xserver: Branch 'master' - 12 commits

Adam Jackson ajax at kemper.freedesktop.org
Tue Jun 28 16:05:10 UTC 2016


 hw/xwin/InitOutput.c            |   21 ++++++-
 hw/xwin/man/XWin.man            |    3 -
 hw/xwin/win.h                   |    3 -
 hw/xwin/winblock.c              |    2 
 hw/xwin/wincreatewnd.c          |    6 +-
 hw/xwin/winerror.c              |    2 
 hw/xwin/winkeybd.c              |    2 
 hw/xwin/winmultiwindowwm.c      |  118 ++++++++++++++++++++++++++++------------
 hw/xwin/winmultiwindowwndproc.c |    2 
 hw/xwin/winprefs.c              |   29 ++++++---
 hw/xwin/winprefs.h              |    9 ++-
 hw/xwin/winprocarg.c            |    8 +-
 hw/xwin/wintaskbar.c            |    2 
 hw/xwin/winvalargs.c            |   19 +++++-
 hw/xwin/winwindow.h             |    2 
 hw/xwin/winwndproc.c            |    6 +-
 16 files changed, 162 insertions(+), 72 deletions(-)

New commits:
commit ef1578e736887aadf209172f48daa9eaec25b3db
Author: Jon Turney <jon.turney at dronecode.org.uk>
Date:   Sun Feb 28 00:53:24 2016 +0000

    hw/xwin: Fix a typo in "Remove Shadow DirectDraw engine"
    
    Commit 7a22912e "Remove Shadow DirectDraw engine" contained a typo, changing
    the fullscreen && DirectDraw check in WM_DISPLAYCHANGE to fullscreen ||
    DirectDraw
    
    This causes disruptive depth changes to be improperly handled
    
    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/winwndproc.c b/hw/xwin/winwndproc.c
index 6cbd447..7236a95 100644
--- a/hw/xwin/winwndproc.c
+++ b/hw/xwin/winwndproc.c
@@ -162,7 +162,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
          * their own mode when they become active.
          */
         if (s_pScreenInfo->fFullScreen
-            || (s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL)) {
+            && (s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL)) {
             break;
         }
 
commit 0a0c1bd93259c208184d6ad974ba55658191af0c
Author: Jon Turney <jon.turney at dronecode.org.uk>
Date:   Fri Feb 26 18:03:04 2016 +0000

    hw/xwin: Fix a crash trying to reload window icons when not in multiwindow mode
    
    ReloadEnumWindowsProc() accesses window privates, which are only valid in
    multiwindow mode, but is called in all modes.
    
    Fix this potential crash by not doing this unless in multiwindow mode.
    
    Reproduction steps:
    1/ XWin -mwextwm
    2/ Run a client which creates an X window e.g. xterm
    3/ Right click on notification area icon, and choose 'Reload .XWinrc' from the menu
    
    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 656f6c2..3f47fec 100644
--- a/hw/xwin/winmultiwindowwndproc.c
+++ b/hw/xwin/winmultiwindowwndproc.c
@@ -428,7 +428,7 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
         /*
          * Any window menu items go through here
          */
-        if (HandleCustomWM_COMMAND(hwnd, LOWORD(wParam))) {
+        if (HandleCustomWM_COMMAND(hwnd, LOWORD(wParam), s_pScreenPriv)) {
             /* Don't pass customized menus to DefWindowProc */
             return 0;
         }
diff --git a/hw/xwin/winprefs.c b/hw/xwin/winprefs.c
index a180a9e..65115ec 100644
--- a/hw/xwin/winprefs.c
+++ b/hw/xwin/winprefs.c
@@ -206,18 +206,21 @@ ReloadEnumWindowsProc(HWND hwnd, LPARAM lParam)
  * Set custom icons and menus again.
  */
 static void
-ReloadPrefs(void)
+ReloadPrefs(winPrivScreenPtr pScreenPriv)
 {
     int i;
 
 #ifdef XWIN_MULTIWINDOW
+    winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+
     /* First, iterate over all windows, deleting their icons and custom menus.
      * This is really only needed because winDestroyIcon() will try to
      * destroy the old global icons, which will have changed.
      * It is probably better to set a windows USER_DATA to flag locally defined
      * icons, and use that to accurately know when to destroy old icons.
      */
-    EnumThreadWindows(g_dwCurrentThreadID, ReloadEnumWindowsProc, FALSE);
+    if (pScreenInfo->fMultiWindow)
+        EnumThreadWindows(g_dwCurrentThreadID, ReloadEnumWindowsProc, FALSE);
 #endif
 
     /* Now, free/clear all info from our prefs structure */
@@ -262,12 +265,12 @@ ReloadPrefs(void)
     g_hSmallIconX = NULL;
 
 #ifdef XWIN_MULTIWINDOW
-    winInitGlobalIcons();
-#endif
+    if (pScreenInfo->fMultiWindow) {
+        winInitGlobalIcons();
 
-#ifdef XWIN_MULTIWINDOW
-    /* Rebuild the icons and menus */
-    EnumThreadWindows(g_dwCurrentThreadID, ReloadEnumWindowsProc, TRUE);
+        /* Rebuild the icons and menus */
+        EnumThreadWindows(g_dwCurrentThreadID, ReloadEnumWindowsProc, TRUE);
+    }
 #endif
 
     /* Whew, done */
@@ -303,7 +306,7 @@ HandleCustomWM_INITMENU(HWND hwnd, HMENU hmenu)
  * Return TRUE if command is proccessed, FALSE otherwise.
  */
 Bool
-HandleCustomWM_COMMAND(HWND hwnd, int command)
+HandleCustomWM_COMMAND(HWND hwnd, WORD command, winPrivScreenPtr pScreenPriv)
 {
     int i, j;
     MENUPARSED *m;
@@ -383,13 +386,17 @@ HandleCustomWM_COMMAND(HWND hwnd, int command)
                                      HWND_TOPMOST,
                                      0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
 #if XWIN_MULTIWINDOW
-                    /* Reflect the changed Z order */
-                    winReorderWindowsMultiWindow();
+                    {
+                        winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+                        if (pScreenInfo->fMultiWindow)
+                            /* Reflect the changed Z order */
+                            winReorderWindowsMultiWindow();
+                    }
 #endif
                     return TRUE;
 
                 case CMD_RELOAD:
-                    ReloadPrefs();
+                    ReloadPrefs(pScreenPriv);
                     return TRUE;
 
                 default:
diff --git a/hw/xwin/winprefs.h b/hw/xwin/winprefs.h
index 8f4eb08..936a42f 100644
--- a/hw/xwin/winprefs.h
+++ b/hw/xwin/winprefs.h
@@ -1,5 +1,3 @@
-#if !defined(WINPREFS_H)
-#define WINPREFS_H
 /*
  * Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
  * Copyright (C) Colin Harrison 2005-2008
@@ -32,6 +30,9 @@
  *              Colin Harrison
  */
 
+#if !defined(WINPREFS_H)
+#define WINPREFS_H
+
 /* Need Bool */
 #include <X11/Xdefs.h>
 /* Need TRUE */
@@ -42,6 +43,8 @@
 /* Xwindows redefines PATH_MAX to at least 1024 */
 #include <X11/Xwindows.h>
 
+#include "winwindow.h"
+
 #ifndef NAME_MAX
 #define NAME_MAX PATH_MAX
 #endif
@@ -159,7 +162,7 @@ void
  HandleCustomWM_INITMENU(HWND hwnd, HMENU hmenu);
 
 Bool
- HandleCustomWM_COMMAND(HWND hwnd, int command);
+ HandleCustomWM_COMMAND(HWND hwnd, WORD command, winPrivScreenPtr pScreenPriv);
 
 int
  winIconIsOverride(HICON hicon);
diff --git a/hw/xwin/winwndproc.c b/hw/xwin/winwndproc.c
index 3df2292..6cbd447 100644
--- a/hw/xwin/winwndproc.c
+++ b/hw/xwin/winwndproc.c
@@ -1215,7 +1215,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 
         default:
             /* It's probably one of the custom menus... */
-            if (HandleCustomWM_COMMAND(0, LOWORD(wParam)))
+            if (HandleCustomWM_COMMAND(0, LOWORD(wParam), s_pScreenPriv))
                 return 0;
         }
         break;
commit 91ae2571458c50d9f782190d9f80815b770aefac
Author: Colin Harrison <colin.harrison at virgin.net>
Date:   Fri Feb 26 16:46:15 2016 +0000

    hw/xwin: Fix a crash which occurs if focus returns to XWin after xkbcomp has failed
    
    If WM_FOCUS is received while the "core devices failed" fatal error (due to
    xkbcomp failing) is displayed, winRestoreModeKeyState() attempts to
    dereference a NULL InputInfo.keyboard->key pointer.
    
    Signed-off-by: Colin Harrison <colin.harrison at virgin.net>
    Reviewed-by: Jon Turney <jon.turney at dronecode.org.uk>

diff --git a/hw/xwin/winkeybd.c b/hw/xwin/winkeybd.c
index ab53af4..00586c2 100644
--- a/hw/xwin/winkeybd.c
+++ b/hw/xwin/winkeybd.c
@@ -246,7 +246,7 @@ winRestoreModeKeyStates(void)
     unsigned short internalKeyStates;
 
     /* X server is being initialized */
-    if (!inputInfo.keyboard)
+    if (!inputInfo.keyboard || !inputInfo.keyboard->key)
         return;
 
     /* Only process events if the rootwindow is mapped. The keyboard events
commit 4b123e0f61eb55e59d30bf442499cf3b3f621c3b
Author: Jon Turney <jon.turney at dronecode.org.uk>
Date:   Tue Aug 4 16:05:05 2015 +0100

    hw/xwin: Make window maximizable if a maximium size larger than virtual desktop size is specified
    
    Firefox 38 has a WM_NORMAL_HINTS with a maximum size of 32767x32767.
    
    Don't remove the maximize control from the window frame if the maximum size
    is bigger than the virtual desktop size, as maximizing the window will not
    exceed the maximium size.
    
    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 580d641..df7e6d3 100644
--- a/hw/xwin/winmultiwindowwm.c
+++ b/hw/xwin/winmultiwindowwm.c
@@ -1763,8 +1763,12 @@ winApplyHints(WMInfoPtr pWMInfo, xcb_window_t iWindow, HWND hWnd, HWND * zstyle)
         cookie = xcb_icccm_get_wm_normal_hints(conn, iWindow);
         if (xcb_icccm_get_wm_normal_hints_reply(conn, cookie, &size_hints, NULL)) {
             if (size_hints.flags & XCB_ICCCM_SIZE_HINT_P_MAX_SIZE) {
-                /* Not maximizable if a maximum size is specified */
-                hint |= HINT_NOMAXIMIZE;
+
+                /* Not maximizable if a maximum size is specified, and that size
+                   is smaller (in either dimension) than the screen size */
+                if ((size_hints.max_width < GetSystemMetrics(SM_CXVIRTUALSCREEN))
+                    || (size_hints.max_height < GetSystemMetrics(SM_CYVIRTUALSCREEN)))
+                    hint |= HINT_NOMAXIMIZE;
 
                 if (size_hints.flags & XCB_ICCCM_SIZE_HINT_P_MIN_SIZE) {
                     /*
commit 504bf495f9b3adea1ba650469223511f81709714
Author: Jon Turney <jon.turney at dronecode.org.uk>
Date:   Wed Jul 8 19:12:22 2015 +0100

    hw/xwin: Detect invalid options in combination with -nodecoration
    
    Detect invalid options in combination with -nodecoration
    
    These are particularly problematic as -nodecoration implies a default of
    -nomultimonitors, for some reason, which will gives rendering issues with
    -multiwindow.
    
    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/winvalargs.c b/hw/xwin/winvalargs.c
index d0e0b75..f938724 100644
--- a/hw/xwin/winvalargs.c
+++ b/hw/xwin/winvalargs.c
@@ -127,7 +127,7 @@ winValidateArgs(void)
             return FALSE;
         }
 
-        /* Check for -multiwindow, -mwextwm, or -rootless and fullscreen */
+        /* Check for -multiwindow, -mwextwm, or -rootless and -fullscreen */
         if (g_ScreenInfo[i].fFullScreen && (FALSE
 #ifdef XWIN_MULTIWINDOW
                                             || g_ScreenInfo[i].fMultiWindow
@@ -142,6 +142,21 @@ winValidateArgs(void)
             return FALSE;
         }
 
+        /* Check for -multiwindow, -mwextwm, or -rootless and -nodecoration */
+        if (!g_ScreenInfo[i].fDecoration && (FALSE
+#ifdef XWIN_MULTIWINDOW
+                                            || g_ScreenInfo[i].fMultiWindow
+#endif
+#ifdef XWIN_MULTIWINDOWEXTWM
+                                            || g_ScreenInfo[i].fMWExtWM
+#endif
+                                            || g_ScreenInfo[i].fRootless)
+            ) {
+            ErrorF("winValidateArgs - -nodecoration is invalid with "
+                   "-multiwindow, -mwextwm, or -rootless.\n");
+            return FALSE;
+        }
+
         /* Check for !fullscreen and any fullscreen-only parameters */
         if (!g_ScreenInfo[i].fFullScreen
             && (g_ScreenInfo[i].dwRefreshRate != WIN_DEFAULT_REFRESH
commit e1b983b55e4cefcf976c8f92d608af8216a56927
Author: Jon Turney <jon.turney at dronecode.org.uk>
Date:   Tue Nov 11 11:46:25 2014 +0000

    hw/xwin: Default to -noresize when -fullscreen is used
    
    Currently, just using -fullscreen fails in winValidateArgs(), as the default
    -resize=randr is incompatible with -fullscreen.
    
    Set the default resize mode to -noresize if -fullscreen is used.
    
    Also, rename enum value notAllowed -> resizeNotAllowed for clarity.
    
    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/InitOutput.c b/hw/xwin/InitOutput.c
index 07631a9..4621012 100644
--- a/hw/xwin/InitOutput.c
+++ b/hw/xwin/InitOutput.c
@@ -690,6 +690,20 @@ OsVendorInit(void)
             }
         }
     }
+
+    /* Work out what the default resize setting should be, and apply it if it
+     was not explicitly specified */
+    {
+        int j;
+        for (j = 0; j < g_iNumScreens; j++) {
+            if (g_ScreenInfo[j].iResizeMode == resizeDefault) {
+                if (g_ScreenInfo[j].fFullScreen)
+                    g_ScreenInfo[j].iResizeMode = resizeNotAllowed;
+                else
+                    g_ScreenInfo[j].iResizeMode = resizeWithRandr;
+                }
+        }
+    }
 }
 
 static void
diff --git a/hw/xwin/man/XWin.man b/hw/xwin/man/XWin.man
index 7ffdd6c..2222293 100644
--- a/hw/xwin/man/XWin.man
+++ b/hw/xwin/man/XWin.man
@@ -124,7 +124,8 @@ Alternative name for \fB\-resize=scrollbars\fP.
 .SH OPTIONS CONTROLLING RESIZE BEHAVIOUR
 .TP 8
 .B \-resize[=none|scrollbars|randr]
-Select the resize mode of an X screen. The default is randr.
+Select the resize mode of an X screen.
+The default is \fBnone\fP if \fB\-fullscreen\fP is used, \fBrandr\fP otherwise.
 
 .RS
 .IP \fB\-resize=none\fP 8
diff --git a/hw/xwin/win.h b/hw/xwin/win.h
index f9c44b3..787c42a 100644
--- a/hw/xwin/win.h
+++ b/hw/xwin/win.h
@@ -335,7 +335,8 @@ typedef struct {
  * Resize modes
  */
 typedef enum {
-    notAllowed,
+    resizeDefault = -1,
+    resizeNotAllowed,
     resizeWithScrollbars,
     resizeWithRandr
 } winResizeMode;
diff --git a/hw/xwin/wincreatewnd.c b/hw/xwin/wincreatewnd.c
index b2f797c..e6e587f 100644
--- a/hw/xwin/wincreatewnd.c
+++ b/hw/xwin/wincreatewnd.c
@@ -171,7 +171,7 @@ winCreateBoundingWindowWindowed(ScreenPtr pScreen)
             fForceShowWindow = TRUE;
         }
         dwWindowStyle |= WS_CAPTION;
-        if (pScreenInfo->iResizeMode != notAllowed)
+        if (pScreenInfo->iResizeMode != resizeNotAllowed)
             dwWindowStyle |= WS_THICKFRAME | WS_MAXIMIZEBOX;
     }
     else
@@ -226,7 +226,7 @@ winCreateBoundingWindowWindowed(ScreenPtr pScreen)
         )
         && (pScreenInfo->iResizeMode == resizeWithScrollbars)) {
         /* We cannot have scrollbars if we do not have a window border */
-        pScreenInfo->iResizeMode = notAllowed;
+        pScreenInfo->iResizeMode = resizeNotAllowed;
     }
 
     /* Did the user specify a height and width? */
@@ -253,7 +253,7 @@ winCreateBoundingWindowWindowed(ScreenPtr pScreen)
 #endif
 
             /* Are we resizable */
-            if (pScreenInfo->iResizeMode != notAllowed) {
+            if (pScreenInfo->iResizeMode != resizeNotAllowed) {
 #if CYGDEBUG
                 winDebug
                     ("winCreateBoundingWindowWindowed - Window is resizable\n");
diff --git a/hw/xwin/winprocarg.c b/hw/xwin/winprocarg.c
index 8e09c70..35ea8f2 100644
--- a/hw/xwin/winprocarg.c
+++ b/hw/xwin/winprocarg.c
@@ -140,7 +140,7 @@ winInitializeScreenDefaults(void)
 #endif
     defaultScreenInfo.fMultipleMonitors = FALSE;
     defaultScreenInfo.fLessPointer = FALSE;
-    defaultScreenInfo.iResizeMode = resizeWithRandr;
+    defaultScreenInfo.iResizeMode = resizeDefault;
     defaultScreenInfo.fNoTrayIcon = FALSE;
     defaultScreenInfo.iE3BTimeout = WIN_E3B_DEFAULT;
     defaultScreenInfo.fUseWinKillKey = WIN_DEFAULT_WIN_KILL;
@@ -662,7 +662,7 @@ ddxProcessArgument(int argc, char *argv[], int i)
         if (IS_OPTION("-resize"))
             mode = resizeWithRandr;
         else if (IS_OPTION("-noresize"))
-            mode = notAllowed;
+            mode = resizeNotAllowed;
         else if (strncmp(argv[i], "-resize=", strlen("-resize=")) == 0) {
             char *option = argv[i] + strlen("-resize=");
 
@@ -671,7 +671,7 @@ ddxProcessArgument(int argc, char *argv[], int i)
             else if (strcmp(option, "scrollbars") == 0)
                 mode = resizeWithScrollbars;
             else if (strcmp(option, "none") == 0)
-                mode = notAllowed;
+                mode = resizeNotAllowed;
             else {
                 ErrorF("ddxProcessArgument - resize - Invalid resize mode %s\n",
                        option);
diff --git a/hw/xwin/winvalargs.c b/hw/xwin/winvalargs.c
index edfd71f..d0e0b75 100644
--- a/hw/xwin/winvalargs.c
+++ b/hw/xwin/winvalargs.c
@@ -153,7 +153,7 @@ winValidateArgs(void)
 
         /* Check for fullscreen and any non-fullscreen parameters */
         if (g_ScreenInfo[i].fFullScreen
-            && ((g_ScreenInfo[i].iResizeMode != notAllowed)
+            && ((g_ScreenInfo[i].iResizeMode != resizeNotAllowed)
                 || !g_ScreenInfo[i].fDecoration
                 || g_ScreenInfo[i].fLessPointer)) {
             ErrorF("winValidateArgs - -fullscreen is invalid with "
diff --git a/hw/xwin/winwndproc.c b/hw/xwin/winwndproc.c
index 7423643..3df2292 100644
--- a/hw/xwin/winwndproc.c
+++ b/hw/xwin/winwndproc.c
@@ -316,7 +316,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 #endif
 
         /* Break if we do not allow resizing */
-        if ((s_pScreenInfo->iResizeMode == notAllowed)
+        if ((s_pScreenInfo->iResizeMode == resizeNotAllowed)
             || !s_pScreenInfo->fDecoration
 #ifdef XWIN_MULTIWINDOWEXTWM
             || s_pScreenInfo->fMWExtWM
commit 42f7cd5d92f2046e1b5c264b3d76c3afda624a55
Author: Jon Turney <jon.turney at dronecode.org.uk>
Date:   Sat Oct 11 14:49:16 2014 +0100

    hw/xwin: Tell LogInit() to backup previous logfile as .old
    
    Future work: Do we really need to call LogInit() in so many different
    places?
    
    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/InitOutput.c b/hw/xwin/InitOutput.c
index 1190124..07631a9 100644
--- a/hw/xwin/InitOutput.c
+++ b/hw/xwin/InitOutput.c
@@ -210,7 +210,7 @@ ddxGiveUp(enum ExitCode error)
 #endif
 
     if (!g_fLogInited) {
-        g_pszLogFile = LogInit(g_pszLogFile, NULL);
+        g_pszLogFile = LogInit(g_pszLogFile, ".old");
         g_fLogInited = TRUE;
     }
     LogClose(error);
@@ -635,7 +635,8 @@ OsVendorInit(void)
          * avoid the second call
          */
         g_fLogInited = TRUE;
-        g_pszLogFile = LogInit(g_pszLogFile, NULL);
+        g_pszLogFile = LogInit(g_pszLogFile, ".old");
+
     }
     LogSetParameter(XLOG_FLUSH, 1);
     LogSetParameter(XLOG_VERBOSITY, g_iLogVerbose);
@@ -865,7 +866,7 @@ ddxUseMsg(void)
 
     /* Log file will not be opened for UseMsg unless we open it now */
     if (!g_fLogInited) {
-        g_pszLogFile = LogInit(g_pszLogFile, NULL);
+        g_pszLogFile = LogInit(g_pszLogFile, ".old");
         g_fLogInited = TRUE;
     }
     LogClose(EXIT_NO_ERROR);
diff --git a/hw/xwin/winerror.c b/hw/xwin/winerror.c
index 1318b0f..b49f9e5 100644
--- a/hw/xwin/winerror.c
+++ b/hw/xwin/winerror.c
@@ -75,7 +75,7 @@ OsVendorFatalError(const char *f, va_list args)
 
     if (!g_fLogInited) {
         g_fLogInited = TRUE;
-        g_pszLogFile = LogInit(g_pszLogFile, NULL);
+        g_pszLogFile = LogInit(g_pszLogFile, ".old");
     }
     LogClose(EXIT_ERR_ABORT);
 
commit 197419838273eddbd0bd34890771799f4bebbc07
Author: Jon Turney <jon.turney at dronecode.org.uk>
Date:   Fri Sep 26 13:18:33 2014 +0100

    hw/xwin: Downgrade some uninformative, always-emitted log output to debug
    
    Downgrade from error to debug some uninformative, always-emitted log output
    about thread synchronization during initialization
    
    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 07e9078..8b84652 100644
--- a/hw/xwin/winblock.c
+++ b/hw/xwin/winblock.c
@@ -70,7 +70,7 @@ winBlockHandler(ScreenPtr pScreen,
     if (pScreenPriv != NULL && !pScreenPriv->fServerStarted) {
         int iReturn;
 
-        ErrorF("winBlockHandler - pthread_mutex_unlock()\n");
+        winDebug("winBlockHandler - pthread_mutex_unlock()\n");
 
         /* Flag that modules are to be started */
         pScreenPriv->fServerStarted = TRUE;
diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c
index 32d2397..580d641 100644
--- a/hw/xwin/winmultiwindowwm.c
+++ b/hw/xwin/winmultiwindowwm.c
@@ -1045,7 +1045,7 @@ winMultiWindowXMsgProc(void *pArg)
         pthread_exit(NULL);
     }
 
-    ErrorF("winMultiWindowXMsgProc - Calling pthread_mutex_lock ()\n");
+    winDebug("winMultiWindowXMsgProc - Calling pthread_mutex_lock ()\n");
 
     /* Grab the server started mutex - pause until we get it */
     iReturn = pthread_mutex_lock(pProcArg->ppmServerStarted);
@@ -1055,12 +1055,12 @@ winMultiWindowXMsgProc(void *pArg)
         pthread_exit(NULL);
     }
 
-    ErrorF("winMultiWindowXMsgProc - pthread_mutex_lock () returned.\n");
+    winDebug("winMultiWindowXMsgProc - pthread_mutex_lock () returned.\n");
 
     /* Release the server started mutex */
     pthread_mutex_unlock(pProcArg->ppmServerStarted);
 
-    ErrorF("winMultiWindowXMsgProc - pthread_mutex_unlock () returned.\n");
+    winDebug("winMultiWindowXMsgProc - pthread_mutex_unlock () returned.\n");
 
     /* Setup the display connection string x */
     winGetDisplayName(pszDisplay, (int) pProcArg->dwScreen);
@@ -1428,7 +1428,7 @@ winInitMultiWindowWM(WMInfoPtr pWMInfo, WMProcArgPtr pProcArg)
         pthread_exit(NULL);
     }
 
-    ErrorF("winInitMultiWindowWM - Calling pthread_mutex_lock ()\n");
+    winDebug("winInitMultiWindowWM - Calling pthread_mutex_lock ()\n");
 
     /* Grab our garbage mutex to satisfy pthread_cond_wait */
     iReturn = pthread_mutex_lock(pProcArg->ppmServerStarted);
@@ -1438,12 +1438,12 @@ winInitMultiWindowWM(WMInfoPtr pWMInfo, WMProcArgPtr pProcArg)
         pthread_exit(NULL);
     }
 
-    ErrorF("winInitMultiWindowWM - pthread_mutex_lock () returned.\n");
+    winDebug("winInitMultiWindowWM - pthread_mutex_lock () returned.\n");
 
     /* Release the server started mutex */
     pthread_mutex_unlock(pProcArg->ppmServerStarted);
 
-    ErrorF("winInitMultiWindowWM - pthread_mutex_unlock () returned.\n");
+    winDebug("winInitMultiWindowWM - pthread_mutex_unlock () returned.\n");
 
     /* Setup the display connection string x */
     winGetDisplayName(pszDisplay, (int) pProcArg->dwScreen);
diff --git a/hw/xwin/winprocarg.c b/hw/xwin/winprocarg.c
index 5c58480..8e09c70 100644
--- a/hw/xwin/winprocarg.c
+++ b/hw/xwin/winprocarg.c
@@ -246,7 +246,7 @@ ddxProcessArgument(int argc, char *argv[], int i)
              * OsVendorInit () gets called, otherwise we will overwrite
              * settings changed by parameters such as -fullscreen, etc.
              */
-            winErrorFVerb(2, "ddxProcessArgument - Initializing default "
+            winErrorFVerb(3, "ddxProcessArgument - Initializing default "
                           "screens\n");
             winInitializeScreenDefaults();
         }
commit 17c8bf348eea4f12ce7cb4ca7db0d0576e28c982
Author: Jon Turney <jon.turney at dronecode.org.uk>
Date:   Tue Apr 28 16:04:40 2015 +0100

    hw/xwin: Check for just the hostname in window title
    
    When -hostintitle is enabled, only use the hostname, not a FQDN from
    WM_CLIENT_MACHINE, when checking if the window title already contains it
    
    Also restructure GetWindowName() to fix a potential memory leak.
    
    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 36d8ed7..32d2397 100644
--- a/hw/xwin/winmultiwindowwm.c
+++ b/hw/xwin/winmultiwindowwm.c
@@ -416,27 +416,39 @@ GetWindowName(WMInfoPtr pWMInfo, xcb_window_t iWin, char **ppWindowName)
             xcb_icccm_get_text_property_reply_wipe(&reply);
         }
 
+    /* return the window name, unless... */
+    *ppWindowName = pszWindowName;
+
     if (g_fHostInTitle) {
-        char *pszClientMachine;
-        char hostname[HOST_NAME_MAX + 1];
         xcb_get_property_cookie_t cookie;
         xcb_icccm_get_text_property_reply_t reply;
 
         /* Try to get client machine name */
         cookie = xcb_icccm_get_wm_client_machine(conn, iWin);
         if (xcb_icccm_get_wm_client_machine_reply(conn, cookie, &reply, NULL)) {
+            char *pszClientMachine;
+            char *pszClientHostname;
+            char *dot;
+            char hostname[HOST_NAME_MAX + 1];
+
             pszClientMachine = Xutf8TextPropertyToString(pWMInfo, &reply);
             xcb_icccm_get_text_property_reply_wipe(&reply);
 
+            /* If client machine name looks like a FQDN, find the hostname */
+            pszClientHostname = strdup(pszClientMachine);
+            dot = strchr(pszClientHostname, '.');
+            if (dot)
+                *dot = '\0';
+
             /*
-               If we have a client machine name
-               and it's not the local host name
+               If we have a client machine hostname
+               and it's not the local hostname
                and it's not already in the window title...
              */
-            if (strlen(pszClientMachine) &&
+            if (strlen(pszClientHostname) &&
                 !gethostname(hostname, HOST_NAME_MAX + 1) &&
-                strcmp(hostname, pszClientMachine) &&
-                (strstr(pszWindowName, pszClientMachine) == 0)) {
+                strcmp(hostname, pszClientHostname) &&
+                (strstr(pszWindowName, pszClientHostname) == 0)) {
                 /* ... add '@<clientmachine>' to end of window name */
                 *ppWindowName =
                     malloc(strlen(pszWindowName) +
@@ -446,15 +458,12 @@ GetWindowName(WMInfoPtr pWMInfo, xcb_window_t iWin, char **ppWindowName)
                 strcat(*ppWindowName, pszClientMachine);
 
                 free(pszWindowName);
-                free(pszClientMachine);
-
-                return;
             }
+
+            free(pszClientMachine);
+            free(pszClientHostname);
         }
     }
-
-    /* otherwise just return the window name */
-    *ppWindowName = pszWindowName;
 }
 
 /*
commit c05c4360eea245b3ef5f3a355b95dcd63244ef70
Author: Jon Turney <jon.turney at dronecode.org.uk>
Date:   Mon Sep 22 14:40:41 2014 +0100

    hw/xwin: Use _NET_WM_NAME for window titles in multiwindow mode
    
    Use _NET_WM_NAME in preference to WM_NAME for window title
    
    Update window title when _NET_WM_NAME property changes
    
    We should always have been doing this, but some qt5 examples only set
    _NET_WM_NAME, so now it's become more important...
    
    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 09ec826..36d8ed7 100644
--- a/hw/xwin/winmultiwindowwm.c
+++ b/hw/xwin/winmultiwindowwm.c
@@ -114,6 +114,7 @@ typedef struct _WMInfo {
     xcb_atom_t atmWmTakeFocus;
     xcb_atom_t atmPrivMap;
     xcb_atom_t atmUtf8String;
+    xcb_atom_t atmNetWmName;
     xcb_ewmh_connection_t ewmh;
 } WMInfoRec, *WMInfoPtr;
 
@@ -376,30 +377,51 @@ static void
 GetWindowName(WMInfoPtr pWMInfo, xcb_window_t iWin, char **ppWindowName)
 {
     xcb_connection_t *conn = pWMInfo->conn;
-    xcb_get_property_cookie_t cookie;
-    xcb_icccm_get_text_property_reply_t reply;
-    char *pszWindowName;
-    char *pszClientMachine;
-    char hostname[HOST_NAME_MAX + 1];
+    char *pszWindowName = NULL;
 
 #if CYGMULTIWINDOW_DEBUG
     ErrorF("GetWindowName\n");
 #endif
 
-    /* Intialize ppWindowName to NULL */
-    *ppWindowName = NULL;
-
-    /* Try to get window name */
-    cookie = xcb_icccm_get_wm_name(conn, iWin);
-    if (!xcb_icccm_get_wm_name_reply(conn, cookie, &reply, NULL)) {
-        ErrorF("GetWindowName - xcb_icccm_get_wm_name_reply failed.  No name.\n");
-        return;
+    /* Try to get window name from _NET_WM_NAME */
+    {
+        xcb_get_property_cookie_t cookie;
+        xcb_get_property_reply_t *reply;
+
+        cookie = xcb_get_property(pWMInfo->conn, FALSE, iWin,
+                                  pWMInfo->atmNetWmName,
+                                  XCB_GET_PROPERTY_TYPE_ANY, 0, INT_MAX);
+        reply = xcb_get_property_reply(pWMInfo->conn, cookie, NULL);
+        if (reply && (reply->type != XCB_NONE)) {
+            pszWindowName = strndup(xcb_get_property_value(reply),
+                                    xcb_get_property_value_length(reply));
+            free(reply);
+        }
     }
 
-    pszWindowName = Xutf8TextPropertyToString(pWMInfo, &reply);
-    xcb_icccm_get_text_property_reply_wipe(&reply);
+    /* Otherwise, try to get window name from WM_NAME */
+    if (!pszWindowName)
+        {
+            xcb_get_property_cookie_t cookie;
+            xcb_icccm_get_text_property_reply_t reply;
+
+            cookie = xcb_icccm_get_wm_name(conn, iWin);
+            if (!xcb_icccm_get_wm_name_reply(conn, cookie, &reply, NULL)) {
+                ErrorF("GetWindowName - xcb_icccm_get_wm_name_reply failed.  No name.\n");
+                *ppWindowName = NULL;
+                return;
+            }
+
+            pszWindowName = Xutf8TextPropertyToString(pWMInfo, &reply);
+            xcb_icccm_get_text_property_reply_wipe(&reply);
+        }
 
     if (g_fHostInTitle) {
+        char *pszClientMachine;
+        char hostname[HOST_NAME_MAX + 1];
+        xcb_get_property_cookie_t cookie;
+        xcb_icccm_get_text_property_reply_t reply;
+
         /* Try to get client machine name */
         cookie = xcb_icccm_get_wm_client_machine(conn, iWin);
         if (xcb_icccm_get_wm_client_machine_reply(conn, cookie, &reply, NULL)) {
@@ -998,6 +1020,7 @@ winMultiWindowXMsgProc(void *pArg)
     char pszDisplay[512];
     int iRetries;
     xcb_atom_t atmWmName;
+    xcb_atom_t atmNetWmName;
     xcb_atom_t atmWmHints;
     xcb_atom_t atmWmChange;
     xcb_atom_t atmNetWmIcon;
@@ -1099,6 +1122,7 @@ winMultiWindowXMsgProc(void *pArg)
     }
 
     atmWmName = intern_atom(pProcArg->conn, "WM_NAME");
+    atmNetWmName = intern_atom(pProcArg->conn, "_NET_WM_NAME");
     atmWmHints = intern_atom(pProcArg->conn, "WM_HINTS");
     atmWmChange = intern_atom(pProcArg->conn, "WM_CHANGE_STATE");
     atmNetWmIcon = intern_atom(pProcArg->conn, "_NET_WM_ICON");
@@ -1240,7 +1264,8 @@ winMultiWindowXMsgProc(void *pArg)
         else if (type ==  XCB_PROPERTY_NOTIFY) {
             xcb_property_notify_event_t *notify = (xcb_property_notify_event_t *)event;
 
-            if (notify->atom == atmWmName) {
+            if ((notify->atom == atmWmName) ||
+                (notify->atom == atmNetWmName)) {
                 memset(&msg, 0, sizeof(msg));
 
                 msg.msg = WM_WM_NAME_EVENT;
@@ -1453,6 +1478,7 @@ winInitMultiWindowWM(WMInfoPtr pWMInfo, WMProcArgPtr pProcArg)
     pWMInfo->atmWmTakeFocus = intern_atom(pWMInfo->conn, "WM_TAKE_FOCUS");
     pWMInfo->atmPrivMap = intern_atom(pWMInfo->conn, WINDOWSWM_NATIVE_HWND);
     pWMInfo->atmUtf8String = intern_atom(pWMInfo->conn, "UTF8_STRING");
+    pWMInfo->atmNetWmName = intern_atom(pWMInfo->conn, "_NET_WM_NAME");
 
     /* Initialization for the xcb_ewmh and EWMH atoms */
     {
commit 866d8299abc4315d4836292aeac4abe0b686fc10
Author: Jon Turney <jon.turney at dronecode.org.uk>
Date:   Thu Mar 13 17:53:44 2014 +0000

    hw/xwin: Remove decorations from _NET_WM_WINDOW_TYPE_SPLASH type windows
    
    In multiwindow mode, remove decorations from _NET_WM_WINDOW_TYPE_SPLASH type
    windows.
    
    Some programs use _NET_WM_WINDOW_TYPE_SPLASH_SCREEN in error, so also accept
    that as equivalent.
    
    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 e23913e..09ec826 100644
--- a/hw/xwin/winmultiwindowwm.c
+++ b/hw/xwin/winmultiwindowwm.c
@@ -1471,6 +1471,7 @@ winInitMultiWindowWM(WMInfoPtr pWMInfo, WMProcArgPtr pProcArg)
                     pWMInfo->ewmh._NET_CLOSE_WINDOW,
                     pWMInfo->ewmh._NET_WM_WINDOW_TYPE,
                     pWMInfo->ewmh._NET_WM_WINDOW_TYPE_DOCK,
+                    pWMInfo->ewmh._NET_WM_WINDOW_TYPE_SPLASH,
                     pWMInfo->ewmh._NET_WM_STATE,
                     pWMInfo->ewmh._NET_WM_STATE_HIDDEN,
                     pWMInfo->ewmh._NET_WM_STATE_ABOVE,
@@ -1613,10 +1614,12 @@ winDeinitMultiWindowWM(void)
 static void
 winApplyHints(WMInfoPtr pWMInfo, xcb_window_t iWindow, HWND hWnd, HWND * zstyle)
 {
+
     xcb_connection_t *conn = pWMInfo->conn;
     static xcb_atom_t windowState, motif_wm_hints;
     static xcb_atom_t hiddenState, fullscreenState, belowState, aboveState,
         skiptaskbarState;
+    static xcb_atom_t splashType;
     static int generation;
 
     unsigned long hint = 0, maxmin = 0;
@@ -1636,6 +1639,7 @@ winApplyHints(WMInfoPtr pWMInfo, xcb_window_t iWindow, HWND hWnd, HWND * zstyle)
         belowState = intern_atom(conn, "_NET_WM_STATE_BELOW");
         aboveState = intern_atom(conn, "_NET_WM_STATE_ABOVE");
         skiptaskbarState = intern_atom(conn, "_NET_WM_STATE_SKIP_TASKBAR");
+        splashType = intern_atom(conn, "_NET_WM_WINDOW_TYPE_SPLASHSCREEN");
     }
 
     {
@@ -1708,6 +1712,11 @@ winApplyHints(WMInfoPtr pWMInfo, xcb_window_t iWindow, HWND hWnd, HWND * zstyle)
                 hint = (hint & ~HINT_NOFRAME) | HINT_SKIPTASKBAR | HINT_SIZEBOX;
                 *zstyle = HWND_TOPMOST;
             }
+            else if ((type.atoms[i] == pWMInfo->ewmh._NET_WM_WINDOW_TYPE_SPLASH)
+                     || (type.atoms[i] == splashType)) {
+                hint |= (HINT_SKIPTASKBAR | HINT_NOSYSMENU | HINT_NOMINIMIZE | HINT_NOMAXIMIZE);
+                *zstyle = HWND_TOPMOST;
+            }
         }
       }
     }
commit 356b9129067dd0e1dc62e893d47a1e9b033885bd
Author: Jon Turney <jon.turney at dronecode.org.uk>
Date:   Thu Apr 7 17:40:56 2016 +0100

    hw/xwin: Use Bool type in winShowWindowOnTaskbar() prototype
    
    Use the Bool type from X11/Xdefs.h for winShowWindowOnTaskbar().
    
    This is the boolean type we should be using inside the X server, rather than
    BOOL, which evaluates to either the Win32 API type, or the Xlib API type,
    depending on the context...
    
    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/wintaskbar.c b/hw/xwin/wintaskbar.c
index 7dd4ec3..401ec17 100644
--- a/hw/xwin/wintaskbar.c
+++ b/hw/xwin/wintaskbar.c
@@ -66,7 +66,7 @@ DECLARE_INTERFACE_(ITaskbarList, IUnknown)
    seem to be the case
 */
 
-void winShowWindowOnTaskbar(HWND hWnd, BOOL show)
+void winShowWindowOnTaskbar(HWND hWnd, Bool show)
 {
   ITaskbarList* pTaskbarList = NULL;
 
diff --git a/hw/xwin/winwindow.h b/hw/xwin/winwindow.h
index e3a5948..65e4bea 100644
--- a/hw/xwin/winwindow.h
+++ b/hw/xwin/winwindow.h
@@ -160,7 +160,7 @@ void
  winSetAppUserModelID(HWND hWnd, const char *AppID);
 
 void
- winShowWindowOnTaskbar(HWND hWnd, BOOL show);
+ winShowWindowOnTaskbar(HWND hWnd, Bool show);
 
 #endif                          /* XWIN_MULTIWINDOW */
 #endif


More information about the xorg-commit mailing list