git.lucas.co / cce-compositor
Wayland compositor (wlroots)
git clone https://git.lucas.co/cce-compositor.git

commite2d92c28da6796b074cfd71d9075c40254ef38ef
parent83733c7658
authorIsaac Freund <[email protected]>
date2024-04-29 13:51
rwm: add interactive pointer move/resize

All events/requests are pointer-specific so that support for touch and
tablet tool move/resize may be added with new events in the future.
The pointer case is simpler as there is only a single global pointer per
seat while there may be multiple touch points/tablet tools.

 protocol/river-window-management-v1.xml | 76 ++++++++++++++++++++++++++++++++-
 1 file changed, 74 insertions(+), 2 deletions(-)

diff --git a/protocol/river-window-management-v1.xml b/protocol/river-window-management-v1.xml
index 5ebf184..03c10c3 100644
--- a/protocol/river-window-management-v1.xml
+++ b/protocol/river-window-management-v1.xml
@@ -263,7 +263,7 @@
       </description>
     </request>
 
-    <enum name="border_edges" bitfield="true">
+    <enum name="edges" bitfield="true">
       <entry name="none" value="0"/>
       <entry name="top" value="1"/>
       <entry name="bottom" value="2"/>
@@ -286,7 +286,7 @@
         This request is double-buffered state and will not be applied until the
         next river_window_manager_v1.commit request.
       </description>
-      <arg name="edges" type="uint" enum="border_edges"/>
+      <arg name="edges" type="uint" enum="edges"/>
       <arg name="width" type="int"/>
       <arg name="r" type="uint"/>
       <arg name="g" type="uint"/>
@@ -304,6 +304,42 @@
       <arg name="id" type="new_id" interface="river_decoration_v1"/>
       <arg name="surface" type="object" interface="wl_surface"/>
     </request>
+
+    <event name="pointer_move_requested">
+      <description summary="the window requested interactive move">
+        The xdg-shell protocol for example allows windows to request that an
+        interactive move be started, perhaps when a client-side rendered
+        titlebar is dragged.
+
+        This event informs the window manager that the window has requested to
+        be interactively moved using the pointer. The window manager is free to
+        honor this request using river_seat_v1.pointer_move_window or ignore it.
+
+        This event is double-buffered state and will be followed by a
+        river_window_manager_v1.update event.
+      </description>
+    </event>
+
+    <event name="pointer_resize_requested">
+      <description summary="the window requested interactive resize">
+        The xdg-shell protocol for example allows windows to request that an
+        interactive resize be started, perhaps when the corner of client-side
+        rendered decorations is dragged.
+
+        This event informs the window manager that the window has requested to
+        be interactively resized using the pointer. The window manager is free
+        to honor this request using river_seat_v1.pointer_resize_window or
+        ignore it.
+
+        The edges argument indicates which edges the window has requested to be
+        resized from. The edges argument will never be none and will never have
+        both top and bottom or both left and right edges set.
+
+        This event is double-buffered state and will be followed by a
+        river_window_manager_v1.update event.
+      </description>
+      <arg name="edges" type="uint" enum="edges"/>
+    </event>
   </interface>
 
   <interface name="river_decoration_v1" version="1">
@@ -646,5 +682,41 @@
       </description>
       <arg name="window" type="object" interface="river_window_v1"/>
     </event>
+
+    <request name="pointer_move_window">
+      <description summary="start interactive pointer move of a window">
+        This request causes the position of a window to be updated while the
+        pointer is moved. Multiple windows may be interactivey moved at the same
+        time.
+
+        The interactive move is ended when all pointer buttons are released.
+        This request is ignored if no pointer buttons are held.
+
+        This request is double-buffered state and will not be applied until the
+        next river_window_manager_v1.commit request.
+      </description>
+      <arg name="window" type="object" interface="river_window_v1"/>
+    </request>
+
+    <request name="pointer_resize_window">
+      <description summary="start interactive pointer resize of a window">
+        This request causes the a window to be resized from the specified edges,
+        updating the position/dimensions of the window as while the pointer is
+        moved. Multiple windows may be interactively resized at the same time.
+
+        The interactive resize is ended when all pointer buttons are released.
+        This request is ignored if no pointer buttons are held.
+
+        It is a protocol error to set the edges argument to none. It is also an
+        error to set both the top and bottom edges or both the left and right
+        edges. Resizing from, for example, both the top and right edges is
+        allowed.
+
+        This request is double-buffered state and will not be applied until the
+        next river_window_manager_v1.commit request.
+      </description>
+      <arg name="window" type="object" interface="river_window_v1"/>
+      <arg name="edges" type="uint" enum="river_window_v1.edges"/>
+    </request>
   </interface>
 </protocol>