Skip to content

Commit

Permalink
xrEngine: fix inactive render
Browse files Browse the repository at this point in the history
  • Loading branch information
eagleivg authored and Xottab-DUTY committed Jul 24, 2018
1 parent b3e56d3 commit 6b197d4
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions src/xrEngine/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6b197d4

Please sign in to comment.