diff --git a/src/mac/carbon/toplevel.cpp b/src/mac/carbon/toplevel.cpp index dd928635f1..0af7822dde 100644 --- a/src/mac/carbon/toplevel.cpp +++ b/src/mac/carbon/toplevel.cpp @@ -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 ; } diff --git a/src/mac/toplevel.cpp b/src/mac/toplevel.cpp index dd928635f1..0af7822dde 100644 --- a/src/mac/toplevel.cpp +++ b/src/mac/toplevel.cpp @@ -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 ; }