reintroducing non-composited functionality due to DataBrowser Bugs under 10.2

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32396 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2005-02-27 09:10:52 +00:00
parent 9b89f11ad8
commit 789ae0cfa2
8 changed files with 264 additions and 214 deletions

View File

@@ -300,6 +300,12 @@ bool wxCheckListBox::Create(wxWindow *parent, wxWindowID id,
#endif #endif
m_peer->SetCallbacks( &callbacks); m_peer->SetCallbacks( &callbacks);
#if 0
// shouldn't be necessary anymore under 10.2
m_peer->SetData( kControlNoPart, kControlDataBrowserIncludesFrameAndFocusTag, (Boolean) false ) ;
m_peer->SetNeedsFocusRect( true ) ;
#endif
MacPostControlCreate(pos,size) ; MacPostControlCreate(pos,size) ;
for ( int i = 0 ; i < n ; i++ ) for ( int i = 0 ; i < n ; i++ )

View File

@@ -482,7 +482,7 @@ pascal OSErr wxMacWindowDragTrackingHandler(DragTrackingMessage theMessage, Wind
// wxPoint point(localMouse.h , localMouse.v) ; // wxPoint point(localMouse.h , localMouse.v) ;
wxWindow *win = NULL ; wxWindow *win = NULL ;
ControlPartCode controlPart ; ControlPartCode controlPart ;
ControlRef control = wxMacFindControlUnderMouse( localMouse , ControlRef control = wxMacFindControlUnderMouse( toplevel , localMouse ,
theWindow , &controlPart ) ; theWindow , &controlPart ) ;
if ( control ) if ( control )
win = wxFindControlFromMacControl( control ) ; win = wxFindControlFromMacControl( control ) ;

View File

@@ -48,6 +48,10 @@ const short kTextColumnId = 1024 ;
// we just introduce id s corresponding // we just introduce id s corresponding
// to the line number // to the line number
DataBrowserItemDataUPP gDataBrowserItemDataUPP = NULL ;
DataBrowserItemNotificationUPP gDataBrowserItemNotificationUPP = NULL ;
DataBrowserDrawItemUPP gDataBrowserDrawItemUPP = NULL ;
#if TARGET_API_MAC_OSX #if TARGET_API_MAC_OSX
static pascal void DataBrowserItemNotificationProc(ControlRef browser, DataBrowserItemID itemID, static pascal void DataBrowserItemNotificationProc(ControlRef browser, DataBrowserItemID itemID,
DataBrowserItemNotification message, DataBrowserItemDataRef itemData) DataBrowserItemNotification message, DataBrowserItemDataRef itemData)
@@ -137,6 +141,34 @@ static pascal OSStatus ListBoxGetSetItemData(ControlRef browser,
return err; return err;
} }
static pascal void ListBoxDrawProc( ControlRef browser , DataBrowserItemID item , DataBrowserPropertyID property ,
DataBrowserItemState itemState , const Rect *itemRect , SInt16 depth , Boolean isColorDevice )
{
CFStringRef cfString;
long systemVersion;
cfString = CFStringCreateWithFormat( NULL, NULL, CFSTR("Row %d"), item );
ThemeDrawingState themeState ;
GetThemeDrawingState( &themeState ) ;
if ( itemState == kDataBrowserItemIsSelected ) // In this sample we handle the "selected" state, all others fall through to our "active" state
{
Gestalt( gestaltSystemVersion, &systemVersion );
if ( (systemVersion >= 0x00001030) && (IsControlActive( browser ) == false) ) // Panther DB starts using kThemeBrushSecondaryHighlightColor for inactive browser hilighting
SetThemePen( kThemeBrushSecondaryHighlightColor, 32, true );
else
SetThemePen( kThemeBrushPrimaryHighlightColor, 32, true );
PaintRect( itemRect ); // First paint the hilite rect, then the text on top
SetThemeDrawingState( themeState , false ) ;
}
DrawThemeTextBox( cfString, kThemeApplicationFont, kThemeStateActive, true, itemRect, teFlushDefault, NULL );
if ( cfString != NULL )
CFRelease( cfString );
SetThemeDrawingState( themeState , true ) ;
}
// Listbox item // Listbox item
wxListBox::wxListBox() wxListBox::wxListBox()
@@ -200,6 +232,32 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
} }
verify_noerr(m_peer->SetSelectionFlags( options ) ); verify_noerr(m_peer->SetSelectionFlags( options ) );
if ( gDataBrowserItemDataUPP == NULL ) gDataBrowserItemDataUPP = NewDataBrowserItemDataUPP(ListBoxGetSetItemData) ;
if ( gDataBrowserItemNotificationUPP == NULL )
{
gDataBrowserItemNotificationUPP =
#if TARGET_API_MAC_OSX
(DataBrowserItemNotificationUPP) NewDataBrowserItemNotificationWithItemUPP(DataBrowserItemNotificationProc) ;
#else
NewDataBrowserItemNotificationUPP(DataBrowserItemNotificationProc) ;
#endif
}
if ( gDataBrowserDrawItemUPP == NULL ) gDataBrowserDrawItemUPP = NewDataBrowserDrawItemUPP(ListBoxDrawProc) ;
DataBrowserCallbacks callbacks ;
InitializeDataBrowserCallbacks( &callbacks , kDataBrowserLatestCallbacks ) ;
callbacks.u.v1.itemDataCallback = gDataBrowserItemDataUPP;
callbacks.u.v1.itemNotificationCallback = gDataBrowserItemNotificationUPP;
m_peer->SetCallbacks( &callbacks);
DataBrowserCustomCallbacks customCallbacks ;
InitializeDataBrowserCustomCallbacks( &customCallbacks , kDataBrowserLatestCustomCallbacks ) ;
customCallbacks.u.v1.drawItemCallback = gDataBrowserDrawItemUPP ;
SetDataBrowserCustomCallbacks( m_peer->GetControlRef() , &customCallbacks ) ;
DataBrowserListViewColumnDesc columnDesc ; DataBrowserListViewColumnDesc columnDesc ;
columnDesc.headerBtnDesc.titleOffset = 0; columnDesc.headerBtnDesc.titleOffset = 0;
columnDesc.headerBtnDesc.version = kDataBrowserListViewLatestHeaderDesc; columnDesc.headerBtnDesc.version = kDataBrowserListViewLatestHeaderDesc;
@@ -208,7 +266,6 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
kControlUseFontMask | kControlUseJustMask; kControlUseFontMask | kControlUseJustMask;
columnDesc.headerBtnDesc.btnContentInfo.contentType = kControlNoContent; columnDesc.headerBtnDesc.btnContentInfo.contentType = kControlNoContent;
columnDesc.propertyDesc.propertyType = kDataBrowserTextType;
columnDesc.headerBtnDesc.btnFontStyle.just = teFlushDefault; columnDesc.headerBtnDesc.btnFontStyle.just = teFlushDefault;
columnDesc.headerBtnDesc.minimumWidth = 0; columnDesc.headerBtnDesc.minimumWidth = 0;
columnDesc.headerBtnDesc.maximumWidth = 10000; columnDesc.headerBtnDesc.maximumWidth = 10000;
@@ -218,41 +275,25 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
columnDesc.headerBtnDesc.titleString = NULL ; // CFSTR( "" ); columnDesc.headerBtnDesc.titleString = NULL ; // CFSTR( "" );
columnDesc.propertyDesc.propertyID = kTextColumnId; columnDesc.propertyDesc.propertyID = kTextColumnId;
columnDesc.propertyDesc.propertyType = kDataBrowserTextType; columnDesc.propertyDesc.propertyType = kDataBrowserTextType ; // kDataBrowserCustomType;
columnDesc.propertyDesc.propertyFlags = columnDesc.propertyDesc.propertyFlags =
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2 #if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
kDataBrowserListViewTypeSelectColumn | kDataBrowserListViewTypeSelectColumn |
#endif #endif
kDataBrowserTableViewSelectionColumn ; kDataBrowserTableViewSelectionColumn ;
verify_noerr(m_peer->AddListViewColumn( &columnDesc, kDataBrowserListViewAppendColumn) ) ; verify_noerr(m_peer->AddListViewColumn( &columnDesc, kDataBrowserListViewAppendColumn) ) ;
verify_noerr(m_peer->AutoSizeListViewColumns() ) ; verify_noerr(m_peer->AutoSizeListViewColumns() ) ;
verify_noerr(m_peer->SetHasScrollBars(false , true ) ) ; verify_noerr(m_peer->SetHasScrollBars(false , true ) ) ;
verify_noerr(m_peer->SetTableViewHiliteStyle(kDataBrowserTableViewFillHilite ) ) ; verify_noerr(m_peer->SetTableViewHiliteStyle(kDataBrowserTableViewFillHilite ) ) ;
verify_noerr(m_peer->SetListViewHeaderBtnHeight( 0 ) ) ; verify_noerr(m_peer->SetListViewHeaderBtnHeight( 0 ) ) ;
DataBrowserCallbacks callbacks ;
callbacks.version = kDataBrowserLatestCallbacks; #if 0
// shouldn't be necessary anymore under 10.2
InitDataBrowserCallbacks(&callbacks);
callbacks.u.v1.itemDataCallback =
NewDataBrowserItemDataUPP(ListBoxGetSetItemData);
callbacks.u.v1.itemNotificationCallback =
#if TARGET_API_MAC_OSX
(DataBrowserItemNotificationUPP) NewDataBrowserItemNotificationWithItemUPP(DataBrowserItemNotificationProc) ;
#else
NewDataBrowserItemNotificationUPP(DataBrowserItemNotificationProc) ;
#endif
m_peer->SetCallbacks( &callbacks);
#if TARGET_API_MAC_OSX
// there is a redraw bug in 10.2.X
if ( UMAGetSystemVersion() < 0x1030 )
m_peer->SetData( kControlNoPart, kControlDataBrowserIncludesFrameAndFocusTag, (Boolean) false ) ; m_peer->SetData( kControlNoPart, kControlDataBrowserIncludesFrameAndFocusTag, (Boolean) false ) ;
m_peer->SetNeedsFocusRect( true ) ;
#endif #endif
MacPostControlCreate(pos,size) ; MacPostControlCreate(pos,size) ;
for ( int i = 0 ; i < n ; i++ ) for ( int i = 0 ; i < n ; i++ )

View File

@@ -214,7 +214,7 @@ public :
class wxMacMLTEControl : public wxMacTextControl class wxMacMLTEControl : public wxMacTextControl
{ {
public : public :
wxMacMLTEControl( wxTextCtrl *peer ) : wxMacTextControl( peer ) {} wxMacMLTEControl( wxTextCtrl *peer ) ;
virtual wxString GetStringValue() const ; virtual wxString GetStringValue() const ;
virtual void SetStringValue( const wxString &str) ; virtual void SetStringValue( const wxString &str) ;
@@ -271,7 +271,6 @@ public :
const wxSize& size, long style ) ; const wxSize& size, long style ) ;
virtual OSStatus SetFocus( ControlFocusPart focusPart ) ; virtual OSStatus SetFocus( ControlFocusPart focusPart ) ;
virtual bool HasFocus() const ; virtual bool HasFocus() const ;
virtual bool NeedsFocusRect() const;
protected : protected :
HIViewRef m_scrollView ; HIViewRef m_scrollView ;
HIViewRef m_textView ; HIViewRef m_textView ;
@@ -318,7 +317,6 @@ public :
~wxMacMLTEClassicControl() ; ~wxMacMLTEClassicControl() ;
virtual void VisibilityChanged(bool shown) ; virtual void VisibilityChanged(bool shown) ;
virtual void SuperChangedPosition() ; virtual void SuperChangedPosition() ;
virtual bool NeedsFocusRect() const;
virtual void MacControlUserPaneDrawProc(wxInt16 part) ; virtual void MacControlUserPaneDrawProc(wxInt16 part) ;
virtual wxInt16 MacControlUserPaneHitTestProc(wxInt16 x, wxInt16 y) ; virtual wxInt16 MacControlUserPaneHitTestProc(wxInt16 x, wxInt16 y) ;
@@ -1377,6 +1375,11 @@ public :
TXNControlData m_data[1] ; TXNControlData m_data[1] ;
} ; } ;
wxMacMLTEControl::wxMacMLTEControl( wxTextCtrl *peer ) : wxMacTextControl( peer )
{
SetNeedsFocusRect( true ) ;
}
wxString wxMacMLTEControl::GetStringValue() const wxString wxMacMLTEControl::GetStringValue() const
{ {
wxString result ; wxString result ;
@@ -2092,7 +2095,13 @@ void wxMacMLTEClassicControl::MacFocusPaneText(Boolean setFocus)
void wxMacMLTEClassicControl::MacSetObjectVisibility(Boolean vis) void wxMacMLTEClassicControl::MacSetObjectVisibility(Boolean vis)
{ {
ControlRef controlFocus = 0 ;
GetKeyboardFocus( m_txnWindow , &controlFocus ) ;
if ( controlFocus == m_controlRef && vis == false )
{
SetKeyboardFocus( m_txnWindow , m_controlRef , kControlFocusNoPart ) ;
}
// we right now are always clipping as partial visibility (overlapped) visibility // we right now are always clipping as partial visibility (overlapped) visibility
// is also a problem, if we run into further problems we might set the FrameBounds to an empty // is also a problem, if we run into further problems we might set the FrameBounds to an empty
// rect here // rect here
@@ -2117,6 +2126,7 @@ void wxMacMLTEClassicControl::MacUpdatePosition()
wxMacWindowClipper cl(textctrl) ; wxMacWindowClipper cl(textctrl) ;
#ifdef __WXMAC_OSX__ #ifdef __WXMAC_OSX__
bool isCompositing = textctrl->MacGetTopLevelWindow()->MacUsesCompositing() ;
if ( m_sbHorizontal || m_sbVertical ) if ( m_sbHorizontal || m_sbVertical )
{ {
int w = bounds.right - bounds.left ; int w = bounds.right - bounds.left ;
@@ -2130,6 +2140,10 @@ void wxMacMLTEClassicControl::MacUpdatePosition()
sbBounds.top = h - 14 ; sbBounds.top = h - 14 ;
sbBounds.right = w + 1 ; sbBounds.right = w + 1 ;
sbBounds.bottom = h + 1 ; sbBounds.bottom = h + 1 ;
if ( !isCompositing )
OffsetRect( &sbBounds , m_txnControlBounds.left , m_txnControlBounds.top ) ;
SetControlBounds( m_sbHorizontal , &sbBounds ) ; SetControlBounds( m_sbHorizontal , &sbBounds ) ;
SetControlViewSize( m_sbHorizontal , w ) ; SetControlViewSize( m_sbHorizontal , w ) ;
} }
@@ -2142,6 +2156,9 @@ void wxMacMLTEClassicControl::MacUpdatePosition()
sbBounds.right = w + 1 ; sbBounds.right = w + 1 ;
sbBounds.bottom = m_sbHorizontal ? h - 14 : h + 1 ; sbBounds.bottom = m_sbHorizontal ? h - 14 : h + 1 ;
if ( !isCompositing )
OffsetRect( &sbBounds , m_txnControlBounds.left , m_txnControlBounds.top ) ;
SetControlBounds( m_sbVertical , &sbBounds ) ; SetControlBounds( m_sbVertical , &sbBounds ) ;
SetControlViewSize( m_sbVertical , h ) ; SetControlViewSize( m_sbVertical , h ) ;
} }
@@ -2392,11 +2409,6 @@ void wxMacMLTEClassicControl::SuperChangedPosition()
wxMacControl::SuperChangedPosition() ; wxMacControl::SuperChangedPosition() ;
} }
bool wxMacMLTEClassicControl::NeedsFocusRect() const
{
return true;
}
#ifdef __WXMAC_OSX__ #ifdef __WXMAC_OSX__
ControlUserPaneDrawUPP gTPDrawProc = NULL; ControlUserPaneDrawUPP gTPDrawProc = NULL;
@@ -2650,11 +2662,6 @@ bool wxMacMLTEHIViewControl::HasFocus() const
return control == m_textView ; return control == m_textView ;
} }
bool wxMacMLTEHIViewControl::NeedsFocusRect() const
{
return m_windowStyle & wxNO_BORDER ? false : true;
}
#endif // MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2 #endif // MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2

View File

@@ -240,20 +240,21 @@ void wxToolBarTool::SetPosition(const wxPoint& position)
m_x = position.x; m_x = position.x;
m_y = position.y; m_y = position.y;
if ( IsButton() )
{
int x , y ; int x , y ;
x = y = 0 ; x = y = 0 ;
int mac_x = position.x ; int mac_x = position.x ;
int mac_y = position.y ; int mac_y = position.y ;
#ifdef __WXMAC_OSX__
// already correctly set up if ( ! GetToolBar()->MacGetTopLevelWindow()->MacUsesCompositing() )
#else {
WindowRef rootwindow = (WindowRef) GetToolBar()->MacGetTopLevelWindowRef() ; WindowRef rootwindow = (WindowRef) GetToolBar()->MacGetTopLevelWindowRef() ;
GetToolBar()->MacWindowToRootWindow( &x , &y ) ; GetToolBar()->MacWindowToRootWindow( &x , &y ) ;
mac_x += x; mac_x += x;
mac_y += y; mac_y += y;
#endif }
if ( IsButton() )
{
Rect contrlRect ; Rect contrlRect ;
GetControlBounds( m_controlHandle , &contrlRect ) ; GetControlBounds( m_controlHandle , &contrlRect ) ;
int former_mac_x = contrlRect.left ; int former_mac_x = contrlRect.left ;
@@ -273,11 +274,6 @@ void wxToolBarTool::SetPosition(const wxPoint& position)
{ {
// separator // separator
#ifdef __WXMAC_OSX__ #ifdef __WXMAC_OSX__
int x , y ;
x = y = 0 ;
int mac_x = position.x ;
int mac_y = position.y ;
Rect contrlRect ; Rect contrlRect ;
GetControlBounds( m_controlHandle , &contrlRect ) ; GetControlBounds( m_controlHandle , &contrlRect ) ;
int former_mac_x = contrlRect.left ; int former_mac_x = contrlRect.left ;

View File

@@ -359,7 +359,7 @@ static void SetupMouseEvent( wxMouseEvent &wxevent , wxMacCarbonEvent &cEvent )
} }
} }
ControlRef wxMacFindSubControl( Point location , ControlRef superControl , ControlPartCode *outPart ) ControlRef wxMacFindSubControl( wxTopLevelWindowMac* toplevelWindow, Point location , ControlRef superControl , ControlPartCode *outPart )
{ {
if ( superControl ) if ( superControl )
{ {
@@ -383,16 +383,19 @@ ControlRef wxMacFindSubControl( Point location , ControlRef superControl , Contr
UMAGetControlBoundsInWindowCoords( sibling , &r ) ; UMAGetControlBoundsInWindowCoords( sibling , &r ) ;
if ( MacPtInRect( location , &r ) ) if ( MacPtInRect( location , &r ) )
{ {
ControlHandle child = wxMacFindSubControl( location , sibling , outPart ) ; ControlHandle child = wxMacFindSubControl( toplevelWindow , location , sibling , outPart ) ;
if ( child ) if ( child )
return child ; return child ;
else else
{ {
Point testLocation = location ; Point testLocation = location ;
#if TARGET_API_MAC_OSX
if ( toplevelWindow && toplevelWindow->MacUsesCompositing() )
{
testLocation.h -= r.left ; testLocation.h -= r.left ;
testLocation.v -= r.top ; testLocation.v -= r.top ;
#endif }
*outPart = TestControl( sibling , testLocation ) ; *outPart = TestControl( sibling , testLocation ) ;
return sibling ; return sibling ;
} }
@@ -403,19 +406,20 @@ ControlRef wxMacFindSubControl( Point location , ControlRef superControl , Contr
return NULL ; return NULL ;
} }
ControlRef wxMacFindControlUnderMouse( Point location , WindowRef window , ControlPartCode *outPart ) ControlRef wxMacFindControlUnderMouse( wxTopLevelWindowMac* toplevelWindow , Point location , WindowRef window , ControlPartCode *outPart )
{ {
#if TARGET_API_MAC_OSX #if TARGET_API_MAC_OSX
if ( UMAGetSystemVersion() >= 0x1030 ) if ( UMAGetSystemVersion() >= 0x1030 && ( toplevelWindow == 0 || toplevelWindow->MacUsesCompositing() ) )
return FindControlUnderMouse( location , window , outPart ) ; return FindControlUnderMouse( location , window , outPart ) ;
#endif #endif
ControlRef rootControl = NULL ; ControlRef rootControl = NULL ;
verify_noerr( GetRootControl( window , &rootControl ) ) ; verify_noerr( GetRootControl( window , &rootControl ) ) ;
return wxMacFindSubControl( location , rootControl , outPart ) ; return wxMacFindSubControl( toplevelWindow , location , rootControl , outPart ) ;
} }
pascal OSStatus wxMacTopLevelMouseEventHandler( EventHandlerCallRef handler , EventRef event , void *data ) pascal OSStatus wxMacTopLevelMouseEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
{ {
wxTopLevelWindowMac* toplevelWindow = (wxTopLevelWindowMac*) data ;
OSStatus result = eventNotHandledErr ; OSStatus result = eventNotHandledErr ;
@@ -441,7 +445,7 @@ pascal OSStatus wxMacTopLevelMouseEventHandler( EventHandlerCallRef handler , Ev
else if ( (IsWindowActive(window) && windowPart == inContent) ) else if ( (IsWindowActive(window) && windowPart == inContent) )
{ {
ControlPartCode part ; ControlPartCode part ;
control = wxMacFindControlUnderMouse( windowMouseLocation , window , &part ) ; control = wxMacFindControlUnderMouse( toplevelWindow , windowMouseLocation , window , &part ) ;
// if there is no control below the mouse position, send the event to the toplevel window itself // if there is no control below the mouse position, send the event to the toplevel window itself
if ( control == 0 ) if ( control == 0 )
currentMouseWindow = (wxWindow*) data ; currentMouseWindow = (wxWindow*) data ;
@@ -549,7 +553,7 @@ pascal OSStatus wxMacTopLevelMouseEventHandler( EventHandlerCallRef handler , Ev
#ifdef __WXMAC_OSX__ #ifdef __WXMAC_OSX__
&& &&
(FindControlUnderMouse(windowMouseLocation , window , &dummyPart) != (FindControlUnderMouse(windowMouseLocation , window , &dummyPart) !=
wxMacFindControlUnderMouse( windowMouseLocation , window , &dummyPart ) ) wxMacFindControlUnderMouse( toplevelWindow , windowMouseLocation , window , &dummyPart ) )
#endif #endif
) )
{ {
@@ -557,9 +561,10 @@ pascal OSStatus wxMacTopLevelMouseEventHandler( EventHandlerCallRef handler , Ev
{ {
EventModifiers modifiers = cEvent.GetParameter<EventModifiers>(kEventParamKeyModifiers, typeUInt32) ; EventModifiers modifiers = cEvent.GetParameter<EventModifiers>(kEventParamKeyModifiers, typeUInt32) ;
Point clickLocation = windowMouseLocation ; Point clickLocation = windowMouseLocation ;
#if TARGET_API_MAC_OSX
if ( toplevelWindow->MacUsesCompositing() )
currentMouseWindow->MacRootWindowToWindow( &clickLocation.h , &clickLocation.v ) ; currentMouseWindow->MacRootWindowToWindow( &clickLocation.h , &clickLocation.v ) ;
#endif
HandleControlClick( (ControlRef) currentMouseWindow->GetHandle() , clickLocation , HandleControlClick( (ControlRef) currentMouseWindow->GetHandle() , clickLocation ,
modifiers , (ControlActionUPP ) -1 ) ; modifiers , (ControlActionUPP ) -1 ) ;
@@ -594,12 +599,13 @@ pascal OSStatus wxMacTopLevelMouseEventHandler( EventHandlerCallRef handler , Ev
// don't mess with controls we don't know about // don't mess with controls we don't know about
// for some reason returning eventNotHandledErr does not lead to the correct behaviour // for some reason returning eventNotHandledErr does not lead to the correct behaviour
// so we try sending them the correct control directly // so we try sending them the correct control directly
wxTopLevelWindowMac* toplevelWindow = (wxTopLevelWindowMac*) data ;
if ( cEvent.GetKind() == kEventMouseDown && toplevelWindow && control ) if ( cEvent.GetKind() == kEventMouseDown && toplevelWindow && control )
{ {
EventModifiers modifiers = cEvent.GetParameter<EventModifiers>(kEventParamKeyModifiers, typeUInt32) ; EventModifiers modifiers = cEvent.GetParameter<EventModifiers>(kEventParamKeyModifiers, typeUInt32) ;
Point clickLocation = windowMouseLocation ; Point clickLocation = windowMouseLocation ;
#if TARGET_API_MAC_OSX if ( toplevelWindow->MacUsesCompositing() )
{
#ifdef __WXMAC_OSX__
HIPoint hiPoint ; HIPoint hiPoint ;
hiPoint.x = clickLocation.h ; hiPoint.x = clickLocation.h ;
hiPoint.y = clickLocation.v ; hiPoint.y = clickLocation.v ;
@@ -607,6 +613,7 @@ pascal OSStatus wxMacTopLevelMouseEventHandler( EventHandlerCallRef handler , Ev
clickLocation.h = (int)hiPoint.x ; clickLocation.h = (int)hiPoint.x ;
clickLocation.v = (int)hiPoint.y ; clickLocation.v = (int)hiPoint.y ;
#endif #endif
}
HandleControlClick( control , clickLocation , HandleControlClick( control , clickLocation ,
modifiers , (ControlActionUPP ) -1 ) ; modifiers , (ControlActionUPP ) -1 ) ;
result = noErr ; result = noErr ;
@@ -843,10 +850,15 @@ void wxTopLevelWindowMac::Init()
m_maximizeOnShow = FALSE; m_maximizeOnShow = FALSE;
m_macWindow = NULL ; m_macWindow = NULL ;
#if TARGET_API_MAC_OSX #if TARGET_API_MAC_OSX
if ( UMAGetSystemVersion() >= 0x1030 )
{
m_macUsesCompositing = TRUE; m_macUsesCompositing = TRUE;
#else }
m_macUsesCompositing = FALSE; else
#endif #endif
{
m_macUsesCompositing = FALSE;
}
m_macEventHandler = NULL ; m_macEventHandler = NULL ;
m_macFullScreenData = NULL ; m_macFullScreenData = NULL ;
} }
@@ -1052,10 +1064,8 @@ void wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title,
else if ( HasFlag( wxFRAME_DRAWER ) ) else if ( HasFlag( wxFRAME_DRAWER ) )
{ {
wclass = kDrawerWindowClass; wclass = kDrawerWindowClass;
// Should this be left for compositing check below? // we must force compositing on a drawer
// CreateNewWindow will fail without it, should wxDrawerWindow turn m_macUsesCompositing = TRUE ;
// on compositing before calling MacCreateRealWindow?
attr |= kWindowCompositingAttribute;// | kWindowStandardHandlerAttribute;
} }
#endif //10.2 and up #endif //10.2 and up
else else
@@ -1100,6 +1110,7 @@ void wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title,
} }
#if TARGET_API_MAC_OSX #if TARGET_API_MAC_OSX
if ( m_macUsesCompositing )
attr |= kWindowCompositingAttribute; attr |= kWindowCompositingAttribute;
#endif #endif
@@ -1131,6 +1142,9 @@ void wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title,
UMASetWTitle( (WindowRef) m_macWindow , title , m_font.GetEncoding() ) ; UMASetWTitle( (WindowRef) m_macWindow , title , m_font.GetEncoding() ) ;
m_peer = new wxMacControl(this) ; m_peer = new wxMacControl(this) ;
#if TARGET_API_MAC_OSX #if TARGET_API_MAC_OSX
if ( m_macUsesCompositing )
{
// There is a bug in 10.2.X for ::GetRootControl returning the window view instead of // There is a bug in 10.2.X for ::GetRootControl returning the window view instead of
// the content view, so we have to retrieve it explicitely // the content view, so we have to retrieve it explicitely
HIViewFindByID( HIViewGetRoot( (WindowRef) m_macWindow ) , kHIViewWindowContentID , HIViewFindByID( HIViewGetRoot( (WindowRef) m_macWindow ) , kHIViewWindowContentID ,
@@ -1140,9 +1154,11 @@ void wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title,
// compatibility mode fallback // compatibility mode fallback
GetRootControl( (WindowRef) m_macWindow , m_peer->GetControlRefAddr() ) ; GetRootControl( (WindowRef) m_macWindow , m_peer->GetControlRefAddr() ) ;
} }
#else }
::CreateRootControl( (WindowRef)m_macWindow , m_peer->GetControlRefAddr() ) ;
#endif #endif
{
::CreateRootControl( (WindowRef)m_macWindow , m_peer->GetControlRefAddr() ) ;
}
// the root control level handleer // the root control level handleer
MacInstallEventHandler( (WXWidget) m_peer->GetControlRef() ) ; MacInstallEventHandler( (WXWidget) m_peer->GetControlRef() ) ;
@@ -1361,9 +1377,7 @@ void wxTopLevelWindowMac::DoGetClientSize( int *width, int *height ) const
void wxTopLevelWindowMac::MacSetMetalAppearance( bool set ) void wxTopLevelWindowMac::MacSetMetalAppearance( bool set )
{ {
#if TARGET_API_MAC_OSX #if TARGET_API_MAC_OSX
UInt32 attr = 0 ; wxASSERT_MSG( m_macUsesCompositing ,
GetWindowAttributes((WindowRef) m_macWindow , &attr ) ;
wxASSERT_MSG( attr & kWindowCompositingAttribute ,
wxT("Cannot set metal appearance on a non-compositing window") ) ; wxT("Cannot set metal appearance on a non-compositing window") ) ;
MacChangeWindowAttributes( set ? kWindowMetalAttribute : kWindowNoAttributes , MacChangeWindowAttributes( set ? kWindowMetalAttribute : kWindowNoAttributes ,

View File

@@ -790,18 +790,18 @@ OSStatus UMAPutScrap( Size size , OSType type , void *data )
Rect* UMAGetControlBoundsInWindowCoords(ControlRef theControl, Rect *bounds) Rect* UMAGetControlBoundsInWindowCoords(ControlRef theControl, Rect *bounds)
{ {
// wxWindow* win = wxFindControlFromMacControl( theControl ) ;
GetControlBounds( theControl , bounds ) ; GetControlBounds( theControl , bounds ) ;
#if TARGET_API_MAC_OSX #if TARGET_API_MAC_OSX
WindowRef tlwref = GetControlOwner( theControl ) ; WindowRef tlwref = GetControlOwner( theControl ) ;
wxWindow* tlwwx = (wxWindow*) wxFindWinFromMacWindow( tlwref ) ;
wxTopLevelWindowMac* tlwwx = wxFindWinFromMacWindow( tlwref ) ;
if ( tlwwx->MacUsesCompositing() )
{
ControlRef rootControl = tlwwx->GetPeer()->GetControlRef() ; ControlRef rootControl = tlwwx->GetPeer()->GetControlRef() ;
HIPoint hiPoint = CGPointMake( 0 , 0 ) ; HIPoint hiPoint = CGPointMake( 0 , 0 ) ;
HIViewConvertPoint( &hiPoint , HIViewGetSuperview(theControl) , rootControl ) ; HIViewConvertPoint( &hiPoint , HIViewGetSuperview(theControl) , rootControl ) ;
OffsetRect( bounds , (short) (hiPoint.x) , (short) (hiPoint.y) ) ; OffsetRect( bounds , (short) hiPoint.x , (short) hiPoint.y ) ;
}
#endif #endif
return bounds ; return bounds ;
} }

View File

@@ -201,7 +201,7 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl
RgnHandle updateRgn = NULL ; RgnHandle updateRgn = NULL ;
RgnHandle allocatedRgn = NULL ; RgnHandle allocatedRgn = NULL ;
wxRegion visRegion = thisWindow->MacGetVisibleRegion() ; wxRegion visRegion = thisWindow->MacGetVisibleRegion() ;
if ( cEvent.GetParameter<RgnHandle>(kEventParamRgnHandle, &updateRgn) != noErr ) if ( thisWindow->MacGetTopLevelWindow()->MacUsesCompositing() == false || cEvent.GetParameter<RgnHandle>(kEventParamRgnHandle, &updateRgn) != noErr )
{ {
updateRgn = (RgnHandle) visRegion.GetWXHRGN() ; updateRgn = (RgnHandle) visRegion.GetWXHRGN() ;
} }
@@ -1175,6 +1175,8 @@ bool wxWindowMac::MacGetBoundsForControl(const wxPoint& pos,
int& x, int& y, int& x, int& y,
int& w, int& h , bool adjustOrigin ) const int& w, int& h , bool adjustOrigin ) const
{ {
bool isCompositing = MacGetTopLevelWindow()->MacUsesCompositing() ;
// the desired size, minus the border pixels gives the correct size of the control // the desired size, minus the border pixels gives the correct size of the control
x = (int)pos.x; x = (int)pos.x;
@@ -1182,9 +1184,9 @@ bool wxWindowMac::MacGetBoundsForControl(const wxPoint& pos,
// todo the default calls may be used as soon as PostCreateControl Is moved here // todo the default calls may be used as soon as PostCreateControl Is moved here
w = wxMax(size.x,0) ; // WidthDefault( size.x ); w = wxMax(size.x,0) ; // WidthDefault( size.x );
h = wxMax(size.y,0) ; // HeightDefault( size.y ) ; h = wxMax(size.y,0) ; // HeightDefault( size.y ) ;
#if !TARGET_API_MAC_OSX
if ( !isCompositing )
GetParent()->MacWindowToRootWindow( &x , &y ) ; GetParent()->MacWindowToRootWindow( &x , &y ) ;
#endif
x += MacGetLeftBorderSize() ; x += MacGetLeftBorderSize() ;
y += MacGetTopBorderSize() ; y += MacGetTopBorderSize() ;
@@ -1193,14 +1195,14 @@ bool wxWindowMac::MacGetBoundsForControl(const wxPoint& pos,
if ( adjustOrigin ) if ( adjustOrigin )
AdjustForParentClientOrigin( x , y ) ; AdjustForParentClientOrigin( x , y ) ;
#if TARGET_API_MAC_OSX
// this is in window relative coordinate, as this parent may have a border, its physical position is offset by this border // this is in window relative coordinate, as this parent may have a border, its physical position is offset by this border
if ( ! GetParent()->IsTopLevel() ) if ( !GetParent()->IsTopLevel() )
{ {
x -= GetParent()->MacGetLeftBorderSize() ; x -= GetParent()->MacGetLeftBorderSize() ;
y -= GetParent()->MacGetTopBorderSize() ; y -= GetParent()->MacGetTopBorderSize() ;
} }
#endif
return true ; return true ;
} }
@@ -1222,20 +1224,22 @@ void wxWindowMac::DoGetSize(int *x, int *y) const
// get the position of the bounds of this window in client coordinates of its parent // get the position of the bounds of this window in client coordinates of its parent
void wxWindowMac::DoGetPosition(int *x, int *y) const void wxWindowMac::DoGetPosition(int *x, int *y) const
{ {
bool isCompositing = MacGetTopLevelWindow()->MacUsesCompositing() ;
int x1 , y1 , w1 ,h1 ; int x1 , y1 , w1 ,h1 ;
MacGetPositionAndSizeFromControl( x1 , y1, w1 ,h1 ) ; MacGetPositionAndSizeFromControl( x1 , y1, w1 ,h1 ) ;
x1 -= MacGetLeftBorderSize() ; x1 -= MacGetLeftBorderSize() ;
y1 -= MacGetTopBorderSize() ; y1 -= MacGetTopBorderSize() ;
// to non-client // to non-client
#if !TARGET_API_MAC_OSX
if ( !GetParent()->IsTopLevel() ) if ( !isCompositing && !GetParent()->IsTopLevel() )
{ {
Rect bounds ; Rect bounds ;
GetControlBounds( (ControlRef) GetParent()->GetHandle() , &bounds ) ; GetControlBounds( (ControlRef) GetParent()->GetHandle() , &bounds ) ;
x1 -= bounds.left ; x1 -= bounds.left ;
y1 -= bounds.top ; y1 -= bounds.top ;
} }
#endif
if ( !IsTopLevel() ) if ( !IsTopLevel() )
{ {
wxWindow *parent = GetParent(); wxWindow *parent = GetParent();
@@ -1377,6 +1381,8 @@ void wxWindowMac::MacRootWindowToWindow( short *x , short *y ) const
void wxWindowMac::MacGetContentAreaInset( int &left , int &top , int &right , int &bottom ) void wxWindowMac::MacGetContentAreaInset( int &left , int &top , int &right , int &bottom )
{ {
bool isCompositing = MacGetTopLevelWindow()->MacUsesCompositing() ;
RgnHandle rgn = NewRgn() ; RgnHandle rgn = NewRgn() ;
Rect content ; Rect content ;
if ( m_peer->GetRegion( kControlContentMetaPart , rgn ) == noErr ) if ( m_peer->GetRegion( kControlContentMetaPart , rgn ) == noErr )
@@ -1390,9 +1396,10 @@ void wxWindowMac::MacGetContentAreaInset( int &left , int &top , int &right , in
DisposeRgn( rgn ) ; DisposeRgn( rgn ) ;
Rect structure ; Rect structure ;
m_peer->GetRect( &structure ) ; m_peer->GetRect( &structure ) ;
#if !TARGET_API_MAC_OSX
if ( !isCompositing )
OffsetRect( &content , -structure.left , -structure.top ) ; OffsetRect( &content , -structure.left , -structure.top ) ;
#endif
left = content.left - structure.left ; left = content.left - structure.left ;
top = content.top - structure.top ; top = content.top - structure.top ;
right = structure.right - content.right ; right = structure.right - content.right ;
@@ -1401,6 +1408,7 @@ void wxWindowMac::MacGetContentAreaInset( int &left , int &top , int &right , in
wxSize wxWindowMac::DoGetSizeFromClientSize( const wxSize & size ) const wxSize wxWindowMac::DoGetSizeFromClientSize( const wxSize & size ) const
{ {
bool isCompositing = MacGetTopLevelWindow()->MacUsesCompositing() ;
wxSize sizeTotal = size; wxSize sizeTotal = size;
RgnHandle rgn = NewRgn() ; RgnHandle rgn = NewRgn() ;
@@ -1418,9 +1426,9 @@ wxSize wxWindowMac::DoGetSizeFromClientSize( const wxSize & size ) const
DisposeRgn( rgn ) ; DisposeRgn( rgn ) ;
Rect structure ; Rect structure ;
m_peer->GetRect( &structure ) ; m_peer->GetRect( &structure ) ;
#if !TARGET_API_MAC_OSX
if ( !isCompositing )
OffsetRect( &content , -structure.left , -structure.top ) ; OffsetRect( &content , -structure.left , -structure.top ) ;
#endif
sizeTotal.x += (structure.right - structure.left) - (content.right - content.left) ; sizeTotal.x += (structure.right - structure.left) - (content.right - content.left) ;
sizeTotal.y += (structure.bottom - structure.top) - (content.bottom - content.top ) ; sizeTotal.y += (structure.bottom - structure.top) - (content.bottom - content.top ) ;
@@ -1435,6 +1443,7 @@ wxSize wxWindowMac::DoGetSizeFromClientSize( const wxSize & size ) const
// Get size *available for subwindows* i.e. excluding menu bar etc. // Get size *available for subwindows* i.e. excluding menu bar etc.
void wxWindowMac::DoGetClientSize(int *x, int *y) const void wxWindowMac::DoGetClientSize(int *x, int *y) const
{ {
bool isCompositing = MacGetTopLevelWindow()->MacUsesCompositing() ;
int ww, hh; int ww, hh;
RgnHandle rgn = NewRgn() ; RgnHandle rgn = NewRgn() ;
@@ -1448,11 +1457,13 @@ void wxWindowMac::DoGetClientSize(int *x, int *y) const
m_peer->GetRect( &content ) ; m_peer->GetRect( &content ) ;
} }
DisposeRgn( rgn ) ; DisposeRgn( rgn ) ;
#if !TARGET_API_MAC_OSX
if ( !isCompositing )
{
Rect structure ; Rect structure ;
m_peer->GetRect( &structure ) ; m_peer->GetRect( &structure ) ;
OffsetRect( &content , -structure.left , -structure.top ) ; OffsetRect( &content , -structure.left , -structure.top ) ;
#endif }
ww = content.right - content.left ; ww = content.right - content.left ;
hh = content.bottom - content.top ; hh = content.bottom - content.top ;
/* /*
@@ -1538,7 +1549,8 @@ bool wxWindowMac::SetCursor(const wxCursor& cursor)
wxWindowMac *mouseWin = 0 ; wxWindowMac *mouseWin = 0 ;
{ {
WindowRef window = (WindowRef) MacGetTopLevelWindowRef() ; wxTopLevelWindowMac *tlw = MacGetTopLevelWindow() ;
WindowRef window = (WindowRef) ( tlw ? tlw->MacGetWindowRef() : 0 ) ;
CGrafPtr savePort ; CGrafPtr savePort ;
Boolean swapped = QDSwapPort( GetWindowPort( window ) , &savePort ) ; Boolean swapped = QDSwapPort( GetWindowPort( window ) , &savePort ) ;
@@ -1549,7 +1561,7 @@ bool wxWindowMac::SetCursor(const wxCursor& cursor)
GetMouse( &pt ) ; GetMouse( &pt ) ;
ControlPartCode part ; ControlPartCode part ;
ControlRef control ; ControlRef control ;
control = wxMacFindControlUnderMouse( pt , window , &part ) ; control = wxMacFindControlUnderMouse( tlw , pt , window , &part ) ;
if ( control ) if ( control )
mouseWin = wxFindControlFromMacControl( control ) ; mouseWin = wxFindControlFromMacControl( control ) ;
@@ -1803,13 +1815,7 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height)
MacInvalidateBorders() ; MacInvalidateBorders() ;
// the HIViewSetFrame call itself should invalidate the areas, but when testing with the UnicodeTextCtrl it does not !
if ( vis )
m_peer->SetVisibility( false , true ) ;
m_peer->SetRect( &r ) ; m_peer->SetRect( &r ) ;
if ( vis )
m_peer->SetVisibility( true , true ) ;
if ( doMove ) if ( doMove )
wxWindowMac::MacSuperChangedPosition() ; // like this only children will be notified wxWindowMac::MacSuperChangedPosition() ; // like this only children will be notified
@@ -1948,12 +1954,15 @@ void wxWindowMac::DoSetSize(int x, int y, int width, int height, int sizeFlags)
wxPoint wxWindowMac::GetClientAreaOrigin() const wxPoint wxWindowMac::GetClientAreaOrigin() const
{ {
bool isCompositing = MacGetTopLevelWindow()->MacUsesCompositing() ;
RgnHandle rgn = NewRgn() ; RgnHandle rgn = NewRgn() ;
Rect content ; Rect content ;
m_peer->GetRegion( kControlContentMetaPart , rgn ) ; m_peer->GetRegion( kControlContentMetaPart , rgn ) ;
GetRegionBounds( rgn , &content ) ; GetRegionBounds( rgn , &content ) ;
DisposeRgn( rgn ) ; DisposeRgn( rgn ) ;
#if !TARGET_API_MAC_OSX
if ( !isCompositing )
{
// if the content rgn is empty / not supported // if the content rgn is empty / not supported
// don't attempt to correct the coordinates to wxWindow relative ones // don't attempt to correct the coordinates to wxWindow relative ones
if (!::EmptyRect( &content ) ) if (!::EmptyRect( &content ) )
@@ -1962,7 +1971,7 @@ wxPoint wxWindowMac::GetClientAreaOrigin() const
m_peer->GetRect( &structure ) ; m_peer->GetRect( &structure ) ;
OffsetRect( &content , -structure.left , -structure.top ) ; OffsetRect( &content , -structure.left , -structure.top ) ;
} }
#endif }
return wxPoint( content.left + MacGetLeftBorderSize( ) , content.top + MacGetTopBorderSize( ) ); return wxPoint( content.left + MacGetLeftBorderSize( ) , content.top + MacGetTopBorderSize( ) );
} }
@@ -2187,83 +2196,62 @@ void wxWindowMac::Refresh(bool eraseBack, const wxRect *rect)
if ( m_peer == NULL ) if ( m_peer == NULL )
return ; return ;
#if TARGET_API_MAC_OSX
if ( rect == NULL ) bool isCompositing = MacGetTopLevelWindow()->MacUsesCompositing() ;
// if ( isCompositing )
{
if ( rect == NULL && isCompositing )
m_peer->SetNeedsDisplay( true ) ; m_peer->SetNeedsDisplay( true ) ;
else else
{ {
Rect controlBounds ;
m_peer->GetRect( &controlBounds ) ;
InvalWindowRect( (WindowRef) MacGetTopLevelWindowRef() , &controlBounds ) ;
/*
RgnHandle update = NewRgn() ; RgnHandle update = NewRgn() ;
if ( rect == NULL )
{
CopyRgn( (RgnHandle) MacGetVisibleRegion().GetWXHRGN() , update ) ;
}
else
{
SetRectRgn( update , rect->x , rect->y , rect->x + rect->width , rect->y + rect->height ) ; SetRectRgn( update , rect->x , rect->y , rect->x + rect->width , rect->y + rect->height ) ;
SectRgn( (RgnHandle) MacGetVisibleRegion().GetWXHRGN() , update , update ) ; SectRgn( (RgnHandle) MacGetVisibleRegion().GetWXHRGN() , update , update ) ;
}
wxPoint origin = GetClientAreaOrigin() ; wxPoint origin = GetClientAreaOrigin() ;
OffsetRgn( update, origin.x , origin.y ) ; OffsetRgn( update, origin.x , origin.y ) ;
// right now this is wx' window coordinates, as our native peer does not have borders, this is // right now this is wx' window coordinates, as our native peer does not have borders, this is
// inset // inset
if ( isCompositing )
{
OffsetRgn( update , -MacGetLeftBorderSize() , -MacGetTopBorderSize() ) ; OffsetRgn( update , -MacGetLeftBorderSize() , -MacGetTopBorderSize() ) ;
m_peer->SetNeedsDisplay( true , update) ; m_peer->SetNeedsDisplay( true , update) ;
DisposeRgn( update ) ;
}
#else
/*
RgnHandle updateRgn = NewRgn() ;
if ( rect == NULL )
{
CopyRgn( (RgnHandle) MacGetVisibleRegion().GetWXHRGN() , updateRgn ) ;
} }
else else
{ {
SetRectRgn( updateRgn , rect->x , rect->y , rect->x + rect->width , rect->y + rect->height ) ; int x = 0 ;
SectRgn( (RgnHandle) MacGetVisibleRegion().GetWXHRGN() , updateRgn , updateRgn ) ; int y = 0 ;
MacWindowToRootWindow( &x , &y ) ;
OffsetRgn( update , x , y ) ;
InvalWindowRgn( (WindowRef) MacGetTopLevelWindowRef() , update ) ;
} }
InvalWindowRgn( (WindowRef) MacGetTopLevelWindowRef() , updateRgn ) ; DisposeRgn( update ) ;
DisposeRgn(updateRgn) ; */
*/ }
}
if ( 0 )
{
if ( MacIsReallyShown() ) if ( MacIsReallyShown() )
{ {
/*
m_peer->SetVisibility( false , false ) ; m_peer->SetVisibility( false , false ) ;
m_peer->SetVisibility( true , true ) ; m_peer->SetVisibility( true , true ) ;
}
/*
if ( MacGetTopLevelWindow() == NULL )
return ;
if ( !m_peer->IsVisible())
return ;
wxPoint client = GetClientAreaOrigin();
int x1 = -client.x;
int y1 = -client.y;
int x2 = m_width - client.x;
int y2 = m_height - client.y;
if (IsKindOf( CLASSINFO(wxButton)))
{
// buttons have an "aura"
y1 -= 5;
x1 -= 5;
y2 += 5;
x2 += 5;
}
Rect clientrect = { y1, x1, y2, x2 };
if ( rect )
{
Rect r = { rect->y , rect->x , rect->y + rect->height , rect->x + rect->width } ;
SectRect( &clientrect , &r , &clientrect ) ;
}
if ( !EmptyRect( &clientrect ) )
{
int top = 0 , left = 0 ;
MacClientToRootWindow( &left , &top ) ;
OffsetRect( &clientrect , left , top ) ;
MacGetTopLevelWindow()->MacInvalidate( &clientrect , eraseBack ) ;
}
*/ */
#endif }
}
} }
void wxWindowMac::Freeze() void wxWindowMac::Freeze()
@@ -2309,7 +2297,7 @@ void wxWindowMac::WarpPointer (int x_pos, int y_pos)
void wxWindowMac::OnEraseBackground(wxEraseEvent& event) void wxWindowMac::OnEraseBackground(wxEraseEvent& event)
{ {
#if TARGET_API_MAC_OSX #if TARGET_API_MAC_OSX
if ( m_macBackgroundBrush.Ok() == false || m_macBackgroundBrush.GetStyle() == wxTRANSPARENT ) if ( MacGetTopLevelWindow()->MacUsesCompositing() && (m_macBackgroundBrush.Ok() == false || m_macBackgroundBrush.GetStyle() == wxTRANSPARENT ) )
{ {
event.Skip() ; event.Skip() ;
} }
@@ -2470,10 +2458,9 @@ void wxWindowMac::MacPaintBorders( int leftOrigin , int rightOrigin )
else else
#endif #endif
{ {
#ifdef __WXMAC_OSX__
// as the non OSX Version is already working in window relative coordinates, it's not needed // as the non OSX Version is already working in window relative coordinates, it's not needed
wxTopLevelWindowMac* top = MacGetTopLevelWindow(); wxTopLevelWindowMac* top = MacGetTopLevelWindow();
if (top) if (top && top->MacUsesCompositing())
{ {
wxPoint pt(0,0) ; wxPoint pt(0,0) ;
wxMacControl::Convert( &pt , GetParent()->m_peer , top->m_peer ) ; wxMacControl::Convert( &pt , GetParent()->m_peer , top->m_peer ) ;
@@ -2482,7 +2469,6 @@ void wxWindowMac::MacPaintBorders( int leftOrigin , int rightOrigin )
rect.top += pt.y ; rect.top += pt.y ;
rect.bottom += pt.y ; rect.bottom += pt.y ;
} }
#endif
if (HasFlag(wxRAISED_BORDER) || HasFlag( wxSUNKEN_BORDER) || HasFlag(wxDOUBLE_BORDER) ) if (HasFlag(wxRAISED_BORDER) || HasFlag( wxSUNKEN_BORDER) || HasFlag(wxDOUBLE_BORDER) )
{ {
@@ -2739,7 +2725,7 @@ void wxWindowMac::OnSetFocus(wxFocusEvent& event)
#ifdef __WXMAC_OSX__ #ifdef __WXMAC_OSX__
// as the non OSX Version is already working in window relative coordinates, it's not needed // as the non OSX Version is already working in window relative coordinates, it's not needed
wxTopLevelWindowMac* top = MacGetTopLevelWindow(); wxTopLevelWindowMac* top = MacGetTopLevelWindow();
if (top) if (top && top->MacUsesCompositing() )
{ {
wxPoint pt(0,0) ; wxPoint pt(0,0) ;
wxMacControl::Convert( &pt , GetParent()->m_peer , top->m_peer ) ; wxMacControl::Convert( &pt , GetParent()->m_peer , top->m_peer ) ;