haven/nexgb/glx/glx.go

10827 lines
309 KiB
Go
Raw Normal View History

2012-05-11 02:06:22 +02:00
// Package glx is the X client API for the GLX extension.
package glx
// This file is automatically generated from glx.xml. Edit at your peril!
import (
2018-09-08 19:57:27 +02:00
xgb "janouch.name/haven/nexgb"
2018-09-08 19:57:27 +02:00
"janouch.name/haven/nexgb/xproto"
)
const (
MajorVersion = 1
MinorVersion = 4
)
// Init must be called before using the GLX extension.
func Init(c *xgb.Conn) error {
reply, err := xproto.QueryExtension(c, 3, "GLX").Reply()
switch {
case err != nil:
return err
case !reply.Present:
return xgb.Errorf("No extension named GLX could be found on on the server.")
}
2016-03-01 15:41:38 +01:00
c.ExtLock.Lock()
c.Extensions["GLX"] = reply.MajorOpcode
2016-03-01 15:41:38 +01:00
c.ExtLock.Unlock()
for evNum, fun := range xgb.NewExtEventFuncs["GLX"] {
xgb.NewEventFuncs[int(reply.FirstEvent)+evNum] = fun
}
for errNum, fun := range xgb.NewExtErrorFuncs["GLX"] {
xgb.NewErrorFuncs[int(reply.FirstError)+errNum] = fun
}
return nil
}
func init() {
xgb.NewExtEventFuncs["GLX"] = make(map[int]xgb.NewEventFun)
xgb.NewExtErrorFuncs["GLX"] = make(map[int]xgb.NewErrorFun)
}
2013-08-12 02:43:26 +02:00
// BadBadContext is the error number for a BadBadContext.
const BadBadContext = 0
type BadContextError GenericError
// BadContextErrorNew constructs a BadContextError value that implements xgb.Error from a byte slice.
func BadContextErrorNew(buf []byte) xgb.Error {
v := BadContextError(GenericErrorNew(buf).(GenericError))
v.NiceName = "BadContext"
return v
}
// SequenceId returns the sequence id attached to the BadBadContext error.
// This is mostly used internally.
func (err BadContextError) SequenceId() uint16 {
return err.Sequence
}
// BadId returns the 'BadValue' number if one exists for the BadBadContext error. If no bad value exists, 0 is returned.
func (err BadContextError) BadId() uint32 {
return 0
}
// Error returns a rudimentary string representation of the BadBadContext error.
func (err BadContextError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode))
return "BadBadContext {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewExtErrorFuncs["GLX"][0] = BadContextErrorNew
}
// BadBadContextState is the error number for a BadBadContextState.
const BadBadContextState = 1
type BadContextStateError GenericError
// BadContextStateErrorNew constructs a BadContextStateError value that implements xgb.Error from a byte slice.
func BadContextStateErrorNew(buf []byte) xgb.Error {
v := BadContextStateError(GenericErrorNew(buf).(GenericError))
v.NiceName = "BadContextState"
return v
}
// SequenceId returns the sequence id attached to the BadBadContextState error.
// This is mostly used internally.
func (err BadContextStateError) SequenceId() uint16 {
return err.Sequence
}
// BadId returns the 'BadValue' number if one exists for the BadBadContextState error. If no bad value exists, 0 is returned.
func (err BadContextStateError) BadId() uint32 {
return 0
}
// Error returns a rudimentary string representation of the BadBadContextState error.
func (err BadContextStateError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode))
return "BadBadContextState {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewExtErrorFuncs["GLX"][1] = BadContextStateErrorNew
}
// BadBadContextTag is the error number for a BadBadContextTag.
const BadBadContextTag = 4
type BadContextTagError GenericError
// BadContextTagErrorNew constructs a BadContextTagError value that implements xgb.Error from a byte slice.
func BadContextTagErrorNew(buf []byte) xgb.Error {
v := BadContextTagError(GenericErrorNew(buf).(GenericError))
v.NiceName = "BadContextTag"
return v
}
// SequenceId returns the sequence id attached to the BadBadContextTag error.
// This is mostly used internally.
func (err BadContextTagError) SequenceId() uint16 {
return err.Sequence
}
// BadId returns the 'BadValue' number if one exists for the BadBadContextTag error. If no bad value exists, 0 is returned.
func (err BadContextTagError) BadId() uint32 {
return 0
}
// Error returns a rudimentary string representation of the BadBadContextTag error.
func (err BadContextTagError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode))
return "BadBadContextTag {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewExtErrorFuncs["GLX"][4] = BadContextTagErrorNew
}
// BadBadCurrentDrawable is the error number for a BadBadCurrentDrawable.
const BadBadCurrentDrawable = 11
type BadCurrentDrawableError GenericError
// BadCurrentDrawableErrorNew constructs a BadCurrentDrawableError value that implements xgb.Error from a byte slice.
func BadCurrentDrawableErrorNew(buf []byte) xgb.Error {
v := BadCurrentDrawableError(GenericErrorNew(buf).(GenericError))
v.NiceName = "BadCurrentDrawable"
return v
}
// SequenceId returns the sequence id attached to the BadBadCurrentDrawable error.
// This is mostly used internally.
func (err BadCurrentDrawableError) SequenceId() uint16 {
return err.Sequence
}
// BadId returns the 'BadValue' number if one exists for the BadBadCurrentDrawable error. If no bad value exists, 0 is returned.
func (err BadCurrentDrawableError) BadId() uint32 {
return 0
}
// Error returns a rudimentary string representation of the BadBadCurrentDrawable error.
func (err BadCurrentDrawableError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode))
return "BadBadCurrentDrawable {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewExtErrorFuncs["GLX"][11] = BadCurrentDrawableErrorNew
}
// BadBadCurrentWindow is the error number for a BadBadCurrentWindow.
const BadBadCurrentWindow = 5
type BadCurrentWindowError GenericError
// BadCurrentWindowErrorNew constructs a BadCurrentWindowError value that implements xgb.Error from a byte slice.
func BadCurrentWindowErrorNew(buf []byte) xgb.Error {
v := BadCurrentWindowError(GenericErrorNew(buf).(GenericError))
v.NiceName = "BadCurrentWindow"
return v
}
// SequenceId returns the sequence id attached to the BadBadCurrentWindow error.
// This is mostly used internally.
func (err BadCurrentWindowError) SequenceId() uint16 {
return err.Sequence
}
// BadId returns the 'BadValue' number if one exists for the BadBadCurrentWindow error. If no bad value exists, 0 is returned.
func (err BadCurrentWindowError) BadId() uint32 {
return 0
}
// Error returns a rudimentary string representation of the BadBadCurrentWindow error.
func (err BadCurrentWindowError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode))
return "BadBadCurrentWindow {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewExtErrorFuncs["GLX"][5] = BadCurrentWindowErrorNew
}
// BadBadDrawable is the error number for a BadBadDrawable.
const BadBadDrawable = 2
type BadDrawableError GenericError
// BadDrawableErrorNew constructs a BadDrawableError value that implements xgb.Error from a byte slice.
func BadDrawableErrorNew(buf []byte) xgb.Error {
v := BadDrawableError(GenericErrorNew(buf).(GenericError))
v.NiceName = "BadDrawable"
return v
}
// SequenceId returns the sequence id attached to the BadBadDrawable error.
// This is mostly used internally.
func (err BadDrawableError) SequenceId() uint16 {
return err.Sequence
}
// BadId returns the 'BadValue' number if one exists for the BadBadDrawable error. If no bad value exists, 0 is returned.
func (err BadDrawableError) BadId() uint32 {
return 0
}
// Error returns a rudimentary string representation of the BadBadDrawable error.
func (err BadDrawableError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode))
return "BadBadDrawable {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewExtErrorFuncs["GLX"][2] = BadDrawableErrorNew
}
// BadBadFBConfig is the error number for a BadBadFBConfig.
const BadBadFBConfig = 9
type BadFBConfigError GenericError
// BadFBConfigErrorNew constructs a BadFBConfigError value that implements xgb.Error from a byte slice.
func BadFBConfigErrorNew(buf []byte) xgb.Error {
v := BadFBConfigError(GenericErrorNew(buf).(GenericError))
v.NiceName = "BadFBConfig"
return v
}
// SequenceId returns the sequence id attached to the BadBadFBConfig error.
// This is mostly used internally.
func (err BadFBConfigError) SequenceId() uint16 {
return err.Sequence
}
// BadId returns the 'BadValue' number if one exists for the BadBadFBConfig error. If no bad value exists, 0 is returned.
func (err BadFBConfigError) BadId() uint32 {
return 0
}
// Error returns a rudimentary string representation of the BadBadFBConfig error.
func (err BadFBConfigError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode))
return "BadBadFBConfig {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewExtErrorFuncs["GLX"][9] = BadFBConfigErrorNew
}
// BadBadLargeRequest is the error number for a BadBadLargeRequest.
const BadBadLargeRequest = 7
type BadLargeRequestError GenericError
// BadLargeRequestErrorNew constructs a BadLargeRequestError value that implements xgb.Error from a byte slice.
func BadLargeRequestErrorNew(buf []byte) xgb.Error {
v := BadLargeRequestError(GenericErrorNew(buf).(GenericError))
v.NiceName = "BadLargeRequest"
return v
}
// SequenceId returns the sequence id attached to the BadBadLargeRequest error.
// This is mostly used internally.
func (err BadLargeRequestError) SequenceId() uint16 {
return err.Sequence
}
// BadId returns the 'BadValue' number if one exists for the BadBadLargeRequest error. If no bad value exists, 0 is returned.
func (err BadLargeRequestError) BadId() uint32 {
return 0
}
// Error returns a rudimentary string representation of the BadBadLargeRequest error.
func (err BadLargeRequestError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode))
return "BadBadLargeRequest {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewExtErrorFuncs["GLX"][7] = BadLargeRequestErrorNew
}
// BadBadPbuffer is the error number for a BadBadPbuffer.
const BadBadPbuffer = 10
type BadPbufferError GenericError
// BadPbufferErrorNew constructs a BadPbufferError value that implements xgb.Error from a byte slice.
func BadPbufferErrorNew(buf []byte) xgb.Error {
v := BadPbufferError(GenericErrorNew(buf).(GenericError))
v.NiceName = "BadPbuffer"
return v
}
// SequenceId returns the sequence id attached to the BadBadPbuffer error.
// This is mostly used internally.
func (err BadPbufferError) SequenceId() uint16 {
return err.Sequence
}
2013-08-12 02:43:26 +02:00
// BadId returns the 'BadValue' number if one exists for the BadBadPbuffer error. If no bad value exists, 0 is returned.
func (err BadPbufferError) BadId() uint32 {
return 0
}
2013-08-12 02:43:26 +02:00
// Error returns a rudimentary string representation of the BadBadPbuffer error.
func (err BadPbufferError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode))
return "BadBadPbuffer {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
2013-08-12 02:43:26 +02:00
func init() {
xgb.NewExtErrorFuncs["GLX"][10] = BadPbufferErrorNew
}
2013-08-12 02:43:26 +02:00
// BadBadPixmap is the error number for a BadBadPixmap.
const BadBadPixmap = 3
2013-08-12 02:43:26 +02:00
type BadPixmapError GenericError
2013-08-12 02:43:26 +02:00
// BadPixmapErrorNew constructs a BadPixmapError value that implements xgb.Error from a byte slice.
func BadPixmapErrorNew(buf []byte) xgb.Error {
v := BadPixmapError(GenericErrorNew(buf).(GenericError))
v.NiceName = "BadPixmap"
return v
}
2013-08-12 02:43:26 +02:00
// SequenceId returns the sequence id attached to the BadBadPixmap error.
// This is mostly used internally.
func (err BadPixmapError) SequenceId() uint16 {
return err.Sequence
}
2013-08-12 02:43:26 +02:00
// BadId returns the 'BadValue' number if one exists for the BadBadPixmap error. If no bad value exists, 0 is returned.
func (err BadPixmapError) BadId() uint32 {
return 0
}
2013-08-12 02:43:26 +02:00
// Error returns a rudimentary string representation of the BadBadPixmap error.
func (err BadPixmapError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode))
return "BadBadPixmap {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
2013-08-12 02:43:26 +02:00
func init() {
xgb.NewExtErrorFuncs["GLX"][3] = BadPixmapErrorNew
}
2013-08-12 02:43:26 +02:00
// BadBadRenderRequest is the error number for a BadBadRenderRequest.
const BadBadRenderRequest = 6
2012-06-05 06:14:34 +02:00
2013-08-12 02:43:26 +02:00
type BadRenderRequestError GenericError
2013-08-12 02:43:26 +02:00
// BadRenderRequestErrorNew constructs a BadRenderRequestError value that implements xgb.Error from a byte slice.
func BadRenderRequestErrorNew(buf []byte) xgb.Error {
v := BadRenderRequestError(GenericErrorNew(buf).(GenericError))
v.NiceName = "BadRenderRequest"
return v
}
// SequenceId returns the sequence id attached to the BadBadRenderRequest error.
// This is mostly used internally.
func (err BadRenderRequestError) SequenceId() uint16 {
return err.Sequence
}
// BadId returns the 'BadValue' number if one exists for the BadBadRenderRequest error. If no bad value exists, 0 is returned.
func (err BadRenderRequestError) BadId() uint32 {
return 0
}
// Error returns a rudimentary string representation of the BadBadRenderRequest error.
func (err BadRenderRequestError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode))
return "BadBadRenderRequest {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewExtErrorFuncs["GLX"][6] = BadRenderRequestErrorNew
}
// BadBadWindow is the error number for a BadBadWindow.
const BadBadWindow = 12
type BadWindowError GenericError
// BadWindowErrorNew constructs a BadWindowError value that implements xgb.Error from a byte slice.
func BadWindowErrorNew(buf []byte) xgb.Error {
v := BadWindowError(GenericErrorNew(buf).(GenericError))
v.NiceName = "BadWindow"
return v
}
// SequenceId returns the sequence id attached to the BadBadWindow error.
// This is mostly used internally.
func (err BadWindowError) SequenceId() uint16 {
return err.Sequence
}
// BadId returns the 'BadValue' number if one exists for the BadBadWindow error. If no bad value exists, 0 is returned.
func (err BadWindowError) BadId() uint32 {
return 0
}
// Error returns a rudimentary string representation of the BadBadWindow error.
func (err BadWindowError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode))
return "BadBadWindow {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewExtErrorFuncs["GLX"][12] = BadWindowErrorNew
}
type Bool32 uint32
// BufferSwapComplete is the event number for a BufferSwapCompleteEvent.
const BufferSwapComplete = 1
type BufferSwapCompleteEvent struct {
Sequence uint16
// padding: 1 bytes
EventType uint16
// padding: 2 bytes
Drawable Drawable
UstHi uint32
UstLo uint32
MscHi uint32
MscLo uint32
Sbc uint32
}
// BufferSwapCompleteEventNew constructs a BufferSwapCompleteEvent value that implements xgb.Event from a byte slice.
func BufferSwapCompleteEventNew(buf []byte) xgb.Event {
v := BufferSwapCompleteEvent{}
b := 1 // don't read event number
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.EventType = xgb.Get16(buf[b:])
b += 2
b += 2 // padding
v.Drawable = Drawable(xgb.Get32(buf[b:]))
b += 4
v.UstHi = xgb.Get32(buf[b:])
b += 4
v.UstLo = xgb.Get32(buf[b:])
b += 4
v.MscHi = xgb.Get32(buf[b:])
b += 4
v.MscLo = xgb.Get32(buf[b:])
b += 4
v.Sbc = xgb.Get32(buf[b:])
b += 4
return v
}
// Bytes writes a BufferSwapCompleteEvent value to a byte slice.
func (v BufferSwapCompleteEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 1
b += 1
b += 1 // padding
b += 2 // skip sequence number
xgb.Put16(buf[b:], v.EventType)
b += 2
b += 2 // padding
xgb.Put32(buf[b:], uint32(v.Drawable))
b += 4
xgb.Put32(buf[b:], v.UstHi)
b += 4
xgb.Put32(buf[b:], v.UstLo)
b += 4
xgb.Put32(buf[b:], v.MscHi)
b += 4
xgb.Put32(buf[b:], v.MscLo)
b += 4
xgb.Put32(buf[b:], v.Sbc)
b += 4
return buf
}
// SequenceId returns the sequence id attached to the BufferSwapComplete event.
// Events without a sequence number (KeymapNotify) return 0.
// This is mostly used internally.
func (v BufferSwapCompleteEvent) SequenceId() uint16 {
return v.Sequence
}
// String is a rudimentary string representation of BufferSwapCompleteEvent.
func (v BufferSwapCompleteEvent) String() string {
fieldVals := make([]string, 0, 9)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("EventType: %d", v.EventType))
fieldVals = append(fieldVals, xgb.Sprintf("Drawable: %d", v.Drawable))
fieldVals = append(fieldVals, xgb.Sprintf("UstHi: %d", v.UstHi))
fieldVals = append(fieldVals, xgb.Sprintf("UstLo: %d", v.UstLo))
fieldVals = append(fieldVals, xgb.Sprintf("MscHi: %d", v.MscHi))
fieldVals = append(fieldVals, xgb.Sprintf("MscLo: %d", v.MscLo))
fieldVals = append(fieldVals, xgb.Sprintf("Sbc: %d", v.Sbc))
return "BufferSwapComplete {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewExtEventFuncs["GLX"][1] = BufferSwapCompleteEventNew
}
2013-08-12 02:43:26 +02:00
type Context uint32
func NewContextId(c *xgb.Conn) (Context, error) {
id, err := c.NewId()
if err != nil {
return 0, err
}
return Context(id), nil
}
type ContextTag uint32
type Drawable uint32
func NewDrawableId(c *xgb.Conn) (Drawable, error) {
id, err := c.NewId()
if err != nil {
return 0, err
}
return Drawable(id), nil
}
type Fbconfig uint32
func NewFbconfigId(c *xgb.Conn) (Fbconfig, error) {
id, err := c.NewId()
if err != nil {
return 0, err
}
return Fbconfig(id), nil
}
type Float32 float64
type Float64 float64
// BadGLXBadProfileARB is the error number for a BadGLXBadProfileARB.
const BadGLXBadProfileARB = 13
type GLXBadProfileARBError GenericError
// GLXBadProfileARBErrorNew constructs a GLXBadProfileARBError value that implements xgb.Error from a byte slice.
func GLXBadProfileARBErrorNew(buf []byte) xgb.Error {
v := GLXBadProfileARBError(GenericErrorNew(buf).(GenericError))
v.NiceName = "GLXBadProfileARB"
return v
}
// SequenceId returns the sequence id attached to the BadGLXBadProfileARB error.
// This is mostly used internally.
func (err GLXBadProfileARBError) SequenceId() uint16 {
return err.Sequence
}
// BadId returns the 'BadValue' number if one exists for the BadGLXBadProfileARB error. If no bad value exists, 0 is returned.
func (err GLXBadProfileARBError) BadId() uint32 {
return 0
}
// Error returns a rudimentary string representation of the BadGLXBadProfileARB error.
func (err GLXBadProfileARBError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode))
return "BadGLXBadProfileARB {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewExtErrorFuncs["GLX"][13] = GLXBadProfileARBErrorNew
}
const (
GcGlCurrentBit = 1
GcGlPointBit = 2
GcGlLineBit = 4
GcGlPolygonBit = 8
GcGlPolygonStippleBit = 16
GcGlPixelModeBit = 32
GcGlLightingBit = 64
GcGlFogBit = 128
GcGlDepthBufferBit = 256
GcGlAccumBufferBit = 512
GcGlStencilBufferBit = 1024
GcGlViewportBit = 2048
GcGlTransformBit = 4096
GcGlEnableBit = 8192
GcGlColorBufferBit = 16384
GcGlHintBit = 32768
GcGlEvalBit = 65536
GcGlListBit = 131072
GcGlTextureBit = 262144
GcGlScissorBit = 524288
GcGlAllAttribBits = 16777215
)
2013-08-12 02:43:26 +02:00
// BadGeneric is the error number for a BadGeneric.
const BadGeneric = -1
2013-08-12 02:43:26 +02:00
type GenericError struct {
Sequence uint16
NiceName string
BadValue uint32
MinorOpcode uint16
MajorOpcode byte
// padding: 21 bytes
}
2013-08-12 02:43:26 +02:00
// GenericErrorNew constructs a GenericError value that implements xgb.Error from a byte slice.
func GenericErrorNew(buf []byte) xgb.Error {
v := GenericError{}
v.NiceName = "Generic"
b := 1 // skip error determinant
b += 1 // don't read error number
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.BadValue = xgb.Get32(buf[b:])
b += 4
v.MinorOpcode = xgb.Get16(buf[b:])
b += 2
v.MajorOpcode = buf[b]
b += 1
b += 21 // padding
2013-08-12 02:43:26 +02:00
return v
}
2013-08-12 02:43:26 +02:00
// SequenceId returns the sequence id attached to the BadGeneric error.
// This is mostly used internally.
func (err GenericError) SequenceId() uint16 {
return err.Sequence
}
2013-08-12 02:43:26 +02:00
// BadId returns the 'BadValue' number if one exists for the BadGeneric error. If no bad value exists, 0 is returned.
func (err GenericError) BadId() uint32 {
return 0
}
2013-08-12 02:43:26 +02:00
// Error returns a rudimentary string representation of the BadGeneric error.
2013-08-12 02:43:26 +02:00
func (err GenericError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode))
return "BadGeneric {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
2013-08-12 02:43:26 +02:00
func init() {
xgb.NewExtErrorFuncs["GLX"][-1] = GenericErrorNew
}
2013-08-12 02:43:26 +02:00
const (
PbcdtWindow = 32793
PbcdtPbuffer = 32794
)
2013-08-12 02:43:26 +02:00
const (
PbcetDamaged = 32791
PbcetSaved = 32792
)
type Pbuffer uint32
func NewPbufferId(c *xgb.Conn) (Pbuffer, error) {
id, err := c.NewId()
if err != nil {
return 0, err
}
2013-08-12 02:43:26 +02:00
return Pbuffer(id), nil
}
2012-05-11 05:57:34 +02:00
// PbufferClobber is the event number for a PbufferClobberEvent.
const PbufferClobber = 0
type PbufferClobberEvent struct {
Sequence uint16
// padding: 1 bytes
EventType uint16
DrawType uint16
Drawable Drawable
BMask uint32
AuxBuffer uint16
X uint16
Y uint16
Width uint16
Height uint16
Count uint16
// padding: 4 bytes
}
2012-05-11 05:57:34 +02:00
// PbufferClobberEventNew constructs a PbufferClobberEvent value that implements xgb.Event from a byte slice.
func PbufferClobberEventNew(buf []byte) xgb.Event {
v := PbufferClobberEvent{}
b := 1 // don't read event number
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.EventType = xgb.Get16(buf[b:])
b += 2
v.DrawType = xgb.Get16(buf[b:])
b += 2
v.Drawable = Drawable(xgb.Get32(buf[b:]))
b += 4
v.BMask = xgb.Get32(buf[b:])
b += 4
v.AuxBuffer = xgb.Get16(buf[b:])
b += 2
v.X = xgb.Get16(buf[b:])
b += 2
v.Y = xgb.Get16(buf[b:])
b += 2
v.Width = xgb.Get16(buf[b:])
b += 2
v.Height = xgb.Get16(buf[b:])
b += 2
v.Count = xgb.Get16(buf[b:])
b += 2
b += 4 // padding
return v
}
2012-05-11 05:57:34 +02:00
// Bytes writes a PbufferClobberEvent value to a byte slice.
func (v PbufferClobberEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 0
b += 1
b += 1 // padding
b += 2 // skip sequence number
xgb.Put16(buf[b:], v.EventType)
b += 2
xgb.Put16(buf[b:], v.DrawType)
b += 2
xgb.Put32(buf[b:], uint32(v.Drawable))
b += 4
xgb.Put32(buf[b:], v.BMask)
b += 4
xgb.Put16(buf[b:], v.AuxBuffer)
b += 2
xgb.Put16(buf[b:], v.X)
b += 2
xgb.Put16(buf[b:], v.Y)
b += 2
xgb.Put16(buf[b:], v.Width)
b += 2
xgb.Put16(buf[b:], v.Height)
b += 2
xgb.Put16(buf[b:], v.Count)
b += 2
b += 4 // padding
return buf
}
2012-05-11 05:57:34 +02:00
// SequenceId returns the sequence id attached to the PbufferClobber event.
// Events without a sequence number (KeymapNotify) return 0.
// This is mostly used internally.
func (v PbufferClobberEvent) SequenceId() uint16 {
return v.Sequence
}
2012-05-11 05:57:34 +02:00
// String is a rudimentary string representation of PbufferClobberEvent.
func (v PbufferClobberEvent) String() string {
fieldVals := make([]string, 0, 12)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("EventType: %d", v.EventType))
fieldVals = append(fieldVals, xgb.Sprintf("DrawType: %d", v.DrawType))
fieldVals = append(fieldVals, xgb.Sprintf("Drawable: %d", v.Drawable))
fieldVals = append(fieldVals, xgb.Sprintf("BMask: %d", v.BMask))
fieldVals = append(fieldVals, xgb.Sprintf("AuxBuffer: %d", v.AuxBuffer))
fieldVals = append(fieldVals, xgb.Sprintf("X: %d", v.X))
fieldVals = append(fieldVals, xgb.Sprintf("Y: %d", v.Y))
fieldVals = append(fieldVals, xgb.Sprintf("Width: %d", v.Width))
fieldVals = append(fieldVals, xgb.Sprintf("Height: %d", v.Height))
fieldVals = append(fieldVals, xgb.Sprintf("Count: %d", v.Count))
return "PbufferClobber {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewExtEventFuncs["GLX"][0] = PbufferClobberEventNew
}
2013-08-12 02:43:26 +02:00
type Pixmap uint32
2013-08-12 02:43:26 +02:00
func NewPixmapId(c *xgb.Conn) (Pixmap, error) {
id, err := c.NewId()
if err != nil {
return 0, err
}
return Pixmap(id), nil
}
2013-08-12 02:43:26 +02:00
const (
RmGlRender = 7168
RmGlFeedback = 7169
RmGlSelect = 7170
)
2013-08-12 02:43:26 +02:00
// BadUnsupportedPrivateRequest is the error number for a BadUnsupportedPrivateRequest.
const BadUnsupportedPrivateRequest = 8
2013-08-12 02:43:26 +02:00
type UnsupportedPrivateRequestError GenericError
2013-08-12 02:43:26 +02:00
// UnsupportedPrivateRequestErrorNew constructs a UnsupportedPrivateRequestError value that implements xgb.Error from a byte slice.
func UnsupportedPrivateRequestErrorNew(buf []byte) xgb.Error {
v := UnsupportedPrivateRequestError(GenericErrorNew(buf).(GenericError))
v.NiceName = "UnsupportedPrivateRequest"
return v
}
2013-08-12 02:43:26 +02:00
// SequenceId returns the sequence id attached to the BadUnsupportedPrivateRequest error.
2012-05-11 05:57:34 +02:00
// This is mostly used internally.
2013-08-12 02:43:26 +02:00
func (err UnsupportedPrivateRequestError) SequenceId() uint16 {
return err.Sequence
}
2013-08-12 02:43:26 +02:00
// BadId returns the 'BadValue' number if one exists for the BadUnsupportedPrivateRequest error. If no bad value exists, 0 is returned.
func (err UnsupportedPrivateRequestError) BadId() uint32 {
return 0
}
2013-08-12 02:43:26 +02:00
// Error returns a rudimentary string representation of the BadUnsupportedPrivateRequest error.
func (err UnsupportedPrivateRequestError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode))
2013-08-12 02:43:26 +02:00
return "BadUnsupportedPrivateRequest {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
2013-08-12 02:43:26 +02:00
xgb.NewExtErrorFuncs["GLX"][8] = UnsupportedPrivateRequestErrorNew
}
2013-08-12 02:43:26 +02:00
type Window uint32
2013-08-12 02:43:26 +02:00
func NewWindowId(c *xgb.Conn) (Window, error) {
id, err := c.NewId()
if err != nil {
return 0, err
}
return Window(id), nil
}
2013-08-12 02:43:26 +02:00
// Skipping definition for base type 'Bool'
// Skipping definition for base type 'Byte'
// Skipping definition for base type 'Card8'
// Skipping definition for base type 'Char'
// Skipping definition for base type 'Void'
// Skipping definition for base type 'Double'
// Skipping definition for base type 'Float'
// Skipping definition for base type 'Int16'
// Skipping definition for base type 'Int32'
// Skipping definition for base type 'Int8'
// Skipping definition for base type 'Card16'
// Skipping definition for base type 'Card32'
// AreTexturesResidentCookie is a cookie used only for AreTexturesResident requests.
type AreTexturesResidentCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// AreTexturesResident sends a checked request.
// If an error occurs, it will be returned with the reply by calling AreTexturesResidentCookie.Reply.
2013-08-12 02:43:26 +02:00
func AreTexturesResident(c *xgb.Conn, ContextTag ContextTag, N int32, Textures []uint32) AreTexturesResidentCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
2013-08-12 02:43:26 +02:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'AreTexturesResident' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(areTexturesResidentRequest(c, ContextTag, N, Textures), cookie)
return AreTexturesResidentCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// AreTexturesResidentUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func AreTexturesResidentUnchecked(c *xgb.Conn, ContextTag ContextTag, N int32, Textures []uint32) AreTexturesResidentCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
2013-08-12 02:43:26 +02:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'AreTexturesResident' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(areTexturesResidentRequest(c, ContextTag, N, Textures), cookie)
return AreTexturesResidentCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// AreTexturesResidentReply represents the data returned from a AreTexturesResident request.
type AreTexturesResidentReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
RetVal Bool32
// padding: 20 bytes
Data []bool // size: xgb.Pad(((int(Length) * 4) * 1))
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a AreTexturesResident request.
func (cook AreTexturesResidentCookie) Reply() (*AreTexturesResidentReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return areTexturesResidentReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// areTexturesResidentReply reads a byte slice into a AreTexturesResidentReply value.
func areTexturesResidentReply(buf []byte) *AreTexturesResidentReply {
v := new(AreTexturesResidentReply)
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
b += 20 // padding
2013-08-12 02:43:26 +02:00
v.Data = make([]bool, (int(v.Length) * 4))
for i := 0; i < int((int(v.Length) * 4)); i++ {
if buf[b] == 1 {
v.Data[i] = true
} else {
v.Data[i] = false
}
b += 1
}
return v
}
// areTexturesResidentRequest writes a AreTexturesResident request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func areTexturesResidentRequest(c *xgb.Conn, ContextTag ContextTag, N int32, Textures []uint32) []byte {
size := xgb.Pad((12 + xgb.Pad((int(N) * 4))))
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
2013-08-12 02:43:26 +02:00
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
2013-08-12 02:43:26 +02:00
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 143 // request opcode
b += 1
2013-08-12 02:43:26 +02:00
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(N))
b += 4
2013-08-12 02:43:26 +02:00
for i := 0; i < int(N); i++ {
xgb.Put32(buf[b:], Textures[i])
b += 4
}
2013-08-12 02:43:26 +02:00
return buf
}
2013-08-12 02:43:26 +02:00
// ChangeDrawableAttributesCookie is a cookie used only for ChangeDrawableAttributes requests.
type ChangeDrawableAttributesCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// ChangeDrawableAttributes sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func ChangeDrawableAttributes(c *xgb.Conn, Drawable Drawable, NumAttribs uint32, Attribs []uint32) ChangeDrawableAttributesCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
2013-08-12 02:43:26 +02:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'ChangeDrawableAttributes' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(changeDrawableAttributesRequest(c, Drawable, NumAttribs, Attribs), cookie)
return ChangeDrawableAttributesCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// ChangeDrawableAttributesChecked sends a checked request.
// If an error occurs, it can be retrieved using ChangeDrawableAttributesCookie.Check.
2013-08-12 02:43:26 +02:00
func ChangeDrawableAttributesChecked(c *xgb.Conn, Drawable Drawable, NumAttribs uint32, Attribs []uint32) ChangeDrawableAttributesCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
2013-08-12 02:43:26 +02:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'ChangeDrawableAttributes' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(changeDrawableAttributesRequest(c, Drawable, NumAttribs, Attribs), cookie)
return ChangeDrawableAttributesCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook ChangeDrawableAttributesCookie) Check() error {
return cook.Cookie.Check()
}
// changeDrawableAttributesRequest writes a ChangeDrawableAttributes request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func changeDrawableAttributesRequest(c *xgb.Conn, Drawable Drawable, NumAttribs uint32, Attribs []uint32) []byte {
size := xgb.Pad((12 + xgb.Pad(((int(NumAttribs) * 2) * 4))))
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
2013-08-12 02:43:26 +02:00
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
2013-08-12 02:43:26 +02:00
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 30 // request opcode
b += 1
2013-08-12 02:43:26 +02:00
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(Drawable))
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], NumAttribs)
b += 4
2013-08-12 02:43:26 +02:00
for i := 0; i < int((int(NumAttribs) * 2)); i++ {
xgb.Put32(buf[b:], Attribs[i])
b += 4
}
2013-08-12 02:43:26 +02:00
return buf
}
2013-08-12 02:43:26 +02:00
// ClientInfoCookie is a cookie used only for ClientInfo requests.
type ClientInfoCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// ClientInfo sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func ClientInfo(c *xgb.Conn, MajorVersion, MinorVersion, StrLen uint32, String string) ClientInfoCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
2013-08-12 02:43:26 +02:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'ClientInfo' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(clientInfoRequest(c, MajorVersion, MinorVersion, StrLen, String), cookie)
return ClientInfoCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// ClientInfoChecked sends a checked request.
// If an error occurs, it can be retrieved using ClientInfoCookie.Check.
func ClientInfoChecked(c *xgb.Conn, MajorVersion, MinorVersion, StrLen uint32, String string) ClientInfoCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
2013-08-12 02:43:26 +02:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'ClientInfo' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(clientInfoRequest(c, MajorVersion, MinorVersion, StrLen, String), cookie)
return ClientInfoCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook ClientInfoCookie) Check() error {
return cook.Cookie.Check()
}
// clientInfoRequest writes a ClientInfo request to a byte slice for transfer.
func clientInfoRequest(c *xgb.Conn, MajorVersion, MinorVersion, StrLen uint32, String string) []byte {
2013-08-12 02:43:26 +02:00
size := xgb.Pad((16 + xgb.Pad((int(StrLen) * 1))))
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
2013-08-12 02:43:26 +02:00
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
2013-08-12 02:43:26 +02:00
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 20 // request opcode
b += 1
2013-08-12 02:43:26 +02:00
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], MajorVersion)
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], MinorVersion)
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], StrLen)
b += 4
2013-08-12 02:43:26 +02:00
copy(buf[b:], String[:StrLen])
b += int(StrLen)
2013-08-12 02:43:26 +02:00
return buf
}
2013-08-12 02:43:26 +02:00
// CopyContextCookie is a cookie used only for CopyContext requests.
type CopyContextCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// CopyContext sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func CopyContext(c *xgb.Conn, Src, Dest Context, Mask uint32, SrcContextTag ContextTag) CopyContextCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
2013-08-12 02:43:26 +02:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'CopyContext' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(copyContextRequest(c, Src, Dest, Mask, SrcContextTag), cookie)
return CopyContextCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// CopyContextChecked sends a checked request.
// If an error occurs, it can be retrieved using CopyContextCookie.Check.
func CopyContextChecked(c *xgb.Conn, Src, Dest Context, Mask uint32, SrcContextTag ContextTag) CopyContextCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
2013-08-12 02:43:26 +02:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'CopyContext' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(copyContextRequest(c, Src, Dest, Mask, SrcContextTag), cookie)
return CopyContextCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook CopyContextCookie) Check() error {
return cook.Cookie.Check()
}
// copyContextRequest writes a CopyContext request to a byte slice for transfer.
func copyContextRequest(c *xgb.Conn, Src, Dest Context, Mask uint32, SrcContextTag ContextTag) []byte {
2013-08-12 02:43:26 +02:00
size := 20
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
2013-08-12 02:43:26 +02:00
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
2013-08-12 02:43:26 +02:00
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 10 // request opcode
b += 1
2013-08-12 02:43:26 +02:00
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(Src))
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(Dest))
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Mask)
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(SrcContextTag))
b += 4
2013-08-12 02:43:26 +02:00
return buf
}
2013-08-12 02:43:26 +02:00
// CreateContextCookie is a cookie used only for CreateContext requests.
type CreateContextCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// CreateContext sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func CreateContext(c *xgb.Conn, Context Context, Visual xproto.Visualid, Screen uint32, ShareList Context, IsDirect bool) CreateContextCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
2013-08-12 02:43:26 +02:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'CreateContext' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(createContextRequest(c, Context, Visual, Screen, ShareList, IsDirect), cookie)
return CreateContextCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// CreateContextChecked sends a checked request.
// If an error occurs, it can be retrieved using CreateContextCookie.Check.
2013-08-12 02:43:26 +02:00
func CreateContextChecked(c *xgb.Conn, Context Context, Visual xproto.Visualid, Screen uint32, ShareList Context, IsDirect bool) CreateContextCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
2013-08-12 02:43:26 +02:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'CreateContext' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(createContextRequest(c, Context, Visual, Screen, ShareList, IsDirect), cookie)
return CreateContextCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook CreateContextCookie) Check() error {
return cook.Cookie.Check()
}
// createContextRequest writes a CreateContext request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func createContextRequest(c *xgb.Conn, Context Context, Visual xproto.Visualid, Screen uint32, ShareList Context, IsDirect bool) []byte {
size := 24
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
2013-08-12 02:43:26 +02:00
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
2013-08-12 02:43:26 +02:00
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 3 // request opcode
b += 1
2013-08-12 02:43:26 +02:00
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(Context))
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(Visual))
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Screen)
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(ShareList))
b += 4
2013-08-12 02:43:26 +02:00
if IsDirect {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
2013-08-12 02:43:26 +02:00
b += 3 // padding
return buf
}
2013-08-12 02:43:26 +02:00
// CreateContextAttribsARBCookie is a cookie used only for CreateContextAttribsARB requests.
type CreateContextAttribsARBCookie struct {
*xgb.Cookie
}
// CreateContextAttribsARB sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func CreateContextAttribsARB(c *xgb.Conn, Context Context, Fbconfig Fbconfig, Screen uint32, ShareList Context, IsDirect bool, NumAttribs uint32, Attribs []uint32) CreateContextAttribsARBCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
2013-08-12 02:43:26 +02:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'CreateContextAttribsARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(createContextAttribsARBRequest(c, Context, Fbconfig, Screen, ShareList, IsDirect, NumAttribs, Attribs), cookie)
return CreateContextAttribsARBCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// CreateContextAttribsARBChecked sends a checked request.
// If an error occurs, it can be retrieved using CreateContextAttribsARBCookie.Check.
2013-08-12 02:43:26 +02:00
func CreateContextAttribsARBChecked(c *xgb.Conn, Context Context, Fbconfig Fbconfig, Screen uint32, ShareList Context, IsDirect bool, NumAttribs uint32, Attribs []uint32) CreateContextAttribsARBCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
2013-08-12 02:43:26 +02:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'CreateContextAttribsARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(createContextAttribsARBRequest(c, Context, Fbconfig, Screen, ShareList, IsDirect, NumAttribs, Attribs), cookie)
return CreateContextAttribsARBCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook CreateContextAttribsARBCookie) Check() error {
return cook.Cookie.Check()
}
// createContextAttribsARBRequest writes a CreateContextAttribsARB request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func createContextAttribsARBRequest(c *xgb.Conn, Context Context, Fbconfig Fbconfig, Screen uint32, ShareList Context, IsDirect bool, NumAttribs uint32, Attribs []uint32) []byte {
size := xgb.Pad((28 + xgb.Pad(((int(NumAttribs) * 2) * 4))))
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
2013-08-12 02:43:26 +02:00
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
2013-08-12 02:43:26 +02:00
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 34 // request opcode
b += 1
2013-08-12 02:43:26 +02:00
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(Context))
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(Fbconfig))
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Screen)
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(ShareList))
b += 4
2013-08-12 02:43:26 +02:00
if IsDirect {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
2013-08-12 02:43:26 +02:00
b += 3 // padding
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], NumAttribs)
b += 4
for i := 0; i < int((int(NumAttribs) * 2)); i++ {
xgb.Put32(buf[b:], Attribs[i])
b += 4
}
return buf
}
2013-08-12 02:43:26 +02:00
// CreateGLXPixmapCookie is a cookie used only for CreateGLXPixmap requests.
type CreateGLXPixmapCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// CreateGLXPixmap sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func CreateGLXPixmap(c *xgb.Conn, Screen uint32, Visual xproto.Visualid, Pixmap xproto.Pixmap, GlxPixmap Pixmap) CreateGLXPixmapCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
2013-08-12 02:43:26 +02:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'CreateGLXPixmap' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(createGLXPixmapRequest(c, Screen, Visual, Pixmap, GlxPixmap), cookie)
return CreateGLXPixmapCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// CreateGLXPixmapChecked sends a checked request.
// If an error occurs, it can be retrieved using CreateGLXPixmapCookie.Check.
2013-08-12 02:43:26 +02:00
func CreateGLXPixmapChecked(c *xgb.Conn, Screen uint32, Visual xproto.Visualid, Pixmap xproto.Pixmap, GlxPixmap Pixmap) CreateGLXPixmapCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
2013-08-12 02:43:26 +02:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'CreateGLXPixmap' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(createGLXPixmapRequest(c, Screen, Visual, Pixmap, GlxPixmap), cookie)
return CreateGLXPixmapCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook CreateGLXPixmapCookie) Check() error {
return cook.Cookie.Check()
}
// createGLXPixmapRequest writes a CreateGLXPixmap request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func createGLXPixmapRequest(c *xgb.Conn, Screen uint32, Visual xproto.Visualid, Pixmap xproto.Pixmap, GlxPixmap Pixmap) []byte {
size := 20
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
2013-08-12 02:43:26 +02:00
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
2013-08-12 02:43:26 +02:00
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 13 // request opcode
b += 1
2013-08-12 02:43:26 +02:00
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Screen)
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(Visual))
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(Pixmap))
b += 4
xgb.Put32(buf[b:], uint32(GlxPixmap))
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// CreateNewContextCookie is a cookie used only for CreateNewContext requests.
type CreateNewContextCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// CreateNewContext sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func CreateNewContext(c *xgb.Conn, Context Context, Fbconfig Fbconfig, Screen, RenderType uint32, ShareList Context, IsDirect bool) CreateNewContextCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'CreateNewContext' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
2013-08-12 02:43:26 +02:00
c.NewRequest(createNewContextRequest(c, Context, Fbconfig, Screen, RenderType, ShareList, IsDirect), cookie)
return CreateNewContextCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// CreateNewContextChecked sends a checked request.
// If an error occurs, it can be retrieved using CreateNewContextCookie.Check.
func CreateNewContextChecked(c *xgb.Conn, Context Context, Fbconfig Fbconfig, Screen, RenderType uint32, ShareList Context, IsDirect bool) CreateNewContextCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'CreateNewContext' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
2013-08-12 02:43:26 +02:00
c.NewRequest(createNewContextRequest(c, Context, Fbconfig, Screen, RenderType, ShareList, IsDirect), cookie)
return CreateNewContextCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
2013-08-12 02:43:26 +02:00
func (cook CreateNewContextCookie) Check() error {
return cook.Cookie.Check()
}
// createNewContextRequest writes a CreateNewContext request to a byte slice for transfer.
func createNewContextRequest(c *xgb.Conn, Context Context, Fbconfig Fbconfig, Screen, RenderType uint32, ShareList Context, IsDirect bool) []byte {
2013-08-12 02:43:26 +02:00
size := 28
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 24 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(Context))
b += 4
xgb.Put32(buf[b:], uint32(Fbconfig))
b += 4
xgb.Put32(buf[b:], Screen)
b += 4
xgb.Put32(buf[b:], RenderType)
b += 4
xgb.Put32(buf[b:], uint32(ShareList))
b += 4
2013-08-12 02:43:26 +02:00
if IsDirect {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
b += 3 // padding
return buf
}
2013-08-12 02:43:26 +02:00
// CreatePbufferCookie is a cookie used only for CreatePbuffer requests.
type CreatePbufferCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// CreatePbuffer sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2013-08-12 02:43:26 +02:00
func CreatePbuffer(c *xgb.Conn, Screen uint32, Fbconfig Fbconfig, Pbuffer Pbuffer, NumAttribs uint32, Attribs []uint32) CreatePbufferCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'CreatePbuffer' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
2013-08-12 02:43:26 +02:00
c.NewRequest(createPbufferRequest(c, Screen, Fbconfig, Pbuffer, NumAttribs, Attribs), cookie)
return CreatePbufferCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// CreatePbufferChecked sends a checked request.
// If an error occurs, it can be retrieved using CreatePbufferCookie.Check.
2013-08-12 02:43:26 +02:00
func CreatePbufferChecked(c *xgb.Conn, Screen uint32, Fbconfig Fbconfig, Pbuffer Pbuffer, NumAttribs uint32, Attribs []uint32) CreatePbufferCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'CreatePbuffer' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
2013-08-12 02:43:26 +02:00
c.NewRequest(createPbufferRequest(c, Screen, Fbconfig, Pbuffer, NumAttribs, Attribs), cookie)
return CreatePbufferCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
2013-08-12 02:43:26 +02:00
func (cook CreatePbufferCookie) Check() error {
return cook.Cookie.Check()
}
// createPbufferRequest writes a CreatePbuffer request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func createPbufferRequest(c *xgb.Conn, Screen uint32, Fbconfig Fbconfig, Pbuffer Pbuffer, NumAttribs uint32, Attribs []uint32) []byte {
size := xgb.Pad((20 + xgb.Pad(((int(NumAttribs) * 2) * 4))))
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 27 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Screen)
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(Fbconfig))
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(Pbuffer))
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], NumAttribs)
b += 4
2013-08-12 02:43:26 +02:00
for i := 0; i < int((int(NumAttribs) * 2)); i++ {
xgb.Put32(buf[b:], Attribs[i])
b += 4
}
return buf
}
2013-08-12 02:43:26 +02:00
// CreatePixmapCookie is a cookie used only for CreatePixmap requests.
type CreatePixmapCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// CreatePixmap sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2013-08-12 02:43:26 +02:00
func CreatePixmap(c *xgb.Conn, Screen uint32, Fbconfig Fbconfig, Pixmap xproto.Pixmap, GlxPixmap Pixmap, NumAttribs uint32, Attribs []uint32) CreatePixmapCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'CreatePixmap' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
2013-08-12 02:43:26 +02:00
c.NewRequest(createPixmapRequest(c, Screen, Fbconfig, Pixmap, GlxPixmap, NumAttribs, Attribs), cookie)
return CreatePixmapCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// CreatePixmapChecked sends a checked request.
// If an error occurs, it can be retrieved using CreatePixmapCookie.Check.
2013-08-12 02:43:26 +02:00
func CreatePixmapChecked(c *xgb.Conn, Screen uint32, Fbconfig Fbconfig, Pixmap xproto.Pixmap, GlxPixmap Pixmap, NumAttribs uint32, Attribs []uint32) CreatePixmapCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'CreatePixmap' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
2013-08-12 02:43:26 +02:00
c.NewRequest(createPixmapRequest(c, Screen, Fbconfig, Pixmap, GlxPixmap, NumAttribs, Attribs), cookie)
return CreatePixmapCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
2013-08-12 02:43:26 +02:00
func (cook CreatePixmapCookie) Check() error {
return cook.Cookie.Check()
}
// createPixmapRequest writes a CreatePixmap request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func createPixmapRequest(c *xgb.Conn, Screen uint32, Fbconfig Fbconfig, Pixmap xproto.Pixmap, GlxPixmap Pixmap, NumAttribs uint32, Attribs []uint32) []byte {
size := xgb.Pad((24 + xgb.Pad(((int(NumAttribs) * 2) * 4))))
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 22 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Screen)
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(Fbconfig))
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(Pixmap))
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(GlxPixmap))
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], NumAttribs)
b += 4
2013-08-12 02:43:26 +02:00
for i := 0; i < int((int(NumAttribs) * 2)); i++ {
xgb.Put32(buf[b:], Attribs[i])
b += 4
}
return buf
}
2013-08-12 02:43:26 +02:00
// CreateWindowCookie is a cookie used only for CreateWindow requests.
type CreateWindowCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// CreateWindow sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2013-08-12 02:43:26 +02:00
func CreateWindow(c *xgb.Conn, Screen uint32, Fbconfig Fbconfig, Window xproto.Window, GlxWindow Window, NumAttribs uint32, Attribs []uint32) CreateWindowCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'CreateWindow' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
2013-08-12 02:43:26 +02:00
c.NewRequest(createWindowRequest(c, Screen, Fbconfig, Window, GlxWindow, NumAttribs, Attribs), cookie)
return CreateWindowCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// CreateWindowChecked sends a checked request.
// If an error occurs, it can be retrieved using CreateWindowCookie.Check.
2013-08-12 02:43:26 +02:00
func CreateWindowChecked(c *xgb.Conn, Screen uint32, Fbconfig Fbconfig, Window xproto.Window, GlxWindow Window, NumAttribs uint32, Attribs []uint32) CreateWindowCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'CreateWindow' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
2013-08-12 02:43:26 +02:00
c.NewRequest(createWindowRequest(c, Screen, Fbconfig, Window, GlxWindow, NumAttribs, Attribs), cookie)
return CreateWindowCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
2013-08-12 02:43:26 +02:00
func (cook CreateWindowCookie) Check() error {
return cook.Cookie.Check()
}
// createWindowRequest writes a CreateWindow request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func createWindowRequest(c *xgb.Conn, Screen uint32, Fbconfig Fbconfig, Window xproto.Window, GlxWindow Window, NumAttribs uint32, Attribs []uint32) []byte {
size := xgb.Pad((24 + xgb.Pad(((int(NumAttribs) * 2) * 4))))
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 31 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Screen)
b += 4
xgb.Put32(buf[b:], uint32(Fbconfig))
b += 4
xgb.Put32(buf[b:], uint32(Window))
b += 4
xgb.Put32(buf[b:], uint32(GlxWindow))
b += 4
xgb.Put32(buf[b:], NumAttribs)
b += 4
2013-08-12 02:43:26 +02:00
for i := 0; i < int((int(NumAttribs) * 2)); i++ {
xgb.Put32(buf[b:], Attribs[i])
b += 4
}
return buf
}
2013-08-12 02:43:26 +02:00
// DeleteListsCookie is a cookie used only for DeleteLists requests.
type DeleteListsCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// DeleteLists sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2013-08-12 02:43:26 +02:00
func DeleteLists(c *xgb.Conn, ContextTag ContextTag, List uint32, Range int32) DeleteListsCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'DeleteLists' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-12 02:43:26 +02:00
cookie := c.NewCookie(false, false)
c.NewRequest(deleteListsRequest(c, ContextTag, List, Range), cookie)
return DeleteListsCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// DeleteListsChecked sends a checked request.
// If an error occurs, it can be retrieved using DeleteListsCookie.Check.
2013-08-12 02:43:26 +02:00
func DeleteListsChecked(c *xgb.Conn, ContextTag ContextTag, List uint32, Range int32) DeleteListsCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
2013-08-12 02:43:26 +02:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'DeleteLists' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-12 02:43:26 +02:00
cookie := c.NewCookie(true, false)
c.NewRequest(deleteListsRequest(c, ContextTag, List, Range), cookie)
return DeleteListsCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook DeleteListsCookie) Check() error {
return cook.Cookie.Check()
}
// deleteListsRequest writes a DeleteLists request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func deleteListsRequest(c *xgb.Conn, ContextTag ContextTag, List uint32, Range int32) []byte {
size := 16
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 103 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], List)
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(Range))
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// DeleteQueriesARBCookie is a cookie used only for DeleteQueriesARB requests.
type DeleteQueriesARBCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// DeleteQueriesARB sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2013-08-12 02:43:26 +02:00
func DeleteQueriesARB(c *xgb.Conn, ContextTag ContextTag, N int32, Ids []uint32) DeleteQueriesARBCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'DeleteQueriesARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-12 02:43:26 +02:00
cookie := c.NewCookie(false, false)
c.NewRequest(deleteQueriesARBRequest(c, ContextTag, N, Ids), cookie)
return DeleteQueriesARBCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// DeleteQueriesARBChecked sends a checked request.
// If an error occurs, it can be retrieved using DeleteQueriesARBCookie.Check.
2013-08-12 02:43:26 +02:00
func DeleteQueriesARBChecked(c *xgb.Conn, ContextTag ContextTag, N int32, Ids []uint32) DeleteQueriesARBCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
2013-08-12 02:43:26 +02:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'DeleteQueriesARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-12 02:43:26 +02:00
cookie := c.NewCookie(true, false)
c.NewRequest(deleteQueriesARBRequest(c, ContextTag, N, Ids), cookie)
return DeleteQueriesARBCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook DeleteQueriesARBCookie) Check() error {
return cook.Cookie.Check()
}
// deleteQueriesARBRequest writes a DeleteQueriesARB request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func deleteQueriesARBRequest(c *xgb.Conn, ContextTag ContextTag, N int32, Ids []uint32) []byte {
size := xgb.Pad((12 + xgb.Pad((int(N) * 4))))
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 161 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(N))
b += 4
for i := 0; i < int(N); i++ {
xgb.Put32(buf[b:], Ids[i])
b += 4
}
return buf
}
2013-08-12 02:43:26 +02:00
// DeleteTexturesCookie is a cookie used only for DeleteTextures requests.
type DeleteTexturesCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// DeleteTextures sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func DeleteTextures(c *xgb.Conn, ContextTag ContextTag, N int32, Textures []uint32) DeleteTexturesCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'DeleteTextures' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-12 02:43:26 +02:00
cookie := c.NewCookie(false, false)
c.NewRequest(deleteTexturesRequest(c, ContextTag, N, Textures), cookie)
return DeleteTexturesCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// DeleteTexturesChecked sends a checked request.
// If an error occurs, it can be retrieved using DeleteTexturesCookie.Check.
2013-08-12 02:43:26 +02:00
func DeleteTexturesChecked(c *xgb.Conn, ContextTag ContextTag, N int32, Textures []uint32) DeleteTexturesCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'DeleteTextures' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-12 02:43:26 +02:00
cookie := c.NewCookie(true, false)
c.NewRequest(deleteTexturesRequest(c, ContextTag, N, Textures), cookie)
return DeleteTexturesCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook DeleteTexturesCookie) Check() error {
return cook.Cookie.Check()
}
// deleteTexturesRequest writes a DeleteTextures request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func deleteTexturesRequest(c *xgb.Conn, ContextTag ContextTag, N int32, Textures []uint32) []byte {
size := xgb.Pad((12 + xgb.Pad((int(N) * 4))))
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
2013-08-12 02:43:26 +02:00
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
2013-08-12 02:43:26 +02:00
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 144 // request opcode
b += 1
2013-08-12 02:43:26 +02:00
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(N))
b += 4
2013-08-12 02:43:26 +02:00
for i := 0; i < int(N); i++ {
xgb.Put32(buf[b:], Textures[i])
b += 4
}
2013-08-12 02:43:26 +02:00
return buf
}
2013-08-12 02:43:26 +02:00
// DeleteWindowCookie is a cookie used only for DeleteWindow requests.
type DeleteWindowCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// DeleteWindow sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func DeleteWindow(c *xgb.Conn, Glxwindow Window) DeleteWindowCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
2013-08-12 02:43:26 +02:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'DeleteWindow' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(deleteWindowRequest(c, Glxwindow), cookie)
return DeleteWindowCookie{cookie}
}
// DeleteWindowChecked sends a checked request.
// If an error occurs, it can be retrieved using DeleteWindowCookie.Check.
2013-08-12 02:43:26 +02:00
func DeleteWindowChecked(c *xgb.Conn, Glxwindow Window) DeleteWindowCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
2013-08-12 02:43:26 +02:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'DeleteWindow' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(deleteWindowRequest(c, Glxwindow), cookie)
return DeleteWindowCookie{cookie}
}
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook DeleteWindowCookie) Check() error {
return cook.Cookie.Check()
}
// deleteWindowRequest writes a DeleteWindow request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func deleteWindowRequest(c *xgb.Conn, Glxwindow Window) []byte {
size := 8
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 32 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(Glxwindow))
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// DestroyContextCookie is a cookie used only for DestroyContext requests.
type DestroyContextCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// DestroyContext sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2013-08-12 02:43:26 +02:00
func DestroyContext(c *xgb.Conn, Context Context) DestroyContextCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'DestroyContext' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
2013-08-12 02:43:26 +02:00
c.NewRequest(destroyContextRequest(c, Context), cookie)
return DestroyContextCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// DestroyContextChecked sends a checked request.
// If an error occurs, it can be retrieved using DestroyContextCookie.Check.
2013-08-12 02:43:26 +02:00
func DestroyContextChecked(c *xgb.Conn, Context Context) DestroyContextCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'DestroyContext' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
2013-08-12 02:43:26 +02:00
c.NewRequest(destroyContextRequest(c, Context), cookie)
return DestroyContextCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
2013-08-12 02:43:26 +02:00
func (cook DestroyContextCookie) Check() error {
return cook.Cookie.Check()
}
// destroyContextRequest writes a DestroyContext request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func destroyContextRequest(c *xgb.Conn, Context Context) []byte {
size := 8
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 4 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(Context))
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// DestroyGLXPixmapCookie is a cookie used only for DestroyGLXPixmap requests.
type DestroyGLXPixmapCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// DestroyGLXPixmap sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2013-08-12 02:43:26 +02:00
func DestroyGLXPixmap(c *xgb.Conn, GlxPixmap Pixmap) DestroyGLXPixmapCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'DestroyGLXPixmap' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
2013-08-12 02:43:26 +02:00
c.NewRequest(destroyGLXPixmapRequest(c, GlxPixmap), cookie)
return DestroyGLXPixmapCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// DestroyGLXPixmapChecked sends a checked request.
// If an error occurs, it can be retrieved using DestroyGLXPixmapCookie.Check.
2013-08-12 02:43:26 +02:00
func DestroyGLXPixmapChecked(c *xgb.Conn, GlxPixmap Pixmap) DestroyGLXPixmapCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'DestroyGLXPixmap' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
2013-08-12 02:43:26 +02:00
c.NewRequest(destroyGLXPixmapRequest(c, GlxPixmap), cookie)
return DestroyGLXPixmapCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
2013-08-12 02:43:26 +02:00
func (cook DestroyGLXPixmapCookie) Check() error {
return cook.Cookie.Check()
}
// destroyGLXPixmapRequest writes a DestroyGLXPixmap request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func destroyGLXPixmapRequest(c *xgb.Conn, GlxPixmap Pixmap) []byte {
size := 8
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 15 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(GlxPixmap))
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// DestroyPbufferCookie is a cookie used only for DestroyPbuffer requests.
type DestroyPbufferCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// DestroyPbuffer sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2013-08-12 02:43:26 +02:00
func DestroyPbuffer(c *xgb.Conn, Pbuffer Pbuffer) DestroyPbufferCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'DestroyPbuffer' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
2013-08-12 02:43:26 +02:00
c.NewRequest(destroyPbufferRequest(c, Pbuffer), cookie)
return DestroyPbufferCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// DestroyPbufferChecked sends a checked request.
// If an error occurs, it can be retrieved using DestroyPbufferCookie.Check.
2013-08-12 02:43:26 +02:00
func DestroyPbufferChecked(c *xgb.Conn, Pbuffer Pbuffer) DestroyPbufferCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'DestroyPbuffer' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
2013-08-12 02:43:26 +02:00
c.NewRequest(destroyPbufferRequest(c, Pbuffer), cookie)
return DestroyPbufferCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
2013-08-12 02:43:26 +02:00
func (cook DestroyPbufferCookie) Check() error {
return cook.Cookie.Check()
}
// destroyPbufferRequest writes a DestroyPbuffer request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func destroyPbufferRequest(c *xgb.Conn, Pbuffer Pbuffer) []byte {
size := 8
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 28 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(Pbuffer))
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// DestroyPixmapCookie is a cookie used only for DestroyPixmap requests.
type DestroyPixmapCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// DestroyPixmap sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2013-08-12 02:43:26 +02:00
func DestroyPixmap(c *xgb.Conn, GlxPixmap Pixmap) DestroyPixmapCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'DestroyPixmap' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
2013-08-12 02:43:26 +02:00
c.NewRequest(destroyPixmapRequest(c, GlxPixmap), cookie)
return DestroyPixmapCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// DestroyPixmapChecked sends a checked request.
// If an error occurs, it can be retrieved using DestroyPixmapCookie.Check.
2013-08-12 02:43:26 +02:00
func DestroyPixmapChecked(c *xgb.Conn, GlxPixmap Pixmap) DestroyPixmapCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'DestroyPixmap' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
2013-08-12 02:43:26 +02:00
c.NewRequest(destroyPixmapRequest(c, GlxPixmap), cookie)
return DestroyPixmapCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
2013-08-12 02:43:26 +02:00
func (cook DestroyPixmapCookie) Check() error {
return cook.Cookie.Check()
}
// destroyPixmapRequest writes a DestroyPixmap request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func destroyPixmapRequest(c *xgb.Conn, GlxPixmap Pixmap) []byte {
size := 8
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 23 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(GlxPixmap))
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// EndListCookie is a cookie used only for EndList requests.
type EndListCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// EndList sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2013-08-12 02:43:26 +02:00
func EndList(c *xgb.Conn, ContextTag ContextTag) EndListCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'EndList' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
2013-08-12 02:43:26 +02:00
c.NewRequest(endListRequest(c, ContextTag), cookie)
return EndListCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// EndListChecked sends a checked request.
// If an error occurs, it can be retrieved using EndListCookie.Check.
2013-08-12 02:43:26 +02:00
func EndListChecked(c *xgb.Conn, ContextTag ContextTag) EndListCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'EndList' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
2013-08-12 02:43:26 +02:00
c.NewRequest(endListRequest(c, ContextTag), cookie)
return EndListCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
2013-08-12 02:43:26 +02:00
func (cook EndListCookie) Check() error {
return cook.Cookie.Check()
}
// endListRequest writes a EndList request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func endListRequest(c *xgb.Conn, ContextTag ContextTag) []byte {
size := 8
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 102 // 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
return buf
}
2013-08-12 02:43:26 +02:00
// FeedbackBufferCookie is a cookie used only for FeedbackBuffer requests.
type FeedbackBufferCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// FeedbackBuffer sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func FeedbackBuffer(c *xgb.Conn, ContextTag ContextTag, Size, Type int32) FeedbackBufferCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'FeedbackBuffer' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
2013-08-12 02:43:26 +02:00
c.NewRequest(feedbackBufferRequest(c, ContextTag, Size, Type), cookie)
return FeedbackBufferCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// FeedbackBufferChecked sends a checked request.
// If an error occurs, it can be retrieved using FeedbackBufferCookie.Check.
func FeedbackBufferChecked(c *xgb.Conn, ContextTag ContextTag, Size, Type int32) FeedbackBufferCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'FeedbackBuffer' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
2013-08-12 02:43:26 +02:00
c.NewRequest(feedbackBufferRequest(c, ContextTag, Size, Type), cookie)
return FeedbackBufferCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
2013-08-12 02:43:26 +02:00
func (cook FeedbackBufferCookie) Check() error {
return cook.Cookie.Check()
}
// feedbackBufferRequest writes a FeedbackBuffer request to a byte slice for transfer.
func feedbackBufferRequest(c *xgb.Conn, ContextTag ContextTag, Size, Type int32) []byte {
2013-08-12 02:43:26 +02:00
size := 16
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 105 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(Size))
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(Type))
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// FinishCookie is a cookie used only for Finish requests.
type FinishCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// Finish sends a checked request.
// If an error occurs, it will be returned with the reply by calling FinishCookie.Reply.
2013-08-12 02:43:26 +02:00
func Finish(c *xgb.Conn, ContextTag ContextTag) FinishCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'Finish' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(finishRequest(c, ContextTag), cookie)
return FinishCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// FinishUnchecked sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2013-08-12 02:43:26 +02:00
func FinishUnchecked(c *xgb.Conn, ContextTag ContextTag) FinishCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'Finish' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(finishRequest(c, ContextTag), cookie)
return FinishCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// FinishReply represents the data returned from a Finish request.
type FinishReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a Finish request.
func (cook FinishCookie) Reply() (*FinishReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
2013-08-12 02:43:26 +02:00
return finishReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// finishReply reads a byte slice into a FinishReply value.
func finishReply(buf []byte) *FinishReply {
v := new(FinishReply)
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
return v
}
// finishRequest writes a Finish request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func finishRequest(c *xgb.Conn, ContextTag ContextTag) []byte {
size := 8
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 108 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// FlushCookie is a cookie used only for Flush requests.
type FlushCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// Flush sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2013-08-12 02:43:26 +02:00
func Flush(c *xgb.Conn, ContextTag ContextTag) FlushCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'Flush' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
2013-08-12 02:43:26 +02:00
c.NewRequest(flushRequest(c, ContextTag), cookie)
return FlushCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// FlushChecked sends a checked request.
// If an error occurs, it can be retrieved using FlushCookie.Check.
2013-08-12 02:43:26 +02:00
func FlushChecked(c *xgb.Conn, ContextTag ContextTag) FlushCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'Flush' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
2013-08-12 02:43:26 +02:00
c.NewRequest(flushRequest(c, ContextTag), cookie)
return FlushCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
2013-08-12 02:43:26 +02:00
func (cook FlushCookie) Check() error {
return cook.Cookie.Check()
}
// flushRequest writes a Flush request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func flushRequest(c *xgb.Conn, ContextTag ContextTag) []byte {
size := 8
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 142 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// GenListsCookie is a cookie used only for GenLists requests.
type GenListsCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// GenLists sends a checked request.
// If an error occurs, it will be returned with the reply by calling GenListsCookie.Reply.
2013-08-12 02:43:26 +02:00
func GenLists(c *xgb.Conn, ContextTag ContextTag, Range int32) GenListsCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GenLists' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-12 02:43:26 +02:00
cookie := c.NewCookie(true, true)
c.NewRequest(genListsRequest(c, ContextTag, Range), cookie)
return GenListsCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GenListsUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GenListsUnchecked(c *xgb.Conn, ContextTag ContextTag, Range int32) GenListsCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GenLists' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-12 02:43:26 +02:00
cookie := c.NewCookie(false, true)
c.NewRequest(genListsRequest(c, ContextTag, Range), cookie)
return GenListsCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GenListsReply represents the data returned from a GenLists request.
type GenListsReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
RetVal uint32
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a GenLists request.
func (cook GenListsCookie) Reply() (*GenListsReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return genListsReply(buf), nil
}
// genListsReply reads a byte slice into a GenListsReply value.
func genListsReply(buf []byte) *GenListsReply {
v := new(GenListsReply)
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 = xgb.Get32(buf[b:])
b += 4
return v
}
// genListsRequest writes a GenLists request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func genListsRequest(c *xgb.Conn, ContextTag ContextTag, Range int32) []byte {
size := 12
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 104 // 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
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(Range))
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// GenQueriesARBCookie is a cookie used only for GenQueriesARB requests.
type GenQueriesARBCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// GenQueriesARB sends a checked request.
// If an error occurs, it will be returned with the reply by calling GenQueriesARBCookie.Reply.
2013-08-12 02:43:26 +02:00
func GenQueriesARB(c *xgb.Conn, ContextTag ContextTag, N int32) GenQueriesARBCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GenQueriesARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(genQueriesARBRequest(c, ContextTag, N), cookie)
return GenQueriesARBCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GenQueriesARBUnchecked sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2013-08-12 02:43:26 +02:00
func GenQueriesARBUnchecked(c *xgb.Conn, ContextTag ContextTag, N int32) GenQueriesARBCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GenQueriesARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(genQueriesARBRequest(c, ContextTag, N), cookie)
return GenQueriesARBCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GenQueriesARBReply represents the data returned from a GenQueriesARB request.
type GenQueriesARBReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
2013-08-12 02:43:26 +02:00
// padding: 24 bytes
Data []uint32 // size: xgb.Pad((int(Length) * 4))
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a GenQueriesARB request.
func (cook GenQueriesARBCookie) Reply() (*GenQueriesARBReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
2013-08-12 02:43:26 +02:00
return genQueriesARBReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// genQueriesARBReply reads a byte slice into a GenQueriesARBReply value.
func genQueriesARBReply(buf []byte) *GenQueriesARBReply {
v := new(GenQueriesARBReply)
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
2013-08-12 02:43:26 +02:00
b += 24 // padding
2013-08-12 02:43:26 +02:00
v.Data = make([]uint32, v.Length)
for i := 0; i < int(v.Length); i++ {
v.Data[i] = xgb.Get32(buf[b:])
b += 4
}
return v
}
// genQueriesARBRequest writes a GenQueriesARB request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func genQueriesARBRequest(c *xgb.Conn, ContextTag ContextTag, N int32) []byte {
size := 12
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 162 // 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
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(N))
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// GenTexturesCookie is a cookie used only for GenTextures requests.
type GenTexturesCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// GenTextures sends a checked request.
// If an error occurs, it will be returned with the reply by calling GenTexturesCookie.Reply.
2013-08-12 02:43:26 +02:00
func GenTextures(c *xgb.Conn, ContextTag ContextTag, N int32) GenTexturesCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GenTextures' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(genTexturesRequest(c, ContextTag, N), cookie)
return GenTexturesCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GenTexturesUnchecked sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2013-08-12 02:43:26 +02:00
func GenTexturesUnchecked(c *xgb.Conn, ContextTag ContextTag, N int32) GenTexturesCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GenTextures' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(genTexturesRequest(c, ContextTag, N), cookie)
return GenTexturesCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GenTexturesReply represents the data returned from a GenTextures request.
type GenTexturesReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
2013-08-12 02:43:26 +02:00
// padding: 24 bytes
Data []uint32 // size: xgb.Pad((int(Length) * 4))
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a GenTextures request.
func (cook GenTexturesCookie) Reply() (*GenTexturesReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
2013-08-12 02:43:26 +02:00
return genTexturesReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// genTexturesReply reads a byte slice into a GenTexturesReply value.
func genTexturesReply(buf []byte) *GenTexturesReply {
v := new(GenTexturesReply)
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
2013-08-12 02:43:26 +02:00
b += 24 // padding
2013-08-12 02:43:26 +02:00
v.Data = make([]uint32, v.Length)
for i := 0; i < int(v.Length); i++ {
v.Data[i] = xgb.Get32(buf[b:])
b += 4
}
return v
}
// genTexturesRequest writes a GenTextures request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func genTexturesRequest(c *xgb.Conn, ContextTag ContextTag, N int32) []byte {
size := 12
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 145 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
xgb.Put32(buf[b:], uint32(N))
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// GetBooleanvCookie is a cookie used only for GetBooleanv requests.
type GetBooleanvCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// GetBooleanv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetBooleanvCookie.Reply.
2013-08-12 02:43:26 +02:00
func GetBooleanv(c *xgb.Conn, ContextTag ContextTag, Pname int32) GetBooleanvCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetBooleanv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getBooleanvRequest(c, ContextTag, Pname), cookie)
return GetBooleanvCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetBooleanvUnchecked sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2013-08-12 02:43:26 +02:00
func GetBooleanvUnchecked(c *xgb.Conn, ContextTag ContextTag, Pname int32) GetBooleanvCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetBooleanv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getBooleanvRequest(c, ContextTag, Pname), cookie)
return GetBooleanvCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetBooleanvReply represents the data returned from a GetBooleanv request.
type GetBooleanvReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
2013-08-12 02:43:26 +02:00
N uint32
Datum bool
// padding: 15 bytes
Data []bool // size: xgb.Pad((int(N) * 1))
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a GetBooleanv request.
func (cook GetBooleanvCookie) Reply() (*GetBooleanvReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
2013-08-12 02:43:26 +02:00
return getBooleanvReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// getBooleanvReply reads a byte slice into a GetBooleanvReply value.
func getBooleanvReply(buf []byte) *GetBooleanvReply {
v := new(GetBooleanvReply)
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 += 4 // padding
2013-08-12 02:43:26 +02:00
v.N = xgb.Get32(buf[b:])
b += 4
2013-08-12 02:43:26 +02:00
if buf[b] == 1 {
v.Datum = true
} else {
v.Datum = false
}
b += 1
2013-08-12 02:43:26 +02:00
b += 15 // padding
2013-08-12 02:43:26 +02:00
v.Data = make([]bool, v.N)
for i := 0; i < int(v.N); i++ {
if buf[b] == 1 {
v.Data[i] = true
} else {
v.Data[i] = false
}
b += 1
}
2013-08-12 02:43:26 +02:00
return v
}
// getBooleanvRequest writes a GetBooleanv request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func getBooleanvRequest(c *xgb.Conn, ContextTag ContextTag, Pname int32) []byte {
size := 12
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 112 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(Pname))
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// GetClipPlaneCookie is a cookie used only for GetClipPlane requests.
type GetClipPlaneCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// GetClipPlane sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetClipPlaneCookie.Reply.
2013-08-12 02:43:26 +02:00
func GetClipPlane(c *xgb.Conn, ContextTag ContextTag, Plane int32) GetClipPlaneCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetClipPlane' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getClipPlaneRequest(c, ContextTag, Plane), cookie)
return GetClipPlaneCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetClipPlaneUnchecked sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2013-08-12 02:43:26 +02:00
func GetClipPlaneUnchecked(c *xgb.Conn, ContextTag ContextTag, Plane int32) GetClipPlaneCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetClipPlane' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getClipPlaneRequest(c, ContextTag, Plane), cookie)
return GetClipPlaneCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetClipPlaneReply represents the data returned from a GetClipPlane request.
type GetClipPlaneReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
2013-08-12 02:43:26 +02:00
// padding: 24 bytes
Data []Float64 // size: xgb.Pad(((int(Length) / 2) * 8))
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a GetClipPlane request.
func (cook GetClipPlaneCookie) Reply() (*GetClipPlaneReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
2013-08-12 02:43:26 +02:00
return getClipPlaneReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// getClipPlaneReply reads a byte slice into a GetClipPlaneReply value.
func getClipPlaneReply(buf []byte) *GetClipPlaneReply {
v := new(GetClipPlaneReply)
b := 1 // skip reply determinant
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
2017-01-18 10:52:16 +01:00
b += 1 // padding
2013-08-12 02:43:26 +02:00
b += 24 // padding
2013-08-12 02:43:26 +02:00
v.Data = make([]Float64, (int(v.Length) / 2))
for i := 0; i < int((int(v.Length) / 2)); i++ {
v.Data[i] = Float64(xgb.Get64(buf[b:]))
b += 8
}
return v
}
// getClipPlaneRequest writes a GetClipPlane request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func getClipPlaneRequest(c *xgb.Conn, ContextTag ContextTag, Plane int32) []byte {
size := 12
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 113 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
xgb.Put32(buf[b:], uint32(Plane))
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// GetColorTableCookie is a cookie used only for GetColorTable requests.
type GetColorTableCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// GetColorTable sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetColorTableCookie.Reply.
func GetColorTable(c *xgb.Conn, ContextTag ContextTag, Target, Format, Type uint32, SwapBytes bool) GetColorTableCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetColorTable' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-12 02:43:26 +02:00
cookie := c.NewCookie(true, true)
c.NewRequest(getColorTableRequest(c, ContextTag, Target, Format, Type, SwapBytes), cookie)
return GetColorTableCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetColorTableUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetColorTableUnchecked(c *xgb.Conn, ContextTag ContextTag, Target, Format, Type uint32, SwapBytes bool) GetColorTableCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetColorTable' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-12 02:43:26 +02:00
cookie := c.NewCookie(false, true)
c.NewRequest(getColorTableRequest(c, ContextTag, Target, Format, Type, SwapBytes), cookie)
return GetColorTableCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetColorTableReply represents the data returned from a GetColorTable request.
type GetColorTableReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 8 bytes
Width int32
// padding: 12 bytes
Data []byte // size: xgb.Pad(((int(Length) * 4) * 1))
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a GetColorTable request.
func (cook GetColorTableCookie) Reply() (*GetColorTableReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
2013-08-12 02:43:26 +02:00
if buf == nil {
return nil, nil
}
2013-08-12 02:43:26 +02:00
return getColorTableReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// getColorTableReply reads a byte slice into a GetColorTableReply value.
func getColorTableReply(buf []byte) *GetColorTableReply {
v := new(GetColorTableReply)
b := 1 // skip reply determinant
2013-08-12 02:43:26 +02:00
b += 1 // padding
2013-08-12 02:43:26 +02:00
v.Sequence = xgb.Get16(buf[b:])
b += 2
2013-08-12 02:43:26 +02:00
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
2013-08-12 02:43:26 +02:00
b += 8 // padding
2013-08-12 02:43:26 +02:00
v.Width = int32(xgb.Get32(buf[b:]))
b += 4
2013-08-12 02:43:26 +02:00
b += 12 // padding
2013-08-12 02:43:26 +02:00
v.Data = make([]byte, (int(v.Length) * 4))
copy(v.Data[:(int(v.Length)*4)], buf[b:])
b += int((int(v.Length) * 4))
2013-08-12 02:43:26 +02:00
return v
}
// getColorTableRequest writes a GetColorTable request to a byte slice for transfer.
func getColorTableRequest(c *xgb.Conn, ContextTag ContextTag, Target, Format, Type uint32, SwapBytes bool) []byte {
2013-08-12 02:43:26 +02:00
size := 24
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 147 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Target)
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Format)
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Type)
b += 4
2013-08-12 02:43:26 +02:00
if SwapBytes {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
return buf
}
2013-08-12 02:43:26 +02:00
// GetColorTableParameterfvCookie is a cookie used only for GetColorTableParameterfv requests.
type GetColorTableParameterfvCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// GetColorTableParameterfv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetColorTableParameterfvCookie.Reply.
func GetColorTableParameterfv(c *xgb.Conn, ContextTag ContextTag, Target, Pname uint32) GetColorTableParameterfvCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetColorTableParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getColorTableParameterfvRequest(c, ContextTag, Target, Pname), cookie)
return GetColorTableParameterfvCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetColorTableParameterfvUnchecked sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetColorTableParameterfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Target, Pname uint32) GetColorTableParameterfvCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetColorTableParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getColorTableParameterfvRequest(c, ContextTag, Target, Pname), cookie)
return GetColorTableParameterfvCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetColorTableParameterfvReply represents the data returned from a GetColorTableParameterfv request.
type GetColorTableParameterfvReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
2013-08-12 02:43:26 +02:00
// padding: 4 bytes
N uint32
Datum Float32
// padding: 12 bytes
Data []Float32 // size: xgb.Pad((int(N) * 4))
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a GetColorTableParameterfv request.
func (cook GetColorTableParameterfvCookie) Reply() (*GetColorTableParameterfvReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
2013-08-12 02:43:26 +02:00
return getColorTableParameterfvReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// getColorTableParameterfvReply reads a byte slice into a GetColorTableParameterfvReply value.
func getColorTableParameterfvReply(buf []byte) *GetColorTableParameterfvReply {
v := new(GetColorTableParameterfvReply)
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
2013-08-12 02:43:26 +02:00
b += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
2013-08-12 02:43:26 +02:00
v.Datum = Float32(xgb.Get32(buf[b:]))
b += 4
2013-08-12 02:43:26 +02:00
b += 12 // padding
v.Data = make([]Float32, v.N)
for i := 0; i < int(v.N); i++ {
v.Data[i] = Float32(xgb.Get32(buf[b:]))
b += 4
}
return v
}
// getColorTableParameterfvRequest writes a GetColorTableParameterfv request to a byte slice for transfer.
func getColorTableParameterfvRequest(c *xgb.Conn, ContextTag ContextTag, Target, Pname uint32) []byte {
2013-08-12 02:43:26 +02:00
size := 16
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 148 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
xgb.Put32(buf[b:], Target)
b += 4
xgb.Put32(buf[b:], Pname)
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// GetColorTableParameterivCookie is a cookie used only for GetColorTableParameteriv requests.
type GetColorTableParameterivCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// GetColorTableParameteriv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetColorTableParameterivCookie.Reply.
func GetColorTableParameteriv(c *xgb.Conn, ContextTag ContextTag, Target, Pname uint32) GetColorTableParameterivCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetColorTableParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getColorTableParameterivRequest(c, ContextTag, Target, Pname), cookie)
return GetColorTableParameterivCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetColorTableParameterivUnchecked sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetColorTableParameterivUnchecked(c *xgb.Conn, ContextTag ContextTag, Target, Pname uint32) GetColorTableParameterivCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetColorTableParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getColorTableParameterivRequest(c, ContextTag, Target, Pname), cookie)
return GetColorTableParameterivCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetColorTableParameterivReply represents the data returned from a GetColorTableParameteriv request.
type GetColorTableParameterivReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
2013-08-12 02:43:26 +02:00
// padding: 4 bytes
N uint32
Datum int32
// padding: 12 bytes
Data []int32 // size: xgb.Pad((int(N) * 4))
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a GetColorTableParameteriv request.
func (cook GetColorTableParameterivCookie) Reply() (*GetColorTableParameterivReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
2013-08-12 02:43:26 +02:00
return getColorTableParameterivReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// getColorTableParameterivReply reads a byte slice into a GetColorTableParameterivReply value.
func getColorTableParameterivReply(buf []byte) *GetColorTableParameterivReply {
v := new(GetColorTableParameterivReply)
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
2013-08-12 02:43:26 +02:00
b += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
2013-08-12 02:43:26 +02:00
v.Datum = int32(xgb.Get32(buf[b:]))
b += 4
b += 12 // padding
v.Data = make([]int32, v.N)
for i := 0; i < int(v.N); i++ {
v.Data[i] = int32(xgb.Get32(buf[b:]))
b += 4
}
return v
}
// getColorTableParameterivRequest writes a GetColorTableParameteriv request to a byte slice for transfer.
func getColorTableParameterivRequest(c *xgb.Conn, ContextTag ContextTag, Target, Pname uint32) []byte {
2013-08-12 02:43:26 +02:00
size := 16
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 149 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Target)
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Pname)
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// GetCompressedTexImageARBCookie is a cookie used only for GetCompressedTexImageARB requests.
type GetCompressedTexImageARBCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// GetCompressedTexImageARB sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetCompressedTexImageARBCookie.Reply.
2013-08-12 02:43:26 +02:00
func GetCompressedTexImageARB(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32) GetCompressedTexImageARBCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetCompressedTexImageARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-12 02:43:26 +02:00
cookie := c.NewCookie(true, true)
c.NewRequest(getCompressedTexImageARBRequest(c, ContextTag, Target, Level), cookie)
return GetCompressedTexImageARBCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetCompressedTexImageARBUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetCompressedTexImageARBUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32) GetCompressedTexImageARBCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetCompressedTexImageARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-12 02:43:26 +02:00
cookie := c.NewCookie(false, true)
c.NewRequest(getCompressedTexImageARBRequest(c, ContextTag, Target, Level), cookie)
return GetCompressedTexImageARBCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetCompressedTexImageARBReply represents the data returned from a GetCompressedTexImageARB request.
type GetCompressedTexImageARBReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 8 bytes
Size int32
// padding: 12 bytes
Data []byte // size: xgb.Pad(((int(Length) * 4) * 1))
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a GetCompressedTexImageARB request.
func (cook GetCompressedTexImageARBCookie) Reply() (*GetCompressedTexImageARBReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getCompressedTexImageARBReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// getCompressedTexImageARBReply reads a byte slice into a GetCompressedTexImageARBReply value.
func getCompressedTexImageARBReply(buf []byte) *GetCompressedTexImageARBReply {
v := new(GetCompressedTexImageARBReply)
b := 1 // skip reply determinant
2013-08-12 02:43:26 +02:00
b += 1 // padding
2013-08-12 02:43:26 +02:00
v.Sequence = xgb.Get16(buf[b:])
b += 2
2013-08-12 02:43:26 +02:00
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
2013-08-12 02:43:26 +02:00
b += 8 // padding
2013-08-12 02:43:26 +02:00
v.Size = int32(xgb.Get32(buf[b:]))
b += 4
2013-08-12 02:43:26 +02:00
b += 12 // padding
2013-08-12 02:43:26 +02:00
v.Data = make([]byte, (int(v.Length) * 4))
copy(v.Data[:(int(v.Length)*4)], buf[b:])
b += int((int(v.Length) * 4))
2013-08-12 02:43:26 +02:00
return v
}
// getCompressedTexImageARBRequest writes a GetCompressedTexImageARB request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func getCompressedTexImageARBRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32) []byte {
size := 16
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 160 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
xgb.Put32(buf[b:], Target)
b += 4
xgb.Put32(buf[b:], uint32(Level))
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// GetConvolutionFilterCookie is a cookie used only for GetConvolutionFilter requests.
type GetConvolutionFilterCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// GetConvolutionFilter sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetConvolutionFilterCookie.Reply.
func GetConvolutionFilter(c *xgb.Conn, ContextTag ContextTag, Target, Format, Type uint32, SwapBytes bool) GetConvolutionFilterCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetConvolutionFilter' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getConvolutionFilterRequest(c, ContextTag, Target, Format, Type, SwapBytes), cookie)
return GetConvolutionFilterCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetConvolutionFilterUnchecked sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetConvolutionFilterUnchecked(c *xgb.Conn, ContextTag ContextTag, Target, Format, Type uint32, SwapBytes bool) GetConvolutionFilterCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetConvolutionFilter' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getConvolutionFilterRequest(c, ContextTag, Target, Format, Type, SwapBytes), cookie)
return GetConvolutionFilterCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetConvolutionFilterReply represents the data returned from a GetConvolutionFilter request.
type GetConvolutionFilterReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
2013-08-12 02:43:26 +02:00
// padding: 8 bytes
Width int32
Height int32
// padding: 8 bytes
Data []byte // size: xgb.Pad(((int(Length) * 4) * 1))
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a GetConvolutionFilter request.
func (cook GetConvolutionFilterCookie) Reply() (*GetConvolutionFilterReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
2013-08-12 02:43:26 +02:00
return getConvolutionFilterReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// getConvolutionFilterReply reads a byte slice into a GetConvolutionFilterReply value.
func getConvolutionFilterReply(buf []byte) *GetConvolutionFilterReply {
v := new(GetConvolutionFilterReply)
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
2013-08-12 02:43:26 +02:00
b += 8 // padding
v.Width = int32(xgb.Get32(buf[b:]))
b += 4
2013-08-12 02:43:26 +02:00
v.Height = int32(xgb.Get32(buf[b:]))
b += 4
2013-08-12 02:43:26 +02:00
b += 8 // padding
v.Data = make([]byte, (int(v.Length) * 4))
copy(v.Data[:(int(v.Length)*4)], buf[b:])
b += int((int(v.Length) * 4))
return v
}
// getConvolutionFilterRequest writes a GetConvolutionFilter request to a byte slice for transfer.
func getConvolutionFilterRequest(c *xgb.Conn, ContextTag ContextTag, Target, Format, Type uint32, SwapBytes bool) []byte {
2013-08-12 02:43:26 +02:00
size := 24
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 150 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
xgb.Put32(buf[b:], Target)
b += 4
xgb.Put32(buf[b:], Format)
b += 4
xgb.Put32(buf[b:], Type)
b += 4
2013-08-12 02:43:26 +02:00
if SwapBytes {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
return buf
}
2013-08-12 02:43:26 +02:00
// GetConvolutionParameterfvCookie is a cookie used only for GetConvolutionParameterfv requests.
type GetConvolutionParameterfvCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// GetConvolutionParameterfv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetConvolutionParameterfvCookie.Reply.
func GetConvolutionParameterfv(c *xgb.Conn, ContextTag ContextTag, Target, Pname uint32) GetConvolutionParameterfvCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetConvolutionParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-12 02:43:26 +02:00
cookie := c.NewCookie(true, true)
c.NewRequest(getConvolutionParameterfvRequest(c, ContextTag, Target, Pname), cookie)
return GetConvolutionParameterfvCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetConvolutionParameterfvUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetConvolutionParameterfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Target, Pname uint32) GetConvolutionParameterfvCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetConvolutionParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getConvolutionParameterfvRequest(c, ContextTag, Target, Pname), cookie)
return GetConvolutionParameterfvCookie{cookie}
}
// GetConvolutionParameterfvReply represents the data returned from a GetConvolutionParameterfv request.
type GetConvolutionParameterfvReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum Float32
// padding: 12 bytes
Data []Float32 // size: xgb.Pad((int(N) * 4))
}
// Reply blocks and returns the reply data for a GetConvolutionParameterfv request.
func (cook GetConvolutionParameterfvCookie) Reply() (*GetConvolutionParameterfvReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getConvolutionParameterfvReply(buf), nil
}
// getConvolutionParameterfvReply reads a byte slice into a GetConvolutionParameterfvReply value.
func getConvolutionParameterfvReply(buf []byte) *GetConvolutionParameterfvReply {
v := new(GetConvolutionParameterfvReply)
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 += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
v.Datum = Float32(xgb.Get32(buf[b:]))
b += 4
b += 12 // padding
v.Data = make([]Float32, v.N)
for i := 0; i < int(v.N); i++ {
v.Data[i] = Float32(xgb.Get32(buf[b:]))
b += 4
}
2013-08-12 02:43:26 +02:00
return v
}
// getConvolutionParameterfvRequest writes a GetConvolutionParameterfv request to a byte slice for transfer.
func getConvolutionParameterfvRequest(c *xgb.Conn, ContextTag ContextTag, Target, Pname uint32) []byte {
2013-08-12 02:43:26 +02:00
size := 16
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 151 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Target)
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Pname)
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// GetConvolutionParameterivCookie is a cookie used only for GetConvolutionParameteriv requests.
type GetConvolutionParameterivCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// GetConvolutionParameteriv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetConvolutionParameterivCookie.Reply.
func GetConvolutionParameteriv(c *xgb.Conn, ContextTag ContextTag, Target, Pname uint32) GetConvolutionParameterivCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetConvolutionParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-12 02:43:26 +02:00
cookie := c.NewCookie(true, true)
c.NewRequest(getConvolutionParameterivRequest(c, ContextTag, Target, Pname), cookie)
return GetConvolutionParameterivCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetConvolutionParameterivUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetConvolutionParameterivUnchecked(c *xgb.Conn, ContextTag ContextTag, Target, Pname uint32) GetConvolutionParameterivCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetConvolutionParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-12 02:43:26 +02:00
cookie := c.NewCookie(false, true)
c.NewRequest(getConvolutionParameterivRequest(c, ContextTag, Target, Pname), cookie)
return GetConvolutionParameterivCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetConvolutionParameterivReply represents the data returned from a GetConvolutionParameteriv request.
type GetConvolutionParameterivReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum int32
// padding: 12 bytes
Data []int32 // size: xgb.Pad((int(N) * 4))
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a GetConvolutionParameteriv request.
func (cook GetConvolutionParameterivCookie) Reply() (*GetConvolutionParameterivReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getConvolutionParameterivReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// getConvolutionParameterivReply reads a byte slice into a GetConvolutionParameterivReply value.
func getConvolutionParameterivReply(buf []byte) *GetConvolutionParameterivReply {
v := new(GetConvolutionParameterivReply)
b := 1 // skip reply determinant
2013-08-12 02:43:26 +02:00
b += 1 // padding
2013-08-12 02:43:26 +02:00
v.Sequence = xgb.Get16(buf[b:])
b += 2
2013-08-12 02:43:26 +02:00
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
2013-08-12 02:43:26 +02:00
b += 4 // padding
2013-08-12 02:43:26 +02:00
v.N = xgb.Get32(buf[b:])
b += 4
2013-08-12 02:43:26 +02:00
v.Datum = int32(xgb.Get32(buf[b:]))
b += 4
2013-08-12 02:43:26 +02:00
b += 12 // padding
2013-08-12 02:43:26 +02:00
v.Data = make([]int32, v.N)
for i := 0; i < int(v.N); i++ {
v.Data[i] = int32(xgb.Get32(buf[b:]))
b += 4
}
2013-08-12 02:43:26 +02:00
return v
}
// getConvolutionParameterivRequest writes a GetConvolutionParameteriv request to a byte slice for transfer.
func getConvolutionParameterivRequest(c *xgb.Conn, ContextTag ContextTag, Target, Pname uint32) []byte {
2013-08-12 02:43:26 +02:00
size := 16
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 152 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
xgb.Put32(buf[b:], Target)
b += 4
xgb.Put32(buf[b:], Pname)
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// GetDoublevCookie is a cookie used only for GetDoublev requests.
type GetDoublevCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// GetDoublev sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetDoublevCookie.Reply.
2013-08-12 02:43:26 +02:00
func GetDoublev(c *xgb.Conn, ContextTag ContextTag, Pname uint32) GetDoublevCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetDoublev' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-12 02:43:26 +02:00
cookie := c.NewCookie(true, true)
c.NewRequest(getDoublevRequest(c, ContextTag, Pname), cookie)
return GetDoublevCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetDoublevUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetDoublevUnchecked(c *xgb.Conn, ContextTag ContextTag, Pname uint32) GetDoublevCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetDoublev' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getDoublevRequest(c, ContextTag, Pname), cookie)
return GetDoublevCookie{cookie}
}
// GetDoublevReply represents the data returned from a GetDoublev request.
type GetDoublevReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum Float64
// padding: 8 bytes
Data []Float64 // size: xgb.Pad((int(N) * 8))
}
// Reply blocks and returns the reply data for a GetDoublev request.
func (cook GetDoublevCookie) Reply() (*GetDoublevReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getDoublevReply(buf), nil
}
// getDoublevReply reads a byte slice into a GetDoublevReply value.
func getDoublevReply(buf []byte) *GetDoublevReply {
v := new(GetDoublevReply)
b := 1 // skip reply determinant
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
2017-01-18 10:52:16 +01:00
b += 1 // padding
2013-08-12 02:43:26 +02:00
b += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
v.Datum = Float64(xgb.Get64(buf[b:]))
b += 8
b += 8 // padding
v.Data = make([]Float64, v.N)
for i := 0; i < int(v.N); i++ {
v.Data[i] = Float64(xgb.Get64(buf[b:]))
b += 8
}
2013-08-12 02:43:26 +02:00
return v
}
// getDoublevRequest writes a GetDoublev request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func getDoublevRequest(c *xgb.Conn, ContextTag ContextTag, Pname uint32) []byte {
size := 12
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 114 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Pname)
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// GetDrawableAttributesCookie is a cookie used only for GetDrawableAttributes requests.
type GetDrawableAttributesCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// GetDrawableAttributes sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetDrawableAttributesCookie.Reply.
2013-08-12 02:43:26 +02:00
func GetDrawableAttributes(c *xgb.Conn, Drawable Drawable) GetDrawableAttributesCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetDrawableAttributes' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-12 02:43:26 +02:00
cookie := c.NewCookie(true, true)
c.NewRequest(getDrawableAttributesRequest(c, Drawable), cookie)
return GetDrawableAttributesCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetDrawableAttributesUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetDrawableAttributesUnchecked(c *xgb.Conn, Drawable Drawable) GetDrawableAttributesCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetDrawableAttributes' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-12 02:43:26 +02:00
cookie := c.NewCookie(false, true)
c.NewRequest(getDrawableAttributesRequest(c, Drawable), cookie)
return GetDrawableAttributesCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetDrawableAttributesReply represents the data returned from a GetDrawableAttributes request.
type GetDrawableAttributesReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
NumAttribs uint32
// padding: 20 bytes
Attribs []uint32 // size: xgb.Pad(((int(NumAttribs) * 2) * 4))
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a GetDrawableAttributes request.
func (cook GetDrawableAttributesCookie) Reply() (*GetDrawableAttributesReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getDrawableAttributesReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// getDrawableAttributesReply reads a byte slice into a GetDrawableAttributesReply value.
func getDrawableAttributesReply(buf []byte) *GetDrawableAttributesReply {
v := new(GetDrawableAttributesReply)
b := 1 // skip reply determinant
2013-08-12 02:43:26 +02:00
b += 1 // padding
2013-08-12 02:43:26 +02:00
v.Sequence = xgb.Get16(buf[b:])
b += 2
2013-08-12 02:43:26 +02:00
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
2013-08-12 02:43:26 +02:00
v.NumAttribs = xgb.Get32(buf[b:])
b += 4
2013-08-12 02:43:26 +02:00
b += 20 // padding
2013-08-12 02:43:26 +02:00
v.Attribs = make([]uint32, (int(v.NumAttribs) * 2))
for i := 0; i < int((int(v.NumAttribs) * 2)); i++ {
v.Attribs[i] = xgb.Get32(buf[b:])
b += 4
}
2013-08-12 02:43:26 +02:00
return v
}
// getDrawableAttributesRequest writes a GetDrawableAttributes request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func getDrawableAttributesRequest(c *xgb.Conn, Drawable Drawable) []byte {
size := 8
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
2013-08-12 02:43:26 +02:00
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 29 // request opcode
b += 1
2013-08-12 02:43:26 +02:00
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(Drawable))
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// GetErrorCookie is a cookie used only for GetError requests.
type GetErrorCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// GetError sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetErrorCookie.Reply.
2013-08-12 02:43:26 +02:00
func GetError(c *xgb.Conn, ContextTag ContextTag) GetErrorCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetError' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-12 02:43:26 +02:00
cookie := c.NewCookie(true, true)
c.NewRequest(getErrorRequest(c, ContextTag), cookie)
return GetErrorCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetErrorUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetErrorUnchecked(c *xgb.Conn, ContextTag ContextTag) GetErrorCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetError' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-12 02:43:26 +02:00
cookie := c.NewCookie(false, true)
c.NewRequest(getErrorRequest(c, ContextTag), cookie)
return GetErrorCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetErrorReply represents the data returned from a GetError request.
type GetErrorReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
Error int32
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a GetError request.
func (cook GetErrorCookie) Reply() (*GetErrorReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getErrorReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// getErrorReply reads a byte slice into a GetErrorReply value.
func getErrorReply(buf []byte) *GetErrorReply {
v := new(GetErrorReply)
b := 1 // skip reply determinant
2013-08-12 02:43:26 +02:00
b += 1 // padding
2013-08-12 02:43:26 +02:00
v.Sequence = xgb.Get16(buf[b:])
b += 2
2013-08-12 02:43:26 +02:00
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
2013-08-12 02:43:26 +02:00
v.Error = int32(xgb.Get32(buf[b:]))
b += 4
2013-08-12 02:43:26 +02:00
return v
}
// getErrorRequest writes a GetError request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func getErrorRequest(c *xgb.Conn, ContextTag ContextTag) []byte {
size := 8
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
2013-08-12 02:43:26 +02:00
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
2013-08-12 02:43:26 +02:00
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 115 // request opcode
b += 1
2013-08-12 02:43:26 +02:00
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// GetFBConfigsCookie is a cookie used only for GetFBConfigs requests.
type GetFBConfigsCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// GetFBConfigs sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetFBConfigsCookie.Reply.
2013-08-12 02:43:26 +02:00
func GetFBConfigs(c *xgb.Conn, Screen uint32) GetFBConfigsCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetFBConfigs' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-12 02:43:26 +02:00
cookie := c.NewCookie(true, true)
c.NewRequest(getFBConfigsRequest(c, Screen), cookie)
return GetFBConfigsCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetFBConfigsUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetFBConfigsUnchecked(c *xgb.Conn, Screen uint32) GetFBConfigsCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetFBConfigs' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-12 02:43:26 +02:00
cookie := c.NewCookie(false, true)
c.NewRequest(getFBConfigsRequest(c, Screen), cookie)
return GetFBConfigsCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetFBConfigsReply represents the data returned from a GetFBConfigs request.
type GetFBConfigsReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
NumFbConfigs uint32
NumProperties uint32
// padding: 16 bytes
PropertyList []uint32 // size: xgb.Pad((int(Length) * 4))
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a GetFBConfigs request.
func (cook GetFBConfigsCookie) Reply() (*GetFBConfigsReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getFBConfigsReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// getFBConfigsReply reads a byte slice into a GetFBConfigsReply value.
func getFBConfigsReply(buf []byte) *GetFBConfigsReply {
v := new(GetFBConfigsReply)
b := 1 // skip reply determinant
2013-08-12 02:43:26 +02:00
b += 1 // padding
2013-08-12 02:43:26 +02:00
v.Sequence = xgb.Get16(buf[b:])
b += 2
2013-08-12 02:43:26 +02:00
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
2013-08-12 02:43:26 +02:00
v.NumFbConfigs = xgb.Get32(buf[b:])
b += 4
2013-08-12 02:43:26 +02:00
v.NumProperties = xgb.Get32(buf[b:])
b += 4
2013-08-12 02:43:26 +02:00
b += 16 // padding
2013-08-12 02:43:26 +02:00
v.PropertyList = make([]uint32, v.Length)
for i := 0; i < int(v.Length); i++ {
v.PropertyList[i] = xgb.Get32(buf[b:])
b += 4
}
2013-08-12 02:43:26 +02:00
return v
}
// getFBConfigsRequest writes a GetFBConfigs request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func getFBConfigsRequest(c *xgb.Conn, Screen uint32) []byte {
size := 8
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 21 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Screen)
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// GetFloatvCookie is a cookie used only for GetFloatv requests.
type GetFloatvCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// GetFloatv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetFloatvCookie.Reply.
2013-08-12 02:43:26 +02:00
func GetFloatv(c *xgb.Conn, ContextTag ContextTag, Pname uint32) GetFloatvCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetFloatv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-12 02:43:26 +02:00
cookie := c.NewCookie(true, true)
c.NewRequest(getFloatvRequest(c, ContextTag, Pname), cookie)
return GetFloatvCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetFloatvUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetFloatvUnchecked(c *xgb.Conn, ContextTag ContextTag, Pname uint32) GetFloatvCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetFloatv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-12 02:43:26 +02:00
cookie := c.NewCookie(false, true)
c.NewRequest(getFloatvRequest(c, ContextTag, Pname), cookie)
return GetFloatvCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetFloatvReply represents the data returned from a GetFloatv request.
type GetFloatvReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum Float32
// padding: 12 bytes
Data []Float32 // size: xgb.Pad((int(N) * 4))
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a GetFloatv request.
func (cook GetFloatvCookie) Reply() (*GetFloatvReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getFloatvReply(buf), nil
}
// getFloatvReply reads a byte slice into a GetFloatvReply value.
func getFloatvReply(buf []byte) *GetFloatvReply {
v := new(GetFloatvReply)
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 += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
v.Datum = Float32(xgb.Get32(buf[b:]))
b += 4
b += 12 // padding
v.Data = make([]Float32, v.N)
for i := 0; i < int(v.N); i++ {
v.Data[i] = Float32(xgb.Get32(buf[b:]))
b += 4
}
return v
}
// getFloatvRequest writes a GetFloatv request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func getFloatvRequest(c *xgb.Conn, ContextTag ContextTag, Pname uint32) []byte {
size := 12
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 116 // 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
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Pname)
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// GetHistogramCookie is a cookie used only for GetHistogram requests.
type GetHistogramCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// GetHistogram sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetHistogramCookie.Reply.
func GetHistogram(c *xgb.Conn, ContextTag ContextTag, Target, Format, Type uint32, SwapBytes, Reset bool) GetHistogramCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetHistogram' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getHistogramRequest(c, ContextTag, Target, Format, Type, SwapBytes, Reset), cookie)
return GetHistogramCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetHistogramUnchecked sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetHistogramUnchecked(c *xgb.Conn, ContextTag ContextTag, Target, Format, Type uint32, SwapBytes, Reset bool) GetHistogramCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetHistogram' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getHistogramRequest(c, ContextTag, Target, Format, Type, SwapBytes, Reset), cookie)
return GetHistogramCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetHistogramReply represents the data returned from a GetHistogram request.
type GetHistogramReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
2013-08-12 02:43:26 +02:00
// padding: 8 bytes
Width int32
// padding: 12 bytes
Data []byte // size: xgb.Pad(((int(Length) * 4) * 1))
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a GetHistogram request.
func (cook GetHistogramCookie) Reply() (*GetHistogramReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
2013-08-12 02:43:26 +02:00
return getHistogramReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// getHistogramReply reads a byte slice into a GetHistogramReply value.
func getHistogramReply(buf []byte) *GetHistogramReply {
v := new(GetHistogramReply)
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
2013-08-12 02:43:26 +02:00
b += 8 // padding
v.Width = int32(xgb.Get32(buf[b:]))
b += 4
2013-08-12 02:43:26 +02:00
b += 12 // padding
v.Data = make([]byte, (int(v.Length) * 4))
copy(v.Data[:(int(v.Length)*4)], buf[b:])
b += int((int(v.Length) * 4))
2013-08-12 02:43:26 +02:00
return v
}
// getHistogramRequest writes a GetHistogram request to a byte slice for transfer.
func getHistogramRequest(c *xgb.Conn, ContextTag ContextTag, Target, Format, Type uint32, SwapBytes, Reset bool) []byte {
2013-08-12 02:43:26 +02:00
size := 24
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 154 // 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
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Target)
b += 4
xgb.Put32(buf[b:], Format)
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Type)
b += 4
if SwapBytes {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
if Reset {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
return buf
}
2013-08-12 02:43:26 +02:00
// GetHistogramParameterfvCookie is a cookie used only for GetHistogramParameterfv requests.
type GetHistogramParameterfvCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// GetHistogramParameterfv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetHistogramParameterfvCookie.Reply.
func GetHistogramParameterfv(c *xgb.Conn, ContextTag ContextTag, Target, Pname uint32) GetHistogramParameterfvCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetHistogramParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-12 02:43:26 +02:00
cookie := c.NewCookie(true, true)
c.NewRequest(getHistogramParameterfvRequest(c, ContextTag, Target, Pname), cookie)
return GetHistogramParameterfvCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetHistogramParameterfvUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetHistogramParameterfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Target, Pname uint32) GetHistogramParameterfvCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetHistogramParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-12 02:43:26 +02:00
cookie := c.NewCookie(false, true)
c.NewRequest(getHistogramParameterfvRequest(c, ContextTag, Target, Pname), cookie)
return GetHistogramParameterfvCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetHistogramParameterfvReply represents the data returned from a GetHistogramParameterfv request.
type GetHistogramParameterfvReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum Float32
// padding: 12 bytes
Data []Float32 // size: xgb.Pad((int(N) * 4))
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a GetHistogramParameterfv request.
func (cook GetHistogramParameterfvCookie) Reply() (*GetHistogramParameterfvReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getHistogramParameterfvReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// getHistogramParameterfvReply reads a byte slice into a GetHistogramParameterfvReply value.
func getHistogramParameterfvReply(buf []byte) *GetHistogramParameterfvReply {
v := new(GetHistogramParameterfvReply)
b := 1 // skip reply determinant
2013-08-12 02:43:26 +02:00
b += 1 // padding
2013-08-12 02:43:26 +02:00
v.Sequence = xgb.Get16(buf[b:])
b += 2
2013-08-12 02:43:26 +02:00
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
2013-08-12 02:43:26 +02:00
b += 4 // padding
2013-08-12 02:43:26 +02:00
v.N = xgb.Get32(buf[b:])
b += 4
2013-08-12 02:43:26 +02:00
v.Datum = Float32(xgb.Get32(buf[b:]))
b += 4
2013-08-12 02:43:26 +02:00
b += 12 // padding
2013-08-12 02:43:26 +02:00
v.Data = make([]Float32, v.N)
for i := 0; i < int(v.N); i++ {
v.Data[i] = Float32(xgb.Get32(buf[b:]))
b += 4
}
2013-08-12 02:43:26 +02:00
return v
}
// getHistogramParameterfvRequest writes a GetHistogramParameterfv request to a byte slice for transfer.
func getHistogramParameterfvRequest(c *xgb.Conn, ContextTag ContextTag, Target, Pname uint32) []byte {
2013-08-12 02:43:26 +02:00
size := 16
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 155 // 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
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Target)
b += 4
xgb.Put32(buf[b:], Pname)
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// GetHistogramParameterivCookie is a cookie used only for GetHistogramParameteriv requests.
type GetHistogramParameterivCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// GetHistogramParameteriv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetHistogramParameterivCookie.Reply.
func GetHistogramParameteriv(c *xgb.Conn, ContextTag ContextTag, Target, Pname uint32) GetHistogramParameterivCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetHistogramParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getHistogramParameterivRequest(c, ContextTag, Target, Pname), cookie)
return GetHistogramParameterivCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetHistogramParameterivUnchecked sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetHistogramParameterivUnchecked(c *xgb.Conn, ContextTag ContextTag, Target, Pname uint32) GetHistogramParameterivCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetHistogramParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getHistogramParameterivRequest(c, ContextTag, Target, Pname), cookie)
return GetHistogramParameterivCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetHistogramParameterivReply represents the data returned from a GetHistogramParameteriv request.
type GetHistogramParameterivReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
2013-08-12 02:43:26 +02:00
// padding: 4 bytes
N uint32
Datum int32
// padding: 12 bytes
2013-08-12 02:43:26 +02:00
Data []int32 // size: xgb.Pad((int(N) * 4))
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a GetHistogramParameteriv request.
func (cook GetHistogramParameterivCookie) Reply() (*GetHistogramParameterivReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
2013-08-12 02:43:26 +02:00
return getHistogramParameterivReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// getHistogramParameterivReply reads a byte slice into a GetHistogramParameterivReply value.
func getHistogramParameterivReply(buf []byte) *GetHistogramParameterivReply {
v := new(GetHistogramParameterivReply)
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
2013-08-12 02:43:26 +02:00
b += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
2013-08-12 02:43:26 +02:00
v.Datum = int32(xgb.Get32(buf[b:]))
b += 4
b += 12 // padding
2013-08-12 02:43:26 +02:00
v.Data = make([]int32, v.N)
for i := 0; i < int(v.N); i++ {
2013-08-12 02:43:26 +02:00
v.Data[i] = int32(xgb.Get32(buf[b:]))
b += 4
}
return v
}
// getHistogramParameterivRequest writes a GetHistogramParameteriv request to a byte slice for transfer.
func getHistogramParameterivRequest(c *xgb.Conn, ContextTag ContextTag, Target, Pname uint32) []byte {
2013-08-12 02:43:26 +02:00
size := 16
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 156 // 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
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Target)
b += 4
xgb.Put32(buf[b:], Pname)
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// GetIntegervCookie is a cookie used only for GetIntegerv requests.
type GetIntegervCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// GetIntegerv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetIntegervCookie.Reply.
2013-08-12 02:43:26 +02:00
func GetIntegerv(c *xgb.Conn, ContextTag ContextTag, Pname uint32) GetIntegervCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetIntegerv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getIntegervRequest(c, ContextTag, Pname), cookie)
return GetIntegervCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetIntegervUnchecked sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2013-08-12 02:43:26 +02:00
func GetIntegervUnchecked(c *xgb.Conn, ContextTag ContextTag, Pname uint32) GetIntegervCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetIntegerv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getIntegervRequest(c, ContextTag, Pname), cookie)
return GetIntegervCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetIntegervReply represents the data returned from a GetIntegerv request.
type GetIntegervReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
2013-08-12 02:43:26 +02:00
// padding: 4 bytes
N uint32
Datum int32
// padding: 12 bytes
Data []int32 // size: xgb.Pad((int(N) * 4))
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a GetIntegerv request.
func (cook GetIntegervCookie) Reply() (*GetIntegervReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
2013-08-12 02:43:26 +02:00
return getIntegervReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// getIntegervReply reads a byte slice into a GetIntegervReply value.
func getIntegervReply(buf []byte) *GetIntegervReply {
v := new(GetIntegervReply)
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
2013-08-12 02:43:26 +02:00
b += 4 // padding
2013-08-12 02:43:26 +02:00
v.N = xgb.Get32(buf[b:])
b += 4
2013-08-12 02:43:26 +02:00
v.Datum = int32(xgb.Get32(buf[b:]))
b += 4
2013-08-12 02:43:26 +02:00
b += 12 // padding
2013-08-12 02:43:26 +02:00
v.Data = make([]int32, v.N)
for i := 0; i < int(v.N); i++ {
v.Data[i] = int32(xgb.Get32(buf[b:]))
b += 4
}
2013-08-12 02:43:26 +02:00
return v
}
// getIntegervRequest writes a GetIntegerv request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func getIntegervRequest(c *xgb.Conn, ContextTag ContextTag, Pname uint32) []byte {
size := 12
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 117 // 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:], Pname)
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// GetLightfvCookie is a cookie used only for GetLightfv requests.
type GetLightfvCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// GetLightfv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetLightfvCookie.Reply.
func GetLightfv(c *xgb.Conn, ContextTag ContextTag, Light, Pname uint32) GetLightfvCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetLightfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getLightfvRequest(c, ContextTag, Light, Pname), cookie)
return GetLightfvCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetLightfvUnchecked sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetLightfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Light, Pname uint32) GetLightfvCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetLightfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getLightfvRequest(c, ContextTag, Light, Pname), cookie)
return GetLightfvCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetLightfvReply represents the data returned from a GetLightfv request.
type GetLightfvReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
2013-08-12 02:43:26 +02:00
// padding: 4 bytes
N uint32
Datum Float32
// padding: 12 bytes
Data []Float32 // size: xgb.Pad((int(N) * 4))
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a GetLightfv request.
func (cook GetLightfvCookie) Reply() (*GetLightfvReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
2013-08-12 02:43:26 +02:00
return getLightfvReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// getLightfvReply reads a byte slice into a GetLightfvReply value.
func getLightfvReply(buf []byte) *GetLightfvReply {
v := new(GetLightfvReply)
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
2013-08-12 02:43:26 +02:00
b += 4 // padding
2013-08-12 02:43:26 +02:00
v.N = xgb.Get32(buf[b:])
b += 4
v.Datum = Float32(xgb.Get32(buf[b:]))
b += 4
b += 12 // padding
v.Data = make([]Float32, v.N)
for i := 0; i < int(v.N); i++ {
v.Data[i] = Float32(xgb.Get32(buf[b:]))
b += 4
}
return v
}
// getLightfvRequest writes a GetLightfv request to a byte slice for transfer.
func getLightfvRequest(c *xgb.Conn, ContextTag ContextTag, Light, Pname uint32) []byte {
2013-08-12 02:43:26 +02:00
size := 16
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 118 // 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
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Light)
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Pname)
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// GetLightivCookie is a cookie used only for GetLightiv requests.
type GetLightivCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// GetLightiv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetLightivCookie.Reply.
func GetLightiv(c *xgb.Conn, ContextTag ContextTag, Light, Pname uint32) GetLightivCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetLightiv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getLightivRequest(c, ContextTag, Light, Pname), cookie)
return GetLightivCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetLightivUnchecked sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetLightivUnchecked(c *xgb.Conn, ContextTag ContextTag, Light, Pname uint32) GetLightivCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetLightiv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getLightivRequest(c, ContextTag, Light, Pname), cookie)
return GetLightivCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetLightivReply represents the data returned from a GetLightiv request.
type GetLightivReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
2013-08-12 02:43:26 +02:00
Datum int32
// padding: 12 bytes
Data []int32 // size: xgb.Pad((int(N) * 4))
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a GetLightiv request.
func (cook GetLightivCookie) Reply() (*GetLightivReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
2013-08-12 02:43:26 +02:00
return getLightivReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// getLightivReply reads a byte slice into a GetLightivReply value.
func getLightivReply(buf []byte) *GetLightivReply {
v := new(GetLightivReply)
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 += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
2013-08-12 02:43:26 +02:00
v.Datum = int32(xgb.Get32(buf[b:]))
b += 4
2013-08-12 02:43:26 +02:00
b += 12 // padding
2013-08-12 02:43:26 +02:00
v.Data = make([]int32, v.N)
for i := 0; i < int(v.N); i++ {
2013-08-12 02:43:26 +02:00
v.Data[i] = int32(xgb.Get32(buf[b:]))
b += 4
}
return v
}
// getLightivRequest writes a GetLightiv request to a byte slice for transfer.
func getLightivRequest(c *xgb.Conn, ContextTag ContextTag, Light, Pname uint32) []byte {
2013-08-12 02:43:26 +02:00
size := 16
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 119 // 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
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Light)
b += 4
xgb.Put32(buf[b:], Pname)
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// GetMapdvCookie is a cookie used only for GetMapdv requests.
type GetMapdvCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// GetMapdv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetMapdvCookie.Reply.
func GetMapdv(c *xgb.Conn, ContextTag ContextTag, Target, Query uint32) GetMapdvCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetMapdv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getMapdvRequest(c, ContextTag, Target, Query), cookie)
return GetMapdvCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetMapdvUnchecked sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetMapdvUnchecked(c *xgb.Conn, ContextTag ContextTag, Target, Query uint32) GetMapdvCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetMapdv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getMapdvRequest(c, ContextTag, Target, Query), cookie)
return GetMapdvCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetMapdvReply represents the data returned from a GetMapdv request.
type GetMapdvReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
2013-08-12 02:43:26 +02:00
// padding: 4 bytes
N uint32
Datum Float64
// padding: 8 bytes
Data []Float64 // size: xgb.Pad((int(N) * 8))
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a GetMapdv request.
func (cook GetMapdvCookie) Reply() (*GetMapdvReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
2013-08-12 02:43:26 +02:00
return getMapdvReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// getMapdvReply reads a byte slice into a GetMapdvReply value.
func getMapdvReply(buf []byte) *GetMapdvReply {
v := new(GetMapdvReply)
b := 1 // skip reply determinant
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
2017-01-18 10:52:16 +01:00
b += 1 // padding
2013-08-12 02:43:26 +02:00
b += 4 // padding
2013-08-12 02:43:26 +02:00
v.N = xgb.Get32(buf[b:])
b += 4
v.Datum = Float64(xgb.Get64(buf[b:]))
b += 8
b += 8 // padding
v.Data = make([]Float64, v.N)
for i := 0; i < int(v.N); i++ {
v.Data[i] = Float64(xgb.Get64(buf[b:]))
b += 8
}
return v
}
// getMapdvRequest writes a GetMapdv request to a byte slice for transfer.
func getMapdvRequest(c *xgb.Conn, ContextTag ContextTag, Target, Query uint32) []byte {
2013-08-12 02:43:26 +02:00
size := 16
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 120 // 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
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Target)
b += 4
xgb.Put32(buf[b:], Query)
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// GetMapfvCookie is a cookie used only for GetMapfv requests.
type GetMapfvCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// GetMapfv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetMapfvCookie.Reply.
func GetMapfv(c *xgb.Conn, ContextTag ContextTag, Target, Query uint32) GetMapfvCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetMapfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getMapfvRequest(c, ContextTag, Target, Query), cookie)
return GetMapfvCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetMapfvUnchecked sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetMapfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Target, Query uint32) GetMapfvCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetMapfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getMapfvRequest(c, ContextTag, Target, Query), cookie)
return GetMapfvCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetMapfvReply represents the data returned from a GetMapfv request.
type GetMapfvReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
2013-08-12 02:43:26 +02:00
Datum Float32
// padding: 12 bytes
Data []Float32 // size: xgb.Pad((int(N) * 4))
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a GetMapfv request.
func (cook GetMapfvCookie) Reply() (*GetMapfvReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
2013-08-12 02:43:26 +02:00
return getMapfvReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// getMapfvReply reads a byte slice into a GetMapfvReply value.
func getMapfvReply(buf []byte) *GetMapfvReply {
v := new(GetMapfvReply)
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 += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
2013-08-12 02:43:26 +02:00
v.Datum = Float32(xgb.Get32(buf[b:]))
b += 4
2013-08-12 02:43:26 +02:00
b += 12 // padding
2013-08-12 02:43:26 +02:00
v.Data = make([]Float32, v.N)
for i := 0; i < int(v.N); i++ {
2013-08-12 02:43:26 +02:00
v.Data[i] = Float32(xgb.Get32(buf[b:]))
b += 4
}
return v
}
// getMapfvRequest writes a GetMapfv request to a byte slice for transfer.
func getMapfvRequest(c *xgb.Conn, ContextTag ContextTag, Target, Query uint32) []byte {
2013-08-12 02:43:26 +02:00
size := 16
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 121 // 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
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Target)
b += 4
xgb.Put32(buf[b:], Query)
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// GetMapivCookie is a cookie used only for GetMapiv requests.
type GetMapivCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// GetMapiv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetMapivCookie.Reply.
func GetMapiv(c *xgb.Conn, ContextTag ContextTag, Target, Query uint32) GetMapivCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetMapiv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getMapivRequest(c, ContextTag, Target, Query), cookie)
return GetMapivCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetMapivUnchecked sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetMapivUnchecked(c *xgb.Conn, ContextTag ContextTag, Target, Query uint32) GetMapivCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetMapiv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getMapivRequest(c, ContextTag, Target, Query), cookie)
return GetMapivCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetMapivReply represents the data returned from a GetMapiv request.
type GetMapivReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
2013-08-12 02:43:26 +02:00
// padding: 4 bytes
N uint32
Datum int32
// padding: 12 bytes
Data []int32 // size: xgb.Pad((int(N) * 4))
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a GetMapiv request.
func (cook GetMapivCookie) Reply() (*GetMapivReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
2013-08-12 02:43:26 +02:00
return getMapivReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// getMapivReply reads a byte slice into a GetMapivReply value.
func getMapivReply(buf []byte) *GetMapivReply {
v := new(GetMapivReply)
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
2013-08-12 02:43:26 +02:00
b += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
v.Datum = int32(xgb.Get32(buf[b:]))
b += 4
2013-08-12 02:43:26 +02:00
b += 12 // padding
v.Data = make([]int32, v.N)
for i := 0; i < int(v.N); i++ {
v.Data[i] = int32(xgb.Get32(buf[b:]))
b += 4
}
return v
}
// getMapivRequest writes a GetMapiv request to a byte slice for transfer.
func getMapivRequest(c *xgb.Conn, ContextTag ContextTag, Target, Query uint32) []byte {
2013-08-12 02:43:26 +02:00
size := 16
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 122 // 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
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Target)
b += 4
xgb.Put32(buf[b:], Query)
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// GetMaterialfvCookie is a cookie used only for GetMaterialfv requests.
type GetMaterialfvCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// GetMaterialfv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetMaterialfvCookie.Reply.
func GetMaterialfv(c *xgb.Conn, ContextTag ContextTag, Face, Pname uint32) GetMaterialfvCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetMaterialfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getMaterialfvRequest(c, ContextTag, Face, Pname), cookie)
return GetMaterialfvCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetMaterialfvUnchecked sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetMaterialfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Face, Pname uint32) GetMaterialfvCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetMaterialfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getMaterialfvRequest(c, ContextTag, Face, Pname), cookie)
return GetMaterialfvCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetMaterialfvReply represents the data returned from a GetMaterialfv request.
type GetMaterialfvReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum Float32
// padding: 12 bytes
Data []Float32 // size: xgb.Pad((int(N) * 4))
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a GetMaterialfv request.
func (cook GetMaterialfvCookie) Reply() (*GetMaterialfvReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
2013-08-12 02:43:26 +02:00
return getMaterialfvReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// getMaterialfvReply reads a byte slice into a GetMaterialfvReply value.
func getMaterialfvReply(buf []byte) *GetMaterialfvReply {
v := new(GetMaterialfvReply)
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 += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
v.Datum = Float32(xgb.Get32(buf[b:]))
b += 4
b += 12 // padding
v.Data = make([]Float32, v.N)
for i := 0; i < int(v.N); i++ {
v.Data[i] = Float32(xgb.Get32(buf[b:]))
b += 4
}
return v
}
// getMaterialfvRequest writes a GetMaterialfv request to a byte slice for transfer.
func getMaterialfvRequest(c *xgb.Conn, ContextTag ContextTag, Face, Pname uint32) []byte {
2013-08-12 02:43:26 +02:00
size := 16
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 123 // 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
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Face)
b += 4
xgb.Put32(buf[b:], Pname)
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// GetMaterialivCookie is a cookie used only for GetMaterialiv requests.
type GetMaterialivCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// GetMaterialiv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetMaterialivCookie.Reply.
func GetMaterialiv(c *xgb.Conn, ContextTag ContextTag, Face, Pname uint32) GetMaterialivCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetMaterialiv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getMaterialivRequest(c, ContextTag, Face, Pname), cookie)
return GetMaterialivCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetMaterialivUnchecked sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetMaterialivUnchecked(c *xgb.Conn, ContextTag ContextTag, Face, Pname uint32) GetMaterialivCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetMaterialiv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getMaterialivRequest(c, ContextTag, Face, Pname), cookie)
return GetMaterialivCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetMaterialivReply represents the data returned from a GetMaterialiv request.
type GetMaterialivReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum int32
// padding: 12 bytes
Data []int32 // size: xgb.Pad((int(N) * 4))
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a GetMaterialiv request.
func (cook GetMaterialivCookie) Reply() (*GetMaterialivReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
2013-08-12 02:43:26 +02:00
return getMaterialivReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// getMaterialivReply reads a byte slice into a GetMaterialivReply value.
func getMaterialivReply(buf []byte) *GetMaterialivReply {
v := new(GetMaterialivReply)
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 += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
v.Datum = int32(xgb.Get32(buf[b:]))
b += 4
b += 12 // padding
v.Data = make([]int32, v.N)
for i := 0; i < int(v.N); i++ {
v.Data[i] = int32(xgb.Get32(buf[b:]))
b += 4
}
return v
}
// getMaterialivRequest writes a GetMaterialiv request to a byte slice for transfer.
func getMaterialivRequest(c *xgb.Conn, ContextTag ContextTag, Face, Pname uint32) []byte {
2013-08-12 02:43:26 +02:00
size := 16
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 124 // 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
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Face)
b += 4
xgb.Put32(buf[b:], Pname)
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// GetMinmaxCookie is a cookie used only for GetMinmax requests.
type GetMinmaxCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// GetMinmax sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetMinmaxCookie.Reply.
func GetMinmax(c *xgb.Conn, ContextTag ContextTag, Target, Format, Type uint32, SwapBytes, Reset bool) GetMinmaxCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetMinmax' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getMinmaxRequest(c, ContextTag, Target, Format, Type, SwapBytes, Reset), cookie)
return GetMinmaxCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetMinmaxUnchecked sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetMinmaxUnchecked(c *xgb.Conn, ContextTag ContextTag, Target, Format, Type uint32, SwapBytes, Reset bool) GetMinmaxCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetMinmax' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getMinmaxRequest(c, ContextTag, Target, Format, Type, SwapBytes, Reset), cookie)
return GetMinmaxCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetMinmaxReply represents the data returned from a GetMinmax request.
type GetMinmaxReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
2013-08-12 02:43:26 +02:00
// padding: 24 bytes
Data []byte // size: xgb.Pad(((int(Length) * 4) * 1))
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a GetMinmax request.
func (cook GetMinmaxCookie) Reply() (*GetMinmaxReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
2013-08-12 02:43:26 +02:00
return getMinmaxReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// getMinmaxReply reads a byte slice into a GetMinmaxReply value.
func getMinmaxReply(buf []byte) *GetMinmaxReply {
v := new(GetMinmaxReply)
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
2013-08-12 02:43:26 +02:00
b += 24 // padding
2013-08-12 02:43:26 +02:00
v.Data = make([]byte, (int(v.Length) * 4))
copy(v.Data[:(int(v.Length)*4)], buf[b:])
b += int((int(v.Length) * 4))
return v
}
// getMinmaxRequest writes a GetMinmax request to a byte slice for transfer.
func getMinmaxRequest(c *xgb.Conn, ContextTag ContextTag, Target, Format, Type uint32, SwapBytes, Reset bool) []byte {
2013-08-12 02:43:26 +02:00
size := 24
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 157 // 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
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Target)
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Format)
b += 4
xgb.Put32(buf[b:], Type)
b += 4
2013-08-12 02:43:26 +02:00
if SwapBytes {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
if Reset {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
return buf
}
2013-08-12 02:43:26 +02:00
// GetMinmaxParameterfvCookie is a cookie used only for GetMinmaxParameterfv requests.
type GetMinmaxParameterfvCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// GetMinmaxParameterfv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetMinmaxParameterfvCookie.Reply.
func GetMinmaxParameterfv(c *xgb.Conn, ContextTag ContextTag, Target, Pname uint32) GetMinmaxParameterfvCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetMinmaxParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getMinmaxParameterfvRequest(c, ContextTag, Target, Pname), cookie)
return GetMinmaxParameterfvCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetMinmaxParameterfvUnchecked sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetMinmaxParameterfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Target, Pname uint32) GetMinmaxParameterfvCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetMinmaxParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getMinmaxParameterfvRequest(c, ContextTag, Target, Pname), cookie)
return GetMinmaxParameterfvCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetMinmaxParameterfvReply represents the data returned from a GetMinmaxParameterfv request.
type GetMinmaxParameterfvReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
2013-08-12 02:43:26 +02:00
Datum Float32
// padding: 12 bytes
2013-08-12 02:43:26 +02:00
Data []Float32 // size: xgb.Pad((int(N) * 4))
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a GetMinmaxParameterfv request.
func (cook GetMinmaxParameterfvCookie) Reply() (*GetMinmaxParameterfvReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
2013-08-12 02:43:26 +02:00
return getMinmaxParameterfvReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// getMinmaxParameterfvReply reads a byte slice into a GetMinmaxParameterfvReply value.
func getMinmaxParameterfvReply(buf []byte) *GetMinmaxParameterfvReply {
v := new(GetMinmaxParameterfvReply)
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 += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
2013-08-12 02:43:26 +02:00
v.Datum = Float32(xgb.Get32(buf[b:]))
b += 4
b += 12 // padding
2013-08-12 02:43:26 +02:00
v.Data = make([]Float32, v.N)
for i := 0; i < int(v.N); i++ {
2013-08-12 02:43:26 +02:00
v.Data[i] = Float32(xgb.Get32(buf[b:]))
b += 4
}
return v
}
// getMinmaxParameterfvRequest writes a GetMinmaxParameterfv request to a byte slice for transfer.
func getMinmaxParameterfvRequest(c *xgb.Conn, ContextTag ContextTag, Target, Pname uint32) []byte {
size := 16
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 158 // 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
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Target)
b += 4
xgb.Put32(buf[b:], Pname)
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// GetMinmaxParameterivCookie is a cookie used only for GetMinmaxParameteriv requests.
type GetMinmaxParameterivCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// GetMinmaxParameteriv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetMinmaxParameterivCookie.Reply.
func GetMinmaxParameteriv(c *xgb.Conn, ContextTag ContextTag, Target, Pname uint32) GetMinmaxParameterivCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetMinmaxParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getMinmaxParameterivRequest(c, ContextTag, Target, Pname), cookie)
return GetMinmaxParameterivCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetMinmaxParameterivUnchecked sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetMinmaxParameterivUnchecked(c *xgb.Conn, ContextTag ContextTag, Target, Pname uint32) GetMinmaxParameterivCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetMinmaxParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getMinmaxParameterivRequest(c, ContextTag, Target, Pname), cookie)
return GetMinmaxParameterivCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetMinmaxParameterivReply represents the data returned from a GetMinmaxParameteriv request.
type GetMinmaxParameterivReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
2013-08-12 02:43:26 +02:00
Datum int32
// padding: 12 bytes
Data []int32 // size: xgb.Pad((int(N) * 4))
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a GetMinmaxParameteriv request.
func (cook GetMinmaxParameterivCookie) Reply() (*GetMinmaxParameterivReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
2013-08-12 02:43:26 +02:00
return getMinmaxParameterivReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// getMinmaxParameterivReply reads a byte slice into a GetMinmaxParameterivReply value.
func getMinmaxParameterivReply(buf []byte) *GetMinmaxParameterivReply {
v := new(GetMinmaxParameterivReply)
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 += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
2013-08-12 02:43:26 +02:00
v.Datum = int32(xgb.Get32(buf[b:]))
b += 4
2013-08-12 02:43:26 +02:00
b += 12 // padding
2013-08-12 02:43:26 +02:00
v.Data = make([]int32, v.N)
for i := 0; i < int(v.N); i++ {
2013-08-12 02:43:26 +02:00
v.Data[i] = int32(xgb.Get32(buf[b:]))
b += 4
}
return v
}
// getMinmaxParameterivRequest writes a GetMinmaxParameteriv request to a byte slice for transfer.
func getMinmaxParameterivRequest(c *xgb.Conn, ContextTag ContextTag, Target, Pname uint32) []byte {
size := 16
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 159 // 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:], Target)
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Pname)
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// GetPixelMapfvCookie is a cookie used only for GetPixelMapfv requests.
type GetPixelMapfvCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// GetPixelMapfv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetPixelMapfvCookie.Reply.
2013-08-12 02:43:26 +02:00
func GetPixelMapfv(c *xgb.Conn, ContextTag ContextTag, Map uint32) GetPixelMapfvCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetPixelMapfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getPixelMapfvRequest(c, ContextTag, Map), cookie)
return GetPixelMapfvCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetPixelMapfvUnchecked sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2013-08-12 02:43:26 +02:00
func GetPixelMapfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Map uint32) GetPixelMapfvCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetPixelMapfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getPixelMapfvRequest(c, ContextTag, Map), cookie)
return GetPixelMapfvCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetPixelMapfvReply represents the data returned from a GetPixelMapfv request.
type GetPixelMapfvReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum Float32
// padding: 12 bytes
Data []Float32 // size: xgb.Pad((int(N) * 4))
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a GetPixelMapfv request.
func (cook GetPixelMapfvCookie) Reply() (*GetPixelMapfvReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
2013-08-12 02:43:26 +02:00
return getPixelMapfvReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// getPixelMapfvReply reads a byte slice into a GetPixelMapfvReply value.
func getPixelMapfvReply(buf []byte) *GetPixelMapfvReply {
v := new(GetPixelMapfvReply)
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 += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
v.Datum = Float32(xgb.Get32(buf[b:]))
b += 4
b += 12 // padding
v.Data = make([]Float32, v.N)
for i := 0; i < int(v.N); i++ {
v.Data[i] = Float32(xgb.Get32(buf[b:]))
b += 4
}
return v
}
// getPixelMapfvRequest writes a GetPixelMapfv request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func getPixelMapfvRequest(c *xgb.Conn, ContextTag ContextTag, Map uint32) []byte {
size := 12
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 125 // 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
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Map)
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// GetPixelMapuivCookie is a cookie used only for GetPixelMapuiv requests.
type GetPixelMapuivCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// GetPixelMapuiv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetPixelMapuivCookie.Reply.
2013-08-12 02:43:26 +02:00
func GetPixelMapuiv(c *xgb.Conn, ContextTag ContextTag, Map uint32) GetPixelMapuivCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetPixelMapuiv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getPixelMapuivRequest(c, ContextTag, Map), cookie)
return GetPixelMapuivCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetPixelMapuivUnchecked sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2013-08-12 02:43:26 +02:00
func GetPixelMapuivUnchecked(c *xgb.Conn, ContextTag ContextTag, Map uint32) GetPixelMapuivCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetPixelMapuiv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getPixelMapuivRequest(c, ContextTag, Map), cookie)
return GetPixelMapuivCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetPixelMapuivReply represents the data returned from a GetPixelMapuiv request.
type GetPixelMapuivReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
2013-08-12 02:43:26 +02:00
Datum uint32
// padding: 12 bytes
2013-08-12 02:43:26 +02:00
Data []uint32 // size: xgb.Pad((int(N) * 4))
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a GetPixelMapuiv request.
func (cook GetPixelMapuivCookie) Reply() (*GetPixelMapuivReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
2013-08-12 02:43:26 +02:00
return getPixelMapuivReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// getPixelMapuivReply reads a byte slice into a GetPixelMapuivReply value.
func getPixelMapuivReply(buf []byte) *GetPixelMapuivReply {
v := new(GetPixelMapuivReply)
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 += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
2013-08-12 02:43:26 +02:00
v.Datum = xgb.Get32(buf[b:])
b += 4
b += 12 // padding
2013-08-12 02:43:26 +02:00
v.Data = make([]uint32, v.N)
for i := 0; i < int(v.N); i++ {
2013-08-12 02:43:26 +02:00
v.Data[i] = xgb.Get32(buf[b:])
b += 4
}
return v
}
// getPixelMapuivRequest writes a GetPixelMapuiv request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func getPixelMapuivRequest(c *xgb.Conn, ContextTag ContextTag, Map uint32) []byte {
size := 12
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 126 // 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
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Map)
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// GetPixelMapusvCookie is a cookie used only for GetPixelMapusv requests.
type GetPixelMapusvCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// GetPixelMapusv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetPixelMapusvCookie.Reply.
2013-08-12 02:43:26 +02:00
func GetPixelMapusv(c *xgb.Conn, ContextTag ContextTag, Map uint32) GetPixelMapusvCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetPixelMapusv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getPixelMapusvRequest(c, ContextTag, Map), cookie)
return GetPixelMapusvCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetPixelMapusvUnchecked sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2013-08-12 02:43:26 +02:00
func GetPixelMapusvUnchecked(c *xgb.Conn, ContextTag ContextTag, Map uint32) GetPixelMapusvCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetPixelMapusv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getPixelMapusvRequest(c, ContextTag, Map), cookie)
return GetPixelMapusvCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetPixelMapusvReply represents the data returned from a GetPixelMapusv request.
type GetPixelMapusvReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
2013-08-12 02:43:26 +02:00
Datum uint16
// padding: 16 bytes
Data []uint16 // size: xgb.Pad((int(N) * 2))
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a GetPixelMapusv request.
func (cook GetPixelMapusvCookie) Reply() (*GetPixelMapusvReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
2013-08-12 02:43:26 +02:00
return getPixelMapusvReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// getPixelMapusvReply reads a byte slice into a GetPixelMapusvReply value.
func getPixelMapusvReply(buf []byte) *GetPixelMapusvReply {
v := new(GetPixelMapusvReply)
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 += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
2013-08-12 02:43:26 +02:00
v.Datum = xgb.Get16(buf[b:])
b += 2
2013-08-12 02:43:26 +02:00
b += 16 // padding
2013-08-12 02:43:26 +02:00
v.Data = make([]uint16, v.N)
for i := 0; i < int(v.N); i++ {
2013-08-12 02:43:26 +02:00
v.Data[i] = xgb.Get16(buf[b:])
b += 2
}
return v
}
// getPixelMapusvRequest writes a GetPixelMapusv request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func getPixelMapusvRequest(c *xgb.Conn, ContextTag ContextTag, Map uint32) []byte {
size := 12
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 127 // 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
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Map)
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// GetPolygonStippleCookie is a cookie used only for GetPolygonStipple requests.
type GetPolygonStippleCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// GetPolygonStipple sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetPolygonStippleCookie.Reply.
2013-08-12 02:43:26 +02:00
func GetPolygonStipple(c *xgb.Conn, ContextTag ContextTag, LsbFirst bool) GetPolygonStippleCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetPolygonStipple' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getPolygonStippleRequest(c, ContextTag, LsbFirst), cookie)
return GetPolygonStippleCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetPolygonStippleUnchecked sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2013-08-12 02:43:26 +02:00
func GetPolygonStippleUnchecked(c *xgb.Conn, ContextTag ContextTag, LsbFirst bool) GetPolygonStippleCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetPolygonStipple' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getPolygonStippleRequest(c, ContextTag, LsbFirst), cookie)
return GetPolygonStippleCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetPolygonStippleReply represents the data returned from a GetPolygonStipple request.
type GetPolygonStippleReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
2013-08-12 02:43:26 +02:00
// padding: 24 bytes
Data []byte // size: xgb.Pad(((int(Length) * 4) * 1))
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a GetPolygonStipple request.
func (cook GetPolygonStippleCookie) Reply() (*GetPolygonStippleReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
2013-08-12 02:43:26 +02:00
return getPolygonStippleReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// getPolygonStippleReply reads a byte slice into a GetPolygonStippleReply value.
func getPolygonStippleReply(buf []byte) *GetPolygonStippleReply {
v := new(GetPolygonStippleReply)
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
2013-08-12 02:43:26 +02:00
b += 24 // padding
2013-08-12 02:43:26 +02:00
v.Data = make([]byte, (int(v.Length) * 4))
copy(v.Data[:(int(v.Length)*4)], buf[b:])
b += int((int(v.Length) * 4))
return v
}
// getPolygonStippleRequest writes a GetPolygonStipple request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func getPolygonStippleRequest(c *xgb.Conn, ContextTag ContextTag, LsbFirst bool) []byte {
size := 12
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 128 // 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
2013-08-12 02:43:26 +02:00
if LsbFirst {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
return buf
}
2013-08-12 02:43:26 +02:00
// GetQueryObjectivARBCookie is a cookie used only for GetQueryObjectivARB requests.
type GetQueryObjectivARBCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// GetQueryObjectivARB sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetQueryObjectivARBCookie.Reply.
func GetQueryObjectivARB(c *xgb.Conn, ContextTag ContextTag, Id, Pname uint32) GetQueryObjectivARBCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetQueryObjectivARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getQueryObjectivARBRequest(c, ContextTag, Id, Pname), cookie)
return GetQueryObjectivARBCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetQueryObjectivARBUnchecked sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetQueryObjectivARBUnchecked(c *xgb.Conn, ContextTag ContextTag, Id, Pname uint32) GetQueryObjectivARBCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetQueryObjectivARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getQueryObjectivARBRequest(c, ContextTag, Id, Pname), cookie)
return GetQueryObjectivARBCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetQueryObjectivARBReply represents the data returned from a GetQueryObjectivARB request.
type GetQueryObjectivARBReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
2013-08-12 02:43:26 +02:00
Datum int32
// padding: 12 bytes
2013-08-12 02:43:26 +02:00
Data []int32 // size: xgb.Pad((int(N) * 4))
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a GetQueryObjectivARB request.
func (cook GetQueryObjectivARBCookie) Reply() (*GetQueryObjectivARBReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
2013-08-12 02:43:26 +02:00
return getQueryObjectivARBReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// getQueryObjectivARBReply reads a byte slice into a GetQueryObjectivARBReply value.
func getQueryObjectivARBReply(buf []byte) *GetQueryObjectivARBReply {
v := new(GetQueryObjectivARBReply)
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 += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
2013-08-12 02:43:26 +02:00
v.Datum = int32(xgb.Get32(buf[b:]))
b += 4
b += 12 // padding
2013-08-12 02:43:26 +02:00
v.Data = make([]int32, v.N)
for i := 0; i < int(v.N); i++ {
2013-08-12 02:43:26 +02:00
v.Data[i] = int32(xgb.Get32(buf[b:]))
b += 4
}
return v
}
// getQueryObjectivARBRequest writes a GetQueryObjectivARB request to a byte slice for transfer.
func getQueryObjectivARBRequest(c *xgb.Conn, ContextTag ContextTag, Id, Pname uint32) []byte {
2013-08-12 02:43:26 +02:00
size := 16
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 165 // 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
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Id)
b += 4
xgb.Put32(buf[b:], Pname)
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// GetQueryObjectuivARBCookie is a cookie used only for GetQueryObjectuivARB requests.
type GetQueryObjectuivARBCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// GetQueryObjectuivARB sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetQueryObjectuivARBCookie.Reply.
func GetQueryObjectuivARB(c *xgb.Conn, ContextTag ContextTag, Id, Pname uint32) GetQueryObjectuivARBCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetQueryObjectuivARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getQueryObjectuivARBRequest(c, ContextTag, Id, Pname), cookie)
return GetQueryObjectuivARBCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetQueryObjectuivARBUnchecked sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetQueryObjectuivARBUnchecked(c *xgb.Conn, ContextTag ContextTag, Id, Pname uint32) GetQueryObjectuivARBCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetQueryObjectuivARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getQueryObjectuivARBRequest(c, ContextTag, Id, Pname), cookie)
return GetQueryObjectuivARBCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetQueryObjectuivARBReply represents the data returned from a GetQueryObjectuivARB request.
type GetQueryObjectuivARBReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum uint32
// padding: 12 bytes
Data []uint32 // size: xgb.Pad((int(N) * 4))
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a GetQueryObjectuivARB request.
func (cook GetQueryObjectuivARBCookie) Reply() (*GetQueryObjectuivARBReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
2013-08-12 02:43:26 +02:00
return getQueryObjectuivARBReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// getQueryObjectuivARBReply reads a byte slice into a GetQueryObjectuivARBReply value.
func getQueryObjectuivARBReply(buf []byte) *GetQueryObjectuivARBReply {
v := new(GetQueryObjectuivARBReply)
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 += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
v.Datum = xgb.Get32(buf[b:])
b += 4
b += 12 // padding
v.Data = make([]uint32, v.N)
for i := 0; i < int(v.N); i++ {
v.Data[i] = xgb.Get32(buf[b:])
b += 4
}
return v
}
// getQueryObjectuivARBRequest writes a GetQueryObjectuivARB request to a byte slice for transfer.
func getQueryObjectuivARBRequest(c *xgb.Conn, ContextTag ContextTag, Id, Pname uint32) []byte {
2013-08-12 02:43:26 +02:00
size := 16
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 166 // 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
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Id)
b += 4
xgb.Put32(buf[b:], Pname)
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// GetQueryivARBCookie is a cookie used only for GetQueryivARB requests.
type GetQueryivARBCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// GetQueryivARB sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetQueryivARBCookie.Reply.
func GetQueryivARB(c *xgb.Conn, ContextTag ContextTag, Target, Pname uint32) GetQueryivARBCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetQueryivARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getQueryivARBRequest(c, ContextTag, Target, Pname), cookie)
return GetQueryivARBCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetQueryivARBUnchecked sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetQueryivARBUnchecked(c *xgb.Conn, ContextTag ContextTag, Target, Pname uint32) GetQueryivARBCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetQueryivARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getQueryivARBRequest(c, ContextTag, Target, Pname), cookie)
return GetQueryivARBCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetQueryivARBReply represents the data returned from a GetQueryivARB request.
type GetQueryivARBReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
2013-08-12 02:43:26 +02:00
Datum int32
// padding: 12 bytes
Data []int32 // size: xgb.Pad((int(N) * 4))
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a GetQueryivARB request.
func (cook GetQueryivARBCookie) Reply() (*GetQueryivARBReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
2013-08-12 02:43:26 +02:00
return getQueryivARBReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// getQueryivARBReply reads a byte slice into a GetQueryivARBReply value.
func getQueryivARBReply(buf []byte) *GetQueryivARBReply {
v := new(GetQueryivARBReply)
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 += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
2013-08-12 02:43:26 +02:00
v.Datum = int32(xgb.Get32(buf[b:]))
b += 4
2013-08-12 02:43:26 +02:00
b += 12 // padding
2013-08-12 02:43:26 +02:00
v.Data = make([]int32, v.N)
for i := 0; i < int(v.N); i++ {
2013-08-12 02:43:26 +02:00
v.Data[i] = int32(xgb.Get32(buf[b:]))
b += 4
}
return v
}
// getQueryivARBRequest writes a GetQueryivARB request to a byte slice for transfer.
func getQueryivARBRequest(c *xgb.Conn, ContextTag ContextTag, Target, Pname uint32) []byte {
2013-08-12 02:43:26 +02:00
size := 16
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 164 // 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
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Target)
b += 4
xgb.Put32(buf[b:], Pname)
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// GetSeparableFilterCookie is a cookie used only for GetSeparableFilter requests.
type GetSeparableFilterCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// GetSeparableFilter sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetSeparableFilterCookie.Reply.
func GetSeparableFilter(c *xgb.Conn, ContextTag ContextTag, Target, Format, Type uint32, SwapBytes bool) GetSeparableFilterCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetSeparableFilter' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getSeparableFilterRequest(c, ContextTag, Target, Format, Type, SwapBytes), cookie)
return GetSeparableFilterCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetSeparableFilterUnchecked sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetSeparableFilterUnchecked(c *xgb.Conn, ContextTag ContextTag, Target, Format, Type uint32, SwapBytes bool) GetSeparableFilterCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetSeparableFilter' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getSeparableFilterRequest(c, ContextTag, Target, Format, Type, SwapBytes), cookie)
return GetSeparableFilterCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetSeparableFilterReply represents the data returned from a GetSeparableFilter request.
type GetSeparableFilterReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
2013-08-12 02:43:26 +02:00
// padding: 8 bytes
RowW int32
ColH int32
// padding: 8 bytes
RowsAndCols []byte // size: xgb.Pad(((int(Length) * 4) * 1))
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a GetSeparableFilter request.
func (cook GetSeparableFilterCookie) Reply() (*GetSeparableFilterReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
2013-08-12 02:43:26 +02:00
return getSeparableFilterReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// getSeparableFilterReply reads a byte slice into a GetSeparableFilterReply value.
func getSeparableFilterReply(buf []byte) *GetSeparableFilterReply {
v := new(GetSeparableFilterReply)
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
2013-08-12 02:43:26 +02:00
b += 8 // padding
2013-08-12 02:43:26 +02:00
v.RowW = int32(xgb.Get32(buf[b:]))
b += 4
v.ColH = int32(xgb.Get32(buf[b:]))
b += 4
b += 8 // padding
v.RowsAndCols = make([]byte, (int(v.Length) * 4))
copy(v.RowsAndCols[:(int(v.Length)*4)], buf[b:])
b += int((int(v.Length) * 4))
return v
}
// getSeparableFilterRequest writes a GetSeparableFilter request to a byte slice for transfer.
func getSeparableFilterRequest(c *xgb.Conn, ContextTag ContextTag, Target, Format, Type uint32, SwapBytes bool) []byte {
2013-08-12 02:43:26 +02:00
size := 24
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 153 // 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
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Target)
b += 4
xgb.Put32(buf[b:], Format)
b += 4
xgb.Put32(buf[b:], Type)
b += 4
if SwapBytes {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
return buf
}
2012-05-11 05:57:34 +02:00
// GetStringCookie is a cookie used only for GetString requests.
type GetStringCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetString sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetStringCookie.Reply.
func GetString(c *xgb.Conn, ContextTag ContextTag, Name uint32) GetStringCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetString' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getStringRequest(c, ContextTag, Name), cookie)
return GetStringCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetStringUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetStringUnchecked(c *xgb.Conn, ContextTag ContextTag, Name uint32) GetStringCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetString' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getStringRequest(c, ContextTag, Name), cookie)
return GetStringCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetStringReply represents the data returned from a GetString request.
type GetStringReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
// padding: 16 bytes
String string // size: xgb.Pad((int(N) * 1))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetString request.
func (cook GetStringCookie) Reply() (*GetStringReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getStringReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getStringReply reads a byte slice into a GetStringReply value.
func getStringReply(buf []byte) *GetStringReply {
v := new(GetStringReply)
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 += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
b += 16 // padding
{
byteString := make([]byte, v.N)
copy(byteString[:v.N], buf[b:])
v.String = string(byteString)
b += int(v.N)
}
return v
}
// getStringRequest writes a GetString request to a byte slice for transfer.
func getStringRequest(c *xgb.Conn, ContextTag ContextTag, Name uint32) []byte {
size := 12
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
buf[b] = 129 // 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:], Name)
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// GetTexEnvfvCookie is a cookie used only for GetTexEnvfv requests.
type GetTexEnvfvCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetTexEnvfv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetTexEnvfvCookie.Reply.
func GetTexEnvfv(c *xgb.Conn, ContextTag ContextTag, Target, Pname uint32) GetTexEnvfvCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetTexEnvfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getTexEnvfvRequest(c, ContextTag, Target, Pname), cookie)
return GetTexEnvfvCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetTexEnvfvUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetTexEnvfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Target, Pname uint32) GetTexEnvfvCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetTexEnvfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getTexEnvfvRequest(c, ContextTag, Target, Pname), cookie)
return GetTexEnvfvCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetTexEnvfvReply represents the data returned from a GetTexEnvfv request.
type GetTexEnvfvReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum Float32
// padding: 12 bytes
Data []Float32 // size: xgb.Pad((int(N) * 4))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetTexEnvfv request.
func (cook GetTexEnvfvCookie) Reply() (*GetTexEnvfvReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getTexEnvfvReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getTexEnvfvReply reads a byte slice into a GetTexEnvfvReply value.
func getTexEnvfvReply(buf []byte) *GetTexEnvfvReply {
v := new(GetTexEnvfvReply)
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 += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
v.Datum = Float32(xgb.Get32(buf[b:]))
b += 4
b += 12 // padding
v.Data = make([]Float32, v.N)
for i := 0; i < int(v.N); i++ {
v.Data[i] = Float32(xgb.Get32(buf[b:]))
b += 4
}
return v
}
// getTexEnvfvRequest writes a GetTexEnvfv request to a byte slice for transfer.
func getTexEnvfvRequest(c *xgb.Conn, ContextTag ContextTag, Target, Pname uint32) []byte {
size := 16
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
buf[b] = 130 // 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:], Target)
b += 4
xgb.Put32(buf[b:], Pname)
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// GetTexEnvivCookie is a cookie used only for GetTexEnviv requests.
type GetTexEnvivCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetTexEnviv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetTexEnvivCookie.Reply.
func GetTexEnviv(c *xgb.Conn, ContextTag ContextTag, Target, Pname uint32) GetTexEnvivCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetTexEnviv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getTexEnvivRequest(c, ContextTag, Target, Pname), cookie)
return GetTexEnvivCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetTexEnvivUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetTexEnvivUnchecked(c *xgb.Conn, ContextTag ContextTag, Target, Pname uint32) GetTexEnvivCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetTexEnviv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getTexEnvivRequest(c, ContextTag, Target, Pname), cookie)
return GetTexEnvivCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetTexEnvivReply represents the data returned from a GetTexEnviv request.
type GetTexEnvivReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum int32
// padding: 12 bytes
Data []int32 // size: xgb.Pad((int(N) * 4))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetTexEnviv request.
func (cook GetTexEnvivCookie) Reply() (*GetTexEnvivReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getTexEnvivReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getTexEnvivReply reads a byte slice into a GetTexEnvivReply value.
func getTexEnvivReply(buf []byte) *GetTexEnvivReply {
v := new(GetTexEnvivReply)
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 += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
v.Datum = int32(xgb.Get32(buf[b:]))
b += 4
b += 12 // padding
v.Data = make([]int32, v.N)
for i := 0; i < int(v.N); i++ {
v.Data[i] = int32(xgb.Get32(buf[b:]))
b += 4
}
return v
}
// getTexEnvivRequest writes a GetTexEnviv request to a byte slice for transfer.
func getTexEnvivRequest(c *xgb.Conn, ContextTag ContextTag, Target, Pname uint32) []byte {
size := 16
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
buf[b] = 131 // 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:], Target)
b += 4
xgb.Put32(buf[b:], Pname)
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// GetTexGendvCookie is a cookie used only for GetTexGendv requests.
type GetTexGendvCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetTexGendv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetTexGendvCookie.Reply.
func GetTexGendv(c *xgb.Conn, ContextTag ContextTag, Coord, Pname uint32) GetTexGendvCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetTexGendv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getTexGendvRequest(c, ContextTag, Coord, Pname), cookie)
return GetTexGendvCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetTexGendvUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetTexGendvUnchecked(c *xgb.Conn, ContextTag ContextTag, Coord, Pname uint32) GetTexGendvCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetTexGendv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getTexGendvRequest(c, ContextTag, Coord, Pname), cookie)
return GetTexGendvCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetTexGendvReply represents the data returned from a GetTexGendv request.
type GetTexGendvReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum Float64
// padding: 8 bytes
Data []Float64 // size: xgb.Pad((int(N) * 8))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetTexGendv request.
func (cook GetTexGendvCookie) Reply() (*GetTexGendvReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getTexGendvReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getTexGendvReply reads a byte slice into a GetTexGendvReply value.
func getTexGendvReply(buf []byte) *GetTexGendvReply {
v := new(GetTexGendvReply)
b := 1 // skip reply determinant
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
2017-01-18 10:52:16 +01:00
b += 1 // padding
b += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
v.Datum = Float64(xgb.Get64(buf[b:]))
b += 8
b += 8 // padding
v.Data = make([]Float64, v.N)
for i := 0; i < int(v.N); i++ {
v.Data[i] = Float64(xgb.Get64(buf[b:]))
b += 8
}
return v
}
// getTexGendvRequest writes a GetTexGendv request to a byte slice for transfer.
func getTexGendvRequest(c *xgb.Conn, ContextTag ContextTag, Coord, Pname uint32) []byte {
size := 16
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
buf[b] = 132 // 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:], Coord)
b += 4
xgb.Put32(buf[b:], Pname)
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// GetTexGenfvCookie is a cookie used only for GetTexGenfv requests.
type GetTexGenfvCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetTexGenfv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetTexGenfvCookie.Reply.
func GetTexGenfv(c *xgb.Conn, ContextTag ContextTag, Coord, Pname uint32) GetTexGenfvCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetTexGenfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getTexGenfvRequest(c, ContextTag, Coord, Pname), cookie)
return GetTexGenfvCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetTexGenfvUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetTexGenfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Coord, Pname uint32) GetTexGenfvCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetTexGenfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getTexGenfvRequest(c, ContextTag, Coord, Pname), cookie)
return GetTexGenfvCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetTexGenfvReply represents the data returned from a GetTexGenfv request.
type GetTexGenfvReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum Float32
// padding: 12 bytes
Data []Float32 // size: xgb.Pad((int(N) * 4))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetTexGenfv request.
func (cook GetTexGenfvCookie) Reply() (*GetTexGenfvReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getTexGenfvReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getTexGenfvReply reads a byte slice into a GetTexGenfvReply value.
func getTexGenfvReply(buf []byte) *GetTexGenfvReply {
v := new(GetTexGenfvReply)
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 += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
v.Datum = Float32(xgb.Get32(buf[b:]))
b += 4
b += 12 // padding
v.Data = make([]Float32, v.N)
for i := 0; i < int(v.N); i++ {
v.Data[i] = Float32(xgb.Get32(buf[b:]))
b += 4
}
return v
}
// getTexGenfvRequest writes a GetTexGenfv request to a byte slice for transfer.
func getTexGenfvRequest(c *xgb.Conn, ContextTag ContextTag, Coord, Pname uint32) []byte {
size := 16
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
buf[b] = 133 // 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:], Coord)
b += 4
xgb.Put32(buf[b:], Pname)
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// GetTexGenivCookie is a cookie used only for GetTexGeniv requests.
type GetTexGenivCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetTexGeniv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetTexGenivCookie.Reply.
func GetTexGeniv(c *xgb.Conn, ContextTag ContextTag, Coord, Pname uint32) GetTexGenivCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetTexGeniv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getTexGenivRequest(c, ContextTag, Coord, Pname), cookie)
return GetTexGenivCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetTexGenivUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetTexGenivUnchecked(c *xgb.Conn, ContextTag ContextTag, Coord, Pname uint32) GetTexGenivCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetTexGeniv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getTexGenivRequest(c, ContextTag, Coord, Pname), cookie)
return GetTexGenivCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetTexGenivReply represents the data returned from a GetTexGeniv request.
type GetTexGenivReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum int32
// padding: 12 bytes
Data []int32 // size: xgb.Pad((int(N) * 4))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetTexGeniv request.
func (cook GetTexGenivCookie) Reply() (*GetTexGenivReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getTexGenivReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getTexGenivReply reads a byte slice into a GetTexGenivReply value.
func getTexGenivReply(buf []byte) *GetTexGenivReply {
v := new(GetTexGenivReply)
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 += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
v.Datum = int32(xgb.Get32(buf[b:]))
b += 4
b += 12 // padding
v.Data = make([]int32, v.N)
for i := 0; i < int(v.N); i++ {
v.Data[i] = int32(xgb.Get32(buf[b:]))
b += 4
}
return v
}
// getTexGenivRequest writes a GetTexGeniv request to a byte slice for transfer.
func getTexGenivRequest(c *xgb.Conn, ContextTag ContextTag, Coord, Pname uint32) []byte {
size := 16
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
buf[b] = 134 // 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:], Coord)
b += 4
xgb.Put32(buf[b:], Pname)
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// GetTexImageCookie is a cookie used only for GetTexImage requests.
type GetTexImageCookie struct {
*xgb.Cookie
2013-08-12 02:43:26 +02:00
}
// GetTexImage sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetTexImageCookie.Reply.
func GetTexImage(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32, Format, Type uint32, SwapBytes bool) GetTexImageCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetTexImage' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getTexImageRequest(c, ContextTag, Target, Level, Format, Type, SwapBytes), cookie)
return GetTexImageCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetTexImageUnchecked sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetTexImageUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32, Format, Type uint32, SwapBytes bool) GetTexImageCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetTexImage' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getTexImageRequest(c, ContextTag, Target, Level, Format, Type, SwapBytes), cookie)
return GetTexImageCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetTexImageReply represents the data returned from a GetTexImage request.
type GetTexImageReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
2013-08-12 02:43:26 +02:00
// padding: 8 bytes
Width int32
Height int32
Depth int32
// padding: 4 bytes
2013-08-12 02:43:26 +02:00
Data []byte // size: xgb.Pad(((int(Length) * 4) * 1))
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a GetTexImage request.
func (cook GetTexImageCookie) Reply() (*GetTexImageReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
2013-08-12 02:43:26 +02:00
return getTexImageReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// getTexImageReply reads a byte slice into a GetTexImageReply value.
func getTexImageReply(buf []byte) *GetTexImageReply {
v := new(GetTexImageReply)
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
2013-08-12 02:43:26 +02:00
b += 8 // padding
2013-08-12 02:43:26 +02:00
v.Width = int32(xgb.Get32(buf[b:]))
b += 4
2013-08-12 02:43:26 +02:00
v.Height = int32(xgb.Get32(buf[b:]))
b += 4
2013-08-12 02:43:26 +02:00
v.Depth = int32(xgb.Get32(buf[b:]))
b += 4
2013-08-12 02:43:26 +02:00
b += 4 // padding
v.Data = make([]byte, (int(v.Length) * 4))
copy(v.Data[:(int(v.Length)*4)], buf[b:])
b += int((int(v.Length) * 4))
return v
}
// getTexImageRequest writes a GetTexImage request to a byte slice for transfer.
func getTexImageRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32, Format, Type uint32, SwapBytes bool) []byte {
2013-08-12 02:43:26 +02:00
size := 28
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 135 // 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:], Target)
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(Level))
b += 4
xgb.Put32(buf[b:], Format)
b += 4
xgb.Put32(buf[b:], Type)
b += 4
2013-08-12 02:43:26 +02:00
if SwapBytes {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
return buf
}
2012-05-11 05:57:34 +02:00
// GetTexLevelParameterfvCookie is a cookie used only for GetTexLevelParameterfv requests.
type GetTexLevelParameterfvCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetTexLevelParameterfv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetTexLevelParameterfvCookie.Reply.
func GetTexLevelParameterfv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32, Pname uint32) GetTexLevelParameterfvCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetTexLevelParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getTexLevelParameterfvRequest(c, ContextTag, Target, Level, Pname), cookie)
return GetTexLevelParameterfvCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetTexLevelParameterfvUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetTexLevelParameterfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32, Pname uint32) GetTexLevelParameterfvCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetTexLevelParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getTexLevelParameterfvRequest(c, ContextTag, Target, Level, Pname), cookie)
return GetTexLevelParameterfvCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetTexLevelParameterfvReply represents the data returned from a GetTexLevelParameterfv request.
type GetTexLevelParameterfvReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum Float32
// padding: 12 bytes
Data []Float32 // size: xgb.Pad((int(N) * 4))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetTexLevelParameterfv request.
func (cook GetTexLevelParameterfvCookie) Reply() (*GetTexLevelParameterfvReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getTexLevelParameterfvReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getTexLevelParameterfvReply reads a byte slice into a GetTexLevelParameterfvReply value.
func getTexLevelParameterfvReply(buf []byte) *GetTexLevelParameterfvReply {
v := new(GetTexLevelParameterfvReply)
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 += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
v.Datum = Float32(xgb.Get32(buf[b:]))
b += 4
b += 12 // padding
v.Data = make([]Float32, v.N)
for i := 0; i < int(v.N); i++ {
v.Data[i] = Float32(xgb.Get32(buf[b:]))
b += 4
}
return v
}
// getTexLevelParameterfvRequest writes a GetTexLevelParameterfv request to a byte slice for transfer.
func getTexLevelParameterfvRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32, Pname uint32) []byte {
size := 20
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
buf[b] = 138 // 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:], Target)
b += 4
xgb.Put32(buf[b:], uint32(Level))
b += 4
xgb.Put32(buf[b:], Pname)
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// GetTexLevelParameterivCookie is a cookie used only for GetTexLevelParameteriv requests.
type GetTexLevelParameterivCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetTexLevelParameteriv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetTexLevelParameterivCookie.Reply.
func GetTexLevelParameteriv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32, Pname uint32) GetTexLevelParameterivCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetTexLevelParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getTexLevelParameterivRequest(c, ContextTag, Target, Level, Pname), cookie)
return GetTexLevelParameterivCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetTexLevelParameterivUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetTexLevelParameterivUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32, Pname uint32) GetTexLevelParameterivCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetTexLevelParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getTexLevelParameterivRequest(c, ContextTag, Target, Level, Pname), cookie)
return GetTexLevelParameterivCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetTexLevelParameterivReply represents the data returned from a GetTexLevelParameteriv request.
type GetTexLevelParameterivReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum int32
// padding: 12 bytes
Data []int32 // size: xgb.Pad((int(N) * 4))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetTexLevelParameteriv request.
func (cook GetTexLevelParameterivCookie) Reply() (*GetTexLevelParameterivReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getTexLevelParameterivReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getTexLevelParameterivReply reads a byte slice into a GetTexLevelParameterivReply value.
func getTexLevelParameterivReply(buf []byte) *GetTexLevelParameterivReply {
v := new(GetTexLevelParameterivReply)
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 += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
v.Datum = int32(xgb.Get32(buf[b:]))
b += 4
b += 12 // padding
v.Data = make([]int32, v.N)
for i := 0; i < int(v.N); i++ {
v.Data[i] = int32(xgb.Get32(buf[b:]))
b += 4
}
return v
}
// getTexLevelParameterivRequest writes a GetTexLevelParameteriv request to a byte slice for transfer.
func getTexLevelParameterivRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32, Pname uint32) []byte {
size := 20
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
buf[b] = 139 // 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:], Target)
b += 4
xgb.Put32(buf[b:], uint32(Level))
b += 4
xgb.Put32(buf[b:], Pname)
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// GetTexParameterfvCookie is a cookie used only for GetTexParameterfv requests.
type GetTexParameterfvCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// GetTexParameterfv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetTexParameterfvCookie.Reply.
func GetTexParameterfv(c *xgb.Conn, ContextTag ContextTag, Target, Pname uint32) GetTexParameterfvCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetTexParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getTexParameterfvRequest(c, ContextTag, Target, Pname), cookie)
return GetTexParameterfvCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetTexParameterfvUnchecked sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetTexParameterfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Target, Pname uint32) GetTexParameterfvCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetTexParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getTexParameterfvRequest(c, ContextTag, Target, Pname), cookie)
return GetTexParameterfvCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetTexParameterfvReply represents the data returned from a GetTexParameterfv request.
type GetTexParameterfvReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
2013-08-12 02:43:26 +02:00
// padding: 4 bytes
N uint32
Datum Float32
// padding: 12 bytes
Data []Float32 // size: xgb.Pad((int(N) * 4))
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a GetTexParameterfv request.
func (cook GetTexParameterfvCookie) Reply() (*GetTexParameterfvReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
2013-08-12 02:43:26 +02:00
return getTexParameterfvReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// getTexParameterfvReply reads a byte slice into a GetTexParameterfvReply value.
func getTexParameterfvReply(buf []byte) *GetTexParameterfvReply {
v := new(GetTexParameterfvReply)
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
2013-08-12 02:43:26 +02:00
b += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
2013-08-12 02:43:26 +02:00
v.Datum = Float32(xgb.Get32(buf[b:]))
b += 4
2013-08-12 02:43:26 +02:00
b += 12 // padding
v.Data = make([]Float32, v.N)
for i := 0; i < int(v.N); i++ {
v.Data[i] = Float32(xgb.Get32(buf[b:]))
b += 4
}
return v
}
// getTexParameterfvRequest writes a GetTexParameterfv request to a byte slice for transfer.
func getTexParameterfvRequest(c *xgb.Conn, ContextTag ContextTag, Target, Pname uint32) []byte {
2013-08-12 02:43:26 +02:00
size := 16
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 136 // 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
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Target)
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Pname)
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// GetTexParameterivCookie is a cookie used only for GetTexParameteriv requests.
type GetTexParameterivCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// GetTexParameteriv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetTexParameterivCookie.Reply.
func GetTexParameteriv(c *xgb.Conn, ContextTag ContextTag, Target, Pname uint32) GetTexParameterivCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetTexParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-12 02:43:26 +02:00
cookie := c.NewCookie(true, true)
c.NewRequest(getTexParameterivRequest(c, ContextTag, Target, Pname), cookie)
return GetTexParameterivCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetTexParameterivUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetTexParameterivUnchecked(c *xgb.Conn, ContextTag ContextTag, Target, Pname uint32) GetTexParameterivCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetTexParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-12 02:43:26 +02:00
cookie := c.NewCookie(false, true)
c.NewRequest(getTexParameterivRequest(c, ContextTag, Target, Pname), cookie)
return GetTexParameterivCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetTexParameterivReply represents the data returned from a GetTexParameteriv request.
type GetTexParameterivReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum int32
// padding: 12 bytes
Data []int32 // size: xgb.Pad((int(N) * 4))
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a GetTexParameteriv request.
func (cook GetTexParameterivCookie) Reply() (*GetTexParameterivReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getTexParameterivReply(buf), nil
}
// getTexParameterivReply reads a byte slice into a GetTexParameterivReply value.
func getTexParameterivReply(buf []byte) *GetTexParameterivReply {
v := new(GetTexParameterivReply)
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 += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
v.Datum = int32(xgb.Get32(buf[b:]))
b += 4
b += 12 // padding
v.Data = make([]int32, v.N)
for i := 0; i < int(v.N); i++ {
v.Data[i] = int32(xgb.Get32(buf[b:]))
b += 4
}
return v
}
// getTexParameterivRequest writes a GetTexParameteriv request to a byte slice for transfer.
func getTexParameterivRequest(c *xgb.Conn, ContextTag ContextTag, Target, Pname uint32) []byte {
2013-08-12 02:43:26 +02:00
size := 16
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 137 // 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
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Target)
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Pname)
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// GetVisualConfigsCookie is a cookie used only for GetVisualConfigs requests.
type GetVisualConfigsCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// GetVisualConfigs sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetVisualConfigsCookie.Reply.
2013-08-12 02:43:26 +02:00
func GetVisualConfigs(c *xgb.Conn, Screen uint32) GetVisualConfigsCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetVisualConfigs' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getVisualConfigsRequest(c, Screen), cookie)
return GetVisualConfigsCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetVisualConfigsUnchecked sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2013-08-12 02:43:26 +02:00
func GetVisualConfigsUnchecked(c *xgb.Conn, Screen uint32) GetVisualConfigsCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'GetVisualConfigs' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(getVisualConfigsRequest(c, Screen), cookie)
return GetVisualConfigsCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// GetVisualConfigsReply represents the data returned from a GetVisualConfigs request.
type GetVisualConfigsReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
2013-08-12 02:43:26 +02:00
NumVisuals uint32
NumProperties uint32
// padding: 16 bytes
PropertyList []uint32 // size: xgb.Pad((int(Length) * 4))
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a GetVisualConfigs request.
func (cook GetVisualConfigsCookie) Reply() (*GetVisualConfigsReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
2013-08-12 02:43:26 +02:00
return getVisualConfigsReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// getVisualConfigsReply reads a byte slice into a GetVisualConfigsReply value.
func getVisualConfigsReply(buf []byte) *GetVisualConfigsReply {
v := new(GetVisualConfigsReply)
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
2013-08-12 02:43:26 +02:00
v.NumVisuals = xgb.Get32(buf[b:])
b += 4
2013-08-12 02:43:26 +02:00
v.NumProperties = xgb.Get32(buf[b:])
b += 4
b += 16 // padding
v.PropertyList = make([]uint32, v.Length)
for i := 0; i < int(v.Length); i++ {
2013-08-12 02:43:26 +02:00
v.PropertyList[i] = xgb.Get32(buf[b:])
b += 4
}
return v
}
// getVisualConfigsRequest writes a GetVisualConfigs request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func getVisualConfigsRequest(c *xgb.Conn, Screen uint32) []byte {
size := 8
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 14 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Screen)
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// IsDirectCookie is a cookie used only for IsDirect requests.
type IsDirectCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// IsDirect sends a checked request.
// If an error occurs, it will be returned with the reply by calling IsDirectCookie.Reply.
2013-08-12 02:43:26 +02:00
func IsDirect(c *xgb.Conn, Context Context) IsDirectCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'IsDirect' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(isDirectRequest(c, Context), cookie)
return IsDirectCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// IsDirectUnchecked sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2013-08-12 02:43:26 +02:00
func IsDirectUnchecked(c *xgb.Conn, Context Context) IsDirectCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'IsDirect' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(isDirectRequest(c, Context), cookie)
return IsDirectCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// IsDirectReply represents the data returned from a IsDirect request.
type IsDirectReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
2013-08-12 02:43:26 +02:00
IsDirect bool
// padding: 23 bytes
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a IsDirect request.
func (cook IsDirectCookie) Reply() (*IsDirectReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
2013-08-12 02:43:26 +02:00
return isDirectReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// isDirectReply reads a byte slice into a IsDirectReply value.
func isDirectReply(buf []byte) *IsDirectReply {
v := new(IsDirectReply)
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
2013-08-12 02:43:26 +02:00
if buf[b] == 1 {
v.IsDirect = true
} else {
v.IsDirect = false
}
b += 1
b += 23 // padding
return v
}
// isDirectRequest writes a IsDirect request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func isDirectRequest(c *xgb.Conn, Context Context) []byte {
size := 8
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 6 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(Context))
b += 4
return buf
}
2017-01-18 10:52:16 +01:00
// 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.
2017-01-18 10:52:16 +01:00
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
}
// isEnabledRequest writes a IsEnabled request to a byte slice for transfer.
2017-01-18 10:52:16 +01:00
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
}
2013-08-12 02:43:26 +02:00
// IsListCookie is a cookie used only for IsList requests.
type IsListCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// IsList sends a checked request.
// If an error occurs, it will be returned with the reply by calling IsListCookie.Reply.
2013-08-12 02:43:26 +02:00
func IsList(c *xgb.Conn, ContextTag ContextTag, List uint32) IsListCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'IsList' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(isListRequest(c, ContextTag, List), cookie)
return IsListCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// IsListUnchecked sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2013-08-12 02:43:26 +02:00
func IsListUnchecked(c *xgb.Conn, ContextTag ContextTag, List uint32) IsListCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'IsList' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(isListRequest(c, ContextTag, List), cookie)
return IsListCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// IsListReply represents the data returned from a IsList request.
type IsListReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
2013-08-12 02:43:26 +02:00
RetVal Bool32
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a IsList request.
func (cook IsListCookie) Reply() (*IsListReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
2013-08-12 02:43:26 +02:00
return isListReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// isListReply reads a byte slice into a IsListReply value.
func isListReply(buf []byte) *IsListReply {
v := new(IsListReply)
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
2013-08-12 02:43:26 +02:00
v.RetVal = Bool32(xgb.Get32(buf[b:]))
b += 4
return v
}
// isListRequest writes a IsList request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func isListRequest(c *xgb.Conn, ContextTag ContextTag, List uint32) []byte {
size := 12
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 141 // 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
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], List)
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// IsQueryARBCookie is a cookie used only for IsQueryARB requests.
type IsQueryARBCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// IsQueryARB sends a checked request.
// If an error occurs, it will be returned with the reply by calling IsQueryARBCookie.Reply.
2013-08-12 02:43:26 +02:00
func IsQueryARB(c *xgb.Conn, ContextTag ContextTag, Id uint32) IsQueryARBCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'IsQueryARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(isQueryARBRequest(c, ContextTag, Id), cookie)
return IsQueryARBCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// IsQueryARBUnchecked sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2013-08-12 02:43:26 +02:00
func IsQueryARBUnchecked(c *xgb.Conn, ContextTag ContextTag, Id uint32) IsQueryARBCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'IsQueryARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(isQueryARBRequest(c, ContextTag, Id), cookie)
return IsQueryARBCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// IsQueryARBReply represents the data returned from a IsQueryARB request.
type IsQueryARBReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
2013-08-12 02:43:26 +02:00
RetVal Bool32
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a IsQueryARB request.
func (cook IsQueryARBCookie) Reply() (*IsQueryARBReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
2013-08-12 02:43:26 +02:00
return isQueryARBReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// isQueryARBReply reads a byte slice into a IsQueryARBReply value.
func isQueryARBReply(buf []byte) *IsQueryARBReply {
v := new(IsQueryARBReply)
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
2013-08-12 02:43:26 +02:00
v.RetVal = Bool32(xgb.Get32(buf[b:]))
b += 4
return v
}
// isQueryARBRequest writes a IsQueryARB request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func isQueryARBRequest(c *xgb.Conn, ContextTag ContextTag, Id uint32) []byte {
size := 12
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 163 // 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
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Id)
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// IsTextureCookie is a cookie used only for IsTexture requests.
type IsTextureCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// IsTexture sends a checked request.
// If an error occurs, it will be returned with the reply by calling IsTextureCookie.Reply.
2013-08-12 02:43:26 +02:00
func IsTexture(c *xgb.Conn, ContextTag ContextTag, Texture uint32) IsTextureCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'IsTexture' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(isTextureRequest(c, ContextTag, Texture), cookie)
return IsTextureCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// IsTextureUnchecked sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2013-08-12 02:43:26 +02:00
func IsTextureUnchecked(c *xgb.Conn, ContextTag ContextTag, Texture uint32) IsTextureCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'IsTexture' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-12 02:43:26 +02:00
cookie := c.NewCookie(false, true)
c.NewRequest(isTextureRequest(c, ContextTag, Texture), cookie)
return IsTextureCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// IsTextureReply represents the data returned from a IsTexture request.
type IsTextureReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
2013-08-12 02:43:26 +02:00
RetVal Bool32
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a IsTexture request.
func (cook IsTextureCookie) Reply() (*IsTextureReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
2013-08-12 02:43:26 +02:00
return isTextureReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// isTextureReply reads a byte slice into a IsTextureReply value.
func isTextureReply(buf []byte) *IsTextureReply {
v := new(IsTextureReply)
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
2013-08-12 02:43:26 +02:00
v.RetVal = Bool32(xgb.Get32(buf[b:]))
b += 4
return v
}
// isTextureRequest writes a IsTexture request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func isTextureRequest(c *xgb.Conn, ContextTag ContextTag, Texture uint32) []byte {
size := 12
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 146 // 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
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Texture)
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// MakeContextCurrentCookie is a cookie used only for MakeContextCurrent requests.
type MakeContextCurrentCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// MakeContextCurrent sends a checked request.
// If an error occurs, it will be returned with the reply by calling MakeContextCurrentCookie.Reply.
func MakeContextCurrent(c *xgb.Conn, OldContextTag ContextTag, Drawable, ReadDrawable Drawable, Context Context) MakeContextCurrentCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'MakeContextCurrent' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(makeContextCurrentRequest(c, OldContextTag, Drawable, ReadDrawable, Context), cookie)
return MakeContextCurrentCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// MakeContextCurrentUnchecked sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func MakeContextCurrentUnchecked(c *xgb.Conn, OldContextTag ContextTag, Drawable, ReadDrawable Drawable, Context Context) MakeContextCurrentCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'MakeContextCurrent' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(makeContextCurrentRequest(c, OldContextTag, Drawable, ReadDrawable, Context), cookie)
return MakeContextCurrentCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// MakeContextCurrentReply represents the data returned from a MakeContextCurrent request.
type MakeContextCurrentReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
2013-08-12 02:43:26 +02:00
ContextTag ContextTag
// padding: 20 bytes
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a MakeContextCurrent request.
func (cook MakeContextCurrentCookie) Reply() (*MakeContextCurrentReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
2013-08-12 02:43:26 +02:00
return makeContextCurrentReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// makeContextCurrentReply reads a byte slice into a MakeContextCurrentReply value.
func makeContextCurrentReply(buf []byte) *MakeContextCurrentReply {
v := new(MakeContextCurrentReply)
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
2013-08-12 02:43:26 +02:00
v.ContextTag = ContextTag(xgb.Get32(buf[b:]))
b += 4
2013-08-12 02:43:26 +02:00
b += 20 // padding
return v
}
// makeContextCurrentRequest writes a MakeContextCurrent request to a byte slice for transfer.
func makeContextCurrentRequest(c *xgb.Conn, OldContextTag ContextTag, Drawable, ReadDrawable Drawable, Context Context) []byte {
2013-08-12 02:43:26 +02:00
size := 20
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 26 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(OldContextTag))
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(Drawable))
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(ReadDrawable))
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(Context))
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// MakeCurrentCookie is a cookie used only for MakeCurrent requests.
type MakeCurrentCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// MakeCurrent sends a checked request.
// If an error occurs, it will be returned with the reply by calling MakeCurrentCookie.Reply.
2013-08-12 02:43:26 +02:00
func MakeCurrent(c *xgb.Conn, Drawable Drawable, Context Context, OldContextTag ContextTag) MakeCurrentCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'MakeCurrent' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(makeCurrentRequest(c, Drawable, Context, OldContextTag), cookie)
return MakeCurrentCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// MakeCurrentUnchecked sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2013-08-12 02:43:26 +02:00
func MakeCurrentUnchecked(c *xgb.Conn, Drawable Drawable, Context Context, OldContextTag ContextTag) MakeCurrentCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'MakeCurrent' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(makeCurrentRequest(c, Drawable, Context, OldContextTag), cookie)
return MakeCurrentCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// MakeCurrentReply represents the data returned from a MakeCurrent request.
type MakeCurrentReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
2013-08-12 02:43:26 +02:00
ContextTag ContextTag
// padding: 20 bytes
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a MakeCurrent request.
func (cook MakeCurrentCookie) Reply() (*MakeCurrentReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
2013-08-12 02:43:26 +02:00
return makeCurrentReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// makeCurrentReply reads a byte slice into a MakeCurrentReply value.
func makeCurrentReply(buf []byte) *MakeCurrentReply {
v := new(MakeCurrentReply)
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
2013-08-12 02:43:26 +02:00
v.ContextTag = ContextTag(xgb.Get32(buf[b:]))
b += 4
2013-08-12 02:43:26 +02:00
b += 20 // padding
return v
}
// makeCurrentRequest writes a MakeCurrent request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func makeCurrentRequest(c *xgb.Conn, Drawable Drawable, Context Context, OldContextTag ContextTag) []byte {
size := 16
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
2013-08-12 02:43:26 +02:00
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
2013-08-12 02:43:26 +02:00
b += 1
buf[b] = 5 // 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(Drawable))
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(Context))
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(OldContextTag))
b += 4
2013-08-12 02:43:26 +02:00
return buf
}
// NewListCookie is a cookie used only for NewList requests.
type NewListCookie struct {
*xgb.Cookie
}
// NewList sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func NewList(c *xgb.Conn, ContextTag ContextTag, List, Mode uint32) NewListCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
2013-08-12 02:43:26 +02:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'NewList' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-12 02:43:26 +02:00
cookie := c.NewCookie(false, false)
c.NewRequest(newListRequest(c, ContextTag, List, Mode), cookie)
return NewListCookie{cookie}
}
// NewListChecked sends a checked request.
// If an error occurs, it can be retrieved using NewListCookie.Check.
func NewListChecked(c *xgb.Conn, ContextTag ContextTag, List, Mode uint32) NewListCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
2013-08-12 02:43:26 +02:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'NewList' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(newListRequest(c, ContextTag, List, Mode), cookie)
return NewListCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook NewListCookie) Check() error {
return cook.Cookie.Check()
}
// newListRequest writes a NewList request to a byte slice for transfer.
func newListRequest(c *xgb.Conn, ContextTag ContextTag, List, Mode uint32) []byte {
size := 16
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 101 // 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
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], List)
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Mode)
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// PixelStorefCookie is a cookie used only for PixelStoref requests.
type PixelStorefCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// PixelStoref sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func PixelStoref(c *xgb.Conn, ContextTag ContextTag, Pname uint32, Datum Float32) PixelStorefCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'PixelStoref' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-12 02:43:26 +02:00
cookie := c.NewCookie(false, false)
c.NewRequest(pixelStorefRequest(c, ContextTag, Pname, Datum), cookie)
return PixelStorefCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// PixelStorefChecked sends a checked request.
// If an error occurs, it can be retrieved using PixelStorefCookie.Check.
2013-08-12 02:43:26 +02:00
func PixelStorefChecked(c *xgb.Conn, ContextTag ContextTag, Pname uint32, Datum Float32) PixelStorefCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'PixelStoref' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-12 02:43:26 +02:00
cookie := c.NewCookie(true, false)
c.NewRequest(pixelStorefRequest(c, ContextTag, Pname, Datum), cookie)
return PixelStorefCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook PixelStorefCookie) Check() error {
return cook.Cookie.Check()
}
// pixelStorefRequest writes a PixelStoref request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func pixelStorefRequest(c *xgb.Conn, ContextTag ContextTag, Pname uint32, Datum Float32) []byte {
size := 16
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
2013-08-12 02:43:26 +02:00
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
2013-08-12 02:43:26 +02:00
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 109 // request opcode
b += 1
2013-08-12 02:43:26 +02:00
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Pname)
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(Datum))
b += 4
2013-08-12 02:43:26 +02:00
return buf
}
2013-08-12 02:43:26 +02:00
// PixelStoreiCookie is a cookie used only for PixelStorei requests.
type PixelStoreiCookie struct {
*xgb.Cookie
}
// PixelStorei sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func PixelStorei(c *xgb.Conn, ContextTag ContextTag, Pname uint32, Datum int32) PixelStoreiCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
2013-08-12 02:43:26 +02:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'PixelStorei' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-12 02:43:26 +02:00
cookie := c.NewCookie(false, false)
c.NewRequest(pixelStoreiRequest(c, ContextTag, Pname, Datum), cookie)
return PixelStoreiCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// PixelStoreiChecked sends a checked request.
// If an error occurs, it can be retrieved using PixelStoreiCookie.Check.
2013-08-12 02:43:26 +02:00
func PixelStoreiChecked(c *xgb.Conn, ContextTag ContextTag, Pname uint32, Datum int32) PixelStoreiCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
2013-08-12 02:43:26 +02:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'PixelStorei' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(pixelStoreiRequest(c, ContextTag, Pname, Datum), cookie)
return PixelStoreiCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook PixelStoreiCookie) Check() error {
return cook.Cookie.Check()
}
// pixelStoreiRequest writes a PixelStorei request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func pixelStoreiRequest(c *xgb.Conn, ContextTag ContextTag, Pname uint32, Datum int32) []byte {
size := 16
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 110 // 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
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Pname)
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(Datum))
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// QueryContextCookie is a cookie used only for QueryContext requests.
type QueryContextCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// QueryContext sends a checked request.
// If an error occurs, it will be returned with the reply by calling QueryContextCookie.Reply.
2013-08-12 02:43:26 +02:00
func QueryContext(c *xgb.Conn, Context Context) QueryContextCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'QueryContext' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(queryContextRequest(c, Context), cookie)
return QueryContextCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// QueryContextUnchecked sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2013-08-12 02:43:26 +02:00
func QueryContextUnchecked(c *xgb.Conn, Context Context) QueryContextCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'QueryContext' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(queryContextRequest(c, Context), cookie)
return QueryContextCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// QueryContextReply represents the data returned from a QueryContext request.
type QueryContextReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
2013-08-12 02:43:26 +02:00
NumAttribs uint32
// padding: 20 bytes
Attribs []uint32 // size: xgb.Pad(((int(NumAttribs) * 2) * 4))
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a QueryContext request.
func (cook QueryContextCookie) Reply() (*QueryContextReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
2013-08-12 02:43:26 +02:00
return queryContextReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// queryContextReply reads a byte slice into a QueryContextReply value.
func queryContextReply(buf []byte) *QueryContextReply {
v := new(QueryContextReply)
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
2013-08-12 02:43:26 +02:00
v.NumAttribs = xgb.Get32(buf[b:])
b += 4
2013-08-12 02:43:26 +02:00
b += 20 // padding
2013-08-12 02:43:26 +02:00
v.Attribs = make([]uint32, (int(v.NumAttribs) * 2))
for i := 0; i < int((int(v.NumAttribs) * 2)); i++ {
v.Attribs[i] = xgb.Get32(buf[b:])
b += 4
}
return v
}
// queryContextRequest writes a QueryContext request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func queryContextRequest(c *xgb.Conn, Context Context) []byte {
size := 8
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 25 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(Context))
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// QueryExtensionsStringCookie is a cookie used only for QueryExtensionsString requests.
type QueryExtensionsStringCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// QueryExtensionsString sends a checked request.
// If an error occurs, it will be returned with the reply by calling QueryExtensionsStringCookie.Reply.
2013-08-12 02:43:26 +02:00
func QueryExtensionsString(c *xgb.Conn, Screen uint32) QueryExtensionsStringCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'QueryExtensionsString' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(queryExtensionsStringRequest(c, Screen), cookie)
return QueryExtensionsStringCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// QueryExtensionsStringUnchecked sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2013-08-12 02:43:26 +02:00
func QueryExtensionsStringUnchecked(c *xgb.Conn, Screen uint32) QueryExtensionsStringCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'QueryExtensionsString' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(queryExtensionsStringRequest(c, Screen), cookie)
return QueryExtensionsStringCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// QueryExtensionsStringReply represents the data returned from a QueryExtensionsString request.
type QueryExtensionsStringReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
2013-08-12 02:43:26 +02:00
// padding: 4 bytes
N uint32
// padding: 16 bytes
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a QueryExtensionsString request.
func (cook QueryExtensionsStringCookie) Reply() (*QueryExtensionsStringReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
2013-08-12 02:43:26 +02:00
return queryExtensionsStringReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// queryExtensionsStringReply reads a byte slice into a QueryExtensionsStringReply value.
func queryExtensionsStringReply(buf []byte) *QueryExtensionsStringReply {
v := new(QueryExtensionsStringReply)
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
2013-08-12 02:43:26 +02:00
b += 4 // padding
2013-08-12 02:43:26 +02:00
v.N = xgb.Get32(buf[b:])
b += 4
2013-08-12 02:43:26 +02:00
b += 16 // padding
return v
}
// queryExtensionsStringRequest writes a QueryExtensionsString request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func queryExtensionsStringRequest(c *xgb.Conn, Screen uint32) []byte {
size := 8
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 18 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Screen)
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// QueryServerStringCookie is a cookie used only for QueryServerString requests.
type QueryServerStringCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// QueryServerString sends a checked request.
// If an error occurs, it will be returned with the reply by calling QueryServerStringCookie.Reply.
func QueryServerString(c *xgb.Conn, Screen, Name uint32) QueryServerStringCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'QueryServerString' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(queryServerStringRequest(c, Screen, Name), cookie)
return QueryServerStringCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// QueryServerStringUnchecked sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func QueryServerStringUnchecked(c *xgb.Conn, Screen, Name uint32) QueryServerStringCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'QueryServerString' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(queryServerStringRequest(c, Screen, Name), cookie)
return QueryServerStringCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// QueryServerStringReply represents the data returned from a QueryServerString request.
type QueryServerStringReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
2013-08-12 02:43:26 +02:00
StrLen uint32
// padding: 16 bytes
String string // size: xgb.Pad((int(StrLen) * 1))
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a QueryServerString request.
func (cook QueryServerStringCookie) Reply() (*QueryServerStringReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
2013-08-12 02:43:26 +02:00
return queryServerStringReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// queryServerStringReply reads a byte slice into a QueryServerStringReply value.
func queryServerStringReply(buf []byte) *QueryServerStringReply {
v := new(QueryServerStringReply)
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 += 4 // padding
2013-08-12 02:43:26 +02:00
v.StrLen = xgb.Get32(buf[b:])
b += 4
2013-08-12 02:43:26 +02:00
b += 16 // padding
2013-08-12 02:43:26 +02:00
{
byteString := make([]byte, v.StrLen)
copy(byteString[:v.StrLen], buf[b:])
v.String = string(byteString)
b += int(v.StrLen)
}
return v
}
// queryServerStringRequest writes a QueryServerString request to a byte slice for transfer.
func queryServerStringRequest(c *xgb.Conn, Screen, Name uint32) []byte {
2013-08-12 02:43:26 +02:00
size := 12
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 19 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Screen)
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Name)
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// QueryVersionCookie is a cookie used only for QueryVersion requests.
type QueryVersionCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// QueryVersion sends a checked request.
// If an error occurs, it will be returned with the reply by calling QueryVersionCookie.Reply.
func QueryVersion(c *xgb.Conn, MajorVersion, MinorVersion uint32) QueryVersionCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(queryVersionRequest(c, MajorVersion, MinorVersion), cookie)
return QueryVersionCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// QueryVersionUnchecked sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func QueryVersionUnchecked(c *xgb.Conn, MajorVersion, MinorVersion uint32) QueryVersionCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(queryVersionRequest(c, MajorVersion, MinorVersion), cookie)
return QueryVersionCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// QueryVersionReply represents the data returned from a QueryVersion request.
type QueryVersionReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
2013-08-12 02:43:26 +02:00
MajorVersion uint32
MinorVersion uint32
// padding: 16 bytes
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a QueryVersion request.
func (cook QueryVersionCookie) Reply() (*QueryVersionReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
2013-08-12 02:43:26 +02:00
return queryVersionReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// queryVersionReply reads a byte slice into a QueryVersionReply value.
func queryVersionReply(buf []byte) *QueryVersionReply {
v := new(QueryVersionReply)
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
2013-08-12 02:43:26 +02:00
v.MajorVersion = xgb.Get32(buf[b:])
b += 4
2013-08-12 02:43:26 +02:00
v.MinorVersion = xgb.Get32(buf[b:])
b += 4
2013-08-12 02:43:26 +02:00
b += 16 // padding
return v
}
// queryVersionRequest writes a QueryVersion request to a byte slice for transfer.
func queryVersionRequest(c *xgb.Conn, MajorVersion, MinorVersion uint32) []byte {
2013-08-12 02:43:26 +02:00
size := 12
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 7 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], MajorVersion)
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], MinorVersion)
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// ReadPixelsCookie is a cookie used only for ReadPixels requests.
type ReadPixelsCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// ReadPixels sends a checked request.
// If an error occurs, it will be returned with the reply by calling ReadPixelsCookie.Reply.
func ReadPixels(c *xgb.Conn, ContextTag ContextTag, X, Y, Width, Height int32, Format, Type uint32, SwapBytes, LsbFirst bool) ReadPixelsCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'ReadPixels' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(readPixelsRequest(c, ContextTag, X, Y, Width, Height, Format, Type, SwapBytes, LsbFirst), cookie)
return ReadPixelsCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// ReadPixelsUnchecked sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func ReadPixelsUnchecked(c *xgb.Conn, ContextTag ContextTag, X, Y, Width, Height int32, Format, Type uint32, SwapBytes, LsbFirst bool) ReadPixelsCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'ReadPixels' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(readPixelsRequest(c, ContextTag, X, Y, Width, Height, Format, Type, SwapBytes, LsbFirst), cookie)
return ReadPixelsCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// ReadPixelsReply represents the data returned from a ReadPixels request.
type ReadPixelsReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 24 bytes
Data []byte // size: xgb.Pad(((int(Length) * 4) * 1))
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a ReadPixels request.
func (cook ReadPixelsCookie) Reply() (*ReadPixelsReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
2013-08-12 02:43:26 +02:00
return readPixelsReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// readPixelsReply reads a byte slice into a ReadPixelsReply value.
func readPixelsReply(buf []byte) *ReadPixelsReply {
v := new(ReadPixelsReply)
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 += 24 // padding
v.Data = make([]byte, (int(v.Length) * 4))
copy(v.Data[:(int(v.Length)*4)], buf[b:])
b += int((int(v.Length) * 4))
return v
}
// readPixelsRequest writes a ReadPixels request to a byte slice for transfer.
func readPixelsRequest(c *xgb.Conn, ContextTag ContextTag, X, Y, Width, Height int32, Format, Type uint32, SwapBytes, LsbFirst bool) []byte {
2013-08-12 02:43:26 +02:00
size := 36
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 111 // 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
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(X))
b += 4
xgb.Put32(buf[b:], uint32(Y))
b += 4
xgb.Put32(buf[b:], uint32(Width))
b += 4
xgb.Put32(buf[b:], uint32(Height))
b += 4
xgb.Put32(buf[b:], Format)
b += 4
xgb.Put32(buf[b:], Type)
b += 4
if SwapBytes {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
2013-08-12 02:43:26 +02:00
if LsbFirst {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
return buf
}
2013-08-12 02:43:26 +02:00
// RenderCookie is a cookie used only for Render requests.
type RenderCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// Render sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2013-08-12 02:43:26 +02:00
func Render(c *xgb.Conn, ContextTag ContextTag, Data []byte) RenderCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'Render' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-12 02:43:26 +02:00
cookie := c.NewCookie(false, false)
c.NewRequest(renderRequest(c, ContextTag, Data), cookie)
return RenderCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// RenderChecked sends a checked request.
// If an error occurs, it can be retrieved using RenderCookie.Check.
2013-08-12 02:43:26 +02:00
func RenderChecked(c *xgb.Conn, ContextTag ContextTag, Data []byte) RenderCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
2013-08-12 02:43:26 +02:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'Render' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-12 02:43:26 +02:00
cookie := c.NewCookie(true, false)
c.NewRequest(renderRequest(c, ContextTag, Data), cookie)
return RenderCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook RenderCookie) Check() error {
return cook.Cookie.Check()
}
// renderRequest writes a Render request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func renderRequest(c *xgb.Conn, ContextTag ContextTag, Data []byte) []byte {
size := xgb.Pad((8 + xgb.Pad((len(Data) * 1))))
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 1 // 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
2013-08-12 02:43:26 +02:00
copy(buf[b:], Data[:len(Data)])
b += int(len(Data))
return buf
}
2013-08-12 02:43:26 +02:00
// RenderLargeCookie is a cookie used only for RenderLarge requests.
type RenderLargeCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// RenderLarge sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func RenderLarge(c *xgb.Conn, ContextTag ContextTag, RequestNum, RequestTotal uint16, DataLen uint32, Data []byte) RenderLargeCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'RenderLarge' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-12 02:43:26 +02:00
cookie := c.NewCookie(false, false)
c.NewRequest(renderLargeRequest(c, ContextTag, RequestNum, RequestTotal, DataLen, Data), cookie)
return RenderLargeCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// RenderLargeChecked sends a checked request.
// If an error occurs, it can be retrieved using RenderLargeCookie.Check.
func RenderLargeChecked(c *xgb.Conn, ContextTag ContextTag, RequestNum, RequestTotal uint16, DataLen uint32, Data []byte) RenderLargeCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
2013-08-12 02:43:26 +02:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'RenderLarge' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-12 02:43:26 +02:00
cookie := c.NewCookie(true, false)
c.NewRequest(renderLargeRequest(c, ContextTag, RequestNum, RequestTotal, DataLen, Data), cookie)
return RenderLargeCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook RenderLargeCookie) Check() error {
return cook.Cookie.Check()
}
// renderLargeRequest writes a RenderLarge request to a byte slice for transfer.
func renderLargeRequest(c *xgb.Conn, ContextTag ContextTag, RequestNum, RequestTotal uint16, DataLen uint32, Data []byte) []byte {
2013-08-12 02:43:26 +02:00
size := xgb.Pad((16 + xgb.Pad((int(DataLen) * 1))))
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 2 // 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
2013-08-12 02:43:26 +02:00
xgb.Put16(buf[b:], RequestNum)
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put16(buf[b:], RequestTotal)
b += 2
xgb.Put32(buf[b:], DataLen)
b += 4
2013-08-12 02:43:26 +02:00
copy(buf[b:], Data[:DataLen])
b += int(DataLen)
2013-08-12 02:43:26 +02:00
return buf
}
2013-08-12 02:43:26 +02:00
// RenderModeCookie is a cookie used only for RenderMode requests.
type RenderModeCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// RenderMode sends a checked request.
// If an error occurs, it will be returned with the reply by calling RenderModeCookie.Reply.
2013-08-12 02:43:26 +02:00
func RenderMode(c *xgb.Conn, ContextTag ContextTag, Mode uint32) RenderModeCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'RenderMode' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(renderModeRequest(c, ContextTag, Mode), cookie)
return RenderModeCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// RenderModeUnchecked sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2013-08-12 02:43:26 +02:00
func RenderModeUnchecked(c *xgb.Conn, ContextTag ContextTag, Mode uint32) RenderModeCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'RenderMode' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(renderModeRequest(c, ContextTag, Mode), cookie)
return RenderModeCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// RenderModeReply represents the data returned from a RenderMode request.
type RenderModeReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
2013-08-12 02:43:26 +02:00
RetVal uint32
N uint32
NewMode uint32
// padding: 12 bytes
2013-08-12 02:43:26 +02:00
Data []uint32 // size: xgb.Pad((int(N) * 4))
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a RenderMode request.
func (cook RenderModeCookie) Reply() (*RenderModeReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
2013-08-12 02:43:26 +02:00
return renderModeReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// renderModeReply reads a byte slice into a RenderModeReply value.
func renderModeReply(buf []byte) *RenderModeReply {
v := new(RenderModeReply)
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
2013-08-12 02:43:26 +02:00
v.RetVal = xgb.Get32(buf[b:])
b += 4
2013-08-12 02:43:26 +02:00
v.N = xgb.Get32(buf[b:])
b += 4
v.NewMode = xgb.Get32(buf[b:])
b += 4
b += 12 // padding
2013-08-12 02:43:26 +02:00
v.Data = make([]uint32, v.N)
for i := 0; i < int(v.N); i++ {
v.Data[i] = xgb.Get32(buf[b:])
b += 4
}
return v
}
// renderModeRequest writes a RenderMode request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func renderModeRequest(c *xgb.Conn, ContextTag ContextTag, Mode uint32) []byte {
size := 12
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 107 // 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
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Mode)
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// SelectBufferCookie is a cookie used only for SelectBuffer requests.
type SelectBufferCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// SelectBuffer sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2013-08-12 02:43:26 +02:00
func SelectBuffer(c *xgb.Conn, ContextTag ContextTag, Size int32) SelectBufferCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'SelectBuffer' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
2013-08-12 02:43:26 +02:00
c.NewRequest(selectBufferRequest(c, ContextTag, Size), cookie)
return SelectBufferCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// SelectBufferChecked sends a checked request.
// If an error occurs, it can be retrieved using SelectBufferCookie.Check.
2013-08-12 02:43:26 +02:00
func SelectBufferChecked(c *xgb.Conn, ContextTag ContextTag, Size int32) SelectBufferCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'SelectBuffer' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
2013-08-12 02:43:26 +02:00
c.NewRequest(selectBufferRequest(c, ContextTag, Size), cookie)
return SelectBufferCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
2013-08-12 02:43:26 +02:00
func (cook SelectBufferCookie) Check() error {
return cook.Cookie.Check()
}
// selectBufferRequest writes a SelectBuffer request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func selectBufferRequest(c *xgb.Conn, ContextTag ContextTag, Size int32) []byte {
size := 12
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 106 // 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
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(Size))
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// SetClientInfo2ARBCookie is a cookie used only for SetClientInfo2ARB requests.
type SetClientInfo2ARBCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// SetClientInfo2ARB sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func SetClientInfo2ARB(c *xgb.Conn, MajorVersion, MinorVersion, NumVersions, GlStrLen, GlxStrLen uint32, GlVersions []uint32, GlExtensionString, GlxExtensionString string) SetClientInfo2ARBCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'SetClientInfo2ARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-12 02:43:26 +02:00
cookie := c.NewCookie(false, false)
c.NewRequest(setClientInfo2ARBRequest(c, MajorVersion, MinorVersion, NumVersions, GlStrLen, GlxStrLen, GlVersions, GlExtensionString, GlxExtensionString), cookie)
return SetClientInfo2ARBCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// SetClientInfo2ARBChecked sends a checked request.
// If an error occurs, it can be retrieved using SetClientInfo2ARBCookie.Check.
func SetClientInfo2ARBChecked(c *xgb.Conn, MajorVersion, MinorVersion, NumVersions, GlStrLen, GlxStrLen uint32, GlVersions []uint32, GlExtensionString, GlxExtensionString string) SetClientInfo2ARBCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'SetClientInfo2ARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-12 02:43:26 +02:00
cookie := c.NewCookie(true, false)
c.NewRequest(setClientInfo2ARBRequest(c, MajorVersion, MinorVersion, NumVersions, GlStrLen, GlxStrLen, GlVersions, GlExtensionString, GlxExtensionString), cookie)
return SetClientInfo2ARBCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook SetClientInfo2ARBCookie) Check() error {
return cook.Cookie.Check()
}
// setClientInfo2ARBRequest writes a SetClientInfo2ARB request to a byte slice for transfer.
func setClientInfo2ARBRequest(c *xgb.Conn, MajorVersion, MinorVersion, NumVersions, GlStrLen, GlxStrLen uint32, GlVersions []uint32, GlExtensionString, GlxExtensionString string) []byte {
2013-08-12 02:43:26 +02:00
size := xgb.Pad((((24 + xgb.Pad(((int(NumVersions) * 3) * 4))) + xgb.Pad((int(GlStrLen) * 1))) + xgb.Pad((int(GlxStrLen) * 1))))
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
2013-08-12 02:43:26 +02:00
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
2013-08-12 02:43:26 +02:00
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 35 // request opcode
b += 1
2013-08-12 02:43:26 +02:00
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], MajorVersion)
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], MinorVersion)
b += 4
xgb.Put32(buf[b:], NumVersions)
b += 4
xgb.Put32(buf[b:], GlStrLen)
b += 4
xgb.Put32(buf[b:], GlxStrLen)
b += 4
for i := 0; i < int((int(NumVersions) * 3)); i++ {
xgb.Put32(buf[b:], GlVersions[i])
b += 4
}
copy(buf[b:], GlExtensionString[:GlStrLen])
b += int(GlStrLen)
2013-08-12 02:43:26 +02:00
copy(buf[b:], GlxExtensionString[:GlxStrLen])
b += int(GlxStrLen)
2013-08-12 02:43:26 +02:00
return buf
}
// SetClientInfoARBCookie is a cookie used only for SetClientInfoARB requests.
type SetClientInfoARBCookie struct {
*xgb.Cookie
}
// SetClientInfoARB sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func SetClientInfoARB(c *xgb.Conn, MajorVersion, MinorVersion, NumVersions, GlStrLen, GlxStrLen uint32, GlVersions []uint32, GlExtensionString, GlxExtensionString string) SetClientInfoARBCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
2013-08-12 02:43:26 +02:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'SetClientInfoARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(setClientInfoARBRequest(c, MajorVersion, MinorVersion, NumVersions, GlStrLen, GlxStrLen, GlVersions, GlExtensionString, GlxExtensionString), cookie)
return SetClientInfoARBCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// SetClientInfoARBChecked sends a checked request.
// If an error occurs, it can be retrieved using SetClientInfoARBCookie.Check.
func SetClientInfoARBChecked(c *xgb.Conn, MajorVersion, MinorVersion, NumVersions, GlStrLen, GlxStrLen uint32, GlVersions []uint32, GlExtensionString, GlxExtensionString string) SetClientInfoARBCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
2013-08-12 02:43:26 +02:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'SetClientInfoARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-12 02:43:26 +02:00
cookie := c.NewCookie(true, false)
c.NewRequest(setClientInfoARBRequest(c, MajorVersion, MinorVersion, NumVersions, GlStrLen, GlxStrLen, GlVersions, GlExtensionString, GlxExtensionString), cookie)
return SetClientInfoARBCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook SetClientInfoARBCookie) Check() error {
return cook.Cookie.Check()
}
// setClientInfoARBRequest writes a SetClientInfoARB request to a byte slice for transfer.
func setClientInfoARBRequest(c *xgb.Conn, MajorVersion, MinorVersion, NumVersions, GlStrLen, GlxStrLen uint32, GlVersions []uint32, GlExtensionString, GlxExtensionString string) []byte {
2013-08-12 02:43:26 +02:00
size := xgb.Pad((((24 + xgb.Pad(((int(NumVersions) * 2) * 4))) + xgb.Pad((int(GlStrLen) * 1))) + xgb.Pad((int(GlxStrLen) * 1))))
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 33 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], MajorVersion)
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], MinorVersion)
b += 4
xgb.Put32(buf[b:], NumVersions)
b += 4
xgb.Put32(buf[b:], GlStrLen)
b += 4
xgb.Put32(buf[b:], GlxStrLen)
b += 4
2013-08-12 02:43:26 +02:00
for i := 0; i < int((int(NumVersions) * 2)); i++ {
xgb.Put32(buf[b:], GlVersions[i])
b += 4
}
copy(buf[b:], GlExtensionString[:GlStrLen])
b += int(GlStrLen)
2013-08-12 02:43:26 +02:00
copy(buf[b:], GlxExtensionString[:GlxStrLen])
b += int(GlxStrLen)
2013-08-12 02:43:26 +02:00
return buf
}
2013-08-12 02:43:26 +02:00
// SwapBuffersCookie is a cookie used only for SwapBuffers requests.
type SwapBuffersCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// SwapBuffers sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2013-08-12 02:43:26 +02:00
func SwapBuffers(c *xgb.Conn, ContextTag ContextTag, Drawable Drawable) SwapBuffersCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'SwapBuffers' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-12 02:43:26 +02:00
cookie := c.NewCookie(false, false)
c.NewRequest(swapBuffersRequest(c, ContextTag, Drawable), cookie)
return SwapBuffersCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// SwapBuffersChecked sends a checked request.
// If an error occurs, it can be retrieved using SwapBuffersCookie.Check.
2013-08-12 02:43:26 +02:00
func SwapBuffersChecked(c *xgb.Conn, ContextTag ContextTag, Drawable Drawable) SwapBuffersCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
2013-08-12 02:43:26 +02:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'SwapBuffers' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-12 02:43:26 +02:00
cookie := c.NewCookie(true, false)
c.NewRequest(swapBuffersRequest(c, ContextTag, Drawable), cookie)
return SwapBuffersCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook SwapBuffersCookie) Check() error {
return cook.Cookie.Check()
}
// swapBuffersRequest writes a SwapBuffers request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func swapBuffersRequest(c *xgb.Conn, ContextTag ContextTag, Drawable Drawable) []byte {
size := 12
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 11 // 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
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(Drawable))
b += 4
return buf
}
2013-08-12 02:43:26 +02:00
// UseXFontCookie is a cookie used only for UseXFont requests.
type UseXFontCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// UseXFont sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func UseXFont(c *xgb.Conn, ContextTag ContextTag, Font xproto.Font, First, Count, ListBase uint32) UseXFontCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'UseXFont' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-12 02:43:26 +02:00
cookie := c.NewCookie(false, false)
c.NewRequest(useXFontRequest(c, ContextTag, Font, First, Count, ListBase), cookie)
return UseXFontCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// UseXFontChecked sends a checked request.
// If an error occurs, it can be retrieved using UseXFontCookie.Check.
func UseXFontChecked(c *xgb.Conn, ContextTag ContextTag, Font xproto.Font, First, Count, ListBase uint32) UseXFontCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'UseXFont' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-12 02:43:26 +02:00
cookie := c.NewCookie(true, false)
c.NewRequest(useXFontRequest(c, ContextTag, Font, First, Count, ListBase), cookie)
return UseXFontCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook UseXFontCookie) Check() error {
return cook.Cookie.Check()
}
// useXFontRequest writes a UseXFont request to a byte slice for transfer.
func useXFontRequest(c *xgb.Conn, ContextTag ContextTag, Font xproto.Font, First, Count, ListBase uint32) []byte {
2013-08-12 02:43:26 +02:00
size := 24
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
2013-08-12 02:43:26 +02:00
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
2013-08-12 02:43:26 +02:00
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 12 // request opcode
b += 1
2013-08-12 02:43:26 +02:00
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(Font))
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], First)
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], Count)
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], ListBase)
b += 4
2013-08-12 02:43:26 +02:00
return buf
}
// VendorPrivateCookie is a cookie used only for VendorPrivate requests.
type VendorPrivateCookie struct {
*xgb.Cookie
}
// VendorPrivate sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func VendorPrivate(c *xgb.Conn, VendorCode uint32, ContextTag ContextTag, Data []byte) VendorPrivateCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
2013-08-12 02:43:26 +02:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'VendorPrivate' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(vendorPrivateRequest(c, VendorCode, ContextTag, Data), cookie)
return VendorPrivateCookie{cookie}
}
// VendorPrivateChecked sends a checked request.
// If an error occurs, it can be retrieved using VendorPrivateCookie.Check.
2013-08-12 02:43:26 +02:00
func VendorPrivateChecked(c *xgb.Conn, VendorCode uint32, ContextTag ContextTag, Data []byte) VendorPrivateCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
2013-08-12 02:43:26 +02:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'VendorPrivate' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-12 02:43:26 +02:00
cookie := c.NewCookie(true, false)
c.NewRequest(vendorPrivateRequest(c, VendorCode, ContextTag, Data), cookie)
return VendorPrivateCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook VendorPrivateCookie) Check() error {
return cook.Cookie.Check()
}
// vendorPrivateRequest writes a VendorPrivate request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func vendorPrivateRequest(c *xgb.Conn, VendorCode uint32, ContextTag ContextTag, Data []byte) []byte {
size := xgb.Pad((12 + xgb.Pad((len(Data) * 1))))
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 16 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], VendorCode)
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
2013-08-12 02:43:26 +02:00
copy(buf[b:], Data[:len(Data)])
b += int(len(Data))
return buf
}
2013-08-12 02:43:26 +02:00
// VendorPrivateWithReplyCookie is a cookie used only for VendorPrivateWithReply requests.
type VendorPrivateWithReplyCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// VendorPrivateWithReply sends a checked request.
// If an error occurs, it will be returned with the reply by calling VendorPrivateWithReplyCookie.Reply.
2013-08-12 02:43:26 +02:00
func VendorPrivateWithReply(c *xgb.Conn, VendorCode uint32, ContextTag ContextTag, Data []byte) VendorPrivateWithReplyCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'VendorPrivateWithReply' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(vendorPrivateWithReplyRequest(c, VendorCode, ContextTag, Data), cookie)
return VendorPrivateWithReplyCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// VendorPrivateWithReplyUnchecked sends an unchecked request.
2012-05-11 05:57:34 +02:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2013-08-12 02:43:26 +02:00
func VendorPrivateWithReplyUnchecked(c *xgb.Conn, VendorCode uint32, ContextTag ContextTag, Data []byte) VendorPrivateWithReplyCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'VendorPrivateWithReply' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
2013-08-12 02:43:26 +02:00
c.NewRequest(vendorPrivateWithReplyRequest(c, VendorCode, ContextTag, Data), cookie)
return VendorPrivateWithReplyCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// VendorPrivateWithReplyReply represents the data returned from a VendorPrivateWithReply request.
type VendorPrivateWithReplyReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
2013-08-12 02:43:26 +02:00
Retval uint32
Data1 []byte // size: 24
Data2 []byte // size: xgb.Pad(((int(Length) * 4) * 1))
}
2013-08-12 02:43:26 +02:00
// Reply blocks and returns the reply data for a VendorPrivateWithReply request.
func (cook VendorPrivateWithReplyCookie) Reply() (*VendorPrivateWithReplyReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
2013-08-12 02:43:26 +02:00
return vendorPrivateWithReplyReply(buf), nil
}
2013-08-12 02:43:26 +02:00
// vendorPrivateWithReplyReply reads a byte slice into a VendorPrivateWithReplyReply value.
func vendorPrivateWithReplyReply(buf []byte) *VendorPrivateWithReplyReply {
v := new(VendorPrivateWithReplyReply)
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
2013-08-12 02:43:26 +02:00
v.Retval = xgb.Get32(buf[b:])
b += 4
2013-08-12 02:43:26 +02:00
v.Data1 = make([]byte, 24)
copy(v.Data1[:24], buf[b:])
b += int(24)
2013-08-12 02:43:26 +02:00
v.Data2 = make([]byte, (int(v.Length) * 4))
copy(v.Data2[:(int(v.Length)*4)], buf[b:])
b += int((int(v.Length) * 4))
return v
}
// vendorPrivateWithReplyRequest writes a VendorPrivateWithReply request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func vendorPrivateWithReplyRequest(c *xgb.Conn, VendorCode uint32, ContextTag ContextTag, Data []byte) []byte {
size := xgb.Pad((12 + xgb.Pad((len(Data) * 1))))
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 17 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], VendorCode)
b += 4
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
2013-08-12 02:43:26 +02:00
copy(buf[b:], Data[:len(Data)])
b += int(len(Data))
return buf
}
2013-08-12 02:43:26 +02:00
// WaitGLCookie is a cookie used only for WaitGL requests.
type WaitGLCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// WaitGL sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func WaitGL(c *xgb.Conn, ContextTag ContextTag) WaitGLCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'WaitGL' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-12 02:43:26 +02:00
cookie := c.NewCookie(false, false)
c.NewRequest(waitGLRequest(c, ContextTag), cookie)
return WaitGLCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// WaitGLChecked sends a checked request.
// If an error occurs, it can be retrieved using WaitGLCookie.Check.
2013-08-12 02:43:26 +02:00
func WaitGLChecked(c *xgb.Conn, ContextTag ContextTag) WaitGLCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-12 02:43:26 +02:00
panic("Cannot issue request 'WaitGL' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-12 02:43:26 +02:00
cookie := c.NewCookie(true, false)
c.NewRequest(waitGLRequest(c, ContextTag), cookie)
return WaitGLCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook WaitGLCookie) Check() error {
return cook.Cookie.Check()
}
// waitGLRequest writes a WaitGL request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func waitGLRequest(c *xgb.Conn, ContextTag ContextTag) []byte {
size := 8
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
2013-08-12 02:43:26 +02:00
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
2013-08-12 02:43:26 +02:00
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 8 // request opcode
b += 1
2013-08-12 02:43:26 +02:00
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-12 02:43:26 +02:00
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
2013-08-12 02:43:26 +02:00
return buf
}
2013-08-12 02:43:26 +02:00
// WaitXCookie is a cookie used only for WaitX requests.
type WaitXCookie struct {
*xgb.Cookie
}
2013-08-12 02:43:26 +02:00
// WaitX sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func WaitX(c *xgb.Conn, ContextTag ContextTag) WaitXCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
2013-08-12 02:43:26 +02:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'WaitX' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(waitXRequest(c, ContextTag), cookie)
return WaitXCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// WaitXChecked sends a checked request.
// If an error occurs, it can be retrieved using WaitXCookie.Check.
2013-08-12 02:43:26 +02:00
func WaitXChecked(c *xgb.Conn, ContextTag ContextTag) WaitXCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
2013-08-12 02:43:26 +02:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'WaitX' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-12 02:43:26 +02:00
cookie := c.NewCookie(true, false)
c.NewRequest(waitXRequest(c, ContextTag), cookie)
return WaitXCookie{cookie}
}
2013-08-12 02:43:26 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook WaitXCookie) Check() error {
return cook.Cookie.Check()
}
// waitXRequest writes a WaitX request to a byte slice for transfer.
2013-08-12 02:43:26 +02:00
func waitXRequest(c *xgb.Conn, ContextTag ContextTag) []byte {
size := 8
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-12 02:43:26 +02:00
buf[b] = 9 // 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
return buf
}