mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-02-19 19:20:56 +01:00
Stop passing customized menus to DefWindowProc. Although it does not cause
visible problems so far, it should be inhibited. Apply a mask, which is
described in MSDN, for wParam in winTopLevelWindowProc/WM_SYSCOMMAND
handler.
This commit is contained in:
parent
c4045f54e2
commit
19d82be496
4 changed files with 26 additions and 17 deletions
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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<pref.menuItems; i++)
|
||||
{
|
||||
|
|
@ -332,12 +333,12 @@ HandleCustomWM_COMMAND (unsigned long hwndIn,
|
|||
exit (0);
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
return TRUE;
|
||||
break;
|
||||
|
||||
case CMD_ALWAYSONTOP:
|
||||
if (!hwnd)
|
||||
return 0;
|
||||
return FALSE;
|
||||
|
||||
/* Get extended window style */
|
||||
dwExStyle = GetWindowLong (hwnd, GWL_EXSTYLE);
|
||||
|
|
@ -355,20 +356,20 @@ HandleCustomWM_COMMAND (unsigned long hwndIn,
|
|||
0, 0,
|
||||
0, 0,
|
||||
SWP_NOSIZE | SWP_NOMOVE);
|
||||
return 0;
|
||||
return TRUE;
|
||||
|
||||
case CMD_RELOAD:
|
||||
ReloadPrefs();
|
||||
return 0;
|
||||
return TRUE;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
} /* match */
|
||||
} /* for j */
|
||||
} /* for i */
|
||||
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ void
|
|||
HandleCustomWM_INITMENU(unsigned long hwndIn,
|
||||
unsigned long hmenuIn);
|
||||
|
||||
int
|
||||
Bool
|
||||
HandleCustomWM_COMMAND (unsigned long hwndIn,
|
||||
int command);
|
||||
|
||||
|
|
|
|||
|
|
@ -1069,7 +1069,8 @@ winWindowProc (HWND hwnd, UINT message,
|
|||
|
||||
default:
|
||||
/* It's probably one of the custom menus... */
|
||||
return HandleCustomWM_COMMAND (0, LOWORD (wParam));
|
||||
if (HandleCustomWM_COMMAND (0, LOWORD (wParam)))
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue