]> git.saurik.com Git - wxWidgets.git/commitdiff
changed char event handling for ctrl-chars and skipped events
authorStefan Csomor <csomor@advancedconcepts.ch>
Fri, 17 May 2002 12:16:38 +0000 (12:16 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Fri, 17 May 2002 12:16:38 +0000 (12:16 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15588 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mac/app.cpp
src/mac/carbon/app.cpp

index be6dba89abb39c24c1e4bbd3ed07427e89dec647..7e83eb254a1b770d7a7330751d519f35ef097eef 100644 (file)
@@ -1595,6 +1595,11 @@ void wxApp::MacHandleKeyDownEvent( WXEVENTREF evr )
         short keychar ;
         keychar = short(ev->message & charCodeMask);
         keycode = short(ev->message & keyCodeMask) >> 8 ;
+        // it is wxWindows Convention to have Ctrl Key Combinations at ASCII char value
+        if ( ev->modifiers & controlKey && keychar >= 0 && keychar < 0x20 )
+        {
+            keychar += 0x40 ;
+        }
         long keyval = wxMacTranslateKey(keychar, keycode) ;
         bool handled = false ;
         wxWindow* focus = wxWindow::FindFocus() ;
@@ -1612,12 +1617,13 @@ void wxApp::MacHandleKeyDownEvent( WXEVENTREF evr )
             event.m_timeStamp = ev->when;
             event.SetEventObject(focus);
             handled = focus->GetEventHandler()->ProcessEvent( event ) ;
+            if ( handled && event.GetSkipped() )
+                handled = false ;
             if ( !handled )
             {
 #if wxUSE_ACCEL
                 if (!handled)
                 {
-                    /*
                     wxWindow *ancestor = focus;
                     while (ancestor)
                     {
@@ -1628,11 +1634,10 @@ void wxApp::MacHandleKeyDownEvent( WXEVENTREF evr )
                             handled = ancestor->GetEventHandler()->ProcessEvent( command_event );
                             break;
                         }
-                        if (ancestor->m_isFrame)
+                        if (ancestor->IsTopLevel())
                             break;
                         ancestor = ancestor->GetParent();
                     }
-                    */
                 }
 #endif // wxUSE_ACCEL
             }
@@ -1649,10 +1654,18 @@ void wxApp::MacHandleKeyDownEvent( WXEVENTREF evr )
                 event.m_timeStamp = ev->when;
                 event.SetEventObject(focus);
                 handled = focus->GetEventHandler()->ProcessEvent( event ) ;
+                if ( handled && event.GetSkipped() )
+                    handled = false ;
             }
             if ( !handled &&
                  (keyval == WXK_TAB) &&
+// CS: copied the change below from wxGTK
+// VZ: testing for wxTE_PROCESS_TAB shouldn't be done here the control may
+//     have this style, yet choose not to process this particular TAB in which
+//     case TAB must still work as a navigational character
+#if 0
                  (!focus->HasFlag(wxTE_PROCESS_TAB)) &&
+#endif
                  (focus->GetParent()) &&
                  (focus->GetParent()->HasFlag( wxTAB_TRAVERSAL)) )
             {
@@ -1663,6 +1676,8 @@ void wxApp::MacHandleKeyDownEvent( WXEVENTREF evr )
                 new_event.SetWindowChange( event.ControlDown() );
                 new_event.SetCurrentFocus( focus );
                 handled = focus->GetEventHandler()->ProcessEvent( new_event );
+                if ( handled && new_event.GetSkipped() )
+                    handled = false ;
             }
         }
         if ( !handled )
index be6dba89abb39c24c1e4bbd3ed07427e89dec647..7e83eb254a1b770d7a7330751d519f35ef097eef 100644 (file)
@@ -1595,6 +1595,11 @@ void wxApp::MacHandleKeyDownEvent( WXEVENTREF evr )
         short keychar ;
         keychar = short(ev->message & charCodeMask);
         keycode = short(ev->message & keyCodeMask) >> 8 ;
+        // it is wxWindows Convention to have Ctrl Key Combinations at ASCII char value
+        if ( ev->modifiers & controlKey && keychar >= 0 && keychar < 0x20 )
+        {
+            keychar += 0x40 ;
+        }
         long keyval = wxMacTranslateKey(keychar, keycode) ;
         bool handled = false ;
         wxWindow* focus = wxWindow::FindFocus() ;
@@ -1612,12 +1617,13 @@ void wxApp::MacHandleKeyDownEvent( WXEVENTREF evr )
             event.m_timeStamp = ev->when;
             event.SetEventObject(focus);
             handled = focus->GetEventHandler()->ProcessEvent( event ) ;
+            if ( handled && event.GetSkipped() )
+                handled = false ;
             if ( !handled )
             {
 #if wxUSE_ACCEL
                 if (!handled)
                 {
-                    /*
                     wxWindow *ancestor = focus;
                     while (ancestor)
                     {
@@ -1628,11 +1634,10 @@ void wxApp::MacHandleKeyDownEvent( WXEVENTREF evr )
                             handled = ancestor->GetEventHandler()->ProcessEvent( command_event );
                             break;
                         }
-                        if (ancestor->m_isFrame)
+                        if (ancestor->IsTopLevel())
                             break;
                         ancestor = ancestor->GetParent();
                     }
-                    */
                 }
 #endif // wxUSE_ACCEL
             }
@@ -1649,10 +1654,18 @@ void wxApp::MacHandleKeyDownEvent( WXEVENTREF evr )
                 event.m_timeStamp = ev->when;
                 event.SetEventObject(focus);
                 handled = focus->GetEventHandler()->ProcessEvent( event ) ;
+                if ( handled && event.GetSkipped() )
+                    handled = false ;
             }
             if ( !handled &&
                  (keyval == WXK_TAB) &&
+// CS: copied the change below from wxGTK
+// VZ: testing for wxTE_PROCESS_TAB shouldn't be done here the control may
+//     have this style, yet choose not to process this particular TAB in which
+//     case TAB must still work as a navigational character
+#if 0
                  (!focus->HasFlag(wxTE_PROCESS_TAB)) &&
+#endif
                  (focus->GetParent()) &&
                  (focus->GetParent()->HasFlag( wxTAB_TRAVERSAL)) )
             {
@@ -1663,6 +1676,8 @@ void wxApp::MacHandleKeyDownEvent( WXEVENTREF evr )
                 new_event.SetWindowChange( event.ControlDown() );
                 new_event.SetCurrentFocus( focus );
                 handled = focus->GetEventHandler()->ProcessEvent( new_event );
+                if ( handled && new_event.GetSkipped() )
+                    handled = false ;
             }
         }
         if ( !handled )