5e294aa37961df53b7879ec19974f1831238fc78
1 /*
2 * Copyright © 2013-2014 Collabora, Ltd.
3 *
4 * Permission to use, copy, modify, distribute, and sell this
5 * software and its documentation for any purpose is hereby granted
6 * without fee, provided that the above copyright notice appear in
7 * all copies and that both that copyright notice and this permission
8 * notice appear in supporting documentation, and that the name of
9 * the copyright holders not be used in advertising or publicity
10 * pertaining to distribution of the software without specific,
11 * written prior permission. The copyright holders make no
12 * representations about the suitability of this software for any
13 * purpose. It is provided "as is" without express or implied
14 * warranty.
15 *
16 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
17 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
19 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
20 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
21 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
22 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
23 * THIS SOFTWARE.
24 */
26 #ifndef SCALER_CLIENT_PROTOCOL_H
27 #define SCALER_CLIENT_PROTOCOL_H
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
33 #include <stdint.h>
34 #include <stddef.h>
35 #include "wayland-client.h"
37 struct wl_client;
38 struct wl_resource;
40 struct wl_scaler;
41 struct wl_viewport;
43 extern const struct wl_interface wl_scaler_interface;
44 extern const struct wl_interface wl_viewport_interface;
46 #ifndef WL_SCALER_ERROR_ENUM
47 #define WL_SCALER_ERROR_ENUM
48 enum wl_scaler_error {
49 WL_SCALER_ERROR_VIEWPORT_EXISTS = 0,
50 };
51 #endif /* WL_SCALER_ERROR_ENUM */
53 #define WL_SCALER_DESTROY 0
54 #define WL_SCALER_GET_VIEWPORT 1
56 static inline void
57 wl_scaler_set_user_data(struct wl_scaler *wl_scaler, void *user_data)
58 {
59 wl_proxy_set_user_data((struct wl_proxy *) wl_scaler, user_data);
60 }
62 static inline void *
63 wl_scaler_get_user_data(struct wl_scaler *wl_scaler)
64 {
65 return wl_proxy_get_user_data((struct wl_proxy *) wl_scaler);
66 }
68 static inline void
69 wl_scaler_destroy(struct wl_scaler *wl_scaler)
70 {
71 wl_proxy_marshal((struct wl_proxy *) wl_scaler,
72 WL_SCALER_DESTROY);
74 wl_proxy_destroy((struct wl_proxy *) wl_scaler);
75 }
77 static inline struct wl_viewport *
78 wl_scaler_get_viewport(struct wl_scaler *wl_scaler, struct wl_surface *surface)
79 {
80 struct wl_proxy *id;
82 id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_scaler,
83 WL_SCALER_GET_VIEWPORT, &wl_viewport_interface, NULL, surface);
85 return (struct wl_viewport *) id;
86 }
88 #ifndef WL_VIEWPORT_ERROR_ENUM
89 #define WL_VIEWPORT_ERROR_ENUM
90 enum wl_viewport_error {
91 WL_VIEWPORT_ERROR_BAD_VALUE = 0,
92 };
93 #endif /* WL_VIEWPORT_ERROR_ENUM */
95 #define WL_VIEWPORT_DESTROY 0
96 #define WL_VIEWPORT_SET 1
97 #define WL_VIEWPORT_SET_SOURCE 2
98 #define WL_VIEWPORT_SET_DESTINATION 3
100 static inline void
101 wl_viewport_set_user_data(struct wl_viewport *wl_viewport, void *user_data)
102 {
103 wl_proxy_set_user_data((struct wl_proxy *) wl_viewport, user_data);
104 }
106 static inline void *
107 wl_viewport_get_user_data(struct wl_viewport *wl_viewport)
108 {
109 return wl_proxy_get_user_data((struct wl_proxy *) wl_viewport);
110 }
112 static inline void
113 wl_viewport_destroy(struct wl_viewport *wl_viewport)
114 {
115 wl_proxy_marshal((struct wl_proxy *) wl_viewport,
116 WL_VIEWPORT_DESTROY);
118 wl_proxy_destroy((struct wl_proxy *) wl_viewport);
119 }
121 static inline void
122 wl_viewport_set(struct wl_viewport *wl_viewport, wl_fixed_t src_x, wl_fixed_t src_y, wl_fixed_t src_width, wl_fixed_t src_height, int32_t dst_width, int32_t dst_height)
123 {
124 wl_proxy_marshal((struct wl_proxy *) wl_viewport,
125 WL_VIEWPORT_SET, src_x, src_y, src_width, src_height, dst_width, dst_height);
126 }
128 static inline void
129 wl_viewport_set_source(struct wl_viewport *wl_viewport, wl_fixed_t x, wl_fixed_t y, wl_fixed_t width, wl_fixed_t height)
130 {
131 wl_proxy_marshal((struct wl_proxy *) wl_viewport,
132 WL_VIEWPORT_SET_SOURCE, x, y, width, height);
133 }
135 static inline void
136 wl_viewport_set_destination(struct wl_viewport *wl_viewport, int32_t width, int32_t height)
137 {
138 wl_proxy_marshal((struct wl_proxy *) wl_viewport,
139 WL_VIEWPORT_SET_DESTINATION, width, height);
140 }
142 #ifdef __cplusplus
143 }
144 #endif
146 #endif