From 2d1760d30ff85ea96fb69d38b7710f695a0148d2 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Fri, 25 Jun 2004 11:18:02 +0000 Subject: [PATCH] cursor handling fix git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28021 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mac/carbon/window.cpp | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/src/mac/carbon/window.cpp b/src/mac/carbon/window.cpp index 35913c0d0c..295086cb60 100644 --- a/src/mac/carbon/window.cpp +++ b/src/mac/carbon/window.cpp @@ -1416,27 +1416,30 @@ bool wxWindowMac::SetCursor(const wxCursor& cursor) wxASSERT_MSG( m_cursor.Ok(), wxT("cursor must be valid after call to the base version")); - - /* - - TODO why do we have to use current coordinates ? - Point pt ; - wxWindowMac *mouseWin ; - GetMouse( &pt ) ; - - // Change the cursor NOW if we're within the correct window - - if ( MacGetWindowFromPoint( wxPoint( pt.h , pt.v ) , &mouseWin ) ) + wxWindowMac *mouseWin = 0 ; { - if ( mouseWin == this && !wxIsBusy() ) - { - m_cursor.MacInstall() ; - } + WindowRef window = (WindowRef) MacGetTopLevelWindowRef() ; + CGrafPtr savePort ; + Boolean swapped = QDSwapPort( GetWindowPort( window ) , &savePort ) ; + + // TODO If we ever get a GetCurrentEvent.. replacement for the mouse + // position, use it... + + Point pt ; + GetMouse( &pt ) ; + ControlPartCode part ; + ControlRef control ; + control = wxMacFindControlUnderMouse( pt , window , &part ) ; + if ( control ) + mouseWin = wxFindControlFromMacControl( control ) ; + + if ( swapped ) + QDSwapPort( savePort , NULL ) ; } - */ - if ( !wxIsBusy() ) + + if ( mouseWin == this && !wxIsBusy() ) { m_cursor.MacInstall() ; } -- 2.47.2