Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LNZ81-0001Bq-31 for qemu-devel@nongnu.org; Thu, 15 Jan 2009 15:47:49 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LNZ7z-0001B2-M2 for qemu-devel@nongnu.org; Thu, 15 Jan 2009 15:47:48 -0500 Received: from [199.232.76.173] (port=34677 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LNZ7z-0001Au-I4 for qemu-devel@nongnu.org; Thu, 15 Jan 2009 15:47:47 -0500 Received: from savannah.gnu.org ([199.232.41.3]:39418 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LNZ7y-0001Ev-Q9 for qemu-devel@nongnu.org; Thu, 15 Jan 2009 15:47:47 -0500 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1LNZ7y-0004qW-Bu for qemu-devel@nongnu.org; Thu, 15 Jan 2009 20:47:46 +0000 Received: from aliguori by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1LNZ7y-0004qS-2S for qemu-devel@nongnu.org; Thu, 15 Jan 2009 20:47:46 +0000 MIME-Version: 1.0 Errors-To: aliguori Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Anthony Liguori Message-Id: Date: Thu, 15 Jan 2009 20:47:46 +0000 Subject: [Qemu-devel] [6325] Handle SDL grabs failing (Mark McLoughlin) 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 Revision: 6325 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6325 Author: aliguori Date: 2009-01-15 20:47:45 +0000 (Thu, 15 Jan 2009) Log Message: ----------- Handle SDL grabs failing (Mark McLoughlin) If a X window is not viewable, XGrabPointer() fails and returns GrabNotViewable. SDL's X backend currently handles this by retrying the grab until the window becomes viewable again. This means e.g. if you Ctrl-Alt-RightArrow to switch workspaces, QEMU tries to grab, SDL blocks because the window isn't viewable and your guest stops executing until you switch back to that workspace again. See this Fedora bug for the gory details: https://bugzilla.redhat.com/480065 Some SDL backends will return SDL_GRAB_OFF from SDL_WM_GrabInput(), so the fix is to make the X backend do this if the grab fails. The only side-effect in QEMU is that if SDL_WM_GrabInput() fails we still change the window title to indicate that it's grabbed, when in fact it's not. This patch fixes that minor issue. Signed-off-by: Mark McLoughlin Signed-off-by: Anthony Liguori Modified Paths: -------------- trunk/sdl.c Modified: trunk/sdl.c =================================================================== --- trunk/sdl.c 2009-01-15 20:44:26 UTC (rev 6324) +++ trunk/sdl.c 2009-01-15 20:47:45 UTC (rev 6325) @@ -286,9 +286,12 @@ SDL_WarpMouse(guest_x, guest_y); } else sdl_hide_cursor(); - SDL_WM_GrabInput(SDL_GRAB_ON); - gui_grab = 1; - sdl_update_caption(); + + if (SDL_WM_GrabInput(SDL_GRAB_ON) == SDL_GRAB_ON) { + gui_grab = 1; + sdl_update_caption(); + } else + sdl_show_cursor(); } static void sdl_grab_end(void)