Added a macro SDL_TICKS_PASSED() to correctly compare two 32-bit tick values.
Went through the code and used the macro and fixed a couple places that were using incorrect timestamp comparisons.
This commit is contained in:
parent
84561c952a
commit
367ffcc3af
12 changed files with 23 additions and 21 deletions
|
@ -271,7 +271,7 @@ Cocoa_PumpEvents(_THIS)
|
|||
SDL_VideoData *data = (SDL_VideoData *)_this->driverdata;
|
||||
Uint32 now = SDL_GetTicks();
|
||||
if (!data->screensaver_activity ||
|
||||
(int)(now-data->screensaver_activity) >= 30000) {
|
||||
SDL_TICKS_PASSED(now, data->screensaver_activity + 30000)) {
|
||||
UpdateSystemActivity(UsrActivity);
|
||||
data->screensaver_activity = now;
|
||||
}
|
||||
|
|
|
@ -909,7 +909,7 @@ X11_HandleFocusChanges(_THIS)
|
|||
SDL_WindowData *data = videodata->windowlist[i];
|
||||
if (data && data->pending_focus != PENDING_FOCUS_NONE) {
|
||||
Uint32 now = SDL_GetTicks();
|
||||
if ( (int)(data->pending_focus_time-now) <= 0 ) {
|
||||
if (SDL_TICKS_PASSED(now, data->pending_focus_time)) {
|
||||
if ( data->pending_focus == PENDING_FOCUS_IN ) {
|
||||
X11_DispatchFocusIn(data);
|
||||
} else {
|
||||
|
@ -963,7 +963,7 @@ X11_PumpEvents(_THIS)
|
|||
if (_this->suspend_screensaver) {
|
||||
Uint32 now = SDL_GetTicks();
|
||||
if (!data->screensaver_activity ||
|
||||
(int) (now - data->screensaver_activity) >= 30000) {
|
||||
SDL_TICKS_PASSED(now, data->screensaver_activity + 30000)) {
|
||||
X11_XResetScreenSaver(data->display);
|
||||
|
||||
#if SDL_USE_LIBDBUS
|
||||
|
|
|
@ -66,7 +66,7 @@ X11_XIfEventTimeout(Display *display, XEvent *event_return, Bool (*predicate)(),
|
|||
Uint32 start = SDL_GetTicks();
|
||||
|
||||
while (!X11_XCheckIfEvent(display, event_return, predicate, arg)) {
|
||||
if ((SDL_GetTicks() - start) >= timeoutMS) {
|
||||
if (SDL_TICKS_PASSED(SDL_GetTicks(), start + timeoutMS)) {
|
||||
return False;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue