From 2078220ed6605d5d3bba16afe1a231b3e92fa9d8 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Mon, 14 Jan 2002 20:23:49 +0000 Subject: [PATCH] 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 --- src/mac/carbon/window.cpp | 14 ++++++++++++-- src/mac/window.cpp | 14 ++++++++++++-- 2 files changed, 24 insertions(+), 4 deletions(-) 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 ) ; } } -- 2.50.0