display: Grab attached dialogs' parent

Currently, attached modal dialog can be grabbed (either by the
title bar, or using Alt+Button1), though they won't move when
dragged. To address this, grab the parent in that case, which
allows to move both the parent and the attached dialog.

https://bugzilla.gnome.org/show_bug.cgi?id=638674
This commit is contained in:
Ron 2011-01-04 17:42:51 +01:00 committed by Florian Müllner
parent 26e41bc24a
commit e3ebcc004d

View File

@ -3494,6 +3494,7 @@ meta_display_begin_grab_op (MetaDisplay *display,
int root_x,
int root_y)
{
MetaWindow *grab_window = NULL;
Window grab_xwindow;
meta_topic (META_DEBUG_WINDOW_OPS,
@ -3523,14 +3524,25 @@ meta_display_begin_grab_op (MetaDisplay *display,
}
}
/* If window is a modal dialog attached to its parent,
* grab the parent instead for moving.
*/
if (meta_prefs_get_attach_modal_dialogs () &&
window->type == META_WINDOW_MODAL_DIALOG &&
meta_grab_op_is_moving (op))
grab_window = meta_window_get_transient_for (window);
if (grab_window == NULL)
grab_window = window;
/* FIXME:
* If we have no MetaWindow we do our best
* and try to do the grab on the RootWindow.
* This will fail if anyone else has any
* key grab on the RootWindow.
*/
if (window)
grab_xwindow = window->frame ? window->frame->xwindow : window->xwindow;
if (grab_window)
grab_xwindow = grab_window->frame ? grab_window->frame->xwindow : grab_window->xwindow;
else
grab_xwindow = screen->xroot;
@ -3552,9 +3564,9 @@ meta_display_begin_grab_op (MetaDisplay *display,
/* Grab keys for keyboard ops and mouse move/resizes; see #126497 */
if (grab_op_is_keyboard (op) || grab_op_is_mouse_only (op))
{
if (window)
if (grab_window)
display->grab_have_keyboard =
meta_window_grab_all_keys (window, timestamp);
meta_window_grab_all_keys (grab_window, timestamp);
else
display->grab_have_keyboard =
@ -3571,7 +3583,7 @@ meta_display_begin_grab_op (MetaDisplay *display,
}
display->grab_op = op;
display->grab_window = window;
display->grab_window = grab_window;
display->grab_screen = screen;
display->grab_xwindow = grab_xwindow;
display->grab_button = button;