From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Kxgvp-0004p2-97 for qemu-devel@nongnu.org; Wed, 05 Nov 2008 06:52:17 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Kxgvn-0004nj-Vv for qemu-devel@nongnu.org; Wed, 05 Nov 2008 06:52:16 -0500 Received: from [199.232.76.173] (port=40470 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kxgvn-0004nF-GJ for qemu-devel@nongnu.org; Wed, 05 Nov 2008 06:52:15 -0500 Received: from smtp.ctxuk.citrix.com ([62.200.22.115]:49341 helo=SMTP.EU.CITRIX.COM) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Kxgvn-0008EU-Cc for qemu-devel@nongnu.org; Wed, 05 Nov 2008 06:52:15 -0500 Message-ID: <491189B5.9020801@eu.citrix.com> Date: Wed, 05 Nov 2008 11:55:33 +0000 From: Stefano Stabellini MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH] sdl hide pointer when not in focus 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 Hide the mouse pointer when the sdl window is not in focus and the mouse is in absolute mode. Signed-off-by: Stefano Stabellini --- diff -r 5c78dd111aae sdl.c --- a/sdl.c Tue Nov 04 09:04:41 2008 +0000 +++ b/sdl.c Wed Nov 05 11:47:07 2008 +0000 @@ -520,6 +520,12 @@ !ev->active.gain && !gui_fullscreen_initial_grab) { sdl_grab_end(); } + /* Send mouse pointer to oblivion on focus change */ + if ((ev->active.state == SDL_APPINPUTFOCUS) || + (ev->active.state == SDL_APPMOUSEFOCUS)) { + if (ev->active.gain != SDL_ENABLE && kbd_mouse_is_absolute()) + kbd_mouse_event(0x7FFF, 0x7FFF, 0, 0); + } if (ev->active.state & SDL_APPACTIVE) { if (ev->active.gain) { /* Back to default interval */