viewporter-client-protocol.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  1. /* Generated by wayland-scanner 1.26.0 */
  2. #ifndef VIEWPORTER_CLIENT_PROTOCOL_H
  3. #define VIEWPORTER_CLIENT_PROTOCOL_H
  4. #include <stdint.h>
  5. #include <stddef.h>
  6. #include "wayland-client.h"
  7. #ifdef __cplusplus
  8. extern "C" {
  9. #endif
  10. /**
  11. * @page page_viewporter The viewporter protocol
  12. * @section page_ifaces_viewporter Interfaces
  13. * - @subpage page_iface_wp_viewporter - surface cropping and scaling
  14. * - @subpage page_iface_wp_viewport - crop and scale interface to a wl_surface
  15. * @section page_copyright_viewporter Copyright
  16. * <pre>
  17. *
  18. * Copyright © 2013-2016 Collabora, Ltd.
  19. *
  20. * Permission is hereby granted, free of charge, to any person obtaining a
  21. * copy of this software and associated documentation files (the "Software"),
  22. * to deal in the Software without restriction, including without limitation
  23. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  24. * and/or sell copies of the Software, and to permit persons to whom the
  25. * Software is furnished to do so, subject to the following conditions:
  26. *
  27. * The above copyright notice and this permission notice (including the next
  28. * paragraph) shall be included in all copies or substantial portions of the
  29. * Software.
  30. *
  31. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  32. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  33. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  34. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  35. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  36. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  37. * DEALINGS IN THE SOFTWARE.
  38. * </pre>
  39. */
  40. struct wl_surface;
  41. struct wp_viewport;
  42. struct wp_viewporter;
  43. #ifndef WP_VIEWPORTER_INTERFACE
  44. #define WP_VIEWPORTER_INTERFACE
  45. /**
  46. * @page page_iface_wp_viewporter wp_viewporter
  47. * @section page_iface_wp_viewporter_desc Description
  48. *
  49. * The global interface exposing surface cropping and scaling
  50. * capabilities is used to instantiate an interface extension for a
  51. * wl_surface object. This extended interface will then allow
  52. * cropping and scaling the surface contents, effectively
  53. * disconnecting the direct relationship between the buffer and the
  54. * surface size.
  55. * @section page_iface_wp_viewporter_api API
  56. * See @ref iface_wp_viewporter.
  57. */
  58. /**
  59. * @defgroup iface_wp_viewporter The wp_viewporter interface
  60. *
  61. * The global interface exposing surface cropping and scaling
  62. * capabilities is used to instantiate an interface extension for a
  63. * wl_surface object. This extended interface will then allow
  64. * cropping and scaling the surface contents, effectively
  65. * disconnecting the direct relationship between the buffer and the
  66. * surface size.
  67. */
  68. extern const struct wl_interface wp_viewporter_interface;
  69. #endif
  70. #ifndef WP_VIEWPORT_INTERFACE
  71. #define WP_VIEWPORT_INTERFACE
  72. /**
  73. * @page page_iface_wp_viewport wp_viewport
  74. * @section page_iface_wp_viewport_desc Description
  75. *
  76. * An additional interface to a wl_surface object, which allows the
  77. * client to specify the cropping and scaling of the surface
  78. * contents.
  79. *
  80. * This interface works with two concepts: the source rectangle (src_x,
  81. * src_y, src_width, src_height), and the destination size (dst_width,
  82. * dst_height). The contents of the source rectangle are scaled to the
  83. * destination size, and content outside the source rectangle is ignored.
  84. * This state is double-buffered, see wl_surface.commit.
  85. *
  86. * The two parts of crop and scale state are independent: the source
  87. * rectangle, and the destination size. Initially both are unset, that
  88. * is, no scaling is applied. The whole of the current wl_buffer is
  89. * used as the source, and the surface size is as defined in
  90. * wl_surface.attach.
  91. *
  92. * If the destination size is set, it causes the surface size to become
  93. * dst_width, dst_height. The source (rectangle) is scaled to exactly
  94. * this size. This overrides whatever the attached wl_buffer size is,
  95. * unless the wl_buffer is NULL. If the wl_buffer is NULL, the surface
  96. * has no content and therefore no size. Otherwise, the size is always
  97. * at least 1x1 in surface local coordinates.
  98. *
  99. * If the source rectangle is set, it defines what area of the wl_buffer is
  100. * taken as the source. If the source rectangle is set and the destination
  101. * size is not set, then src_width and src_height must be integers, and the
  102. * surface size becomes the source rectangle size. This results in cropping
  103. * without scaling. If src_width or src_height are not integers and
  104. * destination size is not set, the bad_size protocol error is raised when
  105. * the surface state is applied.
  106. *
  107. * The coordinate transformations from buffer pixel coordinates up to
  108. * the surface-local coordinates happen in the following order:
  109. * 1. buffer_transform (wl_surface.set_buffer_transform)
  110. * 2. buffer_scale (wl_surface.set_buffer_scale)
  111. * 3. crop and scale (wp_viewport.set*)
  112. * This means, that the source rectangle coordinates of crop and scale
  113. * are given in the coordinates after the buffer transform and scale,
  114. * i.e. in the coordinates that would be the surface-local coordinates
  115. * if the crop and scale was not applied.
  116. *
  117. * If src_x or src_y are negative, the bad_value protocol error is raised.
  118. * Otherwise, if the source rectangle is partially or completely outside of
  119. * the non-NULL wl_buffer, then the out_of_buffer protocol error is raised
  120. * when the surface state is applied. A NULL wl_buffer does not raise the
  121. * out_of_buffer error.
  122. *
  123. * If the wl_surface associated with the wp_viewport is destroyed,
  124. * all wp_viewport requests except 'destroy' raise the protocol error
  125. * no_surface.
  126. *
  127. * If the wp_viewport object is destroyed, the crop and scale
  128. * state is removed from the wl_surface. The change will be applied
  129. * on the next wl_surface.commit.
  130. * @section page_iface_wp_viewport_api API
  131. * See @ref iface_wp_viewport.
  132. */
  133. /**
  134. * @defgroup iface_wp_viewport The wp_viewport interface
  135. *
  136. * An additional interface to a wl_surface object, which allows the
  137. * client to specify the cropping and scaling of the surface
  138. * contents.
  139. *
  140. * This interface works with two concepts: the source rectangle (src_x,
  141. * src_y, src_width, src_height), and the destination size (dst_width,
  142. * dst_height). The contents of the source rectangle are scaled to the
  143. * destination size, and content outside the source rectangle is ignored.
  144. * This state is double-buffered, see wl_surface.commit.
  145. *
  146. * The two parts of crop and scale state are independent: the source
  147. * rectangle, and the destination size. Initially both are unset, that
  148. * is, no scaling is applied. The whole of the current wl_buffer is
  149. * used as the source, and the surface size is as defined in
  150. * wl_surface.attach.
  151. *
  152. * If the destination size is set, it causes the surface size to become
  153. * dst_width, dst_height. The source (rectangle) is scaled to exactly
  154. * this size. This overrides whatever the attached wl_buffer size is,
  155. * unless the wl_buffer is NULL. If the wl_buffer is NULL, the surface
  156. * has no content and therefore no size. Otherwise, the size is always
  157. * at least 1x1 in surface local coordinates.
  158. *
  159. * If the source rectangle is set, it defines what area of the wl_buffer is
  160. * taken as the source. If the source rectangle is set and the destination
  161. * size is not set, then src_width and src_height must be integers, and the
  162. * surface size becomes the source rectangle size. This results in cropping
  163. * without scaling. If src_width or src_height are not integers and
  164. * destination size is not set, the bad_size protocol error is raised when
  165. * the surface state is applied.
  166. *
  167. * The coordinate transformations from buffer pixel coordinates up to
  168. * the surface-local coordinates happen in the following order:
  169. * 1. buffer_transform (wl_surface.set_buffer_transform)
  170. * 2. buffer_scale (wl_surface.set_buffer_scale)
  171. * 3. crop and scale (wp_viewport.set*)
  172. * This means, that the source rectangle coordinates of crop and scale
  173. * are given in the coordinates after the buffer transform and scale,
  174. * i.e. in the coordinates that would be the surface-local coordinates
  175. * if the crop and scale was not applied.
  176. *
  177. * If src_x or src_y are negative, the bad_value protocol error is raised.
  178. * Otherwise, if the source rectangle is partially or completely outside of
  179. * the non-NULL wl_buffer, then the out_of_buffer protocol error is raised
  180. * when the surface state is applied. A NULL wl_buffer does not raise the
  181. * out_of_buffer error.
  182. *
  183. * If the wl_surface associated with the wp_viewport is destroyed,
  184. * all wp_viewport requests except 'destroy' raise the protocol error
  185. * no_surface.
  186. *
  187. * If the wp_viewport object is destroyed, the crop and scale
  188. * state is removed from the wl_surface. The change will be applied
  189. * on the next wl_surface.commit.
  190. */
  191. extern const struct wl_interface wp_viewport_interface;
  192. #endif
  193. #ifndef WP_VIEWPORTER_ERROR_ENUM
  194. #define WP_VIEWPORTER_ERROR_ENUM
  195. enum wp_viewporter_error {
  196. /**
  197. * the surface already has a viewport object associated
  198. */
  199. WP_VIEWPORTER_ERROR_VIEWPORT_EXISTS = 0,
  200. };
  201. #endif /* WP_VIEWPORTER_ERROR_ENUM */
  202. #define WP_VIEWPORTER_DESTROY 0
  203. #define WP_VIEWPORTER_GET_VIEWPORT 1
  204. /**
  205. * @ingroup iface_wp_viewporter
  206. */
  207. #define WP_VIEWPORTER_DESTROY_SINCE_VERSION 1
  208. /**
  209. * @ingroup iface_wp_viewporter
  210. */
  211. #define WP_VIEWPORTER_GET_VIEWPORT_SINCE_VERSION 1
  212. /** @ingroup iface_wp_viewporter */
  213. static inline void
  214. wp_viewporter_set_user_data(struct wp_viewporter *wp_viewporter, void *user_data)
  215. {
  216. wl_proxy_set_user_data((struct wl_proxy *) wp_viewporter, user_data);
  217. }
  218. /** @ingroup iface_wp_viewporter */
  219. static inline void *
  220. wp_viewporter_get_user_data(struct wp_viewporter *wp_viewporter)
  221. {
  222. return wl_proxy_get_user_data((struct wl_proxy *) wp_viewporter);
  223. }
  224. static inline uint32_t
  225. wp_viewporter_get_version(struct wp_viewporter *wp_viewporter)
  226. {
  227. return wl_proxy_get_version((struct wl_proxy *) wp_viewporter);
  228. }
  229. /**
  230. * @ingroup iface_wp_viewporter
  231. *
  232. * Informs the server that the client will not be using this
  233. * protocol object anymore. This does not affect any other objects,
  234. * wp_viewport objects included.
  235. */
  236. static inline void
  237. wp_viewporter_destroy(struct wp_viewporter *wp_viewporter)
  238. {
  239. wl_proxy_marshal_flags((struct wl_proxy *) wp_viewporter,
  240. WP_VIEWPORTER_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) wp_viewporter), WL_MARSHAL_FLAG_DESTROY);
  241. }
  242. /**
  243. * @ingroup iface_wp_viewporter
  244. *
  245. * Instantiate an interface extension for the given wl_surface to
  246. * crop and scale its content. If the given wl_surface already has
  247. * a wp_viewport object associated, the viewport_exists
  248. * protocol error is raised.
  249. */
  250. static inline struct wp_viewport *
  251. wp_viewporter_get_viewport(struct wp_viewporter *wp_viewporter, struct wl_surface *surface)
  252. {
  253. struct wl_proxy *id;
  254. id = wl_proxy_marshal_flags((struct wl_proxy *) wp_viewporter,
  255. WP_VIEWPORTER_GET_VIEWPORT, &wp_viewport_interface, wl_proxy_get_version((struct wl_proxy *) wp_viewporter), 0, NULL, surface);
  256. return (struct wp_viewport *) id;
  257. }
  258. #ifndef WP_VIEWPORT_ERROR_ENUM
  259. #define WP_VIEWPORT_ERROR_ENUM
  260. enum wp_viewport_error {
  261. /**
  262. * negative or zero values in width or height
  263. */
  264. WP_VIEWPORT_ERROR_BAD_VALUE = 0,
  265. /**
  266. * destination size is not integer
  267. */
  268. WP_VIEWPORT_ERROR_BAD_SIZE = 1,
  269. /**
  270. * source rectangle extends outside of the content area
  271. */
  272. WP_VIEWPORT_ERROR_OUT_OF_BUFFER = 2,
  273. /**
  274. * the wl_surface was destroyed
  275. */
  276. WP_VIEWPORT_ERROR_NO_SURFACE = 3,
  277. };
  278. #endif /* WP_VIEWPORT_ERROR_ENUM */
  279. #define WP_VIEWPORT_DESTROY 0
  280. #define WP_VIEWPORT_SET_SOURCE 1
  281. #define WP_VIEWPORT_SET_DESTINATION 2
  282. /**
  283. * @ingroup iface_wp_viewport
  284. */
  285. #define WP_VIEWPORT_DESTROY_SINCE_VERSION 1
  286. /**
  287. * @ingroup iface_wp_viewport
  288. */
  289. #define WP_VIEWPORT_SET_SOURCE_SINCE_VERSION 1
  290. /**
  291. * @ingroup iface_wp_viewport
  292. */
  293. #define WP_VIEWPORT_SET_DESTINATION_SINCE_VERSION 1
  294. /** @ingroup iface_wp_viewport */
  295. static inline void
  296. wp_viewport_set_user_data(struct wp_viewport *wp_viewport, void *user_data)
  297. {
  298. wl_proxy_set_user_data((struct wl_proxy *) wp_viewport, user_data);
  299. }
  300. /** @ingroup iface_wp_viewport */
  301. static inline void *
  302. wp_viewport_get_user_data(struct wp_viewport *wp_viewport)
  303. {
  304. return wl_proxy_get_user_data((struct wl_proxy *) wp_viewport);
  305. }
  306. static inline uint32_t
  307. wp_viewport_get_version(struct wp_viewport *wp_viewport)
  308. {
  309. return wl_proxy_get_version((struct wl_proxy *) wp_viewport);
  310. }
  311. /**
  312. * @ingroup iface_wp_viewport
  313. *
  314. * The associated wl_surface's crop and scale state is removed.
  315. * The change is applied on the next wl_surface.commit.
  316. */
  317. static inline void
  318. wp_viewport_destroy(struct wp_viewport *wp_viewport)
  319. {
  320. wl_proxy_marshal_flags((struct wl_proxy *) wp_viewport,
  321. WP_VIEWPORT_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) wp_viewport), WL_MARSHAL_FLAG_DESTROY);
  322. }
  323. /**
  324. * @ingroup iface_wp_viewport
  325. *
  326. * Set the source rectangle of the associated wl_surface. See
  327. * wp_viewport for the description, and relation to the wl_buffer
  328. * size.
  329. *
  330. * If all of x, y, width and height are -1.0, the source rectangle is
  331. * unset instead. Any other set of values where width or height are zero
  332. * or negative, or x or y are negative, raise the bad_value protocol
  333. * error.
  334. *
  335. * The crop and scale state is double-buffered, see wl_surface.commit.
  336. */
  337. static inline void
  338. wp_viewport_set_source(struct wp_viewport *wp_viewport, wl_fixed_t x, wl_fixed_t y, wl_fixed_t width, wl_fixed_t height)
  339. {
  340. wl_proxy_marshal_flags((struct wl_proxy *) wp_viewport,
  341. WP_VIEWPORT_SET_SOURCE, NULL, wl_proxy_get_version((struct wl_proxy *) wp_viewport), 0, x, y, width, height);
  342. }
  343. /**
  344. * @ingroup iface_wp_viewport
  345. *
  346. * Set the destination size of the associated wl_surface. See
  347. * wp_viewport for the description, and relation to the wl_buffer
  348. * size.
  349. *
  350. * If width is -1 and height is -1, the destination size is unset
  351. * instead. Any other pair of values for width and height that
  352. * contains zero or negative values raises the bad_value protocol
  353. * error.
  354. *
  355. * The crop and scale state is double-buffered, see wl_surface.commit.
  356. */
  357. static inline void
  358. wp_viewport_set_destination(struct wp_viewport *wp_viewport, int32_t width, int32_t height)
  359. {
  360. wl_proxy_marshal_flags((struct wl_proxy *) wp_viewport,
  361. WP_VIEWPORT_SET_DESTINATION, NULL, wl_proxy_get_version((struct wl_proxy *) wp_viewport), 0, width, height);
  362. }
  363. #ifdef __cplusplus
  364. }
  365. #endif
  366. #endif