aboutsummaryrefslogtreecommitdiff
path: root/ui/sdl.c
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2011-07-30 11:39:12 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2011-08-05 10:57:35 -0500
commitf85581004c140c09936bc63f3744a287216aa76d (patch)
tree090fac890b79c0e86bfdd34a5eaf065338a750c9 /ui/sdl.c
parent110defd753906a01d01d0cabfb2d8db77b3271ef (diff)
sdl: Consistently avoid grabbing input for text consoles
There were some preexisting bits that released the input when switching to text console. This patch spreads this logic consistently and also avoids grabbing the input while a text console is active. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'ui/sdl.c')
-rw-r--r--ui/sdl.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/ui/sdl.c b/ui/sdl.c
index f19bae2b27..27465b2b7d 100644
--- a/ui/sdl.c
+++ b/ui/sdl.c
@@ -564,8 +564,9 @@ static void toggle_full_screen(DisplayState *ds)
} else {
do_sdl_resize(ds_get_width(ds), ds_get_height(ds), 0);
}
- if (!gui_saved_grab)
+ if (!gui_saved_grab || !is_graphic_console()) {
sdl_grab_end();
+ }
}
vga_hw_invalidate();
vga_hw_update();
@@ -689,8 +690,10 @@ static void sdl_refresh(DisplayState *ds)
'SDL_WM_GrabInput(SDL_GRAB_ON)'
from blocking all the application
(SDL bug). */
- if (SDL_GetAppState() & SDL_APPACTIVE)
+ if (is_graphic_console() &&
+ SDL_GetAppState() & SDL_APPACTIVE) {
sdl_grab_start();
+ }
} else {
sdl_grab_end();
}
@@ -721,7 +724,7 @@ static void sdl_refresh(DisplayState *ds)
break;
case SDL_MOUSEBUTTONDOWN:
case SDL_MOUSEBUTTONUP:
- {
+ if (is_graphic_console()) {
SDL_MouseButtonEvent *bev = &ev->button;
if (!gui_grab && !kbd_mouse_is_absolute()) {
if (ev->type == SDL_MOUSEBUTTONDOWN &&