From c2984cecc6fc6ad2d8d057460a9345ac549ce11c Mon Sep 17 00:00:00 2001 From: Ilya Orlov Date: Sat, 7 Jul 2018 02:44:02 +0400 Subject: [PATCH] xrEngine: fix inactive render --- src/xrEngine/device.cpp | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/xrEngine/device.cpp b/src/xrEngine/device.cpp index 77de67e633c..a59c75a8399 100644 --- a/src/xrEngine/device.cpp +++ b/src/xrEngine/device.cpp @@ -346,31 +346,41 @@ void CRenderDevice::message_loop() switch (event.window.event) { case SDL_WINDOWEVENT_MOVED: - case SDL_WINDOWEVENT_SIZE_CHANGED: - case SDL_WINDOWEVENT_MAXIMIZED: SDL_Log("Window %d moved to %d,%d", event.window.windowID, event.window.data1, event.window.data2); continue; + case SDL_WINDOWEVENT_SIZE_CHANGED: + SDL_Log("Window %d resized to %d,%d", event.window.windowID, event.window.data1, event.window.data2); + continue; case SDL_WINDOWEVENT_CLOSE: event.type = SDL_QUIT; SDL_PeepEvents(&event, 1, SDL_ADDEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT); continue; #if SDL_VERSION_ATLEAST(2, 0, 5) case SDL_WINDOWEVENT_SHOWN: - case SDL_WINDOWEVENT_EXPOSED: - // case SDL_WINDOWEVENT_TAKE_FOCUS: + case SDL_WINDOWEVENT_FOCUS_GAINED: if (editor()) { Device.b_is_Active = TRUE; continue; } - OnWM_Activate(event.window.data1, event.window.data2); + OnWM_Activate(1, event.window.data2); SDL_Log("Window %d is offered a focus", event.window.windowID); continue; + case SDL_WINDOWEVENT_HIDDEN: + case SDL_WINDOWEVENT_FOCUS_LOST: + OnWM_Activate(0, event.window.data2); + SDL_Log("Window %d is lost a focus", event.window.windowID); + continue; #endif - default: SDL_Log("Window %d got unknown event %d", event.window.windowID, event.window.event); continue; + default: + SDL_Log("Window %d got unknown event %d with %d %d", event.window.windowID, event.window.event, + event.window.data1, event.window.data2); + continue; } continue; - default: Log("Recieve window %d event", event.type); continue; + default: + SDL_Log("Window event %d to %d,%d", event.type, event.window.data1, event.window.data2); + continue; } } @@ -528,10 +538,8 @@ void CRenderDevice::Pause(BOOL bOn, BOOL bTimer, BOOL bSound, LPCSTR reason) BOOL CRenderDevice::Paused() { return g_pauseMngr().Paused(); } void CRenderDevice::OnWM_Activate(WPARAM wParam, LPARAM /*lParam*/) { - u16 fActive = LOWORD(wParam); - const BOOL fMinimized = (BOOL)HIWORD(wParam); + const BOOL isWndActive = (1 == wParam) ? TRUE : FALSE; - const BOOL isWndActive = (fActive != WA_INACTIVE && (!fMinimized)) ? TRUE : FALSE; if (!editor() && !GEnv.isDedicatedServer && isWndActive) pInput->ClipCursor(true); else