diff options
author | marha <marha@users.sourceforge.net> | 2013-01-22 14:27:38 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2013-01-22 14:27:38 +0100 |
commit | 7002c66cfba01e7d3b88dae498a195f78f0e83f5 (patch) | |
tree | 2fbbd202a6a4243f0e64a8b22e22417a609ae19d /xorg-server/hw/xwin | |
parent | 50c07563e17397daf040a32d8fdd3ab397e72371 (diff) | |
parent | 470f7ca9f0be348faf2f03fc16811844c5eeffce (diff) | |
download | vcxsrv-7002c66cfba01e7d3b88dae498a195f78f0e83f5.tar.gz vcxsrv-7002c66cfba01e7d3b88dae498a195f78f0e83f5.tar.bz2 vcxsrv-7002c66cfba01e7d3b88dae498a195f78f0e83f5.zip |
Merge remote-tracking branch 'origin/released'
* origin/released:
fontconfig libfontenc mesa mkfontscale pixman xserver xkeyboard-config
Conflicts:
mesalib/src/mesa/main/syncobj.c
mesalib/src/mesa/main/syncobj.h
xorg-server/hw/xwin/winconfig.c
xorg-server/hw/xwin/winmultiwindowwndproc.c
Diffstat (limited to 'xorg-server/hw/xwin')
-rw-r--r-- | xorg-server/hw/xwin/winblock.c | 32 | ||||
-rwxr-xr-x[-rw-r--r--] | xorg-server/hw/xwin/winconfig.c | 5 | ||||
-rw-r--r-- | xorg-server/hw/xwin/winglobals.h | 4 | ||||
-rw-r--r-- | xorg-server/hw/xwin/winkeybd.c | 8 | ||||
-rw-r--r-- | xorg-server/hw/xwin/winmultiwindowwm.c | 115 | ||||
-rwxr-xr-x[-rw-r--r--] | xorg-server/hw/xwin/winmultiwindowwndproc.c | 64 | ||||
-rw-r--r-- | xorg-server/hw/xwin/wintrayicon.c | 2 | ||||
-rw-r--r-- | xorg-server/hw/xwin/winwakeup.c | 4 | ||||
-rw-r--r-- | xorg-server/hw/xwin/winwindow.h | 1 |
9 files changed, 157 insertions, 78 deletions
diff --git a/xorg-server/hw/xwin/winblock.c b/xorg-server/hw/xwin/winblock.c index a4ae8669f..c3ef4becd 100644 --- a/xorg-server/hw/xwin/winblock.c +++ b/xorg-server/hw/xwin/winblock.c @@ -42,14 +42,26 @@ winBlockHandler(ScreenPtr pScreen, #if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW) winScreenPriv(pScreen); #endif - MSG msg; #ifndef HAS_DEVWINDOWS struct timeval **tvp = pTimeout; if (*tvp != NULL) { + if (GetQueueStatus(QS_ALLINPUT | QS_ALLPOSTMESSAGE) != 0) { + /* If there are still messages to process on the Windows message + queue, make sure select() just polls rather than blocking. + */ + (*tvp)->tv_sec = 0; + (*tvp)->tv_usec = 0; + } + else { + /* Otherwise, lacking /dev/windows, we must wake up again in + a reasonable time to check the Windows message queue. without + noticeable delay. + */ (*tvp)->tv_sec = 0; (*tvp)->tv_usec = 100; + } } #endif @@ -68,24 +80,12 @@ winBlockHandler(ScreenPtr pScreen, if (iReturn != 0) { ErrorF("winBlockHandler - pthread_mutex_unlock () failed: %d\n", iReturn); - goto winBlockHandler_ProcessMessages; } - - winDebug("winBlockHandler - pthread_mutex_unlock () returned\n"); - } - - winBlockHandler_ProcessMessages: -#endif - - /* Process all messages on our queue */ - while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { - if ((g_hDlgDepthChange == 0 - || !IsDialogMessage(g_hDlgDepthChange, &msg)) - && (g_hDlgExit == 0 || !IsDialogMessage(g_hDlgExit, &msg)) - && (g_hDlgAbout == 0 || !IsDialogMessage(g_hDlgAbout, &msg))) { - DispatchMessage(&msg); + else { + winDebug("winBlockHandler - pthread_mutex_unlock () returned\n"); } } +#endif /* At least one X client has asked to suspend the screensaver, so diff --git a/xorg-server/hw/xwin/winconfig.c b/xorg-server/hw/xwin/winconfig.c index 5d36aa89f..11717a506 100644..100755 --- a/xorg-server/hw/xwin/winconfig.c +++ b/xorg-server/hw/xwin/winconfig.c @@ -81,8 +81,7 @@ WinCmdlineRec g_cmdline = { 0 /* emulate3Timeout */ }; -winInfoRec -g_winInfo = { +winInfoRec g_winInfo = { { /* keyboard */ 0, /* leds */ 500, /* delay */ @@ -763,7 +762,7 @@ ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p) break; case OPTV_STRING: if (*s == '\0') { - winDebug ( "Option \"%s\" requires an string value\n", p->name); + winDebug ( "Option \"%s\" requires a string value\n", p->name); p->found = FALSE; } else { diff --git a/xorg-server/hw/xwin/winglobals.h b/xorg-server/hw/xwin/winglobals.h index a7ca6088d..ae2385255 100644 --- a/xorg-server/hw/xwin/winglobals.h +++ b/xorg-server/hw/xwin/winglobals.h @@ -26,6 +26,10 @@ #ifndef WINGLOBALS_H #define WINGLOBALS_H +#ifdef HAVE_XWIN_CONFIG_H +#include <xwin-config.h> +#endif + /* * References to external symbols */ diff --git a/xorg-server/hw/xwin/winkeybd.c b/xorg-server/hw/xwin/winkeybd.c index 8e035956d..1d242a2ba 100644 --- a/xorg-server/hw/xwin/winkeybd.c +++ b/xorg-server/hw/xwin/winkeybd.c @@ -56,7 +56,7 @@ static void static void winKeybdCtrl(DeviceIntPtr pDevice, KeybdCtrl * pCtrl); -/* +/* * Translate a Windows WM_[SYS]KEY(UP/DOWN) message * into an ASCII scan code. * @@ -134,7 +134,7 @@ winKeybdCtrl(DeviceIntPtr pDevice, KeybdCtrl * pCtrl) { } -/* +/* * See Porting Layer Definition - p. 18 * winKeybdProc is known as a DeviceProc. */ @@ -523,8 +523,8 @@ winCheckKeyPressed(WPARAM wParam, LPARAM lParam) return FALSE; } -/* Only on shift release message is sent even if both are pressed. - * Fix this here +/* Only one shift release message is sent even if both are pressed. + * Fix this here */ void winFixShiftKeys(int iScanCode) diff --git a/xorg-server/hw/xwin/winmultiwindowwm.c b/xorg-server/hw/xwin/winmultiwindowwm.c index 424da2bfa..059550c8c 100644 --- a/xorg-server/hw/xwin/winmultiwindowwm.c +++ b/xorg-server/hw/xwin/winmultiwindowwm.c @@ -192,7 +192,7 @@ static void winApplyHints(Display * pDisplay, Window iWindow, HWND hWnd, HWND * zstyle); void - winUpdateWindowPosition(HWND hWnd, Bool reshape, HWND * zstyle); + winUpdateWindowPosition(HWND hWnd, HWND * zstyle); /* * Local globals @@ -560,6 +560,45 @@ UpdateIcon(WMInfoPtr pWMInfo, Window iWindow) winUpdateIcon(hWnd, pWMInfo->pDisplay, iWindow, hIconNew); } +/* + * Updates the style of a HWND according to its X style properties + */ + +static void +UpdateStyle(WMInfoPtr pWMInfo, Window iWindow) +{ + HWND hWnd; + HWND zstyle = HWND_NOTOPMOST; + UINT flags; + + hWnd = getHwnd(pWMInfo, iWindow); + if (!hWnd) + return; + + /* Determine the Window style, which determines borders and clipping region... */ + winApplyHints(pWMInfo->pDisplay, iWindow, hWnd, &zstyle); + winUpdateWindowPosition(hWnd, &zstyle); + + /* Apply the updated window style, without changing it's show or activation state */ + flags = SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE; + if (zstyle == HWND_NOTOPMOST) + flags |= SWP_NOZORDER | SWP_NOOWNERZORDER; + SetWindowPos(hWnd, NULL, 0, 0, 0, 0, flags); + + /* + Use the WS_EX_TOOLWINDOW style to remove window from Alt-Tab window switcher + + According to MSDN, this is supposed to remove the window from the taskbar as well, + if we SW_HIDE before changing the style followed by SW_SHOW afterwards. + + But that doesn't seem to work reliably, and causes the window to flicker, so use + the iTaskbarList interface to tell the taskbar to show or hide this window. + */ + winShowWindowOnTaskbar(hWnd, + (GetWindowLongPtr(hWnd, GWL_EXSTYLE) & + WS_EX_APPWINDOW) ? TRUE : FALSE); +} + #if 0 /* * Fix up any differences between the X11 and Win32 window stacks @@ -691,13 +730,19 @@ winMultiWindowWMProc(void *pArg) (unsigned char *) &(pNode->msg.hwndWindow), 1); UpdateName(pWMInfo, pNode->msg.iWindow); UpdateIcon(pWMInfo, pNode->msg.iWindow); - { - HWND zstyle = HWND_NOTOPMOST; + UpdateStyle(pWMInfo, pNode->msg.iWindow); + - winApplyHints(pWMInfo->pDisplay, pNode->msg.iWindow, - pNode->msg.hwndWindow, &zstyle); - winUpdateWindowPosition(pNode->msg.hwndWindow, TRUE, &zstyle); + /* Reshape */ + { + WindowPtr pWin = + GetProp(pNode->msg.hwndWindow, WIN_WINDOW_PROP); + if (pWin) { + winReshapeMultiWindow(pWin); + winUpdateRgnMultiWindow(pWin); + } } + break; case WM_WM_UNMAP: @@ -750,6 +795,19 @@ winMultiWindowWMProc(void *pArg) UpdateIcon(pWMInfo, pNode->msg.iWindow); break; + case WM_WM_HINTS_EVENT: + { + XWindowAttributes attr; + + /* Don't do anything if this is an override-redirect window */ + XGetWindowAttributes (pWMInfo->pDisplay, pNode->msg.iWindow, &attr); + if (attr.override_redirect) + break; + + UpdateStyle(pWMInfo, pNode->msg.iWindow); + } + break; + case WM_WM_CHANGE_STATE: /* Minimize the window in Windows */ winMinimizeWindow(pNode->msg.iWindow); @@ -800,6 +858,7 @@ winMultiWindowXMsgProc(void *pArg) Atom atmWmHints; Atom atmWmChange; Atom atmNetWmIcon; + Atom atmWindowState, atmMotifWmHints, atmWindowType, atmNormalHints; int iReturn; XIconSize *xis; @@ -926,6 +985,10 @@ winMultiWindowXMsgProc(void *pArg) atmWmHints = XInternAtom(pProcArg->pDisplay, "WM_HINTS", False); atmWmChange = XInternAtom(pProcArg->pDisplay, "WM_CHANGE_STATE", False); atmNetWmIcon = XInternAtom(pProcArg->pDisplay, "_NET_WM_ICON", False); + atmWindowState = XInternAtom(pProcArg->pDisplay, "_NET_WM_STATE", False); + atmMotifWmHints = XInternAtom(pProcArg->pDisplay, "_MOTIF_WM_HINTS", False); + atmWindowType = XInternAtom(pProcArg->pDisplay, "_NET_WM_WINDOW_TYPE", False); + atmNormalHints = XInternAtom(pProcArg->pDisplay, "WM_NORMAL_HINTS", False); /* iiimxcf had a bug until 2009-04-27, assuming that the @@ -1066,14 +1129,34 @@ winMultiWindowXMsgProc(void *pArg) /* Other fields ignored */ winSendMessageToWM(pProcArg->pWMInfo, &msg); } - else if ((event.xproperty.atom == atmWmHints) || - (event.xproperty.atom == atmNetWmIcon)) { - memset(&msg, 0, sizeof(msg)); - msg.msg = WM_WM_ICON_EVENT; - msg.iWindow = event.xproperty.window; + else { + /* + Several properties are considered for WM hints, check if this property change affects any of them... + (this list needs to be kept in sync with winApplyHints()) + */ + if ((event.xproperty.atom == atmWmHints) || + (event.xproperty.atom == atmWindowState) || + (event.xproperty.atom == atmMotifWmHints) || + (event.xproperty.atom == atmWindowType) || + (event.xproperty.atom == atmNormalHints)) { + memset(&msg, 0, sizeof(msg)); + msg.msg = WM_WM_HINTS_EVENT; + msg.iWindow = event.xproperty.window; + + /* Other fields ignored */ + winSendMessageToWM(pProcArg->pWMInfo, &msg); + } - /* Other fields ignored */ - winSendMessageToWM(pProcArg->pWMInfo, &msg); + /* Not an else as WM_HINTS affects both style and icon */ + if ((event.xproperty.atom == atmWmHints) || + (event.xproperty.atom == atmNetWmIcon)) { + memset(&msg, 0, sizeof(msg)); + msg.msg = WM_WM_ICON_EVENT; + msg.iWindow = event.xproperty.window; + + /* Other fields ignored */ + winSendMessageToWM(pProcArg->pWMInfo, &msg); + } } } else if (event.type == ClientMessage @@ -1733,7 +1816,7 @@ winApplyHints(Display * pDisplay, Window iWindow, HWND hWnd, HWND * zstyle) } void -winUpdateWindowPosition(HWND hWnd, Bool reshape, HWND * zstyle) +winUpdateWindowPosition(HWND hWnd, HWND * zstyle) { int iX, iY, iWidth, iHeight; int iDx, iDy; @@ -1778,10 +1861,6 @@ winUpdateWindowPosition(HWND hWnd, Bool reshape, HWND * zstyle) SetWindowPos(hWnd, *zstyle, rcNew.left, rcNew.top, rcNew.right - rcNew.left, rcNew.bottom - rcNew.top, 0); - if (reshape) { - winReshapeMultiWindow(pWin); - winUpdateRgnMultiWindow(pWin); - } } void diff --git a/xorg-server/hw/xwin/winmultiwindowwndproc.c b/xorg-server/hw/xwin/winmultiwindowwndproc.c index 7ceee11a5..abd7672cc 100644..100755 --- a/xorg-server/hw/xwin/winmultiwindowwndproc.c +++ b/xorg-server/hw/xwin/winmultiwindowwndproc.c @@ -46,6 +46,8 @@ #include "winmsg.h" #include "inputstr.h" +extern void winUpdateWindowPosition(HWND hWnd, HWND * zstyle); + #ifdef XKB #ifndef XKB_IN_SERVER #define XKB_IN_SERVER @@ -53,7 +55,6 @@ #include <xkbsrv.h> #endif -extern void winUpdateWindowPosition(HWND hWnd, Bool reshape, HWND * zstyle); /* * Local globals @@ -327,7 +328,7 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) static Bool s_fTracking = FALSE; Bool needRestack = FALSE; LRESULT ret; - static Bool hasEnteredSizeMove = FALSE; + static Bool hasEnteredSizeMove = FALSE; winDebugWin32Message("winTopLevelWindowProc", hwnd, message, wParam, lParam); @@ -863,41 +864,36 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) /* */ if (!pWin->overrideRedirect) { + HWND zstyle = HWND_NOTOPMOST; + /* Flag that this window needs to be made active when clicked */ SetProp(hwnd, WIN_NEEDMANAGE_PROP, (HANDLE) 1); - if (!(GetWindowLongPtr(hwnd, GWL_EXSTYLE) & WS_EX_APPWINDOW)) { - HWND zstyle = HWND_NOTOPMOST; - - /* Set the window extended style flags */ - SetWindowLongPtr(hwnd, GWL_EXSTYLE, WS_EX_APPWINDOW); - - /* Set the transient style flags */ - if (GetParent(hwnd)) - SetWindowLongPtr(hwnd, GWL_STYLE, - WS_POPUP | WS_OVERLAPPED | WS_SYSMENU | - WS_CLIPCHILDREN | WS_CLIPSIBLINGS); - /* Set the window standard style flags */ - else - SetWindowLongPtr(hwnd, GWL_STYLE, - (WS_POPUP | WS_OVERLAPPEDWINDOW | - WS_CLIPCHILDREN | WS_CLIPSIBLINGS) - & ~WS_CAPTION & ~WS_SIZEBOX); - - winUpdateWindowPosition(hwnd, FALSE, &zstyle); - - { - WinXWMHints hints; - - if (winMultiWindowGetWMHints(pWin, &hints)) { - /* - Give the window focus, unless it has an InputHint - which is FALSE (this is used by e.g. glean to - avoid every test window grabbing the focus) - */ - if (!((hints.flags & InputHint) && (!hints.input))) { - SetForegroundWindow(hwnd); - } + /* Set the transient style flags */ + if (GetParent(hwnd)) + SetWindowLongPtr(hwnd, GWL_STYLE, + WS_POPUP | WS_OVERLAPPED | WS_SYSMENU | + WS_CLIPCHILDREN | WS_CLIPSIBLINGS); + /* Set the window standard style flags */ + else + SetWindowLongPtr(hwnd, GWL_STYLE, + (WS_POPUP | WS_OVERLAPPEDWINDOW | + WS_CLIPCHILDREN | WS_CLIPSIBLINGS) + & ~WS_CAPTION & ~WS_SIZEBOX); + + winUpdateWindowPosition(hwnd, &zstyle); + + { + WinXWMHints hints; + + if (winMultiWindowGetWMHints(pWin, &hints)) { + /* + Give the window focus, unless it has an InputHint + which is FALSE (this is used by e.g. glean to + avoid every test window grabbing the focus) + */ + if (!((hints.flags & InputHint) && (!hints.input))) { + SetForegroundWindow(hwnd); } } } diff --git a/xorg-server/hw/xwin/wintrayicon.c b/xorg-server/hw/xwin/wintrayicon.c index 8a3952629..bcea0cc81 100644 --- a/xorg-server/hw/xwin/wintrayicon.c +++ b/xorg-server/hw/xwin/wintrayicon.c @@ -137,7 +137,7 @@ winHandleIconMessage(HWND hwnd, UINT message, break; case WM_LBUTTONUP: /* Restack and bring all windows to top */ - SetForegroundWindow(hwnd); + SetForegroundWindow (pScreenPriv->hwndScreen); #ifdef XWIN_MULTIWINDOWEXTWM if (pScreenInfo->fMWExtWM) diff --git a/xorg-server/hw/xwin/winwakeup.c b/xorg-server/hw/xwin/winwakeup.c index 77c160533..795221a1a 100644 --- a/xorg-server/hw/xwin/winwakeup.c +++ b/xorg-server/hw/xwin/winwakeup.c @@ -43,8 +43,8 @@ winWakeupHandler(ScreenPtr pScreen, { MSG msg; - /* Process all messages on our queue */ - while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { + /* Process one message from our queue */ + if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { if ((g_hDlgDepthChange == 0 || !IsDialogMessage(g_hDlgDepthChange, &msg)) && (g_hDlgExit == 0 || !IsDialogMessage(g_hDlgExit, &msg)) diff --git a/xorg-server/hw/xwin/winwindow.h b/xorg-server/hw/xwin/winwindow.h index f80e5752d..bc4ed5abe 100644 --- a/xorg-server/hw/xwin/winwindow.h +++ b/xorg-server/hw/xwin/winwindow.h @@ -105,6 +105,7 @@ typedef struct _winWMMessageRec { #define WM_WM_CHANGE_STATE (WM_USER + 11) #define WM_WM_MAP2 (WM_USER + 12) #define WM_WM_MAP3 (WM_USER + 13) +#define WM_WM_HINTS_EVENT (WM_USER + 14) #define WM_MANAGE (WM_USER + 100) #define WM_UNMANAGE (WM_USER + 102) #define WM_WM_REINIT (WM_USER + 200) |