git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26554 
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
                 // GrafPtr myport = cEvent.GetParameter<GrafPtr>(kEventParamGrafPort,typeGrafPtr) ;
 
 #if 0 
                 // GrafPtr myport = cEvent.GetParameter<GrafPtr>(kEventParamGrafPort,typeGrafPtr) ;
 
 #if 0 
-                // in case we would need a coregraphics compliant background erase first
+              // in case we would need a coregraphics compliant background erase first
                 // now usable to track redraws
                 CGContextRef cgContext = cEvent.GetParameter<CGContextRef>(kEventParamCGContextRef) ;
                 if ( thisWindow->MacIsUserPane() )
                 // now usable to track redraws
                 CGContextRef cgContext = cEvent.GetParameter<CGContextRef>(kEventParamCGContextRef) ;
                 if ( thisWindow->MacIsUserPane() )
 
 void wxWindowMac::MacInstallEventHandler()
 {
 
 void wxWindowMac::MacInstallEventHandler()
 {
+    wxAssociateControlWithMacControl( (ControlRef) m_macControl , this ) ;
     InstallControlEventHandler( (ControlRef) m_macControl, GetwxMacWindowEventHandlerUPP(),
         GetEventTypeCount(eventList), eventList, this, 
         (EventHandlerRef *)&m_macControlEventHandler);
     InstallControlEventHandler( (ControlRef) m_macControl, GetwxMacWindowEventHandlerUPP(),
         GetEventTypeCount(eventList), eventList, this, 
         (EventHandlerRef *)&m_macControlEventHandler);
 {
     wxASSERT_MSG( (ControlRef) m_macControl != NULL , wxT("No valid mac control") ) ;
 
 {
     wxASSERT_MSG( (ControlRef) m_macControl != NULL , wxT("No valid mac control") ) ;
 
-    wxAssociateControlWithMacControl( (ControlRef) m_macControl , this ) ;
     ::SetControlReference( (ControlRef) m_macControl , (long) this ) ;
 
     MacInstallEventHandler();
     ::SetControlReference( (ControlRef) m_macControl , (long) this ) ;
 
     MacInstallEventHandler();
     if ( x ) pt.x = *x ;
     if ( y ) pt.y = *y ;
 
     if ( x ) pt.x = *x ;
     if ( y ) pt.y = *y ;
 
-    HIViewConvertPoint( &pt , (ControlRef) m_macControl , (ControlRef) MacGetTopLevelWindow()->GetHandle()  ) ;
+    if ( !IsTopLevel() )
+        HIViewConvertPoint( &pt , (ControlRef) m_macControl , (ControlRef) MacGetTopLevelWindow()->GetHandle()  ) ;
     
     if ( x ) *x = (int) pt.x ;
     if ( y ) *y = (int) pt.y ;
     
     if ( x ) *x = (int) pt.x ;
     if ( y ) *y = (int) pt.y ;
     if ( x ) pt.x = *x ;
     if ( y ) pt.y = *y ;
 
     if ( x ) pt.x = *x ;
     if ( y ) pt.y = *y ;
 
-    HIViewConvertPoint( &pt , (ControlRef) MacGetTopLevelWindow()->GetHandle()  , (ControlRef) m_macControl ) ;
+    if ( !IsTopLevel() )
+        HIViewConvertPoint( &pt , (ControlRef) MacGetTopLevelWindow()->GetHandle()  , (ControlRef) m_macControl ) ;
     
     if ( x ) *x = (int) pt.x ;
     if ( y ) *y = (int) pt.y ;
     
     if ( x ) *x = (int) pt.x ;
     if ( y ) *y = (int) pt.y ;
  */
 bool wxWindowMac::MacDoRedraw( WXHRGN updatergnr , long time ) 
 {
  */
 bool wxWindowMac::MacDoRedraw( WXHRGN updatergnr , long time ) 
 {
-    // we let the OS handle root control redraws
-    if ( m_macControl == MacGetTopLevelWindow()->GetHandle() )
-        return false ;
-        
     RgnHandle updatergn = (RgnHandle) updatergnr ;
     bool handled = false ;
     
     RgnHandle updatergn = (RgnHandle) updatergnr ;
     bool handled = false ;