diff options
author | Jasper St. Pierre <jstpierre@mecheye.net> | 2014-03-13 16:54:04 -0400 |
---|---|---|
committer | Jasper St. Pierre <jstpierre@mecheye.net> | 2014-03-14 10:22:13 -0400 |
commit | 27bec68c67464f72379d48d1ba3d6a7b81979a5b (patch) | |
tree | 26558d79373bf312e2dc52ff3f134200b4d6a34e | |
parent | 8ce4407a9f157e3475b58fd863c5dcc2f57342db (diff) | |
download | mutter-wip/compositor-menu.tar.gz |
wayland: Add support for show_window_menuwip/compositor-menu
-rw-r--r-- | protocol/xdg-shell.xml | 14 | ||||
-rw-r--r-- | src/wayland/meta-wayland-surface.c | 18 |
2 files changed, 32 insertions, 0 deletions
diff --git a/protocol/xdg-shell.xml b/protocol/xdg-shell.xml index 47ff2605a..4d2dfd9e0 100644 --- a/protocol/xdg-shell.xml +++ b/protocol/xdg-shell.xml @@ -218,6 +218,20 @@ <arg name="surface_type" type="uint" summary="a surface type from surface_type"/> </request> + <request name="show_window_menu"> + <description summary="show the window menu"> + Clients implementing client-side decorations might want to show + a context menu when right-clicking on the decorations, giving the + user a menu that they can use to maximize or minimize the window. + + The seat passed must have either pointer or keyboard focus to pop + up the window menu for a surface. + </description> + + <arg name="seat" type="object" interface="wl_seat" summary="the seat to pop the window up on"/> + <arg name="serial" type="uint" summary="serial of the event to pop up the window for"/> + </request> + <request name="move"> <description summary="start an interactive move"> Start a pointer-driven move of the surface. diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c index 2f386ec56..4a304f1d7 100644 --- a/src/wayland/meta-wayland-surface.c +++ b/src/wayland/meta-wayland-surface.c @@ -775,6 +775,23 @@ xdg_surface_set_surface_type (struct wl_client *client, window_type_from_surface_type (surface_type)); } +static void +xdg_surface_show_window_menu (struct wl_client *client, + struct wl_resource *resource, + struct wl_resource *seat_resource, + uint32_t serial) +{ + MetaWaylandSeat *seat = wl_resource_get_user_data (seat_resource); + MetaWaylandSurface *surface = wl_resource_get_user_data (resource); + + if (seat->pointer.button_count == 0 || + seat->pointer.grab_serial != serial || + seat->pointer.focus_surface != surface) + return; + + meta_window_show_menu (surface->window); +} + static gboolean begin_grab_op_on_surface (MetaWaylandSurface *surface, MetaWaylandSeat *seat, @@ -925,6 +942,7 @@ static const struct xdg_surface_interface meta_wayland_xdg_surface_interface = { xdg_surface_set_title, xdg_surface_set_app_id, xdg_surface_set_surface_type, + xdg_surface_show_window_menu, xdg_surface_move, xdg_surface_resize, xdg_surface_set_output, |