diff options
| author | Milan Nikolic <[email protected]> | 2022-10-29 21:45:28 +0200 |
|---|---|---|
| committer | Milan Nikolic <[email protected]> | 2022-10-29 21:45:28 +0200 |
| commit | ba0b8dd42f220cde96737bbd61d87f1bc136824e (patch) | |
| tree | 41f7f8fdc1ec903272515c18a0751041702da69e /glx/glx.go | |
| parent | 54fbc6f8722629e1bd14c432e9e17499d2925ac7 (diff) | |
Regenerated from xcb-proto 1.15
Diffstat (limited to 'glx/glx.go')
| -rw-r--r-- | glx/glx.go | 133 |
1 files changed, 119 insertions, 14 deletions
@@ -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 @@ -10260,7 +10357,7 @@ func (cook SetClientInfo2ARBCookie) Check() error { // Write request to wire for SetClientInfo2ARB // setClientInfo2ARBRequest writes a SetClientInfo2ARB request to a byte slice. func setClientInfo2ARBRequest(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32, NumVersions uint32, GlStrLen uint32, GlxStrLen uint32, GlVersions []uint32, GlExtensionString string, GlxExtensionString string) []byte { - size := xgb.Pad((((24 + xgb.Pad(((int(NumVersions) * 3) * 4))) + xgb.Pad((int(GlStrLen) * 1))) + xgb.Pad((int(GlxStrLen) * 1)))) + size := xgb.Pad(((((24 + xgb.Pad(((int(NumVersions) * 3) * 4))) + xgb.Pad((int(GlStrLen) * 1))) + 4) + xgb.Pad((int(GlxStrLen) * 1)))) b := 0 buf := make([]byte, size) @@ -10272,7 +10369,7 @@ func setClientInfo2ARBRequest(c *xgb.Conn, MajorVersion uint32, MinorVersion uin buf[b] = 35 // request opcode b += 1 - xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + blen := b b += 2 xgb.Put32(buf[b:], MajorVersion) @@ -10298,10 +10395,14 @@ func setClientInfo2ARBRequest(c *xgb.Conn, MajorVersion uint32, MinorVersion uin copy(buf[b:], GlExtensionString[:GlStrLen]) b += int(GlStrLen) + b = (b + 3) & ^3 // alignment gap + copy(buf[b:], GlxExtensionString[:GlxStrLen]) b += int(GlxStrLen) - return buf + b = xgb.Pad(b) + xgb.Put16(buf[blen:], uint16(b/4)) // write request size in 4-byte units + return buf[:b] } // SetClientInfoARBCookie is a cookie used only for SetClientInfoARB requests. @@ -10344,7 +10445,7 @@ func (cook SetClientInfoARBCookie) Check() error { // Write request to wire for SetClientInfoARB // setClientInfoARBRequest writes a SetClientInfoARB request to a byte slice. func setClientInfoARBRequest(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32, NumVersions uint32, GlStrLen uint32, GlxStrLen uint32, GlVersions []uint32, GlExtensionString string, GlxExtensionString string) []byte { - size := xgb.Pad((((24 + xgb.Pad(((int(NumVersions) * 2) * 4))) + xgb.Pad((int(GlStrLen) * 1))) + xgb.Pad((int(GlxStrLen) * 1)))) + size := xgb.Pad(((((24 + xgb.Pad(((int(NumVersions) * 2) * 4))) + xgb.Pad((int(GlStrLen) * 1))) + 4) + xgb.Pad((int(GlxStrLen) * 1)))) b := 0 buf := make([]byte, size) @@ -10356,7 +10457,7 @@ func setClientInfoARBRequest(c *xgb.Conn, MajorVersion uint32, MinorVersion uint buf[b] = 33 // request opcode b += 1 - xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + blen := b b += 2 xgb.Put32(buf[b:], MajorVersion) @@ -10382,10 +10483,14 @@ func setClientInfoARBRequest(c *xgb.Conn, MajorVersion uint32, MinorVersion uint copy(buf[b:], GlExtensionString[:GlStrLen]) b += int(GlStrLen) + b = (b + 3) & ^3 // alignment gap + copy(buf[b:], GlxExtensionString[:GlxStrLen]) b += int(GlxStrLen) - return buf + b = xgb.Pad(b) + xgb.Put16(buf[blen:], uint16(b/4)) // write request size in 4-byte units + return buf[:b] } // SwapBuffersCookie is a cookie used only for SwapBuffers requests. |
