From 2fd4d2e4186d22d07bdc00d22b083b166c6de9f3 Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Mon, 15 Sep 2025 09:16:05 +0200 Subject: [PATCH] sdl3 Wayland display w/o fs: print SDL error + print the SDL_SetWindowPosition in verbose mode also in Wayland (currently always an error - we are calling it with x/y=SDL_WINDOWPOS_CENTERED_DISPLAY(0) if nothing is specified). --- src/video_display/sdl3.c | 16 ++++++++++------ src/video_display/vulkan/vulkan_sdl3.cpp | 16 ++++++++++------ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/video_display/sdl3.c b/src/video_display/sdl3.c index 38ea35f05..4c58f0dec 100644 --- a/src/video_display/sdl3.c +++ b/src/video_display/sdl3.c @@ -789,14 +789,18 @@ sdl3_set_window_position(struct state_sdl3 *s, int x, int y) { const bool is_wayland = strcmp(SDL_GetCurrentVideoDriver(), "wayland") == 0; if (is_wayland && s->display_idx != -1 && !s->fs) { - MSG(ERROR, "In Wayland, display specification is available " - "only together with fullscreen flag ':fs'!\n"); - } else if (!is_wayland || s->x != SDL_WINDOWPOS_UNDEFINED || - s->y != SDL_WINDOWPOS_UNDEFINED) { - MSG(ERROR, "Error (SDL_SetWindowPosition): %s\n", + MSG(ERROR, + "In Wayland, display specification is possible only with " + "fullscreen flag ':fs' (%s)\n", SDL_GetError()); + return; } - // no warning if wayland and x/y unspecified + const int ll = !is_wayland || s->x != SDL_WINDOWPOS_UNDEFINED || + s->y != SDL_WINDOWPOS_UNDEFINED + ? LOG_LEVEL_ERROR + : LOG_LEVEL_VERBOSE; + log_msg(ll, MOD_NAME "Error (SDL_SetWindowPosition): %s\n", + SDL_GetError()); } static bool diff --git a/src/video_display/vulkan/vulkan_sdl3.cpp b/src/video_display/vulkan/vulkan_sdl3.cpp index 6aa9c87b2..6a2bb17ee 100644 --- a/src/video_display/vulkan/vulkan_sdl3.cpp +++ b/src/video_display/vulkan/vulkan_sdl3.cpp @@ -730,14 +730,18 @@ vulkan_sdl3_set_window_position(state_vulkan_sdl3 *s, const bool is_wayland = strcmp(SDL_GetCurrentVideoDriver(), "wayland") == 0; if (is_wayland && args->display_idx != -1 && !s->fullscreen) { - MSG(ERROR, "In Wayland, display specification is available " - "only together with fullscreen flag ':fs'!\n"); - } else if (!is_wayland || args->x != SDL_WINDOWPOS_UNDEFINED || - args->y != SDL_WINDOWPOS_UNDEFINED) { - MSG(ERROR, "Error (SDL_SetWindowPosition): %s\n", + MSG(ERROR, + "In Wayland, display specification is possible only with " + "fullscreen flag ':fs' (%s)\n", SDL_GetError()); + return; } - // no warning if wayland and x/y unspecified + const int ll = !is_wayland || args->x != SDL_WINDOWPOS_UNDEFINED || + args->y != SDL_WINDOWPOS_UNDEFINED + ? LOG_LEVEL_ERROR + : LOG_LEVEL_VERBOSE; + log_msg(ll, MOD_NAME "Error (SDL_SetWindowPosition): %s\n", + SDL_GetError()); } void* display_vulkan_init(module* parent, const char* fmt, unsigned int flags) {