fix for id of CHAR_HOOK events

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6008 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2000-02-14 15:06:40 +00:00
parent f1a31d8891
commit 32de7d24a5

View File

@@ -3728,8 +3728,8 @@ wxKeyboardHook(int nCode, WORD wParam, DWORD lParam)
DWORD hiWord = HIWORD(lParam); DWORD hiWord = HIWORD(lParam);
if ( nCode != HC_NOREMOVE && ((hiWord & KF_UP) == 0) ) if ( nCode != HC_NOREMOVE && ((hiWord & KF_UP) == 0) )
{ {
int id; int id = wxCharCodeMSWToWX(wParam);
if ( (id = wxCharCodeMSWToWX(wParam)) != 0 ) if ( id != 0 )
{ {
wxKeyEvent event(wxEVT_CHAR_HOOK); wxKeyEvent event(wxEVT_CHAR_HOOK);
if ( (HIWORD(lParam) & KF_ALTDOWN) == KF_ALTDOWN ) if ( (HIWORD(lParam) & KF_ALTDOWN) == KF_ALTDOWN )
@@ -3737,25 +3737,31 @@ wxKeyboardHook(int nCode, WORD wParam, DWORD lParam)
event.m_eventObject = NULL; event.m_eventObject = NULL;
event.m_keyCode = id; event.m_keyCode = id;
/* begin Albert's fix for control and shift key 26.5 */ event.m_shiftDown = ::GetKeyState(VK_SHIFT) & 0x100 != 0;
event.m_shiftDown = (::GetKeyState(VK_SHIFT)&0x100?TRUE:FALSE); event.m_controlDown = ::GetKeyState(VK_CONTROL) & 0x100 != 0;
event.m_controlDown = (::GetKeyState(VK_CONTROL)&0x100?TRUE:FALSE);
/* end Albert's fix for control and shift key 26.5 */
event.SetTimestamp(s_currentMsg.time); event.SetTimestamp(s_currentMsg.time);
wxWindow *win = wxGetActiveWindow(); wxWindow *win = wxGetActiveWindow();
wxEvtHandler *handler;
if ( win ) if ( win )
{ {
if ( win->GetEventHandler()->ProcessEvent(event) ) handler = win->GetEventHandler();
return 1; event.SetId(win->GetId());
} }
else else
{ {
if ( wxTheApp && wxTheApp->ProcessEvent(event) ) handler = wxTheApp;
return 1; event.SetId(-1);
}
if ( handler && handler->ProcessEvent(event) )
{
// processed
return 1;
} }
} }
} }
return (int)CallNextHookEx(wxTheKeyboardHook, nCode, wParam, lParam); return (int)CallNextHookEx(wxTheKeyboardHook, nCode, wParam, lParam);
} }