Merge branch 'issue1214-tooltips-win32' into 'gtk-3-24'

Gdk-Win32: Correct handling of transient state changes

See merge request GNOME/gtk!248
This commit is contained in:
Matthias Clasen 2018-07-30 14:53:48 +00:00
commit 5f0a14fa2a

View File

@ -1085,17 +1085,11 @@ gdk_win32_window_destroy (GdkWindow *window,
_gdk_remove_modal_window (window); _gdk_remove_modal_window (window);
/* Remove all our transient children */ /* Remove all our transient children */
tmp = window_impl->transient_children; while (window_impl->transient_children != NULL)
while (tmp != NULL)
{ {
GdkWindow *child = tmp->data; GdkWindow *child = window_impl->transient_children->data;
GdkWindowImplWin32 *child_impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW (child)->impl); gdk_window_set_transient_for (child, NULL);
child_impl->transient_owner = NULL;
tmp = tmp->next;
} }
g_slist_free (window_impl->transient_children);
window_impl->transient_children = NULL;
#ifdef GDK_WIN32_ENABLE_EGL #ifdef GDK_WIN32_ENABLE_EGL
display = GDK_WIN32_DISPLAY (gdk_window_get_display (window)); display = GDK_WIN32_DISPLAY (gdk_window_get_display (window));
@ -2127,27 +2121,29 @@ gdk_win32_window_set_transient_for (GdkWindow *window,
return; return;
} }
if (parent == NULL) if (window_impl->transient_owner == parent)
return;
if (GDK_IS_WINDOW (window_impl->transient_owner))
{ {
GdkWindowImplWin32 *trans_impl = GDK_WINDOW_IMPL_WIN32 (window_impl->transient_owner->impl); GdkWindowImplWin32 *trans_impl = GDK_WINDOW_IMPL_WIN32 (window_impl->transient_owner->impl);
if (trans_impl->transient_children != NULL) item = g_slist_find (trans_impl->transient_children, window);
{ item->data = NULL;
item = g_slist_find (trans_impl->transient_children, window); trans_impl->transient_children = g_slist_delete_link (trans_impl->transient_children, item);
item->data = NULL; trans_impl->num_transients--;
trans_impl->transient_children = g_slist_delete_link (trans_impl->transient_children, item);
trans_impl->num_transients--;
if (!trans_impl->num_transients) if (!trans_impl->num_transients)
{ {
trans_impl->transient_children = NULL; trans_impl->transient_children = NULL;
}
} }
g_object_unref (G_OBJECT (window_impl->transient_owner)); g_object_unref (G_OBJECT (window_impl->transient_owner));
g_object_unref (G_OBJECT (window)); g_object_unref (G_OBJECT (window));
window_impl->transient_owner = NULL; window_impl->transient_owner = NULL;
} }
else
if (parent)
{ {
parent_impl = GDK_WINDOW_IMPL_WIN32 (parent->impl); parent_impl = GDK_WINDOW_IMPL_WIN32 (parent->impl);