[mutter/gnome-41] wayland/gtk: Only perform allowed titlebar gestures



commit bacaa9900f8862356e36ff261ad32126ca5c74c8
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Feb 10 19:51:16 2022 +0100

    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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2281>
    
    (cherry picked from commit 7ff52b612838f95556d061c44a62512d7fcf0a96)

 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 1ec5ffdf45..3d85c3f887 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;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]