From c00652934e4ec68016a152b9bea10273b0be8726 Mon Sep 17 00:00:00 2001 From: "Andrew Gallant (Ocelot)" Date: Thu, 10 May 2012 23:57:34 -0400 Subject: better docs --- nexgb/xv/xv.go | 440 ++++++++++++++++++++++++++++++++------------------------- 1 file changed, 251 insertions(+), 189 deletions(-) (limited to 'nexgb/xv') diff --git a/nexgb/xv/xv.go b/nexgb/xv/xv.go index 4e495cf..041b082 100644 --- a/nexgb/xv/xv.go +++ b/nexgb/xv/xv.go @@ -2,7 +2,7 @@ package xv /* - This file was generated by xv.xml on May 10 2012 8:04:33pm EDT. + This file was generated by xv.xml on May 10 2012 11:56:20pm EDT. This file is automatically generated. Edit at your peril! */ @@ -41,10 +41,6 @@ func init() { xgb.NewExtErrorFuncs["XVideo"] = make(map[int]xgb.NewErrorFun) } -// Skipping definition for base type 'Int8' - -// Skipping definition for base type 'Card16' - // Skipping definition for base type 'Char' // Skipping definition for base type 'Card32' @@ -65,6 +61,10 @@ func init() { // Skipping definition for base type 'Byte' +// Skipping definition for base type 'Int8' + +// Skipping definition for base type 'Card16' + const ( TypeInputMask = 1 TypeOutputMask = 2 @@ -130,14 +130,12 @@ func NewEncodingId(c *xgb.Conn) (Encoding, error) { return Encoding(id), nil } -// 'Rational' struct definition -// Size: 8 type Rational struct { Numerator int32 Denominator int32 } -// Struct read Rational +// RationalRead reads a byte slice into a Rational value. func RationalRead(buf []byte, v *Rational) int { b := 0 @@ -150,7 +148,7 @@ func RationalRead(buf []byte, v *Rational) int { return b } -// Struct list read Rational +// RationalReadList reads a byte slice into a list of Rational values. func RationalReadList(buf []byte, dest []Rational) int { b := 0 for i := 0; i < len(dest); i++ { @@ -160,7 +158,7 @@ func RationalReadList(buf []byte, dest []Rational) int { return xgb.Pad(b) } -// Struct write Rational +// Bytes writes a Rational value to a byte slice. func (v Rational) Bytes() []byte { buf := make([]byte, 8) b := 0 @@ -174,7 +172,7 @@ func (v Rational) Bytes() []byte { return buf } -// Write struct list Rational +// RationalListBytes writes a list of %s(MISSING) values to a byte slice. func RationalListBytes(buf []byte, list []Rational) int { b := 0 var structBytes []byte @@ -186,15 +184,13 @@ func RationalListBytes(buf []byte, list []Rational) int { return b } -// 'Format' struct definition -// Size: 8 type Format struct { Visual xproto.Visualid Depth byte // padding: 3 bytes } -// Struct read Format +// FormatRead reads a byte slice into a Format value. func FormatRead(buf []byte, v *Format) int { b := 0 @@ -209,7 +205,7 @@ func FormatRead(buf []byte, v *Format) int { return b } -// Struct list read Format +// FormatReadList reads a byte slice into a list of Format values. func FormatReadList(buf []byte, dest []Format) int { b := 0 for i := 0; i < len(dest); i++ { @@ -219,7 +215,7 @@ func FormatReadList(buf []byte, dest []Format) int { return xgb.Pad(b) } -// Struct write Format +// Bytes writes a Format value to a byte slice. func (v Format) Bytes() []byte { buf := make([]byte, 8) b := 0 @@ -235,7 +231,7 @@ func (v Format) Bytes() []byte { return buf } -// Write struct list Format +// FormatListBytes writes a list of %s(MISSING) values to a byte slice. func FormatListBytes(buf []byte, list []Format) int { b := 0 var structBytes []byte @@ -247,8 +243,6 @@ func FormatListBytes(buf []byte, list []Format) int { return b } -// 'AdaptorInfo' struct definition -// Size: ((12 + xgb.Pad((int(NameSize) * 1))) + xgb.Pad((int(NumFormats) * 8))) type AdaptorInfo struct { BaseId Port NameSize uint16 @@ -260,7 +254,7 @@ type AdaptorInfo struct { Formats []Format // size: xgb.Pad((int(NumFormats) * 8)) } -// Struct read AdaptorInfo +// AdaptorInfoRead reads a byte slice into a AdaptorInfo value. func AdaptorInfoRead(buf []byte, v *AdaptorInfo) int { b := 0 @@ -294,7 +288,7 @@ func AdaptorInfoRead(buf []byte, v *AdaptorInfo) int { return b } -// Struct list read AdaptorInfo +// AdaptorInfoReadList reads a byte slice into a list of AdaptorInfo values. func AdaptorInfoReadList(buf []byte, dest []AdaptorInfo) int { b := 0 for i := 0; i < len(dest); i++ { @@ -304,7 +298,7 @@ func AdaptorInfoReadList(buf []byte, dest []AdaptorInfo) int { return xgb.Pad(b) } -// Struct write AdaptorInfo +// Bytes writes a AdaptorInfo value to a byte slice. func (v AdaptorInfo) Bytes() []byte { buf := make([]byte, ((12 + xgb.Pad((int(v.NameSize) * 1))) + xgb.Pad((int(v.NumFormats) * 8)))) b := 0 @@ -334,7 +328,7 @@ func (v AdaptorInfo) Bytes() []byte { return buf } -// Write struct list AdaptorInfo +// AdaptorInfoListBytes writes a list of %s(MISSING) values to a byte slice. func AdaptorInfoListBytes(buf []byte, list []AdaptorInfo) int { b := 0 var structBytes []byte @@ -346,7 +340,7 @@ func AdaptorInfoListBytes(buf []byte, list []AdaptorInfo) int { return b } -// Struct list size AdaptorInfo +// AdaptorInfoListSize computes the size (bytes) of a list of AdaptorInfo values. func AdaptorInfoListSize(list []AdaptorInfo) int { size := 0 for _, item := range list { @@ -355,8 +349,6 @@ func AdaptorInfoListSize(list []AdaptorInfo) int { return size } -// 'EncodingInfo' struct definition -// Size: (20 + xgb.Pad((int(NameSize) * 1))) type EncodingInfo struct { Encoding Encoding NameSize uint16 @@ -367,7 +359,7 @@ type EncodingInfo struct { Name string // size: xgb.Pad((int(NameSize) * 1)) } -// Struct read EncodingInfo +// EncodingInfoRead reads a byte slice into a EncodingInfo value. func EncodingInfoRead(buf []byte, v *EncodingInfo) int { b := 0 @@ -398,7 +390,7 @@ func EncodingInfoRead(buf []byte, v *EncodingInfo) int { return b } -// Struct list read EncodingInfo +// EncodingInfoReadList reads a byte slice into a list of EncodingInfo values. func EncodingInfoReadList(buf []byte, dest []EncodingInfo) int { b := 0 for i := 0; i < len(dest); i++ { @@ -408,7 +400,7 @@ func EncodingInfoReadList(buf []byte, dest []EncodingInfo) int { return xgb.Pad(b) } -// Struct write EncodingInfo +// Bytes writes a EncodingInfo value to a byte slice. func (v EncodingInfo) Bytes() []byte { buf := make([]byte, (20 + xgb.Pad((int(v.NameSize) * 1)))) b := 0 @@ -439,7 +431,7 @@ func (v EncodingInfo) Bytes() []byte { return buf } -// Write struct list EncodingInfo +// EncodingInfoListBytes writes a list of %s(MISSING) values to a byte slice. func EncodingInfoListBytes(buf []byte, list []EncodingInfo) int { b := 0 var structBytes []byte @@ -451,7 +443,7 @@ func EncodingInfoListBytes(buf []byte, list []EncodingInfo) int { return b } -// Struct list size EncodingInfo +// EncodingInfoListSize computes the size (bytes) of a list of EncodingInfo values. func EncodingInfoListSize(list []EncodingInfo) int { size := 0 for _, item := range list { @@ -460,8 +452,6 @@ func EncodingInfoListSize(list []EncodingInfo) int { return size } -// 'Image' struct definition -// Size: (((16 + xgb.Pad((int(NumPlanes) * 4))) + xgb.Pad((int(NumPlanes) * 4))) + xgb.Pad((int(DataSize) * 1))) type Image struct { Id uint32 Width uint16 @@ -473,7 +463,7 @@ type Image struct { Data []byte // size: xgb.Pad((int(DataSize) * 1)) } -// Struct read Image +// ImageRead reads a byte slice into a Image value. func ImageRead(buf []byte, v *Image) int { b := 0 @@ -513,7 +503,7 @@ func ImageRead(buf []byte, v *Image) int { return b } -// Struct list read Image +// ImageReadList reads a byte slice into a list of Image values. func ImageReadList(buf []byte, dest []Image) int { b := 0 for i := 0; i < len(dest); i++ { @@ -523,7 +513,7 @@ func ImageReadList(buf []byte, dest []Image) int { return xgb.Pad(b) } -// Struct write Image +// Bytes writes a Image value to a byte slice. func (v Image) Bytes() []byte { buf := make([]byte, (((16 + xgb.Pad((int(v.NumPlanes) * 4))) + xgb.Pad((int(v.NumPlanes) * 4))) + xgb.Pad((int(v.DataSize) * 1)))) b := 0 @@ -561,7 +551,7 @@ func (v Image) Bytes() []byte { return buf } -// Write struct list Image +// ImageListBytes writes a list of %s(MISSING) values to a byte slice. func ImageListBytes(buf []byte, list []Image) int { b := 0 var structBytes []byte @@ -573,7 +563,7 @@ func ImageListBytes(buf []byte, list []Image) int { return b } -// Struct list size Image +// ImageListSize computes the size (bytes) of a list of Image values. func ImageListSize(list []Image) int { size := 0 for _, item := range list { @@ -582,8 +572,6 @@ func ImageListSize(list []Image) int { return size } -// 'AttributeInfo' struct definition -// Size: (16 + xgb.Pad((int(Size) * 1))) type AttributeInfo struct { Flags uint32 Min int32 @@ -592,7 +580,7 @@ type AttributeInfo struct { Name string // size: xgb.Pad((int(Size) * 1)) } -// Struct read AttributeInfo +// AttributeInfoRead reads a byte slice into a AttributeInfo value. func AttributeInfoRead(buf []byte, v *AttributeInfo) int { b := 0 @@ -618,7 +606,7 @@ func AttributeInfoRead(buf []byte, v *AttributeInfo) int { return b } -// Struct list read AttributeInfo +// AttributeInfoReadList reads a byte slice into a list of AttributeInfo values. func AttributeInfoReadList(buf []byte, dest []AttributeInfo) int { b := 0 for i := 0; i < len(dest); i++ { @@ -628,7 +616,7 @@ func AttributeInfoReadList(buf []byte, dest []AttributeInfo) int { return xgb.Pad(b) } -// Struct write AttributeInfo +// Bytes writes a AttributeInfo value to a byte slice. func (v AttributeInfo) Bytes() []byte { buf := make([]byte, (16 + xgb.Pad((int(v.Size) * 1)))) b := 0 @@ -651,7 +639,7 @@ func (v AttributeInfo) Bytes() []byte { return buf } -// Write struct list AttributeInfo +// AttributeInfoListBytes writes a list of %s(MISSING) values to a byte slice. func AttributeInfoListBytes(buf []byte, list []AttributeInfo) int { b := 0 var structBytes []byte @@ -663,7 +651,7 @@ func AttributeInfoListBytes(buf []byte, list []AttributeInfo) int { return b } -// Struct list size AttributeInfo +// AttributeInfoListSize computes the size (bytes) of a list of AttributeInfo values. func AttributeInfoListSize(list []AttributeInfo) int { size := 0 for _, item := range list { @@ -672,8 +660,6 @@ func AttributeInfoListSize(list []AttributeInfo) int { return size } -// 'ImageFormatInfo' struct definition -// Size: 128 type ImageFormatInfo struct { Id uint32 Type byte @@ -704,7 +690,7 @@ type ImageFormatInfo struct { // padding: 11 bytes } -// Struct read ImageFormatInfo +// ImageFormatInfoRead reads a byte slice into a ImageFormatInfo value. func ImageFormatInfoRead(buf []byte, v *ImageFormatInfo) int { b := 0 @@ -789,7 +775,7 @@ func ImageFormatInfoRead(buf []byte, v *ImageFormatInfo) int { return b } -// Struct list read ImageFormatInfo +// ImageFormatInfoReadList reads a byte slice into a list of ImageFormatInfo values. func ImageFormatInfoReadList(buf []byte, dest []ImageFormatInfo) int { b := 0 for i := 0; i < len(dest); i++ { @@ -799,7 +785,7 @@ func ImageFormatInfoReadList(buf []byte, dest []ImageFormatInfo) int { return xgb.Pad(b) } -// Struct write ImageFormatInfo +// Bytes writes a ImageFormatInfo value to a byte slice. func (v ImageFormatInfo) Bytes() []byte { buf := make([]byte, 128) b := 0 @@ -883,7 +869,7 @@ func (v ImageFormatInfo) Bytes() []byte { return buf } -// Write struct list ImageFormatInfo +// ImageFormatInfoListBytes writes a list of %s(MISSING) values to a byte slice. func ImageFormatInfoListBytes(buf []byte, list []ImageFormatInfo) int { b := 0 var structBytes []byte @@ -895,7 +881,7 @@ func ImageFormatInfoListBytes(buf []byte, list []ImageFormatInfo) int { return b } -// Struct list size ImageFormatInfo +// ImageFormatInfoListSize computes the size (bytes) of a list of ImageFormatInfo values. func ImageFormatInfoListSize(list []ImageFormatInfo) int { size := 0 for _ = range list { @@ -904,9 +890,7 @@ func ImageFormatInfoListSize(list []ImageFormatInfo) int { return size } -// Event definition VideoNotify (0) -// Size: 32 - +// VideoNotify is the event number for a VideoNotifyEvent. const VideoNotify = 0 type VideoNotifyEvent struct { @@ -917,7 +901,7 @@ type VideoNotifyEvent struct { Port Port } -// Event read VideoNotify +// VideoNotifyEventNew constructs a VideoNotifyEvent value that implements xgb.Event from a byte slice. func VideoNotifyEventNew(buf []byte) xgb.Event { v := VideoNotifyEvent{} b := 1 // don't read event number @@ -940,7 +924,7 @@ func VideoNotifyEventNew(buf []byte) xgb.Event { return v } -// Event write VideoNotify +// Bytes writes a VideoNotifyEvent value to a byte slice. func (v VideoNotifyEvent) Bytes() []byte { buf := make([]byte, 32) b := 0 @@ -966,12 +950,14 @@ func (v VideoNotifyEvent) Bytes() []byte { return buf } -func (v VideoNotifyEvent) ImplementsEvent() {} - +// SequenceId returns the sequence id attached to the VideoNotify event. +// Events without a sequence number (KeymapNotify) return 0. +// This is mostly used internally. func (v VideoNotifyEvent) SequenceId() uint16 { return v.Sequence } +// String is a rudimentary string representation of VideoNotifyEvent. func (v VideoNotifyEvent) String() string { fieldVals := make([]string, 0, 4) fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence)) @@ -986,9 +972,7 @@ func init() { xgb.NewExtEventFuncs["XVideo"][0] = VideoNotifyEventNew } -// Event definition PortNotify (1) -// Size: 32 - +// PortNotify is the event number for a PortNotifyEvent. const PortNotify = 1 type PortNotifyEvent struct { @@ -1000,7 +984,7 @@ type PortNotifyEvent struct { Value int32 } -// Event read PortNotify +// PortNotifyEventNew constructs a PortNotifyEvent value that implements xgb.Event from a byte slice. func PortNotifyEventNew(buf []byte) xgb.Event { v := PortNotifyEvent{} b := 1 // don't read event number @@ -1025,7 +1009,7 @@ func PortNotifyEventNew(buf []byte) xgb.Event { return v } -// Event write PortNotify +// Bytes writes a PortNotifyEvent value to a byte slice. func (v PortNotifyEvent) Bytes() []byte { buf := make([]byte, 32) b := 0 @@ -1053,12 +1037,14 @@ func (v PortNotifyEvent) Bytes() []byte { return buf } -func (v PortNotifyEvent) ImplementsEvent() {} - +// SequenceId returns the sequence id attached to the PortNotify event. +// Events without a sequence number (KeymapNotify) return 0. +// This is mostly used internally. func (v PortNotifyEvent) SequenceId() uint16 { return v.Sequence } +// String is a rudimentary string representation of PortNotifyEvent. func (v PortNotifyEvent) String() string { fieldVals := make([]string, 0, 5) fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence)) @@ -1073,9 +1059,7 @@ func init() { xgb.NewExtEventFuncs["XVideo"][1] = PortNotifyEventNew } -// Error definition BadPort (0) -// Size: 32 - +// BadBadPort is the error number for a BadBadPort. const BadBadPort = 0 type BadPortError struct { @@ -1083,7 +1067,7 @@ type BadPortError struct { NiceName string } -// Error read BadPort +// BadPortErrorNew constructs a BadPortError value that implements xgb.Error from a byte slice. func BadPortErrorNew(buf []byte) xgb.Error { v := BadPortError{} v.NiceName = "BadPort" @@ -1097,8 +1081,8 @@ func BadPortErrorNew(buf []byte) xgb.Error { return v } -func (err BadPortError) ImplementsError() {} - +// SequenceId returns the sequence id attached to the BadBadPort error. +// This is mostly used internally. func (err BadPortError) SequenceId() uint16 { return err.Sequence } @@ -1118,9 +1102,7 @@ func init() { xgb.NewExtErrorFuncs["XVideo"][0] = BadPortErrorNew } -// Error definition BadEncoding (1) -// Size: 32 - +// BadBadEncoding is the error number for a BadBadEncoding. const BadBadEncoding = 1 type BadEncodingError struct { @@ -1128,7 +1110,7 @@ type BadEncodingError struct { NiceName string } -// Error read BadEncoding +// BadEncodingErrorNew constructs a BadEncodingError value that implements xgb.Error from a byte slice. func BadEncodingErrorNew(buf []byte) xgb.Error { v := BadEncodingError{} v.NiceName = "BadEncoding" @@ -1142,8 +1124,8 @@ func BadEncodingErrorNew(buf []byte) xgb.Error { return v } -func (err BadEncodingError) ImplementsError() {} - +// SequenceId returns the sequence id attached to the BadBadEncoding error. +// This is mostly used internally. func (err BadEncodingError) SequenceId() uint16 { return err.Sequence } @@ -1163,9 +1145,7 @@ func init() { xgb.NewExtErrorFuncs["XVideo"][1] = BadEncodingErrorNew } -// Error definition BadControl (2) -// Size: 32 - +// BadBadControl is the error number for a BadBadControl. const BadBadControl = 2 type BadControlError struct { @@ -1173,7 +1153,7 @@ type BadControlError struct { NiceName string } -// Error read BadControl +// BadControlErrorNew constructs a BadControlError value that implements xgb.Error from a byte slice. func BadControlErrorNew(buf []byte) xgb.Error { v := BadControlError{} v.NiceName = "BadControl" @@ -1187,8 +1167,8 @@ func BadControlErrorNew(buf []byte) xgb.Error { return v } -func (err BadControlError) ImplementsError() {} - +// SequenceId returns the sequence id attached to the BadBadControl error. +// This is mostly used internally. func (err BadControlError) SequenceId() uint16 { return err.Sequence } @@ -1208,35 +1188,37 @@ func init() { xgb.NewExtErrorFuncs["XVideo"][2] = BadControlErrorNew } -// Request QueryExtension -// size: 4 +// QueryExtensionCookie is a cookie used only for QueryExtension requests. type QueryExtensionCookie struct { *xgb.Cookie } +// QueryExtension sends a checked request. +// If an error occurs, it will be returned with the reply by calling QueryExtensionCookie.Reply() func QueryExtension(c *xgb.Conn) QueryExtensionCookie { cookie := c.NewCookie(true, true) c.NewRequest(queryExtensionRequest(c), cookie) return QueryExtensionCookie{cookie} } +// QueryExtensionUnchecked sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryExtensionUnchecked(c *xgb.Conn) QueryExtensionCookie { cookie := c.NewCookie(false, true) c.NewRequest(queryExtensionRequest(c), cookie) return QueryExtensionCookie{cookie} } -// Request reply for QueryExtension -// size: 12 +// QueryExtensionReply represents the data returned from a QueryExtension request. type QueryExtensionReply 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 Major uint16 Minor uint16 } -// Waits and reads reply data from request QueryExtension +// Reply blocks and returns the reply data for a QueryExtension request. func (cook QueryExtensionCookie) Reply() (*QueryExtensionReply, error) { buf, err := cook.Cookie.Reply() if err != nil { @@ -1248,7 +1230,7 @@ func (cook QueryExtensionCookie) Reply() (*QueryExtensionReply, error) { return queryExtensionReply(buf), nil } -// Read reply into structure from buffer for QueryExtension +// queryExtensionReply reads a byte slice into a QueryExtensionReply value. func queryExtensionReply(buf []byte) *QueryExtensionReply { v := new(QueryExtensionReply) b := 1 // skip reply determinant @@ -1271,6 +1253,7 @@ func queryExtensionReply(buf []byte) *QueryExtensionReply { } // Write request to wire for QueryExtension +// queryExtensionRequest writes a QueryExtension request to a byte slice. func queryExtensionRequest(c *xgb.Conn) []byte { size := 4 b := 0 @@ -1288,36 +1271,38 @@ func queryExtensionRequest(c *xgb.Conn) []byte { return buf } -// Request QueryAdaptors -// size: 8 +// QueryAdaptorsCookie is a cookie used only for QueryAdaptors requests. type QueryAdaptorsCookie struct { *xgb.Cookie } +// QueryAdaptors sends a checked request. +// If an error occurs, it will be returned with the reply by calling QueryAdaptorsCookie.Reply() func QueryAdaptors(c *xgb.Conn, Window xproto.Window) QueryAdaptorsCookie { cookie := c.NewCookie(true, true) c.NewRequest(queryAdaptorsRequest(c, Window), cookie) return QueryAdaptorsCookie{cookie} } +// QueryAdaptorsUnchecked sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryAdaptorsUnchecked(c *xgb.Conn, Window xproto.Window) QueryAdaptorsCookie { cookie := c.NewCookie(false, true) c.NewRequest(queryAdaptorsRequest(c, Window), cookie) return QueryAdaptorsCookie{cookie} } -// Request reply for QueryAdaptors -// size: (32 + AdaptorInfoListSize(Info)) +// QueryAdaptorsReply represents the data returned from a QueryAdaptors request. type QueryAdaptorsReply 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 NumAdaptors uint16 // padding: 22 bytes Info []AdaptorInfo // size: AdaptorInfoListSize(Info) } -// Waits and reads reply data from request QueryAdaptors +// Reply blocks and returns the reply data for a QueryAdaptors request. func (cook QueryAdaptorsCookie) Reply() (*QueryAdaptorsReply, error) { buf, err := cook.Cookie.Reply() if err != nil { @@ -1329,7 +1314,7 @@ func (cook QueryAdaptorsCookie) Reply() (*QueryAdaptorsReply, error) { return queryAdaptorsReply(buf), nil } -// Read reply into structure from buffer for QueryAdaptors +// queryAdaptorsReply reads a byte slice into a QueryAdaptorsReply value. func queryAdaptorsReply(buf []byte) *QueryAdaptorsReply { v := new(QueryAdaptorsReply) b := 1 // skip reply determinant @@ -1354,6 +1339,7 @@ func queryAdaptorsReply(buf []byte) *QueryAdaptorsReply { } // Write request to wire for QueryAdaptors +// queryAdaptorsRequest writes a QueryAdaptors request to a byte slice. func queryAdaptorsRequest(c *xgb.Conn, Window xproto.Window) []byte { size := 8 b := 0 @@ -1374,36 +1360,38 @@ func queryAdaptorsRequest(c *xgb.Conn, Window xproto.Window) []byte { return buf } -// Request QueryEncodings -// size: 8 +// QueryEncodingsCookie is a cookie used only for QueryEncodings requests. type QueryEncodingsCookie struct { *xgb.Cookie } +// QueryEncodings sends a checked request. +// If an error occurs, it will be returned with the reply by calling QueryEncodingsCookie.Reply() func QueryEncodings(c *xgb.Conn, Port Port) QueryEncodingsCookie { cookie := c.NewCookie(true, true) c.NewRequest(queryEncodingsRequest(c, Port), cookie) return QueryEncodingsCookie{cookie} } +// QueryEncodingsUnchecked sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryEncodingsUnchecked(c *xgb.Conn, Port Port) QueryEncodingsCookie { cookie := c.NewCookie(false, true) c.NewRequest(queryEncodingsRequest(c, Port), cookie) return QueryEncodingsCookie{cookie} } -// Request reply for QueryEncodings -// size: (32 + EncodingInfoListSize(Info)) +// QueryEncodingsReply represents the data returned from a QueryEncodings request. type QueryEncodingsReply 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 NumEncodings uint16 // padding: 22 bytes Info []EncodingInfo // size: EncodingInfoListSize(Info) } -// Waits and reads reply data from request QueryEncodings +// Reply blocks and returns the reply data for a QueryEncodings request. func (cook QueryEncodingsCookie) Reply() (*QueryEncodingsReply, error) { buf, err := cook.Cookie.Reply() if err != nil { @@ -1415,7 +1403,7 @@ func (cook QueryEncodingsCookie) Reply() (*QueryEncodingsReply, error) { return queryEncodingsReply(buf), nil } -// Read reply into structure from buffer for QueryEncodings +// queryEncodingsReply reads a byte slice into a QueryEncodingsReply value. func queryEncodingsReply(buf []byte) *QueryEncodingsReply { v := new(QueryEncodingsReply) b := 1 // skip reply determinant @@ -1440,6 +1428,7 @@ func queryEncodingsReply(buf []byte) *QueryEncodingsReply { } // Write request to wire for QueryEncodings +// queryEncodingsRequest writes a QueryEncodings request to a byte slice. func queryEncodingsRequest(c *xgb.Conn, Port Port) []byte { size := 8 b := 0 @@ -1460,33 +1449,35 @@ func queryEncodingsRequest(c *xgb.Conn, Port Port) []byte { return buf } -// Request GrabPort -// size: 12 +// GrabPortCookie is a cookie used only for GrabPort requests. type GrabPortCookie struct { *xgb.Cookie } +// GrabPort sends a checked request. +// If an error occurs, it will be returned with the reply by calling GrabPortCookie.Reply() func GrabPort(c *xgb.Conn, Port Port, Time xproto.Timestamp) GrabPortCookie { cookie := c.NewCookie(true, true) c.NewRequest(grabPortRequest(c, Port, Time), cookie) return GrabPortCookie{cookie} } +// GrabPortUnchecked sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GrabPortUnchecked(c *xgb.Conn, Port Port, Time xproto.Timestamp) GrabPortCookie { cookie := c.NewCookie(false, true) c.NewRequest(grabPortRequest(c, Port, Time), cookie) return GrabPortCookie{cookie} } -// Request reply for GrabPort -// size: 8 +// GrabPortReply represents the data returned from a GrabPort request. type GrabPortReply struct { - Sequence uint16 - Length uint32 + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply Result byte } -// Waits and reads reply data from request GrabPort +// Reply blocks and returns the reply data for a GrabPort request. func (cook GrabPortCookie) Reply() (*GrabPortReply, error) { buf, err := cook.Cookie.Reply() if err != nil { @@ -1498,7 +1489,7 @@ func (cook GrabPortCookie) Reply() (*GrabPortReply, error) { return grabPortReply(buf), nil } -// Read reply into structure from buffer for GrabPort +// grabPortReply reads a byte slice into a GrabPortReply value. func grabPortReply(buf []byte) *GrabPortReply { v := new(GrabPortReply) b := 1 // skip reply determinant @@ -1516,6 +1507,7 @@ func grabPortReply(buf []byte) *GrabPortReply { } // Write request to wire for GrabPort +// grabPortRequest writes a GrabPort request to a byte slice. func grabPortRequest(c *xgb.Conn, Port Port, Time xproto.Timestamp) []byte { size := 12 b := 0 @@ -1539,30 +1531,35 @@ func grabPortRequest(c *xgb.Conn, Port Port, Time xproto.Timestamp) []byte { return buf } -// Request UngrabPort -// size: 12 +// UngrabPortCookie is a cookie used only for UngrabPort requests. type UngrabPortCookie struct { *xgb.Cookie } -// Write request to wire for UngrabPort +// UngrabPort sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func UngrabPort(c *xgb.Conn, Port Port, Time xproto.Timestamp) UngrabPortCookie { cookie := c.NewCookie(false, false) c.NewRequest(ungrabPortRequest(c, Port, Time), cookie) return UngrabPortCookie{cookie} } +// UngrabPortChecked sends a checked request. +// If an error occurs, it can be retrieved using UngrabPortCookie.Check() func UngrabPortChecked(c *xgb.Conn, Port Port, Time xproto.Timestamp) UngrabPortCookie { cookie := c.NewCookie(true, false) c.NewRequest(ungrabPortRequest(c, Port, Time), cookie) return UngrabPortCookie{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 UngrabPortCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for UngrabPort +// ungrabPortRequest writes a UngrabPort request to a byte slice. func ungrabPortRequest(c *xgb.Conn, Port Port, Time xproto.Timestamp) []byte { size := 12 b := 0 @@ -1586,30 +1583,35 @@ func ungrabPortRequest(c *xgb.Conn, Port Port, Time xproto.Timestamp) []byte { return buf } -// Request PutVideo -// size: 32 +// PutVideoCookie is a cookie used only for PutVideo requests. type PutVideoCookie struct { *xgb.Cookie } -// Write request to wire for PutVideo +// PutVideo sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func PutVideo(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) PutVideoCookie { cookie := c.NewCookie(false, false) c.NewRequest(putVideoRequest(c, Port, Drawable, Gc, VidX, VidY, VidW, VidH, DrwX, DrwY, DrwW, DrwH), cookie) return PutVideoCookie{cookie} } +// PutVideoChecked sends a checked request. +// If an error occurs, it can be retrieved using PutVideoCookie.Check() func PutVideoChecked(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) PutVideoCookie { cookie := c.NewCookie(true, false) c.NewRequest(putVideoRequest(c, Port, Drawable, Gc, VidX, VidY, VidW, VidH, DrwX, DrwY, DrwW, DrwH), cookie) return PutVideoCookie{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 PutVideoCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for PutVideo +// putVideoRequest writes a PutVideo request to a byte slice. func putVideoRequest(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) []byte { size := 32 b := 0 @@ -1660,30 +1662,35 @@ func putVideoRequest(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto return buf } -// Request PutStill -// size: 32 +// PutStillCookie is a cookie used only for PutStill requests. type PutStillCookie struct { *xgb.Cookie } -// Write request to wire for PutStill +// PutStill sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func PutStill(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) PutStillCookie { cookie := c.NewCookie(false, false) c.NewRequest(putStillRequest(c, Port, Drawable, Gc, VidX, VidY, VidW, VidH, DrwX, DrwY, DrwW, DrwH), cookie) return PutStillCookie{cookie} } +// PutStillChecked sends a checked request. +// If an error occurs, it can be retrieved using PutStillCookie.Check() func PutStillChecked(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) PutStillCookie { cookie := c.NewCookie(true, false) c.NewRequest(putStillRequest(c, Port, Drawable, Gc, VidX, VidY, VidW, VidH, DrwX, DrwY, DrwW, DrwH), cookie) return PutStillCookie{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 PutStillCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for PutStill +// putStillRequest writes a PutStill request to a byte slice. func putStillRequest(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) []byte { size := 32 b := 0 @@ -1734,30 +1741,35 @@ func putStillRequest(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto return buf } -// Request GetVideo -// size: 32 +// GetVideoCookie is a cookie used only for GetVideo requests. type GetVideoCookie struct { *xgb.Cookie } -// Write request to wire for GetVideo +// GetVideo sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetVideo(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) GetVideoCookie { cookie := c.NewCookie(false, false) c.NewRequest(getVideoRequest(c, Port, Drawable, Gc, VidX, VidY, VidW, VidH, DrwX, DrwY, DrwW, DrwH), cookie) return GetVideoCookie{cookie} } +// GetVideoChecked sends a checked request. +// If an error occurs, it can be retrieved using GetVideoCookie.Check() func GetVideoChecked(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) GetVideoCookie { cookie := c.NewCookie(true, false) c.NewRequest(getVideoRequest(c, Port, Drawable, Gc, VidX, VidY, VidW, VidH, DrwX, DrwY, DrwW, DrwH), cookie) return GetVideoCookie{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 GetVideoCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for GetVideo +// getVideoRequest writes a GetVideo request to a byte slice. func getVideoRequest(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) []byte { size := 32 b := 0 @@ -1808,30 +1820,35 @@ func getVideoRequest(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto return buf } -// Request GetStill -// size: 32 +// GetStillCookie is a cookie used only for GetStill requests. type GetStillCookie struct { *xgb.Cookie } -// Write request to wire for GetStill +// GetStill sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetStill(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) GetStillCookie { cookie := c.NewCookie(false, false) c.NewRequest(getStillRequest(c, Port, Drawable, Gc, VidX, VidY, VidW, VidH, DrwX, DrwY, DrwW, DrwH), cookie) return GetStillCookie{cookie} } +// GetStillChecked sends a checked request. +// If an error occurs, it can be retrieved using GetStillCookie.Check() func GetStillChecked(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) GetStillCookie { cookie := c.NewCookie(true, false) c.NewRequest(getStillRequest(c, Port, Drawable, Gc, VidX, VidY, VidW, VidH, DrwX, DrwY, DrwW, DrwH), cookie) return GetStillCookie{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 GetStillCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for GetStill +// getStillRequest writes a GetStill request to a byte slice. func getStillRequest(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) []byte { size := 32 b := 0 @@ -1882,30 +1899,35 @@ func getStillRequest(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto return buf } -// Request StopVideo -// size: 12 +// StopVideoCookie is a cookie used only for StopVideo requests. type StopVideoCookie struct { *xgb.Cookie } -// Write request to wire for StopVideo +// StopVideo sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func StopVideo(c *xgb.Conn, Port Port, Drawable xproto.Drawable) StopVideoCookie { cookie := c.NewCookie(false, false) c.NewRequest(stopVideoRequest(c, Port, Drawable), cookie) return StopVideoCookie{cookie} } +// StopVideoChecked sends a checked request. +// If an error occurs, it can be retrieved using StopVideoCookie.Check() func StopVideoChecked(c *xgb.Conn, Port Port, Drawable xproto.Drawable) StopVideoCookie { cookie := c.NewCookie(true, false) c.NewRequest(stopVideoRequest(c, Port, Drawable), cookie) return StopVideoCookie{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 StopVideoCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for StopVideo +// stopVideoRequest writes a StopVideo request to a byte slice. func stopVideoRequest(c *xgb.Conn, Port Port, Drawable xproto.Drawable) []byte { size := 12 b := 0 @@ -1929,30 +1951,35 @@ func stopVideoRequest(c *xgb.Conn, Port Port, Drawable xproto.Drawable) []byte { return buf } -// Request SelectVideoNotify -// size: 12 +// SelectVideoNotifyCookie is a cookie used only for SelectVideoNotify requests. type SelectVideoNotifyCookie struct { *xgb.Cookie } -// Write request to wire for SelectVideoNotify +// SelectVideoNotify sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SelectVideoNotify(c *xgb.Conn, Drawable xproto.Drawable, Onoff bool) SelectVideoNotifyCookie { cookie := c.NewCookie(false, false) c.NewRequest(selectVideoNotifyRequest(c, Drawable, Onoff), cookie) return SelectVideoNotifyCookie{cookie} } +// SelectVideoNotifyChecked sends a checked request. +// If an error occurs, it can be retrieved using SelectVideoNotifyCookie.Check() func SelectVideoNotifyChecked(c *xgb.Conn, Drawable xproto.Drawable, Onoff bool) SelectVideoNotifyCookie { cookie := c.NewCookie(true, false) c.NewRequest(selectVideoNotifyRequest(c, Drawable, Onoff), cookie) return SelectVideoNotifyCookie{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 SelectVideoNotifyCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for SelectVideoNotify +// selectVideoNotifyRequest writes a SelectVideoNotify request to a byte slice. func selectVideoNotifyRequest(c *xgb.Conn, Drawable xproto.Drawable, Onoff bool) []byte { size := 12 b := 0 @@ -1982,30 +2009,35 @@ func selectVideoNotifyRequest(c *xgb.Conn, Drawable xproto.Drawable, Onoff bool) return buf } -// Request SelectPortNotify -// size: 12 +// SelectPortNotifyCookie is a cookie used only for SelectPortNotify requests. type SelectPortNotifyCookie struct { *xgb.Cookie } -// Write request to wire for SelectPortNotify +// SelectPortNotify sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SelectPortNotify(c *xgb.Conn, Port Port, Onoff bool) SelectPortNotifyCookie { cookie := c.NewCookie(false, false) c.NewRequest(selectPortNotifyRequest(c, Port, Onoff), cookie) return SelectPortNotifyCookie{cookie} } +// SelectPortNotifyChecked sends a checked request. +// If an error occurs, it can be retrieved using SelectPortNotifyCookie.Check() func SelectPortNotifyChecked(c *xgb.Conn, Port Port, Onoff bool) SelectPortNotifyCookie { cookie := c.NewCookie(true, false) c.NewRequest(selectPortNotifyRequest(c, Port, Onoff), cookie) return SelectPortNotifyCookie{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 SelectPortNotifyCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for SelectPortNotify +// selectPortNotifyRequest writes a SelectPortNotify request to a byte slice. func selectPortNotifyRequest(c *xgb.Conn, Port Port, Onoff bool) []byte { size := 12 b := 0 @@ -2035,35 +2067,37 @@ func selectPortNotifyRequest(c *xgb.Conn, Port Port, Onoff bool) []byte { return buf } -// Request QueryBestSize -// size: 20 +// QueryBestSizeCookie is a cookie used only for QueryBestSize requests. type QueryBestSizeCookie struct { *xgb.Cookie } +// QueryBestSize sends a checked request. +// If an error occurs, it will be returned with the reply by calling QueryBestSizeCookie.Reply() func QueryBestSize(c *xgb.Conn, Port Port, VidW uint16, VidH uint16, DrwW uint16, DrwH uint16, Motion bool) QueryBestSizeCookie { cookie := c.NewCookie(true, true) c.NewRequest(queryBestSizeRequest(c, Port, VidW, VidH, DrwW, DrwH, Motion), cookie) return QueryBestSizeCookie{cookie} } +// QueryBestSizeUnchecked sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryBestSizeUnchecked(c *xgb.Conn, Port Port, VidW uint16, VidH uint16, DrwW uint16, DrwH uint16, Motion bool) QueryBestSizeCookie { cookie := c.NewCookie(false, true) c.NewRequest(queryBestSizeRequest(c, Port, VidW, VidH, DrwW, DrwH, Motion), cookie) return QueryBestSizeCookie{cookie} } -// Request reply for QueryBestSize -// size: 12 +// QueryBestSizeReply represents the data returned from a QueryBestSize request. type QueryBestSizeReply 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 ActualWidth uint16 ActualHeight uint16 } -// Waits and reads reply data from request QueryBestSize +// Reply blocks and returns the reply data for a QueryBestSize request. func (cook QueryBestSizeCookie) Reply() (*QueryBestSizeReply, error) { buf, err := cook.Cookie.Reply() if err != nil { @@ -2075,7 +2109,7 @@ func (cook QueryBestSizeCookie) Reply() (*QueryBestSizeReply, error) { return queryBestSizeReply(buf), nil } -// Read reply into structure from buffer for QueryBestSize +// queryBestSizeReply reads a byte slice into a QueryBestSizeReply value. func queryBestSizeReply(buf []byte) *QueryBestSizeReply { v := new(QueryBestSizeReply) b := 1 // skip reply determinant @@ -2098,6 +2132,7 @@ func queryBestSizeReply(buf []byte) *QueryBestSizeReply { } // Write request to wire for QueryBestSize +// queryBestSizeRequest writes a QueryBestSize request to a byte slice. func queryBestSizeRequest(c *xgb.Conn, Port Port, VidW uint16, VidH uint16, DrwW uint16, DrwH uint16, Motion bool) []byte { size := 20 b := 0 @@ -2139,30 +2174,35 @@ func queryBestSizeRequest(c *xgb.Conn, Port Port, VidW uint16, VidH uint16, DrwW return buf } -// Request SetPortAttribute -// size: 16 +// SetPortAttributeCookie is a cookie used only for SetPortAttribute requests. type SetPortAttributeCookie struct { *xgb.Cookie } -// Write request to wire for SetPortAttribute +// SetPortAttribute sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetPortAttribute(c *xgb.Conn, Port Port, Attribute xproto.Atom, Value int32) SetPortAttributeCookie { cookie := c.NewCookie(false, false) c.NewRequest(setPortAttributeRequest(c, Port, Attribute, Value), cookie) return SetPortAttributeCookie{cookie} } +// SetPortAttributeChecked sends a checked request. +// If an error occurs, it can be retrieved using SetPortAttributeCookie.Check() func SetPortAttributeChecked(c *xgb.Conn, Port Port, Attribute xproto.Atom, Value int32) SetPortAttributeCookie { cookie := c.NewCookie(true, false) c.NewRequest(setPortAttributeRequest(c, Port, Attribute, Value), cookie) return SetPortAttributeCookie{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 SetPortAttributeCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for SetPortAttribute +// setPortAttributeRequest writes a SetPortAttribute request to a byte slice. func setPortAttributeRequest(c *xgb.Conn, Port Port, Attribute xproto.Atom, Value int32) []byte { size := 16 b := 0 @@ -2189,34 +2229,36 @@ func setPortAttributeRequest(c *xgb.Conn, Port Port, Attribute xproto.Atom, Valu return buf } -// Request GetPortAttribute -// size: 12 +// GetPortAttributeCookie is a cookie used only for GetPortAttribute requests. type GetPortAttributeCookie struct { *xgb.Cookie } +// GetPortAttribute sends a checked request. +// If an error occurs, it will be returned with the reply by calling GetPortAttributeCookie.Reply() func GetPortAttribute(c *xgb.Conn, Port Port, Attribute xproto.Atom) GetPortAttributeCookie { cookie := c.NewCookie(true, true) c.NewRequest(getPortAttributeRequest(c, Port, Attribute), cookie) return GetPortAttributeCookie{cookie} } +// GetPortAttributeUnchecked sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetPortAttributeUnchecked(c *xgb.Conn, Port Port, Attribute xproto.Atom) GetPortAttributeCookie { cookie := c.NewCookie(false, true) c.NewRequest(getPortAttributeRequest(c, Port, Attribute), cookie) return GetPortAttributeCookie{cookie} } -// Request reply for GetPortAttribute -// size: 12 +// GetPortAttributeReply represents the data returned from a GetPortAttribute request. type GetPortAttributeReply 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 Value int32 } -// Waits and reads reply data from request GetPortAttribute +// Reply blocks and returns the reply data for a GetPortAttribute request. func (cook GetPortAttributeCookie) Reply() (*GetPortAttributeReply, error) { buf, err := cook.Cookie.Reply() if err != nil { @@ -2228,7 +2270,7 @@ func (cook GetPortAttributeCookie) Reply() (*GetPortAttributeReply, error) { return getPortAttributeReply(buf), nil } -// Read reply into structure from buffer for GetPortAttribute +// getPortAttributeReply reads a byte slice into a GetPortAttributeReply value. func getPortAttributeReply(buf []byte) *GetPortAttributeReply { v := new(GetPortAttributeReply) b := 1 // skip reply determinant @@ -2248,6 +2290,7 @@ func getPortAttributeReply(buf []byte) *GetPortAttributeReply { } // Write request to wire for GetPortAttribute +// getPortAttributeRequest writes a GetPortAttribute request to a byte slice. func getPortAttributeRequest(c *xgb.Conn, Port Port, Attribute xproto.Atom) []byte { size := 12 b := 0 @@ -2271,29 +2314,31 @@ func getPortAttributeRequest(c *xgb.Conn, Port Port, Attribute xproto.Atom) []by return buf } -// Request QueryPortAttributes -// size: 8 +// QueryPortAttributesCookie is a cookie used only for QueryPortAttributes requests. type QueryPortAttributesCookie struct { *xgb.Cookie } +// QueryPortAttributes sends a checked request. +// If an error occurs, it will be returned with the reply by calling QueryPortAttributesCookie.Reply() func QueryPortAttributes(c *xgb.Conn, Port Port) QueryPortAttributesCookie { cookie := c.NewCookie(true, true) c.NewRequest(queryPortAttributesRequest(c, Port), cookie) return QueryPortAttributesCookie{cookie} } +// QueryPortAttributesUnchecked sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryPortAttributesUnchecked(c *xgb.Conn, Port Port) QueryPortAttributesCookie { cookie := c.NewCookie(false, true) c.NewRequest(queryPortAttributesRequest(c, Port), cookie) return QueryPortAttributesCookie{cookie} } -// Request reply for QueryPortAttributes -// size: (32 + AttributeInfoListSize(Attributes)) +// QueryPortAttributesReply represents the data returned from a QueryPortAttributes request. type QueryPortAttributesReply 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 NumAttributes uint32 TextSize uint32 @@ -2301,7 +2346,7 @@ type QueryPortAttributesReply struct { Attributes []AttributeInfo // size: AttributeInfoListSize(Attributes) } -// Waits and reads reply data from request QueryPortAttributes +// Reply blocks and returns the reply data for a QueryPortAttributes request. func (cook QueryPortAttributesCookie) Reply() (*QueryPortAttributesReply, error) { buf, err := cook.Cookie.Reply() if err != nil { @@ -2313,7 +2358,7 @@ func (cook QueryPortAttributesCookie) Reply() (*QueryPortAttributesReply, error) return queryPortAttributesReply(buf), nil } -// Read reply into structure from buffer for QueryPortAttributes +// queryPortAttributesReply reads a byte slice into a QueryPortAttributesReply value. func queryPortAttributesReply(buf []byte) *QueryPortAttributesReply { v := new(QueryPortAttributesReply) b := 1 // skip reply determinant @@ -2341,6 +2386,7 @@ func queryPortAttributesReply(buf []byte) *QueryPortAttributesReply { } // Write request to wire for QueryPortAttributes +// queryPortAttributesRequest writes a QueryPortAttributes request to a byte slice. func queryPortAttributesRequest(c *xgb.Conn, Port Port) []byte { size := 8 b := 0 @@ -2361,36 +2407,38 @@ func queryPortAttributesRequest(c *xgb.Conn, Port Port) []byte { return buf } -// Request ListImageFormats -// size: 8 +// ListImageFormatsCookie is a cookie used only for ListImageFormats requests. type ListImageFormatsCookie struct { *xgb.Cookie } +// ListImageFormats sends a checked request. +// If an error occurs, it will be returned with the reply by calling ListImageFormatsCookie.Reply() func ListImageFormats(c *xgb.Conn, Port Port) ListImageFormatsCookie { cookie := c.NewCookie(true, true) c.NewRequest(listImageFormatsRequest(c, Port), cookie) return ListImageFormatsCookie{cookie} } +// ListImageFormatsUnchecked sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ListImageFormatsUnchecked(c *xgb.Conn, Port Port) ListImageFormatsCookie { cookie := c.NewCookie(false, true) c.NewRequest(listImageFormatsRequest(c, Port), cookie) return ListImageFormatsCookie{cookie} } -// Request reply for ListImageFormats -// size: (32 + ImageFormatInfoListSize(Format)) +// ListImageFormatsReply represents the data returned from a ListImageFormats request. type ListImageFormatsReply 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 NumFormats uint32 // padding: 20 bytes Format []ImageFormatInfo // size: ImageFormatInfoListSize(Format) } -// Waits and reads reply data from request ListImageFormats +// Reply blocks and returns the reply data for a ListImageFormats request. func (cook ListImageFormatsCookie) Reply() (*ListImageFormatsReply, error) { buf, err := cook.Cookie.Reply() if err != nil { @@ -2402,7 +2450,7 @@ func (cook ListImageFormatsCookie) Reply() (*ListImageFormatsReply, error) { return listImageFormatsReply(buf), nil } -// Read reply into structure from buffer for ListImageFormats +// listImageFormatsReply reads a byte slice into a ListImageFormatsReply value. func listImageFormatsReply(buf []byte) *ListImageFormatsReply { v := new(ListImageFormatsReply) b := 1 // skip reply determinant @@ -2427,6 +2475,7 @@ func listImageFormatsReply(buf []byte) *ListImageFormatsReply { } // Write request to wire for ListImageFormats +// listImageFormatsRequest writes a ListImageFormats request to a byte slice. func listImageFormatsRequest(c *xgb.Conn, Port Port) []byte { size := 8 b := 0 @@ -2447,29 +2496,31 @@ func listImageFormatsRequest(c *xgb.Conn, Port Port) []byte { return buf } -// Request QueryImageAttributes -// size: 16 +// QueryImageAttributesCookie is a cookie used only for QueryImageAttributes requests. type QueryImageAttributesCookie struct { *xgb.Cookie } +// QueryImageAttributes sends a checked request. +// If an error occurs, it will be returned with the reply by calling QueryImageAttributesCookie.Reply() func QueryImageAttributes(c *xgb.Conn, Port Port, Id uint32, Width uint16, Height uint16) QueryImageAttributesCookie { cookie := c.NewCookie(true, true) c.NewRequest(queryImageAttributesRequest(c, Port, Id, Width, Height), cookie) return QueryImageAttributesCookie{cookie} } +// QueryImageAttributesUnchecked sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryImageAttributesUnchecked(c *xgb.Conn, Port Port, Id uint32, Width uint16, Height uint16) QueryImageAttributesCookie { cookie := c.NewCookie(false, true) c.NewRequest(queryImageAttributesRequest(c, Port, Id, Width, Height), cookie) return QueryImageAttributesCookie{cookie} } -// Request reply for QueryImageAttributes -// size: ((32 + xgb.Pad((int(NumPlanes) * 4))) + xgb.Pad((int(NumPlanes) * 4))) +// QueryImageAttributesReply represents the data returned from a QueryImageAttributes request. type QueryImageAttributesReply 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 NumPlanes uint32 DataSize uint32 @@ -2480,7 +2531,7 @@ type QueryImageAttributesReply struct { Offsets []uint32 // size: xgb.Pad((int(NumPlanes) * 4)) } -// Waits and reads reply data from request QueryImageAttributes +// Reply blocks and returns the reply data for a QueryImageAttributes request. func (cook QueryImageAttributesCookie) Reply() (*QueryImageAttributesReply, error) { buf, err := cook.Cookie.Reply() if err != nil { @@ -2492,7 +2543,7 @@ func (cook QueryImageAttributesCookie) Reply() (*QueryImageAttributesReply, erro return queryImageAttributesReply(buf), nil } -// Read reply into structure from buffer for QueryImageAttributes +// queryImageAttributesReply reads a byte slice into a QueryImageAttributesReply value. func queryImageAttributesReply(buf []byte) *QueryImageAttributesReply { v := new(QueryImageAttributesReply) b := 1 // skip reply determinant @@ -2537,6 +2588,7 @@ func queryImageAttributesReply(buf []byte) *QueryImageAttributesReply { } // Write request to wire for QueryImageAttributes +// queryImageAttributesRequest writes a QueryImageAttributes request to a byte slice. func queryImageAttributesRequest(c *xgb.Conn, Port Port, Id uint32, Width uint16, Height uint16) []byte { size := 16 b := 0 @@ -2566,30 +2618,35 @@ func queryImageAttributesRequest(c *xgb.Conn, Port Port, Id uint32, Width uint16 return buf } -// Request PutImage -// size: xgb.Pad((40 + xgb.Pad((len(Data) * 1)))) +// PutImageCookie is a cookie used only for PutImage requests. type PutImageCookie struct { *xgb.Cookie } -// Write request to wire for PutImage +// PutImage sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func PutImage(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, Id uint32, SrcX int16, SrcY int16, SrcW uint16, SrcH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16, Width uint16, Height uint16, Data []byte) PutImageCookie { cookie := c.NewCookie(false, false) c.NewRequest(putImageRequest(c, Port, Drawable, Gc, Id, SrcX, SrcY, SrcW, SrcH, DrwX, DrwY, DrwW, DrwH, Width, Height, Data), cookie) return PutImageCookie{cookie} } +// PutImageChecked sends a checked request. +// If an error occurs, it can be retrieved using PutImageCookie.Check() func PutImageChecked(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, Id uint32, SrcX int16, SrcY int16, SrcW uint16, SrcH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16, Width uint16, Height uint16, Data []byte) PutImageCookie { cookie := c.NewCookie(true, false) c.NewRequest(putImageRequest(c, Port, Drawable, Gc, Id, SrcX, SrcY, SrcW, SrcH, DrwX, DrwY, DrwW, DrwH, Width, Height, Data), cookie) return PutImageCookie{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 PutImageCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for PutImage +// putImageRequest writes a PutImage request to a byte slice. func putImageRequest(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, Id uint32, SrcX int16, SrcY int16, SrcW uint16, SrcH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16, Width uint16, Height uint16, Data []byte) []byte { size := xgb.Pad((40 + xgb.Pad((len(Data) * 1)))) b := 0 @@ -2652,30 +2709,35 @@ func putImageRequest(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto return buf } -// Request ShmPutImage -// size: 52 +// ShmPutImageCookie is a cookie used only for ShmPutImage requests. type ShmPutImageCookie struct { *xgb.Cookie } -// Write request to wire for ShmPutImage +// ShmPutImage sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ShmPutImage(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, Shmseg shm.Seg, Id uint32, Offset uint32, SrcX int16, SrcY int16, SrcW uint16, SrcH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16, Width uint16, Height uint16, SendEvent byte) ShmPutImageCookie { cookie := c.NewCookie(false, false) c.NewRequest(shmPutImageRequest(c, Port, Drawable, Gc, Shmseg, Id, Offset, SrcX, SrcY, SrcW, SrcH, DrwX, DrwY, DrwW, DrwH, Width, Height, SendEvent), cookie) return ShmPutImageCookie{cookie} } +// ShmPutImageChecked sends a checked request. +// If an error occurs, it can be retrieved using ShmPutImageCookie.Check() func ShmPutImageChecked(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, Shmseg shm.Seg, Id uint32, Offset uint32, SrcX int16, SrcY int16, SrcW uint16, SrcH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16, Width uint16, Height uint16, SendEvent byte) ShmPutImageCookie { cookie := c.NewCookie(true, false) c.NewRequest(shmPutImageRequest(c, Port, Drawable, Gc, Shmseg, Id, Offset, SrcX, SrcY, SrcW, SrcH, DrwX, DrwY, DrwW, DrwH, Width, Height, SendEvent), cookie) return ShmPutImageCookie{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 ShmPutImageCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for ShmPutImage +// shmPutImageRequest writes a ShmPutImage request to a byte slice. func shmPutImageRequest(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, Shmseg shm.Seg, Id uint32, Offset uint32, SrcX int16, SrcY int16, SrcW uint16, SrcH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16, Width uint16, Height uint16, SendEvent byte) []byte { size := 52 b := 0 -- cgit v1.2.3-70-g09d2