haven/nexgb/glx/glx.go

10167 lines
296 KiB
Go
Raw Normal View History

2012-05-11 02:06:22 +02:00
// Package glx is the X client API for the GLX extension.
package glx
/*
This file was generated by glx.xml on May 11 2012 11:57:19pm EDT.
This file is automatically generated. Edit at your peril!
*/
import (
"github.com/BurntSushi/xgb"
"github.com/BurntSushi/xgb/xproto"
)
// 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.")
}
xgb.ExtLock.Lock()
c.Extensions["GLX"] = reply.MajorOpcode
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
}
xgb.ExtLock.Unlock()
return nil
}
func init() {
xgb.NewExtEventFuncs["GLX"] = make(map[int]xgb.NewEventFun)
xgb.NewExtErrorFuncs["GLX"] = make(map[int]xgb.NewErrorFun)
}
2012-05-11 02:06:22 +02:00
// Skipping definition for base type 'Float'
// Skipping definition for base type 'Card8'
// Skipping definition for base type 'Int16'
// Skipping definition for base type 'Int32'
// Skipping definition for base type 'Void'
// Skipping definition for base type 'Byte'
// Skipping definition for base type 'Int8'
// Skipping definition for base type 'Card16'
// Skipping definition for base type 'Char'
// Skipping definition for base type 'Card32'
// Skipping definition for base type 'Double'
// Skipping definition for base type 'Bool'
const (
PbcetDamaged = 32791
PbcetSaved = 32792
)
const (
PbcdtWindow = 32793
PbcdtPbuffer = 32794
)
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
)
const (
RmGlRender = 7168
RmGlFeedback = 7169
RmGlSelect = 7170
)
type Pixmap uint32
func NewPixmapId(c *xgb.Conn) (Pixmap, error) {
id, err := c.NewId()
if err != nil {
return 0, err
}
return Pixmap(id), nil
}
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 Pbuffer uint32
func NewPbufferId(c *xgb.Conn) (Pbuffer, error) {
id, err := c.NewId()
if err != nil {
return 0, err
}
return Pbuffer(id), nil
}
type Window uint32
func NewWindowId(c *xgb.Conn) (Window, error) {
id, err := c.NewId()
if err != nil {
return 0, err
}
return Window(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 Drawable uint32
func NewDrawableId(c *xgb.Conn) (Drawable, error) {
id, err := c.NewId()
if err != nil {
return 0, err
}
return Drawable(id), nil
}
type Float32 float64
type Float64 float64
type Bool32 uint32
type ContextTag uint32
2012-05-11 05:57:34 +02:00
// PbufferClobber is the event number for a PbufferClobberEvent.
const PbufferClobber = 0
type PbufferClobberEvent struct {
Sequence uint16
// padding: 1 bytes
EventType uint16
DrawType uint16
Drawable Drawable
BMask uint32
AuxBuffer uint16
X uint16
Y uint16
Width uint16
Height uint16
Count uint16
// padding: 4 bytes
}
2012-05-11 05:57:34 +02:00
// PbufferClobberEventNew constructs a PbufferClobberEvent value that implements xgb.Event from a byte slice.
func PbufferClobberEventNew(buf []byte) xgb.Event {
v := PbufferClobberEvent{}
b := 1 // don't read event number
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.EventType = xgb.Get16(buf[b:])
b += 2
v.DrawType = xgb.Get16(buf[b:])
b += 2
v.Drawable = Drawable(xgb.Get32(buf[b:]))
b += 4
v.BMask = xgb.Get32(buf[b:])
b += 4
v.AuxBuffer = xgb.Get16(buf[b:])
b += 2
v.X = xgb.Get16(buf[b:])
b += 2
v.Y = xgb.Get16(buf[b:])
b += 2
v.Width = xgb.Get16(buf[b:])
b += 2
v.Height = xgb.Get16(buf[b:])
b += 2
v.Count = xgb.Get16(buf[b:])
b += 2
b += 4 // padding
return v
}
2012-05-11 05:57:34 +02:00
// Bytes writes a PbufferClobberEvent value to a byte slice.
func (v PbufferClobberEvent) Bytes() []byte {
buf := make([]byte, 32)
b := 0
// write event number
buf[b] = 0
b += 1
b += 1 // padding
b += 2 // skip sequence number
xgb.Put16(buf[b:], v.EventType)
b += 2
xgb.Put16(buf[b:], v.DrawType)
b += 2
xgb.Put32(buf[b:], uint32(v.Drawable))
b += 4
xgb.Put32(buf[b:], v.BMask)
b += 4
xgb.Put16(buf[b:], v.AuxBuffer)
b += 2
xgb.Put16(buf[b:], v.X)
b += 2
xgb.Put16(buf[b:], v.Y)
b += 2
xgb.Put16(buf[b:], v.Width)
b += 2
xgb.Put16(buf[b:], v.Height)
b += 2
xgb.Put16(buf[b:], v.Count)
b += 2
b += 4 // padding
return buf
}
2012-05-11 05:57:34 +02:00
// SequenceId returns the sequence id attached to the PbufferClobber event.
// Events without a sequence number (KeymapNotify) return 0.
// This is mostly used internally.
func (v PbufferClobberEvent) SequenceId() uint16 {
return v.Sequence
}
2012-05-11 05:57:34 +02:00
// String is a rudimentary string representation of PbufferClobberEvent.
func (v PbufferClobberEvent) String() string {
fieldVals := make([]string, 0, 12)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("EventType: %d", v.EventType))
fieldVals = append(fieldVals, xgb.Sprintf("DrawType: %d", v.DrawType))
fieldVals = append(fieldVals, xgb.Sprintf("Drawable: %d", v.Drawable))
fieldVals = append(fieldVals, xgb.Sprintf("BMask: %d", v.BMask))
fieldVals = append(fieldVals, xgb.Sprintf("AuxBuffer: %d", v.AuxBuffer))
fieldVals = append(fieldVals, xgb.Sprintf("X: %d", v.X))
fieldVals = append(fieldVals, xgb.Sprintf("Y: %d", v.Y))
fieldVals = append(fieldVals, xgb.Sprintf("Width: %d", v.Width))
fieldVals = append(fieldVals, xgb.Sprintf("Height: %d", v.Height))
fieldVals = append(fieldVals, xgb.Sprintf("Count: %d", v.Count))
return "PbufferClobber {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewExtEventFuncs["GLX"][0] = PbufferClobberEventNew
}
2012-05-11 05:57:34 +02: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
}
2012-05-11 05:57:34 +02:00
// GenericErrorNew constructs a GenericError value that implements xgb.Error from a byte slice.
func GenericErrorNew(buf []byte) xgb.Error {
v := GenericError{}
v.NiceName = "Generic"
b := 1 // skip error determinant
b += 1 // don't read error number
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.BadValue = xgb.Get32(buf[b:])
b += 4
v.MinorOpcode = xgb.Get16(buf[b:])
b += 2
v.MajorOpcode = buf[b]
b += 1
b += 21 // padding
return v
}
2012-05-11 05:57:34 +02:00
// SequenceId returns the sequence id attached to the BadGeneric error.
// This is mostly used internally.
func (err GenericError) SequenceId() uint16 {
return err.Sequence
}
2012-05-11 07:58:52 +02:00
// BadId returns the 'BadValue' number if one exists for the BadGeneric error. If no bad value exists, 0 is returned.
func (err GenericError) BadId() uint32 {
return 0
}
2012-05-11 07:58:52 +02:00
// 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
}
2012-05-11 05:57:34 +02:00
// BadBadContext is the error number for a BadBadContext.
const BadBadContext = 0
type BadContextError GenericError
2012-05-11 05:57:34 +02: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
}
2012-05-11 05:57:34 +02:00
// SequenceId returns the sequence id attached to the BadBadContext error.
// This is mostly used internally.
func (err BadContextError) SequenceId() uint16 {
return err.Sequence
}
2012-05-11 07:58:52 +02: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
}
2012-05-11 07:58:52 +02: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, ", ") + "}"
}
func init() {
xgb.NewExtErrorFuncs["GLX"][0] = BadContextErrorNew
}
2012-05-11 05:57:34 +02:00
// BadBadContextState is the error number for a BadBadContextState.
const BadBadContextState = 1
type BadContextStateError GenericError
2012-05-11 05:57:34 +02: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
}
2012-05-11 05:57:34 +02:00
// SequenceId returns the sequence id attached to the BadBadContextState error.
// This is mostly used internally.
func (err BadContextStateError) SequenceId() uint16 {
return err.Sequence
}
2012-05-11 07:58:52 +02: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-05-11 07:58:52 +02: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, ", ") + "}"
}
func init() {
xgb.NewExtErrorFuncs["GLX"][1] = BadContextStateErrorNew
}
2012-05-11 05:57:34 +02:00
// BadBadDrawable is the error number for a BadBadDrawable.
const BadBadDrawable = 2
type BadDrawableError GenericError
2012-05-11 05:57:34 +02:00
// 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
}
2012-05-11 05:57:34 +02:00
// SequenceId returns the sequence id attached to the BadBadDrawable error.
// This is mostly used internally.
func (err BadDrawableError) SequenceId() uint16 {
return err.Sequence
}
2012-05-11 07:58:52 +02:00
// 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
}
2012-05-11 07:58:52 +02:00
// 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
}
2012-05-11 05:57:34 +02:00
// BadBadPixmap is the error number for a BadBadPixmap.
const BadBadPixmap = 3
type BadPixmapError GenericError
2012-05-11 05:57:34 +02:00
// BadPixmapErrorNew constructs a BadPixmapError value that implements xgb.Error from a byte slice.
func BadPixmapErrorNew(buf []byte) xgb.Error {
v := BadPixmapError(GenericErrorNew(buf).(GenericError))
v.NiceName = "BadPixmap"
return v
}
2012-05-11 05:57:34 +02:00
// SequenceId returns the sequence id attached to the BadBadPixmap error.
// This is mostly used internally.
func (err BadPixmapError) SequenceId() uint16 {
return err.Sequence
}
2012-05-11 07:58:52 +02:00
// BadId returns the 'BadValue' number if one exists for the BadBadPixmap error. If no bad value exists, 0 is returned.
func (err BadPixmapError) BadId() uint32 {
return 0
}
2012-05-11 07:58:52 +02:00
// Error returns a rudimentary string representation of the BadBadPixmap error.
func (err BadPixmapError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode))
return "BadBadPixmap {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewExtErrorFuncs["GLX"][3] = BadPixmapErrorNew
}
2012-05-11 05:57:34 +02:00
// BadBadContextTag is the error number for a BadBadContextTag.
const BadBadContextTag = 4
type BadContextTagError GenericError
2012-05-11 05:57:34 +02:00
// 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
}
2012-05-11 05:57:34 +02:00
// SequenceId returns the sequence id attached to the BadBadContextTag error.
// This is mostly used internally.
func (err BadContextTagError) SequenceId() uint16 {
return err.Sequence
}
2012-05-11 07:58:52 +02:00
// 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
}
2012-05-11 07:58:52 +02:00
// 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
}
2012-05-11 05:57:34 +02:00
// BadBadCurrentWindow is the error number for a BadBadCurrentWindow.
const BadBadCurrentWindow = 5
type BadCurrentWindowError GenericError
2012-05-11 05:57:34 +02:00
// 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
}
2012-05-11 05:57:34 +02:00
// SequenceId returns the sequence id attached to the BadBadCurrentWindow error.
// This is mostly used internally.
func (err BadCurrentWindowError) SequenceId() uint16 {
return err.Sequence
}
2012-05-11 07:58:52 +02:00
// 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
}
2012-05-11 07:58:52 +02:00
// 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
}
2012-05-11 05:57:34 +02:00
// BadBadRenderRequest is the error number for a BadBadRenderRequest.
const BadBadRenderRequest = 6
type BadRenderRequestError GenericError
2012-05-11 05:57:34 +02:00
// BadRenderRequestErrorNew constructs a BadRenderRequestError value that implements xgb.Error from a byte slice.
func BadRenderRequestErrorNew(buf []byte) xgb.Error {
v := BadRenderRequestError(GenericErrorNew(buf).(GenericError))
v.NiceName = "BadRenderRequest"
return v
}
2012-05-11 05:57:34 +02:00
// SequenceId returns the sequence id attached to the BadBadRenderRequest error.
// This is mostly used internally.
func (err BadRenderRequestError) SequenceId() uint16 {
return err.Sequence
}
2012-05-11 07:58:52 +02:00
// 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
}
2012-05-11 07:58:52 +02:00
// 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
}
2012-05-11 05:57:34 +02:00
// BadBadLargeRequest is the error number for a BadBadLargeRequest.
const BadBadLargeRequest = 7
type BadLargeRequestError GenericError
2012-05-11 05:57:34 +02:00
// 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
}
2012-05-11 05:57:34 +02:00
// SequenceId returns the sequence id attached to the BadBadLargeRequest error.
// This is mostly used internally.
func (err BadLargeRequestError) SequenceId() uint16 {
return err.Sequence
}
2012-05-11 07:58:52 +02:00
// 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
}
2012-05-11 07:58:52 +02:00
// 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
}
2012-05-11 05:57:34 +02:00
// BadUnsupportedPrivateRequest is the error number for a BadUnsupportedPrivateRequest.
const BadUnsupportedPrivateRequest = 8
type UnsupportedPrivateRequestError GenericError
2012-05-11 05:57:34 +02:00
// UnsupportedPrivateRequestErrorNew constructs a UnsupportedPrivateRequestError value that implements xgb.Error from a byte slice.
func UnsupportedPrivateRequestErrorNew(buf []byte) xgb.Error {
v := UnsupportedPrivateRequestError(GenericErrorNew(buf).(GenericError))
v.NiceName = "UnsupportedPrivateRequest"
return v
}
2012-05-11 05:57:34 +02: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 07:58:52 +02:00
// BadId returns the 'BadValue' number if one exists for the BadUnsupportedPrivateRequest error. If no bad value exists, 0 is returned.
func (err UnsupportedPrivateRequestError) BadId() uint32 {
return 0
}
2012-05-11 07:58:52 +02:00
// Error returns a rudimentary string representation of the BadUnsupportedPrivateRequest error.
func (err UnsupportedPrivateRequestError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode))
return "BadUnsupportedPrivateRequest {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewExtErrorFuncs["GLX"][8] = UnsupportedPrivateRequestErrorNew
}
2012-05-11 05:57:34 +02:00
// BadBadFBConfig is the error number for a BadBadFBConfig.
const BadBadFBConfig = 9
type BadFBConfigError GenericError
2012-05-11 05:57:34 +02:00
// 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
}
2012-05-11 05:57:34 +02:00
// SequenceId returns the sequence id attached to the BadBadFBConfig error.
// This is mostly used internally.
func (err BadFBConfigError) SequenceId() uint16 {
return err.Sequence
}
2012-05-11 07:58:52 +02:00
// 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
}
2012-05-11 07:58:52 +02:00
// 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
}
2012-05-11 05:57:34 +02:00
// BadBadPbuffer is the error number for a BadBadPbuffer.
const BadBadPbuffer = 10
type BadPbufferError GenericError
2012-05-11 05:57:34 +02:00
// 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
}
2012-05-11 05:57:34 +02:00
// SequenceId returns the sequence id attached to the BadBadPbuffer error.
// This is mostly used internally.
func (err BadPbufferError) SequenceId() uint16 {
return err.Sequence
}
2012-05-11 07:58:52 +02:00
// BadId returns the 'BadValue' number if one exists for the BadBadPbuffer error. If no bad value exists, 0 is returned.
func (err BadPbufferError) BadId() uint32 {
return 0
}
2012-05-11 07:58:52 +02:00
// Error returns a rudimentary string representation of the BadBadPbuffer error.
func (err BadPbufferError) Error() string {
fieldVals := make([]string, 0, 4)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue))
fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode))
fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode))
return "BadBadPbuffer {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewExtErrorFuncs["GLX"][10] = BadPbufferErrorNew
}
2012-05-11 05:57:34 +02:00
// BadBadCurrentDrawable is the error number for a BadBadCurrentDrawable.
const BadBadCurrentDrawable = 11
type BadCurrentDrawableError GenericError
2012-05-11 05:57:34 +02:00
// 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
}
2012-05-11 05:57:34 +02:00
// SequenceId returns the sequence id attached to the BadBadCurrentDrawable error.
// This is mostly used internally.
func (err BadCurrentDrawableError) SequenceId() uint16 {
return err.Sequence
}
2012-05-11 07:58:52 +02:00
// 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
}
2012-05-11 07:58:52 +02:00
// 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
}
2012-05-11 05:57:34 +02:00
// BadBadWindow is the error number for a BadBadWindow.
const BadBadWindow = 12
type BadWindowError GenericError
2012-05-11 05:57:34 +02:00
// 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
}
2012-05-11 05:57:34 +02:00
// SequenceId returns the sequence id attached to the BadBadWindow error.
// This is mostly used internally.
func (err BadWindowError) SequenceId() uint16 {
return err.Sequence
}
2012-05-11 07:58:52 +02:00
// 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
}
2012-05-11 07:58:52 +02:00
// 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
}
2012-05-11 05:57:34 +02:00
// BadGLXBadProfileARB is the error number for a BadGLXBadProfileARB.
const BadGLXBadProfileARB = 13
type GLXBadProfileARBError GenericError
2012-05-11 05:57:34 +02:00
// 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
}
2012-05-11 05:57:34 +02:00
// SequenceId returns the sequence id attached to the BadGLXBadProfileARB error.
// This is mostly used internally.
func (err GLXBadProfileARBError) SequenceId() uint16 {
return err.Sequence
}
2012-05-11 07:58:52 +02:00
// 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
}
2012-05-11 07:58:52 +02:00
// 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
}
2012-05-11 05:57:34 +02:00
// RenderCookie is a cookie used only for Render requests.
type RenderCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// Render sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func Render(c *xgb.Conn, ContextTag ContextTag, Data []byte) RenderCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'Render' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(renderRequest(c, ContextTag, Data), cookie)
return RenderCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// RenderChecked sends a checked request.
// If an error occurs, it can be retrieved using RenderCookie.Check()
func RenderChecked(c *xgb.Conn, ContextTag ContextTag, Data []byte) RenderCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'Render' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(renderRequest(c, ContextTag, Data), cookie)
return RenderCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook RenderCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for Render
2012-05-11 05:57:34 +02:00
// renderRequest writes a Render request to a byte slice.
func renderRequest(c *xgb.Conn, ContextTag ContextTag, Data []byte) []byte {
size := xgb.Pad((8 + xgb.Pad((len(Data) * 1))))
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 1 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
copy(buf[b:], Data[:len(Data)])
b += xgb.Pad(int(len(Data)))
return buf
}
2012-05-11 05:57:34 +02:00
// RenderLargeCookie is a cookie used only for RenderLarge requests.
type RenderLargeCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// RenderLarge sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func RenderLarge(c *xgb.Conn, ContextTag ContextTag, RequestNum uint16, RequestTotal uint16, DataLen uint32, Data []byte) RenderLargeCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'RenderLarge' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(renderLargeRequest(c, ContextTag, RequestNum, RequestTotal, DataLen, Data), cookie)
return RenderLargeCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// RenderLargeChecked sends a checked request.
// If an error occurs, it can be retrieved using RenderLargeCookie.Check()
func RenderLargeChecked(c *xgb.Conn, ContextTag ContextTag, RequestNum uint16, RequestTotal uint16, DataLen uint32, Data []byte) RenderLargeCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'RenderLarge' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(renderLargeRequest(c, ContextTag, RequestNum, RequestTotal, DataLen, Data), cookie)
return RenderLargeCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook RenderLargeCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for RenderLarge
2012-05-11 05:57:34 +02:00
// renderLargeRequest writes a RenderLarge request to a byte slice.
func renderLargeRequest(c *xgb.Conn, ContextTag ContextTag, RequestNum uint16, RequestTotal uint16, DataLen uint32, Data []byte) []byte {
size := xgb.Pad((16 + xgb.Pad((int(DataLen) * 1))))
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 2 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
xgb.Put16(buf[b:], RequestNum)
b += 2
xgb.Put16(buf[b:], RequestTotal)
b += 2
xgb.Put32(buf[b:], DataLen)
b += 4
copy(buf[b:], Data[:DataLen])
b += xgb.Pad(int(DataLen))
return buf
}
2012-05-11 05:57:34 +02:00
// CreateContextCookie is a cookie used only for CreateContext requests.
type CreateContextCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// CreateContext sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func CreateContext(c *xgb.Conn, Context Context, Visual xproto.Visualid, Screen uint32, ShareList Context, IsDirect bool) CreateContextCookie {
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-11 05:57:34 +02:00
// CreateContextChecked sends a checked request.
// 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 {
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-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook CreateContextCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for CreateContext
2012-05-11 05:57:34 +02:00
// createContextRequest writes a CreateContext request to a byte slice.
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)
buf[b] = c.Extensions["GLX"]
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
}
2012-05-11 05:57:34 +02:00
// DestroyContextCookie is a cookie used only for DestroyContext requests.
type DestroyContextCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// DestroyContext sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func DestroyContext(c *xgb.Conn, Context Context) DestroyContextCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'DestroyContext' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(destroyContextRequest(c, Context), cookie)
return DestroyContextCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// DestroyContextChecked sends a checked request.
// If an error occurs, it can be retrieved using DestroyContextCookie.Check()
func DestroyContextChecked(c *xgb.Conn, Context Context) DestroyContextCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'DestroyContext' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(destroyContextRequest(c, Context), cookie)
return DestroyContextCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook DestroyContextCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for DestroyContext
2012-05-11 05:57:34 +02:00
// destroyContextRequest writes a DestroyContext request to a byte slice.
func destroyContextRequest(c *xgb.Conn, Context Context) []byte {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
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
}
2012-05-11 05:57:34 +02:00
// MakeCurrentCookie is a cookie used only for MakeCurrent requests.
type MakeCurrentCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// MakeCurrent sends a checked request.
// If an error occurs, it will be returned with the reply by calling MakeCurrentCookie.Reply()
func MakeCurrent(c *xgb.Conn, Drawable Drawable, Context Context, OldContextTag ContextTag) MakeCurrentCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'MakeCurrent' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(makeCurrentRequest(c, Drawable, Context, OldContextTag), cookie)
return MakeCurrentCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// MakeCurrentUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func MakeCurrentUnchecked(c *xgb.Conn, Drawable Drawable, Context Context, OldContextTag ContextTag) MakeCurrentCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'MakeCurrent' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(makeCurrentRequest(c, Drawable, Context, OldContextTag), cookie)
return MakeCurrentCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// MakeCurrentReply represents the data returned from a MakeCurrent request.
type MakeCurrentReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
ContextTag ContextTag
// padding: 20 bytes
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a MakeCurrent request.
func (cook MakeCurrentCookie) Reply() (*MakeCurrentReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return makeCurrentReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// makeCurrentReply reads a byte slice into a MakeCurrentReply value.
func makeCurrentReply(buf []byte) *MakeCurrentReply {
v := new(MakeCurrentReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
v.ContextTag = ContextTag(xgb.Get32(buf[b:]))
b += 4
b += 20 // padding
return v
}
// Write request to wire for MakeCurrent
2012-05-11 05:57:34 +02:00
// makeCurrentRequest writes a MakeCurrent request to a byte slice.
func makeCurrentRequest(c *xgb.Conn, Drawable Drawable, Context Context, OldContextTag ContextTag) []byte {
size := 16
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 5 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(Drawable))
b += 4
xgb.Put32(buf[b:], uint32(Context))
b += 4
xgb.Put32(buf[b:], uint32(OldContextTag))
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// IsDirectCookie is a cookie used only for IsDirect requests.
type IsDirectCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// IsDirect sends a checked request.
// If an error occurs, it will be returned with the reply by calling IsDirectCookie.Reply()
func IsDirect(c *xgb.Conn, Context Context) IsDirectCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'IsDirect' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(isDirectRequest(c, Context), cookie)
return IsDirectCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// IsDirectUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func IsDirectUnchecked(c *xgb.Conn, Context Context) IsDirectCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'IsDirect' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(isDirectRequest(c, Context), cookie)
return IsDirectCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// IsDirectReply represents the data returned from a IsDirect request.
type IsDirectReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
IsDirect bool
// padding: 23 bytes
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a IsDirect request.
func (cook IsDirectCookie) Reply() (*IsDirectReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return isDirectReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// isDirectReply reads a byte slice into a IsDirectReply value.
func isDirectReply(buf []byte) *IsDirectReply {
v := new(IsDirectReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
if buf[b] == 1 {
v.IsDirect = true
} else {
v.IsDirect = false
}
b += 1
b += 23 // padding
return v
}
// Write request to wire for IsDirect
2012-05-11 05:57:34 +02:00
// isDirectRequest writes a IsDirect request to a byte slice.
func isDirectRequest(c *xgb.Conn, Context Context) []byte {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 6 // 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
}
2012-05-11 05:57:34 +02:00
// QueryVersionCookie is a cookie used only for QueryVersion requests.
type QueryVersionCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// QueryVersion sends a checked request.
// If an error occurs, it will be returned with the reply by calling QueryVersionCookie.Reply()
func QueryVersion(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32) QueryVersionCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(queryVersionRequest(c, MajorVersion, MinorVersion), cookie)
return QueryVersionCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// QueryVersionUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func QueryVersionUnchecked(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32) QueryVersionCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(queryVersionRequest(c, MajorVersion, MinorVersion), cookie)
return QueryVersionCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// QueryVersionReply represents the data returned from a QueryVersion request.
type QueryVersionReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
MajorVersion uint32
MinorVersion uint32
// padding: 16 bytes
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a QueryVersion request.
func (cook QueryVersionCookie) Reply() (*QueryVersionReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return queryVersionReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// queryVersionReply reads a byte slice into a QueryVersionReply value.
func queryVersionReply(buf []byte) *QueryVersionReply {
v := new(QueryVersionReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
v.MajorVersion = xgb.Get32(buf[b:])
b += 4
v.MinorVersion = xgb.Get32(buf[b:])
b += 4
b += 16 // padding
return v
}
// Write request to wire for QueryVersion
2012-05-11 05:57:34 +02:00
// queryVersionRequest writes a QueryVersion request to a byte slice.
func queryVersionRequest(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32) []byte {
size := 12
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 7 // 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
return buf
}
2012-05-11 05:57:34 +02:00
// WaitGLCookie is a cookie used only for WaitGL requests.
type WaitGLCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// WaitGL sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func WaitGL(c *xgb.Conn, ContextTag ContextTag) WaitGLCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'WaitGL' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(waitGLRequest(c, ContextTag), cookie)
return WaitGLCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// WaitGLChecked sends a checked request.
// If an error occurs, it can be retrieved using WaitGLCookie.Check()
func WaitGLChecked(c *xgb.Conn, ContextTag ContextTag) WaitGLCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'WaitGL' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(waitGLRequest(c, ContextTag), cookie)
return WaitGLCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook WaitGLCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for WaitGL
2012-05-11 05:57:34 +02:00
// waitGLRequest writes a WaitGL request to a byte slice.
func waitGLRequest(c *xgb.Conn, ContextTag ContextTag) []byte {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 8 // 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-11 05:57:34 +02:00
// WaitXCookie is a cookie used only for WaitX requests.
type WaitXCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// WaitX sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func WaitX(c *xgb.Conn, ContextTag ContextTag) WaitXCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'WaitX' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(waitXRequest(c, ContextTag), cookie)
return WaitXCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// WaitXChecked sends a checked request.
// If an error occurs, it can be retrieved using WaitXCookie.Check()
func WaitXChecked(c *xgb.Conn, ContextTag ContextTag) WaitXCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'WaitX' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(waitXRequest(c, ContextTag), cookie)
return WaitXCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook WaitXCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for WaitX
2012-05-11 05:57:34 +02:00
// waitXRequest writes a WaitX request to a byte slice.
func waitXRequest(c *xgb.Conn, ContextTag ContextTag) []byte {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 9 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// CopyContextCookie is a cookie used only for CopyContext requests.
type CopyContextCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// CopyContext sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func CopyContext(c *xgb.Conn, Src Context, Dest Context, Mask uint32, SrcContextTag ContextTag) CopyContextCookie {
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}
}
2012-05-11 05:57:34 +02:00
// CopyContextChecked sends a checked request.
// If an error occurs, it can be retrieved using CopyContextCookie.Check()
func CopyContextChecked(c *xgb.Conn, Src Context, Dest Context, Mask uint32, SrcContextTag ContextTag) CopyContextCookie {
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}
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook CopyContextCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for CopyContext
2012-05-11 05:57:34 +02:00
// copyContextRequest writes a CopyContext request to a byte slice.
func copyContextRequest(c *xgb.Conn, Src Context, Dest Context, Mask uint32, SrcContextTag ContextTag) []byte {
size := 20
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
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-11 05:57:34 +02:00
// SwapBuffersCookie is a cookie used only for SwapBuffers requests.
type SwapBuffersCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// SwapBuffers sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func SwapBuffers(c *xgb.Conn, ContextTag ContextTag, Drawable Drawable) SwapBuffersCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'SwapBuffers' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(swapBuffersRequest(c, ContextTag, Drawable), cookie)
return SwapBuffersCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// SwapBuffersChecked sends a checked request.
// If an error occurs, it can be retrieved using SwapBuffersCookie.Check()
func SwapBuffersChecked(c *xgb.Conn, ContextTag ContextTag, Drawable Drawable) SwapBuffersCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'SwapBuffers' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(swapBuffersRequest(c, ContextTag, Drawable), cookie)
return SwapBuffersCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook SwapBuffersCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for SwapBuffers
2012-05-11 05:57:34 +02:00
// swapBuffersRequest writes a SwapBuffers request to a byte slice.
func swapBuffersRequest(c *xgb.Conn, ContextTag ContextTag, Drawable Drawable) []byte {
size := 12
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 11 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
xgb.Put32(buf[b:], uint32(Drawable))
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// UseXFontCookie is a cookie used only for UseXFont requests.
type UseXFontCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// UseXFont sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func UseXFont(c *xgb.Conn, ContextTag ContextTag, Font xproto.Font, First uint32, Count uint32, ListBase uint32) UseXFontCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'UseXFont' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(useXFontRequest(c, ContextTag, Font, First, Count, ListBase), cookie)
return UseXFontCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// UseXFontChecked sends a checked request.
// If an error occurs, it can be retrieved using UseXFontCookie.Check()
func UseXFontChecked(c *xgb.Conn, ContextTag ContextTag, Font xproto.Font, First uint32, Count uint32, ListBase uint32) UseXFontCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'UseXFont' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(useXFontRequest(c, ContextTag, Font, First, Count, ListBase), cookie)
return UseXFontCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook UseXFontCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for UseXFont
2012-05-11 05:57:34 +02:00
// useXFontRequest writes a UseXFont request to a byte slice.
func useXFontRequest(c *xgb.Conn, ContextTag ContextTag, Font xproto.Font, First uint32, Count uint32, ListBase uint32) []byte {
size := 24
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 12 // 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(Font))
b += 4
xgb.Put32(buf[b:], First)
b += 4
xgb.Put32(buf[b:], Count)
b += 4
xgb.Put32(buf[b:], ListBase)
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// CreateGLXPixmapCookie is a cookie used only for CreateGLXPixmap requests.
type CreateGLXPixmapCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// CreateGLXPixmap sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func CreateGLXPixmap(c *xgb.Conn, Screen uint32, Visual xproto.Visualid, Pixmap xproto.Pixmap, GlxPixmap Pixmap) CreateGLXPixmapCookie {
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-11 05:57:34 +02:00
// CreateGLXPixmapChecked sends a checked request.
// 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 {
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-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook CreateGLXPixmapCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for CreateGLXPixmap
2012-05-11 05:57:34 +02:00
// createGLXPixmapRequest writes a CreateGLXPixmap request to a byte slice.
func createGLXPixmapRequest(c *xgb.Conn, Screen uint32, Visual xproto.Visualid, Pixmap xproto.Pixmap, GlxPixmap Pixmap) []byte {
size := 20
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
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-11 05:57:34 +02:00
// GetVisualConfigsCookie is a cookie used only for GetVisualConfigs requests.
type GetVisualConfigsCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetVisualConfigs sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetVisualConfigsCookie.Reply()
func GetVisualConfigs(c *xgb.Conn, Screen uint32) GetVisualConfigsCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetVisualConfigs' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getVisualConfigsRequest(c, Screen), cookie)
return GetVisualConfigsCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetVisualConfigsUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetVisualConfigsUnchecked(c *xgb.Conn, Screen uint32) GetVisualConfigsCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetVisualConfigs' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getVisualConfigsRequest(c, Screen), cookie)
return GetVisualConfigsCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetVisualConfigsReply represents the data returned from a GetVisualConfigs request.
type GetVisualConfigsReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
NumVisuals uint32
NumProperties uint32
// padding: 16 bytes
PropertyList []uint32 // size: xgb.Pad((int(Length) * 4))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetVisualConfigs request.
func (cook GetVisualConfigsCookie) Reply() (*GetVisualConfigsReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getVisualConfigsReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getVisualConfigsReply reads a byte slice into a GetVisualConfigsReply value.
func getVisualConfigsReply(buf []byte) *GetVisualConfigsReply {
v := new(GetVisualConfigsReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
v.NumVisuals = xgb.Get32(buf[b:])
b += 4
v.NumProperties = xgb.Get32(buf[b:])
b += 4
b += 16 // padding
v.PropertyList = make([]uint32, v.Length)
for i := 0; i < int(v.Length); i++ {
v.PropertyList[i] = xgb.Get32(buf[b:])
b += 4
}
b = xgb.Pad(b)
return v
}
// Write request to wire for GetVisualConfigs
2012-05-11 05:57:34 +02:00
// getVisualConfigsRequest writes a GetVisualConfigs request to a byte slice.
func getVisualConfigsRequest(c *xgb.Conn, Screen uint32) []byte {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 14 // 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
return buf
}
2012-05-11 05:57:34 +02:00
// DestroyGLXPixmapCookie is a cookie used only for DestroyGLXPixmap requests.
type DestroyGLXPixmapCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// DestroyGLXPixmap sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func DestroyGLXPixmap(c *xgb.Conn, GlxPixmap Pixmap) DestroyGLXPixmapCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'DestroyGLXPixmap' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(destroyGLXPixmapRequest(c, GlxPixmap), cookie)
return DestroyGLXPixmapCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// DestroyGLXPixmapChecked sends a checked request.
// If an error occurs, it can be retrieved using DestroyGLXPixmapCookie.Check()
func DestroyGLXPixmapChecked(c *xgb.Conn, GlxPixmap Pixmap) DestroyGLXPixmapCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'DestroyGLXPixmap' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(destroyGLXPixmapRequest(c, GlxPixmap), cookie)
return DestroyGLXPixmapCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook DestroyGLXPixmapCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for DestroyGLXPixmap
2012-05-11 05:57:34 +02:00
// destroyGLXPixmapRequest writes a DestroyGLXPixmap request to a byte slice.
func destroyGLXPixmapRequest(c *xgb.Conn, GlxPixmap Pixmap) []byte {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 15 // 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-11 05:57:34 +02:00
// VendorPrivateCookie is a cookie used only for VendorPrivate requests.
type VendorPrivateCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// VendorPrivate sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func VendorPrivate(c *xgb.Conn, VendorCode uint32, ContextTag ContextTag, Data []byte) VendorPrivateCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'VendorPrivate' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(vendorPrivateRequest(c, VendorCode, ContextTag, Data), cookie)
return VendorPrivateCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// VendorPrivateChecked sends a checked request.
// If an error occurs, it can be retrieved using VendorPrivateCookie.Check()
func VendorPrivateChecked(c *xgb.Conn, VendorCode uint32, ContextTag ContextTag, Data []byte) VendorPrivateCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'VendorPrivate' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(vendorPrivateRequest(c, VendorCode, ContextTag, Data), cookie)
return VendorPrivateCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook VendorPrivateCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for VendorPrivate
2012-05-11 05:57:34 +02:00
// vendorPrivateRequest writes a VendorPrivate request to a byte slice.
func vendorPrivateRequest(c *xgb.Conn, VendorCode uint32, ContextTag ContextTag, Data []byte) []byte {
size := xgb.Pad((12 + xgb.Pad((len(Data) * 1))))
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 16 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], VendorCode)
b += 4
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
copy(buf[b:], Data[:len(Data)])
b += xgb.Pad(int(len(Data)))
return buf
}
2012-05-11 05:57:34 +02:00
// VendorPrivateWithReplyCookie is a cookie used only for VendorPrivateWithReply requests.
type VendorPrivateWithReplyCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// VendorPrivateWithReply sends a checked request.
// If an error occurs, it will be returned with the reply by calling VendorPrivateWithReplyCookie.Reply()
func VendorPrivateWithReply(c *xgb.Conn, VendorCode uint32, ContextTag ContextTag, Data []byte) VendorPrivateWithReplyCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'VendorPrivateWithReply' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(vendorPrivateWithReplyRequest(c, VendorCode, ContextTag, Data), cookie)
return VendorPrivateWithReplyCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// VendorPrivateWithReplyUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func VendorPrivateWithReplyUnchecked(c *xgb.Conn, VendorCode uint32, ContextTag ContextTag, Data []byte) VendorPrivateWithReplyCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'VendorPrivateWithReply' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(vendorPrivateWithReplyRequest(c, VendorCode, ContextTag, Data), cookie)
return VendorPrivateWithReplyCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// VendorPrivateWithReplyReply represents the data returned from a VendorPrivateWithReply request.
type VendorPrivateWithReplyReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
Retval uint32
Data1 []byte // size: 24
Data2 []byte // size: xgb.Pad(((int(Length) * 4) * 1))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a VendorPrivateWithReply request.
func (cook VendorPrivateWithReplyCookie) Reply() (*VendorPrivateWithReplyReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return vendorPrivateWithReplyReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// vendorPrivateWithReplyReply reads a byte slice into a VendorPrivateWithReplyReply value.
func vendorPrivateWithReplyReply(buf []byte) *VendorPrivateWithReplyReply {
v := new(VendorPrivateWithReplyReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
v.Retval = xgb.Get32(buf[b:])
b += 4
v.Data1 = make([]byte, 24)
copy(v.Data1[:24], buf[b:])
b += xgb.Pad(int(24))
v.Data2 = make([]byte, (int(v.Length) * 4))
copy(v.Data2[:(int(v.Length)*4)], buf[b:])
b += xgb.Pad(int((int(v.Length) * 4)))
return v
}
// Write request to wire for VendorPrivateWithReply
2012-05-11 05:57:34 +02:00
// vendorPrivateWithReplyRequest writes a VendorPrivateWithReply request to a byte slice.
func vendorPrivateWithReplyRequest(c *xgb.Conn, VendorCode uint32, ContextTag ContextTag, Data []byte) []byte {
size := xgb.Pad((12 + xgb.Pad((len(Data) * 1))))
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 17 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], VendorCode)
b += 4
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
copy(buf[b:], Data[:len(Data)])
b += xgb.Pad(int(len(Data)))
return buf
}
2012-05-11 05:57:34 +02:00
// QueryExtensionsStringCookie is a cookie used only for QueryExtensionsString requests.
type QueryExtensionsStringCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// QueryExtensionsString sends a checked request.
// If an error occurs, it will be returned with the reply by calling QueryExtensionsStringCookie.Reply()
func QueryExtensionsString(c *xgb.Conn, Screen uint32) QueryExtensionsStringCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'QueryExtensionsString' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(queryExtensionsStringRequest(c, Screen), cookie)
return QueryExtensionsStringCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// QueryExtensionsStringUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func QueryExtensionsStringUnchecked(c *xgb.Conn, Screen uint32) QueryExtensionsStringCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'QueryExtensionsString' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(queryExtensionsStringRequest(c, Screen), cookie)
return QueryExtensionsStringCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// QueryExtensionsStringReply represents the data returned from a QueryExtensionsString request.
type QueryExtensionsStringReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
// padding: 16 bytes
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a QueryExtensionsString request.
func (cook QueryExtensionsStringCookie) Reply() (*QueryExtensionsStringReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return queryExtensionsStringReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// queryExtensionsStringReply reads a byte slice into a QueryExtensionsStringReply value.
func queryExtensionsStringReply(buf []byte) *QueryExtensionsStringReply {
v := new(QueryExtensionsStringReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
b += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
b += 16 // padding
return v
}
// Write request to wire for QueryExtensionsString
2012-05-11 05:57:34 +02:00
// queryExtensionsStringRequest writes a QueryExtensionsString request to a byte slice.
func queryExtensionsStringRequest(c *xgb.Conn, Screen uint32) []byte {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 18 // 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
return buf
}
2012-05-11 05:57:34 +02:00
// QueryServerStringCookie is a cookie used only for QueryServerString requests.
type QueryServerStringCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// QueryServerString sends a checked request.
// If an error occurs, it will be returned with the reply by calling QueryServerStringCookie.Reply()
func QueryServerString(c *xgb.Conn, Screen uint32, Name uint32) QueryServerStringCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'QueryServerString' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(queryServerStringRequest(c, Screen, Name), cookie)
return QueryServerStringCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// QueryServerStringUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func QueryServerStringUnchecked(c *xgb.Conn, Screen uint32, Name uint32) QueryServerStringCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'QueryServerString' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(queryServerStringRequest(c, Screen, Name), cookie)
return QueryServerStringCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// QueryServerStringReply represents the data returned from a QueryServerString request.
type QueryServerStringReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
StrLen uint32
// padding: 16 bytes
String string // size: xgb.Pad((int(StrLen) * 1))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a QueryServerString request.
func (cook QueryServerStringCookie) Reply() (*QueryServerStringReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return queryServerStringReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// queryServerStringReply reads a byte slice into a QueryServerStringReply value.
func queryServerStringReply(buf []byte) *QueryServerStringReply {
v := new(QueryServerStringReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
b += 4 // padding
v.StrLen = xgb.Get32(buf[b:])
b += 4
b += 16 // padding
{
byteString := make([]byte, v.StrLen)
copy(byteString[:v.StrLen], buf[b:])
v.String = string(byteString)
b += xgb.Pad(int(v.StrLen))
}
return v
}
// Write request to wire for QueryServerString
2012-05-11 05:57:34 +02:00
// queryServerStringRequest writes a QueryServerString request to a byte slice.
func queryServerStringRequest(c *xgb.Conn, Screen uint32, Name uint32) []byte {
size := 12
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 19 // 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:], Name)
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// ClientInfoCookie is a cookie used only for ClientInfo requests.
type ClientInfoCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// ClientInfo sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func ClientInfo(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32, StrLen uint32, String string) ClientInfoCookie {
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}
}
2012-05-11 05:57:34 +02:00
// ClientInfoChecked sends a checked request.
// If an error occurs, it can be retrieved using ClientInfoCookie.Check()
func ClientInfoChecked(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32, StrLen uint32, String string) ClientInfoCookie {
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}
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook ClientInfoCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for ClientInfo
2012-05-11 05:57:34 +02:00
// clientInfoRequest writes a ClientInfo request to a byte slice.
func clientInfoRequest(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32, StrLen uint32, String string) []byte {
size := xgb.Pad((16 + xgb.Pad((int(StrLen) * 1))))
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
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 += xgb.Pad(int(StrLen))
return buf
}
2012-05-11 05:57:34 +02:00
// GetFBConfigsCookie is a cookie used only for GetFBConfigs requests.
type GetFBConfigsCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetFBConfigs sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetFBConfigsCookie.Reply()
func GetFBConfigs(c *xgb.Conn, Screen uint32) GetFBConfigsCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetFBConfigs' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getFBConfigsRequest(c, Screen), cookie)
return GetFBConfigsCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetFBConfigsUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetFBConfigsUnchecked(c *xgb.Conn, Screen uint32) GetFBConfigsCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetFBConfigs' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getFBConfigsRequest(c, Screen), cookie)
return GetFBConfigsCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetFBConfigsReply represents the data returned from a GetFBConfigs request.
type GetFBConfigsReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
NumFbConfigs uint32
NumProperties uint32
// padding: 16 bytes
PropertyList []uint32 // size: xgb.Pad((int(Length) * 4))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetFBConfigs request.
func (cook GetFBConfigsCookie) Reply() (*GetFBConfigsReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getFBConfigsReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getFBConfigsReply reads a byte slice into a GetFBConfigsReply value.
func getFBConfigsReply(buf []byte) *GetFBConfigsReply {
v := new(GetFBConfigsReply)
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.NumFbConfigs = xgb.Get32(buf[b:])
b += 4
v.NumProperties = xgb.Get32(buf[b:])
b += 4
b += 16 // padding
v.PropertyList = make([]uint32, v.Length)
for i := 0; i < int(v.Length); i++ {
v.PropertyList[i] = xgb.Get32(buf[b:])
b += 4
}
b = xgb.Pad(b)
return v
}
// Write request to wire for GetFBConfigs
2012-05-11 05:57:34 +02:00
// getFBConfigsRequest writes a GetFBConfigs request to a byte slice.
func getFBConfigsRequest(c *xgb.Conn, Screen uint32) []byte {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 21 // 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
return buf
}
2012-05-11 05:57:34 +02:00
// CreatePixmapCookie is a cookie used only for CreatePixmap requests.
type CreatePixmapCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// CreatePixmap sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func CreatePixmap(c *xgb.Conn, Screen uint32, Fbconfig Fbconfig, Pixmap xproto.Pixmap, GlxPixmap Pixmap, NumAttribs uint32, Attribs []uint32) CreatePixmapCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'CreatePixmap' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(createPixmapRequest(c, Screen, Fbconfig, Pixmap, GlxPixmap, NumAttribs, Attribs), cookie)
return CreatePixmapCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// CreatePixmapChecked sends a checked request.
// If an error occurs, it can be retrieved using CreatePixmapCookie.Check()
func CreatePixmapChecked(c *xgb.Conn, Screen uint32, Fbconfig Fbconfig, Pixmap xproto.Pixmap, GlxPixmap Pixmap, NumAttribs uint32, Attribs []uint32) CreatePixmapCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'CreatePixmap' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(createPixmapRequest(c, Screen, Fbconfig, Pixmap, GlxPixmap, NumAttribs, Attribs), cookie)
return CreatePixmapCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook CreatePixmapCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for CreatePixmap
2012-05-11 05:57:34 +02:00
// createPixmapRequest writes a CreatePixmap request to a byte slice.
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)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 22 // 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(Pixmap))
b += 4
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
}
b = xgb.Pad(b)
return buf
}
2012-05-11 05:57:34 +02:00
// DestroyPixmapCookie is a cookie used only for DestroyPixmap requests.
type DestroyPixmapCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// 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 {
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}
}
2012-05-11 05:57:34 +02:00
// DestroyPixmapChecked sends a checked request.
// If an error occurs, it can be retrieved using DestroyPixmapCookie.Check()
func DestroyPixmapChecked(c *xgb.Conn, GlxPixmap Pixmap) DestroyPixmapCookie {
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}
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook DestroyPixmapCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for DestroyPixmap
2012-05-11 05:57:34 +02:00
// destroyPixmapRequest writes a DestroyPixmap request to a byte slice.
func destroyPixmapRequest(c *xgb.Conn, GlxPixmap Pixmap) []byte {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
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-11 05:57:34 +02:00
// CreateNewContextCookie is a cookie used only for CreateNewContext requests.
type CreateNewContextCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// CreateNewContext sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func CreateNewContext(c *xgb.Conn, Context Context, Fbconfig Fbconfig, Screen uint32, RenderType uint32, ShareList Context, IsDirect bool) CreateNewContextCookie {
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-11 05:57:34 +02:00
// CreateNewContextChecked sends a checked request.
// If an error occurs, it can be retrieved using CreateNewContextCookie.Check()
func CreateNewContextChecked(c *xgb.Conn, Context Context, Fbconfig Fbconfig, Screen uint32, RenderType uint32, ShareList Context, IsDirect bool) CreateNewContextCookie {
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-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook CreateNewContextCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for CreateNewContext
2012-05-11 05:57:34 +02:00
// createNewContextRequest writes a CreateNewContext request to a byte slice.
func createNewContextRequest(c *xgb.Conn, Context Context, Fbconfig Fbconfig, Screen uint32, RenderType uint32, ShareList Context, IsDirect bool) []byte {
size := 28
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
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-11 05:57:34 +02:00
// QueryContextCookie is a cookie used only for QueryContext requests.
type QueryContextCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// QueryContext sends a checked request.
// If an error occurs, it will be returned with the reply by calling QueryContextCookie.Reply()
func QueryContext(c *xgb.Conn, Context Context) QueryContextCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'QueryContext' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(queryContextRequest(c, Context), cookie)
return QueryContextCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// QueryContextUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func QueryContextUnchecked(c *xgb.Conn, Context Context) QueryContextCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'QueryContext' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(queryContextRequest(c, Context), cookie)
return QueryContextCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// QueryContextReply represents the data returned from a QueryContext request.
type QueryContextReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
NumAttribs uint32
// padding: 20 bytes
Attribs []uint32 // size: xgb.Pad(((int(NumAttribs) * 2) * 4))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a QueryContext request.
func (cook QueryContextCookie) Reply() (*QueryContextReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return queryContextReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// queryContextReply reads a byte slice into a QueryContextReply value.
func queryContextReply(buf []byte) *QueryContextReply {
v := new(QueryContextReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
v.NumAttribs = xgb.Get32(buf[b:])
b += 4
b += 20 // padding
v.Attribs = make([]uint32, (int(v.NumAttribs) * 2))
for i := 0; i < int((int(v.NumAttribs) * 2)); i++ {
v.Attribs[i] = xgb.Get32(buf[b:])
b += 4
}
b = xgb.Pad(b)
return v
}
// Write request to wire for QueryContext
2012-05-11 05:57:34 +02:00
// queryContextRequest writes a QueryContext request to a byte slice.
func queryContextRequest(c *xgb.Conn, Context Context) []byte {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 25 // 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
}
2012-05-11 05:57:34 +02:00
// MakeContextCurrentCookie is a cookie used only for MakeContextCurrent requests.
type MakeContextCurrentCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// MakeContextCurrent sends a checked request.
// If an error occurs, it will be returned with the reply by calling MakeContextCurrentCookie.Reply()
func MakeContextCurrent(c *xgb.Conn, OldContextTag ContextTag, Drawable Drawable, ReadDrawable Drawable, Context Context) MakeContextCurrentCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'MakeContextCurrent' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(makeContextCurrentRequest(c, OldContextTag, Drawable, ReadDrawable, Context), cookie)
return MakeContextCurrentCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// MakeContextCurrentUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func MakeContextCurrentUnchecked(c *xgb.Conn, OldContextTag ContextTag, Drawable Drawable, ReadDrawable Drawable, Context Context) MakeContextCurrentCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'MakeContextCurrent' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(makeContextCurrentRequest(c, OldContextTag, Drawable, ReadDrawable, Context), cookie)
return MakeContextCurrentCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// MakeContextCurrentReply represents the data returned from a MakeContextCurrent request.
type MakeContextCurrentReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
ContextTag ContextTag
// padding: 20 bytes
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a MakeContextCurrent request.
func (cook MakeContextCurrentCookie) Reply() (*MakeContextCurrentReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return makeContextCurrentReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// makeContextCurrentReply reads a byte slice into a MakeContextCurrentReply value.
func makeContextCurrentReply(buf []byte) *MakeContextCurrentReply {
v := new(MakeContextCurrentReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
v.ContextTag = ContextTag(xgb.Get32(buf[b:]))
b += 4
b += 20 // padding
return v
}
// Write request to wire for MakeContextCurrent
2012-05-11 05:57:34 +02:00
// makeContextCurrentRequest writes a MakeContextCurrent request to a byte slice.
func makeContextCurrentRequest(c *xgb.Conn, OldContextTag ContextTag, Drawable Drawable, ReadDrawable Drawable, Context Context) []byte {
size := 20
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 26 // 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(OldContextTag))
b += 4
xgb.Put32(buf[b:], uint32(Drawable))
b += 4
xgb.Put32(buf[b:], uint32(ReadDrawable))
b += 4
xgb.Put32(buf[b:], uint32(Context))
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// CreatePbufferCookie is a cookie used only for CreatePbuffer requests.
type CreatePbufferCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02: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 {
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-11 05:57:34 +02:00
// CreatePbufferChecked sends a checked request.
// 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 {
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-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook CreatePbufferCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for CreatePbuffer
2012-05-11 05:57:34 +02:00
// createPbufferRequest writes a CreatePbuffer request to a byte slice.
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)
buf[b] = c.Extensions["GLX"]
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
}
b = xgb.Pad(b)
return buf
}
2012-05-11 05:57:34 +02:00
// DestroyPbufferCookie is a cookie used only for DestroyPbuffer requests.
type DestroyPbufferCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// DestroyPbuffer sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func DestroyPbuffer(c *xgb.Conn, Pbuffer Pbuffer) DestroyPbufferCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'DestroyPbuffer' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(destroyPbufferRequest(c, Pbuffer), cookie)
return DestroyPbufferCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// DestroyPbufferChecked sends a checked request.
// If an error occurs, it can be retrieved using DestroyPbufferCookie.Check()
func DestroyPbufferChecked(c *xgb.Conn, Pbuffer Pbuffer) DestroyPbufferCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'DestroyPbuffer' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(destroyPbufferRequest(c, Pbuffer), cookie)
return DestroyPbufferCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook DestroyPbufferCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for DestroyPbuffer
2012-05-11 05:57:34 +02:00
// destroyPbufferRequest writes a DestroyPbuffer request to a byte slice.
func destroyPbufferRequest(c *xgb.Conn, Pbuffer Pbuffer) []byte {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 28 // 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(Pbuffer))
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// GetDrawableAttributesCookie is a cookie used only for GetDrawableAttributes requests.
type GetDrawableAttributesCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetDrawableAttributes sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetDrawableAttributesCookie.Reply()
func GetDrawableAttributes(c *xgb.Conn, Drawable Drawable) GetDrawableAttributesCookie {
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}
}
2012-05-11 05:57:34 +02:00
// GetDrawableAttributesUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetDrawableAttributesUnchecked(c *xgb.Conn, Drawable Drawable) GetDrawableAttributesCookie {
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}
}
2012-05-11 05:57:34 +02:00
// GetDrawableAttributesReply represents the data returned from a GetDrawableAttributes request.
type GetDrawableAttributesReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
NumAttribs uint32
// padding: 20 bytes
Attribs []uint32 // size: xgb.Pad(((int(NumAttribs) * 2) * 4))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetDrawableAttributes request.
func (cook GetDrawableAttributesCookie) Reply() (*GetDrawableAttributesReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getDrawableAttributesReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getDrawableAttributesReply reads a byte slice into a GetDrawableAttributesReply value.
func getDrawableAttributesReply(buf []byte) *GetDrawableAttributesReply {
v := new(GetDrawableAttributesReply)
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.NumAttribs = xgb.Get32(buf[b:])
b += 4
b += 20 // padding
v.Attribs = make([]uint32, (int(v.NumAttribs) * 2))
for i := 0; i < int((int(v.NumAttribs) * 2)); i++ {
v.Attribs[i] = xgb.Get32(buf[b:])
b += 4
}
b = xgb.Pad(b)
return v
}
// Write request to wire for GetDrawableAttributes
2012-05-11 05:57:34 +02:00
// getDrawableAttributesRequest writes a GetDrawableAttributes request to a byte slice.
func getDrawableAttributesRequest(c *xgb.Conn, Drawable Drawable) []byte {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 29 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(Drawable))
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// ChangeDrawableAttributesCookie is a cookie used only for ChangeDrawableAttributes requests.
type ChangeDrawableAttributesCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// ChangeDrawableAttributes sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func ChangeDrawableAttributes(c *xgb.Conn, Drawable Drawable, NumAttribs uint32, Attribs []uint32) ChangeDrawableAttributesCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'ChangeDrawableAttributes' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(changeDrawableAttributesRequest(c, Drawable, NumAttribs, Attribs), cookie)
return ChangeDrawableAttributesCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// ChangeDrawableAttributesChecked sends a checked request.
// If an error occurs, it can be retrieved using ChangeDrawableAttributesCookie.Check()
func ChangeDrawableAttributesChecked(c *xgb.Conn, Drawable Drawable, NumAttribs uint32, Attribs []uint32) ChangeDrawableAttributesCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'ChangeDrawableAttributes' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(changeDrawableAttributesRequest(c, Drawable, NumAttribs, Attribs), cookie)
return ChangeDrawableAttributesCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook ChangeDrawableAttributesCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for ChangeDrawableAttributes
2012-05-11 05:57:34 +02:00
// changeDrawableAttributesRequest writes a ChangeDrawableAttributes request to a byte slice.
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)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 30 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(Drawable))
b += 4
xgb.Put32(buf[b:], NumAttribs)
b += 4
for i := 0; i < int((int(NumAttribs) * 2)); i++ {
xgb.Put32(buf[b:], Attribs[i])
b += 4
}
b = xgb.Pad(b)
return buf
}
2012-05-11 05:57:34 +02:00
// CreateWindowCookie is a cookie used only for CreateWindow requests.
type CreateWindowCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02: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 {
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-11 05:57:34 +02:00
// CreateWindowChecked sends a checked request.
// 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 {
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-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook CreateWindowCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for CreateWindow
2012-05-11 05:57:34 +02:00
// createWindowRequest writes a CreateWindow request to a byte slice.
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)
buf[b] = c.Extensions["GLX"]
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
}
b = xgb.Pad(b)
return buf
}
2012-05-11 05:57:34 +02:00
// DeleteWindowCookie is a cookie used only for DeleteWindow requests.
type DeleteWindowCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// DeleteWindow sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func DeleteWindow(c *xgb.Conn, Glxwindow Window) DeleteWindowCookie {
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-11 05:57:34 +02:00
// DeleteWindowChecked sends a checked request.
// If an error occurs, it can be retrieved using DeleteWindowCookie.Check()
func DeleteWindowChecked(c *xgb.Conn, Glxwindow Window) DeleteWindowCookie {
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-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook DeleteWindowCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for DeleteWindow
2012-05-11 05:57:34 +02:00
// deleteWindowRequest writes a DeleteWindow request to a byte slice.
func deleteWindowRequest(c *xgb.Conn, Glxwindow Window) []byte {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
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
}
2012-05-11 05:57:34 +02:00
// SetClientInfoARBCookie is a cookie used only for SetClientInfoARB requests.
type SetClientInfoARBCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// SetClientInfoARB sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func SetClientInfoARB(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32, NumVersions uint32, GlStrLen uint32, GlxStrLen uint32, GlVersions []uint32, GlExtensionString string, GlxExtensionString string) SetClientInfoARBCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'SetClientInfoARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(setClientInfoARBRequest(c, MajorVersion, MinorVersion, NumVersions, GlStrLen, GlxStrLen, GlVersions, GlExtensionString, GlxExtensionString), cookie)
return SetClientInfoARBCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// SetClientInfoARBChecked sends a checked request.
// If an error occurs, it can be retrieved using SetClientInfoARBCookie.Check()
func SetClientInfoARBChecked(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32, NumVersions uint32, GlStrLen uint32, GlxStrLen uint32, GlVersions []uint32, GlExtensionString string, GlxExtensionString string) SetClientInfoARBCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'SetClientInfoARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(setClientInfoARBRequest(c, MajorVersion, MinorVersion, NumVersions, GlStrLen, GlxStrLen, GlVersions, GlExtensionString, GlxExtensionString), cookie)
return SetClientInfoARBCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook SetClientInfoARBCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for SetClientInfoARB
2012-05-11 05:57:34 +02:00
// setClientInfoARBRequest writes a SetClientInfoARB request to a byte slice.
func setClientInfoARBRequest(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32, NumVersions uint32, GlStrLen uint32, GlxStrLen uint32, GlVersions []uint32, GlExtensionString string, GlxExtensionString string) []byte {
size := xgb.Pad((((24 + xgb.Pad(((int(NumVersions) * 2) * 4))) + xgb.Pad((int(GlStrLen) * 1))) + xgb.Pad((int(GlxStrLen) * 1))))
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 33 // 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:], NumVersions)
b += 4
xgb.Put32(buf[b:], GlStrLen)
b += 4
xgb.Put32(buf[b:], GlxStrLen)
b += 4
for i := 0; i < int((int(NumVersions) * 2)); i++ {
xgb.Put32(buf[b:], GlVersions[i])
b += 4
}
b = xgb.Pad(b)
copy(buf[b:], GlExtensionString[:GlStrLen])
b += xgb.Pad(int(GlStrLen))
copy(buf[b:], GlxExtensionString[:GlxStrLen])
b += xgb.Pad(int(GlxStrLen))
return buf
}
2012-05-11 05:57:34 +02:00
// CreateContextAttribsARBCookie is a cookie used only for CreateContextAttribsARB requests.
type CreateContextAttribsARBCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// CreateContextAttribsARB sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func CreateContextAttribsARB(c *xgb.Conn, Context Context, Fbconfig Fbconfig, Screen uint32, ShareList Context, IsDirect bool, NumAttribs uint32, Attribs []uint32) CreateContextAttribsARBCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'CreateContextAttribsARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(createContextAttribsARBRequest(c, Context, Fbconfig, Screen, ShareList, IsDirect, NumAttribs, Attribs), cookie)
return CreateContextAttribsARBCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// CreateContextAttribsARBChecked sends a checked request.
// If an error occurs, it can be retrieved using CreateContextAttribsARBCookie.Check()
func CreateContextAttribsARBChecked(c *xgb.Conn, Context Context, Fbconfig Fbconfig, Screen uint32, ShareList Context, IsDirect bool, NumAttribs uint32, Attribs []uint32) CreateContextAttribsARBCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'CreateContextAttribsARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(createContextAttribsARBRequest(c, Context, Fbconfig, Screen, ShareList, IsDirect, NumAttribs, Attribs), cookie)
return CreateContextAttribsARBCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook CreateContextAttribsARBCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for CreateContextAttribsARB
2012-05-11 05:57:34 +02:00
// createContextAttribsARBRequest writes a CreateContextAttribsARB request to a byte slice.
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)
buf[b] = c.Extensions["GLX"]
b += 1
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
xgb.Put32(buf[b:], uint32(Fbconfig))
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
xgb.Put32(buf[b:], NumAttribs)
b += 4
for i := 0; i < int((int(NumAttribs) * 2)); i++ {
xgb.Put32(buf[b:], Attribs[i])
b += 4
}
b = xgb.Pad(b)
return buf
}
2012-05-11 05:57:34 +02:00
// SetClientInfo2ARBCookie is a cookie used only for SetClientInfo2ARB requests.
type SetClientInfo2ARBCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// SetClientInfo2ARB sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func SetClientInfo2ARB(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32, NumVersions uint32, GlStrLen uint32, GlxStrLen uint32, GlVersions []uint32, GlExtensionString string, GlxExtensionString string) SetClientInfo2ARBCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'SetClientInfo2ARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(setClientInfo2ARBRequest(c, MajorVersion, MinorVersion, NumVersions, GlStrLen, GlxStrLen, GlVersions, GlExtensionString, GlxExtensionString), cookie)
return SetClientInfo2ARBCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// SetClientInfo2ARBChecked sends a checked request.
// If an error occurs, it can be retrieved using SetClientInfo2ARBCookie.Check()
func SetClientInfo2ARBChecked(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32, NumVersions uint32, GlStrLen uint32, GlxStrLen uint32, GlVersions []uint32, GlExtensionString string, GlxExtensionString string) SetClientInfo2ARBCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'SetClientInfo2ARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(setClientInfo2ARBRequest(c, MajorVersion, MinorVersion, NumVersions, GlStrLen, GlxStrLen, GlVersions, GlExtensionString, GlxExtensionString), cookie)
return SetClientInfo2ARBCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook SetClientInfo2ARBCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for SetClientInfo2ARB
2012-05-11 05:57:34 +02:00
// setClientInfo2ARBRequest writes a SetClientInfo2ARB request to a byte slice.
func setClientInfo2ARBRequest(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32, NumVersions uint32, GlStrLen uint32, GlxStrLen uint32, GlVersions []uint32, GlExtensionString string, GlxExtensionString string) []byte {
size := xgb.Pad((((24 + xgb.Pad(((int(NumVersions) * 3) * 4))) + xgb.Pad((int(GlStrLen) * 1))) + xgb.Pad((int(GlxStrLen) * 1))))
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 35 // 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:], NumVersions)
b += 4
xgb.Put32(buf[b:], GlStrLen)
b += 4
xgb.Put32(buf[b:], GlxStrLen)
b += 4
for i := 0; i < int((int(NumVersions) * 3)); i++ {
xgb.Put32(buf[b:], GlVersions[i])
b += 4
}
b = xgb.Pad(b)
copy(buf[b:], GlExtensionString[:GlStrLen])
b += xgb.Pad(int(GlStrLen))
copy(buf[b:], GlxExtensionString[:GlxStrLen])
b += xgb.Pad(int(GlxStrLen))
return buf
}
2012-05-11 05:57:34 +02:00
// NewListCookie is a cookie used only for NewList requests.
type NewListCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// NewList sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func NewList(c *xgb.Conn, ContextTag ContextTag, List uint32, Mode uint32) NewListCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'NewList' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(newListRequest(c, ContextTag, List, Mode), cookie)
return NewListCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// NewListChecked sends a checked request.
// If an error occurs, it can be retrieved using NewListCookie.Check()
func NewListChecked(c *xgb.Conn, ContextTag ContextTag, List uint32, Mode uint32) NewListCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'NewList' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(newListRequest(c, ContextTag, List, Mode), cookie)
return NewListCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook NewListCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for NewList
2012-05-11 05:57:34 +02:00
// newListRequest writes a NewList request to a byte slice.
func newListRequest(c *xgb.Conn, ContextTag ContextTag, List uint32, Mode uint32) []byte {
size := 16
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 101 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
xgb.Put32(buf[b:], List)
b += 4
xgb.Put32(buf[b:], Mode)
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// EndListCookie is a cookie used only for EndList requests.
type EndListCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02: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 {
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-11 05:57:34 +02:00
// EndListChecked sends a checked request.
// If an error occurs, it can be retrieved using EndListCookie.Check()
func EndListChecked(c *xgb.Conn, ContextTag ContextTag) EndListCookie {
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-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook EndListCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for EndList
2012-05-11 05:57:34 +02:00
// endListRequest writes a EndList request to a byte slice.
func endListRequest(c *xgb.Conn, ContextTag ContextTag) []byte {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
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
}
2012-05-11 05:57:34 +02:00
// DeleteListsCookie is a cookie used only for DeleteLists requests.
type DeleteListsCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// 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 {
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}
}
2012-05-11 05:57:34 +02:00
// DeleteListsChecked sends a checked request.
// If an error occurs, it can be retrieved using DeleteListsCookie.Check()
func DeleteListsChecked(c *xgb.Conn, ContextTag ContextTag, List uint32, Range int32) DeleteListsCookie {
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}
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook DeleteListsCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for DeleteLists
2012-05-11 05:57:34 +02:00
// deleteListsRequest writes a DeleteLists request to a byte slice.
func deleteListsRequest(c *xgb.Conn, ContextTag ContextTag, List uint32, Range int32) []byte {
size := 16
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
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
}
2012-05-11 05:57:34 +02:00
// GenListsCookie is a cookie used only for GenLists requests.
type GenListsCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GenLists sends a checked request.
// 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 {
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-11 05:57:34 +02:00
// GenListsUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GenListsUnchecked(c *xgb.Conn, ContextTag ContextTag, Range int32) GenListsCookie {
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-11 05:57:34 +02:00
// GenListsReply represents the data returned from a GenLists request.
type GenListsReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
RetVal uint32
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GenLists request.
func (cook GenListsCookie) Reply() (*GenListsReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return genListsReply(buf), nil
}
2012-05-11 05:57:34 +02: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
}
// Write request to wire for GenLists
2012-05-11 05:57:34 +02:00
// genListsRequest writes a GenLists request to a byte slice.
func genListsRequest(c *xgb.Conn, ContextTag ContextTag, Range int32) []byte {
size := 12
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
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
}
2012-05-11 05:57:34 +02:00
// FeedbackBufferCookie is a cookie used only for FeedbackBuffer requests.
type FeedbackBufferCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// FeedbackBuffer sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func FeedbackBuffer(c *xgb.Conn, ContextTag ContextTag, Size int32, Type int32) FeedbackBufferCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'FeedbackBuffer' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(feedbackBufferRequest(c, ContextTag, Size, Type), cookie)
return FeedbackBufferCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// FeedbackBufferChecked sends a checked request.
// If an error occurs, it can be retrieved using FeedbackBufferCookie.Check()
func FeedbackBufferChecked(c *xgb.Conn, ContextTag ContextTag, Size int32, Type int32) FeedbackBufferCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'FeedbackBuffer' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(feedbackBufferRequest(c, ContextTag, Size, Type), cookie)
return FeedbackBufferCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook FeedbackBufferCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for FeedbackBuffer
2012-05-11 05:57:34 +02:00
// feedbackBufferRequest writes a FeedbackBuffer request to a byte slice.
func feedbackBufferRequest(c *xgb.Conn, ContextTag ContextTag, Size int32, Type int32) []byte {
size := 16
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
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
xgb.Put32(buf[b:], uint32(Size))
b += 4
xgb.Put32(buf[b:], uint32(Type))
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// SelectBufferCookie is a cookie used only for SelectBuffer requests.
type SelectBufferCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// SelectBuffer sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func SelectBuffer(c *xgb.Conn, ContextTag ContextTag, Size int32) SelectBufferCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'SelectBuffer' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(selectBufferRequest(c, ContextTag, Size), cookie)
return SelectBufferCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// SelectBufferChecked sends a checked request.
// If an error occurs, it can be retrieved using SelectBufferCookie.Check()
func SelectBufferChecked(c *xgb.Conn, ContextTag ContextTag, Size int32) SelectBufferCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'SelectBuffer' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(selectBufferRequest(c, ContextTag, Size), cookie)
return SelectBufferCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook SelectBufferCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for SelectBuffer
2012-05-11 05:57:34 +02:00
// selectBufferRequest writes a SelectBuffer request to a byte slice.
func selectBufferRequest(c *xgb.Conn, ContextTag ContextTag, Size int32) []byte {
size := 12
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 106 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
xgb.Put32(buf[b:], uint32(Size))
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// RenderModeCookie is a cookie used only for RenderMode requests.
type RenderModeCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// RenderMode sends a checked request.
// If an error occurs, it will be returned with the reply by calling RenderModeCookie.Reply()
func RenderMode(c *xgb.Conn, ContextTag ContextTag, Mode uint32) RenderModeCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'RenderMode' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(renderModeRequest(c, ContextTag, Mode), cookie)
return RenderModeCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// RenderModeUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func RenderModeUnchecked(c *xgb.Conn, ContextTag ContextTag, Mode uint32) RenderModeCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'RenderMode' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(renderModeRequest(c, ContextTag, Mode), cookie)
return RenderModeCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// RenderModeReply represents the data returned from a RenderMode request.
type RenderModeReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
RetVal uint32
N uint32
NewMode uint32
// padding: 12 bytes
Data []uint32 // size: xgb.Pad((int(N) * 4))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a RenderMode request.
func (cook RenderModeCookie) Reply() (*RenderModeReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return renderModeReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// renderModeReply reads a byte slice into a RenderModeReply value.
func renderModeReply(buf []byte) *RenderModeReply {
v := new(RenderModeReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
v.RetVal = xgb.Get32(buf[b:])
b += 4
v.N = xgb.Get32(buf[b:])
b += 4
v.NewMode = xgb.Get32(buf[b:])
b += 4
b += 12 // padding
v.Data = make([]uint32, v.N)
for i := 0; i < int(v.N); i++ {
v.Data[i] = xgb.Get32(buf[b:])
b += 4
}
b = xgb.Pad(b)
return v
}
// Write request to wire for RenderMode
2012-05-11 05:57:34 +02:00
// renderModeRequest writes a RenderMode request to a byte slice.
func renderModeRequest(c *xgb.Conn, ContextTag ContextTag, Mode uint32) []byte {
size := 12
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 107 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
xgb.Put32(buf[b:], Mode)
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// FinishCookie is a cookie used only for Finish requests.
type FinishCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// Finish sends a checked request.
// If an error occurs, it will be returned with the reply by calling FinishCookie.Reply()
func Finish(c *xgb.Conn, ContextTag ContextTag) FinishCookie {
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}
}
2012-05-11 05:57:34 +02:00
// 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 {
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}
}
2012-05-11 05:57:34 +02:00
// FinishReply represents the data returned from a Finish request.
type FinishReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a Finish request.
func (cook FinishCookie) Reply() (*FinishReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return finishReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// finishReply reads a byte slice into a FinishReply value.
func finishReply(buf []byte) *FinishReply {
v := new(FinishReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
return v
}
// Write request to wire for Finish
2012-05-11 05:57:34 +02:00
// finishRequest writes a Finish request to a byte slice.
func finishRequest(c *xgb.Conn, ContextTag ContextTag) []byte {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
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
}
2012-05-11 05:57:34 +02:00
// PixelStorefCookie is a cookie used only for PixelStoref requests.
type PixelStorefCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// PixelStoref sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func PixelStoref(c *xgb.Conn, ContextTag ContextTag, Pname uint32, Datum Float32) PixelStorefCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'PixelStoref' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(pixelStorefRequest(c, ContextTag, Pname, Datum), cookie)
return PixelStorefCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// PixelStorefChecked sends a checked request.
// If an error occurs, it can be retrieved using PixelStorefCookie.Check()
func PixelStorefChecked(c *xgb.Conn, ContextTag ContextTag, Pname uint32, Datum Float32) PixelStorefCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'PixelStoref' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(pixelStorefRequest(c, ContextTag, Pname, Datum), cookie)
return PixelStorefCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook PixelStorefCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for PixelStoref
2012-05-11 05:57:34 +02:00
// pixelStorefRequest writes a PixelStoref request to a byte slice.
func pixelStorefRequest(c *xgb.Conn, ContextTag ContextTag, Pname uint32, Datum Float32) []byte {
size := 16
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 109 // 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
xgb.Put32(buf[b:], uint32(Datum))
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// PixelStoreiCookie is a cookie used only for PixelStorei requests.
type PixelStoreiCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// PixelStorei sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func PixelStorei(c *xgb.Conn, ContextTag ContextTag, Pname uint32, Datum int32) PixelStoreiCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'PixelStorei' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(pixelStoreiRequest(c, ContextTag, Pname, Datum), cookie)
return PixelStoreiCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// PixelStoreiChecked sends a checked request.
// If an error occurs, it can be retrieved using PixelStoreiCookie.Check()
func PixelStoreiChecked(c *xgb.Conn, ContextTag ContextTag, Pname uint32, Datum int32) PixelStoreiCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'PixelStorei' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(pixelStoreiRequest(c, ContextTag, Pname, Datum), cookie)
return PixelStoreiCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook PixelStoreiCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for PixelStorei
2012-05-11 05:57:34 +02:00
// pixelStoreiRequest writes a PixelStorei request to a byte slice.
func pixelStoreiRequest(c *xgb.Conn, ContextTag ContextTag, Pname uint32, Datum int32) []byte {
size := 16
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 110 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
xgb.Put32(buf[b:], Pname)
b += 4
xgb.Put32(buf[b:], uint32(Datum))
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// ReadPixelsCookie is a cookie used only for ReadPixels requests.
type ReadPixelsCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// ReadPixels sends a checked request.
// If an error occurs, it will be returned with the reply by calling ReadPixelsCookie.Reply()
func ReadPixels(c *xgb.Conn, ContextTag ContextTag, X int32, Y int32, Width int32, Height int32, Format uint32, Type uint32, SwapBytes bool, LsbFirst bool) ReadPixelsCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'ReadPixels' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(readPixelsRequest(c, ContextTag, X, Y, Width, Height, Format, Type, SwapBytes, LsbFirst), cookie)
return ReadPixelsCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// ReadPixelsUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func ReadPixelsUnchecked(c *xgb.Conn, ContextTag ContextTag, X int32, Y int32, Width int32, Height int32, Format uint32, Type uint32, SwapBytes bool, LsbFirst bool) ReadPixelsCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'ReadPixels' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(readPixelsRequest(c, ContextTag, X, Y, Width, Height, Format, Type, SwapBytes, LsbFirst), cookie)
return ReadPixelsCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// ReadPixelsReply represents the data returned from a ReadPixels request.
type ReadPixelsReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 24 bytes
Data []byte // size: xgb.Pad(((int(Length) * 4) * 1))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a ReadPixels request.
func (cook ReadPixelsCookie) Reply() (*ReadPixelsReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return readPixelsReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// readPixelsReply reads a byte slice into a ReadPixelsReply value.
func readPixelsReply(buf []byte) *ReadPixelsReply {
v := new(ReadPixelsReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
b += 24 // padding
v.Data = make([]byte, (int(v.Length) * 4))
copy(v.Data[:(int(v.Length)*4)], buf[b:])
b += xgb.Pad(int((int(v.Length) * 4)))
return v
}
// Write request to wire for ReadPixels
2012-05-11 05:57:34 +02:00
// readPixelsRequest writes a ReadPixels request to a byte slice.
func readPixelsRequest(c *xgb.Conn, ContextTag ContextTag, X int32, Y int32, Width int32, Height int32, Format uint32, Type uint32, SwapBytes bool, LsbFirst bool) []byte {
size := 36
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 111 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
xgb.Put32(buf[b:], uint32(X))
b += 4
xgb.Put32(buf[b:], uint32(Y))
b += 4
xgb.Put32(buf[b:], uint32(Width))
b += 4
xgb.Put32(buf[b:], uint32(Height))
b += 4
xgb.Put32(buf[b:], Format)
b += 4
xgb.Put32(buf[b:], Type)
b += 4
if SwapBytes {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
if LsbFirst {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
return buf
}
2012-05-11 05:57:34 +02:00
// GetBooleanvCookie is a cookie used only for GetBooleanv requests.
type GetBooleanvCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetBooleanv sends a checked request.
// 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 {
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-11 05:57:34 +02: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 {
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-11 05:57:34 +02:00
// GetBooleanvReply represents the data returned from a GetBooleanv request.
type GetBooleanvReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum bool
// padding: 15 bytes
Data []bool // size: xgb.Pad((int(N) * 1))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetBooleanv request.
func (cook GetBooleanvCookie) Reply() (*GetBooleanvReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getBooleanvReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getBooleanvReply reads a byte slice into a GetBooleanvReply value.
func getBooleanvReply(buf []byte) *GetBooleanvReply {
v := new(GetBooleanvReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
b += 4 // padding
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
}
b = xgb.Pad(b)
return v
}
// Write request to wire for GetBooleanv
2012-05-11 05:57:34 +02:00
// getBooleanvRequest writes a GetBooleanv request to a byte slice.
func getBooleanvRequest(c *xgb.Conn, ContextTag ContextTag, Pname int32) []byte {
size := 12
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
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-11 05:57:34 +02:00
// GetClipPlaneCookie is a cookie used only for GetClipPlane requests.
type GetClipPlaneCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetClipPlane sends a checked request.
// 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 {
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-11 05:57:34 +02: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 {
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-11 05:57:34 +02:00
// GetClipPlaneReply represents the data returned from a GetClipPlane request.
type GetClipPlaneReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 24 bytes
Data []Float64 // size: xgb.Pad(((int(Length) / 2) * 8))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetClipPlane request.
func (cook GetClipPlaneCookie) Reply() (*GetClipPlaneReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getClipPlaneReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getClipPlaneReply reads a byte slice into a GetClipPlaneReply value.
func getClipPlaneReply(buf []byte) *GetClipPlaneReply {
v := new(GetClipPlaneReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
b += 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
}
b = xgb.Pad(b)
return v
}
// Write request to wire for GetClipPlane
2012-05-11 05:57:34 +02:00
// getClipPlaneRequest writes a GetClipPlane request to a byte slice.
func getClipPlaneRequest(c *xgb.Conn, ContextTag ContextTag, Plane int32) []byte {
size := 12
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
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
}
2012-05-11 05:57:34 +02:00
// GetDoublevCookie is a cookie used only for GetDoublev requests.
type GetDoublevCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetDoublev sends a checked request.
// 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 {
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-11 05:57:34 +02:00
// GetDoublevUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetDoublevUnchecked(c *xgb.Conn, ContextTag ContextTag, Pname uint32) GetDoublevCookie {
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-11 05:57:34 +02:00
// GetDoublevReply represents the data returned from a GetDoublev request.
type GetDoublevReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum Float64
// padding: 8 bytes
Data []Float64 // size: xgb.Pad((int(N) * 8))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a 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-11 05:57:34 +02:00
// getDoublevReply reads a byte slice into a GetDoublevReply value.
func getDoublevReply(buf []byte) *GetDoublevReply {
v := new(GetDoublevReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
b += 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
}
b = xgb.Pad(b)
return v
}
// Write request to wire for GetDoublev
2012-05-11 05:57:34 +02:00
// getDoublevRequest writes a GetDoublev request to a byte slice.
func getDoublevRequest(c *xgb.Conn, ContextTag ContextTag, Pname uint32) []byte {
size := 12
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
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
}
2012-05-11 05:57:34 +02:00
// GetErrorCookie is a cookie used only for GetError requests.
type GetErrorCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetError sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetErrorCookie.Reply()
func GetError(c *xgb.Conn, ContextTag ContextTag) GetErrorCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetError' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getErrorRequest(c, ContextTag), cookie)
return GetErrorCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetErrorUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetErrorUnchecked(c *xgb.Conn, ContextTag ContextTag) GetErrorCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetError' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getErrorRequest(c, ContextTag), cookie)
return GetErrorCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetErrorReply represents the data returned from a GetError request.
type GetErrorReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
Error int32
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetError request.
func (cook GetErrorCookie) Reply() (*GetErrorReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getErrorReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getErrorReply reads a byte slice into a GetErrorReply value.
func getErrorReply(buf []byte) *GetErrorReply {
v := new(GetErrorReply)
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.Error = int32(xgb.Get32(buf[b:]))
b += 4
return v
}
// Write request to wire for GetError
2012-05-11 05:57:34 +02:00
// getErrorRequest writes a GetError request to a byte slice.
func getErrorRequest(c *xgb.Conn, ContextTag ContextTag) []byte {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 115 // 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-11 05:57:34 +02:00
// GetFloatvCookie is a cookie used only for GetFloatv requests.
type GetFloatvCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetFloatv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetFloatvCookie.Reply()
func GetFloatv(c *xgb.Conn, ContextTag ContextTag, Pname uint32) GetFloatvCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetFloatv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getFloatvRequest(c, ContextTag, Pname), cookie)
return GetFloatvCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetFloatvUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetFloatvUnchecked(c *xgb.Conn, ContextTag ContextTag, Pname uint32) GetFloatvCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetFloatv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getFloatvRequest(c, ContextTag, Pname), cookie)
return GetFloatvCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetFloatvReply represents the data returned from a GetFloatv request.
type GetFloatvReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum Float32
// padding: 12 bytes
Data []Float32 // size: xgb.Pad((int(N) * 4))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetFloatv request.
func (cook GetFloatvCookie) Reply() (*GetFloatvReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getFloatvReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getFloatvReply reads a byte slice into a GetFloatvReply value.
func getFloatvReply(buf []byte) *GetFloatvReply {
v := new(GetFloatvReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
b += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
v.Datum = Float32(xgb.Get32(buf[b:]))
b += 4
b += 12 // padding
v.Data = make([]Float32, v.N)
for i := 0; i < int(v.N); i++ {
v.Data[i] = Float32(xgb.Get32(buf[b:]))
b += 4
}
b = xgb.Pad(b)
return v
}
// Write request to wire for GetFloatv
2012-05-11 05:57:34 +02:00
// getFloatvRequest writes a GetFloatv request to a byte slice.
func getFloatvRequest(c *xgb.Conn, ContextTag ContextTag, Pname uint32) []byte {
size := 12
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 116 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
xgb.Put32(buf[b:], Pname)
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// GetIntegervCookie is a cookie used only for GetIntegerv requests.
type GetIntegervCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetIntegerv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetIntegervCookie.Reply()
func GetIntegerv(c *xgb.Conn, ContextTag ContextTag, Pname uint32) GetIntegervCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetIntegerv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getIntegervRequest(c, ContextTag, Pname), cookie)
return GetIntegervCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetIntegervUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetIntegervUnchecked(c *xgb.Conn, ContextTag ContextTag, Pname uint32) GetIntegervCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetIntegerv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getIntegervRequest(c, ContextTag, Pname), cookie)
return GetIntegervCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetIntegervReply represents the data returned from a GetIntegerv request.
type GetIntegervReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum int32
// padding: 12 bytes
Data []int32 // size: xgb.Pad((int(N) * 4))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetIntegerv request.
func (cook GetIntegervCookie) Reply() (*GetIntegervReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getIntegervReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getIntegervReply reads a byte slice into a GetIntegervReply value.
func getIntegervReply(buf []byte) *GetIntegervReply {
v := new(GetIntegervReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
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
}
b = xgb.Pad(b)
return v
}
// Write request to wire for GetIntegerv
2012-05-11 05:57:34 +02:00
// getIntegervRequest writes a GetIntegerv request to a byte slice.
func getIntegervRequest(c *xgb.Conn, ContextTag ContextTag, Pname uint32) []byte {
size := 12
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 117 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
xgb.Put32(buf[b:], Pname)
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// GetLightfvCookie is a cookie used only for GetLightfv requests.
type GetLightfvCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetLightfv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetLightfvCookie.Reply()
func GetLightfv(c *xgb.Conn, ContextTag ContextTag, Light uint32, Pname uint32) GetLightfvCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetLightfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getLightfvRequest(c, ContextTag, Light, Pname), cookie)
return GetLightfvCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetLightfvUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetLightfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Light uint32, Pname uint32) GetLightfvCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetLightfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getLightfvRequest(c, ContextTag, Light, Pname), cookie)
return GetLightfvCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetLightfvReply represents the data returned from a GetLightfv request.
type GetLightfvReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum Float32
// padding: 12 bytes
Data []Float32 // size: xgb.Pad((int(N) * 4))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetLightfv request.
func (cook GetLightfvCookie) Reply() (*GetLightfvReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getLightfvReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getLightfvReply reads a byte slice into a GetLightfvReply value.
func getLightfvReply(buf []byte) *GetLightfvReply {
v := new(GetLightfvReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
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
}
b = xgb.Pad(b)
return v
}
// Write request to wire for GetLightfv
2012-05-11 05:57:34 +02:00
// getLightfvRequest writes a GetLightfv request to a byte slice.
func getLightfvRequest(c *xgb.Conn, ContextTag ContextTag, Light uint32, Pname uint32) []byte {
size := 16
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 118 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
xgb.Put32(buf[b:], Light)
b += 4
xgb.Put32(buf[b:], Pname)
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// GetLightivCookie is a cookie used only for GetLightiv requests.
type GetLightivCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetLightiv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetLightivCookie.Reply()
func GetLightiv(c *xgb.Conn, ContextTag ContextTag, Light uint32, Pname uint32) GetLightivCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetLightiv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getLightivRequest(c, ContextTag, Light, Pname), cookie)
return GetLightivCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetLightivUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetLightivUnchecked(c *xgb.Conn, ContextTag ContextTag, Light uint32, Pname uint32) GetLightivCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetLightiv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getLightivRequest(c, ContextTag, Light, Pname), cookie)
return GetLightivCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetLightivReply represents the data returned from a GetLightiv request.
type GetLightivReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum int32
// padding: 12 bytes
Data []int32 // size: xgb.Pad((int(N) * 4))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetLightiv request.
func (cook GetLightivCookie) Reply() (*GetLightivReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getLightivReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getLightivReply reads a byte slice into a GetLightivReply value.
func getLightivReply(buf []byte) *GetLightivReply {
v := new(GetLightivReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
b += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
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
}
b = xgb.Pad(b)
return v
}
// Write request to wire for GetLightiv
2012-05-11 05:57:34 +02:00
// getLightivRequest writes a GetLightiv request to a byte slice.
func getLightivRequest(c *xgb.Conn, ContextTag ContextTag, Light uint32, Pname uint32) []byte {
size := 16
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 119 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
xgb.Put32(buf[b:], Light)
b += 4
xgb.Put32(buf[b:], Pname)
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// GetMapdvCookie is a cookie used only for GetMapdv requests.
type GetMapdvCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetMapdv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetMapdvCookie.Reply()
func GetMapdv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Query uint32) GetMapdvCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetMapdv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getMapdvRequest(c, ContextTag, Target, Query), cookie)
return GetMapdvCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetMapdvUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetMapdvUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Query uint32) GetMapdvCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetMapdv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getMapdvRequest(c, ContextTag, Target, Query), cookie)
return GetMapdvCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetMapdvReply represents the data returned from a GetMapdv request.
type GetMapdvReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum Float64
// padding: 8 bytes
Data []Float64 // size: xgb.Pad((int(N) * 8))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetMapdv request.
func (cook GetMapdvCookie) Reply() (*GetMapdvReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getMapdvReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getMapdvReply reads a byte slice into a GetMapdvReply value.
func getMapdvReply(buf []byte) *GetMapdvReply {
v := new(GetMapdvReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
b += 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
}
b = xgb.Pad(b)
return v
}
// Write request to wire for GetMapdv
2012-05-11 05:57:34 +02:00
// getMapdvRequest writes a GetMapdv request to a byte slice.
func getMapdvRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Query uint32) []byte {
size := 16
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 120 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
xgb.Put32(buf[b:], Target)
b += 4
xgb.Put32(buf[b:], Query)
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// GetMapfvCookie is a cookie used only for GetMapfv requests.
type GetMapfvCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetMapfv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetMapfvCookie.Reply()
func GetMapfv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Query uint32) GetMapfvCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetMapfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getMapfvRequest(c, ContextTag, Target, Query), cookie)
return GetMapfvCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetMapfvUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetMapfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Query uint32) GetMapfvCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetMapfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getMapfvRequest(c, ContextTag, Target, Query), cookie)
return GetMapfvCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetMapfvReply represents the data returned from a GetMapfv request.
type GetMapfvReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum Float32
// padding: 12 bytes
Data []Float32 // size: xgb.Pad((int(N) * 4))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetMapfv request.
func (cook GetMapfvCookie) Reply() (*GetMapfvReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getMapfvReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getMapfvReply reads a byte slice into a GetMapfvReply value.
func getMapfvReply(buf []byte) *GetMapfvReply {
v := new(GetMapfvReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
b += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
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
}
b = xgb.Pad(b)
return v
}
// Write request to wire for GetMapfv
2012-05-11 05:57:34 +02:00
// getMapfvRequest writes a GetMapfv request to a byte slice.
func getMapfvRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Query uint32) []byte {
size := 16
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 121 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
xgb.Put32(buf[b:], Target)
b += 4
xgb.Put32(buf[b:], Query)
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// GetMapivCookie is a cookie used only for GetMapiv requests.
type GetMapivCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetMapiv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetMapivCookie.Reply()
func GetMapiv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Query uint32) GetMapivCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetMapiv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getMapivRequest(c, ContextTag, Target, Query), cookie)
return GetMapivCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetMapivUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetMapivUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Query uint32) GetMapivCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetMapiv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getMapivRequest(c, ContextTag, Target, Query), cookie)
return GetMapivCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetMapivReply represents the data returned from a GetMapiv request.
type GetMapivReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum int32
// padding: 12 bytes
Data []int32 // size: xgb.Pad((int(N) * 4))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetMapiv request.
func (cook GetMapivCookie) Reply() (*GetMapivReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getMapivReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getMapivReply reads a byte slice into a GetMapivReply value.
func getMapivReply(buf []byte) *GetMapivReply {
v := new(GetMapivReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
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
}
b = xgb.Pad(b)
return v
}
// Write request to wire for GetMapiv
2012-05-11 05:57:34 +02:00
// getMapivRequest writes a GetMapiv request to a byte slice.
func getMapivRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Query uint32) []byte {
size := 16
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 122 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
xgb.Put32(buf[b:], Target)
b += 4
xgb.Put32(buf[b:], Query)
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// GetMaterialfvCookie is a cookie used only for GetMaterialfv requests.
type GetMaterialfvCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetMaterialfv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetMaterialfvCookie.Reply()
func GetMaterialfv(c *xgb.Conn, ContextTag ContextTag, Face uint32, Pname uint32) GetMaterialfvCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetMaterialfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getMaterialfvRequest(c, ContextTag, Face, Pname), cookie)
return GetMaterialfvCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetMaterialfvUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetMaterialfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Face uint32, Pname uint32) GetMaterialfvCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetMaterialfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getMaterialfvRequest(c, ContextTag, Face, Pname), cookie)
return GetMaterialfvCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetMaterialfvReply represents the data returned from a GetMaterialfv request.
type GetMaterialfvReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum Float32
// padding: 12 bytes
Data []Float32 // size: xgb.Pad((int(N) * 4))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetMaterialfv request.
func (cook GetMaterialfvCookie) Reply() (*GetMaterialfvReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getMaterialfvReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getMaterialfvReply reads a byte slice into a GetMaterialfvReply value.
func getMaterialfvReply(buf []byte) *GetMaterialfvReply {
v := new(GetMaterialfvReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
b += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
v.Datum = Float32(xgb.Get32(buf[b:]))
b += 4
b += 12 // padding
v.Data = make([]Float32, v.N)
for i := 0; i < int(v.N); i++ {
v.Data[i] = Float32(xgb.Get32(buf[b:]))
b += 4
}
b = xgb.Pad(b)
return v
}
// Write request to wire for GetMaterialfv
2012-05-11 05:57:34 +02:00
// getMaterialfvRequest writes a GetMaterialfv request to a byte slice.
func getMaterialfvRequest(c *xgb.Conn, ContextTag ContextTag, Face uint32, Pname uint32) []byte {
size := 16
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 123 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
xgb.Put32(buf[b:], Face)
b += 4
xgb.Put32(buf[b:], Pname)
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// GetMaterialivCookie is a cookie used only for GetMaterialiv requests.
type GetMaterialivCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetMaterialiv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetMaterialivCookie.Reply()
func GetMaterialiv(c *xgb.Conn, ContextTag ContextTag, Face uint32, Pname uint32) GetMaterialivCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetMaterialiv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getMaterialivRequest(c, ContextTag, Face, Pname), cookie)
return GetMaterialivCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetMaterialivUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetMaterialivUnchecked(c *xgb.Conn, ContextTag ContextTag, Face uint32, Pname uint32) GetMaterialivCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetMaterialiv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getMaterialivRequest(c, ContextTag, Face, Pname), cookie)
return GetMaterialivCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetMaterialivReply represents the data returned from a GetMaterialiv request.
type GetMaterialivReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum int32
// padding: 12 bytes
Data []int32 // size: xgb.Pad((int(N) * 4))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetMaterialiv request.
func (cook GetMaterialivCookie) Reply() (*GetMaterialivReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getMaterialivReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getMaterialivReply reads a byte slice into a GetMaterialivReply value.
func getMaterialivReply(buf []byte) *GetMaterialivReply {
v := new(GetMaterialivReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
b += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
v.Datum = int32(xgb.Get32(buf[b:]))
b += 4
b += 12 // padding
v.Data = make([]int32, v.N)
for i := 0; i < int(v.N); i++ {
v.Data[i] = int32(xgb.Get32(buf[b:]))
b += 4
}
b = xgb.Pad(b)
return v
}
// Write request to wire for GetMaterialiv
2012-05-11 05:57:34 +02:00
// getMaterialivRequest writes a GetMaterialiv request to a byte slice.
func getMaterialivRequest(c *xgb.Conn, ContextTag ContextTag, Face uint32, Pname uint32) []byte {
size := 16
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 124 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
xgb.Put32(buf[b:], Face)
b += 4
xgb.Put32(buf[b:], Pname)
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// GetPixelMapfvCookie is a cookie used only for GetPixelMapfv requests.
type GetPixelMapfvCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetPixelMapfv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetPixelMapfvCookie.Reply()
func GetPixelMapfv(c *xgb.Conn, ContextTag ContextTag, Map uint32) GetPixelMapfvCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetPixelMapfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getPixelMapfvRequest(c, ContextTag, Map), cookie)
return GetPixelMapfvCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetPixelMapfvUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetPixelMapfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Map uint32) GetPixelMapfvCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetPixelMapfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getPixelMapfvRequest(c, ContextTag, Map), cookie)
return GetPixelMapfvCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetPixelMapfvReply represents the data returned from a GetPixelMapfv request.
type GetPixelMapfvReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum Float32
// padding: 12 bytes
Data []Float32 // size: xgb.Pad((int(N) * 4))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetPixelMapfv request.
func (cook GetPixelMapfvCookie) Reply() (*GetPixelMapfvReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getPixelMapfvReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getPixelMapfvReply reads a byte slice into a GetPixelMapfvReply value.
func getPixelMapfvReply(buf []byte) *GetPixelMapfvReply {
v := new(GetPixelMapfvReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
b += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
v.Datum = Float32(xgb.Get32(buf[b:]))
b += 4
b += 12 // padding
v.Data = make([]Float32, v.N)
for i := 0; i < int(v.N); i++ {
v.Data[i] = Float32(xgb.Get32(buf[b:]))
b += 4
}
b = xgb.Pad(b)
return v
}
// Write request to wire for GetPixelMapfv
2012-05-11 05:57:34 +02:00
// getPixelMapfvRequest writes a GetPixelMapfv request to a byte slice.
func getPixelMapfvRequest(c *xgb.Conn, ContextTag ContextTag, Map uint32) []byte {
size := 12
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 125 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
xgb.Put32(buf[b:], Map)
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// GetPixelMapuivCookie is a cookie used only for GetPixelMapuiv requests.
type GetPixelMapuivCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetPixelMapuiv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetPixelMapuivCookie.Reply()
func GetPixelMapuiv(c *xgb.Conn, ContextTag ContextTag, Map uint32) GetPixelMapuivCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetPixelMapuiv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getPixelMapuivRequest(c, ContextTag, Map), cookie)
return GetPixelMapuivCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetPixelMapuivUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetPixelMapuivUnchecked(c *xgb.Conn, ContextTag ContextTag, Map uint32) GetPixelMapuivCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetPixelMapuiv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getPixelMapuivRequest(c, ContextTag, Map), cookie)
return GetPixelMapuivCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetPixelMapuivReply represents the data returned from a GetPixelMapuiv request.
type GetPixelMapuivReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum uint32
// padding: 12 bytes
Data []uint32 // size: xgb.Pad((int(N) * 4))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetPixelMapuiv request.
func (cook GetPixelMapuivCookie) Reply() (*GetPixelMapuivReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getPixelMapuivReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getPixelMapuivReply reads a byte slice into a GetPixelMapuivReply value.
func getPixelMapuivReply(buf []byte) *GetPixelMapuivReply {
v := new(GetPixelMapuivReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
b += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
v.Datum = xgb.Get32(buf[b:])
b += 4
b += 12 // padding
v.Data = make([]uint32, v.N)
for i := 0; i < int(v.N); i++ {
v.Data[i] = xgb.Get32(buf[b:])
b += 4
}
b = xgb.Pad(b)
return v
}
// Write request to wire for GetPixelMapuiv
2012-05-11 05:57:34 +02:00
// getPixelMapuivRequest writes a GetPixelMapuiv request to a byte slice.
func getPixelMapuivRequest(c *xgb.Conn, ContextTag ContextTag, Map uint32) []byte {
size := 12
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 126 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
xgb.Put32(buf[b:], Map)
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// GetPixelMapusvCookie is a cookie used only for GetPixelMapusv requests.
type GetPixelMapusvCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetPixelMapusv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetPixelMapusvCookie.Reply()
func GetPixelMapusv(c *xgb.Conn, ContextTag ContextTag, Map uint32) GetPixelMapusvCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetPixelMapusv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getPixelMapusvRequest(c, ContextTag, Map), cookie)
return GetPixelMapusvCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetPixelMapusvUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetPixelMapusvUnchecked(c *xgb.Conn, ContextTag ContextTag, Map uint32) GetPixelMapusvCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetPixelMapusv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getPixelMapusvRequest(c, ContextTag, Map), cookie)
return GetPixelMapusvCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetPixelMapusvReply represents the data returned from a GetPixelMapusv request.
type GetPixelMapusvReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum uint16
// padding: 16 bytes
Data []uint16 // size: xgb.Pad((int(N) * 2))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetPixelMapusv request.
func (cook GetPixelMapusvCookie) Reply() (*GetPixelMapusvReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getPixelMapusvReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getPixelMapusvReply reads a byte slice into a GetPixelMapusvReply value.
func getPixelMapusvReply(buf []byte) *GetPixelMapusvReply {
v := new(GetPixelMapusvReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
b += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
v.Datum = xgb.Get16(buf[b:])
b += 2
b += 16 // padding
v.Data = make([]uint16, v.N)
for i := 0; i < int(v.N); i++ {
v.Data[i] = xgb.Get16(buf[b:])
b += 2
}
b = xgb.Pad(b)
return v
}
// Write request to wire for GetPixelMapusv
2012-05-11 05:57:34 +02:00
// getPixelMapusvRequest writes a GetPixelMapusv request to a byte slice.
func getPixelMapusvRequest(c *xgb.Conn, ContextTag ContextTag, Map uint32) []byte {
size := 12
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 127 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
xgb.Put32(buf[b:], Map)
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// GetPolygonStippleCookie is a cookie used only for GetPolygonStipple requests.
type GetPolygonStippleCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetPolygonStipple sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetPolygonStippleCookie.Reply()
func GetPolygonStipple(c *xgb.Conn, ContextTag ContextTag, LsbFirst bool) GetPolygonStippleCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetPolygonStipple' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getPolygonStippleRequest(c, ContextTag, LsbFirst), cookie)
return GetPolygonStippleCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetPolygonStippleUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetPolygonStippleUnchecked(c *xgb.Conn, ContextTag ContextTag, LsbFirst bool) GetPolygonStippleCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetPolygonStipple' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getPolygonStippleRequest(c, ContextTag, LsbFirst), cookie)
return GetPolygonStippleCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetPolygonStippleReply represents the data returned from a GetPolygonStipple request.
type GetPolygonStippleReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 24 bytes
Data []byte // size: xgb.Pad(((int(Length) * 4) * 1))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetPolygonStipple request.
func (cook GetPolygonStippleCookie) Reply() (*GetPolygonStippleReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getPolygonStippleReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getPolygonStippleReply reads a byte slice into a GetPolygonStippleReply value.
func getPolygonStippleReply(buf []byte) *GetPolygonStippleReply {
v := new(GetPolygonStippleReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
b += 24 // padding
v.Data = make([]byte, (int(v.Length) * 4))
copy(v.Data[:(int(v.Length)*4)], buf[b:])
b += xgb.Pad(int((int(v.Length) * 4)))
return v
}
// Write request to wire for GetPolygonStipple
2012-05-11 05:57:34 +02:00
// getPolygonStippleRequest writes a GetPolygonStipple request to a byte slice.
func getPolygonStippleRequest(c *xgb.Conn, ContextTag ContextTag, LsbFirst bool) []byte {
size := 12
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 128 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
if LsbFirst {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
return buf
}
2012-05-11 05:57:34 +02:00
// GetStringCookie is a cookie used only for GetString requests.
type GetStringCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetString sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetStringCookie.Reply()
func GetString(c *xgb.Conn, ContextTag ContextTag, Name uint32) GetStringCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetString' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getStringRequest(c, ContextTag, Name), cookie)
return GetStringCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetStringUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetStringUnchecked(c *xgb.Conn, ContextTag ContextTag, Name uint32) GetStringCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetString' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getStringRequest(c, ContextTag, Name), cookie)
return GetStringCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetStringReply represents the data returned from a GetString request.
type GetStringReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
// padding: 16 bytes
String string // size: xgb.Pad((int(N) * 1))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetString request.
func (cook GetStringCookie) Reply() (*GetStringReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getStringReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getStringReply reads a byte slice into a GetStringReply value.
func getStringReply(buf []byte) *GetStringReply {
v := new(GetStringReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
b += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
b += 16 // padding
{
byteString := make([]byte, v.N)
copy(byteString[:v.N], buf[b:])
v.String = string(byteString)
b += xgb.Pad(int(v.N))
}
return v
}
// Write request to wire for GetString
2012-05-11 05:57:34 +02:00
// getStringRequest writes a GetString request to a byte slice.
func getStringRequest(c *xgb.Conn, ContextTag ContextTag, Name uint32) []byte {
size := 12
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 129 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
xgb.Put32(buf[b:], Name)
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// GetTexEnvfvCookie is a cookie used only for GetTexEnvfv requests.
type GetTexEnvfvCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetTexEnvfv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetTexEnvfvCookie.Reply()
func GetTexEnvfv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetTexEnvfvCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetTexEnvfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getTexEnvfvRequest(c, ContextTag, Target, Pname), cookie)
return GetTexEnvfvCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetTexEnvfvUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetTexEnvfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetTexEnvfvCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetTexEnvfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getTexEnvfvRequest(c, ContextTag, Target, Pname), cookie)
return GetTexEnvfvCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetTexEnvfvReply represents the data returned from a GetTexEnvfv request.
type GetTexEnvfvReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum Float32
// padding: 12 bytes
Data []Float32 // size: xgb.Pad((int(N) * 4))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetTexEnvfv request.
func (cook GetTexEnvfvCookie) Reply() (*GetTexEnvfvReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getTexEnvfvReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getTexEnvfvReply reads a byte slice into a GetTexEnvfvReply value.
func getTexEnvfvReply(buf []byte) *GetTexEnvfvReply {
v := new(GetTexEnvfvReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
b += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
v.Datum = Float32(xgb.Get32(buf[b:]))
b += 4
b += 12 // padding
v.Data = make([]Float32, v.N)
for i := 0; i < int(v.N); i++ {
v.Data[i] = Float32(xgb.Get32(buf[b:]))
b += 4
}
b = xgb.Pad(b)
return v
}
// Write request to wire for GetTexEnvfv
2012-05-11 05:57:34 +02:00
// getTexEnvfvRequest writes a GetTexEnvfv request to a byte slice.
func getTexEnvfvRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) []byte {
size := 16
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 130 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
xgb.Put32(buf[b:], Target)
b += 4
xgb.Put32(buf[b:], Pname)
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// GetTexEnvivCookie is a cookie used only for GetTexEnviv requests.
type GetTexEnvivCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetTexEnviv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetTexEnvivCookie.Reply()
func GetTexEnviv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetTexEnvivCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetTexEnviv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getTexEnvivRequest(c, ContextTag, Target, Pname), cookie)
return GetTexEnvivCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetTexEnvivUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetTexEnvivUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetTexEnvivCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetTexEnviv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getTexEnvivRequest(c, ContextTag, Target, Pname), cookie)
return GetTexEnvivCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetTexEnvivReply represents the data returned from a GetTexEnviv request.
type GetTexEnvivReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum int32
// padding: 12 bytes
Data []int32 // size: xgb.Pad((int(N) * 4))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetTexEnviv request.
func (cook GetTexEnvivCookie) Reply() (*GetTexEnvivReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getTexEnvivReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getTexEnvivReply reads a byte slice into a GetTexEnvivReply value.
func getTexEnvivReply(buf []byte) *GetTexEnvivReply {
v := new(GetTexEnvivReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
b += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
v.Datum = int32(xgb.Get32(buf[b:]))
b += 4
b += 12 // padding
v.Data = make([]int32, v.N)
for i := 0; i < int(v.N); i++ {
v.Data[i] = int32(xgb.Get32(buf[b:]))
b += 4
}
b = xgb.Pad(b)
return v
}
// Write request to wire for GetTexEnviv
2012-05-11 05:57:34 +02:00
// getTexEnvivRequest writes a GetTexEnviv request to a byte slice.
func getTexEnvivRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) []byte {
size := 16
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 131 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
xgb.Put32(buf[b:], Target)
b += 4
xgb.Put32(buf[b:], Pname)
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// GetTexGendvCookie is a cookie used only for GetTexGendv requests.
type GetTexGendvCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetTexGendv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetTexGendvCookie.Reply()
func GetTexGendv(c *xgb.Conn, ContextTag ContextTag, Coord uint32, Pname uint32) GetTexGendvCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetTexGendv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getTexGendvRequest(c, ContextTag, Coord, Pname), cookie)
return GetTexGendvCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetTexGendvUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetTexGendvUnchecked(c *xgb.Conn, ContextTag ContextTag, Coord uint32, Pname uint32) GetTexGendvCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetTexGendv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getTexGendvRequest(c, ContextTag, Coord, Pname), cookie)
return GetTexGendvCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetTexGendvReply represents the data returned from a GetTexGendv request.
type GetTexGendvReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum Float64
// padding: 8 bytes
Data []Float64 // size: xgb.Pad((int(N) * 8))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetTexGendv request.
func (cook GetTexGendvCookie) Reply() (*GetTexGendvReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getTexGendvReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getTexGendvReply reads a byte slice into a GetTexGendvReply value.
func getTexGendvReply(buf []byte) *GetTexGendvReply {
v := new(GetTexGendvReply)
b := 1 // skip reply determinant
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 = 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
}
b = xgb.Pad(b)
return v
}
// Write request to wire for GetTexGendv
2012-05-11 05:57:34 +02:00
// getTexGendvRequest writes a GetTexGendv request to a byte slice.
func getTexGendvRequest(c *xgb.Conn, ContextTag ContextTag, Coord uint32, Pname uint32) []byte {
size := 16
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 132 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
xgb.Put32(buf[b:], Coord)
b += 4
xgb.Put32(buf[b:], Pname)
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// GetTexGenfvCookie is a cookie used only for GetTexGenfv requests.
type GetTexGenfvCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetTexGenfv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetTexGenfvCookie.Reply()
func GetTexGenfv(c *xgb.Conn, ContextTag ContextTag, Coord uint32, Pname uint32) GetTexGenfvCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetTexGenfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getTexGenfvRequest(c, ContextTag, Coord, Pname), cookie)
return GetTexGenfvCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetTexGenfvUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetTexGenfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Coord uint32, Pname uint32) GetTexGenfvCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetTexGenfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getTexGenfvRequest(c, ContextTag, Coord, Pname), cookie)
return GetTexGenfvCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetTexGenfvReply represents the data returned from a GetTexGenfv request.
type GetTexGenfvReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum Float32
// padding: 12 bytes
Data []Float32 // size: xgb.Pad((int(N) * 4))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetTexGenfv request.
func (cook GetTexGenfvCookie) Reply() (*GetTexGenfvReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getTexGenfvReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getTexGenfvReply reads a byte slice into a GetTexGenfvReply value.
func getTexGenfvReply(buf []byte) *GetTexGenfvReply {
v := new(GetTexGenfvReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
b += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
v.Datum = Float32(xgb.Get32(buf[b:]))
b += 4
b += 12 // padding
v.Data = make([]Float32, v.N)
for i := 0; i < int(v.N); i++ {
v.Data[i] = Float32(xgb.Get32(buf[b:]))
b += 4
}
b = xgb.Pad(b)
return v
}
// Write request to wire for GetTexGenfv
2012-05-11 05:57:34 +02:00
// getTexGenfvRequest writes a GetTexGenfv request to a byte slice.
func getTexGenfvRequest(c *xgb.Conn, ContextTag ContextTag, Coord uint32, Pname uint32) []byte {
size := 16
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 133 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
xgb.Put32(buf[b:], Coord)
b += 4
xgb.Put32(buf[b:], Pname)
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// GetTexGenivCookie is a cookie used only for GetTexGeniv requests.
type GetTexGenivCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetTexGeniv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetTexGenivCookie.Reply()
func GetTexGeniv(c *xgb.Conn, ContextTag ContextTag, Coord uint32, Pname uint32) GetTexGenivCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetTexGeniv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getTexGenivRequest(c, ContextTag, Coord, Pname), cookie)
return GetTexGenivCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetTexGenivUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetTexGenivUnchecked(c *xgb.Conn, ContextTag ContextTag, Coord uint32, Pname uint32) GetTexGenivCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetTexGeniv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getTexGenivRequest(c, ContextTag, Coord, Pname), cookie)
return GetTexGenivCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetTexGenivReply represents the data returned from a GetTexGeniv request.
type GetTexGenivReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum int32
// padding: 12 bytes
Data []int32 // size: xgb.Pad((int(N) * 4))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetTexGeniv request.
func (cook GetTexGenivCookie) Reply() (*GetTexGenivReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getTexGenivReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getTexGenivReply reads a byte slice into a GetTexGenivReply value.
func getTexGenivReply(buf []byte) *GetTexGenivReply {
v := new(GetTexGenivReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
b += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
v.Datum = int32(xgb.Get32(buf[b:]))
b += 4
b += 12 // padding
v.Data = make([]int32, v.N)
for i := 0; i < int(v.N); i++ {
v.Data[i] = int32(xgb.Get32(buf[b:]))
b += 4
}
b = xgb.Pad(b)
return v
}
// Write request to wire for GetTexGeniv
2012-05-11 05:57:34 +02:00
// getTexGenivRequest writes a GetTexGeniv request to a byte slice.
func getTexGenivRequest(c *xgb.Conn, ContextTag ContextTag, Coord uint32, Pname uint32) []byte {
size := 16
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 134 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
xgb.Put32(buf[b:], Coord)
b += 4
xgb.Put32(buf[b:], Pname)
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// GetTexImageCookie is a cookie used only for GetTexImage requests.
type GetTexImageCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetTexImage sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetTexImageCookie.Reply()
func GetTexImage(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32, Format uint32, Type uint32, SwapBytes bool) GetTexImageCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetTexImage' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getTexImageRequest(c, ContextTag, Target, Level, Format, Type, SwapBytes), cookie)
return GetTexImageCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetTexImageUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetTexImageUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32, Format uint32, Type uint32, SwapBytes bool) GetTexImageCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetTexImage' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getTexImageRequest(c, ContextTag, Target, Level, Format, Type, SwapBytes), cookie)
return GetTexImageCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetTexImageReply represents the data returned from a GetTexImage request.
type GetTexImageReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 8 bytes
Width int32
Height int32
Depth int32
// padding: 4 bytes
Data []byte // size: xgb.Pad(((int(Length) * 4) * 1))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetTexImage request.
func (cook GetTexImageCookie) Reply() (*GetTexImageReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getTexImageReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getTexImageReply reads a byte slice into a GetTexImageReply value.
func getTexImageReply(buf []byte) *GetTexImageReply {
v := new(GetTexImageReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
b += 8 // padding
v.Width = int32(xgb.Get32(buf[b:]))
b += 4
v.Height = int32(xgb.Get32(buf[b:]))
b += 4
v.Depth = int32(xgb.Get32(buf[b:]))
b += 4
b += 4 // padding
v.Data = make([]byte, (int(v.Length) * 4))
copy(v.Data[:(int(v.Length)*4)], buf[b:])
b += xgb.Pad(int((int(v.Length) * 4)))
return v
}
// Write request to wire for GetTexImage
2012-05-11 05:57:34 +02:00
// getTexImageRequest writes a GetTexImage request to a byte slice.
func getTexImageRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32, Format uint32, Type uint32, SwapBytes bool) []byte {
size := 28
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 135 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
xgb.Put32(buf[b:], Target)
b += 4
xgb.Put32(buf[b:], uint32(Level))
b += 4
xgb.Put32(buf[b:], Format)
b += 4
xgb.Put32(buf[b:], Type)
b += 4
if SwapBytes {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
return buf
}
2012-05-11 05:57:34 +02:00
// GetTexParameterfvCookie is a cookie used only for GetTexParameterfv requests.
type GetTexParameterfvCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetTexParameterfv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetTexParameterfvCookie.Reply()
func GetTexParameterfv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetTexParameterfvCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetTexParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getTexParameterfvRequest(c, ContextTag, Target, Pname), cookie)
return GetTexParameterfvCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetTexParameterfvUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetTexParameterfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetTexParameterfvCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetTexParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getTexParameterfvRequest(c, ContextTag, Target, Pname), cookie)
return GetTexParameterfvCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetTexParameterfvReply represents the data returned from a GetTexParameterfv request.
type GetTexParameterfvReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum Float32
// padding: 12 bytes
Data []Float32 // size: xgb.Pad((int(N) * 4))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetTexParameterfv request.
func (cook GetTexParameterfvCookie) Reply() (*GetTexParameterfvReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getTexParameterfvReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getTexParameterfvReply reads a byte slice into a GetTexParameterfvReply value.
func getTexParameterfvReply(buf []byte) *GetTexParameterfvReply {
v := new(GetTexParameterfvReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
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
}
b = xgb.Pad(b)
return v
}
// Write request to wire for GetTexParameterfv
2012-05-11 05:57:34 +02:00
// getTexParameterfvRequest writes a GetTexParameterfv request to a byte slice.
func getTexParameterfvRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) []byte {
size := 16
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 136 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
xgb.Put32(buf[b:], Target)
b += 4
xgb.Put32(buf[b:], Pname)
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// GetTexParameterivCookie is a cookie used only for GetTexParameteriv requests.
type GetTexParameterivCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetTexParameteriv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetTexParameterivCookie.Reply()
func GetTexParameteriv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetTexParameterivCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetTexParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getTexParameterivRequest(c, ContextTag, Target, Pname), cookie)
return GetTexParameterivCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetTexParameterivUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetTexParameterivUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetTexParameterivCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetTexParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getTexParameterivRequest(c, ContextTag, Target, Pname), cookie)
return GetTexParameterivCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetTexParameterivReply represents the data returned from a GetTexParameteriv request.
type GetTexParameterivReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum int32
// padding: 12 bytes
Data []int32 // size: xgb.Pad((int(N) * 4))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetTexParameteriv request.
func (cook GetTexParameterivCookie) Reply() (*GetTexParameterivReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getTexParameterivReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getTexParameterivReply reads a byte slice into a GetTexParameterivReply value.
func getTexParameterivReply(buf []byte) *GetTexParameterivReply {
v := new(GetTexParameterivReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
b += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
v.Datum = int32(xgb.Get32(buf[b:]))
b += 4
b += 12 // padding
v.Data = make([]int32, v.N)
for i := 0; i < int(v.N); i++ {
v.Data[i] = int32(xgb.Get32(buf[b:]))
b += 4
}
b = xgb.Pad(b)
return v
}
// Write request to wire for GetTexParameteriv
2012-05-11 05:57:34 +02:00
// getTexParameterivRequest writes a GetTexParameteriv request to a byte slice.
func getTexParameterivRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) []byte {
size := 16
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 137 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
xgb.Put32(buf[b:], Target)
b += 4
xgb.Put32(buf[b:], Pname)
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// GetTexLevelParameterfvCookie is a cookie used only for GetTexLevelParameterfv requests.
type GetTexLevelParameterfvCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetTexLevelParameterfv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetTexLevelParameterfvCookie.Reply()
func GetTexLevelParameterfv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32, Pname uint32) GetTexLevelParameterfvCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetTexLevelParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getTexLevelParameterfvRequest(c, ContextTag, Target, Level, Pname), cookie)
return GetTexLevelParameterfvCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetTexLevelParameterfvUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetTexLevelParameterfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32, Pname uint32) GetTexLevelParameterfvCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetTexLevelParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getTexLevelParameterfvRequest(c, ContextTag, Target, Level, Pname), cookie)
return GetTexLevelParameterfvCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetTexLevelParameterfvReply represents the data returned from a GetTexLevelParameterfv request.
type GetTexLevelParameterfvReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum Float32
// padding: 12 bytes
Data []Float32 // size: xgb.Pad((int(N) * 4))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetTexLevelParameterfv request.
func (cook GetTexLevelParameterfvCookie) Reply() (*GetTexLevelParameterfvReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getTexLevelParameterfvReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getTexLevelParameterfvReply reads a byte slice into a GetTexLevelParameterfvReply value.
func getTexLevelParameterfvReply(buf []byte) *GetTexLevelParameterfvReply {
v := new(GetTexLevelParameterfvReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
b += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
v.Datum = Float32(xgb.Get32(buf[b:]))
b += 4
b += 12 // padding
v.Data = make([]Float32, v.N)
for i := 0; i < int(v.N); i++ {
v.Data[i] = Float32(xgb.Get32(buf[b:]))
b += 4
}
b = xgb.Pad(b)
return v
}
// Write request to wire for GetTexLevelParameterfv
2012-05-11 05:57:34 +02:00
// getTexLevelParameterfvRequest writes a GetTexLevelParameterfv request to a byte slice.
func getTexLevelParameterfvRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32, Pname uint32) []byte {
size := 20
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 138 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
xgb.Put32(buf[b:], Target)
b += 4
xgb.Put32(buf[b:], uint32(Level))
b += 4
xgb.Put32(buf[b:], Pname)
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// GetTexLevelParameterivCookie is a cookie used only for GetTexLevelParameteriv requests.
type GetTexLevelParameterivCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetTexLevelParameteriv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetTexLevelParameterivCookie.Reply()
func GetTexLevelParameteriv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32, Pname uint32) GetTexLevelParameterivCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetTexLevelParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getTexLevelParameterivRequest(c, ContextTag, Target, Level, Pname), cookie)
return GetTexLevelParameterivCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetTexLevelParameterivUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetTexLevelParameterivUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32, Pname uint32) GetTexLevelParameterivCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetTexLevelParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getTexLevelParameterivRequest(c, ContextTag, Target, Level, Pname), cookie)
return GetTexLevelParameterivCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetTexLevelParameterivReply represents the data returned from a GetTexLevelParameteriv request.
type GetTexLevelParameterivReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum int32
// padding: 12 bytes
Data []int32 // size: xgb.Pad((int(N) * 4))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetTexLevelParameteriv request.
func (cook GetTexLevelParameterivCookie) Reply() (*GetTexLevelParameterivReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getTexLevelParameterivReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getTexLevelParameterivReply reads a byte slice into a GetTexLevelParameterivReply value.
func getTexLevelParameterivReply(buf []byte) *GetTexLevelParameterivReply {
v := new(GetTexLevelParameterivReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
b += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
v.Datum = int32(xgb.Get32(buf[b:]))
b += 4
b += 12 // padding
v.Data = make([]int32, v.N)
for i := 0; i < int(v.N); i++ {
v.Data[i] = int32(xgb.Get32(buf[b:]))
b += 4
}
b = xgb.Pad(b)
return v
}
// Write request to wire for GetTexLevelParameteriv
2012-05-11 05:57:34 +02:00
// getTexLevelParameterivRequest writes a GetTexLevelParameteriv request to a byte slice.
func getTexLevelParameterivRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32, Pname uint32) []byte {
size := 20
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 139 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
xgb.Put32(buf[b:], Target)
b += 4
xgb.Put32(buf[b:], uint32(Level))
b += 4
xgb.Put32(buf[b:], Pname)
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// IsListCookie is a cookie used only for IsList requests.
type IsListCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// IsList sends a checked request.
// If an error occurs, it will be returned with the reply by calling IsListCookie.Reply()
func IsList(c *xgb.Conn, ContextTag ContextTag, List uint32) IsListCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'IsList' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(isListRequest(c, ContextTag, List), cookie)
return IsListCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// IsListUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func IsListUnchecked(c *xgb.Conn, ContextTag ContextTag, List uint32) IsListCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'IsList' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(isListRequest(c, ContextTag, List), cookie)
return IsListCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// IsListReply represents the data returned from a IsList request.
type IsListReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
RetVal Bool32
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a IsList request.
func (cook IsListCookie) Reply() (*IsListReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return isListReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// isListReply reads a byte slice into a IsListReply value.
func isListReply(buf []byte) *IsListReply {
v := new(IsListReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
v.RetVal = Bool32(xgb.Get32(buf[b:]))
b += 4
return v
}
// Write request to wire for IsList
2012-05-11 05:57:34 +02:00
// isListRequest writes a IsList request to a byte slice.
func isListRequest(c *xgb.Conn, ContextTag ContextTag, List uint32) []byte {
size := 12
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 141 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
xgb.Put32(buf[b:], List)
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// FlushCookie is a cookie used only for Flush requests.
type FlushCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// 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 {
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}
}
2012-05-11 05:57:34 +02:00
// FlushChecked sends a checked request.
// If an error occurs, it can be retrieved using FlushCookie.Check()
func FlushChecked(c *xgb.Conn, ContextTag ContextTag) FlushCookie {
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}
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook FlushCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for Flush
2012-05-11 05:57:34 +02:00
// flushRequest writes a Flush request to a byte slice.
func flushRequest(c *xgb.Conn, ContextTag ContextTag) []byte {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
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-11 05:57:34 +02:00
// AreTexturesResidentCookie is a cookie used only for AreTexturesResident requests.
type AreTexturesResidentCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// AreTexturesResident sends a checked request.
// If an error occurs, it will be returned with the reply by calling AreTexturesResidentCookie.Reply()
func AreTexturesResident(c *xgb.Conn, ContextTag ContextTag, N int32, Textures []uint32) AreTexturesResidentCookie {
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}
}
2012-05-11 05:57:34 +02:00
// AreTexturesResidentUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func AreTexturesResidentUnchecked(c *xgb.Conn, ContextTag ContextTag, N int32, Textures []uint32) AreTexturesResidentCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'AreTexturesResident' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(areTexturesResidentRequest(c, ContextTag, N, Textures), cookie)
return AreTexturesResidentCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// AreTexturesResidentReply represents the data returned from a AreTexturesResident request.
type AreTexturesResidentReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
RetVal Bool32
// padding: 20 bytes
Data []bool // size: xgb.Pad(((int(Length) * 4) * 1))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a AreTexturesResident request.
func (cook AreTexturesResidentCookie) Reply() (*AreTexturesResidentReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return areTexturesResidentReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// areTexturesResidentReply reads a byte slice into a AreTexturesResidentReply value.
func areTexturesResidentReply(buf []byte) *AreTexturesResidentReply {
v := new(AreTexturesResidentReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
v.RetVal = Bool32(xgb.Get32(buf[b:]))
b += 4
b += 20 // padding
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
}
b = xgb.Pad(b)
return v
}
// Write request to wire for AreTexturesResident
2012-05-11 05:57:34 +02:00
// areTexturesResidentRequest writes a AreTexturesResident request to a byte slice.
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)
buf[b] = c.Extensions["GLX"]
b += 1
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
xgb.Put32(buf[b:], uint32(N))
b += 4
for i := 0; i < int(N); i++ {
xgb.Put32(buf[b:], Textures[i])
b += 4
}
b = xgb.Pad(b)
return buf
}
2012-05-11 05:57:34 +02:00
// DeleteTexturesCookie is a cookie used only for DeleteTextures requests.
type DeleteTexturesCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// DeleteTextures sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func DeleteTextures(c *xgb.Conn, ContextTag ContextTag, N int32, Textures []uint32) DeleteTexturesCookie {
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}
}
2012-05-11 05:57:34 +02:00
// DeleteTexturesChecked sends a checked request.
// If an error occurs, it can be retrieved using DeleteTexturesCookie.Check()
func DeleteTexturesChecked(c *xgb.Conn, ContextTag ContextTag, N int32, Textures []uint32) DeleteTexturesCookie {
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}
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook DeleteTexturesCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for DeleteTextures
2012-05-11 05:57:34 +02:00
// deleteTexturesRequest writes a DeleteTextures request to a byte slice.
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)
buf[b] = c.Extensions["GLX"]
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
}
b = xgb.Pad(b)
return buf
}
2012-05-11 05:57:34 +02:00
// GenTexturesCookie is a cookie used only for GenTextures requests.
type GenTexturesCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GenTextures sends a checked request.
// If an error occurs, it will be returned with the reply by calling GenTexturesCookie.Reply()
func GenTextures(c *xgb.Conn, ContextTag ContextTag, N int32) GenTexturesCookie {
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(true, true)
c.NewRequest(genTexturesRequest(c, ContextTag, N), cookie)
return GenTexturesCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// 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 {
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}
}
2012-05-11 05:57:34 +02:00
// GenTexturesReply represents the data returned from a GenTextures request.
type GenTexturesReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 24 bytes
Data []uint32 // size: xgb.Pad((int(Length) * 4))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GenTextures request.
func (cook GenTexturesCookie) Reply() (*GenTexturesReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return genTexturesReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// genTexturesReply reads a byte slice into a GenTexturesReply value.
func genTexturesReply(buf []byte) *GenTexturesReply {
v := new(GenTexturesReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
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
}
b = xgb.Pad(b)
return v
}
// Write request to wire for GenTextures
2012-05-11 05:57:34 +02:00
// genTexturesRequest writes a GenTextures request to a byte slice.
func genTexturesRequest(c *xgb.Conn, ContextTag ContextTag, N int32) []byte {
size := 12
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 145 // 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
return buf
}
2012-05-11 05:57:34 +02:00
// IsTextureCookie is a cookie used only for IsTexture requests.
type IsTextureCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// IsTexture sends a checked request.
// If an error occurs, it will be returned with the reply by calling IsTextureCookie.Reply()
func IsTexture(c *xgb.Conn, ContextTag ContextTag, Texture uint32) IsTextureCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'IsTexture' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(isTextureRequest(c, ContextTag, Texture), cookie)
return IsTextureCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// IsTextureUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func IsTextureUnchecked(c *xgb.Conn, ContextTag ContextTag, Texture uint32) IsTextureCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'IsTexture' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(isTextureRequest(c, ContextTag, Texture), cookie)
return IsTextureCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// IsTextureReply represents the data returned from a IsTexture request.
type IsTextureReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
RetVal Bool32
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a IsTexture request.
func (cook IsTextureCookie) Reply() (*IsTextureReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return isTextureReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// isTextureReply reads a byte slice into a IsTextureReply value.
func isTextureReply(buf []byte) *IsTextureReply {
v := new(IsTextureReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
v.RetVal = Bool32(xgb.Get32(buf[b:]))
b += 4
return v
}
// Write request to wire for IsTexture
2012-05-11 05:57:34 +02:00
// isTextureRequest writes a IsTexture request to a byte slice.
func isTextureRequest(c *xgb.Conn, ContextTag ContextTag, Texture uint32) []byte {
size := 12
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 146 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
xgb.Put32(buf[b:], Texture)
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// GetColorTableCookie is a cookie used only for GetColorTable requests.
type GetColorTableCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetColorTable sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetColorTableCookie.Reply()
func GetColorTable(c *xgb.Conn, ContextTag ContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool) GetColorTableCookie {
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}
}
2012-05-11 05:57:34 +02:00
// GetColorTableUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetColorTableUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool) GetColorTableCookie {
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}
}
2012-05-11 05:57:34 +02:00
// GetColorTableReply represents the data returned from a GetColorTable request.
type GetColorTableReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 8 bytes
Width int32
// padding: 12 bytes
Data []byte // size: xgb.Pad(((int(Length) * 4) * 1))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetColorTable request.
func (cook GetColorTableCookie) Reply() (*GetColorTableReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getColorTableReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// 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 += xgb.Pad(int((int(v.Length) * 4)))
return v
}
// Write request to wire for GetColorTable
2012-05-11 05:57:34 +02:00
// getColorTableRequest writes a GetColorTable request to a byte slice.
func getColorTableRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool) []byte {
size := 24
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
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
}
2012-05-11 05:57:34 +02:00
// GetColorTableParameterfvCookie is a cookie used only for GetColorTableParameterfv requests.
type GetColorTableParameterfvCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetColorTableParameterfv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetColorTableParameterfvCookie.Reply()
func GetColorTableParameterfv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetColorTableParameterfvCookie {
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}
}
2012-05-11 05:57:34 +02:00
// GetColorTableParameterfvUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetColorTableParameterfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetColorTableParameterfvCookie {
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}
}
2012-05-11 05:57:34 +02:00
// GetColorTableParameterfvReply represents the data returned from a GetColorTableParameterfv request.
type GetColorTableParameterfvReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum Float32
// padding: 12 bytes
Data []Float32 // size: xgb.Pad((int(N) * 4))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a 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
}
2012-05-11 05:57:34 +02:00
// getColorTableParameterfvReply reads a byte slice into a GetColorTableParameterfvReply value.
func getColorTableParameterfvReply(buf []byte) *GetColorTableParameterfvReply {
v := new(GetColorTableParameterfvReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
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
}
b = xgb.Pad(b)
return v
}
// Write request to wire for GetColorTableParameterfv
2012-05-11 05:57:34 +02:00
// getColorTableParameterfvRequest writes a GetColorTableParameterfv request to a byte slice.
func getColorTableParameterfvRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) []byte {
size := 16
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
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
}
2012-05-11 05:57:34 +02:00
// GetColorTableParameterivCookie is a cookie used only for GetColorTableParameteriv requests.
type GetColorTableParameterivCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetColorTableParameteriv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetColorTableParameterivCookie.Reply()
func GetColorTableParameteriv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetColorTableParameterivCookie {
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}
}
2012-05-11 05:57:34 +02:00
// GetColorTableParameterivUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetColorTableParameterivUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetColorTableParameterivCookie {
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}
}
2012-05-11 05:57:34 +02:00
// GetColorTableParameterivReply represents the data returned from a GetColorTableParameteriv request.
type GetColorTableParameterivReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum int32
// padding: 12 bytes
Data []int32 // size: xgb.Pad((int(N) * 4))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a 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
}
2012-05-11 05:57:34 +02:00
// getColorTableParameterivReply reads a byte slice into a GetColorTableParameterivReply value.
func getColorTableParameterivReply(buf []byte) *GetColorTableParameterivReply {
v := new(GetColorTableParameterivReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
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
}
b = xgb.Pad(b)
return v
}
// Write request to wire for GetColorTableParameteriv
2012-05-11 05:57:34 +02:00
// getColorTableParameterivRequest writes a GetColorTableParameteriv request to a byte slice.
func getColorTableParameterivRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) []byte {
size := 16
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
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
}
2012-05-11 05:57:34 +02:00
// GetConvolutionFilterCookie is a cookie used only for GetConvolutionFilter requests.
type GetConvolutionFilterCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetConvolutionFilter sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetConvolutionFilterCookie.Reply()
func GetConvolutionFilter(c *xgb.Conn, ContextTag ContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool) GetConvolutionFilterCookie {
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}
}
2012-05-11 05:57:34 +02:00
// GetConvolutionFilterUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetConvolutionFilterUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool) GetConvolutionFilterCookie {
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}
}
2012-05-11 05:57:34 +02:00
// GetConvolutionFilterReply represents the data returned from a GetConvolutionFilter request.
type GetConvolutionFilterReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 8 bytes
Width int32
Height int32
// padding: 8 bytes
Data []byte // size: xgb.Pad(((int(Length) * 4) * 1))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetConvolutionFilter request.
func (cook GetConvolutionFilterCookie) Reply() (*GetConvolutionFilterReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getConvolutionFilterReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getConvolutionFilterReply reads a byte slice into a GetConvolutionFilterReply value.
func getConvolutionFilterReply(buf []byte) *GetConvolutionFilterReply {
v := new(GetConvolutionFilterReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
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 += xgb.Pad(int((int(v.Length) * 4)))
return v
}
// Write request to wire for GetConvolutionFilter
2012-05-11 05:57:34 +02:00
// getConvolutionFilterRequest writes a GetConvolutionFilter request to a byte slice.
func getConvolutionFilterRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool) []byte {
size := 24
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
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
}
2012-05-11 05:57:34 +02:00
// GetConvolutionParameterfvCookie is a cookie used only for GetConvolutionParameterfv requests.
type GetConvolutionParameterfvCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetConvolutionParameterfv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetConvolutionParameterfvCookie.Reply()
func GetConvolutionParameterfv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetConvolutionParameterfvCookie {
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}
}
2012-05-11 05:57:34 +02:00
// GetConvolutionParameterfvUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetConvolutionParameterfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetConvolutionParameterfvCookie {
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}
}
2012-05-11 05:57:34 +02:00
// GetConvolutionParameterfvReply represents the data returned from a GetConvolutionParameterfv request.
type GetConvolutionParameterfvReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum Float32
// padding: 12 bytes
Data []Float32 // size: xgb.Pad((int(N) * 4))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a 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
}
2012-05-11 05:57:34 +02:00
// 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
}
b = xgb.Pad(b)
return v
}
// Write request to wire for GetConvolutionParameterfv
2012-05-11 05:57:34 +02:00
// getConvolutionParameterfvRequest writes a GetConvolutionParameterfv request to a byte slice.
func getConvolutionParameterfvRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) []byte {
size := 16
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
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
}
2012-05-11 05:57:34 +02:00
// GetConvolutionParameterivCookie is a cookie used only for GetConvolutionParameteriv requests.
type GetConvolutionParameterivCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetConvolutionParameteriv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetConvolutionParameterivCookie.Reply()
func GetConvolutionParameteriv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetConvolutionParameterivCookie {
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}
}
2012-05-11 05:57:34 +02:00
// GetConvolutionParameterivUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetConvolutionParameterivUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetConvolutionParameterivCookie {
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}
}
2012-05-11 05:57:34 +02:00
// GetConvolutionParameterivReply represents the data returned from a GetConvolutionParameteriv request.
type GetConvolutionParameterivReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum int32
// padding: 12 bytes
Data []int32 // size: xgb.Pad((int(N) * 4))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a 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
}
2012-05-11 05:57:34 +02:00
// 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
}
b = xgb.Pad(b)
return v
}
// Write request to wire for GetConvolutionParameteriv
2012-05-11 05:57:34 +02:00
// getConvolutionParameterivRequest writes a GetConvolutionParameteriv request to a byte slice.
func getConvolutionParameterivRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) []byte {
size := 16
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
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-11 05:57:34 +02:00
// GetSeparableFilterCookie is a cookie used only for GetSeparableFilter requests.
type GetSeparableFilterCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetSeparableFilter sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetSeparableFilterCookie.Reply()
func GetSeparableFilter(c *xgb.Conn, ContextTag ContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool) GetSeparableFilterCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetSeparableFilter' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getSeparableFilterRequest(c, ContextTag, Target, Format, Type, SwapBytes), cookie)
return GetSeparableFilterCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetSeparableFilterUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetSeparableFilterUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool) GetSeparableFilterCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetSeparableFilter' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getSeparableFilterRequest(c, ContextTag, Target, Format, Type, SwapBytes), cookie)
return GetSeparableFilterCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetSeparableFilterReply represents the data returned from a GetSeparableFilter request.
type GetSeparableFilterReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 8 bytes
RowW int32
ColH int32
// padding: 8 bytes
RowsAndCols []byte // size: xgb.Pad(((int(Length) * 4) * 1))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetSeparableFilter request.
func (cook GetSeparableFilterCookie) Reply() (*GetSeparableFilterReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getSeparableFilterReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getSeparableFilterReply reads a byte slice into a GetSeparableFilterReply value.
func getSeparableFilterReply(buf []byte) *GetSeparableFilterReply {
v := new(GetSeparableFilterReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
b += 8 // padding
v.RowW = int32(xgb.Get32(buf[b:]))
b += 4
v.ColH = int32(xgb.Get32(buf[b:]))
b += 4
b += 8 // padding
v.RowsAndCols = make([]byte, (int(v.Length) * 4))
copy(v.RowsAndCols[:(int(v.Length)*4)], buf[b:])
b += xgb.Pad(int((int(v.Length) * 4)))
return v
}
// Write request to wire for GetSeparableFilter
2012-05-11 05:57:34 +02:00
// getSeparableFilterRequest writes a GetSeparableFilter request to a byte slice.
func getSeparableFilterRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool) []byte {
size := 24
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 153 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
xgb.Put32(buf[b:], Target)
b += 4
xgb.Put32(buf[b:], Format)
b += 4
xgb.Put32(buf[b:], Type)
b += 4
if SwapBytes {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
return buf
}
2012-05-11 05:57:34 +02:00
// GetHistogramCookie is a cookie used only for GetHistogram requests.
type GetHistogramCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetHistogram sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetHistogramCookie.Reply()
func GetHistogram(c *xgb.Conn, ContextTag ContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool, Reset bool) GetHistogramCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetHistogram' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getHistogramRequest(c, ContextTag, Target, Format, Type, SwapBytes, Reset), cookie)
return GetHistogramCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetHistogramUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetHistogramUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool, Reset bool) GetHistogramCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetHistogram' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getHistogramRequest(c, ContextTag, Target, Format, Type, SwapBytes, Reset), cookie)
return GetHistogramCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetHistogramReply represents the data returned from a GetHistogram request.
type GetHistogramReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 8 bytes
Width int32
// padding: 12 bytes
Data []byte // size: xgb.Pad(((int(Length) * 4) * 1))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetHistogram request.
func (cook GetHistogramCookie) Reply() (*GetHistogramReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getHistogramReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getHistogramReply reads a byte slice into a GetHistogramReply value.
func getHistogramReply(buf []byte) *GetHistogramReply {
v := new(GetHistogramReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
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 += xgb.Pad(int((int(v.Length) * 4)))
return v
}
// Write request to wire for GetHistogram
2012-05-11 05:57:34 +02:00
// getHistogramRequest writes a GetHistogram request to a byte slice.
func getHistogramRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool, Reset bool) []byte {
size := 24
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 154 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
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
if Reset {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
return buf
}
2012-05-11 05:57:34 +02:00
// GetHistogramParameterfvCookie is a cookie used only for GetHistogramParameterfv requests.
type GetHistogramParameterfvCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetHistogramParameterfv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetHistogramParameterfvCookie.Reply()
func GetHistogramParameterfv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetHistogramParameterfvCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetHistogramParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getHistogramParameterfvRequest(c, ContextTag, Target, Pname), cookie)
return GetHistogramParameterfvCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetHistogramParameterfvUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetHistogramParameterfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetHistogramParameterfvCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetHistogramParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getHistogramParameterfvRequest(c, ContextTag, Target, Pname), cookie)
return GetHistogramParameterfvCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetHistogramParameterfvReply represents the data returned from a GetHistogramParameterfv request.
type GetHistogramParameterfvReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum Float32
// padding: 12 bytes
Data []Float32 // size: xgb.Pad((int(N) * 4))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetHistogramParameterfv request.
func (cook GetHistogramParameterfvCookie) Reply() (*GetHistogramParameterfvReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getHistogramParameterfvReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getHistogramParameterfvReply reads a byte slice into a GetHistogramParameterfvReply value.
func getHistogramParameterfvReply(buf []byte) *GetHistogramParameterfvReply {
v := new(GetHistogramParameterfvReply)
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
}
b = xgb.Pad(b)
return v
}
// Write request to wire for GetHistogramParameterfv
2012-05-11 05:57:34 +02:00
// getHistogramParameterfvRequest writes a GetHistogramParameterfv request to a byte slice.
func getHistogramParameterfvRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) []byte {
size := 16
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 155 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
xgb.Put32(buf[b:], Target)
b += 4
xgb.Put32(buf[b:], Pname)
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// GetHistogramParameterivCookie is a cookie used only for GetHistogramParameteriv requests.
type GetHistogramParameterivCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetHistogramParameteriv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetHistogramParameterivCookie.Reply()
func GetHistogramParameteriv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetHistogramParameterivCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetHistogramParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getHistogramParameterivRequest(c, ContextTag, Target, Pname), cookie)
return GetHistogramParameterivCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetHistogramParameterivUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetHistogramParameterivUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetHistogramParameterivCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetHistogramParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getHistogramParameterivRequest(c, ContextTag, Target, Pname), cookie)
return GetHistogramParameterivCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetHistogramParameterivReply represents the data returned from a GetHistogramParameteriv request.
type GetHistogramParameterivReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum int32
// padding: 12 bytes
Data []int32 // size: xgb.Pad((int(N) * 4))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetHistogramParameteriv request.
func (cook GetHistogramParameterivCookie) Reply() (*GetHistogramParameterivReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getHistogramParameterivReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getHistogramParameterivReply reads a byte slice into a GetHistogramParameterivReply value.
func getHistogramParameterivReply(buf []byte) *GetHistogramParameterivReply {
v := new(GetHistogramParameterivReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
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
}
b = xgb.Pad(b)
return v
}
// Write request to wire for GetHistogramParameteriv
2012-05-11 05:57:34 +02:00
// getHistogramParameterivRequest writes a GetHistogramParameteriv request to a byte slice.
func getHistogramParameterivRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) []byte {
size := 16
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 156 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
xgb.Put32(buf[b:], Target)
b += 4
xgb.Put32(buf[b:], Pname)
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// GetMinmaxCookie is a cookie used only for GetMinmax requests.
type GetMinmaxCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetMinmax sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetMinmaxCookie.Reply()
func GetMinmax(c *xgb.Conn, ContextTag ContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool, Reset bool) GetMinmaxCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetMinmax' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getMinmaxRequest(c, ContextTag, Target, Format, Type, SwapBytes, Reset), cookie)
return GetMinmaxCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetMinmaxUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetMinmaxUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool, Reset bool) GetMinmaxCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetMinmax' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getMinmaxRequest(c, ContextTag, Target, Format, Type, SwapBytes, Reset), cookie)
return GetMinmaxCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetMinmaxReply represents the data returned from a GetMinmax request.
type GetMinmaxReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 24 bytes
Data []byte // size: xgb.Pad(((int(Length) * 4) * 1))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetMinmax request.
func (cook GetMinmaxCookie) Reply() (*GetMinmaxReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getMinmaxReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getMinmaxReply reads a byte slice into a GetMinmaxReply value.
func getMinmaxReply(buf []byte) *GetMinmaxReply {
v := new(GetMinmaxReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
b += 24 // padding
v.Data = make([]byte, (int(v.Length) * 4))
copy(v.Data[:(int(v.Length)*4)], buf[b:])
b += xgb.Pad(int((int(v.Length) * 4)))
return v
}
// Write request to wire for GetMinmax
2012-05-11 05:57:34 +02:00
// getMinmaxRequest writes a GetMinmax request to a byte slice.
func getMinmaxRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Format uint32, Type uint32, SwapBytes bool, Reset bool) []byte {
size := 24
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 157 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
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
if Reset {
buf[b] = 1
} else {
buf[b] = 0
}
b += 1
return buf
}
2012-05-11 05:57:34 +02:00
// GetMinmaxParameterfvCookie is a cookie used only for GetMinmaxParameterfv requests.
type GetMinmaxParameterfvCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetMinmaxParameterfv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetMinmaxParameterfvCookie.Reply()
func GetMinmaxParameterfv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetMinmaxParameterfvCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetMinmaxParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getMinmaxParameterfvRequest(c, ContextTag, Target, Pname), cookie)
return GetMinmaxParameterfvCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetMinmaxParameterfvUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetMinmaxParameterfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetMinmaxParameterfvCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetMinmaxParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getMinmaxParameterfvRequest(c, ContextTag, Target, Pname), cookie)
return GetMinmaxParameterfvCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetMinmaxParameterfvReply represents the data returned from a GetMinmaxParameterfv request.
type GetMinmaxParameterfvReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum Float32
// padding: 12 bytes
Data []Float32 // size: xgb.Pad((int(N) * 4))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetMinmaxParameterfv request.
func (cook GetMinmaxParameterfvCookie) Reply() (*GetMinmaxParameterfvReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getMinmaxParameterfvReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getMinmaxParameterfvReply reads a byte slice into a GetMinmaxParameterfvReply value.
func getMinmaxParameterfvReply(buf []byte) *GetMinmaxParameterfvReply {
v := new(GetMinmaxParameterfvReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
b += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
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
}
b = xgb.Pad(b)
return v
}
// Write request to wire for GetMinmaxParameterfv
2012-05-11 05:57:34 +02:00
// getMinmaxParameterfvRequest writes a GetMinmaxParameterfv request to a byte slice.
func getMinmaxParameterfvRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) []byte {
size := 16
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 158 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
xgb.Put32(buf[b:], Target)
b += 4
xgb.Put32(buf[b:], Pname)
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// GetMinmaxParameterivCookie is a cookie used only for GetMinmaxParameteriv requests.
type GetMinmaxParameterivCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetMinmaxParameteriv sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetMinmaxParameterivCookie.Reply()
func GetMinmaxParameteriv(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetMinmaxParameterivCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetMinmaxParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getMinmaxParameterivRequest(c, ContextTag, Target, Pname), cookie)
return GetMinmaxParameterivCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetMinmaxParameterivUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetMinmaxParameterivUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetMinmaxParameterivCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetMinmaxParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getMinmaxParameterivRequest(c, ContextTag, Target, Pname), cookie)
return GetMinmaxParameterivCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetMinmaxParameterivReply represents the data returned from a GetMinmaxParameteriv request.
type GetMinmaxParameterivReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum int32
// padding: 12 bytes
Data []int32 // size: xgb.Pad((int(N) * 4))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetMinmaxParameteriv request.
func (cook GetMinmaxParameterivCookie) Reply() (*GetMinmaxParameterivReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getMinmaxParameterivReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getMinmaxParameterivReply reads a byte slice into a GetMinmaxParameterivReply value.
func getMinmaxParameterivReply(buf []byte) *GetMinmaxParameterivReply {
v := new(GetMinmaxParameterivReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
b += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
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
}
b = xgb.Pad(b)
return v
}
// Write request to wire for GetMinmaxParameteriv
2012-05-11 05:57:34 +02:00
// getMinmaxParameterivRequest writes a GetMinmaxParameteriv request to a byte slice.
func getMinmaxParameterivRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) []byte {
size := 16
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 159 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
xgb.Put32(buf[b:], Target)
b += 4
xgb.Put32(buf[b:], Pname)
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// GetCompressedTexImageARBCookie is a cookie used only for GetCompressedTexImageARB requests.
type GetCompressedTexImageARBCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetCompressedTexImageARB sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetCompressedTexImageARBCookie.Reply()
func GetCompressedTexImageARB(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32) GetCompressedTexImageARBCookie {
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}
}
2012-05-11 05:57:34 +02:00
// GetCompressedTexImageARBUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetCompressedTexImageARBUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32) GetCompressedTexImageARBCookie {
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}
}
2012-05-11 05:57:34 +02:00
// GetCompressedTexImageARBReply represents the data returned from a GetCompressedTexImageARB request.
type GetCompressedTexImageARBReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 8 bytes
Size int32
// padding: 12 bytes
Data []byte // size: xgb.Pad(((int(Length) * 4) * 1))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetCompressedTexImageARB request.
func (cook GetCompressedTexImageARBCookie) Reply() (*GetCompressedTexImageARBReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getCompressedTexImageARBReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// 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 += xgb.Pad(int((int(v.Length) * 4)))
return v
}
// Write request to wire for GetCompressedTexImageARB
2012-05-11 05:57:34 +02:00
// getCompressedTexImageARBRequest writes a GetCompressedTexImageARB request to a byte slice.
func getCompressedTexImageARBRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32) []byte {
size := 16
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
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
}
2012-05-11 05:57:34 +02:00
// DeleteQueriesARBCookie is a cookie used only for DeleteQueriesARB requests.
type DeleteQueriesARBCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// 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 {
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}
}
2012-05-11 05:57:34 +02:00
// DeleteQueriesARBChecked sends a checked request.
// If an error occurs, it can be retrieved using DeleteQueriesARBCookie.Check()
func DeleteQueriesARBChecked(c *xgb.Conn, ContextTag ContextTag, N int32, Ids []uint32) DeleteQueriesARBCookie {
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}
}
2012-05-11 05:57:34 +02:00
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook DeleteQueriesARBCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for DeleteQueriesARB
2012-05-11 05:57:34 +02:00
// deleteQueriesARBRequest writes a DeleteQueriesARB request to a byte slice.
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)
buf[b] = c.Extensions["GLX"]
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
}
b = xgb.Pad(b)
return buf
}
2012-05-11 05:57:34 +02:00
// GenQueriesARBCookie is a cookie used only for GenQueriesARB requests.
type GenQueriesARBCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GenQueriesARB sends a checked request.
// If an error occurs, it will be returned with the reply by calling GenQueriesARBCookie.Reply()
func GenQueriesARB(c *xgb.Conn, ContextTag ContextTag, N int32) GenQueriesARBCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GenQueriesARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(genQueriesARBRequest(c, ContextTag, N), cookie)
return GenQueriesARBCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GenQueriesARBUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GenQueriesARBUnchecked(c *xgb.Conn, ContextTag ContextTag, N int32) GenQueriesARBCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GenQueriesARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(genQueriesARBRequest(c, ContextTag, N), cookie)
return GenQueriesARBCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GenQueriesARBReply represents the data returned from a GenQueriesARB request.
type GenQueriesARBReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 24 bytes
Data []uint32 // size: xgb.Pad((int(Length) * 4))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GenQueriesARB request.
func (cook GenQueriesARBCookie) Reply() (*GenQueriesARBReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return genQueriesARBReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// genQueriesARBReply reads a byte slice into a GenQueriesARBReply value.
func genQueriesARBReply(buf []byte) *GenQueriesARBReply {
v := new(GenQueriesARBReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
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
}
b = xgb.Pad(b)
return v
}
// Write request to wire for GenQueriesARB
2012-05-11 05:57:34 +02:00
// genQueriesARBRequest writes a GenQueriesARB request to a byte slice.
func genQueriesARBRequest(c *xgb.Conn, ContextTag ContextTag, N int32) []byte {
size := 12
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
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
xgb.Put32(buf[b:], uint32(N))
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// IsQueryARBCookie is a cookie used only for IsQueryARB requests.
type IsQueryARBCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// IsQueryARB sends a checked request.
// If an error occurs, it will be returned with the reply by calling IsQueryARBCookie.Reply()
func IsQueryARB(c *xgb.Conn, ContextTag ContextTag, Id uint32) IsQueryARBCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'IsQueryARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(isQueryARBRequest(c, ContextTag, Id), cookie)
return IsQueryARBCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// IsQueryARBUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func IsQueryARBUnchecked(c *xgb.Conn, ContextTag ContextTag, Id uint32) IsQueryARBCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'IsQueryARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(isQueryARBRequest(c, ContextTag, Id), cookie)
return IsQueryARBCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// IsQueryARBReply represents the data returned from a IsQueryARB request.
type IsQueryARBReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
RetVal Bool32
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a IsQueryARB request.
func (cook IsQueryARBCookie) Reply() (*IsQueryARBReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return isQueryARBReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// isQueryARBReply reads a byte slice into a IsQueryARBReply value.
func isQueryARBReply(buf []byte) *IsQueryARBReply {
v := new(IsQueryARBReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
v.RetVal = Bool32(xgb.Get32(buf[b:]))
b += 4
return v
}
// Write request to wire for IsQueryARB
2012-05-11 05:57:34 +02:00
// isQueryARBRequest writes a IsQueryARB request to a byte slice.
func isQueryARBRequest(c *xgb.Conn, ContextTag ContextTag, Id uint32) []byte {
size := 12
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 163 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
xgb.Put32(buf[b:], Id)
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// GetQueryivARBCookie is a cookie used only for GetQueryivARB requests.
type GetQueryivARBCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetQueryivARB sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetQueryivARBCookie.Reply()
func GetQueryivARB(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetQueryivARBCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetQueryivARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getQueryivARBRequest(c, ContextTag, Target, Pname), cookie)
return GetQueryivARBCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetQueryivARBUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetQueryivARBUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetQueryivARBCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetQueryivARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getQueryivARBRequest(c, ContextTag, Target, Pname), cookie)
return GetQueryivARBCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetQueryivARBReply represents the data returned from a GetQueryivARB request.
type GetQueryivARBReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum int32
// padding: 12 bytes
Data []int32 // size: xgb.Pad((int(N) * 4))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetQueryivARB request.
func (cook GetQueryivARBCookie) Reply() (*GetQueryivARBReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getQueryivARBReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getQueryivARBReply reads a byte slice into a GetQueryivARBReply value.
func getQueryivARBReply(buf []byte) *GetQueryivARBReply {
v := new(GetQueryivARBReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
b += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
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
}
b = xgb.Pad(b)
return v
}
// Write request to wire for GetQueryivARB
2012-05-11 05:57:34 +02:00
// getQueryivARBRequest writes a GetQueryivARB request to a byte slice.
func getQueryivARBRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) []byte {
size := 16
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 164 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
xgb.Put32(buf[b:], Target)
b += 4
xgb.Put32(buf[b:], Pname)
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// GetQueryObjectivARBCookie is a cookie used only for GetQueryObjectivARB requests.
type GetQueryObjectivARBCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetQueryObjectivARB sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetQueryObjectivARBCookie.Reply()
func GetQueryObjectivARB(c *xgb.Conn, ContextTag ContextTag, Id uint32, Pname uint32) GetQueryObjectivARBCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetQueryObjectivARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getQueryObjectivARBRequest(c, ContextTag, Id, Pname), cookie)
return GetQueryObjectivARBCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetQueryObjectivARBUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetQueryObjectivARBUnchecked(c *xgb.Conn, ContextTag ContextTag, Id uint32, Pname uint32) GetQueryObjectivARBCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetQueryObjectivARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getQueryObjectivARBRequest(c, ContextTag, Id, Pname), cookie)
return GetQueryObjectivARBCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetQueryObjectivARBReply represents the data returned from a GetQueryObjectivARB request.
type GetQueryObjectivARBReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum int32
// padding: 12 bytes
Data []int32 // size: xgb.Pad((int(N) * 4))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetQueryObjectivARB request.
func (cook GetQueryObjectivARBCookie) Reply() (*GetQueryObjectivARBReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getQueryObjectivARBReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getQueryObjectivARBReply reads a byte slice into a GetQueryObjectivARBReply value.
func getQueryObjectivARBReply(buf []byte) *GetQueryObjectivARBReply {
v := new(GetQueryObjectivARBReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
b += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
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
}
b = xgb.Pad(b)
return v
}
// Write request to wire for GetQueryObjectivARB
2012-05-11 05:57:34 +02:00
// getQueryObjectivARBRequest writes a GetQueryObjectivARB request to a byte slice.
func getQueryObjectivARBRequest(c *xgb.Conn, ContextTag ContextTag, Id uint32, Pname uint32) []byte {
size := 16
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 165 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
xgb.Put32(buf[b:], Id)
b += 4
xgb.Put32(buf[b:], Pname)
b += 4
return buf
}
2012-05-11 05:57:34 +02:00
// GetQueryObjectuivARBCookie is a cookie used only for GetQueryObjectuivARB requests.
type GetQueryObjectuivARBCookie struct {
*xgb.Cookie
}
2012-05-11 05:57:34 +02:00
// GetQueryObjectuivARB sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetQueryObjectuivARBCookie.Reply()
func GetQueryObjectuivARB(c *xgb.Conn, ContextTag ContextTag, Id uint32, Pname uint32) GetQueryObjectuivARBCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetQueryObjectuivARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getQueryObjectuivARBRequest(c, ContextTag, Id, Pname), cookie)
return GetQueryObjectuivARBCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetQueryObjectuivARBUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetQueryObjectuivARBUnchecked(c *xgb.Conn, ContextTag ContextTag, Id uint32, Pname uint32) GetQueryObjectuivARBCookie {
if _, ok := c.Extensions["GLX"]; !ok {
panic("Cannot issue request 'GetQueryObjectuivARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getQueryObjectuivARBRequest(c, ContextTag, Id, Pname), cookie)
return GetQueryObjectuivARBCookie{cookie}
}
2012-05-11 05:57:34 +02:00
// GetQueryObjectuivARBReply represents the data returned from a GetQueryObjectuivARB request.
type GetQueryObjectuivARBReply struct {
2012-05-11 05:57:34 +02:00
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 4 bytes
N uint32
Datum uint32
// padding: 12 bytes
Data []uint32 // size: xgb.Pad((int(N) * 4))
}
2012-05-11 05:57:34 +02:00
// Reply blocks and returns the reply data for a GetQueryObjectuivARB request.
func (cook GetQueryObjectuivARBCookie) Reply() (*GetQueryObjectuivARBReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return getQueryObjectuivARBReply(buf), nil
}
2012-05-11 05:57:34 +02:00
// getQueryObjectuivARBReply reads a byte slice into a GetQueryObjectuivARBReply value.
func getQueryObjectuivARBReply(buf []byte) *GetQueryObjectuivARBReply {
v := new(GetQueryObjectuivARBReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
b += 4 // padding
v.N = xgb.Get32(buf[b:])
b += 4
v.Datum = xgb.Get32(buf[b:])
b += 4
b += 12 // padding
v.Data = make([]uint32, v.N)
for i := 0; i < int(v.N); i++ {
v.Data[i] = xgb.Get32(buf[b:])
b += 4
}
b = xgb.Pad(b)
return v
}
// Write request to wire for GetQueryObjectuivARB
2012-05-11 05:57:34 +02:00
// getQueryObjectuivARBRequest writes a GetQueryObjectuivARB request to a byte slice.
func getQueryObjectuivARBRequest(c *xgb.Conn, ContextTag ContextTag, Id uint32, Pname uint32) []byte {
size := 16
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["GLX"]
b += 1
buf[b] = 166 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(ContextTag))
b += 4
xgb.Put32(buf[b:], Id)
b += 4
xgb.Put32(buf[b:], Pname)
b += 4
return buf
}