Skip to content

Commit 2fd4d2e

Browse files
committed
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).
1 parent cf20aea commit 2fd4d2e

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

src/video_display/sdl3.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -789,14 +789,18 @@ sdl3_set_window_position(struct state_sdl3 *s, int x, int y) {
789789
const bool is_wayland =
790790
strcmp(SDL_GetCurrentVideoDriver(), "wayland") == 0;
791791
if (is_wayland && s->display_idx != -1 && !s->fs) {
792-
MSG(ERROR, "In Wayland, display specification is available "
793-
"only together with fullscreen flag ':fs'!\n");
794-
} else if (!is_wayland || s->x != SDL_WINDOWPOS_UNDEFINED ||
795-
s->y != SDL_WINDOWPOS_UNDEFINED) {
796-
MSG(ERROR, "Error (SDL_SetWindowPosition): %s\n",
792+
MSG(ERROR,
793+
"In Wayland, display specification is possible only with "
794+
"fullscreen flag ':fs' (%s)\n",
797795
SDL_GetError());
796+
return;
798797
}
799-
// no warning if wayland and x/y unspecified
798+
const int ll = !is_wayland || s->x != SDL_WINDOWPOS_UNDEFINED ||
799+
s->y != SDL_WINDOWPOS_UNDEFINED
800+
? LOG_LEVEL_ERROR
801+
: LOG_LEVEL_VERBOSE;
802+
log_msg(ll, MOD_NAME "Error (SDL_SetWindowPosition): %s\n",
803+
SDL_GetError());
800804
}
801805

802806
static bool

src/video_display/vulkan/vulkan_sdl3.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -730,14 +730,18 @@ vulkan_sdl3_set_window_position(state_vulkan_sdl3 *s,
730730
const bool is_wayland =
731731
strcmp(SDL_GetCurrentVideoDriver(), "wayland") == 0;
732732
if (is_wayland && args->display_idx != -1 && !s->fullscreen) {
733-
MSG(ERROR, "In Wayland, display specification is available "
734-
"only together with fullscreen flag ':fs'!\n");
735-
} else if (!is_wayland || args->x != SDL_WINDOWPOS_UNDEFINED ||
736-
args->y != SDL_WINDOWPOS_UNDEFINED) {
737-
MSG(ERROR, "Error (SDL_SetWindowPosition): %s\n",
733+
MSG(ERROR,
734+
"In Wayland, display specification is possible only with "
735+
"fullscreen flag ':fs' (%s)\n",
738736
SDL_GetError());
737+
return;
739738
}
740-
// no warning if wayland and x/y unspecified
739+
const int ll = !is_wayland || args->x != SDL_WINDOWPOS_UNDEFINED ||
740+
args->y != SDL_WINDOWPOS_UNDEFINED
741+
? LOG_LEVEL_ERROR
742+
: LOG_LEVEL_VERBOSE;
743+
log_msg(ll, MOD_NAME "Error (SDL_SetWindowPosition): %s\n",
744+
SDL_GetError());
741745
}
742746

743747
void* display_vulkan_init(module* parent, const char* fmt, unsigned int flags) {

0 commit comments

Comments
 (0)