1 /* Generated by wayland-scanner 1.19.0 */
3 #ifndef FRACTIONAL_SCALE_V1_CLIENT_PROTOCOL_H
4 #define FRACTIONAL_SCALE_V1_CLIENT_PROTOCOL_H
8 #include "wayland-client.h"
15 * @page page_fractional_scale_v1 The fractional_scale_v1 protocol
16 * Protocol for requesting fractional surface scales
18 * @section page_desc_fractional_scale_v1 Description
20 * This protocol allows a compositor to suggest for surfaces to render at
23 * A client can submit scaled content by utilizing wp_viewport. This is done by
24 * creating a wp_viewport object for the surface and setting the destination
25 * rectangle to the surface size before the scale factor is applied.
27 * The buffer size is calculated by multiplying the surface size by the
30 * The wl_surface buffer scale should remain set to 1.
32 * If a surface has a surface-local size of 100 px by 50 px and wishes to
33 * submit buffers with a scale of 1.5, then a buffer of 150px by 75 px should
34 * be used and the wp_viewport destination rectangle should be 100 px by 50 px.
36 * For toplevel surfaces, the size is rounded halfway away from zero. The
37 * rounding algorithm for subsurface position and size is not defined.
39 * @section page_ifaces_fractional_scale_v1 Interfaces
40 * - @subpage page_iface_wp_fractional_scale_manager_v1 - fractional surface
42 * - @subpage page_iface_wp_fractional_scale_v1 - fractional scale interface to
44 * @section page_copyright_fractional_scale_v1 Copyright
47 * Copyright © 2022 Kenny Levinsen
49 * Permission is hereby granted, free of charge, to any person obtaining a
50 * copy of this software and associated documentation files (the "Software"),
51 * to deal in the Software without restriction, including without limitation
52 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
53 * and/or sell copies of the Software, and to permit persons to whom the
54 * Software is furnished to do so, subject to the following conditions:
56 * The above copyright notice and this permission notice (including the next
57 * paragraph) shall be included in all copies or substantial portions of the
60 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
61 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
62 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
63 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
64 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
65 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
66 * DEALINGS IN THE SOFTWARE.
70 struct wp_fractional_scale_manager_v1
;
71 struct wp_fractional_scale_v1
;
73 #ifndef WP_FRACTIONAL_SCALE_MANAGER_V1_INTERFACE
74 # define WP_FRACTIONAL_SCALE_MANAGER_V1_INTERFACE
76 * @page page_iface_wp_fractional_scale_manager_v1
77 * wp_fractional_scale_manager_v1
78 * @section page_iface_wp_fractional_scale_manager_v1_desc Description
80 * A global interface for requesting surfaces to use fractional scales.
81 * @section page_iface_wp_fractional_scale_manager_v1_api API
82 * See @ref iface_wp_fractional_scale_manager_v1.
85 * @defgroup iface_wp_fractional_scale_manager_v1 The
86 * wp_fractional_scale_manager_v1 interface
88 * A global interface for requesting surfaces to use fractional scales.
90 extern const struct wl_interface wp_fractional_scale_manager_v1_interface
;
92 #ifndef WP_FRACTIONAL_SCALE_V1_INTERFACE
93 # define WP_FRACTIONAL_SCALE_V1_INTERFACE
95 * @page page_iface_wp_fractional_scale_v1 wp_fractional_scale_v1
96 * @section page_iface_wp_fractional_scale_v1_desc Description
98 * An additional interface to a wl_surface object which allows the compositor
99 * to inform the client of the preferred scale.
100 * @section page_iface_wp_fractional_scale_v1_api API
101 * See @ref iface_wp_fractional_scale_v1.
104 * @defgroup iface_wp_fractional_scale_v1 The wp_fractional_scale_v1 interface
106 * An additional interface to a wl_surface object which allows the compositor
107 * to inform the client of the preferred scale.
109 extern const struct wl_interface wp_fractional_scale_v1_interface
;
112 #ifndef WP_FRACTIONAL_SCALE_MANAGER_V1_ERROR_ENUM
113 # define WP_FRACTIONAL_SCALE_MANAGER_V1_ERROR_ENUM
114 enum wp_fractional_scale_manager_v1_error
{
116 * the surface already has a fractional_scale object associated
118 WP_FRACTIONAL_SCALE_MANAGER_V1_ERROR_FRACTIONAL_SCALE_EXISTS
= 0,
120 #endif /* WP_FRACTIONAL_SCALE_MANAGER_V1_ERROR_ENUM */
122 #define WP_FRACTIONAL_SCALE_MANAGER_V1_DESTROY 0
123 #define WP_FRACTIONAL_SCALE_MANAGER_V1_GET_FRACTIONAL_SCALE 1
126 * @ingroup iface_wp_fractional_scale_manager_v1
128 #define WP_FRACTIONAL_SCALE_MANAGER_V1_DESTROY_SINCE_VERSION 1
130 * @ingroup iface_wp_fractional_scale_manager_v1
132 #define WP_FRACTIONAL_SCALE_MANAGER_V1_GET_FRACTIONAL_SCALE_SINCE_VERSION 1
134 /** @ingroup iface_wp_fractional_scale_manager_v1 */
135 static inline void wp_fractional_scale_manager_v1_set_user_data(
136 struct wp_fractional_scale_manager_v1
* wp_fractional_scale_manager_v1
,
138 wl_proxy_set_user_data((struct wl_proxy
*)wp_fractional_scale_manager_v1
,
142 /** @ingroup iface_wp_fractional_scale_manager_v1 */
143 static inline void* wp_fractional_scale_manager_v1_get_user_data(
144 struct wp_fractional_scale_manager_v1
* wp_fractional_scale_manager_v1
) {
145 return wl_proxy_get_user_data(
146 (struct wl_proxy
*)wp_fractional_scale_manager_v1
);
149 static inline uint32_t wp_fractional_scale_manager_v1_get_version(
150 struct wp_fractional_scale_manager_v1
* wp_fractional_scale_manager_v1
) {
151 return wl_proxy_get_version((struct wl_proxy
*)wp_fractional_scale_manager_v1
);
155 * @ingroup iface_wp_fractional_scale_manager_v1
157 * Informs the server that the client will not be using this protocol
158 * object anymore. This does not affect any other objects,
159 * wp_fractional_scale_v1 objects included.
161 static inline void wp_fractional_scale_manager_v1_destroy(
162 struct wp_fractional_scale_manager_v1
* wp_fractional_scale_manager_v1
) {
163 wl_proxy_marshal((struct wl_proxy
*)wp_fractional_scale_manager_v1
,
164 WP_FRACTIONAL_SCALE_MANAGER_V1_DESTROY
);
166 wl_proxy_destroy((struct wl_proxy
*)wp_fractional_scale_manager_v1
);
170 * @ingroup iface_wp_fractional_scale_manager_v1
172 * Create an add-on object for the the wl_surface to let the compositor
173 * request fractional scales. If the given wl_surface already has a
174 * wp_fractional_scale_v1 object associated, the fractional_scale_exists
175 * protocol error is raised.
177 static inline struct wp_fractional_scale_v1
*
178 wp_fractional_scale_manager_v1_get_fractional_scale(
179 struct wp_fractional_scale_manager_v1
* wp_fractional_scale_manager_v1
,
180 struct wl_surface
* surface
) {
183 id
= wl_proxy_marshal_constructor(
184 (struct wl_proxy
*)wp_fractional_scale_manager_v1
,
185 WP_FRACTIONAL_SCALE_MANAGER_V1_GET_FRACTIONAL_SCALE
,
186 &wp_fractional_scale_v1_interface
, NULL
, surface
);
188 return (struct wp_fractional_scale_v1
*)id
;
192 * @ingroup iface_wp_fractional_scale_v1
193 * @struct wp_fractional_scale_v1_listener
195 struct wp_fractional_scale_v1_listener
{
197 * notify of new preferred scale
199 * Notification of a new preferred scale for this surface that
200 * the compositor suggests that the client should use.
202 * The sent scale is the numerator of a fraction with a denominator
204 * @param scale the new preferred scale
206 void (*preferred_scale
)(void* data
,
207 struct wp_fractional_scale_v1
* wp_fractional_scale_v1
,
212 * @ingroup iface_wp_fractional_scale_v1
214 static inline int wp_fractional_scale_v1_add_listener(
215 struct wp_fractional_scale_v1
* wp_fractional_scale_v1
,
216 const struct wp_fractional_scale_v1_listener
* listener
, void* data
) {
217 return wl_proxy_add_listener((struct wl_proxy
*)wp_fractional_scale_v1
,
218 (void (**)(void))listener
, data
);
221 #define WP_FRACTIONAL_SCALE_V1_DESTROY 0
224 * @ingroup iface_wp_fractional_scale_v1
226 #define WP_FRACTIONAL_SCALE_V1_PREFERRED_SCALE_SINCE_VERSION 1
229 * @ingroup iface_wp_fractional_scale_v1
231 #define WP_FRACTIONAL_SCALE_V1_DESTROY_SINCE_VERSION 1
233 /** @ingroup iface_wp_fractional_scale_v1 */
234 static inline void wp_fractional_scale_v1_set_user_data(
235 struct wp_fractional_scale_v1
* wp_fractional_scale_v1
, void* user_data
) {
236 wl_proxy_set_user_data((struct wl_proxy
*)wp_fractional_scale_v1
, user_data
);
239 /** @ingroup iface_wp_fractional_scale_v1 */
240 static inline void* wp_fractional_scale_v1_get_user_data(
241 struct wp_fractional_scale_v1
* wp_fractional_scale_v1
) {
242 return wl_proxy_get_user_data((struct wl_proxy
*)wp_fractional_scale_v1
);
245 static inline uint32_t wp_fractional_scale_v1_get_version(
246 struct wp_fractional_scale_v1
* wp_fractional_scale_v1
) {
247 return wl_proxy_get_version((struct wl_proxy
*)wp_fractional_scale_v1
);
251 * @ingroup iface_wp_fractional_scale_v1
253 * Destroy the fractional scale object. When this object is destroyed,
254 * preferred_scale events will no longer be sent.
256 static inline void wp_fractional_scale_v1_destroy(
257 struct wp_fractional_scale_v1
* wp_fractional_scale_v1
) {
258 wl_proxy_marshal((struct wl_proxy
*)wp_fractional_scale_v1
,
259 WP_FRACTIONAL_SCALE_V1_DESTROY
);
261 wl_proxy_destroy((struct wl_proxy
*)wp_fractional_scale_v1
);