qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1 of 2] sdl nograb


From: Anthony Liguori
Subject: Re: [Qemu-devel] [PATCH 1 of 2] sdl nograb
Date: Tue, 04 Nov 2008 13:08:46 -0600
User-agent: Thunderbird 2.0.0.17 (X11/20080925)

Stefano Stabellini wrote:
Add a -nograb command line option to prevent sdl from grabbing mouse
and keyboard.

Signed-off-by: Stefano Stabellini <address@hidden>

diff -r 5c78dd111aae sdl.c
--- a/sdl.c     Tue Nov 04 09:04:41 2008 +0000
+++ b/sdl.c     Tue Nov 04 18:31:02 2008 +0000
@@ -451,7 +451,7 @@
                         gui_key_modifier_pressed = 0;
                         if (gui_keysym == 0) {
                             /* exit/enter grab if pressing Ctrl-Alt */
-                            if (!gui_grab) {
+                            if (!gui_grab && !grab_disabled) {
                                 /* if the application is not active,
                                    do not try to enter grab state. It
                                    prevents
@@ -481,7 +481,7 @@
             break;
         case SDL_MOUSEMOTION:
             if (gui_grab || kbd_mouse_is_absolute() ||
-                absolute_enabled) {
+                absolute_enabled || grab_disabled) {
                 sdl_send_mouse_event(ev->motion.xrel, ev->motion.yrel, 0,
                        ev->motion.x, ev->motion.y, ev->motion.state);
             }
@@ -490,7 +490,7 @@
         case SDL_MOUSEBUTTONUP:
             {
                 SDL_MouseButtonEvent *bev = &ev->button;
-                if (!gui_grab && !kbd_mouse_is_absolute()) {
+                if (!gui_grab && !kbd_mouse_is_absolute() && !grab_disabled) {
                     if (ev->type == SDL_MOUSEBUTTONDOWN &&
                         (bev->button == SDL_BUTTON_LEFT)) {
                         /* start grabbing all events */
@@ -655,7 +655,10 @@
     atexit(sdl_cleanup);
     if (full_screen) {
         gui_fullscreen = 1;
-        gui_fullscreen_initial_grab = 1;
-        sdl_grab_start();
+        if (!grab_disabled)
+        {
+            gui_fullscreen_initial_grab = 1;
+            sdl_grab_start();
+        }

Code formatting is off here (should be if () {).

In principle, I think this patch is good. I wonder if we should introduce some sort of way to pass sdl options and fold -no-quit and -no-grab into the same command. Like -sdlopts no-quit,no-grab.

Regards,

Anthony Liguori





reply via email to

[Prev in Thread] Current Thread [Next in Thread]