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 3845

Summary: SDL_GetWindowPosition() regression in 2.0.6
Product: SDL Reporter: Daniel <daniel.plakhotich>
Component: videoAssignee: Ryan C. Gordon <icculus>
Status: ASSIGNED --- QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: sezeroz, sheppy
Version: don't knowKeywords: target-2.0.16
Hardware: x86_64   
OS: Linux   

Description Daniel 2017-09-24 10:29:02 UTC
Previously (at least in 2.0.4), SDL_GetWindowPosition() returned position of the window decoration, which was consistent with SDL_SetWindowPosition(). I updated to 2.0.6, and it now returns position of the viewport.

It looks like there was something similar in bug 1300.

I don't sure: maybe it's by design, and the bug is actually in SDL_SetWindowPosition(), which should ignore the decoration?
Comment 1 Sam Lantinga 2017-09-24 19:17:12 UTC
Yes, the bug is in SDL_SetWindowPosition()

What window manager are you using?

Ryan, can you take a look when you get a chance?
Comment 2 Daniel 2017-09-25 14:37:04 UTC
My window manager is xfwm4 (Xfce).
Comment 3 Daniel 2017-09-25 16:17:42 UTC
I currently found that this only happens after all events are polled. That's why testautomation_video.c doesn't detect the bug.
Here is a snippet:

    SDL_SetWindowPosition(window, 1, 1);

    int x, y;
    SDL_GetWindowPosition(window, &x, &y);
    printf("Pos %i %i\n", x, y);

    SDL_Event event;
    while (SDL_PollEvent(&event)) {
    }

    SDL_GetWindowPosition(window, &x, &y);
    printf("New pos %i %i\n", x, y);

On my machine, it prints:
  Pos 1 1
  New pos 2 27
Comment 4 Eric Shepherd (:sheppy) 2020-03-15 17:40:45 UTC
I thought this was similar to a problem I'm having but after starting to comment, I decided it might only be tangentially related at most. For whatever it's worth, I filed my problem as bug 5032.