Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp
index 056b5536ab0..ccc90e363b7 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -396,12 +396,12 @@ GHOST_TSuccess GHOST_SystemWin32::disposeContext(GHOST_IContext *context)
bool GHOST_SystemWin32::processEvents(bool waitForEvent)
{
MSG msg;
- bool anyProcessed = false;
+ bool hasEventHandled = false;
do {
GHOST_TimerManager *timerMgr = getTimerManager();
- if (waitForEvent && !::PeekMessage(&msg, 0, 0, 0, PM_NOREMOVE)) {
+ if (waitForEvent && !::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) {
#if 1
::Sleep(1);
#else
@@ -420,20 +420,26 @@ bool GHOST_SystemWin32::processEvents(bool waitForEvent)
}
if (timerMgr->fireTimers(getMilliSeconds())) {
- anyProcessed = true;
+ hasEventHandled = true;
}
// Process all the events waiting for us
- while (::PeekMessageW(&msg, 0, 0, 0, PM_REMOVE) != 0) {
+ while (::PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE) != 0) {
// TranslateMessage doesn't alter the message, and doesn't change our raw keyboard data.
// Needed for MapVirtualKey or if we ever need to get chars from wm_ime_char or similar.
::TranslateMessage(&msg);
::DispatchMessageW(&msg);
- anyProcessed = true;
}
- } while (waitForEvent && !anyProcessed);
- return anyProcessed;
+ if (hasEventHandled == false) {
+ // Check if we have events handled by the system
+ // (for example the `GHOST_kEventWindowClose`).
+ hasEventHandled = m_eventManager->getNumEvents() != 0;
+ }
+
+ } while (waitForEvent && !hasEventHandled);
+
+ return hasEventHandled;
}