X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c8326d649c00a47d3e77770a8e0a0a3b7ead56bb..ab346e1c7e75d76f3aeef1b21a02a0620f7e3452:/src/mac/carbon/app.cpp diff --git a/src/mac/carbon/app.cpp b/src/mac/carbon/app.cpp index 3f0b8919f7..154369334d 100644 --- a/src/mac/carbon/app.cpp +++ b/src/mac/carbon/app.cpp @@ -27,15 +27,15 @@ #include "wx/palette.h" #include "wx/icon.h" #include "wx/cursor.h" + #include "wx/dialog.h" + #include "wx/msgdlg.h" + #include "wx/textctrl.h" + #include "wx/memory.h" + #include "wx/gdicmn.h" #endif -#include "wx/gdicmn.h" -#include "wx/dialog.h" -#include "wx/msgdlg.h" #include "wx/module.h" -#include "wx/memory.h" #include "wx/tooltip.h" -#include "wx/textctrl.h" #include "wx/docview.h" #include "wx/filename.h" @@ -67,8 +67,6 @@ # include #endif -extern wxList wxPendingDelete; - #if wxUSE_THREADS extern size_t g_numberOfThreads; #endif @@ -1578,14 +1576,18 @@ bool wxApp::MacSendCharEvent( wxWindow* focus , long keymessage , long modifiers { if ( keyval == WXK_RETURN ) { - wxButton *def = wxDynamicCast(focus->GetDefaultItem(), wxButton); - if ( def && def->IsEnabled() ) + wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(focus), wxTopLevelWindow); + if ( tlw && tlw->GetDefaultItem() ) { - wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, def->GetId() ); - event.SetEventObject(def); - def->Command(event); + wxButton *def = wxDynamicCast(tlw->GetDefaultItem(), wxButton); + if ( def && def->IsEnabled() ) + { + wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, def->GetId() ); + event.SetEventObject(def); + def->Command(event); - return true ; + return true ; + } } } else if (keyval == WXK_ESCAPE || (keyval == '.' && modifiers & cmdKey ) )