]> git.saurik.com Git - wxWidgets.git/commitdiff
avoiding double firing of visibility state changed for certain controls like multilin...
authorStefan Csomor <csomor@advancedconcepts.ch>
Sat, 23 Feb 2008 09:45:10 +0000 (09:45 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Sat, 23 Feb 2008 09:45:10 +0000 (09:45 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52018 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mac/carbon/window.cpp

index 76ad79347675c154969713a7a567a1ff1b75a8eb..220960871acaadb4714dcf58559d056b39d93a86 100644 (file)
@@ -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();