From: Stefan Csomor Date: Mon, 14 Jan 2002 20:23:49 +0000 (+0000) Subject: since DoScreenToClient and ClientToScreen in toplvlcmn are implemented by calling... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/2078220ed6605d5d3bba16afe1a231b3e92fa9d8?ds=inline since DoScreenToClient and ClientToScreen in toplvlcmn are implemented by calling the superclass implementation, we have to avoid shifting by the client origin twice. had to change MacWindowFromPoint therefore too git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13572 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/mac/carbon/window.cpp b/src/mac/carbon/window.cpp index e63dde07d7..7462e3ab8e 100644 --- a/src/mac/carbon/window.cpp +++ b/src/mac/carbon/window.cpp @@ -350,14 +350,23 @@ void wxWindowMac::DoScreenToClient(int *x, int *y) const if(x) *x = localwhere.h ; if(y) *y = localwhere.v ; - MacRootWindowToClient( x , y ) ; + MacRootWindowToWindow( x , y ) ; + if ( x ) + x -= MacGetLeftBorderSize() ; + if ( y ) + y -= MacGetTopBorderSize() ; } void wxWindowMac::DoClientToScreen(int *x, int *y) const { WindowRef window = (WindowRef) MacGetRootWindow() ; - MacClientToRootWindow( x , y ) ; + if ( x ) + x += MacGetLeftBorderSize() ; + if ( y ) + y += MacGetTopBorderSize() ; + + MacWindowToRootWindow( x , y ) ; Point localwhere = { 0,0 }; if(x) localwhere.h = * x ; @@ -1349,6 +1358,7 @@ bool wxWindowMac::MacGetWindowFromPoint( const wxPoint &screenpoint , wxWindowMa if ( win ) { point = win->ScreenToClient( point ) ; + point += win->GetClientAreaOrigin() ; return win->MacGetWindowFromPointSub( point , outWin ) ; } } diff --git a/src/mac/window.cpp b/src/mac/window.cpp index e63dde07d7..7462e3ab8e 100644 --- a/src/mac/window.cpp +++ b/src/mac/window.cpp @@ -350,14 +350,23 @@ void wxWindowMac::DoScreenToClient(int *x, int *y) const if(x) *x = localwhere.h ; if(y) *y = localwhere.v ; - MacRootWindowToClient( x , y ) ; + MacRootWindowToWindow( x , y ) ; + if ( x ) + x -= MacGetLeftBorderSize() ; + if ( y ) + y -= MacGetTopBorderSize() ; } void wxWindowMac::DoClientToScreen(int *x, int *y) const { WindowRef window = (WindowRef) MacGetRootWindow() ; - MacClientToRootWindow( x , y ) ; + if ( x ) + x += MacGetLeftBorderSize() ; + if ( y ) + y += MacGetTopBorderSize() ; + + MacWindowToRootWindow( x , y ) ; Point localwhere = { 0,0 }; if(x) localwhere.h = * x ; @@ -1349,6 +1358,7 @@ bool wxWindowMac::MacGetWindowFromPoint( const wxPoint &screenpoint , wxWindowMa if ( win ) { point = win->ScreenToClient( point ) ; + point += win->GetClientAreaOrigin() ; return win->MacGetWindowFromPointSub( point , outWin ) ; } }