|
|
35faab |
From: Cole Robinson <crobinso@redhat.com>
|
|
|
35faab |
Date: Fri, 6 May 2016 12:36:46 -0400
|
|
|
35faab |
Subject: [PATCH] ui: sdl2: Release grab before opening console window
|
|
|
35faab |
|
|
|
35faab |
sdl 2.0.4 currently has a bug which causes our UI shortcuts to fire
|
|
|
35faab |
rapidly in succession:
|
|
|
35faab |
|
|
|
35faab |
https://bugzilla.libsdl.org/show_bug.cgi?id=3287
|
|
|
35faab |
|
|
|
35faab |
It's a toss up whether ctrl+alt+f or ctrl+alt+2 will fire an
|
|
|
35faab |
odd or even number of times, thus determining whether the action
|
|
|
35faab |
succeeds or fails.
|
|
|
35faab |
|
|
|
35faab |
Opening monitor/serial windows is doubly broken, since it will often
|
|
|
35faab |
lock the UI trying to grab the pointer:
|
|
|
35faab |
|
|
|
35faab |
0x00007fffef3720a5 in SDL_Delay_REAL () at /lib64/libSDL2-2.0.so.0
|
|
|
35faab |
0x00007fffef3688ba in X11_SetWindowGrab () at /lib64/libSDL2-2.0.so.0
|
|
|
35faab |
0x00007fffef2f2da7 in SDL_SendWindowEvent () at /lib64/libSDL2-2.0.so.0
|
|
|
35faab |
0x00007fffef2f080b in SDL_SetKeyboardFocus () at /lib64/libSDL2-2.0.so.0
|
|
|
35faab |
0x00007fffef35d784 in X11_DispatchFocusIn.isra.8 () at /lib64/libSDL2-2.0.so.0
|
|
|
35faab |
0x00007fffef35dbce in X11_DispatchEvent () at /lib64/libSDL2-2.0.so.0
|
|
|
35faab |
0x00007fffef35ee4a in X11_PumpEvents () at /lib64/libSDL2-2.0.so.0
|
|
|
35faab |
0x00007fffef2eea6a in SDL_PumpEvents_REAL () at /lib64/libSDL2-2.0.so.0
|
|
|
35faab |
0x00007fffef2eeab5 in SDL_WaitEventTimeout_REAL () at /lib64/libSDL2-2.0.so.0
|
|
|
35faab |
0x000055555597eed0 in sdl2_poll_events (scon=0x55555876f928) at ui/sdl2.c:593
|
|
|
35faab |
|
|
|
35faab |
We can work around that hang by ungrabbing the pointer before launching
|
|
|
35faab |
a new window. This roughly matches what our sdl1 code does
|
|
|
35faab |
---
|
|
|
35faab |
ui/sdl2.c | 4 ++++
|
|
|
35faab |
1 file changed, 4 insertions(+)
|
|
|
35faab |
|
|
|
35faab |
diff --git a/ui/sdl2.c b/ui/sdl2.c
|
|
|
35faab |
index d042442..909038f 100644
|
|
|
35faab |
--- a/ui/sdl2.c
|
|
|
35faab |
+++ b/ui/sdl2.c
|
|
|
35faab |
@@ -357,6 +357,10 @@ static void handle_keydown(SDL_Event *ev)
|
|
|
35faab |
case SDL_SCANCODE_7:
|
|
|
35faab |
case SDL_SCANCODE_8:
|
|
|
35faab |
case SDL_SCANCODE_9:
|
|
|
35faab |
+ if (gui_grab) {
|
|
|
35faab |
+ sdl_grab_end(scon);
|
|
|
35faab |
+ }
|
|
|
35faab |
+
|
|
|
35faab |
win = ev->key.keysym.scancode - SDL_SCANCODE_1;
|
|
|
35faab |
if (win < sdl2_num_outputs) {
|
|
|
35faab |
sdl2_console[win].hidden = !sdl2_console[win].hidden;
|