Skip to contentSkip to conversation

sdl hide pointer when not in focus

PATCH New Stefano Stabellini 1 participant 1 message Nov 5, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sdl hide pointer when not in focus

Hide the mouse pointer when the sdl window is not in focus and the mouse is in absolute mode.

---

sdl.c +6 -0
diff -r 5c78dd111aae sdl.c
@@ -520,6 +520,12 @@
                 !ev->active.gain && !gui_fullscreen_initial_grab) {
                 sdl_grab_end();
             }
+            /* Send mouse pointer to oblivion on focus change */
+            if ((ev->active.state == SDL_APPINPUTFOCUS) ||
+                (ev->active.state == SDL_APPMOUSEFOCUS)) {
+                if (ev->active.gain != SDL_ENABLE && kbd_mouse_is_absolute())
+                    kbd_mouse_event(0x7FFF, 0x7FFF, 0, 0);
+            }
             if (ev->active.state & SDL_APPACTIVE) {
                 if (ev->active.gain) {
                     /* Back to default interval */