diff options
Diffstat (limited to 'intern')
-rw-r--r-- | intern/ghost/GHOST_Types.h | 2 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemCarbon.cpp | 6 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemWin32.cpp | 5 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemX11.cpp | 5 |
4 files changed, 11 insertions, 7 deletions
diff --git a/intern/ghost/GHOST_Types.h b/intern/ghost/GHOST_Types.h index 349fb5a02fc..a413b765ccb 100644 --- a/intern/ghost/GHOST_Types.h +++ b/intern/ghost/GHOST_Types.h @@ -143,6 +143,8 @@ typedef enum { GHOST_kEventWindowSize, GHOST_kEventWindowMove, + GHOST_kEventTimer, + GHOST_kNumEventTypes } GHOST_TEventType; diff --git a/intern/ghost/intern/GHOST_SystemCarbon.cpp b/intern/ghost/intern/GHOST_SystemCarbon.cpp index 5523fab50f1..e1980521eb0 100644 --- a/intern/ghost/intern/GHOST_SystemCarbon.cpp +++ b/intern/ghost/intern/GHOST_SystemCarbon.cpp @@ -423,17 +423,15 @@ bool GHOST_SystemCarbon::processEvents(bool waitForEvent) GHOST_TimerManager* timerMgr = getTimerManager(); if (waitForEvent) { - GHOST_TUns64 curtime = getMilliSeconds(); GHOST_TUns64 next = timerMgr->nextFireTime(); double timeOut; if (next == GHOST_kFireTimeNever) { timeOut = kEventDurationForever; } else { - if (next<=curtime) + timeOut = (double)(next - getMilliSeconds())/1000.0; + if (timeOut < 0.0) timeOut = 0.0; - else - timeOut = (double) (next - getMilliSeconds())/1000.0; } ::ReceiveNextEvent(0, NULL, timeOut, false, &event); diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp index 6f9bad0f876..61b504400d2 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemWin32.cpp @@ -190,11 +190,12 @@ bool GHOST_SystemWin32::processEvents(bool waitForEvent) ::Sleep(1); #else GHOST_TUns64 next = timerMgr->nextFireTime(); + GHOST_TInt64 maxSleep = next - getMilliSeconds(); if (next == GHOST_kFireTimeNever) { ::WaitMessage(); - } else { - ::SetTimer(NULL, 0, next - getMilliSeconds(), NULL); + } else if(maxSleep >= 0.0) { + ::SetTimer(NULL, 0, maxSleep, NULL); ::WaitMessage(); ::KillTimer(NULL, 0); } diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp index bbce940f1b3..170a7c23843 100644 --- a/intern/ghost/intern/GHOST_SystemX11.cpp +++ b/intern/ghost/intern/GHOST_SystemX11.cpp @@ -309,7 +309,10 @@ processEvents( if (next==GHOST_kFireTimeNever) { SleepTillEvent(m_display, -1); } else { - SleepTillEvent(m_display, next - getMilliSeconds()); + GHOST_TInt64 maxSleep = next - getMilliSeconds(); + + if(maxSleep >= 0) + SleepTillEvent(m_display, next - getMilliSeconds()); } } |