[mutter/wip/fmuellner/remove-app-menu] ui: Remove fallback app menu



commit 29fb7c827d8d0b58d1841be195f99e9511a1abc8
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Oct 4 22:09:15 2018 +0200

    ui: Remove fallback app menu
    
    The app menu is in the process of being retired[0], and the shell
    stopped displaying it while applications are in the process of
    dropping it. It therefore doesn't make sense to always show a
    fallback menu in server-side decorations, applications that still
    set the menu can rely on GTK+'s own fallback instead.
    
    [0] https://gitlab.gnome.org/GNOME/Initiatives/wikis/App-Menu-Retirement
    
    https://gitlab.gnome.org/GNOME/gnome-shell/issues/624

 src/core/frame.c       |  4 ----
 src/core/prefs.c       |  2 --
 src/meta/common.h      | 41 +++++++++++++++++++----------------------
 src/ui/frames.c        | 22 ++--------------------
 src/ui/frames.h        |  1 -
 src/ui/theme-private.h |  4 +---
 src/ui/theme.c         | 18 ------------------
 7 files changed, 22 insertions(+), 70 deletions(-)
---
diff --git a/src/core/frame.c b/src/core/frame.c
index cfd284bc9..1905d9fcf 100644
--- a/src/core/frame.c
+++ b/src/core/frame.c
@@ -250,10 +250,6 @@ meta_frame_get_flags (MetaFrame *frame)
     {
       flags |= META_FRAME_ALLOWS_MENU;
 
-      if (meta_prefs_get_show_fallback_app_menu () &&
-          frame->window->gtk_app_menu_object_path)
-        flags |= META_FRAME_ALLOWS_APPMENU;
-
       if (frame->window->has_close_func)
         flags |= META_FRAME_ALLOWS_DELETE;
 
diff --git a/src/core/prefs.c b/src/core/prefs.c
index 30ac5d010..300320a08 100644
--- a/src/core/prefs.c
+++ b/src/core/prefs.c
@@ -1259,8 +1259,6 @@ button_function_from_string (const char *str)
 {
   if (strcmp (str, "menu") == 0)
     return META_BUTTON_FUNCTION_MENU;
-  else if (strcmp (str, "appmenu") == 0)
-    return META_BUTTON_FUNCTION_APPMENU;
   else if (strcmp (str, "minimize") == 0)
     return META_BUTTON_FUNCTION_MINIMIZE;
   else if (strcmp (str, "maximize") == 0)
diff --git a/src/meta/common.h b/src/meta/common.h
index d5dae613a..4fa79b787 100644
--- a/src/meta/common.h
+++ b/src/meta/common.h
@@ -50,7 +50,6 @@
  * MetaFrameFlags:
  * @META_FRAME_ALLOWS_DELETE: frame allows delete
  * @META_FRAME_ALLOWS_MENU: frame allows menu
- * @META_FRAME_ALLOWS_APPMENU: frame allows (fallback) app menu
  * @META_FRAME_ALLOWS_MINIMIZE: frame allows minimize
  * @META_FRAME_ALLOWS_MAXIMIZE: frame allows maximize
  * @META_FRAME_ALLOWS_VERTICAL_RESIZE: frame allows vertical resize
@@ -71,22 +70,21 @@ typedef enum
 {
   META_FRAME_ALLOWS_DELETE            = 1 << 0,
   META_FRAME_ALLOWS_MENU              = 1 << 1,
-  META_FRAME_ALLOWS_APPMENU           = 1 << 2,
-  META_FRAME_ALLOWS_MINIMIZE          = 1 << 3,
-  META_FRAME_ALLOWS_MAXIMIZE          = 1 << 4,
-  META_FRAME_ALLOWS_VERTICAL_RESIZE   = 1 << 5,
-  META_FRAME_ALLOWS_HORIZONTAL_RESIZE = 1 << 6,
-  META_FRAME_HAS_FOCUS                = 1 << 7,
-  META_FRAME_SHADED                   = 1 << 8,
-  META_FRAME_STUCK                    = 1 << 9,
-  META_FRAME_MAXIMIZED                = 1 << 10,
-  META_FRAME_ALLOWS_SHADE             = 1 << 11,
-  META_FRAME_ALLOWS_MOVE              = 1 << 12,
-  META_FRAME_FULLSCREEN               = 1 << 13,
-  META_FRAME_IS_FLASHING              = 1 << 14,
-  META_FRAME_ABOVE                    = 1 << 15,
-  META_FRAME_TILED_LEFT               = 1 << 16,
-  META_FRAME_TILED_RIGHT              = 1 << 17
+  META_FRAME_ALLOWS_MINIMIZE          = 1 << 2,
+  META_FRAME_ALLOWS_MAXIMIZE          = 1 << 3,
+  META_FRAME_ALLOWS_VERTICAL_RESIZE   = 1 << 4,
+  META_FRAME_ALLOWS_HORIZONTAL_RESIZE = 1 << 5,
+  META_FRAME_HAS_FOCUS                = 1 << 6,
+  META_FRAME_SHADED                   = 1 << 7,
+  META_FRAME_STUCK                    = 1 << 8,
+  META_FRAME_MAXIMIZED                = 1 << 9,
+  META_FRAME_ALLOWS_SHADE             = 1 << 10,
+  META_FRAME_ALLOWS_MOVE              = 1 << 11,
+  META_FRAME_FULLSCREEN               = 1 << 12,
+  META_FRAME_IS_FLASHING              = 1 << 13,
+  META_FRAME_ABOVE                    = 1 << 14,
+  META_FRAME_TILED_LEFT               = 1 << 15,
+  META_FRAME_TILED_RIGHT              = 1 << 16
 } MetaFrameFlags;
 
 /**
@@ -387,7 +385,6 @@ typedef enum
   META_BUTTON_FUNCTION_MINIMIZE,
   META_BUTTON_FUNCTION_MAXIMIZE,
   META_BUTTON_FUNCTION_CLOSE,
-  META_BUTTON_FUNCTION_APPMENU,
   META_BUTTON_FUNCTION_LAST
 } MetaButtonFunction;
 
@@ -396,10 +393,10 @@ typedef enum
 /* Keep array size in sync with MAX_BUTTONS_PER_CORNER */
 /**
  * MetaButtonLayout:
- * @left_buttons: (array fixed-size=5):
- * @right_buttons: (array fixed-size=5):
- * @left_buttons_has_spacer: (array fixed-size=5):
- * @right_buttons_has_spacer: (array fixed-size=5):
+ * @left_buttons: (array fixed-size=4):
+ * @right_buttons: (array fixed-size=4):
+ * @left_buttons_has_spacer: (array fixed-size=4):
+ * @right_buttons_has_spacer: (array fixed-size=4):
  */
 typedef struct _MetaButtonLayout MetaButtonLayout;
 struct _MetaButtonLayout
diff --git a/src/ui/frames.c b/src/ui/frames.c
index 6d7b999be..a361eb795 100644
--- a/src/ui/frames.c
+++ b/src/ui/frames.c
@@ -1025,19 +1025,16 @@ meta_frame_left_click_event (MetaUIFrame        *frame,
     case META_FRAME_CONTROL_MINIMIZE:
     case META_FRAME_CONTROL_DELETE:
     case META_FRAME_CONTROL_MENU:
-    case META_FRAME_CONTROL_APPMENU:
       frame->grab_button = get_button_number (event);
       frame->button_state = META_BUTTON_STATE_PRESSED;
       frame->prelit_control = control;
       redraw_control (frame, control);
 
-      if (control == META_FRAME_CONTROL_MENU ||
-          control == META_FRAME_CONTROL_APPMENU)
+      if (control == META_FRAME_CONTROL_MENU)
         {
           MetaFrameGeometry fgeom;
           GdkRectangle *rect;
           MetaRectangle root_rect;
-          MetaWindowMenuType menu;
           int win_x, win_y;
 
           meta_ui_frame_calc_geometry (frame, &fgeom);
@@ -1051,9 +1048,6 @@ meta_frame_left_click_event (MetaUIFrame        *frame,
           root_rect.width = rect->width;
           root_rect.height = rect->height;
 
-          menu = control == META_FRAME_CONTROL_MENU ? META_WINDOW_MENU_WM
-            : META_WINDOW_MENU_APP;
-
           /* if the compositor takes a grab for showing the menu, we will
            * get a LeaveNotify event we want to ignore, to keep the pressed
            * button state while the menu is open
@@ -1061,7 +1055,7 @@ meta_frame_left_click_event (MetaUIFrame        *frame,
           frame->maybe_ignore_leave_notify = TRUE;
           meta_core_show_window_menu_for_rect (display,
                                                frame->xwindow,
-                                               menu,
+                                               META_WINDOW_MENU_WM,
                                                &root_rect,
                                                evtime);
         }
@@ -1257,8 +1251,6 @@ meta_ui_frame_update_prelit_control (MetaUIFrame     *frame,
       break;
     case META_FRAME_CONTROL_MENU:
       break;
-    case META_FRAME_CONTROL_APPMENU:
-      break;
     case META_FRAME_CONTROL_MINIMIZE:
       break;
     case META_FRAME_CONTROL_MAXIMIZE:
@@ -1299,7 +1291,6 @@ meta_ui_frame_update_prelit_control (MetaUIFrame     *frame,
   switch (control)
     {
     case META_FRAME_CONTROL_MENU:
-    case META_FRAME_CONTROL_APPMENU:
     case META_FRAME_CONTROL_MINIMIZE:
     case META_FRAME_CONTROL_MAXIMIZE:
     case META_FRAME_CONTROL_DELETE:
@@ -1532,9 +1523,6 @@ meta_ui_frame_paint (MetaUIFrame  *frame,
     case META_FRAME_CONTROL_MENU:
       button_type = META_BUTTON_TYPE_MENU;
       break;
-    case META_FRAME_CONTROL_APPMENU:
-      button_type = META_BUTTON_TYPE_APPMENU;
-      break;
     case META_FRAME_CONTROL_MINIMIZE:
       button_type = META_BUTTON_TYPE_MINIMIZE;
       break;
@@ -1690,9 +1678,6 @@ control_rect (MetaFrameControl control,
     case META_FRAME_CONTROL_MENU:
       rect = &fgeom->menu_rect.visible;
       break;
-    case META_FRAME_CONTROL_APPMENU:
-      rect = &fgeom->appmenu_rect.visible;
-      break;
     case META_FRAME_CONTROL_MINIMIZE:
       rect = &fgeom->min_rect.visible;
       break;
@@ -1758,9 +1743,6 @@ get_control (MetaUIFrame *frame, int root_x, int root_y)
   if (POINT_IN_RECT (x, y, fgeom.menu_rect.clickable))
     return META_FRAME_CONTROL_MENU;
 
-  if (POINT_IN_RECT (x, y, fgeom.appmenu_rect.clickable))
-    return META_FRAME_CONTROL_APPMENU;
-
   flags = meta_frame_get_flags (frame->meta_window->frame);
   type = meta_window_get_frame_type (frame->meta_window);
 
diff --git a/src/ui/frames.h b/src/ui/frames.h
index 397f350f6..a154a2b2b 100644
--- a/src/ui/frames.h
+++ b/src/ui/frames.h
@@ -35,7 +35,6 @@ typedef enum
   META_FRAME_CONTROL_TITLE,
   META_FRAME_CONTROL_DELETE,
   META_FRAME_CONTROL_MENU,
-  META_FRAME_CONTROL_APPMENU,
   META_FRAME_CONTROL_MINIMIZE,
   META_FRAME_CONTROL_MAXIMIZE,
   META_FRAME_CONTROL_UNMAXIMIZE,
diff --git a/src/ui/theme-private.h b/src/ui/theme-private.h
index eaee95d10..1869c8d34 100644
--- a/src/ui/theme-private.h
+++ b/src/ui/theme-private.h
@@ -127,14 +127,13 @@ struct _MetaFrameGeometry
 
   /* used for a memset hack */
 #define ADDRESS_OF_BUTTON_RECTS(fgeom) (((char*)(fgeom)) + G_STRUCT_OFFSET (MetaFrameGeometry, close_rect))
-#define LENGTH_OF_BUTTON_RECTS (G_STRUCT_OFFSET (MetaFrameGeometry, appmenu_rect) + sizeof (MetaButtonSpace) 
- G_STRUCT_OFFSET (MetaFrameGeometry, close_rect))
+#define LENGTH_OF_BUTTON_RECTS (G_STRUCT_OFFSET (MetaFrameGeometry, menu_rect) + sizeof (MetaButtonSpace) - 
G_STRUCT_OFFSET (MetaFrameGeometry, close_rect))
 
   /* The button rects (if changed adjust memset hack) */
   MetaButtonSpace close_rect;
   MetaButtonSpace max_rect;
   MetaButtonSpace min_rect;
   MetaButtonSpace menu_rect;
-  MetaButtonSpace appmenu_rect;
   /* End of button rects (if changed adjust memset hack) */
 
   /* Saved button layout */
@@ -163,7 +162,6 @@ typedef enum
   META_BUTTON_TYPE_MAXIMIZE,
   META_BUTTON_TYPE_MINIMIZE,
   META_BUTTON_TYPE_MENU,
-  META_BUTTON_TYPE_APPMENU,
   META_BUTTON_TYPE_LAST
 } MetaButtonType;
 
diff --git a/src/ui/theme.c b/src/ui/theme.c
index c0bb9b66a..7c2c67d50 100644
--- a/src/ui/theme.c
+++ b/src/ui/theme.c
@@ -166,11 +166,6 @@ rect_for_function (MetaFrameGeometry *fgeom,
         return &fgeom->menu_rect;
       else
         return NULL;
-    case META_BUTTON_FUNCTION_APPMENU:
-      if (flags & META_FRAME_ALLOWS_APPMENU)
-        return &fgeom->appmenu_rect;
-      else
-        return NULL;
     case META_BUTTON_FUNCTION_MINIMIZE:
       if (flags & META_FRAME_ALLOWS_MINIMIZE)
         return &fgeom->min_rect;
@@ -519,10 +514,6 @@ meta_frame_layout_calc_geometry (MetaFrameLayout        *layout,
         continue;
       else if (strip_button (left_func_rects, &n_left, &fgeom->menu_rect))
         continue;
-      else if (strip_button (right_func_rects, &n_right, &fgeom->appmenu_rect))
-        continue;
-      else if (strip_button (left_func_rects, &n_left, &fgeom->appmenu_rect))
-        continue;
       else
         {
           meta_bug ("Could not find a button to strip. n_left = %d n_right = %d\n",
@@ -690,10 +681,6 @@ get_button_rect (MetaButtonType           type,
       *rect = fgeom->menu_rect.visible;
       break;
 
-    case META_BUTTON_TYPE_APPMENU:
-      *rect = fgeom->appmenu_rect.visible;
-      break;
-
     default:
     case META_BUTTON_TYPE_LAST:
       g_assert_not_reached ();
@@ -712,8 +699,6 @@ get_class_from_button_type (MetaButtonType type)
       return "maximize";
     case META_BUTTON_TYPE_MINIMIZE:
       return "minimize";
-    case META_BUTTON_TYPE_APPMENU:
-      return "appmenu";
     default:
       return NULL;
     }
@@ -868,9 +853,6 @@ meta_frame_layout_draw_with_style (MetaFrameLayout         *layout,
             case META_BUTTON_TYPE_MENU:
                icon_name = "open-menu-symbolic";
                break;
-            case META_BUTTON_TYPE_APPMENU:
-               surface = cairo_surface_reference (mini_icon);
-               break;
             default:
                icon_name = NULL;
                break;


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