wayland: Add support for show_window_menu

This commit is contained in:
Jasper St. Pierre 2014-03-13 16:54:04 -04:00
parent 8ce4407a9f
commit 27bec68c67
2 changed files with 32 additions and 0 deletions

View File

@ -218,6 +218,20 @@
<arg name="surface_type" type="uint" summary="a surface type from surface_type"/> <arg name="surface_type" type="uint" summary="a surface type from surface_type"/>
</request> </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"> <request name="move">
<description summary="start an interactive move"> <description summary="start an interactive move">
Start a pointer-driven move of the surface. Start a pointer-driven move of the surface.

View File

@ -775,6 +775,23 @@ xdg_surface_set_surface_type (struct wl_client *client,
window_type_from_surface_type (surface_type)); 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 static gboolean
begin_grab_op_on_surface (MetaWaylandSurface *surface, begin_grab_op_on_surface (MetaWaylandSurface *surface,
MetaWaylandSeat *seat, MetaWaylandSeat *seat,
@ -925,6 +942,7 @@ static const struct xdg_surface_interface meta_wayland_xdg_surface_interface = {
xdg_surface_set_title, xdg_surface_set_title,
xdg_surface_set_app_id, xdg_surface_set_app_id,
xdg_surface_set_surface_type, xdg_surface_set_surface_type,
xdg_surface_show_window_menu,
xdg_surface_move, xdg_surface_move,
xdg_surface_resize, xdg_surface_resize,
xdg_surface_set_output, xdg_surface_set_output,