summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Turney <jon.turney@dronecode.org.uk>2016-04-20 12:19:51 +0100
committerJon Turney <jon.turney@dronecode.org.uk>2016-06-13 12:21:31 +0000
commit08d03eb689c1e0444fc4d7bb78c9e9842c52b299 (patch)
tree487d5ac2876ef5746d0080fc46bdb6f262a53712
parented6a0e6fcd685c0e74d61ba5c7ab5b93f17e8836 (diff)
Fix custom sysmenu not used initially
It seems we need to defer setting the custom sysmenu until after WS_SYSMENU style is applied?
-rw-r--r--hw/xwin/winmultiwindowwindow.c6
-rw-r--r--hw/xwin/winmultiwindowwm.c7
-rw-r--r--hw/xwin/winprefs.c4
3 files changed, 10 insertions, 7 deletions
diff --git a/hw/xwin/winmultiwindowwindow.c b/hw/xwin/winmultiwindowwindow.c
index 7ef792917..7ff598743 100644
--- a/hw/xwin/winmultiwindowwindow.c
+++ b/hw/xwin/winmultiwindowwindow.c
@@ -690,12 +690,6 @@ winCreateWindowsTopLevelWindow(WindowPtr pWin)
/* Adjust the X window to match the window placement we actually got... */
winAdjustXWindow(pWin, hWnd);
- /* Make sure it gets the proper system menu for a WS_POPUP, too */
- GetSystemMenu(hWnd, TRUE);
-
- /* Cause any .XWinrc menus to be added in main WNDPROC */
- PostMessage(hWnd, WM_INIT_SYS_MENU, 0, 0);
-
SetProp(hWnd, WIN_WID_PROP, (HANDLE) (INT_PTR) winGetWindowID(pWin));
/* Flag that this Windows window handles its own activation */
diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c
index ea7fc649e..be2caf8d9 100644
--- a/hw/xwin/winmultiwindowwm.c
+++ b/hw/xwin/winmultiwindowwm.c
@@ -991,6 +991,13 @@ winMultiWindowWMProc(void *pArg)
/* Determine the Window style, which determines borders and clipping region... */
UpdateStyle(pWMInfo, pNode->msg.iWindow, &maxmin);
+ /* Make sure it gets the proper system menu for a WS_POPUP, too */
+ GetSystemMenu(pNode->msg.hwndWindow, TRUE);
+
+#define WM_INIT_SYS_MENU (WM_USER + 1001)
+ /* Cause any .XWinrc menus to be added in main WNDPROC */
+ PostMessage(pNode->msg.hwndWindow, WM_INIT_SYS_MENU, 0, 0);
+
/* Display the window without activating it */
{
xcb_get_window_attributes_cookie_t cookie;
diff --git a/hw/xwin/winprefs.c b/hw/xwin/winprefs.c
index c97c88dca..ed1154b90 100644
--- a/hw/xwin/winprefs.c
+++ b/hw/xwin/winprefs.c
@@ -526,8 +526,10 @@ SetupSysMenu(HWND hwnd)
pWin = GetProp(hwnd, WIN_WINDOW_PROP);
sys = GetSystemMenu(hwnd, FALSE);
- if (!sys)
+ if (!sys) {
+ ErrorF("SetupSysMenu: GetSystemMenu() failed for HWND %p\n", hwnd);
return;
+ }
if (pWin) {
/* First see if there's a class match... */