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
This commit is contained in:
Vadim Zeitlin
2007-07-13 14:09:08 +00:00
parent d3c58c7ec0
commit 46753a7ce5
2 changed files with 40 additions and 47 deletions

View File

@@ -199,6 +199,7 @@ wxMSW:
- Added msw.font.no-proof-quality system option, see manual for description - Added msw.font.no-proof-quality system option, see manual for description
- Fix appearance of notebook with non-top tabs under Windows Vista - Fix appearance of notebook with non-top tabs under Windows Vista
- Fixed bug with symbol resolving in wxStackWalker (Axel Gembe) - Fixed bug with symbol resolving in wxStackWalker (Axel Gembe)
- Fixed showing busy cursor for disabled windows and during wxExecute()
wxGTK: wxGTK:

View File

@@ -3810,63 +3810,56 @@ bool wxWindowMSW::HandleSetCursor(WXHWND WXUNUSED(hWnd),
{ {
#ifndef __WXMICROWIN__ #ifndef __WXMICROWIN__
// the logic is as follows: // the logic is as follows:
// -1. don't set cursor for non client area, including but not limited to // 0. if we're busy, set the busy cursor (even for non client elements)
// the title bar, scrollbars, &c // 1. don't set custom cursor for non client area of enabled windows
// 0. allow the user to override default behaviour by using EVT_SET_CURSOR // 2. ask user EVT_SET_CURSOR handler for the cursor
// 1. if we have the cursor set it unless wxIsBusy() // 3. if still no cursor but we're in a TLW, set the global cursor
// 2. if we're a top level window, set some cursor anyhow
// 3. if wxIsBusy(), set the busy cursor, otherwise the global one
if ( nHitTest != HTCLIENT )
{
return false;
}
HCURSOR hcursor = 0; HCURSOR hcursor = 0;
if ( wxIsBusy() )
{
hcursor = wxGetCurrentBusyCursor();
}
else // not busy
{
if ( nHitTest != HTCLIENT )
return false;
// first ask the user code - it may wish to set the cursor in some very // first ask the user code - it may wish to set the cursor in some very
// specific way (for example, depending on the current position) // specific way (for example, depending on the current position)
POINT pt; POINT pt;
#ifdef __WXWINCE__ #ifdef __WXWINCE__
if ( !::GetCursorPosWinCE(&pt)) if ( !::GetCursorPosWinCE(&pt))
#else #else
if ( !::GetCursorPos(&pt) ) if ( !::GetCursorPos(&pt) )
#endif #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());
}
if ( !hcursor )
{
bool isBusy = wxIsBusy();
// 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 = GetHcursorOf(m_cursor); wxLogLastError(wxT("GetCursorPos"));
} }
if ( !GetParent() ) int x = pt.x,
y = pt.y;
ScreenToClient(&x, &y);
wxSetCursorEvent event(x, y);
bool processedEvtSetCursor = GetEventHandler()->ProcessEvent(event);
if ( processedEvtSetCursor && event.HasCursor() )
{ {
if ( isBusy ) hcursor = GetHcursorOf(event.GetCursor());
}
if ( !hcursor )
{
// 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(); const wxCursor *cursor = wxGetGlobalCursor();
if ( cursor && cursor->Ok() ) if ( cursor && cursor->Ok() )
@@ -3877,10 +3870,9 @@ bool wxWindowMSW::HandleSetCursor(WXHWND WXUNUSED(hWnd),
} }
} }
if ( hcursor ) if ( hcursor )
{ {
// wxLogDebug("HandleSetCursor: Setting cursor %ld", (long) hcursor);
::SetCursor(hcursor); ::SetCursor(hcursor);
// cursor set, stop here // cursor set, stop here