From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KxRGn-0001bj-5I for qemu-devel@nongnu.org; Tue, 04 Nov 2008 14:08:53 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KxRGl-0001au-Jz for qemu-devel@nongnu.org; Tue, 04 Nov 2008 14:08:52 -0500 Received: from [199.232.76.173] (port=35976 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KxRGl-0001af-22 for qemu-devel@nongnu.org; Tue, 04 Nov 2008 14:08:51 -0500 Received: from yx-out-1718.google.com ([74.125.44.157]:24911) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KxRGl-0007B2-92 for qemu-devel@nongnu.org; Tue, 04 Nov 2008 14:08:51 -0500 Received: by yx-out-1718.google.com with SMTP id 3so1151811yxi.82 for ; Tue, 04 Nov 2008 11:08:49 -0800 (PST) Message-ID: <49109DBE.70203@codemonkey.ws> Date: Tue, 04 Nov 2008 13:08:46 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 1 of 2] sdl nograb References: <49109615.20500@eu.citrix.com> In-Reply-To: <49109615.20500@eu.citrix.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Ian Jackson Stefano Stabellini wrote: > Add a -nograb command line option to prevent sdl from grabbing mouse > and keyboard. > > Signed-off-by: Stefano Stabellini > > 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