sdl: Do not grab mouse on mode switch while in background
PATCH 1/1 sdl: Do not grab mouse on mode switch while in background
From: Jan Kiszka <[email protected]>
When the mouse mode changes to absolute while the SDL windows is not in focus, refrain from grabbing the input. It would steal from some other window.
---
I bet this makes no difference for your problem, Erik, but I came across this while trying to reproduce the issue.
ui/sdl.c | 30 ++++++++++++++++-------------- 1 files changed, 16 insertions(+), 14 deletions(-)
ui/sdl.c +16 -14
@@ -483,12 +483,27 @@ static void sdl_grab_end(void)sdl_update_caption (); } +static void absolute_mouse_grab (void ) +{ +int mouse_x, mouse_y; + +if (SDL_GetAppState () &SDL_APPINPUTFOCUS ) { +SDL_GetMouseState (&mouse_x, &mouse_y); +if (mouse_x >0 && mouse_x < real_screen->w -1 && + mouse_y >0 && mouse_y < real_screen->h -1 ) { +sdl_grab_start (); + } + } +} +static void sdl_mouse_mode_change (Notifier *notify,void *data) {if (kbd_mouse_is_absolute ()) {if (!absolute_enabled) { -sdl_grab_start (); absolute_enabled =1 ; +if (is_graphic_console ()) { +absolute_mouse_grab (); + } } }else if (absolute_enabled) {if (!gui_fullscreen) {
@@ -571,19 +586,6 @@ static void toggle_full_screen(DisplayState *ds)vga_hw_update (); } -static void absolute_mouse_grab (void ) -{ -int mouse_x, mouse_y; - -if (SDL_GetAppState () &SDL_APPINPUTFOCUS ) { -SDL_GetMouseState (&mouse_x, &mouse_y); -if (mouse_x >0 && mouse_x < real_screen->w -1 && - mouse_y >0 && mouse_y < real_screen->h -1 ) { -sdl_grab_start (); - } - } -} -static void handle_keydown (DisplayState *ds,SDL_Event *ev) {int mod_state;
Signature · 1 line
1.7.3.4
Quoted 5 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
When the mouse mode changes to absolute while the SDL windows is not in focus, refrain from grabbing the input. It would steal from some other window.
I'll send out a SDL series with fixes and will include this. So forget about it for trivial.
Thanks,
Jan
Quoted 63 lines
Signed-off-by Jan Kiszka <[email protected]>---
I bet this makes no difference for your problem, Erik, but I came across this while trying to reproduce the issue.
ui/sdl.c | 30 ++++++++++++++++-------------- 1 files changed, 16 insertions(+), 14 deletions(-)ui/sdl.c +16
-14@@ -483,12 +483,27 @@ static void sdl_grab_end(void)sdl_update_caption (); } +static void absolute_mouse_grab (void ) +{ +int mouse_x, mouse_y; + +if (SDL_GetAppState () &SDL_APPINPUTFOCUS ) { +SDL_GetMouseState (&mouse_x, &mouse_y); +if (mouse_x >0 && mouse_x < real_screen->w -1 && + mouse_y >0 && mouse_y < real_screen->h -1 ) { +sdl_grab_start (); + } + } +} +static void sdl_mouse_mode_change (Notifier *notify,void *data) {if (kbd_mouse_is_absolute ()) {if (!absolute_enabled) { -sdl_grab_start (); absolute_enabled =1 ; +if (is_graphic_console ()) { +absolute_mouse_grab (); + } } }else if (absolute_enabled) {if (!gui_fullscreen) {@@ -571,19 +586,6 @@ static void toggle_full_screen(DisplayState *ds)vga_hw_update (); } -static void absolute_mouse_grab (void ) -{ -int mouse_x, mouse_y; - -if (SDL_GetAppState () &SDL_APPINPUTFOCUS ) { -SDL_GetMouseState (&mouse_x, &mouse_y); -if (mouse_x >0 && mouse_x < real_screen->w -1 && - mouse_y >0 && mouse_y < real_screen->h -1 ) { -sdl_grab_start (); - } - } -} -static void handle_keydown (DisplayState *ds,SDL_Event *ev) {int mod_state;