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 2849

Summary: SDL_SetWindowPosition does not respect the display passed in for SDL_WINDOWPOS_CENTERED_DISPLAY(?)
Product: SDL Reporter: Edward Rudd <urkle>
Component: videoAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: icculus
Version: HG 2.0Keywords: triage-2.0.4
Hardware: x86   
OS: Other   
Attachments: Patch to fix the SetWindowPosition behvior
updated patch to be C90 compliant.

Description Edward Rudd 2015-01-19 17:46:48 UTC
Created attachment 1995 [details]
Patch to fix the SetWindowPosition behvior

When I run this SDL code

SDL_SetWindowPosition(sdlWin, SDL_WINDOWPOS_CENTERED_DISPLAY(1), SDL_WINDOWPOS_CENTERED_DISPLAY(1));

I expect the window to 'move' from the first screen to the second screen. However it doesn't as the SetWindowPosition code only looks at where the window currently is to determine the display index.

a side-effect of this change would be that if some existing code *assumed* that this code

SDL_SetWindowPosition(sdlWin, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);

would center the window on the current monitor, would start to not work as expected. (it would always center on the first monitor)

However, that is undocumented behaviour, and I believe this patch implements the correct expected behavior of this method.
Comment 1 Edward Rudd 2015-02-11 18:59:39 UTC
Created attachment 2029 [details]
updated patch to be C90 compliant.
Comment 2 Ryan C. Gordon 2015-02-19 05:22:15 UTC
Marking a large number of bugs with the "triage-2.0.4" keyword at once. Sorry if you got a lot of email from this. This is to help me sort through some bugs in regards to a 2.0.4 release. We may or may not fix this bug for 2.0.4, though!
Comment 3 Ryan C. Gordon 2015-02-20 00:42:03 UTC
This patch is now https://hg.libsdl.org/SDL/rev/c9a4d606f6db, thanks!

--ryan.