X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/902725eefee5a402d21d13b2630583ab28ae3931..a4f4d548ce0d3533fe9e84d812643cc7c21dd580:/src/mac/carbon/app.cpp diff --git a/src/mac/carbon/app.cpp b/src/mac/carbon/app.cpp index cf429f727e..deef92ad8a 100644 --- a/src/mac/carbon/app.cpp +++ b/src/mac/carbon/app.cpp @@ -9,10 +9,6 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma implementation "app.h" -#endif - #include "wx/wxprec.h" #include "wx/window.h" @@ -457,7 +453,15 @@ static pascal OSStatus wxMacAppCommandEventHandler( EventHandlerCallRef handler } else if ( id != 0 && command.menu.menuRef != 0 && command.menu.menuItemIndex != 0 ) { - GetMenuItemRefCon( command.menu.menuRef , command.menu.menuItemIndex , (UInt32*) &item ) ; + wxMenu* itsMenu = NULL ; + UInt32 refCon ; + GetMenuItemRefCon( command.menu.menuRef , command.menu.menuItemIndex , &refCon ) ; + // make sure it is one of our own menus, otherwise don't touch + itsMenu = wxFindMenuFromMacMenu( command.menu.menuRef ) ; + if ( itsMenu != NULL ) + { + item = (wxMenuItem*) refCon ; + } } if ( item ) @@ -565,7 +569,7 @@ DEFINE_ONE_SHOT_HANDLER_GETTER( wxMacAppEventHandler ) WXIMPORT char std::__throws_bad_alloc ; #endif -#if __WXDEBUG__ +#ifdef __WXDEBUG__ pascal static void wxMacAssertOutputHandler(OSType componentSignature, UInt32 options, const char *assertionString, const char *exceptionLabelString, @@ -619,7 +623,7 @@ bool wxApp::Initialize(int& argc, wxChar **argv) { // Mac-specific -#if __WXDEBUG__ +#ifdef __WXDEBUG__ InstallDebugAssertOutputHandler ( NewDebugAssertOutputHandlerUPP( wxMacAssertOutputHandler ) ); #endif UMAInitToolbox( 4, sm_isEmbedded ) ; @@ -1443,7 +1447,7 @@ bool wxApp::MacSendKeyDownEvent( wxWindow* focus , long keymessage , long modifi event.SetEventObject(def); def->Command(event); return true ; - } + } } /* generate wxID_CANCEL if command-. or has been pressed (typically in dialogs) */ else if (keyval == WXK_ESCAPE || (keyval == '.' && modifiers & cmdKey ) )