summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de>2005-07-05 14:09:48 +0000
committerAlexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de>2005-07-05 14:09:48 +0000
commit3af77ad3e754c4d419a1996ca73a9fd01f92388a (patch)
tree6580169a46d59819f94749d28265608ab8c14a18
parent426282268bcdd0e0ca973fa79b414e9065fbfd9d (diff)
External windowmanagers could connect in multiwindow mode which lead to
strange results with the internal windowmanager.
-rw-r--r--hw/xwin/ChangeLog8
-rw-r--r--hw/xwin/winmultiwindowwm.c27
-rw-r--r--hw/xwin/winscrinit.c3
-rw-r--r--hw/xwin/winwindow.h3
4 files changed, 36 insertions, 5 deletions
diff --git a/hw/xwin/ChangeLog b/hw/xwin/ChangeLog
index b9f521cb3..7ce672667 100644
--- a/hw/xwin/ChangeLog
+++ b/hw/xwin/ChangeLog
@@ -1,5 +1,13 @@
2005-07-05 Alexander Gottwald <ago at freedesktop dot org>
+ * winwindow.h:
+ * winmultiwindowwm.c:
+ * winscrinit.c:
+ External windowmanagers could connect in multiwindow mode which lead
+ to strange results with the internal windowmanager.
+
+2005-07-05 Alexander Gottwald <ago at freedesktop dot org>
+
* *.c:
Include xwin-config.h if HAVE_XWIN_CONFIG is defined
Cleanup X11 includes handling
diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c
index 217603dc9..47c43d98f 100644
--- a/hw/xwin/winmultiwindowwm.c
+++ b/hw/xwin/winmultiwindowwm.c
@@ -112,6 +112,7 @@ typedef struct _WMInfo {
Atom atmWmProtos;
Atom atmWmDelete;
Atom atmPrivMap;
+ Bool fAllowOtherWM;
} WMInfoRec, *WMInfoPtr;
typedef struct _WMProcArgRec {
@@ -933,7 +934,25 @@ winMultiWindowXMsgProc (void *pArg)
"successfully opened the display.\n");
/* Check if another window manager is already running */
- g_fAnotherWMRunnig = CheckAnotherWindowManager (pProcArg->pDisplay, pProcArg->dwScreen);
+ if (pProcArg->pWMInfo->fAllowOtherWM)
+ {
+ g_fAnotherWMRunnig = CheckAnotherWindowManager (pProcArg->pDisplay, pProcArg->dwScreen);
+ } else {
+ redirectError = FALSE;
+ XSetErrorHandler (winRedirectErrorHandler);
+ XSelectInput(pProcArg->pDisplay,
+ 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 */
xis = XAllocIconSize ();
@@ -962,7 +981,7 @@ winMultiWindowXMsgProc (void *pArg)
/* Loop until we explicitly break out */
while (1)
{
- if (!XPending (pProcArg->pDisplay))
+ if (pProcArg->pWMInfo->fAllowOtherWM && !XPending (pProcArg->pDisplay))
{
if (CheckAnotherWindowManager (pProcArg->pDisplay, pProcArg->dwScreen))
{
@@ -1057,7 +1076,8 @@ winInitWM (void **ppWMInfo,
pthread_t *ptXMsgProc,
pthread_mutex_t *ppmServerStarted,
int dwScreen,
- HWND hwndScreen)
+ HWND hwndScreen,
+ BOOL allowOtherWM)
{
WMProcArgPtr pArg = (WMProcArgPtr) malloc (sizeof(WMProcArgRec));
WMInfoPtr pWMInfo = (WMInfoPtr) malloc (sizeof(WMInfoRec));
@@ -1077,6 +1097,7 @@ 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;
diff --git a/hw/xwin/winscrinit.c b/hw/xwin/winscrinit.c
index d5117513e..0c8d23ad5 100644
--- a/hw/xwin/winscrinit.c
+++ b/hw/xwin/winscrinit.c
@@ -610,7 +610,8 @@ winFinishScreenInitFB (int index,
&pScreenPriv->ptXMsgProc,
&pScreenPriv->pmServerStarted,
pScreenInfo->dwScreen,
- (HWND)&pScreenPriv->hwndScreen))
+ (HWND)&pScreenPriv->hwndScreen,
+ pScreenInfo->fInternalWM))
{
ErrorF ("winFinishScreenInitFB - winInitWM () failed.\n");
return FALSE;
diff --git a/hw/xwin/winwindow.h b/hw/xwin/winwindow.h
index 6cc69aa19..d0499bcbb 100644
--- a/hw/xwin/winwindow.h
+++ b/hw/xwin/winwindow.h
@@ -124,7 +124,8 @@ winInitWM (void **ppWMInfo,
pthread_t *ptXMsgProc,
pthread_mutex_t *ppmServerStarted,
int dwScreen,
- HWND hwndScreen);
+ HWND hwndScreen,
+ BOOL allowOtherWM);
void
winDeinitMultiWindowWM (void);