]> git.saurik.com Git - wxWidgets.git/commitdiff
fix for id of CHAR_HOOK events
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 14 Feb 2000 15:06:40 +0000 (15:06 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 14 Feb 2000 15:06:40 +0000 (15:06 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6008 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/window.cpp

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