From e1c9247ba0c2740b8a181ca7770902dbf0431ffb Mon Sep 17 00:00:00 2001 From: Jon TURNEY Date: Thu, 2 Jul 2015 13:32:40 +0100 Subject: Factor out MessageName() debug helper Factor out MessageName() debug helper for message id -> text, and use it on message queue and dequeue. Reorder in numerical order to match winwindow.h Add missing WM_WM_ICON_EVENT Signed-off-by: Jon TURNEY --- hw/xwin/winmultiwindowwm.c | 128 +++++++++++++++++++++------------------------ 1 file changed, 61 insertions(+), 67 deletions(-) diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c index 754bf7926..dc329591f 100644 --- a/hw/xwin/winmultiwindowwm.c +++ b/hw/xwin/winmultiwindowwm.c @@ -237,6 +237,64 @@ static Bool g_shutdown = FALSE; static Bool redirectError = FALSE; static Bool g_fAnotherWMRunning = FALSE; +/* + * Translate msg id to text, for debug purposes + */ + +static const char * +MessageName(winWMMessagePtr msg) +{ + switch (msg->msg) + { + case WM_WM_MOVE: + return "WM_WM_MOVE"; + break; + case WM_WM_SIZE: + return "WM_WM_SIZE"; + break; + case WM_WM_RAISE: + return "WM_WM_RAISE"; + break; + case WM_WM_LOWER: + return "WM_WM_LOWER"; + break; + case WM_WM_UNMAP: + return "WM_WM_UNMAP"; + break; + case WM_WM_KILL: + return "WM_WM_KILL"; + break; + case WM_WM_ACTIVATE: + return "WM_WM_ACTIVATE"; + break; + case WM_WM_NAME_EVENT: + return "WM_WM_NAME_EVENT"; + break; + case WM_WM_ICON_EVENT: + return "WM_WM_ICON_EVENT"; + break; + case WM_WM_CHANGE_STATE: + return "WM_WM_CHANGE_STATE"; + break; + case WM_WM_MAP: + return "WM_WM_MAP"; + break; + case WM_WM_MAP2: + return "WM_WM_MAP2"; + break; + case WM_WM_MAP3: + return "WM_WM_MAP3"; + break; + case WM_WM_HINTS_EVENT: + return "WM_WM_HINTS_EVENT"; + break; + default: + return "Unknown Message"; + break; + } +} + + /* * PushMessage - Push a message onto the queue */ @@ -259,44 +317,6 @@ PushMessage(WMMsgQueuePtr pQueue, WMMsgNodePtr pNode) pQueue->pHead = pNode; } -#if 0 - switch (pNode->msg.msg) { - case WM_WM_MOVE: - ErrorF("\tWM_WM_MOVE\n"); - break; - case WM_WM_SIZE: - ErrorF("\tWM_WM_SIZE\n"); - break; - case WM_WM_RAISE: - ErrorF("\tWM_WM_RAISE\n"); - break; - case WM_WM_LOWER: - ErrorF("\tWM_WM_LOWER\n"); - break; - case WM_WM_MAP: - ErrorF("\tWM_WM_MAP\n"); - break; - case WM_WM_MAP2: - ErrorF("\tWM_WM_MAP2\n"); - break; - case WM_WM_MAP3: - ErrorF("\tWM_WM_MAP3\n"); - break; - case WM_WM_UNMAP: - ErrorF("\tWM_WM_UNMAP\n"); - break; - case WM_WM_KILL: - ErrorF("\tWM_WM_KILL\n"); - break; - case WM_WM_ACTIVATE: - ErrorF("\tWM_WM_ACTIVATE\n"); - break; - default: - ErrorF("\tUnknown Message.\n"); - break; - } -#endif - /* Increase the count of elements in the queue by one */ ++(pQueue->nQueueSize); @@ -981,26 +1001,21 @@ winMultiWindowWMProc(void *pArg) } #if CYGMULTIWINDOW_DEBUG - ErrorF("winMultiWindowWMProc - %d ms MSG: %d ID: %d\n", - GetTickCount(), (int) pNode->msg.msg, (int) pNode->msg.dwID); + ErrorF("winMultiWindowWMProc - MSG: %s (%d) ID: %d\n", + MessageName(&(pNode->msg)), (int)pNode->msg.msg, (int)pNode->msg.dwID); #endif /* Branch on the message type */ switch (pNode->msg.msg) { #if 0 case WM_WM_MOVE: - ErrorF("\tWM_WM_MOVE\n"); break; case WM_WM_SIZE: - ErrorF("\tWM_WM_SIZE\n"); break; #endif case WM_WM_RAISE: -#if CYGMULTIWINDOW_DEBUG - ErrorF("\tWM_WM_RAISE\n"); -#endif /* Raise the window */ XRaiseWindow(pWMInfo->pDisplay, pNode->msg.iWindow); #if 0 @@ -1009,18 +1024,12 @@ winMultiWindowWMProc(void *pArg) break; case WM_WM_LOWER: -#if CYGMULTIWINDOW_DEBUG - ErrorF("\tWM_WM_LOWER\n"); -#endif /* Lower the window */ XLowerWindow(pWMInfo->pDisplay, pNode->msg.iWindow); break; case WM_WM_MAP: -#if CYGMULTIWINDOW_DEBUG - ErrorF("\tWM_WM_MAP\n"); -#endif /* Put a note as to the HWND associated with this Window */ XChangeProperty(pWMInfo->pDisplay, pNode->msg.iWindow, pWMInfo->atmPrivMap, XA_INTEGER, 32, @@ -1031,9 +1040,6 @@ winMultiWindowWMProc(void *pArg) break; case WM_WM_MAP2: -#if CYGMULTIWINDOW_DEBUG - ErrorF("\tWM_WM_MAP2\n"); -#endif XChangeProperty(pWMInfo->pDisplay, pNode->msg.iWindow, pWMInfo->atmPrivMap, XA_INTEGER, 32, PropModeReplace, @@ -1041,9 +1047,6 @@ winMultiWindowWMProc(void *pArg) break; case WM_WM_MAP3: -#if CYGMULTIWINDOW_DEBUG - ErrorF("\tWM_WM_MAP3\n"); -#endif /* Put a note as to the HWND associated with this Window */ XChangeProperty(pWMInfo->pDisplay, pNode->msg.iWindow, pWMInfo->atmPrivMap, XA_INTEGER, 32, @@ -1067,18 +1070,12 @@ winMultiWindowWMProc(void *pArg) break; case WM_WM_UNMAP: -#if CYGMULTIWINDOW_DEBUG - ErrorF("\tWM_WM_UNMAP\n"); -#endif /* Unmap the window */ XUnmapWindow(pWMInfo->pDisplay, pNode->msg.iWindow); break; case WM_WM_KILL: -#if CYGMULTIWINDOW_DEBUG - ErrorF("\tWM_WM_KILL\n"); -#endif { /* --- */ if (IsWmProtocolAvailable(pWMInfo->pDisplay, @@ -1093,9 +1090,6 @@ winMultiWindowWMProc(void *pArg) break; case WM_WM_ACTIVATE: -#if CYGMULTIWINDOW_DEBUG - ErrorF("\tWM_WM_ACTIVATE\n"); -#endif /* Set the input focus */ /* @@ -1747,7 +1741,7 @@ winSendMessageToWM(void *pWMInfo, winWMMessagePtr pMsg) WMMsgNodePtr pNode; #if CYGMULTIWINDOW_DEBUG - ErrorF("winSendMessageToWM ()\n"); + ErrorF("winSendMessageToWM %s\n", MessageName(pMsg)); #endif pNode = malloc(sizeof(WMMsgNodeRec)); -- cgit v1.2.3 From d53e4def57c72afd16a6f45c1617e4fdfbb05d60 Mon Sep 17 00:00:00 2001 From: Jon TURNEY Date: Thu, 2 Jul 2015 22:21:28 +0100 Subject: Rename WM_WM_MAP[23] Rename WM_WM_MAP2 as WM_WM_MAP_UNMANAGED Rename WM_WM_MAP3 as WM_WM_MAP_MANAGED --- hw/xwin/winmultiwindowwm.c | 12 ++++++------ hw/xwin/winmultiwindowwndproc.c | 4 ++-- hw/xwin/winwindow.h | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c index dc329591f..e6be7866f 100644 --- a/hw/xwin/winmultiwindowwm.c +++ b/hw/xwin/winmultiwindowwm.c @@ -279,11 +279,11 @@ MessageName(winWMMessagePtr msg) case WM_WM_MAP: return "WM_WM_MAP"; break; - case WM_WM_MAP2: - return "WM_WM_MAP2"; + case WM_WM_MAP_UNMANAGED: + return "WM_WM_MAP_UNMANAGED"; break; - case WM_WM_MAP3: - return "WM_WM_MAP3"; + case WM_WM_MAP_MANAGED: + return "WM_WM_MAP_MANAGED"; break; case WM_WM_HINTS_EVENT: return "WM_WM_HINTS_EVENT"; @@ -1039,14 +1039,14 @@ winMultiWindowWMProc(void *pArg) UpdateIcon(pWMInfo, pNode->msg.iWindow); break; - case WM_WM_MAP2: + case WM_WM_MAP_UNMANAGED: XChangeProperty(pWMInfo->pDisplay, pNode->msg.iWindow, pWMInfo->atmPrivMap, XA_INTEGER, 32, PropModeReplace, (unsigned char *) &(pNode->msg.hwndWindow), sizeof(HWND)/4); break; - case WM_WM_MAP3: + case WM_WM_MAP_MANAGED: /* Put a note as to the HWND associated with this Window */ XChangeProperty(pWMInfo->pDisplay, pNode->msg.iWindow, pWMInfo->atmPrivMap, XA_INTEGER, 32, diff --git a/hw/xwin/winmultiwindowwndproc.c b/hw/xwin/winmultiwindowwndproc.c index 65f1484ad..1304c28c3 100644 --- a/hw/xwin/winmultiwindowwndproc.c +++ b/hw/xwin/winmultiwindowwndproc.c @@ -945,7 +945,7 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) } } } - wmMsg.msg = WM_WM_MAP3; + wmMsg.msg = WM_WM_MAP_MANAGED; } else { /* It is an overridden window so make it top of Z stack */ @@ -965,7 +965,7 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); } } - wmMsg.msg = WM_WM_MAP2; + wmMsg.msg = WM_WM_MAP_UNMANAGED; } /* Tell our Window Manager thread to map the window */ diff --git a/hw/xwin/winwindow.h b/hw/xwin/winwindow.h index d21274f4f..f27094f4d 100644 --- a/hw/xwin/winwindow.h +++ b/hw/xwin/winwindow.h @@ -111,8 +111,8 @@ typedef struct _winWMMessageRec { #define WM_WM_NAME_EVENT (WM_USER + 9) #define WM_WM_ICON_EVENT (WM_USER + 10) #define WM_WM_CHANGE_STATE (WM_USER + 11) -#define WM_WM_MAP2 (WM_USER + 12) -#define WM_WM_MAP3 (WM_USER + 13) +#define WM_WM_MAP_UNMANAGED (WM_USER + 12) +#define WM_WM_MAP_MANAGED (WM_USER + 13) #define WM_WM_HINTS_EVENT (WM_USER + 14) #define WM_MANAGE (WM_USER + 100) #define WM_UNMANAGE (WM_USER + 102) -- cgit v1.2.3 From 6c57998908a162ad6eeb7c384cd36a60cf150be3 Mon Sep 17 00:00:00 2001 From: Jon TURNEY Date: Wed, 1 Jul 2015 22:27:20 +0100 Subject: Don't alter window style in WM_SHOWWINDOW We can do all of the needed window styling in winApplyStyle() The WS_POPUP | WS_OVERLAPPED | WS_CLIPCHILDREN | WS_CLIPBSIBLINGS styles are already set by winCreateWindowsWindow. Make winApplyStyle() set and clear WS_SYSMENU, WS_MAXIMIZEBOX and WS_MINIMIZEBOX as needed. The difference between the transient (WS_OVERLAPPED | WS_SYSMENU) and standard (WS_OVERLAPPEDWINDOW & ~WS_CAPTION & ~WS_SIZEBOX) styles is just (WS_MINIMIZEBOX | WS_MAXIMIZEBOX), both of which are adjusted by winApplyStyle() now. --- hw/xwin/winmultiwindowwm.c | 5 +++++ hw/xwin/winmultiwindowwndproc.c | 12 ------------ 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c index e6be7866f..cc5ee9ae8 100644 --- a/hw/xwin/winmultiwindowwm.c +++ b/hw/xwin/winmultiwindowwm.c @@ -2169,6 +2169,11 @@ winApplyHints(WMInfoPtr pWMInfo, Window iWindow, HWND hWnd, HWND * zstyle) style &= ~WS_CAPTION & ~WS_SIZEBOX; /* Just in case */ + if (GetParent(hWnd)) + style |= WS_SYSMENU; + else + style |= WS_SYSMENU | WS_MAXIMIZEBOX | WS_MINIMIZEBOX; + if (!(hint & ~HINT_SKIPTASKBAR)) /* No hints, default */ style = style | WS_CAPTION | WS_SIZEBOX; else if (hint & HINT_NOFRAME) /* No frame, no decorations */ diff --git a/hw/xwin/winmultiwindowwndproc.c b/hw/xwin/winmultiwindowwndproc.c index 1304c28c3..71a327fb4 100644 --- a/hw/xwin/winmultiwindowwndproc.c +++ b/hw/xwin/winmultiwindowwndproc.c @@ -917,18 +917,6 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) /* Flag that this window needs to be made active when clicked */ SetProp(hwnd, WIN_NEEDMANAGE_PROP, (HANDLE) 1); - /* Set the transient style flags */ - if (GetParent(hwnd)) - SetWindowLongPtr(hwnd, GWL_STYLE, - WS_POPUP | WS_OVERLAPPED | WS_SYSMENU | - WS_CLIPCHILDREN | WS_CLIPSIBLINGS); - /* Set the window standard style flags */ - else - SetWindowLongPtr(hwnd, GWL_STYLE, - (WS_POPUP | WS_OVERLAPPEDWINDOW | - WS_CLIPCHILDREN | WS_CLIPSIBLINGS) - & ~WS_CAPTION & ~WS_SIZEBOX); - winUpdateWindowPosition(hwnd, &zstyle); { -- cgit v1.2.3 From 3df990257b143ed3806aa6ebf606457425337ea2 Mon Sep 17 00:00:00 2001 From: Jon TURNEY Date: Wed, 1 Jul 2015 23:17:31 +0100 Subject: Map window in WM_WINDOWPOSCHANGED not WM_SHOWWINDOW Instead of using WM_SHOWWINDOW, use WM_WINDOWPOSCHANGED SWP_(SHOW|HIDE)WINDOW events to map and unmap the window. WM_WINDOWPOSCHANGED doesn't have the quirks that WM_SHOWWINDOW has, which can lead to it being emitted multiple times while the window is in the shown state, so it's a reliable way of reacting to the window being shown and hidden. See also http://blogs.msdn.com/b/oldnewthing/archive/2008/01/15/7113860.aspx --- hw/xwin/winmultiwindowwndproc.c | 128 ++++++++++++++++++++-------------------- 1 file changed, 64 insertions(+), 64 deletions(-) diff --git a/hw/xwin/winmultiwindowwndproc.c b/hw/xwin/winmultiwindowwndproc.c index 71a327fb4..cebdcf7e8 100644 --- a/hw/xwin/winmultiwindowwndproc.c +++ b/hw/xwin/winmultiwindowwndproc.c @@ -905,65 +905,6 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) /* else: Wait for WM_EXITSIZEMOVE */ return 0; - case WM_SHOWWINDOW: - /* Bail out if the window is being hidden */ - if (!wParam) - return 0; - - /* */ - if (!pWin->overrideRedirect) { - HWND zstyle = HWND_NOTOPMOST; - - /* Flag that this window needs to be made active when clicked */ - SetProp(hwnd, WIN_NEEDMANAGE_PROP, (HANDLE) 1); - - winUpdateWindowPosition(hwnd, &zstyle); - - { - WinXWMHints hints; - - if (winMultiWindowGetWMHints(pWin, &hints)) { - /* - Give the window focus, unless it has an InputHint - which is FALSE (this is used by e.g. glean to - avoid every test window grabbing the focus) - */ - if (!((hints.flags & InputHint) && (!hints.input))) { - SetForegroundWindow(hwnd); - } - } - } - wmMsg.msg = WM_WM_MAP_MANAGED; - } - else { /* It is an overridden window so make it top of Z stack */ - - HWND forHwnd = GetForegroundWindow(); - -#if CYGWINDOWING_DEBUG - ErrorF("overridden window is shown\n"); -#endif - if (forHwnd != NULL) { - if (GetWindowLongPtr(forHwnd, GWLP_USERDATA) & (LONG_PTR) - XMING_SIGNATURE) { - if (GetWindowLongPtr(forHwnd, GWL_EXSTYLE) & WS_EX_TOPMOST) - SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, - SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); - else - SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, - SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); - } - } - wmMsg.msg = WM_WM_MAP_UNMANAGED; - } - - /* Tell our Window Manager thread to map the window */ - if (fWMMsgInitialized) - winSendMessageToWM(s_pScreenPriv->pWMInfo, &wmMsg); - - winStartMousePolling(s_pScreenPriv); - - return 0; - case WM_SIZING: /* Need to legalize the size according to WM_NORMAL_HINTS */ /* for applications like xterm */ @@ -1016,12 +957,71 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) } } } + + /* Window is being shown */ + if (pWinPos->flags & SWP_SHOWWINDOW) { + if (!pWin->overrideRedirect) { + HWND zstyle = HWND_NOTOPMOST; + + /* Flag that this window needs to be made active when clicked */ + SetProp(hwnd, WIN_NEEDMANAGE_PROP, (HANDLE) 1); + + winUpdateWindowPosition(hwnd, &zstyle); + + { + WinXWMHints hints; + + if (winMultiWindowGetWMHints(pWin, &hints)) { + /* + Give the window focus, unless it has an InputHint + which is FALSE (this is used by e.g. glean to + avoid every test window grabbing the focus) + */ + if (!((hints.flags & InputHint) && (!hints.input))) { + SetForegroundWindow(hwnd); + } + } + } + wmMsg.msg = WM_WM_MAP_MANAGED; + } + else { /* It is an overridden window so make it top of Z stack */ + HWND forHwnd = GetForegroundWindow(); + + if (forHwnd != NULL) { + if (GetWindowLongPtr(forHwnd, GWLP_USERDATA) & (LONG_PTR) + XMING_SIGNATURE) { + if (GetWindowLongPtr(forHwnd, GWL_EXSTYLE) & WS_EX_TOPMOST) + SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, + SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); + else + SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, + SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); + } + } + wmMsg.msg = WM_WM_MAP_UNMANAGED; + } + + /* Tell our Window Manager thread to map the window */ + if (fWMMsgInitialized) + winSendMessageToWM(s_pScreenPriv->pWMInfo, &wmMsg); + + winStartMousePolling(s_pScreenPriv); + } + + /* Window is being hidden */ + if (pWinPos->flags & SWP_HIDEWINDOW) { + /* Tell our Window Manager thread to unmap the window */ + wmMsg.msg = WM_WM_UNMAP; + + if (fWMMsgInitialized) + winSendMessageToWM(s_pScreenPriv->pWMInfo, &wmMsg); + } } - /* - * Pass the message to DefWindowProc to let the function - * break down WM_WINDOWPOSCHANGED to WM_MOVE and WM_SIZE. - */ - break; + /* + * Pass the message to DefWindowProc to let the function + * break down WM_WINDOWPOSCHANGED to WM_MOVE and WM_SIZE. + */ + break; case WM_ENTERSIZEMOVE: hasEnteredSizeMove = TRUE; -- cgit v1.2.3 From 328b8d3595466a28caa9991ea9adfa98eaf5e031 Mon Sep 17 00:00:00 2001 From: Jon TURNEY Date: Sun, 28 Jun 2015 18:13:42 +0100 Subject: Only apply MINIMIZE/MAXIMIZE style from XWinrc when mapping the window It only makes sense for winApplyStyle() to apply MINIMIZE or MAXIMIZE window states when the windows is initially shown, otherwise there is no way for the window to leave that state. --- hw/xwin/winmultiwindowwm.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c index cc5ee9ae8..3b8237a25 100644 --- a/hw/xwin/winmultiwindowwm.c +++ b/hw/xwin/winmultiwindowwm.c @@ -221,7 +221,7 @@ static void winApplyUrgency(Display * pDisplay, Window iWindow, HWND hWnd); static void - winApplyHints(WMInfoPtr pWMInfo, Window iWindow, HWND hWnd, HWND * zstyle); + winApplyHints(WMInfoPtr pWMInfo, Window iWindow, HWND hWnd, HWND * zstyle, Bool onCreate); /* * Local globals @@ -743,7 +743,7 @@ UpdateIcon(WMInfoPtr pWMInfo, Window iWindow) */ static void -UpdateStyle(WMInfoPtr pWMInfo, Window iWindow) +UpdateStyle(WMInfoPtr pWMInfo, Window iWindow, Bool onCreate) { HWND hWnd; HWND zstyle = HWND_NOTOPMOST; @@ -754,7 +754,7 @@ UpdateStyle(WMInfoPtr pWMInfo, Window iWindow) return; /* Determine the Window style, which determines borders and clipping region... */ - winApplyHints(pWMInfo, iWindow, hWnd, &zstyle); + winApplyHints(pWMInfo, iWindow, hWnd, &zstyle, onCreate); winUpdateWindowPosition(hWnd, &zstyle); /* Apply the updated window style, without changing it's show or activation state */ @@ -1053,7 +1053,7 @@ winMultiWindowWMProc(void *pArg) PropModeReplace, (unsigned char *) &(pNode->msg.hwndWindow), sizeof(HWND)/4); UpdateName(pWMInfo, pNode->msg.iWindow); - UpdateStyle(pWMInfo, pNode->msg.iWindow); + UpdateStyle(pWMInfo, pNode->msg.iWindow, TRUE); UpdateIcon(pWMInfo, pNode->msg.iWindow); @@ -1142,7 +1142,7 @@ winMultiWindowWMProc(void *pArg) if (attr.override_redirect) break; - UpdateStyle(pWMInfo, pNode->msg.iWindow); + UpdateStyle(pWMInfo, pNode->msg.iWindow, FALSE); } break; @@ -1945,7 +1945,7 @@ winApplyUrgency(Display * pDisplay, Window iWindow, HWND hWnd) #define HINT_MIN (1L<<1) static void -winApplyHints(WMInfoPtr pWMInfo, Window iWindow, HWND hWnd, HWND * zstyle) +winApplyHints(WMInfoPtr pWMInfo, Window iWindow, HWND hWnd, HWND * zstyle, Bool onCreate) { static Atom motif_wm_hints, windowType; static Atom fullscreenState, belowState, aboveState, skiptaskbarState; @@ -2129,6 +2129,13 @@ winApplyHints(WMInfoPtr pWMInfo, Window iWindow, HWND hWnd, HWND * zstyle) free(application_id); if (window_name) XFree(window_name); + + /* + It only makes sense to apply minimize/maximize override when the + window is mapped, as otherwise the state can't be changed. + */ + if (!onCreate) + style &= ~(STYLE_MAXIMIZE | STYLE_MINIMIZE); } else { style = STYLE_NONE; -- cgit v1.2.3 From f566b877be4564dda393d3ed1ceeeb003c37bcc9 Mon Sep 17 00:00:00 2001 From: Jon TURNEY Date: Thu, 2 Jul 2015 19:21:11 +0100 Subject: In multiwindow mode, look up the HWND for the parent window Rather than only looking at the foreground window to see if it matches the WM_TRANSIENT_FOR window XID, lookup that XID and fetch the HWND from the window privates. --- hw/xwin/winmultiwindowwindow.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/hw/xwin/winmultiwindowwindow.c b/hw/xwin/winmultiwindowwindow.c index 477853dce..ee8aadd2b 100644 --- a/hw/xwin/winmultiwindowwindow.c +++ b/hw/xwin/winmultiwindowwindow.c @@ -588,9 +588,13 @@ winCreateWindowsTopLevelWindow(WindowPtr pWin) if (winMultiWindowGetTransientFor(pWin, &daddyId)) { if (daddyId) { - hFore = GetForegroundWindow(); - if (hFore && (daddyId != (Window) (INT_PTR) GetProp(hFore, WIN_WID_PROP))) - hFore = NULL; + WindowPtr pParent; + int res = dixLookupWindow(&pParent, daddyId, serverClient, DixReadAccess); + if (res == Success) + { + winPrivWinPtr pParentPriv = winGetWindowPriv(pParent); + hFore = pParentPriv->hWnd; + } } } else { -- cgit v1.2.3 From 0c617ee2794a8caa83b9548690f813f80d0e9222 Mon Sep 17 00:00:00 2001 From: Jon TURNEY Date: Sun, 5 Jul 2015 23:12:05 +0100 Subject: Downgrade crashreporter not loaded message to debug --- os/backtrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/os/backtrace.c b/os/backtrace.c index 9f32b5687..3bff2dff1 100644 --- a/os/backtrace.c +++ b/os/backtrace.c @@ -415,7 +415,7 @@ xorg_crashreport_init(const char *logfile) } else { - ErrorF("Could not load crashreporter dll\n"); + DebugF("Could not load crashreporter dll\n"); } } -- cgit v1.2.3 From 477f462fd43beb372e0931454ad7427b79677091 Mon Sep 17 00:00:00 2001 From: Jon TURNEY Date: Sun, 5 Jul 2015 23:12:27 +0100 Subject: Should use ErrorFSigSafe in OsSigHandler --- os/osinit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/os/osinit.c b/os/osinit.c index 8eb6ab409..8e5b0f16b 100644 --- a/os/osinit.c +++ b/os/osinit.c @@ -128,7 +128,7 @@ OsSigHandler(int signo) } } - ErrorF("Fatal signal received in thread 0x%x [0x%x]\n", pthread_self(), GetCurrentThreadId()); + ErrorFSigSafe("Fatal signal received in thread 0x%x [0x%x]\n", pthread_self(), GetCurrentThreadId()); #ifdef SA_SIGINFO if (sip->si_code == SI_USER) { -- cgit v1.2.3 From ff92e6a3d5aa5cb312bfb3a12f2ff093a588e50c Mon Sep 17 00:00:00 2001 From: Jon TURNEY Date: Sun, 5 Jul 2015 23:14:07 +0100 Subject: Use longjmp to continue after a SEGV in glxWinScreenProbe() Use longjmp to continue after a SEGV in glxWinScreenProbe(), rather than terminating --- hw/xwin/glx/indirect.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/hw/xwin/glx/indirect.c b/hw/xwin/glx/indirect.c index d2928106c..95fc7c875 100644 --- a/hw/xwin/glx/indirect.c +++ b/hw/xwin/glx/indirect.c @@ -87,6 +87,7 @@ #include #include #include +#include #define NUM_ELEMENTS(x) (sizeof(x)/ sizeof(x[1])) @@ -479,6 +480,7 @@ glxLogExtensions(const char *prefix, const char *extensions) free(str); } +static jmp_buf jmp_sig; static struct sigaction old_act; extern Bool install_os_signal_handler; @@ -490,7 +492,7 @@ glxWinScreenProbeSigHandler(int signo, siginfo_t * sip, void *context) // show a messagebox MessageBox(NULL, - "A crash occurred while initializing Windows OpenGL.\n" + "Windows OpenGL has been disabled as a crash occurred during initialization.\n" "\n" "Please try updating the display driver.\n" "\n" @@ -498,8 +500,8 @@ glxWinScreenProbeSigHandler(int signo, siginfo_t * sip, void *context) XVENDORNAMESHORT, MB_OK | MB_ICONERROR | MB_TASKMODAL | MB_SETFOREGROUND); - // and pass on to previous sighandler - (*old_act.sa_sigaction)(signo, sip, context); + // continue via longjmp() + longjmp(jmp_sig, 1); } /* This is called by GlxExtensionInit() asking the GLX provider if it can handle the screen... */ @@ -566,7 +568,7 @@ glxWinScreenProbe(ScreenPtr pScreen) // The following tests seem particularly prone to crashing somewhere in the // display driver's OpenGL implementation. So temporarily install a special - // SIGSEGV handler so we can offer some remedial advice... + // SIGSEGV handler so can catch that and offer some remedial advice... if (install_os_signal_handler) { struct sigaction act; @@ -574,6 +576,11 @@ glxWinScreenProbe(ScreenPtr pScreen) act.sa_sigaction = glxWinScreenProbeSigHandler; act.sa_flags = SA_SIGINFO; sigaction(SIGSEGV, &act, &old_act); + + if (setjmp(jmp_sig)) { + LogMessage(X_ERROR, "AIGLX: Not using WGL due to SEGV\n"); + goto error; + } } // create an invisible window for a scratch DC -- cgit v1.2.3 From bd54cd29d1921d808c130a75f3aa8078cd375d35 Mon Sep 17 00:00:00 2001 From: Jon TURNEY Date: Wed, 8 Jul 2015 19:12:22 +0100 Subject: Detect invalid options in combination with -nodecoration Detect invalid options in combination with -nodecoration These are particularly problematic as -nodecoration implies a default of -nomultimonitors, for some reason, which will gives rendering issues with -multiwindow. --- hw/xwin/winvalargs.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/hw/xwin/winvalargs.c b/hw/xwin/winvalargs.c index d0e0b7519..f93872419 100644 --- a/hw/xwin/winvalargs.c +++ b/hw/xwin/winvalargs.c @@ -127,7 +127,7 @@ winValidateArgs(void) return FALSE; } - /* Check for -multiwindow, -mwextwm, or -rootless and fullscreen */ + /* Check for -multiwindow, -mwextwm, or -rootless and -fullscreen */ if (g_ScreenInfo[i].fFullScreen && (FALSE #ifdef XWIN_MULTIWINDOW || g_ScreenInfo[i].fMultiWindow @@ -142,6 +142,21 @@ winValidateArgs(void) return FALSE; } + /* Check for -multiwindow, -mwextwm, or -rootless and -nodecoration */ + if (!g_ScreenInfo[i].fDecoration && (FALSE +#ifdef XWIN_MULTIWINDOW + || g_ScreenInfo[i].fMultiWindow +#endif +#ifdef XWIN_MULTIWINDOWEXTWM + || g_ScreenInfo[i].fMWExtWM +#endif + || g_ScreenInfo[i].fRootless) + ) { + ErrorF("winValidateArgs - -nodecoration is invalid with " + "-multiwindow, -mwextwm, or -rootless.\n"); + return FALSE; + } + /* Check for !fullscreen and any fullscreen-only parameters */ if (!g_ScreenInfo[i].fFullScreen && (g_ScreenInfo[i].dwRefreshRate != WIN_DEFAULT_REFRESH -- cgit v1.2.3 From c3fdf57a762ac966787aa083bf7fa9e5691068e2 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Tue, 7 Jul 2015 15:33:19 -0500 Subject: hw/xwin: support SKIPTASKBAR style in XWinrc Signed-off-by: Yaakov Selkowitz --- hw/xwin/man/XWinrc.man | 12 +++++++++--- hw/xwin/winmultiwindowwm.c | 3 +++ hw/xwin/winprefs.h | 1 + hw/xwin/winprefslex.l | 1 + hw/xwin/winprefsyacc.y | 16 ++++++++++++++++ 5 files changed, 30 insertions(+), 3 deletions(-) diff --git a/hw/xwin/man/XWinrc.man b/hw/xwin/man/XWinrc.man index 0f641e92f..60b8ce1ec 100644 --- a/hw/xwin/man/XWinrc.man +++ b/hw/xwin/man/XWinrc.man @@ -200,7 +200,7 @@ will be used. .SH Style Instructions .TP 8 .B STYLES { -\fIclass-or-name-of-window\fP \fIstyle-keyword-1\fP \fIstyle-keyword-2\fP +\fIclass-or-name-of-window\fP \fIstyle-keyword-1\fP \fIstyle-keyword-2\fP \fIstyle-keyword-3\fP .br \fI...\fP .br @@ -245,8 +245,14 @@ No Windows title bar and just a thin-line border, for the class or name. .br No Windows title bar or border, for the class or name. -One keyword in \fIstyle-keyword-1\fP can be used with one keyword in \fIstyle-keyword-2\fP, -or any keyword can be used singly. +\fIstyle-keyword-3\fP + +\fBSKIPTASKBAR\fP +.br +Omit the class or name from being listed in the Windows taskbar. + +Up to one keyword from each of these three groups can be used. Not all +groups need be used, and the keywords can be given in any order. .SH EXAMPLE diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c index 3b8237a25..66b6d979f 100644 --- a/hw/xwin/winmultiwindowwm.c +++ b/hw/xwin/winmultiwindowwm.c @@ -2169,6 +2169,9 @@ winApplyHints(WMInfoPtr pWMInfo, Window iWindow, HWND hWnd, HWND * zstyle, Bool (hint & ~HINT_BORDER & ~HINT_CAPTION & ~HINT_SIZEBOX) | HINT_NOFRAME; + if (style & STYLE_SKIPTASKBAR) + hint |= HINT_SKIPTASKBAR; + /* Now apply styles to window */ style = GetWindowLongPtr(hWnd, GWL_STYLE); if (!style) diff --git a/hw/xwin/winprefs.h b/hw/xwin/winprefs.h index 702e5897d..c41710419 100644 --- a/hw/xwin/winprefs.h +++ b/hw/xwin/winprefs.h @@ -62,6 +62,7 @@ typedef enum MENUCOMMANDTYPE { #define STYLE_MAXIMIZE (1L<<4) /* Open a window maximized */ #define STYLE_MINIMIZE (1L<<5) /* Open a window minimized */ #define STYLE_BOTTOM (1L<<6) /* Open a window at the bottom of the Z order */ +#define STYLE_SKIPTASKBAR (1L<<7) /* Omit from taskbar */ /* Where to place a system menu */ typedef enum MENUPOSITION { diff --git a/hw/xwin/winprefslex.l b/hw/xwin/winprefslex.l index 472c85658..e7547729c 100644 --- a/hw/xwin/winprefslex.l +++ b/hw/xwin/winprefslex.l @@ -77,6 +77,7 @@ BOTTOM { return BOTTOM; } NOTITLE { return NOTITLE; } OUTLINE { return OUTLINE; } NOFRAME { return NOFRAME; } +SKIPTASKBAR { return SKIPTASKBAR; } ROOTMENU { return ROOTMENU; } DEFAULTSYSMENU { return DEFAULTSYSMENU; } SYSMENU { return SYSMENU; } diff --git a/hw/xwin/winprefsyacc.y b/hw/xwin/winprefsyacc.y index 361e05de0..e4e305a0f 100644 --- a/hw/xwin/winprefsyacc.y +++ b/hw/xwin/winprefsyacc.y @@ -117,6 +117,7 @@ extern int yylex(void); %token NOTITLE %token OUTLINE %token NOFRAME +%token SKIPTASKBAR %token DEFAULTSYSMENU %token SYSMENU %token ROOTMENU @@ -140,6 +141,7 @@ extern int yylex(void); %token STRING %type group1 %type group2 +%type group3 %type stylecombo %type atspot @@ -246,10 +248,24 @@ group2: NOTITLE { $$=STYLE_NOTITLE; } | NOFRAME { $$=STYLE_NOFRAME; } ; +group3: SKIPTASKBAR { $$=STYLE_SKIPTASKBAR; } + ; + stylecombo: group1 { $$=$1; } | group2 { $$=$1; } + | group3 { $$=$1; } | group1 group2 { $$=$1|$2; } + | group1 group3 { $$=$1|$2; } | group2 group1 { $$=$1|$2; } + | group2 group3 { $$=$1|$2; } + | group3 group1 { $$=$1|$2; } + | group3 group2 { $$=$1|$2; } + | group1 group2 group3 { $$=$1|$2|$3; } + | group1 group3 group2 { $$=$1|$2|$3; } + | group2 group1 group3 { $$=$1|$2|$3; } + | group2 group3 group1 { $$=$1|$2|$3; } + | group3 group1 group2 { $$=$1|$2|$3; } + | group3 group2 group1 { $$=$1|$2|$3; } ; styleline: STRING stylecombo NEWLINE newline_or_nada { AddStyleLine($1, $2); free($1); } -- cgit v1.2.3