// Code generated by xtgen; DO NOT EDIT. package xproto import "encoding/binary" import "bnema.dev/xturbo" // KindKeyPress identifies KeyPress events in xturbo.Event.Kind. const KindKeyPress = xturbo.EventKind(2) // KeyPressEvent is a view over a KeyPress event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from. type KeyPressEvent struct{ raw *[32]byte } // KeyPressOf views ev as KeyPress without checking ev.Kind: a wrong kind yields garbage, never a panic. func KeyPressOf(ev *xturbo.Event) KeyPressEvent { return KeyPressEvent{raw: &ev.Raw} } func (e KeyPressEvent) Raw() *[32]byte { return e.raw } func (e KeyPressEvent) Detail() Keycode { return Keycode(e.raw[1:][0]) } func (e KeyPressEvent) Time() Timestamp { return Timestamp(binary.LittleEndian.Uint32(e.raw[4:])) } func (e KeyPressEvent) Root() Window { return Window(binary.LittleEndian.Uint32(e.raw[8:])) } func (e KeyPressEvent) Event() Window { return Window(binary.LittleEndian.Uint32(e.raw[12:])) } func (e KeyPressEvent) Child() Window { return Window(binary.LittleEndian.Uint32(e.raw[16:])) } func (e KeyPressEvent) RootX() int16 { return int16(binary.LittleEndian.Uint16(e.raw[20:])) } func (e KeyPressEvent) RootY() int16 { return int16(binary.LittleEndian.Uint16(e.raw[22:])) } func (e KeyPressEvent) EventX() int16 { return int16(binary.LittleEndian.Uint16(e.raw[24:])) } func (e KeyPressEvent) EventY() int16 { return int16(binary.LittleEndian.Uint16(e.raw[26:])) } func (e KeyPressEvent) State() KeyButMask { return KeyButMask(binary.LittleEndian.Uint16(e.raw[28:])) } func (e KeyPressEvent) SameScreen() bool { return (e.raw[30:][0] != 0) } // KeyPressEventData encodes a KeyPress event for SendEvent. type KeyPressEventData struct { Detail Keycode Time Timestamp Root Window Event Window Child Window RootX int16 RootY int16 EventX int16 EventY int16 State KeyButMask SameScreen bool } // Put writes the event (code 2, pads and sequence zeroed) into dst. dst may alias // memory that d's borrowed fields view, such as the Event.Raw they were read from. func (d *KeyPressEventData) Put(dst *[32]byte) { var tmp [32]byte tmp[0] = 2 tmp[1:][0] = byte(d.Detail) binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Time)) binary.LittleEndian.PutUint32(tmp[8:], uint32(d.Root)) binary.LittleEndian.PutUint32(tmp[12:], uint32(d.Event)) binary.LittleEndian.PutUint32(tmp[16:], uint32(d.Child)) binary.LittleEndian.PutUint16(tmp[20:], uint16(d.RootX)) binary.LittleEndian.PutUint16(tmp[22:], uint16(d.RootY)) binary.LittleEndian.PutUint16(tmp[24:], uint16(d.EventX)) binary.LittleEndian.PutUint16(tmp[26:], uint16(d.EventY)) binary.LittleEndian.PutUint16(tmp[28:], uint16(d.State)) if d.SameScreen { tmp[30:][0] = 1 } else { tmp[30:][0] = 0 } *dst = tmp } // KindKeyRelease identifies KeyRelease events in xturbo.Event.Kind. const KindKeyRelease = xturbo.EventKind(3) // KeyReleaseEvent shares KeyPress's layout (eventcopy). type KeyReleaseEvent = KeyPressEvent // KeyReleaseOf views ev as KeyRelease without checking ev.Kind. func KeyReleaseOf(ev *xturbo.Event) KeyReleaseEvent { return KeyPressOf(ev) } // KeyReleaseEventData encodes a KeyRelease event for SendEvent with KeyPress's fields. type KeyReleaseEventData KeyPressEventData // Put writes the event (code 3, pads and sequence zeroed) into dst. func (d *KeyReleaseEventData) Put(dst *[32]byte) { (*KeyPressEventData)(d).Put(dst); dst[0] = 3 } // KindButtonPress identifies ButtonPress events in xturbo.Event.Kind. const KindButtonPress = xturbo.EventKind(4) // ButtonPressEvent is a view over a ButtonPress event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from. type ButtonPressEvent struct{ raw *[32]byte } // ButtonPressOf views ev as ButtonPress without checking ev.Kind: a wrong kind yields garbage, never a panic. func ButtonPressOf(ev *xturbo.Event) ButtonPressEvent { return ButtonPressEvent{raw: &ev.Raw} } func (e ButtonPressEvent) Raw() *[32]byte { return e.raw } func (e ButtonPressEvent) Detail() Button { return Button(e.raw[1:][0]) } func (e ButtonPressEvent) Time() Timestamp { return Timestamp(binary.LittleEndian.Uint32(e.raw[4:])) } func (e ButtonPressEvent) Root() Window { return Window(binary.LittleEndian.Uint32(e.raw[8:])) } func (e ButtonPressEvent) Event() Window { return Window(binary.LittleEndian.Uint32(e.raw[12:])) } func (e ButtonPressEvent) Child() Window { return Window(binary.LittleEndian.Uint32(e.raw[16:])) } func (e ButtonPressEvent) RootX() int16 { return int16(binary.LittleEndian.Uint16(e.raw[20:])) } func (e ButtonPressEvent) RootY() int16 { return int16(binary.LittleEndian.Uint16(e.raw[22:])) } func (e ButtonPressEvent) EventX() int16 { return int16(binary.LittleEndian.Uint16(e.raw[24:])) } func (e ButtonPressEvent) EventY() int16 { return int16(binary.LittleEndian.Uint16(e.raw[26:])) } func (e ButtonPressEvent) State() KeyButMask { return KeyButMask(binary.LittleEndian.Uint16(e.raw[28:])) } func (e ButtonPressEvent) SameScreen() bool { return (e.raw[30:][0] != 0) } // ButtonPressEventData encodes a ButtonPress event for SendEvent. type ButtonPressEventData struct { Detail Button Time Timestamp Root Window Event Window Child Window RootX int16 RootY int16 EventX int16 EventY int16 State KeyButMask SameScreen bool } // Put writes the event (code 4, pads and sequence zeroed) into dst. dst may alias // memory that d's borrowed fields view, such as the Event.Raw they were read from. func (d *ButtonPressEventData) Put(dst *[32]byte) { var tmp [32]byte tmp[0] = 4 tmp[1:][0] = byte(d.Detail) binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Time)) binary.LittleEndian.PutUint32(tmp[8:], uint32(d.Root)) binary.LittleEndian.PutUint32(tmp[12:], uint32(d.Event)) binary.LittleEndian.PutUint32(tmp[16:], uint32(d.Child)) binary.LittleEndian.PutUint16(tmp[20:], uint16(d.RootX)) binary.LittleEndian.PutUint16(tmp[22:], uint16(d.RootY)) binary.LittleEndian.PutUint16(tmp[24:], uint16(d.EventX)) binary.LittleEndian.PutUint16(tmp[26:], uint16(d.EventY)) binary.LittleEndian.PutUint16(tmp[28:], uint16(d.State)) if d.SameScreen { tmp[30:][0] = 1 } else { tmp[30:][0] = 0 } *dst = tmp } // KindButtonRelease identifies ButtonRelease events in xturbo.Event.Kind. const KindButtonRelease = xturbo.EventKind(5) // ButtonReleaseEvent shares ButtonPress's layout (eventcopy). type ButtonReleaseEvent = ButtonPressEvent // ButtonReleaseOf views ev as ButtonRelease without checking ev.Kind. func ButtonReleaseOf(ev *xturbo.Event) ButtonReleaseEvent { return ButtonPressOf(ev) } // ButtonReleaseEventData encodes a ButtonRelease event for SendEvent with ButtonPress's fields. type ButtonReleaseEventData ButtonPressEventData // Put writes the event (code 5, pads and sequence zeroed) into dst. func (d *ButtonReleaseEventData) Put(dst *[32]byte) { (*ButtonPressEventData)(d).Put(dst); dst[0] = 5 } // KindMotionNotify identifies MotionNotify events in xturbo.Event.Kind. const KindMotionNotify = xturbo.EventKind(6) // MotionNotifyEvent is a view over a MotionNotify event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from. type MotionNotifyEvent struct{ raw *[32]byte } // MotionNotifyOf views ev as MotionNotify without checking ev.Kind: a wrong kind yields garbage, never a panic. func MotionNotifyOf(ev *xturbo.Event) MotionNotifyEvent { return MotionNotifyEvent{raw: &ev.Raw} } func (e MotionNotifyEvent) Raw() *[32]byte { return e.raw } func (e MotionNotifyEvent) Detail() Motion { return Motion(e.raw[1:][0]) } func (e MotionNotifyEvent) Time() Timestamp { return Timestamp(binary.LittleEndian.Uint32(e.raw[4:])) } func (e MotionNotifyEvent) Root() Window { return Window(binary.LittleEndian.Uint32(e.raw[8:])) } func (e MotionNotifyEvent) Event() Window { return Window(binary.LittleEndian.Uint32(e.raw[12:])) } func (e MotionNotifyEvent) Child() Window { return Window(binary.LittleEndian.Uint32(e.raw[16:])) } func (e MotionNotifyEvent) RootX() int16 { return int16(binary.LittleEndian.Uint16(e.raw[20:])) } func (e MotionNotifyEvent) RootY() int16 { return int16(binary.LittleEndian.Uint16(e.raw[22:])) } func (e MotionNotifyEvent) EventX() int16 { return int16(binary.LittleEndian.Uint16(e.raw[24:])) } func (e MotionNotifyEvent) EventY() int16 { return int16(binary.LittleEndian.Uint16(e.raw[26:])) } func (e MotionNotifyEvent) State() KeyButMask { return KeyButMask(binary.LittleEndian.Uint16(e.raw[28:])) } func (e MotionNotifyEvent) SameScreen() bool { return (e.raw[30:][0] != 0) } // MotionNotifyEventData encodes a MotionNotify event for SendEvent. type MotionNotifyEventData struct { Detail Motion Time Timestamp Root Window Event Window Child Window RootX int16 RootY int16 EventX int16 EventY int16 State KeyButMask SameScreen bool } // Put writes the event (code 6, pads and sequence zeroed) into dst. dst may alias // memory that d's borrowed fields view, such as the Event.Raw they were read from. func (d *MotionNotifyEventData) Put(dst *[32]byte) { var tmp [32]byte tmp[0] = 6 tmp[1:][0] = byte(d.Detail) binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Time)) binary.LittleEndian.PutUint32(tmp[8:], uint32(d.Root)) binary.LittleEndian.PutUint32(tmp[12:], uint32(d.Event)) binary.LittleEndian.PutUint32(tmp[16:], uint32(d.Child)) binary.LittleEndian.PutUint16(tmp[20:], uint16(d.RootX)) binary.LittleEndian.PutUint16(tmp[22:], uint16(d.RootY)) binary.LittleEndian.PutUint16(tmp[24:], uint16(d.EventX)) binary.LittleEndian.PutUint16(tmp[26:], uint16(d.EventY)) binary.LittleEndian.PutUint16(tmp[28:], uint16(d.State)) if d.SameScreen { tmp[30:][0] = 1 } else { tmp[30:][0] = 0 } *dst = tmp } // KindEnterNotify identifies EnterNotify events in xturbo.Event.Kind. const KindEnterNotify = xturbo.EventKind(7) // EnterNotifyEvent is a view over a EnterNotify event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from. type EnterNotifyEvent struct{ raw *[32]byte } // EnterNotifyOf views ev as EnterNotify without checking ev.Kind: a wrong kind yields garbage, never a panic. func EnterNotifyOf(ev *xturbo.Event) EnterNotifyEvent { return EnterNotifyEvent{raw: &ev.Raw} } func (e EnterNotifyEvent) Raw() *[32]byte { return e.raw } func (e EnterNotifyEvent) Detail() NotifyDetail { return NotifyDetail(e.raw[1:][0]) } func (e EnterNotifyEvent) Time() Timestamp { return Timestamp(binary.LittleEndian.Uint32(e.raw[4:])) } func (e EnterNotifyEvent) Root() Window { return Window(binary.LittleEndian.Uint32(e.raw[8:])) } func (e EnterNotifyEvent) Event() Window { return Window(binary.LittleEndian.Uint32(e.raw[12:])) } func (e EnterNotifyEvent) Child() Window { return Window(binary.LittleEndian.Uint32(e.raw[16:])) } func (e EnterNotifyEvent) RootX() int16 { return int16(binary.LittleEndian.Uint16(e.raw[20:])) } func (e EnterNotifyEvent) RootY() int16 { return int16(binary.LittleEndian.Uint16(e.raw[22:])) } func (e EnterNotifyEvent) EventX() int16 { return int16(binary.LittleEndian.Uint16(e.raw[24:])) } func (e EnterNotifyEvent) EventY() int16 { return int16(binary.LittleEndian.Uint16(e.raw[26:])) } func (e EnterNotifyEvent) State() KeyButMask { return KeyButMask(binary.LittleEndian.Uint16(e.raw[28:])) } func (e EnterNotifyEvent) Mode() NotifyMode { return NotifyMode(e.raw[30:][0]) } func (e EnterNotifyEvent) SameScreenFocus() byte { return byte(e.raw[31:][0]) } // EnterNotifyEventData encodes a EnterNotify event for SendEvent. type EnterNotifyEventData struct { Detail NotifyDetail Time Timestamp Root Window Event Window Child Window RootX int16 RootY int16 EventX int16 EventY int16 State KeyButMask Mode NotifyMode SameScreenFocus byte } // Put writes the event (code 7, pads and sequence zeroed) into dst. dst may alias // memory that d's borrowed fields view, such as the Event.Raw they were read from. func (d *EnterNotifyEventData) Put(dst *[32]byte) { var tmp [32]byte tmp[0] = 7 tmp[1:][0] = byte(d.Detail) binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Time)) binary.LittleEndian.PutUint32(tmp[8:], uint32(d.Root)) binary.LittleEndian.PutUint32(tmp[12:], uint32(d.Event)) binary.LittleEndian.PutUint32(tmp[16:], uint32(d.Child)) binary.LittleEndian.PutUint16(tmp[20:], uint16(d.RootX)) binary.LittleEndian.PutUint16(tmp[22:], uint16(d.RootY)) binary.LittleEndian.PutUint16(tmp[24:], uint16(d.EventX)) binary.LittleEndian.PutUint16(tmp[26:], uint16(d.EventY)) binary.LittleEndian.PutUint16(tmp[28:], uint16(d.State)) tmp[30:][0] = byte(d.Mode) tmp[31:][0] = byte(d.SameScreenFocus) *dst = tmp } // KindLeaveNotify identifies LeaveNotify events in xturbo.Event.Kind. const KindLeaveNotify = xturbo.EventKind(8) // LeaveNotifyEvent shares EnterNotify's layout (eventcopy). type LeaveNotifyEvent = EnterNotifyEvent // LeaveNotifyOf views ev as LeaveNotify without checking ev.Kind. func LeaveNotifyOf(ev *xturbo.Event) LeaveNotifyEvent { return EnterNotifyOf(ev) } // LeaveNotifyEventData encodes a LeaveNotify event for SendEvent with EnterNotify's fields. type LeaveNotifyEventData EnterNotifyEventData // Put writes the event (code 8, pads and sequence zeroed) into dst. func (d *LeaveNotifyEventData) Put(dst *[32]byte) { (*EnterNotifyEventData)(d).Put(dst); dst[0] = 8 } // KindFocusIn identifies FocusIn events in xturbo.Event.Kind. const KindFocusIn = xturbo.EventKind(9) // FocusInEvent is a view over a FocusIn event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from. type FocusInEvent struct{ raw *[32]byte } // FocusInOf views ev as FocusIn without checking ev.Kind: a wrong kind yields garbage, never a panic. func FocusInOf(ev *xturbo.Event) FocusInEvent { return FocusInEvent{raw: &ev.Raw} } func (e FocusInEvent) Raw() *[32]byte { return e.raw } func (e FocusInEvent) Detail() NotifyDetail { return NotifyDetail(e.raw[1:][0]) } func (e FocusInEvent) Event() Window { return Window(binary.LittleEndian.Uint32(e.raw[4:])) } func (e FocusInEvent) Mode() NotifyMode { return NotifyMode(e.raw[8:][0]) } // FocusInEventData encodes a FocusIn event for SendEvent. type FocusInEventData struct { Detail NotifyDetail Event Window Mode NotifyMode } // Put writes the event (code 9, pads and sequence zeroed) into dst. dst may alias // memory that d's borrowed fields view, such as the Event.Raw they were read from. func (d *FocusInEventData) Put(dst *[32]byte) { var tmp [32]byte tmp[0] = 9 tmp[1:][0] = byte(d.Detail) binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Event)) tmp[8:][0] = byte(d.Mode) *dst = tmp } // KindFocusOut identifies FocusOut events in xturbo.Event.Kind. const KindFocusOut = xturbo.EventKind(10) // FocusOutEvent shares FocusIn's layout (eventcopy). type FocusOutEvent = FocusInEvent // FocusOutOf views ev as FocusOut without checking ev.Kind. func FocusOutOf(ev *xturbo.Event) FocusOutEvent { return FocusInOf(ev) } // FocusOutEventData encodes a FocusOut event for SendEvent with FocusIn's fields. type FocusOutEventData FocusInEventData // Put writes the event (code 10, pads and sequence zeroed) into dst. func (d *FocusOutEventData) Put(dst *[32]byte) { (*FocusInEventData)(d).Put(dst); dst[0] = 10 } // KindKeymapNotify identifies KeymapNotify events in xturbo.Event.Kind. const KindKeymapNotify = xturbo.EventKind(11) // KeymapNotifyEvent is a view over a KeymapNotify event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from. type KeymapNotifyEvent struct{ raw *[32]byte } // KeymapNotifyOf views ev as KeymapNotify without checking ev.Kind: a wrong kind yields garbage, never a panic. func KeymapNotifyOf(ev *xturbo.Event) KeymapNotifyEvent { return KeymapNotifyEvent{raw: &ev.Raw} } func (e KeymapNotifyEvent) Raw() *[32]byte { return e.raw } func (e KeymapNotifyEvent) Keys() []byte { off := 1; end := off + 31; return e.raw[off:end:end] } // KeymapNotifyEventData encodes a KeymapNotify event for SendEvent. type KeymapNotifyEventData struct { Keys [31]uint8 } // Put writes the event (code 11, pads and sequence zeroed) into dst. dst may alias // memory that d's borrowed fields view, such as the Event.Raw they were read from. func (d *KeymapNotifyEventData) Put(dst *[32]byte) { var tmp [32]byte tmp[0] = 11 for i := range d.Keys { tmp[1+i*1:][0] = byte(d.Keys[i]) } *dst = tmp } // KindExpose identifies Expose events in xturbo.Event.Kind. const KindExpose = xturbo.EventKind(12) // ExposeEvent is a view over a Expose event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from. type ExposeEvent struct{ raw *[32]byte } // ExposeOf views ev as Expose without checking ev.Kind: a wrong kind yields garbage, never a panic. func ExposeOf(ev *xturbo.Event) ExposeEvent { return ExposeEvent{raw: &ev.Raw} } func (e ExposeEvent) Raw() *[32]byte { return e.raw } func (e ExposeEvent) Window() Window { return Window(binary.LittleEndian.Uint32(e.raw[4:])) } func (e ExposeEvent) X() uint16 { return uint16(binary.LittleEndian.Uint16(e.raw[8:])) } func (e ExposeEvent) Y() uint16 { return uint16(binary.LittleEndian.Uint16(e.raw[10:])) } func (e ExposeEvent) Width() uint16 { return uint16(binary.LittleEndian.Uint16(e.raw[12:])) } func (e ExposeEvent) Height() uint16 { return uint16(binary.LittleEndian.Uint16(e.raw[14:])) } func (e ExposeEvent) Count() uint16 { return uint16(binary.LittleEndian.Uint16(e.raw[16:])) } // ExposeEventData encodes a Expose event for SendEvent. type ExposeEventData struct { Window Window X uint16 Y uint16 Width uint16 Height uint16 Count uint16 } // Put writes the event (code 12, pads and sequence zeroed) into dst. dst may alias // memory that d's borrowed fields view, such as the Event.Raw they were read from. func (d *ExposeEventData) Put(dst *[32]byte) { var tmp [32]byte tmp[0] = 12 binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Window)) binary.LittleEndian.PutUint16(tmp[8:], uint16(d.X)) binary.LittleEndian.PutUint16(tmp[10:], uint16(d.Y)) binary.LittleEndian.PutUint16(tmp[12:], uint16(d.Width)) binary.LittleEndian.PutUint16(tmp[14:], uint16(d.Height)) binary.LittleEndian.PutUint16(tmp[16:], uint16(d.Count)) *dst = tmp } // KindGraphicsExposure identifies GraphicsExposure events in xturbo.Event.Kind. const KindGraphicsExposure = xturbo.EventKind(13) // GraphicsExposureEvent is a view over a GraphicsExposure event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from. type GraphicsExposureEvent struct{ raw *[32]byte } // GraphicsExposureOf views ev as GraphicsExposure without checking ev.Kind: a wrong kind yields garbage, never a panic. func GraphicsExposureOf(ev *xturbo.Event) GraphicsExposureEvent { return GraphicsExposureEvent{raw: &ev.Raw} } func (e GraphicsExposureEvent) Raw() *[32]byte { return e.raw } func (e GraphicsExposureEvent) Drawable() Drawable { return Drawable(binary.LittleEndian.Uint32(e.raw[4:])) } func (e GraphicsExposureEvent) X() uint16 { return uint16(binary.LittleEndian.Uint16(e.raw[8:])) } func (e GraphicsExposureEvent) Y() uint16 { return uint16(binary.LittleEndian.Uint16(e.raw[10:])) } func (e GraphicsExposureEvent) Width() uint16 { return uint16(binary.LittleEndian.Uint16(e.raw[12:])) } func (e GraphicsExposureEvent) Height() uint16 { return uint16(binary.LittleEndian.Uint16(e.raw[14:])) } func (e GraphicsExposureEvent) MinorOpcode() uint16 { return uint16(binary.LittleEndian.Uint16(e.raw[16:])) } func (e GraphicsExposureEvent) Count() uint16 { return uint16(binary.LittleEndian.Uint16(e.raw[18:])) } func (e GraphicsExposureEvent) MajorOpcode() uint8 { return uint8(e.raw[20:][0]) } // GraphicsExposureEventData encodes a GraphicsExposure event for SendEvent. type GraphicsExposureEventData struct { Drawable Drawable X uint16 Y uint16 Width uint16 Height uint16 MinorOpcode uint16 Count uint16 MajorOpcode uint8 } // Put writes the event (code 13, pads and sequence zeroed) into dst. dst may alias // memory that d's borrowed fields view, such as the Event.Raw they were read from. func (d *GraphicsExposureEventData) Put(dst *[32]byte) { var tmp [32]byte tmp[0] = 13 binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Drawable)) binary.LittleEndian.PutUint16(tmp[8:], uint16(d.X)) binary.LittleEndian.PutUint16(tmp[10:], uint16(d.Y)) binary.LittleEndian.PutUint16(tmp[12:], uint16(d.Width)) binary.LittleEndian.PutUint16(tmp[14:], uint16(d.Height)) binary.LittleEndian.PutUint16(tmp[16:], uint16(d.MinorOpcode)) binary.LittleEndian.PutUint16(tmp[18:], uint16(d.Count)) tmp[20:][0] = byte(d.MajorOpcode) *dst = tmp } // KindNoExposure identifies NoExposure events in xturbo.Event.Kind. const KindNoExposure = xturbo.EventKind(14) // NoExposureEvent is a view over a NoExposure event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from. type NoExposureEvent struct{ raw *[32]byte } // NoExposureOf views ev as NoExposure without checking ev.Kind: a wrong kind yields garbage, never a panic. func NoExposureOf(ev *xturbo.Event) NoExposureEvent { return NoExposureEvent{raw: &ev.Raw} } func (e NoExposureEvent) Raw() *[32]byte { return e.raw } func (e NoExposureEvent) Drawable() Drawable { return Drawable(binary.LittleEndian.Uint32(e.raw[4:])) } func (e NoExposureEvent) MinorOpcode() uint16 { return uint16(binary.LittleEndian.Uint16(e.raw[8:])) } func (e NoExposureEvent) MajorOpcode() uint8 { return uint8(e.raw[10:][0]) } // NoExposureEventData encodes a NoExposure event for SendEvent. type NoExposureEventData struct { Drawable Drawable MinorOpcode uint16 MajorOpcode uint8 } // Put writes the event (code 14, pads and sequence zeroed) into dst. dst may alias // memory that d's borrowed fields view, such as the Event.Raw they were read from. func (d *NoExposureEventData) Put(dst *[32]byte) { var tmp [32]byte tmp[0] = 14 binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Drawable)) binary.LittleEndian.PutUint16(tmp[8:], uint16(d.MinorOpcode)) tmp[10:][0] = byte(d.MajorOpcode) *dst = tmp } // KindVisibilityNotify identifies VisibilityNotify events in xturbo.Event.Kind. const KindVisibilityNotify = xturbo.EventKind(15) // VisibilityNotifyEvent is a view over a VisibilityNotify event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from. type VisibilityNotifyEvent struct{ raw *[32]byte } // VisibilityNotifyOf views ev as VisibilityNotify without checking ev.Kind: a wrong kind yields garbage, never a panic. func VisibilityNotifyOf(ev *xturbo.Event) VisibilityNotifyEvent { return VisibilityNotifyEvent{raw: &ev.Raw} } func (e VisibilityNotifyEvent) Raw() *[32]byte { return e.raw } func (e VisibilityNotifyEvent) Window() Window { return Window(binary.LittleEndian.Uint32(e.raw[4:])) } func (e VisibilityNotifyEvent) State() Visibility { return Visibility(e.raw[8:][0]) } // VisibilityNotifyEventData encodes a VisibilityNotify event for SendEvent. type VisibilityNotifyEventData struct { Window Window State Visibility } // Put writes the event (code 15, pads and sequence zeroed) into dst. dst may alias // memory that d's borrowed fields view, such as the Event.Raw they were read from. func (d *VisibilityNotifyEventData) Put(dst *[32]byte) { var tmp [32]byte tmp[0] = 15 binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Window)) tmp[8:][0] = byte(d.State) *dst = tmp } // KindCreateNotify identifies CreateNotify events in xturbo.Event.Kind. const KindCreateNotify = xturbo.EventKind(16) // CreateNotifyEvent is a view over a CreateNotify event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from. type CreateNotifyEvent struct{ raw *[32]byte } // CreateNotifyOf views ev as CreateNotify without checking ev.Kind: a wrong kind yields garbage, never a panic. func CreateNotifyOf(ev *xturbo.Event) CreateNotifyEvent { return CreateNotifyEvent{raw: &ev.Raw} } func (e CreateNotifyEvent) Raw() *[32]byte { return e.raw } func (e CreateNotifyEvent) Parent() Window { return Window(binary.LittleEndian.Uint32(e.raw[4:])) } func (e CreateNotifyEvent) Window() Window { return Window(binary.LittleEndian.Uint32(e.raw[8:])) } func (e CreateNotifyEvent) X() int16 { return int16(binary.LittleEndian.Uint16(e.raw[12:])) } func (e CreateNotifyEvent) Y() int16 { return int16(binary.LittleEndian.Uint16(e.raw[14:])) } func (e CreateNotifyEvent) Width() uint16 { return uint16(binary.LittleEndian.Uint16(e.raw[16:])) } func (e CreateNotifyEvent) Height() uint16 { return uint16(binary.LittleEndian.Uint16(e.raw[18:])) } func (e CreateNotifyEvent) BorderWidth() uint16 { return uint16(binary.LittleEndian.Uint16(e.raw[20:])) } func (e CreateNotifyEvent) OverrideRedirect() bool { return (e.raw[22:][0] != 0) } // CreateNotifyEventData encodes a CreateNotify event for SendEvent. type CreateNotifyEventData struct { Parent Window Window Window X int16 Y int16 Width uint16 Height uint16 BorderWidth uint16 OverrideRedirect bool } // Put writes the event (code 16, pads and sequence zeroed) into dst. dst may alias // memory that d's borrowed fields view, such as the Event.Raw they were read from. func (d *CreateNotifyEventData) Put(dst *[32]byte) { var tmp [32]byte tmp[0] = 16 binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Parent)) binary.LittleEndian.PutUint32(tmp[8:], uint32(d.Window)) binary.LittleEndian.PutUint16(tmp[12:], uint16(d.X)) binary.LittleEndian.PutUint16(tmp[14:], uint16(d.Y)) binary.LittleEndian.PutUint16(tmp[16:], uint16(d.Width)) binary.LittleEndian.PutUint16(tmp[18:], uint16(d.Height)) binary.LittleEndian.PutUint16(tmp[20:], uint16(d.BorderWidth)) if d.OverrideRedirect { tmp[22:][0] = 1 } else { tmp[22:][0] = 0 } *dst = tmp } // KindDestroyNotify identifies DestroyNotify events in xturbo.Event.Kind. const KindDestroyNotify = xturbo.EventKind(17) // DestroyNotifyEvent is a view over a DestroyNotify event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from. type DestroyNotifyEvent struct{ raw *[32]byte } // DestroyNotifyOf views ev as DestroyNotify without checking ev.Kind: a wrong kind yields garbage, never a panic. func DestroyNotifyOf(ev *xturbo.Event) DestroyNotifyEvent { return DestroyNotifyEvent{raw: &ev.Raw} } func (e DestroyNotifyEvent) Raw() *[32]byte { return e.raw } func (e DestroyNotifyEvent) Event() Window { return Window(binary.LittleEndian.Uint32(e.raw[4:])) } func (e DestroyNotifyEvent) Window() Window { return Window(binary.LittleEndian.Uint32(e.raw[8:])) } // DestroyNotifyEventData encodes a DestroyNotify event for SendEvent. type DestroyNotifyEventData struct { Event Window Window Window } // Put writes the event (code 17, pads and sequence zeroed) into dst. dst may alias // memory that d's borrowed fields view, such as the Event.Raw they were read from. func (d *DestroyNotifyEventData) Put(dst *[32]byte) { var tmp [32]byte tmp[0] = 17 binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Event)) binary.LittleEndian.PutUint32(tmp[8:], uint32(d.Window)) *dst = tmp } // KindUnmapNotify identifies UnmapNotify events in xturbo.Event.Kind. const KindUnmapNotify = xturbo.EventKind(18) // UnmapNotifyEvent is a view over a UnmapNotify event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from. type UnmapNotifyEvent struct{ raw *[32]byte } // UnmapNotifyOf views ev as UnmapNotify without checking ev.Kind: a wrong kind yields garbage, never a panic. func UnmapNotifyOf(ev *xturbo.Event) UnmapNotifyEvent { return UnmapNotifyEvent{raw: &ev.Raw} } func (e UnmapNotifyEvent) Raw() *[32]byte { return e.raw } func (e UnmapNotifyEvent) Event() Window { return Window(binary.LittleEndian.Uint32(e.raw[4:])) } func (e UnmapNotifyEvent) Window() Window { return Window(binary.LittleEndian.Uint32(e.raw[8:])) } func (e UnmapNotifyEvent) FromConfigure() bool { return (e.raw[12:][0] != 0) } // UnmapNotifyEventData encodes a UnmapNotify event for SendEvent. type UnmapNotifyEventData struct { Event Window Window Window FromConfigure bool } // Put writes the event (code 18, pads and sequence zeroed) into dst. dst may alias // memory that d's borrowed fields view, such as the Event.Raw they were read from. func (d *UnmapNotifyEventData) Put(dst *[32]byte) { var tmp [32]byte tmp[0] = 18 binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Event)) binary.LittleEndian.PutUint32(tmp[8:], uint32(d.Window)) if d.FromConfigure { tmp[12:][0] = 1 } else { tmp[12:][0] = 0 } *dst = tmp } // KindMapNotify identifies MapNotify events in xturbo.Event.Kind. const KindMapNotify = xturbo.EventKind(19) // MapNotifyEvent is a view over a MapNotify event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from. type MapNotifyEvent struct{ raw *[32]byte } // MapNotifyOf views ev as MapNotify without checking ev.Kind: a wrong kind yields garbage, never a panic. func MapNotifyOf(ev *xturbo.Event) MapNotifyEvent { return MapNotifyEvent{raw: &ev.Raw} } func (e MapNotifyEvent) Raw() *[32]byte { return e.raw } func (e MapNotifyEvent) Event() Window { return Window(binary.LittleEndian.Uint32(e.raw[4:])) } func (e MapNotifyEvent) Window() Window { return Window(binary.LittleEndian.Uint32(e.raw[8:])) } func (e MapNotifyEvent) OverrideRedirect() bool { return (e.raw[12:][0] != 0) } // MapNotifyEventData encodes a MapNotify event for SendEvent. type MapNotifyEventData struct { Event Window Window Window OverrideRedirect bool } // Put writes the event (code 19, pads and sequence zeroed) into dst. dst may alias // memory that d's borrowed fields view, such as the Event.Raw they were read from. func (d *MapNotifyEventData) Put(dst *[32]byte) { var tmp [32]byte tmp[0] = 19 binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Event)) binary.LittleEndian.PutUint32(tmp[8:], uint32(d.Window)) if d.OverrideRedirect { tmp[12:][0] = 1 } else { tmp[12:][0] = 0 } *dst = tmp } // KindMapRequest identifies MapRequest events in xturbo.Event.Kind. const KindMapRequest = xturbo.EventKind(20) // MapRequestEvent is a view over a MapRequest event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from. type MapRequestEvent struct{ raw *[32]byte } // MapRequestOf views ev as MapRequest without checking ev.Kind: a wrong kind yields garbage, never a panic. func MapRequestOf(ev *xturbo.Event) MapRequestEvent { return MapRequestEvent{raw: &ev.Raw} } func (e MapRequestEvent) Raw() *[32]byte { return e.raw } func (e MapRequestEvent) Parent() Window { return Window(binary.LittleEndian.Uint32(e.raw[4:])) } func (e MapRequestEvent) Window() Window { return Window(binary.LittleEndian.Uint32(e.raw[8:])) } // MapRequestEventData encodes a MapRequest event for SendEvent. type MapRequestEventData struct { Parent Window Window Window } // Put writes the event (code 20, pads and sequence zeroed) into dst. dst may alias // memory that d's borrowed fields view, such as the Event.Raw they were read from. func (d *MapRequestEventData) Put(dst *[32]byte) { var tmp [32]byte tmp[0] = 20 binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Parent)) binary.LittleEndian.PutUint32(tmp[8:], uint32(d.Window)) *dst = tmp } // KindReparentNotify identifies ReparentNotify events in xturbo.Event.Kind. const KindReparentNotify = xturbo.EventKind(21) // ReparentNotifyEvent is a view over a ReparentNotify event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from. type ReparentNotifyEvent struct{ raw *[32]byte } // ReparentNotifyOf views ev as ReparentNotify without checking ev.Kind: a wrong kind yields garbage, never a panic. func ReparentNotifyOf(ev *xturbo.Event) ReparentNotifyEvent { return ReparentNotifyEvent{raw: &ev.Raw} } func (e ReparentNotifyEvent) Raw() *[32]byte { return e.raw } func (e ReparentNotifyEvent) Event() Window { return Window(binary.LittleEndian.Uint32(e.raw[4:])) } func (e ReparentNotifyEvent) Window() Window { return Window(binary.LittleEndian.Uint32(e.raw[8:])) } func (e ReparentNotifyEvent) Parent() Window { return Window(binary.LittleEndian.Uint32(e.raw[12:])) } func (e ReparentNotifyEvent) X() int16 { return int16(binary.LittleEndian.Uint16(e.raw[16:])) } func (e ReparentNotifyEvent) Y() int16 { return int16(binary.LittleEndian.Uint16(e.raw[18:])) } func (e ReparentNotifyEvent) OverrideRedirect() bool { return (e.raw[20:][0] != 0) } // ReparentNotifyEventData encodes a ReparentNotify event for SendEvent. type ReparentNotifyEventData struct { Event Window Window Window Parent Window X int16 Y int16 OverrideRedirect bool } // Put writes the event (code 21, pads and sequence zeroed) into dst. dst may alias // memory that d's borrowed fields view, such as the Event.Raw they were read from. func (d *ReparentNotifyEventData) Put(dst *[32]byte) { var tmp [32]byte tmp[0] = 21 binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Event)) binary.LittleEndian.PutUint32(tmp[8:], uint32(d.Window)) binary.LittleEndian.PutUint32(tmp[12:], uint32(d.Parent)) binary.LittleEndian.PutUint16(tmp[16:], uint16(d.X)) binary.LittleEndian.PutUint16(tmp[18:], uint16(d.Y)) if d.OverrideRedirect { tmp[20:][0] = 1 } else { tmp[20:][0] = 0 } *dst = tmp } // KindConfigureNotify identifies ConfigureNotify events in xturbo.Event.Kind. const KindConfigureNotify = xturbo.EventKind(22) // ConfigureNotifyEvent is a view over a ConfigureNotify event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from. type ConfigureNotifyEvent struct{ raw *[32]byte } // ConfigureNotifyOf views ev as ConfigureNotify without checking ev.Kind: a wrong kind yields garbage, never a panic. func ConfigureNotifyOf(ev *xturbo.Event) ConfigureNotifyEvent { return ConfigureNotifyEvent{raw: &ev.Raw} } func (e ConfigureNotifyEvent) Raw() *[32]byte { return e.raw } func (e ConfigureNotifyEvent) Event() Window { return Window(binary.LittleEndian.Uint32(e.raw[4:])) } func (e ConfigureNotifyEvent) Window() Window { return Window(binary.LittleEndian.Uint32(e.raw[8:])) } func (e ConfigureNotifyEvent) AboveSibling() Window { return Window(binary.LittleEndian.Uint32(e.raw[12:])) } func (e ConfigureNotifyEvent) X() int16 { return int16(binary.LittleEndian.Uint16(e.raw[16:])) } func (e ConfigureNotifyEvent) Y() int16 { return int16(binary.LittleEndian.Uint16(e.raw[18:])) } func (e ConfigureNotifyEvent) Width() uint16 { return uint16(binary.LittleEndian.Uint16(e.raw[20:])) } func (e ConfigureNotifyEvent) Height() uint16 { return uint16(binary.LittleEndian.Uint16(e.raw[22:])) } func (e ConfigureNotifyEvent) BorderWidth() uint16 { return uint16(binary.LittleEndian.Uint16(e.raw[24:])) } func (e ConfigureNotifyEvent) OverrideRedirect() bool { return (e.raw[26:][0] != 0) } // ConfigureNotifyEventData encodes a ConfigureNotify event for SendEvent. type ConfigureNotifyEventData struct { Event Window Window Window AboveSibling Window X int16 Y int16 Width uint16 Height uint16 BorderWidth uint16 OverrideRedirect bool } // Put writes the event (code 22, pads and sequence zeroed) into dst. dst may alias // memory that d's borrowed fields view, such as the Event.Raw they were read from. func (d *ConfigureNotifyEventData) Put(dst *[32]byte) { var tmp [32]byte tmp[0] = 22 binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Event)) binary.LittleEndian.PutUint32(tmp[8:], uint32(d.Window)) binary.LittleEndian.PutUint32(tmp[12:], uint32(d.AboveSibling)) binary.LittleEndian.PutUint16(tmp[16:], uint16(d.X)) binary.LittleEndian.PutUint16(tmp[18:], uint16(d.Y)) binary.LittleEndian.PutUint16(tmp[20:], uint16(d.Width)) binary.LittleEndian.PutUint16(tmp[22:], uint16(d.Height)) binary.LittleEndian.PutUint16(tmp[24:], uint16(d.BorderWidth)) if d.OverrideRedirect { tmp[26:][0] = 1 } else { tmp[26:][0] = 0 } *dst = tmp } // KindConfigureRequest identifies ConfigureRequest events in xturbo.Event.Kind. const KindConfigureRequest = xturbo.EventKind(23) // ConfigureRequestEvent is a view over a ConfigureRequest event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from. type ConfigureRequestEvent struct{ raw *[32]byte } // ConfigureRequestOf views ev as ConfigureRequest without checking ev.Kind: a wrong kind yields garbage, never a panic. func ConfigureRequestOf(ev *xturbo.Event) ConfigureRequestEvent { return ConfigureRequestEvent{raw: &ev.Raw} } func (e ConfigureRequestEvent) Raw() *[32]byte { return e.raw } func (e ConfigureRequestEvent) StackMode() StackMode { return StackMode(e.raw[1:][0]) } func (e ConfigureRequestEvent) Parent() Window { return Window(binary.LittleEndian.Uint32(e.raw[4:])) } func (e ConfigureRequestEvent) Window() Window { return Window(binary.LittleEndian.Uint32(e.raw[8:])) } func (e ConfigureRequestEvent) Sibling() Window { return Window(binary.LittleEndian.Uint32(e.raw[12:])) } func (e ConfigureRequestEvent) X() int16 { return int16(binary.LittleEndian.Uint16(e.raw[16:])) } func (e ConfigureRequestEvent) Y() int16 { return int16(binary.LittleEndian.Uint16(e.raw[18:])) } func (e ConfigureRequestEvent) Width() uint16 { return uint16(binary.LittleEndian.Uint16(e.raw[20:])) } func (e ConfigureRequestEvent) Height() uint16 { return uint16(binary.LittleEndian.Uint16(e.raw[22:])) } func (e ConfigureRequestEvent) BorderWidth() uint16 { return uint16(binary.LittleEndian.Uint16(e.raw[24:])) } func (e ConfigureRequestEvent) ValueMask() ConfigWindow { return ConfigWindow(binary.LittleEndian.Uint16(e.raw[26:])) } // ConfigureRequestEventData encodes a ConfigureRequest event for SendEvent. type ConfigureRequestEventData struct { StackMode StackMode Parent Window Window Window Sibling Window X int16 Y int16 Width uint16 Height uint16 BorderWidth uint16 ValueMask ConfigWindow } // Put writes the event (code 23, pads and sequence zeroed) into dst. dst may alias // memory that d's borrowed fields view, such as the Event.Raw they were read from. func (d *ConfigureRequestEventData) Put(dst *[32]byte) { var tmp [32]byte tmp[0] = 23 tmp[1:][0] = byte(d.StackMode) binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Parent)) binary.LittleEndian.PutUint32(tmp[8:], uint32(d.Window)) binary.LittleEndian.PutUint32(tmp[12:], uint32(d.Sibling)) binary.LittleEndian.PutUint16(tmp[16:], uint16(d.X)) binary.LittleEndian.PutUint16(tmp[18:], uint16(d.Y)) binary.LittleEndian.PutUint16(tmp[20:], uint16(d.Width)) binary.LittleEndian.PutUint16(tmp[22:], uint16(d.Height)) binary.LittleEndian.PutUint16(tmp[24:], uint16(d.BorderWidth)) binary.LittleEndian.PutUint16(tmp[26:], uint16(d.ValueMask)) *dst = tmp } // KindGravityNotify identifies GravityNotify events in xturbo.Event.Kind. const KindGravityNotify = xturbo.EventKind(24) // GravityNotifyEvent is a view over a GravityNotify event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from. type GravityNotifyEvent struct{ raw *[32]byte } // GravityNotifyOf views ev as GravityNotify without checking ev.Kind: a wrong kind yields garbage, never a panic. func GravityNotifyOf(ev *xturbo.Event) GravityNotifyEvent { return GravityNotifyEvent{raw: &ev.Raw} } func (e GravityNotifyEvent) Raw() *[32]byte { return e.raw } func (e GravityNotifyEvent) Event() Window { return Window(binary.LittleEndian.Uint32(e.raw[4:])) } func (e GravityNotifyEvent) Window() Window { return Window(binary.LittleEndian.Uint32(e.raw[8:])) } func (e GravityNotifyEvent) X() int16 { return int16(binary.LittleEndian.Uint16(e.raw[12:])) } func (e GravityNotifyEvent) Y() int16 { return int16(binary.LittleEndian.Uint16(e.raw[14:])) } // GravityNotifyEventData encodes a GravityNotify event for SendEvent. type GravityNotifyEventData struct { Event Window Window Window X int16 Y int16 } // Put writes the event (code 24, pads and sequence zeroed) into dst. dst may alias // memory that d's borrowed fields view, such as the Event.Raw they were read from. func (d *GravityNotifyEventData) Put(dst *[32]byte) { var tmp [32]byte tmp[0] = 24 binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Event)) binary.LittleEndian.PutUint32(tmp[8:], uint32(d.Window)) binary.LittleEndian.PutUint16(tmp[12:], uint16(d.X)) binary.LittleEndian.PutUint16(tmp[14:], uint16(d.Y)) *dst = tmp } // KindResizeRequest identifies ResizeRequest events in xturbo.Event.Kind. const KindResizeRequest = xturbo.EventKind(25) // ResizeRequestEvent is a view over a ResizeRequest event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from. type ResizeRequestEvent struct{ raw *[32]byte } // ResizeRequestOf views ev as ResizeRequest without checking ev.Kind: a wrong kind yields garbage, never a panic. func ResizeRequestOf(ev *xturbo.Event) ResizeRequestEvent { return ResizeRequestEvent{raw: &ev.Raw} } func (e ResizeRequestEvent) Raw() *[32]byte { return e.raw } func (e ResizeRequestEvent) Window() Window { return Window(binary.LittleEndian.Uint32(e.raw[4:])) } func (e ResizeRequestEvent) Width() uint16 { return uint16(binary.LittleEndian.Uint16(e.raw[8:])) } func (e ResizeRequestEvent) Height() uint16 { return uint16(binary.LittleEndian.Uint16(e.raw[10:])) } // ResizeRequestEventData encodes a ResizeRequest event for SendEvent. type ResizeRequestEventData struct { Window Window Width uint16 Height uint16 } // Put writes the event (code 25, pads and sequence zeroed) into dst. dst may alias // memory that d's borrowed fields view, such as the Event.Raw they were read from. func (d *ResizeRequestEventData) Put(dst *[32]byte) { var tmp [32]byte tmp[0] = 25 binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Window)) binary.LittleEndian.PutUint16(tmp[8:], uint16(d.Width)) binary.LittleEndian.PutUint16(tmp[10:], uint16(d.Height)) *dst = tmp } // KindCirculateNotify identifies CirculateNotify events in xturbo.Event.Kind. const KindCirculateNotify = xturbo.EventKind(26) // CirculateNotifyEvent is a view over a CirculateNotify event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from. type CirculateNotifyEvent struct{ raw *[32]byte } // CirculateNotifyOf views ev as CirculateNotify without checking ev.Kind: a wrong kind yields garbage, never a panic. func CirculateNotifyOf(ev *xturbo.Event) CirculateNotifyEvent { return CirculateNotifyEvent{raw: &ev.Raw} } func (e CirculateNotifyEvent) Raw() *[32]byte { return e.raw } func (e CirculateNotifyEvent) Event() Window { return Window(binary.LittleEndian.Uint32(e.raw[4:])) } func (e CirculateNotifyEvent) Window() Window { return Window(binary.LittleEndian.Uint32(e.raw[8:])) } func (e CirculateNotifyEvent) Place() Place { return Place(e.raw[16:][0]) } // CirculateNotifyEventData encodes a CirculateNotify event for SendEvent. type CirculateNotifyEventData struct { Event Window Window Window Place Place } // Put writes the event (code 26, pads and sequence zeroed) into dst. dst may alias // memory that d's borrowed fields view, such as the Event.Raw they were read from. func (d *CirculateNotifyEventData) Put(dst *[32]byte) { var tmp [32]byte tmp[0] = 26 binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Event)) binary.LittleEndian.PutUint32(tmp[8:], uint32(d.Window)) tmp[16:][0] = byte(d.Place) *dst = tmp } // KindCirculateRequest identifies CirculateRequest events in xturbo.Event.Kind. const KindCirculateRequest = xturbo.EventKind(27) // CirculateRequestEvent shares CirculateNotify's layout (eventcopy). type CirculateRequestEvent = CirculateNotifyEvent // CirculateRequestOf views ev as CirculateRequest without checking ev.Kind. func CirculateRequestOf(ev *xturbo.Event) CirculateRequestEvent { return CirculateNotifyOf(ev) } // CirculateRequestEventData encodes a CirculateRequest event for SendEvent with CirculateNotify's fields. type CirculateRequestEventData CirculateNotifyEventData // Put writes the event (code 27, pads and sequence zeroed) into dst. func (d *CirculateRequestEventData) Put(dst *[32]byte) { (*CirculateNotifyEventData)(d).Put(dst) dst[0] = 27 } // KindPropertyNotify identifies PropertyNotify events in xturbo.Event.Kind. const KindPropertyNotify = xturbo.EventKind(28) // PropertyNotifyEvent is a view over a PropertyNotify event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from. type PropertyNotifyEvent struct{ raw *[32]byte } // PropertyNotifyOf views ev as PropertyNotify without checking ev.Kind: a wrong kind yields garbage, never a panic. func PropertyNotifyOf(ev *xturbo.Event) PropertyNotifyEvent { return PropertyNotifyEvent{raw: &ev.Raw} } func (e PropertyNotifyEvent) Raw() *[32]byte { return e.raw } func (e PropertyNotifyEvent) Window() Window { return Window(binary.LittleEndian.Uint32(e.raw[4:])) } func (e PropertyNotifyEvent) Atom() Atom { return Atom(binary.LittleEndian.Uint32(e.raw[8:])) } func (e PropertyNotifyEvent) Time() Timestamp { return Timestamp(binary.LittleEndian.Uint32(e.raw[12:])) } func (e PropertyNotifyEvent) State() Property { return Property(e.raw[16:][0]) } // PropertyNotifyEventData encodes a PropertyNotify event for SendEvent. type PropertyNotifyEventData struct { Window Window Atom Atom Time Timestamp State Property } // Put writes the event (code 28, pads and sequence zeroed) into dst. dst may alias // memory that d's borrowed fields view, such as the Event.Raw they were read from. func (d *PropertyNotifyEventData) Put(dst *[32]byte) { var tmp [32]byte tmp[0] = 28 binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Window)) binary.LittleEndian.PutUint32(tmp[8:], uint32(d.Atom)) binary.LittleEndian.PutUint32(tmp[12:], uint32(d.Time)) tmp[16:][0] = byte(d.State) *dst = tmp } // KindSelectionClear identifies SelectionClear events in xturbo.Event.Kind. const KindSelectionClear = xturbo.EventKind(29) // SelectionClearEvent is a view over a SelectionClear event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from. type SelectionClearEvent struct{ raw *[32]byte } // SelectionClearOf views ev as SelectionClear without checking ev.Kind: a wrong kind yields garbage, never a panic. func SelectionClearOf(ev *xturbo.Event) SelectionClearEvent { return SelectionClearEvent{raw: &ev.Raw} } func (e SelectionClearEvent) Raw() *[32]byte { return e.raw } func (e SelectionClearEvent) Time() Timestamp { return Timestamp(binary.LittleEndian.Uint32(e.raw[4:])) } func (e SelectionClearEvent) Owner() Window { return Window(binary.LittleEndian.Uint32(e.raw[8:])) } func (e SelectionClearEvent) Selection() Atom { return Atom(binary.LittleEndian.Uint32(e.raw[12:])) } // SelectionClearEventData encodes a SelectionClear event for SendEvent. type SelectionClearEventData struct { Time Timestamp Owner Window Selection Atom } // Put writes the event (code 29, pads and sequence zeroed) into dst. dst may alias // memory that d's borrowed fields view, such as the Event.Raw they were read from. func (d *SelectionClearEventData) Put(dst *[32]byte) { var tmp [32]byte tmp[0] = 29 binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Time)) binary.LittleEndian.PutUint32(tmp[8:], uint32(d.Owner)) binary.LittleEndian.PutUint32(tmp[12:], uint32(d.Selection)) *dst = tmp } // KindSelectionRequest identifies SelectionRequest events in xturbo.Event.Kind. const KindSelectionRequest = xturbo.EventKind(30) // SelectionRequestEvent is a view over a SelectionRequest event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from. type SelectionRequestEvent struct{ raw *[32]byte } // SelectionRequestOf views ev as SelectionRequest without checking ev.Kind: a wrong kind yields garbage, never a panic. func SelectionRequestOf(ev *xturbo.Event) SelectionRequestEvent { return SelectionRequestEvent{raw: &ev.Raw} } func (e SelectionRequestEvent) Raw() *[32]byte { return e.raw } func (e SelectionRequestEvent) Time() Timestamp { return Timestamp(binary.LittleEndian.Uint32(e.raw[4:])) } func (e SelectionRequestEvent) Owner() Window { return Window(binary.LittleEndian.Uint32(e.raw[8:])) } func (e SelectionRequestEvent) Requestor() Window { return Window(binary.LittleEndian.Uint32(e.raw[12:])) } func (e SelectionRequestEvent) Selection() Atom { return Atom(binary.LittleEndian.Uint32(e.raw[16:])) } func (e SelectionRequestEvent) Target() Atom { return Atom(binary.LittleEndian.Uint32(e.raw[20:])) } func (e SelectionRequestEvent) Property() Atom { return Atom(binary.LittleEndian.Uint32(e.raw[24:])) } // SelectionRequestEventData encodes a SelectionRequest event for SendEvent. type SelectionRequestEventData struct { Time Timestamp Owner Window Requestor Window Selection Atom Target Atom Property Atom } // Put writes the event (code 30, pads and sequence zeroed) into dst. dst may alias // memory that d's borrowed fields view, such as the Event.Raw they were read from. func (d *SelectionRequestEventData) Put(dst *[32]byte) { var tmp [32]byte tmp[0] = 30 binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Time)) binary.LittleEndian.PutUint32(tmp[8:], uint32(d.Owner)) binary.LittleEndian.PutUint32(tmp[12:], uint32(d.Requestor)) binary.LittleEndian.PutUint32(tmp[16:], uint32(d.Selection)) binary.LittleEndian.PutUint32(tmp[20:], uint32(d.Target)) binary.LittleEndian.PutUint32(tmp[24:], uint32(d.Property)) *dst = tmp } // KindSelectionNotify identifies SelectionNotify events in xturbo.Event.Kind. const KindSelectionNotify = xturbo.EventKind(31) // SelectionNotifyEvent is a view over a SelectionNotify event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from. type SelectionNotifyEvent struct{ raw *[32]byte } // SelectionNotifyOf views ev as SelectionNotify without checking ev.Kind: a wrong kind yields garbage, never a panic. func SelectionNotifyOf(ev *xturbo.Event) SelectionNotifyEvent { return SelectionNotifyEvent{raw: &ev.Raw} } func (e SelectionNotifyEvent) Raw() *[32]byte { return e.raw } func (e SelectionNotifyEvent) Time() Timestamp { return Timestamp(binary.LittleEndian.Uint32(e.raw[4:])) } func (e SelectionNotifyEvent) Requestor() Window { return Window(binary.LittleEndian.Uint32(e.raw[8:])) } func (e SelectionNotifyEvent) Selection() Atom { return Atom(binary.LittleEndian.Uint32(e.raw[12:])) } func (e SelectionNotifyEvent) Target() Atom { return Atom(binary.LittleEndian.Uint32(e.raw[16:])) } func (e SelectionNotifyEvent) Property() Atom { return Atom(binary.LittleEndian.Uint32(e.raw[20:])) } // SelectionNotifyEventData encodes a SelectionNotify event for SendEvent. type SelectionNotifyEventData struct { Time Timestamp Requestor Window Selection Atom Target Atom Property Atom } // Put writes the event (code 31, pads and sequence zeroed) into dst. dst may alias // memory that d's borrowed fields view, such as the Event.Raw they were read from. func (d *SelectionNotifyEventData) Put(dst *[32]byte) { var tmp [32]byte tmp[0] = 31 binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Time)) binary.LittleEndian.PutUint32(tmp[8:], uint32(d.Requestor)) binary.LittleEndian.PutUint32(tmp[12:], uint32(d.Selection)) binary.LittleEndian.PutUint32(tmp[16:], uint32(d.Target)) binary.LittleEndian.PutUint32(tmp[20:], uint32(d.Property)) *dst = tmp } // KindColormapNotify identifies ColormapNotify events in xturbo.Event.Kind. const KindColormapNotify = xturbo.EventKind(32) // ColormapNotifyEvent is a view over a ColormapNotify event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from. type ColormapNotifyEvent struct{ raw *[32]byte } // ColormapNotifyOf views ev as ColormapNotify without checking ev.Kind: a wrong kind yields garbage, never a panic. func ColormapNotifyOf(ev *xturbo.Event) ColormapNotifyEvent { return ColormapNotifyEvent{raw: &ev.Raw} } func (e ColormapNotifyEvent) Raw() *[32]byte { return e.raw } func (e ColormapNotifyEvent) Window() Window { return Window(binary.LittleEndian.Uint32(e.raw[4:])) } func (e ColormapNotifyEvent) Colormap() Colormap { return Colormap(binary.LittleEndian.Uint32(e.raw[8:])) } func (e ColormapNotifyEvent) New() bool { return (e.raw[12:][0] != 0) } func (e ColormapNotifyEvent) State() ColormapState { return ColormapState(e.raw[13:][0]) } // ColormapNotifyEventData encodes a ColormapNotify event for SendEvent. type ColormapNotifyEventData struct { Window Window Colormap Colormap New bool State ColormapState } // Put writes the event (code 32, pads and sequence zeroed) into dst. dst may alias // memory that d's borrowed fields view, such as the Event.Raw they were read from. func (d *ColormapNotifyEventData) Put(dst *[32]byte) { var tmp [32]byte tmp[0] = 32 binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Window)) binary.LittleEndian.PutUint32(tmp[8:], uint32(d.Colormap)) if d.New { tmp[12:][0] = 1 } else { tmp[12:][0] = 0 } tmp[13:][0] = byte(d.State) *dst = tmp } // KindClientMessage identifies ClientMessage events in xturbo.Event.Kind. const KindClientMessage = xturbo.EventKind(33) // ClientMessageEvent is a view over a ClientMessage event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from. type ClientMessageEvent struct{ raw *[32]byte } // ClientMessageOf views ev as ClientMessage without checking ev.Kind: a wrong kind yields garbage, never a panic. func ClientMessageOf(ev *xturbo.Event) ClientMessageEvent { return ClientMessageEvent{raw: &ev.Raw} } func (e ClientMessageEvent) Raw() *[32]byte { return e.raw } func (e ClientMessageEvent) Format() uint8 { return uint8(e.raw[1:][0]) } func (e ClientMessageEvent) Window() Window { return Window(binary.LittleEndian.Uint32(e.raw[4:])) } func (e ClientMessageEvent) Type() Atom { return Atom(binary.LittleEndian.Uint32(e.raw[8:])) } func (e ClientMessageEvent) Data() ClientMessageData { return GetClientMessageData(e.raw[12:]) } // ClientMessageEventData encodes a ClientMessage event for SendEvent. type ClientMessageEventData struct { Format uint8 Window Window Type Atom Data ClientMessageData } // Put writes the event (code 33, pads and sequence zeroed) into dst. dst may alias // memory that d's borrowed fields view, such as the Event.Raw they were read from. func (d *ClientMessageEventData) Put(dst *[32]byte) { var tmp [32]byte tmp[0] = 33 tmp[1:][0] = byte(d.Format) binary.LittleEndian.PutUint32(tmp[4:], uint32(d.Window)) binary.LittleEndian.PutUint32(tmp[8:], uint32(d.Type)) d.Data.Put(tmp[12:]) *dst = tmp } // KindMappingNotify identifies MappingNotify events in xturbo.Event.Kind. const KindMappingNotify = xturbo.EventKind(34) // MappingNotifyEvent is a view over a MappingNotify event's 32 bytes. Getters read the copied Event.Raw, so a view stays valid as long as the Event value it was taken from. type MappingNotifyEvent struct{ raw *[32]byte } // MappingNotifyOf views ev as MappingNotify without checking ev.Kind: a wrong kind yields garbage, never a panic. func MappingNotifyOf(ev *xturbo.Event) MappingNotifyEvent { return MappingNotifyEvent{raw: &ev.Raw} } func (e MappingNotifyEvent) Raw() *[32]byte { return e.raw } func (e MappingNotifyEvent) Request() Mapping { return Mapping(e.raw[4:][0]) } func (e MappingNotifyEvent) FirstKeycode() Keycode { return Keycode(e.raw[5:][0]) } func (e MappingNotifyEvent) Count() uint8 { return uint8(e.raw[6:][0]) } // MappingNotifyEventData encodes a MappingNotify event for SendEvent. type MappingNotifyEventData struct { Request Mapping FirstKeycode Keycode Count uint8 } // Put writes the event (code 34, pads and sequence zeroed) into dst. dst may alias // memory that d's borrowed fields view, such as the Event.Raw they were read from. func (d *MappingNotifyEventData) Put(dst *[32]byte) { var tmp [32]byte tmp[0] = 34 tmp[4:][0] = byte(d.Request) tmp[5:][0] = byte(d.FirstKeycode) tmp[6:][0] = byte(d.Count) *dst = tmp } // GeGenericEvent is a view over a GeGeneric generic event: the copied Event.Raw plus the borrowed Event.Tail. // Tail is valid only until the Handler callback returns; copy what you keep. type GeGenericEvent struct { raw *[32]byte tail []byte } // GeGenericOf views ev as GeGeneric; false when ev is not a generic event or Tail does not match its length. func GeGenericOf(ev *xturbo.Event) (GeGenericEvent, bool) { if ev.Raw[0]&0x7f != 35 || len(ev.Tail) != 4*int(binary.LittleEndian.Uint32(ev.Raw[4:])) { return GeGenericEvent{}, false } return GeGenericEvent{raw: &ev.Raw, tail: ev.Tail}, true } func (e GeGenericEvent) Extension() uint8 { return e.raw[1] } func (e GeGenericEvent) Length() uint32 { return binary.LittleEndian.Uint32(e.raw[4:]) } func (e GeGenericEvent) EventType() uint16 { return binary.LittleEndian.Uint16(e.raw[8:]) } func (e GeGenericEvent) Tail() []byte { return e.tail } func (e GeGenericEvent) Raw() *[32]byte { return e.raw }