usleep fix & cursor adaptions
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@19478 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -158,7 +158,7 @@ void wxUsleep(unsigned long milliseconds)
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
YieldToAnyThread() ;
|
YieldToAnyThread() ;
|
||||||
} while( clock() - start < milliseconds / CLOCKS_PER_SEC ) ;
|
} while( clock() - start < milliseconds / 1000.0 * CLOCKS_PER_SEC ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSleep(int nSecs)
|
void wxSleep(int nSecs)
|
||||||
@@ -313,49 +313,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
|
//else: nothing to do, already set
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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 )
|
|
||||||
::SetCursor( *gMacStoredActiveCursor ) ;
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
Cursor MacArrow ;
|
gMacStoredActiveCursor.MacInstall() ;
|
||||||
::SetCursor( GetQDGlobalsArrow( &MacArrow ) ) ;
|
gMacStoredActiveCursor = wxNullCursor ;
|
||||||
}
|
|
||||||
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,
|
||||||
|
@@ -158,7 +158,7 @@ void wxUsleep(unsigned long milliseconds)
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
YieldToAnyThread() ;
|
YieldToAnyThread() ;
|
||||||
} while( clock() - start < milliseconds / CLOCKS_PER_SEC ) ;
|
} while( clock() - start < milliseconds / 1000.0 * CLOCKS_PER_SEC ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSleep(int nSecs)
|
void wxSleep(int nSecs)
|
||||||
@@ -313,49 +313,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
|
//else: nothing to do, already set
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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 )
|
|
||||||
::SetCursor( *gMacStoredActiveCursor ) ;
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
Cursor MacArrow ;
|
gMacStoredActiveCursor.MacInstall() ;
|
||||||
::SetCursor( GetQDGlobalsArrow( &MacArrow ) ) ;
|
gMacStoredActiveCursor = wxNullCursor ;
|
||||||
}
|
|
||||||
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,
|
||||||
|
Reference in New Issue
Block a user