This commit is contained in:
2025-01-28 02:09:31 +02:00
parent 7823518fe4
commit acc1d371ea
2 changed files with 6 additions and 21 deletions

View File

@@ -1299,25 +1299,6 @@ int X11ErrorHandler(X11::Display* display, X11::XErrorEvent* event)
bool SDLPlatform::InitInternal()
{
//if (LinuxPlatform::Init())
// return true;
#if false
if (!CommandLine::Options.Headless && strcmp(SDL_GetCurrentVideoDriver(), "wayland") == 0)
{
WaylandDisplay = (wl_display*)SDL_GetPointerProperty(SDL_GetGlobalProperties(), SDL_PROP_GLOBAL_VIDEO_WAYLAND_WL_DISPLAY_POINTER, nullptr);
wl_registry* registry = wl_display_get_registry(WaylandDisplay);
wl_registry_add_listener(registry, &WaylandRegistryListener, nullptr);
wl_display_roundtrip(WaylandDisplay);
dataDevice = wl_data_device_manager_get_data_device(WaylandDataDeviceManager, WaylandSeat);
wl_data_device_add_listener(dataDevice, &WaylandDataDeviceListener, nullptr);
wl_display_roundtrip(WaylandDisplay);
}
#else
bool waylandRequested = (!CommandLine::Options.X11 || CommandLine::Options.Wayland) && StringAnsi(SDL_GetHint(SDL_HINT_VIDEO_DRIVER)) == "wayland";
if (!CommandLine::Options.Headless && waylandRequested)
{
@@ -1335,7 +1316,6 @@ bool SDLPlatform::InitInternal()
}
}
}
#endif
return false;
}

View File

@@ -41,7 +41,12 @@ bool SDLPlatform::Init()
else if (CommandLine::Options.Wayland)
SDL_SetHintWithPriority(SDL_HINT_VIDEO_DRIVER, "wayland", SDL_HINT_OVERRIDE);
else
SDL_SetHintWithPriority(SDL_HINT_VIDEO_DRIVER, "wayland", SDL_HINT_DEFAULT);
{
// Override the X11 preference when running in Wayland session
String waylandDisplayEnv;
if (!GetEnvironmentVariable(String("WAYLAND_DISPLAY"), waylandDisplayEnv))
SDL_SetHintWithPriority(SDL_HINT_VIDEO_DRIVER, "wayland", SDL_HINT_OVERRIDE);
}
#endif
#if PLATFORM_LINUX