From 790c2b39adf6628766598d7e96cf8349f969e7e1 Mon Sep 17 00:00:00 2001 From: Quantum Date: Sat, 9 Jan 2021 23:50:49 -0500 Subject: [PATCH] [client] spice: set absolute position and focus state on Wayland --- client/src/main.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/client/src/main.c b/client/src/main.c index 19832369..fcbe750d 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -1206,6 +1206,16 @@ int eventFilter(void * userdata, SDL_Event * event) handleWindowLeave(); break; + case SDL_WINDOWEVENT_FOCUS_GAINED: + if (g_state.wminfo.subsystem != SDL_SYSWM_X11) + g_state.focused = true; + break; + + case SDL_WINDOWEVENT_FOCUS_LOST: + if (g_state.wminfo.subsystem != SDL_SYSWM_X11) + g_state.focused = false; + break; + case SDL_WINDOWEVENT_SIZE_CHANGED: case SDL_WINDOWEVENT_RESIZED: if (g_state.wminfo.subsystem != SDL_SYSWM_X11) @@ -1423,6 +1433,9 @@ int eventFilter(void * userdata, SDL_Event * event) if (g_state.wminfo.subsystem == SDL_SYSWM_X11) break; + g_cursor.pos.x = event->motion.x; + g_cursor.pos.y = event->motion.y; + if (g_cursor.grab) handleMouseGrabbed(event->motion.xrel, event->motion.yrel); else