From: Stefan Csomor Date: Tue, 3 Jun 2003 20:32:59 +0000 (+0000) Subject: feeds missed key events back to the control X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/ace07c80baf8585b1e15162d5c3e5e8a4776ab90?ds=inline feeds missed key events back to the control git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20899 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- 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 ; }