diff options
Diffstat (limited to 'src/plugins/platformthemes/gtk3/qgtk3theme.cpp')
-rw-r--r-- | src/plugins/platformthemes/gtk3/qgtk3theme.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/plugins/platformthemes/gtk3/qgtk3theme.cpp b/src/plugins/platformthemes/gtk3/qgtk3theme.cpp index 93520344f8..6e9e89faf9 100644 --- a/src/plugins/platformthemes/gtk3/qgtk3theme.cpp +++ b/src/plugins/platformthemes/gtk3/qgtk3theme.cpp @@ -41,6 +41,7 @@ #include "qgtk3dialoghelpers.h" #include "qgtk3menu.h" #include <QVariant> +#include <QGuiApplication> #undef signals #include <gtk/gtk.h> @@ -84,6 +85,14 @@ void gtkMessageHandler(const gchar *log_domain, QGtk3Theme::QGtk3Theme() { + // Ensure gtk uses the same windowing system, but let it + // fallback in case GDK_BACKEND environment variable + // filters the preferred one out + if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"))) + gdk_set_allowed_backends("wayland,x11"); + else if (QGuiApplication::platformName() == QLatin1String("xcb")) + gdk_set_allowed_backends("x11,wayland"); + // gtk_init will reset the Xlib error handler, and that causes // Qt applications to quit on X errors. Therefore, we need to manually restore it. int (*oldErrorHandler)(Display *, XErrorEvent *) = XSetErrorHandler(nullptr); |