Cygwin/X: Fix typo in g_fAnotherWMRunning and tidy up WM detection code
Tidy up code for detecting another WM is already running Fix typo g_fAnotherWMRunnig -> g_fAnotherWMRunning Remove some unused event mask macros Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk> Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
This commit is contained in:
parent
f3fad371cc
commit
71519a572f
|
@ -64,18 +64,6 @@ winUpdateWindowsWindow (WindowPtr pWin);
|
||||||
static void
|
static void
|
||||||
winFindWindow (pointer value, XID id, pointer cdata);
|
winFindWindow (pointer value, XID id, pointer cdata);
|
||||||
|
|
||||||
/*
|
|
||||||
* Macros
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define SubSend(pWin) \
|
|
||||||
((pWin->eventMask|wOtherEventMasks(pWin)) & SubstructureNotifyMask)
|
|
||||||
|
|
||||||
#define StrSend(pWin) \
|
|
||||||
((pWin->eventMask|wOtherEventMasks(pWin)) & StructureNotifyMask)
|
|
||||||
|
|
||||||
#define SubStrSend(pWin,pParent) (StrSend(pWin) || SubSend(pParent))
|
|
||||||
|
|
||||||
static
|
static
|
||||||
void winInitMultiWindowClass(void)
|
void winInitMultiWindowClass(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -209,7 +209,7 @@ static jmp_buf g_jmpWMEntry;
|
||||||
static jmp_buf g_jmpXMsgProcEntry;
|
static jmp_buf g_jmpXMsgProcEntry;
|
||||||
static Bool g_shutdown = FALSE;
|
static Bool g_shutdown = FALSE;
|
||||||
static Bool redirectError = FALSE;
|
static Bool redirectError = FALSE;
|
||||||
static Bool g_fAnotherWMRunnig = FALSE;
|
static Bool g_fAnotherWMRunning = FALSE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* PushMessage - Push a message onto the queue
|
* PushMessage - Push a message onto the queue
|
||||||
|
@ -651,7 +651,7 @@ winMultiWindowWMProc (void *pArg)
|
||||||
{
|
{
|
||||||
WMMsgNodePtr pNode;
|
WMMsgNodePtr pNode;
|
||||||
|
|
||||||
if(g_fAnotherWMRunnig)/* Another Window manager exists. */
|
if(g_fAnotherWMRunning)/* Another Window manager exists. */
|
||||||
{
|
{
|
||||||
Sleep (1000);
|
Sleep (1000);
|
||||||
continue;
|
continue;
|
||||||
|
@ -978,26 +978,15 @@ winMultiWindowXMsgProc (void *pArg)
|
||||||
"successfully opened the display.\n");
|
"successfully opened the display.\n");
|
||||||
|
|
||||||
/* Check if another window manager is already running */
|
/* Check if another window manager is already running */
|
||||||
if (pProcArg->pWMInfo->fAllowOtherWM)
|
g_fAnotherWMRunning = CheckAnotherWindowManager (pProcArg->pDisplay, pProcArg->dwScreen);
|
||||||
{
|
|
||||||
g_fAnotherWMRunnig = CheckAnotherWindowManager (pProcArg->pDisplay, pProcArg->dwScreen);
|
if (g_fAnotherWMRunning && !pProcArg->pWMInfo->fAllowOtherWM)
|
||||||
} else {
|
{
|
||||||
redirectError = FALSE;
|
ErrorF ("winMultiWindowXMsgProc - "
|
||||||
XSetErrorHandler (winRedirectErrorHandler);
|
"another window manager is running. Exiting.\n");
|
||||||
XSelectInput(pProcArg->pDisplay,
|
pthread_exit (NULL);
|
||||||
RootWindow (pProcArg->pDisplay, pProcArg->dwScreen),
|
|
||||||
SubstructureNotifyMask | ButtonPressMask);
|
|
||||||
XSync (pProcArg->pDisplay, 0);
|
|
||||||
XSetErrorHandler (winMultiWindowXMsgProcErrorHandler);
|
|
||||||
if (redirectError)
|
|
||||||
{
|
|
||||||
ErrorF ("winMultiWindowXMsgProc - "
|
|
||||||
"another window manager is running. Exiting.\n");
|
|
||||||
pthread_exit (NULL);
|
|
||||||
}
|
}
|
||||||
g_fAnotherWMRunnig = FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set up the supported icon sizes */
|
/* Set up the supported icon sizes */
|
||||||
xis = XAllocIconSize ();
|
xis = XAllocIconSize ();
|
||||||
if (xis)
|
if (xis)
|
||||||
|
@ -1032,17 +1021,17 @@ winMultiWindowXMsgProc (void *pArg)
|
||||||
{
|
{
|
||||||
if (CheckAnotherWindowManager (pProcArg->pDisplay, pProcArg->dwScreen))
|
if (CheckAnotherWindowManager (pProcArg->pDisplay, pProcArg->dwScreen))
|
||||||
{
|
{
|
||||||
if (!g_fAnotherWMRunnig)
|
if (!g_fAnotherWMRunning)
|
||||||
{
|
{
|
||||||
g_fAnotherWMRunnig = TRUE;
|
g_fAnotherWMRunning = TRUE;
|
||||||
SendMessage(*(HWND*)pProcArg->hwndScreen, WM_UNMANAGE, 0, 0);
|
SendMessage(*(HWND*)pProcArg->hwndScreen, WM_UNMANAGE, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (g_fAnotherWMRunnig)
|
if (g_fAnotherWMRunning)
|
||||||
{
|
{
|
||||||
g_fAnotherWMRunnig = FALSE;
|
g_fAnotherWMRunning = FALSE;
|
||||||
SendMessage(*(HWND*)pProcArg->hwndScreen, WM_MANAGE, 0, 0);
|
SendMessage(*(HWND*)pProcArg->hwndScreen, WM_MANAGE, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1454,27 +1443,23 @@ winRedirectErrorHandler (Display *pDisplay, XErrorEvent *pErr)
|
||||||
static Bool
|
static Bool
|
||||||
CheckAnotherWindowManager (Display *pDisplay, DWORD dwScreen)
|
CheckAnotherWindowManager (Display *pDisplay, DWORD dwScreen)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
Try to select the events which only one client at a time is allowed to select.
|
||||||
|
If this causes an error, another window manager is already running...
|
||||||
|
*/
|
||||||
redirectError = FALSE;
|
redirectError = FALSE;
|
||||||
XSetErrorHandler (winRedirectErrorHandler);
|
XSetErrorHandler (winRedirectErrorHandler);
|
||||||
XSelectInput(pDisplay, RootWindow (pDisplay, dwScreen),
|
XSelectInput(pDisplay, RootWindow (pDisplay, dwScreen),
|
||||||
// SubstructureNotifyMask | ButtonPressMask
|
ResizeRedirectMask | SubstructureRedirectMask | ButtonPressMask);
|
||||||
ColormapChangeMask | EnterWindowMask | PropertyChangeMask |
|
|
||||||
SubstructureRedirectMask | KeyPressMask |
|
|
||||||
ButtonPressMask | ButtonReleaseMask);
|
|
||||||
XSync (pDisplay, 0);
|
XSync (pDisplay, 0);
|
||||||
XSetErrorHandler (winMultiWindowXMsgProcErrorHandler);
|
XSetErrorHandler (winMultiWindowXMsgProcErrorHandler);
|
||||||
XSelectInput(pDisplay, RootWindow (pDisplay, dwScreen),
|
|
||||||
SubstructureNotifyMask);
|
/*
|
||||||
|
Side effect: select the events we are actually interested in...
|
||||||
|
*/
|
||||||
|
XSelectInput(pDisplay, RootWindow (pDisplay, dwScreen), SubstructureNotifyMask);
|
||||||
XSync (pDisplay, 0);
|
XSync (pDisplay, 0);
|
||||||
if (redirectError)
|
return redirectError;
|
||||||
{
|
|
||||||
//ErrorF ("CheckAnotherWindowManager() - another window manager is running. Exiting.\n");
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue
Block a user