Skip to content

Commit 60eaa84

Browse files
committed
Enable XWayland only for skinned UI (part 1)
Needs accompanying change on plugins side
1 parent 4035b68 commit 60eaa84

2 files changed

Lines changed: 12 additions & 17 deletions

File tree

src/libaudgui/init.cc

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -343,15 +343,12 @@ EXPORT void audgui_init ()
343343
return;
344344

345345
#if defined(GDK_WINDOWING_WAYLAND) && defined(GDK_WINDOWING_X11)
346-
// Use X11/XWayland by default, but allow to overwrite it.
347-
// Especially the Winamp interface is not usable yet on Wayland
348-
// due to limitations regarding application-side window positioning.
349-
auto backend = g_getenv ("GDK_BACKEND");
350-
if (! backend && g_getenv ("DISPLAY"))
351-
g_setenv ("GDK_BACKEND", "x11", false);
352-
else if (g_strcmp0 (backend, "x11"))
353-
AUDWARN ("X11/XWayland was not detected. This is unsupported, "
354-
"please do not report bugs.\n");
346+
// The Winamp interface is not usable yet on Wayland (and perhaps
347+
// may never be) due to protocol limitations regarding application-
348+
// side window positioning. Force XWayland if needed and available.
349+
PluginHandle * skins = aud_plugin_lookup_basename ("skins");
350+
if (skins && aud_plugin_get_enabled (skins) && g_getenv ("DISPLAY"))
351+
g_setenv ("GDK_BACKEND", "x11", true);
355352
#endif
356353

357354
static char app_name[] = "audacious";

src/libaudqt/audqt.cc

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <libaudcore/audstrings.h>
3030
#include <libaudcore/i18n.h>
3131
#include <libaudcore/interface.h>
32+
#include <libaudcore/plugins.h>
3233
#include <libaudcore/runtime.h>
3334

3435
#include "libaudqt-internal.h"
@@ -135,15 +136,12 @@ EXPORT void init()
135136
#endif
136137

137138
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
138-
// Use X11/XWayland by default, but allow to overwrite it.
139-
// Especially the Winamp interface is not usable yet on Wayland
140-
// due to limitations regarding application-side window positioning.
141-
auto platform = qgetenv("QT_QPA_PLATFORM");
142-
if (platform.isEmpty() && qEnvironmentVariableIsSet("DISPLAY"))
139+
// The Winamp interface is not usable yet on Wayland (and perhaps
140+
// may never be) due to protocol limitations regarding application-
141+
// side window positioning. Force XWayland if needed and available.
142+
PluginHandle * skins = aud_plugin_lookup_basename("skins-qt");
143+
if (skins && aud_plugin_get_enabled(skins) && !qgetenv("DISPLAY").isEmpty())
143144
qputenv("QT_QPA_PLATFORM", "xcb");
144-
else if (platform != "xcb")
145-
AUDWARN("X11/XWayland was not detected. This is unsupported, "
146-
"please do not report bugs.\n");
147145
#endif
148146

149147
static char app_name[] = "audacious";

0 commit comments

Comments
 (0)