Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FjDb5-00032t-Ed for qemu-devel@nongnu.org; Thu, 25 May 2006 07:01:43 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FjDb2-00032D-Cj for qemu-devel@nongnu.org; Thu, 25 May 2006 07:01:42 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FjDb2-00032A-7x for qemu-devel@nongnu.org; Thu, 25 May 2006 07:01:40 -0400 Received: from [212.16.62.50] (helo=mail.13thfloor.at) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FjDfg-0005oV-Ae for qemu-devel@nongnu.org; Thu, 25 May 2006 07:06:28 -0400 Date: Thu, 25 May 2006 13:01:37 +0200 From: Herbert Poetzl Message-ID: <20060525110137.GB17024@MAIL.13thfloor.at> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] sdl fix for mouse grab/hide Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Qemu mailing list Hi Folks! IMHO the idea behind the grab/mouse hide was to have relative mouse moves inside the window when the mouse is grabbed ... now the SDL documentation SDL_MouseMotionEvent(3) says the following: If the cursor is hidden (SDL_ShowCursor(0)) and the input is grabbed (SDL_WM_GrabInput(SDL_GRAB_ON)), then the mouse will give relative motion events even when the cursor reaches the edge fo the screen. which is almost met, except for qemu _not_ using the SDL_ShowCursor() but instead doing a special SDL_SetCursor(sdl_cursor_hidden), which results in SDL _not_ transmitting the relative motion events once the border is reached, which in turn gives funny behaviour :) the following patch fixes this: diff -NurpP qemu-cvs20060522/sdl.c qemu-cvs20060522/sdl.c --- qemu-cvs20060522/sdl.c 2006-05-23 01:18:33.000000000 +0200 +++ qemu-cvs20060522/sdl.c 2006-05-23 03:03:19.000000000 +0200 @@ -285,13 +285,13 @@ static void sdl_update_caption(void) static void sdl_hide_cursor(void) { - SDL_SetCursor(sdl_cursor_hidden); + SDL_ShowCursor(0); } static void sdl_show_cursor(void) { if (!kbd_mouse_is_absolute()) { - SDL_SetCursor(sdl_cursor_normal); + SDL_ShowCursor(1); } } best, Herbert