aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xwin/winmultiwindowwm.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-02-14 21:52:51 +0000
committermarha <marha@users.sourceforge.net>2010-02-14 21:52:51 +0000
commit00e6751183c1e854ea3eba746b101449b32201a4 (patch)
tree3494085d6728e086582f30c8a68846d81840303d /xorg-server/hw/xwin/winmultiwindowwm.c
parentac637a8cd15f3977f44b701c7ac71a561763c1d8 (diff)
parent8d38172d866775594af3185ae3fbd8d750677650 (diff)
downloadvcxsrv-00e6751183c1e854ea3eba746b101449b32201a4.tar.gz
vcxsrv-00e6751183c1e854ea3eba746b101449b32201a4.tar.bz2
vcxsrv-00e6751183c1e854ea3eba746b101449b32201a4.zip
svn merge ^/branches/released
Diffstat (limited to 'xorg-server/hw/xwin/winmultiwindowwm.c')
-rw-r--r--xorg-server/hw/xwin/winmultiwindowwm.c61
1 files changed, 47 insertions, 14 deletions
diff --git a/xorg-server/hw/xwin/winmultiwindowwm.c b/xorg-server/hw/xwin/winmultiwindowwm.c
index 083590218..c3742b755 100644
--- a/xorg-server/hw/xwin/winmultiwindowwm.c
+++ b/xorg-server/hw/xwin/winmultiwindowwm.c
@@ -187,7 +187,7 @@ static void
winInitMultiWindowWM (WMInfoPtr pWMInfo, WMProcArgPtr pProcArg);
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);
@@ -396,6 +396,7 @@ GetWindowName (Display *pDisplay, Window iWin, wchar_t **ppName)
pszReturnData = (char *) malloc (iLen + 1);
pszReturnData[0] = '\0';
for (i = 0; i < nNum; i++) strcat (pszReturnData, ppList[i]);
+ if (ppList) XFreeStringList (ppList);
}
else
{
@@ -406,9 +407,7 @@ GetWindowName (Display *pDisplay, Window iWin, wchar_t **ppName)
*ppName = (wchar_t*)malloc(sizeof(wchar_t)*(iLen + 1));
MultiByteToWideChar (CP_UTF8, 0, pszReturnData, -1, *ppName, iLen);
XFree (xtpName.value);
- if (ppList) XFreeStringList (ppList);
free (pszReturnData);
-
winDebug ("GetWindowName - Returning\n");
}
@@ -804,9 +803,7 @@ winMultiWindowXMsgProc (void *pArg)
/* See if X supports the current locale */
if (XSupportsLocale () == False)
{
- ErrorF ("winMultiWindowXMsgProc - Locale not supported by X. "
- "Exiting.\n");
- pthread_exit (NULL);
+ ErrorF ("winMultiWindowXMsgProc - Warning: locale not supported by X\n");
}
/* Release the server started mutex */
@@ -879,7 +876,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)
{
@@ -930,7 +927,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)
{
@@ -1179,8 +1176,7 @@ winInitMultiWindowWM (WMInfoPtr pWMInfo, WMProcArgPtr pProcArg)
/* See if X supports the current locale */
if (XSupportsLocale () == False)
{
- ErrorF ("winInitMultiWindowWM - Locale not supported by X. Exiting.\n");
- pthread_exit (NULL);
+ ErrorF ("winInitMultiWindowWM - Warning: Locale not supported by X.\n");
}
/* Release the server started mutex */
@@ -1414,7 +1410,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.
@@ -1429,8 +1425,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;
}
@@ -1451,6 +1451,7 @@ winDeinitMultiWindowWM (void)
#define HINT_BORDER (1L<<1)
#define HINT_SIZEBOX (1l<<2)
#define HINT_CAPTION (1l<<3)
+#define HINT_NOMAXIMIZE (1L<<4)
/* These two are used on their own */
#define HINT_MAX (1L<<0)
#define HINT_MIN (1L<<1)
@@ -1532,7 +1533,32 @@ winApplyHints (Display *pDisplay, Window iWindow, HWND hWnd, HWND *zstyle)
if (pAtom) XFree(pAtom);
}
- /* Apply Styles, overriding hint settings from above */
+ {
+ XSizeHints *normal_hint = XAllocSizeHints();
+ long supplied;
+ if (normal_hint && (XGetWMNormalHints(pDisplay, iWindow, normal_hint, &supplied) == Success))
+ {
+ if (normal_hint->flags & PMaxSize)
+ {
+ /* Not maximizable if a maximum size is specified */
+ hint |= HINT_NOMAXIMIZE;
+
+ if (normal_hint->flags & PMinSize)
+ {
+ /*
+ If both minimum size and maximum size are specified and are the same,
+ don't bother with a resizing frame
+ */
+ if ((normal_hint->min_width == normal_hint->max_width)
+ && (normal_hint->min_height == normal_hint->max_height))
+ hint = (hint & ~HINT_SIZEBOX);
+ }
+ }
+ }
+ XFree(normal_hint);
+ }
+
+ /* Override hint settings from above with settings from config file */
style = winOverrideStyle((unsigned long)pWin);
if (style & STYLE_TOPMOST) *zstyle = HWND_TOPMOST;
else if (style & STYLE_MAXIMIZE) maxmin = (hint & ~HINT_MIN) | HINT_MAX;
@@ -1549,12 +1575,19 @@ winApplyHints (Display *pDisplay, Window iWindow, HWND hWnd, HWND *zstyle)
else if (style & STYLE_NOFRAME)
hint = (hint & ~HINT_BORDER & ~HINT_CAPTION) | HINT_NOFRAME;
+ /* Now apply styles to window */
style = GetWindowLongPtr(hWnd, GWL_STYLE) & ~WS_CAPTION & ~WS_SIZEBOX; /* Just in case */
if (!hint) /* All on, but no resize of children is allowed */
style = style | WS_CAPTION;
- else if (hint & HINT_NOFRAME); /* All off, so do nothing */
+ else if (hint & HINT_NOFRAME) /* All off */
+ style = style & ~WS_CAPTION & ~WS_SIZEBOX;
else style = style | ((hint & HINT_BORDER) ? WS_BORDER : 0) |
+ ((hint & HINT_SIZEBOX) ? WS_SIZEBOX : 0) |
((hint & HINT_CAPTION) ? WS_CAPTION : 0);
+
+ if (hint & HINT_NOMAXIMIZE)
+ style = style & ~WS_MAXIMIZEBOX;
+
if (winMultiWindowGetWMNormalHints(pWin, &SizeHints))
{