cursor cleanup
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@18713 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -59,10 +59,6 @@ wxWindowList wxModelessWindows;
|
|||||||
static Point gs_lastWhere;
|
static Point gs_lastWhere;
|
||||||
static long gs_lastWhen = 0;
|
static long gs_lastWhen = 0;
|
||||||
|
|
||||||
// cursor stuff
|
|
||||||
extern int wxBusyCursorCount;
|
|
||||||
|
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// wxTopLevelWindowMac implementation
|
// wxTopLevelWindowMac implementation
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
@@ -535,7 +531,7 @@ void wxTopLevelWindowMac::MacFireMouseEvent( WXEVENTREF evr )
|
|||||||
if ( ev->what == mouseUp )
|
if ( ev->what == mouseUp )
|
||||||
{
|
{
|
||||||
wxTheApp->s_captureWindow = NULL ;
|
wxTheApp->s_captureWindow = NULL ;
|
||||||
if ( wxBusyCursorCount == 0 )
|
if ( !wxIsBusy() )
|
||||||
{
|
{
|
||||||
m_cursor.MacInstall() ;
|
m_cursor.MacInstall() ;
|
||||||
}
|
}
|
||||||
|
@@ -317,49 +317,38 @@ bool wxGetResource(const wxString& section, const wxString& entry, int *value, c
|
|||||||
}
|
}
|
||||||
#endif // wxUSE_RESOURCES
|
#endif // wxUSE_RESOURCES
|
||||||
|
|
||||||
int wxBusyCursorCount = 0;
|
int gs_wxBusyCursorCount = 0;
|
||||||
extern CursHandle gMacCurrentCursor ;
|
extern wxCursor gMacCurrentCursor ;
|
||||||
CursHandle gMacStoredActiveCursor = NULL ;
|
wxCursor gMacStoredActiveCursor ;
|
||||||
|
|
||||||
// Set the cursor to the busy cursor for all windows
|
// Set the cursor to the busy cursor for all windows
|
||||||
void wxBeginBusyCursor(wxCursor *cursor)
|
void wxBeginBusyCursor(wxCursor *cursor)
|
||||||
{
|
{
|
||||||
wxBusyCursorCount ++;
|
if (gs_wxBusyCursorCount++ == 0)
|
||||||
if (wxBusyCursorCount == 1)
|
|
||||||
{
|
{
|
||||||
gMacStoredActiveCursor = gMacCurrentCursor ;
|
gMacStoredActiveCursor = gMacCurrentCursor ;
|
||||||
::SetCursor( *::GetCursor( watchCursor ) ) ;
|
cursor->MacInstall() ;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
}
|
}
|
||||||
|
//else: nothing to do, already set
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore cursor to normal
|
// Restore cursor to normal
|
||||||
void wxEndBusyCursor()
|
void wxEndBusyCursor()
|
||||||
{
|
{
|
||||||
if (wxBusyCursorCount == 0)
|
wxCHECK_RET( gs_wxBusyCursorCount > 0,
|
||||||
return;
|
wxT("no matching wxBeginBusyCursor() for wxEndBusyCursor()") );
|
||||||
|
|
||||||
wxBusyCursorCount --;
|
if (--gs_wxBusyCursorCount == 0)
|
||||||
if (wxBusyCursorCount == 0)
|
|
||||||
{
|
{
|
||||||
if ( gMacStoredActiveCursor )
|
gMacStoredActiveCursor.MacInstall() ;
|
||||||
::SetCursor( *gMacStoredActiveCursor ) ;
|
gMacStoredActiveCursor = wxNullCursor ;
|
||||||
else
|
|
||||||
{
|
|
||||||
Cursor MacArrow ;
|
|
||||||
::SetCursor( GetQDGlobalsArrow( &MacArrow ) ) ;
|
|
||||||
}
|
|
||||||
gMacStoredActiveCursor = NULL ;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TRUE if we're between the above two calls
|
// TRUE if we're between the above two calls
|
||||||
bool wxIsBusy()
|
bool wxIsBusy()
|
||||||
{
|
{
|
||||||
return (wxBusyCursorCount > 0);
|
return (gs_wxBusyCursorCount > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxMacFindFolder( short vol,
|
wxString wxMacFindFolder( short vol,
|
||||||
|
@@ -1478,7 +1478,6 @@ bool wxWindowMac::MacGetWindowFromPoint( const wxPoint &screenpoint , wxWindowMa
|
|||||||
return FALSE ;
|
return FALSE ;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int wxBusyCursorCount ;
|
|
||||||
static wxWindow *gs_lastWhich = NULL;
|
static wxWindow *gs_lastWhich = NULL;
|
||||||
|
|
||||||
bool wxWindowMac::MacSetupCursor( const wxPoint& pt)
|
bool wxWindowMac::MacSetupCursor( const wxPoint& pt)
|
||||||
|
@@ -59,10 +59,6 @@ wxWindowList wxModelessWindows;
|
|||||||
static Point gs_lastWhere;
|
static Point gs_lastWhere;
|
||||||
static long gs_lastWhen = 0;
|
static long gs_lastWhen = 0;
|
||||||
|
|
||||||
// cursor stuff
|
|
||||||
extern int wxBusyCursorCount;
|
|
||||||
|
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// wxTopLevelWindowMac implementation
|
// wxTopLevelWindowMac implementation
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
@@ -535,7 +531,7 @@ void wxTopLevelWindowMac::MacFireMouseEvent( WXEVENTREF evr )
|
|||||||
if ( ev->what == mouseUp )
|
if ( ev->what == mouseUp )
|
||||||
{
|
{
|
||||||
wxTheApp->s_captureWindow = NULL ;
|
wxTheApp->s_captureWindow = NULL ;
|
||||||
if ( wxBusyCursorCount == 0 )
|
if ( !wxIsBusy() )
|
||||||
{
|
{
|
||||||
m_cursor.MacInstall() ;
|
m_cursor.MacInstall() ;
|
||||||
}
|
}
|
||||||
|
@@ -317,49 +317,38 @@ bool wxGetResource(const wxString& section, const wxString& entry, int *value, c
|
|||||||
}
|
}
|
||||||
#endif // wxUSE_RESOURCES
|
#endif // wxUSE_RESOURCES
|
||||||
|
|
||||||
int wxBusyCursorCount = 0;
|
int gs_wxBusyCursorCount = 0;
|
||||||
extern CursHandle gMacCurrentCursor ;
|
extern wxCursor gMacCurrentCursor ;
|
||||||
CursHandle gMacStoredActiveCursor = NULL ;
|
wxCursor gMacStoredActiveCursor ;
|
||||||
|
|
||||||
// Set the cursor to the busy cursor for all windows
|
// Set the cursor to the busy cursor for all windows
|
||||||
void wxBeginBusyCursor(wxCursor *cursor)
|
void wxBeginBusyCursor(wxCursor *cursor)
|
||||||
{
|
{
|
||||||
wxBusyCursorCount ++;
|
if (gs_wxBusyCursorCount++ == 0)
|
||||||
if (wxBusyCursorCount == 1)
|
|
||||||
{
|
{
|
||||||
gMacStoredActiveCursor = gMacCurrentCursor ;
|
gMacStoredActiveCursor = gMacCurrentCursor ;
|
||||||
::SetCursor( *::GetCursor( watchCursor ) ) ;
|
cursor->MacInstall() ;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
}
|
}
|
||||||
|
//else: nothing to do, already set
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore cursor to normal
|
// Restore cursor to normal
|
||||||
void wxEndBusyCursor()
|
void wxEndBusyCursor()
|
||||||
{
|
{
|
||||||
if (wxBusyCursorCount == 0)
|
wxCHECK_RET( gs_wxBusyCursorCount > 0,
|
||||||
return;
|
wxT("no matching wxBeginBusyCursor() for wxEndBusyCursor()") );
|
||||||
|
|
||||||
wxBusyCursorCount --;
|
if (--gs_wxBusyCursorCount == 0)
|
||||||
if (wxBusyCursorCount == 0)
|
|
||||||
{
|
{
|
||||||
if ( gMacStoredActiveCursor )
|
gMacStoredActiveCursor.MacInstall() ;
|
||||||
::SetCursor( *gMacStoredActiveCursor ) ;
|
gMacStoredActiveCursor = wxNullCursor ;
|
||||||
else
|
|
||||||
{
|
|
||||||
Cursor MacArrow ;
|
|
||||||
::SetCursor( GetQDGlobalsArrow( &MacArrow ) ) ;
|
|
||||||
}
|
|
||||||
gMacStoredActiveCursor = NULL ;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TRUE if we're between the above two calls
|
// TRUE if we're between the above two calls
|
||||||
bool wxIsBusy()
|
bool wxIsBusy()
|
||||||
{
|
{
|
||||||
return (wxBusyCursorCount > 0);
|
return (gs_wxBusyCursorCount > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxMacFindFolder( short vol,
|
wxString wxMacFindFolder( short vol,
|
||||||
|
@@ -1478,7 +1478,6 @@ bool wxWindowMac::MacGetWindowFromPoint( const wxPoint &screenpoint , wxWindowMa
|
|||||||
return FALSE ;
|
return FALSE ;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int wxBusyCursorCount ;
|
|
||||||
static wxWindow *gs_lastWhich = NULL;
|
static wxWindow *gs_lastWhich = NULL;
|
||||||
|
|
||||||
bool wxWindowMac::MacSetupCursor( const wxPoint& pt)
|
bool wxWindowMac::MacSetupCursor( const wxPoint& pt)
|
||||||
|
Reference in New Issue
Block a user