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 719

Summary: Window positions jumps when clicking on titlebar if input is grabbed
Product: SDL Reporter: Mike Blaguszewski <bugzilla>
Component: videoAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: minor    
Priority: P2 CC: ewmailing, sezeroz
Version: HG 1.2Keywords: target-1.2.14
Hardware: PowerPC   
OS: Mac OS X (All)   
Attachments: Patch to 1.2 HEAD that fixes the issue

Description Mike Blaguszewski 2009-03-23 13:29:52 UTC
To reproduce:
1. Start an SDL application that grabs mouse input. Run it in a window.
2. Use command-tab to switch to another application
3. Switch back to the SDL app by clicking on the titlebar
4. The window position will jump several hundred pixels, often putting it partly offscreen. Since cursor input is captured, there's not necessarily a user workaround.
Comment 1 Mike Blaguszewski 2009-03-23 13:32:22 UTC
Created attachment 307 [details]
Patch to 1.2 HEAD that fixes the issue

Fixes bug in SDL 1.2.13 where clicking on an app's title bar to activate the app, when cursor capturing is enabled, will cause the window to jump. This is because SDL's handler for activate events calls a low-level Quartz function to move the cursor. Calling this when the mouse is down in the title bar confuses the WindowServer into thinking the title bar has been dragged. The patch defers processing of activate events in this case.

The bottom line is that CGWarpMouseCursorPosition() is not safe to call when the mouse in down in a window's title bar.
Comment 2 Mike Blaguszewski 2009-03-23 13:36:04 UTC
I should note that I'm submitting this patch to comply with the LGPL, since it is used in shipping products. We'd previously submitted this privately, but I think there was a miscommunication. I apologize for the delay. If someone thinks this is likely to be an issue in 1.3 as well, I can make a patch for that too. It's a nasty bug to track down, and I'd hate to see others bitten by it.
Comment 3 Ryan C. Gordon 2009-09-13 16:33:12 UTC
Tagging this bug with "target-1.2.14" so we can try to resolve it for SDL 1.2.14.

Please note that we may choose to resolve it as WONTFIX. This tag is largely so we have a comprehensive wishlist of bugs to examine for 1.2.14 (and so we can close bugs that we'll never fix, rather than have them live forever in Bugzilla).

--ryan.
Comment 4 Eric wing 2009-09-21 05:01:56 UTC
Would you supply a simple test program that reproduces the problem?
Comment 5 Sam Lantinga 2009-09-23 00:14:16 UTC
I can reproduce this with his steps.
Comment 6 Sam Lantinga 2009-09-23 00:19:24 UTC
This is fixed in subversion, thanks!