Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConfigureNotify race condition(?) on X11 window resize causes bad mouse coordinate bounding #593

SDLBugzilla opened this issue Feb 10, 2021 · 0 comments


Copy link

SDLBugzilla commented Feb 10, 2021

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: 1.2.14
Reported for operating system, platform: Linux, All

Comments on the original bug report:

On 2010-08-28 07:02:01 +0000, Andrew Church wrote:

If, after calling SDL_SetVideoMode() to resize the window, SDL receives a ConfigureNotify event for the old size, SDL_PrivateResize() will be called with the old size, generating an SDL_VIDEORESIZE event and (significantly) calling SDL_SetMouseRange() on the given size. When the ConfigureNotify for the resized window comes in, it will be dropped because it's the same as the current window size, meaning that SDL_SetMouseRange() still has the old size; if that is smaller than the actual window size, then SDL_GetMouseState() will only return coordinates within that smaller size.

For example, when resizing a window from 800x600 to 1024x768, if a ConfigureNotify for 800x600 comes in after SDL_SetVideoMode(1024,768,...), then SDL_GetMouseState() will only return mouse coordinates in the range (0,0)-(799,599).

I haven't succeeded in reproducing the issue in a simple test program; it may be a race condition that only manifests under load or with a particular code sequence.

The fix is probably to ignore all ConfigureNotify events after a window resize until one is received for the new window size.

On 2010-08-28 07:04:32 +0000, Andrew Church wrote:

Created attachment 537
Possible fix for bug

On 2011-08-23 13:48:56 +0000, Ryan C. Gordon wrote:

A modified version of this patch is now hg changeset ad4ed9f0336f.



Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

No branches or pull requests

1 participant