| Summary: | SDL thinks mouse button is held down | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Terry Welsh <mogumbo> |
| Component: | events | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | grimfang4 |
| Version: | 2.0.2 | ||
| Hardware: | x86_64 | ||
| OS: | Windows (All) | ||
It looks like this is fixed in the latest SDL snapshot: http://www.libsdl.org/tmp/SDL-2.0.zip |
Windows appears to send extra mouse button press events to SDL windows sometimes. There is no accompanying mouse button release event, causing SDL_GetMouseState() and SDL_GetRelativeMouseState() to return a non-zero button state while no buttons are held down. Replicate it using an SDL program that uses the mouse button state or add this bit of code to the end of the main loop in testsprite2: Uint32 mousestate = SDL_GetMouseState(NULL, NULL); if(mousestate != 0) SDL_Delay(200); Then click on the desktop or a random window. Hold a mouse button down while you Alt-Tab into your SDL program. Release the mouse button. SDL should now think the button is still held down. Jonny D reports causing the problem a different way: "I'm calling the Windows function GetOpenFileName() which opens a system dialog. When I double-click a file in the dialog, it returns to my program with the mouse button stuck down. If I click, the new mouse down event doesn't happen and I get the new mouse up event instead of the old one (which is lost completely). If I Alt-Tab out and back in again, I also get a new mouse up event without clicking at all. Clicking other mouse buttons does not affect the stuck one." Related email thread: http://lists.libsdl.org/pipermail/sdl-libsdl.org/2014-March/093562.html