aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xwin
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-07-25 09:24:55 +0200
committermarha <marha@users.sourceforge.net>2013-07-25 09:24:55 +0200
commitaf62a89a4e677bc0a10094be86816b2e273b2c4a (patch)
tree3cceb0e23b7ab79dbcedb27c5546cf2666c1c7a0 /xorg-server/hw/xwin
parentde54c5b749b3eefb75d420840c889533a58aa342 (diff)
parentacf3535c75d7c79154b6b89c66567317944d244c (diff)
downloadvcxsrv-af62a89a4e677bc0a10094be86816b2e273b2c4a.tar.gz
vcxsrv-af62a89a4e677bc0a10094be86816b2e273b2c4a.tar.bz2
vcxsrv-af62a89a4e677bc0a10094be86816b2e273b2c4a.zip
Merge remote-tracking branch 'origin/released'
* origin/released: xserver mesa git update 25 Jul 2013 Conflicts: xorg-server/hw/xwin/win.h xorg-server/hw/xwin/winclipboardthread.c xorg-server/hw/xwin/winglobals.c xorg-server/hw/xwin/winmouse.c xorg-server/hw/xwin/winmultiwindowclass.c xorg-server/hw/xwin/winscrinit.c xorg-server/hw/xwin/winwin32rootless.c xorg-server/hw/xwin/winwin32rootlesswndproc.c xorg-server/hw/xwin/winwindow.h xorg-server/hw/xwin/winwindowswm.c xorg-server/hw/xwin/winwndproc.c
Diffstat (limited to 'xorg-server/hw/xwin')
-rw-r--r--xorg-server/hw/xwin/InitOutput.c36
-rw-r--r--xorg-server/hw/xwin/Makefile.am3
-rw-r--r--xorg-server/hw/xwin/glx/Makefile.am4
-rw-r--r--xorg-server/hw/xwin/makefile1
-rw-r--r--xorg-server/hw/xwin/win.h25
-rw-r--r--xorg-server/hw/xwin/winclipboard.h1
-rw-r--r--[-rwxr-xr-x]xorg-server/hw/xwin/winclipboardthread.c87
-rw-r--r--[-rwxr-xr-x]xorg-server/hw/xwin/windialogs.c0
-rw-r--r--xorg-server/hw/xwin/winfillsp.c2
-rw-r--r--xorg-server/hw/xwin/winglobals.c1
-rw-r--r--xorg-server/hw/xwin/winglobals.h2
-rw-r--r--xorg-server/hw/xwin/winkeybd.c62
-rw-r--r--xorg-server/hw/xwin/winmessages.h2
-rw-r--r--xorg-server/hw/xwin/winmouse.c50
-rw-r--r--xorg-server/hw/xwin/winmsgwindow.c180
-rw-r--r--[-rwxr-xr-x]xorg-server/hw/xwin/winmultiwindowclass.c30
-rw-r--r--xorg-server/hw/xwin/winmultiwindowicons.c4
-rw-r--r--[-rwxr-xr-x]xorg-server/hw/xwin/winmultiwindowwindow.c0
-rw-r--r--xorg-server/hw/xwin/winmultiwindowwm.c36
-rw-r--r--xorg-server/hw/xwin/winmultiwindowwndproc.c16
-rw-r--r--xorg-server/hw/xwin/winscrinit.c2
-rw-r--r--xorg-server/hw/xwin/winwin32rootless.c44
-rw-r--r--xorg-server/hw/xwin/winwin32rootlesswindow.c4
-rw-r--r--xorg-server/hw/xwin/winwin32rootlesswndproc.c27
-rw-r--r--[-rwxr-xr-x]xorg-server/hw/xwin/winwindow.c0
-rw-r--r--xorg-server/hw/xwin/winwindow.h15
-rw-r--r--xorg-server/hw/xwin/winwindowswm.c6
-rw-r--r--xorg-server/hw/xwin/winwndproc.c23
28 files changed, 472 insertions, 191 deletions
diff --git a/xorg-server/hw/xwin/InitOutput.c b/xorg-server/hw/xwin/InitOutput.c
index f194d535f..c45de8331 100644
--- a/xorg-server/hw/xwin/InitOutput.c
+++ b/xorg-server/hw/xwin/InitOutput.c
@@ -183,6 +183,25 @@ ddxBeforeReset(void)
}
#endif
+int
+main(int argc, char *argv[], char *envp[])
+{
+ int iReturn;
+
+ /* Create & acquire the termination mutex */
+ iReturn = pthread_mutex_init(&g_pmTerminating, NULL);
+ if (iReturn != 0) {
+ ErrorF("ddxMain - pthread_mutex_init () failed: %d\n", iReturn);
+ }
+
+ iReturn = pthread_mutex_lock(&g_pmTerminating);
+ if (iReturn != 0) {
+ ErrorF("ddxMain - pthread_mutex_lock () failed: %d\n", iReturn);
+ }
+
+ return dix_main(argc, argv, envp);
+}
+
/* See Porting Layer Definition - p. 57 */
void
ddxGiveUp(enum ExitCode error)
@@ -238,6 +257,19 @@ ddxGiveUp(enum ExitCode error)
/* Tell Windows that we want to end the app */
PostQuitMessage(0);
+
+ {
+ winDebug("ddxGiveUp - Releasing termination mutex\n");
+
+ int iReturn = pthread_mutex_unlock(&g_pmTerminating);
+
+ if (iReturn != 0) {
+ ErrorF("winMsgWindowProc - pthread_mutex_unlock () failed: %d\n",
+ iReturn);
+ }
+ }
+
+ winDebug("ddxGiveUp - End\n");
}
/* See Porting Layer Definition - p. 57 */
@@ -978,6 +1010,10 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char *argv[])
/* Store the instance handle */
g_hInstance = GetModuleHandle(NULL);
+ /* Create the messaging window */
+ if (serverGeneration == 1)
+ winCreateMsgWindowThread();
+
/* Initialize each screen */
for (i = 0; i < g_iNumScreens; ++i) {
/* Initialize the screen */
diff --git a/xorg-server/hw/xwin/Makefile.am b/xorg-server/hw/xwin/Makefile.am
index 9bfe66d9d..3f27b4dd2 100644
--- a/xorg-server/hw/xwin/Makefile.am
+++ b/xorg-server/hw/xwin/Makefile.am
@@ -92,6 +92,7 @@ SRCS = InitInput.c \
winmonitors.c \
winmouse.c \
winmsg.c \
+ winmsgwindow.c \
winmultiwindowclass.c \
winmultiwindowicons.c \
winprefs.c \
@@ -154,7 +155,7 @@ INCLUDES = -I$(top_srcdir)/miext/rootless
XWIN_SYS_LIBS += -ldxguid
-XWin_DEPENDENCIES = $(MULTIWINDOWEXTWM_LIBS) $(XWIN_GLX_LIBS) $(XWIN_LIBS) $(MAIN_LIB) $(XSERVER_LIBS)
+XWin_DEPENDENCIES = $(MULTIWINDOWEXTWM_LIBS) $(XWIN_GLX_LIBS) $(XWIN_LIBS) $(XSERVER_LIBS)
XWin_LDADD = $(MULTIWINDOW_LIBS) $(MULTIWINDOWEXTWM_LIBS) $(XWIN_GLX_LIBS) $(XWIN_GLX_LINK_FLAGS) $(XWIN_LIBS) $(MAIN_LIB) $(XSERVER_LIBS) $(XSERVER_SYS_LIBS) $(XWIN_SYS_LIBS)
XWin_LDFLAGS = -mwindows -static
diff --git a/xorg-server/hw/xwin/glx/Makefile.am b/xorg-server/hw/xwin/glx/Makefile.am
index 59f6879a7..f969af277 100644
--- a/xorg-server/hw/xwin/glx/Makefile.am
+++ b/xorg-server/hw/xwin/glx/Makefile.am
@@ -33,10 +33,10 @@ AM_CFLAGS = -DHAVE_XWIN_CONFIG_H $(DIX_CFLAGS) \
if XWIN_GLX_WINDOWS
generated_gl_wrappers.c: gen_gl_wrappers.py $(KHRONOS_SPEC_DIR)/gl.spec $(KHRONOS_SPEC_DIR)/gl.tm
- $(AM_V_GEN)$(srcdir)/gen_gl_wrappers.py --spec=$(KHRONOS_SPEC_DIR)/gl.spec --typemap=$(KHRONOS_SPEC_DIR)/gl.tm --dispatch-header=$(top_srcdir)/glx/dispatch.h --staticwrappers >generated_gl_wrappers.c
+ $(AM_V_GEN)$(PYTHON) $(srcdir)/gen_gl_wrappers.py --spec=$(KHRONOS_SPEC_DIR)/gl.spec --typemap=$(KHRONOS_SPEC_DIR)/gl.tm --dispatch-header=$(top_srcdir)/glx/dispatch.h --staticwrappers >generated_gl_wrappers.c
generated_wgl_wrappers.c: gen_gl_wrappers.py $(KHRONOS_SPEC_DIR)/wglext.spec $(KHRONOS_SPEC_DIR)/wgl.tm
- $(AM_V_GEN)$(srcdir)/gen_gl_wrappers.py --spec=$(KHRONOS_SPEC_DIR)/wglext.spec --typemap=$(KHRONOS_SPEC_DIR)/wgl.tm --prefix=wgl --preresolve >generated_wgl_wrappers.c
+ $(AM_V_GEN)$(PYTHON) $(srcdir)/gen_gl_wrappers.py --spec=$(KHRONOS_SPEC_DIR)/wglext.spec --typemap=$(KHRONOS_SPEC_DIR)/wgl.tm --prefix=wgl --preresolve >generated_wgl_wrappers.c
endif
BUILT_SOURCES = generated_gl_wrappers.c generated_wgl_wrappers.c
diff --git a/xorg-server/hw/xwin/makefile b/xorg-server/hw/xwin/makefile
index 6ed7d7f54..f09cee19d 100644
--- a/xorg-server/hw/xwin/makefile
+++ b/xorg-server/hw/xwin/makefile
@@ -99,6 +99,7 @@ SRCS = InitInput.c \
winmonitors.c \
winmouse.c \
winmsg.c \
+ winmsgwindow.c \
winmultiwindowclass.c \
winmultiwindowicons.c \
winprefs.c \
diff --git a/xorg-server/hw/xwin/win.h b/xorg-server/hw/xwin/win.h
index 875605241..1d3448a44 100644
--- a/xorg-server/hw/xwin/win.h
+++ b/xorg-server/hw/xwin/win.h
@@ -42,15 +42,9 @@
#define YES 1
#endif
-/* WM_XBUTTON Messages. They should go into w32api. */
-#ifndef WM_XBUTTONDOWN
-#define WM_XBUTTONDOWN 523
-#endif
-#ifndef WM_XBUTTONUP
-#define WM_XBUTTONUP 524
-#endif
-#ifndef WM_XBUTTONDBLCLK
-#define WM_XBUTTONDBLCLK 525
+/* We can handle WM_MOUSEHWHEEL even though _WIN32_WINNT < 0x0600 */
+#ifndef WM_MOUSEHWHEEL
+#define WM_MOUSEHWHEEL 0x020E
#endif
#define WIN_DEFAULT_BPP 0
@@ -423,6 +417,7 @@ typedef struct _winPrivScreenRec {
Bool fBadDepth;
int iDeltaZ;
+ int iDeltaV;
int iConnectedClients;
@@ -889,8 +884,8 @@ void
* winkeybd.c
*/
-void
- winTranslateKey(WPARAM wParam, LPARAM lParam, int *piScanCode);
+int
+ winTranslateKey(WPARAM wParam, LPARAM lParam);
int
winKeybdProc(DeviceIntPtr pDeviceInt, int iState);
@@ -954,7 +949,7 @@ int
winMouseProc(DeviceIntPtr pDeviceInt, int iState);
int
- winMouseWheel(ScreenPtr pScreen, int iDeltaZ);
+ winMouseWheel(int *iTotalDeltaZ, int iDeltaZ, int iButtonUp, int iButtonDown);
void
winMouseButtonsSendEvent(int iEventType, int iButton);
@@ -1375,6 +1370,12 @@ winDoRandRScreenSetSize(ScreenPtr pScreen,
CARD16 height, CARD32 mmWidth, CARD32 mmHeight);
/*
+ * winmsgwindow.c
+ */
+Bool
+winCreateMsgWindowThread(void);
+
+/*
* END DDX and DIX Function Prototypes
*/
diff --git a/xorg-server/hw/xwin/winclipboard.h b/xorg-server/hw/xwin/winclipboard.h
index 7d5db98fe..550eeb26c 100644
--- a/xorg-server/hw/xwin/winclipboard.h
+++ b/xorg-server/hw/xwin/winclipboard.h
@@ -70,7 +70,6 @@ typedef int pid_t;
#define WIN_JMP_ERROR_IO 2
#define WIN_LOCAL_PROPERTY "CYGX_CUT_BUFFER"
#define WIN_XEVENTS_SUCCESS 0
-#define WIN_XEVENTS_SHUTDOWN 1
#define WIN_XEVENTS_CONVERT 2
#define WIN_XEVENTS_NOTIFY 3
diff --git a/xorg-server/hw/xwin/winclipboardthread.c b/xorg-server/hw/xwin/winclipboardthread.c
index d000b0205..488a00fcc 100755..100644
--- a/xorg-server/hw/xwin/winclipboardthread.c
+++ b/xorg-server/hw/xwin/winclipboardthread.c
@@ -53,11 +53,11 @@
extern Bool g_fUnicodeClipboard;
extern Bool g_fClipboardStarted;
-extern Bool g_fClipboardLaunched;
+extern Bool g_fClipboardLaunched;
extern HWND g_hwndClipboard;
extern void *g_pClipboardDisplay;
extern Window g_iClipboardWindow;
-extern Bool g_fClipboardPrimary;
+extern Bool g_fClipboardPrimary;
/*
* Global variables
@@ -199,7 +199,7 @@ winClipboardProc(void *pvNotUsed)
fdMessageQueue = open (WIN_MSG_QUEUE_FNAME, _O_RDONLY);
if (fdMessageQueue == -1) {
ErrorF("winClipboardProc - Failed opening %s\n", WIN_MSG_QUEUE_FNAME);
- goto thread_errorexit;
+ goto thread_errorexit;
}
/* Find max of our file descriptors */
@@ -240,27 +240,27 @@ winClipboardProc(void *pvNotUsed)
/* Assert ownership of selections if Win32 clipboard is owned */
if (NULL != GetClipboardOwner()) {
- if (g_fClipboardPrimary)
- {
- /* PRIMARY */
- winDebug("winClipboardProc - asserted ownership.\n");
- iReturn = XSetSelectionOwner (pDisplay, XA_PRIMARY,
- iWindow, CurrentTime);
- if (iReturn == BadAtom || iReturn == BadWindow /*||
- XGetSelectionOwner (pDisplay, XA_PRIMARY) != iWindow*/)
- {
- ErrorF ("winClipboardProc - Could not set PRIMARY owner\n");
- goto thread_errorexit;
- }
- }
+ if (g_fClipboardPrimary)
+ {
+ /* PRIMARY */
+ winDebug("winClipboardProc - asserted ownership.\n");
+ iReturn = XSetSelectionOwner (pDisplay, XA_PRIMARY,
+ iWindow, CurrentTime);
+ if (iReturn == BadAtom || iReturn == BadWindow /*||
+ XGetSelectionOwner (pDisplay, XA_PRIMARY) != iWindow*/)
+ {
+ ErrorF ("winClipboardProc - Could not set PRIMARY owner\n");
+ goto thread_errorexit;
+ }
+ }
/* CLIPBOARD */
iReturn = XSetSelectionOwner(pDisplay, atomClipboard,
iWindow, CurrentTime);
- if (iReturn == BadAtom || iReturn == BadWindow /*||
- XGetSelectionOwner (pDisplay, atomClipboard) != iWindow*/)
- {
- ErrorF ("winClipboardProc - Could not set CLIPBOARD owner\n");
+ if (iReturn == BadAtom || iReturn == BadWindow /*||
+ XGetSelectionOwner (pDisplay, atomClipboard) != iWindow*/)
+ {
+ ErrorF ("winClipboardProc - Could not set CLIPBOARD owner\n");
goto thread_errorexit;
}
}
@@ -334,19 +334,12 @@ winClipboardProc(void *pvNotUsed)
}
/* Branch on which descriptor became active */
-// if (FD_ISSET (iConnectionNumber, &fdsRead))
-// { Also do it when no read since winClipboardFlushXEvents
-// is sending the output.
+// if (FD_ISSET (iConnectionNumber, &fdsRead)) {
+// Also do it when no read since winClipboardFlushXEvents
+// is sending the output.
/* Process X events */
- /* Exit when we see that server is shutting down */
- iReturn = winClipboardFlushXEvents(hwnd,
- iWindow, pDisplay, fUseUnicode, FALSE);
- if (WIN_XEVENTS_SHUTDOWN == iReturn) {
- ErrorF("winClipboardProc - winClipboardFlushXEvents "
- "trapped shutdown event, exiting main loop.\n");
- break;
- }
-// }
+ winClipboardFlushXEvents(hwnd, iWindow, pDisplay, fUseUnicode, FALSE);
+// }
#ifdef HAS_DEVWINDOWS
/* Check for Windows event ready */
@@ -403,25 +396,25 @@ winClipboardProc(void *pvNotUsed)
goto commonexit;
thread_errorexit:
- if (g_pClipboardDisplay && g_iClipboardWindow)
- {
- iReturn = XDestroyWindow (g_pClipboardDisplay, g_iClipboardWindow);
- if (iReturn == BadWindow)
- ErrorF ("winClipboardProc - XDestroyWindow returned BadWindow.\n");
+ if (g_pClipboardDisplay && g_iClipboardWindow)
+ {
+ iReturn = XDestroyWindow (g_pClipboardDisplay, g_iClipboardWindow);
+ if (iReturn == BadWindow)
+ ErrorF ("winClipboardProc - XDestroyWindow returned BadWindow.\n");
#ifdef WINDBG
- else
- winDebug ("winClipboardProc - XDestroyWindow succeeded.\n");
+ else
+ winDebug ("winClipboardProc - XDestroyWindow succeeded.\n");
#endif
- }
- winDebug ("Clipboard thread died.\n");
+ }
+ winDebug ("Clipboard thread died.\n");
commonexit:
- g_iClipboardWindow = None;
- g_pClipboardDisplay = NULL;
- g_fClipboardLaunched = FALSE;
- g_fClipboardStarted = FALSE;
+ g_iClipboardWindow = None;
+ g_pClipboardDisplay = NULL;
+ g_fClipboardLaunched = FALSE;
+ g_fClipboardStarted = FALSE;
- pthread_cleanup_pop(0);
+ pthread_cleanup_pop(0);
return NULL;
}
@@ -458,7 +451,7 @@ winClipboardErrorHandler(Display * pDisplay, XErrorEvent * pErr)
static int
winClipboardIOErrorHandler(Display * pDisplay)
{
- ErrorF("winClipboardIOErrorHandler!\n\n");
+ ErrorF("winClipboardIOErrorHandler!\n");
if (pthread_equal(pthread_self(), g_winClipboardProcThread)) {
/* Restart at the main entry point */
diff --git a/xorg-server/hw/xwin/windialogs.c b/xorg-server/hw/xwin/windialogs.c
index 3e3bd401c..3e3bd401c 100755..100644
--- a/xorg-server/hw/xwin/windialogs.c
+++ b/xorg-server/hw/xwin/windialogs.c
diff --git a/xorg-server/hw/xwin/winfillsp.c b/xorg-server/hw/xwin/winfillsp.c
index f2432ed23..bd0a15e8a 100644
--- a/xorg-server/hw/xwin/winfillsp.c
+++ b/xorg-server/hw/xwin/winfillsp.c
@@ -118,7 +118,7 @@ winFillSpansNativeGDI(DrawablePtr pDrawable,
if (hbmpOrig == NULL)
FatalError("winFillSpans - DRAWABLE_PIXMAP - "
"SelectObject () failed on\n\tpPixmapPriv->hBitmap: "
- "%08x\n", (unsigned int) pPixmapPriv->hBitmap);
+ "%p\n", pPixmapPriv->hBitmap);
/* Branch on the fill type */
switch (pGC->fillStyle) {
diff --git a/xorg-server/hw/xwin/winglobals.c b/xorg-server/hw/xwin/winglobals.c
index 32f09f2bb..59287cadb 100644
--- a/xorg-server/hw/xwin/winglobals.c
+++ b/xorg-server/hw/xwin/winglobals.c
@@ -79,6 +79,7 @@ Bool g_fSoftwareCursor = FALSE;
Bool g_fSilentDupError = FALSE;
Bool g_fNativeGl = TRUE;
Bool g_fswrastwgl = FALSE;
+pthread_mutex_t g_pmTerminating = PTHREAD_MUTEX_INITIALIZER;
#ifdef XWIN_CLIPBOARD
/*
diff --git a/xorg-server/hw/xwin/winglobals.h b/xorg-server/hw/xwin/winglobals.h
index ae2385255..81ceca31c 100644
--- a/xorg-server/hw/xwin/winglobals.h
+++ b/xorg-server/hw/xwin/winglobals.h
@@ -90,4 +90,6 @@ extern Bool g_fButton[3];
extern Bool g_fNoConfigureWindow;
#endif
+extern pthread_mutex_t g_pmTerminating;
+
#endif /* WINGLOBALS_H */
diff --git a/xorg-server/hw/xwin/winkeybd.c b/xorg-server/hw/xwin/winkeybd.c
index b88bb6f80..54e1847d7 100644
--- a/xorg-server/hw/xwin/winkeybd.c
+++ b/xorg-server/hw/xwin/winkeybd.c
@@ -65,13 +65,14 @@ static void
* like AltGr on European keyboards.
*/
-void
-winTranslateKey(WPARAM wParam, LPARAM lParam, int *piScanCode)
+int
+winTranslateKey(WPARAM wParam, LPARAM lParam)
{
int iKeyFixup = g_iKeyMap[wParam * WIN_KEYMAP_COLS + 1];
int iKeyFixupEx = g_iKeyMap[wParam * WIN_KEYMAP_COLS + 2];
int iParam = HIWORD(lParam);
int iParamScanCode = LOBYTE(iParam);
+ int iScanCode;
winDebug("winTranslateKey: wParam %08x lParam %08x\n", wParam, lParam);
@@ -96,23 +97,25 @@ winTranslateKey(WPARAM wParam, LPARAM lParam, int *piScanCode)
/* Branch on special extended, special non-extended, or normal key */
if ((iParam & KF_EXTENDED) && iKeyFixupEx)
- *piScanCode = iKeyFixupEx;
+ iScanCode = iKeyFixupEx;
else if (iKeyFixup)
- *piScanCode = iKeyFixup;
+ iScanCode = iKeyFixup;
else if (wParam == 0 && iParamScanCode == 0x70)
- *piScanCode = KEY_HKTG;
+ iScanCode = KEY_HKTG;
else
switch (iParamScanCode) {
case 0x70:
- *piScanCode = KEY_HKTG;
+ iScanCode = KEY_HKTG;
break;
case 0x73:
- *piScanCode = KEY_BSlash2;
+ iScanCode = KEY_BSlash2;
break;
default:
- *piScanCode = iParamScanCode;
+ iScanCode = iParamScanCode;
break;
}
+
+ return iScanCode;
}
/* Ring the keyboard bell (system speaker on PCs) */
@@ -278,25 +281,38 @@ winRestoreModeKeyStates(void)
/* Check if modifier keys are pressed, and if so, fake a press */
{
- BOOL ctrl = (GetAsyncKeyState(VK_CONTROL) < 0);
- BOOL shift = (GetAsyncKeyState(VK_SHIFT) < 0);
+
+ BOOL lctrl = (GetAsyncKeyState(VK_LCONTROL) < 0);
+ BOOL rctrl = (GetAsyncKeyState(VK_RCONTROL) < 0);
+ BOOL lshift = (GetAsyncKeyState(VK_LSHIFT) < 0);
+ BOOL rshift = (GetAsyncKeyState(VK_RSHIFT) < 0);
BOOL alt = (GetAsyncKeyState(VK_LMENU) < 0);
BOOL altgr = (GetAsyncKeyState(VK_RMENU) < 0);
- if (ctrl && altgr)
- ctrl = FALSE;
+ /*
+ If AltGr and CtrlL appear to be pressed, assume the
+ CtrL is a fake one
+ */
+ if (lctrl && altgr)
+ lctrl = FALSE;
+
+ if (lctrl)
+ winSendKeyEvent(KEY_LCtrl, TRUE);
- if (LOGICAL_XOR(internalKeyStates & ControlMask, ctrl))
- winSendKeyEvent(KEY_LCtrl, ctrl);
+ if (rctrl)
+ winSendKeyEvent(KEY_RCtrl, TRUE);
- if (LOGICAL_XOR(internalKeyStates & ShiftMask, shift))
- winSendKeyEvent(KEY_ShiftL, shift);
+ if (lshift)
+ winSendKeyEvent(KEY_ShiftL, TRUE);
- if (LOGICAL_XOR(internalKeyStates & Mod1Mask, alt))
- winSendKeyEvent(KEY_Alt, alt);
+ if (rshift)
+ winSendKeyEvent(KEY_ShiftL, TRUE);
- if (LOGICAL_XOR(internalKeyStates & Mod5Mask, altgr))
- winSendKeyEvent(KEY_AltLang, altgr);
+ if (alt)
+ winSendKeyEvent(KEY_Alt, TRUE);
+
+ if (altgr)
+ winSendKeyEvent(KEY_AltLang, TRUE);
}
/*
@@ -327,6 +343,12 @@ winRestoreModeKeyStates(void)
winSendKeyEvent(KEY_HKTG, TRUE);
winSendKeyEvent(KEY_HKTG, FALSE);
}
+
+ /*
+ For strict correctness, we should also press any non-modifier keys
+ which are already down when we gain focus, but nobody has complained
+ yet :-)
+ */
}
/*
diff --git a/xorg-server/hw/xwin/winmessages.h b/xorg-server/hw/xwin/winmessages.h
index 3d3fab274..8282f8b06 100644
--- a/xorg-server/hw/xwin/winmessages.h
+++ b/xorg-server/hw/xwin/winmessages.h
@@ -529,7 +529,7 @@ static const char *MESSAGE_NAMES[1024] = {
"WM_XBUTTONDOWN",
"WM_XBUTTONUP",
"WM_XBUTTONDBLCLK",
- "526",
+ "WM_MOUSEHWHEEL",
"527",
"WM_PARENTNOTIFY",
"WM_ENTERMENULOOP",
diff --git a/xorg-server/hw/xwin/winmouse.c b/xorg-server/hw/xwin/winmouse.c
index 63081d62c..6b293f0ab 100644
--- a/xorg-server/hw/xwin/winmouse.c
+++ b/xorg-server/hw/xwin/winmouse.c
@@ -63,7 +63,7 @@ winMouseProc(DeviceIntPtr pDeviceInt, int iState)
int lngWheelEvents = 4;
CARD8 *map;
DevicePtr pDevice = (DevicePtr) pDeviceInt;
- Atom *btn_labels;
+ Atom btn_labels[9];
Atom axes_labels[2];
switch (iState) {
@@ -75,15 +75,23 @@ winMouseProc(DeviceIntPtr pDeviceInt, int iState)
/* Mapping of windows events to X events:
* LEFT:1 MIDDLE:2 RIGHT:3
* SCROLL_UP:4 SCROLL_DOWN:5
- * XBUTTON 1:6 XBUTTON 2:7 ...
+ * TILT_LEFT:6 TILT_RIGHT:7
+ * XBUTTON 1:8 XBUTTON 2:9 (most commonly 'back' and 'forward')
+ * ...
*
+ * The current Windows API only defines 2 extra buttons, so we don't
+ * expect more than 5 buttons to be reported, but more than that
+ * should be handled correctly
+ */
+
+ /*
* To map scroll wheel correctly we need at least the 3 normal buttons
*/
if (lngMouseButtons < 3)
lngMouseButtons = 3;
- /* allocate memory:
- * number of buttons + 2x mouse wheel event + 1 extra (offset for map)
+ /* allocate memory:
+ * number of buttons + 4 x mouse wheel event + 1 extra (offset for map)
*/
map = malloc(sizeof(CARD8) * (lngMouseButtons + lngWheelEvents + 1));
@@ -92,14 +100,15 @@ winMouseProc(DeviceIntPtr pDeviceInt, int iState)
for (i = 1; i <= lngMouseButtons + lngWheelEvents; i++)
map[i] = i;
- btn_labels = calloc((lngMouseButtons + lngWheelEvents), sizeof(Atom));
btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT);
btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE);
btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT);
btn_labels[3] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_UP);
btn_labels[4] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_DOWN);
- btn_labels[5] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_LEFT);
- btn_labels[6] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_RIGHT);
+ btn_labels[5] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_LEFT);
+ btn_labels[6] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_RIGHT);
+ btn_labels[7] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_BACK);
+ btn_labels[8] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_FORWARD);
axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X);
axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y);
@@ -111,7 +120,6 @@ winMouseProc(DeviceIntPtr pDeviceInt, int iState)
(PtrCtrlProcPtr)NoopDDA,
GetMotionHistorySize(), 2, axes_labels);
free(map);
- free(btn_labels);
g_winMouseButtonMap = pDeviceInt->button->map;
break;
@@ -132,20 +140,16 @@ winMouseProc(DeviceIntPtr pDeviceInt, int iState)
/* Handle the mouse wheel */
int
-winMouseWheel(ScreenPtr pScreen, int iDeltaZ)
+winMouseWheel(int *iTotalDeltaZ, int iDeltaZ, int iButtonUp, int iButtonDown)
{
- winScreenPriv(pScreen);
- int button; /* Button4 or Button5 */
-
- /* Button4 = WheelUp */
- /* Button5 = WheelDown */
+ int button;
/* Do we have any previous delta stored? */
- if ((pScreenPriv->iDeltaZ > 0 && iDeltaZ > 0)
- || (pScreenPriv->iDeltaZ < 0 && iDeltaZ < 0)) {
+ if ((*iTotalDeltaZ > 0 && iDeltaZ > 0)
+ || (*iTotalDeltaZ < 0 && iDeltaZ < 0)) {
/* Previous delta and of same sign as current delta */
- iDeltaZ += pScreenPriv->iDeltaZ;
- pScreenPriv->iDeltaZ = 0;
+ iDeltaZ += *iTotalDeltaZ;
+ *iTotalDeltaZ = 0;
}
else {
/*
@@ -154,7 +158,7 @@ winMouseWheel(ScreenPtr pScreen, int iDeltaZ)
* as blindly setting takes just as much time
* as checking, then setting if necessary :)
*/
- pScreenPriv->iDeltaZ = 0;
+ *iTotalDeltaZ = 0;
}
/*
@@ -162,7 +166,7 @@ winMouseWheel(ScreenPtr pScreen, int iDeltaZ)
* WHEEL_DELTA
*/
if (iDeltaZ >= WHEEL_DELTA || (-1 * iDeltaZ) >= WHEEL_DELTA) {
- pScreenPriv->iDeltaZ = 0;
+ *iTotalDeltaZ = 0;
/* Figure out how many whole deltas of the wheel we have */
iDeltaZ /= WHEEL_DELTA;
@@ -173,16 +177,16 @@ winMouseWheel(ScreenPtr pScreen, int iDeltaZ)
* we will store the wheel delta until the threshold
* has been reached.
*/
- pScreenPriv->iDeltaZ = iDeltaZ;
+ *iTotalDeltaZ = iDeltaZ;
return 0;
}
/* Set the button to indicate up or down wheel delta */
if (iDeltaZ > 0) {
- button = Button4;
+ button = iButtonUp;
}
else {
- button = Button5;
+ button = iButtonDown;
}
/*
diff --git a/xorg-server/hw/xwin/winmsgwindow.c b/xorg-server/hw/xwin/winmsgwindow.c
new file mode 100644
index 000000000..8067c693c
--- /dev/null
+++ b/xorg-server/hw/xwin/winmsgwindow.c
@@ -0,0 +1,180 @@
+/*
+ * Copyright (C) Jon TURNEY 2011
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#include "win.h"
+
+/*
+ * This is the messaging window, a hidden top-level window. We never do anything
+ * with it, but other programs may send messages to it.
+ */
+
+/*
+ * winMsgWindowProc - Window procedure for msg window
+ */
+
+static
+LRESULT CALLBACK
+winMsgWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+#if CYGDEBUG
+ winDebugWin32Message("winMsgWindowProc", hwnd, message, wParam, lParam);
+#endif
+
+ switch (message) {
+ case WM_ENDSESSION:
+ if (!wParam)
+ return 0; /* shutdown is being cancelled */
+
+ /*
+ Send a WM_GIVEUP message to the X server thread so it wakes up if
+ blocked in select(), performs GiveUp(), and then notices that GiveUp()
+ has set the DE_TERMINATE flag so exits the msg dispatch loop.
+ */
+ {
+ ScreenPtr pScreen = screenInfo.screens[0];
+
+ winScreenPriv(pScreen);
+ PostMessage(pScreenPriv->hwndScreen, WM_GIVEUP, 0, 0);
+ }
+
+ /*
+ This process will be terminated by the system almost immediately
+ after the last thread with a message queue returns from processing
+ WM_ENDSESSION, so we cannot rely on any code executing after this
+ message is processed and need to wait here until ddxGiveUp() is called
+ and releases the termination mutex to guarantee that the lock file and
+ unix domain sockets have been removed
+
+ ofc, Microsoft doesn't document this under WM_ENDSESSION, you are supposed
+ to read the source of CRSS to find out how it works :-)
+
+ http://blogs.msdn.com/b/michen/archive/2008/04/04/application-termination-when-user-logs-off.aspx
+ */
+ {
+ int iReturn = pthread_mutex_lock(&g_pmTerminating);
+
+ if (iReturn != 0) {
+ ErrorF("winMsgWindowProc - pthread_mutex_lock () failed: %d\n",
+ iReturn);
+ }
+ winDebug
+ ("winMsgWindowProc - WM_ENDSESSION termination lock acquired\n");
+ }
+
+ return 0;
+ }
+
+ return DefWindowProc(hwnd, message, wParam, lParam);
+}
+
+static HWND
+winCreateMsgWindow(void)
+{
+ HWND hwndMsg;
+ wATOM winClass;
+
+ // register window class
+ {
+ WNDCLASSEX wcx;
+
+ wcx.cbSize = sizeof(WNDCLASSEX);
+ wcx.style = CS_HREDRAW | CS_VREDRAW;
+ wcx.lpfnWndProc = winMsgWindowProc;
+ wcx.cbClsExtra = 0;
+ wcx.cbWndExtra = 0;
+ wcx.hInstance = g_hInstance;
+ wcx.hIcon = NULL;
+ wcx.hCursor = 0;
+ wcx.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
+ wcx.lpszMenuName = NULL;
+ wcx.lpszClassName = WINDOW_CLASS_X_MSG;
+ wcx.hIconSm = NULL;
+ winClass = RegisterClassEx(&wcx);
+ }
+
+ // Create the msg window.
+ hwndMsg = CreateWindowEx(0, // no extended styles
+ WINDOW_CLASS_X_MSG, // class name
+ "XWin Msg Window", // window name
+ WS_OVERLAPPEDWINDOW, // overlapped window
+ CW_USEDEFAULT, // default horizontal position
+ CW_USEDEFAULT, // default vertical position
+ CW_USEDEFAULT, // default width
+ CW_USEDEFAULT, // default height
+ (HWND) NULL, // no parent or owner window
+ (HMENU) NULL, // class menu used
+ GetModuleHandle(NULL), // instance handle
+ NULL); // no window creation data
+
+ if (!hwndMsg) {
+ ErrorF("winCreateMsgWindow - Create msg window failed\n");
+ return NULL;
+ }
+
+ winDebug("winCreateMsgWindow - Created msg window hwnd 0x%x\n", hwndMsg);
+
+ return hwndMsg;
+}
+
+static void *
+winMsgWindowThreadProc(void *arg)
+{
+ HWND hwndMsg;
+
+ winDebug("winMsgWindowThreadProc - Hello\n");
+
+ hwndMsg = winCreateMsgWindow();
+ if (hwndMsg) {
+ MSG msg;
+
+ /* Pump the msg window message queue */
+ while (GetMessage(&msg, hwndMsg, 0, 0) > 0) {
+#if CYGDEBUG
+ winDebugWin32Message("winMsgWindowThread", msg.hwnd, msg.message,
+ msg.wParam, msg.lParam);
+#endif
+ DispatchMessage(&msg);
+ }
+ }
+
+ winDebug("winMsgWindowThreadProc - Exit\n");
+
+ return NULL;
+}
+
+Bool
+winCreateMsgWindowThread(void)
+{
+ pthread_t ptMsgWindowThreadProc;
+
+ /* Spawn a thread for the msg window */
+ if (pthread_create(&ptMsgWindowThreadProc,
+ NULL, winMsgWindowThreadProc, NULL)) {
+ /* Bail if thread creation failed */
+ ErrorF("winCreateMsgWindow - pthread_create failed.\n");
+ return FALSE;
+ }
+
+ return TRUE;
+}
diff --git a/xorg-server/hw/xwin/winmultiwindowclass.c b/xorg-server/hw/xwin/winmultiwindowclass.c
index 1e544ec5f..ec283610e 100755..100644
--- a/xorg-server/hw/xwin/winmultiwindowclass.c
+++ b/xorg-server/hw/xwin/winmultiwindowclass.c
@@ -68,7 +68,12 @@ winMultiWindowGetClassHint(WindowPtr pWin, char **res_name, char **res_class)
while (prop) {
if (prop->propertyName == XA_WM_CLASS
&& prop->type == XA_STRING && prop->format == 8 && prop->data) {
- len_name = strnlen((char *) prop->data, prop->size);
+ /*
+ WM_CLASS property should consist of 2 null terminated strings, but we
+ must handle the cases when one or both is absent or not null terminated
+ */
+ len_name = strlen((char *) prop->data);
+ if (len_name > prop->size) len_name = prop->size;
(*res_name) = malloc(len_name + 1);
@@ -77,19 +82,13 @@ winMultiWindowGetClassHint(WindowPtr pWin, char **res_name, char **res_class)
return 0;
}
- /* Add one to len_name to allow copying of trailing 0 */
- memcpy((*res_name), prop->data, len_name );
- (*res_name)[len_name]='\0';
+ /* Copy name and ensure null terminated */
+ strncpy((*res_name), prop->data, len_name);
+ (*res_name)[len_name] = '\0';
- if (len_name < prop->size-1)
- {
- // It could be that the string is not null terminated
- len_class = strnlen(((char *) prop->data) + 1 + len_name, prop->size-1-len_name);
- }
- else
- {
- len_class = 0;
- }
+ /* Compute length of class name, it could be that it is absent or not null terminated */
+ len_class = (len_name >= prop->size) ? 0 : (strlen(((char *) prop->data) + 1 + len_name));
+ if (len_class > prop->size - 1 - len_name) len_class = prop->size - 1 - len_name;
(*res_class) = malloc(len_class + 1);
@@ -101,8 +100,9 @@ winMultiWindowGetClassHint(WindowPtr pWin, char **res_name, char **res_class)
return 0;
}
- memcpy((*res_class), ((char *) prop->data) + 1 + len_name, len_class);
- (*res_class)[len_class]='\0';
+ /* Copy class name and ensure null terminated */
+ strncpy((*res_class), ((char *) prop->data) + 1 + len_name, len_class);
+ (*res_class)[len_class] = '\0';
return 1;
}
diff --git a/xorg-server/hw/xwin/winmultiwindowicons.c b/xorg-server/hw/xwin/winmultiwindowicons.c
index 74c4b8dfe..74d0af1ba 100644
--- a/xorg-server/hw/xwin/winmultiwindowicons.c
+++ b/xorg-server/hw/xwin/winmultiwindowicons.c
@@ -259,6 +259,10 @@ NetWMToWinIconAlpha(uint32_t * icon)
DIB_RGB_COLORS, (void **) &DIB_pixels, NULL,
0);
ReleaseDC(NULL, hdc);
+
+ if (!ii.hbmColor)
+ return NULL;
+
ii.hbmMask = CreateBitmap(width, height, 1, 1, NULL);
memcpy(DIB_pixels, pixels, height * width * 4);
diff --git a/xorg-server/hw/xwin/winmultiwindowwindow.c b/xorg-server/hw/xwin/winmultiwindowwindow.c
index 94956863b..94956863b 100755..100644
--- a/xorg-server/hw/xwin/winmultiwindowwindow.c
+++ b/xorg-server/hw/xwin/winmultiwindowwindow.c
diff --git a/xorg-server/hw/xwin/winmultiwindowwm.c b/xorg-server/hw/xwin/winmultiwindowwm.c
index e8fbf08c0..8cd1e0dbb 100644
--- a/xorg-server/hw/xwin/winmultiwindowwm.c
+++ b/xorg-server/hw/xwin/winmultiwindowwm.c
@@ -1407,7 +1407,7 @@ winMultiWindowWMErrorHandler(Display * pDisplay, XErrorEvent * pErr)
static int
winMultiWindowWMIOErrorHandler(Display * pDisplay)
{
- ErrorF("winMultiWindowWMIOErrorHandler!\n\n");
+ ErrorF("winMultiWindowWMIOErrorHandler!\n");
if (pthread_equal(pthread_self(), g_winMultiWindowWMThread)) {
if (g_shutdown)
@@ -1456,7 +1456,7 @@ winMultiWindowXMsgProcErrorHandler(Display * pDisplay, XErrorEvent * pErr)
static int
winMultiWindowXMsgProcIOErrorHandler(Display * pDisplay)
{
- ErrorF("winMultiWindowXMsgProcIOErrorHandler!\n\n");
+ ErrorF("winMultiWindowXMsgProcIOErrorHandler!\n");
if (pthread_equal(pthread_self(), g_winMultiWindowXMsgProcThread)) {
/* Restart at the main entry point */
@@ -1586,23 +1586,27 @@ winApplyHints(Display * pDisplay, Window iWindow, HWND hWnd, HWND * zstyle)
}
if (XGetWindowProperty(pDisplay, iWindow, windowState, 0L,
- 1L, False, XA_ATOM, &type, &format,
+ MAXINT, False, XA_ATOM, &type, &format,
&nitems, &left,
(unsigned char **) &pAtom) == Success) {
- if (pAtom && nitems == 1) {
- if (*pAtom == skiptaskbarState)
- hint |= HINT_SKIPTASKBAR;
- if (*pAtom == hiddenState)
- maxmin |= HINT_MIN;
- else if (*pAtom == fullscreenState)
- maxmin |= HINT_MAX;
- if (*pAtom == belowState)
- *zstyle = HWND_BOTTOM;
- else if (*pAtom == aboveState)
- *zstyle = HWND_TOPMOST;
- }
- if (pAtom)
+ if (pAtom ) {
+ unsigned long i;
+
+ for (i = 0; i < nitems; i++) {
+ if (pAtom[i] == skiptaskbarState)
+ hint |= HINT_SKIPTASKBAR;
+ if (pAtom[i] == hiddenState)
+ maxmin |= HINT_MIN;
+ else if (pAtom[i] == fullscreenState)
+ maxmin |= HINT_MAX;
+ if (pAtom[i] == belowState)
+ *zstyle = HWND_BOTTOM;
+ else if (pAtom[i] == aboveState)
+ *zstyle = HWND_TOPMOST;
+ }
+
XFree(pAtom);
+ }
}
nitems = left = 0;
diff --git a/xorg-server/hw/xwin/winmultiwindowwndproc.c b/xorg-server/hw/xwin/winmultiwindowwndproc.c
index b52d5990b..1488a657c 100644
--- a/xorg-server/hw/xwin/winmultiwindowwndproc.c
+++ b/xorg-server/hw/xwin/winmultiwindowwndproc.c
@@ -655,7 +655,7 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
break;
SetCapture(hwnd);
- return winMouseButtonsHandle(s_pScreen, ButtonPress, HIWORD(wParam) + 5,
+ return winMouseButtonsHandle(s_pScreen, ButtonPress, HIWORD(wParam) + 7,
wParam);
case WM_XBUTTONUP:
@@ -664,7 +664,7 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
ReleaseCapture();
winStartMousePolling(s_pScreenPriv);
return winMouseButtonsHandle(s_pScreen, ButtonRelease,
- HIWORD(wParam) + 5, wParam);
+ HIWORD(wParam) + 7, wParam);
case WM_MOUSEWHEEL:
if (SendMessage
@@ -678,6 +678,18 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
else
break;
+ case WM_MOUSEHWHEEL:
+ if (SendMessage
+ (hwnd, WM_NCHITTEST, 0,
+ MAKELONG(GET_X_LPARAM(lParam),
+ GET_Y_LPARAM(lParam))) == HTCLIENT) {
+ /* Pass the message to the root window */
+ SendMessage(hwndScreen, message, wParam, lParam);
+ return 0;
+ }
+ else
+ break;
+
case WM_SETFOCUS:
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
break;
diff --git a/xorg-server/hw/xwin/winscrinit.c b/xorg-server/hw/xwin/winscrinit.c
index 90d084d3f..ae52f8a2c 100644
--- a/xorg-server/hw/xwin/winscrinit.c
+++ b/xorg-server/hw/xwin/winscrinit.c
@@ -690,7 +690,7 @@ winFinishScreenInitNativeGDI(int i,
pScreenPriv->fEnabled = TRUE;
winDebug ("winFinishScreenInitNativeGDI - Successful addition of "
- "screen %08x\n", (unsigned int) pScreen);
+ "screen %p\n", pScreen);
return TRUE;
}
diff --git a/xorg-server/hw/xwin/winwin32rootless.c b/xorg-server/hw/xwin/winwin32rootless.c
index b0de5697d..7ea7f0c4d 100644
--- a/xorg-server/hw/xwin/winwin32rootless.c
+++ b/xorg-server/hw/xwin/winwin32rootless.c
@@ -304,8 +304,8 @@ winMWExtWMCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen,
winMWExtWMReshapeFrame(pFrame->wid, pShape);
}
- winDebug("winMWExtWMCreateFrame - (%08x) %08x\n",
- (int) pFrame->wid, (int) pRLWinPriv->hWnd);
+ winDebug("winMWExtWMCreateFrame - (%p) %p\n",
+ pFrame->wid, pRLWinPriv->hWnd);
winMWExtWMSetNativeProperty(pFrame);
@@ -322,8 +322,8 @@ winMWExtWMDestroyFrame(RootlessFrameID wid)
int iReturn;
char pszClass[CLASS_NAME_LENGTH];
- winDebug("winMWExtWMDestroyFrame (%08x) %08x\n",
- (int) pRLWinPriv, (int) pRLWinPriv->hWnd);
+ winDebug("winMWExtWMDestroyFrame (%p) %p\n",
+ pRLWinPriv, pRLWinPriv->hWnd);
/* Store the info we need to destroy after this window is gone */
hInstance = (HINSTANCE) GetClassLongPtr(pRLWinPriv->hWnd, GCLP_HMODULE);
@@ -361,7 +361,7 @@ winMWExtWMMoveFrame(RootlessFrameID wid, ScreenPtr pScreen, int iNewX,
DWORD dwStyle;
int iX, iY, iWidth, iHeight;
- winDebug("winMWExtWMMoveFrame (%08x) (%d %d)\n", (int) pRLWinPriv, iNewX,
+ winDebug("winMWExtWMMoveFrame (%p) (%d %d)\n", pRLWinPriv, iNewX,
iNewY);
/* Get the Windows window style and extended style */
@@ -395,7 +395,7 @@ winMWExtWMMoveFrame(RootlessFrameID wid, ScreenPtr pScreen, int iNewX,
SetWindowPos(pRLWinPriv->hWnd, NULL, rcNew.left, rcNew.top, 0, 0,
SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER);
g_fNoConfigureWindow = FALSE;
- winDebug("winMWExtWMMoveFrame (%08x) done\n", (int) pRLWinPriv);
+ winDebug("winMWExtWMMoveFrame (%p) done\n", pRLWinPriv);
}
void
@@ -411,8 +411,8 @@ winMWExtWMResizeFrame(RootlessFrameID wid, ScreenPtr pScreen,
DWORD dwStyle;
int iX, iY;
- winDebug("winMWExtWMResizeFrame (%08x) (%d %d)-(%d %d)\n",
- (int) pRLWinPriv, iNewX, iNewY, uiNewWidth, uiNewHeight);
+ winDebug("winMWExtWMResizeFrame (%p) (%d %d)-(%d %d)\n",
+ pRLWinPriv, iNewX, iNewY, uiNewWidth, uiNewHeight);
pRLWinPriv->fResized = TRUE;
@@ -461,7 +461,7 @@ winMWExtWMRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid)
Bool fFirst = TRUE;
Bool fNeedRestack = TRUE;
- winDebug("winMWExtWMRestackFrame (%08x)\n", (int) pRLWinPriv);
+ winDebug("winMWExtWMRestackFrame (%p)\n", pRLWinPriv);
if (pScreenPriv && pScreenPriv->fRestacking)
@@ -540,7 +540,7 @@ winMWExtWMRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid)
SetWindowPos(pRLWinPriv->hWnd, pRLNextWinPriv->hWnd,
0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
}
- winDebug("winMWExtWMRestackFrame - done (%08x)\n", (int) pRLWinPriv);
+ winDebug("winMWExtWMRestackFrame - done (%p)\n", pRLWinPriv);
pRLWinPriv->fRestackingNow = FALSE;
}
@@ -552,7 +552,7 @@ winMWExtWMReshapeFrame(RootlessFrameID wid, RegionPtr pShape)
HRGN hRgn, hRgnWindow, hRgnClient;
RECT rcWindow, rcClient;
- winDebug("winMWExtWMReshapeFrame (%08x)\n", (int) pRLWinPriv);
+ winDebug("winMWExtWMReshapeFrame (%p)\n", pRLWinPriv);
hRgn = winMWExtWMCreateRgnFromRegion(pShape);
@@ -579,7 +579,7 @@ winMWExtWMUnmapFrame(RootlessFrameID wid)
{
win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
- winDebug("winMWExtWMUnmapFrame (%08x)\n", (int) pRLWinPriv);
+ winDebug("winMWExtWMUnmapFrame (%p)\n", pRLWinPriv);
g_fNoConfigureWindow = TRUE;
//ShowWindow (pRLWinPriv->hWnd, SW_MINIMIZE);
@@ -602,7 +602,7 @@ winMWExtWMStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow)
HDC hdcNew;
HBITMAP hbmpNew;
- winDebug("winMWExtWMStartDrawing (%08x) %08x\n", (int) pRLWinPriv,
+ winDebug("winMWExtWMStartDrawing (%p) %08x\n", pRLWinPriv,
pRLWinPriv->fDestroyed);
if (!pRLWinPriv->fDestroyed) {
@@ -612,8 +612,8 @@ winMWExtWMStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow)
if (pScreenPriv)
pScreenInfo = pScreenPriv->pScreenInfo;
- winDebug("\tpScreenPriv %08X\n", (int) pScreenPriv);
- winDebug("\tpScreenInfo %08X\n", (int) pScreenInfo);
+ winDebug("\tpScreenPriv %p\n", pScreenPriv);
+ winDebug("\tpScreenInfo %p\n", pScreenInfo);
winDebug("\t(%d, %d)\n", (int) pRLWinPriv->pFrame->width,
(int) pRLWinPriv->pFrame->height);
@@ -715,9 +715,9 @@ winMWExtWMStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow)
else {
ErrorF("winMWExtWMStartDrawing - Already window was destroyed \n");
}
- winDebug("winMWExtWMStartDrawing - done (0x%08x) 0x%08x %d\n",
- (int) pRLWinPriv,
- (unsigned int) pRLWinPriv->pfb,
+ winDebug("winMWExtWMStartDrawing - done (%p) %p %d\n",
+ pRLWinPriv,
+ pRLWinPriv->pfb,
(unsigned int) pRLWinPriv->dwWidthBytes);
*pixelData = pRLWinPriv->pfb;
*bytesPerRow = pRLWinPriv->dwWidthBytes;
@@ -764,8 +764,8 @@ winMWExtWMRootlessSwitchWindow(RootlessWindowPtr pFrame, WindowPtr oldWin)
{
win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) pFrame->wid;
- winDebug("winMWExtWMRootlessSwitchWindow (%08x) %08x\n",
- (int) pRLWinPriv, (int) pRLWinPriv->hWnd);
+ winDebug("winMWExtWMRootlessSwitchWindow (%p) %p\n",
+ pRLWinPriv, pRLWinPriv->hWnd);
pRLWinPriv->pFrame = pFrame;
pRLWinPriv->fResized = TRUE;
@@ -795,8 +795,8 @@ winMWExtWMCopyWindow(RootlessFrameID wid, int nDstRects,
const BoxRec *pEnd;
RECT rcDmg;
- winDebug("winMWExtWMCopyWindow (%08x, %d, %08x, %d, %d)\n",
- (int) pRLWinPriv, nDstRects, (int) pDstRects, nDx, nDy);
+ winDebug("winMWExtWMCopyWindow (%p, %d, %p, %d, %d)\n",
+ pRLWinPriv, nDstRects, pDstRects, nDx, nDy);
for (pEnd = pDstRects + nDstRects; pDstRects < pEnd; pDstRects++) {
winDebug("BitBlt (%d, %d, %d, %d) (%d, %d)\n",
diff --git a/xorg-server/hw/xwin/winwin32rootlesswindow.c b/xorg-server/hw/xwin/winwin32rootlesswindow.c
index 46f203c33..693fbcec0 100644
--- a/xorg-server/hw/xwin/winwin32rootlesswindow.c
+++ b/xorg-server/hw/xwin/winwin32rootlesswindow.c
@@ -208,8 +208,8 @@ winMWExtWMUpdateWindowDecoration(win32RootlessWindowPtr pRLWinPriv,
showCmd |= SWP_NOMOVE | SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOZORDER;
- winDebug("winMWExtWMUpdateWindowDecoration %08x %s\n",
- (int) pRLWinPriv, fDecorate ? "Decorate" : "Bare");
+ winDebug("winMWExtWMUpdateWindowDecoration %p %s\n",
+ pRLWinPriv, fDecorate ? "Decorate" : "Bare");
/* Get the extended window style information */
dwExStyle = GetWindowLongPtr(pRLWinPriv->hWnd, GWL_EXSTYLE);
diff --git a/xorg-server/hw/xwin/winwin32rootlesswndproc.c b/xorg-server/hw/xwin/winwin32rootlesswndproc.c
index 13a9cd645..0c5856d6e 100644
--- a/xorg-server/hw/xwin/winwin32rootlesswndproc.c
+++ b/xorg-server/hw/xwin/winwin32rootlesswndproc.c
@@ -648,13 +648,13 @@ winMWExtWMWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput)
break;
SetCapture(hwnd);
- return winMouseButtonsHandle(pScreen, ButtonPress, HIWORD(wParam) + 5,
+ return winMouseButtonsHandle(pScreen, ButtonPress, HIWORD(wParam) + 7,
wParam);
case WM_XBUTTONUP:
if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput)
break;
ReleaseCapture();
- return winMouseButtonsHandle(pScreen, ButtonRelease, HIWORD(wParam) + 5,
+ return winMouseButtonsHandle(pScreen, ButtonRelease, HIWORD(wParam) + 7,
wParam);
case WM_MOUSEWHEEL:
@@ -666,6 +666,15 @@ winMWExtWMWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
SendMessage(hwndScreen, message, wParam, lParam);
return 0;
+ case WM_MOUSEHWHEEL:
+#if CYGMULTIWINDOW_DEBUG
+ winDebug("winMWExtWMWindowProc - WM_MOUSEHWHEEL\n");
+#endif
+
+ /* Pass the message to the root window */
+ SendMessage(hwndScreen, message, wParam, lParam);
+ return 0;
+
case WM_MOUSEACTIVATE:
winDebug("winMWExtWMWindowProc - WM_MOUSEACTIVATE\n");
@@ -820,8 +829,8 @@ winMWExtWMWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
pWinPos = (LPWINDOWPOS) lParam;
if (!(pWinPos->flags & SWP_NOZORDER)) {
if (pRLWinPriv->fRestackingNow || pScreenPriv->fRestacking) {
- winDebug("Win %08x is now restacking.\n",
- (unsigned int) pRLWinPriv);
+ winDebug("Win %p is now restacking.\n",
+ pRLWinPriv);
break;
}
@@ -830,14 +839,14 @@ winMWExtWMWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
winIsInternalWMRunning(pScreenInfo) ||
#endif
IsRaiseOnClick (pWin))
- winDebug("Win %08x has WINDOWSWM_RAISE_ON_CLICK.\n",
- (unsigned int) pRLWinPriv);
+ winDebug("Win %p has WINDOWSWM_RAISE_ON_CLICK.\n",
+ pRLWinPriv);
break;
}
- winDebug("Win %08x forbid to change z order (%08x).\n",
- (unsigned int) pRLWinPriv,
- (unsigned int) pWinPos->hwndInsertAfter);
+ winDebug("Win %p forbid to change z order (%p).\n",
+ pRLWinPriv,
+ pWinPos->hwndInsertAfter);
pWinPos->flags |= SWP_NOZORDER;
}
break;
diff --git a/xorg-server/hw/xwin/winwindow.c b/xorg-server/hw/xwin/winwindow.c
index e3bac41d9..e3bac41d9 100755..100644
--- a/xorg-server/hw/xwin/winwindow.c
+++ b/xorg-server/hw/xwin/winwindow.c
diff --git a/xorg-server/hw/xwin/winwindow.h b/xorg-server/hw/xwin/winwindow.h
index 0b4713a27..3ab7148d7 100644
--- a/xorg-server/hw/xwin/winwindow.h
+++ b/xorg-server/hw/xwin/winwindow.h
@@ -44,20 +44,21 @@
#define PROJECT_NAME "VcXsrv"
#endif
#define EXECUTABLE_NAME "VcXsrv"
-#define WINDOW_CLASS "VcXsrv/x"
-#define WINDOW_TITLE PROJECT_NAME " Server - Display %s:%s.%d"
-#define WINDOW_TITLE_XDMCP PROJECT_NAME " Server - %s - Display %s:%s.%d"
+#define WINDOW_CLASS "VcXsrv/x"
+#define WINDOW_TITLE PROJECT_NAME " Server - Display %s:%s.%d"
+#define WINDOW_TITLE_XDMCP PROJECT_NAME " Server - %s - Display %s:%s.%d"
extern const char WIN_SCR_PROP[];
-#define WINDOW_CLASS_X "vcxsrv/x X rl"
-#define WINDOW_TITLE_X PROJECT_NAME " X"
+#define WINDOW_CLASS_X "vcxsrv/x X rl"
+#define WINDOW_CLASS_X_MSG "vcxsrv/x X msg"
+#define WINDOW_TITLE_X PROJECT_NAME " X"
extern const char WIN_WINDOW_PROP[];
#ifdef HAS_DEVWINDOWS
-#define WIN_MSG_QUEUE_FNAME "/dev/windows"
+#define WIN_MSG_QUEUE_FNAME "/dev/windows"
#endif
extern const char WIN_WID_PROP[];
extern const char WIN_NEEDMANAGE_PROP[];
-#define VCXSRV_SIGNATURE 0xdeaddeadL
+#define VCXSRV_SIGNATURE 0xdeaddeadL
typedef struct _winPrivScreenRec *winPrivScreenPtr;
diff --git a/xorg-server/hw/xwin/winwindowswm.c b/xorg-server/hw/xwin/winwindowswm.c
index 70e0419bb..36f4ce0ae 100644
--- a/xorg-server/hw/xwin/winwindowswm.c
+++ b/xorg-server/hw/xwin/winwindowswm.c
@@ -242,7 +242,7 @@ winWindowsWMSendEvent(int type, unsigned int mask, int which, int arg,
return;
for (pEvent = *pHead; pEvent; pEvent = pEvent->next) {
client = pEvent->client;
- winDebug ("winWindowsWMSendEvent - x%08x\n", (int) client);
+ winDebug ("winWindowsWMSendEvent - %p\n", client);
if ((pEvent->mask & mask) == 0) {
continue;
}
@@ -366,8 +366,8 @@ ProcWindowsWMFrameDraw(ClientPtr client)
if (pRLWinPriv == 0)
return BadWindow;
- winDebug ("ProcWindowsWMFrameDraw - HWND 0x%08x 0x%08x 0x%08x\n",
- (int) pRLWinPriv->hWnd, (int) stuff->frame_style,
+ winDebug ("ProcWindowsWMFrameDraw - HWND %p 0x%08x 0x%08x\n",
+ pRLWinPriv->hWnd, (int) stuff->frame_style,
(int) stuff->frame_style_ex);
winDebug ("ProcWindowsWMFrameDraw - %d %d %d %d\n",
stuff->ix, stuff->iy, stuff->iw, stuff->ih);
diff --git a/xorg-server/hw/xwin/winwndproc.c b/xorg-server/hw/xwin/winwndproc.c
index a121d0698..6d4cb3a51 100644
--- a/xorg-server/hw/xwin/winwndproc.c
+++ b/xorg-server/hw/xwin/winwndproc.c
@@ -889,7 +889,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
#endif
)
SetCapture(hwnd);
- return winMouseButtonsHandle(s_pScreen, ButtonPress, HIWORD(wParam) + 5,
+ return winMouseButtonsHandle(s_pScreen, ButtonPress, HIWORD(wParam) + 7,
wParam);
case WM_XBUTTONUP:
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
@@ -901,7 +901,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
)
ReleaseCapture();
return winMouseButtonsHandle(s_pScreen, ButtonRelease,
- HIWORD(wParam) + 5, wParam);
+ HIWORD(wParam) + 7, wParam);
case WM_TIMER:
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
@@ -969,7 +969,18 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
break;
winDebug("winWindowProc - WM_MOUSEWHEEL\n");
- winMouseWheel(s_pScreen, GET_WHEEL_DELTA_WPARAM(wParam));
+ /* Button4 = WheelUp */
+ /* Button5 = WheelDown */
+ winMouseWheel(&(s_pScreenPriv->iDeltaZ), GET_WHEEL_DELTA_WPARAM(wParam), Button4, Button5);
+ break;
+
+ case WM_MOUSEHWHEEL:
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ winDebug("winWindowProc - WM_MOUSEHWHEEL\n");
+ /* Button7 = TiltRight */
+ /* Button6 = TiltLeft */
+ winMouseWheel(&(s_pScreenPriv->iDeltaV), GET_WHEEL_DELTA_WPARAM(wParam), 7, 6);
break;
case WM_SETFOCUS:
@@ -1049,7 +1060,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
}
/* Translate Windows key code to X scan code */
- winTranslateKey(wParam, lParam, &iScanCode);
+ iScanCode = winTranslateKey(wParam, lParam);
/* Ignore repeats for CapsLock */
if (wParam == VK_CAPITAL)
@@ -1070,7 +1081,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
return 0;
/* Enqueue a keyup event */
- winTranslateKey(wParam, lParam, &iScanCode);
+ iScanCode = winTranslateKey(wParam, lParam);
winSendKeyEvent(iScanCode, FALSE);
/* Release all pressed shift keys */
@@ -1122,6 +1133,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
/* Clear any lingering wheel delta */
s_pScreenPriv->iDeltaZ = 0;
+ s_pScreenPriv->iDeltaV = 0;
/* Reshow the Windows mouse cursor if we are being deactivated */
if (g_fSoftwareCursor && LOWORD(wParam) == WA_INACTIVE && !g_fCursor) {
@@ -1194,7 +1206,6 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
}
break;
- case WM_ENDSESSION:
case WM_GIVEUP:
/* Tell X that we are giving up */
#ifdef XWIN_MULTIWINDOW