- Rect former ;
- GetControlBounds( m_controlRef , &former ) ;
- InvalWindowRect( GetControlOwner( m_controlRef ) , &former ) ;
- SetControlBounds( m_controlRef , r ) ;
- InvalWindowRect( GetControlOwner( m_controlRef ) , r ) ;
+ bool vis = IsVisible() ;
+ if ( vis )
+ {
+ Rect former ;
+ GetControlBounds( m_controlRef , &former ) ;
+ InvalWindowRect( GetControlOwner( m_controlRef ) , &former ) ;
+ }
+
+ Rect controlBounds = *r ;
+
+ // since the rect passed in is always (even in non-compositing) relative
+ // to the (native) parent, we have to adjust to window relative here
+ wxMacControl* parent = m_peer->GetParent()->GetPeer() ;
+ if ( !parent->m_isRootControl )
+ {
+ Rect superRect ;
+ GetControlBounds( parent->m_controlRef , &superRect ) ;
+ OffsetRect( &controlBounds , superRect.left , superRect.top ) ;
+ }
+
+ SetControlBounds( m_controlRef , &controlBounds ) ;
+ if ( vis )
+ InvalWindowRect( GetControlOwner( m_controlRef ) , &controlBounds ) ;