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/auto_xf86vidmode.go | |
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/auto_xf86vidmode.go')
-rw-r--r-- | nexgb/auto_xf86vidmode.go | 2372 |
1 files changed, 2372 insertions, 0 deletions
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 +} |