summaryrefslogtreecommitdiffstats
path: root/src/plugins/platformthemes
diff options
context:
space:
mode:
authorIlya Fedin <fedin-ilja2010@ya.ru>2022-07-02 13:53:28 +0400
committerIlya Fedin <fedin-ilja2010@ya.ru>2022-07-07 02:06:14 +0400
commitdbe858bf80f554c4d916ee230fc9dcde01699bd7 (patch)
treebc319e93c43a8ec9f6367823255adc146afea090 /src/plugins/platformthemes
parent3d45f23b022878444454ec1a47c25678b88868c6 (diff)
QGtk3Theme: Respect xcb_xlib config option
Pick-to: 6.4 6.3 6.2 Change-Id: I4b01a694e8a13a6f009296d8ccfa8f8eb21043e4 Reviewed-by: Liang Qi <liang.qi@qt.io>
Diffstat (limited to 'src/plugins/platformthemes')
-rw-r--r--src/plugins/platformthemes/gtk3/qgtk3theme.cpp6
-rw-r--r--src/plugins/platformthemes/gtk3/qgtk3theme.h1
2 files changed, 7 insertions, 0 deletions
diff --git a/src/plugins/platformthemes/gtk3/qgtk3theme.cpp b/src/plugins/platformthemes/gtk3/qgtk3theme.cpp
index 51e19175d6..8551966678 100644
--- a/src/plugins/platformthemes/gtk3/qgtk3theme.cpp
+++ b/src/plugins/platformthemes/gtk3/qgtk3theme.cpp
@@ -11,7 +11,9 @@
#undef signals
#include <gtk/gtk.h>
+#if QT_CONFIG(xcb_xlib)
#include <X11/Xlib.h>
+#endif
QT_BEGIN_NAMESPACE
@@ -60,13 +62,17 @@ QGtk3Theme::QGtk3Theme()
else if (QGuiApplication::platformName() == "xcb"_L1)
gdk_set_allowed_backends("x11,wayland");
+#if QT_CONFIG(xcb_xlib)
// 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);
+#endif
gtk_init(nullptr, nullptr);
+#if QT_CONFIG(xcb_xlib)
XSetErrorHandler(oldErrorHandler);
+#endif
/* Initialize some types here so that Gtk+ does not crash when reading
* the treemodel for GtkFontChooser.
diff --git a/src/plugins/platformthemes/gtk3/qgtk3theme.h b/src/plugins/platformthemes/gtk3/qgtk3theme.h
index 0f274234d5..8c7a1da7cc 100644
--- a/src/plugins/platformthemes/gtk3/qgtk3theme.h
+++ b/src/plugins/platformthemes/gtk3/qgtk3theme.h
@@ -4,6 +4,7 @@
#ifndef QGTK3THEME_H
#define QGTK3THEME_H
+#include <private/qtguiglobal_p.h>
#include <private/qgenericunixthemes_p.h>
QT_BEGIN_NAMESPACE