1// Code generated by wlbgen. DO NOT EDIT.
2// Protocol: text_input_unstable_v3
3// Source: text-input-unstable-v3.xml
4
5// Upstream protocol copyright and license:
6// Copyright © 2012, 2013 Intel Corporation
7// Copyright © 2015, 2016 Jan Arne Petersen
8// Copyright © 2017, 2018 Red Hat, Inc.
9// Copyright © 2018 Purism SPC
10//
11// Permission to use, copy, modify, distribute, and sell this
12// software and its documentation for any purpose is hereby granted
13// without fee, provided that the above copyright notice appear in
14// all copies and that both that copyright notice and this permission
15// notice appear in supporting documentation, and that the name of
16// the copyright holders not be used in advertising or publicity
17// pertaining to distribution of the software without specific,
18// written prior permission. The copyright holders make no
19// representations about the suitability of this software for any
20// purpose. It is provided "as is" without express or implied
21// warranty.
22//
23// THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
24// SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
25// FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
26// SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
27// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
28// AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
29// ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
30// THIS SOFTWARE.
31
32package textinput
33
34import (
35 "sync"
36
37 cross_wl_seat "github.com/bnema/go-wayland-bindings/client/wayland"
38 "github.com/bnema/wlturbo/wl"
39)
40
41// CHANGE_CAUSE_INPUT_METHOD is the change_cause input_method value.
42const CHANGE_CAUSE_INPUT_METHOD = 0
43
44// CHANGE_CAUSE_OTHER is the change_cause other value.
45const CHANGE_CAUSE_OTHER = 1
46
47// CONTENT_HINT_NONE is the content_hint none value.
48const CONTENT_HINT_NONE = 0x0
49
50// CONTENT_HINT_COMPLETION is the content_hint completion value.
51const CONTENT_HINT_COMPLETION = 0x1
52
53// CONTENT_HINT_SPELLCHECK is the content_hint spellcheck value.
54const CONTENT_HINT_SPELLCHECK = 0x2
55
56// CONTENT_HINT_AUTO_CAPITALIZATION is the content_hint auto_capitalization value.
57const CONTENT_HINT_AUTO_CAPITALIZATION = 0x4
58
59// CONTENT_HINT_LOWERCASE is the content_hint lowercase value.
60const CONTENT_HINT_LOWERCASE = 0x8
61
62// CONTENT_HINT_UPPERCASE is the content_hint uppercase value.
63const CONTENT_HINT_UPPERCASE = 0x10
64
65// CONTENT_HINT_TITLECASE is the content_hint titlecase value.
66const CONTENT_HINT_TITLECASE = 0x20
67
68// CONTENT_HINT_HIDDEN_TEXT is the content_hint hidden_text value.
69const CONTENT_HINT_HIDDEN_TEXT = 0x40
70
71// CONTENT_HINT_SENSITIVE_DATA is the content_hint sensitive_data value.
72const CONTENT_HINT_SENSITIVE_DATA = 0x80
73
74// CONTENT_HINT_LATIN is the content_hint latin value.
75const CONTENT_HINT_LATIN = 0x100
76
77// CONTENT_HINT_MULTILINE is the content_hint multiline value.
78const CONTENT_HINT_MULTILINE = 0x200
79
80// CONTENT_HINT_ON_SCREEN_INPUT_PROVIDED is the content_hint on_screen_input_provided value.
81const CONTENT_HINT_ON_SCREEN_INPUT_PROVIDED = 0x400
82
83// CONTENT_HINT_NO_EMOJI is the content_hint no_emoji value.
84const CONTENT_HINT_NO_EMOJI = 0x800
85
86// CONTENT_HINT_PREEDIT_SHOWN is the content_hint preedit_shown value.
87const CONTENT_HINT_PREEDIT_SHOWN = 0x1000
88
89// CONTENT_PURPOSE_NORMAL is the content_purpose normal value.
90const CONTENT_PURPOSE_NORMAL = 0
91
92// CONTENT_PURPOSE_ALPHA is the content_purpose alpha value.
93const CONTENT_PURPOSE_ALPHA = 1
94
95// CONTENT_PURPOSE_DIGITS is the content_purpose digits value.
96const CONTENT_PURPOSE_DIGITS = 2
97
98// CONTENT_PURPOSE_NUMBER is the content_purpose number value.
99const CONTENT_PURPOSE_NUMBER = 3
100
101// CONTENT_PURPOSE_PHONE is the content_purpose phone value.
102const CONTENT_PURPOSE_PHONE = 4
103
104// CONTENT_PURPOSE_URL is the content_purpose url value.
105const CONTENT_PURPOSE_URL = 5
106
107// CONTENT_PURPOSE_EMAIL is the content_purpose email value.
108const CONTENT_PURPOSE_EMAIL = 6
109
110// CONTENT_PURPOSE_NAME is the content_purpose name value.
111const CONTENT_PURPOSE_NAME = 7
112
113// CONTENT_PURPOSE_PASSWORD is the content_purpose password value.
114const CONTENT_PURPOSE_PASSWORD = 8
115
116// CONTENT_PURPOSE_PIN is the content_purpose pin value.
117const CONTENT_PURPOSE_PIN = 9
118
119// CONTENT_PURPOSE_DATE is the content_purpose date value.
120const CONTENT_PURPOSE_DATE = 10
121
122// CONTENT_PURPOSE_TIME is the content_purpose time value.
123const CONTENT_PURPOSE_TIME = 11
124
125// CONTENT_PURPOSE_DATETIME is the content_purpose datetime value.
126const CONTENT_PURPOSE_DATETIME = 12
127
128// CONTENT_PURPOSE_TERMINAL is the content_purpose terminal value.
129const CONTENT_PURPOSE_TERMINAL = 13
130
131// ERROR_INVALID_ACTION is the error invalid_action value.
132const ERROR_INVALID_ACTION = 0
133
134// ACTION_NONE is the action none value.
135const ACTION_NONE = 0
136
137// ACTION_SUBMIT is the action submit value.
138const ACTION_SUBMIT = 1
139
140// PREEDIT_HINT_WHOLE is the preedit_hint whole value.
141const PREEDIT_HINT_WHOLE = 1
142
143// PREEDIT_HINT_SELECTION is the preedit_hint selection value.
144const PREEDIT_HINT_SELECTION = 2
145
146// PREEDIT_HINT_PREDICTION is the preedit_hint prediction value.
147const PREEDIT_HINT_PREDICTION = 3
148
149// PREEDIT_HINT_PREFIX is the preedit_hint prefix value.
150const PREEDIT_HINT_PREFIX = 4
151
152// PREEDIT_HINT_SUFFIX is the preedit_hint suffix value.
153const PREEDIT_HINT_SUFFIX = 5
154
155// PREEDIT_HINT_SPELLING_ERROR is the preedit_hint spelling_error value.
156const PREEDIT_HINT_SPELLING_ERROR = 6
157
158// PREEDIT_HINT_COMPOSE_ERROR is the preedit_hint compose_error value.
159const PREEDIT_HINT_COMPOSE_ERROR = 7
160
161// TextInputV3Interface is the protocol interface name.
162const TextInputV3Interface = "zwp_text_input_v3"
163
164// TextInputV3 is the generated binding for zwp_text_input_v3 version 2.
165type TextInputV3 struct {
166 wl.BaseProxy
167 // handlersMu guards the handler slices: a client may register or replace
168 // handlers while another goroutine dispatches events.
169 handlersMu sync.Mutex
170 onEnter []func(surfaceID uint32)
171 onLeave []func(surfaceID uint32)
172 onPreeditString []func(text string, cursorBegin int32, cursorEnd int32)
173 onCommitString []func(text string)
174 onDeleteSurroundingText []func(beforeLength uint32, afterLength uint32)
175 onDone []func(serial uint32)
176 onAction []func(action uint32, serial uint32)
177 onLanguage []func(language string)
178 onPreeditHint []func(start uint32, end uint32, hint uint32)
179}
180
181// NewTextInputV3 returns an unbound TextInputV3.
182func NewTextInputV3(ctx *wl.Context) *TextInputV3 {
183 obj := &TextInputV3{}
184 obj.SetContext(ctx)
185 ctx.Register(obj)
186 return obj
187}
188
189// Destroy the wp_text_input object. Also disables all surfaces enabled through this wp_text_input object.
190func (o *TextInputV3) Destroy() error {
191 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "zwp_text_input_v3.destroy", Destructor: true}); err != nil {
192 return err
193 }
194 return nil
195}
196
197// Requests text input on the surface previously obtained from the enter event. This request must be issued every time the focused text input changes to a new one, including within the current surface. Use zwp_text_input_v3.disable when there is no longer any input focus on the current surface. Clients must not enable more than one text input on the single seat and should disable the current text input before enabling the new one. Requests to enable a text input when another text input is enabled on the same seat must be ignored by compositor. This request resets all state associated with previous enable, disable, set_surrounding_text, set_text_change_cause, set_content_type, and set_cursor_rectangle requests, as well as the state associated with preedit_string, commit_string, and delete_surrounding_text events. The set_surrounding_text, set_content_type and set_cursor_rectangle requests must follow if the text input supports the necessary functionality. State set with this request is double-buffered. It will get applied on the next zwp_text_input_v3.commit request, and stay valid until the next committed enable or disable request. The changes must be applied by the compositor after issuing a zwp_text_input_v3.commit request.
198func (o *TextInputV3) Enable() error {
199 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "zwp_text_input_v3.enable"}); err != nil {
200 return err
201 }
202 return nil
203}
204
205// Explicitly disable text input on the current surface (typically when there is no focus on any text entry inside the surface). State set with this request is double-buffered. It will get applied on the next zwp_text_input_v3.commit request.
206func (o *TextInputV3) Disable() error {
207 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 2, Name: "zwp_text_input_v3.disable"}); err != nil {
208 return err
209 }
210 return nil
211}
212
213// Sets the surrounding plain text around the input, excluding the preedit text. The client should notify the compositor of any changes in any of the values carried with this request, including changes caused by handling incoming text-input events as well as changes caused by other mechanisms like keyboard typing. If the client is unaware of the text around the cursor, it should not issue this request, to signify lack of support to the compositor. Text is UTF-8 encoded, and should include the cursor position, the complete selection and additional characters before and after them. There is a maximum length of wayland messages, so text can not be longer than 4000 bytes. Cursor is the byte offset of the cursor within text buffer. Anchor is the byte offset of the selection anchor within text buffer. If there is no selected text, anchor is the same as cursor. If any preedit text is present, it is replaced with a cursor for the purpose of this event. Values set with this request are double-buffered. They will get applied on the next zwp_text_input_v3.commit request, and stay valid until the next committed enable or disable request. The initial state for affected fields is empty, meaning that the text input does not support sending surrounding text. If the empty values get applied, subsequent attempts to change them may have no effect.
214func (o *TextInputV3) SetSurroundingText(text string, cursor int32, anchor int32) error {
215 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 3, Name: "zwp_text_input_v3.set_surrounding_text"}, wl.ArgString(text), wl.ArgInt(cursor), wl.ArgInt(anchor)); err != nil {
216 return err
217 }
218 return nil
219}
220
221// Tells the compositor why the text surrounding the cursor changed. Whenever the client detects an external change in text, cursor, or anchor posision, it must issue this request to the compositor. This request is intended to give the input method a chance to update the preedit text in an appropriate way, e.g. by removing it when the user starts typing with a keyboard. cause describes the source of the change. The value set with this request is double-buffered. It must be applied and reset to initial at the next zwp_text_input_v3.commit request. The initial value of cause is input_method.
222func (o *TextInputV3) SetTextChangeCause(cause uint32) error {
223 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 4, Name: "zwp_text_input_v3.set_text_change_cause"}, wl.ArgUint(cause)); err != nil {
224 return err
225 }
226 return nil
227}
228
229// Sets the content purpose and content hint. While the purpose is the basic purpose of an input field, the hint flags allow to modify some of the behavior. Values set with this request are double-buffered. They will get applied on the next zwp_text_input_v3.commit request. Subsequent attempts to update them may have no effect. The values remain valid until the next committed enable or disable request. The initial value for hint is none, and the initial value for purpose is normal.
230func (o *TextInputV3) SetContentType(hint uint32, purpose uint32) error {
231 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 5, Name: "zwp_text_input_v3.set_content_type"}, wl.ArgUint(hint), wl.ArgUint(purpose)); err != nil {
232 return err
233 }
234 return nil
235}
236
237// Marks an area around the cursor as a x, y, width, height rectangle in surface local coordinates. Allows the compositor to put a window with word suggestions near the cursor, without obstructing the text being input. If the client is unaware of the position of edited text, it should not issue this request, to signify lack of support to the compositor. Values set with this request are double-buffered. They will get applied on the next zwp_text_input_v3.commit request, and stay valid until the next committed enable or disable request. The initial values describing a cursor rectangle are empty. That means the text input does not support describing the cursor area. If the empty values get applied, subsequent attempts to change them may have no effect. As of version 2, the zwp_text_input_v3.commit request does not apply values sent with this request. Instead, it stores them in a separate "committed" area. The committed values, if still valid, get applied on the next wl_surface.commit request on the surface with text-input focus. Both committed and applied values get invalidated on: - the next committed enable or disable request, or - a change of the focused surface of the text-input (leave or enter events). This double stage application allows the compositor to position the input method popup in the same frame as the contents of the text on the surface are updated.
238func (o *TextInputV3) SetCursorRectangle(x int32, y int32, width int32, height int32) error {
239 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 6, Name: "zwp_text_input_v3.set_cursor_rectangle"}, wl.ArgInt(x), wl.ArgInt(y), wl.ArgInt(width), wl.ArgInt(height)); err != nil {
240 return err
241 }
242 return nil
243}
244
245// Atomically applies state changes recently sent to the compositor. The commit request establishes and updates the state of the client, and must be issued after any changes to apply them. Text input state (enabled status, content purpose, content hint, surrounding text and change cause, cursor rectangle) is conceptually double-buffered within the context of a text input, i.e. between a committed enable request and the following committed enable or disable request. Protocol requests modify the pending state, as opposed to the current state in use by the input method. A commit request atomically applies all pending state, replacing the current state. After commit, the new pending state is as documented for each related request. Requests are applied in the order of arrival. Neither current nor pending state are modified unless noted otherwise. The compositor must count the number of commit requests coming from each zwp_text_input_v3 object and use the count as the serial in done events.
246func (o *TextInputV3) Commit() error {
247 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 7, Name: "zwp_text_input_v3.commit"}); err != nil {
248 return err
249 }
250 return nil
251}
252
253// Set the actions available for this text input. Values set with this request are double-buffered. They will get applied on the next zwp_text_input_v3.commit request. If the available_actions array contains the none action, or contains the same action multiple times, the compositor must raise the invalid_action protocol error. Initially, no actions are available.
254func (o *TextInputV3) SetAvailableActions(availableActions []byte) error {
255 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 8, Name: "zwp_text_input_v3.set_available_actions", Since: 2}, wl.ArgArray(availableActions)); err != nil {
256 return err
257 }
258 return nil
259}
260
261// Requests an input panel to be shown (e.g. a on-screen keyboard). This request only hints the desired interaction pattern from the client side, and its effect may be ignored by compositors given other environmental factors. Repeated calls will be ignored.
262func (o *TextInputV3) ShowInputPanel() error {
263 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 9, Name: "zwp_text_input_v3.show_input_panel", Since: 2}); err != nil {
264 return err
265 }
266 return nil
267}
268
269// Requests an input panel to be hidden. This request only hints the desired interaction pattern from the client side, and its effect may be ignored by compositors given other environmental factors. Repeated calls will be ignored.
270func (o *TextInputV3) HideInputPanel() error {
271 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 10, Name: "zwp_text_input_v3.hide_input_panel", Since: 2}); err != nil {
272 return err
273 }
274 return nil
275}
276
277// OnEnter registers a handler for the enter event.
278//
279// Handlers are appended, so a second call adds another handler rather than
280// replacing the first. Registration is safe while another goroutine dispatches.
281func (o *TextInputV3) OnEnter(handler func(surfaceID uint32)) {
282 if handler == nil {
283 return
284 }
285 o.handlersMu.Lock()
286 defer o.handlersMu.Unlock()
287 o.onEnter = append(o.onEnter, handler)
288}
289
290// handlersForEnter returns the handlers registered for enter, taken
291// under the lock so a handler may register another handler while events are
292// being dispatched.
293func (o *TextInputV3) handlersForEnter() []func(surfaceID uint32) {
294 o.handlersMu.Lock()
295 defer o.handlersMu.Unlock()
296 return o.onEnter
297}
298
299// OnLeave registers a handler for the leave event.
300//
301// Handlers are appended, so a second call adds another handler rather than
302// replacing the first. Registration is safe while another goroutine dispatches.
303func (o *TextInputV3) OnLeave(handler func(surfaceID uint32)) {
304 if handler == nil {
305 return
306 }
307 o.handlersMu.Lock()
308 defer o.handlersMu.Unlock()
309 o.onLeave = append(o.onLeave, handler)
310}
311
312// handlersForLeave returns the handlers registered for leave, taken
313// under the lock so a handler may register another handler while events are
314// being dispatched.
315func (o *TextInputV3) handlersForLeave() []func(surfaceID uint32) {
316 o.handlersMu.Lock()
317 defer o.handlersMu.Unlock()
318 return o.onLeave
319}
320
321// OnPreeditString registers a handler for the preedit_string event.
322//
323// Handlers are appended, so a second call adds another handler rather than
324// replacing the first. Registration is safe while another goroutine dispatches.
325func (o *TextInputV3) OnPreeditString(handler func(text string, cursorBegin int32, cursorEnd int32)) {
326 if handler == nil {
327 return
328 }
329 o.handlersMu.Lock()
330 defer o.handlersMu.Unlock()
331 o.onPreeditString = append(o.onPreeditString, handler)
332}
333
334// handlersForPreeditString returns the handlers registered for preedit_string, taken
335// under the lock so a handler may register another handler while events are
336// being dispatched.
337func (o *TextInputV3) handlersForPreeditString() []func(text string, cursorBegin int32, cursorEnd int32) {
338 o.handlersMu.Lock()
339 defer o.handlersMu.Unlock()
340 return o.onPreeditString
341}
342
343// OnCommitString registers a handler for the commit_string event.
344//
345// Handlers are appended, so a second call adds another handler rather than
346// replacing the first. Registration is safe while another goroutine dispatches.
347func (o *TextInputV3) OnCommitString(handler func(text string)) {
348 if handler == nil {
349 return
350 }
351 o.handlersMu.Lock()
352 defer o.handlersMu.Unlock()
353 o.onCommitString = append(o.onCommitString, handler)
354}
355
356// handlersForCommitString returns the handlers registered for commit_string, taken
357// under the lock so a handler may register another handler while events are
358// being dispatched.
359func (o *TextInputV3) handlersForCommitString() []func(text string) {
360 o.handlersMu.Lock()
361 defer o.handlersMu.Unlock()
362 return o.onCommitString
363}
364
365// OnDeleteSurroundingText registers a handler for the delete_surrounding_text event.
366//
367// Handlers are appended, so a second call adds another handler rather than
368// replacing the first. Registration is safe while another goroutine dispatches.
369func (o *TextInputV3) OnDeleteSurroundingText(handler func(beforeLength uint32, afterLength uint32)) {
370 if handler == nil {
371 return
372 }
373 o.handlersMu.Lock()
374 defer o.handlersMu.Unlock()
375 o.onDeleteSurroundingText = append(o.onDeleteSurroundingText, handler)
376}
377
378// handlersForDeleteSurroundingText returns the handlers registered for delete_surrounding_text, taken
379// under the lock so a handler may register another handler while events are
380// being dispatched.
381func (o *TextInputV3) handlersForDeleteSurroundingText() []func(beforeLength uint32, afterLength uint32) {
382 o.handlersMu.Lock()
383 defer o.handlersMu.Unlock()
384 return o.onDeleteSurroundingText
385}
386
387// OnDone registers a handler for the done event.
388//
389// Handlers are appended, so a second call adds another handler rather than
390// replacing the first. Registration is safe while another goroutine dispatches.
391func (o *TextInputV3) OnDone(handler func(serial uint32)) {
392 if handler == nil {
393 return
394 }
395 o.handlersMu.Lock()
396 defer o.handlersMu.Unlock()
397 o.onDone = append(o.onDone, handler)
398}
399
400// handlersForDone returns the handlers registered for done, taken
401// under the lock so a handler may register another handler while events are
402// being dispatched.
403func (o *TextInputV3) handlersForDone() []func(serial uint32) {
404 o.handlersMu.Lock()
405 defer o.handlersMu.Unlock()
406 return o.onDone
407}
408
409// OnAction registers a handler for the action event.
410//
411// Handlers are appended, so a second call adds another handler rather than
412// replacing the first. Registration is safe while another goroutine dispatches.
413func (o *TextInputV3) OnAction(handler func(action uint32, serial uint32)) {
414 if handler == nil {
415 return
416 }
417 o.handlersMu.Lock()
418 defer o.handlersMu.Unlock()
419 o.onAction = append(o.onAction, handler)
420}
421
422// handlersForAction returns the handlers registered for action, taken
423// under the lock so a handler may register another handler while events are
424// being dispatched.
425func (o *TextInputV3) handlersForAction() []func(action uint32, serial uint32) {
426 o.handlersMu.Lock()
427 defer o.handlersMu.Unlock()
428 return o.onAction
429}
430
431// OnLanguage registers a handler for the language event.
432//
433// Handlers are appended, so a second call adds another handler rather than
434// replacing the first. Registration is safe while another goroutine dispatches.
435func (o *TextInputV3) OnLanguage(handler func(language string)) {
436 if handler == nil {
437 return
438 }
439 o.handlersMu.Lock()
440 defer o.handlersMu.Unlock()
441 o.onLanguage = append(o.onLanguage, handler)
442}
443
444// handlersForLanguage returns the handlers registered for language, taken
445// under the lock so a handler may register another handler while events are
446// being dispatched.
447func (o *TextInputV3) handlersForLanguage() []func(language string) {
448 o.handlersMu.Lock()
449 defer o.handlersMu.Unlock()
450 return o.onLanguage
451}
452
453// OnPreeditHint registers a handler for the preedit_hint event.
454//
455// Handlers are appended, so a second call adds another handler rather than
456// replacing the first. Registration is safe while another goroutine dispatches.
457func (o *TextInputV3) OnPreeditHint(handler func(start uint32, end uint32, hint uint32)) {
458 if handler == nil {
459 return
460 }
461 o.handlersMu.Lock()
462 defer o.handlersMu.Unlock()
463 o.onPreeditHint = append(o.onPreeditHint, handler)
464}
465
466// handlersForPreeditHint returns the handlers registered for preedit_hint, taken
467// under the lock so a handler may register another handler while events are
468// being dispatched.
469func (o *TextInputV3) handlersForPreeditHint() []func(start uint32, end uint32, hint uint32) {
470 o.handlersMu.Lock()
471 defer o.handlersMu.Unlock()
472 return o.onPreeditHint
473}
474
475// EventSignature returns the declared event argument types in wire order.
476func (o *TextInputV3) EventSignature(opcode uint16) (string, bool) {
477 switch opcode {
478 case 0:
479 return "object,", true
480 case 1:
481 return "object,", true
482 case 2:
483 return "string,int,int,", true
484 case 3:
485 return "string,", true
486 case 4:
487 return "uint,uint,", true
488 case 5:
489 return "uint,", true
490 case 6:
491 return "uint,uint,", true
492 case 7:
493 return "string,", true
494 case 8:
495 return "uint,uint,uint,", true
496 default:
497 return "", false
498 }
499}
500
501// Dispatch decodes one event on zwp_text_input_v3 and calls the registered handlers.
502func (o *TextInputV3) Dispatch(event *wl.Event) {
503 switch event.Opcode {
504 case 0: // enter
505 surfaceID := event.Uint32()
506
507 for i, handler := range o.handlersForEnter() {
508 _ = i
509 handler(surfaceID)
510 }
511 case 1: // leave
512 surfaceID := event.Uint32()
513
514 for i, handler := range o.handlersForLeave() {
515 _ = i
516 handler(surfaceID)
517 }
518 case 2: // preedit_string
519 text := event.String()
520 cursorBegin := event.Int32()
521 cursorEnd := event.Int32()
522
523 for i, handler := range o.handlersForPreeditString() {
524 _ = i
525 handler(text, cursorBegin, cursorEnd)
526 }
527 case 3: // commit_string
528 text := event.String()
529
530 for i, handler := range o.handlersForCommitString() {
531 _ = i
532 handler(text)
533 }
534 case 4: // delete_surrounding_text
535 beforeLength := event.Uint32()
536 afterLength := event.Uint32()
537
538 for i, handler := range o.handlersForDeleteSurroundingText() {
539 _ = i
540 handler(beforeLength, afterLength)
541 }
542 case 5: // done
543 serial := event.Uint32()
544
545 for i, handler := range o.handlersForDone() {
546 _ = i
547 handler(serial)
548 }
549 case 6: // action
550 action := event.Uint32()
551 serial := event.Uint32()
552
553 for i, handler := range o.handlersForAction() {
554 _ = i
555 handler(action, serial)
556 }
557 case 7: // language
558 language := event.String()
559
560 for i, handler := range o.handlersForLanguage() {
561 _ = i
562 handler(language)
563 }
564 case 8: // preedit_hint
565 start := event.Uint32()
566 end := event.Uint32()
567 hint := event.Uint32()
568
569 for i, handler := range o.handlersForPreeditHint() {
570 _ = i
571 handler(start, end, hint)
572 }
573 default:
574 }
575}
576
577// TextInputManagerV3Interface is the protocol interface name.
578const TextInputManagerV3Interface = "zwp_text_input_manager_v3"
579
580// TextInputManagerV3 is the generated binding for zwp_text_input_manager_v3 version 2.
581type TextInputManagerV3 struct {
582 wl.BaseProxy
583}
584
585// NewTextInputManagerV3 returns an unbound TextInputManagerV3.
586func NewTextInputManagerV3(ctx *wl.Context) *TextInputManagerV3 {
587 obj := &TextInputManagerV3{}
588 obj.SetContext(ctx)
589 ctx.Register(obj)
590 return obj
591}
592
593// Destroy the wp_text_input_manager object.
594func (o *TextInputManagerV3) Destroy() error {
595 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "zwp_text_input_manager_v3.destroy", Destructor: true}); err != nil {
596 return err
597 }
598 return nil
599}
600
601// Creates a new text-input object for a given seat.
602func (o *TextInputManagerV3) GetTextInput(seat *cross_wl_seat.Seat) (*TextInputV3, error) {
603 var arg1 wl.Object
604 if seat != nil {
605 arg1 = seat
606 }
607 child := &TextInputV3{}
608 child.SetContext(o.Context())
609 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "zwp_text_input_manager_v3.get_text_input", Child: child}, wl.ArgObject(child), wl.ArgObject(arg1)); err != nil {
610 return nil, err
611 }
612 return child, nil
613}
614
615// EventSignature returns the declared event argument types in wire order.
616func (o *TextInputManagerV3) EventSignature(opcode uint16) (string, bool) {
617 switch opcode {
618 default:
619 return "", false
620 }
621}
622
623// Dispatch decodes one event on zwp_text_input_manager_v3 and calls the registered handlers.
624func (o *TextInputManagerV3) Dispatch(event *wl.Event) {
625 switch event.Opcode {
626 default:
627 }
628}