summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2017-12-14 02:59:58 +0100
committerBenjamin Otte <otte@redhat.com>2017-12-14 03:05:34 +0100
commitd7f34874abe0b53f7eaf18a70d89145e06883ef6 (patch)
tree08fbeed4bfe8f9bb27307c93cfc76ffd7870e52c
parenta4b42f0b736943be15924963c8d563c44962225f (diff)
downloadgtk+-d7f34874abe0b53f7eaf18a70d89145e06883ef6.tar.gz
x11: Make unsetting transient-for work
... and just unset it from GtkWindow instead of fiddling with properties.
-rw-r--r--gdk/x11/gdkwindow-x11.c12
-rw-r--r--gtk/gtkwindow.c3
2 files changed, 11 insertions, 4 deletions
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index a30861827e..d56c9bdf0e 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -2448,11 +2448,19 @@ static void
gdk_x11_window_set_transient_for (GdkWindow *window,
GdkWindow *parent)
{
- if (!GDK_WINDOW_DESTROYED (window) && !GDK_WINDOW_DESTROYED (parent) &&
- WINDOW_IS_TOPLEVEL_OR_FOREIGN (window))
+ if (GDK_WINDOW_DESTROYED (window) ||
+ !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window))
+ return;
+
+ /* XSetTransientForHint() doesn't allow unsetting, so do it manually */
+ if (!GDK_WINDOW_DESTROYED (parent))
XSetTransientForHint (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window),
GDK_WINDOW_XID (parent));
+ else
+ XDeleteProperty (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window),
+ gdk_x11_get_xatom_by_name_for_display (GDK_WINDOW_DISPLAY (window), "WM_TRANSIENT_FOR"));
}
GdkCursor *
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 94c1ba4ad8..a429ba311f 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -3382,8 +3382,7 @@ gtk_window_transient_parent_unrealized (GtkWidget *parent,
GtkWidget *window)
{
if (_gtk_widget_get_realized (window))
- gdk_property_delete (_gtk_widget_get_window (window),
- gdk_atom_intern_static_string ("WM_TRANSIENT_FOR"));
+ gdk_window_set_transient_for (_gtk_widget_get_window (window), NULL);
}
static void