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>
This commit is contained in:
parent
c4e0c5fad6
commit
3f473f4025
@ -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.
|
||||
|
@ -4,6 +4,7 @@
|
||||
#ifndef QGTK3THEME_H
|
||||
#define QGTK3THEME_H
|
||||
|
||||
#include <private/qtguiglobal_p.h>
|
||||
#include <private/qgenericunixthemes_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
Loading…
x
Reference in New Issue
Block a user