diff options
author | Luca Bacci <luca.bacci982@gmail.com> | 2018-07-17 12:01:54 +0200 |
---|---|---|
committer | Luca Bacci <luca.bacci982@gmail.com> | 2018-07-27 12:11:18 +0200 |
commit | 6348a7d48ffb24f95b7fe8dd2cc29a7cd7e6de98 (patch) | |
tree | 705e4cca5c704fd16c855afb1da1be35a1cdd916 | |
parent | 9008f7702dff689ce48f2cfa7ce42db099e4ef0c (diff) | |
download | gtk+-6348a7d48ffb24f95b7fe8dd2cc29a7cd7e6de98.tar.gz |
Gdk-Win32: Correct handling of transient state changes
gdk_win32_window_set_transient_for() behaves incorrectly when
called in sequence with the same arguments. This fix ensures it
always operates correctly.
In some cases this function gets called multiple times with the
same arguments, e.g. when tooltips are shown.
See issue #1214
-rw-r--r-- | gdk/win32/gdkwindow-win32.c | 38 |
1 files changed, 17 insertions, 21 deletions
diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c index 28f2b7696d..2b6733fb8f 100644 --- a/gdk/win32/gdkwindow-win32.c +++ b/gdk/win32/gdkwindow-win32.c @@ -1085,17 +1085,11 @@ gdk_win32_window_destroy (GdkWindow *window, _gdk_remove_modal_window (window); /* Remove all our transient children */ - tmp = window_impl->transient_children; - while (tmp != NULL) + while (window_impl->transient_children != NULL) { - GdkWindow *child = tmp->data; - GdkWindowImplWin32 *child_impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW (child)->impl); - - child_impl->transient_owner = NULL; - tmp = tmp->next; + GdkWindow *child = window_impl->transient_children->data; + gdk_window_set_transient_for (child, NULL); } - g_slist_free (window_impl->transient_children); - window_impl->transient_children = NULL; #ifdef GDK_WIN32_ENABLE_EGL display = GDK_WIN32_DISPLAY (gdk_window_get_display (window)); @@ -2127,27 +2121,29 @@ gdk_win32_window_set_transient_for (GdkWindow *window, 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); - if (trans_impl->transient_children != NULL) - { - item = g_slist_find (trans_impl->transient_children, window); - item->data = NULL; - trans_impl->transient_children = g_slist_delete_link (trans_impl->transient_children, item); - trans_impl->num_transients--; + item = g_slist_find (trans_impl->transient_children, window); + item->data = NULL; + trans_impl->transient_children = g_slist_delete_link (trans_impl->transient_children, item); + trans_impl->num_transients--; - if (!trans_impl->num_transients) - { - trans_impl->transient_children = NULL; - } + if (!trans_impl->num_transients) + { + trans_impl->transient_children = NULL; } + g_object_unref (G_OBJECT (window_impl->transient_owner)); g_object_unref (G_OBJECT (window)); window_impl->transient_owner = NULL; } - else + + if (parent) { parent_impl = GDK_WINDOW_IMPL_WIN32 (parent->impl); |