We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 101

Summary: X11 mouse and focus loss
Product: SDL Reporter: Ryan C. Gordon <icculus>
Component: videoAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: HG 1.2   
Hardware: All   
OS: Linux   
Attachments: Reproduction case.

Description Ryan C. Gordon 2006-01-27 12:55:06 UTC
Scenario:

A message window pops up and the SDL fullscreen window loses focus. Under the hood, SDL responds to this by reverting to a window, but doesn't seem to unlock the mouse cursor; the cursor sits visible in the center of the newly-windowed SDL surface. This is happening reliably here with both metacity and icewm window managers in a Gnome environment on XFree86 4.3.0 (gentoo's 4.3.0-r3, specifically)...also happens with Metacity on x.org 6.8.2 (Ubuntu 5.10 default).

At the application level, if I call SDL_ShowCursor(1) in my SDL_ACTIVEEVENT handler, the mouse moves correctly across the desktop. So the SDL_ACTIVEEVENT code ends up looking like:

    case SDL_ACTIVEEVENT:
        SDL_ShowCursor(event.active.gain ? 0 : 1);
        break;

I've attached a program to demonstrate this. Run it, ssh in to your box and launch an xterm so the SDL window loses focus. See how mouse cursor becomes visible but doesn't move. Exit the new xterm so it goes away and (hopefully) returns focus to your SDL window, and hit ESC to terminate the program.

Rerun program with --showhide to manually show/hide the cursor in the SDL_ACTIVEEVENT handler, which "fixes" the issue.

You may also notice that the windowed SDL surface resists being dragged around by its title bar, but that might just be metacity.

--ryan.
Comment 1 Ryan C. Gordon 2006-01-27 12:55:27 UTC
Tossing to Sam.

--ryan.

Comment 2 Ryan C. Gordon 2006-01-27 12:56:05 UTC
Created attachment 45 [details]
Reproduction case.


Attached test program.

--ryan.
Comment 3 Sam Lantinga 2006-04-27 06:44:59 UTC
This is fixed in SVN, thanks!