From 949cb163a78520153dbdb3cd2e2dbaab075be9ca Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Sun, 28 Mar 2004 17:50:04 +0000 Subject: [PATCH] toplevel event handler exposed git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26433 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mac/carbon/toplevel.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/mac/carbon/toplevel.cpp b/src/mac/carbon/toplevel.cpp index 6d038b6fa8..f527792360 100644 --- a/src/mac/carbon/toplevel.cpp +++ b/src/mac/carbon/toplevel.cpp @@ -74,7 +74,7 @@ extern long wxMacTranslateKey(unsigned char key, unsigned char code) ; static const EventTypeSpec eventList[] = { // TODO remove control related event like key and mouse (except for WindowLeave events) -#if !TARGET_API_MAC_OSX +#if 1 { kEventClassTextInput, kEventTextInputUnicodeForKeyEvent } , { kEventClassKeyboard, kEventRawKeyDown } , @@ -827,6 +827,16 @@ void wxTopLevelWindowMac::MacSetBackgroundBrush( const wxBrush &brush ) } } +void wxTopLevelWindowMac::MacInstallTopLevelWindowEventHandler() +{ + if ( m_macEventHandler != NULL ) + { + verify_noerr( ::RemoveEventHandler( (EventHandlerRef) m_macEventHandler ) ) ; + } + InstallWindowEventHandler(MAC_WXHWND(m_macWindow), GetwxMacTopLevelEventHandlerUPP(), + GetEventTypeCount(eventList), eventList, this, (EventHandlerRef *)&m_macEventHandler); +} + void wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title, const wxPoint& pos, const wxSize& size, @@ -950,13 +960,12 @@ void wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title, else { ::CreateRootControl( (WindowRef)m_macWindow , (ControlRef*)&m_macControl ) ; - MacInstallEventHandler() ; } + MacInstallEventHandler() ; InstallStandardEventHandler( GetWindowEventTarget(MAC_WXHWND(m_macWindow)) ) ; - InstallWindowEventHandler(MAC_WXHWND(m_macWindow), GetwxMacTopLevelEventHandlerUPP(), - GetEventTypeCount(eventList), eventList, this, (EventHandlerRef *)&m_macEventHandler); - + MacInstallTopLevelWindowEventHandler() ; + m_macFocus = NULL ; if ( HasFlag(wxFRAME_SHAPED) ) -- 2.47.2