[gtk/gtk-3-24: 1/2] Gdk-Win32: Correct handling of transient state changes
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/gtk-3-24: 1/2] Gdk-Win32: Correct handling of transient state changes
- Date: Mon, 30 Jul 2018 14:56:11 +0000 (UTC)
commit 6348a7d48ffb24f95b7fe8dd2cc29a7cd7e6de98
Author: Luca Bacci <luca bacci982 gmail com>
Date: Tue Jul 17 12:01:54 2018 +0200
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
gdk/win32/gdkwindow-win32.c | 38 +++++++++++++++++---------------------
1 file 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]