Add new surface.map_transient() request to map a surface relative to another
authorKristian Høgsberg <krh@bitplanet.net>
Fri, 21 Jan 2011 23:02:24 +0000 (18:02 -0500)
committerKristian Høgsberg <krh@bitplanet.net>
Fri, 21 Jan 2011 23:02:24 +0000 (18:02 -0500)
compositor/compositor.c
protocol/wayland.xml

index b1767ed..5199b9e 100644 (file)
@@ -473,6 +473,26 @@ surface_map_toplevel(struct wl_client *client,
 }
 
 static void
+surface_map_transient(struct wl_client *client,
+                     struct wl_surface *surface, struct wl_surface *parent,
+                     int x, int y, uint32_t flags)
+{
+       struct wlsc_surface *es = (struct wlsc_surface *) surface;
+       struct wlsc_surface *pes = (struct wlsc_surface *) parent;
+
+       if (es->mapped)
+               return;
+
+       es->x = pes->x + x;
+       es->y = pes->y + y;
+
+       wlsc_surface_update_matrix(es);
+       wl_list_insert(&es->compositor->surface_list, &es->link);
+       wlsc_compositor_schedule_repaint(es->compositor);
+       es->mapped = 1;
+}
+
+static void
 surface_damage(struct wl_client *client,
               struct wl_surface *surface,
               int32_t x, int32_t y, int32_t width, int32_t height)
@@ -487,6 +507,7 @@ const static struct wl_surface_interface surface_interface = {
        surface_destroy,
        surface_attach,
        surface_map_toplevel,
+       surface_map_transient,
        surface_damage
 };
 
index 75ccb5b..7f1a377 100644 (file)
     <!-- Make the surface visible as a toplevel window. -->
     <request name="map_toplevel"/>
 
+    <!-- Map the surface relative to an existing surface. The x and y
+         arguments specify the locations of the upper left corner of
+         the surface relative to the upper left corner of the parent
+         surface.  The flags argument controls overflow/clipping
+         behaviour when the surface would intersect a screen edge,
+         panel or such.  And possibly whether the offset only
+         determines the initial position or if the surface is locked
+         to that relative position during moves. -->
+    <request name="map_transient">
+      <arg name="parent" type="object" interface="surface"/>
+      <arg name="x" type="int"/>
+      <arg name="y" type="int"/>
+      <arg name="flags" type="uint"/>
+    </request>
+
     <!-- Notify the server that the attached buffer's contents have
          changed, and request a redraw. The arguments allow you to
          damage only a part of the surface, but the server may ignore