Skip to content

Commit fc41186

Browse files
Enable Xwayland only for Winamp interface. Closes: #1754
- Add a configuration setting with a checkbox to enable Xwayland - Enable it by default though for older systems (Qt <= 6.7), window docking for example only works well with newer Qt 6 versions - Allow using Wayland for the GTK and Qt interface by keeping it disabled - Enforce it for the Winamp interface, it does not support Wayland See also: #1664, #1656 --------- Co-authored-by: Thomas Lange <thomas-lange2@gmx.de>
1 parent aab6c02 commit fc41186

7 files changed

Lines changed: 22 additions & 19 deletions

File tree

config.h.meson

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,6 @@
2525
#mesondefine USE_GTK
2626
#mesondefine USE_GTK3
2727
#mesondefine USE_LIBARCHIVE
28+
#mesondefine USE_XWAYLAND
2829

2930
#mesondefine GLIB_VERSION_MIN_REQUIRED

meson.build

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,9 @@ endif
176176

177177
if get_option('qt')
178178
conf.set10('USE_QT', true)
179+
if qt_dep.version().version_compare('<= 6.7')
180+
conf.set10('USE_XWAYLAND', true)
181+
endif
179182
endif
180183

181184

src/libaudcore/config.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ static const char * const core_defaults[] = {
4343
"resume_playback_on_startup", "TRUE",
4444
"show_interface", "TRUE",
4545
"use_qt", "TRUE",
46+
#ifdef USE_XWAYLAND
47+
"use_xwayland", "TRUE",
48+
#else
49+
"use_xwayland", "FALSE",
50+
#endif
4651

4752
/* equalizer */
4853
"eqpreset_default_file", "",

src/libaudgui/init.cc

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,10 @@
1818
*/
1919

2020
#include <assert.h>
21-
#include <stdlib.h>
2221

2322
#include <libaudcore/audstrings.h>
2423
#include <libaudcore/hook.h>
2524
#include <libaudcore/playlist.h>
26-
#include <libaudcore/plugins.h>
2725
#include <libaudcore/runtime.h>
2826

2927
#include "internal.h"
@@ -343,15 +341,9 @@ EXPORT void audgui_init ()
343341
return;
344342

345343
#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");
344+
// Force Xwayland if requested and potentially available
345+
if (aud_get_bool ("use_xwayland") && g_getenv ("DISPLAY"))
346+
g_setenv ("GDK_BACKEND", "x11", true);
355347
#endif
356348

357349
static char app_name[] = "audacious";

src/libaudgui/prefs-window.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,10 @@ static const PreferencesWidget song_info_page_widgets[] = {
369369

370370
static const PreferencesWidget advanced_page_widgets[] = {
371371
WidgetLabel (N_("<b>Compatibility</b>")),
372+
#if defined(GDK_WINDOWING_WAYLAND) && defined(GDK_WINDOWING_X11)
373+
WidgetCheck (N_("Use Xwayland (requires a restart to take effect)"),
374+
WidgetBool (0, "use_xwayland")),
375+
#endif
372376
WidgetCheck (N_("Interpret \\ (backward slash) as a folder delimiter"),
373377
WidgetBool (0, "convert_backslash")),
374378
WidgetTable ({{chardet_elements}}),

src/libaudqt/audqt.cc

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,9 @@ EXPORT void init()
131131
#endif
132132

133133
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
134-
// Use X11/XWayland by default, but allow to overwrite it.
135-
// Especially the Winamp interface is not usable yet on Wayland
136-
// due to limitations regarding application-side window positioning.
137-
auto platform = qgetenv("QT_QPA_PLATFORM");
138-
if (platform.isEmpty() && qEnvironmentVariableIsSet("DISPLAY"))
134+
// Force Xwayland if requested and potentially available
135+
if (aud_get_bool("use_xwayland") && qEnvironmentVariableIsSet("DISPLAY"))
139136
qputenv("QT_QPA_PLATFORM", "xcb");
140-
else if (platform != "xcb")
141-
AUDWARN("X11/XWayland was not detected. This is unsupported, "
142-
"please do not report bugs.\n");
143137
#endif
144138

145139
static char app_name[] = "audacious";

src/libaudqt/prefs-window-qt.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,10 @@ static const PreferencesWidget song_info_page_widgets[] = {
401401

402402
static const PreferencesWidget advanced_page_widgets[] = {
403403
WidgetLabel(N_("<b>Compatibility</b>")),
404+
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
405+
WidgetCheck(N_("Use Xwayland (requires a restart to take effect)"),
406+
WidgetBool(0, "use_xwayland")),
407+
#endif
404408
WidgetCheck(N_("Interpret \\ (backward slash) as a folder delimiter"),
405409
WidgetBool(0, "convert_backslash")),
406410
WidgetTable({{chardet_elements}}),

0 commit comments

Comments
 (0)