[Bf-blender-cvs] [785e8a636a2] blender2.8: GHOST: Fix `processEvents` not notifying events handled by the system if the window is hidden.
Germano
noreply at git.blender.org
Thu Apr 19 16:26:40 CEST 2018
Commit: 785e8a636a293941a4295e669cb5aeecfafae039
Author: Germano
Date: Thu Apr 19 11:26:33 2018 -0300
Branches: blender2.8
https://developer.blender.org/rB785e8a636a293941a4295e669cb5aeecfafae039
GHOST: Fix `processEvents` not notifying events handled by the system if the window is hidden.
Reviewed By: @LazyDodo
Differential Revision: https://developer.blender.org/D3154
===================================================================
M intern/ghost/intern/GHOST_SystemWin32.cpp
===================================================================
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;
}
More information about the Bf-blender-cvs
mailing list