From 101634b2e4d0182fbceb1efb6964a1592cfcc4ec Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Fri, 6 Aug 2004 18:30:55 +0000 Subject: [PATCH] corrected positioning of focus rect in hierarchies and changed the redraw after a control lost focus to do an invalidation instead of a redraw, because in the situations where we have wrong z-order (static boxes) a wrong shade of gray will get painted otherwise. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28667 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mac/carbon/window.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/mac/carbon/window.cpp b/src/mac/carbon/window.cpp index 4ffbac7e71..7e931ec421 100644 --- a/src/mac/carbon/window.cpp +++ b/src/mac/carbon/window.cpp @@ -2429,8 +2429,22 @@ void wxWindowMac::OnSetFocus(wxFocusEvent& event) else { DrawThemeFocusRect( &rect , false ) ; + // as this erases part of the frame we have to redraw borders - MacPaintBorders( x , y ) ; + // and because our z-ordering is not always correct (staticboxes) + // we have to invalidate things, we cannot simple redraw + RgnHandle updateInner = NewRgn() , updateOuter = NewRgn() ; + RectRgn( updateInner , &rect ) ; + InsetRect( &rect , -4 , -4 ) ; + RectRgn( updateOuter , &rect ) ; + DiffRgn( updateOuter , updateInner ,updateOuter ) ; + wxPoint parent(0,0); + GetParent()->MacWindowToRootWindow( &parent.x , &parent.y ) ; + parent -= GetParent()->GetClientAreaOrigin() ; + OffsetRgn( updateOuter , -parent.x , -parent.y ) ; + GetParent()->m_peer->SetNeedsDisplay( true , updateOuter ) ; + DisposeRgn(updateOuter) ; + DisposeRgn(updateInner) ; } } @@ -2726,6 +2740,7 @@ bool wxWindowMac::MacDoRedraw( WXHRGN updatergnr , long time ) wxWindowDC dc(this) ; dc.SetClippingRegion(wxRegion(updatergn)); wxMacPortSetter helper(&dc) ; + OffsetRect( &childRect , dc.m_macLocalOrigin.x , dc.m_macLocalOrigin.y ) ; DrawThemeFocusRect( &childRect , true ) ; } } -- 2.45.2