wayland/client: Add make_desktop() method

There are existing extensions that implement desktop icons as
a combination of a GTK program and a small extension to make
the wayland window behave as if it was of type DESKTOP on X11.

That's quite painful, as it requires reimplementing WM behavior
that is already implemented in mutter itself (stacking, stickiness,
skip-taskbar, ...), as well as modifying gnome-shell to consider
the window in addition to "real" DESKTOP windows (workspace-switch
animations, ctrl-alt-tab, ...).

In addition to that, other extensions may also have special handling
of DESKTOP windows, and their code cannot easily be monkey-patched
to handle "alternative" desktop icons.

This whole game of whack-a-mole can easily be avoided by allowing
desktop-icons extensions to mark their desktop windows as DESKTOP,
so do just that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3305>
This commit is contained in:
Florian Müllner 2023-09-29 13:04:49 +02:00 committed by Marge Bot
parent 6a22b52579
commit 13d9edc687
2 changed files with 25 additions and 0 deletions

View File

@ -60,5 +60,9 @@ META_EXPORT
void meta_wayland_client_show_in_window_list (MetaWaylandClient *client,
MetaWindow *window);
META_EXPORT
void meta_wayland_client_make_desktop (MetaWaylandClient *client,
MetaWindow *window);
G_END_DECLS

View File

@ -474,6 +474,27 @@ meta_wayland_client_show_in_window_list (MetaWaylandClient *client,
}
}
/**
* meta_wayland_client_make_desktop
* @client: a #MetaWaylandClient
* @window: (not nullable): a MetaWindow
*
* Mark window as DESKTOP window
*/
void
meta_wayland_client_make_desktop (MetaWaylandClient *client,
MetaWindow *window)
{
g_return_if_fail (META_IS_WAYLAND_CLIENT (client));
g_return_if_fail (META_IS_WINDOW (window));
g_return_if_fail (window->type == META_WINDOW_NORMAL);
if (!meta_wayland_client_owns_window (client, window))
return;
meta_window_set_type (window, META_WINDOW_DESKTOP);
}
gboolean
meta_wayland_client_matches (MetaWaylandClient *client,
const struct wl_client *wayland_client)