summaryrefslogtreecommitdiff
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
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
-rw-r--r--src/core/prefs.c2
-rw-r--r--src/include/common.h33
-rw-r--r--src/ui/frames.c25
-rw-r--r--src/ui/frames.h1
-rw-r--r--src/ui/theme-parser.c2
-rw-r--r--src/ui/theme.c29
-rw-r--r--src/ui/theme.h2
7 files changed, 76 insertions, 18 deletions
diff --git a/src/core/prefs.c b/src/core/prefs.c
index b5f9f7e3..74cf0ca7 100644
--- a/src/core/prefs.c
+++ b/src/core/prefs.c
@@ -1267,6 +1267,8 @@ 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/include/common.h b/src/include/common.h
index 6e94c7a0..83b750a9 100644
--- a/src/include/common.h
+++ b/src/include/common.h
@@ -35,21 +35,22 @@ typedef enum
{
META_FRAME_ALLOWS_DELETE = 1 << 0,
META_FRAME_ALLOWS_MENU = 1 << 1,
- 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
+ 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
} MetaFrameFlags;
typedef enum
@@ -143,6 +144,7 @@ typedef enum
META_GRAB_OP_CLICKING_UNMAXIMIZE_HORIZONTAL,
META_GRAB_OP_CLICKING_DELETE,
META_GRAB_OP_CLICKING_MENU,
+ META_GRAB_OP_CLICKING_APPMENU,
META_GRAB_OP_CLICKING_SHADE,
META_GRAB_OP_CLICKING_UNSHADE,
META_GRAB_OP_CLICKING_ABOVE,
@@ -271,6 +273,7 @@ typedef enum
typedef enum
{
META_BUTTON_FUNCTION_MENU,
+ META_BUTTON_FUNCTION_APPMENU,
META_BUTTON_FUNCTION_MINIMIZE,
META_BUTTON_FUNCTION_MAXIMIZE,
META_BUTTON_FUNCTION_CLOSE,
diff --git a/src/ui/frames.c b/src/ui/frames.c
index a8cb96fa..c0ad3ede 100644
--- a/src/ui/frames.c
+++ b/src/ui/frames.c
@@ -1116,6 +1116,9 @@ show_tip_now (MetaFrames *frames)
case META_FRAME_CONTROL_MENU:
tiptext = _("Window Menu");
break;
+ case META_FRAME_CONTROL_APPMENU:
+ tiptext = _("Window App Menu");
+ break;
case META_FRAME_CONTROL_MINIMIZE:
tiptext = _("Minimize Window");
break;
@@ -1466,6 +1469,9 @@ meta_frames_button_press_event (GtkWidget *widget,
case META_FRAME_CONTROL_MENU:
op = META_GRAB_OP_CLICKING_MENU;
break;
+ case META_FRAME_CONTROL_APPMENU:
+ op = META_GRAB_OP_CLICKING_APPMENU;
+ break;
case META_FRAME_CONTROL_SHADE:
op = META_GRAB_OP_CLICKING_SHADE;
break;
@@ -1730,6 +1736,7 @@ meta_frames_button_release_event (GtkWidget *widget,
break;
case META_GRAB_OP_CLICKING_MENU:
+ case META_GRAB_OP_CLICKING_APPMENU:
meta_core_end_grab_op (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), event->time);
break;
@@ -1816,6 +1823,8 @@ meta_frames_update_prelit_control (MetaFrames *frames,
break;
case META_FRAME_CONTROL_MENU:
break;
+ case META_FRAME_CONTROL_APPMENU:
+ break;
case META_FRAME_CONTROL_MINIMIZE:
break;
case META_FRAME_CONTROL_MAXIMIZE:
@@ -1868,6 +1877,7 @@ meta_frames_update_prelit_control (MetaFrames *frames,
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:
@@ -1921,6 +1931,7 @@ meta_frames_motion_notify_event (GtkWidget *widget,
switch (grab_op)
{
case META_GRAB_OP_CLICKING_MENU:
+ case META_GRAB_OP_CLICKING_APPMENU:
case META_GRAB_OP_CLICKING_DELETE:
case META_GRAB_OP_CLICKING_MINIMIZE:
case META_GRAB_OP_CLICKING_MAXIMIZE:
@@ -1951,6 +1962,8 @@ meta_frames_motion_notify_event (GtkWidget *widget,
control = get_control (frames, frame, x, y);
if (! ((control == META_FRAME_CONTROL_MENU &&
grab_op == META_GRAB_OP_CLICKING_MENU) ||
+ (control == META_FRAME_CONTROL_APPMENU &&
+ grab_op == META_GRAB_OP_CLICKING_APPMENU) ||
(control == META_FRAME_CONTROL_DELETE &&
grab_op == META_GRAB_OP_CLICKING_DELETE) ||
(control == META_FRAME_CONTROL_MINIMIZE &&
@@ -2352,6 +2365,12 @@ meta_frames_paint_to_drawable (MetaFrames *frames,
else
button_states[META_BUTTON_TYPE_MENU] = META_BUTTON_STATE_PRELIGHT;
break;
+ case META_FRAME_CONTROL_APPMENU:
+ if (grab_op == META_GRAB_OP_CLICKING_MENU)
+ button_states[META_BUTTON_TYPE_APPMENU] = META_BUTTON_STATE_PRESSED;
+ else
+ button_states[META_BUTTON_TYPE_APPMENU] = META_BUTTON_STATE_PRELIGHT;
+ break;
case META_FRAME_CONTROL_MINIMIZE:
if (grab_op == META_GRAB_OP_CLICKING_MINIMIZE)
button_states[META_BUTTON_TYPE_MINIMIZE] = META_BUTTON_STATE_PRESSED;
@@ -2549,6 +2568,9 @@ 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;
@@ -2635,6 +2657,9 @@ get_control (MetaFrames *frames,
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;
+
meta_core_get (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow,
META_CORE_GET_FRAME_FLAGS, &flags,
META_CORE_GET_END);
diff --git a/src/ui/frames.h b/src/ui/frames.h
index 0c7f3a5c..8124a927 100644
--- a/src/ui/frames.h
+++ b/src/ui/frames.h
@@ -35,6 +35,7 @@ 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-parser.c b/src/ui/theme-parser.c
index 1a632d4f..a328fd06 100644
--- a/src/ui/theme-parser.c
+++ b/src/ui/theme-parser.c
@@ -38,7 +38,7 @@
* look out for.
*/
#define THEME_MAJOR_VERSION 3
-#define THEME_MINOR_VERSION 4
+#define THEME_MINOR_VERSION 5
#define THEME_VERSION (1000 * THEME_MAJOR_VERSION + THEME_MINOR_VERSION)
#define MARCO_THEME_FILENAME_FORMAT "metacity-theme-%d.xml"
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;
diff --git a/src/ui/theme.h b/src/ui/theme.h
index 56144edc..4e21a6e5 100644
--- a/src/ui/theme.h
+++ b/src/ui/theme.h
@@ -192,6 +192,7 @@ struct _MetaFrameGeometry
MetaButtonSpace max_rect;
MetaButtonSpace min_rect;
MetaButtonSpace menu_rect;
+ MetaButtonSpace appmenu_rect;
MetaButtonSpace shade_rect;
MetaButtonSpace above_rect;
MetaButtonSpace stick_rect;
@@ -609,6 +610,7 @@ typedef enum
META_BUTTON_TYPE_MAXIMIZE,
META_BUTTON_TYPE_MINIMIZE,
META_BUTTON_TYPE_MENU,
+ META_BUTTON_TYPE_APPMENU,
META_BUTTON_TYPE_SHADE,
META_BUTTON_TYPE_ABOVE,
META_BUTTON_TYPE_STICK,