🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

186 lines
8.3 KiB

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <protocol name="viewporter">
  3. <copyright>
  4. Copyright © 2013-2016 Collabora, Ltd.
  5. Permission is hereby granted, free of charge, to any person obtaining a
  6. copy of this software and associated documentation files (the "Software"),
  7. to deal in the Software without restriction, including without limitation
  8. the rights to use, copy, modify, merge, publish, distribute, sublicense,
  9. and/or sell copies of the Software, and to permit persons to whom the
  10. Software is furnished to do so, subject to the following conditions:
  11. The above copyright notice and this permission notice (including the next
  12. paragraph) shall be included in all copies or substantial portions of the
  13. Software.
  14. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  17. THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  20. DEALINGS IN THE SOFTWARE.
  21. </copyright>
  22. <interface name="wp_viewporter" version="1">
  23. <description summary="surface cropping and scaling">
  24. The global interface exposing surface cropping and scaling
  25. capabilities is used to instantiate an interface extension for a
  26. wl_surface object. This extended interface will then allow
  27. cropping and scaling the surface contents, effectively
  28. disconnecting the direct relationship between the buffer and the
  29. surface size.
  30. </description>
  31. <request name="destroy" type="destructor">
  32. <description summary="unbind from the cropping and scaling interface">
  33. Informs the server that the client will not be using this
  34. protocol object anymore. This does not affect any other objects,
  35. wp_viewport objects included.
  36. </description>
  37. </request>
  38. <enum name="error">
  39. <entry name="viewport_exists" value="0"
  40. summary="the surface already has a viewport object associated"/>
  41. </enum>
  42. <request name="get_viewport">
  43. <description summary="extend surface interface for crop and scale">
  44. Instantiate an interface extension for the given wl_surface to
  45. crop and scale its content. If the given wl_surface already has
  46. a wp_viewport object associated, the viewport_exists
  47. protocol error is raised.
  48. </description>
  49. <arg name="id" type="new_id" interface="wp_viewport"
  50. summary="the new viewport interface id"/>
  51. <arg name="surface" type="object" interface="wl_surface"
  52. summary="the surface"/>
  53. </request>
  54. </interface>
  55. <interface name="wp_viewport" version="1">
  56. <description summary="crop and scale interface to a wl_surface">
  57. An additional interface to a wl_surface object, which allows the
  58. client to specify the cropping and scaling of the surface
  59. contents.
  60. This interface works with two concepts: the source rectangle (src_x,
  61. src_y, src_width, src_height), and the destination size (dst_width,
  62. dst_height). The contents of the source rectangle are scaled to the
  63. destination size, and content outside the source rectangle is ignored.
  64. This state is double-buffered, and is applied on the next
  65. wl_surface.commit.
  66. The two parts of crop and scale state are independent: the source
  67. rectangle, and the destination size. Initially both are unset, that
  68. is, no scaling is applied. The whole of the current wl_buffer is
  69. used as the source, and the surface size is as defined in
  70. wl_surface.attach.
  71. If the destination size is set, it causes the surface size to become
  72. dst_width, dst_height. The source (rectangle) is scaled to exactly
  73. this size. This overrides whatever the attached wl_buffer size is,
  74. unless the wl_buffer is NULL. If the wl_buffer is NULL, the surface
  75. has no content and therefore no size. Otherwise, the size is always
  76. at least 1x1 in surface local coordinates.
  77. If the source rectangle is set, it defines what area of the wl_buffer is
  78. taken as the source. If the source rectangle is set and the destination
  79. size is not set, then src_width and src_height must be integers, and the
  80. surface size becomes the source rectangle size. This results in cropping
  81. without scaling. If src_width or src_height are not integers and
  82. destination size is not set, the bad_size protocol error is raised when
  83. the surface state is applied.
  84. The coordinate transformations from buffer pixel coordinates up to
  85. the surface-local coordinates happen in the following order:
  86. 1. buffer_transform (wl_surface.set_buffer_transform)
  87. 2. buffer_scale (wl_surface.set_buffer_scale)
  88. 3. crop and scale (wp_viewport.set*)
  89. This means, that the source rectangle coordinates of crop and scale
  90. are given in the coordinates after the buffer transform and scale,
  91. i.e. in the coordinates that would be the surface-local coordinates
  92. if the crop and scale was not applied.
  93. If src_x or src_y are negative, the bad_value protocol error is raised.
  94. Otherwise, if the source rectangle is partially or completely outside of
  95. the non-NULL wl_buffer, then the out_of_buffer protocol error is raised
  96. when the surface state is applied. A NULL wl_buffer does not raise the
  97. out_of_buffer error.
  98. The x, y arguments of wl_surface.attach are applied as normal to
  99. the surface. They indicate how many pixels to remove from the
  100. surface size from the left and the top. In other words, they are
  101. still in the surface-local coordinate system, just like dst_width
  102. and dst_height are.
  103. If the wl_surface associated with the wp_viewport is destroyed,
  104. all wp_viewport requests except 'destroy' raise the protocol error
  105. no_surface.
  106. If the wp_viewport object is destroyed, the crop and scale
  107. state is removed from the wl_surface. The change will be applied
  108. on the next wl_surface.commit.
  109. </description>
  110. <request name="destroy" type="destructor">
  111. <description summary="remove scaling and cropping from the surface">
  112. The associated wl_surface's crop and scale state is removed.
  113. The change is applied on the next wl_surface.commit.
  114. </description>
  115. </request>
  116. <enum name="error">
  117. <entry name="bad_value" value="0"
  118. summary="negative or zero values in width or height"/>
  119. <entry name="bad_size" value="1"
  120. summary="destination size is not integer"/>
  121. <entry name="out_of_buffer" value="2"
  122. summary="source rectangle extends outside of the content area"/>
  123. <entry name="no_surface" value="3"
  124. summary="the wl_surface was destroyed"/>
  125. </enum>
  126. <request name="set_source">
  127. <description summary="set the source rectangle for cropping">
  128. Set the source rectangle of the associated wl_surface. See
  129. wp_viewport for the description, and relation to the wl_buffer
  130. size.
  131. If all of x, y, width and height are -1.0, the source rectangle is
  132. unset instead. Any other set of values where width or height are zero
  133. or negative, or x or y are negative, raise the bad_value protocol
  134. error.
  135. The crop and scale state is double-buffered state, and will be
  136. applied on the next wl_surface.commit.
  137. </description>
  138. <arg name="x" type="fixed" summary="source rectangle x"/>
  139. <arg name="y" type="fixed" summary="source rectangle y"/>
  140. <arg name="width" type="fixed" summary="source rectangle width"/>
  141. <arg name="height" type="fixed" summary="source rectangle height"/>
  142. </request>
  143. <request name="set_destination">
  144. <description summary="set the surface size for scaling">
  145. Set the destination size of the associated wl_surface. See
  146. wp_viewport for the description, and relation to the wl_buffer
  147. size.
  148. If width is -1 and height is -1, the destination size is unset
  149. instead. Any other pair of values for width and height that
  150. contains zero or negative values raises the bad_value protocol
  151. error.
  152. The crop and scale state is double-buffered state, and will be
  153. applied on the next wl_surface.commit.
  154. </description>
  155. <arg name="width" type="int" summary="surface width"/>
  156. <arg name="height" type="int" summary="surface height"/>
  157. </request>
  158. </interface>
  159. </protocol>