]> git.saurik.com Git - wxWidgets.git/commitdiff
feeds missed key events back to the control
authorStefan Csomor <csomor@advancedconcepts.ch>
Tue, 3 Jun 2003 20:32:59 +0000 (20:32 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Tue, 3 Jun 2003 20:32:59 +0000 (20:32 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20899 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mac/carbon/toplevel.cpp
src/mac/toplevel.cpp

index dd928635f1fce1df512882ddefcf1f49c42b9dc4..0af7822ddeb58a86170def5d22ce394c92abeee7 100644 (file)
@@ -128,11 +128,26 @@ static pascal OSStatus TextInputEventHandler( EventHandlerCallRef handler , Even
     switch ( GetEventKind( event ) )
     {
         case kEventTextInputUnicodeForKeyEvent :
+            // this is only called when no default handler has jumped in, eg a wxControl on a floater window does not
+            // get its own kEventTextInputUnicodeForKeyEvent, so we route back the 
+            wxControl* control = wxDynamicCast( focus , wxControl ) ;
+            if ( control )
+            {
+                ControlHandle macControl = (ControlHandle) control->GetMacControl() ;
+                if ( macControl )
+                {
+                    ::HandleControlKey( macControl , keyCode , charCode , modifiers ) ;
+                    result = noErr ;
+                }
+            }
+            /*
+            // this may lead to double events sent to a window in case all handlers have skipped the key down event
             if ( (focus != NULL) && wxTheApp->MacSendKeyDownEvent(
                 focus , message , modifiers , when , point.h , point.v ) )
             {
                 result = noErr ;
             }
+            */
             break ;
     }
 
index dd928635f1fce1df512882ddefcf1f49c42b9dc4..0af7822ddeb58a86170def5d22ce394c92abeee7 100644 (file)
@@ -128,11 +128,26 @@ static pascal OSStatus TextInputEventHandler( EventHandlerCallRef handler , Even
     switch ( GetEventKind( event ) )
     {
         case kEventTextInputUnicodeForKeyEvent :
+            // this is only called when no default handler has jumped in, eg a wxControl on a floater window does not
+            // get its own kEventTextInputUnicodeForKeyEvent, so we route back the 
+            wxControl* control = wxDynamicCast( focus , wxControl ) ;
+            if ( control )
+            {
+                ControlHandle macControl = (ControlHandle) control->GetMacControl() ;
+                if ( macControl )
+                {
+                    ::HandleControlKey( macControl , keyCode , charCode , modifiers ) ;
+                    result = noErr ;
+                }
+            }
+            /*
+            // this may lead to double events sent to a window in case all handlers have skipped the key down event
             if ( (focus != NULL) && wxTheApp->MacSendKeyDownEvent(
                 focus , message , modifiers , when , point.h , point.v ) )
             {
                 result = noErr ;
             }
+            */
             break ;
     }