xserver: Branch 'master' - 13 commits

Keith Packard keithp at kemper.freedesktop.org
Sun Jan 20 16:14:12 PST 2013


 hw/xwin/winSetAppUserModelID.c  |    1 
 hw/xwin/winblock.c              |   32 +++++------
 hw/xwin/winglobals.h            |    4 +
 hw/xwin/winkeybd.c              |    8 +-
 hw/xwin/winmultiwindowwm.c      |  115 +++++++++++++++++++++++++++++++++-------
 hw/xwin/winmultiwindowwndproc.c |   61 +++++++++------------
 hw/xwin/wintrayicon.c           |    2 
 hw/xwin/winwakeup.c             |    4 -
 hw/xwin/winwindow.h             |    1 
 include/xwin-config.h.in        |    3 +
 10 files changed, 157 insertions(+), 74 deletions(-)

New commits:
commit 069d8ed3eb659c48dd2b0f8b7b8c11f092fdb362
Merge: 591c062 d6dcde7
Author: Keith Packard <keithp at keithp.com>
Date:   Sun Jan 20 15:58:38 2013 -0800

    Merge remote-tracking branch 'jturney/xserver-next'

commit d6dcde7a03bb38c17ffc4ec5f0ca1c161e54569f
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Sat Feb 11 12:22:17 2012 +0000

    hw/xwin: Stop assuming WS_EX_APPWINDOW style in WM_SHOWWINDOW
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>

diff --git a/hw/xwin/winmultiwindowwndproc.c b/hw/xwin/winmultiwindowwndproc.c
index f7c6f2b..0e46ea7 100644
--- a/hw/xwin/winmultiwindowwndproc.c
+++ b/hw/xwin/winmultiwindowwndproc.c
@@ -870,41 +870,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, &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);
                     }
                 }
             }
commit 56e94403f8f9182e05428d895a983371c7737d2a
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Wed Jan 9 20:15:01 2013 +0000

    hw/xwin: Use ITaskBarList interface to ensure show-on-taskbar state is updated correctly
    
    Use ITaskBarList interface to ensure that the taskbar notices if the window has
    changed it's style in a way which affects if the taskbar shows it or not.
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>

diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c
index 0c6b09a..4f6dec7 100644
--- a/hw/xwin/winmultiwindowwm.c
+++ b/hw/xwin/winmultiwindowwm.c
@@ -614,6 +614,19 @@ UpdateStyle(WMInfoPtr pWMInfo, Window iWindow)
     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
commit c94d1cb0a49106f44714f4511720a197cc549164
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Thu Jan 10 14:35:56 2013 +0000

    hw/xwin: Ensure full styling is applied when the window is mapped
    
    Move styling update code from WM_WM_HINTS_EVENT to a function UpdateStyle(),
    which is also invoked from WM_WM_MAP3, so everything which needs to be done
    to style the window happens when it is mapped
    
    (Otherwise, the appearance of the window is sensitive to the timing of the
    notification of the windows appearance hint properties being set relative to
    window creation. e.g. see [1])
    
    [1] http://sourceware.org/ml/cygwin-xfree/2012-06/msg00004.html
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>

diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c
index 1dc31fd..0c6b09a 100644
--- a/hw/xwin/winmultiwindowwm.c
+++ b/hw/xwin/winmultiwindowwm.c
@@ -590,6 +590,32 @@ 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);
+}
+
 #if 0
 /*
  * Fix up any differences between the X11 and Win32 window stacks
@@ -737,13 +763,8 @@ 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, &zstyle);
-            }
 
             /* Reshape */
             {
@@ -815,8 +836,6 @@ winMultiWindowWMProc(void *pArg)
 
         case WM_WM_HINTS_EVENT:
             {
-            HWND zstyle = HWND_NOTOPMOST;
-            UINT flags;
             XWindowAttributes attr;
 
             /* Don't do anything if this is an override-redirect window */
@@ -824,18 +843,7 @@ winMultiWindowWMProc(void *pArg)
             if (attr.override_redirect)
               break;
 
-            pNode->msg.hwndWindow = getHwnd(pWMInfo, pNode->msg.iWindow);
-
-            /* Determine the Window style, which determines borders and clipping region... */
-            winApplyHints(pWMInfo->pDisplay, pNode->msg.iWindow,
-                          pNode->msg.hwndWindow, &zstyle);
-            winUpdateWindowPosition(pNode->msg.hwndWindow, &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(pNode->msg.hwndWindow, NULL, 0, 0, 0, 0, flags);
+            UpdateStyle(pWMInfo, pNode->msg.iWindow);
             }
             break;
 
commit ef61f8cacc84080c9156675f9ce26a27e8a90ac1
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Sat Mar 31 18:45:28 2012 +0100

    hw/xwin: Make sure that WM_WM_HINTS_EVENT does nothing for override-redirect windows
    
    Future work: It looks like this code could be rationalized quite a lot: It might
    make sense to pull the checking for override-redirect up out of UpdateIcon() and
    UpdateName() and consolidate WM_WM_MAP2 and WM_WM_MAP3
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>

diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c
index 1200243..1dc31fd 100644
--- a/hw/xwin/winmultiwindowwm.c
+++ b/hw/xwin/winmultiwindowwm.c
@@ -817,6 +817,12 @@ winMultiWindowWMProc(void *pArg)
             {
             HWND zstyle = HWND_NOTOPMOST;
             UINT flags;
+            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;
 
             pNode->msg.hwndWindow = getHwnd(pWMInfo, pNode->msg.iWindow);
 
commit 3628559e594fcbdfcc14b1e8fa60aa841f184e19
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Sun Feb 5 11:25:39 2012 +0000

    hw/xwin: Add a new WM_WM_HINTS_EVENT event to update window style
    
    Add a new WM_WM_HINTS_EVENT event to update window style if any of the
    properties which affect window style change
    
    Check PropertyNotify events for any of the window properties which we consider
    to decide on the window style, and update the window style by sending a
    WM_WM_HINTS_EVENT message to the WM.
    
    This allows the styling of the window to change during it's lifetime.
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>

diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c
index feefcf4..1200243 100644
--- a/hw/xwin/winmultiwindowwm.c
+++ b/hw/xwin/winmultiwindowwm.c
@@ -813,6 +813,26 @@ winMultiWindowWMProc(void *pArg)
             UpdateIcon(pWMInfo, pNode->msg.iWindow);
             break;
 
+        case WM_WM_HINTS_EVENT:
+            {
+            HWND zstyle = HWND_NOTOPMOST;
+            UINT flags;
+
+            pNode->msg.hwndWindow = getHwnd(pWMInfo, pNode->msg.iWindow);
+
+            /* Determine the Window style, which determines borders and clipping region... */
+            winApplyHints(pWMInfo->pDisplay, pNode->msg.iWindow,
+                          pNode->msg.hwndWindow, &zstyle);
+            winUpdateWindowPosition(pNode->msg.hwndWindow, &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(pNode->msg.hwndWindow, NULL, 0, 0, 0, 0, flags);
+            }
+            break;
+
         case WM_WM_CHANGE_STATE:
             /* Minimize the window in Windows */
             winMinimizeWindow(pNode->msg.iWindow);
@@ -862,6 +882,7 @@ winMultiWindowXMsgProc(void *pArg)
     Atom atmWmHints;
     Atom atmWmChange;
     Atom atmNetWmIcon;
+    Atom atmWindowState, atmMotifWmHints, atmWindowType, atmNormalHints;
     int iReturn;
     XIconSize *xis;
 
@@ -988,6 +1009,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
@@ -1125,14 +1150,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
diff --git a/hw/xwin/winwindow.h b/hw/xwin/winwindow.h
index 37b9752..25826ec 100644
--- a/hw/xwin/winwindow.h
+++ b/hw/xwin/winwindow.h
@@ -110,6 +110,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)
 
commit 066ecbd11d516ea68d7ebc7470232d01c5717546
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Thu Jan 10 14:37:45 2013 +0000

    hw/xwin: Move reshape code from winUpdateWindowPosition() to the map event handler
    
    Move reshape code, which was only used when handling a map event, from
    winUpdateWindowPosition(), to put it explicitly in the map event handler.
    
    Remove 'reshape' parameter from winUpdatePosition().
    
    (Note that there's no handling of the ShapeNotify event to notice when the
    window shape changes, instead we hook the screen SetShape procedure and reshape
    the native window then)
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>

diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c
index 773fc97..feefcf4 100644
--- a/hw/xwin/winmultiwindowwm.c
+++ b/hw/xwin/winmultiwindowwm.c
@@ -186,7 +186,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
@@ -742,8 +742,19 @@ winMultiWindowWMProc(void *pArg)
 
                 winApplyHints(pWMInfo->pDisplay, pNode->msg.iWindow,
                               pNode->msg.hwndWindow, &zstyle);
-                winUpdateWindowPosition(pNode->msg.hwndWindow, TRUE, &zstyle);
+                winUpdateWindowPosition(pNode->msg.hwndWindow, &zstyle);
             }
+
+            /* Reshape */
+            {
+                WindowPtr pWin =
+                    GetProp(pNode->msg.hwndWindow, WIN_WINDOW_PROP);
+                if (pWin) {
+                    winReshapeMultiWindow(pWin);
+                    winUpdateRgnMultiWindow(pWin);
+                }
+            }
+
             break;
 
         case WM_WM_UNMAP:
@@ -1749,7 +1760,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;
@@ -1800,8 +1811,4 @@ 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);
-    }
 }
diff --git a/hw/xwin/winmultiwindowwndproc.c b/hw/xwin/winmultiwindowwndproc.c
index c2292c6..f7c6f2b 100644
--- a/hw/xwin/winmultiwindowwndproc.c
+++ b/hw/xwin/winmultiwindowwndproc.c
@@ -42,7 +42,7 @@
 #include "winmsg.h"
 #include "inputstr.h"
 
-extern void winUpdateWindowPosition(HWND hWnd, Bool reshape, HWND * zstyle);
+extern void winUpdateWindowPosition(HWND hWnd, HWND * zstyle);
 
 /*
  * Local globals
@@ -891,7 +891,7 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
                                       WS_CLIPCHILDREN | WS_CLIPSIBLINGS)
                                      & ~WS_CAPTION & ~WS_SIZEBOX);
 
-                winUpdateWindowPosition(hwnd, FALSE, &zstyle);
+                winUpdateWindowPosition(hwnd, &zstyle);
 
                 {
                     WinXWMHints hints;
commit 852d1fb042f4160fe023a015f1c9a34126bf911a
Author: Ryan Pavlik <rpavlik at iastate.edu>
Date:   Sat Dec 1 16:58:40 2012 +0000

    hw/xwin: Add missing include xwin-config.h to winglobals.h
    
    winglobals.h checks if RELOCATE_PROJECTROOT is defined to see if a declaration
    of g_fLogFileChanged is needed, so must include xwin-config.h
    
    Signed-off-by: Ryan Pavlik <rpavlik at iastate.edu>
    Reviewed-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>

diff --git a/hw/xwin/winglobals.h b/hw/xwin/winglobals.h
index 2edf957..d2e2ba2 100644
--- a/hw/xwin/winglobals.h
+++ b/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
  */
commit ab686ce029208abf970a4bcd1435bf8411a44de9
Author: Ryan Pavlik <rpavlik at iastate.edu>
Date:   Wed Oct 26 17:03:25 2011 -0500

    include: Add RELOCATE_PROJECTROOT to xwin-config.h header
    
    RELOCATE_PROJECTROOT is AC_DEFINED in configure.ac, but currently has no effect
    as it doesn't appear in any AC_CONFIG_HEADER header.
    
    When packaged for Windows, we do not have a unix-style filesystem tree, where
    file needed by the X server can be found in fixed, absolute paths under the
    prefix (PROJECTROOT).
    
    Instead, the filesystem tree containing files needed by the X server and clients
    will be installed with the directory containing the X server executable as the
    root directory of that tree.
    
    (Typically, this will be in the Program Files directory, which does not have a
    fixed name, as it can be moved, localized, or added to to indicate x86 or x64
    binaries)
    
    So, RELOCATE_PROJECTROOT is used to make a native Windows build of the X server
    look for various files (fonts, xkb data) in locations relative to the X server
    rather than at absolute paths, by translating those paths at run-time.
    
    Additionally the XKEYSYMDB, XERRORDB, XLOCALEDIR env vars checked by libX11 are
    set appropriately for clients started by the X server.
    
    Signed-off-by: Ryan Pavlik <rpavlik at iastate.edu>
    Reviewed-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>

diff --git a/include/xwin-config.h.in b/include/xwin-config.h.in
index 8122f55..c5119f2 100644
--- a/include/xwin-config.h.in
+++ b/include/xwin-config.h.in
@@ -31,3 +31,6 @@
 
 /* Default log location */
 #undef DEFAULT_LOGDIR
+
+/* Whether we should re-locate the root to where the executable lives */
+#undef RELOCATE_PROJECTROOT
commit a2037d7080ae64ea55f7d76971716346aa3ec6d3
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Wed Nov 28 22:25:35 2012 +0000

    hw/xwin: Fix MinGW build of winSetAppModelID.c
    
    Add missing #include <pthread.h>
    
    In file included from /jhbuild/checkout/xorg/xserver/hw/xwin/winSetAppUserModelID.c:31:0:
    /jhbuild/checkout/xorg/xserver/hw/xwin/winwindow.h:140:11: error: expected declaration specifiers or ‘...’ before ‘pthread_t’
    /jhbuild/checkout/xorg/xserver/hw/xwin/winwindow.h:141:11: error: expected declaration specifiers or ‘...’ before ‘pthread_t’
    /jhbuild/checkout/xorg/xserver/hw/xwin/winwindow.h:142:11: error: expected declaration specifiers or ‘...’ before ‘pthread_mutex_t’
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>

diff --git a/hw/xwin/winSetAppUserModelID.c b/hw/xwin/winSetAppUserModelID.c
index ce9da5e..41615e1 100644
--- a/hw/xwin/winSetAppUserModelID.c
+++ b/hw/xwin/winSetAppUserModelID.c
@@ -28,6 +28,7 @@
 #include <X11/Xlib.h>
 #include <X11/Xproto.h>
 #include <X11/Xwindows.h>
+#include <pthread.h>
 #include "winwindow.h"
 #include "os.h"
 #include "winmsg.h"
commit f57100bb36eae3b4d75f3c315973405f705b8de6
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Tue Feb 23 13:38:48 2010 +0000

    hw/xwin: Process one Windows message per wakeup, rather than all of them.
    
    De-queuing Windows messages and X events happens in the same thread of
    execution.  Draining the windows message queue can lead to the X event queue
    overflowing if lots of those windows messages cause X events (e.g. if a keyboard
    macro program has just dumped thousands of keypresses into the Windows message
    queue).  See the mailing list thread [1] for more details.
    
    Processing one Windows message per wakeup, rather than all of them gives the X
    server a chance to do stuff as well after each message.
    
    [1] http://cygwin.com/ml/cygwin-xfree/2010-01/msg00056.html
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>

diff --git a/hw/xwin/winblock.c b/hw/xwin/winblock.c
index a4ae866..c3ef4be 100644
--- a/hw/xwin/winblock.c
+++ b/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/hw/xwin/winwakeup.c b/hw/xwin/winwakeup.c
index 77c1605..795221a 100644
--- a/hw/xwin/winwakeup.c
+++ b/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))
commit e30e1ea98720acc583f34c830a1c1b7e3e88f694
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Mon Dec 17 22:38:25 2012 +0000

    hw/xwin: Fix some comments in winkeybd.c
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>

diff --git a/hw/xwin/winkeybd.c b/hw/xwin/winkeybd.c
index a70cdcd..27c114c 100644
--- a/hw/xwin/winkeybd.c
+++ b/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.
  */
@@ -509,8 +509,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)
commit 6f4a48f8a55bc54b6d3e9d80734be05750c024de
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Thu Apr 1 15:08:26 2010 +0100

    hw/xwin: Bring the X screen window to the front on a single left-click on the tray icon
    
    Bring the X screen window to the front on a single left click on the tray icon,
    like the comment says we do
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>

diff --git a/hw/xwin/wintrayicon.c b/hw/xwin/wintrayicon.c
index dbc4725..f168b88 100644
--- a/hw/xwin/wintrayicon.c
+++ b/hw/xwin/wintrayicon.c
@@ -114,7 +114,7 @@ winHandleIconMessage(HWND hwnd, UINT message,
     switch (lParam) {
     case WM_LBUTTONUP:
         /* Restack and bring all windows to top */
-        SetForegroundWindow(hwnd);
+        SetForegroundWindow (pScreenPriv->hwndScreen);
 
 #ifdef XWIN_MULTIWINDOWEXTWM
         if (pScreenInfo->fMWExtWM)


More information about the xorg-commit mailing list