From 7ff52b612838f95556d061c44a62512d7fcf0a96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 10 Feb 2022 19:51:16 +0100 Subject: [PATCH] wayland/gtk: Only perform allowed titlebar gestures The window functions "work" regardless of whether the client allows the behavior or not. That is, it's up to the caller to not call maximize and friends when the action isn't allowed. Add appropriate checks, which should make the titlebar_gesture() behavior identical to titlebar actions for server-side decorations. https://gitlab.gnome.org/GNOME/mutter/-/issues/2139 Part-of: --- src/wayland/meta-wayland-gtk-shell.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/wayland/meta-wayland-gtk-shell.c b/src/wayland/meta-wayland-gtk-shell.c index 1ec5ffdf4..3d85c3f88 100644 --- a/src/wayland/meta-wayland-gtk-shell.c +++ b/src/wayland/meta-wayland-gtk-shell.c @@ -253,6 +253,9 @@ gtk_surface_titlebar_gesture (struct wl_client *client, switch (action) { case G_DESKTOP_TITLEBAR_ACTION_TOGGLE_MAXIMIZE: + if (!window->has_maximize_func) + break; + if (META_WINDOW_MAXIMIZED (window)) meta_window_unmaximize (window, META_MAXIMIZE_BOTH); else @@ -260,6 +263,9 @@ gtk_surface_titlebar_gesture (struct wl_client *client, break; case G_DESKTOP_TITLEBAR_ACTION_TOGGLE_MAXIMIZE_HORIZONTALLY: + if (!window->has_maximize_func) + break; + if (META_WINDOW_MAXIMIZED_HORIZONTALLY (window)) meta_window_unmaximize (window, META_MAXIMIZE_HORIZONTAL); else @@ -267,6 +273,9 @@ gtk_surface_titlebar_gesture (struct wl_client *client, break; case G_DESKTOP_TITLEBAR_ACTION_TOGGLE_MAXIMIZE_VERTICALLY: + if (!window->has_maximize_func) + break; + if (META_WINDOW_MAXIMIZED_VERTICALLY (window)) meta_window_unmaximize (window, META_MAXIMIZE_VERTICAL); else @@ -274,6 +283,9 @@ gtk_surface_titlebar_gesture (struct wl_client *client, break; case G_DESKTOP_TITLEBAR_ACTION_MINIMIZE: + if (!window->has_minimize_func) + break; + meta_window_minimize (window); break;