summaryrefslogtreecommitdiff
path: root/src/ui/theme.c
diff options
context:
space:
mode:
authorAlberts Muktupāvels <[email protected]>2014-10-07 05:37:23 +0300
committerVictor Kareh <[email protected]>2018-08-28 18:53:42 -0400
commitc49f361a93752ffb53d99fd55fa7e8db2ac660c5 (patch)
treef5c02fb0bbb261f96900f09ec170c72ba5e8cc07 /src/ui/theme.c
parentcb9a1be4e7d324be0ec58b1783f72783e1a8f576 (diff)
downloadmarco-c49f361a93752ffb53d99fd55fa7e8db2ac660c5.tar.bz2
marco-c49f361a93752ffb53d99fd55fa7e8db2ac660c5.tar.xz
add support for app-menu button in theme
Add app-menu button support in themes. This is done only to support metacity theme format 3.5 version. Marco will not show this button! Based on metacity commit: https://gitlab.gnome.org/GNOME/metacity/commit/6a2cc159
Diffstat (limited to 'src/ui/theme.c')
-rw-r--r--src/ui/theme.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/src/ui/theme.c b/src/ui/theme.c
index 6f463b3d..7035db5f 100644
--- a/src/ui/theme.c
+++ b/src/ui/theme.c
@@ -468,6 +468,8 @@ map_button_function_to_type (MetaButtonFunction function)
return META_BUTTON_TYPE_UNSTICK;
case META_BUTTON_FUNCTION_MENU:
return META_BUTTON_TYPE_MENU;
+ case META_BUTTON_FUNCTION_APPMENU:
+ return META_BUTTON_TYPE_APPMENU;
case META_BUTTON_FUNCTION_MINIMIZE:
return META_BUTTON_TYPE_MINIMIZE;
case META_BUTTON_FUNCTION_MAXIMIZE:
@@ -536,6 +538,11 @@ 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;
@@ -834,6 +841,12 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout *layout,
else if (strip_button (left_func_rects, left_bg_rects,
&n_left, &fgeom->menu_rect))
continue;
+ else if (strip_button (right_func_rects, right_bg_rects,
+ &n_right, &fgeom->appmenu_rect))
+ continue;
+ else if (strip_button (left_func_rects, left_bg_rects,
+ &n_left, &fgeom->appmenu_rect))
+ continue;
else
{
meta_bug ("Could not find a button to strip. n_left = %d n_right = %d\n",
@@ -4412,7 +4425,7 @@ map_button_state (MetaButtonType button_type,
switch (button_type)
{
- /* First hande functions, which map directly */
+ /* First handle functions, which map directly */
case META_BUTTON_TYPE_SHADE:
case META_BUTTON_TYPE_ABOVE:
case META_BUTTON_TYPE_STICK:
@@ -4420,6 +4433,7 @@ map_button_state (MetaButtonType button_type,
case META_BUTTON_TYPE_UNABOVE:
case META_BUTTON_TYPE_UNSTICK:
case META_BUTTON_TYPE_MENU:
+ case META_BUTTON_TYPE_APPMENU:
case META_BUTTON_TYPE_MINIMIZE:
case META_BUTTON_TYPE_MAXIMIZE:
case META_BUTTON_TYPE_CLOSE:
@@ -4626,6 +4640,10 @@ get_button_rect (MetaButtonType type,
*rect = fgeom->menu_rect.visible;
break;
+ case META_BUTTON_TYPE_APPMENU:
+ *rect = fgeom->appmenu_rect.visible;
+ break;
+
case META_BUTTON_TYPE_LAST:
g_assert_not_reached ();
break;
@@ -6081,6 +6099,8 @@ meta_button_type_from_string (const char *str, MetaTheme *theme)
return META_BUTTON_TYPE_MINIMIZE;
else if (strcmp ("menu", str) == 0)
return META_BUTTON_TYPE_MENU;
+ else if (strcmp ("appmenu", str) == 0)
+ return META_BUTTON_TYPE_APPMENU;
else if (strcmp ("left_left_background", str) == 0)
return META_BUTTON_TYPE_LEFT_LEFT_BACKGROUND;
else if (strcmp ("left_middle_background", str) == 0)
@@ -6124,8 +6144,10 @@ meta_button_type_to_string (MetaButtonType type)
return "unabove";
case META_BUTTON_TYPE_UNSTICK:
return "unstick";
- case META_BUTTON_TYPE_MENU:
+ case META_BUTTON_TYPE_MENU:
return "menu";
+ case META_BUTTON_TYPE_APPMENU:
+ return "appmenu";
case META_BUTTON_TYPE_LEFT_LEFT_BACKGROUND:
return "left_left_background";
case META_BUTTON_TYPE_LEFT_MIDDLE_BACKGROUND:
@@ -7005,6 +7027,9 @@ meta_theme_earliest_version_with_button (MetaButtonType type)
case META_BUTTON_TYPE_RIGHT_SINGLE_BACKGROUND:
return 3003;
+ case META_BUTTON_TYPE_APPMENU:
+ return 3005;
+
default:
meta_warning("Unknown button %d\n", type);
return 1000;