summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon TURNEY <jon.turney@dronecode.org.uk>2015-06-02 14:44:43 +0100
committerJon TURNEY <jon.turney@dronecode.org.uk>2015-06-02 14:44:43 +0100
commit7c61592022ea519edf92e86d721d707580eacbdb (patch)
tree63a63743dfb14ad5fcfbe04712aa39419b54bd51
parentb17931db63a489486b2bb3cf537f09c3fd42d53d (diff)
parentd70eff4f05291f151dc31ba5e57e9534a13cfbf3 (diff)
Merge branch 'cygwin-patches-for-1.17' into cygwin-release-1.17xserver-cygwin-1.17.1-5
-rw-r--r--dix/main.c4
-rw-r--r--hw/xwin/InitOutput.c39
-rw-r--r--hw/xwin/winerror.c26
-rw-r--r--hw/xwin/winglobals.c7
-rw-r--r--hw/xwin/winglobals.h5
-rw-r--r--hw/xwin/winmultiwindowwindow.c50
-rw-r--r--hw/xwin/winmultiwindowwm.c202
-rw-r--r--hw/xwin/winmultiwindowwndproc.c30
-rw-r--r--hw/xwin/winprocarg.c6
-rw-r--r--hw/xwin/winwindow.h4
10 files changed, 235 insertions, 138 deletions
diff --git a/dix/main.c b/dix/main.c
index 3a3eb1cf7..09f9504b8 100644
--- a/dix/main.c
+++ b/dix/main.c
@@ -159,6 +159,8 @@ dix_main(int argc, char *argv[], char *envp[])
DPMSPowerLevel = 0;
#endif
InitBlockAndWakeupHandlers();
+ /* Perform any operating system dependent initializations you'd like */
+ OsInit();
if (serverGeneration == 1) {
CreateWellKnownSockets();
for (i = 1; i < MAXCLIENTS; i++)
@@ -170,8 +172,6 @@ dix_main(int argc, char *argv[], char *envp[])
}
else
ResetWellKnownSockets();
- /* Perform any operating system dependent initializations you'd like */
- OsInit();
clients[0] = serverClient;
currentMaxClients = 1;
diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c
index 30b4e86c8..029a3d7cd 100644
--- a/hw/xwin/InitOutput.c
+++ b/hw/xwin/InitOutput.c
@@ -220,10 +220,6 @@ ddxGiveUp(enum ExitCode error)
}
#endif
- if (!g_fLogInited) {
- g_pszLogFile = LogInit(g_pszLogFile, ".old");
- g_fLogInited = TRUE;
- }
LogClose(error);
/*
@@ -620,13 +616,13 @@ winFixupPaths(void)
winMsg(X_ERROR, "Can not determine HOME directory\n");
}
}
- if (!g_fLogFileChanged) {
+ if (!g_fLogFile) {
static char buffer[MAX_PATH];
DWORD size = GetTempPath(sizeof(buffer), buffer);
if (size && size < sizeof(buffer)) {
snprintf(buffer + size, sizeof(buffer) - size,
- "XWin.%s.log", display);
+ g_pszLogFileFormat, display);
buffer[sizeof(buffer) - 1] = 0;
g_pszLogFile = buffer;
winMsg(X_DEFAULT, "Logfile set to \"%s\"\n", g_pszLogFile);
@@ -657,18 +653,16 @@ OsVendorInit(void)
OsVendorVErrorFProc = OsVendorVErrorF;
#endif
- if (!g_fLogInited) {
- /* keep this order. If LogInit fails it calls Abort which then calls
- * ddxGiveUp where LogInit is called again and creates an infinite
- * recursion. If we set g_fLogInited to TRUE before the init we
- * avoid the second call
- */
- g_fLogInited = TRUE;
- g_pszLogFile = LogInit(g_pszLogFile, ".old");
+ if (serverGeneration == 1) {
+ if (g_pszLogFile)
+ g_pszLogFile = LogInit(g_pszLogFile, ".old");
+ else
+ g_pszLogFile = LogInit(g_pszLogFileFormat, ".old");
/* Tell crashreporter logfile name */
xorg_crashreport_init(g_pszLogFile);
}
+
LogSetParameter(XLOG_FLUSH, 1);
LogSetParameter(XLOG_VERBOSITY, g_iLogVerbose);
LogSetParameter(XLOG_FILE_VERBOSITY, g_iLogVerbose);
@@ -914,24 +908,7 @@ winUseMsg(void)
void
ddxUseMsg(void)
{
- /* Set a flag so that FatalError won't give duplicate warning message */
- g_fSilentFatalError = TRUE;
-
winUseMsg();
-
- /* Log file will not be opened for UseMsg unless we open it now */
- if (!g_fLogInited) {
- g_pszLogFile = LogInit(g_pszLogFile, ".old");
- g_fLogInited = TRUE;
- }
- LogClose(EXIT_NO_ERROR);
-
- /* Notify user where UseMsg text can be found. */
- if (!g_fNoHelpMessageBox)
- winMessageBoxF("The " PROJECT_NAME " help text has been printed to "
- "%s.\n"
- "Please open %s to read the help text.\n",
- MB_ICONINFORMATION, g_pszLogFile, g_pszLogFile);
}
/* See Porting Layer Definition - p. 20 */
diff --git a/hw/xwin/winerror.c b/hw/xwin/winerror.c
index 47ac20246..09b8dda0c 100644
--- a/hw/xwin/winerror.c
+++ b/hw/xwin/winerror.c
@@ -48,16 +48,6 @@ OsVendorVErrorF(const char *pszFormat, va_list va_args)
pthread_mutex_lock(&s_pmPrinting);
#endif
- /* If we want to silence it,
- * detect if we are going to abort due to duplication error */
- if (g_fSilentDupError) {
- if ((strcmp(pszFormat, "InitOutput - Duplicate invocation on display number: %s. Exiting.\n") == 0)
- || (strcmp(pszFormat, "Server is already active for display %s\n%s %s\n%s\n") == 0)
- || (strcmp(pszFormat, "MakeAllCOTSServerListeners: server already running\n") == 0)) {
- g_fSilentFatalError = TRUE;
- }
- }
-
/* Print the error message to a log file, could be stderr */
LogVWrite(0, pszFormat, va_args);
@@ -79,14 +69,20 @@ OsVendorFatalError(const char *f, va_list args)
{
char errormsg[1024] = "";
- /* Don't give duplicate warning if UseMsg was called */
+ /* If we want to silence it,
+ * detect if we are going to abort due to duplication error */
+ if (g_fSilentDupError) {
+ if ((strcmp(f, "InitOutput - Duplicate invocation on display number: %s. Exiting.\n") == 0)
+ || (strcmp(f, "Server is already active for display %s\n%s %s\n%s\n") == 0)
+ || (strcmp(f, "MakeAllCOTSServerListeners: server already running\n") == 0)) {
+ g_fSilentFatalError = TRUE;
+ }
+ }
+
+ /* Don't give warning if it's been silenced */
if (g_fSilentFatalError)
return;
- if (!g_fLogInited) {
- g_fLogInited = TRUE;
- g_pszLogFile = LogInit(g_pszLogFile, ".old");
- }
LogClose(EXIT_ERR_ABORT);
/* Format the error message */
diff --git a/hw/xwin/winglobals.c b/hw/xwin/winglobals.c
index 1382c8972..8a699f236 100644
--- a/hw/xwin/winglobals.c
+++ b/hw/xwin/winglobals.c
@@ -63,13 +63,12 @@ HICON g_hIconX = NULL;
HICON g_hSmallIconX = NULL;
#ifndef RELOCATE_PROJECTROOT
-const char *g_pszLogFile = DEFAULT_LOGDIR "/XWin.%s.log";
+const char *g_pszLogFileFormat = DEFAULT_LOGDIR "/XWin.%s.log";
#else
-const char *g_pszLogFile = "XWin.log";
-Bool g_fLogFileChanged = FALSE;
+const char *g_pszLogFileFormat = "XWin.%s.log";
#endif
+const char *g_pszLogFile = NULL;
int g_iLogVerbose = 2;
-Bool g_fLogInited = FALSE;
char *g_pszCommandLine = NULL;
Bool g_fSilentFatalError = FALSE;
DWORD g_dwCurrentThreadID = 0;
diff --git a/hw/xwin/winglobals.h b/hw/xwin/winglobals.h
index d7b813dbb..a20f266c2 100644
--- a/hw/xwin/winglobals.h
+++ b/hw/xwin/winglobals.h
@@ -40,13 +40,10 @@ extern int g_iNumScreens;
extern int g_iLastScreen;
extern char *g_pszCommandLine;
extern Bool g_fSilentFatalError;
+extern const char *g_pszLogFileFormat;
extern const char *g_pszLogFile;
-#ifdef RELOCATE_PROJECTROOT
-extern Bool g_fLogFileChanged;
-#endif
extern int g_iLogVerbose;
-extern Bool g_fLogInited;
extern Bool g_fAuthEnabled;
extern Bool g_fXdmcpEnabled;
diff --git a/hw/xwin/winmultiwindowwindow.c b/hw/xwin/winmultiwindowwindow.c
index e4e6db0d6..0fe300227 100644
--- a/hw/xwin/winmultiwindowwindow.c
+++ b/hw/xwin/winmultiwindowwindow.c
@@ -1012,56 +1012,6 @@ winReorderWindowsMultiWindow(void)
}
/*
- * winMinimizeWindow - Minimize in response to WM_CHANGE_STATE
- */
-
-void
-winMinimizeWindow(Window id)
-{
- WindowPtr pWin;
- winPrivWinPtr pWinPriv;
-
-#ifdef XWIN_MULTIWINDOWEXTWM
- win32RootlessWindowPtr pRLWinPriv;
-#endif
- HWND hWnd;
- ScreenPtr pScreen = NULL;
- winPrivScreenPtr pScreenPriv = NULL;
-
-#if CYGWINDOWING_DEBUG
- ErrorF("winMinimizeWindow\n");
-#endif
-
- dixLookupResourceByType((void *) &pWin, id, RT_WINDOW, NullClient,
- DixUnknownAccess);
- if (!pWin) {
- ErrorF("%s: NULL pWin. Leaving\n", __FUNCTION__);
- return;
- }
-
- pScreen = pWin->drawable.pScreen;
- if (pScreen)
- pScreenPriv = winGetScreenPriv(pScreen);
-
-#ifdef XWIN_MULTIWINDOWEXTWM
- if (pScreenPriv && pScreenPriv->pScreenInfo->fInternalWM) {
- pRLWinPriv =
- (win32RootlessWindowPtr) RootlessFrameForWindow(pWin, FALSE);
- hWnd = pRLWinPriv->hWnd;
- }
- else
-#else
- if (pScreenPriv)
-#endif
- {
- pWinPriv = winGetWindowPriv(pWin);
- hWnd = pWinPriv->hWnd;
- }
-
- ShowWindow(hWnd, SW_MINIMIZE);
-}
-
-/*
* CopyWindow - See Porting Layer Definition - p. 39
*/
void
diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c
index e2bd7e127..754bf7926 100644
--- a/hw/xwin/winmultiwindowwm.c
+++ b/hw/xwin/winmultiwindowwm.c
@@ -139,6 +139,11 @@ typedef struct _WMInfo {
Atom atmCurrentDesktop;
Atom atmNumberDesktops;
Atom atmDesktopNames;
+ Atom atmWmState;
+ Atom atmNetWmState;
+ Atom atmHiddenState;
+ Atom atmVertMaxState;
+ Atom atmHorzMaxState;
Bool fAllowOtherWM;
} WMInfoRec, *WMInfoPtr;
@@ -216,7 +221,7 @@ static void
winApplyUrgency(Display * pDisplay, Window iWindow, HWND hWnd);
static void
- winApplyHints(Display * pDisplay, Window iWindow, HWND hWnd, HWND * zstyle);
+ winApplyHints(WMInfoPtr pWMInfo, Window iWindow, HWND hWnd, HWND * zstyle);
/*
* Local globals
@@ -729,7 +734,7 @@ UpdateStyle(WMInfoPtr pWMInfo, Window iWindow)
return;
/* Determine the Window style, which determines borders and clipping region... */
- winApplyHints(pWMInfo->pDisplay, iWindow, hWnd, &zstyle);
+ winApplyHints(pWMInfo, iWindow, hWnd, &zstyle);
winUpdateWindowPosition(hWnd, &zstyle);
/* Apply the updated window style, without changing it's show or activation state */
@@ -755,6 +760,148 @@ UpdateStyle(WMInfoPtr pWMInfo, Window iWindow)
winApplyUrgency(pWMInfo->pDisplay, iWindow, hWnd);
}
+/*
+ * Updates the state of a HWND
+ */
+
+static void
+UpdateState(WMInfoPtr pWMInfo, Window iWindow, int state)
+{
+ HWND hWnd;
+ int current_state = -1;
+
+ winDebug("UpdateState: iWindow 0x%08x %d\n", (int)iWindow, state);
+
+ hWnd = getHwnd(pWMInfo, iWindow);
+ if (hWnd)
+ {
+ // Keep track of the Window state, do nothing if it's not changing
+ current_state = (intptr_t)GetProp(hWnd, WIN_STATE_PROP);
+
+ if (current_state == state)
+ return;
+
+ SetProp(hWnd, WIN_STATE_PROP, (HANDLE)(intptr_t)state);
+
+ switch (state)
+ {
+ case IconicState:
+ ShowWindow(hWnd, SW_SHOWMINNOACTIVE);
+ break;
+
+ case ZoomState:
+ // ZoomState should only come internally, not from a client
+ // There doesn't seem to be a SW_SHOWMAXNOACTIVE, but Window should
+ // already displayed correctly.
+ break;
+
+ case NormalState:
+ ShowWindow(hWnd, SW_SHOWNA);
+ break;
+
+ case WithdrawnState:
+ ShowWindow(hWnd, SW_HIDE);
+ break;
+ }
+ }
+
+ // Update WM_STATE property
+ {
+ // ZoomState is obsolete in ICCCM, so map it to NormalState
+ int icccm_state = state;
+ int icccm_current_state = current_state;
+
+ if (icccm_state == ZoomState)
+ icccm_state = NormalState;
+
+ if (icccm_current_state == ZoomState)
+ icccm_current_state = NormalState;
+
+ // Don't change property unnecessarily
+ //
+ // (Note that we do not take notice of WM_STATE PropertyNotify, only
+ // WM_CHANGE_STATE ClientMessage, so this should not cause the state to
+ // change itself)
+ if (icccm_current_state != icccm_state)
+ {
+ struct
+ {
+ CARD32 state;
+ XID icon;
+ } wmstate;
+
+ wmstate.state = icccm_state;
+ wmstate.icon = None;
+
+ XChangeProperty(pWMInfo->pDisplay, iWindow, pWMInfo->atmWmState,
+ pWMInfo->atmWmState, 32, PropModeReplace,
+ (unsigned char *) &wmstate,
+ sizeof(wmstate)/sizeof(int));
+ }
+ }
+
+ // Update _NET_WM_STATE property
+ if (state == WithdrawnState) {
+ XDeleteProperty(pWMInfo->pDisplay, iWindow, pWMInfo->atmNetWmState);
+ }
+ else {
+ Atom type, *pAtom = NULL;
+ int format;
+ unsigned long nitems = 0, left;
+
+ XGetWindowProperty(pWMInfo->pDisplay, iWindow,
+ pWMInfo->atmNetWmState, 0L,
+ MAXINT, False, XA_ATOM, &type, &format,
+ &nitems, &left,
+ (unsigned char **) &pAtom);
+ {
+ unsigned long i, o = 0;
+ Atom netwmstate[nitems + 2];
+ Bool changed = FALSE;
+
+ // Make a copy with _NET_WM_HIDDEN, _NET_WM_MAXIMIZED_{VERT,HORZ}
+ // removed
+ for (i = 0; i < nitems; i++) {
+ if ((pAtom[i] != pWMInfo->atmHiddenState) &&
+ (pAtom[i] != pWMInfo->atmVertMaxState) &&
+ (pAtom[i] != pWMInfo->atmHorzMaxState))
+ netwmstate[o++] = pAtom[i];
+ }
+ XFree(pAtom);
+
+ // if iconized, add _NET_WM_HIDDEN
+ if (state == IconicState) {
+ netwmstate[o++] = pWMInfo->atmHiddenState;
+ }
+
+ // if maximized, add _NET_WM_MAXIMIZED_{VERT,HORZ}
+ if (state == ZoomState) {
+ netwmstate[o++] = pWMInfo->atmVertMaxState;
+ netwmstate[o++] = pWMInfo->atmHorzMaxState;
+ }
+
+ // Don't change property unnecessarily
+ if (nitems != o)
+ changed = TRUE;
+ else
+ for (i = 0; i < nitems; i++)
+ {
+ if (pAtom[i] != netwmstate[i])
+ {
+ changed = TRUE;
+ break;
+ }
+ }
+
+ if (changed)
+ XChangeProperty(pWMInfo->pDisplay, iWindow,
+ pWMInfo->atmNetWmState, XA_ATOM, 32,
+ PropModeReplace, (unsigned char *) &netwmstate,
+ o);
+ }
+ }
+}
+
#if 0
/*
* Fix up any differences between the X11 and Win32 window stacks
@@ -1006,8 +1153,7 @@ winMultiWindowWMProc(void *pArg)
break;
case WM_WM_CHANGE_STATE:
- /* Minimize the window in Windows */
- winMinimizeWindow(pNode->msg.iWindow);
+ UpdateState(pWMInfo, pNode->msg.iWindow, pNode->msg.dwID);
break;
default:
@@ -1181,16 +1327,6 @@ winMultiWindowXMsgProc(void *pArg)
atmWindowType = XInternAtom(pProcArg->pDisplay, "_NET_WM_WINDOW_TYPE", False);
atmNormalHints = XInternAtom(pProcArg->pDisplay, "WM_NORMAL_HINTS", False);
- /*
- iiimxcf had a bug until 2009-04-27, assuming that the
- WM_STATE atom exists, causing clients to fail with
- a BadAtom X error if it doesn't.
-
- Since this is on in the default Solaris 10 install,
- workaround this by making sure it does exist...
- */
- XInternAtom(pProcArg->pDisplay, "WM_STATE", 0);
-
/* Loop until we explicitly break out */
while (1) {
if (g_shutdown)
@@ -1283,6 +1419,13 @@ winMultiWindowXMsgProc(void *pArg)
}
}
}
+ else if (event.type == UnmapNotify) {
+ msg.msg = WM_WM_CHANGE_STATE;
+ msg.iWindow = event.xunmap.window;
+ msg.dwID = WithdrawnState;
+
+ winSendMessageToWM(pProcArg->pWMInfo, &msg);
+ }
else if (event.type == ConfigureNotify) {
if (!event.xconfigure.send_event) {
/*
@@ -1359,6 +1502,7 @@ winMultiWindowXMsgProc(void *pArg)
msg.msg = WM_WM_CHANGE_STATE;
msg.iWindow = event.xclient.window;
+ msg.dwID = event.xclient.data.l[0];
winSendMessageToWM(pProcArg->pWMInfo, &msg);
}
@@ -1553,6 +1697,16 @@ winInitMultiWindowWM(WMInfoPtr pWMInfo, WMProcArgPtr pProcArg)
"_NET_NUMBER_OF_DESKTOPS", False);
pWMInfo->atmDesktopNames = XInternAtom(pWMInfo->pDisplay,
"_NET_DESKTOP_NAMES", False);
+ pWMInfo->atmWmState = XInternAtom(pWMInfo->pDisplay,
+ "WM_STATE", False);
+ pWMInfo->atmNetWmState = XInternAtom(pWMInfo->pDisplay,
+ "_NET_WM_STATE", False);
+ pWMInfo->atmHiddenState = XInternAtom(pWMInfo->pDisplay,
+ "_NET_WM_STATE_HIDDEN", False);
+ pWMInfo->atmVertMaxState = XInternAtom(pWMInfo->pDisplay,
+ "_NET_WM_STATE_MAXIMIZED_VERT", False);
+ pWMInfo->atmHorzMaxState = XInternAtom(pWMInfo->pDisplay,
+ "_NET_WM_STATE_MAXIMIZED_HORZ", False);
/*
Set root window properties for describing multiple desktops to describe
@@ -1797,11 +1951,10 @@ winApplyUrgency(Display * pDisplay, Window iWindow, HWND hWnd)
#define HINT_MIN (1L<<1)
static void
-winApplyHints(Display * pDisplay, Window iWindow, HWND hWnd, HWND * zstyle)
+winApplyHints(WMInfoPtr pWMInfo, Window iWindow, HWND hWnd, HWND * zstyle)
{
- static Atom windowState, motif_wm_hints, windowType;
- static Atom hiddenState, fullscreenState, belowState, aboveState,
- skiptaskbarState, vertMaxState, horzMaxState;
+ static Atom motif_wm_hints, windowType;
+ static Atom fullscreenState, belowState, aboveState, skiptaskbarState;
static Atom dockWindow, splashWindow;
static int generation;
Atom type, *pAtom = NULL;
@@ -1809,6 +1962,7 @@ winApplyHints(Display * pDisplay, Window iWindow, HWND hWnd, HWND * zstyle)
unsigned long hint = 0, maxmin = 0, nitems = 0, left = 0;
unsigned long style, exStyle;
MwmHints *mwm_hint = NULL;
+ Display *pDisplay = pWMInfo->pDisplay;
if (!hWnd)
return;
@@ -1817,10 +1971,8 @@ winApplyHints(Display * pDisplay, Window iWindow, HWND hWnd, HWND * zstyle)
if (generation != serverGeneration) {
generation = serverGeneration;
- windowState = XInternAtom(pDisplay, "_NET_WM_STATE", False);
motif_wm_hints = XInternAtom(pDisplay, "_MOTIF_WM_HINTS", False);
windowType = XInternAtom(pDisplay, "_NET_WM_WINDOW_TYPE", False);
- hiddenState = XInternAtom(pDisplay, "_NET_WM_STATE_HIDDEN", False);
fullscreenState =
XInternAtom(pDisplay, "_NET_WM_STATE_FULLSCREEN", False);
belowState = XInternAtom(pDisplay, "_NET_WM_STATE_BELOW", False);
@@ -1829,11 +1981,9 @@ winApplyHints(Display * pDisplay, Window iWindow, HWND hWnd, HWND * zstyle)
splashWindow = XInternAtom(pDisplay, "_NET_WM_WINDOW_TYPE_SPLASH", False);
skiptaskbarState =
XInternAtom(pDisplay, "_NET_WM_STATE_SKIP_TASKBAR", False);
- vertMaxState = XInternAtom(pDisplay, "_NET_WM_STATE_MAXIMIZED_VERT", False);
- horzMaxState = XInternAtom(pDisplay, "_NET_WM_STATE_MAXIMIZED_HORZ", False);
}
- if (XGetWindowProperty(pDisplay, iWindow, windowState, 0L,
+ if (XGetWindowProperty(pDisplay, iWindow, pWMInfo->atmNetWmState, 0L,
MAXINT, False, XA_ATOM, &type, &format,
&nitems, &left,
(unsigned char **) &pAtom) == Success) {
@@ -1846,7 +1996,7 @@ winApplyHints(Display * pDisplay, Window iWindow, HWND hWnd, HWND * zstyle)
for (i = 0; i < nitems; i++) {
if (pAtom[i] == skiptaskbarState)
hint |= HINT_SKIPTASKBAR;
- if (pAtom[i] == hiddenState)
+ if (pAtom[i] == pWMInfo->atmHiddenState)
maxmin |= HINT_MIN;
else if (pAtom[i] == fullscreenState)
maxmin |= HINT_MAX;
@@ -1854,9 +2004,9 @@ winApplyHints(Display * pDisplay, Window iWindow, HWND hWnd, HWND * zstyle)
*zstyle = HWND_BOTTOM;
else if (pAtom[i] == aboveState)
*zstyle = HWND_TOPMOST;
- if (pAtom[i] == vertMaxState)
+ if (pAtom[i] == pWMInfo->atmVertMaxState)
verMax = TRUE;
- if (pAtom[i] == horzMaxState)
+ if (pAtom[i] == pWMInfo->atmHorzMaxState)
horMax = TRUE;
}
diff --git a/hw/xwin/winmultiwindowwndproc.c b/hw/xwin/winmultiwindowwndproc.c
index b4eb9dd6a..85b8669ae 100644
--- a/hw/xwin/winmultiwindowwndproc.c
+++ b/hw/xwin/winmultiwindowwndproc.c
@@ -295,6 +295,31 @@ winStartMousePolling(winPrivScreenPtr s_pScreenPriv)
MOUSE_POLLING_INTERVAL, NULL);
}
+static
+void
+winAdjustXWindowState(winPrivScreenPtr s_pScreenPriv, winWMMessageRec *wmMsg)
+{
+ wmMsg->msg = WM_WM_CHANGE_STATE;
+ if (IsIconic(wmMsg->hwndWindow)) {
+ wmMsg->dwID = 3; // IconicState
+ winSendMessageToWM(s_pScreenPriv->pWMInfo, wmMsg);
+ }
+ else if (IsZoomed(wmMsg->hwndWindow)) {
+ wmMsg->dwID = 2; // ZoomState
+ winSendMessageToWM(s_pScreenPriv->pWMInfo, wmMsg);
+ }
+ else if (IsWindowVisible(wmMsg->hwndWindow)) {
+ wmMsg->dwID = 1; // NormalState
+ winSendMessageToWM(s_pScreenPriv->pWMInfo, wmMsg);
+ }
+ else {
+ /* Only the client, not the user can Withdraw windows, so it doesn't make
+ much sense to handle that state here, and anything else is an
+ unanticapted state. */
+ ErrorF("winAdjustXWindowState - Unknown state for %p\n", wmMsg->hwndWindow);
+ }
+}
+
/*
* winTopLevelWindowProc - Window procedure for all top-level Windows windows.
*/
@@ -869,6 +894,7 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
RemoveProp(hwnd, WIN_WINDOW_PROP);
RemoveProp(hwnd, WIN_WID_PROP);
RemoveProp(hwnd, WIN_NEEDMANAGE_PROP);
+ RemoveProp(hwnd, WIN_STATE_PROP);
break;
@@ -1017,6 +1043,8 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
/* Adjust the X Window to the moved Windows window */
hasEnteredSizeMove = FALSE;
winAdjustXWindow(pWin, hwnd);
+ if (fWMMsgInitialized)
+ winAdjustXWindowState(s_pScreenPriv, &wmMsg);
return 0;
case WM_SIZE:
@@ -1046,6 +1074,8 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
if (!hasEnteredSizeMove) {
/* Adjust the X Window to the moved Windows window */
winAdjustXWindow(pWin, hwnd);
+ if (fWMMsgInitialized)
+ winAdjustXWindowState(s_pScreenPriv, &wmMsg);
if (wParam == SIZE_MINIMIZED)
winReorderWindowsMultiWindow();
}
diff --git a/hw/xwin/winprocarg.c b/hw/xwin/winprocarg.c
index d11ee6c1f..475745f08 100644
--- a/hw/xwin/winprocarg.c
+++ b/hw/xwin/winprocarg.c
@@ -292,6 +292,9 @@ ddxProcessArgument(int argc, char *argv[], int i)
/* Display the usage message if the argument is malformed */
if (i + 1 >= argc) {
+ ErrorF("ddxProcessArgument - screen - Missing screen number\n");
+ UseMsg();
+ FatalError("-screen missing screen number\n");
return 0;
}
@@ -1019,9 +1022,6 @@ ddxProcessArgument(int argc, char *argv[], int i)
if (IS_OPTION("-logfile")) {
CHECK_ARGS(1);
g_pszLogFile = argv[++i];
-#ifdef RELOCATE_PROJECTROOT
- g_fLogFileChanged = TRUE;
-#endif
return 2;
}
diff --git a/hw/xwin/winwindow.h b/hw/xwin/winwindow.h
index a5b9a386c..d21274f4f 100644
--- a/hw/xwin/winwindow.h
+++ b/hw/xwin/winwindow.h
@@ -58,6 +58,7 @@
#endif
#define WIN_WID_PROP "cyg_wid_prop_rl"
#define WIN_NEEDMANAGE_PROP "cyg_override_redirect_prop_rl"
+#define WIN_STATE_PROP "cyg_state_prop_rl"
#ifndef CYGMULTIWINDOW_DEBUG
#define CYGMULTIWINDOW_DEBUG NO
#endif
@@ -149,9 +150,6 @@ void
winDeinitMultiWindowWM(void);
void
- winMinimizeWindow(Window id);
-
-void
winPropertyStoreInit(void);
void