diff options
| author | Andrew Gallant (Ocelot) <Andrew.Gallant@tufts.edu> | 2012-05-05 18:22:24 -0400 | 
|---|---|---|
| committer | Andrew Gallant (Ocelot) <Andrew.Gallant@tufts.edu> | 2012-05-05 18:22:24 -0400 | 
| commit | 369ad0d33e51035a3e48436fc85f60130b201437 (patch) | |
| tree | e3b4bec82f4e21cfc0e8cc3c696f56b58bb30869 /nexgb | |
| parent | b6715f376f5ea3efb58146c58924dcc7b1536181 (diff) | |
| download | haven-369ad0d33e51035a3e48436fc85f60130b201437.tar.gz haven-369ad0d33e51035a3e48436fc85f60130b201437.tar.xz haven-369ad0d33e51035a3e48436fc85f60130b201437.zip | |
extensions are working! extensions are working!
Diffstat (limited to 'nexgb')
| -rw-r--r-- | nexgb/conn.go | 4 | ||||
| -rw-r--r-- | nexgb/cookie.go | 51 | ||||
| -rw-r--r-- | nexgb/examples/atom.go | 2 | ||||
| -rw-r--r-- | nexgb/examples/property.go | 10 | ||||
| -rw-r--r-- | nexgb/randr.go | 3988 | ||||
| -rw-r--r-- | nexgb/render.go | 3506 | ||||
| -rw-r--r-- | nexgb/xgb.go | 102 | ||||
| -rw-r--r-- | nexgb/xgb_help.go | 52 | ||||
| -rw-r--r-- | nexgb/xinerama.go | 629 | ||||
| -rw-r--r-- | nexgb/xproto.go | 2847 | 
10 files changed, 10360 insertions, 831 deletions
| diff --git a/nexgb/conn.go b/nexgb/conn.go index 235402d..02396d4 100644 --- a/nexgb/conn.go +++ b/nexgb/conn.go @@ -10,7 +10,8 @@ import (  	"strings"  ) -// connect connects to the X server given in the 'display' string. +// connect connects to the X server given in the 'display' string, +// and does all the necessary setup handshaking.  // If 'display' is empty it will be taken from os.Getenv("DISPLAY").  // Note that you should read and understand the "Connection Setup" of the  // X Protocol Reference Manual before changing this function: @@ -87,6 +88,7 @@ func (c *Conn) connect(display string) error {  	return nil  } +// dial initializes the actual net connection with X.  func (c *Conn) dial(display string) error {  	if len(display) == 0 {  		display = os.Getenv("DISPLAY") diff --git a/nexgb/cookie.go b/nexgb/cookie.go index 502ccbf..7f54a22 100644 --- a/nexgb/cookie.go +++ b/nexgb/cookie.go @@ -4,16 +4,28 @@ import (  	"errors"  ) +// cookie is the internal representation of a cookie, where one is generated +// for *every* request sent by XGB. +// 'cookie' is most frequently used by embedding it into a more specific +// kind of cookie, i.e., 'GetInputFocusCookie'.  type cookie struct { +	conn *Conn  	Sequence        uint16  	replyChan chan []byte  	errorChan chan error  	pingChan chan bool  } -func (c *Conn) newCookie(checked, reply bool) cookie { -	cookie := cookie{ -		Sequence: c.newSequenceId(), +// newCookie creates a new cookie with the correct channels initialized +// depending upon the values of 'checked' and 'reply'. Together, there are +// four different kinds of cookies. (See more detailed comments in the +// function for more info on those.) +// Note that a sequence number is not set until just before the request +// corresponding to this cookie is sent over the wire. +func (c *Conn) newCookie(checked, reply bool) *cookie { +	cookie := &cookie{ +		conn: c, +		Sequence: 0, // we add the sequence id just before sending a request  		replyChan: nil,  		errorChan: nil,  		pingChan: nil, @@ -48,6 +60,8 @@ func (c *Conn) newCookie(checked, reply bool) cookie {  	return cookie  } +// reply detects whether this is a checked or unchecked cookie, and calls +// 'replyChecked' or 'replyUnchecked' appropriately.  func (c cookie) reply() ([]byte, error) {  	// checked  	if c.errorChan != nil { @@ -56,6 +70,10 @@ func (c cookie) reply() ([]byte, error) {  	return c.replyUnchecked()  } +// replyChecked waits for a response on either the replyChan or errorChan +// channels. If the former arrives, the bytes are returned with a nil error. +// If the latter arrives, no bytes are returned (nil) and the error received +// is returned.  func (c cookie) replyChecked() ([]byte, error) {  	if c.replyChan == nil {  		return nil, errors.New("Cannot call 'replyChecked' on a cookie that " + @@ -75,6 +93,12 @@ func (c cookie) replyChecked() ([]byte, error) {  	panic("unreachable")  } +// replyChecked waits for a response on either the replyChan or pingChan +// channels. If the former arrives, the bytes are returned with a nil error. +// If the latter arrives, no bytes are returned (nil) and a nil error +// is returned. (In the latter case, the corresponding error can be retrieved +// from (Wait|Poll)ForEvent asynchronously.) +// In all honesty, you *probably* don't want to use this method.  func (c cookie) replyUnchecked() ([]byte, error) {  	if c.replyChan == nil {  		return nil, errors.New("Cannot call 'replyUnchecked' on a cookie " + @@ -90,7 +114,15 @@ func (c cookie) replyUnchecked() ([]byte, error) {  	panic("unreachable")  } -func (c cookie) Check() error { +// check is used for checked requests that have no replies. It is a mechanism +// by which to report "success" or "error" in a synchronous fashion. (Therefore, +// unchecked requests without replies cannot use this method.) +// If the request causes an error, it is sent to this cookie's errorChan. +// If the request was successful, there is no response from the server. +// Thus, pingChan is sent a value when the *next* reply is read. +// If no more replies are being processed, we force a round trip request with +// GetInputFocus. +func (c cookie) check() error {  	if c.replyChan != nil {  		return errors.New("Cannot call 'Check' on a cookie that is " +  			"expecting a *reply*. Use 'Reply' instead.") @@ -100,6 +132,17 @@ func (c cookie) Check() error {  			"not expecting a possible *error*.")  	} +	// First do a quick non-blocking check to see if we've been pinged. +	select { +	case err := <-c.errorChan: +		return err +	case <-c.pingChan: +		return nil +	default: +	} + +	// Now force a round trip and try again, but block this time. +	c.conn.GetInputFocus().Reply()  	select {  	case err := <-c.errorChan:  		return err diff --git a/nexgb/examples/atom.go b/nexgb/examples/atom.go index c64acee..2cb7132 100644 --- a/nexgb/examples/atom.go +++ b/nexgb/examples/atom.go @@ -18,7 +18,7 @@ func main() {  	}  	aname := "_NET_ACTIVE_WINDOW" -	atom, err := X.InternAtom(true, uint16(len(aname)), aname) +	atom, err := X.InternAtom(true, uint16(len(aname)), aname).Reply()  	if err != nil {  		log.Fatal(err)  	} diff --git a/nexgb/examples/property.go b/nexgb/examples/property.go index 2477df4..45144c7 100644 --- a/nexgb/examples/property.go +++ b/nexgb/examples/property.go @@ -27,13 +27,15 @@ func main() {  	root := X.DefaultScreen().Root  	aname := "_NET_ACTIVE_WINDOW" -	atom, err := X.InternAtom(true, uint16(len(aname)), aname) +	atom, err := X.InternAtom(true, uint16(len(aname)), aname).Reply()  	if err != nil {  		log.Fatal(err)  	} -	reply, err := X.GetProperty(false, root, atom.Atom, xgb.GetPropertyTypeAny, -		0, (1<<32)-1) +	reply, err := X.GetProperty(false, root, atom.Atom, +		xgb.GetPropertyTypeAny, 0, (1<<32)-1).Reply() +	if err != nil { +		log.Fatal(err) +	}  	log.Printf("%X", get32(reply.Value))  } - diff --git a/nexgb/randr.go b/nexgb/randr.go new file mode 100644 index 0000000..fdb10ca --- /dev/null +++ b/nexgb/randr.go @@ -0,0 +1,3988 @@ +package xgb + +/* +	This file was generated by randr.xml on May 5 2012 6:06:50pm EDT. +	This file is automatically generated. Edit at your peril! +*/ + +// Imports are not necessary for XGB because everything is  +// in one package. They are still listed here for reference. +// import "xproto" +// import "render" + +// Skipping definition for base type 'Id' + +// Skipping definition for base type 'Card8' + +// Skipping definition for base type 'Int16' + +// Skipping definition for base type 'Int32' + +// Skipping definition for base type 'Void' + +// Skipping definition for base type 'Byte' + +// Skipping definition for base type 'Int8' + +// Skipping definition for base type 'Card16' + +// Skipping definition for base type 'Char' + +// Skipping definition for base type 'Card32' + +// Skipping definition for base type 'Double' + +// Skipping definition for base type 'Bool' + +// Skipping definition for base type 'Float' + +const ( +	RandrRotationRotate0   = 1 +	RandrRotationRotate90  = 2 +	RandrRotationRotate180 = 4 +	RandrRotationRotate270 = 8 +	RandrRotationReflectX  = 16 +	RandrRotationReflectY  = 32 +) + +const ( +	RandrSetConfigSuccess           = 0 +	RandrSetConfigInvalidConfigTime = 1 +	RandrSetConfigInvalidTime       = 2 +	RandrSetConfigFailed            = 3 +) + +const ( +	RandrNotifyMaskScreenChange   = 1 +	RandrNotifyMaskCrtcChange     = 2 +	RandrNotifyMaskOutputChange   = 4 +	RandrNotifyMaskOutputProperty = 8 +) + +const ( +	RandrModeFlagHsyncPositive  = 1 +	RandrModeFlagHsyncNegative  = 2 +	RandrModeFlagVsyncPositive  = 4 +	RandrModeFlagVsyncNegative  = 8 +	RandrModeFlagInterlace      = 16 +	RandrModeFlagDoubleScan     = 32 +	RandrModeFlagCsync          = 64 +	RandrModeFlagCsyncPositive  = 128 +	RandrModeFlagCsyncNegative  = 256 +	RandrModeFlagHskewPresent   = 512 +	RandrModeFlagBcast          = 1024 +	RandrModeFlagPixelMultiplex = 2048 +	RandrModeFlagDoubleClock    = 4096 +	RandrModeFlagHalveClock     = 8192 +) + +const ( +	RandrConnectionConnected    = 0 +	RandrConnectionDisconnected = 1 +	RandrConnectionUnknown      = 2 +) + +const ( +	RandrNotifyCrtcChange     = 0 +	RandrNotifyOutputChange   = 1 +	RandrNotifyOutputProperty = 2 +) + +// Skipping resource definition of 'Mode' + +// Skipping resource definition of 'Crtc' + +// Skipping resource definition of 'Output' + +// 'RandrScreenSize' struct definition +// Size: 8 +type RandrScreenSize struct { +	Width   uint16 +	Height  uint16 +	Mwidth  uint16 +	Mheight uint16 +} + +// Struct read RandrScreenSize +func ReadRandrScreenSize(buf []byte, v *RandrScreenSize) int { +	b := 0 + +	v.Width = Get16(buf[b:]) +	b += 2 + +	v.Height = Get16(buf[b:]) +	b += 2 + +	v.Mwidth = Get16(buf[b:]) +	b += 2 + +	v.Mheight = Get16(buf[b:]) +	b += 2 + +	return b +} + +// Struct list read RandrScreenSize +func ReadRandrScreenSizeList(buf []byte, dest []RandrScreenSize) int { +	b := 0 +	for i := 0; i < len(dest); i++ { +		dest[i] = RandrScreenSize{} +		b += ReadRandrScreenSize(buf[b:], &dest[i]) +	} +	return pad(b) +} + +// Struct write RandrScreenSize +func (v RandrScreenSize) Bytes() []byte { +	buf := make([]byte, 8) +	b := 0 + +	Put16(buf[b:], v.Width) +	b += 2 + +	Put16(buf[b:], v.Height) +	b += 2 + +	Put16(buf[b:], v.Mwidth) +	b += 2 + +	Put16(buf[b:], v.Mheight) +	b += 2 + +	return buf +} + +// Write struct list RandrScreenSize +func RandrScreenSizeListBytes(buf []byte, list []RandrScreenSize) int { +	b := 0 +	var structBytes []byte +	for _, item := range list { +		structBytes = item.Bytes() +		copy(buf[b:], structBytes) +		b += pad(len(structBytes)) +	} +	return b +} + +// 'RandrRefreshRates' struct definition +// Size: (2 + pad((int(NRates) * 2))) +type RandrRefreshRates struct { +	NRates uint16 +	Rates  []uint16 // size: pad((int(NRates) * 2)) +} + +// Struct read RandrRefreshRates +func ReadRandrRefreshRates(buf []byte, v *RandrRefreshRates) int { +	b := 0 + +	v.NRates = Get16(buf[b:]) +	b += 2 + +	v.Rates = make([]uint16, v.NRates) +	for i := 0; i < int(v.NRates); i++ { +		v.Rates[i] = Get16(buf[b:]) +		b += 2 +	} +	b = pad(b) + +	return b +} + +// Struct list read RandrRefreshRates +func ReadRandrRefreshRatesList(buf []byte, dest []RandrRefreshRates) int { +	b := 0 +	for i := 0; i < len(dest); i++ { +		dest[i] = RandrRefreshRates{} +		b += ReadRandrRefreshRates(buf[b:], &dest[i]) +	} +	return pad(b) +} + +// Struct write RandrRefreshRates +func (v RandrRefreshRates) Bytes() []byte { +	buf := make([]byte, (2 + pad((int(v.NRates) * 2)))) +	b := 0 + +	Put16(buf[b:], v.NRates) +	b += 2 + +	for i := 0; i < int(v.NRates); i++ { +		Put16(buf[b:], v.Rates[i]) +		b += 2 +	} +	b = pad(b) + +	return buf +} + +// Write struct list RandrRefreshRates +func RandrRefreshRatesListBytes(buf []byte, list []RandrRefreshRates) int { +	b := 0 +	var structBytes []byte +	for _, item := range list { +		structBytes = item.Bytes() +		copy(buf[b:], structBytes) +		b += pad(len(structBytes)) +	} +	return b +} + +// Struct list size RandrRefreshRates +func RandrRefreshRatesListSize(list []RandrRefreshRates) int { +	size := 0 +	for _, item := range list { +		size += (2 + pad((int(item.NRates) * 2))) +	} +	return size +} + +// 'RandrModeInfo' struct definition +// Size: 32 +type RandrModeInfo struct { +	Id         uint32 +	Width      uint16 +	Height     uint16 +	DotClock   uint32 +	HsyncStart uint16 +	HsyncEnd   uint16 +	Htotal     uint16 +	Hskew      uint16 +	VsyncStart uint16 +	VsyncEnd   uint16 +	Vtotal     uint16 +	NameLen    uint16 +	ModeFlags  uint32 +} + +// Struct read RandrModeInfo +func ReadRandrModeInfo(buf []byte, v *RandrModeInfo) int { +	b := 0 + +	v.Id = Get32(buf[b:]) +	b += 4 + +	v.Width = Get16(buf[b:]) +	b += 2 + +	v.Height = Get16(buf[b:]) +	b += 2 + +	v.DotClock = Get32(buf[b:]) +	b += 4 + +	v.HsyncStart = Get16(buf[b:]) +	b += 2 + +	v.HsyncEnd = Get16(buf[b:]) +	b += 2 + +	v.Htotal = Get16(buf[b:]) +	b += 2 + +	v.Hskew = Get16(buf[b:]) +	b += 2 + +	v.VsyncStart = Get16(buf[b:]) +	b += 2 + +	v.VsyncEnd = Get16(buf[b:]) +	b += 2 + +	v.Vtotal = Get16(buf[b:]) +	b += 2 + +	v.NameLen = Get16(buf[b:]) +	b += 2 + +	v.ModeFlags = Get32(buf[b:]) +	b += 4 + +	return b +} + +// Struct list read RandrModeInfo +func ReadRandrModeInfoList(buf []byte, dest []RandrModeInfo) int { +	b := 0 +	for i := 0; i < len(dest); i++ { +		dest[i] = RandrModeInfo{} +		b += ReadRandrModeInfo(buf[b:], &dest[i]) +	} +	return pad(b) +} + +// Struct write RandrModeInfo +func (v RandrModeInfo) Bytes() []byte { +	buf := make([]byte, 32) +	b := 0 + +	Put32(buf[b:], v.Id) +	b += 4 + +	Put16(buf[b:], v.Width) +	b += 2 + +	Put16(buf[b:], v.Height) +	b += 2 + +	Put32(buf[b:], v.DotClock) +	b += 4 + +	Put16(buf[b:], v.HsyncStart) +	b += 2 + +	Put16(buf[b:], v.HsyncEnd) +	b += 2 + +	Put16(buf[b:], v.Htotal) +	b += 2 + +	Put16(buf[b:], v.Hskew) +	b += 2 + +	Put16(buf[b:], v.VsyncStart) +	b += 2 + +	Put16(buf[b:], v.VsyncEnd) +	b += 2 + +	Put16(buf[b:], v.Vtotal) +	b += 2 + +	Put16(buf[b:], v.NameLen) +	b += 2 + +	Put32(buf[b:], v.ModeFlags) +	b += 4 + +	return buf +} + +// Write struct list RandrModeInfo +func RandrModeInfoListBytes(buf []byte, list []RandrModeInfo) int { +	b := 0 +	var structBytes []byte +	for _, item := range list { +		structBytes = item.Bytes() +		copy(buf[b:], structBytes) +		b += pad(len(structBytes)) +	} +	return b +} + +// 'RandrCrtcChange' struct definition +// Size: 28 +type RandrCrtcChange struct { +	Timestamp Timestamp +	Window    Id +	Crtc      Id +	Mode      Id +	Rotation  uint16 +	// padding: 2 bytes +	X      int16 +	Y      int16 +	Width  uint16 +	Height uint16 +} + +// Struct read RandrCrtcChange +func ReadRandrCrtcChange(buf []byte, v *RandrCrtcChange) int { +	b := 0 + +	v.Timestamp = Timestamp(Get32(buf[b:])) +	b += 4 + +	v.Window = Id(Get32(buf[b:])) +	b += 4 + +	v.Crtc = Id(Get32(buf[b:])) +	b += 4 + +	v.Mode = Id(Get32(buf[b:])) +	b += 4 + +	v.Rotation = Get16(buf[b:]) +	b += 2 + +	b += 2 // padding + +	v.X = int16(Get16(buf[b:])) +	b += 2 + +	v.Y = int16(Get16(buf[b:])) +	b += 2 + +	v.Width = Get16(buf[b:]) +	b += 2 + +	v.Height = Get16(buf[b:]) +	b += 2 + +	return b +} + +// Struct list read RandrCrtcChange +func ReadRandrCrtcChangeList(buf []byte, dest []RandrCrtcChange) int { +	b := 0 +	for i := 0; i < len(dest); i++ { +		dest[i] = RandrCrtcChange{} +		b += ReadRandrCrtcChange(buf[b:], &dest[i]) +	} +	return pad(b) +} + +// Struct write RandrCrtcChange +func (v RandrCrtcChange) Bytes() []byte { +	buf := make([]byte, 28) +	b := 0 + +	Put32(buf[b:], uint32(v.Timestamp)) +	b += 4 + +	Put32(buf[b:], uint32(v.Window)) +	b += 4 + +	Put32(buf[b:], uint32(v.Crtc)) +	b += 4 + +	Put32(buf[b:], uint32(v.Mode)) +	b += 4 + +	Put16(buf[b:], v.Rotation) +	b += 2 + +	b += 2 // padding + +	Put16(buf[b:], uint16(v.X)) +	b += 2 + +	Put16(buf[b:], uint16(v.Y)) +	b += 2 + +	Put16(buf[b:], v.Width) +	b += 2 + +	Put16(buf[b:], v.Height) +	b += 2 + +	return buf +} + +// Write struct list RandrCrtcChange +func RandrCrtcChangeListBytes(buf []byte, list []RandrCrtcChange) int { +	b := 0 +	var structBytes []byte +	for _, item := range list { +		structBytes = item.Bytes() +		copy(buf[b:], structBytes) +		b += pad(len(structBytes)) +	} +	return b +} + +// 'RandrOutputChange' struct definition +// Size: 28 +type RandrOutputChange struct { +	Timestamp       Timestamp +	ConfigTimestamp Timestamp +	Window          Id +	Output          Id +	Crtc            Id +	Mode            Id +	Rotation        uint16 +	Connection      byte +	SubpixelOrder   byte +} + +// Struct read RandrOutputChange +func ReadRandrOutputChange(buf []byte, v *RandrOutputChange) int { +	b := 0 + +	v.Timestamp = Timestamp(Get32(buf[b:])) +	b += 4 + +	v.ConfigTimestamp = Timestamp(Get32(buf[b:])) +	b += 4 + +	v.Window = Id(Get32(buf[b:])) +	b += 4 + +	v.Output = Id(Get32(buf[b:])) +	b += 4 + +	v.Crtc = Id(Get32(buf[b:])) +	b += 4 + +	v.Mode = Id(Get32(buf[b:])) +	b += 4 + +	v.Rotation = Get16(buf[b:]) +	b += 2 + +	v.Connection = buf[b] +	b += 1 + +	v.SubpixelOrder = buf[b] +	b += 1 + +	return b +} + +// Struct list read RandrOutputChange +func ReadRandrOutputChangeList(buf []byte, dest []RandrOutputChange) int { +	b := 0 +	for i := 0; i < len(dest); i++ { +		dest[i] = RandrOutputChange{} +		b += ReadRandrOutputChange(buf[b:], &dest[i]) +	} +	return pad(b) +} + +// Struct write RandrOutputChange +func (v RandrOutputChange) Bytes() []byte { +	buf := make([]byte, 28) +	b := 0 + +	Put32(buf[b:], uint32(v.Timestamp)) +	b += 4 + +	Put32(buf[b:], uint32(v.ConfigTimestamp)) +	b += 4 + +	Put32(buf[b:], uint32(v.Window)) +	b += 4 + +	Put32(buf[b:], uint32(v.Output)) +	b += 4 + +	Put32(buf[b:], uint32(v.Crtc)) +	b += 4 + +	Put32(buf[b:], uint32(v.Mode)) +	b += 4 + +	Put16(buf[b:], v.Rotation) +	b += 2 + +	buf[b] = v.Connection +	b += 1 + +	buf[b] = v.SubpixelOrder +	b += 1 + +	return buf +} + +// Write struct list RandrOutputChange +func RandrOutputChangeListBytes(buf []byte, list []RandrOutputChange) int { +	b := 0 +	var structBytes []byte +	for _, item := range list { +		structBytes = item.Bytes() +		copy(buf[b:], structBytes) +		b += pad(len(structBytes)) +	} +	return b +} + +// 'RandrOutputProperty' struct definition +// Size: 28 +type RandrOutputProperty struct { +	Window    Id +	Output    Id +	Atom      Id +	Timestamp Timestamp +	Status    byte +	// padding: 11 bytes +} + +// Struct read RandrOutputProperty +func ReadRandrOutputProperty(buf []byte, v *RandrOutputProperty) int { +	b := 0 + +	v.Window = Id(Get32(buf[b:])) +	b += 4 + +	v.Output = Id(Get32(buf[b:])) +	b += 4 + +	v.Atom = Id(Get32(buf[b:])) +	b += 4 + +	v.Timestamp = Timestamp(Get32(buf[b:])) +	b += 4 + +	v.Status = buf[b] +	b += 1 + +	b += 11 // padding + +	return b +} + +// Struct list read RandrOutputProperty +func ReadRandrOutputPropertyList(buf []byte, dest []RandrOutputProperty) int { +	b := 0 +	for i := 0; i < len(dest); i++ { +		dest[i] = RandrOutputProperty{} +		b += ReadRandrOutputProperty(buf[b:], &dest[i]) +	} +	return pad(b) +} + +// Struct write RandrOutputProperty +func (v RandrOutputProperty) Bytes() []byte { +	buf := make([]byte, 28) +	b := 0 + +	Put32(buf[b:], uint32(v.Window)) +	b += 4 + +	Put32(buf[b:], uint32(v.Output)) +	b += 4 + +	Put32(buf[b:], uint32(v.Atom)) +	b += 4 + +	Put32(buf[b:], uint32(v.Timestamp)) +	b += 4 + +	buf[b] = v.Status +	b += 1 + +	b += 11 // padding + +	return buf +} + +// Write struct list RandrOutputProperty +func RandrOutputPropertyListBytes(buf []byte, list []RandrOutputProperty) int { +	b := 0 +	var structBytes []byte +	for _, item := range list { +		structBytes = item.Bytes() +		copy(buf[b:], structBytes) +		b += pad(len(structBytes)) +	} +	return b +} + +// Union definition RandrNotifyDataUnion +// Note that to *create* a Union, you should *never* create +// this struct directly (unless you know what you're doing). +// Instead use one of the following constructors for 'RandrNotifyDataUnion': +//     NewRandrNotifyDataUnionCc(Cc RandrCrtcChange) RandrNotifyDataUnion +//     NewRandrNotifyDataUnionOc(Oc RandrOutputChange) RandrNotifyDataUnion +//     NewRandrNotifyDataUnionOp(Op RandrOutputProperty) RandrNotifyDataUnion +type RandrNotifyDataUnion struct { +	Cc RandrCrtcChange +	Oc RandrOutputChange +	Op RandrOutputProperty +} + +// Union constructor for RandrNotifyDataUnion for field Cc. +func NewRandrNotifyDataUnionCc(Cc RandrCrtcChange) RandrNotifyDataUnion { +	var b int +	buf := make([]byte, 28) + +	{ +		structBytes := Cc.Bytes() +		copy(buf[b:], structBytes) +		b += pad(len(structBytes)) +	} + +	// Create the Union type +	v := RandrNotifyDataUnion{} + +	// Now copy buf into all fields + +	b = 0 // always read the same bytes +	v.Cc = RandrCrtcChange{} +	b += ReadRandrCrtcChange(buf[b:], &v.Cc) + +	b = 0 // always read the same bytes +	v.Oc = RandrOutputChange{} +	b += ReadRandrOutputChange(buf[b:], &v.Oc) + +	b = 0 // always read the same bytes +	v.Op = RandrOutputProperty{} +	b += ReadRandrOutputProperty(buf[b:], &v.Op) + +	return v +} + +// Union constructor for RandrNotifyDataUnion for field Oc. +func NewRandrNotifyDataUnionOc(Oc RandrOutputChange) RandrNotifyDataUnion { +	var b int +	buf := make([]byte, 28) + +	{ +		structBytes := Oc.Bytes() +		copy(buf[b:], structBytes) +		b += pad(len(structBytes)) +	} + +	// Create the Union type +	v := RandrNotifyDataUnion{} + +	// Now copy buf into all fields + +	b = 0 // always read the same bytes +	v.Cc = RandrCrtcChange{} +	b += ReadRandrCrtcChange(buf[b:], &v.Cc) + +	b = 0 // always read the same bytes +	v.Oc = RandrOutputChange{} +	b += ReadRandrOutputChange(buf[b:], &v.Oc) + +	b = 0 // always read the same bytes +	v.Op = RandrOutputProperty{} +	b += ReadRandrOutputProperty(buf[b:], &v.Op) + +	return v +} + +// Union constructor for RandrNotifyDataUnion for field Op. +func NewRandrNotifyDataUnionOp(Op RandrOutputProperty) RandrNotifyDataUnion { +	var b int +	buf := make([]byte, 28) + +	{ +		structBytes := Op.Bytes() +		copy(buf[b:], structBytes) +		b += pad(len(structBytes)) +	} + +	// Create the Union type +	v := RandrNotifyDataUnion{} + +	// Now copy buf into all fields + +	b = 0 // always read the same bytes +	v.Cc = RandrCrtcChange{} +	b += ReadRandrCrtcChange(buf[b:], &v.Cc) + +	b = 0 // always read the same bytes +	v.Oc = RandrOutputChange{} +	b += ReadRandrOutputChange(buf[b:], &v.Oc) + +	b = 0 // always read the same bytes +	v.Op = RandrOutputProperty{} +	b += ReadRandrOutputProperty(buf[b:], &v.Op) + +	return v +} + +// Union read RandrNotifyDataUnion +func ReadRandrNotifyDataUnion(buf []byte, v *RandrNotifyDataUnion) int { +	var b int + +	b = 0 // re-read the same bytes +	v.Cc = RandrCrtcChange{} +	b += ReadRandrCrtcChange(buf[b:], &v.Cc) + +	b = 0 // re-read the same bytes +	v.Oc = RandrOutputChange{} +	b += ReadRandrOutputChange(buf[b:], &v.Oc) + +	b = 0 // re-read the same bytes +	v.Op = RandrOutputProperty{} +	b += ReadRandrOutputProperty(buf[b:], &v.Op) + +	return 28 +} + +// Union list read RandrNotifyDataUnion +func ReadRandrNotifyDataUnionList(buf []byte, dest []RandrNotifyDataUnion) int { +	b := 0 +	for i := 0; i < len(dest); i++ { +		dest[i] = RandrNotifyDataUnion{} +		b += ReadRandrNotifyDataUnion(buf[b:], &dest[i]) +	} +	return pad(b) +} + +// Union write RandrNotifyDataUnion +// Each field in a union must contain the same data. +// So simply pick the first field and write that to the wire. +func (v RandrNotifyDataUnion) Bytes() []byte { +	buf := make([]byte, 28) +	b := 0 + +	{ +		structBytes := v.Cc.Bytes() +		copy(buf[b:], structBytes) +		b += pad(len(structBytes)) +	} +	return buf +} + +// Union list write RandrNotifyDataUnion +func RandrNotifyDataUnionListBytes(buf []byte, list []RandrNotifyDataUnion) int { +	b := 0 +	var unionBytes []byte +	for _, item := range list { +		unionBytes = item.Bytes() +		copy(buf[b:], unionBytes) +		b += pad(len(unionBytes)) +	} +	return b +} + +// Event definition RandrScreenChangeNotify (0) +// Size: 32 + +const RandrScreenChangeNotify = 0 + +type RandrScreenChangeNotifyEvent struct { +	Sequence        uint16 +	Rotation        byte +	Timestamp       Timestamp +	ConfigTimestamp Timestamp +	Root            Id +	RequestWindow   Id +	SizeID          uint16 +	SubpixelOrder   uint16 +	Width           uint16 +	Height          uint16 +	Mwidth          uint16 +	Mheight         uint16 +} + +// Event read RandrScreenChangeNotify +func NewRandrScreenChangeNotifyEvent(buf []byte) Event { +	v := RandrScreenChangeNotifyEvent{} +	b := 1 // don't read event number + +	v.Rotation = buf[b] +	b += 1 + +	v.Sequence = Get16(buf[b:]) +	b += 2 + +	v.Timestamp = Timestamp(Get32(buf[b:])) +	b += 4 + +	v.ConfigTimestamp = Timestamp(Get32(buf[b:])) +	b += 4 + +	v.Root = Id(Get32(buf[b:])) +	b += 4 + +	v.RequestWindow = Id(Get32(buf[b:])) +	b += 4 + +	v.SizeID = Get16(buf[b:]) +	b += 2 + +	v.SubpixelOrder = Get16(buf[b:]) +	b += 2 + +	v.Width = Get16(buf[b:]) +	b += 2 + +	v.Height = Get16(buf[b:]) +	b += 2 + +	v.Mwidth = Get16(buf[b:]) +	b += 2 + +	v.Mheight = Get16(buf[b:]) +	b += 2 + +	return v +} + +// Event write RandrScreenChangeNotify +func (v RandrScreenChangeNotifyEvent) Bytes() []byte { +	buf := make([]byte, 32) +	b := 0 + +	// write event number +	buf[b] = 0 +	b += 1 + +	buf[b] = v.Rotation +	b += 1 + +	b += 2 // skip sequence number + +	Put32(buf[b:], uint32(v.Timestamp)) +	b += 4 + +	Put32(buf[b:], uint32(v.ConfigTimestamp)) +	b += 4 + +	Put32(buf[b:], uint32(v.Root)) +	b += 4 + +	Put32(buf[b:], uint32(v.RequestWindow)) +	b += 4 + +	Put16(buf[b:], v.SizeID) +	b += 2 + +	Put16(buf[b:], v.SubpixelOrder) +	b += 2 + +	Put16(buf[b:], v.Width) +	b += 2 + +	Put16(buf[b:], v.Height) +	b += 2 + +	Put16(buf[b:], v.Mwidth) +	b += 2 + +	Put16(buf[b:], v.Mheight) +	b += 2 + +	return buf +} + +func (v RandrScreenChangeNotifyEvent) ImplementsEvent() {} + +func (v RandrScreenChangeNotifyEvent) SequenceId() uint16 { +	return v.Sequence +} + +func (v RandrScreenChangeNotifyEvent) String() string { +	fieldVals := make([]string, 0, 11) +	fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) +	fieldVals = append(fieldVals, sprintf("Rotation: %d", v.Rotation)) +	fieldVals = append(fieldVals, sprintf("Timestamp: %d", v.Timestamp)) +	fieldVals = append(fieldVals, sprintf("ConfigTimestamp: %d", v.ConfigTimestamp)) +	fieldVals = append(fieldVals, sprintf("Root: %d", v.Root)) +	fieldVals = append(fieldVals, sprintf("RequestWindow: %d", v.RequestWindow)) +	fieldVals = append(fieldVals, sprintf("SizeID: %d", v.SizeID)) +	fieldVals = append(fieldVals, sprintf("SubpixelOrder: %d", v.SubpixelOrder)) +	fieldVals = append(fieldVals, sprintf("Width: %d", v.Width)) +	fieldVals = append(fieldVals, sprintf("Height: %d", v.Height)) +	fieldVals = append(fieldVals, sprintf("Mwidth: %d", v.Mwidth)) +	fieldVals = append(fieldVals, sprintf("Mheight: %d", v.Mheight)) +	return "RandrScreenChangeNotify {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { +	newEventFuncs[0] = NewRandrScreenChangeNotifyEvent +} + +// Event definition RandrNotify (1) +// Size: 32 + +const RandrNotify = 1 + +type RandrNotifyEvent struct { +	Sequence uint16 +	SubCode  byte +	U        RandrNotifyDataUnion +} + +// Event read RandrNotify +func NewRandrNotifyEvent(buf []byte) Event { +	v := RandrNotifyEvent{} +	b := 1 // don't read event number + +	v.SubCode = buf[b] +	b += 1 + +	v.Sequence = Get16(buf[b:]) +	b += 2 + +	v.U = RandrNotifyDataUnion{} +	b += ReadRandrNotifyDataUnion(buf[b:], &v.U) + +	return v +} + +// Event write RandrNotify +func (v RandrNotifyEvent) Bytes() []byte { +	buf := make([]byte, 32) +	b := 0 + +	// write event number +	buf[b] = 1 +	b += 1 + +	buf[b] = v.SubCode +	b += 1 + +	b += 2 // skip sequence number + +	{ +		unionBytes := v.U.Bytes() +		copy(buf[b:], unionBytes) +		b += pad(len(unionBytes)) +	} + +	return buf +} + +func (v RandrNotifyEvent) ImplementsEvent() {} + +func (v RandrNotifyEvent) SequenceId() uint16 { +	return v.Sequence +} + +func (v RandrNotifyEvent) String() string { +	fieldVals := make([]string, 0, 2) +	fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) +	fieldVals = append(fieldVals, sprintf("SubCode: %d", v.SubCode)) +	return "RandrNotify {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { +	newEventFuncs[1] = NewRandrNotifyEvent +} + +// Error definition RandrBadOutput (0) +// Size: 32 + +const BadRandrBadOutput = 0 + +type RandrBadOutputError struct { +	Sequence uint16 +	NiceName string +} + +// Error read RandrBadOutput +func NewRandrBadOutputError(buf []byte) Error { +	v := RandrBadOutputError{} +	v.NiceName = "RandrBadOutput" + +	b := 1 // skip error determinant +	b += 1 // don't read error number + +	v.Sequence = Get16(buf[b:]) +	b += 2 + +	return v +} + +func (err RandrBadOutputError) ImplementsError() {} + +func (err RandrBadOutputError) SequenceId() uint16 { +	return err.Sequence +} + +func (err RandrBadOutputError) BadId() Id { +	return 0 +} + +func (err RandrBadOutputError) Error() string { +	fieldVals := make([]string, 0, 0) +	fieldVals = append(fieldVals, "NiceName: "+err.NiceName) +	fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) +	return "BadRandrBadOutput {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { +	newErrorFuncs[0] = NewRandrBadOutputError +} + +// Error definition RandrBadCrtc (1) +// Size: 32 + +const BadRandrBadCrtc = 1 + +type RandrBadCrtcError struct { +	Sequence uint16 +	NiceName string +} + +// Error read RandrBadCrtc +func NewRandrBadCrtcError(buf []byte) Error { +	v := RandrBadCrtcError{} +	v.NiceName = "RandrBadCrtc" + +	b := 1 // skip error determinant +	b += 1 // don't read error number + +	v.Sequence = Get16(buf[b:]) +	b += 2 + +	return v +} + +func (err RandrBadCrtcError) ImplementsError() {} + +func (err RandrBadCrtcError) SequenceId() uint16 { +	return err.Sequence +} + +func (err RandrBadCrtcError) BadId() Id { +	return 0 +} + +func (err RandrBadCrtcError) Error() string { +	fieldVals := make([]string, 0, 0) +	fieldVals = append(fieldVals, "NiceName: "+err.NiceName) +	fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) +	return "BadRandrBadCrtc {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { +	newErrorFuncs[1] = NewRandrBadCrtcError +} + +// Error definition RandrBadMode (2) +// Size: 32 + +const BadRandrBadMode = 2 + +type RandrBadModeError struct { +	Sequence uint16 +	NiceName string +} + +// Error read RandrBadMode +func NewRandrBadModeError(buf []byte) Error { +	v := RandrBadModeError{} +	v.NiceName = "RandrBadMode" + +	b := 1 // skip error determinant +	b += 1 // don't read error number + +	v.Sequence = Get16(buf[b:]) +	b += 2 + +	return v +} + +func (err RandrBadModeError) ImplementsError() {} + +func (err RandrBadModeError) SequenceId() uint16 { +	return err.Sequence +} + +func (err RandrBadModeError) BadId() Id { +	return 0 +} + +func (err RandrBadModeError) Error() string { +	fieldVals := make([]string, 0, 0) +	fieldVals = append(fieldVals, "NiceName: "+err.NiceName) +	fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) +	return "BadRandrBadMode {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { +	newErrorFuncs[2] = NewRandrBadModeError +} + +// Request RandrQueryVersion +// size: 12 +type RandrQueryVersionCookie struct { +	*cookie +} + +func (c *Conn) RandrQueryVersion(MajorVersion uint32, MinorVersion uint32) RandrQueryVersionCookie { +	cookie := c.newCookie(true, true) +	c.newRequest(c.randrQueryVersionRequest(MajorVersion, MinorVersion), cookie) +	return RandrQueryVersionCookie{cookie} +} + +func (c *Conn) RandrQueryVersionUnchecked(MajorVersion uint32, MinorVersion uint32) RandrQueryVersionCookie { +	cookie := c.newCookie(false, true) +	c.newRequest(c.randrQueryVersionRequest(MajorVersion, MinorVersion), cookie) +	return RandrQueryVersionCookie{cookie} +} + +// Request reply for RandrQueryVersion +// size: 32 +type RandrQueryVersionReply struct { +	Sequence uint16 +	Length   uint32 +	// padding: 1 bytes +	MajorVersion uint32 +	MinorVersion uint32 +	// padding: 16 bytes +} + +// Waits and reads reply data from request RandrQueryVersion +func (cook RandrQueryVersionCookie) Reply() (*RandrQueryVersionReply, error) { +	buf, err := cook.reply() +	if err != nil { +		return nil, err +	} +	if buf == nil { +		return nil, nil +	} +	return randrQueryVersionReply(buf), nil +} + +// Read reply into structure from buffer for RandrQueryVersion +func randrQueryVersionReply(buf []byte) *RandrQueryVersionReply { +	v := new(RandrQueryVersionReply) +	b := 1 // skip reply determinant + +	b += 1 // padding + +	v.Sequence = Get16(buf[b:]) +	b += 2 + +	v.Length = Get32(buf[b:]) // 4-byte units +	b += 4 + +	v.MajorVersion = Get32(buf[b:]) +	b += 4 + +	v.MinorVersion = Get32(buf[b:]) +	b += 4 + +	b += 16 // padding + +	return v +} + +func (cook RandrQueryVersionCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RandrQueryVersion +func (c *Conn) randrQueryVersionRequest(MajorVersion uint32, MinorVersion uint32) []byte { +	size := 12 +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RANDR"] +	b += 1 + +	buf[b] = 0 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], MajorVersion) +	b += 4 + +	Put32(buf[b:], MinorVersion) +	b += 4 + +	return buf +} + +// Request RandrSetScreenConfig +// size: 24 +type RandrSetScreenConfigCookie struct { +	*cookie +} + +func (c *Conn) RandrSetScreenConfig(Window Id, Timestamp Timestamp, ConfigTimestamp Timestamp, SizeID uint16, Rotation uint16, Rate uint16) RandrSetScreenConfigCookie { +	cookie := c.newCookie(true, true) +	c.newRequest(c.randrSetScreenConfigRequest(Window, Timestamp, ConfigTimestamp, SizeID, Rotation, Rate), cookie) +	return RandrSetScreenConfigCookie{cookie} +} + +func (c *Conn) RandrSetScreenConfigUnchecked(Window Id, Timestamp Timestamp, ConfigTimestamp Timestamp, SizeID uint16, Rotation uint16, Rate uint16) RandrSetScreenConfigCookie { +	cookie := c.newCookie(false, true) +	c.newRequest(c.randrSetScreenConfigRequest(Window, Timestamp, ConfigTimestamp, SizeID, Rotation, Rate), cookie) +	return RandrSetScreenConfigCookie{cookie} +} + +// Request reply for RandrSetScreenConfig +// size: 32 +type RandrSetScreenConfigReply struct { +	Sequence        uint16 +	Length          uint32 +	Status          byte +	NewTimestamp    Timestamp +	ConfigTimestamp Timestamp +	Root            Id +	SubpixelOrder   uint16 +	// padding: 10 bytes +} + +// Waits and reads reply data from request RandrSetScreenConfig +func (cook RandrSetScreenConfigCookie) Reply() (*RandrSetScreenConfigReply, error) { +	buf, err := cook.reply() +	if err != nil { +		return nil, err +	} +	if buf == nil { +		return nil, nil +	} +	return randrSetScreenConfigReply(buf), nil +} + +// Read reply into structure from buffer for RandrSetScreenConfig +func randrSetScreenConfigReply(buf []byte) *RandrSetScreenConfigReply { +	v := new(RandrSetScreenConfigReply) +	b := 1 // skip reply determinant + +	v.Status = buf[b] +	b += 1 + +	v.Sequence = Get16(buf[b:]) +	b += 2 + +	v.Length = Get32(buf[b:]) // 4-byte units +	b += 4 + +	v.NewTimestamp = Timestamp(Get32(buf[b:])) +	b += 4 + +	v.ConfigTimestamp = Timestamp(Get32(buf[b:])) +	b += 4 + +	v.Root = Id(Get32(buf[b:])) +	b += 4 + +	v.SubpixelOrder = Get16(buf[b:]) +	b += 2 + +	b += 10 // padding + +	return v +} + +func (cook RandrSetScreenConfigCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RandrSetScreenConfig +func (c *Conn) randrSetScreenConfigRequest(Window Id, Timestamp Timestamp, ConfigTimestamp Timestamp, SizeID uint16, Rotation uint16, Rate uint16) []byte { +	size := 24 +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RANDR"] +	b += 1 + +	buf[b] = 2 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Window)) +	b += 4 + +	Put32(buf[b:], uint32(Timestamp)) +	b += 4 + +	Put32(buf[b:], uint32(ConfigTimestamp)) +	b += 4 + +	Put16(buf[b:], SizeID) +	b += 2 + +	Put16(buf[b:], Rotation) +	b += 2 + +	Put16(buf[b:], Rate) +	b += 2 + +	b += 2 // padding + +	return buf +} + +// Request RandrSelectInput +// size: 12 +type RandrSelectInputCookie struct { +	*cookie +} + +// Write request to wire for RandrSelectInput +func (c *Conn) RandrSelectInput(Window Id, Enable uint16) RandrSelectInputCookie { +	cookie := c.newCookie(false, false) +	c.newRequest(c.randrSelectInputRequest(Window, Enable), cookie) +	return RandrSelectInputCookie{cookie} +} + +func (c *Conn) RandrSelectInputChecked(Window Id, Enable uint16) RandrSelectInputCookie { +	cookie := c.newCookie(true, false) +	c.newRequest(c.randrSelectInputRequest(Window, Enable), cookie) +	return RandrSelectInputCookie{cookie} +} + +func (cook RandrSelectInputCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RandrSelectInput +func (c *Conn) randrSelectInputRequest(Window Id, Enable uint16) []byte { +	size := 12 +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RANDR"] +	b += 1 + +	buf[b] = 4 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Window)) +	b += 4 + +	Put16(buf[b:], Enable) +	b += 2 + +	b += 2 // padding + +	return buf +} + +// Request RandrGetScreenInfo +// size: 8 +type RandrGetScreenInfoCookie struct { +	*cookie +} + +func (c *Conn) RandrGetScreenInfo(Window Id) RandrGetScreenInfoCookie { +	cookie := c.newCookie(true, true) +	c.newRequest(c.randrGetScreenInfoRequest(Window), cookie) +	return RandrGetScreenInfoCookie{cookie} +} + +func (c *Conn) RandrGetScreenInfoUnchecked(Window Id) RandrGetScreenInfoCookie { +	cookie := c.newCookie(false, true) +	c.newRequest(c.randrGetScreenInfoRequest(Window), cookie) +	return RandrGetScreenInfoCookie{cookie} +} + +// Request reply for RandrGetScreenInfo +// size: ((32 + pad((int(NSizes) * 8))) + RandrRefreshRatesListSize(Rates)) +type RandrGetScreenInfoReply struct { +	Sequence        uint16 +	Length          uint32 +	Rotations       byte +	Root            Id +	Timestamp       Timestamp +	ConfigTimestamp Timestamp +	NSizes          uint16 +	SizeID          uint16 +	Rotation        uint16 +	Rate            uint16 +	NInfo           uint16 +	// padding: 2 bytes +	Sizes []RandrScreenSize   // size: pad((int(NSizes) * 8)) +	Rates []RandrRefreshRates // size: RandrRefreshRatesListSize(Rates) +} + +// Waits and reads reply data from request RandrGetScreenInfo +func (cook RandrGetScreenInfoCookie) Reply() (*RandrGetScreenInfoReply, error) { +	buf, err := cook.reply() +	if err != nil { +		return nil, err +	} +	if buf == nil { +		return nil, nil +	} +	return randrGetScreenInfoReply(buf), nil +} + +// Read reply into structure from buffer for RandrGetScreenInfo +func randrGetScreenInfoReply(buf []byte) *RandrGetScreenInfoReply { +	v := new(RandrGetScreenInfoReply) +	b := 1 // skip reply determinant + +	v.Rotations = buf[b] +	b += 1 + +	v.Sequence = Get16(buf[b:]) +	b += 2 + +	v.Length = Get32(buf[b:]) // 4-byte units +	b += 4 + +	v.Root = Id(Get32(buf[b:])) +	b += 4 + +	v.Timestamp = Timestamp(Get32(buf[b:])) +	b += 4 + +	v.ConfigTimestamp = Timestamp(Get32(buf[b:])) +	b += 4 + +	v.NSizes = Get16(buf[b:]) +	b += 2 + +	v.SizeID = Get16(buf[b:]) +	b += 2 + +	v.Rotation = Get16(buf[b:]) +	b += 2 + +	v.Rate = Get16(buf[b:]) +	b += 2 + +	v.NInfo = Get16(buf[b:]) +	b += 2 + +	b += 2 // padding + +	v.Sizes = make([]RandrScreenSize, v.NSizes) +	b += ReadRandrScreenSizeList(buf[b:], v.Sizes) + +	v.Rates = make([]RandrRefreshRates, (int(v.NInfo) - int(v.NSizes))) +	b += ReadRandrRefreshRatesList(buf[b:], v.Rates) + +	return v +} + +func (cook RandrGetScreenInfoCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RandrGetScreenInfo +func (c *Conn) randrGetScreenInfoRequest(Window Id) []byte { +	size := 8 +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RANDR"] +	b += 1 + +	buf[b] = 5 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Window)) +	b += 4 + +	return buf +} + +// Request RandrGetScreenSizeRange +// size: 8 +type RandrGetScreenSizeRangeCookie struct { +	*cookie +} + +func (c *Conn) RandrGetScreenSizeRange(Window Id) RandrGetScreenSizeRangeCookie { +	cookie := c.newCookie(true, true) +	c.newRequest(c.randrGetScreenSizeRangeRequest(Window), cookie) +	return RandrGetScreenSizeRangeCookie{cookie} +} + +func (c *Conn) RandrGetScreenSizeRangeUnchecked(Window Id) RandrGetScreenSizeRangeCookie { +	cookie := c.newCookie(false, true) +	c.newRequest(c.randrGetScreenSizeRangeRequest(Window), cookie) +	return RandrGetScreenSizeRangeCookie{cookie} +} + +// Request reply for RandrGetScreenSizeRange +// size: 32 +type RandrGetScreenSizeRangeReply struct { +	Sequence uint16 +	Length   uint32 +	// padding: 1 bytes +	MinWidth  uint16 +	MinHeight uint16 +	MaxWidth  uint16 +	MaxHeight uint16 +	// padding: 16 bytes +} + +// Waits and reads reply data from request RandrGetScreenSizeRange +func (cook RandrGetScreenSizeRangeCookie) Reply() (*RandrGetScreenSizeRangeReply, error) { +	buf, err := cook.reply() +	if err != nil { +		return nil, err +	} +	if buf == nil { +		return nil, nil +	} +	return randrGetScreenSizeRangeReply(buf), nil +} + +// Read reply into structure from buffer for RandrGetScreenSizeRange +func randrGetScreenSizeRangeReply(buf []byte) *RandrGetScreenSizeRangeReply { +	v := new(RandrGetScreenSizeRangeReply) +	b := 1 // skip reply determinant + +	b += 1 // padding + +	v.Sequence = Get16(buf[b:]) +	b += 2 + +	v.Length = Get32(buf[b:]) // 4-byte units +	b += 4 + +	v.MinWidth = Get16(buf[b:]) +	b += 2 + +	v.MinHeight = Get16(buf[b:]) +	b += 2 + +	v.MaxWidth = Get16(buf[b:]) +	b += 2 + +	v.MaxHeight = Get16(buf[b:]) +	b += 2 + +	b += 16 // padding + +	return v +} + +func (cook RandrGetScreenSizeRangeCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RandrGetScreenSizeRange +func (c *Conn) randrGetScreenSizeRangeRequest(Window Id) []byte { +	size := 8 +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RANDR"] +	b += 1 + +	buf[b] = 6 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Window)) +	b += 4 + +	return buf +} + +// Request RandrSetScreenSize +// size: 20 +type RandrSetScreenSizeCookie struct { +	*cookie +} + +// Write request to wire for RandrSetScreenSize +func (c *Conn) RandrSetScreenSize(Window Id, Width uint16, Height uint16, MmWidth uint32, MmHeight uint32) RandrSetScreenSizeCookie { +	cookie := c.newCookie(false, false) +	c.newRequest(c.randrSetScreenSizeRequest(Window, Width, Height, MmWidth, MmHeight), cookie) +	return RandrSetScreenSizeCookie{cookie} +} + +func (c *Conn) RandrSetScreenSizeChecked(Window Id, Width uint16, Height uint16, MmWidth uint32, MmHeight uint32) RandrSetScreenSizeCookie { +	cookie := c.newCookie(true, false) +	c.newRequest(c.randrSetScreenSizeRequest(Window, Width, Height, MmWidth, MmHeight), cookie) +	return RandrSetScreenSizeCookie{cookie} +} + +func (cook RandrSetScreenSizeCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RandrSetScreenSize +func (c *Conn) randrSetScreenSizeRequest(Window Id, Width uint16, Height uint16, MmWidth uint32, MmHeight uint32) []byte { +	size := 20 +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RANDR"] +	b += 1 + +	buf[b] = 7 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Window)) +	b += 4 + +	Put16(buf[b:], Width) +	b += 2 + +	Put16(buf[b:], Height) +	b += 2 + +	Put32(buf[b:], MmWidth) +	b += 4 + +	Put32(buf[b:], MmHeight) +	b += 4 + +	return buf +} + +// Request RandrGetScreenResources +// size: 8 +type RandrGetScreenResourcesCookie struct { +	*cookie +} + +func (c *Conn) RandrGetScreenResources(Window Id) RandrGetScreenResourcesCookie { +	cookie := c.newCookie(true, true) +	c.newRequest(c.randrGetScreenResourcesRequest(Window), cookie) +	return RandrGetScreenResourcesCookie{cookie} +} + +func (c *Conn) RandrGetScreenResourcesUnchecked(Window Id) RandrGetScreenResourcesCookie { +	cookie := c.newCookie(false, true) +	c.newRequest(c.randrGetScreenResourcesRequest(Window), cookie) +	return RandrGetScreenResourcesCookie{cookie} +} + +// Request reply for RandrGetScreenResources +// size: ((((32 + pad((int(NumCrtcs) * 4))) + pad((int(NumOutputs) * 4))) + pad((int(NumModes) * 32))) + pad((int(NamesLen) * 1))) +type RandrGetScreenResourcesReply struct { +	Sequence uint16 +	Length   uint32 +	// padding: 1 bytes +	Timestamp       Timestamp +	ConfigTimestamp Timestamp +	NumCrtcs        uint16 +	NumOutputs      uint16 +	NumModes        uint16 +	NamesLen        uint16 +	// padding: 8 bytes +	Crtcs   []Id            // size: pad((int(NumCrtcs) * 4)) +	Outputs []Id            // size: pad((int(NumOutputs) * 4)) +	Modes   []RandrModeInfo // size: pad((int(NumModes) * 32)) +	Names   []byte          // size: pad((int(NamesLen) * 1)) +} + +// Waits and reads reply data from request RandrGetScreenResources +func (cook RandrGetScreenResourcesCookie) Reply() (*RandrGetScreenResourcesReply, error) { +	buf, err := cook.reply() +	if err != nil { +		return nil, err +	} +	if buf == nil { +		return nil, nil +	} +	return randrGetScreenResourcesReply(buf), nil +} + +// Read reply into structure from buffer for RandrGetScreenResources +func randrGetScreenResourcesReply(buf []byte) *RandrGetScreenResourcesReply { +	v := new(RandrGetScreenResourcesReply) +	b := 1 // skip reply determinant + +	b += 1 // padding + +	v.Sequence = Get16(buf[b:]) +	b += 2 + +	v.Length = Get32(buf[b:]) // 4-byte units +	b += 4 + +	v.Timestamp = Timestamp(Get32(buf[b:])) +	b += 4 + +	v.ConfigTimestamp = Timestamp(Get32(buf[b:])) +	b += 4 + +	v.NumCrtcs = Get16(buf[b:]) +	b += 2 + +	v.NumOutputs = Get16(buf[b:]) +	b += 2 + +	v.NumModes = Get16(buf[b:]) +	b += 2 + +	v.NamesLen = Get16(buf[b:]) +	b += 2 + +	b += 8 // padding + +	v.Crtcs = make([]Id, v.NumCrtcs) +	for i := 0; i < int(v.NumCrtcs); i++ { +		v.Crtcs[i] = Id(Get32(buf[b:])) +		b += 4 +	} +	b = pad(b) + +	v.Outputs = make([]Id, v.NumOutputs) +	for i := 0; i < int(v.NumOutputs); i++ { +		v.Outputs[i] = Id(Get32(buf[b:])) +		b += 4 +	} +	b = pad(b) + +	v.Modes = make([]RandrModeInfo, v.NumModes) +	b += ReadRandrModeInfoList(buf[b:], v.Modes) + +	v.Names = make([]byte, v.NamesLen) +	copy(v.Names[:v.NamesLen], buf[b:]) +	b += pad(int(v.NamesLen)) + +	return v +} + +func (cook RandrGetScreenResourcesCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RandrGetScreenResources +func (c *Conn) randrGetScreenResourcesRequest(Window Id) []byte { +	size := 8 +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RANDR"] +	b += 1 + +	buf[b] = 8 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Window)) +	b += 4 + +	return buf +} + +// Request RandrGetOutputInfo +// size: 12 +type RandrGetOutputInfoCookie struct { +	*cookie +} + +func (c *Conn) RandrGetOutputInfo(Output Id, ConfigTimestamp Timestamp) RandrGetOutputInfoCookie { +	cookie := c.newCookie(true, true) +	c.newRequest(c.randrGetOutputInfoRequest(Output, ConfigTimestamp), cookie) +	return RandrGetOutputInfoCookie{cookie} +} + +func (c *Conn) RandrGetOutputInfoUnchecked(Output Id, ConfigTimestamp Timestamp) RandrGetOutputInfoCookie { +	cookie := c.newCookie(false, true) +	c.newRequest(c.randrGetOutputInfoRequest(Output, ConfigTimestamp), cookie) +	return RandrGetOutputInfoCookie{cookie} +} + +// Request reply for RandrGetOutputInfo +// size: ((((36 + pad((int(NumCrtcs) * 4))) + pad((int(NumModes) * 4))) + pad((int(NumClones) * 4))) + pad((int(NameLen) * 1))) +type RandrGetOutputInfoReply struct { +	Sequence      uint16 +	Length        uint32 +	Status        byte +	Timestamp     Timestamp +	Crtc          Id +	MmWidth       uint32 +	MmHeight      uint32 +	Connection    byte +	SubpixelOrder byte +	NumCrtcs      uint16 +	NumModes      uint16 +	NumPreferred  uint16 +	NumClones     uint16 +	NameLen       uint16 +	Crtcs         []Id   // size: pad((int(NumCrtcs) * 4)) +	Modes         []Id   // size: pad((int(NumModes) * 4)) +	Clones        []Id   // size: pad((int(NumClones) * 4)) +	Name          []byte // size: pad((int(NameLen) * 1)) +} + +// Waits and reads reply data from request RandrGetOutputInfo +func (cook RandrGetOutputInfoCookie) Reply() (*RandrGetOutputInfoReply, error) { +	buf, err := cook.reply() +	if err != nil { +		return nil, err +	} +	if buf == nil { +		return nil, nil +	} +	return randrGetOutputInfoReply(buf), nil +} + +// Read reply into structure from buffer for RandrGetOutputInfo +func randrGetOutputInfoReply(buf []byte) *RandrGetOutputInfoReply { +	v := new(RandrGetOutputInfoReply) +	b := 1 // skip reply determinant + +	v.Status = buf[b] +	b += 1 + +	v.Sequence = Get16(buf[b:]) +	b += 2 + +	v.Length = Get32(buf[b:]) // 4-byte units +	b += 4 + +	v.Timestamp = Timestamp(Get32(buf[b:])) +	b += 4 + +	v.Crtc = Id(Get32(buf[b:])) +	b += 4 + +	v.MmWidth = Get32(buf[b:]) +	b += 4 + +	v.MmHeight = Get32(buf[b:]) +	b += 4 + +	v.Connection = buf[b] +	b += 1 + +	v.SubpixelOrder = buf[b] +	b += 1 + +	v.NumCrtcs = Get16(buf[b:]) +	b += 2 + +	v.NumModes = Get16(buf[b:]) +	b += 2 + +	v.NumPreferred = Get16(buf[b:]) +	b += 2 + +	v.NumClones = Get16(buf[b:]) +	b += 2 + +	v.NameLen = Get16(buf[b:]) +	b += 2 + +	v.Crtcs = make([]Id, v.NumCrtcs) +	for i := 0; i < int(v.NumCrtcs); i++ { +		v.Crtcs[i] = Id(Get32(buf[b:])) +		b += 4 +	} +	b = pad(b) + +	v.Modes = make([]Id, v.NumModes) +	for i := 0; i < int(v.NumModes); i++ { +		v.Modes[i] = Id(Get32(buf[b:])) +		b += 4 +	} +	b = pad(b) + +	v.Clones = make([]Id, v.NumClones) +	for i := 0; i < int(v.NumClones); i++ { +		v.Clones[i] = Id(Get32(buf[b:])) +		b += 4 +	} +	b = pad(b) + +	v.Name = make([]byte, v.NameLen) +	copy(v.Name[:v.NameLen], buf[b:]) +	b += pad(int(v.NameLen)) + +	return v +} + +func (cook RandrGetOutputInfoCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RandrGetOutputInfo +func (c *Conn) randrGetOutputInfoRequest(Output Id, ConfigTimestamp Timestamp) []byte { +	size := 12 +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RANDR"] +	b += 1 + +	buf[b] = 9 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Output)) +	b += 4 + +	Put32(buf[b:], uint32(ConfigTimestamp)) +	b += 4 + +	return buf +} + +// Request RandrListOutputProperties +// size: 8 +type RandrListOutputPropertiesCookie struct { +	*cookie +} + +func (c *Conn) RandrListOutputProperties(Output Id) RandrListOutputPropertiesCookie { +	cookie := c.newCookie(true, true) +	c.newRequest(c.randrListOutputPropertiesRequest(Output), cookie) +	return RandrListOutputPropertiesCookie{cookie} +} + +func (c *Conn) RandrListOutputPropertiesUnchecked(Output Id) RandrListOutputPropertiesCookie { +	cookie := c.newCookie(false, true) +	c.newRequest(c.randrListOutputPropertiesRequest(Output), cookie) +	return RandrListOutputPropertiesCookie{cookie} +} + +// Request reply for RandrListOutputProperties +// size: (32 + pad((int(NumAtoms) * 4))) +type RandrListOutputPropertiesReply struct { +	Sequence uint16 +	Length   uint32 +	// padding: 1 bytes +	NumAtoms uint16 +	// padding: 22 bytes +	Atoms []Id // size: pad((int(NumAtoms) * 4)) +} + +// Waits and reads reply data from request RandrListOutputProperties +func (cook RandrListOutputPropertiesCookie) Reply() (*RandrListOutputPropertiesReply, error) { +	buf, err := cook.reply() +	if err != nil { +		return nil, err +	} +	if buf == nil { +		return nil, nil +	} +	return randrListOutputPropertiesReply(buf), nil +} + +// Read reply into structure from buffer for RandrListOutputProperties +func randrListOutputPropertiesReply(buf []byte) *RandrListOutputPropertiesReply { +	v := new(RandrListOutputPropertiesReply) +	b := 1 // skip reply determinant + +	b += 1 // padding + +	v.Sequence = Get16(buf[b:]) +	b += 2 + +	v.Length = Get32(buf[b:]) // 4-byte units +	b += 4 + +	v.NumAtoms = Get16(buf[b:]) +	b += 2 + +	b += 22 // padding + +	v.Atoms = make([]Id, v.NumAtoms) +	for i := 0; i < int(v.NumAtoms); i++ { +		v.Atoms[i] = Id(Get32(buf[b:])) +		b += 4 +	} +	b = pad(b) + +	return v +} + +func (cook RandrListOutputPropertiesCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RandrListOutputProperties +func (c *Conn) randrListOutputPropertiesRequest(Output Id) []byte { +	size := 8 +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RANDR"] +	b += 1 + +	buf[b] = 10 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Output)) +	b += 4 + +	return buf +} + +// Request RandrQueryOutputProperty +// size: 12 +type RandrQueryOutputPropertyCookie struct { +	*cookie +} + +func (c *Conn) RandrQueryOutputProperty(Output Id, Property Id) RandrQueryOutputPropertyCookie { +	cookie := c.newCookie(true, true) +	c.newRequest(c.randrQueryOutputPropertyRequest(Output, Property), cookie) +	return RandrQueryOutputPropertyCookie{cookie} +} + +func (c *Conn) RandrQueryOutputPropertyUnchecked(Output Id, Property Id) RandrQueryOutputPropertyCookie { +	cookie := c.newCookie(false, true) +	c.newRequest(c.randrQueryOutputPropertyRequest(Output, Property), cookie) +	return RandrQueryOutputPropertyCookie{cookie} +} + +// Request reply for RandrQueryOutputProperty +// size: (32 + pad((int(Length) * 4))) +type RandrQueryOutputPropertyReply struct { +	Sequence uint16 +	Length   uint32 +	// padding: 1 bytes +	Pending   bool +	Range     bool +	Immutable bool +	// padding: 21 bytes +	ValidValues []int32 // size: pad((int(Length) * 4)) +} + +// Waits and reads reply data from request RandrQueryOutputProperty +func (cook RandrQueryOutputPropertyCookie) Reply() (*RandrQueryOutputPropertyReply, error) { +	buf, err := cook.reply() +	if err != nil { +		return nil, err +	} +	if buf == nil { +		return nil, nil +	} +	return randrQueryOutputPropertyReply(buf), nil +} + +// Read reply into structure from buffer for RandrQueryOutputProperty +func randrQueryOutputPropertyReply(buf []byte) *RandrQueryOutputPropertyReply { +	v := new(RandrQueryOutputPropertyReply) +	b := 1 // skip reply determinant + +	b += 1 // padding + +	v.Sequence = Get16(buf[b:]) +	b += 2 + +	v.Length = Get32(buf[b:]) // 4-byte units +	b += 4 + +	if buf[b] == 1 { +		v.Pending = true +	} else { +		v.Pending = false +	} +	b += 1 + +	if buf[b] == 1 { +		v.Range = true +	} else { +		v.Range = false +	} +	b += 1 + +	if buf[b] == 1 { +		v.Immutable = true +	} else { +		v.Immutable = false +	} +	b += 1 + +	b += 21 // padding + +	v.ValidValues = make([]int32, v.Length) +	for i := 0; i < int(v.Length); i++ { +		v.ValidValues[i] = int32(Get32(buf[b:])) +		b += 4 +	} +	b = pad(b) + +	return v +} + +func (cook RandrQueryOutputPropertyCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RandrQueryOutputProperty +func (c *Conn) randrQueryOutputPropertyRequest(Output Id, Property Id) []byte { +	size := 12 +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RANDR"] +	b += 1 + +	buf[b] = 11 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Output)) +	b += 4 + +	Put32(buf[b:], uint32(Property)) +	b += 4 + +	return buf +} + +// Request RandrConfigureOutputProperty +// size: pad((16 + pad((len(Values) * 4)))) +type RandrConfigureOutputPropertyCookie struct { +	*cookie +} + +// Write request to wire for RandrConfigureOutputProperty +func (c *Conn) RandrConfigureOutputProperty(Output Id, Property Id, Pending bool, Range bool, Values []int32) RandrConfigureOutputPropertyCookie { +	cookie := c.newCookie(false, false) +	c.newRequest(c.randrConfigureOutputPropertyRequest(Output, Property, Pending, Range, Values), cookie) +	return RandrConfigureOutputPropertyCookie{cookie} +} + +func (c *Conn) RandrConfigureOutputPropertyChecked(Output Id, Property Id, Pending bool, Range bool, Values []int32) RandrConfigureOutputPropertyCookie { +	cookie := c.newCookie(true, false) +	c.newRequest(c.randrConfigureOutputPropertyRequest(Output, Property, Pending, Range, Values), cookie) +	return RandrConfigureOutputPropertyCookie{cookie} +} + +func (cook RandrConfigureOutputPropertyCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RandrConfigureOutputProperty +func (c *Conn) randrConfigureOutputPropertyRequest(Output Id, Property Id, Pending bool, Range bool, Values []int32) []byte { +	size := pad((16 + pad((len(Values) * 4)))) +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RANDR"] +	b += 1 + +	buf[b] = 12 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Output)) +	b += 4 + +	Put32(buf[b:], uint32(Property)) +	b += 4 + +	if Pending { +		buf[b] = 1 +	} else { +		buf[b] = 0 +	} +	b += 1 + +	if Range { +		buf[b] = 1 +	} else { +		buf[b] = 0 +	} +	b += 1 + +	b += 2 // padding + +	for i := 0; i < int(len(Values)); i++ { +		Put32(buf[b:], uint32(Values[i])) +		b += 4 +	} +	b = pad(b) + +	return buf +} + +// Request RandrChangeOutputProperty +// size: pad((24 + pad((((int(NumUnits) * int(Format)) / 8) * 1)))) +type RandrChangeOutputPropertyCookie struct { +	*cookie +} + +// Write request to wire for RandrChangeOutputProperty +func (c *Conn) RandrChangeOutputProperty(Output Id, Property Id, Type Id, Format byte, Mode byte, NumUnits uint32, Data []byte) RandrChangeOutputPropertyCookie { +	cookie := c.newCookie(false, false) +	c.newRequest(c.randrChangeOutputPropertyRequest(Output, Property, Type, Format, Mode, NumUnits, Data), cookie) +	return RandrChangeOutputPropertyCookie{cookie} +} + +func (c *Conn) RandrChangeOutputPropertyChecked(Output Id, Property Id, Type Id, Format byte, Mode byte, NumUnits uint32, Data []byte) RandrChangeOutputPropertyCookie { +	cookie := c.newCookie(true, false) +	c.newRequest(c.randrChangeOutputPropertyRequest(Output, Property, Type, Format, Mode, NumUnits, Data), cookie) +	return RandrChangeOutputPropertyCookie{cookie} +} + +func (cook RandrChangeOutputPropertyCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RandrChangeOutputProperty +func (c *Conn) randrChangeOutputPropertyRequest(Output Id, Property Id, Type Id, Format byte, Mode byte, NumUnits uint32, Data []byte) []byte { +	size := pad((24 + pad((((int(NumUnits) * int(Format)) / 8) * 1)))) +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RANDR"] +	b += 1 + +	buf[b] = 13 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Output)) +	b += 4 + +	Put32(buf[b:], uint32(Property)) +	b += 4 + +	Put32(buf[b:], uint32(Type)) +	b += 4 + +	buf[b] = Format +	b += 1 + +	buf[b] = Mode +	b += 1 + +	b += 2 // padding + +	Put32(buf[b:], NumUnits) +	b += 4 + +	copy(buf[b:], Data[:((int(NumUnits)*int(Format))/8)]) +	b += pad(int(((int(NumUnits) * int(Format)) / 8))) + +	return buf +} + +// Request RandrDeleteOutputProperty +// size: 12 +type RandrDeleteOutputPropertyCookie struct { +	*cookie +} + +// Write request to wire for RandrDeleteOutputProperty +func (c *Conn) RandrDeleteOutputProperty(Output Id, Property Id) RandrDeleteOutputPropertyCookie { +	cookie := c.newCookie(false, false) +	c.newRequest(c.randrDeleteOutputPropertyRequest(Output, Property), cookie) +	return RandrDeleteOutputPropertyCookie{cookie} +} + +func (c *Conn) RandrDeleteOutputPropertyChecked(Output Id, Property Id) RandrDeleteOutputPropertyCookie { +	cookie := c.newCookie(true, false) +	c.newRequest(c.randrDeleteOutputPropertyRequest(Output, Property), cookie) +	return RandrDeleteOutputPropertyCookie{cookie} +} + +func (cook RandrDeleteOutputPropertyCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RandrDeleteOutputProperty +func (c *Conn) randrDeleteOutputPropertyRequest(Output Id, Property Id) []byte { +	size := 12 +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RANDR"] +	b += 1 + +	buf[b] = 14 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Output)) +	b += 4 + +	Put32(buf[b:], uint32(Property)) +	b += 4 + +	return buf +} + +// Request RandrGetOutputProperty +// size: 28 +type RandrGetOutputPropertyCookie struct { +	*cookie +} + +func (c *Conn) RandrGetOutputProperty(Output Id, Property Id, Type Id, LongOffset uint32, LongLength uint32, Delete bool, Pending bool) RandrGetOutputPropertyCookie { +	cookie := c.newCookie(true, true) +	c.newRequest(c.randrGetOutputPropertyRequest(Output, Property, Type, LongOffset, LongLength, Delete, Pending), cookie) +	return RandrGetOutputPropertyCookie{cookie} +} + +func (c *Conn) RandrGetOutputPropertyUnchecked(Output Id, Property Id, Type Id, LongOffset uint32, LongLength uint32, Delete bool, Pending bool) RandrGetOutputPropertyCookie { +	cookie := c.newCookie(false, true) +	c.newRequest(c.randrGetOutputPropertyRequest(Output, Property, Type, LongOffset, LongLength, Delete, Pending), cookie) +	return RandrGetOutputPropertyCookie{cookie} +} + +// Request reply for RandrGetOutputProperty +// size: (32 + pad(((int(NumItems) * (int(Format) / 8)) * 1))) +type RandrGetOutputPropertyReply struct { +	Sequence   uint16 +	Length     uint32 +	Format     byte +	Type       Id +	BytesAfter uint32 +	NumItems   uint32 +	// padding: 12 bytes +	Data []byte // size: pad(((int(NumItems) * (int(Format) / 8)) * 1)) +} + +// Waits and reads reply data from request RandrGetOutputProperty +func (cook RandrGetOutputPropertyCookie) Reply() (*RandrGetOutputPropertyReply, error) { +	buf, err := cook.reply() +	if err != nil { +		return nil, err +	} +	if buf == nil { +		return nil, nil +	} +	return randrGetOutputPropertyReply(buf), nil +} + +// Read reply into structure from buffer for RandrGetOutputProperty +func randrGetOutputPropertyReply(buf []byte) *RandrGetOutputPropertyReply { +	v := new(RandrGetOutputPropertyReply) +	b := 1 // skip reply determinant + +	v.Format = buf[b] +	b += 1 + +	v.Sequence = Get16(buf[b:]) +	b += 2 + +	v.Length = Get32(buf[b:]) // 4-byte units +	b += 4 + +	v.Type = Id(Get32(buf[b:])) +	b += 4 + +	v.BytesAfter = Get32(buf[b:]) +	b += 4 + +	v.NumItems = Get32(buf[b:]) +	b += 4 + +	b += 12 // padding + +	v.Data = make([]byte, (int(v.NumItems) * (int(v.Format) / 8))) +	copy(v.Data[:(int(v.NumItems)*(int(v.Format)/8))], buf[b:]) +	b += pad(int((int(v.NumItems) * (int(v.Format) / 8)))) + +	return v +} + +func (cook RandrGetOutputPropertyCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RandrGetOutputProperty +func (c *Conn) randrGetOutputPropertyRequest(Output Id, Property Id, Type Id, LongOffset uint32, LongLength uint32, Delete bool, Pending bool) []byte { +	size := 28 +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RANDR"] +	b += 1 + +	buf[b] = 15 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Output)) +	b += 4 + +	Put32(buf[b:], uint32(Property)) +	b += 4 + +	Put32(buf[b:], uint32(Type)) +	b += 4 + +	Put32(buf[b:], LongOffset) +	b += 4 + +	Put32(buf[b:], LongLength) +	b += 4 + +	if Delete { +		buf[b] = 1 +	} else { +		buf[b] = 0 +	} +	b += 1 + +	if Pending { +		buf[b] = 1 +	} else { +		buf[b] = 0 +	} +	b += 1 + +	b += 2 // padding + +	return buf +} + +// Request RandrCreateMode +// size: pad((40 + pad((len(Name) * 1)))) +type RandrCreateModeCookie struct { +	*cookie +} + +func (c *Conn) RandrCreateMode(Window Id, ModeInfo RandrModeInfo, Name string) RandrCreateModeCookie { +	cookie := c.newCookie(true, true) +	c.newRequest(c.randrCreateModeRequest(Window, ModeInfo, Name), cookie) +	return RandrCreateModeCookie{cookie} +} + +func (c *Conn) RandrCreateModeUnchecked(Window Id, ModeInfo RandrModeInfo, Name string) RandrCreateModeCookie { +	cookie := c.newCookie(false, true) +	c.newRequest(c.randrCreateModeRequest(Window, ModeInfo, Name), cookie) +	return RandrCreateModeCookie{cookie} +} + +// Request reply for RandrCreateMode +// size: 32 +type RandrCreateModeReply struct { +	Sequence uint16 +	Length   uint32 +	// padding: 1 bytes +	Mode Id +	// padding: 20 bytes +} + +// Waits and reads reply data from request RandrCreateMode +func (cook RandrCreateModeCookie) Reply() (*RandrCreateModeReply, error) { +	buf, err := cook.reply() +	if err != nil { +		return nil, err +	} +	if buf == nil { +		return nil, nil +	} +	return randrCreateModeReply(buf), nil +} + +// Read reply into structure from buffer for RandrCreateMode +func randrCreateModeReply(buf []byte) *RandrCreateModeReply { +	v := new(RandrCreateModeReply) +	b := 1 // skip reply determinant + +	b += 1 // padding + +	v.Sequence = Get16(buf[b:]) +	b += 2 + +	v.Length = Get32(buf[b:]) // 4-byte units +	b += 4 + +	v.Mode = Id(Get32(buf[b:])) +	b += 4 + +	b += 20 // padding + +	return v +} + +func (cook RandrCreateModeCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RandrCreateMode +func (c *Conn) randrCreateModeRequest(Window Id, ModeInfo RandrModeInfo, Name string) []byte { +	size := pad((40 + pad((len(Name) * 1)))) +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RANDR"] +	b += 1 + +	buf[b] = 16 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Window)) +	b += 4 + +	{ +		structBytes := ModeInfo.Bytes() +		copy(buf[b:], structBytes) +		b += pad(len(structBytes)) +	} + +	copy(buf[b:], Name[:len(Name)]) +	b += pad(int(len(Name))) + +	return buf +} + +// Request RandrDestroyMode +// size: 8 +type RandrDestroyModeCookie struct { +	*cookie +} + +// Write request to wire for RandrDestroyMode +func (c *Conn) RandrDestroyMode(Mode Id) RandrDestroyModeCookie { +	cookie := c.newCookie(false, false) +	c.newRequest(c.randrDestroyModeRequest(Mode), cookie) +	return RandrDestroyModeCookie{cookie} +} + +func (c *Conn) RandrDestroyModeChecked(Mode Id) RandrDestroyModeCookie { +	cookie := c.newCookie(true, false) +	c.newRequest(c.randrDestroyModeRequest(Mode), cookie) +	return RandrDestroyModeCookie{cookie} +} + +func (cook RandrDestroyModeCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RandrDestroyMode +func (c *Conn) randrDestroyModeRequest(Mode Id) []byte { +	size := 8 +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RANDR"] +	b += 1 + +	buf[b] = 17 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Mode)) +	b += 4 + +	return buf +} + +// Request RandrAddOutputMode +// size: 12 +type RandrAddOutputModeCookie struct { +	*cookie +} + +// Write request to wire for RandrAddOutputMode +func (c *Conn) RandrAddOutputMode(Output Id, Mode Id) RandrAddOutputModeCookie { +	cookie := c.newCookie(false, false) +	c.newRequest(c.randrAddOutputModeRequest(Output, Mode), cookie) +	return RandrAddOutputModeCookie{cookie} +} + +func (c *Conn) RandrAddOutputModeChecked(Output Id, Mode Id) RandrAddOutputModeCookie { +	cookie := c.newCookie(true, false) +	c.newRequest(c.randrAddOutputModeRequest(Output, Mode), cookie) +	return RandrAddOutputModeCookie{cookie} +} + +func (cook RandrAddOutputModeCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RandrAddOutputMode +func (c *Conn) randrAddOutputModeRequest(Output Id, Mode Id) []byte { +	size := 12 +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RANDR"] +	b += 1 + +	buf[b] = 18 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Output)) +	b += 4 + +	Put32(buf[b:], uint32(Mode)) +	b += 4 + +	return buf +} + +// Request RandrDeleteOutputMode +// size: 12 +type RandrDeleteOutputModeCookie struct { +	*cookie +} + +// Write request to wire for RandrDeleteOutputMode +func (c *Conn) RandrDeleteOutputMode(Output Id, Mode Id) RandrDeleteOutputModeCookie { +	cookie := c.newCookie(false, false) +	c.newRequest(c.randrDeleteOutputModeRequest(Output, Mode), cookie) +	return RandrDeleteOutputModeCookie{cookie} +} + +func (c *Conn) RandrDeleteOutputModeChecked(Output Id, Mode Id) RandrDeleteOutputModeCookie { +	cookie := c.newCookie(true, false) +	c.newRequest(c.randrDeleteOutputModeRequest(Output, Mode), cookie) +	return RandrDeleteOutputModeCookie{cookie} +} + +func (cook RandrDeleteOutputModeCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RandrDeleteOutputMode +func (c *Conn) randrDeleteOutputModeRequest(Output Id, Mode Id) []byte { +	size := 12 +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RANDR"] +	b += 1 + +	buf[b] = 19 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Output)) +	b += 4 + +	Put32(buf[b:], uint32(Mode)) +	b += 4 + +	return buf +} + +// Request RandrGetCrtcInfo +// size: 12 +type RandrGetCrtcInfoCookie struct { +	*cookie +} + +func (c *Conn) RandrGetCrtcInfo(Crtc Id, ConfigTimestamp Timestamp) RandrGetCrtcInfoCookie { +	cookie := c.newCookie(true, true) +	c.newRequest(c.randrGetCrtcInfoRequest(Crtc, ConfigTimestamp), cookie) +	return RandrGetCrtcInfoCookie{cookie} +} + +func (c *Conn) RandrGetCrtcInfoUnchecked(Crtc Id, ConfigTimestamp Timestamp) RandrGetCrtcInfoCookie { +	cookie := c.newCookie(false, true) +	c.newRequest(c.randrGetCrtcInfoRequest(Crtc, ConfigTimestamp), cookie) +	return RandrGetCrtcInfoCookie{cookie} +} + +// Request reply for RandrGetCrtcInfo +// size: ((32 + pad((int(NumOutputs) * 4))) + pad((int(NumPossibleOutputs) * 4))) +type RandrGetCrtcInfoReply struct { +	Sequence           uint16 +	Length             uint32 +	Status             byte +	Timestamp          Timestamp +	X                  int16 +	Y                  int16 +	Width              uint16 +	Height             uint16 +	Mode               Id +	Rotation           uint16 +	Rotations          uint16 +	NumOutputs         uint16 +	NumPossibleOutputs uint16 +	Outputs            []Id // size: pad((int(NumOutputs) * 4)) +	Possible           []Id // size: pad((int(NumPossibleOutputs) * 4)) +} + +// Waits and reads reply data from request RandrGetCrtcInfo +func (cook RandrGetCrtcInfoCookie) Reply() (*RandrGetCrtcInfoReply, error) { +	buf, err := cook.reply() +	if err != nil { +		return nil, err +	} +	if buf == nil { +		return nil, nil +	} +	return randrGetCrtcInfoReply(buf), nil +} + +// Read reply into structure from buffer for RandrGetCrtcInfo +func randrGetCrtcInfoReply(buf []byte) *RandrGetCrtcInfoReply { +	v := new(RandrGetCrtcInfoReply) +	b := 1 // skip reply determinant + +	v.Status = buf[b] +	b += 1 + +	v.Sequence = Get16(buf[b:]) +	b += 2 + +	v.Length = Get32(buf[b:]) // 4-byte units +	b += 4 + +	v.Timestamp = Timestamp(Get32(buf[b:])) +	b += 4 + +	v.X = int16(Get16(buf[b:])) +	b += 2 + +	v.Y = int16(Get16(buf[b:])) +	b += 2 + +	v.Width = Get16(buf[b:]) +	b += 2 + +	v.Height = Get16(buf[b:]) +	b += 2 + +	v.Mode = Id(Get32(buf[b:])) +	b += 4 + +	v.Rotation = Get16(buf[b:]) +	b += 2 + +	v.Rotations = Get16(buf[b:]) +	b += 2 + +	v.NumOutputs = Get16(buf[b:]) +	b += 2 + +	v.NumPossibleOutputs = Get16(buf[b:]) +	b += 2 + +	v.Outputs = make([]Id, v.NumOutputs) +	for i := 0; i < int(v.NumOutputs); i++ { +		v.Outputs[i] = Id(Get32(buf[b:])) +		b += 4 +	} +	b = pad(b) + +	v.Possible = make([]Id, v.NumPossibleOutputs) +	for i := 0; i < int(v.NumPossibleOutputs); i++ { +		v.Possible[i] = Id(Get32(buf[b:])) +		b += 4 +	} +	b = pad(b) + +	return v +} + +func (cook RandrGetCrtcInfoCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RandrGetCrtcInfo +func (c *Conn) randrGetCrtcInfoRequest(Crtc Id, ConfigTimestamp Timestamp) []byte { +	size := 12 +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RANDR"] +	b += 1 + +	buf[b] = 20 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Crtc)) +	b += 4 + +	Put32(buf[b:], uint32(ConfigTimestamp)) +	b += 4 + +	return buf +} + +// Request RandrSetCrtcConfig +// size: pad((28 + pad((len(Outputs) * 4)))) +type RandrSetCrtcConfigCookie struct { +	*cookie +} + +func (c *Conn) RandrSetCrtcConfig(Crtc Id, Timestamp Timestamp, ConfigTimestamp Timestamp, X int16, Y int16, Mode Id, Rotation uint16, Outputs []Id) RandrSetCrtcConfigCookie { +	cookie := c.newCookie(true, true) +	c.newRequest(c.randrSetCrtcConfigRequest(Crtc, Timestamp, ConfigTimestamp, X, Y, Mode, Rotation, Outputs), cookie) +	return RandrSetCrtcConfigCookie{cookie} +} + +func (c *Conn) RandrSetCrtcConfigUnchecked(Crtc Id, Timestamp Timestamp, ConfigTimestamp Timestamp, X int16, Y int16, Mode Id, Rotation uint16, Outputs []Id) RandrSetCrtcConfigCookie { +	cookie := c.newCookie(false, true) +	c.newRequest(c.randrSetCrtcConfigRequest(Crtc, Timestamp, ConfigTimestamp, X, Y, Mode, Rotation, Outputs), cookie) +	return RandrSetCrtcConfigCookie{cookie} +} + +// Request reply for RandrSetCrtcConfig +// size: 32 +type RandrSetCrtcConfigReply struct { +	Sequence  uint16 +	Length    uint32 +	Status    byte +	Timestamp Timestamp +	// padding: 20 bytes +} + +// Waits and reads reply data from request RandrSetCrtcConfig +func (cook RandrSetCrtcConfigCookie) Reply() (*RandrSetCrtcConfigReply, error) { +	buf, err := cook.reply() +	if err != nil { +		return nil, err +	} +	if buf == nil { +		return nil, nil +	} +	return randrSetCrtcConfigReply(buf), nil +} + +// Read reply into structure from buffer for RandrSetCrtcConfig +func randrSetCrtcConfigReply(buf []byte) *RandrSetCrtcConfigReply { +	v := new(RandrSetCrtcConfigReply) +	b := 1 // skip reply determinant + +	v.Status = buf[b] +	b += 1 + +	v.Sequence = Get16(buf[b:]) +	b += 2 + +	v.Length = Get32(buf[b:]) // 4-byte units +	b += 4 + +	v.Timestamp = Timestamp(Get32(buf[b:])) +	b += 4 + +	b += 20 // padding + +	return v +} + +func (cook RandrSetCrtcConfigCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RandrSetCrtcConfig +func (c *Conn) randrSetCrtcConfigRequest(Crtc Id, Timestamp Timestamp, ConfigTimestamp Timestamp, X int16, Y int16, Mode Id, Rotation uint16, Outputs []Id) []byte { +	size := pad((28 + pad((len(Outputs) * 4)))) +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RANDR"] +	b += 1 + +	buf[b] = 21 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Crtc)) +	b += 4 + +	Put32(buf[b:], uint32(Timestamp)) +	b += 4 + +	Put32(buf[b:], uint32(ConfigTimestamp)) +	b += 4 + +	Put16(buf[b:], uint16(X)) +	b += 2 + +	Put16(buf[b:], uint16(Y)) +	b += 2 + +	Put32(buf[b:], uint32(Mode)) +	b += 4 + +	Put16(buf[b:], Rotation) +	b += 2 + +	b += 2 // padding + +	for i := 0; i < int(len(Outputs)); i++ { +		Put32(buf[b:], uint32(Outputs[i])) +		b += 4 +	} +	b = pad(b) + +	return buf +} + +// Request RandrGetCrtcGammaSize +// size: 8 +type RandrGetCrtcGammaSizeCookie struct { +	*cookie +} + +func (c *Conn) RandrGetCrtcGammaSize(Crtc Id) RandrGetCrtcGammaSizeCookie { +	cookie := c.newCookie(true, true) +	c.newRequest(c.randrGetCrtcGammaSizeRequest(Crtc), cookie) +	return RandrGetCrtcGammaSizeCookie{cookie} +} + +func (c *Conn) RandrGetCrtcGammaSizeUnchecked(Crtc Id) RandrGetCrtcGammaSizeCookie { +	cookie := c.newCookie(false, true) +	c.newRequest(c.randrGetCrtcGammaSizeRequest(Crtc), cookie) +	return RandrGetCrtcGammaSizeCookie{cookie} +} + +// Request reply for RandrGetCrtcGammaSize +// size: 32 +type RandrGetCrtcGammaSizeReply struct { +	Sequence uint16 +	Length   uint32 +	// padding: 1 bytes +	Size uint16 +	// padding: 22 bytes +} + +// Waits and reads reply data from request RandrGetCrtcGammaSize +func (cook RandrGetCrtcGammaSizeCookie) Reply() (*RandrGetCrtcGammaSizeReply, error) { +	buf, err := cook.reply() +	if err != nil { +		return nil, err +	} +	if buf == nil { +		return nil, nil +	} +	return randrGetCrtcGammaSizeReply(buf), nil +} + +// Read reply into structure from buffer for RandrGetCrtcGammaSize +func randrGetCrtcGammaSizeReply(buf []byte) *RandrGetCrtcGammaSizeReply { +	v := new(RandrGetCrtcGammaSizeReply) +	b := 1 // skip reply determinant + +	b += 1 // padding + +	v.Sequence = Get16(buf[b:]) +	b += 2 + +	v.Length = Get32(buf[b:]) // 4-byte units +	b += 4 + +	v.Size = Get16(buf[b:]) +	b += 2 + +	b += 22 // padding + +	return v +} + +func (cook RandrGetCrtcGammaSizeCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RandrGetCrtcGammaSize +func (c *Conn) randrGetCrtcGammaSizeRequest(Crtc Id) []byte { +	size := 8 +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RANDR"] +	b += 1 + +	buf[b] = 22 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Crtc)) +	b += 4 + +	return buf +} + +// Request RandrGetCrtcGamma +// size: 8 +type RandrGetCrtcGammaCookie struct { +	*cookie +} + +func (c *Conn) RandrGetCrtcGamma(Crtc Id) RandrGetCrtcGammaCookie { +	cookie := c.newCookie(true, true) +	c.newRequest(c.randrGetCrtcGammaRequest(Crtc), cookie) +	return RandrGetCrtcGammaCookie{cookie} +} + +func (c *Conn) RandrGetCrtcGammaUnchecked(Crtc Id) RandrGetCrtcGammaCookie { +	cookie := c.newCookie(false, true) +	c.newRequest(c.randrGetCrtcGammaRequest(Crtc), cookie) +	return RandrGetCrtcGammaCookie{cookie} +} + +// Request reply for RandrGetCrtcGamma +// size: (((32 + pad((int(Size) * 2))) + pad((int(Size) * 2))) + pad((int(Size) * 2))) +type RandrGetCrtcGammaReply struct { +	Sequence uint16 +	Length   uint32 +	// padding: 1 bytes +	Size uint16 +	// padding: 22 bytes +	Red   []uint16 // size: pad((int(Size) * 2)) +	Green []uint16 // size: pad((int(Size) * 2)) +	Blue  []uint16 // size: pad((int(Size) * 2)) +} + +// Waits and reads reply data from request RandrGetCrtcGamma +func (cook RandrGetCrtcGammaCookie) Reply() (*RandrGetCrtcGammaReply, error) { +	buf, err := cook.reply() +	if err != nil { +		return nil, err +	} +	if buf == nil { +		return nil, nil +	} +	return randrGetCrtcGammaReply(buf), nil +} + +// Read reply into structure from buffer for RandrGetCrtcGamma +func randrGetCrtcGammaReply(buf []byte) *RandrGetCrtcGammaReply { +	v := new(RandrGetCrtcGammaReply) +	b := 1 // skip reply determinant + +	b += 1 // padding + +	v.Sequence = Get16(buf[b:]) +	b += 2 + +	v.Length = Get32(buf[b:]) // 4-byte units +	b += 4 + +	v.Size = Get16(buf[b:]) +	b += 2 + +	b += 22 // padding + +	v.Red = make([]uint16, v.Size) +	for i := 0; i < int(v.Size); i++ { +		v.Red[i] = Get16(buf[b:]) +		b += 2 +	} +	b = pad(b) + +	v.Green = make([]uint16, v.Size) +	for i := 0; i < int(v.Size); i++ { +		v.Green[i] = Get16(buf[b:]) +		b += 2 +	} +	b = pad(b) + +	v.Blue = make([]uint16, v.Size) +	for i := 0; i < int(v.Size); i++ { +		v.Blue[i] = Get16(buf[b:]) +		b += 2 +	} +	b = pad(b) + +	return v +} + +func (cook RandrGetCrtcGammaCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RandrGetCrtcGamma +func (c *Conn) randrGetCrtcGammaRequest(Crtc Id) []byte { +	size := 8 +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RANDR"] +	b += 1 + +	buf[b] = 23 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Crtc)) +	b += 4 + +	return buf +} + +// Request RandrSetCrtcGamma +// size: pad((((12 + pad((int(Size) * 2))) + pad((int(Size) * 2))) + pad((int(Size) * 2)))) +type RandrSetCrtcGammaCookie struct { +	*cookie +} + +// Write request to wire for RandrSetCrtcGamma +func (c *Conn) RandrSetCrtcGamma(Crtc Id, Size uint16, Red []uint16, Green []uint16, Blue []uint16) RandrSetCrtcGammaCookie { +	cookie := c.newCookie(false, false) +	c.newRequest(c.randrSetCrtcGammaRequest(Crtc, Size, Red, Green, Blue), cookie) +	return RandrSetCrtcGammaCookie{cookie} +} + +func (c *Conn) RandrSetCrtcGammaChecked(Crtc Id, Size uint16, Red []uint16, Green []uint16, Blue []uint16) RandrSetCrtcGammaCookie { +	cookie := c.newCookie(true, false) +	c.newRequest(c.randrSetCrtcGammaRequest(Crtc, Size, Red, Green, Blue), cookie) +	return RandrSetCrtcGammaCookie{cookie} +} + +func (cook RandrSetCrtcGammaCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RandrSetCrtcGamma +func (c *Conn) randrSetCrtcGammaRequest(Crtc Id, Size uint16, Red []uint16, Green []uint16, Blue []uint16) []byte { +	size := pad((((12 + pad((int(Size) * 2))) + pad((int(Size) * 2))) + pad((int(Size) * 2)))) +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RANDR"] +	b += 1 + +	buf[b] = 24 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Crtc)) +	b += 4 + +	Put16(buf[b:], Size) +	b += 2 + +	b += 2 // padding + +	for i := 0; i < int(Size); i++ { +		Put16(buf[b:], Red[i]) +		b += 2 +	} +	b = pad(b) + +	for i := 0; i < int(Size); i++ { +		Put16(buf[b:], Green[i]) +		b += 2 +	} +	b = pad(b) + +	for i := 0; i < int(Size); i++ { +		Put16(buf[b:], Blue[i]) +		b += 2 +	} +	b = pad(b) + +	return buf +} + +// Request RandrGetScreenResourcesCurrent +// size: 8 +type RandrGetScreenResourcesCurrentCookie struct { +	*cookie +} + +func (c *Conn) RandrGetScreenResourcesCurrent(Window Id) RandrGetScreenResourcesCurrentCookie { +	cookie := c.newCookie(true, true) +	c.newRequest(c.randrGetScreenResourcesCurrentRequest(Window), cookie) +	return RandrGetScreenResourcesCurrentCookie{cookie} +} + +func (c *Conn) RandrGetScreenResourcesCurrentUnchecked(Window Id) RandrGetScreenResourcesCurrentCookie { +	cookie := c.newCookie(false, true) +	c.newRequest(c.randrGetScreenResourcesCurrentRequest(Window), cookie) +	return RandrGetScreenResourcesCurrentCookie{cookie} +} + +// Request reply for RandrGetScreenResourcesCurrent +// size: ((((32 + pad((int(NumCrtcs) * 4))) + pad((int(NumOutputs) * 4))) + pad((int(NumModes) * 32))) + pad((int(NamesLen) * 1))) +type RandrGetScreenResourcesCurrentReply struct { +	Sequence uint16 +	Length   uint32 +	// padding: 1 bytes +	Timestamp       Timestamp +	ConfigTimestamp Timestamp +	NumCrtcs        uint16 +	NumOutputs      uint16 +	NumModes        uint16 +	NamesLen        uint16 +	// padding: 8 bytes +	Crtcs   []Id            // size: pad((int(NumCrtcs) * 4)) +	Outputs []Id            // size: pad((int(NumOutputs) * 4)) +	Modes   []RandrModeInfo // size: pad((int(NumModes) * 32)) +	Names   []byte          // size: pad((int(NamesLen) * 1)) +} + +// Waits and reads reply data from request RandrGetScreenResourcesCurrent +func (cook RandrGetScreenResourcesCurrentCookie) Reply() (*RandrGetScreenResourcesCurrentReply, error) { +	buf, err := cook.reply() +	if err != nil { +		return nil, err +	} +	if buf == nil { +		return nil, nil +	} +	return randrGetScreenResourcesCurrentReply(buf), nil +} + +// Read reply into structure from buffer for RandrGetScreenResourcesCurrent +func randrGetScreenResourcesCurrentReply(buf []byte) *RandrGetScreenResourcesCurrentReply { +	v := new(RandrGetScreenResourcesCurrentReply) +	b := 1 // skip reply determinant + +	b += 1 // padding + +	v.Sequence = Get16(buf[b:]) +	b += 2 + +	v.Length = Get32(buf[b:]) // 4-byte units +	b += 4 + +	v.Timestamp = Timestamp(Get32(buf[b:])) +	b += 4 + +	v.ConfigTimestamp = Timestamp(Get32(buf[b:])) +	b += 4 + +	v.NumCrtcs = Get16(buf[b:]) +	b += 2 + +	v.NumOutputs = Get16(buf[b:]) +	b += 2 + +	v.NumModes = Get16(buf[b:]) +	b += 2 + +	v.NamesLen = Get16(buf[b:]) +	b += 2 + +	b += 8 // padding + +	v.Crtcs = make([]Id, v.NumCrtcs) +	for i := 0; i < int(v.NumCrtcs); i++ { +		v.Crtcs[i] = Id(Get32(buf[b:])) +		b += 4 +	} +	b = pad(b) + +	v.Outputs = make([]Id, v.NumOutputs) +	for i := 0; i < int(v.NumOutputs); i++ { +		v.Outputs[i] = Id(Get32(buf[b:])) +		b += 4 +	} +	b = pad(b) + +	v.Modes = make([]RandrModeInfo, v.NumModes) +	b += ReadRandrModeInfoList(buf[b:], v.Modes) + +	v.Names = make([]byte, v.NamesLen) +	copy(v.Names[:v.NamesLen], buf[b:]) +	b += pad(int(v.NamesLen)) + +	return v +} + +func (cook RandrGetScreenResourcesCurrentCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RandrGetScreenResourcesCurrent +func (c *Conn) randrGetScreenResourcesCurrentRequest(Window Id) []byte { +	size := 8 +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RANDR"] +	b += 1 + +	buf[b] = 25 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Window)) +	b += 4 + +	return buf +} + +// Request RandrSetCrtcTransform +// size: pad(((48 + pad((int(FilterLen) * 1))) + pad((len(FilterParams) * 4)))) +type RandrSetCrtcTransformCookie struct { +	*cookie +} + +// Write request to wire for RandrSetCrtcTransform +func (c *Conn) RandrSetCrtcTransform(Crtc Id, Transform RenderTransform, FilterLen uint16, FilterName string, FilterParams []RenderFixed) RandrSetCrtcTransformCookie { +	cookie := c.newCookie(false, false) +	c.newRequest(c.randrSetCrtcTransformRequest(Crtc, Transform, FilterLen, FilterName, FilterParams), cookie) +	return RandrSetCrtcTransformCookie{cookie} +} + +func (c *Conn) RandrSetCrtcTransformChecked(Crtc Id, Transform RenderTransform, FilterLen uint16, FilterName string, FilterParams []RenderFixed) RandrSetCrtcTransformCookie { +	cookie := c.newCookie(true, false) +	c.newRequest(c.randrSetCrtcTransformRequest(Crtc, Transform, FilterLen, FilterName, FilterParams), cookie) +	return RandrSetCrtcTransformCookie{cookie} +} + +func (cook RandrSetCrtcTransformCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RandrSetCrtcTransform +func (c *Conn) randrSetCrtcTransformRequest(Crtc Id, Transform RenderTransform, FilterLen uint16, FilterName string, FilterParams []RenderFixed) []byte { +	size := pad(((48 + pad((int(FilterLen) * 1))) + pad((len(FilterParams) * 4)))) +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RANDR"] +	b += 1 + +	buf[b] = 26 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Crtc)) +	b += 4 + +	{ +		structBytes := Transform.Bytes() +		copy(buf[b:], structBytes) +		b += pad(len(structBytes)) +	} + +	Put16(buf[b:], FilterLen) +	b += 2 + +	b += 2 // padding + +	copy(buf[b:], FilterName[:FilterLen]) +	b += pad(int(FilterLen)) + +	for i := 0; i < int(len(FilterParams)); i++ { +		Put32(buf[b:], uint32(FilterParams[i])) +		b += 4 +	} +	b = pad(b) + +	return buf +} + +// Request RandrGetCrtcTransform +// size: 8 +type RandrGetCrtcTransformCookie struct { +	*cookie +} + +func (c *Conn) RandrGetCrtcTransform(Crtc Id) RandrGetCrtcTransformCookie { +	cookie := c.newCookie(true, true) +	c.newRequest(c.randrGetCrtcTransformRequest(Crtc), cookie) +	return RandrGetCrtcTransformCookie{cookie} +} + +func (c *Conn) RandrGetCrtcTransformUnchecked(Crtc Id) RandrGetCrtcTransformCookie { +	cookie := c.newCookie(false, true) +	c.newRequest(c.randrGetCrtcTransformRequest(Crtc), cookie) +	return RandrGetCrtcTransformCookie{cookie} +} + +// Request reply for RandrGetCrtcTransform +// size: ((((96 + pad((int(PendingLen) * 1))) + pad((int(PendingNparams) * 4))) + pad((int(CurrentLen) * 1))) + pad((int(CurrentNparams) * 4))) +type RandrGetCrtcTransformReply struct { +	Sequence uint16 +	Length   uint32 +	// padding: 1 bytes +	PendingTransform RenderTransform +	HasTransforms    bool +	// padding: 3 bytes +	CurrentTransform RenderTransform +	// padding: 4 bytes +	PendingLen        uint16 +	PendingNparams    uint16 +	CurrentLen        uint16 +	CurrentNparams    uint16 +	PendingFilterName string        // size: pad((int(PendingLen) * 1)) +	PendingParams     []RenderFixed // size: pad((int(PendingNparams) * 4)) +	CurrentFilterName string        // size: pad((int(CurrentLen) * 1)) +	CurrentParams     []RenderFixed // size: pad((int(CurrentNparams) * 4)) +} + +// Waits and reads reply data from request RandrGetCrtcTransform +func (cook RandrGetCrtcTransformCookie) Reply() (*RandrGetCrtcTransformReply, error) { +	buf, err := cook.reply() +	if err != nil { +		return nil, err +	} +	if buf == nil { +		return nil, nil +	} +	return randrGetCrtcTransformReply(buf), nil +} + +// Read reply into structure from buffer for RandrGetCrtcTransform +func randrGetCrtcTransformReply(buf []byte) *RandrGetCrtcTransformReply { +	v := new(RandrGetCrtcTransformReply) +	b := 1 // skip reply determinant + +	b += 1 // padding + +	v.Sequence = Get16(buf[b:]) +	b += 2 + +	v.Length = Get32(buf[b:]) // 4-byte units +	b += 4 + +	v.PendingTransform = RenderTransform{} +	b += ReadRenderTransform(buf[b:], &v.PendingTransform) + +	if buf[b] == 1 { +		v.HasTransforms = true +	} else { +		v.HasTransforms = false +	} +	b += 1 + +	b += 3 // padding + +	v.CurrentTransform = RenderTransform{} +	b += ReadRenderTransform(buf[b:], &v.CurrentTransform) + +	b += 4 // padding + +	v.PendingLen = Get16(buf[b:]) +	b += 2 + +	v.PendingNparams = Get16(buf[b:]) +	b += 2 + +	v.CurrentLen = Get16(buf[b:]) +	b += 2 + +	v.CurrentNparams = Get16(buf[b:]) +	b += 2 + +	{ +		byteString := make([]byte, v.PendingLen) +		copy(byteString[:v.PendingLen], buf[b:]) +		v.PendingFilterName = string(byteString) +		b += pad(int(v.PendingLen)) +	} + +	v.PendingParams = make([]RenderFixed, v.PendingNparams) +	for i := 0; i < int(v.PendingNparams); i++ { +		v.PendingParams[i] = RenderFixed(Get32(buf[b:])) +		b += 4 +	} +	b = pad(b) + +	{ +		byteString := make([]byte, v.CurrentLen) +		copy(byteString[:v.CurrentLen], buf[b:]) +		v.CurrentFilterName = string(byteString) +		b += pad(int(v.CurrentLen)) +	} + +	v.CurrentParams = make([]RenderFixed, v.CurrentNparams) +	for i := 0; i < int(v.CurrentNparams); i++ { +		v.CurrentParams[i] = RenderFixed(Get32(buf[b:])) +		b += 4 +	} +	b = pad(b) + +	return v +} + +func (cook RandrGetCrtcTransformCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RandrGetCrtcTransform +func (c *Conn) randrGetCrtcTransformRequest(Crtc Id) []byte { +	size := 8 +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RANDR"] +	b += 1 + +	buf[b] = 27 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Crtc)) +	b += 4 + +	return buf +} + +// Request RandrGetPanning +// size: 8 +type RandrGetPanningCookie struct { +	*cookie +} + +func (c *Conn) RandrGetPanning(Crtc Id) RandrGetPanningCookie { +	cookie := c.newCookie(true, true) +	c.newRequest(c.randrGetPanningRequest(Crtc), cookie) +	return RandrGetPanningCookie{cookie} +} + +func (c *Conn) RandrGetPanningUnchecked(Crtc Id) RandrGetPanningCookie { +	cookie := c.newCookie(false, true) +	c.newRequest(c.randrGetPanningRequest(Crtc), cookie) +	return RandrGetPanningCookie{cookie} +} + +// Request reply for RandrGetPanning +// size: 36 +type RandrGetPanningReply struct { +	Sequence     uint16 +	Length       uint32 +	Status       byte +	Timestamp    Timestamp +	Left         uint16 +	Top          uint16 +	Width        uint16 +	Height       uint16 +	TrackLeft    uint16 +	TrackTop     uint16 +	TrackWidth   uint16 +	TrackHeight  uint16 +	BorderLeft   int16 +	BorderTop    int16 +	BorderRight  int16 +	BorderBottom int16 +} + +// Waits and reads reply data from request RandrGetPanning +func (cook RandrGetPanningCookie) Reply() (*RandrGetPanningReply, error) { +	buf, err := cook.reply() +	if err != nil { +		return nil, err +	} +	if buf == nil { +		return nil, nil +	} +	return randrGetPanningReply(buf), nil +} + +// Read reply into structure from buffer for RandrGetPanning +func randrGetPanningReply(buf []byte) *RandrGetPanningReply { +	v := new(RandrGetPanningReply) +	b := 1 // skip reply determinant + +	v.Status = buf[b] +	b += 1 + +	v.Sequence = Get16(buf[b:]) +	b += 2 + +	v.Length = Get32(buf[b:]) // 4-byte units +	b += 4 + +	v.Timestamp = Timestamp(Get32(buf[b:])) +	b += 4 + +	v.Left = Get16(buf[b:]) +	b += 2 + +	v.Top = Get16(buf[b:]) +	b += 2 + +	v.Width = Get16(buf[b:]) +	b += 2 + +	v.Height = Get16(buf[b:]) +	b += 2 + +	v.TrackLeft = Get16(buf[b:]) +	b += 2 + +	v.TrackTop = Get16(buf[b:]) +	b += 2 + +	v.TrackWidth = Get16(buf[b:]) +	b += 2 + +	v.TrackHeight = Get16(buf[b:]) +	b += 2 + +	v.BorderLeft = int16(Get16(buf[b:])) +	b += 2 + +	v.BorderTop = int16(Get16(buf[b:])) +	b += 2 + +	v.BorderRight = int16(Get16(buf[b:])) +	b += 2 + +	v.BorderBottom = int16(Get16(buf[b:])) +	b += 2 + +	return v +} + +func (cook RandrGetPanningCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RandrGetPanning +func (c *Conn) randrGetPanningRequest(Crtc Id) []byte { +	size := 8 +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RANDR"] +	b += 1 + +	buf[b] = 28 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Crtc)) +	b += 4 + +	return buf +} + +// Request RandrSetPanning +// size: 36 +type RandrSetPanningCookie struct { +	*cookie +} + +func (c *Conn) RandrSetPanning(Crtc Id, Timestamp Timestamp, Left uint16, Top uint16, Width uint16, Height uint16, TrackLeft uint16, TrackTop uint16, TrackWidth uint16, TrackHeight uint16, BorderLeft int16, BorderTop int16, BorderRight int16, BorderBottom int16) RandrSetPanningCookie { +	cookie := c.newCookie(true, true) +	c.newRequest(c.randrSetPanningRequest(Crtc, Timestamp, Left, Top, Width, Height, TrackLeft, TrackTop, TrackWidth, TrackHeight, BorderLeft, BorderTop, BorderRight, BorderBottom), cookie) +	return RandrSetPanningCookie{cookie} +} + +func (c *Conn) RandrSetPanningUnchecked(Crtc Id, Timestamp Timestamp, Left uint16, Top uint16, Width uint16, Height uint16, TrackLeft uint16, TrackTop uint16, TrackWidth uint16, TrackHeight uint16, BorderLeft int16, BorderTop int16, BorderRight int16, BorderBottom int16) RandrSetPanningCookie { +	cookie := c.newCookie(false, true) +	c.newRequest(c.randrSetPanningRequest(Crtc, Timestamp, Left, Top, Width, Height, TrackLeft, TrackTop, TrackWidth, TrackHeight, BorderLeft, BorderTop, BorderRight, BorderBottom), cookie) +	return RandrSetPanningCookie{cookie} +} + +// Request reply for RandrSetPanning +// size: 12 +type RandrSetPanningReply struct { +	Sequence  uint16 +	Length    uint32 +	Status    byte +	Timestamp Timestamp +} + +// Waits and reads reply data from request RandrSetPanning +func (cook RandrSetPanningCookie) Reply() (*RandrSetPanningReply, error) { +	buf, err := cook.reply() +	if err != nil { +		return nil, err +	} +	if buf == nil { +		return nil, nil +	} +	return randrSetPanningReply(buf), nil +} + +// Read reply into structure from buffer for RandrSetPanning +func randrSetPanningReply(buf []byte) *RandrSetPanningReply { +	v := new(RandrSetPanningReply) +	b := 1 // skip reply determinant + +	v.Status = buf[b] +	b += 1 + +	v.Sequence = Get16(buf[b:]) +	b += 2 + +	v.Length = Get32(buf[b:]) // 4-byte units +	b += 4 + +	v.Timestamp = Timestamp(Get32(buf[b:])) +	b += 4 + +	return v +} + +func (cook RandrSetPanningCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RandrSetPanning +func (c *Conn) randrSetPanningRequest(Crtc Id, Timestamp Timestamp, Left uint16, Top uint16, Width uint16, Height uint16, TrackLeft uint16, TrackTop uint16, TrackWidth uint16, TrackHeight uint16, BorderLeft int16, BorderTop int16, BorderRight int16, BorderBottom int16) []byte { +	size := 36 +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RANDR"] +	b += 1 + +	buf[b] = 29 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Crtc)) +	b += 4 + +	Put32(buf[b:], uint32(Timestamp)) +	b += 4 + +	Put16(buf[b:], Left) +	b += 2 + +	Put16(buf[b:], Top) +	b += 2 + +	Put16(buf[b:], Width) +	b += 2 + +	Put16(buf[b:], Height) +	b += 2 + +	Put16(buf[b:], TrackLeft) +	b += 2 + +	Put16(buf[b:], TrackTop) +	b += 2 + +	Put16(buf[b:], TrackWidth) +	b += 2 + +	Put16(buf[b:], TrackHeight) +	b += 2 + +	Put16(buf[b:], uint16(BorderLeft)) +	b += 2 + +	Put16(buf[b:], uint16(BorderTop)) +	b += 2 + +	Put16(buf[b:], uint16(BorderRight)) +	b += 2 + +	Put16(buf[b:], uint16(BorderBottom)) +	b += 2 + +	return buf +} + +// Request RandrSetOutputPrimary +// size: 12 +type RandrSetOutputPrimaryCookie struct { +	*cookie +} + +// Write request to wire for RandrSetOutputPrimary +func (c *Conn) RandrSetOutputPrimary(Window Id, Output Id) RandrSetOutputPrimaryCookie { +	cookie := c.newCookie(false, false) +	c.newRequest(c.randrSetOutputPrimaryRequest(Window, Output), cookie) +	return RandrSetOutputPrimaryCookie{cookie} +} + +func (c *Conn) RandrSetOutputPrimaryChecked(Window Id, Output Id) RandrSetOutputPrimaryCookie { +	cookie := c.newCookie(true, false) +	c.newRequest(c.randrSetOutputPrimaryRequest(Window, Output), cookie) +	return RandrSetOutputPrimaryCookie{cookie} +} + +func (cook RandrSetOutputPrimaryCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RandrSetOutputPrimary +func (c *Conn) randrSetOutputPrimaryRequest(Window Id, Output Id) []byte { +	size := 12 +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RANDR"] +	b += 1 + +	buf[b] = 30 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Window)) +	b += 4 + +	Put32(buf[b:], uint32(Output)) +	b += 4 + +	return buf +} + +// Request RandrGetOutputPrimary +// size: 8 +type RandrGetOutputPrimaryCookie struct { +	*cookie +} + +func (c *Conn) RandrGetOutputPrimary(Window Id) RandrGetOutputPrimaryCookie { +	cookie := c.newCookie(true, true) +	c.newRequest(c.randrGetOutputPrimaryRequest(Window), cookie) +	return RandrGetOutputPrimaryCookie{cookie} +} + +func (c *Conn) RandrGetOutputPrimaryUnchecked(Window Id) RandrGetOutputPrimaryCookie { +	cookie := c.newCookie(false, true) +	c.newRequest(c.randrGetOutputPrimaryRequest(Window), cookie) +	return RandrGetOutputPrimaryCookie{cookie} +} + +// Request reply for RandrGetOutputPrimary +// size: 12 +type RandrGetOutputPrimaryReply struct { +	Sequence uint16 +	Length   uint32 +	// padding: 1 bytes +	Output Id +} + +// Waits and reads reply data from request RandrGetOutputPrimary +func (cook RandrGetOutputPrimaryCookie) Reply() (*RandrGetOutputPrimaryReply, error) { +	buf, err := cook.reply() +	if err != nil { +		return nil, err +	} +	if buf == nil { +		return nil, nil +	} +	return randrGetOutputPrimaryReply(buf), nil +} + +// Read reply into structure from buffer for RandrGetOutputPrimary +func randrGetOutputPrimaryReply(buf []byte) *RandrGetOutputPrimaryReply { +	v := new(RandrGetOutputPrimaryReply) +	b := 1 // skip reply determinant + +	b += 1 // padding + +	v.Sequence = Get16(buf[b:]) +	b += 2 + +	v.Length = Get32(buf[b:]) // 4-byte units +	b += 4 + +	v.Output = Id(Get32(buf[b:])) +	b += 4 + +	return v +} + +func (cook RandrGetOutputPrimaryCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RandrGetOutputPrimary +func (c *Conn) randrGetOutputPrimaryRequest(Window Id) []byte { +	size := 8 +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RANDR"] +	b += 1 + +	buf[b] = 31 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Window)) +	b += 4 + +	return buf +} diff --git a/nexgb/render.go b/nexgb/render.go new file mode 100644 index 0000000..069ce76 --- /dev/null +++ b/nexgb/render.go @@ -0,0 +1,3506 @@ +package xgb + +/* +	This file was generated by render.xml on May 5 2012 6:07:02pm EDT. +	This file is automatically generated. Edit at your peril! +*/ + +// Imports are not necessary for XGB because everything is  +// in one package. They are still listed here for reference. +// import "xproto" + +// Skipping definition for base type 'Id' + +// Skipping definition for base type 'Card8' + +// Skipping definition for base type 'Int16' + +// Skipping definition for base type 'Int32' + +// Skipping definition for base type 'Void' + +// Skipping definition for base type 'Byte' + +// Skipping definition for base type 'Int8' + +// Skipping definition for base type 'Card16' + +// Skipping definition for base type 'Char' + +// Skipping definition for base type 'Card32' + +// Skipping definition for base type 'Double' + +// Skipping definition for base type 'Bool' + +// Skipping definition for base type 'Float' + +const ( +	RenderPictTypeIndexed = 0 +	RenderPictTypeDirect  = 1 +) + +const ( +	RenderPictureNone = 0 +) + +const ( +	RenderPictOpClear               = 0 +	RenderPictOpSrc                 = 1 +	RenderPictOpDst                 = 2 +	RenderPictOpOver                = 3 +	RenderPictOpOverReverse         = 4 +	RenderPictOpIn                  = 5 +	RenderPictOpInReverse           = 6 +	RenderPictOpOut                 = 7 +	RenderPictOpOutReverse          = 8 +	RenderPictOpAtop                = 9 +	RenderPictOpAtopReverse         = 10 +	RenderPictOpXor                 = 11 +	RenderPictOpAdd                 = 12 +	RenderPictOpSaturate            = 13 +	RenderPictOpDisjointClear       = 16 +	RenderPictOpDisjointSrc         = 17 +	RenderPictOpDisjointDst         = 18 +	RenderPictOpDisjointOver        = 19 +	RenderPictOpDisjointOverReverse = 20 +	RenderPictOpDisjointIn          = 21 +	RenderPictOpDisjointInReverse   = 22 +	RenderPictOpDisjointOut         = 23 +	RenderPictOpDisjointOutReverse  = 24 +	RenderPictOpDisjointAtop        = 25 +	RenderPictOpDisjointAtopReverse = 26 +	RenderPictOpDisjointXor         = 27 +	RenderPictOpConjointClear       = 32 +	RenderPictOpConjointSrc         = 33 +	RenderPictOpConjointDst         = 34 +	RenderPictOpConjointOver        = 35 +	RenderPictOpConjointOverReverse = 36 +	RenderPictOpConjointIn          = 37 +	RenderPictOpConjointInReverse   = 38 +	RenderPictOpConjointOut         = 39 +	RenderPictOpConjointOutReverse  = 40 +	RenderPictOpConjointAtop        = 41 +	RenderPictOpConjointAtopReverse = 42 +	RenderPictOpConjointXor         = 43 +	RenderPictOpMultiply            = 48 +	RenderPictOpScreen              = 49 +	RenderPictOpOverlay             = 50 +	RenderPictOpDarken              = 51 +	RenderPictOpLighten             = 52 +	RenderPictOpColorDodge          = 53 +	RenderPictOpColorBurn           = 54 +	RenderPictOpHardLight           = 55 +	RenderPictOpSoftLight           = 56 +	RenderPictOpDifference          = 57 +	RenderPictOpExclusion           = 58 +	RenderPictOpHSLHue              = 59 +	RenderPictOpHSLSaturation       = 60 +	RenderPictOpHSLColor            = 61 +	RenderPictOpHSLLuminosity       = 62 +) + +const ( +	RenderPolyEdgeSharp  = 0 +	RenderPolyEdgeSmooth = 1 +) + +const ( +	RenderPolyModePrecise   = 0 +	RenderPolyModeImprecise = 1 +) + +const ( +	RenderCpRepeat           = 1 +	RenderCpAlphaMap         = 2 +	RenderCpAlphaXOrigin     = 4 +	RenderCpAlphaYOrigin     = 8 +	RenderCpClipXOrigin      = 16 +	RenderCpClipYOrigin      = 32 +	RenderCpClipMask         = 64 +	RenderCpGraphicsExposure = 128 +	RenderCpSubwindowMode    = 256 +	RenderCpPolyEdge         = 512 +	RenderCpPolyMode         = 1024 +	RenderCpDither           = 2048 +	RenderCpComponentAlpha   = 4096 +) + +const ( +	RenderSubPixelUnknown       = 0 +	RenderSubPixelHorizontalRGB = 1 +	RenderSubPixelHorizontalBGR = 2 +	RenderSubPixelVerticalRGB   = 3 +	RenderSubPixelVerticalBGR   = 4 +	RenderSubPixelNone          = 5 +) + +const ( +	RenderRepeatNone    = 0 +	RenderRepeatNormal  = 1 +	RenderRepeatPad     = 2 +	RenderRepeatReflect = 3 +) + +// Skipping resource definition of 'Glyphset' + +// Skipping resource definition of 'Picture' + +// Skipping resource definition of 'Pictformat' + +type RenderGlyph uint32 + +type RenderFixed int32 + +// 'RenderDirectformat' struct definition +// Size: 16 +type RenderDirectformat struct { +	RedShift   uint16 +	RedMask    uint16 +	GreenShift uint16 +	GreenMask  uint16 +	BlueShift  uint16 +	BlueMask   uint16 +	AlphaShift uint16 +	AlphaMask  uint16 +} + +// Struct read RenderDirectformat +func ReadRenderDirectformat(buf []byte, v *RenderDirectformat) int { +	b := 0 + +	v.RedShift = Get16(buf[b:]) +	b += 2 + +	v.RedMask = Get16(buf[b:]) +	b += 2 + +	v.GreenShift = Get16(buf[b:]) +	b += 2 + +	v.GreenMask = Get16(buf[b:]) +	b += 2 + +	v.BlueShift = Get16(buf[b:]) +	b += 2 + +	v.BlueMask = Get16(buf[b:]) +	b += 2 + +	v.AlphaShift = Get16(buf[b:]) +	b += 2 + +	v.AlphaMask = Get16(buf[b:]) +	b += 2 + +	return b +} + +// Struct list read RenderDirectformat +func ReadRenderDirectformatList(buf []byte, dest []RenderDirectformat) int { +	b := 0 +	for i := 0; i < len(dest); i++ { +		dest[i] = RenderDirectformat{} +		b += ReadRenderDirectformat(buf[b:], &dest[i]) +	} +	return pad(b) +} + +// Struct write RenderDirectformat +func (v RenderDirectformat) Bytes() []byte { +	buf := make([]byte, 16) +	b := 0 + +	Put16(buf[b:], v.RedShift) +	b += 2 + +	Put16(buf[b:], v.RedMask) +	b += 2 + +	Put16(buf[b:], v.GreenShift) +	b += 2 + +	Put16(buf[b:], v.GreenMask) +	b += 2 + +	Put16(buf[b:], v.BlueShift) +	b += 2 + +	Put16(buf[b:], v.BlueMask) +	b += 2 + +	Put16(buf[b:], v.AlphaShift) +	b += 2 + +	Put16(buf[b:], v.AlphaMask) +	b += 2 + +	return buf +} + +// Write struct list RenderDirectformat +func RenderDirectformatListBytes(buf []byte, list []RenderDirectformat) int { +	b := 0 +	var structBytes []byte +	for _, item := range list { +		structBytes = item.Bytes() +		copy(buf[b:], structBytes) +		b += pad(len(structBytes)) +	} +	return b +} + +// 'RenderPictforminfo' struct definition +// Size: 28 +type RenderPictforminfo struct { +	Id    Id +	Type  byte +	Depth byte +	// padding: 2 bytes +	Direct   RenderDirectformat +	Colormap Id +} + +// Struct read RenderPictforminfo +func ReadRenderPictforminfo(buf []byte, v *RenderPictforminfo) int { +	b := 0 + +	v.Id = Id(Get32(buf[b:])) +	b += 4 + +	v.Type = buf[b] +	b += 1 + +	v.Depth = buf[b] +	b += 1 + +	b += 2 // padding + +	v.Direct = RenderDirectformat{} +	b += ReadRenderDirectformat(buf[b:], &v.Direct) + +	v.Colormap = Id(Get32(buf[b:])) +	b += 4 + +	return b +} + +// Struct list read RenderPictforminfo +func ReadRenderPictforminfoList(buf []byte, dest []RenderPictforminfo) int { +	b := 0 +	for i := 0; i < len(dest); i++ { +		dest[i] = RenderPictforminfo{} +		b += ReadRenderPictforminfo(buf[b:], &dest[i]) +	} +	return pad(b) +} + +// Struct write RenderPictforminfo +func (v RenderPictforminfo) Bytes() []byte { +	buf := make([]byte, 28) +	b := 0 + +	Put32(buf[b:], uint32(v.Id)) +	b += 4 + +	buf[b] = v.Type +	b += 1 + +	buf[b] = v.Depth +	b += 1 + +	b += 2 // padding + +	{ +		structBytes := v.Direct.Bytes() +		copy(buf[b:], structBytes) +		b += pad(len(structBytes)) +	} + +	Put32(buf[b:], uint32(v.Colormap)) +	b += 4 + +	return buf +} + +// Write struct list RenderPictforminfo +func RenderPictforminfoListBytes(buf []byte, list []RenderPictforminfo) int { +	b := 0 +	var structBytes []byte +	for _, item := range list { +		structBytes = item.Bytes() +		copy(buf[b:], structBytes) +		b += pad(len(structBytes)) +	} +	return b +} + +// 'RenderPictvisual' struct definition +// Size: 8 +type RenderPictvisual struct { +	Visual Visualid +	Format Id +} + +// Struct read RenderPictvisual +func ReadRenderPictvisual(buf []byte, v *RenderPictvisual) int { +	b := 0 + +	v.Visual = Visualid(Get32(buf[b:])) +	b += 4 + +	v.Format = Id(Get32(buf[b:])) +	b += 4 + +	return b +} + +// Struct list read RenderPictvisual +func ReadRenderPictvisualList(buf []byte, dest []RenderPictvisual) int { +	b := 0 +	for i := 0; i < len(dest); i++ { +		dest[i] = RenderPictvisual{} +		b += ReadRenderPictvisual(buf[b:], &dest[i]) +	} +	return pad(b) +} + +// Struct write RenderPictvisual +func (v RenderPictvisual) Bytes() []byte { +	buf := make([]byte, 8) +	b := 0 + +	Put32(buf[b:], uint32(v.Visual)) +	b += 4 + +	Put32(buf[b:], uint32(v.Format)) +	b += 4 + +	return buf +} + +// Write struct list RenderPictvisual +func RenderPictvisualListBytes(buf []byte, list []RenderPictvisual) int { +	b := 0 +	var structBytes []byte +	for _, item := range list { +		structBytes = item.Bytes() +		copy(buf[b:], structBytes) +		b += pad(len(structBytes)) +	} +	return b +} + +// 'RenderPictdepth' struct definition +// Size: (8 + pad((int(NumVisuals) * 8))) +type RenderPictdepth struct { +	Depth byte +	// padding: 1 bytes +	NumVisuals uint16 +	// padding: 4 bytes +	Visuals []RenderPictvisual // size: pad((int(NumVisuals) * 8)) +} + +// Struct read RenderPictdepth +func ReadRenderPictdepth(buf []byte, v *RenderPictdepth) int { +	b := 0 + +	v.Depth = buf[b] +	b += 1 + +	b += 1 // padding + +	v.NumVisuals = Get16(buf[b:]) +	b += 2 + +	b += 4 // padding + +	v.Visuals = make([]RenderPictvisual, v.NumVisuals) +	b += ReadRenderPictvisualList(buf[b:], v.Visuals) + +	return b +} + +// Struct list read RenderPictdepth +func ReadRenderPictdepthList(buf []byte, dest []RenderPictdepth) int { +	b := 0 +	for i := 0; i < len(dest); i++ { +		dest[i] = RenderPictdepth{} +		b += ReadRenderPictdepth(buf[b:], &dest[i]) +	} +	return pad(b) +} + +// Struct write RenderPictdepth +func (v RenderPictdepth) Bytes() []byte { +	buf := make([]byte, (8 + pad((int(v.NumVisuals) * 8)))) +	b := 0 + +	buf[b] = v.Depth +	b += 1 + +	b += 1 // padding + +	Put16(buf[b:], v.NumVisuals) +	b += 2 + +	b += 4 // padding + +	b += RenderPictvisualListBytes(buf[b:], v.Visuals) + +	return buf +} + +// Write struct list RenderPictdepth +func RenderPictdepthListBytes(buf []byte, list []RenderPictdepth) int { +	b := 0 +	var structBytes []byte +	for _, item := range list { +		structBytes = item.Bytes() +		copy(buf[b:], structBytes) +		b += pad(len(structBytes)) +	} +	return b +} + +// Struct list size RenderPictdepth +func RenderPictdepthListSize(list []RenderPictdepth) int { +	size := 0 +	for _, item := range list { +		size += (8 + pad((int(item.NumVisuals) * 8))) +	} +	return size +} + +// 'RenderPictscreen' struct definition +// Size: (8 + RenderPictdepthListSize(Depths)) +type RenderPictscreen struct { +	NumDepths uint32 +	Fallback  Id +	Depths    []RenderPictdepth // size: RenderPictdepthListSize(Depths) +} + +// Struct read RenderPictscreen +func ReadRenderPictscreen(buf []byte, v *RenderPictscreen) int { +	b := 0 + +	v.NumDepths = Get32(buf[b:]) +	b += 4 + +	v.Fallback = Id(Get32(buf[b:])) +	b += 4 + +	v.Depths = make([]RenderPictdepth, v.NumDepths) +	b += ReadRenderPictdepthList(buf[b:], v.Depths) + +	return b +} + +// Struct list read RenderPictscreen +func ReadRenderPictscreenList(buf []byte, dest []RenderPictscreen) int { +	b := 0 +	for i := 0; i < len(dest); i++ { +		dest[i] = RenderPictscreen{} +		b += ReadRenderPictscreen(buf[b:], &dest[i]) +	} +	return pad(b) +} + +// Struct write RenderPictscreen +func (v RenderPictscreen) Bytes() []byte { +	buf := make([]byte, (8 + RenderPictdepthListSize(v.Depths))) +	b := 0 + +	Put32(buf[b:], v.NumDepths) +	b += 4 + +	Put32(buf[b:], uint32(v.Fallback)) +	b += 4 + +	b += RenderPictdepthListBytes(buf[b:], v.Depths) + +	return buf +} + +// Write struct list RenderPictscreen +func RenderPictscreenListBytes(buf []byte, list []RenderPictscreen) int { +	b := 0 +	var structBytes []byte +	for _, item := range list { +		structBytes = item.Bytes() +		copy(buf[b:], structBytes) +		b += pad(len(structBytes)) +	} +	return b +} + +// Struct list size RenderPictscreen +func RenderPictscreenListSize(list []RenderPictscreen) int { +	size := 0 +	for _, item := range list { +		size += (8 + RenderPictdepthListSize(item.Depths)) +	} +	return size +} + +// 'RenderIndexvalue' struct definition +// Size: 12 +type RenderIndexvalue struct { +	Pixel uint32 +	Red   uint16 +	Green uint16 +	Blue  uint16 +	Alpha uint16 +} + +// Struct read RenderIndexvalue +func ReadRenderIndexvalue(buf []byte, v *RenderIndexvalue) int { +	b := 0 + +	v.Pixel = Get32(buf[b:]) +	b += 4 + +	v.Red = Get16(buf[b:]) +	b += 2 + +	v.Green = Get16(buf[b:]) +	b += 2 + +	v.Blue = Get16(buf[b:]) +	b += 2 + +	v.Alpha = Get16(buf[b:]) +	b += 2 + +	return b +} + +// Struct list read RenderIndexvalue +func ReadRenderIndexvalueList(buf []byte, dest []RenderIndexvalue) int { +	b := 0 +	for i := 0; i < len(dest); i++ { +		dest[i] = RenderIndexvalue{} +		b += ReadRenderIndexvalue(buf[b:], &dest[i]) +	} +	return pad(b) +} + +// Struct write RenderIndexvalue +func (v RenderIndexvalue) Bytes() []byte { +	buf := make([]byte, 12) +	b := 0 + +	Put32(buf[b:], v.Pixel) +	b += 4 + +	Put16(buf[b:], v.Red) +	b += 2 + +	Put16(buf[b:], v.Green) +	b += 2 + +	Put16(buf[b:], v.Blue) +	b += 2 + +	Put16(buf[b:], v.Alpha) +	b += 2 + +	return buf +} + +// Write struct list RenderIndexvalue +func RenderIndexvalueListBytes(buf []byte, list []RenderIndexvalue) int { +	b := 0 +	var structBytes []byte +	for _, item := range list { +		structBytes = item.Bytes() +		copy(buf[b:], structBytes) +		b += pad(len(structBytes)) +	} +	return b +} + +// 'RenderColor' struct definition +// Size: 8 +type RenderColor struct { +	Red   uint16 +	Green uint16 +	Blue  uint16 +	Alpha uint16 +} + +// Struct read RenderColor +func ReadRenderColor(buf []byte, v *RenderColor) int { +	b := 0 + +	v.Red = Get16(buf[b:]) +	b += 2 + +	v.Green = Get16(buf[b:]) +	b += 2 + +	v.Blue = Get16(buf[b:]) +	b += 2 + +	v.Alpha = Get16(buf[b:]) +	b += 2 + +	return b +} + +// Struct list read RenderColor +func ReadRenderColorList(buf []byte, dest []RenderColor) int { +	b := 0 +	for i := 0; i < len(dest); i++ { +		dest[i] = RenderColor{} +		b += ReadRenderColor(buf[b:], &dest[i]) +	} +	return pad(b) +} + +// Struct write RenderColor +func (v RenderColor) Bytes() []byte { +	buf := make([]byte, 8) +	b := 0 + +	Put16(buf[b:], v.Red) +	b += 2 + +	Put16(buf[b:], v.Green) +	b += 2 + +	Put16(buf[b:], v.Blue) +	b += 2 + +	Put16(buf[b:], v.Alpha) +	b += 2 + +	return buf +} + +// Write struct list RenderColor +func RenderColorListBytes(buf []byte, list []RenderColor) int { +	b := 0 +	var structBytes []byte +	for _, item := range list { +		structBytes = item.Bytes() +		copy(buf[b:], structBytes) +		b += pad(len(structBytes)) +	} +	return b +} + +// 'RenderPointfix' struct definition +// Size: 8 +type RenderPointfix struct { +	X RenderFixed +	Y RenderFixed +} + +// Struct read RenderPointfix +func ReadRenderPointfix(buf []byte, v *RenderPointfix) int { +	b := 0 + +	v.X = RenderFixed(Get32(buf[b:])) +	b += 4 + +	v.Y = RenderFixed(Get32(buf[b:])) +	b += 4 + +	return b +} + +// Struct list read RenderPointfix +func ReadRenderPointfixList(buf []byte, dest []RenderPointfix) int { +	b := 0 +	for i := 0; i < len(dest); i++ { +		dest[i] = RenderPointfix{} +		b += ReadRenderPointfix(buf[b:], &dest[i]) +	} +	return pad(b) +} + +// Struct write RenderPointfix +func (v RenderPointfix) Bytes() []byte { +	buf := make([]byte, 8) +	b := 0 + +	Put32(buf[b:], uint32(v.X)) +	b += 4 + +	Put32(buf[b:], uint32(v.Y)) +	b += 4 + +	return buf +} + +// Write struct list RenderPointfix +func RenderPointfixListBytes(buf []byte, list []RenderPointfix) int { +	b := 0 +	var structBytes []byte +	for _, item := range list { +		structBytes = item.Bytes() +		copy(buf[b:], structBytes) +		b += pad(len(structBytes)) +	} +	return b +} + +// 'RenderLinefix' struct definition +// Size: 16 +type RenderLinefix struct { +	P1 RenderPointfix +	P2 RenderPointfix +} + +// Struct read RenderLinefix +func ReadRenderLinefix(buf []byte, v *RenderLinefix) int { +	b := 0 + +	v.P1 = RenderPointfix{} +	b += ReadRenderPointfix(buf[b:], &v.P1) + +	v.P2 = RenderPointfix{} +	b += ReadRenderPointfix(buf[b:], &v.P2) + +	return b +} + +// Struct list read RenderLinefix +func ReadRenderLinefixList(buf []byte, dest []RenderLinefix) int { +	b := 0 +	for i := 0; i < len(dest); i++ { +		dest[i] = RenderLinefix{} +		b += ReadRenderLinefix(buf[b:], &dest[i]) +	} +	return pad(b) +} + +// Struct write RenderLinefix +func (v RenderLinefix) Bytes() []byte { +	buf := make([]byte, 16) +	b := 0 + +	{ +		structBytes := v.P1.Bytes() +		copy(buf[b:], structBytes) +		b += pad(len(structBytes)) +	} + +	{ +		structBytes := v.P2.Bytes() +		copy(buf[b:], structBytes) +		b += pad(len(structBytes)) +	} + +	return buf +} + +// Write struct list RenderLinefix +func RenderLinefixListBytes(buf []byte, list []RenderLinefix) int { +	b := 0 +	var structBytes []byte +	for _, item := range list { +		structBytes = item.Bytes() +		copy(buf[b:], structBytes) +		b += pad(len(structBytes)) +	} +	return b +} + +// 'RenderTriangle' struct definition +// Size: 24 +type RenderTriangle struct { +	P1 RenderPointfix +	P2 RenderPointfix +	P3 RenderPointfix +} + +// Struct read RenderTriangle +func ReadRenderTriangle(buf []byte, v *RenderTriangle) int { +	b := 0 + +	v.P1 = RenderPointfix{} +	b += ReadRenderPointfix(buf[b:], &v.P1) + +	v.P2 = RenderPointfix{} +	b += ReadRenderPointfix(buf[b:], &v.P2) + +	v.P3 = RenderPointfix{} +	b += ReadRenderPointfix(buf[b:], &v.P3) + +	return b +} + +// Struct list read RenderTriangle +func ReadRenderTriangleList(buf []byte, dest []RenderTriangle) int { +	b := 0 +	for i := 0; i < len(dest); i++ { +		dest[i] = RenderTriangle{} +		b += ReadRenderTriangle(buf[b:], &dest[i]) +	} +	return pad(b) +} + +// Struct write RenderTriangle +func (v RenderTriangle) Bytes() []byte { +	buf := make([]byte, 24) +	b := 0 + +	{ +		structBytes := v.P1.Bytes() +		copy(buf[b:], structBytes) +		b += pad(len(structBytes)) +	} + +	{ +		structBytes := v.P2.Bytes() +		copy(buf[b:], structBytes) +		b += pad(len(structBytes)) +	} + +	{ +		structBytes := v.P3.Bytes() +		copy(buf[b:], structBytes) +		b += pad(len(structBytes)) +	} + +	return buf +} + +// Write struct list RenderTriangle +func RenderTriangleListBytes(buf []byte, list []RenderTriangle) int { +	b := 0 +	var structBytes []byte +	for _, item := range list { +		structBytes = item.Bytes() +		copy(buf[b:], structBytes) +		b += pad(len(structBytes)) +	} +	return b +} + +// 'RenderTrapezoid' struct definition +// Size: 40 +type RenderTrapezoid struct { +	Top    RenderFixed +	Bottom RenderFixed +	Left   RenderLinefix +	Right  RenderLinefix +} + +// Struct read RenderTrapezoid +func ReadRenderTrapezoid(buf []byte, v *RenderTrapezoid) int { +	b := 0 + +	v.Top = RenderFixed(Get32(buf[b:])) +	b += 4 + +	v.Bottom = RenderFixed(Get32(buf[b:])) +	b += 4 + +	v.Left = RenderLinefix{} +	b += ReadRenderLinefix(buf[b:], &v.Left) + +	v.Right = RenderLinefix{} +	b += ReadRenderLinefix(buf[b:], &v.Right) + +	return b +} + +// Struct list read RenderTrapezoid +func ReadRenderTrapezoidList(buf []byte, dest []RenderTrapezoid) int { +	b := 0 +	for i := 0; i < len(dest); i++ { +		dest[i] = RenderTrapezoid{} +		b += ReadRenderTrapezoid(buf[b:], &dest[i]) +	} +	return pad(b) +} + +// Struct write RenderTrapezoid +func (v RenderTrapezoid) Bytes() []byte { +	buf := make([]byte, 40) +	b := 0 + +	Put32(buf[b:], uint32(v.Top)) +	b += 4 + +	Put32(buf[b:], uint32(v.Bottom)) +	b += 4 + +	{ +		structBytes := v.Left.Bytes() +		copy(buf[b:], structBytes) +		b += pad(len(structBytes)) +	} + +	{ +		structBytes := v.Right.Bytes() +		copy(buf[b:], structBytes) +		b += pad(len(structBytes)) +	} + +	return buf +} + +// Write struct list RenderTrapezoid +func RenderTrapezoidListBytes(buf []byte, list []RenderTrapezoid) int { +	b := 0 +	var structBytes []byte +	for _, item := range list { +		structBytes = item.Bytes() +		copy(buf[b:], structBytes) +		b += pad(len(structBytes)) +	} +	return b +} + +// 'RenderGlyphinfo' struct definition +// Size: 12 +type RenderGlyphinfo struct { +	Width  uint16 +	Height uint16 +	X      int16 +	Y      int16 +	XOff   int16 +	YOff   int16 +} + +// Struct read RenderGlyphinfo +func ReadRenderGlyphinfo(buf []byte, v *RenderGlyphinfo) int { +	b := 0 + +	v.Width = Get16(buf[b:]) +	b += 2 + +	v.Height = Get16(buf[b:]) +	b += 2 + +	v.X = int16(Get16(buf[b:])) +	b += 2 + +	v.Y = int16(Get16(buf[b:])) +	b += 2 + +	v.XOff = int16(Get16(buf[b:])) +	b += 2 + +	v.YOff = int16(Get16(buf[b:])) +	b += 2 + +	return b +} + +// Struct list read RenderGlyphinfo +func ReadRenderGlyphinfoList(buf []byte, dest []RenderGlyphinfo) int { +	b := 0 +	for i := 0; i < len(dest); i++ { +		dest[i] = RenderGlyphinfo{} +		b += ReadRenderGlyphinfo(buf[b:], &dest[i]) +	} +	return pad(b) +} + +// Struct write RenderGlyphinfo +func (v RenderGlyphinfo) Bytes() []byte { +	buf := make([]byte, 12) +	b := 0 + +	Put16(buf[b:], v.Width) +	b += 2 + +	Put16(buf[b:], v.Height) +	b += 2 + +	Put16(buf[b:], uint16(v.X)) +	b += 2 + +	Put16(buf[b:], uint16(v.Y)) +	b += 2 + +	Put16(buf[b:], uint16(v.XOff)) +	b += 2 + +	Put16(buf[b:], uint16(v.YOff)) +	b += 2 + +	return buf +} + +// Write struct list RenderGlyphinfo +func RenderGlyphinfoListBytes(buf []byte, list []RenderGlyphinfo) int { +	b := 0 +	var structBytes []byte +	for _, item := range list { +		structBytes = item.Bytes() +		copy(buf[b:], structBytes) +		b += pad(len(structBytes)) +	} +	return b +} + +// 'RenderTransform' struct definition +// Size: 36 +type RenderTransform struct { +	Matrix11 RenderFixed +	Matrix12 RenderFixed +	Matrix13 RenderFixed +	Matrix21 RenderFixed +	Matrix22 RenderFixed +	Matrix23 RenderFixed +	Matrix31 RenderFixed +	Matrix32 RenderFixed +	Matrix33 RenderFixed +} + +// Struct read RenderTransform +func ReadRenderTransform(buf []byte, v *RenderTransform) int { +	b := 0 + +	v.Matrix11 = RenderFixed(Get32(buf[b:])) +	b += 4 + +	v.Matrix12 = RenderFixed(Get32(buf[b:])) +	b += 4 + +	v.Matrix13 = RenderFixed(Get32(buf[b:])) +	b += 4 + +	v.Matrix21 = RenderFixed(Get32(buf[b:])) +	b += 4 + +	v.Matrix22 = RenderFixed(Get32(buf[b:])) +	b += 4 + +	v.Matrix23 = RenderFixed(Get32(buf[b:])) +	b += 4 + +	v.Matrix31 = RenderFixed(Get32(buf[b:])) +	b += 4 + +	v.Matrix32 = RenderFixed(Get32(buf[b:])) +	b += 4 + +	v.Matrix33 = RenderFixed(Get32(buf[b:])) +	b += 4 + +	return b +} + +// Struct list read RenderTransform +func ReadRenderTransformList(buf []byte, dest []RenderTransform) int { +	b := 0 +	for i := 0; i < len(dest); i++ { +		dest[i] = RenderTransform{} +		b += ReadRenderTransform(buf[b:], &dest[i]) +	} +	return pad(b) +} + +// Struct write RenderTransform +func (v RenderTransform) Bytes() []byte { +	buf := make([]byte, 36) +	b := 0 + +	Put32(buf[b:], uint32(v.Matrix11)) +	b += 4 + +	Put32(buf[b:], uint32(v.Matrix12)) +	b += 4 + +	Put32(buf[b:], uint32(v.Matrix13)) +	b += 4 + +	Put32(buf[b:], uint32(v.Matrix21)) +	b += 4 + +	Put32(buf[b:], uint32(v.Matrix22)) +	b += 4 + +	Put32(buf[b:], uint32(v.Matrix23)) +	b += 4 + +	Put32(buf[b:], uint32(v.Matrix31)) +	b += 4 + +	Put32(buf[b:], uint32(v.Matrix32)) +	b += 4 + +	Put32(buf[b:], uint32(v.Matrix33)) +	b += 4 + +	return buf +} + +// Write struct list RenderTransform +func RenderTransformListBytes(buf []byte, list []RenderTransform) int { +	b := 0 +	var structBytes []byte +	for _, item := range list { +		structBytes = item.Bytes() +		copy(buf[b:], structBytes) +		b += pad(len(structBytes)) +	} +	return b +} + +// 'RenderAnimcursorelt' struct definition +// Size: 8 +type RenderAnimcursorelt struct { +	Cursor Id +	Delay  uint32 +} + +// Struct read RenderAnimcursorelt +func ReadRenderAnimcursorelt(buf []byte, v *RenderAnimcursorelt) int { +	b := 0 + +	v.Cursor = Id(Get32(buf[b:])) +	b += 4 + +	v.Delay = Get32(buf[b:]) +	b += 4 + +	return b +} + +// Struct list read RenderAnimcursorelt +func ReadRenderAnimcursoreltList(buf []byte, dest []RenderAnimcursorelt) int { +	b := 0 +	for i := 0; i < len(dest); i++ { +		dest[i] = RenderAnimcursorelt{} +		b += ReadRenderAnimcursorelt(buf[b:], &dest[i]) +	} +	return pad(b) +} + +// Struct write RenderAnimcursorelt +func (v RenderAnimcursorelt) Bytes() []byte { +	buf := make([]byte, 8) +	b := 0 + +	Put32(buf[b:], uint32(v.Cursor)) +	b += 4 + +	Put32(buf[b:], v.Delay) +	b += 4 + +	return buf +} + +// Write struct list RenderAnimcursorelt +func RenderAnimcursoreltListBytes(buf []byte, list []RenderAnimcursorelt) int { +	b := 0 +	var structBytes []byte +	for _, item := range list { +		structBytes = item.Bytes() +		copy(buf[b:], structBytes) +		b += pad(len(structBytes)) +	} +	return b +} + +// 'RenderSpanfix' struct definition +// Size: 12 +type RenderSpanfix struct { +	L RenderFixed +	R RenderFixed +	Y RenderFixed +} + +// Struct read RenderSpanfix +func ReadRenderSpanfix(buf []byte, v *RenderSpanfix) int { +	b := 0 + +	v.L = RenderFixed(Get32(buf[b:])) +	b += 4 + +	v.R = RenderFixed(Get32(buf[b:])) +	b += 4 + +	v.Y = RenderFixed(Get32(buf[b:])) +	b += 4 + +	return b +} + +// Struct list read RenderSpanfix +func ReadRenderSpanfixList(buf []byte, dest []RenderSpanfix) int { +	b := 0 +	for i := 0; i < len(dest); i++ { +		dest[i] = RenderSpanfix{} +		b += ReadRenderSpanfix(buf[b:], &dest[i]) +	} +	return pad(b) +} + +// Struct write RenderSpanfix +func (v RenderSpanfix) Bytes() []byte { +	buf := make([]byte, 12) +	b := 0 + +	Put32(buf[b:], uint32(v.L)) +	b += 4 + +	Put32(buf[b:], uint32(v.R)) +	b += 4 + +	Put32(buf[b:], uint32(v.Y)) +	b += 4 + +	return buf +} + +// Write struct list RenderSpanfix +func RenderSpanfixListBytes(buf []byte, list []RenderSpanfix) int { +	b := 0 +	var structBytes []byte +	for _, item := range list { +		structBytes = item.Bytes() +		copy(buf[b:], structBytes) +		b += pad(len(structBytes)) +	} +	return b +} + +// 'RenderTrap' struct definition +// Size: 24 +type RenderTrap struct { +	Top RenderSpanfix +	Bot RenderSpanfix +} + +// Struct read RenderTrap +func ReadRenderTrap(buf []byte, v *RenderTrap) int { +	b := 0 + +	v.Top = RenderSpanfix{} +	b += ReadRenderSpanfix(buf[b:], &v.Top) + +	v.Bot = RenderSpanfix{} +	b += ReadRenderSpanfix(buf[b:], &v.Bot) + +	return b +} + +// Struct list read RenderTrap +func ReadRenderTrapList(buf []byte, dest []RenderTrap) int { +	b := 0 +	for i := 0; i < len(dest); i++ { +		dest[i] = RenderTrap{} +		b += ReadRenderTrap(buf[b:], &dest[i]) +	} +	return pad(b) +} + +// Struct write RenderTrap +func (v RenderTrap) Bytes() []byte { +	buf := make([]byte, 24) +	b := 0 + +	{ +		structBytes := v.Top.Bytes() +		copy(buf[b:], structBytes) +		b += pad(len(structBytes)) +	} + +	{ +		structBytes := v.Bot.Bytes() +		copy(buf[b:], structBytes) +		b += pad(len(structBytes)) +	} + +	return buf +} + +// Write struct list RenderTrap +func RenderTrapListBytes(buf []byte, list []RenderTrap) int { +	b := 0 +	var structBytes []byte +	for _, item := range list { +		structBytes = item.Bytes() +		copy(buf[b:], structBytes) +		b += pad(len(structBytes)) +	} +	return b +} + +// Error definition RenderPictFormat (0) +// Size: 32 + +const BadRenderPictFormat = 0 + +type RenderPictFormatError struct { +	Sequence uint16 +	NiceName string +} + +// Error read RenderPictFormat +func NewRenderPictFormatError(buf []byte) Error { +	v := RenderPictFormatError{} +	v.NiceName = "RenderPictFormat" + +	b := 1 // skip error determinant +	b += 1 // don't read error number + +	v.Sequence = Get16(buf[b:]) +	b += 2 + +	return v +} + +func (err RenderPictFormatError) ImplementsError() {} + +func (err RenderPictFormatError) SequenceId() uint16 { +	return err.Sequence +} + +func (err RenderPictFormatError) BadId() Id { +	return 0 +} + +func (err RenderPictFormatError) Error() string { +	fieldVals := make([]string, 0, 0) +	fieldVals = append(fieldVals, "NiceName: "+err.NiceName) +	fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) +	return "BadRenderPictFormat {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { +	newErrorFuncs[0] = NewRenderPictFormatError +} + +// Error definition RenderPicture (1) +// Size: 32 + +const BadRenderPicture = 1 + +type RenderPictureError struct { +	Sequence uint16 +	NiceName string +} + +// Error read RenderPicture +func NewRenderPictureError(buf []byte) Error { +	v := RenderPictureError{} +	v.NiceName = "RenderPicture" + +	b := 1 // skip error determinant +	b += 1 // don't read error number + +	v.Sequence = Get16(buf[b:]) +	b += 2 + +	return v +} + +func (err RenderPictureError) ImplementsError() {} + +func (err RenderPictureError) SequenceId() uint16 { +	return err.Sequence +} + +func (err RenderPictureError) BadId() Id { +	return 0 +} + +func (err RenderPictureError) Error() string { +	fieldVals := make([]string, 0, 0) +	fieldVals = append(fieldVals, "NiceName: "+err.NiceName) +	fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) +	return "BadRenderPicture {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { +	newErrorFuncs[1] = NewRenderPictureError +} + +// Error definition RenderPictOp (2) +// Size: 32 + +const BadRenderPictOp = 2 + +type RenderPictOpError struct { +	Sequence uint16 +	NiceName string +} + +// Error read RenderPictOp +func NewRenderPictOpError(buf []byte) Error { +	v := RenderPictOpError{} +	v.NiceName = "RenderPictOp" + +	b := 1 // skip error determinant +	b += 1 // don't read error number + +	v.Sequence = Get16(buf[b:]) +	b += 2 + +	return v +} + +func (err RenderPictOpError) ImplementsError() {} + +func (err RenderPictOpError) SequenceId() uint16 { +	return err.Sequence +} + +func (err RenderPictOpError) BadId() Id { +	return 0 +} + +func (err RenderPictOpError) Error() string { +	fieldVals := make([]string, 0, 0) +	fieldVals = append(fieldVals, "NiceName: "+err.NiceName) +	fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) +	return "BadRenderPictOp {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { +	newErrorFuncs[2] = NewRenderPictOpError +} + +// Error definition RenderGlyphSet (3) +// Size: 32 + +const BadRenderGlyphSet = 3 + +type RenderGlyphSetError struct { +	Sequence uint16 +	NiceName string +} + +// Error read RenderGlyphSet +func NewRenderGlyphSetError(buf []byte) Error { +	v := RenderGlyphSetError{} +	v.NiceName = "RenderGlyphSet" + +	b := 1 // skip error determinant +	b += 1 // don't read error number + +	v.Sequence = Get16(buf[b:]) +	b += 2 + +	return v +} + +func (err RenderGlyphSetError) ImplementsError() {} + +func (err RenderGlyphSetError) SequenceId() uint16 { +	return err.Sequence +} + +func (err RenderGlyphSetError) BadId() Id { +	return 0 +} + +func (err RenderGlyphSetError) Error() string { +	fieldVals := make([]string, 0, 0) +	fieldVals = append(fieldVals, "NiceName: "+err.NiceName) +	fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) +	return "BadRenderGlyphSet {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { +	newErrorFuncs[3] = NewRenderGlyphSetError +} + +// Error definition RenderGlyph (4) +// Size: 32 + +const BadRenderGlyph = 4 + +type RenderGlyphError struct { +	Sequence uint16 +	NiceName string +} + +// Error read RenderGlyph +func NewRenderGlyphError(buf []byte) Error { +	v := RenderGlyphError{} +	v.NiceName = "RenderGlyph" + +	b := 1 // skip error determinant +	b += 1 // don't read error number + +	v.Sequence = Get16(buf[b:]) +	b += 2 + +	return v +} + +func (err RenderGlyphError) ImplementsError() {} + +func (err RenderGlyphError) SequenceId() uint16 { +	return err.Sequence +} + +func (err RenderGlyphError) BadId() Id { +	return 0 +} + +func (err RenderGlyphError) Error() string { +	fieldVals := make([]string, 0, 0) +	fieldVals = append(fieldVals, "NiceName: "+err.NiceName) +	fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) +	return "BadRenderGlyph {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { +	newErrorFuncs[4] = NewRenderGlyphError +} + +// Request RenderQueryVersion +// size: 12 +type RenderQueryVersionCookie struct { +	*cookie +} + +func (c *Conn) RenderQueryVersion(ClientMajorVersion uint32, ClientMinorVersion uint32) RenderQueryVersionCookie { +	cookie := c.newCookie(true, true) +	c.newRequest(c.renderQueryVersionRequest(ClientMajorVersion, ClientMinorVersion), cookie) +	return RenderQueryVersionCookie{cookie} +} + +func (c *Conn) RenderQueryVersionUnchecked(ClientMajorVersion uint32, ClientMinorVersion uint32) RenderQueryVersionCookie { +	cookie := c.newCookie(false, true) +	c.newRequest(c.renderQueryVersionRequest(ClientMajorVersion, ClientMinorVersion), cookie) +	return RenderQueryVersionCookie{cookie} +} + +// Request reply for RenderQueryVersion +// size: 32 +type RenderQueryVersionReply struct { +	Sequence uint16 +	Length   uint32 +	// padding: 1 bytes +	MajorVersion uint32 +	MinorVersion uint32 +	// padding: 16 bytes +} + +// Waits and reads reply data from request RenderQueryVersion +func (cook RenderQueryVersionCookie) Reply() (*RenderQueryVersionReply, error) { +	buf, err := cook.reply() +	if err != nil { +		return nil, err +	} +	if buf == nil { +		return nil, nil +	} +	return renderQueryVersionReply(buf), nil +} + +// Read reply into structure from buffer for RenderQueryVersion +func renderQueryVersionReply(buf []byte) *RenderQueryVersionReply { +	v := new(RenderQueryVersionReply) +	b := 1 // skip reply determinant + +	b += 1 // padding + +	v.Sequence = Get16(buf[b:]) +	b += 2 + +	v.Length = Get32(buf[b:]) // 4-byte units +	b += 4 + +	v.MajorVersion = Get32(buf[b:]) +	b += 4 + +	v.MinorVersion = Get32(buf[b:]) +	b += 4 + +	b += 16 // padding + +	return v +} + +func (cook RenderQueryVersionCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RenderQueryVersion +func (c *Conn) renderQueryVersionRequest(ClientMajorVersion uint32, ClientMinorVersion uint32) []byte { +	size := 12 +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RENDER"] +	b += 1 + +	buf[b] = 0 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], ClientMajorVersion) +	b += 4 + +	Put32(buf[b:], ClientMinorVersion) +	b += 4 + +	return buf +} + +// Request RenderQueryPictFormats +// size: 4 +type RenderQueryPictFormatsCookie struct { +	*cookie +} + +func (c *Conn) RenderQueryPictFormats() RenderQueryPictFormatsCookie { +	cookie := c.newCookie(true, true) +	c.newRequest(c.renderQueryPictFormatsRequest(), cookie) +	return RenderQueryPictFormatsCookie{cookie} +} + +func (c *Conn) RenderQueryPictFormatsUnchecked() RenderQueryPictFormatsCookie { +	cookie := c.newCookie(false, true) +	c.newRequest(c.renderQueryPictFormatsRequest(), cookie) +	return RenderQueryPictFormatsCookie{cookie} +} + +// Request reply for RenderQueryPictFormats +// size: (((32 + pad((int(NumFormats) * 28))) + RenderPictscreenListSize(Screens)) + pad((int(NumSubpixel) * 4))) +type RenderQueryPictFormatsReply struct { +	Sequence uint16 +	Length   uint32 +	// padding: 1 bytes +	NumFormats  uint32 +	NumScreens  uint32 +	NumDepths   uint32 +	NumVisuals  uint32 +	NumSubpixel uint32 +	// padding: 4 bytes +	Formats   []RenderPictforminfo // size: pad((int(NumFormats) * 28)) +	Screens   []RenderPictscreen   // size: RenderPictscreenListSize(Screens) +	Subpixels []uint32             // size: pad((int(NumSubpixel) * 4)) +} + +// Waits and reads reply data from request RenderQueryPictFormats +func (cook RenderQueryPictFormatsCookie) Reply() (*RenderQueryPictFormatsReply, error) { +	buf, err := cook.reply() +	if err != nil { +		return nil, err +	} +	if buf == nil { +		return nil, nil +	} +	return renderQueryPictFormatsReply(buf), nil +} + +// Read reply into structure from buffer for RenderQueryPictFormats +func renderQueryPictFormatsReply(buf []byte) *RenderQueryPictFormatsReply { +	v := new(RenderQueryPictFormatsReply) +	b := 1 // skip reply determinant + +	b += 1 // padding + +	v.Sequence = Get16(buf[b:]) +	b += 2 + +	v.Length = Get32(buf[b:]) // 4-byte units +	b += 4 + +	v.NumFormats = Get32(buf[b:]) +	b += 4 + +	v.NumScreens = Get32(buf[b:]) +	b += 4 + +	v.NumDepths = Get32(buf[b:]) +	b += 4 + +	v.NumVisuals = Get32(buf[b:]) +	b += 4 + +	v.NumSubpixel = Get32(buf[b:]) +	b += 4 + +	b += 4 // padding + +	v.Formats = make([]RenderPictforminfo, v.NumFormats) +	b += ReadRenderPictforminfoList(buf[b:], v.Formats) + +	v.Screens = make([]RenderPictscreen, v.NumScreens) +	b += ReadRenderPictscreenList(buf[b:], v.Screens) + +	v.Subpixels = make([]uint32, v.NumSubpixel) +	for i := 0; i < int(v.NumSubpixel); i++ { +		v.Subpixels[i] = Get32(buf[b:]) +		b += 4 +	} +	b = pad(b) + +	return v +} + +func (cook RenderQueryPictFormatsCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RenderQueryPictFormats +func (c *Conn) renderQueryPictFormatsRequest() []byte { +	size := 4 +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RENDER"] +	b += 1 + +	buf[b] = 1 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	return buf +} + +// Request RenderQueryPictIndexValues +// size: 8 +type RenderQueryPictIndexValuesCookie struct { +	*cookie +} + +func (c *Conn) RenderQueryPictIndexValues(Format Id) RenderQueryPictIndexValuesCookie { +	cookie := c.newCookie(true, true) +	c.newRequest(c.renderQueryPictIndexValuesRequest(Format), cookie) +	return RenderQueryPictIndexValuesCookie{cookie} +} + +func (c *Conn) RenderQueryPictIndexValuesUnchecked(Format Id) RenderQueryPictIndexValuesCookie { +	cookie := c.newCookie(false, true) +	c.newRequest(c.renderQueryPictIndexValuesRequest(Format), cookie) +	return RenderQueryPictIndexValuesCookie{cookie} +} + +// Request reply for RenderQueryPictIndexValues +// size: (32 + pad((int(NumValues) * 12))) +type RenderQueryPictIndexValuesReply struct { +	Sequence uint16 +	Length   uint32 +	// padding: 1 bytes +	NumValues uint32 +	// padding: 20 bytes +	Values []RenderIndexvalue // size: pad((int(NumValues) * 12)) +} + +// Waits and reads reply data from request RenderQueryPictIndexValues +func (cook RenderQueryPictIndexValuesCookie) Reply() (*RenderQueryPictIndexValuesReply, error) { +	buf, err := cook.reply() +	if err != nil { +		return nil, err +	} +	if buf == nil { +		return nil, nil +	} +	return renderQueryPictIndexValuesReply(buf), nil +} + +// Read reply into structure from buffer for RenderQueryPictIndexValues +func renderQueryPictIndexValuesReply(buf []byte) *RenderQueryPictIndexValuesReply { +	v := new(RenderQueryPictIndexValuesReply) +	b := 1 // skip reply determinant + +	b += 1 // padding + +	v.Sequence = Get16(buf[b:]) +	b += 2 + +	v.Length = Get32(buf[b:]) // 4-byte units +	b += 4 + +	v.NumValues = Get32(buf[b:]) +	b += 4 + +	b += 20 // padding + +	v.Values = make([]RenderIndexvalue, v.NumValues) +	b += ReadRenderIndexvalueList(buf[b:], v.Values) + +	return v +} + +func (cook RenderQueryPictIndexValuesCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RenderQueryPictIndexValues +func (c *Conn) renderQueryPictIndexValuesRequest(Format Id) []byte { +	size := 8 +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RENDER"] +	b += 1 + +	buf[b] = 2 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Format)) +	b += 4 + +	return buf +} + +// Request RenderCreatePicture +// size: pad((16 + (4 + pad((4 * popCount(int(ValueMask))))))) +type RenderCreatePictureCookie struct { +	*cookie +} + +// Write request to wire for RenderCreatePicture +func (c *Conn) RenderCreatePicture(Pid Id, Drawable Id, Format Id, ValueMask uint32, ValueList []uint32) RenderCreatePictureCookie { +	cookie := c.newCookie(false, false) +	c.newRequest(c.renderCreatePictureRequest(Pid, Drawable, Format, ValueMask, ValueList), cookie) +	return RenderCreatePictureCookie{cookie} +} + +func (c *Conn) RenderCreatePictureChecked(Pid Id, Drawable Id, Format Id, ValueMask uint32, ValueList []uint32) RenderCreatePictureCookie { +	cookie := c.newCookie(true, false) +	c.newRequest(c.renderCreatePictureRequest(Pid, Drawable, Format, ValueMask, ValueList), cookie) +	return RenderCreatePictureCookie{cookie} +} + +func (cook RenderCreatePictureCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RenderCreatePicture +func (c *Conn) renderCreatePictureRequest(Pid Id, Drawable Id, Format Id, ValueMask uint32, ValueList []uint32) []byte { +	size := pad((16 + (4 + pad((4 * popCount(int(ValueMask))))))) +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RENDER"] +	b += 1 + +	buf[b] = 4 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Pid)) +	b += 4 + +	Put32(buf[b:], uint32(Drawable)) +	b += 4 + +	Put32(buf[b:], uint32(Format)) +	b += 4 + +	Put32(buf[b:], ValueMask) +	b += 4 +	for i := 0; i < popCount(int(ValueMask)); i++ { +		Put32(buf[b:], ValueList[i]) +		b += 4 +	} +	b = pad(b) + +	return buf +} + +// Request RenderChangePicture +// size: pad((8 + (4 + pad((4 * popCount(int(ValueMask))))))) +type RenderChangePictureCookie struct { +	*cookie +} + +// Write request to wire for RenderChangePicture +func (c *Conn) RenderChangePicture(Picture Id, ValueMask uint32, ValueList []uint32) RenderChangePictureCookie { +	cookie := c.newCookie(false, false) +	c.newRequest(c.renderChangePictureRequest(Picture, ValueMask, ValueList), cookie) +	return RenderChangePictureCookie{cookie} +} + +func (c *Conn) RenderChangePictureChecked(Picture Id, ValueMask uint32, ValueList []uint32) RenderChangePictureCookie { +	cookie := c.newCookie(true, false) +	c.newRequest(c.renderChangePictureRequest(Picture, ValueMask, ValueList), cookie) +	return RenderChangePictureCookie{cookie} +} + +func (cook RenderChangePictureCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RenderChangePicture +func (c *Conn) renderChangePictureRequest(Picture Id, ValueMask uint32, ValueList []uint32) []byte { +	size := pad((8 + (4 + pad((4 * popCount(int(ValueMask))))))) +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RENDER"] +	b += 1 + +	buf[b] = 5 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Picture)) +	b += 4 + +	Put32(buf[b:], ValueMask) +	b += 4 +	for i := 0; i < popCount(int(ValueMask)); i++ { +		Put32(buf[b:], ValueList[i]) +		b += 4 +	} +	b = pad(b) + +	return buf +} + +// Request RenderSetPictureClipRectangles +// size: pad((12 + pad((len(Rectangles) * 8)))) +type RenderSetPictureClipRectanglesCookie struct { +	*cookie +} + +// Write request to wire for RenderSetPictureClipRectangles +func (c *Conn) RenderSetPictureClipRectangles(Picture Id, ClipXOrigin int16, ClipYOrigin int16, Rectangles []Rectangle) RenderSetPictureClipRectanglesCookie { +	cookie := c.newCookie(false, false) +	c.newRequest(c.renderSetPictureClipRectanglesRequest(Picture, ClipXOrigin, ClipYOrigin, Rectangles), cookie) +	return RenderSetPictureClipRectanglesCookie{cookie} +} + +func (c *Conn) RenderSetPictureClipRectanglesChecked(Picture Id, ClipXOrigin int16, ClipYOrigin int16, Rectangles []Rectangle) RenderSetPictureClipRectanglesCookie { +	cookie := c.newCookie(true, false) +	c.newRequest(c.renderSetPictureClipRectanglesRequest(Picture, ClipXOrigin, ClipYOrigin, Rectangles), cookie) +	return RenderSetPictureClipRectanglesCookie{cookie} +} + +func (cook RenderSetPictureClipRectanglesCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RenderSetPictureClipRectangles +func (c *Conn) renderSetPictureClipRectanglesRequest(Picture Id, ClipXOrigin int16, ClipYOrigin int16, Rectangles []Rectangle) []byte { +	size := pad((12 + pad((len(Rectangles) * 8)))) +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RENDER"] +	b += 1 + +	buf[b] = 6 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Picture)) +	b += 4 + +	Put16(buf[b:], uint16(ClipXOrigin)) +	b += 2 + +	Put16(buf[b:], uint16(ClipYOrigin)) +	b += 2 + +	b += RectangleListBytes(buf[b:], Rectangles) + +	return buf +} + +// Request RenderFreePicture +// size: 8 +type RenderFreePictureCookie struct { +	*cookie +} + +// Write request to wire for RenderFreePicture +func (c *Conn) RenderFreePicture(Picture Id) RenderFreePictureCookie { +	cookie := c.newCookie(false, false) +	c.newRequest(c.renderFreePictureRequest(Picture), cookie) +	return RenderFreePictureCookie{cookie} +} + +func (c *Conn) RenderFreePictureChecked(Picture Id) RenderFreePictureCookie { +	cookie := c.newCookie(true, false) +	c.newRequest(c.renderFreePictureRequest(Picture), cookie) +	return RenderFreePictureCookie{cookie} +} + +func (cook RenderFreePictureCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RenderFreePicture +func (c *Conn) renderFreePictureRequest(Picture Id) []byte { +	size := 8 +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RENDER"] +	b += 1 + +	buf[b] = 7 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Picture)) +	b += 4 + +	return buf +} + +// Request RenderComposite +// size: 36 +type RenderCompositeCookie struct { +	*cookie +} + +// Write request to wire for RenderComposite +func (c *Conn) RenderComposite(Op byte, Src Id, Mask Id, Dst Id, SrcX int16, SrcY int16, MaskX int16, MaskY int16, DstX int16, DstY int16, Width uint16, Height uint16) RenderCompositeCookie { +	cookie := c.newCookie(false, false) +	c.newRequest(c.renderCompositeRequest(Op, Src, Mask, Dst, SrcX, SrcY, MaskX, MaskY, DstX, DstY, Width, Height), cookie) +	return RenderCompositeCookie{cookie} +} + +func (c *Conn) RenderCompositeChecked(Op byte, Src Id, Mask Id, Dst Id, SrcX int16, SrcY int16, MaskX int16, MaskY int16, DstX int16, DstY int16, Width uint16, Height uint16) RenderCompositeCookie { +	cookie := c.newCookie(true, false) +	c.newRequest(c.renderCompositeRequest(Op, Src, Mask, Dst, SrcX, SrcY, MaskX, MaskY, DstX, DstY, Width, Height), cookie) +	return RenderCompositeCookie{cookie} +} + +func (cook RenderCompositeCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RenderComposite +func (c *Conn) renderCompositeRequest(Op byte, Src Id, Mask Id, Dst Id, SrcX int16, SrcY int16, MaskX int16, MaskY int16, DstX int16, DstY int16, Width uint16, Height uint16) []byte { +	size := 36 +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RENDER"] +	b += 1 + +	buf[b] = 8 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	buf[b] = Op +	b += 1 + +	b += 3 // padding + +	Put32(buf[b:], uint32(Src)) +	b += 4 + +	Put32(buf[b:], uint32(Mask)) +	b += 4 + +	Put32(buf[b:], uint32(Dst)) +	b += 4 + +	Put16(buf[b:], uint16(SrcX)) +	b += 2 + +	Put16(buf[b:], uint16(SrcY)) +	b += 2 + +	Put16(buf[b:], uint16(MaskX)) +	b += 2 + +	Put16(buf[b:], uint16(MaskY)) +	b += 2 + +	Put16(buf[b:], uint16(DstX)) +	b += 2 + +	Put16(buf[b:], uint16(DstY)) +	b += 2 + +	Put16(buf[b:], Width) +	b += 2 + +	Put16(buf[b:], Height) +	b += 2 + +	return buf +} + +// Request RenderTrapezoids +// size: pad((24 + pad((len(Traps) * 40)))) +type RenderTrapezoidsCookie struct { +	*cookie +} + +// Write request to wire for RenderTrapezoids +func (c *Conn) RenderTrapezoids(Op byte, Src Id, Dst Id, MaskFormat Id, SrcX int16, SrcY int16, Traps []RenderTrapezoid) RenderTrapezoidsCookie { +	cookie := c.newCookie(false, false) +	c.newRequest(c.renderTrapezoidsRequest(Op, Src, Dst, MaskFormat, SrcX, SrcY, Traps), cookie) +	return RenderTrapezoidsCookie{cookie} +} + +func (c *Conn) RenderTrapezoidsChecked(Op byte, Src Id, Dst Id, MaskFormat Id, SrcX int16, SrcY int16, Traps []RenderTrapezoid) RenderTrapezoidsCookie { +	cookie := c.newCookie(true, false) +	c.newRequest(c.renderTrapezoidsRequest(Op, Src, Dst, MaskFormat, SrcX, SrcY, Traps), cookie) +	return RenderTrapezoidsCookie{cookie} +} + +func (cook RenderTrapezoidsCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RenderTrapezoids +func (c *Conn) renderTrapezoidsRequest(Op byte, Src Id, Dst Id, MaskFormat Id, SrcX int16, SrcY int16, Traps []RenderTrapezoid) []byte { +	size := pad((24 + pad((len(Traps) * 40)))) +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RENDER"] +	b += 1 + +	buf[b] = 10 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	buf[b] = Op +	b += 1 + +	b += 3 // padding + +	Put32(buf[b:], uint32(Src)) +	b += 4 + +	Put32(buf[b:], uint32(Dst)) +	b += 4 + +	Put32(buf[b:], uint32(MaskFormat)) +	b += 4 + +	Put16(buf[b:], uint16(SrcX)) +	b += 2 + +	Put16(buf[b:], uint16(SrcY)) +	b += 2 + +	b += RenderTrapezoidListBytes(buf[b:], Traps) + +	return buf +} + +// Request RenderTriangles +// size: pad((24 + pad((len(Triangles) * 24)))) +type RenderTrianglesCookie struct { +	*cookie +} + +// Write request to wire for RenderTriangles +func (c *Conn) RenderTriangles(Op byte, Src Id, Dst Id, MaskFormat Id, SrcX int16, SrcY int16, Triangles []RenderTriangle) RenderTrianglesCookie { +	cookie := c.newCookie(false, false) +	c.newRequest(c.renderTrianglesRequest(Op, Src, Dst, MaskFormat, SrcX, SrcY, Triangles), cookie) +	return RenderTrianglesCookie{cookie} +} + +func (c *Conn) RenderTrianglesChecked(Op byte, Src Id, Dst Id, MaskFormat Id, SrcX int16, SrcY int16, Triangles []RenderTriangle) RenderTrianglesCookie { +	cookie := c.newCookie(true, false) +	c.newRequest(c.renderTrianglesRequest(Op, Src, Dst, MaskFormat, SrcX, SrcY, Triangles), cookie) +	return RenderTrianglesCookie{cookie} +} + +func (cook RenderTrianglesCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RenderTriangles +func (c *Conn) renderTrianglesRequest(Op byte, Src Id, Dst Id, MaskFormat Id, SrcX int16, SrcY int16, Triangles []RenderTriangle) []byte { +	size := pad((24 + pad((len(Triangles) * 24)))) +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RENDER"] +	b += 1 + +	buf[b] = 11 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	buf[b] = Op +	b += 1 + +	b += 3 // padding + +	Put32(buf[b:], uint32(Src)) +	b += 4 + +	Put32(buf[b:], uint32(Dst)) +	b += 4 + +	Put32(buf[b:], uint32(MaskFormat)) +	b += 4 + +	Put16(buf[b:], uint16(SrcX)) +	b += 2 + +	Put16(buf[b:], uint16(SrcY)) +	b += 2 + +	b += RenderTriangleListBytes(buf[b:], Triangles) + +	return buf +} + +// Request RenderTriStrip +// size: pad((24 + pad((len(Points) * 8)))) +type RenderTriStripCookie struct { +	*cookie +} + +// Write request to wire for RenderTriStrip +func (c *Conn) RenderTriStrip(Op byte, Src Id, Dst Id, MaskFormat Id, SrcX int16, SrcY int16, Points []RenderPointfix) RenderTriStripCookie { +	cookie := c.newCookie(false, false) +	c.newRequest(c.renderTriStripRequest(Op, Src, Dst, MaskFormat, SrcX, SrcY, Points), cookie) +	return RenderTriStripCookie{cookie} +} + +func (c *Conn) RenderTriStripChecked(Op byte, Src Id, Dst Id, MaskFormat Id, SrcX int16, SrcY int16, Points []RenderPointfix) RenderTriStripCookie { +	cookie := c.newCookie(true, false) +	c.newRequest(c.renderTriStripRequest(Op, Src, Dst, MaskFormat, SrcX, SrcY, Points), cookie) +	return RenderTriStripCookie{cookie} +} + +func (cook RenderTriStripCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RenderTriStrip +func (c *Conn) renderTriStripRequest(Op byte, Src Id, Dst Id, MaskFormat Id, SrcX int16, SrcY int16, Points []RenderPointfix) []byte { +	size := pad((24 + pad((len(Points) * 8)))) +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RENDER"] +	b += 1 + +	buf[b] = 12 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	buf[b] = Op +	b += 1 + +	b += 3 // padding + +	Put32(buf[b:], uint32(Src)) +	b += 4 + +	Put32(buf[b:], uint32(Dst)) +	b += 4 + +	Put32(buf[b:], uint32(MaskFormat)) +	b += 4 + +	Put16(buf[b:], uint16(SrcX)) +	b += 2 + +	Put16(buf[b:], uint16(SrcY)) +	b += 2 + +	b += RenderPointfixListBytes(buf[b:], Points) + +	return buf +} + +// Request RenderTriFan +// size: pad((24 + pad((len(Points) * 8)))) +type RenderTriFanCookie struct { +	*cookie +} + +// Write request to wire for RenderTriFan +func (c *Conn) RenderTriFan(Op byte, Src Id, Dst Id, MaskFormat Id, SrcX int16, SrcY int16, Points []RenderPointfix) RenderTriFanCookie { +	cookie := c.newCookie(false, false) +	c.newRequest(c.renderTriFanRequest(Op, Src, Dst, MaskFormat, SrcX, SrcY, Points), cookie) +	return RenderTriFanCookie{cookie} +} + +func (c *Conn) RenderTriFanChecked(Op byte, Src Id, Dst Id, MaskFormat Id, SrcX int16, SrcY int16, Points []RenderPointfix) RenderTriFanCookie { +	cookie := c.newCookie(true, false) +	c.newRequest(c.renderTriFanRequest(Op, Src, Dst, MaskFormat, SrcX, SrcY, Points), cookie) +	return RenderTriFanCookie{cookie} +} + +func (cook RenderTriFanCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RenderTriFan +func (c *Conn) renderTriFanRequest(Op byte, Src Id, Dst Id, MaskFormat Id, SrcX int16, SrcY int16, Points []RenderPointfix) []byte { +	size := pad((24 + pad((len(Points) * 8)))) +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RENDER"] +	b += 1 + +	buf[b] = 13 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	buf[b] = Op +	b += 1 + +	b += 3 // padding + +	Put32(buf[b:], uint32(Src)) +	b += 4 + +	Put32(buf[b:], uint32(Dst)) +	b += 4 + +	Put32(buf[b:], uint32(MaskFormat)) +	b += 4 + +	Put16(buf[b:], uint16(SrcX)) +	b += 2 + +	Put16(buf[b:], uint16(SrcY)) +	b += 2 + +	b += RenderPointfixListBytes(buf[b:], Points) + +	return buf +} + +// Request RenderCreateGlyphSet +// size: 12 +type RenderCreateGlyphSetCookie struct { +	*cookie +} + +// Write request to wire for RenderCreateGlyphSet +func (c *Conn) RenderCreateGlyphSet(Gsid Id, Format Id) RenderCreateGlyphSetCookie { +	cookie := c.newCookie(false, false) +	c.newRequest(c.renderCreateGlyphSetRequest(Gsid, Format), cookie) +	return RenderCreateGlyphSetCookie{cookie} +} + +func (c *Conn) RenderCreateGlyphSetChecked(Gsid Id, Format Id) RenderCreateGlyphSetCookie { +	cookie := c.newCookie(true, false) +	c.newRequest(c.renderCreateGlyphSetRequest(Gsid, Format), cookie) +	return RenderCreateGlyphSetCookie{cookie} +} + +func (cook RenderCreateGlyphSetCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RenderCreateGlyphSet +func (c *Conn) renderCreateGlyphSetRequest(Gsid Id, Format Id) []byte { +	size := 12 +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RENDER"] +	b += 1 + +	buf[b] = 17 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Gsid)) +	b += 4 + +	Put32(buf[b:], uint32(Format)) +	b += 4 + +	return buf +} + +// Request RenderReferenceGlyphSet +// size: 12 +type RenderReferenceGlyphSetCookie struct { +	*cookie +} + +// Write request to wire for RenderReferenceGlyphSet +func (c *Conn) RenderReferenceGlyphSet(Gsid Id, Existing Id) RenderReferenceGlyphSetCookie { +	cookie := c.newCookie(false, false) +	c.newRequest(c.renderReferenceGlyphSetRequest(Gsid, Existing), cookie) +	return RenderReferenceGlyphSetCookie{cookie} +} + +func (c *Conn) RenderReferenceGlyphSetChecked(Gsid Id, Existing Id) RenderReferenceGlyphSetCookie { +	cookie := c.newCookie(true, false) +	c.newRequest(c.renderReferenceGlyphSetRequest(Gsid, Existing), cookie) +	return RenderReferenceGlyphSetCookie{cookie} +} + +func (cook RenderReferenceGlyphSetCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RenderReferenceGlyphSet +func (c *Conn) renderReferenceGlyphSetRequest(Gsid Id, Existing Id) []byte { +	size := 12 +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RENDER"] +	b += 1 + +	buf[b] = 18 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Gsid)) +	b += 4 + +	Put32(buf[b:], uint32(Existing)) +	b += 4 + +	return buf +} + +// Request RenderFreeGlyphSet +// size: 8 +type RenderFreeGlyphSetCookie struct { +	*cookie +} + +// Write request to wire for RenderFreeGlyphSet +func (c *Conn) RenderFreeGlyphSet(Glyphset Id) RenderFreeGlyphSetCookie { +	cookie := c.newCookie(false, false) +	c.newRequest(c.renderFreeGlyphSetRequest(Glyphset), cookie) +	return RenderFreeGlyphSetCookie{cookie} +} + +func (c *Conn) RenderFreeGlyphSetChecked(Glyphset Id) RenderFreeGlyphSetCookie { +	cookie := c.newCookie(true, false) +	c.newRequest(c.renderFreeGlyphSetRequest(Glyphset), cookie) +	return RenderFreeGlyphSetCookie{cookie} +} + +func (cook RenderFreeGlyphSetCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RenderFreeGlyphSet +func (c *Conn) renderFreeGlyphSetRequest(Glyphset Id) []byte { +	size := 8 +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RENDER"] +	b += 1 + +	buf[b] = 19 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Glyphset)) +	b += 4 + +	return buf +} + +// Request RenderAddGlyphs +// size: pad((((12 + pad((int(GlyphsLen) * 4))) + pad((int(GlyphsLen) * 12))) + pad((len(Data) * 1)))) +type RenderAddGlyphsCookie struct { +	*cookie +} + +// Write request to wire for RenderAddGlyphs +func (c *Conn) RenderAddGlyphs(Glyphset Id, GlyphsLen uint32, Glyphids []uint32, Glyphs []RenderGlyphinfo, Data []byte) RenderAddGlyphsCookie { +	cookie := c.newCookie(false, false) +	c.newRequest(c.renderAddGlyphsRequest(Glyphset, GlyphsLen, Glyphids, Glyphs, Data), cookie) +	return RenderAddGlyphsCookie{cookie} +} + +func (c *Conn) RenderAddGlyphsChecked(Glyphset Id, GlyphsLen uint32, Glyphids []uint32, Glyphs []RenderGlyphinfo, Data []byte) RenderAddGlyphsCookie { +	cookie := c.newCookie(true, false) +	c.newRequest(c.renderAddGlyphsRequest(Glyphset, GlyphsLen, Glyphids, Glyphs, Data), cookie) +	return RenderAddGlyphsCookie{cookie} +} + +func (cook RenderAddGlyphsCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RenderAddGlyphs +func (c *Conn) renderAddGlyphsRequest(Glyphset Id, GlyphsLen uint32, Glyphids []uint32, Glyphs []RenderGlyphinfo, Data []byte) []byte { +	size := pad((((12 + pad((int(GlyphsLen) * 4))) + pad((int(GlyphsLen) * 12))) + pad((len(Data) * 1)))) +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RENDER"] +	b += 1 + +	buf[b] = 20 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Glyphset)) +	b += 4 + +	Put32(buf[b:], GlyphsLen) +	b += 4 + +	for i := 0; i < int(GlyphsLen); i++ { +		Put32(buf[b:], Glyphids[i]) +		b += 4 +	} +	b = pad(b) + +	b += RenderGlyphinfoListBytes(buf[b:], Glyphs) + +	copy(buf[b:], Data[:len(Data)]) +	b += pad(int(len(Data))) + +	return buf +} + +// Request RenderFreeGlyphs +// size: pad((8 + pad((len(Glyphs) * 4)))) +type RenderFreeGlyphsCookie struct { +	*cookie +} + +// Write request to wire for RenderFreeGlyphs +func (c *Conn) RenderFreeGlyphs(Glyphset Id, Glyphs []RenderGlyph) RenderFreeGlyphsCookie { +	cookie := c.newCookie(false, false) +	c.newRequest(c.renderFreeGlyphsRequest(Glyphset, Glyphs), cookie) +	return RenderFreeGlyphsCookie{cookie} +} + +func (c *Conn) RenderFreeGlyphsChecked(Glyphset Id, Glyphs []RenderGlyph) RenderFreeGlyphsCookie { +	cookie := c.newCookie(true, false) +	c.newRequest(c.renderFreeGlyphsRequest(Glyphset, Glyphs), cookie) +	return RenderFreeGlyphsCookie{cookie} +} + +func (cook RenderFreeGlyphsCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RenderFreeGlyphs +func (c *Conn) renderFreeGlyphsRequest(Glyphset Id, Glyphs []RenderGlyph) []byte { +	size := pad((8 + pad((len(Glyphs) * 4)))) +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RENDER"] +	b += 1 + +	buf[b] = 22 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Glyphset)) +	b += 4 + +	for i := 0; i < int(len(Glyphs)); i++ { +		Put32(buf[b:], uint32(Glyphs[i])) +		b += 4 +	} +	b = pad(b) + +	return buf +} + +// Request RenderCompositeGlyphs8 +// size: pad((28 + pad((len(Glyphcmds) * 1)))) +type RenderCompositeGlyphs8Cookie struct { +	*cookie +} + +// Write request to wire for RenderCompositeGlyphs8 +func (c *Conn) RenderCompositeGlyphs8(Op byte, Src Id, Dst Id, MaskFormat Id, Glyphset Id, SrcX int16, SrcY int16, Glyphcmds []byte) RenderCompositeGlyphs8Cookie { +	cookie := c.newCookie(false, false) +	c.newRequest(c.renderCompositeGlyphs8Request(Op, Src, Dst, MaskFormat, Glyphset, SrcX, SrcY, Glyphcmds), cookie) +	return RenderCompositeGlyphs8Cookie{cookie} +} + +func (c *Conn) RenderCompositeGlyphs8Checked(Op byte, Src Id, Dst Id, MaskFormat Id, Glyphset Id, SrcX int16, SrcY int16, Glyphcmds []byte) RenderCompositeGlyphs8Cookie { +	cookie := c.newCookie(true, false) +	c.newRequest(c.renderCompositeGlyphs8Request(Op, Src, Dst, MaskFormat, Glyphset, SrcX, SrcY, Glyphcmds), cookie) +	return RenderCompositeGlyphs8Cookie{cookie} +} + +func (cook RenderCompositeGlyphs8Cookie) Check() error { +	return cook.check() +} + +// Write request to wire for RenderCompositeGlyphs8 +func (c *Conn) renderCompositeGlyphs8Request(Op byte, Src Id, Dst Id, MaskFormat Id, Glyphset Id, SrcX int16, SrcY int16, Glyphcmds []byte) []byte { +	size := pad((28 + pad((len(Glyphcmds) * 1)))) +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RENDER"] +	b += 1 + +	buf[b] = 23 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	buf[b] = Op +	b += 1 + +	b += 3 // padding + +	Put32(buf[b:], uint32(Src)) +	b += 4 + +	Put32(buf[b:], uint32(Dst)) +	b += 4 + +	Put32(buf[b:], uint32(MaskFormat)) +	b += 4 + +	Put32(buf[b:], uint32(Glyphset)) +	b += 4 + +	Put16(buf[b:], uint16(SrcX)) +	b += 2 + +	Put16(buf[b:], uint16(SrcY)) +	b += 2 + +	copy(buf[b:], Glyphcmds[:len(Glyphcmds)]) +	b += pad(int(len(Glyphcmds))) + +	return buf +} + +// Request RenderCompositeGlyphs16 +// size: pad((28 + pad((len(Glyphcmds) * 1)))) +type RenderCompositeGlyphs16Cookie struct { +	*cookie +} + +// Write request to wire for RenderCompositeGlyphs16 +func (c *Conn) RenderCompositeGlyphs16(Op byte, Src Id, Dst Id, MaskFormat Id, Glyphset Id, SrcX int16, SrcY int16, Glyphcmds []byte) RenderCompositeGlyphs16Cookie { +	cookie := c.newCookie(false, false) +	c.newRequest(c.renderCompositeGlyphs16Request(Op, Src, Dst, MaskFormat, Glyphset, SrcX, SrcY, Glyphcmds), cookie) +	return RenderCompositeGlyphs16Cookie{cookie} +} + +func (c *Conn) RenderCompositeGlyphs16Checked(Op byte, Src Id, Dst Id, MaskFormat Id, Glyphset Id, SrcX int16, SrcY int16, Glyphcmds []byte) RenderCompositeGlyphs16Cookie { +	cookie := c.newCookie(true, false) +	c.newRequest(c.renderCompositeGlyphs16Request(Op, Src, Dst, MaskFormat, Glyphset, SrcX, SrcY, Glyphcmds), cookie) +	return RenderCompositeGlyphs16Cookie{cookie} +} + +func (cook RenderCompositeGlyphs16Cookie) Check() error { +	return cook.check() +} + +// Write request to wire for RenderCompositeGlyphs16 +func (c *Conn) renderCompositeGlyphs16Request(Op byte, Src Id, Dst Id, MaskFormat Id, Glyphset Id, SrcX int16, SrcY int16, Glyphcmds []byte) []byte { +	size := pad((28 + pad((len(Glyphcmds) * 1)))) +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RENDER"] +	b += 1 + +	buf[b] = 24 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	buf[b] = Op +	b += 1 + +	b += 3 // padding + +	Put32(buf[b:], uint32(Src)) +	b += 4 + +	Put32(buf[b:], uint32(Dst)) +	b += 4 + +	Put32(buf[b:], uint32(MaskFormat)) +	b += 4 + +	Put32(buf[b:], uint32(Glyphset)) +	b += 4 + +	Put16(buf[b:], uint16(SrcX)) +	b += 2 + +	Put16(buf[b:], uint16(SrcY)) +	b += 2 + +	copy(buf[b:], Glyphcmds[:len(Glyphcmds)]) +	b += pad(int(len(Glyphcmds))) + +	return buf +} + +// Request RenderCompositeGlyphs32 +// size: pad((28 + pad((len(Glyphcmds) * 1)))) +type RenderCompositeGlyphs32Cookie struct { +	*cookie +} + +// Write request to wire for RenderCompositeGlyphs32 +func (c *Conn) RenderCompositeGlyphs32(Op byte, Src Id, Dst Id, MaskFormat Id, Glyphset Id, SrcX int16, SrcY int16, Glyphcmds []byte) RenderCompositeGlyphs32Cookie { +	cookie := c.newCookie(false, false) +	c.newRequest(c.renderCompositeGlyphs32Request(Op, Src, Dst, MaskFormat, Glyphset, SrcX, SrcY, Glyphcmds), cookie) +	return RenderCompositeGlyphs32Cookie{cookie} +} + +func (c *Conn) RenderCompositeGlyphs32Checked(Op byte, Src Id, Dst Id, MaskFormat Id, Glyphset Id, SrcX int16, SrcY int16, Glyphcmds []byte) RenderCompositeGlyphs32Cookie { +	cookie := c.newCookie(true, false) +	c.newRequest(c.renderCompositeGlyphs32Request(Op, Src, Dst, MaskFormat, Glyphset, SrcX, SrcY, Glyphcmds), cookie) +	return RenderCompositeGlyphs32Cookie{cookie} +} + +func (cook RenderCompositeGlyphs32Cookie) Check() error { +	return cook.check() +} + +// Write request to wire for RenderCompositeGlyphs32 +func (c *Conn) renderCompositeGlyphs32Request(Op byte, Src Id, Dst Id, MaskFormat Id, Glyphset Id, SrcX int16, SrcY int16, Glyphcmds []byte) []byte { +	size := pad((28 + pad((len(Glyphcmds) * 1)))) +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RENDER"] +	b += 1 + +	buf[b] = 25 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	buf[b] = Op +	b += 1 + +	b += 3 // padding + +	Put32(buf[b:], uint32(Src)) +	b += 4 + +	Put32(buf[b:], uint32(Dst)) +	b += 4 + +	Put32(buf[b:], uint32(MaskFormat)) +	b += 4 + +	Put32(buf[b:], uint32(Glyphset)) +	b += 4 + +	Put16(buf[b:], uint16(SrcX)) +	b += 2 + +	Put16(buf[b:], uint16(SrcY)) +	b += 2 + +	copy(buf[b:], Glyphcmds[:len(Glyphcmds)]) +	b += pad(int(len(Glyphcmds))) + +	return buf +} + +// Request RenderFillRectangles +// size: pad((20 + pad((len(Rects) * 8)))) +type RenderFillRectanglesCookie struct { +	*cookie +} + +// Write request to wire for RenderFillRectangles +func (c *Conn) RenderFillRectangles(Op byte, Dst Id, Color RenderColor, Rects []Rectangle) RenderFillRectanglesCookie { +	cookie := c.newCookie(false, false) +	c.newRequest(c.renderFillRectanglesRequest(Op, Dst, Color, Rects), cookie) +	return RenderFillRectanglesCookie{cookie} +} + +func (c *Conn) RenderFillRectanglesChecked(Op byte, Dst Id, Color RenderColor, Rects []Rectangle) RenderFillRectanglesCookie { +	cookie := c.newCookie(true, false) +	c.newRequest(c.renderFillRectanglesRequest(Op, Dst, Color, Rects), cookie) +	return RenderFillRectanglesCookie{cookie} +} + +func (cook RenderFillRectanglesCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RenderFillRectangles +func (c *Conn) renderFillRectanglesRequest(Op byte, Dst Id, Color RenderColor, Rects []Rectangle) []byte { +	size := pad((20 + pad((len(Rects) * 8)))) +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RENDER"] +	b += 1 + +	buf[b] = 26 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	buf[b] = Op +	b += 1 + +	b += 3 // padding + +	Put32(buf[b:], uint32(Dst)) +	b += 4 + +	{ +		structBytes := Color.Bytes() +		copy(buf[b:], structBytes) +		b += pad(len(structBytes)) +	} + +	b += RectangleListBytes(buf[b:], Rects) + +	return buf +} + +// Request RenderCreateCursor +// size: 16 +type RenderCreateCursorCookie struct { +	*cookie +} + +// Write request to wire for RenderCreateCursor +func (c *Conn) RenderCreateCursor(Cid Id, Source Id, X uint16, Y uint16) RenderCreateCursorCookie { +	cookie := c.newCookie(false, false) +	c.newRequest(c.renderCreateCursorRequest(Cid, Source, X, Y), cookie) +	return RenderCreateCursorCookie{cookie} +} + +func (c *Conn) RenderCreateCursorChecked(Cid Id, Source Id, X uint16, Y uint16) RenderCreateCursorCookie { +	cookie := c.newCookie(true, false) +	c.newRequest(c.renderCreateCursorRequest(Cid, Source, X, Y), cookie) +	return RenderCreateCursorCookie{cookie} +} + +func (cook RenderCreateCursorCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RenderCreateCursor +func (c *Conn) renderCreateCursorRequest(Cid Id, Source Id, X uint16, Y uint16) []byte { +	size := 16 +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RENDER"] +	b += 1 + +	buf[b] = 27 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Cid)) +	b += 4 + +	Put32(buf[b:], uint32(Source)) +	b += 4 + +	Put16(buf[b:], X) +	b += 2 + +	Put16(buf[b:], Y) +	b += 2 + +	return buf +} + +// Request RenderSetPictureTransform +// size: 44 +type RenderSetPictureTransformCookie struct { +	*cookie +} + +// Write request to wire for RenderSetPictureTransform +func (c *Conn) RenderSetPictureTransform(Picture Id, Transform RenderTransform) RenderSetPictureTransformCookie { +	cookie := c.newCookie(false, false) +	c.newRequest(c.renderSetPictureTransformRequest(Picture, Transform), cookie) +	return RenderSetPictureTransformCookie{cookie} +} + +func (c *Conn) RenderSetPictureTransformChecked(Picture Id, Transform RenderTransform) RenderSetPictureTransformCookie { +	cookie := c.newCookie(true, false) +	c.newRequest(c.renderSetPictureTransformRequest(Picture, Transform), cookie) +	return RenderSetPictureTransformCookie{cookie} +} + +func (cook RenderSetPictureTransformCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RenderSetPictureTransform +func (c *Conn) renderSetPictureTransformRequest(Picture Id, Transform RenderTransform) []byte { +	size := 44 +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RENDER"] +	b += 1 + +	buf[b] = 28 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Picture)) +	b += 4 + +	{ +		structBytes := Transform.Bytes() +		copy(buf[b:], structBytes) +		b += pad(len(structBytes)) +	} + +	return buf +} + +// Request RenderQueryFilters +// size: 8 +type RenderQueryFiltersCookie struct { +	*cookie +} + +func (c *Conn) RenderQueryFilters(Drawable Id) RenderQueryFiltersCookie { +	cookie := c.newCookie(true, true) +	c.newRequest(c.renderQueryFiltersRequest(Drawable), cookie) +	return RenderQueryFiltersCookie{cookie} +} + +func (c *Conn) RenderQueryFiltersUnchecked(Drawable Id) RenderQueryFiltersCookie { +	cookie := c.newCookie(false, true) +	c.newRequest(c.renderQueryFiltersRequest(Drawable), cookie) +	return RenderQueryFiltersCookie{cookie} +} + +// Request reply for RenderQueryFilters +// size: ((32 + pad((int(NumAliases) * 2))) + StrListSize(Filters)) +type RenderQueryFiltersReply struct { +	Sequence uint16 +	Length   uint32 +	// padding: 1 bytes +	NumAliases uint32 +	NumFilters uint32 +	// padding: 16 bytes +	Aliases []uint16 // size: pad((int(NumAliases) * 2)) +	Filters []Str    // size: StrListSize(Filters) +} + +// Waits and reads reply data from request RenderQueryFilters +func (cook RenderQueryFiltersCookie) Reply() (*RenderQueryFiltersReply, error) { +	buf, err := cook.reply() +	if err != nil { +		return nil, err +	} +	if buf == nil { +		return nil, nil +	} +	return renderQueryFiltersReply(buf), nil +} + +// Read reply into structure from buffer for RenderQueryFilters +func renderQueryFiltersReply(buf []byte) *RenderQueryFiltersReply { +	v := new(RenderQueryFiltersReply) +	b := 1 // skip reply determinant + +	b += 1 // padding + +	v.Sequence = Get16(buf[b:]) +	b += 2 + +	v.Length = Get32(buf[b:]) // 4-byte units +	b += 4 + +	v.NumAliases = Get32(buf[b:]) +	b += 4 + +	v.NumFilters = Get32(buf[b:]) +	b += 4 + +	b += 16 // padding + +	v.Aliases = make([]uint16, v.NumAliases) +	for i := 0; i < int(v.NumAliases); i++ { +		v.Aliases[i] = Get16(buf[b:]) +		b += 2 +	} +	b = pad(b) + +	v.Filters = make([]Str, v.NumFilters) +	b += ReadStrList(buf[b:], v.Filters) + +	return v +} + +func (cook RenderQueryFiltersCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RenderQueryFilters +func (c *Conn) renderQueryFiltersRequest(Drawable Id) []byte { +	size := 8 +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RENDER"] +	b += 1 + +	buf[b] = 29 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Drawable)) +	b += 4 + +	return buf +} + +// Request RenderSetPictureFilter +// size: pad(((12 + pad((int(FilterLen) * 1))) + pad((len(Values) * 4)))) +type RenderSetPictureFilterCookie struct { +	*cookie +} + +// Write request to wire for RenderSetPictureFilter +func (c *Conn) RenderSetPictureFilter(Picture Id, FilterLen uint16, Filter string, Values []RenderFixed) RenderSetPictureFilterCookie { +	cookie := c.newCookie(false, false) +	c.newRequest(c.renderSetPictureFilterRequest(Picture, FilterLen, Filter, Values), cookie) +	return RenderSetPictureFilterCookie{cookie} +} + +func (c *Conn) RenderSetPictureFilterChecked(Picture Id, FilterLen uint16, Filter string, Values []RenderFixed) RenderSetPictureFilterCookie { +	cookie := c.newCookie(true, false) +	c.newRequest(c.renderSetPictureFilterRequest(Picture, FilterLen, Filter, Values), cookie) +	return RenderSetPictureFilterCookie{cookie} +} + +func (cook RenderSetPictureFilterCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RenderSetPictureFilter +func (c *Conn) renderSetPictureFilterRequest(Picture Id, FilterLen uint16, Filter string, Values []RenderFixed) []byte { +	size := pad(((12 + pad((int(FilterLen) * 1))) + pad((len(Values) * 4)))) +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RENDER"] +	b += 1 + +	buf[b] = 30 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Picture)) +	b += 4 + +	Put16(buf[b:], FilterLen) +	b += 2 + +	b += 2 // padding + +	copy(buf[b:], Filter[:FilterLen]) +	b += pad(int(FilterLen)) + +	for i := 0; i < int(len(Values)); i++ { +		Put32(buf[b:], uint32(Values[i])) +		b += 4 +	} +	b = pad(b) + +	return buf +} + +// Request RenderCreateAnimCursor +// size: pad((8 + pad((len(Cursors) * 8)))) +type RenderCreateAnimCursorCookie struct { +	*cookie +} + +// Write request to wire for RenderCreateAnimCursor +func (c *Conn) RenderCreateAnimCursor(Cid Id, Cursors []RenderAnimcursorelt) RenderCreateAnimCursorCookie { +	cookie := c.newCookie(false, false) +	c.newRequest(c.renderCreateAnimCursorRequest(Cid, Cursors), cookie) +	return RenderCreateAnimCursorCookie{cookie} +} + +func (c *Conn) RenderCreateAnimCursorChecked(Cid Id, Cursors []RenderAnimcursorelt) RenderCreateAnimCursorCookie { +	cookie := c.newCookie(true, false) +	c.newRequest(c.renderCreateAnimCursorRequest(Cid, Cursors), cookie) +	return RenderCreateAnimCursorCookie{cookie} +} + +func (cook RenderCreateAnimCursorCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RenderCreateAnimCursor +func (c *Conn) renderCreateAnimCursorRequest(Cid Id, Cursors []RenderAnimcursorelt) []byte { +	size := pad((8 + pad((len(Cursors) * 8)))) +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RENDER"] +	b += 1 + +	buf[b] = 31 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Cid)) +	b += 4 + +	b += RenderAnimcursoreltListBytes(buf[b:], Cursors) + +	return buf +} + +// Request RenderAddTraps +// size: pad((12 + pad((len(Traps) * 24)))) +type RenderAddTrapsCookie struct { +	*cookie +} + +// Write request to wire for RenderAddTraps +func (c *Conn) RenderAddTraps(Picture Id, XOff int16, YOff int16, Traps []RenderTrap) RenderAddTrapsCookie { +	cookie := c.newCookie(false, false) +	c.newRequest(c.renderAddTrapsRequest(Picture, XOff, YOff, Traps), cookie) +	return RenderAddTrapsCookie{cookie} +} + +func (c *Conn) RenderAddTrapsChecked(Picture Id, XOff int16, YOff int16, Traps []RenderTrap) RenderAddTrapsCookie { +	cookie := c.newCookie(true, false) +	c.newRequest(c.renderAddTrapsRequest(Picture, XOff, YOff, Traps), cookie) +	return RenderAddTrapsCookie{cookie} +} + +func (cook RenderAddTrapsCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RenderAddTraps +func (c *Conn) renderAddTrapsRequest(Picture Id, XOff int16, YOff int16, Traps []RenderTrap) []byte { +	size := pad((12 + pad((len(Traps) * 24)))) +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RENDER"] +	b += 1 + +	buf[b] = 32 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Picture)) +	b += 4 + +	Put16(buf[b:], uint16(XOff)) +	b += 2 + +	Put16(buf[b:], uint16(YOff)) +	b += 2 + +	b += RenderTrapListBytes(buf[b:], Traps) + +	return buf +} + +// Request RenderCreateSolidFill +// size: 16 +type RenderCreateSolidFillCookie struct { +	*cookie +} + +// Write request to wire for RenderCreateSolidFill +func (c *Conn) RenderCreateSolidFill(Picture Id, Color RenderColor) RenderCreateSolidFillCookie { +	cookie := c.newCookie(false, false) +	c.newRequest(c.renderCreateSolidFillRequest(Picture, Color), cookie) +	return RenderCreateSolidFillCookie{cookie} +} + +func (c *Conn) RenderCreateSolidFillChecked(Picture Id, Color RenderColor) RenderCreateSolidFillCookie { +	cookie := c.newCookie(true, false) +	c.newRequest(c.renderCreateSolidFillRequest(Picture, Color), cookie) +	return RenderCreateSolidFillCookie{cookie} +} + +func (cook RenderCreateSolidFillCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RenderCreateSolidFill +func (c *Conn) renderCreateSolidFillRequest(Picture Id, Color RenderColor) []byte { +	size := 16 +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RENDER"] +	b += 1 + +	buf[b] = 33 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Picture)) +	b += 4 + +	{ +		structBytes := Color.Bytes() +		copy(buf[b:], structBytes) +		b += pad(len(structBytes)) +	} + +	return buf +} + +// Request RenderCreateLinearGradient +// size: pad(((28 + pad((int(NumStops) * 4))) + pad((int(NumStops) * 8)))) +type RenderCreateLinearGradientCookie struct { +	*cookie +} + +// Write request to wire for RenderCreateLinearGradient +func (c *Conn) RenderCreateLinearGradient(Picture Id, P1 RenderPointfix, P2 RenderPointfix, NumStops uint32, Stops []RenderFixed, Colors []RenderColor) RenderCreateLinearGradientCookie { +	cookie := c.newCookie(false, false) +	c.newRequest(c.renderCreateLinearGradientRequest(Picture, P1, P2, NumStops, Stops, Colors), cookie) +	return RenderCreateLinearGradientCookie{cookie} +} + +func (c *Conn) RenderCreateLinearGradientChecked(Picture Id, P1 RenderPointfix, P2 RenderPointfix, NumStops uint32, Stops []RenderFixed, Colors []RenderColor) RenderCreateLinearGradientCookie { +	cookie := c.newCookie(true, false) +	c.newRequest(c.renderCreateLinearGradientRequest(Picture, P1, P2, NumStops, Stops, Colors), cookie) +	return RenderCreateLinearGradientCookie{cookie} +} + +func (cook RenderCreateLinearGradientCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RenderCreateLinearGradient +func (c *Conn) renderCreateLinearGradientRequest(Picture Id, P1 RenderPointfix, P2 RenderPointfix, NumStops uint32, Stops []RenderFixed, Colors []RenderColor) []byte { +	size := pad(((28 + pad((int(NumStops) * 4))) + pad((int(NumStops) * 8)))) +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RENDER"] +	b += 1 + +	buf[b] = 34 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Picture)) +	b += 4 + +	{ +		structBytes := P1.Bytes() +		copy(buf[b:], structBytes) +		b += pad(len(structBytes)) +	} + +	{ +		structBytes := P2.Bytes() +		copy(buf[b:], structBytes) +		b += pad(len(structBytes)) +	} + +	Put32(buf[b:], NumStops) +	b += 4 + +	for i := 0; i < int(NumStops); i++ { +		Put32(buf[b:], uint32(Stops[i])) +		b += 4 +	} +	b = pad(b) + +	b += RenderColorListBytes(buf[b:], Colors) + +	return buf +} + +// Request RenderCreateRadialGradient +// size: pad(((36 + pad((int(NumStops) * 4))) + pad((int(NumStops) * 8)))) +type RenderCreateRadialGradientCookie struct { +	*cookie +} + +// Write request to wire for RenderCreateRadialGradient +func (c *Conn) RenderCreateRadialGradient(Picture Id, Inner RenderPointfix, Outer RenderPointfix, InnerRadius RenderFixed, OuterRadius RenderFixed, NumStops uint32, Stops []RenderFixed, Colors []RenderColor) RenderCreateRadialGradientCookie { +	cookie := c.newCookie(false, false) +	c.newRequest(c.renderCreateRadialGradientRequest(Picture, Inner, Outer, InnerRadius, OuterRadius, NumStops, Stops, Colors), cookie) +	return RenderCreateRadialGradientCookie{cookie} +} + +func (c *Conn) RenderCreateRadialGradientChecked(Picture Id, Inner RenderPointfix, Outer RenderPointfix, InnerRadius RenderFixed, OuterRadius RenderFixed, NumStops uint32, Stops []RenderFixed, Colors []RenderColor) RenderCreateRadialGradientCookie { +	cookie := c.newCookie(true, false) +	c.newRequest(c.renderCreateRadialGradientRequest(Picture, Inner, Outer, InnerRadius, OuterRadius, NumStops, Stops, Colors), cookie) +	return RenderCreateRadialGradientCookie{cookie} +} + +func (cook RenderCreateRadialGradientCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RenderCreateRadialGradient +func (c *Conn) renderCreateRadialGradientRequest(Picture Id, Inner RenderPointfix, Outer RenderPointfix, InnerRadius RenderFixed, OuterRadius RenderFixed, NumStops uint32, Stops []RenderFixed, Colors []RenderColor) []byte { +	size := pad(((36 + pad((int(NumStops) * 4))) + pad((int(NumStops) * 8)))) +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RENDER"] +	b += 1 + +	buf[b] = 35 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Picture)) +	b += 4 + +	{ +		structBytes := Inner.Bytes() +		copy(buf[b:], structBytes) +		b += pad(len(structBytes)) +	} + +	{ +		structBytes := Outer.Bytes() +		copy(buf[b:], structBytes) +		b += pad(len(structBytes)) +	} + +	Put32(buf[b:], uint32(InnerRadius)) +	b += 4 + +	Put32(buf[b:], uint32(OuterRadius)) +	b += 4 + +	Put32(buf[b:], NumStops) +	b += 4 + +	for i := 0; i < int(NumStops); i++ { +		Put32(buf[b:], uint32(Stops[i])) +		b += 4 +	} +	b = pad(b) + +	b += RenderColorListBytes(buf[b:], Colors) + +	return buf +} + +// Request RenderCreateConicalGradient +// size: pad(((24 + pad((int(NumStops) * 4))) + pad((int(NumStops) * 8)))) +type RenderCreateConicalGradientCookie struct { +	*cookie +} + +// Write request to wire for RenderCreateConicalGradient +func (c *Conn) RenderCreateConicalGradient(Picture Id, Center RenderPointfix, Angle RenderFixed, NumStops uint32, Stops []RenderFixed, Colors []RenderColor) RenderCreateConicalGradientCookie { +	cookie := c.newCookie(false, false) +	c.newRequest(c.renderCreateConicalGradientRequest(Picture, Center, Angle, NumStops, Stops, Colors), cookie) +	return RenderCreateConicalGradientCookie{cookie} +} + +func (c *Conn) RenderCreateConicalGradientChecked(Picture Id, Center RenderPointfix, Angle RenderFixed, NumStops uint32, Stops []RenderFixed, Colors []RenderColor) RenderCreateConicalGradientCookie { +	cookie := c.newCookie(true, false) +	c.newRequest(c.renderCreateConicalGradientRequest(Picture, Center, Angle, NumStops, Stops, Colors), cookie) +	return RenderCreateConicalGradientCookie{cookie} +} + +func (cook RenderCreateConicalGradientCookie) Check() error { +	return cook.check() +} + +// Write request to wire for RenderCreateConicalGradient +func (c *Conn) renderCreateConicalGradientRequest(Picture Id, Center RenderPointfix, Angle RenderFixed, NumStops uint32, Stops []RenderFixed, Colors []RenderColor) []byte { +	size := pad(((24 + pad((int(NumStops) * 4))) + pad((int(NumStops) * 8)))) +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["RENDER"] +	b += 1 + +	buf[b] = 36 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], uint32(Picture)) +	b += 4 + +	{ +		structBytes := Center.Bytes() +		copy(buf[b:], structBytes) +		b += pad(len(structBytes)) +	} + +	Put32(buf[b:], uint32(Angle)) +	b += 4 + +	Put32(buf[b:], NumStops) +	b += 4 + +	for i := 0; i < int(NumStops); i++ { +		Put32(buf[b:], uint32(Stops[i])) +		b += 4 +	} +	b = pad(b) + +	b += RenderColorListBytes(buf[b:], Colors) + +	return buf +} diff --git a/nexgb/xgb.go b/nexgb/xgb.go index b453427..26c0138 100644 --- a/nexgb/xgb.go +++ b/nexgb/xgb.go @@ -17,6 +17,11 @@ import (  )  const ( +	// cookieBuffer represents the queue size of cookies existing at any +	// point in time. The size of the buffer is really only important when +	// there are many requests without replies made in sequence. Once the +	// buffer fills, a round trip request is made to clear the buffer. +	cookieBuffer = 1000  	readBuffer  = 100  	writeBuffer = 100  ) @@ -32,7 +37,7 @@ type Conn struct {  	extensions    map[string]byte  	eventChan         chan eventOrError -	cookieChan chan cookie +	cookieChan chan *cookie  	xidChan chan xid  	seqChan chan uint16  	reqChan chan *request @@ -68,7 +73,7 @@ func NewConnDisplay(display string) (*Conn, error) {  	conn.extensions = make(map[string]byte) -	conn.cookieChan = make(chan cookie, 100) +	conn.cookieChan = make(chan *cookie, cookieBuffer)  	conn.xidChan = make(chan xid, 5)  	conn.seqChan = make(chan uint16, 20)  	conn.reqChan = make(chan *request, 100) @@ -87,6 +92,12 @@ func (c *Conn) Close() {  	c.conn.Close()  } +// DefaultScreen returns the Screen info for the default screen, which is +// 0 or the one given in the display argument to Dial. +func (c *Conn) DefaultScreen() *ScreenInfo { +	return &c.Setup.Roots[c.defaultScreen] +} +  // Id is used for all X identifiers, such as windows, pixmaps, and GCs.  type Id uint32 @@ -95,6 +106,7 @@ type Id uint32  type Event interface {  	ImplementsEvent()  	Bytes() []byte +	String() string  }  // newEventFuncs is a map from event numbers to functions that create @@ -188,7 +200,8 @@ func (c *Conn) newSequenceId() uint16 {  // to match up replies with requests.  // Since sequence ids can only be 16 bit integers we start over at zero when it   // comes time to wrap. -// FIXME: 65,536 requests without replies cannot be made in a single sequence. +// N.B. As long as the cookie buffer is less than 2^16, there are no limitations +// on the number (or kind) of requests made in sequence.  func (c *Conn) generateSeqIds() {  	seqid := uint16(1)  	for { @@ -206,13 +219,14 @@ func (c *Conn) generateSeqIds() {  // The cookie is used to match up the reply/error.  type request struct {  	buf []byte -	cookie cookie +	cookie *cookie  }  // newRequest takes the bytes an a cookie, constructs a request type, -// and sends it over the Conn.reqChan channel. It then returns the cookie -// (for convenience). -func (c *Conn) newRequest(buf []byte, cookie cookie) { +// and sends it over the Conn.reqChan channel. +// Note that the sequence number is added to the cookie after it is sent +// over the request channel. +func (c *Conn) newRequest(buf []byte, cookie *cookie) {  	c.reqChan <- &request{buf: buf, cookie: cookie}  } @@ -220,15 +234,38 @@ func (c *Conn) newRequest(buf []byte, cookie cookie) {  // the bytes to the wire and adds the cookie to the cookie queue.  func (c *Conn) sendRequests() {  	for req := range c.reqChan { +		// ho there! if the cookie channel is nearly full, force a round +		// trip to clear out the cookie buffer. +		// Note that we circumvent the request channel, because we're *in* +		// the request channel. +		if len(c.cookieChan) == cookieBuffer - 1 { +			cookie := c.newCookie(true, true) +			cookie.Sequence = c.newSequenceId() +			c.cookieChan <- cookie +			if !c.writeBuffer(c.getInputFocusRequest()) { +				return +			} +			GetInputFocusCookie{cookie}.Reply() // wait for the buffer to clear +		} + +		req.cookie.Sequence = c.newSequenceId()  		c.cookieChan <- req.cookie -		if _, err := c.conn.Write(req.buf); err != nil { -			fmt.Fprintf(os.Stderr, "x protocol write error: %s\n", err) -			close(c.reqChan) +		if !c.writeBuffer(req.buf) {  			return  		}  	}  } +// writeBuffer is a convenience function for writing a byte slice to the wire. +func (c *Conn) writeBuffer(buf []byte) bool { +	if _, err := c.conn.Write(buf); err != nil { +		fmt.Fprintf(os.Stderr, "x protocol write error: %s\n", err) +		close(c.reqChan) +		return false +	} +	return true +} +  // readResponses is a goroutine that reads events, errors and  // replies off the wire.  // When an event is read, it is always added to the event channel. @@ -260,7 +297,15 @@ func (c *Conn) readResponses() {  		case 0: // This is an error  			// Use the constructor function for this error (that is auto  			// generated) by looking it up by the error number. -			err = newErrorFuncs[int(buf[1])](buf) +			newErrFun, ok := newErrorFuncs[int(buf[1])] +			if !ok { +				fmt.Fprintf(os.Stderr, +					"BUG: " + +					"Could not find error constructor function for error " + +					"with number %d.", buf[1]) +				continue +			} +			err = newErrFun(buf)  			seq = err.SequenceId()  			// This error is either sent to the event channel or a specific @@ -291,22 +336,23 @@ func (c *Conn) readResponses() {  			// Note that we AND the event number with 127 so that we ignore  			// the most significant bit (which is set when it was sent from  			// a SendEvent request). -			event = newEventFuncs[int(buf[0] & 127)](buf) -			// seq = event.SequenceId() // 0 for KeymapNotify  +			evNum := int(buf[0] & 127) +			newEventFun, ok := newEventFuncs[evNum] +			if !ok { +				fmt.Fprintf(os.Stderr, +					"BUG: " + +					"Could not find event constructor function for event " + +					"with number %d.", evNum) +				continue +			} + +			event = newEventFun(buf)  			// Put the event into the queue.  			c.eventChan <- event  			// No more processing for events.  			continue - -			// If this was a KeymapNotify event, then we don't do any more -			// processing since we don't have any sequence id. -			// if event != nil {  -				// if _, ok := event.(KeymapNotifyEvent); ok {  -					// continue  -				// }  -			// }   		}  		// At this point, we have a sequence number and we're either @@ -326,12 +372,17 @@ func (c *Conn) readResponses() {  						cookie.errorChan <- err  					} else { // asynchronous processing  						c.eventChan <- err +						// if this is an unchecked reply, ping the cookie too +						if cookie.pingChan != nil { +							cookie.pingChan <- true +						}  					}  				} else { // this is a reply  					if cookie.replyChan == nil {  						fmt.Fprintf(os.Stderr,  							"Reply with sequence id %d does not have a " +  							"cookie with a valid reply channel.\n", seq) +						continue  					} else {  						cookie.replyChan <- replyBytes  					} @@ -344,10 +395,14 @@ func (c *Conn) readResponses() {  			case cookie.replyChan != nil && cookie.errorChan != nil:  				fmt.Fprintf(os.Stderr,  					"Found cookie with sequence id %d that is expecting a " + -					"reply but will never get it.\n", cookie.Sequence) +					"reply but will never get it. Currently on sequence " + +					"number %d\n", cookie.Sequence, seq)  			// Unchecked requests with replies  			case cookie.replyChan != nil && cookie.pingChan != nil: -				cookie.pingChan <- true +				fmt.Fprintf(os.Stderr, +					"Found cookie with sequence id %d that is expecting a " + +					"reply (and not an error) but will never get it. " + +					"Currently on sequence number %d\n", cookie.Sequence, seq)  			// Checked requests without replies  			case cookie.pingChan != nil && cookie.errorChan != nil:  				cookie.pingChan <- true @@ -368,6 +423,7 @@ func processEventOrError(everr eventOrError) (Event, Error) {  		return nil, ee  	default:  		fmt.Fprintf(os.Stderr, "Invalid event/error type: %T\n", everr) +		return nil, nil  	}  	panic("unreachable")  } diff --git a/nexgb/xgb_help.go b/nexgb/xgb_help.go index f7b4948..b54ab41 100644 --- a/nexgb/xgb_help.go +++ b/nexgb/xgb_help.go @@ -5,20 +5,6 @@ import (  	"strings"  ) -// getExtensionOpcode retrieves the extension opcode from the extensions map. -// If one doesn't exist, just return 0. An X error will likely result. -func (c *Conn) getExtensionOpcode(name string) byte { -	return c.extensions[name] -} - -func (c *Conn) bytesPadding(buf []byte) []byte { -	return append(buf, make([]byte, pad(len(buf))-len(buf))...) -} - -func (c *Conn) bytesString(str string) []byte { -	return c.bytesPadding([]byte(str)) -} -  // stringsJoin is an alias to strings.Join. It allows us to avoid having to  // import 'strings' in each of the generated Go files.  func stringsJoin(ss []string, sep string) string { @@ -31,13 +17,29 @@ func sprintf(format string, v ...interface{}) string {  }  // Pad a length to align on 4 bytes. -func pad(n int) int { return (n + 3) & ^3 } +func pad(n int) int { +	return (n + 3) & ^3 +} + +// popCount counts the number of bits set in a value list mask. +func popCount(mask0 int) int { +	mask := uint32(mask0) +	n := 0 +	for i := uint32(0); i < 32; i++ { +		if mask&(1<<i) != 0 { +			n++ +		} +	} +	return n +} +// Put16 takes a 16 bit integer and copies it into a byte slice.  func Put16(buf []byte, v uint16) {  	buf[0] = byte(v)  	buf[1] = byte(v >> 8)  } +// Put32 takes a 32 bit integer and copies it into a byte slice.  func Put32(buf []byte, v uint32) {  	buf[0] = byte(v)  	buf[1] = byte(v >> 8) @@ -45,6 +47,7 @@ func Put32(buf []byte, v uint32) {  	buf[3] = byte(v >> 24)  } +// Put64 takes a 64 bit integer and copies it into a byte slice.  func Put64(buf []byte, v uint64) {  	buf[0] = byte(v)  	buf[1] = byte(v >> 8) @@ -56,12 +59,14 @@ func Put64(buf []byte, v uint64) {  	buf[7] = byte(v >> 56)  } +// Get16 constructs a 16 bit integer from the beginning of a byte slice.  func Get16(buf []byte) uint16 {  	v := uint16(buf[0])  	v |= uint16(buf[1]) << 8  	return v  } +// Get32 constructs a 32 bit integer from the beginning of a byte slice.  func Get32(buf []byte) uint32 {  	v := uint32(buf[0])  	v |= uint32(buf[1]) << 8 @@ -70,6 +75,7 @@ func Get32(buf []byte) uint32 {  	return v  } +// Get64 constructs a 64 bit integer from the beginning of a byte slice.  func Get64(buf []byte) uint64 {  	v := uint64(buf[0])  	v |= uint64(buf[1]) << 8 @@ -81,19 +87,3 @@ func Get64(buf []byte) uint64 {  	v |= uint64(buf[7]) << 56  	return v  } - -// Voodoo to count the number of bits set in a value list mask. -func popCount(mask0 int) int { -	mask := uint32(mask0) -	n := 0 -	for i := uint32(0); i < 32; i++ { -		if mask&(1<<i) != 0 { -			n++ -		} -	} -	return n -} - -// DefaultScreen returns the Screen info for the default screen, which is -// 0 or the one given in the display argument to Dial. -func (c *Conn) DefaultScreen() *ScreenInfo { return &c.Setup.Roots[c.defaultScreen] } diff --git a/nexgb/xinerama.go b/nexgb/xinerama.go new file mode 100644 index 0000000..c2e031c --- /dev/null +++ b/nexgb/xinerama.go @@ -0,0 +1,629 @@ +package xgb + +/* +	This file was generated by xinerama.xml on May 5 2012 5:56:52pm EDT. +	This file is automatically generated. Edit at your peril! +*/ + +// Imports are not necessary for XGB because everything is  +// in one package. They are still listed here for reference. +// import "xproto" + +// Skipping definition for base type 'Void' + +// Skipping definition for base type 'Byte' + +// Skipping definition for base type 'Int8' + +// Skipping definition for base type 'Card16' + +// Skipping definition for base type 'Char' + +// Skipping definition for base type 'Card32' + +// Skipping definition for base type 'Double' + +// Skipping definition for base type 'Bool' + +// Skipping definition for base type 'Float' + +// Skipping definition for base type 'Id' + +// Skipping definition for base type 'Card8' + +// Skipping definition for base type 'Int16' + +// Skipping definition for base type 'Int32' + +// 'XineramaScreenInfo' struct definition +// Size: 8 +type XineramaScreenInfo struct { +	XOrg   int16 +	YOrg   int16 +	Width  uint16 +	Height uint16 +} + +// Struct read XineramaScreenInfo +func ReadXineramaScreenInfo(buf []byte, v *XineramaScreenInfo) int { +	b := 0 + +	v.XOrg = int16(Get16(buf[b:])) +	b += 2 + +	v.YOrg = int16(Get16(buf[b:])) +	b += 2 + +	v.Width = Get16(buf[b:]) +	b += 2 + +	v.Height = Get16(buf[b:]) +	b += 2 + +	return b +} + +// Struct list read XineramaScreenInfo +func ReadXineramaScreenInfoList(buf []byte, dest []XineramaScreenInfo) int { +	b := 0 +	for i := 0; i < len(dest); i++ { +		dest[i] = XineramaScreenInfo{} +		b += ReadXineramaScreenInfo(buf[b:], &dest[i]) +	} +	return pad(b) +} + +// Struct write XineramaScreenInfo +func (v XineramaScreenInfo) Bytes() []byte { +	buf := make([]byte, 8) +	b := 0 + +	Put16(buf[b:], uint16(v.XOrg)) +	b += 2 + +	Put16(buf[b:], uint16(v.YOrg)) +	b += 2 + +	Put16(buf[b:], v.Width) +	b += 2 + +	Put16(buf[b:], v.Height) +	b += 2 + +	return buf +} + +// Write struct list XineramaScreenInfo +func XineramaScreenInfoListBytes(buf []byte, list []XineramaScreenInfo) int { +	b := 0 +	var structBytes []byte +	for _, item := range list { +		structBytes = item.Bytes() +		copy(buf[b:], structBytes) +		b += pad(len(structBytes)) +	} +	return b +} + +// Request XineramaQueryVersion +// size: 8 +type XineramaQueryVersionCookie struct { +	*cookie +} + +func (c *Conn) XineramaQueryVersion(Major byte, Minor byte) XineramaQueryVersionCookie { +	cookie := c.newCookie(true, true) +	c.newRequest(c.xineramaQueryVersionRequest(Major, Minor), cookie) +	return XineramaQueryVersionCookie{cookie} +} + +func (c *Conn) XineramaQueryVersionUnchecked(Major byte, Minor byte) XineramaQueryVersionCookie { +	cookie := c.newCookie(false, true) +	c.newRequest(c.xineramaQueryVersionRequest(Major, Minor), cookie) +	return XineramaQueryVersionCookie{cookie} +} + +// Request reply for XineramaQueryVersion +// size: 12 +type XineramaQueryVersionReply struct { +	Sequence uint16 +	Length   uint32 +	// padding: 1 bytes +	Major uint16 +	Minor uint16 +} + +// Waits and reads reply data from request XineramaQueryVersion +func (cook XineramaQueryVersionCookie) Reply() (*XineramaQueryVersionReply, error) { +	buf, err := cook.reply() +	if err != nil { +		return nil, err +	} +	if buf == nil { +		return nil, nil +	} +	return xineramaQueryVersionReply(buf), nil +} + +// Read reply into structure from buffer for XineramaQueryVersion +func xineramaQueryVersionReply(buf []byte) *XineramaQueryVersionReply { +	v := new(XineramaQueryVersionReply) +	b := 1 // skip reply determinant + +	b += 1 // padding + +	v.Sequence = Get16(buf[b:]) +	b += 2 + +	v.Length = Get32(buf[b:]) // 4-byte units +	b += 4 + +	v.Major = Get16(buf[b:]) +	b += 2 + +	v.Minor = Get16(buf[b:]) +	b += 2 + +	return v +} + +func (cook XineramaQueryVersionCookie) Check() error { +	return cook.check() +} + +// Write request to wire for XineramaQueryVersion +func (c *Conn) xineramaQueryVersionRequest(Major byte, Minor byte) []byte { +	size := 8 +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["XINERAMA"] +	b += 1 + +	buf[b] = 0 // request opcode +	b += 1 + +	buf[b] = Major +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	buf[b] = Minor +	b += 1 + +	return buf +} + +// Request XineramaGetState +// size: 8 +type XineramaGetStateCookie struct { +	*cookie +} + +func (c *Conn) XineramaGetState(Window Id) XineramaGetStateCookie { +	cookie := c.newCookie(true, true) +	c.newRequest(c.xineramaGetStateRequest(Window), cookie) +	return XineramaGetStateCookie{cookie} +} + +func (c *Conn) XineramaGetStateUnchecked(Window Id) XineramaGetStateCookie { +	cookie := c.newCookie(false, true) +	c.newRequest(c.xineramaGetStateRequest(Window), cookie) +	return XineramaGetStateCookie{cookie} +} + +// Request reply for XineramaGetState +// size: 12 +type XineramaGetStateReply struct { +	Sequence uint16 +	Length   uint32 +	State    byte +	Window   Id +} + +// Waits and reads reply data from request XineramaGetState +func (cook XineramaGetStateCookie) Reply() (*XineramaGetStateReply, error) { +	buf, err := cook.reply() +	if err != nil { +		return nil, err +	} +	if buf == nil { +		return nil, nil +	} +	return xineramaGetStateReply(buf), nil +} + +// Read reply into structure from buffer for XineramaGetState +func xineramaGetStateReply(buf []byte) *XineramaGetStateReply { +	v := new(XineramaGetStateReply) +	b := 1 // skip reply determinant + +	v.State = buf[b] +	b += 1 + +	v.Sequence = Get16(buf[b:]) +	b += 2 + +	v.Length = Get32(buf[b:]) // 4-byte units +	b += 4 + +	v.Window = Id(Get32(buf[b:])) +	b += 4 + +	return v +} + +func (cook XineramaGetStateCookie) Check() error { +	return cook.check() +} + +// Write request to wire for XineramaGetState +func (c *Conn) xineramaGetStateRequest(Window Id) []byte { +	size := 8 +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["XINERAMA"] +	b += 1 + +	buf[b] = 1 // request opcode +	b += 1 + +	Put32(buf[b:], uint32(Window)) +	b += 4 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	return buf +} + +// Request XineramaGetScreenCount +// size: 8 +type XineramaGetScreenCountCookie struct { +	*cookie +} + +func (c *Conn) XineramaGetScreenCount(Window Id) XineramaGetScreenCountCookie { +	cookie := c.newCookie(true, true) +	c.newRequest(c.xineramaGetScreenCountRequest(Window), cookie) +	return XineramaGetScreenCountCookie{cookie} +} + +func (c *Conn) XineramaGetScreenCountUnchecked(Window Id) XineramaGetScreenCountCookie { +	cookie := c.newCookie(false, true) +	c.newRequest(c.xineramaGetScreenCountRequest(Window), cookie) +	return XineramaGetScreenCountCookie{cookie} +} + +// Request reply for XineramaGetScreenCount +// size: 12 +type XineramaGetScreenCountReply struct { +	Sequence    uint16 +	Length      uint32 +	ScreenCount byte +	Window      Id +} + +// Waits and reads reply data from request XineramaGetScreenCount +func (cook XineramaGetScreenCountCookie) Reply() (*XineramaGetScreenCountReply, error) { +	buf, err := cook.reply() +	if err != nil { +		return nil, err +	} +	if buf == nil { +		return nil, nil +	} +	return xineramaGetScreenCountReply(buf), nil +} + +// Read reply into structure from buffer for XineramaGetScreenCount +func xineramaGetScreenCountReply(buf []byte) *XineramaGetScreenCountReply { +	v := new(XineramaGetScreenCountReply) +	b := 1 // skip reply determinant + +	v.ScreenCount = buf[b] +	b += 1 + +	v.Sequence = Get16(buf[b:]) +	b += 2 + +	v.Length = Get32(buf[b:]) // 4-byte units +	b += 4 + +	v.Window = Id(Get32(buf[b:])) +	b += 4 + +	return v +} + +func (cook XineramaGetScreenCountCookie) Check() error { +	return cook.check() +} + +// Write request to wire for XineramaGetScreenCount +func (c *Conn) xineramaGetScreenCountRequest(Window Id) []byte { +	size := 8 +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["XINERAMA"] +	b += 1 + +	buf[b] = 2 // request opcode +	b += 1 + +	Put32(buf[b:], uint32(Window)) +	b += 4 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	return buf +} + +// Request XineramaGetScreenSize +// size: 12 +type XineramaGetScreenSizeCookie struct { +	*cookie +} + +func (c *Conn) XineramaGetScreenSize(Window Id, Screen uint32) XineramaGetScreenSizeCookie { +	cookie := c.newCookie(true, true) +	c.newRequest(c.xineramaGetScreenSizeRequest(Window, Screen), cookie) +	return XineramaGetScreenSizeCookie{cookie} +} + +func (c *Conn) XineramaGetScreenSizeUnchecked(Window Id, Screen uint32) XineramaGetScreenSizeCookie { +	cookie := c.newCookie(false, true) +	c.newRequest(c.xineramaGetScreenSizeRequest(Window, Screen), cookie) +	return XineramaGetScreenSizeCookie{cookie} +} + +// Request reply for XineramaGetScreenSize +// size: 24 +type XineramaGetScreenSizeReply struct { +	Sequence uint16 +	Length   uint32 +	// padding: 1 bytes +	Width  uint32 +	Height uint32 +	Window Id +	Screen uint32 +} + +// Waits and reads reply data from request XineramaGetScreenSize +func (cook XineramaGetScreenSizeCookie) Reply() (*XineramaGetScreenSizeReply, error) { +	buf, err := cook.reply() +	if err != nil { +		return nil, err +	} +	if buf == nil { +		return nil, nil +	} +	return xineramaGetScreenSizeReply(buf), nil +} + +// Read reply into structure from buffer for XineramaGetScreenSize +func xineramaGetScreenSizeReply(buf []byte) *XineramaGetScreenSizeReply { +	v := new(XineramaGetScreenSizeReply) +	b := 1 // skip reply determinant + +	b += 1 // padding + +	v.Sequence = Get16(buf[b:]) +	b += 2 + +	v.Length = Get32(buf[b:]) // 4-byte units +	b += 4 + +	v.Width = Get32(buf[b:]) +	b += 4 + +	v.Height = Get32(buf[b:]) +	b += 4 + +	v.Window = Id(Get32(buf[b:])) +	b += 4 + +	v.Screen = Get32(buf[b:]) +	b += 4 + +	return v +} + +func (cook XineramaGetScreenSizeCookie) Check() error { +	return cook.check() +} + +// Write request to wire for XineramaGetScreenSize +func (c *Conn) xineramaGetScreenSizeRequest(Window Id, Screen uint32) []byte { +	size := 12 +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["XINERAMA"] +	b += 1 + +	buf[b] = 3 // request opcode +	b += 1 + +	Put32(buf[b:], uint32(Window)) +	b += 4 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	Put32(buf[b:], Screen) +	b += 4 + +	return buf +} + +// Request XineramaIsActive +// size: 4 +type XineramaIsActiveCookie struct { +	*cookie +} + +func (c *Conn) XineramaIsActive() XineramaIsActiveCookie { +	cookie := c.newCookie(true, true) +	c.newRequest(c.xineramaIsActiveRequest(), cookie) +	return XineramaIsActiveCookie{cookie} +} + +func (c *Conn) XineramaIsActiveUnchecked() XineramaIsActiveCookie { +	cookie := c.newCookie(false, true) +	c.newRequest(c.xineramaIsActiveRequest(), cookie) +	return XineramaIsActiveCookie{cookie} +} + +// Request reply for XineramaIsActive +// size: 12 +type XineramaIsActiveReply struct { +	Sequence uint16 +	Length   uint32 +	// padding: 1 bytes +	State uint32 +} + +// Waits and reads reply data from request XineramaIsActive +func (cook XineramaIsActiveCookie) Reply() (*XineramaIsActiveReply, error) { +	buf, err := cook.reply() +	if err != nil { +		return nil, err +	} +	if buf == nil { +		return nil, nil +	} +	return xineramaIsActiveReply(buf), nil +} + +// Read reply into structure from buffer for XineramaIsActive +func xineramaIsActiveReply(buf []byte) *XineramaIsActiveReply { +	v := new(XineramaIsActiveReply) +	b := 1 // skip reply determinant + +	b += 1 // padding + +	v.Sequence = Get16(buf[b:]) +	b += 2 + +	v.Length = Get32(buf[b:]) // 4-byte units +	b += 4 + +	v.State = Get32(buf[b:]) +	b += 4 + +	return v +} + +func (cook XineramaIsActiveCookie) Check() error { +	return cook.check() +} + +// Write request to wire for XineramaIsActive +func (c *Conn) xineramaIsActiveRequest() []byte { +	size := 4 +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["XINERAMA"] +	b += 1 + +	buf[b] = 4 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	return buf +} + +// Request XineramaQueryScreens +// size: 4 +type XineramaQueryScreensCookie struct { +	*cookie +} + +func (c *Conn) XineramaQueryScreens() XineramaQueryScreensCookie { +	cookie := c.newCookie(true, true) +	c.newRequest(c.xineramaQueryScreensRequest(), cookie) +	return XineramaQueryScreensCookie{cookie} +} + +func (c *Conn) XineramaQueryScreensUnchecked() XineramaQueryScreensCookie { +	cookie := c.newCookie(false, true) +	c.newRequest(c.xineramaQueryScreensRequest(), cookie) +	return XineramaQueryScreensCookie{cookie} +} + +// Request reply for XineramaQueryScreens +// size: (32 + pad((int(Number) * 8))) +type XineramaQueryScreensReply struct { +	Sequence uint16 +	Length   uint32 +	// padding: 1 bytes +	Number uint32 +	// padding: 20 bytes +	ScreenInfo []XineramaScreenInfo // size: pad((int(Number) * 8)) +} + +// Waits and reads reply data from request XineramaQueryScreens +func (cook XineramaQueryScreensCookie) Reply() (*XineramaQueryScreensReply, error) { +	buf, err := cook.reply() +	if err != nil { +		return nil, err +	} +	if buf == nil { +		return nil, nil +	} +	return xineramaQueryScreensReply(buf), nil +} + +// Read reply into structure from buffer for XineramaQueryScreens +func xineramaQueryScreensReply(buf []byte) *XineramaQueryScreensReply { +	v := new(XineramaQueryScreensReply) +	b := 1 // skip reply determinant + +	b += 1 // padding + +	v.Sequence = Get16(buf[b:]) +	b += 2 + +	v.Length = Get32(buf[b:]) // 4-byte units +	b += 4 + +	v.Number = Get32(buf[b:]) +	b += 4 + +	b += 20 // padding + +	v.ScreenInfo = make([]XineramaScreenInfo, v.Number) +	b += ReadXineramaScreenInfoList(buf[b:], v.ScreenInfo) + +	return v +} + +func (cook XineramaQueryScreensCookie) Check() error { +	return cook.check() +} + +// Write request to wire for XineramaQueryScreens +func (c *Conn) xineramaQueryScreensRequest() []byte { +	size := 4 +	b := 0 +	buf := make([]byte, size) + +	buf[b] = c.extensions["XINERAMA"] +	b += 1 + +	buf[b] = 5 // request opcode +	b += 1 + +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	return buf +} diff --git a/nexgb/xproto.go b/nexgb/xproto.go index d56f0a1..32fa6dd 100644 --- a/nexgb/xproto.go +++ b/nexgb/xproto.go @@ -1,10 +1,16 @@  package xgb  /* -	This file was generated by xproto.xml on May 5 2012 2:50:11am EDT. +	This file was generated by xproto.xml on May 5 2012 5:43:45pm EDT.  	This file is automatically generated. Edit at your peril!  */ +// 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' @@ -25,12 +31,6 @@ package xgb  // Skipping definition for base type 'Int16' -// Skipping definition for base type 'Int32' - -// Skipping definition for base type 'Void' - -// Skipping definition for base type 'Byte' -  const (  	VisualClassStaticGray  = 0  	VisualClassGrayScale   = 1 @@ -2731,6 +2731,23 @@ func (v KeyPressEvent) SequenceId() uint16 {  	return v.Sequence  } +func (v KeyPressEvent) String() string { +	fieldVals := make([]string, 0, 12) +	fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) +	fieldVals = append(fieldVals, sprintf("Detail: %d", v.Detail)) +	fieldVals = append(fieldVals, sprintf("Time: %d", v.Time)) +	fieldVals = append(fieldVals, sprintf("Root: %d", v.Root)) +	fieldVals = append(fieldVals, sprintf("Event: %d", v.Event)) +	fieldVals = append(fieldVals, sprintf("Child: %d", v.Child)) +	fieldVals = append(fieldVals, sprintf("RootX: %d", v.RootX)) +	fieldVals = append(fieldVals, sprintf("RootY: %d", v.RootY)) +	fieldVals = append(fieldVals, sprintf("EventX: %d", v.EventX)) +	fieldVals = append(fieldVals, sprintf("EventY: %d", v.EventY)) +	fieldVals = append(fieldVals, sprintf("State: %d", v.State)) +	fieldVals = append(fieldVals, sprintf("SameScreen: %t", v.SameScreen)) +	return "KeyPress {" + stringsJoin(fieldVals, ", ") + "}" +} +  func init() {  	newEventFuncs[2] = NewKeyPressEvent  } @@ -2865,6 +2882,23 @@ func (v ButtonPressEvent) SequenceId() uint16 {  	return v.Sequence  } +func (v ButtonPressEvent) String() string { +	fieldVals := make([]string, 0, 12) +	fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) +	fieldVals = append(fieldVals, sprintf("Detail: %d", v.Detail)) +	fieldVals = append(fieldVals, sprintf("Time: %d", v.Time)) +	fieldVals = append(fieldVals, sprintf("Root: %d", v.Root)) +	fieldVals = append(fieldVals, sprintf("Event: %d", v.Event)) +	fieldVals = append(fieldVals, sprintf("Child: %d", v.Child)) +	fieldVals = append(fieldVals, sprintf("RootX: %d", v.RootX)) +	fieldVals = append(fieldVals, sprintf("RootY: %d", v.RootY)) +	fieldVals = append(fieldVals, sprintf("EventX: %d", v.EventX)) +	fieldVals = append(fieldVals, sprintf("EventY: %d", v.EventY)) +	fieldVals = append(fieldVals, sprintf("State: %d", v.State)) +	fieldVals = append(fieldVals, sprintf("SameScreen: %t", v.SameScreen)) +	return "ButtonPress {" + stringsJoin(fieldVals, ", ") + "}" +} +  func init() {  	newEventFuncs[4] = NewButtonPressEvent  } @@ -2999,6 +3033,23 @@ func (v MotionNotifyEvent) SequenceId() uint16 {  	return v.Sequence  } +func (v MotionNotifyEvent) String() string { +	fieldVals := make([]string, 0, 12) +	fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) +	fieldVals = append(fieldVals, sprintf("Detail: %d", v.Detail)) +	fieldVals = append(fieldVals, sprintf("Time: %d", v.Time)) +	fieldVals = append(fieldVals, sprintf("Root: %d", v.Root)) +	fieldVals = append(fieldVals, sprintf("Event: %d", v.Event)) +	fieldVals = append(fieldVals, sprintf("Child: %d", v.Child)) +	fieldVals = append(fieldVals, sprintf("RootX: %d", v.RootX)) +	fieldVals = append(fieldVals, sprintf("RootY: %d", v.RootY)) +	fieldVals = append(fieldVals, sprintf("EventX: %d", v.EventX)) +	fieldVals = append(fieldVals, sprintf("EventY: %d", v.EventY)) +	fieldVals = append(fieldVals, sprintf("State: %d", v.State)) +	fieldVals = append(fieldVals, sprintf("SameScreen: %t", v.SameScreen)) +	return "MotionNotify {" + stringsJoin(fieldVals, ", ") + "}" +} +  func init() {  	newEventFuncs[6] = NewMotionNotifyEvent  } @@ -3127,6 +3178,24 @@ func (v EnterNotifyEvent) SequenceId() uint16 {  	return v.Sequence  } +func (v EnterNotifyEvent) String() string { +	fieldVals := make([]string, 0, 12) +	fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) +	fieldVals = append(fieldVals, sprintf("Detail: %d", v.Detail)) +	fieldVals = append(fieldVals, sprintf("Time: %d", v.Time)) +	fieldVals = append(fieldVals, sprintf("Root: %d", v.Root)) +	fieldVals = append(fieldVals, sprintf("Event: %d", v.Event)) +	fieldVals = append(fieldVals, sprintf("Child: %d", v.Child)) +	fieldVals = append(fieldVals, sprintf("RootX: %d", v.RootX)) +	fieldVals = append(fieldVals, sprintf("RootY: %d", v.RootY)) +	fieldVals = append(fieldVals, sprintf("EventX: %d", v.EventX)) +	fieldVals = append(fieldVals, sprintf("EventY: %d", v.EventY)) +	fieldVals = append(fieldVals, sprintf("State: %d", v.State)) +	fieldVals = append(fieldVals, sprintf("Mode: %d", v.Mode)) +	fieldVals = append(fieldVals, sprintf("SameScreenFocus: %d", v.SameScreenFocus)) +	return "EnterNotify {" + stringsJoin(fieldVals, ", ") + "}" +} +  func init() {  	newEventFuncs[7] = NewEnterNotifyEvent  } @@ -3197,6 +3266,15 @@ func (v FocusInEvent) SequenceId() uint16 {  	return v.Sequence  } +func (v FocusInEvent) String() string { +	fieldVals := make([]string, 0, 4) +	fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) +	fieldVals = append(fieldVals, sprintf("Detail: %d", v.Detail)) +	fieldVals = append(fieldVals, sprintf("Event: %d", v.Event)) +	fieldVals = append(fieldVals, sprintf("Mode: %d", v.Mode)) +	return "FocusIn {" + stringsJoin(fieldVals, ", ") + "}" +} +  func init() {  	newEventFuncs[9] = NewFocusInEvent  } @@ -3243,6 +3321,11 @@ func (v KeymapNotifyEvent) SequenceId() uint16 {  	return uint16(0)  } +func (v KeymapNotifyEvent) String() string { +	fieldVals := make([]string, 0, 1) +	return "KeymapNotify {" + stringsJoin(fieldVals, ", ") + "}" +} +  func init() {  	newEventFuncs[11] = NewKeymapNotifyEvent  } @@ -3339,6 +3422,18 @@ func (v ExposeEvent) SequenceId() uint16 {  	return v.Sequence  } +func (v ExposeEvent) String() string { +	fieldVals := make([]string, 0, 8) +	fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) +	fieldVals = append(fieldVals, sprintf("Window: %d", v.Window)) +	fieldVals = append(fieldVals, sprintf("X: %d", v.X)) +	fieldVals = append(fieldVals, sprintf("Y: %d", v.Y)) +	fieldVals = append(fieldVals, sprintf("Width: %d", v.Width)) +	fieldVals = append(fieldVals, sprintf("Height: %d", v.Height)) +	fieldVals = append(fieldVals, sprintf("Count: %d", v.Count)) +	return "Expose {" + stringsJoin(fieldVals, ", ") + "}" +} +  func init() {  	newEventFuncs[12] = NewExposeEvent  } @@ -3449,6 +3544,20 @@ func (v GraphicsExposureEvent) SequenceId() uint16 {  	return v.Sequence  } +func (v GraphicsExposureEvent) String() string { +	fieldVals := make([]string, 0, 10) +	fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) +	fieldVals = append(fieldVals, sprintf("Drawable: %d", v.Drawable)) +	fieldVals = append(fieldVals, sprintf("X: %d", v.X)) +	fieldVals = append(fieldVals, sprintf("Y: %d", v.Y)) +	fieldVals = append(fieldVals, sprintf("Width: %d", v.Width)) +	fieldVals = append(fieldVals, sprintf("Height: %d", v.Height)) +	fieldVals = append(fieldVals, sprintf("MinorOpcode: %d", v.MinorOpcode)) +	fieldVals = append(fieldVals, sprintf("Count: %d", v.Count)) +	fieldVals = append(fieldVals, sprintf("MajorOpcode: %d", v.MajorOpcode)) +	return "GraphicsExposure {" + stringsJoin(fieldVals, ", ") + "}" +} +  func init() {  	newEventFuncs[13] = NewGraphicsExposureEvent  } @@ -3524,6 +3633,15 @@ func (v NoExposureEvent) SequenceId() uint16 {  	return v.Sequence  } +func (v NoExposureEvent) String() string { +	fieldVals := make([]string, 0, 5) +	fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) +	fieldVals = append(fieldVals, sprintf("Drawable: %d", v.Drawable)) +	fieldVals = append(fieldVals, sprintf("MinorOpcode: %d", v.MinorOpcode)) +	fieldVals = append(fieldVals, sprintf("MajorOpcode: %d", v.MajorOpcode)) +	return "NoExposure {" + stringsJoin(fieldVals, ", ") + "}" +} +  func init() {  	newEventFuncs[14] = NewNoExposureEvent  } @@ -3592,6 +3710,14 @@ func (v VisibilityNotifyEvent) SequenceId() uint16 {  	return v.Sequence  } +func (v VisibilityNotifyEvent) String() string { +	fieldVals := make([]string, 0, 4) +	fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) +	fieldVals = append(fieldVals, sprintf("Window: %d", v.Window)) +	fieldVals = append(fieldVals, sprintf("State: %d", v.State)) +	return "VisibilityNotify {" + stringsJoin(fieldVals, ", ") + "}" +} +  func init() {  	newEventFuncs[15] = NewVisibilityNotifyEvent  } @@ -3710,6 +3836,20 @@ func (v CreateNotifyEvent) SequenceId() uint16 {  	return v.Sequence  } +func (v CreateNotifyEvent) String() string { +	fieldVals := make([]string, 0, 10) +	fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) +	fieldVals = append(fieldVals, sprintf("Parent: %d", v.Parent)) +	fieldVals = append(fieldVals, sprintf("Window: %d", v.Window)) +	fieldVals = append(fieldVals, sprintf("X: %d", v.X)) +	fieldVals = append(fieldVals, sprintf("Y: %d", v.Y)) +	fieldVals = append(fieldVals, sprintf("Width: %d", v.Width)) +	fieldVals = append(fieldVals, sprintf("Height: %d", v.Height)) +	fieldVals = append(fieldVals, sprintf("BorderWidth: %d", v.BorderWidth)) +	fieldVals = append(fieldVals, sprintf("OverrideRedirect: %t", v.OverrideRedirect)) +	return "CreateNotify {" + stringsJoin(fieldVals, ", ") + "}" +} +  func init() {  	newEventFuncs[16] = NewCreateNotifyEvent  } @@ -3773,6 +3913,14 @@ func (v DestroyNotifyEvent) SequenceId() uint16 {  	return v.Sequence  } +func (v DestroyNotifyEvent) String() string { +	fieldVals := make([]string, 0, 3) +	fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) +	fieldVals = append(fieldVals, sprintf("Event: %d", v.Event)) +	fieldVals = append(fieldVals, sprintf("Window: %d", v.Window)) +	return "DestroyNotify {" + stringsJoin(fieldVals, ", ") + "}" +} +  func init() {  	newEventFuncs[17] = NewDestroyNotifyEvent  } @@ -3856,6 +4004,15 @@ func (v UnmapNotifyEvent) SequenceId() uint16 {  	return v.Sequence  } +func (v UnmapNotifyEvent) String() string { +	fieldVals := make([]string, 0, 5) +	fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) +	fieldVals = append(fieldVals, sprintf("Event: %d", v.Event)) +	fieldVals = append(fieldVals, sprintf("Window: %d", v.Window)) +	fieldVals = append(fieldVals, sprintf("FromConfigure: %t", v.FromConfigure)) +	return "UnmapNotify {" + stringsJoin(fieldVals, ", ") + "}" +} +  func init() {  	newEventFuncs[18] = NewUnmapNotifyEvent  } @@ -3939,6 +4096,15 @@ func (v MapNotifyEvent) SequenceId() uint16 {  	return v.Sequence  } +func (v MapNotifyEvent) String() string { +	fieldVals := make([]string, 0, 5) +	fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) +	fieldVals = append(fieldVals, sprintf("Event: %d", v.Event)) +	fieldVals = append(fieldVals, sprintf("Window: %d", v.Window)) +	fieldVals = append(fieldVals, sprintf("OverrideRedirect: %t", v.OverrideRedirect)) +	return "MapNotify {" + stringsJoin(fieldVals, ", ") + "}" +} +  func init() {  	newEventFuncs[19] = NewMapNotifyEvent  } @@ -4002,6 +4168,14 @@ func (v MapRequestEvent) SequenceId() uint16 {  	return v.Sequence  } +func (v MapRequestEvent) String() string { +	fieldVals := make([]string, 0, 3) +	fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) +	fieldVals = append(fieldVals, sprintf("Parent: %d", v.Parent)) +	fieldVals = append(fieldVals, sprintf("Window: %d", v.Window)) +	return "MapRequest {" + stringsJoin(fieldVals, ", ") + "}" +} +  func init() {  	newEventFuncs[20] = NewMapRequestEvent  } @@ -4106,6 +4280,18 @@ func (v ReparentNotifyEvent) SequenceId() uint16 {  	return v.Sequence  } +func (v ReparentNotifyEvent) String() string { +	fieldVals := make([]string, 0, 8) +	fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) +	fieldVals = append(fieldVals, sprintf("Event: %d", v.Event)) +	fieldVals = append(fieldVals, sprintf("Window: %d", v.Window)) +	fieldVals = append(fieldVals, sprintf("Parent: %d", v.Parent)) +	fieldVals = append(fieldVals, sprintf("X: %d", v.X)) +	fieldVals = append(fieldVals, sprintf("Y: %d", v.Y)) +	fieldVals = append(fieldVals, sprintf("OverrideRedirect: %t", v.OverrideRedirect)) +	return "ReparentNotify {" + stringsJoin(fieldVals, ", ") + "}" +} +  func init() {  	newEventFuncs[21] = NewReparentNotifyEvent  } @@ -4231,6 +4417,21 @@ func (v ConfigureNotifyEvent) SequenceId() uint16 {  	return v.Sequence  } +func (v ConfigureNotifyEvent) String() string { +	fieldVals := make([]string, 0, 11) +	fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) +	fieldVals = append(fieldVals, sprintf("Event: %d", v.Event)) +	fieldVals = append(fieldVals, sprintf("Window: %d", v.Window)) +	fieldVals = append(fieldVals, sprintf("AboveSibling: %d", v.AboveSibling)) +	fieldVals = append(fieldVals, sprintf("X: %d", v.X)) +	fieldVals = append(fieldVals, sprintf("Y: %d", v.Y)) +	fieldVals = append(fieldVals, sprintf("Width: %d", v.Width)) +	fieldVals = append(fieldVals, sprintf("Height: %d", v.Height)) +	fieldVals = append(fieldVals, sprintf("BorderWidth: %d", v.BorderWidth)) +	fieldVals = append(fieldVals, sprintf("OverrideRedirect: %t", v.OverrideRedirect)) +	return "ConfigureNotify {" + stringsJoin(fieldVals, ", ") + "}" +} +  func init() {  	newEventFuncs[22] = NewConfigureNotifyEvent  } @@ -4345,6 +4546,22 @@ func (v ConfigureRequestEvent) SequenceId() uint16 {  	return v.Sequence  } +func (v ConfigureRequestEvent) String() string { +	fieldVals := make([]string, 0, 10) +	fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) +	fieldVals = append(fieldVals, sprintf("StackMode: %d", v.StackMode)) +	fieldVals = append(fieldVals, sprintf("Parent: %d", v.Parent)) +	fieldVals = append(fieldVals, sprintf("Window: %d", v.Window)) +	fieldVals = append(fieldVals, sprintf("Sibling: %d", v.Sibling)) +	fieldVals = append(fieldVals, sprintf("X: %d", v.X)) +	fieldVals = append(fieldVals, sprintf("Y: %d", v.Y)) +	fieldVals = append(fieldVals, sprintf("Width: %d", v.Width)) +	fieldVals = append(fieldVals, sprintf("Height: %d", v.Height)) +	fieldVals = append(fieldVals, sprintf("BorderWidth: %d", v.BorderWidth)) +	fieldVals = append(fieldVals, sprintf("ValueMask: %d", v.ValueMask)) +	return "ConfigureRequest {" + stringsJoin(fieldVals, ", ") + "}" +} +  func init() {  	newEventFuncs[23] = NewConfigureRequestEvent  } @@ -4422,6 +4639,16 @@ func (v GravityNotifyEvent) SequenceId() uint16 {  	return v.Sequence  } +func (v GravityNotifyEvent) String() string { +	fieldVals := make([]string, 0, 5) +	fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) +	fieldVals = append(fieldVals, sprintf("Event: %d", v.Event)) +	fieldVals = append(fieldVals, sprintf("Window: %d", v.Window)) +	fieldVals = append(fieldVals, sprintf("X: %d", v.X)) +	fieldVals = append(fieldVals, sprintf("Y: %d", v.Y)) +	return "GravityNotify {" + stringsJoin(fieldVals, ", ") + "}" +} +  func init() {  	newEventFuncs[24] = NewGravityNotifyEvent  } @@ -4492,6 +4719,15 @@ func (v ResizeRequestEvent) SequenceId() uint16 {  	return v.Sequence  } +func (v ResizeRequestEvent) String() string { +	fieldVals := make([]string, 0, 4) +	fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) +	fieldVals = append(fieldVals, sprintf("Window: %d", v.Window)) +	fieldVals = append(fieldVals, sprintf("Width: %d", v.Width)) +	fieldVals = append(fieldVals, sprintf("Height: %d", v.Height)) +	return "ResizeRequest {" + stringsJoin(fieldVals, ", ") + "}" +} +  func init() {  	newEventFuncs[25] = NewResizeRequestEvent  } @@ -4572,6 +4808,15 @@ func (v CirculateNotifyEvent) SequenceId() uint16 {  	return v.Sequence  } +func (v CirculateNotifyEvent) String() string { +	fieldVals := make([]string, 0, 6) +	fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) +	fieldVals = append(fieldVals, sprintf("Event: %d", v.Event)) +	fieldVals = append(fieldVals, sprintf("Window: %d", v.Window)) +	fieldVals = append(fieldVals, sprintf("Place: %d", v.Place)) +	return "CirculateNotify {" + stringsJoin(fieldVals, ", ") + "}" +} +  func init() {  	newEventFuncs[26] = NewCirculateNotifyEvent  } @@ -4654,6 +4899,16 @@ func (v PropertyNotifyEvent) SequenceId() uint16 {  	return v.Sequence  } +func (v PropertyNotifyEvent) String() string { +	fieldVals := make([]string, 0, 6) +	fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) +	fieldVals = append(fieldVals, sprintf("Window: %d", v.Window)) +	fieldVals = append(fieldVals, sprintf("Atom: %d", v.Atom)) +	fieldVals = append(fieldVals, sprintf("Time: %d", v.Time)) +	fieldVals = append(fieldVals, sprintf("State: %d", v.State)) +	return "PropertyNotify {" + stringsJoin(fieldVals, ", ") + "}" +} +  func init() {  	newEventFuncs[28] = NewPropertyNotifyEvent  } @@ -4724,6 +4979,15 @@ func (v SelectionClearEvent) SequenceId() uint16 {  	return v.Sequence  } +func (v SelectionClearEvent) String() string { +	fieldVals := make([]string, 0, 4) +	fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) +	fieldVals = append(fieldVals, sprintf("Time: %d", v.Time)) +	fieldVals = append(fieldVals, sprintf("Owner: %d", v.Owner)) +	fieldVals = append(fieldVals, sprintf("Selection: %d", v.Selection)) +	return "SelectionClear {" + stringsJoin(fieldVals, ", ") + "}" +} +  func init() {  	newEventFuncs[29] = NewSelectionClearEvent  } @@ -4815,6 +5079,18 @@ func (v SelectionRequestEvent) SequenceId() uint16 {  	return v.Sequence  } +func (v SelectionRequestEvent) String() string { +	fieldVals := make([]string, 0, 7) +	fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) +	fieldVals = append(fieldVals, sprintf("Time: %d", v.Time)) +	fieldVals = append(fieldVals, sprintf("Owner: %d", v.Owner)) +	fieldVals = append(fieldVals, sprintf("Requestor: %d", v.Requestor)) +	fieldVals = append(fieldVals, sprintf("Selection: %d", v.Selection)) +	fieldVals = append(fieldVals, sprintf("Target: %d", v.Target)) +	fieldVals = append(fieldVals, sprintf("Property: %d", v.Property)) +	return "SelectionRequest {" + stringsJoin(fieldVals, ", ") + "}" +} +  func init() {  	newEventFuncs[30] = NewSelectionRequestEvent  } @@ -4899,6 +5175,17 @@ func (v SelectionNotifyEvent) SequenceId() uint16 {  	return v.Sequence  } +func (v SelectionNotifyEvent) String() string { +	fieldVals := make([]string, 0, 6) +	fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) +	fieldVals = append(fieldVals, sprintf("Time: %d", v.Time)) +	fieldVals = append(fieldVals, sprintf("Requestor: %d", v.Requestor)) +	fieldVals = append(fieldVals, sprintf("Selection: %d", v.Selection)) +	fieldVals = append(fieldVals, sprintf("Target: %d", v.Target)) +	fieldVals = append(fieldVals, sprintf("Property: %d", v.Property)) +	return "SelectionNotify {" + stringsJoin(fieldVals, ", ") + "}" +} +  func init() {  	newEventFuncs[31] = NewSelectionNotifyEvent  } @@ -4989,6 +5276,16 @@ func (v ColormapNotifyEvent) SequenceId() uint16 {  	return v.Sequence  } +func (v ColormapNotifyEvent) String() string { +	fieldVals := make([]string, 0, 6) +	fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) +	fieldVals = append(fieldVals, sprintf("Window: %d", v.Window)) +	fieldVals = append(fieldVals, sprintf("Colormap: %d", v.Colormap)) +	fieldVals = append(fieldVals, sprintf("New: %t", v.New)) +	fieldVals = append(fieldVals, sprintf("State: %d", v.State)) +	return "ColormapNotify {" + stringsJoin(fieldVals, ", ") + "}" +} +  func init() {  	newEventFuncs[32] = NewColormapNotifyEvent  } @@ -5064,6 +5361,15 @@ func (v ClientMessageEvent) SequenceId() uint16 {  	return v.Sequence  } +func (v ClientMessageEvent) String() string { +	fieldVals := make([]string, 0, 4) +	fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) +	fieldVals = append(fieldVals, sprintf("Format: %d", v.Format)) +	fieldVals = append(fieldVals, sprintf("Window: %d", v.Window)) +	fieldVals = append(fieldVals, sprintf("Type: %d", v.Type)) +	return "ClientMessage {" + stringsJoin(fieldVals, ", ") + "}" +} +  func init() {  	newEventFuncs[33] = NewClientMessageEvent  } @@ -5139,6 +5445,15 @@ func (v MappingNotifyEvent) SequenceId() uint16 {  	return v.Sequence  } +func (v MappingNotifyEvent) String() string { +	fieldVals := make([]string, 0, 5) +	fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) +	fieldVals = append(fieldVals, sprintf("Request: %d", v.Request)) +	fieldVals = append(fieldVals, sprintf("FirstKeycode: %d", v.FirstKeycode)) +	fieldVals = append(fieldVals, sprintf("Count: %d", v.Count)) +	return "MappingNotify {" + stringsJoin(fieldVals, ", ") + "}" +} +  func init() {  	newEventFuncs[34] = NewMappingNotifyEvent  } @@ -5163,6 +5478,23 @@ func (v KeyReleaseEvent) SequenceId() uint16 {  	return v.Sequence  } +func (v KeyReleaseEvent) String() string { +	fieldVals := make([]string, 0, 12) +	fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) +	fieldVals = append(fieldVals, sprintf("Detail: %d", v.Detail)) +	fieldVals = append(fieldVals, sprintf("Time: %d", v.Time)) +	fieldVals = append(fieldVals, sprintf("Root: %d", v.Root)) +	fieldVals = append(fieldVals, sprintf("Event: %d", v.Event)) +	fieldVals = append(fieldVals, sprintf("Child: %d", v.Child)) +	fieldVals = append(fieldVals, sprintf("RootX: %d", v.RootX)) +	fieldVals = append(fieldVals, sprintf("RootY: %d", v.RootY)) +	fieldVals = append(fieldVals, sprintf("EventX: %d", v.EventX)) +	fieldVals = append(fieldVals, sprintf("EventY: %d", v.EventY)) +	fieldVals = append(fieldVals, sprintf("State: %d", v.State)) +	fieldVals = append(fieldVals, sprintf("SameScreen: %t", v.SameScreen)) +	return "KeyRelease {" + stringsJoin(fieldVals, ", ") + "}" +} +  func init() {  	newEventFuncs[3] = NewKeyReleaseEvent  } @@ -5187,6 +5519,23 @@ func (v ButtonReleaseEvent) SequenceId() uint16 {  	return v.Sequence  } +func (v ButtonReleaseEvent) String() string { +	fieldVals := make([]string, 0, 12) +	fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) +	fieldVals = append(fieldVals, sprintf("Detail: %d", v.Detail)) +	fieldVals = append(fieldVals, sprintf("Time: %d", v.Time)) +	fieldVals = append(fieldVals, sprintf("Root: %d", v.Root)) +	fieldVals = append(fieldVals, sprintf("Event: %d", v.Event)) +	fieldVals = append(fieldVals, sprintf("Child: %d", v.Child)) +	fieldVals = append(fieldVals, sprintf("RootX: %d", v.RootX)) +	fieldVals = append(fieldVals, sprintf("RootY: %d", v.RootY)) +	fieldVals = append(fieldVals, sprintf("EventX: %d", v.EventX)) +	fieldVals = append(fieldVals, sprintf("EventY: %d", v.EventY)) +	fieldVals = append(fieldVals, sprintf("State: %d", v.State)) +	fieldVals = append(fieldVals, sprintf("SameScreen: %t", v.SameScreen)) +	return "ButtonRelease {" + stringsJoin(fieldVals, ", ") + "}" +} +  func init() {  	newEventFuncs[5] = NewButtonReleaseEvent  } @@ -5211,6 +5560,24 @@ func (v LeaveNotifyEvent) SequenceId() uint16 {  	return v.Sequence  } +func (v LeaveNotifyEvent) String() string { +	fieldVals := make([]string, 0, 12) +	fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) +	fieldVals = append(fieldVals, sprintf("Detail: %d", v.Detail)) +	fieldVals = append(fieldVals, sprintf("Time: %d", v.Time)) +	fieldVals = append(fieldVals, sprintf("Root: %d", v.Root)) +	fieldVals = append(fieldVals, sprintf("Event: %d", v.Event)) +	fieldVals = append(fieldVals, sprintf("Child: %d", v.Child)) +	fieldVals = append(fieldVals, sprintf("RootX: %d", v.RootX)) +	fieldVals = append(fieldVals, sprintf("RootY: %d", v.RootY)) +	fieldVals = append(fieldVals, sprintf("EventX: %d", v.EventX)) +	fieldVals = append(fieldVals, sprintf("EventY: %d", v.EventY)) +	fieldVals = append(fieldVals, sprintf("State: %d", v.State)) +	fieldVals = append(fieldVals, sprintf("Mode: %d", v.Mode)) +	fieldVals = append(fieldVals, sprintf("SameScreenFocus: %d", v.SameScreenFocus)) +	return "LeaveNotify {" + stringsJoin(fieldVals, ", ") + "}" +} +  func init() {  	newEventFuncs[8] = NewLeaveNotifyEvent  } @@ -5235,6 +5602,15 @@ func (v FocusOutEvent) SequenceId() uint16 {  	return v.Sequence  } +func (v FocusOutEvent) String() string { +	fieldVals := make([]string, 0, 4) +	fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) +	fieldVals = append(fieldVals, sprintf("Detail: %d", v.Detail)) +	fieldVals = append(fieldVals, sprintf("Event: %d", v.Event)) +	fieldVals = append(fieldVals, sprintf("Mode: %d", v.Mode)) +	return "FocusOut {" + stringsJoin(fieldVals, ", ") + "}" +} +  func init() {  	newEventFuncs[10] = NewFocusOutEvent  } @@ -5259,6 +5635,15 @@ func (v CirculateRequestEvent) SequenceId() uint16 {  	return v.Sequence  } +func (v CirculateRequestEvent) String() string { +	fieldVals := make([]string, 0, 6) +	fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) +	fieldVals = append(fieldVals, sprintf("Event: %d", v.Event)) +	fieldVals = append(fieldVals, sprintf("Window: %d", v.Window)) +	fieldVals = append(fieldVals, sprintf("Place: %d", v.Place)) +	return "CirculateRequest {" + stringsJoin(fieldVals, ", ") + "}" +} +  func init() {  	newEventFuncs[27] = NewCirculateRequestEvent  } @@ -5931,23 +6316,29 @@ func init() {  // Request CreateWindow  // size: pad((28 + (4 + pad((4 * popCount(int(ValueMask))))))) -type CreateWindowCookie cookie +type CreateWindowCookie struct { +	*cookie +}  // Write request to wire for CreateWindow  func (c *Conn) CreateWindow(Depth byte, Wid Id, Parent Id, X int16, Y int16, Width uint16, Height uint16, BorderWidth uint16, Class uint16, Visual Visualid, ValueMask uint32, ValueList []uint32) CreateWindowCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(createWindowRequest(Depth, Wid, Parent, X, Y, Width, Height, BorderWidth, Class, Visual, ValueMask, ValueList), cookie) -	return CreateWindowCookie(cookie) +	c.newRequest(c.createWindowRequest(Depth, Wid, Parent, X, Y, Width, Height, BorderWidth, Class, Visual, ValueMask, ValueList), cookie) +	return CreateWindowCookie{cookie}  }  func (c *Conn) CreateWindowChecked(Depth byte, Wid Id, Parent Id, X int16, Y int16, Width uint16, Height uint16, BorderWidth uint16, Class uint16, Visual Visualid, ValueMask uint32, ValueList []uint32) CreateWindowCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(createWindowRequest(Depth, Wid, Parent, X, Y, Width, Height, BorderWidth, Class, Visual, ValueMask, ValueList), cookie) -	return CreateWindowCookie(cookie) +	c.newRequest(c.createWindowRequest(Depth, Wid, Parent, X, Y, Width, Height, BorderWidth, Class, Visual, ValueMask, ValueList), cookie) +	return CreateWindowCookie{cookie} +} + +func (cook CreateWindowCookie) Check() error { +	return cook.check()  }  // Write request to wire for CreateWindow -func createWindowRequest(Depth byte, Wid Id, Parent Id, X int16, Y int16, Width uint16, Height uint16, BorderWidth uint16, Class uint16, Visual Visualid, ValueMask uint32, ValueList []uint32) []byte { +func (c *Conn) createWindowRequest(Depth byte, Wid Id, Parent Id, X int16, Y int16, Width uint16, Height uint16, BorderWidth uint16, Class uint16, Visual Visualid, ValueMask uint32, ValueList []uint32) []byte {  	size := pad((28 + (4 + pad((4 * popCount(int(ValueMask)))))))  	b := 0  	buf := make([]byte, size) @@ -6001,23 +6392,29 @@ func createWindowRequest(Depth byte, Wid Id, Parent Id, X int16, Y int16, Width  // Request ChangeWindowAttributes  // size: pad((8 + (4 + pad((4 * popCount(int(ValueMask))))))) -type ChangeWindowAttributesCookie cookie +type ChangeWindowAttributesCookie struct { +	*cookie +}  // Write request to wire for ChangeWindowAttributes  func (c *Conn) ChangeWindowAttributes(Window Id, ValueMask uint32, ValueList []uint32) ChangeWindowAttributesCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(changeWindowAttributesRequest(Window, ValueMask, ValueList), cookie) -	return ChangeWindowAttributesCookie(cookie) +	c.newRequest(c.changeWindowAttributesRequest(Window, ValueMask, ValueList), cookie) +	return ChangeWindowAttributesCookie{cookie}  }  func (c *Conn) ChangeWindowAttributesChecked(Window Id, ValueMask uint32, ValueList []uint32) ChangeWindowAttributesCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(changeWindowAttributesRequest(Window, ValueMask, ValueList), cookie) -	return ChangeWindowAttributesCookie(cookie) +	c.newRequest(c.changeWindowAttributesRequest(Window, ValueMask, ValueList), cookie) +	return ChangeWindowAttributesCookie{cookie} +} + +func (cook ChangeWindowAttributesCookie) Check() error { +	return cook.check()  }  // Write request to wire for ChangeWindowAttributes -func changeWindowAttributesRequest(Window Id, ValueMask uint32, ValueList []uint32) []byte { +func (c *Conn) changeWindowAttributesRequest(Window Id, ValueMask uint32, ValueList []uint32) []byte {  	size := pad((8 + (4 + pad((4 * popCount(int(ValueMask)))))))  	b := 0  	buf := make([]byte, size) @@ -6046,18 +6443,20 @@ func changeWindowAttributesRequest(Window Id, ValueMask uint32, ValueList []uint  // Request GetWindowAttributes  // size: 8 -type GetWindowAttributesCookie cookie +type GetWindowAttributesCookie struct { +	*cookie +}  func (c *Conn) GetWindowAttributes(Window Id) GetWindowAttributesCookie {  	cookie := c.newCookie(true, true) -	c.newRequest(getWindowAttributesRequest(Window), cookie) -	return GetWindowAttributesCookie(cookie) +	c.newRequest(c.getWindowAttributesRequest(Window), cookie) +	return GetWindowAttributesCookie{cookie}  }  func (c *Conn) GetWindowAttributesUnchecked(Window Id) GetWindowAttributesCookie {  	cookie := c.newCookie(false, true) -	c.newRequest(getWindowAttributesRequest(Window), cookie) -	return GetWindowAttributesCookie(cookie) +	c.newRequest(c.getWindowAttributesRequest(Window), cookie) +	return GetWindowAttributesCookie{cookie}  }  // Request reply for GetWindowAttributes @@ -6085,10 +6484,13 @@ type GetWindowAttributesReply struct {  // Waits and reads reply data from request GetWindowAttributes  func (cook GetWindowAttributesCookie) Reply() (*GetWindowAttributesReply, error) { -	buf, err := cookie(cook).reply() +	buf, err := cook.reply()  	if err != nil {  		return nil, err  	} +	if buf == nil { +		return nil, nil +	}  	return getWindowAttributesReply(buf), nil  } @@ -6165,8 +6567,12 @@ func getWindowAttributesReply(buf []byte) *GetWindowAttributesReply {  	return v  } +func (cook GetWindowAttributesCookie) Check() error { +	return cook.check() +} +  // Write request to wire for GetWindowAttributes -func getWindowAttributesRequest(Window Id) []byte { +func (c *Conn) getWindowAttributesRequest(Window Id) []byte {  	size := 8  	b := 0  	buf := make([]byte, size) @@ -6187,23 +6593,29 @@ func getWindowAttributesRequest(Window Id) []byte {  // Request DestroyWindow  // size: 8 -type DestroyWindowCookie cookie +type DestroyWindowCookie struct { +	*cookie +}  // Write request to wire for DestroyWindow  func (c *Conn) DestroyWindow(Window Id) DestroyWindowCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(destroyWindowRequest(Window), cookie) -	return DestroyWindowCookie(cookie) +	c.newRequest(c.destroyWindowRequest(Window), cookie) +	return DestroyWindowCookie{cookie}  }  func (c *Conn) DestroyWindowChecked(Window Id) DestroyWindowCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(destroyWindowRequest(Window), cookie) -	return DestroyWindowCookie(cookie) +	c.newRequest(c.destroyWindowRequest(Window), cookie) +	return DestroyWindowCookie{cookie} +} + +func (cook DestroyWindowCookie) Check() error { +	return cook.check()  }  // Write request to wire for DestroyWindow -func destroyWindowRequest(Window Id) []byte { +func (c *Conn) destroyWindowRequest(Window Id) []byte {  	size := 8  	b := 0  	buf := make([]byte, size) @@ -6224,23 +6636,29 @@ func destroyWindowRequest(Window Id) []byte {  // Request DestroySubwindows  // size: 8 -type DestroySubwindowsCookie cookie +type DestroySubwindowsCookie struct { +	*cookie +}  // Write request to wire for DestroySubwindows  func (c *Conn) DestroySubwindows(Window Id) DestroySubwindowsCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(destroySubwindowsRequest(Window), cookie) -	return DestroySubwindowsCookie(cookie) +	c.newRequest(c.destroySubwindowsRequest(Window), cookie) +	return DestroySubwindowsCookie{cookie}  }  func (c *Conn) DestroySubwindowsChecked(Window Id) DestroySubwindowsCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(destroySubwindowsRequest(Window), cookie) -	return DestroySubwindowsCookie(cookie) +	c.newRequest(c.destroySubwindowsRequest(Window), cookie) +	return DestroySubwindowsCookie{cookie} +} + +func (cook DestroySubwindowsCookie) Check() error { +	return cook.check()  }  // Write request to wire for DestroySubwindows -func destroySubwindowsRequest(Window Id) []byte { +func (c *Conn) destroySubwindowsRequest(Window Id) []byte {  	size := 8  	b := 0  	buf := make([]byte, size) @@ -6261,23 +6679,29 @@ func destroySubwindowsRequest(Window Id) []byte {  // Request ChangeSaveSet  // size: 8 -type ChangeSaveSetCookie cookie +type ChangeSaveSetCookie struct { +	*cookie +}  // Write request to wire for ChangeSaveSet  func (c *Conn) ChangeSaveSet(Mode byte, Window Id) ChangeSaveSetCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(changeSaveSetRequest(Mode, Window), cookie) -	return ChangeSaveSetCookie(cookie) +	c.newRequest(c.changeSaveSetRequest(Mode, Window), cookie) +	return ChangeSaveSetCookie{cookie}  }  func (c *Conn) ChangeSaveSetChecked(Mode byte, Window Id) ChangeSaveSetCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(changeSaveSetRequest(Mode, Window), cookie) -	return ChangeSaveSetCookie(cookie) +	c.newRequest(c.changeSaveSetRequest(Mode, Window), cookie) +	return ChangeSaveSetCookie{cookie} +} + +func (cook ChangeSaveSetCookie) Check() error { +	return cook.check()  }  // Write request to wire for ChangeSaveSet -func changeSaveSetRequest(Mode byte, Window Id) []byte { +func (c *Conn) changeSaveSetRequest(Mode byte, Window Id) []byte {  	size := 8  	b := 0  	buf := make([]byte, size) @@ -6299,23 +6723,29 @@ func changeSaveSetRequest(Mode byte, Window Id) []byte {  // Request ReparentWindow  // size: 16 -type ReparentWindowCookie cookie +type ReparentWindowCookie struct { +	*cookie +}  // Write request to wire for ReparentWindow  func (c *Conn) ReparentWindow(Window Id, Parent Id, X int16, Y int16) ReparentWindowCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(reparentWindowRequest(Window, Parent, X, Y), cookie) -	return ReparentWindowCookie(cookie) +	c.newRequest(c.reparentWindowRequest(Window, Parent, X, Y), cookie) +	return ReparentWindowCookie{cookie}  }  func (c *Conn) ReparentWindowChecked(Window Id, Parent Id, X int16, Y int16) ReparentWindowCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(reparentWindowRequest(Window, Parent, X, Y), cookie) -	return ReparentWindowCookie(cookie) +	c.newRequest(c.reparentWindowRequest(Window, Parent, X, Y), cookie) +	return ReparentWindowCookie{cookie} +} + +func (cook ReparentWindowCookie) Check() error { +	return cook.check()  }  // Write request to wire for ReparentWindow -func reparentWindowRequest(Window Id, Parent Id, X int16, Y int16) []byte { +func (c *Conn) reparentWindowRequest(Window Id, Parent Id, X int16, Y int16) []byte {  	size := 16  	b := 0  	buf := make([]byte, size) @@ -6345,23 +6775,29 @@ func reparentWindowRequest(Window Id, Parent Id, X int16, Y int16) []byte {  // Request MapWindow  // size: 8 -type MapWindowCookie cookie +type MapWindowCookie struct { +	*cookie +}  // Write request to wire for MapWindow  func (c *Conn) MapWindow(Window Id) MapWindowCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(mapWindowRequest(Window), cookie) -	return MapWindowCookie(cookie) +	c.newRequest(c.mapWindowRequest(Window), cookie) +	return MapWindowCookie{cookie}  }  func (c *Conn) MapWindowChecked(Window Id) MapWindowCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(mapWindowRequest(Window), cookie) -	return MapWindowCookie(cookie) +	c.newRequest(c.mapWindowRequest(Window), cookie) +	return MapWindowCookie{cookie} +} + +func (cook MapWindowCookie) Check() error { +	return cook.check()  }  // Write request to wire for MapWindow -func mapWindowRequest(Window Id) []byte { +func (c *Conn) mapWindowRequest(Window Id) []byte {  	size := 8  	b := 0  	buf := make([]byte, size) @@ -6382,23 +6818,29 @@ func mapWindowRequest(Window Id) []byte {  // Request MapSubwindows  // size: 8 -type MapSubwindowsCookie cookie +type MapSubwindowsCookie struct { +	*cookie +}  // Write request to wire for MapSubwindows  func (c *Conn) MapSubwindows(Window Id) MapSubwindowsCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(mapSubwindowsRequest(Window), cookie) -	return MapSubwindowsCookie(cookie) +	c.newRequest(c.mapSubwindowsRequest(Window), cookie) +	return MapSubwindowsCookie{cookie}  }  func (c *Conn) MapSubwindowsChecked(Window Id) MapSubwindowsCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(mapSubwindowsRequest(Window), cookie) -	return MapSubwindowsCookie(cookie) +	c.newRequest(c.mapSubwindowsRequest(Window), cookie) +	return MapSubwindowsCookie{cookie} +} + +func (cook MapSubwindowsCookie) Check() error { +	return cook.check()  }  // Write request to wire for MapSubwindows -func mapSubwindowsRequest(Window Id) []byte { +func (c *Conn) mapSubwindowsRequest(Window Id) []byte {  	size := 8  	b := 0  	buf := make([]byte, size) @@ -6419,23 +6861,29 @@ func mapSubwindowsRequest(Window Id) []byte {  // Request UnmapWindow  // size: 8 -type UnmapWindowCookie cookie +type UnmapWindowCookie struct { +	*cookie +}  // Write request to wire for UnmapWindow  func (c *Conn) UnmapWindow(Window Id) UnmapWindowCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(unmapWindowRequest(Window), cookie) -	return UnmapWindowCookie(cookie) +	c.newRequest(c.unmapWindowRequest(Window), cookie) +	return UnmapWindowCookie{cookie}  }  func (c *Conn) UnmapWindowChecked(Window Id) UnmapWindowCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(unmapWindowRequest(Window), cookie) -	return UnmapWindowCookie(cookie) +	c.newRequest(c.unmapWindowRequest(Window), cookie) +	return UnmapWindowCookie{cookie} +} + +func (cook UnmapWindowCookie) Check() error { +	return cook.check()  }  // Write request to wire for UnmapWindow -func unmapWindowRequest(Window Id) []byte { +func (c *Conn) unmapWindowRequest(Window Id) []byte {  	size := 8  	b := 0  	buf := make([]byte, size) @@ -6456,23 +6904,29 @@ func unmapWindowRequest(Window Id) []byte {  // Request UnmapSubwindows  // size: 8 -type UnmapSubwindowsCookie cookie +type UnmapSubwindowsCookie struct { +	*cookie +}  // Write request to wire for UnmapSubwindows  func (c *Conn) UnmapSubwindows(Window Id) UnmapSubwindowsCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(unmapSubwindowsRequest(Window), cookie) -	return UnmapSubwindowsCookie(cookie) +	c.newRequest(c.unmapSubwindowsRequest(Window), cookie) +	return UnmapSubwindowsCookie{cookie}  }  func (c *Conn) UnmapSubwindowsChecked(Window Id) UnmapSubwindowsCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(unmapSubwindowsRequest(Window), cookie) -	return UnmapSubwindowsCookie(cookie) +	c.newRequest(c.unmapSubwindowsRequest(Window), cookie) +	return UnmapSubwindowsCookie{cookie} +} + +func (cook UnmapSubwindowsCookie) Check() error { +	return cook.check()  }  // Write request to wire for UnmapSubwindows -func unmapSubwindowsRequest(Window Id) []byte { +func (c *Conn) unmapSubwindowsRequest(Window Id) []byte {  	size := 8  	b := 0  	buf := make([]byte, size) @@ -6493,23 +6947,29 @@ func unmapSubwindowsRequest(Window Id) []byte {  // Request ConfigureWindow  // size: pad((10 + (2 + pad((4 * popCount(int(ValueMask))))))) -type ConfigureWindowCookie cookie +type ConfigureWindowCookie struct { +	*cookie +}  // Write request to wire for ConfigureWindow  func (c *Conn) ConfigureWindow(Window Id, ValueMask uint16, ValueList []uint32) ConfigureWindowCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(configureWindowRequest(Window, ValueMask, ValueList), cookie) -	return ConfigureWindowCookie(cookie) +	c.newRequest(c.configureWindowRequest(Window, ValueMask, ValueList), cookie) +	return ConfigureWindowCookie{cookie}  }  func (c *Conn) ConfigureWindowChecked(Window Id, ValueMask uint16, ValueList []uint32) ConfigureWindowCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(configureWindowRequest(Window, ValueMask, ValueList), cookie) -	return ConfigureWindowCookie(cookie) +	c.newRequest(c.configureWindowRequest(Window, ValueMask, ValueList), cookie) +	return ConfigureWindowCookie{cookie} +} + +func (cook ConfigureWindowCookie) Check() error { +	return cook.check()  }  // Write request to wire for ConfigureWindow -func configureWindowRequest(Window Id, ValueMask uint16, ValueList []uint32) []byte { +func (c *Conn) configureWindowRequest(Window Id, ValueMask uint16, ValueList []uint32) []byte {  	size := pad((10 + (2 + pad((4 * popCount(int(ValueMask)))))))  	b := 0  	buf := make([]byte, size) @@ -6541,23 +7001,29 @@ func configureWindowRequest(Window Id, ValueMask uint16, ValueList []uint32) []b  // Request CirculateWindow  // size: 8 -type CirculateWindowCookie cookie +type CirculateWindowCookie struct { +	*cookie +}  // Write request to wire for CirculateWindow  func (c *Conn) CirculateWindow(Direction byte, Window Id) CirculateWindowCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(circulateWindowRequest(Direction, Window), cookie) -	return CirculateWindowCookie(cookie) +	c.newRequest(c.circulateWindowRequest(Direction, Window), cookie) +	return CirculateWindowCookie{cookie}  }  func (c *Conn) CirculateWindowChecked(Direction byte, Window Id) CirculateWindowCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(circulateWindowRequest(Direction, Window), cookie) -	return CirculateWindowCookie(cookie) +	c.newRequest(c.circulateWindowRequest(Direction, Window), cookie) +	return CirculateWindowCookie{cookie} +} + +func (cook CirculateWindowCookie) Check() error { +	return cook.check()  }  // Write request to wire for CirculateWindow -func circulateWindowRequest(Direction byte, Window Id) []byte { +func (c *Conn) circulateWindowRequest(Direction byte, Window Id) []byte {  	size := 8  	b := 0  	buf := make([]byte, size) @@ -6579,18 +7045,20 @@ func circulateWindowRequest(Direction byte, Window Id) []byte {  // Request GetGeometry  // size: 8 -type GetGeometryCookie cookie +type GetGeometryCookie struct { +	*cookie +}  func (c *Conn) GetGeometry(Drawable Id) GetGeometryCookie {  	cookie := c.newCookie(true, true) -	c.newRequest(getGeometryRequest(Drawable), cookie) -	return GetGeometryCookie(cookie) +	c.newRequest(c.getGeometryRequest(Drawable), cookie) +	return GetGeometryCookie{cookie}  }  func (c *Conn) GetGeometryUnchecked(Drawable Id) GetGeometryCookie {  	cookie := c.newCookie(false, true) -	c.newRequest(getGeometryRequest(Drawable), cookie) -	return GetGeometryCookie(cookie) +	c.newRequest(c.getGeometryRequest(Drawable), cookie) +	return GetGeometryCookie{cookie}  }  // Request reply for GetGeometry @@ -6610,10 +7078,13 @@ type GetGeometryReply struct {  // Waits and reads reply data from request GetGeometry  func (cook GetGeometryCookie) Reply() (*GetGeometryReply, error) { -	buf, err := cookie(cook).reply() +	buf, err := cook.reply()  	if err != nil {  		return nil, err  	} +	if buf == nil { +		return nil, nil +	}  	return getGeometryReply(buf), nil  } @@ -6654,8 +7125,12 @@ func getGeometryReply(buf []byte) *GetGeometryReply {  	return v  } +func (cook GetGeometryCookie) Check() error { +	return cook.check() +} +  // Write request to wire for GetGeometry -func getGeometryRequest(Drawable Id) []byte { +func (c *Conn) getGeometryRequest(Drawable Id) []byte {  	size := 8  	b := 0  	buf := make([]byte, size) @@ -6676,18 +7151,20 @@ func getGeometryRequest(Drawable Id) []byte {  // Request QueryTree  // size: 8 -type QueryTreeCookie cookie +type QueryTreeCookie struct { +	*cookie +}  func (c *Conn) QueryTree(Window Id) QueryTreeCookie {  	cookie := c.newCookie(true, true) -	c.newRequest(queryTreeRequest(Window), cookie) -	return QueryTreeCookie(cookie) +	c.newRequest(c.queryTreeRequest(Window), cookie) +	return QueryTreeCookie{cookie}  }  func (c *Conn) QueryTreeUnchecked(Window Id) QueryTreeCookie {  	cookie := c.newCookie(false, true) -	c.newRequest(queryTreeRequest(Window), cookie) -	return QueryTreeCookie(cookie) +	c.newRequest(c.queryTreeRequest(Window), cookie) +	return QueryTreeCookie{cookie}  }  // Request reply for QueryTree @@ -6705,10 +7182,13 @@ type QueryTreeReply struct {  // Waits and reads reply data from request QueryTree  func (cook QueryTreeCookie) Reply() (*QueryTreeReply, error) { -	buf, err := cookie(cook).reply() +	buf, err := cook.reply()  	if err != nil {  		return nil, err  	} +	if buf == nil { +		return nil, nil +	}  	return queryTreeReply(buf), nil  } @@ -6746,8 +7226,12 @@ func queryTreeReply(buf []byte) *QueryTreeReply {  	return v  } +func (cook QueryTreeCookie) Check() error { +	return cook.check() +} +  // Write request to wire for QueryTree -func queryTreeRequest(Window Id) []byte { +func (c *Conn) queryTreeRequest(Window Id) []byte {  	size := 8  	b := 0  	buf := make([]byte, size) @@ -6768,18 +7252,20 @@ func queryTreeRequest(Window Id) []byte {  // Request InternAtom  // size: pad((8 + pad((int(NameLen) * 1)))) -type InternAtomCookie cookie +type InternAtomCookie struct { +	*cookie +}  func (c *Conn) InternAtom(OnlyIfExists bool, NameLen uint16, Name string) InternAtomCookie {  	cookie := c.newCookie(true, true) -	c.newRequest(internAtomRequest(OnlyIfExists, NameLen, Name), cookie) -	return InternAtomCookie(cookie) +	c.newRequest(c.internAtomRequest(OnlyIfExists, NameLen, Name), cookie) +	return InternAtomCookie{cookie}  }  func (c *Conn) InternAtomUnchecked(OnlyIfExists bool, NameLen uint16, Name string) InternAtomCookie {  	cookie := c.newCookie(false, true) -	c.newRequest(internAtomRequest(OnlyIfExists, NameLen, Name), cookie) -	return InternAtomCookie(cookie) +	c.newRequest(c.internAtomRequest(OnlyIfExists, NameLen, Name), cookie) +	return InternAtomCookie{cookie}  }  // Request reply for InternAtom @@ -6793,10 +7279,13 @@ type InternAtomReply struct {  // Waits and reads reply data from request InternAtom  func (cook InternAtomCookie) Reply() (*InternAtomReply, error) { -	buf, err := cookie(cook).reply() +	buf, err := cook.reply()  	if err != nil {  		return nil, err  	} +	if buf == nil { +		return nil, nil +	}  	return internAtomReply(buf), nil  } @@ -6819,8 +7308,12 @@ func internAtomReply(buf []byte) *InternAtomReply {  	return v  } +func (cook InternAtomCookie) Check() error { +	return cook.check() +} +  // Write request to wire for InternAtom -func internAtomRequest(OnlyIfExists bool, NameLen uint16, Name string) []byte { +func (c *Conn) internAtomRequest(OnlyIfExists bool, NameLen uint16, Name string) []byte {  	size := pad((8 + pad((int(NameLen) * 1))))  	b := 0  	buf := make([]byte, size) @@ -6851,18 +7344,20 @@ func internAtomRequest(OnlyIfExists bool, NameLen uint16, Name string) []byte {  // Request GetAtomName  // size: 8 -type GetAtomNameCookie cookie +type GetAtomNameCookie struct { +	*cookie +}  func (c *Conn) GetAtomName(Atom Id) GetAtomNameCookie {  	cookie := c.newCookie(true, true) -	c.newRequest(getAtomNameRequest(Atom), cookie) -	return GetAtomNameCookie(cookie) +	c.newRequest(c.getAtomNameRequest(Atom), cookie) +	return GetAtomNameCookie{cookie}  }  func (c *Conn) GetAtomNameUnchecked(Atom Id) GetAtomNameCookie {  	cookie := c.newCookie(false, true) -	c.newRequest(getAtomNameRequest(Atom), cookie) -	return GetAtomNameCookie(cookie) +	c.newRequest(c.getAtomNameRequest(Atom), cookie) +	return GetAtomNameCookie{cookie}  }  // Request reply for GetAtomName @@ -6878,10 +7373,13 @@ type GetAtomNameReply struct {  // Waits and reads reply data from request GetAtomName  func (cook GetAtomNameCookie) Reply() (*GetAtomNameReply, error) { -	buf, err := cookie(cook).reply() +	buf, err := cook.reply()  	if err != nil {  		return nil, err  	} +	if buf == nil { +		return nil, nil +	}  	return getAtomNameReply(buf), nil  } @@ -6913,8 +7411,12 @@ func getAtomNameReply(buf []byte) *GetAtomNameReply {  	return v  } +func (cook GetAtomNameCookie) Check() error { +	return cook.check() +} +  // Write request to wire for GetAtomName -func getAtomNameRequest(Atom Id) []byte { +func (c *Conn) getAtomNameRequest(Atom Id) []byte {  	size := 8  	b := 0  	buf := make([]byte, size) @@ -6935,23 +7437,29 @@ func getAtomNameRequest(Atom Id) []byte {  // Request ChangeProperty  // size: pad((24 + pad((((int(DataLen) * int(Format)) / 8) * 1)))) -type ChangePropertyCookie cookie +type ChangePropertyCookie struct { +	*cookie +}  // Write request to wire for ChangeProperty  func (c *Conn) ChangeProperty(Mode byte, Window Id, Property Id, Type Id, Format byte, DataLen uint32, Data []byte) ChangePropertyCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(changePropertyRequest(Mode, Window, Property, Type, Format, DataLen, Data), cookie) -	return ChangePropertyCookie(cookie) +	c.newRequest(c.changePropertyRequest(Mode, Window, Property, Type, Format, DataLen, Data), cookie) +	return ChangePropertyCookie{cookie}  }  func (c *Conn) ChangePropertyChecked(Mode byte, Window Id, Property Id, Type Id, Format byte, DataLen uint32, Data []byte) ChangePropertyCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(changePropertyRequest(Mode, Window, Property, Type, Format, DataLen, Data), cookie) -	return ChangePropertyCookie(cookie) +	c.newRequest(c.changePropertyRequest(Mode, Window, Property, Type, Format, DataLen, Data), cookie) +	return ChangePropertyCookie{cookie} +} + +func (cook ChangePropertyCookie) Check() error { +	return cook.check()  }  // Write request to wire for ChangeProperty -func changePropertyRequest(Mode byte, Window Id, Property Id, Type Id, Format byte, DataLen uint32, Data []byte) []byte { +func (c *Conn) changePropertyRequest(Mode byte, Window Id, Property Id, Type Id, Format byte, DataLen uint32, Data []byte) []byte {  	size := pad((24 + pad((((int(DataLen) * int(Format)) / 8) * 1))))  	b := 0  	buf := make([]byte, size) @@ -6990,23 +7498,29 @@ func changePropertyRequest(Mode byte, Window Id, Property Id, Type Id, Format by  // Request DeleteProperty  // size: 12 -type DeletePropertyCookie cookie +type DeletePropertyCookie struct { +	*cookie +}  // Write request to wire for DeleteProperty  func (c *Conn) DeleteProperty(Window Id, Property Id) DeletePropertyCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(deletePropertyRequest(Window, Property), cookie) -	return DeletePropertyCookie(cookie) +	c.newRequest(c.deletePropertyRequest(Window, Property), cookie) +	return DeletePropertyCookie{cookie}  }  func (c *Conn) DeletePropertyChecked(Window Id, Property Id) DeletePropertyCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(deletePropertyRequest(Window, Property), cookie) -	return DeletePropertyCookie(cookie) +	c.newRequest(c.deletePropertyRequest(Window, Property), cookie) +	return DeletePropertyCookie{cookie} +} + +func (cook DeletePropertyCookie) Check() error { +	return cook.check()  }  // Write request to wire for DeleteProperty -func deletePropertyRequest(Window Id, Property Id) []byte { +func (c *Conn) deletePropertyRequest(Window Id, Property Id) []byte {  	size := 12  	b := 0  	buf := make([]byte, size) @@ -7030,18 +7544,20 @@ func deletePropertyRequest(Window Id, Property Id) []byte {  // Request GetProperty  // size: 24 -type GetPropertyCookie cookie +type GetPropertyCookie struct { +	*cookie +}  func (c *Conn) GetProperty(Delete bool, Window Id, Property Id, Type Id, LongOffset uint32, LongLength uint32) GetPropertyCookie {  	cookie := c.newCookie(true, true) -	c.newRequest(getPropertyRequest(Delete, Window, Property, Type, LongOffset, LongLength), cookie) -	return GetPropertyCookie(cookie) +	c.newRequest(c.getPropertyRequest(Delete, Window, Property, Type, LongOffset, LongLength), cookie) +	return GetPropertyCookie{cookie}  }  func (c *Conn) GetPropertyUnchecked(Delete bool, Window Id, Property Id, Type Id, LongOffset uint32, LongLength uint32) GetPropertyCookie {  	cookie := c.newCookie(false, true) -	c.newRequest(getPropertyRequest(Delete, Window, Property, Type, LongOffset, LongLength), cookie) -	return GetPropertyCookie(cookie) +	c.newRequest(c.getPropertyRequest(Delete, Window, Property, Type, LongOffset, LongLength), cookie) +	return GetPropertyCookie{cookie}  }  // Request reply for GetProperty @@ -7059,10 +7575,13 @@ type GetPropertyReply struct {  // Waits and reads reply data from request GetProperty  func (cook GetPropertyCookie) Reply() (*GetPropertyReply, error) { -	buf, err := cookie(cook).reply() +	buf, err := cook.reply()  	if err != nil {  		return nil, err  	} +	if buf == nil { +		return nil, nil +	}  	return getPropertyReply(buf), nil  } @@ -7098,8 +7617,12 @@ func getPropertyReply(buf []byte) *GetPropertyReply {  	return v  } +func (cook GetPropertyCookie) Check() error { +	return cook.check() +} +  // Write request to wire for GetProperty -func getPropertyRequest(Delete bool, Window Id, Property Id, Type Id, LongOffset uint32, LongLength uint32) []byte { +func (c *Conn) getPropertyRequest(Delete bool, Window Id, Property Id, Type Id, LongOffset uint32, LongLength uint32) []byte {  	size := 24  	b := 0  	buf := make([]byte, size) @@ -7137,18 +7660,20 @@ func getPropertyRequest(Delete bool, Window Id, Property Id, Type Id, LongOffset  // Request ListProperties  // size: 8 -type ListPropertiesCookie cookie +type ListPropertiesCookie struct { +	*cookie +}  func (c *Conn) ListProperties(Window Id) ListPropertiesCookie {  	cookie := c.newCookie(true, true) -	c.newRequest(listPropertiesRequest(Window), cookie) -	return ListPropertiesCookie(cookie) +	c.newRequest(c.listPropertiesRequest(Window), cookie) +	return ListPropertiesCookie{cookie}  }  func (c *Conn) ListPropertiesUnchecked(Window Id) ListPropertiesCookie {  	cookie := c.newCookie(false, true) -	c.newRequest(listPropertiesRequest(Window), cookie) -	return ListPropertiesCookie(cookie) +	c.newRequest(c.listPropertiesRequest(Window), cookie) +	return ListPropertiesCookie{cookie}  }  // Request reply for ListProperties @@ -7164,10 +7689,13 @@ type ListPropertiesReply struct {  // Waits and reads reply data from request ListProperties  func (cook ListPropertiesCookie) Reply() (*ListPropertiesReply, error) { -	buf, err := cookie(cook).reply() +	buf, err := cook.reply()  	if err != nil {  		return nil, err  	} +	if buf == nil { +		return nil, nil +	}  	return listPropertiesReply(buf), nil  } @@ -7199,8 +7727,12 @@ func listPropertiesReply(buf []byte) *ListPropertiesReply {  	return v  } +func (cook ListPropertiesCookie) Check() error { +	return cook.check() +} +  // Write request to wire for ListProperties -func listPropertiesRequest(Window Id) []byte { +func (c *Conn) listPropertiesRequest(Window Id) []byte {  	size := 8  	b := 0  	buf := make([]byte, size) @@ -7221,23 +7753,29 @@ func listPropertiesRequest(Window Id) []byte {  // Request SetSelectionOwner  // size: 16 -type SetSelectionOwnerCookie cookie +type SetSelectionOwnerCookie struct { +	*cookie +}  // Write request to wire for SetSelectionOwner  func (c *Conn) SetSelectionOwner(Owner Id, Selection Id, Time Timestamp) SetSelectionOwnerCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(setSelectionOwnerRequest(Owner, Selection, Time), cookie) -	return SetSelectionOwnerCookie(cookie) +	c.newRequest(c.setSelectionOwnerRequest(Owner, Selection, Time), cookie) +	return SetSelectionOwnerCookie{cookie}  }  func (c *Conn) SetSelectionOwnerChecked(Owner Id, Selection Id, Time Timestamp) SetSelectionOwnerCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(setSelectionOwnerRequest(Owner, Selection, Time), cookie) -	return SetSelectionOwnerCookie(cookie) +	c.newRequest(c.setSelectionOwnerRequest(Owner, Selection, Time), cookie) +	return SetSelectionOwnerCookie{cookie} +} + +func (cook SetSelectionOwnerCookie) Check() error { +	return cook.check()  }  // Write request to wire for SetSelectionOwner -func setSelectionOwnerRequest(Owner Id, Selection Id, Time Timestamp) []byte { +func (c *Conn) setSelectionOwnerRequest(Owner Id, Selection Id, Time Timestamp) []byte {  	size := 16  	b := 0  	buf := make([]byte, size) @@ -7264,18 +7802,20 @@ func setSelectionOwnerRequest(Owner Id, Selection Id, Time Timestamp) []byte {  // Request GetSelectionOwner  // size: 8 -type GetSelectionOwnerCookie cookie +type GetSelectionOwnerCookie struct { +	*cookie +}  func (c *Conn) GetSelectionOwner(Selection Id) GetSelectionOwnerCookie {  	cookie := c.newCookie(true, true) -	c.newRequest(getSelectionOwnerRequest(Selection), cookie) -	return GetSelectionOwnerCookie(cookie) +	c.newRequest(c.getSelectionOwnerRequest(Selection), cookie) +	return GetSelectionOwnerCookie{cookie}  }  func (c *Conn) GetSelectionOwnerUnchecked(Selection Id) GetSelectionOwnerCookie {  	cookie := c.newCookie(false, true) -	c.newRequest(getSelectionOwnerRequest(Selection), cookie) -	return GetSelectionOwnerCookie(cookie) +	c.newRequest(c.getSelectionOwnerRequest(Selection), cookie) +	return GetSelectionOwnerCookie{cookie}  }  // Request reply for GetSelectionOwner @@ -7289,10 +7829,13 @@ type GetSelectionOwnerReply struct {  // Waits and reads reply data from request GetSelectionOwner  func (cook GetSelectionOwnerCookie) Reply() (*GetSelectionOwnerReply, error) { -	buf, err := cookie(cook).reply() +	buf, err := cook.reply()  	if err != nil {  		return nil, err  	} +	if buf == nil { +		return nil, nil +	}  	return getSelectionOwnerReply(buf), nil  } @@ -7315,8 +7858,12 @@ func getSelectionOwnerReply(buf []byte) *GetSelectionOwnerReply {  	return v  } +func (cook GetSelectionOwnerCookie) Check() error { +	return cook.check() +} +  // Write request to wire for GetSelectionOwner -func getSelectionOwnerRequest(Selection Id) []byte { +func (c *Conn) getSelectionOwnerRequest(Selection Id) []byte {  	size := 8  	b := 0  	buf := make([]byte, size) @@ -7337,23 +7884,29 @@ func getSelectionOwnerRequest(Selection Id) []byte {  // Request ConvertSelection  // size: 24 -type ConvertSelectionCookie cookie +type ConvertSelectionCookie struct { +	*cookie +}  // Write request to wire for ConvertSelection  func (c *Conn) ConvertSelection(Requestor Id, Selection Id, Target Id, Property Id, Time Timestamp) ConvertSelectionCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(convertSelectionRequest(Requestor, Selection, Target, Property, Time), cookie) -	return ConvertSelectionCookie(cookie) +	c.newRequest(c.convertSelectionRequest(Requestor, Selection, Target, Property, Time), cookie) +	return ConvertSelectionCookie{cookie}  }  func (c *Conn) ConvertSelectionChecked(Requestor Id, Selection Id, Target Id, Property Id, Time Timestamp) ConvertSelectionCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(convertSelectionRequest(Requestor, Selection, Target, Property, Time), cookie) -	return ConvertSelectionCookie(cookie) +	c.newRequest(c.convertSelectionRequest(Requestor, Selection, Target, Property, Time), cookie) +	return ConvertSelectionCookie{cookie} +} + +func (cook ConvertSelectionCookie) Check() error { +	return cook.check()  }  // Write request to wire for ConvertSelection -func convertSelectionRequest(Requestor Id, Selection Id, Target Id, Property Id, Time Timestamp) []byte { +func (c *Conn) convertSelectionRequest(Requestor Id, Selection Id, Target Id, Property Id, Time Timestamp) []byte {  	size := 24  	b := 0  	buf := make([]byte, size) @@ -7386,23 +7939,29 @@ func convertSelectionRequest(Requestor Id, Selection Id, Target Id, Property Id,  // Request SendEvent  // size: pad((12 + pad(32))) -type SendEventCookie cookie +type SendEventCookie struct { +	*cookie +}  // Write request to wire for SendEvent  func (c *Conn) SendEvent(Propagate bool, Destination Id, EventMask uint32, Event string) SendEventCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(sendEventRequest(Propagate, Destination, EventMask, Event), cookie) -	return SendEventCookie(cookie) +	c.newRequest(c.sendEventRequest(Propagate, Destination, EventMask, Event), cookie) +	return SendEventCookie{cookie}  }  func (c *Conn) SendEventChecked(Propagate bool, Destination Id, EventMask uint32, Event string) SendEventCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(sendEventRequest(Propagate, Destination, EventMask, Event), cookie) -	return SendEventCookie(cookie) +	c.newRequest(c.sendEventRequest(Propagate, Destination, EventMask, Event), cookie) +	return SendEventCookie{cookie} +} + +func (cook SendEventCookie) Check() error { +	return cook.check()  }  // Write request to wire for SendEvent -func sendEventRequest(Propagate bool, Destination Id, EventMask uint32, Event string) []byte { +func (c *Conn) sendEventRequest(Propagate bool, Destination Id, EventMask uint32, Event string) []byte {  	size := pad((12 + pad(32)))  	b := 0  	buf := make([]byte, size) @@ -7434,18 +7993,20 @@ func sendEventRequest(Propagate bool, Destination Id, EventMask uint32, Event st  // Request GrabPointer  // size: 24 -type GrabPointerCookie cookie +type GrabPointerCookie struct { +	*cookie +}  func (c *Conn) GrabPointer(OwnerEvents bool, GrabWindow Id, EventMask uint16, PointerMode byte, KeyboardMode byte, ConfineTo Id, Cursor Id, Time Timestamp) GrabPointerCookie {  	cookie := c.newCookie(true, true) -	c.newRequest(grabPointerRequest(OwnerEvents, GrabWindow, EventMask, PointerMode, KeyboardMode, ConfineTo, Cursor, Time), cookie) -	return GrabPointerCookie(cookie) +	c.newRequest(c.grabPointerRequest(OwnerEvents, GrabWindow, EventMask, PointerMode, KeyboardMode, ConfineTo, Cursor, Time), cookie) +	return GrabPointerCookie{cookie}  }  func (c *Conn) GrabPointerUnchecked(OwnerEvents bool, GrabWindow Id, EventMask uint16, PointerMode byte, KeyboardMode byte, ConfineTo Id, Cursor Id, Time Timestamp) GrabPointerCookie {  	cookie := c.newCookie(false, true) -	c.newRequest(grabPointerRequest(OwnerEvents, GrabWindow, EventMask, PointerMode, KeyboardMode, ConfineTo, Cursor, Time), cookie) -	return GrabPointerCookie(cookie) +	c.newRequest(c.grabPointerRequest(OwnerEvents, GrabWindow, EventMask, PointerMode, KeyboardMode, ConfineTo, Cursor, Time), cookie) +	return GrabPointerCookie{cookie}  }  // Request reply for GrabPointer @@ -7458,10 +8019,13 @@ type GrabPointerReply struct {  // Waits and reads reply data from request GrabPointer  func (cook GrabPointerCookie) Reply() (*GrabPointerReply, error) { -	buf, err := cookie(cook).reply() +	buf, err := cook.reply()  	if err != nil {  		return nil, err  	} +	if buf == nil { +		return nil, nil +	}  	return grabPointerReply(buf), nil  } @@ -7473,11 +8037,21 @@ func grabPointerReply(buf []byte) *GrabPointerReply {  	v.Status = buf[b]  	b += 1 +	v.Sequence = Get16(buf[b:]) +	b += 2 + +	v.Length = Get32(buf[b:]) // 4-byte units +	b += 4 +  	return v  } +func (cook GrabPointerCookie) Check() error { +	return cook.check() +} +  // Write request to wire for GrabPointer -func grabPointerRequest(OwnerEvents bool, GrabWindow Id, EventMask uint16, PointerMode byte, KeyboardMode byte, ConfineTo Id, Cursor Id, Time Timestamp) []byte { +func (c *Conn) grabPointerRequest(OwnerEvents bool, GrabWindow Id, EventMask uint16, PointerMode byte, KeyboardMode byte, ConfineTo Id, Cursor Id, Time Timestamp) []byte {  	size := 24  	b := 0  	buf := make([]byte, size) @@ -7521,23 +8095,29 @@ func grabPointerRequest(OwnerEvents bool, GrabWindow Id, EventMask uint16, Point  // Request UngrabPointer  // size: 8 -type UngrabPointerCookie cookie +type UngrabPointerCookie struct { +	*cookie +}  // Write request to wire for UngrabPointer  func (c *Conn) UngrabPointer(Time Timestamp) UngrabPointerCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(ungrabPointerRequest(Time), cookie) -	return UngrabPointerCookie(cookie) +	c.newRequest(c.ungrabPointerRequest(Time), cookie) +	return UngrabPointerCookie{cookie}  }  func (c *Conn) UngrabPointerChecked(Time Timestamp) UngrabPointerCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(ungrabPointerRequest(Time), cookie) -	return UngrabPointerCookie(cookie) +	c.newRequest(c.ungrabPointerRequest(Time), cookie) +	return UngrabPointerCookie{cookie} +} + +func (cook UngrabPointerCookie) Check() error { +	return cook.check()  }  // Write request to wire for UngrabPointer -func ungrabPointerRequest(Time Timestamp) []byte { +func (c *Conn) ungrabPointerRequest(Time Timestamp) []byte {  	size := 8  	b := 0  	buf := make([]byte, size) @@ -7558,23 +8138,29 @@ func ungrabPointerRequest(Time Timestamp) []byte {  // Request GrabButton  // size: 24 -type GrabButtonCookie cookie +type GrabButtonCookie struct { +	*cookie +}  // Write request to wire for GrabButton  func (c *Conn) GrabButton(OwnerEvents bool, GrabWindow Id, EventMask uint16, PointerMode byte, KeyboardMode byte, ConfineTo Id, Cursor Id, Button byte, Modifiers uint16) GrabButtonCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(grabButtonRequest(OwnerEvents, GrabWindow, EventMask, PointerMode, KeyboardMode, ConfineTo, Cursor, Button, Modifiers), cookie) -	return GrabButtonCookie(cookie) +	c.newRequest(c.grabButtonRequest(OwnerEvents, GrabWindow, EventMask, PointerMode, KeyboardMode, ConfineTo, Cursor, Button, Modifiers), cookie) +	return GrabButtonCookie{cookie}  }  func (c *Conn) GrabButtonChecked(OwnerEvents bool, GrabWindow Id, EventMask uint16, PointerMode byte, KeyboardMode byte, ConfineTo Id, Cursor Id, Button byte, Modifiers uint16) GrabButtonCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(grabButtonRequest(OwnerEvents, GrabWindow, EventMask, PointerMode, KeyboardMode, ConfineTo, Cursor, Button, Modifiers), cookie) -	return GrabButtonCookie(cookie) +	c.newRequest(c.grabButtonRequest(OwnerEvents, GrabWindow, EventMask, PointerMode, KeyboardMode, ConfineTo, Cursor, Button, Modifiers), cookie) +	return GrabButtonCookie{cookie} +} + +func (cook GrabButtonCookie) Check() error { +	return cook.check()  }  // Write request to wire for GrabButton -func grabButtonRequest(OwnerEvents bool, GrabWindow Id, EventMask uint16, PointerMode byte, KeyboardMode byte, ConfineTo Id, Cursor Id, Button byte, Modifiers uint16) []byte { +func (c *Conn) grabButtonRequest(OwnerEvents bool, GrabWindow Id, EventMask uint16, PointerMode byte, KeyboardMode byte, ConfineTo Id, Cursor Id, Button byte, Modifiers uint16) []byte {  	size := 24  	b := 0  	buf := make([]byte, size) @@ -7623,23 +8209,29 @@ func grabButtonRequest(OwnerEvents bool, GrabWindow Id, EventMask uint16, Pointe  // Request UngrabButton  // size: 12 -type UngrabButtonCookie cookie +type UngrabButtonCookie struct { +	*cookie +}  // Write request to wire for UngrabButton  func (c *Conn) UngrabButton(Button byte, GrabWindow Id, Modifiers uint16) UngrabButtonCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(ungrabButtonRequest(Button, GrabWindow, Modifiers), cookie) -	return UngrabButtonCookie(cookie) +	c.newRequest(c.ungrabButtonRequest(Button, GrabWindow, Modifiers), cookie) +	return UngrabButtonCookie{cookie}  }  func (c *Conn) UngrabButtonChecked(Button byte, GrabWindow Id, Modifiers uint16) UngrabButtonCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(ungrabButtonRequest(Button, GrabWindow, Modifiers), cookie) -	return UngrabButtonCookie(cookie) +	c.newRequest(c.ungrabButtonRequest(Button, GrabWindow, Modifiers), cookie) +	return UngrabButtonCookie{cookie} +} + +func (cook UngrabButtonCookie) Check() error { +	return cook.check()  }  // Write request to wire for UngrabButton -func ungrabButtonRequest(Button byte, GrabWindow Id, Modifiers uint16) []byte { +func (c *Conn) ungrabButtonRequest(Button byte, GrabWindow Id, Modifiers uint16) []byte {  	size := 12  	b := 0  	buf := make([]byte, size) @@ -7666,23 +8258,29 @@ func ungrabButtonRequest(Button byte, GrabWindow Id, Modifiers uint16) []byte {  // Request ChangeActivePointerGrab  // size: 16 -type ChangeActivePointerGrabCookie cookie +type ChangeActivePointerGrabCookie struct { +	*cookie +}  // Write request to wire for ChangeActivePointerGrab  func (c *Conn) ChangeActivePointerGrab(Cursor Id, Time Timestamp, EventMask uint16) ChangeActivePointerGrabCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(changeActivePointerGrabRequest(Cursor, Time, EventMask), cookie) -	return ChangeActivePointerGrabCookie(cookie) +	c.newRequest(c.changeActivePointerGrabRequest(Cursor, Time, EventMask), cookie) +	return ChangeActivePointerGrabCookie{cookie}  }  func (c *Conn) ChangeActivePointerGrabChecked(Cursor Id, Time Timestamp, EventMask uint16) ChangeActivePointerGrabCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(changeActivePointerGrabRequest(Cursor, Time, EventMask), cookie) -	return ChangeActivePointerGrabCookie(cookie) +	c.newRequest(c.changeActivePointerGrabRequest(Cursor, Time, EventMask), cookie) +	return ChangeActivePointerGrabCookie{cookie} +} + +func (cook ChangeActivePointerGrabCookie) Check() error { +	return cook.check()  }  // Write request to wire for ChangeActivePointerGrab -func changeActivePointerGrabRequest(Cursor Id, Time Timestamp, EventMask uint16) []byte { +func (c *Conn) changeActivePointerGrabRequest(Cursor Id, Time Timestamp, EventMask uint16) []byte {  	size := 16  	b := 0  	buf := make([]byte, size) @@ -7711,18 +8309,20 @@ func changeActivePointerGrabRequest(Cursor Id, Time Timestamp, EventMask uint16)  // Request GrabKeyboard  // size: 16 -type GrabKeyboardCookie cookie +type GrabKeyboardCookie struct { +	*cookie +}  func (c *Conn) GrabKeyboard(OwnerEvents bool, GrabWindow Id, Time Timestamp, PointerMode byte, KeyboardMode byte) GrabKeyboardCookie {  	cookie := c.newCookie(true, true) -	c.newRequest(grabKeyboardRequest(OwnerEvents, GrabWindow, Time, PointerMode, KeyboardMode), cookie) -	return GrabKeyboardCookie(cookie) +	c.newRequest(c.grabKeyboardRequest(OwnerEvents, GrabWindow, Time, PointerMode, KeyboardMode), cookie) +	return GrabKeyboardCookie{cookie}  }  func (c *Conn) GrabKeyboardUnchecked(OwnerEvents bool, GrabWindow Id, Time Timestamp, PointerMode byte, KeyboardMode byte) GrabKeyboardCookie {  	cookie := c.newCookie(false, true) -	c.newRequest(grabKeyboardRequest(OwnerEvents, GrabWindow, Time, PointerMode, KeyboardMode), cookie) -	return GrabKeyboardCookie(cookie) +	c.newRequest(c.grabKeyboardRequest(OwnerEvents, GrabWindow, Time, PointerMode, KeyboardMode), cookie) +	return GrabKeyboardCookie{cookie}  }  // Request reply for GrabKeyboard @@ -7735,10 +8335,13 @@ type GrabKeyboardReply struct {  // Waits and reads reply data from request GrabKeyboard  func (cook GrabKeyboardCookie) Reply() (*GrabKeyboardReply, error) { -	buf, err := cookie(cook).reply() +	buf, err := cook.reply()  	if err != nil {  		return nil, err  	} +	if buf == nil { +		return nil, nil +	}  	return grabKeyboardReply(buf), nil  } @@ -7750,11 +8353,21 @@ func grabKeyboardReply(buf []byte) *GrabKeyboardReply {  	v.Status = buf[b]  	b += 1 +	v.Sequence = Get16(buf[b:]) +	b += 2 + +	v.Length = Get32(buf[b:]) // 4-byte units +	b += 4 +  	return v  } +func (cook GrabKeyboardCookie) Check() error { +	return cook.check() +} +  // Write request to wire for GrabKeyboard -func grabKeyboardRequest(OwnerEvents bool, GrabWindow Id, Time Timestamp, PointerMode byte, KeyboardMode byte) []byte { +func (c *Conn) grabKeyboardRequest(OwnerEvents bool, GrabWindow Id, Time Timestamp, PointerMode byte, KeyboardMode byte) []byte {  	size := 16  	b := 0  	buf := make([]byte, size) @@ -7791,23 +8404,29 @@ func grabKeyboardRequest(OwnerEvents bool, GrabWindow Id, Time Timestamp, Pointe  // Request UngrabKeyboard  // size: 8 -type UngrabKeyboardCookie cookie +type UngrabKeyboardCookie struct { +	*cookie +}  // Write request to wire for UngrabKeyboard  func (c *Conn) UngrabKeyboard(Time Timestamp) UngrabKeyboardCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(ungrabKeyboardRequest(Time), cookie) -	return UngrabKeyboardCookie(cookie) +	c.newRequest(c.ungrabKeyboardRequest(Time), cookie) +	return UngrabKeyboardCookie{cookie}  }  func (c *Conn) UngrabKeyboardChecked(Time Timestamp) UngrabKeyboardCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(ungrabKeyboardRequest(Time), cookie) -	return UngrabKeyboardCookie(cookie) +	c.newRequest(c.ungrabKeyboardRequest(Time), cookie) +	return UngrabKeyboardCookie{cookie} +} + +func (cook UngrabKeyboardCookie) Check() error { +	return cook.check()  }  // Write request to wire for UngrabKeyboard -func ungrabKeyboardRequest(Time Timestamp) []byte { +func (c *Conn) ungrabKeyboardRequest(Time Timestamp) []byte {  	size := 8  	b := 0  	buf := make([]byte, size) @@ -7828,23 +8447,29 @@ func ungrabKeyboardRequest(Time Timestamp) []byte {  // Request GrabKey  // size: 16 -type GrabKeyCookie cookie +type GrabKeyCookie struct { +	*cookie +}  // Write request to wire for GrabKey  func (c *Conn) GrabKey(OwnerEvents bool, GrabWindow Id, Modifiers uint16, Key Keycode, PointerMode byte, KeyboardMode byte) GrabKeyCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(grabKeyRequest(OwnerEvents, GrabWindow, Modifiers, Key, PointerMode, KeyboardMode), cookie) -	return GrabKeyCookie(cookie) +	c.newRequest(c.grabKeyRequest(OwnerEvents, GrabWindow, Modifiers, Key, PointerMode, KeyboardMode), cookie) +	return GrabKeyCookie{cookie}  }  func (c *Conn) GrabKeyChecked(OwnerEvents bool, GrabWindow Id, Modifiers uint16, Key Keycode, PointerMode byte, KeyboardMode byte) GrabKeyCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(grabKeyRequest(OwnerEvents, GrabWindow, Modifiers, Key, PointerMode, KeyboardMode), cookie) -	return GrabKeyCookie(cookie) +	c.newRequest(c.grabKeyRequest(OwnerEvents, GrabWindow, Modifiers, Key, PointerMode, KeyboardMode), cookie) +	return GrabKeyCookie{cookie} +} + +func (cook GrabKeyCookie) Check() error { +	return cook.check()  }  // Write request to wire for GrabKey -func grabKeyRequest(OwnerEvents bool, GrabWindow Id, Modifiers uint16, Key Keycode, PointerMode byte, KeyboardMode byte) []byte { +func (c *Conn) grabKeyRequest(OwnerEvents bool, GrabWindow Id, Modifiers uint16, Key Keycode, PointerMode byte, KeyboardMode byte) []byte {  	size := 16  	b := 0  	buf := make([]byte, size) @@ -7884,23 +8509,29 @@ func grabKeyRequest(OwnerEvents bool, GrabWindow Id, Modifiers uint16, Key Keyco  // Request UngrabKey  // size: 12 -type UngrabKeyCookie cookie +type UngrabKeyCookie struct { +	*cookie +}  // Write request to wire for UngrabKey  func (c *Conn) UngrabKey(Key Keycode, GrabWindow Id, Modifiers uint16) UngrabKeyCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(ungrabKeyRequest(Key, GrabWindow, Modifiers), cookie) -	return UngrabKeyCookie(cookie) +	c.newRequest(c.ungrabKeyRequest(Key, GrabWindow, Modifiers), cookie) +	return UngrabKeyCookie{cookie}  }  func (c *Conn) UngrabKeyChecked(Key Keycode, GrabWindow Id, Modifiers uint16) UngrabKeyCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(ungrabKeyRequest(Key, GrabWindow, Modifiers), cookie) -	return UngrabKeyCookie(cookie) +	c.newRequest(c.ungrabKeyRequest(Key, GrabWindow, Modifiers), cookie) +	return UngrabKeyCookie{cookie} +} + +func (cook UngrabKeyCookie) Check() error { +	return cook.check()  }  // Write request to wire for UngrabKey -func ungrabKeyRequest(Key Keycode, GrabWindow Id, Modifiers uint16) []byte { +func (c *Conn) ungrabKeyRequest(Key Keycode, GrabWindow Id, Modifiers uint16) []byte {  	size := 12  	b := 0  	buf := make([]byte, size) @@ -7927,23 +8558,29 @@ func ungrabKeyRequest(Key Keycode, GrabWindow Id, Modifiers uint16) []byte {  // Request AllowEvents  // size: 8 -type AllowEventsCookie cookie +type AllowEventsCookie struct { +	*cookie +}  // Write request to wire for AllowEvents  func (c *Conn) AllowEvents(Mode byte, Time Timestamp) AllowEventsCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(allowEventsRequest(Mode, Time), cookie) -	return AllowEventsCookie(cookie) +	c.newRequest(c.allowEventsRequest(Mode, Time), cookie) +	return AllowEventsCookie{cookie}  }  func (c *Conn) AllowEventsChecked(Mode byte, Time Timestamp) AllowEventsCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(allowEventsRequest(Mode, Time), cookie) -	return AllowEventsCookie(cookie) +	c.newRequest(c.allowEventsRequest(Mode, Time), cookie) +	return AllowEventsCookie{cookie} +} + +func (cook AllowEventsCookie) Check() error { +	return cook.check()  }  // Write request to wire for AllowEvents -func allowEventsRequest(Mode byte, Time Timestamp) []byte { +func (c *Conn) allowEventsRequest(Mode byte, Time Timestamp) []byte {  	size := 8  	b := 0  	buf := make([]byte, size) @@ -7965,23 +8602,29 @@ func allowEventsRequest(Mode byte, Time Timestamp) []byte {  // Request GrabServer  // size: 4 -type GrabServerCookie cookie +type GrabServerCookie struct { +	*cookie +}  // Write request to wire for GrabServer  func (c *Conn) GrabServer() GrabServerCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(grabServerRequest(), cookie) -	return GrabServerCookie(cookie) +	c.newRequest(c.grabServerRequest(), cookie) +	return GrabServerCookie{cookie}  }  func (c *Conn) GrabServerChecked() GrabServerCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(grabServerRequest(), cookie) -	return GrabServerCookie(cookie) +	c.newRequest(c.grabServerRequest(), cookie) +	return GrabServerCookie{cookie} +} + +func (cook GrabServerCookie) Check() error { +	return cook.check()  }  // Write request to wire for GrabServer -func grabServerRequest() []byte { +func (c *Conn) grabServerRequest() []byte {  	size := 4  	b := 0  	buf := make([]byte, size) @@ -7989,28 +8632,38 @@ func grabServerRequest() []byte {  	buf[b] = 36 // request opcode  	b += 1 +	b += 1                         // padding +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 +  	return buf  }  // Request UngrabServer  // size: 4 -type UngrabServerCookie cookie +type UngrabServerCookie struct { +	*cookie +}  // Write request to wire for UngrabServer  func (c *Conn) UngrabServer() UngrabServerCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(ungrabServerRequest(), cookie) -	return UngrabServerCookie(cookie) +	c.newRequest(c.ungrabServerRequest(), cookie) +	return UngrabServerCookie{cookie}  }  func (c *Conn) UngrabServerChecked() UngrabServerCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(ungrabServerRequest(), cookie) -	return UngrabServerCookie(cookie) +	c.newRequest(c.ungrabServerRequest(), cookie) +	return UngrabServerCookie{cookie} +} + +func (cook UngrabServerCookie) Check() error { +	return cook.check()  }  // Write request to wire for UngrabServer -func ungrabServerRequest() []byte { +func (c *Conn) ungrabServerRequest() []byte {  	size := 4  	b := 0  	buf := make([]byte, size) @@ -8018,23 +8671,29 @@ func ungrabServerRequest() []byte {  	buf[b] = 37 // request opcode  	b += 1 +	b += 1                         // padding +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 +  	return buf  }  // Request QueryPointer  // size: 8 -type QueryPointerCookie cookie +type QueryPointerCookie struct { +	*cookie +}  func (c *Conn) QueryPointer(Window Id) QueryPointerCookie {  	cookie := c.newCookie(true, true) -	c.newRequest(queryPointerRequest(Window), cookie) -	return QueryPointerCookie(cookie) +	c.newRequest(c.queryPointerRequest(Window), cookie) +	return QueryPointerCookie{cookie}  }  func (c *Conn) QueryPointerUnchecked(Window Id) QueryPointerCookie {  	cookie := c.newCookie(false, true) -	c.newRequest(queryPointerRequest(Window), cookie) -	return QueryPointerCookie(cookie) +	c.newRequest(c.queryPointerRequest(Window), cookie) +	return QueryPointerCookie{cookie}  }  // Request reply for QueryPointer @@ -8055,10 +8714,13 @@ type QueryPointerReply struct {  // Waits and reads reply data from request QueryPointer  func (cook QueryPointerCookie) Reply() (*QueryPointerReply, error) { -	buf, err := cookie(cook).reply() +	buf, err := cook.reply()  	if err != nil {  		return nil, err  	} +	if buf == nil { +		return nil, nil +	}  	return queryPointerReply(buf), nil  } @@ -8106,8 +8768,12 @@ func queryPointerReply(buf []byte) *QueryPointerReply {  	return v  } +func (cook QueryPointerCookie) Check() error { +	return cook.check() +} +  // Write request to wire for QueryPointer -func queryPointerRequest(Window Id) []byte { +func (c *Conn) queryPointerRequest(Window Id) []byte {  	size := 8  	b := 0  	buf := make([]byte, size) @@ -8128,18 +8794,20 @@ func queryPointerRequest(Window Id) []byte {  // Request GetMotionEvents  // size: 16 -type GetMotionEventsCookie cookie +type GetMotionEventsCookie struct { +	*cookie +}  func (c *Conn) GetMotionEvents(Window Id, Start Timestamp, Stop Timestamp) GetMotionEventsCookie {  	cookie := c.newCookie(true, true) -	c.newRequest(getMotionEventsRequest(Window, Start, Stop), cookie) -	return GetMotionEventsCookie(cookie) +	c.newRequest(c.getMotionEventsRequest(Window, Start, Stop), cookie) +	return GetMotionEventsCookie{cookie}  }  func (c *Conn) GetMotionEventsUnchecked(Window Id, Start Timestamp, Stop Timestamp) GetMotionEventsCookie {  	cookie := c.newCookie(false, true) -	c.newRequest(getMotionEventsRequest(Window, Start, Stop), cookie) -	return GetMotionEventsCookie(cookie) +	c.newRequest(c.getMotionEventsRequest(Window, Start, Stop), cookie) +	return GetMotionEventsCookie{cookie}  }  // Request reply for GetMotionEvents @@ -8155,10 +8823,13 @@ type GetMotionEventsReply struct {  // Waits and reads reply data from request GetMotionEvents  func (cook GetMotionEventsCookie) Reply() (*GetMotionEventsReply, error) { -	buf, err := cookie(cook).reply() +	buf, err := cook.reply()  	if err != nil {  		return nil, err  	} +	if buf == nil { +		return nil, nil +	}  	return getMotionEventsReply(buf), nil  } @@ -8186,8 +8857,12 @@ func getMotionEventsReply(buf []byte) *GetMotionEventsReply {  	return v  } +func (cook GetMotionEventsCookie) Check() error { +	return cook.check() +} +  // Write request to wire for GetMotionEvents -func getMotionEventsRequest(Window Id, Start Timestamp, Stop Timestamp) []byte { +func (c *Conn) getMotionEventsRequest(Window Id, Start Timestamp, Stop Timestamp) []byte {  	size := 16  	b := 0  	buf := make([]byte, size) @@ -8214,18 +8889,20 @@ func getMotionEventsRequest(Window Id, Start Timestamp, Stop Timestamp) []byte {  // Request TranslateCoordinates  // size: 16 -type TranslateCoordinatesCookie cookie +type TranslateCoordinatesCookie struct { +	*cookie +}  func (c *Conn) TranslateCoordinates(SrcWindow Id, DstWindow Id, SrcX int16, SrcY int16) TranslateCoordinatesCookie {  	cookie := c.newCookie(true, true) -	c.newRequest(translateCoordinatesRequest(SrcWindow, DstWindow, SrcX, SrcY), cookie) -	return TranslateCoordinatesCookie(cookie) +	c.newRequest(c.translateCoordinatesRequest(SrcWindow, DstWindow, SrcX, SrcY), cookie) +	return TranslateCoordinatesCookie{cookie}  }  func (c *Conn) TranslateCoordinatesUnchecked(SrcWindow Id, DstWindow Id, SrcX int16, SrcY int16) TranslateCoordinatesCookie {  	cookie := c.newCookie(false, true) -	c.newRequest(translateCoordinatesRequest(SrcWindow, DstWindow, SrcX, SrcY), cookie) -	return TranslateCoordinatesCookie(cookie) +	c.newRequest(c.translateCoordinatesRequest(SrcWindow, DstWindow, SrcX, SrcY), cookie) +	return TranslateCoordinatesCookie{cookie}  }  // Request reply for TranslateCoordinates @@ -8241,10 +8918,13 @@ type TranslateCoordinatesReply struct {  // Waits and reads reply data from request TranslateCoordinates  func (cook TranslateCoordinatesCookie) Reply() (*TranslateCoordinatesReply, error) { -	buf, err := cookie(cook).reply() +	buf, err := cook.reply()  	if err != nil {  		return nil, err  	} +	if buf == nil { +		return nil, nil +	}  	return translateCoordinatesReply(buf), nil  } @@ -8278,8 +8958,12 @@ func translateCoordinatesReply(buf []byte) *TranslateCoordinatesReply {  	return v  } +func (cook TranslateCoordinatesCookie) Check() error { +	return cook.check() +} +  // Write request to wire for TranslateCoordinates -func translateCoordinatesRequest(SrcWindow Id, DstWindow Id, SrcX int16, SrcY int16) []byte { +func (c *Conn) translateCoordinatesRequest(SrcWindow Id, DstWindow Id, SrcX int16, SrcY int16) []byte {  	size := 16  	b := 0  	buf := make([]byte, size) @@ -8309,23 +8993,29 @@ func translateCoordinatesRequest(SrcWindow Id, DstWindow Id, SrcX int16, SrcY in  // Request WarpPointer  // size: 24 -type WarpPointerCookie cookie +type WarpPointerCookie struct { +	*cookie +}  // Write request to wire for WarpPointer  func (c *Conn) WarpPointer(SrcWindow Id, DstWindow Id, SrcX int16, SrcY int16, SrcWidth uint16, SrcHeight uint16, DstX int16, DstY int16) WarpPointerCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(warpPointerRequest(SrcWindow, DstWindow, SrcX, SrcY, SrcWidth, SrcHeight, DstX, DstY), cookie) -	return WarpPointerCookie(cookie) +	c.newRequest(c.warpPointerRequest(SrcWindow, DstWindow, SrcX, SrcY, SrcWidth, SrcHeight, DstX, DstY), cookie) +	return WarpPointerCookie{cookie}  }  func (c *Conn) WarpPointerChecked(SrcWindow Id, DstWindow Id, SrcX int16, SrcY int16, SrcWidth uint16, SrcHeight uint16, DstX int16, DstY int16) WarpPointerCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(warpPointerRequest(SrcWindow, DstWindow, SrcX, SrcY, SrcWidth, SrcHeight, DstX, DstY), cookie) -	return WarpPointerCookie(cookie) +	c.newRequest(c.warpPointerRequest(SrcWindow, DstWindow, SrcX, SrcY, SrcWidth, SrcHeight, DstX, DstY), cookie) +	return WarpPointerCookie{cookie} +} + +func (cook WarpPointerCookie) Check() error { +	return cook.check()  }  // Write request to wire for WarpPointer -func warpPointerRequest(SrcWindow Id, DstWindow Id, SrcX int16, SrcY int16, SrcWidth uint16, SrcHeight uint16, DstX int16, DstY int16) []byte { +func (c *Conn) warpPointerRequest(SrcWindow Id, DstWindow Id, SrcX int16, SrcY int16, SrcWidth uint16, SrcHeight uint16, DstX int16, DstY int16) []byte {  	size := 24  	b := 0  	buf := make([]byte, size) @@ -8367,23 +9057,29 @@ func warpPointerRequest(SrcWindow Id, DstWindow Id, SrcX int16, SrcY int16, SrcW  // Request SetInputFocus  // size: 12 -type SetInputFocusCookie cookie +type SetInputFocusCookie struct { +	*cookie +}  // Write request to wire for SetInputFocus  func (c *Conn) SetInputFocus(RevertTo byte, Focus Id, Time Timestamp) SetInputFocusCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(setInputFocusRequest(RevertTo, Focus, Time), cookie) -	return SetInputFocusCookie(cookie) +	c.newRequest(c.setInputFocusRequest(RevertTo, Focus, Time), cookie) +	return SetInputFocusCookie{cookie}  }  func (c *Conn) SetInputFocusChecked(RevertTo byte, Focus Id, Time Timestamp) SetInputFocusCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(setInputFocusRequest(RevertTo, Focus, Time), cookie) -	return SetInputFocusCookie(cookie) +	c.newRequest(c.setInputFocusRequest(RevertTo, Focus, Time), cookie) +	return SetInputFocusCookie{cookie} +} + +func (cook SetInputFocusCookie) Check() error { +	return cook.check()  }  // Write request to wire for SetInputFocus -func setInputFocusRequest(RevertTo byte, Focus Id, Time Timestamp) []byte { +func (c *Conn) setInputFocusRequest(RevertTo byte, Focus Id, Time Timestamp) []byte {  	size := 12  	b := 0  	buf := make([]byte, size) @@ -8408,18 +9104,20 @@ func setInputFocusRequest(RevertTo byte, Focus Id, Time Timestamp) []byte {  // Request GetInputFocus  // size: 4 -type GetInputFocusCookie cookie +type GetInputFocusCookie struct { +	*cookie +}  func (c *Conn) GetInputFocus() GetInputFocusCookie {  	cookie := c.newCookie(true, true) -	c.newRequest(getInputFocusRequest(), cookie) -	return GetInputFocusCookie(cookie) +	c.newRequest(c.getInputFocusRequest(), cookie) +	return GetInputFocusCookie{cookie}  }  func (c *Conn) GetInputFocusUnchecked() GetInputFocusCookie {  	cookie := c.newCookie(false, true) -	c.newRequest(getInputFocusRequest(), cookie) -	return GetInputFocusCookie(cookie) +	c.newRequest(c.getInputFocusRequest(), cookie) +	return GetInputFocusCookie{cookie}  }  // Request reply for GetInputFocus @@ -8433,10 +9131,13 @@ type GetInputFocusReply struct {  // Waits and reads reply data from request GetInputFocus  func (cook GetInputFocusCookie) Reply() (*GetInputFocusReply, error) { -	buf, err := cookie(cook).reply() +	buf, err := cook.reply()  	if err != nil {  		return nil, err  	} +	if buf == nil { +		return nil, nil +	}  	return getInputFocusReply(buf), nil  } @@ -8460,8 +9161,12 @@ func getInputFocusReply(buf []byte) *GetInputFocusReply {  	return v  } +func (cook GetInputFocusCookie) Check() error { +	return cook.check() +} +  // Write request to wire for GetInputFocus -func getInputFocusRequest() []byte { +func (c *Conn) getInputFocusRequest() []byte {  	size := 4  	b := 0  	buf := make([]byte, size) @@ -8469,23 +9174,29 @@ func getInputFocusRequest() []byte {  	buf[b] = 43 // request opcode  	b += 1 +	b += 1                         // padding +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 +  	return buf  }  // Request QueryKeymap  // size: 4 -type QueryKeymapCookie cookie +type QueryKeymapCookie struct { +	*cookie +}  func (c *Conn) QueryKeymap() QueryKeymapCookie {  	cookie := c.newCookie(true, true) -	c.newRequest(queryKeymapRequest(), cookie) -	return QueryKeymapCookie(cookie) +	c.newRequest(c.queryKeymapRequest(), cookie) +	return QueryKeymapCookie{cookie}  }  func (c *Conn) QueryKeymapUnchecked() QueryKeymapCookie {  	cookie := c.newCookie(false, true) -	c.newRequest(queryKeymapRequest(), cookie) -	return QueryKeymapCookie(cookie) +	c.newRequest(c.queryKeymapRequest(), cookie) +	return QueryKeymapCookie{cookie}  }  // Request reply for QueryKeymap @@ -8499,10 +9210,13 @@ type QueryKeymapReply struct {  // Waits and reads reply data from request QueryKeymap  func (cook QueryKeymapCookie) Reply() (*QueryKeymapReply, error) { -	buf, err := cookie(cook).reply() +	buf, err := cook.reply()  	if err != nil {  		return nil, err  	} +	if buf == nil { +		return nil, nil +	}  	return queryKeymapReply(buf), nil  } @@ -8526,8 +9240,12 @@ func queryKeymapReply(buf []byte) *QueryKeymapReply {  	return v  } +func (cook QueryKeymapCookie) Check() error { +	return cook.check() +} +  // Write request to wire for QueryKeymap -func queryKeymapRequest() []byte { +func (c *Conn) queryKeymapRequest() []byte {  	size := 4  	b := 0  	buf := make([]byte, size) @@ -8535,28 +9253,38 @@ func queryKeymapRequest() []byte {  	buf[b] = 44 // request opcode  	b += 1 +	b += 1                         // padding +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 +  	return buf  }  // Request OpenFont  // size: pad((12 + pad((int(NameLen) * 1)))) -type OpenFontCookie cookie +type OpenFontCookie struct { +	*cookie +}  // Write request to wire for OpenFont  func (c *Conn) OpenFont(Fid Id, NameLen uint16, Name string) OpenFontCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(openFontRequest(Fid, NameLen, Name), cookie) -	return OpenFontCookie(cookie) +	c.newRequest(c.openFontRequest(Fid, NameLen, Name), cookie) +	return OpenFontCookie{cookie}  }  func (c *Conn) OpenFontChecked(Fid Id, NameLen uint16, Name string) OpenFontCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(openFontRequest(Fid, NameLen, Name), cookie) -	return OpenFontCookie(cookie) +	c.newRequest(c.openFontRequest(Fid, NameLen, Name), cookie) +	return OpenFontCookie{cookie} +} + +func (cook OpenFontCookie) Check() error { +	return cook.check()  }  // Write request to wire for OpenFont -func openFontRequest(Fid Id, NameLen uint16, Name string) []byte { +func (c *Conn) openFontRequest(Fid Id, NameLen uint16, Name string) []byte {  	size := pad((12 + pad((int(NameLen) * 1))))  	b := 0  	buf := make([]byte, size) @@ -8585,23 +9313,29 @@ func openFontRequest(Fid Id, NameLen uint16, Name string) []byte {  // Request CloseFont  // size: 8 -type CloseFontCookie cookie +type CloseFontCookie struct { +	*cookie +}  // Write request to wire for CloseFont  func (c *Conn) CloseFont(Font Id) CloseFontCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(closeFontRequest(Font), cookie) -	return CloseFontCookie(cookie) +	c.newRequest(c.closeFontRequest(Font), cookie) +	return CloseFontCookie{cookie}  }  func (c *Conn) CloseFontChecked(Font Id) CloseFontCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(closeFontRequest(Font), cookie) -	return CloseFontCookie(cookie) +	c.newRequest(c.closeFontRequest(Font), cookie) +	return CloseFontCookie{cookie} +} + +func (cook CloseFontCookie) Check() error { +	return cook.check()  }  // Write request to wire for CloseFont -func closeFontRequest(Font Id) []byte { +func (c *Conn) closeFontRequest(Font Id) []byte {  	size := 8  	b := 0  	buf := make([]byte, size) @@ -8622,18 +9356,20 @@ func closeFontRequest(Font Id) []byte {  // Request QueryFont  // size: 8 -type QueryFontCookie cookie +type QueryFontCookie struct { +	*cookie +}  func (c *Conn) QueryFont(Font Id) QueryFontCookie {  	cookie := c.newCookie(true, true) -	c.newRequest(queryFontRequest(Font), cookie) -	return QueryFontCookie(cookie) +	c.newRequest(c.queryFontRequest(Font), cookie) +	return QueryFontCookie{cookie}  }  func (c *Conn) QueryFontUnchecked(Font Id) QueryFontCookie {  	cookie := c.newCookie(false, true) -	c.newRequest(queryFontRequest(Font), cookie) -	return QueryFontCookie(cookie) +	c.newRequest(c.queryFontRequest(Font), cookie) +	return QueryFontCookie{cookie}  }  // Request reply for QueryFont @@ -8663,10 +9399,13 @@ type QueryFontReply struct {  // Waits and reads reply data from request QueryFont  func (cook QueryFontCookie) Reply() (*QueryFontReply, error) { -	buf, err := cookie(cook).reply() +	buf, err := cook.reply()  	if err != nil {  		return nil, err  	} +	if buf == nil { +		return nil, nil +	}  	return queryFontReply(buf), nil  } @@ -8739,8 +9478,12 @@ func queryFontReply(buf []byte) *QueryFontReply {  	return v  } +func (cook QueryFontCookie) Check() error { +	return cook.check() +} +  // Write request to wire for QueryFont -func queryFontRequest(Font Id) []byte { +func (c *Conn) queryFontRequest(Font Id) []byte {  	size := 8  	b := 0  	buf := make([]byte, size) @@ -8761,18 +9504,20 @@ func queryFontRequest(Font Id) []byte {  // Request QueryTextExtents  // size: pad((8 + pad((len(String) * 2)))) -type QueryTextExtentsCookie cookie +type QueryTextExtentsCookie struct { +	*cookie +}  func (c *Conn) QueryTextExtents(Font Id, String []Char2b, StringLen uint16) QueryTextExtentsCookie {  	cookie := c.newCookie(true, true) -	c.newRequest(queryTextExtentsRequest(Font, String, StringLen), cookie) -	return QueryTextExtentsCookie(cookie) +	c.newRequest(c.queryTextExtentsRequest(Font, String, StringLen), cookie) +	return QueryTextExtentsCookie{cookie}  }  func (c *Conn) QueryTextExtentsUnchecked(Font Id, String []Char2b, StringLen uint16) QueryTextExtentsCookie {  	cookie := c.newCookie(false, true) -	c.newRequest(queryTextExtentsRequest(Font, String, StringLen), cookie) -	return QueryTextExtentsCookie(cookie) +	c.newRequest(c.queryTextExtentsRequest(Font, String, StringLen), cookie) +	return QueryTextExtentsCookie{cookie}  }  // Request reply for QueryTextExtents @@ -8792,10 +9537,13 @@ type QueryTextExtentsReply struct {  // Waits and reads reply data from request QueryTextExtents  func (cook QueryTextExtentsCookie) Reply() (*QueryTextExtentsReply, error) { -	buf, err := cookie(cook).reply() +	buf, err := cook.reply()  	if err != nil {  		return nil, err  	} +	if buf == nil { +		return nil, nil +	}  	return queryTextExtentsReply(buf), nil  } @@ -8837,8 +9585,12 @@ func queryTextExtentsReply(buf []byte) *QueryTextExtentsReply {  	return v  } +func (cook QueryTextExtentsCookie) Check() error { +	return cook.check() +} +  // Write request to wire for QueryTextExtents -func queryTextExtentsRequest(Font Id, String []Char2b, StringLen uint16) []byte { +func (c *Conn) queryTextExtentsRequest(Font Id, String []Char2b, StringLen uint16) []byte {  	size := pad((8 + pad((len(String) * 2))))  	b := 0  	buf := make([]byte, size) @@ -8864,18 +9616,20 @@ func queryTextExtentsRequest(Font Id, String []Char2b, StringLen uint16) []byte  // Request ListFonts  // size: pad((8 + pad((int(PatternLen) * 1)))) -type ListFontsCookie cookie +type ListFontsCookie struct { +	*cookie +}  func (c *Conn) ListFonts(MaxNames uint16, PatternLen uint16, Pattern string) ListFontsCookie {  	cookie := c.newCookie(true, true) -	c.newRequest(listFontsRequest(MaxNames, PatternLen, Pattern), cookie) -	return ListFontsCookie(cookie) +	c.newRequest(c.listFontsRequest(MaxNames, PatternLen, Pattern), cookie) +	return ListFontsCookie{cookie}  }  func (c *Conn) ListFontsUnchecked(MaxNames uint16, PatternLen uint16, Pattern string) ListFontsCookie {  	cookie := c.newCookie(false, true) -	c.newRequest(listFontsRequest(MaxNames, PatternLen, Pattern), cookie) -	return ListFontsCookie(cookie) +	c.newRequest(c.listFontsRequest(MaxNames, PatternLen, Pattern), cookie) +	return ListFontsCookie{cookie}  }  // Request reply for ListFonts @@ -8891,10 +9645,13 @@ type ListFontsReply struct {  // Waits and reads reply data from request ListFonts  func (cook ListFontsCookie) Reply() (*ListFontsReply, error) { -	buf, err := cookie(cook).reply() +	buf, err := cook.reply()  	if err != nil {  		return nil, err  	} +	if buf == nil { +		return nil, nil +	}  	return listFontsReply(buf), nil  } @@ -8922,8 +9679,12 @@ func listFontsReply(buf []byte) *ListFontsReply {  	return v  } +func (cook ListFontsCookie) Check() error { +	return cook.check() +} +  // Write request to wire for ListFonts -func listFontsRequest(MaxNames uint16, PatternLen uint16, Pattern string) []byte { +func (c *Conn) listFontsRequest(MaxNames uint16, PatternLen uint16, Pattern string) []byte {  	size := pad((8 + pad((int(PatternLen) * 1))))  	b := 0  	buf := make([]byte, size) @@ -8950,18 +9711,20 @@ func listFontsRequest(MaxNames uint16, PatternLen uint16, Pattern string) []byte  // Request ListFontsWithInfo  // size: pad((8 + pad((int(PatternLen) * 1)))) -type ListFontsWithInfoCookie cookie +type ListFontsWithInfoCookie struct { +	*cookie +}  func (c *Conn) ListFontsWithInfo(MaxNames uint16, PatternLen uint16, Pattern string) ListFontsWithInfoCookie {  	cookie := c.newCookie(true, true) -	c.newRequest(listFontsWithInfoRequest(MaxNames, PatternLen, Pattern), cookie) -	return ListFontsWithInfoCookie(cookie) +	c.newRequest(c.listFontsWithInfoRequest(MaxNames, PatternLen, Pattern), cookie) +	return ListFontsWithInfoCookie{cookie}  }  func (c *Conn) ListFontsWithInfoUnchecked(MaxNames uint16, PatternLen uint16, Pattern string) ListFontsWithInfoCookie {  	cookie := c.newCookie(false, true) -	c.newRequest(listFontsWithInfoRequest(MaxNames, PatternLen, Pattern), cookie) -	return ListFontsWithInfoCookie(cookie) +	c.newRequest(c.listFontsWithInfoRequest(MaxNames, PatternLen, Pattern), cookie) +	return ListFontsWithInfoCookie{cookie}  }  // Request reply for ListFontsWithInfo @@ -8991,10 +9754,13 @@ type ListFontsWithInfoReply struct {  // Waits and reads reply data from request ListFontsWithInfo  func (cook ListFontsWithInfoCookie) Reply() (*ListFontsWithInfoReply, error) { -	buf, err := cookie(cook).reply() +	buf, err := cook.reply()  	if err != nil {  		return nil, err  	} +	if buf == nil { +		return nil, nil +	}  	return listFontsWithInfoReply(buf), nil  } @@ -9072,8 +9838,12 @@ func listFontsWithInfoReply(buf []byte) *ListFontsWithInfoReply {  	return v  } +func (cook ListFontsWithInfoCookie) Check() error { +	return cook.check() +} +  // Write request to wire for ListFontsWithInfo -func listFontsWithInfoRequest(MaxNames uint16, PatternLen uint16, Pattern string) []byte { +func (c *Conn) listFontsWithInfoRequest(MaxNames uint16, PatternLen uint16, Pattern string) []byte {  	size := pad((8 + pad((int(PatternLen) * 1))))  	b := 0  	buf := make([]byte, size) @@ -9100,23 +9870,29 @@ func listFontsWithInfoRequest(MaxNames uint16, PatternLen uint16, Pattern string  // Request SetFontPath  // size: pad((8 + StrListSize(Font))) -type SetFontPathCookie cookie +type SetFontPathCookie struct { +	*cookie +}  // Write request to wire for SetFontPath  func (c *Conn) SetFontPath(FontQty uint16, Font []Str) SetFontPathCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(setFontPathRequest(FontQty, Font), cookie) -	return SetFontPathCookie(cookie) +	c.newRequest(c.setFontPathRequest(FontQty, Font), cookie) +	return SetFontPathCookie{cookie}  }  func (c *Conn) SetFontPathChecked(FontQty uint16, Font []Str) SetFontPathCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(setFontPathRequest(FontQty, Font), cookie) -	return SetFontPathCookie(cookie) +	c.newRequest(c.setFontPathRequest(FontQty, Font), cookie) +	return SetFontPathCookie{cookie} +} + +func (cook SetFontPathCookie) Check() error { +	return cook.check()  }  // Write request to wire for SetFontPath -func setFontPathRequest(FontQty uint16, Font []Str) []byte { +func (c *Conn) setFontPathRequest(FontQty uint16, Font []Str) []byte {  	size := pad((8 + StrListSize(Font)))  	b := 0  	buf := make([]byte, size) @@ -9141,18 +9917,20 @@ func setFontPathRequest(FontQty uint16, Font []Str) []byte {  // Request GetFontPath  // size: 4 -type GetFontPathCookie cookie +type GetFontPathCookie struct { +	*cookie +}  func (c *Conn) GetFontPath() GetFontPathCookie {  	cookie := c.newCookie(true, true) -	c.newRequest(getFontPathRequest(), cookie) -	return GetFontPathCookie(cookie) +	c.newRequest(c.getFontPathRequest(), cookie) +	return GetFontPathCookie{cookie}  }  func (c *Conn) GetFontPathUnchecked() GetFontPathCookie {  	cookie := c.newCookie(false, true) -	c.newRequest(getFontPathRequest(), cookie) -	return GetFontPathCookie(cookie) +	c.newRequest(c.getFontPathRequest(), cookie) +	return GetFontPathCookie{cookie}  }  // Request reply for GetFontPath @@ -9168,10 +9946,13 @@ type GetFontPathReply struct {  // Waits and reads reply data from request GetFontPath  func (cook GetFontPathCookie) Reply() (*GetFontPathReply, error) { -	buf, err := cookie(cook).reply() +	buf, err := cook.reply()  	if err != nil {  		return nil, err  	} +	if buf == nil { +		return nil, nil +	}  	return getFontPathReply(buf), nil  } @@ -9199,8 +9980,12 @@ func getFontPathReply(buf []byte) *GetFontPathReply {  	return v  } +func (cook GetFontPathCookie) Check() error { +	return cook.check() +} +  // Write request to wire for GetFontPath -func getFontPathRequest() []byte { +func (c *Conn) getFontPathRequest() []byte {  	size := 4  	b := 0  	buf := make([]byte, size) @@ -9208,28 +9993,38 @@ func getFontPathRequest() []byte {  	buf[b] = 52 // request opcode  	b += 1 +	b += 1                         // padding +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 +  	return buf  }  // Request CreatePixmap  // size: 16 -type CreatePixmapCookie cookie +type CreatePixmapCookie struct { +	*cookie +}  // Write request to wire for CreatePixmap  func (c *Conn) CreatePixmap(Depth byte, Pid Id, Drawable Id, Width uint16, Height uint16) CreatePixmapCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(createPixmapRequest(Depth, Pid, Drawable, Width, Height), cookie) -	return CreatePixmapCookie(cookie) +	c.newRequest(c.createPixmapRequest(Depth, Pid, Drawable, Width, Height), cookie) +	return CreatePixmapCookie{cookie}  }  func (c *Conn) CreatePixmapChecked(Depth byte, Pid Id, Drawable Id, Width uint16, Height uint16) CreatePixmapCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(createPixmapRequest(Depth, Pid, Drawable, Width, Height), cookie) -	return CreatePixmapCookie(cookie) +	c.newRequest(c.createPixmapRequest(Depth, Pid, Drawable, Width, Height), cookie) +	return CreatePixmapCookie{cookie} +} + +func (cook CreatePixmapCookie) Check() error { +	return cook.check()  }  // Write request to wire for CreatePixmap -func createPixmapRequest(Depth byte, Pid Id, Drawable Id, Width uint16, Height uint16) []byte { +func (c *Conn) createPixmapRequest(Depth byte, Pid Id, Drawable Id, Width uint16, Height uint16) []byte {  	size := 16  	b := 0  	buf := make([]byte, size) @@ -9260,23 +10055,29 @@ func createPixmapRequest(Depth byte, Pid Id, Drawable Id, Width uint16, Height u  // Request FreePixmap  // size: 8 -type FreePixmapCookie cookie +type FreePixmapCookie struct { +	*cookie +}  // Write request to wire for FreePixmap  func (c *Conn) FreePixmap(Pixmap Id) FreePixmapCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(freePixmapRequest(Pixmap), cookie) -	return FreePixmapCookie(cookie) +	c.newRequest(c.freePixmapRequest(Pixmap), cookie) +	return FreePixmapCookie{cookie}  }  func (c *Conn) FreePixmapChecked(Pixmap Id) FreePixmapCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(freePixmapRequest(Pixmap), cookie) -	return FreePixmapCookie(cookie) +	c.newRequest(c.freePixmapRequest(Pixmap), cookie) +	return FreePixmapCookie{cookie} +} + +func (cook FreePixmapCookie) Check() error { +	return cook.check()  }  // Write request to wire for FreePixmap -func freePixmapRequest(Pixmap Id) []byte { +func (c *Conn) freePixmapRequest(Pixmap Id) []byte {  	size := 8  	b := 0  	buf := make([]byte, size) @@ -9297,23 +10098,29 @@ func freePixmapRequest(Pixmap Id) []byte {  // Request CreateGC  // size: pad((12 + (4 + pad((4 * popCount(int(ValueMask))))))) -type CreateGCCookie cookie +type CreateGCCookie struct { +	*cookie +}  // Write request to wire for CreateGC  func (c *Conn) CreateGC(Cid Id, Drawable Id, ValueMask uint32, ValueList []uint32) CreateGCCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(createGCRequest(Cid, Drawable, ValueMask, ValueList), cookie) -	return CreateGCCookie(cookie) +	c.newRequest(c.createGCRequest(Cid, Drawable, ValueMask, ValueList), cookie) +	return CreateGCCookie{cookie}  }  func (c *Conn) CreateGCChecked(Cid Id, Drawable Id, ValueMask uint32, ValueList []uint32) CreateGCCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(createGCRequest(Cid, Drawable, ValueMask, ValueList), cookie) -	return CreateGCCookie(cookie) +	c.newRequest(c.createGCRequest(Cid, Drawable, ValueMask, ValueList), cookie) +	return CreateGCCookie{cookie} +} + +func (cook CreateGCCookie) Check() error { +	return cook.check()  }  // Write request to wire for CreateGC -func createGCRequest(Cid Id, Drawable Id, ValueMask uint32, ValueList []uint32) []byte { +func (c *Conn) createGCRequest(Cid Id, Drawable Id, ValueMask uint32, ValueList []uint32) []byte {  	size := pad((12 + (4 + pad((4 * popCount(int(ValueMask)))))))  	b := 0  	buf := make([]byte, size) @@ -9345,23 +10152,29 @@ func createGCRequest(Cid Id, Drawable Id, ValueMask uint32, ValueList []uint32)  // Request ChangeGC  // size: pad((8 + (4 + pad((4 * popCount(int(ValueMask))))))) -type ChangeGCCookie cookie +type ChangeGCCookie struct { +	*cookie +}  // Write request to wire for ChangeGC  func (c *Conn) ChangeGC(Gc Id, ValueMask uint32, ValueList []uint32) ChangeGCCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(changeGCRequest(Gc, ValueMask, ValueList), cookie) -	return ChangeGCCookie(cookie) +	c.newRequest(c.changeGCRequest(Gc, ValueMask, ValueList), cookie) +	return ChangeGCCookie{cookie}  }  func (c *Conn) ChangeGCChecked(Gc Id, ValueMask uint32, ValueList []uint32) ChangeGCCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(changeGCRequest(Gc, ValueMask, ValueList), cookie) -	return ChangeGCCookie(cookie) +	c.newRequest(c.changeGCRequest(Gc, ValueMask, ValueList), cookie) +	return ChangeGCCookie{cookie} +} + +func (cook ChangeGCCookie) Check() error { +	return cook.check()  }  // Write request to wire for ChangeGC -func changeGCRequest(Gc Id, ValueMask uint32, ValueList []uint32) []byte { +func (c *Conn) changeGCRequest(Gc Id, ValueMask uint32, ValueList []uint32) []byte {  	size := pad((8 + (4 + pad((4 * popCount(int(ValueMask)))))))  	b := 0  	buf := make([]byte, size) @@ -9390,23 +10203,29 @@ func changeGCRequest(Gc Id, ValueMask uint32, ValueList []uint32) []byte {  // Request CopyGC  // size: 16 -type CopyGCCookie cookie +type CopyGCCookie struct { +	*cookie +}  // Write request to wire for CopyGC  func (c *Conn) CopyGC(SrcGc Id, DstGc Id, ValueMask uint32) CopyGCCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(copyGCRequest(SrcGc, DstGc, ValueMask), cookie) -	return CopyGCCookie(cookie) +	c.newRequest(c.copyGCRequest(SrcGc, DstGc, ValueMask), cookie) +	return CopyGCCookie{cookie}  }  func (c *Conn) CopyGCChecked(SrcGc Id, DstGc Id, ValueMask uint32) CopyGCCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(copyGCRequest(SrcGc, DstGc, ValueMask), cookie) -	return CopyGCCookie(cookie) +	c.newRequest(c.copyGCRequest(SrcGc, DstGc, ValueMask), cookie) +	return CopyGCCookie{cookie} +} + +func (cook CopyGCCookie) Check() error { +	return cook.check()  }  // Write request to wire for CopyGC -func copyGCRequest(SrcGc Id, DstGc Id, ValueMask uint32) []byte { +func (c *Conn) copyGCRequest(SrcGc Id, DstGc Id, ValueMask uint32) []byte {  	size := 16  	b := 0  	buf := make([]byte, size) @@ -9433,23 +10252,29 @@ func copyGCRequest(SrcGc Id, DstGc Id, ValueMask uint32) []byte {  // Request SetDashes  // size: pad((12 + pad((int(DashesLen) * 1)))) -type SetDashesCookie cookie +type SetDashesCookie struct { +	*cookie +}  // Write request to wire for SetDashes  func (c *Conn) SetDashes(Gc Id, DashOffset uint16, DashesLen uint16, Dashes []byte) SetDashesCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(setDashesRequest(Gc, DashOffset, DashesLen, Dashes), cookie) -	return SetDashesCookie(cookie) +	c.newRequest(c.setDashesRequest(Gc, DashOffset, DashesLen, Dashes), cookie) +	return SetDashesCookie{cookie}  }  func (c *Conn) SetDashesChecked(Gc Id, DashOffset uint16, DashesLen uint16, Dashes []byte) SetDashesCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(setDashesRequest(Gc, DashOffset, DashesLen, Dashes), cookie) -	return SetDashesCookie(cookie) +	c.newRequest(c.setDashesRequest(Gc, DashOffset, DashesLen, Dashes), cookie) +	return SetDashesCookie{cookie} +} + +func (cook SetDashesCookie) Check() error { +	return cook.check()  }  // Write request to wire for SetDashes -func setDashesRequest(Gc Id, DashOffset uint16, DashesLen uint16, Dashes []byte) []byte { +func (c *Conn) setDashesRequest(Gc Id, DashOffset uint16, DashesLen uint16, Dashes []byte) []byte {  	size := pad((12 + pad((int(DashesLen) * 1))))  	b := 0  	buf := make([]byte, size) @@ -9479,23 +10304,29 @@ func setDashesRequest(Gc Id, DashOffset uint16, DashesLen uint16, Dashes []byte)  // Request SetClipRectangles  // size: pad((12 + pad((len(Rectangles) * 8)))) -type SetClipRectanglesCookie cookie +type SetClipRectanglesCookie struct { +	*cookie +}  // Write request to wire for SetClipRectangles  func (c *Conn) SetClipRectangles(Ordering byte, Gc Id, ClipXOrigin int16, ClipYOrigin int16, Rectangles []Rectangle) SetClipRectanglesCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(setClipRectanglesRequest(Ordering, Gc, ClipXOrigin, ClipYOrigin, Rectangles), cookie) -	return SetClipRectanglesCookie(cookie) +	c.newRequest(c.setClipRectanglesRequest(Ordering, Gc, ClipXOrigin, ClipYOrigin, Rectangles), cookie) +	return SetClipRectanglesCookie{cookie}  }  func (c *Conn) SetClipRectanglesChecked(Ordering byte, Gc Id, ClipXOrigin int16, ClipYOrigin int16, Rectangles []Rectangle) SetClipRectanglesCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(setClipRectanglesRequest(Ordering, Gc, ClipXOrigin, ClipYOrigin, Rectangles), cookie) -	return SetClipRectanglesCookie(cookie) +	c.newRequest(c.setClipRectanglesRequest(Ordering, Gc, ClipXOrigin, ClipYOrigin, Rectangles), cookie) +	return SetClipRectanglesCookie{cookie} +} + +func (cook SetClipRectanglesCookie) Check() error { +	return cook.check()  }  // Write request to wire for SetClipRectangles -func setClipRectanglesRequest(Ordering byte, Gc Id, ClipXOrigin int16, ClipYOrigin int16, Rectangles []Rectangle) []byte { +func (c *Conn) setClipRectanglesRequest(Ordering byte, Gc Id, ClipXOrigin int16, ClipYOrigin int16, Rectangles []Rectangle) []byte {  	size := pad((12 + pad((len(Rectangles) * 8))))  	b := 0  	buf := make([]byte, size) @@ -9525,23 +10356,29 @@ func setClipRectanglesRequest(Ordering byte, Gc Id, ClipXOrigin int16, ClipYOrig  // Request FreeGC  // size: 8 -type FreeGCCookie cookie +type FreeGCCookie struct { +	*cookie +}  // Write request to wire for FreeGC  func (c *Conn) FreeGC(Gc Id) FreeGCCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(freeGCRequest(Gc), cookie) -	return FreeGCCookie(cookie) +	c.newRequest(c.freeGCRequest(Gc), cookie) +	return FreeGCCookie{cookie}  }  func (c *Conn) FreeGCChecked(Gc Id) FreeGCCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(freeGCRequest(Gc), cookie) -	return FreeGCCookie(cookie) +	c.newRequest(c.freeGCRequest(Gc), cookie) +	return FreeGCCookie{cookie} +} + +func (cook FreeGCCookie) Check() error { +	return cook.check()  }  // Write request to wire for FreeGC -func freeGCRequest(Gc Id) []byte { +func (c *Conn) freeGCRequest(Gc Id) []byte {  	size := 8  	b := 0  	buf := make([]byte, size) @@ -9562,23 +10399,29 @@ func freeGCRequest(Gc Id) []byte {  // Request ClearArea  // size: 16 -type ClearAreaCookie cookie +type ClearAreaCookie struct { +	*cookie +}  // Write request to wire for ClearArea  func (c *Conn) ClearArea(Exposures bool, Window Id, X int16, Y int16, Width uint16, Height uint16) ClearAreaCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(clearAreaRequest(Exposures, Window, X, Y, Width, Height), cookie) -	return ClearAreaCookie(cookie) +	c.newRequest(c.clearAreaRequest(Exposures, Window, X, Y, Width, Height), cookie) +	return ClearAreaCookie{cookie}  }  func (c *Conn) ClearAreaChecked(Exposures bool, Window Id, X int16, Y int16, Width uint16, Height uint16) ClearAreaCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(clearAreaRequest(Exposures, Window, X, Y, Width, Height), cookie) -	return ClearAreaCookie(cookie) +	c.newRequest(c.clearAreaRequest(Exposures, Window, X, Y, Width, Height), cookie) +	return ClearAreaCookie{cookie} +} + +func (cook ClearAreaCookie) Check() error { +	return cook.check()  }  // Write request to wire for ClearArea -func clearAreaRequest(Exposures bool, Window Id, X int16, Y int16, Width uint16, Height uint16) []byte { +func (c *Conn) clearAreaRequest(Exposures bool, Window Id, X int16, Y int16, Width uint16, Height uint16) []byte {  	size := 16  	b := 0  	buf := make([]byte, size) @@ -9616,23 +10459,29 @@ func clearAreaRequest(Exposures bool, Window Id, X int16, Y int16, Width uint16,  // Request CopyArea  // size: 28 -type CopyAreaCookie cookie +type CopyAreaCookie struct { +	*cookie +}  // Write request to wire for CopyArea  func (c *Conn) CopyArea(SrcDrawable Id, DstDrawable Id, Gc Id, SrcX int16, SrcY int16, DstX int16, DstY int16, Width uint16, Height uint16) CopyAreaCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(copyAreaRequest(SrcDrawable, DstDrawable, Gc, SrcX, SrcY, DstX, DstY, Width, Height), cookie) -	return CopyAreaCookie(cookie) +	c.newRequest(c.copyAreaRequest(SrcDrawable, DstDrawable, Gc, SrcX, SrcY, DstX, DstY, Width, Height), cookie) +	return CopyAreaCookie{cookie}  }  func (c *Conn) CopyAreaChecked(SrcDrawable Id, DstDrawable Id, Gc Id, SrcX int16, SrcY int16, DstX int16, DstY int16, Width uint16, Height uint16) CopyAreaCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(copyAreaRequest(SrcDrawable, DstDrawable, Gc, SrcX, SrcY, DstX, DstY, Width, Height), cookie) -	return CopyAreaCookie(cookie) +	c.newRequest(c.copyAreaRequest(SrcDrawable, DstDrawable, Gc, SrcX, SrcY, DstX, DstY, Width, Height), cookie) +	return CopyAreaCookie{cookie} +} + +func (cook CopyAreaCookie) Check() error { +	return cook.check()  }  // Write request to wire for CopyArea -func copyAreaRequest(SrcDrawable Id, DstDrawable Id, Gc Id, SrcX int16, SrcY int16, DstX int16, DstY int16, Width uint16, Height uint16) []byte { +func (c *Conn) copyAreaRequest(SrcDrawable Id, DstDrawable Id, Gc Id, SrcX int16, SrcY int16, DstX int16, DstY int16, Width uint16, Height uint16) []byte {  	size := 28  	b := 0  	buf := make([]byte, size) @@ -9677,23 +10526,29 @@ func copyAreaRequest(SrcDrawable Id, DstDrawable Id, Gc Id, SrcX int16, SrcY int  // Request CopyPlane  // size: 32 -type CopyPlaneCookie cookie +type CopyPlaneCookie struct { +	*cookie +}  // Write request to wire for CopyPlane  func (c *Conn) CopyPlane(SrcDrawable Id, DstDrawable Id, Gc Id, SrcX int16, SrcY int16, DstX int16, DstY int16, Width uint16, Height uint16, BitPlane uint32) CopyPlaneCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(copyPlaneRequest(SrcDrawable, DstDrawable, Gc, SrcX, SrcY, DstX, DstY, Width, Height, BitPlane), cookie) -	return CopyPlaneCookie(cookie) +	c.newRequest(c.copyPlaneRequest(SrcDrawable, DstDrawable, Gc, SrcX, SrcY, DstX, DstY, Width, Height, BitPlane), cookie) +	return CopyPlaneCookie{cookie}  }  func (c *Conn) CopyPlaneChecked(SrcDrawable Id, DstDrawable Id, Gc Id, SrcX int16, SrcY int16, DstX int16, DstY int16, Width uint16, Height uint16, BitPlane uint32) CopyPlaneCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(copyPlaneRequest(SrcDrawable, DstDrawable, Gc, SrcX, SrcY, DstX, DstY, Width, Height, BitPlane), cookie) -	return CopyPlaneCookie(cookie) +	c.newRequest(c.copyPlaneRequest(SrcDrawable, DstDrawable, Gc, SrcX, SrcY, DstX, DstY, Width, Height, BitPlane), cookie) +	return CopyPlaneCookie{cookie} +} + +func (cook CopyPlaneCookie) Check() error { +	return cook.check()  }  // Write request to wire for CopyPlane -func copyPlaneRequest(SrcDrawable Id, DstDrawable Id, Gc Id, SrcX int16, SrcY int16, DstX int16, DstY int16, Width uint16, Height uint16, BitPlane uint32) []byte { +func (c *Conn) copyPlaneRequest(SrcDrawable Id, DstDrawable Id, Gc Id, SrcX int16, SrcY int16, DstX int16, DstY int16, Width uint16, Height uint16, BitPlane uint32) []byte {  	size := 32  	b := 0  	buf := make([]byte, size) @@ -9741,23 +10596,29 @@ func copyPlaneRequest(SrcDrawable Id, DstDrawable Id, Gc Id, SrcX int16, SrcY in  // Request PolyPoint  // size: pad((12 + pad((len(Points) * 4)))) -type PolyPointCookie cookie +type PolyPointCookie struct { +	*cookie +}  // Write request to wire for PolyPoint  func (c *Conn) PolyPoint(CoordinateMode byte, Drawable Id, Gc Id, Points []Point) PolyPointCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(polyPointRequest(CoordinateMode, Drawable, Gc, Points), cookie) -	return PolyPointCookie(cookie) +	c.newRequest(c.polyPointRequest(CoordinateMode, Drawable, Gc, Points), cookie) +	return PolyPointCookie{cookie}  }  func (c *Conn) PolyPointChecked(CoordinateMode byte, Drawable Id, Gc Id, Points []Point) PolyPointCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(polyPointRequest(CoordinateMode, Drawable, Gc, Points), cookie) -	return PolyPointCookie(cookie) +	c.newRequest(c.polyPointRequest(CoordinateMode, Drawable, Gc, Points), cookie) +	return PolyPointCookie{cookie} +} + +func (cook PolyPointCookie) Check() error { +	return cook.check()  }  // Write request to wire for PolyPoint -func polyPointRequest(CoordinateMode byte, Drawable Id, Gc Id, Points []Point) []byte { +func (c *Conn) polyPointRequest(CoordinateMode byte, Drawable Id, Gc Id, Points []Point) []byte {  	size := pad((12 + pad((len(Points) * 4))))  	b := 0  	buf := make([]byte, size) @@ -9784,23 +10645,29 @@ func polyPointRequest(CoordinateMode byte, Drawable Id, Gc Id, Points []Point) [  // Request PolyLine  // size: pad((12 + pad((len(Points) * 4)))) -type PolyLineCookie cookie +type PolyLineCookie struct { +	*cookie +}  // Write request to wire for PolyLine  func (c *Conn) PolyLine(CoordinateMode byte, Drawable Id, Gc Id, Points []Point) PolyLineCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(polyLineRequest(CoordinateMode, Drawable, Gc, Points), cookie) -	return PolyLineCookie(cookie) +	c.newRequest(c.polyLineRequest(CoordinateMode, Drawable, Gc, Points), cookie) +	return PolyLineCookie{cookie}  }  func (c *Conn) PolyLineChecked(CoordinateMode byte, Drawable Id, Gc Id, Points []Point) PolyLineCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(polyLineRequest(CoordinateMode, Drawable, Gc, Points), cookie) -	return PolyLineCookie(cookie) +	c.newRequest(c.polyLineRequest(CoordinateMode, Drawable, Gc, Points), cookie) +	return PolyLineCookie{cookie} +} + +func (cook PolyLineCookie) Check() error { +	return cook.check()  }  // Write request to wire for PolyLine -func polyLineRequest(CoordinateMode byte, Drawable Id, Gc Id, Points []Point) []byte { +func (c *Conn) polyLineRequest(CoordinateMode byte, Drawable Id, Gc Id, Points []Point) []byte {  	size := pad((12 + pad((len(Points) * 4))))  	b := 0  	buf := make([]byte, size) @@ -9827,23 +10694,29 @@ func polyLineRequest(CoordinateMode byte, Drawable Id, Gc Id, Points []Point) []  // Request PolySegment  // size: pad((12 + pad((len(Segments) * 8)))) -type PolySegmentCookie cookie +type PolySegmentCookie struct { +	*cookie +}  // Write request to wire for PolySegment  func (c *Conn) PolySegment(Drawable Id, Gc Id, Segments []Segment) PolySegmentCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(polySegmentRequest(Drawable, Gc, Segments), cookie) -	return PolySegmentCookie(cookie) +	c.newRequest(c.polySegmentRequest(Drawable, Gc, Segments), cookie) +	return PolySegmentCookie{cookie}  }  func (c *Conn) PolySegmentChecked(Drawable Id, Gc Id, Segments []Segment) PolySegmentCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(polySegmentRequest(Drawable, Gc, Segments), cookie) -	return PolySegmentCookie(cookie) +	c.newRequest(c.polySegmentRequest(Drawable, Gc, Segments), cookie) +	return PolySegmentCookie{cookie} +} + +func (cook PolySegmentCookie) Check() error { +	return cook.check()  }  // Write request to wire for PolySegment -func polySegmentRequest(Drawable Id, Gc Id, Segments []Segment) []byte { +func (c *Conn) polySegmentRequest(Drawable Id, Gc Id, Segments []Segment) []byte {  	size := pad((12 + pad((len(Segments) * 8))))  	b := 0  	buf := make([]byte, size) @@ -9869,23 +10742,29 @@ func polySegmentRequest(Drawable Id, Gc Id, Segments []Segment) []byte {  // Request PolyRectangle  // size: pad((12 + pad((len(Rectangles) * 8)))) -type PolyRectangleCookie cookie +type PolyRectangleCookie struct { +	*cookie +}  // Write request to wire for PolyRectangle  func (c *Conn) PolyRectangle(Drawable Id, Gc Id, Rectangles []Rectangle) PolyRectangleCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(polyRectangleRequest(Drawable, Gc, Rectangles), cookie) -	return PolyRectangleCookie(cookie) +	c.newRequest(c.polyRectangleRequest(Drawable, Gc, Rectangles), cookie) +	return PolyRectangleCookie{cookie}  }  func (c *Conn) PolyRectangleChecked(Drawable Id, Gc Id, Rectangles []Rectangle) PolyRectangleCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(polyRectangleRequest(Drawable, Gc, Rectangles), cookie) -	return PolyRectangleCookie(cookie) +	c.newRequest(c.polyRectangleRequest(Drawable, Gc, Rectangles), cookie) +	return PolyRectangleCookie{cookie} +} + +func (cook PolyRectangleCookie) Check() error { +	return cook.check()  }  // Write request to wire for PolyRectangle -func polyRectangleRequest(Drawable Id, Gc Id, Rectangles []Rectangle) []byte { +func (c *Conn) polyRectangleRequest(Drawable Id, Gc Id, Rectangles []Rectangle) []byte {  	size := pad((12 + pad((len(Rectangles) * 8))))  	b := 0  	buf := make([]byte, size) @@ -9911,23 +10790,29 @@ func polyRectangleRequest(Drawable Id, Gc Id, Rectangles []Rectangle) []byte {  // Request PolyArc  // size: pad((12 + pad((len(Arcs) * 12)))) -type PolyArcCookie cookie +type PolyArcCookie struct { +	*cookie +}  // Write request to wire for PolyArc  func (c *Conn) PolyArc(Drawable Id, Gc Id, Arcs []Arc) PolyArcCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(polyArcRequest(Drawable, Gc, Arcs), cookie) -	return PolyArcCookie(cookie) +	c.newRequest(c.polyArcRequest(Drawable, Gc, Arcs), cookie) +	return PolyArcCookie{cookie}  }  func (c *Conn) PolyArcChecked(Drawable Id, Gc Id, Arcs []Arc) PolyArcCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(polyArcRequest(Drawable, Gc, Arcs), cookie) -	return PolyArcCookie(cookie) +	c.newRequest(c.polyArcRequest(Drawable, Gc, Arcs), cookie) +	return PolyArcCookie{cookie} +} + +func (cook PolyArcCookie) Check() error { +	return cook.check()  }  // Write request to wire for PolyArc -func polyArcRequest(Drawable Id, Gc Id, Arcs []Arc) []byte { +func (c *Conn) polyArcRequest(Drawable Id, Gc Id, Arcs []Arc) []byte {  	size := pad((12 + pad((len(Arcs) * 12))))  	b := 0  	buf := make([]byte, size) @@ -9953,23 +10838,29 @@ func polyArcRequest(Drawable Id, Gc Id, Arcs []Arc) []byte {  // Request FillPoly  // size: pad((16 + pad((len(Points) * 4)))) -type FillPolyCookie cookie +type FillPolyCookie struct { +	*cookie +}  // Write request to wire for FillPoly  func (c *Conn) FillPoly(Drawable Id, Gc Id, Shape byte, CoordinateMode byte, Points []Point) FillPolyCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(fillPolyRequest(Drawable, Gc, Shape, CoordinateMode, Points), cookie) -	return FillPolyCookie(cookie) +	c.newRequest(c.fillPolyRequest(Drawable, Gc, Shape, CoordinateMode, Points), cookie) +	return FillPolyCookie{cookie}  }  func (c *Conn) FillPolyChecked(Drawable Id, Gc Id, Shape byte, CoordinateMode byte, Points []Point) FillPolyCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(fillPolyRequest(Drawable, Gc, Shape, CoordinateMode, Points), cookie) -	return FillPolyCookie(cookie) +	c.newRequest(c.fillPolyRequest(Drawable, Gc, Shape, CoordinateMode, Points), cookie) +	return FillPolyCookie{cookie} +} + +func (cook FillPolyCookie) Check() error { +	return cook.check()  }  // Write request to wire for FillPoly -func fillPolyRequest(Drawable Id, Gc Id, Shape byte, CoordinateMode byte, Points []Point) []byte { +func (c *Conn) fillPolyRequest(Drawable Id, Gc Id, Shape byte, CoordinateMode byte, Points []Point) []byte {  	size := pad((16 + pad((len(Points) * 4))))  	b := 0  	buf := make([]byte, size) @@ -10003,23 +10894,29 @@ func fillPolyRequest(Drawable Id, Gc Id, Shape byte, CoordinateMode byte, Points  // Request PolyFillRectangle  // size: pad((12 + pad((len(Rectangles) * 8)))) -type PolyFillRectangleCookie cookie +type PolyFillRectangleCookie struct { +	*cookie +}  // Write request to wire for PolyFillRectangle  func (c *Conn) PolyFillRectangle(Drawable Id, Gc Id, Rectangles []Rectangle) PolyFillRectangleCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(polyFillRectangleRequest(Drawable, Gc, Rectangles), cookie) -	return PolyFillRectangleCookie(cookie) +	c.newRequest(c.polyFillRectangleRequest(Drawable, Gc, Rectangles), cookie) +	return PolyFillRectangleCookie{cookie}  }  func (c *Conn) PolyFillRectangleChecked(Drawable Id, Gc Id, Rectangles []Rectangle) PolyFillRectangleCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(polyFillRectangleRequest(Drawable, Gc, Rectangles), cookie) -	return PolyFillRectangleCookie(cookie) +	c.newRequest(c.polyFillRectangleRequest(Drawable, Gc, Rectangles), cookie) +	return PolyFillRectangleCookie{cookie} +} + +func (cook PolyFillRectangleCookie) Check() error { +	return cook.check()  }  // Write request to wire for PolyFillRectangle -func polyFillRectangleRequest(Drawable Id, Gc Id, Rectangles []Rectangle) []byte { +func (c *Conn) polyFillRectangleRequest(Drawable Id, Gc Id, Rectangles []Rectangle) []byte {  	size := pad((12 + pad((len(Rectangles) * 8))))  	b := 0  	buf := make([]byte, size) @@ -10045,23 +10942,29 @@ func polyFillRectangleRequest(Drawable Id, Gc Id, Rectangles []Rectangle) []byte  // Request PolyFillArc  // size: pad((12 + pad((len(Arcs) * 12)))) -type PolyFillArcCookie cookie +type PolyFillArcCookie struct { +	*cookie +}  // Write request to wire for PolyFillArc  func (c *Conn) PolyFillArc(Drawable Id, Gc Id, Arcs []Arc) PolyFillArcCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(polyFillArcRequest(Drawable, Gc, Arcs), cookie) -	return PolyFillArcCookie(cookie) +	c.newRequest(c.polyFillArcRequest(Drawable, Gc, Arcs), cookie) +	return PolyFillArcCookie{cookie}  }  func (c *Conn) PolyFillArcChecked(Drawable Id, Gc Id, Arcs []Arc) PolyFillArcCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(polyFillArcRequest(Drawable, Gc, Arcs), cookie) -	return PolyFillArcCookie(cookie) +	c.newRequest(c.polyFillArcRequest(Drawable, Gc, Arcs), cookie) +	return PolyFillArcCookie{cookie} +} + +func (cook PolyFillArcCookie) Check() error { +	return cook.check()  }  // Write request to wire for PolyFillArc -func polyFillArcRequest(Drawable Id, Gc Id, Arcs []Arc) []byte { +func (c *Conn) polyFillArcRequest(Drawable Id, Gc Id, Arcs []Arc) []byte {  	size := pad((12 + pad((len(Arcs) * 12))))  	b := 0  	buf := make([]byte, size) @@ -10087,23 +10990,29 @@ func polyFillArcRequest(Drawable Id, Gc Id, Arcs []Arc) []byte {  // Request PutImage  // size: pad((24 + pad((len(Data) * 1)))) -type PutImageCookie cookie +type PutImageCookie struct { +	*cookie +}  // Write request to wire for PutImage  func (c *Conn) PutImage(Format byte, Drawable Id, Gc Id, Width uint16, Height uint16, DstX int16, DstY int16, LeftPad byte, Depth byte, Data []byte) PutImageCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(putImageRequest(Format, Drawable, Gc, Width, Height, DstX, DstY, LeftPad, Depth, Data), cookie) -	return PutImageCookie(cookie) +	c.newRequest(c.putImageRequest(Format, Drawable, Gc, Width, Height, DstX, DstY, LeftPad, Depth, Data), cookie) +	return PutImageCookie{cookie}  }  func (c *Conn) PutImageChecked(Format byte, Drawable Id, Gc Id, Width uint16, Height uint16, DstX int16, DstY int16, LeftPad byte, Depth byte, Data []byte) PutImageCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(putImageRequest(Format, Drawable, Gc, Width, Height, DstX, DstY, LeftPad, Depth, Data), cookie) -	return PutImageCookie(cookie) +	c.newRequest(c.putImageRequest(Format, Drawable, Gc, Width, Height, DstX, DstY, LeftPad, Depth, Data), cookie) +	return PutImageCookie{cookie} +} + +func (cook PutImageCookie) Check() error { +	return cook.check()  }  // Write request to wire for PutImage -func putImageRequest(Format byte, Drawable Id, Gc Id, Width uint16, Height uint16, DstX int16, DstY int16, LeftPad byte, Depth byte, Data []byte) []byte { +func (c *Conn) putImageRequest(Format byte, Drawable Id, Gc Id, Width uint16, Height uint16, DstX int16, DstY int16, LeftPad byte, Depth byte, Data []byte) []byte {  	size := pad((24 + pad((len(Data) * 1))))  	b := 0  	buf := make([]byte, size) @@ -10151,18 +11060,20 @@ func putImageRequest(Format byte, Drawable Id, Gc Id, Width uint16, Height uint1  // Request GetImage  // size: 20 -type GetImageCookie cookie +type GetImageCookie struct { +	*cookie +}  func (c *Conn) GetImage(Format byte, Drawable Id, X int16, Y int16, Width uint16, Height uint16, PlaneMask uint32) GetImageCookie {  	cookie := c.newCookie(true, true) -	c.newRequest(getImageRequest(Format, Drawable, X, Y, Width, Height, PlaneMask), cookie) -	return GetImageCookie(cookie) +	c.newRequest(c.getImageRequest(Format, Drawable, X, Y, Width, Height, PlaneMask), cookie) +	return GetImageCookie{cookie}  }  func (c *Conn) GetImageUnchecked(Format byte, Drawable Id, X int16, Y int16, Width uint16, Height uint16, PlaneMask uint32) GetImageCookie {  	cookie := c.newCookie(false, true) -	c.newRequest(getImageRequest(Format, Drawable, X, Y, Width, Height, PlaneMask), cookie) -	return GetImageCookie(cookie) +	c.newRequest(c.getImageRequest(Format, Drawable, X, Y, Width, Height, PlaneMask), cookie) +	return GetImageCookie{cookie}  }  // Request reply for GetImage @@ -10178,10 +11089,13 @@ type GetImageReply struct {  // Waits and reads reply data from request GetImage  func (cook GetImageCookie) Reply() (*GetImageReply, error) { -	buf, err := cookie(cook).reply() +	buf, err := cook.reply()  	if err != nil {  		return nil, err  	} +	if buf == nil { +		return nil, nil +	}  	return getImageReply(buf), nil  } @@ -10211,8 +11125,12 @@ func getImageReply(buf []byte) *GetImageReply {  	return v  } +func (cook GetImageCookie) Check() error { +	return cook.check() +} +  // Write request to wire for GetImage -func getImageRequest(Format byte, Drawable Id, X int16, Y int16, Width uint16, Height uint16, PlaneMask uint32) []byte { +func (c *Conn) getImageRequest(Format byte, Drawable Id, X int16, Y int16, Width uint16, Height uint16, PlaneMask uint32) []byte {  	size := 20  	b := 0  	buf := make([]byte, size) @@ -10249,23 +11167,29 @@ func getImageRequest(Format byte, Drawable Id, X int16, Y int16, Width uint16, H  // Request PolyText8  // size: pad((16 + pad((len(Items) * 1)))) -type PolyText8Cookie cookie +type PolyText8Cookie struct { +	*cookie +}  // Write request to wire for PolyText8  func (c *Conn) PolyText8(Drawable Id, Gc Id, X int16, Y int16, Items []byte) PolyText8Cookie {  	cookie := c.newCookie(false, false) -	c.newRequest(polyText8Request(Drawable, Gc, X, Y, Items), cookie) -	return PolyText8Cookie(cookie) +	c.newRequest(c.polyText8Request(Drawable, Gc, X, Y, Items), cookie) +	return PolyText8Cookie{cookie}  }  func (c *Conn) PolyText8Checked(Drawable Id, Gc Id, X int16, Y int16, Items []byte) PolyText8Cookie {  	cookie := c.newCookie(true, false) -	c.newRequest(polyText8Request(Drawable, Gc, X, Y, Items), cookie) -	return PolyText8Cookie(cookie) +	c.newRequest(c.polyText8Request(Drawable, Gc, X, Y, Items), cookie) +	return PolyText8Cookie{cookie} +} + +func (cook PolyText8Cookie) Check() error { +	return cook.check()  }  // Write request to wire for PolyText8 -func polyText8Request(Drawable Id, Gc Id, X int16, Y int16, Items []byte) []byte { +func (c *Conn) polyText8Request(Drawable Id, Gc Id, X int16, Y int16, Items []byte) []byte {  	size := pad((16 + pad((len(Items) * 1))))  	b := 0  	buf := make([]byte, size) @@ -10298,23 +11222,29 @@ func polyText8Request(Drawable Id, Gc Id, X int16, Y int16, Items []byte) []byte  // Request PolyText16  // size: pad((16 + pad((len(Items) * 1)))) -type PolyText16Cookie cookie +type PolyText16Cookie struct { +	*cookie +}  // Write request to wire for PolyText16  func (c *Conn) PolyText16(Drawable Id, Gc Id, X int16, Y int16, Items []byte) PolyText16Cookie {  	cookie := c.newCookie(false, false) -	c.newRequest(polyText16Request(Drawable, Gc, X, Y, Items), cookie) -	return PolyText16Cookie(cookie) +	c.newRequest(c.polyText16Request(Drawable, Gc, X, Y, Items), cookie) +	return PolyText16Cookie{cookie}  }  func (c *Conn) PolyText16Checked(Drawable Id, Gc Id, X int16, Y int16, Items []byte) PolyText16Cookie {  	cookie := c.newCookie(true, false) -	c.newRequest(polyText16Request(Drawable, Gc, X, Y, Items), cookie) -	return PolyText16Cookie(cookie) +	c.newRequest(c.polyText16Request(Drawable, Gc, X, Y, Items), cookie) +	return PolyText16Cookie{cookie} +} + +func (cook PolyText16Cookie) Check() error { +	return cook.check()  }  // Write request to wire for PolyText16 -func polyText16Request(Drawable Id, Gc Id, X int16, Y int16, Items []byte) []byte { +func (c *Conn) polyText16Request(Drawable Id, Gc Id, X int16, Y int16, Items []byte) []byte {  	size := pad((16 + pad((len(Items) * 1))))  	b := 0  	buf := make([]byte, size) @@ -10347,23 +11277,29 @@ func polyText16Request(Drawable Id, Gc Id, X int16, Y int16, Items []byte) []byt  // Request ImageText8  // size: pad((16 + pad((int(StringLen) * 1)))) -type ImageText8Cookie cookie +type ImageText8Cookie struct { +	*cookie +}  // Write request to wire for ImageText8  func (c *Conn) ImageText8(StringLen byte, Drawable Id, Gc Id, X int16, Y int16, String string) ImageText8Cookie {  	cookie := c.newCookie(false, false) -	c.newRequest(imageText8Request(StringLen, Drawable, Gc, X, Y, String), cookie) -	return ImageText8Cookie(cookie) +	c.newRequest(c.imageText8Request(StringLen, Drawable, Gc, X, Y, String), cookie) +	return ImageText8Cookie{cookie}  }  func (c *Conn) ImageText8Checked(StringLen byte, Drawable Id, Gc Id, X int16, Y int16, String string) ImageText8Cookie {  	cookie := c.newCookie(true, false) -	c.newRequest(imageText8Request(StringLen, Drawable, Gc, X, Y, String), cookie) -	return ImageText8Cookie(cookie) +	c.newRequest(c.imageText8Request(StringLen, Drawable, Gc, X, Y, String), cookie) +	return ImageText8Cookie{cookie} +} + +func (cook ImageText8Cookie) Check() error { +	return cook.check()  }  // Write request to wire for ImageText8 -func imageText8Request(StringLen byte, Drawable Id, Gc Id, X int16, Y int16, String string) []byte { +func (c *Conn) imageText8Request(StringLen byte, Drawable Id, Gc Id, X int16, Y int16, String string) []byte {  	size := pad((16 + pad((int(StringLen) * 1))))  	b := 0  	buf := make([]byte, size) @@ -10397,23 +11333,29 @@ func imageText8Request(StringLen byte, Drawable Id, Gc Id, X int16, Y int16, Str  // Request ImageText16  // size: pad((16 + pad((int(StringLen) * 2)))) -type ImageText16Cookie cookie +type ImageText16Cookie struct { +	*cookie +}  // Write request to wire for ImageText16  func (c *Conn) ImageText16(StringLen byte, Drawable Id, Gc Id, X int16, Y int16, String []Char2b) ImageText16Cookie {  	cookie := c.newCookie(false, false) -	c.newRequest(imageText16Request(StringLen, Drawable, Gc, X, Y, String), cookie) -	return ImageText16Cookie(cookie) +	c.newRequest(c.imageText16Request(StringLen, Drawable, Gc, X, Y, String), cookie) +	return ImageText16Cookie{cookie}  }  func (c *Conn) ImageText16Checked(StringLen byte, Drawable Id, Gc Id, X int16, Y int16, String []Char2b) ImageText16Cookie {  	cookie := c.newCookie(true, false) -	c.newRequest(imageText16Request(StringLen, Drawable, Gc, X, Y, String), cookie) -	return ImageText16Cookie(cookie) +	c.newRequest(c.imageText16Request(StringLen, Drawable, Gc, X, Y, String), cookie) +	return ImageText16Cookie{cookie} +} + +func (cook ImageText16Cookie) Check() error { +	return cook.check()  }  // Write request to wire for ImageText16 -func imageText16Request(StringLen byte, Drawable Id, Gc Id, X int16, Y int16, String []Char2b) []byte { +func (c *Conn) imageText16Request(StringLen byte, Drawable Id, Gc Id, X int16, Y int16, String []Char2b) []byte {  	size := pad((16 + pad((int(StringLen) * 2))))  	b := 0  	buf := make([]byte, size) @@ -10446,23 +11388,29 @@ func imageText16Request(StringLen byte, Drawable Id, Gc Id, X int16, Y int16, St  // Request CreateColormap  // size: 16 -type CreateColormapCookie cookie +type CreateColormapCookie struct { +	*cookie +}  // Write request to wire for CreateColormap  func (c *Conn) CreateColormap(Alloc byte, Mid Id, Window Id, Visual Visualid) CreateColormapCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(createColormapRequest(Alloc, Mid, Window, Visual), cookie) -	return CreateColormapCookie(cookie) +	c.newRequest(c.createColormapRequest(Alloc, Mid, Window, Visual), cookie) +	return CreateColormapCookie{cookie}  }  func (c *Conn) CreateColormapChecked(Alloc byte, Mid Id, Window Id, Visual Visualid) CreateColormapCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(createColormapRequest(Alloc, Mid, Window, Visual), cookie) -	return CreateColormapCookie(cookie) +	c.newRequest(c.createColormapRequest(Alloc, Mid, Window, Visual), cookie) +	return CreateColormapCookie{cookie} +} + +func (cook CreateColormapCookie) Check() error { +	return cook.check()  }  // Write request to wire for CreateColormap -func createColormapRequest(Alloc byte, Mid Id, Window Id, Visual Visualid) []byte { +func (c *Conn) createColormapRequest(Alloc byte, Mid Id, Window Id, Visual Visualid) []byte {  	size := 16  	b := 0  	buf := make([]byte, size) @@ -10490,23 +11438,29 @@ func createColormapRequest(Alloc byte, Mid Id, Window Id, Visual Visualid) []byt  // Request FreeColormap  // size: 8 -type FreeColormapCookie cookie +type FreeColormapCookie struct { +	*cookie +}  // Write request to wire for FreeColormap  func (c *Conn) FreeColormap(Cmap Id) FreeColormapCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(freeColormapRequest(Cmap), cookie) -	return FreeColormapCookie(cookie) +	c.newRequest(c.freeColormapRequest(Cmap), cookie) +	return FreeColormapCookie{cookie}  }  func (c *Conn) FreeColormapChecked(Cmap Id) FreeColormapCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(freeColormapRequest(Cmap), cookie) -	return FreeColormapCookie(cookie) +	c.newRequest(c.freeColormapRequest(Cmap), cookie) +	return FreeColormapCookie{cookie} +} + +func (cook FreeColormapCookie) Check() error { +	return cook.check()  }  // Write request to wire for FreeColormap -func freeColormapRequest(Cmap Id) []byte { +func (c *Conn) freeColormapRequest(Cmap Id) []byte {  	size := 8  	b := 0  	buf := make([]byte, size) @@ -10527,23 +11481,29 @@ func freeColormapRequest(Cmap Id) []byte {  // Request CopyColormapAndFree  // size: 12 -type CopyColormapAndFreeCookie cookie +type CopyColormapAndFreeCookie struct { +	*cookie +}  // Write request to wire for CopyColormapAndFree  func (c *Conn) CopyColormapAndFree(Mid Id, SrcCmap Id) CopyColormapAndFreeCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(copyColormapAndFreeRequest(Mid, SrcCmap), cookie) -	return CopyColormapAndFreeCookie(cookie) +	c.newRequest(c.copyColormapAndFreeRequest(Mid, SrcCmap), cookie) +	return CopyColormapAndFreeCookie{cookie}  }  func (c *Conn) CopyColormapAndFreeChecked(Mid Id, SrcCmap Id) CopyColormapAndFreeCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(copyColormapAndFreeRequest(Mid, SrcCmap), cookie) -	return CopyColormapAndFreeCookie(cookie) +	c.newRequest(c.copyColormapAndFreeRequest(Mid, SrcCmap), cookie) +	return CopyColormapAndFreeCookie{cookie} +} + +func (cook CopyColormapAndFreeCookie) Check() error { +	return cook.check()  }  // Write request to wire for CopyColormapAndFree -func copyColormapAndFreeRequest(Mid Id, SrcCmap Id) []byte { +func (c *Conn) copyColormapAndFreeRequest(Mid Id, SrcCmap Id) []byte {  	size := 12  	b := 0  	buf := make([]byte, size) @@ -10567,23 +11527,29 @@ func copyColormapAndFreeRequest(Mid Id, SrcCmap Id) []byte {  // Request InstallColormap  // size: 8 -type InstallColormapCookie cookie +type InstallColormapCookie struct { +	*cookie +}  // Write request to wire for InstallColormap  func (c *Conn) InstallColormap(Cmap Id) InstallColormapCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(installColormapRequest(Cmap), cookie) -	return InstallColormapCookie(cookie) +	c.newRequest(c.installColormapRequest(Cmap), cookie) +	return InstallColormapCookie{cookie}  }  func (c *Conn) InstallColormapChecked(Cmap Id) InstallColormapCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(installColormapRequest(Cmap), cookie) -	return InstallColormapCookie(cookie) +	c.newRequest(c.installColormapRequest(Cmap), cookie) +	return InstallColormapCookie{cookie} +} + +func (cook InstallColormapCookie) Check() error { +	return cook.check()  }  // Write request to wire for InstallColormap -func installColormapRequest(Cmap Id) []byte { +func (c *Conn) installColormapRequest(Cmap Id) []byte {  	size := 8  	b := 0  	buf := make([]byte, size) @@ -10604,23 +11570,29 @@ func installColormapRequest(Cmap Id) []byte {  // Request UninstallColormap  // size: 8 -type UninstallColormapCookie cookie +type UninstallColormapCookie struct { +	*cookie +}  // Write request to wire for UninstallColormap  func (c *Conn) UninstallColormap(Cmap Id) UninstallColormapCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(uninstallColormapRequest(Cmap), cookie) -	return UninstallColormapCookie(cookie) +	c.newRequest(c.uninstallColormapRequest(Cmap), cookie) +	return UninstallColormapCookie{cookie}  }  func (c *Conn) UninstallColormapChecked(Cmap Id) UninstallColormapCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(uninstallColormapRequest(Cmap), cookie) -	return UninstallColormapCookie(cookie) +	c.newRequest(c.uninstallColormapRequest(Cmap), cookie) +	return UninstallColormapCookie{cookie} +} + +func (cook UninstallColormapCookie) Check() error { +	return cook.check()  }  // Write request to wire for UninstallColormap -func uninstallColormapRequest(Cmap Id) []byte { +func (c *Conn) uninstallColormapRequest(Cmap Id) []byte {  	size := 8  	b := 0  	buf := make([]byte, size) @@ -10641,18 +11613,20 @@ func uninstallColormapRequest(Cmap Id) []byte {  // Request ListInstalledColormaps  // size: 8 -type ListInstalledColormapsCookie cookie +type ListInstalledColormapsCookie struct { +	*cookie +}  func (c *Conn) ListInstalledColormaps(Window Id) ListInstalledColormapsCookie {  	cookie := c.newCookie(true, true) -	c.newRequest(listInstalledColormapsRequest(Window), cookie) -	return ListInstalledColormapsCookie(cookie) +	c.newRequest(c.listInstalledColormapsRequest(Window), cookie) +	return ListInstalledColormapsCookie{cookie}  }  func (c *Conn) ListInstalledColormapsUnchecked(Window Id) ListInstalledColormapsCookie {  	cookie := c.newCookie(false, true) -	c.newRequest(listInstalledColormapsRequest(Window), cookie) -	return ListInstalledColormapsCookie(cookie) +	c.newRequest(c.listInstalledColormapsRequest(Window), cookie) +	return ListInstalledColormapsCookie{cookie}  }  // Request reply for ListInstalledColormaps @@ -10668,10 +11642,13 @@ type ListInstalledColormapsReply struct {  // Waits and reads reply data from request ListInstalledColormaps  func (cook ListInstalledColormapsCookie) Reply() (*ListInstalledColormapsReply, error) { -	buf, err := cookie(cook).reply() +	buf, err := cook.reply()  	if err != nil {  		return nil, err  	} +	if buf == nil { +		return nil, nil +	}  	return listInstalledColormapsReply(buf), nil  } @@ -10703,8 +11680,12 @@ func listInstalledColormapsReply(buf []byte) *ListInstalledColormapsReply {  	return v  } +func (cook ListInstalledColormapsCookie) Check() error { +	return cook.check() +} +  // Write request to wire for ListInstalledColormaps -func listInstalledColormapsRequest(Window Id) []byte { +func (c *Conn) listInstalledColormapsRequest(Window Id) []byte {  	size := 8  	b := 0  	buf := make([]byte, size) @@ -10725,18 +11706,20 @@ func listInstalledColormapsRequest(Window Id) []byte {  // Request AllocColor  // size: 16 -type AllocColorCookie cookie +type AllocColorCookie struct { +	*cookie +}  func (c *Conn) AllocColor(Cmap Id, Red uint16, Green uint16, Blue uint16) AllocColorCookie {  	cookie := c.newCookie(true, true) -	c.newRequest(allocColorRequest(Cmap, Red, Green, Blue), cookie) -	return AllocColorCookie(cookie) +	c.newRequest(c.allocColorRequest(Cmap, Red, Green, Blue), cookie) +	return AllocColorCookie{cookie}  }  func (c *Conn) AllocColorUnchecked(Cmap Id, Red uint16, Green uint16, Blue uint16) AllocColorCookie {  	cookie := c.newCookie(false, true) -	c.newRequest(allocColorRequest(Cmap, Red, Green, Blue), cookie) -	return AllocColorCookie(cookie) +	c.newRequest(c.allocColorRequest(Cmap, Red, Green, Blue), cookie) +	return AllocColorCookie{cookie}  }  // Request reply for AllocColor @@ -10754,10 +11737,13 @@ type AllocColorReply struct {  // Waits and reads reply data from request AllocColor  func (cook AllocColorCookie) Reply() (*AllocColorReply, error) { -	buf, err := cookie(cook).reply() +	buf, err := cook.reply()  	if err != nil {  		return nil, err  	} +	if buf == nil { +		return nil, nil +	}  	return allocColorReply(buf), nil  } @@ -10791,8 +11777,12 @@ func allocColorReply(buf []byte) *AllocColorReply {  	return v  } +func (cook AllocColorCookie) Check() error { +	return cook.check() +} +  // Write request to wire for AllocColor -func allocColorRequest(Cmap Id, Red uint16, Green uint16, Blue uint16) []byte { +func (c *Conn) allocColorRequest(Cmap Id, Red uint16, Green uint16, Blue uint16) []byte {  	size := 16  	b := 0  	buf := make([]byte, size) @@ -10824,18 +11814,20 @@ func allocColorRequest(Cmap Id, Red uint16, Green uint16, Blue uint16) []byte {  // Request AllocNamedColor  // size: pad((12 + pad((int(NameLen) * 1)))) -type AllocNamedColorCookie cookie +type AllocNamedColorCookie struct { +	*cookie +}  func (c *Conn) AllocNamedColor(Cmap Id, NameLen uint16, Name string) AllocNamedColorCookie {  	cookie := c.newCookie(true, true) -	c.newRequest(allocNamedColorRequest(Cmap, NameLen, Name), cookie) -	return AllocNamedColorCookie(cookie) +	c.newRequest(c.allocNamedColorRequest(Cmap, NameLen, Name), cookie) +	return AllocNamedColorCookie{cookie}  }  func (c *Conn) AllocNamedColorUnchecked(Cmap Id, NameLen uint16, Name string) AllocNamedColorCookie {  	cookie := c.newCookie(false, true) -	c.newRequest(allocNamedColorRequest(Cmap, NameLen, Name), cookie) -	return AllocNamedColorCookie(cookie) +	c.newRequest(c.allocNamedColorRequest(Cmap, NameLen, Name), cookie) +	return AllocNamedColorCookie{cookie}  }  // Request reply for AllocNamedColor @@ -10855,10 +11847,13 @@ type AllocNamedColorReply struct {  // Waits and reads reply data from request AllocNamedColor  func (cook AllocNamedColorCookie) Reply() (*AllocNamedColorReply, error) { -	buf, err := cookie(cook).reply() +	buf, err := cook.reply()  	if err != nil {  		return nil, err  	} +	if buf == nil { +		return nil, nil +	}  	return allocNamedColorReply(buf), nil  } @@ -10899,8 +11894,12 @@ func allocNamedColorReply(buf []byte) *AllocNamedColorReply {  	return v  } +func (cook AllocNamedColorCookie) Check() error { +	return cook.check() +} +  // Write request to wire for AllocNamedColor -func allocNamedColorRequest(Cmap Id, NameLen uint16, Name string) []byte { +func (c *Conn) allocNamedColorRequest(Cmap Id, NameLen uint16, Name string) []byte {  	size := pad((12 + pad((int(NameLen) * 1))))  	b := 0  	buf := make([]byte, size) @@ -10929,18 +11928,20 @@ func allocNamedColorRequest(Cmap Id, NameLen uint16, Name string) []byte {  // Request AllocColorCells  // size: 12 -type AllocColorCellsCookie cookie +type AllocColorCellsCookie struct { +	*cookie +}  func (c *Conn) AllocColorCells(Contiguous bool, Cmap Id, Colors uint16, Planes uint16) AllocColorCellsCookie {  	cookie := c.newCookie(true, true) -	c.newRequest(allocColorCellsRequest(Contiguous, Cmap, Colors, Planes), cookie) -	return AllocColorCellsCookie(cookie) +	c.newRequest(c.allocColorCellsRequest(Contiguous, Cmap, Colors, Planes), cookie) +	return AllocColorCellsCookie{cookie}  }  func (c *Conn) AllocColorCellsUnchecked(Contiguous bool, Cmap Id, Colors uint16, Planes uint16) AllocColorCellsCookie {  	cookie := c.newCookie(false, true) -	c.newRequest(allocColorCellsRequest(Contiguous, Cmap, Colors, Planes), cookie) -	return AllocColorCellsCookie(cookie) +	c.newRequest(c.allocColorCellsRequest(Contiguous, Cmap, Colors, Planes), cookie) +	return AllocColorCellsCookie{cookie}  }  // Request reply for AllocColorCells @@ -10958,10 +11959,13 @@ type AllocColorCellsReply struct {  // Waits and reads reply data from request AllocColorCells  func (cook AllocColorCellsCookie) Reply() (*AllocColorCellsReply, error) { -	buf, err := cookie(cook).reply() +	buf, err := cook.reply()  	if err != nil {  		return nil, err  	} +	if buf == nil { +		return nil, nil +	}  	return allocColorCellsReply(buf), nil  } @@ -11003,8 +12007,12 @@ func allocColorCellsReply(buf []byte) *AllocColorCellsReply {  	return v  } +func (cook AllocColorCellsCookie) Check() error { +	return cook.check() +} +  // Write request to wire for AllocColorCells -func allocColorCellsRequest(Contiguous bool, Cmap Id, Colors uint16, Planes uint16) []byte { +func (c *Conn) allocColorCellsRequest(Contiguous bool, Cmap Id, Colors uint16, Planes uint16) []byte {  	size := 12  	b := 0  	buf := make([]byte, size) @@ -11036,18 +12044,20 @@ func allocColorCellsRequest(Contiguous bool, Cmap Id, Colors uint16, Planes uint  // Request AllocColorPlanes  // size: 16 -type AllocColorPlanesCookie cookie +type AllocColorPlanesCookie struct { +	*cookie +}  func (c *Conn) AllocColorPlanes(Contiguous bool, Cmap Id, Colors uint16, Reds uint16, Greens uint16, Blues uint16) AllocColorPlanesCookie {  	cookie := c.newCookie(true, true) -	c.newRequest(allocColorPlanesRequest(Contiguous, Cmap, Colors, Reds, Greens, Blues), cookie) -	return AllocColorPlanesCookie(cookie) +	c.newRequest(c.allocColorPlanesRequest(Contiguous, Cmap, Colors, Reds, Greens, Blues), cookie) +	return AllocColorPlanesCookie{cookie}  }  func (c *Conn) AllocColorPlanesUnchecked(Contiguous bool, Cmap Id, Colors uint16, Reds uint16, Greens uint16, Blues uint16) AllocColorPlanesCookie {  	cookie := c.newCookie(false, true) -	c.newRequest(allocColorPlanesRequest(Contiguous, Cmap, Colors, Reds, Greens, Blues), cookie) -	return AllocColorPlanesCookie(cookie) +	c.newRequest(c.allocColorPlanesRequest(Contiguous, Cmap, Colors, Reds, Greens, Blues), cookie) +	return AllocColorPlanesCookie{cookie}  }  // Request reply for AllocColorPlanes @@ -11067,10 +12077,13 @@ type AllocColorPlanesReply struct {  // Waits and reads reply data from request AllocColorPlanes  func (cook AllocColorPlanesCookie) Reply() (*AllocColorPlanesReply, error) { -	buf, err := cookie(cook).reply() +	buf, err := cook.reply()  	if err != nil {  		return nil, err  	} +	if buf == nil { +		return nil, nil +	}  	return allocColorPlanesReply(buf), nil  } @@ -11113,8 +12126,12 @@ func allocColorPlanesReply(buf []byte) *AllocColorPlanesReply {  	return v  } +func (cook AllocColorPlanesCookie) Check() error { +	return cook.check() +} +  // Write request to wire for AllocColorPlanes -func allocColorPlanesRequest(Contiguous bool, Cmap Id, Colors uint16, Reds uint16, Greens uint16, Blues uint16) []byte { +func (c *Conn) allocColorPlanesRequest(Contiguous bool, Cmap Id, Colors uint16, Reds uint16, Greens uint16, Blues uint16) []byte {  	size := 16  	b := 0  	buf := make([]byte, size) @@ -11152,23 +12169,29 @@ func allocColorPlanesRequest(Contiguous bool, Cmap Id, Colors uint16, Reds uint1  // Request FreeColors  // size: pad((12 + pad((len(Pixels) * 4)))) -type FreeColorsCookie cookie +type FreeColorsCookie struct { +	*cookie +}  // Write request to wire for FreeColors  func (c *Conn) FreeColors(Cmap Id, PlaneMask uint32, Pixels []uint32) FreeColorsCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(freeColorsRequest(Cmap, PlaneMask, Pixels), cookie) -	return FreeColorsCookie(cookie) +	c.newRequest(c.freeColorsRequest(Cmap, PlaneMask, Pixels), cookie) +	return FreeColorsCookie{cookie}  }  func (c *Conn) FreeColorsChecked(Cmap Id, PlaneMask uint32, Pixels []uint32) FreeColorsCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(freeColorsRequest(Cmap, PlaneMask, Pixels), cookie) -	return FreeColorsCookie(cookie) +	c.newRequest(c.freeColorsRequest(Cmap, PlaneMask, Pixels), cookie) +	return FreeColorsCookie{cookie} +} + +func (cook FreeColorsCookie) Check() error { +	return cook.check()  }  // Write request to wire for FreeColors -func freeColorsRequest(Cmap Id, PlaneMask uint32, Pixels []uint32) []byte { +func (c *Conn) freeColorsRequest(Cmap Id, PlaneMask uint32, Pixels []uint32) []byte {  	size := pad((12 + pad((len(Pixels) * 4))))  	b := 0  	buf := make([]byte, size) @@ -11198,23 +12221,29 @@ func freeColorsRequest(Cmap Id, PlaneMask uint32, Pixels []uint32) []byte {  // Request StoreColors  // size: pad((8 + pad((len(Items) * 12)))) -type StoreColorsCookie cookie +type StoreColorsCookie struct { +	*cookie +}  // Write request to wire for StoreColors  func (c *Conn) StoreColors(Cmap Id, Items []Coloritem) StoreColorsCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(storeColorsRequest(Cmap, Items), cookie) -	return StoreColorsCookie(cookie) +	c.newRequest(c.storeColorsRequest(Cmap, Items), cookie) +	return StoreColorsCookie{cookie}  }  func (c *Conn) StoreColorsChecked(Cmap Id, Items []Coloritem) StoreColorsCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(storeColorsRequest(Cmap, Items), cookie) -	return StoreColorsCookie(cookie) +	c.newRequest(c.storeColorsRequest(Cmap, Items), cookie) +	return StoreColorsCookie{cookie} +} + +func (cook StoreColorsCookie) Check() error { +	return cook.check()  }  // Write request to wire for StoreColors -func storeColorsRequest(Cmap Id, Items []Coloritem) []byte { +func (c *Conn) storeColorsRequest(Cmap Id, Items []Coloritem) []byte {  	size := pad((8 + pad((len(Items) * 12))))  	b := 0  	buf := make([]byte, size) @@ -11237,23 +12266,29 @@ func storeColorsRequest(Cmap Id, Items []Coloritem) []byte {  // Request StoreNamedColor  // size: pad((16 + pad((int(NameLen) * 1)))) -type StoreNamedColorCookie cookie +type StoreNamedColorCookie struct { +	*cookie +}  // Write request to wire for StoreNamedColor  func (c *Conn) StoreNamedColor(Flags byte, Cmap Id, Pixel uint32, NameLen uint16, Name string) StoreNamedColorCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(storeNamedColorRequest(Flags, Cmap, Pixel, NameLen, Name), cookie) -	return StoreNamedColorCookie(cookie) +	c.newRequest(c.storeNamedColorRequest(Flags, Cmap, Pixel, NameLen, Name), cookie) +	return StoreNamedColorCookie{cookie}  }  func (c *Conn) StoreNamedColorChecked(Flags byte, Cmap Id, Pixel uint32, NameLen uint16, Name string) StoreNamedColorCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(storeNamedColorRequest(Flags, Cmap, Pixel, NameLen, Name), cookie) -	return StoreNamedColorCookie(cookie) +	c.newRequest(c.storeNamedColorRequest(Flags, Cmap, Pixel, NameLen, Name), cookie) +	return StoreNamedColorCookie{cookie} +} + +func (cook StoreNamedColorCookie) Check() error { +	return cook.check()  }  // Write request to wire for StoreNamedColor -func storeNamedColorRequest(Flags byte, Cmap Id, Pixel uint32, NameLen uint16, Name string) []byte { +func (c *Conn) storeNamedColorRequest(Flags byte, Cmap Id, Pixel uint32, NameLen uint16, Name string) []byte {  	size := pad((16 + pad((int(NameLen) * 1))))  	b := 0  	buf := make([]byte, size) @@ -11286,18 +12321,20 @@ func storeNamedColorRequest(Flags byte, Cmap Id, Pixel uint32, NameLen uint16, N  // Request QueryColors  // size: pad((8 + pad((len(Pixels) * 4)))) -type QueryColorsCookie cookie +type QueryColorsCookie struct { +	*cookie +}  func (c *Conn) QueryColors(Cmap Id, Pixels []uint32) QueryColorsCookie {  	cookie := c.newCookie(true, true) -	c.newRequest(queryColorsRequest(Cmap, Pixels), cookie) -	return QueryColorsCookie(cookie) +	c.newRequest(c.queryColorsRequest(Cmap, Pixels), cookie) +	return QueryColorsCookie{cookie}  }  func (c *Conn) QueryColorsUnchecked(Cmap Id, Pixels []uint32) QueryColorsCookie {  	cookie := c.newCookie(false, true) -	c.newRequest(queryColorsRequest(Cmap, Pixels), cookie) -	return QueryColorsCookie(cookie) +	c.newRequest(c.queryColorsRequest(Cmap, Pixels), cookie) +	return QueryColorsCookie{cookie}  }  // Request reply for QueryColors @@ -11313,10 +12350,13 @@ type QueryColorsReply struct {  // Waits and reads reply data from request QueryColors  func (cook QueryColorsCookie) Reply() (*QueryColorsReply, error) { -	buf, err := cookie(cook).reply() +	buf, err := cook.reply()  	if err != nil {  		return nil, err  	} +	if buf == nil { +		return nil, nil +	}  	return queryColorsReply(buf), nil  } @@ -11344,8 +12384,12 @@ func queryColorsReply(buf []byte) *QueryColorsReply {  	return v  } +func (cook QueryColorsCookie) Check() error { +	return cook.check() +} +  // Write request to wire for QueryColors -func queryColorsRequest(Cmap Id, Pixels []uint32) []byte { +func (c *Conn) queryColorsRequest(Cmap Id, Pixels []uint32) []byte {  	size := pad((8 + pad((len(Pixels) * 4))))  	b := 0  	buf := make([]byte, size) @@ -11372,18 +12416,20 @@ func queryColorsRequest(Cmap Id, Pixels []uint32) []byte {  // Request LookupColor  // size: pad((12 + pad((int(NameLen) * 1)))) -type LookupColorCookie cookie +type LookupColorCookie struct { +	*cookie +}  func (c *Conn) LookupColor(Cmap Id, NameLen uint16, Name string) LookupColorCookie {  	cookie := c.newCookie(true, true) -	c.newRequest(lookupColorRequest(Cmap, NameLen, Name), cookie) -	return LookupColorCookie(cookie) +	c.newRequest(c.lookupColorRequest(Cmap, NameLen, Name), cookie) +	return LookupColorCookie{cookie}  }  func (c *Conn) LookupColorUnchecked(Cmap Id, NameLen uint16, Name string) LookupColorCookie {  	cookie := c.newCookie(false, true) -	c.newRequest(lookupColorRequest(Cmap, NameLen, Name), cookie) -	return LookupColorCookie(cookie) +	c.newRequest(c.lookupColorRequest(Cmap, NameLen, Name), cookie) +	return LookupColorCookie{cookie}  }  // Request reply for LookupColor @@ -11402,10 +12448,13 @@ type LookupColorReply struct {  // Waits and reads reply data from request LookupColor  func (cook LookupColorCookie) Reply() (*LookupColorReply, error) { -	buf, err := cookie(cook).reply() +	buf, err := cook.reply()  	if err != nil {  		return nil, err  	} +	if buf == nil { +		return nil, nil +	}  	return lookupColorReply(buf), nil  } @@ -11443,8 +12492,12 @@ func lookupColorReply(buf []byte) *LookupColorReply {  	return v  } +func (cook LookupColorCookie) Check() error { +	return cook.check() +} +  // Write request to wire for LookupColor -func lookupColorRequest(Cmap Id, NameLen uint16, Name string) []byte { +func (c *Conn) lookupColorRequest(Cmap Id, NameLen uint16, Name string) []byte {  	size := pad((12 + pad((int(NameLen) * 1))))  	b := 0  	buf := make([]byte, size) @@ -11473,23 +12526,29 @@ func lookupColorRequest(Cmap Id, NameLen uint16, Name string) []byte {  // Request CreateCursor  // size: 32 -type CreateCursorCookie cookie +type CreateCursorCookie struct { +	*cookie +}  // Write request to wire for CreateCursor  func (c *Conn) CreateCursor(Cid Id, Source Id, Mask Id, ForeRed uint16, ForeGreen uint16, ForeBlue uint16, BackRed uint16, BackGreen uint16, BackBlue uint16, X uint16, Y uint16) CreateCursorCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(createCursorRequest(Cid, Source, Mask, ForeRed, ForeGreen, ForeBlue, BackRed, BackGreen, BackBlue, X, Y), cookie) -	return CreateCursorCookie(cookie) +	c.newRequest(c.createCursorRequest(Cid, Source, Mask, ForeRed, ForeGreen, ForeBlue, BackRed, BackGreen, BackBlue, X, Y), cookie) +	return CreateCursorCookie{cookie}  }  func (c *Conn) CreateCursorChecked(Cid Id, Source Id, Mask Id, ForeRed uint16, ForeGreen uint16, ForeBlue uint16, BackRed uint16, BackGreen uint16, BackBlue uint16, X uint16, Y uint16) CreateCursorCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(createCursorRequest(Cid, Source, Mask, ForeRed, ForeGreen, ForeBlue, BackRed, BackGreen, BackBlue, X, Y), cookie) -	return CreateCursorCookie(cookie) +	c.newRequest(c.createCursorRequest(Cid, Source, Mask, ForeRed, ForeGreen, ForeBlue, BackRed, BackGreen, BackBlue, X, Y), cookie) +	return CreateCursorCookie{cookie} +} + +func (cook CreateCursorCookie) Check() error { +	return cook.check()  }  // Write request to wire for CreateCursor -func createCursorRequest(Cid Id, Source Id, Mask Id, ForeRed uint16, ForeGreen uint16, ForeBlue uint16, BackRed uint16, BackGreen uint16, BackBlue uint16, X uint16, Y uint16) []byte { +func (c *Conn) createCursorRequest(Cid Id, Source Id, Mask Id, ForeRed uint16, ForeGreen uint16, ForeBlue uint16, BackRed uint16, BackGreen uint16, BackBlue uint16, X uint16, Y uint16) []byte {  	size := 32  	b := 0  	buf := make([]byte, size) @@ -11540,23 +12599,29 @@ func createCursorRequest(Cid Id, Source Id, Mask Id, ForeRed uint16, ForeGreen u  // Request CreateGlyphCursor  // size: 32 -type CreateGlyphCursorCookie cookie +type CreateGlyphCursorCookie struct { +	*cookie +}  // Write request to wire for CreateGlyphCursor  func (c *Conn) CreateGlyphCursor(Cid Id, SourceFont Id, MaskFont Id, SourceChar uint16, MaskChar uint16, ForeRed uint16, ForeGreen uint16, ForeBlue uint16, BackRed uint16, BackGreen uint16, BackBlue uint16) CreateGlyphCursorCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(createGlyphCursorRequest(Cid, SourceFont, MaskFont, SourceChar, MaskChar, ForeRed, ForeGreen, ForeBlue, BackRed, BackGreen, BackBlue), cookie) -	return CreateGlyphCursorCookie(cookie) +	c.newRequest(c.createGlyphCursorRequest(Cid, SourceFont, MaskFont, SourceChar, MaskChar, ForeRed, ForeGreen, ForeBlue, BackRed, BackGreen, BackBlue), cookie) +	return CreateGlyphCursorCookie{cookie}  }  func (c *Conn) CreateGlyphCursorChecked(Cid Id, SourceFont Id, MaskFont Id, SourceChar uint16, MaskChar uint16, ForeRed uint16, ForeGreen uint16, ForeBlue uint16, BackRed uint16, BackGreen uint16, BackBlue uint16) CreateGlyphCursorCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(createGlyphCursorRequest(Cid, SourceFont, MaskFont, SourceChar, MaskChar, ForeRed, ForeGreen, ForeBlue, BackRed, BackGreen, BackBlue), cookie) -	return CreateGlyphCursorCookie(cookie) +	c.newRequest(c.createGlyphCursorRequest(Cid, SourceFont, MaskFont, SourceChar, MaskChar, ForeRed, ForeGreen, ForeBlue, BackRed, BackGreen, BackBlue), cookie) +	return CreateGlyphCursorCookie{cookie} +} + +func (cook CreateGlyphCursorCookie) Check() error { +	return cook.check()  }  // Write request to wire for CreateGlyphCursor -func createGlyphCursorRequest(Cid Id, SourceFont Id, MaskFont Id, SourceChar uint16, MaskChar uint16, ForeRed uint16, ForeGreen uint16, ForeBlue uint16, BackRed uint16, BackGreen uint16, BackBlue uint16) []byte { +func (c *Conn) createGlyphCursorRequest(Cid Id, SourceFont Id, MaskFont Id, SourceChar uint16, MaskChar uint16, ForeRed uint16, ForeGreen uint16, ForeBlue uint16, BackRed uint16, BackGreen uint16, BackBlue uint16) []byte {  	size := 32  	b := 0  	buf := make([]byte, size) @@ -11607,23 +12672,29 @@ func createGlyphCursorRequest(Cid Id, SourceFont Id, MaskFont Id, SourceChar uin  // Request FreeCursor  // size: 8 -type FreeCursorCookie cookie +type FreeCursorCookie struct { +	*cookie +}  // Write request to wire for FreeCursor  func (c *Conn) FreeCursor(Cursor Id) FreeCursorCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(freeCursorRequest(Cursor), cookie) -	return FreeCursorCookie(cookie) +	c.newRequest(c.freeCursorRequest(Cursor), cookie) +	return FreeCursorCookie{cookie}  }  func (c *Conn) FreeCursorChecked(Cursor Id) FreeCursorCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(freeCursorRequest(Cursor), cookie) -	return FreeCursorCookie(cookie) +	c.newRequest(c.freeCursorRequest(Cursor), cookie) +	return FreeCursorCookie{cookie} +} + +func (cook FreeCursorCookie) Check() error { +	return cook.check()  }  // Write request to wire for FreeCursor -func freeCursorRequest(Cursor Id) []byte { +func (c *Conn) freeCursorRequest(Cursor Id) []byte {  	size := 8  	b := 0  	buf := make([]byte, size) @@ -11644,23 +12715,29 @@ func freeCursorRequest(Cursor Id) []byte {  // Request RecolorCursor  // size: 20 -type RecolorCursorCookie cookie +type RecolorCursorCookie struct { +	*cookie +}  // Write request to wire for RecolorCursor  func (c *Conn) RecolorCursor(Cursor Id, ForeRed uint16, ForeGreen uint16, ForeBlue uint16, BackRed uint16, BackGreen uint16, BackBlue uint16) RecolorCursorCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(recolorCursorRequest(Cursor, ForeRed, ForeGreen, ForeBlue, BackRed, BackGreen, BackBlue), cookie) -	return RecolorCursorCookie(cookie) +	c.newRequest(c.recolorCursorRequest(Cursor, ForeRed, ForeGreen, ForeBlue, BackRed, BackGreen, BackBlue), cookie) +	return RecolorCursorCookie{cookie}  }  func (c *Conn) RecolorCursorChecked(Cursor Id, ForeRed uint16, ForeGreen uint16, ForeBlue uint16, BackRed uint16, BackGreen uint16, BackBlue uint16) RecolorCursorCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(recolorCursorRequest(Cursor, ForeRed, ForeGreen, ForeBlue, BackRed, BackGreen, BackBlue), cookie) -	return RecolorCursorCookie(cookie) +	c.newRequest(c.recolorCursorRequest(Cursor, ForeRed, ForeGreen, ForeBlue, BackRed, BackGreen, BackBlue), cookie) +	return RecolorCursorCookie{cookie} +} + +func (cook RecolorCursorCookie) Check() error { +	return cook.check()  }  // Write request to wire for RecolorCursor -func recolorCursorRequest(Cursor Id, ForeRed uint16, ForeGreen uint16, ForeBlue uint16, BackRed uint16, BackGreen uint16, BackBlue uint16) []byte { +func (c *Conn) recolorCursorRequest(Cursor Id, ForeRed uint16, ForeGreen uint16, ForeBlue uint16, BackRed uint16, BackGreen uint16, BackBlue uint16) []byte {  	size := 20  	b := 0  	buf := make([]byte, size) @@ -11699,18 +12776,20 @@ func recolorCursorRequest(Cursor Id, ForeRed uint16, ForeGreen uint16, ForeBlue  // Request QueryBestSize  // size: 12 -type QueryBestSizeCookie cookie +type QueryBestSizeCookie struct { +	*cookie +}  func (c *Conn) QueryBestSize(Class byte, Drawable Id, Width uint16, Height uint16) QueryBestSizeCookie {  	cookie := c.newCookie(true, true) -	c.newRequest(queryBestSizeRequest(Class, Drawable, Width, Height), cookie) -	return QueryBestSizeCookie(cookie) +	c.newRequest(c.queryBestSizeRequest(Class, Drawable, Width, Height), cookie) +	return QueryBestSizeCookie{cookie}  }  func (c *Conn) QueryBestSizeUnchecked(Class byte, Drawable Id, Width uint16, Height uint16) QueryBestSizeCookie {  	cookie := c.newCookie(false, true) -	c.newRequest(queryBestSizeRequest(Class, Drawable, Width, Height), cookie) -	return QueryBestSizeCookie(cookie) +	c.newRequest(c.queryBestSizeRequest(Class, Drawable, Width, Height), cookie) +	return QueryBestSizeCookie{cookie}  }  // Request reply for QueryBestSize @@ -11725,10 +12804,13 @@ type QueryBestSizeReply struct {  // Waits and reads reply data from request QueryBestSize  func (cook QueryBestSizeCookie) Reply() (*QueryBestSizeReply, error) { -	buf, err := cookie(cook).reply() +	buf, err := cook.reply()  	if err != nil {  		return nil, err  	} +	if buf == nil { +		return nil, nil +	}  	return queryBestSizeReply(buf), nil  } @@ -11754,8 +12836,12 @@ func queryBestSizeReply(buf []byte) *QueryBestSizeReply {  	return v  } +func (cook QueryBestSizeCookie) Check() error { +	return cook.check() +} +  // Write request to wire for QueryBestSize -func queryBestSizeRequest(Class byte, Drawable Id, Width uint16, Height uint16) []byte { +func (c *Conn) queryBestSizeRequest(Class byte, Drawable Id, Width uint16, Height uint16) []byte {  	size := 12  	b := 0  	buf := make([]byte, size) @@ -11783,18 +12869,20 @@ func queryBestSizeRequest(Class byte, Drawable Id, Width uint16, Height uint16)  // Request QueryExtension  // size: pad((8 + pad((int(NameLen) * 1)))) -type QueryExtensionCookie cookie +type QueryExtensionCookie struct { +	*cookie +}  func (c *Conn) QueryExtension(NameLen uint16, Name string) QueryExtensionCookie {  	cookie := c.newCookie(true, true) -	c.newRequest(queryExtensionRequest(NameLen, Name), cookie) -	return QueryExtensionCookie(cookie) +	c.newRequest(c.queryExtensionRequest(NameLen, Name), cookie) +	return QueryExtensionCookie{cookie}  }  func (c *Conn) QueryExtensionUnchecked(NameLen uint16, Name string) QueryExtensionCookie {  	cookie := c.newCookie(false, true) -	c.newRequest(queryExtensionRequest(NameLen, Name), cookie) -	return QueryExtensionCookie(cookie) +	c.newRequest(c.queryExtensionRequest(NameLen, Name), cookie) +	return QueryExtensionCookie{cookie}  }  // Request reply for QueryExtension @@ -11811,10 +12899,13 @@ type QueryExtensionReply struct {  // Waits and reads reply data from request QueryExtension  func (cook QueryExtensionCookie) Reply() (*QueryExtensionReply, error) { -	buf, err := cookie(cook).reply() +	buf, err := cook.reply()  	if err != nil {  		return nil, err  	} +	if buf == nil { +		return nil, nil +	}  	return queryExtensionReply(buf), nil  } @@ -11850,8 +12941,12 @@ func queryExtensionReply(buf []byte) *QueryExtensionReply {  	return v  } +func (cook QueryExtensionCookie) Check() error { +	return cook.check() +} +  // Write request to wire for QueryExtension -func queryExtensionRequest(NameLen uint16, Name string) []byte { +func (c *Conn) queryExtensionRequest(NameLen uint16, Name string) []byte {  	size := pad((8 + pad((int(NameLen) * 1))))  	b := 0  	buf := make([]byte, size) @@ -11877,18 +12972,20 @@ func queryExtensionRequest(NameLen uint16, Name string) []byte {  // Request ListExtensions  // size: 4 -type ListExtensionsCookie cookie +type ListExtensionsCookie struct { +	*cookie +}  func (c *Conn) ListExtensions() ListExtensionsCookie {  	cookie := c.newCookie(true, true) -	c.newRequest(listExtensionsRequest(), cookie) -	return ListExtensionsCookie(cookie) +	c.newRequest(c.listExtensionsRequest(), cookie) +	return ListExtensionsCookie{cookie}  }  func (c *Conn) ListExtensionsUnchecked() ListExtensionsCookie {  	cookie := c.newCookie(false, true) -	c.newRequest(listExtensionsRequest(), cookie) -	return ListExtensionsCookie(cookie) +	c.newRequest(c.listExtensionsRequest(), cookie) +	return ListExtensionsCookie{cookie}  }  // Request reply for ListExtensions @@ -11903,10 +13000,13 @@ type ListExtensionsReply struct {  // Waits and reads reply data from request ListExtensions  func (cook ListExtensionsCookie) Reply() (*ListExtensionsReply, error) { -	buf, err := cookie(cook).reply() +	buf, err := cook.reply()  	if err != nil {  		return nil, err  	} +	if buf == nil { +		return nil, nil +	}  	return listExtensionsReply(buf), nil  } @@ -11932,8 +13032,12 @@ func listExtensionsReply(buf []byte) *ListExtensionsReply {  	return v  } +func (cook ListExtensionsCookie) Check() error { +	return cook.check() +} +  // Write request to wire for ListExtensions -func listExtensionsRequest() []byte { +func (c *Conn) listExtensionsRequest() []byte {  	size := 4  	b := 0  	buf := make([]byte, size) @@ -11941,28 +13045,38 @@ func listExtensionsRequest() []byte {  	buf[b] = 99 // request opcode  	b += 1 +	b += 1                         // padding +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 +  	return buf  }  // Request ChangeKeyboardMapping  // size: pad((8 + pad(((int(KeycodeCount) * int(KeysymsPerKeycode)) * 4)))) -type ChangeKeyboardMappingCookie cookie +type ChangeKeyboardMappingCookie struct { +	*cookie +}  // Write request to wire for ChangeKeyboardMapping  func (c *Conn) ChangeKeyboardMapping(KeycodeCount byte, FirstKeycode Keycode, KeysymsPerKeycode byte, Keysyms []Keysym) ChangeKeyboardMappingCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(changeKeyboardMappingRequest(KeycodeCount, FirstKeycode, KeysymsPerKeycode, Keysyms), cookie) -	return ChangeKeyboardMappingCookie(cookie) +	c.newRequest(c.changeKeyboardMappingRequest(KeycodeCount, FirstKeycode, KeysymsPerKeycode, Keysyms), cookie) +	return ChangeKeyboardMappingCookie{cookie}  }  func (c *Conn) ChangeKeyboardMappingChecked(KeycodeCount byte, FirstKeycode Keycode, KeysymsPerKeycode byte, Keysyms []Keysym) ChangeKeyboardMappingCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(changeKeyboardMappingRequest(KeycodeCount, FirstKeycode, KeysymsPerKeycode, Keysyms), cookie) -	return ChangeKeyboardMappingCookie(cookie) +	c.newRequest(c.changeKeyboardMappingRequest(KeycodeCount, FirstKeycode, KeysymsPerKeycode, Keysyms), cookie) +	return ChangeKeyboardMappingCookie{cookie} +} + +func (cook ChangeKeyboardMappingCookie) Check() error { +	return cook.check()  }  // Write request to wire for ChangeKeyboardMapping -func changeKeyboardMappingRequest(KeycodeCount byte, FirstKeycode Keycode, KeysymsPerKeycode byte, Keysyms []Keysym) []byte { +func (c *Conn) changeKeyboardMappingRequest(KeycodeCount byte, FirstKeycode Keycode, KeysymsPerKeycode byte, Keysyms []Keysym) []byte {  	size := pad((8 + pad(((int(KeycodeCount) * int(KeysymsPerKeycode)) * 4))))  	b := 0  	buf := make([]byte, size) @@ -11995,18 +13109,20 @@ func changeKeyboardMappingRequest(KeycodeCount byte, FirstKeycode Keycode, Keysy  // Request GetKeyboardMapping  // size: 8 -type GetKeyboardMappingCookie cookie +type GetKeyboardMappingCookie struct { +	*cookie +}  func (c *Conn) GetKeyboardMapping(FirstKeycode Keycode, Count byte) GetKeyboardMappingCookie {  	cookie := c.newCookie(true, true) -	c.newRequest(getKeyboardMappingRequest(FirstKeycode, Count), cookie) -	return GetKeyboardMappingCookie(cookie) +	c.newRequest(c.getKeyboardMappingRequest(FirstKeycode, Count), cookie) +	return GetKeyboardMappingCookie{cookie}  }  func (c *Conn) GetKeyboardMappingUnchecked(FirstKeycode Keycode, Count byte) GetKeyboardMappingCookie {  	cookie := c.newCookie(false, true) -	c.newRequest(getKeyboardMappingRequest(FirstKeycode, Count), cookie) -	return GetKeyboardMappingCookie(cookie) +	c.newRequest(c.getKeyboardMappingRequest(FirstKeycode, Count), cookie) +	return GetKeyboardMappingCookie{cookie}  }  // Request reply for GetKeyboardMapping @@ -12021,10 +13137,13 @@ type GetKeyboardMappingReply struct {  // Waits and reads reply data from request GetKeyboardMapping  func (cook GetKeyboardMappingCookie) Reply() (*GetKeyboardMappingReply, error) { -	buf, err := cookie(cook).reply() +	buf, err := cook.reply()  	if err != nil {  		return nil, err  	} +	if buf == nil { +		return nil, nil +	}  	return getKeyboardMappingReply(buf), nil  } @@ -12054,8 +13173,12 @@ func getKeyboardMappingReply(buf []byte) *GetKeyboardMappingReply {  	return v  } +func (cook GetKeyboardMappingCookie) Check() error { +	return cook.check() +} +  // Write request to wire for GetKeyboardMapping -func getKeyboardMappingRequest(FirstKeycode Keycode, Count byte) []byte { +func (c *Conn) getKeyboardMappingRequest(FirstKeycode Keycode, Count byte) []byte {  	size := 8  	b := 0  	buf := make([]byte, size) @@ -12079,23 +13202,29 @@ func getKeyboardMappingRequest(FirstKeycode Keycode, Count byte) []byte {  // Request ChangeKeyboardControl  // size: pad((4 + (4 + pad((4 * popCount(int(ValueMask))))))) -type ChangeKeyboardControlCookie cookie +type ChangeKeyboardControlCookie struct { +	*cookie +}  // Write request to wire for ChangeKeyboardControl  func (c *Conn) ChangeKeyboardControl(ValueMask uint32, ValueList []uint32) ChangeKeyboardControlCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(changeKeyboardControlRequest(ValueMask, ValueList), cookie) -	return ChangeKeyboardControlCookie(cookie) +	c.newRequest(c.changeKeyboardControlRequest(ValueMask, ValueList), cookie) +	return ChangeKeyboardControlCookie{cookie}  }  func (c *Conn) ChangeKeyboardControlChecked(ValueMask uint32, ValueList []uint32) ChangeKeyboardControlCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(changeKeyboardControlRequest(ValueMask, ValueList), cookie) -	return ChangeKeyboardControlCookie(cookie) +	c.newRequest(c.changeKeyboardControlRequest(ValueMask, ValueList), cookie) +	return ChangeKeyboardControlCookie{cookie} +} + +func (cook ChangeKeyboardControlCookie) Check() error { +	return cook.check()  }  // Write request to wire for ChangeKeyboardControl -func changeKeyboardControlRequest(ValueMask uint32, ValueList []uint32) []byte { +func (c *Conn) changeKeyboardControlRequest(ValueMask uint32, ValueList []uint32) []byte {  	size := pad((4 + (4 + pad((4 * popCount(int(ValueMask)))))))  	b := 0  	buf := make([]byte, size) @@ -12121,18 +13250,20 @@ func changeKeyboardControlRequest(ValueMask uint32, ValueList []uint32) []byte {  // Request GetKeyboardControl  // size: 4 -type GetKeyboardControlCookie cookie +type GetKeyboardControlCookie struct { +	*cookie +}  func (c *Conn) GetKeyboardControl() GetKeyboardControlCookie {  	cookie := c.newCookie(true, true) -	c.newRequest(getKeyboardControlRequest(), cookie) -	return GetKeyboardControlCookie(cookie) +	c.newRequest(c.getKeyboardControlRequest(), cookie) +	return GetKeyboardControlCookie{cookie}  }  func (c *Conn) GetKeyboardControlUnchecked() GetKeyboardControlCookie {  	cookie := c.newCookie(false, true) -	c.newRequest(getKeyboardControlRequest(), cookie) -	return GetKeyboardControlCookie(cookie) +	c.newRequest(c.getKeyboardControlRequest(), cookie) +	return GetKeyboardControlCookie{cookie}  }  // Request reply for GetKeyboardControl @@ -12152,10 +13283,13 @@ type GetKeyboardControlReply struct {  // Waits and reads reply data from request GetKeyboardControl  func (cook GetKeyboardControlCookie) Reply() (*GetKeyboardControlReply, error) { -	buf, err := cookie(cook).reply() +	buf, err := cook.reply()  	if err != nil {  		return nil, err  	} +	if buf == nil { +		return nil, nil +	}  	return getKeyboardControlReply(buf), nil  } @@ -12197,8 +13331,12 @@ func getKeyboardControlReply(buf []byte) *GetKeyboardControlReply {  	return v  } +func (cook GetKeyboardControlCookie) Check() error { +	return cook.check() +} +  // Write request to wire for GetKeyboardControl -func getKeyboardControlRequest() []byte { +func (c *Conn) getKeyboardControlRequest() []byte {  	size := 4  	b := 0  	buf := make([]byte, size) @@ -12206,28 +13344,38 @@ func getKeyboardControlRequest() []byte {  	buf[b] = 103 // request opcode  	b += 1 +	b += 1                         // padding +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 +  	return buf  }  // Request Bell  // size: 4 -type BellCookie cookie +type BellCookie struct { +	*cookie +}  // Write request to wire for Bell  func (c *Conn) Bell(Percent int8) BellCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(bellRequest(Percent), cookie) -	return BellCookie(cookie) +	c.newRequest(c.bellRequest(Percent), cookie) +	return BellCookie{cookie}  }  func (c *Conn) BellChecked(Percent int8) BellCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(bellRequest(Percent), cookie) -	return BellCookie(cookie) +	c.newRequest(c.bellRequest(Percent), cookie) +	return BellCookie{cookie} +} + +func (cook BellCookie) Check() error { +	return cook.check()  }  // Write request to wire for Bell -func bellRequest(Percent int8) []byte { +func (c *Conn) bellRequest(Percent int8) []byte {  	size := 4  	b := 0  	buf := make([]byte, size) @@ -12238,28 +13386,37 @@ func bellRequest(Percent int8) []byte {  	buf[b] = byte(Percent)  	b += 1 +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 +  	return buf  }  // Request ChangePointerControl  // size: 12 -type ChangePointerControlCookie cookie +type ChangePointerControlCookie struct { +	*cookie +}  // Write request to wire for ChangePointerControl  func (c *Conn) ChangePointerControl(AccelerationNumerator int16, AccelerationDenominator int16, Threshold int16, DoAcceleration bool, DoThreshold bool) ChangePointerControlCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(changePointerControlRequest(AccelerationNumerator, AccelerationDenominator, Threshold, DoAcceleration, DoThreshold), cookie) -	return ChangePointerControlCookie(cookie) +	c.newRequest(c.changePointerControlRequest(AccelerationNumerator, AccelerationDenominator, Threshold, DoAcceleration, DoThreshold), cookie) +	return ChangePointerControlCookie{cookie}  }  func (c *Conn) ChangePointerControlChecked(AccelerationNumerator int16, AccelerationDenominator int16, Threshold int16, DoAcceleration bool, DoThreshold bool) ChangePointerControlCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(changePointerControlRequest(AccelerationNumerator, AccelerationDenominator, Threshold, DoAcceleration, DoThreshold), cookie) -	return ChangePointerControlCookie(cookie) +	c.newRequest(c.changePointerControlRequest(AccelerationNumerator, AccelerationDenominator, Threshold, DoAcceleration, DoThreshold), cookie) +	return ChangePointerControlCookie{cookie} +} + +func (cook ChangePointerControlCookie) Check() error { +	return cook.check()  }  // Write request to wire for ChangePointerControl -func changePointerControlRequest(AccelerationNumerator int16, AccelerationDenominator int16, Threshold int16, DoAcceleration bool, DoThreshold bool) []byte { +func (c *Conn) changePointerControlRequest(AccelerationNumerator int16, AccelerationDenominator int16, Threshold int16, DoAcceleration bool, DoThreshold bool) []byte {  	size := 12  	b := 0  	buf := make([]byte, size) @@ -12300,18 +13457,20 @@ func changePointerControlRequest(AccelerationNumerator int16, AccelerationDenomi  // Request GetPointerControl  // size: 4 -type GetPointerControlCookie cookie +type GetPointerControlCookie struct { +	*cookie +}  func (c *Conn) GetPointerControl() GetPointerControlCookie {  	cookie := c.newCookie(true, true) -	c.newRequest(getPointerControlRequest(), cookie) -	return GetPointerControlCookie(cookie) +	c.newRequest(c.getPointerControlRequest(), cookie) +	return GetPointerControlCookie{cookie}  }  func (c *Conn) GetPointerControlUnchecked() GetPointerControlCookie {  	cookie := c.newCookie(false, true) -	c.newRequest(getPointerControlRequest(), cookie) -	return GetPointerControlCookie(cookie) +	c.newRequest(c.getPointerControlRequest(), cookie) +	return GetPointerControlCookie{cookie}  }  // Request reply for GetPointerControl @@ -12328,10 +13487,13 @@ type GetPointerControlReply struct {  // Waits and reads reply data from request GetPointerControl  func (cook GetPointerControlCookie) Reply() (*GetPointerControlReply, error) { -	buf, err := cookie(cook).reply() +	buf, err := cook.reply()  	if err != nil {  		return nil, err  	} +	if buf == nil { +		return nil, nil +	}  	return getPointerControlReply(buf), nil  } @@ -12362,8 +13524,12 @@ func getPointerControlReply(buf []byte) *GetPointerControlReply {  	return v  } +func (cook GetPointerControlCookie) Check() error { +	return cook.check() +} +  // Write request to wire for GetPointerControl -func getPointerControlRequest() []byte { +func (c *Conn) getPointerControlRequest() []byte {  	size := 4  	b := 0  	buf := make([]byte, size) @@ -12371,28 +13537,38 @@ func getPointerControlRequest() []byte {  	buf[b] = 106 // request opcode  	b += 1 +	b += 1                         // padding +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 +  	return buf  }  // Request SetScreenSaver  // size: 12 -type SetScreenSaverCookie cookie +type SetScreenSaverCookie struct { +	*cookie +}  // Write request to wire for SetScreenSaver  func (c *Conn) SetScreenSaver(Timeout int16, Interval int16, PreferBlanking byte, AllowExposures byte) SetScreenSaverCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(setScreenSaverRequest(Timeout, Interval, PreferBlanking, AllowExposures), cookie) -	return SetScreenSaverCookie(cookie) +	c.newRequest(c.setScreenSaverRequest(Timeout, Interval, PreferBlanking, AllowExposures), cookie) +	return SetScreenSaverCookie{cookie}  }  func (c *Conn) SetScreenSaverChecked(Timeout int16, Interval int16, PreferBlanking byte, AllowExposures byte) SetScreenSaverCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(setScreenSaverRequest(Timeout, Interval, PreferBlanking, AllowExposures), cookie) -	return SetScreenSaverCookie(cookie) +	c.newRequest(c.setScreenSaverRequest(Timeout, Interval, PreferBlanking, AllowExposures), cookie) +	return SetScreenSaverCookie{cookie} +} + +func (cook SetScreenSaverCookie) Check() error { +	return cook.check()  }  // Write request to wire for SetScreenSaver -func setScreenSaverRequest(Timeout int16, Interval int16, PreferBlanking byte, AllowExposures byte) []byte { +func (c *Conn) setScreenSaverRequest(Timeout int16, Interval int16, PreferBlanking byte, AllowExposures byte) []byte {  	size := 12  	b := 0  	buf := make([]byte, size) @@ -12422,18 +13598,20 @@ func setScreenSaverRequest(Timeout int16, Interval int16, PreferBlanking byte, A  // Request GetScreenSaver  // size: 4 -type GetScreenSaverCookie cookie +type GetScreenSaverCookie struct { +	*cookie +}  func (c *Conn) GetScreenSaver() GetScreenSaverCookie {  	cookie := c.newCookie(true, true) -	c.newRequest(getScreenSaverRequest(), cookie) -	return GetScreenSaverCookie(cookie) +	c.newRequest(c.getScreenSaverRequest(), cookie) +	return GetScreenSaverCookie{cookie}  }  func (c *Conn) GetScreenSaverUnchecked() GetScreenSaverCookie {  	cookie := c.newCookie(false, true) -	c.newRequest(getScreenSaverRequest(), cookie) -	return GetScreenSaverCookie(cookie) +	c.newRequest(c.getScreenSaverRequest(), cookie) +	return GetScreenSaverCookie{cookie}  }  // Request reply for GetScreenSaver @@ -12451,10 +13629,13 @@ type GetScreenSaverReply struct {  // Waits and reads reply data from request GetScreenSaver  func (cook GetScreenSaverCookie) Reply() (*GetScreenSaverReply, error) { -	buf, err := cookie(cook).reply() +	buf, err := cook.reply()  	if err != nil {  		return nil, err  	} +	if buf == nil { +		return nil, nil +	}  	return getScreenSaverReply(buf), nil  } @@ -12488,8 +13669,12 @@ func getScreenSaverReply(buf []byte) *GetScreenSaverReply {  	return v  } +func (cook GetScreenSaverCookie) Check() error { +	return cook.check() +} +  // Write request to wire for GetScreenSaver -func getScreenSaverRequest() []byte { +func (c *Conn) getScreenSaverRequest() []byte {  	size := 4  	b := 0  	buf := make([]byte, size) @@ -12497,28 +13682,38 @@ func getScreenSaverRequest() []byte {  	buf[b] = 108 // request opcode  	b += 1 +	b += 1                         // padding +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 +  	return buf  }  // Request ChangeHosts  // size: pad((8 + pad((int(AddressLen) * 1)))) -type ChangeHostsCookie cookie +type ChangeHostsCookie struct { +	*cookie +}  // Write request to wire for ChangeHosts  func (c *Conn) ChangeHosts(Mode byte, Family byte, AddressLen uint16, Address []byte) ChangeHostsCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(changeHostsRequest(Mode, Family, AddressLen, Address), cookie) -	return ChangeHostsCookie(cookie) +	c.newRequest(c.changeHostsRequest(Mode, Family, AddressLen, Address), cookie) +	return ChangeHostsCookie{cookie}  }  func (c *Conn) ChangeHostsChecked(Mode byte, Family byte, AddressLen uint16, Address []byte) ChangeHostsCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(changeHostsRequest(Mode, Family, AddressLen, Address), cookie) -	return ChangeHostsCookie(cookie) +	c.newRequest(c.changeHostsRequest(Mode, Family, AddressLen, Address), cookie) +	return ChangeHostsCookie{cookie} +} + +func (cook ChangeHostsCookie) Check() error { +	return cook.check()  }  // Write request to wire for ChangeHosts -func changeHostsRequest(Mode byte, Family byte, AddressLen uint16, Address []byte) []byte { +func (c *Conn) changeHostsRequest(Mode byte, Family byte, AddressLen uint16, Address []byte) []byte {  	size := pad((8 + pad((int(AddressLen) * 1))))  	b := 0  	buf := make([]byte, size) @@ -12548,18 +13743,20 @@ func changeHostsRequest(Mode byte, Family byte, AddressLen uint16, Address []byt  // Request ListHosts  // size: 4 -type ListHostsCookie cookie +type ListHostsCookie struct { +	*cookie +}  func (c *Conn) ListHosts() ListHostsCookie {  	cookie := c.newCookie(true, true) -	c.newRequest(listHostsRequest(), cookie) -	return ListHostsCookie(cookie) +	c.newRequest(c.listHostsRequest(), cookie) +	return ListHostsCookie{cookie}  }  func (c *Conn) ListHostsUnchecked() ListHostsCookie {  	cookie := c.newCookie(false, true) -	c.newRequest(listHostsRequest(), cookie) -	return ListHostsCookie(cookie) +	c.newRequest(c.listHostsRequest(), cookie) +	return ListHostsCookie{cookie}  }  // Request reply for ListHosts @@ -12575,10 +13772,13 @@ type ListHostsReply struct {  // Waits and reads reply data from request ListHosts  func (cook ListHostsCookie) Reply() (*ListHostsReply, error) { -	buf, err := cookie(cook).reply() +	buf, err := cook.reply()  	if err != nil {  		return nil, err  	} +	if buf == nil { +		return nil, nil +	}  	return listHostsReply(buf), nil  } @@ -12607,8 +13807,12 @@ func listHostsReply(buf []byte) *ListHostsReply {  	return v  } +func (cook ListHostsCookie) Check() error { +	return cook.check() +} +  // Write request to wire for ListHosts -func listHostsRequest() []byte { +func (c *Conn) listHostsRequest() []byte {  	size := 4  	b := 0  	buf := make([]byte, size) @@ -12616,28 +13820,38 @@ func listHostsRequest() []byte {  	buf[b] = 110 // request opcode  	b += 1 +	b += 1                         // padding +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 +  	return buf  }  // Request SetAccessControl  // size: 4 -type SetAccessControlCookie cookie +type SetAccessControlCookie struct { +	*cookie +}  // Write request to wire for SetAccessControl  func (c *Conn) SetAccessControl(Mode byte) SetAccessControlCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(setAccessControlRequest(Mode), cookie) -	return SetAccessControlCookie(cookie) +	c.newRequest(c.setAccessControlRequest(Mode), cookie) +	return SetAccessControlCookie{cookie}  }  func (c *Conn) SetAccessControlChecked(Mode byte) SetAccessControlCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(setAccessControlRequest(Mode), cookie) -	return SetAccessControlCookie(cookie) +	c.newRequest(c.setAccessControlRequest(Mode), cookie) +	return SetAccessControlCookie{cookie} +} + +func (cook SetAccessControlCookie) Check() error { +	return cook.check()  }  // Write request to wire for SetAccessControl -func setAccessControlRequest(Mode byte) []byte { +func (c *Conn) setAccessControlRequest(Mode byte) []byte {  	size := 4  	b := 0  	buf := make([]byte, size) @@ -12648,28 +13862,37 @@ func setAccessControlRequest(Mode byte) []byte {  	buf[b] = Mode  	b += 1 +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 +  	return buf  }  // Request SetCloseDownMode  // size: 4 -type SetCloseDownModeCookie cookie +type SetCloseDownModeCookie struct { +	*cookie +}  // Write request to wire for SetCloseDownMode  func (c *Conn) SetCloseDownMode(Mode byte) SetCloseDownModeCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(setCloseDownModeRequest(Mode), cookie) -	return SetCloseDownModeCookie(cookie) +	c.newRequest(c.setCloseDownModeRequest(Mode), cookie) +	return SetCloseDownModeCookie{cookie}  }  func (c *Conn) SetCloseDownModeChecked(Mode byte) SetCloseDownModeCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(setCloseDownModeRequest(Mode), cookie) -	return SetCloseDownModeCookie(cookie) +	c.newRequest(c.setCloseDownModeRequest(Mode), cookie) +	return SetCloseDownModeCookie{cookie} +} + +func (cook SetCloseDownModeCookie) Check() error { +	return cook.check()  }  // Write request to wire for SetCloseDownMode -func setCloseDownModeRequest(Mode byte) []byte { +func (c *Conn) setCloseDownModeRequest(Mode byte) []byte {  	size := 4  	b := 0  	buf := make([]byte, size) @@ -12680,28 +13903,37 @@ func setCloseDownModeRequest(Mode byte) []byte {  	buf[b] = Mode  	b += 1 +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 +  	return buf  }  // Request KillClient  // size: 8 -type KillClientCookie cookie +type KillClientCookie struct { +	*cookie +}  // Write request to wire for KillClient  func (c *Conn) KillClient(Resource uint32) KillClientCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(killClientRequest(Resource), cookie) -	return KillClientCookie(cookie) +	c.newRequest(c.killClientRequest(Resource), cookie) +	return KillClientCookie{cookie}  }  func (c *Conn) KillClientChecked(Resource uint32) KillClientCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(killClientRequest(Resource), cookie) -	return KillClientCookie(cookie) +	c.newRequest(c.killClientRequest(Resource), cookie) +	return KillClientCookie{cookie} +} + +func (cook KillClientCookie) Check() error { +	return cook.check()  }  // Write request to wire for KillClient -func killClientRequest(Resource uint32) []byte { +func (c *Conn) killClientRequest(Resource uint32) []byte {  	size := 8  	b := 0  	buf := make([]byte, size) @@ -12722,23 +13954,29 @@ func killClientRequest(Resource uint32) []byte {  // Request RotateProperties  // size: pad((12 + pad((int(AtomsLen) * 4)))) -type RotatePropertiesCookie cookie +type RotatePropertiesCookie struct { +	*cookie +}  // Write request to wire for RotateProperties  func (c *Conn) RotateProperties(Window Id, AtomsLen uint16, Delta int16, Atoms []Id) RotatePropertiesCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(rotatePropertiesRequest(Window, AtomsLen, Delta, Atoms), cookie) -	return RotatePropertiesCookie(cookie) +	c.newRequest(c.rotatePropertiesRequest(Window, AtomsLen, Delta, Atoms), cookie) +	return RotatePropertiesCookie{cookie}  }  func (c *Conn) RotatePropertiesChecked(Window Id, AtomsLen uint16, Delta int16, Atoms []Id) RotatePropertiesCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(rotatePropertiesRequest(Window, AtomsLen, Delta, Atoms), cookie) -	return RotatePropertiesCookie(cookie) +	c.newRequest(c.rotatePropertiesRequest(Window, AtomsLen, Delta, Atoms), cookie) +	return RotatePropertiesCookie{cookie} +} + +func (cook RotatePropertiesCookie) Check() error { +	return cook.check()  }  // Write request to wire for RotateProperties -func rotatePropertiesRequest(Window Id, AtomsLen uint16, Delta int16, Atoms []Id) []byte { +func (c *Conn) rotatePropertiesRequest(Window Id, AtomsLen uint16, Delta int16, Atoms []Id) []byte {  	size := pad((12 + pad((int(AtomsLen) * 4))))  	b := 0  	buf := make([]byte, size) @@ -12771,23 +14009,29 @@ func rotatePropertiesRequest(Window Id, AtomsLen uint16, Delta int16, Atoms []Id  // Request ForceScreenSaver  // size: 4 -type ForceScreenSaverCookie cookie +type ForceScreenSaverCookie struct { +	*cookie +}  // Write request to wire for ForceScreenSaver  func (c *Conn) ForceScreenSaver(Mode byte) ForceScreenSaverCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(forceScreenSaverRequest(Mode), cookie) -	return ForceScreenSaverCookie(cookie) +	c.newRequest(c.forceScreenSaverRequest(Mode), cookie) +	return ForceScreenSaverCookie{cookie}  }  func (c *Conn) ForceScreenSaverChecked(Mode byte) ForceScreenSaverCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(forceScreenSaverRequest(Mode), cookie) -	return ForceScreenSaverCookie(cookie) +	c.newRequest(c.forceScreenSaverRequest(Mode), cookie) +	return ForceScreenSaverCookie{cookie} +} + +func (cook ForceScreenSaverCookie) Check() error { +	return cook.check()  }  // Write request to wire for ForceScreenSaver -func forceScreenSaverRequest(Mode byte) []byte { +func (c *Conn) forceScreenSaverRequest(Mode byte) []byte {  	size := 4  	b := 0  	buf := make([]byte, size) @@ -12798,23 +14042,28 @@ func forceScreenSaverRequest(Mode byte) []byte {  	buf[b] = Mode  	b += 1 +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 +  	return buf  }  // Request SetPointerMapping  // size: pad((4 + pad((int(MapLen) * 1)))) -type SetPointerMappingCookie cookie +type SetPointerMappingCookie struct { +	*cookie +}  func (c *Conn) SetPointerMapping(MapLen byte, Map []byte) SetPointerMappingCookie {  	cookie := c.newCookie(true, true) -	c.newRequest(setPointerMappingRequest(MapLen, Map), cookie) -	return SetPointerMappingCookie(cookie) +	c.newRequest(c.setPointerMappingRequest(MapLen, Map), cookie) +	return SetPointerMappingCookie{cookie}  }  func (c *Conn) SetPointerMappingUnchecked(MapLen byte, Map []byte) SetPointerMappingCookie {  	cookie := c.newCookie(false, true) -	c.newRequest(setPointerMappingRequest(MapLen, Map), cookie) -	return SetPointerMappingCookie(cookie) +	c.newRequest(c.setPointerMappingRequest(MapLen, Map), cookie) +	return SetPointerMappingCookie{cookie}  }  // Request reply for SetPointerMapping @@ -12827,10 +14076,13 @@ type SetPointerMappingReply struct {  // Waits and reads reply data from request SetPointerMapping  func (cook SetPointerMappingCookie) Reply() (*SetPointerMappingReply, error) { -	buf, err := cookie(cook).reply() +	buf, err := cook.reply()  	if err != nil {  		return nil, err  	} +	if buf == nil { +		return nil, nil +	}  	return setPointerMappingReply(buf), nil  } @@ -12842,11 +14094,21 @@ func setPointerMappingReply(buf []byte) *SetPointerMappingReply {  	v.Status = buf[b]  	b += 1 +	v.Sequence = Get16(buf[b:]) +	b += 2 + +	v.Length = Get32(buf[b:]) // 4-byte units +	b += 4 +  	return v  } +func (cook SetPointerMappingCookie) Check() error { +	return cook.check() +} +  // Write request to wire for SetPointerMapping -func setPointerMappingRequest(MapLen byte, Map []byte) []byte { +func (c *Conn) setPointerMappingRequest(MapLen byte, Map []byte) []byte {  	size := pad((4 + pad((int(MapLen) * 1))))  	b := 0  	buf := make([]byte, size) @@ -12868,18 +14130,20 @@ func setPointerMappingRequest(MapLen byte, Map []byte) []byte {  // Request GetPointerMapping  // size: 4 -type GetPointerMappingCookie cookie +type GetPointerMappingCookie struct { +	*cookie +}  func (c *Conn) GetPointerMapping() GetPointerMappingCookie {  	cookie := c.newCookie(true, true) -	c.newRequest(getPointerMappingRequest(), cookie) -	return GetPointerMappingCookie(cookie) +	c.newRequest(c.getPointerMappingRequest(), cookie) +	return GetPointerMappingCookie{cookie}  }  func (c *Conn) GetPointerMappingUnchecked() GetPointerMappingCookie {  	cookie := c.newCookie(false, true) -	c.newRequest(getPointerMappingRequest(), cookie) -	return GetPointerMappingCookie(cookie) +	c.newRequest(c.getPointerMappingRequest(), cookie) +	return GetPointerMappingCookie{cookie}  }  // Request reply for GetPointerMapping @@ -12894,10 +14158,13 @@ type GetPointerMappingReply struct {  // Waits and reads reply data from request GetPointerMapping  func (cook GetPointerMappingCookie) Reply() (*GetPointerMappingReply, error) { -	buf, err := cookie(cook).reply() +	buf, err := cook.reply()  	if err != nil {  		return nil, err  	} +	if buf == nil { +		return nil, nil +	}  	return getPointerMappingReply(buf), nil  } @@ -12924,8 +14191,12 @@ func getPointerMappingReply(buf []byte) *GetPointerMappingReply {  	return v  } +func (cook GetPointerMappingCookie) Check() error { +	return cook.check() +} +  // Write request to wire for GetPointerMapping -func getPointerMappingRequest() []byte { +func (c *Conn) getPointerMappingRequest() []byte {  	size := 4  	b := 0  	buf := make([]byte, size) @@ -12933,23 +14204,29 @@ func getPointerMappingRequest() []byte {  	buf[b] = 117 // request opcode  	b += 1 +	b += 1                         // padding +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 +  	return buf  }  // Request SetModifierMapping  // size: pad((4 + pad(((int(KeycodesPerModifier) * 8) * 1)))) -type SetModifierMappingCookie cookie +type SetModifierMappingCookie struct { +	*cookie +}  func (c *Conn) SetModifierMapping(KeycodesPerModifier byte, Keycodes []Keycode) SetModifierMappingCookie {  	cookie := c.newCookie(true, true) -	c.newRequest(setModifierMappingRequest(KeycodesPerModifier, Keycodes), cookie) -	return SetModifierMappingCookie(cookie) +	c.newRequest(c.setModifierMappingRequest(KeycodesPerModifier, Keycodes), cookie) +	return SetModifierMappingCookie{cookie}  }  func (c *Conn) SetModifierMappingUnchecked(KeycodesPerModifier byte, Keycodes []Keycode) SetModifierMappingCookie {  	cookie := c.newCookie(false, true) -	c.newRequest(setModifierMappingRequest(KeycodesPerModifier, Keycodes), cookie) -	return SetModifierMappingCookie(cookie) +	c.newRequest(c.setModifierMappingRequest(KeycodesPerModifier, Keycodes), cookie) +	return SetModifierMappingCookie{cookie}  }  // Request reply for SetModifierMapping @@ -12962,10 +14239,13 @@ type SetModifierMappingReply struct {  // Waits and reads reply data from request SetModifierMapping  func (cook SetModifierMappingCookie) Reply() (*SetModifierMappingReply, error) { -	buf, err := cookie(cook).reply() +	buf, err := cook.reply()  	if err != nil {  		return nil, err  	} +	if buf == nil { +		return nil, nil +	}  	return setModifierMappingReply(buf), nil  } @@ -12977,11 +14257,21 @@ func setModifierMappingReply(buf []byte) *SetModifierMappingReply {  	v.Status = buf[b]  	b += 1 +	v.Sequence = Get16(buf[b:]) +	b += 2 + +	v.Length = Get32(buf[b:]) // 4-byte units +	b += 4 +  	return v  } +func (cook SetModifierMappingCookie) Check() error { +	return cook.check() +} +  // Write request to wire for SetModifierMapping -func setModifierMappingRequest(KeycodesPerModifier byte, Keycodes []Keycode) []byte { +func (c *Conn) setModifierMappingRequest(KeycodesPerModifier byte, Keycodes []Keycode) []byte {  	size := pad((4 + pad(((int(KeycodesPerModifier) * 8) * 1))))  	b := 0  	buf := make([]byte, size) @@ -13006,18 +14296,20 @@ func setModifierMappingRequest(KeycodesPerModifier byte, Keycodes []Keycode) []b  // Request GetModifierMapping  // size: 4 -type GetModifierMappingCookie cookie +type GetModifierMappingCookie struct { +	*cookie +}  func (c *Conn) GetModifierMapping() GetModifierMappingCookie {  	cookie := c.newCookie(true, true) -	c.newRequest(getModifierMappingRequest(), cookie) -	return GetModifierMappingCookie(cookie) +	c.newRequest(c.getModifierMappingRequest(), cookie) +	return GetModifierMappingCookie{cookie}  }  func (c *Conn) GetModifierMappingUnchecked() GetModifierMappingCookie {  	cookie := c.newCookie(false, true) -	c.newRequest(getModifierMappingRequest(), cookie) -	return GetModifierMappingCookie(cookie) +	c.newRequest(c.getModifierMappingRequest(), cookie) +	return GetModifierMappingCookie{cookie}  }  // Request reply for GetModifierMapping @@ -13032,10 +14324,13 @@ type GetModifierMappingReply struct {  // Waits and reads reply data from request GetModifierMapping  func (cook GetModifierMappingCookie) Reply() (*GetModifierMappingReply, error) { -	buf, err := cookie(cook).reply() +	buf, err := cook.reply()  	if err != nil {  		return nil, err  	} +	if buf == nil { +		return nil, nil +	}  	return getModifierMappingReply(buf), nil  } @@ -13065,8 +14360,12 @@ func getModifierMappingReply(buf []byte) *GetModifierMappingReply {  	return v  } +func (cook GetModifierMappingCookie) Check() error { +	return cook.check() +} +  // Write request to wire for GetModifierMapping -func getModifierMappingRequest() []byte { +func (c *Conn) getModifierMappingRequest() []byte {  	size := 4  	b := 0  	buf := make([]byte, size) @@ -13074,28 +14373,38 @@ func getModifierMappingRequest() []byte {  	buf[b] = 119 // request opcode  	b += 1 +	b += 1                         // padding +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 +  	return buf  }  // Request NoOperation  // size: 4 -type NoOperationCookie cookie +type NoOperationCookie struct { +	*cookie +}  // Write request to wire for NoOperation  func (c *Conn) NoOperation() NoOperationCookie {  	cookie := c.newCookie(false, false) -	c.newRequest(noOperationRequest(), cookie) -	return NoOperationCookie(cookie) +	c.newRequest(c.noOperationRequest(), cookie) +	return NoOperationCookie{cookie}  }  func (c *Conn) NoOperationChecked() NoOperationCookie {  	cookie := c.newCookie(true, false) -	c.newRequest(noOperationRequest(), cookie) -	return NoOperationCookie(cookie) +	c.newRequest(c.noOperationRequest(), cookie) +	return NoOperationCookie{cookie} +} + +func (cook NoOperationCookie) Check() error { +	return cook.check()  }  // Write request to wire for NoOperation -func noOperationRequest() []byte { +func (c *Conn) noOperationRequest() []byte {  	size := 4  	b := 0  	buf := make([]byte, size) @@ -13103,5 +14412,9 @@ func noOperationRequest() []byte {  	buf[b] = 127 // request opcode  	b += 1 +	b += 1                         // padding +	Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 +  	return buf  } | 
