Skip to content

SDL_SetWindowPosition does not set position when using wayland video driver #442

@madebr

Description

@madebr

The py-sdl2 test_SDL_GetSetWindowPosition test fails when running with sdl2-compat, and using the wayland video driver.

Equivalent C code:

#define SDL_ASSERT_LEVEL 3
#include <SDL2/SDL.h>

int main(int argc, char *argv[]) {
    (void) argc;
    (void) argv;

    SDL_SetHintWithPriority(SDL_HINT_VIDEODRIVER, "wayland", SDL_HINT_OVERRIDE);
    SDL_setenv("SDL_ASSERT", "ignore", 0);
    int result = SDL_Init(SDL_INIT_VIDEO);
    SDL_assert(result == 0);
    SDL_Window *window = SDL_CreateWindow("hello", 10, 200, 10, 10, 0);
    SDL_assert(window != NULL);
    SDL_assert(SDL_strcmp("wayland", SDL_GetCurrentVideoDriver()) == 0);

    int px, py;
    SDL_GetWindowPosition(window, &px, &py);
    SDL_assert(px == 10);
    SDL_assert(py == 200);

    SDL_SetWindowPosition(window, 0, 150);
    SDL_PumpEvents();

    SDL_GetWindowPosition(window, &px, &py);
    SDL_assert(px == 0);
    SDL_assert(py == 150);

    SDL_SetWindowPosition(window, 480, 320);
    SDL_PumpEvents();

    SDL_GetWindowPosition(window, &px, &py);
    SDL_assert(px == 480);
    SDL_assert(py == 320);

    SDL_DestroyWindow(window);
    SDL_Quit();
    return 0;
}

SDL2 output is empty.

sdl2-compat output is:

WARN: 

Assertion failure at main (a.c:22), triggered 1 time:
  'px == 0'

WARN: 

Assertion failure at main (a.c:23), triggered 1 time:
  'py == 150'

WARN: 

Assertion failure at main (a.c:29), triggered 1 time:
  'px == 480'

WARN: 

Assertion failure at main (a.c:30), triggered 1 time:
  'py == 320'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions