diff mbox

[4/5] sdl: Grab input on end of non-absolute mouse click

Message ID 60206186c53e7984c07a98851df83e2b32ab74f3.1328013930.git.jan.kiszka@siemens.com
State New
Headers show

Commit Message

Jan Kiszka Jan. 31, 2012, 12:45 p.m. UTC
By grabbing the input already on button down, we leave the button in
that state for the host GUI. Thus it takes another click after releasing
the input again to synchronize the mouse button state.

Avoid this by grabbing on button up.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 ui/sdl.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/ui/sdl.c b/ui/sdl.c
index 0d3a889..73e5839 100644
--- a/ui/sdl.c
+++ b/ui/sdl.c
@@ -802,8 +802,7 @@  static void handle_mousebutton(DisplayState *ds, SDL_Event *ev)
 
     bev = &ev->button;
     if (!gui_grab && !kbd_mouse_is_absolute()) {
-        if (ev->type == SDL_MOUSEBUTTONDOWN &&
-            (bev->button == SDL_BUTTON_LEFT)) {
+        if (ev->type == SDL_MOUSEBUTTONUP && bev->button == SDL_BUTTON_LEFT) {
             /* start grabbing all events */
             sdl_grab_start();
         }