summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlya Fedin <fedin-ilja2010@ya.ru>2022-07-02 13:53:28 +0400
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-08-03 15:52:11 +0000
commitf88cc18429c3657c920c75cde7aad36dc6ef1419 (patch)
tree1eddd6b0d699fcd03a94a48cc94c7621eb0ff314
parent7bc93fc70f79e0b6efb2b69122c08ce6abd90a94 (diff)
QGtk3Theme: Respect xcb_xlib config option
Change-Id: I4b01a694e8a13a6f009296d8ccfa8f8eb21043e4 Reviewed-by: Liang Qi <liang.qi@qt.io> (cherry picked from commit dbe858bf80f554c4d916ee230fc9dcde01699bd7) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-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 484f20802e..2df8de650c 100644
--- a/src/plugins/platformthemes/gtk3/qgtk3theme.cpp
+++ b/src/plugins/platformthemes/gtk3/qgtk3theme.cpp
@@ -47,7 +47,9 @@
#undef signals
#include <gtk/gtk.h>
+#if QT_CONFIG(xcb_xlib)
#include <X11/Xlib.h>
+#endif
QT_BEGIN_NAMESPACE
@@ -94,13 +96,17 @@ QGtk3Theme::QGtk3Theme()
else if (QGuiApplication::platformName() == QLatin1String("xcb"))
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 5f439067af..71de35841e 100644
--- a/src/plugins/platformthemes/gtk3/qgtk3theme.h
+++ b/src/plugins/platformthemes/gtk3/qgtk3theme.h
@@ -40,6 +40,7 @@
#ifndef QGTK3THEME_H
#define QGTK3THEME_H
+#include <private/qtguiglobal_p.h>
#include <private/qgenericunixthemes_p.h>
QT_BEGIN_NAMESPACE