diff options
| author | aarzilli <alessandro.arzilli@gmail.com> | 2017-01-18 10:52:16 +0100 | 
|---|---|---|
| committer | Přemysl Janouch <p@janouch.name> | 2018-09-08 16:49:27 +0200 | 
| commit | 3906399e7c2a40fbaf355de572cf50a314083f64 (patch) | |
| tree | fcdcca7da60cc3c7c7e87faa5dcc4898d1671514 /nexgb/glx | |
| parent | 1c01d79ba14a802c603ca2e5bbd35156e3363b85 (diff) | |
| download | haven-3906399e7c2a40fbaf355de572cf50a314083f64.tar.gz haven-3906399e7c2a40fbaf355de572cf50a314083f64.tar.xz haven-3906399e7c2a40fbaf355de572cf50a314083f64.zip | |
Regenerated from xcb-proto 1.12
Diffstat (limited to 'nexgb/glx')
| -rw-r--r-- | nexgb/glx/glx.go | 113 | 
1 files changed, 105 insertions, 8 deletions
| diff --git a/nexgb/glx/glx.go b/nexgb/glx/glx.go index cf72d9a..0ecc3b5 100644 --- a/nexgb/glx/glx.go +++ b/nexgb/glx/glx.go @@ -3165,14 +3165,14 @@ func getClipPlaneReply(buf []byte) *GetClipPlaneReply {  	v := new(GetClipPlaneReply)  	b := 1 // skip reply determinant -	b += 1 // padding -  	v.Sequence = xgb.Get16(buf[b:])  	b += 2  	v.Length = xgb.Get32(buf[b:]) // 4-byte units  	b += 4 +	b += 1 // padding +  	b += 24 // padding  	v.Data = make([]Float64, (int(v.Length) / 2)) @@ -4096,14 +4096,14 @@ func getDoublevReply(buf []byte) *GetDoublevReply {  	v := new(GetDoublevReply)  	b := 1 // skip reply determinant -	b += 1 // padding -  	v.Sequence = xgb.Get16(buf[b:])  	b += 2  	v.Length = xgb.Get32(buf[b:]) // 4-byte units  	b += 4 +	b += 1 // padding +  	b += 4 // padding  	v.N = xgb.Get32(buf[b:]) @@ -5340,14 +5340,14 @@ func getMapdvReply(buf []byte) *GetMapdvReply {  	v := new(GetMapdvReply)  	b := 1 // skip reply determinant -	b += 1 // padding -  	v.Sequence = xgb.Get16(buf[b:])  	b += 2  	v.Length = xgb.Get32(buf[b:]) // 4-byte units  	b += 4 +	b += 1 // padding +  	b += 4 // padding  	v.N = xgb.Get32(buf[b:]) @@ -7548,14 +7548,14 @@ func getTexGendvReply(buf []byte) *GetTexGendvReply {  	v := new(GetTexGendvReply)  	b := 1 // skip reply determinant -	b += 1 // padding -  	v.Sequence = xgb.Get16(buf[b:])  	b += 2  	v.Length = xgb.Get32(buf[b:]) // 4-byte units  	b += 4 +	b += 1 // padding +  	b += 4 // padding  	v.N = xgb.Get32(buf[b:]) @@ -8654,6 +8654,103 @@ func isDirectRequest(c *xgb.Conn, Context Context) []byte {  	return buf  } +// IsEnabledCookie is a cookie used only for IsEnabled requests. +type IsEnabledCookie struct { +	*xgb.Cookie +} + +// IsEnabled sends a checked request. +// If an error occurs, it will be returned with the reply by calling IsEnabledCookie.Reply() +func IsEnabled(c *xgb.Conn, ContextTag ContextTag, Capability uint32) IsEnabledCookie { +	c.ExtLock.RLock() +	defer c.ExtLock.RUnlock() +	if _, ok := c.Extensions["GLX"]; !ok { +		panic("Cannot issue request 'IsEnabled' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") +	} +	cookie := c.NewCookie(true, true) +	c.NewRequest(isEnabledRequest(c, ContextTag, Capability), cookie) +	return IsEnabledCookie{cookie} +} + +// IsEnabledUnchecked sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. +func IsEnabledUnchecked(c *xgb.Conn, ContextTag ContextTag, Capability uint32) IsEnabledCookie { +	c.ExtLock.RLock() +	defer c.ExtLock.RUnlock() +	if _, ok := c.Extensions["GLX"]; !ok { +		panic("Cannot issue request 'IsEnabled' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") +	} +	cookie := c.NewCookie(false, true) +	c.NewRequest(isEnabledRequest(c, ContextTag, Capability), cookie) +	return IsEnabledCookie{cookie} +} + +// IsEnabledReply represents the data returned from a IsEnabled request. +type IsEnabledReply struct { +	Sequence uint16 // sequence number of the request for this reply +	Length   uint32 // number of bytes in this reply +	// padding: 1 bytes +	RetVal Bool32 +} + +// Reply blocks and returns the reply data for a IsEnabled request. +func (cook IsEnabledCookie) Reply() (*IsEnabledReply, error) { +	buf, err := cook.Cookie.Reply() +	if err != nil { +		return nil, err +	} +	if buf == nil { +		return nil, nil +	} +	return isEnabledReply(buf), nil +} + +// isEnabledReply reads a byte slice into a IsEnabledReply value. +func isEnabledReply(buf []byte) *IsEnabledReply { +	v := new(IsEnabledReply) +	b := 1 // skip reply determinant + +	b += 1 // padding + +	v.Sequence = xgb.Get16(buf[b:]) +	b += 2 + +	v.Length = xgb.Get32(buf[b:]) // 4-byte units +	b += 4 + +	v.RetVal = Bool32(xgb.Get32(buf[b:])) +	b += 4 + +	return v +} + +// Write request to wire for IsEnabled +// isEnabledRequest writes a IsEnabled request to a byte slice. +func isEnabledRequest(c *xgb.Conn, ContextTag ContextTag, Capability uint32) []byte { +	size := 12 +	b := 0 +	buf := make([]byte, size) + +	c.ExtLock.RLock() +	buf[b] = c.Extensions["GLX"] +	c.ExtLock.RUnlock() +	b += 1 + +	buf[b] = 140 // request opcode +	b += 1 + +	xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units +	b += 2 + +	xgb.Put32(buf[b:], uint32(ContextTag)) +	b += 4 + +	xgb.Put32(buf[b:], Capability) +	b += 4 + +	return buf +} +  // IsListCookie is a cookie used only for IsList requests.  type IsListCookie struct {  	*xgb.Cookie | 
