From b96ace7f0439eb5b15b1157fa642d2915e2c22e6 Mon Sep 17 00:00:00 2001 From: Janne Hakonen Date: Sun, 2 Sep 2018 00:31:37 +0300 Subject: [PATCH] Release mouse cursor when window focus is lost --- app/streaming/session.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/streaming/session.cpp b/app/streaming/session.cpp index 4f93d881..6c9a9fbd 100644 --- a/app/streaming/session.cpp +++ b/app/streaming/session.cpp @@ -849,6 +849,12 @@ void Session::exec() } case SDL_WINDOWEVENT: + // Release mouse cursor when another window is activated (e.g. by using ALT+TAB). + // This lets user to interact with our window's title bar and with the buttons in it. + if (event.window.event == SDL_WINDOWEVENT_FOCUS_LOST) { + SDL_SetRelativeMouseMode(SDL_FALSE); + } + // We want to recreate the decoder for resizes (full-screen toggles) and the initial shown event. // We use SDL_WINDOWEVENT_SIZE_CHANGED rather than SDL_WINDOWEVENT_RESIZED because the latter doesn't // seem to fire when switching from windowed to full-screen on X11.