window: make determination of attached dialog windows more consistent

Different bits of code were using slightly different checks to test
whether a window was an attached dialog. Add a new
meta_window_is_attached_dialog(), and use that everywhere.

Also, freeze the is-attached status when the window is first shown,
rather than recomputing it each time the caller asks, since this could
cause problems if a window changes its type after it has already been
attached, etc. However, if an attached window's parent is destroyed,
or an attached window changes its transient-for, then fix things up by
destroying the old MetaWindow and creating a new one (causing
compositor unmap and map events to be fired off, allowing the display
of the window to be fixed up).

Remove some code in display.c that tried to fix existing windows if
the gconf setting changed, but which didn't actually do anything (at
least under gnome-shell). However, if 654643 was fixed then the new
behavior with this patch would be that changing the gconf setting
would affect new dialogs, but not existing ones.

https://bugzilla.gnome.org/show_bug.cgi?id=646761
This commit is contained in:
Dan Winship
2011-04-05 10:14:52 -04:00
parent 3650e9b074
commit 7f8c59614e
6 changed files with 141 additions and 83 deletions

View File

@ -749,9 +749,7 @@ constrain_modal_dialog (MetaWindow *window,
MetaWindow *parent = meta_window_get_transient_for (window);
gboolean constraint_already_satisfied;
if (!meta_prefs_get_attach_modal_dialogs ())
return TRUE;
if (window->type != META_WINDOW_MODAL_DIALOG || !parent)
if (!meta_window_is_attached_dialog (window))
return TRUE;
x = parent->rect.x + (parent->rect.width / 2 - info->current.width / 2);