display: Make sure to retrieve the toplevel transient for

If we have multiple modal stacked dialogs, move the top one, not
the immediate parent, which heavily confuses mutter.
This commit is contained in:
Jasper St. Pierre 2014-04-28 17:23:20 -04:00
parent 7cefe91c3c
commit 6e8d1d79d1

View File

@ -1715,6 +1715,18 @@ meta_display_set_grab_op_cursor (MetaDisplay *display,
display->grab_have_pointer = TRUE;
}
static MetaWindow *
get_toplevel_transient_for (MetaWindow *window)
{
while (TRUE)
{
MetaWindow *parent = meta_window_get_transient_for (window);
if (parent == NULL)
return window;
window = parent;
}
}
gboolean
meta_display_begin_grab_op (MetaDisplay *display,
MetaScreen *screen,
@ -1757,15 +1769,13 @@ meta_display_begin_grab_op (MetaDisplay *display,
}
}
grab_window = window;
/* If window is a modal dialog attached to its parent,
* grab the parent instead for moving.
*/
if (window && meta_window_is_attached_dialog (window) &&
meta_grab_op_is_moving (op))
grab_window = meta_window_get_transient_for (window);
if (grab_window == NULL)
grab_window = window;
if (meta_grab_op_is_moving (op))
grab_window = get_toplevel_transient_for (window);
g_assert (grab_window != NULL);
g_assert (op != META_GRAB_OP_NONE);