From: Stefan Csomor Date: Sat, 23 Feb 2008 09:45:10 +0000 (+0000) Subject: avoiding double firing of visibility state changed for certain controls like multilin... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/ef53a8e81460709c871aec9d1693c2f4770592d8?hp=841e47cfd74743bc6bf9f44e729badc3f8051872 avoiding double firing of visibility state changed for certain controls like multiline text controls git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52018 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/mac/carbon/window.cpp b/src/mac/carbon/window.cpp index 76ad793476..220960871a 100644 --- a/src/mac/carbon/window.cpp +++ b/src/mac/carbon/window.cpp @@ -276,7 +276,13 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl break ; case kEventControlVisibilityChanged : - thisWindow->MacVisibilityChanged() ; + // we might have two native controls attributed to the same wxWindow instance + // eg a scrollview and an embedded textview, make sure we only fire for the 'outer' + // control, as otherwise native and wx visibility are different + if ( thisWindow->GetPeer() != NULL && thisWindow->GetPeer()->GetControlRef() == controlRef ) + { + thisWindow->MacVisibilityChanged() ; + } break ; case kEventControlEnabledStateChanged : @@ -3199,7 +3205,17 @@ bool wxWindowMac::IsShownOnScreen() const { #if TARGET_API_MAC_OSX if ( m_peer && m_peer->Ok() ) + { + bool peerVis = m_peer->IsVisible(); + bool wxVis = wxWindowBase::IsShownOnScreen(); + if( peerVis != wxVis ) + { + wxVis = wxWindowBase::IsShownOnScreen(); + return wxVis; + } + return m_peer->IsVisible(); + } #endif return wxWindowBase::IsShownOnScreen();