diff options
author | Andrew Gallant (Ocelot) <Andrew.Gallant@tufts.edu> | 2012-05-06 03:06:48 -0400 |
---|---|---|
committer | Andrew Gallant (Ocelot) <Andrew.Gallant@tufts.edu> | 2012-05-06 03:06:48 -0400 |
commit | 135cee57610cccd10009b264cce7fbcd5af367cb (patch) | |
tree | aa4bb450d28eff241e35978233613436edafe045 /nexgb | |
parent | 70ebcf5178018a31378367f67542fc89980e62a2 (diff) | |
download | haven-135cee57610cccd10009b264cce7fbcd5af367cb.tar.gz haven-135cee57610cccd10009b264cce7fbcd5af367cb.tar.xz haven-135cee57610cccd10009b264cce7fbcd5af367cb.zip |
auto-generated Go code ftw. ~65,000 lines. woooheee
Diffstat (limited to 'nexgb')
-rw-r--r-- | nexgb/auto_bigreq.go | 112 | ||||
-rw-r--r-- | nexgb/auto_composite.go | 555 | ||||
-rw-r--r-- | nexgb/auto_damage.go | 479 | ||||
-rw-r--r-- | nexgb/auto_dpms.go | 574 | ||||
-rw-r--r-- | nexgb/auto_dri2.go | 1534 | ||||
-rw-r--r-- | nexgb/auto_ge.go | 125 | ||||
-rw-r--r-- | nexgb/auto_glx.go | 9356 | ||||
-rw-r--r-- | nexgb/auto_randr.go | 14 | ||||
-rw-r--r-- | nexgb/auto_record.go | 1061 | ||||
-rw-r--r-- | nexgb/auto_render.go | 26 | ||||
-rw-r--r-- | nexgb/auto_res.go | 502 | ||||
-rw-r--r-- | nexgb/auto_screensaver.go | 601 | ||||
-rw-r--r-- | nexgb/auto_shape.go | 871 | ||||
-rw-r--r-- | nexgb/auto_shm.go | 644 | ||||
-rw-r--r-- | nexgb/auto_sync.go | 1899 | ||||
-rw-r--r-- | nexgb/auto_xc_misc.go | 300 | ||||
-rw-r--r-- | nexgb/auto_xevie.go | 513 | ||||
-rw-r--r-- | nexgb/auto_xf86dri.go | 1125 | ||||
-rw-r--r-- | nexgb/auto_xf86vidmode.go | 2372 | ||||
-rw-r--r-- | nexgb/auto_xfixes.go | 2139 | ||||
-rw-r--r-- | nexgb/auto_xinerama.go | 46 | ||||
-rw-r--r-- | nexgb/auto_xinput.go | 7271 | ||||
-rw-r--r-- | nexgb/auto_xprint.go | 2176 | ||||
-rw-r--r-- | nexgb/auto_xproto.go | 36 | ||||
-rw-r--r-- | nexgb/auto_xselinux.go | 1939 | ||||
-rw-r--r-- | nexgb/auto_xtest.go | 335 | ||||
-rw-r--r-- | nexgb/auto_xv.go | 2738 | ||||
-rw-r--r-- | nexgb/auto_xvmc.go | 879 |
28 files changed, 40161 insertions, 61 deletions
diff --git a/nexgb/auto_bigreq.go b/nexgb/auto_bigreq.go new file mode 100644 index 0000000..d008bce --- /dev/null +++ b/nexgb/auto_bigreq.go @@ -0,0 +1,112 @@ +package xgb + +/* + This file was generated by bigreq.xml on May 6 2012 3:00:43am EDT. + This file is automatically generated. Edit at your peril! +*/ + +// Skipping definition for base type 'Float' + +// Skipping definition for base type 'Id' + +// Skipping definition for base type 'Card8' + +// Skipping definition for base type 'Int16' + +// Skipping definition for base type 'Int32' + +// Skipping definition for base type 'Void' + +// Skipping definition for base type 'Byte' + +// Skipping definition for base type 'Int8' + +// Skipping definition for base type 'Card16' + +// Skipping definition for base type 'Char' + +// Skipping definition for base type 'Card32' + +// Skipping definition for base type 'Double' + +// Skipping definition for base type 'Bool' + +// Request BigreqEnable +// size: 4 +type BigreqEnableCookie struct { + *cookie +} + +func (c *Conn) BigreqEnable() BigreqEnableCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.bigreqEnableRequest(), cookie) + return BigreqEnableCookie{cookie} +} + +func (c *Conn) BigreqEnableUnchecked() BigreqEnableCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.bigreqEnableRequest(), cookie) + return BigreqEnableCookie{cookie} +} + +// Request reply for BigreqEnable +// size: 12 +type BigreqEnableReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + MaximumRequestLength uint32 +} + +// Waits and reads reply data from request BigreqEnable +func (cook BigreqEnableCookie) Reply() (*BigreqEnableReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return bigreqEnableReply(buf), nil +} + +// Read reply into structure from buffer for BigreqEnable +func bigreqEnableReply(buf []byte) *BigreqEnableReply { + v := new(BigreqEnableReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.MaximumRequestLength = Get32(buf[b:]) + b += 4 + + return v +} + +func (cook BigreqEnableCookie) Check() error { + return cook.check() +} + +// Write request to wire for BigreqEnable +func (c *Conn) bigreqEnableRequest() []byte { + size := 4 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["BIG-REQUESTS"] + b += 1 + + buf[b] = 0 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + return buf +} diff --git a/nexgb/auto_composite.go b/nexgb/auto_composite.go new file mode 100644 index 0000000..185e425 --- /dev/null +++ b/nexgb/auto_composite.go @@ -0,0 +1,555 @@ +package xgb + +/* + This file was generated by composite.xml on May 6 2012 3:00:43am EDT. + This file is automatically generated. Edit at your peril! +*/ + +// Imports are not necessary for XGB because everything is +// in one package. They are still listed here for reference. +// import "xproto" +// import "xfixes" + +// Skipping definition for base type 'Float' + +// Skipping definition for base type 'Id' + +// Skipping definition for base type 'Card8' + +// Skipping definition for base type 'Int16' + +// Skipping definition for base type 'Int32' + +// Skipping definition for base type 'Void' + +// Skipping definition for base type 'Byte' + +// Skipping definition for base type 'Int8' + +// Skipping definition for base type 'Card16' + +// Skipping definition for base type 'Char' + +// Skipping definition for base type 'Card32' + +// Skipping definition for base type 'Double' + +// Skipping definition for base type 'Bool' + +const ( + CompositeRedirectAutomatic = 0 + CompositeRedirectManual = 1 +) + +// Request CompositeQueryVersion +// size: 12 +type CompositeQueryVersionCookie struct { + *cookie +} + +func (c *Conn) CompositeQueryVersion(ClientMajorVersion uint32, ClientMinorVersion uint32) CompositeQueryVersionCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.compositeQueryVersionRequest(ClientMajorVersion, ClientMinorVersion), cookie) + return CompositeQueryVersionCookie{cookie} +} + +func (c *Conn) CompositeQueryVersionUnchecked(ClientMajorVersion uint32, ClientMinorVersion uint32) CompositeQueryVersionCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.compositeQueryVersionRequest(ClientMajorVersion, ClientMinorVersion), cookie) + return CompositeQueryVersionCookie{cookie} +} + +// Request reply for CompositeQueryVersion +// size: 32 +type CompositeQueryVersionReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + MajorVersion uint32 + MinorVersion uint32 + // padding: 16 bytes +} + +// Waits and reads reply data from request CompositeQueryVersion +func (cook CompositeQueryVersionCookie) Reply() (*CompositeQueryVersionReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return compositeQueryVersionReply(buf), nil +} + +// Read reply into structure from buffer for CompositeQueryVersion +func compositeQueryVersionReply(buf []byte) *CompositeQueryVersionReply { + v := new(CompositeQueryVersionReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.MajorVersion = Get32(buf[b:]) + b += 4 + + v.MinorVersion = Get32(buf[b:]) + b += 4 + + b += 16 // padding + + return v +} + +func (cook CompositeQueryVersionCookie) Check() error { + return cook.check() +} + +// Write request to wire for CompositeQueryVersion +func (c *Conn) compositeQueryVersionRequest(ClientMajorVersion uint32, ClientMinorVersion uint32) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["COMPOSITE"] + b += 1 + + buf[b] = 0 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], ClientMajorVersion) + b += 4 + + Put32(buf[b:], ClientMinorVersion) + b += 4 + + return buf +} + +// Request CompositeRedirectWindow +// size: 12 +type CompositeRedirectWindowCookie struct { + *cookie +} + +// Write request to wire for CompositeRedirectWindow +func (c *Conn) CompositeRedirectWindow(Window Id, Update byte) CompositeRedirectWindowCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.compositeRedirectWindowRequest(Window, Update), cookie) + return CompositeRedirectWindowCookie{cookie} +} + +func (c *Conn) CompositeRedirectWindowChecked(Window Id, Update byte) CompositeRedirectWindowCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.compositeRedirectWindowRequest(Window, Update), cookie) + return CompositeRedirectWindowCookie{cookie} +} + +func (cook CompositeRedirectWindowCookie) Check() error { + return cook.check() +} + +// Write request to wire for CompositeRedirectWindow +func (c *Conn) compositeRedirectWindowRequest(Window Id, Update byte) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["COMPOSITE"] + b += 1 + + buf[b] = 1 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Window)) + b += 4 + + buf[b] = Update + b += 1 + + b += 3 // padding + + return buf +} + +// Request CompositeRedirectSubwindows +// size: 12 +type CompositeRedirectSubwindowsCookie struct { + *cookie +} + +// Write request to wire for CompositeRedirectSubwindows +func (c *Conn) CompositeRedirectSubwindows(Window Id, Update byte) CompositeRedirectSubwindowsCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.compositeRedirectSubwindowsRequest(Window, Update), cookie) + return CompositeRedirectSubwindowsCookie{cookie} +} + +func (c *Conn) CompositeRedirectSubwindowsChecked(Window Id, Update byte) CompositeRedirectSubwindowsCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.compositeRedirectSubwindowsRequest(Window, Update), cookie) + return CompositeRedirectSubwindowsCookie{cookie} +} + +func (cook CompositeRedirectSubwindowsCookie) Check() error { + return cook.check() +} + +// Write request to wire for CompositeRedirectSubwindows +func (c *Conn) compositeRedirectSubwindowsRequest(Window Id, Update byte) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["COMPOSITE"] + b += 1 + + buf[b] = 2 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Window)) + b += 4 + + buf[b] = Update + b += 1 + + b += 3 // padding + + return buf +} + +// Request CompositeUnredirectWindow +// size: 12 +type CompositeUnredirectWindowCookie struct { + *cookie +} + +// Write request to wire for CompositeUnredirectWindow +func (c *Conn) CompositeUnredirectWindow(Window Id, Update byte) CompositeUnredirectWindowCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.compositeUnredirectWindowRequest(Window, Update), cookie) + return CompositeUnredirectWindowCookie{cookie} +} + +func (c *Conn) CompositeUnredirectWindowChecked(Window Id, Update byte) CompositeUnredirectWindowCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.compositeUnredirectWindowRequest(Window, Update), cookie) + return CompositeUnredirectWindowCookie{cookie} +} + +func (cook CompositeUnredirectWindowCookie) Check() error { + return cook.check() +} + +// Write request to wire for CompositeUnredirectWindow +func (c *Conn) compositeUnredirectWindowRequest(Window Id, Update byte) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["COMPOSITE"] + b += 1 + + buf[b] = 3 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Window)) + b += 4 + + buf[b] = Update + b += 1 + + b += 3 // padding + + return buf +} + +// Request CompositeUnredirectSubwindows +// size: 12 +type CompositeUnredirectSubwindowsCookie struct { + *cookie +} + +// Write request to wire for CompositeUnredirectSubwindows +func (c *Conn) CompositeUnredirectSubwindows(Window Id, Update byte) CompositeUnredirectSubwindowsCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.compositeUnredirectSubwindowsRequest(Window, Update), cookie) + return CompositeUnredirectSubwindowsCookie{cookie} +} + +func (c *Conn) CompositeUnredirectSubwindowsChecked(Window Id, Update byte) CompositeUnredirectSubwindowsCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.compositeUnredirectSubwindowsRequest(Window, Update), cookie) + return CompositeUnredirectSubwindowsCookie{cookie} +} + +func (cook CompositeUnredirectSubwindowsCookie) Check() error { + return cook.check() +} + +// Write request to wire for CompositeUnredirectSubwindows +func (c *Conn) compositeUnredirectSubwindowsRequest(Window Id, Update byte) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["COMPOSITE"] + b += 1 + + buf[b] = 4 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Window)) + b += 4 + + buf[b] = Update + b += 1 + + b += 3 // padding + + return buf +} + +// Request CompositeCreateRegionFromBorderClip +// size: 12 +type CompositeCreateRegionFromBorderClipCookie struct { + *cookie +} + +// Write request to wire for CompositeCreateRegionFromBorderClip +func (c *Conn) CompositeCreateRegionFromBorderClip(Region Id, Window Id) CompositeCreateRegionFromBorderClipCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.compositeCreateRegionFromBorderClipRequest(Region, Window), cookie) + return CompositeCreateRegionFromBorderClipCookie{cookie} +} + +func (c *Conn) CompositeCreateRegionFromBorderClipChecked(Region Id, Window Id) CompositeCreateRegionFromBorderClipCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.compositeCreateRegionFromBorderClipRequest(Region, Window), cookie) + return CompositeCreateRegionFromBorderClipCookie{cookie} +} + +func (cook CompositeCreateRegionFromBorderClipCookie) Check() error { + return cook.check() +} + +// Write request to wire for CompositeCreateRegionFromBorderClip +func (c *Conn) compositeCreateRegionFromBorderClipRequest(Region Id, Window Id) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["COMPOSITE"] + b += 1 + + buf[b] = 5 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Region)) + b += 4 + + Put32(buf[b:], uint32(Window)) + b += 4 + + return buf +} + +// Request CompositeNameWindowPixmap +// size: 12 +type CompositeNameWindowPixmapCookie struct { + *cookie +} + +// Write request to wire for CompositeNameWindowPixmap +func (c *Conn) CompositeNameWindowPixmap(Window Id, Pixmap Id) CompositeNameWindowPixmapCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.compositeNameWindowPixmapRequest(Window, Pixmap), cookie) + return CompositeNameWindowPixmapCookie{cookie} +} + +func (c *Conn) CompositeNameWindowPixmapChecked(Window Id, Pixmap Id) CompositeNameWindowPixmapCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.compositeNameWindowPixmapRequest(Window, Pixmap), cookie) + return CompositeNameWindowPixmapCookie{cookie} +} + +func (cook CompositeNameWindowPixmapCookie) Check() error { + return cook.check() +} + +// Write request to wire for CompositeNameWindowPixmap +func (c *Conn) compositeNameWindowPixmapRequest(Window Id, Pixmap Id) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["COMPOSITE"] + b += 1 + + buf[b] = 6 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Window)) + b += 4 + + Put32(buf[b:], uint32(Pixmap)) + b += 4 + + return buf +} + +// Request CompositeGetOverlayWindow +// size: 8 +type CompositeGetOverlayWindowCookie struct { + *cookie +} + +func (c *Conn) CompositeGetOverlayWindow(Window Id) CompositeGetOverlayWindowCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.compositeGetOverlayWindowRequest(Window), cookie) + return CompositeGetOverlayWindowCookie{cookie} +} + +func (c *Conn) CompositeGetOverlayWindowUnchecked(Window Id) CompositeGetOverlayWindowCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.compositeGetOverlayWindowRequest(Window), cookie) + return CompositeGetOverlayWindowCookie{cookie} +} + +// Request reply for CompositeGetOverlayWindow +// size: 32 +type CompositeGetOverlayWindowReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + OverlayWin Id + // padding: 20 bytes +} + +// Waits and reads reply data from request CompositeGetOverlayWindow +func (cook CompositeGetOverlayWindowCookie) Reply() (*CompositeGetOverlayWindowReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return compositeGetOverlayWindowReply(buf), nil +} + +// Read reply into structure from buffer for CompositeGetOverlayWindow +func compositeGetOverlayWindowReply(buf []byte) *CompositeGetOverlayWindowReply { + v := new(CompositeGetOverlayWindowReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.OverlayWin = Id(Get32(buf[b:])) + b += 4 + + b += 20 // padding + + return v +} + +func (cook CompositeGetOverlayWindowCookie) Check() error { + return cook.check() +} + +// Write request to wire for CompositeGetOverlayWindow +func (c *Conn) compositeGetOverlayWindowRequest(Window Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["COMPOSITE"] + b += 1 + + buf[b] = 7 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Window)) + b += 4 + + return buf +} + +// Request CompositeReleaseOverlayWindow +// size: 8 +type CompositeReleaseOverlayWindowCookie struct { + *cookie +} + +// Write request to wire for CompositeReleaseOverlayWindow +func (c *Conn) CompositeReleaseOverlayWindow(Window Id) CompositeReleaseOverlayWindowCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.compositeReleaseOverlayWindowRequest(Window), cookie) + return CompositeReleaseOverlayWindowCookie{cookie} +} + +func (c *Conn) CompositeReleaseOverlayWindowChecked(Window Id) CompositeReleaseOverlayWindowCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.compositeReleaseOverlayWindowRequest(Window), cookie) + return CompositeReleaseOverlayWindowCookie{cookie} +} + +func (cook CompositeReleaseOverlayWindowCookie) Check() error { + return cook.check() +} + +// Write request to wire for CompositeReleaseOverlayWindow +func (c *Conn) compositeReleaseOverlayWindowRequest(Window Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["COMPOSITE"] + b += 1 + + buf[b] = 8 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Window)) + b += 4 + + return buf +} diff --git a/nexgb/auto_damage.go b/nexgb/auto_damage.go new file mode 100644 index 0000000..c875016 --- /dev/null +++ b/nexgb/auto_damage.go @@ -0,0 +1,479 @@ +package xgb + +/* + This file was generated by damage.xml on May 6 2012 3:00:43am EDT. + This file is automatically generated. Edit at your peril! +*/ + +// Imports are not necessary for XGB because everything is +// in one package. They are still listed here for reference. +// import "xproto" +// import "xfixes" + +// Skipping definition for base type 'Card16' + +// Skipping definition for base type 'Char' + +// Skipping definition for base type 'Card32' + +// Skipping definition for base type 'Double' + +// Skipping definition for base type 'Bool' + +// Skipping definition for base type 'Float' + +// Skipping definition for base type 'Id' + +// Skipping definition for base type 'Card8' + +// Skipping definition for base type 'Int16' + +// Skipping definition for base type 'Int32' + +// Skipping definition for base type 'Void' + +// Skipping definition for base type 'Byte' + +// Skipping definition for base type 'Int8' + +const ( + DamageReportLevelRawRectangles = 0 + DamageReportLevelDeltaRectangles = 1 + DamageReportLevelBoundingBox = 2 + DamageReportLevelNonEmpty = 3 +) + +// Skipping resource definition of 'Damage' + +// Event definition DamageNotify (0) +// Size: 32 + +const DamageNotify = 0 + +type DamageNotifyEvent struct { + Sequence uint16 + Level byte + Drawable Id + Damage Id + Timestamp Timestamp + Area Rectangle + Geometry Rectangle +} + +// Event read DamageNotify +func NewDamageNotifyEvent(buf []byte) Event { + v := DamageNotifyEvent{} + b := 1 // don't read event number + + v.Level = buf[b] + b += 1 + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Drawable = Id(Get32(buf[b:])) + b += 4 + + v.Damage = Id(Get32(buf[b:])) + b += 4 + + v.Timestamp = Timestamp(Get32(buf[b:])) + b += 4 + + v.Area = Rectangle{} + b += ReadRectangle(buf[b:], &v.Area) + + v.Geometry = Rectangle{} + b += ReadRectangle(buf[b:], &v.Geometry) + + return v +} + +// Event write DamageNotify +func (v DamageNotifyEvent) Bytes() []byte { + buf := make([]byte, 32) + b := 0 + + // write event number + buf[b] = 0 + b += 1 + + buf[b] = v.Level + b += 1 + + b += 2 // skip sequence number + + Put32(buf[b:], uint32(v.Drawable)) + b += 4 + + Put32(buf[b:], uint32(v.Damage)) + b += 4 + + Put32(buf[b:], uint32(v.Timestamp)) + b += 4 + + { + structBytes := v.Area.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + + { + structBytes := v.Geometry.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + + return buf +} + +func (v DamageNotifyEvent) ImplementsEvent() {} + +func (v DamageNotifyEvent) SequenceId() uint16 { + return v.Sequence +} + +func (v DamageNotifyEvent) String() string { + fieldVals := make([]string, 0, 6) + fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) + fieldVals = append(fieldVals, sprintf("Level: %d", v.Level)) + fieldVals = append(fieldVals, sprintf("Drawable: %d", v.Drawable)) + fieldVals = append(fieldVals, sprintf("Damage: %d", v.Damage)) + fieldVals = append(fieldVals, sprintf("Timestamp: %d", v.Timestamp)) + return "DamageNotify {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newEventFuncs[0] = NewDamageNotifyEvent +} + +// Error definition DamageBadDamage (0) +// Size: 32 + +const BadDamageBadDamage = 0 + +type DamageBadDamageError struct { + Sequence uint16 + NiceName string +} + +// Error read DamageBadDamage +func NewDamageBadDamageError(buf []byte) Error { + v := DamageBadDamageError{} + v.NiceName = "DamageBadDamage" + + b := 1 // skip error determinant + b += 1 // don't read error number + + v.Sequence = Get16(buf[b:]) + b += 2 + + return v +} + +func (err DamageBadDamageError) ImplementsError() {} + +func (err DamageBadDamageError) SequenceId() uint16 { + return err.Sequence +} + +func (err DamageBadDamageError) BadId() Id { + return 0 +} + +func (err DamageBadDamageError) Error() string { + fieldVals := make([]string, 0, 0) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) + return "BadDamageBadDamage {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newErrorFuncs[0] = NewDamageBadDamageError +} + +// Request DamageQueryVersion +// size: 12 +type DamageQueryVersionCookie struct { + *cookie +} + +func (c *Conn) DamageQueryVersion(ClientMajorVersion uint32, ClientMinorVersion uint32) DamageQueryVersionCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.damageQueryVersionRequest(ClientMajorVersion, ClientMinorVersion), cookie) + return DamageQueryVersionCookie{cookie} +} + +func (c *Conn) DamageQueryVersionUnchecked(ClientMajorVersion uint32, ClientMinorVersion uint32) DamageQueryVersionCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.damageQueryVersionRequest(ClientMajorVersion, ClientMinorVersion), cookie) + return DamageQueryVersionCookie{cookie} +} + +// Request reply for DamageQueryVersion +// size: 32 +type DamageQueryVersionReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + MajorVersion uint32 + MinorVersion uint32 + // padding: 16 bytes +} + +// Waits and reads reply data from request DamageQueryVersion +func (cook DamageQueryVersionCookie) Reply() (*DamageQueryVersionReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return damageQueryVersionReply(buf), nil +} + +// Read reply into structure from buffer for DamageQueryVersion +func damageQueryVersionReply(buf []byte) *DamageQueryVersionReply { + v := new(DamageQueryVersionReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.MajorVersion = Get32(buf[b:]) + b += 4 + + v.MinorVersion = Get32(buf[b:]) + b += 4 + + b += 16 // padding + + return v +} + +func (cook DamageQueryVersionCookie) Check() error { + return cook.check() +} + +// Write request to wire for DamageQueryVersion +func (c *Conn) damageQueryVersionRequest(ClientMajorVersion uint32, ClientMinorVersion uint32) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["DAMAGE"] + b += 1 + + buf[b] = 0 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], ClientMajorVersion) + b += 4 + + Put32(buf[b:], ClientMinorVersion) + b += 4 + + return buf +} + +// Request DamageCreate +// size: 16 +type DamageCreateCookie struct { + *cookie +} + +// Write request to wire for DamageCreate +func (c *Conn) DamageCreate(Damage Id, Drawable Id, Level byte) DamageCreateCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.damageCreateRequest(Damage, Drawable, Level), cookie) + return DamageCreateCookie{cookie} +} + +func (c *Conn) DamageCreateChecked(Damage Id, Drawable Id, Level byte) DamageCreateCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.damageCreateRequest(Damage, Drawable, Level), cookie) + return DamageCreateCookie{cookie} +} + +func (cook DamageCreateCookie) Check() error { + return cook.check() +} + +// Write request to wire for DamageCreate +func (c *Conn) damageCreateRequest(Damage Id, Drawable Id, Level byte) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["DAMAGE"] + b += 1 + + buf[b] = 1 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Damage)) + b += 4 + + Put32(buf[b:], uint32(Drawable)) + b += 4 + + buf[b] = Level + b += 1 + + b += 3 // padding + + return buf +} + +// Request DamageDestroy +// size: 8 +type DamageDestroyCookie struct { + *cookie +} + +// Write request to wire for DamageDestroy +func (c *Conn) DamageDestroy(Damage Id) DamageDestroyCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.damageDestroyRequest(Damage), cookie) + return DamageDestroyCookie{cookie} +} + +func (c *Conn) DamageDestroyChecked(Damage Id) DamageDestroyCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.damageDestroyRequest(Damage), cookie) + return DamageDestroyCookie{cookie} +} + +func (cook DamageDestroyCookie) Check() error { + return cook.check() +} + +// Write request to wire for DamageDestroy +func (c *Conn) damageDestroyRequest(Damage Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["DAMAGE"] + b += 1 + + buf[b] = 2 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Damage)) + b += 4 + + return buf +} + +// Request DamageSubtract +// size: 16 +type DamageSubtractCookie struct { + *cookie +} + +// Write request to wire for DamageSubtract +func (c *Conn) DamageSubtract(Damage Id, Repair Id, Parts Id) DamageSubtractCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.damageSubtractRequest(Damage, Repair, Parts), cookie) + return DamageSubtractCookie{cookie} +} + +func (c *Conn) DamageSubtractChecked(Damage Id, Repair Id, Parts Id) DamageSubtractCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.damageSubtractRequest(Damage, Repair, Parts), cookie) + return DamageSubtractCookie{cookie} +} + +func (cook DamageSubtractCookie) Check() error { + return cook.check() +} + +// Write request to wire for DamageSubtract +func (c *Conn) damageSubtractRequest(Damage Id, Repair Id, Parts Id) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["DAMAGE"] + b += 1 + + buf[b] = 3 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Damage)) + b += 4 + + Put32(buf[b:], uint32(Repair)) + b += 4 + + Put32(buf[b:], uint32(Parts)) + b += 4 + + return buf +} + +// Request DamageAdd +// size: 12 +type DamageAddCookie struct { + *cookie +} + +// Write request to wire for DamageAdd +func (c *Conn) DamageAdd(Drawable Id, Region Id) DamageAddCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.damageAddRequest(Drawable, Region), cookie) + return DamageAddCookie{cookie} +} + +func (c *Conn) DamageAddChecked(Drawable Id, Region Id) DamageAddCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.damageAddRequest(Drawable, Region), cookie) + return DamageAddCookie{cookie} +} + +func (cook DamageAddCookie) Check() error { + return cook.check() +} + +// Write request to wire for DamageAdd +func (c *Conn) damageAddRequest(Drawable Id, Region Id) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["DAMAGE"] + b += 1 + + buf[b] = 4 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Drawable)) + b += 4 + + Put32(buf[b:], uint32(Region)) + b += 4 + + return buf +} diff --git a/nexgb/auto_dpms.go b/nexgb/auto_dpms.go new file mode 100644 index 0000000..a1f733b --- /dev/null +++ b/nexgb/auto_dpms.go @@ -0,0 +1,574 @@ +package xgb + +/* + This file was generated by dpms.xml on May 6 2012 3:00:44am EDT. + This file is automatically generated. Edit at your peril! +*/ + +// Skipping definition for base type 'Void' + +// Skipping definition for base type 'Byte' + +// Skipping definition for base type 'Int8' + +// Skipping definition for base type 'Card16' + +// Skipping definition for base type 'Char' + +// Skipping definition for base type 'Card32' + +// Skipping definition for base type 'Double' + +// Skipping definition for base type 'Bool' + +// Skipping definition for base type 'Float' + +// Skipping definition for base type 'Id' + +// Skipping definition for base type 'Card8' + +// Skipping definition for base type 'Int16' + +// Skipping definition for base type 'Int32' + +const ( + DpmsDPMSModeOn = 0 + DpmsDPMSModeStandby = 1 + DpmsDPMSModeSuspend = 2 + DpmsDPMSModeOff = 3 +) + +// Request DpmsGetVersion +// size: 8 +type DpmsGetVersionCookie struct { + *cookie +} + +func (c *Conn) DpmsGetVersion(ClientMajorVersion uint16, ClientMinorVersion uint16) DpmsGetVersionCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.dpmsGetVersionRequest(ClientMajorVersion, ClientMinorVersion), cookie) + return DpmsGetVersionCookie{cookie} +} + +func (c *Conn) DpmsGetVersionUnchecked(ClientMajorVersion uint16, ClientMinorVersion uint16) DpmsGetVersionCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.dpmsGetVersionRequest(ClientMajorVersion, ClientMinorVersion), cookie) + return DpmsGetVersionCookie{cookie} +} + +// Request reply for DpmsGetVersion +// size: 12 +type DpmsGetVersionReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + ServerMajorVersion uint16 + ServerMinorVersion uint16 +} + +// Waits and reads reply data from request DpmsGetVersion +func (cook DpmsGetVersionCookie) Reply() (*DpmsGetVersionReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return dpmsGetVersionReply(buf), nil +} + +// Read reply into structure from buffer for DpmsGetVersion +func dpmsGetVersionReply(buf []byte) *DpmsGetVersionReply { + v := new(DpmsGetVersionReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.ServerMajorVersion = Get16(buf[b:]) + b += 2 + + v.ServerMinorVersion = Get16(buf[b:]) + b += 2 + + return v +} + +func (cook DpmsGetVersionCookie) Check() error { + return cook.check() +} + +// Write request to wire for DpmsGetVersion +func (c *Conn) dpmsGetVersionRequest(ClientMajorVersion uint16, ClientMinorVersion uint16) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["DPMS"] + b += 1 + + buf[b] = 0 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put16(buf[b:], ClientMajorVersion) + b += 2 + + Put16(buf[b:], ClientMinorVersion) + b += 2 + + return buf +} + +// Request DpmsCapable +// size: 4 +type DpmsCapableCookie struct { + *cookie +} + +func (c *Conn) DpmsCapable() DpmsCapableCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.dpmsCapableRequest(), cookie) + return DpmsCapableCookie{cookie} +} + +func (c *Conn) DpmsCapableUnchecked() DpmsCapableCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.dpmsCapableRequest(), cookie) + return DpmsCapableCookie{cookie} +} + +// Request reply for DpmsCapable +// size: 32 +type DpmsCapableReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Capable bool + // padding: 23 bytes +} + +// Waits and reads reply data from request DpmsCapable +func (cook DpmsCapableCookie) Reply() (*DpmsCapableReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return dpmsCapableReply(buf), nil +} + +// Read reply into structure from buffer for DpmsCapable +func dpmsCapableReply(buf []byte) *DpmsCapableReply { + v := new(DpmsCapableReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + if buf[b] == 1 { + v.Capable = true + } else { + v.Capable = false + } + b += 1 + + b += 23 // padding + + return v +} + +func (cook DpmsCapableCookie) Check() error { + return cook.check() +} + +// Write request to wire for DpmsCapable +func (c *Conn) dpmsCapableRequest() []byte { + size := 4 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["DPMS"] + b += 1 + + buf[b] = 1 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + return buf +} + +// Request DpmsGetTimeouts +// size: 4 +type DpmsGetTimeoutsCookie struct { + *cookie +} + +func (c *Conn) DpmsGetTimeouts() DpmsGetTimeoutsCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.dpmsGetTimeoutsRequest(), cookie) + return DpmsGetTimeoutsCookie{cookie} +} + +func (c *Conn) DpmsGetTimeoutsUnchecked() DpmsGetTimeoutsCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.dpmsGetTimeoutsRequest(), cookie) + return DpmsGetTimeoutsCookie{cookie} +} + +// Request reply for DpmsGetTimeouts +// size: 32 +type DpmsGetTimeoutsReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + StandbyTimeout uint16 + SuspendTimeout uint16 + OffTimeout uint16 + // padding: 18 bytes +} + +// Waits and reads reply data from request DpmsGetTimeouts +func (cook DpmsGetTimeoutsCookie) Reply() (*DpmsGetTimeoutsReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return dpmsGetTimeoutsReply(buf), nil +} + +// Read reply into structure from buffer for DpmsGetTimeouts +func dpmsGetTimeoutsReply(buf []byte) *DpmsGetTimeoutsReply { + v := new(DpmsGetTimeoutsReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.StandbyTimeout = Get16(buf[b:]) + b += 2 + + v.SuspendTimeout = Get16(buf[b:]) + b += 2 + + v.OffTimeout = Get16(buf[b:]) + b += 2 + + b += 18 // padding + + return v +} + +func (cook DpmsGetTimeoutsCookie) Check() error { + return cook.check() +} + +// Write request to wire for DpmsGetTimeouts +func (c *Conn) dpmsGetTimeoutsRequest() []byte { + size := 4 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["DPMS"] + b += 1 + + buf[b] = 2 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + return buf +} + +// Request DpmsSetTimeouts +// size: 12 +type DpmsSetTimeoutsCookie struct { + *cookie +} + +// Write request to wire for DpmsSetTimeouts +func (c *Conn) DpmsSetTimeouts(StandbyTimeout uint16, SuspendTimeout uint16, OffTimeout uint16) DpmsSetTimeoutsCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.dpmsSetTimeoutsRequest(StandbyTimeout, SuspendTimeout, OffTimeout), cookie) + return DpmsSetTimeoutsCookie{cookie} +} + +func (c *Conn) DpmsSetTimeoutsChecked(StandbyTimeout uint16, SuspendTimeout uint16, OffTimeout uint16) DpmsSetTimeoutsCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.dpmsSetTimeoutsRequest(StandbyTimeout, SuspendTimeout, OffTimeout), cookie) + return DpmsSetTimeoutsCookie{cookie} +} + +func (cook DpmsSetTimeoutsCookie) Check() error { + return cook.check() +} + +// Write request to wire for DpmsSetTimeouts +func (c *Conn) dpmsSetTimeoutsRequest(StandbyTimeout uint16, SuspendTimeout uint16, OffTimeout uint16) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["DPMS"] + b += 1 + + buf[b] = 3 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put16(buf[b:], StandbyTimeout) + b += 2 + + Put16(buf[b:], SuspendTimeout) + b += 2 + + Put16(buf[b:], OffTimeout) + b += 2 + + return buf +} + +// Request DpmsEnable +// size: 4 +type DpmsEnableCookie struct { + *cookie +} + +// Write request to wire for DpmsEnable +func (c *Conn) DpmsEnable() DpmsEnableCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.dpmsEnableRequest(), cookie) + return DpmsEnableCookie{cookie} +} + +func (c *Conn) DpmsEnableChecked() DpmsEnableCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.dpmsEnableRequest(), cookie) + return DpmsEnableCookie{cookie} +} + +func (cook DpmsEnableCookie) Check() error { + return cook.check() +} + +// Write request to wire for DpmsEnable +func (c *Conn) dpmsEnableRequest() []byte { + size := 4 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["DPMS"] + b += 1 + + buf[b] = 4 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + return buf +} + +// Request DpmsDisable +// size: 4 +type DpmsDisableCookie struct { + *cookie +} + +// Write request to wire for DpmsDisable +func (c *Conn) DpmsDisable() DpmsDisableCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.dpmsDisableRequest(), cookie) + return DpmsDisableCookie{cookie} +} + +func (c *Conn) DpmsDisableChecked() DpmsDisableCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.dpmsDisableRequest(), cookie) + return DpmsDisableCookie{cookie} +} + +func (cook DpmsDisableCookie) Check() error { + return cook.check() +} + +// Write request to wire for DpmsDisable +func (c *Conn) dpmsDisableRequest() []byte { + size := 4 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["DPMS"] + b += 1 + + buf[b] = 5 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + return buf +} + +// Request DpmsForceLevel +// size: 8 +type DpmsForceLevelCookie struct { + *cookie +} + +// Write request to wire for DpmsForceLevel +func (c *Conn) DpmsForceLevel(PowerLevel uint16) DpmsForceLevelCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.dpmsForceLevelRequest(PowerLevel), cookie) + return DpmsForceLevelCookie{cookie} +} + +func (c *Conn) DpmsForceLevelChecked(PowerLevel uint16) DpmsForceLevelCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.dpmsForceLevelRequest(PowerLevel), cookie) + return DpmsForceLevelCookie{cookie} +} + +func (cook DpmsForceLevelCookie) Check() error { + return cook.check() +} + +// Write request to wire for DpmsForceLevel +func (c *Conn) dpmsForceLevelRequest(PowerLevel uint16) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["DPMS"] + b += 1 + + buf[b] = 6 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put16(buf[b:], PowerLevel) + b += 2 + + return buf +} + +// Request DpmsInfo +// size: 4 +type DpmsInfoCookie struct { + *cookie +} + +func (c *Conn) DpmsInfo() DpmsInfoCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.dpmsInfoRequest(), cookie) + return DpmsInfoCookie{cookie} +} + +func (c *Conn) DpmsInfoUnchecked() DpmsInfoCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.dpmsInfoRequest(), cookie) + return DpmsInfoCookie{cookie} +} + +// Request reply for DpmsInfo +// size: 32 +type DpmsInfoReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + PowerLevel uint16 + State bool + // padding: 21 bytes +} + +// Waits and reads reply data from request DpmsInfo +func (cook DpmsInfoCookie) Reply() (*DpmsInfoReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return dpmsInfoReply(buf), nil +} + +// Read reply into structure from buffer for DpmsInfo +func dpmsInfoReply(buf []byte) *DpmsInfoReply { + v := new(DpmsInfoReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.PowerLevel = Get16(buf[b:]) + b += 2 + + if buf[b] == 1 { + v.State = true + } else { + v.State = false + } + b += 1 + + b += 21 // padding + + return v +} + +func (cook DpmsInfoCookie) Check() error { + return cook.check() +} + +// Write request to wire for DpmsInfo +func (c *Conn) dpmsInfoRequest() []byte { + size := 4 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["DPMS"] + b += 1 + + buf[b] = 7 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + return buf +} diff --git a/nexgb/auto_dri2.go b/nexgb/auto_dri2.go new file mode 100644 index 0000000..7797623 --- /dev/null +++ b/nexgb/auto_dri2.go @@ -0,0 +1,1534 @@ +package xgb + +/* + This file was generated by dri2.xml on May 6 2012 3:00:44am EDT. + This file is automatically generated. Edit at your peril! +*/ + +// Imports are not necessary for XGB because everything is +// in one package. They are still listed here for reference. +// import "xproto" + +// Skipping definition for base type 'Float' + +// Skipping definition for base type 'Id' + +// Skipping definition for base type 'Card8' + +// Skipping definition for base type 'Int16' + +// Skipping definition for base type 'Int32' + +// Skipping definition for base type 'Void' + +// Skipping definition for base type 'Byte' + +// Skipping definition for base type 'Int8' + +// Skipping definition for base type 'Card16' + +// Skipping definition for base type 'Char' + +// Skipping definition for base type 'Card32' + +// Skipping definition for base type 'Double' + +// Skipping definition for base type 'Bool' + +const ( + Dri2AttachmentBufferFrontLeft = 0 + Dri2AttachmentBufferBackLeft = 1 + Dri2AttachmentBufferFrontRight = 2 + Dri2AttachmentBufferBackRight = 3 + Dri2AttachmentBufferDepth = 4 + Dri2AttachmentBufferStencil = 5 + Dri2AttachmentBufferAccum = 6 + Dri2AttachmentBufferFakeFrontLeft = 7 + Dri2AttachmentBufferFakeFrontRight = 8 + Dri2AttachmentBufferDepthStencil = 9 + Dri2AttachmentBufferHiz = 10 +) + +const ( + Dri2DriverTypeDri = 0 + Dri2DriverTypeVdpau = 1 +) + +const ( + Dri2EventTypeExchangeComplete = 1 + Dri2EventTypeBlitComplete = 2 + Dri2EventTypeFlipComplete = 3 +) + +// 'Dri2DRI2Buffer' struct definition +// Size: 20 +type Dri2DRI2Buffer struct { + Attachment uint32 + Name uint32 + Pitch uint32 + Cpp uint32 + Flags uint32 +} + +// Struct read Dri2DRI2Buffer +func ReadDri2DRI2Buffer(buf []byte, v *Dri2DRI2Buffer) int { + b := 0 + + v.Attachment = Get32(buf[b:]) + b += 4 + + v.Name = Get32(buf[b:]) + b += 4 + + v.Pitch = Get32(buf[b:]) + b += 4 + + v.Cpp = Get32(buf[b:]) + b += 4 + + v.Flags = Get32(buf[b:]) + b += 4 + + return b +} + +// Struct list read Dri2DRI2Buffer +func ReadDri2DRI2BufferList(buf []byte, dest []Dri2DRI2Buffer) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = Dri2DRI2Buffer{} + b += ReadDri2DRI2Buffer(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write Dri2DRI2Buffer +func (v Dri2DRI2Buffer) Bytes() []byte { + buf := make([]byte, 20) + b := 0 + + Put32(buf[b:], v.Attachment) + b += 4 + + Put32(buf[b:], v.Name) + b += 4 + + Put32(buf[b:], v.Pitch) + b += 4 + + Put32(buf[b:], v.Cpp) + b += 4 + + Put32(buf[b:], v.Flags) + b += 4 + + return buf +} + +// Write struct list Dri2DRI2Buffer +func Dri2DRI2BufferListBytes(buf []byte, list []Dri2DRI2Buffer) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'Dri2AttachFormat' struct definition +// Size: 8 +type Dri2AttachFormat struct { + Attachment uint32 + Format uint32 +} + +// Struct read Dri2AttachFormat +func ReadDri2AttachFormat(buf []byte, v *Dri2AttachFormat) int { + b := 0 + + v.Attachment = Get32(buf[b:]) + b += 4 + + v.Format = Get32(buf[b:]) + b += 4 + + return b +} + +// Struct list read Dri2AttachFormat +func ReadDri2AttachFormatList(buf []byte, dest []Dri2AttachFormat) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = Dri2AttachFormat{} + b += ReadDri2AttachFormat(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write Dri2AttachFormat +func (v Dri2AttachFormat) Bytes() []byte { + buf := make([]byte, 8) + b := 0 + + Put32(buf[b:], v.Attachment) + b += 4 + + Put32(buf[b:], v.Format) + b += 4 + + return buf +} + +// Write struct list Dri2AttachFormat +func Dri2AttachFormatListBytes(buf []byte, list []Dri2AttachFormat) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// Event definition Dri2BufferSwapComplete (0) +// Size: 32 + +const Dri2BufferSwapComplete = 0 + +type Dri2BufferSwapCompleteEvent struct { + Sequence uint16 + // padding: 1 bytes + EventType uint16 + // padding: 2 bytes + Drawable Id + UstHi uint32 + UstLo uint32 + MscHi uint32 + MscLo uint32 + Sbc uint32 +} + +// Event read Dri2BufferSwapComplete +func NewDri2BufferSwapCompleteEvent(buf []byte) Event { + v := Dri2BufferSwapCompleteEvent{} + b := 1 // don't read event number + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.EventType = Get16(buf[b:]) + b += 2 + + b += 2 // padding + + v.Drawable = Id(Get32(buf[b:])) + b += 4 + + v.UstHi = Get32(buf[b:]) + b += 4 + + v.UstLo = Get32(buf[b:]) + b += 4 + + v.MscHi = Get32(buf[b:]) + b += 4 + + v.MscLo = Get32(buf[b:]) + b += 4 + + v.Sbc = Get32(buf[b:]) + b += 4 + + return v +} + +// Event write Dri2BufferSwapComplete +func (v Dri2BufferSwapCompleteEvent) Bytes() []byte { + buf := make([]byte, 32) + b := 0 + + // write event number + buf[b] = 0 + b += 1 + + b += 1 // padding + + b += 2 // skip sequence number + + Put16(buf[b:], v.EventType) + b += 2 + + b += 2 // padding + + Put32(buf[b:], uint32(v.Drawable)) + b += 4 + + Put32(buf[b:], v.UstHi) + b += 4 + + Put32(buf[b:], v.UstLo) + b += 4 + + Put32(buf[b:], v.MscHi) + b += 4 + + Put32(buf[b:], v.MscLo) + b += 4 + + Put32(buf[b:], v.Sbc) + b += 4 + + return buf +} + +func (v Dri2BufferSwapCompleteEvent) ImplementsEvent() {} + +func (v Dri2BufferSwapCompleteEvent) SequenceId() uint16 { + return v.Sequence +} + +func (v Dri2BufferSwapCompleteEvent) String() string { + fieldVals := make([]string, 0, 9) + fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) + fieldVals = append(fieldVals, sprintf("EventType: %d", v.EventType)) + fieldVals = append(fieldVals, sprintf("Drawable: %d", v.Drawable)) + fieldVals = append(fieldVals, sprintf("UstHi: %d", v.UstHi)) + fieldVals = append(fieldVals, sprintf("UstLo: %d", v.UstLo)) + fieldVals = append(fieldVals, sprintf("MscHi: %d", v.MscHi)) + fieldVals = append(fieldVals, sprintf("MscLo: %d", v.MscLo)) + fieldVals = append(fieldVals, sprintf("Sbc: %d", v.Sbc)) + return "Dri2BufferSwapComplete {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newEventFuncs[0] = NewDri2BufferSwapCompleteEvent +} + +// Event definition Dri2InvalidateBuffers (1) +// Size: 32 + +const Dri2InvalidateBuffers = 1 + +type Dri2InvalidateBuffersEvent struct { + Sequence uint16 + // padding: 1 bytes + Drawable Id +} + +// Event read Dri2InvalidateBuffers +func NewDri2InvalidateBuffersEvent(buf []byte) Event { + v := Dri2InvalidateBuffersEvent{} + b := 1 // don't read event number + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Drawable = Id(Get32(buf[b:])) + b += 4 + + return v +} + +// Event write Dri2InvalidateBuffers +func (v Dri2InvalidateBuffersEvent) Bytes() []byte { + buf := make([]byte, 32) + b := 0 + + // write event number + buf[b] = 1 + b += 1 + + b += 1 // padding + + b += 2 // skip sequence number + + Put32(buf[b:], uint32(v.Drawable)) + b += 4 + + return buf +} + +func (v Dri2InvalidateBuffersEvent) ImplementsEvent() {} + +func (v Dri2InvalidateBuffersEvent) SequenceId() uint16 { + return v.Sequence +} + +func (v Dri2InvalidateBuffersEvent) String() string { + fieldVals := make([]string, 0, 2) + fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) + fieldVals = append(fieldVals, sprintf("Drawable: %d", v.Drawable)) + return "Dri2InvalidateBuffers {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newEventFuncs[1] = NewDri2InvalidateBuffersEvent +} + +// Request Dri2QueryVersion +// size: 12 +type Dri2QueryVersionCookie struct { + *cookie +} + +func (c *Conn) Dri2QueryVersion(MajorVersion uint32, MinorVersion uint32) Dri2QueryVersionCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.dri2QueryVersionRequest(MajorVersion, MinorVersion), cookie) + return Dri2QueryVersionCookie{cookie} +} + +func (c *Conn) Dri2QueryVersionUnchecked(MajorVersion uint32, MinorVersion uint32) Dri2QueryVersionCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.dri2QueryVersionRequest(MajorVersion, MinorVersion), cookie) + return Dri2QueryVersionCookie{cookie} +} + +// Request reply for Dri2QueryVersion +// size: 16 +type Dri2QueryVersionReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + MajorVersion uint32 + MinorVersion uint32 +} + +// Waits and reads reply data from request Dri2QueryVersion +func (cook Dri2QueryVersionCookie) Reply() (*Dri2QueryVersionReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return dri2QueryVersionReply(buf), nil +} + +// Read reply into structure from buffer for Dri2QueryVersion +func dri2QueryVersionReply(buf []byte) *Dri2QueryVersionReply { + v := new(Dri2QueryVersionReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.MajorVersion = Get32(buf[b:]) + b += 4 + + v.MinorVersion = Get32(buf[b:]) + b += 4 + + return v +} + +func (cook Dri2QueryVersionCookie) Check() error { + return cook.check() +} + +// Write request to wire for Dri2QueryVersion +func (c *Conn) dri2QueryVersionRequest(MajorVersion uint32, MinorVersion uint32) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["DRI2"] + b += 1 + + buf[b] = 0 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], MajorVersion) + b += 4 + + Put32(buf[b:], MinorVersion) + b += 4 + + return buf +} + +// Request Dri2Connect +// size: 12 +type Dri2ConnectCookie struct { + *cookie +} + +func (c *Conn) Dri2Connect(Window Id, DriverType uint32) Dri2ConnectCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.dri2ConnectRequest(Window, DriverType), cookie) + return Dri2ConnectCookie{cookie} +} + +func (c *Conn) Dri2ConnectUnchecked(Window Id, DriverType uint32) Dri2ConnectCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.dri2ConnectRequest(Window, DriverType), cookie) + return Dri2ConnectCookie{cookie} +} + +// Request reply for Dri2Connect +// size: (((32 + pad((int(DriverNameLength) * 1))) + pad(((((int(DriverNameLength) + 3) & -4) - int(DriverNameLength)) * 1))) + pad((int(DeviceNameLength) * 1))) +type Dri2ConnectReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + DriverNameLength uint32 + DeviceNameLength uint32 + // padding: 16 bytes + DriverName string // size: pad((int(DriverNameLength) * 1)) + AlignmentPad []byte // size: pad(((((int(DriverNameLength) + 3) & -4) - int(DriverNameLength)) * 1)) + DeviceName string // size: pad((int(DeviceNameLength) * 1)) +} + +// Waits and reads reply data from request Dri2Connect +func (cook Dri2ConnectCookie) Reply() (*Dri2ConnectReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return dri2ConnectReply(buf), nil +} + +// Read reply into structure from buffer for Dri2Connect +func dri2ConnectReply(buf []byte) *Dri2ConnectReply { + v := new(Dri2ConnectReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.DriverNameLength = Get32(buf[b:]) + b += 4 + + v.DeviceNameLength = Get32(buf[b:]) + b += 4 + + b += 16 // padding + + { + byteString := make([]byte, v.DriverNameLength) + copy(byteString[:v.DriverNameLength], buf[b:]) + v.DriverName = string(byteString) + b += pad(int(v.DriverNameLength)) + } + + v.AlignmentPad = make([]byte, (((int(v.DriverNameLength) + 3) & -4) - int(v.DriverNameLength))) + copy(v.AlignmentPad[:(((int(v.DriverNameLength)+3)&-4)-int(v.DriverNameLength))], buf[b:]) + b += pad(int((((int(v.DriverNameLength) + 3) & -4) - int(v.DriverNameLength)))) + + { + byteString := make([]byte, v.DeviceNameLength) + copy(byteString[:v.DeviceNameLength], buf[b:]) + v.DeviceName = string(byteString) + b += pad(int(v.DeviceNameLength)) + } + + return v +} + +func (cook Dri2ConnectCookie) Check() error { + return cook.check() +} + +// Write request to wire for Dri2Connect +func (c *Conn) dri2ConnectRequest(Window Id, DriverType uint32) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["DRI2"] + b += 1 + + buf[b] = 1 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Window)) + b += 4 + + Put32(buf[b:], DriverType) + b += 4 + + return buf +} + +// Request Dri2Authenticate +// size: 12 +type Dri2AuthenticateCookie struct { + *cookie +} + +func (c *Conn) Dri2Authenticate(Window Id, Magic uint32) Dri2AuthenticateCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.dri2AuthenticateRequest(Window, Magic), cookie) + return Dri2AuthenticateCookie{cookie} +} + +func (c *Conn) Dri2AuthenticateUnchecked(Window Id, Magic uint32) Dri2AuthenticateCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.dri2AuthenticateRequest(Window, Magic), cookie) + return Dri2AuthenticateCookie{cookie} +} + +// Request reply for Dri2Authenticate +// size: 12 +type Dri2AuthenticateReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Authenticated uint32 +} + +// Waits and reads reply data from request Dri2Authenticate +func (cook Dri2AuthenticateCookie) Reply() (*Dri2AuthenticateReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return dri2AuthenticateReply(buf), nil +} + +// Read reply into structure from buffer for Dri2Authenticate +func dri2AuthenticateReply(buf []byte) *Dri2AuthenticateReply { + v := new(Dri2AuthenticateReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.Authenticated = Get32(buf[b:]) + b += 4 + + return v +} + +func (cook Dri2AuthenticateCookie) Check() error { + return cook.check() +} + +// Write request to wire for Dri2Authenticate +func (c *Conn) dri2AuthenticateRequest(Window Id, Magic uint32) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["DRI2"] + b += 1 + + buf[b] = 2 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Window)) + b += 4 + + Put32(buf[b:], Magic) + b += 4 + + return buf +} + +// Request Dri2CreateDrawable +// size: 8 +type Dri2CreateDrawableCookie struct { + *cookie +} + +// Write request to wire for Dri2CreateDrawable +func (c *Conn) Dri2CreateDrawable(Drawable Id) Dri2CreateDrawableCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.dri2CreateDrawableRequest(Drawable), cookie) + return Dri2CreateDrawableCookie{cookie} +} + +func (c *Conn) Dri2CreateDrawableChecked(Drawable Id) Dri2CreateDrawableCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.dri2CreateDrawableRequest(Drawable), cookie) + return Dri2CreateDrawableCookie{cookie} +} + +func (cook Dri2CreateDrawableCookie) Check() error { + return cook.check() +} + +// Write request to wire for Dri2CreateDrawable +func (c *Conn) dri2CreateDrawableRequest(Drawable Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["DRI2"] + b += 1 + + buf[b] = 3 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Drawable)) + b += 4 + + return buf +} + +// Request Dri2DestroyDrawable +// size: 8 +type Dri2DestroyDrawableCookie struct { + *cookie +} + +// Write request to wire for Dri2DestroyDrawable +func (c *Conn) Dri2DestroyDrawable(Drawable Id) Dri2DestroyDrawableCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.dri2DestroyDrawableRequest(Drawable), cookie) + return Dri2DestroyDrawableCookie{cookie} +} + +func (c *Conn) Dri2DestroyDrawableChecked(Drawable Id) Dri2DestroyDrawableCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.dri2DestroyDrawableRequest(Drawable), cookie) + return Dri2DestroyDrawableCookie{cookie} +} + +func (cook Dri2DestroyDrawableCookie) Check() error { + return cook.check() +} + +// Write request to wire for Dri2DestroyDrawable +func (c *Conn) dri2DestroyDrawableRequest(Drawable Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["DRI2"] + b += 1 + + buf[b] = 4 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Drawable)) + b += 4 + + return buf +} + +// Request Dri2GetBuffers +// size: pad((12 + pad((len(Attachments) * 4)))) +type Dri2GetBuffersCookie struct { + *cookie +} + +func (c *Conn) Dri2GetBuffers(Drawable Id, Count uint32, Attachments []uint32) Dri2GetBuffersCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.dri2GetBuffersRequest(Drawable, Count, Attachments), cookie) + return Dri2GetBuffersCookie{cookie} +} + +func (c *Conn) Dri2GetBuffersUnchecked(Drawable Id, Count uint32, Attachments []uint32) Dri2GetBuffersCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.dri2GetBuffersRequest(Drawable, Count, Attachments), cookie) + return Dri2GetBuffersCookie{cookie} +} + +// Request reply for Dri2GetBuffers +// size: (32 + pad((int(Count) * 20))) +type Dri2GetBuffersReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Width uint32 + Height uint32 + Count uint32 + // padding: 12 bytes + Buffers []Dri2DRI2Buffer // size: pad((int(Count) * 20)) +} + +// Waits and reads reply data from request Dri2GetBuffers +func (cook Dri2GetBuffersCookie) Reply() (*Dri2GetBuffersReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return dri2GetBuffersReply(buf), nil +} + +// Read reply into structure from buffer for Dri2GetBuffers +func dri2GetBuffersReply(buf []byte) *Dri2GetBuffersReply { + v := new(Dri2GetBuffersReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.Width = Get32(buf[b:]) + b += 4 + + v.Height = Get32(buf[b:]) + b += 4 + + v.Count = Get32(buf[b:]) + b += 4 + + b += 12 // padding + + v.Buffers = make([]Dri2DRI2Buffer, v.Count) + b += ReadDri2DRI2BufferList(buf[b:], v.Buffers) + + return v +} + +func (cook Dri2GetBuffersCookie) Check() error { + return cook.check() +} + +// Write request to wire for Dri2GetBuffers +func (c *Conn) dri2GetBuffersRequest(Drawable Id, Count uint32, Attachments []uint32) []byte { + size := pad((12 + pad((len(Attachments) * 4)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["DRI2"] + b += 1 + + buf[b] = 5 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Drawable)) + b += 4 + + Put32(buf[b:], Count) + b += 4 + + for i := 0; i < int(len(Attachments)); i++ { + Put32(buf[b:], Attachments[i]) + b += 4 + } + b = pad(b) + + return buf +} + +// Request Dri2CopyRegion +// size: 20 +type Dri2CopyRegionCookie struct { + *cookie +} + +func (c *Conn) Dri2CopyRegion(Drawable Id, Region uint32, Dest uint32, Src uint32) Dri2CopyRegionCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.dri2CopyRegionRequest(Drawable, Region, Dest, Src), cookie) + return Dri2CopyRegionCookie{cookie} +} + +func (c *Conn) Dri2CopyRegionUnchecked(Drawable Id, Region uint32, Dest uint32, Src uint32) Dri2CopyRegionCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.dri2CopyRegionRequest(Drawable, Region, Dest, Src), cookie) + return Dri2CopyRegionCookie{cookie} +} + +// Request reply for Dri2CopyRegion +// size: 8 +type Dri2CopyRegionReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes +} + +// Waits and reads reply data from request Dri2CopyRegion +func (cook Dri2CopyRegionCookie) Reply() (*Dri2CopyRegionReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return dri2CopyRegionReply(buf), nil +} + +// Read reply into structure from buffer for Dri2CopyRegion +func dri2CopyRegionReply(buf []byte) *Dri2CopyRegionReply { + v := new(Dri2CopyRegionReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + return v +} + +func (cook Dri2CopyRegionCookie) Check() error { + return cook.check() +} + +// Write request to wire for Dri2CopyRegion +func (c *Conn) dri2CopyRegionRequest(Drawable Id, Region uint32, Dest uint32, Src uint32) []byte { + size := 20 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["DRI2"] + b += 1 + + buf[b] = 6 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Drawable)) + b += 4 + + Put32(buf[b:], Region) + b += 4 + + Put32(buf[b:], Dest) + b += 4 + + Put32(buf[b:], Src) + b += 4 + + return buf +} + +// Request Dri2GetBuffersWithFormat +// size: pad((12 + pad((len(Attachments) * 8)))) +type Dri2GetBuffersWithFormatCookie struct { + *cookie +} + +func (c *Conn) Dri2GetBuffersWithFormat(Drawable Id, Count uint32, Attachments []Dri2AttachFormat) Dri2GetBuffersWithFormatCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.dri2GetBuffersWithFormatRequest(Drawable, Count, Attachments), cookie) + return Dri2GetBuffersWithFormatCookie{cookie} +} + +func (c *Conn) Dri2GetBuffersWithFormatUnchecked(Drawable Id, Count uint32, Attachments []Dri2AttachFormat) Dri2GetBuffersWithFormatCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.dri2GetBuffersWithFormatRequest(Drawable, Count, Attachments), cookie) + return Dri2GetBuffersWithFormatCookie{cookie} +} + +// Request reply for Dri2GetBuffersWithFormat +// size: (32 + pad((int(Count) * 20))) +type Dri2GetBuffersWithFormatReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Width uint32 + Height uint32 + Count uint32 + // padding: 12 bytes + Buffers []Dri2DRI2Buffer // size: pad((int(Count) * 20)) +} + +// Waits and reads reply data from request Dri2GetBuffersWithFormat +func (cook Dri2GetBuffersWithFormatCookie) Reply() (*Dri2GetBuffersWithFormatReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return dri2GetBuffersWithFormatReply(buf), nil +} + +// Read reply into structure from buffer for Dri2GetBuffersWithFormat +func dri2GetBuffersWithFormatReply(buf []byte) *Dri2GetBuffersWithFormatReply { + v := new(Dri2GetBuffersWithFormatReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.Width = Get32(buf[b:]) + b += 4 + + v.Height = Get32(buf[b:]) + b += 4 + + v.Count = Get32(buf[b:]) + b += 4 + + b += 12 // padding + + v.Buffers = make([]Dri2DRI2Buffer, v.Count) + b += ReadDri2DRI2BufferList(buf[b:], v.Buffers) + + return v +} + +func (cook Dri2GetBuffersWithFormatCookie) Check() error { + return cook.check() +} + +// Write request to wire for Dri2GetBuffersWithFormat +func (c *Conn) dri2GetBuffersWithFormatRequest(Drawable Id, Count uint32, Attachments []Dri2AttachFormat) []byte { + size := pad((12 + pad((len(Attachments) * 8)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["DRI2"] + b += 1 + + buf[b] = 7 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Drawable)) + b += 4 + + Put32(buf[b:], Count) + b += 4 + + b += Dri2AttachFormatListBytes(buf[b:], Attachments) + + return buf +} + +// Request Dri2SwapBuffers +// size: 32 +type Dri2SwapBuffersCookie struct { + *cookie +} + +func (c *Conn) Dri2SwapBuffers(Drawable Id, TargetMscHi uint32, TargetMscLo uint32, DivisorHi uint32, DivisorLo uint32, RemainderHi uint32, RemainderLo uint32) Dri2SwapBuffersCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.dri2SwapBuffersRequest(Drawable, TargetMscHi, TargetMscLo, DivisorHi, DivisorLo, RemainderHi, RemainderLo), cookie) + return Dri2SwapBuffersCookie{cookie} +} + +func (c *Conn) Dri2SwapBuffersUnchecked(Drawable Id, TargetMscHi uint32, TargetMscLo uint32, DivisorHi uint32, DivisorLo uint32, RemainderHi uint32, RemainderLo uint32) Dri2SwapBuffersCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.dri2SwapBuffersRequest(Drawable, TargetMscHi, TargetMscLo, DivisorHi, DivisorLo, RemainderHi, RemainderLo), cookie) + return Dri2SwapBuffersCookie{cookie} +} + +// Request reply for Dri2SwapBuffers +// size: 16 +type Dri2SwapBuffersReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + SwapHi uint32 + SwapLo uint32 +} + +// Waits and reads reply data from request Dri2SwapBuffers +func (cook Dri2SwapBuffersCookie) Reply() (*Dri2SwapBuffersReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return dri2SwapBuffersReply(buf), nil +} + +// Read reply into structure from buffer for Dri2SwapBuffers +func dri2SwapBuffersReply(buf []byte) *Dri2SwapBuffersReply { + v := new(Dri2SwapBuffersReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.SwapHi = Get32(buf[b:]) + b += 4 + + v.SwapLo = Get32(buf[b:]) + b += 4 + + return v +} + +func (cook Dri2SwapBuffersCookie) Check() error { + return cook.check() +} + +// Write request to wire for Dri2SwapBuffers +func (c *Conn) dri2SwapBuffersRequest(Drawable Id, TargetMscHi uint32, TargetMscLo uint32, DivisorHi uint32, DivisorLo uint32, RemainderHi uint32, RemainderLo uint32) []byte { + size := 32 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["DRI2"] + b += 1 + + buf[b] = 8 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Drawable)) + b += 4 + + Put32(buf[b:], TargetMscHi) + b += 4 + + Put32(buf[b:], TargetMscLo) + b += 4 + + Put32(buf[b:], DivisorHi) + b += 4 + + Put32(buf[b:], DivisorLo) + b += 4 + + Put32(buf[b:], RemainderHi) + b += 4 + + Put32(buf[b:], RemainderLo) + b += 4 + + return buf +} + +// Request Dri2GetMSC +// size: 8 +type Dri2GetMSCCookie struct { + *cookie +} + +func (c *Conn) Dri2GetMSC(Drawable Id) Dri2GetMSCCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.dri2GetMSCRequest(Drawable), cookie) + return Dri2GetMSCCookie{cookie} +} + +func (c *Conn) Dri2GetMSCUnchecked(Drawable Id) Dri2GetMSCCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.dri2GetMSCRequest(Drawable), cookie) + return Dri2GetMSCCookie{cookie} +} + +// Request reply for Dri2GetMSC +// size: 32 +type Dri2GetMSCReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + UstHi uint32 + UstLo uint32 + MscHi uint32 + MscLo uint32 + SbcHi uint32 + SbcLo uint32 +} + +// Waits and reads reply data from request Dri2GetMSC +func (cook Dri2GetMSCCookie) Reply() (*Dri2GetMSCReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return dri2GetMSCReply(buf), nil +} + +// Read reply into structure from buffer for Dri2GetMSC +func dri2GetMSCReply(buf []byte) *Dri2GetMSCReply { + v := new(Dri2GetMSCReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.UstHi = Get32(buf[b:]) + b += 4 + + v.UstLo = Get32(buf[b:]) + b += 4 + + v.MscHi = Get32(buf[b:]) + b += 4 + + v.MscLo = Get32(buf[b:]) + b += 4 + + v.SbcHi = Get32(buf[b:]) + b += 4 + + v.SbcLo = Get32(buf[b:]) + b += 4 + + return v +} + +func (cook Dri2GetMSCCookie) Check() error { + return cook.check() +} + +// Write request to wire for Dri2GetMSC +func (c *Conn) dri2GetMSCRequest(Drawable Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["DRI2"] + b += 1 + + buf[b] = 9 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Drawable)) + b += 4 + + return buf +} + +// Request Dri2WaitMSC +// size: 32 +type Dri2WaitMSCCookie struct { + *cookie +} + +func (c *Conn) Dri2WaitMSC(Drawable Id, TargetMscHi uint32, TargetMscLo uint32, DivisorHi uint32, DivisorLo uint32, RemainderHi uint32, RemainderLo uint32) Dri2WaitMSCCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.dri2WaitMSCRequest(Drawable, TargetMscHi, TargetMscLo, DivisorHi, DivisorLo, RemainderHi, RemainderLo), cookie) + return Dri2WaitMSCCookie{cookie} +} + +func (c *Conn) Dri2WaitMSCUnchecked(Drawable Id, TargetMscHi uint32, TargetMscLo uint32, DivisorHi uint32, DivisorLo uint32, RemainderHi uint32, RemainderLo uint32) Dri2WaitMSCCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.dri2WaitMSCRequest(Drawable, TargetMscHi, TargetMscLo, DivisorHi, DivisorLo, RemainderHi, RemainderLo), cookie) + return Dri2WaitMSCCookie{cookie} +} + +// Request reply for Dri2WaitMSC +// size: 32 +type Dri2WaitMSCReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + UstHi uint32 + UstLo uint32 + MscHi uint32 + MscLo uint32 + SbcHi uint32 + SbcLo uint32 +} + +// Waits and reads reply data from request Dri2WaitMSC +func (cook Dri2WaitMSCCookie) Reply() (*Dri2WaitMSCReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return dri2WaitMSCReply(buf), nil +} + +// Read reply into structure from buffer for Dri2WaitMSC +func dri2WaitMSCReply(buf []byte) *Dri2WaitMSCReply { + v := new(Dri2WaitMSCReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.UstHi = Get32(buf[b:]) + b += 4 + + v.UstLo = Get32(buf[b:]) + b += 4 + + v.MscHi = Get32(buf[b:]) + b += 4 + + v.MscLo = Get32(buf[b:]) + b += 4 + + v.SbcHi = Get32(buf[b:]) + b += 4 + + v.SbcLo = Get32(buf[b:]) + b += 4 + + return v +} + +func (cook Dri2WaitMSCCookie) Check() error { + return cook.check() +} + +// Write request to wire for Dri2WaitMSC +func (c *Conn) dri2WaitMSCRequest(Drawable Id, TargetMscHi uint32, TargetMscLo uint32, DivisorHi uint32, DivisorLo uint32, RemainderHi uint32, RemainderLo uint32) []byte { + size := 32 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["DRI2"] + b += 1 + + buf[b] = 10 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Drawable)) + b += 4 + + Put32(buf[b:], TargetMscHi) + b += 4 + + Put32(buf[b:], TargetMscLo) + b += 4 + + Put32(buf[b:], DivisorHi) + b += 4 + + Put32(buf[b:], DivisorLo) + b += 4 + + Put32(buf[b:], RemainderHi) + b += 4 + + Put32(buf[b:], RemainderLo) + b += 4 + + return buf +} + +// Request Dri2WaitSBC +// size: 16 +type Dri2WaitSBCCookie struct { + *cookie +} + +func (c *Conn) Dri2WaitSBC(Drawable Id, TargetSbcHi uint32, TargetSbcLo uint32) Dri2WaitSBCCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.dri2WaitSBCRequest(Drawable, TargetSbcHi, TargetSbcLo), cookie) + return Dri2WaitSBCCookie{cookie} +} + +func (c *Conn) Dri2WaitSBCUnchecked(Drawable Id, TargetSbcHi uint32, TargetSbcLo uint32) Dri2WaitSBCCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.dri2WaitSBCRequest(Drawable, TargetSbcHi, TargetSbcLo), cookie) + return Dri2WaitSBCCookie{cookie} +} + +// Request reply for Dri2WaitSBC +// size: 32 +type Dri2WaitSBCReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + UstHi uint32 + UstLo uint32 + MscHi uint32 + MscLo uint32 + SbcHi uint32 + SbcLo uint32 +} + +// Waits and reads reply data from request Dri2WaitSBC +func (cook Dri2WaitSBCCookie) Reply() (*Dri2WaitSBCReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return dri2WaitSBCReply(buf), nil +} + +// Read reply into structure from buffer for Dri2WaitSBC +func dri2WaitSBCReply(buf []byte) *Dri2WaitSBCReply { + v := new(Dri2WaitSBCReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.UstHi = Get32(buf[b:]) + b += 4 + + v.UstLo = Get32(buf[b:]) + b += 4 + + v.MscHi = Get32(buf[b:]) + b += 4 + + v.MscLo = Get32(buf[b:]) + b += 4 + + v.SbcHi = Get32(buf[b:]) + b += 4 + + v.SbcLo = Get32(buf[b:]) + b += 4 + + return v +} + +func (cook Dri2WaitSBCCookie) Check() error { + return cook.check() +} + +// Write request to wire for Dri2WaitSBC +func (c *Conn) dri2WaitSBCRequest(Drawable Id, TargetSbcHi uint32, TargetSbcLo uint32) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["DRI2"] + b += 1 + + buf[b] = 11 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Drawable)) + b += 4 + + Put32(buf[b:], TargetSbcHi) + b += 4 + + Put32(buf[b:], TargetSbcLo) + b += 4 + + return buf +} + +// Request Dri2SwapInterval +// size: 12 +type Dri2SwapIntervalCookie struct { + *cookie +} + +// Write request to wire for Dri2SwapInterval +func (c *Conn) Dri2SwapInterval(Drawable Id, Interval uint32) Dri2SwapIntervalCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.dri2SwapIntervalRequest(Drawable, Interval), cookie) + return Dri2SwapIntervalCookie{cookie} +} + +func (c *Conn) Dri2SwapIntervalChecked(Drawable Id, Interval uint32) Dri2SwapIntervalCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.dri2SwapIntervalRequest(Drawable, Interval), cookie) + return Dri2SwapIntervalCookie{cookie} +} + +func (cook Dri2SwapIntervalCookie) Check() error { + return cook.check() +} + +// Write request to wire for Dri2SwapInterval +func (c *Conn) dri2SwapIntervalRequest(Drawable Id, Interval uint32) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["DRI2"] + b += 1 + + buf[b] = 12 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Drawable)) + b += 4 + + Put32(buf[b:], Interval) + b += 4 + + return buf +} diff --git a/nexgb/auto_ge.go b/nexgb/auto_ge.go new file mode 100644 index 0000000..d9f52c1 --- /dev/null +++ b/nexgb/auto_ge.go @@ -0,0 +1,125 @@ +package xgb + +/* + This file was generated by ge.xml on May 6 2012 3:00:44am EDT. + This file is automatically generated. Edit at your peril! +*/ + +// Skipping definition for base type 'Id' + +// Skipping definition for base type 'Card8' + +// Skipping definition for base type 'Int16' + +// Skipping definition for base type 'Int32' + +// Skipping definition for base type 'Void' + +// Skipping definition for base type 'Byte' + +// Skipping definition for base type 'Int8' + +// Skipping definition for base type 'Card16' + +// Skipping definition for base type 'Char' + +// Skipping definition for base type 'Card32' + +// Skipping definition for base type 'Double' + +// Skipping definition for base type 'Bool' + +// Skipping definition for base type 'Float' + +// Request GeQueryVersion +// size: 8 +type GeQueryVersionCookie struct { + *cookie +} + +func (c *Conn) GeQueryVersion(ClientMajorVersion uint16, ClientMinorVersion uint16) GeQueryVersionCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.geQueryVersionRequest(ClientMajorVersion, ClientMinorVersion), cookie) + return GeQueryVersionCookie{cookie} +} + +func (c *Conn) GeQueryVersionUnchecked(ClientMajorVersion uint16, ClientMinorVersion uint16) GeQueryVersionCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.geQueryVersionRequest(ClientMajorVersion, ClientMinorVersion), cookie) + return GeQueryVersionCookie{cookie} +} + +// Request reply for GeQueryVersion +// size: 32 +type GeQueryVersionReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + MajorVersion uint16 + MinorVersion uint16 + // padding: 20 bytes +} + +// Waits and reads reply data from request GeQueryVersion +func (cook GeQueryVersionCookie) Reply() (*GeQueryVersionReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return geQueryVersionReply(buf), nil +} + +// Read reply into structure from buffer for GeQueryVersion +func geQueryVersionReply(buf []byte) *GeQueryVersionReply { + v := new(GeQueryVersionReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.MajorVersion = Get16(buf[b:]) + b += 2 + + v.MinorVersion = Get16(buf[b:]) + b += 2 + + b += 20 // padding + + return v +} + +func (cook GeQueryVersionCookie) Check() error { + return cook.check() +} + +// Write request to wire for GeQueryVersion +func (c *Conn) geQueryVersionRequest(ClientMajorVersion uint16, ClientMinorVersion uint16) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GENERIC EVENT EXTENSION"] + b += 1 + + buf[b] = 0 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put16(buf[b:], ClientMajorVersion) + b += 2 + + Put16(buf[b:], ClientMinorVersion) + b += 2 + + return buf +} diff --git a/nexgb/auto_glx.go b/nexgb/auto_glx.go new file mode 100644 index 0000000..4b6b2c5 --- /dev/null +++ b/nexgb/auto_glx.go @@ -0,0 +1,9356 @@ +package xgb + +/* + This file was generated by glx.xml on May 6 2012 3:00:44am EDT. + This file is automatically generated. Edit at your peril! +*/ + +// Imports are not necessary for XGB because everything is +// in one package. They are still listed here for reference. +// import "xproto" + +// Skipping definition for base type 'Card16' + +// Skipping definition for base type 'Char' + +// Skipping definition for base type 'Card32' + +// Skipping definition for base type 'Double' + +// Skipping definition for base type 'Bool' + +// Skipping definition for base type 'Float' + +// Skipping definition for base type 'Id' + +// Skipping definition for base type 'Card8' + +// Skipping definition for base type 'Int16' + +// Skipping definition for base type 'Int32' + +// Skipping definition for base type 'Void' + +// Skipping definition for base type 'Byte' + +// Skipping definition for base type 'Int8' + +const ( + GlxPbcetDamaged = 32791 + GlxPbcetSaved = 32792 +) + +const ( + GlxPbcdtWindow = 32793 + GlxPbcdtPbuffer = 32794 +) + +const ( + GlxGcGlCurrentBit = 1 + GlxGcGlPointBit = 2 + GlxGcGlLineBit = 4 + GlxGcGlPolygonBit = 8 + GlxGcGlPolygonStippleBit = 16 + GlxGcGlPixelModeBit = 32 + GlxGcGlLightingBit = 64 + GlxGcGlFogBit = 128 + GlxGcGlDepthBufferBit = 256 + GlxGcGlAccumBufferBit = 512 + GlxGcGlStencilBufferBit = 1024 + GlxGcGlViewportBit = 2048 + GlxGcGlTransformBit = 4096 + GlxGcGlEnableBit = 8192 + GlxGcGlColorBufferBit = 16384 + GlxGcGlHintBit = 32768 + GlxGcGlEvalBit = 65536 + GlxGcGlListBit = 131072 + GlxGcGlTextureBit = 262144 + GlxGcGlScissorBit = 524288 + GlxGcGlAllAttribBits = 16777215 +) + +const ( + GlxRmGlRender = 7168 + GlxRmGlFeedback = 7169 + GlxRmGlSelect = 7170 +) + +// Skipping resource definition of 'Pixmap' + +// Skipping resource definition of 'Context' + +// Skipping resource definition of 'Pbuffer' + +// Skipping resource definition of 'Window' + +// Skipping resource definition of 'Fbconfig' + +// Skipping resource definition of 'Drawable' + +type GlxFloat32 float64 + +type GlxFloat64 float64 + +type GlxBool32 uint32 + +type GlxContextTag uint32 + +// Event definition GlxPbufferClobber (0) +// Size: 32 + +const GlxPbufferClobber = 0 + +type GlxPbufferClobberEvent struct { + Sequence uint16 + // padding: 1 bytes + EventType uint16 + DrawType uint16 + Drawable Id + BMask uint32 + AuxBuffer uint16 + X uint16 + Y uint16 + Width uint16 + Height uint16 + Count uint16 + // padding: 4 bytes +} + +// Event read GlxPbufferClobber +func NewGlxPbufferClobberEvent(buf []byte) Event { + v := GlxPbufferClobberEvent{} + b := 1 // don't read event number + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.EventType = Get16(buf[b:]) + b += 2 + + v.DrawType = Get16(buf[b:]) + b += 2 + + v.Drawable = Id(Get32(buf[b:])) + b += 4 + + v.BMask = Get32(buf[b:]) + b += 4 + + v.AuxBuffer = Get16(buf[b:]) + b += 2 + + v.X = Get16(buf[b:]) + b += 2 + + v.Y = Get16(buf[b:]) + b += 2 + + v.Width = Get16(buf[b:]) + b += 2 + + v.Height = Get16(buf[b:]) + b += 2 + + v.Count = Get16(buf[b:]) + b += 2 + + b += 4 // padding + + return v +} + +// Event write GlxPbufferClobber +func (v GlxPbufferClobberEvent) Bytes() []byte { + buf := make([]byte, 32) + b := 0 + + // write event number + buf[b] = 0 + b += 1 + + b += 1 // padding + + b += 2 // skip sequence number + + Put16(buf[b:], v.EventType) + b += 2 + + Put16(buf[b:], v.DrawType) + b += 2 + + Put32(buf[b:], uint32(v.Drawable)) + b += 4 + + Put32(buf[b:], v.BMask) + b += 4 + + Put16(buf[b:], v.AuxBuffer) + b += 2 + + Put16(buf[b:], v.X) + b += 2 + + Put16(buf[b:], v.Y) + b += 2 + + Put16(buf[b:], v.Width) + b += 2 + + Put16(buf[b:], v.Height) + b += 2 + + Put16(buf[b:], v.Count) + b += 2 + + b += 4 // padding + + return buf +} + +func (v GlxPbufferClobberEvent) ImplementsEvent() {} + +func (v GlxPbufferClobberEvent) SequenceId() uint16 { + return v.Sequence +} + +func (v GlxPbufferClobberEvent) String() string { + fieldVals := make([]string, 0, 12) + fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) + fieldVals = append(fieldVals, sprintf("EventType: %d", v.EventType)) + fieldVals = append(fieldVals, sprintf("DrawType: %d", v.DrawType)) + fieldVals = append(fieldVals, sprintf("Drawable: %d", v.Drawable)) + fieldVals = append(fieldVals, sprintf("BMask: %d", v.BMask)) + fieldVals = append(fieldVals, sprintf("AuxBuffer: %d", v.AuxBuffer)) + fieldVals = append(fieldVals, sprintf("X: %d", v.X)) + fieldVals = append(fieldVals, sprintf("Y: %d", v.Y)) + fieldVals = append(fieldVals, sprintf("Width: %d", v.Width)) + fieldVals = append(fieldVals, sprintf("Height: %d", v.Height)) + fieldVals = append(fieldVals, sprintf("Count: %d", v.Count)) + return "GlxPbufferClobber {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newEventFuncs[0] = NewGlxPbufferClobberEvent +} + +// Error definition GlxGeneric (-1) +// Size: 32 + +const BadGlxGeneric = -1 + +type GlxGenericError struct { + Sequence uint16 + NiceName string + BadValue uint32 + MinorOpcode uint16 + MajorOpcode byte + // padding: 21 bytes +} + +// Error read GlxGeneric +func NewGlxGenericError(buf []byte) Error { + v := GlxGenericError{} + v.NiceName = "GlxGeneric" + + b := 1 // skip error determinant + b += 1 // don't read error number + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.BadValue = Get32(buf[b:]) + b += 4 + + v.MinorOpcode = Get16(buf[b:]) + b += 2 + + v.MajorOpcode = buf[b] + b += 1 + + b += 21 // padding + + return v +} + +func (err GlxGenericError) ImplementsError() {} + +func (err GlxGenericError) SequenceId() uint16 { + return err.Sequence +} + +func (err GlxGenericError) BadId() Id { + return 0 +} + +func (err GlxGenericError) Error() string { + fieldVals := make([]string, 0, 4) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) + fieldVals = append(fieldVals, sprintf("BadValue: %d", err.BadValue)) + fieldVals = append(fieldVals, sprintf("MinorOpcode: %d", err.MinorOpcode)) + fieldVals = append(fieldVals, sprintf("MajorOpcode: %d", err.MajorOpcode)) + return "BadGlxGeneric {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newErrorFuncs[-1] = NewGlxGenericError +} + +// ErrorCopy definition GlxBadContext (0) + +const BadGlxBadContext = 0 + +type GlxBadContextError GlxGenericError + +func NewGlxBadContextError(buf []byte) Error { + v := GlxBadContextError(NewGlxGenericError(buf).(GlxGenericError)) + v.NiceName = "GlxBadContext" + return v +} + +func (err GlxBadContextError) ImplementsError() {} + +func (err GlxBadContextError) SequenceId() uint16 { + return err.Sequence +} + +func (err GlxBadContextError) BadId() Id { + return Id(err.BadValue) +} + +func (err GlxBadContextError) Error() string { + fieldVals := make([]string, 0, 4) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) + fieldVals = append(fieldVals, sprintf("BadValue: %d", err.BadValue)) + fieldVals = append(fieldVals, sprintf("MinorOpcode: %d", err.MinorOpcode)) + fieldVals = append(fieldVals, sprintf("MajorOpcode: %d", err.MajorOpcode)) + return "BadGlxBadContext {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newErrorFuncs[0] = NewGlxBadContextError +} + +// ErrorCopy definition GlxBadContextState (1) + +const BadGlxBadContextState = 1 + +type GlxBadContextStateError GlxGenericError + +func NewGlxBadContextStateError(buf []byte) Error { + v := GlxBadContextStateError(NewGlxGenericError(buf).(GlxGenericError)) + v.NiceName = "GlxBadContextState" + return v +} + +func (err GlxBadContextStateError) ImplementsError() {} + +func (err GlxBadContextStateError) SequenceId() uint16 { + return err.Sequence +} + +func (err GlxBadContextStateError) BadId() Id { + return Id(err.BadValue) +} + +func (err GlxBadContextStateError) Error() string { + fieldVals := make([]string, 0, 4) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) + fieldVals = append(fieldVals, sprintf("BadValue: %d", err.BadValue)) + fieldVals = append(fieldVals, sprintf("MinorOpcode: %d", err.MinorOpcode)) + fieldVals = append(fieldVals, sprintf("MajorOpcode: %d", err.MajorOpcode)) + return "BadGlxBadContextState {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newErrorFuncs[1] = NewGlxBadContextStateError +} + +// ErrorCopy definition GlxBadDrawable (2) + +const BadGlxBadDrawable = 2 + +type GlxBadDrawableError GlxGenericError + +func NewGlxBadDrawableError(buf []byte) Error { + v := GlxBadDrawableError(NewGlxGenericError(buf).(GlxGenericError)) + v.NiceName = "GlxBadDrawable" + return v +} + +func (err GlxBadDrawableError) ImplementsError() {} + +func (err GlxBadDrawableError) SequenceId() uint16 { + return err.Sequence +} + +func (err GlxBadDrawableError) BadId() Id { + return Id(err.BadValue) +} + +func (err GlxBadDrawableError) Error() string { + fieldVals := make([]string, 0, 4) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) + fieldVals = append(fieldVals, sprintf("BadValue: %d", err.BadValue)) + fieldVals = append(fieldVals, sprintf("MinorOpcode: %d", err.MinorOpcode)) + fieldVals = append(fieldVals, sprintf("MajorOpcode: %d", err.MajorOpcode)) + return "BadGlxBadDrawable {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newErrorFuncs[2] = NewGlxBadDrawableError +} + +// ErrorCopy definition GlxBadPixmap (3) + +const BadGlxBadPixmap = 3 + +type GlxBadPixmapError GlxGenericError + +func NewGlxBadPixmapError(buf []byte) Error { + v := GlxBadPixmapError(NewGlxGenericError(buf).(GlxGenericError)) + v.NiceName = "GlxBadPixmap" + return v +} + +func (err GlxBadPixmapError) ImplementsError() {} + +func (err GlxBadPixmapError) SequenceId() uint16 { + return err.Sequence +} + +func (err GlxBadPixmapError) BadId() Id { + return Id(err.BadValue) +} + +func (err GlxBadPixmapError) Error() string { + fieldVals := make([]string, 0, 4) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) + fieldVals = append(fieldVals, sprintf("BadValue: %d", err.BadValue)) + fieldVals = append(fieldVals, sprintf("MinorOpcode: %d", err.MinorOpcode)) + fieldVals = append(fieldVals, sprintf("MajorOpcode: %d", err.MajorOpcode)) + return "BadGlxBadPixmap {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newErrorFuncs[3] = NewGlxBadPixmapError +} + +// ErrorCopy definition GlxBadContextTag (4) + +const BadGlxBadContextTag = 4 + +type GlxBadContextTagError GlxGenericError + +func NewGlxBadContextTagError(buf []byte) Error { + v := GlxBadContextTagError(NewGlxGenericError(buf).(GlxGenericError)) + v.NiceName = "GlxBadContextTag" + return v +} + +func (err GlxBadContextTagError) ImplementsError() {} + +func (err GlxBadContextTagError) SequenceId() uint16 { + return err.Sequence +} + +func (err GlxBadContextTagError) BadId() Id { + return Id(err.BadValue) +} + +func (err GlxBadContextTagError) Error() string { + fieldVals := make([]string, 0, 4) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) + fieldVals = append(fieldVals, sprintf("BadValue: %d", err.BadValue)) + fieldVals = append(fieldVals, sprintf("MinorOpcode: %d", err.MinorOpcode)) + fieldVals = append(fieldVals, sprintf("MajorOpcode: %d", err.MajorOpcode)) + return "BadGlxBadContextTag {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newErrorFuncs[4] = NewGlxBadContextTagError +} + +// ErrorCopy definition GlxBadCurrentWindow (5) + +const BadGlxBadCurrentWindow = 5 + +type GlxBadCurrentWindowError GlxGenericError + +func NewGlxBadCurrentWindowError(buf []byte) Error { + v := GlxBadCurrentWindowError(NewGlxGenericError(buf).(GlxGenericError)) + v.NiceName = "GlxBadCurrentWindow" + return v +} + +func (err GlxBadCurrentWindowError) ImplementsError() {} + +func (err GlxBadCurrentWindowError) SequenceId() uint16 { + return err.Sequence +} + +func (err GlxBadCurrentWindowError) BadId() Id { + return Id(err.BadValue) +} + +func (err GlxBadCurrentWindowError) Error() string { + fieldVals := make([]string, 0, 4) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) + fieldVals = append(fieldVals, sprintf("BadValue: %d", err.BadValue)) + fieldVals = append(fieldVals, sprintf("MinorOpcode: %d", err.MinorOpcode)) + fieldVals = append(fieldVals, sprintf("MajorOpcode: %d", err.MajorOpcode)) + return "BadGlxBadCurrentWindow {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newErrorFuncs[5] = NewGlxBadCurrentWindowError +} + +// ErrorCopy definition GlxBadRenderRequest (6) + +const BadGlxBadRenderRequest = 6 + +type GlxBadRenderRequestError GlxGenericError + +func NewGlxBadRenderRequestError(buf []byte) Error { + v := GlxBadRenderRequestError(NewGlxGenericError(buf).(GlxGenericError)) + v.NiceName = "GlxBadRenderRequest" + return v +} + +func (err GlxBadRenderRequestError) ImplementsError() {} + +func (err GlxBadRenderRequestError) SequenceId() uint16 { + return err.Sequence +} + +func (err GlxBadRenderRequestError) BadId() Id { + return Id(err.BadValue) +} + +func (err GlxBadRenderRequestError) Error() string { + fieldVals := make([]string, 0, 4) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) + fieldVals = append(fieldVals, sprintf("BadValue: %d", err.BadValue)) + fieldVals = append(fieldVals, sprintf("MinorOpcode: %d", err.MinorOpcode)) + fieldVals = append(fieldVals, sprintf("MajorOpcode: %d", err.MajorOpcode)) + return "BadGlxBadRenderRequest {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newErrorFuncs[6] = NewGlxBadRenderRequestError +} + +// ErrorCopy definition GlxBadLargeRequest (7) + +const BadGlxBadLargeRequest = 7 + +type GlxBadLargeRequestError GlxGenericError + +func NewGlxBadLargeRequestError(buf []byte) Error { + v := GlxBadLargeRequestError(NewGlxGenericError(buf).(GlxGenericError)) + v.NiceName = "GlxBadLargeRequest" + return v +} + +func (err GlxBadLargeRequestError) ImplementsError() {} + +func (err GlxBadLargeRequestError) SequenceId() uint16 { + return err.Sequence +} + +func (err GlxBadLargeRequestError) BadId() Id { + return Id(err.BadValue) +} + +func (err GlxBadLargeRequestError) Error() string { + fieldVals := make([]string, 0, 4) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) + fieldVals = append(fieldVals, sprintf("BadValue: %d", err.BadValue)) + fieldVals = append(fieldVals, sprintf("MinorOpcode: %d", err.MinorOpcode)) + fieldVals = append(fieldVals, sprintf("MajorOpcode: %d", err.MajorOpcode)) + return "BadGlxBadLargeRequest {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newErrorFuncs[7] = NewGlxBadLargeRequestError +} + +// ErrorCopy definition GlxUnsupportedPrivateRequest (8) + +const BadGlxUnsupportedPrivateRequest = 8 + +type GlxUnsupportedPrivateRequestError GlxGenericError + +func NewGlxUnsupportedPrivateRequestError(buf []byte) Error { + v := GlxUnsupportedPrivateRequestError(NewGlxGenericError(buf).(GlxGenericError)) + v.NiceName = "GlxUnsupportedPrivateRequest" + return v +} + +func (err GlxUnsupportedPrivateRequestError) ImplementsError() {} + +func (err GlxUnsupportedPrivateRequestError) SequenceId() uint16 { + return err.Sequence +} + +func (err GlxUnsupportedPrivateRequestError) BadId() Id { + return Id(err.BadValue) +} + +func (err GlxUnsupportedPrivateRequestError) Error() string { + fieldVals := make([]string, 0, 4) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) + fieldVals = append(fieldVals, sprintf("BadValue: %d", err.BadValue)) + fieldVals = append(fieldVals, sprintf("MinorOpcode: %d", err.MinorOpcode)) + fieldVals = append(fieldVals, sprintf("MajorOpcode: %d", err.MajorOpcode)) + return "BadGlxUnsupportedPrivateRequest {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newErrorFuncs[8] = NewGlxUnsupportedPrivateRequestError +} + +// ErrorCopy definition GlxBadFBConfig (9) + +const BadGlxBadFBConfig = 9 + +type GlxBadFBConfigError GlxGenericError + +func NewGlxBadFBConfigError(buf []byte) Error { + v := GlxBadFBConfigError(NewGlxGenericError(buf).(GlxGenericError)) + v.NiceName = "GlxBadFBConfig" + return v +} + +func (err GlxBadFBConfigError) ImplementsError() {} + +func (err GlxBadFBConfigError) SequenceId() uint16 { + return err.Sequence +} + +func (err GlxBadFBConfigError) BadId() Id { + return Id(err.BadValue) +} + +func (err GlxBadFBConfigError) Error() string { + fieldVals := make([]string, 0, 4) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) + fieldVals = append(fieldVals, sprintf("BadValue: %d", err.BadValue)) + fieldVals = append(fieldVals, sprintf("MinorOpcode: %d", err.MinorOpcode)) + fieldVals = append(fieldVals, sprintf("MajorOpcode: %d", err.MajorOpcode)) + return "BadGlxBadFBConfig {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newErrorFuncs[9] = NewGlxBadFBConfigError +} + +// ErrorCopy definition GlxBadPbuffer (10) + +const BadGlxBadPbuffer = 10 + +type GlxBadPbufferError GlxGenericError + +func NewGlxBadPbufferError(buf []byte) Error { + v := GlxBadPbufferError(NewGlxGenericError(buf).(GlxGenericError)) + v.NiceName = "GlxBadPbuffer" + return v +} + +func (err GlxBadPbufferError) ImplementsError() {} + +func (err GlxBadPbufferError) SequenceId() uint16 { + return err.Sequence +} + +func (err GlxBadPbufferError) BadId() Id { + return Id(err.BadValue) +} + +func (err GlxBadPbufferError) Error() string { + fieldVals := make([]string, 0, 4) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) + fieldVals = append(fieldVals, sprintf("BadValue: %d", err.BadValue)) + fieldVals = append(fieldVals, sprintf("MinorOpcode: %d", err.MinorOpcode)) + fieldVals = append(fieldVals, sprintf("MajorOpcode: %d", err.MajorOpcode)) + return "BadGlxBadPbuffer {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newErrorFuncs[10] = NewGlxBadPbufferError +} + +// ErrorCopy definition GlxBadCurrentDrawable (11) + +const BadGlxBadCurrentDrawable = 11 + +type GlxBadCurrentDrawableError GlxGenericError + +func NewGlxBadCurrentDrawableError(buf []byte) Error { + v := GlxBadCurrentDrawableError(NewGlxGenericError(buf).(GlxGenericError)) + v.NiceName = "GlxBadCurrentDrawable" + return v +} + +func (err GlxBadCurrentDrawableError) ImplementsError() {} + +func (err GlxBadCurrentDrawableError) SequenceId() uint16 { + return err.Sequence +} + +func (err GlxBadCurrentDrawableError) BadId() Id { + return Id(err.BadValue) +} + +func (err GlxBadCurrentDrawableError) Error() string { + fieldVals := make([]string, 0, 4) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) + fieldVals = append(fieldVals, sprintf("BadValue: %d", err.BadValue)) + fieldVals = append(fieldVals, sprintf("MinorOpcode: %d", err.MinorOpcode)) + fieldVals = append(fieldVals, sprintf("MajorOpcode: %d", err.MajorOpcode)) + return "BadGlxBadCurrentDrawable {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newErrorFuncs[11] = NewGlxBadCurrentDrawableError +} + +// ErrorCopy definition GlxBadWindow (12) + +const BadGlxBadWindow = 12 + +type GlxBadWindowError GlxGenericError + +func NewGlxBadWindowError(buf []byte) Error { + v := GlxBadWindowError(NewGlxGenericError(buf).(GlxGenericError)) + v.NiceName = "GlxBadWindow" + return v +} + +func (err GlxBadWindowError) ImplementsError() {} + +func (err GlxBadWindowError) SequenceId() uint16 { + return err.Sequence +} + +func (err GlxBadWindowError) BadId() Id { + return Id(err.BadValue) +} + +func (err GlxBadWindowError) Error() string { + fieldVals := make([]string, 0, 4) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) + fieldVals = append(fieldVals, sprintf("BadValue: %d", err.BadValue)) + fieldVals = append(fieldVals, sprintf("MinorOpcode: %d", err.MinorOpcode)) + fieldVals = append(fieldVals, sprintf("MajorOpcode: %d", err.MajorOpcode)) + return "BadGlxBadWindow {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newErrorFuncs[12] = NewGlxBadWindowError +} + +// ErrorCopy definition GlxGLXBadProfileARB (13) + +const BadGlxGLXBadProfileARB = 13 + +type GlxGLXBadProfileARBError GlxGenericError + +func NewGlxGLXBadProfileARBError(buf []byte) Error { + v := GlxGLXBadProfileARBError(NewGlxGenericError(buf).(GlxGenericError)) + v.NiceName = "GlxGLXBadProfileARB" + return v +} + +func (err GlxGLXBadProfileARBError) ImplementsError() {} + +func (err GlxGLXBadProfileARBError) SequenceId() uint16 { + return err.Sequence +} + +func (err GlxGLXBadProfileARBError) BadId() Id { + return Id(err.BadValue) +} + +func (err GlxGLXBadProfileARBError) Error() string { + fieldVals := make([]string, 0, 4) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) + fieldVals = append(fieldVals, sprintf("BadValue: %d", err.BadValue)) + fieldVals = append(fieldVals, sprintf("MinorOpcode: %d", err.MinorOpcode)) + fieldVals = append(fieldVals, sprintf("MajorOpcode: %d", err.MajorOpcode)) + return "BadGlxGLXBadProfileARB {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newErrorFuncs[13] = NewGlxGLXBadProfileARBError +} + +// Request GlxRender +// size: pad((8 + pad((len(Data) * 1)))) +type GlxRenderCookie struct { + *cookie +} + +// Write request to wire for GlxRender +func (c *Conn) GlxRender(ContextTag GlxContextTag, Data []byte) GlxRenderCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.glxRenderRequest(ContextTag, Data), cookie) + return GlxRenderCookie{cookie} +} + +func (c *Conn) GlxRenderChecked(ContextTag GlxContextTag, Data []byte) GlxRenderCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.glxRenderRequest(ContextTag, Data), cookie) + return GlxRenderCookie{cookie} +} + +func (cook GlxRenderCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxRender +func (c *Conn) glxRenderRequest(ContextTag GlxContextTag, Data []byte) []byte { + size := pad((8 + pad((len(Data) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 1 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + copy(buf[b:], Data[:len(Data)]) + b += pad(int(len(Data))) + + return buf +} + +// Request GlxRenderLarge +// size: pad((16 + pad((int(DataLen) * 1)))) +type GlxRenderLargeCookie struct { + *cookie +} + +// Write request to wire for GlxRenderLarge +func (c *Conn) GlxRenderLarge(ContextTag GlxContextTag, RequestNum uint16, RequestTotal uint16, DataLen uint32, Data []byte) GlxRenderLargeCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.glxRenderLargeRequest(ContextTag, RequestNum, RequestTotal, DataLen, Data), cookie) + return GlxRenderLargeCookie{cookie} +} + +func (c *Conn) GlxRenderLargeChecked(ContextTag GlxContextTag, RequestNum uint16, RequestTotal uint16, DataLen uint32, Data []byte) GlxRenderLargeCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.glxRenderLargeRequest(ContextTag, RequestNum, RequestTotal, DataLen, Data), cookie) + return GlxRenderLargeCookie{cookie} +} + +func (cook GlxRenderLargeCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxRenderLarge +func (c *Conn) glxRenderLargeRequest(ContextTag GlxContextTag, RequestNum uint16, RequestTotal uint16, DataLen uint32, Data []byte) []byte { + size := pad((16 + pad((int(DataLen) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 2 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put16(buf[b:], RequestNum) + b += 2 + + Put16(buf[b:], RequestTotal) + b += 2 + + Put32(buf[b:], DataLen) + b += 4 + + copy(buf[b:], Data[:DataLen]) + b += pad(int(DataLen)) + + return buf +} + +// Request GlxCreateContext +// size: 24 +type GlxCreateContextCookie struct { + *cookie +} + +// Write request to wire for GlxCreateContext +func (c *Conn) GlxCreateContext(Context Id, Visual Visualid, Screen uint32, ShareList Id, IsDirect bool) GlxCreateContextCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.glxCreateContextRequest(Context, Visual, Screen, ShareList, IsDirect), cookie) + return GlxCreateContextCookie{cookie} +} + +func (c *Conn) GlxCreateContextChecked(Context Id, Visual Visualid, Screen uint32, ShareList Id, IsDirect bool) GlxCreateContextCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.glxCreateContextRequest(Context, Visual, Screen, ShareList, IsDirect), cookie) + return GlxCreateContextCookie{cookie} +} + +func (cook GlxCreateContextCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxCreateContext +func (c *Conn) glxCreateContextRequest(Context Id, Visual Visualid, Screen uint32, ShareList Id, IsDirect bool) []byte { + size := 24 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 3 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Context)) + b += 4 + + Put32(buf[b:], uint32(Visual)) + b += 4 + + Put32(buf[b:], Screen) + b += 4 + + Put32(buf[b:], uint32(ShareList)) + b += 4 + + if IsDirect { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + b += 3 // padding + + return buf +} + +// Request GlxDestroyContext +// size: 8 +type GlxDestroyContextCookie struct { + *cookie +} + +// Write request to wire for GlxDestroyContext +func (c *Conn) GlxDestroyContext(Context Id) GlxDestroyContextCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.glxDestroyContextRequest(Context), cookie) + return GlxDestroyContextCookie{cookie} +} + +func (c *Conn) GlxDestroyContextChecked(Context Id) GlxDestroyContextCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.glxDestroyContextRequest(Context), cookie) + return GlxDestroyContextCookie{cookie} +} + +func (cook GlxDestroyContextCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxDestroyContext +func (c *Conn) glxDestroyContextRequest(Context Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 4 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Context)) + b += 4 + + return buf +} + +// Request GlxMakeCurrent +// size: 16 +type GlxMakeCurrentCookie struct { + *cookie +} + +func (c *Conn) GlxMakeCurrent(Drawable Id, Context Id, OldContextTag GlxContextTag) GlxMakeCurrentCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxMakeCurrentRequest(Drawable, Context, OldContextTag), cookie) + return GlxMakeCurrentCookie{cookie} +} + +func (c *Conn) GlxMakeCurrentUnchecked(Drawable Id, Context Id, OldContextTag GlxContextTag) GlxMakeCurrentCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxMakeCurrentRequest(Drawable, Context, OldContextTag), cookie) + return GlxMakeCurrentCookie{cookie} +} + +// Request reply for GlxMakeCurrent +// size: 32 +type GlxMakeCurrentReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + ContextTag GlxContextTag + // padding: 20 bytes +} + +// Waits and reads reply data from request GlxMakeCurrent +func (cook GlxMakeCurrentCookie) Reply() (*GlxMakeCurrentReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxMakeCurrentReply(buf), nil +} + +// Read reply into structure from buffer for GlxMakeCurrent +func glxMakeCurrentReply(buf []byte) *GlxMakeCurrentReply { + v := new(GlxMakeCurrentReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.ContextTag = GlxContextTag(Get32(buf[b:])) + b += 4 + + b += 20 // padding + + return v +} + +func (cook GlxMakeCurrentCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxMakeCurrent +func (c *Conn) glxMakeCurrentRequest(Drawable Id, Context Id, OldContextTag GlxContextTag) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 5 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Drawable)) + b += 4 + + Put32(buf[b:], uint32(Context)) + b += 4 + + Put32(buf[b:], uint32(OldContextTag)) + b += 4 + + return buf +} + +// Request GlxIsDirect +// size: 8 +type GlxIsDirectCookie struct { + *cookie +} + +func (c *Conn) GlxIsDirect(Context Id) GlxIsDirectCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxIsDirectRequest(Context), cookie) + return GlxIsDirectCookie{cookie} +} + +func (c *Conn) GlxIsDirectUnchecked(Context Id) GlxIsDirectCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxIsDirectRequest(Context), cookie) + return GlxIsDirectCookie{cookie} +} + +// Request reply for GlxIsDirect +// size: 32 +type GlxIsDirectReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + IsDirect bool + // padding: 23 bytes +} + +// Waits and reads reply data from request GlxIsDirect +func (cook GlxIsDirectCookie) Reply() (*GlxIsDirectReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxIsDirectReply(buf), nil +} + +// Read reply into structure from buffer for GlxIsDirect +func glxIsDirectReply(buf []byte) *GlxIsDirectReply { + v := new(GlxIsDirectReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + if buf[b] == 1 { + v.IsDirect = true + } else { + v.IsDirect = false + } + b += 1 + + b += 23 // padding + + return v +} + +func (cook GlxIsDirectCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxIsDirect +func (c *Conn) glxIsDirectRequest(Context Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 6 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Context)) + b += 4 + + return buf +} + +// Request GlxQueryVersion +// size: 12 +type GlxQueryVersionCookie struct { + *cookie +} + +func (c *Conn) GlxQueryVersion(MajorVersion uint32, MinorVersion uint32) GlxQueryVersionCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxQueryVersionRequest(MajorVersion, MinorVersion), cookie) + return GlxQueryVersionCookie{cookie} +} + +func (c *Conn) GlxQueryVersionUnchecked(MajorVersion uint32, MinorVersion uint32) GlxQueryVersionCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxQueryVersionRequest(MajorVersion, MinorVersion), cookie) + return GlxQueryVersionCookie{cookie} +} + +// Request reply for GlxQueryVersion +// size: 32 +type GlxQueryVersionReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + MajorVersion uint32 + MinorVersion uint32 + // padding: 16 bytes +} + +// Waits and reads reply data from request GlxQueryVersion +func (cook GlxQueryVersionCookie) Reply() (*GlxQueryVersionReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxQueryVersionReply(buf), nil +} + +// Read reply into structure from buffer for GlxQueryVersion +func glxQueryVersionReply(buf []byte) *GlxQueryVersionReply { + v := new(GlxQueryVersionReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.MajorVersion = Get32(buf[b:]) + b += 4 + + v.MinorVersion = Get32(buf[b:]) + b += 4 + + b += 16 // padding + + return v +} + +func (cook GlxQueryVersionCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxQueryVersion +func (c *Conn) glxQueryVersionRequest(MajorVersion uint32, MinorVersion uint32) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 7 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], MajorVersion) + b += 4 + + Put32(buf[b:], MinorVersion) + b += 4 + + return buf +} + +// Request GlxWaitGL +// size: 8 +type GlxWaitGLCookie struct { + *cookie +} + +// Write request to wire for GlxWaitGL +func (c *Conn) GlxWaitGL(ContextTag GlxContextTag) GlxWaitGLCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.glxWaitGLRequest(ContextTag), cookie) + return GlxWaitGLCookie{cookie} +} + +func (c *Conn) GlxWaitGLChecked(ContextTag GlxContextTag) GlxWaitGLCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.glxWaitGLRequest(ContextTag), cookie) + return GlxWaitGLCookie{cookie} +} + +func (cook GlxWaitGLCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxWaitGL +func (c *Conn) glxWaitGLRequest(ContextTag GlxContextTag) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 8 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + return buf +} + +// Request GlxWaitX +// size: 8 +type GlxWaitXCookie struct { + *cookie +} + +// Write request to wire for GlxWaitX +func (c *Conn) GlxWaitX(ContextTag GlxContextTag) GlxWaitXCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.glxWaitXRequest(ContextTag), cookie) + return GlxWaitXCookie{cookie} +} + +func (c *Conn) GlxWaitXChecked(ContextTag GlxContextTag) GlxWaitXCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.glxWaitXRequest(ContextTag), cookie) + return GlxWaitXCookie{cookie} +} + +func (cook GlxWaitXCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxWaitX +func (c *Conn) glxWaitXRequest(ContextTag GlxContextTag) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 9 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + return buf +} + +// Request GlxCopyContext +// size: 20 +type GlxCopyContextCookie struct { + *cookie +} + +// Write request to wire for GlxCopyContext +func (c *Conn) GlxCopyContext(Src Id, Dest Id, Mask uint32, SrcContextTag GlxContextTag) GlxCopyContextCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.glxCopyContextRequest(Src, Dest, Mask, SrcContextTag), cookie) + return GlxCopyContextCookie{cookie} +} + +func (c *Conn) GlxCopyContextChecked(Src Id, Dest Id, Mask uint32, SrcContextTag GlxContextTag) GlxCopyContextCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.glxCopyContextRequest(Src, Dest, Mask, SrcContextTag), cookie) + return GlxCopyContextCookie{cookie} +} + +func (cook GlxCopyContextCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxCopyContext +func (c *Conn) glxCopyContextRequest(Src Id, Dest Id, Mask uint32, SrcContextTag GlxContextTag) []byte { + size := 20 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 10 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Src)) + b += 4 + + Put32(buf[b:], uint32(Dest)) + b += 4 + + Put32(buf[b:], Mask) + b += 4 + + Put32(buf[b:], uint32(SrcContextTag)) + b += 4 + + return buf +} + +// Request GlxSwapBuffers +// size: 12 +type GlxSwapBuffersCookie struct { + *cookie +} + +// Write request to wire for GlxSwapBuffers +func (c *Conn) GlxSwapBuffers(ContextTag GlxContextTag, Drawable Id) GlxSwapBuffersCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.glxSwapBuffersRequest(ContextTag, Drawable), cookie) + return GlxSwapBuffersCookie{cookie} +} + +func (c *Conn) GlxSwapBuffersChecked(ContextTag GlxContextTag, Drawable Id) GlxSwapBuffersCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.glxSwapBuffersRequest(ContextTag, Drawable), cookie) + return GlxSwapBuffersCookie{cookie} +} + +func (cook GlxSwapBuffersCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxSwapBuffers +func (c *Conn) glxSwapBuffersRequest(ContextTag GlxContextTag, Drawable Id) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 11 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], uint32(Drawable)) + b += 4 + + return buf +} + +// Request GlxUseXFont +// size: 24 +type GlxUseXFontCookie struct { + *cookie +} + +// Write request to wire for GlxUseXFont +func (c *Conn) GlxUseXFont(ContextTag GlxContextTag, Font Id, First uint32, Count uint32, ListBase uint32) GlxUseXFontCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.glxUseXFontRequest(ContextTag, Font, First, Count, ListBase), cookie) + return GlxUseXFontCookie{cookie} +} + +func (c *Conn) GlxUseXFontChecked(ContextTag GlxContextTag, Font Id, First uint32, Count uint32, ListBase uint32) GlxUseXFontCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.glxUseXFontRequest(ContextTag, Font, First, Count, ListBase), cookie) + return GlxUseXFontCookie{cookie} +} + +func (cook GlxUseXFontCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxUseXFont +func (c *Conn) glxUseXFontRequest(ContextTag GlxContextTag, Font Id, First uint32, Count uint32, ListBase uint32) []byte { + size := 24 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 12 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], uint32(Font)) + b += 4 + + Put32(buf[b:], First) + b += 4 + + Put32(buf[b:], Count) + b += 4 + + Put32(buf[b:], ListBase) + b += 4 + + return buf +} + +// Request GlxCreateGLXPixmap +// size: 20 +type GlxCreateGLXPixmapCookie struct { + *cookie +} + +// Write request to wire for GlxCreateGLXPixmap +func (c *Conn) GlxCreateGLXPixmap(Screen uint32, Visual Visualid, Pixmap Id, GlxPixmap Id) GlxCreateGLXPixmapCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.glxCreateGLXPixmapRequest(Screen, Visual, Pixmap, GlxPixmap), cookie) + return GlxCreateGLXPixmapCookie{cookie} +} + +func (c *Conn) GlxCreateGLXPixmapChecked(Screen uint32, Visual Visualid, Pixmap Id, GlxPixmap Id) GlxCreateGLXPixmapCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.glxCreateGLXPixmapRequest(Screen, Visual, Pixmap, GlxPixmap), cookie) + return GlxCreateGLXPixmapCookie{cookie} +} + +func (cook GlxCreateGLXPixmapCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxCreateGLXPixmap +func (c *Conn) glxCreateGLXPixmapRequest(Screen uint32, Visual Visualid, Pixmap Id, GlxPixmap Id) []byte { + size := 20 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 13 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], Screen) + b += 4 + + Put32(buf[b:], uint32(Visual)) + b += 4 + + Put32(buf[b:], uint32(Pixmap)) + b += 4 + + Put32(buf[b:], uint32(GlxPixmap)) + b += 4 + + return buf +} + +// Request GlxGetVisualConfigs +// size: 8 +type GlxGetVisualConfigsCookie struct { + *cookie +} + +func (c *Conn) GlxGetVisualConfigs(Screen uint32) GlxGetVisualConfigsCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGetVisualConfigsRequest(Screen), cookie) + return GlxGetVisualConfigsCookie{cookie} +} + +func (c *Conn) GlxGetVisualConfigsUnchecked(Screen uint32) GlxGetVisualConfigsCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGetVisualConfigsRequest(Screen), cookie) + return GlxGetVisualConfigsCookie{cookie} +} + +// Request reply for GlxGetVisualConfigs +// size: (32 + pad((int(Length) * 4))) +type GlxGetVisualConfigsReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + NumVisuals uint32 + NumProperties uint32 + // padding: 16 bytes + PropertyList []uint32 // size: pad((int(Length) * 4)) +} + +// Waits and reads reply data from request GlxGetVisualConfigs +func (cook GlxGetVisualConfigsCookie) Reply() (*GlxGetVisualConfigsReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGetVisualConfigsReply(buf), nil +} + +// Read reply into structure from buffer for GlxGetVisualConfigs +func glxGetVisualConfigsReply(buf []byte) *GlxGetVisualConfigsReply { + v := new(GlxGetVisualConfigsReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.NumVisuals = Get32(buf[b:]) + b += 4 + + v.NumProperties = Get32(buf[b:]) + b += 4 + + b += 16 // padding + + v.PropertyList = make([]uint32, v.Length) + for i := 0; i < int(v.Length); i++ { + v.PropertyList[i] = Get32(buf[b:]) + b += 4 + } + b = pad(b) + + return v +} + +func (cook GlxGetVisualConfigsCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGetVisualConfigs +func (c *Conn) glxGetVisualConfigsRequest(Screen uint32) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 14 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], Screen) + b += 4 + + return buf +} + +// Request GlxDestroyGLXPixmap +// size: 8 +type GlxDestroyGLXPixmapCookie struct { + *cookie +} + +// Write request to wire for GlxDestroyGLXPixmap +func (c *Conn) GlxDestroyGLXPixmap(GlxPixmap Id) GlxDestroyGLXPixmapCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.glxDestroyGLXPixmapRequest(GlxPixmap), cookie) + return GlxDestroyGLXPixmapCookie{cookie} +} + +func (c *Conn) GlxDestroyGLXPixmapChecked(GlxPixmap Id) GlxDestroyGLXPixmapCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.glxDestroyGLXPixmapRequest(GlxPixmap), cookie) + return GlxDestroyGLXPixmapCookie{cookie} +} + +func (cook GlxDestroyGLXPixmapCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxDestroyGLXPixmap +func (c *Conn) glxDestroyGLXPixmapRequest(GlxPixmap Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 15 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(GlxPixmap)) + b += 4 + + return buf +} + +// Request GlxVendorPrivate +// size: pad((12 + pad((len(Data) * 1)))) +type GlxVendorPrivateCookie struct { + *cookie +} + +// Write request to wire for GlxVendorPrivate +func (c *Conn) GlxVendorPrivate(VendorCode uint32, ContextTag GlxContextTag, Data []byte) GlxVendorPrivateCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.glxVendorPrivateRequest(VendorCode, ContextTag, Data), cookie) + return GlxVendorPrivateCookie{cookie} +} + +func (c *Conn) GlxVendorPrivateChecked(VendorCode uint32, ContextTag GlxContextTag, Data []byte) GlxVendorPrivateCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.glxVendorPrivateRequest(VendorCode, ContextTag, Data), cookie) + return GlxVendorPrivateCookie{cookie} +} + +func (cook GlxVendorPrivateCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxVendorPrivate +func (c *Conn) glxVendorPrivateRequest(VendorCode uint32, ContextTag GlxContextTag, Data []byte) []byte { + size := pad((12 + pad((len(Data) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 16 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], VendorCode) + b += 4 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + copy(buf[b:], Data[:len(Data)]) + b += pad(int(len(Data))) + + return buf +} + +// Request GlxVendorPrivateWithReply +// size: pad((12 + pad((len(Data) * 1)))) +type GlxVendorPrivateWithReplyCookie struct { + *cookie +} + +func (c *Conn) GlxVendorPrivateWithReply(VendorCode uint32, ContextTag GlxContextTag, Data []byte) GlxVendorPrivateWithReplyCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxVendorPrivateWithReplyRequest(VendorCode, ContextTag, Data), cookie) + return GlxVendorPrivateWithReplyCookie{cookie} +} + +func (c *Conn) GlxVendorPrivateWithReplyUnchecked(VendorCode uint32, ContextTag GlxContextTag, Data []byte) GlxVendorPrivateWithReplyCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxVendorPrivateWithReplyRequest(VendorCode, ContextTag, Data), cookie) + return GlxVendorPrivateWithReplyCookie{cookie} +} + +// Request reply for GlxVendorPrivateWithReply +// size: (36 + pad(((int(Length) * 4) * 1))) +type GlxVendorPrivateWithReplyReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Retval uint32 + Data1 []byte // size: 24 + Data2 []byte // size: pad(((int(Length) * 4) * 1)) +} + +// Waits and reads reply data from request GlxVendorPrivateWithReply +func (cook GlxVendorPrivateWithReplyCookie) Reply() (*GlxVendorPrivateWithReplyReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxVendorPrivateWithReplyReply(buf), nil +} + +// Read reply into structure from buffer for GlxVendorPrivateWithReply +func glxVendorPrivateWithReplyReply(buf []byte) *GlxVendorPrivateWithReplyReply { + v := new(GlxVendorPrivateWithReplyReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.Retval = Get32(buf[b:]) + b += 4 + + v.Data1 = make([]byte, 24) + copy(v.Data1[:24], buf[b:]) + b += pad(int(24)) + + v.Data2 = make([]byte, (int(v.Length) * 4)) + copy(v.Data2[:(int(v.Length)*4)], buf[b:]) + b += pad(int((int(v.Length) * 4))) + + return v +} + +func (cook GlxVendorPrivateWithReplyCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxVendorPrivateWithReply +func (c *Conn) glxVendorPrivateWithReplyRequest(VendorCode uint32, ContextTag GlxContextTag, Data []byte) []byte { + size := pad((12 + pad((len(Data) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 17 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], VendorCode) + b += 4 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + copy(buf[b:], Data[:len(Data)]) + b += pad(int(len(Data))) + + return buf +} + +// Request GlxQueryExtensionsString +// size: 8 +type GlxQueryExtensionsStringCookie struct { + *cookie +} + +func (c *Conn) GlxQueryExtensionsString(Screen uint32) GlxQueryExtensionsStringCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxQueryExtensionsStringRequest(Screen), cookie) + return GlxQueryExtensionsStringCookie{cookie} +} + +func (c *Conn) GlxQueryExtensionsStringUnchecked(Screen uint32) GlxQueryExtensionsStringCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxQueryExtensionsStringRequest(Screen), cookie) + return GlxQueryExtensionsStringCookie{cookie} +} + +// Request reply for GlxQueryExtensionsString +// size: 32 +type GlxQueryExtensionsStringReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 4 bytes + N uint32 + // padding: 16 bytes +} + +// Waits and reads reply data from request GlxQueryExtensionsString +func (cook GlxQueryExtensionsStringCookie) Reply() (*GlxQueryExtensionsStringReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxQueryExtensionsStringReply(buf), nil +} + +// Read reply into structure from buffer for GlxQueryExtensionsString +func glxQueryExtensionsStringReply(buf []byte) *GlxQueryExtensionsStringReply { + v := new(GlxQueryExtensionsStringReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 4 // padding + + v.N = Get32(buf[b:]) + b += 4 + + b += 16 // padding + + return v +} + +func (cook GlxQueryExtensionsStringCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxQueryExtensionsString +func (c *Conn) glxQueryExtensionsStringRequest(Screen uint32) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 18 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], Screen) + b += 4 + + return buf +} + +// Request GlxQueryServerString +// size: 12 +type GlxQueryServerStringCookie struct { + *cookie +} + +func (c *Conn) GlxQueryServerString(Screen uint32, Name uint32) GlxQueryServerStringCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxQueryServerStringRequest(Screen, Name), cookie) + return GlxQueryServerStringCookie{cookie} +} + +func (c *Conn) GlxQueryServerStringUnchecked(Screen uint32, Name uint32) GlxQueryServerStringCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxQueryServerStringRequest(Screen, Name), cookie) + return GlxQueryServerStringCookie{cookie} +} + +// Request reply for GlxQueryServerString +// size: (32 + pad((int(StrLen) * 1))) +type GlxQueryServerStringReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 4 bytes + StrLen uint32 + // padding: 16 bytes + String string // size: pad((int(StrLen) * 1)) +} + +// Waits and reads reply data from request GlxQueryServerString +func (cook GlxQueryServerStringCookie) Reply() (*GlxQueryServerStringReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxQueryServerStringReply(buf), nil +} + +// Read reply into structure from buffer for GlxQueryServerString +func glxQueryServerStringReply(buf []byte) *GlxQueryServerStringReply { + v := new(GlxQueryServerStringReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 4 // padding + + v.StrLen = Get32(buf[b:]) + b += 4 + + b += 16 // padding + + { + byteString := make([]byte, v.StrLen) + copy(byteString[:v.StrLen], buf[b:]) + v.String = string(byteString) + b += pad(int(v.StrLen)) + } + + return v +} + +func (cook GlxQueryServerStringCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxQueryServerString +func (c *Conn) glxQueryServerStringRequest(Screen uint32, Name uint32) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 19 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], Screen) + b += 4 + + Put32(buf[b:], Name) + b += 4 + + return buf +} + +// Request GlxClientInfo +// size: pad((16 + pad((int(StrLen) * 1)))) +type GlxClientInfoCookie struct { + *cookie +} + +// Write request to wire for GlxClientInfo +func (c *Conn) GlxClientInfo(MajorVersion uint32, MinorVersion uint32, StrLen uint32, String string) GlxClientInfoCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.glxClientInfoRequest(MajorVersion, MinorVersion, StrLen, String), cookie) + return GlxClientInfoCookie{cookie} +} + +func (c *Conn) GlxClientInfoChecked(MajorVersion uint32, MinorVersion uint32, StrLen uint32, String string) GlxClientInfoCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.glxClientInfoRequest(MajorVersion, MinorVersion, StrLen, String), cookie) + return GlxClientInfoCookie{cookie} +} + +func (cook GlxClientInfoCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxClientInfo +func (c *Conn) glxClientInfoRequest(MajorVersion uint32, MinorVersion uint32, StrLen uint32, String string) []byte { + size := pad((16 + pad((int(StrLen) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 20 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], MajorVersion) + b += 4 + + Put32(buf[b:], MinorVersion) + b += 4 + + Put32(buf[b:], StrLen) + b += 4 + + copy(buf[b:], String[:StrLen]) + b += pad(int(StrLen)) + + return buf +} + +// Request GlxGetFBConfigs +// size: 8 +type GlxGetFBConfigsCookie struct { + *cookie +} + +func (c *Conn) GlxGetFBConfigs(Screen uint32) GlxGetFBConfigsCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGetFBConfigsRequest(Screen), cookie) + return GlxGetFBConfigsCookie{cookie} +} + +func (c *Conn) GlxGetFBConfigsUnchecked(Screen uint32) GlxGetFBConfigsCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGetFBConfigsRequest(Screen), cookie) + return GlxGetFBConfigsCookie{cookie} +} + +// Request reply for GlxGetFBConfigs +// size: (32 + pad((int(Length) * 4))) +type GlxGetFBConfigsReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + NumFbConfigs uint32 + NumProperties uint32 + // padding: 16 bytes + PropertyList []uint32 // size: pad((int(Length) * 4)) +} + +// Waits and reads reply data from request GlxGetFBConfigs +func (cook GlxGetFBConfigsCookie) Reply() (*GlxGetFBConfigsReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGetFBConfigsReply(buf), nil +} + +// Read reply into structure from buffer for GlxGetFBConfigs +func glxGetFBConfigsReply(buf []byte) *GlxGetFBConfigsReply { + v := new(GlxGetFBConfigsReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.NumFbConfigs = Get32(buf[b:]) + b += 4 + + v.NumProperties = Get32(buf[b:]) + b += 4 + + b += 16 // padding + + v.PropertyList = make([]uint32, v.Length) + for i := 0; i < int(v.Length); i++ { + v.PropertyList[i] = Get32(buf[b:]) + b += 4 + } + b = pad(b) + + return v +} + +func (cook GlxGetFBConfigsCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGetFBConfigs +func (c *Conn) glxGetFBConfigsRequest(Screen uint32) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 21 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], Screen) + b += 4 + + return buf +} + +// Request GlxCreatePixmap +// size: pad((24 + pad(((int(NumAttribs) * 2) * 4)))) +type GlxCreatePixmapCookie struct { + *cookie +} + +// Write request to wire for GlxCreatePixmap +func (c *Conn) GlxCreatePixmap(Screen uint32, Fbconfig Id, Pixmap Id, GlxPixmap Id, NumAttribs uint32, Attribs []uint32) GlxCreatePixmapCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.glxCreatePixmapRequest(Screen, Fbconfig, Pixmap, GlxPixmap, NumAttribs, Attribs), cookie) + return GlxCreatePixmapCookie{cookie} +} + +func (c *Conn) GlxCreatePixmapChecked(Screen uint32, Fbconfig Id, Pixmap Id, GlxPixmap Id, NumAttribs uint32, Attribs []uint32) GlxCreatePixmapCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.glxCreatePixmapRequest(Screen, Fbconfig, Pixmap, GlxPixmap, NumAttribs, Attribs), cookie) + return GlxCreatePixmapCookie{cookie} +} + +func (cook GlxCreatePixmapCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxCreatePixmap +func (c *Conn) glxCreatePixmapRequest(Screen uint32, Fbconfig Id, Pixmap Id, GlxPixmap Id, NumAttribs uint32, Attribs []uint32) []byte { + size := pad((24 + pad(((int(NumAttribs) * 2) * 4)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 22 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], Screen) + b += 4 + + Put32(buf[b:], uint32(Fbconfig)) + b += 4 + + Put32(buf[b:], uint32(Pixmap)) + b += 4 + + Put32(buf[b:], uint32(GlxPixmap)) + b += 4 + + Put32(buf[b:], NumAttribs) + b += 4 + + for i := 0; i < int((int(NumAttribs) * 2)); i++ { + Put32(buf[b:], Attribs[i]) + b += 4 + } + b = pad(b) + + return buf +} + +// Request GlxDestroyPixmap +// size: 8 +type GlxDestroyPixmapCookie struct { + *cookie +} + +// Write request to wire for GlxDestroyPixmap +func (c *Conn) GlxDestroyPixmap(GlxPixmap Id) GlxDestroyPixmapCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.glxDestroyPixmapRequest(GlxPixmap), cookie) + return GlxDestroyPixmapCookie{cookie} +} + +func (c *Conn) GlxDestroyPixmapChecked(GlxPixmap Id) GlxDestroyPixmapCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.glxDestroyPixmapRequest(GlxPixmap), cookie) + return GlxDestroyPixmapCookie{cookie} +} + +func (cook GlxDestroyPixmapCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxDestroyPixmap +func (c *Conn) glxDestroyPixmapRequest(GlxPixmap Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 23 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(GlxPixmap)) + b += 4 + + return buf +} + +// Request GlxCreateNewContext +// size: 28 +type GlxCreateNewContextCookie struct { + *cookie +} + +// Write request to wire for GlxCreateNewContext +func (c *Conn) GlxCreateNewContext(Context Id, Fbconfig Id, Screen uint32, RenderType uint32, ShareList Id, IsDirect bool) GlxCreateNewContextCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.glxCreateNewContextRequest(Context, Fbconfig, Screen, RenderType, ShareList, IsDirect), cookie) + return GlxCreateNewContextCookie{cookie} +} + +func (c *Conn) GlxCreateNewContextChecked(Context Id, Fbconfig Id, Screen uint32, RenderType uint32, ShareList Id, IsDirect bool) GlxCreateNewContextCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.glxCreateNewContextRequest(Context, Fbconfig, Screen, RenderType, ShareList, IsDirect), cookie) + return GlxCreateNewContextCookie{cookie} +} + +func (cook GlxCreateNewContextCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxCreateNewContext +func (c *Conn) glxCreateNewContextRequest(Context Id, Fbconfig Id, Screen uint32, RenderType uint32, ShareList Id, IsDirect bool) []byte { + size := 28 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 24 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Context)) + b += 4 + + Put32(buf[b:], uint32(Fbconfig)) + b += 4 + + Put32(buf[b:], Screen) + b += 4 + + Put32(buf[b:], RenderType) + b += 4 + + Put32(buf[b:], uint32(ShareList)) + b += 4 + + if IsDirect { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + b += 3 // padding + + return buf +} + +// Request GlxQueryContext +// size: 8 +type GlxQueryContextCookie struct { + *cookie +} + +func (c *Conn) GlxQueryContext(Context Id) GlxQueryContextCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxQueryContextRequest(Context), cookie) + return GlxQueryContextCookie{cookie} +} + +func (c *Conn) GlxQueryContextUnchecked(Context Id) GlxQueryContextCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxQueryContextRequest(Context), cookie) + return GlxQueryContextCookie{cookie} +} + +// Request reply for GlxQueryContext +// size: (32 + pad(((int(NumAttribs) * 2) * 4))) +type GlxQueryContextReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + NumAttribs uint32 + // padding: 20 bytes + Attribs []uint32 // size: pad(((int(NumAttribs) * 2) * 4)) +} + +// Waits and reads reply data from request GlxQueryContext +func (cook GlxQueryContextCookie) Reply() (*GlxQueryContextReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxQueryContextReply(buf), nil +} + +// Read reply into structure from buffer for GlxQueryContext +func glxQueryContextReply(buf []byte) *GlxQueryContextReply { + v := new(GlxQueryContextReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.NumAttribs = Get32(buf[b:]) + b += 4 + + b += 20 // padding + + v.Attribs = make([]uint32, (int(v.NumAttribs) * 2)) + for i := 0; i < int((int(v.NumAttribs) * 2)); i++ { + v.Attribs[i] = Get32(buf[b:]) + b += 4 + } + b = pad(b) + + return v +} + +func (cook GlxQueryContextCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxQueryContext +func (c *Conn) glxQueryContextRequest(Context Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 25 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Context)) + b += 4 + + return buf +} + +// Request GlxMakeContextCurrent +// size: 20 +type GlxMakeContextCurrentCookie struct { + *cookie +} + +func (c *Conn) GlxMakeContextCurrent(OldContextTag GlxContextTag, Drawable Id, ReadDrawable Id, Context Id) GlxMakeContextCurrentCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxMakeContextCurrentRequest(OldContextTag, Drawable, ReadDrawable, Context), cookie) + return GlxMakeContextCurrentCookie{cookie} +} + +func (c *Conn) GlxMakeContextCurrentUnchecked(OldContextTag GlxContextTag, Drawable Id, ReadDrawable Id, Context Id) GlxMakeContextCurrentCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxMakeContextCurrentRequest(OldContextTag, Drawable, ReadDrawable, Context), cookie) + return GlxMakeContextCurrentCookie{cookie} +} + +// Request reply for GlxMakeContextCurrent +// size: 32 +type GlxMakeContextCurrentReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + ContextTag GlxContextTag + // padding: 20 bytes +} + +// Waits and reads reply data from request GlxMakeContextCurrent +func (cook GlxMakeContextCurrentCookie) Reply() (*GlxMakeContextCurrentReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxMakeContextCurrentReply(buf), nil +} + +// Read reply into structure from buffer for GlxMakeContextCurrent +func glxMakeContextCurrentReply(buf []byte) *GlxMakeContextCurrentReply { + v := new(GlxMakeContextCurrentReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.ContextTag = GlxContextTag(Get32(buf[b:])) + b += 4 + + b += 20 // padding + + return v +} + +func (cook GlxMakeContextCurrentCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxMakeContextCurrent +func (c *Conn) glxMakeContextCurrentRequest(OldContextTag GlxContextTag, Drawable Id, ReadDrawable Id, Context Id) []byte { + size := 20 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 26 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(OldContextTag)) + b += 4 + + Put32(buf[b:], uint32(Drawable)) + b += 4 + + Put32(buf[b:], uint32(ReadDrawable)) + b += 4 + + Put32(buf[b:], uint32(Context)) + b += 4 + + return buf +} + +// Request GlxCreatePbuffer +// size: pad((20 + pad(((int(NumAttribs) * 2) * 4)))) +type GlxCreatePbufferCookie struct { + *cookie +} + +// Write request to wire for GlxCreatePbuffer +func (c *Conn) GlxCreatePbuffer(Screen uint32, Fbconfig Id, Pbuffer Id, NumAttribs uint32, Attribs []uint32) GlxCreatePbufferCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.glxCreatePbufferRequest(Screen, Fbconfig, Pbuffer, NumAttribs, Attribs), cookie) + return GlxCreatePbufferCookie{cookie} +} + +func (c *Conn) GlxCreatePbufferChecked(Screen uint32, Fbconfig Id, Pbuffer Id, NumAttribs uint32, Attribs []uint32) GlxCreatePbufferCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.glxCreatePbufferRequest(Screen, Fbconfig, Pbuffer, NumAttribs, Attribs), cookie) + return GlxCreatePbufferCookie{cookie} +} + +func (cook GlxCreatePbufferCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxCreatePbuffer +func (c *Conn) glxCreatePbufferRequest(Screen uint32, Fbconfig Id, Pbuffer Id, NumAttribs uint32, Attribs []uint32) []byte { + size := pad((20 + pad(((int(NumAttribs) * 2) * 4)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 27 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], Screen) + b += 4 + + Put32(buf[b:], uint32(Fbconfig)) + b += 4 + + Put32(buf[b:], uint32(Pbuffer)) + b += 4 + + Put32(buf[b:], NumAttribs) + b += 4 + + for i := 0; i < int((int(NumAttribs) * 2)); i++ { + Put32(buf[b:], Attribs[i]) + b += 4 + } + b = pad(b) + + return buf +} + +// Request GlxDestroyPbuffer +// size: 8 +type GlxDestroyPbufferCookie struct { + *cookie +} + +// Write request to wire for GlxDestroyPbuffer +func (c *Conn) GlxDestroyPbuffer(Pbuffer Id) GlxDestroyPbufferCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.glxDestroyPbufferRequest(Pbuffer), cookie) + return GlxDestroyPbufferCookie{cookie} +} + +func (c *Conn) GlxDestroyPbufferChecked(Pbuffer Id) GlxDestroyPbufferCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.glxDestroyPbufferRequest(Pbuffer), cookie) + return GlxDestroyPbufferCookie{cookie} +} + +func (cook GlxDestroyPbufferCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxDestroyPbuffer +func (c *Conn) glxDestroyPbufferRequest(Pbuffer Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 28 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Pbuffer)) + b += 4 + + return buf +} + +// Request GlxGetDrawableAttributes +// size: 8 +type GlxGetDrawableAttributesCookie struct { + *cookie +} + +func (c *Conn) GlxGetDrawableAttributes(Drawable Id) GlxGetDrawableAttributesCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGetDrawableAttributesRequest(Drawable), cookie) + return GlxGetDrawableAttributesCookie{cookie} +} + +func (c *Conn) GlxGetDrawableAttributesUnchecked(Drawable Id) GlxGetDrawableAttributesCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGetDrawableAttributesRequest(Drawable), cookie) + return GlxGetDrawableAttributesCookie{cookie} +} + +// Request reply for GlxGetDrawableAttributes +// size: (32 + pad(((int(NumAttribs) * 2) * 4))) +type GlxGetDrawableAttributesReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + NumAttribs uint32 + // padding: 20 bytes + Attribs []uint32 // size: pad(((int(NumAttribs) * 2) * 4)) +} + +// Waits and reads reply data from request GlxGetDrawableAttributes +func (cook GlxGetDrawableAttributesCookie) Reply() (*GlxGetDrawableAttributesReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGetDrawableAttributesReply(buf), nil +} + +// Read reply into structure from buffer for GlxGetDrawableAttributes +func glxGetDrawableAttributesReply(buf []byte) *GlxGetDrawableAttributesReply { + v := new(GlxGetDrawableAttributesReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.NumAttribs = Get32(buf[b:]) + b += 4 + + b += 20 // padding + + v.Attribs = make([]uint32, (int(v.NumAttribs) * 2)) + for i := 0; i < int((int(v.NumAttribs) * 2)); i++ { + v.Attribs[i] = Get32(buf[b:]) + b += 4 + } + b = pad(b) + + return v +} + +func (cook GlxGetDrawableAttributesCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGetDrawableAttributes +func (c *Conn) glxGetDrawableAttributesRequest(Drawable Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 29 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Drawable)) + b += 4 + + return buf +} + +// Request GlxChangeDrawableAttributes +// size: pad((12 + pad(((int(NumAttribs) * 2) * 4)))) +type GlxChangeDrawableAttributesCookie struct { + *cookie +} + +// Write request to wire for GlxChangeDrawableAttributes +func (c *Conn) GlxChangeDrawableAttributes(Drawable Id, NumAttribs uint32, Attribs []uint32) GlxChangeDrawableAttributesCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.glxChangeDrawableAttributesRequest(Drawable, NumAttribs, Attribs), cookie) + return GlxChangeDrawableAttributesCookie{cookie} +} + +func (c *Conn) GlxChangeDrawableAttributesChecked(Drawable Id, NumAttribs uint32, Attribs []uint32) GlxChangeDrawableAttributesCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.glxChangeDrawableAttributesRequest(Drawable, NumAttribs, Attribs), cookie) + return GlxChangeDrawableAttributesCookie{cookie} +} + +func (cook GlxChangeDrawableAttributesCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxChangeDrawableAttributes +func (c *Conn) glxChangeDrawableAttributesRequest(Drawable Id, NumAttribs uint32, Attribs []uint32) []byte { + size := pad((12 + pad(((int(NumAttribs) * 2) * 4)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 30 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Drawable)) + b += 4 + + Put32(buf[b:], NumAttribs) + b += 4 + + for i := 0; i < int((int(NumAttribs) * 2)); i++ { + Put32(buf[b:], Attribs[i]) + b += 4 + } + b = pad(b) + + return buf +} + +// Request GlxCreateWindow +// size: pad((24 + pad(((int(NumAttribs) * 2) * 4)))) +type GlxCreateWindowCookie struct { + *cookie +} + +// Write request to wire for GlxCreateWindow +func (c *Conn) GlxCreateWindow(Screen uint32, Fbconfig Id, Window Id, GlxWindow Id, NumAttribs uint32, Attribs []uint32) GlxCreateWindowCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.glxCreateWindowRequest(Screen, Fbconfig, Window, GlxWindow, NumAttribs, Attribs), cookie) + return GlxCreateWindowCookie{cookie} +} + +func (c *Conn) GlxCreateWindowChecked(Screen uint32, Fbconfig Id, Window Id, GlxWindow Id, NumAttribs uint32, Attribs []uint32) GlxCreateWindowCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.glxCreateWindowRequest(Screen, Fbconfig, Window, GlxWindow, NumAttribs, Attribs), cookie) + return GlxCreateWindowCookie{cookie} +} + +func (cook GlxCreateWindowCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxCreateWindow +func (c *Conn) glxCreateWindowRequest(Screen uint32, Fbconfig Id, Window Id, GlxWindow Id, NumAttribs uint32, Attribs []uint32) []byte { + size := pad((24 + pad(((int(NumAttribs) * 2) * 4)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 31 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], Screen) + b += 4 + + Put32(buf[b:], uint32(Fbconfig)) + b += 4 + + Put32(buf[b:], uint32(Window)) + b += 4 + + Put32(buf[b:], uint32(GlxWindow)) + b += 4 + + Put32(buf[b:], NumAttribs) + b += 4 + + for i := 0; i < int((int(NumAttribs) * 2)); i++ { + Put32(buf[b:], Attribs[i]) + b += 4 + } + b = pad(b) + + return buf +} + +// Request GlxDeleteWindow +// size: 8 +type GlxDeleteWindowCookie struct { + *cookie +} + +// Write request to wire for GlxDeleteWindow +func (c *Conn) GlxDeleteWindow(Glxwindow Id) GlxDeleteWindowCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.glxDeleteWindowRequest(Glxwindow), cookie) + return GlxDeleteWindowCookie{cookie} +} + +func (c *Conn) GlxDeleteWindowChecked(Glxwindow Id) GlxDeleteWindowCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.glxDeleteWindowRequest(Glxwindow), cookie) + return GlxDeleteWindowCookie{cookie} +} + +func (cook GlxDeleteWindowCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxDeleteWindow +func (c *Conn) glxDeleteWindowRequest(Glxwindow Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 32 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Glxwindow)) + b += 4 + + return buf +} + +// Request GlxSetClientInfoARB +// size: pad((((24 + pad(((int(NumVersions) * 2) * 4))) + pad((int(GlStrLen) * 1))) + pad((int(GlxStrLen) * 1)))) +type GlxSetClientInfoARBCookie struct { + *cookie +} + +// Write request to wire for GlxSetClientInfoARB +func (c *Conn) GlxSetClientInfoARB(MajorVersion uint32, MinorVersion uint32, NumVersions uint32, GlStrLen uint32, GlxStrLen uint32, GlVersions []uint32, GlExtensionString string, GlxExtensionString string) GlxSetClientInfoARBCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.glxSetClientInfoARBRequest(MajorVersion, MinorVersion, NumVersions, GlStrLen, GlxStrLen, GlVersions, GlExtensionString, GlxExtensionString), cookie) + return GlxSetClientInfoARBCookie{cookie} +} + +func (c *Conn) GlxSetClientInfoARBChecked(MajorVersion uint32, MinorVersion uint32, NumVersions uint32, GlStrLen uint32, GlxStrLen uint32, GlVersions []uint32, GlExtensionString string, GlxExtensionString string) GlxSetClientInfoARBCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.glxSetClientInfoARBRequest(MajorVersion, MinorVersion, NumVersions, GlStrLen, GlxStrLen, GlVersions, GlExtensionString, GlxExtensionString), cookie) + return GlxSetClientInfoARBCookie{cookie} +} + +func (cook GlxSetClientInfoARBCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxSetClientInfoARB +func (c *Conn) glxSetClientInfoARBRequest(MajorVersion uint32, MinorVersion uint32, NumVersions uint32, GlStrLen uint32, GlxStrLen uint32, GlVersions []uint32, GlExtensionString string, GlxExtensionString string) []byte { + size := pad((((24 + pad(((int(NumVersions) * 2) * 4))) + pad((int(GlStrLen) * 1))) + pad((int(GlxStrLen) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 33 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], MajorVersion) + b += 4 + + Put32(buf[b:], MinorVersion) + b += 4 + + Put32(buf[b:], NumVersions) + b += 4 + + Put32(buf[b:], GlStrLen) + b += 4 + + Put32(buf[b:], GlxStrLen) + b += 4 + + for i := 0; i < int((int(NumVersions) * 2)); i++ { + Put32(buf[b:], GlVersions[i]) + b += 4 + } + b = pad(b) + + copy(buf[b:], GlExtensionString[:GlStrLen]) + b += pad(int(GlStrLen)) + + copy(buf[b:], GlxExtensionString[:GlxStrLen]) + b += pad(int(GlxStrLen)) + + return buf +} + +// Request GlxCreateContextAttribsARB +// size: pad((28 + pad(((int(NumAttribs) * 2) * 4)))) +type GlxCreateContextAttribsARBCookie struct { + *cookie +} + +// Write request to wire for GlxCreateContextAttribsARB +func (c *Conn) GlxCreateContextAttribsARB(Context Id, Fbconfig Id, Screen uint32, ShareList Id, IsDirect bool, NumAttribs uint32, Attribs []uint32) GlxCreateContextAttribsARBCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.glxCreateContextAttribsARBRequest(Context, Fbconfig, Screen, ShareList, IsDirect, NumAttribs, Attribs), cookie) + return GlxCreateContextAttribsARBCookie{cookie} +} + +func (c *Conn) GlxCreateContextAttribsARBChecked(Context Id, Fbconfig Id, Screen uint32, ShareList Id, IsDirect bool, NumAttribs uint32, Attribs []uint32) GlxCreateContextAttribsARBCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.glxCreateContextAttribsARBRequest(Context, Fbconfig, Screen, ShareList, IsDirect, NumAttribs, Attribs), cookie) + return GlxCreateContextAttribsARBCookie{cookie} +} + +func (cook GlxCreateContextAttribsARBCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxCreateContextAttribsARB +func (c *Conn) glxCreateContextAttribsARBRequest(Context Id, Fbconfig Id, Screen uint32, ShareList Id, IsDirect bool, NumAttribs uint32, Attribs []uint32) []byte { + size := pad((28 + pad(((int(NumAttribs) * 2) * 4)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 34 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Context)) + b += 4 + + Put32(buf[b:], uint32(Fbconfig)) + b += 4 + + Put32(buf[b:], Screen) + b += 4 + + Put32(buf[b:], uint32(ShareList)) + b += 4 + + if IsDirect { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + b += 3 // padding + + Put32(buf[b:], NumAttribs) + b += 4 + + for i := 0; i < int((int(NumAttribs) * 2)); i++ { + Put32(buf[b:], Attribs[i]) + b += 4 + } + b = pad(b) + + return buf +} + +// Request GlxSetClientInfo2ARB +// size: pad((((24 + pad(((int(NumVersions) * 3) * 4))) + pad((int(GlStrLen) * 1))) + pad((int(GlxStrLen) * 1)))) +type GlxSetClientInfo2ARBCookie struct { + *cookie +} + +// Write request to wire for GlxSetClientInfo2ARB +func (c *Conn) GlxSetClientInfo2ARB(MajorVersion uint32, MinorVersion uint32, NumVersions uint32, GlStrLen uint32, GlxStrLen uint32, GlVersions []uint32, GlExtensionString string, GlxExtensionString string) GlxSetClientInfo2ARBCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.glxSetClientInfo2ARBRequest(MajorVersion, MinorVersion, NumVersions, GlStrLen, GlxStrLen, GlVersions, GlExtensionString, GlxExtensionString), cookie) + return GlxSetClientInfo2ARBCookie{cookie} +} + +func (c *Conn) GlxSetClientInfo2ARBChecked(MajorVersion uint32, MinorVersion uint32, NumVersions uint32, GlStrLen uint32, GlxStrLen uint32, GlVersions []uint32, GlExtensionString string, GlxExtensionString string) GlxSetClientInfo2ARBCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.glxSetClientInfo2ARBRequest(MajorVersion, MinorVersion, NumVersions, GlStrLen, GlxStrLen, GlVersions, GlExtensionString, GlxExtensionString), cookie) + return GlxSetClientInfo2ARBCookie{cookie} +} + +func (cook GlxSetClientInfo2ARBCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxSetClientInfo2ARB +func (c *Conn) glxSetClientInfo2ARBRequest(MajorVersion uint32, MinorVersion uint32, NumVersions uint32, GlStrLen uint32, GlxStrLen uint32, GlVersions []uint32, GlExtensionString string, GlxExtensionString string) []byte { + size := pad((((24 + pad(((int(NumVersions) * 3) * 4))) + pad((int(GlStrLen) * 1))) + pad((int(GlxStrLen) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 35 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], MajorVersion) + b += 4 + + Put32(buf[b:], MinorVersion) + b += 4 + + Put32(buf[b:], NumVersions) + b += 4 + + Put32(buf[b:], GlStrLen) + b += 4 + + Put32(buf[b:], GlxStrLen) + b += 4 + + for i := 0; i < int((int(NumVersions) * 3)); i++ { + Put32(buf[b:], GlVersions[i]) + b += 4 + } + b = pad(b) + + copy(buf[b:], GlExtensionString[:GlStrLen]) + b += pad(int(GlStrLen)) + + copy(buf[b:], GlxExtensionString[:GlxStrLen]) + b += pad(int(GlxStrLen)) + + return buf +} + +// Request GlxNewList +// size: 16 +type GlxNewListCookie struct { + *cookie +} + +// Write request to wire for GlxNewList +func (c *Conn) GlxNewList(ContextTag GlxContextTag, List uint32, Mode uint32) GlxNewListCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.glxNewListRequest(ContextTag, List, Mode), cookie) + return GlxNewListCookie{cookie} +} + +func (c *Conn) GlxNewListChecked(ContextTag GlxContextTag, List uint32, Mode uint32) GlxNewListCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.glxNewListRequest(ContextTag, List, Mode), cookie) + return GlxNewListCookie{cookie} +} + +func (cook GlxNewListCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxNewList +func (c *Conn) glxNewListRequest(ContextTag GlxContextTag, List uint32, Mode uint32) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 101 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], List) + b += 4 + + Put32(buf[b:], Mode) + b += 4 + + return buf +} + +// Request GlxEndList +// size: 8 +type GlxEndListCookie struct { + *cookie +} + +// Write request to wire for GlxEndList +func (c *Conn) GlxEndList(ContextTag GlxContextTag) GlxEndListCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.glxEndListRequest(ContextTag), cookie) + return GlxEndListCookie{cookie} +} + +func (c *Conn) GlxEndListChecked(ContextTag GlxContextTag) GlxEndListCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.glxEndListRequest(ContextTag), cookie) + return GlxEndListCookie{cookie} +} + +func (cook GlxEndListCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxEndList +func (c *Conn) glxEndListRequest(ContextTag GlxContextTag) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 102 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + return buf +} + +// Request GlxDeleteLists +// size: 16 +type GlxDeleteListsCookie struct { + *cookie +} + +// Write request to wire for GlxDeleteLists +func (c *Conn) GlxDeleteLists(ContextTag GlxContextTag, List uint32, Range int32) GlxDeleteListsCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.glxDeleteListsRequest(ContextTag, List, Range), cookie) + return GlxDeleteListsCookie{cookie} +} + +func (c *Conn) GlxDeleteListsChecked(ContextTag GlxContextTag, List uint32, Range int32) GlxDeleteListsCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.glxDeleteListsRequest(ContextTag, List, Range), cookie) + return GlxDeleteListsCookie{cookie} +} + +func (cook GlxDeleteListsCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxDeleteLists +func (c *Conn) glxDeleteListsRequest(ContextTag GlxContextTag, List uint32, Range int32) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 103 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], List) + b += 4 + + Put32(buf[b:], uint32(Range)) + b += 4 + + return buf +} + +// Request GlxGenLists +// size: 12 +type GlxGenListsCookie struct { + *cookie +} + +func (c *Conn) GlxGenLists(ContextTag GlxContextTag, Range int32) GlxGenListsCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGenListsRequest(ContextTag, Range), cookie) + return GlxGenListsCookie{cookie} +} + +func (c *Conn) GlxGenListsUnchecked(ContextTag GlxContextTag, Range int32) GlxGenListsCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGenListsRequest(ContextTag, Range), cookie) + return GlxGenListsCookie{cookie} +} + +// Request reply for GlxGenLists +// size: 12 +type GlxGenListsReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + RetVal uint32 +} + +// Waits and reads reply data from request GlxGenLists +func (cook GlxGenListsCookie) Reply() (*GlxGenListsReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGenListsReply(buf), nil +} + +// Read reply into structure from buffer for GlxGenLists +func glxGenListsReply(buf []byte) *GlxGenListsReply { + v := new(GlxGenListsReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.RetVal = Get32(buf[b:]) + b += 4 + + return v +} + +func (cook GlxGenListsCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGenLists +func (c *Conn) glxGenListsRequest(ContextTag GlxContextTag, Range int32) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 104 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], uint32(Range)) + b += 4 + + return buf +} + +// Request GlxFeedbackBuffer +// size: 16 +type GlxFeedbackBufferCookie struct { + *cookie +} + +// Write request to wire for GlxFeedbackBuffer +func (c *Conn) GlxFeedbackBuffer(ContextTag GlxContextTag, Size int32, Type int32) GlxFeedbackBufferCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.glxFeedbackBufferRequest(ContextTag, Size, Type), cookie) + return GlxFeedbackBufferCookie{cookie} +} + +func (c *Conn) GlxFeedbackBufferChecked(ContextTag GlxContextTag, Size int32, Type int32) GlxFeedbackBufferCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.glxFeedbackBufferRequest(ContextTag, Size, Type), cookie) + return GlxFeedbackBufferCookie{cookie} +} + +func (cook GlxFeedbackBufferCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxFeedbackBuffer +func (c *Conn) glxFeedbackBufferRequest(ContextTag GlxContextTag, Size int32, Type int32) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 105 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], uint32(Size)) + b += 4 + + Put32(buf[b:], uint32(Type)) + b += 4 + + return buf +} + +// Request GlxSelectBuffer +// size: 12 +type GlxSelectBufferCookie struct { + *cookie +} + +// Write request to wire for GlxSelectBuffer +func (c *Conn) GlxSelectBuffer(ContextTag GlxContextTag, Size int32) GlxSelectBufferCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.glxSelectBufferRequest(ContextTag, Size), cookie) + return GlxSelectBufferCookie{cookie} +} + +func (c *Conn) GlxSelectBufferChecked(ContextTag GlxContextTag, Size int32) GlxSelectBufferCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.glxSelectBufferRequest(ContextTag, Size), cookie) + return GlxSelectBufferCookie{cookie} +} + +func (cook GlxSelectBufferCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxSelectBuffer +func (c *Conn) glxSelectBufferRequest(ContextTag GlxContextTag, Size int32) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 106 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], uint32(Size)) + b += 4 + + return buf +} + +// Request GlxRenderMode +// size: 12 +type GlxRenderModeCookie struct { + *cookie +} + +func (c *Conn) GlxRenderMode(ContextTag GlxContextTag, Mode uint32) GlxRenderModeCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxRenderModeRequest(ContextTag, Mode), cookie) + return GlxRenderModeCookie{cookie} +} + +func (c *Conn) GlxRenderModeUnchecked(ContextTag GlxContextTag, Mode uint32) GlxRenderModeCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxRenderModeRequest(ContextTag, Mode), cookie) + return GlxRenderModeCookie{cookie} +} + +// Request reply for GlxRenderMode +// size: (32 + pad((int(N) * 4))) +type GlxRenderModeReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + RetVal uint32 + N uint32 + NewMode uint32 + // padding: 12 bytes + Data []uint32 // size: pad((int(N) * 4)) +} + +// Waits and reads reply data from request GlxRenderMode +func (cook GlxRenderModeCookie) Reply() (*GlxRenderModeReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxRenderModeReply(buf), nil +} + +// Read reply into structure from buffer for GlxRenderMode +func glxRenderModeReply(buf []byte) *GlxRenderModeReply { + v := new(GlxRenderModeReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.RetVal = Get32(buf[b:]) + b += 4 + + v.N = Get32(buf[b:]) + b += 4 + + v.NewMode = Get32(buf[b:]) + b += 4 + + b += 12 // padding + + v.Data = make([]uint32, v.N) + for i := 0; i < int(v.N); i++ { + v.Data[i] = Get32(buf[b:]) + b += 4 + } + b = pad(b) + + return v +} + +func (cook GlxRenderModeCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxRenderMode +func (c *Conn) glxRenderModeRequest(ContextTag GlxContextTag, Mode uint32) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 107 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], Mode) + b += 4 + + return buf +} + +// Request GlxFinish +// size: 8 +type GlxFinishCookie struct { + *cookie +} + +func (c *Conn) GlxFinish(ContextTag GlxContextTag) GlxFinishCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxFinishRequest(ContextTag), cookie) + return GlxFinishCookie{cookie} +} + +func (c *Conn) GlxFinishUnchecked(ContextTag GlxContextTag) GlxFinishCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxFinishRequest(ContextTag), cookie) + return GlxFinishCookie{cookie} +} + +// Request reply for GlxFinish +// size: 8 +type GlxFinishReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes +} + +// Waits and reads reply data from request GlxFinish +func (cook GlxFinishCookie) Reply() (*GlxFinishReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxFinishReply(buf), nil +} + +// Read reply into structure from buffer for GlxFinish +func glxFinishReply(buf []byte) *GlxFinishReply { + v := new(GlxFinishReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + return v +} + +func (cook GlxFinishCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxFinish +func (c *Conn) glxFinishRequest(ContextTag GlxContextTag) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 108 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + return buf +} + +// Request GlxPixelStoref +// size: 16 +type GlxPixelStorefCookie struct { + *cookie +} + +// Write request to wire for GlxPixelStoref +func (c *Conn) GlxPixelStoref(ContextTag GlxContextTag, Pname uint32, Datum GlxFloat32) GlxPixelStorefCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.glxPixelStorefRequest(ContextTag, Pname, Datum), cookie) + return GlxPixelStorefCookie{cookie} +} + +func (c *Conn) GlxPixelStorefChecked(ContextTag GlxContextTag, Pname uint32, Datum GlxFloat32) GlxPixelStorefCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.glxPixelStorefRequest(ContextTag, Pname, Datum), cookie) + return GlxPixelStorefCookie{cookie} +} + +func (cook GlxPixelStorefCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxPixelStoref +func (c *Conn) glxPixelStorefRequest(ContextTag GlxContextTag, Pname uint32, Datum GlxFloat32) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 109 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], Pname) + b += 4 + + Put32(buf[b:], uint32(Datum)) + b += 4 + + return buf +} + +// Request GlxPixelStorei +// size: 16 +type GlxPixelStoreiCookie struct { + *cookie +} + +// Write request to wire for GlxPixelStorei +func (c *Conn) GlxPixelStorei(ContextTag GlxContextTag, Pname uint32, Datum int32) GlxPixelStoreiCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.glxPixelStoreiRequest(ContextTag, Pname, Datum), cookie) + return GlxPixelStoreiCookie{cookie} +} + +func (c *Conn) GlxPixelStoreiChecked(ContextTag GlxContextTag, Pname uint32, Datum int32) GlxPixelStoreiCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.glxPixelStoreiRequest(ContextTag, Pname, Datum), cookie) + return GlxPixelStoreiCookie{cookie} +} + +func (cook GlxPixelStoreiCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxPixelStorei +func (c *Conn) glxPixelStoreiRequest(ContextTag GlxContextTag, Pname uint32, Datum int32) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 110 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], Pname) + b += 4 + + Put32(buf[b:], uint32(Datum)) + b += 4 + + return buf +} + +// Request GlxReadPixels +// size: 36 +type GlxReadPixelsCookie struct { + *cookie +} + +func (c *Conn) GlxReadPixels(ContextTag GlxContextTag, X int32, Y int32, Width int32, Height int32, Format uint32, Type uint32, SwapBytes bool, LsbFirst bool) GlxReadPixelsCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxReadPixelsRequest(ContextTag, X, Y, Width, Height, Format, Type, SwapBytes, LsbFirst), cookie) + return GlxReadPixelsCookie{cookie} +} + +func (c *Conn) GlxReadPixelsUnchecked(ContextTag GlxContextTag, X int32, Y int32, Width int32, Height int32, Format uint32, Type uint32, SwapBytes bool, LsbFirst bool) GlxReadPixelsCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxReadPixelsRequest(ContextTag, X, Y, Width, Height, Format, Type, SwapBytes, LsbFirst), cookie) + return GlxReadPixelsCookie{cookie} +} + +// Request reply for GlxReadPixels +// size: (32 + pad(((int(Length) * 4) * 1))) +type GlxReadPixelsReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 24 bytes + Data []byte // size: pad(((int(Length) * 4) * 1)) +} + +// Waits and reads reply data from request GlxReadPixels +func (cook GlxReadPixelsCookie) Reply() (*GlxReadPixelsReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxReadPixelsReply(buf), nil +} + +// Read reply into structure from buffer for GlxReadPixels +func glxReadPixelsReply(buf []byte) *GlxReadPixelsReply { + v := new(GlxReadPixelsReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 24 // padding + + v.Data = make([]byte, (int(v.Length) * 4)) + copy(v.Data[:(int(v.Length)*4)], buf[b:]) + b += pad(int((int(v.Length) * 4))) + + return v +} + +func (cook GlxReadPixelsCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxReadPixels +func (c *Conn) glxReadPixelsRequest(ContextTag GlxContextTag, X int32, Y int32, Width int32, Height int32, Format uint32, Type uint32, SwapBytes bool, LsbFirst bool) []byte { + size := 36 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 111 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], uint32(X)) + b += 4 + + Put32(buf[b:], uint32(Y)) + b += 4 + + Put32(buf[b:], uint32(Width)) + b += 4 + + Put32(buf[b:], uint32(Height)) + b += 4 + + Put32(buf[b:], Format) + b += 4 + + Put32(buf[b:], Type) + b += 4 + + if SwapBytes { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + if LsbFirst { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + return buf +} + +// Request GlxGetBooleanv +// size: 12 +type GlxGetBooleanvCookie struct { + *cookie +} + +func (c *Conn) GlxGetBooleanv(ContextTag GlxContextTag, Pname int32) GlxGetBooleanvCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGetBooleanvRequest(ContextTag, Pname), cookie) + return GlxGetBooleanvCookie{cookie} +} + +func (c *Conn) GlxGetBooleanvUnchecked(ContextTag GlxContextTag, Pname int32) GlxGetBooleanvCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGetBooleanvRequest(ContextTag, Pname), cookie) + return GlxGetBooleanvCookie{cookie} +} + +// Request reply for GlxGetBooleanv +// size: (32 + pad((int(N) * 1))) +type GlxGetBooleanvReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 4 bytes + N uint32 + Datum bool + // padding: 15 bytes + Data []bool // size: pad((int(N) * 1)) +} + +// Waits and reads reply data from request GlxGetBooleanv +func (cook GlxGetBooleanvCookie) Reply() (*GlxGetBooleanvReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGetBooleanvReply(buf), nil +} + +// Read reply into structure from buffer for GlxGetBooleanv +func glxGetBooleanvReply(buf []byte) *GlxGetBooleanvReply { + v := new(GlxGetBooleanvReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 4 // padding + + v.N = Get32(buf[b:]) + b += 4 + + if buf[b] == 1 { + v.Datum = true + } else { + v.Datum = false + } + b += 1 + + b += 15 // padding + + v.Data = make([]bool, v.N) + for i := 0; i < int(v.N); i++ { + if buf[b] == 1 { + v.Data[i] = true + } else { + v.Data[i] = false + } + b += 1 + } + b = pad(b) + + return v +} + +func (cook GlxGetBooleanvCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGetBooleanv +func (c *Conn) glxGetBooleanvRequest(ContextTag GlxContextTag, Pname int32) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 112 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], uint32(Pname)) + b += 4 + + return buf +} + +// Request GlxGetClipPlane +// size: 12 +type GlxGetClipPlaneCookie struct { + *cookie +} + +func (c *Conn) GlxGetClipPlane(ContextTag GlxContextTag, Plane int32) GlxGetClipPlaneCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGetClipPlaneRequest(ContextTag, Plane), cookie) + return GlxGetClipPlaneCookie{cookie} +} + +func (c *Conn) GlxGetClipPlaneUnchecked(ContextTag GlxContextTag, Plane int32) GlxGetClipPlaneCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGetClipPlaneRequest(ContextTag, Plane), cookie) + return GlxGetClipPlaneCookie{cookie} +} + +// Request reply for GlxGetClipPlane +// size: (32 + pad(((int(Length) / 2) * 8))) +type GlxGetClipPlaneReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 24 bytes + Data []GlxFloat64 // size: pad(((int(Length) / 2) * 8)) +} + +// Waits and reads reply data from request GlxGetClipPlane +func (cook GlxGetClipPlaneCookie) Reply() (*GlxGetClipPlaneReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGetClipPlaneReply(buf), nil +} + +// Read reply into structure from buffer for GlxGetClipPlane +func glxGetClipPlaneReply(buf []byte) *GlxGetClipPlaneReply { + v := new(GlxGetClipPlaneReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 24 // padding + + v.Data = make([]GlxFloat64, (int(v.Length) / 2)) + for i := 0; i < int((int(v.Length) / 2)); i++ { + v.Data[i] = GlxFloat64(Get64(buf[b:])) + b += 8 + } + b = pad(b) + + return v +} + +func (cook GlxGetClipPlaneCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGetClipPlane +func (c *Conn) glxGetClipPlaneRequest(ContextTag GlxContextTag, Plane int32) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 113 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], uint32(Plane)) + b += 4 + + return buf +} + +// Request GlxGetDoublev +// size: 12 +type GlxGetDoublevCookie struct { + *cookie +} + +func (c *Conn) GlxGetDoublev(ContextTag GlxContextTag, Pname uint32) GlxGetDoublevCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGetDoublevRequest(ContextTag, Pname), cookie) + return GlxGetDoublevCookie{cookie} +} + +func (c *Conn) GlxGetDoublevUnchecked(ContextTag GlxContextTag, Pname uint32) GlxGetDoublevCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGetDoublevRequest(ContextTag, Pname), cookie) + return GlxGetDoublevCookie{cookie} +} + +// Request reply for GlxGetDoublev +// size: (32 + pad((int(N) * 8))) +type GlxGetDoublevReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 4 bytes + N uint32 + Datum GlxFloat64 + // padding: 8 bytes + Data []GlxFloat64 // size: pad((int(N) * 8)) +} + +// Waits and reads reply data from request GlxGetDoublev +func (cook GlxGetDoublevCookie) Reply() (*GlxGetDoublevReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGetDoublevReply(buf), nil +} + +// Read reply into structure from buffer for GlxGetDoublev +func glxGetDoublevReply(buf []byte) *GlxGetDoublevReply { + v := new(GlxGetDoublevReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 4 // padding + + v.N = Get32(buf[b:]) + b += 4 + + v.Datum = GlxFloat64(Get64(buf[b:])) + b += 8 + + b += 8 // padding + + v.Data = make([]GlxFloat64, v.N) + for i := 0; i < int(v.N); i++ { + v.Data[i] = GlxFloat64(Get64(buf[b:])) + b += 8 + } + b = pad(b) + + return v +} + +func (cook GlxGetDoublevCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGetDoublev +func (c *Conn) glxGetDoublevRequest(ContextTag GlxContextTag, Pname uint32) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 114 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], Pname) + b += 4 + + return buf +} + +// Request GlxGetError +// size: 8 +type GlxGetErrorCookie struct { + *cookie +} + +func (c *Conn) GlxGetError(ContextTag GlxContextTag) GlxGetErrorCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGetErrorRequest(ContextTag), cookie) + return GlxGetErrorCookie{cookie} +} + +func (c *Conn) GlxGetErrorUnchecked(ContextTag GlxContextTag) GlxGetErrorCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGetErrorRequest(ContextTag), cookie) + return GlxGetErrorCookie{cookie} +} + +// Request reply for GlxGetError +// size: 12 +type GlxGetErrorReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Error int32 +} + +// Waits and reads reply data from request GlxGetError +func (cook GlxGetErrorCookie) Reply() (*GlxGetErrorReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGetErrorReply(buf), nil +} + +// Read reply into structure from buffer for GlxGetError +func glxGetErrorReply(buf []byte) *GlxGetErrorReply { + v := new(GlxGetErrorReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.Error = int32(Get32(buf[b:])) + b += 4 + + return v +} + +func (cook GlxGetErrorCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGetError +func (c *Conn) glxGetErrorRequest(ContextTag GlxContextTag) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 115 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + return buf +} + +// Request GlxGetFloatv +// size: 12 +type GlxGetFloatvCookie struct { + *cookie +} + +func (c *Conn) GlxGetFloatv(ContextTag GlxContextTag, Pname uint32) GlxGetFloatvCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGetFloatvRequest(ContextTag, Pname), cookie) + return GlxGetFloatvCookie{cookie} +} + +func (c *Conn) GlxGetFloatvUnchecked(ContextTag GlxContextTag, Pname uint32) GlxGetFloatvCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGetFloatvRequest(ContextTag, Pname), cookie) + return GlxGetFloatvCookie{cookie} +} + +// Request reply for GlxGetFloatv +// size: (32 + pad((int(N) * 4))) +type GlxGetFloatvReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 4 bytes + N uint32 + Datum GlxFloat32 + // padding: 12 bytes + Data []GlxFloat32 // size: pad((int(N) * 4)) +} + +// Waits and reads reply data from request GlxGetFloatv +func (cook GlxGetFloatvCookie) Reply() (*GlxGetFloatvReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGetFloatvReply(buf), nil +} + +// Read reply into structure from buffer for GlxGetFloatv +func glxGetFloatvReply(buf []byte) *GlxGetFloatvReply { + v := new(GlxGetFloatvReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 4 // padding + + v.N = Get32(buf[b:]) + b += 4 + + v.Datum = GlxFloat32(Get32(buf[b:])) + b += 4 + + b += 12 // padding + + v.Data = make([]GlxFloat32, v.N) + for i := 0; i < int(v.N); i++ { + v.Data[i] = GlxFloat32(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + return v +} + +func (cook GlxGetFloatvCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGetFloatv +func (c *Conn) glxGetFloatvRequest(ContextTag GlxContextTag, Pname uint32) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 116 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], Pname) + b += 4 + + return buf +} + +// Request GlxGetIntegerv +// size: 12 +type GlxGetIntegervCookie struct { + *cookie +} + +func (c *Conn) GlxGetIntegerv(ContextTag GlxContextTag, Pname uint32) GlxGetIntegervCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGetIntegervRequest(ContextTag, Pname), cookie) + return GlxGetIntegervCookie{cookie} +} + +func (c *Conn) GlxGetIntegervUnchecked(ContextTag GlxContextTag, Pname uint32) GlxGetIntegervCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGetIntegervRequest(ContextTag, Pname), cookie) + return GlxGetIntegervCookie{cookie} +} + +// Request reply for GlxGetIntegerv +// size: (32 + pad((int(N) * 4))) +type GlxGetIntegervReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 4 bytes + N uint32 + Datum int32 + // padding: 12 bytes + Data []int32 // size: pad((int(N) * 4)) +} + +// Waits and reads reply data from request GlxGetIntegerv +func (cook GlxGetIntegervCookie) Reply() (*GlxGetIntegervReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGetIntegervReply(buf), nil +} + +// Read reply into structure from buffer for GlxGetIntegerv +func glxGetIntegervReply(buf []byte) *GlxGetIntegervReply { + v := new(GlxGetIntegervReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 4 // padding + + v.N = Get32(buf[b:]) + b += 4 + + v.Datum = int32(Get32(buf[b:])) + b += 4 + + b += 12 // padding + + v.Data = make([]int32, v.N) + for i := 0; i < int(v.N); i++ { + v.Data[i] = int32(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + return v +} + +func (cook GlxGetIntegervCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGetIntegerv +func (c *Conn) glxGetIntegervRequest(ContextTag GlxContextTag, Pname uint32) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 117 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], Pname) + b += 4 + + return buf +} + +// Request GlxGetLightfv +// size: 16 +type GlxGetLightfvCookie struct { + *cookie +} + +func (c *Conn) GlxGetLightfv(ContextTag GlxContextTag, Light uint32, Pname uint32) GlxGetLightfvCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGetLightfvRequest(ContextTag, Light, Pname), cookie) + return GlxGetLightfvCookie{cookie} +} + +func (c *Conn) GlxGetLightfvUnchecked(ContextTag GlxContextTag, Light uint32, Pname uint32) GlxGetLightfvCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGetLightfvRequest(ContextTag, Light, Pname), cookie) + return GlxGetLightfvCookie{cookie} +} + +// Request reply for GlxGetLightfv +// size: (32 + pad((int(N) * 4))) +type GlxGetLightfvReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 4 bytes + N uint32 + Datum GlxFloat32 + // padding: 12 bytes + Data []GlxFloat32 // size: pad((int(N) * 4)) +} + +// Waits and reads reply data from request GlxGetLightfv +func (cook GlxGetLightfvCookie) Reply() (*GlxGetLightfvReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGetLightfvReply(buf), nil +} + +// Read reply into structure from buffer for GlxGetLightfv +func glxGetLightfvReply(buf []byte) *GlxGetLightfvReply { + v := new(GlxGetLightfvReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 4 // padding + + v.N = Get32(buf[b:]) + b += 4 + + v.Datum = GlxFloat32(Get32(buf[b:])) + b += 4 + + b += 12 // padding + + v.Data = make([]GlxFloat32, v.N) + for i := 0; i < int(v.N); i++ { + v.Data[i] = GlxFloat32(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + return v +} + +func (cook GlxGetLightfvCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGetLightfv +func (c *Conn) glxGetLightfvRequest(ContextTag GlxContextTag, Light uint32, Pname uint32) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 118 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], Light) + b += 4 + + Put32(buf[b:], Pname) + b += 4 + + return buf +} + +// Request GlxGetLightiv +// size: 16 +type GlxGetLightivCookie struct { + *cookie +} + +func (c *Conn) GlxGetLightiv(ContextTag GlxContextTag, Light uint32, Pname uint32) GlxGetLightivCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGetLightivRequest(ContextTag, Light, Pname), cookie) + return GlxGetLightivCookie{cookie} +} + +func (c *Conn) GlxGetLightivUnchecked(ContextTag GlxContextTag, Light uint32, Pname uint32) GlxGetLightivCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGetLightivRequest(ContextTag, Light, Pname), cookie) + return GlxGetLightivCookie{cookie} +} + +// Request reply for GlxGetLightiv +// size: (32 + pad((int(N) * 4))) +type GlxGetLightivReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 4 bytes + N uint32 + Datum int32 + // padding: 12 bytes + Data []int32 // size: pad((int(N) * 4)) +} + +// Waits and reads reply data from request GlxGetLightiv +func (cook GlxGetLightivCookie) Reply() (*GlxGetLightivReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGetLightivReply(buf), nil +} + +// Read reply into structure from buffer for GlxGetLightiv +func glxGetLightivReply(buf []byte) *GlxGetLightivReply { + v := new(GlxGetLightivReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 4 // padding + + v.N = Get32(buf[b:]) + b += 4 + + v.Datum = int32(Get32(buf[b:])) + b += 4 + + b += 12 // padding + + v.Data = make([]int32, v.N) + for i := 0; i < int(v.N); i++ { + v.Data[i] = int32(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + return v +} + +func (cook GlxGetLightivCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGetLightiv +func (c *Conn) glxGetLightivRequest(ContextTag GlxContextTag, Light uint32, Pname uint32) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 119 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], Light) + b += 4 + + Put32(buf[b:], Pname) + b += 4 + + return buf +} + +// Request GlxGetMapdv +// size: 16 +type GlxGetMapdvCookie struct { + *cookie +} + +func (c *Conn) GlxGetMapdv(ContextTag GlxContextTag, Target uint32, Query uint32) GlxGetMapdvCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGetMapdvRequest(ContextTag, Target, Query), cookie) + return GlxGetMapdvCookie{cookie} +} + +func (c *Conn) GlxGetMapdvUnchecked(ContextTag GlxContextTag, Target uint32, Query uint32) GlxGetMapdvCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGetMapdvRequest(ContextTag, Target, Query), cookie) + return GlxGetMapdvCookie{cookie} +} + +// Request reply for GlxGetMapdv +// size: (32 + pad((int(N) * 8))) +type GlxGetMapdvReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 4 bytes + N uint32 + Datum GlxFloat64 + // padding: 8 bytes + Data []GlxFloat64 // size: pad((int(N) * 8)) +} + +// Waits and reads reply data from request GlxGetMapdv +func (cook GlxGetMapdvCookie) Reply() (*GlxGetMapdvReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGetMapdvReply(buf), nil +} + +// Read reply into structure from buffer for GlxGetMapdv +func glxGetMapdvReply(buf []byte) *GlxGetMapdvReply { + v := new(GlxGetMapdvReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 4 // padding + + v.N = Get32(buf[b:]) + b += 4 + + v.Datum = GlxFloat64(Get64(buf[b:])) + b += 8 + + b += 8 // padding + + v.Data = make([]GlxFloat64, v.N) + for i := 0; i < int(v.N); i++ { + v.Data[i] = GlxFloat64(Get64(buf[b:])) + b += 8 + } + b = pad(b) + + return v +} + +func (cook GlxGetMapdvCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGetMapdv +func (c *Conn) glxGetMapdvRequest(ContextTag GlxContextTag, Target uint32, Query uint32) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 120 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], Target) + b += 4 + + Put32(buf[b:], Query) + b += 4 + + return buf +} + +// Request GlxGetMapfv +// size: 16 +type GlxGetMapfvCookie struct { + *cookie +} + +func (c *Conn) GlxGetMapfv(ContextTag GlxContextTag, Target uint32, Query uint32) GlxGetMapfvCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGetMapfvRequest(ContextTag, Target, Query), cookie) + return GlxGetMapfvCookie{cookie} +} + +func (c *Conn) GlxGetMapfvUnchecked(ContextTag GlxContextTag, Target uint32, Query uint32) GlxGetMapfvCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGetMapfvRequest(ContextTag, Target, Query), cookie) + return GlxGetMapfvCookie{cookie} +} + +// Request reply for GlxGetMapfv +// size: (32 + pad((int(N) * 4))) +type GlxGetMapfvReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 4 bytes + N uint32 + Datum GlxFloat32 + // padding: 12 bytes + Data []GlxFloat32 // size: pad((int(N) * 4)) +} + +// Waits and reads reply data from request GlxGetMapfv +func (cook GlxGetMapfvCookie) Reply() (*GlxGetMapfvReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGetMapfvReply(buf), nil +} + +// Read reply into structure from buffer for GlxGetMapfv +func glxGetMapfvReply(buf []byte) *GlxGetMapfvReply { + v := new(GlxGetMapfvReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 4 // padding + + v.N = Get32(buf[b:]) + b += 4 + + v.Datum = GlxFloat32(Get32(buf[b:])) + b += 4 + + b += 12 // padding + + v.Data = make([]GlxFloat32, v.N) + for i := 0; i < int(v.N); i++ { + v.Data[i] = GlxFloat32(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + return v +} + +func (cook GlxGetMapfvCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGetMapfv +func (c *Conn) glxGetMapfvRequest(ContextTag GlxContextTag, Target uint32, Query uint32) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 121 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], Target) + b += 4 + + Put32(buf[b:], Query) + b += 4 + + return buf +} + +// Request GlxGetMapiv +// size: 16 +type GlxGetMapivCookie struct { + *cookie +} + +func (c *Conn) GlxGetMapiv(ContextTag GlxContextTag, Target uint32, Query uint32) GlxGetMapivCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGetMapivRequest(ContextTag, Target, Query), cookie) + return GlxGetMapivCookie{cookie} +} + +func (c *Conn) GlxGetMapivUnchecked(ContextTag GlxContextTag, Target uint32, Query uint32) GlxGetMapivCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGetMapivRequest(ContextTag, Target, Query), cookie) + return GlxGetMapivCookie{cookie} +} + +// Request reply for GlxGetMapiv +// size: (32 + pad((int(N) * 4))) +type GlxGetMapivReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 4 bytes + N uint32 + Datum int32 + // padding: 12 bytes + Data []int32 // size: pad((int(N) * 4)) +} + +// Waits and reads reply data from request GlxGetMapiv +func (cook GlxGetMapivCookie) Reply() (*GlxGetMapivReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGetMapivReply(buf), nil +} + +// Read reply into structure from buffer for GlxGetMapiv +func glxGetMapivReply(buf []byte) *GlxGetMapivReply { + v := new(GlxGetMapivReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 4 // padding + + v.N = Get32(buf[b:]) + b += 4 + + v.Datum = int32(Get32(buf[b:])) + b += 4 + + b += 12 // padding + + v.Data = make([]int32, v.N) + for i := 0; i < int(v.N); i++ { + v.Data[i] = int32(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + return v +} + +func (cook GlxGetMapivCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGetMapiv +func (c *Conn) glxGetMapivRequest(ContextTag GlxContextTag, Target uint32, Query uint32) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 122 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], Target) + b += 4 + + Put32(buf[b:], Query) + b += 4 + + return buf +} + +// Request GlxGetMaterialfv +// size: 16 +type GlxGetMaterialfvCookie struct { + *cookie +} + +func (c *Conn) GlxGetMaterialfv(ContextTag GlxContextTag, Face uint32, Pname uint32) GlxGetMaterialfvCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGetMaterialfvRequest(ContextTag, Face, Pname), cookie) + return GlxGetMaterialfvCookie{cookie} +} + +func (c *Conn) GlxGetMaterialfvUnchecked(ContextTag GlxContextTag, Face uint32, Pname uint32) GlxGetMaterialfvCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGetMaterialfvRequest(ContextTag, Face, Pname), cookie) + return GlxGetMaterialfvCookie{cookie} +} + +// Request reply for GlxGetMaterialfv +// size: (32 + pad((int(N) * 4))) +type GlxGetMaterialfvReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 4 bytes + N uint32 + Datum GlxFloat32 + // padding: 12 bytes + Data []GlxFloat32 // size: pad((int(N) * 4)) +} + +// Waits and reads reply data from request GlxGetMaterialfv +func (cook GlxGetMaterialfvCookie) Reply() (*GlxGetMaterialfvReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGetMaterialfvReply(buf), nil +} + +// Read reply into structure from buffer for GlxGetMaterialfv +func glxGetMaterialfvReply(buf []byte) *GlxGetMaterialfvReply { + v := new(GlxGetMaterialfvReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 4 // padding + + v.N = Get32(buf[b:]) + b += 4 + + v.Datum = GlxFloat32(Get32(buf[b:])) + b += 4 + + b += 12 // padding + + v.Data = make([]GlxFloat32, v.N) + for i := 0; i < int(v.N); i++ { + v.Data[i] = GlxFloat32(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + return v +} + +func (cook GlxGetMaterialfvCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGetMaterialfv +func (c *Conn) glxGetMaterialfvRequest(ContextTag GlxContextTag, Face uint32, Pname uint32) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 123 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], Face) + b += 4 + + Put32(buf[b:], Pname) + b += 4 + + return buf +} + +// Request GlxGetMaterialiv +// size: 16 +type GlxGetMaterialivCookie struct { + *cookie +} + +func (c *Conn) GlxGetMaterialiv(ContextTag GlxContextTag, Face uint32, Pname uint32) GlxGetMaterialivCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGetMaterialivRequest(ContextTag, Face, Pname), cookie) + return GlxGetMaterialivCookie{cookie} +} + +func (c *Conn) GlxGetMaterialivUnchecked(ContextTag GlxContextTag, Face uint32, Pname uint32) GlxGetMaterialivCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGetMaterialivRequest(ContextTag, Face, Pname), cookie) + return GlxGetMaterialivCookie{cookie} +} + +// Request reply for GlxGetMaterialiv +// size: (32 + pad((int(N) * 4))) +type GlxGetMaterialivReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 4 bytes + N uint32 + Datum int32 + // padding: 12 bytes + Data []int32 // size: pad((int(N) * 4)) +} + +// Waits and reads reply data from request GlxGetMaterialiv +func (cook GlxGetMaterialivCookie) Reply() (*GlxGetMaterialivReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGetMaterialivReply(buf), nil +} + +// Read reply into structure from buffer for GlxGetMaterialiv +func glxGetMaterialivReply(buf []byte) *GlxGetMaterialivReply { + v := new(GlxGetMaterialivReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 4 // padding + + v.N = Get32(buf[b:]) + b += 4 + + v.Datum = int32(Get32(buf[b:])) + b += 4 + + b += 12 // padding + + v.Data = make([]int32, v.N) + for i := 0; i < int(v.N); i++ { + v.Data[i] = int32(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + return v +} + +func (cook GlxGetMaterialivCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGetMaterialiv +func (c *Conn) glxGetMaterialivRequest(ContextTag GlxContextTag, Face uint32, Pname uint32) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 124 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], Face) + b += 4 + + Put32(buf[b:], Pname) + b += 4 + + return buf +} + +// Request GlxGetPixelMapfv +// size: 12 +type GlxGetPixelMapfvCookie struct { + *cookie +} + +func (c *Conn) GlxGetPixelMapfv(ContextTag GlxContextTag, Map uint32) GlxGetPixelMapfvCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGetPixelMapfvRequest(ContextTag, Map), cookie) + return GlxGetPixelMapfvCookie{cookie} +} + +func (c *Conn) GlxGetPixelMapfvUnchecked(ContextTag GlxContextTag, Map uint32) GlxGetPixelMapfvCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGetPixelMapfvRequest(ContextTag, Map), cookie) + return GlxGetPixelMapfvCookie{cookie} +} + +// Request reply for GlxGetPixelMapfv +// size: (32 + pad((int(N) * 4))) +type GlxGetPixelMapfvReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 4 bytes + N uint32 + Datum GlxFloat32 + // padding: 12 bytes + Data []GlxFloat32 // size: pad((int(N) * 4)) +} + +// Waits and reads reply data from request GlxGetPixelMapfv +func (cook GlxGetPixelMapfvCookie) Reply() (*GlxGetPixelMapfvReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGetPixelMapfvReply(buf), nil +} + +// Read reply into structure from buffer for GlxGetPixelMapfv +func glxGetPixelMapfvReply(buf []byte) *GlxGetPixelMapfvReply { + v := new(GlxGetPixelMapfvReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 4 // padding + + v.N = Get32(buf[b:]) + b += 4 + + v.Datum = GlxFloat32(Get32(buf[b:])) + b += 4 + + b += 12 // padding + + v.Data = make([]GlxFloat32, v.N) + for i := 0; i < int(v.N); i++ { + v.Data[i] = GlxFloat32(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + return v +} + +func (cook GlxGetPixelMapfvCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGetPixelMapfv +func (c *Conn) glxGetPixelMapfvRequest(ContextTag GlxContextTag, Map uint32) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 125 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], Map) + b += 4 + + return buf +} + +// Request GlxGetPixelMapuiv +// size: 12 +type GlxGetPixelMapuivCookie struct { + *cookie +} + +func (c *Conn) GlxGetPixelMapuiv(ContextTag GlxContextTag, Map uint32) GlxGetPixelMapuivCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGetPixelMapuivRequest(ContextTag, Map), cookie) + return GlxGetPixelMapuivCookie{cookie} +} + +func (c *Conn) GlxGetPixelMapuivUnchecked(ContextTag GlxContextTag, Map uint32) GlxGetPixelMapuivCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGetPixelMapuivRequest(ContextTag, Map), cookie) + return GlxGetPixelMapuivCookie{cookie} +} + +// Request reply for GlxGetPixelMapuiv +// size: (32 + pad((int(N) * 4))) +type GlxGetPixelMapuivReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 4 bytes + N uint32 + Datum uint32 + // padding: 12 bytes + Data []uint32 // size: pad((int(N) * 4)) +} + +// Waits and reads reply data from request GlxGetPixelMapuiv +func (cook GlxGetPixelMapuivCookie) Reply() (*GlxGetPixelMapuivReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGetPixelMapuivReply(buf), nil +} + +// Read reply into structure from buffer for GlxGetPixelMapuiv +func glxGetPixelMapuivReply(buf []byte) *GlxGetPixelMapuivReply { + v := new(GlxGetPixelMapuivReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 4 // padding + + v.N = Get32(buf[b:]) + b += 4 + + v.Datum = Get32(buf[b:]) + b += 4 + + b += 12 // padding + + v.Data = make([]uint32, v.N) + for i := 0; i < int(v.N); i++ { + v.Data[i] = Get32(buf[b:]) + b += 4 + } + b = pad(b) + + return v +} + +func (cook GlxGetPixelMapuivCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGetPixelMapuiv +func (c *Conn) glxGetPixelMapuivRequest(ContextTag GlxContextTag, Map uint32) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 126 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], Map) + b += 4 + + return buf +} + +// Request GlxGetPixelMapusv +// size: 12 +type GlxGetPixelMapusvCookie struct { + *cookie +} + +func (c *Conn) GlxGetPixelMapusv(ContextTag GlxContextTag, Map uint32) GlxGetPixelMapusvCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGetPixelMapusvRequest(ContextTag, Map), cookie) + return GlxGetPixelMapusvCookie{cookie} +} + +func (c *Conn) GlxGetPixelMapusvUnchecked(ContextTag GlxContextTag, Map uint32) GlxGetPixelMapusvCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGetPixelMapusvRequest(ContextTag, Map), cookie) + return GlxGetPixelMapusvCookie{cookie} +} + +// Request reply for GlxGetPixelMapusv +// size: (34 + pad((int(N) * 2))) +type GlxGetPixelMapusvReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 4 bytes + N uint32 + Datum uint16 + // padding: 16 bytes + Data []uint16 // size: pad((int(N) * 2)) +} + +// Waits and reads reply data from request GlxGetPixelMapusv +func (cook GlxGetPixelMapusvCookie) Reply() (*GlxGetPixelMapusvReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGetPixelMapusvReply(buf), nil +} + +// Read reply into structure from buffer for GlxGetPixelMapusv +func glxGetPixelMapusvReply(buf []byte) *GlxGetPixelMapusvReply { + v := new(GlxGetPixelMapusvReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 4 // padding + + v.N = Get32(buf[b:]) + b += 4 + + v.Datum = Get16(buf[b:]) + b += 2 + + b += 16 // padding + + v.Data = make([]uint16, v.N) + for i := 0; i < int(v.N); i++ { + v.Data[i] = Get16(buf[b:]) + b += 2 + } + b = pad(b) + + return v +} + +func (cook GlxGetPixelMapusvCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGetPixelMapusv +func (c *Conn) glxGetPixelMapusvRequest(ContextTag GlxContextTag, Map uint32) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 127 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], Map) + b += 4 + + return buf +} + +// Request GlxGetPolygonStipple +// size: 12 +type GlxGetPolygonStippleCookie struct { + *cookie +} + +func (c *Conn) GlxGetPolygonStipple(ContextTag GlxContextTag, LsbFirst bool) GlxGetPolygonStippleCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGetPolygonStippleRequest(ContextTag, LsbFirst), cookie) + return GlxGetPolygonStippleCookie{cookie} +} + +func (c *Conn) GlxGetPolygonStippleUnchecked(ContextTag GlxContextTag, LsbFirst bool) GlxGetPolygonStippleCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGetPolygonStippleRequest(ContextTag, LsbFirst), cookie) + return GlxGetPolygonStippleCookie{cookie} +} + +// Request reply for GlxGetPolygonStipple +// size: (32 + pad(((int(Length) * 4) * 1))) +type GlxGetPolygonStippleReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 24 bytes + Data []byte // size: pad(((int(Length) * 4) * 1)) +} + +// Waits and reads reply data from request GlxGetPolygonStipple +func (cook GlxGetPolygonStippleCookie) Reply() (*GlxGetPolygonStippleReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGetPolygonStippleReply(buf), nil +} + +// Read reply into structure from buffer for GlxGetPolygonStipple +func glxGetPolygonStippleReply(buf []byte) *GlxGetPolygonStippleReply { + v := new(GlxGetPolygonStippleReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 24 // padding + + v.Data = make([]byte, (int(v.Length) * 4)) + copy(v.Data[:(int(v.Length)*4)], buf[b:]) + b += pad(int((int(v.Length) * 4))) + + return v +} + +func (cook GlxGetPolygonStippleCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGetPolygonStipple +func (c *Conn) glxGetPolygonStippleRequest(ContextTag GlxContextTag, LsbFirst bool) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 128 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + if LsbFirst { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + return buf +} + +// Request GlxGetString +// size: 12 +type GlxGetStringCookie struct { + *cookie +} + +func (c *Conn) GlxGetString(ContextTag GlxContextTag, Name uint32) GlxGetStringCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGetStringRequest(ContextTag, Name), cookie) + return GlxGetStringCookie{cookie} +} + +func (c *Conn) GlxGetStringUnchecked(ContextTag GlxContextTag, Name uint32) GlxGetStringCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGetStringRequest(ContextTag, Name), cookie) + return GlxGetStringCookie{cookie} +} + +// Request reply for GlxGetString +// size: (32 + pad((int(N) * 1))) +type GlxGetStringReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 4 bytes + N uint32 + // padding: 16 bytes + String string // size: pad((int(N) * 1)) +} + +// Waits and reads reply data from request GlxGetString +func (cook GlxGetStringCookie) Reply() (*GlxGetStringReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGetStringReply(buf), nil +} + +// Read reply into structure from buffer for GlxGetString +func glxGetStringReply(buf []byte) *GlxGetStringReply { + v := new(GlxGetStringReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 4 // padding + + v.N = Get32(buf[b:]) + b += 4 + + b += 16 // padding + + { + byteString := make([]byte, v.N) + copy(byteString[:v.N], buf[b:]) + v.String = string(byteString) + b += pad(int(v.N)) + } + + return v +} + +func (cook GlxGetStringCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGetString +func (c *Conn) glxGetStringRequest(ContextTag GlxContextTag, Name uint32) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 129 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], Name) + b += 4 + + return buf +} + +// Request GlxGetTexEnvfv +// size: 16 +type GlxGetTexEnvfvCookie struct { + *cookie +} + +func (c *Conn) GlxGetTexEnvfv(ContextTag GlxContextTag, Target uint32, Pname uint32) GlxGetTexEnvfvCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGetTexEnvfvRequest(ContextTag, Target, Pname), cookie) + return GlxGetTexEnvfvCookie{cookie} +} + +func (c *Conn) GlxGetTexEnvfvUnchecked(ContextTag GlxContextTag, Target uint32, Pname uint32) GlxGetTexEnvfvCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGetTexEnvfvRequest(ContextTag, Target, Pname), cookie) + return GlxGetTexEnvfvCookie{cookie} +} + +// Request reply for GlxGetTexEnvfv +// size: (32 + pad((int(N) * 4))) +type GlxGetTexEnvfvReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 4 bytes + N uint32 + Datum GlxFloat32 + // padding: 12 bytes + Data []GlxFloat32 // size: pad((int(N) * 4)) +} + +// Waits and reads reply data from request GlxGetTexEnvfv +func (cook GlxGetTexEnvfvCookie) Reply() (*GlxGetTexEnvfvReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGetTexEnvfvReply(buf), nil +} + +// Read reply into structure from buffer for GlxGetTexEnvfv +func glxGetTexEnvfvReply(buf []byte) *GlxGetTexEnvfvReply { + v := new(GlxGetTexEnvfvReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 4 // padding + + v.N = Get32(buf[b:]) + b += 4 + + v.Datum = GlxFloat32(Get32(buf[b:])) + b += 4 + + b += 12 // padding + + v.Data = make([]GlxFloat32, v.N) + for i := 0; i < int(v.N); i++ { + v.Data[i] = GlxFloat32(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + return v +} + +func (cook GlxGetTexEnvfvCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGetTexEnvfv +func (c *Conn) glxGetTexEnvfvRequest(ContextTag GlxContextTag, Target uint32, Pname uint32) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 130 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], Target) + b += 4 + + Put32(buf[b:], Pname) + b += 4 + + return buf +} + +// Request GlxGetTexEnviv +// size: 16 +type GlxGetTexEnvivCookie struct { + *cookie +} + +func (c *Conn) GlxGetTexEnviv(ContextTag GlxContextTag, Target uint32, Pname uint32) GlxGetTexEnvivCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGetTexEnvivRequest(ContextTag, Target, Pname), cookie) + return GlxGetTexEnvivCookie{cookie} +} + +func (c *Conn) GlxGetTexEnvivUnchecked(ContextTag GlxContextTag, Target uint32, Pname uint32) GlxGetTexEnvivCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGetTexEnvivRequest(ContextTag, Target, Pname), cookie) + return GlxGetTexEnvivCookie{cookie} +} + +// Request reply for GlxGetTexEnviv +// size: (32 + pad((int(N) * 4))) +type GlxGetTexEnvivReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 4 bytes + N uint32 + Datum int32 + // padding: 12 bytes + Data []int32 // size: pad((int(N) * 4)) +} + +// Waits and reads reply data from request GlxGetTexEnviv +func (cook GlxGetTexEnvivCookie) Reply() (*GlxGetTexEnvivReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGetTexEnvivReply(buf), nil +} + +// Read reply into structure from buffer for GlxGetTexEnviv +func glxGetTexEnvivReply(buf []byte) *GlxGetTexEnvivReply { + v := new(GlxGetTexEnvivReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 4 // padding + + v.N = Get32(buf[b:]) + b += 4 + + v.Datum = int32(Get32(buf[b:])) + b += 4 + + b += 12 // padding + + v.Data = make([]int32, v.N) + for i := 0; i < int(v.N); i++ { + v.Data[i] = int32(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + return v +} + +func (cook GlxGetTexEnvivCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGetTexEnviv +func (c *Conn) glxGetTexEnvivRequest(ContextTag GlxContextTag, Target uint32, Pname uint32) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 131 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], Target) + b += 4 + + Put32(buf[b:], Pname) + b += 4 + + return buf +} + +// Request GlxGetTexGendv +// size: 16 +type GlxGetTexGendvCookie struct { + *cookie +} + +func (c *Conn) GlxGetTexGendv(ContextTag GlxContextTag, Coord uint32, Pname uint32) GlxGetTexGendvCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGetTexGendvRequest(ContextTag, Coord, Pname), cookie) + return GlxGetTexGendvCookie{cookie} +} + +func (c *Conn) GlxGetTexGendvUnchecked(ContextTag GlxContextTag, Coord uint32, Pname uint32) GlxGetTexGendvCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGetTexGendvRequest(ContextTag, Coord, Pname), cookie) + return GlxGetTexGendvCookie{cookie} +} + +// Request reply for GlxGetTexGendv +// size: (32 + pad((int(N) * 8))) +type GlxGetTexGendvReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 4 bytes + N uint32 + Datum GlxFloat64 + // padding: 8 bytes + Data []GlxFloat64 // size: pad((int(N) * 8)) +} + +// Waits and reads reply data from request GlxGetTexGendv +func (cook GlxGetTexGendvCookie) Reply() (*GlxGetTexGendvReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGetTexGendvReply(buf), nil +} + +// Read reply into structure from buffer for GlxGetTexGendv +func glxGetTexGendvReply(buf []byte) *GlxGetTexGendvReply { + v := new(GlxGetTexGendvReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 4 // padding + + v.N = Get32(buf[b:]) + b += 4 + + v.Datum = GlxFloat64(Get64(buf[b:])) + b += 8 + + b += 8 // padding + + v.Data = make([]GlxFloat64, v.N) + for i := 0; i < int(v.N); i++ { + v.Data[i] = GlxFloat64(Get64(buf[b:])) + b += 8 + } + b = pad(b) + + return v +} + +func (cook GlxGetTexGendvCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGetTexGendv +func (c *Conn) glxGetTexGendvRequest(ContextTag GlxContextTag, Coord uint32, Pname uint32) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 132 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], Coord) + b += 4 + + Put32(buf[b:], Pname) + b += 4 + + return buf +} + +// Request GlxGetTexGenfv +// size: 16 +type GlxGetTexGenfvCookie struct { + *cookie +} + +func (c *Conn) GlxGetTexGenfv(ContextTag GlxContextTag, Coord uint32, Pname uint32) GlxGetTexGenfvCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGetTexGenfvRequest(ContextTag, Coord, Pname), cookie) + return GlxGetTexGenfvCookie{cookie} +} + +func (c *Conn) GlxGetTexGenfvUnchecked(ContextTag GlxContextTag, Coord uint32, Pname uint32) GlxGetTexGenfvCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGetTexGenfvRequest(ContextTag, Coord, Pname), cookie) + return GlxGetTexGenfvCookie{cookie} +} + +// Request reply for GlxGetTexGenfv +// size: (32 + pad((int(N) * 4))) +type GlxGetTexGenfvReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 4 bytes + N uint32 + Datum GlxFloat32 + // padding: 12 bytes + Data []GlxFloat32 // size: pad((int(N) * 4)) +} + +// Waits and reads reply data from request GlxGetTexGenfv +func (cook GlxGetTexGenfvCookie) Reply() (*GlxGetTexGenfvReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGetTexGenfvReply(buf), nil +} + +// Read reply into structure from buffer for GlxGetTexGenfv +func glxGetTexGenfvReply(buf []byte) *GlxGetTexGenfvReply { + v := new(GlxGetTexGenfvReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 4 // padding + + v.N = Get32(buf[b:]) + b += 4 + + v.Datum = GlxFloat32(Get32(buf[b:])) + b += 4 + + b += 12 // padding + + v.Data = make([]GlxFloat32, v.N) + for i := 0; i < int(v.N); i++ { + v.Data[i] = GlxFloat32(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + return v +} + +func (cook GlxGetTexGenfvCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGetTexGenfv +func (c *Conn) glxGetTexGenfvRequest(ContextTag GlxContextTag, Coord uint32, Pname uint32) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 133 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], Coord) + b += 4 + + Put32(buf[b:], Pname) + b += 4 + + return buf +} + +// Request GlxGetTexGeniv +// size: 16 +type GlxGetTexGenivCookie struct { + *cookie +} + +func (c *Conn) GlxGetTexGeniv(ContextTag GlxContextTag, Coord uint32, Pname uint32) GlxGetTexGenivCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGetTexGenivRequest(ContextTag, Coord, Pname), cookie) + return GlxGetTexGenivCookie{cookie} +} + +func (c *Conn) GlxGetTexGenivUnchecked(ContextTag GlxContextTag, Coord uint32, Pname uint32) GlxGetTexGenivCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGetTexGenivRequest(ContextTag, Coord, Pname), cookie) + return GlxGetTexGenivCookie{cookie} +} + +// Request reply for GlxGetTexGeniv +// size: (32 + pad((int(N) * 4))) +type GlxGetTexGenivReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 4 bytes + N uint32 + Datum int32 + // padding: 12 bytes + Data []int32 // size: pad((int(N) * 4)) +} + +// Waits and reads reply data from request GlxGetTexGeniv +func (cook GlxGetTexGenivCookie) Reply() (*GlxGetTexGenivReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGetTexGenivReply(buf), nil +} + +// Read reply into structure from buffer for GlxGetTexGeniv +func glxGetTexGenivReply(buf []byte) *GlxGetTexGenivReply { + v := new(GlxGetTexGenivReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 4 // padding + + v.N = Get32(buf[b:]) + b += 4 + + v.Datum = int32(Get32(buf[b:])) + b += 4 + + b += 12 // padding + + v.Data = make([]int32, v.N) + for i := 0; i < int(v.N); i++ { + v.Data[i] = int32(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + return v +} + +func (cook GlxGetTexGenivCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGetTexGeniv +func (c *Conn) glxGetTexGenivRequest(ContextTag GlxContextTag, Coord uint32, Pname uint32) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 134 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], Coord) + b += 4 + + Put32(buf[b:], Pname) + b += 4 + + return buf +} + +// Request GlxGetTexImage +// size: 28 +type GlxGetTexImageCookie struct { + *cookie +} + +func (c *Conn) GlxGetTexImage(ContextTag GlxContextTag, Target uint32, Level int32, Format uint32, Type uint32, SwapBytes bool) GlxGetTexImageCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGetTexImageRequest(ContextTag, Target, Level, Format, Type, SwapBytes), cookie) + return GlxGetTexImageCookie{cookie} +} + +func (c *Conn) GlxGetTexImageUnchecked(ContextTag GlxContextTag, Target uint32, Level int32, Format uint32, Type uint32, SwapBytes bool) GlxGetTexImageCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGetTexImageRequest(ContextTag, Target, Level, Format, Type, SwapBytes), cookie) + return GlxGetTexImageCookie{cookie} +} + +// Request reply for GlxGetTexImage +// size: (32 + pad(((int(Length) * 4) * 1))) +type GlxGetTexImageReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 8 bytes + Width int32 + Height int32 + Depth int32 + // padding: 4 bytes + Data []byte // size: pad(((int(Length) * 4) * 1)) +} + +// Waits and reads reply data from request GlxGetTexImage +func (cook GlxGetTexImageCookie) Reply() (*GlxGetTexImageReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGetTexImageReply(buf), nil +} + +// Read reply into structure from buffer for GlxGetTexImage +func glxGetTexImageReply(buf []byte) *GlxGetTexImageReply { + v := new(GlxGetTexImageReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 8 // padding + + v.Width = int32(Get32(buf[b:])) + b += 4 + + v.Height = int32(Get32(buf[b:])) + b += 4 + + v.Depth = int32(Get32(buf[b:])) + b += 4 + + b += 4 // padding + + v.Data = make([]byte, (int(v.Length) * 4)) + copy(v.Data[:(int(v.Length)*4)], buf[b:]) + b += pad(int((int(v.Length) * 4))) + + return v +} + +func (cook GlxGetTexImageCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGetTexImage +func (c *Conn) glxGetTexImageRequest(ContextTag GlxContextTag, Target uint32, Level int32, Format uint32, Type uint32, SwapBytes bool) []byte { + size := 28 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 135 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], Target) + b += 4 + + Put32(buf[b:], uint32(Level)) + b += 4 + + Put32(buf[b:], Format) + b += 4 + + Put32(buf[b:], Type) + b += 4 + + if SwapBytes { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + return buf +} + +// Request GlxGetTexParameterfv +// size: 16 +type GlxGetTexParameterfvCookie struct { + *cookie +} + +func (c *Conn) GlxGetTexParameterfv(ContextTag GlxContextTag, Target uint32, Pname uint32) GlxGetTexParameterfvCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGetTexParameterfvRequest(ContextTag, Target, Pname), cookie) + return GlxGetTexParameterfvCookie{cookie} +} + +func (c *Conn) GlxGetTexParameterfvUnchecked(ContextTag GlxContextTag, Target uint32, Pname uint32) GlxGetTexParameterfvCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGetTexParameterfvRequest(ContextTag, Target, Pname), cookie) + return GlxGetTexParameterfvCookie{cookie} +} + +// Request reply for GlxGetTexParameterfv +// size: (32 + pad((int(N) * 4))) +type GlxGetTexParameterfvReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 4 bytes + N uint32 + Datum GlxFloat32 + // padding: 12 bytes + Data []GlxFloat32 // size: pad((int(N) * 4)) +} + +// Waits and reads reply data from request GlxGetTexParameterfv +func (cook GlxGetTexParameterfvCookie) Reply() (*GlxGetTexParameterfvReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGetTexParameterfvReply(buf), nil +} + +// Read reply into structure from buffer for GlxGetTexParameterfv +func glxGetTexParameterfvReply(buf []byte) *GlxGetTexParameterfvReply { + v := new(GlxGetTexParameterfvReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 4 // padding + + v.N = Get32(buf[b:]) + b += 4 + + v.Datum = GlxFloat32(Get32(buf[b:])) + b += 4 + + b += 12 // padding + + v.Data = make([]GlxFloat32, v.N) + for i := 0; i < int(v.N); i++ { + v.Data[i] = GlxFloat32(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + return v +} + +func (cook GlxGetTexParameterfvCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGetTexParameterfv +func (c *Conn) glxGetTexParameterfvRequest(ContextTag GlxContextTag, Target uint32, Pname uint32) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 136 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], Target) + b += 4 + + Put32(buf[b:], Pname) + b += 4 + + return buf +} + +// Request GlxGetTexParameteriv +// size: 16 +type GlxGetTexParameterivCookie struct { + *cookie +} + +func (c *Conn) GlxGetTexParameteriv(ContextTag GlxContextTag, Target uint32, Pname uint32) GlxGetTexParameterivCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGetTexParameterivRequest(ContextTag, Target, Pname), cookie) + return GlxGetTexParameterivCookie{cookie} +} + +func (c *Conn) GlxGetTexParameterivUnchecked(ContextTag GlxContextTag, Target uint32, Pname uint32) GlxGetTexParameterivCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGetTexParameterivRequest(ContextTag, Target, Pname), cookie) + return GlxGetTexParameterivCookie{cookie} +} + +// Request reply for GlxGetTexParameteriv +// size: (32 + pad((int(N) * 4))) +type GlxGetTexParameterivReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 4 bytes + N uint32 + Datum int32 + // padding: 12 bytes + Data []int32 // size: pad((int(N) * 4)) +} + +// Waits and reads reply data from request GlxGetTexParameteriv +func (cook GlxGetTexParameterivCookie) Reply() (*GlxGetTexParameterivReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGetTexParameterivReply(buf), nil +} + +// Read reply into structure from buffer for GlxGetTexParameteriv +func glxGetTexParameterivReply(buf []byte) *GlxGetTexParameterivReply { + v := new(GlxGetTexParameterivReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 4 // padding + + v.N = Get32(buf[b:]) + b += 4 + + v.Datum = int32(Get32(buf[b:])) + b += 4 + + b += 12 // padding + + v.Data = make([]int32, v.N) + for i := 0; i < int(v.N); i++ { + v.Data[i] = int32(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + return v +} + +func (cook GlxGetTexParameterivCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGetTexParameteriv +func (c *Conn) glxGetTexParameterivRequest(ContextTag GlxContextTag, Target uint32, Pname uint32) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 137 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], Target) + b += 4 + + Put32(buf[b:], Pname) + b += 4 + + return buf +} + +// Request GlxGetTexLevelParameterfv +// size: 20 +type GlxGetTexLevelParameterfvCookie struct { + *cookie +} + +func (c *Conn) GlxGetTexLevelParameterfv(ContextTag GlxContextTag, Target uint32, Level int32, Pname uint32) GlxGetTexLevelParameterfvCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGetTexLevelParameterfvRequest(ContextTag, Target, Level, Pname), cookie) + return GlxGetTexLevelParameterfvCookie{cookie} +} + +func (c *Conn) GlxGetTexLevelParameterfvUnchecked(ContextTag GlxContextTag, Target uint32, Level int32, Pname uint32) GlxGetTexLevelParameterfvCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGetTexLevelParameterfvRequest(ContextTag, Target, Level, Pname), cookie) + return GlxGetTexLevelParameterfvCookie{cookie} +} + +// Request reply for GlxGetTexLevelParameterfv +// size: (32 + pad((int(N) * 4))) +type GlxGetTexLevelParameterfvReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 4 bytes + N uint32 + Datum GlxFloat32 + // padding: 12 bytes + Data []GlxFloat32 // size: pad((int(N) * 4)) +} + +// Waits and reads reply data from request GlxGetTexLevelParameterfv +func (cook GlxGetTexLevelParameterfvCookie) Reply() (*GlxGetTexLevelParameterfvReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGetTexLevelParameterfvReply(buf), nil +} + +// Read reply into structure from buffer for GlxGetTexLevelParameterfv +func glxGetTexLevelParameterfvReply(buf []byte) *GlxGetTexLevelParameterfvReply { + v := new(GlxGetTexLevelParameterfvReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 4 // padding + + v.N = Get32(buf[b:]) + b += 4 + + v.Datum = GlxFloat32(Get32(buf[b:])) + b += 4 + + b += 12 // padding + + v.Data = make([]GlxFloat32, v.N) + for i := 0; i < int(v.N); i++ { + v.Data[i] = GlxFloat32(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + return v +} + +func (cook GlxGetTexLevelParameterfvCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGetTexLevelParameterfv +func (c *Conn) glxGetTexLevelParameterfvRequest(ContextTag GlxContextTag, Target uint32, Level int32, Pname uint32) []byte { + size := 20 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 138 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], Target) + b += 4 + + Put32(buf[b:], uint32(Level)) + b += 4 + + Put32(buf[b:], Pname) + b += 4 + + return buf +} + +// Request GlxGetTexLevelParameteriv +// size: 20 +type GlxGetTexLevelParameterivCookie struct { + *cookie +} + +func (c *Conn) GlxGetTexLevelParameteriv(ContextTag GlxContextTag, Target uint32, Level int32, Pname uint32) GlxGetTexLevelParameterivCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGetTexLevelParameterivRequest(ContextTag, Target, Level, Pname), cookie) + return GlxGetTexLevelParameterivCookie{cookie} +} + +func (c *Conn) GlxGetTexLevelParameterivUnchecked(ContextTag GlxContextTag, Target uint32, Level int32, Pname uint32) GlxGetTexLevelParameterivCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGetTexLevelParameterivRequest(ContextTag, Target, Level, Pname), cookie) + return GlxGetTexLevelParameterivCookie{cookie} +} + +// Request reply for GlxGetTexLevelParameteriv +// size: (32 + pad((int(N) * 4))) +type GlxGetTexLevelParameterivReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 4 bytes + N uint32 + Datum int32 + // padding: 12 bytes + Data []int32 // size: pad((int(N) * 4)) +} + +// Waits and reads reply data from request GlxGetTexLevelParameteriv +func (cook GlxGetTexLevelParameterivCookie) Reply() (*GlxGetTexLevelParameterivReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGetTexLevelParameterivReply(buf), nil +} + +// Read reply into structure from buffer for GlxGetTexLevelParameteriv +func glxGetTexLevelParameterivReply(buf []byte) *GlxGetTexLevelParameterivReply { + v := new(GlxGetTexLevelParameterivReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 4 // padding + + v.N = Get32(buf[b:]) + b += 4 + + v.Datum = int32(Get32(buf[b:])) + b += 4 + + b += 12 // padding + + v.Data = make([]int32, v.N) + for i := 0; i < int(v.N); i++ { + v.Data[i] = int32(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + return v +} + +func (cook GlxGetTexLevelParameterivCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGetTexLevelParameteriv +func (c *Conn) glxGetTexLevelParameterivRequest(ContextTag GlxContextTag, Target uint32, Level int32, Pname uint32) []byte { + size := 20 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 139 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], Target) + b += 4 + + Put32(buf[b:], uint32(Level)) + b += 4 + + Put32(buf[b:], Pname) + b += 4 + + return buf +} + +// Request GlxIsList +// size: 12 +type GlxIsListCookie struct { + *cookie +} + +func (c *Conn) GlxIsList(ContextTag GlxContextTag, List uint32) GlxIsListCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxIsListRequest(ContextTag, List), cookie) + return GlxIsListCookie{cookie} +} + +func (c *Conn) GlxIsListUnchecked(ContextTag GlxContextTag, List uint32) GlxIsListCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxIsListRequest(ContextTag, List), cookie) + return GlxIsListCookie{cookie} +} + +// Request reply for GlxIsList +// size: 12 +type GlxIsListReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + RetVal GlxBool32 +} + +// Waits and reads reply data from request GlxIsList +func (cook GlxIsListCookie) Reply() (*GlxIsListReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxIsListReply(buf), nil +} + +// Read reply into structure from buffer for GlxIsList +func glxIsListReply(buf []byte) *GlxIsListReply { + v := new(GlxIsListReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.RetVal = GlxBool32(Get32(buf[b:])) + b += 4 + + return v +} + +func (cook GlxIsListCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxIsList +func (c *Conn) glxIsListRequest(ContextTag GlxContextTag, List uint32) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 141 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], List) + b += 4 + + return buf +} + +// Request GlxFlush +// size: 8 +type GlxFlushCookie struct { + *cookie +} + +// Write request to wire for GlxFlush +func (c *Conn) GlxFlush(ContextTag GlxContextTag) GlxFlushCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.glxFlushRequest(ContextTag), cookie) + return GlxFlushCookie{cookie} +} + +func (c *Conn) GlxFlushChecked(ContextTag GlxContextTag) GlxFlushCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.glxFlushRequest(ContextTag), cookie) + return GlxFlushCookie{cookie} +} + +func (cook GlxFlushCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxFlush +func (c *Conn) glxFlushRequest(ContextTag GlxContextTag) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 142 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + return buf +} + +// Request GlxAreTexturesResident +// size: pad((12 + pad((int(N) * 4)))) +type GlxAreTexturesResidentCookie struct { + *cookie +} + +func (c *Conn) GlxAreTexturesResident(ContextTag GlxContextTag, N int32, Textures []uint32) GlxAreTexturesResidentCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxAreTexturesResidentRequest(ContextTag, N, Textures), cookie) + return GlxAreTexturesResidentCookie{cookie} +} + +func (c *Conn) GlxAreTexturesResidentUnchecked(ContextTag GlxContextTag, N int32, Textures []uint32) GlxAreTexturesResidentCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxAreTexturesResidentRequest(ContextTag, N, Textures), cookie) + return GlxAreTexturesResidentCookie{cookie} +} + +// Request reply for GlxAreTexturesResident +// size: (32 + pad(((int(Length) * 4) * 1))) +type GlxAreTexturesResidentReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + RetVal GlxBool32 + // padding: 20 bytes + Data []bool // size: pad(((int(Length) * 4) * 1)) +} + +// Waits and reads reply data from request GlxAreTexturesResident +func (cook GlxAreTexturesResidentCookie) Reply() (*GlxAreTexturesResidentReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxAreTexturesResidentReply(buf), nil +} + +// Read reply into structure from buffer for GlxAreTexturesResident +func glxAreTexturesResidentReply(buf []byte) *GlxAreTexturesResidentReply { + v := new(GlxAreTexturesResidentReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.RetVal = GlxBool32(Get32(buf[b:])) + b += 4 + + b += 20 // padding + + v.Data = make([]bool, (int(v.Length) * 4)) + for i := 0; i < int((int(v.Length) * 4)); i++ { + if buf[b] == 1 { + v.Data[i] = true + } else { + v.Data[i] = false + } + b += 1 + } + b = pad(b) + + return v +} + +func (cook GlxAreTexturesResidentCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxAreTexturesResident +func (c *Conn) glxAreTexturesResidentRequest(ContextTag GlxContextTag, N int32, Textures []uint32) []byte { + size := pad((12 + pad((int(N) * 4)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 143 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], uint32(N)) + b += 4 + + for i := 0; i < int(N); i++ { + Put32(buf[b:], Textures[i]) + b += 4 + } + b = pad(b) + + return buf +} + +// Request GlxDeleteTextures +// size: pad((12 + pad((int(N) * 4)))) +type GlxDeleteTexturesCookie struct { + *cookie +} + +// Write request to wire for GlxDeleteTextures +func (c *Conn) GlxDeleteTextures(ContextTag GlxContextTag, N int32, Textures []uint32) GlxDeleteTexturesCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.glxDeleteTexturesRequest(ContextTag, N, Textures), cookie) + return GlxDeleteTexturesCookie{cookie} +} + +func (c *Conn) GlxDeleteTexturesChecked(ContextTag GlxContextTag, N int32, Textures []uint32) GlxDeleteTexturesCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.glxDeleteTexturesRequest(ContextTag, N, Textures), cookie) + return GlxDeleteTexturesCookie{cookie} +} + +func (cook GlxDeleteTexturesCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxDeleteTextures +func (c *Conn) glxDeleteTexturesRequest(ContextTag GlxContextTag, N int32, Textures []uint32) []byte { + size := pad((12 + pad((int(N) * 4)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 144 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], uint32(N)) + b += 4 + + for i := 0; i < int(N); i++ { + Put32(buf[b:], Textures[i]) + b += 4 + } + b = pad(b) + + return buf +} + +// Request GlxGenTextures +// size: 12 +type GlxGenTexturesCookie struct { + *cookie +} + +func (c *Conn) GlxGenTextures(ContextTag GlxContextTag, N int32) GlxGenTexturesCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGenTexturesRequest(ContextTag, N), cookie) + return GlxGenTexturesCookie{cookie} +} + +func (c *Conn) GlxGenTexturesUnchecked(ContextTag GlxContextTag, N int32) GlxGenTexturesCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGenTexturesRequest(ContextTag, N), cookie) + return GlxGenTexturesCookie{cookie} +} + +// Request reply for GlxGenTextures +// size: (32 + pad((int(Length) * 4))) +type GlxGenTexturesReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 24 bytes + Data []uint32 // size: pad((int(Length) * 4)) +} + +// Waits and reads reply data from request GlxGenTextures +func (cook GlxGenTexturesCookie) Reply() (*GlxGenTexturesReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGenTexturesReply(buf), nil +} + +// Read reply into structure from buffer for GlxGenTextures +func glxGenTexturesReply(buf []byte) *GlxGenTexturesReply { + v := new(GlxGenTexturesReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 24 // padding + + v.Data = make([]uint32, v.Length) + for i := 0; i < int(v.Length); i++ { + v.Data[i] = Get32(buf[b:]) + b += 4 + } + b = pad(b) + + return v +} + +func (cook GlxGenTexturesCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGenTextures +func (c *Conn) glxGenTexturesRequest(ContextTag GlxContextTag, N int32) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 145 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], uint32(N)) + b += 4 + + return buf +} + +// Request GlxIsTexture +// size: 12 +type GlxIsTextureCookie struct { + *cookie +} + +func (c *Conn) GlxIsTexture(ContextTag GlxContextTag, Texture uint32) GlxIsTextureCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxIsTextureRequest(ContextTag, Texture), cookie) + return GlxIsTextureCookie{cookie} +} + +func (c *Conn) GlxIsTextureUnchecked(ContextTag GlxContextTag, Texture uint32) GlxIsTextureCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxIsTextureRequest(ContextTag, Texture), cookie) + return GlxIsTextureCookie{cookie} +} + +// Request reply for GlxIsTexture +// size: 12 +type GlxIsTextureReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + RetVal GlxBool32 +} + +// Waits and reads reply data from request GlxIsTexture +func (cook GlxIsTextureCookie) Reply() (*GlxIsTextureReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxIsTextureReply(buf), nil +} + +// Read reply into structure from buffer for GlxIsTexture +func glxIsTextureReply(buf []byte) *GlxIsTextureReply { + v := new(GlxIsTextureReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.RetVal = GlxBool32(Get32(buf[b:])) + b += 4 + + return v +} + +func (cook GlxIsTextureCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxIsTexture +func (c *Conn) glxIsTextureRequest(ContextTag GlxContextTag, Texture uint32) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 146 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], Texture) + b += 4 + + return buf +} + +// Request GlxGetColorTable +// size: 24 +type GlxGetColorTableCookie struct { + *cookie +} + +func (c *Conn) GlxGetColorTable(ContextTag GlxContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool) GlxGetColorTableCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGetColorTableRequest(ContextTag, Target, Format, Type, SwapBytes), cookie) + return GlxGetColorTableCookie{cookie} +} + +func (c *Conn) GlxGetColorTableUnchecked(ContextTag GlxContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool) GlxGetColorTableCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGetColorTableRequest(ContextTag, Target, Format, Type, SwapBytes), cookie) + return GlxGetColorTableCookie{cookie} +} + +// Request reply for GlxGetColorTable +// size: (32 + pad(((int(Length) * 4) * 1))) +type GlxGetColorTableReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 8 bytes + Width int32 + // padding: 12 bytes + Data []byte // size: pad(((int(Length) * 4) * 1)) +} + +// Waits and reads reply data from request GlxGetColorTable +func (cook GlxGetColorTableCookie) Reply() (*GlxGetColorTableReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGetColorTableReply(buf), nil +} + +// Read reply into structure from buffer for GlxGetColorTable +func glxGetColorTableReply(buf []byte) *GlxGetColorTableReply { + v := new(GlxGetColorTableReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 8 // padding + + v.Width = int32(Get32(buf[b:])) + b += 4 + + b += 12 // padding + + v.Data = make([]byte, (int(v.Length) * 4)) + copy(v.Data[:(int(v.Length)*4)], buf[b:]) + b += pad(int((int(v.Length) * 4))) + + return v +} + +func (cook GlxGetColorTableCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGetColorTable +func (c *Conn) glxGetColorTableRequest(ContextTag GlxContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool) []byte { + size := 24 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 147 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], Target) + b += 4 + + Put32(buf[b:], Format) + b += 4 + + Put32(buf[b:], Type) + b += 4 + + if SwapBytes { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + return buf +} + +// Request GlxGetColorTableParameterfv +// size: 16 +type GlxGetColorTableParameterfvCookie struct { + *cookie +} + +func (c *Conn) GlxGetColorTableParameterfv(ContextTag GlxContextTag, Target uint32, Pname uint32) GlxGetColorTableParameterfvCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGetColorTableParameterfvRequest(ContextTag, Target, Pname), cookie) + return GlxGetColorTableParameterfvCookie{cookie} +} + +func (c *Conn) GlxGetColorTableParameterfvUnchecked(ContextTag GlxContextTag, Target uint32, Pname uint32) GlxGetColorTableParameterfvCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGetColorTableParameterfvRequest(ContextTag, Target, Pname), cookie) + return GlxGetColorTableParameterfvCookie{cookie} +} + +// Request reply for GlxGetColorTableParameterfv +// size: (32 + pad((int(N) * 4))) +type GlxGetColorTableParameterfvReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 4 bytes + N uint32 + Datum GlxFloat32 + // padding: 12 bytes + Data []GlxFloat32 // size: pad((int(N) * 4)) +} + +// Waits and reads reply data from request GlxGetColorTableParameterfv +func (cook GlxGetColorTableParameterfvCookie) Reply() (*GlxGetColorTableParameterfvReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGetColorTableParameterfvReply(buf), nil +} + +// Read reply into structure from buffer for GlxGetColorTableParameterfv +func glxGetColorTableParameterfvReply(buf []byte) *GlxGetColorTableParameterfvReply { + v := new(GlxGetColorTableParameterfvReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 4 // padding + + v.N = Get32(buf[b:]) + b += 4 + + v.Datum = GlxFloat32(Get32(buf[b:])) + b += 4 + + b += 12 // padding + + v.Data = make([]GlxFloat32, v.N) + for i := 0; i < int(v.N); i++ { + v.Data[i] = GlxFloat32(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + return v +} + +func (cook GlxGetColorTableParameterfvCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGetColorTableParameterfv +func (c *Conn) glxGetColorTableParameterfvRequest(ContextTag GlxContextTag, Target uint32, Pname uint32) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 148 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], Target) + b += 4 + + Put32(buf[b:], Pname) + b += 4 + + return buf +} + +// Request GlxGetColorTableParameteriv +// size: 16 +type GlxGetColorTableParameterivCookie struct { + *cookie +} + +func (c *Conn) GlxGetColorTableParameteriv(ContextTag GlxContextTag, Target uint32, Pname uint32) GlxGetColorTableParameterivCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGetColorTableParameterivRequest(ContextTag, Target, Pname), cookie) + return GlxGetColorTableParameterivCookie{cookie} +} + +func (c *Conn) GlxGetColorTableParameterivUnchecked(ContextTag GlxContextTag, Target uint32, Pname uint32) GlxGetColorTableParameterivCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGetColorTableParameterivRequest(ContextTag, Target, Pname), cookie) + return GlxGetColorTableParameterivCookie{cookie} +} + +// Request reply for GlxGetColorTableParameteriv +// size: (32 + pad((int(N) * 4))) +type GlxGetColorTableParameterivReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 4 bytes + N uint32 + Datum int32 + // padding: 12 bytes + Data []int32 // size: pad((int(N) * 4)) +} + +// Waits and reads reply data from request GlxGetColorTableParameteriv +func (cook GlxGetColorTableParameterivCookie) Reply() (*GlxGetColorTableParameterivReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGetColorTableParameterivReply(buf), nil +} + +// Read reply into structure from buffer for GlxGetColorTableParameteriv +func glxGetColorTableParameterivReply(buf []byte) *GlxGetColorTableParameterivReply { + v := new(GlxGetColorTableParameterivReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 4 // padding + + v.N = Get32(buf[b:]) + b += 4 + + v.Datum = int32(Get32(buf[b:])) + b += 4 + + b += 12 // padding + + v.Data = make([]int32, v.N) + for i := 0; i < int(v.N); i++ { + v.Data[i] = int32(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + return v +} + +func (cook GlxGetColorTableParameterivCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGetColorTableParameteriv +func (c *Conn) glxGetColorTableParameterivRequest(ContextTag GlxContextTag, Target uint32, Pname uint32) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 149 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], Target) + b += 4 + + Put32(buf[b:], Pname) + b += 4 + + return buf +} + +// Request GlxGetConvolutionFilter +// size: 24 +type GlxGetConvolutionFilterCookie struct { + *cookie +} + +func (c *Conn) GlxGetConvolutionFilter(ContextTag GlxContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool) GlxGetConvolutionFilterCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGetConvolutionFilterRequest(ContextTag, Target, Format, Type, SwapBytes), cookie) + return GlxGetConvolutionFilterCookie{cookie} +} + +func (c *Conn) GlxGetConvolutionFilterUnchecked(ContextTag GlxContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool) GlxGetConvolutionFilterCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGetConvolutionFilterRequest(ContextTag, Target, Format, Type, SwapBytes), cookie) + return GlxGetConvolutionFilterCookie{cookie} +} + +// Request reply for GlxGetConvolutionFilter +// size: (32 + pad(((int(Length) * 4) * 1))) +type GlxGetConvolutionFilterReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 8 bytes + Width int32 + Height int32 + // padding: 8 bytes + Data []byte // size: pad(((int(Length) * 4) * 1)) +} + +// Waits and reads reply data from request GlxGetConvolutionFilter +func (cook GlxGetConvolutionFilterCookie) Reply() (*GlxGetConvolutionFilterReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGetConvolutionFilterReply(buf), nil +} + +// Read reply into structure from buffer for GlxGetConvolutionFilter +func glxGetConvolutionFilterReply(buf []byte) *GlxGetConvolutionFilterReply { + v := new(GlxGetConvolutionFilterReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 8 // padding + + v.Width = int32(Get32(buf[b:])) + b += 4 + + v.Height = int32(Get32(buf[b:])) + b += 4 + + b += 8 // padding + + v.Data = make([]byte, (int(v.Length) * 4)) + copy(v.Data[:(int(v.Length)*4)], buf[b:]) + b += pad(int((int(v.Length) * 4))) + + return v +} + +func (cook GlxGetConvolutionFilterCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGetConvolutionFilter +func (c *Conn) glxGetConvolutionFilterRequest(ContextTag GlxContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool) []byte { + size := 24 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 150 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], Target) + b += 4 + + Put32(buf[b:], Format) + b += 4 + + Put32(buf[b:], Type) + b += 4 + + if SwapBytes { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + return buf +} + +// Request GlxGetConvolutionParameterfv +// size: 16 +type GlxGetConvolutionParameterfvCookie struct { + *cookie +} + +func (c *Conn) GlxGetConvolutionParameterfv(ContextTag GlxContextTag, Target uint32, Pname uint32) GlxGetConvolutionParameterfvCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGetConvolutionParameterfvRequest(ContextTag, Target, Pname), cookie) + return GlxGetConvolutionParameterfvCookie{cookie} +} + +func (c *Conn) GlxGetConvolutionParameterfvUnchecked(ContextTag GlxContextTag, Target uint32, Pname uint32) GlxGetConvolutionParameterfvCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGetConvolutionParameterfvRequest(ContextTag, Target, Pname), cookie) + return GlxGetConvolutionParameterfvCookie{cookie} +} + +// Request reply for GlxGetConvolutionParameterfv +// size: (32 + pad((int(N) * 4))) +type GlxGetConvolutionParameterfvReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 4 bytes + N uint32 + Datum GlxFloat32 + // padding: 12 bytes + Data []GlxFloat32 // size: pad((int(N) * 4)) +} + +// Waits and reads reply data from request GlxGetConvolutionParameterfv +func (cook GlxGetConvolutionParameterfvCookie) Reply() (*GlxGetConvolutionParameterfvReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGetConvolutionParameterfvReply(buf), nil +} + +// Read reply into structure from buffer for GlxGetConvolutionParameterfv +func glxGetConvolutionParameterfvReply(buf []byte) *GlxGetConvolutionParameterfvReply { + v := new(GlxGetConvolutionParameterfvReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 4 // padding + + v.N = Get32(buf[b:]) + b += 4 + + v.Datum = GlxFloat32(Get32(buf[b:])) + b += 4 + + b += 12 // padding + + v.Data = make([]GlxFloat32, v.N) + for i := 0; i < int(v.N); i++ { + v.Data[i] = GlxFloat32(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + return v +} + +func (cook GlxGetConvolutionParameterfvCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGetConvolutionParameterfv +func (c *Conn) glxGetConvolutionParameterfvRequest(ContextTag GlxContextTag, Target uint32, Pname uint32) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 151 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], Target) + b += 4 + + Put32(buf[b:], Pname) + b += 4 + + return buf +} + +// Request GlxGetConvolutionParameteriv +// size: 16 +type GlxGetConvolutionParameterivCookie struct { + *cookie +} + +func (c *Conn) GlxGetConvolutionParameteriv(ContextTag GlxContextTag, Target uint32, Pname uint32) GlxGetConvolutionParameterivCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGetConvolutionParameterivRequest(ContextTag, Target, Pname), cookie) + return GlxGetConvolutionParameterivCookie{cookie} +} + +func (c *Conn) GlxGetConvolutionParameterivUnchecked(ContextTag GlxContextTag, Target uint32, Pname uint32) GlxGetConvolutionParameterivCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGetConvolutionParameterivRequest(ContextTag, Target, Pname), cookie) + return GlxGetConvolutionParameterivCookie{cookie} +} + +// Request reply for GlxGetConvolutionParameteriv +// size: (32 + pad((int(N) * 4))) +type GlxGetConvolutionParameterivReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 4 bytes + N uint32 + Datum int32 + // padding: 12 bytes + Data []int32 // size: pad((int(N) * 4)) +} + +// Waits and reads reply data from request GlxGetConvolutionParameteriv +func (cook GlxGetConvolutionParameterivCookie) Reply() (*GlxGetConvolutionParameterivReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGetConvolutionParameterivReply(buf), nil +} + +// Read reply into structure from buffer for GlxGetConvolutionParameteriv +func glxGetConvolutionParameterivReply(buf []byte) *GlxGetConvolutionParameterivReply { + v := new(GlxGetConvolutionParameterivReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 4 // padding + + v.N = Get32(buf[b:]) + b += 4 + + v.Datum = int32(Get32(buf[b:])) + b += 4 + + b += 12 // padding + + v.Data = make([]int32, v.N) + for i := 0; i < int(v.N); i++ { + v.Data[i] = int32(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + return v +} + +func (cook GlxGetConvolutionParameterivCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGetConvolutionParameteriv +func (c *Conn) glxGetConvolutionParameterivRequest(ContextTag GlxContextTag, Target uint32, Pname uint32) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 152 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], Target) + b += 4 + + Put32(buf[b:], Pname) + b += 4 + + return buf +} + +// Request GlxGetSeparableFilter +// size: 24 +type GlxGetSeparableFilterCookie struct { + *cookie +} + +func (c *Conn) GlxGetSeparableFilter(ContextTag GlxContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool) GlxGetSeparableFilterCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGetSeparableFilterRequest(ContextTag, Target, Format, Type, SwapBytes), cookie) + return GlxGetSeparableFilterCookie{cookie} +} + +func (c *Conn) GlxGetSeparableFilterUnchecked(ContextTag GlxContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool) GlxGetSeparableFilterCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGetSeparableFilterRequest(ContextTag, Target, Format, Type, SwapBytes), cookie) + return GlxGetSeparableFilterCookie{cookie} +} + +// Request reply for GlxGetSeparableFilter +// size: (32 + pad(((int(Length) * 4) * 1))) +type GlxGetSeparableFilterReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 8 bytes + RowW int32 + ColH int32 + // padding: 8 bytes + RowsAndCols []byte // size: pad(((int(Length) * 4) * 1)) +} + +// Waits and reads reply data from request GlxGetSeparableFilter +func (cook GlxGetSeparableFilterCookie) Reply() (*GlxGetSeparableFilterReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGetSeparableFilterReply(buf), nil +} + +// Read reply into structure from buffer for GlxGetSeparableFilter +func glxGetSeparableFilterReply(buf []byte) *GlxGetSeparableFilterReply { + v := new(GlxGetSeparableFilterReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 8 // padding + + v.RowW = int32(Get32(buf[b:])) + b += 4 + + v.ColH = int32(Get32(buf[b:])) + b += 4 + + b += 8 // padding + + v.RowsAndCols = make([]byte, (int(v.Length) * 4)) + copy(v.RowsAndCols[:(int(v.Length)*4)], buf[b:]) + b += pad(int((int(v.Length) * 4))) + + return v +} + +func (cook GlxGetSeparableFilterCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGetSeparableFilter +func (c *Conn) glxGetSeparableFilterRequest(ContextTag GlxContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool) []byte { + size := 24 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 153 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], Target) + b += 4 + + Put32(buf[b:], Format) + b += 4 + + Put32(buf[b:], Type) + b += 4 + + if SwapBytes { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + return buf +} + +// Request GlxGetHistogram +// size: 24 +type GlxGetHistogramCookie struct { + *cookie +} + +func (c *Conn) GlxGetHistogram(ContextTag GlxContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool, Reset bool) GlxGetHistogramCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGetHistogramRequest(ContextTag, Target, Format, Type, SwapBytes, Reset), cookie) + return GlxGetHistogramCookie{cookie} +} + +func (c *Conn) GlxGetHistogramUnchecked(ContextTag GlxContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool, Reset bool) GlxGetHistogramCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGetHistogramRequest(ContextTag, Target, Format, Type, SwapBytes, Reset), cookie) + return GlxGetHistogramCookie{cookie} +} + +// Request reply for GlxGetHistogram +// size: (32 + pad(((int(Length) * 4) * 1))) +type GlxGetHistogramReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 8 bytes + Width int32 + // padding: 12 bytes + Data []byte // size: pad(((int(Length) * 4) * 1)) +} + +// Waits and reads reply data from request GlxGetHistogram +func (cook GlxGetHistogramCookie) Reply() (*GlxGetHistogramReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGetHistogramReply(buf), nil +} + +// Read reply into structure from buffer for GlxGetHistogram +func glxGetHistogramReply(buf []byte) *GlxGetHistogramReply { + v := new(GlxGetHistogramReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 8 // padding + + v.Width = int32(Get32(buf[b:])) + b += 4 + + b += 12 // padding + + v.Data = make([]byte, (int(v.Length) * 4)) + copy(v.Data[:(int(v.Length)*4)], buf[b:]) + b += pad(int((int(v.Length) * 4))) + + return v +} + +func (cook GlxGetHistogramCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGetHistogram +func (c *Conn) glxGetHistogramRequest(ContextTag GlxContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool, Reset bool) []byte { + size := 24 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 154 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], Target) + b += 4 + + Put32(buf[b:], Format) + b += 4 + + Put32(buf[b:], Type) + b += 4 + + if SwapBytes { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + if Reset { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + return buf +} + +// Request GlxGetHistogramParameterfv +// size: 16 +type GlxGetHistogramParameterfvCookie struct { + *cookie +} + +func (c *Conn) GlxGetHistogramParameterfv(ContextTag GlxContextTag, Target uint32, Pname uint32) GlxGetHistogramParameterfvCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGetHistogramParameterfvRequest(ContextTag, Target, Pname), cookie) + return GlxGetHistogramParameterfvCookie{cookie} +} + +func (c *Conn) GlxGetHistogramParameterfvUnchecked(ContextTag GlxContextTag, Target uint32, Pname uint32) GlxGetHistogramParameterfvCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGetHistogramParameterfvRequest(ContextTag, Target, Pname), cookie) + return GlxGetHistogramParameterfvCookie{cookie} +} + +// Request reply for GlxGetHistogramParameterfv +// size: (32 + pad((int(N) * 4))) +type GlxGetHistogramParameterfvReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 4 bytes + N uint32 + Datum GlxFloat32 + // padding: 12 bytes + Data []GlxFloat32 // size: pad((int(N) * 4)) +} + +// Waits and reads reply data from request GlxGetHistogramParameterfv +func (cook GlxGetHistogramParameterfvCookie) Reply() (*GlxGetHistogramParameterfvReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGetHistogramParameterfvReply(buf), nil +} + +// Read reply into structure from buffer for GlxGetHistogramParameterfv +func glxGetHistogramParameterfvReply(buf []byte) *GlxGetHistogramParameterfvReply { + v := new(GlxGetHistogramParameterfvReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 4 // padding + + v.N = Get32(buf[b:]) + b += 4 + + v.Datum = GlxFloat32(Get32(buf[b:])) + b += 4 + + b += 12 // padding + + v.Data = make([]GlxFloat32, v.N) + for i := 0; i < int(v.N); i++ { + v.Data[i] = GlxFloat32(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + return v +} + +func (cook GlxGetHistogramParameterfvCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGetHistogramParameterfv +func (c *Conn) glxGetHistogramParameterfvRequest(ContextTag GlxContextTag, Target uint32, Pname uint32) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 155 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], Target) + b += 4 + + Put32(buf[b:], Pname) + b += 4 + + return buf +} + +// Request GlxGetHistogramParameteriv +// size: 16 +type GlxGetHistogramParameterivCookie struct { + *cookie +} + +func (c *Conn) GlxGetHistogramParameteriv(ContextTag GlxContextTag, Target uint32, Pname uint32) GlxGetHistogramParameterivCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGetHistogramParameterivRequest(ContextTag, Target, Pname), cookie) + return GlxGetHistogramParameterivCookie{cookie} +} + +func (c *Conn) GlxGetHistogramParameterivUnchecked(ContextTag GlxContextTag, Target uint32, Pname uint32) GlxGetHistogramParameterivCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGetHistogramParameterivRequest(ContextTag, Target, Pname), cookie) + return GlxGetHistogramParameterivCookie{cookie} +} + +// Request reply for GlxGetHistogramParameteriv +// size: (32 + pad((int(N) * 4))) +type GlxGetHistogramParameterivReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 4 bytes + N uint32 + Datum int32 + // padding: 12 bytes + Data []int32 // size: pad((int(N) * 4)) +} + +// Waits and reads reply data from request GlxGetHistogramParameteriv +func (cook GlxGetHistogramParameterivCookie) Reply() (*GlxGetHistogramParameterivReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGetHistogramParameterivReply(buf), nil +} + +// Read reply into structure from buffer for GlxGetHistogramParameteriv +func glxGetHistogramParameterivReply(buf []byte) *GlxGetHistogramParameterivReply { + v := new(GlxGetHistogramParameterivReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 4 // padding + + v.N = Get32(buf[b:]) + b += 4 + + v.Datum = int32(Get32(buf[b:])) + b += 4 + + b += 12 // padding + + v.Data = make([]int32, v.N) + for i := 0; i < int(v.N); i++ { + v.Data[i] = int32(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + return v +} + +func (cook GlxGetHistogramParameterivCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGetHistogramParameteriv +func (c *Conn) glxGetHistogramParameterivRequest(ContextTag GlxContextTag, Target uint32, Pname uint32) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 156 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], Target) + b += 4 + + Put32(buf[b:], Pname) + b += 4 + + return buf +} + +// Request GlxGetMinmax +// size: 24 +type GlxGetMinmaxCookie struct { + *cookie +} + +func (c *Conn) GlxGetMinmax(ContextTag GlxContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool, Reset bool) GlxGetMinmaxCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGetMinmaxRequest(ContextTag, Target, Format, Type, SwapBytes, Reset), cookie) + return GlxGetMinmaxCookie{cookie} +} + +func (c *Conn) GlxGetMinmaxUnchecked(ContextTag GlxContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool, Reset bool) GlxGetMinmaxCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGetMinmaxRequest(ContextTag, Target, Format, Type, SwapBytes, Reset), cookie) + return GlxGetMinmaxCookie{cookie} +} + +// Request reply for GlxGetMinmax +// size: (32 + pad(((int(Length) * 4) * 1))) +type GlxGetMinmaxReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 24 bytes + Data []byte // size: pad(((int(Length) * 4) * 1)) +} + +// Waits and reads reply data from request GlxGetMinmax +func (cook GlxGetMinmaxCookie) Reply() (*GlxGetMinmaxReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGetMinmaxReply(buf), nil +} + +// Read reply into structure from buffer for GlxGetMinmax +func glxGetMinmaxReply(buf []byte) *GlxGetMinmaxReply { + v := new(GlxGetMinmaxReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 24 // padding + + v.Data = make([]byte, (int(v.Length) * 4)) + copy(v.Data[:(int(v.Length)*4)], buf[b:]) + b += pad(int((int(v.Length) * 4))) + + return v +} + +func (cook GlxGetMinmaxCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGetMinmax +func (c *Conn) glxGetMinmaxRequest(ContextTag GlxContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool, Reset bool) []byte { + size := 24 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 157 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], Target) + b += 4 + + Put32(buf[b:], Format) + b += 4 + + Put32(buf[b:], Type) + b += 4 + + if SwapBytes { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + if Reset { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + return buf +} + +// Request GlxGetMinmaxParameterfv +// size: 16 +type GlxGetMinmaxParameterfvCookie struct { + *cookie +} + +func (c *Conn) GlxGetMinmaxParameterfv(ContextTag GlxContextTag, Target uint32, Pname uint32) GlxGetMinmaxParameterfvCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGetMinmaxParameterfvRequest(ContextTag, Target, Pname), cookie) + return GlxGetMinmaxParameterfvCookie{cookie} +} + +func (c *Conn) GlxGetMinmaxParameterfvUnchecked(ContextTag GlxContextTag, Target uint32, Pname uint32) GlxGetMinmaxParameterfvCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGetMinmaxParameterfvRequest(ContextTag, Target, Pname), cookie) + return GlxGetMinmaxParameterfvCookie{cookie} +} + +// Request reply for GlxGetMinmaxParameterfv +// size: (32 + pad((int(N) * 4))) +type GlxGetMinmaxParameterfvReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 4 bytes + N uint32 + Datum GlxFloat32 + // padding: 12 bytes + Data []GlxFloat32 // size: pad((int(N) * 4)) +} + +// Waits and reads reply data from request GlxGetMinmaxParameterfv +func (cook GlxGetMinmaxParameterfvCookie) Reply() (*GlxGetMinmaxParameterfvReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGetMinmaxParameterfvReply(buf), nil +} + +// Read reply into structure from buffer for GlxGetMinmaxParameterfv +func glxGetMinmaxParameterfvReply(buf []byte) *GlxGetMinmaxParameterfvReply { + v := new(GlxGetMinmaxParameterfvReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 4 // padding + + v.N = Get32(buf[b:]) + b += 4 + + v.Datum = GlxFloat32(Get32(buf[b:])) + b += 4 + + b += 12 // padding + + v.Data = make([]GlxFloat32, v.N) + for i := 0; i < int(v.N); i++ { + v.Data[i] = GlxFloat32(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + return v +} + +func (cook GlxGetMinmaxParameterfvCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGetMinmaxParameterfv +func (c *Conn) glxGetMinmaxParameterfvRequest(ContextTag GlxContextTag, Target uint32, Pname uint32) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 158 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], Target) + b += 4 + + Put32(buf[b:], Pname) + b += 4 + + return buf +} + +// Request GlxGetMinmaxParameteriv +// size: 16 +type GlxGetMinmaxParameterivCookie struct { + *cookie +} + +func (c *Conn) GlxGetMinmaxParameteriv(ContextTag GlxContextTag, Target uint32, Pname uint32) GlxGetMinmaxParameterivCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGetMinmaxParameterivRequest(ContextTag, Target, Pname), cookie) + return GlxGetMinmaxParameterivCookie{cookie} +} + +func (c *Conn) GlxGetMinmaxParameterivUnchecked(ContextTag GlxContextTag, Target uint32, Pname uint32) GlxGetMinmaxParameterivCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGetMinmaxParameterivRequest(ContextTag, Target, Pname), cookie) + return GlxGetMinmaxParameterivCookie{cookie} +} + +// Request reply for GlxGetMinmaxParameteriv +// size: (32 + pad((int(N) * 4))) +type GlxGetMinmaxParameterivReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 4 bytes + N uint32 + Datum int32 + // padding: 12 bytes + Data []int32 // size: pad((int(N) * 4)) +} + +// Waits and reads reply data from request GlxGetMinmaxParameteriv +func (cook GlxGetMinmaxParameterivCookie) Reply() (*GlxGetMinmaxParameterivReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGetMinmaxParameterivReply(buf), nil +} + +// Read reply into structure from buffer for GlxGetMinmaxParameteriv +func glxGetMinmaxParameterivReply(buf []byte) *GlxGetMinmaxParameterivReply { + v := new(GlxGetMinmaxParameterivReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 4 // padding + + v.N = Get32(buf[b:]) + b += 4 + + v.Datum = int32(Get32(buf[b:])) + b += 4 + + b += 12 // padding + + v.Data = make([]int32, v.N) + for i := 0; i < int(v.N); i++ { + v.Data[i] = int32(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + return v +} + +func (cook GlxGetMinmaxParameterivCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGetMinmaxParameteriv +func (c *Conn) glxGetMinmaxParameterivRequest(ContextTag GlxContextTag, Target uint32, Pname uint32) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 159 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], Target) + b += 4 + + Put32(buf[b:], Pname) + b += 4 + + return buf +} + +// Request GlxGetCompressedTexImageARB +// size: 16 +type GlxGetCompressedTexImageARBCookie struct { + *cookie +} + +func (c *Conn) GlxGetCompressedTexImageARB(ContextTag GlxContextTag, Target uint32, Level int32) GlxGetCompressedTexImageARBCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGetCompressedTexImageARBRequest(ContextTag, Target, Level), cookie) + return GlxGetCompressedTexImageARBCookie{cookie} +} + +func (c *Conn) GlxGetCompressedTexImageARBUnchecked(ContextTag GlxContextTag, Target uint32, Level int32) GlxGetCompressedTexImageARBCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGetCompressedTexImageARBRequest(ContextTag, Target, Level), cookie) + return GlxGetCompressedTexImageARBCookie{cookie} +} + +// Request reply for GlxGetCompressedTexImageARB +// size: (32 + pad(((int(Length) * 4) * 1))) +type GlxGetCompressedTexImageARBReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 8 bytes + Size int32 + // padding: 12 bytes + Data []byte // size: pad(((int(Length) * 4) * 1)) +} + +// Waits and reads reply data from request GlxGetCompressedTexImageARB +func (cook GlxGetCompressedTexImageARBCookie) Reply() (*GlxGetCompressedTexImageARBReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGetCompressedTexImageARBReply(buf), nil +} + +// Read reply into structure from buffer for GlxGetCompressedTexImageARB +func glxGetCompressedTexImageARBReply(buf []byte) *GlxGetCompressedTexImageARBReply { + v := new(GlxGetCompressedTexImageARBReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 8 // padding + + v.Size = int32(Get32(buf[b:])) + b += 4 + + b += 12 // padding + + v.Data = make([]byte, (int(v.Length) * 4)) + copy(v.Data[:(int(v.Length)*4)], buf[b:]) + b += pad(int((int(v.Length) * 4))) + + return v +} + +func (cook GlxGetCompressedTexImageARBCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGetCompressedTexImageARB +func (c *Conn) glxGetCompressedTexImageARBRequest(ContextTag GlxContextTag, Target uint32, Level int32) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 160 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], Target) + b += 4 + + Put32(buf[b:], uint32(Level)) + b += 4 + + return buf +} + +// Request GlxDeleteQueriesARB +// size: pad((12 + pad((int(N) * 4)))) +type GlxDeleteQueriesARBCookie struct { + *cookie +} + +// Write request to wire for GlxDeleteQueriesARB +func (c *Conn) GlxDeleteQueriesARB(ContextTag GlxContextTag, N int32, Ids []uint32) GlxDeleteQueriesARBCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.glxDeleteQueriesARBRequest(ContextTag, N, Ids), cookie) + return GlxDeleteQueriesARBCookie{cookie} +} + +func (c *Conn) GlxDeleteQueriesARBChecked(ContextTag GlxContextTag, N int32, Ids []uint32) GlxDeleteQueriesARBCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.glxDeleteQueriesARBRequest(ContextTag, N, Ids), cookie) + return GlxDeleteQueriesARBCookie{cookie} +} + +func (cook GlxDeleteQueriesARBCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxDeleteQueriesARB +func (c *Conn) glxDeleteQueriesARBRequest(ContextTag GlxContextTag, N int32, Ids []uint32) []byte { + size := pad((12 + pad((int(N) * 4)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 161 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], uint32(N)) + b += 4 + + for i := 0; i < int(N); i++ { + Put32(buf[b:], Ids[i]) + b += 4 + } + b = pad(b) + + return buf +} + +// Request GlxGenQueriesARB +// size: 12 +type GlxGenQueriesARBCookie struct { + *cookie +} + +func (c *Conn) GlxGenQueriesARB(ContextTag GlxContextTag, N int32) GlxGenQueriesARBCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGenQueriesARBRequest(ContextTag, N), cookie) + return GlxGenQueriesARBCookie{cookie} +} + +func (c *Conn) GlxGenQueriesARBUnchecked(ContextTag GlxContextTag, N int32) GlxGenQueriesARBCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGenQueriesARBRequest(ContextTag, N), cookie) + return GlxGenQueriesARBCookie{cookie} +} + +// Request reply for GlxGenQueriesARB +// size: (32 + pad((int(Length) * 4))) +type GlxGenQueriesARBReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 24 bytes + Data []uint32 // size: pad((int(Length) * 4)) +} + +// Waits and reads reply data from request GlxGenQueriesARB +func (cook GlxGenQueriesARBCookie) Reply() (*GlxGenQueriesARBReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGenQueriesARBReply(buf), nil +} + +// Read reply into structure from buffer for GlxGenQueriesARB +func glxGenQueriesARBReply(buf []byte) *GlxGenQueriesARBReply { + v := new(GlxGenQueriesARBReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 24 // padding + + v.Data = make([]uint32, v.Length) + for i := 0; i < int(v.Length); i++ { + v.Data[i] = Get32(buf[b:]) + b += 4 + } + b = pad(b) + + return v +} + +func (cook GlxGenQueriesARBCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGenQueriesARB +func (c *Conn) glxGenQueriesARBRequest(ContextTag GlxContextTag, N int32) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 162 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], uint32(N)) + b += 4 + + return buf +} + +// Request GlxIsQueryARB +// size: 12 +type GlxIsQueryARBCookie struct { + *cookie +} + +func (c *Conn) GlxIsQueryARB(ContextTag GlxContextTag, Id uint32) GlxIsQueryARBCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxIsQueryARBRequest(ContextTag, Id), cookie) + return GlxIsQueryARBCookie{cookie} +} + +func (c *Conn) GlxIsQueryARBUnchecked(ContextTag GlxContextTag, Id uint32) GlxIsQueryARBCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxIsQueryARBRequest(ContextTag, Id), cookie) + return GlxIsQueryARBCookie{cookie} +} + +// Request reply for GlxIsQueryARB +// size: 12 +type GlxIsQueryARBReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + RetVal GlxBool32 +} + +// Waits and reads reply data from request GlxIsQueryARB +func (cook GlxIsQueryARBCookie) Reply() (*GlxIsQueryARBReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxIsQueryARBReply(buf), nil +} + +// Read reply into structure from buffer for GlxIsQueryARB +func glxIsQueryARBReply(buf []byte) *GlxIsQueryARBReply { + v := new(GlxIsQueryARBReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.RetVal = GlxBool32(Get32(buf[b:])) + b += 4 + + return v +} + +func (cook GlxIsQueryARBCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxIsQueryARB +func (c *Conn) glxIsQueryARBRequest(ContextTag GlxContextTag, Id uint32) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 163 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], Id) + b += 4 + + return buf +} + +// Request GlxGetQueryivARB +// size: 16 +type GlxGetQueryivARBCookie struct { + *cookie +} + +func (c *Conn) GlxGetQueryivARB(ContextTag GlxContextTag, Target uint32, Pname uint32) GlxGetQueryivARBCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGetQueryivARBRequest(ContextTag, Target, Pname), cookie) + return GlxGetQueryivARBCookie{cookie} +} + +func (c *Conn) GlxGetQueryivARBUnchecked(ContextTag GlxContextTag, Target uint32, Pname uint32) GlxGetQueryivARBCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGetQueryivARBRequest(ContextTag, Target, Pname), cookie) + return GlxGetQueryivARBCookie{cookie} +} + +// Request reply for GlxGetQueryivARB +// size: (32 + pad((int(N) * 4))) +type GlxGetQueryivARBReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 4 bytes + N uint32 + Datum int32 + // padding: 12 bytes + Data []int32 // size: pad((int(N) * 4)) +} + +// Waits and reads reply data from request GlxGetQueryivARB +func (cook GlxGetQueryivARBCookie) Reply() (*GlxGetQueryivARBReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGetQueryivARBReply(buf), nil +} + +// Read reply into structure from buffer for GlxGetQueryivARB +func glxGetQueryivARBReply(buf []byte) *GlxGetQueryivARBReply { + v := new(GlxGetQueryivARBReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 4 // padding + + v.N = Get32(buf[b:]) + b += 4 + + v.Datum = int32(Get32(buf[b:])) + b += 4 + + b += 12 // padding + + v.Data = make([]int32, v.N) + for i := 0; i < int(v.N); i++ { + v.Data[i] = int32(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + return v +} + +func (cook GlxGetQueryivARBCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGetQueryivARB +func (c *Conn) glxGetQueryivARBRequest(ContextTag GlxContextTag, Target uint32, Pname uint32) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 164 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], Target) + b += 4 + + Put32(buf[b:], Pname) + b += 4 + + return buf +} + +// Request GlxGetQueryObjectivARB +// size: 16 +type GlxGetQueryObjectivARBCookie struct { + *cookie +} + +func (c *Conn) GlxGetQueryObjectivARB(ContextTag GlxContextTag, Id uint32, Pname uint32) GlxGetQueryObjectivARBCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGetQueryObjectivARBRequest(ContextTag, Id, Pname), cookie) + return GlxGetQueryObjectivARBCookie{cookie} +} + +func (c *Conn) GlxGetQueryObjectivARBUnchecked(ContextTag GlxContextTag, Id uint32, Pname uint32) GlxGetQueryObjectivARBCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGetQueryObjectivARBRequest(ContextTag, Id, Pname), cookie) + return GlxGetQueryObjectivARBCookie{cookie} +} + +// Request reply for GlxGetQueryObjectivARB +// size: (32 + pad((int(N) * 4))) +type GlxGetQueryObjectivARBReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 4 bytes + N uint32 + Datum int32 + // padding: 12 bytes + Data []int32 // size: pad((int(N) * 4)) +} + +// Waits and reads reply data from request GlxGetQueryObjectivARB +func (cook GlxGetQueryObjectivARBCookie) Reply() (*GlxGetQueryObjectivARBReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGetQueryObjectivARBReply(buf), nil +} + +// Read reply into structure from buffer for GlxGetQueryObjectivARB +func glxGetQueryObjectivARBReply(buf []byte) *GlxGetQueryObjectivARBReply { + v := new(GlxGetQueryObjectivARBReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 4 // padding + + v.N = Get32(buf[b:]) + b += 4 + + v.Datum = int32(Get32(buf[b:])) + b += 4 + + b += 12 // padding + + v.Data = make([]int32, v.N) + for i := 0; i < int(v.N); i++ { + v.Data[i] = int32(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + return v +} + +func (cook GlxGetQueryObjectivARBCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGetQueryObjectivARB +func (c *Conn) glxGetQueryObjectivARBRequest(ContextTag GlxContextTag, Id uint32, Pname uint32) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 165 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], Id) + b += 4 + + Put32(buf[b:], Pname) + b += 4 + + return buf +} + +// Request GlxGetQueryObjectuivARB +// size: 16 +type GlxGetQueryObjectuivARBCookie struct { + *cookie +} + +func (c *Conn) GlxGetQueryObjectuivARB(ContextTag GlxContextTag, Id uint32, Pname uint32) GlxGetQueryObjectuivARBCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.glxGetQueryObjectuivARBRequest(ContextTag, Id, Pname), cookie) + return GlxGetQueryObjectuivARBCookie{cookie} +} + +func (c *Conn) GlxGetQueryObjectuivARBUnchecked(ContextTag GlxContextTag, Id uint32, Pname uint32) GlxGetQueryObjectuivARBCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.glxGetQueryObjectuivARBRequest(ContextTag, Id, Pname), cookie) + return GlxGetQueryObjectuivARBCookie{cookie} +} + +// Request reply for GlxGetQueryObjectuivARB +// size: (32 + pad((int(N) * 4))) +type GlxGetQueryObjectuivARBReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 4 bytes + N uint32 + Datum uint32 + // padding: 12 bytes + Data []uint32 // size: pad((int(N) * 4)) +} + +// Waits and reads reply data from request GlxGetQueryObjectuivARB +func (cook GlxGetQueryObjectuivARBCookie) Reply() (*GlxGetQueryObjectuivARBReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return glxGetQueryObjectuivARBReply(buf), nil +} + +// Read reply into structure from buffer for GlxGetQueryObjectuivARB +func glxGetQueryObjectuivARBReply(buf []byte) *GlxGetQueryObjectuivARBReply { + v := new(GlxGetQueryObjectuivARBReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 4 // padding + + v.N = Get32(buf[b:]) + b += 4 + + v.Datum = Get32(buf[b:]) + b += 4 + + b += 12 // padding + + v.Data = make([]uint32, v.N) + for i := 0; i < int(v.N); i++ { + v.Data[i] = Get32(buf[b:]) + b += 4 + } + b = pad(b) + + return v +} + +func (cook GlxGetQueryObjectuivARBCookie) Check() error { + return cook.check() +} + +// Write request to wire for GlxGetQueryObjectuivARB +func (c *Conn) glxGetQueryObjectuivARBRequest(ContextTag GlxContextTag, Id uint32, Pname uint32) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["GLX"] + b += 1 + + buf[b] = 166 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextTag)) + b += 4 + + Put32(buf[b:], Id) + b += 4 + + Put32(buf[b:], Pname) + b += 4 + + return buf +} diff --git a/nexgb/auto_randr.go b/nexgb/auto_randr.go index fdb10ca..bb092f5 100644 --- a/nexgb/auto_randr.go +++ b/nexgb/auto_randr.go @@ -1,7 +1,7 @@ package xgb /* - This file was generated by randr.xml on May 5 2012 6:06:50pm EDT. + This file was generated by randr.xml on May 6 2012 3:00:44am EDT. This file is automatically generated. Edit at your peril! */ @@ -10,12 +10,6 @@ package xgb // import "xproto" // import "render" -// Skipping definition for base type 'Id' - -// Skipping definition for base type 'Card8' - -// Skipping definition for base type 'Int16' - // Skipping definition for base type 'Int32' // Skipping definition for base type 'Void' @@ -36,6 +30,12 @@ package xgb // Skipping definition for base type 'Float' +// Skipping definition for base type 'Id' + +// Skipping definition for base type 'Card8' + +// Skipping definition for base type 'Int16' + const ( RandrRotationRotate0 = 1 RandrRotationRotate90 = 2 diff --git a/nexgb/auto_record.go b/nexgb/auto_record.go new file mode 100644 index 0000000..75caf76 --- /dev/null +++ b/nexgb/auto_record.go @@ -0,0 +1,1061 @@ +package xgb + +/* + This file was generated by record.xml on May 6 2012 3:00:44am EDT. + This file is automatically generated. Edit at your peril! +*/ + +// Skipping definition for base type 'Card32' + +// Skipping definition for base type 'Double' + +// Skipping definition for base type 'Bool' + +// Skipping definition for base type 'Float' + +// Skipping definition for base type 'Id' + +// Skipping definition for base type 'Card8' + +// Skipping definition for base type 'Int16' + +// Skipping definition for base type 'Int32' + +// Skipping definition for base type 'Void' + +// Skipping definition for base type 'Byte' + +// Skipping definition for base type 'Int8' + +// Skipping definition for base type 'Card16' + +// Skipping definition for base type 'Char' + +const ( + RecordHTypeFromServerTime = 1 + RecordHTypeFromClientTime = 2 + RecordHTypeFromClientSequence = 4 +) + +const ( + RecordCsCurrentClients = 1 + RecordCsFutureClients = 2 + RecordCsAllClients = 3 +) + +// Skipping resource definition of 'Context' + +type RecordElementHeader byte + +type RecordClientSpec uint32 + +// 'RecordRange8' struct definition +// Size: 2 +type RecordRange8 struct { + First byte + Last byte +} + +// Struct read RecordRange8 +func ReadRecordRange8(buf []byte, v *RecordRange8) int { + b := 0 + + v.First = buf[b] + b += 1 + + v.Last = buf[b] + b += 1 + + return b +} + +// Struct list read RecordRange8 +func ReadRecordRange8List(buf []byte, dest []RecordRange8) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = RecordRange8{} + b += ReadRecordRange8(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write RecordRange8 +func (v RecordRange8) Bytes() []byte { + buf := make([]byte, 2) + b := 0 + + buf[b] = v.First + b += 1 + + buf[b] = v.Last + b += 1 + + return buf +} + +// Write struct list RecordRange8 +func RecordRange8ListBytes(buf []byte, list []RecordRange8) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'RecordRange16' struct definition +// Size: 4 +type RecordRange16 struct { + First uint16 + Last uint16 +} + +// Struct read RecordRange16 +func ReadRecordRange16(buf []byte, v *RecordRange16) int { + b := 0 + + v.First = Get16(buf[b:]) + b += 2 + + v.Last = Get16(buf[b:]) + b += 2 + + return b +} + +// Struct list read RecordRange16 +func ReadRecordRange16List(buf []byte, dest []RecordRange16) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = RecordRange16{} + b += ReadRecordRange16(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write RecordRange16 +func (v RecordRange16) Bytes() []byte { + buf := make([]byte, 4) + b := 0 + + Put16(buf[b:], v.First) + b += 2 + + Put16(buf[b:], v.Last) + b += 2 + + return buf +} + +// Write struct list RecordRange16 +func RecordRange16ListBytes(buf []byte, list []RecordRange16) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'RecordExtRange' struct definition +// Size: 6 +type RecordExtRange struct { + Major RecordRange8 + Minor RecordRange16 +} + +// Struct read RecordExtRange +func ReadRecordExtRange(buf []byte, v *RecordExtRange) int { + b := 0 + + v.Major = RecordRange8{} + b += ReadRecordRange8(buf[b:], &v.Major) + + v.Minor = RecordRange16{} + b += ReadRecordRange16(buf[b:], &v.Minor) + + return b +} + +// Struct list read RecordExtRange +func ReadRecordExtRangeList(buf []byte, dest []RecordExtRange) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = RecordExtRange{} + b += ReadRecordExtRange(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write RecordExtRange +func (v RecordExtRange) Bytes() []byte { + buf := make([]byte, 6) + b := 0 + + { + structBytes := v.Major.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + + { + structBytes := v.Minor.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + + return buf +} + +// Write struct list RecordExtRange +func RecordExtRangeListBytes(buf []byte, list []RecordExtRange) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'RecordRange' struct definition +// Size: 24 +type RecordRange struct { + CoreRequests RecordRange8 + CoreReplies RecordRange8 + ExtRequests RecordExtRange + ExtReplies RecordExtRange + DeliveredEvents RecordRange8 + DeviceEvents RecordRange8 + Errors RecordRange8 + ClientStarted bool + ClientDied bool +} + +// Struct read RecordRange +func ReadRecordRange(buf []byte, v *RecordRange) int { + b := 0 + + v.CoreRequests = RecordRange8{} + b += ReadRecordRange8(buf[b:], &v.CoreRequests) + + v.CoreReplies = RecordRange8{} + b += ReadRecordRange8(buf[b:], &v.CoreReplies) + + v.ExtRequests = RecordExtRange{} + b += ReadRecordExtRange(buf[b:], &v.ExtRequests) + + v.ExtReplies = RecordExtRange{} + b += ReadRecordExtRange(buf[b:], &v.ExtReplies) + + v.DeliveredEvents = RecordRange8{} + b += ReadRecordRange8(buf[b:], &v.DeliveredEvents) + + v.DeviceEvents = RecordRange8{} + b += ReadRecordRange8(buf[b:], &v.DeviceEvents) + + v.Errors = RecordRange8{} + b += ReadRecordRange8(buf[b:], &v.Errors) + + if buf[b] == 1 { + v.ClientStarted = true + } else { + v.ClientStarted = false + } + b += 1 + + if buf[b] == 1 { + v.ClientDied = true + } else { + v.ClientDied = false + } + b += 1 + + return b +} + +// Struct list read RecordRange +func ReadRecordRangeList(buf []byte, dest []RecordRange) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = RecordRange{} + b += ReadRecordRange(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write RecordRange +func (v RecordRange) Bytes() []byte { + buf := make([]byte, 24) + b := 0 + + { + structBytes := v.CoreRequests.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + + { + structBytes := v.CoreReplies.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + + { + structBytes := v.ExtRequests.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + + { + structBytes := v.ExtReplies.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + + { + structBytes := v.DeliveredEvents.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + + { + structBytes := v.DeviceEvents.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + + { + structBytes := v.Errors.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + + if v.ClientStarted { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + if v.ClientDied { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + return buf +} + +// Write struct list RecordRange +func RecordRangeListBytes(buf []byte, list []RecordRange) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'RecordClientInfo' struct definition +// Size: (8 + pad((int(NumRanges) * 24))) +type RecordClientInfo struct { + ClientResource RecordClientSpec + NumRanges uint32 + Ranges []RecordRange // size: pad((int(NumRanges) * 24)) +} + +// Struct read RecordClientInfo +func ReadRecordClientInfo(buf []byte, v *RecordClientInfo) int { + b := 0 + + v.ClientResource = RecordClientSpec(Get32(buf[b:])) + b += 4 + + v.NumRanges = Get32(buf[b:]) + b += 4 + + v.Ranges = make([]RecordRange, v.NumRanges) + b += ReadRecordRangeList(buf[b:], v.Ranges) + + return b +} + +// Struct list read RecordClientInfo +func ReadRecordClientInfoList(buf []byte, dest []RecordClientInfo) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = RecordClientInfo{} + b += ReadRecordClientInfo(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write RecordClientInfo +func (v RecordClientInfo) Bytes() []byte { + buf := make([]byte, (8 + pad((int(v.NumRanges) * 24)))) + b := 0 + + Put32(buf[b:], uint32(v.ClientResource)) + b += 4 + + Put32(buf[b:], v.NumRanges) + b += 4 + + b += RecordRangeListBytes(buf[b:], v.Ranges) + + return buf +} + +// Write struct list RecordClientInfo +func RecordClientInfoListBytes(buf []byte, list []RecordClientInfo) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// Struct list size RecordClientInfo +func RecordClientInfoListSize(list []RecordClientInfo) int { + size := 0 + for _, item := range list { + size += (8 + pad((int(item.NumRanges) * 24))) + } + return size +} + +// Error definition RecordBadContext (0) +// Size: 32 + +const BadRecordBadContext = 0 + +type RecordBadContextError struct { + Sequence uint16 + NiceName string + InvalidRecord uint32 +} + +// Error read RecordBadContext +func NewRecordBadContextError(buf []byte) Error { + v := RecordBadContextError{} + v.NiceName = "RecordBadContext" + + b := 1 // skip error determinant + b += 1 // don't read error number + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.InvalidRecord = Get32(buf[b:]) + b += 4 + + return v +} + +func (err RecordBadContextError) ImplementsError() {} + +func (err RecordBadContextError) SequenceId() uint16 { + return err.Sequence +} + +func (err RecordBadContextError) BadId() Id { + return 0 +} + +func (err RecordBadContextError) Error() string { + fieldVals := make([]string, 0, 1) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) + fieldVals = append(fieldVals, sprintf("InvalidRecord: %d", err.InvalidRecord)) + return "BadRecordBadContext {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newErrorFuncs[0] = NewRecordBadContextError +} + +// Request RecordQueryVersion +// size: 8 +type RecordQueryVersionCookie struct { + *cookie +} + +func (c *Conn) RecordQueryVersion(MajorVersion uint16, MinorVersion uint16) RecordQueryVersionCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.recordQueryVersionRequest(MajorVersion, MinorVersion), cookie) + return RecordQueryVersionCookie{cookie} +} + +func (c *Conn) RecordQueryVersionUnchecked(MajorVersion uint16, MinorVersion uint16) RecordQueryVersionCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.recordQueryVersionRequest(MajorVersion, MinorVersion), cookie) + return RecordQueryVersionCookie{cookie} +} + +// Request reply for RecordQueryVersion +// size: 12 +type RecordQueryVersionReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + MajorVersion uint16 + MinorVersion uint16 +} + +// Waits and reads reply data from request RecordQueryVersion +func (cook RecordQueryVersionCookie) Reply() (*RecordQueryVersionReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return recordQueryVersionReply(buf), nil +} + +// Read reply into structure from buffer for RecordQueryVersion +func recordQueryVersionReply(buf []byte) *RecordQueryVersionReply { + v := new(RecordQueryVersionReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.MajorVersion = Get16(buf[b:]) + b += 2 + + v.MinorVersion = Get16(buf[b:]) + b += 2 + + return v +} + +func (cook RecordQueryVersionCookie) Check() error { + return cook.check() +} + +// Write request to wire for RecordQueryVersion +func (c *Conn) recordQueryVersionRequest(MajorVersion uint16, MinorVersion uint16) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RECORD"] + b += 1 + + buf[b] = 0 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put16(buf[b:], MajorVersion) + b += 2 + + Put16(buf[b:], MinorVersion) + b += 2 + + return buf +} + +// Request RecordCreateContext +// size: pad(((20 + pad((int(NumClientSpecs) * 4))) + pad((int(NumRanges) * 24)))) +type RecordCreateContextCookie struct { + *cookie +} + +// Write request to wire for RecordCreateContext +func (c *Conn) RecordCreateContext(Context Id, ElementHeader RecordElementHeader, NumClientSpecs uint32, NumRanges uint32, ClientSpecs []RecordClientSpec, Ranges []RecordRange) RecordCreateContextCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.recordCreateContextRequest(Context, ElementHeader, NumClientSpecs, NumRanges, ClientSpecs, Ranges), cookie) + return RecordCreateContextCookie{cookie} +} + +func (c *Conn) RecordCreateContextChecked(Context Id, ElementHeader RecordElementHeader, NumClientSpecs uint32, NumRanges uint32, ClientSpecs []RecordClientSpec, Ranges []RecordRange) RecordCreateContextCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.recordCreateContextRequest(Context, ElementHeader, NumClientSpecs, NumRanges, ClientSpecs, Ranges), cookie) + return RecordCreateContextCookie{cookie} +} + +func (cook RecordCreateContextCookie) Check() error { + return cook.check() +} + +// Write request to wire for RecordCreateContext +func (c *Conn) recordCreateContextRequest(Context Id, ElementHeader RecordElementHeader, NumClientSpecs uint32, NumRanges uint32, ClientSpecs []RecordClientSpec, Ranges []RecordRange) []byte { + size := pad(((20 + pad((int(NumClientSpecs) * 4))) + pad((int(NumRanges) * 24)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RECORD"] + b += 1 + + buf[b] = 1 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Context)) + b += 4 + + buf[b] = byte(ElementHeader) + b += 1 + + b += 3 // padding + + Put32(buf[b:], NumClientSpecs) + b += 4 + + Put32(buf[b:], NumRanges) + b += 4 + + for i := 0; i < int(NumClientSpecs); i++ { + Put32(buf[b:], uint32(ClientSpecs[i])) + b += 4 + } + b = pad(b) + + b += RecordRangeListBytes(buf[b:], Ranges) + + return buf +} + +// Request RecordRegisterClients +// size: pad(((20 + pad((int(NumClientSpecs) * 4))) + pad((int(NumRanges) * 24)))) +type RecordRegisterClientsCookie struct { + *cookie +} + +// Write request to wire for RecordRegisterClients +func (c *Conn) RecordRegisterClients(Context Id, ElementHeader RecordElementHeader, NumClientSpecs uint32, NumRanges uint32, ClientSpecs []RecordClientSpec, Ranges []RecordRange) RecordRegisterClientsCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.recordRegisterClientsRequest(Context, ElementHeader, NumClientSpecs, NumRanges, ClientSpecs, Ranges), cookie) + return RecordRegisterClientsCookie{cookie} +} + +func (c *Conn) RecordRegisterClientsChecked(Context Id, ElementHeader RecordElementHeader, NumClientSpecs uint32, NumRanges uint32, ClientSpecs []RecordClientSpec, Ranges []RecordRange) RecordRegisterClientsCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.recordRegisterClientsRequest(Context, ElementHeader, NumClientSpecs, NumRanges, ClientSpecs, Ranges), cookie) + return RecordRegisterClientsCookie{cookie} +} + +func (cook RecordRegisterClientsCookie) Check() error { + return cook.check() +} + +// Write request to wire for RecordRegisterClients +func (c *Conn) recordRegisterClientsRequest(Context Id, ElementHeader RecordElementHeader, NumClientSpecs uint32, NumRanges uint32, ClientSpecs []RecordClientSpec, Ranges []RecordRange) []byte { + size := pad(((20 + pad((int(NumClientSpecs) * 4))) + pad((int(NumRanges) * 24)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RECORD"] + b += 1 + + buf[b] = 2 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Context)) + b += 4 + + buf[b] = byte(ElementHeader) + b += 1 + + b += 3 // padding + + Put32(buf[b:], NumClientSpecs) + b += 4 + + Put32(buf[b:], NumRanges) + b += 4 + + for i := 0; i < int(NumClientSpecs); i++ { + Put32(buf[b:], uint32(ClientSpecs[i])) + b += 4 + } + b = pad(b) + + b += RecordRangeListBytes(buf[b:], Ranges) + + return buf +} + +// Request RecordUnregisterClients +// size: pad((12 + pad((int(NumClientSpecs) * 4)))) +type RecordUnregisterClientsCookie struct { + *cookie +} + +// Write request to wire for RecordUnregisterClients +func (c *Conn) RecordUnregisterClients(Context Id, NumClientSpecs uint32, ClientSpecs []RecordClientSpec) RecordUnregisterClientsCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.recordUnregisterClientsRequest(Context, NumClientSpecs, ClientSpecs), cookie) + return RecordUnregisterClientsCookie{cookie} +} + +func (c *Conn) RecordUnregisterClientsChecked(Context Id, NumClientSpecs uint32, ClientSpecs []RecordClientSpec) RecordUnregisterClientsCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.recordUnregisterClientsRequest(Context, NumClientSpecs, ClientSpecs), cookie) + return RecordUnregisterClientsCookie{cookie} +} + +func (cook RecordUnregisterClientsCookie) Check() error { + return cook.check() +} + +// Write request to wire for RecordUnregisterClients +func (c *Conn) recordUnregisterClientsRequest(Context Id, NumClientSpecs uint32, ClientSpecs []RecordClientSpec) []byte { + size := pad((12 + pad((int(NumClientSpecs) * 4)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RECORD"] + b += 1 + + buf[b] = 3 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Context)) + b += 4 + + Put32(buf[b:], NumClientSpecs) + b += 4 + + for i := 0; i < int(NumClientSpecs); i++ { + Put32(buf[b:], uint32(ClientSpecs[i])) + b += 4 + } + b = pad(b) + + return buf +} + +// Request RecordGetContext +// size: 8 +type RecordGetContextCookie struct { + *cookie +} + +func (c *Conn) RecordGetContext(Context Id) RecordGetContextCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.recordGetContextRequest(Context), cookie) + return RecordGetContextCookie{cookie} +} + +func (c *Conn) RecordGetContextUnchecked(Context Id) RecordGetContextCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.recordGetContextRequest(Context), cookie) + return RecordGetContextCookie{cookie} +} + +// Request reply for RecordGetContext +// size: (32 + RecordClientInfoListSize(InterceptedClients)) +type RecordGetContextReply struct { + Sequence uint16 + Length uint32 + Enabled bool + ElementHeader RecordElementHeader + // padding: 3 bytes + NumInterceptedClients uint32 + // padding: 16 bytes + InterceptedClients []RecordClientInfo // size: RecordClientInfoListSize(InterceptedClients) +} + +// Waits and reads reply data from request RecordGetContext +func (cook RecordGetContextCookie) Reply() (*RecordGetContextReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return recordGetContextReply(buf), nil +} + +// Read reply into structure from buffer for RecordGetContext +func recordGetContextReply(buf []byte) *RecordGetContextReply { + v := new(RecordGetContextReply) + b := 1 // skip reply determinant + + if buf[b] == 1 { + v.Enabled = true + } else { + v.Enabled = false + } + b += 1 + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.ElementHeader = RecordElementHeader(buf[b]) + b += 1 + + b += 3 // padding + + v.NumInterceptedClients = Get32(buf[b:]) + b += 4 + + b += 16 // padding + + v.InterceptedClients = make([]RecordClientInfo, v.NumInterceptedClients) + b += ReadRecordClientInfoList(buf[b:], v.InterceptedClients) + + return v +} + +func (cook RecordGetContextCookie) Check() error { + return cook.check() +} + +// Write request to wire for RecordGetContext +func (c *Conn) recordGetContextRequest(Context Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RECORD"] + b += 1 + + buf[b] = 4 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Context)) + b += 4 + + return buf +} + +// Request RecordEnableContext +// size: 8 +type RecordEnableContextCookie struct { + *cookie +} + +func (c *Conn) RecordEnableContext(Context Id) RecordEnableContextCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.recordEnableContextRequest(Context), cookie) + return RecordEnableContextCookie{cookie} +} + +func (c *Conn) RecordEnableContextUnchecked(Context Id) RecordEnableContextCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.recordEnableContextRequest(Context), cookie) + return RecordEnableContextCookie{cookie} +} + +// Request reply for RecordEnableContext +// size: (32 + pad(((int(Length) * 4) * 1))) +type RecordEnableContextReply struct { + Sequence uint16 + Length uint32 + Category byte + ElementHeader RecordElementHeader + ClientSwapped bool + // padding: 2 bytes + XidBase uint32 + ServerTime uint32 + RecSequenceNum uint32 + // padding: 8 bytes + Data []byte // size: pad(((int(Length) * 4) * 1)) +} + +// Waits and reads reply data from request RecordEnableContext +func (cook RecordEnableContextCookie) Reply() (*RecordEnableContextReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return recordEnableContextReply(buf), nil +} + +// Read reply into structure from buffer for RecordEnableContext +func recordEnableContextReply(buf []byte) *RecordEnableContextReply { + v := new(RecordEnableContextReply) + b := 1 // skip reply determinant + + v.Category = buf[b] + b += 1 + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.ElementHeader = RecordElementHeader(buf[b]) + b += 1 + + if buf[b] == 1 { + v.ClientSwapped = true + } else { + v.ClientSwapped = false + } + b += 1 + + b += 2 // padding + + v.XidBase = Get32(buf[b:]) + b += 4 + + v.ServerTime = Get32(buf[b:]) + b += 4 + + v.RecSequenceNum = Get32(buf[b:]) + b += 4 + + b += 8 // padding + + v.Data = make([]byte, (int(v.Length) * 4)) + copy(v.Data[:(int(v.Length)*4)], buf[b:]) + b += pad(int((int(v.Length) * 4))) + + return v +} + +func (cook RecordEnableContextCookie) Check() error { + return cook.check() +} + +// Write request to wire for RecordEnableContext +func (c *Conn) recordEnableContextRequest(Context Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RECORD"] + b += 1 + + buf[b] = 5 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Context)) + b += 4 + + return buf +} + +// Request RecordDisableContext +// size: 8 +type RecordDisableContextCookie struct { + *cookie +} + +// Write request to wire for RecordDisableContext +func (c *Conn) RecordDisableContext(Context Id) RecordDisableContextCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.recordDisableContextRequest(Context), cookie) + return RecordDisableContextCookie{cookie} +} + +func (c *Conn) RecordDisableContextChecked(Context Id) RecordDisableContextCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.recordDisableContextRequest(Context), cookie) + return RecordDisableContextCookie{cookie} +} + +func (cook RecordDisableContextCookie) Check() error { + return cook.check() +} + +// Write request to wire for RecordDisableContext +func (c *Conn) recordDisableContextRequest(Context Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RECORD"] + b += 1 + + buf[b] = 6 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Context)) + b += 4 + + return buf +} + +// Request RecordFreeContext +// size: 8 +type RecordFreeContextCookie struct { + *cookie +} + +// Write request to wire for RecordFreeContext +func (c *Conn) RecordFreeContext(Context Id) RecordFreeContextCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.recordFreeContextRequest(Context), cookie) + return RecordFreeContextCookie{cookie} +} + +func (c *Conn) RecordFreeContextChecked(Context Id) RecordFreeContextCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.recordFreeContextRequest(Context), cookie) + return RecordFreeContextCookie{cookie} +} + +func (cook RecordFreeContextCookie) Check() error { + return cook.check() +} + +// Write request to wire for RecordFreeContext +func (c *Conn) recordFreeContextRequest(Context Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RECORD"] + b += 1 + + buf[b] = 7 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Context)) + b += 4 + + return buf +} diff --git a/nexgb/auto_render.go b/nexgb/auto_render.go index 069ce76..f6b37b7 100644 --- a/nexgb/auto_render.go +++ b/nexgb/auto_render.go @@ -1,7 +1,7 @@ package xgb /* - This file was generated by render.xml on May 5 2012 6:07:02pm EDT. + This file was generated by render.xml on May 6 2012 3:00:44am EDT. This file is automatically generated. Edit at your peril! */ @@ -9,18 +9,6 @@ package xgb // in one package. They are still listed here for reference. // import "xproto" -// Skipping definition for base type 'Id' - -// Skipping definition for base type 'Card8' - -// Skipping definition for base type 'Int16' - -// Skipping definition for base type 'Int32' - -// Skipping definition for base type 'Void' - -// Skipping definition for base type 'Byte' - // Skipping definition for base type 'Int8' // Skipping definition for base type 'Card16' @@ -35,6 +23,18 @@ package xgb // Skipping definition for base type 'Float' +// Skipping definition for base type 'Id' + +// Skipping definition for base type 'Card8' + +// Skipping definition for base type 'Int16' + +// Skipping definition for base type 'Int32' + +// Skipping definition for base type 'Void' + +// Skipping definition for base type 'Byte' + const ( RenderPictTypeIndexed = 0 RenderPictTypeDirect = 1 diff --git a/nexgb/auto_res.go b/nexgb/auto_res.go new file mode 100644 index 0000000..066bad8 --- /dev/null +++ b/nexgb/auto_res.go @@ -0,0 +1,502 @@ +package xgb + +/* + This file was generated by res.xml on May 6 2012 3:00:44am EDT. + This file is automatically generated. Edit at your peril! +*/ + +// Imports are not necessary for XGB because everything is +// in one package. They are still listed here for reference. +// import "xproto" + +// Skipping definition for base type 'Card16' + +// Skipping definition for base type 'Char' + +// Skipping definition for base type 'Card32' + +// Skipping definition for base type 'Double' + +// Skipping definition for base type 'Bool' + +// Skipping definition for base type 'Float' + +// Skipping definition for base type 'Id' + +// Skipping definition for base type 'Card8' + +// Skipping definition for base type 'Int16' + +// Skipping definition for base type 'Int32' + +// Skipping definition for base type 'Void' + +// Skipping definition for base type 'Byte' + +// Skipping definition for base type 'Int8' + +// 'ResClient' struct definition +// Size: 8 +type ResClient struct { + ResourceBase uint32 + ResourceMask uint32 +} + +// Struct read ResClient +func ReadResClient(buf []byte, v *ResClient) int { + b := 0 + + v.ResourceBase = Get32(buf[b:]) + b += 4 + + v.ResourceMask = Get32(buf[b:]) + b += 4 + + return b +} + +// Struct list read ResClient +func ReadResClientList(buf []byte, dest []ResClient) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = ResClient{} + b += ReadResClient(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write ResClient +func (v ResClient) Bytes() []byte { + buf := make([]byte, 8) + b := 0 + + Put32(buf[b:], v.ResourceBase) + b += 4 + + Put32(buf[b:], v.ResourceMask) + b += 4 + + return buf +} + +// Write struct list ResClient +func ResClientListBytes(buf []byte, list []ResClient) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'ResType' struct definition +// Size: 8 +type ResType struct { + ResourceType Id + Count uint32 +} + +// Struct read ResType +func ReadResType(buf []byte, v *ResType) int { + b := 0 + + v.ResourceType = Id(Get32(buf[b:])) + b += 4 + + v.Count = Get32(buf[b:]) + b += 4 + + return b +} + +// Struct list read ResType +func ReadResTypeList(buf []byte, dest []ResType) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = ResType{} + b += ReadResType(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write ResType +func (v ResType) Bytes() []byte { + buf := make([]byte, 8) + b := 0 + + Put32(buf[b:], uint32(v.ResourceType)) + b += 4 + + Put32(buf[b:], v.Count) + b += 4 + + return buf +} + +// Write struct list ResType +func ResTypeListBytes(buf []byte, list []ResType) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// Request ResQueryVersion +// size: 8 +type ResQueryVersionCookie struct { + *cookie +} + +func (c *Conn) ResQueryVersion(ClientMajor byte, ClientMinor byte) ResQueryVersionCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.resQueryVersionRequest(ClientMajor, ClientMinor), cookie) + return ResQueryVersionCookie{cookie} +} + +func (c *Conn) ResQueryVersionUnchecked(ClientMajor byte, ClientMinor byte) ResQueryVersionCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.resQueryVersionRequest(ClientMajor, ClientMinor), cookie) + return ResQueryVersionCookie{cookie} +} + +// Request reply for ResQueryVersion +// size: 12 +type ResQueryVersionReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + ServerMajor uint16 + ServerMinor uint16 +} + +// Waits and reads reply data from request ResQueryVersion +func (cook ResQueryVersionCookie) Reply() (*ResQueryVersionReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return resQueryVersionReply(buf), nil +} + +// Read reply into structure from buffer for ResQueryVersion +func resQueryVersionReply(buf []byte) *ResQueryVersionReply { + v := new(ResQueryVersionReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.ServerMajor = Get16(buf[b:]) + b += 2 + + v.ServerMinor = Get16(buf[b:]) + b += 2 + + return v +} + +func (cook ResQueryVersionCookie) Check() error { + return cook.check() +} + +// Write request to wire for ResQueryVersion +func (c *Conn) resQueryVersionRequest(ClientMajor byte, ClientMinor byte) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["X-RESOURCE"] + b += 1 + + buf[b] = 0 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = ClientMajor + b += 1 + + buf[b] = ClientMinor + b += 1 + + return buf +} + +// Request ResQueryClients +// size: 4 +type ResQueryClientsCookie struct { + *cookie +} + +func (c *Conn) ResQueryClients() ResQueryClientsCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.resQueryClientsRequest(), cookie) + return ResQueryClientsCookie{cookie} +} + +func (c *Conn) ResQueryClientsUnchecked() ResQueryClientsCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.resQueryClientsRequest(), cookie) + return ResQueryClientsCookie{cookie} +} + +// Request reply for ResQueryClients +// size: (32 + pad((int(NumClients) * 8))) +type ResQueryClientsReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + NumClients uint32 + // padding: 20 bytes + Clients []ResClient // size: pad((int(NumClients) * 8)) +} + +// Waits and reads reply data from request ResQueryClients +func (cook ResQueryClientsCookie) Reply() (*ResQueryClientsReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return resQueryClientsReply(buf), nil +} + +// Read reply into structure from buffer for ResQueryClients +func resQueryClientsReply(buf []byte) *ResQueryClientsReply { + v := new(ResQueryClientsReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.NumClients = Get32(buf[b:]) + b += 4 + + b += 20 // padding + + v.Clients = make([]ResClient, v.NumClients) + b += ReadResClientList(buf[b:], v.Clients) + + return v +} + +func (cook ResQueryClientsCookie) Check() error { + return cook.check() +} + +// Write request to wire for ResQueryClients +func (c *Conn) resQueryClientsRequest() []byte { + size := 4 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["X-RESOURCE"] + b += 1 + + buf[b] = 1 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + return buf +} + +// Request ResQueryClientResources +// size: 8 +type ResQueryClientResourcesCookie struct { + *cookie +} + +func (c *Conn) ResQueryClientResources(Xid uint32) ResQueryClientResourcesCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.resQueryClientResourcesRequest(Xid), cookie) + return ResQueryClientResourcesCookie{cookie} +} + +func (c *Conn) ResQueryClientResourcesUnchecked(Xid uint32) ResQueryClientResourcesCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.resQueryClientResourcesRequest(Xid), cookie) + return ResQueryClientResourcesCookie{cookie} +} + +// Request reply for ResQueryClientResources +// size: (32 + pad((int(NumTypes) * 8))) +type ResQueryClientResourcesReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + NumTypes uint32 + // padding: 20 bytes + Types []ResType // size: pad((int(NumTypes) * 8)) +} + +// Waits and reads reply data from request ResQueryClientResources +func (cook ResQueryClientResourcesCookie) Reply() (*ResQueryClientResourcesReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return resQueryClientResourcesReply(buf), nil +} + +// Read reply into structure from buffer for ResQueryClientResources +func resQueryClientResourcesReply(buf []byte) *ResQueryClientResourcesReply { + v := new(ResQueryClientResourcesReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.NumTypes = Get32(buf[b:]) + b += 4 + + b += 20 // padding + + v.Types = make([]ResType, v.NumTypes) + b += ReadResTypeList(buf[b:], v.Types) + + return v +} + +func (cook ResQueryClientResourcesCookie) Check() error { + return cook.check() +} + +// Write request to wire for ResQueryClientResources +func (c *Conn) resQueryClientResourcesRequest(Xid uint32) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["X-RESOURCE"] + b += 1 + + buf[b] = 2 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], Xid) + b += 4 + + return buf +} + +// Request ResQueryClientPixmapBytes +// size: 8 +type ResQueryClientPixmapBytesCookie struct { + *cookie +} + +func (c *Conn) ResQueryClientPixmapBytes(Xid uint32) ResQueryClientPixmapBytesCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.resQueryClientPixmapBytesRequest(Xid), cookie) + return ResQueryClientPixmapBytesCookie{cookie} +} + +func (c *Conn) ResQueryClientPixmapBytesUnchecked(Xid uint32) ResQueryClientPixmapBytesCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.resQueryClientPixmapBytesRequest(Xid), cookie) + return ResQueryClientPixmapBytesCookie{cookie} +} + +// Request reply for ResQueryClientPixmapBytes +// size: 16 +type ResQueryClientPixmapBytesReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Bytes uint32 + BytesOverflow uint32 +} + +// Waits and reads reply data from request ResQueryClientPixmapBytes +func (cook ResQueryClientPixmapBytesCookie) Reply() (*ResQueryClientPixmapBytesReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return resQueryClientPixmapBytesReply(buf), nil +} + +// Read reply into structure from buffer for ResQueryClientPixmapBytes +func resQueryClientPixmapBytesReply(buf []byte) *ResQueryClientPixmapBytesReply { + v := new(ResQueryClientPixmapBytesReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.Bytes = Get32(buf[b:]) + b += 4 + + v.BytesOverflow = Get32(buf[b:]) + b += 4 + + return v +} + +func (cook ResQueryClientPixmapBytesCookie) Check() error { + return cook.check() +} + +// Write request to wire for ResQueryClientPixmapBytes +func (c *Conn) resQueryClientPixmapBytesRequest(Xid uint32) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["X-RESOURCE"] + b += 1 + + buf[b] = 3 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], Xid) + b += 4 + + return buf +} diff --git a/nexgb/auto_screensaver.go b/nexgb/auto_screensaver.go new file mode 100644 index 0000000..c023eec --- /dev/null +++ b/nexgb/auto_screensaver.go @@ -0,0 +1,601 @@ +package xgb + +/* + This file was generated by screensaver.xml on May 6 2012 3:00:44am EDT. + This file is automatically generated. Edit at your peril! +*/ + +// Imports are not necessary for XGB because everything is +// in one package. They are still listed here for reference. +// import "xproto" + +// Skipping definition for base type 'Char' + +// Skipping definition for base type 'Card32' + +// Skipping definition for base type 'Double' + +// Skipping definition for base type 'Bool' + +// Skipping definition for base type 'Float' + +// Skipping definition for base type 'Id' + +// Skipping definition for base type 'Card8' + +// Skipping definition for base type 'Int16' + +// Skipping definition for base type 'Int32' + +// Skipping definition for base type 'Void' + +// Skipping definition for base type 'Byte' + +// Skipping definition for base type 'Int8' + +// Skipping definition for base type 'Card16' + +const ( + ScreensaverKindBlanked = 0 + ScreensaverKindInternal = 1 + ScreensaverKindExternal = 2 +) + +const ( + ScreensaverEventNotifyMask = 1 + ScreensaverEventCycleMask = 2 +) + +const ( + ScreensaverStateOff = 0 + ScreensaverStateOn = 1 + ScreensaverStateCycle = 2 + ScreensaverStateDisabled = 3 +) + +// Event definition ScreensaverNotify (0) +// Size: 32 + +const ScreensaverNotify = 0 + +type ScreensaverNotifyEvent struct { + Sequence uint16 + Code byte + State byte + // padding: 1 bytes + SequenceNumber uint16 + Time Timestamp + Root Id + Window Id + Kind byte + Forced bool + // padding: 14 bytes +} + +// Event read ScreensaverNotify +func NewScreensaverNotifyEvent(buf []byte) Event { + v := ScreensaverNotifyEvent{} + b := 1 // don't read event number + + v.Code = buf[b] + b += 1 + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.State = buf[b] + b += 1 + + b += 1 // padding + + v.SequenceNumber = Get16(buf[b:]) + b += 2 + + v.Time = Timestamp(Get32(buf[b:])) + b += 4 + + v.Root = Id(Get32(buf[b:])) + b += 4 + + v.Window = Id(Get32(buf[b:])) + b += 4 + + v.Kind = buf[b] + b += 1 + + if buf[b] == 1 { + v.Forced = true + } else { + v.Forced = false + } + b += 1 + + b += 14 // padding + + return v +} + +// Event write ScreensaverNotify +func (v ScreensaverNotifyEvent) Bytes() []byte { + buf := make([]byte, 32) + b := 0 + + // write event number + buf[b] = 0 + b += 1 + + buf[b] = v.Code + b += 1 + + b += 2 // skip sequence number + + buf[b] = v.State + b += 1 + + b += 1 // padding + + Put16(buf[b:], v.SequenceNumber) + b += 2 + + Put32(buf[b:], uint32(v.Time)) + b += 4 + + Put32(buf[b:], uint32(v.Root)) + b += 4 + + Put32(buf[b:], uint32(v.Window)) + b += 4 + + buf[b] = v.Kind + b += 1 + + if v.Forced { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + b += 14 // padding + + return buf +} + +func (v ScreensaverNotifyEvent) ImplementsEvent() {} + +func (v ScreensaverNotifyEvent) SequenceId() uint16 { + return v.Sequence +} + +func (v ScreensaverNotifyEvent) String() string { + fieldVals := make([]string, 0, 10) + fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) + fieldVals = append(fieldVals, sprintf("Code: %d", v.Code)) + fieldVals = append(fieldVals, sprintf("State: %d", v.State)) + fieldVals = append(fieldVals, sprintf("SequenceNumber: %d", v.SequenceNumber)) + fieldVals = append(fieldVals, sprintf("Time: %d", v.Time)) + fieldVals = append(fieldVals, sprintf("Root: %d", v.Root)) + fieldVals = append(fieldVals, sprintf("Window: %d", v.Window)) + fieldVals = append(fieldVals, sprintf("Kind: %d", v.Kind)) + fieldVals = append(fieldVals, sprintf("Forced: %t", v.Forced)) + return "ScreensaverNotify {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newEventFuncs[0] = NewScreensaverNotifyEvent +} + +// Request ScreensaverQueryVersion +// size: 8 +type ScreensaverQueryVersionCookie struct { + *cookie +} + +func (c *Conn) ScreensaverQueryVersion(ClientMajorVersion byte, ClientMinorVersion byte) ScreensaverQueryVersionCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.screensaverQueryVersionRequest(ClientMajorVersion, ClientMinorVersion), cookie) + return ScreensaverQueryVersionCookie{cookie} +} + +func (c *Conn) ScreensaverQueryVersionUnchecked(ClientMajorVersion byte, ClientMinorVersion byte) ScreensaverQueryVersionCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.screensaverQueryVersionRequest(ClientMajorVersion, ClientMinorVersion), cookie) + return ScreensaverQueryVersionCookie{cookie} +} + +// Request reply for ScreensaverQueryVersion +// size: 32 +type ScreensaverQueryVersionReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + ServerMajorVersion uint16 + ServerMinorVersion uint16 + // padding: 20 bytes +} + +// Waits and reads reply data from request ScreensaverQueryVersion +func (cook ScreensaverQueryVersionCookie) Reply() (*ScreensaverQueryVersionReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return screensaverQueryVersionReply(buf), nil +} + +// Read reply into structure from buffer for ScreensaverQueryVersion +func screensaverQueryVersionReply(buf []byte) *ScreensaverQueryVersionReply { + v := new(ScreensaverQueryVersionReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.ServerMajorVersion = Get16(buf[b:]) + b += 2 + + v.ServerMinorVersion = Get16(buf[b:]) + b += 2 + + b += 20 // padding + + return v +} + +func (cook ScreensaverQueryVersionCookie) Check() error { + return cook.check() +} + +// Write request to wire for ScreensaverQueryVersion +func (c *Conn) screensaverQueryVersionRequest(ClientMajorVersion byte, ClientMinorVersion byte) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["MIT-SCREEN-SAVER"] + b += 1 + + buf[b] = 0 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = ClientMajorVersion + b += 1 + + buf[b] = ClientMinorVersion + b += 1 + + b += 2 // padding + + return buf +} + +// Request ScreensaverQueryInfo +// size: 8 +type ScreensaverQueryInfoCookie struct { + *cookie +} + +func (c *Conn) ScreensaverQueryInfo(Drawable Id) ScreensaverQueryInfoCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.screensaverQueryInfoRequest(Drawable), cookie) + return ScreensaverQueryInfoCookie{cookie} +} + +func (c *Conn) ScreensaverQueryInfoUnchecked(Drawable Id) ScreensaverQueryInfoCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.screensaverQueryInfoRequest(Drawable), cookie) + return ScreensaverQueryInfoCookie{cookie} +} + +// Request reply for ScreensaverQueryInfo +// size: 32 +type ScreensaverQueryInfoReply struct { + Sequence uint16 + Length uint32 + State byte + SaverWindow Id + MsUntilServer uint32 + MsSinceUserInput uint32 + EventMask uint32 + Kind byte + // padding: 7 bytes +} + +// Waits and reads reply data from request ScreensaverQueryInfo +func (cook ScreensaverQueryInfoCookie) Reply() (*ScreensaverQueryInfoReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return screensaverQueryInfoReply(buf), nil +} + +// Read reply into structure from buffer for ScreensaverQueryInfo +func screensaverQueryInfoReply(buf []byte) *ScreensaverQueryInfoReply { + v := new(ScreensaverQueryInfoReply) + b := 1 // skip reply determinant + + v.State = buf[b] + b += 1 + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.SaverWindow = Id(Get32(buf[b:])) + b += 4 + + v.MsUntilServer = Get32(buf[b:]) + b += 4 + + v.MsSinceUserInput = Get32(buf[b:]) + b += 4 + + v.EventMask = Get32(buf[b:]) + b += 4 + + v.Kind = buf[b] + b += 1 + + b += 7 // padding + + return v +} + +func (cook ScreensaverQueryInfoCookie) Check() error { + return cook.check() +} + +// Write request to wire for ScreensaverQueryInfo +func (c *Conn) screensaverQueryInfoRequest(Drawable Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["MIT-SCREEN-SAVER"] + b += 1 + + buf[b] = 1 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Drawable)) + b += 4 + + return buf +} + +// Request ScreensaverSelectInput +// size: 12 +type ScreensaverSelectInputCookie struct { + *cookie +} + +// Write request to wire for ScreensaverSelectInput +func (c *Conn) ScreensaverSelectInput(Drawable Id, EventMask uint32) ScreensaverSelectInputCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.screensaverSelectInputRequest(Drawable, EventMask), cookie) + return ScreensaverSelectInputCookie{cookie} +} + +func (c *Conn) ScreensaverSelectInputChecked(Drawable Id, EventMask uint32) ScreensaverSelectInputCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.screensaverSelectInputRequest(Drawable, EventMask), cookie) + return ScreensaverSelectInputCookie{cookie} +} + +func (cook ScreensaverSelectInputCookie) Check() error { + return cook.check() +} + +// Write request to wire for ScreensaverSelectInput +func (c *Conn) screensaverSelectInputRequest(Drawable Id, EventMask uint32) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["MIT-SCREEN-SAVER"] + b += 1 + + buf[b] = 2 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Drawable)) + b += 4 + + Put32(buf[b:], EventMask) + b += 4 + + return buf +} + +// Request ScreensaverSetAttributes +// size: pad((24 + (4 + pad((4 * popCount(int(ValueMask))))))) +type ScreensaverSetAttributesCookie struct { + *cookie +} + +// Write request to wire for ScreensaverSetAttributes +func (c *Conn) ScreensaverSetAttributes(Drawable Id, X int16, Y int16, Width uint16, Height uint16, BorderWidth uint16, Class byte, Depth byte, Visual Visualid, ValueMask uint32, ValueList []uint32) ScreensaverSetAttributesCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.screensaverSetAttributesRequest(Drawable, X, Y, Width, Height, BorderWidth, Class, Depth, Visual, ValueMask, ValueList), cookie) + return ScreensaverSetAttributesCookie{cookie} +} + +func (c *Conn) ScreensaverSetAttributesChecked(Drawable Id, X int16, Y int16, Width uint16, Height uint16, BorderWidth uint16, Class byte, Depth byte, Visual Visualid, ValueMask uint32, ValueList []uint32) ScreensaverSetAttributesCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.screensaverSetAttributesRequest(Drawable, X, Y, Width, Height, BorderWidth, Class, Depth, Visual, ValueMask, ValueList), cookie) + return ScreensaverSetAttributesCookie{cookie} +} + +func (cook ScreensaverSetAttributesCookie) Check() error { + return cook.check() +} + +// Write request to wire for ScreensaverSetAttributes +func (c *Conn) screensaverSetAttributesRequest(Drawable Id, X int16, Y int16, Width uint16, Height uint16, BorderWidth uint16, Class byte, Depth byte, Visual Visualid, ValueMask uint32, ValueList []uint32) []byte { + size := pad((24 + (4 + pad((4 * popCount(int(ValueMask))))))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["MIT-SCREEN-SAVER"] + b += 1 + + buf[b] = 3 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Drawable)) + b += 4 + + Put16(buf[b:], uint16(X)) + b += 2 + + Put16(buf[b:], uint16(Y)) + b += 2 + + Put16(buf[b:], Width) + b += 2 + + Put16(buf[b:], Height) + b += 2 + + Put16(buf[b:], BorderWidth) + b += 2 + + buf[b] = Class + b += 1 + + buf[b] = Depth + b += 1 + + Put32(buf[b:], uint32(Visual)) + b += 4 + + Put32(buf[b:], ValueMask) + b += 4 + for i := 0; i < popCount(int(ValueMask)); i++ { + Put32(buf[b:], ValueList[i]) + b += 4 + } + b = pad(b) + + return buf +} + +// Request ScreensaverUnsetAttributes +// size: 8 +type ScreensaverUnsetAttributesCookie struct { + *cookie +} + +// Write request to wire for ScreensaverUnsetAttributes +func (c *Conn) ScreensaverUnsetAttributes(Drawable Id) ScreensaverUnsetAttributesCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.screensaverUnsetAttributesRequest(Drawable), cookie) + return ScreensaverUnsetAttributesCookie{cookie} +} + +func (c *Conn) ScreensaverUnsetAttributesChecked(Drawable Id) ScreensaverUnsetAttributesCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.screensaverUnsetAttributesRequest(Drawable), cookie) + return ScreensaverUnsetAttributesCookie{cookie} +} + +func (cook ScreensaverUnsetAttributesCookie) Check() error { + return cook.check() +} + +// Write request to wire for ScreensaverUnsetAttributes +func (c *Conn) screensaverUnsetAttributesRequest(Drawable Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["MIT-SCREEN-SAVER"] + b += 1 + + buf[b] = 4 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Drawable)) + b += 4 + + return buf +} + +// Request ScreensaverSuspend +// size: 8 +type ScreensaverSuspendCookie struct { + *cookie +} + +// Write request to wire for ScreensaverSuspend +func (c *Conn) ScreensaverSuspend(Suspend bool) ScreensaverSuspendCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.screensaverSuspendRequest(Suspend), cookie) + return ScreensaverSuspendCookie{cookie} +} + +func (c *Conn) ScreensaverSuspendChecked(Suspend bool) ScreensaverSuspendCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.screensaverSuspendRequest(Suspend), cookie) + return ScreensaverSuspendCookie{cookie} +} + +func (cook ScreensaverSuspendCookie) Check() error { + return cook.check() +} + +// Write request to wire for ScreensaverSuspend +func (c *Conn) screensaverSuspendRequest(Suspend bool) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["MIT-SCREEN-SAVER"] + b += 1 + + buf[b] = 5 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + if Suspend { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + b += 3 // padding + + return buf +} diff --git a/nexgb/auto_shape.go b/nexgb/auto_shape.go new file mode 100644 index 0000000..b5c5f04 --- /dev/null +++ b/nexgb/auto_shape.go @@ -0,0 +1,871 @@ +package xgb + +/* + This file was generated by shape.xml on May 6 2012 3:00:44am EDT. + This file is automatically generated. Edit at your peril! +*/ + +// Imports are not necessary for XGB because everything is +// in one package. They are still listed here for reference. +// import "xproto" + +// Skipping definition for base type 'Card16' + +// Skipping definition for base type 'Char' + +// Skipping definition for base type 'Card32' + +// Skipping definition for base type 'Double' + +// Skipping definition for base type 'Bool' + +// Skipping definition for base type 'Float' + +// Skipping definition for base type 'Id' + +// Skipping definition for base type 'Card8' + +// Skipping definition for base type 'Int16' + +// Skipping definition for base type 'Int32' + +// Skipping definition for base type 'Void' + +// Skipping definition for base type 'Byte' + +// Skipping definition for base type 'Int8' + +const ( + ShapeSoSet = 0 + ShapeSoUnion = 1 + ShapeSoIntersect = 2 + ShapeSoSubtract = 3 + ShapeSoInvert = 4 +) + +const ( + ShapeSkBounding = 0 + ShapeSkClip = 1 + ShapeSkInput = 2 +) + +type ShapeOp byte + +type ShapeKind byte + +// Event definition ShapeNotify (0) +// Size: 32 + +const ShapeNotify = 0 + +type ShapeNotifyEvent struct { + Sequence uint16 + ShapeKind ShapeKind + AffectedWindow Id + ExtentsX int16 + ExtentsY int16 + ExtentsWidth uint16 + ExtentsHeight uint16 + ServerTime Timestamp + Shaped bool + // padding: 11 bytes +} + +// Event read ShapeNotify +func NewShapeNotifyEvent(buf []byte) Event { + v := ShapeNotifyEvent{} + b := 1 // don't read event number + + v.ShapeKind = ShapeKind(buf[b]) + b += 1 + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.AffectedWindow = Id(Get32(buf[b:])) + b += 4 + + v.ExtentsX = int16(Get16(buf[b:])) + b += 2 + + v.ExtentsY = int16(Get16(buf[b:])) + b += 2 + + v.ExtentsWidth = Get16(buf[b:]) + b += 2 + + v.ExtentsHeight = Get16(buf[b:]) + b += 2 + + v.ServerTime = Timestamp(Get32(buf[b:])) + b += 4 + + if buf[b] == 1 { + v.Shaped = true + } else { + v.Shaped = false + } + b += 1 + + b += 11 // padding + + return v +} + +// Event write ShapeNotify +func (v ShapeNotifyEvent) Bytes() []byte { + buf := make([]byte, 32) + b := 0 + + // write event number + buf[b] = 0 + b += 1 + + buf[b] = byte(v.ShapeKind) + b += 1 + + b += 2 // skip sequence number + + Put32(buf[b:], uint32(v.AffectedWindow)) + b += 4 + + Put16(buf[b:], uint16(v.ExtentsX)) + b += 2 + + Put16(buf[b:], uint16(v.ExtentsY)) + b += 2 + + Put16(buf[b:], v.ExtentsWidth) + b += 2 + + Put16(buf[b:], v.ExtentsHeight) + b += 2 + + Put32(buf[b:], uint32(v.ServerTime)) + b += 4 + + if v.Shaped { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + b += 11 // padding + + return buf +} + +func (v ShapeNotifyEvent) ImplementsEvent() {} + +func (v ShapeNotifyEvent) SequenceId() uint16 { + return v.Sequence +} + +func (v ShapeNotifyEvent) String() string { + fieldVals := make([]string, 0, 9) + fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) + fieldVals = append(fieldVals, sprintf("ShapeKind: %d", v.ShapeKind)) + fieldVals = append(fieldVals, sprintf("AffectedWindow: %d", v.AffectedWindow)) + fieldVals = append(fieldVals, sprintf("ExtentsX: %d", v.ExtentsX)) + fieldVals = append(fieldVals, sprintf("ExtentsY: %d", v.ExtentsY)) + fieldVals = append(fieldVals, sprintf("ExtentsWidth: %d", v.ExtentsWidth)) + fieldVals = append(fieldVals, sprintf("ExtentsHeight: %d", v.ExtentsHeight)) + fieldVals = append(fieldVals, sprintf("ServerTime: %d", v.ServerTime)) + fieldVals = append(fieldVals, sprintf("Shaped: %t", v.Shaped)) + return "ShapeNotify {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newEventFuncs[0] = NewShapeNotifyEvent +} + +// Request ShapeQueryVersion +// size: 4 +type ShapeQueryVersionCookie struct { + *cookie +} + +func (c *Conn) ShapeQueryVersion() ShapeQueryVersionCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.shapeQueryVersionRequest(), cookie) + return ShapeQueryVersionCookie{cookie} +} + +func (c *Conn) ShapeQueryVersionUnchecked() ShapeQueryVersionCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.shapeQueryVersionRequest(), cookie) + return ShapeQueryVersionCookie{cookie} +} + +// Request reply for ShapeQueryVersion +// size: 12 +type ShapeQueryVersionReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + MajorVersion uint16 + MinorVersion uint16 +} + +// Waits and reads reply data from request ShapeQueryVersion +func (cook ShapeQueryVersionCookie) Reply() (*ShapeQueryVersionReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return shapeQueryVersionReply(buf), nil +} + +// Read reply into structure from buffer for ShapeQueryVersion +func shapeQueryVersionReply(buf []byte) *ShapeQueryVersionReply { + v := new(ShapeQueryVersionReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.MajorVersion = Get16(buf[b:]) + b += 2 + + v.MinorVersion = Get16(buf[b:]) + b += 2 + + return v +} + +func (cook ShapeQueryVersionCookie) Check() error { + return cook.check() +} + +// Write request to wire for ShapeQueryVersion +func (c *Conn) shapeQueryVersionRequest() []byte { + size := 4 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SHAPE"] + b += 1 + + buf[b] = 0 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + return buf +} + +// Request ShapeRectangles +// size: pad((16 + pad((len(Rectangles) * 8)))) +type ShapeRectanglesCookie struct { + *cookie +} + +// Write request to wire for ShapeRectangles +func (c *Conn) ShapeRectangles(Operation ShapeOp, DestinationKind ShapeKind, Ordering byte, DestinationWindow Id, XOffset int16, YOffset int16, Rectangles []Rectangle) ShapeRectanglesCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.shapeRectanglesRequest(Operation, DestinationKind, Ordering, DestinationWindow, XOffset, YOffset, Rectangles), cookie) + return ShapeRectanglesCookie{cookie} +} + +func (c *Conn) ShapeRectanglesChecked(Operation ShapeOp, DestinationKind ShapeKind, Ordering byte, DestinationWindow Id, XOffset int16, YOffset int16, Rectangles []Rectangle) ShapeRectanglesCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.shapeRectanglesRequest(Operation, DestinationKind, Ordering, DestinationWindow, XOffset, YOffset, Rectangles), cookie) + return ShapeRectanglesCookie{cookie} +} + +func (cook ShapeRectanglesCookie) Check() error { + return cook.check() +} + +// Write request to wire for ShapeRectangles +func (c *Conn) shapeRectanglesRequest(Operation ShapeOp, DestinationKind ShapeKind, Ordering byte, DestinationWindow Id, XOffset int16, YOffset int16, Rectangles []Rectangle) []byte { + size := pad((16 + pad((len(Rectangles) * 8)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SHAPE"] + b += 1 + + buf[b] = 1 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = byte(Operation) + b += 1 + + buf[b] = byte(DestinationKind) + b += 1 + + buf[b] = Ordering + b += 1 + + b += 1 // padding + + Put32(buf[b:], uint32(DestinationWindow)) + b += 4 + + Put16(buf[b:], uint16(XOffset)) + b += 2 + + Put16(buf[b:], uint16(YOffset)) + b += 2 + + b += RectangleListBytes(buf[b:], Rectangles) + + return buf +} + +// Request ShapeMask +// size: 20 +type ShapeMaskCookie struct { + *cookie +} + +// Write request to wire for ShapeMask +func (c *Conn) ShapeMask(Operation ShapeOp, DestinationKind ShapeKind, DestinationWindow Id, XOffset int16, YOffset int16, SourceBitmap Id) ShapeMaskCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.shapeMaskRequest(Operation, DestinationKind, DestinationWindow, XOffset, YOffset, SourceBitmap), cookie) + return ShapeMaskCookie{cookie} +} + +func (c *Conn) ShapeMaskChecked(Operation ShapeOp, DestinationKind ShapeKind, DestinationWindow Id, XOffset int16, YOffset int16, SourceBitmap Id) ShapeMaskCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.shapeMaskRequest(Operation, DestinationKind, DestinationWindow, XOffset, YOffset, SourceBitmap), cookie) + return ShapeMaskCookie{cookie} +} + +func (cook ShapeMaskCookie) Check() error { + return cook.check() +} + +// Write request to wire for ShapeMask +func (c *Conn) shapeMaskRequest(Operation ShapeOp, DestinationKind ShapeKind, DestinationWindow Id, XOffset int16, YOffset int16, SourceBitmap Id) []byte { + size := 20 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SHAPE"] + b += 1 + + buf[b] = 2 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = byte(Operation) + b += 1 + + buf[b] = byte(DestinationKind) + b += 1 + + b += 2 // padding + + Put32(buf[b:], uint32(DestinationWindow)) + b += 4 + + Put16(buf[b:], uint16(XOffset)) + b += 2 + + Put16(buf[b:], uint16(YOffset)) + b += 2 + + Put32(buf[b:], uint32(SourceBitmap)) + b += 4 + + return buf +} + +// Request ShapeCombine +// size: 20 +type ShapeCombineCookie struct { + *cookie +} + +// Write request to wire for ShapeCombine +func (c *Conn) ShapeCombine(Operation ShapeOp, DestinationKind ShapeKind, SourceKind ShapeKind, DestinationWindow Id, XOffset int16, YOffset int16, SourceWindow Id) ShapeCombineCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.shapeCombineRequest(Operation, DestinationKind, SourceKind, DestinationWindow, XOffset, YOffset, SourceWindow), cookie) + return ShapeCombineCookie{cookie} +} + +func (c *Conn) ShapeCombineChecked(Operation ShapeOp, DestinationKind ShapeKind, SourceKind ShapeKind, DestinationWindow Id, XOffset int16, YOffset int16, SourceWindow Id) ShapeCombineCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.shapeCombineRequest(Operation, DestinationKind, SourceKind, DestinationWindow, XOffset, YOffset, SourceWindow), cookie) + return ShapeCombineCookie{cookie} +} + +func (cook ShapeCombineCookie) Check() error { + return cook.check() +} + +// Write request to wire for ShapeCombine +func (c *Conn) shapeCombineRequest(Operation ShapeOp, DestinationKind ShapeKind, SourceKind ShapeKind, DestinationWindow Id, XOffset int16, YOffset int16, SourceWindow Id) []byte { + size := 20 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SHAPE"] + b += 1 + + buf[b] = 3 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = byte(Operation) + b += 1 + + buf[b] = byte(DestinationKind) + b += 1 + + buf[b] = byte(SourceKind) + b += 1 + + b += 1 // padding + + Put32(buf[b:], uint32(DestinationWindow)) + b += 4 + + Put16(buf[b:], uint16(XOffset)) + b += 2 + + Put16(buf[b:], uint16(YOffset)) + b += 2 + + Put32(buf[b:], uint32(SourceWindow)) + b += 4 + + return buf +} + +// Request ShapeOffset +// size: 16 +type ShapeOffsetCookie struct { + *cookie +} + +// Write request to wire for ShapeOffset +func (c *Conn) ShapeOffset(DestinationKind ShapeKind, DestinationWindow Id, XOffset int16, YOffset int16) ShapeOffsetCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.shapeOffsetRequest(DestinationKind, DestinationWindow, XOffset, YOffset), cookie) + return ShapeOffsetCookie{cookie} +} + +func (c *Conn) ShapeOffsetChecked(DestinationKind ShapeKind, DestinationWindow Id, XOffset int16, YOffset int16) ShapeOffsetCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.shapeOffsetRequest(DestinationKind, DestinationWindow, XOffset, YOffset), cookie) + return ShapeOffsetCookie{cookie} +} + +func (cook ShapeOffsetCookie) Check() error { + return cook.check() +} + +// Write request to wire for ShapeOffset +func (c *Conn) shapeOffsetRequest(DestinationKind ShapeKind, DestinationWindow Id, XOffset int16, YOffset int16) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SHAPE"] + b += 1 + + buf[b] = 4 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = byte(DestinationKind) + b += 1 + + b += 3 // padding + + Put32(buf[b:], uint32(DestinationWindow)) + b += 4 + + Put16(buf[b:], uint16(XOffset)) + b += 2 + + Put16(buf[b:], uint16(YOffset)) + b += 2 + + return buf +} + +// Request ShapeQueryExtents +// size: 8 +type ShapeQueryExtentsCookie struct { + *cookie +} + +func (c *Conn) ShapeQueryExtents(DestinationWindow Id) ShapeQueryExtentsCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.shapeQueryExtentsRequest(DestinationWindow), cookie) + return ShapeQueryExtentsCookie{cookie} +} + +func (c *Conn) ShapeQueryExtentsUnchecked(DestinationWindow Id) ShapeQueryExtentsCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.shapeQueryExtentsRequest(DestinationWindow), cookie) + return ShapeQueryExtentsCookie{cookie} +} + +// Request reply for ShapeQueryExtents +// size: 28 +type ShapeQueryExtentsReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + BoundingShaped bool + ClipShaped bool + // padding: 2 bytes + BoundingShapeExtentsX int16 + BoundingShapeExtentsY int16 + BoundingShapeExtentsWidth uint16 + BoundingShapeExtentsHeight uint16 + ClipShapeExtentsX int16 + ClipShapeExtentsY int16 + ClipShapeExtentsWidth uint16 + ClipShapeExtentsHeight uint16 +} + +// Waits and reads reply data from request ShapeQueryExtents +func (cook ShapeQueryExtentsCookie) Reply() (*ShapeQueryExtentsReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return shapeQueryExtentsReply(buf), nil +} + +// Read reply into structure from buffer for ShapeQueryExtents +func shapeQueryExtentsReply(buf []byte) *ShapeQueryExtentsReply { + v := new(ShapeQueryExtentsReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + if buf[b] == 1 { + v.BoundingShaped = true + } else { + v.BoundingShaped = false + } + b += 1 + + if buf[b] == 1 { + v.ClipShaped = true + } else { + v.ClipShaped = false + } + b += 1 + + b += 2 // padding + + v.BoundingShapeExtentsX = int16(Get16(buf[b:])) + b += 2 + + v.BoundingShapeExtentsY = int16(Get16(buf[b:])) + b += 2 + + v.BoundingShapeExtentsWidth = Get16(buf[b:]) + b += 2 + + v.BoundingShapeExtentsHeight = Get16(buf[b:]) + b += 2 + + v.ClipShapeExtentsX = int16(Get16(buf[b:])) + b += 2 + + v.ClipShapeExtentsY = int16(Get16(buf[b:])) + b += 2 + + v.ClipShapeExtentsWidth = Get16(buf[b:]) + b += 2 + + v.ClipShapeExtentsHeight = Get16(buf[b:]) + b += 2 + + return v +} + +func (cook ShapeQueryExtentsCookie) Check() error { + return cook.check() +} + +// Write request to wire for ShapeQueryExtents +func (c *Conn) shapeQueryExtentsRequest(DestinationWindow Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SHAPE"] + b += 1 + + buf[b] = 5 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(DestinationWindow)) + b += 4 + + return buf +} + +// Request ShapeSelectInput +// size: 12 +type ShapeSelectInputCookie struct { + *cookie +} + +// Write request to wire for ShapeSelectInput +func (c *Conn) ShapeSelectInput(DestinationWindow Id, Enable bool) ShapeSelectInputCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.shapeSelectInputRequest(DestinationWindow, Enable), cookie) + return ShapeSelectInputCookie{cookie} +} + +func (c *Conn) ShapeSelectInputChecked(DestinationWindow Id, Enable bool) ShapeSelectInputCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.shapeSelectInputRequest(DestinationWindow, Enable), cookie) + return ShapeSelectInputCookie{cookie} +} + +func (cook ShapeSelectInputCookie) Check() error { + return cook.check() +} + +// Write request to wire for ShapeSelectInput +func (c *Conn) shapeSelectInputRequest(DestinationWindow Id, Enable bool) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SHAPE"] + b += 1 + + buf[b] = 6 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(DestinationWindow)) + b += 4 + + if Enable { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + b += 3 // padding + + return buf +} + +// Request ShapeInputSelected +// size: 8 +type ShapeInputSelectedCookie struct { + *cookie +} + +func (c *Conn) ShapeInputSelected(DestinationWindow Id) ShapeInputSelectedCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.shapeInputSelectedRequest(DestinationWindow), cookie) + return ShapeInputSelectedCookie{cookie} +} + +func (c *Conn) ShapeInputSelectedUnchecked(DestinationWindow Id) ShapeInputSelectedCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.shapeInputSelectedRequest(DestinationWindow), cookie) + return ShapeInputSelectedCookie{cookie} +} + +// Request reply for ShapeInputSelected +// size: 8 +type ShapeInputSelectedReply struct { + Sequence uint16 + Length uint32 + Enabled bool +} + +// Waits and reads reply data from request ShapeInputSelected +func (cook ShapeInputSelectedCookie) Reply() (*ShapeInputSelectedReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return shapeInputSelectedReply(buf), nil +} + +// Read reply into structure from buffer for ShapeInputSelected +func shapeInputSelectedReply(buf []byte) *ShapeInputSelectedReply { + v := new(ShapeInputSelectedReply) + b := 1 // skip reply determinant + + if buf[b] == 1 { + v.Enabled = true + } else { + v.Enabled = false + } + b += 1 + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + return v +} + +func (cook ShapeInputSelectedCookie) Check() error { + return cook.check() +} + +// Write request to wire for ShapeInputSelected +func (c *Conn) shapeInputSelectedRequest(DestinationWindow Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SHAPE"] + b += 1 + + buf[b] = 7 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(DestinationWindow)) + b += 4 + + return buf +} + +// Request ShapeGetRectangles +// size: 12 +type ShapeGetRectanglesCookie struct { + *cookie +} + +func (c *Conn) ShapeGetRectangles(Window Id, SourceKind ShapeKind) ShapeGetRectanglesCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.shapeGetRectanglesRequest(Window, SourceKind), cookie) + return ShapeGetRectanglesCookie{cookie} +} + +func (c *Conn) ShapeGetRectanglesUnchecked(Window Id, SourceKind ShapeKind) ShapeGetRectanglesCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.shapeGetRectanglesRequest(Window, SourceKind), cookie) + return ShapeGetRectanglesCookie{cookie} +} + +// Request reply for ShapeGetRectangles +// size: (32 + pad((int(RectanglesLen) * 8))) +type ShapeGetRectanglesReply struct { + Sequence uint16 + Length uint32 + Ordering byte + RectanglesLen uint32 + // padding: 20 bytes + Rectangles []Rectangle // size: pad((int(RectanglesLen) * 8)) +} + +// Waits and reads reply data from request ShapeGetRectangles +func (cook ShapeGetRectanglesCookie) Reply() (*ShapeGetRectanglesReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return shapeGetRectanglesReply(buf), nil +} + +// Read reply into structure from buffer for ShapeGetRectangles +func shapeGetRectanglesReply(buf []byte) *ShapeGetRectanglesReply { + v := new(ShapeGetRectanglesReply) + b := 1 // skip reply determinant + + v.Ordering = buf[b] + b += 1 + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.RectanglesLen = Get32(buf[b:]) + b += 4 + + b += 20 // padding + + v.Rectangles = make([]Rectangle, v.RectanglesLen) + b += ReadRectangleList(buf[b:], v.Rectangles) + + return v +} + +func (cook ShapeGetRectanglesCookie) Check() error { + return cook.check() +} + +// Write request to wire for ShapeGetRectangles +func (c *Conn) shapeGetRectanglesRequest(Window Id, SourceKind ShapeKind) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SHAPE"] + b += 1 + + buf[b] = 8 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Window)) + b += 4 + + buf[b] = byte(SourceKind) + b += 1 + + b += 3 // padding + + return buf +} diff --git a/nexgb/auto_shm.go b/nexgb/auto_shm.go new file mode 100644 index 0000000..5b7ba28 --- /dev/null +++ b/nexgb/auto_shm.go @@ -0,0 +1,644 @@ +package xgb + +/* + This file was generated by shm.xml on May 6 2012 3:00:44am EDT. + This file is automatically generated. Edit at your peril! +*/ + +// Imports are not necessary for XGB because everything is +// in one package. They are still listed here for reference. +// import "xproto" + +// Skipping definition for base type 'Card8' + +// Skipping definition for base type 'Int16' + +// Skipping definition for base type 'Int32' + +// Skipping definition for base type 'Void' + +// Skipping definition for base type 'Byte' + +// Skipping definition for base type 'Int8' + +// Skipping definition for base type 'Card16' + +// Skipping definition for base type 'Char' + +// Skipping definition for base type 'Card32' + +// Skipping definition for base type 'Double' + +// Skipping definition for base type 'Bool' + +// Skipping definition for base type 'Float' + +// Skipping definition for base type 'Id' + +// Skipping resource definition of 'Seg' + +// Event definition ShmCompletion (0) +// Size: 32 + +const ShmCompletion = 0 + +type ShmCompletionEvent struct { + Sequence uint16 + // padding: 1 bytes + Drawable Id + MinorEvent uint16 + MajorEvent byte + // padding: 1 bytes + Shmseg Id + Offset uint32 +} + +// Event read ShmCompletion +func NewShmCompletionEvent(buf []byte) Event { + v := ShmCompletionEvent{} + b := 1 // don't read event number + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Drawable = Id(Get32(buf[b:])) + b += 4 + + v.MinorEvent = Get16(buf[b:]) + b += 2 + + v.MajorEvent = buf[b] + b += 1 + + b += 1 // padding + + v.Shmseg = Id(Get32(buf[b:])) + b += 4 + + v.Offset = Get32(buf[b:]) + b += 4 + + return v +} + +// Event write ShmCompletion +func (v ShmCompletionEvent) Bytes() []byte { + buf := make([]byte, 32) + b := 0 + + // write event number + buf[b] = 0 + b += 1 + + b += 1 // padding + + b += 2 // skip sequence number + + Put32(buf[b:], uint32(v.Drawable)) + b += 4 + + Put16(buf[b:], v.MinorEvent) + b += 2 + + buf[b] = v.MajorEvent + b += 1 + + b += 1 // padding + + Put32(buf[b:], uint32(v.Shmseg)) + b += 4 + + Put32(buf[b:], v.Offset) + b += 4 + + return buf +} + +func (v ShmCompletionEvent) ImplementsEvent() {} + +func (v ShmCompletionEvent) SequenceId() uint16 { + return v.Sequence +} + +func (v ShmCompletionEvent) String() string { + fieldVals := make([]string, 0, 7) + fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) + fieldVals = append(fieldVals, sprintf("Drawable: %d", v.Drawable)) + fieldVals = append(fieldVals, sprintf("MinorEvent: %d", v.MinorEvent)) + fieldVals = append(fieldVals, sprintf("MajorEvent: %d", v.MajorEvent)) + fieldVals = append(fieldVals, sprintf("Shmseg: %d", v.Shmseg)) + fieldVals = append(fieldVals, sprintf("Offset: %d", v.Offset)) + return "ShmCompletion {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newEventFuncs[0] = NewShmCompletionEvent +} + +// ErrorCopy definition ShmBadSeg (0) + +const BadShmBadSeg = 0 + +type ShmBadSegError ValueError + +func NewShmBadSegError(buf []byte) Error { + v := ShmBadSegError(NewValueError(buf).(ValueError)) + v.NiceName = "ShmBadSeg" + return v +} + +func (err ShmBadSegError) ImplementsError() {} + +func (err ShmBadSegError) SequenceId() uint16 { + return err.Sequence +} + +func (err ShmBadSegError) BadId() Id { + return Id(err.BadValue) +} + +func (err ShmBadSegError) Error() string { + fieldVals := make([]string, 0, 4) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) + fieldVals = append(fieldVals, sprintf("BadValue: %d", err.BadValue)) + fieldVals = append(fieldVals, sprintf("MinorOpcode: %d", err.MinorOpcode)) + fieldVals = append(fieldVals, sprintf("MajorOpcode: %d", err.MajorOpcode)) + return "BadShmBadSeg {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newErrorFuncs[0] = NewShmBadSegError +} + +// Request ShmQueryVersion +// size: 4 +type ShmQueryVersionCookie struct { + *cookie +} + +func (c *Conn) ShmQueryVersion() ShmQueryVersionCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.shmQueryVersionRequest(), cookie) + return ShmQueryVersionCookie{cookie} +} + +func (c *Conn) ShmQueryVersionUnchecked() ShmQueryVersionCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.shmQueryVersionRequest(), cookie) + return ShmQueryVersionCookie{cookie} +} + +// Request reply for ShmQueryVersion +// size: 32 +type ShmQueryVersionReply struct { + Sequence uint16 + Length uint32 + SharedPixmaps bool + MajorVersion uint16 + MinorVersion uint16 + Uid uint16 + Gid uint16 + PixmapFormat byte + // padding: 15 bytes +} + +// Waits and reads reply data from request ShmQueryVersion +func (cook ShmQueryVersionCookie) Reply() (*ShmQueryVersionReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return shmQueryVersionReply(buf), nil +} + +// Read reply into structure from buffer for ShmQueryVersion +func shmQueryVersionReply(buf []byte) *ShmQueryVersionReply { + v := new(ShmQueryVersionReply) + b := 1 // skip reply determinant + + if buf[b] == 1 { + v.SharedPixmaps = true + } else { + v.SharedPixmaps = false + } + b += 1 + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.MajorVersion = Get16(buf[b:]) + b += 2 + + v.MinorVersion = Get16(buf[b:]) + b += 2 + + v.Uid = Get16(buf[b:]) + b += 2 + + v.Gid = Get16(buf[b:]) + b += 2 + + v.PixmapFormat = buf[b] + b += 1 + + b += 15 // padding + + return v +} + +func (cook ShmQueryVersionCookie) Check() error { + return cook.check() +} + +// Write request to wire for ShmQueryVersion +func (c *Conn) shmQueryVersionRequest() []byte { + size := 4 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["MIT-SHM"] + b += 1 + + buf[b] = 0 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + return buf +} + +// Request ShmAttach +// size: 16 +type ShmAttachCookie struct { + *cookie +} + +// Write request to wire for ShmAttach +func (c *Conn) ShmAttach(Shmseg Id, Shmid uint32, ReadOnly bool) ShmAttachCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.shmAttachRequest(Shmseg, Shmid, ReadOnly), cookie) + return ShmAttachCookie{cookie} +} + +func (c *Conn) ShmAttachChecked(Shmseg Id, Shmid uint32, ReadOnly bool) ShmAttachCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.shmAttachRequest(Shmseg, Shmid, ReadOnly), cookie) + return ShmAttachCookie{cookie} +} + +func (cook ShmAttachCookie) Check() error { + return cook.check() +} + +// Write request to wire for ShmAttach +func (c *Conn) shmAttachRequest(Shmseg Id, Shmid uint32, ReadOnly bool) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["MIT-SHM"] + b += 1 + + buf[b] = 1 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Shmseg)) + b += 4 + + Put32(buf[b:], Shmid) + b += 4 + + if ReadOnly { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + b += 3 // padding + + return buf +} + +// Request ShmDetach +// size: 8 +type ShmDetachCookie struct { + *cookie +} + +// Write request to wire for ShmDetach +func (c *Conn) ShmDetach(Shmseg Id) ShmDetachCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.shmDetachRequest(Shmseg), cookie) + return ShmDetachCookie{cookie} +} + +func (c *Conn) ShmDetachChecked(Shmseg Id) ShmDetachCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.shmDetachRequest(Shmseg), cookie) + return ShmDetachCookie{cookie} +} + +func (cook ShmDetachCookie) Check() error { + return cook.check() +} + +// Write request to wire for ShmDetach +func (c *Conn) shmDetachRequest(Shmseg Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["MIT-SHM"] + b += 1 + + buf[b] = 2 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Shmseg)) + b += 4 + + return buf +} + +// Request ShmPutImage +// size: 40 +type ShmPutImageCookie struct { + *cookie +} + +// Write request to wire for ShmPutImage +func (c *Conn) ShmPutImage(Drawable Id, Gc Id, TotalWidth uint16, TotalHeight uint16, SrcX uint16, SrcY uint16, SrcWidth uint16, SrcHeight uint16, DstX int16, DstY int16, Depth byte, Format byte, SendEvent byte, Shmseg Id, Offset uint32) ShmPutImageCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.shmPutImageRequest(Drawable, Gc, TotalWidth, TotalHeight, SrcX, SrcY, SrcWidth, SrcHeight, DstX, DstY, Depth, Format, SendEvent, Shmseg, Offset), cookie) + return ShmPutImageCookie{cookie} +} + +func (c *Conn) ShmPutImageChecked(Drawable Id, Gc Id, TotalWidth uint16, TotalHeight uint16, SrcX uint16, SrcY uint16, SrcWidth uint16, SrcHeight uint16, DstX int16, DstY int16, Depth byte, Format byte, SendEvent byte, Shmseg Id, Offset uint32) ShmPutImageCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.shmPutImageRequest(Drawable, Gc, TotalWidth, TotalHeight, SrcX, SrcY, SrcWidth, SrcHeight, DstX, DstY, Depth, Format, SendEvent, Shmseg, Offset), cookie) + return ShmPutImageCookie{cookie} +} + +func (cook ShmPutImageCookie) Check() error { + return cook.check() +} + +// Write request to wire for ShmPutImage +func (c *Conn) shmPutImageRequest(Drawable Id, Gc Id, TotalWidth uint16, TotalHeight uint16, SrcX uint16, SrcY uint16, SrcWidth uint16, SrcHeight uint16, DstX int16, DstY int16, Depth byte, Format byte, SendEvent byte, Shmseg Id, Offset uint32) []byte { + size := 40 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["MIT-SHM"] + b += 1 + + buf[b] = 3 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Drawable)) + b += 4 + + Put32(buf[b:], uint32(Gc)) + b += 4 + + Put16(buf[b:], TotalWidth) + b += 2 + + Put16(buf[b:], TotalHeight) + b += 2 + + Put16(buf[b:], SrcX) + b += 2 + + Put16(buf[b:], SrcY) + b += 2 + + Put16(buf[b:], SrcWidth) + b += 2 + + Put16(buf[b:], SrcHeight) + b += 2 + + Put16(buf[b:], uint16(DstX)) + b += 2 + + Put16(buf[b:], uint16(DstY)) + b += 2 + + buf[b] = Depth + b += 1 + + buf[b] = Format + b += 1 + + buf[b] = SendEvent + b += 1 + + b += 1 // padding + + Put32(buf[b:], uint32(Shmseg)) + b += 4 + + Put32(buf[b:], Offset) + b += 4 + + return buf +} + +// Request ShmGetImage +// size: 32 +type ShmGetImageCookie struct { + *cookie +} + +func (c *Conn) ShmGetImage(Drawable Id, X int16, Y int16, Width uint16, Height uint16, PlaneMask uint32, Format byte, Shmseg Id, Offset uint32) ShmGetImageCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.shmGetImageRequest(Drawable, X, Y, Width, Height, PlaneMask, Format, Shmseg, Offset), cookie) + return ShmGetImageCookie{cookie} +} + +func (c *Conn) ShmGetImageUnchecked(Drawable Id, X int16, Y int16, Width uint16, Height uint16, PlaneMask uint32, Format byte, Shmseg Id, Offset uint32) ShmGetImageCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.shmGetImageRequest(Drawable, X, Y, Width, Height, PlaneMask, Format, Shmseg, Offset), cookie) + return ShmGetImageCookie{cookie} +} + +// Request reply for ShmGetImage +// size: 16 +type ShmGetImageReply struct { + Sequence uint16 + Length uint32 + Depth byte + Visual Visualid + Size uint32 +} + +// Waits and reads reply data from request ShmGetImage +func (cook ShmGetImageCookie) Reply() (*ShmGetImageReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return shmGetImageReply(buf), nil +} + +// Read reply into structure from buffer for ShmGetImage +func shmGetImageReply(buf []byte) *ShmGetImageReply { + v := new(ShmGetImageReply) + b := 1 // skip reply determinant + + v.Depth = buf[b] + b += 1 + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.Visual = Visualid(Get32(buf[b:])) + b += 4 + + v.Size = Get32(buf[b:]) + b += 4 + + return v +} + +func (cook ShmGetImageCookie) Check() error { + return cook.check() +} + +// Write request to wire for ShmGetImage +func (c *Conn) shmGetImageRequest(Drawable Id, X int16, Y int16, Width uint16, Height uint16, PlaneMask uint32, Format byte, Shmseg Id, Offset uint32) []byte { + size := 32 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["MIT-SHM"] + b += 1 + + buf[b] = 4 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Drawable)) + b += 4 + + Put16(buf[b:], uint16(X)) + b += 2 + + Put16(buf[b:], uint16(Y)) + b += 2 + + Put16(buf[b:], Width) + b += 2 + + Put16(buf[b:], Height) + b += 2 + + Put32(buf[b:], PlaneMask) + b += 4 + + buf[b] = Format + b += 1 + + b += 3 // padding + + Put32(buf[b:], uint32(Shmseg)) + b += 4 + + Put32(buf[b:], Offset) + b += 4 + + return buf +} + +// Request ShmCreatePixmap +// size: 28 +type ShmCreatePixmapCookie struct { + *cookie +} + +// Write request to wire for ShmCreatePixmap +func (c *Conn) ShmCreatePixmap(Pid Id, Drawable Id, Width uint16, Height uint16, Depth byte, Shmseg Id, Offset uint32) ShmCreatePixmapCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.shmCreatePixmapRequest(Pid, Drawable, Width, Height, Depth, Shmseg, Offset), cookie) + return ShmCreatePixmapCookie{cookie} +} + +func (c *Conn) ShmCreatePixmapChecked(Pid Id, Drawable Id, Width uint16, Height uint16, Depth byte, Shmseg Id, Offset uint32) ShmCreatePixmapCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.shmCreatePixmapRequest(Pid, Drawable, Width, Height, Depth, Shmseg, Offset), cookie) + return ShmCreatePixmapCookie{cookie} +} + +func (cook ShmCreatePixmapCookie) Check() error { + return cook.check() +} + +// Write request to wire for ShmCreatePixmap +func (c *Conn) shmCreatePixmapRequest(Pid Id, Drawable Id, Width uint16, Height uint16, Depth byte, Shmseg Id, Offset uint32) []byte { + size := 28 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["MIT-SHM"] + b += 1 + + buf[b] = 5 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Pid)) + b += 4 + + Put32(buf[b:], uint32(Drawable)) + b += 4 + + Put16(buf[b:], Width) + b += 2 + + Put16(buf[b:], Height) + b += 2 + + buf[b] = Depth + b += 1 + + b += 3 // padding + + Put32(buf[b:], uint32(Shmseg)) + b += 4 + + Put32(buf[b:], Offset) + b += 4 + + return buf +} diff --git a/nexgb/auto_sync.go b/nexgb/auto_sync.go new file mode 100644 index 0000000..e87c488 --- /dev/null +++ b/nexgb/auto_sync.go @@ -0,0 +1,1899 @@ +package xgb + +/* + This file was generated by sync.xml on May 6 2012 3:00:44am EDT. + This file is automatically generated. Edit at your peril! +*/ + +// Imports are not necessary for XGB because everything is +// in one package. They are still listed here for reference. +// import "xproto" + +// Skipping definition for base type 'Float' + +// Skipping definition for base type 'Id' + +// Skipping definition for base type 'Card8' + +// Skipping definition for base type 'Int16' + +// Skipping definition for base type 'Int32' + +// Skipping definition for base type 'Void' + +// Skipping definition for base type 'Byte' + +// Skipping definition for base type 'Int8' + +// Skipping definition for base type 'Card16' + +// Skipping definition for base type 'Char' + +// Skipping definition for base type 'Card32' + +// Skipping definition for base type 'Double' + +// Skipping definition for base type 'Bool' + +const ( + SyncAlarmstateActive = 0 + SyncAlarmstateInactive = 1 + SyncAlarmstateDestroyed = 2 +) + +const ( + SyncTesttypePositiveTransition = 0 + SyncTesttypeNegativeTransition = 1 + SyncTesttypePositiveComparison = 2 + SyncTesttypeNegativeComparison = 3 +) + +const ( + SyncValuetypeAbsolute = 0 + SyncValuetypeRelative = 1 +) + +const ( + SyncCaCounter = 1 + SyncCaValueType = 2 + SyncCaValue = 4 + SyncCaTestType = 8 + SyncCaDelta = 16 + SyncCaEvents = 32 +) + +// Skipping resource definition of 'Alarm' + +// Skipping resource definition of 'Counter' + +// Skipping resource definition of 'Fence' + +// 'SyncInt64' struct definition +// Size: 8 +type SyncInt64 struct { + Hi int32 + Lo uint32 +} + +// Struct read SyncInt64 +func ReadSyncInt64(buf []byte, v *SyncInt64) int { + b := 0 + + v.Hi = int32(Get32(buf[b:])) + b += 4 + + v.Lo = Get32(buf[b:]) + b += 4 + + return b +} + +// Struct list read SyncInt64 +func ReadSyncInt64List(buf []byte, dest []SyncInt64) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = SyncInt64{} + b += ReadSyncInt64(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write SyncInt64 +func (v SyncInt64) Bytes() []byte { + buf := make([]byte, 8) + b := 0 + + Put32(buf[b:], uint32(v.Hi)) + b += 4 + + Put32(buf[b:], v.Lo) + b += 4 + + return buf +} + +// Write struct list SyncInt64 +func SyncInt64ListBytes(buf []byte, list []SyncInt64) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'SyncSystemcounter' struct definition +// Size: (14 + pad((int(NameLen) * 1))) +type SyncSystemcounter struct { + Counter Id + Resolution SyncInt64 + NameLen uint16 + Name string // size: pad((int(NameLen) * 1)) +} + +// Struct read SyncSystemcounter +func ReadSyncSystemcounter(buf []byte, v *SyncSystemcounter) int { + b := 0 + + v.Counter = Id(Get32(buf[b:])) + b += 4 + + v.Resolution = SyncInt64{} + b += ReadSyncInt64(buf[b:], &v.Resolution) + + v.NameLen = Get16(buf[b:]) + b += 2 + + { + byteString := make([]byte, v.NameLen) + copy(byteString[:v.NameLen], buf[b:]) + v.Name = string(byteString) + b += pad(int(v.NameLen)) + } + + return b +} + +// Struct list read SyncSystemcounter +func ReadSyncSystemcounterList(buf []byte, dest []SyncSystemcounter) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = SyncSystemcounter{} + b += ReadSyncSystemcounter(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write SyncSystemcounter +func (v SyncSystemcounter) Bytes() []byte { + buf := make([]byte, (14 + pad((int(v.NameLen) * 1)))) + b := 0 + + Put32(buf[b:], uint32(v.Counter)) + b += 4 + + { + structBytes := v.Resolution.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + + Put16(buf[b:], v.NameLen) + b += 2 + + copy(buf[b:], v.Name[:v.NameLen]) + b += pad(int(v.NameLen)) + + return buf +} + +// Write struct list SyncSystemcounter +func SyncSystemcounterListBytes(buf []byte, list []SyncSystemcounter) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// Struct list size SyncSystemcounter +func SyncSystemcounterListSize(list []SyncSystemcounter) int { + size := 0 + for _, item := range list { + size += (14 + pad((int(item.NameLen) * 1))) + } + return size +} + +// 'SyncTrigger' struct definition +// Size: 20 +type SyncTrigger struct { + Counter Id + WaitType uint32 + WaitValue SyncInt64 + TestType uint32 +} + +// Struct read SyncTrigger +func ReadSyncTrigger(buf []byte, v *SyncTrigger) int { + b := 0 + + v.Counter = Id(Get32(buf[b:])) + b += 4 + + v.WaitType = Get32(buf[b:]) + b += 4 + + v.WaitValue = SyncInt64{} + b += ReadSyncInt64(buf[b:], &v.WaitValue) + + v.TestType = Get32(buf[b:]) + b += 4 + + return b +} + +// Struct list read SyncTrigger +func ReadSyncTriggerList(buf []byte, dest []SyncTrigger) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = SyncTrigger{} + b += ReadSyncTrigger(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write SyncTrigger +func (v SyncTrigger) Bytes() []byte { + buf := make([]byte, 20) + b := 0 + + Put32(buf[b:], uint32(v.Counter)) + b += 4 + + Put32(buf[b:], v.WaitType) + b += 4 + + { + structBytes := v.WaitValue.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + + Put32(buf[b:], v.TestType) + b += 4 + + return buf +} + +// Write struct list SyncTrigger +func SyncTriggerListBytes(buf []byte, list []SyncTrigger) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'SyncWaitcondition' struct definition +// Size: 28 +type SyncWaitcondition struct { + Trigger SyncTrigger + EventThreshold SyncInt64 +} + +// Struct read SyncWaitcondition +func ReadSyncWaitcondition(buf []byte, v *SyncWaitcondition) int { + b := 0 + + v.Trigger = SyncTrigger{} + b += ReadSyncTrigger(buf[b:], &v.Trigger) + + v.EventThreshold = SyncInt64{} + b += ReadSyncInt64(buf[b:], &v.EventThreshold) + + return b +} + +// Struct list read SyncWaitcondition +func ReadSyncWaitconditionList(buf []byte, dest []SyncWaitcondition) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = SyncWaitcondition{} + b += ReadSyncWaitcondition(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write SyncWaitcondition +func (v SyncWaitcondition) Bytes() []byte { + buf := make([]byte, 28) + b := 0 + + { + structBytes := v.Trigger.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + + { + structBytes := v.EventThreshold.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + + return buf +} + +// Write struct list SyncWaitcondition +func SyncWaitconditionListBytes(buf []byte, list []SyncWaitcondition) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// Event definition SyncCounterNotify (0) +// Size: 32 + +const SyncCounterNotify = 0 + +type SyncCounterNotifyEvent struct { + Sequence uint16 + Kind byte + Counter Id + WaitValue SyncInt64 + CounterValue SyncInt64 + Timestamp Timestamp + Count uint16 + Destroyed bool + // padding: 1 bytes +} + +// Event read SyncCounterNotify +func NewSyncCounterNotifyEvent(buf []byte) Event { + v := SyncCounterNotifyEvent{} + b := 1 // don't read event number + + v.Kind = buf[b] + b += 1 + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Counter = Id(Get32(buf[b:])) + b += 4 + + v.WaitValue = SyncInt64{} + b += ReadSyncInt64(buf[b:], &v.WaitValue) + + v.CounterValue = SyncInt64{} + b += ReadSyncInt64(buf[b:], &v.CounterValue) + + v.Timestamp = Timestamp(Get32(buf[b:])) + b += 4 + + v.Count = Get16(buf[b:]) + b += 2 + + if buf[b] == 1 { + v.Destroyed = true + } else { + v.Destroyed = false + } + b += 1 + + b += 1 // padding + + return v +} + +// Event write SyncCounterNotify +func (v SyncCounterNotifyEvent) Bytes() []byte { + buf := make([]byte, 32) + b := 0 + + // write event number + buf[b] = 0 + b += 1 + + buf[b] = v.Kind + b += 1 + + b += 2 // skip sequence number + + Put32(buf[b:], uint32(v.Counter)) + b += 4 + + { + structBytes := v.WaitValue.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + + { + structBytes := v.CounterValue.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + + Put32(buf[b:], uint32(v.Timestamp)) + b += 4 + + Put16(buf[b:], v.Count) + b += 2 + + if v.Destroyed { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + b += 1 // padding + + return buf +} + +func (v SyncCounterNotifyEvent) ImplementsEvent() {} + +func (v SyncCounterNotifyEvent) SequenceId() uint16 { + return v.Sequence +} + +func (v SyncCounterNotifyEvent) String() string { + fieldVals := make([]string, 0, 8) + fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) + fieldVals = append(fieldVals, sprintf("Kind: %d", v.Kind)) + fieldVals = append(fieldVals, sprintf("Counter: %d", v.Counter)) + fieldVals = append(fieldVals, sprintf("Timestamp: %d", v.Timestamp)) + fieldVals = append(fieldVals, sprintf("Count: %d", v.Count)) + fieldVals = append(fieldVals, sprintf("Destroyed: %t", v.Destroyed)) + return "SyncCounterNotify {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newEventFuncs[0] = NewSyncCounterNotifyEvent +} + +// Event definition SyncAlarmNotify (1) +// Size: 32 + +const SyncAlarmNotify = 1 + +type SyncAlarmNotifyEvent struct { + Sequence uint16 + Kind byte + Alarm Id + CounterValue SyncInt64 + AlarmValue SyncInt64 + Timestamp Timestamp + State byte + // padding: 3 bytes +} + +// Event read SyncAlarmNotify +func NewSyncAlarmNotifyEvent(buf []byte) Event { + v := SyncAlarmNotifyEvent{} + b := 1 // don't read event number + + v.Kind = buf[b] + b += 1 + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Alarm = Id(Get32(buf[b:])) + b += 4 + + v.CounterValue = SyncInt64{} + b += ReadSyncInt64(buf[b:], &v.CounterValue) + + v.AlarmValue = SyncInt64{} + b += ReadSyncInt64(buf[b:], &v.AlarmValue) + + v.Timestamp = Timestamp(Get32(buf[b:])) + b += 4 + + v.State = buf[b] + b += 1 + + b += 3 // padding + + return v +} + +// Event write SyncAlarmNotify +func (v SyncAlarmNotifyEvent) Bytes() []byte { + buf := make([]byte, 32) + b := 0 + + // write event number + buf[b] = 1 + b += 1 + + buf[b] = v.Kind + b += 1 + + b += 2 // skip sequence number + + Put32(buf[b:], uint32(v.Alarm)) + b += 4 + + { + structBytes := v.CounterValue.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + + { + structBytes := v.AlarmValue.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + + Put32(buf[b:], uint32(v.Timestamp)) + b += 4 + + buf[b] = v.State + b += 1 + + b += 3 // padding + + return buf +} + +func (v SyncAlarmNotifyEvent) ImplementsEvent() {} + +func (v SyncAlarmNotifyEvent) SequenceId() uint16 { + return v.Sequence +} + +func (v SyncAlarmNotifyEvent) String() string { + fieldVals := make([]string, 0, 7) + fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) + fieldVals = append(fieldVals, sprintf("Kind: %d", v.Kind)) + fieldVals = append(fieldVals, sprintf("Alarm: %d", v.Alarm)) + fieldVals = append(fieldVals, sprintf("Timestamp: %d", v.Timestamp)) + fieldVals = append(fieldVals, sprintf("State: %d", v.State)) + return "SyncAlarmNotify {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newEventFuncs[1] = NewSyncAlarmNotifyEvent +} + +// Error definition SyncCounter (0) +// Size: 32 + +const BadSyncCounter = 0 + +type SyncCounterError struct { + Sequence uint16 + NiceName string + BadCounter uint32 + MinorOpcode uint16 + MajorOpcode byte +} + +// Error read SyncCounter +func NewSyncCounterError(buf []byte) Error { + v := SyncCounterError{} + v.NiceName = "SyncCounter" + + b := 1 // skip error determinant + b += 1 // don't read error number + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.BadCounter = Get32(buf[b:]) + b += 4 + + v.MinorOpcode = Get16(buf[b:]) + b += 2 + + v.MajorOpcode = buf[b] + b += 1 + + return v +} + +func (err SyncCounterError) ImplementsError() {} + +func (err SyncCounterError) SequenceId() uint16 { + return err.Sequence +} + +func (err SyncCounterError) BadId() Id { + return 0 +} + +func (err SyncCounterError) Error() string { + fieldVals := make([]string, 0, 3) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) + fieldVals = append(fieldVals, sprintf("BadCounter: %d", err.BadCounter)) + fieldVals = append(fieldVals, sprintf("MinorOpcode: %d", err.MinorOpcode)) + fieldVals = append(fieldVals, sprintf("MajorOpcode: %d", err.MajorOpcode)) + return "BadSyncCounter {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newErrorFuncs[0] = NewSyncCounterError +} + +// Error definition SyncAlarm (1) +// Size: 32 + +const BadSyncAlarm = 1 + +type SyncAlarmError struct { + Sequence uint16 + NiceName string + BadAlarm uint32 + MinorOpcode uint16 + MajorOpcode byte +} + +// Error read SyncAlarm +func NewSyncAlarmError(buf []byte) Error { + v := SyncAlarmError{} + v.NiceName = "SyncAlarm" + + b := 1 // skip error determinant + b += 1 // don't read error number + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.BadAlarm = Get32(buf[b:]) + b += 4 + + v.MinorOpcode = Get16(buf[b:]) + b += 2 + + v.MajorOpcode = buf[b] + b += 1 + + return v +} + +func (err SyncAlarmError) ImplementsError() {} + +func (err SyncAlarmError) SequenceId() uint16 { + return err.Sequence +} + +func (err SyncAlarmError) BadId() Id { + return 0 +} + +func (err SyncAlarmError) Error() string { + fieldVals := make([]string, 0, 3) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) + fieldVals = append(fieldVals, sprintf("BadAlarm: %d", err.BadAlarm)) + fieldVals = append(fieldVals, sprintf("MinorOpcode: %d", err.MinorOpcode)) + fieldVals = append(fieldVals, sprintf("MajorOpcode: %d", err.MajorOpcode)) + return "BadSyncAlarm {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newErrorFuncs[1] = NewSyncAlarmError +} + +// Request SyncInitialize +// size: 8 +type SyncInitializeCookie struct { + *cookie +} + +func (c *Conn) SyncInitialize(DesiredMajorVersion byte, DesiredMinorVersion byte) SyncInitializeCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.syncInitializeRequest(DesiredMajorVersion, DesiredMinorVersion), cookie) + return SyncInitializeCookie{cookie} +} + +func (c *Conn) SyncInitializeUnchecked(DesiredMajorVersion byte, DesiredMinorVersion byte) SyncInitializeCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.syncInitializeRequest(DesiredMajorVersion, DesiredMinorVersion), cookie) + return SyncInitializeCookie{cookie} +} + +// Request reply for SyncInitialize +// size: 32 +type SyncInitializeReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + MajorVersion byte + MinorVersion byte + // padding: 22 bytes +} + +// Waits and reads reply data from request SyncInitialize +func (cook SyncInitializeCookie) Reply() (*SyncInitializeReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return syncInitializeReply(buf), nil +} + +// Read reply into structure from buffer for SyncInitialize +func syncInitializeReply(buf []byte) *SyncInitializeReply { + v := new(SyncInitializeReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.MajorVersion = buf[b] + b += 1 + + v.MinorVersion = buf[b] + b += 1 + + b += 22 // padding + + return v +} + +func (cook SyncInitializeCookie) Check() error { + return cook.check() +} + +// Write request to wire for SyncInitialize +func (c *Conn) syncInitializeRequest(DesiredMajorVersion byte, DesiredMinorVersion byte) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SYNC"] + b += 1 + + buf[b] = 0 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = DesiredMajorVersion + b += 1 + + buf[b] = DesiredMinorVersion + b += 1 + + return buf +} + +// Request SyncListSystemCounters +// size: 4 +type SyncListSystemCountersCookie struct { + *cookie +} + +func (c *Conn) SyncListSystemCounters() SyncListSystemCountersCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.syncListSystemCountersRequest(), cookie) + return SyncListSystemCountersCookie{cookie} +} + +func (c *Conn) SyncListSystemCountersUnchecked() SyncListSystemCountersCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.syncListSystemCountersRequest(), cookie) + return SyncListSystemCountersCookie{cookie} +} + +// Request reply for SyncListSystemCounters +// size: (32 + SyncSystemcounterListSize(Counters)) +type SyncListSystemCountersReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + CountersLen uint32 + // padding: 20 bytes + Counters []SyncSystemcounter // size: SyncSystemcounterListSize(Counters) +} + +// Waits and reads reply data from request SyncListSystemCounters +func (cook SyncListSystemCountersCookie) Reply() (*SyncListSystemCountersReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return syncListSystemCountersReply(buf), nil +} + +// Read reply into structure from buffer for SyncListSystemCounters +func syncListSystemCountersReply(buf []byte) *SyncListSystemCountersReply { + v := new(SyncListSystemCountersReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.CountersLen = Get32(buf[b:]) + b += 4 + + b += 20 // padding + + v.Counters = make([]SyncSystemcounter, v.CountersLen) + b += ReadSyncSystemcounterList(buf[b:], v.Counters) + + return v +} + +func (cook SyncListSystemCountersCookie) Check() error { + return cook.check() +} + +// Write request to wire for SyncListSystemCounters +func (c *Conn) syncListSystemCountersRequest() []byte { + size := 4 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SYNC"] + b += 1 + + buf[b] = 1 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + return buf +} + +// Request SyncCreateCounter +// size: 16 +type SyncCreateCounterCookie struct { + *cookie +} + +// Write request to wire for SyncCreateCounter +func (c *Conn) SyncCreateCounter(Id Id, InitialValue SyncInt64) SyncCreateCounterCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.syncCreateCounterRequest(Id, InitialValue), cookie) + return SyncCreateCounterCookie{cookie} +} + +func (c *Conn) SyncCreateCounterChecked(Id Id, InitialValue SyncInt64) SyncCreateCounterCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.syncCreateCounterRequest(Id, InitialValue), cookie) + return SyncCreateCounterCookie{cookie} +} + +func (cook SyncCreateCounterCookie) Check() error { + return cook.check() +} + +// Write request to wire for SyncCreateCounter +func (c *Conn) syncCreateCounterRequest(Id Id, InitialValue SyncInt64) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SYNC"] + b += 1 + + buf[b] = 2 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Id)) + b += 4 + + { + structBytes := InitialValue.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + + return buf +} + +// Request SyncDestroyCounter +// size: 8 +type SyncDestroyCounterCookie struct { + *cookie +} + +// Write request to wire for SyncDestroyCounter +func (c *Conn) SyncDestroyCounter(Counter Id) SyncDestroyCounterCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.syncDestroyCounterRequest(Counter), cookie) + return SyncDestroyCounterCookie{cookie} +} + +func (c *Conn) SyncDestroyCounterChecked(Counter Id) SyncDestroyCounterCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.syncDestroyCounterRequest(Counter), cookie) + return SyncDestroyCounterCookie{cookie} +} + +func (cook SyncDestroyCounterCookie) Check() error { + return cook.check() +} + +// Write request to wire for SyncDestroyCounter +func (c *Conn) syncDestroyCounterRequest(Counter Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SYNC"] + b += 1 + + buf[b] = 6 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Counter)) + b += 4 + + return buf +} + +// Request SyncQueryCounter +// size: 8 +type SyncQueryCounterCookie struct { + *cookie +} + +func (c *Conn) SyncQueryCounter(Counter Id) SyncQueryCounterCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.syncQueryCounterRequest(Counter), cookie) + return SyncQueryCounterCookie{cookie} +} + +func (c *Conn) SyncQueryCounterUnchecked(Counter Id) SyncQueryCounterCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.syncQueryCounterRequest(Counter), cookie) + return SyncQueryCounterCookie{cookie} +} + +// Request reply for SyncQueryCounter +// size: 16 +type SyncQueryCounterReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + CounterValue SyncInt64 +} + +// Waits and reads reply data from request SyncQueryCounter +func (cook SyncQueryCounterCookie) Reply() (*SyncQueryCounterReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return syncQueryCounterReply(buf), nil +} + +// Read reply into structure from buffer for SyncQueryCounter +func syncQueryCounterReply(buf []byte) *SyncQueryCounterReply { + v := new(SyncQueryCounterReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.CounterValue = SyncInt64{} + b += ReadSyncInt64(buf[b:], &v.CounterValue) + + return v +} + +func (cook SyncQueryCounterCookie) Check() error { + return cook.check() +} + +// Write request to wire for SyncQueryCounter +func (c *Conn) syncQueryCounterRequest(Counter Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SYNC"] + b += 1 + + buf[b] = 5 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Counter)) + b += 4 + + return buf +} + +// Request SyncAwait +// size: pad((4 + pad((len(WaitList) * 28)))) +type SyncAwaitCookie struct { + *cookie +} + +// Write request to wire for SyncAwait +func (c *Conn) SyncAwait(WaitList []SyncWaitcondition) SyncAwaitCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.syncAwaitRequest(WaitList), cookie) + return SyncAwaitCookie{cookie} +} + +func (c *Conn) SyncAwaitChecked(WaitList []SyncWaitcondition) SyncAwaitCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.syncAwaitRequest(WaitList), cookie) + return SyncAwaitCookie{cookie} +} + +func (cook SyncAwaitCookie) Check() error { + return cook.check() +} + +// Write request to wire for SyncAwait +func (c *Conn) syncAwaitRequest(WaitList []SyncWaitcondition) []byte { + size := pad((4 + pad((len(WaitList) * 28)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SYNC"] + b += 1 + + buf[b] = 7 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + b += SyncWaitconditionListBytes(buf[b:], WaitList) + + return buf +} + +// Request SyncChangeCounter +// size: 16 +type SyncChangeCounterCookie struct { + *cookie +} + +// Write request to wire for SyncChangeCounter +func (c *Conn) SyncChangeCounter(Counter Id, Amount SyncInt64) SyncChangeCounterCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.syncChangeCounterRequest(Counter, Amount), cookie) + return SyncChangeCounterCookie{cookie} +} + +func (c *Conn) SyncChangeCounterChecked(Counter Id, Amount SyncInt64) SyncChangeCounterCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.syncChangeCounterRequest(Counter, Amount), cookie) + return SyncChangeCounterCookie{cookie} +} + +func (cook SyncChangeCounterCookie) Check() error { + return cook.check() +} + +// Write request to wire for SyncChangeCounter +func (c *Conn) syncChangeCounterRequest(Counter Id, Amount SyncInt64) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SYNC"] + b += 1 + + buf[b] = 4 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Counter)) + b += 4 + + { + structBytes := Amount.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + + return buf +} + +// Request SyncSetCounter +// size: 16 +type SyncSetCounterCookie struct { + *cookie +} + +// Write request to wire for SyncSetCounter +func (c *Conn) SyncSetCounter(Counter Id, Value SyncInt64) SyncSetCounterCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.syncSetCounterRequest(Counter, Value), cookie) + return SyncSetCounterCookie{cookie} +} + +func (c *Conn) SyncSetCounterChecked(Counter Id, Value SyncInt64) SyncSetCounterCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.syncSetCounterRequest(Counter, Value), cookie) + return SyncSetCounterCookie{cookie} +} + +func (cook SyncSetCounterCookie) Check() error { + return cook.check() +} + +// Write request to wire for SyncSetCounter +func (c *Conn) syncSetCounterRequest(Counter Id, Value SyncInt64) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SYNC"] + b += 1 + + buf[b] = 3 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Counter)) + b += 4 + + { + structBytes := Value.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + + return buf +} + +// Request SyncCreateAlarm +// size: pad((8 + (4 + pad((4 * popCount(int(ValueMask))))))) +type SyncCreateAlarmCookie struct { + *cookie +} + +// Write request to wire for SyncCreateAlarm +func (c *Conn) SyncCreateAlarm(Id Id, ValueMask uint32, ValueList []uint32) SyncCreateAlarmCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.syncCreateAlarmRequest(Id, ValueMask, ValueList), cookie) + return SyncCreateAlarmCookie{cookie} +} + +func (c *Conn) SyncCreateAlarmChecked(Id Id, ValueMask uint32, ValueList []uint32) SyncCreateAlarmCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.syncCreateAlarmRequest(Id, ValueMask, ValueList), cookie) + return SyncCreateAlarmCookie{cookie} +} + +func (cook SyncCreateAlarmCookie) Check() error { + return cook.check() +} + +// Write request to wire for SyncCreateAlarm +func (c *Conn) syncCreateAlarmRequest(Id Id, ValueMask uint32, ValueList []uint32) []byte { + size := pad((8 + (4 + pad((4 * popCount(int(ValueMask))))))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SYNC"] + b += 1 + + buf[b] = 8 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Id)) + b += 4 + + Put32(buf[b:], ValueMask) + b += 4 + for i := 0; i < popCount(int(ValueMask)); i++ { + Put32(buf[b:], ValueList[i]) + b += 4 + } + b = pad(b) + + return buf +} + +// Request SyncChangeAlarm +// size: pad((8 + (4 + pad((4 * popCount(int(ValueMask))))))) +type SyncChangeAlarmCookie struct { + *cookie +} + +// Write request to wire for SyncChangeAlarm +func (c *Conn) SyncChangeAlarm(Id Id, ValueMask uint32, ValueList []uint32) SyncChangeAlarmCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.syncChangeAlarmRequest(Id, ValueMask, ValueList), cookie) + return SyncChangeAlarmCookie{cookie} +} + +func (c *Conn) SyncChangeAlarmChecked(Id Id, ValueMask uint32, ValueList []uint32) SyncChangeAlarmCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.syncChangeAlarmRequest(Id, ValueMask, ValueList), cookie) + return SyncChangeAlarmCookie{cookie} +} + +func (cook SyncChangeAlarmCookie) Check() error { + return cook.check() +} + +// Write request to wire for SyncChangeAlarm +func (c *Conn) syncChangeAlarmRequest(Id Id, ValueMask uint32, ValueList []uint32) []byte { + size := pad((8 + (4 + pad((4 * popCount(int(ValueMask))))))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SYNC"] + b += 1 + + buf[b] = 9 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Id)) + b += 4 + + Put32(buf[b:], ValueMask) + b += 4 + for i := 0; i < popCount(int(ValueMask)); i++ { + Put32(buf[b:], ValueList[i]) + b += 4 + } + b = pad(b) + + return buf +} + +// Request SyncDestroyAlarm +// size: 8 +type SyncDestroyAlarmCookie struct { + *cookie +} + +// Write request to wire for SyncDestroyAlarm +func (c *Conn) SyncDestroyAlarm(Alarm Id) SyncDestroyAlarmCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.syncDestroyAlarmRequest(Alarm), cookie) + return SyncDestroyAlarmCookie{cookie} +} + +func (c *Conn) SyncDestroyAlarmChecked(Alarm Id) SyncDestroyAlarmCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.syncDestroyAlarmRequest(Alarm), cookie) + return SyncDestroyAlarmCookie{cookie} +} + +func (cook SyncDestroyAlarmCookie) Check() error { + return cook.check() +} + +// Write request to wire for SyncDestroyAlarm +func (c *Conn) syncDestroyAlarmRequest(Alarm Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SYNC"] + b += 1 + + buf[b] = 11 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Alarm)) + b += 4 + + return buf +} + +// Request SyncQueryAlarm +// size: 8 +type SyncQueryAlarmCookie struct { + *cookie +} + +func (c *Conn) SyncQueryAlarm(Alarm Id) SyncQueryAlarmCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.syncQueryAlarmRequest(Alarm), cookie) + return SyncQueryAlarmCookie{cookie} +} + +func (c *Conn) SyncQueryAlarmUnchecked(Alarm Id) SyncQueryAlarmCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.syncQueryAlarmRequest(Alarm), cookie) + return SyncQueryAlarmCookie{cookie} +} + +// Request reply for SyncQueryAlarm +// size: 40 +type SyncQueryAlarmReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Trigger SyncTrigger + Delta SyncInt64 + Events bool + State byte + // padding: 2 bytes +} + +// Waits and reads reply data from request SyncQueryAlarm +func (cook SyncQueryAlarmCookie) Reply() (*SyncQueryAlarmReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return syncQueryAlarmReply(buf), nil +} + +// Read reply into structure from buffer for SyncQueryAlarm +func syncQueryAlarmReply(buf []byte) *SyncQueryAlarmReply { + v := new(SyncQueryAlarmReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.Trigger = SyncTrigger{} + b += ReadSyncTrigger(buf[b:], &v.Trigger) + + v.Delta = SyncInt64{} + b += ReadSyncInt64(buf[b:], &v.Delta) + + if buf[b] == 1 { + v.Events = true + } else { + v.Events = false + } + b += 1 + + v.State = buf[b] + b += 1 + + b += 2 // padding + + return v +} + +func (cook SyncQueryAlarmCookie) Check() error { + return cook.check() +} + +// Write request to wire for SyncQueryAlarm +func (c *Conn) syncQueryAlarmRequest(Alarm Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SYNC"] + b += 1 + + buf[b] = 10 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Alarm)) + b += 4 + + return buf +} + +// Request SyncSetPriority +// size: 12 +type SyncSetPriorityCookie struct { + *cookie +} + +// Write request to wire for SyncSetPriority +func (c *Conn) SyncSetPriority(Id uint32, Priority int32) SyncSetPriorityCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.syncSetPriorityRequest(Id, Priority), cookie) + return SyncSetPriorityCookie{cookie} +} + +func (c *Conn) SyncSetPriorityChecked(Id uint32, Priority int32) SyncSetPriorityCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.syncSetPriorityRequest(Id, Priority), cookie) + return SyncSetPriorityCookie{cookie} +} + +func (cook SyncSetPriorityCookie) Check() error { + return cook.check() +} + +// Write request to wire for SyncSetPriority +func (c *Conn) syncSetPriorityRequest(Id uint32, Priority int32) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SYNC"] + b += 1 + + buf[b] = 12 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], Id) + b += 4 + + Put32(buf[b:], uint32(Priority)) + b += 4 + + return buf +} + +// Request SyncGetPriority +// size: 8 +type SyncGetPriorityCookie struct { + *cookie +} + +func (c *Conn) SyncGetPriority(Id uint32) SyncGetPriorityCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.syncGetPriorityRequest(Id), cookie) + return SyncGetPriorityCookie{cookie} +} + +func (c *Conn) SyncGetPriorityUnchecked(Id uint32) SyncGetPriorityCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.syncGetPriorityRequest(Id), cookie) + return SyncGetPriorityCookie{cookie} +} + +// Request reply for SyncGetPriority +// size: 12 +type SyncGetPriorityReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Priority int32 +} + +// Waits and reads reply data from request SyncGetPriority +func (cook SyncGetPriorityCookie) Reply() (*SyncGetPriorityReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return syncGetPriorityReply(buf), nil +} + +// Read reply into structure from buffer for SyncGetPriority +func syncGetPriorityReply(buf []byte) *SyncGetPriorityReply { + v := new(SyncGetPriorityReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.Priority = int32(Get32(buf[b:])) + b += 4 + + return v +} + +func (cook SyncGetPriorityCookie) Check() error { + return cook.check() +} + +// Write request to wire for SyncGetPriority +func (c *Conn) syncGetPriorityRequest(Id uint32) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SYNC"] + b += 1 + + buf[b] = 13 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], Id) + b += 4 + + return buf +} + +// Request SyncCreateFence +// size: 16 +type SyncCreateFenceCookie struct { + *cookie +} + +// Write request to wire for SyncCreateFence +func (c *Conn) SyncCreateFence(Drawable Id, Fence Id, InitiallyTriggered bool) SyncCreateFenceCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.syncCreateFenceRequest(Drawable, Fence, InitiallyTriggered), cookie) + return SyncCreateFenceCookie{cookie} +} + +func (c *Conn) SyncCreateFenceChecked(Drawable Id, Fence Id, InitiallyTriggered bool) SyncCreateFenceCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.syncCreateFenceRequest(Drawable, Fence, InitiallyTriggered), cookie) + return SyncCreateFenceCookie{cookie} +} + +func (cook SyncCreateFenceCookie) Check() error { + return cook.check() +} + +// Write request to wire for SyncCreateFence +func (c *Conn) syncCreateFenceRequest(Drawable Id, Fence Id, InitiallyTriggered bool) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SYNC"] + b += 1 + + buf[b] = 14 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Drawable)) + b += 4 + + Put32(buf[b:], uint32(Fence)) + b += 4 + + if InitiallyTriggered { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + return buf +} + +// Request SyncTriggerFence +// size: 8 +type SyncTriggerFenceCookie struct { + *cookie +} + +// Write request to wire for SyncTriggerFence +func (c *Conn) SyncTriggerFence(Fence Id) SyncTriggerFenceCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.syncTriggerFenceRequest(Fence), cookie) + return SyncTriggerFenceCookie{cookie} +} + +func (c *Conn) SyncTriggerFenceChecked(Fence Id) SyncTriggerFenceCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.syncTriggerFenceRequest(Fence), cookie) + return SyncTriggerFenceCookie{cookie} +} + +func (cook SyncTriggerFenceCookie) Check() error { + return cook.check() +} + +// Write request to wire for SyncTriggerFence +func (c *Conn) syncTriggerFenceRequest(Fence Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SYNC"] + b += 1 + + buf[b] = 15 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Fence)) + b += 4 + + return buf +} + +// Request SyncResetFence +// size: 8 +type SyncResetFenceCookie struct { + *cookie +} + +// Write request to wire for SyncResetFence +func (c *Conn) SyncResetFence(Fence Id) SyncResetFenceCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.syncResetFenceRequest(Fence), cookie) + return SyncResetFenceCookie{cookie} +} + +func (c *Conn) SyncResetFenceChecked(Fence Id) SyncResetFenceCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.syncResetFenceRequest(Fence), cookie) + return SyncResetFenceCookie{cookie} +} + +func (cook SyncResetFenceCookie) Check() error { + return cook.check() +} + +// Write request to wire for SyncResetFence +func (c *Conn) syncResetFenceRequest(Fence Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SYNC"] + b += 1 + + buf[b] = 16 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Fence)) + b += 4 + + return buf +} + +// Request SyncDestroyFence +// size: 8 +type SyncDestroyFenceCookie struct { + *cookie +} + +// Write request to wire for SyncDestroyFence +func (c *Conn) SyncDestroyFence(Fence Id) SyncDestroyFenceCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.syncDestroyFenceRequest(Fence), cookie) + return SyncDestroyFenceCookie{cookie} +} + +func (c *Conn) SyncDestroyFenceChecked(Fence Id) SyncDestroyFenceCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.syncDestroyFenceRequest(Fence), cookie) + return SyncDestroyFenceCookie{cookie} +} + +func (cook SyncDestroyFenceCookie) Check() error { + return cook.check() +} + +// Write request to wire for SyncDestroyFence +func (c *Conn) syncDestroyFenceRequest(Fence Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SYNC"] + b += 1 + + buf[b] = 17 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Fence)) + b += 4 + + return buf +} + +// Request SyncQueryFence +// size: 8 +type SyncQueryFenceCookie struct { + *cookie +} + +func (c *Conn) SyncQueryFence(Fence Id) SyncQueryFenceCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.syncQueryFenceRequest(Fence), cookie) + return SyncQueryFenceCookie{cookie} +} + +func (c *Conn) SyncQueryFenceUnchecked(Fence Id) SyncQueryFenceCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.syncQueryFenceRequest(Fence), cookie) + return SyncQueryFenceCookie{cookie} +} + +// Request reply for SyncQueryFence +// size: 32 +type SyncQueryFenceReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Triggered bool + // padding: 23 bytes +} + +// Waits and reads reply data from request SyncQueryFence +func (cook SyncQueryFenceCookie) Reply() (*SyncQueryFenceReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return syncQueryFenceReply(buf), nil +} + +// Read reply into structure from buffer for SyncQueryFence +func syncQueryFenceReply(buf []byte) *SyncQueryFenceReply { + v := new(SyncQueryFenceReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + if buf[b] == 1 { + v.Triggered = true + } else { + v.Triggered = false + } + b += 1 + + b += 23 // padding + + return v +} + +func (cook SyncQueryFenceCookie) Check() error { + return cook.check() +} + +// Write request to wire for SyncQueryFence +func (c *Conn) syncQueryFenceRequest(Fence Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SYNC"] + b += 1 + + buf[b] = 18 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Fence)) + b += 4 + + return buf +} + +// Request SyncAwaitFence +// size: pad((4 + pad((len(FenceList) * 4)))) +type SyncAwaitFenceCookie struct { + *cookie +} + +// Write request to wire for SyncAwaitFence +func (c *Conn) SyncAwaitFence(FenceList []Id) SyncAwaitFenceCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.syncAwaitFenceRequest(FenceList), cookie) + return SyncAwaitFenceCookie{cookie} +} + +func (c *Conn) SyncAwaitFenceChecked(FenceList []Id) SyncAwaitFenceCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.syncAwaitFenceRequest(FenceList), cookie) + return SyncAwaitFenceCookie{cookie} +} + +func (cook SyncAwaitFenceCookie) Check() error { + return cook.check() +} + +// Write request to wire for SyncAwaitFence +func (c *Conn) syncAwaitFenceRequest(FenceList []Id) []byte { + size := pad((4 + pad((len(FenceList) * 4)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SYNC"] + b += 1 + + buf[b] = 19 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + for i := 0; i < int(len(FenceList)); i++ { + Put32(buf[b:], uint32(FenceList[i])) + b += 4 + } + b = pad(b) + + return buf +} diff --git a/nexgb/auto_xc_misc.go b/nexgb/auto_xc_misc.go new file mode 100644 index 0000000..48a5d1e --- /dev/null +++ b/nexgb/auto_xc_misc.go @@ -0,0 +1,300 @@ +package xgb + +/* + This file was generated by xc_misc.xml on May 6 2012 3:00:44am EDT. + This file is automatically generated. Edit at your peril! +*/ + +// Skipping definition for base type 'Float' + +// Skipping definition for base type 'Id' + +// Skipping definition for base type 'Card8' + +// Skipping definition for base type 'Int16' + +// Skipping definition for base type 'Int32' + +// Skipping definition for base type 'Void' + +// Skipping definition for base type 'Byte' + +// Skipping definition for base type 'Int8' + +// Skipping definition for base type 'Card16' + +// Skipping definition for base type 'Char' + +// Skipping definition for base type 'Card32' + +// Skipping definition for base type 'Double' + +// Skipping definition for base type 'Bool' + +// Request Xc_miscGetVersion +// size: 8 +type Xc_miscGetVersionCookie struct { + *cookie +} + +func (c *Conn) Xc_miscGetVersion(ClientMajorVersion uint16, ClientMinorVersion uint16) Xc_miscGetVersionCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xc_miscGetVersionRequest(ClientMajorVersion, ClientMinorVersion), cookie) + return Xc_miscGetVersionCookie{cookie} +} + +func (c *Conn) Xc_miscGetVersionUnchecked(ClientMajorVersion uint16, ClientMinorVersion uint16) Xc_miscGetVersionCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xc_miscGetVersionRequest(ClientMajorVersion, ClientMinorVersion), cookie) + return Xc_miscGetVersionCookie{cookie} +} + +// Request reply for Xc_miscGetVersion +// size: 12 +type Xc_miscGetVersionReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + ServerMajorVersion uint16 + ServerMinorVersion uint16 +} + +// Waits and reads reply data from request Xc_miscGetVersion +func (cook Xc_miscGetVersionCookie) Reply() (*Xc_miscGetVersionReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xc_miscGetVersionReply(buf), nil +} + +// Read reply into structure from buffer for Xc_miscGetVersion +func xc_miscGetVersionReply(buf []byte) *Xc_miscGetVersionReply { + v := new(Xc_miscGetVersionReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.ServerMajorVersion = Get16(buf[b:]) + b += 2 + + v.ServerMinorVersion = Get16(buf[b:]) + b += 2 + + return v +} + +func (cook Xc_miscGetVersionCookie) Check() error { + return cook.check() +} + +// Write request to wire for Xc_miscGetVersion +func (c *Conn) xc_miscGetVersionRequest(ClientMajorVersion uint16, ClientMinorVersion uint16) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XC-MISC"] + b += 1 + + buf[b] = 0 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put16(buf[b:], ClientMajorVersion) + b += 2 + + Put16(buf[b:], ClientMinorVersion) + b += 2 + + return buf +} + +// Request Xc_miscGetXIDRange +// size: 4 +type Xc_miscGetXIDRangeCookie struct { + *cookie +} + +func (c *Conn) Xc_miscGetXIDRange() Xc_miscGetXIDRangeCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xc_miscGetXIDRangeRequest(), cookie) + return Xc_miscGetXIDRangeCookie{cookie} +} + +func (c *Conn) Xc_miscGetXIDRangeUnchecked() Xc_miscGetXIDRangeCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xc_miscGetXIDRangeRequest(), cookie) + return Xc_miscGetXIDRangeCookie{cookie} +} + +// Request reply for Xc_miscGetXIDRange +// size: 16 +type Xc_miscGetXIDRangeReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + StartId uint32 + Count uint32 +} + +// Waits and reads reply data from request Xc_miscGetXIDRange +func (cook Xc_miscGetXIDRangeCookie) Reply() (*Xc_miscGetXIDRangeReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xc_miscGetXIDRangeReply(buf), nil +} + +// Read reply into structure from buffer for Xc_miscGetXIDRange +func xc_miscGetXIDRangeReply(buf []byte) *Xc_miscGetXIDRangeReply { + v := new(Xc_miscGetXIDRangeReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.StartId = Get32(buf[b:]) + b += 4 + + v.Count = Get32(buf[b:]) + b += 4 + + return v +} + +func (cook Xc_miscGetXIDRangeCookie) Check() error { + return cook.check() +} + +// Write request to wire for Xc_miscGetXIDRange +func (c *Conn) xc_miscGetXIDRangeRequest() []byte { + size := 4 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XC-MISC"] + b += 1 + + buf[b] = 1 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + return buf +} + +// Request Xc_miscGetXIDList +// size: 8 +type Xc_miscGetXIDListCookie struct { + *cookie +} + +func (c *Conn) Xc_miscGetXIDList(Count uint32) Xc_miscGetXIDListCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xc_miscGetXIDListRequest(Count), cookie) + return Xc_miscGetXIDListCookie{cookie} +} + +func (c *Conn) Xc_miscGetXIDListUnchecked(Count uint32) Xc_miscGetXIDListCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xc_miscGetXIDListRequest(Count), cookie) + return Xc_miscGetXIDListCookie{cookie} +} + +// Request reply for Xc_miscGetXIDList +// size: (32 + pad((int(IdsLen) * 4))) +type Xc_miscGetXIDListReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + IdsLen uint32 + // padding: 20 bytes + Ids []uint32 // size: pad((int(IdsLen) * 4)) +} + +// Waits and reads reply data from request Xc_miscGetXIDList +func (cook Xc_miscGetXIDListCookie) Reply() (*Xc_miscGetXIDListReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xc_miscGetXIDListReply(buf), nil +} + +// Read reply into structure from buffer for Xc_miscGetXIDList +func xc_miscGetXIDListReply(buf []byte) *Xc_miscGetXIDListReply { + v := new(Xc_miscGetXIDListReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.IdsLen = Get32(buf[b:]) + b += 4 + + b += 20 // padding + + v.Ids = make([]uint32, v.IdsLen) + for i := 0; i < int(v.IdsLen); i++ { + v.Ids[i] = Get32(buf[b:]) + b += 4 + } + b = pad(b) + + return v +} + +func (cook Xc_miscGetXIDListCookie) Check() error { + return cook.check() +} + +// Write request to wire for Xc_miscGetXIDList +func (c *Conn) xc_miscGetXIDListRequest(Count uint32) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XC-MISC"] + b += 1 + + buf[b] = 2 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], Count) + b += 4 + + return buf +} diff --git a/nexgb/auto_xevie.go b/nexgb/auto_xevie.go new file mode 100644 index 0000000..fbc1d92 --- /dev/null +++ b/nexgb/auto_xevie.go @@ -0,0 +1,513 @@ +package xgb + +/* + This file was generated by xevie.xml on May 6 2012 3:00:44am EDT. + This file is automatically generated. Edit at your peril! +*/ + +// Skipping definition for base type 'Id' + +// Skipping definition for base type 'Card8' + +// Skipping definition for base type 'Int16' + +// Skipping definition for base type 'Int32' + +// Skipping definition for base type 'Void' + +// Skipping definition for base type 'Byte' + +// Skipping definition for base type 'Int8' + +// Skipping definition for base type 'Card16' + +// Skipping definition for base type 'Char' + +// Skipping definition for base type 'Card32' + +// Skipping definition for base type 'Double' + +// Skipping definition for base type 'Bool' + +// Skipping definition for base type 'Float' + +const ( + XevieDatatypeUnmodified = 0 + XevieDatatypeModified = 1 +) + +// 'XevieEvent' struct definition +// Size: 32 +type XevieEvent struct { + // padding: 32 bytes +} + +// Struct read XevieEvent +func ReadXevieEvent(buf []byte, v *XevieEvent) int { + b := 0 + + b += 32 // padding + + return b +} + +// Struct list read XevieEvent +func ReadXevieEventList(buf []byte, dest []XevieEvent) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XevieEvent{} + b += ReadXevieEvent(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XevieEvent +func (v XevieEvent) Bytes() []byte { + buf := make([]byte, 32) + b := 0 + + b += 32 // padding + + return buf +} + +// Write struct list XevieEvent +func XevieEventListBytes(buf []byte, list []XevieEvent) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// Request XevieQueryVersion +// size: 8 +type XevieQueryVersionCookie struct { + *cookie +} + +func (c *Conn) XevieQueryVersion(ClientMajorVersion uint16, ClientMinorVersion uint16) XevieQueryVersionCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xevieQueryVersionRequest(ClientMajorVersion, ClientMinorVersion), cookie) + return XevieQueryVersionCookie{cookie} +} + +func (c *Conn) XevieQueryVersionUnchecked(ClientMajorVersion uint16, ClientMinorVersion uint16) XevieQueryVersionCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xevieQueryVersionRequest(ClientMajorVersion, ClientMinorVersion), cookie) + return XevieQueryVersionCookie{cookie} +} + +// Request reply for XevieQueryVersion +// size: 32 +type XevieQueryVersionReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + ServerMajorVersion uint16 + ServerMinorVersion uint16 + // padding: 20 bytes +} + +// Waits and reads reply data from request XevieQueryVersion +func (cook XevieQueryVersionCookie) Reply() (*XevieQueryVersionReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xevieQueryVersionReply(buf), nil +} + +// Read reply into structure from buffer for XevieQueryVersion +func xevieQueryVersionReply(buf []byte) *XevieQueryVersionReply { + v := new(XevieQueryVersionReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.ServerMajorVersion = Get16(buf[b:]) + b += 2 + + v.ServerMinorVersion = Get16(buf[b:]) + b += 2 + + b += 20 // padding + + return v +} + +func (cook XevieQueryVersionCookie) Check() error { + return cook.check() +} + +// Write request to wire for XevieQueryVersion +func (c *Conn) xevieQueryVersionRequest(ClientMajorVersion uint16, ClientMinorVersion uint16) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XEVIE"] + b += 1 + + buf[b] = 0 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put16(buf[b:], ClientMajorVersion) + b += 2 + + Put16(buf[b:], ClientMinorVersion) + b += 2 + + return buf +} + +// Request XevieStart +// size: 8 +type XevieStartCookie struct { + *cookie +} + +func (c *Conn) XevieStart(Screen uint32) XevieStartCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xevieStartRequest(Screen), cookie) + return XevieStartCookie{cookie} +} + +func (c *Conn) XevieStartUnchecked(Screen uint32) XevieStartCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xevieStartRequest(Screen), cookie) + return XevieStartCookie{cookie} +} + +// Request reply for XevieStart +// size: 32 +type XevieStartReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 24 bytes +} + +// Waits and reads reply data from request XevieStart +func (cook XevieStartCookie) Reply() (*XevieStartReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xevieStartReply(buf), nil +} + +// Read reply into structure from buffer for XevieStart +func xevieStartReply(buf []byte) *XevieStartReply { + v := new(XevieStartReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 24 // padding + + return v +} + +func (cook XevieStartCookie) Check() error { + return cook.check() +} + +// Write request to wire for XevieStart +func (c *Conn) xevieStartRequest(Screen uint32) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XEVIE"] + b += 1 + + buf[b] = 1 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], Screen) + b += 4 + + return buf +} + +// Request XevieEnd +// size: 8 +type XevieEndCookie struct { + *cookie +} + +func (c *Conn) XevieEnd(Cmap uint32) XevieEndCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xevieEndRequest(Cmap), cookie) + return XevieEndCookie{cookie} +} + +func (c *Conn) XevieEndUnchecked(Cmap uint32) XevieEndCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xevieEndRequest(Cmap), cookie) + return XevieEndCookie{cookie} +} + +// Request reply for XevieEnd +// size: 32 +type XevieEndReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 24 bytes +} + +// Waits and reads reply data from request XevieEnd +func (cook XevieEndCookie) Reply() (*XevieEndReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xevieEndReply(buf), nil +} + +// Read reply into structure from buffer for XevieEnd +func xevieEndReply(buf []byte) *XevieEndReply { + v := new(XevieEndReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 24 // padding + + return v +} + +func (cook XevieEndCookie) Check() error { + return cook.check() +} + +// Write request to wire for XevieEnd +func (c *Conn) xevieEndRequest(Cmap uint32) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XEVIE"] + b += 1 + + buf[b] = 2 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], Cmap) + b += 4 + + return buf +} + +// Request XevieSend +// size: 104 +type XevieSendCookie struct { + *cookie +} + +func (c *Conn) XevieSend(Event XevieEvent, DataType uint32) XevieSendCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xevieSendRequest(Event, DataType), cookie) + return XevieSendCookie{cookie} +} + +func (c *Conn) XevieSendUnchecked(Event XevieEvent, DataType uint32) XevieSendCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xevieSendRequest(Event, DataType), cookie) + return XevieSendCookie{cookie} +} + +// Request reply for XevieSend +// size: 32 +type XevieSendReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 24 bytes +} + +// Waits and reads reply data from request XevieSend +func (cook XevieSendCookie) Reply() (*XevieSendReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xevieSendReply(buf), nil +} + +// Read reply into structure from buffer for XevieSend +func xevieSendReply(buf []byte) *XevieSendReply { + v := new(XevieSendReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 24 // padding + + return v +} + +func (cook XevieSendCookie) Check() error { + return cook.check() +} + +// Write request to wire for XevieSend +func (c *Conn) xevieSendRequest(Event XevieEvent, DataType uint32) []byte { + size := 104 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XEVIE"] + b += 1 + + buf[b] = 3 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + { + structBytes := Event.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + + Put32(buf[b:], DataType) + b += 4 + + b += 64 // padding + + return buf +} + +// Request XevieSelectInput +// size: 8 +type XevieSelectInputCookie struct { + *cookie +} + +func (c *Conn) XevieSelectInput(EventMask uint32) XevieSelectInputCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xevieSelectInputRequest(EventMask), cookie) + return XevieSelectInputCookie{cookie} +} + +func (c *Conn) XevieSelectInputUnchecked(EventMask uint32) XevieSelectInputCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xevieSelectInputRequest(EventMask), cookie) + return XevieSelectInputCookie{cookie} +} + +// Request reply for XevieSelectInput +// size: 32 +type XevieSelectInputReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 24 bytes +} + +// Waits and reads reply data from request XevieSelectInput +func (cook XevieSelectInputCookie) Reply() (*XevieSelectInputReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xevieSelectInputReply(buf), nil +} + +// Read reply into structure from buffer for XevieSelectInput +func xevieSelectInputReply(buf []byte) *XevieSelectInputReply { + v := new(XevieSelectInputReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 24 // padding + + return v +} + +func (cook XevieSelectInputCookie) Check() error { + return cook.check() +} + +// Write request to wire for XevieSelectInput +func (c *Conn) xevieSelectInputRequest(EventMask uint32) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XEVIE"] + b += 1 + + buf[b] = 4 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], EventMask) + b += 4 + + return buf +} diff --git a/nexgb/auto_xf86dri.go b/nexgb/auto_xf86dri.go new file mode 100644 index 0000000..1dbe77c --- /dev/null +++ b/nexgb/auto_xf86dri.go @@ -0,0 +1,1125 @@ +package xgb + +/* + This file was generated by xf86dri.xml on May 6 2012 3:00:44am EDT. + This file is automatically generated. Edit at your peril! +*/ + +// Skipping definition for base type 'Int8' + +// Skipping definition for base type 'Card16' + +// Skipping definition for base type 'Char' + +// Skipping definition for base type 'Card32' + +// Skipping definition for base type 'Double' + +// Skipping definition for base type 'Bool' + +// Skipping definition for base type 'Float' + +// Skipping definition for base type 'Id' + +// Skipping definition for base type 'Card8' + +// Skipping definition for base type 'Int16' + +// Skipping definition for base type 'Int32' + +// Skipping definition for base type 'Void' + +// Skipping definition for base type 'Byte' + +// 'Xf86driDrmClipRect' struct definition +// Size: 8 +type Xf86driDrmClipRect struct { + X1 int16 + Y1 int16 + X2 int16 + X3 int16 +} + +// Struct read Xf86driDrmClipRect +func ReadXf86driDrmClipRect(buf []byte, v *Xf86driDrmClipRect) int { + b := 0 + + v.X1 = int16(Get16(buf[b:])) + b += 2 + + v.Y1 = int16(Get16(buf[b:])) + b += 2 + + v.X2 = int16(Get16(buf[b:])) + b += 2 + + v.X3 = int16(Get16(buf[b:])) + b += 2 + + return b +} + +// Struct list read Xf86driDrmClipRect +func ReadXf86driDrmClipRectList(buf []byte, dest []Xf86driDrmClipRect) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = Xf86driDrmClipRect{} + b += ReadXf86driDrmClipRect(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write Xf86driDrmClipRect +func (v Xf86driDrmClipRect) Bytes() []byte { + buf := make([]byte, 8) + b := 0 + + Put16(buf[b:], uint16(v.X1)) + b += 2 + + Put16(buf[b:], uint16(v.Y1)) + b += 2 + + Put16(buf[b:], uint16(v.X2)) + b += 2 + + Put16(buf[b:], uint16(v.X3)) + b += 2 + + return buf +} + +// Write struct list Xf86driDrmClipRect +func Xf86driDrmClipRectListBytes(buf []byte, list []Xf86driDrmClipRect) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// Request Xf86driQueryVersion +// size: 4 +type Xf86driQueryVersionCookie struct { + *cookie +} + +func (c *Conn) Xf86driQueryVersion() Xf86driQueryVersionCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xf86driQueryVersionRequest(), cookie) + return Xf86driQueryVersionCookie{cookie} +} + +func (c *Conn) Xf86driQueryVersionUnchecked() Xf86driQueryVersionCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xf86driQueryVersionRequest(), cookie) + return Xf86driQueryVersionCookie{cookie} +} + +// Request reply for Xf86driQueryVersion +// size: 16 +type Xf86driQueryVersionReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + DriMajorVersion uint16 + DriMinorVersion uint16 + DriMinorPatch uint32 +} + +// Waits and reads reply data from request Xf86driQueryVersion +func (cook Xf86driQueryVersionCookie) Reply() (*Xf86driQueryVersionReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xf86driQueryVersionReply(buf), nil +} + +// Read reply into structure from buffer for Xf86driQueryVersion +func xf86driQueryVersionReply(buf []byte) *Xf86driQueryVersionReply { + v := new(Xf86driQueryVersionReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.DriMajorVersion = Get16(buf[b:]) + b += 2 + + v.DriMinorVersion = Get16(buf[b:]) + b += 2 + + v.DriMinorPatch = Get32(buf[b:]) + b += 4 + + return v +} + +func (cook Xf86driQueryVersionCookie) Check() error { + return cook.check() +} + +// Write request to wire for Xf86driQueryVersion +func (c *Conn) xf86driQueryVersionRequest() []byte { + size := 4 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFREE86-DRI"] + b += 1 + + buf[b] = 0 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + return buf +} + +// Request Xf86driQueryDirectRenderingCapable +// size: 8 +type Xf86driQueryDirectRenderingCapableCookie struct { + *cookie +} + +func (c *Conn) Xf86driQueryDirectRenderingCapable(Screen uint32) Xf86driQueryDirectRenderingCapableCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xf86driQueryDirectRenderingCapableRequest(Screen), cookie) + return Xf86driQueryDirectRenderingCapableCookie{cookie} +} + +func (c *Conn) Xf86driQueryDirectRenderingCapableUnchecked(Screen uint32) Xf86driQueryDirectRenderingCapableCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xf86driQueryDirectRenderingCapableRequest(Screen), cookie) + return Xf86driQueryDirectRenderingCapableCookie{cookie} +} + +// Request reply for Xf86driQueryDirectRenderingCapable +// size: 9 +type Xf86driQueryDirectRenderingCapableReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + IsCapable bool +} + +// Waits and reads reply data from request Xf86driQueryDirectRenderingCapable +func (cook Xf86driQueryDirectRenderingCapableCookie) Reply() (*Xf86driQueryDirectRenderingCapableReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xf86driQueryDirectRenderingCapableReply(buf), nil +} + +// Read reply into structure from buffer for Xf86driQueryDirectRenderingCapable +func xf86driQueryDirectRenderingCapableReply(buf []byte) *Xf86driQueryDirectRenderingCapableReply { + v := new(Xf86driQueryDirectRenderingCapableReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + if buf[b] == 1 { + v.IsCapable = true + } else { + v.IsCapable = false + } + b += 1 + + return v +} + +func (cook Xf86driQueryDirectRenderingCapableCookie) Check() error { + return cook.check() +} + +// Write request to wire for Xf86driQueryDirectRenderingCapable +func (c *Conn) xf86driQueryDirectRenderingCapableRequest(Screen uint32) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFREE86-DRI"] + b += 1 + + buf[b] = 1 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], Screen) + b += 4 + + return buf +} + +// Request Xf86driOpenConnection +// size: 8 +type Xf86driOpenConnectionCookie struct { + *cookie +} + +func (c *Conn) Xf86driOpenConnection(Screen uint32) Xf86driOpenConnectionCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xf86driOpenConnectionRequest(Screen), cookie) + return Xf86driOpenConnectionCookie{cookie} +} + +func (c *Conn) Xf86driOpenConnectionUnchecked(Screen uint32) Xf86driOpenConnectionCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xf86driOpenConnectionRequest(Screen), cookie) + return Xf86driOpenConnectionCookie{cookie} +} + +// Request reply for Xf86driOpenConnection +// size: (32 + pad((int(BusIdLen) * 1))) +type Xf86driOpenConnectionReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + SareaHandleLow uint32 + SareaHandleHigh uint32 + BusIdLen uint32 + // padding: 12 bytes + BusId string // size: pad((int(BusIdLen) * 1)) +} + +// Waits and reads reply data from request Xf86driOpenConnection +func (cook Xf86driOpenConnectionCookie) Reply() (*Xf86driOpenConnectionReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xf86driOpenConnectionReply(buf), nil +} + +// Read reply into structure from buffer for Xf86driOpenConnection +func xf86driOpenConnectionReply(buf []byte) *Xf86driOpenConnectionReply { + v := new(Xf86driOpenConnectionReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.SareaHandleLow = Get32(buf[b:]) + b += 4 + + v.SareaHandleHigh = Get32(buf[b:]) + b += 4 + + v.BusIdLen = Get32(buf[b:]) + b += 4 + + b += 12 // padding + + { + byteString := make([]byte, v.BusIdLen) + copy(byteString[:v.BusIdLen], buf[b:]) + v.BusId = string(byteString) + b += pad(int(v.BusIdLen)) + } + + return v +} + +func (cook Xf86driOpenConnectionCookie) Check() error { + return cook.check() +} + +// Write request to wire for Xf86driOpenConnection +func (c *Conn) xf86driOpenConnectionRequest(Screen uint32) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFREE86-DRI"] + b += 1 + + buf[b] = 2 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], Screen) + b += 4 + + return buf +} + +// Request Xf86driCloseConnection +// size: 8 +type Xf86driCloseConnectionCookie struct { + *cookie +} + +// Write request to wire for Xf86driCloseConnection +func (c *Conn) Xf86driCloseConnection(Screen uint32) Xf86driCloseConnectionCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xf86driCloseConnectionRequest(Screen), cookie) + return Xf86driCloseConnectionCookie{cookie} +} + +func (c *Conn) Xf86driCloseConnectionChecked(Screen uint32) Xf86driCloseConnectionCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xf86driCloseConnectionRequest(Screen), cookie) + return Xf86driCloseConnectionCookie{cookie} +} + +func (cook Xf86driCloseConnectionCookie) Check() error { + return cook.check() +} + +// Write request to wire for Xf86driCloseConnection +func (c *Conn) xf86driCloseConnectionRequest(Screen uint32) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFREE86-DRI"] + b += 1 + + buf[b] = 3 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], Screen) + b += 4 + + return buf +} + +// Request Xf86driGetClientDriverName +// size: 8 +type Xf86driGetClientDriverNameCookie struct { + *cookie +} + +func (c *Conn) Xf86driGetClientDriverName(Screen uint32) Xf86driGetClientDriverNameCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xf86driGetClientDriverNameRequest(Screen), cookie) + return Xf86driGetClientDriverNameCookie{cookie} +} + +func (c *Conn) Xf86driGetClientDriverNameUnchecked(Screen uint32) Xf86driGetClientDriverNameCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xf86driGetClientDriverNameRequest(Screen), cookie) + return Xf86driGetClientDriverNameCookie{cookie} +} + +// Request reply for Xf86driGetClientDriverName +// size: (32 + pad((int(ClientDriverNameLen) * 1))) +type Xf86driGetClientDriverNameReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + ClientDriverMajorVersion uint32 + ClientDriverMinorVersion uint32 + ClientDriverPatchVersion uint32 + ClientDriverNameLen uint32 + // padding: 8 bytes + ClientDriverName string // size: pad((int(ClientDriverNameLen) * 1)) +} + +// Waits and reads reply data from request Xf86driGetClientDriverName +func (cook Xf86driGetClientDriverNameCookie) Reply() (*Xf86driGetClientDriverNameReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xf86driGetClientDriverNameReply(buf), nil +} + +// Read reply into structure from buffer for Xf86driGetClientDriverName +func xf86driGetClientDriverNameReply(buf []byte) *Xf86driGetClientDriverNameReply { + v := new(Xf86driGetClientDriverNameReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.ClientDriverMajorVersion = Get32(buf[b:]) + b += 4 + + v.ClientDriverMinorVersion = Get32(buf[b:]) + b += 4 + + v.ClientDriverPatchVersion = Get32(buf[b:]) + b += 4 + + v.ClientDriverNameLen = Get32(buf[b:]) + b += 4 + + b += 8 // padding + + { + byteString := make([]byte, v.ClientDriverNameLen) + copy(byteString[:v.ClientDriverNameLen], buf[b:]) + v.ClientDriverName = string(byteString) + b += pad(int(v.ClientDriverNameLen)) + } + + return v +} + +func (cook Xf86driGetClientDriverNameCookie) Check() error { + return cook.check() +} + +// Write request to wire for Xf86driGetClientDriverName +func (c *Conn) xf86driGetClientDriverNameRequest(Screen uint32) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFREE86-DRI"] + b += 1 + + buf[b] = 4 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], Screen) + b += 4 + + return buf +} + +// Request Xf86driCreateContext +// size: 16 +type Xf86driCreateContextCookie struct { + *cookie +} + +func (c *Conn) Xf86driCreateContext(Screen uint32, Visual uint32, Context uint32) Xf86driCreateContextCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xf86driCreateContextRequest(Screen, Visual, Context), cookie) + return Xf86driCreateContextCookie{cookie} +} + +func (c *Conn) Xf86driCreateContextUnchecked(Screen uint32, Visual uint32, Context uint32) Xf86driCreateContextCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xf86driCreateContextRequest(Screen, Visual, Context), cookie) + return Xf86driCreateContextCookie{cookie} +} + +// Request reply for Xf86driCreateContext +// size: 12 +type Xf86driCreateContextReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + HwContext uint32 +} + +// Waits and reads reply data from request Xf86driCreateContext +func (cook Xf86driCreateContextCookie) Reply() (*Xf86driCreateContextReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xf86driCreateContextReply(buf), nil +} + +// Read reply into structure from buffer for Xf86driCreateContext +func xf86driCreateContextReply(buf []byte) *Xf86driCreateContextReply { + v := new(Xf86driCreateContextReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.HwContext = Get32(buf[b:]) + b += 4 + + return v +} + +func (cook Xf86driCreateContextCookie) Check() error { + return cook.check() +} + +// Write request to wire for Xf86driCreateContext +func (c *Conn) xf86driCreateContextRequest(Screen uint32, Visual uint32, Context uint32) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFREE86-DRI"] + b += 1 + + buf[b] = 5 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], Screen) + b += 4 + + Put32(buf[b:], Visual) + b += 4 + + Put32(buf[b:], Context) + b += 4 + + return buf +} + +// Request Xf86driDestroyContext +// size: 12 +type Xf86driDestroyContextCookie struct { + *cookie +} + +// Write request to wire for Xf86driDestroyContext +func (c *Conn) Xf86driDestroyContext(Screen uint32, Context uint32) Xf86driDestroyContextCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xf86driDestroyContextRequest(Screen, Context), cookie) + return Xf86driDestroyContextCookie{cookie} +} + +func (c *Conn) Xf86driDestroyContextChecked(Screen uint32, Context uint32) Xf86driDestroyContextCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xf86driDestroyContextRequest(Screen, Context), cookie) + return Xf86driDestroyContextCookie{cookie} +} + +func (cook Xf86driDestroyContextCookie) Check() error { + return cook.check() +} + +// Write request to wire for Xf86driDestroyContext +func (c *Conn) xf86driDestroyContextRequest(Screen uint32, Context uint32) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFREE86-DRI"] + b += 1 + + buf[b] = 6 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], Screen) + b += 4 + + Put32(buf[b:], Context) + b += 4 + + return buf +} + +// Request Xf86driCreateDrawable +// size: 12 +type Xf86driCreateDrawableCookie struct { + *cookie +} + +func (c *Conn) Xf86driCreateDrawable(Screen uint32, Drawable uint32) Xf86driCreateDrawableCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xf86driCreateDrawableRequest(Screen, Drawable), cookie) + return Xf86driCreateDrawableCookie{cookie} +} + +func (c *Conn) Xf86driCreateDrawableUnchecked(Screen uint32, Drawable uint32) Xf86driCreateDrawableCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xf86driCreateDrawableRequest(Screen, Drawable), cookie) + return Xf86driCreateDrawableCookie{cookie} +} + +// Request reply for Xf86driCreateDrawable +// size: 12 +type Xf86driCreateDrawableReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + HwDrawableHandle uint32 +} + +// Waits and reads reply data from request Xf86driCreateDrawable +func (cook Xf86driCreateDrawableCookie) Reply() (*Xf86driCreateDrawableReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xf86driCreateDrawableReply(buf), nil +} + +// Read reply into structure from buffer for Xf86driCreateDrawable +func xf86driCreateDrawableReply(buf []byte) *Xf86driCreateDrawableReply { + v := new(Xf86driCreateDrawableReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.HwDrawableHandle = Get32(buf[b:]) + b += 4 + + return v +} + +func (cook Xf86driCreateDrawableCookie) Check() error { + return cook.check() +} + +// Write request to wire for Xf86driCreateDrawable +func (c *Conn) xf86driCreateDrawableRequest(Screen uint32, Drawable uint32) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFREE86-DRI"] + b += 1 + + buf[b] = 7 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], Screen) + b += 4 + + Put32(buf[b:], Drawable) + b += 4 + + return buf +} + +// Request Xf86driDestroyDrawable +// size: 12 +type Xf86driDestroyDrawableCookie struct { + *cookie +} + +// Write request to wire for Xf86driDestroyDrawable +func (c *Conn) Xf86driDestroyDrawable(Screen uint32, Drawable uint32) Xf86driDestroyDrawableCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xf86driDestroyDrawableRequest(Screen, Drawable), cookie) + return Xf86driDestroyDrawableCookie{cookie} +} + +func (c *Conn) Xf86driDestroyDrawableChecked(Screen uint32, Drawable uint32) Xf86driDestroyDrawableCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xf86driDestroyDrawableRequest(Screen, Drawable), cookie) + return Xf86driDestroyDrawableCookie{cookie} +} + +func (cook Xf86driDestroyDrawableCookie) Check() error { + return cook.check() +} + +// Write request to wire for Xf86driDestroyDrawable +func (c *Conn) xf86driDestroyDrawableRequest(Screen uint32, Drawable uint32) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFREE86-DRI"] + b += 1 + + buf[b] = 8 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], Screen) + b += 4 + + Put32(buf[b:], Drawable) + b += 4 + + return buf +} + +// Request Xf86driGetDrawableInfo +// size: 12 +type Xf86driGetDrawableInfoCookie struct { + *cookie +} + +func (c *Conn) Xf86driGetDrawableInfo(Screen uint32, Drawable uint32) Xf86driGetDrawableInfoCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xf86driGetDrawableInfoRequest(Screen, Drawable), cookie) + return Xf86driGetDrawableInfoCookie{cookie} +} + +func (c *Conn) Xf86driGetDrawableInfoUnchecked(Screen uint32, Drawable uint32) Xf86driGetDrawableInfoCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xf86driGetDrawableInfoRequest(Screen, Drawable), cookie) + return Xf86driGetDrawableInfoCookie{cookie} +} + +// Request reply for Xf86driGetDrawableInfo +// size: ((36 + pad((int(NumClipRects) * 8))) + pad((int(NumBackClipRects) * 8))) +type Xf86driGetDrawableInfoReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + DrawableTableIndex uint32 + DrawableTableStamp uint32 + DrawableOriginX int16 + DrawableOriginY int16 + DrawableSizeW int16 + DrawableSizeH int16 + NumClipRects uint32 + BackX int16 + BackY int16 + NumBackClipRects uint32 + ClipRects []Xf86driDrmClipRect // size: pad((int(NumClipRects) * 8)) + BackClipRects []Xf86driDrmClipRect // size: pad((int(NumBackClipRects) * 8)) +} + +// Waits and reads reply data from request Xf86driGetDrawableInfo +func (cook Xf86driGetDrawableInfoCookie) Reply() (*Xf86driGetDrawableInfoReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xf86driGetDrawableInfoReply(buf), nil +} + +// Read reply into structure from buffer for Xf86driGetDrawableInfo +func xf86driGetDrawableInfoReply(buf []byte) *Xf86driGetDrawableInfoReply { + v := new(Xf86driGetDrawableInfoReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.DrawableTableIndex = Get32(buf[b:]) + b += 4 + + v.DrawableTableStamp = Get32(buf[b:]) + b += 4 + + v.DrawableOriginX = int16(Get16(buf[b:])) + b += 2 + + v.DrawableOriginY = int16(Get16(buf[b:])) + b += 2 + + v.DrawableSizeW = int16(Get16(buf[b:])) + b += 2 + + v.DrawableSizeH = int16(Get16(buf[b:])) + b += 2 + + v.NumClipRects = Get32(buf[b:]) + b += 4 + + v.BackX = int16(Get16(buf[b:])) + b += 2 + + v.BackY = int16(Get16(buf[b:])) + b += 2 + + v.NumBackClipRects = Get32(buf[b:]) + b += 4 + + v.ClipRects = make([]Xf86driDrmClipRect, v.NumClipRects) + b += ReadXf86driDrmClipRectList(buf[b:], v.ClipRects) + + v.BackClipRects = make([]Xf86driDrmClipRect, v.NumBackClipRects) + b += ReadXf86driDrmClipRectList(buf[b:], v.BackClipRects) + + return v +} + +func (cook Xf86driGetDrawableInfoCookie) Check() error { + return cook.check() +} + +// Write request to wire for Xf86driGetDrawableInfo +func (c *Conn) xf86driGetDrawableInfoRequest(Screen uint32, Drawable uint32) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFREE86-DRI"] + b += 1 + + buf[b] = 9 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], Screen) + b += 4 + + Put32(buf[b:], Drawable) + b += 4 + + return buf +} + +// Request Xf86driGetDeviceInfo +// size: 8 +type Xf86driGetDeviceInfoCookie struct { + *cookie +} + +func (c *Conn) Xf86driGetDeviceInfo(Screen uint32) Xf86driGetDeviceInfoCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xf86driGetDeviceInfoRequest(Screen), cookie) + return Xf86driGetDeviceInfoCookie{cookie} +} + +func (c *Conn) Xf86driGetDeviceInfoUnchecked(Screen uint32) Xf86driGetDeviceInfoCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xf86driGetDeviceInfoRequest(Screen), cookie) + return Xf86driGetDeviceInfoCookie{cookie} +} + +// Request reply for Xf86driGetDeviceInfo +// size: (32 + pad((int(DevicePrivateSize) * 4))) +type Xf86driGetDeviceInfoReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + FramebufferHandleLow uint32 + FramebufferHandleHigh uint32 + FramebufferOriginOffset uint32 + FramebufferSize uint32 + FramebufferStride uint32 + DevicePrivateSize uint32 + DevicePrivate []uint32 // size: pad((int(DevicePrivateSize) * 4)) +} + +// Waits and reads reply data from request Xf86driGetDeviceInfo +func (cook Xf86driGetDeviceInfoCookie) Reply() (*Xf86driGetDeviceInfoReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xf86driGetDeviceInfoReply(buf), nil +} + +// Read reply into structure from buffer for Xf86driGetDeviceInfo +func xf86driGetDeviceInfoReply(buf []byte) *Xf86driGetDeviceInfoReply { + v := new(Xf86driGetDeviceInfoReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.FramebufferHandleLow = Get32(buf[b:]) + b += 4 + + v.FramebufferHandleHigh = Get32(buf[b:]) + b += 4 + + v.FramebufferOriginOffset = Get32(buf[b:]) + b += 4 + + v.FramebufferSize = Get32(buf[b:]) + b += 4 + + v.FramebufferStride = Get32(buf[b:]) + b += 4 + + v.DevicePrivateSize = Get32(buf[b:]) + b += 4 + + v.DevicePrivate = make([]uint32, v.DevicePrivateSize) + for i := 0; i < int(v.DevicePrivateSize); i++ { + v.DevicePrivate[i] = Get32(buf[b:]) + b += 4 + } + b = pad(b) + + return v +} + +func (cook Xf86driGetDeviceInfoCookie) Check() error { + return cook.check() +} + +// Write request to wire for Xf86driGetDeviceInfo +func (c *Conn) xf86driGetDeviceInfoRequest(Screen uint32) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFREE86-DRI"] + b += 1 + + buf[b] = 10 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], Screen) + b += 4 + + return buf +} + +// Request Xf86driAuthConnection +// size: 12 +type Xf86driAuthConnectionCookie struct { + *cookie +} + +func (c *Conn) Xf86driAuthConnection(Screen uint32, Magic uint32) Xf86driAuthConnectionCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xf86driAuthConnectionRequest(Screen, Magic), cookie) + return Xf86driAuthConnectionCookie{cookie} +} + +func (c *Conn) Xf86driAuthConnectionUnchecked(Screen uint32, Magic uint32) Xf86driAuthConnectionCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xf86driAuthConnectionRequest(Screen, Magic), cookie) + return Xf86driAuthConnectionCookie{cookie} +} + +// Request reply for Xf86driAuthConnection +// size: 12 +type Xf86driAuthConnectionReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Authenticated uint32 +} + +// Waits and reads reply data from request Xf86driAuthConnection +func (cook Xf86driAuthConnectionCookie) Reply() (*Xf86driAuthConnectionReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xf86driAuthConnectionReply(buf), nil +} + +// Read reply into structure from buffer for Xf86driAuthConnection +func xf86driAuthConnectionReply(buf []byte) *Xf86driAuthConnectionReply { + v := new(Xf86driAuthConnectionReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.Authenticated = Get32(buf[b:]) + b += 4 + + return v +} + +func (cook Xf86driAuthConnectionCookie) Check() error { + return cook.check() +} + +// Write request to wire for Xf86driAuthConnection +func (c *Conn) xf86driAuthConnectionRequest(Screen uint32, Magic uint32) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFREE86-DRI"] + b += 1 + + buf[b] = 11 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], Screen) + b += 4 + + Put32(buf[b:], Magic) + b += 4 + + return buf +} diff --git a/nexgb/auto_xf86vidmode.go b/nexgb/auto_xf86vidmode.go new file mode 100644 index 0000000..aefadf7 --- /dev/null +++ b/nexgb/auto_xf86vidmode.go @@ -0,0 +1,2372 @@ +package xgb + +/* + This file was generated by xf86vidmode.xml on May 6 2012 3:00:44am EDT. + This file is automatically generated. Edit at your peril! +*/ + +// Skipping definition for base type 'Card16' + +// Skipping definition for base type 'Char' + +// Skipping definition for base type 'Card32' + +// Skipping definition for base type 'Double' + +// Skipping definition for base type 'Bool' + +// Skipping definition for base type 'Float' + +// Skipping definition for base type 'Id' + +// Skipping definition for base type 'Card8' + +// Skipping definition for base type 'Int16' + +// Skipping definition for base type 'Int32' + +// Skipping definition for base type 'Void' + +// Skipping definition for base type 'Byte' + +// Skipping definition for base type 'Int8' + +const ( + Xf86vidmodeModeFlagPositiveHsync = 1 + Xf86vidmodeModeFlagNegativeHsync = 2 + Xf86vidmodeModeFlagPositiveVsync = 4 + Xf86vidmodeModeFlagNegativeVsync = 8 + Xf86vidmodeModeFlagInterlace = 16 + Xf86vidmodeModeFlagCompositeSync = 32 + Xf86vidmodeModeFlagPositiveCsync = 64 + Xf86vidmodeModeFlagNegativeCsync = 128 + Xf86vidmodeModeFlagHSkew = 256 + Xf86vidmodeModeFlagBroadcast = 512 + Xf86vidmodeModeFlagPixmux = 1024 + Xf86vidmodeModeFlagDoubleClock = 2048 + Xf86vidmodeModeFlagHalfClock = 4096 +) + +const ( + Xf86vidmodeClockFlagProgramable = 1 +) + +const ( + Xf86vidmodePermissionRead = 1 + Xf86vidmodePermissionWrite = 2 +) + +type Xf86vidmodeSyncrange uint32 + +type Xf86vidmodeDotclock uint32 + +// 'Xf86vidmodeModeInfo' struct definition +// Size: 48 +type Xf86vidmodeModeInfo struct { + Dotclock Xf86vidmodeDotclock + Hdisplay uint16 + Hsyncstart uint16 + Hsyncend uint16 + Htotal uint16 + Hskew uint32 + Vdisplay uint16 + Vsyncstart uint16 + Vsyncend uint16 + Vtotal uint16 + // padding: 4 bytes + Flags uint32 + // padding: 12 bytes + Privsize uint32 +} + +// Struct read Xf86vidmodeModeInfo +func ReadXf86vidmodeModeInfo(buf []byte, v *Xf86vidmodeModeInfo) int { + b := 0 + + v.Dotclock = Xf86vidmodeDotclock(Get32(buf[b:])) + b += 4 + + v.Hdisplay = Get16(buf[b:]) + b += 2 + + v.Hsyncstart = Get16(buf[b:]) + b += 2 + + v.Hsyncend = Get16(buf[b:]) + b += 2 + + v.Htotal = Get16(buf[b:]) + b += 2 + + v.Hskew = Get32(buf[b:]) + b += 4 + + v.Vdisplay = Get16(buf[b:]) + b += 2 + + v.Vsyncstart = Get16(buf[b:]) + b += 2 + + v.Vsyncend = Get16(buf[b:]) + b += 2 + + v.Vtotal = Get16(buf[b:]) + b += 2 + + b += 4 // padding + + v.Flags = Get32(buf[b:]) + b += 4 + + b += 12 // padding + + v.Privsize = Get32(buf[b:]) + b += 4 + + return b +} + +// Struct list read Xf86vidmodeModeInfo +func ReadXf86vidmodeModeInfoList(buf []byte, dest []Xf86vidmodeModeInfo) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = Xf86vidmodeModeInfo{} + b += ReadXf86vidmodeModeInfo(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write Xf86vidmodeModeInfo +func (v Xf86vidmodeModeInfo) Bytes() []byte { + buf := make([]byte, 48) + b := 0 + + Put32(buf[b:], uint32(v.Dotclock)) + b += 4 + + Put16(buf[b:], v.Hdisplay) + b += 2 + + Put16(buf[b:], v.Hsyncstart) + b += 2 + + Put16(buf[b:], v.Hsyncend) + b += 2 + + Put16(buf[b:], v.Htotal) + b += 2 + + Put32(buf[b:], v.Hskew) + b += 4 + + Put16(buf[b:], v.Vdisplay) + b += 2 + + Put16(buf[b:], v.Vsyncstart) + b += 2 + + Put16(buf[b:], v.Vsyncend) + b += 2 + + Put16(buf[b:], v.Vtotal) + b += 2 + + b += 4 // padding + + Put32(buf[b:], v.Flags) + b += 4 + + b += 12 // padding + + Put32(buf[b:], v.Privsize) + b += 4 + + return buf +} + +// Write struct list Xf86vidmodeModeInfo +func Xf86vidmodeModeInfoListBytes(buf []byte, list []Xf86vidmodeModeInfo) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// Error definition Xf86vidmodeBadClock (0) +// Size: 32 + +const BadXf86vidmodeBadClock = 0 + +type Xf86vidmodeBadClockError struct { + Sequence uint16 + NiceName string +} + +// Error read Xf86vidmodeBadClock +func NewXf86vidmodeBadClockError(buf []byte) Error { + v := Xf86vidmodeBadClockError{} + v.NiceName = "Xf86vidmodeBadClock" + + b := 1 // skip error determinant + b += 1 // don't read error number + + v.Sequence = Get16(buf[b:]) + b += 2 + + return v +} + +func (err Xf86vidmodeBadClockError) ImplementsError() {} + +func (err Xf86vidmodeBadClockError) SequenceId() uint16 { + return err.Sequence +} + +func (err Xf86vidmodeBadClockError) BadId() Id { + return 0 +} + +func (err Xf86vidmodeBadClockError) Error() string { + fieldVals := make([]string, 0, 0) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) + return "BadXf86vidmodeBadClock {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newErrorFuncs[0] = NewXf86vidmodeBadClockError +} + +// Error definition Xf86vidmodeBadHTimings (1) +// Size: 32 + +const BadXf86vidmodeBadHTimings = 1 + +type Xf86vidmodeBadHTimingsError struct { + Sequence uint16 + NiceName string +} + +// Error read Xf86vidmodeBadHTimings +func NewXf86vidmodeBadHTimingsError(buf []byte) Error { + v := Xf86vidmodeBadHTimingsError{} + v.NiceName = "Xf86vidmodeBadHTimings" + + b := 1 // skip error determinant + b += 1 // don't read error number + + v.Sequence = Get16(buf[b:]) + b += 2 + + return v +} + +func (err Xf86vidmodeBadHTimingsError) ImplementsError() {} + +func (err Xf86vidmodeBadHTimingsError) SequenceId() uint16 { + return err.Sequence +} + +func (err Xf86vidmodeBadHTimingsError) BadId() Id { + return 0 +} + +func (err Xf86vidmodeBadHTimingsError) Error() string { + fieldVals := make([]string, 0, 0) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) + return "BadXf86vidmodeBadHTimings {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newErrorFuncs[1] = NewXf86vidmodeBadHTimingsError +} + +// Error definition Xf86vidmodeBadVTimings (2) +// Size: 32 + +const BadXf86vidmodeBadVTimings = 2 + +type Xf86vidmodeBadVTimingsError struct { + Sequence uint16 + NiceName string +} + +// Error read Xf86vidmodeBadVTimings +func NewXf86vidmodeBadVTimingsError(buf []byte) Error { + v := Xf86vidmodeBadVTimingsError{} + v.NiceName = "Xf86vidmodeBadVTimings" + + b := 1 // skip error determinant + b += 1 // don't read error number + + v.Sequence = Get16(buf[b:]) + b += 2 + + return v +} + +func (err Xf86vidmodeBadVTimingsError) ImplementsError() {} + +func (err Xf86vidmodeBadVTimingsError) SequenceId() uint16 { + return err.Sequence +} + +func (err Xf86vidmodeBadVTimingsError) BadId() Id { + return 0 +} + +func (err Xf86vidmodeBadVTimingsError) Error() string { + fieldVals := make([]string, 0, 0) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) + return "BadXf86vidmodeBadVTimings {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newErrorFuncs[2] = NewXf86vidmodeBadVTimingsError +} + +// Error definition Xf86vidmodeModeUnsuitable (3) +// Size: 32 + +const BadXf86vidmodeModeUnsuitable = 3 + +type Xf86vidmodeModeUnsuitableError struct { + Sequence uint16 + NiceName string +} + +// Error read Xf86vidmodeModeUnsuitable +func NewXf86vidmodeModeUnsuitableError(buf []byte) Error { + v := Xf86vidmodeModeUnsuitableError{} + v.NiceName = "Xf86vidmodeModeUnsuitable" + + b := 1 // skip error determinant + b += 1 // don't read error number + + v.Sequence = Get16(buf[b:]) + b += 2 + + return v +} + +func (err Xf86vidmodeModeUnsuitableError) ImplementsError() {} + +func (err Xf86vidmodeModeUnsuitableError) SequenceId() uint16 { + return err.Sequence +} + +func (err Xf86vidmodeModeUnsuitableError) BadId() Id { + return 0 +} + +func (err Xf86vidmodeModeUnsuitableError) Error() string { + fieldVals := make([]string, 0, 0) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) + return "BadXf86vidmodeModeUnsuitable {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newErrorFuncs[3] = NewXf86vidmodeModeUnsuitableError +} + +// Error definition Xf86vidmodeExtensionDisabled (4) +// Size: 32 + +const BadXf86vidmodeExtensionDisabled = 4 + +type Xf86vidmodeExtensionDisabledError struct { + Sequence uint16 + NiceName string +} + +// Error read Xf86vidmodeExtensionDisabled +func NewXf86vidmodeExtensionDisabledError(buf []byte) Error { + v := Xf86vidmodeExtensionDisabledError{} + v.NiceName = "Xf86vidmodeExtensionDisabled" + + b := 1 // skip error determinant + b += 1 // don't read error number + + v.Sequence = Get16(buf[b:]) + b += 2 + + return v +} + +func (err Xf86vidmodeExtensionDisabledError) ImplementsError() {} + +func (err Xf86vidmodeExtensionDisabledError) SequenceId() uint16 { + return err.Sequence +} + +func (err Xf86vidmodeExtensionDisabledError) BadId() Id { + return 0 +} + +func (err Xf86vidmodeExtensionDisabledError) Error() string { + fieldVals := make([]string, 0, 0) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) + return "BadXf86vidmodeExtensionDisabled {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newErrorFuncs[4] = NewXf86vidmodeExtensionDisabledError +} + +// Error definition Xf86vidmodeClientNotLocal (5) +// Size: 32 + +const BadXf86vidmodeClientNotLocal = 5 + +type Xf86vidmodeClientNotLocalError struct { + Sequence uint16 + NiceName string +} + +// Error read Xf86vidmodeClientNotLocal +func NewXf86vidmodeClientNotLocalError(buf []byte) Error { + v := Xf86vidmodeClientNotLocalError{} + v.NiceName = "Xf86vidmodeClientNotLocal" + + b := 1 // skip error determinant + b += 1 // don't read error number + + v.Sequence = Get16(buf[b:]) + b += 2 + + return v +} + +func (err Xf86vidmodeClientNotLocalError) ImplementsError() {} + +func (err Xf86vidmodeClientNotLocalError) SequenceId() uint16 { + return err.Sequence +} + +func (err Xf86vidmodeClientNotLocalError) BadId() Id { + return 0 +} + +func (err Xf86vidmodeClientNotLocalError) Error() string { + fieldVals := make([]string, 0, 0) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) + return "BadXf86vidmodeClientNotLocal {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newErrorFuncs[5] = NewXf86vidmodeClientNotLocalError +} + +// Error definition Xf86vidmodeZoomLocked (6) +// Size: 32 + +const BadXf86vidmodeZoomLocked = 6 + +type Xf86vidmodeZoomLockedError struct { + Sequence uint16 + NiceName string +} + +// Error read Xf86vidmodeZoomLocked +func NewXf86vidmodeZoomLockedError(buf []byte) Error { + v := Xf86vidmodeZoomLockedError{} + v.NiceName = "Xf86vidmodeZoomLocked" + + b := 1 // skip error determinant + b += 1 // don't read error number + + v.Sequence = Get16(buf[b:]) + b += 2 + + return v +} + +func (err Xf86vidmodeZoomLockedError) ImplementsError() {} + +func (err Xf86vidmodeZoomLockedError) SequenceId() uint16 { + return err.Sequence +} + +func (err Xf86vidmodeZoomLockedError) BadId() Id { + return 0 +} + +func (err Xf86vidmodeZoomLockedError) Error() string { + fieldVals := make([]string, 0, 0) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) + return "BadXf86vidmodeZoomLocked {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newErrorFuncs[6] = NewXf86vidmodeZoomLockedError +} + +// Request Xf86vidmodeQueryVersion +// size: 4 +type Xf86vidmodeQueryVersionCookie struct { + *cookie +} + +func (c *Conn) Xf86vidmodeQueryVersion() Xf86vidmodeQueryVersionCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xf86vidmodeQueryVersionRequest(), cookie) + return Xf86vidmodeQueryVersionCookie{cookie} +} + +func (c *Conn) Xf86vidmodeQueryVersionUnchecked() Xf86vidmodeQueryVersionCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xf86vidmodeQueryVersionRequest(), cookie) + return Xf86vidmodeQueryVersionCookie{cookie} +} + +// Request reply for Xf86vidmodeQueryVersion +// size: 12 +type Xf86vidmodeQueryVersionReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + MajorVersion uint16 + MinorVersion uint16 +} + +// Waits and reads reply data from request Xf86vidmodeQueryVersion +func (cook Xf86vidmodeQueryVersionCookie) Reply() (*Xf86vidmodeQueryVersionReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xf86vidmodeQueryVersionReply(buf), nil +} + +// Read reply into structure from buffer for Xf86vidmodeQueryVersion +func xf86vidmodeQueryVersionReply(buf []byte) *Xf86vidmodeQueryVersionReply { + v := new(Xf86vidmodeQueryVersionReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.MajorVersion = Get16(buf[b:]) + b += 2 + + v.MinorVersion = Get16(buf[b:]) + b += 2 + + return v +} + +func (cook Xf86vidmodeQueryVersionCookie) Check() error { + return cook.check() +} + +// Write request to wire for Xf86vidmodeQueryVersion +func (c *Conn) xf86vidmodeQueryVersionRequest() []byte { + size := 4 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFREE86-VIDMODEEXTENSION"] + b += 1 + + buf[b] = 0 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + return buf +} + +// Request Xf86vidmodeGetModeLine +// size: 8 +type Xf86vidmodeGetModeLineCookie struct { + *cookie +} + +func (c *Conn) Xf86vidmodeGetModeLine(Screen uint16) Xf86vidmodeGetModeLineCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xf86vidmodeGetModeLineRequest(Screen), cookie) + return Xf86vidmodeGetModeLineCookie{cookie} +} + +func (c *Conn) Xf86vidmodeGetModeLineUnchecked(Screen uint16) Xf86vidmodeGetModeLineCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xf86vidmodeGetModeLineRequest(Screen), cookie) + return Xf86vidmodeGetModeLineCookie{cookie} +} + +// Request reply for Xf86vidmodeGetModeLine +// size: (52 + pad((int(Privsize) * 1))) +type Xf86vidmodeGetModeLineReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Dotclock Xf86vidmodeDotclock + Hdisplay uint16 + Hsyncstart uint16 + Hsyncend uint16 + Htotal uint16 + Hskew uint16 + Vdisplay uint16 + Vsyncstart uint16 + Vsyncend uint16 + Vtotal uint16 + // padding: 2 bytes + Flags uint32 + // padding: 12 bytes + Privsize uint32 + Private []byte // size: pad((int(Privsize) * 1)) +} + +// Waits and reads reply data from request Xf86vidmodeGetModeLine +func (cook Xf86vidmodeGetModeLineCookie) Reply() (*Xf86vidmodeGetModeLineReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xf86vidmodeGetModeLineReply(buf), nil +} + +// Read reply into structure from buffer for Xf86vidmodeGetModeLine +func xf86vidmodeGetModeLineReply(buf []byte) *Xf86vidmodeGetModeLineReply { + v := new(Xf86vidmodeGetModeLineReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.Dotclock = Xf86vidmodeDotclock(Get32(buf[b:])) + b += 4 + + v.Hdisplay = Get16(buf[b:]) + b += 2 + + v.Hsyncstart = Get16(buf[b:]) + b += 2 + + v.Hsyncend = Get16(buf[b:]) + b += 2 + + v.Htotal = Get16(buf[b:]) + b += 2 + + v.Hskew = Get16(buf[b:]) + b += 2 + + v.Vdisplay = Get16(buf[b:]) + b += 2 + + v.Vsyncstart = Get16(buf[b:]) + b += 2 + + v.Vsyncend = Get16(buf[b:]) + b += 2 + + v.Vtotal = Get16(buf[b:]) + b += 2 + + b += 2 // padding + + v.Flags = Get32(buf[b:]) + b += 4 + + b += 12 // padding + + v.Privsize = Get32(buf[b:]) + b += 4 + + v.Private = make([]byte, v.Privsize) + copy(v.Private[:v.Privsize], buf[b:]) + b += pad(int(v.Privsize)) + + return v +} + +func (cook Xf86vidmodeGetModeLineCookie) Check() error { + return cook.check() +} + +// Write request to wire for Xf86vidmodeGetModeLine +func (c *Conn) xf86vidmodeGetModeLineRequest(Screen uint16) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFREE86-VIDMODEEXTENSION"] + b += 1 + + buf[b] = 1 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put16(buf[b:], Screen) + b += 2 + + b += 2 // padding + + return buf +} + +// Request Xf86vidmodeModModeLine +// size: pad((48 + pad((int(Privsize) * 1)))) +type Xf86vidmodeModModeLineCookie struct { + *cookie +} + +// Write request to wire for Xf86vidmodeModModeLine +func (c *Conn) Xf86vidmodeModModeLine(Screen uint32, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) Xf86vidmodeModModeLineCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xf86vidmodeModModeLineRequest(Screen, Hdisplay, Hsyncstart, Hsyncend, Htotal, Hskew, Vdisplay, Vsyncstart, Vsyncend, Vtotal, Flags, Privsize, Private), cookie) + return Xf86vidmodeModModeLineCookie{cookie} +} + +func (c *Conn) Xf86vidmodeModModeLineChecked(Screen uint32, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) Xf86vidmodeModModeLineCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xf86vidmodeModModeLineRequest(Screen, Hdisplay, Hsyncstart, Hsyncend, Htotal, Hskew, Vdisplay, Vsyncstart, Vsyncend, Vtotal, Flags, Privsize, Private), cookie) + return Xf86vidmodeModModeLineCookie{cookie} +} + +func (cook Xf86vidmodeModModeLineCookie) Check() error { + return cook.check() +} + +// Write request to wire for Xf86vidmodeModModeLine +func (c *Conn) xf86vidmodeModModeLineRequest(Screen uint32, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) []byte { + size := pad((48 + pad((int(Privsize) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFREE86-VIDMODEEXTENSION"] + b += 1 + + buf[b] = 2 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], Screen) + b += 4 + + Put16(buf[b:], Hdisplay) + b += 2 + + Put16(buf[b:], Hsyncstart) + b += 2 + + Put16(buf[b:], Hsyncend) + b += 2 + + Put16(buf[b:], Htotal) + b += 2 + + Put16(buf[b:], Hskew) + b += 2 + + Put16(buf[b:], Vdisplay) + b += 2 + + Put16(buf[b:], Vsyncstart) + b += 2 + + Put16(buf[b:], Vsyncend) + b += 2 + + Put16(buf[b:], Vtotal) + b += 2 + + b += 2 // padding + + Put32(buf[b:], Flags) + b += 4 + + b += 12 // padding + + Put32(buf[b:], Privsize) + b += 4 + + copy(buf[b:], Private[:Privsize]) + b += pad(int(Privsize)) + + return buf +} + +// Request Xf86vidmodeSwitchMode +// size: 8 +type Xf86vidmodeSwitchModeCookie struct { + *cookie +} + +// Write request to wire for Xf86vidmodeSwitchMode +func (c *Conn) Xf86vidmodeSwitchMode(Screen uint16, Zoom uint16) Xf86vidmodeSwitchModeCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xf86vidmodeSwitchModeRequest(Screen, Zoom), cookie) + return Xf86vidmodeSwitchModeCookie{cookie} +} + +func (c *Conn) Xf86vidmodeSwitchModeChecked(Screen uint16, Zoom uint16) Xf86vidmodeSwitchModeCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xf86vidmodeSwitchModeRequest(Screen, Zoom), cookie) + return Xf86vidmodeSwitchModeCookie{cookie} +} + +func (cook Xf86vidmodeSwitchModeCookie) Check() error { + return cook.check() +} + +// Write request to wire for Xf86vidmodeSwitchMode +func (c *Conn) xf86vidmodeSwitchModeRequest(Screen uint16, Zoom uint16) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFREE86-VIDMODEEXTENSION"] + b += 1 + + buf[b] = 3 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put16(buf[b:], Screen) + b += 2 + + Put16(buf[b:], Zoom) + b += 2 + + return buf +} + +// Request Xf86vidmodeGetMonitor +// size: 8 +type Xf86vidmodeGetMonitorCookie struct { + *cookie +} + +func (c *Conn) Xf86vidmodeGetMonitor(Screen uint16) Xf86vidmodeGetMonitorCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xf86vidmodeGetMonitorRequest(Screen), cookie) + return Xf86vidmodeGetMonitorCookie{cookie} +} + +func (c *Conn) Xf86vidmodeGetMonitorUnchecked(Screen uint16) Xf86vidmodeGetMonitorCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xf86vidmodeGetMonitorRequest(Screen), cookie) + return Xf86vidmodeGetMonitorCookie{cookie} +} + +// Request reply for Xf86vidmodeGetMonitor +// size: (((((32 + pad((int(NumHsync) * 4))) + pad((int(NumVsync) * 4))) + pad((int(VendorLength) * 1))) + pad(((((int(VendorLength) + 3) & -4) - int(VendorLength)) * 1))) + pad((int(ModelLength) * 1))) +type Xf86vidmodeGetMonitorReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + VendorLength byte + ModelLength byte + NumHsync byte + NumVsync byte + // padding: 20 bytes + Hsync []Xf86vidmodeSyncrange // size: pad((int(NumHsync) * 4)) + Vsync []Xf86vidmodeSyncrange // size: pad((int(NumVsync) * 4)) + Vendor string // size: pad((int(VendorLength) * 1)) + AlignmentPad []byte // size: pad(((((int(VendorLength) + 3) & -4) - int(VendorLength)) * 1)) + Model string // size: pad((int(ModelLength) * 1)) +} + +// Waits and reads reply data from request Xf86vidmodeGetMonitor +func (cook Xf86vidmodeGetMonitorCookie) Reply() (*Xf86vidmodeGetMonitorReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xf86vidmodeGetMonitorReply(buf), nil +} + +// Read reply into structure from buffer for Xf86vidmodeGetMonitor +func xf86vidmodeGetMonitorReply(buf []byte) *Xf86vidmodeGetMonitorReply { + v := new(Xf86vidmodeGetMonitorReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.VendorLength = buf[b] + b += 1 + + v.ModelLength = buf[b] + b += 1 + + v.NumHsync = buf[b] + b += 1 + + v.NumVsync = buf[b] + b += 1 + + b += 20 // padding + + v.Hsync = make([]Xf86vidmodeSyncrange, v.NumHsync) + for i := 0; i < int(v.NumHsync); i++ { + v.Hsync[i] = Xf86vidmodeSyncrange(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + v.Vsync = make([]Xf86vidmodeSyncrange, v.NumVsync) + for i := 0; i < int(v.NumVsync); i++ { + v.Vsync[i] = Xf86vidmodeSyncrange(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + { + byteString := make([]byte, v.VendorLength) + copy(byteString[:v.VendorLength], buf[b:]) + v.Vendor = string(byteString) + b += pad(int(v.VendorLength)) + } + + v.AlignmentPad = make([]byte, (((int(v.VendorLength) + 3) & -4) - int(v.VendorLength))) + copy(v.AlignmentPad[:(((int(v.VendorLength)+3)&-4)-int(v.VendorLength))], buf[b:]) + b += pad(int((((int(v.VendorLength) + 3) & -4) - int(v.VendorLength)))) + + { + byteString := make([]byte, v.ModelLength) + copy(byteString[:v.ModelLength], buf[b:]) + v.Model = string(byteString) + b += pad(int(v.ModelLength)) + } + + return v +} + +func (cook Xf86vidmodeGetMonitorCookie) Check() error { + return cook.check() +} + +// Write request to wire for Xf86vidmodeGetMonitor +func (c *Conn) xf86vidmodeGetMonitorRequest(Screen uint16) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFREE86-VIDMODEEXTENSION"] + b += 1 + + buf[b] = 4 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put16(buf[b:], Screen) + b += 2 + + b += 2 // padding + + return buf +} + +// Request Xf86vidmodeLockModeSwitch +// size: 8 +type Xf86vidmodeLockModeSwitchCookie struct { + *cookie +} + +// Write request to wire for Xf86vidmodeLockModeSwitch +func (c *Conn) Xf86vidmodeLockModeSwitch(Screen uint16, Lock uint16) Xf86vidmodeLockModeSwitchCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xf86vidmodeLockModeSwitchRequest(Screen, Lock), cookie) + return Xf86vidmodeLockModeSwitchCookie{cookie} +} + +func (c *Conn) Xf86vidmodeLockModeSwitchChecked(Screen uint16, Lock uint16) Xf86vidmodeLockModeSwitchCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xf86vidmodeLockModeSwitchRequest(Screen, Lock), cookie) + return Xf86vidmodeLockModeSwitchCookie{cookie} +} + +func (cook Xf86vidmodeLockModeSwitchCookie) Check() error { + return cook.check() +} + +// Write request to wire for Xf86vidmodeLockModeSwitch +func (c *Conn) xf86vidmodeLockModeSwitchRequest(Screen uint16, Lock uint16) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFREE86-VIDMODEEXTENSION"] + b += 1 + + buf[b] = 5 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put16(buf[b:], Screen) + b += 2 + + Put16(buf[b:], Lock) + b += 2 + + return buf +} + +// Request Xf86vidmodeGetAllModeLines +// size: 8 +type Xf86vidmodeGetAllModeLinesCookie struct { + *cookie +} + +func (c *Conn) Xf86vidmodeGetAllModeLines(Screen uint16) Xf86vidmodeGetAllModeLinesCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xf86vidmodeGetAllModeLinesRequest(Screen), cookie) + return Xf86vidmodeGetAllModeLinesCookie{cookie} +} + +func (c *Conn) Xf86vidmodeGetAllModeLinesUnchecked(Screen uint16) Xf86vidmodeGetAllModeLinesCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xf86vidmodeGetAllModeLinesRequest(Screen), cookie) + return Xf86vidmodeGetAllModeLinesCookie{cookie} +} + +// Request reply for Xf86vidmodeGetAllModeLines +// size: (32 + pad((int(Modecount) * 48))) +type Xf86vidmodeGetAllModeLinesReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Modecount uint32 + // padding: 20 bytes + Modeinfo []Xf86vidmodeModeInfo // size: pad((int(Modecount) * 48)) +} + +// Waits and reads reply data from request Xf86vidmodeGetAllModeLines +func (cook Xf86vidmodeGetAllModeLinesCookie) Reply() (*Xf86vidmodeGetAllModeLinesReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xf86vidmodeGetAllModeLinesReply(buf), nil +} + +// Read reply into structure from buffer for Xf86vidmodeGetAllModeLines +func xf86vidmodeGetAllModeLinesReply(buf []byte) *Xf86vidmodeGetAllModeLinesReply { + v := new(Xf86vidmodeGetAllModeLinesReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.Modecount = Get32(buf[b:]) + b += 4 + + b += 20 // padding + + v.Modeinfo = make([]Xf86vidmodeModeInfo, v.Modecount) + b += ReadXf86vidmodeModeInfoList(buf[b:], v.Modeinfo) + + return v +} + +func (cook Xf86vidmodeGetAllModeLinesCookie) Check() error { + return cook.check() +} + +// Write request to wire for Xf86vidmodeGetAllModeLines +func (c *Conn) xf86vidmodeGetAllModeLinesRequest(Screen uint16) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFREE86-VIDMODEEXTENSION"] + b += 1 + + buf[b] = 6 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put16(buf[b:], Screen) + b += 2 + + b += 2 // padding + + return buf +} + +// Request Xf86vidmodeAddModeLine +// size: pad((92 + pad((int(Privsize) * 1)))) +type Xf86vidmodeAddModeLineCookie struct { + *cookie +} + +// Write request to wire for Xf86vidmodeAddModeLine +func (c *Conn) Xf86vidmodeAddModeLine(Screen uint32, Dotclock Xf86vidmodeDotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, AfterDotclock Xf86vidmodeDotclock, AfterHdisplay uint16, AfterHsyncstart uint16, AfterHsyncend uint16, AfterHtotal uint16, AfterHskew uint16, AfterVdisplay uint16, AfterVsyncstart uint16, AfterVsyncend uint16, AfterVtotal uint16, AfterFlags uint32, Private []byte) Xf86vidmodeAddModeLineCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xf86vidmodeAddModeLineRequest(Screen, Dotclock, Hdisplay, Hsyncstart, Hsyncend, Htotal, Hskew, Vdisplay, Vsyncstart, Vsyncend, Vtotal, Flags, Privsize, AfterDotclock, AfterHdisplay, AfterHsyncstart, AfterHsyncend, AfterHtotal, AfterHskew, AfterVdisplay, AfterVsyncstart, AfterVsyncend, AfterVtotal, AfterFlags, Private), cookie) + return Xf86vidmodeAddModeLineCookie{cookie} +} + +func (c *Conn) Xf86vidmodeAddModeLineChecked(Screen uint32, Dotclock Xf86vidmodeDotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, AfterDotclock Xf86vidmodeDotclock, AfterHdisplay uint16, AfterHsyncstart uint16, AfterHsyncend uint16, AfterHtotal uint16, AfterHskew uint16, AfterVdisplay uint16, AfterVsyncstart uint16, AfterVsyncend uint16, AfterVtotal uint16, AfterFlags uint32, Private []byte) Xf86vidmodeAddModeLineCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xf86vidmodeAddModeLineRequest(Screen, Dotclock, Hdisplay, Hsyncstart, Hsyncend, Htotal, Hskew, Vdisplay, Vsyncstart, Vsyncend, Vtotal, Flags, Privsize, AfterDotclock, AfterHdisplay, AfterHsyncstart, AfterHsyncend, AfterHtotal, AfterHskew, AfterVdisplay, AfterVsyncstart, AfterVsyncend, AfterVtotal, AfterFlags, Private), cookie) + return Xf86vidmodeAddModeLineCookie{cookie} +} + +func (cook Xf86vidmodeAddModeLineCookie) Check() error { + return cook.check() +} + +// Write request to wire for Xf86vidmodeAddModeLine +func (c *Conn) xf86vidmodeAddModeLineRequest(Screen uint32, Dotclock Xf86vidmodeDotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, AfterDotclock Xf86vidmodeDotclock, AfterHdisplay uint16, AfterHsyncstart uint16, AfterHsyncend uint16, AfterHtotal uint16, AfterHskew uint16, AfterVdisplay uint16, AfterVsyncstart uint16, AfterVsyncend uint16, AfterVtotal uint16, AfterFlags uint32, Private []byte) []byte { + size := pad((92 + pad((int(Privsize) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFREE86-VIDMODEEXTENSION"] + b += 1 + + buf[b] = 7 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], Screen) + b += 4 + + Put32(buf[b:], uint32(Dotclock)) + b += 4 + + Put16(buf[b:], Hdisplay) + b += 2 + + Put16(buf[b:], Hsyncstart) + b += 2 + + Put16(buf[b:], Hsyncend) + b += 2 + + Put16(buf[b:], Htotal) + b += 2 + + Put16(buf[b:], Hskew) + b += 2 + + Put16(buf[b:], Vdisplay) + b += 2 + + Put16(buf[b:], Vsyncstart) + b += 2 + + Put16(buf[b:], Vsyncend) + b += 2 + + Put16(buf[b:], Vtotal) + b += 2 + + b += 2 // padding + + Put32(buf[b:], Flags) + b += 4 + + b += 12 // padding + + Put32(buf[b:], Privsize) + b += 4 + + Put32(buf[b:], uint32(AfterDotclock)) + b += 4 + + Put16(buf[b:], AfterHdisplay) + b += 2 + + Put16(buf[b:], AfterHsyncstart) + b += 2 + + Put16(buf[b:], AfterHsyncend) + b += 2 + + Put16(buf[b:], AfterHtotal) + b += 2 + + Put16(buf[b:], AfterHskew) + b += 2 + + Put16(buf[b:], AfterVdisplay) + b += 2 + + Put16(buf[b:], AfterVsyncstart) + b += 2 + + Put16(buf[b:], AfterVsyncend) + b += 2 + + Put16(buf[b:], AfterVtotal) + b += 2 + + b += 2 // padding + + Put32(buf[b:], AfterFlags) + b += 4 + + b += 12 // padding + + copy(buf[b:], Private[:Privsize]) + b += pad(int(Privsize)) + + return buf +} + +// Request Xf86vidmodeDeleteModeLine +// size: pad((52 + pad((int(Privsize) * 1)))) +type Xf86vidmodeDeleteModeLineCookie struct { + *cookie +} + +// Write request to wire for Xf86vidmodeDeleteModeLine +func (c *Conn) Xf86vidmodeDeleteModeLine(Screen uint32, Dotclock Xf86vidmodeDotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) Xf86vidmodeDeleteModeLineCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xf86vidmodeDeleteModeLineRequest(Screen, Dotclock, Hdisplay, Hsyncstart, Hsyncend, Htotal, Hskew, Vdisplay, Vsyncstart, Vsyncend, Vtotal, Flags, Privsize, Private), cookie) + return Xf86vidmodeDeleteModeLineCookie{cookie} +} + +func (c *Conn) Xf86vidmodeDeleteModeLineChecked(Screen uint32, Dotclock Xf86vidmodeDotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) Xf86vidmodeDeleteModeLineCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xf86vidmodeDeleteModeLineRequest(Screen, Dotclock, Hdisplay, Hsyncstart, Hsyncend, Htotal, Hskew, Vdisplay, Vsyncstart, Vsyncend, Vtotal, Flags, Privsize, Private), cookie) + return Xf86vidmodeDeleteModeLineCookie{cookie} +} + +func (cook Xf86vidmodeDeleteModeLineCookie) Check() error { + return cook.check() +} + +// Write request to wire for Xf86vidmodeDeleteModeLine +func (c *Conn) xf86vidmodeDeleteModeLineRequest(Screen uint32, Dotclock Xf86vidmodeDotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) []byte { + size := pad((52 + pad((int(Privsize) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFREE86-VIDMODEEXTENSION"] + b += 1 + + buf[b] = 8 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], Screen) + b += 4 + + Put32(buf[b:], uint32(Dotclock)) + b += 4 + + Put16(buf[b:], Hdisplay) + b += 2 + + Put16(buf[b:], Hsyncstart) + b += 2 + + Put16(buf[b:], Hsyncend) + b += 2 + + Put16(buf[b:], Htotal) + b += 2 + + Put16(buf[b:], Hskew) + b += 2 + + Put16(buf[b:], Vdisplay) + b += 2 + + Put16(buf[b:], Vsyncstart) + b += 2 + + Put16(buf[b:], Vsyncend) + b += 2 + + Put16(buf[b:], Vtotal) + b += 2 + + b += 2 // padding + + Put32(buf[b:], Flags) + b += 4 + + b += 12 // padding + + Put32(buf[b:], Privsize) + b += 4 + + copy(buf[b:], Private[:Privsize]) + b += pad(int(Privsize)) + + return buf +} + +// Request Xf86vidmodeValidateModeLine +// size: pad((52 + pad((int(Privsize) * 1)))) +type Xf86vidmodeValidateModeLineCookie struct { + *cookie +} + +func (c *Conn) Xf86vidmodeValidateModeLine(Screen uint32, Dotclock Xf86vidmodeDotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) Xf86vidmodeValidateModeLineCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xf86vidmodeValidateModeLineRequest(Screen, Dotclock, Hdisplay, Hsyncstart, Hsyncend, Htotal, Hskew, Vdisplay, Vsyncstart, Vsyncend, Vtotal, Flags, Privsize, Private), cookie) + return Xf86vidmodeValidateModeLineCookie{cookie} +} + +func (c *Conn) Xf86vidmodeValidateModeLineUnchecked(Screen uint32, Dotclock Xf86vidmodeDotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) Xf86vidmodeValidateModeLineCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xf86vidmodeValidateModeLineRequest(Screen, Dotclock, Hdisplay, Hsyncstart, Hsyncend, Htotal, Hskew, Vdisplay, Vsyncstart, Vsyncend, Vtotal, Flags, Privsize, Private), cookie) + return Xf86vidmodeValidateModeLineCookie{cookie} +} + +// Request reply for Xf86vidmodeValidateModeLine +// size: 32 +type Xf86vidmodeValidateModeLineReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Status uint32 + // padding: 20 bytes +} + +// Waits and reads reply data from request Xf86vidmodeValidateModeLine +func (cook Xf86vidmodeValidateModeLineCookie) Reply() (*Xf86vidmodeValidateModeLineReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xf86vidmodeValidateModeLineReply(buf), nil +} + +// Read reply into structure from buffer for Xf86vidmodeValidateModeLine +func xf86vidmodeValidateModeLineReply(buf []byte) *Xf86vidmodeValidateModeLineReply { + v := new(Xf86vidmodeValidateModeLineReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.Status = Get32(buf[b:]) + b += 4 + + b += 20 // padding + + return v +} + +func (cook Xf86vidmodeValidateModeLineCookie) Check() error { + return cook.check() +} + +// Write request to wire for Xf86vidmodeValidateModeLine +func (c *Conn) xf86vidmodeValidateModeLineRequest(Screen uint32, Dotclock Xf86vidmodeDotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) []byte { + size := pad((52 + pad((int(Privsize) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFREE86-VIDMODEEXTENSION"] + b += 1 + + buf[b] = 9 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], Screen) + b += 4 + + Put32(buf[b:], uint32(Dotclock)) + b += 4 + + Put16(buf[b:], Hdisplay) + b += 2 + + Put16(buf[b:], Hsyncstart) + b += 2 + + Put16(buf[b:], Hsyncend) + b += 2 + + Put16(buf[b:], Htotal) + b += 2 + + Put16(buf[b:], Hskew) + b += 2 + + Put16(buf[b:], Vdisplay) + b += 2 + + Put16(buf[b:], Vsyncstart) + b += 2 + + Put16(buf[b:], Vsyncend) + b += 2 + + Put16(buf[b:], Vtotal) + b += 2 + + b += 2 // padding + + Put32(buf[b:], Flags) + b += 4 + + b += 12 // padding + + Put32(buf[b:], Privsize) + b += 4 + + copy(buf[b:], Private[:Privsize]) + b += pad(int(Privsize)) + + return buf +} + +// Request Xf86vidmodeSwitchToMode +// size: pad((52 + pad((int(Privsize) * 1)))) +type Xf86vidmodeSwitchToModeCookie struct { + *cookie +} + +// Write request to wire for Xf86vidmodeSwitchToMode +func (c *Conn) Xf86vidmodeSwitchToMode(Screen uint32, Dotclock Xf86vidmodeDotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) Xf86vidmodeSwitchToModeCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xf86vidmodeSwitchToModeRequest(Screen, Dotclock, Hdisplay, Hsyncstart, Hsyncend, Htotal, Hskew, Vdisplay, Vsyncstart, Vsyncend, Vtotal, Flags, Privsize, Private), cookie) + return Xf86vidmodeSwitchToModeCookie{cookie} +} + +func (c *Conn) Xf86vidmodeSwitchToModeChecked(Screen uint32, Dotclock Xf86vidmodeDotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) Xf86vidmodeSwitchToModeCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xf86vidmodeSwitchToModeRequest(Screen, Dotclock, Hdisplay, Hsyncstart, Hsyncend, Htotal, Hskew, Vdisplay, Vsyncstart, Vsyncend, Vtotal, Flags, Privsize, Private), cookie) + return Xf86vidmodeSwitchToModeCookie{cookie} +} + +func (cook Xf86vidmodeSwitchToModeCookie) Check() error { + return cook.check() +} + +// Write request to wire for Xf86vidmodeSwitchToMode +func (c *Conn) xf86vidmodeSwitchToModeRequest(Screen uint32, Dotclock Xf86vidmodeDotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) []byte { + size := pad((52 + pad((int(Privsize) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFREE86-VIDMODEEXTENSION"] + b += 1 + + buf[b] = 10 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], Screen) + b += 4 + + Put32(buf[b:], uint32(Dotclock)) + b += 4 + + Put16(buf[b:], Hdisplay) + b += 2 + + Put16(buf[b:], Hsyncstart) + b += 2 + + Put16(buf[b:], Hsyncend) + b += 2 + + Put16(buf[b:], Htotal) + b += 2 + + Put16(buf[b:], Hskew) + b += 2 + + Put16(buf[b:], Vdisplay) + b += 2 + + Put16(buf[b:], Vsyncstart) + b += 2 + + Put16(buf[b:], Vsyncend) + b += 2 + + Put16(buf[b:], Vtotal) + b += 2 + + b += 2 // padding + + Put32(buf[b:], Flags) + b += 4 + + b += 12 // padding + + Put32(buf[b:], Privsize) + b += 4 + + copy(buf[b:], Private[:Privsize]) + b += pad(int(Privsize)) + + return buf +} + +// Request Xf86vidmodeGetViewPort +// size: 8 +type Xf86vidmodeGetViewPortCookie struct { + *cookie +} + +func (c *Conn) Xf86vidmodeGetViewPort(Screen uint16) Xf86vidmodeGetViewPortCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xf86vidmodeGetViewPortRequest(Screen), cookie) + return Xf86vidmodeGetViewPortCookie{cookie} +} + +func (c *Conn) Xf86vidmodeGetViewPortUnchecked(Screen uint16) Xf86vidmodeGetViewPortCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xf86vidmodeGetViewPortRequest(Screen), cookie) + return Xf86vidmodeGetViewPortCookie{cookie} +} + +// Request reply for Xf86vidmodeGetViewPort +// size: 32 +type Xf86vidmodeGetViewPortReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + X uint32 + Y uint32 + // padding: 16 bytes +} + +// Waits and reads reply data from request Xf86vidmodeGetViewPort +func (cook Xf86vidmodeGetViewPortCookie) Reply() (*Xf86vidmodeGetViewPortReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xf86vidmodeGetViewPortReply(buf), nil +} + +// Read reply into structure from buffer for Xf86vidmodeGetViewPort +func xf86vidmodeGetViewPortReply(buf []byte) *Xf86vidmodeGetViewPortReply { + v := new(Xf86vidmodeGetViewPortReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.X = Get32(buf[b:]) + b += 4 + + v.Y = Get32(buf[b:]) + b += 4 + + b += 16 // padding + + return v +} + +func (cook Xf86vidmodeGetViewPortCookie) Check() error { + return cook.check() +} + +// Write request to wire for Xf86vidmodeGetViewPort +func (c *Conn) xf86vidmodeGetViewPortRequest(Screen uint16) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFREE86-VIDMODEEXTENSION"] + b += 1 + + buf[b] = 11 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put16(buf[b:], Screen) + b += 2 + + b += 2 // padding + + return buf +} + +// Request Xf86vidmodeSetViewPort +// size: 16 +type Xf86vidmodeSetViewPortCookie struct { + *cookie +} + +// Write request to wire for Xf86vidmodeSetViewPort +func (c *Conn) Xf86vidmodeSetViewPort(Screen uint16, X uint32, Y uint32) Xf86vidmodeSetViewPortCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xf86vidmodeSetViewPortRequest(Screen, X, Y), cookie) + return Xf86vidmodeSetViewPortCookie{cookie} +} + +func (c *Conn) Xf86vidmodeSetViewPortChecked(Screen uint16, X uint32, Y uint32) Xf86vidmodeSetViewPortCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xf86vidmodeSetViewPortRequest(Screen, X, Y), cookie) + return Xf86vidmodeSetViewPortCookie{cookie} +} + +func (cook Xf86vidmodeSetViewPortCookie) Check() error { + return cook.check() +} + +// Write request to wire for Xf86vidmodeSetViewPort +func (c *Conn) xf86vidmodeSetViewPortRequest(Screen uint16, X uint32, Y uint32) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFREE86-VIDMODEEXTENSION"] + b += 1 + + buf[b] = 12 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put16(buf[b:], Screen) + b += 2 + + b += 2 // padding + + Put32(buf[b:], X) + b += 4 + + Put32(buf[b:], Y) + b += 4 + + return buf +} + +// Request Xf86vidmodeGetDotClocks +// size: 8 +type Xf86vidmodeGetDotClocksCookie struct { + *cookie +} + +func (c *Conn) Xf86vidmodeGetDotClocks(Screen uint16) Xf86vidmodeGetDotClocksCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xf86vidmodeGetDotClocksRequest(Screen), cookie) + return Xf86vidmodeGetDotClocksCookie{cookie} +} + +func (c *Conn) Xf86vidmodeGetDotClocksUnchecked(Screen uint16) Xf86vidmodeGetDotClocksCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xf86vidmodeGetDotClocksRequest(Screen), cookie) + return Xf86vidmodeGetDotClocksCookie{cookie} +} + +// Request reply for Xf86vidmodeGetDotClocks +// size: (32 + pad((((1 - (int(Flags) & 1)) * int(Clocks)) * 4))) +type Xf86vidmodeGetDotClocksReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Flags uint32 + Clocks uint32 + Maxclocks uint32 + // padding: 12 bytes + Clock []uint32 // size: pad((((1 - (int(Flags) & 1)) * int(Clocks)) * 4)) +} + +// Waits and reads reply data from request Xf86vidmodeGetDotClocks +func (cook Xf86vidmodeGetDotClocksCookie) Reply() (*Xf86vidmodeGetDotClocksReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xf86vidmodeGetDotClocksReply(buf), nil +} + +// Read reply into structure from buffer for Xf86vidmodeGetDotClocks +func xf86vidmodeGetDotClocksReply(buf []byte) *Xf86vidmodeGetDotClocksReply { + v := new(Xf86vidmodeGetDotClocksReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.Flags = Get32(buf[b:]) + b += 4 + + v.Clocks = Get32(buf[b:]) + b += 4 + + v.Maxclocks = Get32(buf[b:]) + b += 4 + + b += 12 // padding + + v.Clock = make([]uint32, ((1 - (int(v.Flags) & 1)) * int(v.Clocks))) + for i := 0; i < int(((1 - (int(v.Flags) & 1)) * int(v.Clocks))); i++ { + v.Clock[i] = Get32(buf[b:]) + b += 4 + } + b = pad(b) + + return v +} + +func (cook Xf86vidmodeGetDotClocksCookie) Check() error { + return cook.check() +} + +// Write request to wire for Xf86vidmodeGetDotClocks +func (c *Conn) xf86vidmodeGetDotClocksRequest(Screen uint16) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFREE86-VIDMODEEXTENSION"] + b += 1 + + buf[b] = 13 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put16(buf[b:], Screen) + b += 2 + + b += 2 // padding + + return buf +} + +// Request Xf86vidmodeSetClientVersion +// size: 8 +type Xf86vidmodeSetClientVersionCookie struct { + *cookie +} + +// Write request to wire for Xf86vidmodeSetClientVersion +func (c *Conn) Xf86vidmodeSetClientVersion(Major uint16, Minor uint16) Xf86vidmodeSetClientVersionCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xf86vidmodeSetClientVersionRequest(Major, Minor), cookie) + return Xf86vidmodeSetClientVersionCookie{cookie} +} + +func (c *Conn) Xf86vidmodeSetClientVersionChecked(Major uint16, Minor uint16) Xf86vidmodeSetClientVersionCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xf86vidmodeSetClientVersionRequest(Major, Minor), cookie) + return Xf86vidmodeSetClientVersionCookie{cookie} +} + +func (cook Xf86vidmodeSetClientVersionCookie) Check() error { + return cook.check() +} + +// Write request to wire for Xf86vidmodeSetClientVersion +func (c *Conn) xf86vidmodeSetClientVersionRequest(Major uint16, Minor uint16) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFREE86-VIDMODEEXTENSION"] + b += 1 + + buf[b] = 14 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put16(buf[b:], Major) + b += 2 + + Put16(buf[b:], Minor) + b += 2 + + return buf +} + +// Request Xf86vidmodeSetGamma +// size: 32 +type Xf86vidmodeSetGammaCookie struct { + *cookie +} + +// Write request to wire for Xf86vidmodeSetGamma +func (c *Conn) Xf86vidmodeSetGamma(Screen uint16, Red uint32, Green uint32, Blue uint32) Xf86vidmodeSetGammaCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xf86vidmodeSetGammaRequest(Screen, Red, Green, Blue), cookie) + return Xf86vidmodeSetGammaCookie{cookie} +} + +func (c *Conn) Xf86vidmodeSetGammaChecked(Screen uint16, Red uint32, Green uint32, Blue uint32) Xf86vidmodeSetGammaCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xf86vidmodeSetGammaRequest(Screen, Red, Green, Blue), cookie) + return Xf86vidmodeSetGammaCookie{cookie} +} + +func (cook Xf86vidmodeSetGammaCookie) Check() error { + return cook.check() +} + +// Write request to wire for Xf86vidmodeSetGamma +func (c *Conn) xf86vidmodeSetGammaRequest(Screen uint16, Red uint32, Green uint32, Blue uint32) []byte { + size := 32 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFREE86-VIDMODEEXTENSION"] + b += 1 + + buf[b] = 15 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put16(buf[b:], Screen) + b += 2 + + b += 2 // padding + + Put32(buf[b:], Red) + b += 4 + + Put32(buf[b:], Green) + b += 4 + + Put32(buf[b:], Blue) + b += 4 + + b += 12 // padding + + return buf +} + +// Request Xf86vidmodeGetGamma +// size: 32 +type Xf86vidmodeGetGammaCookie struct { + *cookie +} + +func (c *Conn) Xf86vidmodeGetGamma(Screen uint16) Xf86vidmodeGetGammaCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xf86vidmodeGetGammaRequest(Screen), cookie) + return Xf86vidmodeGetGammaCookie{cookie} +} + +func (c *Conn) Xf86vidmodeGetGammaUnchecked(Screen uint16) Xf86vidmodeGetGammaCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xf86vidmodeGetGammaRequest(Screen), cookie) + return Xf86vidmodeGetGammaCookie{cookie} +} + +// Request reply for Xf86vidmodeGetGamma +// size: 32 +type Xf86vidmodeGetGammaReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Red uint32 + Green uint32 + Blue uint32 + // padding: 12 bytes +} + +// Waits and reads reply data from request Xf86vidmodeGetGamma +func (cook Xf86vidmodeGetGammaCookie) Reply() (*Xf86vidmodeGetGammaReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xf86vidmodeGetGammaReply(buf), nil +} + +// Read reply into structure from buffer for Xf86vidmodeGetGamma +func xf86vidmodeGetGammaReply(buf []byte) *Xf86vidmodeGetGammaReply { + v := new(Xf86vidmodeGetGammaReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.Red = Get32(buf[b:]) + b += 4 + + v.Green = Get32(buf[b:]) + b += 4 + + v.Blue = Get32(buf[b:]) + b += 4 + + b += 12 // padding + + return v +} + +func (cook Xf86vidmodeGetGammaCookie) Check() error { + return cook.check() +} + +// Write request to wire for Xf86vidmodeGetGamma +func (c *Conn) xf86vidmodeGetGammaRequest(Screen uint16) []byte { + size := 32 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFREE86-VIDMODEEXTENSION"] + b += 1 + + buf[b] = 16 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put16(buf[b:], Screen) + b += 2 + + b += 26 // padding + + return buf +} + +// Request Xf86vidmodeGetGammaRamp +// size: 8 +type Xf86vidmodeGetGammaRampCookie struct { + *cookie +} + +func (c *Conn) Xf86vidmodeGetGammaRamp(Screen uint16, Size uint16) Xf86vidmodeGetGammaRampCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xf86vidmodeGetGammaRampRequest(Screen, Size), cookie) + return Xf86vidmodeGetGammaRampCookie{cookie} +} + +func (c *Conn) Xf86vidmodeGetGammaRampUnchecked(Screen uint16, Size uint16) Xf86vidmodeGetGammaRampCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xf86vidmodeGetGammaRampRequest(Screen, Size), cookie) + return Xf86vidmodeGetGammaRampCookie{cookie} +} + +// Request reply for Xf86vidmodeGetGammaRamp +// size: (((32 + pad((((int(Size) + 1) & -2) * 2))) + pad((((int(Size) + 1) & -2) * 2))) + pad((((int(Size) + 1) & -2) * 2))) +type Xf86vidmodeGetGammaRampReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Size uint16 + // padding: 22 bytes + Red []uint16 // size: pad((((int(Size) + 1) & -2) * 2)) + Green []uint16 // size: pad((((int(Size) + 1) & -2) * 2)) + Blue []uint16 // size: pad((((int(Size) + 1) & -2) * 2)) +} + +// Waits and reads reply data from request Xf86vidmodeGetGammaRamp +func (cook Xf86vidmodeGetGammaRampCookie) Reply() (*Xf86vidmodeGetGammaRampReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xf86vidmodeGetGammaRampReply(buf), nil +} + +// Read reply into structure from buffer for Xf86vidmodeGetGammaRamp +func xf86vidmodeGetGammaRampReply(buf []byte) *Xf86vidmodeGetGammaRampReply { + v := new(Xf86vidmodeGetGammaRampReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.Size = Get16(buf[b:]) + b += 2 + + b += 22 // padding + + v.Red = make([]uint16, ((int(v.Size) + 1) & -2)) + for i := 0; i < int(((int(v.Size) + 1) & -2)); i++ { + v.Red[i] = Get16(buf[b:]) + b += 2 + } + b = pad(b) + + v.Green = make([]uint16, ((int(v.Size) + 1) & -2)) + for i := 0; i < int(((int(v.Size) + 1) & -2)); i++ { + v.Green[i] = Get16(buf[b:]) + b += 2 + } + b = pad(b) + + v.Blue = make([]uint16, ((int(v.Size) + 1) & -2)) + for i := 0; i < int(((int(v.Size) + 1) & -2)); i++ { + v.Blue[i] = Get16(buf[b:]) + b += 2 + } + b = pad(b) + + return v +} + +func (cook Xf86vidmodeGetGammaRampCookie) Check() error { + return cook.check() +} + +// Write request to wire for Xf86vidmodeGetGammaRamp +func (c *Conn) xf86vidmodeGetGammaRampRequest(Screen uint16, Size uint16) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFREE86-VIDMODEEXTENSION"] + b += 1 + + buf[b] = 17 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put16(buf[b:], Screen) + b += 2 + + Put16(buf[b:], Size) + b += 2 + + return buf +} + +// Request Xf86vidmodeSetGammaRamp +// size: pad((((8 + pad((((int(Size) + 1) & -2) * 2))) + pad((((int(Size) + 1) & -2) * 2))) + pad((((int(Size) + 1) & -2) * 2)))) +type Xf86vidmodeSetGammaRampCookie struct { + *cookie +} + +// Write request to wire for Xf86vidmodeSetGammaRamp +func (c *Conn) Xf86vidmodeSetGammaRamp(Screen uint16, Size uint16, Red []uint16, Green []uint16, Blue []uint16) Xf86vidmodeSetGammaRampCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xf86vidmodeSetGammaRampRequest(Screen, Size, Red, Green, Blue), cookie) + return Xf86vidmodeSetGammaRampCookie{cookie} +} + +func (c *Conn) Xf86vidmodeSetGammaRampChecked(Screen uint16, Size uint16, Red []uint16, Green []uint16, Blue []uint16) Xf86vidmodeSetGammaRampCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xf86vidmodeSetGammaRampRequest(Screen, Size, Red, Green, Blue), cookie) + return Xf86vidmodeSetGammaRampCookie{cookie} +} + +func (cook Xf86vidmodeSetGammaRampCookie) Check() error { + return cook.check() +} + +// Write request to wire for Xf86vidmodeSetGammaRamp +func (c *Conn) xf86vidmodeSetGammaRampRequest(Screen uint16, Size uint16, Red []uint16, Green []uint16, Blue []uint16) []byte { + size := pad((((8 + pad((((int(Size) + 1) & -2) * 2))) + pad((((int(Size) + 1) & -2) * 2))) + pad((((int(Size) + 1) & -2) * 2)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFREE86-VIDMODEEXTENSION"] + b += 1 + + buf[b] = 18 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put16(buf[b:], Screen) + b += 2 + + Put16(buf[b:], Size) + b += 2 + + for i := 0; i < int(((int(Size) + 1) & -2)); i++ { + Put16(buf[b:], Red[i]) + b += 2 + } + b = pad(b) + + for i := 0; i < int(((int(Size) + 1) & -2)); i++ { + Put16(buf[b:], Green[i]) + b += 2 + } + b = pad(b) + + for i := 0; i < int(((int(Size) + 1) & -2)); i++ { + Put16(buf[b:], Blue[i]) + b += 2 + } + b = pad(b) + + return buf +} + +// Request Xf86vidmodeGetGammaRampSize +// size: 8 +type Xf86vidmodeGetGammaRampSizeCookie struct { + *cookie +} + +func (c *Conn) Xf86vidmodeGetGammaRampSize(Screen uint16) Xf86vidmodeGetGammaRampSizeCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xf86vidmodeGetGammaRampSizeRequest(Screen), cookie) + return Xf86vidmodeGetGammaRampSizeCookie{cookie} +} + +func (c *Conn) Xf86vidmodeGetGammaRampSizeUnchecked(Screen uint16) Xf86vidmodeGetGammaRampSizeCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xf86vidmodeGetGammaRampSizeRequest(Screen), cookie) + return Xf86vidmodeGetGammaRampSizeCookie{cookie} +} + +// Request reply for Xf86vidmodeGetGammaRampSize +// size: 32 +type Xf86vidmodeGetGammaRampSizeReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Size uint16 + // padding: 22 bytes +} + +// Waits and reads reply data from request Xf86vidmodeGetGammaRampSize +func (cook Xf86vidmodeGetGammaRampSizeCookie) Reply() (*Xf86vidmodeGetGammaRampSizeReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xf86vidmodeGetGammaRampSizeReply(buf), nil +} + +// Read reply into structure from buffer for Xf86vidmodeGetGammaRampSize +func xf86vidmodeGetGammaRampSizeReply(buf []byte) *Xf86vidmodeGetGammaRampSizeReply { + v := new(Xf86vidmodeGetGammaRampSizeReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.Size = Get16(buf[b:]) + b += 2 + + b += 22 // padding + + return v +} + +func (cook Xf86vidmodeGetGammaRampSizeCookie) Check() error { + return cook.check() +} + +// Write request to wire for Xf86vidmodeGetGammaRampSize +func (c *Conn) xf86vidmodeGetGammaRampSizeRequest(Screen uint16) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFREE86-VIDMODEEXTENSION"] + b += 1 + + buf[b] = 19 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put16(buf[b:], Screen) + b += 2 + + b += 2 // padding + + return buf +} + +// Request Xf86vidmodeGetPermissions +// size: 8 +type Xf86vidmodeGetPermissionsCookie struct { + *cookie +} + +func (c *Conn) Xf86vidmodeGetPermissions(Screen uint16) Xf86vidmodeGetPermissionsCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xf86vidmodeGetPermissionsRequest(Screen), cookie) + return Xf86vidmodeGetPermissionsCookie{cookie} +} + +func (c *Conn) Xf86vidmodeGetPermissionsUnchecked(Screen uint16) Xf86vidmodeGetPermissionsCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xf86vidmodeGetPermissionsRequest(Screen), cookie) + return Xf86vidmodeGetPermissionsCookie{cookie} +} + +// Request reply for Xf86vidmodeGetPermissions +// size: 32 +type Xf86vidmodeGetPermissionsReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Permissions uint32 + // padding: 20 bytes +} + +// Waits and reads reply data from request Xf86vidmodeGetPermissions +func (cook Xf86vidmodeGetPermissionsCookie) Reply() (*Xf86vidmodeGetPermissionsReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xf86vidmodeGetPermissionsReply(buf), nil +} + +// Read reply into structure from buffer for Xf86vidmodeGetPermissions +func xf86vidmodeGetPermissionsReply(buf []byte) *Xf86vidmodeGetPermissionsReply { + v := new(Xf86vidmodeGetPermissionsReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.Permissions = Get32(buf[b:]) + b += 4 + + b += 20 // padding + + return v +} + +func (cook Xf86vidmodeGetPermissionsCookie) Check() error { + return cook.check() +} + +// Write request to wire for Xf86vidmodeGetPermissions +func (c *Conn) xf86vidmodeGetPermissionsRequest(Screen uint16) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFREE86-VIDMODEEXTENSION"] + b += 1 + + buf[b] = 20 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put16(buf[b:], Screen) + b += 2 + + b += 2 // padding + + return buf +} diff --git a/nexgb/auto_xfixes.go b/nexgb/auto_xfixes.go new file mode 100644 index 0000000..9f1d105 --- /dev/null +++ b/nexgb/auto_xfixes.go @@ -0,0 +1,2139 @@ +package xgb + +/* + This file was generated by xfixes.xml on May 6 2012 3:00:44am EDT. + This file is automatically generated. Edit at your peril! +*/ + +// Imports are not necessary for XGB because everything is +// in one package. They are still listed here for reference. +// import "xproto" +// import "render" +// import "shape" + +// Skipping definition for base type 'Card8' + +// Skipping definition for base type 'Int16' + +// Skipping definition for base type 'Int32' + +// Skipping definition for base type 'Void' + +// Skipping definition for base type 'Byte' + +// Skipping definition for base type 'Int8' + +// Skipping definition for base type 'Card16' + +// Skipping definition for base type 'Char' + +// Skipping definition for base type 'Card32' + +// Skipping definition for base type 'Double' + +// Skipping definition for base type 'Bool' + +// Skipping definition for base type 'Float' + +// Skipping definition for base type 'Id' + +const ( + XfixesSaveSetModeInsert = 0 + XfixesSaveSetModeDelete = 1 +) + +const ( + XfixesSaveSetTargetNearest = 0 + XfixesSaveSetTargetRoot = 1 +) + +const ( + XfixesSaveSetMappingMap = 0 + XfixesSaveSetMappingUnmap = 1 +) + +const ( + XfixesSelectionEventSetSelectionOwner = 0 + XfixesSelectionEventSelectionWindowDestroy = 1 + XfixesSelectionEventSelectionClientClose = 2 +) + +const ( + XfixesSelectionEventMaskSetSelectionOwner = 1 + XfixesSelectionEventMaskSelectionWindowDestroy = 2 + XfixesSelectionEventMaskSelectionClientClose = 4 +) + +const ( + XfixesCursorNotifyDisplayCursor = 0 +) + +const ( + XfixesCursorNotifyMaskDisplayCursor = 1 +) + +const ( + XfixesRegionNone = 0 +) + +// Skipping resource definition of 'Region' + +// Event definition XfixesSelectionNotify (0) +// Size: 32 + +const XfixesSelectionNotify = 0 + +type XfixesSelectionNotifyEvent struct { + Sequence uint16 + Subtype byte + Window Id + Owner Id + Selection Id + Timestamp Timestamp + SelectionTimestamp Timestamp + // padding: 8 bytes +} + +// Event read XfixesSelectionNotify +func NewXfixesSelectionNotifyEvent(buf []byte) Event { + v := XfixesSelectionNotifyEvent{} + b := 1 // don't read event number + + v.Subtype = buf[b] + b += 1 + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Window = Id(Get32(buf[b:])) + b += 4 + + v.Owner = Id(Get32(buf[b:])) + b += 4 + + v.Selection = Id(Get32(buf[b:])) + b += 4 + + v.Timestamp = Timestamp(Get32(buf[b:])) + b += 4 + + v.SelectionTimestamp = Timestamp(Get32(buf[b:])) + b += 4 + + b += 8 // padding + + return v +} + +// Event write XfixesSelectionNotify +func (v XfixesSelectionNotifyEvent) Bytes() []byte { + buf := make([]byte, 32) + b := 0 + + // write event number + buf[b] = 0 + b += 1 + + buf[b] = v.Subtype + b += 1 + + b += 2 // skip sequence number + + Put32(buf[b:], uint32(v.Window)) + b += 4 + + Put32(buf[b:], uint32(v.Owner)) + b += 4 + + Put32(buf[b:], uint32(v.Selection)) + b += 4 + + Put32(buf[b:], uint32(v.Timestamp)) + b += 4 + + Put32(buf[b:], uint32(v.SelectionTimestamp)) + b += 4 + + b += 8 // padding + + return buf +} + +func (v XfixesSelectionNotifyEvent) ImplementsEvent() {} + +func (v XfixesSelectionNotifyEvent) SequenceId() uint16 { + return v.Sequence +} + +func (v XfixesSelectionNotifyEvent) String() string { + fieldVals := make([]string, 0, 7) + fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) + fieldVals = append(fieldVals, sprintf("Subtype: %d", v.Subtype)) + fieldVals = append(fieldVals, sprintf("Window: %d", v.Window)) + fieldVals = append(fieldVals, sprintf("Owner: %d", v.Owner)) + fieldVals = append(fieldVals, sprintf("Selection: %d", v.Selection)) + fieldVals = append(fieldVals, sprintf("Timestamp: %d", v.Timestamp)) + fieldVals = append(fieldVals, sprintf("SelectionTimestamp: %d", v.SelectionTimestamp)) + return "XfixesSelectionNotify {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newEventFuncs[0] = NewXfixesSelectionNotifyEvent +} + +// Event definition XfixesCursorNotify (1) +// Size: 32 + +const XfixesCursorNotify = 1 + +type XfixesCursorNotifyEvent struct { + Sequence uint16 + Subtype byte + Window Id + CursorSerial uint32 + Timestamp Timestamp + Name Id + // padding: 12 bytes +} + +// Event read XfixesCursorNotify +func NewXfixesCursorNotifyEvent(buf []byte) Event { + v := XfixesCursorNotifyEvent{} + b := 1 // don't read event number + + v.Subtype = buf[b] + b += 1 + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Window = Id(Get32(buf[b:])) + b += 4 + + v.CursorSerial = Get32(buf[b:]) + b += 4 + + v.Timestamp = Timestamp(Get32(buf[b:])) + b += 4 + + v.Name = Id(Get32(buf[b:])) + b += 4 + + b += 12 // padding + + return v +} + +// Event write XfixesCursorNotify +func (v XfixesCursorNotifyEvent) Bytes() []byte { + buf := make([]byte, 32) + b := 0 + + // write event number + buf[b] = 1 + b += 1 + + buf[b] = v.Subtype + b += 1 + + b += 2 // skip sequence number + + Put32(buf[b:], uint32(v.Window)) + b += 4 + + Put32(buf[b:], v.CursorSerial) + b += 4 + + Put32(buf[b:], uint32(v.Timestamp)) + b += 4 + + Put32(buf[b:], uint32(v.Name)) + b += 4 + + b += 12 // padding + + return buf +} + +func (v XfixesCursorNotifyEvent) ImplementsEvent() {} + +func (v XfixesCursorNotifyEvent) SequenceId() uint16 { + return v.Sequence +} + +func (v XfixesCursorNotifyEvent) String() string { + fieldVals := make([]string, 0, 6) + fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) + fieldVals = append(fieldVals, sprintf("Subtype: %d", v.Subtype)) + fieldVals = append(fieldVals, sprintf("Window: %d", v.Window)) + fieldVals = append(fieldVals, sprintf("CursorSerial: %d", v.CursorSerial)) + fieldVals = append(fieldVals, sprintf("Timestamp: %d", v.Timestamp)) + fieldVals = append(fieldVals, sprintf("Name: %d", v.Name)) + return "XfixesCursorNotify {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newEventFuncs[1] = NewXfixesCursorNotifyEvent +} + +// Error definition XfixesBadRegion (0) +// Size: 32 + +const BadXfixesBadRegion = 0 + +type XfixesBadRegionError struct { + Sequence uint16 + NiceName string +} + +// Error read XfixesBadRegion +func NewXfixesBadRegionError(buf []byte) Error { + v := XfixesBadRegionError{} + v.NiceName = "XfixesBadRegion" + + b := 1 // skip error determinant + b += 1 // don't read error number + + v.Sequence = Get16(buf[b:]) + b += 2 + + return v +} + +func (err XfixesBadRegionError) ImplementsError() {} + +func (err XfixesBadRegionError) SequenceId() uint16 { + return err.Sequence +} + +func (err XfixesBadRegionError) BadId() Id { + return 0 +} + +func (err XfixesBadRegionError) Error() string { + fieldVals := make([]string, 0, 0) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) + return "BadXfixesBadRegion {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newErrorFuncs[0] = NewXfixesBadRegionError +} + +// Request XfixesQueryVersion +// size: 12 +type XfixesQueryVersionCookie struct { + *cookie +} + +func (c *Conn) XfixesQueryVersion(ClientMajorVersion uint32, ClientMinorVersion uint32) XfixesQueryVersionCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xfixesQueryVersionRequest(ClientMajorVersion, ClientMinorVersion), cookie) + return XfixesQueryVersionCookie{cookie} +} + +func (c *Conn) XfixesQueryVersionUnchecked(ClientMajorVersion uint32, ClientMinorVersion uint32) XfixesQueryVersionCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xfixesQueryVersionRequest(ClientMajorVersion, ClientMinorVersion), cookie) + return XfixesQueryVersionCookie{cookie} +} + +// Request reply for XfixesQueryVersion +// size: 32 +type XfixesQueryVersionReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + MajorVersion uint32 + MinorVersion uint32 + // padding: 16 bytes +} + +// Waits and reads reply data from request XfixesQueryVersion +func (cook XfixesQueryVersionCookie) Reply() (*XfixesQueryVersionReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xfixesQueryVersionReply(buf), nil +} + +// Read reply into structure from buffer for XfixesQueryVersion +func xfixesQueryVersionReply(buf []byte) *XfixesQueryVersionReply { + v := new(XfixesQueryVersionReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.MajorVersion = Get32(buf[b:]) + b += 4 + + v.MinorVersion = Get32(buf[b:]) + b += 4 + + b += 16 // padding + + return v +} + +func (cook XfixesQueryVersionCookie) Check() error { + return cook.check() +} + +// Write request to wire for XfixesQueryVersion +func (c *Conn) xfixesQueryVersionRequest(ClientMajorVersion uint32, ClientMinorVersion uint32) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFIXES"] + b += 1 + + buf[b] = 0 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], ClientMajorVersion) + b += 4 + + Put32(buf[b:], ClientMinorVersion) + b += 4 + + return buf +} + +// Request XfixesChangeSaveSet +// size: 12 +type XfixesChangeSaveSetCookie struct { + *cookie +} + +// Write request to wire for XfixesChangeSaveSet +func (c *Conn) XfixesChangeSaveSet(Mode byte, Target byte, Map byte, Window Id) XfixesChangeSaveSetCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xfixesChangeSaveSetRequest(Mode, Target, Map, Window), cookie) + return XfixesChangeSaveSetCookie{cookie} +} + +func (c *Conn) XfixesChangeSaveSetChecked(Mode byte, Target byte, Map byte, Window Id) XfixesChangeSaveSetCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xfixesChangeSaveSetRequest(Mode, Target, Map, Window), cookie) + return XfixesChangeSaveSetCookie{cookie} +} + +func (cook XfixesChangeSaveSetCookie) Check() error { + return cook.check() +} + +// Write request to wire for XfixesChangeSaveSet +func (c *Conn) xfixesChangeSaveSetRequest(Mode byte, Target byte, Map byte, Window Id) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFIXES"] + b += 1 + + buf[b] = 1 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = Mode + b += 1 + + buf[b] = Target + b += 1 + + buf[b] = Map + b += 1 + + b += 1 // padding + + Put32(buf[b:], uint32(Window)) + b += 4 + + return buf +} + +// Request XfixesSelectSelectionInput +// size: 16 +type XfixesSelectSelectionInputCookie struct { + *cookie +} + +// Write request to wire for XfixesSelectSelectionInput +func (c *Conn) XfixesSelectSelectionInput(Window Id, Selection Id, EventMask uint32) XfixesSelectSelectionInputCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xfixesSelectSelectionInputRequest(Window, Selection, EventMask), cookie) + return XfixesSelectSelectionInputCookie{cookie} +} + +func (c *Conn) XfixesSelectSelectionInputChecked(Window Id, Selection Id, EventMask uint32) XfixesSelectSelectionInputCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xfixesSelectSelectionInputRequest(Window, Selection, EventMask), cookie) + return XfixesSelectSelectionInputCookie{cookie} +} + +func (cook XfixesSelectSelectionInputCookie) Check() error { + return cook.check() +} + +// Write request to wire for XfixesSelectSelectionInput +func (c *Conn) xfixesSelectSelectionInputRequest(Window Id, Selection Id, EventMask uint32) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFIXES"] + b += 1 + + buf[b] = 2 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Window)) + b += 4 + + Put32(buf[b:], uint32(Selection)) + b += 4 + + Put32(buf[b:], EventMask) + b += 4 + + return buf +} + +// Request XfixesSelectCursorInput +// size: 12 +type XfixesSelectCursorInputCookie struct { + *cookie +} + +// Write request to wire for XfixesSelectCursorInput +func (c *Conn) XfixesSelectCursorInput(Window Id, EventMask uint32) XfixesSelectCursorInputCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xfixesSelectCursorInputRequest(Window, EventMask), cookie) + return XfixesSelectCursorInputCookie{cookie} +} + +func (c *Conn) XfixesSelectCursorInputChecked(Window Id, EventMask uint32) XfixesSelectCursorInputCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xfixesSelectCursorInputRequest(Window, EventMask), cookie) + return XfixesSelectCursorInputCookie{cookie} +} + +func (cook XfixesSelectCursorInputCookie) Check() error { + return cook.check() +} + +// Write request to wire for XfixesSelectCursorInput +func (c *Conn) xfixesSelectCursorInputRequest(Window Id, EventMask uint32) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFIXES"] + b += 1 + + buf[b] = 3 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Window)) + b += 4 + + Put32(buf[b:], EventMask) + b += 4 + + return buf +} + +// Request XfixesGetCursorImage +// size: 4 +type XfixesGetCursorImageCookie struct { + *cookie +} + +func (c *Conn) XfixesGetCursorImage() XfixesGetCursorImageCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xfixesGetCursorImageRequest(), cookie) + return XfixesGetCursorImageCookie{cookie} +} + +func (c *Conn) XfixesGetCursorImageUnchecked() XfixesGetCursorImageCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xfixesGetCursorImageRequest(), cookie) + return XfixesGetCursorImageCookie{cookie} +} + +// Request reply for XfixesGetCursorImage +// size: (32 + pad(((int(Width) * int(Height)) * 4))) +type XfixesGetCursorImageReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + X int16 + Y int16 + Width uint16 + Height uint16 + Xhot uint16 + Yhot uint16 + CursorSerial uint32 + // padding: 8 bytes + CursorImage []uint32 // size: pad(((int(Width) * int(Height)) * 4)) +} + +// Waits and reads reply data from request XfixesGetCursorImage +func (cook XfixesGetCursorImageCookie) Reply() (*XfixesGetCursorImageReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xfixesGetCursorImageReply(buf), nil +} + +// Read reply into structure from buffer for XfixesGetCursorImage +func xfixesGetCursorImageReply(buf []byte) *XfixesGetCursorImageReply { + v := new(XfixesGetCursorImageReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.X = int16(Get16(buf[b:])) + b += 2 + + v.Y = int16(Get16(buf[b:])) + b += 2 + + v.Width = Get16(buf[b:]) + b += 2 + + v.Height = Get16(buf[b:]) + b += 2 + + v.Xhot = Get16(buf[b:]) + b += 2 + + v.Yhot = Get16(buf[b:]) + b += 2 + + v.CursorSerial = Get32(buf[b:]) + b += 4 + + b += 8 // padding + + v.CursorImage = make([]uint32, (int(v.Width) * int(v.Height))) + for i := 0; i < int((int(v.Width) * int(v.Height))); i++ { + v.CursorImage[i] = Get32(buf[b:]) + b += 4 + } + b = pad(b) + + return v +} + +func (cook XfixesGetCursorImageCookie) Check() error { + return cook.check() +} + +// Write request to wire for XfixesGetCursorImage +func (c *Conn) xfixesGetCursorImageRequest() []byte { + size := 4 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFIXES"] + b += 1 + + buf[b] = 4 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + return buf +} + +// Request XfixesCreateRegion +// size: pad((8 + pad((len(Rectangles) * 8)))) +type XfixesCreateRegionCookie struct { + *cookie +} + +// Write request to wire for XfixesCreateRegion +func (c *Conn) XfixesCreateRegion(Region Id, Rectangles []Rectangle) XfixesCreateRegionCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xfixesCreateRegionRequest(Region, Rectangles), cookie) + return XfixesCreateRegionCookie{cookie} +} + +func (c *Conn) XfixesCreateRegionChecked(Region Id, Rectangles []Rectangle) XfixesCreateRegionCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xfixesCreateRegionRequest(Region, Rectangles), cookie) + return XfixesCreateRegionCookie{cookie} +} + +func (cook XfixesCreateRegionCookie) Check() error { + return cook.check() +} + +// Write request to wire for XfixesCreateRegion +func (c *Conn) xfixesCreateRegionRequest(Region Id, Rectangles []Rectangle) []byte { + size := pad((8 + pad((len(Rectangles) * 8)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFIXES"] + b += 1 + + buf[b] = 5 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Region)) + b += 4 + + b += RectangleListBytes(buf[b:], Rectangles) + + return buf +} + +// Request XfixesCreateRegionFromBitmap +// size: 12 +type XfixesCreateRegionFromBitmapCookie struct { + *cookie +} + +// Write request to wire for XfixesCreateRegionFromBitmap +func (c *Conn) XfixesCreateRegionFromBitmap(Region Id, Bitmap Id) XfixesCreateRegionFromBitmapCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xfixesCreateRegionFromBitmapRequest(Region, Bitmap), cookie) + return XfixesCreateRegionFromBitmapCookie{cookie} +} + +func (c *Conn) XfixesCreateRegionFromBitmapChecked(Region Id, Bitmap Id) XfixesCreateRegionFromBitmapCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xfixesCreateRegionFromBitmapRequest(Region, Bitmap), cookie) + return XfixesCreateRegionFromBitmapCookie{cookie} +} + +func (cook XfixesCreateRegionFromBitmapCookie) Check() error { + return cook.check() +} + +// Write request to wire for XfixesCreateRegionFromBitmap +func (c *Conn) xfixesCreateRegionFromBitmapRequest(Region Id, Bitmap Id) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFIXES"] + b += 1 + + buf[b] = 6 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Region)) + b += 4 + + Put32(buf[b:], uint32(Bitmap)) + b += 4 + + return buf +} + +// Request XfixesCreateRegionFromWindow +// size: 16 +type XfixesCreateRegionFromWindowCookie struct { + *cookie +} + +// Write request to wire for XfixesCreateRegionFromWindow +func (c *Conn) XfixesCreateRegionFromWindow(Region Id, Window Id, Kind ShapeKind) XfixesCreateRegionFromWindowCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xfixesCreateRegionFromWindowRequest(Region, Window, Kind), cookie) + return XfixesCreateRegionFromWindowCookie{cookie} +} + +func (c *Conn) XfixesCreateRegionFromWindowChecked(Region Id, Window Id, Kind ShapeKind) XfixesCreateRegionFromWindowCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xfixesCreateRegionFromWindowRequest(Region, Window, Kind), cookie) + return XfixesCreateRegionFromWindowCookie{cookie} +} + +func (cook XfixesCreateRegionFromWindowCookie) Check() error { + return cook.check() +} + +// Write request to wire for XfixesCreateRegionFromWindow +func (c *Conn) xfixesCreateRegionFromWindowRequest(Region Id, Window Id, Kind ShapeKind) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFIXES"] + b += 1 + + buf[b] = 7 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Region)) + b += 4 + + Put32(buf[b:], uint32(Window)) + b += 4 + + buf[b] = byte(Kind) + b += 1 + + b += 3 // padding + + return buf +} + +// Request XfixesCreateRegionFromGC +// size: 12 +type XfixesCreateRegionFromGCCookie struct { + *cookie +} + +// Write request to wire for XfixesCreateRegionFromGC +func (c *Conn) XfixesCreateRegionFromGC(Region Id, Gc Id) XfixesCreateRegionFromGCCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xfixesCreateRegionFromGCRequest(Region, Gc), cookie) + return XfixesCreateRegionFromGCCookie{cookie} +} + +func (c *Conn) XfixesCreateRegionFromGCChecked(Region Id, Gc Id) XfixesCreateRegionFromGCCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xfixesCreateRegionFromGCRequest(Region, Gc), cookie) + return XfixesCreateRegionFromGCCookie{cookie} +} + +func (cook XfixesCreateRegionFromGCCookie) Check() error { + return cook.check() +} + +// Write request to wire for XfixesCreateRegionFromGC +func (c *Conn) xfixesCreateRegionFromGCRequest(Region Id, Gc Id) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFIXES"] + b += 1 + + buf[b] = 8 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Region)) + b += 4 + + Put32(buf[b:], uint32(Gc)) + b += 4 + + return buf +} + +// Request XfixesCreateRegionFromPicture +// size: 12 +type XfixesCreateRegionFromPictureCookie struct { + *cookie +} + +// Write request to wire for XfixesCreateRegionFromPicture +func (c *Conn) XfixesCreateRegionFromPicture(Region Id, Picture Id) XfixesCreateRegionFromPictureCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xfixesCreateRegionFromPictureRequest(Region, Picture), cookie) + return XfixesCreateRegionFromPictureCookie{cookie} +} + +func (c *Conn) XfixesCreateRegionFromPictureChecked(Region Id, Picture Id) XfixesCreateRegionFromPictureCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xfixesCreateRegionFromPictureRequest(Region, Picture), cookie) + return XfixesCreateRegionFromPictureCookie{cookie} +} + +func (cook XfixesCreateRegionFromPictureCookie) Check() error { + return cook.check() +} + +// Write request to wire for XfixesCreateRegionFromPicture +func (c *Conn) xfixesCreateRegionFromPictureRequest(Region Id, Picture Id) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFIXES"] + b += 1 + + buf[b] = 9 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Region)) + b += 4 + + Put32(buf[b:], uint32(Picture)) + b += 4 + + return buf +} + +// Request XfixesDestroyRegion +// size: 8 +type XfixesDestroyRegionCookie struct { + *cookie +} + +// Write request to wire for XfixesDestroyRegion +func (c *Conn) XfixesDestroyRegion(Region Id) XfixesDestroyRegionCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xfixesDestroyRegionRequest(Region), cookie) + return XfixesDestroyRegionCookie{cookie} +} + +func (c *Conn) XfixesDestroyRegionChecked(Region Id) XfixesDestroyRegionCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xfixesDestroyRegionRequest(Region), cookie) + return XfixesDestroyRegionCookie{cookie} +} + +func (cook XfixesDestroyRegionCookie) Check() error { + return cook.check() +} + +// Write request to wire for XfixesDestroyRegion +func (c *Conn) xfixesDestroyRegionRequest(Region Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFIXES"] + b += 1 + + buf[b] = 10 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Region)) + b += 4 + + return buf +} + +// Request XfixesSetRegion +// size: pad((8 + pad((len(Rectangles) * 8)))) +type XfixesSetRegionCookie struct { + *cookie +} + +// Write request to wire for XfixesSetRegion +func (c *Conn) XfixesSetRegion(Region Id, Rectangles []Rectangle) XfixesSetRegionCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xfixesSetRegionRequest(Region, Rectangles), cookie) + return XfixesSetRegionCookie{cookie} +} + +func (c *Conn) XfixesSetRegionChecked(Region Id, Rectangles []Rectangle) XfixesSetRegionCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xfixesSetRegionRequest(Region, Rectangles), cookie) + return XfixesSetRegionCookie{cookie} +} + +func (cook XfixesSetRegionCookie) Check() error { + return cook.check() +} + +// Write request to wire for XfixesSetRegion +func (c *Conn) xfixesSetRegionRequest(Region Id, Rectangles []Rectangle) []byte { + size := pad((8 + pad((len(Rectangles) * 8)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFIXES"] + b += 1 + + buf[b] = 11 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Region)) + b += 4 + + b += RectangleListBytes(buf[b:], Rectangles) + + return buf +} + +// Request XfixesCopyRegion +// size: 12 +type XfixesCopyRegionCookie struct { + *cookie +} + +// Write request to wire for XfixesCopyRegion +func (c *Conn) XfixesCopyRegion(Source Id, Destination Id) XfixesCopyRegionCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xfixesCopyRegionRequest(Source, Destination), cookie) + return XfixesCopyRegionCookie{cookie} +} + +func (c *Conn) XfixesCopyRegionChecked(Source Id, Destination Id) XfixesCopyRegionCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xfixesCopyRegionRequest(Source, Destination), cookie) + return XfixesCopyRegionCookie{cookie} +} + +func (cook XfixesCopyRegionCookie) Check() error { + return cook.check() +} + +// Write request to wire for XfixesCopyRegion +func (c *Conn) xfixesCopyRegionRequest(Source Id, Destination Id) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFIXES"] + b += 1 + + buf[b] = 12 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Source)) + b += 4 + + Put32(buf[b:], uint32(Destination)) + b += 4 + + return buf +} + +// Request XfixesUnionRegion +// size: 16 +type XfixesUnionRegionCookie struct { + *cookie +} + +// Write request to wire for XfixesUnionRegion +func (c *Conn) XfixesUnionRegion(Source1 Id, Source2 Id, Destination Id) XfixesUnionRegionCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xfixesUnionRegionRequest(Source1, Source2, Destination), cookie) + return XfixesUnionRegionCookie{cookie} +} + +func (c *Conn) XfixesUnionRegionChecked(Source1 Id, Source2 Id, Destination Id) XfixesUnionRegionCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xfixesUnionRegionRequest(Source1, Source2, Destination), cookie) + return XfixesUnionRegionCookie{cookie} +} + +func (cook XfixesUnionRegionCookie) Check() error { + return cook.check() +} + +// Write request to wire for XfixesUnionRegion +func (c *Conn) xfixesUnionRegionRequest(Source1 Id, Source2 Id, Destination Id) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFIXES"] + b += 1 + + buf[b] = 13 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Source1)) + b += 4 + + Put32(buf[b:], uint32(Source2)) + b += 4 + + Put32(buf[b:], uint32(Destination)) + b += 4 + + return buf +} + +// Request XfixesIntersectRegion +// size: 16 +type XfixesIntersectRegionCookie struct { + *cookie +} + +// Write request to wire for XfixesIntersectRegion +func (c *Conn) XfixesIntersectRegion(Source1 Id, Source2 Id, Destination Id) XfixesIntersectRegionCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xfixesIntersectRegionRequest(Source1, Source2, Destination), cookie) + return XfixesIntersectRegionCookie{cookie} +} + +func (c *Conn) XfixesIntersectRegionChecked(Source1 Id, Source2 Id, Destination Id) XfixesIntersectRegionCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xfixesIntersectRegionRequest(Source1, Source2, Destination), cookie) + return XfixesIntersectRegionCookie{cookie} +} + +func (cook XfixesIntersectRegionCookie) Check() error { + return cook.check() +} + +// Write request to wire for XfixesIntersectRegion +func (c *Conn) xfixesIntersectRegionRequest(Source1 Id, Source2 Id, Destination Id) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFIXES"] + b += 1 + + buf[b] = 14 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Source1)) + b += 4 + + Put32(buf[b:], uint32(Source2)) + b += 4 + + Put32(buf[b:], uint32(Destination)) + b += 4 + + return buf +} + +// Request XfixesSubtractRegion +// size: 16 +type XfixesSubtractRegionCookie struct { + *cookie +} + +// Write request to wire for XfixesSubtractRegion +func (c *Conn) XfixesSubtractRegion(Source1 Id, Source2 Id, Destination Id) XfixesSubtractRegionCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xfixesSubtractRegionRequest(Source1, Source2, Destination), cookie) + return XfixesSubtractRegionCookie{cookie} +} + +func (c *Conn) XfixesSubtractRegionChecked(Source1 Id, Source2 Id, Destination Id) XfixesSubtractRegionCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xfixesSubtractRegionRequest(Source1, Source2, Destination), cookie) + return XfixesSubtractRegionCookie{cookie} +} + +func (cook XfixesSubtractRegionCookie) Check() error { + return cook.check() +} + +// Write request to wire for XfixesSubtractRegion +func (c *Conn) xfixesSubtractRegionRequest(Source1 Id, Source2 Id, Destination Id) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFIXES"] + b += 1 + + buf[b] = 15 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Source1)) + b += 4 + + Put32(buf[b:], uint32(Source2)) + b += 4 + + Put32(buf[b:], uint32(Destination)) + b += 4 + + return buf +} + +// Request XfixesInvertRegion +// size: 20 +type XfixesInvertRegionCookie struct { + *cookie +} + +// Write request to wire for XfixesInvertRegion +func (c *Conn) XfixesInvertRegion(Source Id, Bounds Rectangle, Destination Id) XfixesInvertRegionCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xfixesInvertRegionRequest(Source, Bounds, Destination), cookie) + return XfixesInvertRegionCookie{cookie} +} + +func (c *Conn) XfixesInvertRegionChecked(Source Id, Bounds Rectangle, Destination Id) XfixesInvertRegionCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xfixesInvertRegionRequest(Source, Bounds, Destination), cookie) + return XfixesInvertRegionCookie{cookie} +} + +func (cook XfixesInvertRegionCookie) Check() error { + return cook.check() +} + +// Write request to wire for XfixesInvertRegion +func (c *Conn) xfixesInvertRegionRequest(Source Id, Bounds Rectangle, Destination Id) []byte { + size := 20 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFIXES"] + b += 1 + + buf[b] = 16 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Source)) + b += 4 + + { + structBytes := Bounds.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + + Put32(buf[b:], uint32(Destination)) + b += 4 + + return buf +} + +// Request XfixesTranslateRegion +// size: 12 +type XfixesTranslateRegionCookie struct { + *cookie +} + +// Write request to wire for XfixesTranslateRegion +func (c *Conn) XfixesTranslateRegion(Region Id, Dx int16, Dy int16) XfixesTranslateRegionCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xfixesTranslateRegionRequest(Region, Dx, Dy), cookie) + return XfixesTranslateRegionCookie{cookie} +} + +func (c *Conn) XfixesTranslateRegionChecked(Region Id, Dx int16, Dy int16) XfixesTranslateRegionCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xfixesTranslateRegionRequest(Region, Dx, Dy), cookie) + return XfixesTranslateRegionCookie{cookie} +} + +func (cook XfixesTranslateRegionCookie) Check() error { + return cook.check() +} + +// Write request to wire for XfixesTranslateRegion +func (c *Conn) xfixesTranslateRegionRequest(Region Id, Dx int16, Dy int16) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFIXES"] + b += 1 + + buf[b] = 17 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Region)) + b += 4 + + Put16(buf[b:], uint16(Dx)) + b += 2 + + Put16(buf[b:], uint16(Dy)) + b += 2 + + return buf +} + +// Request XfixesRegionExtents +// size: 12 +type XfixesRegionExtentsCookie struct { + *cookie +} + +// Write request to wire for XfixesRegionExtents +func (c *Conn) XfixesRegionExtents(Source Id, Destination Id) XfixesRegionExtentsCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xfixesRegionExtentsRequest(Source, Destination), cookie) + return XfixesRegionExtentsCookie{cookie} +} + +func (c *Conn) XfixesRegionExtentsChecked(Source Id, Destination Id) XfixesRegionExtentsCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xfixesRegionExtentsRequest(Source, Destination), cookie) + return XfixesRegionExtentsCookie{cookie} +} + +func (cook XfixesRegionExtentsCookie) Check() error { + return cook.check() +} + +// Write request to wire for XfixesRegionExtents +func (c *Conn) xfixesRegionExtentsRequest(Source Id, Destination Id) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFIXES"] + b += 1 + + buf[b] = 18 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Source)) + b += 4 + + Put32(buf[b:], uint32(Destination)) + b += 4 + + return buf +} + +// Request XfixesFetchRegion +// size: 8 +type XfixesFetchRegionCookie struct { + *cookie +} + +func (c *Conn) XfixesFetchRegion(Region Id) XfixesFetchRegionCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xfixesFetchRegionRequest(Region), cookie) + return XfixesFetchRegionCookie{cookie} +} + +func (c *Conn) XfixesFetchRegionUnchecked(Region Id) XfixesFetchRegionCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xfixesFetchRegionRequest(Region), cookie) + return XfixesFetchRegionCookie{cookie} +} + +// Request reply for XfixesFetchRegion +// size: (32 + pad(((int(Length) / 2) * 8))) +type XfixesFetchRegionReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Extents Rectangle + // padding: 16 bytes + Rectangles []Rectangle // size: pad(((int(Length) / 2) * 8)) +} + +// Waits and reads reply data from request XfixesFetchRegion +func (cook XfixesFetchRegionCookie) Reply() (*XfixesFetchRegionReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xfixesFetchRegionReply(buf), nil +} + +// Read reply into structure from buffer for XfixesFetchRegion +func xfixesFetchRegionReply(buf []byte) *XfixesFetchRegionReply { + v := new(XfixesFetchRegionReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.Extents = Rectangle{} + b += ReadRectangle(buf[b:], &v.Extents) + + b += 16 // padding + + v.Rectangles = make([]Rectangle, (int(v.Length) / 2)) + b += ReadRectangleList(buf[b:], v.Rectangles) + + return v +} + +func (cook XfixesFetchRegionCookie) Check() error { + return cook.check() +} + +// Write request to wire for XfixesFetchRegion +func (c *Conn) xfixesFetchRegionRequest(Region Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFIXES"] + b += 1 + + buf[b] = 19 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Region)) + b += 4 + + return buf +} + +// Request XfixesSetGCClipRegion +// size: 16 +type XfixesSetGCClipRegionCookie struct { + *cookie +} + +// Write request to wire for XfixesSetGCClipRegion +func (c *Conn) XfixesSetGCClipRegion(Gc Id, Region Id, XOrigin int16, YOrigin int16) XfixesSetGCClipRegionCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xfixesSetGCClipRegionRequest(Gc, Region, XOrigin, YOrigin), cookie) + return XfixesSetGCClipRegionCookie{cookie} +} + +func (c *Conn) XfixesSetGCClipRegionChecked(Gc Id, Region Id, XOrigin int16, YOrigin int16) XfixesSetGCClipRegionCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xfixesSetGCClipRegionRequest(Gc, Region, XOrigin, YOrigin), cookie) + return XfixesSetGCClipRegionCookie{cookie} +} + +func (cook XfixesSetGCClipRegionCookie) Check() error { + return cook.check() +} + +// Write request to wire for XfixesSetGCClipRegion +func (c *Conn) xfixesSetGCClipRegionRequest(Gc Id, Region Id, XOrigin int16, YOrigin int16) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFIXES"] + b += 1 + + buf[b] = 20 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Gc)) + b += 4 + + Put32(buf[b:], uint32(Region)) + b += 4 + + Put16(buf[b:], uint16(XOrigin)) + b += 2 + + Put16(buf[b:], uint16(YOrigin)) + b += 2 + + return buf +} + +// Request XfixesSetWindowShapeRegion +// size: 20 +type XfixesSetWindowShapeRegionCookie struct { + *cookie +} + +// Write request to wire for XfixesSetWindowShapeRegion +func (c *Conn) XfixesSetWindowShapeRegion(Dest Id, DestKind ShapeKind, XOffset int16, YOffset int16, Region Id) XfixesSetWindowShapeRegionCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xfixesSetWindowShapeRegionRequest(Dest, DestKind, XOffset, YOffset, Region), cookie) + return XfixesSetWindowShapeRegionCookie{cookie} +} + +func (c *Conn) XfixesSetWindowShapeRegionChecked(Dest Id, DestKind ShapeKind, XOffset int16, YOffset int16, Region Id) XfixesSetWindowShapeRegionCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xfixesSetWindowShapeRegionRequest(Dest, DestKind, XOffset, YOffset, Region), cookie) + return XfixesSetWindowShapeRegionCookie{cookie} +} + +func (cook XfixesSetWindowShapeRegionCookie) Check() error { + return cook.check() +} + +// Write request to wire for XfixesSetWindowShapeRegion +func (c *Conn) xfixesSetWindowShapeRegionRequest(Dest Id, DestKind ShapeKind, XOffset int16, YOffset int16, Region Id) []byte { + size := 20 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFIXES"] + b += 1 + + buf[b] = 21 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Dest)) + b += 4 + + buf[b] = byte(DestKind) + b += 1 + + b += 3 // padding + + Put16(buf[b:], uint16(XOffset)) + b += 2 + + Put16(buf[b:], uint16(YOffset)) + b += 2 + + Put32(buf[b:], uint32(Region)) + b += 4 + + return buf +} + +// Request XfixesSetPictureClipRegion +// size: 16 +type XfixesSetPictureClipRegionCookie struct { + *cookie +} + +// Write request to wire for XfixesSetPictureClipRegion +func (c *Conn) XfixesSetPictureClipRegion(Picture Id, Region Id, XOrigin int16, YOrigin int16) XfixesSetPictureClipRegionCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xfixesSetPictureClipRegionRequest(Picture, Region, XOrigin, YOrigin), cookie) + return XfixesSetPictureClipRegionCookie{cookie} +} + +func (c *Conn) XfixesSetPictureClipRegionChecked(Picture Id, Region Id, XOrigin int16, YOrigin int16) XfixesSetPictureClipRegionCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xfixesSetPictureClipRegionRequest(Picture, Region, XOrigin, YOrigin), cookie) + return XfixesSetPictureClipRegionCookie{cookie} +} + +func (cook XfixesSetPictureClipRegionCookie) Check() error { + return cook.check() +} + +// Write request to wire for XfixesSetPictureClipRegion +func (c *Conn) xfixesSetPictureClipRegionRequest(Picture Id, Region Id, XOrigin int16, YOrigin int16) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFIXES"] + b += 1 + + buf[b] = 22 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Picture)) + b += 4 + + Put32(buf[b:], uint32(Region)) + b += 4 + + Put16(buf[b:], uint16(XOrigin)) + b += 2 + + Put16(buf[b:], uint16(YOrigin)) + b += 2 + + return buf +} + +// Request XfixesSetCursorName +// size: pad((12 + pad((int(Nbytes) * 1)))) +type XfixesSetCursorNameCookie struct { + *cookie +} + +// Write request to wire for XfixesSetCursorName +func (c *Conn) XfixesSetCursorName(Cursor Id, Nbytes uint16, Name string) XfixesSetCursorNameCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xfixesSetCursorNameRequest(Cursor, Nbytes, Name), cookie) + return XfixesSetCursorNameCookie{cookie} +} + +func (c *Conn) XfixesSetCursorNameChecked(Cursor Id, Nbytes uint16, Name string) XfixesSetCursorNameCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xfixesSetCursorNameRequest(Cursor, Nbytes, Name), cookie) + return XfixesSetCursorNameCookie{cookie} +} + +func (cook XfixesSetCursorNameCookie) Check() error { + return cook.check() +} + +// Write request to wire for XfixesSetCursorName +func (c *Conn) xfixesSetCursorNameRequest(Cursor Id, Nbytes uint16, Name string) []byte { + size := pad((12 + pad((int(Nbytes) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFIXES"] + b += 1 + + buf[b] = 23 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Cursor)) + b += 4 + + Put16(buf[b:], Nbytes) + b += 2 + + b += 2 // padding + + copy(buf[b:], Name[:Nbytes]) + b += pad(int(Nbytes)) + + return buf +} + +// Request XfixesGetCursorName +// size: 8 +type XfixesGetCursorNameCookie struct { + *cookie +} + +func (c *Conn) XfixesGetCursorName(Cursor Id) XfixesGetCursorNameCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xfixesGetCursorNameRequest(Cursor), cookie) + return XfixesGetCursorNameCookie{cookie} +} + +func (c *Conn) XfixesGetCursorNameUnchecked(Cursor Id) XfixesGetCursorNameCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xfixesGetCursorNameRequest(Cursor), cookie) + return XfixesGetCursorNameCookie{cookie} +} + +// Request reply for XfixesGetCursorName +// size: (32 + pad((int(Nbytes) * 1))) +type XfixesGetCursorNameReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Atom Id + Nbytes uint16 + // padding: 18 bytes + Name string // size: pad((int(Nbytes) * 1)) +} + +// Waits and reads reply data from request XfixesGetCursorName +func (cook XfixesGetCursorNameCookie) Reply() (*XfixesGetCursorNameReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xfixesGetCursorNameReply(buf), nil +} + +// Read reply into structure from buffer for XfixesGetCursorName +func xfixesGetCursorNameReply(buf []byte) *XfixesGetCursorNameReply { + v := new(XfixesGetCursorNameReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.Atom = Id(Get32(buf[b:])) + b += 4 + + v.Nbytes = Get16(buf[b:]) + b += 2 + + b += 18 // padding + + { + byteString := make([]byte, v.Nbytes) + copy(byteString[:v.Nbytes], buf[b:]) + v.Name = string(byteString) + b += pad(int(v.Nbytes)) + } + + return v +} + +func (cook XfixesGetCursorNameCookie) Check() error { + return cook.check() +} + +// Write request to wire for XfixesGetCursorName +func (c *Conn) xfixesGetCursorNameRequest(Cursor Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFIXES"] + b += 1 + + buf[b] = 24 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Cursor)) + b += 4 + + return buf +} + +// Request XfixesGetCursorImageAndName +// size: 4 +type XfixesGetCursorImageAndNameCookie struct { + *cookie +} + +func (c *Conn) XfixesGetCursorImageAndName() XfixesGetCursorImageAndNameCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xfixesGetCursorImageAndNameRequest(), cookie) + return XfixesGetCursorImageAndNameCookie{cookie} +} + +func (c *Conn) XfixesGetCursorImageAndNameUnchecked() XfixesGetCursorImageAndNameCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xfixesGetCursorImageAndNameRequest(), cookie) + return XfixesGetCursorImageAndNameCookie{cookie} +} + +// Request reply for XfixesGetCursorImageAndName +// size: ((32 + pad((int(Nbytes) * 1))) + pad(((int(Width) * int(Height)) * 4))) +type XfixesGetCursorImageAndNameReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + X int16 + Y int16 + Width uint16 + Height uint16 + Xhot uint16 + Yhot uint16 + CursorSerial uint32 + CursorAtom Id + Nbytes uint16 + // padding: 2 bytes + Name string // size: pad((int(Nbytes) * 1)) + CursorImage []uint32 // size: pad(((int(Width) * int(Height)) * 4)) +} + +// Waits and reads reply data from request XfixesGetCursorImageAndName +func (cook XfixesGetCursorImageAndNameCookie) Reply() (*XfixesGetCursorImageAndNameReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xfixesGetCursorImageAndNameReply(buf), nil +} + +// Read reply into structure from buffer for XfixesGetCursorImageAndName +func xfixesGetCursorImageAndNameReply(buf []byte) *XfixesGetCursorImageAndNameReply { + v := new(XfixesGetCursorImageAndNameReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.X = int16(Get16(buf[b:])) + b += 2 + + v.Y = int16(Get16(buf[b:])) + b += 2 + + v.Width = Get16(buf[b:]) + b += 2 + + v.Height = Get16(buf[b:]) + b += 2 + + v.Xhot = Get16(buf[b:]) + b += 2 + + v.Yhot = Get16(buf[b:]) + b += 2 + + v.CursorSerial = Get32(buf[b:]) + b += 4 + + v.CursorAtom = Id(Get32(buf[b:])) + b += 4 + + v.Nbytes = Get16(buf[b:]) + b += 2 + + b += 2 // padding + + { + byteString := make([]byte, v.Nbytes) + copy(byteString[:v.Nbytes], buf[b:]) + v.Name = string(byteString) + b += pad(int(v.Nbytes)) + } + + v.CursorImage = make([]uint32, (int(v.Width) * int(v.Height))) + for i := 0; i < int((int(v.Width) * int(v.Height))); i++ { + v.CursorImage[i] = Get32(buf[b:]) + b += 4 + } + b = pad(b) + + return v +} + +func (cook XfixesGetCursorImageAndNameCookie) Check() error { + return cook.check() +} + +// Write request to wire for XfixesGetCursorImageAndName +func (c *Conn) xfixesGetCursorImageAndNameRequest() []byte { + size := 4 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFIXES"] + b += 1 + + buf[b] = 25 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + return buf +} + +// Request XfixesChangeCursor +// size: 12 +type XfixesChangeCursorCookie struct { + *cookie +} + +// Write request to wire for XfixesChangeCursor +func (c *Conn) XfixesChangeCursor(Source Id, Destination Id) XfixesChangeCursorCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xfixesChangeCursorRequest(Source, Destination), cookie) + return XfixesChangeCursorCookie{cookie} +} + +func (c *Conn) XfixesChangeCursorChecked(Source Id, Destination Id) XfixesChangeCursorCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xfixesChangeCursorRequest(Source, Destination), cookie) + return XfixesChangeCursorCookie{cookie} +} + +func (cook XfixesChangeCursorCookie) Check() error { + return cook.check() +} + +// Write request to wire for XfixesChangeCursor +func (c *Conn) xfixesChangeCursorRequest(Source Id, Destination Id) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFIXES"] + b += 1 + + buf[b] = 26 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Source)) + b += 4 + + Put32(buf[b:], uint32(Destination)) + b += 4 + + return buf +} + +// Request XfixesChangeCursorByName +// size: pad((12 + pad((int(Nbytes) * 1)))) +type XfixesChangeCursorByNameCookie struct { + *cookie +} + +// Write request to wire for XfixesChangeCursorByName +func (c *Conn) XfixesChangeCursorByName(Src Id, Nbytes uint16, Name string) XfixesChangeCursorByNameCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xfixesChangeCursorByNameRequest(Src, Nbytes, Name), cookie) + return XfixesChangeCursorByNameCookie{cookie} +} + +func (c *Conn) XfixesChangeCursorByNameChecked(Src Id, Nbytes uint16, Name string) XfixesChangeCursorByNameCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xfixesChangeCursorByNameRequest(Src, Nbytes, Name), cookie) + return XfixesChangeCursorByNameCookie{cookie} +} + +func (cook XfixesChangeCursorByNameCookie) Check() error { + return cook.check() +} + +// Write request to wire for XfixesChangeCursorByName +func (c *Conn) xfixesChangeCursorByNameRequest(Src Id, Nbytes uint16, Name string) []byte { + size := pad((12 + pad((int(Nbytes) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFIXES"] + b += 1 + + buf[b] = 27 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Src)) + b += 4 + + Put16(buf[b:], Nbytes) + b += 2 + + b += 2 // padding + + copy(buf[b:], Name[:Nbytes]) + b += pad(int(Nbytes)) + + return buf +} + +// Request XfixesExpandRegion +// size: 20 +type XfixesExpandRegionCookie struct { + *cookie +} + +// Write request to wire for XfixesExpandRegion +func (c *Conn) XfixesExpandRegion(Source Id, Destination Id, Left uint16, Right uint16, Top uint16, Bottom uint16) XfixesExpandRegionCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xfixesExpandRegionRequest(Source, Destination, Left, Right, Top, Bottom), cookie) + return XfixesExpandRegionCookie{cookie} +} + +func (c *Conn) XfixesExpandRegionChecked(Source Id, Destination Id, Left uint16, Right uint16, Top uint16, Bottom uint16) XfixesExpandRegionCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xfixesExpandRegionRequest(Source, Destination, Left, Right, Top, Bottom), cookie) + return XfixesExpandRegionCookie{cookie} +} + +func (cook XfixesExpandRegionCookie) Check() error { + return cook.check() +} + +// Write request to wire for XfixesExpandRegion +func (c *Conn) xfixesExpandRegionRequest(Source Id, Destination Id, Left uint16, Right uint16, Top uint16, Bottom uint16) []byte { + size := 20 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFIXES"] + b += 1 + + buf[b] = 28 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Source)) + b += 4 + + Put32(buf[b:], uint32(Destination)) + b += 4 + + Put16(buf[b:], Left) + b += 2 + + Put16(buf[b:], Right) + b += 2 + + Put16(buf[b:], Top) + b += 2 + + Put16(buf[b:], Bottom) + b += 2 + + return buf +} + +// Request XfixesHideCursor +// size: 8 +type XfixesHideCursorCookie struct { + *cookie +} + +// Write request to wire for XfixesHideCursor +func (c *Conn) XfixesHideCursor(Window Id) XfixesHideCursorCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xfixesHideCursorRequest(Window), cookie) + return XfixesHideCursorCookie{cookie} +} + +func (c *Conn) XfixesHideCursorChecked(Window Id) XfixesHideCursorCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xfixesHideCursorRequest(Window), cookie) + return XfixesHideCursorCookie{cookie} +} + +func (cook XfixesHideCursorCookie) Check() error { + return cook.check() +} + +// Write request to wire for XfixesHideCursor +func (c *Conn) xfixesHideCursorRequest(Window Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFIXES"] + b += 1 + + buf[b] = 29 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Window)) + b += 4 + + return buf +} + +// Request XfixesShowCursor +// size: 8 +type XfixesShowCursorCookie struct { + *cookie +} + +// Write request to wire for XfixesShowCursor +func (c *Conn) XfixesShowCursor(Window Id) XfixesShowCursorCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xfixesShowCursorRequest(Window), cookie) + return XfixesShowCursorCookie{cookie} +} + +func (c *Conn) XfixesShowCursorChecked(Window Id) XfixesShowCursorCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xfixesShowCursorRequest(Window), cookie) + return XfixesShowCursorCookie{cookie} +} + +func (cook XfixesShowCursorCookie) Check() error { + return cook.check() +} + +// Write request to wire for XfixesShowCursor +func (c *Conn) xfixesShowCursorRequest(Window Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XFIXES"] + b += 1 + + buf[b] = 30 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Window)) + b += 4 + + return buf +} diff --git a/nexgb/auto_xinerama.go b/nexgb/auto_xinerama.go index c2e031c..6c08447 100644 --- a/nexgb/auto_xinerama.go +++ b/nexgb/auto_xinerama.go @@ -1,7 +1,7 @@ package xgb /* - This file was generated by xinerama.xml on May 5 2012 5:56:52pm EDT. + This file was generated by xinerama.xml on May 6 2012 3:00:45am EDT. This file is automatically generated. Edit at your peril! */ @@ -9,6 +9,16 @@ package xgb // in one package. They are still listed here for reference. // import "xproto" +// Skipping definition for base type 'Float' + +// Skipping definition for base type 'Id' + +// Skipping definition for base type 'Card8' + +// Skipping definition for base type 'Int16' + +// Skipping definition for base type 'Int32' + // Skipping definition for base type 'Void' // Skipping definition for base type 'Byte' @@ -25,16 +35,6 @@ package xgb // Skipping definition for base type 'Bool' -// Skipping definition for base type 'Float' - -// Skipping definition for base type 'Id' - -// Skipping definition for base type 'Card8' - -// Skipping definition for base type 'Int16' - -// Skipping definition for base type 'Int32' - // 'XineramaScreenInfo' struct definition // Size: 8 type XineramaScreenInfo struct { @@ -183,12 +183,12 @@ func (c *Conn) xineramaQueryVersionRequest(Major byte, Minor byte) []byte { buf[b] = 0 // request opcode b += 1 - buf[b] = Major - b += 1 - Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 + buf[b] = Major + b += 1 + buf[b] = Minor b += 1 @@ -270,12 +270,12 @@ func (c *Conn) xineramaGetStateRequest(Window Id) []byte { buf[b] = 1 // request opcode b += 1 - Put32(buf[b:], uint32(Window)) - b += 4 - Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 + Put32(buf[b:], uint32(Window)) + b += 4 + return buf } @@ -354,12 +354,12 @@ func (c *Conn) xineramaGetScreenCountRequest(Window Id) []byte { buf[b] = 2 // request opcode b += 1 - Put32(buf[b:], uint32(Window)) - b += 4 - Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 + Put32(buf[b:], uint32(Window)) + b += 4 + return buf } @@ -449,12 +449,12 @@ func (c *Conn) xineramaGetScreenSizeRequest(Window Id, Screen uint32) []byte { buf[b] = 3 // request opcode b += 1 - Put32(buf[b:], uint32(Window)) - b += 4 - Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 + Put32(buf[b:], uint32(Window)) + b += 4 + Put32(buf[b:], Screen) b += 4 diff --git a/nexgb/auto_xinput.go b/nexgb/auto_xinput.go new file mode 100644 index 0000000..d300bca --- /dev/null +++ b/nexgb/auto_xinput.go @@ -0,0 +1,7271 @@ +package xgb + +/* + This file was generated by xinput.xml on May 6 2012 3:00:45am EDT. + This file is automatically generated. Edit at your peril! +*/ + +// Imports are not necessary for XGB because everything is +// in one package. They are still listed here for reference. +// import "xproto" + +// Skipping definition for base type 'Float' + +// Skipping definition for base type 'Id' + +// Skipping definition for base type 'Card8' + +// Skipping definition for base type 'Int16' + +// Skipping definition for base type 'Int32' + +// Skipping definition for base type 'Void' + +// Skipping definition for base type 'Byte' + +// Skipping definition for base type 'Int8' + +// Skipping definition for base type 'Card16' + +// Skipping definition for base type 'Char' + +// Skipping definition for base type 'Card32' + +// Skipping definition for base type 'Double' + +// Skipping definition for base type 'Bool' + +const ( + XinputValuatorModeRelative = 0 + XinputValuatorModeAbsolute = 1 +) + +const ( + XinputPropagateModeAddToList = 0 + XinputPropagateModeDeleteFromList = 1 +) + +const ( + XinputDeviceUseIsXPointer = 0 + XinputDeviceUseIsXKeyboard = 1 + XinputDeviceUseIsXExtensionDevice = 2 + XinputDeviceUseIsXExtensionKeyboard = 3 + XinputDeviceUseIsXExtensionPointer = 4 +) + +const ( + XinputInputClassKey = 0 + XinputInputClassButton = 1 + XinputInputClassValuator = 2 + XinputInputClassFeedback = 3 + XinputInputClassProximity = 4 + XinputInputClassFocus = 5 + XinputInputClassOther = 6 +) + +const ( + XinputDeviceInputModeAsyncThisDevice = 0 + XinputDeviceInputModeSyncThisDevice = 1 + XinputDeviceInputModeReplayThisDevice = 2 + XinputDeviceInputModeAsyncOtherDevices = 3 + XinputDeviceInputModeAsyncAll = 4 + XinputDeviceInputModeSyncAll = 5 +) + +const ( + XinputFeedbackClassKeyboard = 0 + XinputFeedbackClassPointer = 1 + XinputFeedbackClassString = 2 + XinputFeedbackClassInteger = 3 + XinputFeedbackClassLed = 4 + XinputFeedbackClassBell = 5 +) + +type XinputKeyCode byte + +type XinputEventClass uint32 + +// 'XinputDeviceInfo' struct definition +// Size: 8 +type XinputDeviceInfo struct { + DeviceType Id + DeviceId byte + NumClassInfo byte + DeviceUse byte + // padding: 1 bytes +} + +// Struct read XinputDeviceInfo +func ReadXinputDeviceInfo(buf []byte, v *XinputDeviceInfo) int { + b := 0 + + v.DeviceType = Id(Get32(buf[b:])) + b += 4 + + v.DeviceId = buf[b] + b += 1 + + v.NumClassInfo = buf[b] + b += 1 + + v.DeviceUse = buf[b] + b += 1 + + b += 1 // padding + + return b +} + +// Struct list read XinputDeviceInfo +func ReadXinputDeviceInfoList(buf []byte, dest []XinputDeviceInfo) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XinputDeviceInfo{} + b += ReadXinputDeviceInfo(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XinputDeviceInfo +func (v XinputDeviceInfo) Bytes() []byte { + buf := make([]byte, 8) + b := 0 + + Put32(buf[b:], uint32(v.DeviceType)) + b += 4 + + buf[b] = v.DeviceId + b += 1 + + buf[b] = v.NumClassInfo + b += 1 + + buf[b] = v.DeviceUse + b += 1 + + b += 1 // padding + + return buf +} + +// Write struct list XinputDeviceInfo +func XinputDeviceInfoListBytes(buf []byte, list []XinputDeviceInfo) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'XinputInputInfo' struct definition +// Size: 2 +type XinputInputInfo struct { + ClassId byte + Len byte +} + +// Struct read XinputInputInfo +func ReadXinputInputInfo(buf []byte, v *XinputInputInfo) int { + b := 0 + + v.ClassId = buf[b] + b += 1 + + v.Len = buf[b] + b += 1 + + return b +} + +// Struct list read XinputInputInfo +func ReadXinputInputInfoList(buf []byte, dest []XinputInputInfo) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XinputInputInfo{} + b += ReadXinputInputInfo(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XinputInputInfo +func (v XinputInputInfo) Bytes() []byte { + buf := make([]byte, 2) + b := 0 + + buf[b] = v.ClassId + b += 1 + + buf[b] = v.Len + b += 1 + + return buf +} + +// Write struct list XinputInputInfo +func XinputInputInfoListBytes(buf []byte, list []XinputInputInfo) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'XinputKeyInfo' struct definition +// Size: 8 +type XinputKeyInfo struct { + ClassId byte + Len byte + MinKeycode XinputKeyCode + MaxKeycode XinputKeyCode + NumKeys uint16 + // padding: 2 bytes +} + +// Struct read XinputKeyInfo +func ReadXinputKeyInfo(buf []byte, v *XinputKeyInfo) int { + b := 0 + + v.ClassId = buf[b] + b += 1 + + v.Len = buf[b] + b += 1 + + v.MinKeycode = XinputKeyCode(buf[b]) + b += 1 + + v.MaxKeycode = XinputKeyCode(buf[b]) + b += 1 + + v.NumKeys = Get16(buf[b:]) + b += 2 + + b += 2 // padding + + return b +} + +// Struct list read XinputKeyInfo +func ReadXinputKeyInfoList(buf []byte, dest []XinputKeyInfo) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XinputKeyInfo{} + b += ReadXinputKeyInfo(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XinputKeyInfo +func (v XinputKeyInfo) Bytes() []byte { + buf := make([]byte, 8) + b := 0 + + buf[b] = v.ClassId + b += 1 + + buf[b] = v.Len + b += 1 + + buf[b] = byte(v.MinKeycode) + b += 1 + + buf[b] = byte(v.MaxKeycode) + b += 1 + + Put16(buf[b:], v.NumKeys) + b += 2 + + b += 2 // padding + + return buf +} + +// Write struct list XinputKeyInfo +func XinputKeyInfoListBytes(buf []byte, list []XinputKeyInfo) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'XinputButtonInfo' struct definition +// Size: 4 +type XinputButtonInfo struct { + ClassId byte + Len byte + NumButtons uint16 +} + +// Struct read XinputButtonInfo +func ReadXinputButtonInfo(buf []byte, v *XinputButtonInfo) int { + b := 0 + + v.ClassId = buf[b] + b += 1 + + v.Len = buf[b] + b += 1 + + v.NumButtons = Get16(buf[b:]) + b += 2 + + return b +} + +// Struct list read XinputButtonInfo +func ReadXinputButtonInfoList(buf []byte, dest []XinputButtonInfo) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XinputButtonInfo{} + b += ReadXinputButtonInfo(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XinputButtonInfo +func (v XinputButtonInfo) Bytes() []byte { + buf := make([]byte, 4) + b := 0 + + buf[b] = v.ClassId + b += 1 + + buf[b] = v.Len + b += 1 + + Put16(buf[b:], v.NumButtons) + b += 2 + + return buf +} + +// Write struct list XinputButtonInfo +func XinputButtonInfoListBytes(buf []byte, list []XinputButtonInfo) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'XinputAxisInfo' struct definition +// Size: 12 +type XinputAxisInfo struct { + Resolution uint32 + Minimum int32 + Maximum int32 +} + +// Struct read XinputAxisInfo +func ReadXinputAxisInfo(buf []byte, v *XinputAxisInfo) int { + b := 0 + + v.Resolution = Get32(buf[b:]) + b += 4 + + v.Minimum = int32(Get32(buf[b:])) + b += 4 + + v.Maximum = int32(Get32(buf[b:])) + b += 4 + + return b +} + +// Struct list read XinputAxisInfo +func ReadXinputAxisInfoList(buf []byte, dest []XinputAxisInfo) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XinputAxisInfo{} + b += ReadXinputAxisInfo(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XinputAxisInfo +func (v XinputAxisInfo) Bytes() []byte { + buf := make([]byte, 12) + b := 0 + + Put32(buf[b:], v.Resolution) + b += 4 + + Put32(buf[b:], uint32(v.Minimum)) + b += 4 + + Put32(buf[b:], uint32(v.Maximum)) + b += 4 + + return buf +} + +// Write struct list XinputAxisInfo +func XinputAxisInfoListBytes(buf []byte, list []XinputAxisInfo) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'XinputValuatorInfo' struct definition +// Size: (8 + pad((int(AxesLen) * 12))) +type XinputValuatorInfo struct { + ClassId byte + Len byte + AxesLen byte + Mode byte + MotionSize uint32 + Axes []XinputAxisInfo // size: pad((int(AxesLen) * 12)) +} + +// Struct read XinputValuatorInfo +func ReadXinputValuatorInfo(buf []byte, v *XinputValuatorInfo) int { + b := 0 + + v.ClassId = buf[b] + b += 1 + + v.Len = buf[b] + b += 1 + + v.AxesLen = buf[b] + b += 1 + + v.Mode = buf[b] + b += 1 + + v.MotionSize = Get32(buf[b:]) + b += 4 + + v.Axes = make([]XinputAxisInfo, v.AxesLen) + b += ReadXinputAxisInfoList(buf[b:], v.Axes) + + return b +} + +// Struct list read XinputValuatorInfo +func ReadXinputValuatorInfoList(buf []byte, dest []XinputValuatorInfo) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XinputValuatorInfo{} + b += ReadXinputValuatorInfo(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XinputValuatorInfo +func (v XinputValuatorInfo) Bytes() []byte { + buf := make([]byte, (8 + pad((int(v.AxesLen) * 12)))) + b := 0 + + buf[b] = v.ClassId + b += 1 + + buf[b] = v.Len + b += 1 + + buf[b] = v.AxesLen + b += 1 + + buf[b] = v.Mode + b += 1 + + Put32(buf[b:], v.MotionSize) + b += 4 + + b += XinputAxisInfoListBytes(buf[b:], v.Axes) + + return buf +} + +// Write struct list XinputValuatorInfo +func XinputValuatorInfoListBytes(buf []byte, list []XinputValuatorInfo) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// Struct list size XinputValuatorInfo +func XinputValuatorInfoListSize(list []XinputValuatorInfo) int { + size := 0 + for _, item := range list { + size += (8 + pad((int(item.AxesLen) * 12))) + } + return size +} + +// 'XinputInputClassInfo' struct definition +// Size: 2 +type XinputInputClassInfo struct { + ClassId byte + EventTypeBase byte +} + +// Struct read XinputInputClassInfo +func ReadXinputInputClassInfo(buf []byte, v *XinputInputClassInfo) int { + b := 0 + + v.ClassId = buf[b] + b += 1 + + v.EventTypeBase = buf[b] + b += 1 + + return b +} + +// Struct list read XinputInputClassInfo +func ReadXinputInputClassInfoList(buf []byte, dest []XinputInputClassInfo) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XinputInputClassInfo{} + b += ReadXinputInputClassInfo(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XinputInputClassInfo +func (v XinputInputClassInfo) Bytes() []byte { + buf := make([]byte, 2) + b := 0 + + buf[b] = v.ClassId + b += 1 + + buf[b] = v.EventTypeBase + b += 1 + + return buf +} + +// Write struct list XinputInputClassInfo +func XinputInputClassInfoListBytes(buf []byte, list []XinputInputClassInfo) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'XinputDeviceTimeCoord' struct definition +// Size: 4 +type XinputDeviceTimeCoord struct { + Time Timestamp +} + +// Struct read XinputDeviceTimeCoord +func ReadXinputDeviceTimeCoord(buf []byte, v *XinputDeviceTimeCoord) int { + b := 0 + + v.Time = Timestamp(Get32(buf[b:])) + b += 4 + + return b +} + +// Struct list read XinputDeviceTimeCoord +func ReadXinputDeviceTimeCoordList(buf []byte, dest []XinputDeviceTimeCoord) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XinputDeviceTimeCoord{} + b += ReadXinputDeviceTimeCoord(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XinputDeviceTimeCoord +func (v XinputDeviceTimeCoord) Bytes() []byte { + buf := make([]byte, 4) + b := 0 + + Put32(buf[b:], uint32(v.Time)) + b += 4 + + return buf +} + +// Write struct list XinputDeviceTimeCoord +func XinputDeviceTimeCoordListBytes(buf []byte, list []XinputDeviceTimeCoord) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'XinputFeedbackState' struct definition +// Size: 4 +type XinputFeedbackState struct { + ClassId byte + Id byte + Len uint16 +} + +// Struct read XinputFeedbackState +func ReadXinputFeedbackState(buf []byte, v *XinputFeedbackState) int { + b := 0 + + v.ClassId = buf[b] + b += 1 + + v.Id = buf[b] + b += 1 + + v.Len = Get16(buf[b:]) + b += 2 + + return b +} + +// Struct list read XinputFeedbackState +func ReadXinputFeedbackStateList(buf []byte, dest []XinputFeedbackState) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XinputFeedbackState{} + b += ReadXinputFeedbackState(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XinputFeedbackState +func (v XinputFeedbackState) Bytes() []byte { + buf := make([]byte, 4) + b := 0 + + buf[b] = v.ClassId + b += 1 + + buf[b] = v.Id + b += 1 + + Put16(buf[b:], v.Len) + b += 2 + + return buf +} + +// Write struct list XinputFeedbackState +func XinputFeedbackStateListBytes(buf []byte, list []XinputFeedbackState) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'XinputKbdFeedbackState' struct definition +// Size: 52 +type XinputKbdFeedbackState struct { + ClassId byte + Id byte + Len uint16 + Pitch uint16 + Duration uint16 + LedMask uint32 + LedValues uint32 + GlobalAutoRepeat bool + Click byte + Percent byte + // padding: 1 bytes + AutoRepeats []byte // size: 32 +} + +// Struct read XinputKbdFeedbackState +func ReadXinputKbdFeedbackState(buf []byte, v *XinputKbdFeedbackState) int { + b := 0 + + v.ClassId = buf[b] + b += 1 + + v.Id = buf[b] + b += 1 + + v.Len = Get16(buf[b:]) + b += 2 + + v.Pitch = Get16(buf[b:]) + b += 2 + + v.Duration = Get16(buf[b:]) + b += 2 + + v.LedMask = Get32(buf[b:]) + b += 4 + + v.LedValues = Get32(buf[b:]) + b += 4 + + if buf[b] == 1 { + v.GlobalAutoRepeat = true + } else { + v.GlobalAutoRepeat = false + } + b += 1 + + v.Click = buf[b] + b += 1 + + v.Percent = buf[b] + b += 1 + + b += 1 // padding + + v.AutoRepeats = make([]byte, 32) + copy(v.AutoRepeats[:32], buf[b:]) + b += pad(int(32)) + + return b +} + +// Struct list read XinputKbdFeedbackState +func ReadXinputKbdFeedbackStateList(buf []byte, dest []XinputKbdFeedbackState) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XinputKbdFeedbackState{} + b += ReadXinputKbdFeedbackState(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XinputKbdFeedbackState +func (v XinputKbdFeedbackState) Bytes() []byte { + buf := make([]byte, 52) + b := 0 + + buf[b] = v.ClassId + b += 1 + + buf[b] = v.Id + b += 1 + + Put16(buf[b:], v.Len) + b += 2 + + Put16(buf[b:], v.Pitch) + b += 2 + + Put16(buf[b:], v.Duration) + b += 2 + + Put32(buf[b:], v.LedMask) + b += 4 + + Put32(buf[b:], v.LedValues) + b += 4 + + if v.GlobalAutoRepeat { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + buf[b] = v.Click + b += 1 + + buf[b] = v.Percent + b += 1 + + b += 1 // padding + + copy(buf[b:], v.AutoRepeats[:32]) + b += pad(int(32)) + + return buf +} + +// Write struct list XinputKbdFeedbackState +func XinputKbdFeedbackStateListBytes(buf []byte, list []XinputKbdFeedbackState) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// Struct list size XinputKbdFeedbackState +func XinputKbdFeedbackStateListSize(list []XinputKbdFeedbackState) int { + size := 0 + for _ = range list { + size += 52 + } + return size +} + +// 'XinputPtrFeedbackState' struct definition +// Size: 12 +type XinputPtrFeedbackState struct { + ClassId byte + Id byte + Len uint16 + // padding: 2 bytes + AccelNum uint16 + AccelDenom uint16 + Threshold uint16 +} + +// Struct read XinputPtrFeedbackState +func ReadXinputPtrFeedbackState(buf []byte, v *XinputPtrFeedbackState) int { + b := 0 + + v.ClassId = buf[b] + b += 1 + + v.Id = buf[b] + b += 1 + + v.Len = Get16(buf[b:]) + b += 2 + + b += 2 // padding + + v.AccelNum = Get16(buf[b:]) + b += 2 + + v.AccelDenom = Get16(buf[b:]) + b += 2 + + v.Threshold = Get16(buf[b:]) + b += 2 + + return b +} + +// Struct list read XinputPtrFeedbackState +func ReadXinputPtrFeedbackStateList(buf []byte, dest []XinputPtrFeedbackState) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XinputPtrFeedbackState{} + b += ReadXinputPtrFeedbackState(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XinputPtrFeedbackState +func (v XinputPtrFeedbackState) Bytes() []byte { + buf := make([]byte, 12) + b := 0 + + buf[b] = v.ClassId + b += 1 + + buf[b] = v.Id + b += 1 + + Put16(buf[b:], v.Len) + b += 2 + + b += 2 // padding + + Put16(buf[b:], v.AccelNum) + b += 2 + + Put16(buf[b:], v.AccelDenom) + b += 2 + + Put16(buf[b:], v.Threshold) + b += 2 + + return buf +} + +// Write struct list XinputPtrFeedbackState +func XinputPtrFeedbackStateListBytes(buf []byte, list []XinputPtrFeedbackState) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'XinputIntegerFeedbackState' struct definition +// Size: 16 +type XinputIntegerFeedbackState struct { + ClassId byte + Id byte + Len uint16 + Resolution uint32 + MinValue int32 + MaxValue int32 +} + +// Struct read XinputIntegerFeedbackState +func ReadXinputIntegerFeedbackState(buf []byte, v *XinputIntegerFeedbackState) int { + b := 0 + + v.ClassId = buf[b] + b += 1 + + v.Id = buf[b] + b += 1 + + v.Len = Get16(buf[b:]) + b += 2 + + v.Resolution = Get32(buf[b:]) + b += 4 + + v.MinValue = int32(Get32(buf[b:])) + b += 4 + + v.MaxValue = int32(Get32(buf[b:])) + b += 4 + + return b +} + +// Struct list read XinputIntegerFeedbackState +func ReadXinputIntegerFeedbackStateList(buf []byte, dest []XinputIntegerFeedbackState) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XinputIntegerFeedbackState{} + b += ReadXinputIntegerFeedbackState(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XinputIntegerFeedbackState +func (v XinputIntegerFeedbackState) Bytes() []byte { + buf := make([]byte, 16) + b := 0 + + buf[b] = v.ClassId + b += 1 + + buf[b] = v.Id + b += 1 + + Put16(buf[b:], v.Len) + b += 2 + + Put32(buf[b:], v.Resolution) + b += 4 + + Put32(buf[b:], uint32(v.MinValue)) + b += 4 + + Put32(buf[b:], uint32(v.MaxValue)) + b += 4 + + return buf +} + +// Write struct list XinputIntegerFeedbackState +func XinputIntegerFeedbackStateListBytes(buf []byte, list []XinputIntegerFeedbackState) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'XinputStringFeedbackState' struct definition +// Size: (8 + pad((int(NumKeysyms) * 4))) +type XinputStringFeedbackState struct { + ClassId byte + Id byte + Len uint16 + MaxSymbols uint16 + NumKeysyms uint16 + Keysyms []Keysym // size: pad((int(NumKeysyms) * 4)) +} + +// Struct read XinputStringFeedbackState +func ReadXinputStringFeedbackState(buf []byte, v *XinputStringFeedbackState) int { + b := 0 + + v.ClassId = buf[b] + b += 1 + + v.Id = buf[b] + b += 1 + + v.Len = Get16(buf[b:]) + b += 2 + + v.MaxSymbols = Get16(buf[b:]) + b += 2 + + v.NumKeysyms = Get16(buf[b:]) + b += 2 + + v.Keysyms = make([]Keysym, v.NumKeysyms) + for i := 0; i < int(v.NumKeysyms); i++ { + v.Keysyms[i] = Keysym(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + return b +} + +// Struct list read XinputStringFeedbackState +func ReadXinputStringFeedbackStateList(buf []byte, dest []XinputStringFeedbackState) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XinputStringFeedbackState{} + b += ReadXinputStringFeedbackState(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XinputStringFeedbackState +func (v XinputStringFeedbackState) Bytes() []byte { + buf := make([]byte, (8 + pad((int(v.NumKeysyms) * 4)))) + b := 0 + + buf[b] = v.ClassId + b += 1 + + buf[b] = v.Id + b += 1 + + Put16(buf[b:], v.Len) + b += 2 + + Put16(buf[b:], v.MaxSymbols) + b += 2 + + Put16(buf[b:], v.NumKeysyms) + b += 2 + + for i := 0; i < int(v.NumKeysyms); i++ { + Put32(buf[b:], uint32(v.Keysyms[i])) + b += 4 + } + b = pad(b) + + return buf +} + +// Write struct list XinputStringFeedbackState +func XinputStringFeedbackStateListBytes(buf []byte, list []XinputStringFeedbackState) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// Struct list size XinputStringFeedbackState +func XinputStringFeedbackStateListSize(list []XinputStringFeedbackState) int { + size := 0 + for _, item := range list { + size += (8 + pad((int(item.NumKeysyms) * 4))) + } + return size +} + +// 'XinputBellFeedbackState' struct definition +// Size: 12 +type XinputBellFeedbackState struct { + ClassId byte + Id byte + Len uint16 + Percent byte + // padding: 3 bytes + Pitch uint16 + Duration uint16 +} + +// Struct read XinputBellFeedbackState +func ReadXinputBellFeedbackState(buf []byte, v *XinputBellFeedbackState) int { + b := 0 + + v.ClassId = buf[b] + b += 1 + + v.Id = buf[b] + b += 1 + + v.Len = Get16(buf[b:]) + b += 2 + + v.Percent = buf[b] + b += 1 + + b += 3 // padding + + v.Pitch = Get16(buf[b:]) + b += 2 + + v.Duration = Get16(buf[b:]) + b += 2 + + return b +} + +// Struct list read XinputBellFeedbackState +func ReadXinputBellFeedbackStateList(buf []byte, dest []XinputBellFeedbackState) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XinputBellFeedbackState{} + b += ReadXinputBellFeedbackState(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XinputBellFeedbackState +func (v XinputBellFeedbackState) Bytes() []byte { + buf := make([]byte, 12) + b := 0 + + buf[b] = v.ClassId + b += 1 + + buf[b] = v.Id + b += 1 + + Put16(buf[b:], v.Len) + b += 2 + + buf[b] = v.Percent + b += 1 + + b += 3 // padding + + Put16(buf[b:], v.Pitch) + b += 2 + + Put16(buf[b:], v.Duration) + b += 2 + + return buf +} + +// Write struct list XinputBellFeedbackState +func XinputBellFeedbackStateListBytes(buf []byte, list []XinputBellFeedbackState) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'XinputLedFeedbackState' struct definition +// Size: 12 +type XinputLedFeedbackState struct { + ClassId byte + Id byte + Len uint16 + LedMask uint32 + LedValues uint32 +} + +// Struct read XinputLedFeedbackState +func ReadXinputLedFeedbackState(buf []byte, v *XinputLedFeedbackState) int { + b := 0 + + v.ClassId = buf[b] + b += 1 + + v.Id = buf[b] + b += 1 + + v.Len = Get16(buf[b:]) + b += 2 + + v.LedMask = Get32(buf[b:]) + b += 4 + + v.LedValues = Get32(buf[b:]) + b += 4 + + return b +} + +// Struct list read XinputLedFeedbackState +func ReadXinputLedFeedbackStateList(buf []byte, dest []XinputLedFeedbackState) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XinputLedFeedbackState{} + b += ReadXinputLedFeedbackState(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XinputLedFeedbackState +func (v XinputLedFeedbackState) Bytes() []byte { + buf := make([]byte, 12) + b := 0 + + buf[b] = v.ClassId + b += 1 + + buf[b] = v.Id + b += 1 + + Put16(buf[b:], v.Len) + b += 2 + + Put32(buf[b:], v.LedMask) + b += 4 + + Put32(buf[b:], v.LedValues) + b += 4 + + return buf +} + +// Write struct list XinputLedFeedbackState +func XinputLedFeedbackStateListBytes(buf []byte, list []XinputLedFeedbackState) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'XinputFeedbackCtl' struct definition +// Size: 4 +type XinputFeedbackCtl struct { + ClassId byte + Id byte + Len uint16 +} + +// Struct read XinputFeedbackCtl +func ReadXinputFeedbackCtl(buf []byte, v *XinputFeedbackCtl) int { + b := 0 + + v.ClassId = buf[b] + b += 1 + + v.Id = buf[b] + b += 1 + + v.Len = Get16(buf[b:]) + b += 2 + + return b +} + +// Struct list read XinputFeedbackCtl +func ReadXinputFeedbackCtlList(buf []byte, dest []XinputFeedbackCtl) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XinputFeedbackCtl{} + b += ReadXinputFeedbackCtl(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XinputFeedbackCtl +func (v XinputFeedbackCtl) Bytes() []byte { + buf := make([]byte, 4) + b := 0 + + buf[b] = v.ClassId + b += 1 + + buf[b] = v.Id + b += 1 + + Put16(buf[b:], v.Len) + b += 2 + + return buf +} + +// Write struct list XinputFeedbackCtl +func XinputFeedbackCtlListBytes(buf []byte, list []XinputFeedbackCtl) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'XinputKbdFeedbackCtl' struct definition +// Size: 20 +type XinputKbdFeedbackCtl struct { + ClassId byte + Id byte + Len uint16 + Key XinputKeyCode + AutoRepeatMode byte + KeyClickPercent int8 + BellPercent int8 + BellPitch int16 + BellDuration int16 + LedMask uint32 + LedValues uint32 +} + +// Struct read XinputKbdFeedbackCtl +func ReadXinputKbdFeedbackCtl(buf []byte, v *XinputKbdFeedbackCtl) int { + b := 0 + + v.ClassId = buf[b] + b += 1 + + v.Id = buf[b] + b += 1 + + v.Len = Get16(buf[b:]) + b += 2 + + v.Key = XinputKeyCode(buf[b]) + b += 1 + + v.AutoRepeatMode = buf[b] + b += 1 + + v.KeyClickPercent = int8(buf[b]) + b += 1 + + v.BellPercent = int8(buf[b]) + b += 1 + + v.BellPitch = int16(Get16(buf[b:])) + b += 2 + + v.BellDuration = int16(Get16(buf[b:])) + b += 2 + + v.LedMask = Get32(buf[b:]) + b += 4 + + v.LedValues = Get32(buf[b:]) + b += 4 + + return b +} + +// Struct list read XinputKbdFeedbackCtl +func ReadXinputKbdFeedbackCtlList(buf []byte, dest []XinputKbdFeedbackCtl) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XinputKbdFeedbackCtl{} + b += ReadXinputKbdFeedbackCtl(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XinputKbdFeedbackCtl +func (v XinputKbdFeedbackCtl) Bytes() []byte { + buf := make([]byte, 20) + b := 0 + + buf[b] = v.ClassId + b += 1 + + buf[b] = v.Id + b += 1 + + Put16(buf[b:], v.Len) + b += 2 + + buf[b] = byte(v.Key) + b += 1 + + buf[b] = v.AutoRepeatMode + b += 1 + + buf[b] = byte(v.KeyClickPercent) + b += 1 + + buf[b] = byte(v.BellPercent) + b += 1 + + Put16(buf[b:], uint16(v.BellPitch)) + b += 2 + + Put16(buf[b:], uint16(v.BellDuration)) + b += 2 + + Put32(buf[b:], v.LedMask) + b += 4 + + Put32(buf[b:], v.LedValues) + b += 4 + + return buf +} + +// Write struct list XinputKbdFeedbackCtl +func XinputKbdFeedbackCtlListBytes(buf []byte, list []XinputKbdFeedbackCtl) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'XinputPtrFeedbackCtl' struct definition +// Size: 12 +type XinputPtrFeedbackCtl struct { + ClassId byte + Id byte + Len uint16 + // padding: 2 bytes + Num int16 + Denom int16 + Threshold int16 +} + +// Struct read XinputPtrFeedbackCtl +func ReadXinputPtrFeedbackCtl(buf []byte, v *XinputPtrFeedbackCtl) int { + b := 0 + + v.ClassId = buf[b] + b += 1 + + v.Id = buf[b] + b += 1 + + v.Len = Get16(buf[b:]) + b += 2 + + b += 2 // padding + + v.Num = int16(Get16(buf[b:])) + b += 2 + + v.Denom = int16(Get16(buf[b:])) + b += 2 + + v.Threshold = int16(Get16(buf[b:])) + b += 2 + + return b +} + +// Struct list read XinputPtrFeedbackCtl +func ReadXinputPtrFeedbackCtlList(buf []byte, dest []XinputPtrFeedbackCtl) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XinputPtrFeedbackCtl{} + b += ReadXinputPtrFeedbackCtl(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XinputPtrFeedbackCtl +func (v XinputPtrFeedbackCtl) Bytes() []byte { + buf := make([]byte, 12) + b := 0 + + buf[b] = v.ClassId + b += 1 + + buf[b] = v.Id + b += 1 + + Put16(buf[b:], v.Len) + b += 2 + + b += 2 // padding + + Put16(buf[b:], uint16(v.Num)) + b += 2 + + Put16(buf[b:], uint16(v.Denom)) + b += 2 + + Put16(buf[b:], uint16(v.Threshold)) + b += 2 + + return buf +} + +// Write struct list XinputPtrFeedbackCtl +func XinputPtrFeedbackCtlListBytes(buf []byte, list []XinputPtrFeedbackCtl) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'XinputIntegerFeedbackCtl' struct definition +// Size: 8 +type XinputIntegerFeedbackCtl struct { + ClassId byte + Id byte + Len uint16 + IntToDisplay int32 +} + +// Struct read XinputIntegerFeedbackCtl +func ReadXinputIntegerFeedbackCtl(buf []byte, v *XinputIntegerFeedbackCtl) int { + b := 0 + + v.ClassId = buf[b] + b += 1 + + v.Id = buf[b] + b += 1 + + v.Len = Get16(buf[b:]) + b += 2 + + v.IntToDisplay = int32(Get32(buf[b:])) + b += 4 + + return b +} + +// Struct list read XinputIntegerFeedbackCtl +func ReadXinputIntegerFeedbackCtlList(buf []byte, dest []XinputIntegerFeedbackCtl) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XinputIntegerFeedbackCtl{} + b += ReadXinputIntegerFeedbackCtl(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XinputIntegerFeedbackCtl +func (v XinputIntegerFeedbackCtl) Bytes() []byte { + buf := make([]byte, 8) + b := 0 + + buf[b] = v.ClassId + b += 1 + + buf[b] = v.Id + b += 1 + + Put16(buf[b:], v.Len) + b += 2 + + Put32(buf[b:], uint32(v.IntToDisplay)) + b += 4 + + return buf +} + +// Write struct list XinputIntegerFeedbackCtl +func XinputIntegerFeedbackCtlListBytes(buf []byte, list []XinputIntegerFeedbackCtl) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'XinputStringFeedbackCtl' struct definition +// Size: (8 + pad((int(NumKeysyms) * 4))) +type XinputStringFeedbackCtl struct { + ClassId byte + Id byte + Len uint16 + // padding: 2 bytes + NumKeysyms uint16 + Keysyms []Keysym // size: pad((int(NumKeysyms) * 4)) +} + +// Struct read XinputStringFeedbackCtl +func ReadXinputStringFeedbackCtl(buf []byte, v *XinputStringFeedbackCtl) int { + b := 0 + + v.ClassId = buf[b] + b += 1 + + v.Id = buf[b] + b += 1 + + v.Len = Get16(buf[b:]) + b += 2 + + b += 2 // padding + + v.NumKeysyms = Get16(buf[b:]) + b += 2 + + v.Keysyms = make([]Keysym, v.NumKeysyms) + for i := 0; i < int(v.NumKeysyms); i++ { + v.Keysyms[i] = Keysym(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + return b +} + +// Struct list read XinputStringFeedbackCtl +func ReadXinputStringFeedbackCtlList(buf []byte, dest []XinputStringFeedbackCtl) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XinputStringFeedbackCtl{} + b += ReadXinputStringFeedbackCtl(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XinputStringFeedbackCtl +func (v XinputStringFeedbackCtl) Bytes() []byte { + buf := make([]byte, (8 + pad((int(v.NumKeysyms) * 4)))) + b := 0 + + buf[b] = v.ClassId + b += 1 + + buf[b] = v.Id + b += 1 + + Put16(buf[b:], v.Len) + b += 2 + + b += 2 // padding + + Put16(buf[b:], v.NumKeysyms) + b += 2 + + for i := 0; i < int(v.NumKeysyms); i++ { + Put32(buf[b:], uint32(v.Keysyms[i])) + b += 4 + } + b = pad(b) + + return buf +} + +// Write struct list XinputStringFeedbackCtl +func XinputStringFeedbackCtlListBytes(buf []byte, list []XinputStringFeedbackCtl) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// Struct list size XinputStringFeedbackCtl +func XinputStringFeedbackCtlListSize(list []XinputStringFeedbackCtl) int { + size := 0 + for _, item := range list { + size += (8 + pad((int(item.NumKeysyms) * 4))) + } + return size +} + +// 'XinputBellFeedbackCtl' struct definition +// Size: 12 +type XinputBellFeedbackCtl struct { + ClassId byte + Id byte + Len uint16 + Percent int8 + // padding: 3 bytes + Pitch int16 + Duration int16 +} + +// Struct read XinputBellFeedbackCtl +func ReadXinputBellFeedbackCtl(buf []byte, v *XinputBellFeedbackCtl) int { + b := 0 + + v.ClassId = buf[b] + b += 1 + + v.Id = buf[b] + b += 1 + + v.Len = Get16(buf[b:]) + b += 2 + + v.Percent = int8(buf[b]) + b += 1 + + b += 3 // padding + + v.Pitch = int16(Get16(buf[b:])) + b += 2 + + v.Duration = int16(Get16(buf[b:])) + b += 2 + + return b +} + +// Struct list read XinputBellFeedbackCtl +func ReadXinputBellFeedbackCtlList(buf []byte, dest []XinputBellFeedbackCtl) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XinputBellFeedbackCtl{} + b += ReadXinputBellFeedbackCtl(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XinputBellFeedbackCtl +func (v XinputBellFeedbackCtl) Bytes() []byte { + buf := make([]byte, 12) + b := 0 + + buf[b] = v.ClassId + b += 1 + + buf[b] = v.Id + b += 1 + + Put16(buf[b:], v.Len) + b += 2 + + buf[b] = byte(v.Percent) + b += 1 + + b += 3 // padding + + Put16(buf[b:], uint16(v.Pitch)) + b += 2 + + Put16(buf[b:], uint16(v.Duration)) + b += 2 + + return buf +} + +// Write struct list XinputBellFeedbackCtl +func XinputBellFeedbackCtlListBytes(buf []byte, list []XinputBellFeedbackCtl) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'XinputLedFeedbackCtl' struct definition +// Size: 12 +type XinputLedFeedbackCtl struct { + ClassId byte + Id byte + Len uint16 + LedMask uint32 + LedValues uint32 +} + +// Struct read XinputLedFeedbackCtl +func ReadXinputLedFeedbackCtl(buf []byte, v *XinputLedFeedbackCtl) int { + b := 0 + + v.ClassId = buf[b] + b += 1 + + v.Id = buf[b] + b += 1 + + v.Len = Get16(buf[b:]) + b += 2 + + v.LedMask = Get32(buf[b:]) + b += 4 + + v.LedValues = Get32(buf[b:]) + b += 4 + + return b +} + +// Struct list read XinputLedFeedbackCtl +func ReadXinputLedFeedbackCtlList(buf []byte, dest []XinputLedFeedbackCtl) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XinputLedFeedbackCtl{} + b += ReadXinputLedFeedbackCtl(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XinputLedFeedbackCtl +func (v XinputLedFeedbackCtl) Bytes() []byte { + buf := make([]byte, 12) + b := 0 + + buf[b] = v.ClassId + b += 1 + + buf[b] = v.Id + b += 1 + + Put16(buf[b:], v.Len) + b += 2 + + Put32(buf[b:], v.LedMask) + b += 4 + + Put32(buf[b:], v.LedValues) + b += 4 + + return buf +} + +// Write struct list XinputLedFeedbackCtl +func XinputLedFeedbackCtlListBytes(buf []byte, list []XinputLedFeedbackCtl) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'XinputInputState' struct definition +// Size: 3 +type XinputInputState struct { + ClassId byte + Len byte + NumItems byte +} + +// Struct read XinputInputState +func ReadXinputInputState(buf []byte, v *XinputInputState) int { + b := 0 + + v.ClassId = buf[b] + b += 1 + + v.Len = buf[b] + b += 1 + + v.NumItems = buf[b] + b += 1 + + return b +} + +// Struct list read XinputInputState +func ReadXinputInputStateList(buf []byte, dest []XinputInputState) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XinputInputState{} + b += ReadXinputInputState(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XinputInputState +func (v XinputInputState) Bytes() []byte { + buf := make([]byte, 3) + b := 0 + + buf[b] = v.ClassId + b += 1 + + buf[b] = v.Len + b += 1 + + buf[b] = v.NumItems + b += 1 + + return buf +} + +// Write struct list XinputInputState +func XinputInputStateListBytes(buf []byte, list []XinputInputState) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'XinputKeyState' struct definition +// Size: 36 +type XinputKeyState struct { + ClassId byte + Len byte + NumKeys byte + // padding: 1 bytes + Keys []byte // size: 32 +} + +// Struct read XinputKeyState +func ReadXinputKeyState(buf []byte, v *XinputKeyState) int { + b := 0 + + v.ClassId = buf[b] + b += 1 + + v.Len = buf[b] + b += 1 + + v.NumKeys = buf[b] + b += 1 + + b += 1 // padding + + v.Keys = make([]byte, 32) + copy(v.Keys[:32], buf[b:]) + b += pad(int(32)) + + return b +} + +// Struct list read XinputKeyState +func ReadXinputKeyStateList(buf []byte, dest []XinputKeyState) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XinputKeyState{} + b += ReadXinputKeyState(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XinputKeyState +func (v XinputKeyState) Bytes() []byte { + buf := make([]byte, 36) + b := 0 + + buf[b] = v.ClassId + b += 1 + + buf[b] = v.Len + b += 1 + + buf[b] = v.NumKeys + b += 1 + + b += 1 // padding + + copy(buf[b:], v.Keys[:32]) + b += pad(int(32)) + + return buf +} + +// Write struct list XinputKeyState +func XinputKeyStateListBytes(buf []byte, list []XinputKeyState) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// Struct list size XinputKeyState +func XinputKeyStateListSize(list []XinputKeyState) int { + size := 0 + for _ = range list { + size += 36 + } + return size +} + +// 'XinputButtonState' struct definition +// Size: 36 +type XinputButtonState struct { + ClassId byte + Len byte + NumButtons byte + // padding: 1 bytes + Buttons []byte // size: 32 +} + +// Struct read XinputButtonState +func ReadXinputButtonState(buf []byte, v *XinputButtonState) int { + b := 0 + + v.ClassId = buf[b] + b += 1 + + v.Len = buf[b] + b += 1 + + v.NumButtons = buf[b] + b += 1 + + b += 1 // padding + + v.Buttons = make([]byte, 32) + copy(v.Buttons[:32], buf[b:]) + b += pad(int(32)) + + return b +} + +// Struct list read XinputButtonState +func ReadXinputButtonStateList(buf []byte, dest []XinputButtonState) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XinputButtonState{} + b += ReadXinputButtonState(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XinputButtonState +func (v XinputButtonState) Bytes() []byte { + buf := make([]byte, 36) + b := 0 + + buf[b] = v.ClassId + b += 1 + + buf[b] = v.Len + b += 1 + + buf[b] = v.NumButtons + b += 1 + + b += 1 // padding + + copy(buf[b:], v.Buttons[:32]) + b += pad(int(32)) + + return buf +} + +// Write struct list XinputButtonState +func XinputButtonStateListBytes(buf []byte, list []XinputButtonState) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// Struct list size XinputButtonState +func XinputButtonStateListSize(list []XinputButtonState) int { + size := 0 + for _ = range list { + size += 36 + } + return size +} + +// 'XinputValuatorState' struct definition +// Size: (4 + pad((int(NumValuators) * 4))) +type XinputValuatorState struct { + ClassId byte + Len byte + NumValuators byte + Mode byte + Valuators []uint32 // size: pad((int(NumValuators) * 4)) +} + +// Struct read XinputValuatorState +func ReadXinputValuatorState(buf []byte, v *XinputValuatorState) int { + b := 0 + + v.ClassId = buf[b] + b += 1 + + v.Len = buf[b] + b += 1 + + v.NumValuators = buf[b] + b += 1 + + v.Mode = buf[b] + b += 1 + + v.Valuators = make([]uint32, v.NumValuators) + for i := 0; i < int(v.NumValuators); i++ { + v.Valuators[i] = Get32(buf[b:]) + b += 4 + } + b = pad(b) + + return b +} + +// Struct list read XinputValuatorState +func ReadXinputValuatorStateList(buf []byte, dest []XinputValuatorState) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XinputValuatorState{} + b += ReadXinputValuatorState(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XinputValuatorState +func (v XinputValuatorState) Bytes() []byte { + buf := make([]byte, (4 + pad((int(v.NumValuators) * 4)))) + b := 0 + + buf[b] = v.ClassId + b += 1 + + buf[b] = v.Len + b += 1 + + buf[b] = v.NumValuators + b += 1 + + buf[b] = v.Mode + b += 1 + + for i := 0; i < int(v.NumValuators); i++ { + Put32(buf[b:], v.Valuators[i]) + b += 4 + } + b = pad(b) + + return buf +} + +// Write struct list XinputValuatorState +func XinputValuatorStateListBytes(buf []byte, list []XinputValuatorState) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// Struct list size XinputValuatorState +func XinputValuatorStateListSize(list []XinputValuatorState) int { + size := 0 + for _, item := range list { + size += (4 + pad((int(item.NumValuators) * 4))) + } + return size +} + +// 'XinputDeviceState' struct definition +// Size: 4 +type XinputDeviceState struct { + ControlId uint16 + Len uint16 +} + +// Struct read XinputDeviceState +func ReadXinputDeviceState(buf []byte, v *XinputDeviceState) int { + b := 0 + + v.ControlId = Get16(buf[b:]) + b += 2 + + v.Len = Get16(buf[b:]) + b += 2 + + return b +} + +// Struct list read XinputDeviceState +func ReadXinputDeviceStateList(buf []byte, dest []XinputDeviceState) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XinputDeviceState{} + b += ReadXinputDeviceState(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XinputDeviceState +func (v XinputDeviceState) Bytes() []byte { + buf := make([]byte, 4) + b := 0 + + Put16(buf[b:], v.ControlId) + b += 2 + + Put16(buf[b:], v.Len) + b += 2 + + return buf +} + +// Write struct list XinputDeviceState +func XinputDeviceStateListBytes(buf []byte, list []XinputDeviceState) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'XinputDeviceResolutionState' struct definition +// Size: (((8 + pad((int(NumValuators) * 4))) + pad((int(NumValuators) * 4))) + pad((int(NumValuators) * 4))) +type XinputDeviceResolutionState struct { + ControlId uint16 + Len uint16 + NumValuators uint32 + ResolutionValues []uint32 // size: pad((int(NumValuators) * 4)) + ResolutionMin []uint32 // size: pad((int(NumValuators) * 4)) + ResolutionMax []uint32 // size: pad((int(NumValuators) * 4)) +} + +// Struct read XinputDeviceResolutionState +func ReadXinputDeviceResolutionState(buf []byte, v *XinputDeviceResolutionState) int { + b := 0 + + v.ControlId = Get16(buf[b:]) + b += 2 + + v.Len = Get16(buf[b:]) + b += 2 + + v.NumValuators = Get32(buf[b:]) + b += 4 + + v.ResolutionValues = make([]uint32, v.NumValuators) + for i := 0; i < int(v.NumValuators); i++ { + v.ResolutionValues[i] = Get32(buf[b:]) + b += 4 + } + b = pad(b) + + v.ResolutionMin = make([]uint32, v.NumValuators) + for i := 0; i < int(v.NumValuators); i++ { + v.ResolutionMin[i] = Get32(buf[b:]) + b += 4 + } + b = pad(b) + + v.ResolutionMax = make([]uint32, v.NumValuators) + for i := 0; i < int(v.NumValuators); i++ { + v.ResolutionMax[i] = Get32(buf[b:]) + b += 4 + } + b = pad(b) + + return b +} + +// Struct list read XinputDeviceResolutionState +func ReadXinputDeviceResolutionStateList(buf []byte, dest []XinputDeviceResolutionState) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XinputDeviceResolutionState{} + b += ReadXinputDeviceResolutionState(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XinputDeviceResolutionState +func (v XinputDeviceResolutionState) Bytes() []byte { + buf := make([]byte, (((8 + pad((int(v.NumValuators) * 4))) + pad((int(v.NumValuators) * 4))) + pad((int(v.NumValuators) * 4)))) + b := 0 + + Put16(buf[b:], v.ControlId) + b += 2 + + Put16(buf[b:], v.Len) + b += 2 + + Put32(buf[b:], v.NumValuators) + b += 4 + + for i := 0; i < int(v.NumValuators); i++ { + Put32(buf[b:], v.ResolutionValues[i]) + b += 4 + } + b = pad(b) + + for i := 0; i < int(v.NumValuators); i++ { + Put32(buf[b:], v.ResolutionMin[i]) + b += 4 + } + b = pad(b) + + for i := 0; i < int(v.NumValuators); i++ { + Put32(buf[b:], v.ResolutionMax[i]) + b += 4 + } + b = pad(b) + + return buf +} + +// Write struct list XinputDeviceResolutionState +func XinputDeviceResolutionStateListBytes(buf []byte, list []XinputDeviceResolutionState) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// Struct list size XinputDeviceResolutionState +func XinputDeviceResolutionStateListSize(list []XinputDeviceResolutionState) int { + size := 0 + for _, item := range list { + size += (((8 + pad((int(item.NumValuators) * 4))) + pad((int(item.NumValuators) * 4))) + pad((int(item.NumValuators) * 4))) + } + return size +} + +// 'XinputDeviceAbsCalibState' struct definition +// Size: 36 +type XinputDeviceAbsCalibState struct { + ControlId uint16 + Len uint16 + MinX int32 + MaxX int32 + MinY int32 + MaxY int32 + FlipX uint32 + FlipY uint32 + Rotation uint32 + ButtonThreshold uint32 +} + +// Struct read XinputDeviceAbsCalibState +func ReadXinputDeviceAbsCalibState(buf []byte, v *XinputDeviceAbsCalibState) int { + b := 0 + + v.ControlId = Get16(buf[b:]) + b += 2 + + v.Len = Get16(buf[b:]) + b += 2 + + v.MinX = int32(Get32(buf[b:])) + b += 4 + + v.MaxX = int32(Get32(buf[b:])) + b += 4 + + v.MinY = int32(Get32(buf[b:])) + b += 4 + + v.MaxY = int32(Get32(buf[b:])) + b += 4 + + v.FlipX = Get32(buf[b:]) + b += 4 + + v.FlipY = Get32(buf[b:]) + b += 4 + + v.Rotation = Get32(buf[b:]) + b += 4 + + v.ButtonThreshold = Get32(buf[b:]) + b += 4 + + return b +} + +// Struct list read XinputDeviceAbsCalibState +func ReadXinputDeviceAbsCalibStateList(buf []byte, dest []XinputDeviceAbsCalibState) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XinputDeviceAbsCalibState{} + b += ReadXinputDeviceAbsCalibState(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XinputDeviceAbsCalibState +func (v XinputDeviceAbsCalibState) Bytes() []byte { + buf := make([]byte, 36) + b := 0 + + Put16(buf[b:], v.ControlId) + b += 2 + + Put16(buf[b:], v.Len) + b += 2 + + Put32(buf[b:], uint32(v.MinX)) + b += 4 + + Put32(buf[b:], uint32(v.MaxX)) + b += 4 + + Put32(buf[b:], uint32(v.MinY)) + b += 4 + + Put32(buf[b:], uint32(v.MaxY)) + b += 4 + + Put32(buf[b:], v.FlipX) + b += 4 + + Put32(buf[b:], v.FlipY) + b += 4 + + Put32(buf[b:], v.Rotation) + b += 4 + + Put32(buf[b:], v.ButtonThreshold) + b += 4 + + return buf +} + +// Write struct list XinputDeviceAbsCalibState +func XinputDeviceAbsCalibStateListBytes(buf []byte, list []XinputDeviceAbsCalibState) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'XinputDeviceAbsAreaState' struct definition +// Size: 28 +type XinputDeviceAbsAreaState struct { + ControlId uint16 + Len uint16 + OffsetX uint32 + OffsetY uint32 + Width uint32 + Height uint32 + Screen uint32 + Following uint32 +} + +// Struct read XinputDeviceAbsAreaState +func ReadXinputDeviceAbsAreaState(buf []byte, v *XinputDeviceAbsAreaState) int { + b := 0 + + v.ControlId = Get16(buf[b:]) + b += 2 + + v.Len = Get16(buf[b:]) + b += 2 + + v.OffsetX = Get32(buf[b:]) + b += 4 + + v.OffsetY = Get32(buf[b:]) + b += 4 + + v.Width = Get32(buf[b:]) + b += 4 + + v.Height = Get32(buf[b:]) + b += 4 + + v.Screen = Get32(buf[b:]) + b += 4 + + v.Following = Get32(buf[b:]) + b += 4 + + return b +} + +// Struct list read XinputDeviceAbsAreaState +func ReadXinputDeviceAbsAreaStateList(buf []byte, dest []XinputDeviceAbsAreaState) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XinputDeviceAbsAreaState{} + b += ReadXinputDeviceAbsAreaState(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XinputDeviceAbsAreaState +func (v XinputDeviceAbsAreaState) Bytes() []byte { + buf := make([]byte, 28) + b := 0 + + Put16(buf[b:], v.ControlId) + b += 2 + + Put16(buf[b:], v.Len) + b += 2 + + Put32(buf[b:], v.OffsetX) + b += 4 + + Put32(buf[b:], v.OffsetY) + b += 4 + + Put32(buf[b:], v.Width) + b += 4 + + Put32(buf[b:], v.Height) + b += 4 + + Put32(buf[b:], v.Screen) + b += 4 + + Put32(buf[b:], v.Following) + b += 4 + + return buf +} + +// Write struct list XinputDeviceAbsAreaState +func XinputDeviceAbsAreaStateListBytes(buf []byte, list []XinputDeviceAbsAreaState) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'XinputDeviceCoreState' struct definition +// Size: 8 +type XinputDeviceCoreState struct { + ControlId uint16 + Len uint16 + Status byte + Iscore byte + // padding: 2 bytes +} + +// Struct read XinputDeviceCoreState +func ReadXinputDeviceCoreState(buf []byte, v *XinputDeviceCoreState) int { + b := 0 + + v.ControlId = Get16(buf[b:]) + b += 2 + + v.Len = Get16(buf[b:]) + b += 2 + + v.Status = buf[b] + b += 1 + + v.Iscore = buf[b] + b += 1 + + b += 2 // padding + + return b +} + +// Struct list read XinputDeviceCoreState +func ReadXinputDeviceCoreStateList(buf []byte, dest []XinputDeviceCoreState) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XinputDeviceCoreState{} + b += ReadXinputDeviceCoreState(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XinputDeviceCoreState +func (v XinputDeviceCoreState) Bytes() []byte { + buf := make([]byte, 8) + b := 0 + + Put16(buf[b:], v.ControlId) + b += 2 + + Put16(buf[b:], v.Len) + b += 2 + + buf[b] = v.Status + b += 1 + + buf[b] = v.Iscore + b += 1 + + b += 2 // padding + + return buf +} + +// Write struct list XinputDeviceCoreState +func XinputDeviceCoreStateListBytes(buf []byte, list []XinputDeviceCoreState) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'XinputDeviceEnableState' struct definition +// Size: 8 +type XinputDeviceEnableState struct { + ControlId uint16 + Len uint16 + Enable byte + // padding: 3 bytes +} + +// Struct read XinputDeviceEnableState +func ReadXinputDeviceEnableState(buf []byte, v *XinputDeviceEnableState) int { + b := 0 + + v.ControlId = Get16(buf[b:]) + b += 2 + + v.Len = Get16(buf[b:]) + b += 2 + + v.Enable = buf[b] + b += 1 + + b += 3 // padding + + return b +} + +// Struct list read XinputDeviceEnableState +func ReadXinputDeviceEnableStateList(buf []byte, dest []XinputDeviceEnableState) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XinputDeviceEnableState{} + b += ReadXinputDeviceEnableState(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XinputDeviceEnableState +func (v XinputDeviceEnableState) Bytes() []byte { + buf := make([]byte, 8) + b := 0 + + Put16(buf[b:], v.ControlId) + b += 2 + + Put16(buf[b:], v.Len) + b += 2 + + buf[b] = v.Enable + b += 1 + + b += 3 // padding + + return buf +} + +// Write struct list XinputDeviceEnableState +func XinputDeviceEnableStateListBytes(buf []byte, list []XinputDeviceEnableState) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'XinputDeviceCtl' struct definition +// Size: 4 +type XinputDeviceCtl struct { + ControlId uint16 + Len uint16 +} + +// Struct read XinputDeviceCtl +func ReadXinputDeviceCtl(buf []byte, v *XinputDeviceCtl) int { + b := 0 + + v.ControlId = Get16(buf[b:]) + b += 2 + + v.Len = Get16(buf[b:]) + b += 2 + + return b +} + +// Struct list read XinputDeviceCtl +func ReadXinputDeviceCtlList(buf []byte, dest []XinputDeviceCtl) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XinputDeviceCtl{} + b += ReadXinputDeviceCtl(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XinputDeviceCtl +func (v XinputDeviceCtl) Bytes() []byte { + buf := make([]byte, 4) + b := 0 + + Put16(buf[b:], v.ControlId) + b += 2 + + Put16(buf[b:], v.Len) + b += 2 + + return buf +} + +// Write struct list XinputDeviceCtl +func XinputDeviceCtlListBytes(buf []byte, list []XinputDeviceCtl) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'XinputDeviceResolutionCtl' struct definition +// Size: (6 + pad((int(NumValuators) * 4))) +type XinputDeviceResolutionCtl struct { + ControlId uint16 + Len uint16 + FirstValuator byte + NumValuators byte + ResolutionValues []uint32 // size: pad((int(NumValuators) * 4)) +} + +// Struct read XinputDeviceResolutionCtl +func ReadXinputDeviceResolutionCtl(buf []byte, v *XinputDeviceResolutionCtl) int { + b := 0 + + v.ControlId = Get16(buf[b:]) + b += 2 + + v.Len = Get16(buf[b:]) + b += 2 + + v.FirstValuator = buf[b] + b += 1 + + v.NumValuators = buf[b] + b += 1 + + v.ResolutionValues = make([]uint32, v.NumValuators) + for i := 0; i < int(v.NumValuators); i++ { + v.ResolutionValues[i] = Get32(buf[b:]) + b += 4 + } + b = pad(b) + + return b +} + +// Struct list read XinputDeviceResolutionCtl +func ReadXinputDeviceResolutionCtlList(buf []byte, dest []XinputDeviceResolutionCtl) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XinputDeviceResolutionCtl{} + b += ReadXinputDeviceResolutionCtl(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XinputDeviceResolutionCtl +func (v XinputDeviceResolutionCtl) Bytes() []byte { + buf := make([]byte, (6 + pad((int(v.NumValuators) * 4)))) + b := 0 + + Put16(buf[b:], v.ControlId) + b += 2 + + Put16(buf[b:], v.Len) + b += 2 + + buf[b] = v.FirstValuator + b += 1 + + buf[b] = v.NumValuators + b += 1 + + for i := 0; i < int(v.NumValuators); i++ { + Put32(buf[b:], v.ResolutionValues[i]) + b += 4 + } + b = pad(b) + + return buf +} + +// Write struct list XinputDeviceResolutionCtl +func XinputDeviceResolutionCtlListBytes(buf []byte, list []XinputDeviceResolutionCtl) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// Struct list size XinputDeviceResolutionCtl +func XinputDeviceResolutionCtlListSize(list []XinputDeviceResolutionCtl) int { + size := 0 + for _, item := range list { + size += (6 + pad((int(item.NumValuators) * 4))) + } + return size +} + +// 'XinputDeviceAbsCalibCtl' struct definition +// Size: 36 +type XinputDeviceAbsCalibCtl struct { + ControlId uint16 + Len uint16 + MinX int32 + MaxX int32 + MinY int32 + MaxY int32 + FlipX uint32 + FlipY uint32 + Rotation uint32 + ButtonThreshold uint32 +} + +// Struct read XinputDeviceAbsCalibCtl +func ReadXinputDeviceAbsCalibCtl(buf []byte, v *XinputDeviceAbsCalibCtl) int { + b := 0 + + v.ControlId = Get16(buf[b:]) + b += 2 + + v.Len = Get16(buf[b:]) + b += 2 + + v.MinX = int32(Get32(buf[b:])) + b += 4 + + v.MaxX = int32(Get32(buf[b:])) + b += 4 + + v.MinY = int32(Get32(buf[b:])) + b += 4 + + v.MaxY = int32(Get32(buf[b:])) + b += 4 + + v.FlipX = Get32(buf[b:]) + b += 4 + + v.FlipY = Get32(buf[b:]) + b += 4 + + v.Rotation = Get32(buf[b:]) + b += 4 + + v.ButtonThreshold = Get32(buf[b:]) + b += 4 + + return b +} + +// Struct list read XinputDeviceAbsCalibCtl +func ReadXinputDeviceAbsCalibCtlList(buf []byte, dest []XinputDeviceAbsCalibCtl) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XinputDeviceAbsCalibCtl{} + b += ReadXinputDeviceAbsCalibCtl(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XinputDeviceAbsCalibCtl +func (v XinputDeviceAbsCalibCtl) Bytes() []byte { + buf := make([]byte, 36) + b := 0 + + Put16(buf[b:], v.ControlId) + b += 2 + + Put16(buf[b:], v.Len) + b += 2 + + Put32(buf[b:], uint32(v.MinX)) + b += 4 + + Put32(buf[b:], uint32(v.MaxX)) + b += 4 + + Put32(buf[b:], uint32(v.MinY)) + b += 4 + + Put32(buf[b:], uint32(v.MaxY)) + b += 4 + + Put32(buf[b:], v.FlipX) + b += 4 + + Put32(buf[b:], v.FlipY) + b += 4 + + Put32(buf[b:], v.Rotation) + b += 4 + + Put32(buf[b:], v.ButtonThreshold) + b += 4 + + return buf +} + +// Write struct list XinputDeviceAbsCalibCtl +func XinputDeviceAbsCalibCtlListBytes(buf []byte, list []XinputDeviceAbsCalibCtl) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'XinputDeviceAbsAreaCtrl' struct definition +// Size: 28 +type XinputDeviceAbsAreaCtrl struct { + ControlId uint16 + Len uint16 + OffsetX uint32 + OffsetY uint32 + Width int32 + Height int32 + Screen int32 + Following uint32 +} + +// Struct read XinputDeviceAbsAreaCtrl +func ReadXinputDeviceAbsAreaCtrl(buf []byte, v *XinputDeviceAbsAreaCtrl) int { + b := 0 + + v.ControlId = Get16(buf[b:]) + b += 2 + + v.Len = Get16(buf[b:]) + b += 2 + + v.OffsetX = Get32(buf[b:]) + b += 4 + + v.OffsetY = Get32(buf[b:]) + b += 4 + + v.Width = int32(Get32(buf[b:])) + b += 4 + + v.Height = int32(Get32(buf[b:])) + b += 4 + + v.Screen = int32(Get32(buf[b:])) + b += 4 + + v.Following = Get32(buf[b:]) + b += 4 + + return b +} + +// Struct list read XinputDeviceAbsAreaCtrl +func ReadXinputDeviceAbsAreaCtrlList(buf []byte, dest []XinputDeviceAbsAreaCtrl) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XinputDeviceAbsAreaCtrl{} + b += ReadXinputDeviceAbsAreaCtrl(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XinputDeviceAbsAreaCtrl +func (v XinputDeviceAbsAreaCtrl) Bytes() []byte { + buf := make([]byte, 28) + b := 0 + + Put16(buf[b:], v.ControlId) + b += 2 + + Put16(buf[b:], v.Len) + b += 2 + + Put32(buf[b:], v.OffsetX) + b += 4 + + Put32(buf[b:], v.OffsetY) + b += 4 + + Put32(buf[b:], uint32(v.Width)) + b += 4 + + Put32(buf[b:], uint32(v.Height)) + b += 4 + + Put32(buf[b:], uint32(v.Screen)) + b += 4 + + Put32(buf[b:], v.Following) + b += 4 + + return buf +} + +// Write struct list XinputDeviceAbsAreaCtrl +func XinputDeviceAbsAreaCtrlListBytes(buf []byte, list []XinputDeviceAbsAreaCtrl) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'XinputDeviceCoreCtrl' struct definition +// Size: 8 +type XinputDeviceCoreCtrl struct { + ControlId uint16 + Len uint16 + Status byte + // padding: 3 bytes +} + +// Struct read XinputDeviceCoreCtrl +func ReadXinputDeviceCoreCtrl(buf []byte, v *XinputDeviceCoreCtrl) int { + b := 0 + + v.ControlId = Get16(buf[b:]) + b += 2 + + v.Len = Get16(buf[b:]) + b += 2 + + v.Status = buf[b] + b += 1 + + b += 3 // padding + + return b +} + +// Struct list read XinputDeviceCoreCtrl +func ReadXinputDeviceCoreCtrlList(buf []byte, dest []XinputDeviceCoreCtrl) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XinputDeviceCoreCtrl{} + b += ReadXinputDeviceCoreCtrl(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XinputDeviceCoreCtrl +func (v XinputDeviceCoreCtrl) Bytes() []byte { + buf := make([]byte, 8) + b := 0 + + Put16(buf[b:], v.ControlId) + b += 2 + + Put16(buf[b:], v.Len) + b += 2 + + buf[b] = v.Status + b += 1 + + b += 3 // padding + + return buf +} + +// Write struct list XinputDeviceCoreCtrl +func XinputDeviceCoreCtrlListBytes(buf []byte, list []XinputDeviceCoreCtrl) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'XinputDeviceEnableCtrl' struct definition +// Size: 8 +type XinputDeviceEnableCtrl struct { + ControlId uint16 + Len uint16 + Enable byte + // padding: 3 bytes +} + +// Struct read XinputDeviceEnableCtrl +func ReadXinputDeviceEnableCtrl(buf []byte, v *XinputDeviceEnableCtrl) int { + b := 0 + + v.ControlId = Get16(buf[b:]) + b += 2 + + v.Len = Get16(buf[b:]) + b += 2 + + v.Enable = buf[b] + b += 1 + + b += 3 // padding + + return b +} + +// Struct list read XinputDeviceEnableCtrl +func ReadXinputDeviceEnableCtrlList(buf []byte, dest []XinputDeviceEnableCtrl) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XinputDeviceEnableCtrl{} + b += ReadXinputDeviceEnableCtrl(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XinputDeviceEnableCtrl +func (v XinputDeviceEnableCtrl) Bytes() []byte { + buf := make([]byte, 8) + b := 0 + + Put16(buf[b:], v.ControlId) + b += 2 + + Put16(buf[b:], v.Len) + b += 2 + + buf[b] = v.Enable + b += 1 + + b += 3 // padding + + return buf +} + +// Write struct list XinputDeviceEnableCtrl +func XinputDeviceEnableCtrlListBytes(buf []byte, list []XinputDeviceEnableCtrl) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// Event definition XinputDeviceValuator (0) +// Size: 32 + +const XinputDeviceValuator = 0 + +type XinputDeviceValuatorEvent struct { + Sequence uint16 + DeviceId byte + DeviceState uint16 + NumValuators byte + FirstValuator byte + Valuators []int32 // size: 24 +} + +// Event read XinputDeviceValuator +func NewXinputDeviceValuatorEvent(buf []byte) Event { + v := XinputDeviceValuatorEvent{} + b := 1 // don't read event number + + v.DeviceId = buf[b] + b += 1 + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.DeviceState = Get16(buf[b:]) + b += 2 + + v.NumValuators = buf[b] + b += 1 + + v.FirstValuator = buf[b] + b += 1 + + v.Valuators = make([]int32, 6) + for i := 0; i < int(6); i++ { + v.Valuators[i] = int32(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + return v +} + +// Event write XinputDeviceValuator +func (v XinputDeviceValuatorEvent) Bytes() []byte { + buf := make([]byte, 32) + b := 0 + + // write event number + buf[b] = 0 + b += 1 + + buf[b] = v.DeviceId + b += 1 + + b += 2 // skip sequence number + + Put16(buf[b:], v.DeviceState) + b += 2 + + buf[b] = v.NumValuators + b += 1 + + buf[b] = v.FirstValuator + b += 1 + + for i := 0; i < int(6); i++ { + Put32(buf[b:], uint32(v.Valuators[i])) + b += 4 + } + b = pad(b) + + return buf +} + +func (v XinputDeviceValuatorEvent) ImplementsEvent() {} + +func (v XinputDeviceValuatorEvent) SequenceId() uint16 { + return v.Sequence +} + +func (v XinputDeviceValuatorEvent) String() string { + fieldVals := make([]string, 0, 5) + fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) + fieldVals = append(fieldVals, sprintf("DeviceId: %d", v.DeviceId)) + fieldVals = append(fieldVals, sprintf("DeviceState: %d", v.DeviceState)) + fieldVals = append(fieldVals, sprintf("NumValuators: %d", v.NumValuators)) + fieldVals = append(fieldVals, sprintf("FirstValuator: %d", v.FirstValuator)) + return "XinputDeviceValuator {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newEventFuncs[0] = NewXinputDeviceValuatorEvent +} + +// Event definition XinputDeviceKeyPress (1) +// Size: 32 + +const XinputDeviceKeyPress = 1 + +type XinputDeviceKeyPressEvent struct { + Sequence uint16 + Detail byte + Time Timestamp + Root Id + Event Id + Child Id + RootX int16 + RootY int16 + EventX int16 + EventY int16 + State uint16 + SameScreen bool + DeviceId byte +} + +// Event read XinputDeviceKeyPress +func NewXinputDeviceKeyPressEvent(buf []byte) Event { + v := XinputDeviceKeyPressEvent{} + b := 1 // don't read event number + + v.Detail = buf[b] + b += 1 + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Time = Timestamp(Get32(buf[b:])) + b += 4 + + v.Root = Id(Get32(buf[b:])) + b += 4 + + v.Event = Id(Get32(buf[b:])) + b += 4 + + v.Child = Id(Get32(buf[b:])) + b += 4 + + v.RootX = int16(Get16(buf[b:])) + b += 2 + + v.RootY = int16(Get16(buf[b:])) + b += 2 + + v.EventX = int16(Get16(buf[b:])) + b += 2 + + v.EventY = int16(Get16(buf[b:])) + b += 2 + + v.State = Get16(buf[b:]) + b += 2 + + if buf[b] == 1 { + v.SameScreen = true + } else { + v.SameScreen = false + } + b += 1 + + v.DeviceId = buf[b] + b += 1 + + return v +} + +// Event write XinputDeviceKeyPress +func (v XinputDeviceKeyPressEvent) Bytes() []byte { + buf := make([]byte, 32) + b := 0 + + // write event number + buf[b] = 1 + b += 1 + + buf[b] = v.Detail + b += 1 + + b += 2 // skip sequence number + + Put32(buf[b:], uint32(v.Time)) + b += 4 + + Put32(buf[b:], uint32(v.Root)) + b += 4 + + Put32(buf[b:], uint32(v.Event)) + b += 4 + + Put32(buf[b:], uint32(v.Child)) + b += 4 + + Put16(buf[b:], uint16(v.RootX)) + b += 2 + + Put16(buf[b:], uint16(v.RootY)) + b += 2 + + Put16(buf[b:], uint16(v.EventX)) + b += 2 + + Put16(buf[b:], uint16(v.EventY)) + b += 2 + + Put16(buf[b:], v.State) + b += 2 + + if v.SameScreen { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + buf[b] = v.DeviceId + b += 1 + + return buf +} + +func (v XinputDeviceKeyPressEvent) ImplementsEvent() {} + +func (v XinputDeviceKeyPressEvent) SequenceId() uint16 { + return v.Sequence +} + +func (v XinputDeviceKeyPressEvent) String() string { + fieldVals := make([]string, 0, 12) + fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) + fieldVals = append(fieldVals, sprintf("Detail: %d", v.Detail)) + fieldVals = append(fieldVals, sprintf("Time: %d", v.Time)) + fieldVals = append(fieldVals, sprintf("Root: %d", v.Root)) + fieldVals = append(fieldVals, sprintf("Event: %d", v.Event)) + fieldVals = append(fieldVals, sprintf("Child: %d", v.Child)) + fieldVals = append(fieldVals, sprintf("RootX: %d", v.RootX)) + fieldVals = append(fieldVals, sprintf("RootY: %d", v.RootY)) + fieldVals = append(fieldVals, sprintf("EventX: %d", v.EventX)) + fieldVals = append(fieldVals, sprintf("EventY: %d", v.EventY)) + fieldVals = append(fieldVals, sprintf("State: %d", v.State)) + fieldVals = append(fieldVals, sprintf("SameScreen: %t", v.SameScreen)) + fieldVals = append(fieldVals, sprintf("DeviceId: %d", v.DeviceId)) + return "XinputDeviceKeyPress {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newEventFuncs[1] = NewXinputDeviceKeyPressEvent +} + +// Event definition XinputFocusIn (6) +// Size: 32 + +const XinputFocusIn = 6 + +type XinputFocusInEvent struct { + Sequence uint16 + Detail byte + Time Timestamp + Window Id + Mode byte + DeviceId byte + // padding: 18 bytes +} + +// Event read XinputFocusIn +func NewXinputFocusInEvent(buf []byte) Event { + v := XinputFocusInEvent{} + b := 1 // don't read event number + + v.Detail = buf[b] + b += 1 + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Time = Timestamp(Get32(buf[b:])) + b += 4 + + v.Window = Id(Get32(buf[b:])) + b += 4 + + v.Mode = buf[b] + b += 1 + + v.DeviceId = buf[b] + b += 1 + + b += 18 // padding + + return v +} + +// Event write XinputFocusIn +func (v XinputFocusInEvent) 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 + + Put32(buf[b:], uint32(v.Time)) + b += 4 + + Put32(buf[b:], uint32(v.Window)) + b += 4 + + buf[b] = v.Mode + b += 1 + + buf[b] = v.DeviceId + b += 1 + + b += 18 // padding + + return buf +} + +func (v XinputFocusInEvent) ImplementsEvent() {} + +func (v XinputFocusInEvent) SequenceId() uint16 { + return v.Sequence +} + +func (v XinputFocusInEvent) String() string { + fieldVals := make([]string, 0, 6) + fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) + fieldVals = append(fieldVals, sprintf("Detail: %d", v.Detail)) + fieldVals = append(fieldVals, sprintf("Time: %d", v.Time)) + fieldVals = append(fieldVals, sprintf("Window: %d", v.Window)) + fieldVals = append(fieldVals, sprintf("Mode: %d", v.Mode)) + fieldVals = append(fieldVals, sprintf("DeviceId: %d", v.DeviceId)) + return "XinputFocusIn {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newEventFuncs[6] = NewXinputFocusInEvent +} + +// Event definition XinputDeviceStateNotify (10) +// Size: 32 + +const XinputDeviceStateNotify = 10 + +type XinputDeviceStateNotifyEvent struct { + Sequence uint16 + DeviceId byte + Time Timestamp + NumKeys byte + NumButtons byte + NumValuators byte + ClassesReported byte + Buttons []byte // size: 4 + Keys []byte // size: 4 + Valuators []uint32 // size: 12 +} + +// Event read XinputDeviceStateNotify +func NewXinputDeviceStateNotifyEvent(buf []byte) Event { + v := XinputDeviceStateNotifyEvent{} + b := 1 // don't read event number + + v.DeviceId = buf[b] + b += 1 + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Time = Timestamp(Get32(buf[b:])) + b += 4 + + v.NumKeys = buf[b] + b += 1 + + v.NumButtons = buf[b] + b += 1 + + v.NumValuators = buf[b] + b += 1 + + v.ClassesReported = buf[b] + b += 1 + + v.Buttons = make([]byte, 4) + copy(v.Buttons[:4], buf[b:]) + b += pad(int(4)) + + v.Keys = make([]byte, 4) + copy(v.Keys[:4], buf[b:]) + b += pad(int(4)) + + v.Valuators = make([]uint32, 3) + for i := 0; i < int(3); i++ { + v.Valuators[i] = Get32(buf[b:]) + b += 4 + } + b = pad(b) + + return v +} + +// Event write XinputDeviceStateNotify +func (v XinputDeviceStateNotifyEvent) Bytes() []byte { + buf := make([]byte, 32) + b := 0 + + // write event number + buf[b] = 10 + b += 1 + + buf[b] = v.DeviceId + b += 1 + + b += 2 // skip sequence number + + Put32(buf[b:], uint32(v.Time)) + b += 4 + + buf[b] = v.NumKeys + b += 1 + + buf[b] = v.NumButtons + b += 1 + + buf[b] = v.NumValuators + b += 1 + + buf[b] = v.ClassesReported + b += 1 + + copy(buf[b:], v.Buttons[:4]) + b += pad(int(4)) + + copy(buf[b:], v.Keys[:4]) + b += pad(int(4)) + + for i := 0; i < int(3); i++ { + Put32(buf[b:], v.Valuators[i]) + b += 4 + } + b = pad(b) + + return buf +} + +func (v XinputDeviceStateNotifyEvent) ImplementsEvent() {} + +func (v XinputDeviceStateNotifyEvent) SequenceId() uint16 { + return v.Sequence +} + +func (v XinputDeviceStateNotifyEvent) String() string { + fieldVals := make([]string, 0, 9) + fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) + fieldVals = append(fieldVals, sprintf("DeviceId: %d", v.DeviceId)) + fieldVals = append(fieldVals, sprintf("Time: %d", v.Time)) + fieldVals = append(fieldVals, sprintf("NumKeys: %d", v.NumKeys)) + fieldVals = append(fieldVals, sprintf("NumButtons: %d", v.NumButtons)) + fieldVals = append(fieldVals, sprintf("NumValuators: %d", v.NumValuators)) + fieldVals = append(fieldVals, sprintf("ClassesReported: %d", v.ClassesReported)) + return "XinputDeviceStateNotify {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newEventFuncs[10] = NewXinputDeviceStateNotifyEvent +} + +// Event definition XinputDeviceMappingNotify (11) +// Size: 32 + +const XinputDeviceMappingNotify = 11 + +type XinputDeviceMappingNotifyEvent struct { + Sequence uint16 + DeviceId byte + Request byte + FirstKeycode XinputKeyCode + Count byte + // padding: 1 bytes + Time Timestamp + // padding: 20 bytes +} + +// Event read XinputDeviceMappingNotify +func NewXinputDeviceMappingNotifyEvent(buf []byte) Event { + v := XinputDeviceMappingNotifyEvent{} + b := 1 // don't read event number + + v.DeviceId = buf[b] + b += 1 + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Request = buf[b] + b += 1 + + v.FirstKeycode = XinputKeyCode(buf[b]) + b += 1 + + v.Count = buf[b] + b += 1 + + b += 1 // padding + + v.Time = Timestamp(Get32(buf[b:])) + b += 4 + + b += 20 // padding + + return v +} + +// Event write XinputDeviceMappingNotify +func (v XinputDeviceMappingNotifyEvent) Bytes() []byte { + buf := make([]byte, 32) + b := 0 + + // write event number + buf[b] = 11 + b += 1 + + buf[b] = v.DeviceId + b += 1 + + 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 + + Put32(buf[b:], uint32(v.Time)) + b += 4 + + b += 20 // padding + + return buf +} + +func (v XinputDeviceMappingNotifyEvent) ImplementsEvent() {} + +func (v XinputDeviceMappingNotifyEvent) SequenceId() uint16 { + return v.Sequence +} + +func (v XinputDeviceMappingNotifyEvent) String() string { + fieldVals := make([]string, 0, 7) + fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) + fieldVals = append(fieldVals, sprintf("DeviceId: %d", v.DeviceId)) + fieldVals = append(fieldVals, sprintf("Request: %d", v.Request)) + fieldVals = append(fieldVals, sprintf("FirstKeycode: %d", v.FirstKeycode)) + fieldVals = append(fieldVals, sprintf("Count: %d", v.Count)) + fieldVals = append(fieldVals, sprintf("Time: %d", v.Time)) + return "XinputDeviceMappingNotify {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newEventFuncs[11] = NewXinputDeviceMappingNotifyEvent +} + +// Event definition XinputChangeDeviceNotify (12) +// Size: 32 + +const XinputChangeDeviceNotify = 12 + +type XinputChangeDeviceNotifyEvent struct { + Sequence uint16 + DeviceId byte + Time Timestamp + Request byte + // padding: 23 bytes +} + +// Event read XinputChangeDeviceNotify +func NewXinputChangeDeviceNotifyEvent(buf []byte) Event { + v := XinputChangeDeviceNotifyEvent{} + b := 1 // don't read event number + + v.DeviceId = buf[b] + b += 1 + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Time = Timestamp(Get32(buf[b:])) + b += 4 + + v.Request = buf[b] + b += 1 + + b += 23 // padding + + return v +} + +// Event write XinputChangeDeviceNotify +func (v XinputChangeDeviceNotifyEvent) Bytes() []byte { + buf := make([]byte, 32) + b := 0 + + // write event number + buf[b] = 12 + b += 1 + + buf[b] = v.DeviceId + b += 1 + + b += 2 // skip sequence number + + Put32(buf[b:], uint32(v.Time)) + b += 4 + + buf[b] = v.Request + b += 1 + + b += 23 // padding + + return buf +} + +func (v XinputChangeDeviceNotifyEvent) ImplementsEvent() {} + +func (v XinputChangeDeviceNotifyEvent) SequenceId() uint16 { + return v.Sequence +} + +func (v XinputChangeDeviceNotifyEvent) String() string { + fieldVals := make([]string, 0, 4) + fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) + fieldVals = append(fieldVals, sprintf("DeviceId: %d", v.DeviceId)) + fieldVals = append(fieldVals, sprintf("Time: %d", v.Time)) + fieldVals = append(fieldVals, sprintf("Request: %d", v.Request)) + return "XinputChangeDeviceNotify {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newEventFuncs[12] = NewXinputChangeDeviceNotifyEvent +} + +// Event definition XinputDeviceKeyStateNotify (13) +// Size: 32 + +const XinputDeviceKeyStateNotify = 13 + +type XinputDeviceKeyStateNotifyEvent struct { + Sequence uint16 + DeviceId byte + Keys []byte // size: 28 +} + +// Event read XinputDeviceKeyStateNotify +func NewXinputDeviceKeyStateNotifyEvent(buf []byte) Event { + v := XinputDeviceKeyStateNotifyEvent{} + b := 1 // don't read event number + + v.DeviceId = buf[b] + b += 1 + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Keys = make([]byte, 28) + copy(v.Keys[:28], buf[b:]) + b += pad(int(28)) + + return v +} + +// Event write XinputDeviceKeyStateNotify +func (v XinputDeviceKeyStateNotifyEvent) Bytes() []byte { + buf := make([]byte, 32) + b := 0 + + // write event number + buf[b] = 13 + b += 1 + + buf[b] = v.DeviceId + b += 1 + + b += 2 // skip sequence number + + copy(buf[b:], v.Keys[:28]) + b += pad(int(28)) + + return buf +} + +func (v XinputDeviceKeyStateNotifyEvent) ImplementsEvent() {} + +func (v XinputDeviceKeyStateNotifyEvent) SequenceId() uint16 { + return v.Sequence +} + +func (v XinputDeviceKeyStateNotifyEvent) String() string { + fieldVals := make([]string, 0, 2) + fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) + fieldVals = append(fieldVals, sprintf("DeviceId: %d", v.DeviceId)) + return "XinputDeviceKeyStateNotify {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newEventFuncs[13] = NewXinputDeviceKeyStateNotifyEvent +} + +// Event definition XinputDeviceButtonStateNotify (14) +// Size: 32 + +const XinputDeviceButtonStateNotify = 14 + +type XinputDeviceButtonStateNotifyEvent struct { + Sequence uint16 + DeviceId byte + Buttons []byte // size: 28 +} + +// Event read XinputDeviceButtonStateNotify +func NewXinputDeviceButtonStateNotifyEvent(buf []byte) Event { + v := XinputDeviceButtonStateNotifyEvent{} + b := 1 // don't read event number + + v.DeviceId = buf[b] + b += 1 + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Buttons = make([]byte, 28) + copy(v.Buttons[:28], buf[b:]) + b += pad(int(28)) + + return v +} + +// Event write XinputDeviceButtonStateNotify +func (v XinputDeviceButtonStateNotifyEvent) Bytes() []byte { + buf := make([]byte, 32) + b := 0 + + // write event number + buf[b] = 14 + b += 1 + + buf[b] = v.DeviceId + b += 1 + + b += 2 // skip sequence number + + copy(buf[b:], v.Buttons[:28]) + b += pad(int(28)) + + return buf +} + +func (v XinputDeviceButtonStateNotifyEvent) ImplementsEvent() {} + +func (v XinputDeviceButtonStateNotifyEvent) SequenceId() uint16 { + return v.Sequence +} + +func (v XinputDeviceButtonStateNotifyEvent) String() string { + fieldVals := make([]string, 0, 2) + fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) + fieldVals = append(fieldVals, sprintf("DeviceId: %d", v.DeviceId)) + return "XinputDeviceButtonStateNotify {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newEventFuncs[14] = NewXinputDeviceButtonStateNotifyEvent +} + +// Event definition XinputDevicePresenceNotify (15) +// Size: 32 + +const XinputDevicePresenceNotify = 15 + +type XinputDevicePresenceNotifyEvent struct { + Sequence uint16 + // padding: 1 bytes + Time Timestamp + Devchange byte + DeviceId byte + Control uint16 + // padding: 20 bytes +} + +// Event read XinputDevicePresenceNotify +func NewXinputDevicePresenceNotifyEvent(buf []byte) Event { + v := XinputDevicePresenceNotifyEvent{} + b := 1 // don't read event number + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Time = Timestamp(Get32(buf[b:])) + b += 4 + + v.Devchange = buf[b] + b += 1 + + v.DeviceId = buf[b] + b += 1 + + v.Control = Get16(buf[b:]) + b += 2 + + b += 20 // padding + + return v +} + +// Event write XinputDevicePresenceNotify +func (v XinputDevicePresenceNotifyEvent) Bytes() []byte { + buf := make([]byte, 32) + b := 0 + + // write event number + buf[b] = 15 + b += 1 + + b += 1 // padding + + b += 2 // skip sequence number + + Put32(buf[b:], uint32(v.Time)) + b += 4 + + buf[b] = v.Devchange + b += 1 + + buf[b] = v.DeviceId + b += 1 + + Put16(buf[b:], v.Control) + b += 2 + + b += 20 // padding + + return buf +} + +func (v XinputDevicePresenceNotifyEvent) ImplementsEvent() {} + +func (v XinputDevicePresenceNotifyEvent) SequenceId() uint16 { + return v.Sequence +} + +func (v XinputDevicePresenceNotifyEvent) String() string { + fieldVals := make([]string, 0, 6) + fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) + fieldVals = append(fieldVals, sprintf("Time: %d", v.Time)) + fieldVals = append(fieldVals, sprintf("Devchange: %d", v.Devchange)) + fieldVals = append(fieldVals, sprintf("DeviceId: %d", v.DeviceId)) + fieldVals = append(fieldVals, sprintf("Control: %d", v.Control)) + return "XinputDevicePresenceNotify {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newEventFuncs[15] = NewXinputDevicePresenceNotifyEvent +} + +// EventCopy definition XinputDeviceKeyRelease (2) + +const XinputDeviceKeyRelease = 2 + +type XinputDeviceKeyReleaseEvent XinputDeviceKeyPressEvent + +func NewXinputDeviceKeyReleaseEvent(buf []byte) Event { + return XinputDeviceKeyReleaseEvent(NewXinputDeviceKeyPressEvent(buf).(XinputDeviceKeyPressEvent)) +} + +func (v XinputDeviceKeyReleaseEvent) Bytes() []byte { + return XinputDeviceKeyPressEvent(v).Bytes() +} + +func (v XinputDeviceKeyReleaseEvent) ImplementsEvent() {} + +func (v XinputDeviceKeyReleaseEvent) SequenceId() uint16 { + return v.Sequence +} + +func (v XinputDeviceKeyReleaseEvent) String() string { + fieldVals := make([]string, 0, 12) + fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) + fieldVals = append(fieldVals, sprintf("Detail: %d", v.Detail)) + fieldVals = append(fieldVals, sprintf("Time: %d", v.Time)) + fieldVals = append(fieldVals, sprintf("Root: %d", v.Root)) + fieldVals = append(fieldVals, sprintf("Event: %d", v.Event)) + fieldVals = append(fieldVals, sprintf("Child: %d", v.Child)) + fieldVals = append(fieldVals, sprintf("RootX: %d", v.RootX)) + fieldVals = append(fieldVals, sprintf("RootY: %d", v.RootY)) + fieldVals = append(fieldVals, sprintf("EventX: %d", v.EventX)) + fieldVals = append(fieldVals, sprintf("EventY: %d", v.EventY)) + fieldVals = append(fieldVals, sprintf("State: %d", v.State)) + fieldVals = append(fieldVals, sprintf("SameScreen: %t", v.SameScreen)) + fieldVals = append(fieldVals, sprintf("DeviceId: %d", v.DeviceId)) + return "XinputDeviceKeyRelease {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newEventFuncs[2] = NewXinputDeviceKeyReleaseEvent +} + +// EventCopy definition XinputDeviceButtonPress (3) + +const XinputDeviceButtonPress = 3 + +type XinputDeviceButtonPressEvent XinputDeviceKeyPressEvent + +func NewXinputDeviceButtonPressEvent(buf []byte) Event { + return XinputDeviceButtonPressEvent(NewXinputDeviceKeyPressEvent(buf).(XinputDeviceKeyPressEvent)) +} + +func (v XinputDeviceButtonPressEvent) Bytes() []byte { + return XinputDeviceKeyPressEvent(v).Bytes() +} + +func (v XinputDeviceButtonPressEvent) ImplementsEvent() {} + +func (v XinputDeviceButtonPressEvent) SequenceId() uint16 { + return v.Sequence +} + +func (v XinputDeviceButtonPressEvent) String() string { + fieldVals := make([]string, 0, 12) + fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) + fieldVals = append(fieldVals, sprintf("Detail: %d", v.Detail)) + fieldVals = append(fieldVals, sprintf("Time: %d", v.Time)) + fieldVals = append(fieldVals, sprintf("Root: %d", v.Root)) + fieldVals = append(fieldVals, sprintf("Event: %d", v.Event)) + fieldVals = append(fieldVals, sprintf("Child: %d", v.Child)) + fieldVals = append(fieldVals, sprintf("RootX: %d", v.RootX)) + fieldVals = append(fieldVals, sprintf("RootY: %d", v.RootY)) + fieldVals = append(fieldVals, sprintf("EventX: %d", v.EventX)) + fieldVals = append(fieldVals, sprintf("EventY: %d", v.EventY)) + fieldVals = append(fieldVals, sprintf("State: %d", v.State)) + fieldVals = append(fieldVals, sprintf("SameScreen: %t", v.SameScreen)) + fieldVals = append(fieldVals, sprintf("DeviceId: %d", v.DeviceId)) + return "XinputDeviceButtonPress {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newEventFuncs[3] = NewXinputDeviceButtonPressEvent +} + +// EventCopy definition XinputDeviceButtonRelease (4) + +const XinputDeviceButtonRelease = 4 + +type XinputDeviceButtonReleaseEvent XinputDeviceKeyPressEvent + +func NewXinputDeviceButtonReleaseEvent(buf []byte) Event { + return XinputDeviceButtonReleaseEvent(NewXinputDeviceKeyPressEvent(buf).(XinputDeviceKeyPressEvent)) +} + +func (v XinputDeviceButtonReleaseEvent) Bytes() []byte { + return XinputDeviceKeyPressEvent(v).Bytes() +} + +func (v XinputDeviceButtonReleaseEvent) ImplementsEvent() {} + +func (v XinputDeviceButtonReleaseEvent) SequenceId() uint16 { + return v.Sequence +} + +func (v XinputDeviceButtonReleaseEvent) String() string { + fieldVals := make([]string, 0, 12) + fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) + fieldVals = append(fieldVals, sprintf("Detail: %d", v.Detail)) + fieldVals = append(fieldVals, sprintf("Time: %d", v.Time)) + fieldVals = append(fieldVals, sprintf("Root: %d", v.Root)) + fieldVals = append(fieldVals, sprintf("Event: %d", v.Event)) + fieldVals = append(fieldVals, sprintf("Child: %d", v.Child)) + fieldVals = append(fieldVals, sprintf("RootX: %d", v.RootX)) + fieldVals = append(fieldVals, sprintf("RootY: %d", v.RootY)) + fieldVals = append(fieldVals, sprintf("EventX: %d", v.EventX)) + fieldVals = append(fieldVals, sprintf("EventY: %d", v.EventY)) + fieldVals = append(fieldVals, sprintf("State: %d", v.State)) + fieldVals = append(fieldVals, sprintf("SameScreen: %t", v.SameScreen)) + fieldVals = append(fieldVals, sprintf("DeviceId: %d", v.DeviceId)) + return "XinputDeviceButtonRelease {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newEventFuncs[4] = NewXinputDeviceButtonReleaseEvent +} + +// EventCopy definition XinputDeviceMotionNotify (5) + +const XinputDeviceMotionNotify = 5 + +type XinputDeviceMotionNotifyEvent XinputDeviceKeyPressEvent + +func NewXinputDeviceMotionNotifyEvent(buf []byte) Event { + return XinputDeviceMotionNotifyEvent(NewXinputDeviceKeyPressEvent(buf).(XinputDeviceKeyPressEvent)) +} + +func (v XinputDeviceMotionNotifyEvent) Bytes() []byte { + return XinputDeviceKeyPressEvent(v).Bytes() +} + +func (v XinputDeviceMotionNotifyEvent) ImplementsEvent() {} + +func (v XinputDeviceMotionNotifyEvent) SequenceId() uint16 { + return v.Sequence +} + +func (v XinputDeviceMotionNotifyEvent) String() string { + fieldVals := make([]string, 0, 12) + fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) + fieldVals = append(fieldVals, sprintf("Detail: %d", v.Detail)) + fieldVals = append(fieldVals, sprintf("Time: %d", v.Time)) + fieldVals = append(fieldVals, sprintf("Root: %d", v.Root)) + fieldVals = append(fieldVals, sprintf("Event: %d", v.Event)) + fieldVals = append(fieldVals, sprintf("Child: %d", v.Child)) + fieldVals = append(fieldVals, sprintf("RootX: %d", v.RootX)) + fieldVals = append(fieldVals, sprintf("RootY: %d", v.RootY)) + fieldVals = append(fieldVals, sprintf("EventX: %d", v.EventX)) + fieldVals = append(fieldVals, sprintf("EventY: %d", v.EventY)) + fieldVals = append(fieldVals, sprintf("State: %d", v.State)) + fieldVals = append(fieldVals, sprintf("SameScreen: %t", v.SameScreen)) + fieldVals = append(fieldVals, sprintf("DeviceId: %d", v.DeviceId)) + return "XinputDeviceMotionNotify {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newEventFuncs[5] = NewXinputDeviceMotionNotifyEvent +} + +// EventCopy definition XinputProximityIn (8) + +const XinputProximityIn = 8 + +type XinputProximityInEvent XinputDeviceKeyPressEvent + +func NewXinputProximityInEvent(buf []byte) Event { + return XinputProximityInEvent(NewXinputDeviceKeyPressEvent(buf).(XinputDeviceKeyPressEvent)) +} + +func (v XinputProximityInEvent) Bytes() []byte { + return XinputDeviceKeyPressEvent(v).Bytes() +} + +func (v XinputProximityInEvent) ImplementsEvent() {} + +func (v XinputProximityInEvent) SequenceId() uint16 { + return v.Sequence +} + +func (v XinputProximityInEvent) String() string { + fieldVals := make([]string, 0, 12) + fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) + fieldVals = append(fieldVals, sprintf("Detail: %d", v.Detail)) + fieldVals = append(fieldVals, sprintf("Time: %d", v.Time)) + fieldVals = append(fieldVals, sprintf("Root: %d", v.Root)) + fieldVals = append(fieldVals, sprintf("Event: %d", v.Event)) + fieldVals = append(fieldVals, sprintf("Child: %d", v.Child)) + fieldVals = append(fieldVals, sprintf("RootX: %d", v.RootX)) + fieldVals = append(fieldVals, sprintf("RootY: %d", v.RootY)) + fieldVals = append(fieldVals, sprintf("EventX: %d", v.EventX)) + fieldVals = append(fieldVals, sprintf("EventY: %d", v.EventY)) + fieldVals = append(fieldVals, sprintf("State: %d", v.State)) + fieldVals = append(fieldVals, sprintf("SameScreen: %t", v.SameScreen)) + fieldVals = append(fieldVals, sprintf("DeviceId: %d", v.DeviceId)) + return "XinputProximityIn {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newEventFuncs[8] = NewXinputProximityInEvent +} + +// EventCopy definition XinputProximityOut (9) + +const XinputProximityOut = 9 + +type XinputProximityOutEvent XinputDeviceKeyPressEvent + +func NewXinputProximityOutEvent(buf []byte) Event { + return XinputProximityOutEvent(NewXinputDeviceKeyPressEvent(buf).(XinputDeviceKeyPressEvent)) +} + +func (v XinputProximityOutEvent) Bytes() []byte { + return XinputDeviceKeyPressEvent(v).Bytes() +} + +func (v XinputProximityOutEvent) ImplementsEvent() {} + +func (v XinputProximityOutEvent) SequenceId() uint16 { + return v.Sequence +} + +func (v XinputProximityOutEvent) String() string { + fieldVals := make([]string, 0, 12) + fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) + fieldVals = append(fieldVals, sprintf("Detail: %d", v.Detail)) + fieldVals = append(fieldVals, sprintf("Time: %d", v.Time)) + fieldVals = append(fieldVals, sprintf("Root: %d", v.Root)) + fieldVals = append(fieldVals, sprintf("Event: %d", v.Event)) + fieldVals = append(fieldVals, sprintf("Child: %d", v.Child)) + fieldVals = append(fieldVals, sprintf("RootX: %d", v.RootX)) + fieldVals = append(fieldVals, sprintf("RootY: %d", v.RootY)) + fieldVals = append(fieldVals, sprintf("EventX: %d", v.EventX)) + fieldVals = append(fieldVals, sprintf("EventY: %d", v.EventY)) + fieldVals = append(fieldVals, sprintf("State: %d", v.State)) + fieldVals = append(fieldVals, sprintf("SameScreen: %t", v.SameScreen)) + fieldVals = append(fieldVals, sprintf("DeviceId: %d", v.DeviceId)) + return "XinputProximityOut {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newEventFuncs[9] = NewXinputProximityOutEvent +} + +// EventCopy definition XinputFocusOut (7) + +const XinputFocusOut = 7 + +type XinputFocusOutEvent XinputFocusInEvent + +func NewXinputFocusOutEvent(buf []byte) Event { + return XinputFocusOutEvent(NewXinputFocusInEvent(buf).(XinputFocusInEvent)) +} + +func (v XinputFocusOutEvent) Bytes() []byte { + return XinputFocusInEvent(v).Bytes() +} + +func (v XinputFocusOutEvent) ImplementsEvent() {} + +func (v XinputFocusOutEvent) SequenceId() uint16 { + return v.Sequence +} + +func (v XinputFocusOutEvent) String() string { + fieldVals := make([]string, 0, 6) + fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) + fieldVals = append(fieldVals, sprintf("Detail: %d", v.Detail)) + fieldVals = append(fieldVals, sprintf("Time: %d", v.Time)) + fieldVals = append(fieldVals, sprintf("Window: %d", v.Window)) + fieldVals = append(fieldVals, sprintf("Mode: %d", v.Mode)) + fieldVals = append(fieldVals, sprintf("DeviceId: %d", v.DeviceId)) + return "XinputFocusOut {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newEventFuncs[7] = NewXinputFocusOutEvent +} + +// Error definition XinputDevice (0) +// Size: 32 + +const BadXinputDevice = 0 + +type XinputDeviceError struct { + Sequence uint16 + NiceName string +} + +// Error read XinputDevice +func NewXinputDeviceError(buf []byte) Error { + v := XinputDeviceError{} + v.NiceName = "XinputDevice" + + b := 1 // skip error determinant + b += 1 // don't read error number + + v.Sequence = Get16(buf[b:]) + b += 2 + + return v +} + +func (err XinputDeviceError) ImplementsError() {} + +func (err XinputDeviceError) SequenceId() uint16 { + return err.Sequence +} + +func (err XinputDeviceError) BadId() Id { + return 0 +} + +func (err XinputDeviceError) Error() string { + fieldVals := make([]string, 0, 0) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) + return "BadXinputDevice {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newErrorFuncs[0] = NewXinputDeviceError +} + +// Error definition XinputEvent (1) +// Size: 32 + +const BadXinputEvent = 1 + +type XinputEventError struct { + Sequence uint16 + NiceName string +} + +// Error read XinputEvent +func NewXinputEventError(buf []byte) Error { + v := XinputEventError{} + v.NiceName = "XinputEvent" + + b := 1 // skip error determinant + b += 1 // don't read error number + + v.Sequence = Get16(buf[b:]) + b += 2 + + return v +} + +func (err XinputEventError) ImplementsError() {} + +func (err XinputEventError) SequenceId() uint16 { + return err.Sequence +} + +func (err XinputEventError) BadId() Id { + return 0 +} + +func (err XinputEventError) Error() string { + fieldVals := make([]string, 0, 0) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) + return "BadXinputEvent {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newErrorFuncs[1] = NewXinputEventError +} + +// Error definition XinputMode (2) +// Size: 32 + +const BadXinputMode = 2 + +type XinputModeError struct { + Sequence uint16 + NiceName string +} + +// Error read XinputMode +func NewXinputModeError(buf []byte) Error { + v := XinputModeError{} + v.NiceName = "XinputMode" + + b := 1 // skip error determinant + b += 1 // don't read error number + + v.Sequence = Get16(buf[b:]) + b += 2 + + return v +} + +func (err XinputModeError) ImplementsError() {} + +func (err XinputModeError) SequenceId() uint16 { + return err.Sequence +} + +func (err XinputModeError) BadId() Id { + return 0 +} + +func (err XinputModeError) Error() string { + fieldVals := make([]string, 0, 0) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) + return "BadXinputMode {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newErrorFuncs[2] = NewXinputModeError +} + +// Error definition XinputDeviceBusy (3) +// Size: 32 + +const BadXinputDeviceBusy = 3 + +type XinputDeviceBusyError struct { + Sequence uint16 + NiceName string +} + +// Error read XinputDeviceBusy +func NewXinputDeviceBusyError(buf []byte) Error { + v := XinputDeviceBusyError{} + v.NiceName = "XinputDeviceBusy" + + b := 1 // skip error determinant + b += 1 // don't read error number + + v.Sequence = Get16(buf[b:]) + b += 2 + + return v +} + +func (err XinputDeviceBusyError) ImplementsError() {} + +func (err XinputDeviceBusyError) SequenceId() uint16 { + return err.Sequence +} + +func (err XinputDeviceBusyError) BadId() Id { + return 0 +} + +func (err XinputDeviceBusyError) Error() string { + fieldVals := make([]string, 0, 0) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) + return "BadXinputDeviceBusy {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newErrorFuncs[3] = NewXinputDeviceBusyError +} + +// Error definition XinputClass (4) +// Size: 32 + +const BadXinputClass = 4 + +type XinputClassError struct { + Sequence uint16 + NiceName string +} + +// Error read XinputClass +func NewXinputClassError(buf []byte) Error { + v := XinputClassError{} + v.NiceName = "XinputClass" + + b := 1 // skip error determinant + b += 1 // don't read error number + + v.Sequence = Get16(buf[b:]) + b += 2 + + return v +} + +func (err XinputClassError) ImplementsError() {} + +func (err XinputClassError) SequenceId() uint16 { + return err.Sequence +} + +func (err XinputClassError) BadId() Id { + return 0 +} + +func (err XinputClassError) Error() string { + fieldVals := make([]string, 0, 0) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) + return "BadXinputClass {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newErrorFuncs[4] = NewXinputClassError +} + +// Request XinputGetExtensionVersion +// size: pad((8 + pad((int(NameLen) * 1)))) +type XinputGetExtensionVersionCookie struct { + *cookie +} + +func (c *Conn) XinputGetExtensionVersion(NameLen uint16, Name string) XinputGetExtensionVersionCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xinputGetExtensionVersionRequest(NameLen, Name), cookie) + return XinputGetExtensionVersionCookie{cookie} +} + +func (c *Conn) XinputGetExtensionVersionUnchecked(NameLen uint16, Name string) XinputGetExtensionVersionCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xinputGetExtensionVersionRequest(NameLen, Name), cookie) + return XinputGetExtensionVersionCookie{cookie} +} + +// Request reply for XinputGetExtensionVersion +// size: 32 +type XinputGetExtensionVersionReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + ServerMajor uint16 + ServerMinor uint16 + Present bool + // padding: 19 bytes +} + +// Waits and reads reply data from request XinputGetExtensionVersion +func (cook XinputGetExtensionVersionCookie) Reply() (*XinputGetExtensionVersionReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xinputGetExtensionVersionReply(buf), nil +} + +// Read reply into structure from buffer for XinputGetExtensionVersion +func xinputGetExtensionVersionReply(buf []byte) *XinputGetExtensionVersionReply { + v := new(XinputGetExtensionVersionReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.ServerMajor = Get16(buf[b:]) + b += 2 + + v.ServerMinor = Get16(buf[b:]) + b += 2 + + if buf[b] == 1 { + v.Present = true + } else { + v.Present = false + } + b += 1 + + b += 19 // padding + + return v +} + +func (cook XinputGetExtensionVersionCookie) Check() error { + return cook.check() +} + +// Write request to wire for XinputGetExtensionVersion +func (c *Conn) xinputGetExtensionVersionRequest(NameLen uint16, Name string) []byte { + size := pad((8 + pad((int(NameLen) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XINPUTEXTENSION"] + b += 1 + + buf[b] = 1 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put16(buf[b:], NameLen) + b += 2 + + b += 2 // padding + + copy(buf[b:], Name[:NameLen]) + b += pad(int(NameLen)) + + return buf +} + +// Request XinputListInputDevices +// size: 4 +type XinputListInputDevicesCookie struct { + *cookie +} + +func (c *Conn) XinputListInputDevices() XinputListInputDevicesCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xinputListInputDevicesRequest(), cookie) + return XinputListInputDevicesCookie{cookie} +} + +func (c *Conn) XinputListInputDevicesUnchecked() XinputListInputDevicesCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xinputListInputDevicesRequest(), cookie) + return XinputListInputDevicesCookie{cookie} +} + +// Request reply for XinputListInputDevices +// size: (32 + pad((int(DevicesLen) * 8))) +type XinputListInputDevicesReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + DevicesLen byte + // padding: 23 bytes + Devices []XinputDeviceInfo // size: pad((int(DevicesLen) * 8)) +} + +// Waits and reads reply data from request XinputListInputDevices +func (cook XinputListInputDevicesCookie) Reply() (*XinputListInputDevicesReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xinputListInputDevicesReply(buf), nil +} + +// Read reply into structure from buffer for XinputListInputDevices +func xinputListInputDevicesReply(buf []byte) *XinputListInputDevicesReply { + v := new(XinputListInputDevicesReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.DevicesLen = buf[b] + b += 1 + + b += 23 // padding + + v.Devices = make([]XinputDeviceInfo, v.DevicesLen) + b += ReadXinputDeviceInfoList(buf[b:], v.Devices) + + return v +} + +func (cook XinputListInputDevicesCookie) Check() error { + return cook.check() +} + +// Write request to wire for XinputListInputDevices +func (c *Conn) xinputListInputDevicesRequest() []byte { + size := 4 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XINPUTEXTENSION"] + b += 1 + + buf[b] = 2 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + return buf +} + +// Request XinputOpenDevice +// size: 8 +type XinputOpenDeviceCookie struct { + *cookie +} + +func (c *Conn) XinputOpenDevice(DeviceId byte) XinputOpenDeviceCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xinputOpenDeviceRequest(DeviceId), cookie) + return XinputOpenDeviceCookie{cookie} +} + +func (c *Conn) XinputOpenDeviceUnchecked(DeviceId byte) XinputOpenDeviceCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xinputOpenDeviceRequest(DeviceId), cookie) + return XinputOpenDeviceCookie{cookie} +} + +// Request reply for XinputOpenDevice +// size: (32 + pad((int(NumClasses) * 2))) +type XinputOpenDeviceReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + NumClasses byte + // padding: 23 bytes + ClassInfo []XinputInputClassInfo // size: pad((int(NumClasses) * 2)) +} + +// Waits and reads reply data from request XinputOpenDevice +func (cook XinputOpenDeviceCookie) Reply() (*XinputOpenDeviceReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xinputOpenDeviceReply(buf), nil +} + +// Read reply into structure from buffer for XinputOpenDevice +func xinputOpenDeviceReply(buf []byte) *XinputOpenDeviceReply { + v := new(XinputOpenDeviceReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.NumClasses = buf[b] + b += 1 + + b += 23 // padding + + v.ClassInfo = make([]XinputInputClassInfo, v.NumClasses) + b += ReadXinputInputClassInfoList(buf[b:], v.ClassInfo) + + return v +} + +func (cook XinputOpenDeviceCookie) Check() error { + return cook.check() +} + +// Write request to wire for XinputOpenDevice +func (c *Conn) xinputOpenDeviceRequest(DeviceId byte) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XINPUTEXTENSION"] + b += 1 + + buf[b] = 3 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = DeviceId + b += 1 + + b += 3 // padding + + return buf +} + +// Request XinputCloseDevice +// size: 8 +type XinputCloseDeviceCookie struct { + *cookie +} + +// Write request to wire for XinputCloseDevice +func (c *Conn) XinputCloseDevice(DeviceId byte) XinputCloseDeviceCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xinputCloseDeviceRequest(DeviceId), cookie) + return XinputCloseDeviceCookie{cookie} +} + +func (c *Conn) XinputCloseDeviceChecked(DeviceId byte) XinputCloseDeviceCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xinputCloseDeviceRequest(DeviceId), cookie) + return XinputCloseDeviceCookie{cookie} +} + +func (cook XinputCloseDeviceCookie) Check() error { + return cook.check() +} + +// Write request to wire for XinputCloseDevice +func (c *Conn) xinputCloseDeviceRequest(DeviceId byte) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XINPUTEXTENSION"] + b += 1 + + buf[b] = 4 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = DeviceId + b += 1 + + b += 3 // padding + + return buf +} + +// Request XinputSetDeviceMode +// size: 8 +type XinputSetDeviceModeCookie struct { + *cookie +} + +func (c *Conn) XinputSetDeviceMode(DeviceId byte, Mode byte) XinputSetDeviceModeCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xinputSetDeviceModeRequest(DeviceId, Mode), cookie) + return XinputSetDeviceModeCookie{cookie} +} + +func (c *Conn) XinputSetDeviceModeUnchecked(DeviceId byte, Mode byte) XinputSetDeviceModeCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xinputSetDeviceModeRequest(DeviceId, Mode), cookie) + return XinputSetDeviceModeCookie{cookie} +} + +// Request reply for XinputSetDeviceMode +// size: 32 +type XinputSetDeviceModeReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Status byte + // padding: 23 bytes +} + +// Waits and reads reply data from request XinputSetDeviceMode +func (cook XinputSetDeviceModeCookie) Reply() (*XinputSetDeviceModeReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xinputSetDeviceModeReply(buf), nil +} + +// Read reply into structure from buffer for XinputSetDeviceMode +func xinputSetDeviceModeReply(buf []byte) *XinputSetDeviceModeReply { + v := new(XinputSetDeviceModeReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.Status = buf[b] + b += 1 + + b += 23 // padding + + return v +} + +func (cook XinputSetDeviceModeCookie) Check() error { + return cook.check() +} + +// Write request to wire for XinputSetDeviceMode +func (c *Conn) xinputSetDeviceModeRequest(DeviceId byte, Mode byte) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XINPUTEXTENSION"] + b += 1 + + buf[b] = 5 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = DeviceId + b += 1 + + buf[b] = Mode + b += 1 + + b += 2 // padding + + return buf +} + +// Request XinputSelectExtensionEvent +// size: pad((12 + pad((int(NumClasses) * 4)))) +type XinputSelectExtensionEventCookie struct { + *cookie +} + +// Write request to wire for XinputSelectExtensionEvent +func (c *Conn) XinputSelectExtensionEvent(Window Id, NumClasses uint16, Classes []XinputEventClass) XinputSelectExtensionEventCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xinputSelectExtensionEventRequest(Window, NumClasses, Classes), cookie) + return XinputSelectExtensionEventCookie{cookie} +} + +func (c *Conn) XinputSelectExtensionEventChecked(Window Id, NumClasses uint16, Classes []XinputEventClass) XinputSelectExtensionEventCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xinputSelectExtensionEventRequest(Window, NumClasses, Classes), cookie) + return XinputSelectExtensionEventCookie{cookie} +} + +func (cook XinputSelectExtensionEventCookie) Check() error { + return cook.check() +} + +// Write request to wire for XinputSelectExtensionEvent +func (c *Conn) xinputSelectExtensionEventRequest(Window Id, NumClasses uint16, Classes []XinputEventClass) []byte { + size := pad((12 + pad((int(NumClasses) * 4)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XINPUTEXTENSION"] + b += 1 + + buf[b] = 6 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Window)) + b += 4 + + Put16(buf[b:], NumClasses) + b += 2 + + b += 2 // padding + + for i := 0; i < int(NumClasses); i++ { + Put32(buf[b:], uint32(Classes[i])) + b += 4 + } + b = pad(b) + + return buf +} + +// Request XinputGetSelectedExtensionEvents +// size: 8 +type XinputGetSelectedExtensionEventsCookie struct { + *cookie +} + +func (c *Conn) XinputGetSelectedExtensionEvents(Window Id) XinputGetSelectedExtensionEventsCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xinputGetSelectedExtensionEventsRequest(Window), cookie) + return XinputGetSelectedExtensionEventsCookie{cookie} +} + +func (c *Conn) XinputGetSelectedExtensionEventsUnchecked(Window Id) XinputGetSelectedExtensionEventsCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xinputGetSelectedExtensionEventsRequest(Window), cookie) + return XinputGetSelectedExtensionEventsCookie{cookie} +} + +// Request reply for XinputGetSelectedExtensionEvents +// size: ((32 + pad((int(NumThisClasses) * 4))) + pad((int(NumAllClasses) * 4))) +type XinputGetSelectedExtensionEventsReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + NumThisClasses uint16 + NumAllClasses uint16 + // padding: 20 bytes + ThisClasses []XinputEventClass // size: pad((int(NumThisClasses) * 4)) + AllClasses []XinputEventClass // size: pad((int(NumAllClasses) * 4)) +} + +// Waits and reads reply data from request XinputGetSelectedExtensionEvents +func (cook XinputGetSelectedExtensionEventsCookie) Reply() (*XinputGetSelectedExtensionEventsReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xinputGetSelectedExtensionEventsReply(buf), nil +} + +// Read reply into structure from buffer for XinputGetSelectedExtensionEvents +func xinputGetSelectedExtensionEventsReply(buf []byte) *XinputGetSelectedExtensionEventsReply { + v := new(XinputGetSelectedExtensionEventsReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.NumThisClasses = Get16(buf[b:]) + b += 2 + + v.NumAllClasses = Get16(buf[b:]) + b += 2 + + b += 20 // padding + + v.ThisClasses = make([]XinputEventClass, v.NumThisClasses) + for i := 0; i < int(v.NumThisClasses); i++ { + v.ThisClasses[i] = XinputEventClass(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + v.AllClasses = make([]XinputEventClass, v.NumAllClasses) + for i := 0; i < int(v.NumAllClasses); i++ { + v.AllClasses[i] = XinputEventClass(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + return v +} + +func (cook XinputGetSelectedExtensionEventsCookie) Check() error { + return cook.check() +} + +// Write request to wire for XinputGetSelectedExtensionEvents +func (c *Conn) xinputGetSelectedExtensionEventsRequest(Window Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XINPUTEXTENSION"] + b += 1 + + buf[b] = 7 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Window)) + b += 4 + + return buf +} + +// Request XinputChangeDeviceDontPropagateList +// size: pad((12 + pad((int(NumClasses) * 4)))) +type XinputChangeDeviceDontPropagateListCookie struct { + *cookie +} + +// Write request to wire for XinputChangeDeviceDontPropagateList +func (c *Conn) XinputChangeDeviceDontPropagateList(Window Id, NumClasses uint16, Mode byte, Classes []XinputEventClass) XinputChangeDeviceDontPropagateListCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xinputChangeDeviceDontPropagateListRequest(Window, NumClasses, Mode, Classes), cookie) + return XinputChangeDeviceDontPropagateListCookie{cookie} +} + +func (c *Conn) XinputChangeDeviceDontPropagateListChecked(Window Id, NumClasses uint16, Mode byte, Classes []XinputEventClass) XinputChangeDeviceDontPropagateListCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xinputChangeDeviceDontPropagateListRequest(Window, NumClasses, Mode, Classes), cookie) + return XinputChangeDeviceDontPropagateListCookie{cookie} +} + +func (cook XinputChangeDeviceDontPropagateListCookie) Check() error { + return cook.check() +} + +// Write request to wire for XinputChangeDeviceDontPropagateList +func (c *Conn) xinputChangeDeviceDontPropagateListRequest(Window Id, NumClasses uint16, Mode byte, Classes []XinputEventClass) []byte { + size := pad((12 + pad((int(NumClasses) * 4)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XINPUTEXTENSION"] + b += 1 + + buf[b] = 8 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Window)) + b += 4 + + Put16(buf[b:], NumClasses) + b += 2 + + buf[b] = Mode + b += 1 + + b += 1 // padding + + for i := 0; i < int(NumClasses); i++ { + Put32(buf[b:], uint32(Classes[i])) + b += 4 + } + b = pad(b) + + return buf +} + +// Request XinputGetDeviceDontPropagateList +// size: 8 +type XinputGetDeviceDontPropagateListCookie struct { + *cookie +} + +func (c *Conn) XinputGetDeviceDontPropagateList(Window Id) XinputGetDeviceDontPropagateListCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xinputGetDeviceDontPropagateListRequest(Window), cookie) + return XinputGetDeviceDontPropagateListCookie{cookie} +} + +func (c *Conn) XinputGetDeviceDontPropagateListUnchecked(Window Id) XinputGetDeviceDontPropagateListCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xinputGetDeviceDontPropagateListRequest(Window), cookie) + return XinputGetDeviceDontPropagateListCookie{cookie} +} + +// Request reply for XinputGetDeviceDontPropagateList +// size: (32 + pad((int(NumClasses) * 4))) +type XinputGetDeviceDontPropagateListReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + NumClasses uint16 + // padding: 22 bytes + Classes []XinputEventClass // size: pad((int(NumClasses) * 4)) +} + +// Waits and reads reply data from request XinputGetDeviceDontPropagateList +func (cook XinputGetDeviceDontPropagateListCookie) Reply() (*XinputGetDeviceDontPropagateListReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xinputGetDeviceDontPropagateListReply(buf), nil +} + +// Read reply into structure from buffer for XinputGetDeviceDontPropagateList +func xinputGetDeviceDontPropagateListReply(buf []byte) *XinputGetDeviceDontPropagateListReply { + v := new(XinputGetDeviceDontPropagateListReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.NumClasses = Get16(buf[b:]) + b += 2 + + b += 22 // padding + + v.Classes = make([]XinputEventClass, v.NumClasses) + for i := 0; i < int(v.NumClasses); i++ { + v.Classes[i] = XinputEventClass(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + return v +} + +func (cook XinputGetDeviceDontPropagateListCookie) Check() error { + return cook.check() +} + +// Write request to wire for XinputGetDeviceDontPropagateList +func (c *Conn) xinputGetDeviceDontPropagateListRequest(Window Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XINPUTEXTENSION"] + b += 1 + + buf[b] = 9 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Window)) + b += 4 + + return buf +} + +// Request XinputGetDeviceMotionEvents +// size: 16 +type XinputGetDeviceMotionEventsCookie struct { + *cookie +} + +func (c *Conn) XinputGetDeviceMotionEvents(Start Timestamp, Stop Timestamp, DeviceId byte) XinputGetDeviceMotionEventsCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xinputGetDeviceMotionEventsRequest(Start, Stop, DeviceId), cookie) + return XinputGetDeviceMotionEventsCookie{cookie} +} + +func (c *Conn) XinputGetDeviceMotionEventsUnchecked(Start Timestamp, Stop Timestamp, DeviceId byte) XinputGetDeviceMotionEventsCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xinputGetDeviceMotionEventsRequest(Start, Stop, DeviceId), cookie) + return XinputGetDeviceMotionEventsCookie{cookie} +} + +// Request reply for XinputGetDeviceMotionEvents +// size: 32 +type XinputGetDeviceMotionEventsReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + NumCoords uint32 + NumAxes byte + DeviceMode byte + // padding: 18 bytes +} + +// Waits and reads reply data from request XinputGetDeviceMotionEvents +func (cook XinputGetDeviceMotionEventsCookie) Reply() (*XinputGetDeviceMotionEventsReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xinputGetDeviceMotionEventsReply(buf), nil +} + +// Read reply into structure from buffer for XinputGetDeviceMotionEvents +func xinputGetDeviceMotionEventsReply(buf []byte) *XinputGetDeviceMotionEventsReply { + v := new(XinputGetDeviceMotionEventsReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.NumCoords = Get32(buf[b:]) + b += 4 + + v.NumAxes = buf[b] + b += 1 + + v.DeviceMode = buf[b] + b += 1 + + b += 18 // padding + + return v +} + +func (cook XinputGetDeviceMotionEventsCookie) Check() error { + return cook.check() +} + +// Write request to wire for XinputGetDeviceMotionEvents +func (c *Conn) xinputGetDeviceMotionEventsRequest(Start Timestamp, Stop Timestamp, DeviceId byte) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XINPUTEXTENSION"] + b += 1 + + buf[b] = 10 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Start)) + b += 4 + + Put32(buf[b:], uint32(Stop)) + b += 4 + + buf[b] = DeviceId + b += 1 + + return buf +} + +// Request XinputChangeKeyboardDevice +// size: 8 +type XinputChangeKeyboardDeviceCookie struct { + *cookie +} + +func (c *Conn) XinputChangeKeyboardDevice(DeviceId byte) XinputChangeKeyboardDeviceCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xinputChangeKeyboardDeviceRequest(DeviceId), cookie) + return XinputChangeKeyboardDeviceCookie{cookie} +} + +func (c *Conn) XinputChangeKeyboardDeviceUnchecked(DeviceId byte) XinputChangeKeyboardDeviceCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xinputChangeKeyboardDeviceRequest(DeviceId), cookie) + return XinputChangeKeyboardDeviceCookie{cookie} +} + +// Request reply for XinputChangeKeyboardDevice +// size: 32 +type XinputChangeKeyboardDeviceReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Status byte + // padding: 23 bytes +} + +// Waits and reads reply data from request XinputChangeKeyboardDevice +func (cook XinputChangeKeyboardDeviceCookie) Reply() (*XinputChangeKeyboardDeviceReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xinputChangeKeyboardDeviceReply(buf), nil +} + +// Read reply into structure from buffer for XinputChangeKeyboardDevice +func xinputChangeKeyboardDeviceReply(buf []byte) *XinputChangeKeyboardDeviceReply { + v := new(XinputChangeKeyboardDeviceReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.Status = buf[b] + b += 1 + + b += 23 // padding + + return v +} + +func (cook XinputChangeKeyboardDeviceCookie) Check() error { + return cook.check() +} + +// Write request to wire for XinputChangeKeyboardDevice +func (c *Conn) xinputChangeKeyboardDeviceRequest(DeviceId byte) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XINPUTEXTENSION"] + b += 1 + + buf[b] = 11 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = DeviceId + b += 1 + + b += 3 // padding + + return buf +} + +// Request XinputChangePointerDevice +// size: 8 +type XinputChangePointerDeviceCookie struct { + *cookie +} + +func (c *Conn) XinputChangePointerDevice(XAxis byte, YAxis byte, DeviceId byte) XinputChangePointerDeviceCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xinputChangePointerDeviceRequest(XAxis, YAxis, DeviceId), cookie) + return XinputChangePointerDeviceCookie{cookie} +} + +func (c *Conn) XinputChangePointerDeviceUnchecked(XAxis byte, YAxis byte, DeviceId byte) XinputChangePointerDeviceCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xinputChangePointerDeviceRequest(XAxis, YAxis, DeviceId), cookie) + return XinputChangePointerDeviceCookie{cookie} +} + +// Request reply for XinputChangePointerDevice +// size: 32 +type XinputChangePointerDeviceReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Status byte + // padding: 23 bytes +} + +// Waits and reads reply data from request XinputChangePointerDevice +func (cook XinputChangePointerDeviceCookie) Reply() (*XinputChangePointerDeviceReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xinputChangePointerDeviceReply(buf), nil +} + +// Read reply into structure from buffer for XinputChangePointerDevice +func xinputChangePointerDeviceReply(buf []byte) *XinputChangePointerDeviceReply { + v := new(XinputChangePointerDeviceReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.Status = buf[b] + b += 1 + + b += 23 // padding + + return v +} + +func (cook XinputChangePointerDeviceCookie) Check() error { + return cook.check() +} + +// Write request to wire for XinputChangePointerDevice +func (c *Conn) xinputChangePointerDeviceRequest(XAxis byte, YAxis byte, DeviceId byte) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XINPUTEXTENSION"] + b += 1 + + buf[b] = 12 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = XAxis + b += 1 + + buf[b] = YAxis + b += 1 + + buf[b] = DeviceId + b += 1 + + b += 1 // padding + + return buf +} + +// Request XinputGrabDevice +// size: pad((20 + pad((int(NumClasses) * 4)))) +type XinputGrabDeviceCookie struct { + *cookie +} + +func (c *Conn) XinputGrabDevice(GrabWindow Id, Time Timestamp, NumClasses uint16, ThisDeviceMode byte, OtherDeviceMode byte, OwnerEvents bool, DeviceId byte, Classes []XinputEventClass) XinputGrabDeviceCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xinputGrabDeviceRequest(GrabWindow, Time, NumClasses, ThisDeviceMode, OtherDeviceMode, OwnerEvents, DeviceId, Classes), cookie) + return XinputGrabDeviceCookie{cookie} +} + +func (c *Conn) XinputGrabDeviceUnchecked(GrabWindow Id, Time Timestamp, NumClasses uint16, ThisDeviceMode byte, OtherDeviceMode byte, OwnerEvents bool, DeviceId byte, Classes []XinputEventClass) XinputGrabDeviceCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xinputGrabDeviceRequest(GrabWindow, Time, NumClasses, ThisDeviceMode, OtherDeviceMode, OwnerEvents, DeviceId, Classes), cookie) + return XinputGrabDeviceCookie{cookie} +} + +// Request reply for XinputGrabDevice +// size: 32 +type XinputGrabDeviceReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Status byte + // padding: 23 bytes +} + +// Waits and reads reply data from request XinputGrabDevice +func (cook XinputGrabDeviceCookie) Reply() (*XinputGrabDeviceReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xinputGrabDeviceReply(buf), nil +} + +// Read reply into structure from buffer for XinputGrabDevice +func xinputGrabDeviceReply(buf []byte) *XinputGrabDeviceReply { + v := new(XinputGrabDeviceReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.Status = buf[b] + b += 1 + + b += 23 // padding + + return v +} + +func (cook XinputGrabDeviceCookie) Check() error { + return cook.check() +} + +// Write request to wire for XinputGrabDevice +func (c *Conn) xinputGrabDeviceRequest(GrabWindow Id, Time Timestamp, NumClasses uint16, ThisDeviceMode byte, OtherDeviceMode byte, OwnerEvents bool, DeviceId byte, Classes []XinputEventClass) []byte { + size := pad((20 + pad((int(NumClasses) * 4)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XINPUTEXTENSION"] + b += 1 + + buf[b] = 13 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(GrabWindow)) + b += 4 + + Put32(buf[b:], uint32(Time)) + b += 4 + + Put16(buf[b:], NumClasses) + b += 2 + + buf[b] = ThisDeviceMode + b += 1 + + buf[b] = OtherDeviceMode + b += 1 + + if OwnerEvents { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + buf[b] = DeviceId + b += 1 + + b += 2 // padding + + for i := 0; i < int(NumClasses); i++ { + Put32(buf[b:], uint32(Classes[i])) + b += 4 + } + b = pad(b) + + return buf +} + +// Request XinputUngrabDevice +// size: 12 +type XinputUngrabDeviceCookie struct { + *cookie +} + +// Write request to wire for XinputUngrabDevice +func (c *Conn) XinputUngrabDevice(Time Timestamp, DeviceId byte) XinputUngrabDeviceCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xinputUngrabDeviceRequest(Time, DeviceId), cookie) + return XinputUngrabDeviceCookie{cookie} +} + +func (c *Conn) XinputUngrabDeviceChecked(Time Timestamp, DeviceId byte) XinputUngrabDeviceCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xinputUngrabDeviceRequest(Time, DeviceId), cookie) + return XinputUngrabDeviceCookie{cookie} +} + +func (cook XinputUngrabDeviceCookie) Check() error { + return cook.check() +} + +// Write request to wire for XinputUngrabDevice +func (c *Conn) xinputUngrabDeviceRequest(Time Timestamp, DeviceId byte) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XINPUTEXTENSION"] + b += 1 + + buf[b] = 14 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Time)) + b += 4 + + buf[b] = DeviceId + b += 1 + + return buf +} + +// Request XinputGrabDeviceKey +// size: pad((20 + pad((int(NumClasses) * 4)))) +type XinputGrabDeviceKeyCookie struct { + *cookie +} + +// Write request to wire for XinputGrabDeviceKey +func (c *Conn) XinputGrabDeviceKey(GrabWindow Id, NumClasses uint16, Modifiers uint16, ModifierDevice byte, GrabbedDevice byte, Key byte, ThisDeviceMode byte, OtherDeviceMode byte, OwnerEvents bool, Classes []XinputEventClass) XinputGrabDeviceKeyCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xinputGrabDeviceKeyRequest(GrabWindow, NumClasses, Modifiers, ModifierDevice, GrabbedDevice, Key, ThisDeviceMode, OtherDeviceMode, OwnerEvents, Classes), cookie) + return XinputGrabDeviceKeyCookie{cookie} +} + +func (c *Conn) XinputGrabDeviceKeyChecked(GrabWindow Id, NumClasses uint16, Modifiers uint16, ModifierDevice byte, GrabbedDevice byte, Key byte, ThisDeviceMode byte, OtherDeviceMode byte, OwnerEvents bool, Classes []XinputEventClass) XinputGrabDeviceKeyCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xinputGrabDeviceKeyRequest(GrabWindow, NumClasses, Modifiers, ModifierDevice, GrabbedDevice, Key, ThisDeviceMode, OtherDeviceMode, OwnerEvents, Classes), cookie) + return XinputGrabDeviceKeyCookie{cookie} +} + +func (cook XinputGrabDeviceKeyCookie) Check() error { + return cook.check() +} + +// Write request to wire for XinputGrabDeviceKey +func (c *Conn) xinputGrabDeviceKeyRequest(GrabWindow Id, NumClasses uint16, Modifiers uint16, ModifierDevice byte, GrabbedDevice byte, Key byte, ThisDeviceMode byte, OtherDeviceMode byte, OwnerEvents bool, Classes []XinputEventClass) []byte { + size := pad((20 + pad((int(NumClasses) * 4)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XINPUTEXTENSION"] + b += 1 + + buf[b] = 15 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(GrabWindow)) + b += 4 + + Put16(buf[b:], NumClasses) + b += 2 + + Put16(buf[b:], Modifiers) + b += 2 + + buf[b] = ModifierDevice + b += 1 + + buf[b] = GrabbedDevice + b += 1 + + buf[b] = Key + b += 1 + + buf[b] = ThisDeviceMode + b += 1 + + buf[b] = OtherDeviceMode + b += 1 + + if OwnerEvents { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + b += 2 // padding + + for i := 0; i < int(NumClasses); i++ { + Put32(buf[b:], uint32(Classes[i])) + b += 4 + } + b = pad(b) + + return buf +} + +// Request XinputUngrabDeviceKey +// size: 16 +type XinputUngrabDeviceKeyCookie struct { + *cookie +} + +// Write request to wire for XinputUngrabDeviceKey +func (c *Conn) XinputUngrabDeviceKey(GrabWindow Id, Modifiers uint16, ModifierDevice byte, Key byte, GrabbedDevice byte) XinputUngrabDeviceKeyCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xinputUngrabDeviceKeyRequest(GrabWindow, Modifiers, ModifierDevice, Key, GrabbedDevice), cookie) + return XinputUngrabDeviceKeyCookie{cookie} +} + +func (c *Conn) XinputUngrabDeviceKeyChecked(GrabWindow Id, Modifiers uint16, ModifierDevice byte, Key byte, GrabbedDevice byte) XinputUngrabDeviceKeyCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xinputUngrabDeviceKeyRequest(GrabWindow, Modifiers, ModifierDevice, Key, GrabbedDevice), cookie) + return XinputUngrabDeviceKeyCookie{cookie} +} + +func (cook XinputUngrabDeviceKeyCookie) Check() error { + return cook.check() +} + +// Write request to wire for XinputUngrabDeviceKey +func (c *Conn) xinputUngrabDeviceKeyRequest(GrabWindow Id, Modifiers uint16, ModifierDevice byte, Key byte, GrabbedDevice byte) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XINPUTEXTENSION"] + b += 1 + + buf[b] = 16 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(GrabWindow)) + b += 4 + + Put16(buf[b:], Modifiers) + b += 2 + + buf[b] = ModifierDevice + b += 1 + + buf[b] = Key + b += 1 + + buf[b] = GrabbedDevice + b += 1 + + return buf +} + +// Request XinputGrabDeviceButton +// size: pad((20 + pad((int(NumClasses) * 4)))) +type XinputGrabDeviceButtonCookie struct { + *cookie +} + +// Write request to wire for XinputGrabDeviceButton +func (c *Conn) XinputGrabDeviceButton(GrabWindow Id, GrabbedDevice byte, ModifierDevice byte, NumClasses uint16, Modifiers uint16, ThisDeviceMode byte, OtherDeviceMode byte, Button byte, OwnerEvents byte, Classes []XinputEventClass) XinputGrabDeviceButtonCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xinputGrabDeviceButtonRequest(GrabWindow, GrabbedDevice, ModifierDevice, NumClasses, Modifiers, ThisDeviceMode, OtherDeviceMode, Button, OwnerEvents, Classes), cookie) + return XinputGrabDeviceButtonCookie{cookie} +} + +func (c *Conn) XinputGrabDeviceButtonChecked(GrabWindow Id, GrabbedDevice byte, ModifierDevice byte, NumClasses uint16, Modifiers uint16, ThisDeviceMode byte, OtherDeviceMode byte, Button byte, OwnerEvents byte, Classes []XinputEventClass) XinputGrabDeviceButtonCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xinputGrabDeviceButtonRequest(GrabWindow, GrabbedDevice, ModifierDevice, NumClasses, Modifiers, ThisDeviceMode, OtherDeviceMode, Button, OwnerEvents, Classes), cookie) + return XinputGrabDeviceButtonCookie{cookie} +} + +func (cook XinputGrabDeviceButtonCookie) Check() error { + return cook.check() +} + +// Write request to wire for XinputGrabDeviceButton +func (c *Conn) xinputGrabDeviceButtonRequest(GrabWindow Id, GrabbedDevice byte, ModifierDevice byte, NumClasses uint16, Modifiers uint16, ThisDeviceMode byte, OtherDeviceMode byte, Button byte, OwnerEvents byte, Classes []XinputEventClass) []byte { + size := pad((20 + pad((int(NumClasses) * 4)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XINPUTEXTENSION"] + b += 1 + + buf[b] = 17 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(GrabWindow)) + b += 4 + + buf[b] = GrabbedDevice + b += 1 + + buf[b] = ModifierDevice + b += 1 + + Put16(buf[b:], NumClasses) + b += 2 + + Put16(buf[b:], Modifiers) + b += 2 + + buf[b] = ThisDeviceMode + b += 1 + + buf[b] = OtherDeviceMode + b += 1 + + buf[b] = Button + b += 1 + + buf[b] = OwnerEvents + b += 1 + + b += 2 // padding + + for i := 0; i < int(NumClasses); i++ { + Put32(buf[b:], uint32(Classes[i])) + b += 4 + } + b = pad(b) + + return buf +} + +// Request XinputUngrabDeviceButton +// size: 16 +type XinputUngrabDeviceButtonCookie struct { + *cookie +} + +// Write request to wire for XinputUngrabDeviceButton +func (c *Conn) XinputUngrabDeviceButton(GrabWindow Id, Modifiers uint16, ModifierDevice byte, Button byte, GrabbedDevice byte) XinputUngrabDeviceButtonCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xinputUngrabDeviceButtonRequest(GrabWindow, Modifiers, ModifierDevice, Button, GrabbedDevice), cookie) + return XinputUngrabDeviceButtonCookie{cookie} +} + +func (c *Conn) XinputUngrabDeviceButtonChecked(GrabWindow Id, Modifiers uint16, ModifierDevice byte, Button byte, GrabbedDevice byte) XinputUngrabDeviceButtonCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xinputUngrabDeviceButtonRequest(GrabWindow, Modifiers, ModifierDevice, Button, GrabbedDevice), cookie) + return XinputUngrabDeviceButtonCookie{cookie} +} + +func (cook XinputUngrabDeviceButtonCookie) Check() error { + return cook.check() +} + +// Write request to wire for XinputUngrabDeviceButton +func (c *Conn) xinputUngrabDeviceButtonRequest(GrabWindow Id, Modifiers uint16, ModifierDevice byte, Button byte, GrabbedDevice byte) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XINPUTEXTENSION"] + b += 1 + + buf[b] = 18 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(GrabWindow)) + b += 4 + + Put16(buf[b:], Modifiers) + b += 2 + + buf[b] = ModifierDevice + b += 1 + + buf[b] = Button + b += 1 + + buf[b] = GrabbedDevice + b += 1 + + return buf +} + +// Request XinputAllowDeviceEvents +// size: 12 +type XinputAllowDeviceEventsCookie struct { + *cookie +} + +// Write request to wire for XinputAllowDeviceEvents +func (c *Conn) XinputAllowDeviceEvents(Time Timestamp, Mode byte, DeviceId byte) XinputAllowDeviceEventsCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xinputAllowDeviceEventsRequest(Time, Mode, DeviceId), cookie) + return XinputAllowDeviceEventsCookie{cookie} +} + +func (c *Conn) XinputAllowDeviceEventsChecked(Time Timestamp, Mode byte, DeviceId byte) XinputAllowDeviceEventsCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xinputAllowDeviceEventsRequest(Time, Mode, DeviceId), cookie) + return XinputAllowDeviceEventsCookie{cookie} +} + +func (cook XinputAllowDeviceEventsCookie) Check() error { + return cook.check() +} + +// Write request to wire for XinputAllowDeviceEvents +func (c *Conn) xinputAllowDeviceEventsRequest(Time Timestamp, Mode byte, DeviceId byte) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XINPUTEXTENSION"] + b += 1 + + buf[b] = 19 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Time)) + b += 4 + + buf[b] = Mode + b += 1 + + buf[b] = DeviceId + b += 1 + + return buf +} + +// Request XinputGetDeviceFocus +// size: 8 +type XinputGetDeviceFocusCookie struct { + *cookie +} + +func (c *Conn) XinputGetDeviceFocus(DeviceId byte) XinputGetDeviceFocusCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xinputGetDeviceFocusRequest(DeviceId), cookie) + return XinputGetDeviceFocusCookie{cookie} +} + +func (c *Conn) XinputGetDeviceFocusUnchecked(DeviceId byte) XinputGetDeviceFocusCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xinputGetDeviceFocusRequest(DeviceId), cookie) + return XinputGetDeviceFocusCookie{cookie} +} + +// Request reply for XinputGetDeviceFocus +// size: 32 +type XinputGetDeviceFocusReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Focus Id + Time Timestamp + RevertTo byte + // padding: 15 bytes +} + +// Waits and reads reply data from request XinputGetDeviceFocus +func (cook XinputGetDeviceFocusCookie) Reply() (*XinputGetDeviceFocusReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xinputGetDeviceFocusReply(buf), nil +} + +// Read reply into structure from buffer for XinputGetDeviceFocus +func xinputGetDeviceFocusReply(buf []byte) *XinputGetDeviceFocusReply { + v := new(XinputGetDeviceFocusReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.Focus = Id(Get32(buf[b:])) + b += 4 + + v.Time = Timestamp(Get32(buf[b:])) + b += 4 + + v.RevertTo = buf[b] + b += 1 + + b += 15 // padding + + return v +} + +func (cook XinputGetDeviceFocusCookie) Check() error { + return cook.check() +} + +// Write request to wire for XinputGetDeviceFocus +func (c *Conn) xinputGetDeviceFocusRequest(DeviceId byte) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XINPUTEXTENSION"] + b += 1 + + buf[b] = 20 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = DeviceId + b += 1 + + b += 3 // padding + + return buf +} + +// Request XinputSetDeviceFocus +// size: 16 +type XinputSetDeviceFocusCookie struct { + *cookie +} + +// Write request to wire for XinputSetDeviceFocus +func (c *Conn) XinputSetDeviceFocus(Focus Id, Time Timestamp, RevertTo byte, DeviceId byte) XinputSetDeviceFocusCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xinputSetDeviceFocusRequest(Focus, Time, RevertTo, DeviceId), cookie) + return XinputSetDeviceFocusCookie{cookie} +} + +func (c *Conn) XinputSetDeviceFocusChecked(Focus Id, Time Timestamp, RevertTo byte, DeviceId byte) XinputSetDeviceFocusCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xinputSetDeviceFocusRequest(Focus, Time, RevertTo, DeviceId), cookie) + return XinputSetDeviceFocusCookie{cookie} +} + +func (cook XinputSetDeviceFocusCookie) Check() error { + return cook.check() +} + +// Write request to wire for XinputSetDeviceFocus +func (c *Conn) xinputSetDeviceFocusRequest(Focus Id, Time Timestamp, RevertTo byte, DeviceId byte) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XINPUTEXTENSION"] + b += 1 + + buf[b] = 21 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Focus)) + b += 4 + + Put32(buf[b:], uint32(Time)) + b += 4 + + buf[b] = RevertTo + b += 1 + + buf[b] = DeviceId + b += 1 + + return buf +} + +// Request XinputGetFeedbackControl +// size: 8 +type XinputGetFeedbackControlCookie struct { + *cookie +} + +func (c *Conn) XinputGetFeedbackControl(DeviceId byte) XinputGetFeedbackControlCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xinputGetFeedbackControlRequest(DeviceId), cookie) + return XinputGetFeedbackControlCookie{cookie} +} + +func (c *Conn) XinputGetFeedbackControlUnchecked(DeviceId byte) XinputGetFeedbackControlCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xinputGetFeedbackControlRequest(DeviceId), cookie) + return XinputGetFeedbackControlCookie{cookie} +} + +// Request reply for XinputGetFeedbackControl +// size: 32 +type XinputGetFeedbackControlReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + NumFeedback uint16 + // padding: 22 bytes +} + +// Waits and reads reply data from request XinputGetFeedbackControl +func (cook XinputGetFeedbackControlCookie) Reply() (*XinputGetFeedbackControlReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xinputGetFeedbackControlReply(buf), nil +} + +// Read reply into structure from buffer for XinputGetFeedbackControl +func xinputGetFeedbackControlReply(buf []byte) *XinputGetFeedbackControlReply { + v := new(XinputGetFeedbackControlReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.NumFeedback = Get16(buf[b:]) + b += 2 + + b += 22 // padding + + return v +} + +func (cook XinputGetFeedbackControlCookie) Check() error { + return cook.check() +} + +// Write request to wire for XinputGetFeedbackControl +func (c *Conn) xinputGetFeedbackControlRequest(DeviceId byte) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XINPUTEXTENSION"] + b += 1 + + buf[b] = 22 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = DeviceId + b += 1 + + b += 3 // padding + + return buf +} + +// Request XinputGetDeviceKeyMapping +// size: 8 +type XinputGetDeviceKeyMappingCookie struct { + *cookie +} + +func (c *Conn) XinputGetDeviceKeyMapping(DeviceId byte, FirstKeycode XinputKeyCode, Count byte) XinputGetDeviceKeyMappingCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xinputGetDeviceKeyMappingRequest(DeviceId, FirstKeycode, Count), cookie) + return XinputGetDeviceKeyMappingCookie{cookie} +} + +func (c *Conn) XinputGetDeviceKeyMappingUnchecked(DeviceId byte, FirstKeycode XinputKeyCode, Count byte) XinputGetDeviceKeyMappingCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xinputGetDeviceKeyMappingRequest(DeviceId, FirstKeycode, Count), cookie) + return XinputGetDeviceKeyMappingCookie{cookie} +} + +// Request reply for XinputGetDeviceKeyMapping +// size: (32 + pad((int(Length) * 4))) +type XinputGetDeviceKeyMappingReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + KeysymsPerKeycode byte + // padding: 23 bytes + Keysyms []Keysym // size: pad((int(Length) * 4)) +} + +// Waits and reads reply data from request XinputGetDeviceKeyMapping +func (cook XinputGetDeviceKeyMappingCookie) Reply() (*XinputGetDeviceKeyMappingReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xinputGetDeviceKeyMappingReply(buf), nil +} + +// Read reply into structure from buffer for XinputGetDeviceKeyMapping +func xinputGetDeviceKeyMappingReply(buf []byte) *XinputGetDeviceKeyMappingReply { + v := new(XinputGetDeviceKeyMappingReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.KeysymsPerKeycode = buf[b] + b += 1 + + b += 23 // padding + + v.Keysyms = make([]Keysym, v.Length) + for i := 0; i < int(v.Length); i++ { + v.Keysyms[i] = Keysym(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + return v +} + +func (cook XinputGetDeviceKeyMappingCookie) Check() error { + return cook.check() +} + +// Write request to wire for XinputGetDeviceKeyMapping +func (c *Conn) xinputGetDeviceKeyMappingRequest(DeviceId byte, FirstKeycode XinputKeyCode, Count byte) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XINPUTEXTENSION"] + b += 1 + + buf[b] = 24 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = DeviceId + b += 1 + + buf[b] = byte(FirstKeycode) + b += 1 + + buf[b] = Count + b += 1 + + return buf +} + +// Request XinputChangeDeviceKeyMapping +// size: pad((8 + pad(((int(KeycodeCount) * int(KeysymsPerKeycode)) * 4)))) +type XinputChangeDeviceKeyMappingCookie struct { + *cookie +} + +// Write request to wire for XinputChangeDeviceKeyMapping +func (c *Conn) XinputChangeDeviceKeyMapping(DeviceId byte, FirstKeycode XinputKeyCode, KeysymsPerKeycode byte, KeycodeCount byte, Keysyms []Keysym) XinputChangeDeviceKeyMappingCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xinputChangeDeviceKeyMappingRequest(DeviceId, FirstKeycode, KeysymsPerKeycode, KeycodeCount, Keysyms), cookie) + return XinputChangeDeviceKeyMappingCookie{cookie} +} + +func (c *Conn) XinputChangeDeviceKeyMappingChecked(DeviceId byte, FirstKeycode XinputKeyCode, KeysymsPerKeycode byte, KeycodeCount byte, Keysyms []Keysym) XinputChangeDeviceKeyMappingCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xinputChangeDeviceKeyMappingRequest(DeviceId, FirstKeycode, KeysymsPerKeycode, KeycodeCount, Keysyms), cookie) + return XinputChangeDeviceKeyMappingCookie{cookie} +} + +func (cook XinputChangeDeviceKeyMappingCookie) Check() error { + return cook.check() +} + +// Write request to wire for XinputChangeDeviceKeyMapping +func (c *Conn) xinputChangeDeviceKeyMappingRequest(DeviceId byte, FirstKeycode XinputKeyCode, KeysymsPerKeycode byte, KeycodeCount byte, Keysyms []Keysym) []byte { + size := pad((8 + pad(((int(KeycodeCount) * int(KeysymsPerKeycode)) * 4)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XINPUTEXTENSION"] + b += 1 + + buf[b] = 25 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = DeviceId + b += 1 + + buf[b] = byte(FirstKeycode) + b += 1 + + buf[b] = KeysymsPerKeycode + b += 1 + + buf[b] = KeycodeCount + b += 1 + + for i := 0; i < int((int(KeycodeCount) * int(KeysymsPerKeycode))); i++ { + Put32(buf[b:], uint32(Keysyms[i])) + b += 4 + } + b = pad(b) + + return buf +} + +// Request XinputGetDeviceModifierMapping +// size: 8 +type XinputGetDeviceModifierMappingCookie struct { + *cookie +} + +func (c *Conn) XinputGetDeviceModifierMapping(DeviceId byte) XinputGetDeviceModifierMappingCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xinputGetDeviceModifierMappingRequest(DeviceId), cookie) + return XinputGetDeviceModifierMappingCookie{cookie} +} + +func (c *Conn) XinputGetDeviceModifierMappingUnchecked(DeviceId byte) XinputGetDeviceModifierMappingCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xinputGetDeviceModifierMappingRequest(DeviceId), cookie) + return XinputGetDeviceModifierMappingCookie{cookie} +} + +// Request reply for XinputGetDeviceModifierMapping +// size: (32 + pad(((int(KeycodesPerModifier) * 8) * 1))) +type XinputGetDeviceModifierMappingReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + KeycodesPerModifier byte + // padding: 23 bytes + Keymaps []byte // size: pad(((int(KeycodesPerModifier) * 8) * 1)) +} + +// Waits and reads reply data from request XinputGetDeviceModifierMapping +func (cook XinputGetDeviceModifierMappingCookie) Reply() (*XinputGetDeviceModifierMappingReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xinputGetDeviceModifierMappingReply(buf), nil +} + +// Read reply into structure from buffer for XinputGetDeviceModifierMapping +func xinputGetDeviceModifierMappingReply(buf []byte) *XinputGetDeviceModifierMappingReply { + v := new(XinputGetDeviceModifierMappingReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.KeycodesPerModifier = buf[b] + b += 1 + + b += 23 // padding + + v.Keymaps = make([]byte, (int(v.KeycodesPerModifier) * 8)) + copy(v.Keymaps[:(int(v.KeycodesPerModifier)*8)], buf[b:]) + b += pad(int((int(v.KeycodesPerModifier) * 8))) + + return v +} + +func (cook XinputGetDeviceModifierMappingCookie) Check() error { + return cook.check() +} + +// Write request to wire for XinputGetDeviceModifierMapping +func (c *Conn) xinputGetDeviceModifierMappingRequest(DeviceId byte) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XINPUTEXTENSION"] + b += 1 + + buf[b] = 26 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = DeviceId + b += 1 + + b += 3 // padding + + return buf +} + +// Request XinputSetDeviceModifierMapping +// size: pad((7 + pad(((int(KeycodesPerModifier) * 8) * 1)))) +type XinputSetDeviceModifierMappingCookie struct { + *cookie +} + +func (c *Conn) XinputSetDeviceModifierMapping(DeviceId byte, KeycodesPerModifier byte, Keymaps []byte) XinputSetDeviceModifierMappingCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xinputSetDeviceModifierMappingRequest(DeviceId, KeycodesPerModifier, Keymaps), cookie) + return XinputSetDeviceModifierMappingCookie{cookie} +} + +func (c *Conn) XinputSetDeviceModifierMappingUnchecked(DeviceId byte, KeycodesPerModifier byte, Keymaps []byte) XinputSetDeviceModifierMappingCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xinputSetDeviceModifierMappingRequest(DeviceId, KeycodesPerModifier, Keymaps), cookie) + return XinputSetDeviceModifierMappingCookie{cookie} +} + +// Request reply for XinputSetDeviceModifierMapping +// size: 32 +type XinputSetDeviceModifierMappingReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Status byte + // padding: 23 bytes +} + +// Waits and reads reply data from request XinputSetDeviceModifierMapping +func (cook XinputSetDeviceModifierMappingCookie) Reply() (*XinputSetDeviceModifierMappingReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xinputSetDeviceModifierMappingReply(buf), nil +} + +// Read reply into structure from buffer for XinputSetDeviceModifierMapping +func xinputSetDeviceModifierMappingReply(buf []byte) *XinputSetDeviceModifierMappingReply { + v := new(XinputSetDeviceModifierMappingReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.Status = buf[b] + b += 1 + + b += 23 // padding + + return v +} + +func (cook XinputSetDeviceModifierMappingCookie) Check() error { + return cook.check() +} + +// Write request to wire for XinputSetDeviceModifierMapping +func (c *Conn) xinputSetDeviceModifierMappingRequest(DeviceId byte, KeycodesPerModifier byte, Keymaps []byte) []byte { + size := pad((7 + pad(((int(KeycodesPerModifier) * 8) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XINPUTEXTENSION"] + b += 1 + + buf[b] = 27 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = DeviceId + b += 1 + + buf[b] = KeycodesPerModifier + b += 1 + + b += 1 // padding + + copy(buf[b:], Keymaps[:(int(KeycodesPerModifier)*8)]) + b += pad(int((int(KeycodesPerModifier) * 8))) + + return buf +} + +// Request XinputGetDeviceButtonMapping +// size: 8 +type XinputGetDeviceButtonMappingCookie struct { + *cookie +} + +func (c *Conn) XinputGetDeviceButtonMapping(DeviceId byte) XinputGetDeviceButtonMappingCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xinputGetDeviceButtonMappingRequest(DeviceId), cookie) + return XinputGetDeviceButtonMappingCookie{cookie} +} + +func (c *Conn) XinputGetDeviceButtonMappingUnchecked(DeviceId byte) XinputGetDeviceButtonMappingCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xinputGetDeviceButtonMappingRequest(DeviceId), cookie) + return XinputGetDeviceButtonMappingCookie{cookie} +} + +// Request reply for XinputGetDeviceButtonMapping +// size: (32 + pad((int(MapSize) * 1))) +type XinputGetDeviceButtonMappingReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + MapSize byte + // padding: 23 bytes + Map []byte // size: pad((int(MapSize) * 1)) +} + +// Waits and reads reply data from request XinputGetDeviceButtonMapping +func (cook XinputGetDeviceButtonMappingCookie) Reply() (*XinputGetDeviceButtonMappingReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xinputGetDeviceButtonMappingReply(buf), nil +} + +// Read reply into structure from buffer for XinputGetDeviceButtonMapping +func xinputGetDeviceButtonMappingReply(buf []byte) *XinputGetDeviceButtonMappingReply { + v := new(XinputGetDeviceButtonMappingReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.MapSize = buf[b] + b += 1 + + b += 23 // padding + + v.Map = make([]byte, v.MapSize) + copy(v.Map[:v.MapSize], buf[b:]) + b += pad(int(v.MapSize)) + + return v +} + +func (cook XinputGetDeviceButtonMappingCookie) Check() error { + return cook.check() +} + +// Write request to wire for XinputGetDeviceButtonMapping +func (c *Conn) xinputGetDeviceButtonMappingRequest(DeviceId byte) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XINPUTEXTENSION"] + b += 1 + + buf[b] = 28 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = DeviceId + b += 1 + + b += 3 // padding + + return buf +} + +// Request XinputSetDeviceButtonMapping +// size: pad((8 + pad((int(MapSize) * 1)))) +type XinputSetDeviceButtonMappingCookie struct { + *cookie +} + +func (c *Conn) XinputSetDeviceButtonMapping(DeviceId byte, MapSize byte, Map []byte) XinputSetDeviceButtonMappingCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xinputSetDeviceButtonMappingRequest(DeviceId, MapSize, Map), cookie) + return XinputSetDeviceButtonMappingCookie{cookie} +} + +func (c *Conn) XinputSetDeviceButtonMappingUnchecked(DeviceId byte, MapSize byte, Map []byte) XinputSetDeviceButtonMappingCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xinputSetDeviceButtonMappingRequest(DeviceId, MapSize, Map), cookie) + return XinputSetDeviceButtonMappingCookie{cookie} +} + +// Request reply for XinputSetDeviceButtonMapping +// size: 32 +type XinputSetDeviceButtonMappingReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Status byte + // padding: 23 bytes +} + +// Waits and reads reply data from request XinputSetDeviceButtonMapping +func (cook XinputSetDeviceButtonMappingCookie) Reply() (*XinputSetDeviceButtonMappingReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xinputSetDeviceButtonMappingReply(buf), nil +} + +// Read reply into structure from buffer for XinputSetDeviceButtonMapping +func xinputSetDeviceButtonMappingReply(buf []byte) *XinputSetDeviceButtonMappingReply { + v := new(XinputSetDeviceButtonMappingReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.Status = buf[b] + b += 1 + + b += 23 // padding + + return v +} + +func (cook XinputSetDeviceButtonMappingCookie) Check() error { + return cook.check() +} + +// Write request to wire for XinputSetDeviceButtonMapping +func (c *Conn) xinputSetDeviceButtonMappingRequest(DeviceId byte, MapSize byte, Map []byte) []byte { + size := pad((8 + pad((int(MapSize) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XINPUTEXTENSION"] + b += 1 + + buf[b] = 29 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = DeviceId + b += 1 + + buf[b] = MapSize + b += 1 + + b += 2 // padding + + copy(buf[b:], Map[:MapSize]) + b += pad(int(MapSize)) + + return buf +} + +// Request XinputQueryDeviceState +// size: 8 +type XinputQueryDeviceStateCookie struct { + *cookie +} + +func (c *Conn) XinputQueryDeviceState(DeviceId byte) XinputQueryDeviceStateCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xinputQueryDeviceStateRequest(DeviceId), cookie) + return XinputQueryDeviceStateCookie{cookie} +} + +func (c *Conn) XinputQueryDeviceStateUnchecked(DeviceId byte) XinputQueryDeviceStateCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xinputQueryDeviceStateRequest(DeviceId), cookie) + return XinputQueryDeviceStateCookie{cookie} +} + +// Request reply for XinputQueryDeviceState +// size: 32 +type XinputQueryDeviceStateReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + NumClasses byte + // padding: 23 bytes +} + +// Waits and reads reply data from request XinputQueryDeviceState +func (cook XinputQueryDeviceStateCookie) Reply() (*XinputQueryDeviceStateReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xinputQueryDeviceStateReply(buf), nil +} + +// Read reply into structure from buffer for XinputQueryDeviceState +func xinputQueryDeviceStateReply(buf []byte) *XinputQueryDeviceStateReply { + v := new(XinputQueryDeviceStateReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.NumClasses = buf[b] + b += 1 + + b += 23 // padding + + return v +} + +func (cook XinputQueryDeviceStateCookie) Check() error { + return cook.check() +} + +// Write request to wire for XinputQueryDeviceState +func (c *Conn) xinputQueryDeviceStateRequest(DeviceId byte) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XINPUTEXTENSION"] + b += 1 + + buf[b] = 30 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = DeviceId + b += 1 + + b += 3 // padding + + return buf +} + +// Request XinputSendExtensionEvent +// size: pad(((16 + pad(((int(NumEvents) * 32) * 1))) + pad((int(NumClasses) * 4)))) +type XinputSendExtensionEventCookie struct { + *cookie +} + +// Write request to wire for XinputSendExtensionEvent +func (c *Conn) XinputSendExtensionEvent(Destination Id, DeviceId byte, Propagate bool, NumClasses uint16, NumEvents byte, Events string, Classes []XinputEventClass) XinputSendExtensionEventCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xinputSendExtensionEventRequest(Destination, DeviceId, Propagate, NumClasses, NumEvents, Events, Classes), cookie) + return XinputSendExtensionEventCookie{cookie} +} + +func (c *Conn) XinputSendExtensionEventChecked(Destination Id, DeviceId byte, Propagate bool, NumClasses uint16, NumEvents byte, Events string, Classes []XinputEventClass) XinputSendExtensionEventCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xinputSendExtensionEventRequest(Destination, DeviceId, Propagate, NumClasses, NumEvents, Events, Classes), cookie) + return XinputSendExtensionEventCookie{cookie} +} + +func (cook XinputSendExtensionEventCookie) Check() error { + return cook.check() +} + +// Write request to wire for XinputSendExtensionEvent +func (c *Conn) xinputSendExtensionEventRequest(Destination Id, DeviceId byte, Propagate bool, NumClasses uint16, NumEvents byte, Events string, Classes []XinputEventClass) []byte { + size := pad(((16 + pad(((int(NumEvents) * 32) * 1))) + pad((int(NumClasses) * 4)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XINPUTEXTENSION"] + b += 1 + + buf[b] = 31 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Destination)) + b += 4 + + buf[b] = DeviceId + b += 1 + + if Propagate { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + Put16(buf[b:], NumClasses) + b += 2 + + buf[b] = NumEvents + b += 1 + + b += 3 // padding + + copy(buf[b:], Events[:(int(NumEvents)*32)]) + b += pad(int((int(NumEvents) * 32))) + + for i := 0; i < int(NumClasses); i++ { + Put32(buf[b:], uint32(Classes[i])) + b += 4 + } + b = pad(b) + + return buf +} + +// Request XinputDeviceBell +// size: 8 +type XinputDeviceBellCookie struct { + *cookie +} + +// Write request to wire for XinputDeviceBell +func (c *Conn) XinputDeviceBell(DeviceId byte, FeedbackId byte, FeedbackClass byte, Percent int8) XinputDeviceBellCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xinputDeviceBellRequest(DeviceId, FeedbackId, FeedbackClass, Percent), cookie) + return XinputDeviceBellCookie{cookie} +} + +func (c *Conn) XinputDeviceBellChecked(DeviceId byte, FeedbackId byte, FeedbackClass byte, Percent int8) XinputDeviceBellCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xinputDeviceBellRequest(DeviceId, FeedbackId, FeedbackClass, Percent), cookie) + return XinputDeviceBellCookie{cookie} +} + +func (cook XinputDeviceBellCookie) Check() error { + return cook.check() +} + +// Write request to wire for XinputDeviceBell +func (c *Conn) xinputDeviceBellRequest(DeviceId byte, FeedbackId byte, FeedbackClass byte, Percent int8) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XINPUTEXTENSION"] + b += 1 + + buf[b] = 32 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = DeviceId + b += 1 + + buf[b] = FeedbackId + b += 1 + + buf[b] = FeedbackClass + b += 1 + + buf[b] = byte(Percent) + b += 1 + + return buf +} + +// Request XinputSetDeviceValuators +// size: pad((8 + pad((int(NumValuators) * 4)))) +type XinputSetDeviceValuatorsCookie struct { + *cookie +} + +func (c *Conn) XinputSetDeviceValuators(DeviceId byte, FirstValuator byte, NumValuators byte, Valuators []int32) XinputSetDeviceValuatorsCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xinputSetDeviceValuatorsRequest(DeviceId, FirstValuator, NumValuators, Valuators), cookie) + return XinputSetDeviceValuatorsCookie{cookie} +} + +func (c *Conn) XinputSetDeviceValuatorsUnchecked(DeviceId byte, FirstValuator byte, NumValuators byte, Valuators []int32) XinputSetDeviceValuatorsCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xinputSetDeviceValuatorsRequest(DeviceId, FirstValuator, NumValuators, Valuators), cookie) + return XinputSetDeviceValuatorsCookie{cookie} +} + +// Request reply for XinputSetDeviceValuators +// size: 32 +type XinputSetDeviceValuatorsReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Status byte + // padding: 23 bytes +} + +// Waits and reads reply data from request XinputSetDeviceValuators +func (cook XinputSetDeviceValuatorsCookie) Reply() (*XinputSetDeviceValuatorsReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xinputSetDeviceValuatorsReply(buf), nil +} + +// Read reply into structure from buffer for XinputSetDeviceValuators +func xinputSetDeviceValuatorsReply(buf []byte) *XinputSetDeviceValuatorsReply { + v := new(XinputSetDeviceValuatorsReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.Status = buf[b] + b += 1 + + b += 23 // padding + + return v +} + +func (cook XinputSetDeviceValuatorsCookie) Check() error { + return cook.check() +} + +// Write request to wire for XinputSetDeviceValuators +func (c *Conn) xinputSetDeviceValuatorsRequest(DeviceId byte, FirstValuator byte, NumValuators byte, Valuators []int32) []byte { + size := pad((8 + pad((int(NumValuators) * 4)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XINPUTEXTENSION"] + b += 1 + + buf[b] = 33 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = DeviceId + b += 1 + + buf[b] = FirstValuator + b += 1 + + buf[b] = NumValuators + b += 1 + + b += 1 // padding + + for i := 0; i < int(NumValuators); i++ { + Put32(buf[b:], uint32(Valuators[i])) + b += 4 + } + b = pad(b) + + return buf +} + +// Request XinputGetDeviceControl +// size: 8 +type XinputGetDeviceControlCookie struct { + *cookie +} + +func (c *Conn) XinputGetDeviceControl(ControlId uint16, DeviceId byte) XinputGetDeviceControlCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xinputGetDeviceControlRequest(ControlId, DeviceId), cookie) + return XinputGetDeviceControlCookie{cookie} +} + +func (c *Conn) XinputGetDeviceControlUnchecked(ControlId uint16, DeviceId byte) XinputGetDeviceControlCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xinputGetDeviceControlRequest(ControlId, DeviceId), cookie) + return XinputGetDeviceControlCookie{cookie} +} + +// Request reply for XinputGetDeviceControl +// size: 32 +type XinputGetDeviceControlReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Status byte + // padding: 23 bytes +} + +// Waits and reads reply data from request XinputGetDeviceControl +func (cook XinputGetDeviceControlCookie) Reply() (*XinputGetDeviceControlReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xinputGetDeviceControlReply(buf), nil +} + +// Read reply into structure from buffer for XinputGetDeviceControl +func xinputGetDeviceControlReply(buf []byte) *XinputGetDeviceControlReply { + v := new(XinputGetDeviceControlReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.Status = buf[b] + b += 1 + + b += 23 // padding + + return v +} + +func (cook XinputGetDeviceControlCookie) Check() error { + return cook.check() +} + +// Write request to wire for XinputGetDeviceControl +func (c *Conn) xinputGetDeviceControlRequest(ControlId uint16, DeviceId byte) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XINPUTEXTENSION"] + b += 1 + + buf[b] = 34 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put16(buf[b:], ControlId) + b += 2 + + buf[b] = DeviceId + b += 1 + + b += 1 // padding + + return buf +} diff --git a/nexgb/auto_xprint.go b/nexgb/auto_xprint.go new file mode 100644 index 0000000..6790a86 --- /dev/null +++ b/nexgb/auto_xprint.go @@ -0,0 +1,2176 @@ +package xgb + +/* + This file was generated by xprint.xml on May 6 2012 3:00:45am EDT. + This file is automatically generated. Edit at your peril! +*/ + +// Imports are not necessary for XGB because everything is +// in one package. They are still listed here for reference. +// import "xproto" + +// Skipping definition for base type 'Card16' + +// Skipping definition for base type 'Char' + +// Skipping definition for base type 'Card32' + +// Skipping definition for base type 'Double' + +// Skipping definition for base type 'Bool' + +// Skipping definition for base type 'Float' + +// Skipping definition for base type 'Id' + +// Skipping definition for base type 'Card8' + +// Skipping definition for base type 'Int16' + +// Skipping definition for base type 'Int32' + +// Skipping definition for base type 'Void' + +// Skipping definition for base type 'Byte' + +// Skipping definition for base type 'Int8' + +const ( + XprintGetDocFinished = 0 + XprintGetDocSecondConsumer = 1 +) + +const ( + XprintEvMaskNoEventMask = 0 + XprintEvMaskPrintMask = 1 + XprintEvMaskAttributeMask = 2 +) + +const ( + XprintDetailStartJobNotify = 1 + XprintDetailEndJobNotify = 2 + XprintDetailStartDocNotify = 3 + XprintDetailEndDocNotify = 4 + XprintDetailStartPageNotify = 5 + XprintDetailEndPageNotify = 6 +) + +const ( + XprintAttrJobAttr = 1 + XprintAttrDocAttr = 2 + XprintAttrPageAttr = 3 + XprintAttrPrinterAttr = 4 + XprintAttrServerAttr = 5 + XprintAttrMediumAttr = 6 + XprintAttrSpoolerAttr = 7 +) + +// Skipping resource definition of 'Pcontext' + +type XprintString8 byte + +// 'XprintPrinter' struct definition +// Size: (((4 + pad((int(NameLen) * 1))) + 4) + pad((int(DescLen) * 1))) +type XprintPrinter struct { + NameLen uint32 + Name []XprintString8 // size: pad((int(NameLen) * 1)) + DescLen uint32 + Description []XprintString8 // size: pad((int(DescLen) * 1)) +} + +// Struct read XprintPrinter +func ReadXprintPrinter(buf []byte, v *XprintPrinter) int { + b := 0 + + v.NameLen = Get32(buf[b:]) + b += 4 + + v.Name = make([]XprintString8, v.NameLen) + for i := 0; i < int(v.NameLen); i++ { + v.Name[i] = XprintString8(buf[b]) + b += 1 + } + b = pad(b) + + v.DescLen = Get32(buf[b:]) + b += 4 + + v.Description = make([]XprintString8, v.DescLen) + for i := 0; i < int(v.DescLen); i++ { + v.Description[i] = XprintString8(buf[b]) + b += 1 + } + b = pad(b) + + return b +} + +// Struct list read XprintPrinter +func ReadXprintPrinterList(buf []byte, dest []XprintPrinter) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XprintPrinter{} + b += ReadXprintPrinter(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XprintPrinter +func (v XprintPrinter) Bytes() []byte { + buf := make([]byte, (((4 + pad((int(v.NameLen) * 1))) + 4) + pad((int(v.DescLen) * 1)))) + b := 0 + + Put32(buf[b:], v.NameLen) + b += 4 + + for i := 0; i < int(v.NameLen); i++ { + buf[b] = byte(v.Name[i]) + b += 1 + } + b = pad(b) + + Put32(buf[b:], v.DescLen) + b += 4 + + for i := 0; i < int(v.DescLen); i++ { + buf[b] = byte(v.Description[i]) + b += 1 + } + b = pad(b) + + return buf +} + +// Write struct list XprintPrinter +func XprintPrinterListBytes(buf []byte, list []XprintPrinter) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// Struct list size XprintPrinter +func XprintPrinterListSize(list []XprintPrinter) int { + size := 0 + for _, item := range list { + size += (((4 + pad((int(item.NameLen) * 1))) + 4) + pad((int(item.DescLen) * 1))) + } + return size +} + +// Event definition XprintNotify (0) +// Size: 32 + +const XprintNotify = 0 + +type XprintNotifyEvent struct { + Sequence uint16 + Detail byte + Context Id + Cancel bool +} + +// Event read XprintNotify +func NewXprintNotifyEvent(buf []byte) Event { + v := XprintNotifyEvent{} + b := 1 // don't read event number + + v.Detail = buf[b] + b += 1 + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Context = Id(Get32(buf[b:])) + b += 4 + + if buf[b] == 1 { + v.Cancel = true + } else { + v.Cancel = false + } + b += 1 + + return v +} + +// Event write XprintNotify +func (v XprintNotifyEvent) Bytes() []byte { + buf := make([]byte, 32) + b := 0 + + // write event number + buf[b] = 0 + b += 1 + + buf[b] = v.Detail + b += 1 + + b += 2 // skip sequence number + + Put32(buf[b:], uint32(v.Context)) + b += 4 + + if v.Cancel { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + return buf +} + +func (v XprintNotifyEvent) ImplementsEvent() {} + +func (v XprintNotifyEvent) SequenceId() uint16 { + return v.Sequence +} + +func (v XprintNotifyEvent) String() string { + fieldVals := make([]string, 0, 3) + fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) + fieldVals = append(fieldVals, sprintf("Detail: %d", v.Detail)) + fieldVals = append(fieldVals, sprintf("Context: %d", v.Context)) + fieldVals = append(fieldVals, sprintf("Cancel: %t", v.Cancel)) + return "XprintNotify {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newEventFuncs[0] = NewXprintNotifyEvent +} + +// Event definition XprintAttributNotify (1) +// Size: 32 + +const XprintAttributNotify = 1 + +type XprintAttributNotifyEvent struct { + Sequence uint16 + Detail byte + Context Id +} + +// Event read XprintAttributNotify +func NewXprintAttributNotifyEvent(buf []byte) Event { + v := XprintAttributNotifyEvent{} + b := 1 // don't read event number + + v.Detail = buf[b] + b += 1 + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Context = Id(Get32(buf[b:])) + b += 4 + + return v +} + +// Event write XprintAttributNotify +func (v XprintAttributNotifyEvent) Bytes() []byte { + buf := make([]byte, 32) + b := 0 + + // write event number + buf[b] = 1 + b += 1 + + buf[b] = v.Detail + b += 1 + + b += 2 // skip sequence number + + Put32(buf[b:], uint32(v.Context)) + b += 4 + + return buf +} + +func (v XprintAttributNotifyEvent) ImplementsEvent() {} + +func (v XprintAttributNotifyEvent) SequenceId() uint16 { + return v.Sequence +} + +func (v XprintAttributNotifyEvent) String() string { + fieldVals := make([]string, 0, 2) + fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) + fieldVals = append(fieldVals, sprintf("Detail: %d", v.Detail)) + fieldVals = append(fieldVals, sprintf("Context: %d", v.Context)) + return "XprintAttributNotify {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newEventFuncs[1] = NewXprintAttributNotifyEvent +} + +// Error definition XprintBadContext (0) +// Size: 32 + +const BadXprintBadContext = 0 + +type XprintBadContextError struct { + Sequence uint16 + NiceName string +} + +// Error read XprintBadContext +func NewXprintBadContextError(buf []byte) Error { + v := XprintBadContextError{} + v.NiceName = "XprintBadContext" + + b := 1 // skip error determinant + b += 1 // don't read error number + + v.Sequence = Get16(buf[b:]) + b += 2 + + return v +} + +func (err XprintBadContextError) ImplementsError() {} + +func (err XprintBadContextError) SequenceId() uint16 { + return err.Sequence +} + +func (err XprintBadContextError) BadId() Id { + return 0 +} + +func (err XprintBadContextError) Error() string { + fieldVals := make([]string, 0, 0) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) + return "BadXprintBadContext {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newErrorFuncs[0] = NewXprintBadContextError +} + +// Error definition XprintBadSequence (1) +// Size: 32 + +const BadXprintBadSequence = 1 + +type XprintBadSequenceError struct { + Sequence uint16 + NiceName string +} + +// Error read XprintBadSequence +func NewXprintBadSequenceError(buf []byte) Error { + v := XprintBadSequenceError{} + v.NiceName = "XprintBadSequence" + + b := 1 // skip error determinant + b += 1 // don't read error number + + v.Sequence = Get16(buf[b:]) + b += 2 + + return v +} + +func (err XprintBadSequenceError) ImplementsError() {} + +func (err XprintBadSequenceError) SequenceId() uint16 { + return err.Sequence +} + +func (err XprintBadSequenceError) BadId() Id { + return 0 +} + +func (err XprintBadSequenceError) Error() string { + fieldVals := make([]string, 0, 0) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) + return "BadXprintBadSequence {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newErrorFuncs[1] = NewXprintBadSequenceError +} + +// Request XprintPrintQueryVersion +// size: 4 +type XprintPrintQueryVersionCookie struct { + *cookie +} + +func (c *Conn) XprintPrintQueryVersion() XprintPrintQueryVersionCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xprintPrintQueryVersionRequest(), cookie) + return XprintPrintQueryVersionCookie{cookie} +} + +func (c *Conn) XprintPrintQueryVersionUnchecked() XprintPrintQueryVersionCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xprintPrintQueryVersionRequest(), cookie) + return XprintPrintQueryVersionCookie{cookie} +} + +// Request reply for XprintPrintQueryVersion +// size: 12 +type XprintPrintQueryVersionReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + MajorVersion uint16 + MinorVersion uint16 +} + +// Waits and reads reply data from request XprintPrintQueryVersion +func (cook XprintPrintQueryVersionCookie) Reply() (*XprintPrintQueryVersionReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xprintPrintQueryVersionReply(buf), nil +} + +// Read reply into structure from buffer for XprintPrintQueryVersion +func xprintPrintQueryVersionReply(buf []byte) *XprintPrintQueryVersionReply { + v := new(XprintPrintQueryVersionReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.MajorVersion = Get16(buf[b:]) + b += 2 + + v.MinorVersion = Get16(buf[b:]) + b += 2 + + return v +} + +func (cook XprintPrintQueryVersionCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintPrintQueryVersion +func (c *Conn) xprintPrintQueryVersionRequest() []byte { + size := 4 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 0 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + return buf +} + +// Request XprintPrintGetPrinterList +// size: pad(((12 + pad((int(PrinterNameLen) * 1))) + pad((int(LocaleLen) * 1)))) +type XprintPrintGetPrinterListCookie struct { + *cookie +} + +func (c *Conn) XprintPrintGetPrinterList(PrinterNameLen uint32, LocaleLen uint32, PrinterName []XprintString8, Locale []XprintString8) XprintPrintGetPrinterListCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xprintPrintGetPrinterListRequest(PrinterNameLen, LocaleLen, PrinterName, Locale), cookie) + return XprintPrintGetPrinterListCookie{cookie} +} + +func (c *Conn) XprintPrintGetPrinterListUnchecked(PrinterNameLen uint32, LocaleLen uint32, PrinterName []XprintString8, Locale []XprintString8) XprintPrintGetPrinterListCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xprintPrintGetPrinterListRequest(PrinterNameLen, LocaleLen, PrinterName, Locale), cookie) + return XprintPrintGetPrinterListCookie{cookie} +} + +// Request reply for XprintPrintGetPrinterList +// size: (32 + XprintPrinterListSize(Printers)) +type XprintPrintGetPrinterListReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + ListCount uint32 + // padding: 20 bytes + Printers []XprintPrinter // size: XprintPrinterListSize(Printers) +} + +// Waits and reads reply data from request XprintPrintGetPrinterList +func (cook XprintPrintGetPrinterListCookie) Reply() (*XprintPrintGetPrinterListReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xprintPrintGetPrinterListReply(buf), nil +} + +// Read reply into structure from buffer for XprintPrintGetPrinterList +func xprintPrintGetPrinterListReply(buf []byte) *XprintPrintGetPrinterListReply { + v := new(XprintPrintGetPrinterListReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.ListCount = Get32(buf[b:]) + b += 4 + + b += 20 // padding + + v.Printers = make([]XprintPrinter, v.ListCount) + b += ReadXprintPrinterList(buf[b:], v.Printers) + + return v +} + +func (cook XprintPrintGetPrinterListCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintPrintGetPrinterList +func (c *Conn) xprintPrintGetPrinterListRequest(PrinterNameLen uint32, LocaleLen uint32, PrinterName []XprintString8, Locale []XprintString8) []byte { + size := pad(((12 + pad((int(PrinterNameLen) * 1))) + pad((int(LocaleLen) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 1 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], PrinterNameLen) + b += 4 + + Put32(buf[b:], LocaleLen) + b += 4 + + for i := 0; i < int(PrinterNameLen); i++ { + buf[b] = byte(PrinterName[i]) + b += 1 + } + b = pad(b) + + for i := 0; i < int(LocaleLen); i++ { + buf[b] = byte(Locale[i]) + b += 1 + } + b = pad(b) + + return buf +} + +// Request XprintPrintRehashPrinterList +// size: 4 +type XprintPrintRehashPrinterListCookie struct { + *cookie +} + +// Write request to wire for XprintPrintRehashPrinterList +func (c *Conn) XprintPrintRehashPrinterList() XprintPrintRehashPrinterListCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xprintPrintRehashPrinterListRequest(), cookie) + return XprintPrintRehashPrinterListCookie{cookie} +} + +func (c *Conn) XprintPrintRehashPrinterListChecked() XprintPrintRehashPrinterListCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xprintPrintRehashPrinterListRequest(), cookie) + return XprintPrintRehashPrinterListCookie{cookie} +} + +func (cook XprintPrintRehashPrinterListCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintPrintRehashPrinterList +func (c *Conn) xprintPrintRehashPrinterListRequest() []byte { + size := 4 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 20 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + return buf +} + +// Request XprintCreateContext +// size: pad(((16 + pad((int(PrinterNameLen) * 1))) + pad((int(LocaleLen) * 1)))) +type XprintCreateContextCookie struct { + *cookie +} + +// Write request to wire for XprintCreateContext +func (c *Conn) XprintCreateContext(ContextId uint32, PrinterNameLen uint32, LocaleLen uint32, PrinterName []XprintString8, Locale []XprintString8) XprintCreateContextCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xprintCreateContextRequest(ContextId, PrinterNameLen, LocaleLen, PrinterName, Locale), cookie) + return XprintCreateContextCookie{cookie} +} + +func (c *Conn) XprintCreateContextChecked(ContextId uint32, PrinterNameLen uint32, LocaleLen uint32, PrinterName []XprintString8, Locale []XprintString8) XprintCreateContextCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xprintCreateContextRequest(ContextId, PrinterNameLen, LocaleLen, PrinterName, Locale), cookie) + return XprintCreateContextCookie{cookie} +} + +func (cook XprintCreateContextCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintCreateContext +func (c *Conn) xprintCreateContextRequest(ContextId uint32, PrinterNameLen uint32, LocaleLen uint32, PrinterName []XprintString8, Locale []XprintString8) []byte { + size := pad(((16 + pad((int(PrinterNameLen) * 1))) + pad((int(LocaleLen) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 2 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], ContextId) + b += 4 + + Put32(buf[b:], PrinterNameLen) + b += 4 + + Put32(buf[b:], LocaleLen) + b += 4 + + for i := 0; i < int(PrinterNameLen); i++ { + buf[b] = byte(PrinterName[i]) + b += 1 + } + b = pad(b) + + for i := 0; i < int(LocaleLen); i++ { + buf[b] = byte(Locale[i]) + b += 1 + } + b = pad(b) + + return buf +} + +// Request XprintPrintSetContext +// size: 8 +type XprintPrintSetContextCookie struct { + *cookie +} + +// Write request to wire for XprintPrintSetContext +func (c *Conn) XprintPrintSetContext(Context uint32) XprintPrintSetContextCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xprintPrintSetContextRequest(Context), cookie) + return XprintPrintSetContextCookie{cookie} +} + +func (c *Conn) XprintPrintSetContextChecked(Context uint32) XprintPrintSetContextCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xprintPrintSetContextRequest(Context), cookie) + return XprintPrintSetContextCookie{cookie} +} + +func (cook XprintPrintSetContextCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintPrintSetContext +func (c *Conn) xprintPrintSetContextRequest(Context uint32) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 3 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], Context) + b += 4 + + return buf +} + +// Request XprintPrintGetContext +// size: 4 +type XprintPrintGetContextCookie struct { + *cookie +} + +func (c *Conn) XprintPrintGetContext() XprintPrintGetContextCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xprintPrintGetContextRequest(), cookie) + return XprintPrintGetContextCookie{cookie} +} + +func (c *Conn) XprintPrintGetContextUnchecked() XprintPrintGetContextCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xprintPrintGetContextRequest(), cookie) + return XprintPrintGetContextCookie{cookie} +} + +// Request reply for XprintPrintGetContext +// size: 12 +type XprintPrintGetContextReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Context uint32 +} + +// Waits and reads reply data from request XprintPrintGetContext +func (cook XprintPrintGetContextCookie) Reply() (*XprintPrintGetContextReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xprintPrintGetContextReply(buf), nil +} + +// Read reply into structure from buffer for XprintPrintGetContext +func xprintPrintGetContextReply(buf []byte) *XprintPrintGetContextReply { + v := new(XprintPrintGetContextReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.Context = Get32(buf[b:]) + b += 4 + + return v +} + +func (cook XprintPrintGetContextCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintPrintGetContext +func (c *Conn) xprintPrintGetContextRequest() []byte { + size := 4 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 4 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + return buf +} + +// Request XprintPrintDestroyContext +// size: 8 +type XprintPrintDestroyContextCookie struct { + *cookie +} + +// Write request to wire for XprintPrintDestroyContext +func (c *Conn) XprintPrintDestroyContext(Context uint32) XprintPrintDestroyContextCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xprintPrintDestroyContextRequest(Context), cookie) + return XprintPrintDestroyContextCookie{cookie} +} + +func (c *Conn) XprintPrintDestroyContextChecked(Context uint32) XprintPrintDestroyContextCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xprintPrintDestroyContextRequest(Context), cookie) + return XprintPrintDestroyContextCookie{cookie} +} + +func (cook XprintPrintDestroyContextCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintPrintDestroyContext +func (c *Conn) xprintPrintDestroyContextRequest(Context uint32) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 5 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], Context) + b += 4 + + return buf +} + +// Request XprintPrintGetScreenOfContext +// size: 4 +type XprintPrintGetScreenOfContextCookie struct { + *cookie +} + +func (c *Conn) XprintPrintGetScreenOfContext() XprintPrintGetScreenOfContextCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xprintPrintGetScreenOfContextRequest(), cookie) + return XprintPrintGetScreenOfContextCookie{cookie} +} + +func (c *Conn) XprintPrintGetScreenOfContextUnchecked() XprintPrintGetScreenOfContextCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xprintPrintGetScreenOfContextRequest(), cookie) + return XprintPrintGetScreenOfContextCookie{cookie} +} + +// Request reply for XprintPrintGetScreenOfContext +// size: 12 +type XprintPrintGetScreenOfContextReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Root Id +} + +// Waits and reads reply data from request XprintPrintGetScreenOfContext +func (cook XprintPrintGetScreenOfContextCookie) Reply() (*XprintPrintGetScreenOfContextReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xprintPrintGetScreenOfContextReply(buf), nil +} + +// Read reply into structure from buffer for XprintPrintGetScreenOfContext +func xprintPrintGetScreenOfContextReply(buf []byte) *XprintPrintGetScreenOfContextReply { + v := new(XprintPrintGetScreenOfContextReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.Root = Id(Get32(buf[b:])) + b += 4 + + return v +} + +func (cook XprintPrintGetScreenOfContextCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintPrintGetScreenOfContext +func (c *Conn) xprintPrintGetScreenOfContextRequest() []byte { + size := 4 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 6 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + return buf +} + +// Request XprintPrintStartJob +// size: 8 +type XprintPrintStartJobCookie struct { + *cookie +} + +// Write request to wire for XprintPrintStartJob +func (c *Conn) XprintPrintStartJob(OutputMode byte) XprintPrintStartJobCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xprintPrintStartJobRequest(OutputMode), cookie) + return XprintPrintStartJobCookie{cookie} +} + +func (c *Conn) XprintPrintStartJobChecked(OutputMode byte) XprintPrintStartJobCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xprintPrintStartJobRequest(OutputMode), cookie) + return XprintPrintStartJobCookie{cookie} +} + +func (cook XprintPrintStartJobCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintPrintStartJob +func (c *Conn) xprintPrintStartJobRequest(OutputMode byte) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 7 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = OutputMode + b += 1 + + return buf +} + +// Request XprintPrintEndJob +// size: 8 +type XprintPrintEndJobCookie struct { + *cookie +} + +// Write request to wire for XprintPrintEndJob +func (c *Conn) XprintPrintEndJob(Cancel bool) XprintPrintEndJobCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xprintPrintEndJobRequest(Cancel), cookie) + return XprintPrintEndJobCookie{cookie} +} + +func (c *Conn) XprintPrintEndJobChecked(Cancel bool) XprintPrintEndJobCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xprintPrintEndJobRequest(Cancel), cookie) + return XprintPrintEndJobCookie{cookie} +} + +func (cook XprintPrintEndJobCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintPrintEndJob +func (c *Conn) xprintPrintEndJobRequest(Cancel bool) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 8 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + if Cancel { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + return buf +} + +// Request XprintPrintStartDoc +// size: 8 +type XprintPrintStartDocCookie struct { + *cookie +} + +// Write request to wire for XprintPrintStartDoc +func (c *Conn) XprintPrintStartDoc(DriverMode byte) XprintPrintStartDocCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xprintPrintStartDocRequest(DriverMode), cookie) + return XprintPrintStartDocCookie{cookie} +} + +func (c *Conn) XprintPrintStartDocChecked(DriverMode byte) XprintPrintStartDocCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xprintPrintStartDocRequest(DriverMode), cookie) + return XprintPrintStartDocCookie{cookie} +} + +func (cook XprintPrintStartDocCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintPrintStartDoc +func (c *Conn) xprintPrintStartDocRequest(DriverMode byte) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 9 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = DriverMode + b += 1 + + return buf +} + +// Request XprintPrintEndDoc +// size: 8 +type XprintPrintEndDocCookie struct { + *cookie +} + +// Write request to wire for XprintPrintEndDoc +func (c *Conn) XprintPrintEndDoc(Cancel bool) XprintPrintEndDocCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xprintPrintEndDocRequest(Cancel), cookie) + return XprintPrintEndDocCookie{cookie} +} + +func (c *Conn) XprintPrintEndDocChecked(Cancel bool) XprintPrintEndDocCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xprintPrintEndDocRequest(Cancel), cookie) + return XprintPrintEndDocCookie{cookie} +} + +func (cook XprintPrintEndDocCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintPrintEndDoc +func (c *Conn) xprintPrintEndDocRequest(Cancel bool) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 10 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + if Cancel { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + return buf +} + +// Request XprintPrintPutDocumentData +// size: pad((((16 + pad((int(LenData) * 1))) + pad((len(DocFormat) * 1))) + pad((len(Options) * 1)))) +type XprintPrintPutDocumentDataCookie struct { + *cookie +} + +// Write request to wire for XprintPrintPutDocumentData +func (c *Conn) XprintPrintPutDocumentData(Drawable Id, LenData uint32, LenFmt uint16, LenOptions uint16, Data []byte, DocFormat []XprintString8, Options []XprintString8) XprintPrintPutDocumentDataCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xprintPrintPutDocumentDataRequest(Drawable, LenData, LenFmt, LenOptions, Data, DocFormat, Options), cookie) + return XprintPrintPutDocumentDataCookie{cookie} +} + +func (c *Conn) XprintPrintPutDocumentDataChecked(Drawable Id, LenData uint32, LenFmt uint16, LenOptions uint16, Data []byte, DocFormat []XprintString8, Options []XprintString8) XprintPrintPutDocumentDataCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xprintPrintPutDocumentDataRequest(Drawable, LenData, LenFmt, LenOptions, Data, DocFormat, Options), cookie) + return XprintPrintPutDocumentDataCookie{cookie} +} + +func (cook XprintPrintPutDocumentDataCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintPrintPutDocumentData +func (c *Conn) xprintPrintPutDocumentDataRequest(Drawable Id, LenData uint32, LenFmt uint16, LenOptions uint16, Data []byte, DocFormat []XprintString8, Options []XprintString8) []byte { + size := pad((((16 + pad((int(LenData) * 1))) + pad((len(DocFormat) * 1))) + pad((len(Options) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 11 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Drawable)) + b += 4 + + Put32(buf[b:], LenData) + b += 4 + + Put16(buf[b:], LenFmt) + b += 2 + + Put16(buf[b:], LenOptions) + b += 2 + + copy(buf[b:], Data[:LenData]) + b += pad(int(LenData)) + + for i := 0; i < int(len(DocFormat)); i++ { + buf[b] = byte(DocFormat[i]) + b += 1 + } + b = pad(b) + + for i := 0; i < int(len(Options)); i++ { + buf[b] = byte(Options[i]) + b += 1 + } + b = pad(b) + + return buf +} + +// Request XprintPrintGetDocumentData +// size: 12 +type XprintPrintGetDocumentDataCookie struct { + *cookie +} + +func (c *Conn) XprintPrintGetDocumentData(Context Id, MaxBytes uint32) XprintPrintGetDocumentDataCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xprintPrintGetDocumentDataRequest(Context, MaxBytes), cookie) + return XprintPrintGetDocumentDataCookie{cookie} +} + +func (c *Conn) XprintPrintGetDocumentDataUnchecked(Context Id, MaxBytes uint32) XprintPrintGetDocumentDataCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xprintPrintGetDocumentDataRequest(Context, MaxBytes), cookie) + return XprintPrintGetDocumentDataCookie{cookie} +} + +// Request reply for XprintPrintGetDocumentData +// size: (32 + pad((int(DataLen) * 1))) +type XprintPrintGetDocumentDataReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + StatusCode uint32 + FinishedFlag uint32 + DataLen uint32 + // padding: 12 bytes + Data []byte // size: pad((int(DataLen) * 1)) +} + +// Waits and reads reply data from request XprintPrintGetDocumentData +func (cook XprintPrintGetDocumentDataCookie) Reply() (*XprintPrintGetDocumentDataReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xprintPrintGetDocumentDataReply(buf), nil +} + +// Read reply into structure from buffer for XprintPrintGetDocumentData +func xprintPrintGetDocumentDataReply(buf []byte) *XprintPrintGetDocumentDataReply { + v := new(XprintPrintGetDocumentDataReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.StatusCode = Get32(buf[b:]) + b += 4 + + v.FinishedFlag = Get32(buf[b:]) + b += 4 + + v.DataLen = Get32(buf[b:]) + b += 4 + + b += 12 // padding + + v.Data = make([]byte, v.DataLen) + copy(v.Data[:v.DataLen], buf[b:]) + b += pad(int(v.DataLen)) + + return v +} + +func (cook XprintPrintGetDocumentDataCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintPrintGetDocumentData +func (c *Conn) xprintPrintGetDocumentDataRequest(Context Id, MaxBytes uint32) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 12 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Context)) + b += 4 + + Put32(buf[b:], MaxBytes) + b += 4 + + return buf +} + +// Request XprintPrintStartPage +// size: 8 +type XprintPrintStartPageCookie struct { + *cookie +} + +// Write request to wire for XprintPrintStartPage +func (c *Conn) XprintPrintStartPage(Window Id) XprintPrintStartPageCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xprintPrintStartPageRequest(Window), cookie) + return XprintPrintStartPageCookie{cookie} +} + +func (c *Conn) XprintPrintStartPageChecked(Window Id) XprintPrintStartPageCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xprintPrintStartPageRequest(Window), cookie) + return XprintPrintStartPageCookie{cookie} +} + +func (cook XprintPrintStartPageCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintPrintStartPage +func (c *Conn) xprintPrintStartPageRequest(Window Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 13 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Window)) + b += 4 + + return buf +} + +// Request XprintPrintEndPage +// size: 8 +type XprintPrintEndPageCookie struct { + *cookie +} + +// Write request to wire for XprintPrintEndPage +func (c *Conn) XprintPrintEndPage(Cancel bool) XprintPrintEndPageCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xprintPrintEndPageRequest(Cancel), cookie) + return XprintPrintEndPageCookie{cookie} +} + +func (c *Conn) XprintPrintEndPageChecked(Cancel bool) XprintPrintEndPageCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xprintPrintEndPageRequest(Cancel), cookie) + return XprintPrintEndPageCookie{cookie} +} + +func (cook XprintPrintEndPageCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintPrintEndPage +func (c *Conn) xprintPrintEndPageRequest(Cancel bool) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 14 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + if Cancel { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + b += 3 // padding + + return buf +} + +// Request XprintPrintSelectInput +// size: pad((8 + (4 + pad((4 * popCount(int(EventMask))))))) +type XprintPrintSelectInputCookie struct { + *cookie +} + +// Write request to wire for XprintPrintSelectInput +func (c *Conn) XprintPrintSelectInput(Context Id, EventMask uint32, EventList []uint32) XprintPrintSelectInputCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xprintPrintSelectInputRequest(Context, EventMask, EventList), cookie) + return XprintPrintSelectInputCookie{cookie} +} + +func (c *Conn) XprintPrintSelectInputChecked(Context Id, EventMask uint32, EventList []uint32) XprintPrintSelectInputCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xprintPrintSelectInputRequest(Context, EventMask, EventList), cookie) + return XprintPrintSelectInputCookie{cookie} +} + +func (cook XprintPrintSelectInputCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintPrintSelectInput +func (c *Conn) xprintPrintSelectInputRequest(Context Id, EventMask uint32, EventList []uint32) []byte { + size := pad((8 + (4 + pad((4 * popCount(int(EventMask))))))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 15 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Context)) + b += 4 + + Put32(buf[b:], EventMask) + b += 4 + for i := 0; i < popCount(int(EventMask)); i++ { + Put32(buf[b:], EventList[i]) + b += 4 + } + b = pad(b) + + return buf +} + +// Request XprintPrintInputSelected +// size: 8 +type XprintPrintInputSelectedCookie struct { + *cookie +} + +func (c *Conn) XprintPrintInputSelected(Context Id) XprintPrintInputSelectedCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xprintPrintInputSelectedRequest(Context), cookie) + return XprintPrintInputSelectedCookie{cookie} +} + +func (c *Conn) XprintPrintInputSelectedUnchecked(Context Id) XprintPrintInputSelectedCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xprintPrintInputSelectedRequest(Context), cookie) + return XprintPrintInputSelectedCookie{cookie} +} + +// Request reply for XprintPrintInputSelected +// size: ((8 + (4 + pad((4 * popCount(int(EventMask)))))) + (4 + pad((4 * popCount(int(AllEventsMask)))))) +type XprintPrintInputSelectedReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + EventMask uint32 + EventList []uint32 + AllEventsMask uint32 + AllEventsList []uint32 +} + +// Waits and reads reply data from request XprintPrintInputSelected +func (cook XprintPrintInputSelectedCookie) Reply() (*XprintPrintInputSelectedReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xprintPrintInputSelectedReply(buf), nil +} + +// Read reply into structure from buffer for XprintPrintInputSelected +func xprintPrintInputSelectedReply(buf []byte) *XprintPrintInputSelectedReply { + v := new(XprintPrintInputSelectedReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.EventMask = Get32(buf[b:]) + b += 4 + + v.EventList = make([]uint32, popCount(int(v.EventMask))) + for i := 0; i < popCount(int(v.EventMask)); i++ { + v.EventList[i] = Get32(buf[b:]) + b += 4 + } + b = pad(b) + + v.AllEventsMask = Get32(buf[b:]) + b += 4 + + v.AllEventsList = make([]uint32, popCount(int(v.AllEventsMask))) + for i := 0; i < popCount(int(v.AllEventsMask)); i++ { + v.AllEventsList[i] = Get32(buf[b:]) + b += 4 + } + b = pad(b) + + return v +} + +func (cook XprintPrintInputSelectedCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintPrintInputSelected +func (c *Conn) xprintPrintInputSelectedRequest(Context Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 16 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Context)) + b += 4 + + return buf +} + +// Request XprintPrintGetAttributes +// size: 12 +type XprintPrintGetAttributesCookie struct { + *cookie +} + +func (c *Conn) XprintPrintGetAttributes(Context Id, Pool byte) XprintPrintGetAttributesCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xprintPrintGetAttributesRequest(Context, Pool), cookie) + return XprintPrintGetAttributesCookie{cookie} +} + +func (c *Conn) XprintPrintGetAttributesUnchecked(Context Id, Pool byte) XprintPrintGetAttributesCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xprintPrintGetAttributesRequest(Context, Pool), cookie) + return XprintPrintGetAttributesCookie{cookie} +} + +// Request reply for XprintPrintGetAttributes +// size: 33 +type XprintPrintGetAttributesReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + StringLen uint32 + // padding: 20 bytes + Attributes XprintString8 +} + +// Waits and reads reply data from request XprintPrintGetAttributes +func (cook XprintPrintGetAttributesCookie) Reply() (*XprintPrintGetAttributesReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xprintPrintGetAttributesReply(buf), nil +} + +// Read reply into structure from buffer for XprintPrintGetAttributes +func xprintPrintGetAttributesReply(buf []byte) *XprintPrintGetAttributesReply { + v := new(XprintPrintGetAttributesReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.StringLen = Get32(buf[b:]) + b += 4 + + b += 20 // padding + + v.Attributes = XprintString8(buf[b]) + b += 1 + + return v +} + +func (cook XprintPrintGetAttributesCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintPrintGetAttributes +func (c *Conn) xprintPrintGetAttributesRequest(Context Id, Pool byte) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 17 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Context)) + b += 4 + + buf[b] = Pool + b += 1 + + b += 3 // padding + + return buf +} + +// Request XprintPrintGetOneAttributes +// size: pad((16 + pad((int(NameLen) * 1)))) +type XprintPrintGetOneAttributesCookie struct { + *cookie +} + +func (c *Conn) XprintPrintGetOneAttributes(Context Id, NameLen uint32, Pool byte, Name []XprintString8) XprintPrintGetOneAttributesCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xprintPrintGetOneAttributesRequest(Context, NameLen, Pool, Name), cookie) + return XprintPrintGetOneAttributesCookie{cookie} +} + +func (c *Conn) XprintPrintGetOneAttributesUnchecked(Context Id, NameLen uint32, Pool byte, Name []XprintString8) XprintPrintGetOneAttributesCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xprintPrintGetOneAttributesRequest(Context, NameLen, Pool, Name), cookie) + return XprintPrintGetOneAttributesCookie{cookie} +} + +// Request reply for XprintPrintGetOneAttributes +// size: (32 + pad((int(ValueLen) * 1))) +type XprintPrintGetOneAttributesReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + ValueLen uint32 + // padding: 20 bytes + Value []XprintString8 // size: pad((int(ValueLen) * 1)) +} + +// Waits and reads reply data from request XprintPrintGetOneAttributes +func (cook XprintPrintGetOneAttributesCookie) Reply() (*XprintPrintGetOneAttributesReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xprintPrintGetOneAttributesReply(buf), nil +} + +// Read reply into structure from buffer for XprintPrintGetOneAttributes +func xprintPrintGetOneAttributesReply(buf []byte) *XprintPrintGetOneAttributesReply { + v := new(XprintPrintGetOneAttributesReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.ValueLen = Get32(buf[b:]) + b += 4 + + b += 20 // padding + + v.Value = make([]XprintString8, v.ValueLen) + for i := 0; i < int(v.ValueLen); i++ { + v.Value[i] = XprintString8(buf[b]) + b += 1 + } + b = pad(b) + + return v +} + +func (cook XprintPrintGetOneAttributesCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintPrintGetOneAttributes +func (c *Conn) xprintPrintGetOneAttributesRequest(Context Id, NameLen uint32, Pool byte, Name []XprintString8) []byte { + size := pad((16 + pad((int(NameLen) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 19 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Context)) + b += 4 + + Put32(buf[b:], NameLen) + b += 4 + + buf[b] = Pool + b += 1 + + b += 3 // padding + + for i := 0; i < int(NameLen); i++ { + buf[b] = byte(Name[i]) + b += 1 + } + b = pad(b) + + return buf +} + +// Request XprintPrintSetAttributes +// size: pad((16 + pad((len(Attributes) * 1)))) +type XprintPrintSetAttributesCookie struct { + *cookie +} + +// Write request to wire for XprintPrintSetAttributes +func (c *Conn) XprintPrintSetAttributes(Context Id, StringLen uint32, Pool byte, Rule byte, Attributes []XprintString8) XprintPrintSetAttributesCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xprintPrintSetAttributesRequest(Context, StringLen, Pool, Rule, Attributes), cookie) + return XprintPrintSetAttributesCookie{cookie} +} + +func (c *Conn) XprintPrintSetAttributesChecked(Context Id, StringLen uint32, Pool byte, Rule byte, Attributes []XprintString8) XprintPrintSetAttributesCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xprintPrintSetAttributesRequest(Context, StringLen, Pool, Rule, Attributes), cookie) + return XprintPrintSetAttributesCookie{cookie} +} + +func (cook XprintPrintSetAttributesCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintPrintSetAttributes +func (c *Conn) xprintPrintSetAttributesRequest(Context Id, StringLen uint32, Pool byte, Rule byte, Attributes []XprintString8) []byte { + size := pad((16 + pad((len(Attributes) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 18 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Context)) + b += 4 + + Put32(buf[b:], StringLen) + b += 4 + + buf[b] = Pool + b += 1 + + buf[b] = Rule + b += 1 + + b += 2 // padding + + for i := 0; i < int(len(Attributes)); i++ { + buf[b] = byte(Attributes[i]) + b += 1 + } + b = pad(b) + + return buf +} + +// Request XprintPrintGetPageDimensions +// size: 8 +type XprintPrintGetPageDimensionsCookie struct { + *cookie +} + +func (c *Conn) XprintPrintGetPageDimensions(Context Id) XprintPrintGetPageDimensionsCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xprintPrintGetPageDimensionsRequest(Context), cookie) + return XprintPrintGetPageDimensionsCookie{cookie} +} + +func (c *Conn) XprintPrintGetPageDimensionsUnchecked(Context Id) XprintPrintGetPageDimensionsCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xprintPrintGetPageDimensionsRequest(Context), cookie) + return XprintPrintGetPageDimensionsCookie{cookie} +} + +// Request reply for XprintPrintGetPageDimensions +// size: 20 +type XprintPrintGetPageDimensionsReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Width uint16 + Height uint16 + OffsetX uint16 + OffsetY uint16 + ReproducibleWidth uint16 + ReproducibleHeight uint16 +} + +// Waits and reads reply data from request XprintPrintGetPageDimensions +func (cook XprintPrintGetPageDimensionsCookie) Reply() (*XprintPrintGetPageDimensionsReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xprintPrintGetPageDimensionsReply(buf), nil +} + +// Read reply into structure from buffer for XprintPrintGetPageDimensions +func xprintPrintGetPageDimensionsReply(buf []byte) *XprintPrintGetPageDimensionsReply { + v := new(XprintPrintGetPageDimensionsReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.Width = Get16(buf[b:]) + b += 2 + + v.Height = Get16(buf[b:]) + b += 2 + + v.OffsetX = Get16(buf[b:]) + b += 2 + + v.OffsetY = Get16(buf[b:]) + b += 2 + + v.ReproducibleWidth = Get16(buf[b:]) + b += 2 + + v.ReproducibleHeight = Get16(buf[b:]) + b += 2 + + return v +} + +func (cook XprintPrintGetPageDimensionsCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintPrintGetPageDimensions +func (c *Conn) xprintPrintGetPageDimensionsRequest(Context Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 21 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Context)) + b += 4 + + return buf +} + +// Request XprintPrintQueryScreens +// size: 4 +type XprintPrintQueryScreensCookie struct { + *cookie +} + +func (c *Conn) XprintPrintQueryScreens() XprintPrintQueryScreensCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xprintPrintQueryScreensRequest(), cookie) + return XprintPrintQueryScreensCookie{cookie} +} + +func (c *Conn) XprintPrintQueryScreensUnchecked() XprintPrintQueryScreensCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xprintPrintQueryScreensRequest(), cookie) + return XprintPrintQueryScreensCookie{cookie} +} + +// Request reply for XprintPrintQueryScreens +// size: (32 + pad((int(ListCount) * 4))) +type XprintPrintQueryScreensReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + ListCount uint32 + // padding: 20 bytes + Roots []Id // size: pad((int(ListCount) * 4)) +} + +// Waits and reads reply data from request XprintPrintQueryScreens +func (cook XprintPrintQueryScreensCookie) Reply() (*XprintPrintQueryScreensReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xprintPrintQueryScreensReply(buf), nil +} + +// Read reply into structure from buffer for XprintPrintQueryScreens +func xprintPrintQueryScreensReply(buf []byte) *XprintPrintQueryScreensReply { + v := new(XprintPrintQueryScreensReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.ListCount = Get32(buf[b:]) + b += 4 + + b += 20 // padding + + v.Roots = make([]Id, v.ListCount) + for i := 0; i < int(v.ListCount); i++ { + v.Roots[i] = Id(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + return v +} + +func (cook XprintPrintQueryScreensCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintPrintQueryScreens +func (c *Conn) xprintPrintQueryScreensRequest() []byte { + size := 4 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 22 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + return buf +} + +// Request XprintPrintSetImageResolution +// size: 12 +type XprintPrintSetImageResolutionCookie struct { + *cookie +} + +func (c *Conn) XprintPrintSetImageResolution(Context Id, ImageResolution uint16) XprintPrintSetImageResolutionCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xprintPrintSetImageResolutionRequest(Context, ImageResolution), cookie) + return XprintPrintSetImageResolutionCookie{cookie} +} + +func (c *Conn) XprintPrintSetImageResolutionUnchecked(Context Id, ImageResolution uint16) XprintPrintSetImageResolutionCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xprintPrintSetImageResolutionRequest(Context, ImageResolution), cookie) + return XprintPrintSetImageResolutionCookie{cookie} +} + +// Request reply for XprintPrintSetImageResolution +// size: 10 +type XprintPrintSetImageResolutionReply struct { + Sequence uint16 + Length uint32 + Status bool + PreviousResolutions uint16 +} + +// Waits and reads reply data from request XprintPrintSetImageResolution +func (cook XprintPrintSetImageResolutionCookie) Reply() (*XprintPrintSetImageResolutionReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xprintPrintSetImageResolutionReply(buf), nil +} + +// Read reply into structure from buffer for XprintPrintSetImageResolution +func xprintPrintSetImageResolutionReply(buf []byte) *XprintPrintSetImageResolutionReply { + v := new(XprintPrintSetImageResolutionReply) + b := 1 // skip reply determinant + + if buf[b] == 1 { + v.Status = true + } else { + v.Status = false + } + b += 1 + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.PreviousResolutions = Get16(buf[b:]) + b += 2 + + return v +} + +func (cook XprintPrintSetImageResolutionCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintPrintSetImageResolution +func (c *Conn) xprintPrintSetImageResolutionRequest(Context Id, ImageResolution uint16) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 23 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Context)) + b += 4 + + Put16(buf[b:], ImageResolution) + b += 2 + + return buf +} + +// Request XprintPrintGetImageResolution +// size: 8 +type XprintPrintGetImageResolutionCookie struct { + *cookie +} + +func (c *Conn) XprintPrintGetImageResolution(Context Id) XprintPrintGetImageResolutionCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xprintPrintGetImageResolutionRequest(Context), cookie) + return XprintPrintGetImageResolutionCookie{cookie} +} + +func (c *Conn) XprintPrintGetImageResolutionUnchecked(Context Id) XprintPrintGetImageResolutionCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xprintPrintGetImageResolutionRequest(Context), cookie) + return XprintPrintGetImageResolutionCookie{cookie} +} + +// Request reply for XprintPrintGetImageResolution +// size: 10 +type XprintPrintGetImageResolutionReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + ImageResolution uint16 +} + +// Waits and reads reply data from request XprintPrintGetImageResolution +func (cook XprintPrintGetImageResolutionCookie) Reply() (*XprintPrintGetImageResolutionReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xprintPrintGetImageResolutionReply(buf), nil +} + +// Read reply into structure from buffer for XprintPrintGetImageResolution +func xprintPrintGetImageResolutionReply(buf []byte) *XprintPrintGetImageResolutionReply { + v := new(XprintPrintGetImageResolutionReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.ImageResolution = Get16(buf[b:]) + b += 2 + + return v +} + +func (cook XprintPrintGetImageResolutionCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintPrintGetImageResolution +func (c *Conn) xprintPrintGetImageResolutionRequest(Context Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 24 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Context)) + b += 4 + + return buf +} diff --git a/nexgb/auto_xproto.go b/nexgb/auto_xproto.go index 32fa6dd..edee988 100644 --- a/nexgb/auto_xproto.go +++ b/nexgb/auto_xproto.go @@ -1,10 +1,12 @@ package xgb /* - This file was generated by xproto.xml on May 5 2012 5:43:45pm EDT. + This file was generated by xproto.xml on May 6 2012 3:00:45am EDT. This file is automatically generated. Edit at your peril! */ +// Skipping definition for base type 'Int16' + // Skipping definition for base type 'Int32' // Skipping definition for base type 'Void' @@ -29,8 +31,6 @@ package xgb // Skipping definition for base type 'Card8' -// Skipping definition for base type 'Int16' - const ( VisualClassStaticGray = 0 VisualClassGrayScale = 1 @@ -2417,15 +2417,15 @@ func HostListSize(list []Host) int { // NewClientMessageDataUnionData16(Data16 []uint16) ClientMessageDataUnion // NewClientMessageDataUnionData32(Data32 []uint32) ClientMessageDataUnion type ClientMessageDataUnion struct { - Data8 []byte // size: pad(20) - Data16 []uint16 // size: pad(20) - Data32 []uint32 // size: pad(20) + Data8 []byte // size: 20 + Data16 []uint16 // size: 20 + Data32 []uint32 // size: 20 } // Union constructor for ClientMessageDataUnion for field Data8. func NewClientMessageDataUnionData8(Data8 []byte) ClientMessageDataUnion { var b int - buf := make([]byte, pad(20)) + buf := make([]byte, 20) copy(buf[b:], Data8[:20]) b += pad(int(20)) @@ -2462,7 +2462,7 @@ func NewClientMessageDataUnionData8(Data8 []byte) ClientMessageDataUnion { // Union constructor for ClientMessageDataUnion for field Data16. func NewClientMessageDataUnionData16(Data16 []uint16) ClientMessageDataUnion { var b int - buf := make([]byte, pad(20)) + buf := make([]byte, 20) for i := 0; i < int(10); i++ { Put16(buf[b:], Data16[i]) @@ -2502,7 +2502,7 @@ func NewClientMessageDataUnionData16(Data16 []uint16) ClientMessageDataUnion { // Union constructor for ClientMessageDataUnion for field Data32. func NewClientMessageDataUnionData32(Data32 []uint32) ClientMessageDataUnion { var b int - buf := make([]byte, pad(20)) + buf := make([]byte, 20) for i := 0; i < int(5); i++ { Put32(buf[b:], Data32[i]) @@ -2564,7 +2564,7 @@ func ReadClientMessageDataUnion(buf []byte, v *ClientMessageDataUnion) int { } b = pad(b) - return pad(20) + return 20 } // Union list read ClientMessageDataUnion @@ -2581,7 +2581,7 @@ func ReadClientMessageDataUnionList(buf []byte, dest []ClientMessageDataUnion) i // 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, pad(20)) + buf := make([]byte, 20) b := 0 copy(buf[b:], v.Data8[:20]) @@ -3285,7 +3285,7 @@ func init() { const KeymapNotify = 11 type KeymapNotifyEvent struct { - Keys []byte // size: pad(31) + Keys []byte // size: 32 } // Event read KeymapNotify @@ -7938,7 +7938,7 @@ func (c *Conn) convertSelectionRequest(Requestor Id, Selection Id, Target Id, Pr } // Request SendEvent -// size: pad((12 + pad(32))) +// size: 44 type SendEventCookie struct { *cookie } @@ -7962,7 +7962,7 @@ func (cook SendEventCookie) Check() error { // Write request to wire for SendEvent func (c *Conn) sendEventRequest(Propagate bool, Destination Id, EventMask uint32, Event string) []byte { - size := pad((12 + pad(32))) + size := 44 b := 0 buf := make([]byte, size) @@ -9200,12 +9200,12 @@ func (c *Conn) QueryKeymapUnchecked() QueryKeymapCookie { } // Request reply for QueryKeymap -// size: (8 + pad(32)) +// size: 40 type QueryKeymapReply struct { Sequence uint16 Length uint32 // padding: 1 bytes - Keys []byte // size: pad(32) + Keys []byte // size: 32 } // Waits and reads reply data from request QueryKeymap @@ -13267,7 +13267,7 @@ func (c *Conn) GetKeyboardControlUnchecked() GetKeyboardControlCookie { } // Request reply for GetKeyboardControl -// size: (20 + pad(32)) +// size: 52 type GetKeyboardControlReply struct { Sequence uint16 Length uint32 @@ -13278,7 +13278,7 @@ type GetKeyboardControlReply struct { BellPitch uint16 BellDuration uint16 // padding: 2 bytes - AutoRepeats []byte // size: pad(32) + AutoRepeats []byte // size: 32 } // Waits and reads reply data from request GetKeyboardControl diff --git a/nexgb/auto_xselinux.go b/nexgb/auto_xselinux.go new file mode 100644 index 0000000..57908c2 --- /dev/null +++ b/nexgb/auto_xselinux.go @@ -0,0 +1,1939 @@ +package xgb + +/* + This file was generated by xselinux.xml on May 6 2012 3:00:45am EDT. + This file is automatically generated. Edit at your peril! +*/ + +// Imports are not necessary for XGB because everything is +// in one package. They are still listed here for reference. +// import "xproto" + +// Skipping definition for base type 'Void' + +// Skipping definition for base type 'Byte' + +// Skipping definition for base type 'Int8' + +// Skipping definition for base type 'Card16' + +// Skipping definition for base type 'Char' + +// Skipping definition for base type 'Card32' + +// Skipping definition for base type 'Double' + +// Skipping definition for base type 'Bool' + +// Skipping definition for base type 'Float' + +// Skipping definition for base type 'Id' + +// Skipping definition for base type 'Card8' + +// Skipping definition for base type 'Int16' + +// Skipping definition for base type 'Int32' + +// 'XselinuxListItem' struct definition +// Size: ((12 + pad((int(ObjectContextLen) * 1))) + pad((int(DataContextLen) * 1))) +type XselinuxListItem struct { + Name Id + ObjectContextLen uint32 + DataContextLen uint32 + ObjectContext string // size: pad((int(ObjectContextLen) * 1)) + DataContext string // size: pad((int(DataContextLen) * 1)) +} + +// Struct read XselinuxListItem +func ReadXselinuxListItem(buf []byte, v *XselinuxListItem) int { + b := 0 + + v.Name = Id(Get32(buf[b:])) + b += 4 + + v.ObjectContextLen = Get32(buf[b:]) + b += 4 + + v.DataContextLen = Get32(buf[b:]) + b += 4 + + { + byteString := make([]byte, v.ObjectContextLen) + copy(byteString[:v.ObjectContextLen], buf[b:]) + v.ObjectContext = string(byteString) + b += pad(int(v.ObjectContextLen)) + } + + { + byteString := make([]byte, v.DataContextLen) + copy(byteString[:v.DataContextLen], buf[b:]) + v.DataContext = string(byteString) + b += pad(int(v.DataContextLen)) + } + + return b +} + +// Struct list read XselinuxListItem +func ReadXselinuxListItemList(buf []byte, dest []XselinuxListItem) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XselinuxListItem{} + b += ReadXselinuxListItem(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XselinuxListItem +func (v XselinuxListItem) Bytes() []byte { + buf := make([]byte, ((12 + pad((int(v.ObjectContextLen) * 1))) + pad((int(v.DataContextLen) * 1)))) + b := 0 + + Put32(buf[b:], uint32(v.Name)) + b += 4 + + Put32(buf[b:], v.ObjectContextLen) + b += 4 + + Put32(buf[b:], v.DataContextLen) + b += 4 + + copy(buf[b:], v.ObjectContext[:v.ObjectContextLen]) + b += pad(int(v.ObjectContextLen)) + + copy(buf[b:], v.DataContext[:v.DataContextLen]) + b += pad(int(v.DataContextLen)) + + return buf +} + +// Write struct list XselinuxListItem +func XselinuxListItemListBytes(buf []byte, list []XselinuxListItem) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// Struct list size XselinuxListItem +func XselinuxListItemListSize(list []XselinuxListItem) int { + size := 0 + for _, item := range list { + size += ((12 + pad((int(item.ObjectContextLen) * 1))) + pad((int(item.DataContextLen) * 1))) + } + return size +} + +// Request XselinuxQueryVersion +// size: 8 +type XselinuxQueryVersionCookie struct { + *cookie +} + +func (c *Conn) XselinuxQueryVersion(ClientMajor byte, ClientMinor byte) XselinuxQueryVersionCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xselinuxQueryVersionRequest(ClientMajor, ClientMinor), cookie) + return XselinuxQueryVersionCookie{cookie} +} + +func (c *Conn) XselinuxQueryVersionUnchecked(ClientMajor byte, ClientMinor byte) XselinuxQueryVersionCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xselinuxQueryVersionRequest(ClientMajor, ClientMinor), cookie) + return XselinuxQueryVersionCookie{cookie} +} + +// Request reply for XselinuxQueryVersion +// size: 12 +type XselinuxQueryVersionReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + ServerMajor uint16 + ServerMinor uint16 +} + +// Waits and reads reply data from request XselinuxQueryVersion +func (cook XselinuxQueryVersionCookie) Reply() (*XselinuxQueryVersionReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xselinuxQueryVersionReply(buf), nil +} + +// Read reply into structure from buffer for XselinuxQueryVersion +func xselinuxQueryVersionReply(buf []byte) *XselinuxQueryVersionReply { + v := new(XselinuxQueryVersionReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.ServerMajor = Get16(buf[b:]) + b += 2 + + v.ServerMinor = Get16(buf[b:]) + b += 2 + + return v +} + +func (cook XselinuxQueryVersionCookie) Check() error { + return cook.check() +} + +// Write request to wire for XselinuxQueryVersion +func (c *Conn) xselinuxQueryVersionRequest(ClientMajor byte, ClientMinor byte) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SELINUX"] + b += 1 + + buf[b] = 0 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = ClientMajor + b += 1 + + buf[b] = ClientMinor + b += 1 + + return buf +} + +// Request XselinuxSetDeviceCreateContext +// size: pad((8 + pad((int(ContextLen) * 1)))) +type XselinuxSetDeviceCreateContextCookie struct { + *cookie +} + +// Write request to wire for XselinuxSetDeviceCreateContext +func (c *Conn) XselinuxSetDeviceCreateContext(ContextLen uint32, Context string) XselinuxSetDeviceCreateContextCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xselinuxSetDeviceCreateContextRequest(ContextLen, Context), cookie) + return XselinuxSetDeviceCreateContextCookie{cookie} +} + +func (c *Conn) XselinuxSetDeviceCreateContextChecked(ContextLen uint32, Context string) XselinuxSetDeviceCreateContextCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xselinuxSetDeviceCreateContextRequest(ContextLen, Context), cookie) + return XselinuxSetDeviceCreateContextCookie{cookie} +} + +func (cook XselinuxSetDeviceCreateContextCookie) Check() error { + return cook.check() +} + +// Write request to wire for XselinuxSetDeviceCreateContext +func (c *Conn) xselinuxSetDeviceCreateContextRequest(ContextLen uint32, Context string) []byte { + size := pad((8 + pad((int(ContextLen) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SELINUX"] + b += 1 + + buf[b] = 1 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], ContextLen) + b += 4 + + copy(buf[b:], Context[:ContextLen]) + b += pad(int(ContextLen)) + + return buf +} + +// Request XselinuxGetDeviceCreateContext +// size: 4 +type XselinuxGetDeviceCreateContextCookie struct { + *cookie +} + +func (c *Conn) XselinuxGetDeviceCreateContext() XselinuxGetDeviceCreateContextCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xselinuxGetDeviceCreateContextRequest(), cookie) + return XselinuxGetDeviceCreateContextCookie{cookie} +} + +func (c *Conn) XselinuxGetDeviceCreateContextUnchecked() XselinuxGetDeviceCreateContextCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xselinuxGetDeviceCreateContextRequest(), cookie) + return XselinuxGetDeviceCreateContextCookie{cookie} +} + +// Request reply for XselinuxGetDeviceCreateContext +// size: (32 + pad((int(ContextLen) * 1))) +type XselinuxGetDeviceCreateContextReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + ContextLen uint32 + // padding: 20 bytes + Context string // size: pad((int(ContextLen) * 1)) +} + +// Waits and reads reply data from request XselinuxGetDeviceCreateContext +func (cook XselinuxGetDeviceCreateContextCookie) Reply() (*XselinuxGetDeviceCreateContextReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xselinuxGetDeviceCreateContextReply(buf), nil +} + +// Read reply into structure from buffer for XselinuxGetDeviceCreateContext +func xselinuxGetDeviceCreateContextReply(buf []byte) *XselinuxGetDeviceCreateContextReply { + v := new(XselinuxGetDeviceCreateContextReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.ContextLen = Get32(buf[b:]) + b += 4 + + b += 20 // padding + + { + byteString := make([]byte, v.ContextLen) + copy(byteString[:v.ContextLen], buf[b:]) + v.Context = string(byteString) + b += pad(int(v.ContextLen)) + } + + return v +} + +func (cook XselinuxGetDeviceCreateContextCookie) Check() error { + return cook.check() +} + +// Write request to wire for XselinuxGetDeviceCreateContext +func (c *Conn) xselinuxGetDeviceCreateContextRequest() []byte { + size := 4 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SELINUX"] + b += 1 + + buf[b] = 2 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + return buf +} + +// Request XselinuxSetDeviceContext +// size: pad((12 + pad((int(ContextLen) * 1)))) +type XselinuxSetDeviceContextCookie struct { + *cookie +} + +// Write request to wire for XselinuxSetDeviceContext +func (c *Conn) XselinuxSetDeviceContext(Device uint32, ContextLen uint32, Context string) XselinuxSetDeviceContextCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xselinuxSetDeviceContextRequest(Device, ContextLen, Context), cookie) + return XselinuxSetDeviceContextCookie{cookie} +} + +func (c *Conn) XselinuxSetDeviceContextChecked(Device uint32, ContextLen uint32, Context string) XselinuxSetDeviceContextCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xselinuxSetDeviceContextRequest(Device, ContextLen, Context), cookie) + return XselinuxSetDeviceContextCookie{cookie} +} + +func (cook XselinuxSetDeviceContextCookie) Check() error { + return cook.check() +} + +// Write request to wire for XselinuxSetDeviceContext +func (c *Conn) xselinuxSetDeviceContextRequest(Device uint32, ContextLen uint32, Context string) []byte { + size := pad((12 + pad((int(ContextLen) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SELINUX"] + b += 1 + + buf[b] = 3 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], Device) + b += 4 + + Put32(buf[b:], ContextLen) + b += 4 + + copy(buf[b:], Context[:ContextLen]) + b += pad(int(ContextLen)) + + return buf +} + +// Request XselinuxGetDeviceContext +// size: 8 +type XselinuxGetDeviceContextCookie struct { + *cookie +} + +func (c *Conn) XselinuxGetDeviceContext(Device uint32) XselinuxGetDeviceContextCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xselinuxGetDeviceContextRequest(Device), cookie) + return XselinuxGetDeviceContextCookie{cookie} +} + +func (c *Conn) XselinuxGetDeviceContextUnchecked(Device uint32) XselinuxGetDeviceContextCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xselinuxGetDeviceContextRequest(Device), cookie) + return XselinuxGetDeviceContextCookie{cookie} +} + +// Request reply for XselinuxGetDeviceContext +// size: (32 + pad((int(ContextLen) * 1))) +type XselinuxGetDeviceContextReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + ContextLen uint32 + // padding: 20 bytes + Context string // size: pad((int(ContextLen) * 1)) +} + +// Waits and reads reply data from request XselinuxGetDeviceContext +func (cook XselinuxGetDeviceContextCookie) Reply() (*XselinuxGetDeviceContextReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xselinuxGetDeviceContextReply(buf), nil +} + +// Read reply into structure from buffer for XselinuxGetDeviceContext +func xselinuxGetDeviceContextReply(buf []byte) *XselinuxGetDeviceContextReply { + v := new(XselinuxGetDeviceContextReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.ContextLen = Get32(buf[b:]) + b += 4 + + b += 20 // padding + + { + byteString := make([]byte, v.ContextLen) + copy(byteString[:v.ContextLen], buf[b:]) + v.Context = string(byteString) + b += pad(int(v.ContextLen)) + } + + return v +} + +func (cook XselinuxGetDeviceContextCookie) Check() error { + return cook.check() +} + +// Write request to wire for XselinuxGetDeviceContext +func (c *Conn) xselinuxGetDeviceContextRequest(Device uint32) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SELINUX"] + b += 1 + + buf[b] = 4 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], Device) + b += 4 + + return buf +} + +// Request XselinuxSetWindowCreateContext +// size: pad((8 + pad((int(ContextLen) * 1)))) +type XselinuxSetWindowCreateContextCookie struct { + *cookie +} + +// Write request to wire for XselinuxSetWindowCreateContext +func (c *Conn) XselinuxSetWindowCreateContext(ContextLen uint32, Context string) XselinuxSetWindowCreateContextCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xselinuxSetWindowCreateContextRequest(ContextLen, Context), cookie) + return XselinuxSetWindowCreateContextCookie{cookie} +} + +func (c *Conn) XselinuxSetWindowCreateContextChecked(ContextLen uint32, Context string) XselinuxSetWindowCreateContextCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xselinuxSetWindowCreateContextRequest(ContextLen, Context), cookie) + return XselinuxSetWindowCreateContextCookie{cookie} +} + +func (cook XselinuxSetWindowCreateContextCookie) Check() error { + return cook.check() +} + +// Write request to wire for XselinuxSetWindowCreateContext +func (c *Conn) xselinuxSetWindowCreateContextRequest(ContextLen uint32, Context string) []byte { + size := pad((8 + pad((int(ContextLen) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SELINUX"] + b += 1 + + buf[b] = 5 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], ContextLen) + b += 4 + + copy(buf[b:], Context[:ContextLen]) + b += pad(int(ContextLen)) + + return buf +} + +// Request XselinuxGetWindowCreateContext +// size: 4 +type XselinuxGetWindowCreateContextCookie struct { + *cookie +} + +func (c *Conn) XselinuxGetWindowCreateContext() XselinuxGetWindowCreateContextCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xselinuxGetWindowCreateContextRequest(), cookie) + return XselinuxGetWindowCreateContextCookie{cookie} +} + +func (c *Conn) XselinuxGetWindowCreateContextUnchecked() XselinuxGetWindowCreateContextCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xselinuxGetWindowCreateContextRequest(), cookie) + return XselinuxGetWindowCreateContextCookie{cookie} +} + +// Request reply for XselinuxGetWindowCreateContext +// size: (32 + pad((int(ContextLen) * 1))) +type XselinuxGetWindowCreateContextReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + ContextLen uint32 + // padding: 20 bytes + Context string // size: pad((int(ContextLen) * 1)) +} + +// Waits and reads reply data from request XselinuxGetWindowCreateContext +func (cook XselinuxGetWindowCreateContextCookie) Reply() (*XselinuxGetWindowCreateContextReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xselinuxGetWindowCreateContextReply(buf), nil +} + +// Read reply into structure from buffer for XselinuxGetWindowCreateContext +func xselinuxGetWindowCreateContextReply(buf []byte) *XselinuxGetWindowCreateContextReply { + v := new(XselinuxGetWindowCreateContextReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.ContextLen = Get32(buf[b:]) + b += 4 + + b += 20 // padding + + { + byteString := make([]byte, v.ContextLen) + copy(byteString[:v.ContextLen], buf[b:]) + v.Context = string(byteString) + b += pad(int(v.ContextLen)) + } + + return v +} + +func (cook XselinuxGetWindowCreateContextCookie) Check() error { + return cook.check() +} + +// Write request to wire for XselinuxGetWindowCreateContext +func (c *Conn) xselinuxGetWindowCreateContextRequest() []byte { + size := 4 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SELINUX"] + b += 1 + + buf[b] = 6 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + return buf +} + +// Request XselinuxGetWindowContext +// size: 8 +type XselinuxGetWindowContextCookie struct { + *cookie +} + +func (c *Conn) XselinuxGetWindowContext(Window Id) XselinuxGetWindowContextCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xselinuxGetWindowContextRequest(Window), cookie) + return XselinuxGetWindowContextCookie{cookie} +} + +func (c *Conn) XselinuxGetWindowContextUnchecked(Window Id) XselinuxGetWindowContextCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xselinuxGetWindowContextRequest(Window), cookie) + return XselinuxGetWindowContextCookie{cookie} +} + +// Request reply for XselinuxGetWindowContext +// size: (32 + pad((int(ContextLen) * 1))) +type XselinuxGetWindowContextReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + ContextLen uint32 + // padding: 20 bytes + Context string // size: pad((int(ContextLen) * 1)) +} + +// Waits and reads reply data from request XselinuxGetWindowContext +func (cook XselinuxGetWindowContextCookie) Reply() (*XselinuxGetWindowContextReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xselinuxGetWindowContextReply(buf), nil +} + +// Read reply into structure from buffer for XselinuxGetWindowContext +func xselinuxGetWindowContextReply(buf []byte) *XselinuxGetWindowContextReply { + v := new(XselinuxGetWindowContextReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.ContextLen = Get32(buf[b:]) + b += 4 + + b += 20 // padding + + { + byteString := make([]byte, v.ContextLen) + copy(byteString[:v.ContextLen], buf[b:]) + v.Context = string(byteString) + b += pad(int(v.ContextLen)) + } + + return v +} + +func (cook XselinuxGetWindowContextCookie) Check() error { + return cook.check() +} + +// Write request to wire for XselinuxGetWindowContext +func (c *Conn) xselinuxGetWindowContextRequest(Window Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SELINUX"] + b += 1 + + buf[b] = 7 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Window)) + b += 4 + + return buf +} + +// Request XselinuxSetPropertyCreateContext +// size: pad((8 + pad((int(ContextLen) * 1)))) +type XselinuxSetPropertyCreateContextCookie struct { + *cookie +} + +// Write request to wire for XselinuxSetPropertyCreateContext +func (c *Conn) XselinuxSetPropertyCreateContext(ContextLen uint32, Context string) XselinuxSetPropertyCreateContextCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xselinuxSetPropertyCreateContextRequest(ContextLen, Context), cookie) + return XselinuxSetPropertyCreateContextCookie{cookie} +} + +func (c *Conn) XselinuxSetPropertyCreateContextChecked(ContextLen uint32, Context string) XselinuxSetPropertyCreateContextCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xselinuxSetPropertyCreateContextRequest(ContextLen, Context), cookie) + return XselinuxSetPropertyCreateContextCookie{cookie} +} + +func (cook XselinuxSetPropertyCreateContextCookie) Check() error { + return cook.check() +} + +// Write request to wire for XselinuxSetPropertyCreateContext +func (c *Conn) xselinuxSetPropertyCreateContextRequest(ContextLen uint32, Context string) []byte { + size := pad((8 + pad((int(ContextLen) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SELINUX"] + b += 1 + + buf[b] = 8 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], ContextLen) + b += 4 + + copy(buf[b:], Context[:ContextLen]) + b += pad(int(ContextLen)) + + return buf +} + +// Request XselinuxGetPropertyCreateContext +// size: 4 +type XselinuxGetPropertyCreateContextCookie struct { + *cookie +} + +func (c *Conn) XselinuxGetPropertyCreateContext() XselinuxGetPropertyCreateContextCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xselinuxGetPropertyCreateContextRequest(), cookie) + return XselinuxGetPropertyCreateContextCookie{cookie} +} + +func (c *Conn) XselinuxGetPropertyCreateContextUnchecked() XselinuxGetPropertyCreateContextCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xselinuxGetPropertyCreateContextRequest(), cookie) + return XselinuxGetPropertyCreateContextCookie{cookie} +} + +// Request reply for XselinuxGetPropertyCreateContext +// size: (32 + pad((int(ContextLen) * 1))) +type XselinuxGetPropertyCreateContextReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + ContextLen uint32 + // padding: 20 bytes + Context string // size: pad((int(ContextLen) * 1)) +} + +// Waits and reads reply data from request XselinuxGetPropertyCreateContext +func (cook XselinuxGetPropertyCreateContextCookie) Reply() (*XselinuxGetPropertyCreateContextReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xselinuxGetPropertyCreateContextReply(buf), nil +} + +// Read reply into structure from buffer for XselinuxGetPropertyCreateContext +func xselinuxGetPropertyCreateContextReply(buf []byte) *XselinuxGetPropertyCreateContextReply { + v := new(XselinuxGetPropertyCreateContextReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.ContextLen = Get32(buf[b:]) + b += 4 + + b += 20 // padding + + { + byteString := make([]byte, v.ContextLen) + copy(byteString[:v.ContextLen], buf[b:]) + v.Context = string(byteString) + b += pad(int(v.ContextLen)) + } + + return v +} + +func (cook XselinuxGetPropertyCreateContextCookie) Check() error { + return cook.check() +} + +// Write request to wire for XselinuxGetPropertyCreateContext +func (c *Conn) xselinuxGetPropertyCreateContextRequest() []byte { + size := 4 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SELINUX"] + b += 1 + + buf[b] = 9 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + return buf +} + +// Request XselinuxSetPropertyUseContext +// size: pad((8 + pad((int(ContextLen) * 1)))) +type XselinuxSetPropertyUseContextCookie struct { + *cookie +} + +// Write request to wire for XselinuxSetPropertyUseContext +func (c *Conn) XselinuxSetPropertyUseContext(ContextLen uint32, Context string) XselinuxSetPropertyUseContextCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xselinuxSetPropertyUseContextRequest(ContextLen, Context), cookie) + return XselinuxSetPropertyUseContextCookie{cookie} +} + +func (c *Conn) XselinuxSetPropertyUseContextChecked(ContextLen uint32, Context string) XselinuxSetPropertyUseContextCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xselinuxSetPropertyUseContextRequest(ContextLen, Context), cookie) + return XselinuxSetPropertyUseContextCookie{cookie} +} + +func (cook XselinuxSetPropertyUseContextCookie) Check() error { + return cook.check() +} + +// Write request to wire for XselinuxSetPropertyUseContext +func (c *Conn) xselinuxSetPropertyUseContextRequest(ContextLen uint32, Context string) []byte { + size := pad((8 + pad((int(ContextLen) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SELINUX"] + b += 1 + + buf[b] = 10 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], ContextLen) + b += 4 + + copy(buf[b:], Context[:ContextLen]) + b += pad(int(ContextLen)) + + return buf +} + +// Request XselinuxGetPropertyUseContext +// size: 4 +type XselinuxGetPropertyUseContextCookie struct { + *cookie +} + +func (c *Conn) XselinuxGetPropertyUseContext() XselinuxGetPropertyUseContextCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xselinuxGetPropertyUseContextRequest(), cookie) + return XselinuxGetPropertyUseContextCookie{cookie} +} + +func (c *Conn) XselinuxGetPropertyUseContextUnchecked() XselinuxGetPropertyUseContextCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xselinuxGetPropertyUseContextRequest(), cookie) + return XselinuxGetPropertyUseContextCookie{cookie} +} + +// Request reply for XselinuxGetPropertyUseContext +// size: (32 + pad((int(ContextLen) * 1))) +type XselinuxGetPropertyUseContextReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + ContextLen uint32 + // padding: 20 bytes + Context string // size: pad((int(ContextLen) * 1)) +} + +// Waits and reads reply data from request XselinuxGetPropertyUseContext +func (cook XselinuxGetPropertyUseContextCookie) Reply() (*XselinuxGetPropertyUseContextReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xselinuxGetPropertyUseContextReply(buf), nil +} + +// Read reply into structure from buffer for XselinuxGetPropertyUseContext +func xselinuxGetPropertyUseContextReply(buf []byte) *XselinuxGetPropertyUseContextReply { + v := new(XselinuxGetPropertyUseContextReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.ContextLen = Get32(buf[b:]) + b += 4 + + b += 20 // padding + + { + byteString := make([]byte, v.ContextLen) + copy(byteString[:v.ContextLen], buf[b:]) + v.Context = string(byteString) + b += pad(int(v.ContextLen)) + } + + return v +} + +func (cook XselinuxGetPropertyUseContextCookie) Check() error { + return cook.check() +} + +// Write request to wire for XselinuxGetPropertyUseContext +func (c *Conn) xselinuxGetPropertyUseContextRequest() []byte { + size := 4 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SELINUX"] + b += 1 + + buf[b] = 11 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + return buf +} + +// Request XselinuxGetPropertyContext +// size: 12 +type XselinuxGetPropertyContextCookie struct { + *cookie +} + +func (c *Conn) XselinuxGetPropertyContext(Window Id, Property Id) XselinuxGetPropertyContextCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xselinuxGetPropertyContextRequest(Window, Property), cookie) + return XselinuxGetPropertyContextCookie{cookie} +} + +func (c *Conn) XselinuxGetPropertyContextUnchecked(Window Id, Property Id) XselinuxGetPropertyContextCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xselinuxGetPropertyContextRequest(Window, Property), cookie) + return XselinuxGetPropertyContextCookie{cookie} +} + +// Request reply for XselinuxGetPropertyContext +// size: (32 + pad((int(ContextLen) * 1))) +type XselinuxGetPropertyContextReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + ContextLen uint32 + // padding: 20 bytes + Context string // size: pad((int(ContextLen) * 1)) +} + +// Waits and reads reply data from request XselinuxGetPropertyContext +func (cook XselinuxGetPropertyContextCookie) Reply() (*XselinuxGetPropertyContextReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xselinuxGetPropertyContextReply(buf), nil +} + +// Read reply into structure from buffer for XselinuxGetPropertyContext +func xselinuxGetPropertyContextReply(buf []byte) *XselinuxGetPropertyContextReply { + v := new(XselinuxGetPropertyContextReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.ContextLen = Get32(buf[b:]) + b += 4 + + b += 20 // padding + + { + byteString := make([]byte, v.ContextLen) + copy(byteString[:v.ContextLen], buf[b:]) + v.Context = string(byteString) + b += pad(int(v.ContextLen)) + } + + return v +} + +func (cook XselinuxGetPropertyContextCookie) Check() error { + return cook.check() +} + +// Write request to wire for XselinuxGetPropertyContext +func (c *Conn) xselinuxGetPropertyContextRequest(Window Id, Property Id) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SELINUX"] + b += 1 + + buf[b] = 12 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Window)) + b += 4 + + Put32(buf[b:], uint32(Property)) + b += 4 + + return buf +} + +// Request XselinuxGetPropertyDataContext +// size: 12 +type XselinuxGetPropertyDataContextCookie struct { + *cookie +} + +func (c *Conn) XselinuxGetPropertyDataContext(Window Id, Property Id) XselinuxGetPropertyDataContextCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xselinuxGetPropertyDataContextRequest(Window, Property), cookie) + return XselinuxGetPropertyDataContextCookie{cookie} +} + +func (c *Conn) XselinuxGetPropertyDataContextUnchecked(Window Id, Property Id) XselinuxGetPropertyDataContextCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xselinuxGetPropertyDataContextRequest(Window, Property), cookie) + return XselinuxGetPropertyDataContextCookie{cookie} +} + +// Request reply for XselinuxGetPropertyDataContext +// size: (32 + pad((int(ContextLen) * 1))) +type XselinuxGetPropertyDataContextReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + ContextLen uint32 + // padding: 20 bytes + Context string // size: pad((int(ContextLen) * 1)) +} + +// Waits and reads reply data from request XselinuxGetPropertyDataContext +func (cook XselinuxGetPropertyDataContextCookie) Reply() (*XselinuxGetPropertyDataContextReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xselinuxGetPropertyDataContextReply(buf), nil +} + +// Read reply into structure from buffer for XselinuxGetPropertyDataContext +func xselinuxGetPropertyDataContextReply(buf []byte) *XselinuxGetPropertyDataContextReply { + v := new(XselinuxGetPropertyDataContextReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.ContextLen = Get32(buf[b:]) + b += 4 + + b += 20 // padding + + { + byteString := make([]byte, v.ContextLen) + copy(byteString[:v.ContextLen], buf[b:]) + v.Context = string(byteString) + b += pad(int(v.ContextLen)) + } + + return v +} + +func (cook XselinuxGetPropertyDataContextCookie) Check() error { + return cook.check() +} + +// Write request to wire for XselinuxGetPropertyDataContext +func (c *Conn) xselinuxGetPropertyDataContextRequest(Window Id, Property Id) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SELINUX"] + b += 1 + + buf[b] = 13 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Window)) + b += 4 + + Put32(buf[b:], uint32(Property)) + b += 4 + + return buf +} + +// Request XselinuxListProperties +// size: 8 +type XselinuxListPropertiesCookie struct { + *cookie +} + +func (c *Conn) XselinuxListProperties(Window Id) XselinuxListPropertiesCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xselinuxListPropertiesRequest(Window), cookie) + return XselinuxListPropertiesCookie{cookie} +} + +func (c *Conn) XselinuxListPropertiesUnchecked(Window Id) XselinuxListPropertiesCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xselinuxListPropertiesRequest(Window), cookie) + return XselinuxListPropertiesCookie{cookie} +} + +// Request reply for XselinuxListProperties +// size: (32 + XselinuxListItemListSize(Properties)) +type XselinuxListPropertiesReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + PropertiesLen uint32 + // padding: 20 bytes + Properties []XselinuxListItem // size: XselinuxListItemListSize(Properties) +} + +// Waits and reads reply data from request XselinuxListProperties +func (cook XselinuxListPropertiesCookie) Reply() (*XselinuxListPropertiesReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xselinuxListPropertiesReply(buf), nil +} + +// Read reply into structure from buffer for XselinuxListProperties +func xselinuxListPropertiesReply(buf []byte) *XselinuxListPropertiesReply { + v := new(XselinuxListPropertiesReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.PropertiesLen = Get32(buf[b:]) + b += 4 + + b += 20 // padding + + v.Properties = make([]XselinuxListItem, v.PropertiesLen) + b += ReadXselinuxListItemList(buf[b:], v.Properties) + + return v +} + +func (cook XselinuxListPropertiesCookie) Check() error { + return cook.check() +} + +// Write request to wire for XselinuxListProperties +func (c *Conn) xselinuxListPropertiesRequest(Window Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SELINUX"] + b += 1 + + buf[b] = 14 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Window)) + b += 4 + + return buf +} + +// Request XselinuxSetSelectionCreateContext +// size: pad((8 + pad((int(ContextLen) * 1)))) +type XselinuxSetSelectionCreateContextCookie struct { + *cookie +} + +// Write request to wire for XselinuxSetSelectionCreateContext +func (c *Conn) XselinuxSetSelectionCreateContext(ContextLen uint32, Context string) XselinuxSetSelectionCreateContextCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xselinuxSetSelectionCreateContextRequest(ContextLen, Context), cookie) + return XselinuxSetSelectionCreateContextCookie{cookie} +} + +func (c *Conn) XselinuxSetSelectionCreateContextChecked(ContextLen uint32, Context string) XselinuxSetSelectionCreateContextCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xselinuxSetSelectionCreateContextRequest(ContextLen, Context), cookie) + return XselinuxSetSelectionCreateContextCookie{cookie} +} + +func (cook XselinuxSetSelectionCreateContextCookie) Check() error { + return cook.check() +} + +// Write request to wire for XselinuxSetSelectionCreateContext +func (c *Conn) xselinuxSetSelectionCreateContextRequest(ContextLen uint32, Context string) []byte { + size := pad((8 + pad((int(ContextLen) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SELINUX"] + b += 1 + + buf[b] = 15 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], ContextLen) + b += 4 + + copy(buf[b:], Context[:ContextLen]) + b += pad(int(ContextLen)) + + return buf +} + +// Request XselinuxGetSelectionCreateContext +// size: 4 +type XselinuxGetSelectionCreateContextCookie struct { + *cookie +} + +func (c *Conn) XselinuxGetSelectionCreateContext() XselinuxGetSelectionCreateContextCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xselinuxGetSelectionCreateContextRequest(), cookie) + return XselinuxGetSelectionCreateContextCookie{cookie} +} + +func (c *Conn) XselinuxGetSelectionCreateContextUnchecked() XselinuxGetSelectionCreateContextCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xselinuxGetSelectionCreateContextRequest(), cookie) + return XselinuxGetSelectionCreateContextCookie{cookie} +} + +// Request reply for XselinuxGetSelectionCreateContext +// size: (32 + pad((int(ContextLen) * 1))) +type XselinuxGetSelectionCreateContextReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + ContextLen uint32 + // padding: 20 bytes + Context string // size: pad((int(ContextLen) * 1)) +} + +// Waits and reads reply data from request XselinuxGetSelectionCreateContext +func (cook XselinuxGetSelectionCreateContextCookie) Reply() (*XselinuxGetSelectionCreateContextReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xselinuxGetSelectionCreateContextReply(buf), nil +} + +// Read reply into structure from buffer for XselinuxGetSelectionCreateContext +func xselinuxGetSelectionCreateContextReply(buf []byte) *XselinuxGetSelectionCreateContextReply { + v := new(XselinuxGetSelectionCreateContextReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.ContextLen = Get32(buf[b:]) + b += 4 + + b += 20 // padding + + { + byteString := make([]byte, v.ContextLen) + copy(byteString[:v.ContextLen], buf[b:]) + v.Context = string(byteString) + b += pad(int(v.ContextLen)) + } + + return v +} + +func (cook XselinuxGetSelectionCreateContextCookie) Check() error { + return cook.check() +} + +// Write request to wire for XselinuxGetSelectionCreateContext +func (c *Conn) xselinuxGetSelectionCreateContextRequest() []byte { + size := 4 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SELINUX"] + b += 1 + + buf[b] = 16 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + return buf +} + +// Request XselinuxSetSelectionUseContext +// size: pad((8 + pad((int(ContextLen) * 1)))) +type XselinuxSetSelectionUseContextCookie struct { + *cookie +} + +// Write request to wire for XselinuxSetSelectionUseContext +func (c *Conn) XselinuxSetSelectionUseContext(ContextLen uint32, Context string) XselinuxSetSelectionUseContextCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xselinuxSetSelectionUseContextRequest(ContextLen, Context), cookie) + return XselinuxSetSelectionUseContextCookie{cookie} +} + +func (c *Conn) XselinuxSetSelectionUseContextChecked(ContextLen uint32, Context string) XselinuxSetSelectionUseContextCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xselinuxSetSelectionUseContextRequest(ContextLen, Context), cookie) + return XselinuxSetSelectionUseContextCookie{cookie} +} + +func (cook XselinuxSetSelectionUseContextCookie) Check() error { + return cook.check() +} + +// Write request to wire for XselinuxSetSelectionUseContext +func (c *Conn) xselinuxSetSelectionUseContextRequest(ContextLen uint32, Context string) []byte { + size := pad((8 + pad((int(ContextLen) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SELINUX"] + b += 1 + + buf[b] = 17 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], ContextLen) + b += 4 + + copy(buf[b:], Context[:ContextLen]) + b += pad(int(ContextLen)) + + return buf +} + +// Request XselinuxGetSelectionUseContext +// size: 4 +type XselinuxGetSelectionUseContextCookie struct { + *cookie +} + +func (c *Conn) XselinuxGetSelectionUseContext() XselinuxGetSelectionUseContextCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xselinuxGetSelectionUseContextRequest(), cookie) + return XselinuxGetSelectionUseContextCookie{cookie} +} + +func (c *Conn) XselinuxGetSelectionUseContextUnchecked() XselinuxGetSelectionUseContextCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xselinuxGetSelectionUseContextRequest(), cookie) + return XselinuxGetSelectionUseContextCookie{cookie} +} + +// Request reply for XselinuxGetSelectionUseContext +// size: (32 + pad((int(ContextLen) * 1))) +type XselinuxGetSelectionUseContextReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + ContextLen uint32 + // padding: 20 bytes + Context string // size: pad((int(ContextLen) * 1)) +} + +// Waits and reads reply data from request XselinuxGetSelectionUseContext +func (cook XselinuxGetSelectionUseContextCookie) Reply() (*XselinuxGetSelectionUseContextReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xselinuxGetSelectionUseContextReply(buf), nil +} + +// Read reply into structure from buffer for XselinuxGetSelectionUseContext +func xselinuxGetSelectionUseContextReply(buf []byte) *XselinuxGetSelectionUseContextReply { + v := new(XselinuxGetSelectionUseContextReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.ContextLen = Get32(buf[b:]) + b += 4 + + b += 20 // padding + + { + byteString := make([]byte, v.ContextLen) + copy(byteString[:v.ContextLen], buf[b:]) + v.Context = string(byteString) + b += pad(int(v.ContextLen)) + } + + return v +} + +func (cook XselinuxGetSelectionUseContextCookie) Check() error { + return cook.check() +} + +// Write request to wire for XselinuxGetSelectionUseContext +func (c *Conn) xselinuxGetSelectionUseContextRequest() []byte { + size := 4 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SELINUX"] + b += 1 + + buf[b] = 18 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + return buf +} + +// Request XselinuxGetSelectionContext +// size: 8 +type XselinuxGetSelectionContextCookie struct { + *cookie +} + +func (c *Conn) XselinuxGetSelectionContext(Selection Id) XselinuxGetSelectionContextCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xselinuxGetSelectionContextRequest(Selection), cookie) + return XselinuxGetSelectionContextCookie{cookie} +} + +func (c *Conn) XselinuxGetSelectionContextUnchecked(Selection Id) XselinuxGetSelectionContextCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xselinuxGetSelectionContextRequest(Selection), cookie) + return XselinuxGetSelectionContextCookie{cookie} +} + +// Request reply for XselinuxGetSelectionContext +// size: (32 + pad((int(ContextLen) * 1))) +type XselinuxGetSelectionContextReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + ContextLen uint32 + // padding: 20 bytes + Context string // size: pad((int(ContextLen) * 1)) +} + +// Waits and reads reply data from request XselinuxGetSelectionContext +func (cook XselinuxGetSelectionContextCookie) Reply() (*XselinuxGetSelectionContextReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xselinuxGetSelectionContextReply(buf), nil +} + +// Read reply into structure from buffer for XselinuxGetSelectionContext +func xselinuxGetSelectionContextReply(buf []byte) *XselinuxGetSelectionContextReply { + v := new(XselinuxGetSelectionContextReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.ContextLen = Get32(buf[b:]) + b += 4 + + b += 20 // padding + + { + byteString := make([]byte, v.ContextLen) + copy(byteString[:v.ContextLen], buf[b:]) + v.Context = string(byteString) + b += pad(int(v.ContextLen)) + } + + return v +} + +func (cook XselinuxGetSelectionContextCookie) Check() error { + return cook.check() +} + +// Write request to wire for XselinuxGetSelectionContext +func (c *Conn) xselinuxGetSelectionContextRequest(Selection Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SELINUX"] + b += 1 + + buf[b] = 19 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Selection)) + b += 4 + + return buf +} + +// Request XselinuxGetSelectionDataContext +// size: 8 +type XselinuxGetSelectionDataContextCookie struct { + *cookie +} + +func (c *Conn) XselinuxGetSelectionDataContext(Selection Id) XselinuxGetSelectionDataContextCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xselinuxGetSelectionDataContextRequest(Selection), cookie) + return XselinuxGetSelectionDataContextCookie{cookie} +} + +func (c *Conn) XselinuxGetSelectionDataContextUnchecked(Selection Id) XselinuxGetSelectionDataContextCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xselinuxGetSelectionDataContextRequest(Selection), cookie) + return XselinuxGetSelectionDataContextCookie{cookie} +} + +// Request reply for XselinuxGetSelectionDataContext +// size: (32 + pad((int(ContextLen) * 1))) +type XselinuxGetSelectionDataContextReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + ContextLen uint32 + // padding: 20 bytes + Context string // size: pad((int(ContextLen) * 1)) +} + +// Waits and reads reply data from request XselinuxGetSelectionDataContext +func (cook XselinuxGetSelectionDataContextCookie) Reply() (*XselinuxGetSelectionDataContextReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xselinuxGetSelectionDataContextReply(buf), nil +} + +// Read reply into structure from buffer for XselinuxGetSelectionDataContext +func xselinuxGetSelectionDataContextReply(buf []byte) *XselinuxGetSelectionDataContextReply { + v := new(XselinuxGetSelectionDataContextReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.ContextLen = Get32(buf[b:]) + b += 4 + + b += 20 // padding + + { + byteString := make([]byte, v.ContextLen) + copy(byteString[:v.ContextLen], buf[b:]) + v.Context = string(byteString) + b += pad(int(v.ContextLen)) + } + + return v +} + +func (cook XselinuxGetSelectionDataContextCookie) Check() error { + return cook.check() +} + +// Write request to wire for XselinuxGetSelectionDataContext +func (c *Conn) xselinuxGetSelectionDataContextRequest(Selection Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SELINUX"] + b += 1 + + buf[b] = 20 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Selection)) + b += 4 + + return buf +} + +// Request XselinuxListSelections +// size: 4 +type XselinuxListSelectionsCookie struct { + *cookie +} + +func (c *Conn) XselinuxListSelections() XselinuxListSelectionsCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xselinuxListSelectionsRequest(), cookie) + return XselinuxListSelectionsCookie{cookie} +} + +func (c *Conn) XselinuxListSelectionsUnchecked() XselinuxListSelectionsCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xselinuxListSelectionsRequest(), cookie) + return XselinuxListSelectionsCookie{cookie} +} + +// Request reply for XselinuxListSelections +// size: (32 + XselinuxListItemListSize(Selections)) +type XselinuxListSelectionsReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + SelectionsLen uint32 + // padding: 20 bytes + Selections []XselinuxListItem // size: XselinuxListItemListSize(Selections) +} + +// Waits and reads reply data from request XselinuxListSelections +func (cook XselinuxListSelectionsCookie) Reply() (*XselinuxListSelectionsReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xselinuxListSelectionsReply(buf), nil +} + +// Read reply into structure from buffer for XselinuxListSelections +func xselinuxListSelectionsReply(buf []byte) *XselinuxListSelectionsReply { + v := new(XselinuxListSelectionsReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.SelectionsLen = Get32(buf[b:]) + b += 4 + + b += 20 // padding + + v.Selections = make([]XselinuxListItem, v.SelectionsLen) + b += ReadXselinuxListItemList(buf[b:], v.Selections) + + return v +} + +func (cook XselinuxListSelectionsCookie) Check() error { + return cook.check() +} + +// Write request to wire for XselinuxListSelections +func (c *Conn) xselinuxListSelectionsRequest() []byte { + size := 4 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SELINUX"] + b += 1 + + buf[b] = 21 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + return buf +} + +// Request XselinuxGetClientContext +// size: 8 +type XselinuxGetClientContextCookie struct { + *cookie +} + +func (c *Conn) XselinuxGetClientContext(Resource uint32) XselinuxGetClientContextCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xselinuxGetClientContextRequest(Resource), cookie) + return XselinuxGetClientContextCookie{cookie} +} + +func (c *Conn) XselinuxGetClientContextUnchecked(Resource uint32) XselinuxGetClientContextCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xselinuxGetClientContextRequest(Resource), cookie) + return XselinuxGetClientContextCookie{cookie} +} + +// Request reply for XselinuxGetClientContext +// size: (32 + pad((int(ContextLen) * 1))) +type XselinuxGetClientContextReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + ContextLen uint32 + // padding: 20 bytes + Context string // size: pad((int(ContextLen) * 1)) +} + +// Waits and reads reply data from request XselinuxGetClientContext +func (cook XselinuxGetClientContextCookie) Reply() (*XselinuxGetClientContextReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xselinuxGetClientContextReply(buf), nil +} + +// Read reply into structure from buffer for XselinuxGetClientContext +func xselinuxGetClientContextReply(buf []byte) *XselinuxGetClientContextReply { + v := new(XselinuxGetClientContextReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.ContextLen = Get32(buf[b:]) + b += 4 + + b += 20 // padding + + { + byteString := make([]byte, v.ContextLen) + copy(byteString[:v.ContextLen], buf[b:]) + v.Context = string(byteString) + b += pad(int(v.ContextLen)) + } + + return v +} + +func (cook XselinuxGetClientContextCookie) Check() error { + return cook.check() +} + +// Write request to wire for XselinuxGetClientContext +func (c *Conn) xselinuxGetClientContextRequest(Resource uint32) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["SELINUX"] + b += 1 + + buf[b] = 22 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], Resource) + b += 4 + + return buf +} diff --git a/nexgb/auto_xtest.go b/nexgb/auto_xtest.go new file mode 100644 index 0000000..3c4ce7c --- /dev/null +++ b/nexgb/auto_xtest.go @@ -0,0 +1,335 @@ +package xgb + +/* + This file was generated by xtest.xml on May 6 2012 3:00:45am EDT. + This file is automatically generated. Edit at your peril! +*/ + +// Imports are not necessary for XGB because everything is +// in one package. They are still listed here for reference. +// import "xproto" + +// Skipping definition for base type 'Int32' + +// Skipping definition for base type 'Void' + +// Skipping definition for base type 'Byte' + +// Skipping definition for base type 'Int8' + +// Skipping definition for base type 'Card16' + +// Skipping definition for base type 'Char' + +// Skipping definition for base type 'Card32' + +// Skipping definition for base type 'Double' + +// Skipping definition for base type 'Bool' + +// Skipping definition for base type 'Float' + +// Skipping definition for base type 'Id' + +// Skipping definition for base type 'Card8' + +// Skipping definition for base type 'Int16' + +const ( + XtestCursorNone = 0 + XtestCursorCurrent = 1 +) + +// Request XtestGetVersion +// size: 8 +type XtestGetVersionCookie struct { + *cookie +} + +func (c *Conn) XtestGetVersion(MajorVersion byte, MinorVersion uint16) XtestGetVersionCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xtestGetVersionRequest(MajorVersion, MinorVersion), cookie) + return XtestGetVersionCookie{cookie} +} + +func (c *Conn) XtestGetVersionUnchecked(MajorVersion byte, MinorVersion uint16) XtestGetVersionCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xtestGetVersionRequest(MajorVersion, MinorVersion), cookie) + return XtestGetVersionCookie{cookie} +} + +// Request reply for XtestGetVersion +// size: 10 +type XtestGetVersionReply struct { + Sequence uint16 + Length uint32 + MajorVersion byte + MinorVersion uint16 +} + +// Waits and reads reply data from request XtestGetVersion +func (cook XtestGetVersionCookie) Reply() (*XtestGetVersionReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xtestGetVersionReply(buf), nil +} + +// Read reply into structure from buffer for XtestGetVersion +func xtestGetVersionReply(buf []byte) *XtestGetVersionReply { + v := new(XtestGetVersionReply) + b := 1 // skip reply determinant + + v.MajorVersion = buf[b] + b += 1 + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.MinorVersion = Get16(buf[b:]) + b += 2 + + return v +} + +func (cook XtestGetVersionCookie) Check() error { + return cook.check() +} + +// Write request to wire for XtestGetVersion +func (c *Conn) xtestGetVersionRequest(MajorVersion byte, MinorVersion uint16) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XTEST"] + b += 1 + + buf[b] = 0 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = MajorVersion + b += 1 + + b += 1 // padding + + Put16(buf[b:], MinorVersion) + b += 2 + + return buf +} + +// Request XtestCompareCursor +// size: 12 +type XtestCompareCursorCookie struct { + *cookie +} + +func (c *Conn) XtestCompareCursor(Window Id, Cursor Id) XtestCompareCursorCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xtestCompareCursorRequest(Window, Cursor), cookie) + return XtestCompareCursorCookie{cookie} +} + +func (c *Conn) XtestCompareCursorUnchecked(Window Id, Cursor Id) XtestCompareCursorCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xtestCompareCursorRequest(Window, Cursor), cookie) + return XtestCompareCursorCookie{cookie} +} + +// Request reply for XtestCompareCursor +// size: 8 +type XtestCompareCursorReply struct { + Sequence uint16 + Length uint32 + Same bool +} + +// Waits and reads reply data from request XtestCompareCursor +func (cook XtestCompareCursorCookie) Reply() (*XtestCompareCursorReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xtestCompareCursorReply(buf), nil +} + +// Read reply into structure from buffer for XtestCompareCursor +func xtestCompareCursorReply(buf []byte) *XtestCompareCursorReply { + v := new(XtestCompareCursorReply) + b := 1 // skip reply determinant + + if buf[b] == 1 { + v.Same = true + } else { + v.Same = false + } + b += 1 + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + return v +} + +func (cook XtestCompareCursorCookie) Check() error { + return cook.check() +} + +// Write request to wire for XtestCompareCursor +func (c *Conn) xtestCompareCursorRequest(Window Id, Cursor Id) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XTEST"] + b += 1 + + buf[b] = 1 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Window)) + b += 4 + + Put32(buf[b:], uint32(Cursor)) + b += 4 + + return buf +} + +// Request XtestFakeInput +// size: 36 +type XtestFakeInputCookie struct { + *cookie +} + +// Write request to wire for XtestFakeInput +func (c *Conn) XtestFakeInput(Type byte, Detail byte, Time uint32, Root Id, RootX int16, RootY int16, Deviceid byte) XtestFakeInputCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xtestFakeInputRequest(Type, Detail, Time, Root, RootX, RootY, Deviceid), cookie) + return XtestFakeInputCookie{cookie} +} + +func (c *Conn) XtestFakeInputChecked(Type byte, Detail byte, Time uint32, Root Id, RootX int16, RootY int16, Deviceid byte) XtestFakeInputCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xtestFakeInputRequest(Type, Detail, Time, Root, RootX, RootY, Deviceid), cookie) + return XtestFakeInputCookie{cookie} +} + +func (cook XtestFakeInputCookie) Check() error { + return cook.check() +} + +// Write request to wire for XtestFakeInput +func (c *Conn) xtestFakeInputRequest(Type byte, Detail byte, Time uint32, Root Id, RootX int16, RootY int16, Deviceid byte) []byte { + size := 36 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XTEST"] + b += 1 + + buf[b] = 2 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = Type + b += 1 + + buf[b] = Detail + b += 1 + + b += 2 // padding + + Put32(buf[b:], Time) + b += 4 + + Put32(buf[b:], uint32(Root)) + b += 4 + + b += 8 // padding + + Put16(buf[b:], uint16(RootX)) + b += 2 + + Put16(buf[b:], uint16(RootY)) + b += 2 + + b += 7 // padding + + buf[b] = Deviceid + b += 1 + + return buf +} + +// Request XtestGrabControl +// size: 8 +type XtestGrabControlCookie struct { + *cookie +} + +// Write request to wire for XtestGrabControl +func (c *Conn) XtestGrabControl(Impervious bool) XtestGrabControlCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xtestGrabControlRequest(Impervious), cookie) + return XtestGrabControlCookie{cookie} +} + +func (c *Conn) XtestGrabControlChecked(Impervious bool) XtestGrabControlCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xtestGrabControlRequest(Impervious), cookie) + return XtestGrabControlCookie{cookie} +} + +func (cook XtestGrabControlCookie) Check() error { + return cook.check() +} + +// Write request to wire for XtestGrabControl +func (c *Conn) xtestGrabControlRequest(Impervious bool) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XTEST"] + b += 1 + + buf[b] = 3 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + if Impervious { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + b += 3 // padding + + return buf +} diff --git a/nexgb/auto_xv.go b/nexgb/auto_xv.go new file mode 100644 index 0000000..9e560a0 --- /dev/null +++ b/nexgb/auto_xv.go @@ -0,0 +1,2738 @@ +package xgb + +/* + This file was generated by xv.xml on May 6 2012 3:00:45am EDT. + This file is automatically generated. Edit at your peril! +*/ + +// Imports are not necessary for XGB because everything is +// in one package. They are still listed here for reference. +// import "xproto" +// import "shm" + +// Skipping definition for base type 'Card8' + +// Skipping definition for base type 'Int16' + +// Skipping definition for base type 'Int32' + +// Skipping definition for base type 'Void' + +// Skipping definition for base type 'Byte' + +// Skipping definition for base type 'Int8' + +// Skipping definition for base type 'Card16' + +// Skipping definition for base type 'Char' + +// Skipping definition for base type 'Card32' + +// Skipping definition for base type 'Double' + +// Skipping definition for base type 'Bool' + +// Skipping definition for base type 'Float' + +// Skipping definition for base type 'Id' + +const ( + XvTypeInputMask = 1 + XvTypeOutputMask = 2 + XvTypeVideoMask = 4 + XvTypeStillMask = 8 + XvTypeImageMask = 16 +) + +const ( + XvImageFormatInfoTypeRgb = 0 + XvImageFormatInfoTypeYuv = 1 +) + +const ( + XvImageFormatInfoFormatPacked = 0 + XvImageFormatInfoFormatPlanar = 1 +) + +const ( + XvAttributeFlagGettable = 1 + XvAttributeFlagSettable = 2 +) + +const ( + XvVideoNotifyReasonStarted = 0 + XvVideoNotifyReasonStopped = 1 + XvVideoNotifyReasonBusy = 2 + XvVideoNotifyReasonPreempted = 3 + XvVideoNotifyReasonHardError = 4 +) + +const ( + XvScanlineOrderTopToBottom = 0 + XvScanlineOrderBottomToTop = 1 +) + +const ( + XvGrabPortStatusSuccess = 0 + XvGrabPortStatusBadExtension = 1 + XvGrabPortStatusAlreadyGrabbed = 2 + XvGrabPortStatusInvalidTime = 3 + XvGrabPortStatusBadReply = 4 + XvGrabPortStatusBadAlloc = 5 +) + +// Skipping resource definition of 'Port' + +// Skipping resource definition of 'Encoding' + +// 'XvRational' struct definition +// Size: 8 +type XvRational struct { + Numerator int32 + Denominator int32 +} + +// Struct read XvRational +func ReadXvRational(buf []byte, v *XvRational) int { + b := 0 + + v.Numerator = int32(Get32(buf[b:])) + b += 4 + + v.Denominator = int32(Get32(buf[b:])) + b += 4 + + return b +} + +// Struct list read XvRational +func ReadXvRationalList(buf []byte, dest []XvRational) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XvRational{} + b += ReadXvRational(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XvRational +func (v XvRational) Bytes() []byte { + buf := make([]byte, 8) + b := 0 + + Put32(buf[b:], uint32(v.Numerator)) + b += 4 + + Put32(buf[b:], uint32(v.Denominator)) + b += 4 + + return buf +} + +// Write struct list XvRational +func XvRationalListBytes(buf []byte, list []XvRational) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'XvFormat' struct definition +// Size: 8 +type XvFormat struct { + Visual Visualid + Depth byte + // padding: 3 bytes +} + +// Struct read XvFormat +func ReadXvFormat(buf []byte, v *XvFormat) int { + b := 0 + + v.Visual = Visualid(Get32(buf[b:])) + b += 4 + + v.Depth = buf[b] + b += 1 + + b += 3 // padding + + return b +} + +// Struct list read XvFormat +func ReadXvFormatList(buf []byte, dest []XvFormat) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XvFormat{} + b += ReadXvFormat(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XvFormat +func (v XvFormat) Bytes() []byte { + buf := make([]byte, 8) + b := 0 + + Put32(buf[b:], uint32(v.Visual)) + b += 4 + + buf[b] = v.Depth + b += 1 + + b += 3 // padding + + return buf +} + +// Write struct list XvFormat +func XvFormatListBytes(buf []byte, list []XvFormat) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'XvAdaptorInfo' struct definition +// Size: ((12 + pad((int(NameSize) * 1))) + pad((int(NumFormats) * 8))) +type XvAdaptorInfo struct { + BaseId Id + NameSize uint16 + NumPorts uint16 + NumFormats uint16 + Type byte + // padding: 1 bytes + Name string // size: pad((int(NameSize) * 1)) + Formats []XvFormat // size: pad((int(NumFormats) * 8)) +} + +// Struct read XvAdaptorInfo +func ReadXvAdaptorInfo(buf []byte, v *XvAdaptorInfo) int { + b := 0 + + v.BaseId = Id(Get32(buf[b:])) + b += 4 + + v.NameSize = Get16(buf[b:]) + b += 2 + + v.NumPorts = Get16(buf[b:]) + b += 2 + + v.NumFormats = Get16(buf[b:]) + b += 2 + + v.Type = buf[b] + b += 1 + + b += 1 // padding + + { + byteString := make([]byte, v.NameSize) + copy(byteString[:v.NameSize], buf[b:]) + v.Name = string(byteString) + b += pad(int(v.NameSize)) + } + + v.Formats = make([]XvFormat, v.NumFormats) + b += ReadXvFormatList(buf[b:], v.Formats) + + return b +} + +// Struct list read XvAdaptorInfo +func ReadXvAdaptorInfoList(buf []byte, dest []XvAdaptorInfo) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XvAdaptorInfo{} + b += ReadXvAdaptorInfo(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XvAdaptorInfo +func (v XvAdaptorInfo) Bytes() []byte { + buf := make([]byte, ((12 + pad((int(v.NameSize) * 1))) + pad((int(v.NumFormats) * 8)))) + b := 0 + + Put32(buf[b:], uint32(v.BaseId)) + b += 4 + + Put16(buf[b:], v.NameSize) + b += 2 + + Put16(buf[b:], v.NumPorts) + b += 2 + + Put16(buf[b:], v.NumFormats) + b += 2 + + buf[b] = v.Type + b += 1 + + b += 1 // padding + + copy(buf[b:], v.Name[:v.NameSize]) + b += pad(int(v.NameSize)) + + b += XvFormatListBytes(buf[b:], v.Formats) + + return buf +} + +// Write struct list XvAdaptorInfo +func XvAdaptorInfoListBytes(buf []byte, list []XvAdaptorInfo) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// Struct list size XvAdaptorInfo +func XvAdaptorInfoListSize(list []XvAdaptorInfo) int { + size := 0 + for _, item := range list { + size += ((12 + pad((int(item.NameSize) * 1))) + pad((int(item.NumFormats) * 8))) + } + return size +} + +// 'XvEncodingInfo' struct definition +// Size: (20 + pad((int(NameSize) * 1))) +type XvEncodingInfo struct { + Encoding Id + NameSize uint16 + Width uint16 + Height uint16 + // padding: 2 bytes + Rate XvRational + Name string // size: pad((int(NameSize) * 1)) +} + +// Struct read XvEncodingInfo +func ReadXvEncodingInfo(buf []byte, v *XvEncodingInfo) int { + b := 0 + + v.Encoding = Id(Get32(buf[b:])) + b += 4 + + v.NameSize = Get16(buf[b:]) + b += 2 + + v.Width = Get16(buf[b:]) + b += 2 + + v.Height = Get16(buf[b:]) + b += 2 + + b += 2 // padding + + v.Rate = XvRational{} + b += ReadXvRational(buf[b:], &v.Rate) + + { + byteString := make([]byte, v.NameSize) + copy(byteString[:v.NameSize], buf[b:]) + v.Name = string(byteString) + b += pad(int(v.NameSize)) + } + + return b +} + +// Struct list read XvEncodingInfo +func ReadXvEncodingInfoList(buf []byte, dest []XvEncodingInfo) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XvEncodingInfo{} + b += ReadXvEncodingInfo(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XvEncodingInfo +func (v XvEncodingInfo) Bytes() []byte { + buf := make([]byte, (20 + pad((int(v.NameSize) * 1)))) + b := 0 + + Put32(buf[b:], uint32(v.Encoding)) + b += 4 + + Put16(buf[b:], v.NameSize) + b += 2 + + Put16(buf[b:], v.Width) + b += 2 + + Put16(buf[b:], v.Height) + b += 2 + + b += 2 // padding + + { + structBytes := v.Rate.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + + copy(buf[b:], v.Name[:v.NameSize]) + b += pad(int(v.NameSize)) + + return buf +} + +// Write struct list XvEncodingInfo +func XvEncodingInfoListBytes(buf []byte, list []XvEncodingInfo) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// Struct list size XvEncodingInfo +func XvEncodingInfoListSize(list []XvEncodingInfo) int { + size := 0 + for _, item := range list { + size += (20 + pad((int(item.NameSize) * 1))) + } + return size +} + +// 'XvImage' struct definition +// Size: (((16 + pad((int(NumPlanes) * 4))) + pad((int(NumPlanes) * 4))) + pad((int(DataSize) * 1))) +type XvImage struct { + Id uint32 + Width uint16 + Height uint16 + DataSize uint32 + NumPlanes uint32 + Pitches []uint32 // size: pad((int(NumPlanes) * 4)) + Offsets []uint32 // size: pad((int(NumPlanes) * 4)) + Data []byte // size: pad((int(DataSize) * 1)) +} + +// Struct read XvImage +func ReadXvImage(buf []byte, v *XvImage) int { + b := 0 + + v.Id = Get32(buf[b:]) + b += 4 + + v.Width = Get16(buf[b:]) + b += 2 + + v.Height = Get16(buf[b:]) + b += 2 + + v.DataSize = Get32(buf[b:]) + b += 4 + + v.NumPlanes = Get32(buf[b:]) + b += 4 + + v.Pitches = make([]uint32, v.NumPlanes) + for i := 0; i < int(v.NumPlanes); i++ { + v.Pitches[i] = Get32(buf[b:]) + b += 4 + } + b = pad(b) + + v.Offsets = make([]uint32, v.NumPlanes) + for i := 0; i < int(v.NumPlanes); i++ { + v.Offsets[i] = Get32(buf[b:]) + b += 4 + } + b = pad(b) + + v.Data = make([]byte, v.DataSize) + copy(v.Data[:v.DataSize], buf[b:]) + b += pad(int(v.DataSize)) + + return b +} + +// Struct list read XvImage +func ReadXvImageList(buf []byte, dest []XvImage) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XvImage{} + b += ReadXvImage(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XvImage +func (v XvImage) Bytes() []byte { + buf := make([]byte, (((16 + pad((int(v.NumPlanes) * 4))) + pad((int(v.NumPlanes) * 4))) + pad((int(v.DataSize) * 1)))) + b := 0 + + Put32(buf[b:], v.Id) + b += 4 + + Put16(buf[b:], v.Width) + b += 2 + + Put16(buf[b:], v.Height) + b += 2 + + Put32(buf[b:], v.DataSize) + b += 4 + + Put32(buf[b:], v.NumPlanes) + b += 4 + + for i := 0; i < int(v.NumPlanes); i++ { + Put32(buf[b:], v.Pitches[i]) + b += 4 + } + b = pad(b) + + for i := 0; i < int(v.NumPlanes); i++ { + Put32(buf[b:], v.Offsets[i]) + b += 4 + } + b = pad(b) + + copy(buf[b:], v.Data[:v.DataSize]) + b += pad(int(v.DataSize)) + + return buf +} + +// Write struct list XvImage +func XvImageListBytes(buf []byte, list []XvImage) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// Struct list size XvImage +func XvImageListSize(list []XvImage) int { + size := 0 + for _, item := range list { + size += (((16 + pad((int(item.NumPlanes) * 4))) + pad((int(item.NumPlanes) * 4))) + pad((int(item.DataSize) * 1))) + } + return size +} + +// 'XvAttributeInfo' struct definition +// Size: (16 + pad((int(Size) * 1))) +type XvAttributeInfo struct { + Flags uint32 + Min int32 + Max int32 + Size uint32 + Name string // size: pad((int(Size) * 1)) +} + +// Struct read XvAttributeInfo +func ReadXvAttributeInfo(buf []byte, v *XvAttributeInfo) int { + b := 0 + + v.Flags = Get32(buf[b:]) + b += 4 + + v.Min = int32(Get32(buf[b:])) + b += 4 + + v.Max = int32(Get32(buf[b:])) + b += 4 + + v.Size = Get32(buf[b:]) + b += 4 + + { + byteString := make([]byte, v.Size) + copy(byteString[:v.Size], buf[b:]) + v.Name = string(byteString) + b += pad(int(v.Size)) + } + + return b +} + +// Struct list read XvAttributeInfo +func ReadXvAttributeInfoList(buf []byte, dest []XvAttributeInfo) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XvAttributeInfo{} + b += ReadXvAttributeInfo(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XvAttributeInfo +func (v XvAttributeInfo) Bytes() []byte { + buf := make([]byte, (16 + pad((int(v.Size) * 1)))) + b := 0 + + Put32(buf[b:], v.Flags) + b += 4 + + Put32(buf[b:], uint32(v.Min)) + b += 4 + + Put32(buf[b:], uint32(v.Max)) + b += 4 + + Put32(buf[b:], v.Size) + b += 4 + + copy(buf[b:], v.Name[:v.Size]) + b += pad(int(v.Size)) + + return buf +} + +// Write struct list XvAttributeInfo +func XvAttributeInfoListBytes(buf []byte, list []XvAttributeInfo) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// Struct list size XvAttributeInfo +func XvAttributeInfoListSize(list []XvAttributeInfo) int { + size := 0 + for _, item := range list { + size += (16 + pad((int(item.Size) * 1))) + } + return size +} + +// 'XvImageFormatInfo' struct definition +// Size: 128 +type XvImageFormatInfo struct { + Id uint32 + Type byte + ByteOrder byte + // padding: 2 bytes + Guid []byte // size: 16 + Bpp byte + NumPlanes byte + // padding: 2 bytes + Depth byte + // padding: 3 bytes + RedMask uint32 + GreenMask uint32 + BlueMask uint32 + Format byte + // padding: 3 bytes + YSampleBits uint32 + USampleBits uint32 + VSampleBits uint32 + VhorzYPeriod uint32 + VhorzUPeriod uint32 + VhorzVPeriod uint32 + VvertYPeriod uint32 + VvertUPeriod uint32 + VvertVPeriod uint32 + VcompOrder []byte // size: 32 + VscanlineOrder byte + // padding: 11 bytes +} + +// Struct read XvImageFormatInfo +func ReadXvImageFormatInfo(buf []byte, v *XvImageFormatInfo) int { + b := 0 + + v.Id = Get32(buf[b:]) + b += 4 + + v.Type = buf[b] + b += 1 + + v.ByteOrder = buf[b] + b += 1 + + b += 2 // padding + + v.Guid = make([]byte, 16) + copy(v.Guid[:16], buf[b:]) + b += pad(int(16)) + + v.Bpp = buf[b] + b += 1 + + v.NumPlanes = buf[b] + b += 1 + + b += 2 // padding + + v.Depth = buf[b] + b += 1 + + b += 3 // padding + + v.RedMask = Get32(buf[b:]) + b += 4 + + v.GreenMask = Get32(buf[b:]) + b += 4 + + v.BlueMask = Get32(buf[b:]) + b += 4 + + v.Format = buf[b] + b += 1 + + b += 3 // padding + + v.YSampleBits = Get32(buf[b:]) + b += 4 + + v.USampleBits = Get32(buf[b:]) + b += 4 + + v.VSampleBits = Get32(buf[b:]) + b += 4 + + v.VhorzYPeriod = Get32(buf[b:]) + b += 4 + + v.VhorzUPeriod = Get32(buf[b:]) + b += 4 + + v.VhorzVPeriod = Get32(buf[b:]) + b += 4 + + v.VvertYPeriod = Get32(buf[b:]) + b += 4 + + v.VvertUPeriod = Get32(buf[b:]) + b += 4 + + v.VvertVPeriod = Get32(buf[b:]) + b += 4 + + v.VcompOrder = make([]byte, 32) + copy(v.VcompOrder[:32], buf[b:]) + b += pad(int(32)) + + v.VscanlineOrder = buf[b] + b += 1 + + b += 11 // padding + + return b +} + +// Struct list read XvImageFormatInfo +func ReadXvImageFormatInfoList(buf []byte, dest []XvImageFormatInfo) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XvImageFormatInfo{} + b += ReadXvImageFormatInfo(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XvImageFormatInfo +func (v XvImageFormatInfo) Bytes() []byte { + buf := make([]byte, 128) + b := 0 + + Put32(buf[b:], v.Id) + b += 4 + + buf[b] = v.Type + b += 1 + + buf[b] = v.ByteOrder + b += 1 + + b += 2 // padding + + copy(buf[b:], v.Guid[:16]) + b += pad(int(16)) + + buf[b] = v.Bpp + b += 1 + + buf[b] = v.NumPlanes + b += 1 + + b += 2 // padding + + buf[b] = v.Depth + b += 1 + + b += 3 // padding + + Put32(buf[b:], v.RedMask) + b += 4 + + Put32(buf[b:], v.GreenMask) + b += 4 + + Put32(buf[b:], v.BlueMask) + b += 4 + + buf[b] = v.Format + b += 1 + + b += 3 // padding + + Put32(buf[b:], v.YSampleBits) + b += 4 + + Put32(buf[b:], v.USampleBits) + b += 4 + + Put32(buf[b:], v.VSampleBits) + b += 4 + + Put32(buf[b:], v.VhorzYPeriod) + b += 4 + + Put32(buf[b:], v.VhorzUPeriod) + b += 4 + + Put32(buf[b:], v.VhorzVPeriod) + b += 4 + + Put32(buf[b:], v.VvertYPeriod) + b += 4 + + Put32(buf[b:], v.VvertUPeriod) + b += 4 + + Put32(buf[b:], v.VvertVPeriod) + b += 4 + + copy(buf[b:], v.VcompOrder[:32]) + b += pad(int(32)) + + buf[b] = v.VscanlineOrder + b += 1 + + b += 11 // padding + + return buf +} + +// Write struct list XvImageFormatInfo +func XvImageFormatInfoListBytes(buf []byte, list []XvImageFormatInfo) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// Struct list size XvImageFormatInfo +func XvImageFormatInfoListSize(list []XvImageFormatInfo) int { + size := 0 + for _ = range list { + size += 128 + } + return size +} + +// Event definition XvVideoNotify (0) +// Size: 32 + +const XvVideoNotify = 0 + +type XvVideoNotifyEvent struct { + Sequence uint16 + Reason byte + Time Timestamp + Drawable Id + Port Id +} + +// Event read XvVideoNotify +func NewXvVideoNotifyEvent(buf []byte) Event { + v := XvVideoNotifyEvent{} + b := 1 // don't read event number + + v.Reason = buf[b] + b += 1 + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Time = Timestamp(Get32(buf[b:])) + b += 4 + + v.Drawable = Id(Get32(buf[b:])) + b += 4 + + v.Port = Id(Get32(buf[b:])) + b += 4 + + return v +} + +// Event write XvVideoNotify +func (v XvVideoNotifyEvent) Bytes() []byte { + buf := make([]byte, 32) + b := 0 + + // write event number + buf[b] = 0 + b += 1 + + buf[b] = v.Reason + b += 1 + + b += 2 // skip sequence number + + Put32(buf[b:], uint32(v.Time)) + b += 4 + + Put32(buf[b:], uint32(v.Drawable)) + b += 4 + + Put32(buf[b:], uint32(v.Port)) + b += 4 + + return buf +} + +func (v XvVideoNotifyEvent) ImplementsEvent() {} + +func (v XvVideoNotifyEvent) SequenceId() uint16 { + return v.Sequence +} + +func (v XvVideoNotifyEvent) String() string { + fieldVals := make([]string, 0, 4) + fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) + fieldVals = append(fieldVals, sprintf("Reason: %d", v.Reason)) + fieldVals = append(fieldVals, sprintf("Time: %d", v.Time)) + fieldVals = append(fieldVals, sprintf("Drawable: %d", v.Drawable)) + fieldVals = append(fieldVals, sprintf("Port: %d", v.Port)) + return "XvVideoNotify {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newEventFuncs[0] = NewXvVideoNotifyEvent +} + +// Event definition XvPortNotify (1) +// Size: 32 + +const XvPortNotify = 1 + +type XvPortNotifyEvent struct { + Sequence uint16 + // padding: 1 bytes + Time Timestamp + Port Id + Attribute Id + Value int32 +} + +// Event read XvPortNotify +func NewXvPortNotifyEvent(buf []byte) Event { + v := XvPortNotifyEvent{} + b := 1 // don't read event number + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Time = Timestamp(Get32(buf[b:])) + b += 4 + + v.Port = Id(Get32(buf[b:])) + b += 4 + + v.Attribute = Id(Get32(buf[b:])) + b += 4 + + v.Value = int32(Get32(buf[b:])) + b += 4 + + return v +} + +// Event write XvPortNotify +func (v XvPortNotifyEvent) Bytes() []byte { + buf := make([]byte, 32) + b := 0 + + // write event number + buf[b] = 1 + b += 1 + + b += 1 // padding + + b += 2 // skip sequence number + + Put32(buf[b:], uint32(v.Time)) + b += 4 + + Put32(buf[b:], uint32(v.Port)) + b += 4 + + Put32(buf[b:], uint32(v.Attribute)) + b += 4 + + Put32(buf[b:], uint32(v.Value)) + b += 4 + + return buf +} + +func (v XvPortNotifyEvent) ImplementsEvent() {} + +func (v XvPortNotifyEvent) SequenceId() uint16 { + return v.Sequence +} + +func (v XvPortNotifyEvent) String() string { + fieldVals := make([]string, 0, 5) + fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) + fieldVals = append(fieldVals, sprintf("Time: %d", v.Time)) + fieldVals = append(fieldVals, sprintf("Port: %d", v.Port)) + fieldVals = append(fieldVals, sprintf("Attribute: %d", v.Attribute)) + fieldVals = append(fieldVals, sprintf("Value: %d", v.Value)) + return "XvPortNotify {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newEventFuncs[1] = NewXvPortNotifyEvent +} + +// Error definition XvBadPort (0) +// Size: 32 + +const BadXvBadPort = 0 + +type XvBadPortError struct { + Sequence uint16 + NiceName string +} + +// Error read XvBadPort +func NewXvBadPortError(buf []byte) Error { + v := XvBadPortError{} + v.NiceName = "XvBadPort" + + b := 1 // skip error determinant + b += 1 // don't read error number + + v.Sequence = Get16(buf[b:]) + b += 2 + + return v +} + +func (err XvBadPortError) ImplementsError() {} + +func (err XvBadPortError) SequenceId() uint16 { + return err.Sequence +} + +func (err XvBadPortError) BadId() Id { + return 0 +} + +func (err XvBadPortError) Error() string { + fieldVals := make([]string, 0, 0) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) + return "BadXvBadPort {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newErrorFuncs[0] = NewXvBadPortError +} + +// Error definition XvBadEncoding (1) +// Size: 32 + +const BadXvBadEncoding = 1 + +type XvBadEncodingError struct { + Sequence uint16 + NiceName string +} + +// Error read XvBadEncoding +func NewXvBadEncodingError(buf []byte) Error { + v := XvBadEncodingError{} + v.NiceName = "XvBadEncoding" + + b := 1 // skip error determinant + b += 1 // don't read error number + + v.Sequence = Get16(buf[b:]) + b += 2 + + return v +} + +func (err XvBadEncodingError) ImplementsError() {} + +func (err XvBadEncodingError) SequenceId() uint16 { + return err.Sequence +} + +func (err XvBadEncodingError) BadId() Id { + return 0 +} + +func (err XvBadEncodingError) Error() string { + fieldVals := make([]string, 0, 0) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) + return "BadXvBadEncoding {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newErrorFuncs[1] = NewXvBadEncodingError +} + +// Error definition XvBadControl (2) +// Size: 32 + +const BadXvBadControl = 2 + +type XvBadControlError struct { + Sequence uint16 + NiceName string +} + +// Error read XvBadControl +func NewXvBadControlError(buf []byte) Error { + v := XvBadControlError{} + v.NiceName = "XvBadControl" + + b := 1 // skip error determinant + b += 1 // don't read error number + + v.Sequence = Get16(buf[b:]) + b += 2 + + return v +} + +func (err XvBadControlError) ImplementsError() {} + +func (err XvBadControlError) SequenceId() uint16 { + return err.Sequence +} + +func (err XvBadControlError) BadId() Id { + return 0 +} + +func (err XvBadControlError) Error() string { + fieldVals := make([]string, 0, 0) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) + return "BadXvBadControl {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newErrorFuncs[2] = NewXvBadControlError +} + +// Request XvQueryExtension +// size: 4 +type XvQueryExtensionCookie struct { + *cookie +} + +func (c *Conn) XvQueryExtension() XvQueryExtensionCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xvQueryExtensionRequest(), cookie) + return XvQueryExtensionCookie{cookie} +} + +func (c *Conn) XvQueryExtensionUnchecked() XvQueryExtensionCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xvQueryExtensionRequest(), cookie) + return XvQueryExtensionCookie{cookie} +} + +// Request reply for XvQueryExtension +// size: 12 +type XvQueryExtensionReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Major uint16 + Minor uint16 +} + +// Waits and reads reply data from request XvQueryExtension +func (cook XvQueryExtensionCookie) Reply() (*XvQueryExtensionReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xvQueryExtensionReply(buf), nil +} + +// Read reply into structure from buffer for XvQueryExtension +func xvQueryExtensionReply(buf []byte) *XvQueryExtensionReply { + v := new(XvQueryExtensionReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.Major = Get16(buf[b:]) + b += 2 + + v.Minor = Get16(buf[b:]) + b += 2 + + return v +} + +func (cook XvQueryExtensionCookie) Check() error { + return cook.check() +} + +// Write request to wire for XvQueryExtension +func (c *Conn) xvQueryExtensionRequest() []byte { + size := 4 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XVIDEO"] + b += 1 + + buf[b] = 0 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + return buf +} + +// Request XvQueryAdaptors +// size: 8 +type XvQueryAdaptorsCookie struct { + *cookie +} + +func (c *Conn) XvQueryAdaptors(Window Id) XvQueryAdaptorsCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xvQueryAdaptorsRequest(Window), cookie) + return XvQueryAdaptorsCookie{cookie} +} + +func (c *Conn) XvQueryAdaptorsUnchecked(Window Id) XvQueryAdaptorsCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xvQueryAdaptorsRequest(Window), cookie) + return XvQueryAdaptorsCookie{cookie} +} + +// Request reply for XvQueryAdaptors +// size: (32 + XvAdaptorInfoListSize(Info)) +type XvQueryAdaptorsReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + NumAdaptors uint16 + // padding: 22 bytes + Info []XvAdaptorInfo // size: XvAdaptorInfoListSize(Info) +} + +// Waits and reads reply data from request XvQueryAdaptors +func (cook XvQueryAdaptorsCookie) Reply() (*XvQueryAdaptorsReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xvQueryAdaptorsReply(buf), nil +} + +// Read reply into structure from buffer for XvQueryAdaptors +func xvQueryAdaptorsReply(buf []byte) *XvQueryAdaptorsReply { + v := new(XvQueryAdaptorsReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.NumAdaptors = Get16(buf[b:]) + b += 2 + + b += 22 // padding + + v.Info = make([]XvAdaptorInfo, v.NumAdaptors) + b += ReadXvAdaptorInfoList(buf[b:], v.Info) + + return v +} + +func (cook XvQueryAdaptorsCookie) Check() error { + return cook.check() +} + +// Write request to wire for XvQueryAdaptors +func (c *Conn) xvQueryAdaptorsRequest(Window Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XVIDEO"] + b += 1 + + buf[b] = 1 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Window)) + b += 4 + + return buf +} + +// Request XvQueryEncodings +// size: 8 +type XvQueryEncodingsCookie struct { + *cookie +} + +func (c *Conn) XvQueryEncodings(Port Id) XvQueryEncodingsCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xvQueryEncodingsRequest(Port), cookie) + return XvQueryEncodingsCookie{cookie} +} + +func (c *Conn) XvQueryEncodingsUnchecked(Port Id) XvQueryEncodingsCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xvQueryEncodingsRequest(Port), cookie) + return XvQueryEncodingsCookie{cookie} +} + +// Request reply for XvQueryEncodings +// size: (32 + XvEncodingInfoListSize(Info)) +type XvQueryEncodingsReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + NumEncodings uint16 + // padding: 22 bytes + Info []XvEncodingInfo // size: XvEncodingInfoListSize(Info) +} + +// Waits and reads reply data from request XvQueryEncodings +func (cook XvQueryEncodingsCookie) Reply() (*XvQueryEncodingsReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xvQueryEncodingsReply(buf), nil +} + +// Read reply into structure from buffer for XvQueryEncodings +func xvQueryEncodingsReply(buf []byte) *XvQueryEncodingsReply { + v := new(XvQueryEncodingsReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.NumEncodings = Get16(buf[b:]) + b += 2 + + b += 22 // padding + + v.Info = make([]XvEncodingInfo, v.NumEncodings) + b += ReadXvEncodingInfoList(buf[b:], v.Info) + + return v +} + +func (cook XvQueryEncodingsCookie) Check() error { + return cook.check() +} + +// Write request to wire for XvQueryEncodings +func (c *Conn) xvQueryEncodingsRequest(Port Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XVIDEO"] + b += 1 + + buf[b] = 2 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Port)) + b += 4 + + return buf +} + +// Request XvGrabPort +// size: 12 +type XvGrabPortCookie struct { + *cookie +} + +func (c *Conn) XvGrabPort(Port Id, Time Timestamp) XvGrabPortCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xvGrabPortRequest(Port, Time), cookie) + return XvGrabPortCookie{cookie} +} + +func (c *Conn) XvGrabPortUnchecked(Port Id, Time Timestamp) XvGrabPortCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xvGrabPortRequest(Port, Time), cookie) + return XvGrabPortCookie{cookie} +} + +// Request reply for XvGrabPort +// size: 8 +type XvGrabPortReply struct { + Sequence uint16 + Length uint32 + Result byte +} + +// Waits and reads reply data from request XvGrabPort +func (cook XvGrabPortCookie) Reply() (*XvGrabPortReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xvGrabPortReply(buf), nil +} + +// Read reply into structure from buffer for XvGrabPort +func xvGrabPortReply(buf []byte) *XvGrabPortReply { + v := new(XvGrabPortReply) + b := 1 // skip reply determinant + + v.Result = buf[b] + b += 1 + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + return v +} + +func (cook XvGrabPortCookie) Check() error { + return cook.check() +} + +// Write request to wire for XvGrabPort +func (c *Conn) xvGrabPortRequest(Port Id, Time Timestamp) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XVIDEO"] + b += 1 + + buf[b] = 3 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Port)) + b += 4 + + Put32(buf[b:], uint32(Time)) + b += 4 + + return buf +} + +// Request XvUngrabPort +// size: 12 +type XvUngrabPortCookie struct { + *cookie +} + +// Write request to wire for XvUngrabPort +func (c *Conn) XvUngrabPort(Port Id, Time Timestamp) XvUngrabPortCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xvUngrabPortRequest(Port, Time), cookie) + return XvUngrabPortCookie{cookie} +} + +func (c *Conn) XvUngrabPortChecked(Port Id, Time Timestamp) XvUngrabPortCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xvUngrabPortRequest(Port, Time), cookie) + return XvUngrabPortCookie{cookie} +} + +func (cook XvUngrabPortCookie) Check() error { + return cook.check() +} + +// Write request to wire for XvUngrabPort +func (c *Conn) xvUngrabPortRequest(Port Id, Time Timestamp) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XVIDEO"] + b += 1 + + buf[b] = 4 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Port)) + b += 4 + + Put32(buf[b:], uint32(Time)) + b += 4 + + return buf +} + +// Request XvPutVideo +// size: 32 +type XvPutVideoCookie struct { + *cookie +} + +// Write request to wire for XvPutVideo +func (c *Conn) XvPutVideo(Port Id, Drawable Id, Gc Id, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) XvPutVideoCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xvPutVideoRequest(Port, Drawable, Gc, VidX, VidY, VidW, VidH, DrwX, DrwY, DrwW, DrwH), cookie) + return XvPutVideoCookie{cookie} +} + +func (c *Conn) XvPutVideoChecked(Port Id, Drawable Id, Gc Id, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) XvPutVideoCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xvPutVideoRequest(Port, Drawable, Gc, VidX, VidY, VidW, VidH, DrwX, DrwY, DrwW, DrwH), cookie) + return XvPutVideoCookie{cookie} +} + +func (cook XvPutVideoCookie) Check() error { + return cook.check() +} + +// Write request to wire for XvPutVideo +func (c *Conn) xvPutVideoRequest(Port Id, Drawable Id, Gc Id, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) []byte { + size := 32 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XVIDEO"] + b += 1 + + buf[b] = 5 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Port)) + b += 4 + + Put32(buf[b:], uint32(Drawable)) + b += 4 + + Put32(buf[b:], uint32(Gc)) + b += 4 + + Put16(buf[b:], uint16(VidX)) + b += 2 + + Put16(buf[b:], uint16(VidY)) + b += 2 + + Put16(buf[b:], VidW) + b += 2 + + Put16(buf[b:], VidH) + b += 2 + + Put16(buf[b:], uint16(DrwX)) + b += 2 + + Put16(buf[b:], uint16(DrwY)) + b += 2 + + Put16(buf[b:], DrwW) + b += 2 + + Put16(buf[b:], DrwH) + b += 2 + + return buf +} + +// Request XvPutStill +// size: 32 +type XvPutStillCookie struct { + *cookie +} + +// Write request to wire for XvPutStill +func (c *Conn) XvPutStill(Port Id, Drawable Id, Gc Id, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) XvPutStillCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xvPutStillRequest(Port, Drawable, Gc, VidX, VidY, VidW, VidH, DrwX, DrwY, DrwW, DrwH), cookie) + return XvPutStillCookie{cookie} +} + +func (c *Conn) XvPutStillChecked(Port Id, Drawable Id, Gc Id, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) XvPutStillCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xvPutStillRequest(Port, Drawable, Gc, VidX, VidY, VidW, VidH, DrwX, DrwY, DrwW, DrwH), cookie) + return XvPutStillCookie{cookie} +} + +func (cook XvPutStillCookie) Check() error { + return cook.check() +} + +// Write request to wire for XvPutStill +func (c *Conn) xvPutStillRequest(Port Id, Drawable Id, Gc Id, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) []byte { + size := 32 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XVIDEO"] + b += 1 + + buf[b] = 6 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Port)) + b += 4 + + Put32(buf[b:], uint32(Drawable)) + b += 4 + + Put32(buf[b:], uint32(Gc)) + b += 4 + + Put16(buf[b:], uint16(VidX)) + b += 2 + + Put16(buf[b:], uint16(VidY)) + b += 2 + + Put16(buf[b:], VidW) + b += 2 + + Put16(buf[b:], VidH) + b += 2 + + Put16(buf[b:], uint16(DrwX)) + b += 2 + + Put16(buf[b:], uint16(DrwY)) + b += 2 + + Put16(buf[b:], DrwW) + b += 2 + + Put16(buf[b:], DrwH) + b += 2 + + return buf +} + +// Request XvGetVideo +// size: 32 +type XvGetVideoCookie struct { + *cookie +} + +// Write request to wire for XvGetVideo +func (c *Conn) XvGetVideo(Port Id, Drawable Id, Gc Id, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) XvGetVideoCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xvGetVideoRequest(Port, Drawable, Gc, VidX, VidY, VidW, VidH, DrwX, DrwY, DrwW, DrwH), cookie) + return XvGetVideoCookie{cookie} +} + +func (c *Conn) XvGetVideoChecked(Port Id, Drawable Id, Gc Id, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) XvGetVideoCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xvGetVideoRequest(Port, Drawable, Gc, VidX, VidY, VidW, VidH, DrwX, DrwY, DrwW, DrwH), cookie) + return XvGetVideoCookie{cookie} +} + +func (cook XvGetVideoCookie) Check() error { + return cook.check() +} + +// Write request to wire for XvGetVideo +func (c *Conn) xvGetVideoRequest(Port Id, Drawable Id, Gc Id, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) []byte { + size := 32 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XVIDEO"] + b += 1 + + buf[b] = 7 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Port)) + b += 4 + + Put32(buf[b:], uint32(Drawable)) + b += 4 + + Put32(buf[b:], uint32(Gc)) + b += 4 + + Put16(buf[b:], uint16(VidX)) + b += 2 + + Put16(buf[b:], uint16(VidY)) + b += 2 + + Put16(buf[b:], VidW) + b += 2 + + Put16(buf[b:], VidH) + b += 2 + + Put16(buf[b:], uint16(DrwX)) + b += 2 + + Put16(buf[b:], uint16(DrwY)) + b += 2 + + Put16(buf[b:], DrwW) + b += 2 + + Put16(buf[b:], DrwH) + b += 2 + + return buf +} + +// Request XvGetStill +// size: 32 +type XvGetStillCookie struct { + *cookie +} + +// Write request to wire for XvGetStill +func (c *Conn) XvGetStill(Port Id, Drawable Id, Gc Id, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) XvGetStillCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xvGetStillRequest(Port, Drawable, Gc, VidX, VidY, VidW, VidH, DrwX, DrwY, DrwW, DrwH), cookie) + return XvGetStillCookie{cookie} +} + +func (c *Conn) XvGetStillChecked(Port Id, Drawable Id, Gc Id, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) XvGetStillCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xvGetStillRequest(Port, Drawable, Gc, VidX, VidY, VidW, VidH, DrwX, DrwY, DrwW, DrwH), cookie) + return XvGetStillCookie{cookie} +} + +func (cook XvGetStillCookie) Check() error { + return cook.check() +} + +// Write request to wire for XvGetStill +func (c *Conn) xvGetStillRequest(Port Id, Drawable Id, Gc Id, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) []byte { + size := 32 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XVIDEO"] + b += 1 + + buf[b] = 8 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Port)) + b += 4 + + Put32(buf[b:], uint32(Drawable)) + b += 4 + + Put32(buf[b:], uint32(Gc)) + b += 4 + + Put16(buf[b:], uint16(VidX)) + b += 2 + + Put16(buf[b:], uint16(VidY)) + b += 2 + + Put16(buf[b:], VidW) + b += 2 + + Put16(buf[b:], VidH) + b += 2 + + Put16(buf[b:], uint16(DrwX)) + b += 2 + + Put16(buf[b:], uint16(DrwY)) + b += 2 + + Put16(buf[b:], DrwW) + b += 2 + + Put16(buf[b:], DrwH) + b += 2 + + return buf +} + +// Request XvStopVideo +// size: 12 +type XvStopVideoCookie struct { + *cookie +} + +// Write request to wire for XvStopVideo +func (c *Conn) XvStopVideo(Port Id, Drawable Id) XvStopVideoCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xvStopVideoRequest(Port, Drawable), cookie) + return XvStopVideoCookie{cookie} +} + +func (c *Conn) XvStopVideoChecked(Port Id, Drawable Id) XvStopVideoCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xvStopVideoRequest(Port, Drawable), cookie) + return XvStopVideoCookie{cookie} +} + +func (cook XvStopVideoCookie) Check() error { + return cook.check() +} + +// Write request to wire for XvStopVideo +func (c *Conn) xvStopVideoRequest(Port Id, Drawable Id) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XVIDEO"] + b += 1 + + buf[b] = 9 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Port)) + b += 4 + + Put32(buf[b:], uint32(Drawable)) + b += 4 + + return buf +} + +// Request XvSelectVideoNotify +// size: 12 +type XvSelectVideoNotifyCookie struct { + *cookie +} + +// Write request to wire for XvSelectVideoNotify +func (c *Conn) XvSelectVideoNotify(Drawable Id, Onoff bool) XvSelectVideoNotifyCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xvSelectVideoNotifyRequest(Drawable, Onoff), cookie) + return XvSelectVideoNotifyCookie{cookie} +} + +func (c *Conn) XvSelectVideoNotifyChecked(Drawable Id, Onoff bool) XvSelectVideoNotifyCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xvSelectVideoNotifyRequest(Drawable, Onoff), cookie) + return XvSelectVideoNotifyCookie{cookie} +} + +func (cook XvSelectVideoNotifyCookie) Check() error { + return cook.check() +} + +// Write request to wire for XvSelectVideoNotify +func (c *Conn) xvSelectVideoNotifyRequest(Drawable Id, Onoff bool) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XVIDEO"] + b += 1 + + buf[b] = 10 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Drawable)) + b += 4 + + if Onoff { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + b += 3 // padding + + return buf +} + +// Request XvSelectPortNotify +// size: 12 +type XvSelectPortNotifyCookie struct { + *cookie +} + +// Write request to wire for XvSelectPortNotify +func (c *Conn) XvSelectPortNotify(Port Id, Onoff bool) XvSelectPortNotifyCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xvSelectPortNotifyRequest(Port, Onoff), cookie) + return XvSelectPortNotifyCookie{cookie} +} + +func (c *Conn) XvSelectPortNotifyChecked(Port Id, Onoff bool) XvSelectPortNotifyCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xvSelectPortNotifyRequest(Port, Onoff), cookie) + return XvSelectPortNotifyCookie{cookie} +} + +func (cook XvSelectPortNotifyCookie) Check() error { + return cook.check() +} + +// Write request to wire for XvSelectPortNotify +func (c *Conn) xvSelectPortNotifyRequest(Port Id, Onoff bool) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XVIDEO"] + b += 1 + + buf[b] = 11 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Port)) + b += 4 + + if Onoff { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + b += 3 // padding + + return buf +} + +// Request XvQueryBestSize +// size: 20 +type XvQueryBestSizeCookie struct { + *cookie +} + +func (c *Conn) XvQueryBestSize(Port Id, VidW uint16, VidH uint16, DrwW uint16, DrwH uint16, Motion bool) XvQueryBestSizeCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xvQueryBestSizeRequest(Port, VidW, VidH, DrwW, DrwH, Motion), cookie) + return XvQueryBestSizeCookie{cookie} +} + +func (c *Conn) XvQueryBestSizeUnchecked(Port Id, VidW uint16, VidH uint16, DrwW uint16, DrwH uint16, Motion bool) XvQueryBestSizeCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xvQueryBestSizeRequest(Port, VidW, VidH, DrwW, DrwH, Motion), cookie) + return XvQueryBestSizeCookie{cookie} +} + +// Request reply for XvQueryBestSize +// size: 12 +type XvQueryBestSizeReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + ActualWidth uint16 + ActualHeight uint16 +} + +// Waits and reads reply data from request XvQueryBestSize +func (cook XvQueryBestSizeCookie) Reply() (*XvQueryBestSizeReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xvQueryBestSizeReply(buf), nil +} + +// Read reply into structure from buffer for XvQueryBestSize +func xvQueryBestSizeReply(buf []byte) *XvQueryBestSizeReply { + v := new(XvQueryBestSizeReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.ActualWidth = Get16(buf[b:]) + b += 2 + + v.ActualHeight = Get16(buf[b:]) + b += 2 + + return v +} + +func (cook XvQueryBestSizeCookie) Check() error { + return cook.check() +} + +// Write request to wire for XvQueryBestSize +func (c *Conn) xvQueryBestSizeRequest(Port Id, VidW uint16, VidH uint16, DrwW uint16, DrwH uint16, Motion bool) []byte { + size := 20 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XVIDEO"] + b += 1 + + buf[b] = 12 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Port)) + b += 4 + + Put16(buf[b:], VidW) + b += 2 + + Put16(buf[b:], VidH) + b += 2 + + Put16(buf[b:], DrwW) + b += 2 + + Put16(buf[b:], DrwH) + b += 2 + + if Motion { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + b += 3 // padding + + return buf +} + +// Request XvSetPortAttribute +// size: 16 +type XvSetPortAttributeCookie struct { + *cookie +} + +// Write request to wire for XvSetPortAttribute +func (c *Conn) XvSetPortAttribute(Port Id, Attribute Id, Value int32) XvSetPortAttributeCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xvSetPortAttributeRequest(Port, Attribute, Value), cookie) + return XvSetPortAttributeCookie{cookie} +} + +func (c *Conn) XvSetPortAttributeChecked(Port Id, Attribute Id, Value int32) XvSetPortAttributeCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xvSetPortAttributeRequest(Port, Attribute, Value), cookie) + return XvSetPortAttributeCookie{cookie} +} + +func (cook XvSetPortAttributeCookie) Check() error { + return cook.check() +} + +// Write request to wire for XvSetPortAttribute +func (c *Conn) xvSetPortAttributeRequest(Port Id, Attribute Id, Value int32) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XVIDEO"] + b += 1 + + buf[b] = 13 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Port)) + b += 4 + + Put32(buf[b:], uint32(Attribute)) + b += 4 + + Put32(buf[b:], uint32(Value)) + b += 4 + + return buf +} + +// Request XvGetPortAttribute +// size: 12 +type XvGetPortAttributeCookie struct { + *cookie +} + +func (c *Conn) XvGetPortAttribute(Port Id, Attribute Id) XvGetPortAttributeCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xvGetPortAttributeRequest(Port, Attribute), cookie) + return XvGetPortAttributeCookie{cookie} +} + +func (c *Conn) XvGetPortAttributeUnchecked(Port Id, Attribute Id) XvGetPortAttributeCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xvGetPortAttributeRequest(Port, Attribute), cookie) + return XvGetPortAttributeCookie{cookie} +} + +// Request reply for XvGetPortAttribute +// size: 12 +type XvGetPortAttributeReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Value int32 +} + +// Waits and reads reply data from request XvGetPortAttribute +func (cook XvGetPortAttributeCookie) Reply() (*XvGetPortAttributeReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xvGetPortAttributeReply(buf), nil +} + +// Read reply into structure from buffer for XvGetPortAttribute +func xvGetPortAttributeReply(buf []byte) *XvGetPortAttributeReply { + v := new(XvGetPortAttributeReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.Value = int32(Get32(buf[b:])) + b += 4 + + return v +} + +func (cook XvGetPortAttributeCookie) Check() error { + return cook.check() +} + +// Write request to wire for XvGetPortAttribute +func (c *Conn) xvGetPortAttributeRequest(Port Id, Attribute Id) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XVIDEO"] + b += 1 + + buf[b] = 14 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Port)) + b += 4 + + Put32(buf[b:], uint32(Attribute)) + b += 4 + + return buf +} + +// Request XvQueryPortAttributes +// size: 8 +type XvQueryPortAttributesCookie struct { + *cookie +} + +func (c *Conn) XvQueryPortAttributes(Port Id) XvQueryPortAttributesCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xvQueryPortAttributesRequest(Port), cookie) + return XvQueryPortAttributesCookie{cookie} +} + +func (c *Conn) XvQueryPortAttributesUnchecked(Port Id) XvQueryPortAttributesCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xvQueryPortAttributesRequest(Port), cookie) + return XvQueryPortAttributesCookie{cookie} +} + +// Request reply for XvQueryPortAttributes +// size: (32 + XvAttributeInfoListSize(Attributes)) +type XvQueryPortAttributesReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + NumAttributes uint32 + TextSize uint32 + // padding: 16 bytes + Attributes []XvAttributeInfo // size: XvAttributeInfoListSize(Attributes) +} + +// Waits and reads reply data from request XvQueryPortAttributes +func (cook XvQueryPortAttributesCookie) Reply() (*XvQueryPortAttributesReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xvQueryPortAttributesReply(buf), nil +} + +// Read reply into structure from buffer for XvQueryPortAttributes +func xvQueryPortAttributesReply(buf []byte) *XvQueryPortAttributesReply { + v := new(XvQueryPortAttributesReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.NumAttributes = Get32(buf[b:]) + b += 4 + + v.TextSize = Get32(buf[b:]) + b += 4 + + b += 16 // padding + + v.Attributes = make([]XvAttributeInfo, v.NumAttributes) + b += ReadXvAttributeInfoList(buf[b:], v.Attributes) + + return v +} + +func (cook XvQueryPortAttributesCookie) Check() error { + return cook.check() +} + +// Write request to wire for XvQueryPortAttributes +func (c *Conn) xvQueryPortAttributesRequest(Port Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XVIDEO"] + b += 1 + + buf[b] = 15 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Port)) + b += 4 + + return buf +} + +// Request XvListImageFormats +// size: 8 +type XvListImageFormatsCookie struct { + *cookie +} + +func (c *Conn) XvListImageFormats(Port Id) XvListImageFormatsCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xvListImageFormatsRequest(Port), cookie) + return XvListImageFormatsCookie{cookie} +} + +func (c *Conn) XvListImageFormatsUnchecked(Port Id) XvListImageFormatsCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xvListImageFormatsRequest(Port), cookie) + return XvListImageFormatsCookie{cookie} +} + +// Request reply for XvListImageFormats +// size: (32 + XvImageFormatInfoListSize(Format)) +type XvListImageFormatsReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + NumFormats uint32 + // padding: 20 bytes + Format []XvImageFormatInfo // size: XvImageFormatInfoListSize(Format) +} + +// Waits and reads reply data from request XvListImageFormats +func (cook XvListImageFormatsCookie) Reply() (*XvListImageFormatsReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xvListImageFormatsReply(buf), nil +} + +// Read reply into structure from buffer for XvListImageFormats +func xvListImageFormatsReply(buf []byte) *XvListImageFormatsReply { + v := new(XvListImageFormatsReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.NumFormats = Get32(buf[b:]) + b += 4 + + b += 20 // padding + + v.Format = make([]XvImageFormatInfo, v.NumFormats) + b += ReadXvImageFormatInfoList(buf[b:], v.Format) + + return v +} + +func (cook XvListImageFormatsCookie) Check() error { + return cook.check() +} + +// Write request to wire for XvListImageFormats +func (c *Conn) xvListImageFormatsRequest(Port Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XVIDEO"] + b += 1 + + buf[b] = 16 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Port)) + b += 4 + + return buf +} + +// Request XvQueryImageAttributes +// size: 16 +type XvQueryImageAttributesCookie struct { + *cookie +} + +func (c *Conn) XvQueryImageAttributes(Port Id, Id uint32, Width uint16, Height uint16) XvQueryImageAttributesCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xvQueryImageAttributesRequest(Port, Id, Width, Height), cookie) + return XvQueryImageAttributesCookie{cookie} +} + +func (c *Conn) XvQueryImageAttributesUnchecked(Port Id, Id uint32, Width uint16, Height uint16) XvQueryImageAttributesCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xvQueryImageAttributesRequest(Port, Id, Width, Height), cookie) + return XvQueryImageAttributesCookie{cookie} +} + +// Request reply for XvQueryImageAttributes +// size: ((32 + pad((int(NumPlanes) * 4))) + pad((int(NumPlanes) * 4))) +type XvQueryImageAttributesReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + NumPlanes uint32 + DataSize uint32 + Width uint16 + Height uint16 + // padding: 12 bytes + Pitches []uint32 // size: pad((int(NumPlanes) * 4)) + Offsets []uint32 // size: pad((int(NumPlanes) * 4)) +} + +// Waits and reads reply data from request XvQueryImageAttributes +func (cook XvQueryImageAttributesCookie) Reply() (*XvQueryImageAttributesReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xvQueryImageAttributesReply(buf), nil +} + +// Read reply into structure from buffer for XvQueryImageAttributes +func xvQueryImageAttributesReply(buf []byte) *XvQueryImageAttributesReply { + v := new(XvQueryImageAttributesReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.NumPlanes = Get32(buf[b:]) + b += 4 + + v.DataSize = Get32(buf[b:]) + b += 4 + + v.Width = Get16(buf[b:]) + b += 2 + + v.Height = Get16(buf[b:]) + b += 2 + + b += 12 // padding + + v.Pitches = make([]uint32, v.NumPlanes) + for i := 0; i < int(v.NumPlanes); i++ { + v.Pitches[i] = Get32(buf[b:]) + b += 4 + } + b = pad(b) + + v.Offsets = make([]uint32, v.NumPlanes) + for i := 0; i < int(v.NumPlanes); i++ { + v.Offsets[i] = Get32(buf[b:]) + b += 4 + } + b = pad(b) + + return v +} + +func (cook XvQueryImageAttributesCookie) Check() error { + return cook.check() +} + +// Write request to wire for XvQueryImageAttributes +func (c *Conn) xvQueryImageAttributesRequest(Port Id, Id uint32, Width uint16, Height uint16) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XVIDEO"] + b += 1 + + buf[b] = 17 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Port)) + b += 4 + + Put32(buf[b:], Id) + b += 4 + + Put16(buf[b:], Width) + b += 2 + + Put16(buf[b:], Height) + b += 2 + + return buf +} + +// Request XvPutImage +// size: pad((40 + pad((len(Data) * 1)))) +type XvPutImageCookie struct { + *cookie +} + +// Write request to wire for XvPutImage +func (c *Conn) XvPutImage(Port Id, Drawable Id, Gc Id, Id uint32, SrcX int16, SrcY int16, SrcW uint16, SrcH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16, Width uint16, Height uint16, Data []byte) XvPutImageCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xvPutImageRequest(Port, Drawable, Gc, Id, SrcX, SrcY, SrcW, SrcH, DrwX, DrwY, DrwW, DrwH, Width, Height, Data), cookie) + return XvPutImageCookie{cookie} +} + +func (c *Conn) XvPutImageChecked(Port Id, Drawable Id, Gc Id, Id uint32, SrcX int16, SrcY int16, SrcW uint16, SrcH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16, Width uint16, Height uint16, Data []byte) XvPutImageCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xvPutImageRequest(Port, Drawable, Gc, Id, SrcX, SrcY, SrcW, SrcH, DrwX, DrwY, DrwW, DrwH, Width, Height, Data), cookie) + return XvPutImageCookie{cookie} +} + +func (cook XvPutImageCookie) Check() error { + return cook.check() +} + +// Write request to wire for XvPutImage +func (c *Conn) xvPutImageRequest(Port Id, Drawable Id, Gc Id, Id uint32, SrcX int16, SrcY int16, SrcW uint16, SrcH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16, Width uint16, Height uint16, Data []byte) []byte { + size := pad((40 + pad((len(Data) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XVIDEO"] + b += 1 + + buf[b] = 18 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Port)) + b += 4 + + Put32(buf[b:], uint32(Drawable)) + b += 4 + + Put32(buf[b:], uint32(Gc)) + b += 4 + + Put32(buf[b:], Id) + b += 4 + + Put16(buf[b:], uint16(SrcX)) + b += 2 + + Put16(buf[b:], uint16(SrcY)) + b += 2 + + Put16(buf[b:], SrcW) + b += 2 + + Put16(buf[b:], SrcH) + b += 2 + + Put16(buf[b:], uint16(DrwX)) + b += 2 + + Put16(buf[b:], uint16(DrwY)) + b += 2 + + Put16(buf[b:], DrwW) + b += 2 + + Put16(buf[b:], DrwH) + b += 2 + + Put16(buf[b:], Width) + b += 2 + + Put16(buf[b:], Height) + b += 2 + + copy(buf[b:], Data[:len(Data)]) + b += pad(int(len(Data))) + + return buf +} + +// Request XvShmPutImage +// size: 52 +type XvShmPutImageCookie struct { + *cookie +} + +// Write request to wire for XvShmPutImage +func (c *Conn) XvShmPutImage(Port Id, Drawable Id, Gc Id, Shmseg Id, Id uint32, Offset uint32, SrcX int16, SrcY int16, SrcW uint16, SrcH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16, Width uint16, Height uint16, SendEvent byte) XvShmPutImageCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xvShmPutImageRequest(Port, Drawable, Gc, Shmseg, Id, Offset, SrcX, SrcY, SrcW, SrcH, DrwX, DrwY, DrwW, DrwH, Width, Height, SendEvent), cookie) + return XvShmPutImageCookie{cookie} +} + +func (c *Conn) XvShmPutImageChecked(Port Id, Drawable Id, Gc Id, Shmseg Id, Id uint32, Offset uint32, SrcX int16, SrcY int16, SrcW uint16, SrcH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16, Width uint16, Height uint16, SendEvent byte) XvShmPutImageCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xvShmPutImageRequest(Port, Drawable, Gc, Shmseg, Id, Offset, SrcX, SrcY, SrcW, SrcH, DrwX, DrwY, DrwW, DrwH, Width, Height, SendEvent), cookie) + return XvShmPutImageCookie{cookie} +} + +func (cook XvShmPutImageCookie) Check() error { + return cook.check() +} + +// Write request to wire for XvShmPutImage +func (c *Conn) xvShmPutImageRequest(Port Id, Drawable Id, Gc Id, Shmseg Id, Id uint32, Offset uint32, SrcX int16, SrcY int16, SrcW uint16, SrcH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16, Width uint16, Height uint16, SendEvent byte) []byte { + size := 52 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XVIDEO"] + b += 1 + + buf[b] = 19 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Port)) + b += 4 + + Put32(buf[b:], uint32(Drawable)) + b += 4 + + Put32(buf[b:], uint32(Gc)) + b += 4 + + Put32(buf[b:], uint32(Shmseg)) + b += 4 + + Put32(buf[b:], Id) + b += 4 + + Put32(buf[b:], Offset) + b += 4 + + Put16(buf[b:], uint16(SrcX)) + b += 2 + + Put16(buf[b:], uint16(SrcY)) + b += 2 + + Put16(buf[b:], SrcW) + b += 2 + + Put16(buf[b:], SrcH) + b += 2 + + Put16(buf[b:], uint16(DrwX)) + b += 2 + + Put16(buf[b:], uint16(DrwY)) + b += 2 + + Put16(buf[b:], DrwW) + b += 2 + + Put16(buf[b:], DrwH) + b += 2 + + Put16(buf[b:], Width) + b += 2 + + Put16(buf[b:], Height) + b += 2 + + buf[b] = SendEvent + b += 1 + + b += 3 // padding + + return buf +} diff --git a/nexgb/auto_xvmc.go b/nexgb/auto_xvmc.go new file mode 100644 index 0000000..1d8814d --- /dev/null +++ b/nexgb/auto_xvmc.go @@ -0,0 +1,879 @@ +package xgb + +/* + This file was generated by xvmc.xml on May 6 2012 3:00:45am EDT. + This file is automatically generated. Edit at your peril! +*/ + +// Imports are not necessary for XGB because everything is +// in one package. They are still listed here for reference. +// import "xv" + +// Skipping definition for base type 'Card16' + +// Skipping definition for base type 'Char' + +// Skipping definition for base type 'Card32' + +// Skipping definition for base type 'Double' + +// Skipping definition for base type 'Bool' + +// Skipping definition for base type 'Float' + +// Skipping definition for base type 'Id' + +// Skipping definition for base type 'Card8' + +// Skipping definition for base type 'Int16' + +// Skipping definition for base type 'Int32' + +// Skipping definition for base type 'Void' + +// Skipping definition for base type 'Byte' + +// Skipping definition for base type 'Int8' + +// Skipping resource definition of 'Context' + +// Skipping resource definition of 'Surface' + +// Skipping resource definition of 'Subpicture' + +// 'XvmcSurfaceInfo' struct definition +// Size: 24 +type XvmcSurfaceInfo struct { + Id Id + ChromaFormat uint16 + Pad0 uint16 + MaxWidth uint16 + MaxHeight uint16 + SubpictureMaxWidth uint16 + SubpictureMaxHeight uint16 + McType uint32 + Flags uint32 +} + +// Struct read XvmcSurfaceInfo +func ReadXvmcSurfaceInfo(buf []byte, v *XvmcSurfaceInfo) int { + b := 0 + + v.Id = Id(Get32(buf[b:])) + b += 4 + + v.ChromaFormat = Get16(buf[b:]) + b += 2 + + v.Pad0 = Get16(buf[b:]) + b += 2 + + v.MaxWidth = Get16(buf[b:]) + b += 2 + + v.MaxHeight = Get16(buf[b:]) + b += 2 + + v.SubpictureMaxWidth = Get16(buf[b:]) + b += 2 + + v.SubpictureMaxHeight = Get16(buf[b:]) + b += 2 + + v.McType = Get32(buf[b:]) + b += 4 + + v.Flags = Get32(buf[b:]) + b += 4 + + return b +} + +// Struct list read XvmcSurfaceInfo +func ReadXvmcSurfaceInfoList(buf []byte, dest []XvmcSurfaceInfo) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XvmcSurfaceInfo{} + b += ReadXvmcSurfaceInfo(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XvmcSurfaceInfo +func (v XvmcSurfaceInfo) Bytes() []byte { + buf := make([]byte, 24) + b := 0 + + Put32(buf[b:], uint32(v.Id)) + b += 4 + + Put16(buf[b:], v.ChromaFormat) + b += 2 + + Put16(buf[b:], v.Pad0) + b += 2 + + Put16(buf[b:], v.MaxWidth) + b += 2 + + Put16(buf[b:], v.MaxHeight) + b += 2 + + Put16(buf[b:], v.SubpictureMaxWidth) + b += 2 + + Put16(buf[b:], v.SubpictureMaxHeight) + b += 2 + + Put32(buf[b:], v.McType) + b += 4 + + Put32(buf[b:], v.Flags) + b += 4 + + return buf +} + +// Write struct list XvmcSurfaceInfo +func XvmcSurfaceInfoListBytes(buf []byte, list []XvmcSurfaceInfo) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// Request XvmcQueryVersion +// size: 4 +type XvmcQueryVersionCookie struct { + *cookie +} + +func (c *Conn) XvmcQueryVersion() XvmcQueryVersionCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xvmcQueryVersionRequest(), cookie) + return XvmcQueryVersionCookie{cookie} +} + +func (c *Conn) XvmcQueryVersionUnchecked() XvmcQueryVersionCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xvmcQueryVersionRequest(), cookie) + return XvmcQueryVersionCookie{cookie} +} + +// Request reply for XvmcQueryVersion +// size: 16 +type XvmcQueryVersionReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Major uint32 + Minor uint32 +} + +// Waits and reads reply data from request XvmcQueryVersion +func (cook XvmcQueryVersionCookie) Reply() (*XvmcQueryVersionReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xvmcQueryVersionReply(buf), nil +} + +// Read reply into structure from buffer for XvmcQueryVersion +func xvmcQueryVersionReply(buf []byte) *XvmcQueryVersionReply { + v := new(XvmcQueryVersionReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.Major = Get32(buf[b:]) + b += 4 + + v.Minor = Get32(buf[b:]) + b += 4 + + return v +} + +func (cook XvmcQueryVersionCookie) Check() error { + return cook.check() +} + +// Write request to wire for XvmcQueryVersion +func (c *Conn) xvmcQueryVersionRequest() []byte { + size := 4 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XVIDEO-MOTIONCOMPENSATION"] + b += 1 + + buf[b] = 0 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + return buf +} + +// Request XvmcListSurfaceTypes +// size: 8 +type XvmcListSurfaceTypesCookie struct { + *cookie +} + +func (c *Conn) XvmcListSurfaceTypes(PortId Id) XvmcListSurfaceTypesCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xvmcListSurfaceTypesRequest(PortId), cookie) + return XvmcListSurfaceTypesCookie{cookie} +} + +func (c *Conn) XvmcListSurfaceTypesUnchecked(PortId Id) XvmcListSurfaceTypesCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xvmcListSurfaceTypesRequest(PortId), cookie) + return XvmcListSurfaceTypesCookie{cookie} +} + +// Request reply for XvmcListSurfaceTypes +// size: (32 + pad((int(Num) * 24))) +type XvmcListSurfaceTypesReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Num uint32 + // padding: 20 bytes + Surfaces []XvmcSurfaceInfo // size: pad((int(Num) * 24)) +} + +// Waits and reads reply data from request XvmcListSurfaceTypes +func (cook XvmcListSurfaceTypesCookie) Reply() (*XvmcListSurfaceTypesReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xvmcListSurfaceTypesReply(buf), nil +} + +// Read reply into structure from buffer for XvmcListSurfaceTypes +func xvmcListSurfaceTypesReply(buf []byte) *XvmcListSurfaceTypesReply { + v := new(XvmcListSurfaceTypesReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.Num = Get32(buf[b:]) + b += 4 + + b += 20 // padding + + v.Surfaces = make([]XvmcSurfaceInfo, v.Num) + b += ReadXvmcSurfaceInfoList(buf[b:], v.Surfaces) + + return v +} + +func (cook XvmcListSurfaceTypesCookie) Check() error { + return cook.check() +} + +// Write request to wire for XvmcListSurfaceTypes +func (c *Conn) xvmcListSurfaceTypesRequest(PortId Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XVIDEO-MOTIONCOMPENSATION"] + b += 1 + + buf[b] = 1 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(PortId)) + b += 4 + + return buf +} + +// Request XvmcCreateContext +// size: 24 +type XvmcCreateContextCookie struct { + *cookie +} + +func (c *Conn) XvmcCreateContext(ContextId Id, PortId Id, SurfaceId Id, Width uint16, Height uint16, Flags uint32) XvmcCreateContextCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xvmcCreateContextRequest(ContextId, PortId, SurfaceId, Width, Height, Flags), cookie) + return XvmcCreateContextCookie{cookie} +} + +func (c *Conn) XvmcCreateContextUnchecked(ContextId Id, PortId Id, SurfaceId Id, Width uint16, Height uint16, Flags uint32) XvmcCreateContextCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xvmcCreateContextRequest(ContextId, PortId, SurfaceId, Width, Height, Flags), cookie) + return XvmcCreateContextCookie{cookie} +} + +// Request reply for XvmcCreateContext +// size: (36 + pad((int(Length) * 4))) +type XvmcCreateContextReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + WidthActual uint16 + HeightActual uint16 + FlagsReturn uint32 + // padding: 20 bytes + PrivData []uint32 // size: pad((int(Length) * 4)) +} + +// Waits and reads reply data from request XvmcCreateContext +func (cook XvmcCreateContextCookie) Reply() (*XvmcCreateContextReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xvmcCreateContextReply(buf), nil +} + +// Read reply into structure from buffer for XvmcCreateContext +func xvmcCreateContextReply(buf []byte) *XvmcCreateContextReply { + v := new(XvmcCreateContextReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.WidthActual = Get16(buf[b:]) + b += 2 + + v.HeightActual = Get16(buf[b:]) + b += 2 + + v.FlagsReturn = Get32(buf[b:]) + b += 4 + + b += 20 // padding + + v.PrivData = make([]uint32, v.Length) + for i := 0; i < int(v.Length); i++ { + v.PrivData[i] = Get32(buf[b:]) + b += 4 + } + b = pad(b) + + return v +} + +func (cook XvmcCreateContextCookie) Check() error { + return cook.check() +} + +// Write request to wire for XvmcCreateContext +func (c *Conn) xvmcCreateContextRequest(ContextId Id, PortId Id, SurfaceId Id, Width uint16, Height uint16, Flags uint32) []byte { + size := 24 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XVIDEO-MOTIONCOMPENSATION"] + b += 1 + + buf[b] = 2 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextId)) + b += 4 + + Put32(buf[b:], uint32(PortId)) + b += 4 + + Put32(buf[b:], uint32(SurfaceId)) + b += 4 + + Put16(buf[b:], Width) + b += 2 + + Put16(buf[b:], Height) + b += 2 + + Put32(buf[b:], Flags) + b += 4 + + return buf +} + +// Request XvmcDestroyContext +// size: 8 +type XvmcDestroyContextCookie struct { + *cookie +} + +// Write request to wire for XvmcDestroyContext +func (c *Conn) XvmcDestroyContext(ContextId Id) XvmcDestroyContextCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xvmcDestroyContextRequest(ContextId), cookie) + return XvmcDestroyContextCookie{cookie} +} + +func (c *Conn) XvmcDestroyContextChecked(ContextId Id) XvmcDestroyContextCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xvmcDestroyContextRequest(ContextId), cookie) + return XvmcDestroyContextCookie{cookie} +} + +func (cook XvmcDestroyContextCookie) Check() error { + return cook.check() +} + +// Write request to wire for XvmcDestroyContext +func (c *Conn) xvmcDestroyContextRequest(ContextId Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XVIDEO-MOTIONCOMPENSATION"] + b += 1 + + buf[b] = 3 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(ContextId)) + b += 4 + + return buf +} + +// Request XvmcCreateSurface +// size: 12 +type XvmcCreateSurfaceCookie struct { + *cookie +} + +func (c *Conn) XvmcCreateSurface(SurfaceId Id, ContextId Id) XvmcCreateSurfaceCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xvmcCreateSurfaceRequest(SurfaceId, ContextId), cookie) + return XvmcCreateSurfaceCookie{cookie} +} + +func (c *Conn) XvmcCreateSurfaceUnchecked(SurfaceId Id, ContextId Id) XvmcCreateSurfaceCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xvmcCreateSurfaceRequest(SurfaceId, ContextId), cookie) + return XvmcCreateSurfaceCookie{cookie} +} + +// Request reply for XvmcCreateSurface +// size: (32 + pad((int(Length) * 4))) +type XvmcCreateSurfaceReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 24 bytes + PrivData []uint32 // size: pad((int(Length) * 4)) +} + +// Waits and reads reply data from request XvmcCreateSurface +func (cook XvmcCreateSurfaceCookie) Reply() (*XvmcCreateSurfaceReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xvmcCreateSurfaceReply(buf), nil +} + +// Read reply into structure from buffer for XvmcCreateSurface +func xvmcCreateSurfaceReply(buf []byte) *XvmcCreateSurfaceReply { + v := new(XvmcCreateSurfaceReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + b += 24 // padding + + v.PrivData = make([]uint32, v.Length) + for i := 0; i < int(v.Length); i++ { + v.PrivData[i] = Get32(buf[b:]) + b += 4 + } + b = pad(b) + + return v +} + +func (cook XvmcCreateSurfaceCookie) Check() error { + return cook.check() +} + +// Write request to wire for XvmcCreateSurface +func (c *Conn) xvmcCreateSurfaceRequest(SurfaceId Id, ContextId Id) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XVIDEO-MOTIONCOMPENSATION"] + b += 1 + + buf[b] = 4 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(SurfaceId)) + b += 4 + + Put32(buf[b:], uint32(ContextId)) + b += 4 + + return buf +} + +// Request XvmcDestroySurface +// size: 8 +type XvmcDestroySurfaceCookie struct { + *cookie +} + +// Write request to wire for XvmcDestroySurface +func (c *Conn) XvmcDestroySurface(SurfaceId Id) XvmcDestroySurfaceCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xvmcDestroySurfaceRequest(SurfaceId), cookie) + return XvmcDestroySurfaceCookie{cookie} +} + +func (c *Conn) XvmcDestroySurfaceChecked(SurfaceId Id) XvmcDestroySurfaceCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xvmcDestroySurfaceRequest(SurfaceId), cookie) + return XvmcDestroySurfaceCookie{cookie} +} + +func (cook XvmcDestroySurfaceCookie) Check() error { + return cook.check() +} + +// Write request to wire for XvmcDestroySurface +func (c *Conn) xvmcDestroySurfaceRequest(SurfaceId Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XVIDEO-MOTIONCOMPENSATION"] + b += 1 + + buf[b] = 5 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(SurfaceId)) + b += 4 + + return buf +} + +// Request XvmcCreateSubpicture +// size: 20 +type XvmcCreateSubpictureCookie struct { + *cookie +} + +func (c *Conn) XvmcCreateSubpicture(SubpictureId Id, Context Id, XvimageId uint32, Width uint16, Height uint16) XvmcCreateSubpictureCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xvmcCreateSubpictureRequest(SubpictureId, Context, XvimageId, Width, Height), cookie) + return XvmcCreateSubpictureCookie{cookie} +} + +func (c *Conn) XvmcCreateSubpictureUnchecked(SubpictureId Id, Context Id, XvimageId uint32, Width uint16, Height uint16) XvmcCreateSubpictureCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xvmcCreateSubpictureRequest(SubpictureId, Context, XvimageId, Width, Height), cookie) + return XvmcCreateSubpictureCookie{cookie} +} + +// Request reply for XvmcCreateSubpicture +// size: (32 + pad((int(Length) * 4))) +type XvmcCreateSubpictureReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + WidthActual uint16 + HeightActual uint16 + NumPaletteEntries uint16 + EntryBytes uint16 + ComponentOrder []byte // size: 4 + // padding: 12 bytes + PrivData []uint32 // size: pad((int(Length) * 4)) +} + +// Waits and reads reply data from request XvmcCreateSubpicture +func (cook XvmcCreateSubpictureCookie) Reply() (*XvmcCreateSubpictureReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xvmcCreateSubpictureReply(buf), nil +} + +// Read reply into structure from buffer for XvmcCreateSubpicture +func xvmcCreateSubpictureReply(buf []byte) *XvmcCreateSubpictureReply { + v := new(XvmcCreateSubpictureReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.WidthActual = Get16(buf[b:]) + b += 2 + + v.HeightActual = Get16(buf[b:]) + b += 2 + + v.NumPaletteEntries = Get16(buf[b:]) + b += 2 + + v.EntryBytes = Get16(buf[b:]) + b += 2 + + v.ComponentOrder = make([]byte, 4) + copy(v.ComponentOrder[:4], buf[b:]) + b += pad(int(4)) + + b += 12 // padding + + v.PrivData = make([]uint32, v.Length) + for i := 0; i < int(v.Length); i++ { + v.PrivData[i] = Get32(buf[b:]) + b += 4 + } + b = pad(b) + + return v +} + +func (cook XvmcCreateSubpictureCookie) Check() error { + return cook.check() +} + +// Write request to wire for XvmcCreateSubpicture +func (c *Conn) xvmcCreateSubpictureRequest(SubpictureId Id, Context Id, XvimageId uint32, Width uint16, Height uint16) []byte { + size := 20 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XVIDEO-MOTIONCOMPENSATION"] + b += 1 + + buf[b] = 6 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(SubpictureId)) + b += 4 + + Put32(buf[b:], uint32(Context)) + b += 4 + + Put32(buf[b:], XvimageId) + b += 4 + + Put16(buf[b:], Width) + b += 2 + + Put16(buf[b:], Height) + b += 2 + + return buf +} + +// Request XvmcDestroySubpicture +// size: 8 +type XvmcDestroySubpictureCookie struct { + *cookie +} + +// Write request to wire for XvmcDestroySubpicture +func (c *Conn) XvmcDestroySubpicture(SubpictureId Id) XvmcDestroySubpictureCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xvmcDestroySubpictureRequest(SubpictureId), cookie) + return XvmcDestroySubpictureCookie{cookie} +} + +func (c *Conn) XvmcDestroySubpictureChecked(SubpictureId Id) XvmcDestroySubpictureCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xvmcDestroySubpictureRequest(SubpictureId), cookie) + return XvmcDestroySubpictureCookie{cookie} +} + +func (cook XvmcDestroySubpictureCookie) Check() error { + return cook.check() +} + +// Write request to wire for XvmcDestroySubpicture +func (c *Conn) xvmcDestroySubpictureRequest(SubpictureId Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XVIDEO-MOTIONCOMPENSATION"] + b += 1 + + buf[b] = 7 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(SubpictureId)) + b += 4 + + return buf +} + +// Request XvmcListSubpictureTypes +// size: 12 +type XvmcListSubpictureTypesCookie struct { + *cookie +} + +func (c *Conn) XvmcListSubpictureTypes(PortId Id, SurfaceId Id) XvmcListSubpictureTypesCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xvmcListSubpictureTypesRequest(PortId, SurfaceId), cookie) + return XvmcListSubpictureTypesCookie{cookie} +} + +func (c *Conn) XvmcListSubpictureTypesUnchecked(PortId Id, SurfaceId Id) XvmcListSubpictureTypesCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xvmcListSubpictureTypesRequest(PortId, SurfaceId), cookie) + return XvmcListSubpictureTypesCookie{cookie} +} + +// Request reply for XvmcListSubpictureTypes +// size: (32 + XvImageFormatInfoListSize(Types)) +type XvmcListSubpictureTypesReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Num uint32 + // padding: 20 bytes + Types []XvImageFormatInfo // size: XvImageFormatInfoListSize(Types) +} + +// Waits and reads reply data from request XvmcListSubpictureTypes +func (cook XvmcListSubpictureTypesCookie) Reply() (*XvmcListSubpictureTypesReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xvmcListSubpictureTypesReply(buf), nil +} + +// Read reply into structure from buffer for XvmcListSubpictureTypes +func xvmcListSubpictureTypesReply(buf []byte) *XvmcListSubpictureTypesReply { + v := new(XvmcListSubpictureTypesReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.Num = Get32(buf[b:]) + b += 4 + + b += 20 // padding + + v.Types = make([]XvImageFormatInfo, v.Num) + b += ReadXvImageFormatInfoList(buf[b:], v.Types) + + return v +} + +func (cook XvmcListSubpictureTypesCookie) Check() error { + return cook.check() +} + +// Write request to wire for XvmcListSubpictureTypes +func (c *Conn) xvmcListSubpictureTypesRequest(PortId Id, SurfaceId Id) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XVIDEO-MOTIONCOMPENSATION"] + b += 1 + + buf[b] = 8 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(PortId)) + b += 4 + + Put32(buf[b:], uint32(SurfaceId)) + b += 4 + + return buf +} |