diff options
Diffstat (limited to 'nexgb/auto_randr.go')
-rw-r--r-- | nexgb/auto_randr.go | 3988 |
1 files changed, 3988 insertions, 0 deletions
diff --git a/nexgb/auto_randr.go b/nexgb/auto_randr.go new file mode 100644 index 0000000..fdb10ca --- /dev/null +++ b/nexgb/auto_randr.go @@ -0,0 +1,3988 @@ +package xgb + +/* + This file was generated by randr.xml on May 5 2012 6:06:50pm 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" + +// 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 ( + RandrRotationRotate0 = 1 + RandrRotationRotate90 = 2 + RandrRotationRotate180 = 4 + RandrRotationRotate270 = 8 + RandrRotationReflectX = 16 + RandrRotationReflectY = 32 +) + +const ( + RandrSetConfigSuccess = 0 + RandrSetConfigInvalidConfigTime = 1 + RandrSetConfigInvalidTime = 2 + RandrSetConfigFailed = 3 +) + +const ( + RandrNotifyMaskScreenChange = 1 + RandrNotifyMaskCrtcChange = 2 + RandrNotifyMaskOutputChange = 4 + RandrNotifyMaskOutputProperty = 8 +) + +const ( + RandrModeFlagHsyncPositive = 1 + RandrModeFlagHsyncNegative = 2 + RandrModeFlagVsyncPositive = 4 + RandrModeFlagVsyncNegative = 8 + RandrModeFlagInterlace = 16 + RandrModeFlagDoubleScan = 32 + RandrModeFlagCsync = 64 + RandrModeFlagCsyncPositive = 128 + RandrModeFlagCsyncNegative = 256 + RandrModeFlagHskewPresent = 512 + RandrModeFlagBcast = 1024 + RandrModeFlagPixelMultiplex = 2048 + RandrModeFlagDoubleClock = 4096 + RandrModeFlagHalveClock = 8192 +) + +const ( + RandrConnectionConnected = 0 + RandrConnectionDisconnected = 1 + RandrConnectionUnknown = 2 +) + +const ( + RandrNotifyCrtcChange = 0 + RandrNotifyOutputChange = 1 + RandrNotifyOutputProperty = 2 +) + +// Skipping resource definition of 'Mode' + +// Skipping resource definition of 'Crtc' + +// Skipping resource definition of 'Output' + +// 'RandrScreenSize' struct definition +// Size: 8 +type RandrScreenSize struct { + Width uint16 + Height uint16 + Mwidth uint16 + Mheight uint16 +} + +// Struct read RandrScreenSize +func ReadRandrScreenSize(buf []byte, v *RandrScreenSize) int { + b := 0 + + v.Width = Get16(buf[b:]) + b += 2 + + v.Height = Get16(buf[b:]) + b += 2 + + v.Mwidth = Get16(buf[b:]) + b += 2 + + v.Mheight = Get16(buf[b:]) + b += 2 + + return b +} + +// Struct list read RandrScreenSize +func ReadRandrScreenSizeList(buf []byte, dest []RandrScreenSize) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = RandrScreenSize{} + b += ReadRandrScreenSize(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write RandrScreenSize +func (v RandrScreenSize) Bytes() []byte { + buf := make([]byte, 8) + b := 0 + + Put16(buf[b:], v.Width) + b += 2 + + Put16(buf[b:], v.Height) + b += 2 + + Put16(buf[b:], v.Mwidth) + b += 2 + + Put16(buf[b:], v.Mheight) + b += 2 + + return buf +} + +// Write struct list RandrScreenSize +func RandrScreenSizeListBytes(buf []byte, list []RandrScreenSize) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'RandrRefreshRates' struct definition +// Size: (2 + pad((int(NRates) * 2))) +type RandrRefreshRates struct { + NRates uint16 + Rates []uint16 // size: pad((int(NRates) * 2)) +} + +// Struct read RandrRefreshRates +func ReadRandrRefreshRates(buf []byte, v *RandrRefreshRates) int { + b := 0 + + v.NRates = Get16(buf[b:]) + b += 2 + + v.Rates = make([]uint16, v.NRates) + for i := 0; i < int(v.NRates); i++ { + v.Rates[i] = Get16(buf[b:]) + b += 2 + } + b = pad(b) + + return b +} + +// Struct list read RandrRefreshRates +func ReadRandrRefreshRatesList(buf []byte, dest []RandrRefreshRates) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = RandrRefreshRates{} + b += ReadRandrRefreshRates(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write RandrRefreshRates +func (v RandrRefreshRates) Bytes() []byte { + buf := make([]byte, (2 + pad((int(v.NRates) * 2)))) + b := 0 + + Put16(buf[b:], v.NRates) + b += 2 + + for i := 0; i < int(v.NRates); i++ { + Put16(buf[b:], v.Rates[i]) + b += 2 + } + b = pad(b) + + return buf +} + +// Write struct list RandrRefreshRates +func RandrRefreshRatesListBytes(buf []byte, list []RandrRefreshRates) 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 RandrRefreshRates +func RandrRefreshRatesListSize(list []RandrRefreshRates) int { + size := 0 + for _, item := range list { + size += (2 + pad((int(item.NRates) * 2))) + } + return size +} + +// 'RandrModeInfo' struct definition +// Size: 32 +type RandrModeInfo struct { + Id uint32 + Width uint16 + Height uint16 + DotClock uint32 + HsyncStart uint16 + HsyncEnd uint16 + Htotal uint16 + Hskew uint16 + VsyncStart uint16 + VsyncEnd uint16 + Vtotal uint16 + NameLen uint16 + ModeFlags uint32 +} + +// Struct read RandrModeInfo +func ReadRandrModeInfo(buf []byte, v *RandrModeInfo) 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.DotClock = Get32(buf[b:]) + b += 4 + + 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.VsyncStart = Get16(buf[b:]) + b += 2 + + v.VsyncEnd = Get16(buf[b:]) + b += 2 + + v.Vtotal = Get16(buf[b:]) + b += 2 + + v.NameLen = Get16(buf[b:]) + b += 2 + + v.ModeFlags = Get32(buf[b:]) + b += 4 + + return b +} + +// Struct list read RandrModeInfo +func ReadRandrModeInfoList(buf []byte, dest []RandrModeInfo) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = RandrModeInfo{} + b += ReadRandrModeInfo(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write RandrModeInfo +func (v RandrModeInfo) Bytes() []byte { + buf := make([]byte, 32) + 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.DotClock) + b += 4 + + Put16(buf[b:], v.HsyncStart) + b += 2 + + Put16(buf[b:], v.HsyncEnd) + b += 2 + + Put16(buf[b:], v.Htotal) + b += 2 + + Put16(buf[b:], v.Hskew) + b += 2 + + Put16(buf[b:], v.VsyncStart) + b += 2 + + Put16(buf[b:], v.VsyncEnd) + b += 2 + + Put16(buf[b:], v.Vtotal) + b += 2 + + Put16(buf[b:], v.NameLen) + b += 2 + + Put32(buf[b:], v.ModeFlags) + b += 4 + + return buf +} + +// Write struct list RandrModeInfo +func RandrModeInfoListBytes(buf []byte, list []RandrModeInfo) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'RandrCrtcChange' struct definition +// Size: 28 +type RandrCrtcChange struct { + Timestamp Timestamp + Window Id + Crtc Id + Mode Id + Rotation uint16 + // padding: 2 bytes + X int16 + Y int16 + Width uint16 + Height uint16 +} + +// Struct read RandrCrtcChange +func ReadRandrCrtcChange(buf []byte, v *RandrCrtcChange) int { + b := 0 + + v.Timestamp = Timestamp(Get32(buf[b:])) + b += 4 + + v.Window = Id(Get32(buf[b:])) + b += 4 + + v.Crtc = Id(Get32(buf[b:])) + b += 4 + + v.Mode = Id(Get32(buf[b:])) + b += 4 + + v.Rotation = Get16(buf[b:]) + b += 2 + + b += 2 // padding + + 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 + + return b +} + +// Struct list read RandrCrtcChange +func ReadRandrCrtcChangeList(buf []byte, dest []RandrCrtcChange) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = RandrCrtcChange{} + b += ReadRandrCrtcChange(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write RandrCrtcChange +func (v RandrCrtcChange) Bytes() []byte { + buf := make([]byte, 28) + b := 0 + + Put32(buf[b:], uint32(v.Timestamp)) + b += 4 + + Put32(buf[b:], uint32(v.Window)) + b += 4 + + Put32(buf[b:], uint32(v.Crtc)) + b += 4 + + Put32(buf[b:], uint32(v.Mode)) + b += 4 + + Put16(buf[b:], v.Rotation) + b += 2 + + b += 2 // padding + + Put16(buf[b:], uint16(v.X)) + b += 2 + + Put16(buf[b:], uint16(v.Y)) + b += 2 + + Put16(buf[b:], v.Width) + b += 2 + + Put16(buf[b:], v.Height) + b += 2 + + return buf +} + +// Write struct list RandrCrtcChange +func RandrCrtcChangeListBytes(buf []byte, list []RandrCrtcChange) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'RandrOutputChange' struct definition +// Size: 28 +type RandrOutputChange struct { + Timestamp Timestamp + ConfigTimestamp Timestamp + Window Id + Output Id + Crtc Id + Mode Id + Rotation uint16 + Connection byte + SubpixelOrder byte +} + +// Struct read RandrOutputChange +func ReadRandrOutputChange(buf []byte, v *RandrOutputChange) int { + b := 0 + + v.Timestamp = Timestamp(Get32(buf[b:])) + b += 4 + + v.ConfigTimestamp = Timestamp(Get32(buf[b:])) + b += 4 + + v.Window = Id(Get32(buf[b:])) + b += 4 + + v.Output = Id(Get32(buf[b:])) + b += 4 + + v.Crtc = Id(Get32(buf[b:])) + b += 4 + + v.Mode = Id(Get32(buf[b:])) + b += 4 + + v.Rotation = Get16(buf[b:]) + b += 2 + + v.Connection = buf[b] + b += 1 + + v.SubpixelOrder = buf[b] + b += 1 + + return b +} + +// Struct list read RandrOutputChange +func ReadRandrOutputChangeList(buf []byte, dest []RandrOutputChange) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = RandrOutputChange{} + b += ReadRandrOutputChange(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write RandrOutputChange +func (v RandrOutputChange) Bytes() []byte { + buf := make([]byte, 28) + b := 0 + + Put32(buf[b:], uint32(v.Timestamp)) + b += 4 + + Put32(buf[b:], uint32(v.ConfigTimestamp)) + b += 4 + + Put32(buf[b:], uint32(v.Window)) + b += 4 + + Put32(buf[b:], uint32(v.Output)) + b += 4 + + Put32(buf[b:], uint32(v.Crtc)) + b += 4 + + Put32(buf[b:], uint32(v.Mode)) + b += 4 + + Put16(buf[b:], v.Rotation) + b += 2 + + buf[b] = v.Connection + b += 1 + + buf[b] = v.SubpixelOrder + b += 1 + + return buf +} + +// Write struct list RandrOutputChange +func RandrOutputChangeListBytes(buf []byte, list []RandrOutputChange) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// 'RandrOutputProperty' struct definition +// Size: 28 +type RandrOutputProperty struct { + Window Id + Output Id + Atom Id + Timestamp Timestamp + Status byte + // padding: 11 bytes +} + +// Struct read RandrOutputProperty +func ReadRandrOutputProperty(buf []byte, v *RandrOutputProperty) int { + b := 0 + + v.Window = Id(Get32(buf[b:])) + b += 4 + + v.Output = Id(Get32(buf[b:])) + b += 4 + + v.Atom = Id(Get32(buf[b:])) + b += 4 + + v.Timestamp = Timestamp(Get32(buf[b:])) + b += 4 + + v.Status = buf[b] + b += 1 + + b += 11 // padding + + return b +} + +// Struct list read RandrOutputProperty +func ReadRandrOutputPropertyList(buf []byte, dest []RandrOutputProperty) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = RandrOutputProperty{} + b += ReadRandrOutputProperty(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write RandrOutputProperty +func (v RandrOutputProperty) Bytes() []byte { + buf := make([]byte, 28) + b := 0 + + Put32(buf[b:], uint32(v.Window)) + b += 4 + + Put32(buf[b:], uint32(v.Output)) + b += 4 + + Put32(buf[b:], uint32(v.Atom)) + b += 4 + + Put32(buf[b:], uint32(v.Timestamp)) + b += 4 + + buf[b] = v.Status + b += 1 + + b += 11 // padding + + return buf +} + +// Write struct list RandrOutputProperty +func RandrOutputPropertyListBytes(buf []byte, list []RandrOutputProperty) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// Union definition RandrNotifyDataUnion +// Note that to *create* a Union, you should *never* create +// this struct directly (unless you know what you're doing). +// Instead use one of the following constructors for 'RandrNotifyDataUnion': +// NewRandrNotifyDataUnionCc(Cc RandrCrtcChange) RandrNotifyDataUnion +// NewRandrNotifyDataUnionOc(Oc RandrOutputChange) RandrNotifyDataUnion +// NewRandrNotifyDataUnionOp(Op RandrOutputProperty) RandrNotifyDataUnion +type RandrNotifyDataUnion struct { + Cc RandrCrtcChange + Oc RandrOutputChange + Op RandrOutputProperty +} + +// Union constructor for RandrNotifyDataUnion for field Cc. +func NewRandrNotifyDataUnionCc(Cc RandrCrtcChange) RandrNotifyDataUnion { + var b int + buf := make([]byte, 28) + + { + structBytes := Cc.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + + // Create the Union type + v := RandrNotifyDataUnion{} + + // Now copy buf into all fields + + b = 0 // always read the same bytes + v.Cc = RandrCrtcChange{} + b += ReadRandrCrtcChange(buf[b:], &v.Cc) + + b = 0 // always read the same bytes + v.Oc = RandrOutputChange{} + b += ReadRandrOutputChange(buf[b:], &v.Oc) + + b = 0 // always read the same bytes + v.Op = RandrOutputProperty{} + b += ReadRandrOutputProperty(buf[b:], &v.Op) + + return v +} + +// Union constructor for RandrNotifyDataUnion for field Oc. +func NewRandrNotifyDataUnionOc(Oc RandrOutputChange) RandrNotifyDataUnion { + var b int + buf := make([]byte, 28) + + { + structBytes := Oc.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + + // Create the Union type + v := RandrNotifyDataUnion{} + + // Now copy buf into all fields + + b = 0 // always read the same bytes + v.Cc = RandrCrtcChange{} + b += ReadRandrCrtcChange(buf[b:], &v.Cc) + + b = 0 // always read the same bytes + v.Oc = RandrOutputChange{} + b += ReadRandrOutputChange(buf[b:], &v.Oc) + + b = 0 // always read the same bytes + v.Op = RandrOutputProperty{} + b += ReadRandrOutputProperty(buf[b:], &v.Op) + + return v +} + +// Union constructor for RandrNotifyDataUnion for field Op. +func NewRandrNotifyDataUnionOp(Op RandrOutputProperty) RandrNotifyDataUnion { + var b int + buf := make([]byte, 28) + + { + structBytes := Op.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + + // Create the Union type + v := RandrNotifyDataUnion{} + + // Now copy buf into all fields + + b = 0 // always read the same bytes + v.Cc = RandrCrtcChange{} + b += ReadRandrCrtcChange(buf[b:], &v.Cc) + + b = 0 // always read the same bytes + v.Oc = RandrOutputChange{} + b += ReadRandrOutputChange(buf[b:], &v.Oc) + + b = 0 // always read the same bytes + v.Op = RandrOutputProperty{} + b += ReadRandrOutputProperty(buf[b:], &v.Op) + + return v +} + +// Union read RandrNotifyDataUnion +func ReadRandrNotifyDataUnion(buf []byte, v *RandrNotifyDataUnion) int { + var b int + + b = 0 // re-read the same bytes + v.Cc = RandrCrtcChange{} + b += ReadRandrCrtcChange(buf[b:], &v.Cc) + + b = 0 // re-read the same bytes + v.Oc = RandrOutputChange{} + b += ReadRandrOutputChange(buf[b:], &v.Oc) + + b = 0 // re-read the same bytes + v.Op = RandrOutputProperty{} + b += ReadRandrOutputProperty(buf[b:], &v.Op) + + return 28 +} + +// Union list read RandrNotifyDataUnion +func ReadRandrNotifyDataUnionList(buf []byte, dest []RandrNotifyDataUnion) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = RandrNotifyDataUnion{} + b += ReadRandrNotifyDataUnion(buf[b:], &dest[i]) + } + return pad(b) +} + +// Union write RandrNotifyDataUnion +// Each field in a union must contain the same data. +// So simply pick the first field and write that to the wire. +func (v RandrNotifyDataUnion) Bytes() []byte { + buf := make([]byte, 28) + b := 0 + + { + structBytes := v.Cc.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return buf +} + +// Union list write RandrNotifyDataUnion +func RandrNotifyDataUnionListBytes(buf []byte, list []RandrNotifyDataUnion) int { + b := 0 + var unionBytes []byte + for _, item := range list { + unionBytes = item.Bytes() + copy(buf[b:], unionBytes) + b += pad(len(unionBytes)) + } + return b +} + +// Event definition RandrScreenChangeNotify (0) +// Size: 32 + +const RandrScreenChangeNotify = 0 + +type RandrScreenChangeNotifyEvent struct { + Sequence uint16 + Rotation byte + Timestamp Timestamp + ConfigTimestamp Timestamp + Root Id + RequestWindow Id + SizeID uint16 + SubpixelOrder uint16 + Width uint16 + Height uint16 + Mwidth uint16 + Mheight uint16 +} + +// Event read RandrScreenChangeNotify +func NewRandrScreenChangeNotifyEvent(buf []byte) Event { + v := RandrScreenChangeNotifyEvent{} + b := 1 // don't read event number + + v.Rotation = buf[b] + b += 1 + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Timestamp = Timestamp(Get32(buf[b:])) + b += 4 + + v.ConfigTimestamp = Timestamp(Get32(buf[b:])) + b += 4 + + v.Root = Id(Get32(buf[b:])) + b += 4 + + v.RequestWindow = Id(Get32(buf[b:])) + b += 4 + + v.SizeID = Get16(buf[b:]) + b += 2 + + v.SubpixelOrder = Get16(buf[b:]) + b += 2 + + v.Width = Get16(buf[b:]) + b += 2 + + v.Height = Get16(buf[b:]) + b += 2 + + v.Mwidth = Get16(buf[b:]) + b += 2 + + v.Mheight = Get16(buf[b:]) + b += 2 + + return v +} + +// Event write RandrScreenChangeNotify +func (v RandrScreenChangeNotifyEvent) Bytes() []byte { + buf := make([]byte, 32) + b := 0 + + // write event number + buf[b] = 0 + b += 1 + + buf[b] = v.Rotation + b += 1 + + b += 2 // skip sequence number + + Put32(buf[b:], uint32(v.Timestamp)) + b += 4 + + Put32(buf[b:], uint32(v.ConfigTimestamp)) + b += 4 + + Put32(buf[b:], uint32(v.Root)) + b += 4 + + Put32(buf[b:], uint32(v.RequestWindow)) + b += 4 + + Put16(buf[b:], v.SizeID) + b += 2 + + Put16(buf[b:], v.SubpixelOrder) + b += 2 + + Put16(buf[b:], v.Width) + b += 2 + + Put16(buf[b:], v.Height) + b += 2 + + Put16(buf[b:], v.Mwidth) + b += 2 + + Put16(buf[b:], v.Mheight) + b += 2 + + return buf +} + +func (v RandrScreenChangeNotifyEvent) ImplementsEvent() {} + +func (v RandrScreenChangeNotifyEvent) SequenceId() uint16 { + return v.Sequence +} + +func (v RandrScreenChangeNotifyEvent) String() string { + fieldVals := make([]string, 0, 11) + fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) + fieldVals = append(fieldVals, sprintf("Rotation: %d", v.Rotation)) + fieldVals = append(fieldVals, sprintf("Timestamp: %d", v.Timestamp)) + fieldVals = append(fieldVals, sprintf("ConfigTimestamp: %d", v.ConfigTimestamp)) + fieldVals = append(fieldVals, sprintf("Root: %d", v.Root)) + fieldVals = append(fieldVals, sprintf("RequestWindow: %d", v.RequestWindow)) + fieldVals = append(fieldVals, sprintf("SizeID: %d", v.SizeID)) + fieldVals = append(fieldVals, sprintf("SubpixelOrder: %d", v.SubpixelOrder)) + fieldVals = append(fieldVals, sprintf("Width: %d", v.Width)) + fieldVals = append(fieldVals, sprintf("Height: %d", v.Height)) + fieldVals = append(fieldVals, sprintf("Mwidth: %d", v.Mwidth)) + fieldVals = append(fieldVals, sprintf("Mheight: %d", v.Mheight)) + return "RandrScreenChangeNotify {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newEventFuncs[0] = NewRandrScreenChangeNotifyEvent +} + +// Event definition RandrNotify (1) +// Size: 32 + +const RandrNotify = 1 + +type RandrNotifyEvent struct { + Sequence uint16 + SubCode byte + U RandrNotifyDataUnion +} + +// Event read RandrNotify +func NewRandrNotifyEvent(buf []byte) Event { + v := RandrNotifyEvent{} + b := 1 // don't read event number + + v.SubCode = buf[b] + b += 1 + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.U = RandrNotifyDataUnion{} + b += ReadRandrNotifyDataUnion(buf[b:], &v.U) + + return v +} + +// Event write RandrNotify +func (v RandrNotifyEvent) Bytes() []byte { + buf := make([]byte, 32) + b := 0 + + // write event number + buf[b] = 1 + b += 1 + + buf[b] = v.SubCode + b += 1 + + b += 2 // skip sequence number + + { + unionBytes := v.U.Bytes() + copy(buf[b:], unionBytes) + b += pad(len(unionBytes)) + } + + return buf +} + +func (v RandrNotifyEvent) ImplementsEvent() {} + +func (v RandrNotifyEvent) SequenceId() uint16 { + return v.Sequence +} + +func (v RandrNotifyEvent) String() string { + fieldVals := make([]string, 0, 2) + fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) + fieldVals = append(fieldVals, sprintf("SubCode: %d", v.SubCode)) + return "RandrNotify {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newEventFuncs[1] = NewRandrNotifyEvent +} + +// Error definition RandrBadOutput (0) +// Size: 32 + +const BadRandrBadOutput = 0 + +type RandrBadOutputError struct { + Sequence uint16 + NiceName string +} + +// Error read RandrBadOutput +func NewRandrBadOutputError(buf []byte) Error { + v := RandrBadOutputError{} + v.NiceName = "RandrBadOutput" + + b := 1 // skip error determinant + b += 1 // don't read error number + + v.Sequence = Get16(buf[b:]) + b += 2 + + return v +} + +func (err RandrBadOutputError) ImplementsError() {} + +func (err RandrBadOutputError) SequenceId() uint16 { + return err.Sequence +} + +func (err RandrBadOutputError) BadId() Id { + return 0 +} + +func (err RandrBadOutputError) Error() string { + fieldVals := make([]string, 0, 0) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) + return "BadRandrBadOutput {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newErrorFuncs[0] = NewRandrBadOutputError +} + +// Error definition RandrBadCrtc (1) +// Size: 32 + +const BadRandrBadCrtc = 1 + +type RandrBadCrtcError struct { + Sequence uint16 + NiceName string +} + +// Error read RandrBadCrtc +func NewRandrBadCrtcError(buf []byte) Error { + v := RandrBadCrtcError{} + v.NiceName = "RandrBadCrtc" + + b := 1 // skip error determinant + b += 1 // don't read error number + + v.Sequence = Get16(buf[b:]) + b += 2 + + return v +} + +func (err RandrBadCrtcError) ImplementsError() {} + +func (err RandrBadCrtcError) SequenceId() uint16 { + return err.Sequence +} + +func (err RandrBadCrtcError) BadId() Id { + return 0 +} + +func (err RandrBadCrtcError) Error() string { + fieldVals := make([]string, 0, 0) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) + return "BadRandrBadCrtc {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newErrorFuncs[1] = NewRandrBadCrtcError +} + +// Error definition RandrBadMode (2) +// Size: 32 + +const BadRandrBadMode = 2 + +type RandrBadModeError struct { + Sequence uint16 + NiceName string +} + +// Error read RandrBadMode +func NewRandrBadModeError(buf []byte) Error { + v := RandrBadModeError{} + v.NiceName = "RandrBadMode" + + b := 1 // skip error determinant + b += 1 // don't read error number + + v.Sequence = Get16(buf[b:]) + b += 2 + + return v +} + +func (err RandrBadModeError) ImplementsError() {} + +func (err RandrBadModeError) SequenceId() uint16 { + return err.Sequence +} + +func (err RandrBadModeError) BadId() Id { + return 0 +} + +func (err RandrBadModeError) Error() string { + fieldVals := make([]string, 0, 0) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) + return "BadRandrBadMode {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newErrorFuncs[2] = NewRandrBadModeError +} + +// Request RandrQueryVersion +// size: 12 +type RandrQueryVersionCookie struct { + *cookie +} + +func (c *Conn) RandrQueryVersion(MajorVersion uint32, MinorVersion uint32) RandrQueryVersionCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.randrQueryVersionRequest(MajorVersion, MinorVersion), cookie) + return RandrQueryVersionCookie{cookie} +} + +func (c *Conn) RandrQueryVersionUnchecked(MajorVersion uint32, MinorVersion uint32) RandrQueryVersionCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.randrQueryVersionRequest(MajorVersion, MinorVersion), cookie) + return RandrQueryVersionCookie{cookie} +} + +// Request reply for RandrQueryVersion +// size: 32 +type RandrQueryVersionReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + MajorVersion uint32 + MinorVersion uint32 + // padding: 16 bytes +} + +// Waits and reads reply data from request RandrQueryVersion +func (cook RandrQueryVersionCookie) Reply() (*RandrQueryVersionReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return randrQueryVersionReply(buf), nil +} + +// Read reply into structure from buffer for RandrQueryVersion +func randrQueryVersionReply(buf []byte) *RandrQueryVersionReply { + v := new(RandrQueryVersionReply) + 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 RandrQueryVersionCookie) Check() error { + return cook.check() +} + +// Write request to wire for RandrQueryVersion +func (c *Conn) randrQueryVersionRequest(MajorVersion uint32, MinorVersion uint32) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RANDR"] + 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 RandrSetScreenConfig +// size: 24 +type RandrSetScreenConfigCookie struct { + *cookie +} + +func (c *Conn) RandrSetScreenConfig(Window Id, Timestamp Timestamp, ConfigTimestamp Timestamp, SizeID uint16, Rotation uint16, Rate uint16) RandrSetScreenConfigCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.randrSetScreenConfigRequest(Window, Timestamp, ConfigTimestamp, SizeID, Rotation, Rate), cookie) + return RandrSetScreenConfigCookie{cookie} +} + +func (c *Conn) RandrSetScreenConfigUnchecked(Window Id, Timestamp Timestamp, ConfigTimestamp Timestamp, SizeID uint16, Rotation uint16, Rate uint16) RandrSetScreenConfigCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.randrSetScreenConfigRequest(Window, Timestamp, ConfigTimestamp, SizeID, Rotation, Rate), cookie) + return RandrSetScreenConfigCookie{cookie} +} + +// Request reply for RandrSetScreenConfig +// size: 32 +type RandrSetScreenConfigReply struct { + Sequence uint16 + Length uint32 + Status byte + NewTimestamp Timestamp + ConfigTimestamp Timestamp + Root Id + SubpixelOrder uint16 + // padding: 10 bytes +} + +// Waits and reads reply data from request RandrSetScreenConfig +func (cook RandrSetScreenConfigCookie) Reply() (*RandrSetScreenConfigReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return randrSetScreenConfigReply(buf), nil +} + +// Read reply into structure from buffer for RandrSetScreenConfig +func randrSetScreenConfigReply(buf []byte) *RandrSetScreenConfigReply { + v := new(RandrSetScreenConfigReply) + b := 1 // skip reply determinant + + v.Status = buf[b] + b += 1 + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.NewTimestamp = Timestamp(Get32(buf[b:])) + b += 4 + + v.ConfigTimestamp = Timestamp(Get32(buf[b:])) + b += 4 + + v.Root = Id(Get32(buf[b:])) + b += 4 + + v.SubpixelOrder = Get16(buf[b:]) + b += 2 + + b += 10 // padding + + return v +} + +func (cook RandrSetScreenConfigCookie) Check() error { + return cook.check() +} + +// Write request to wire for RandrSetScreenConfig +func (c *Conn) randrSetScreenConfigRequest(Window Id, Timestamp Timestamp, ConfigTimestamp Timestamp, SizeID uint16, Rotation uint16, Rate uint16) []byte { + size := 24 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RANDR"] + 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(Timestamp)) + b += 4 + + Put32(buf[b:], uint32(ConfigTimestamp)) + b += 4 + + Put16(buf[b:], SizeID) + b += 2 + + Put16(buf[b:], Rotation) + b += 2 + + Put16(buf[b:], Rate) + b += 2 + + b += 2 // padding + + return buf +} + +// Request RandrSelectInput +// size: 12 +type RandrSelectInputCookie struct { + *cookie +} + +// Write request to wire for RandrSelectInput +func (c *Conn) RandrSelectInput(Window Id, Enable uint16) RandrSelectInputCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.randrSelectInputRequest(Window, Enable), cookie) + return RandrSelectInputCookie{cookie} +} + +func (c *Conn) RandrSelectInputChecked(Window Id, Enable uint16) RandrSelectInputCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.randrSelectInputRequest(Window, Enable), cookie) + return RandrSelectInputCookie{cookie} +} + +func (cook RandrSelectInputCookie) Check() error { + return cook.check() +} + +// Write request to wire for RandrSelectInput +func (c *Conn) randrSelectInputRequest(Window Id, Enable uint16) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RANDR"] + 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 + + Put16(buf[b:], Enable) + b += 2 + + b += 2 // padding + + return buf +} + +// Request RandrGetScreenInfo +// size: 8 +type RandrGetScreenInfoCookie struct { + *cookie +} + +func (c *Conn) RandrGetScreenInfo(Window Id) RandrGetScreenInfoCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.randrGetScreenInfoRequest(Window), cookie) + return RandrGetScreenInfoCookie{cookie} +} + +func (c *Conn) RandrGetScreenInfoUnchecked(Window Id) RandrGetScreenInfoCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.randrGetScreenInfoRequest(Window), cookie) + return RandrGetScreenInfoCookie{cookie} +} + +// Request reply for RandrGetScreenInfo +// size: ((32 + pad((int(NSizes) * 8))) + RandrRefreshRatesListSize(Rates)) +type RandrGetScreenInfoReply struct { + Sequence uint16 + Length uint32 + Rotations byte + Root Id + Timestamp Timestamp + ConfigTimestamp Timestamp + NSizes uint16 + SizeID uint16 + Rotation uint16 + Rate uint16 + NInfo uint16 + // padding: 2 bytes + Sizes []RandrScreenSize // size: pad((int(NSizes) * 8)) + Rates []RandrRefreshRates // size: RandrRefreshRatesListSize(Rates) +} + +// Waits and reads reply data from request RandrGetScreenInfo +func (cook RandrGetScreenInfoCookie) Reply() (*RandrGetScreenInfoReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return randrGetScreenInfoReply(buf), nil +} + +// Read reply into structure from buffer for RandrGetScreenInfo +func randrGetScreenInfoReply(buf []byte) *RandrGetScreenInfoReply { + v := new(RandrGetScreenInfoReply) + b := 1 // skip reply determinant + + v.Rotations = buf[b] + b += 1 + + 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 + + v.Timestamp = Timestamp(Get32(buf[b:])) + b += 4 + + v.ConfigTimestamp = Timestamp(Get32(buf[b:])) + b += 4 + + v.NSizes = Get16(buf[b:]) + b += 2 + + v.SizeID = Get16(buf[b:]) + b += 2 + + v.Rotation = Get16(buf[b:]) + b += 2 + + v.Rate = Get16(buf[b:]) + b += 2 + + v.NInfo = Get16(buf[b:]) + b += 2 + + b += 2 // padding + + v.Sizes = make([]RandrScreenSize, v.NSizes) + b += ReadRandrScreenSizeList(buf[b:], v.Sizes) + + v.Rates = make([]RandrRefreshRates, (int(v.NInfo) - int(v.NSizes))) + b += ReadRandrRefreshRatesList(buf[b:], v.Rates) + + return v +} + +func (cook RandrGetScreenInfoCookie) Check() error { + return cook.check() +} + +// Write request to wire for RandrGetScreenInfo +func (c *Conn) randrGetScreenInfoRequest(Window Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RANDR"] + 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(Window)) + b += 4 + + return buf +} + +// Request RandrGetScreenSizeRange +// size: 8 +type RandrGetScreenSizeRangeCookie struct { + *cookie +} + +func (c *Conn) RandrGetScreenSizeRange(Window Id) RandrGetScreenSizeRangeCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.randrGetScreenSizeRangeRequest(Window), cookie) + return RandrGetScreenSizeRangeCookie{cookie} +} + +func (c *Conn) RandrGetScreenSizeRangeUnchecked(Window Id) RandrGetScreenSizeRangeCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.randrGetScreenSizeRangeRequest(Window), cookie) + return RandrGetScreenSizeRangeCookie{cookie} +} + +// Request reply for RandrGetScreenSizeRange +// size: 32 +type RandrGetScreenSizeRangeReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + MinWidth uint16 + MinHeight uint16 + MaxWidth uint16 + MaxHeight uint16 + // padding: 16 bytes +} + +// Waits and reads reply data from request RandrGetScreenSizeRange +func (cook RandrGetScreenSizeRangeCookie) Reply() (*RandrGetScreenSizeRangeReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return randrGetScreenSizeRangeReply(buf), nil +} + +// Read reply into structure from buffer for RandrGetScreenSizeRange +func randrGetScreenSizeRangeReply(buf []byte) *RandrGetScreenSizeRangeReply { + v := new(RandrGetScreenSizeRangeReply) + 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.MinWidth = Get16(buf[b:]) + b += 2 + + v.MinHeight = Get16(buf[b:]) + b += 2 + + v.MaxWidth = Get16(buf[b:]) + b += 2 + + v.MaxHeight = Get16(buf[b:]) + b += 2 + + b += 16 // padding + + return v +} + +func (cook RandrGetScreenSizeRangeCookie) Check() error { + return cook.check() +} + +// Write request to wire for RandrGetScreenSizeRange +func (c *Conn) randrGetScreenSizeRangeRequest(Window Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RANDR"] + 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 + + return buf +} + +// Request RandrSetScreenSize +// size: 20 +type RandrSetScreenSizeCookie struct { + *cookie +} + +// Write request to wire for RandrSetScreenSize +func (c *Conn) RandrSetScreenSize(Window Id, Width uint16, Height uint16, MmWidth uint32, MmHeight uint32) RandrSetScreenSizeCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.randrSetScreenSizeRequest(Window, Width, Height, MmWidth, MmHeight), cookie) + return RandrSetScreenSizeCookie{cookie} +} + +func (c *Conn) RandrSetScreenSizeChecked(Window Id, Width uint16, Height uint16, MmWidth uint32, MmHeight uint32) RandrSetScreenSizeCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.randrSetScreenSizeRequest(Window, Width, Height, MmWidth, MmHeight), cookie) + return RandrSetScreenSizeCookie{cookie} +} + +func (cook RandrSetScreenSizeCookie) Check() error { + return cook.check() +} + +// Write request to wire for RandrSetScreenSize +func (c *Conn) randrSetScreenSizeRequest(Window Id, Width uint16, Height uint16, MmWidth uint32, MmHeight uint32) []byte { + size := 20 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RANDR"] + 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 + + Put16(buf[b:], Width) + b += 2 + + Put16(buf[b:], Height) + b += 2 + + Put32(buf[b:], MmWidth) + b += 4 + + Put32(buf[b:], MmHeight) + b += 4 + + return buf +} + +// Request RandrGetScreenResources +// size: 8 +type RandrGetScreenResourcesCookie struct { + *cookie +} + +func (c *Conn) RandrGetScreenResources(Window Id) RandrGetScreenResourcesCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.randrGetScreenResourcesRequest(Window), cookie) + return RandrGetScreenResourcesCookie{cookie} +} + +func (c *Conn) RandrGetScreenResourcesUnchecked(Window Id) RandrGetScreenResourcesCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.randrGetScreenResourcesRequest(Window), cookie) + return RandrGetScreenResourcesCookie{cookie} +} + +// Request reply for RandrGetScreenResources +// size: ((((32 + pad((int(NumCrtcs) * 4))) + pad((int(NumOutputs) * 4))) + pad((int(NumModes) * 32))) + pad((int(NamesLen) * 1))) +type RandrGetScreenResourcesReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Timestamp Timestamp + ConfigTimestamp Timestamp + NumCrtcs uint16 + NumOutputs uint16 + NumModes uint16 + NamesLen uint16 + // padding: 8 bytes + Crtcs []Id // size: pad((int(NumCrtcs) * 4)) + Outputs []Id // size: pad((int(NumOutputs) * 4)) + Modes []RandrModeInfo // size: pad((int(NumModes) * 32)) + Names []byte // size: pad((int(NamesLen) * 1)) +} + +// Waits and reads reply data from request RandrGetScreenResources +func (cook RandrGetScreenResourcesCookie) Reply() (*RandrGetScreenResourcesReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return randrGetScreenResourcesReply(buf), nil +} + +// Read reply into structure from buffer for RandrGetScreenResources +func randrGetScreenResourcesReply(buf []byte) *RandrGetScreenResourcesReply { + v := new(RandrGetScreenResourcesReply) + 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.Timestamp = Timestamp(Get32(buf[b:])) + b += 4 + + v.ConfigTimestamp = Timestamp(Get32(buf[b:])) + b += 4 + + v.NumCrtcs = Get16(buf[b:]) + b += 2 + + v.NumOutputs = Get16(buf[b:]) + b += 2 + + v.NumModes = Get16(buf[b:]) + b += 2 + + v.NamesLen = Get16(buf[b:]) + b += 2 + + b += 8 // padding + + v.Crtcs = make([]Id, v.NumCrtcs) + for i := 0; i < int(v.NumCrtcs); i++ { + v.Crtcs[i] = Id(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + v.Outputs = make([]Id, v.NumOutputs) + for i := 0; i < int(v.NumOutputs); i++ { + v.Outputs[i] = Id(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + v.Modes = make([]RandrModeInfo, v.NumModes) + b += ReadRandrModeInfoList(buf[b:], v.Modes) + + v.Names = make([]byte, v.NamesLen) + copy(v.Names[:v.NamesLen], buf[b:]) + b += pad(int(v.NamesLen)) + + return v +} + +func (cook RandrGetScreenResourcesCookie) Check() error { + return cook.check() +} + +// Write request to wire for RandrGetScreenResources +func (c *Conn) randrGetScreenResourcesRequest(Window Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RANDR"] + 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 +} + +// Request RandrGetOutputInfo +// size: 12 +type RandrGetOutputInfoCookie struct { + *cookie +} + +func (c *Conn) RandrGetOutputInfo(Output Id, ConfigTimestamp Timestamp) RandrGetOutputInfoCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.randrGetOutputInfoRequest(Output, ConfigTimestamp), cookie) + return RandrGetOutputInfoCookie{cookie} +} + +func (c *Conn) RandrGetOutputInfoUnchecked(Output Id, ConfigTimestamp Timestamp) RandrGetOutputInfoCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.randrGetOutputInfoRequest(Output, ConfigTimestamp), cookie) + return RandrGetOutputInfoCookie{cookie} +} + +// Request reply for RandrGetOutputInfo +// size: ((((36 + pad((int(NumCrtcs) * 4))) + pad((int(NumModes) * 4))) + pad((int(NumClones) * 4))) + pad((int(NameLen) * 1))) +type RandrGetOutputInfoReply struct { + Sequence uint16 + Length uint32 + Status byte + Timestamp Timestamp + Crtc Id + MmWidth uint32 + MmHeight uint32 + Connection byte + SubpixelOrder byte + NumCrtcs uint16 + NumModes uint16 + NumPreferred uint16 + NumClones uint16 + NameLen uint16 + Crtcs []Id // size: pad((int(NumCrtcs) * 4)) + Modes []Id // size: pad((int(NumModes) * 4)) + Clones []Id // size: pad((int(NumClones) * 4)) + Name []byte // size: pad((int(NameLen) * 1)) +} + +// Waits and reads reply data from request RandrGetOutputInfo +func (cook RandrGetOutputInfoCookie) Reply() (*RandrGetOutputInfoReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return randrGetOutputInfoReply(buf), nil +} + +// Read reply into structure from buffer for RandrGetOutputInfo +func randrGetOutputInfoReply(buf []byte) *RandrGetOutputInfoReply { + v := new(RandrGetOutputInfoReply) + b := 1 // skip reply determinant + + v.Status = buf[b] + b += 1 + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.Timestamp = Timestamp(Get32(buf[b:])) + b += 4 + + v.Crtc = Id(Get32(buf[b:])) + b += 4 + + v.MmWidth = Get32(buf[b:]) + b += 4 + + v.MmHeight = Get32(buf[b:]) + b += 4 + + v.Connection = buf[b] + b += 1 + + v.SubpixelOrder = buf[b] + b += 1 + + v.NumCrtcs = Get16(buf[b:]) + b += 2 + + v.NumModes = Get16(buf[b:]) + b += 2 + + v.NumPreferred = Get16(buf[b:]) + b += 2 + + v.NumClones = Get16(buf[b:]) + b += 2 + + v.NameLen = Get16(buf[b:]) + b += 2 + + v.Crtcs = make([]Id, v.NumCrtcs) + for i := 0; i < int(v.NumCrtcs); i++ { + v.Crtcs[i] = Id(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + v.Modes = make([]Id, v.NumModes) + for i := 0; i < int(v.NumModes); i++ { + v.Modes[i] = Id(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + v.Clones = make([]Id, v.NumClones) + for i := 0; i < int(v.NumClones); i++ { + v.Clones[i] = Id(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + v.Name = make([]byte, v.NameLen) + copy(v.Name[:v.NameLen], buf[b:]) + b += pad(int(v.NameLen)) + + return v +} + +func (cook RandrGetOutputInfoCookie) Check() error { + return cook.check() +} + +// Write request to wire for RandrGetOutputInfo +func (c *Conn) randrGetOutputInfoRequest(Output Id, ConfigTimestamp Timestamp) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RANDR"] + 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(Output)) + b += 4 + + Put32(buf[b:], uint32(ConfigTimestamp)) + b += 4 + + return buf +} + +// Request RandrListOutputProperties +// size: 8 +type RandrListOutputPropertiesCookie struct { + *cookie +} + +func (c *Conn) RandrListOutputProperties(Output Id) RandrListOutputPropertiesCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.randrListOutputPropertiesRequest(Output), cookie) + return RandrListOutputPropertiesCookie{cookie} +} + +func (c *Conn) RandrListOutputPropertiesUnchecked(Output Id) RandrListOutputPropertiesCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.randrListOutputPropertiesRequest(Output), cookie) + return RandrListOutputPropertiesCookie{cookie} +} + +// Request reply for RandrListOutputProperties +// size: (32 + pad((int(NumAtoms) * 4))) +type RandrListOutputPropertiesReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + NumAtoms uint16 + // padding: 22 bytes + Atoms []Id // size: pad((int(NumAtoms) * 4)) +} + +// Waits and reads reply data from request RandrListOutputProperties +func (cook RandrListOutputPropertiesCookie) Reply() (*RandrListOutputPropertiesReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return randrListOutputPropertiesReply(buf), nil +} + +// Read reply into structure from buffer for RandrListOutputProperties +func randrListOutputPropertiesReply(buf []byte) *RandrListOutputPropertiesReply { + v := new(RandrListOutputPropertiesReply) + 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.NumAtoms = Get16(buf[b:]) + b += 2 + + b += 22 // padding + + v.Atoms = make([]Id, v.NumAtoms) + for i := 0; i < int(v.NumAtoms); i++ { + v.Atoms[i] = Id(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + return v +} + +func (cook RandrListOutputPropertiesCookie) Check() error { + return cook.check() +} + +// Write request to wire for RandrListOutputProperties +func (c *Conn) randrListOutputPropertiesRequest(Output Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RANDR"] + 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(Output)) + b += 4 + + return buf +} + +// Request RandrQueryOutputProperty +// size: 12 +type RandrQueryOutputPropertyCookie struct { + *cookie +} + +func (c *Conn) RandrQueryOutputProperty(Output Id, Property Id) RandrQueryOutputPropertyCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.randrQueryOutputPropertyRequest(Output, Property), cookie) + return RandrQueryOutputPropertyCookie{cookie} +} + +func (c *Conn) RandrQueryOutputPropertyUnchecked(Output Id, Property Id) RandrQueryOutputPropertyCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.randrQueryOutputPropertyRequest(Output, Property), cookie) + return RandrQueryOutputPropertyCookie{cookie} +} + +// Request reply for RandrQueryOutputProperty +// size: (32 + pad((int(Length) * 4))) +type RandrQueryOutputPropertyReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Pending bool + Range bool + Immutable bool + // padding: 21 bytes + ValidValues []int32 // size: pad((int(Length) * 4)) +} + +// Waits and reads reply data from request RandrQueryOutputProperty +func (cook RandrQueryOutputPropertyCookie) Reply() (*RandrQueryOutputPropertyReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return randrQueryOutputPropertyReply(buf), nil +} + +// Read reply into structure from buffer for RandrQueryOutputProperty +func randrQueryOutputPropertyReply(buf []byte) *RandrQueryOutputPropertyReply { + v := new(RandrQueryOutputPropertyReply) + 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.Pending = true + } else { + v.Pending = false + } + b += 1 + + if buf[b] == 1 { + v.Range = true + } else { + v.Range = false + } + b += 1 + + if buf[b] == 1 { + v.Immutable = true + } else { + v.Immutable = false + } + b += 1 + + b += 21 // padding + + v.ValidValues = make([]int32, v.Length) + for i := 0; i < int(v.Length); i++ { + v.ValidValues[i] = int32(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + return v +} + +func (cook RandrQueryOutputPropertyCookie) Check() error { + return cook.check() +} + +// Write request to wire for RandrQueryOutputProperty +func (c *Conn) randrQueryOutputPropertyRequest(Output Id, Property Id) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RANDR"] + 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(Output)) + b += 4 + + Put32(buf[b:], uint32(Property)) + b += 4 + + return buf +} + +// Request RandrConfigureOutputProperty +// size: pad((16 + pad((len(Values) * 4)))) +type RandrConfigureOutputPropertyCookie struct { + *cookie +} + +// Write request to wire for RandrConfigureOutputProperty +func (c *Conn) RandrConfigureOutputProperty(Output Id, Property Id, Pending bool, Range bool, Values []int32) RandrConfigureOutputPropertyCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.randrConfigureOutputPropertyRequest(Output, Property, Pending, Range, Values), cookie) + return RandrConfigureOutputPropertyCookie{cookie} +} + +func (c *Conn) RandrConfigureOutputPropertyChecked(Output Id, Property Id, Pending bool, Range bool, Values []int32) RandrConfigureOutputPropertyCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.randrConfigureOutputPropertyRequest(Output, Property, Pending, Range, Values), cookie) + return RandrConfigureOutputPropertyCookie{cookie} +} + +func (cook RandrConfigureOutputPropertyCookie) Check() error { + return cook.check() +} + +// Write request to wire for RandrConfigureOutputProperty +func (c *Conn) randrConfigureOutputPropertyRequest(Output Id, Property Id, Pending bool, Range bool, Values []int32) []byte { + size := pad((16 + pad((len(Values) * 4)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RANDR"] + 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(Output)) + b += 4 + + Put32(buf[b:], uint32(Property)) + b += 4 + + if Pending { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + if Range { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + b += 2 // padding + + for i := 0; i < int(len(Values)); i++ { + Put32(buf[b:], uint32(Values[i])) + b += 4 + } + b = pad(b) + + return buf +} + +// Request RandrChangeOutputProperty +// size: pad((24 + pad((((int(NumUnits) * int(Format)) / 8) * 1)))) +type RandrChangeOutputPropertyCookie struct { + *cookie +} + +// Write request to wire for RandrChangeOutputProperty +func (c *Conn) RandrChangeOutputProperty(Output Id, Property Id, Type Id, Format byte, Mode byte, NumUnits uint32, Data []byte) RandrChangeOutputPropertyCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.randrChangeOutputPropertyRequest(Output, Property, Type, Format, Mode, NumUnits, Data), cookie) + return RandrChangeOutputPropertyCookie{cookie} +} + +func (c *Conn) RandrChangeOutputPropertyChecked(Output Id, Property Id, Type Id, Format byte, Mode byte, NumUnits uint32, Data []byte) RandrChangeOutputPropertyCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.randrChangeOutputPropertyRequest(Output, Property, Type, Format, Mode, NumUnits, Data), cookie) + return RandrChangeOutputPropertyCookie{cookie} +} + +func (cook RandrChangeOutputPropertyCookie) Check() error { + return cook.check() +} + +// Write request to wire for RandrChangeOutputProperty +func (c *Conn) randrChangeOutputPropertyRequest(Output Id, Property Id, Type Id, Format byte, Mode byte, NumUnits uint32, Data []byte) []byte { + size := pad((24 + pad((((int(NumUnits) * int(Format)) / 8) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RANDR"] + 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(Output)) + b += 4 + + Put32(buf[b:], uint32(Property)) + b += 4 + + Put32(buf[b:], uint32(Type)) + b += 4 + + buf[b] = Format + b += 1 + + buf[b] = Mode + b += 1 + + b += 2 // padding + + Put32(buf[b:], NumUnits) + b += 4 + + copy(buf[b:], Data[:((int(NumUnits)*int(Format))/8)]) + b += pad(int(((int(NumUnits) * int(Format)) / 8))) + + return buf +} + +// Request RandrDeleteOutputProperty +// size: 12 +type RandrDeleteOutputPropertyCookie struct { + *cookie +} + +// Write request to wire for RandrDeleteOutputProperty +func (c *Conn) RandrDeleteOutputProperty(Output Id, Property Id) RandrDeleteOutputPropertyCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.randrDeleteOutputPropertyRequest(Output, Property), cookie) + return RandrDeleteOutputPropertyCookie{cookie} +} + +func (c *Conn) RandrDeleteOutputPropertyChecked(Output Id, Property Id) RandrDeleteOutputPropertyCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.randrDeleteOutputPropertyRequest(Output, Property), cookie) + return RandrDeleteOutputPropertyCookie{cookie} +} + +func (cook RandrDeleteOutputPropertyCookie) Check() error { + return cook.check() +} + +// Write request to wire for RandrDeleteOutputProperty +func (c *Conn) randrDeleteOutputPropertyRequest(Output Id, Property Id) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RANDR"] + 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(Output)) + b += 4 + + Put32(buf[b:], uint32(Property)) + b += 4 + + return buf +} + +// Request RandrGetOutputProperty +// size: 28 +type RandrGetOutputPropertyCookie struct { + *cookie +} + +func (c *Conn) RandrGetOutputProperty(Output Id, Property Id, Type Id, LongOffset uint32, LongLength uint32, Delete bool, Pending bool) RandrGetOutputPropertyCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.randrGetOutputPropertyRequest(Output, Property, Type, LongOffset, LongLength, Delete, Pending), cookie) + return RandrGetOutputPropertyCookie{cookie} +} + +func (c *Conn) RandrGetOutputPropertyUnchecked(Output Id, Property Id, Type Id, LongOffset uint32, LongLength uint32, Delete bool, Pending bool) RandrGetOutputPropertyCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.randrGetOutputPropertyRequest(Output, Property, Type, LongOffset, LongLength, Delete, Pending), cookie) + return RandrGetOutputPropertyCookie{cookie} +} + +// Request reply for RandrGetOutputProperty +// size: (32 + pad(((int(NumItems) * (int(Format) / 8)) * 1))) +type RandrGetOutputPropertyReply struct { + Sequence uint16 + Length uint32 + Format byte + Type Id + BytesAfter uint32 + NumItems uint32 + // padding: 12 bytes + Data []byte // size: pad(((int(NumItems) * (int(Format) / 8)) * 1)) +} + +// Waits and reads reply data from request RandrGetOutputProperty +func (cook RandrGetOutputPropertyCookie) Reply() (*RandrGetOutputPropertyReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return randrGetOutputPropertyReply(buf), nil +} + +// Read reply into structure from buffer for RandrGetOutputProperty +func randrGetOutputPropertyReply(buf []byte) *RandrGetOutputPropertyReply { + v := new(RandrGetOutputPropertyReply) + b := 1 // skip reply determinant + + v.Format = buf[b] + b += 1 + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.Type = Id(Get32(buf[b:])) + b += 4 + + v.BytesAfter = Get32(buf[b:]) + b += 4 + + v.NumItems = Get32(buf[b:]) + b += 4 + + b += 12 // padding + + v.Data = make([]byte, (int(v.NumItems) * (int(v.Format) / 8))) + copy(v.Data[:(int(v.NumItems)*(int(v.Format)/8))], buf[b:]) + b += pad(int((int(v.NumItems) * (int(v.Format) / 8)))) + + return v +} + +func (cook RandrGetOutputPropertyCookie) Check() error { + return cook.check() +} + +// Write request to wire for RandrGetOutputProperty +func (c *Conn) randrGetOutputPropertyRequest(Output Id, Property Id, Type Id, LongOffset uint32, LongLength uint32, Delete bool, Pending bool) []byte { + size := 28 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RANDR"] + 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(Output)) + b += 4 + + Put32(buf[b:], uint32(Property)) + b += 4 + + Put32(buf[b:], uint32(Type)) + b += 4 + + Put32(buf[b:], LongOffset) + b += 4 + + Put32(buf[b:], LongLength) + b += 4 + + if Delete { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + if Pending { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + b += 2 // padding + + return buf +} + +// Request RandrCreateMode +// size: pad((40 + pad((len(Name) * 1)))) +type RandrCreateModeCookie struct { + *cookie +} + +func (c *Conn) RandrCreateMode(Window Id, ModeInfo RandrModeInfo, Name string) RandrCreateModeCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.randrCreateModeRequest(Window, ModeInfo, Name), cookie) + return RandrCreateModeCookie{cookie} +} + +func (c *Conn) RandrCreateModeUnchecked(Window Id, ModeInfo RandrModeInfo, Name string) RandrCreateModeCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.randrCreateModeRequest(Window, ModeInfo, Name), cookie) + return RandrCreateModeCookie{cookie} +} + +// Request reply for RandrCreateMode +// size: 32 +type RandrCreateModeReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Mode Id + // padding: 20 bytes +} + +// Waits and reads reply data from request RandrCreateMode +func (cook RandrCreateModeCookie) Reply() (*RandrCreateModeReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return randrCreateModeReply(buf), nil +} + +// Read reply into structure from buffer for RandrCreateMode +func randrCreateModeReply(buf []byte) *RandrCreateModeReply { + v := new(RandrCreateModeReply) + 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.Mode = Id(Get32(buf[b:])) + b += 4 + + b += 20 // padding + + return v +} + +func (cook RandrCreateModeCookie) Check() error { + return cook.check() +} + +// Write request to wire for RandrCreateMode +func (c *Conn) randrCreateModeRequest(Window Id, ModeInfo RandrModeInfo, Name string) []byte { + size := pad((40 + pad((len(Name) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RANDR"] + 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(Window)) + b += 4 + + { + structBytes := ModeInfo.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + + copy(buf[b:], Name[:len(Name)]) + b += pad(int(len(Name))) + + return buf +} + +// Request RandrDestroyMode +// size: 8 +type RandrDestroyModeCookie struct { + *cookie +} + +// Write request to wire for RandrDestroyMode +func (c *Conn) RandrDestroyMode(Mode Id) RandrDestroyModeCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.randrDestroyModeRequest(Mode), cookie) + return RandrDestroyModeCookie{cookie} +} + +func (c *Conn) RandrDestroyModeChecked(Mode Id) RandrDestroyModeCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.randrDestroyModeRequest(Mode), cookie) + return RandrDestroyModeCookie{cookie} +} + +func (cook RandrDestroyModeCookie) Check() error { + return cook.check() +} + +// Write request to wire for RandrDestroyMode +func (c *Conn) randrDestroyModeRequest(Mode Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RANDR"] + 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(Mode)) + b += 4 + + return buf +} + +// Request RandrAddOutputMode +// size: 12 +type RandrAddOutputModeCookie struct { + *cookie +} + +// Write request to wire for RandrAddOutputMode +func (c *Conn) RandrAddOutputMode(Output Id, Mode Id) RandrAddOutputModeCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.randrAddOutputModeRequest(Output, Mode), cookie) + return RandrAddOutputModeCookie{cookie} +} + +func (c *Conn) RandrAddOutputModeChecked(Output Id, Mode Id) RandrAddOutputModeCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.randrAddOutputModeRequest(Output, Mode), cookie) + return RandrAddOutputModeCookie{cookie} +} + +func (cook RandrAddOutputModeCookie) Check() error { + return cook.check() +} + +// Write request to wire for RandrAddOutputMode +func (c *Conn) randrAddOutputModeRequest(Output Id, Mode Id) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RANDR"] + 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(Output)) + b += 4 + + Put32(buf[b:], uint32(Mode)) + b += 4 + + return buf +} + +// Request RandrDeleteOutputMode +// size: 12 +type RandrDeleteOutputModeCookie struct { + *cookie +} + +// Write request to wire for RandrDeleteOutputMode +func (c *Conn) RandrDeleteOutputMode(Output Id, Mode Id) RandrDeleteOutputModeCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.randrDeleteOutputModeRequest(Output, Mode), cookie) + return RandrDeleteOutputModeCookie{cookie} +} + +func (c *Conn) RandrDeleteOutputModeChecked(Output Id, Mode Id) RandrDeleteOutputModeCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.randrDeleteOutputModeRequest(Output, Mode), cookie) + return RandrDeleteOutputModeCookie{cookie} +} + +func (cook RandrDeleteOutputModeCookie) Check() error { + return cook.check() +} + +// Write request to wire for RandrDeleteOutputMode +func (c *Conn) randrDeleteOutputModeRequest(Output Id, Mode Id) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RANDR"] + 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(Output)) + b += 4 + + Put32(buf[b:], uint32(Mode)) + b += 4 + + return buf +} + +// Request RandrGetCrtcInfo +// size: 12 +type RandrGetCrtcInfoCookie struct { + *cookie +} + +func (c *Conn) RandrGetCrtcInfo(Crtc Id, ConfigTimestamp Timestamp) RandrGetCrtcInfoCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.randrGetCrtcInfoRequest(Crtc, ConfigTimestamp), cookie) + return RandrGetCrtcInfoCookie{cookie} +} + +func (c *Conn) RandrGetCrtcInfoUnchecked(Crtc Id, ConfigTimestamp Timestamp) RandrGetCrtcInfoCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.randrGetCrtcInfoRequest(Crtc, ConfigTimestamp), cookie) + return RandrGetCrtcInfoCookie{cookie} +} + +// Request reply for RandrGetCrtcInfo +// size: ((32 + pad((int(NumOutputs) * 4))) + pad((int(NumPossibleOutputs) * 4))) +type RandrGetCrtcInfoReply struct { + Sequence uint16 + Length uint32 + Status byte + Timestamp Timestamp + X int16 + Y int16 + Width uint16 + Height uint16 + Mode Id + Rotation uint16 + Rotations uint16 + NumOutputs uint16 + NumPossibleOutputs uint16 + Outputs []Id // size: pad((int(NumOutputs) * 4)) + Possible []Id // size: pad((int(NumPossibleOutputs) * 4)) +} + +// Waits and reads reply data from request RandrGetCrtcInfo +func (cook RandrGetCrtcInfoCookie) Reply() (*RandrGetCrtcInfoReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return randrGetCrtcInfoReply(buf), nil +} + +// Read reply into structure from buffer for RandrGetCrtcInfo +func randrGetCrtcInfoReply(buf []byte) *RandrGetCrtcInfoReply { + v := new(RandrGetCrtcInfoReply) + b := 1 // skip reply determinant + + v.Status = buf[b] + b += 1 + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.Timestamp = Timestamp(Get32(buf[b:])) + 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.Mode = Id(Get32(buf[b:])) + b += 4 + + v.Rotation = Get16(buf[b:]) + b += 2 + + v.Rotations = Get16(buf[b:]) + b += 2 + + v.NumOutputs = Get16(buf[b:]) + b += 2 + + v.NumPossibleOutputs = Get16(buf[b:]) + b += 2 + + v.Outputs = make([]Id, v.NumOutputs) + for i := 0; i < int(v.NumOutputs); i++ { + v.Outputs[i] = Id(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + v.Possible = make([]Id, v.NumPossibleOutputs) + for i := 0; i < int(v.NumPossibleOutputs); i++ { + v.Possible[i] = Id(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + return v +} + +func (cook RandrGetCrtcInfoCookie) Check() error { + return cook.check() +} + +// Write request to wire for RandrGetCrtcInfo +func (c *Conn) randrGetCrtcInfoRequest(Crtc Id, ConfigTimestamp Timestamp) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RANDR"] + 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(Crtc)) + b += 4 + + Put32(buf[b:], uint32(ConfigTimestamp)) + b += 4 + + return buf +} + +// Request RandrSetCrtcConfig +// size: pad((28 + pad((len(Outputs) * 4)))) +type RandrSetCrtcConfigCookie struct { + *cookie +} + +func (c *Conn) RandrSetCrtcConfig(Crtc Id, Timestamp Timestamp, ConfigTimestamp Timestamp, X int16, Y int16, Mode Id, Rotation uint16, Outputs []Id) RandrSetCrtcConfigCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.randrSetCrtcConfigRequest(Crtc, Timestamp, ConfigTimestamp, X, Y, Mode, Rotation, Outputs), cookie) + return RandrSetCrtcConfigCookie{cookie} +} + +func (c *Conn) RandrSetCrtcConfigUnchecked(Crtc Id, Timestamp Timestamp, ConfigTimestamp Timestamp, X int16, Y int16, Mode Id, Rotation uint16, Outputs []Id) RandrSetCrtcConfigCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.randrSetCrtcConfigRequest(Crtc, Timestamp, ConfigTimestamp, X, Y, Mode, Rotation, Outputs), cookie) + return RandrSetCrtcConfigCookie{cookie} +} + +// Request reply for RandrSetCrtcConfig +// size: 32 +type RandrSetCrtcConfigReply struct { + Sequence uint16 + Length uint32 + Status byte + Timestamp Timestamp + // padding: 20 bytes +} + +// Waits and reads reply data from request RandrSetCrtcConfig +func (cook RandrSetCrtcConfigCookie) Reply() (*RandrSetCrtcConfigReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return randrSetCrtcConfigReply(buf), nil +} + +// Read reply into structure from buffer for RandrSetCrtcConfig +func randrSetCrtcConfigReply(buf []byte) *RandrSetCrtcConfigReply { + v := new(RandrSetCrtcConfigReply) + b := 1 // skip reply determinant + + v.Status = buf[b] + b += 1 + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.Timestamp = Timestamp(Get32(buf[b:])) + b += 4 + + b += 20 // padding + + return v +} + +func (cook RandrSetCrtcConfigCookie) Check() error { + return cook.check() +} + +// Write request to wire for RandrSetCrtcConfig +func (c *Conn) randrSetCrtcConfigRequest(Crtc Id, Timestamp Timestamp, ConfigTimestamp Timestamp, X int16, Y int16, Mode Id, Rotation uint16, Outputs []Id) []byte { + size := pad((28 + pad((len(Outputs) * 4)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RANDR"] + 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(Crtc)) + b += 4 + + Put32(buf[b:], uint32(Timestamp)) + b += 4 + + Put32(buf[b:], uint32(ConfigTimestamp)) + b += 4 + + Put16(buf[b:], uint16(X)) + b += 2 + + Put16(buf[b:], uint16(Y)) + b += 2 + + Put32(buf[b:], uint32(Mode)) + b += 4 + + Put16(buf[b:], Rotation) + b += 2 + + b += 2 // padding + + for i := 0; i < int(len(Outputs)); i++ { + Put32(buf[b:], uint32(Outputs[i])) + b += 4 + } + b = pad(b) + + return buf +} + +// Request RandrGetCrtcGammaSize +// size: 8 +type RandrGetCrtcGammaSizeCookie struct { + *cookie +} + +func (c *Conn) RandrGetCrtcGammaSize(Crtc Id) RandrGetCrtcGammaSizeCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.randrGetCrtcGammaSizeRequest(Crtc), cookie) + return RandrGetCrtcGammaSizeCookie{cookie} +} + +func (c *Conn) RandrGetCrtcGammaSizeUnchecked(Crtc Id) RandrGetCrtcGammaSizeCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.randrGetCrtcGammaSizeRequest(Crtc), cookie) + return RandrGetCrtcGammaSizeCookie{cookie} +} + +// Request reply for RandrGetCrtcGammaSize +// size: 32 +type RandrGetCrtcGammaSizeReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Size uint16 + // padding: 22 bytes +} + +// Waits and reads reply data from request RandrGetCrtcGammaSize +func (cook RandrGetCrtcGammaSizeCookie) Reply() (*RandrGetCrtcGammaSizeReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return randrGetCrtcGammaSizeReply(buf), nil +} + +// Read reply into structure from buffer for RandrGetCrtcGammaSize +func randrGetCrtcGammaSizeReply(buf []byte) *RandrGetCrtcGammaSizeReply { + v := new(RandrGetCrtcGammaSizeReply) + 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 RandrGetCrtcGammaSizeCookie) Check() error { + return cook.check() +} + +// Write request to wire for RandrGetCrtcGammaSize +func (c *Conn) randrGetCrtcGammaSizeRequest(Crtc Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RANDR"] + 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(Crtc)) + b += 4 + + return buf +} + +// Request RandrGetCrtcGamma +// size: 8 +type RandrGetCrtcGammaCookie struct { + *cookie +} + +func (c *Conn) RandrGetCrtcGamma(Crtc Id) RandrGetCrtcGammaCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.randrGetCrtcGammaRequest(Crtc), cookie) + return RandrGetCrtcGammaCookie{cookie} +} + +func (c *Conn) RandrGetCrtcGammaUnchecked(Crtc Id) RandrGetCrtcGammaCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.randrGetCrtcGammaRequest(Crtc), cookie) + return RandrGetCrtcGammaCookie{cookie} +} + +// Request reply for RandrGetCrtcGamma +// size: (((32 + pad((int(Size) * 2))) + pad((int(Size) * 2))) + pad((int(Size) * 2))) +type RandrGetCrtcGammaReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Size uint16 + // padding: 22 bytes + Red []uint16 // size: pad((int(Size) * 2)) + Green []uint16 // size: pad((int(Size) * 2)) + Blue []uint16 // size: pad((int(Size) * 2)) +} + +// Waits and reads reply data from request RandrGetCrtcGamma +func (cook RandrGetCrtcGammaCookie) Reply() (*RandrGetCrtcGammaReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return randrGetCrtcGammaReply(buf), nil +} + +// Read reply into structure from buffer for RandrGetCrtcGamma +func randrGetCrtcGammaReply(buf []byte) *RandrGetCrtcGammaReply { + v := new(RandrGetCrtcGammaReply) + 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, v.Size) + for i := 0; i < int(v.Size); i++ { + v.Red[i] = Get16(buf[b:]) + b += 2 + } + b = pad(b) + + v.Green = make([]uint16, v.Size) + for i := 0; i < int(v.Size); i++ { + v.Green[i] = Get16(buf[b:]) + b += 2 + } + b = pad(b) + + v.Blue = make([]uint16, v.Size) + for i := 0; i < int(v.Size); i++ { + v.Blue[i] = Get16(buf[b:]) + b += 2 + } + b = pad(b) + + return v +} + +func (cook RandrGetCrtcGammaCookie) Check() error { + return cook.check() +} + +// Write request to wire for RandrGetCrtcGamma +func (c *Conn) randrGetCrtcGammaRequest(Crtc Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RANDR"] + 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(Crtc)) + b += 4 + + return buf +} + +// Request RandrSetCrtcGamma +// size: pad((((12 + pad((int(Size) * 2))) + pad((int(Size) * 2))) + pad((int(Size) * 2)))) +type RandrSetCrtcGammaCookie struct { + *cookie +} + +// Write request to wire for RandrSetCrtcGamma +func (c *Conn) RandrSetCrtcGamma(Crtc Id, Size uint16, Red []uint16, Green []uint16, Blue []uint16) RandrSetCrtcGammaCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.randrSetCrtcGammaRequest(Crtc, Size, Red, Green, Blue), cookie) + return RandrSetCrtcGammaCookie{cookie} +} + +func (c *Conn) RandrSetCrtcGammaChecked(Crtc Id, Size uint16, Red []uint16, Green []uint16, Blue []uint16) RandrSetCrtcGammaCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.randrSetCrtcGammaRequest(Crtc, Size, Red, Green, Blue), cookie) + return RandrSetCrtcGammaCookie{cookie} +} + +func (cook RandrSetCrtcGammaCookie) Check() error { + return cook.check() +} + +// Write request to wire for RandrSetCrtcGamma +func (c *Conn) randrSetCrtcGammaRequest(Crtc Id, Size uint16, Red []uint16, Green []uint16, Blue []uint16) []byte { + size := pad((((12 + pad((int(Size) * 2))) + pad((int(Size) * 2))) + pad((int(Size) * 2)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RANDR"] + 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(Crtc)) + b += 4 + + Put16(buf[b:], Size) + b += 2 + + b += 2 // padding + + for i := 0; i < int(Size); i++ { + Put16(buf[b:], Red[i]) + b += 2 + } + b = pad(b) + + for i := 0; i < int(Size); i++ { + Put16(buf[b:], Green[i]) + b += 2 + } + b = pad(b) + + for i := 0; i < int(Size); i++ { + Put16(buf[b:], Blue[i]) + b += 2 + } + b = pad(b) + + return buf +} + +// Request RandrGetScreenResourcesCurrent +// size: 8 +type RandrGetScreenResourcesCurrentCookie struct { + *cookie +} + +func (c *Conn) RandrGetScreenResourcesCurrent(Window Id) RandrGetScreenResourcesCurrentCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.randrGetScreenResourcesCurrentRequest(Window), cookie) + return RandrGetScreenResourcesCurrentCookie{cookie} +} + +func (c *Conn) RandrGetScreenResourcesCurrentUnchecked(Window Id) RandrGetScreenResourcesCurrentCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.randrGetScreenResourcesCurrentRequest(Window), cookie) + return RandrGetScreenResourcesCurrentCookie{cookie} +} + +// Request reply for RandrGetScreenResourcesCurrent +// size: ((((32 + pad((int(NumCrtcs) * 4))) + pad((int(NumOutputs) * 4))) + pad((int(NumModes) * 32))) + pad((int(NamesLen) * 1))) +type RandrGetScreenResourcesCurrentReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Timestamp Timestamp + ConfigTimestamp Timestamp + NumCrtcs uint16 + NumOutputs uint16 + NumModes uint16 + NamesLen uint16 + // padding: 8 bytes + Crtcs []Id // size: pad((int(NumCrtcs) * 4)) + Outputs []Id // size: pad((int(NumOutputs) * 4)) + Modes []RandrModeInfo // size: pad((int(NumModes) * 32)) + Names []byte // size: pad((int(NamesLen) * 1)) +} + +// Waits and reads reply data from request RandrGetScreenResourcesCurrent +func (cook RandrGetScreenResourcesCurrentCookie) Reply() (*RandrGetScreenResourcesCurrentReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return randrGetScreenResourcesCurrentReply(buf), nil +} + +// Read reply into structure from buffer for RandrGetScreenResourcesCurrent +func randrGetScreenResourcesCurrentReply(buf []byte) *RandrGetScreenResourcesCurrentReply { + v := new(RandrGetScreenResourcesCurrentReply) + 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.Timestamp = Timestamp(Get32(buf[b:])) + b += 4 + + v.ConfigTimestamp = Timestamp(Get32(buf[b:])) + b += 4 + + v.NumCrtcs = Get16(buf[b:]) + b += 2 + + v.NumOutputs = Get16(buf[b:]) + b += 2 + + v.NumModes = Get16(buf[b:]) + b += 2 + + v.NamesLen = Get16(buf[b:]) + b += 2 + + b += 8 // padding + + v.Crtcs = make([]Id, v.NumCrtcs) + for i := 0; i < int(v.NumCrtcs); i++ { + v.Crtcs[i] = Id(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + v.Outputs = make([]Id, v.NumOutputs) + for i := 0; i < int(v.NumOutputs); i++ { + v.Outputs[i] = Id(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + v.Modes = make([]RandrModeInfo, v.NumModes) + b += ReadRandrModeInfoList(buf[b:], v.Modes) + + v.Names = make([]byte, v.NamesLen) + copy(v.Names[:v.NamesLen], buf[b:]) + b += pad(int(v.NamesLen)) + + return v +} + +func (cook RandrGetScreenResourcesCurrentCookie) Check() error { + return cook.check() +} + +// Write request to wire for RandrGetScreenResourcesCurrent +func (c *Conn) randrGetScreenResourcesCurrentRequest(Window Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RANDR"] + 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(Window)) + b += 4 + + return buf +} + +// Request RandrSetCrtcTransform +// size: pad(((48 + pad((int(FilterLen) * 1))) + pad((len(FilterParams) * 4)))) +type RandrSetCrtcTransformCookie struct { + *cookie +} + +// Write request to wire for RandrSetCrtcTransform +func (c *Conn) RandrSetCrtcTransform(Crtc Id, Transform RenderTransform, FilterLen uint16, FilterName string, FilterParams []RenderFixed) RandrSetCrtcTransformCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.randrSetCrtcTransformRequest(Crtc, Transform, FilterLen, FilterName, FilterParams), cookie) + return RandrSetCrtcTransformCookie{cookie} +} + +func (c *Conn) RandrSetCrtcTransformChecked(Crtc Id, Transform RenderTransform, FilterLen uint16, FilterName string, FilterParams []RenderFixed) RandrSetCrtcTransformCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.randrSetCrtcTransformRequest(Crtc, Transform, FilterLen, FilterName, FilterParams), cookie) + return RandrSetCrtcTransformCookie{cookie} +} + +func (cook RandrSetCrtcTransformCookie) Check() error { + return cook.check() +} + +// Write request to wire for RandrSetCrtcTransform +func (c *Conn) randrSetCrtcTransformRequest(Crtc Id, Transform RenderTransform, FilterLen uint16, FilterName string, FilterParams []RenderFixed) []byte { + size := pad(((48 + pad((int(FilterLen) * 1))) + pad((len(FilterParams) * 4)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RANDR"] + 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(Crtc)) + b += 4 + + { + structBytes := Transform.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + + Put16(buf[b:], FilterLen) + b += 2 + + b += 2 // padding + + copy(buf[b:], FilterName[:FilterLen]) + b += pad(int(FilterLen)) + + for i := 0; i < int(len(FilterParams)); i++ { + Put32(buf[b:], uint32(FilterParams[i])) + b += 4 + } + b = pad(b) + + return buf +} + +// Request RandrGetCrtcTransform +// size: 8 +type RandrGetCrtcTransformCookie struct { + *cookie +} + +func (c *Conn) RandrGetCrtcTransform(Crtc Id) RandrGetCrtcTransformCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.randrGetCrtcTransformRequest(Crtc), cookie) + return RandrGetCrtcTransformCookie{cookie} +} + +func (c *Conn) RandrGetCrtcTransformUnchecked(Crtc Id) RandrGetCrtcTransformCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.randrGetCrtcTransformRequest(Crtc), cookie) + return RandrGetCrtcTransformCookie{cookie} +} + +// Request reply for RandrGetCrtcTransform +// size: ((((96 + pad((int(PendingLen) * 1))) + pad((int(PendingNparams) * 4))) + pad((int(CurrentLen) * 1))) + pad((int(CurrentNparams) * 4))) +type RandrGetCrtcTransformReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + PendingTransform RenderTransform + HasTransforms bool + // padding: 3 bytes + CurrentTransform RenderTransform + // padding: 4 bytes + PendingLen uint16 + PendingNparams uint16 + CurrentLen uint16 + CurrentNparams uint16 + PendingFilterName string // size: pad((int(PendingLen) * 1)) + PendingParams []RenderFixed // size: pad((int(PendingNparams) * 4)) + CurrentFilterName string // size: pad((int(CurrentLen) * 1)) + CurrentParams []RenderFixed // size: pad((int(CurrentNparams) * 4)) +} + +// Waits and reads reply data from request RandrGetCrtcTransform +func (cook RandrGetCrtcTransformCookie) Reply() (*RandrGetCrtcTransformReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return randrGetCrtcTransformReply(buf), nil +} + +// Read reply into structure from buffer for RandrGetCrtcTransform +func randrGetCrtcTransformReply(buf []byte) *RandrGetCrtcTransformReply { + v := new(RandrGetCrtcTransformReply) + 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.PendingTransform = RenderTransform{} + b += ReadRenderTransform(buf[b:], &v.PendingTransform) + + if buf[b] == 1 { + v.HasTransforms = true + } else { + v.HasTransforms = false + } + b += 1 + + b += 3 // padding + + v.CurrentTransform = RenderTransform{} + b += ReadRenderTransform(buf[b:], &v.CurrentTransform) + + b += 4 // padding + + v.PendingLen = Get16(buf[b:]) + b += 2 + + v.PendingNparams = Get16(buf[b:]) + b += 2 + + v.CurrentLen = Get16(buf[b:]) + b += 2 + + v.CurrentNparams = Get16(buf[b:]) + b += 2 + + { + byteString := make([]byte, v.PendingLen) + copy(byteString[:v.PendingLen], buf[b:]) + v.PendingFilterName = string(byteString) + b += pad(int(v.PendingLen)) + } + + v.PendingParams = make([]RenderFixed, v.PendingNparams) + for i := 0; i < int(v.PendingNparams); i++ { + v.PendingParams[i] = RenderFixed(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + { + byteString := make([]byte, v.CurrentLen) + copy(byteString[:v.CurrentLen], buf[b:]) + v.CurrentFilterName = string(byteString) + b += pad(int(v.CurrentLen)) + } + + v.CurrentParams = make([]RenderFixed, v.CurrentNparams) + for i := 0; i < int(v.CurrentNparams); i++ { + v.CurrentParams[i] = RenderFixed(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + return v +} + +func (cook RandrGetCrtcTransformCookie) Check() error { + return cook.check() +} + +// Write request to wire for RandrGetCrtcTransform +func (c *Conn) randrGetCrtcTransformRequest(Crtc Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RANDR"] + 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(Crtc)) + b += 4 + + return buf +} + +// Request RandrGetPanning +// size: 8 +type RandrGetPanningCookie struct { + *cookie +} + +func (c *Conn) RandrGetPanning(Crtc Id) RandrGetPanningCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.randrGetPanningRequest(Crtc), cookie) + return RandrGetPanningCookie{cookie} +} + +func (c *Conn) RandrGetPanningUnchecked(Crtc Id) RandrGetPanningCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.randrGetPanningRequest(Crtc), cookie) + return RandrGetPanningCookie{cookie} +} + +// Request reply for RandrGetPanning +// size: 36 +type RandrGetPanningReply struct { + Sequence uint16 + Length uint32 + Status byte + Timestamp Timestamp + Left uint16 + Top uint16 + Width uint16 + Height uint16 + TrackLeft uint16 + TrackTop uint16 + TrackWidth uint16 + TrackHeight uint16 + BorderLeft int16 + BorderTop int16 + BorderRight int16 + BorderBottom int16 +} + +// Waits and reads reply data from request RandrGetPanning +func (cook RandrGetPanningCookie) Reply() (*RandrGetPanningReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return randrGetPanningReply(buf), nil +} + +// Read reply into structure from buffer for RandrGetPanning +func randrGetPanningReply(buf []byte) *RandrGetPanningReply { + v := new(RandrGetPanningReply) + b := 1 // skip reply determinant + + v.Status = buf[b] + b += 1 + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.Timestamp = Timestamp(Get32(buf[b:])) + b += 4 + + v.Left = Get16(buf[b:]) + b += 2 + + v.Top = Get16(buf[b:]) + b += 2 + + v.Width = Get16(buf[b:]) + b += 2 + + v.Height = Get16(buf[b:]) + b += 2 + + v.TrackLeft = Get16(buf[b:]) + b += 2 + + v.TrackTop = Get16(buf[b:]) + b += 2 + + v.TrackWidth = Get16(buf[b:]) + b += 2 + + v.TrackHeight = Get16(buf[b:]) + b += 2 + + v.BorderLeft = int16(Get16(buf[b:])) + b += 2 + + v.BorderTop = int16(Get16(buf[b:])) + b += 2 + + v.BorderRight = int16(Get16(buf[b:])) + b += 2 + + v.BorderBottom = int16(Get16(buf[b:])) + b += 2 + + return v +} + +func (cook RandrGetPanningCookie) Check() error { + return cook.check() +} + +// Write request to wire for RandrGetPanning +func (c *Conn) randrGetPanningRequest(Crtc Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RANDR"] + 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(Crtc)) + b += 4 + + return buf +} + +// Request RandrSetPanning +// size: 36 +type RandrSetPanningCookie struct { + *cookie +} + +func (c *Conn) RandrSetPanning(Crtc Id, Timestamp Timestamp, Left uint16, Top uint16, Width uint16, Height uint16, TrackLeft uint16, TrackTop uint16, TrackWidth uint16, TrackHeight uint16, BorderLeft int16, BorderTop int16, BorderRight int16, BorderBottom int16) RandrSetPanningCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.randrSetPanningRequest(Crtc, Timestamp, Left, Top, Width, Height, TrackLeft, TrackTop, TrackWidth, TrackHeight, BorderLeft, BorderTop, BorderRight, BorderBottom), cookie) + return RandrSetPanningCookie{cookie} +} + +func (c *Conn) RandrSetPanningUnchecked(Crtc Id, Timestamp Timestamp, Left uint16, Top uint16, Width uint16, Height uint16, TrackLeft uint16, TrackTop uint16, TrackWidth uint16, TrackHeight uint16, BorderLeft int16, BorderTop int16, BorderRight int16, BorderBottom int16) RandrSetPanningCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.randrSetPanningRequest(Crtc, Timestamp, Left, Top, Width, Height, TrackLeft, TrackTop, TrackWidth, TrackHeight, BorderLeft, BorderTop, BorderRight, BorderBottom), cookie) + return RandrSetPanningCookie{cookie} +} + +// Request reply for RandrSetPanning +// size: 12 +type RandrSetPanningReply struct { + Sequence uint16 + Length uint32 + Status byte + Timestamp Timestamp +} + +// Waits and reads reply data from request RandrSetPanning +func (cook RandrSetPanningCookie) Reply() (*RandrSetPanningReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return randrSetPanningReply(buf), nil +} + +// Read reply into structure from buffer for RandrSetPanning +func randrSetPanningReply(buf []byte) *RandrSetPanningReply { + v := new(RandrSetPanningReply) + b := 1 // skip reply determinant + + v.Status = buf[b] + b += 1 + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.Timestamp = Timestamp(Get32(buf[b:])) + b += 4 + + return v +} + +func (cook RandrSetPanningCookie) Check() error { + return cook.check() +} + +// Write request to wire for RandrSetPanning +func (c *Conn) randrSetPanningRequest(Crtc Id, Timestamp Timestamp, Left uint16, Top uint16, Width uint16, Height uint16, TrackLeft uint16, TrackTop uint16, TrackWidth uint16, TrackHeight uint16, BorderLeft int16, BorderTop int16, BorderRight int16, BorderBottom int16) []byte { + size := 36 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RANDR"] + 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(Crtc)) + b += 4 + + Put32(buf[b:], uint32(Timestamp)) + b += 4 + + Put16(buf[b:], Left) + b += 2 + + Put16(buf[b:], Top) + b += 2 + + Put16(buf[b:], Width) + b += 2 + + Put16(buf[b:], Height) + b += 2 + + Put16(buf[b:], TrackLeft) + b += 2 + + Put16(buf[b:], TrackTop) + b += 2 + + Put16(buf[b:], TrackWidth) + b += 2 + + Put16(buf[b:], TrackHeight) + b += 2 + + Put16(buf[b:], uint16(BorderLeft)) + b += 2 + + Put16(buf[b:], uint16(BorderTop)) + b += 2 + + Put16(buf[b:], uint16(BorderRight)) + b += 2 + + Put16(buf[b:], uint16(BorderBottom)) + b += 2 + + return buf +} + +// Request RandrSetOutputPrimary +// size: 12 +type RandrSetOutputPrimaryCookie struct { + *cookie +} + +// Write request to wire for RandrSetOutputPrimary +func (c *Conn) RandrSetOutputPrimary(Window Id, Output Id) RandrSetOutputPrimaryCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.randrSetOutputPrimaryRequest(Window, Output), cookie) + return RandrSetOutputPrimaryCookie{cookie} +} + +func (c *Conn) RandrSetOutputPrimaryChecked(Window Id, Output Id) RandrSetOutputPrimaryCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.randrSetOutputPrimaryRequest(Window, Output), cookie) + return RandrSetOutputPrimaryCookie{cookie} +} + +func (cook RandrSetOutputPrimaryCookie) Check() error { + return cook.check() +} + +// Write request to wire for RandrSetOutputPrimary +func (c *Conn) randrSetOutputPrimaryRequest(Window Id, Output Id) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RANDR"] + 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 + + Put32(buf[b:], uint32(Output)) + b += 4 + + return buf +} + +// Request RandrGetOutputPrimary +// size: 8 +type RandrGetOutputPrimaryCookie struct { + *cookie +} + +func (c *Conn) RandrGetOutputPrimary(Window Id) RandrGetOutputPrimaryCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.randrGetOutputPrimaryRequest(Window), cookie) + return RandrGetOutputPrimaryCookie{cookie} +} + +func (c *Conn) RandrGetOutputPrimaryUnchecked(Window Id) RandrGetOutputPrimaryCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.randrGetOutputPrimaryRequest(Window), cookie) + return RandrGetOutputPrimaryCookie{cookie} +} + +// Request reply for RandrGetOutputPrimary +// size: 12 +type RandrGetOutputPrimaryReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Output Id +} + +// Waits and reads reply data from request RandrGetOutputPrimary +func (cook RandrGetOutputPrimaryCookie) Reply() (*RandrGetOutputPrimaryReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return randrGetOutputPrimaryReply(buf), nil +} + +// Read reply into structure from buffer for RandrGetOutputPrimary +func randrGetOutputPrimaryReply(buf []byte) *RandrGetOutputPrimaryReply { + v := new(RandrGetOutputPrimaryReply) + 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.Output = Id(Get32(buf[b:])) + b += 4 + + return v +} + +func (cook RandrGetOutputPrimaryCookie) Check() error { + return cook.check() +} + +// Write request to wire for RandrGetOutputPrimary +func (c *Conn) randrGetOutputPrimaryRequest(Window Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["RANDR"] + 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(Window)) + b += 4 + + return buf +} |