we are always compositing on the supported OS versions
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40560 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -625,7 +625,6 @@ public :
|
|||||||
virtual OSStatus GetRegion( ControlPartCode partCode , RgnHandle region );
|
virtual OSStatus GetRegion( ControlPartCode partCode , RgnHandle region );
|
||||||
virtual OSStatus SetZOrder( bool above , wxMacControl* other );
|
virtual OSStatus SetZOrder( bool above , wxMacControl* other );
|
||||||
|
|
||||||
bool IsCompositing() { return m_isCompositing; }
|
|
||||||
bool IsRootControl() { return m_isRootControl; }
|
bool IsRootControl() { return m_isRootControl; }
|
||||||
|
|
||||||
wxWindow* GetPeer() const
|
wxWindow* GetPeer() const
|
||||||
@@ -642,7 +641,6 @@ protected :
|
|||||||
long m_windowStyle;
|
long m_windowStyle;
|
||||||
wxWindow* m_peer;
|
wxWindow* m_peer;
|
||||||
bool m_needsFocusRect;
|
bool m_needsFocusRect;
|
||||||
bool m_isCompositing;
|
|
||||||
bool m_isRootControl;
|
bool m_isRootControl;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -854,7 +854,7 @@ Rect * UMAGetControlBoundsInWindowCoords( ControlRef theControl, Rect *bounds )
|
|||||||
WindowRef tlwref = GetControlOwner( theControl ) ;
|
WindowRef tlwref = GetControlOwner( theControl ) ;
|
||||||
|
|
||||||
wxTopLevelWindowMac* tlwwx = wxFindWinFromMacWindow( tlwref ) ;
|
wxTopLevelWindowMac* tlwwx = wxFindWinFromMacWindow( tlwref ) ;
|
||||||
if ( tlwwx != NULL && tlwwx->MacUsesCompositing() )
|
if ( tlwwx != NULL )
|
||||||
{
|
{
|
||||||
ControlRef rootControl = tlwwx->GetPeer()->GetControlRef() ;
|
ControlRef rootControl = tlwwx->GetPeer()->GetControlRef() ;
|
||||||
HIPoint hiPoint = CGPointMake( 0 , 0 ) ;
|
HIPoint hiPoint = CGPointMake( 0 , 0 ) ;
|
||||||
|
@@ -820,14 +820,12 @@ wxMacControl::wxMacControl(wxWindow* peer , bool isRootControl )
|
|||||||
Init();
|
Init();
|
||||||
m_peer = peer;
|
m_peer = peer;
|
||||||
m_isRootControl = isRootControl;
|
m_isRootControl = isRootControl;
|
||||||
m_isCompositing = peer->MacGetTopLevelWindow()->MacUsesCompositing();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMacControl::wxMacControl( wxWindow* peer , ControlRef control )
|
wxMacControl::wxMacControl( wxWindow* peer , ControlRef control )
|
||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
m_peer = peer;
|
m_peer = peer;
|
||||||
m_isCompositing = peer->MacGetTopLevelWindow()->MacUsesCompositing();
|
|
||||||
m_controlRef = control;
|
m_controlRef = control;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -835,7 +833,6 @@ wxMacControl::wxMacControl( wxWindow* peer , WXWidget control )
|
|||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
m_peer = peer;
|
m_peer = peer;
|
||||||
m_isCompositing = peer->MacGetTopLevelWindow()->MacUsesCompositing();
|
|
||||||
m_controlRef = (ControlRef) control;
|
m_controlRef = (ControlRef) control;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -848,7 +845,6 @@ void wxMacControl::Init()
|
|||||||
m_peer = NULL;
|
m_peer = NULL;
|
||||||
m_controlRef = NULL;
|
m_controlRef = NULL;
|
||||||
m_needsFocusRect = false;
|
m_needsFocusRect = false;
|
||||||
m_isCompositing = false;
|
|
||||||
m_isRootControl = false;
|
m_isRootControl = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1096,72 +1092,28 @@ bool wxMacControl::IsActive() const
|
|||||||
|
|
||||||
void wxMacControl::Enable( bool enable )
|
void wxMacControl::Enable( bool enable )
|
||||||
{
|
{
|
||||||
#if TARGET_API_MAC_OSX
|
|
||||||
if ( enable )
|
if ( enable )
|
||||||
EnableControl( m_controlRef );
|
EnableControl( m_controlRef );
|
||||||
else
|
else
|
||||||
DisableControl( m_controlRef );
|
DisableControl( m_controlRef );
|
||||||
#else
|
|
||||||
if ( enable )
|
|
||||||
ActivateControl( m_controlRef );
|
|
||||||
else
|
|
||||||
DeactivateControl( m_controlRef );
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMacControl::SetDrawingEnabled( bool enable )
|
void wxMacControl::SetDrawingEnabled( bool enable )
|
||||||
{
|
{
|
||||||
#if TARGET_API_MAC_OSX
|
|
||||||
HIViewSetDrawingEnabled( m_controlRef , enable );
|
HIViewSetDrawingEnabled( m_controlRef , enable );
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TARGET_API_MAC_OSX
|
|
||||||
bool wxMacControl::GetNeedsDisplay() const
|
bool wxMacControl::GetNeedsDisplay() const
|
||||||
{
|
{
|
||||||
#if TARGET_API_MAC_OSX
|
return HIViewGetNeedsDisplay( m_controlRef );
|
||||||
if ( m_isCompositing )
|
|
||||||
{
|
|
||||||
return HIViewGetNeedsDisplay( m_controlRef );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
if ( !IsVisible() )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
Rect controlBounds;
|
|
||||||
GetControlBounds( m_controlRef, &controlBounds );
|
|
||||||
RgnHandle rgn = NewRgn();
|
|
||||||
GetWindowRegion ( GetControlOwner( m_controlRef ) , kWindowUpdateRgn , rgn );
|
|
||||||
Boolean intersect = RectInRgn ( &controlBounds , rgn );
|
|
||||||
DisposeRgn( rgn );
|
|
||||||
|
|
||||||
return intersect;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void wxMacControl::SetNeedsDisplay( RgnHandle where )
|
void wxMacControl::SetNeedsDisplay( RgnHandle where )
|
||||||
{
|
{
|
||||||
if ( !IsVisible() )
|
if ( !IsVisible() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if TARGET_API_MAC_OSX
|
HIViewSetNeedsDisplayInRegion( m_controlRef , where , true );
|
||||||
if ( m_isCompositing )
|
|
||||||
{
|
|
||||||
HIViewSetNeedsDisplayInRegion( m_controlRef , where , true );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
Rect controlBounds;
|
|
||||||
GetControlBounds( m_controlRef, &controlBounds );
|
|
||||||
RgnHandle update = NewRgn();
|
|
||||||
CopyRgn( where , update );
|
|
||||||
OffsetRgn( update , controlBounds.left , controlBounds.top );
|
|
||||||
InvalWindowRgn( GetControlOwner( m_controlRef) , update );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMacControl::SetNeedsDisplay( Rect* where )
|
void wxMacControl::SetNeedsDisplay( Rect* where )
|
||||||
@@ -1169,133 +1121,41 @@ void wxMacControl::SetNeedsDisplay( Rect* where )
|
|||||||
if ( !IsVisible() )
|
if ( !IsVisible() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if TARGET_API_MAC_OSX
|
if ( where != NULL )
|
||||||
if ( m_isCompositing )
|
|
||||||
{
|
{
|
||||||
if ( where != NULL )
|
RgnHandle update = NewRgn();
|
||||||
{
|
RectRgn( update , where );
|
||||||
RgnHandle update = NewRgn();
|
HIViewSetNeedsDisplayInRegion( m_controlRef , update , true );
|
||||||
RectRgn( update , where );
|
DisposeRgn( update );
|
||||||
HIViewSetNeedsDisplayInRegion( m_controlRef , update , true );
|
|
||||||
DisposeRgn( update );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
HIViewSetNeedsDisplay( m_controlRef , true );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
HIViewSetNeedsDisplay( m_controlRef , true );
|
||||||
{
|
|
||||||
Rect controlBounds;
|
|
||||||
|
|
||||||
GetControlBounds( m_controlRef, &controlBounds );
|
|
||||||
if ( where )
|
|
||||||
{
|
|
||||||
Rect whereLocal = *where;
|
|
||||||
OffsetRect( &whereLocal , controlBounds.left , controlBounds.top );
|
|
||||||
SectRect( &controlBounds , &whereLocal, &controlBounds );
|
|
||||||
}
|
|
||||||
|
|
||||||
InvalWindowRect( GetControlOwner( m_controlRef) , &controlBounds );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMacControl::Convert( wxPoint *pt , wxMacControl *from , wxMacControl *to )
|
void wxMacControl::Convert( wxPoint *pt , wxMacControl *from , wxMacControl *to )
|
||||||
{
|
{
|
||||||
#if TARGET_API_MAC_OSX
|
HIPoint hiPoint;
|
||||||
if ( from->m_peer->MacGetTopLevelWindow()->MacUsesCompositing() )
|
|
||||||
{
|
|
||||||
HIPoint hiPoint;
|
|
||||||
|
|
||||||
hiPoint.x = pt->x;
|
hiPoint.x = pt->x;
|
||||||
hiPoint.y = pt->y;
|
hiPoint.y = pt->y;
|
||||||
HIViewConvertPoint( &hiPoint , from->m_controlRef , to->m_controlRef );
|
HIViewConvertPoint( &hiPoint , from->m_controlRef , to->m_controlRef );
|
||||||
pt->x = (int)hiPoint.x;
|
pt->x = (int)hiPoint.x;
|
||||||
pt->y = (int)hiPoint.y;
|
pt->y = (int)hiPoint.y;
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
Rect fromRect, toRect;
|
|
||||||
|
|
||||||
GetControlBounds( from->m_controlRef , &fromRect );
|
|
||||||
GetControlBounds( to->m_controlRef , &toRect );
|
|
||||||
if ( from->m_isRootControl )
|
|
||||||
fromRect.left = fromRect.top = 0;
|
|
||||||
if ( to->m_isRootControl )
|
|
||||||
toRect.left = toRect.top = 0;
|
|
||||||
|
|
||||||
pt->x = pt->x + fromRect.left - toRect.left;
|
|
||||||
pt->y = pt->y + fromRect.top - toRect.top;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMacControl::SetRect( Rect *r )
|
void wxMacControl::SetRect( Rect *r )
|
||||||
{
|
{
|
||||||
#if TARGET_API_MAC_OSX
|
|
||||||
if ( m_isCompositing )
|
|
||||||
{
|
|
||||||
//A HIRect is actually a CGRect on OSX - which consists of two structures -
|
//A HIRect is actually a CGRect on OSX - which consists of two structures -
|
||||||
//CGPoint and CGSize, which have two floats each
|
//CGPoint and CGSize, which have two floats each
|
||||||
HIRect hir = { { r->left , r->top }, { r->right - r->left , r->bottom - r->top } };
|
HIRect hir = { { r->left , r->top }, { r->right - r->left , r->bottom - r->top } };
|
||||||
HIViewSetFrame ( m_controlRef , &hir );
|
HIViewSetFrame ( m_controlRef , &hir );
|
||||||
// eventuall we might have to do a SetVisibility( false , true );
|
// eventuall we might have to do a SetVisibility( false , true );
|
||||||
// before and a SetVisibility( true , true ); after
|
// before and a SetVisibility( true , true ); after
|
||||||
}
|
}
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
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 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxMacControl::GetRect( Rect *r )
|
void wxMacControl::GetRect( Rect *r )
|
||||||
{
|
{
|
||||||
GetControlBounds( m_controlRef , r );
|
GetControlBounds( m_controlRef , r );
|
||||||
if ( !m_isCompositing )
|
|
||||||
{
|
|
||||||
// correct the case of the root control
|
|
||||||
if ( m_isRootControl )
|
|
||||||
{
|
|
||||||
WindowRef wr = GetControlOwner( m_controlRef );
|
|
||||||
GetWindowBounds( wr , kWindowContentRgn , r );
|
|
||||||
r->right -= r->left;
|
|
||||||
r->bottom -= r->top;
|
|
||||||
r->left = 0;
|
|
||||||
r->top = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
wxMacControl* parent = m_peer->GetParent()->GetPeer();
|
|
||||||
if ( !parent->m_isRootControl )
|
|
||||||
{
|
|
||||||
Rect superRect;
|
|
||||||
GetControlBounds( parent->m_controlRef , &superRect );
|
|
||||||
OffsetRect( r , -superRect.left , -superRect.top );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMacControl::GetRectInWindowCoords( Rect *r )
|
void wxMacControl::GetRectInWindowCoords( Rect *r )
|
||||||
@@ -1330,18 +1190,6 @@ void wxMacControl::GetFeatures( UInt32 * features )
|
|||||||
OSStatus wxMacControl::GetRegion( ControlPartCode partCode , RgnHandle region )
|
OSStatus wxMacControl::GetRegion( ControlPartCode partCode , RgnHandle region )
|
||||||
{
|
{
|
||||||
OSStatus err = GetControlRegion( m_controlRef , partCode , region );
|
OSStatus err = GetControlRegion( m_controlRef , partCode , region );
|
||||||
if ( !m_isCompositing )
|
|
||||||
{
|
|
||||||
if ( !m_isRootControl )
|
|
||||||
{
|
|
||||||
Rect r;
|
|
||||||
|
|
||||||
GetControlBounds(m_controlRef, &r );
|
|
||||||
if ( !EmptyRgn( region ) )
|
|
||||||
OffsetRgn( region , -r.left , -r.top );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1391,28 +1239,8 @@ void wxMacControl::ScrollRect( wxRect *r , int dx , int dy )
|
|||||||
{
|
{
|
||||||
wxASSERT( r != NULL );
|
wxASSERT( r != NULL );
|
||||||
|
|
||||||
#if TARGET_API_MAC_OSX
|
HIRect scrollarea = CGRectMake( r->x , r->y , r->width , r->height);
|
||||||
if ( m_isCompositing )
|
HIViewScrollRect ( m_controlRef , &scrollarea , dx ,dy );
|
||||||
{
|
|
||||||
HIRect scrollarea = CGRectMake( r->x , r->y , r->width , r->height);
|
|
||||||
HIViewScrollRect ( m_controlRef , &scrollarea , dx ,dy );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
Rect bounds;
|
|
||||||
|
|
||||||
GetControlBounds( m_controlRef , &bounds );
|
|
||||||
bounds.left += r->x;
|
|
||||||
bounds.top += r->y;
|
|
||||||
bounds.bottom = bounds.top + r->height;
|
|
||||||
bounds.right = bounds.left + r->width;
|
|
||||||
wxMacWindowClipper clip( m_peer );
|
|
||||||
RgnHandle updateRgn = NewRgn();
|
|
||||||
::ScrollRect( &bounds , dx , dy , updateRgn );
|
|
||||||
InvalWindowRgn( GetControlOwner( m_controlRef ) , updateRgn );
|
|
||||||
DisposeRgn( updateRgn );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
OSType wxMacCreator = 'WXMC';
|
OSType wxMacCreator = 'WXMC';
|
||||||
|
Reference in New Issue
Block a user