moving stacking event handlers and event ref to central location

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28659 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2004-08-06 15:50:40 +00:00
parent 16abe93eb4
commit 27740109ca

View File

@@ -366,11 +366,7 @@ static const EventTypeSpec eventList[] =
static pascal OSStatus static pascal OSStatus
wxMacAppMenuEventHandler( EventHandlerCallRef handler , EventRef event , void *data ) wxMacAppMenuEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
{ {
EventRef formerEvent = (EventRef) wxTheApp->MacGetCurrentEvent() ;
EventHandlerCallRef formerEventHandlerCallRef = (EventHandlerCallRef) wxTheApp->MacGetCurrentEventHandlerCallRef() ;
wxTheApp->MacSetCurrentEvent( event , handler ) ;
wxMacCarbonEvent cEvent( event ) ; wxMacCarbonEvent cEvent( event ) ;
MenuRef menuRef = cEvent.GetParameter<MenuRef>(kEventParamDirectObject) ; MenuRef menuRef = cEvent.GetParameter<MenuRef>(kEventParamDirectObject) ;
wxMenu* menu = wxFindMenuFromMacMenu( menuRef ) ; wxMenu* menu = wxFindMenuFromMacMenu( menuRef ) ;
@@ -416,8 +412,6 @@ wxMacAppMenuEventHandler( EventHandlerCallRef handler , EventRef event , void *d
} }
} }
wxTheApp->MacSetCurrentEvent( formerEvent, formerEventHandlerCallRef ) ;
return eventNotHandledErr; return eventNotHandledErr;
} }
@@ -502,6 +496,10 @@ static pascal OSStatus wxMacAppApplicationEventHandler( EventHandlerCallRef hand
pascal OSStatus wxMacAppEventHandler( EventHandlerCallRef handler , EventRef event , void *data ) pascal OSStatus wxMacAppEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
{ {
EventRef formerEvent = (EventRef) wxTheApp->MacGetCurrentEvent() ;
EventHandlerCallRef formerEventHandlerCallRef = (EventHandlerCallRef) wxTheApp->MacGetCurrentEventHandlerCallRef() ;
wxTheApp->MacSetCurrentEvent( event , handler ) ;
OSStatus result = eventNotHandledErr ; OSStatus result = eventNotHandledErr ;
switch( GetEventClass( event ) ) switch( GetEventClass( event ) )
{ {
@@ -528,6 +526,8 @@ pascal OSStatus wxMacAppEventHandler( EventHandlerCallRef handler , EventRef eve
break ; break ;
} }
wxTheApp->MacSetCurrentEvent( formerEvent, formerEventHandlerCallRef ) ;
return result ; return result ;
} }