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 486

Summary: Mouse resets to center position every four seconds in fullscreen mode
Product: SDL Reporter: Tapio Raevaara <tapio.raevaara>
Component: eventsAssignee: Sam Lantinga <slouken>
Status: RESOLVED WORKSFORME QA Contact: Sam Lantinga <slouken>
Severity: major    
Priority: P2 CC: bugzilla, espen_g, m.arefiev
Version: 1.2.12   
Hardware: x86   
OS: Linux   

Description Tapio Raevaara 2007-08-31 05:03:01 UTC
In games which capture the mouse inside the window or use fullscreen mode, the mouse will reset or jump to starting/center position exactly every four seconds.

This should not happen, as it will make playing such games practically impossible.

Steps to reproduce:
  1) Start up just about any(*) SDL game which captures the mouse inside the window (Hexen II: Hammer of Thyrion, PrBoom, Critical Mass, Battle for Wesnoth in fullscreen mode etc.)
  2) Move the mouse around a bit.
=> Every four seconds the view (in FPS games) or the mouse cursor will return to starting position.

(*) Vavoom is the only exception to this rule I've encountered.

My environment:
- Gentoo Linux
- libsdl version 1.2.12, compiled from source by Gentoo's Portage Package Management System
- Athlon XP 2200+
- CFLAGS="-O2 -fomit-frame-pointer -march=athlon-xp -pipe -mfpmath=sse -m3dnow -mmmx -msse"

I'd be happy to provide more information if needed. I'd also be grateful for (information on) any hack or workaround to circumvent this problem, even if it might cause other problems and/or never make the official release.

Thank you for your time!
Comment 1 Arefiev 2007-10-14 15:29:08 UTC
I am experiencing this thing too, but with jump period of ≈8 seconds.
LibSDL 1.2.12-1, X.org 1:7.3+2, kernel 2.6.22-1-k7 (Debian stock), sinful proprietary drivers from nVidia 100.14.11-1 and xserver-xorg-video-nv 1:2.1.2-2 (tried both).
Graphic card is GeForce 5600XT.
Comment 2 Espen Grønvold 2008-11-09 02:14:27 UTC
What kind of mouse/mouse driver are you guys using? If you are using an "evdev" mouse it might be related to bug 617.
Comment 3 Sam Lantinga 2009-09-27 17:11:25 UTC
Is this still happening with the latest SDL snapshot?
http://www.libsdl.org/tmp/SDL-1.2.zip
Comment 4 Sam Lantinga 2009-10-17 11:07:03 UTC
No response from the customer, I'm closing this for now.  Please reopen this as a 1.3 bug if it's an issue there.
Comment 5 Olivier Fabre 2011-03-09 04:00:55 UTC
This is probably caused by "unclutter". Unclutter is a tool that hides the mouse pointer after a few (user-configurable) seconds. I'm using it and most SDL games have this problem. Killing unclutter resolves it.

It would be nice if it didn't happen though, but I haven't had a look at either unclutter of SDL's source code to see what's causing that behaviour...
Comment 6 Olivier Fabre 2011-03-09 05:10:00 UTC
Using the "-grab" option of unclutter seems to solve the issue for me and my program (which uses SDL_WM_GrabInput(SDL_GRAB_ON).) This option doesn't seem to cause any problem at first sight...

Unclutter README: http://ftp.x.org/contrib/utilities/unclutter-8.README
Source code: http://ftp.x.org/contrib/utilities/unclutter-8.tar.Z
Comment 7 Sam Lantinga 2011-03-09 09:15:43 UTC
Yeah, if you are using grab in your SDL application, it means that unclutter can't manipulate the mouse, so you need unclutter to grab the mouse and modify the cursor.