fixing a CG error during construction on 10.6, resizing the client area so that the content doesn't extend over the shape's boundingbox at the right and the bottom

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@67125 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2011-03-04 16:36:47 +00:00
parent afa37904f2
commit 3a2ae66206

View File

@@ -1809,13 +1809,19 @@ bool wxTopLevelWindowMac::SetShape(const wxRegion& region)
static void wxShapedMacWindowGetPos(WindowRef window, Rect* inRect) static void wxShapedMacWindowGetPos(WindowRef window, Rect* inRect)
{ {
#if 1
// under 10.6 we are getting errors during construction otherwise
::GetWindowBounds(window, kWindowGlobalPortRgn, inRect);
#else
GetWindowPortBounds(window, inRect); GetWindowPortBounds(window, inRect);
Point pt = { inRect->top ,inRect->left }; Point pt = { inRect->top ,inRect->left };
wxMacLocalToGlobal( window, &pt ) ; wxMacLocalToGlobal( window, &pt ) ;
inRect->bottom += pt.v - inRect->top; inRect->bottom += pt.v - inRect->top;
inRect->right += pt.h - inRect->left; inRect->right += pt.h - inRect->left;
inRect->top = pt.v; inRect->top = pt.v;
inRect->left = pt.h; inRect->left = pt.h;
#endif
} }
static SInt32 wxShapedMacWindowGetFeatures(WindowRef window, SInt32 param) static SInt32 wxShapedMacWindowGetFeatures(WindowRef window, SInt32 param)
@@ -1849,10 +1855,27 @@ static void wxShapedMacWindowContentRegion(WindowRef window, RgnHandle rgn)
wxTopLevelWindowMac* win = wxFindWinFromMacWindow(window); wxTopLevelWindowMac* win = wxFindWinFromMacWindow(window);
if (win) if (win)
{ {
Rect windowRect ;
wxShapedMacWindowGetPos( window, &windowRect ) ;
#if 1
// the port rectangle of the window may be larger than the window was set,
// therefore we clip at the right and bottom of the shape
RgnHandle cachedRegion = (RgnHandle) GetWRefCon(window);
if (cachedRegion)
{
CopyRgn(cachedRegion, rgn); // make a copy of our cached region
OffsetRgn(rgn, windowRect.left, windowRect.top); // position it over window
Rect r; Rect r;
wxShapedMacWindowGetPos( window, &r ) ; GetRegionBounds(rgn,&r);
r.left = windowRect.left;
r.top = windowRect.top;
RectRgn( rgn , &r ) ; RectRgn( rgn , &r ) ;
} }
#else
RectRgn( rgn , &windowRect ) ;
#endif
}
} }
// The structure region is set to the shape given to the SetShape method. // The structure region is set to the shape given to the SetShape method.