blob: 728f85f03fcdb37598de072265fce0dae696f75d [file] [log] [blame]
// Package xproto is the X client API for the extension.
package xproto
// This file is automatically generated from xproto.xml. Edit at your peril!
import (
"github.com/BurntSushi/xgb"
)
// Setup parses the setup bytes retrieved when
// connecting into a SetupInfo struct.
func Setup(c *xgb.Conn) *SetupInfo {
setup := new(SetupInfo)
SetupInfoRead(c.SetupBytes, setup)
return setup
}
// DefaultScreen gets the default screen info from SetupInfo.
func (s *SetupInfo) DefaultScreen(c *xgb.Conn) *ScreenInfo {
return &s.Roots[c.DefaultScreen]
}
// BadAccess is the error number for a BadAccess.
const BadAccess = 10
type AccessError RequestError
// AccessErrorNew constructs a AccessError value that implements xgb.Error from a byte slice.
func AccessErrorNew(buf []byte) xgb.Error {
v := AccessError(RequestErrorNew(buf).(RequestError))
v.NiceName = "Access"
return v
}
// SequenceId returns the sequence id attached to the BadAccess error.
// This is mostly used internally.
func (err AccessError) SequenceId() uint16 {
return err.Sequence
}
// BadId returns the 'BadValue' number if one exists for the BadAccess error. If no bad value exists, 0 is returned.
func (err AccessError) BadId() uint32 {
return err.BadValue
}
// Error returns a rudimentary string representation of the BadAccess error.
func (err AccessError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode))
return "BadAccess {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewErrorFuncs[10] = AccessErrorNew
}
const (
AccessControlDisable = 0
AccessControlEnable = 1
)
// BadAlloc is the error number for a BadAlloc.
const BadAlloc = 11
type AllocError RequestError
// AllocErrorNew constructs a AllocError value that implements xgb.Error from a byte slice.
func AllocErrorNew(buf []byte) xgb.Error {
v := AllocError(RequestErrorNew(buf).(RequestError))
v.NiceName = "Alloc"
return v
}
// SequenceId returns the sequence id attached to the BadAlloc error.
// This is mostly used internally.
func (err AllocError) SequenceId() uint16 {
return err.Sequence
}
// BadId returns the 'BadValue' number if one exists for the BadAlloc error. If no bad value exists, 0 is returned.
func (err AllocError) BadId() uint32 {
return err.BadValue
}
// Error returns a rudimentary string representation of the BadAlloc error.
func (err AllocError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode))
return "BadAlloc {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewErrorFuncs[11] = AllocErrorNew
}
const (
AllowAsyncPointer = 0
AllowSyncPointer = 1
AllowReplayPointer = 2
AllowAsyncKeyboard = 3
AllowSyncKeyboard = 4
AllowReplayKeyboard = 5
AllowAsyncBoth = 6
AllowSyncBoth = 7
)
type Arc struct {
X int16
Y int16
Width uint16
Height uint16
Angle1 int16
Angle2 int16
}
// ArcRead reads a byte slice into a Arc value.
func ArcRead(buf []byte, v *Arc) int {
b := 0
v.X = int16(xgb.Get16(buf[b:]))
b += 2
v.Y = int16(xgb.Get16(buf[b:]))
b += 2
v.Width = xgb.Get16(buf[b:])
b += 2
v.Height = xgb.Get16(buf[b:])
b += 2
v.Angle1 = int16(xgb.Get16(buf[b:]))
b += 2
v.Angle2 = int16(xgb.Get16(buf[b:]))
b += 2
return b
}
// ArcReadList reads a byte slice into a list of Arc values.
func ArcReadList(buf []byte, dest []Arc) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = Arc{}
b += ArcRead(buf[b:], &dest[i])
}
return xgb.Pad(b)
}
// Bytes writes a Arc value to a byte slice.
func (v Arc) Bytes() []byte {
buf := make([]byte, 12)
b := 0
xgb.Put16(buf[b:], uint16(v.X))
b += 2
xgb.Put16(buf[b:], uint16(v.Y))
b += 2
xgb.Put16(buf[b:], v.Width)
b += 2
xgb.Put16(buf[b:], v.Height)
b += 2
xgb.Put16(buf[b:], uint16(v.Angle1))
b += 2
xgb.Put16(buf[b:], uint16(v.Angle2))
b += 2
return buf[:b]
}
// ArcListBytes writes a list of Arc values to a byte slice.
func ArcListBytes(buf []byte, list []Arc) int {
b := 0
var structBytes []byte
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
b += len(structBytes)
}
return xgb.Pad(b)
}
const (
ArcModeChord = 0
ArcModePieSlice = 1
)
type Atom uint32
func NewAtomId(c *xgb.Conn) (Atom, error) {
id, err := c.NewId()
if err != nil {
return 0, err
}
return Atom(id), nil
}
const (
AtomNone = 0
AtomAny = 0
AtomPrimary = 1
AtomSecondary = 2
AtomArc = 3
AtomAtom = 4
AtomBitmap = 5
AtomCardinal = 6
AtomColormap = 7
AtomCursor = 8
AtomCutBuffer0 = 9
AtomCutBuffer1 = 10
AtomCutBuffer2 = 11
AtomCutBuffer3 = 12
AtomCutBuffer4 = 13
AtomCutBuffer5 = 14
AtomCutBuffer6 = 15
AtomCutBuffer7 = 16
AtomDrawable = 17
AtomFont = 18
AtomInteger = 19
AtomPixmap = 20
AtomPoint = 21
AtomRectangle = 22
AtomResourceManager = 23
AtomRgbColorMap = 24
AtomRgbBestMap = 25
AtomRgbBlueMap = 26
AtomRgbDefaultMap = 27
AtomRgbGrayMap = 28
AtomRgbGreenMap = 29
AtomRgbRedMap = 30
AtomString = 31
AtomVisualid = 32
AtomWindow = 33
AtomWmCommand = 34
AtomWmHints = 35
AtomWmClientMachine = 36
AtomWmIconName = 37
AtomWmIconSize = 38
AtomWmName = 39
AtomWmNormalHints = 40
AtomWmSizeHints = 41
AtomWmZoomHints = 42
AtomMinSpace = 43
AtomNormSpace = 44
AtomMaxSpace = 45
AtomEndSpace = 46
AtomSuperscriptX = 47
AtomSuperscriptY = 48
AtomSubscriptX = 49
AtomSubscriptY = 50
AtomUnderlinePosition = 51
AtomUnderlineThickness = 52
AtomStrikeoutAscent = 53
AtomStrikeoutDescent = 54
AtomItalicAngle = 55
AtomXHeight = 56
AtomQuadWidth = 57
AtomWeight = 58
AtomPointSize = 59
AtomResolution = 60
AtomCopyright = 61
AtomNotice = 62
AtomFontName = 63
AtomFamilyName = 64
AtomFullName = 65
AtomCapHeight = 66
AtomWmClass = 67
AtomWmTransientFor = 68
)
// BadAtom is the error number for a BadAtom.
const BadAtom = 5
type AtomError ValueError
// AtomErrorNew constructs a AtomError value that implements xgb.Error from a byte slice.
func AtomErrorNew(buf []byte) xgb.Error {
v := AtomError(ValueErrorNew(buf).(ValueError))
v.NiceName = "Atom"
return v
}
// SequenceId returns the sequence id attached to the BadAtom error.
// This is mostly used internally.
func (err AtomError) SequenceId() uint16 {
return err.Sequence
}
// BadId returns the 'BadValue' number if one exists for the BadAtom error. If no bad value exists, 0 is returned.
func (err AtomError) BadId() uint32 {
return err.BadValue
}
// Error returns a rudimentary string representation of the BadAtom error.
func (err AtomError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode))
return "BadAtom {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewErrorFuncs[5] = AtomErrorNew
}
const (
AutoRepeatModeOff = 0
AutoRepeatModeOn = 1
AutoRepeatModeDefault = 2
)
const (
BackPixmapNone = 0
BackPixmapParentRelative = 1
)
const (
BackingStoreNotUseful = 0
BackingStoreWhenMapped = 1
BackingStoreAlways = 2
)
const (
BlankingNotPreferred = 0
BlankingPreferred = 1
BlankingDefault = 2
)
type Button byte
const (
ButtonIndexAny = 0
ButtonIndex1 = 1
ButtonIndex2 = 2
ButtonIndex3 = 3
ButtonIndex4 = 4
ButtonIndex5 = 5
)
const (
ButtonMask1 = 256
ButtonMask2 = 512
ButtonMask3 = 1024
ButtonMask4 = 2048
ButtonMask5 = 4096
ButtonMaskAny = 32768
)
// ButtonPress is the event number for a ButtonPressEvent.
const ButtonPress = 4
type ButtonPressEvent struct {
Sequence uint16
Detail Button
Time Timestamp
Root Window
Event Window
Child Window
RootX int16
RootY int16
EventX int16
EventY int16
State uint16
SameScreen bool
// padding: 1 bytes
}
// ButtonPressEventNew constructs a ButtonPressEvent value that implements xgb.Event from a byte slice.
func ButtonPressEventNew(buf []byte) xgb.Event {
v := ButtonPressEvent{}
b := 1 // don't read event number
v.Detail = Button(buf[b])
b += 1
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Time = Timestamp(xgb.Get32(buf[b:]))
b += 4
v.Root = Window(xgb.Get32(buf[b:]))
b += 4
v.Event = Window(xgb.Get32(buf[b:]))
b += 4
v.Child = Window(xgb.Get32(buf[b:]))
b += 4
v.RootX = int16(xgb.Get16(buf[b:]))
b += 2
v.RootY = int16(xgb.Get16(buf[b:]))
b += 2
v.EventX = int16(xgb.Get16(buf[b:]))
b += 2
v.EventY = int16(xgb.Get16(buf[b:]))
b += 2
v.State = xgb.Get16(buf[b:])
b += 2
if buf[b] == 1 {
v.SameScreen = true
} else {
v.SameScreen = false
}
b += 1
b += 1 // padding
return v
}
// Bytes writes a ButtonPressEvent value to a byte slice.
func (v ButtonPressEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 4
b += 1
buf[b] = byte(v.Detail)
b += 1
b += 2 // skip sequence number
xgb.Put32(buf[b:], uint32(v.Time))
b += 4
xgb.Put32(buf[b:], uint32(v.Root))
b += 4
xgb.Put32(buf[b:], uint32(v.Event))
b += 4
xgb.Put32(buf[b:], uint32(v.Child))
b += 4
xgb.Put16(buf[b:], uint16(v.RootX))
b += 2
xgb.Put16(buf[b:], uint16(v.RootY))
b += 2
xgb.Put16(buf[b:], uint16(v.EventX))
b += 2
xgb.Put16(buf[b:], uint16(v.EventY))
b += 2
xgb.Put16(buf[b:], v.State)
b += 2
if v.SameScreen {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
b += 1 // padding
return buf
}
// SequenceId returns the sequence id attached to the ButtonPress event.
// Events without a sequence number (KeymapNotify) return 0.
// This is mostly used internally.
func (v ButtonPressEvent) SequenceId() uint16 {
return v.Sequence
}
// String is a rudimentary string representation of ButtonPressEvent.
func (v ButtonPressEvent) String() string {
fieldVals := make([]string, 0, 12)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("Detail: %d", v.Detail))
fieldVals = append(fieldVals, xgb.Sprintf("Time: %d", v.Time))
fieldVals = append(fieldVals, xgb.Sprintf("Root: %d", v.Root))
fieldVals = append(fieldVals, xgb.Sprintf("Event: %d", v.Event))
fieldVals = append(fieldVals, xgb.Sprintf("Child: %d", v.Child))
fieldVals = append(fieldVals, xgb.Sprintf("RootX: %d", v.RootX))
fieldVals = append(fieldVals, xgb.Sprintf("RootY: %d", v.RootY))
fieldVals = append(fieldVals, xgb.Sprintf("EventX: %d", v.EventX))
fieldVals = append(fieldVals, xgb.Sprintf("EventY: %d", v.EventY))
fieldVals = append(fieldVals, xgb.Sprintf("State: %d", v.State))
fieldVals = append(fieldVals, xgb.Sprintf("SameScreen: %t", v.SameScreen))
return "ButtonPress {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewEventFuncs[4] = ButtonPressEventNew
}
// ButtonRelease is the event number for a ButtonReleaseEvent.
const ButtonRelease = 5
type ButtonReleaseEvent ButtonPressEvent
// ButtonReleaseEventNew constructs a ButtonReleaseEvent value that implements xgb.Event from a byte slice.
func ButtonReleaseEventNew(buf []byte) xgb.Event {
return ButtonReleaseEvent(ButtonPressEventNew(buf).(ButtonPressEvent))
}
// Bytes writes a ButtonReleaseEvent value to a byte slice.
func (v ButtonReleaseEvent) Bytes() []byte {
return ButtonPressEvent(v).Bytes()
}
// SequenceId returns the sequence id attached to the ButtonRelease event.
// Events without a sequence number (KeymapNotify) return 0.
// This is mostly used internally.
func (v ButtonReleaseEvent) SequenceId() uint16 {
return v.Sequence
}
func (v ButtonReleaseEvent) String() string {
fieldVals := make([]string, 0, 12)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("Detail: %d", v.Detail))
fieldVals = append(fieldVals, xgb.Sprintf("Time: %d", v.Time))
fieldVals = append(fieldVals, xgb.Sprintf("Root: %d", v.Root))
fieldVals = append(fieldVals, xgb.Sprintf("Event: %d", v.Event))
fieldVals = append(fieldVals, xgb.Sprintf("Child: %d", v.Child))
fieldVals = append(fieldVals, xgb.Sprintf("RootX: %d", v.RootX))
fieldVals = append(fieldVals, xgb.Sprintf("RootY: %d", v.RootY))
fieldVals = append(fieldVals, xgb.Sprintf("EventX: %d", v.EventX))
fieldVals = append(fieldVals, xgb.Sprintf("EventY: %d", v.EventY))
fieldVals = append(fieldVals, xgb.Sprintf("State: %d", v.State))
fieldVals = append(fieldVals, xgb.Sprintf("SameScreen: %t", v.SameScreen))
return "ButtonRelease {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewEventFuncs[5] = ButtonReleaseEventNew
}
const (
CapStyleNotLast = 0
CapStyleButt = 1
CapStyleRound = 2
CapStyleProjecting = 3
)
type Char2b struct {
Byte1 byte
Byte2 byte
}
// Char2bRead reads a byte slice into a Char2b value.
func Char2bRead(buf []byte, v *Char2b) int {
b := 0
v.Byte1 = buf[b]
b += 1
v.Byte2 = buf[b]
b += 1
return b
}
// Char2bReadList reads a byte slice into a list of Char2b values.
func Char2bReadList(buf []byte, dest []Char2b) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = Char2b{}
b += Char2bRead(buf[b:], &dest[i])
}
return xgb.Pad(b)
}
// Bytes writes a Char2b value to a byte slice.
func (v Char2b) Bytes() []byte {
buf := make([]byte, 2)
b := 0
buf[b] = v.Byte1
b += 1
buf[b] = v.Byte2
b += 1
return buf[:b]
}
// Char2bListBytes writes a list of Char2b values to a byte slice.
func Char2bListBytes(buf []byte, list []Char2b) int {
b := 0
var structBytes []byte
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
b += len(structBytes)
}
return xgb.Pad(b)
}
type Charinfo struct {
LeftSideBearing int16
RightSideBearing int16
CharacterWidth int16
Ascent int16
Descent int16
Attributes uint16
}
// CharinfoRead reads a byte slice into a Charinfo value.
func CharinfoRead(buf []byte, v *Charinfo) int {
b := 0
v.LeftSideBearing = int16(xgb.Get16(buf[b:]))
b += 2
v.RightSideBearing = int16(xgb.Get16(buf[b:]))
b += 2
v.CharacterWidth = int16(xgb.Get16(buf[b:]))
b += 2
v.Ascent = int16(xgb.Get16(buf[b:]))
b += 2
v.Descent = int16(xgb.Get16(buf[b:]))
b += 2
v.Attributes = xgb.Get16(buf[b:])
b += 2
return b
}
// CharinfoReadList reads a byte slice into a list of Charinfo values.
func CharinfoReadList(buf []byte, dest []Charinfo) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = Charinfo{}
b += CharinfoRead(buf[b:], &dest[i])
}
return xgb.Pad(b)
}
// Bytes writes a Charinfo value to a byte slice.
func (v Charinfo) Bytes() []byte {
buf := make([]byte, 12)
b := 0
xgb.Put16(buf[b:], uint16(v.LeftSideBearing))
b += 2
xgb.Put16(buf[b:], uint16(v.RightSideBearing))
b += 2
xgb.Put16(buf[b:], uint16(v.CharacterWidth))
b += 2
xgb.Put16(buf[b:], uint16(v.Ascent))
b += 2
xgb.Put16(buf[b:], uint16(v.Descent))
b += 2
xgb.Put16(buf[b:], v.Attributes)
b += 2
return buf[:b]
}
// CharinfoListBytes writes a list of Charinfo values to a byte slice.
func CharinfoListBytes(buf []byte, list []Charinfo) int {
b := 0
var structBytes []byte
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
b += len(structBytes)
}
return xgb.Pad(b)
}
const (
CirculateRaiseLowest = 0
CirculateLowerHighest = 1
)
// CirculateNotify is the event number for a CirculateNotifyEvent.
const CirculateNotify = 26
type CirculateNotifyEvent struct {
Sequence uint16
// padding: 1 bytes
Event Window
Window Window
// padding: 4 bytes
Place byte
// padding: 3 bytes
}
// CirculateNotifyEventNew constructs a CirculateNotifyEvent value that implements xgb.Event from a byte slice.
func CirculateNotifyEventNew(buf []byte) xgb.Event {
v := CirculateNotifyEvent{}
b := 1 // don't read event number
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Event = Window(xgb.Get32(buf[b:]))
b += 4
v.Window = Window(xgb.Get32(buf[b:]))
b += 4
b += 4 // padding
v.Place = buf[b]
b += 1
b += 3 // padding
return v
}
// Bytes writes a CirculateNotifyEvent value to a byte slice.
func (v CirculateNotifyEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 26
b += 1
b += 1 // padding
b += 2 // skip sequence number
xgb.Put32(buf[b:], uint32(v.Event))
b += 4
xgb.Put32(buf[b:], uint32(v.Window))
b += 4
b += 4 // padding
buf[b] = v.Place
b += 1
b += 3 // padding
return buf
}
// SequenceId returns the sequence id attached to the CirculateNotify event.
// Events without a sequence number (KeymapNotify) return 0.
// This is mostly used internally.
func (v CirculateNotifyEvent) SequenceId() uint16 {
return v.Sequence
}
// String is a rudimentary string representation of CirculateNotifyEvent.
func (v CirculateNotifyEvent) String() string {
fieldVals := make([]string, 0, 6)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("Event: %d", v.Event))
fieldVals = append(fieldVals, xgb.Sprintf("Window: %d", v.Window))
fieldVals = append(fieldVals, xgb.Sprintf("Place: %d", v.Place))
return "CirculateNotify {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewEventFuncs[26] = CirculateNotifyEventNew
}
// CirculateRequest is the event number for a CirculateRequestEvent.
const CirculateRequest = 27
type CirculateRequestEvent CirculateNotifyEvent
// CirculateRequestEventNew constructs a CirculateRequestEvent value that implements xgb.Event from a byte slice.
func CirculateRequestEventNew(buf []byte) xgb.Event {
return CirculateRequestEvent(CirculateNotifyEventNew(buf).(CirculateNotifyEvent))
}
// Bytes writes a CirculateRequestEvent value to a byte slice.
func (v CirculateRequestEvent) Bytes() []byte {
return CirculateNotifyEvent(v).Bytes()
}
// SequenceId returns the sequence id attached to the CirculateRequest event.
// Events without a sequence number (KeymapNotify) return 0.
// This is mostly used internally.
func (v CirculateRequestEvent) SequenceId() uint16 {
return v.Sequence
}
func (v CirculateRequestEvent) String() string {
fieldVals := make([]string, 0, 6)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("Event: %d", v.Event))
fieldVals = append(fieldVals, xgb.Sprintf("Window: %d", v.Window))
fieldVals = append(fieldVals, xgb.Sprintf("Place: %d", v.Place))
return "CirculateRequest {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewEventFuncs[27] = CirculateRequestEventNew
}
// ClientMessage is the event number for a ClientMessageEvent.
const ClientMessage = 33
type ClientMessageEvent struct {
Sequence uint16
Format byte
Window Window
Type Atom
Data ClientMessageDataUnion
}
// ClientMessageEventNew constructs a ClientMessageEvent value that implements xgb.Event from a byte slice.
func ClientMessageEventNew(buf []byte) xgb.Event {
v := ClientMessageEvent{}
b := 1 // don't read event number
v.Format = buf[b]
b += 1
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Window = Window(xgb.Get32(buf[b:]))
b += 4
v.Type = Atom(xgb.Get32(buf[b:]))
b += 4
v.Data = ClientMessageDataUnion{}
b += ClientMessageDataUnionRead(buf[b:], &v.Data)
return v
}
// Bytes writes a ClientMessageEvent value to a byte slice.
func (v ClientMessageEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 33
b += 1
buf[b] = v.Format
b += 1
b += 2 // skip sequence number
xgb.Put32(buf[b:], uint32(v.Window))
b += 4
xgb.Put32(buf[b:], uint32(v.Type))
b += 4
{
unionBytes := v.Data.Bytes()
copy(buf[b:], unionBytes)
b += len(unionBytes)
}
return buf
}
// SequenceId returns the sequence id attached to the ClientMessage event.
// Events without a sequence number (KeymapNotify) return 0.
// This is mostly used internally.
func (v ClientMessageEvent) SequenceId() uint16 {
return v.Sequence
}
// String is a rudimentary string representation of ClientMessageEvent.
func (v ClientMessageEvent) String() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("Format: %d", v.Format))
fieldVals = append(fieldVals, xgb.Sprintf("Window: %d", v.Window))
fieldVals = append(fieldVals, xgb.Sprintf("Type: %d", v.Type))
return "ClientMessage {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewEventFuncs[33] = ClientMessageEventNew
}
// ClientMessageDataUnion is a represention of the ClientMessageDataUnion union type.
// Note that to *create* a Union, you should *never* create
// this struct directly (unless you know what you're doing).
// Instead use one of the following constructors for 'ClientMessageDataUnion':
// ClientMessageDataUnionData8New(Data8 []byte) ClientMessageDataUnion
// ClientMessageDataUnionData16New(Data16 []uint16) ClientMessageDataUnion
// ClientMessageDataUnionData32New(Data32 []uint32) ClientMessageDataUnion
type ClientMessageDataUnion struct {
Data8 []byte // size: 20
Data16 []uint16 // size: 20
Data32 []uint32 // size: 20
}
// ClientMessageDataUnionData8New constructs a new ClientMessageDataUnion union type with the Data8 field.
func ClientMessageDataUnionData8New(Data8 []byte) ClientMessageDataUnion {
var b int
buf := make([]byte, 20)
copy(buf[b:], Data8[:20])
b += int(20)
// Create the Union type
v := ClientMessageDataUnion{}
// Now copy buf into all fields
b = 0 // always read the same bytes
v.Data8 = make([]byte, 20)
copy(v.Data8[:20], buf[b:])
b += int(20)
b = 0 // always read the same bytes
v.Data16 = make([]uint16, 10)
for i := 0; i < int(10); i++ {
v.Data16[i] = xgb.Get16(buf[b:])
b += 2
}
b = 0 // always read the same bytes
v.Data32 = make([]uint32, 5)
for i := 0; i < int(5); i++ {
v.Data32[i] = xgb.Get32(buf[b:])
b += 4
}
return v
}
// ClientMessageDataUnionData16New constructs a new ClientMessageDataUnion union type with the Data16 field.
func ClientMessageDataUnionData16New(Data16 []uint16) ClientMessageDataUnion {
var b int
buf := make([]byte, 20)
for i := 0; i < int(10); i++ {
xgb.Put16(buf[b:], Data16[i])
b += 2
}
// Create the Union type
v := ClientMessageDataUnion{}
// Now copy buf into all fields
b = 0 // always read the same bytes
v.Data8 = make([]byte, 20)
copy(v.Data8[:20], buf[b:])
b += int(20)
b = 0 // always read the same bytes
v.Data16 = make([]uint16, 10)
for i := 0; i < int(10); i++ {
v.Data16[i] = xgb.Get16(buf[b:])
b += 2
}
b = 0 // always read the same bytes
v.Data32 = make([]uint32, 5)
for i := 0; i < int(5); i++ {
v.Data32[i] = xgb.Get32(buf[b:])
b += 4
}
return v
}
// ClientMessageDataUnionData32New constructs a new ClientMessageDataUnion union type with the Data32 field.
func ClientMessageDataUnionData32New(Data32 []uint32) ClientMessageDataUnion {
var b int
buf := make([]byte, 20)
for i := 0; i < int(5); i++ {
xgb.Put32(buf[b:], Data32[i])
b += 4
}
// Create the Union type
v := ClientMessageDataUnion{}
// Now copy buf into all fields
b = 0 // always read the same bytes
v.Data8 = make([]byte, 20)
copy(v.Data8[:20], buf[b:])
b += int(20)
b = 0 // always read the same bytes
v.Data16 = make([]uint16, 10)
for i := 0; i < int(10); i++ {
v.Data16[i] = xgb.Get16(buf[b:])
b += 2
}
b = 0 // always read the same bytes
v.Data32 = make([]uint32, 5)
for i := 0; i < int(5); i++ {
v.Data32[i] = xgb.Get32(buf[b:])
b += 4
}
return v
}
// ClientMessageDataUnionRead reads a byte slice into a ClientMessageDataUnion value.
func ClientMessageDataUnionRead(buf []byte, v *ClientMessageDataUnion) int {
var b int
b = 0 // re-read the same bytes
v.Data8 = make([]byte, 20)
copy(v.Data8[:20], buf[b:])
b += int(20)
b = 0 // re-read the same bytes
v.Data16 = make([]uint16, 10)
for i := 0; i < int(10); i++ {
v.Data16[i] = xgb.Get16(buf[b:])
b += 2
}
b = 0 // re-read the same bytes
v.Data32 = make([]uint32, 5)
for i := 0; i < int(5); i++ {
v.Data32[i] = xgb.Get32(buf[b:])
b += 4
}
return 20
}
// ClientMessageDataUnionReadList reads a byte slice into a list of ClientMessageDataUnion values.
func ClientMessageDataUnionReadList(buf []byte, dest []ClientMessageDataUnion) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = ClientMessageDataUnion{}
b += ClientMessageDataUnionRead(buf[b:], &dest[i])
}
return xgb.Pad(b)
}
// Bytes writes a ClientMessageDataUnion value to a byte slice.
// Each field in a union must contain the same data.
// So simply pick the first field and write that to the wire.
func (v ClientMessageDataUnion) Bytes() []byte {
buf := make([]byte, 20)
b := 0
copy(buf[b:], v.Data8[:20])
b += int(20)
return buf
}
// ClientMessageDataUnionListBytes writes a list of ClientMessageDataUnion values to a byte slice.
func ClientMessageDataUnionListBytes(buf []byte, list []ClientMessageDataUnion) int {
b := 0
var unionBytes []byte
for _, item := range list {
unionBytes = item.Bytes()
copy(buf[b:], unionBytes)
b += xgb.Pad(len(unionBytes))
}
return b
}
const (
ClipOrderingUnsorted = 0
ClipOrderingYSorted = 1
ClipOrderingYXSorted = 2
ClipOrderingYXBanded = 3
)
const (
CloseDownDestroyAll = 0
CloseDownRetainPermanent = 1
CloseDownRetainTemporary = 2
)
const (
ColorFlagRed = 1
ColorFlagGreen = 2
ColorFlagBlue = 4
)
type Coloritem struct {
Pixel uint32
Red uint16
Green uint16
Blue uint16
Flags byte
// padding: 1 bytes
}
// ColoritemRead reads a byte slice into a Coloritem value.
func ColoritemRead(buf []byte, v *Coloritem) int {
b := 0
v.Pixel = xgb.Get32(buf[b:])
b += 4
v.Red = xgb.Get16(buf[b:])
b += 2
v.Green = xgb.Get16(buf[b:])
b += 2
v.Blue = xgb.Get16(buf[b:])
b += 2
v.Flags = buf[b]
b += 1
b += 1 // padding
return b
}
// ColoritemReadList reads a byte slice into a list of Coloritem values.
func ColoritemReadList(buf []byte, dest []Coloritem) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = Coloritem{}
b += ColoritemRead(buf[b:], &dest[i])
}
return xgb.Pad(b)
}
// Bytes writes a Coloritem value to a byte slice.
func (v Coloritem) Bytes() []byte {
buf := make([]byte, 12)
b := 0
xgb.Put32(buf[b:], v.Pixel)
b += 4
xgb.Put16(buf[b:], v.Red)
b += 2
xgb.Put16(buf[b:], v.Green)
b += 2
xgb.Put16(buf[b:], v.Blue)
b += 2
buf[b] = v.Flags
b += 1
b += 1 // padding
return buf[:b]
}
// ColoritemListBytes writes a list of Coloritem values to a byte slice.
func ColoritemListBytes(buf []byte, list []Coloritem) int {
b := 0
var structBytes []byte
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
b += len(structBytes)
}
return xgb.Pad(b)
}
type Colormap uint32
func NewColormapId(c *xgb.Conn) (Colormap, error) {
id, err := c.NewId()
if err != nil {
return 0, err
}
return Colormap(id), nil
}
// BadColormap is the error number for a BadColormap.
const BadColormap = 12
type ColormapError ValueError
// ColormapErrorNew constructs a ColormapError value that implements xgb.Error from a byte slice.
func ColormapErrorNew(buf []byte) xgb.Error {
v := ColormapError(ValueErrorNew(buf).(ValueError))
v.NiceName = "Colormap"
return v
}
// SequenceId returns the sequence id attached to the BadColormap error.
// This is mostly used internally.
func (err ColormapError) SequenceId() uint16 {
return err.Sequence
}
// BadId returns the 'BadValue' number if one exists for the BadColormap error. If no bad value exists, 0 is returned.
func (err ColormapError) BadId() uint32 {
return err.BadValue
}
// Error returns a rudimentary string representation of the BadColormap error.
func (err ColormapError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode))
return "BadColormap {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewErrorFuncs[12] = ColormapErrorNew
}
const (
ColormapNone = 0
)
const (
ColormapAllocNone = 0
ColormapAllocAll = 1
)
// ColormapNotify is the event number for a ColormapNotifyEvent.
const ColormapNotify = 32
type ColormapNotifyEvent struct {
Sequence uint16
// padding: 1 bytes
Window Window
Colormap Colormap
New bool
State byte
// padding: 2 bytes
}
// ColormapNotifyEventNew constructs a ColormapNotifyEvent value that implements xgb.Event from a byte slice.
func ColormapNotifyEventNew(buf []byte) xgb.Event {
v := ColormapNotifyEvent{}
b := 1 // don't read event number
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Window = Window(xgb.Get32(buf[b:]))
b += 4
v.Colormap = Colormap(xgb.Get32(buf[b:]))
b += 4
if buf[b] == 1 {
v.New = true
} else {
v.New = false
}
b += 1
v.State = buf[b]
b += 1
b += 2 // padding
return v
}
// Bytes writes a ColormapNotifyEvent value to a byte slice.
func (v ColormapNotifyEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 32
b += 1
b += 1 // padding
b += 2 // skip sequence number
xgb.Put32(buf[b:], uint32(v.Window))
b += 4
xgb.Put32(buf[b:], uint32(v.Colormap))
b += 4
if v.New {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
buf[b] = v.State
b += 1
b += 2 // padding
return buf
}
// SequenceId returns the sequence id attached to the ColormapNotify event.
// Events without a sequence number (KeymapNotify) return 0.
// This is mostly used internally.
func (v ColormapNotifyEvent) SequenceId() uint16 {
return v.Sequence
}
// String is a rudimentary string representation of ColormapNotifyEvent.
func (v ColormapNotifyEvent) String() string {
fieldVals := make([]string, 0, 6)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("Window: %d", v.Window))
fieldVals = append(fieldVals, xgb.Sprintf("Colormap: %d", v.Colormap))
fieldVals = append(fieldVals, xgb.Sprintf("New: %t", v.New))
fieldVals = append(fieldVals, xgb.Sprintf("State: %d", v.State))
return "ColormapNotify {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewEventFuncs[32] = ColormapNotifyEventNew
}
const (
ColormapStateUninstalled = 0
ColormapStateInstalled = 1
)
const (
ConfigWindowX = 1
ConfigWindowY = 2
ConfigWindowWidth = 4
ConfigWindowHeight = 8
ConfigWindowBorderWidth = 16
ConfigWindowSibling = 32
ConfigWindowStackMode = 64
)
// ConfigureNotify is the event number for a ConfigureNotifyEvent.
const ConfigureNotify = 22
type ConfigureNotifyEvent struct {
Sequence uint16
// padding: 1 bytes
Event Window
Window Window
AboveSibling Window
X int16
Y int16
Width uint16
Height uint16
BorderWidth uint16
OverrideRedirect bool
// padding: 1 bytes
}
// ConfigureNotifyEventNew constructs a ConfigureNotifyEvent value that implements xgb.Event from a byte slice.
func ConfigureNotifyEventNew(buf []byte) xgb.Event {
v := ConfigureNotifyEvent{}
b := 1 // don't read event number
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Event = Window(xgb.Get32(buf[b:]))
b += 4
v.Window = Window(xgb.Get32(buf[b:]))
b += 4
v.AboveSibling = Window(xgb.Get32(buf[b:]))
b += 4
v.X = int16(xgb.Get16(buf[b:]))
b += 2
v.Y = int16(xgb.Get16(buf[b:]))
b += 2
v.Width = xgb.Get16(buf[b:])
b += 2
v.Height = xgb.Get16(buf[b:])
b += 2
v.BorderWidth = xgb.Get16(buf[b:])
b += 2
if buf[b] == 1 {
v.OverrideRedirect = true
} else {
v.OverrideRedirect = false
}
b += 1
b += 1 // padding
return v
}
// Bytes writes a ConfigureNotifyEvent value to a byte slice.
func (v ConfigureNotifyEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 22
b += 1
b += 1 // padding
b += 2 // skip sequence number
xgb.Put32(buf[b:], uint32(v.Event))
b += 4
xgb.Put32(buf[b:], uint32(v.Window))
b += 4
xgb.Put32(buf[b:], uint32(v.AboveSibling))
b += 4
xgb.Put16(buf[b:], uint16(v.X))
b += 2
xgb.Put16(buf[b:], uint16(v.Y))
b += 2
xgb.Put16(buf[b:], v.Width)
b += 2
xgb.Put16(buf[b:], v.Height)
b += 2
xgb.Put16(buf[b:], v.BorderWidth)
b += 2
if v.OverrideRedirect {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
b += 1 // padding
return buf
}
// SequenceId returns the sequence id attached to the ConfigureNotify event.
// Events without a sequence number (KeymapNotify) return 0.
// This is mostly used internally.
func (v ConfigureNotifyEvent) SequenceId() uint16 {
return v.Sequence
}
// String is a rudimentary string representation of ConfigureNotifyEvent.
func (v ConfigureNotifyEvent) String() string {
fieldVals := make([]string, 0, 11)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("Event: %d", v.Event))
fieldVals = append(fieldVals, xgb.Sprintf("Window: %d", v.Window))
fieldVals = append(fieldVals, xgb.Sprintf("AboveSibling: %d", v.AboveSibling))
fieldVals = append(fieldVals, xgb.Sprintf("X: %d", v.X))
fieldVals = append(fieldVals, xgb.Sprintf("Y: %d", v.Y))
fieldVals = append(fieldVals, xgb.Sprintf("Width: %d", v.Width))
fieldVals = append(fieldVals, xgb.Sprintf("Height: %d", v.Height))
fieldVals = append(fieldVals, xgb.Sprintf("BorderWidth: %d", v.BorderWidth))
fieldVals = append(fieldVals, xgb.Sprintf("OverrideRedirect: %t", v.OverrideRedirect))
return "ConfigureNotify {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewEventFuncs[22] = ConfigureNotifyEventNew
}
// ConfigureRequest is the event number for a ConfigureRequestEvent.
const ConfigureRequest = 23
type ConfigureRequestEvent struct {
Sequence uint16
StackMode byte
Parent Window
Window Window
Sibling Window
X int16
Y int16
Width uint16
Height uint16
BorderWidth uint16
ValueMask uint16
}
// ConfigureRequestEventNew constructs a ConfigureRequestEvent value that implements xgb.Event from a byte slice.
func ConfigureRequestEventNew(buf []byte) xgb.Event {
v := ConfigureRequestEvent{}
b := 1 // don't read event number
v.StackMode = buf[b]
b += 1
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Parent = Window(xgb.Get32(buf[b:]))
b += 4
v.Window = Window(xgb.Get32(buf[b:]))
b += 4
v.Sibling = Window(xgb.Get32(buf[b:]))
b += 4
v.X = int16(xgb.Get16(buf[b:]))
b += 2
v.Y = int16(xgb.Get16(buf[b:]))
b += 2
v.Width = xgb.Get16(buf[b:])
b += 2
v.Height = xgb.Get16(buf[b:])
b += 2
v.BorderWidth = xgb.Get16(buf[b:])
b += 2
v.ValueMask = xgb.Get16(buf[b:])
b += 2
return v
}
// Bytes writes a ConfigureRequestEvent value to a byte slice.
func (v ConfigureRequestEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 23
b += 1
buf[b] = v.StackMode
b += 1
b += 2 // skip sequence number
xgb.Put32(buf[b:], uint32(v.Parent))
b += 4
xgb.Put32(buf[b:], uint32(v.Window))
b += 4
xgb.Put32(buf[b:], uint32(v.Sibling))
b += 4
xgb.Put16(buf[b:], uint16(v.X))
b += 2
xgb.Put16(buf[b:], uint16(v.Y))
b += 2
xgb.Put16(buf[b:], v.Width)
b += 2
xgb.Put16(buf[b:], v.Height)
b += 2
xgb.Put16(buf[b:], v.BorderWidth)
b += 2
xgb.Put16(buf[b:], v.ValueMask)
b += 2
return buf
}
// SequenceId returns the sequence id attached to the ConfigureRequest event.
// Events without a sequence number (KeymapNotify) return 0.
// This is mostly used internally.
func (v ConfigureRequestEvent) SequenceId() uint16 {
return v.Sequence
}
// String is a rudimentary string representation of ConfigureRequestEvent.
func (v ConfigureRequestEvent) String() string {
fieldVals := make([]string, 0, 10)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("StackMode: %d", v.StackMode))
fieldVals = append(fieldVals, xgb.Sprintf("Parent: %d", v.Parent))
fieldVals = append(fieldVals, xgb.Sprintf("Window: %d", v.Window))
fieldVals = append(fieldVals, xgb.Sprintf("Sibling: %d", v.Sibling))
fieldVals = append(fieldVals, xgb.Sprintf("X: %d", v.X))
fieldVals = append(fieldVals, xgb.Sprintf("Y: %d", v.Y))
fieldVals = append(fieldVals, xgb.Sprintf("Width: %d", v.Width))
fieldVals = append(fieldVals, xgb.Sprintf("Height: %d", v.Height))
fieldVals = append(fieldVals, xgb.Sprintf("BorderWidth: %d", v.BorderWidth))
fieldVals = append(fieldVals, xgb.Sprintf("ValueMask: %d", v.ValueMask))
return "ConfigureRequest {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewEventFuncs[23] = ConfigureRequestEventNew
}
const (
CoordModeOrigin = 0
CoordModePrevious = 1
)
// CreateNotify is the event number for a CreateNotifyEvent.
const CreateNotify = 16
type CreateNotifyEvent struct {
Sequence uint16
// padding: 1 bytes
Parent Window
Window Window
X int16
Y int16
Width uint16
Height uint16
BorderWidth uint16
OverrideRedirect bool
// padding: 1 bytes
}
// CreateNotifyEventNew constructs a CreateNotifyEvent value that implements xgb.Event from a byte slice.
func CreateNotifyEventNew(buf []byte) xgb.Event {
v := CreateNotifyEvent{}
b := 1 // don't read event number
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Parent = Window(xgb.Get32(buf[b:]))
b += 4
v.Window = Window(xgb.Get32(buf[b:]))
b += 4
v.X = int16(xgb.Get16(buf[b:]))
b += 2
v.Y = int16(xgb.Get16(buf[b:]))
b += 2
v.Width = xgb.Get16(buf[b:])
b += 2
v.Height = xgb.Get16(buf[b:])
b += 2
v.BorderWidth = xgb.Get16(buf[b:])
b += 2
if buf[b] == 1 {
v.OverrideRedirect = true
} else {
v.OverrideRedirect = false
}
b += 1
b += 1 // padding
return v
}
// Bytes writes a CreateNotifyEvent value to a byte slice.
func (v CreateNotifyEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 16
b += 1
b += 1 // padding
b += 2 // skip sequence number
xgb.Put32(buf[b:], uint32(v.Parent))
b += 4
xgb.Put32(buf[b:], uint32(v.Window))
b += 4
xgb.Put16(buf[b:], uint16(v.X))
b += 2
xgb.Put16(buf[b:], uint16(v.Y))
b += 2
xgb.Put16(buf[b:], v.Width)
b += 2
xgb.Put16(buf[b:], v.Height)
b += 2
xgb.Put16(buf[b:], v.BorderWidth)
b += 2
if v.OverrideRedirect {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
b += 1 // padding
return buf
}
// SequenceId returns the sequence id attached to the CreateNotify event.
// Events without a sequence number (KeymapNotify) return 0.
// This is mostly used internally.
func (v CreateNotifyEvent) SequenceId() uint16 {
return v.Sequence
}
// String is a rudimentary string representation of CreateNotifyEvent.
func (v CreateNotifyEvent) String() string {
fieldVals := make([]string, 0, 10)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("Parent: %d", v.Parent))
fieldVals = append(fieldVals, xgb.Sprintf("Window: %d", v.Window))
fieldVals = append(fieldVals, xgb.Sprintf("X: %d", v.X))
fieldVals = append(fieldVals, xgb.Sprintf("Y: %d", v.Y))
fieldVals = append(fieldVals, xgb.Sprintf("Width: %d", v.Width))
fieldVals = append(fieldVals, xgb.Sprintf("Height: %d", v.Height))
fieldVals = append(fieldVals, xgb.Sprintf("BorderWidth: %d", v.BorderWidth))
fieldVals = append(fieldVals, xgb.Sprintf("OverrideRedirect: %t", v.OverrideRedirect))
return "CreateNotify {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewEventFuncs[16] = CreateNotifyEventNew
}
type Cursor uint32
func NewCursorId(c *xgb.Conn) (Cursor, error) {
id, err := c.NewId()
if err != nil {
return 0, err
}
return Cursor(id), nil
}
// BadCursor is the error number for a BadCursor.
const BadCursor = 6
type CursorError ValueError
// CursorErrorNew constructs a CursorError value that implements xgb.Error from a byte slice.
func CursorErrorNew(buf []byte) xgb.Error {
v := CursorError(ValueErrorNew(buf).(ValueError))
v.NiceName = "Cursor"
return v
}
// SequenceId returns the sequence id attached to the BadCursor error.
// This is mostly used internally.
func (err CursorError) SequenceId() uint16 {
return err.Sequence
}
// BadId returns the 'BadValue' number if one exists for the BadCursor error. If no bad value exists, 0 is returned.
func (err CursorError) BadId() uint32 {
return err.BadValue
}
// Error returns a rudimentary string representation of the BadCursor error.
func (err CursorError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode))
return "BadCursor {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewErrorFuncs[6] = CursorErrorNew
}
const (
CursorNone = 0
)
const (
CwBackPixmap = 1
CwBackPixel = 2
CwBorderPixmap = 4
CwBorderPixel = 8
CwBitGravity = 16
CwWinGravity = 32
CwBackingStore = 64
CwBackingPlanes = 128
CwBackingPixel = 256
CwOverrideRedirect = 512
CwSaveUnder = 1024
CwEventMask = 2048
CwDontPropagate = 4096
CwColormap = 8192
CwCursor = 16384
)
type DepthInfo struct {
Depth byte
// padding: 1 bytes
VisualsLen uint16
// padding: 4 bytes
Visuals []VisualInfo // size: xgb.Pad((int(VisualsLen) * 24))
}
// DepthInfoRead reads a byte slice into a DepthInfo value.
func DepthInfoRead(buf []byte, v *DepthInfo) int {
b := 0
v.Depth = buf[b]
b += 1
b += 1 // padding
v.VisualsLen = xgb.Get16(buf[b:])
b += 2
b += 4 // padding
v.Visuals = make([]VisualInfo, v.VisualsLen)
b += VisualInfoReadList(buf[b:], v.Visuals)
return b
}
// DepthInfoReadList reads a byte slice into a list of DepthInfo values.
func DepthInfoReadList(buf []byte, dest []DepthInfo) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = DepthInfo{}
b += DepthInfoRead(buf[b:], &dest[i])
}
return xgb.Pad(b)
}
// Bytes writes a DepthInfo value to a byte slice.
func (v DepthInfo) Bytes() []byte {
buf := make([]byte, (8 + xgb.Pad((int(v.VisualsLen) * 24))))
b := 0
buf[b] = v.Depth
b += 1
b += 1 // padding
xgb.Put16(buf[b:], v.VisualsLen)
b += 2
b += 4 // padding
b += VisualInfoListBytes(buf[b:], v.Visuals)
return buf[:b]
}
// DepthInfoListBytes writes a list of DepthInfo values to a byte slice.
func DepthInfoListBytes(buf []byte, list []DepthInfo) int {
b := 0
var structBytes []byte
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
b += len(structBytes)
}
return xgb.Pad(b)
}
// DepthInfoListSize computes the size (bytes) of a list of DepthInfo values.
func DepthInfoListSize(list []DepthInfo) int {
size := 0
for _, item := range list {
size += (8 + xgb.Pad((int(item.VisualsLen) * 24)))
}
return size
}
// DestroyNotify is the event number for a DestroyNotifyEvent.
const DestroyNotify = 17
type DestroyNotifyEvent struct {
Sequence uint16
// padding: 1 bytes
Event Window
Window Window
}
// DestroyNotifyEventNew constructs a DestroyNotifyEvent value that implements xgb.Event from a byte slice.
func DestroyNotifyEventNew(buf []byte) xgb.Event {
v := DestroyNotifyEvent{}
b := 1 // don't read event number
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Event = Window(xgb.Get32(buf[b:]))
b += 4
v.Window = Window(xgb.Get32(buf[b:]))
b += 4
return v
}
// Bytes writes a DestroyNotifyEvent value to a byte slice.
func (v DestroyNotifyEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 17
b += 1
b += 1 // padding
b += 2 // skip sequence number
xgb.Put32(buf[b:], uint32(v.Event))
b += 4
xgb.Put32(buf[b:], uint32(v.Window))
b += 4
return buf
}
// SequenceId returns the sequence id attached to the DestroyNotify event.
// Events without a sequence number (KeymapNotify) return 0.
// This is mostly used internally.
func (v DestroyNotifyEvent) SequenceId() uint16 {
return v.Sequence
}
// String is a rudimentary string representation of DestroyNotifyEvent.
func (v DestroyNotifyEvent) String() string {
fieldVals := make([]string, 0, 3)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("Event: %d", v.Event))
fieldVals = append(fieldVals, xgb.Sprintf("Window: %d", v.Window))
return "DestroyNotify {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewEventFuncs[17] = DestroyNotifyEventNew
}
type Drawable uint32
func NewDrawableId(c *xgb.Conn) (Drawable, error) {
id, err := c.NewId()
if err != nil {
return 0, err
}
return Drawable(id), nil
}
// BadDrawable is the error number for a BadDrawable.
const BadDrawable = 9
type DrawableError ValueError
// DrawableErrorNew constructs a DrawableError value that implements xgb.Error from a byte slice.
func DrawableErrorNew(buf []byte) xgb.Error {
v := DrawableError(ValueErrorNew(buf).(ValueError))
v.NiceName = "Drawable"
return v
}
// SequenceId returns the sequence id attached to the BadDrawable error.
// This is mostly used internally.
func (err DrawableError) SequenceId() uint16 {
return err.Sequence
}
// BadId returns the 'BadValue' number if one exists for the BadDrawable error. If no bad value exists, 0 is returned.
func (err DrawableError) BadId() uint32 {
return err.BadValue
}
// Error returns a rudimentary string representation of the BadDrawable error.
func (err DrawableError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode))
return "BadDrawable {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewErrorFuncs[9] = DrawableErrorNew
}
// EnterNotify is the event number for a EnterNotifyEvent.
const EnterNotify = 7
type EnterNotifyEvent struct {
Sequence uint16
Detail byte
Time Timestamp
Root Window
Event Window
Child Window
RootX int16
RootY int16
EventX int16
EventY int16
State uint16
Mode byte
SameScreenFocus byte
}
// EnterNotifyEventNew constructs a EnterNotifyEvent value that implements xgb.Event from a byte slice.
func EnterNotifyEventNew(buf []byte) xgb.Event {
v := EnterNotifyEvent{}
b := 1 // don't read event number
v.Detail = buf[b]
b += 1
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Time = Timestamp(xgb.Get32(buf[b:]))
b += 4
v.Root = Window(xgb.Get32(buf[b:]))
b += 4
v.Event = Window(xgb.Get32(buf[b:]))
b += 4
v.Child = Window(xgb.Get32(buf[b:]))
b += 4
v.RootX = int16(xgb.Get16(buf[b:]))
b += 2
v.RootY = int16(xgb.Get16(buf[b:]))
b += 2
v.EventX = int16(xgb.Get16(buf[b:]))
b += 2
v.EventY = int16(xgb.Get16(buf[b:]))
b += 2
v.State = xgb.Get16(buf[b:])
b += 2
v.Mode = buf[b]
b += 1
v.SameScreenFocus = buf[b]
b += 1
return v
}
// Bytes writes a EnterNotifyEvent value to a byte slice.
func (v EnterNotifyEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 7
b += 1
buf[b] = v.Detail
b += 1
b += 2 // skip sequence number
xgb.Put32(buf[b:], uint32(v.Time))
b += 4
xgb.Put32(buf[b:], uint32(v.Root))
b += 4
xgb.Put32(buf[b:], uint32(v.Event))
b += 4
xgb.Put32(buf[b:], uint32(v.Child))
b += 4
xgb.Put16(buf[b:], uint16(v.RootX))
b += 2
xgb.Put16(buf[b:], uint16(v.RootY))
b += 2
xgb.Put16(buf[b:], uint16(v.EventX))
b += 2
xgb.Put16(buf[b:], uint16(v.EventY))
b += 2
xgb.Put16(buf[b:], v.State)
b += 2
buf[b] = v.Mode
b += 1
buf[b] = v.SameScreenFocus
b += 1
return buf
}
// SequenceId returns the sequence id attached to the EnterNotify event.
// Events without a sequence number (KeymapNotify) return 0.
// This is mostly used internally.
func (v EnterNotifyEvent) SequenceId() uint16 {
return v.Sequence
}
// String is a rudimentary string representation of EnterNotifyEvent.
func (v EnterNotifyEvent) String() string {
fieldVals := make([]string, 0, 12)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("Detail: %d", v.Detail))
fieldVals = append(fieldVals, xgb.Sprintf("Time: %d", v.Time))
fieldVals = append(fieldVals, xgb.Sprintf("Root: %d", v.Root))
fieldVals = append(fieldVals, xgb.Sprintf("Event: %d", v.Event))
fieldVals = append(fieldVals, xgb.Sprintf("Child: %d", v.Child))
fieldVals = append(fieldVals, xgb.Sprintf("RootX: %d", v.RootX))
fieldVals = append(fieldVals, xgb.Sprintf("RootY: %d", v.RootY))
fieldVals = append(fieldVals, xgb.Sprintf("EventX: %d", v.EventX))
fieldVals = append(fieldVals, xgb.Sprintf("EventY: %d", v.EventY))
fieldVals = append(fieldVals, xgb.Sprintf("State: %d", v.State))
fieldVals = append(fieldVals, xgb.Sprintf("Mode: %d", v.Mode))
fieldVals = append(fieldVals, xgb.Sprintf("SameScreenFocus: %d", v.SameScreenFocus))
return "EnterNotify {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewEventFuncs[7] = EnterNotifyEventNew
}
const (
EventMaskNoEvent = 0
EventMaskKeyPress = 1
EventMaskKeyRelease = 2
EventMaskButtonPress = 4
EventMaskButtonRelease = 8
EventMaskEnterWindow = 16
EventMaskLeaveWindow = 32
EventMaskPointerMotion = 64
EventMaskPointerMotionHint = 128
EventMaskButton1Motion = 256
EventMaskButton2Motion = 512
EventMaskButton3Motion = 1024
EventMaskButton4Motion = 2048
EventMaskButton5Motion = 4096
EventMaskButtonMotion = 8192
EventMaskKeymapState = 16384
EventMaskExposure = 32768
EventMaskVisibilityChange = 65536
EventMaskStructureNotify = 131072
EventMaskResizeRedirect = 262144
EventMaskSubstructureNotify = 524288
EventMaskSubstructureRedirect = 1048576
EventMaskFocusChange = 2097152
EventMaskPropertyChange = 4194304
EventMaskColorMapChange = 8388608
EventMaskOwnerGrabButton = 16777216
)
// Expose is the event number for a ExposeEvent.
const Expose = 12
type ExposeEvent struct {
Sequence uint16
// padding: 1 bytes
Window Window
X uint16
Y uint16
Width uint16
Height uint16
Count uint16
// padding: 2 bytes
}
// ExposeEventNew constructs a ExposeEvent value that implements xgb.Event from a byte slice.
func ExposeEventNew(buf []byte) xgb.Event {
v := ExposeEvent{}
b := 1 // don't read event number
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Window = Window(xgb.Get32(buf[b:]))
b += 4
v.X = xgb.Get16(buf[b:])
b += 2
v.Y = xgb.Get16(buf[b:])
b += 2
v.Width = xgb.Get16(buf[b:])
b += 2
v.Height = xgb.Get16(buf[b:])
b += 2
v.Count = xgb.Get16(buf[b:])
b += 2
b += 2 // padding
return v
}
// Bytes writes a ExposeEvent value to a byte slice.
func (v ExposeEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 12
b += 1
b += 1 // padding
b += 2 // skip sequence number
xgb.Put32(buf[b:], uint32(v.Window))
b += 4
xgb.Put16(buf[b:], v.X)
b += 2
xgb.Put16(buf[b:], v.Y)
b += 2
xgb.Put16(buf[b:], v.Width)
b += 2
xgb.Put16(buf[b:], v.Height)
b += 2
xgb.Put16(buf[b:], v.Count)
b += 2
b += 2 // padding
return buf
}
// SequenceId returns the sequence id attached to the Expose event.
// Events without a sequence number (KeymapNotify) return 0.
// This is mostly used internally.
func (v ExposeEvent) SequenceId() uint16 {
return v.Sequence
}
// String is a rudimentary string representation of ExposeEvent.
func (v ExposeEvent) String() string {
fieldVals := make([]string, 0, 8)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("Window: %d", v.Window))
fieldVals = append(fieldVals, xgb.Sprintf("X: %d", v.X))
fieldVals = append(fieldVals, xgb.Sprintf("Y: %d", v.Y))
fieldVals = append(fieldVals, xgb.Sprintf("Width: %d", v.Width))
fieldVals = append(fieldVals, xgb.Sprintf("Height: %d", v.Height))
fieldVals = append(fieldVals, xgb.Sprintf("Count: %d", v.Count))
return "Expose {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewEventFuncs[12] = ExposeEventNew
}
const (
ExposuresNotAllowed = 0
ExposuresAllowed = 1
ExposuresDefault = 2
)
const (
FamilyInternet = 0
FamilyDECnet = 1
FamilyChaos = 2
FamilyServerInterpreted = 5
FamilyInternet6 = 6
)
const (
FillRuleEvenOdd = 0
FillRuleWinding = 1
)
const (
FillStyleSolid = 0
FillStyleTiled = 1
FillStyleStippled = 2
FillStyleOpaqueStippled = 3
)
// FocusIn is the event number for a FocusInEvent.
const FocusIn = 9
type FocusInEvent struct {
Sequence uint16
Detail byte
Event Window
Mode byte
// padding: 3 bytes
}
// FocusInEventNew constructs a FocusInEvent value that implements xgb.Event from a byte slice.
func FocusInEventNew(buf []byte) xgb.Event {
v := FocusInEvent{}
b := 1 // don't read event number
v.Detail = buf[b]
b += 1
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Event = Window(xgb.Get32(buf[b:]))
b += 4
v.Mode = buf[b]
b += 1
b += 3 // padding
return v
}
// Bytes writes a FocusInEvent value to a byte slice.
func (v FocusInEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 9
b += 1
buf[b] = v.Detail
b += 1
b += 2 // skip sequence number
xgb.Put32(buf[b:], uint32(v.Event))
b += 4
buf[b] = v.Mode
b += 1
b += 3 // padding
return buf
}
// SequenceId returns the sequence id attached to the FocusIn event.
// Events without a sequence number (KeymapNotify) return 0.
// This is mostly used internally.
func (v FocusInEvent) SequenceId() uint16 {
return v.Sequence
}
// String is a rudimentary string representation of FocusInEvent.
func (v FocusInEvent) String() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("Detail: %d", v.Detail))
fieldVals = append(fieldVals, xgb.Sprintf("Event: %d", v.Event))
fieldVals = append(fieldVals, xgb.Sprintf("Mode: %d", v.Mode))
return "FocusIn {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewEventFuncs[9] = FocusInEventNew
}
// FocusOut is the event number for a FocusOutEvent.
const FocusOut = 10
type FocusOutEvent FocusInEvent
// FocusOutEventNew constructs a FocusOutEvent value that implements xgb.Event from a byte slice.
func FocusOutEventNew(buf []byte) xgb.Event {
return FocusOutEvent(FocusInEventNew(buf).(FocusInEvent))
}
// Bytes writes a FocusOutEvent value to a byte slice.
func (v FocusOutEvent) Bytes() []byte {
return FocusInEvent(v).Bytes()
}
// SequenceId returns the sequence id attached to the FocusOut event.
// Events without a sequence number (KeymapNotify) return 0.
// This is mostly used internally.
func (v FocusOutEvent) SequenceId() uint16 {
return v.Sequence
}
func (v FocusOutEvent) String() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("Detail: %d", v.Detail))
fieldVals = append(fieldVals, xgb.Sprintf("Event: %d", v.Event))
fieldVals = append(fieldVals, xgb.Sprintf("Mode: %d", v.Mode))
return "FocusOut {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewEventFuncs[10] = FocusOutEventNew
}
type Font uint32
func NewFontId(c *xgb.Conn) (Font, error) {
id, err := c.NewId()
if err != nil {
return 0, err
}
return Font(id), nil
}
// BadFont is the error number for a BadFont.
const BadFont = 7
type FontError ValueError
// FontErrorNew constructs a FontError value that implements xgb.Error from a byte slice.
func FontErrorNew(buf []byte) xgb.Error {
v := FontError(ValueErrorNew(buf).(ValueError))
v.NiceName = "Font"
return v
}
// SequenceId returns the sequence id attached to the BadFont error.
// This is mostly used internally.
func (err FontError) SequenceId() uint16 {
return err.Sequence
}
// BadId returns the 'BadValue' number if one exists for the BadFont error. If no bad value exists, 0 is returned.
func (err FontError) BadId() uint32 {
return err.BadValue
}
// Error returns a rudimentary string representation of the BadFont error.
func (err FontError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode))
return "BadFont {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewErrorFuncs[7] = FontErrorNew
}
const (
FontNone = 0
)
const (
FontDrawLeftToRight = 0
FontDrawRightToLeft = 1
)
type Fontable uint32
func NewFontableId(c *xgb.Conn) (Fontable, error) {
id, err := c.NewId()
if err != nil {
return 0, err
}
return Fontable(id), nil
}
type Fontprop struct {
Name Atom
Value uint32
}
// FontpropRead reads a byte slice into a Fontprop value.
func FontpropRead(buf []byte, v *Fontprop) int {
b := 0
v.Name = Atom(xgb.Get32(buf[b:]))
b += 4
v.Value = xgb.Get32(buf[b:])
b += 4
return b
}
// FontpropReadList reads a byte slice into a list of Fontprop values.
func FontpropReadList(buf []byte, dest []Fontprop) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = Fontprop{}
b += FontpropRead(buf[b:], &dest[i])
}
return xgb.Pad(b)
}
// Bytes writes a Fontprop value to a byte slice.
func (v Fontprop) Bytes() []byte {
buf := make([]byte, 8)
b := 0
xgb.Put32(buf[b:], uint32(v.Name))
b += 4
xgb.Put32(buf[b:], v.Value)
b += 4
return buf[:b]
}
// FontpropListBytes writes a list of Fontprop values to a byte slice.
func FontpropListBytes(buf []byte, list []Fontprop) int {
b := 0
var structBytes []byte
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
b += len(structBytes)
}
return xgb.Pad(b)
}
type Format struct {
Depth byte
BitsPerPixel byte
ScanlinePad byte
// padding: 5 bytes
}
// FormatRead reads a byte slice into a Format value.
func FormatRead(buf []byte, v *Format) int {
b := 0
v.Depth = buf[b]
b += 1
v.BitsPerPixel = buf[b]
b += 1
v.ScanlinePad = buf[b]
b += 1
b += 5 // padding
return b
}
// FormatReadList reads a byte slice into a list of Format values.
func FormatReadList(buf []byte, dest []Format) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = Format{}
b += FormatRead(buf[b:], &dest[i])
}
return xgb.Pad(b)
}
// Bytes writes a Format value to a byte slice.
func (v Format) Bytes() []byte {
buf := make([]byte, 8)
b := 0
buf[b] = v.Depth
b += 1
buf[b] = v.BitsPerPixel
b += 1
buf[b] = v.ScanlinePad
b += 1
b += 5 // padding
return buf[:b]
}
// FormatListBytes writes a list of Format values to a byte slice.
func FormatListBytes(buf []byte, list []Format) int {
b := 0
var structBytes []byte
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
b += len(structBytes)
}
return xgb.Pad(b)
}
// BadGContext is the error number for a BadGContext.
const BadGContext = 13
type GContextError ValueError
// GContextErrorNew constructs a GContextError value that implements xgb.Error from a byte slice.
func GContextErrorNew(buf []byte) xgb.Error {
v := GContextError(ValueErrorNew(buf).(ValueError))
v.NiceName = "GContext"
return v
}
// SequenceId returns the sequence id attached to the BadGContext error.
// This is mostly used internally.
func (err GContextError) SequenceId() uint16 {
return err.Sequence
}
// BadId returns the 'BadValue' number if one exists for the BadGContext error. If no bad value exists, 0 is returned.
func (err GContextError) BadId() uint32 {
return err.BadValue
}
// Error returns a rudimentary string representation of the BadGContext error.
func (err GContextError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode))
return "BadGContext {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewErrorFuncs[13] = GContextErrorNew
}
const (
GcFunction = 1
GcPlaneMask = 2
GcForeground = 4
GcBackground = 8
GcLineWidth = 16
GcLineStyle = 32
GcCapStyle = 64
GcJoinStyle = 128
GcFillStyle = 256
GcFillRule = 512
GcTile = 1024
GcStipple = 2048
GcTileStippleOriginX = 4096
GcTileStippleOriginY = 8192
GcFont = 16384
GcSubwindowMode = 32768
GcGraphicsExposures = 65536
GcClipOriginX = 131072
GcClipOriginY = 262144
GcClipMask = 524288
GcDashOffset = 1048576
GcDashList = 2097152
GcArcMode = 4194304
)
type Gcontext uint32
func NewGcontextId(c *xgb.Conn) (Gcontext, error) {
id, err := c.NewId()
if err != nil {
return 0, err
}
return Gcontext(id), nil
}
// GeGeneric is the event number for a GeGenericEvent.
const GeGeneric = 35
type GeGenericEvent struct {
Sequence uint16
// padding: 22 bytes
}
// GeGenericEventNew constructs a GeGenericEvent value that implements xgb.Event from a byte slice.
func GeGenericEventNew(buf []byte) xgb.Event {
v := GeGenericEvent{}
b := 1 // don't read event number
b += 22 // padding
return v
}
// Bytes writes a GeGenericEvent value to a byte slice.
func (v GeGenericEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 35
b += 1
b += 22 // padding
return buf
}
// SequenceId returns the sequence id attached to the GeGeneric event.
// Events without a sequence number (KeymapNotify) return 0.
// This is mostly used internally.
func (v GeGenericEvent) SequenceId() uint16 {
return v.Sequence
}
// String is a rudimentary string representation of GeGenericEvent.
func (v GeGenericEvent) String() string {
fieldVals := make([]string, 0, 1)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence))
return "GeGeneric {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewEventFuncs[35] = GeGenericEventNew
}
const (
GetPropertyTypeAny = 0
)
const (
GrabAny = 0
)
const (
GrabModeSync = 0
GrabModeAsync = 1
)
const (
GrabStatusSuccess = 0
GrabStatusAlreadyGrabbed = 1
GrabStatusInvalidTime = 2
GrabStatusNotViewable = 3
GrabStatusFrozen = 4
)
// GraphicsExposure is the event number for a GraphicsExposureEvent.
const GraphicsExposure = 13
type GraphicsExposureEvent struct {
Sequence uint16
// padding: 1 bytes
Drawable Drawable
X uint16
Y uint16
Width uint16
Height uint16
MinorOpcode uint16
Count uint16
MajorOpcode byte
// padding: 3 bytes
}
// GraphicsExposureEventNew constructs a GraphicsExposureEvent value that implements xgb.Event from a byte slice.
func GraphicsExposureEventNew(buf []byte) xgb.Event {
v := GraphicsExposureEvent{}
b := 1 // don't read event number
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Drawable = Drawable(xgb.Get32(buf[b:]))
b += 4
v.X = xgb.Get16(buf[b:])
b += 2
v.Y = xgb.Get16(buf[b:])
b += 2
v.Width = xgb.Get16(buf[b:])
b += 2
v.Height = xgb.Get16(buf[b:])
b += 2
v.MinorOpcode = xgb.Get16(buf[b:])
b += 2
v.Count = xgb.Get16(buf[b:])
b += 2
v.MajorOpcode = buf[b]
b += 1
b += 3 // padding
return v
}
// Bytes writes a GraphicsExposureEvent value to a byte slice.
func (v GraphicsExposureEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 13
b += 1
b += 1 // padding
b += 2 // skip sequence number
xgb.Put32(buf[b:], uint32(v.Drawable))
b += 4
xgb.Put16(buf[b:], v.X)
b += 2
xgb.Put16(buf[b:], v.Y)
b += 2
xgb.Put16(buf[b:], v.Width)
b += 2
xgb.Put16(buf[b:], v.Height)
b += 2
xgb.Put16(buf[b:], v.MinorOpcode)
b += 2
xgb.Put16(buf[b:], v.Count)
b += 2
buf[b] = v.MajorOpcode
b += 1
b += 3 // padding
return buf
}
// SequenceId returns the sequence id attached to the GraphicsExposure event.
// Events without a sequence number (KeymapNotify) return 0.
// This is mostly used internally.
func (v GraphicsExposureEvent) SequenceId() uint16 {
return v.Sequence
}
// String is a rudimentary string representation of GraphicsExposureEvent.
func (v GraphicsExposureEvent) String() string {
fieldVals := make([]string, 0, 10)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("Drawable: %d", v.Drawable))
fieldVals = append(fieldVals, xgb.Sprintf("X: %d", v.X))
fieldVals = append(fieldVals, xgb.Sprintf("Y: %d", v.Y))
fieldVals = append(fieldVals, xgb.Sprintf("Width: %d", v.Width))
fieldVals = append(fieldVals, xgb.Sprintf("Height: %d", v.Height))
fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", v.MinorOpcode))
fieldVals = append(fieldVals, xgb.Sprintf("Count: %d", v.Count))
fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", v.MajorOpcode))
return "GraphicsExposure {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewEventFuncs[13] = GraphicsExposureEventNew
}
const (
GravityBitForget = 0
GravityWinUnmap = 0
GravityNorthWest = 1
GravityNorth = 2
GravityNorthEast = 3
GravityWest = 4
GravityCenter = 5
GravityEast = 6
GravitySouthWest = 7
GravitySouth = 8
GravitySouthEast = 9
GravityStatic = 10
)
// GravityNotify is the event number for a GravityNotifyEvent.
const GravityNotify = 24
type GravityNotifyEvent struct {
Sequence uint16
// padding: 1 bytes
Event Window
Window Window
X int16
Y int16
}
// GravityNotifyEventNew constructs a GravityNotifyEvent value that implements xgb.Event from a byte slice.
func GravityNotifyEventNew(buf []byte) xgb.Event {
v := GravityNotifyEvent{}
b := 1 // don't read event number
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Event = Window(xgb.Get32(buf[b:]))
b += 4
v.Window = Window(xgb.Get32(buf[b:]))
b += 4
v.X = int16(xgb.Get16(buf[b:]))
b += 2
v.Y = int16(xgb.Get16(buf[b:]))
b += 2
return v
}
// Bytes writes a GravityNotifyEvent value to a byte slice.
func (v GravityNotifyEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 24
b += 1
b += 1 // padding
b += 2 // skip sequence number
xgb.Put32(buf[b:], uint32(v.Event))
b += 4
xgb.Put32(buf[b:], uint32(v.Window))
b += 4
xgb.Put16(buf[b:], uint16(v.X))
b += 2
xgb.Put16(buf[b:], uint16(v.Y))
b += 2
return buf
}
// SequenceId returns the sequence id attached to the GravityNotify event.
// Events without a sequence number (KeymapNotify) return 0.
// This is mostly used internally.
func (v GravityNotifyEvent) SequenceId() uint16 {
return v.Sequence
}
// String is a rudimentary string representation of GravityNotifyEvent.
func (v GravityNotifyEvent) String() string {
fieldVals := make([]string, 0, 5)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("Event: %d", v.Event))
fieldVals = append(fieldVals, xgb.Sprintf("Window: %d", v.Window))
fieldVals = append(fieldVals, xgb.Sprintf("X: %d", v.X))
fieldVals = append(fieldVals, xgb.Sprintf("Y: %d", v.Y))
return "GravityNotify {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewEventFuncs[24] = GravityNotifyEventNew
}
const (
GxClear = 0
GxAnd = 1
GxAndReverse = 2
GxCopy = 3
GxAndInverted = 4
GxNoop = 5
GxXor = 6
GxOr = 7
GxNor = 8
GxEquiv = 9
GxInvert = 10
GxOrReverse = 11
GxCopyInverted = 12
GxOrInverted = 13
GxNand = 14
GxSet = 15
)
type Host struct {
Family byte
// padding: 1 bytes
AddressLen uint16
Address []byte // size: xgb.Pad((int(AddressLen) * 1))
}
// HostRead reads a byte slice into a Host value.
func HostRead(buf []byte, v *Host) int {
b := 0
v.Family = buf[b]
b += 1
b += 1 // padding
v.AddressLen = xgb.Get16(buf[b:])
b += 2
v.Address = make([]byte, v.AddressLen)
copy(v.Address[:v.AddressLen], buf[b:])
b += int(v.AddressLen)
return b
}
// HostReadList reads a byte slice into a list of Host values.
func HostReadList(buf []byte, dest []Host) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = Host{}
b += HostRead(buf[b:], &dest[i])
}
return xgb.Pad(b)
}
// Bytes writes a Host value to a byte slice.
func (v Host) Bytes() []byte {
buf := make([]byte, (4 + xgb.Pad((int(v.AddressLen) * 1))))
b := 0
buf[b] = v.Family
b += 1
b += 1 // padding
xgb.Put16(buf[b:], v.AddressLen)
b += 2
copy(buf[b:], v.Address[:v.AddressLen])
b += int(v.AddressLen)
return buf[:b]
}
// HostListBytes writes a list of Host values to a byte slice.
func HostListBytes(buf []byte, list []Host) int {
b := 0
var structBytes []byte
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
b += len(structBytes)
}
return xgb.Pad(b)
}
// HostListSize computes the size (bytes) of a list of Host values.
func HostListSize(list []Host) int {
size := 0
for _, item := range list {
size += (4 + xgb.Pad((int(item.AddressLen) * 1)))
}
return size
}
const (
HostModeInsert = 0
HostModeDelete = 1
)
// BadIDChoice is the error number for a BadIDChoice.
const BadIDChoice = 14
type IDChoiceError ValueError
// IDChoiceErrorNew constructs a IDChoiceError value that implements xgb.Error from a byte slice.
func IDChoiceErrorNew(buf []byte) xgb.Error {
v := IDChoiceError(ValueErrorNew(buf).(ValueError))
v.NiceName = "IDChoice"
return v
}
// SequenceId returns the sequence id attached to the BadIDChoice error.
// This is mostly used internally.
func (err IDChoiceError) SequenceId() uint16 {
return err.Sequence
}
// BadId returns the 'BadValue' number if one exists for the BadIDChoice error. If no bad value exists, 0 is returned.
func (err IDChoiceError) BadId() uint32 {
return err.BadValue
}
// Error returns a rudimentary string representation of the BadIDChoice error.
func (err IDChoiceError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode))
return "BadIDChoice {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewErrorFuncs[14] = IDChoiceErrorNew
}
const (
ImageFormatXYBitmap = 0
ImageFormatXYPixmap = 1
ImageFormatZPixmap = 2
)
const (
ImageOrderLSBFirst = 0
ImageOrderMSBFirst = 1
)
// BadImplementation is the error number for a BadImplementation.
const BadImplementation = 17
type ImplementationError RequestError
// ImplementationErrorNew constructs a ImplementationError value that implements xgb.Error from a byte slice.
func ImplementationErrorNew(buf []byte) xgb.Error {
v := ImplementationError(RequestErrorNew(buf).(RequestError))
v.NiceName = "Implementation"
return v
}
// SequenceId returns the sequence id attached to the BadImplementation error.
// This is mostly used internally.
func (err ImplementationError) SequenceId() uint16 {
return err.Sequence
}
// BadId returns the 'BadValue' number if one exists for the BadImplementation error. If no bad value exists, 0 is returned.
func (err ImplementationError) BadId() uint32 {
return err.BadValue
}
// Error returns a rudimentary string representation of the BadImplementation error.
func (err ImplementationError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode))
return "BadImplementation {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewErrorFuncs[17] = ImplementationErrorNew
}
const (
InputFocusNone = 0
InputFocusPointerRoot = 1
InputFocusParent = 2
InputFocusFollowKeyboard = 3
)
const (
JoinStyleMiter = 0
JoinStyleRound = 1
JoinStyleBevel = 2
)
const (
KbKeyClickPercent = 1
KbBellPercent = 2
KbBellPitch = 4
KbBellDuration = 8
KbLed = 16
KbLedMode = 32
KbKey = 64
KbAutoRepeatMode = 128
)
const (
KeyButMaskShift = 1
KeyButMaskLock = 2
KeyButMaskControl = 4
KeyButMaskMod1 = 8
KeyButMaskMod2 = 16
KeyButMaskMod3 = 32
KeyButMaskMod4 = 64
KeyButMaskMod5 = 128
KeyButMaskButton1 = 256
KeyButMaskButton2 = 512
KeyButMaskButton3 = 1024
KeyButMaskButton4 = 2048
KeyButMaskButton5 = 4096
)
// KeyPress is the event number for a KeyPressEvent.
const KeyPress = 2
type KeyPressEvent struct {
Sequence uint16
Detail Keycode
Time Timestamp
Root Window
Event Window
Child Window
RootX int16
RootY int16
EventX int16
EventY int16
State uint16
SameScreen bool
// padding: 1 bytes
}
// KeyPressEventNew constructs a KeyPressEvent value that implements xgb.Event from a byte slice.
func KeyPressEventNew(buf []byte) xgb.Event {
v := KeyPressEvent{}
b := 1 // don't read event number
v.Detail = Keycode(buf[b])
b += 1
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Time = Timestamp(xgb.Get32(buf[b:]))
b += 4
v.Root = Window(xgb.Get32(buf[b:]))
b += 4
v.Event = Window(xgb.Get32(buf[b:]))
b += 4
v.Child = Window(xgb.Get32(buf[b:]))
b += 4
v.RootX = int16(xgb.Get16(buf[b:]))
b += 2
v.RootY = int16(xgb.Get16(buf[b:]))
b += 2
v.EventX = int16(xgb.Get16(buf[b:]))
b += 2
v.EventY = int16(xgb.Get16(buf[b:]))
b += 2
v.State = xgb.Get16(buf[b:])
b += 2
if buf[b] == 1 {
v.SameScreen = true
} else {
v.SameScreen = false
}
b += 1
b += 1 // padding
return v
}
// Bytes writes a KeyPressEvent value to a byte slice.
func (v KeyPressEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 2
b += 1
buf[b] = byte(v.Detail)
b += 1
b += 2 // skip sequence number
xgb.Put32(buf[b:], uint32(v.Time))
b += 4
xgb.Put32(buf[b:], uint32(v.Root))
b += 4
xgb.Put32(buf[b:], uint32(v.Event))
b += 4
xgb.Put32(buf[b:], uint32(v.Child))
b += 4
xgb.Put16(buf[b:], uint16(v.RootX))
b += 2
xgb.Put16(buf[b:], uint16(v.RootY))
b += 2
xgb.Put16(buf[b:], uint16(v.EventX))
b += 2
xgb.Put16(buf[b:], uint16(v.EventY))
b += 2
xgb.Put16(buf[b:], v.State)
b += 2
if v.SameScreen {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
b += 1 // padding
return buf
}
// SequenceId returns the sequence id attached to the KeyPress event.
// Events without a sequence number (KeymapNotify) return 0.
// This is mostly used internally.
func (v KeyPressEvent) SequenceId() uint16 {
return v.Sequence
}
// String is a rudimentary string representation of KeyPressEvent.
func (v KeyPressEvent) String() string {
fieldVals := make([]string, 0, 12)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("Detail: %d", v.Detail))
fieldVals = append(fieldVals, xgb.Sprintf("Time: %d", v.Time))
fieldVals = append(fieldVals, xgb.Sprintf("Root: %d", v.Root))
fieldVals = append(fieldVals, xgb.Sprintf("Event: %d", v.Event))
fieldVals = append(fieldVals, xgb.Sprintf("Child: %d", v.Child))
fieldVals = append(fieldVals, xgb.Sprintf("RootX: %d", v.RootX))
fieldVals = append(fieldVals, xgb.Sprintf("RootY: %d", v.RootY))
fieldVals = append(fieldVals, xgb.Sprintf("EventX: %d", v.EventX))
fieldVals = append(fieldVals, xgb.Sprintf("EventY: %d", v.EventY))
fieldVals = append(fieldVals, xgb.Sprintf("State: %d", v.State))
fieldVals = append(fieldVals, xgb.Sprintf("SameScreen: %t", v.SameScreen))
return "KeyPress {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewEventFuncs[2] = KeyPressEventNew
}
// KeyRelease is the event number for a KeyReleaseEvent.
const KeyRelease = 3
type KeyReleaseEvent KeyPressEvent
// KeyReleaseEventNew constructs a KeyReleaseEvent value that implements xgb.Event from a byte slice.
func KeyReleaseEventNew(buf []byte) xgb.Event {
return KeyReleaseEvent(KeyPressEventNew(buf).(KeyPressEvent))
}
// Bytes writes a KeyReleaseEvent value to a byte slice.
func (v KeyReleaseEvent) Bytes() []byte {
return KeyPressEvent(v).Bytes()
}
// SequenceId returns the sequence id attached to the KeyRelease event.
// Events without a sequence number (KeymapNotify) return 0.
// This is mostly used internally.
func (v KeyReleaseEvent) SequenceId() uint16 {
return v.Sequence
}
func (v KeyReleaseEvent) String() string {
fieldVals := make([]string, 0, 12)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("Detail: %d", v.Detail))
fieldVals = append(fieldVals, xgb.Sprintf("Time: %d", v.Time))
fieldVals = append(fieldVals, xgb.Sprintf("Root: %d", v.Root))
fieldVals = append(fieldVals, xgb.Sprintf("Event: %d", v.Event))
fieldVals = append(fieldVals, xgb.Sprintf("Child: %d", v.Child))
fieldVals = append(fieldVals, xgb.Sprintf("RootX: %d", v.RootX))
fieldVals = append(fieldVals, xgb.Sprintf("RootY: %d", v.RootY))
fieldVals = append(fieldVals, xgb.Sprintf("EventX: %d", v.EventX))
fieldVals = append(fieldVals, xgb.Sprintf("EventY: %d", v.EventY))
fieldVals = append(fieldVals, xgb.Sprintf("State: %d", v.State))
fieldVals = append(fieldVals, xgb.Sprintf("SameScreen: %t", v.SameScreen))
return "KeyRelease {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewEventFuncs[3] = KeyReleaseEventNew
}
type Keycode byte
// KeymapNotify is the event number for a KeymapNotifyEvent.
const KeymapNotify = 11
type KeymapNotifyEvent struct {
Keys []byte // size: 32
}
// KeymapNotifyEventNew constructs a KeymapNotifyEvent value that implements xgb.Event from a byte slice.
func KeymapNotifyEventNew(buf []byte) xgb.Event {
v := KeymapNotifyEvent{}
b := 1 // don't read event number
v.Keys = make([]byte, 31)
copy(v.Keys[:31], buf[b:])
b += int(31)
return v
}
// Bytes writes a KeymapNotifyEvent value to a byte slice.
func (v KeymapNotifyEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 11
b += 1
copy(buf[b:], v.Keys[:31])
b += int(31)
return buf
}
// SequenceId returns the sequence id attached to the KeymapNotify event.
// Events without a sequence number (KeymapNotify) return 0.
// This is mostly used internally.
func (v KeymapNotifyEvent) SequenceId() uint16 {
return uint16(0)
}
// String is a rudimentary string representation of KeymapNotifyEvent.
func (v KeymapNotifyEvent) String() string {
fieldVals := make([]string, 0, 1)
return "KeymapNotify {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewEventFuncs[11] = KeymapNotifyEventNew
}
type Keysym uint32
const (
KillAllTemporary = 0
)
// LeaveNotify is the event number for a LeaveNotifyEvent.
const LeaveNotify = 8
type LeaveNotifyEvent EnterNotifyEvent
// LeaveNotifyEventNew constructs a LeaveNotifyEvent value that implements xgb.Event from a byte slice.
func LeaveNotifyEventNew(buf []byte) xgb.Event {
return LeaveNotifyEvent(EnterNotifyEventNew(buf).(EnterNotifyEvent))
}
// Bytes writes a LeaveNotifyEvent value to a byte slice.
func (v LeaveNotifyEvent) Bytes() []byte {
return EnterNotifyEvent(v).Bytes()
}
// SequenceId returns the sequence id attached to the LeaveNotify event.
// Events without a sequence number (KeymapNotify) return 0.
// This is mostly used internally.
func (v LeaveNotifyEvent) SequenceId() uint16 {
return v.Sequence
}
func (v LeaveNotifyEvent) String() string {
fieldVals := make([]string, 0, 12)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("Detail: %d", v.Detail))
fieldVals = append(fieldVals, xgb.Sprintf("Time: %d", v.Time))
fieldVals = append(fieldVals, xgb.Sprintf("Root: %d", v.Root))
fieldVals = append(fieldVals, xgb.Sprintf("Event: %d", v.Event))
fieldVals = append(fieldVals, xgb.Sprintf("Child: %d", v.Child))
fieldVals = append(fieldVals, xgb.Sprintf("RootX: %d", v.RootX))
fieldVals = append(fieldVals, xgb.Sprintf("RootY: %d", v.RootY))
fieldVals = append(fieldVals, xgb.Sprintf("EventX: %d", v.EventX))
fieldVals = append(fieldVals, xgb.Sprintf("EventY: %d", v.EventY))
fieldVals = append(fieldVals, xgb.Sprintf("State: %d", v.State))
fieldVals = append(fieldVals, xgb.Sprintf("Mode: %d", v.Mode))
fieldVals = append(fieldVals, xgb.Sprintf("SameScreenFocus: %d", v.SameScreenFocus))
return "LeaveNotify {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewEventFuncs[8] = LeaveNotifyEventNew
}
const (
LedModeOff = 0
LedModeOn = 1
)
// BadLength is the error number for a BadLength.
const BadLength = 16
type LengthError RequestError
// LengthErrorNew constructs a LengthError value that implements xgb.Error from a byte slice.
func LengthErrorNew(buf []byte) xgb.Error {
v := LengthError(RequestErrorNew(buf).(RequestError))
v.NiceName = "Length"
return v
}
// SequenceId returns the sequence id attached to the BadLength error.
// This is mostly used internally.
func (err LengthError) SequenceId() uint16 {
return err.Sequence
}
// BadId returns the 'BadValue' number if one exists for the BadLength error. If no bad value exists, 0 is returned.
func (err LengthError) BadId() uint32 {
return err.BadValue
}
// Error returns a rudimentary string representation of the BadLength error.
func (err LengthError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode))
return "BadLength {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewErrorFuncs[16] = LengthErrorNew
}
const (
LineStyleSolid = 0
LineStyleOnOffDash = 1
LineStyleDoubleDash = 2
)
const (
MapIndexShift = 0
MapIndexLock = 1
MapIndexControl = 2
MapIndex1 = 3
MapIndex2 = 4
MapIndex3 = 5
MapIndex4 = 6
MapIndex5 = 7
)
// MapNotify is the event number for a MapNotifyEvent.
const MapNotify = 19
type MapNotifyEvent struct {
Sequence uint16
// padding: 1 bytes
Event Window
Window Window
OverrideRedirect bool
// padding: 3 bytes
}
// MapNotifyEventNew constructs a MapNotifyEvent value that implements xgb.Event from a byte slice.
func MapNotifyEventNew(buf []byte) xgb.Event {
v := MapNotifyEvent{}
b := 1 // don't read event number
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Event = Window(xgb.Get32(buf[b:]))
b += 4
v.Window = Window(xgb.Get32(buf[b:]))
b += 4
if buf[b] == 1 {
v.OverrideRedirect = true
} else {
v.OverrideRedirect = false
}
b += 1
b += 3 // padding
return v
}
// Bytes writes a MapNotifyEvent value to a byte slice.
func (v MapNotifyEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 19
b += 1
b += 1 // padding
b += 2 // skip sequence number
xgb.Put32(buf[b:], uint32(v.Event))
b += 4
xgb.Put32(buf[b:], uint32(v.Window))
b += 4
if v.OverrideRedirect {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
b += 3 // padding
return buf
}
// SequenceId returns the sequence id attached to the MapNotify event.
// Events without a sequence number (KeymapNotify) return 0.
// This is mostly used internally.
func (v MapNotifyEvent) SequenceId() uint16 {
return v.Sequence
}
// String is a rudimentary string representation of MapNotifyEvent.
func (v MapNotifyEvent) String() string {
fieldVals := make([]string, 0, 5)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("Event: %d", v.Event))
fieldVals = append(fieldVals, xgb.Sprintf("Window: %d", v.Window))
fieldVals = append(fieldVals, xgb.Sprintf("OverrideRedirect: %t", v.OverrideRedirect))
return "MapNotify {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewEventFuncs[19] = MapNotifyEventNew
}
// MapRequest is the event number for a MapRequestEvent.
const MapRequest = 20
type MapRequestEvent struct {
Sequence uint16
// padding: 1 bytes
Parent Window
Window Window
}
// MapRequestEventNew constructs a MapRequestEvent value that implements xgb.Event from a byte slice.
func MapRequestEventNew(buf []byte) xgb.Event {
v := MapRequestEvent{}
b := 1 // don't read event number
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Parent = Window(xgb.Get32(buf[b:]))
b += 4
v.Window = Window(xgb.Get32(buf[b:]))
b += 4
return v
}
// Bytes writes a MapRequestEvent value to a byte slice.
func (v MapRequestEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 20
b += 1
b += 1 // padding
b += 2 // skip sequence number
xgb.Put32(buf[b:], uint32(v.Parent))
b += 4
xgb.Put32(buf[b:], uint32(v.Window))
b += 4
return buf
}
// SequenceId returns the sequence id attached to the MapRequest event.
// Events without a sequence number (KeymapNotify) return 0.
// This is mostly used internally.
func (v MapRequestEvent) SequenceId() uint16 {
return v.Sequence
}
// String is a rudimentary string representation of MapRequestEvent.
func (v MapRequestEvent) String() string {
fieldVals := make([]string, 0, 3)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("Parent: %d", v.Parent))
fieldVals = append(fieldVals, xgb.Sprintf("Window: %d", v.Window))
return "MapRequest {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewEventFuncs[20] = MapRequestEventNew
}
const (
MapStateUnmapped = 0
MapStateUnviewable = 1
MapStateViewable = 2
)
const (
MappingModifier = 0
MappingKeyboard = 1
MappingPointer = 2
)
// MappingNotify is the event number for a MappingNotifyEvent.
const MappingNotify = 34
type MappingNotifyEvent struct {
Sequence uint16
// padding: 1 bytes
Request byte
FirstKeycode Keycode
Count byte
// padding: 1 bytes
}
// MappingNotifyEventNew constructs a MappingNotifyEvent value that implements xgb.Event from a byte slice.
func MappingNotifyEventNew(buf []byte) xgb.Event {
v := MappingNotifyEvent{}
b := 1 // don't read event number
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Request = buf[b]
b += 1
v.FirstKeycode = Keycode(buf[b])
b += 1
v.Count = buf[b]
b += 1
b += 1 // padding
return v
}
// Bytes writes a MappingNotifyEvent value to a byte slice.
func (v MappingNotifyEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 34
b += 1
b += 1 // padding
b += 2 // skip sequence number
buf[b] = v.Request
b += 1
buf[b] = byte(v.FirstKeycode)
b += 1
buf[b] = v.Count
b += 1
b += 1 // padding
return buf
}
// SequenceId returns the sequence id attached to the MappingNotify event.
// Events without a sequence number (KeymapNotify) return 0.
// This is mostly used internally.
func (v MappingNotifyEvent) SequenceId() uint16 {
return v.Sequence
}
// String is a rudimentary string representation of MappingNotifyEvent.
func (v MappingNotifyEvent) String() string {
fieldVals := make([]string, 0, 5)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("Request: %d", v.Request))
fieldVals = append(fieldVals, xgb.Sprintf("FirstKeycode: %d", v.FirstKeycode))
fieldVals = append(fieldVals, xgb.Sprintf("Count: %d", v.Count))
return "MappingNotify {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewEventFuncs[34] = MappingNotifyEventNew
}
const (
MappingStatusSuccess = 0
MappingStatusBusy = 1
MappingStatusFailure = 2
)
// BadMatch is the error number for a BadMatch.
const BadMatch = 8
type MatchError RequestError
// MatchErrorNew constructs a MatchError value that implements xgb.Error from a byte slice.
func MatchErrorNew(buf []byte) xgb.Error {
v := MatchError(RequestErrorNew(buf).(RequestError))
v.NiceName = "Match"
return v
}
// SequenceId returns the sequence id attached to the BadMatch error.
// This is mostly used internally.
func (err MatchError) SequenceId() uint16 {
return err.Sequence
}
// BadId returns the 'BadValue' number if one exists for the BadMatch error. If no bad value exists, 0 is returned.
func (err MatchError) BadId() uint32 {
return err.BadValue
}
// Error returns a rudimentary string representation of the BadMatch error.
func (err MatchError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode))
return "BadMatch {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewErrorFuncs[8] = MatchErrorNew
}
const (
ModMaskShift = 1
ModMaskLock = 2
ModMaskControl = 4
ModMask1 = 8
ModMask2 = 16
ModMask3 = 32
ModMask4 = 64
ModMask5 = 128
ModMaskAny = 32768
)
const (
MotionNormal = 0
MotionHint = 1
)
// MotionNotify is the event number for a MotionNotifyEvent.
const MotionNotify = 6
type MotionNotifyEvent struct {
Sequence uint16
Detail byte
Time Timestamp
Root Window
Event Window
Child Window
RootX int16
RootY int16
EventX int16
EventY int16
State uint16
SameScreen bool
// padding: 1 bytes
}
// MotionNotifyEventNew constructs a MotionNotifyEvent value that implements xgb.Event from a byte slice.
func MotionNotifyEventNew(buf []byte) xgb.Event {
v := MotionNotifyEvent{}
b := 1 // don't read event number
v.Detail = buf[b]
b += 1
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Time = Timestamp(xgb.Get32(buf[b:]))
b += 4
v.Root = Window(xgb.Get32(buf[b:]))
b += 4
v.Event = Window(xgb.Get32(buf[b:]))
b += 4
v.Child = Window(xgb.Get32(buf[b:]))
b += 4
v.RootX = int16(xgb.Get16(buf[b:]))
b += 2
v.RootY = int16(xgb.Get16(buf[b:]))
b += 2
v.EventX = int16(xgb.Get16(buf[b:]))
b += 2
v.EventY = int16(xgb.Get16(buf[b:]))
b += 2
v.State = xgb.Get16(buf[b:])
b += 2
if buf[b] == 1 {
v.SameScreen = true
} else {
v.SameScreen = false
}
b += 1
b += 1 // padding
return v
}
// Bytes writes a MotionNotifyEvent value to a byte slice.
func (v MotionNotifyEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 6
b += 1
buf[b] = v.Detail
b += 1
b += 2 // skip sequence number
xgb.Put32(buf[b:], uint32(v.Time))
b += 4
xgb.Put32(buf[b:], uint32(v.Root))
b += 4
xgb.Put32(buf[b:], uint32(v.Event))
b += 4
xgb.Put32(buf[b:], uint32(v.Child))
b += 4
xgb.Put16(buf[b:], uint16(v.RootX))
b += 2
xgb.Put16(buf[b:], uint16(v.RootY))
b += 2
xgb.Put16(buf[b:], uint16(v.EventX))
b += 2
xgb.Put16(buf[b:], uint16(v.EventY))
b += 2
xgb.Put16(buf[b:], v.State)
b += 2
if v.SameScreen {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
b += 1 // padding
return buf
}
// SequenceId returns the sequence id attached to the MotionNotify event.
// Events without a sequence number (KeymapNotify) return 0.
// This is mostly used internally.
func (v MotionNotifyEvent) SequenceId() uint16 {
return v.Sequence
}
// String is a rudimentary string representation of MotionNotifyEvent.
func (v MotionNotifyEvent) String() string {
fieldVals := make([]string, 0, 12)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("Detail: %d", v.Detail))
fieldVals = append(fieldVals, xgb.Sprintf("Time: %d", v.Time))
fieldVals = append(fieldVals, xgb.Sprintf("Root: %d", v.Root))
fieldVals = append(fieldVals, xgb.Sprintf("Event: %d", v.Event))
fieldVals = append(fieldVals, xgb.Sprintf("Child: %d", v.Child))
fieldVals = append(fieldVals, xgb.Sprintf("RootX: %d", v.RootX))
fieldVals = append(fieldVals, xgb.Sprintf("RootY: %d", v.RootY))
fieldVals = append(fieldVals, xgb.Sprintf("EventX: %d", v.EventX))
fieldVals = append(fieldVals, xgb.Sprintf("EventY: %d", v.EventY))
fieldVals = append(fieldVals, xgb.Sprintf("State: %d", v.State))
fieldVals = append(fieldVals, xgb.Sprintf("SameScreen: %t", v.SameScreen))
return "MotionNotify {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewEventFuncs[6] = MotionNotifyEventNew
}
// BadName is the error number for a BadName.
const BadName = 15
type NameError RequestError
// NameErrorNew constructs a NameError value that implements xgb.Error from a byte slice.
func NameErrorNew(buf []byte) xgb.Error {
v := NameError(RequestErrorNew(buf).(RequestError))
v.NiceName = "Name"
return v
}
// SequenceId returns the sequence id attached to the BadName error.
// This is mostly used internally.
func (err NameError) SequenceId() uint16 {
return err.Sequence
}
// BadId returns the 'BadValue' number if one exists for the BadName error. If no bad value exists, 0 is returned.
func (err NameError) BadId() uint32 {
return err.BadValue
}
// Error returns a rudimentary string representation of the BadName error.
func (err NameError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode))
return "BadName {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewErrorFuncs[15] = NameErrorNew
}
// NoExposure is the event number for a NoExposureEvent.
const NoExposure = 14
type NoExposureEvent struct {
Sequence uint16
// padding: 1 bytes
Drawable Drawable
MinorOpcode uint16
MajorOpcode byte
// padding: 1 bytes
}
// NoExposureEventNew constructs a NoExposureEvent value that implements xgb.Event from a byte slice.
func NoExposureEventNew(buf []byte) xgb.Event {
v := NoExposureEvent{}
b := 1 // don't read event number
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Drawable = Drawable(xgb.Get32(buf[b:]))
b += 4
v.MinorOpcode = xgb.Get16(buf[b:])
b += 2
v.MajorOpcode = buf[b]
b += 1
b += 1 // padding
return v
}
// Bytes writes a NoExposureEvent value to a byte slice.
func (v NoExposureEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 14
b += 1
b += 1 // padding
b += 2 // skip sequence number
xgb.Put32(buf[b:], uint32(v.Drawable))
b += 4
xgb.Put16(buf[b:], v.MinorOpcode)
b += 2
buf[b] = v.MajorOpcode
b += 1
b += 1 // padding
return buf
}
// SequenceId returns the sequence id attached to the NoExposure event.
// Events without a sequence number (KeymapNotify) return 0.
// This is mostly used internally.
func (v NoExposureEvent) SequenceId() uint16 {
return v.Sequence
}
// String is a rudimentary string representation of NoExposureEvent.
func (v NoExposureEvent) String() string {
fieldVals := make([]string, 0, 5)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("Drawable: %d", v.Drawable))
fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", v.MinorOpcode))
fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", v.MajorOpcode))
return "NoExposure {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewEventFuncs[14] = NoExposureEventNew
}
const (
NotifyDetailAncestor = 0
NotifyDetailVirtual = 1
NotifyDetailInferior = 2
NotifyDetailNonlinear = 3
NotifyDetailNonlinearVirtual = 4
NotifyDetailPointer = 5
NotifyDetailPointerRoot = 6
NotifyDetailNone = 7
)
const (
NotifyModeNormal = 0
NotifyModeGrab = 1
NotifyModeUngrab = 2
NotifyModeWhileGrabbed = 3
)
type Pixmap uint32
func NewPixmapId(c *xgb.Conn) (Pixmap, error) {
id, err := c.NewId()
if err != nil {
return 0, err
}
return Pixmap(id), nil
}
// BadPixmap is the error number for a BadPixmap.
const BadPixmap = 4
type PixmapError ValueError
// PixmapErrorNew constructs a PixmapError value that implements xgb.Error from a byte slice.
func PixmapErrorNew(buf []byte) xgb.Error {
v := PixmapError(ValueErrorNew(buf).(ValueError))
v.NiceName = "Pixmap"
return v
}
// SequenceId returns the sequence id attached to the BadPixmap error.
// This is mostly used internally.
func (err PixmapError) SequenceId() uint16 {
return err.Sequence
}
// BadId returns the 'BadValue' number if one exists for the BadPixmap error. If no bad value exists, 0 is returned.
func (err PixmapError) BadId() uint32 {
return err.BadValue
}
// Error returns a rudimentary string representation of the BadPixmap error.
func (err PixmapError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode))
return "BadPixmap {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewErrorFuncs[4] = PixmapErrorNew
}
const (
PixmapNone = 0
)
const (
PlaceOnTop = 0
PlaceOnBottom = 1
)
type Point struct {
X int16
Y int16
}
// PointRead reads a byte slice into a Point value.
func PointRead(buf []byte, v *Point) int {
b := 0
v.X = int16(xgb.Get16(buf[b:]))
b += 2
v.Y = int16(xgb.Get16(buf[b:]))
b += 2
return b
}
// PointReadList reads a byte slice into a list of Point values.
func PointReadList(buf []byte, dest []Point) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = Point{}
b += PointRead(buf[b:], &dest[i])
}
return xgb.Pad(b)
}
// Bytes writes a Point value to a byte slice.
func (v Point) Bytes() []byte {
buf := make([]byte, 4)
b := 0
xgb.Put16(buf[b:], uint16(v.X))
b += 2
xgb.Put16(buf[b:], uint16(v.Y))
b += 2
return buf[:b]
}
// PointListBytes writes a list of Point values to a byte slice.
func PointListBytes(buf []byte, list []Point) int {
b := 0
var structBytes []byte
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
b += len(structBytes)
}
return xgb.Pad(b)
}
const (
PolyShapeComplex = 0
PolyShapeNonconvex = 1
PolyShapeConvex = 2
)
const (
PropModeReplace = 0
PropModePrepend = 1
PropModeAppend = 2
)
const (
PropertyNewValue = 0
PropertyDelete = 1
)
// PropertyNotify is the event number for a PropertyNotifyEvent.
const PropertyNotify = 28
type PropertyNotifyEvent struct {
Sequence uint16
// padding: 1 bytes
Window Window
Atom Atom
Time Timestamp
State byte
// padding: 3 bytes
}
// PropertyNotifyEventNew constructs a PropertyNotifyEvent value that implements xgb.Event from a byte slice.
func PropertyNotifyEventNew(buf []byte) xgb.Event {
v := PropertyNotifyEvent{}
b := 1 // don't read event number
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Window = Window(xgb.Get32(buf[b:]))
b += 4
v.Atom = Atom(xgb.Get32(buf[b:]))
b += 4
v.Time = Timestamp(xgb.Get32(buf[b:]))
b += 4
v.State = buf[b]
b += 1
b += 3 // padding
return v
}
// Bytes writes a PropertyNotifyEvent value to a byte slice.
func (v PropertyNotifyEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 28
b += 1
b += 1 // padding
b += 2 // skip sequence number
xgb.Put32(buf[b:], uint32(v.Window))
b += 4
xgb.Put32(buf[b:], uint32(v.Atom))
b += 4
xgb.Put32(buf[b:], uint32(v.Time))
b += 4
buf[b] = v.State
b += 1
b += 3 // padding
return buf
}
// SequenceId returns the sequence id attached to the PropertyNotify event.
// Events without a sequence number (KeymapNotify) return 0.
// This is mostly used internally.
func (v PropertyNotifyEvent) SequenceId() uint16 {
return v.Sequence
}
// String is a rudimentary string representation of PropertyNotifyEvent.
func (v PropertyNotifyEvent) String() string {
fieldVals := make([]string, 0, 6)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("Window: %d", v.Window))
fieldVals = append(fieldVals, xgb.Sprintf("Atom: %d", v.Atom))
fieldVals = append(fieldVals, xgb.Sprintf("Time: %d", v.Time))
fieldVals = append(fieldVals, xgb.Sprintf("State: %d", v.State))
return "PropertyNotify {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewEventFuncs[28] = PropertyNotifyEventNew
}
const (
QueryShapeOfLargestCursor = 0
QueryShapeOfFastestTile = 1
QueryShapeOfFastestStipple = 2
)
type Rectangle struct {
X int16
Y int16
Width uint16
Height uint16
}
// RectangleRead reads a byte slice into a Rectangle value.
func RectangleRead(buf []byte, v *Rectangle) int {
b := 0
v.X = int16(xgb.Get16(buf[b:]))
b += 2
v.Y = int16(xgb.Get16(buf[b:]))
b += 2
v.Width = xgb.Get16(buf[b:])
b += 2
v.Height = xgb.Get16(buf[b:])
b += 2
return b
}
// RectangleReadList reads a byte slice into a list of Rectangle values.
func RectangleReadList(buf []byte, dest []Rectangle) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = Rectangle{}
b += RectangleRead(buf[b:], &dest[i])
}
return xgb.Pad(b)
}
// Bytes writes a Rectangle value to a byte slice.
func (v Rectangle) Bytes() []byte {
buf := make([]byte, 8)
b := 0
xgb.Put16(buf[b:], uint16(v.X))
b += 2
xgb.Put16(buf[b:], uint16(v.Y))
b += 2
xgb.Put16(buf[b:], v.Width)
b += 2
xgb.Put16(buf[b:], v.Height)