Hi.<br><br>I&#39;ve been trying to isolate the cause of a weird mouse click bug i&#39;m
experiencing in my package gource in Squeeze. I also managed to replicate in another SDL
application that also grabs mouse focus in a similar way called Neverball (neverball).<br>
<br>If you open Gource 0.26 (you will need to point Gource at a git repository eg &#39;gource my-project.git/&#39; ), drag the mouse on the background,
and release, the next &#39;mouse down&#39; click event will get lost by the window manager (the &#39;mouse up&#39; event when the button is finally released is still received). In fact, the next click doesn&#39;t even have to be on Gource - eg you can click on another application and that click will not register.<br>
<br>Likewise, in Neverball once you get into the game it grabs the
mouse focus and hides the mouse pointer to control the Ball with the mouse. If you press ESC to go back to
the menu and try to click a button on the menu, the first click wont register.<br><br>It
seems to happen only if the application grabs mouse focus AND hides the
cursor. For instance, the game Abuse (abuse) lets you toggle grabbing
the mouse by pressing F12, but doesn&#39;t use the window managers mouse
cursor, and this doesn&#39;t lose the mouse click.<br><br>Basically programs that use this idiom:<br>
<br>SDL_WM_GrabInput(SDL_GRAB_ON);<br>

SDL_ShowCursor(false);<br>

<br>...<br><br>
SDL_WM_GrabInput(SDL_GRAB_OFF);<br>
SDL_ShowCursor(true);<br>
<br>
Seem to be affected.<br>
<br>The work around I&#39;ve found is to use SDL_WarpMouse() to warp the cursor to the middle of the screen after each mouse motion event to simulate the behaviour of SDL_WM_GrabInput(SDL_GRAB_ON), and ignore the warp event itself (eg the game Chromium BSU (chromium-bsu) uses this technique).<br>
<br>It may be this is actually a bug in xorg and not specially SDL as the next mouse down event doesn&#39;t register regardless of where you click after SDL_WM_GrabInput(SDL_GRAB_OFF).<br><br>Cheers<br><br>Andrew<br>