Allow WM_SYSKEYDOWN to still be processed by MSWDefWindowProc, even if
it was handled by an event handler. This allows the magic Windows keys (such as Alt-space for the system menu, Alt or F10 to activate the menu bar, Alt-F4 to send WM_CLOSE, etc.) to still work properly. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17601 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1471,7 +1471,7 @@ void wxWindowMSW::Update()
|
|||||||
wxLogLastError(_T("UpdateWindow"));
|
wxLogLastError(_T("UpdateWindow"));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__WIN32__) && !defined(__WXMICROWIN__)
|
#if defined(__WIN32__) && !defined(__WXMICROWIN__)
|
||||||
// just calling UpdateWindow() is not enough, what we did in our WM_PAINT
|
// just calling UpdateWindow() is not enough, what we did in our WM_PAINT
|
||||||
// handler needs to be really drawn right now
|
// handler needs to be really drawn right now
|
||||||
@@ -2612,71 +2612,73 @@ long wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam
|
|||||||
if ( m_lastKeydownProcessed )
|
if ( m_lastKeydownProcessed )
|
||||||
{
|
{
|
||||||
processed = TRUE;
|
processed = TRUE;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ( wParam )
|
if ( !processed )
|
||||||
{
|
{
|
||||||
// we consider these message "not interesting" to OnChar, so
|
switch ( wParam )
|
||||||
// just don't do anything more with them
|
{
|
||||||
case VK_SHIFT:
|
// we consider these message "not interesting" to OnChar, so
|
||||||
case VK_CONTROL:
|
// just don't do anything more with them
|
||||||
case VK_MENU:
|
case VK_SHIFT:
|
||||||
case VK_CAPITAL:
|
case VK_CONTROL:
|
||||||
case VK_NUMLOCK:
|
case VK_MENU:
|
||||||
case VK_SCROLL:
|
case VK_CAPITAL:
|
||||||
processed = TRUE;
|
case VK_NUMLOCK:
|
||||||
break;
|
case VK_SCROLL:
|
||||||
|
processed = TRUE;
|
||||||
|
break;
|
||||||
|
|
||||||
// avoid duplicate messages to OnChar for these ASCII keys:
|
// avoid duplicate messages to OnChar for these ASCII keys:
|
||||||
// they will be translated by TranslateMessage() and received
|
// they will be translated by TranslateMessage() and received
|
||||||
// in WM_CHAR
|
// in WM_CHAR
|
||||||
case VK_ESCAPE:
|
case VK_ESCAPE:
|
||||||
case VK_SPACE:
|
case VK_SPACE:
|
||||||
case VK_RETURN:
|
case VK_RETURN:
|
||||||
case VK_BACK:
|
case VK_BACK:
|
||||||
case VK_TAB:
|
case VK_TAB:
|
||||||
case VK_ADD:
|
case VK_ADD:
|
||||||
case VK_SUBTRACT:
|
case VK_SUBTRACT:
|
||||||
case VK_MULTIPLY:
|
case VK_MULTIPLY:
|
||||||
case VK_DIVIDE:
|
case VK_DIVIDE:
|
||||||
case VK_OEM_1:
|
case VK_OEM_1:
|
||||||
case VK_OEM_2:
|
case VK_OEM_2:
|
||||||
case VK_OEM_3:
|
case VK_OEM_3:
|
||||||
case VK_OEM_4:
|
case VK_OEM_4:
|
||||||
case VK_OEM_5:
|
case VK_OEM_5:
|
||||||
case VK_OEM_6:
|
case VK_OEM_6:
|
||||||
case VK_OEM_7:
|
case VK_OEM_7:
|
||||||
case VK_OEM_PLUS:
|
case VK_OEM_PLUS:
|
||||||
case VK_OEM_COMMA:
|
case VK_OEM_COMMA:
|
||||||
case VK_OEM_MINUS:
|
case VK_OEM_MINUS:
|
||||||
case VK_OEM_PERIOD:
|
case VK_OEM_PERIOD:
|
||||||
// but set processed to FALSE, not TRUE to still pass them
|
// but set processed to FALSE, not TRUE to still pass them
|
||||||
// to the control's default window proc - otherwise
|
// to the control's default window proc - otherwise
|
||||||
// built-in keyboard handling won't work
|
// built-in keyboard handling won't work
|
||||||
processed = FALSE;
|
processed = FALSE;
|
||||||
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
#ifdef VK_APPS
|
#ifdef VK_APPS
|
||||||
// special case of VK_APPS: treat it the same as right mouse
|
// special case of VK_APPS: treat it the same as right mouse
|
||||||
// click because both usually pop up a context menu
|
// click because both usually pop up a context menu
|
||||||
case VK_APPS:
|
case VK_APPS:
|
||||||
{
|
{
|
||||||
WPARAM flags;
|
WPARAM flags;
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
TranslateKbdEventToMouse(this, &x, &y, &flags);
|
TranslateKbdEventToMouse(this, &x, &y, &flags);
|
||||||
processed = HandleMouseEvent(WM_RBUTTONDOWN, x, y, flags);
|
processed = HandleMouseEvent(WM_RBUTTONDOWN, x, y, flags);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif // VK_APPS
|
#endif // VK_APPS
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// do generate a CHAR event
|
// do generate a CHAR event
|
||||||
processed = HandleChar((WORD)wParam, lParam);
|
processed = HandleChar((WORD)wParam, lParam);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (message == WM_SYSKEYDOWN) // Let Windows still handle the SYSKEYs
|
||||||
|
processed = FALSE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_SYSKEYUP:
|
case WM_SYSKEYUP:
|
||||||
|
Reference in New Issue
Block a user