Files

10827 lines
309 KiB
Go
Raw Permalink Normal View History

2012-05-10 20:06:22 -04: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-11 20:43:26 -04:00
// BadBadContext is the error number for a BadBadContext.
const BadBadContext = 0
2013-08-11 20:43:26 -04:00
type BadContextError GenericError
2013-08-11 20:43:26 -04:00
// 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
}
2013-08-11 20:43:26 -04:00
// SequenceId returns the sequence id attached to the BadBadContext error.
// This is mostly used internally.
func (err BadContextError) SequenceId() uint16 {
return err.Sequence
}
2013-08-11 20:43:26 -04:00
// 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
}
2013-08-11 20:43:26 -04:00
// 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, ", ") + "}"
}
2013-08-11 20:43:26 -04:00
func init() {
xgb.NewExtErrorFuncs["GLX"][0] = BadContextErrorNew
}
2013-08-11 20:43:26 -04:00
// BadBadContextState is the error number for a BadBadContextState.
const BadBadContextState = 1
2013-08-11 20:43:26 -04:00
type BadContextStateError GenericError
2013-08-11 20:43:26 -04:00
// 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
}
2013-08-11 20:43:26 -04:00
// SequenceId returns the sequence id attached to the BadBadContextState error.
// This is mostly used internally.
func (err BadContextStateError) SequenceId() uint16 {
return err.Sequence
}
2013-08-11 20:43:26 -04:00
// 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
}
2012-06-05 00:14:34 -04:00
2013-08-11 20:43:26 -04:00
// 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, ", ") + "}"
}
2013-08-11 20:43:26 -04:00
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
}
// 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
}
// 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, ", ") + "}"
}
func init() {
xgb.NewExtErrorFuncs["GLX"][10] = BadPbufferErrorNew
}
// BadBadPixmap is the error number for a BadBadPixmap.
const BadBadPixmap = 3
type BadPixmapError GenericError
// 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
}
// SequenceId returns the sequence id attached to the BadBadPixmap error.
// This is mostly used internally.
func (err BadPixmapError) SequenceId() uint16 {
return err.Sequence
}
// 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
}
// 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, ", ") + "}"
}
func init() {
xgb.NewExtErrorFuncs["GLX"][3] = BadPixmapErrorNew
}
// BadBadRenderRequest is the error number for a BadBadRenderRequest.
const BadBadRenderRequest = 6
type BadRenderRequestError GenericError
// 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-11 20:43:26 -04: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-11 20:43:26 -04:00
// BadGeneric is the error number for a BadGeneric.
const BadGeneric = -1
type GenericError struct {
Sequence uint16
NiceName string
BadValue uint32
MinorOpcode uint16
MajorOpcode byte
// padding: 21 bytes
}
// 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
return v
}
// SequenceId returns the sequence id attached to the BadGeneric error.
// This is mostly used internally.
func (err GenericError) SequenceId() uint16 {
return err.Sequence
}
// 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
}
// Error returns a rudimentary string representation of the BadGeneric error.
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, ", ") + "}"
}
func init() {
xgb.NewExtErrorFuncs["GLX"][-1] = GenericErrorNew
}
const (
2013-08-11 20:43:26 -04:00
PbcdtWindow = 32793
PbcdtPbuffer = 32794
)
2013-08-11 20:43:26 -04: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
}
return Pbuffer(id), nil
}
2012-05-10 23:57:34 -04: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-10 23:57:34 -04: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-10 23:57:34 -04: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-10 23:57:34 -04: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-10 23:57:34 -04: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-11 20:43:26 -04:00
type Pixmap uint32
2013-08-11 20:43:26 -04:00
func NewPixmapId(c *xgb.Conn) (Pixmap, error) {
id, err := c.NewId()
if err != nil {
return 0, err
}
return Pixmap(id), nil
}
2013-08-11 20:43:26 -04:00
const (
RmGlRender = 7168
RmGlFeedback = 7169
RmGlSelect = 7170
)
2012-05-10 23:57:34 -04:00
// BadUnsupportedPrivateRequest is the error number for a BadUnsupportedPrivateRequest.
const BadUnsupportedPrivateRequest = 8
type UnsupportedPrivateRequestError GenericError
2012-05-10 23:57:34 -04: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
}
2012-05-10 23:57:34 -04:00
// SequenceId returns the sequence id attached to the BadUnsupportedPrivateRequest error.
// This is mostly used internally.
func (err UnsupportedPrivateRequestError) SequenceId() uint16 {
return err.Sequence
}
2012-05-11 01:58:52 -04: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
}
2012-05-11 01:58:52 -04: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))
return "BadUnsupportedPrivateRequest {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewExtErrorFuncs["GLX"][8] = UnsupportedPrivateRequestErrorNew
}
2013-08-11 20:43:26 -04:00
type Window uint32
2013-08-11 20:43:26 -04:00
func NewWindowId(c *xgb.Conn) (Window, error) {
id, err := c.NewId()
if err != nil {
return 0, err
}
return Window(id), nil
}
2013-08-11 20:43:26 -04:00
// Skipping definition for base type 'Bool'
2013-08-11 20:43:26 -04:00
// Skipping definition for base type 'Byte'
2013-08-11 20:43:26 -04:00
// Skipping definition for base type 'Card8'
2013-08-11 20:43:26 -04:00
// Skipping definition for base type 'Char'
2013-08-11 20:43:26 -04:00
// Skipping definition for base type 'Void'
2013-08-11 20:43:26 -04:00
// Skipping definition for base type 'Double'
2013-08-11 20:43:26 -04:00
// Skipping definition for base type 'Float'
2013-08-11 20:43:26 -04:00
// Skipping definition for base type 'Int16'
2013-08-11 20:43:26 -04:00
// Skipping definition for base type 'Int32'
2013-08-11 20:43:26 -04:00
// Skipping definition for base type 'Int8'
2013-08-11 20:43:26 -04:00
// Skipping definition for base type 'Card16'
2013-08-11 20:43:26 -04:00
// Skipping definition for base type 'Card32'
2013-08-11 20:43:26 -04:00
// AreTexturesResidentCookie is a cookie used only for AreTexturesResident requests.
type AreTexturesResidentCookie struct {
*xgb.Cookie
}
2013-08-11 20:43:26 -04:00
// AreTexturesResident sends a checked request.
2018-09-30 16:32:47 +02:00
// If an error occurs, it will be returned with the reply by calling AreTexturesResidentCookie.Reply.
2013-08-11 20:43:26 -04: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-11 20:43:26 -04: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}
}
// AreTexturesResidentUnchecked sends an unchecked request.
2012-05-10 23:57:34 -04:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2013-08-11 20:43:26 -04:00
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()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-11 20:43:26 -04:00
panic("Cannot issue request 'AreTexturesResident' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-11 20:43:26 -04:00
cookie := c.NewCookie(false, true)
c.NewRequest(areTexturesResidentRequest(c, ContextTag, N, Textures), cookie)
return AreTexturesResidentCookie{cookie}
}
2013-08-11 20:43:26 -04: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))
}
// 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
}
2013-08-11 20:43:26 -04:00
if buf == nil {
return nil, nil
}
return areTexturesResidentReply(buf), nil
}
2013-08-11 20:43:26 -04: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
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
}
2018-09-30 16:32:47 +02:00
// areTexturesResidentRequest writes a AreTexturesResident request to a byte slice for transfer.
2013-08-11 20:43:26 -04: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()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-11 20:43:26 -04:00
buf[b] = 143 // 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-11 20:43:26 -04:00
xgb.Put32(buf[b:], uint32(N))
b += 4
for i := 0; i < int(N); i++ {
xgb.Put32(buf[b:], Textures[i])
b += 4
}
return buf
}
2013-08-11 20:43:26 -04:00
// ChangeDrawableAttributesCookie is a cookie used only for ChangeDrawableAttributes requests.
type ChangeDrawableAttributesCookie struct {
*xgb.Cookie
}
2013-08-11 20:43:26 -04:00
// ChangeDrawableAttributes sends an unchecked request.
2012-05-10 23:57:34 -04:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2013-08-11 20:43:26 -04:00
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()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-11 20:43:26 -04:00
panic("Cannot issue request 'ChangeDrawableAttributes' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
2013-08-11 20:43:26 -04:00
c.NewRequest(changeDrawableAttributesRequest(c, Drawable, NumAttribs, Attribs), cookie)
return ChangeDrawableAttributesCookie{cookie}
}
2013-08-11 20:43:26 -04:00
// ChangeDrawableAttributesChecked sends a checked request.
2018-09-30 16:32:47 +02:00
// If an error occurs, it can be retrieved using ChangeDrawableAttributesCookie.Check.
2013-08-11 20:43:26 -04: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()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-11 20:43:26 -04:00
panic("Cannot issue request 'ChangeDrawableAttributes' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
2013-08-11 20:43:26 -04:00
c.NewRequest(changeDrawableAttributesRequest(c, Drawable, NumAttribs, Attribs), cookie)
return ChangeDrawableAttributesCookie{cookie}
}
2012-05-10 23:57:34 -04: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-11 20:43:26 -04:00
func (cook ChangeDrawableAttributesCookie) Check() error {
return cook.Cookie.Check()
}
2018-09-30 16:32:47 +02:00
// changeDrawableAttributesRequest writes a ChangeDrawableAttributes request to a byte slice for transfer.
2013-08-11 20:43:26 -04: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()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-11 20:43:26 -04:00
buf[b] = 30 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
2013-08-11 20:43:26 -04:00
xgb.Put32(buf[b:], uint32(Drawable))
b += 4
2013-08-11 20:43:26 -04:00
xgb.Put32(buf[b:], NumAttribs)
b += 4
2013-08-11 20:43:26 -04:00
for i := 0; i < int((int(NumAttribs) * 2)); i++ {
xgb.Put32(buf[b:], Attribs[i])
b += 4
}
return buf
}
// ClientInfoCookie is a cookie used only for ClientInfo requests.
type ClientInfoCookie struct {
*xgb.Cookie
}
// ClientInfo sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2018-09-30 16:32:47 +02:00
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-11 20:43:26 -04: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}
}
// ClientInfoChecked sends a checked request.
2018-09-30 16:32:47 +02:00
// 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-11 20:43:26 -04: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}
}
// 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()
}
2018-09-30 16:32:47 +02:00
// 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-11 20:43:26 -04: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-11 20:43:26 -04:00
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
2013-08-11 20:43:26 -04:00
b += 1
buf[b] = 20 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], MajorVersion)
b += 4
xgb.Put32(buf[b:], MinorVersion)
b += 4
xgb.Put32(buf[b:], StrLen)
b += 4
copy(buf[b:], String[:StrLen])
b += int(StrLen)
2013-08-11 20:43:26 -04:00
return buf
}
// CopyContextCookie is a cookie used only for CopyContext requests.
type CopyContextCookie struct {
*xgb.Cookie
}
// CopyContext sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2018-09-30 16:32:47 +02:00
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-11 20:43:26 -04: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}
}
// CopyContextChecked sends a checked request.
2018-09-30 16:32:47 +02:00
// 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-11 20:43:26 -04: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}
}
// 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()
}
2018-09-30 16:32:47 +02:00
// 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-11 20:43:26 -04:00
size := 20
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
2013-08-11 20:43:26 -04:00
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
2013-08-11 20:43:26 -04:00
b += 1
buf[b] = 10 // 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(Src))
b += 4
xgb.Put32(buf[b:], uint32(Dest))
b += 4
xgb.Put32(buf[b:], Mask)
b += 4
xgb.Put32(buf[b:], uint32(SrcContextTag))
b += 4
return buf
}
2012-05-10 23:57:34 -04:00
// CreateContextCookie is a cookie used only for CreateContext requests.
type CreateContextCookie struct {
*xgb.Cookie
}
2012-05-10 23:57:34 -04: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()
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}
}
2012-05-10 23:57:34 -04:00
// CreateContextChecked sends a checked request.
2018-09-30 16:32:47 +02:00
// If an error occurs, it can be retrieved using CreateContextCookie.Check.
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()
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}
}
2012-05-10 23:57:34 -04: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()
}
2018-09-30 16:32:47 +02:00
// createContextRequest writes a CreateContext request to a byte slice for transfer.
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()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
buf[b] = 3 // 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(Context))
b += 4
xgb.Put32(buf[b:], uint32(Visual))
b += 4
xgb.Put32(buf[b:], Screen)
b += 4
xgb.Put32(buf[b:], uint32(ShareList))
b += 4
if IsDirect {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
b += 3 // padding
return buf
}
2013-08-11 20:43:26 -04:00
// CreateContextAttribsARBCookie is a cookie used only for CreateContextAttribsARB requests.
type CreateContextAttribsARBCookie struct {
*xgb.Cookie
}
2013-08-11 20:43:26 -04:00
// CreateContextAttribsARB sends an unchecked request.
2012-05-10 23:57:34 -04:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2013-08-11 20:43:26 -04:00
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()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-11 20:43:26 -04:00
panic("Cannot issue request 'CreateContextAttribsARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
2013-08-11 20:43:26 -04:00
c.NewRequest(createContextAttribsARBRequest(c, Context, Fbconfig, Screen, ShareList, IsDirect, NumAttribs, Attribs), cookie)
return CreateContextAttribsARBCookie{cookie}
}
2013-08-11 20:43:26 -04:00
// CreateContextAttribsARBChecked sends a checked request.
2018-09-30 16:32:47 +02:00
// If an error occurs, it can be retrieved using CreateContextAttribsARBCookie.Check.
2013-08-11 20:43:26 -04: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()
if _, ok := c.Extensions["GLX"]; !ok {
2013-08-11 20:43:26 -04:00
panic("Cannot issue request 'CreateContextAttribsARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
2013-08-11 20:43:26 -04:00
c.NewRequest(createContextAttribsARBRequest(c, Context, Fbconfig, Screen, ShareList, IsDirect, NumAttribs, Attribs), cookie)
return CreateContextAttribsARBCookie{cookie}
}
2012-05-10 23:57:34 -04: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-11 20:43:26 -04:00
func (cook CreateContextAttribsARBCookie) Check() error {
return cook.Cookie.Check()
}
2018-09-30 16:32:47 +02:00
// createContextAttribsARBRequest writes a CreateContextAttribsARB request to a byte slice for transfer.
2013-08-11 20:43:26 -04: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()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-11 20:43:26 -04:00
buf[b] = 34 // 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(Context))
b += 4
2013-08-11 20:43:26 -04:00
xgb.Put32(buf[b:], uint32(Fbconfig))
b += 4
2013-08-11 20:43:26 -04:00
xgb.Put32(buf[b:], Screen)
b += 4
2013-08-11 20:43:26 -04:00
xgb.Put32(buf[b:], uint32(ShareList))
b += 4
2013-08-11 20:43:26 -04:00
if IsDirect {
buf[b] = 1
} else {
2013-08-11 20:43:26 -04:00
buf[b] = 0
}
b += 1
2013-08-11 20:43:26 -04:00
b += 3 // padding
2013-08-11 20:43:26 -04:00
xgb.Put32(buf[b:], NumAttribs)
b += 4
2013-08-11 20:43:26 -04:00
for i := 0; i < int((int(NumAttribs) * 2)); i++ {
xgb.Put32(buf[b:], Attribs[i])
b += 4
}
return buf
}
2012-05-10 23:57:34 -04:00
// CreateGLXPixmapCookie is a cookie used only for CreateGLXPixmap requests.
type CreateGLXPixmapCookie struct {
*xgb.Cookie
}
2012-05-10 23:57:34 -04: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()
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}
}
2012-05-10 23:57:34 -04:00
// CreateGLXPixmapChecked sends a checked request.
2018-09-30 16:32:47 +02:00
// If an error occurs, it can be retrieved using CreateGLXPixmapCookie.Check.
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()
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}
}
2012-05-10 23:57:34 -04: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()
}
2018-09-30 16:32:47 +02:00
// createGLXPixmapRequest writes a CreateGLXPixmap request to a byte slice for transfer.
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()
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
buf[b] = 13 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], Screen)
b += 4
xgb.Put32(buf[b:], uint32(Visual))
b += 4
xgb.Put32(buf[b:], uint32(Pixmap))
b += 4
xgb.Put32(buf[b:], uint32(GlxPixmap))
b += 4
return buf
}
2012-05-10 23:57:34 -04:00
// CreateNewContextCookie is a cookie used only for CreateNewContext requests.
type CreateNewContextCookie struct {
*xgb.Cookie
}
2012-05-10 23:57:34 -04:00
// CreateNewContext sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2018-09-30 16:32:47 +02:00
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 {
panic("Cannot issue request 'CreateNewContext' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(createNewContextRequest(c, Context, Fbconfig, Screen, RenderType, ShareList, IsDirect), cookie)
return CreateNewContextCookie{cookie}
}
2012-05-10 23:57:34 -04:00
// CreateNewContextChecked sends a checked request.
2018-09-30 16:32:47 +02:00
// 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 {
panic("Cannot issue request 'CreateNewContext' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(createNewContextRequest(c, Context, Fbconfig, Screen, RenderType, ShareList, IsDirect), cookie)
return CreateNewContextCookie{cookie}
}
2012-05-10 23:57:34 -04: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 CreateNewContextCookie) Check() error {
return cook.Cookie.Check()
}
2018-09-30 16:32:47 +02:00
// 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 {
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
buf[b] = 24 // 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(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
if IsDirect {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
b += 3 // padding
return buf
}
2012-05-10 23:57:34 -04:00
// CreatePbufferCookie is a cookie used only for CreatePbuffer requests.
type CreatePbufferCookie struct {
*xgb.Cookie
}
2012-05-10 23:57:34 -04:00
// CreatePbuffer sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
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 {
panic("Cannot issue request 'CreatePbuffer' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(createPbufferRequest(c, Screen, Fbconfig, Pbuffer, NumAttribs, Attribs), cookie)
return CreatePbufferCookie{cookie}
}
2012-05-10 23:57:34 -04:00
// CreatePbufferChecked sends a checked request.
2018-09-30 16:32:47 +02:00
// If an error occurs, it can be retrieved using CreatePbufferCookie.Check.
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 {
panic("Cannot issue request 'CreatePbuffer' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(createPbufferRequest(c, Screen, Fbconfig, Pbuffer, NumAttribs, Attribs), cookie)
return CreatePbufferCookie{cookie}
}
2012-05-10 23:57:34 -04: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 CreatePbufferCookie) Check() error {
return cook.Cookie.Check()
}
2018-09-30 16:32:47 +02:00
// createPbufferRequest writes a CreatePbuffer request to a byte slice for transfer.
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
buf[b] = 27 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], Screen)
b += 4
xgb.Put32(buf[b:], uint32(Fbconfig))
b += 4
xgb.Put32(buf[b:], uint32(Pbuffer))
b += 4
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-11 20:43:26 -04:00
// CreatePixmapCookie is a cookie used only for CreatePixmap requests.
type CreatePixmapCookie struct {
*xgb.Cookie
}
2013-08-11 20:43:26 -04:00
// CreatePixmap sends an unchecked request.
2012-05-10 23:57:34 -04:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2013-08-11 20:43:26 -04: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-11 20:43:26 -04: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-11 20:43:26 -04:00
c.NewRequest(createPixmapRequest(c, Screen, Fbconfig, Pixmap, GlxPixmap, NumAttribs, Attribs), cookie)
return CreatePixmapCookie{cookie}
}
2013-08-11 20:43:26 -04:00
// CreatePixmapChecked sends a checked request.
2018-09-30 16:32:47 +02:00
// If an error occurs, it can be retrieved using CreatePixmapCookie.Check.
2013-08-11 20:43:26 -04: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-11 20:43:26 -04: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-11 20:43:26 -04:00
c.NewRequest(createPixmapRequest(c, Screen, Fbconfig, Pixmap, GlxPixmap, NumAttribs, Attribs), cookie)
return CreatePixmapCookie{cookie}
}
2012-05-10 23:57:34 -04: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-11 20:43:26 -04:00
func (cook CreatePixmapCookie) Check() error {
return cook.Cookie.Check()
}
2018-09-30 16:32:47 +02:00
// createPixmapRequest writes a CreatePixmap request to a byte slice for transfer.
2013-08-11 20:43:26 -04: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-11 20:43:26 -04: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-11 20:43:26 -04:00
xgb.Put32(buf[b:], Screen)
b += 4
2013-08-11 20:43:26 -04:00
xgb.Put32(buf[b:], uint32(Fbconfig))
b += 4
2013-08-11 20:43:26 -04:00
xgb.Put32(buf[b:], uint32(Pixmap))
b += 4
2013-08-11 20:43:26 -04:00
xgb.Put32(buf[b:], uint32(GlxPixmap))
b += 4
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
}
2012-05-10 23:57:34 -04:00
// CreateWindowCookie is a cookie used only for CreateWindow requests.
type CreateWindowCookie struct {
*xgb.Cookie
}
2012-05-10 23:57:34 -04:00
// CreateWindow sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
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 {
panic("Cannot issue request 'CreateWindow' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(createWindowRequest(c, Screen, Fbconfig, Window, GlxWindow, NumAttribs, Attribs), cookie)
return CreateWindowCookie{cookie}
}
2012-05-10 23:57:34 -04:00
// CreateWindowChecked sends a checked request.
2018-09-30 16:32:47 +02:00
// If an error occurs, it can be retrieved using CreateWindowCookie.Check.
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 {
panic("Cannot issue request 'CreateWindow' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(createWindowRequest(c, Screen, Fbconfig, Window, GlxWindow, NumAttribs, Attribs), cookie)
return CreateWindowCookie{cookie}
}
2012-05-10 23:57:34 -04: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 CreateWindowCookie) Check() error {
return cook.Cookie.Check()
}
2018-09-30 16:32:47 +02:00
// createWindowRequest writes a CreateWindow request to a byte slice for transfer.
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
buf[b] = 31 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
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
for i := 0; i < int((int(NumAttribs) * 2)); i++ {
xgb.Put32(buf[b:], Attribs[i])
b += 4
}
return buf
}
2013-08-11 20:43:26 -04:00
// DeleteListsCookie is a cookie used only for DeleteLists requests.
type DeleteListsCookie struct {
*xgb.Cookie
}
// DeleteLists sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
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()
2013-08-11 20:43:26 -04:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'DeleteLists' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(deleteListsRequest(c, ContextTag, List, Range), cookie)
return DeleteListsCookie{cookie}
}
// DeleteListsChecked sends a checked request.
2018-09-30 16:32:47 +02:00
// If an error occurs, it can be retrieved using DeleteListsCookie.Check.
2013-08-11 20:43:26 -04: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-11 20:43:26 -04:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'DeleteLists' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(deleteListsRequest(c, ContextTag, List, Range), cookie)
return DeleteListsCookie{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 DeleteListsCookie) Check() error {
return cook.Cookie.Check()
}
2018-09-30 16:32:47 +02:00
// deleteListsRequest writes a DeleteLists request to a byte slice for transfer.
2013-08-11 20:43:26 -04: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()
2013-08-11 20:43:26 -04:00
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
2013-08-11 20:43:26 -04:00
b += 1
buf[b] = 103 // 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:], List)
b += 4
xgb.Put32(buf[b:], uint32(Range))
b += 4
return buf
}
// DeleteQueriesARBCookie is a cookie used only for DeleteQueriesARB requests.
type DeleteQueriesARBCookie struct {
*xgb.Cookie
}
// DeleteQueriesARB sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
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()
2013-08-11 20:43:26 -04:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'DeleteQueriesARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(deleteQueriesARBRequest(c, ContextTag, N, Ids), cookie)
return DeleteQueriesARBCookie{cookie}
}
// DeleteQueriesARBChecked sends a checked request.
2018-09-30 16:32:47 +02:00
// If an error occurs, it can be retrieved using DeleteQueriesARBCookie.Check.
2013-08-11 20:43:26 -04: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-11 20:43:26 -04:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'DeleteQueriesARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(deleteQueriesARBRequest(c, ContextTag, N, Ids), cookie)
return DeleteQueriesARBCookie{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 DeleteQueriesARBCookie) Check() error {
return cook.Cookie.Check()
}
2018-09-30 16:32:47 +02:00
// deleteQueriesARBRequest writes a DeleteQueriesARB request to a byte slice for transfer.
2013-08-11 20:43:26 -04: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()
2013-08-11 20:43:26 -04:00
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
2013-08-11 20:43:26 -04:00
b += 1
buf[b] = 161 // 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:], uint32(N))
b += 4
for i := 0; i < int(N); i++ {
xgb.Put32(buf[b:], Ids[i])
b += 4
}
return buf
}
// DeleteTexturesCookie is a cookie used only for DeleteTextures requests.
type DeleteTexturesCookie struct {
*xgb.Cookie
}
// 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()
2013-08-11 20:43:26 -04:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'DeleteTextures' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(deleteTexturesRequest(c, ContextTag, N, Textures), cookie)
return DeleteTexturesCookie{cookie}
}
// DeleteTexturesChecked sends a checked request.
2018-09-30 16:32:47 +02:00
// If an error occurs, it can be retrieved using DeleteTexturesCookie.Check.
2013-08-11 20:43:26 -04: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()
2013-08-11 20:43:26 -04:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'DeleteTextures' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(deleteTexturesRequest(c, ContextTag, N, Textures), cookie)
return DeleteTexturesCookie{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 DeleteTexturesCookie) Check() error {
return cook.Cookie.Check()
}
2018-09-30 16:32:47 +02:00
// deleteTexturesRequest writes a DeleteTextures request to a byte slice for transfer.
2013-08-11 20:43:26 -04: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-11 20:43:26 -04:00
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
2013-08-11 20:43:26 -04:00
b += 1
buf[b] = 144 // 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:], uint32(N))
b += 4
for i := 0; i < int(N); i++ {
xgb.Put32(buf[b:], Textures[i])
b += 4
}
return buf
}
2012-05-10 23:57:34 -04:00
// DeleteWindowCookie is a cookie used only for DeleteWindow requests.
type DeleteWindowCookie struct {
*xgb.Cookie
}
2012-05-10 23:57:34 -04: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()
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}
}
2012-05-10 23:57:34 -04:00
// DeleteWindowChecked sends a checked request.
2018-09-30 16:32:47 +02:00
// If an error occurs, it can be retrieved using DeleteWindowCookie.Check.
func DeleteWindowChecked(c *xgb.Conn, Glxwindow Window) DeleteWindowCookie {
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 '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}
}
2012-05-10 23:57:34 -04: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 DeleteWindowCookie) Check() error {
return cook.Cookie.Check()
}
2018-09-30 16:32:47 +02:00
// deleteWindowRequest writes a DeleteWindow request to a byte slice for transfer.
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
buf[b] = 32 // 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(Glxwindow))
b += 4
return buf
}
2013-08-11 20:43:26 -04:00
// DestroyContextCookie is a cookie used only for DestroyContext requests.
type DestroyContextCookie struct {
*xgb.Cookie
}
2013-08-11 20:43:26 -04:00
// DestroyContext sends an unchecked request.
2012-05-10 23:57:34 -04:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2013-08-11 20:43:26 -04: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-11 20:43:26 -04: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-11 20:43:26 -04:00
c.NewRequest(destroyContextRequest(c, Context), cookie)
return DestroyContextCookie{cookie}
}
2013-08-11 20:43:26 -04:00
// DestroyContextChecked sends a checked request.
2018-09-30 16:32:47 +02:00
// If an error occurs, it can be retrieved using DestroyContextCookie.Check.
2013-08-11 20:43:26 -04: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-11 20:43:26 -04: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-11 20:43:26 -04:00
c.NewRequest(destroyContextRequest(c, Context), cookie)
return DestroyContextCookie{cookie}
}
2012-05-10 23:57:34 -04: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-11 20:43:26 -04:00
func (cook DestroyContextCookie) Check() error {
return cook.Cookie.Check()
}
2018-09-30 16:32:47 +02:00
// destroyContextRequest writes a DestroyContext request to a byte slice for transfer.
2013-08-11 20:43:26 -04: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-11 20:43:26 -04:00
buf[b] = 4 // 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(Context))
b += 4
return buf
}
2013-08-11 20:43:26 -04:00
// DestroyGLXPixmapCookie is a cookie used only for DestroyGLXPixmap requests.
type DestroyGLXPixmapCookie struct {
*xgb.Cookie
}
2013-08-11 20:43:26 -04:00
// DestroyGLXPixmap sends an unchecked request.
2012-05-10 23:57:34 -04:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2013-08-11 20:43:26 -04: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-11 20:43:26 -04: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-11 20:43:26 -04:00
c.NewRequest(destroyGLXPixmapRequest(c, GlxPixmap), cookie)
return DestroyGLXPixmapCookie{cookie}
}
2013-08-11 20:43:26 -04:00
// DestroyGLXPixmapChecked sends a checked request.
2018-09-30 16:32:47 +02:00
// If an error occurs, it can be retrieved using DestroyGLXPixmapCookie.Check.
2013-08-11 20:43:26 -04: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-11 20:43:26 -04: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-11 20:43:26 -04:00
c.NewRequest(destroyGLXPixmapRequest(c, GlxPixmap), cookie)
return DestroyGLXPixmapCookie{cookie}
}
2012-05-10 23:57:34 -04: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-11 20:43:26 -04:00
func (cook DestroyGLXPixmapCookie) Check() error {
return cook.Cookie.Check()
}
2018-09-30 16:32:47 +02:00
// destroyGLXPixmapRequest writes a DestroyGLXPixmap request to a byte slice for transfer.
2013-08-11 20:43:26 -04: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-11 20:43:26 -04: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-11 20:43:26 -04:00
xgb.Put32(buf[b:], uint32(GlxPixmap))
b += 4
return buf
}
2013-08-11 20:43:26 -04:00
// DestroyPbufferCookie is a cookie used only for DestroyPbuffer requests.
type DestroyPbufferCookie struct {
*xgb.Cookie
}
2013-08-11 20:43:26 -04:00
// DestroyPbuffer sends an unchecked request.
2012-05-10 23:57:34 -04:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2013-08-11 20:43:26 -04: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-11 20:43:26 -04: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-11 20:43:26 -04:00
c.NewRequest(destroyPbufferRequest(c, Pbuffer), cookie)
return DestroyPbufferCookie{cookie}
}
2013-08-11 20:43:26 -04:00
// DestroyPbufferChecked sends a checked request.
2018-09-30 16:32:47 +02:00
// If an error occurs, it can be retrieved using DestroyPbufferCookie.Check.
2013-08-11 20:43:26 -04: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-11 20:43:26 -04: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-11 20:43:26 -04:00
c.NewRequest(destroyPbufferRequest(c, Pbuffer), cookie)
return DestroyPbufferCookie{cookie}
}
2012-05-10 23:57:34 -04: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-11 20:43:26 -04:00
func (cook DestroyPbufferCookie) Check() error {
return cook.Cookie.Check()
}
2018-09-30 16:32:47 +02:00
// destroyPbufferRequest writes a DestroyPbuffer request to a byte slice for transfer.
2013-08-11 20:43:26 -04: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-11 20:43:26 -04: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-11 20:43:26 -04:00
xgb.Put32(buf[b:], uint32(Pbuffer))
b += 4
2013-08-11 20:43:26 -04:00
return buf
}
2013-08-11 20:43:26 -04:00
// DestroyPixmapCookie is a cookie used only for DestroyPixmap requests.
type DestroyPixmapCookie struct {
*xgb.Cookie
}
// DestroyPixmap sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func DestroyPixmap(c *xgb.Conn, GlxPixmap Pixmap) DestroyPixmapCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
2013-08-11 20:43:26 -04:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'DestroyPixmap' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(destroyPixmapRequest(c, GlxPixmap), cookie)
return DestroyPixmapCookie{cookie}
}
// DestroyPixmapChecked sends a checked request.
2018-09-30 16:32:47 +02:00
// If an error occurs, it can be retrieved using DestroyPixmapCookie.Check.
2013-08-11 20:43:26 -04:00
func DestroyPixmapChecked(c *xgb.Conn, GlxPixmap Pixmap) DestroyPixmapCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
2013-08-11 20:43:26 -04:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'DestroyPixmap' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(destroyPixmapRequest(c, GlxPixmap), cookie)
return DestroyPixmapCookie{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 DestroyPixmapCookie) Check() error {
return cook.Cookie.Check()
}
2018-09-30 16:32:47 +02:00
// destroyPixmapRequest writes a DestroyPixmap request to a byte slice for transfer.
2013-08-11 20:43:26 -04: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()
2013-08-11 20:43:26 -04:00
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
2013-08-11 20:43:26 -04:00
b += 1
buf[b] = 23 // 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(GlxPixmap))
b += 4
return buf
}
2012-05-10 23:57:34 -04:00
// EndListCookie is a cookie used only for EndList requests.
type EndListCookie struct {
*xgb.Cookie
}
2012-05-10 23:57:34 -04:00
// EndList sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
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 {
panic("Cannot issue request 'EndList' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(endListRequest(c, ContextTag), cookie)
return EndListCookie{cookie}
}
2012-05-10 23:57:34 -04:00
// EndListChecked sends a checked request.
2018-09-30 16:32:47 +02:00
// If an error occurs, it can be retrieved using EndListCookie.Check.
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 {
panic("Cannot issue request 'EndList' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(endListRequest(c, ContextTag), cookie)
return EndListCookie{cookie}
}
2012-05-10 23:57:34 -04: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 EndListCookie) Check() error {
return cook.Cookie.Check()
}
2018-09-30 16:32:47 +02:00
// endListRequest writes a EndList request to a byte slice for transfer.
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
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-11 20:43:26 -04:00
// FeedbackBufferCookie is a cookie used only for FeedbackBuffer requests.
type FeedbackBufferCookie struct {
*xgb.Cookie
}
2013-08-11 20:43:26 -04:00
// FeedbackBuffer sends an unchecked request.
2012-05-10 23:57:34 -04:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2018-09-30 16:32:47 +02:00
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-11 20:43:26 -04: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-11 20:43:26 -04:00
c.NewRequest(feedbackBufferRequest(c, ContextTag, Size, Type), cookie)
return FeedbackBufferCookie{cookie}
}
2013-08-11 20:43:26 -04:00
// FeedbackBufferChecked sends a checked request.
2018-09-30 16:32:47 +02:00
// 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-11 20:43:26 -04: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-11 20:43:26 -04:00
c.NewRequest(feedbackBufferRequest(c, ContextTag, Size, Type), cookie)
return FeedbackBufferCookie{cookie}
}
2012-05-10 23:57:34 -04: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-11 20:43:26 -04:00
func (cook FeedbackBufferCookie) Check() error {
return cook.Cookie.Check()
}
2018-09-30 16:32:47 +02:00
// feedbackBufferRequest writes a FeedbackBuffer request to a byte slice for transfer.
func feedbackBufferRequest(c *xgb.Conn, ContextTag ContextTag, Size, Type 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-11 20:43:26 -04:00
buf[b] = 105 // 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-11 20:43:26 -04:00
xgb.Put32(buf[b:], uint32(Size))
b += 4
2013-08-11 20:43:26 -04:00
xgb.Put32(buf[b:], uint32(Type))
b += 4
return buf
}
// FinishCookie is a cookie used only for Finish requests.
type FinishCookie struct {
*xgb.Cookie
}
// Finish sends a checked request.
2018-09-30 16:32:47 +02:00
// If an error occurs, it will be returned with the reply by calling FinishCookie.Reply.
2013-08-11 20:43:26 -04:00
func Finish(c *xgb.Conn, ContextTag ContextTag) FinishCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
2013-08-11 20:43:26 -04:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'Finish' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(finishRequest(c, ContextTag), cookie)
return FinishCookie{cookie}
}
// FinishUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func FinishUnchecked(c *xgb.Conn, ContextTag ContextTag) FinishCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
2013-08-11 20:43:26 -04:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'Finish' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(finishRequest(c, ContextTag), cookie)
return FinishCookie{cookie}
}
// FinishReply represents the data returned from a Finish request.
type FinishReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
}
// 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
}
return finishReply(buf), nil
}
// 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
}
2018-09-30 16:32:47 +02:00
// finishRequest writes a Finish request to a byte slice for transfer.
2013-08-11 20:43:26 -04: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()
2013-08-11 20:43:26 -04:00
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
2013-08-11 20:43:26 -04:00
b += 1
buf[b] = 108 // 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
}
// FlushCookie is a cookie used only for Flush requests.
type FlushCookie struct {
*xgb.Cookie
}
// Flush sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func Flush(c *xgb.Conn, ContextTag ContextTag) FlushCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
2013-08-11 20:43:26 -04:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'Flush' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(flushRequest(c, ContextTag), cookie)
return FlushCookie{cookie}
}
// FlushChecked sends a checked request.
2018-09-30 16:32:47 +02:00
// If an error occurs, it can be retrieved using FlushCookie.Check.
2013-08-11 20:43:26 -04:00
func FlushChecked(c *xgb.Conn, ContextTag ContextTag) FlushCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
2013-08-11 20:43:26 -04:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'Flush' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(flushRequest(c, ContextTag), cookie)
return FlushCookie{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 FlushCookie) Check() error {
return cook.Cookie.Check()
}
2018-09-30 16:32:47 +02:00
// flushRequest writes a Flush request to a byte slice for transfer.
2013-08-11 20:43:26 -04: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()
2013-08-11 20:43:26 -04:00
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
2013-08-11 20:43:26 -04:00
b += 1
buf[b] = 142 // 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
}
2012-05-10 23:57:34 -04:00
// GenListsCookie is a cookie used only for GenLists requests.
type GenListsCookie struct {
*xgb.Cookie
}
2012-05-10 23:57:34 -04:00
// GenLists sends a checked request.
2018-09-30 16:32:47 +02:00
// If an error occurs, it will be returned with the reply by calling GenListsCookie.Reply.
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 {
panic("Cannot issue request 'GenLists' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(genListsRequest(c, ContextTag, Range), cookie)
return GenListsCookie{cookie}
}
2012-05-10 23:57:34 -04: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 {
panic("Cannot issue request 'GenLists' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(genListsRequest(c, ContextTag, Range), cookie)
return GenListsCookie{cookie}
}
2012-05-10 23:57:34 -04:00
// GenListsReply represents the data returned from a GenLists request.
type GenListsReply struct {
2012-05-10 23:57:34 -04:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
RetVal uint32
}
2012-05-10 23:57:34 -04: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
}
2012-05-10 23:57:34 -04:00
// 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
}
2018-09-30 16:32:47 +02:00
// genListsRequest writes a GenLists request to a byte slice for transfer.
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
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
xgb.Put32(buf[b:], uint32(Range))
b += 4
return buf
}
2013-08-11 20:43:26 -04:00
// GenQueriesARBCookie is a cookie used only for GenQueriesARB requests.
type GenQueriesARBCookie struct {
*xgb.Cookie
}
2013-08-11 20:43:26 -04:00
// GenQueriesARB sends a checked request.
2018-09-30 16:32:47 +02:00
// If an error occurs, it will be returned with the reply by calling GenQueriesARBCookie.Reply.
2013-08-11 20:43:26 -04: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-11 20:43:26 -04: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-11 20:43:26 -04:00
c.NewRequest(genQueriesARBRequest(c, ContextTag, N), cookie)
return GenQueriesARBCookie{cookie}
}
2013-08-11 20:43:26 -04:00
// GenQueriesARBUnchecked sends an unchecked request.
2012-05-10 23:57:34 -04:00
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2013-08-11 20:43:26 -04: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-11 20:43:26 -04: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-11 20:43:26 -04:00
c.NewRequest(genQueriesARBRequest(c, ContextTag, N), cookie)
return GenQueriesARBCookie{cookie}
}
2013-08-11 20:43:26 -04:00
// GenQueriesARBReply represents the data returned from a GenQueriesARB request.
type GenQueriesARBReply struct {
2012-05-10 23:57:34 -04: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
2013-08-11 20:43:26 -04:00
Data []uint32 // size: xgb.Pad((int(Length) * 4))
}
2013-08-11 20:43:26 -04: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-11 20:43:26 -04:00
return genQueriesARBReply(buf), nil
}
2013-08-11 20:43:26 -04: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
b += 24 // padding
2013-08-11 20:43:26 -04: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
}
2018-09-30 16:32:47 +02:00
// genQueriesARBRequest writes a GenQueriesARB request to a byte slice for transfer.
2013-08-11 20:43:26 -04: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-11 20:43:26 -04: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-11 20:43:26 -04:00
xgb.Put32(buf[b:], uint32(N))
b += 4
2013-08-11 20:43:26 -04:00
return buf
}
2013-08-11 20:43:26 -04:00
// GenTexturesCookie is a cookie used only for GenTextures requests.
type GenTexturesCookie struct {
*xgb.Cookie
}
2013-08-11 20:43:26 -04:00
// GenTextures sends a checked request.
2018-09-30 16:32:47 +02:00
// If an error occurs, it will be returned with the reply by calling GenTexturesCookie.Reply.
2013-08-11 20:43:26 -04: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()
2013-08-11 20:43:26 -04:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GenTextures' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
2013-08-11 20:43:26 -04:00
cookie := c.NewCookie(true, true)
c.NewRequest(genTexturesRequest(c, ContextTag, N), cookie)
return GenTexturesCookie{cookie}
}
// GenTexturesUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
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()
2013-08-11 20:43:26 -04:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GenTextures' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(genTexturesRequest(c, ContextTag, N), cookie)
return GenTexturesCookie{cookie}
}
// GenTexturesReply represents the data returned from a GenTextures request.
type GenTexturesReply struct {
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 []uint32 // size: xgb.Pad((int(Length) * 4))
}
// 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
}
return genTexturesReply(buf), nil
}
// 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
b += 24 // padding
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
}
2018-09-30 16:32:47 +02:00
// genTexturesRequest writes a GenTextures request to a byte slice for transfer.
2013-08-11 20:43:26 -04: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()
2013-08-11 20:43:26 -04:00
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
b += 1
2013-08-11 20:43:26 -04:00
buf[b] = 145 // request opcode
b += 1
2013-08-11 20:43:26 -04:00
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:], uint32(N))
b += 4
return buf
}
2012-05-10 23:57:34 -04:00
// GetBooleanvCookie is a cookie used only for GetBooleanv requests.
type GetBooleanvCookie struct {
*xgb.Cookie
}
2012-05-10 23:57:34 -04:00
// GetBooleanv sends a checked request.
2018-09-30 16:32:47 +02:00
// If an error occurs, it will be returned with the reply by calling GetBooleanvCookie.Reply.
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 {
panic("Cannot issue request 'GetBooleanv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getBooleanvRequest(c, ContextTag, Pname), cookie)
return GetBooleanvCookie{cookie}
}
2012-05-10 23:57:34 -04:00
// GetBooleanvUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
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 {
panic("Cannot issue request 'GetBooleanv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getBooleanvRequest(c, ContextTag, Pname), cookie)
return GetBooleanvCookie{cookie}
}
2012-05-10 23:57:34 -04:00
// GetBooleanvReply represents the data returned from a GetBooleanv request.
type GetBooleanvReply struct {
2012-05-10 23:57:34 -04: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 bool
// padding: 15 bytes
Data []bool // size: xgb.Pad((int(N) * 1))
}
2012-05-10 23:57:34 -04: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
}
return getBooleanvReply(buf), nil
}
2012-05-10 23:57:34 -04: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
v.N = xgb.Get32(buf[b:])
b += 4
if buf[b] == 1 {
v.Datum = true
} else {
v.Datum = false
}
b += 1
b += 15 // padding
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
}
return v
}
2018-09-30 16:32:47 +02:00
// getBooleanvRequest writes a GetBooleanv request to a byte slice for transfer.
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
buf[b] = 112 // 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:], uint32(Pname))
b += 4
return buf
}
2012-05-10 23:57:34 -04:00
// GetClipPlaneCookie is a cookie used only for GetClipPlane requests.
type GetClipPlaneCookie struct {
*xgb.Cookie
}
2012-05-10 23:57:34 -04:00
// GetClipPlane sends a checked request.
2018-09-30 16:32:47 +02:00
// If an error occurs, it will be returned with the reply by calling GetClipPlaneCookie.Reply.
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 {
panic("Cannot issue request 'GetClipPlane' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getClipPlaneRequest(c, ContextTag, Plane), cookie)
return GetClipPlaneCookie{cookie}
}
2012-05-10 23:57:34 -04:00
// GetClipPlaneUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
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 {
panic("Cannot issue request 'GetClipPlane' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getClipPlaneRequest(c, ContextTag, Plane), cookie)
return GetClipPlaneCookie{cookie}
}
2012-05-10 23:57:34 -04:00
// GetClipPlaneReply represents the data returned from a GetClipPlane request.
type GetClipPlaneReply struct {
2012-05-10 23:57:34 -04: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 []Float64 // size: xgb.Pad(((int(Length) / 2) * 8))
}
2012-05-10 23:57:34 -04: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
}
return getClipPlaneReply(buf), nil
}
2012-05-10 23:57:34 -04: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
b += 24 // padding
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
}
2018-09-30 16:32:47 +02:00
// getClipPlaneRequest writes a GetClipPlane request to a byte slice for transfer.
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
buf[b] = 113 // 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:], uint32(Plane))
b += 4
return buf
}
2013-08-11 20:43:26 -04:00
// GetColorTableCookie is a cookie used only for GetColorTable requests.
type GetColorTableCookie struct {
*xgb.Cookie
}
// GetColorTable sends a checked request.
2018-09-30 16:32:47 +02:00
// 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()
2013-08-11 20:43:26 -04:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetColorTable' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getColorTableRequest(c, ContextTag, Target, Format, Type, SwapBytes), cookie)
return GetColorTableCookie{cookie}
}
// GetColorTableUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2018-09-30 16:32:47 +02:00
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()
2013-08-11 20:43:26 -04:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetColorTable' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getColorTableRequest(c, ContextTag, Target, Format, Type, SwapBytes), cookie)
return GetColorTableCookie{cookie}
}
// 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))
}
// 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
}
if buf == nil {
return nil, nil
}
return getColorTableReply(buf), nil
}
// getColorTableReply reads a byte slice into a GetColorTableReply value.
func getColorTableReply(buf []byte) *GetColorTableReply {
v := new(GetColorTableReply)
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 += 8 // padding
v.Width = int32(xgb.Get32(buf[b:]))
b += 4
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-11 20:43:26 -04:00
return v
}
2018-09-30 16:32:47 +02:00
// 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-11 20:43:26 -04:00
size := 24
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
2013-08-11 20:43:26 -04:00
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
2013-08-11 20:43:26 -04:00
b += 1
buf[b] = 147 // 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:], Format)
b += 4
xgb.Put32(buf[b:], Type)
b += 4
if SwapBytes {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
return buf
}
// GetColorTableParameterfvCookie is a cookie used only for GetColorTableParameterfv requests.
type GetColorTableParameterfvCookie struct {
*xgb.Cookie
}
// GetColorTableParameterfv sends a checked request.
2018-09-30 16:32:47 +02:00
// 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()
2013-08-11 20:43:26 -04:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetColorTableParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getColorTableParameterfvRequest(c, ContextTag, Target, Pname), cookie)
return GetColorTableParameterfvCookie{cookie}
}
// GetColorTableParameterfvUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2018-09-30 16:32:47 +02:00
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()
2013-08-11 20:43:26 -04:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetColorTableParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getColorTableParameterfvRequest(c, ContextTag, Target, Pname), cookie)
return GetColorTableParameterfvCookie{cookie}
}
// GetColorTableParameterfvReply represents the data returned from a GetColorTableParameterfv request.
type GetColorTableParameterfvReply 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 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
}
return getColorTableParameterfvReply(buf), nil
}
// 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
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
}
2018-09-30 16:32:47 +02:00
// getColorTableParameterfvRequest writes a GetColorTableParameterfv request to a byte slice for transfer.
func getColorTableParameterfvRequest(c *xgb.Conn, ContextTag ContextTag, Target, Pname uint32) []byte {
2013-08-11 20:43:26 -04:00
size := 16
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
2013-08-11 20:43:26 -04:00
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
2013-08-11 20:43:26 -04:00
b += 1
buf[b] = 148 // 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
}
// GetColorTableParameterivCookie is a cookie used only for GetColorTableParameteriv requests.
type GetColorTableParameterivCookie struct {
*xgb.Cookie
}
// GetColorTableParameteriv sends a checked request.
2018-09-30 16:32:47 +02:00
// 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()
2013-08-11 20:43:26 -04:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetColorTableParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getColorTableParameterivRequest(c, ContextTag, Target, Pname), cookie)
return GetColorTableParameterivCookie{cookie}
}
// GetColorTableParameterivUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2018-09-30 16:32:47 +02:00
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()
2013-08-11 20:43:26 -04:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetColorTableParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getColorTableParameterivRequest(c, ContextTag, Target, Pname), cookie)
return GetColorTableParameterivCookie{cookie}
}
// GetColorTableParameterivReply represents the data returned from a GetColorTableParameteriv request.
type GetColorTableParameterivReply 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))
}
// 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
}
return getColorTableParameterivReply(buf), nil
}
// 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
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
}
2018-09-30 16:32:47 +02:00
// getColorTableParameterivRequest writes a GetColorTableParameteriv request to a byte slice for transfer.
func getColorTableParameterivRequest(c *xgb.Conn, ContextTag ContextTag, Target, Pname uint32) []byte {
2013-08-11 20:43:26 -04:00
size := 16
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
2013-08-11 20:43:26 -04:00
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
2013-08-11 20:43:26 -04:00
b += 1
buf[b] = 149 // 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
}
// GetCompressedTexImageARBCookie is a cookie used only for GetCompressedTexImageARB requests.
type GetCompressedTexImageARBCookie struct {
*xgb.Cookie
}
// GetCompressedTexImageARB sends a checked request.
2018-09-30 16:32:47 +02:00
// If an error occurs, it will be returned with the reply by calling GetCompressedTexImageARBCookie.Reply.
2013-08-11 20:43:26 -04: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()
2013-08-11 20:43:26 -04:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetCompressedTexImageARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getCompressedTexImageARBRequest(c, ContextTag, Target, Level), cookie)
return GetCompressedTexImageARBCookie{cookie}
}
// 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()
2013-08-11 20:43:26 -04:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetCompressedTexImageARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getCompressedTexImageARBRequest(c, ContextTag, Target, Level), cookie)
return GetCompressedTexImageARBCookie{cookie}
}
// 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))
}
// 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
}
// getCompressedTexImageARBReply reads a byte slice into a GetCompressedTexImageARBReply value.
func getCompressedTexImageARBReply(buf []byte) *GetCompressedTexImageARBReply {
v := new(GetCompressedTexImageARBReply)
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 += 8 // padding
v.Size = int32(xgb.Get32(buf[b:]))
b += 4
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-11 20:43:26 -04:00
return v
}
2018-09-30 16:32:47 +02:00
// getCompressedTexImageARBRequest writes a GetCompressedTexImageARB request to a byte slice for transfer.
2013-08-11 20:43:26 -04: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()
2013-08-11 20:43:26 -04:00
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
2013-08-11 20:43:26 -04:00
b += 1
buf[b] = 160 // 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
return buf
}
// GetConvolutionFilterCookie is a cookie used only for GetConvolutionFilter requests.
type GetConvolutionFilterCookie struct {
*xgb.Cookie
}
// GetConvolutionFilter sends a checked request.
2018-09-30 16:32:47 +02:00
// 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()
2013-08-11 20:43:26 -04:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetConvolutionFilter' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getConvolutionFilterRequest(c, ContextTag, Target, Format, Type, SwapBytes), cookie)
return GetConvolutionFilterCookie{cookie}
}
// GetConvolutionFilterUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2018-09-30 16:32:47 +02:00
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()
2013-08-11 20:43:26 -04:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetConvolutionFilter' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getConvolutionFilterRequest(c, ContextTag, Target, Format, Type, SwapBytes), cookie)
return GetConvolutionFilterCookie{cookie}
}
// GetConvolutionFilterReply represents the data returned from a GetConvolutionFilter request.
type GetConvolutionFilterReply 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
Height int32
// padding: 8 bytes
Data []byte // size: xgb.Pad(((int(Length) * 4) * 1))
}
// 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
}
return getConvolutionFilterReply(buf), nil
}
// 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
b += 8 // padding
v.Width = int32(xgb.Get32(buf[b:]))
b += 4
v.Height = int32(xgb.Get32(buf[b:]))
b += 4
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))
2013-08-11 20:43:26 -04:00
return v
}
2018-09-30 16:32:47 +02:00
// 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-11 20:43:26 -04:00
size := 24
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
2013-08-11 20:43:26 -04:00
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
2013-08-11 20:43:26 -04:00
b += 1
buf[b] = 150 // 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:], Format)
b += 4
xgb.Put32(buf[b:], Type)
b += 4
if SwapBytes {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
return buf
}
// GetConvolutionParameterfvCookie is a cookie used only for GetConvolutionParameterfv requests.
type GetConvolutionParameterfvCookie struct {
*xgb.Cookie
}
// GetConvolutionParameterfv sends a checked request.
2018-09-30 16:32:47 +02:00
// 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()
2013-08-11 20:43:26 -04:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetConvolutionParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getConvolutionParameterfvRequest(c, ContextTag, Target, Pname), cookie)
return GetConvolutionParameterfvCookie{cookie}
}
// GetConvolutionParameterfvUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2018-09-30 16:32:47 +02:00
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()
2013-08-11 20:43:26 -04:00
if _, ok := c.Extensions["GLX"]; !ok {
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
}
return v
}
2018-09-30 16:32:47 +02:00
// getConvolutionParameterfvRequest writes a GetConvolutionParameterfv request to a byte slice for transfer.
func getConvolutionParameterfvRequest(c *xgb.Conn, ContextTag ContextTag, Target, Pname uint32) []byte {
2013-08-11 20:43:26 -04:00
size := 16
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
2013-08-11 20:43:26 -04:00
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
2013-08-11 20:43:26 -04:00
b += 1
buf[b] = 151 // 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
}
// GetConvolutionParameterivCookie is a cookie used only for GetConvolutionParameteriv requests.
type GetConvolutionParameterivCookie struct {
*xgb.Cookie
}
// GetConvolutionParameteriv sends a checked request.
2018-09-30 16:32:47 +02:00
// 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()
2013-08-11 20:43:26 -04:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetConvolutionParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getConvolutionParameterivRequest(c, ContextTag, Target, Pname), cookie)
return GetConvolutionParameterivCookie{cookie}
}
// GetConvolutionParameterivUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
2018-09-30 16:32:47 +02:00
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()
2013-08-11 20:43:26 -04:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetConvolutionParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getConvolutionParameterivRequest(c, ContextTag, Target, Pname), cookie)
return GetConvolutionParameterivCookie{cookie}
}
// 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))
}
// 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
}
// getConvolutionParameterivReply reads a byte slice into a GetConvolutionParameterivReply value.
func getConvolutionParameterivReply(buf []byte) *GetConvolutionParameterivReply {
v := new(GetConvolutionParameterivReply)
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
}
2018-09-30 16:32:47 +02:00
// getConvolutionParameterivRequest writes a GetConvolutionParameteriv request to a byte slice for transfer.
func getConvolutionParameterivRequest(c *xgb.Conn, ContextTag ContextTag, Target, Pname uint32) []byte {
2013-08-11 20:43:26 -04:00
size := 16
b := 0
buf := make([]byte, size)
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
2013-08-11 20:43:26 -04:00
buf[b] = c.Extensions["GLX"]
2016-03-01 15:41:38 +01:00
c.ExtLock.RUnlock()
2013-08-11 20:43:26 -04:00
b += 1
buf[b] = 152 // 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-10 23:57:34 -04:00
// GetDoublevCookie is a cookie used only for GetDoublev requests.
type GetDoublevCookie struct {
*xgb.Cookie
}
2012-05-10 23:57:34 -04:00
// GetDoublev sends a checked request.
2018-09-30 16:32:47 +02:00
// If an error occurs, it will be returned with the reply by calling GetDoublevCookie.Reply.
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 {
panic("Cannot issue request 'GetDoublev' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getDoublevRequest(c, ContextTag, Pname), cookie)
return GetDoublevCookie{cookie}
}
2012-05-10 23:57:34 -04: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 {
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}
}
2012-05-10 23:57:34 -04:00
// GetDoublevReply represents the data returned from a GetDoublev request.
type GetDoublevReply struct {
2012-05-10 23:57:34 -04: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-10 23:57:34 -04:00
// 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
}
2012-05-10 23:57:34 -04:00
// 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
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
}
2018-09-30 16:32:47 +02:00
// getDoublevRequest writes a GetDoublev request to a byte slice for transfer.
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
buf[b] = 114 // 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-11 20:43:26 -04:00
// GetDrawableAttributesCookie is a cookie used only for GetDrawableAttributes requests.
type GetDrawableAttributesCookie struct {
*xgb.Cookie
}
// GetDrawableAttributes sends a checked request.
2018-09-30 16:32:47 +02:00
// If an error occurs, it will be returned with the reply by calling GetDrawableAttributesCookie.Reply.
2013-08-11 20:43:26 -04:00
func GetDrawableAttributes(c *xgb.Conn, Drawable Drawable) GetDrawableAttributesCookie {
2016-03-01 15:41:38 +01:00
c.ExtLock.RLock()
defer c.ExtLock.RUnlock()
2013-08-11 20:43:26 -04:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetDrawableAttributes' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getDrawableAttributesRequest(c, Drawable), cookie)
return GetDrawableAttributesCookie{cookie}
}
// 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()
2013-08-11 20:43:26 -04:00
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetDrawableAttributes' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getDrawableAttributesRequest(c, Drawable), cookie)
return GetDrawableAttributesCookie{cookie}
}
// GetDrawableAttributesReply represents the data returned from a GetDrawableAttributes request.
type GetDrawableAttributesReply struct {