func (i *InputMethodContext) AddPreferredLanguageHandler(f InputMethodContextPreferredLanguageHandlerFunc) {
	if f == nil {
		return
	}
	i.preferredLanguageHandlers = append(i.preferredLanguageHandlers, f)
}
AddPreferredLanguageHandler : adds handler for InputMethodContextPreferredLanguageEvent
package input_method
import (
	"reflect"
	"github.com/rajveermalviya/go-wayland/wayland/client"
)
type InputMethodContext struct {
	client.BaseProxy
	surroundingTextHandlers   []InputMethodContextSurroundingTextHandlerFunc
	resetHandlers             []InputMethodContextResetHandlerFunc
	contentTypeHandlers       []InputMethodContextContentTypeHandlerFunc
	invokeActionHandlers      []InputMethodContextInvokeActionHandlerFunc
	commitStateHandlers       []InputMethodContextCommitStateHandlerFunc
	preferredLanguageHandlers []InputMethodContextPreferredLanguageHandlerFunc
}
func NewInputMethodContext(ctx *client.Context) *InputMethodContext {
	zwpInputMethodContextV1 := &InputMethodContext{}
	ctx.Register(zwpInputMethodContextV1)
	return zwpInputMethodContextV1
}
func (i *InputMethodContext) Destroy() error {
	defer i.Context().Unregister(i)
	const opcode = 0
	const rLen = 8
	r := make([]byte, rLen)
	l := 0
	client.PutUint32(r[l:4], i.ID())
	l += 4
	client.PutUint32(r[l:l+4], uint32(rLen<<16|opcode&0x0000ffff))
	l += 4
	err := i.Context().WriteMsg(r, nil)
	return err
}
func (i *InputMethodContext) CommitString(serial uint32, text string) error {
	const opcode = 1
	textLen := client.PaddedLen(len(text) + 1)
	rLen := 8 + 4 + (4 + textLen)
	r := make([]byte, rLen)
	l := 0
	client.PutUint32(r[l:4], i.ID())
	l += 4
	client.PutUint32(r[l:l+4], uint32(rLen<<16|opcode&0x0000ffff))
	l += 4
	client.PutUint32(r[l:l+4], uint32(serial))
	l += 4
	client.PutString(r[l:l+(4+textLen)], text, textLen)
	l += (4 + textLen)
	err := i.Context().WriteMsg(r, nil)
	return err
}
func (i *InputMethodContext) PreeditString(serial uint32, text, commit string) error {
	const opcode = 2
	textLen := client.PaddedLen(len(text) + 1)
	commitLen := client.PaddedLen(len(commit) + 1)
	rLen := 8 + 4 + (4 + textLen) + (4 + commitLen)
	r := make([]byte, rLen)
	l := 0
	client.PutUint32(r[l:4], i.ID())
	l += 4
	client.PutUint32(r[l:l+4], uint32(rLen<<16|opcode&0x0000ffff))
	l += 4
	client.PutUint32(r[l:l+4], uint32(serial))
	l += 4
	client.PutString(r[l:l+(4+textLen)], text, textLen)
	l += (4 + textLen)
	client.PutString(r[l:l+(4+commitLen)], commit, commitLen)
	l += (4 + commitLen)
	err := i.Context().WriteMsg(r, nil)
	return err
}
func (i *InputMethodContext) PreeditStyling(index, length, style uint32) error {
	const opcode = 3
	const rLen = 8 + 4 + 4 + 4
	r := make([]byte, rLen)
	l := 0
	client.PutUint32(r[l:4], i.ID())
	l += 4
	client.PutUint32(r[l:l+4], uint32(rLen<<16|opcode&0x0000ffff))
	l += 4
	client.PutUint32(r[l:l+4], uint32(index))
	l += 4
	client.PutUint32(r[l:l+4], uint32(length))
	l += 4
	client.PutUint32(r[l:l+4], uint32(style))
	l += 4
	err := i.Context().WriteMsg(r, nil)
	return err
}
func (i *InputMethodContext) PreeditCursor(index int32) error {
	const opcode = 4
	const rLen = 8 + 4
	r := make([]byte, rLen)
	l := 0
	client.PutUint32(r[l:4], i.ID())
	l += 4
	client.PutUint32(r[l:l+4], uint32(rLen<<16|opcode&0x0000ffff))
	l += 4
	client.PutUint32(r[l:l+4], uint32(index))
	l += 4
	err := i.Context().WriteMsg(r, nil)
	return err
}
func (i *InputMethodContext) DeleteSurroundingText(index int32, length uint32) error {
	const opcode = 5
	const rLen = 8 + 4 + 4
	r := make([]byte, rLen)
	l := 0
	client.PutUint32(r[l:4], i.ID())
	l += 4
	client.PutUint32(r[l:l+4], uint32(rLen<<16|opcode&0x0000ffff))
	l += 4
	client.PutUint32(r[l:l+4], uint32(index))
	l += 4
	client.PutUint32(r[l:l+4], uint32(length))
	l += 4
	err := i.Context().WriteMsg(r, nil)
	return err
}
func (i *InputMethodContext) CursorPosition(index, anchor int32) error {
	const opcode = 6
	const rLen = 8 + 4 + 4
	r := make([]byte, rLen)
	l := 0
	client.PutUint32(r[l:4], i.ID())
	l += 4
	client.PutUint32(r[l:l+4], uint32(rLen<<16|opcode&0x0000ffff))
	l += 4
	client.PutUint32(r[l:l+4], uint32(index))
	l += 4
	client.PutUint32(r[l:l+4], uint32(anchor))
	l += 4
	err := i.Context().WriteMsg(r, nil)
	return err
}
func (i *InputMethodContext) ModifiersMap(_map []byte) error {
	const opcode = 7
	_mapLen := len(_map)
	rLen := 8 + _mapLen
	r := make([]byte, rLen)
	l := 0
	client.PutUint32(r[l:4], i.ID())
	l += 4
	client.PutUint32(r[l:l+4], uint32(rLen<<16|opcode&0x0000ffff))
	l += 4
	client.PutArray(r[l:l+(4+_mapLen)], _map)
	l += _mapLen
	err := i.Context().WriteMsg(r, nil)
	return err
}
func (i *InputMethodContext) Keysym(serial, time, sym, state, modifiers uint32) error {
	const opcode = 8
	const rLen = 8 + 4 + 4 + 4 + 4 + 4
	r := make([]byte, rLen)
	l := 0
	client.PutUint32(r[l:4], i.ID())
	l += 4
	client.PutUint32(r[l:l+4], uint32(rLen<<16|opcode&0x0000ffff))
	l += 4
	client.PutUint32(r[l:l+4], uint32(serial))
	l += 4
	client.PutUint32(r[l:l+4], uint32(time))
	l += 4
	client.PutUint32(r[l:l+4], uint32(sym))
	l += 4
	client.PutUint32(r[l:l+4], uint32(state))
	l += 4
	client.PutUint32(r[l:l+4], uint32(modifiers))
	l += 4
	err := i.Context().WriteMsg(r, nil)
	return err
}
func (i *InputMethodContext) GrabKeyboard() (*client.Keyboard, error) {
	keyboard := client.NewKeyboard(i.Context())
	const opcode = 9
	const rLen = 8 + 4
	r := make([]byte, rLen)
	l := 0
	client.PutUint32(r[l:4], i.ID())
	l += 4
	client.PutUint32(r[l:l+4], uint32(rLen<<16|opcode&0x0000ffff))
	l += 4
	client.PutUint32(r[l:l+4], keyboard.ID())
	l += 4
	err := i.Context().WriteMsg(r, nil)
	return keyboard, err
}
func (i *InputMethodContext) Key(serial, time, key, state uint32) error {
	const opcode = 10
	const rLen = 8 + 4 + 4 + 4 + 4
	r := make([]byte, rLen)
	l := 0
	client.PutUint32(r[l:4], i.ID())
	l += 4
	client.PutUint32(r[l:l+4], uint32(rLen<<16|opcode&0x0000ffff))
	l += 4
	client.PutUint32(r[l:l+4], uint32(serial))
	l += 4
	client.PutUint32(r[l:l+4], uint32(time))
	l += 4
	client.PutUint32(r[l:l+4], uint32(key))
	l += 4
	client.PutUint32(r[l:l+4], uint32(state))
	l += 4
	err := i.Context().WriteMsg(r, nil)
	return err
}
func (i *InputMethodContext) Modifiers(serial, modsDepressed, modsLatched, modsLocked, group uint32) error {
	const opcode = 11
	const rLen = 8 + 4 + 4 + 4 + 4 + 4
	r := make([]byte, rLen)
	l := 0
	client.PutUint32(r[l:4], i.ID())
	l += 4
	client.PutUint32(r[l:l+4], uint32(rLen<<16|opcode&0x0000ffff))
	l += 4
	client.PutUint32(r[l:l+4], uint32(serial))
	l += 4
	client.PutUint32(r[l:l+4], uint32(modsDepressed))
	l += 4
	client.PutUint32(r[l:l+4], uint32(modsLatched))
	l += 4
	client.PutUint32(r[l:l+4], uint32(modsLocked))
	l += 4
	client.PutUint32(r[l:l+4], uint32(group))
	l += 4
	err := i.Context().WriteMsg(r, nil)
	return err
}
func (i *InputMethodContext) Language(serial uint32, language string) error {
	const opcode = 12
	languageLen := client.PaddedLen(len(language) + 1)
	rLen := 8 + 4 + (4 + languageLen)
	r := make([]byte, rLen)
	l := 0
	client.PutUint32(r[l:4], i.ID())
	l += 4
	client.PutUint32(r[l:l+4], uint32(rLen<<16|opcode&0x0000ffff))
	l += 4
	client.PutUint32(r[l:l+4], uint32(serial))
	l += 4
	client.PutString(r[l:l+(4+languageLen)], language, languageLen)
	l += (4 + languageLen)
	err := i.Context().WriteMsg(r, nil)
	return err
}
func (i *InputMethodContext) TextDirection(serial, direction uint32) error {
	const opcode = 13
	const rLen = 8 + 4 + 4
	r := make([]byte, rLen)
	l := 0
	client.PutUint32(r[l:4], i.ID())
	l += 4
	client.PutUint32(r[l:l+4], uint32(rLen<<16|opcode&0x0000ffff))
	l += 4
	client.PutUint32(r[l:l+4], uint32(serial))
	l += 4
	client.PutUint32(r[l:l+4], uint32(direction))
	l += 4
	err := i.Context().WriteMsg(r, nil)
	return err
}
type InputMethodContextSurroundingTextEvent struct {
	Text   string
	Cursor uint32
	Anchor uint32
}
type InputMethodContextSurroundingTextHandlerFunc func(InputMethodContextSurroundingTextEvent)
func (i *InputMethodContext) AddSurroundingTextHandler(f InputMethodContextSurroundingTextHandlerFunc) {
	if f == nil {
		return
	}
	i.surroundingTextHandlers = append(i.surroundingTextHandlers, f)
}
func (i *InputMethodContext) RemoveSurroundingTextHandler(f InputMethodContextSurroundingTextHandlerFunc) {
	for j, e := range i.surroundingTextHandlers {
		if reflect.ValueOf(e).Pointer() == reflect.ValueOf(f).Pointer() {
			i.surroundingTextHandlers = append(i.surroundingTextHandlers[:j], i.surroundingTextHandlers[j+1:]...)
			return
		}
	}
}
type InputMethodContextResetEvent struct{}
type InputMethodContextResetHandlerFunc func(InputMethodContextResetEvent)
func (i *InputMethodContext) AddResetHandler(f InputMethodContextResetHandlerFunc) {
	if f == nil {
		return
	}
	i.resetHandlers = append(i.resetHandlers, f)
}
func (i *InputMethodContext) RemoveResetHandler(f InputMethodContextResetHandlerFunc) {
	for j, e := range i.resetHandlers {
		if reflect.ValueOf(e).Pointer() == reflect.ValueOf(f).Pointer() {
			i.resetHandlers = append(i.resetHandlers[:j], i.resetHandlers[j+1:]...)
			return
		}
	}
}
type InputMethodContextContentTypeEvent struct {
	Hint    uint32
	Purpose uint32
}
type InputMethodContextContentTypeHandlerFunc func(InputMethodContextContentTypeEvent)
func (i *InputMethodContext) AddContentTypeHandler(f InputMethodContextContentTypeHandlerFunc) {
	if f == nil {
		return
	}
	i.contentTypeHandlers = append(i.contentTypeHandlers, f)
}
func (i *InputMethodContext) RemoveContentTypeHandler(f InputMethodContextContentTypeHandlerFunc) {
	for j, e := range i.contentTypeHandlers {
		if reflect.ValueOf(e).Pointer() == reflect.ValueOf(f).Pointer() {
			i.contentTypeHandlers = append(i.contentTypeHandlers[:j], i.contentTypeHandlers[j+1:]...)
			return
		}
	}
}
type InputMethodContextInvokeActionEvent struct {
	Button uint32
	Index  uint32
}
type InputMethodContextInvokeActionHandlerFunc func(InputMethodContextInvokeActionEvent)
func (i *InputMethodContext) AddInvokeActionHandler(f InputMethodContextInvokeActionHandlerFunc) {
	if f == nil {
		return
	}
	i.invokeActionHandlers = append(i.invokeActionHandlers, f)
}
func (i *InputMethodContext) RemoveInvokeActionHandler(f InputMethodContextInvokeActionHandlerFunc) {
	for j, e := range i.invokeActionHandlers {
		if reflect.ValueOf(e).Pointer() == reflect.ValueOf(f).Pointer() {
			i.invokeActionHandlers = append(i.invokeActionHandlers[:j], i.invokeActionHandlers[j+1:]...)
			return
		}
	}
}
type InputMethodContextCommitStateEvent struct {
	Serial uint32
}
type InputMethodContextCommitStateHandlerFunc func(InputMethodContextCommitStateEvent)
func (i *InputMethodContext) AddCommitStateHandler(f InputMethodContextCommitStateHandlerFunc) {
	if f == nil {
		return
	}
	i.commitStateHandlers = append(i.commitStateHandlers, f)
}
func (i *InputMethodContext) RemoveCommitStateHandler(f InputMethodContextCommitStateHandlerFunc) {
	for j, e := range i.commitStateHandlers {
		if reflect.ValueOf(e).Pointer() == reflect.ValueOf(f).Pointer() {
			i.commitStateHandlers = append(i.commitStateHandlers[:j], i.commitStateHandlers[j+1:]...)
			return
		}
	}
}
type InputMethodContextPreferredLanguageEvent struct {
	Language string
}
type InputMethodContextPreferredLanguageHandlerFunc func(InputMethodContextPreferredLanguageEvent)