[mutter] wayland: Add support for show_window_menu



commit efcd7d86e76cbeaeba49b95a247c1801d81a4707
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu Mar 13 16:54:04 2014 -0400

    wayland: Add support for show_window_menu

 src/wayland/meta-wayland-surface.c |   18 ++++++++++++++++++
 src/wayland/protocol/xdg-shell.xml |   16 ++++++++++++++++
 2 files changed, 34 insertions(+), 0 deletions(-)
---
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
index e9e09e4..c2abdd4 100644
--- a/src/wayland/meta-wayland-surface.c
+++ b/src/wayland/meta-wayland-surface.c
@@ -770,6 +770,23 @@ xdg_surface_set_app_id (struct wl_client *client,
   meta_window_set_wm_class (surface->window, app_id, app_id);
 }
 
+static void
+xdg_surface_show_window_menu (struct wl_client *client,
+                              struct wl_resource *resource,
+                              struct wl_resource *seat_resource,
+                              uint32_t serial,
+                              uint32_t x,
+                              uint32_t y)
+{
+  MetaWaylandSeat *seat = wl_resource_get_user_data (seat_resource);
+  MetaWaylandSurface *surface = wl_resource_get_user_data (resource);
+
+  if (!meta_wayland_seat_can_grab_surface (seat, surface, serial))
+    return;
+
+  meta_window_show_menu (surface->window, x, y);
+}
+
 static gboolean
 begin_grab_op_on_surface (MetaWaylandSurface *surface,
                           MetaWaylandSeat    *seat,
@@ -910,6 +927,7 @@ static const struct xdg_surface_interface meta_wayland_xdg_surface_interface = {
   xdg_surface_set_margin,
   xdg_surface_set_title,
   xdg_surface_set_app_id,
+  xdg_surface_show_window_menu,
   xdg_surface_move,
   xdg_surface_resize,
   xdg_surface_ack_configure,
diff --git a/src/wayland/protocol/xdg-shell.xml b/src/wayland/protocol/xdg-shell.xml
index 3c18610..570b24e 100644
--- a/src/wayland/protocol/xdg-shell.xml
+++ b/src/wayland/protocol/xdg-shell.xml
@@ -198,6 +198,22 @@
       <arg name="app_id" type="string"/>
     </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"/>
+      <arg name="x" type="uint"/>
+      <arg name="y" type="uint"/>
+    </request>
+
     <request name="move">
       <description summary="start an interactive move">
        Start a pointer-driven move of the surface.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]