From b6bdf368420355332e41c604c523584bd39933f9 Mon Sep 17 00:00:00 2001 From: Jon Turney Date: Mon, 2 Nov 2015 20:51:51 +0000 Subject: [PATCH] hw/xwin: Remove allowOtherWM, which is now always FALSE Signed-off-by: Jon Turney Reviewed-by: Colin Harrison --- hw/xwin/winmultiwindowwm.c | 46 +++++--------------------------------- hw/xwin/winscrinit.c | 4 ++-- hw/xwin/winwindow.h | 2 +- 3 files changed, 9 insertions(+), 43 deletions(-) diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c index 97b893fc0..54d9a8a94 100644 --- a/hw/xwin/winmultiwindowwm.c +++ b/hw/xwin/winmultiwindowwm.c @@ -118,7 +118,6 @@ typedef struct _WMInfo { Atom atmWmDelete; Atom atmWmTakeFocus; Atom atmPrivMap; - Bool fAllowOtherWM; } WMInfoRec, *WMInfoPtr; typedef struct _WMProcArgRec { @@ -184,9 +183,7 @@ static void #endif static Bool - -CheckAnotherWindowManager(Display * pDisplay, DWORD dwScreen, - Bool fAllowOtherWM); +CheckAnotherWindowManager(Display * pDisplay, DWORD dwScreen); static void winApplyHints(Display * pDisplay, Window iWindow, HWND hWnd, HWND * zstyle); @@ -206,7 +203,6 @@ static XIOErrorHandler g_winMultiWindowXMsgProcOldIOErrorHandler; static pthread_t g_winMultiWindowXMsgProcThread; static Bool g_shutdown = FALSE; static Bool redirectError = FALSE; -static Bool g_fAnotherWMRunning = FALSE; /* * Translate msg id to text, for debug purposes @@ -739,11 +735,6 @@ winMultiWindowWMProc(void *pArg) for (;;) { WMMsgNodePtr pNode; - if (g_fAnotherWMRunning) { /* Another Window manager exists. */ - Sleep(1000); - continue; - } - /* Pop a message off of our queue */ pNode = PopMessage(&pWMInfo->wmMsgQueue, pWMInfo); if (pNode == NULL) { @@ -1047,11 +1038,7 @@ winMultiWindowXMsgProc(void *pArg) "successfully opened the display.\n"); /* Check if another window manager is already running */ - g_fAnotherWMRunning = - CheckAnotherWindowManager(pProcArg->pDisplay, pProcArg->dwScreen, - pProcArg->pWMInfo->fAllowOtherWM); - - if (g_fAnotherWMRunning && !pProcArg->pWMInfo->fAllowOtherWM) { + if (CheckAnotherWindowManager(pProcArg->pDisplay, pProcArg->dwScreen)) { ErrorF("winMultiWindowXMsgProc - " "another window manager is running. Exiting.\n"); pthread_exit(NULL); @@ -1093,24 +1080,6 @@ winMultiWindowXMsgProc(void *pArg) if (g_shutdown) break; - if (pProcArg->pWMInfo->fAllowOtherWM && !XPending(pProcArg->pDisplay)) { - if (CheckAnotherWindowManager - (pProcArg->pDisplay, pProcArg->dwScreen, TRUE)) { - if (!g_fAnotherWMRunning) { - g_fAnotherWMRunning = TRUE; - SendMessage(pProcArg->hwndScreen, WM_UNMANAGE, 0, 0); - } - } - else { - if (g_fAnotherWMRunning) { - g_fAnotherWMRunning = FALSE; - SendMessage(pProcArg->hwndScreen, WM_MANAGE, 0, 0); - } - } - Sleep(500); - continue; - } - /* Fetch next event */ XNextEvent(pProcArg->pDisplay, &event); @@ -1272,7 +1241,7 @@ winInitWM(void **ppWMInfo, pthread_t * ptWMProc, pthread_t * ptXMsgProc, pthread_mutex_t * ppmServerStarted, - int dwScreen, HWND hwndScreen, BOOL allowOtherWM) + int dwScreen, HWND hwndScreen) { WMProcArgPtr pArg = malloc(sizeof(WMProcArgRec)); WMInfoPtr pWMInfo = malloc(sizeof(WMInfoRec)); @@ -1294,7 +1263,6 @@ winInitWM(void **ppWMInfo, /* Set a return pointer to the Window Manager info structure */ *ppWMInfo = pWMInfo; - pWMInfo->fAllowOtherWM = allowOtherWM; /* Setup the argument structure for the thread function */ pArg->dwScreen = dwScreen; @@ -1575,8 +1543,7 @@ winRedirectErrorHandler(Display * pDisplay, XErrorEvent * pErr) */ static Bool -CheckAnotherWindowManager(Display * pDisplay, DWORD dwScreen, - Bool fAllowOtherWM) +CheckAnotherWindowManager(Display * pDisplay, DWORD dwScreen) { /* Try to select the events which only one client at a time is allowed to select. @@ -1593,12 +1560,11 @@ 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 + 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 | (!fAllowOtherWM ? ButtonPressMask : - 0)); + SubstructureNotifyMask | ButtonPressMask); XSync(pDisplay, 0); return redirectError; } diff --git a/hw/xwin/winscrinit.c b/hw/xwin/winscrinit.c index f75b2f91c..6cbf08da4 100644 --- a/hw/xwin/winscrinit.c +++ b/hw/xwin/winscrinit.c @@ -544,8 +544,8 @@ winFinishScreenInitFB(int i, ScreenPtr pScreen, int argc, char **argv) &pScreenPriv->ptWMProc, &pScreenPriv->ptXMsgProc, &pScreenPriv->pmServerStarted, - pScreenInfo->dwScreen, (HWND) &pScreenPriv->hwndScreen, - FALSE)) { + pScreenInfo->dwScreen, + (HWND) &pScreenPriv->hwndScreen)) { ErrorF("winFinishScreenInitFB - winInitWM () failed.\n"); return FALSE; } diff --git a/hw/xwin/winwindow.h b/hw/xwin/winwindow.h index 7e6bd565c..0b2bf93ce 100644 --- a/hw/xwin/winwindow.h +++ b/hw/xwin/winwindow.h @@ -142,7 +142,7 @@ winInitWM(void **ppWMInfo, pthread_t * ptWMProc, pthread_t * ptXMsgProc, pthread_mutex_t * ppmServerStarted, - int dwScreen, HWND hwndScreen, BOOL allowOtherWM); + int dwScreen, HWND hwndScreen); void winDeinitMultiWindowWM(void);