diff --git a/src/core/window.c b/src/core/window.c index 3e5cec1aa..b66042e62 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -7985,6 +7985,42 @@ meta_window_is_attached_dialog (MetaWindow *window) return window->attached; } +static gboolean +has_attached_foreach_func (MetaWindow *window, + void *data) +{ + gboolean *is_attached = data; + + *is_attached = window->attached && !window->unmanaging; + + if (*is_attached) + return FALSE; + + return TRUE; +} + + +/** + * meta_window_has_attached_dialogs: + * @window: a #MetaWindow + * + * Tests if @window has any transients attached to it. + * (If the "attach_modal_dialogs" option is not enabled, this will + * always return %FALSE.) + * + * Return value: whether @window has attached transients + */ +gboolean +meta_window_has_attached_dialogs (MetaWindow *window) +{ + gboolean has_attached = FALSE; + + meta_window_foreach_transient (window, + has_attached_foreach_func, + &has_attached); + return has_attached; +} + /** * meta_window_get_tile_match: * @window: a #MetaWindow diff --git a/src/meta/window.h b/src/meta/window.h index 2b69269d1..d5d07a061 100644 --- a/src/meta/window.h +++ b/src/meta/window.h @@ -343,6 +343,9 @@ gboolean meta_window_is_remote (MetaWindow *window); META_EXPORT gboolean meta_window_is_attached_dialog (MetaWindow *window); +META_EXPORT +gboolean meta_window_has_attached_dialogs (MetaWindow *window); + META_EXPORT const char *meta_window_get_mutter_hints (MetaWindow *window);