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

SDL_GetWindowPosition() always returns (0, 0) in fullscreen #1060

Closed
SDLBugzilla opened this issue Feb 10, 2021 · 0 comments
Closed

SDL_GetWindowPosition() always returns (0, 0) in fullscreen #1060

SDLBugzilla opened this issue Feb 10, 2021 · 0 comments

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

Reported in version: HG 2.0
Reported for operating system, platform: All, x86_64

Comments on the original bug report:

On 2013-08-31 23:35:42 +0000, Daniel Gibson wrote:

When I have a window on my second (right) screen, the position I get from SDL_GetWindowPosition() is something like (2151, 276), as I would expect - my first (left) screen has a resolution of 1920x1200, so the screen right of it should start with x=1920.

SDL_GetWindowPosition however always returns (0,0) as Window position, which is also quite obvious from the implementation:
"if (window->flags & SDL_WINDOW_FULLSCREEN)" it just sets x and y to 0, because
"/* Fullscreen windows are always at their display's origin */"

This is of course inconsistent: In windowed mode the function returns a global (across all displays) coordinate, but in fullscreen mode the coordinate on the display it's on.. I guess this is a SDL1.2 leftover?

SDL_Window.x and .y contained the expected values (1920, 0), by the way, so at least on my platform (Linux/X11/xrandr) always returning those would be correct.

By the way, SDL_GetWindowBounds(SDL_Window*, SDL_Rect*) that works analogous to SDL_GetDisplayBounds() would be nice :)

On 2013-08-31 23:38:34 +0000, Daniel Gibson wrote:

(In reply to Daniel Gibson from comment # 0)

SDL_GetWindowPosition however always returns (0,0) as Window position, which
is also quite obvious from the implementation:

This should have been "In fullscreen mode SDL_GetWindowPosition() however always returns (0,0) as Window position, ..."

On 2015-09-13 04:09:50 +0000, Alex Szpakowski wrote:

This should be fixed with this commit: https://hg.libsdl.org/SDL/rev/cfeb59daba69

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

No branches or pull requests

1 participant