Debian Codegraph @

client/wayland/input-method-unstable-v2-client-protocol.h

raw
1 /* Generated by wayland-scanner 1.23.0 */
2
3 #ifndef INPUT_METHOD_UNSTABLE_V2_CLIENT_PROTOCOL_H
4 #define INPUT_METHOD_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_input_method_unstable_v2 The input_method_unstable_v2 protocol
16 * Protocol for creating input methods
17 *
18 * @section page_desc_input_method_unstable_v2 Description
19 *
20 * This protocol allows applications to act as input methods for compositors.
21 *
22 * An input method context is used to manage the state of the input method.
23 *
24 * Text strings are UTF-8 encoded, their indices and lengths are in bytes.
25 *
26 * This document adheres to the RFC 2119 when using words like "must",
27 * "should", "may", etc.
28 *
29 * Warning! The protocol described in this file is experimental and
30 * backward incompatible changes may be made. Backward compatible changes
31 * may be added together with the corresponding interface version bump.
32 * Backward incompatible changes are done by bumping the version number in
33 * the protocol and interface names and resetting the interface version.
34 * Once the protocol is to be declared stable, the 'z' prefix and the
35 * version number in the protocol and interface names are removed and the
36 * interface version number is reset.
37 *
38 * @section page_ifaces_input_method_unstable_v2 Interfaces
39 * - @subpage page_iface_zwp_input_method_v2 - input method
40 * - @subpage page_iface_zwp_input_popup_surface_v2 - popup surface
41 * - @subpage page_iface_zwp_input_method_keyboard_grab_v2 - keyboard grab
42 * - @subpage page_iface_zwp_input_method_manager_v2 - input method manager
43 * @section page_copyright_input_method_unstable_v2 Copyright
44 * <pre>
45 *
46 * Copyright © 2008-2011 Kristian Høgsberg
47 * Copyright © 2010-2011 Intel Corporation
48 * Copyright © 2012-2013 Collabora, Ltd.
49 * Copyright © 2012, 2013 Intel Corporation
50 * Copyright © 2015, 2016 Jan Arne Petersen
51 * Copyright © 2017, 2018 Red Hat, Inc.
52 * Copyright © 2018 Purism SPC
53 *
54 * Permission is hereby granted, free of charge, to any person obtaining a
55 * copy of this software and associated documentation files (the "Software"),
56 * to deal in the Software without restriction, including without limitation
57 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
58 * and/or sell copies of the Software, and to permit persons to whom the
59 * Software is furnished to do so, subject to the following conditions:
60 *
61 * The above copyright notice and this permission notice (including the next
62 * paragraph) shall be included in all copies or substantial portions of the
63 * Software.
64 *
65 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
66 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
67 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
68 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
69 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
70 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
71 * DEALINGS IN THE SOFTWARE.
72 * </pre>
73 */
74 struct wl_seat;
75 struct wl_surface;
76 struct zwp_input_method_keyboard_grab_v2;
77 struct zwp_input_method_manager_v2;
78 struct zwp_input_method_v2;
79 struct zwp_input_popup_surface_v2;
80
81 #ifndef ZWP_INPUT_METHOD_V2_INTERFACE
82 #define ZWP_INPUT_METHOD_V2_INTERFACE
83 /**
84 * @page page_iface_zwp_input_method_v2 zwp_input_method_v2
85 * @section page_iface_zwp_input_method_v2_desc Description
86 *
87 * An input method object allows for clients to compose text.
88 *
89 * The objects connects the client to a text input in an application, and
90 * lets the client to serve as an input method for a seat.
91 *
92 * The zwp_input_method_v2 object can occupy two distinct states: active and
93 * inactive. In the active state, the object is associated to and
94 * communicates with a text input. In the inactive state, there is no
95 * associated text input, and the only communication is with the compositor.
96 * Initially, the input method is in the inactive state.
97 *
98 * Requests issued in the inactive state must be accepted by the compositor.
99 * Because of the serial mechanism, and the state reset on activate event,
100 * they will not have any effect on the state of the next text input.
101 *
102 * There must be no more than one input method object per seat.
103 * @section page_iface_zwp_input_method_v2_api API
104 * See @ref iface_zwp_input_method_v2.
105 */
106 /**
107 * @defgroup iface_zwp_input_method_v2 The zwp_input_method_v2 interface
108 *
109 * An input method object allows for clients to compose text.
110 *
111 * The objects connects the client to a text input in an application, and
112 * lets the client to serve as an input method for a seat.
113 *
114 * The zwp_input_method_v2 object can occupy two distinct states: active and
115 * inactive. In the active state, the object is associated to and
116 * communicates with a text input. In the inactive state, there is no
117 * associated text input, and the only communication is with the compositor.
118 * Initially, the input method is in the inactive state.
119 *
120 * Requests issued in the inactive state must be accepted by the compositor.
121 * Because of the serial mechanism, and the state reset on activate event,
122 * they will not have any effect on the state of the next text input.
123 *
124 * There must be no more than one input method object per seat.
125 */
126 extern const struct wl_interface zwp_input_method_v2_interface;
127 #endif
128 #ifndef ZWP_INPUT_POPUP_SURFACE_V2_INTERFACE
129 #define ZWP_INPUT_POPUP_SURFACE_V2_INTERFACE
130 /**
131 * @page page_iface_zwp_input_popup_surface_v2 zwp_input_popup_surface_v2
132 * @section page_iface_zwp_input_popup_surface_v2_desc Description
133 *
134 * This interface marks a surface as a popup for interacting with an input
135 * method.
136 *
137 * The compositor should place it near the active text input area. It must
138 * be visible if and only if the input method is in the active state.
139 *
140 * The client must not destroy the underlying wl_surface while the
141 * zwp_input_popup_surface_v2 object exists.
142 * @section page_iface_zwp_input_popup_surface_v2_api API
143 * See @ref iface_zwp_input_popup_surface_v2.
144 */
145 /**
146 * @defgroup iface_zwp_input_popup_surface_v2 The zwp_input_popup_surface_v2 interface
147 *
148 * This interface marks a surface as a popup for interacting with an input
149 * method.
150 *
151 * The compositor should place it near the active text input area. It must
152 * be visible if and only if the input method is in the active state.
153 *
154 * The client must not destroy the underlying wl_surface while the
155 * zwp_input_popup_surface_v2 object exists.
156 */
157 extern const struct wl_interface zwp_input_popup_surface_v2_interface;
158 #endif
159 #ifndef ZWP_INPUT_METHOD_KEYBOARD_GRAB_V2_INTERFACE
160 #define ZWP_INPUT_METHOD_KEYBOARD_GRAB_V2_INTERFACE
161 /**
162 * @page page_iface_zwp_input_method_keyboard_grab_v2 zwp_input_method_keyboard_grab_v2
163 * @section page_iface_zwp_input_method_keyboard_grab_v2_desc Description
164 *
165 * The zwp_input_method_keyboard_grab_v2 interface represents an exclusive
166 * grab of the wl_keyboard interface associated with the seat.
167 * @section page_iface_zwp_input_method_keyboard_grab_v2_api API
168 * See @ref iface_zwp_input_method_keyboard_grab_v2.
169 */
170 /**
171 * @defgroup iface_zwp_input_method_keyboard_grab_v2 The zwp_input_method_keyboard_grab_v2 interface
172 *
173 * The zwp_input_method_keyboard_grab_v2 interface represents an exclusive
174 * grab of the wl_keyboard interface associated with the seat.
175 */
176 extern const struct wl_interface zwp_input_method_keyboard_grab_v2_interface;
177 #endif
178 #ifndef ZWP_INPUT_METHOD_MANAGER_V2_INTERFACE
179 #define ZWP_INPUT_METHOD_MANAGER_V2_INTERFACE
180 /**
181 * @page page_iface_zwp_input_method_manager_v2 zwp_input_method_manager_v2
182 * @section page_iface_zwp_input_method_manager_v2_desc Description
183 *
184 * The input method manager allows the client to become the input method on
185 * a chosen seat.
186 *
187 * No more than one input method must be associated with any seat at any
188 * given time.
189 * @section page_iface_zwp_input_method_manager_v2_api API
190 * See @ref iface_zwp_input_method_manager_v2.
191 */
192 /**
193 * @defgroup iface_zwp_input_method_manager_v2 The zwp_input_method_manager_v2 interface
194 *
195 * The input method manager allows the client to become the input method on
196 * a chosen seat.
197 *
198 * No more than one input method must be associated with any seat at any
199 * given time.
200 */
201 extern const struct wl_interface zwp_input_method_manager_v2_interface;
202 #endif
203
204 #ifndef ZWP_INPUT_METHOD_V2_ERROR_ENUM
205 #define ZWP_INPUT_METHOD_V2_ERROR_ENUM
206 enum zwp_input_method_v2_error {
207 /**
208 * wl_surface has another role
209 */
210 ZWP_INPUT_METHOD_V2_ERROR_ROLE = 0,
211 };
212 #endif /* ZWP_INPUT_METHOD_V2_ERROR_ENUM */
213
214 /**
215 * @ingroup iface_zwp_input_method_v2
216 * @struct zwp_input_method_v2_listener
217 */
218 struct zwp_input_method_v2_listener {
219 /**
220 * input method has been requested
221 *
222 * Notification that a text input focused on this seat requested
223 * the input method to be activated.
224 *
225 * This event serves the purpose of providing the compositor with
226 * an active input method.
227 *
228 * This event resets all state associated with previous enable,
229 * disable, surrounding_text, text_change_cause, and content_type
230 * events, as well as the state associated with set_preedit_string,
231 * commit_string, and delete_surrounding_text requests. In
232 * addition, it marks the zwp_input_method_v2 object as active, and
233 * makes any existing zwp_input_popup_surface_v2 objects visible.
234 *
235 * The surrounding_text, and content_type events must follow before
236 * the next done event if the text input supports the respective
237 * functionality.
238 *
239 * State set with this event is double-buffered. It will get
240 * applied on the next zwp_input_method_v2.done event, and stay
241 * valid until changed.
242 */
243 void (*activate)(void *data,
244 struct zwp_input_method_v2 *zwp_input_method_v2);
245 /**
246 * deactivate event
247 *
248 * Notification that no focused text input currently needs an
249 * active input method on this seat.
250 *
251 * This event marks the zwp_input_method_v2 object as inactive. The
252 * compositor must make all existing zwp_input_popup_surface_v2
253 * objects invisible until the next activate event.
254 *
255 * State set with this event is double-buffered. It will get
256 * applied on the next zwp_input_method_v2.done event, and stay
257 * valid until changed.
258 */
259 void (*deactivate)(void *data,
260 struct zwp_input_method_v2 *zwp_input_method_v2);
261 /**
262 * surrounding text event
263 *
264 * Updates the surrounding plain text around the cursor,
265 * excluding the preedit text.
266 *
267 * If any preedit text is present, it is replaced with the cursor
268 * for the purpose of this event.
269 *
270 * The argument text is a buffer containing the preedit string, and
271 * must include the cursor position, and the complete selection. It
272 * should contain additional characters before and after these.
273 * There is a maximum length of wayland messages, so text can not
274 * be longer than 4000 bytes.
275 *
276 * cursor is the byte offset of the cursor within the text buffer.
277 *
278 * anchor is the byte offset of the selection anchor within the
279 * text buffer. If there is no selected text, anchor must be the
280 * same as cursor.
281 *
282 * If this event does not arrive before the first done event, the
283 * input method may assume that the text input does not support
284 * this functionality and ignore following surrounding_text events.
285 *
286 * Values set with this event are double-buffered. They will get
287 * applied and set to initial values on the next
288 * zwp_input_method_v2.done event.
289 *
290 * The initial state for affected fields is empty, meaning that the
291 * text input does not support sending surrounding text. If the
292 * empty values get applied, subsequent attempts to change them may
293 * have no effect.
294 */
295 void (*surrounding_text)(void *data,
296 struct zwp_input_method_v2 *zwp_input_method_v2,
297 const char *text,
298 uint32_t cursor,
299 uint32_t anchor);
300 /**
301 * indicates the cause of surrounding text change
302 *
303 * Tells the input method why the text surrounding the cursor
304 * changed.
305 *
306 * Whenever the client detects an external change in text, cursor,
307 * or anchor position, it must issue this request to the
308 * compositor. This request is intended to give the input method a
309 * chance to update the preedit text in an appropriate way, e.g. by
310 * removing it when the user starts typing with a keyboard.
311 *
312 * cause describes the source of the change.
313 *
314 * The value set with this event is double-buffered. It will get
315 * applied and set to its initial value on the next
316 * zwp_input_method_v2.done event.
317 *
318 * The initial value of cause is input_method.
319 */
320 void (*text_change_cause)(void *data,
321 struct zwp_input_method_v2 *zwp_input_method_v2,
322 uint32_t cause);
323 /**
324 * content purpose and hint
325 *
326 * Indicates the content type and hint for the current
327 * zwp_input_method_v2 instance.
328 *
329 * Values set with this event are double-buffered. They will get
330 * applied on the next zwp_input_method_v2.done event.
331 *
332 * The initial value for hint is none, and the initial value for
333 * purpose is normal.
334 */
335 void (*content_type)(void *data,
336 struct zwp_input_method_v2 *zwp_input_method_v2,
337 uint32_t hint,
338 uint32_t purpose);
339 /**
340 * apply state
341 *
342 * Atomically applies state changes recently sent to the client.
343 *
344 * The done event establishes and updates the state of the client,
345 * and must be issued after any changes to apply them.
346 *
347 * Text input state (content purpose, content hint, surrounding
348 * text, and change cause) is conceptually double-buffered within
349 * an input method context.
350 *
351 * Events modify the pending state, as opposed to the current state
352 * in use by the input method. A done event atomically applies all
353 * pending state, replacing the current state. After done, the new
354 * pending state is as documented for each related request.
355 *
356 * Events must be applied in the order of arrival.
357 *
358 * Neither current nor pending state are modified unless noted
359 * otherwise.
360 */
361 void (*done)(void *data,
362 struct zwp_input_method_v2 *zwp_input_method_v2);
363 /**
364 * input method unavailable
365 *
366 * The input method ceased to be available.
367 *
368 * The compositor must issue this event as the only event on the
369 * object if there was another input_method object associated with
370 * the same seat at the time of its creation.
371 *
372 * The compositor must issue this request when the object is no
373 * longer usable, e.g. due to seat removal.
374 *
375 * The input method context becomes inert and should be destroyed
376 * after deactivation is handled. Any further requests and events
377 * except for the destroy request must be ignored.
378 */
379 void (*unavailable)(void *data,
380 struct zwp_input_method_v2 *zwp_input_method_v2);
381 };
382
383 /**
384 * @ingroup iface_zwp_input_method_v2
385 */
386 static inline int
387 zwp_input_method_v2_add_listener(struct zwp_input_method_v2 *zwp_input_method_v2,
388 const struct zwp_input_method_v2_listener *listener, void *data)
389 {
390 return wl_proxy_add_listener((struct wl_proxy *) zwp_input_method_v2,
391 (void (**)(void)) listener, data);
392 }
393
394 #define ZWP_INPUT_METHOD_V2_COMMIT_STRING 0
395 #define ZWP_INPUT_METHOD_V2_SET_PREEDIT_STRING 1
396 #define ZWP_INPUT_METHOD_V2_DELETE_SURROUNDING_TEXT 2
397 #define ZWP_INPUT_METHOD_V2_COMMIT 3
398 #define ZWP_INPUT_METHOD_V2_GET_INPUT_POPUP_SURFACE 4
399 #define ZWP_INPUT_METHOD_V2_GRAB_KEYBOARD 5
400 #define ZWP_INPUT_METHOD_V2_DESTROY 6
401
402 /**
403 * @ingroup iface_zwp_input_method_v2
404 */
405 #define ZWP_INPUT_METHOD_V2_ACTIVATE_SINCE_VERSION 1
406 /**
407 * @ingroup iface_zwp_input_method_v2
408 */
409 #define ZWP_INPUT_METHOD_V2_DEACTIVATE_SINCE_VERSION 1
410 /**
411 * @ingroup iface_zwp_input_method_v2
412 */
413 #define ZWP_INPUT_METHOD_V2_SURROUNDING_TEXT_SINCE_VERSION 1
414 /**
415 * @ingroup iface_zwp_input_method_v2
416 */
417 #define ZWP_INPUT_METHOD_V2_TEXT_CHANGE_CAUSE_SINCE_VERSION 1
418 /**
419 * @ingroup iface_zwp_input_method_v2
420 */
421 #define ZWP_INPUT_METHOD_V2_CONTENT_TYPE_SINCE_VERSION 1
422 /**
423 * @ingroup iface_zwp_input_method_v2
424 */
425 #define ZWP_INPUT_METHOD_V2_DONE_SINCE_VERSION 1
426 /**
427 * @ingroup iface_zwp_input_method_v2
428 */
429 #define ZWP_INPUT_METHOD_V2_UNAVAILABLE_SINCE_VERSION 1
430
431 /**
432 * @ingroup iface_zwp_input_method_v2
433 */
434 #define ZWP_INPUT_METHOD_V2_COMMIT_STRING_SINCE_VERSION 1
435 /**
436 * @ingroup iface_zwp_input_method_v2
437 */
438 #define ZWP_INPUT_METHOD_V2_SET_PREEDIT_STRING_SINCE_VERSION 1
439 /**
440 * @ingroup iface_zwp_input_method_v2
441 */
442 #define ZWP_INPUT_METHOD_V2_DELETE_SURROUNDING_TEXT_SINCE_VERSION 1
443 /**
444 * @ingroup iface_zwp_input_method_v2
445 */
446 #define ZWP_INPUT_METHOD_V2_COMMIT_SINCE_VERSION 1
447 /**
448 * @ingroup iface_zwp_input_method_v2
449 */
450 #define ZWP_INPUT_METHOD_V2_GET_INPUT_POPUP_SURFACE_SINCE_VERSION 1
451 /**
452 * @ingroup iface_zwp_input_method_v2
453 */
454 #define ZWP_INPUT_METHOD_V2_GRAB_KEYBOARD_SINCE_VERSION 1
455 /**
456 * @ingroup iface_zwp_input_method_v2
457 */
458 #define ZWP_INPUT_METHOD_V2_DESTROY_SINCE_VERSION 1
459
460 /** @ingroup iface_zwp_input_method_v2 */
461 static inline void
462 zwp_input_method_v2_set_user_data(struct zwp_input_method_v2 *zwp_input_method_v2, void *user_data)
463 {
464 wl_proxy_set_user_data((struct wl_proxy *) zwp_input_method_v2, user_data);
465 }
466
467 /** @ingroup iface_zwp_input_method_v2 */
468 static inline void *
469 zwp_input_method_v2_get_user_data(struct zwp_input_method_v2 *zwp_input_method_v2)
470 {
471 return wl_proxy_get_user_data((struct wl_proxy *) zwp_input_method_v2);
472 }
473
474 static inline uint32_t
475 zwp_input_method_v2_get_version(struct zwp_input_method_v2 *zwp_input_method_v2)
476 {
477 return wl_proxy_get_version((struct wl_proxy *) zwp_input_method_v2);
478 }
479
480 /**
481 * @ingroup iface_zwp_input_method_v2
482 *
483 * Send the commit string text for insertion to the application.
484 *
485 * Inserts a string at current cursor position (see commit event
486 * sequence). The string to commit could be either just a single character
487 * after a key press or the result of some composing.
488 *
489 * The argument text is a buffer containing the string to insert. There is
490 * a maximum length of wayland messages, so text can not be longer than
491 * 4000 bytes.
492 *
493 * Values set with this event are double-buffered. They must be applied
494 * and reset to initial on the next zwp_text_input_v3.commit request.
495 *
496 * The initial value of text is an empty string.
497 */
498 static inline void
499 zwp_input_method_v2_commit_string(struct zwp_input_method_v2 *zwp_input_method_v2, const char *text)
500 {
501 wl_proxy_marshal_flags((struct wl_proxy *) zwp_input_method_v2,
502 ZWP_INPUT_METHOD_V2_COMMIT_STRING, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_input_method_v2), 0, text);
503 }
504
505 /**
506 * @ingroup iface_zwp_input_method_v2
507 *
508 * Send the pre-edit string text to the application text input.
509 *
510 * Place a new composing text (pre-edit) at the current cursor position.
511 * Any previously set composing text must be removed. Any previously
512 * existing selected text must be removed. The cursor is moved to a new
513 * position within the preedit string.
514 *
515 * The argument text is a buffer containing the preedit string. There is
516 * a maximum length of wayland messages, so text can not be longer than
517 * 4000 bytes.
518 *
519 * The arguments cursor_begin and cursor_end are counted in bytes relative
520 * to the beginning of the submitted string buffer. Cursor should be
521 * hidden by the text input when both are equal to -1.
522 *
523 * cursor_begin indicates the beginning of the cursor. cursor_end
524 * indicates the end of the cursor. It may be equal or different than
525 * cursor_begin.
526 *
527 * Values set with this event are double-buffered. They must be applied on
528 * the next zwp_input_method_v2.commit event.
529 *
530 * The initial value of text is an empty string. The initial value of
531 * cursor_begin, and cursor_end are both 0.
532 */
533 static inline void
534 zwp_input_method_v2_set_preedit_string(struct zwp_input_method_v2 *zwp_input_method_v2, const char *text, int32_t cursor_begin, int32_t cursor_end)
535 {
536 wl_proxy_marshal_flags((struct wl_proxy *) zwp_input_method_v2,
537 ZWP_INPUT_METHOD_V2_SET_PREEDIT_STRING, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_input_method_v2), 0, text, cursor_begin, cursor_end);
538 }
539
540 /**
541 * @ingroup iface_zwp_input_method_v2
542 *
543 * Remove the surrounding text.
544 *
545 * before_length and after_length are the number of bytes before and after
546 * the current cursor index (excluding the preedit text) to delete.
547 *
548 * If any preedit text is present, it is replaced with the cursor for the
549 * purpose of this event. In effect before_length is counted from the
550 * beginning of preedit text, and after_length from its end (see commit
551 * event sequence).
552 *
553 * Values set with this event are double-buffered. They must be applied
554 * and reset to initial on the next zwp_input_method_v2.commit request.
555 *
556 * The initial values of both before_length and after_length are 0.
557 */
558 static inline void
559 zwp_input_method_v2_delete_surrounding_text(struct zwp_input_method_v2 *zwp_input_method_v2, uint32_t before_length, uint32_t after_length)
560 {
561 wl_proxy_marshal_flags((struct wl_proxy *) zwp_input_method_v2,
562 ZWP_INPUT_METHOD_V2_DELETE_SURROUNDING_TEXT, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_input_method_v2), 0, before_length, after_length);
563 }
564
565 /**
566 * @ingroup iface_zwp_input_method_v2
567 *
568 * Apply state changes from commit_string, set_preedit_string and
569 * delete_surrounding_text requests.
570 *
571 * The state relating to these events is double-buffered, and each one
572 * modifies the pending state. This request replaces the current state
573 * with the pending state.
574 *
575 * The connected text input is expected to proceed by evaluating the
576 * changes in the following order:
577 *
578 * 1. Replace existing preedit string with the cursor.
579 * 2. Delete requested surrounding text.
580 * 3. Insert commit string with the cursor at its end.
581 * 4. Calculate surrounding text to send.
582 * 5. Insert new preedit text in cursor position.
583 * 6. Place cursor inside preedit text.
584 *
585 * The serial number reflects the last state of the zwp_input_method_v2
586 * object known to the client. The value of the serial argument must be
587 * equal to the number of done events already issued by that object. When
588 * the compositor receives a commit request with a serial different than
589 * the number of past done events, it must proceed as normal, except it
590 * should not change the current state of the zwp_input_method_v2 object.
591 */
592 static inline void
593 zwp_input_method_v2_commit(struct zwp_input_method_v2 *zwp_input_method_v2, uint32_t serial)
594 {
595 wl_proxy_marshal_flags((struct wl_proxy *) zwp_input_method_v2,
596 ZWP_INPUT_METHOD_V2_COMMIT, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_input_method_v2), 0, serial);
597 }
598
599 /**
600 * @ingroup iface_zwp_input_method_v2
601 *
602 * Creates a new zwp_input_popup_surface_v2 object wrapping a given
603 * surface.
604 *
605 * The surface gets assigned the "input_popup" role. If the surface
606 * already has an assigned role, the compositor must issue a protocol
607 * error.
608 */
609 static inline struct zwp_input_popup_surface_v2 *
610 zwp_input_method_v2_get_input_popup_surface(struct zwp_input_method_v2 *zwp_input_method_v2, struct wl_surface *surface)
611 {
612 struct wl_proxy *id;
613
614 id = wl_proxy_marshal_flags((struct wl_proxy *) zwp_input_method_v2,
615 ZWP_INPUT_METHOD_V2_GET_INPUT_POPUP_SURFACE, &zwp_input_popup_surface_v2_interface, wl_proxy_get_version((struct wl_proxy *) zwp_input_method_v2), 0, NULL, surface);
616
617 return (struct zwp_input_popup_surface_v2 *) id;
618 }
619
620 /**
621 * @ingroup iface_zwp_input_method_v2
622 *
623 * Allow an input method to receive hardware keyboard input and process
624 * key events to generate text events (with pre-edit) over the wire. This
625 * allows input methods which compose multiple key events for inputting
626 * text like it is done for CJK languages.
627 *
628 * The compositor should send all keyboard events on the seat to the grab
629 * holder via the returned wl_keyboard object. Nevertheless, the
630 * compositor may decide not to forward any particular event. The
631 * compositor must not further process any event after it has been
632 * forwarded to the grab holder.
633 *
634 * Releasing the resulting wl_keyboard object releases the grab.
635 */
636 static inline struct zwp_input_method_keyboard_grab_v2 *
637 zwp_input_method_v2_grab_keyboard(struct zwp_input_method_v2 *zwp_input_method_v2)
638 {
639 struct wl_proxy *keyboard;
640
641 keyboard = wl_proxy_marshal_flags((struct wl_proxy *) zwp_input_method_v2,
642 ZWP_INPUT_METHOD_V2_GRAB_KEYBOARD, &zwp_input_method_keyboard_grab_v2_interface, wl_proxy_get_version((struct wl_proxy *) zwp_input_method_v2), 0, NULL);
643
644 return (struct zwp_input_method_keyboard_grab_v2 *) keyboard;
645 }
646
647 /**
648 * @ingroup iface_zwp_input_method_v2
649 *
650 * Destroys the zwp_text_input_v2 object and any associated child
651 * objects, i.e. zwp_input_popup_surface_v2 and
652 * zwp_input_method_keyboard_grab_v2.
653 */
654 static inline void
655 zwp_input_method_v2_destroy(struct zwp_input_method_v2 *zwp_input_method_v2)
656 {
657 wl_proxy_marshal_flags((struct wl_proxy *) zwp_input_method_v2,
658 ZWP_INPUT_METHOD_V2_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_input_method_v2), WL_MARSHAL_FLAG_DESTROY);
659 }
660
661 /**
662 * @ingroup iface_zwp_input_popup_surface_v2
663 * @struct zwp_input_popup_surface_v2_listener
664 */
665 struct zwp_input_popup_surface_v2_listener {
666 /**
667 * set text input area position
668 *
669 * Notify about the position of the area of the text input
670 * expressed as a rectangle in surface local coordinates.
671 *
672 * This is a hint to the input method telling it the relative
673 * position of the text being entered.
674 */
675 void (*text_input_rectangle)(void *data,
676 struct zwp_input_popup_surface_v2 *zwp_input_popup_surface_v2,
677 int32_t x,
678 int32_t y,
679 int32_t width,
680 int32_t height);
681 };
682
683 /**
684 * @ingroup iface_zwp_input_popup_surface_v2
685 */
686 static inline int
687 zwp_input_popup_surface_v2_add_listener(struct zwp_input_popup_surface_v2 *zwp_input_popup_surface_v2,
688 const struct zwp_input_popup_surface_v2_listener *listener, void *data)
689 {
690 return wl_proxy_add_listener((struct wl_proxy *) zwp_input_popup_surface_v2,
691 (void (**)(void)) listener, data);
692 }
693
694 #define ZWP_INPUT_POPUP_SURFACE_V2_DESTROY 0
695
696 /**
697 * @ingroup iface_zwp_input_popup_surface_v2
698 */
699 #define ZWP_INPUT_POPUP_SURFACE_V2_TEXT_INPUT_RECTANGLE_SINCE_VERSION 1
700
701 /**
702 * @ingroup iface_zwp_input_popup_surface_v2
703 */
704 #define ZWP_INPUT_POPUP_SURFACE_V2_DESTROY_SINCE_VERSION 1
705
706 /** @ingroup iface_zwp_input_popup_surface_v2 */
707 static inline void
708 zwp_input_popup_surface_v2_set_user_data(struct zwp_input_popup_surface_v2 *zwp_input_popup_surface_v2, void *user_data)
709 {
710 wl_proxy_set_user_data((struct wl_proxy *) zwp_input_popup_surface_v2, user_data);
711 }
712
713 /** @ingroup iface_zwp_input_popup_surface_v2 */
714 static inline void *
715 zwp_input_popup_surface_v2_get_user_data(struct zwp_input_popup_surface_v2 *zwp_input_popup_surface_v2)
716 {
717 return wl_proxy_get_user_data((struct wl_proxy *) zwp_input_popup_surface_v2);
718 }
719
720 static inline uint32_t
721 zwp_input_popup_surface_v2_get_version(struct zwp_input_popup_surface_v2 *zwp_input_popup_surface_v2)
722 {
723 return wl_proxy_get_version((struct wl_proxy *) zwp_input_popup_surface_v2);
724 }
725
726 /**
727 * @ingroup iface_zwp_input_popup_surface_v2
728 */
729 static inline void
730 zwp_input_popup_surface_v2_destroy(struct zwp_input_popup_surface_v2 *zwp_input_popup_surface_v2)
731 {
732 wl_proxy_marshal_flags((struct wl_proxy *) zwp_input_popup_surface_v2,
733 ZWP_INPUT_POPUP_SURFACE_V2_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_input_popup_surface_v2), WL_MARSHAL_FLAG_DESTROY);
734 }
735
736 /**
737 * @ingroup iface_zwp_input_method_keyboard_grab_v2
738 * @struct zwp_input_method_keyboard_grab_v2_listener
739 */
740 struct zwp_input_method_keyboard_grab_v2_listener {
741 /**
742 * keyboard mapping
743 *
744 * This event provides a file descriptor to the client which can
745 * be memory-mapped to provide a keyboard mapping description.
746 * @param format keymap format
747 * @param fd keymap file descriptor
748 * @param size keymap size, in bytes
749 */
750 void (*keymap)(void *data,
751 struct zwp_input_method_keyboard_grab_v2 *zwp_input_method_keyboard_grab_v2,
752 uint32_t format,
753 int32_t fd,
754 uint32_t size);
755 /**
756 * key event
757 *
758 * A key was pressed or released. The time argument is a
759 * timestamp with millisecond granularity, with an undefined base.
760 * @param serial serial number of the key event
761 * @param time timestamp with millisecond granularity
762 * @param key key that produced the event
763 * @param state physical state of the key
764 */
765 void (*key)(void *data,
766 struct zwp_input_method_keyboard_grab_v2 *zwp_input_method_keyboard_grab_v2,
767 uint32_t serial,
768 uint32_t time,
769 uint32_t key,
770 uint32_t state);
771 /**
772 * modifier and group state
773 *
774 * Notifies clients that the modifier and/or group state has
775 * changed, and it should update its local state.
776 * @param serial serial number of the modifiers event
777 * @param mods_depressed depressed modifiers
778 * @param mods_latched latched modifiers
779 * @param mods_locked locked modifiers
780 * @param group keyboard layout
781 */
782 void (*modifiers)(void *data,
783 struct zwp_input_method_keyboard_grab_v2 *zwp_input_method_keyboard_grab_v2,
784 uint32_t serial,
785 uint32_t mods_depressed,
786 uint32_t mods_latched,
787 uint32_t mods_locked,
788 uint32_t group);
789 /**
790 * repeat rate and delay
791 *
792 * Informs the client about the keyboard's repeat rate and delay.
793 *
794 * This event is sent as soon as the
795 * zwp_input_method_keyboard_grab_v2 object has been created, and
796 * is guaranteed to be received by the client before any key press
797 * event.
798 *
799 * Negative values for either rate or delay are illegal. A rate of
800 * zero will disable any repeating (regardless of the value of
801 * delay).
802 *
803 * This event can be sent later on as well with a new value if
804 * necessary, so clients should continue listening for the event
805 * past the creation of zwp_input_method_keyboard_grab_v2.
806 * @param rate the rate of repeating keys in characters per second
807 * @param delay delay in milliseconds since key down until repeating starts
808 */
809 void (*repeat_info)(void *data,
810 struct zwp_input_method_keyboard_grab_v2 *zwp_input_method_keyboard_grab_v2,
811 int32_t rate,
812 int32_t delay);
813 };
814
815 /**
816 * @ingroup iface_zwp_input_method_keyboard_grab_v2
817 */
818 static inline int
819 zwp_input_method_keyboard_grab_v2_add_listener(struct zwp_input_method_keyboard_grab_v2 *zwp_input_method_keyboard_grab_v2,
820 const struct zwp_input_method_keyboard_grab_v2_listener *listener, void *data)
821 {
822 return wl_proxy_add_listener((struct wl_proxy *) zwp_input_method_keyboard_grab_v2,
823 (void (**)(void)) listener, data);
824 }
825
826 #define ZWP_INPUT_METHOD_KEYBOARD_GRAB_V2_RELEASE 0
827
828 /**
829 * @ingroup iface_zwp_input_method_keyboard_grab_v2
830 */
831 #define ZWP_INPUT_METHOD_KEYBOARD_GRAB_V2_KEYMAP_SINCE_VERSION 1
832 /**
833 * @ingroup iface_zwp_input_method_keyboard_grab_v2
834 */
835 #define ZWP_INPUT_METHOD_KEYBOARD_GRAB_V2_KEY_SINCE_VERSION 1
836 /**
837 * @ingroup iface_zwp_input_method_keyboard_grab_v2
838 */
839 #define ZWP_INPUT_METHOD_KEYBOARD_GRAB_V2_MODIFIERS_SINCE_VERSION 1
840 /**
841 * @ingroup iface_zwp_input_method_keyboard_grab_v2
842 */
843 #define ZWP_INPUT_METHOD_KEYBOARD_GRAB_V2_REPEAT_INFO_SINCE_VERSION 1
844
845 /**
846 * @ingroup iface_zwp_input_method_keyboard_grab_v2
847 */
848 #define ZWP_INPUT_METHOD_KEYBOARD_GRAB_V2_RELEASE_SINCE_VERSION 1
849
850 /** @ingroup iface_zwp_input_method_keyboard_grab_v2 */
851 static inline void
852 zwp_input_method_keyboard_grab_v2_set_user_data(struct zwp_input_method_keyboard_grab_v2 *zwp_input_method_keyboard_grab_v2, void *user_data)
853 {
854 wl_proxy_set_user_data((struct wl_proxy *) zwp_input_method_keyboard_grab_v2, user_data);
855 }
856
857 /** @ingroup iface_zwp_input_method_keyboard_grab_v2 */
858 static inline void *
859 zwp_input_method_keyboard_grab_v2_get_user_data(struct zwp_input_method_keyboard_grab_v2 *zwp_input_method_keyboard_grab_v2)
860 {
861 return wl_proxy_get_user_data((struct wl_proxy *) zwp_input_method_keyboard_grab_v2);
862 }
863
864 static inline uint32_t
865 zwp_input_method_keyboard_grab_v2_get_version(struct zwp_input_method_keyboard_grab_v2 *zwp_input_method_keyboard_grab_v2)
866 {
867 return wl_proxy_get_version((struct wl_proxy *) zwp_input_method_keyboard_grab_v2);
868 }
869
870 /** @ingroup iface_zwp_input_method_keyboard_grab_v2 */
871 static inline void
872 zwp_input_method_keyboard_grab_v2_destroy(struct zwp_input_method_keyboard_grab_v2 *zwp_input_method_keyboard_grab_v2)
873 {
874 wl_proxy_destroy((struct wl_proxy *) zwp_input_method_keyboard_grab_v2);
875 }
876
877 /**
878 * @ingroup iface_zwp_input_method_keyboard_grab_v2
879 */
880 static inline void
881 zwp_input_method_keyboard_grab_v2_release(struct zwp_input_method_keyboard_grab_v2 *zwp_input_method_keyboard_grab_v2)
882 {
883 wl_proxy_marshal_flags((struct wl_proxy *) zwp_input_method_keyboard_grab_v2,
884 ZWP_INPUT_METHOD_KEYBOARD_GRAB_V2_RELEASE, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_input_method_keyboard_grab_v2), WL_MARSHAL_FLAG_DESTROY);
885 }
886
887 #define ZWP_INPUT_METHOD_MANAGER_V2_GET_INPUT_METHOD 0
888 #define ZWP_INPUT_METHOD_MANAGER_V2_DESTROY 1
889
890
891 /**
892 * @ingroup iface_zwp_input_method_manager_v2
893 */
894 #define ZWP_INPUT_METHOD_MANAGER_V2_GET_INPUT_METHOD_SINCE_VERSION 1
895 /**
896 * @ingroup iface_zwp_input_method_manager_v2
897 */
898 #define ZWP_INPUT_METHOD_MANAGER_V2_DESTROY_SINCE_VERSION 1
899
900 /** @ingroup iface_zwp_input_method_manager_v2 */
901 static inline void
902 zwp_input_method_manager_v2_set_user_data(struct zwp_input_method_manager_v2 *zwp_input_method_manager_v2, void *user_data)
903 {
904 wl_proxy_set_user_data((struct wl_proxy *) zwp_input_method_manager_v2, user_data);
905 }
906
907 /** @ingroup iface_zwp_input_method_manager_v2 */
908 static inline void *
909 zwp_input_method_manager_v2_get_user_data(struct zwp_input_method_manager_v2 *zwp_input_method_manager_v2)
910 {
911 return wl_proxy_get_user_data((struct wl_proxy *) zwp_input_method_manager_v2);
912 }
913
914 static inline uint32_t
915 zwp_input_method_manager_v2_get_version(struct zwp_input_method_manager_v2 *zwp_input_method_manager_v2)
916 {
917 return wl_proxy_get_version((struct wl_proxy *) zwp_input_method_manager_v2);
918 }
919
920 /**
921 * @ingroup iface_zwp_input_method_manager_v2
922 *
923 * Request a new input zwp_input_method_v2 object associated with a given
924 * seat.
925 */
926 static inline struct zwp_input_method_v2 *
927 zwp_input_method_manager_v2_get_input_method(struct zwp_input_method_manager_v2 *zwp_input_method_manager_v2, struct wl_seat *seat)
928 {
929 struct wl_proxy *input_method;
930
931 input_method = wl_proxy_marshal_flags((struct wl_proxy *) zwp_input_method_manager_v2,
932 ZWP_INPUT_METHOD_MANAGER_V2_GET_INPUT_METHOD, &zwp_input_method_v2_interface, wl_proxy_get_version((struct wl_proxy *) zwp_input_method_manager_v2), 0, seat, NULL);
933
934 return (struct zwp_input_method_v2 *) input_method;
935 }
936
937 /**
938 * @ingroup iface_zwp_input_method_manager_v2
939 *
940 * Destroys the zwp_input_method_manager_v2 object.
941 *
942 * The zwp_input_method_v2 objects originating from it remain valid.
943 */
944 static inline void
945 zwp_input_method_manager_v2_destroy(struct zwp_input_method_manager_v2 *zwp_input_method_manager_v2)
946 {
947 wl_proxy_marshal_flags((struct wl_proxy *) zwp_input_method_manager_v2,
948 ZWP_INPUT_METHOD_MANAGER_V2_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_input_method_manager_v2), WL_MARSHAL_FLAG_DESTROY);
949 }
950
951 #ifdef __cplusplus
952 }
953 #endif
954
955 #endif