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 1037

Summary: SDL_VIDEO_CENTERED and OpenGL generating incorrect mouse coordinates
Product: SDL Reporter: sa666666
Component: eventsAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: major    
Priority: P2 CC: jspradlin, puNES.development, sa666666
Version: 1.2.14   
Hardware: All   
OS: Linux   
Attachments: Fix superfluous ConfigureNotify event

Description sa666666 2010-08-01 15:48:46 UTC
Created attachment 529 [details]
Fix superfluous ConfigureNotify event

This following description assumes Linux, OpenGL mode, and using the SDL_VIDEO_CENTERED environment variable.

When creating a larger screen after initially creating a smaller one, mouse button and motion x/y coordinates are clamped to the smaller size, even when that window no longer exists.

I've traced the problem to the new 'SetMouseRange' function in SDL 1.2.14, which clamps the mouse coordinates to the current screen size.  However, since this is initiated from a ConfigureNotify event, and that event is received *after* the new (larger) screen is created, the mouse tracking is no longer valid.

I've fixed this issue by making sure a ConfigureNotify event isn't generated after an XMoveWindow caused by parsing the SDL_VIDEO_CENTERED variable.

Attached is a proposed solution.  Hopefully this can be added to release 1.2.15, as I'm not sure how to work around it in my app.
Comment 1 FHorse 2011-01-06 03:13:45 UTC
I have the same problem when I using SDL_VIDEO_WINDOW_POS environment variable.
Comment 2 Jen Spradlin 2011-04-12 20:22:14 UTC
Thank you for your bug report!

We're busy working on getting SDL 1.3 ready for a high quality release, and want to make sure as many things are fixed there as possible.
Could you check to see if your bug is resolved by the latest SDL 1.3 snapshot?
http://www.libsdl.org/tmp/SDL-1.3.zip

Thanks!
Comment 3 Ryan C. Gordon 2011-08-21 08:09:17 UTC
This patch was applied a few months ago: hg changeset 67d3be4ec9f2.

Thanks!

--ryan.