Don't use focus if NULL

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20205 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2003-04-13 22:38:57 +00:00
parent e340193bb6
commit 8d60dc8aa0
2 changed files with 6 additions and 6 deletions

View File

@@ -181,19 +181,19 @@ static pascal OSStatus KeyboardEventHandler( EventHandlerCallRef handler , Event
wxWindow* focus = wxWindow::FindFocus() ;
event.SetEventObject(focus);
if ( (modifiers ^ wxTheApp->s_lastModifiers ) & controlKey )
if ( focus && (modifiers ^ wxTheApp->s_lastModifiers ) & controlKey )
{
event.m_keyCode = WXK_CONTROL ;
event.SetEventType( ( modifiers & controlKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ;
focus->GetEventHandler()->ProcessEvent( event ) ;
}
if ( (modifiers ^ wxTheApp->s_lastModifiers ) & shiftKey )
if ( focus && (modifiers ^ wxTheApp->s_lastModifiers ) & shiftKey )
{
event.m_keyCode = WXK_SHIFT ;
event.SetEventType( ( modifiers & shiftKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ;
focus->GetEventHandler()->ProcessEvent( event ) ;
}
if ( (modifiers ^ wxTheApp->s_lastModifiers ) & optionKey )
if ( focus && (modifiers ^ wxTheApp->s_lastModifiers ) & optionKey )
{
event.m_keyCode = WXK_ALT ;
event.SetEventType( ( modifiers & optionKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ;

View File

@@ -181,19 +181,19 @@ static pascal OSStatus KeyboardEventHandler( EventHandlerCallRef handler , Event
wxWindow* focus = wxWindow::FindFocus() ;
event.SetEventObject(focus);
if ( (modifiers ^ wxTheApp->s_lastModifiers ) & controlKey )
if ( focus && (modifiers ^ wxTheApp->s_lastModifiers ) & controlKey )
{
event.m_keyCode = WXK_CONTROL ;
event.SetEventType( ( modifiers & controlKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ;
focus->GetEventHandler()->ProcessEvent( event ) ;
}
if ( (modifiers ^ wxTheApp->s_lastModifiers ) & shiftKey )
if ( focus && (modifiers ^ wxTheApp->s_lastModifiers ) & shiftKey )
{
event.m_keyCode = WXK_SHIFT ;
event.SetEventType( ( modifiers & shiftKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ;
focus->GetEventHandler()->ProcessEvent( event ) ;
}
if ( (modifiers ^ wxTheApp->s_lastModifiers ) & optionKey )
if ( focus && (modifiers ^ wxTheApp->s_lastModifiers ) & optionKey )
{
event.m_keyCode = WXK_ALT ;
event.SetEventType( ( modifiers & optionKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ;