| 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <protocol name="hyprland_toplevel_export_v1"> |
| 3 | <copyright> |
| 4 | Copyright © 2022 Vaxry |
| 5 | All rights reserved. |
| 6 | |
| 7 | Redistribution and use in source and binary forms, with or without |
| 8 | modification, are permitted provided that the following conditions are met: |
| 9 | |
| 10 | 1. Redistributions of source code must retain the above copyright notice, this |
| 11 | list of conditions and the following disclaimer. |
| 12 | |
| 13 | 2. Redistributions in binary form must reproduce the above copyright notice, |
| 14 | this list of conditions and the following disclaimer in the documentation |
| 15 | and/or other materials provided with the distribution. |
| 16 | |
| 17 | 3. Neither the name of the copyright holder nor the names of its |
| 18 | contributors may be used to endorse or promote products derived from |
| 19 | this software without specific prior written permission. |
| 20 | |
| 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 22 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 23 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 24 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
| 25 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 26 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 27 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| 28 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 29 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 30 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 31 | </copyright> |
| 32 | |
| 33 | <description summary="capturing the contents of toplevel windows"> |
| 34 | This protocol allows clients to ask for exporting another toplevel's |
| 35 | surface(s) to a buffer. |
| 36 | |
| 37 | Particularly useful for sharing a single window. |
| 38 | </description> |
| 39 | |
| 40 | <interface name="hyprland_toplevel_export_manager_v1" version="2"> |
| 41 | <description summary="manager to inform clients and begin capturing"> |
| 42 | This object is a manager which offers requests to start capturing from a |
| 43 | source. |
| 44 | </description> |
| 45 | |
| 46 | <request name="capture_toplevel"> |
| 47 | <description summary="capture a toplevel"> |
| 48 | Capture the next frame of a toplevel. (window) |
| 49 | |
| 50 | The captured frame will not contain any server-side decorations and will |
| 51 | ignore the compositor-set geometry, like e.g. rounded corners. |
| 52 | |
| 53 | It will contain all the subsurfaces and popups, however the latter will be clipped |
| 54 | to the geometry of the base surface. |
| 55 | |
| 56 | The handle parameter refers to the address of the window as seen in `hyprctl clients`. |
| 57 | For example, for d161e7b0 it would be 3512854448. |
| 58 | </description> |
| 59 | <arg name="frame" type="new_id" interface="hyprland_toplevel_export_frame_v1"/> |
| 60 | <arg name="overlay_cursor" type="int" |
| 61 | summary="composite cursor onto the frame"/> |
| 62 | <arg name="handle" type="uint" summary="the handle of the toplevel (window) to be captured"/> |
| 63 | </request> |
| 64 | |
| 65 | <request name="destroy" type="destructor"> |
| 66 | <description summary="destroy the manager"> |
| 67 | All objects created by the manager will still remain valid, until their |
| 68 | appropriate destroy request has been called. |
| 69 | </description> |
| 70 | </request> |
| 71 | |
| 72 | <!-- Version 2 --> |
| 73 | <request name="capture_toplevel_with_wlr_toplevel_handle" since="2"> |
| 74 | <description summary="capture a toplevel"> |
| 75 | Same as capture_toplevel, but with a zwlr_foreign_toplevel_handle_v1 handle. |
| 76 | </description> |
| 77 | <arg name="frame" type="new_id" interface="hyprland_toplevel_export_frame_v1"/> |
| 78 | <arg name="overlay_cursor" type="int" |
| 79 | summary="composite cursor onto the frame"/> |
| 80 | <arg name="handle" type="object" interface="zwlr_foreign_toplevel_handle_v1" allow-null="false" summary="the zwlr_foreign_toplevel_handle_v1 handle of the toplevel to be captured"/> |
| 81 | </request> |
| 82 | <!-- End Version 2 --> |
| 83 | </interface> |
| 84 | |
| 85 | <interface name="hyprland_toplevel_export_frame_v1" version="2"> |
| 86 | <description summary="a frame ready for copy"> |
| 87 | This object represents a single frame. |
| 88 | |
| 89 | When created, a series of buffer events will be sent, each representing a |
| 90 | supported buffer type. The "buffer_done" event is sent afterwards to |
| 91 | indicate that all supported buffer types have been enumerated. The client |
| 92 | will then be able to send a "copy" request. If the capture is successful, |
| 93 | the compositor will send a "flags" followed by a "ready" event. |
| 94 | |
| 95 | wl_shm buffers are always supported, ie. the "buffer" event is guaranteed to be sent. |
| 96 | |
| 97 | If the capture failed, the "failed" event is sent. This can happen anytime |
| 98 | before the "ready" event. |
| 99 | |
| 100 | Once either a "ready" or a "failed" event is received, the client should |
| 101 | destroy the frame. |
| 102 | </description> |
| 103 | |
| 104 | <event name="buffer"> |
| 105 | <description summary="wl_shm buffer information"> |
| 106 | Provides information about wl_shm buffer parameters that need to be |
| 107 | used for this frame. This event is sent once after the frame is created |
| 108 | if wl_shm buffers are supported. |
| 109 | </description> |
| 110 | <arg name="format" type="uint" enum="wl_shm.format" summary="buffer format"/> |
| 111 | <arg name="width" type="uint" summary="buffer width"/> |
| 112 | <arg name="height" type="uint" summary="buffer height"/> |
| 113 | <arg name="stride" type="uint" summary="buffer stride"/> |
| 114 | </event> |
| 115 | |
| 116 | <request name="copy"> |
| 117 | <description summary="copy the frame"> |
| 118 | Copy the frame to the supplied buffer. The buffer must have the |
| 119 | correct size, see hyprland_toplevel_export_frame_v1.buffer and |
| 120 | hyprland_toplevel_export_frame_v1.linux_dmabuf. The buffer needs to have a |
| 121 | supported format. |
| 122 | |
| 123 | If the frame is successfully copied, a "flags" and a "ready" event is |
| 124 | sent. Otherwise, a "failed" event is sent. |
| 125 | |
| 126 | This event will wait for appropriate damage to be copied, unless the ignore_damage |
| 127 | arg is set to a non-zero value. |
| 128 | </description> |
| 129 | <arg name="buffer" type="object" interface="wl_buffer"/> |
| 130 | <arg name="ignore_damage" type="int"/> |
| 131 | </request> |
| 132 | |
| 133 | <event name="damage"> |
| 134 | <description summary="carries the coordinates of the damaged region"> |
| 135 | This event is sent right before the ready event when ignore_damage was |
| 136 | not set. It may be generated multiple times for each copy |
| 137 | request. |
| 138 | |
| 139 | The arguments describe a box around an area that has changed since the |
| 140 | last copy request that was derived from the current screencopy manager |
| 141 | instance. |
| 142 | |
| 143 | The union of all regions received between the call to copy |
| 144 | and a ready event is the total damage since the prior ready event. |
| 145 | </description> |
| 146 | <arg name="x" type="uint" summary="damaged x coordinates"/> |
| 147 | <arg name="y" type="uint" summary="damaged y coordinates"/> |
| 148 | <arg name="width" type="uint" summary="current width"/> |
| 149 | <arg name="height" type="uint" summary="current height"/> |
| 150 | </event> |
| 151 | |
| 152 | <enum name="error"> |
| 153 | <entry name="already_used" value="0" |
| 154 | summary="the object has already been used to copy a wl_buffer"/> |
| 155 | <entry name="invalid_buffer" value="1" |
| 156 | summary="buffer attributes are invalid"/> |
| 157 | </enum> |
| 158 | |
| 159 | <enum name="flags" bitfield="true"> |
| 160 | <entry name="y_invert" value="1" summary="contents are y-inverted"/> |
| 161 | </enum> |
| 162 | |
| 163 | <event name="flags"> |
| 164 | <description summary="frame flags"> |
| 165 | Provides flags about the frame. This event is sent once before the |
| 166 | "ready" event. |
| 167 | </description> |
| 168 | <arg name="flags" type="uint" enum="flags" summary="frame flags"/> |
| 169 | </event> |
| 170 | |
| 171 | <event name="ready"> |
| 172 | <description summary="indicates frame is available for reading"> |
| 173 | Called as soon as the frame is copied, indicating it is available |
| 174 | for reading. This event includes the time at which presentation happened |
| 175 | at. |
| 176 | |
| 177 | The timestamp is expressed as tv_sec_hi, tv_sec_lo, tv_nsec triples, |
| 178 | each component being an unsigned 32-bit value. Whole seconds are in |
| 179 | tv_sec which is a 64-bit value combined from tv_sec_hi and tv_sec_lo, |
| 180 | and the additional fractional part in tv_nsec as nanoseconds. Hence, |
| 181 | for valid timestamps tv_nsec must be in [0, 999999999]. The seconds part |
| 182 | may have an arbitrary offset at start. |
| 183 | |
| 184 | After receiving this event, the client should destroy the object. |
| 185 | </description> |
| 186 | <arg name="tv_sec_hi" type="uint" |
| 187 | summary="high 32 bits of the seconds part of the timestamp"/> |
| 188 | <arg name="tv_sec_lo" type="uint" |
| 189 | summary="low 32 bits of the seconds part of the timestamp"/> |
| 190 | <arg name="tv_nsec" type="uint" |
| 191 | summary="nanoseconds part of the timestamp"/> |
| 192 | </event> |
| 193 | |
| 194 | <event name="failed"> |
| 195 | <description summary="frame copy failed"> |
| 196 | This event indicates that the attempted frame copy has failed. |
| 197 | |
| 198 | After receiving this event, the client should destroy the object. |
| 199 | </description> |
| 200 | </event> |
| 201 | |
| 202 | <request name="destroy" type="destructor"> |
| 203 | <description summary="delete this object, used or not"> |
| 204 | Destroys the frame. This request can be sent at any time by the client. |
| 205 | </description> |
| 206 | </request> |
| 207 | |
| 208 | <event name="linux_dmabuf"> |
| 209 | <description summary="linux-dmabuf buffer information"> |
| 210 | Provides information about linux-dmabuf buffer parameters that need to |
| 211 | be used for this frame. This event is sent once after the frame is |
| 212 | created if linux-dmabuf buffers are supported. |
| 213 | </description> |
| 214 | <arg name="format" type="uint" summary="fourcc pixel format"/> |
| 215 | <arg name="width" type="uint" summary="buffer width"/> |
| 216 | <arg name="height" type="uint" summary="buffer height"/> |
| 217 | </event> |
| 218 | |
| 219 | <event name="buffer_done"> |
| 220 | <description summary="all buffer types reported"> |
| 221 | This event is sent once after all buffer events have been sent. |
| 222 | |
| 223 | The client should proceed to create a buffer of one of the supported |
| 224 | types, and send a "copy" request. |
| 225 | </description> |
| 226 | </event> |
| 227 | </interface> |
| 228 | </protocol> |