]> Git Repo - qemu.git/blobdiff - ui/sdl.c
sdl: Consistently avoid grabbing input for text consoles
[qemu.git] / ui / sdl.c
index 80bf776104d23921940a4b445da6c141f3f0f2fd..27465b2b7d7fbdd166131f875e13f34e7e4242af 100644 (file)
--- 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 &&
@@ -891,6 +894,11 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame)
         qemu_free(filename);
     }
 
+    if (full_screen) {
+        gui_fullscreen = 1;
+        sdl_grab_start();
+    }
+
     dcl = qemu_mallocz(sizeof(DisplayChangeListener));
     dcl->dpy_update = sdl_update;
     dcl->dpy_resize = sdl_resize;
@@ -920,8 +928,4 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame)
     sdl_cursor_normal = SDL_GetCursor();
 
     atexit(sdl_cleanup);
-    if (full_screen) {
-        gui_fullscreen = 1;
-        sdl_grab_start();
-    }
 }
This page took 0.024227 seconds and 4 git commands to generate.