1 /* Generated by wayland-scanner 1.22.0 */
2 
3 #ifndef TOUCHPAD_HAPTICS_UNSTABLE_V1_CLIENT_PROTOCOL_H
4 #define TOUCHPAD_HAPTICS_UNSTABLE_V1_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_touchpad_haptics_unstable_v1 The touchpad_haptics_unstable_v1 protocol
16  * @section page_ifaces_touchpad_haptics_unstable_v1 Interfaces
17  * - @subpage page_iface_zcr_touchpad_haptics_v1 - Allows to play haptic feedback effects on touchpad
18  * @section page_copyright_touchpad_haptics_unstable_v1 Copyright
19  * <pre>
20  *
21  * Copyright 2021 The Chromium Authors
22  *
23  * Permission is hereby granted, free of charge, to any person obtaining a
24  * copy of this software and associated documentation files (the "Software"),
25  * to deal in the Software without restriction, including without limitation
26  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
27  * and/or sell copies of the Software, and to permit persons to whom the
28  * Software is furnished to do so, subject to the following conditions:
29  *
30  * The above copyright notice and this permission notice (including the next
31  * paragraph) shall be included in all copies or substantial portions of the
32  * Software.
33  *
34  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
35  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
36  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
37  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
38  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
39  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
40  * DEALINGS IN THE SOFTWARE.
41  * </pre>
42  */
43 struct zcr_touchpad_haptics_v1;
44 
45 #ifndef ZCR_TOUCHPAD_HAPTICS_V1_INTERFACE
46 #define ZCR_TOUCHPAD_HAPTICS_V1_INTERFACE
47 /**
48  * @page page_iface_zcr_touchpad_haptics_v1 zcr_touchpad_haptics_v1
49  * @section page_iface_zcr_touchpad_haptics_v1_desc Description
50  *
51  * Allows to play haptic feedback effects on touchpad.
52  *
53  * Warning! The protocol described in this file is experimental and
54  * backward incompatible changes may be made. Backward compatible changes
55  * may be added together with the corresponding uinterface version bump.
56  * Backward incompatible changes are done by bumping the version number in
57  * the protocol and uinterface names and resetting the interface version.
58  * Once the protocol is to be declared stable, the 'z' prefix and the
59  * version number in the protocol and interface names are removed and the
60  * interface version number is reset.
61  * @section page_iface_zcr_touchpad_haptics_v1_api API
62  * See @ref iface_zcr_touchpad_haptics_v1.
63  */
64 /**
65  * @defgroup iface_zcr_touchpad_haptics_v1 The zcr_touchpad_haptics_v1 interface
66  *
67  * Allows to play haptic feedback effects on touchpad.
68  *
69  * Warning! The protocol described in this file is experimental and
70  * backward incompatible changes may be made. Backward compatible changes
71  * may be added together with the corresponding uinterface version bump.
72  * Backward incompatible changes are done by bumping the version number in
73  * the protocol and uinterface names and resetting the interface version.
74  * Once the protocol is to be declared stable, the 'z' prefix and the
75  * version number in the protocol and interface names are removed and the
76  * interface version number is reset.
77  */
78 extern const struct wl_interface zcr_touchpad_haptics_v1_interface;
79 #endif
80 
81 #ifndef ZCR_TOUCHPAD_HAPTICS_V1_EFFECT_ENUM
82 #define ZCR_TOUCHPAD_HAPTICS_V1_EFFECT_ENUM
83 enum zcr_touchpad_haptics_v1_effect {
84 	/**
85 	 * UI feedback for snapping into place
86 	 */
87 	ZCR_TOUCHPAD_HAPTICS_V1_EFFECT_SNAP = 0,
88 	/**
89 	 * UI feedback for snapping out of place
90 	 */
91 	ZCR_TOUCHPAD_HAPTICS_V1_EFFECT_SNAP_REVERSE = 1,
92 	/**
93 	 * UI feedback for reaching a limit or boundary
94 	 */
95 	ZCR_TOUCHPAD_HAPTICS_V1_EFFECT_KNOCK = 2,
96 	/**
97 	 * UI feedback for discrete state changes
98 	 */
99 	ZCR_TOUCHPAD_HAPTICS_V1_EFFECT_TICK = 3,
100 	/**
101 	 * UI feedback for activating a feature
102 	 */
103 	ZCR_TOUCHPAD_HAPTICS_V1_EFFECT_TOGGLE_ON = 4,
104 	/**
105 	 * UI feedback for deactivating a feature
106 	 */
107 	ZCR_TOUCHPAD_HAPTICS_V1_EFFECT_TOGGLE_OFF = 5,
108 	/**
109 	 * Standard touchpad button down effect
110 	 */
111 	ZCR_TOUCHPAD_HAPTICS_V1_EFFECT_PRESS = 6,
112 	/**
113 	 * Standard touchpad button up effect
114 	 */
115 	ZCR_TOUCHPAD_HAPTICS_V1_EFFECT_RELEASE = 7,
116 	/**
117 	 * Deeper (more force) touchpad button down effect
118 	 */
119 	ZCR_TOUCHPAD_HAPTICS_V1_EFFECT_DEEP_PRESS = 8,
120 	/**
121 	 * Deeper (more force) touchpad button up effect
122 	 */
123 	ZCR_TOUCHPAD_HAPTICS_V1_EFFECT_DEEP_RELEASE = 9,
124 };
125 #endif /* ZCR_TOUCHPAD_HAPTICS_V1_EFFECT_ENUM */
126 
127 /**
128  * @ingroup iface_zcr_touchpad_haptics_v1
129  * @struct zcr_touchpad_haptics_v1_listener
130  */
131 struct zcr_touchpad_haptics_v1_listener {
132 	/**
133 	 * touchpad haptics activated
134 	 *
135 	 * Inform the client that a haptic touchpad is present and ready
136 	 * to perform effects.
137 	 */
138 	void (*activated)(void *data,
139 			  struct zcr_touchpad_haptics_v1 *zcr_touchpad_haptics_v1);
140 	/**
141 	 * touchpad haptics deactivated
142 	 *
143 	 * Inform the client that no haptic touchpad is available, likely
144 	 * because the user disabled haptic effects.
145 	 */
146 	void (*deactivated)(void *data,
147 			    struct zcr_touchpad_haptics_v1 *zcr_touchpad_haptics_v1);
148 };
149 
150 /**
151  * @ingroup iface_zcr_touchpad_haptics_v1
152  */
153 static inline int
zcr_touchpad_haptics_v1_add_listener(struct zcr_touchpad_haptics_v1 * zcr_touchpad_haptics_v1,const struct zcr_touchpad_haptics_v1_listener * listener,void * data)154 zcr_touchpad_haptics_v1_add_listener(struct zcr_touchpad_haptics_v1 *zcr_touchpad_haptics_v1,
155 				     const struct zcr_touchpad_haptics_v1_listener *listener, void *data)
156 {
157 	return wl_proxy_add_listener((struct wl_proxy *) zcr_touchpad_haptics_v1,
158 				     (void (**)(void)) listener, data);
159 }
160 
161 #define ZCR_TOUCHPAD_HAPTICS_V1_DESTROY 0
162 #define ZCR_TOUCHPAD_HAPTICS_V1_PLAY 1
163 
164 /**
165  * @ingroup iface_zcr_touchpad_haptics_v1
166  */
167 #define ZCR_TOUCHPAD_HAPTICS_V1_ACTIVATED_SINCE_VERSION 1
168 /**
169  * @ingroup iface_zcr_touchpad_haptics_v1
170  */
171 #define ZCR_TOUCHPAD_HAPTICS_V1_DEACTIVATED_SINCE_VERSION 1
172 
173 /**
174  * @ingroup iface_zcr_touchpad_haptics_v1
175  */
176 #define ZCR_TOUCHPAD_HAPTICS_V1_DESTROY_SINCE_VERSION 1
177 /**
178  * @ingroup iface_zcr_touchpad_haptics_v1
179  */
180 #define ZCR_TOUCHPAD_HAPTICS_V1_PLAY_SINCE_VERSION 1
181 
182 /** @ingroup iface_zcr_touchpad_haptics_v1 */
183 static inline void
zcr_touchpad_haptics_v1_set_user_data(struct zcr_touchpad_haptics_v1 * zcr_touchpad_haptics_v1,void * user_data)184 zcr_touchpad_haptics_v1_set_user_data(struct zcr_touchpad_haptics_v1 *zcr_touchpad_haptics_v1, void *user_data)
185 {
186 	wl_proxy_set_user_data((struct wl_proxy *) zcr_touchpad_haptics_v1, user_data);
187 }
188 
189 /** @ingroup iface_zcr_touchpad_haptics_v1 */
190 static inline void *
zcr_touchpad_haptics_v1_get_user_data(struct zcr_touchpad_haptics_v1 * zcr_touchpad_haptics_v1)191 zcr_touchpad_haptics_v1_get_user_data(struct zcr_touchpad_haptics_v1 *zcr_touchpad_haptics_v1)
192 {
193 	return wl_proxy_get_user_data((struct wl_proxy *) zcr_touchpad_haptics_v1);
194 }
195 
196 static inline uint32_t
zcr_touchpad_haptics_v1_get_version(struct zcr_touchpad_haptics_v1 * zcr_touchpad_haptics_v1)197 zcr_touchpad_haptics_v1_get_version(struct zcr_touchpad_haptics_v1 *zcr_touchpad_haptics_v1)
198 {
199 	return wl_proxy_get_version((struct wl_proxy *) zcr_touchpad_haptics_v1);
200 }
201 
202 /**
203  * @ingroup iface_zcr_touchpad_haptics_v1
204  *
205  * Destroy touchpad_haptics object.
206  */
207 static inline void
zcr_touchpad_haptics_v1_destroy(struct zcr_touchpad_haptics_v1 * zcr_touchpad_haptics_v1)208 zcr_touchpad_haptics_v1_destroy(struct zcr_touchpad_haptics_v1 *zcr_touchpad_haptics_v1)
209 {
210 	wl_proxy_marshal_flags((struct wl_proxy *) zcr_touchpad_haptics_v1,
211 			 ZCR_TOUCHPAD_HAPTICS_V1_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zcr_touchpad_haptics_v1), WL_MARSHAL_FLAG_DESTROY);
212 }
213 
214 /**
215  * @ingroup iface_zcr_touchpad_haptics_v1
216  *
217  * Play the given haptic feedback with the given strength.
218  * The strength should be in [1, 5].
219  */
220 static inline void
zcr_touchpad_haptics_v1_play(struct zcr_touchpad_haptics_v1 * zcr_touchpad_haptics_v1,uint32_t effect,int32_t strength)221 zcr_touchpad_haptics_v1_play(struct zcr_touchpad_haptics_v1 *zcr_touchpad_haptics_v1, uint32_t effect, int32_t strength)
222 {
223 	wl_proxy_marshal_flags((struct wl_proxy *) zcr_touchpad_haptics_v1,
224 			 ZCR_TOUCHPAD_HAPTICS_V1_PLAY, NULL, wl_proxy_get_version((struct wl_proxy *) zcr_touchpad_haptics_v1), 0, effect, strength);
225 }
226 
227 #ifdef  __cplusplus
228 }
229 #endif
230 
231 #endif
232