window: Add internal meta_window_should_show() API

This, in contrast to meta_window_should_be_showing() reports whether a
window should be showing despite not being showable. This is useful to
know the intended visibility state that should happen in the immediate
future.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3475>
This commit is contained in:
Jonas Ådahl
2024-03-25 13:26:26 +01:00
committed by Marge Bot
parent c5caa4afb5
commit cf176df006
5 changed files with 128 additions and 4 deletions

View File

@ -1706,6 +1706,41 @@ meta_window_is_showable (MetaWindow *window)
return TRUE;
}
/**
* meta_window_should_show_on_workspace:
*
* Tells whether a window should be showing on the passed workspace, without
* taking into account whether it can immediately be shown. Whether it can be
* shown or not depends on what windowing system it was created from.
*
* Returns: %TRUE if the window should show.
*/
static gboolean
meta_window_should_show_on_workspace (MetaWindow *window,
MetaWorkspace *workspace)
{
return (meta_window_located_on_workspace (window, workspace) &&
meta_window_showing_on_its_workspace (window));
}
/**
* meta_window_should_show:
*
* Tells whether a window should be showing on the current workspace, without
* taking into account whether it can immediately be shown. Whether it can be
* shown or not depends on what windowing system it was created from.
*
* Returns: %TRUE if the window should show.
*/
gboolean
meta_window_should_show (MetaWindow *window)
{
MetaWorkspaceManager *workspace_manager = window->display->workspace_manager;
MetaWorkspace *active_workspace = workspace_manager->active_workspace;
return meta_window_should_show_on_workspace (window, active_workspace);
}
/**
* meta_window_should_be_showing_on_workspace:
*
@ -1722,10 +1757,7 @@ meta_window_should_be_showing_on_workspace (MetaWindow *window,
if (!meta_window_is_showable (window))
return FALSE;
/* Windows should be showing if they're located on the
* workspace and they're showing on their own workspace. */
return (meta_window_located_on_workspace (window, workspace) &&
meta_window_showing_on_its_workspace (window));
return meta_window_should_show_on_workspace (window, workspace);
}
/**