| OLD | NEW |
| (Empty) | |
| 1 /* |
| 2 * Copyright 2016 The Chromium Authors. |
| 3 * |
| 4 * Permission is hereby granted, free of charge, to any person obtaining a |
| 5 * copy of this software and associated documentation files (the "Software"), |
| 6 * to deal in the Software without restriction, including without limitation |
| 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 8 * and/or sell copies of the Software, and to permit persons to whom the |
| 9 * Software is furnished to do so, subject to the following conditions: |
| 10 * |
| 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 * |
| 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 21 * DEALINGS IN THE SOFTWARE. |
| 22 */ |
| 23 |
| 24 #ifndef STYLUS_UNSTABLE_V1_CLIENT_PROTOCOL_H |
| 25 #define STYLUS_UNSTABLE_V1_CLIENT_PROTOCOL_H |
| 26 |
| 27 #ifdef __cplusplus |
| 28 extern "C" { |
| 29 #endif |
| 30 |
| 31 #include <stdint.h> |
| 32 #include <stddef.h> |
| 33 #include "wayland-client.h" |
| 34 |
| 35 struct wl_client; |
| 36 struct wl_resource; |
| 37 |
| 38 struct zwp_stylus_v1; |
| 39 struct zwp_pointer_stylus_v1; |
| 40 |
| 41 extern const struct wl_interface zwp_stylus_v1_interface; |
| 42 extern const struct wl_interface zwp_pointer_stylus_v1_interface; |
| 43 |
| 44 #define ZWP_STYLUS_V1_GET_POINTER_STYLUS 0 |
| 45 |
| 46 static inline void |
| 47 zwp_stylus_v1_set_user_data(struct zwp_stylus_v1 *zwp_stylus_v1, void *user_data
) |
| 48 { |
| 49 wl_proxy_set_user_data((struct wl_proxy *) zwp_stylus_v1, user_data); |
| 50 } |
| 51 |
| 52 static inline void * |
| 53 zwp_stylus_v1_get_user_data(struct zwp_stylus_v1 *zwp_stylus_v1) |
| 54 { |
| 55 return wl_proxy_get_user_data((struct wl_proxy *) zwp_stylus_v1); |
| 56 } |
| 57 |
| 58 static inline void |
| 59 zwp_stylus_v1_destroy(struct zwp_stylus_v1 *zwp_stylus_v1) |
| 60 { |
| 61 wl_proxy_destroy((struct wl_proxy *) zwp_stylus_v1); |
| 62 } |
| 63 |
| 64 static inline struct zwp_pointer_stylus_v1 * |
| 65 zwp_stylus_v1_get_pointer_stylus(struct zwp_stylus_v1 *zwp_stylus_v1, struct wl_
pointer *pointer) |
| 66 { |
| 67 struct wl_proxy *id; |
| 68 |
| 69 id = wl_proxy_marshal_constructor((struct wl_proxy *) zwp_stylus_v1, |
| 70 ZWP_STYLUS_V1_GET_POINTER_STYLUS, &zwp_pointer_stylus_v
1_interface, NULL, pointer); |
| 71 |
| 72 return (struct zwp_pointer_stylus_v1 *) id; |
| 73 } |
| 74 |
| 75 #ifndef ZWP_POINTER_STYLUS_V1_TOOL_TYPE_ENUM |
| 76 #define ZWP_POINTER_STYLUS_V1_TOOL_TYPE_ENUM |
| 77 /** |
| 78 * zwp_pointer_stylus_v1_tool_type - tool type of device. |
| 79 * @ZWP_POINTER_STYLUS_V1_TOOL_TYPE_MOUSE: Mouse or touchpad, not a |
| 80 * stylus. |
| 81 * @ZWP_POINTER_STYLUS_V1_TOOL_TYPE_PEN: Pen |
| 82 * @ZWP_POINTER_STYLUS_V1_TOOL_TYPE_TOUCH: Touch |
| 83 * @ZWP_POINTER_STYLUS_V1_TOOL_TYPE_ERASER: Eraser |
| 84 * |
| 85 * |
| 86 */ |
| 87 enum zwp_pointer_stylus_v1_tool_type { |
| 88 ZWP_POINTER_STYLUS_V1_TOOL_TYPE_MOUSE = 0, |
| 89 ZWP_POINTER_STYLUS_V1_TOOL_TYPE_PEN = 1, |
| 90 ZWP_POINTER_STYLUS_V1_TOOL_TYPE_TOUCH = 2, |
| 91 ZWP_POINTER_STYLUS_V1_TOOL_TYPE_ERASER = 3, |
| 92 }; |
| 93 #endif /* ZWP_POINTER_STYLUS_V1_TOOL_TYPE_ENUM */ |
| 94 |
| 95 /** |
| 96 * zwp_pointer_stylus_v1 - stylus extension for pointer |
| 97 * @tool_change: pointing device tool type changed |
| 98 * @force: force change event |
| 99 * @tilt: force change event |
| 100 * |
| 101 * The zwp_pointer_stylus_v1 interface extends the wl_pointer interface |
| 102 * with events to describe details about a stylus acting as a pointer. |
| 103 */ |
| 104 struct zwp_pointer_stylus_v1_listener { |
| 105 /** |
| 106 * tool_change - pointing device tool type changed |
| 107 * @type: new device type |
| 108 * |
| 109 * Notification that the user is using a new tool type. There can |
| 110 * only be one tool in use at a time. If the pointer enters a |
| 111 * client surface, with a tool type other than mouse, this event |
| 112 * will also be generated. |
| 113 * |
| 114 * If this event is not received, the client has to assume a mouse |
| 115 * is in use. The remaining events of this protocol are only being |
| 116 * generated after this event has been fired with a tool type other |
| 117 * than mouse. |
| 118 */ |
| 119 void (*tool_change)(void *data, |
| 120 struct zwp_pointer_stylus_v1 *zwp_pointer_stylus_v1, |
| 121 uint32_t type); |
| 122 /** |
| 123 * force - force change event |
| 124 * @time: timestamp with millisecond granularity |
| 125 * @force: new value of force |
| 126 * |
| 127 * Notification of a change in physical force on the surface of |
| 128 * the screen. |
| 129 * |
| 130 * If the pointer enters a client surface, with a tool type other |
| 131 * than mouse, this event will also be generated. |
| 132 * |
| 133 * The force is calibrated and normalized to the 0 to 1 range. |
| 134 */ |
| 135 void (*force)(void *data, |
| 136 struct zwp_pointer_stylus_v1 *zwp_pointer_stylus_v1, |
| 137 uint32_t time, |
| 138 wl_fixed_t force); |
| 139 /** |
| 140 * tilt - force change event |
| 141 * @time: timestamp with millisecond granularity |
| 142 * @tilt_x: tilt in x direction |
| 143 * @tilt_y: tilt in y direction |
| 144 * |
| 145 * Notification of a change in tilt of the pointing tool. |
| 146 * |
| 147 * If the pointer enters a client surface, with a tool type other |
| 148 * than mouse, this event will also be generated. |
| 149 * |
| 150 * Measured from surface normal as plane angle in degrees, values |
| 151 * lie in [-90,90]. A positive x is to the right and a positive y |
| 152 * is towards the user. |
| 153 */ |
| 154 void (*tilt)(void *data, |
| 155 struct zwp_pointer_stylus_v1 *zwp_pointer_stylus_v1, |
| 156 uint32_t time, |
| 157 wl_fixed_t tilt_x, |
| 158 wl_fixed_t tilt_y); |
| 159 }; |
| 160 |
| 161 static inline int |
| 162 zwp_pointer_stylus_v1_add_listener(struct zwp_pointer_stylus_v1 *zwp_pointer_sty
lus_v1, |
| 163 const struct zwp_pointer_stylus_v1_listener *
listener, void *data) |
| 164 { |
| 165 return wl_proxy_add_listener((struct wl_proxy *) zwp_pointer_stylus_v1, |
| 166 (void (**)(void)) listener, data); |
| 167 } |
| 168 |
| 169 #define ZWP_POINTER_STYLUS_V1_DESTROY 0 |
| 170 |
| 171 static inline void |
| 172 zwp_pointer_stylus_v1_set_user_data(struct zwp_pointer_stylus_v1 *zwp_pointer_st
ylus_v1, void *user_data) |
| 173 { |
| 174 wl_proxy_set_user_data((struct wl_proxy *) zwp_pointer_stylus_v1, user_d
ata); |
| 175 } |
| 176 |
| 177 static inline void * |
| 178 zwp_pointer_stylus_v1_get_user_data(struct zwp_pointer_stylus_v1 *zwp_pointer_st
ylus_v1) |
| 179 { |
| 180 return wl_proxy_get_user_data((struct wl_proxy *) zwp_pointer_stylus_v1)
; |
| 181 } |
| 182 |
| 183 static inline void |
| 184 zwp_pointer_stylus_v1_destroy(struct zwp_pointer_stylus_v1 *zwp_pointer_stylus_v
1) |
| 185 { |
| 186 wl_proxy_marshal((struct wl_proxy *) zwp_pointer_stylus_v1, |
| 187 ZWP_POINTER_STYLUS_V1_DESTROY); |
| 188 |
| 189 wl_proxy_destroy((struct wl_proxy *) zwp_pointer_stylus_v1); |
| 190 } |
| 191 |
| 192 #ifdef __cplusplus |
| 193 } |
| 194 #endif |
| 195 |
| 196 #endif |
| OLD | NEW |