diff --git a/src/core/window-private.h b/src/core/window-private.h index b4de8a60a..ccb5b719d 100644 --- a/src/core/window-private.h +++ b/src/core/window-private.h @@ -830,6 +830,7 @@ void meta_window_set_gtk_dbus_properties (MetaWindow *window, const char *window_object_path); gboolean meta_window_has_transient_type (MetaWindow *window); +gboolean meta_window_has_modals (MetaWindow *window); void meta_window_set_transient_for (MetaWindow *window, MetaWindow *parent); diff --git a/src/core/window.c b/src/core/window.c index b66042e62..518cebb34 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -8021,6 +8021,35 @@ meta_window_has_attached_dialogs (MetaWindow *window) return has_attached; } +static gboolean +has_modals_foreach_func (MetaWindow *window, + void *data) +{ + gboolean *is_modal = data; + + *is_modal = window->type == META_WINDOW_MODAL_DIALOG && !window->unmanaging; + + if (*is_modal) + return FALSE; + + return TRUE; +} + +/** + * meta_window_has_modals: + * @window: a #MetaWindow + * + * Return value: whether @window has any modal transients + */ +gboolean +meta_window_has_modals (MetaWindow *window) +{ + gboolean has_modals = FALSE; + + meta_window_foreach_transient (window, has_modals_foreach_func, &has_modals); + return has_modals; +} + /** * meta_window_get_tile_match: * @window: a #MetaWindow