x11: Make unsetting transient-for work

... and just unset it from GtkWindow instead of fiddling with
properties.
This commit is contained in:
Benjamin Otte 2017-12-14 02:59:58 +01:00
parent a4b42f0b73
commit d7f34874ab
2 changed files with 11 additions and 4 deletions

View File

@ -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 *

View File

@ -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