diff --git a/src/core/display.c b/src/core/display.c index 21c444ac1..8b3297b13 100644 --- a/src/core/display.c +++ b/src/core/display.c @@ -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);