summaryrefslogtreecommitdiffstats
path: root/src/plugins/platformthemes
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platformthemes')
-rw-r--r--src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp b/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp
index ce8e2ff756..24fea73dd2 100644
--- a/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp
+++ b/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp
@@ -12,6 +12,8 @@
#include <qfileinfo.h>
#include <private/qguiapplication_p.h>
+#include <private/qgenericunixservices_p.h>
+#include <qpa/qplatformintegration.h>
#include <qpa/qplatformfontdatabase.h>
#undef signals
@@ -23,6 +25,10 @@
#include <gdk/gdkx.h>
#endif
+#ifdef GDK_WINDOWING_WAYLAND
+#include <gdk/gdkwayland.h>
+#endif
+
// The size of the preview we display for selected image files. We set height
// larger than width because generally there is more free space vertically
// than horizontally (setting the preview image will always expand the width of
@@ -98,14 +104,27 @@ bool QGtk3Dialog::show(Qt::WindowFlags flags, Qt::WindowModality modality, QWind
GdkWindow *gdkWindow = gtk_widget_get_window(gtkWidget);
if (parent) {
+ if (false) {
+#if defined(GDK_WINDOWING_WAYLAND) && GTK_CHECK_VERSION(3, 22, 0)
+ } else if (GDK_IS_WAYLAND_WINDOW(gdkWindow)) {
+ const auto unixServices = dynamic_cast<QGenericUnixServices *>(
+ QGuiApplicationPrivate::platformIntegration()->services());
+ if (unixServices) {
+ const auto handle = unixServices->portalWindowIdentifier(parent);
+ if (handle.startsWith("wayland:"_L1)) {
+ auto handleBa = handle.sliced(8).toUtf8();
+ gdk_wayland_window_set_transient_for_exported(gdkWindow, handleBa.data());
+ }
+ }
+#endif
#if QT_CONFIG(xlib) && defined(GDK_WINDOWING_X11)
- if (GDK_IS_X11_WINDOW(gdkWindow)) {
+ } else if (GDK_IS_X11_WINDOW(gdkWindow)) {
GdkDisplay *gdkDisplay = gdk_window_get_display(gdkWindow);
XSetTransientForHint(gdk_x11_display_get_xdisplay(gdkDisplay),
gdk_x11_window_get_xid(gdkWindow),
parent->winId());
- }
#endif
+ }
}
if (modality != Qt::NonModal) {