From 46753a7ce5a204101682180fc64009ce6848bcd7 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 13 Jul 2007 14:09:08 +0000 Subject: [PATCH] fixed showing busy cursor for disabled windows and during wxExecute() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47430 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + src/msw/window.cpp | 80 +++++++++++++++++++++------------------------- 2 files changed, 37 insertions(+), 44 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 1ea9b35234..ee4067c917 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -199,6 +199,7 @@ wxMSW: - Added msw.font.no-proof-quality system option, see manual for description - Fix appearance of notebook with non-top tabs under Windows Vista - Fixed bug with symbol resolving in wxStackWalker (Axel Gembe) +- Fixed showing busy cursor for disabled windows and during wxExecute() wxGTK: diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 484177c102..81ee66815f 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -3810,63 +3810,56 @@ bool wxWindowMSW::HandleSetCursor(WXHWND WXUNUSED(hWnd), { #ifndef __WXMICROWIN__ // the logic is as follows: - // -1. don't set cursor for non client area, including but not limited to - // the title bar, scrollbars, &c - // 0. allow the user to override default behaviour by using EVT_SET_CURSOR - // 1. if we have the cursor set it unless wxIsBusy() - // 2. if we're a top level window, set some cursor anyhow - // 3. if wxIsBusy(), set the busy cursor, otherwise the global one + // 0. if we're busy, set the busy cursor (even for non client elements) + // 1. don't set custom cursor for non client area of enabled windows + // 2. ask user EVT_SET_CURSOR handler for the cursor + // 3. if still no cursor but we're in a TLW, set the global cursor - if ( nHitTest != HTCLIENT ) + HCURSOR hcursor = 0; + if ( wxIsBusy() ) { - return false; + hcursor = wxGetCurrentBusyCursor(); } + else // not busy + { + if ( nHitTest != HTCLIENT ) + return false; - HCURSOR hcursor = 0; - - // first ask the user code - it may wish to set the cursor in some very - // specific way (for example, depending on the current position) - POINT pt; + // first ask the user code - it may wish to set the cursor in some very + // specific way (for example, depending on the current position) + POINT pt; #ifdef __WXWINCE__ - if ( !::GetCursorPosWinCE(&pt)) + if ( !::GetCursorPosWinCE(&pt)) #else - if ( !::GetCursorPos(&pt) ) + if ( !::GetCursorPos(&pt) ) #endif - { - wxLogLastError(wxT("GetCursorPos")); - } - - int x = pt.x, - y = pt.y; - ScreenToClient(&x, &y); - wxSetCursorEvent event(x, y); - - bool processedEvtSetCursor = GetEventHandler()->ProcessEvent(event); - if ( processedEvtSetCursor && event.HasCursor() ) - { - hcursor = GetHcursorOf(event.GetCursor()); - } + { + wxLogLastError(wxT("GetCursorPos")); + } - if ( !hcursor ) - { - bool isBusy = wxIsBusy(); + int x = pt.x, + y = pt.y; + ScreenToClient(&x, &y); + wxSetCursorEvent event(x, y); - // the test for processedEvtSetCursor is here to prevent using m_cursor - // if the user code caught EVT_SET_CURSOR() and returned nothing from - // it - this is a way to say that our cursor shouldn't be used for this - // point - if ( !processedEvtSetCursor && m_cursor.Ok() ) + bool processedEvtSetCursor = GetEventHandler()->ProcessEvent(event); + if ( processedEvtSetCursor && event.HasCursor() ) { - hcursor = GetHcursorOf(m_cursor); + hcursor = GetHcursorOf(event.GetCursor()); } - if ( !GetParent() ) + if ( !hcursor ) { - if ( isBusy ) + // the test for processedEvtSetCursor is here to prevent using + // m_cursor if the user code caught EVT_SET_CURSOR() and returned + // nothing from it - this is a way to say that our cursor shouldn't + // be used for this point + if ( !processedEvtSetCursor && m_cursor.Ok() ) { - hcursor = wxGetCurrentBusyCursor(); + hcursor = GetHcursorOf(m_cursor); } - else if ( !hcursor ) + + if ( !hcursor && !GetParent() ) { const wxCursor *cursor = wxGetGlobalCursor(); if ( cursor && cursor->Ok() ) @@ -3877,10 +3870,9 @@ bool wxWindowMSW::HandleSetCursor(WXHWND WXUNUSED(hWnd), } } + if ( hcursor ) { -// wxLogDebug("HandleSetCursor: Setting cursor %ld", (long) hcursor); - ::SetCursor(hcursor); // cursor set, stop here -- 2.45.2