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 - SDL_SetWindowPosition does not respect the display passed in for SDL_WINDOWPOS_CENTERED_DISPLAY(?)
Summary: SDL_SetWindowPosition does not respect the display passed in for SDL_WINDOWPO...
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: HG 2.0
Hardware: x86 Other
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords: triage-2.0.4
Depends on:
Blocks:
 
Reported: 2015-01-19 17:46 UTC by Edward Rudd
Modified: 2015-02-20 00:42 UTC (History)
1 user (show)

See Also:


Attachments
Patch to fix the SetWindowPosition behvior (1.40 KB, application/mbox)
2015-01-19 17:46 UTC, Edward Rudd
Details
updated patch to be C90 compliant. (1.40 KB, patch)
2015-02-11 18:59 UTC, Edward Rudd
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.