summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorMorten Johan Sorvig <morten.sorvig@nokia.com>2012-04-24 14:23:02 +0200
committerQt by Nokia <qt-info@nokia.com>2012-04-30 14:01:22 +0200
commit842a0b094befeb6f023782da02e1ee649490091e (patch)
treeeb74bd61afca82674670c50e6e3092d37c0cee9f /src/widgets
parent4e59daf34f57dffb1caddb46799ea4e866a640ff (diff)
Make QGtkStyle work on Qt 5.
Mostly straightforward porting: Add configure test from Qt 4. Add X11 include to qgtkstyle_p.cpp. Use renamed QGuiApplicationPrivate::showModalWindow. Change-Id: I83020e13ec00b49f3fe346814f881bce19a6f602 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/styles/qgtkstyle_p.cpp32
-rw-r--r--src/widgets/styles/qgtkstyle_p.h1
-rw-r--r--src/widgets/styles/styles.pri2
3 files changed, 25 insertions, 10 deletions
diff --git a/src/widgets/styles/qgtkstyle_p.cpp b/src/widgets/styles/qgtkstyle_p.cpp
index 0402859e31..37edf5d786 100644
--- a/src/widgets/styles/qgtkstyle_p.cpp
+++ b/src/widgets/styles/qgtkstyle_p.cpp
@@ -74,7 +74,21 @@
#include <QtWidgets/QToolBar>
#include <QtWidgets/QToolButton>
-#include <private/qt_x11_p.h>
+// X11 Includes:
+
+// the following is necessary to work around breakage in many versions
+// of XFree86's Xlib.h still in use
+// ### which versions?
+#if defined(_XLIB_H_) // crude hack, but...
+#error "cannot include <X11/Xlib.h> before this file"
+#endif
+#define XRegisterIMInstantiateCallback qt_XRegisterIMInstantiateCallback
+#define XUnregisterIMInstantiateCallback qt_XUnregisterIMInstantiateCallback
+#define XSetIMValues qt_XSetIMValues
+#include <X11/Xlib.h>
+#undef XRegisterIMInstantiateCallback
+#undef XUnregisterIMInstantiateCallback
+#undef XSetIMValues
QT_BEGIN_NAMESPACE
@@ -982,7 +996,7 @@ QString QGtkStylePrivate::openFilename(QWidget *parent, const QString &caption,
QWidget modal_widget;
modal_widget.setAttribute(Qt::WA_NoChildEventsForParent, true);
modal_widget.setParent(parent, Qt::Window);
- QApplicationPrivate::enterModal(&modal_widget);
+ QGuiApplicationPrivate::showModalWindow(modal_widget.windowHandle());
QString filename;
if (QGtkStylePrivate::gtk_dialog_run ((GtkDialog*)gtkFileChooser) == GTK_RESPONSE_ACCEPT) {
@@ -995,7 +1009,7 @@ QString QGtkStylePrivate::openFilename(QWidget *parent, const QString &caption,
}
}
- QApplicationPrivate::leaveModal(&modal_widget);
+ QApplicationPrivate::hideModalWindow(modal_widget.windowHandle());
gtk_widget_destroy (gtkFileChooser);
return filename;
}
@@ -1015,7 +1029,7 @@ QString QGtkStylePrivate::openDirectory(QWidget *parent, const QString &caption,
QWidget modal_widget;
modal_widget.setAttribute(Qt::WA_NoChildEventsForParent, true);
modal_widget.setParent(parent, Qt::Window);
- QApplicationPrivate::enterModal(&modal_widget);
+ QGuiApplicationPrivate::showModalWindow(modal_widget.windowHandle());
QString filename;
if (QGtkStylePrivate::gtk_dialog_run ((GtkDialog*)gtkFileChooser) == GTK_RESPONSE_ACCEPT) {
@@ -1024,7 +1038,7 @@ QString QGtkStylePrivate::openDirectory(QWidget *parent, const QString &caption,
g_free (gtk_filename);
}
- QApplicationPrivate::leaveModal(&modal_widget);
+ QApplicationPrivate::hideModalWindow(modal_widget.windowHandle());
gtk_widget_destroy (gtkFileChooser);
return filename;
}
@@ -1047,7 +1061,7 @@ QStringList QGtkStylePrivate::openFilenames(QWidget *parent, const QString &capt
QWidget modal_widget;
modal_widget.setAttribute(Qt::WA_NoChildEventsForParent, true);
modal_widget.setParent(parent, Qt::Window);
- QApplicationPrivate::enterModal(&modal_widget);
+ QGuiApplicationPrivate::showModalWindow(modal_widget.windowHandle());
if (gtk_dialog_run ((GtkDialog*)gtkFileChooser) == GTK_RESPONSE_ACCEPT) {
GSList *gtk_file_names = QGtkStylePrivate::gtk_file_chooser_get_filenames((GtkFileChooser*)gtkFileChooser);
@@ -1060,7 +1074,7 @@ QStringList QGtkStylePrivate::openFilenames(QWidget *parent, const QString &capt
}
}
- QApplicationPrivate::leaveModal(&modal_widget);
+ QApplicationPrivate::hideModalWindow(modal_widget.windowHandle());
gtk_widget_destroy (gtkFileChooser);
return filenames;
}
@@ -1080,7 +1094,7 @@ QString QGtkStylePrivate::saveFilename(QWidget *parent, const QString &caption,
QWidget modal_widget;
modal_widget.setAttribute(Qt::WA_NoChildEventsForParent, true);
modal_widget.setParent(parent, Qt::Window);
- QApplicationPrivate::enterModal(&modal_widget);
+ QGuiApplicationPrivate::showModalWindow(modal_widget.windowHandle());
QString filename;
if (QGtkStylePrivate::gtk_dialog_run ((GtkDialog*)gtkFileChooser) == GTK_RESPONSE_ACCEPT) {
@@ -1093,7 +1107,7 @@ QString QGtkStylePrivate::saveFilename(QWidget *parent, const QString &caption,
}
}
- QApplicationPrivate::leaveModal(&modal_widget);
+ QApplicationPrivate::hideModalWindow(modal_widget.windowHandle());
gtk_widget_destroy (gtkFileChooser);
return filename;
}
diff --git a/src/widgets/styles/qgtkstyle_p.h b/src/widgets/styles/qgtkstyle_p.h
index 02d659c1e4..b095820626 100644
--- a/src/widgets/styles/qgtkstyle_p.h
+++ b/src/widgets/styles/qgtkstyle_p.h
@@ -131,6 +131,7 @@ QT_END_NAMESPACE
class GConf;
class GConfClient;
+typedef struct _XDisplay Display;
typedef GConfClient* (*Ptr_gconf_client_get_default)();
typedef char* (*Ptr_gconf_client_get_string)(GConfClient*, const char*, GError **);
diff --git a/src/widgets/styles/styles.pri b/src/widgets/styles/styles.pri
index 2ae9664230..91212f0178 100644
--- a/src/widgets/styles/styles.pri
+++ b/src/widgets/styles/styles.pri
@@ -39,7 +39,7 @@ contains( styles, all ) {
!macx-*|ios:styles -= mac
-x11{
+contains(QT_CONFIG, gtkstyle) {
QMAKE_CXXFLAGS += $$QT_CFLAGS_QGTKSTYLE
LIBS_PRIVATE += $$QT_LIBS_QGTKSTYLE
styles += gtk