From 13d9edc687b81bfb0f51543864a1e551a865628d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Fri, 29 Sep 2023 13:04:49 +0200 Subject: [PATCH] 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: --- src/meta/meta-wayland-client.h | 4 ++++ src/wayland/meta-wayland-client.c | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/src/meta/meta-wayland-client.h b/src/meta/meta-wayland-client.h index b32995bf9..c5f0c8376 100644 --- a/src/meta/meta-wayland-client.h +++ b/src/meta/meta-wayland-client.h @@ -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 diff --git a/src/wayland/meta-wayland-client.c b/src/wayland/meta-wayland-client.c index 8e8b9b0b3..351f13e75 100644 --- a/src/wayland/meta-wayland-client.c +++ b/src/wayland/meta-wayland-client.c @@ -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)