mirror of
https://github.com/brl/mutter.git
synced 2024-12-26 21:02:14 +00:00
window: Add has_attached_dialogs() function
We currently only expose a function to check whether a window *is* an attached modal dialog, not whether it *has* any. The latter is interesting as well, but the code currently lives in a gnome-shell helper function. Mutter is in a better position to filter out unmanaging windows though, so add corresponding API. https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4825 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2123>
This commit is contained in:
parent
844445b807
commit
40d9d26229
@ -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
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user