| OLD | NEW |
| (Empty) | |
| 1 /* Generated by wayland-scanner 1.11.0 */ |
| 2 |
| 3 #ifndef STYLUS_UNSTABLE_V2_CLIENT_PROTOCOL_H |
| 4 #define STYLUS_UNSTABLE_V2_CLIENT_PROTOCOL_H |
| 5 |
| 6 #include <stdint.h> |
| 7 #include <stddef.h> |
| 8 #include "wayland-client.h" |
| 9 |
| 10 #ifdef __cplusplus |
| 11 extern "C" { |
| 12 #endif |
| 13 |
| 14 /** |
| 15 * @page page_stylus_unstable_v2 The stylus_unstable_v2 protocol |
| 16 * @section page_ifaces_stylus_unstable_v2 Interfaces |
| 17 * - @subpage page_iface_zcr_stylus_v2 - extends wl_touch with events for on-scr
een stylus |
| 18 * - @subpage page_iface_zcr_touch_stylus_v2 - stylus extension for touch |
| 19 * @section page_copyright_stylus_unstable_v2 Copyright |
| 20 * <pre> |
| 21 * |
| 22 * Copyright 2016 The Chromium Authors. |
| 23 * |
| 24 * Permission is hereby granted, free of charge, to any person obtaining a |
| 25 * copy of this software and associated documentation files (the "Software"), |
| 26 * to deal in the Software without restriction, including without limitation |
| 27 * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 28 * and/or sell copies of the Software, and to permit persons to whom the |
| 29 * Software is furnished to do so, subject to the following conditions: |
| 30 * |
| 31 * The above copyright notice and this permission notice (including the next |
| 32 * paragraph) shall be included in all copies or substantial portions of the |
| 33 * Software. |
| 34 * |
| 35 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 36 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 37 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 38 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 39 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 40 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 41 * DEALINGS IN THE SOFTWARE. |
| 42 * </pre> |
| 43 */ |
| 44 struct wl_touch; |
| 45 struct zcr_stylus_v2; |
| 46 struct zcr_touch_stylus_v2; |
| 47 |
| 48 /** |
| 49 * @page page_iface_zcr_stylus_v2 zcr_stylus_v2 |
| 50 * @section page_iface_zcr_stylus_v2_desc Description |
| 51 * |
| 52 * Allows a wl_touch to report stylus specific information. The client can |
| 53 * interpret the on-screen stylus like any other touch event, and use |
| 54 * this protocol to obtain detail information about the type of stylus, |
| 55 * as well as the force and tilt of the tool. |
| 56 * |
| 57 * These events are to be fired by the server within the same frame as other |
| 58 * wl_touch events. |
| 59 * |
| 60 * Warning! The protocol described in this file is experimental and |
| 61 * backward incompatible changes may be made. Backward compatible changes |
| 62 * may be added together with the corresponding uinterface version bump. |
| 63 * Backward incompatible changes are done by bumping the version number in |
| 64 * the protocol and uinterface names and resetting the interface version. |
| 65 * Once the protocol is to be declared stable, the 'z' prefix and the |
| 66 * version number in the protocol and interface names are removed and the |
| 67 * interface version number is reset. |
| 68 * @section page_iface_zcr_stylus_v2_api API |
| 69 * See @ref iface_zcr_stylus_v2. |
| 70 */ |
| 71 /** |
| 72 * @defgroup iface_zcr_stylus_v2 The zcr_stylus_v2 interface |
| 73 * |
| 74 * Allows a wl_touch to report stylus specific information. The client can |
| 75 * interpret the on-screen stylus like any other touch event, and use |
| 76 * this protocol to obtain detail information about the type of stylus, |
| 77 * as well as the force and tilt of the tool. |
| 78 * |
| 79 * These events are to be fired by the server within the same frame as other |
| 80 * wl_touch events. |
| 81 * |
| 82 * Warning! The protocol described in this file is experimental and |
| 83 * backward incompatible changes may be made. Backward compatible changes |
| 84 * may be added together with the corresponding uinterface version bump. |
| 85 * Backward incompatible changes are done by bumping the version number in |
| 86 * the protocol and uinterface names and resetting the interface version. |
| 87 * Once the protocol is to be declared stable, the 'z' prefix and the |
| 88 * version number in the protocol and interface names are removed and the |
| 89 * interface version number is reset. |
| 90 */ |
| 91 extern const struct wl_interface zcr_stylus_v2_interface; |
| 92 /** |
| 93 * @page page_iface_zcr_touch_stylus_v2 zcr_touch_stylus_v2 |
| 94 * @section page_iface_zcr_touch_stylus_v2_desc Description |
| 95 * |
| 96 * The zcr_touch_stylus_v1 interface extends the wl_touch interface with |
| 97 * events to describe details about a stylus. |
| 98 * @section page_iface_zcr_touch_stylus_v2_api API |
| 99 * See @ref iface_zcr_touch_stylus_v2. |
| 100 */ |
| 101 /** |
| 102 * @defgroup iface_zcr_touch_stylus_v2 The zcr_touch_stylus_v2 interface |
| 103 * |
| 104 * The zcr_touch_stylus_v1 interface extends the wl_touch interface with |
| 105 * events to describe details about a stylus. |
| 106 */ |
| 107 extern const struct wl_interface zcr_touch_stylus_v2_interface; |
| 108 |
| 109 #ifndef ZCR_STYLUS_V2_ERROR_ENUM |
| 110 #define ZCR_STYLUS_V2_ERROR_ENUM |
| 111 enum zcr_stylus_v2_error { |
| 112 /** |
| 113 * the touch already has a touch_stylus object associated |
| 114 */ |
| 115 ZCR_STYLUS_V2_ERROR_TOUCH_STYLUS_EXISTS = 0, |
| 116 }; |
| 117 #endif /* ZCR_STYLUS_V2_ERROR_ENUM */ |
| 118 |
| 119 #define ZCR_STYLUS_V2_GET_TOUCH_STYLUS 0 |
| 120 |
| 121 /** |
| 122 * @ingroup iface_zcr_stylus_v2 |
| 123 */ |
| 124 #define ZCR_STYLUS_V2_GET_TOUCH_STYLUS_SINCE_VERSION 1 |
| 125 |
| 126 /** @ingroup iface_zcr_stylus_v2 */ |
| 127 static inline void |
| 128 zcr_stylus_v2_set_user_data(struct zcr_stylus_v2 *zcr_stylus_v2, void *user_data
) |
| 129 { |
| 130 wl_proxy_set_user_data((struct wl_proxy *) zcr_stylus_v2, user_data); |
| 131 } |
| 132 |
| 133 /** @ingroup iface_zcr_stylus_v2 */ |
| 134 static inline void * |
| 135 zcr_stylus_v2_get_user_data(struct zcr_stylus_v2 *zcr_stylus_v2) |
| 136 { |
| 137 return wl_proxy_get_user_data((struct wl_proxy *) zcr_stylus_v2); |
| 138 } |
| 139 |
| 140 static inline uint32_t |
| 141 zcr_stylus_v2_get_version(struct zcr_stylus_v2 *zcr_stylus_v2) |
| 142 { |
| 143 return wl_proxy_get_version((struct wl_proxy *) zcr_stylus_v2); |
| 144 } |
| 145 |
| 146 /** @ingroup iface_zcr_stylus_v2 */ |
| 147 static inline void |
| 148 zcr_stylus_v2_destroy(struct zcr_stylus_v2 *zcr_stylus_v2) |
| 149 { |
| 150 wl_proxy_destroy((struct wl_proxy *) zcr_stylus_v2); |
| 151 } |
| 152 |
| 153 /** |
| 154 * @ingroup iface_zcr_stylus_v2 |
| 155 * |
| 156 * Create touch_stylus object. See zcr_touch_stylus_v1 interface for |
| 157 * details. If the given wl_touch already has a touch_stylus object |
| 158 * associated, the touch_stylus_exists protocol error is raised. |
| 159 */ |
| 160 static inline struct zcr_touch_stylus_v2 * |
| 161 zcr_stylus_v2_get_touch_stylus(struct zcr_stylus_v2 *zcr_stylus_v2, struct wl_to
uch *touch) |
| 162 { |
| 163 struct wl_proxy *id; |
| 164 |
| 165 id = wl_proxy_marshal_constructor((struct wl_proxy *) zcr_stylus_v2, |
| 166 ZCR_STYLUS_V2_GET_TOUCH_STYLUS, &zcr_touch_stylus_v2_in
terface, NULL, touch); |
| 167 |
| 168 return (struct zcr_touch_stylus_v2 *) id; |
| 169 } |
| 170 |
| 171 #ifndef ZCR_TOUCH_STYLUS_V2_TOOL_TYPE_ENUM |
| 172 #define ZCR_TOUCH_STYLUS_V2_TOOL_TYPE_ENUM |
| 173 /** |
| 174 * @ingroup iface_zcr_touch_stylus_v2 |
| 175 * tool type of device. |
| 176 */ |
| 177 enum zcr_touch_stylus_v2_tool_type { |
| 178 /** |
| 179 * Touch |
| 180 */ |
| 181 ZCR_TOUCH_STYLUS_V2_TOOL_TYPE_TOUCH = 1, |
| 182 /** |
| 183 * Pen |
| 184 */ |
| 185 ZCR_TOUCH_STYLUS_V2_TOOL_TYPE_PEN = 2, |
| 186 /** |
| 187 * Eraser |
| 188 */ |
| 189 ZCR_TOUCH_STYLUS_V2_TOOL_TYPE_ERASER = 3, |
| 190 }; |
| 191 #endif /* ZCR_TOUCH_STYLUS_V2_TOOL_TYPE_ENUM */ |
| 192 |
| 193 /** |
| 194 * @ingroup iface_zcr_touch_stylus_v2 |
| 195 * @struct zcr_touch_stylus_v2_listener |
| 196 */ |
| 197 struct zcr_touch_stylus_v2_listener { |
| 198 /** |
| 199 * sets tool type of touch |
| 200 * |
| 201 * Notification that the user is using a tool type other than |
| 202 * touch. There can only be one tool in use at a time. This event |
| 203 * is sent in the same frame as the wl_touch.down event. The tool |
| 204 * type cannot change while a touch is being reported. |
| 205 * @param id touch id |
| 206 * @param type type of tool in use |
| 207 */ |
| 208 void (*tool)(void *data, |
| 209 struct zcr_touch_stylus_v2 *zcr_touch_stylus_v2, |
| 210 uint32_t id, |
| 211 uint32_t type); |
| 212 /** |
| 213 * force change event |
| 214 * |
| 215 * Notification of a change in physical force on the surface of |
| 216 * the screen. The force is calibrated and normalized to the 0 to 1 |
| 217 * range. |
| 218 * @param time timestamp with millisecond granularity |
| 219 * @param id touch id |
| 220 * @param force new value of force |
| 221 */ |
| 222 void (*force)(void *data, |
| 223 struct zcr_touch_stylus_v2 *zcr_touch_stylus_v2, |
| 224 uint32_t time, |
| 225 uint32_t id, |
| 226 wl_fixed_t force); |
| 227 /** |
| 228 * tilt change event |
| 229 * |
| 230 * Notification of a change in tilt of a stylus. |
| 231 * |
| 232 * Measured from surface normal as plane angle in degrees, values |
| 233 * lie in [-90,90]. A positive x is to the right and a positive y |
| 234 * is towards the user. |
| 235 * @param time timestamp with millisecond granularity |
| 236 * @param id touch id |
| 237 * @param tilt_x tilt in x direction |
| 238 * @param tilt_y tilt in y direction |
| 239 */ |
| 240 void (*tilt)(void *data, |
| 241 struct zcr_touch_stylus_v2 *zcr_touch_stylus_v2, |
| 242 uint32_t time, |
| 243 uint32_t id, |
| 244 wl_fixed_t tilt_x, |
| 245 wl_fixed_t tilt_y); |
| 246 }; |
| 247 |
| 248 /** |
| 249 * @ingroup zcr_touch_stylus_v2_iface |
| 250 */ |
| 251 static inline int |
| 252 zcr_touch_stylus_v2_add_listener(struct zcr_touch_stylus_v2 *zcr_touch_stylus_v2
, |
| 253 const struct zcr_touch_stylus_v2_listener *list
ener, void *data) |
| 254 { |
| 255 return wl_proxy_add_listener((struct wl_proxy *) zcr_touch_stylus_v2, |
| 256 (void (**)(void)) listener, data); |
| 257 } |
| 258 |
| 259 #define ZCR_TOUCH_STYLUS_V2_DESTROY 0 |
| 260 |
| 261 /** |
| 262 * @ingroup iface_zcr_touch_stylus_v2 |
| 263 */ |
| 264 #define ZCR_TOUCH_STYLUS_V2_DESTROY_SINCE_VERSION 1 |
| 265 |
| 266 /** @ingroup iface_zcr_touch_stylus_v2 */ |
| 267 static inline void |
| 268 zcr_touch_stylus_v2_set_user_data(struct zcr_touch_stylus_v2 *zcr_touch_stylus_v
2, void *user_data) |
| 269 { |
| 270 wl_proxy_set_user_data((struct wl_proxy *) zcr_touch_stylus_v2, user_dat
a); |
| 271 } |
| 272 |
| 273 /** @ingroup iface_zcr_touch_stylus_v2 */ |
| 274 static inline void * |
| 275 zcr_touch_stylus_v2_get_user_data(struct zcr_touch_stylus_v2 *zcr_touch_stylus_v
2) |
| 276 { |
| 277 return wl_proxy_get_user_data((struct wl_proxy *) zcr_touch_stylus_v2); |
| 278 } |
| 279 |
| 280 static inline uint32_t |
| 281 zcr_touch_stylus_v2_get_version(struct zcr_touch_stylus_v2 *zcr_touch_stylus_v2) |
| 282 { |
| 283 return wl_proxy_get_version((struct wl_proxy *) zcr_touch_stylus_v2); |
| 284 } |
| 285 |
| 286 /** |
| 287 * @ingroup iface_zcr_touch_stylus_v2 |
| 288 */ |
| 289 static inline void |
| 290 zcr_touch_stylus_v2_destroy(struct zcr_touch_stylus_v2 *zcr_touch_stylus_v2) |
| 291 { |
| 292 wl_proxy_marshal((struct wl_proxy *) zcr_touch_stylus_v2, |
| 293 ZCR_TOUCH_STYLUS_V2_DESTROY); |
| 294 |
| 295 wl_proxy_destroy((struct wl_proxy *) zcr_touch_stylus_v2); |
| 296 } |
| 297 |
| 298 #ifdef __cplusplus |
| 299 } |
| 300 #endif |
| 301 |
| 302 #endif |
| OLD | NEW |