From: Stefan Csomor Date: Sun, 9 Jan 2005 05:50:36 +0000 (+0000) Subject: fixed border calculation X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/ae190e6447f7befdc011555113b6b8884906ba85 fixed border calculation git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31297 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/mac/carbon/uma.cpp b/src/mac/carbon/uma.cpp index 3e60338538..7f1fa17db9 100644 --- a/src/mac/carbon/uma.cpp +++ b/src/mac/carbon/uma.cpp @@ -796,15 +796,27 @@ Rect* UMAGetControlBoundsInWindowCoords(ControlRef theControl, Rect *bounds) #if TARGET_API_MAC_OSX if ( win != NULL && win->MacGetTopLevelWindow() != NULL ) { - int x , y ; - x = 0 ; - y = 0 ; - - win->GetParent()->MacWindowToRootWindow( &x , & y ) ; - bounds->left += x ; - bounds->right += x ; - bounds->top += y ; - bounds->bottom += y ; + wxWindow* parent = win->GetParent() ; + if ( parent ) + { + // the parent controls 'origin' expressed in its own + // window coordinates (explanation in window.cpp) + int x , y ; + x = 0 ; + y = 0 ; + + if ( !parent->IsTopLevel() ) + { + x += parent->MacGetLeftBorderSize() ; + y += parent->MacGetTopBorderSize() ; + } + + parent->MacWindowToRootWindow( &x , & y ) ; + bounds->left += x ; + bounds->right += x ; + bounds->top += y ; + bounds->bottom += y ; + } } #endif return bounds ;