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 299 - relative movements of the mouse not working correctly.
Summary: relative movements of the mouse not working correctly.
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: events (show other bugs)
Version: 1.2.10
Hardware: x86 Linux
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
: 348 405 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-08-09 16:30 UTC by Johnny Birnfeld
Modified: 2007-03-03 17:45 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Johnny Birnfeld 2006-08-09 16:30:42 UTC
We have a bug at SDL_Event in the relative mouse movement since SDL-1.2.10. The bug occurs when the mouse cursor start out of the window area and SDL_ShowCursor(  ) is disable and SDL_WM_GrabInput( ) enable and SDL_WarpMouse( ) enable. 
A souce that tests this bug can be found here: http://geocities.yahoo.com.br/megaspeedlinux/testSDLEvent.zip
The program will inform mouse position and relative movement. So if you start the pointer out of the window area and start program, try to move the mouse to the edges of the window. You'll notice that the program stops inform the new relative positions.
This source was compiled with:
g++ testeSDL_event.cpp -o testeSDL_event -lSDL

What can be happening?
Comment 1 Ryan C. Gordon 2006-10-23 05:13:17 UTC
*** Bug 348 has been marked as a duplicate of this bug. ***
Comment 2 rasz 2006-10-23 05:37:01 UTC
I can confirm this in http://tremulous.net (ioquake3) under linux with libsdl 1.2.10

make the game windowed, then open some other window (for example terminal or firefox) and then switch back to tremulous and go fullscreen again = the mouse will think it is still in previous application window(!?!) :( = the mouse will have horizontal and vertical boundaries set = you wont be able to spin/turn freely
Comment 3 rasz 2006-10-23 05:42:52 UTC
also playing Deus Ex under wine exhibits this error + some weird shit
Deus Ex has a splash screen, normally that splash screen dissapears after a second and we are in the game, but sometimes when switching between windowed/fullscreen splash screen appears with mouse grabbed inside it, and the game in the background, game receives mouse events only when you move the mouse to the splash screen borders, but mouse cant escape the splash screen.
Anyway it works ok in 1.2.9, and is broken in 1.2.10
Comment 4 Ryan C. Gordon 2006-11-12 23:07:20 UTC
This is X11-specific.

We're failing to enable DGA mouse events when grabbing the input if the system cursor is outside the window...and the normal X11 mouse event isn't warping the grabbed+hidden cursor to the center of the window (like it used to?), so relative motion gets clamps to the window's edges.

svn revision #2236 broke the DGA code:
http://libsdl.org/cgi/viewvc.cgi/trunk/SDL/src/video/x11/SDL_x11mouse.c?r1=2236&r2=2235&pathrev=2236

It's checking for a focus flag that isn't true if the input is grabbed when the cursor is outside the window (SDL_APPMOUSEFOCUS).

My fix is to report to SDL that the mouse focus has been obtained when SDL_WM_GrabInput(SDL_GRAB_ON) is successfully called, since it happens to be true, due to the XGrabPointer() ... if the X server then tries to report on the real obtaining of the mouse focus, that's okay, SDL won't send the duplicate event to the app.

This allows DGA to enable, as before. Not sure why the warp-the-mouse-to-center hack for non-DGA modes isn't working, though.

Fixed in svn revision #2909.

--ryan.

Comment 5 Ryan C. Gordon 2007-03-03 17:45:21 UTC
*** Bug 405 has been marked as a duplicate of this bug. ***