Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/skins-qt/plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,11 @@ bool QtSkins::init ()
return false;
}

if (QGuiApplication::platformName() == "wayland")
if (QGuiApplication::platformName () == "wayland" &&
! qEnvironmentVariableIsSet ("DISPLAY"))
{
AUDERR ("The Winamp interface is not supported on Wayland. "
"Please run Audacious via XWayland.\n");
AUDERR ("The Winamp interface is not supported on Wayland, and "
"Xwayland does not appear to be available on this system.\n");
audqt::cleanup ();
return false;
}
Expand Down
60 changes: 60 additions & 0 deletions src/skins-qt/view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,15 @@
*/

#include <libaudcore/hook.h>
#include <libaudcore/i18n.h>
#include <libaudcore/mainloop.h>
#include <libaudcore/runtime.h>
#include <libaudqt/libaudqt.h>

#include <QGuiApplication>
#include <QMessageBox>
#include <QPointer>
#include <QPushButton>
#include <QWindow>

#include "plugin.h"
Expand All @@ -38,8 +44,62 @@
#include "view.h"
#include "window.h"

class QuitOnCloseMessageBox : public QMessageBox
{
protected:
void closeEvent (QCloseEvent *) override
{
aud_quit ();
}
};

void view_show_player (bool show)
{
static QPointer<QuitOnCloseMessageBox> dialog;

if (show && QGuiApplication::platformName () == "wayland")
{
if (! dialog)
{
dialog = new QuitOnCloseMessageBox;

auto restart = new QPushButton (audqt::translate_str (N_("Restart")), dialog);
auto quit = new QPushButton (audqt::translate_str (N_("Quit")), dialog);

restart->setIcon (QIcon::fromTheme ("view-refresh"));
quit->setIcon (QIcon::fromTheme ("application-exit"));

QObject::connect (restart, & QPushButton::clicked, [] () {
aud_set_bool ("use_xwayland", true);
aud_request_restart ();
});
QObject::connect (quit, & QPushButton::clicked, [] () {
aud_set_bool ("use_xwayland", true);
aud_quit ();
});

dialog->setIcon (QMessageBox::Warning);
dialog->setWindowTitle (_("Compatibility Issue"));
dialog->setText(
_("The Winamp interface requires windowing system features not "
"supported by Wayland. Audacious will attempt to enable Xwayland "
"compatibility mode after restart.\n\n"
"With the GTK or Qt interface you may disable this setting "
"again in the “Advanced” category of the Audacious settings."));

dialog->addButton (restart, QMessageBox::AcceptRole);
dialog->addButton (quit, QMessageBox::RejectRole);
dialog->setDefaultButton (restart);
}

dialog->show ();
show = false; // don't show main window
}
else if (dialog)
{
delete dialog.data ();
}

if (show)
{
mainwin->show ();
Expand Down
7 changes: 4 additions & 3 deletions src/skins/plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,11 @@ bool SkinnedUI::init ()
audgui_init ();

#ifdef GDK_WINDOWING_WAYLAND
if (GDK_IS_WAYLAND_DISPLAY (gdk_display_get_default ()))
if (GDK_IS_WAYLAND_DISPLAY (gdk_display_get_default ()) &&
! g_getenv ("DISPLAY"))
{
AUDERR ("The Winamp interface is not supported on Wayland. "
"Please run Audacious via XWayland.\n");
AUDERR ("The Winamp interface is not supported on Wayland, and "
"Xwayland does not appear to be available on this system.\n");
audgui_cleanup ();
return false;
}
Expand Down
44 changes: 44 additions & 0 deletions src/skins/view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,14 @@
*/

#include <libaudcore/hook.h>
#include <libaudcore/i18n.h>
#include <libaudcore/mainloop.h>
#include <libaudcore/runtime.h>
#include <libaudgui/libaudgui-gtk.h>

#ifdef GDK_WINDOWING_WAYLAND
#include <gdk/gdkwayland.h>
#endif

#include "plugin.h"
#include "plugin-window.h"
Expand All @@ -38,6 +44,44 @@

void view_show_player (bool show)
{
#ifdef GDK_WINDOWING_WAYLAND
static GtkWidget * dialog;

if (show && GDK_IS_WAYLAND_DISPLAY (gdk_display_get_default ()))
{
if (! dialog)
{
auto restart = audgui_button_new (_("Restart"), "view-refresh", [] (void *) {
aud_set_bool ("use_xwayland", true);
aud_request_restart ();
}, nullptr);

auto quit = audgui_button_new (_("Quit"), "application-exit", [] (void *) {
aud_set_bool ("use_xwayland", true);
aud_quit ();
}, nullptr);

dialog = audgui_dialog_new (GTK_MESSAGE_WARNING, _("Compatibility Issue"),
_("The Winamp interface requires windowing system features not "
"supported by Wayland. Audacious will attempt to enable Xwayland "
"compatibility mode after restart.\n\n"
"With the GTK or Qt interface you may disable this setting "
"again in the “Advanced” category of the Audacious settings."),
restart, quit);

g_signal_connect (dialog, "delete-event", (GCallback) aud_quit, nullptr);
g_signal_connect (dialog, "destroy", (GCallback) gtk_widget_destroyed, & dialog);
}

gtk_widget_show_all (dialog);
show = false; // don't show main window
}
else if (dialog)
{
gtk_widget_destroy (dialog);
}
#endif

if (show)
{
// "Move" the window to the position it's already at. This seems
Expand Down
Loading