From de76074336b64b23411d3ffcb107daaaabfdd1a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 4 Oct 2018 22:09:15 +0200 Subject: [PATCH] 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 e0a952165..7eea0a336 100644 --- a/src/core/frame.c +++ b/src/core/frame.c @@ -252,10 +252,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 dca4ced07..fdee5b2e8 100644 --- a/src/core/prefs.c +++ b/src/core/prefs.c @@ -1260,8 +1260,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 34228646b..02e280277 100644 --- a/src/meta/common.h +++ b/src/meta/common.h @@ -52,7 +52,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 @@ -73,22 +72,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; /** @@ -389,7 +387,6 @@ typedef enum META_BUTTON_FUNCTION_MINIMIZE, META_BUTTON_FUNCTION_MAXIMIZE, META_BUTTON_FUNCTION_CLOSE, - META_BUTTON_FUNCTION_APPMENU, META_BUTTON_FUNCTION_LAST } MetaButtonFunction; @@ -398,10 +395,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 77f4eb77d..dce5a4f73 100644 --- a/src/ui/frames.c +++ b/src/ui/frames.c @@ -1027,19 +1027,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); @@ -1053,9 +1050,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 @@ -1063,7 +1057,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); } @@ -1260,8 +1254,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: @@ -1302,7 +1294,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: @@ -1535,9 +1526,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; @@ -1693,9 +1681,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; @@ -1761,9 +1746,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 fc69d2c78..cc6316b3e 100644 --- a/src/ui/frames.h +++ b/src/ui/frames.h @@ -36,7 +36,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 1e88ba596..269dbe867 100644 --- a/src/ui/theme-private.h +++ b/src/ui/theme-private.h @@ -128,14 +128,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 */ @@ -164,7 +163,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 223bc04ae..53d7ef555 100644 --- a/src/ui/theme.c +++ b/src/ui/theme.c @@ -169,11 +169,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; @@ -522,10 +517,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", @@ -693,10 +684,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 (); @@ -715,8 +702,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; } @@ -871,9 +856,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;