1
0
Fork 0

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; 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 gboolean
meta_display_begin_grab_op (MetaDisplay *display, meta_display_begin_grab_op (MetaDisplay *display,
MetaScreen *screen, 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, /* If window is a modal dialog attached to its parent,
* grab the parent instead for moving. * grab the parent instead for moving.
*/ */
if (window && meta_window_is_attached_dialog (window) && if (meta_grab_op_is_moving (op))
meta_grab_op_is_moving (op)) grab_window = get_toplevel_transient_for (window);
grab_window = meta_window_get_transient_for (window);
if (grab_window == NULL)
grab_window = window;
g_assert (grab_window != NULL); g_assert (grab_window != NULL);
g_assert (op != META_GRAB_OP_NONE); g_assert (op != META_GRAB_OP_NONE);