sdl: Grab input on end of non-absolute mouse click

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>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
Jan Kiszka 2012-01-31 13:45:30 +01:00 committed by Anthony Liguori
parent eaa2e027b7
commit 822f98d2a5

View File

@ -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();
}