| 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <protocol name="xdg_toplevel_drag_v1"> |
| 3 | |
| 4 | <copyright> |
| 5 | Copyright 2023 David Redondo |
| 6 | |
| 7 | Permission is hereby granted, free of charge, to any person obtaining a |
| 8 | copy of this software and associated documentation files (the "Software"), |
| 9 | to deal in the Software without restriction, including without limitation |
| 10 | the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 11 | and/or sell copies of the Software, and to permit persons to whom the |
| 12 | Software is furnished to do so, subject to the following conditions: |
| 13 | |
| 14 | The above copyright notice and this permission notice (including the next |
| 15 | paragraph) shall be included in all copies or substantial portions of the |
| 16 | Software. |
| 17 | |
| 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 21 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 23 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 24 | DEALINGS IN THE SOFTWARE. |
| 25 | </copyright> |
| 26 | |
| 27 | <interface name="xdg_toplevel_drag_manager_v1" version="1"> |
| 28 | <description summary="Move a window during a drag"> |
| 29 | This protocol enhances normal drag and drop with the ability to move a |
| 30 | window at the same time. This allows having detachable parts of a window |
| 31 | that when dragged out of it become a new window and can be dragged over |
| 32 | an existing window to be reattached. |
| 33 | |
| 34 | A typical workflow would be when the user starts dragging on top of a |
| 35 | detachable part of a window, the client would create a wl_data_source and |
| 36 | a xdg_toplevel_drag_v1 object and start the drag as normal via |
| 37 | wl_data_device.start_drag. Once the client determines that the detachable |
| 38 | window contents should be detached from the originating window, it creates |
| 39 | a new xdg_toplevel with these contents and issues a |
| 40 | xdg_toplevel_drag_v1.attach request before mapping it. From now on the new |
| 41 | window is moved by the compositor during the drag as if the client called |
| 42 | xdg_toplevel.move. |
| 43 | |
| 44 | Dragging an existing window is similar. The client creates a |
| 45 | xdg_toplevel_drag_v1 object and attaches the existing toplevel before |
| 46 | starting the drag. |
| 47 | |
| 48 | Clients use the existing drag and drop mechanism to detect when a window |
| 49 | can be docked or undocked. If the client wants to snap a window into a |
| 50 | parent window it should delete or unmap the dragged top-level. If the |
| 51 | contents should be detached again it attaches a new toplevel as described |
| 52 | above. If a drag operation is cancelled without being dropped, clients |
| 53 | should revert to the previous state, deleting any newly created windows |
| 54 | as appropriate. When a drag operation ends as indicated by |
| 55 | wl_data_source.dnd_drop_performed the dragged toplevel window's final |
| 56 | position is determined as if a xdg_toplevel_move operation ended. |
| 57 | |
| 58 | Warning! The protocol described in this file is currently in the testing |
| 59 | phase. Backward compatible changes may be added together with the |
| 60 | corresponding interface version bump. Backward incompatible changes can |
| 61 | only be done by creating a new major version of the extension. |
| 62 | </description> |
| 63 | |
| 64 | <enum name="error"> |
| 65 | <entry name="invalid_source" value="0" |
| 66 | summary="data_source already used for toplevel drag"/> |
| 67 | </enum> |
| 68 | |
| 69 | <request name="destroy" type="destructor"> |
| 70 | <description summary="destroy the xdg_toplevel_drag_manager_v1 object"> |
| 71 | Destroy this xdg_toplevel_drag_manager_v1 object. Other objects, |
| 72 | including xdg_toplevel_drag_v1 objects created by this factory, are not |
| 73 | affected by this request. |
| 74 | </description> |
| 75 | </request> |
| 76 | |
| 77 | <request name="get_xdg_toplevel_drag"> |
| 78 | <description summary="get an xdg_toplevel_drag for a wl_data_source"> |
| 79 | Create an xdg_toplevel_drag for a drag and drop operation that is going |
| 80 | to be started with data_source. |
| 81 | |
| 82 | This request can only be made on sources used in drag-and-drop, so it |
| 83 | must be performed before wl_data_device.start_drag. Attempting to use |
| 84 | the source other than for drag-and-drop such as in |
| 85 | wl_data_device.set_selection will raise an invalid_source error. |
| 86 | |
| 87 | Destroying data_source while a toplevel is attached to the |
| 88 | xdg_toplevel_drag is undefined. |
| 89 | </description> |
| 90 | |
| 91 | <arg name="id" type="new_id" interface="xdg_toplevel_drag_v1"/> |
| 92 | <arg name="data_source" type="object" interface="wl_data_source"/> |
| 93 | </request> |
| 94 | </interface> |
| 95 | |
| 96 | <interface name="xdg_toplevel_drag_v1" version="1"> |
| 97 | <description summary="Object representing a toplevel move during a drag"> |
| 98 | </description> |
| 99 | |
| 100 | <enum name="error"> |
| 101 | <entry name="toplevel_attached" value="0" |
| 102 | summary="valid toplevel already attached"/> |
| 103 | <entry name="ongoing_drag" value="1" |
| 104 | summary="drag has not ended" /> |
| 105 | </enum> |
| 106 | |
| 107 | <request name="destroy" type="destructor"> |
| 108 | <description summary="destroy an xdg_toplevel_drag_v1 object"> |
| 109 | Destroy this xdg_toplevel_drag_v1 object. This request must only be |
| 110 | called after the underlying wl_data_source drag has ended, as indicated |
| 111 | by the dnd_drop_performed or cancelled events. In any other case an |
| 112 | ongoing_drag error is raised. |
| 113 | </description> |
| 114 | </request> |
| 115 | |
| 116 | <request name="attach"> |
| 117 | <description summary="Move a toplevel with the drag operation"> |
| 118 | Request that the window will be moved with the cursor during the drag |
| 119 | operation. The offset is a hint to the compositor how the toplevel |
| 120 | should be positioned relative to the cursor hotspot in surface local |
| 121 | coordinates and relative to the geometry of the toplevel being attached. |
| 122 | See xdg_surface.set_window_geometry. For example it might only |
| 123 | be used when an unmapped window is attached. The attached window |
| 124 | does not participate in the selection of the drag target. |
| 125 | |
| 126 | If the toplevel is unmapped while it is attached, it is automatically |
| 127 | detached from the drag. In this case this request has to be called again |
| 128 | if the window should be attached after it is remapped. |
| 129 | |
| 130 | This request can be called multiple times but issuing it while a |
| 131 | toplevel with an active role is attached raises a toplevel_attached |
| 132 | error. |
| 133 | </description> |
| 134 | |
| 135 | <arg name="toplevel" type="object" interface="xdg_toplevel"/> |
| 136 | <arg name="x_offset" type="int" summary="dragged surface x offset"/> |
| 137 | <arg name="y_offset" type="int" summary="dragged surface y offset"/> |
| 138 | </request> |
| 139 | |
| 140 | </interface> |
| 141 | </protocol> |
| 142 |