Cygwin/X: Discourage other WMs in multiwindow mode

Tidying up of other WM detection code when ading SWT/Motif
fix in commit 71519a572f
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 <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
This commit is contained in:
Jon TURNEY 2009-11-10 13:24:40 +00:00
parent 26857b1c20
commit 654d2e372d

View File

@ -191,7 +191,7 @@ PreserveWin32Stack(WMInfoPtr pWMInfo, Window iWindow, UINT direction);
#endif
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;
}