Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FaZFv-0001Vm-RP for qemu-devel@nongnu.org; Mon, 01 May 2006 10:20:07 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FaZFt-0001T6-RW for qemu-devel@nongnu.org; Mon, 01 May 2006 10:20:07 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FaZFt-0001Sp-LX for qemu-devel@nongnu.org; Mon, 01 May 2006 10:20:05 -0400 Received: from [195.70.61.59] (helo=mail.na.hu) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FaZJi-0000pv-Tw for qemu-devel@nongnu.org; Mon, 01 May 2006 10:24:03 -0400 Received: from [10.0.0.54] (unknown [195.70.61.56]) by mail.na.hu (Postfix) with ESMTP id CE2E919F34B for ; Mon, 1 May 2006 16:31:48 +0200 (CEST) From: Scipio Date: Mon, 1 May 2006 16:19:57 +0200 MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_NkhVEXDb9HBQ43B" Message-Id: <200605011619.57752.scipiox@freemail.hu> Subject: [Qemu-devel] [PATCH]USB tablet auto grab and ungrab 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 --Boundary-00=_NkhVEXDb9HBQ43B Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline With this patch, automatic grab keyboard and mouse when the mouse enters the window, and ungrab when the mouse reachs the window edge. I created this beacuse I want to close a window with ALT+F4 inside qemu, but I closed qemu window, because qemu is not grabbed. Scipio --Boundary-00=_NkhVEXDb9HBQ43B Content-Type: text/x-diff; charset="us-ascii"; name="usbtablet_auto_grab_and_ungrab.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="usbtablet_auto_grab_and_ungrab.diff" diff -u qemu.orig/sdl.c qemu/sdl.c --- qemu.orig/sdl.c 2006-04-12 23:09:08.000000000 +0200 +++ qemu/sdl.c 2006-05-01 15:52:43.000000000 +0200 @@ -330,6 +330,11 @@ } SDL_GetMouseState(&dx, &dy); + if( dx==0 || dx==width-1 || dy==0 || dy==height-1 ) { + if(gui_grab) sdl_grab_end(); + } else { + if(!gui_grab) sdl_grab_start(); + } dx = dx * 0x7FFF / width; dy = dy * 0x7FFF / height; } --Boundary-00=_NkhVEXDb9HBQ43B--