@@ -738,6 +738,27 @@ get_display_id_from_idx(int idx)
738738 return 0 ;
739739}
740740
741+ void
742+ vulkan_sdl3_set_window_position (state_vulkan_sdl3 *s,
743+ const command_line_arguments *args, int x,
744+ int y)
745+ {
746+ if (SDL_SetWindowPosition (s->window , x, y)) {
747+ return ;
748+ }
749+ const bool is_wayland =
750+ strcmp (SDL_GetCurrentVideoDriver (), " wayland" ) == 0 ;
751+ if (is_wayland && args->display_idx != -1 && !s->fullscreen ) {
752+ MSG (ERROR, " In Wayland, display specification is available "
753+ " only together with fullscreen flag ':fs'!\n " );
754+ } else if (!is_wayland || args->x != SDL_WINDOWPOS_UNDEFINED ||
755+ args->y != SDL_WINDOWPOS_UNDEFINED) {
756+ MSG (ERROR, " Error (SDL_SetWindowPosition): %s\n " ,
757+ SDL_GetError ());
758+ }
759+ // no warning if wayland and x/y unspecified
760+ }
761+
741762void * display_vulkan_init (module * parent, const char * fmt, unsigned int flags) {
742763 sdl_set_log_level ();
743764 if (flags & DISPLAY_FLAG_AUDIO_ANY) {
@@ -820,7 +841,7 @@ void* display_vulkan_init(module* parent, const char* fmt, unsigned int flags) {
820841 return nullptr ;
821842 }
822843 s->window_callback = new WindowCallback (s->window );
823- SDL_CHECK ( SDL_SetWindowPosition (s-> window , x, y) );
844+ vulkan_sdl3_set_window_position (s. get (), &args, x, y);
824845
825846 uint32_t extension_count = 0 ;
826847 const char *const *extensions = SDL_Vulkan_GetInstanceExtensions (&extension_count);
0 commit comments