diff options
authorJon TURNEY <>2009-11-10 13:24:40 +0000
committerJon TURNEY <>2010-02-05 19:21:14 +0000
commit654d2e372dc2978ce379ab9f02137333ec224f0c (patch)
parent26857b1c2003797b02e258247f63064aa1e37c10 (diff)
Cygwin/X: Discourage other WMs in multiwindow mode
Tidying up of other WM detection code when ading SWT/Motif fix in commit 71519a572fe15b85c0eb2b02636c9e871f2c858f was rather over-agressive and now allows other WMs to think they can start when the internal WM is running. Revert to the behaviour of selecting ButtonPressMask events as well on the root window, so other WMs will be dissuaded from starting Signed-off-by: Jon TURNEY <> Reviewed-by: Colin Harrison <>
1 files changed, 9 insertions, 5 deletions
diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c
index e39cbc105..e92170d8f 100644
--- a/hw/xwin/winmultiwindowwm.c
+++ b/hw/xwin/winmultiwindowwm.c
@@ -191,7 +191,7 @@ PreserveWin32Stack(WMInfoPtr pWMInfo, Window iWindow, UINT direction);
static Bool
-CheckAnotherWindowManager (Display *pDisplay, DWORD dwScreen);
+CheckAnotherWindowManager (Display *pDisplay, DWORD dwScreen, Bool fAllowOtherWM);
static void
winApplyHints (Display *pDisplay, Window iWindow, HWND hWnd, HWND *zstyle);
@@ -967,7 +967,7 @@ winMultiWindowXMsgProc (void *pArg)
"successfully opened the display.\n");
/* Check if another window manager is already running */
- g_fAnotherWMRunning = CheckAnotherWindowManager (pProcArg->pDisplay, pProcArg->dwScreen);
+ g_fAnotherWMRunning = CheckAnotherWindowManager (pProcArg->pDisplay, pProcArg->dwScreen, pProcArg->pWMInfo->fAllowOtherWM);
if (g_fAnotherWMRunning && !pProcArg->pWMInfo->fAllowOtherWM)
@@ -1018,7 +1018,7 @@ winMultiWindowXMsgProc (void *pArg)
if (pProcArg->pWMInfo->fAllowOtherWM && !XPending (pProcArg->pDisplay))
- if (CheckAnotherWindowManager (pProcArg->pDisplay, pProcArg->dwScreen))
+ if (CheckAnotherWindowManager (pProcArg->pDisplay, pProcArg->dwScreen, TRUE))
if (!g_fAnotherWMRunning)
@@ -1496,7 +1496,7 @@ winRedirectErrorHandler (Display *pDisplay, XErrorEvent *pErr)
static Bool
-CheckAnotherWindowManager (Display *pDisplay, DWORD dwScreen)
+CheckAnotherWindowManager (Display *pDisplay, DWORD dwScreen, Bool fAllowOtherWM)
Try to select the events which only one client at a time is allowed to select.
@@ -1511,8 +1511,12 @@ CheckAnotherWindowManager (Display *pDisplay, DWORD dwScreen)
Side effect: select the events we are actually interested in...
+ If other WMs are not allowed, also select one of the events which only one client
+ at a time is allowed to select, so other window managers won't start...
- XSelectInput(pDisplay, RootWindow (pDisplay, dwScreen), SubstructureNotifyMask);
+ XSelectInput(pDisplay, RootWindow (pDisplay, dwScreen),
+ SubstructureNotifyMask | ( !fAllowOtherWM ? ButtonPressMask : 0));
XSync (pDisplay, 0);
return redirectError;