// Code generated by wlgen; DO NOT EDIT. package inputmethod import ( "fmt" wayland "github.com/bnema/purego-libwayland/protocol/wayland" "github.com/bnema/purego-libwayland/server" "runtime" ) var ZwpInputMethodV2Interface *server.Interface var ZwpInputPopupSurfaceV2Interface *server.Interface var ZwpInputMethodKeyboardGrabV2Interface *server.Interface var ZwpInputMethodManagerV2Interface *server.Interface func init() { ZwpInputMethodV2Interface = &server.Interface{Name: "zwp_input_method_v2", Version: 1} ZwpInputPopupSurfaceV2Interface = &server.Interface{Name: "zwp_input_popup_surface_v2", Version: 1} ZwpInputMethodKeyboardGrabV2Interface = &server.Interface{Name: "zwp_input_method_keyboard_grab_v2", Version: 1} ZwpInputMethodManagerV2Interface = &server.Interface{Name: "zwp_input_method_manager_v2", Version: 1} ZwpInputMethodV2Interface.Requests = []server.Message{ {Name: "commit_string", Signature: "s", Types: []*server.Interface{nil}}, {Name: "set_preedit_string", Signature: "sii", Types: []*server.Interface{nil, nil, nil}}, {Name: "delete_surrounding_text", Signature: "uu", Types: []*server.Interface{nil, nil}}, {Name: "commit", Signature: "u", Types: []*server.Interface{nil}}, {Name: "get_input_popup_surface", Signature: "no", Types: []*server.Interface{ZwpInputPopupSurfaceV2Interface, wayland.SurfaceInterface}}, {Name: "grab_keyboard", Signature: "n", Types: []*server.Interface{ZwpInputMethodKeyboardGrabV2Interface}}, {Name: "destroy", Signature: "", Types: []*server.Interface{}}, } ZwpInputMethodV2Interface.Events = []server.Message{ {Name: "activate", Signature: "", Types: []*server.Interface{}}, {Name: "deactivate", Signature: "", Types: []*server.Interface{}}, {Name: "surrounding_text", Signature: "suu", Types: []*server.Interface{nil, nil, nil}}, {Name: "text_change_cause", Signature: "u", Types: []*server.Interface{nil}}, {Name: "content_type", Signature: "uu", Types: []*server.Interface{nil, nil}}, {Name: "done", Signature: "", Types: []*server.Interface{}}, {Name: "unavailable", Signature: "", Types: []*server.Interface{}}, } ZwpInputPopupSurfaceV2Interface.Requests = []server.Message{ {Name: "destroy", Signature: "", Types: []*server.Interface{}}, } ZwpInputPopupSurfaceV2Interface.Events = []server.Message{ {Name: "text_input_rectangle", Signature: "iiii", Types: []*server.Interface{nil, nil, nil, nil}}, } ZwpInputMethodKeyboardGrabV2Interface.Requests = []server.Message{ {Name: "release", Signature: "", Types: []*server.Interface{}}, } ZwpInputMethodKeyboardGrabV2Interface.Events = []server.Message{ {Name: "keymap", Signature: "uhu", Types: []*server.Interface{nil, nil, nil}}, {Name: "key", Signature: "uuuu", Types: []*server.Interface{nil, nil, nil, nil}}, {Name: "modifiers", Signature: "uuuuu", Types: []*server.Interface{nil, nil, nil, nil, nil}}, {Name: "repeat_info", Signature: "ii", Types: []*server.Interface{nil, nil}}, } ZwpInputMethodManagerV2Interface.Requests = []server.Message{ {Name: "get_input_method", Signature: "on", Types: []*server.Interface{wayland.SeatInterface, ZwpInputMethodV2Interface}}, {Name: "destroy", Signature: "", Types: []*server.Interface{}}, } ZwpInputMethodManagerV2Interface.Events = []server.Message{} if err := server.NewInterfaces(ZwpInputMethodV2Interface, ZwpInputPopupSurfaceV2Interface, ZwpInputMethodKeyboardGrabV2Interface, ZwpInputMethodManagerV2Interface); err != nil { panic(err) } } // ZwpInputMethodV2 input method. type ZwpInputMethodV2 struct{ *server.Resource } func WrapZwpInputMethodV2(r *server.Resource) *ZwpInputMethodV2 { if r == nil { return nil } return &ZwpInputMethodV2{r} } const ZwpInputMethodV2RequestCommitString uint32 = 0 const ZwpInputMethodV2RequestSetPreeditString uint32 = 1 const ZwpInputMethodV2RequestDeleteSurroundingText uint32 = 2 const ZwpInputMethodV2RequestCommit uint32 = 3 const ZwpInputMethodV2RequestGetInputPopupSurface uint32 = 4 const ZwpInputMethodV2RequestGrabKeyboard uint32 = 5 const ZwpInputMethodV2RequestDestroy uint32 = 6 const ZwpInputMethodV2EventActivate uint32 = 0 const ZwpInputMethodV2EventDeactivate uint32 = 1 const ZwpInputMethodV2EventSurroundingText uint32 = 2 const ZwpInputMethodV2EventTextChangeCause uint32 = 3 const ZwpInputMethodV2EventContentType uint32 = 4 const ZwpInputMethodV2EventDone uint32 = 5 const ZwpInputMethodV2EventUnavailable uint32 = 6 // ZwpInputMethodV2Error . type ZwpInputMethodV2Error uint32 const ( ZwpInputMethodV2ErrorRole ZwpInputMethodV2Error = 0 ) // ZwpInputMethodV2Handler handles zwp_input_method_v2 requests. type ZwpInputMethodV2Handler interface { CommitString(self *ZwpInputMethodV2, text string) SetPreeditString(self *ZwpInputMethodV2, text string, cursorBegin int32, cursorEnd int32) DeleteSurroundingText(self *ZwpInputMethodV2, beforeLength uint32, afterLength uint32) Commit(self *ZwpInputMethodV2, serial uint32) GetInputPopupSurface(self *ZwpInputMethodV2, id uint32, surface *wayland.Surface) GrabKeyboard(self *ZwpInputMethodV2, keyboard uint32) Destroy(self *ZwpInputMethodV2) } func NewZwpInputMethodV2(c server.Client, version int32, id uint32, h ZwpInputMethodV2Handler) (*ZwpInputMethodV2, error) { if h == nil { return nil, fmt.Errorf("purego-libwayland: nil handler for zwp_input_method_v2") } var self *ZwpInputMethodV2 r, err := c.CreateResource(ZwpInputMethodV2Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { switch opcode { case 0: h.CommitString(self, args[0].String()) case 1: h.SetPreeditString(self, args[0].String(), args[1].Int(), args[2].Int()) case 2: h.DeleteSurroundingText(self, args[0].Uint(), args[1].Uint()) case 3: h.Commit(self, args[0].Uint()) case 4: h.GetInputPopupSurface(self, args[0].NewID(), wayland.WrapSurface(args[1].Resource())) case 5: h.GrabKeyboard(self, args[0].NewID()) case 6: h.Destroy(self) self.Destroy() } }) if err != nil { return nil, err } self = WrapZwpInputMethodV2(r) r.Data = self return self, nil } // SendActivate input method has been requested. func (self *ZwpInputMethodV2) SendActivate() { self.PostEvent(ZwpInputMethodV2EventActivate) } // SendDeactivate deactivate event. func (self *ZwpInputMethodV2) SendDeactivate() { self.PostEvent(ZwpInputMethodV2EventDeactivate) } // SendSurroundingText surrounding text event. func (self *ZwpInputMethodV2) SendSurroundingText(text string, cursor uint32, anchor uint32) { var p runtime.Pinner defer p.Unpin() self.PostEvent(ZwpInputMethodV2EventSurroundingText, server.String(&p, text, false), server.Uint(cursor), server.Uint(anchor)) } // SendTextChangeCause indicates the cause of surrounding text change. func (self *ZwpInputMethodV2) SendTextChangeCause(cause uint32) { self.PostEvent(ZwpInputMethodV2EventTextChangeCause, server.Uint(cause)) } // SendContentType content purpose and hint. func (self *ZwpInputMethodV2) SendContentType(hint uint32, purpose uint32) { self.PostEvent(ZwpInputMethodV2EventContentType, server.Uint(hint), server.Uint(purpose)) } // SendDone apply state. func (self *ZwpInputMethodV2) SendDone() { self.PostEvent(ZwpInputMethodV2EventDone) } // SendUnavailable input method unavailable. func (self *ZwpInputMethodV2) SendUnavailable() { self.PostEvent(ZwpInputMethodV2EventUnavailable) } func NewZwpInputMethodV2Global(d *server.Display, version int32, bind server.BindFunc) error { return d.CreateGlobal(ZwpInputMethodV2Interface, version, bind) } // ZwpInputPopupSurfaceV2 popup surface. type ZwpInputPopupSurfaceV2 struct{ *server.Resource } func WrapZwpInputPopupSurfaceV2(r *server.Resource) *ZwpInputPopupSurfaceV2 { if r == nil { return nil } return &ZwpInputPopupSurfaceV2{r} } const ZwpInputPopupSurfaceV2RequestDestroy uint32 = 0 const ZwpInputPopupSurfaceV2EventTextInputRectangle uint32 = 0 // ZwpInputPopupSurfaceV2Handler handles zwp_input_popup_surface_v2 requests. type ZwpInputPopupSurfaceV2Handler interface { Destroy(self *ZwpInputPopupSurfaceV2) } func NewZwpInputPopupSurfaceV2(c server.Client, version int32, id uint32, h ZwpInputPopupSurfaceV2Handler) (*ZwpInputPopupSurfaceV2, error) { if h == nil { return nil, fmt.Errorf("purego-libwayland: nil handler for zwp_input_popup_surface_v2") } var self *ZwpInputPopupSurfaceV2 r, err := c.CreateResource(ZwpInputPopupSurfaceV2Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { switch opcode { case 0: h.Destroy(self) self.Destroy() } }) if err != nil { return nil, err } self = WrapZwpInputPopupSurfaceV2(r) r.Data = self return self, nil } // SendTextInputRectangle set text input area position. func (self *ZwpInputPopupSurfaceV2) SendTextInputRectangle(x int32, y int32, width int32, height int32) { self.PostEvent(ZwpInputPopupSurfaceV2EventTextInputRectangle, server.Int(x), server.Int(y), server.Int(width), server.Int(height)) } func NewZwpInputPopupSurfaceV2Global(d *server.Display, version int32, bind server.BindFunc) error { return d.CreateGlobal(ZwpInputPopupSurfaceV2Interface, version, bind) } // ZwpInputMethodKeyboardGrabV2 keyboard grab. type ZwpInputMethodKeyboardGrabV2 struct{ *server.Resource } func WrapZwpInputMethodKeyboardGrabV2(r *server.Resource) *ZwpInputMethodKeyboardGrabV2 { if r == nil { return nil } return &ZwpInputMethodKeyboardGrabV2{r} } const ZwpInputMethodKeyboardGrabV2RequestRelease uint32 = 0 const ZwpInputMethodKeyboardGrabV2EventKeymap uint32 = 0 const ZwpInputMethodKeyboardGrabV2EventKey uint32 = 1 const ZwpInputMethodKeyboardGrabV2EventModifiers uint32 = 2 const ZwpInputMethodKeyboardGrabV2EventRepeatInfo uint32 = 3 // ZwpInputMethodKeyboardGrabV2Handler handles zwp_input_method_keyboard_grab_v2 requests. type ZwpInputMethodKeyboardGrabV2Handler interface { Release(self *ZwpInputMethodKeyboardGrabV2) } func NewZwpInputMethodKeyboardGrabV2(c server.Client, version int32, id uint32, h ZwpInputMethodKeyboardGrabV2Handler) (*ZwpInputMethodKeyboardGrabV2, error) { if h == nil { return nil, fmt.Errorf("purego-libwayland: nil handler for zwp_input_method_keyboard_grab_v2") } var self *ZwpInputMethodKeyboardGrabV2 r, err := c.CreateResource(ZwpInputMethodKeyboardGrabV2Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { switch opcode { case 0: h.Release(self) self.Destroy() } }) if err != nil { return nil, err } self = WrapZwpInputMethodKeyboardGrabV2(r) r.Data = self return self, nil } // SendKeymap keyboard mapping. func (self *ZwpInputMethodKeyboardGrabV2) SendKeymap(format uint32, fd int, size uint32) { self.PostEvent(ZwpInputMethodKeyboardGrabV2EventKeymap, server.Uint(format), server.Fd(fd), server.Uint(size)) } // SendKey key event. func (self *ZwpInputMethodKeyboardGrabV2) SendKey(serial uint32, time uint32, key uint32, state uint32) { self.PostEvent(ZwpInputMethodKeyboardGrabV2EventKey, server.Uint(serial), server.Uint(time), server.Uint(key), server.Uint(state)) } // SendModifiers modifier and group state. func (self *ZwpInputMethodKeyboardGrabV2) SendModifiers(serial uint32, modsDepressed uint32, modsLatched uint32, modsLocked uint32, group uint32) { self.PostEvent(ZwpInputMethodKeyboardGrabV2EventModifiers, server.Uint(serial), server.Uint(modsDepressed), server.Uint(modsLatched), server.Uint(modsLocked), server.Uint(group)) } // SendRepeatInfo repeat rate and delay. func (self *ZwpInputMethodKeyboardGrabV2) SendRepeatInfo(rate int32, delay int32) { self.PostEvent(ZwpInputMethodKeyboardGrabV2EventRepeatInfo, server.Int(rate), server.Int(delay)) } func NewZwpInputMethodKeyboardGrabV2Global(d *server.Display, version int32, bind server.BindFunc) error { return d.CreateGlobal(ZwpInputMethodKeyboardGrabV2Interface, version, bind) } // ZwpInputMethodManagerV2 input method manager. type ZwpInputMethodManagerV2 struct{ *server.Resource } func WrapZwpInputMethodManagerV2(r *server.Resource) *ZwpInputMethodManagerV2 { if r == nil { return nil } return &ZwpInputMethodManagerV2{r} } const ZwpInputMethodManagerV2RequestGetInputMethod uint32 = 0 const ZwpInputMethodManagerV2RequestDestroy uint32 = 1 // ZwpInputMethodManagerV2Handler handles zwp_input_method_manager_v2 requests. type ZwpInputMethodManagerV2Handler interface { GetInputMethod(self *ZwpInputMethodManagerV2, seat *wayland.Seat, inputMethod uint32) Destroy(self *ZwpInputMethodManagerV2) } func NewZwpInputMethodManagerV2(c server.Client, version int32, id uint32, h ZwpInputMethodManagerV2Handler) (*ZwpInputMethodManagerV2, error) { if h == nil { return nil, fmt.Errorf("purego-libwayland: nil handler for zwp_input_method_manager_v2") } var self *ZwpInputMethodManagerV2 r, err := c.CreateResource(ZwpInputMethodManagerV2Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { switch opcode { case 0: h.GetInputMethod(self, wayland.WrapSeat(args[0].Resource()), args[1].NewID()) case 1: h.Destroy(self) self.Destroy() } }) if err != nil { return nil, err } self = WrapZwpInputMethodManagerV2(r) r.Data = self return self, nil } func NewZwpInputMethodManagerV2Global(d *server.Display, version int32, bind server.BindFunc) error { return d.CreateGlobal(ZwpInputMethodManagerV2Interface, version, bind) } func resourceOf(v interface{ GetResource() *server.Resource }) *server.Resource { if v == nil { return nil } return v.GetResource() } func (self *ZwpInputMethodV2) GetResource() *server.Resource { if self == nil { return nil } return self.Resource } func (self *ZwpInputPopupSurfaceV2) GetResource() *server.Resource { if self == nil { return nil } return self.Resource } func (self *ZwpInputMethodKeyboardGrabV2) GetResource() *server.Resource { if self == nil { return nil } return self.Resource } func (self *ZwpInputMethodManagerV2) GetResource() *server.Resource { if self == nil { return nil } return self.Resource }