changed char event handling for ctrl-chars and skipped events
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15588 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1595,6 +1595,11 @@ void wxApp::MacHandleKeyDownEvent( WXEVENTREF evr )
|
|||||||
short keychar ;
|
short keychar ;
|
||||||
keychar = short(ev->message & charCodeMask);
|
keychar = short(ev->message & charCodeMask);
|
||||||
keycode = short(ev->message & keyCodeMask) >> 8 ;
|
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) ;
|
long keyval = wxMacTranslateKey(keychar, keycode) ;
|
||||||
bool handled = false ;
|
bool handled = false ;
|
||||||
wxWindow* focus = wxWindow::FindFocus() ;
|
wxWindow* focus = wxWindow::FindFocus() ;
|
||||||
@@ -1612,12 +1617,13 @@ void wxApp::MacHandleKeyDownEvent( WXEVENTREF evr )
|
|||||||
event.m_timeStamp = ev->when;
|
event.m_timeStamp = ev->when;
|
||||||
event.SetEventObject(focus);
|
event.SetEventObject(focus);
|
||||||
handled = focus->GetEventHandler()->ProcessEvent( event ) ;
|
handled = focus->GetEventHandler()->ProcessEvent( event ) ;
|
||||||
|
if ( handled && event.GetSkipped() )
|
||||||
|
handled = false ;
|
||||||
if ( !handled )
|
if ( !handled )
|
||||||
{
|
{
|
||||||
#if wxUSE_ACCEL
|
#if wxUSE_ACCEL
|
||||||
if (!handled)
|
if (!handled)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
wxWindow *ancestor = focus;
|
wxWindow *ancestor = focus;
|
||||||
while (ancestor)
|
while (ancestor)
|
||||||
{
|
{
|
||||||
@@ -1628,11 +1634,10 @@ void wxApp::MacHandleKeyDownEvent( WXEVENTREF evr )
|
|||||||
handled = ancestor->GetEventHandler()->ProcessEvent( command_event );
|
handled = ancestor->GetEventHandler()->ProcessEvent( command_event );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (ancestor->m_isFrame)
|
if (ancestor->IsTopLevel())
|
||||||
break;
|
break;
|
||||||
ancestor = ancestor->GetParent();
|
ancestor = ancestor->GetParent();
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
#endif // wxUSE_ACCEL
|
#endif // wxUSE_ACCEL
|
||||||
}
|
}
|
||||||
@@ -1649,10 +1654,18 @@ void wxApp::MacHandleKeyDownEvent( WXEVENTREF evr )
|
|||||||
event.m_timeStamp = ev->when;
|
event.m_timeStamp = ev->when;
|
||||||
event.SetEventObject(focus);
|
event.SetEventObject(focus);
|
||||||
handled = focus->GetEventHandler()->ProcessEvent( event ) ;
|
handled = focus->GetEventHandler()->ProcessEvent( event ) ;
|
||||||
|
if ( handled && event.GetSkipped() )
|
||||||
|
handled = false ;
|
||||||
}
|
}
|
||||||
if ( !handled &&
|
if ( !handled &&
|
||||||
(keyval == WXK_TAB) &&
|
(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)) &&
|
(!focus->HasFlag(wxTE_PROCESS_TAB)) &&
|
||||||
|
#endif
|
||||||
(focus->GetParent()) &&
|
(focus->GetParent()) &&
|
||||||
(focus->GetParent()->HasFlag( wxTAB_TRAVERSAL)) )
|
(focus->GetParent()->HasFlag( wxTAB_TRAVERSAL)) )
|
||||||
{
|
{
|
||||||
@@ -1663,6 +1676,8 @@ void wxApp::MacHandleKeyDownEvent( WXEVENTREF evr )
|
|||||||
new_event.SetWindowChange( event.ControlDown() );
|
new_event.SetWindowChange( event.ControlDown() );
|
||||||
new_event.SetCurrentFocus( focus );
|
new_event.SetCurrentFocus( focus );
|
||||||
handled = focus->GetEventHandler()->ProcessEvent( new_event );
|
handled = focus->GetEventHandler()->ProcessEvent( new_event );
|
||||||
|
if ( handled && new_event.GetSkipped() )
|
||||||
|
handled = false ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( !handled )
|
if ( !handled )
|
||||||
|
@@ -1595,6 +1595,11 @@ void wxApp::MacHandleKeyDownEvent( WXEVENTREF evr )
|
|||||||
short keychar ;
|
short keychar ;
|
||||||
keychar = short(ev->message & charCodeMask);
|
keychar = short(ev->message & charCodeMask);
|
||||||
keycode = short(ev->message & keyCodeMask) >> 8 ;
|
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) ;
|
long keyval = wxMacTranslateKey(keychar, keycode) ;
|
||||||
bool handled = false ;
|
bool handled = false ;
|
||||||
wxWindow* focus = wxWindow::FindFocus() ;
|
wxWindow* focus = wxWindow::FindFocus() ;
|
||||||
@@ -1612,12 +1617,13 @@ void wxApp::MacHandleKeyDownEvent( WXEVENTREF evr )
|
|||||||
event.m_timeStamp = ev->when;
|
event.m_timeStamp = ev->when;
|
||||||
event.SetEventObject(focus);
|
event.SetEventObject(focus);
|
||||||
handled = focus->GetEventHandler()->ProcessEvent( event ) ;
|
handled = focus->GetEventHandler()->ProcessEvent( event ) ;
|
||||||
|
if ( handled && event.GetSkipped() )
|
||||||
|
handled = false ;
|
||||||
if ( !handled )
|
if ( !handled )
|
||||||
{
|
{
|
||||||
#if wxUSE_ACCEL
|
#if wxUSE_ACCEL
|
||||||
if (!handled)
|
if (!handled)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
wxWindow *ancestor = focus;
|
wxWindow *ancestor = focus;
|
||||||
while (ancestor)
|
while (ancestor)
|
||||||
{
|
{
|
||||||
@@ -1628,11 +1634,10 @@ void wxApp::MacHandleKeyDownEvent( WXEVENTREF evr )
|
|||||||
handled = ancestor->GetEventHandler()->ProcessEvent( command_event );
|
handled = ancestor->GetEventHandler()->ProcessEvent( command_event );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (ancestor->m_isFrame)
|
if (ancestor->IsTopLevel())
|
||||||
break;
|
break;
|
||||||
ancestor = ancestor->GetParent();
|
ancestor = ancestor->GetParent();
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
#endif // wxUSE_ACCEL
|
#endif // wxUSE_ACCEL
|
||||||
}
|
}
|
||||||
@@ -1649,10 +1654,18 @@ void wxApp::MacHandleKeyDownEvent( WXEVENTREF evr )
|
|||||||
event.m_timeStamp = ev->when;
|
event.m_timeStamp = ev->when;
|
||||||
event.SetEventObject(focus);
|
event.SetEventObject(focus);
|
||||||
handled = focus->GetEventHandler()->ProcessEvent( event ) ;
|
handled = focus->GetEventHandler()->ProcessEvent( event ) ;
|
||||||
|
if ( handled && event.GetSkipped() )
|
||||||
|
handled = false ;
|
||||||
}
|
}
|
||||||
if ( !handled &&
|
if ( !handled &&
|
||||||
(keyval == WXK_TAB) &&
|
(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)) &&
|
(!focus->HasFlag(wxTE_PROCESS_TAB)) &&
|
||||||
|
#endif
|
||||||
(focus->GetParent()) &&
|
(focus->GetParent()) &&
|
||||||
(focus->GetParent()->HasFlag( wxTAB_TRAVERSAL)) )
|
(focus->GetParent()->HasFlag( wxTAB_TRAVERSAL)) )
|
||||||
{
|
{
|
||||||
@@ -1663,6 +1676,8 @@ void wxApp::MacHandleKeyDownEvent( WXEVENTREF evr )
|
|||||||
new_event.SetWindowChange( event.ControlDown() );
|
new_event.SetWindowChange( event.ControlDown() );
|
||||||
new_event.SetCurrentFocus( focus );
|
new_event.SetCurrentFocus( focus );
|
||||||
handled = focus->GetEventHandler()->ProcessEvent( new_event );
|
handled = focus->GetEventHandler()->ProcessEvent( new_event );
|
||||||
|
if ( handled && new_event.GetSkipped() )
|
||||||
|
handled = false ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( !handled )
|
if ( !handled )
|
||||||
|
Reference in New Issue
Block a user