diff options
Diffstat (limited to 'nexgb/xf86vidmode')
-rw-r--r-- | nexgb/xf86vidmode/xf86vidmode.go | 425 |
1 files changed, 246 insertions, 179 deletions
diff --git a/nexgb/xf86vidmode/xf86vidmode.go b/nexgb/xf86vidmode/xf86vidmode.go index d32f601..15daeb2 100644 --- a/nexgb/xf86vidmode/xf86vidmode.go +++ b/nexgb/xf86vidmode/xf86vidmode.go @@ -2,7 +2,7 @@ package xf86vidmode /* - This file was generated by xf86vidmode.xml on May 10 2012 8:04:32pm EDT. + This file was generated by xf86vidmode.xml on May 10 2012 11:56:19pm EDT. This file is automatically generated. Edit at your peril! */ @@ -40,18 +40,6 @@ func init() { xgb.NewExtErrorFuncs["XFree86-VidModeExtension"] = make(map[int]xgb.NewErrorFun) } -// 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' @@ -64,6 +52,18 @@ func init() { // Skipping definition for base type 'Float' +// 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 ( ModeFlagPositiveHsync = 1 ModeFlagNegativeHsync = 2 @@ -93,8 +93,6 @@ type Syncrange uint32 type Dotclock uint32 -// 'ModeInfo' struct definition -// Size: 48 type ModeInfo struct { Dotclock Dotclock Hdisplay uint16 @@ -112,7 +110,7 @@ type ModeInfo struct { Privsize uint32 } -// Struct read ModeInfo +// ModeInfoRead reads a byte slice into a ModeInfo value. func ModeInfoRead(buf []byte, v *ModeInfo) int { b := 0 @@ -159,7 +157,7 @@ func ModeInfoRead(buf []byte, v *ModeInfo) int { return b } -// Struct list read ModeInfo +// ModeInfoReadList reads a byte slice into a list of ModeInfo values. func ModeInfoReadList(buf []byte, dest []ModeInfo) int { b := 0 for i := 0; i < len(dest); i++ { @@ -169,7 +167,7 @@ func ModeInfoReadList(buf []byte, dest []ModeInfo) int { return xgb.Pad(b) } -// Struct write ModeInfo +// Bytes writes a ModeInfo value to a byte slice. func (v ModeInfo) Bytes() []byte { buf := make([]byte, 48) b := 0 @@ -217,7 +215,7 @@ func (v ModeInfo) Bytes() []byte { return buf } -// Write struct list ModeInfo +// ModeInfoListBytes writes a list of %s(MISSING) values to a byte slice. func ModeInfoListBytes(buf []byte, list []ModeInfo) int { b := 0 var structBytes []byte @@ -229,9 +227,7 @@ func ModeInfoListBytes(buf []byte, list []ModeInfo) int { return b } -// Error definition BadClock (0) -// Size: 32 - +// BadBadClock is the error number for a BadBadClock. const BadBadClock = 0 type BadClockError struct { @@ -239,7 +235,7 @@ type BadClockError struct { NiceName string } -// Error read BadClock +// BadClockErrorNew constructs a BadClockError value that implements xgb.Error from a byte slice. func BadClockErrorNew(buf []byte) xgb.Error { v := BadClockError{} v.NiceName = "BadClock" @@ -253,8 +249,8 @@ func BadClockErrorNew(buf []byte) xgb.Error { return v } -func (err BadClockError) ImplementsError() {} - +// SequenceId returns the sequence id attached to the BadBadClock error. +// This is mostly used internally. func (err BadClockError) SequenceId() uint16 { return err.Sequence } @@ -274,9 +270,7 @@ func init() { xgb.NewExtErrorFuncs["XFree86-VidModeExtension"][0] = BadClockErrorNew } -// Error definition BadHTimings (1) -// Size: 32 - +// BadBadHTimings is the error number for a BadBadHTimings. const BadBadHTimings = 1 type BadHTimingsError struct { @@ -284,7 +278,7 @@ type BadHTimingsError struct { NiceName string } -// Error read BadHTimings +// BadHTimingsErrorNew constructs a BadHTimingsError value that implements xgb.Error from a byte slice. func BadHTimingsErrorNew(buf []byte) xgb.Error { v := BadHTimingsError{} v.NiceName = "BadHTimings" @@ -298,8 +292,8 @@ func BadHTimingsErrorNew(buf []byte) xgb.Error { return v } -func (err BadHTimingsError) ImplementsError() {} - +// SequenceId returns the sequence id attached to the BadBadHTimings error. +// This is mostly used internally. func (err BadHTimingsError) SequenceId() uint16 { return err.Sequence } @@ -319,9 +313,7 @@ func init() { xgb.NewExtErrorFuncs["XFree86-VidModeExtension"][1] = BadHTimingsErrorNew } -// Error definition BadVTimings (2) -// Size: 32 - +// BadBadVTimings is the error number for a BadBadVTimings. const BadBadVTimings = 2 type BadVTimingsError struct { @@ -329,7 +321,7 @@ type BadVTimingsError struct { NiceName string } -// Error read BadVTimings +// BadVTimingsErrorNew constructs a BadVTimingsError value that implements xgb.Error from a byte slice. func BadVTimingsErrorNew(buf []byte) xgb.Error { v := BadVTimingsError{} v.NiceName = "BadVTimings" @@ -343,8 +335,8 @@ func BadVTimingsErrorNew(buf []byte) xgb.Error { return v } -func (err BadVTimingsError) ImplementsError() {} - +// SequenceId returns the sequence id attached to the BadBadVTimings error. +// This is mostly used internally. func (err BadVTimingsError) SequenceId() uint16 { return err.Sequence } @@ -364,9 +356,7 @@ func init() { xgb.NewExtErrorFuncs["XFree86-VidModeExtension"][2] = BadVTimingsErrorNew } -// Error definition ModeUnsuitable (3) -// Size: 32 - +// BadModeUnsuitable is the error number for a BadModeUnsuitable. const BadModeUnsuitable = 3 type ModeUnsuitableError struct { @@ -374,7 +364,7 @@ type ModeUnsuitableError struct { NiceName string } -// Error read ModeUnsuitable +// ModeUnsuitableErrorNew constructs a ModeUnsuitableError value that implements xgb.Error from a byte slice. func ModeUnsuitableErrorNew(buf []byte) xgb.Error { v := ModeUnsuitableError{} v.NiceName = "ModeUnsuitable" @@ -388,8 +378,8 @@ func ModeUnsuitableErrorNew(buf []byte) xgb.Error { return v } -func (err ModeUnsuitableError) ImplementsError() {} - +// SequenceId returns the sequence id attached to the BadModeUnsuitable error. +// This is mostly used internally. func (err ModeUnsuitableError) SequenceId() uint16 { return err.Sequence } @@ -409,9 +399,7 @@ func init() { xgb.NewExtErrorFuncs["XFree86-VidModeExtension"][3] = ModeUnsuitableErrorNew } -// Error definition ExtensionDisabled (4) -// Size: 32 - +// BadExtensionDisabled is the error number for a BadExtensionDisabled. const BadExtensionDisabled = 4 type ExtensionDisabledError struct { @@ -419,7 +407,7 @@ type ExtensionDisabledError struct { NiceName string } -// Error read ExtensionDisabled +// ExtensionDisabledErrorNew constructs a ExtensionDisabledError value that implements xgb.Error from a byte slice. func ExtensionDisabledErrorNew(buf []byte) xgb.Error { v := ExtensionDisabledError{} v.NiceName = "ExtensionDisabled" @@ -433,8 +421,8 @@ func ExtensionDisabledErrorNew(buf []byte) xgb.Error { return v } -func (err ExtensionDisabledError) ImplementsError() {} - +// SequenceId returns the sequence id attached to the BadExtensionDisabled error. +// This is mostly used internally. func (err ExtensionDisabledError) SequenceId() uint16 { return err.Sequence } @@ -454,9 +442,7 @@ func init() { xgb.NewExtErrorFuncs["XFree86-VidModeExtension"][4] = ExtensionDisabledErrorNew } -// Error definition ClientNotLocal (5) -// Size: 32 - +// BadClientNotLocal is the error number for a BadClientNotLocal. const BadClientNotLocal = 5 type ClientNotLocalError struct { @@ -464,7 +450,7 @@ type ClientNotLocalError struct { NiceName string } -// Error read ClientNotLocal +// ClientNotLocalErrorNew constructs a ClientNotLocalError value that implements xgb.Error from a byte slice. func ClientNotLocalErrorNew(buf []byte) xgb.Error { v := ClientNotLocalError{} v.NiceName = "ClientNotLocal" @@ -478,8 +464,8 @@ func ClientNotLocalErrorNew(buf []byte) xgb.Error { return v } -func (err ClientNotLocalError) ImplementsError() {} - +// SequenceId returns the sequence id attached to the BadClientNotLocal error. +// This is mostly used internally. func (err ClientNotLocalError) SequenceId() uint16 { return err.Sequence } @@ -499,9 +485,7 @@ func init() { xgb.NewExtErrorFuncs["XFree86-VidModeExtension"][5] = ClientNotLocalErrorNew } -// Error definition ZoomLocked (6) -// Size: 32 - +// BadZoomLocked is the error number for a BadZoomLocked. const BadZoomLocked = 6 type ZoomLockedError struct { @@ -509,7 +493,7 @@ type ZoomLockedError struct { NiceName string } -// Error read ZoomLocked +// ZoomLockedErrorNew constructs a ZoomLockedError value that implements xgb.Error from a byte slice. func ZoomLockedErrorNew(buf []byte) xgb.Error { v := ZoomLockedError{} v.NiceName = "ZoomLocked" @@ -523,8 +507,8 @@ func ZoomLockedErrorNew(buf []byte) xgb.Error { return v } -func (err ZoomLockedError) ImplementsError() {} - +// SequenceId returns the sequence id attached to the BadZoomLocked error. +// This is mostly used internally. func (err ZoomLockedError) SequenceId() uint16 { return err.Sequence } @@ -544,35 +528,37 @@ func init() { xgb.NewExtErrorFuncs["XFree86-VidModeExtension"][6] = ZoomLockedErrorNew } -// Request QueryVersion -// size: 4 +// QueryVersionCookie is a cookie used only for QueryVersion requests. type QueryVersionCookie struct { *xgb.Cookie } +// QueryVersion sends a checked request. +// If an error occurs, it will be returned with the reply by calling QueryVersionCookie.Reply() func QueryVersion(c *xgb.Conn) QueryVersionCookie { cookie := c.NewCookie(true, true) c.NewRequest(queryVersionRequest(c), cookie) return QueryVersionCookie{cookie} } +// QueryVersionUnchecked sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryVersionUnchecked(c *xgb.Conn) QueryVersionCookie { cookie := c.NewCookie(false, true) c.NewRequest(queryVersionRequest(c), cookie) return QueryVersionCookie{cookie} } -// Request reply for QueryVersion -// size: 12 +// QueryVersionReply represents the data returned from a QueryVersion request. type QueryVersionReply struct { - Sequence uint16 - Length uint32 + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply // padding: 1 bytes MajorVersion uint16 MinorVersion uint16 } -// Waits and reads reply data from request QueryVersion +// Reply blocks and returns the reply data for a QueryVersion request. func (cook QueryVersionCookie) Reply() (*QueryVersionReply, error) { buf, err := cook.Cookie.Reply() if err != nil { @@ -584,7 +570,7 @@ func (cook QueryVersionCookie) Reply() (*QueryVersionReply, error) { return queryVersionReply(buf), nil } -// Read reply into structure from buffer for QueryVersion +// queryVersionReply reads a byte slice into a QueryVersionReply value. func queryVersionReply(buf []byte) *QueryVersionReply { v := new(QueryVersionReply) b := 1 // skip reply determinant @@ -607,6 +593,7 @@ func queryVersionReply(buf []byte) *QueryVersionReply { } // Write request to wire for QueryVersion +// queryVersionRequest writes a QueryVersion request to a byte slice. func queryVersionRequest(c *xgb.Conn) []byte { size := 4 b := 0 @@ -624,29 +611,31 @@ func queryVersionRequest(c *xgb.Conn) []byte { return buf } -// Request GetModeLine -// size: 8 +// GetModeLineCookie is a cookie used only for GetModeLine requests. type GetModeLineCookie struct { *xgb.Cookie } +// GetModeLine sends a checked request. +// If an error occurs, it will be returned with the reply by calling GetModeLineCookie.Reply() func GetModeLine(c *xgb.Conn, Screen uint16) GetModeLineCookie { cookie := c.NewCookie(true, true) c.NewRequest(getModeLineRequest(c, Screen), cookie) return GetModeLineCookie{cookie} } +// GetModeLineUnchecked sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetModeLineUnchecked(c *xgb.Conn, Screen uint16) GetModeLineCookie { cookie := c.NewCookie(false, true) c.NewRequest(getModeLineRequest(c, Screen), cookie) return GetModeLineCookie{cookie} } -// Request reply for GetModeLine -// size: (52 + xgb.Pad((int(Privsize) * 1))) +// GetModeLineReply represents the data returned from a GetModeLine request. type GetModeLineReply struct { - Sequence uint16 - Length uint32 + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply // padding: 1 bytes Dotclock Dotclock Hdisplay uint16 @@ -665,7 +654,7 @@ type GetModeLineReply struct { Private []byte // size: xgb.Pad((int(Privsize) * 1)) } -// Waits and reads reply data from request GetModeLine +// Reply blocks and returns the reply data for a GetModeLine request. func (cook GetModeLineCookie) Reply() (*GetModeLineReply, error) { buf, err := cook.Cookie.Reply() if err != nil { @@ -677,7 +666,7 @@ func (cook GetModeLineCookie) Reply() (*GetModeLineReply, error) { return getModeLineReply(buf), nil } -// Read reply into structure from buffer for GetModeLine +// getModeLineReply reads a byte slice into a GetModeLineReply value. func getModeLineReply(buf []byte) *GetModeLineReply { v := new(GetModeLineReply) b := 1 // skip reply determinant @@ -738,6 +727,7 @@ func getModeLineReply(buf []byte) *GetModeLineReply { } // Write request to wire for GetModeLine +// getModeLineRequest writes a GetModeLine request to a byte slice. func getModeLineRequest(c *xgb.Conn, Screen uint16) []byte { size := 8 b := 0 @@ -760,30 +750,35 @@ func getModeLineRequest(c *xgb.Conn, Screen uint16) []byte { return buf } -// Request ModModeLine -// size: xgb.Pad((48 + xgb.Pad((int(Privsize) * 1)))) +// ModModeLineCookie is a cookie used only for ModModeLine requests. type ModModeLineCookie struct { *xgb.Cookie } -// Write request to wire for ModModeLine +// ModModeLine sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ModModeLine(c *xgb.Conn, 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) ModModeLineCookie { cookie := c.NewCookie(false, false) c.NewRequest(modModeLineRequest(c, Screen, Hdisplay, Hsyncstart, Hsyncend, Htotal, Hskew, Vdisplay, Vsyncstart, Vsyncend, Vtotal, Flags, Privsize, Private), cookie) return ModModeLineCookie{cookie} } +// ModModeLineChecked sends a checked request. +// If an error occurs, it can be retrieved using ModModeLineCookie.Check() func ModModeLineChecked(c *xgb.Conn, 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) ModModeLineCookie { cookie := c.NewCookie(true, false) c.NewRequest(modModeLineRequest(c, Screen, Hdisplay, Hsyncstart, Hsyncend, Htotal, Hskew, Vdisplay, Vsyncstart, Vsyncend, Vtotal, Flags, Privsize, Private), cookie) return ModModeLineCookie{cookie} } +// Check returns an error if one occurred for checked requests that are not expecting a reply. +// This cannot be called for requests expecting a reply, nor for unchecked requests. func (cook ModModeLineCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for ModModeLine +// modModeLineRequest writes a ModModeLine request to a byte slice. func modModeLineRequest(c *xgb.Conn, 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 := xgb.Pad((48 + xgb.Pad((int(Privsize) * 1)))) b := 0 @@ -844,30 +839,35 @@ func modModeLineRequest(c *xgb.Conn, Screen uint32, Hdisplay uint16, Hsyncstart return buf } -// Request SwitchMode -// size: 8 +// SwitchModeCookie is a cookie used only for SwitchMode requests. type SwitchModeCookie struct { *xgb.Cookie } -// Write request to wire for SwitchMode +// SwitchMode sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SwitchMode(c *xgb.Conn, Screen uint16, Zoom uint16) SwitchModeCookie { cookie := c.NewCookie(false, false) c.NewRequest(switchModeRequest(c, Screen, Zoom), cookie) return SwitchModeCookie{cookie} } +// SwitchModeChecked sends a checked request. +// If an error occurs, it can be retrieved using SwitchModeCookie.Check() func SwitchModeChecked(c *xgb.Conn, Screen uint16, Zoom uint16) SwitchModeCookie { cookie := c.NewCookie(true, false) c.NewRequest(switchModeRequest(c, Screen, Zoom), cookie) return SwitchModeCookie{cookie} } +// Check returns an error if one occurred for checked requests that are not expecting a reply. +// This cannot be called for requests expecting a reply, nor for unchecked requests. func (cook SwitchModeCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for SwitchMode +// switchModeRequest writes a SwitchMode request to a byte slice. func switchModeRequest(c *xgb.Conn, Screen uint16, Zoom uint16) []byte { size := 8 b := 0 @@ -891,29 +891,31 @@ func switchModeRequest(c *xgb.Conn, Screen uint16, Zoom uint16) []byte { return buf } -// Request GetMonitor -// size: 8 +// GetMonitorCookie is a cookie used only for GetMonitor requests. type GetMonitorCookie struct { *xgb.Cookie } +// GetMonitor sends a checked request. +// If an error occurs, it will be returned with the reply by calling GetMonitorCookie.Reply() func GetMonitor(c *xgb.Conn, Screen uint16) GetMonitorCookie { cookie := c.NewCookie(true, true) c.NewRequest(getMonitorRequest(c, Screen), cookie) return GetMonitorCookie{cookie} } +// GetMonitorUnchecked sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetMonitorUnchecked(c *xgb.Conn, Screen uint16) GetMonitorCookie { cookie := c.NewCookie(false, true) c.NewRequest(getMonitorRequest(c, Screen), cookie) return GetMonitorCookie{cookie} } -// Request reply for GetMonitor -// size: (((((32 + xgb.Pad((int(NumHsync) * 4))) + xgb.Pad((int(NumVsync) * 4))) + xgb.Pad((int(VendorLength) * 1))) + xgb.Pad(((((int(VendorLength) + 3) & -4) - int(VendorLength)) * 1))) + xgb.Pad((int(ModelLength) * 1))) +// GetMonitorReply represents the data returned from a GetMonitor request. type GetMonitorReply struct { - Sequence uint16 - Length uint32 + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply // padding: 1 bytes VendorLength byte ModelLength byte @@ -927,7 +929,7 @@ type GetMonitorReply struct { Model string // size: xgb.Pad((int(ModelLength) * 1)) } -// Waits and reads reply data from request GetMonitor +// Reply blocks and returns the reply data for a GetMonitor request. func (cook GetMonitorCookie) Reply() (*GetMonitorReply, error) { buf, err := cook.Cookie.Reply() if err != nil { @@ -939,7 +941,7 @@ func (cook GetMonitorCookie) Reply() (*GetMonitorReply, error) { return getMonitorReply(buf), nil } -// Read reply into structure from buffer for GetMonitor +// getMonitorReply reads a byte slice into a GetMonitorReply value. func getMonitorReply(buf []byte) *GetMonitorReply { v := new(GetMonitorReply) b := 1 // skip reply determinant @@ -1002,6 +1004,7 @@ func getMonitorReply(buf []byte) *GetMonitorReply { } // Write request to wire for GetMonitor +// getMonitorRequest writes a GetMonitor request to a byte slice. func getMonitorRequest(c *xgb.Conn, Screen uint16) []byte { size := 8 b := 0 @@ -1024,30 +1027,35 @@ func getMonitorRequest(c *xgb.Conn, Screen uint16) []byte { return buf } -// Request LockModeSwitch -// size: 8 +// LockModeSwitchCookie is a cookie used only for LockModeSwitch requests. type LockModeSwitchCookie struct { *xgb.Cookie } -// Write request to wire for LockModeSwitch +// LockModeSwitch sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func LockModeSwitch(c *xgb.Conn, Screen uint16, Lock uint16) LockModeSwitchCookie { cookie := c.NewCookie(false, false) c.NewRequest(lockModeSwitchRequest(c, Screen, Lock), cookie) return LockModeSwitchCookie{cookie} } +// LockModeSwitchChecked sends a checked request. +// If an error occurs, it can be retrieved using LockModeSwitchCookie.Check() func LockModeSwitchChecked(c *xgb.Conn, Screen uint16, Lock uint16) LockModeSwitchCookie { cookie := c.NewCookie(true, false) c.NewRequest(lockModeSwitchRequest(c, Screen, Lock), cookie) return LockModeSwitchCookie{cookie} } +// Check returns an error if one occurred for checked requests that are not expecting a reply. +// This cannot be called for requests expecting a reply, nor for unchecked requests. func (cook LockModeSwitchCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for LockModeSwitch +// lockModeSwitchRequest writes a LockModeSwitch request to a byte slice. func lockModeSwitchRequest(c *xgb.Conn, Screen uint16, Lock uint16) []byte { size := 8 b := 0 @@ -1071,36 +1079,38 @@ func lockModeSwitchRequest(c *xgb.Conn, Screen uint16, Lock uint16) []byte { return buf } -// Request GetAllModeLines -// size: 8 +// GetAllModeLinesCookie is a cookie used only for GetAllModeLines requests. type GetAllModeLinesCookie struct { *xgb.Cookie } +// GetAllModeLines sends a checked request. +// If an error occurs, it will be returned with the reply by calling GetAllModeLinesCookie.Reply() func GetAllModeLines(c *xgb.Conn, Screen uint16) GetAllModeLinesCookie { cookie := c.NewCookie(true, true) c.NewRequest(getAllModeLinesRequest(c, Screen), cookie) return GetAllModeLinesCookie{cookie} } +// GetAllModeLinesUnchecked sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetAllModeLinesUnchecked(c *xgb.Conn, Screen uint16) GetAllModeLinesCookie { cookie := c.NewCookie(false, true) c.NewRequest(getAllModeLinesRequest(c, Screen), cookie) return GetAllModeLinesCookie{cookie} } -// Request reply for GetAllModeLines -// size: (32 + xgb.Pad((int(Modecount) * 48))) +// GetAllModeLinesReply represents the data returned from a GetAllModeLines request. type GetAllModeLinesReply struct { - Sequence uint16 - Length uint32 + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply // padding: 1 bytes Modecount uint32 // padding: 20 bytes Modeinfo []ModeInfo // size: xgb.Pad((int(Modecount) * 48)) } -// Waits and reads reply data from request GetAllModeLines +// Reply blocks and returns the reply data for a GetAllModeLines request. func (cook GetAllModeLinesCookie) Reply() (*GetAllModeLinesReply, error) { buf, err := cook.Cookie.Reply() if err != nil { @@ -1112,7 +1122,7 @@ func (cook GetAllModeLinesCookie) Reply() (*GetAllModeLinesReply, error) { return getAllModeLinesReply(buf), nil } -// Read reply into structure from buffer for GetAllModeLines +// getAllModeLinesReply reads a byte slice into a GetAllModeLinesReply value. func getAllModeLinesReply(buf []byte) *GetAllModeLinesReply { v := new(GetAllModeLinesReply) b := 1 // skip reply determinant @@ -1137,6 +1147,7 @@ func getAllModeLinesReply(buf []byte) *GetAllModeLinesReply { } // Write request to wire for GetAllModeLines +// getAllModeLinesRequest writes a GetAllModeLines request to a byte slice. func getAllModeLinesRequest(c *xgb.Conn, Screen uint16) []byte { size := 8 b := 0 @@ -1159,30 +1170,35 @@ func getAllModeLinesRequest(c *xgb.Conn, Screen uint16) []byte { return buf } -// Request AddModeLine -// size: xgb.Pad((92 + xgb.Pad((int(Privsize) * 1)))) +// AddModeLineCookie is a cookie used only for AddModeLine requests. type AddModeLineCookie struct { *xgb.Cookie } -// Write request to wire for AddModeLine +// AddModeLine sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func AddModeLine(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, AfterDotclock Dotclock, AfterHdisplay uint16, AfterHsyncstart uint16, AfterHsyncend uint16, AfterHtotal uint16, AfterHskew uint16, AfterVdisplay uint16, AfterVsyncstart uint16, AfterVsyncend uint16, AfterVtotal uint16, AfterFlags uint32, Private []byte) AddModeLineCookie { cookie := c.NewCookie(false, false) c.NewRequest(addModeLineRequest(c, 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 AddModeLineCookie{cookie} } +// AddModeLineChecked sends a checked request. +// If an error occurs, it can be retrieved using AddModeLineCookie.Check() func AddModeLineChecked(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, AfterDotclock Dotclock, AfterHdisplay uint16, AfterHsyncstart uint16, AfterHsyncend uint16, AfterHtotal uint16, AfterHskew uint16, AfterVdisplay uint16, AfterVsyncstart uint16, AfterVsyncend uint16, AfterVtotal uint16, AfterFlags uint32, Private []byte) AddModeLineCookie { cookie := c.NewCookie(true, false) c.NewRequest(addModeLineRequest(c, 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 AddModeLineCookie{cookie} } +// Check returns an error if one occurred for checked requests that are not expecting a reply. +// This cannot be called for requests expecting a reply, nor for unchecked requests. func (cook AddModeLineCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for AddModeLine +// addModeLineRequest writes a AddModeLine request to a byte slice. func addModeLineRequest(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, AfterDotclock Dotclock, AfterHdisplay uint16, AfterHsyncstart uint16, AfterHsyncend uint16, AfterHtotal uint16, AfterHskew uint16, AfterVdisplay uint16, AfterVsyncstart uint16, AfterVsyncend uint16, AfterVtotal uint16, AfterFlags uint32, Private []byte) []byte { size := xgb.Pad((92 + xgb.Pad((int(Privsize) * 1)))) b := 0 @@ -1283,30 +1299,35 @@ func addModeLineRequest(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay return buf } -// Request DeleteModeLine -// size: xgb.Pad((52 + xgb.Pad((int(Privsize) * 1)))) +// DeleteModeLineCookie is a cookie used only for DeleteModeLine requests. type DeleteModeLineCookie struct { *xgb.Cookie } -// Write request to wire for DeleteModeLine +// DeleteModeLine sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func DeleteModeLine(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) DeleteModeLineCookie { cookie := c.NewCookie(false, false) c.NewRequest(deleteModeLineRequest(c, Screen, Dotclock, Hdisplay, Hsyncstart, Hsyncend, Htotal, Hskew, Vdisplay, Vsyncstart, Vsyncend, Vtotal, Flags, Privsize, Private), cookie) return DeleteModeLineCookie{cookie} } +// DeleteModeLineChecked sends a checked request. +// If an error occurs, it can be retrieved using DeleteModeLineCookie.Check() func DeleteModeLineChecked(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) DeleteModeLineCookie { cookie := c.NewCookie(true, false) c.NewRequest(deleteModeLineRequest(c, Screen, Dotclock, Hdisplay, Hsyncstart, Hsyncend, Htotal, Hskew, Vdisplay, Vsyncstart, Vsyncend, Vtotal, Flags, Privsize, Private), cookie) return DeleteModeLineCookie{cookie} } +// Check returns an error if one occurred for checked requests that are not expecting a reply. +// This cannot be called for requests expecting a reply, nor for unchecked requests. func (cook DeleteModeLineCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for DeleteModeLine +// deleteModeLineRequest writes a DeleteModeLine request to a byte slice. func deleteModeLineRequest(c *xgb.Conn, Screen uint32, Dotclock Dotclock, 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 := xgb.Pad((52 + xgb.Pad((int(Privsize) * 1)))) b := 0 @@ -1370,35 +1391,37 @@ func deleteModeLineRequest(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdispl return buf } -// Request ValidateModeLine -// size: xgb.Pad((52 + xgb.Pad((int(Privsize) * 1)))) +// ValidateModeLineCookie is a cookie used only for ValidateModeLine requests. type ValidateModeLineCookie struct { *xgb.Cookie } +// ValidateModeLine sends a checked request. +// If an error occurs, it will be returned with the reply by calling ValidateModeLineCookie.Reply() func ValidateModeLine(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) ValidateModeLineCookie { cookie := c.NewCookie(true, true) c.NewRequest(validateModeLineRequest(c, Screen, Dotclock, Hdisplay, Hsyncstart, Hsyncend, Htotal, Hskew, Vdisplay, Vsyncstart, Vsyncend, Vtotal, Flags, Privsize, Private), cookie) return ValidateModeLineCookie{cookie} } +// ValidateModeLineUnchecked sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ValidateModeLineUnchecked(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) ValidateModeLineCookie { cookie := c.NewCookie(false, true) c.NewRequest(validateModeLineRequest(c, Screen, Dotclock, Hdisplay, Hsyncstart, Hsyncend, Htotal, Hskew, Vdisplay, Vsyncstart, Vsyncend, Vtotal, Flags, Privsize, Private), cookie) return ValidateModeLineCookie{cookie} } -// Request reply for ValidateModeLine -// size: 32 +// ValidateModeLineReply represents the data returned from a ValidateModeLine request. type ValidateModeLineReply struct { - Sequence uint16 - Length uint32 + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply // padding: 1 bytes Status uint32 // padding: 20 bytes } -// Waits and reads reply data from request ValidateModeLine +// Reply blocks and returns the reply data for a ValidateModeLine request. func (cook ValidateModeLineCookie) Reply() (*ValidateModeLineReply, error) { buf, err := cook.Cookie.Reply() if err != nil { @@ -1410,7 +1433,7 @@ func (cook ValidateModeLineCookie) Reply() (*ValidateModeLineReply, error) { return validateModeLineReply(buf), nil } -// Read reply into structure from buffer for ValidateModeLine +// validateModeLineReply reads a byte slice into a ValidateModeLineReply value. func validateModeLineReply(buf []byte) *ValidateModeLineReply { v := new(ValidateModeLineReply) b := 1 // skip reply determinant @@ -1432,6 +1455,7 @@ func validateModeLineReply(buf []byte) *ValidateModeLineReply { } // Write request to wire for ValidateModeLine +// validateModeLineRequest writes a ValidateModeLine request to a byte slice. func validateModeLineRequest(c *xgb.Conn, Screen uint32, Dotclock Dotclock, 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 := xgb.Pad((52 + xgb.Pad((int(Privsize) * 1)))) b := 0 @@ -1495,30 +1519,35 @@ func validateModeLineRequest(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdis return buf } -// Request SwitchToMode -// size: xgb.Pad((52 + xgb.Pad((int(Privsize) * 1)))) +// SwitchToModeCookie is a cookie used only for SwitchToMode requests. type SwitchToModeCookie struct { *xgb.Cookie } -// Write request to wire for SwitchToMode +// SwitchToMode sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SwitchToMode(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) SwitchToModeCookie { cookie := c.NewCookie(false, false) c.NewRequest(switchToModeRequest(c, Screen, Dotclock, Hdisplay, Hsyncstart, Hsyncend, Htotal, Hskew, Vdisplay, Vsyncstart, Vsyncend, Vtotal, Flags, Privsize, Private), cookie) return SwitchToModeCookie{cookie} } +// SwitchToModeChecked sends a checked request. +// If an error occurs, it can be retrieved using SwitchToModeCookie.Check() func SwitchToModeChecked(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay uint16, Hsyncstart uint16, Hsyncend uint16, Htotal uint16, Hskew uint16, Vdisplay uint16, Vsyncstart uint16, Vsyncend uint16, Vtotal uint16, Flags uint32, Privsize uint32, Private []byte) SwitchToModeCookie { cookie := c.NewCookie(true, false) c.NewRequest(switchToModeRequest(c, Screen, Dotclock, Hdisplay, Hsyncstart, Hsyncend, Htotal, Hskew, Vdisplay, Vsyncstart, Vsyncend, Vtotal, Flags, Privsize, Private), cookie) return SwitchToModeCookie{cookie} } +// Check returns an error if one occurred for checked requests that are not expecting a reply. +// This cannot be called for requests expecting a reply, nor for unchecked requests. func (cook SwitchToModeCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for SwitchToMode +// switchToModeRequest writes a SwitchToMode request to a byte slice. func switchToModeRequest(c *xgb.Conn, Screen uint32, Dotclock Dotclock, 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 := xgb.Pad((52 + xgb.Pad((int(Privsize) * 1)))) b := 0 @@ -1582,36 +1611,38 @@ func switchToModeRequest(c *xgb.Conn, Screen uint32, Dotclock Dotclock, Hdisplay return buf } -// Request GetViewPort -// size: 8 +// GetViewPortCookie is a cookie used only for GetViewPort requests. type GetViewPortCookie struct { *xgb.Cookie } +// GetViewPort sends a checked request. +// If an error occurs, it will be returned with the reply by calling GetViewPortCookie.Reply() func GetViewPort(c *xgb.Conn, Screen uint16) GetViewPortCookie { cookie := c.NewCookie(true, true) c.NewRequest(getViewPortRequest(c, Screen), cookie) return GetViewPortCookie{cookie} } +// GetViewPortUnchecked sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetViewPortUnchecked(c *xgb.Conn, Screen uint16) GetViewPortCookie { cookie := c.NewCookie(false, true) c.NewRequest(getViewPortRequest(c, Screen), cookie) return GetViewPortCookie{cookie} } -// Request reply for GetViewPort -// size: 32 +// GetViewPortReply represents the data returned from a GetViewPort request. type GetViewPortReply struct { - Sequence uint16 - Length uint32 + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply // padding: 1 bytes X uint32 Y uint32 // padding: 16 bytes } -// Waits and reads reply data from request GetViewPort +// Reply blocks and returns the reply data for a GetViewPort request. func (cook GetViewPortCookie) Reply() (*GetViewPortReply, error) { buf, err := cook.Cookie.Reply() if err != nil { @@ -1623,7 +1654,7 @@ func (cook GetViewPortCookie) Reply() (*GetViewPortReply, error) { return getViewPortReply(buf), nil } -// Read reply into structure from buffer for GetViewPort +// getViewPortReply reads a byte slice into a GetViewPortReply value. func getViewPortReply(buf []byte) *GetViewPortReply { v := new(GetViewPortReply) b := 1 // skip reply determinant @@ -1648,6 +1679,7 @@ func getViewPortReply(buf []byte) *GetViewPortReply { } // Write request to wire for GetViewPort +// getViewPortRequest writes a GetViewPort request to a byte slice. func getViewPortRequest(c *xgb.Conn, Screen uint16) []byte { size := 8 b := 0 @@ -1670,30 +1702,35 @@ func getViewPortRequest(c *xgb.Conn, Screen uint16) []byte { return buf } -// Request SetViewPort -// size: 16 +// SetViewPortCookie is a cookie used only for SetViewPort requests. type SetViewPortCookie struct { *xgb.Cookie } -// Write request to wire for SetViewPort +// SetViewPort sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetViewPort(c *xgb.Conn, Screen uint16, X uint32, Y uint32) SetViewPortCookie { cookie := c.NewCookie(false, false) c.NewRequest(setViewPortRequest(c, Screen, X, Y), cookie) return SetViewPortCookie{cookie} } +// SetViewPortChecked sends a checked request. +// If an error occurs, it can be retrieved using SetViewPortCookie.Check() func SetViewPortChecked(c *xgb.Conn, Screen uint16, X uint32, Y uint32) SetViewPortCookie { cookie := c.NewCookie(true, false) c.NewRequest(setViewPortRequest(c, Screen, X, Y), cookie) return SetViewPortCookie{cookie} } +// Check returns an error if one occurred for checked requests that are not expecting a reply. +// This cannot be called for requests expecting a reply, nor for unchecked requests. func (cook SetViewPortCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for SetViewPort +// setViewPortRequest writes a SetViewPort request to a byte slice. func setViewPortRequest(c *xgb.Conn, Screen uint16, X uint32, Y uint32) []byte { size := 16 b := 0 @@ -1722,29 +1759,31 @@ func setViewPortRequest(c *xgb.Conn, Screen uint16, X uint32, Y uint32) []byte { return buf } -// Request GetDotClocks -// size: 8 +// GetDotClocksCookie is a cookie used only for GetDotClocks requests. type GetDotClocksCookie struct { *xgb.Cookie } +// GetDotClocks sends a checked request. +// If an error occurs, it will be returned with the reply by calling GetDotClocksCookie.Reply() func GetDotClocks(c *xgb.Conn, Screen uint16) GetDotClocksCookie { cookie := c.NewCookie(true, true) c.NewRequest(getDotClocksRequest(c, Screen), cookie) return GetDotClocksCookie{cookie} } +// GetDotClocksUnchecked sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetDotClocksUnchecked(c *xgb.Conn, Screen uint16) GetDotClocksCookie { cookie := c.NewCookie(false, true) c.NewRequest(getDotClocksRequest(c, Screen), cookie) return GetDotClocksCookie{cookie} } -// Request reply for GetDotClocks -// size: (32 + xgb.Pad((((1 - (int(Flags) & 1)) * int(Clocks)) * 4))) +// GetDotClocksReply represents the data returned from a GetDotClocks request. type GetDotClocksReply struct { - Sequence uint16 - Length uint32 + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply // padding: 1 bytes Flags uint32 Clocks uint32 @@ -1753,7 +1792,7 @@ type GetDotClocksReply struct { Clock []uint32 // size: xgb.Pad((((1 - (int(Flags) & 1)) * int(Clocks)) * 4)) } -// Waits and reads reply data from request GetDotClocks +// Reply blocks and returns the reply data for a GetDotClocks request. func (cook GetDotClocksCookie) Reply() (*GetDotClocksReply, error) { buf, err := cook.Cookie.Reply() if err != nil { @@ -1765,7 +1804,7 @@ func (cook GetDotClocksCookie) Reply() (*GetDotClocksReply, error) { return getDotClocksReply(buf), nil } -// Read reply into structure from buffer for GetDotClocks +// getDotClocksReply reads a byte slice into a GetDotClocksReply value. func getDotClocksReply(buf []byte) *GetDotClocksReply { v := new(GetDotClocksReply) b := 1 // skip reply determinant @@ -1800,6 +1839,7 @@ func getDotClocksReply(buf []byte) *GetDotClocksReply { } // Write request to wire for GetDotClocks +// getDotClocksRequest writes a GetDotClocks request to a byte slice. func getDotClocksRequest(c *xgb.Conn, Screen uint16) []byte { size := 8 b := 0 @@ -1822,30 +1862,35 @@ func getDotClocksRequest(c *xgb.Conn, Screen uint16) []byte { return buf } -// Request SetClientVersion -// size: 8 +// SetClientVersionCookie is a cookie used only for SetClientVersion requests. type SetClientVersionCookie struct { *xgb.Cookie } -// Write request to wire for SetClientVersion +// SetClientVersion sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetClientVersion(c *xgb.Conn, Major uint16, Minor uint16) SetClientVersionCookie { cookie := c.NewCookie(false, false) c.NewRequest(setClientVersionRequest(c, Major, Minor), cookie) return SetClientVersionCookie{cookie} } +// SetClientVersionChecked sends a checked request. +// If an error occurs, it can be retrieved using SetClientVersionCookie.Check() func SetClientVersionChecked(c *xgb.Conn, Major uint16, Minor uint16) SetClientVersionCookie { cookie := c.NewCookie(true, false) c.NewRequest(setClientVersionRequest(c, Major, Minor), cookie) return SetClientVersionCookie{cookie} } +// Check returns an error if one occurred for checked requests that are not expecting a reply. +// This cannot be called for requests expecting a reply, nor for unchecked requests. func (cook SetClientVersionCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for SetClientVersion +// setClientVersionRequest writes a SetClientVersion request to a byte slice. func setClientVersionRequest(c *xgb.Conn, Major uint16, Minor uint16) []byte { size := 8 b := 0 @@ -1869,30 +1914,35 @@ func setClientVersionRequest(c *xgb.Conn, Major uint16, Minor uint16) []byte { return buf } -// Request SetGamma -// size: 32 +// SetGammaCookie is a cookie used only for SetGamma requests. type SetGammaCookie struct { *xgb.Cookie } -// Write request to wire for SetGamma +// SetGamma sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetGamma(c *xgb.Conn, Screen uint16, Red uint32, Green uint32, Blue uint32) SetGammaCookie { cookie := c.NewCookie(false, false) c.NewRequest(setGammaRequest(c, Screen, Red, Green, Blue), cookie) return SetGammaCookie{cookie} } +// SetGammaChecked sends a checked request. +// If an error occurs, it can be retrieved using SetGammaCookie.Check() func SetGammaChecked(c *xgb.Conn, Screen uint16, Red uint32, Green uint32, Blue uint32) SetGammaCookie { cookie := c.NewCookie(true, false) c.NewRequest(setGammaRequest(c, Screen, Red, Green, Blue), cookie) return SetGammaCookie{cookie} } +// Check returns an error if one occurred for checked requests that are not expecting a reply. +// This cannot be called for requests expecting a reply, nor for unchecked requests. func (cook SetGammaCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for SetGamma +// setGammaRequest writes a SetGamma request to a byte slice. func setGammaRequest(c *xgb.Conn, Screen uint16, Red uint32, Green uint32, Blue uint32) []byte { size := 32 b := 0 @@ -1926,29 +1976,31 @@ func setGammaRequest(c *xgb.Conn, Screen uint16, Red uint32, Green uint32, Blue return buf } -// Request GetGamma -// size: 32 +// GetGammaCookie is a cookie used only for GetGamma requests. type GetGammaCookie struct { *xgb.Cookie } +// GetGamma sends a checked request. +// If an error occurs, it will be returned with the reply by calling GetGammaCookie.Reply() func GetGamma(c *xgb.Conn, Screen uint16) GetGammaCookie { cookie := c.NewCookie(true, true) c.NewRequest(getGammaRequest(c, Screen), cookie) return GetGammaCookie{cookie} } +// GetGammaUnchecked sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetGammaUnchecked(c *xgb.Conn, Screen uint16) GetGammaCookie { cookie := c.NewCookie(false, true) c.NewRequest(getGammaRequest(c, Screen), cookie) return GetGammaCookie{cookie} } -// Request reply for GetGamma -// size: 32 +// GetGammaReply represents the data returned from a GetGamma request. type GetGammaReply struct { - Sequence uint16 - Length uint32 + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply // padding: 1 bytes Red uint32 Green uint32 @@ -1956,7 +2008,7 @@ type GetGammaReply struct { // padding: 12 bytes } -// Waits and reads reply data from request GetGamma +// Reply blocks and returns the reply data for a GetGamma request. func (cook GetGammaCookie) Reply() (*GetGammaReply, error) { buf, err := cook.Cookie.Reply() if err != nil { @@ -1968,7 +2020,7 @@ func (cook GetGammaCookie) Reply() (*GetGammaReply, error) { return getGammaReply(buf), nil } -// Read reply into structure from buffer for GetGamma +// getGammaReply reads a byte slice into a GetGammaReply value. func getGammaReply(buf []byte) *GetGammaReply { v := new(GetGammaReply) b := 1 // skip reply determinant @@ -1996,6 +2048,7 @@ func getGammaReply(buf []byte) *GetGammaReply { } // Write request to wire for GetGamma +// getGammaRequest writes a GetGamma request to a byte slice. func getGammaRequest(c *xgb.Conn, Screen uint16) []byte { size := 32 b := 0 @@ -2018,29 +2071,31 @@ func getGammaRequest(c *xgb.Conn, Screen uint16) []byte { return buf } -// Request GetGammaRamp -// size: 8 +// GetGammaRampCookie is a cookie used only for GetGammaRamp requests. type GetGammaRampCookie struct { *xgb.Cookie } +// GetGammaRamp sends a checked request. +// If an error occurs, it will be returned with the reply by calling GetGammaRampCookie.Reply() func GetGammaRamp(c *xgb.Conn, Screen uint16, Size uint16) GetGammaRampCookie { cookie := c.NewCookie(true, true) c.NewRequest(getGammaRampRequest(c, Screen, Size), cookie) return GetGammaRampCookie{cookie} } +// GetGammaRampUnchecked sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetGammaRampUnchecked(c *xgb.Conn, Screen uint16, Size uint16) GetGammaRampCookie { cookie := c.NewCookie(false, true) c.NewRequest(getGammaRampRequest(c, Screen, Size), cookie) return GetGammaRampCookie{cookie} } -// Request reply for GetGammaRamp -// size: (((32 + xgb.Pad((((int(Size) + 1) & -2) * 2))) + xgb.Pad((((int(Size) + 1) & -2) * 2))) + xgb.Pad((((int(Size) + 1) & -2) * 2))) +// GetGammaRampReply represents the data returned from a GetGammaRamp request. type GetGammaRampReply struct { - Sequence uint16 - Length uint32 + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply // padding: 1 bytes Size uint16 // padding: 22 bytes @@ -2049,7 +2104,7 @@ type GetGammaRampReply struct { Blue []uint16 // size: xgb.Pad((((int(Size) + 1) & -2) * 2)) } -// Waits and reads reply data from request GetGammaRamp +// Reply blocks and returns the reply data for a GetGammaRamp request. func (cook GetGammaRampCookie) Reply() (*GetGammaRampReply, error) { buf, err := cook.Cookie.Reply() if err != nil { @@ -2061,7 +2116,7 @@ func (cook GetGammaRampCookie) Reply() (*GetGammaRampReply, error) { return getGammaRampReply(buf), nil } -// Read reply into structure from buffer for GetGammaRamp +// getGammaRampReply reads a byte slice into a GetGammaRampReply value. func getGammaRampReply(buf []byte) *GetGammaRampReply { v := new(GetGammaRampReply) b := 1 // skip reply determinant @@ -2104,6 +2159,7 @@ func getGammaRampReply(buf []byte) *GetGammaRampReply { } // Write request to wire for GetGammaRamp +// getGammaRampRequest writes a GetGammaRamp request to a byte slice. func getGammaRampRequest(c *xgb.Conn, Screen uint16, Size uint16) []byte { size := 8 b := 0 @@ -2127,30 +2183,35 @@ func getGammaRampRequest(c *xgb.Conn, Screen uint16, Size uint16) []byte { return buf } -// Request SetGammaRamp -// size: xgb.Pad((((8 + xgb.Pad((((int(Size) + 1) & -2) * 2))) + xgb.Pad((((int(Size) + 1) & -2) * 2))) + xgb.Pad((((int(Size) + 1) & -2) * 2)))) +// SetGammaRampCookie is a cookie used only for SetGammaRamp requests. type SetGammaRampCookie struct { *xgb.Cookie } -// Write request to wire for SetGammaRamp +// SetGammaRamp sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetGammaRamp(c *xgb.Conn, Screen uint16, Size uint16, Red []uint16, Green []uint16, Blue []uint16) SetGammaRampCookie { cookie := c.NewCookie(false, false) c.NewRequest(setGammaRampRequest(c, Screen, Size, Red, Green, Blue), cookie) return SetGammaRampCookie{cookie} } +// SetGammaRampChecked sends a checked request. +// If an error occurs, it can be retrieved using SetGammaRampCookie.Check() func SetGammaRampChecked(c *xgb.Conn, Screen uint16, Size uint16, Red []uint16, Green []uint16, Blue []uint16) SetGammaRampCookie { cookie := c.NewCookie(true, false) c.NewRequest(setGammaRampRequest(c, Screen, Size, Red, Green, Blue), cookie) return SetGammaRampCookie{cookie} } +// Check returns an error if one occurred for checked requests that are not expecting a reply. +// This cannot be called for requests expecting a reply, nor for unchecked requests. func (cook SetGammaRampCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for SetGammaRamp +// setGammaRampRequest writes a SetGammaRamp request to a byte slice. func setGammaRampRequest(c *xgb.Conn, Screen uint16, Size uint16, Red []uint16, Green []uint16, Blue []uint16) []byte { size := xgb.Pad((((8 + xgb.Pad((((int(Size) + 1) & -2) * 2))) + xgb.Pad((((int(Size) + 1) & -2) * 2))) + xgb.Pad((((int(Size) + 1) & -2) * 2)))) b := 0 @@ -2192,35 +2253,37 @@ func setGammaRampRequest(c *xgb.Conn, Screen uint16, Size uint16, Red []uint16, return buf } -// Request GetGammaRampSize -// size: 8 +// GetGammaRampSizeCookie is a cookie used only for GetGammaRampSize requests. type GetGammaRampSizeCookie struct { *xgb.Cookie } +// GetGammaRampSize sends a checked request. +// If an error occurs, it will be returned with the reply by calling GetGammaRampSizeCookie.Reply() func GetGammaRampSize(c *xgb.Conn, Screen uint16) GetGammaRampSizeCookie { cookie := c.NewCookie(true, true) c.NewRequest(getGammaRampSizeRequest(c, Screen), cookie) return GetGammaRampSizeCookie{cookie} } +// GetGammaRampSizeUnchecked sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetGammaRampSizeUnchecked(c *xgb.Conn, Screen uint16) GetGammaRampSizeCookie { cookie := c.NewCookie(false, true) c.NewRequest(getGammaRampSizeRequest(c, Screen), cookie) return GetGammaRampSizeCookie{cookie} } -// Request reply for GetGammaRampSize -// size: 32 +// GetGammaRampSizeReply represents the data returned from a GetGammaRampSize request. type GetGammaRampSizeReply struct { - Sequence uint16 - Length uint32 + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply // padding: 1 bytes Size uint16 // padding: 22 bytes } -// Waits and reads reply data from request GetGammaRampSize +// Reply blocks and returns the reply data for a GetGammaRampSize request. func (cook GetGammaRampSizeCookie) Reply() (*GetGammaRampSizeReply, error) { buf, err := cook.Cookie.Reply() if err != nil { @@ -2232,7 +2295,7 @@ func (cook GetGammaRampSizeCookie) Reply() (*GetGammaRampSizeReply, error) { return getGammaRampSizeReply(buf), nil } -// Read reply into structure from buffer for GetGammaRampSize +// getGammaRampSizeReply reads a byte slice into a GetGammaRampSizeReply value. func getGammaRampSizeReply(buf []byte) *GetGammaRampSizeReply { v := new(GetGammaRampSizeReply) b := 1 // skip reply determinant @@ -2254,6 +2317,7 @@ func getGammaRampSizeReply(buf []byte) *GetGammaRampSizeReply { } // Write request to wire for GetGammaRampSize +// getGammaRampSizeRequest writes a GetGammaRampSize request to a byte slice. func getGammaRampSizeRequest(c *xgb.Conn, Screen uint16) []byte { size := 8 b := 0 @@ -2276,35 +2340,37 @@ func getGammaRampSizeRequest(c *xgb.Conn, Screen uint16) []byte { return buf } -// Request GetPermissions -// size: 8 +// GetPermissionsCookie is a cookie used only for GetPermissions requests. type GetPermissionsCookie struct { *xgb.Cookie } +// GetPermissions sends a checked request. +// If an error occurs, it will be returned with the reply by calling GetPermissionsCookie.Reply() func GetPermissions(c *xgb.Conn, Screen uint16) GetPermissionsCookie { cookie := c.NewCookie(true, true) c.NewRequest(getPermissionsRequest(c, Screen), cookie) return GetPermissionsCookie{cookie} } +// GetPermissionsUnchecked sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetPermissionsUnchecked(c *xgb.Conn, Screen uint16) GetPermissionsCookie { cookie := c.NewCookie(false, true) c.NewRequest(getPermissionsRequest(c, Screen), cookie) return GetPermissionsCookie{cookie} } -// Request reply for GetPermissions -// size: 32 +// GetPermissionsReply represents the data returned from a GetPermissions request. type GetPermissionsReply struct { - Sequence uint16 - Length uint32 + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply // padding: 1 bytes Permissions uint32 // padding: 20 bytes } -// Waits and reads reply data from request GetPermissions +// Reply blocks and returns the reply data for a GetPermissions request. func (cook GetPermissionsCookie) Reply() (*GetPermissionsReply, error) { buf, err := cook.Cookie.Reply() if err != nil { @@ -2316,7 +2382,7 @@ func (cook GetPermissionsCookie) Reply() (*GetPermissionsReply, error) { return getPermissionsReply(buf), nil } -// Read reply into structure from buffer for GetPermissions +// getPermissionsReply reads a byte slice into a GetPermissionsReply value. func getPermissionsReply(buf []byte) *GetPermissionsReply { v := new(GetPermissionsReply) b := 1 // skip reply determinant @@ -2338,6 +2404,7 @@ func getPermissionsReply(buf []byte) *GetPermissionsReply { } // Write request to wire for GetPermissions +// getPermissionsRequest writes a GetPermissions request to a byte slice. func getPermissionsRequest(c *xgb.Conn, Screen uint16) []byte { size := 8 b := 0 |