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
This commit is contained in:
Stefan Csomor
2002-01-14 20:23:49 +00:00
parent 42c95b077f
commit 2078220ed6
2 changed files with 24 additions and 4 deletions

View File

@@ -350,14 +350,23 @@ void wxWindowMac::DoScreenToClient(int *x, int *y) const
if(x) *x = localwhere.h ; if(x) *x = localwhere.h ;
if(y) *y = localwhere.v ; 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 void wxWindowMac::DoClientToScreen(int *x, int *y) const
{ {
WindowRef window = (WindowRef) MacGetRootWindow() ; WindowRef window = (WindowRef) MacGetRootWindow() ;
MacClientToRootWindow( x , y ) ; if ( x )
x += MacGetLeftBorderSize() ;
if ( y )
y += MacGetTopBorderSize() ;
MacWindowToRootWindow( x , y ) ;
Point localwhere = { 0,0 }; Point localwhere = { 0,0 };
if(x) localwhere.h = * x ; if(x) localwhere.h = * x ;
@@ -1349,6 +1358,7 @@ bool wxWindowMac::MacGetWindowFromPoint( const wxPoint &screenpoint , wxWindowMa
if ( win ) if ( win )
{ {
point = win->ScreenToClient( point ) ; point = win->ScreenToClient( point ) ;
point += win->GetClientAreaOrigin() ;
return win->MacGetWindowFromPointSub( point , outWin ) ; return win->MacGetWindowFromPointSub( point , outWin ) ;
} }
} }

View File

@@ -350,14 +350,23 @@ void wxWindowMac::DoScreenToClient(int *x, int *y) const
if(x) *x = localwhere.h ; if(x) *x = localwhere.h ;
if(y) *y = localwhere.v ; 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 void wxWindowMac::DoClientToScreen(int *x, int *y) const
{ {
WindowRef window = (WindowRef) MacGetRootWindow() ; WindowRef window = (WindowRef) MacGetRootWindow() ;
MacClientToRootWindow( x , y ) ; if ( x )
x += MacGetLeftBorderSize() ;
if ( y )
y += MacGetTopBorderSize() ;
MacWindowToRootWindow( x , y ) ;
Point localwhere = { 0,0 }; Point localwhere = { 0,0 };
if(x) localwhere.h = * x ; if(x) localwhere.h = * x ;
@@ -1349,6 +1358,7 @@ bool wxWindowMac::MacGetWindowFromPoint( const wxPoint &screenpoint , wxWindowMa
if ( win ) if ( win )
{ {
point = win->ScreenToClient( point ) ; point = win->ScreenToClient( point ) ;
point += win->GetClientAreaOrigin() ;
return win->MacGetWindowFromPointSub( point , outWin ) ; return win->MacGetWindowFromPointSub( point , outWin ) ;
} }
} }