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
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user