diff --git a/hw/xwin/winmultiwindowwndproc.c b/hw/xwin/winmultiwindowwndproc.c index b74f258f3..82d7f930c 100755 --- a/hw/xwin/winmultiwindowwndproc.c +++ b/hw/xwin/winmultiwindowwndproc.c @@ -387,23 +387,30 @@ winTopLevelWindowProc (HWND hwnd, UINT message, /* * Any window menu items go through here */ - /* If minimizing then remove always-on-top, and store the setting */ - if (wParam == SC_MINIMIZE) + switch (wParam & 0xFFF0) /* See MSDN for the magic number 0xFFF0 */ { + case SC_MINIMIZE: + /* If minimizing then remove always-on-top, and store the setting */ if (GetWindowLong (hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST) pWinPriv->fAlwaysOnTop = TRUE; else pWinPriv->fAlwaysOnTop = FALSE; SetWindowPos(hwnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE); - } - else if (wParam == SC_RESTORE) - { + break; + + case SC_RESTORE: if (pWinPriv->fAlwaysOnTop) SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE); + break; + + default: + if (HandleCustomWM_COMMAND ((unsigned long)hwnd, LOWORD(wParam))) + /* Don't pass customized menus to DefWindowProc */ + return 0; + break; } - HandleCustomWM_COMMAND ((unsigned long)hwnd, LOWORD(wParam)); break; case WM_INITMENU: diff --git a/hw/xwin/winprefs.c b/hw/xwin/winprefs.c index 67443ed54..6fb7f0c6c 100644 --- a/hw/xwin/winprefs.c +++ b/hw/xwin/winprefs.c @@ -284,9 +284,10 @@ HandleCustomWM_INITMENU(unsigned long hwndIn, } /* - * Searches for the custom WM_COMMAND command ID and performs action + * Searches for the custom WM_COMMAND command ID and performs action. + * Return TRUE if command is proccessed, FALSE otherwise. */ -int +Bool HandleCustomWM_COMMAND (unsigned long hwndIn, int command) { @@ -298,7 +299,7 @@ HandleCustomWM_COMMAND (unsigned long hwndIn, hwnd = (HWND)hwndIn; if (!command) - return 0; + return FALSE; for (i=0; i