From: David Elliott Date: Fri, 13 Jun 2003 20:24:32 +0000 (+0000) Subject: Added support for delayed deactivation of windows (for MDI) X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/245f35816d761212279e8cf223475efb7a367553?ds=inline Added support for delayed deactivation of windows (for MDI) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21126 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/mac/toplevel.h b/include/wx/mac/toplevel.h index 182c916c03..c0705c0cd6 100644 --- a/include/wx/mac/toplevel.h +++ b/include/wx/mac/toplevel.h @@ -67,6 +67,7 @@ public: // implementation from now on // -------------------------- + static void MacDelayedDeactivation(long timestamp); virtual void MacCreateRealWindow( const wxString& title, const wxPoint& pos, const wxSize& size, @@ -116,6 +117,7 @@ protected: bool m_macNeedsErasing ; static WXWindow s_macWindowInUpdate ; + static wxTopLevelWindowMac *s_macDeactivateWindow; private : #if TARGET_CARBON WXEVENTHANDLERREF m_macEventHandler ; diff --git a/src/mac/carbon/toplevel.cpp b/src/mac/carbon/toplevel.cpp index 7e10934096..b4864e8f21 100644 --- a/src/mac/carbon/toplevel.cpp +++ b/src/mac/carbon/toplevel.cpp @@ -439,6 +439,7 @@ void wxRemoveMacWindowAssociation(wxTopLevelWindowMac *win) // ---------------------------------------------------------------------------- WXHWND wxTopLevelWindowMac::s_macWindowInUpdate = NULL; +wxTopLevelWindowMac *wxTopLevelWindowMac::s_macDeactivateWindow = NULL; void wxTopLevelWindowMac::Init() { @@ -916,8 +917,21 @@ void wxTopLevelWindowMac::MacMouseMoved( WXEVENTREF ev , short part) #endif +void wxTopLevelWindowMac::MacDelayedDeactivation(long timestamp) +{ + if(s_macDeactivateWindow) + { + wxLogDebug("Doing delayed deactivation of %p",s_macDeactivateWindow); + s_macDeactivateWindow->MacActivate(timestamp, false); + } +} + void wxTopLevelWindowMac::MacActivate( long timestamp , bool inIsActivating ) { + wxLogDebug("TopLevel=%p::MacActivate",this); + if(s_macDeactivateWindow==this) + s_macDeactivateWindow=NULL; + MacDelayedDeactivation(timestamp); wxActivateEvent event(wxEVT_ACTIVATE, inIsActivating , m_windowId); event.m_timeStamp = timestamp ; event.SetEventObject(this); diff --git a/src/mac/toplevel.cpp b/src/mac/toplevel.cpp index 7e10934096..b4864e8f21 100644 --- a/src/mac/toplevel.cpp +++ b/src/mac/toplevel.cpp @@ -439,6 +439,7 @@ void wxRemoveMacWindowAssociation(wxTopLevelWindowMac *win) // ---------------------------------------------------------------------------- WXHWND wxTopLevelWindowMac::s_macWindowInUpdate = NULL; +wxTopLevelWindowMac *wxTopLevelWindowMac::s_macDeactivateWindow = NULL; void wxTopLevelWindowMac::Init() { @@ -916,8 +917,21 @@ void wxTopLevelWindowMac::MacMouseMoved( WXEVENTREF ev , short part) #endif +void wxTopLevelWindowMac::MacDelayedDeactivation(long timestamp) +{ + if(s_macDeactivateWindow) + { + wxLogDebug("Doing delayed deactivation of %p",s_macDeactivateWindow); + s_macDeactivateWindow->MacActivate(timestamp, false); + } +} + void wxTopLevelWindowMac::MacActivate( long timestamp , bool inIsActivating ) { + wxLogDebug("TopLevel=%p::MacActivate",this); + if(s_macDeactivateWindow==this) + s_macDeactivateWindow=NULL; + MacDelayedDeactivation(timestamp); wxActivateEvent event(wxEVT_ACTIVATE, inIsActivating , m_windowId); event.m_timeStamp = timestamp ; event.SetEventObject(this);