diff options
Diffstat (limited to 'nexgb/glx')
-rw-r--r-- | nexgb/glx/glx.go | 7938 |
1 files changed, 3969 insertions, 3969 deletions
diff --git a/nexgb/glx/glx.go b/nexgb/glx/glx.go index cc6ab68..facf12e 100644 --- a/nexgb/glx/glx.go +++ b/nexgb/glx/glx.go @@ -2,7 +2,7 @@ package glx /* - This file was generated by glx.xml on Jun 5 2012 12:11:59am EDT. + This file was generated by glx.xml on Aug 11 2013 8:39:43pm EDT. This file is automatically generated. Edit at your peril! */ @@ -40,342 +40,6 @@ func init() { xgb.NewExtErrorFuncs["GLX"] = make(map[int]xgb.NewErrorFun) } -// 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' - -// Skipping definition for base type 'Float' - -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 - -// 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 -} - -// 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 -} - -// 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 -} - -// 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 -} - -// 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 -} - -// BadGeneric is the error number for a BadGeneric. -const BadGeneric = -1 - -type GenericError struct { - Sequence uint16 - NiceName string - BadValue uint32 - MinorOpcode uint16 - MajorOpcode byte - // padding: 21 bytes -} - -// GenericErrorNew constructs a GenericError value that implements xgb.Error from a byte slice. -func GenericErrorNew(buf []byte) xgb.Error { - v := GenericError{} - v.NiceName = "Generic" - - b := 1 // skip error determinant - b += 1 // don't read error number - - v.Sequence = xgb.Get16(buf[b:]) - b += 2 - - v.BadValue = xgb.Get32(buf[b:]) - b += 4 - - v.MinorOpcode = xgb.Get16(buf[b:]) - b += 2 - - v.MajorOpcode = buf[b] - b += 1 - - b += 21 // padding - - return v -} - -// SequenceId returns the sequence id attached to the BadGeneric error. -// This is mostly used internally. -func (err GenericError) SequenceId() uint16 { - return err.Sequence -} - -// BadId returns the 'BadValue' number if one exists for the BadGeneric error. If no bad value exists, 0 is returned. -func (err GenericError) BadId() uint32 { - return 0 -} - -// Error returns a rudimentary string representation of the BadGeneric error. - -func (err GenericError) Error() string { - fieldVals := make([]string, 0, 4) - fieldVals = append(fieldVals, "NiceName: "+err.NiceName) - fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence)) - fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue)) - fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode)) - fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode)) - return "BadGeneric {" + xgb.StringsJoin(fieldVals, ", ") + "}" -} - -func init() { - xgb.NewExtErrorFuncs["GLX"][-1] = GenericErrorNew -} - // BadBadContext is the error number for a BadBadContext. const BadBadContext = 0 @@ -452,118 +116,80 @@ func init() { xgb.NewExtErrorFuncs["GLX"][1] = BadContextStateErrorNew } -// BadBadDrawable is the error number for a BadBadDrawable. -const BadBadDrawable = 2 - -type BadDrawableError GenericError - -// BadDrawableErrorNew constructs a BadDrawableError value that implements xgb.Error from a byte slice. -func BadDrawableErrorNew(buf []byte) xgb.Error { - v := BadDrawableError(GenericErrorNew(buf).(GenericError)) - v.NiceName = "BadDrawable" - return v -} - -// SequenceId returns the sequence id attached to the BadBadDrawable error. -// This is mostly used internally. -func (err BadDrawableError) SequenceId() uint16 { - return err.Sequence -} - -// BadId returns the 'BadValue' number if one exists for the BadBadDrawable error. If no bad value exists, 0 is returned. -func (err BadDrawableError) BadId() uint32 { - return 0 -} - -// Error returns a rudimentary string representation of the BadBadDrawable error. -func (err BadDrawableError) Error() string { - fieldVals := make([]string, 0, 4) - fieldVals = append(fieldVals, "NiceName: "+err.NiceName) - fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence)) - fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue)) - fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode)) - fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode)) - return "BadBadDrawable {" + xgb.StringsJoin(fieldVals, ", ") + "}" -} - -func init() { - xgb.NewExtErrorFuncs["GLX"][2] = BadDrawableErrorNew -} - -// BadBadPixmap is the error number for a BadBadPixmap. -const BadBadPixmap = 3 +// BadBadContextTag is the error number for a BadBadContextTag. +const BadBadContextTag = 4 -type BadPixmapError GenericError +type BadContextTagError GenericError -// BadPixmapErrorNew constructs a BadPixmapError value that implements xgb.Error from a byte slice. -func BadPixmapErrorNew(buf []byte) xgb.Error { - v := BadPixmapError(GenericErrorNew(buf).(GenericError)) - v.NiceName = "BadPixmap" +// BadContextTagErrorNew constructs a BadContextTagError value that implements xgb.Error from a byte slice. +func BadContextTagErrorNew(buf []byte) xgb.Error { + v := BadContextTagError(GenericErrorNew(buf).(GenericError)) + v.NiceName = "BadContextTag" return v } -// SequenceId returns the sequence id attached to the BadBadPixmap error. +// SequenceId returns the sequence id attached to the BadBadContextTag error. // This is mostly used internally. -func (err BadPixmapError) SequenceId() uint16 { +func (err BadContextTagError) SequenceId() uint16 { return err.Sequence } -// BadId returns the 'BadValue' number if one exists for the BadBadPixmap error. If no bad value exists, 0 is returned. -func (err BadPixmapError) BadId() uint32 { +// BadId returns the 'BadValue' number if one exists for the BadBadContextTag error. If no bad value exists, 0 is returned. +func (err BadContextTagError) BadId() uint32 { return 0 } -// Error returns a rudimentary string representation of the BadBadPixmap error. -func (err BadPixmapError) Error() string { +// 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 "BadBadPixmap {" + xgb.StringsJoin(fieldVals, ", ") + "}" + return "BadBadContextTag {" + xgb.StringsJoin(fieldVals, ", ") + "}" } func init() { - xgb.NewExtErrorFuncs["GLX"][3] = BadPixmapErrorNew + xgb.NewExtErrorFuncs["GLX"][4] = BadContextTagErrorNew } -// BadBadContextTag is the error number for a BadBadContextTag. -const BadBadContextTag = 4 +// BadBadCurrentDrawable is the error number for a BadBadCurrentDrawable. +const BadBadCurrentDrawable = 11 -type BadContextTagError GenericError +type BadCurrentDrawableError GenericError -// BadContextTagErrorNew constructs a BadContextTagError value that implements xgb.Error from a byte slice. -func BadContextTagErrorNew(buf []byte) xgb.Error { - v := BadContextTagError(GenericErrorNew(buf).(GenericError)) - v.NiceName = "BadContextTag" +// BadCurrentDrawableErrorNew constructs a BadCurrentDrawableError value that implements xgb.Error from a byte slice. +func BadCurrentDrawableErrorNew(buf []byte) xgb.Error { + v := BadCurrentDrawableError(GenericErrorNew(buf).(GenericError)) + v.NiceName = "BadCurrentDrawable" return v } -// SequenceId returns the sequence id attached to the BadBadContextTag error. +// SequenceId returns the sequence id attached to the BadBadCurrentDrawable error. // This is mostly used internally. -func (err BadContextTagError) SequenceId() uint16 { +func (err BadCurrentDrawableError) SequenceId() uint16 { return err.Sequence } -// BadId returns the 'BadValue' number if one exists for the BadBadContextTag error. If no bad value exists, 0 is returned. -func (err BadContextTagError) BadId() uint32 { +// BadId returns the 'BadValue' number if one exists for the BadBadCurrentDrawable error. If no bad value exists, 0 is returned. +func (err BadCurrentDrawableError) BadId() uint32 { return 0 } -// Error returns a rudimentary string representation of the BadBadContextTag error. -func (err BadContextTagError) Error() string { +// 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 "BadBadContextTag {" + xgb.StringsJoin(fieldVals, ", ") + "}" + return "BadBadCurrentDrawable {" + xgb.StringsJoin(fieldVals, ", ") + "}" } func init() { - xgb.NewExtErrorFuncs["GLX"][4] = BadContextTagErrorNew + xgb.NewExtErrorFuncs["GLX"][11] = BadCurrentDrawableErrorNew } // BadBadCurrentWindow is the error number for a BadBadCurrentWindow. @@ -604,232 +230,232 @@ func init() { xgb.NewExtErrorFuncs["GLX"][5] = BadCurrentWindowErrorNew } -// BadBadRenderRequest is the error number for a BadBadRenderRequest. -const BadBadRenderRequest = 6 +// BadBadDrawable is the error number for a BadBadDrawable. +const BadBadDrawable = 2 -type BadRenderRequestError GenericError +type BadDrawableError GenericError -// BadRenderRequestErrorNew constructs a BadRenderRequestError value that implements xgb.Error from a byte slice. -func BadRenderRequestErrorNew(buf []byte) xgb.Error { - v := BadRenderRequestError(GenericErrorNew(buf).(GenericError)) - v.NiceName = "BadRenderRequest" +// BadDrawableErrorNew constructs a BadDrawableError value that implements xgb.Error from a byte slice. +func BadDrawableErrorNew(buf []byte) xgb.Error { + v := BadDrawableError(GenericErrorNew(buf).(GenericError)) + v.NiceName = "BadDrawable" return v } -// SequenceId returns the sequence id attached to the BadBadRenderRequest error. +// SequenceId returns the sequence id attached to the BadBadDrawable error. // This is mostly used internally. -func (err BadRenderRequestError) SequenceId() uint16 { +func (err BadDrawableError) SequenceId() uint16 { return err.Sequence } -// BadId returns the 'BadValue' number if one exists for the BadBadRenderRequest error. If no bad value exists, 0 is returned. -func (err BadRenderRequestError) BadId() uint32 { +// BadId returns the 'BadValue' number if one exists for the BadBadDrawable error. If no bad value exists, 0 is returned. +func (err BadDrawableError) BadId() uint32 { return 0 } -// Error returns a rudimentary string representation of the BadBadRenderRequest error. -func (err BadRenderRequestError) Error() string { +// 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 "BadBadRenderRequest {" + xgb.StringsJoin(fieldVals, ", ") + "}" + return "BadBadDrawable {" + xgb.StringsJoin(fieldVals, ", ") + "}" } func init() { - xgb.NewExtErrorFuncs["GLX"][6] = BadRenderRequestErrorNew + xgb.NewExtErrorFuncs["GLX"][2] = BadDrawableErrorNew } -// BadBadLargeRequest is the error number for a BadBadLargeRequest. -const BadBadLargeRequest = 7 +// BadBadFBConfig is the error number for a BadBadFBConfig. +const BadBadFBConfig = 9 -type BadLargeRequestError GenericError +type BadFBConfigError GenericError -// BadLargeRequestErrorNew constructs a BadLargeRequestError value that implements xgb.Error from a byte slice. -func BadLargeRequestErrorNew(buf []byte) xgb.Error { - v := BadLargeRequestError(GenericErrorNew(buf).(GenericError)) - v.NiceName = "BadLargeRequest" +// BadFBConfigErrorNew constructs a BadFBConfigError value that implements xgb.Error from a byte slice. +func BadFBConfigErrorNew(buf []byte) xgb.Error { + v := BadFBConfigError(GenericErrorNew(buf).(GenericError)) + v.NiceName = "BadFBConfig" return v } -// SequenceId returns the sequence id attached to the BadBadLargeRequest error. +// SequenceId returns the sequence id attached to the BadBadFBConfig error. // This is mostly used internally. -func (err BadLargeRequestError) SequenceId() uint16 { +func (err BadFBConfigError) SequenceId() uint16 { return err.Sequence } -// BadId returns the 'BadValue' number if one exists for the BadBadLargeRequest error. If no bad value exists, 0 is returned. -func (err BadLargeRequestError) BadId() uint32 { +// BadId returns the 'BadValue' number if one exists for the BadBadFBConfig error. If no bad value exists, 0 is returned. +func (err BadFBConfigError) BadId() uint32 { return 0 } -// Error returns a rudimentary string representation of the BadBadLargeRequest error. -func (err BadLargeRequestError) Error() string { +// 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 "BadBadLargeRequest {" + xgb.StringsJoin(fieldVals, ", ") + "}" + return "BadBadFBConfig {" + xgb.StringsJoin(fieldVals, ", ") + "}" } func init() { - xgb.NewExtErrorFuncs["GLX"][7] = BadLargeRequestErrorNew + xgb.NewExtErrorFuncs["GLX"][9] = BadFBConfigErrorNew } -// BadUnsupportedPrivateRequest is the error number for a BadUnsupportedPrivateRequest. -const BadUnsupportedPrivateRequest = 8 +// BadBadLargeRequest is the error number for a BadBadLargeRequest. +const BadBadLargeRequest = 7 -type UnsupportedPrivateRequestError GenericError +type BadLargeRequestError GenericError -// 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" +// BadLargeRequestErrorNew constructs a BadLargeRequestError value that implements xgb.Error from a byte slice. +func BadLargeRequestErrorNew(buf []byte) xgb.Error { + v := BadLargeRequestError(GenericErrorNew(buf).(GenericError)) + v.NiceName = "BadLargeRequest" return v } -// SequenceId returns the sequence id attached to the BadUnsupportedPrivateRequest error. +// SequenceId returns the sequence id attached to the BadBadLargeRequest error. // This is mostly used internally. -func (err UnsupportedPrivateRequestError) SequenceId() uint16 { +func (err BadLargeRequestError) SequenceId() uint16 { return err.Sequence } -// 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 { +// BadId returns the 'BadValue' number if one exists for the BadBadLargeRequest error. If no bad value exists, 0 is returned. +func (err BadLargeRequestError) BadId() uint32 { return 0 } -// Error returns a rudimentary string representation of the BadUnsupportedPrivateRequest error. -func (err UnsupportedPrivateRequestError) Error() string { +// 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 "BadUnsupportedPrivateRequest {" + xgb.StringsJoin(fieldVals, ", ") + "}" + return "BadBadLargeRequest {" + xgb.StringsJoin(fieldVals, ", ") + "}" } func init() { - xgb.NewExtErrorFuncs["GLX"][8] = UnsupportedPrivateRequestErrorNew + xgb.NewExtErrorFuncs["GLX"][7] = BadLargeRequestErrorNew } -// BadBadFBConfig is the error number for a BadBadFBConfig. -const BadBadFBConfig = 9 +// BadBadPbuffer is the error number for a BadBadPbuffer. +const BadBadPbuffer = 10 -type BadFBConfigError GenericError +type BadPbufferError GenericError -// BadFBConfigErrorNew constructs a BadFBConfigError value that implements xgb.Error from a byte slice. -func BadFBConfigErrorNew(buf []byte) xgb.Error { - v := BadFBConfigError(GenericErrorNew(buf).(GenericError)) - v.NiceName = "BadFBConfig" +// BadPbufferErrorNew constructs a BadPbufferError value that implements xgb.Error from a byte slice. +func BadPbufferErrorNew(buf []byte) xgb.Error { + v := BadPbufferError(GenericErrorNew(buf).(GenericError)) + v.NiceName = "BadPbuffer" return v } -// SequenceId returns the sequence id attached to the BadBadFBConfig error. +// SequenceId returns the sequence id attached to the BadBadPbuffer error. // This is mostly used internally. -func (err BadFBConfigError) SequenceId() uint16 { +func (err BadPbufferError) SequenceId() uint16 { return err.Sequence } -// BadId returns the 'BadValue' number if one exists for the BadBadFBConfig error. If no bad value exists, 0 is returned. -func (err BadFBConfigError) BadId() uint32 { +// BadId returns the 'BadValue' number if one exists for the BadBadPbuffer error. If no bad value exists, 0 is returned. +func (err BadPbufferError) BadId() uint32 { return 0 } -// Error returns a rudimentary string representation of the BadBadFBConfig error. -func (err BadFBConfigError) Error() string { +// 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 "BadBadFBConfig {" + xgb.StringsJoin(fieldVals, ", ") + "}" + return "BadBadPbuffer {" + xgb.StringsJoin(fieldVals, ", ") + "}" } func init() { - xgb.NewExtErrorFuncs["GLX"][9] = BadFBConfigErrorNew + xgb.NewExtErrorFuncs["GLX"][10] = BadPbufferErrorNew } -// BadBadPbuffer is the error number for a BadBadPbuffer. -const BadBadPbuffer = 10 +// BadBadPixmap is the error number for a BadBadPixmap. +const BadBadPixmap = 3 -type BadPbufferError GenericError +type BadPixmapError GenericError -// BadPbufferErrorNew constructs a BadPbufferError value that implements xgb.Error from a byte slice. -func BadPbufferErrorNew(buf []byte) xgb.Error { - v := BadPbufferError(GenericErrorNew(buf).(GenericError)) - v.NiceName = "BadPbuffer" +// BadPixmapErrorNew constructs a BadPixmapError value that implements xgb.Error from a byte slice. +func BadPixmapErrorNew(buf []byte) xgb.Error { + v := BadPixmapError(GenericErrorNew(buf).(GenericError)) + v.NiceName = "BadPixmap" return v } -// SequenceId returns the sequence id attached to the BadBadPbuffer error. +// SequenceId returns the sequence id attached to the BadBadPixmap error. // This is mostly used internally. -func (err BadPbufferError) SequenceId() uint16 { +func (err BadPixmapError) SequenceId() uint16 { return err.Sequence } -// BadId returns the 'BadValue' number if one exists for the BadBadPbuffer error. If no bad value exists, 0 is returned. -func (err BadPbufferError) BadId() uint32 { +// BadId returns the 'BadValue' number if one exists for the BadBadPixmap error. If no bad value exists, 0 is returned. +func (err BadPixmapError) BadId() uint32 { return 0 } -// Error returns a rudimentary string representation of the BadBadPbuffer error. -func (err BadPbufferError) Error() string { +// 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 "BadBadPbuffer {" + xgb.StringsJoin(fieldVals, ", ") + "}" + return "BadBadPixmap {" + xgb.StringsJoin(fieldVals, ", ") + "}" } func init() { - xgb.NewExtErrorFuncs["GLX"][10] = BadPbufferErrorNew + xgb.NewExtErrorFuncs["GLX"][3] = BadPixmapErrorNew } -// BadBadCurrentDrawable is the error number for a BadBadCurrentDrawable. -const BadBadCurrentDrawable = 11 +// BadBadRenderRequest is the error number for a BadBadRenderRequest. +const BadBadRenderRequest = 6 -type BadCurrentDrawableError GenericError +type BadRenderRequestError GenericError -// BadCurrentDrawableErrorNew constructs a BadCurrentDrawableError value that implements xgb.Error from a byte slice. -func BadCurrentDrawableErrorNew(buf []byte) xgb.Error { - v := BadCurrentDrawableError(GenericErrorNew(buf).(GenericError)) - v.NiceName = "BadCurrentDrawable" +// BadRenderRequestErrorNew constructs a BadRenderRequestError value that implements xgb.Error from a byte slice. +func BadRenderRequestErrorNew(buf []byte) xgb.Error { + v := BadRenderRequestError(GenericErrorNew(buf).(GenericError)) + v.NiceName = "BadRenderRequest" return v } -// SequenceId returns the sequence id attached to the BadBadCurrentDrawable error. +// SequenceId returns the sequence id attached to the BadBadRenderRequest error. // This is mostly used internally. -func (err BadCurrentDrawableError) SequenceId() uint16 { +func (err BadRenderRequestError) SequenceId() uint16 { return err.Sequence } -// BadId returns the 'BadValue' number if one exists for the BadBadCurrentDrawable error. If no bad value exists, 0 is returned. -func (err BadCurrentDrawableError) BadId() uint32 { +// BadId returns the 'BadValue' number if one exists for the BadBadRenderRequest error. If no bad value exists, 0 is returned. +func (err BadRenderRequestError) BadId() uint32 { return 0 } -// Error returns a rudimentary string representation of the BadBadCurrentDrawable error. -func (err BadCurrentDrawableError) Error() string { +// 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 "BadBadCurrentDrawable {" + xgb.StringsJoin(fieldVals, ", ") + "}" + return "BadBadRenderRequest {" + xgb.StringsJoin(fieldVals, ", ") + "}" } func init() { - xgb.NewExtErrorFuncs["GLX"][11] = BadCurrentDrawableErrorNew + xgb.NewExtErrorFuncs["GLX"][6] = BadRenderRequestErrorNew } // BadBadWindow is the error number for a BadBadWindow. @@ -870,6 +496,44 @@ func init() { xgb.NewExtErrorFuncs["GLX"][12] = BadWindowErrorNew } +type Bool32 uint32 + +type Context uint32 + +func NewContextId(c *xgb.Conn) (Context, error) { + id, err := c.NewId() + if err != nil { + return 0, err + } + return Context(id), nil +} + +type ContextTag uint32 + +type Drawable uint32 + +func NewDrawableId(c *xgb.Conn) (Drawable, error) { + id, err := c.NewId() + if err != nil { + return 0, err + } + return Drawable(id), nil +} + +type Fbconfig uint32 + +func NewFbconfigId(c *xgb.Conn) (Fbconfig, error) { + id, err := c.NewId() + if err != nil { + return 0, err + } + return Fbconfig(id), nil +} + +type Float32 float64 + +type Float64 float64 + // BadGLXBadProfileARB is the error number for a BadGLXBadProfileARB. const BadGLXBadProfileARB = 13 @@ -908,490 +572,381 @@ func init() { xgb.NewExtErrorFuncs["GLX"][13] = GLXBadProfileARBErrorNew } -// RenderCookie is a cookie used only for Render requests. -type RenderCookie struct { - *xgb.Cookie -} +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 +) -// 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} -} +// BadGeneric is the error number for a BadGeneric. +const BadGeneric = -1 -// 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} +type GenericError struct { + Sequence uint16 + NiceName string + BadValue uint32 + MinorOpcode uint16 + MajorOpcode byte + // padding: 21 bytes } -// 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() -} +// GenericErrorNew constructs a GenericError value that implements xgb.Error from a byte slice. +func GenericErrorNew(buf []byte) xgb.Error { + v := GenericError{} + v.NiceName = "Generic" -// Write request to wire for Render -// 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) + b := 1 // skip error determinant + b += 1 // don't read error number - buf[b] = c.Extensions["GLX"] - b += 1 + v.Sequence = xgb.Get16(buf[b:]) + b += 2 - buf[b] = 1 // request opcode - b += 1 + v.BadValue = xgb.Get32(buf[b:]) + b += 4 - xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + v.MinorOpcode = xgb.Get16(buf[b:]) b += 2 - xgb.Put32(buf[b:], uint32(ContextTag)) - b += 4 + v.MajorOpcode = buf[b] + b += 1 - copy(buf[b:], Data[:len(Data)]) - b += xgb.Pad(int(len(Data))) + b += 21 // padding - return buf + return v } -// RenderLargeCookie is a cookie used only for RenderLarge requests. -type RenderLargeCookie struct { - *xgb.Cookie +// SequenceId returns the sequence id attached to the BadGeneric error. +// This is mostly used internally. +func (err GenericError) SequenceId() uint16 { + return err.Sequence } -// 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} +// 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 } -// 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.") +// Error returns a rudimentary string representation of the BadGeneric error. + +func (err GenericError) Error() string { + fieldVals := make([]string, 0, 4) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence)) + fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue)) + fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode)) + fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode)) + return "BadGeneric {" + xgb.StringsJoin(fieldVals, ", ") + "}" +} + +func init() { + xgb.NewExtErrorFuncs["GLX"][-1] = GenericErrorNew +} + +const ( + PbcdtWindow = 32793 + PbcdtPbuffer = 32794 +) + +const ( + PbcetDamaged = 32791 + PbcetSaved = 32792 +) + +type Pbuffer uint32 + +func NewPbufferId(c *xgb.Conn) (Pbuffer, error) { + id, err := c.NewId() + if err != nil { + return 0, err } - cookie := c.NewCookie(true, false) - c.NewRequest(renderLargeRequest(c, ContextTag, RequestNum, RequestTotal, DataLen, Data), cookie) - return RenderLargeCookie{cookie} + return Pbuffer(id), nil } -// 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() +// 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 } -// Write request to wire for RenderLarge -// 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) +// 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 - buf[b] = c.Extensions["GLX"] - b += 1 + b += 1 // padding - buf[b] = 2 // request opcode - b += 1 + v.Sequence = xgb.Get16(buf[b:]) + b += 2 - xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + v.EventType = xgb.Get16(buf[b:]) b += 2 - xgb.Put32(buf[b:], uint32(ContextTag)) + v.DrawType = xgb.Get16(buf[b:]) + b += 2 + + v.Drawable = Drawable(xgb.Get32(buf[b:])) b += 4 - xgb.Put16(buf[b:], RequestNum) - b += 2 + v.BMask = xgb.Get32(buf[b:]) + b += 4 - xgb.Put16(buf[b:], RequestTotal) + v.AuxBuffer = xgb.Get16(buf[b:]) b += 2 - xgb.Put32(buf[b:], DataLen) - b += 4 + v.X = xgb.Get16(buf[b:]) + b += 2 - copy(buf[b:], Data[:DataLen]) - b += xgb.Pad(int(DataLen)) + v.Y = xgb.Get16(buf[b:]) + b += 2 - return buf -} + v.Width = xgb.Get16(buf[b:]) + b += 2 -// CreateContextCookie is a cookie used only for CreateContext requests. -type CreateContextCookie struct { - *xgb.Cookie -} + v.Height = xgb.Get16(buf[b:]) + b += 2 -// 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} -} + v.Count = xgb.Get16(buf[b:]) + b += 2 -// 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} -} + b += 4 // padding -// 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() + return v } -// Write request to wire for CreateContext -// 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 +// Bytes writes a PbufferClobberEvent value to a byte slice. +func (v PbufferClobberEvent) Bytes() []byte { + buf := make([]byte, 32) b := 0 - buf := make([]byte, size) - buf[b] = c.Extensions["GLX"] + // write event number + buf[b] = 0 b += 1 - buf[b] = 3 // request opcode - b += 1 + b += 1 // padding - xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units - b += 2 + b += 2 // skip sequence number - xgb.Put32(buf[b:], uint32(Context)) - b += 4 + xgb.Put16(buf[b:], v.EventType) + b += 2 - xgb.Put32(buf[b:], uint32(Visual)) - b += 4 + xgb.Put16(buf[b:], v.DrawType) + b += 2 - xgb.Put32(buf[b:], Screen) + xgb.Put32(buf[b:], uint32(v.Drawable)) b += 4 - xgb.Put32(buf[b:], uint32(ShareList)) + xgb.Put32(buf[b:], v.BMask) b += 4 - if IsDirect { - buf[b] = 1 - } else { - buf[b] = 0 - } - b += 1 - - b += 3 // padding - - return buf -} - -// DestroyContextCookie is a cookie used only for DestroyContext requests. -type DestroyContextCookie struct { - *xgb.Cookie -} - -// 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} -} - -// 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} -} + xgb.Put16(buf[b:], v.AuxBuffer) + b += 2 -// 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() -} + xgb.Put16(buf[b:], v.X) + b += 2 -// Write request to wire for DestroyContext -// 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) + xgb.Put16(buf[b:], v.Y) + b += 2 - buf[b] = c.Extensions["GLX"] - b += 1 + xgb.Put16(buf[b:], v.Width) + b += 2 - buf[b] = 4 // request opcode - b += 1 + xgb.Put16(buf[b:], v.Height) + b += 2 - xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + xgb.Put16(buf[b:], v.Count) b += 2 - xgb.Put32(buf[b:], uint32(Context)) - b += 4 + b += 4 // padding return buf } -// MakeCurrentCookie is a cookie used only for MakeCurrent requests. -type MakeCurrentCookie struct { - *xgb.Cookie +// 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 } -// 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} +// 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, ", ") + "}" } -// 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} +func init() { + xgb.NewExtEventFuncs["GLX"][0] = PbufferClobberEventNew } -// MakeCurrentReply represents the data returned from a MakeCurrent request. -type MakeCurrentReply struct { - 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 -} +type Pixmap uint32 -// Reply blocks and returns the reply data for a MakeCurrent request. -func (cook MakeCurrentCookie) Reply() (*MakeCurrentReply, error) { - buf, err := cook.Cookie.Reply() +func NewPixmapId(c *xgb.Conn) (Pixmap, error) { + id, err := c.NewId() if err != nil { - return nil, err - } - if buf == nil { - return nil, nil + return 0, err } - return makeCurrentReply(buf), nil + return Pixmap(id), nil } -// 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 +const ( + RmGlRender = 7168 + RmGlFeedback = 7169 + RmGlSelect = 7170 +) - v.ContextTag = ContextTag(xgb.Get32(buf[b:])) - b += 4 +// BadUnsupportedPrivateRequest is the error number for a BadUnsupportedPrivateRequest. +const BadUnsupportedPrivateRequest = 8 - b += 20 // padding +type UnsupportedPrivateRequestError GenericError +// 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 } -// Write request to wire for MakeCurrent -// 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 +// SequenceId returns the sequence id attached to the BadUnsupportedPrivateRequest error. +// This is mostly used internally. +func (err UnsupportedPrivateRequestError) SequenceId() uint16 { + return err.Sequence } -// IsDirectCookie is a cookie used only for IsDirect requests. -type IsDirectCookie struct { - *xgb.Cookie +// 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 } -// 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} +// 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, ", ") + "}" } -// 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} +func init() { + xgb.NewExtErrorFuncs["GLX"][8] = UnsupportedPrivateRequestErrorNew } -// IsDirectReply represents the data returned from a IsDirect request. -type IsDirectReply struct { - 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 -} +type Window uint32 -// Reply blocks and returns the reply data for a IsDirect request. -func (cook IsDirectCookie) Reply() (*IsDirectReply, error) { - buf, err := cook.Cookie.Reply() +func NewWindowId(c *xgb.Conn) (Window, error) { + id, err := c.NewId() if err != nil { - return nil, err - } - if buf == nil { - return nil, nil + return 0, err } - return isDirectReply(buf), nil + return Window(id), nil } -// 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 +// Skipping definition for base type 'Bool' - v.Sequence = xgb.Get16(buf[b:]) - b += 2 +// Skipping definition for base type 'Byte' - v.Length = xgb.Get32(buf[b:]) // 4-byte units - b += 4 +// Skipping definition for base type 'Card8' - if buf[b] == 1 { - v.IsDirect = true - } else { - v.IsDirect = false - } - b += 1 +// Skipping definition for base type 'Char' - b += 23 // padding +// Skipping definition for base type 'Void' - return v -} +// Skipping definition for base type 'Double' -// Write request to wire for IsDirect -// 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) +// Skipping definition for base type 'Float' - buf[b] = c.Extensions["GLX"] - b += 1 +// Skipping definition for base type 'Int16' - buf[b] = 6 // request opcode - b += 1 +// Skipping definition for base type 'Int32' - xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units - b += 2 +// Skipping definition for base type 'Int8' - xgb.Put32(buf[b:], uint32(Context)) - b += 4 +// Skipping definition for base type 'Card16' - return buf -} +// Skipping definition for base type 'Card32' -// QueryVersionCookie is a cookie used only for QueryVersion requests. -type QueryVersionCookie struct { +// AreTexturesResidentCookie is a cookie used only for AreTexturesResident requests. +type AreTexturesResidentCookie struct { *xgb.Cookie } -// 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 { +// 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 'QueryVersion' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'AreTexturesResident' 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} + c.NewRequest(areTexturesResidentRequest(c, ContextTag, N, Textures), cookie) + return AreTexturesResidentCookie{cookie} } -// QueryVersionUnchecked sends an unchecked request. +// AreTexturesResidentUnchecked 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 { +func AreTexturesResidentUnchecked(c *xgb.Conn, ContextTag ContextTag, N int32, Textures []uint32) AreTexturesResidentCookie { if _, ok := c.Extensions["GLX"]; !ok { - panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'AreTexturesResident' 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} + c.NewRequest(areTexturesResidentRequest(c, ContextTag, N, Textures), cookie) + return AreTexturesResidentCookie{cookie} } -// QueryVersionReply represents the data returned from a QueryVersion request. -type QueryVersionReply struct { +// AreTexturesResidentReply represents the data returned from a AreTexturesResident request. +type AreTexturesResidentReply struct { Sequence uint16 // sequence number of the request for this reply Length uint32 // number of bytes in this reply // padding: 1 bytes - MajorVersion uint32 - MinorVersion uint32 - // padding: 16 bytes + RetVal Bool32 + // padding: 20 bytes + Data []bool // size: xgb.Pad(((int(Length) * 4) * 1)) } -// Reply blocks and returns the reply data for a QueryVersion request. -func (cook QueryVersionCookie) Reply() (*QueryVersionReply, error) { +// 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 @@ -1399,12 +954,12 @@ func (cook QueryVersionCookie) Reply() (*QueryVersionReply, error) { if buf == nil { return nil, nil } - return queryVersionReply(buf), nil + return areTexturesResidentReply(buf), nil } -// queryVersionReply reads a byte slice into a QueryVersionReply value. -func queryVersionReply(buf []byte) *QueryVersionReply { - v := new(QueryVersionReply) +// 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 @@ -1415,149 +970,181 @@ func queryVersionReply(buf []byte) *QueryVersionReply { v.Length = xgb.Get32(buf[b:]) // 4-byte units b += 4 - v.MajorVersion = xgb.Get32(buf[b:]) + v.RetVal = Bool32(xgb.Get32(buf[b:])) b += 4 - v.MinorVersion = xgb.Get32(buf[b:]) - b += 4 + b += 20 // padding - b += 16 // 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 QueryVersion -// queryVersionRequest writes a QueryVersion request to a byte slice. -func queryVersionRequest(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32) []byte { - size := 12 +// Write request to wire for AreTexturesResident +// 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] = 7 // request opcode + 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:], MajorVersion) + xgb.Put32(buf[b:], uint32(ContextTag)) b += 4 - xgb.Put32(buf[b:], MinorVersion) + 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 } -// WaitGLCookie is a cookie used only for WaitGL requests. -type WaitGLCookie struct { +// ChangeDrawableAttributesCookie is a cookie used only for ChangeDrawableAttributes requests. +type ChangeDrawableAttributesCookie struct { *xgb.Cookie } -// WaitGL sends an unchecked request. +// ChangeDrawableAttributes 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 { +func ChangeDrawableAttributes(c *xgb.Conn, Drawable Drawable, NumAttribs uint32, Attribs []uint32) ChangeDrawableAttributesCookie { if _, ok := c.Extensions["GLX"]; !ok { - panic("Cannot issue request 'WaitGL' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'ChangeDrawableAttributes' 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} + c.NewRequest(changeDrawableAttributesRequest(c, Drawable, NumAttribs, Attribs), cookie) + return ChangeDrawableAttributesCookie{cookie} } -// WaitGLChecked sends a checked request. -// If an error occurs, it can be retrieved using WaitGLCookie.Check() -func WaitGLChecked(c *xgb.Conn, ContextTag ContextTag) WaitGLCookie { +// 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 'WaitGL' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'ChangeDrawableAttributes' 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} + c.NewRequest(changeDrawableAttributesRequest(c, Drawable, NumAttribs, Attribs), cookie) + return ChangeDrawableAttributesCookie{cookie} } // Check returns an error if one occurred for checked requests that are not expecting a reply. // This cannot be called for requests expecting a reply, nor for unchecked requests. -func (cook WaitGLCookie) Check() error { +func (cook ChangeDrawableAttributesCookie) Check() error { return cook.Cookie.Check() } -// Write request to wire for WaitGL -// waitGLRequest writes a WaitGL request to a byte slice. -func waitGLRequest(c *xgb.Conn, ContextTag ContextTag) []byte { - size := 8 +// Write request to wire for ChangeDrawableAttributes +// 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] = 8 // request opcode + 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(ContextTag)) + 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 } -// WaitXCookie is a cookie used only for WaitX requests. -type WaitXCookie struct { +// ClientInfoCookie is a cookie used only for ClientInfo requests. +type ClientInfoCookie struct { *xgb.Cookie } -// WaitX sends an unchecked request. +// ClientInfo 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 { +func ClientInfo(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32, StrLen uint32, String string) ClientInfoCookie { if _, ok := c.Extensions["GLX"]; !ok { - panic("Cannot issue request 'WaitX' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'ClientInfo' 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} + c.NewRequest(clientInfoRequest(c, MajorVersion, MinorVersion, StrLen, String), cookie) + return ClientInfoCookie{cookie} } -// WaitXChecked sends a checked request. -// If an error occurs, it can be retrieved using WaitXCookie.Check() -func WaitXChecked(c *xgb.Conn, ContextTag ContextTag) WaitXCookie { +// 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 'WaitX' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'ClientInfo' 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} + c.NewRequest(clientInfoRequest(c, MajorVersion, MinorVersion, StrLen, String), cookie) + return ClientInfoCookie{cookie} } // Check returns an error if one occurred for checked requests that are not expecting a reply. // This cannot be called for requests expecting a reply, nor for unchecked requests. -func (cook WaitXCookie) Check() error { +func (cook ClientInfoCookie) Check() error { return cook.Cookie.Check() } -// Write request to wire for WaitX -// waitXRequest writes a WaitX request to a byte slice. -func waitXRequest(c *xgb.Conn, ContextTag ContextTag) []byte { - size := 8 +// Write request to wire for ClientInfo +// 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] = 9 // request opcode + 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:], uint32(ContextTag)) + 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 } @@ -1625,128 +1212,158 @@ func copyContextRequest(c *xgb.Conn, Src Context, Dest Context, Mask uint32, Src return buf } -// SwapBuffersCookie is a cookie used only for SwapBuffers requests. -type SwapBuffersCookie struct { +// CreateContextCookie is a cookie used only for CreateContext requests. +type CreateContextCookie struct { *xgb.Cookie } -// SwapBuffers sends an unchecked request. +// CreateContext 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 { +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 'SwapBuffers' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'CreateContext' 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} + c.NewRequest(createContextRequest(c, Context, Visual, Screen, ShareList, IsDirect), cookie) + return CreateContextCookie{cookie} } -// 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 { +// 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 'SwapBuffers' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'CreateContext' 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} + c.NewRequest(createContextRequest(c, Context, Visual, Screen, ShareList, IsDirect), cookie) + return CreateContextCookie{cookie} } // Check returns an error if one occurred for checked requests that are not expecting a reply. // This cannot be called for requests expecting a reply, nor for unchecked requests. -func (cook SwapBuffersCookie) Check() error { +func (cook CreateContextCookie) Check() error { return cook.Cookie.Check() } -// Write request to wire for SwapBuffers -// swapBuffersRequest writes a SwapBuffers request to a byte slice. -func swapBuffersRequest(c *xgb.Conn, ContextTag ContextTag, Drawable Drawable) []byte { - size := 12 +// Write request to wire for CreateContext +// 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] = 11 // request opcode + 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(ContextTag)) + xgb.Put32(buf[b:], uint32(Context)) b += 4 - xgb.Put32(buf[b:], uint32(Drawable)) + 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 } -// UseXFontCookie is a cookie used only for UseXFont requests. -type UseXFontCookie struct { +// CreateContextAttribsARBCookie is a cookie used only for CreateContextAttribsARB requests. +type CreateContextAttribsARBCookie struct { *xgb.Cookie } -// UseXFont sends an unchecked request. +// CreateContextAttribsARB 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 { +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 'UseXFont' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'CreateContextAttribsARB' 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} + c.NewRequest(createContextAttribsARBRequest(c, Context, Fbconfig, Screen, ShareList, IsDirect, NumAttribs, Attribs), cookie) + return CreateContextAttribsARBCookie{cookie} } -// 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 { +// 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 'UseXFont' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'CreateContextAttribsARB' 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} + c.NewRequest(createContextAttribsARBRequest(c, Context, Fbconfig, Screen, ShareList, IsDirect, NumAttribs, Attribs), cookie) + return CreateContextAttribsARBCookie{cookie} } // Check returns an error if one occurred for checked requests that are not expecting a reply. // This cannot be called for requests expecting a reply, nor for unchecked requests. -func (cook UseXFontCookie) Check() error { +func (cook CreateContextAttribsARBCookie) Check() error { return cook.Cookie.Check() } -// Write request to wire for UseXFont -// 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 +// Write request to wire for CreateContextAttribsARB +// 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] = 12 // request opcode + 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(ContextTag)) + xgb.Put32(buf[b:], uint32(Context)) b += 4 - xgb.Put32(buf[b:], uint32(Font)) + xgb.Put32(buf[b:], uint32(Fbconfig)) b += 4 - xgb.Put32(buf[b:], First) + xgb.Put32(buf[b:], Screen) b += 4 - xgb.Put32(buf[b:], Count) + xgb.Put32(buf[b:], uint32(ShareList)) b += 4 - xgb.Put32(buf[b:], ListBase) + 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 } @@ -1814,98 +1431,126 @@ func createGLXPixmapRequest(c *xgb.Conn, Screen uint32, Visual xproto.Visualid, return buf } -// GetVisualConfigsCookie is a cookie used only for GetVisualConfigs requests. -type GetVisualConfigsCookie struct { +// CreateNewContextCookie is a cookie used only for CreateNewContext requests. +type CreateNewContextCookie struct { *xgb.Cookie } -// 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 { +// 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 'GetVisualConfigs' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'CreateNewContext' 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} + cookie := c.NewCookie(false, false) + c.NewRequest(createNewContextRequest(c, Context, Fbconfig, Screen, RenderType, ShareList, IsDirect), cookie) + return CreateNewContextCookie{cookie} } -// 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 { +// 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 'GetVisualConfigs' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'CreateNewContext' 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} + cookie := c.NewCookie(true, false) + c.NewRequest(createNewContextRequest(c, Context, Fbconfig, Screen, RenderType, ShareList, IsDirect), cookie) + return CreateNewContextCookie{cookie} } -// GetVisualConfigsReply represents the data returned from a GetVisualConfigs request. -type GetVisualConfigsReply struct { - 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)) +// 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() } -// 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 -} +// Write request to wire for CreateNewContext +// 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) -// getVisualConfigsReply reads a byte slice into a GetVisualConfigsReply value. -func getVisualConfigsReply(buf []byte) *GetVisualConfigsReply { - v := new(GetVisualConfigsReply) - b := 1 // skip reply determinant + buf[b] = c.Extensions["GLX"] + b += 1 - b += 1 // padding + buf[b] = 24 // request opcode + b += 1 - v.Sequence = xgb.Get16(buf[b:]) + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 - v.Length = xgb.Get32(buf[b:]) // 4-byte units + xgb.Put32(buf[b:], uint32(Context)) b += 4 - v.NumVisuals = xgb.Get32(buf[b:]) + xgb.Put32(buf[b:], uint32(Fbconfig)) b += 4 - v.NumProperties = xgb.Get32(buf[b:]) + xgb.Put32(buf[b:], Screen) b += 4 - b += 16 // padding + xgb.Put32(buf[b:], RenderType) + b += 4 - v.PropertyList = make([]uint32, v.Length) - for i := 0; i < int(v.Length); i++ { - v.PropertyList[i] = xgb.Get32(buf[b:]) - b += 4 + xgb.Put32(buf[b:], uint32(ShareList)) + b += 4 + + if IsDirect { + buf[b] = 1 + } else { + buf[b] = 0 } - b = xgb.Pad(b) + b += 1 - return v + b += 3 // padding + + return buf } -// Write request to wire for GetVisualConfigs -// getVisualConfigsRequest writes a GetVisualConfigs request to a byte slice. -func getVisualConfigsRequest(c *xgb.Conn, Screen uint32) []byte { - size := 8 +// CreatePbufferCookie is a cookie used only for CreatePbuffer requests. +type CreatePbufferCookie struct { + *xgb.Cookie +} + +// 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} +} + +// 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} +} + +// 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 +// 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] = 14 // request opcode + buf[b] = 27 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units @@ -1914,576 +1559,505 @@ func getVisualConfigsRequest(c *xgb.Conn, Screen uint32) []byte { 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 } -// DestroyGLXPixmapCookie is a cookie used only for DestroyGLXPixmap requests. -type DestroyGLXPixmapCookie struct { +// CreatePixmapCookie is a cookie used only for CreatePixmap requests. +type CreatePixmapCookie struct { *xgb.Cookie } -// DestroyGLXPixmap sends an unchecked request. +// CreatePixmap 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 { +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 'DestroyGLXPixmap' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'CreatePixmap' 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} + c.NewRequest(createPixmapRequest(c, Screen, Fbconfig, Pixmap, GlxPixmap, NumAttribs, Attribs), cookie) + return CreatePixmapCookie{cookie} } -// DestroyGLXPixmapChecked sends a checked request. -// If an error occurs, it can be retrieved using DestroyGLXPixmapCookie.Check() -func DestroyGLXPixmapChecked(c *xgb.Conn, GlxPixmap Pixmap) DestroyGLXPixmapCookie { +// 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 'DestroyGLXPixmap' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'CreatePixmap' 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} + c.NewRequest(createPixmapRequest(c, Screen, Fbconfig, Pixmap, GlxPixmap, NumAttribs, Attribs), cookie) + return CreatePixmapCookie{cookie} } // Check returns an error if one occurred for checked requests that are not expecting a reply. // This cannot be called for requests expecting a reply, nor for unchecked requests. -func (cook DestroyGLXPixmapCookie) Check() error { +func (cook CreatePixmapCookie) Check() error { return cook.Cookie.Check() } -// Write request to wire for DestroyGLXPixmap -// destroyGLXPixmapRequest writes a DestroyGLXPixmap request to a byte slice. -func destroyGLXPixmapRequest(c *xgb.Conn, GlxPixmap Pixmap) []byte { - size := 8 +// Write request to wire for CreatePixmap +// 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] = 15 // request opcode + 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 } -// VendorPrivateCookie is a cookie used only for VendorPrivate requests. -type VendorPrivateCookie struct { +// CreateWindowCookie is a cookie used only for CreateWindow requests. +type CreateWindowCookie struct { *xgb.Cookie } -// VendorPrivate sends an unchecked request. +// CreateWindow 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 { +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 'VendorPrivate' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'CreateWindow' 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} + c.NewRequest(createWindowRequest(c, Screen, Fbconfig, Window, GlxWindow, NumAttribs, Attribs), cookie) + return CreateWindowCookie{cookie} } -// 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 { +// 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 'VendorPrivate' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'CreateWindow' 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} + c.NewRequest(createWindowRequest(c, Screen, Fbconfig, Window, GlxWindow, NumAttribs, Attribs), cookie) + return CreateWindowCookie{cookie} } // Check returns an error if one occurred for checked requests that are not expecting a reply. // This cannot be called for requests expecting a reply, nor for unchecked requests. -func (cook VendorPrivateCookie) Check() error { +func (cook CreateWindowCookie) Check() error { return cook.Cookie.Check() } -// Write request to wire for VendorPrivate -// 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)))) +// Write request to wire for CreateWindow +// 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] = 16 // request opcode + 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:], VendorCode) + xgb.Put32(buf[b:], Screen) b += 4 - xgb.Put32(buf[b:], uint32(ContextTag)) + xgb.Put32(buf[b:], uint32(Fbconfig)) b += 4 - copy(buf[b:], Data[:len(Data)]) - b += xgb.Pad(int(len(Data))) + 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 } -// VendorPrivateWithReplyCookie is a cookie used only for VendorPrivateWithReply requests. -type VendorPrivateWithReplyCookie struct { +// DeleteListsCookie is a cookie used only for DeleteLists requests. +type DeleteListsCookie struct { *xgb.Cookie } -// 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} -} - -// VendorPrivateWithReplyUnchecked sends an unchecked request. +// DeleteLists 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 { +func DeleteLists(c *xgb.Conn, ContextTag ContextTag, List uint32, Range int32) DeleteListsCookie { if _, ok := c.Extensions["GLX"]; !ok { - panic("Cannot issue request 'VendorPrivateWithReply' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'DeleteLists' 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} -} - -// VendorPrivateWithReplyReply represents the data returned from a VendorPrivateWithReply request. -type VendorPrivateWithReplyReply struct { - 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)) + cookie := c.NewCookie(false, false) + c.NewRequest(deleteListsRequest(c, ContextTag, List, Range), cookie) + return DeleteListsCookie{cookie} } -// 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 +// 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.") } - return vendorPrivateWithReplyReply(buf), nil + cookie := c.NewCookie(true, false) + c.NewRequest(deleteListsRequest(c, ContextTag, List, Range), cookie) + return DeleteListsCookie{cookie} } -// 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 +// 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 VendorPrivateWithReply -// 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)))) +// Write request to wire for DeleteLists +// 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] = 17 // request opcode + 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:], VendorCode) + xgb.Put32(buf[b:], uint32(ContextTag)) b += 4 - xgb.Put32(buf[b:], uint32(ContextTag)) + xgb.Put32(buf[b:], List) b += 4 - copy(buf[b:], Data[:len(Data)]) - b += xgb.Pad(int(len(Data))) + xgb.Put32(buf[b:], uint32(Range)) + b += 4 return buf } -// QueryExtensionsStringCookie is a cookie used only for QueryExtensionsString requests. -type QueryExtensionsStringCookie struct { +// DeleteQueriesARBCookie is a cookie used only for DeleteQueriesARB requests. +type DeleteQueriesARBCookie struct { *xgb.Cookie } -// 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} -} - -// QueryExtensionsStringUnchecked sends an unchecked request. +// DeleteQueriesARB 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 { +func DeleteQueriesARB(c *xgb.Conn, ContextTag ContextTag, N int32, Ids []uint32) DeleteQueriesARBCookie { if _, ok := c.Extensions["GLX"]; !ok { - panic("Cannot issue request 'QueryExtensionsString' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'DeleteQueriesARB' 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} -} - -// QueryExtensionsStringReply represents the data returned from a QueryExtensionsString request. -type QueryExtensionsStringReply struct { - Sequence uint16 // sequence number of the request for this reply - Length uint32 // number of bytes in this reply - // padding: 1 bytes - // padding: 4 bytes - N uint32 - // padding: 16 bytes + cookie := c.NewCookie(false, false) + c.NewRequest(deleteQueriesARBRequest(c, ContextTag, N, Ids), cookie) + return DeleteQueriesARBCookie{cookie} } -// 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 +// 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.") } - return queryExtensionsStringReply(buf), nil + cookie := c.NewCookie(true, false) + c.NewRequest(deleteQueriesARBRequest(c, ContextTag, N, Ids), cookie) + return DeleteQueriesARBCookie{cookie} } -// 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 +// 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 QueryExtensionsString -// queryExtensionsStringRequest writes a QueryExtensionsString request to a byte slice. -func queryExtensionsStringRequest(c *xgb.Conn, Screen uint32) []byte { - size := 8 +// Write request to wire for DeleteQueriesARB +// 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] = 18 // request opcode + 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:], Screen) + 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 } -// QueryServerStringCookie is a cookie used only for QueryServerString requests. -type QueryServerStringCookie struct { +// DeleteTexturesCookie is a cookie used only for DeleteTextures requests. +type DeleteTexturesCookie struct { *xgb.Cookie } -// 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} -} - -// QueryServerStringUnchecked sends an unchecked request. +// DeleteTextures 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 { +func DeleteTextures(c *xgb.Conn, ContextTag ContextTag, N int32, Textures []uint32) DeleteTexturesCookie { if _, ok := c.Extensions["GLX"]; !ok { - panic("Cannot issue request 'QueryServerString' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'DeleteTextures' 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} -} - -// QueryServerStringReply represents the data returned from a QueryServerString request. -type QueryServerStringReply struct { - Sequence uint16 // sequence number of the request for this reply - Length uint32 // number of bytes in this reply - // padding: 1 bytes - // padding: 4 bytes - StrLen uint32 - // padding: 16 bytes - String string // size: xgb.Pad((int(StrLen) * 1)) + cookie := c.NewCookie(false, false) + c.NewRequest(deleteTexturesRequest(c, ContextTag, N, Textures), cookie) + return DeleteTexturesCookie{cookie} } -// 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 +// 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.") } - return queryServerStringReply(buf), nil + cookie := c.NewCookie(true, false) + c.NewRequest(deleteTexturesRequest(c, ContextTag, N, Textures), cookie) + return DeleteTexturesCookie{cookie} } -// 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 +// 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 QueryServerString -// queryServerStringRequest writes a QueryServerString request to a byte slice. -func queryServerStringRequest(c *xgb.Conn, Screen uint32, Name uint32) []byte { - size := 12 +// Write request to wire for DeleteTextures +// 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] = 19 // request opcode + 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:], Screen) + xgb.Put32(buf[b:], uint32(ContextTag)) b += 4 - xgb.Put32(buf[b:], Name) + 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 } -// ClientInfoCookie is a cookie used only for ClientInfo requests. -type ClientInfoCookie struct { +// DeleteWindowCookie is a cookie used only for DeleteWindow requests. +type DeleteWindowCookie struct { *xgb.Cookie } -// ClientInfo sends an unchecked request. +// DeleteWindow 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 { +func DeleteWindow(c *xgb.Conn, Glxwindow Window) DeleteWindowCookie { if _, ok := c.Extensions["GLX"]; !ok { - panic("Cannot issue request 'ClientInfo' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'DeleteWindow' 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} + c.NewRequest(deleteWindowRequest(c, Glxwindow), cookie) + return DeleteWindowCookie{cookie} } -// 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 { +// 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 'ClientInfo' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'DeleteWindow' 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} + c.NewRequest(deleteWindowRequest(c, Glxwindow), cookie) + return DeleteWindowCookie{cookie} } // Check returns an error if one occurred for checked requests that are not expecting a reply. // This cannot be called for requests expecting a reply, nor for unchecked requests. -func (cook ClientInfoCookie) Check() error { +func (cook DeleteWindowCookie) Check() error { return cook.Cookie.Check() } -// Write request to wire for ClientInfo -// 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)))) +// Write request to wire for DeleteWindow +// 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] = 20 // request opcode + 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:], MajorVersion) - b += 4 - - xgb.Put32(buf[b:], MinorVersion) - b += 4 - - xgb.Put32(buf[b:], StrLen) + xgb.Put32(buf[b:], uint32(Glxwindow)) b += 4 - copy(buf[b:], String[:StrLen]) - b += xgb.Pad(int(StrLen)) - return buf } -// GetFBConfigsCookie is a cookie used only for GetFBConfigs requests. -type GetFBConfigsCookie struct { +// DestroyContextCookie is a cookie used only for DestroyContext requests. +type DestroyContextCookie struct { *xgb.Cookie } -// 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 { +// 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 'GetFBConfigs' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'DestroyContext' 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} + cookie := c.NewCookie(false, false) + c.NewRequest(destroyContextRequest(c, Context), cookie) + return DestroyContextCookie{cookie} } -// 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 { +// 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 'GetFBConfigs' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'DestroyContext' 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} + cookie := c.NewCookie(true, false) + c.NewRequest(destroyContextRequest(c, Context), cookie) + return DestroyContextCookie{cookie} } -// GetFBConfigsReply represents the data returned from a GetFBConfigs request. -type GetFBConfigsReply struct { - Sequence uint16 // sequence number of the request for this reply - Length uint32 // number of bytes in this reply - // padding: 1 bytes - NumFbConfigs uint32 - NumProperties uint32 - // padding: 16 bytes - PropertyList []uint32 // size: xgb.Pad((int(Length) * 4)) +// 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() } -// 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 -} +// Write request to wire for DestroyContext +// 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) -// getFBConfigsReply reads a byte slice into a GetFBConfigsReply value. -func getFBConfigsReply(buf []byte) *GetFBConfigsReply { - v := new(GetFBConfigsReply) - b := 1 // skip reply determinant + buf[b] = c.Extensions["GLX"] + b += 1 - b += 1 // padding + buf[b] = 4 // request opcode + b += 1 - v.Sequence = xgb.Get16(buf[b:]) + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 - v.Length = xgb.Get32(buf[b:]) // 4-byte units + xgb.Put32(buf[b:], uint32(Context)) b += 4 - v.NumFbConfigs = xgb.Get32(buf[b:]) - b += 4 + return buf +} - v.NumProperties = xgb.Get32(buf[b:]) - b += 4 +// DestroyGLXPixmapCookie is a cookie used only for DestroyGLXPixmap requests. +type DestroyGLXPixmapCookie struct { + *xgb.Cookie +} - b += 16 // padding +// 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} +} - v.PropertyList = make([]uint32, v.Length) - for i := 0; i < int(v.Length); i++ { - v.PropertyList[i] = xgb.Get32(buf[b:]) - b += 4 +// 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.") } - b = xgb.Pad(b) + cookie := c.NewCookie(true, false) + c.NewRequest(destroyGLXPixmapRequest(c, GlxPixmap), cookie) + return DestroyGLXPixmapCookie{cookie} +} - return v +// 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 GetFBConfigs -// getFBConfigsRequest writes a GetFBConfigs request to a byte slice. -func getFBConfigsRequest(c *xgb.Conn, Screen uint32) []byte { +// Write request to wire for DestroyGLXPixmap +// 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) @@ -2491,88 +2065,70 @@ func getFBConfigsRequest(c *xgb.Conn, Screen uint32) []byte { buf[b] = c.Extensions["GLX"] b += 1 - buf[b] = 21 // request opcode + 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:], Screen) + xgb.Put32(buf[b:], uint32(GlxPixmap)) b += 4 return buf } -// CreatePixmapCookie is a cookie used only for CreatePixmap requests. -type CreatePixmapCookie struct { +// DestroyPbufferCookie is a cookie used only for DestroyPbuffer requests. +type DestroyPbufferCookie struct { *xgb.Cookie } -// CreatePixmap sends an unchecked request. +// DestroyPbuffer 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 { +func DestroyPbuffer(c *xgb.Conn, Pbuffer Pbuffer) DestroyPbufferCookie { if _, ok := c.Extensions["GLX"]; !ok { - panic("Cannot issue request 'CreatePixmap' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'DestroyPbuffer' 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} + c.NewRequest(destroyPbufferRequest(c, Pbuffer), cookie) + return DestroyPbufferCookie{cookie} } -// 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 { +// 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 'CreatePixmap' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'DestroyPbuffer' 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} + c.NewRequest(destroyPbufferRequest(c, Pbuffer), cookie) + return DestroyPbufferCookie{cookie} } // Check returns an error if one occurred for checked requests that are not expecting a reply. // This cannot be called for requests expecting a reply, nor for unchecked requests. -func (cook CreatePixmapCookie) Check() error { +func (cook DestroyPbufferCookie) Check() error { return cook.Cookie.Check() } -// Write request to wire for CreatePixmap -// 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)))) +// Write request to wire for DestroyPbuffer +// 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] = 22 // request opcode + 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:], 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) + xgb.Put32(buf[b:], uint32(Pbuffer)) 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 } @@ -2631,121 +2187,158 @@ func destroyPixmapRequest(c *xgb.Conn, GlxPixmap Pixmap) []byte { return buf } -// CreateNewContextCookie is a cookie used only for CreateNewContext requests. -type CreateNewContextCookie struct { +// EndListCookie is a cookie used only for EndList requests. +type EndListCookie struct { *xgb.Cookie } -// CreateNewContext sends an unchecked request. +// EndList 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 { +func EndList(c *xgb.Conn, ContextTag ContextTag) EndListCookie { if _, ok := c.Extensions["GLX"]; !ok { - panic("Cannot issue request 'CreateNewContext' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'EndList' 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} + c.NewRequest(endListRequest(c, ContextTag), cookie) + return EndListCookie{cookie} } -// 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 { +// 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 'CreateNewContext' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'EndList' 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} + c.NewRequest(endListRequest(c, ContextTag), cookie) + return EndListCookie{cookie} } // Check returns an error if one occurred for checked requests that are not expecting a reply. // This cannot be called for requests expecting a reply, nor for unchecked requests. -func (cook CreateNewContextCookie) Check() error { +func (cook EndListCookie) Check() error { return cook.Cookie.Check() } -// Write request to wire for CreateNewContext -// 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 +// Write request to wire for EndList +// 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] = 24 // request opcode + 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(Context)) - b += 4 - - xgb.Put32(buf[b:], uint32(Fbconfig)) + xgb.Put32(buf[b:], uint32(ContextTag)) b += 4 - xgb.Put32(buf[b:], Screen) - b += 4 + return buf +} - xgb.Put32(buf[b:], RenderType) - b += 4 +// FeedbackBufferCookie is a cookie used only for FeedbackBuffer requests. +type FeedbackBufferCookie struct { + *xgb.Cookie +} - xgb.Put32(buf[b:], uint32(ShareList)) - b += 4 +// 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} +} - if IsDirect { - buf[b] = 1 - } else { - buf[b] = 0 +// 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} +} + +// 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 +// 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 - b += 3 // padding + 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 } -// QueryContextCookie is a cookie used only for QueryContext requests. -type QueryContextCookie struct { +// FinishCookie is a cookie used only for Finish requests. +type FinishCookie struct { *xgb.Cookie } -// 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 { +// 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 'QueryContext' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'Finish' 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} + c.NewRequest(finishRequest(c, ContextTag), cookie) + return FinishCookie{cookie} } -// QueryContextUnchecked sends an unchecked request. +// FinishUnchecked 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 { +func FinishUnchecked(c *xgb.Conn, ContextTag ContextTag) FinishCookie { if _, ok := c.Extensions["GLX"]; !ok { - panic("Cannot issue request 'QueryContext' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'Finish' 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} + c.NewRequest(finishRequest(c, ContextTag), cookie) + return FinishCookie{cookie} } -// QueryContextReply represents the data returned from a QueryContext request. -type QueryContextReply struct { +// FinishReply represents the data returned from a Finish request. +type FinishReply struct { Sequence uint16 // sequence number of the request for this reply Length uint32 // number of bytes in this reply // padding: 1 bytes - NumAttribs uint32 - // padding: 20 bytes - Attribs []uint32 // size: xgb.Pad(((int(NumAttribs) * 2) * 4)) } -// Reply blocks and returns the reply data for a QueryContext request. -func (cook QueryContextCookie) Reply() (*QueryContextReply, error) { +// 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 @@ -2753,12 +2346,12 @@ func (cook QueryContextCookie) Reply() (*QueryContextReply, error) { if buf == nil { return nil, nil } - return queryContextReply(buf), nil + return finishReply(buf), nil } -// queryContextReply reads a byte slice into a QueryContextReply value. -func queryContextReply(buf []byte) *QueryContextReply { - v := new(QueryContextReply) +// 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 @@ -2769,24 +2362,67 @@ func queryContextReply(buf []byte) *QueryContextReply { v.Length = xgb.Get32(buf[b:]) // 4-byte units b += 4 - v.NumAttribs = xgb.Get32(buf[b:]) + return v +} + +// Write request to wire for Finish +// 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 - b += 20 // padding + return buf +} - 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 +// FlushCookie is a cookie used only for Flush requests. +type FlushCookie struct { + *xgb.Cookie +} + +// Flush sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. +func Flush(c *xgb.Conn, ContextTag ContextTag) FlushCookie { + if _, ok := c.Extensions["GLX"]; !ok { + panic("Cannot issue request 'Flush' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } - b = xgb.Pad(b) + cookie := c.NewCookie(false, false) + c.NewRequest(flushRequest(c, ContextTag), cookie) + return FlushCookie{cookie} +} - return v +// 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} } -// Write request to wire for QueryContext -// queryContextRequest writes a QueryContext request to a byte slice. -func queryContextRequest(c *xgb.Conn, Context Context) []byte { +// 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 +// 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) @@ -2794,56 +2430,55 @@ func queryContextRequest(c *xgb.Conn, Context Context) []byte { buf[b] = c.Extensions["GLX"] b += 1 - buf[b] = 25 // request opcode + 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(Context)) + xgb.Put32(buf[b:], uint32(ContextTag)) b += 4 return buf } -// MakeContextCurrentCookie is a cookie used only for MakeContextCurrent requests. -type MakeContextCurrentCookie struct { +// GenListsCookie is a cookie used only for GenLists requests. +type GenListsCookie struct { *xgb.Cookie } -// 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 { +// 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 'MakeContextCurrent' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GenLists' 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} + c.NewRequest(genListsRequest(c, ContextTag, Range), cookie) + return GenListsCookie{cookie} } -// MakeContextCurrentUnchecked sends an unchecked request. +// GenListsUnchecked 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 { +func GenListsUnchecked(c *xgb.Conn, ContextTag ContextTag, Range int32) GenListsCookie { if _, ok := c.Extensions["GLX"]; !ok { - panic("Cannot issue request 'MakeContextCurrent' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GenLists' 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} + c.NewRequest(genListsRequest(c, ContextTag, Range), cookie) + return GenListsCookie{cookie} } -// MakeContextCurrentReply represents the data returned from a MakeContextCurrent request. -type MakeContextCurrentReply struct { +// GenListsReply represents the data returned from a GenLists request. +type GenListsReply struct { Sequence uint16 // sequence number of the request for this reply Length uint32 // number of bytes in this reply // padding: 1 bytes - ContextTag ContextTag - // padding: 20 bytes + RetVal uint32 } -// Reply blocks and returns the reply data for a MakeContextCurrent request. -func (cook MakeContextCurrentCookie) Reply() (*MakeContextCurrentReply, error) { +// 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 @@ -2851,12 +2486,12 @@ func (cook MakeContextCurrentCookie) Reply() (*MakeContextCurrentReply, error) { if buf == nil { return nil, nil } - return makeContextCurrentReply(buf), nil + return genListsReply(buf), nil } -// makeContextCurrentReply reads a byte slice into a MakeContextCurrentReply value. -func makeContextCurrentReply(buf []byte) *MakeContextCurrentReply { - v := new(MakeContextCurrentReply) +// 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 @@ -2867,209 +2502,173 @@ func makeContextCurrentReply(buf []byte) *MakeContextCurrentReply { v.Length = xgb.Get32(buf[b:]) // 4-byte units b += 4 - v.ContextTag = ContextTag(xgb.Get32(buf[b:])) + v.RetVal = xgb.Get32(buf[b:]) b += 4 - b += 20 // padding - return v } -// Write request to wire for MakeContextCurrent -// 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 +// Write request to wire for GenLists +// 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] = 26 // request opcode + 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(OldContextTag)) - b += 4 - - xgb.Put32(buf[b:], uint32(Drawable)) - b += 4 - - xgb.Put32(buf[b:], uint32(ReadDrawable)) + xgb.Put32(buf[b:], uint32(ContextTag)) b += 4 - xgb.Put32(buf[b:], uint32(Context)) + xgb.Put32(buf[b:], uint32(Range)) b += 4 return buf } -// CreatePbufferCookie is a cookie used only for CreatePbuffer requests. -type CreatePbufferCookie struct { +// GenQueriesARBCookie is a cookie used only for GenQueriesARB requests. +type GenQueriesARBCookie struct { *xgb.Cookie } -// 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 { +// 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 'CreatePbuffer' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GenQueriesARB' 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} + cookie := c.NewCookie(true, true) + c.NewRequest(genQueriesARBRequest(c, ContextTag, N), cookie) + return GenQueriesARBCookie{cookie} } -// 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 { +// 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 'CreatePbuffer' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GenQueriesARB' 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} + cookie := c.NewCookie(false, true) + c.NewRequest(genQueriesARBRequest(c, ContextTag, N), cookie) + return GenQueriesARBCookie{cookie} } -// Check returns an error if one occurred for checked requests that are not expecting a reply. -// This cannot be called for requests expecting a reply, nor for unchecked requests. -func (cook CreatePbufferCookie) Check() error { - return cook.Cookie.Check() +// GenQueriesARBReply represents the data returned from a GenQueriesARB request. +type GenQueriesARBReply struct { + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply + // padding: 1 bytes + // padding: 24 bytes + Data []uint32 // size: xgb.Pad((int(Length) * 4)) } -// Write request to wire for CreatePbuffer -// 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) +// 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 +} - buf[b] = c.Extensions["GLX"] - b += 1 +// genQueriesARBReply reads a byte slice into a GenQueriesARBReply value. +func genQueriesARBReply(buf []byte) *GenQueriesARBReply { + v := new(GenQueriesARBReply) + b := 1 // skip reply determinant - buf[b] = 27 // request opcode - b += 1 + b += 1 // padding - xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + v.Sequence = xgb.Get16(buf[b:]) b += 2 - xgb.Put32(buf[b:], Screen) - b += 4 - - xgb.Put32(buf[b:], uint32(Fbconfig)) - b += 4 - - xgb.Put32(buf[b:], uint32(Pbuffer)) + v.Length = xgb.Get32(buf[b:]) // 4-byte units b += 4 - xgb.Put32(buf[b:], NumAttribs) - b += 4 + b += 24 // padding - for i := 0; i < int((int(NumAttribs) * 2)); i++ { - xgb.Put32(buf[b:], Attribs[i]) + 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 buf -} - -// DestroyPbufferCookie is a cookie used only for DestroyPbuffer requests. -type DestroyPbufferCookie struct { - *xgb.Cookie -} - -// 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} -} - -// 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} -} - -// 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() + return v } -// Write request to wire for DestroyPbuffer -// destroyPbufferRequest writes a DestroyPbuffer request to a byte slice. -func destroyPbufferRequest(c *xgb.Conn, Pbuffer Pbuffer) []byte { - size := 8 +// Write request to wire for GenQueriesARB +// 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] = 28 // request opcode + 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(Pbuffer)) + xgb.Put32(buf[b:], uint32(ContextTag)) + b += 4 + + xgb.Put32(buf[b:], uint32(N)) b += 4 return buf } -// GetDrawableAttributesCookie is a cookie used only for GetDrawableAttributes requests. -type GetDrawableAttributesCookie struct { +// GenTexturesCookie is a cookie used only for GenTextures requests. +type GenTexturesCookie struct { *xgb.Cookie } -// 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 { +// 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 'GetDrawableAttributes' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GenTextures' 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} + c.NewRequest(genTexturesRequest(c, ContextTag, N), cookie) + return GenTexturesCookie{cookie} } -// GetDrawableAttributesUnchecked sends an unchecked request. +// GenTexturesUnchecked 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 { +func GenTexturesUnchecked(c *xgb.Conn, ContextTag ContextTag, N int32) GenTexturesCookie { if _, ok := c.Extensions["GLX"]; !ok { - panic("Cannot issue request 'GetDrawableAttributes' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GenTextures' 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} + c.NewRequest(genTexturesRequest(c, ContextTag, N), cookie) + return GenTexturesCookie{cookie} } -// GetDrawableAttributesReply represents the data returned from a GetDrawableAttributes request. -type GetDrawableAttributesReply struct { +// GenTexturesReply represents the data returned from a GenTextures request. +type GenTexturesReply struct { Sequence uint16 // sequence number of the request for this reply Length uint32 // number of bytes in this reply // padding: 1 bytes - NumAttribs uint32 - // padding: 20 bytes - Attribs []uint32 // size: xgb.Pad(((int(NumAttribs) * 2) * 4)) + // padding: 24 bytes + Data []uint32 // size: xgb.Pad((int(Length) * 4)) } -// Reply blocks and returns the reply data for a GetDrawableAttributes request. -func (cook GetDrawableAttributesCookie) Reply() (*GetDrawableAttributesReply, error) { +// 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 @@ -3077,12 +2676,12 @@ func (cook GetDrawableAttributesCookie) Reply() (*GetDrawableAttributesReply, er if buf == nil { return nil, nil } - return getDrawableAttributesReply(buf), nil + return genTexturesReply(buf), nil } -// getDrawableAttributesReply reads a byte slice into a GetDrawableAttributesReply value. -func getDrawableAttributesReply(buf []byte) *GetDrawableAttributesReply { - v := new(GetDrawableAttributesReply) +// 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 @@ -3093,14 +2692,11 @@ func getDrawableAttributesReply(buf []byte) *GetDrawableAttributesReply { v.Length = xgb.Get32(buf[b:]) // 4-byte units b += 4 - v.NumAttribs = xgb.Get32(buf[b:]) - b += 4 - - b += 20 // padding + b += 24 // 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:]) + 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) @@ -3108,496 +2704,448 @@ func getDrawableAttributesReply(buf []byte) *GetDrawableAttributesReply { return v } -// Write request to wire for GetDrawableAttributes -// getDrawableAttributesRequest writes a GetDrawableAttributes request to a byte slice. -func getDrawableAttributesRequest(c *xgb.Conn, Drawable Drawable) []byte { - size := 8 +// Write request to wire for GenTextures +// 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] = 29 // request opcode + 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(Drawable)) + xgb.Put32(buf[b:], uint32(ContextTag)) + b += 4 + + xgb.Put32(buf[b:], uint32(N)) b += 4 return buf } -// ChangeDrawableAttributesCookie is a cookie used only for ChangeDrawableAttributes requests. -type ChangeDrawableAttributesCookie struct { +// GetBooleanvCookie is a cookie used only for GetBooleanv requests. +type GetBooleanvCookie struct { *xgb.Cookie } -// 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 { +// 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 'ChangeDrawableAttributes' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GetBooleanv' 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} + cookie := c.NewCookie(true, true) + c.NewRequest(getBooleanvRequest(c, ContextTag, Pname), cookie) + return GetBooleanvCookie{cookie} } -// 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 { +// 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 'ChangeDrawableAttributes' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GetBooleanv' 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} + cookie := c.NewCookie(false, true) + c.NewRequest(getBooleanvRequest(c, ContextTag, Pname), cookie) + return GetBooleanvCookie{cookie} } -// Check returns an error if one occurred for checked requests that are not expecting a reply. -// This cannot be called for requests expecting a reply, nor for unchecked requests. -func (cook ChangeDrawableAttributesCookie) Check() error { - return cook.Cookie.Check() +// GetBooleanvReply represents the data returned from a GetBooleanv request. +type GetBooleanvReply struct { + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply + // padding: 1 bytes + // padding: 4 bytes + N uint32 + Datum bool + // padding: 15 bytes + Data []bool // size: xgb.Pad((int(N) * 1)) } -// Write request to wire for ChangeDrawableAttributes -// 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) +// 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 +} - buf[b] = c.Extensions["GLX"] - b += 1 +// getBooleanvReply reads a byte slice into a GetBooleanvReply value. +func getBooleanvReply(buf []byte) *GetBooleanvReply { + v := new(GetBooleanvReply) + b := 1 // skip reply determinant - buf[b] = 30 // request opcode - b += 1 + b += 1 // padding - xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + v.Sequence = xgb.Get16(buf[b:]) b += 2 - xgb.Put32(buf[b:], uint32(Drawable)) + v.Length = xgb.Get32(buf[b:]) // 4-byte units b += 4 - xgb.Put32(buf[b:], NumAttribs) + b += 4 // padding + + v.N = xgb.Get32(buf[b:]) b += 4 - for i := 0; i < int((int(NumAttribs) * 2)); i++ { - xgb.Put32(buf[b:], Attribs[i]) - b += 4 + if buf[b] == 1 { + v.Datum = true + } else { + v.Datum = false } - b = xgb.Pad(b) - - return buf -} - -// CreateWindowCookie is a cookie used only for CreateWindow requests. -type CreateWindowCookie struct { - *xgb.Cookie -} + b += 1 -// 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} -} + b += 15 // padding -// 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.") + 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 } - cookie := c.NewCookie(true, false) - c.NewRequest(createWindowRequest(c, Screen, Fbconfig, Window, GlxWindow, NumAttribs, Attribs), cookie) - return CreateWindowCookie{cookie} -} + b = xgb.Pad(b) -// 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() + return v } -// Write request to wire for CreateWindow -// 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)))) +// Write request to wire for GetBooleanv +// 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] = 31 // request opcode + 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:], 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)) + xgb.Put32(buf[b:], uint32(ContextTag)) b += 4 - xgb.Put32(buf[b:], NumAttribs) + xgb.Put32(buf[b:], uint32(Pname)) 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 } -// DeleteWindowCookie is a cookie used only for DeleteWindow requests. -type DeleteWindowCookie struct { +// GetClipPlaneCookie is a cookie used only for GetClipPlane requests. +type GetClipPlaneCookie struct { *xgb.Cookie } -// 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 { +// 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 'DeleteWindow' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GetClipPlane' 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} + cookie := c.NewCookie(true, true) + c.NewRequest(getClipPlaneRequest(c, ContextTag, Plane), cookie) + return GetClipPlaneCookie{cookie} } -// DeleteWindowChecked sends a checked request. -// If an error occurs, it can be retrieved using DeleteWindowCookie.Check() -func DeleteWindowChecked(c *xgb.Conn, Glxwindow Window) DeleteWindowCookie { +// 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 'DeleteWindow' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GetClipPlane' 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} + cookie := c.NewCookie(false, true) + c.NewRequest(getClipPlaneRequest(c, ContextTag, Plane), cookie) + return GetClipPlaneCookie{cookie} } -// Check returns an error if one occurred for checked requests that are not expecting a reply. -// This cannot be called for requests expecting a reply, nor for unchecked requests. -func (cook DeleteWindowCookie) Check() error { - return cook.Cookie.Check() +// GetClipPlaneReply represents the data returned from a GetClipPlane request. +type GetClipPlaneReply struct { + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply + // padding: 1 bytes + // padding: 24 bytes + Data []Float64 // size: xgb.Pad(((int(Length) / 2) * 8)) } -// Write request to wire for DeleteWindow -// 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) +// 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 +} - buf[b] = c.Extensions["GLX"] - b += 1 +// getClipPlaneReply reads a byte slice into a GetClipPlaneReply value. +func getClipPlaneReply(buf []byte) *GetClipPlaneReply { + v := new(GetClipPlaneReply) + b := 1 // skip reply determinant - buf[b] = 32 // request opcode - b += 1 + b += 1 // padding - xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + v.Sequence = xgb.Get16(buf[b:]) b += 2 - xgb.Put32(buf[b:], uint32(Glxwindow)) + v.Length = xgb.Get32(buf[b:]) // 4-byte units b += 4 - return buf -} - -// SetClientInfoARBCookie is a cookie used only for SetClientInfoARB requests. -type SetClientInfoARBCookie struct { - *xgb.Cookie -} - -// SetClientInfoARB sends an unchecked request. -// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. -func SetClientInfoARB(c *xgb.Conn, MajorVersion 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} -} + b += 24 // padding -// 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.") + 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 } - cookie := c.NewCookie(true, false) - c.NewRequest(setClientInfoARBRequest(c, MajorVersion, MinorVersion, NumVersions, GlStrLen, GlxStrLen, GlVersions, GlExtensionString, GlxExtensionString), cookie) - return SetClientInfoARBCookie{cookie} -} + b = xgb.Pad(b) -// 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() + return v } -// Write request to wire for SetClientInfoARB -// setClientInfoARBRequest writes a SetClientInfoARB request to a byte slice. -func setClientInfoARBRequest(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32, NumVersions uint32, GlStrLen uint32, GlxStrLen uint32, GlVersions []uint32, GlExtensionString string, GlxExtensionString string) []byte { - size := xgb.Pad((((24 + xgb.Pad(((int(NumVersions) * 2) * 4))) + xgb.Pad((int(GlStrLen) * 1))) + xgb.Pad((int(GlxStrLen) * 1)))) +// Write request to wire for GetClipPlane +// 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] = 33 // request opcode + 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:], MajorVersion) - b += 4 - - xgb.Put32(buf[b:], MinorVersion) - b += 4 - - xgb.Put32(buf[b:], NumVersions) - b += 4 - - xgb.Put32(buf[b:], GlStrLen) + xgb.Put32(buf[b:], uint32(ContextTag)) b += 4 - xgb.Put32(buf[b:], GlxStrLen) + xgb.Put32(buf[b:], uint32(Plane)) 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 } -// CreateContextAttribsARBCookie is a cookie used only for CreateContextAttribsARB requests. -type CreateContextAttribsARBCookie struct { +// GetColorTableCookie is a cookie used only for GetColorTable requests. +type GetColorTableCookie struct { *xgb.Cookie } -// CreateContextAttribsARB sends an unchecked request. -// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. -func CreateContextAttribsARB(c *xgb.Conn, Context Context, Fbconfig Fbconfig, Screen uint32, ShareList Context, IsDirect bool, NumAttribs uint32, Attribs []uint32) CreateContextAttribsARBCookie { +// 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 'CreateContextAttribsARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GetColorTable' 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} + cookie := c.NewCookie(true, true) + c.NewRequest(getColorTableRequest(c, ContextTag, Target, Format, Type, SwapBytes), cookie) + return GetColorTableCookie{cookie} } -// 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 { +// 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 'CreateContextAttribsARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GetColorTable' 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} + cookie := c.NewCookie(false, true) + c.NewRequest(getColorTableRequest(c, ContextTag, Target, Format, Type, SwapBytes), cookie) + return GetColorTableCookie{cookie} } -// Check returns an error if one occurred for checked requests that are not expecting a reply. -// This cannot be called for requests expecting a reply, nor for unchecked requests. -func (cook CreateContextAttribsARBCookie) Check() error { - return cook.Cookie.Check() +// GetColorTableReply represents the data returned from a GetColorTable request. +type GetColorTableReply struct { + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply + // padding: 1 bytes + // padding: 8 bytes + Width int32 + // padding: 12 bytes + Data []byte // size: xgb.Pad(((int(Length) * 4) * 1)) } -// Write request to wire for CreateContextAttribsARB -// 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)))) +// Reply blocks and returns the reply data for a GetColorTable request. +func (cook GetColorTableCookie) Reply() (*GetColorTableReply, error) { + buf, err := cook.Cookie.Reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return getColorTableReply(buf), nil +} + +// getColorTableReply reads a byte slice into a GetColorTableReply value. +func getColorTableReply(buf []byte) *GetColorTableReply { + v := new(GetColorTableReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = xgb.Get16(buf[b:]) + b += 2 + + v.Length = xgb.Get32(buf[b:]) // 4-byte units + b += 4 + + b += 8 // padding + + v.Width = int32(xgb.Get32(buf[b:])) + b += 4 + + b += 12 // padding + + v.Data = make([]byte, (int(v.Length) * 4)) + copy(v.Data[:(int(v.Length)*4)], buf[b:]) + b += xgb.Pad(int((int(v.Length) * 4))) + + return v +} + +// Write request to wire for GetColorTable +// 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] = 34 // request opcode + 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(Context)) + xgb.Put32(buf[b:], uint32(ContextTag)) b += 4 - xgb.Put32(buf[b:], uint32(Fbconfig)) + xgb.Put32(buf[b:], Target) b += 4 - xgb.Put32(buf[b:], Screen) + xgb.Put32(buf[b:], Format) b += 4 - xgb.Put32(buf[b:], uint32(ShareList)) + xgb.Put32(buf[b:], Type) b += 4 - if IsDirect { + if SwapBytes { 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 } -// SetClientInfo2ARBCookie is a cookie used only for SetClientInfo2ARB requests. -type SetClientInfo2ARBCookie struct { +// GetColorTableParameterfvCookie is a cookie used only for GetColorTableParameterfv requests. +type GetColorTableParameterfvCookie struct { *xgb.Cookie } -// 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 { +// 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 'SetClientInfo2ARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GetColorTableParameterfv' 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} + cookie := c.NewCookie(true, true) + c.NewRequest(getColorTableParameterfvRequest(c, ContextTag, Target, Pname), cookie) + return GetColorTableParameterfvCookie{cookie} } -// 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 { +// 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 'SetClientInfo2ARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GetColorTableParameterfv' 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} + cookie := c.NewCookie(false, true) + c.NewRequest(getColorTableParameterfvRequest(c, ContextTag, Target, Pname), cookie) + return GetColorTableParameterfvCookie{cookie} } -// Check returns an error if one occurred for checked requests that are not expecting a reply. -// This cannot be called for requests expecting a reply, nor for unchecked requests. -func (cook SetClientInfo2ARBCookie) Check() error { - return cook.Cookie.Check() +// GetColorTableParameterfvReply represents the data returned from a GetColorTableParameterfv request. +type GetColorTableParameterfvReply struct { + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply + // padding: 1 bytes + // padding: 4 bytes + N uint32 + Datum Float32 + // padding: 12 bytes + Data []Float32 // size: xgb.Pad((int(N) * 4)) } -// Write request to wire for SetClientInfo2ARB -// setClientInfo2ARBRequest writes a SetClientInfo2ARB request to a byte slice. -func setClientInfo2ARBRequest(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32, NumVersions uint32, GlStrLen uint32, GlxStrLen uint32, GlVersions []uint32, GlExtensionString string, GlxExtensionString string) []byte { - size := xgb.Pad((((24 + xgb.Pad(((int(NumVersions) * 3) * 4))) + xgb.Pad((int(GlStrLen) * 1))) + xgb.Pad((int(GlxStrLen) * 1)))) - b := 0 - buf := make([]byte, size) +// 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 +} - buf[b] = c.Extensions["GLX"] - b += 1 +// getColorTableParameterfvReply reads a byte slice into a GetColorTableParameterfvReply value. +func getColorTableParameterfvReply(buf []byte) *GetColorTableParameterfvReply { + v := new(GetColorTableParameterfvReply) + b := 1 // skip reply determinant - buf[b] = 35 // request opcode - b += 1 + b += 1 // padding - xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + v.Sequence = xgb.Get16(buf[b:]) b += 2 - xgb.Put32(buf[b:], MajorVersion) + v.Length = xgb.Get32(buf[b:]) // 4-byte units b += 4 - xgb.Put32(buf[b:], MinorVersion) - b += 4 + b += 4 // padding - xgb.Put32(buf[b:], NumVersions) + v.N = xgb.Get32(buf[b:]) b += 4 - xgb.Put32(buf[b:], GlStrLen) + v.Datum = Float32(xgb.Get32(buf[b:])) b += 4 - xgb.Put32(buf[b:], GlxStrLen) - b += 4 + b += 12 // padding - for i := 0; i < int((int(NumVersions) * 3)); i++ { - xgb.Put32(buf[b:], GlVersions[i]) + 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) - copy(buf[b:], GlExtensionString[:GlStrLen]) - b += xgb.Pad(int(GlStrLen)) - - copy(buf[b:], GlxExtensionString[:GlxStrLen]) - b += xgb.Pad(int(GlxStrLen)) - - return buf -} - -// NewListCookie is a cookie used only for NewList requests. -type NewListCookie struct { - *xgb.Cookie -} - -// NewList sends an unchecked request. -// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. -func NewList(c *xgb.Conn, ContextTag ContextTag, List 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} -} - -// 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} -} - -// 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() + return v } -// Write request to wire for NewList -// newListRequest writes a NewList request to a byte slice. -func newListRequest(c *xgb.Conn, ContextTag ContextTag, List uint32, Mode uint32) []byte { +// Write request to wire for GetColorTableParameterfv +// 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) @@ -3605,7 +3153,7 @@ func newListRequest(c *xgb.Conn, ContextTag ContextTag, List uint32, Mode uint32 buf[b] = c.Extensions["GLX"] b += 1 - buf[b] = 101 // request opcode + buf[b] = 148 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units @@ -3614,106 +3162,102 @@ func newListRequest(c *xgb.Conn, ContextTag ContextTag, List uint32, Mode uint32 xgb.Put32(buf[b:], uint32(ContextTag)) b += 4 - xgb.Put32(buf[b:], List) + xgb.Put32(buf[b:], Target) b += 4 - xgb.Put32(buf[b:], Mode) + xgb.Put32(buf[b:], Pname) b += 4 return buf } -// EndListCookie is a cookie used only for EndList requests. -type EndListCookie struct { +// GetColorTableParameterivCookie is a cookie used only for GetColorTableParameteriv requests. +type GetColorTableParameterivCookie struct { *xgb.Cookie } -// 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 { +// 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 'EndList' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GetColorTableParameteriv' 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} + cookie := c.NewCookie(true, true) + c.NewRequest(getColorTableParameterivRequest(c, ContextTag, Target, Pname), cookie) + return GetColorTableParameterivCookie{cookie} } -// EndListChecked sends a checked request. -// If an error occurs, it can be retrieved using EndListCookie.Check() -func EndListChecked(c *xgb.Conn, ContextTag ContextTag) EndListCookie { +// 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 'EndList' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GetColorTableParameteriv' 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} + cookie := c.NewCookie(false, true) + c.NewRequest(getColorTableParameterivRequest(c, ContextTag, Target, Pname), cookie) + return GetColorTableParameterivCookie{cookie} } -// Check returns an error if one occurred for checked requests that are not expecting a reply. -// This cannot be called for requests expecting a reply, nor for unchecked requests. -func (cook EndListCookie) Check() error { - return cook.Cookie.Check() +// GetColorTableParameterivReply represents the data returned from a GetColorTableParameteriv request. +type GetColorTableParameterivReply struct { + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply + // padding: 1 bytes + // padding: 4 bytes + N uint32 + Datum int32 + // padding: 12 bytes + Data []int32 // size: xgb.Pad((int(N) * 4)) } -// Write request to wire for EndList -// 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) +// 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 +} - buf[b] = c.Extensions["GLX"] - b += 1 +// getColorTableParameterivReply reads a byte slice into a GetColorTableParameterivReply value. +func getColorTableParameterivReply(buf []byte) *GetColorTableParameterivReply { + v := new(GetColorTableParameterivReply) + b := 1 // skip reply determinant - buf[b] = 102 // request opcode - b += 1 + b += 1 // padding - xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + v.Sequence = xgb.Get16(buf[b:]) b += 2 - xgb.Put32(buf[b:], uint32(ContextTag)) + v.Length = xgb.Get32(buf[b:]) // 4-byte units b += 4 - return buf -} + b += 4 // padding -// DeleteListsCookie is a cookie used only for DeleteLists requests. -type DeleteListsCookie struct { - *xgb.Cookie -} + v.N = xgb.Get32(buf[b:]) + b += 4 -// 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} -} + v.Datum = int32(xgb.Get32(buf[b:])) + b += 4 -// 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.") + 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 } - cookie := c.NewCookie(true, false) - c.NewRequest(deleteListsRequest(c, ContextTag, List, Range), cookie) - return DeleteListsCookie{cookie} -} + b = xgb.Pad(b) -// 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() + return v } -// Write request to wire for DeleteLists -// deleteListsRequest writes a DeleteLists request to a byte slice. -func deleteListsRequest(c *xgb.Conn, ContextTag ContextTag, List uint32, Range int32) []byte { +// Write request to wire for GetColorTableParameteriv +// 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) @@ -3721,7 +3265,7 @@ func deleteListsRequest(c *xgb.Conn, ContextTag ContextTag, List uint32, Range i buf[b] = c.Extensions["GLX"] b += 1 - buf[b] = 103 // request opcode + buf[b] = 149 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units @@ -3730,52 +3274,55 @@ func deleteListsRequest(c *xgb.Conn, ContextTag ContextTag, List uint32, Range i xgb.Put32(buf[b:], uint32(ContextTag)) b += 4 - xgb.Put32(buf[b:], List) + xgb.Put32(buf[b:], Target) b += 4 - xgb.Put32(buf[b:], uint32(Range)) + xgb.Put32(buf[b:], Pname) b += 4 return buf } -// GenListsCookie is a cookie used only for GenLists requests. -type GenListsCookie struct { +// GetCompressedTexImageARBCookie is a cookie used only for GetCompressedTexImageARB requests. +type GetCompressedTexImageARBCookie struct { *xgb.Cookie } -// 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 { +// 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 'GenLists' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GetCompressedTexImageARB' 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} + c.NewRequest(getCompressedTexImageARBRequest(c, ContextTag, Target, Level), cookie) + return GetCompressedTexImageARBCookie{cookie} } -// GenListsUnchecked sends an unchecked request. +// GetCompressedTexImageARBUnchecked 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 { +func GetCompressedTexImageARBUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32) GetCompressedTexImageARBCookie { if _, ok := c.Extensions["GLX"]; !ok { - panic("Cannot issue request 'GenLists' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GetCompressedTexImageARB' 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} + c.NewRequest(getCompressedTexImageARBRequest(c, ContextTag, Target, Level), cookie) + return GetCompressedTexImageARBCookie{cookie} } -// GenListsReply represents the data returned from a GenLists request. -type GenListsReply struct { +// GetCompressedTexImageARBReply represents the data returned from a GetCompressedTexImageARB request. +type GetCompressedTexImageARBReply struct { Sequence uint16 // sequence number of the request for this reply Length uint32 // number of bytes in this reply // padding: 1 bytes - RetVal uint32 + // padding: 8 bytes + Size int32 + // padding: 12 bytes + Data []byte // size: xgb.Pad(((int(Length) * 4) * 1)) } -// Reply blocks and returns the reply data for a GenLists request. -func (cook GenListsCookie) Reply() (*GenListsReply, error) { +// 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 @@ -3783,12 +3330,12 @@ func (cook GenListsCookie) Reply() (*GenListsReply, error) { if buf == nil { return nil, nil } - return genListsReply(buf), nil + return getCompressedTexImageARBReply(buf), nil } -// genListsReply reads a byte slice into a GenListsReply value. -func genListsReply(buf []byte) *GenListsReply { - v := new(GenListsReply) +// 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 @@ -3799,23 +3346,31 @@ func genListsReply(buf []byte) *GenListsReply { v.Length = xgb.Get32(buf[b:]) // 4-byte units b += 4 - v.RetVal = xgb.Get32(buf[b:]) + 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 GenLists -// genListsRequest writes a GenLists request to a byte slice. -func genListsRequest(c *xgb.Conn, ContextTag ContextTag, Range int32) []byte { - size := 12 +// Write request to wire for GetCompressedTexImageARB +// 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] = 104 // request opcode + buf[b] = 160 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units @@ -3824,117 +3379,107 @@ func genListsRequest(c *xgb.Conn, ContextTag ContextTag, Range int32) []byte { xgb.Put32(buf[b:], uint32(ContextTag)) b += 4 - xgb.Put32(buf[b:], uint32(Range)) + xgb.Put32(buf[b:], Target) + b += 4 + + xgb.Put32(buf[b:], uint32(Level)) b += 4 return buf } -// FeedbackBufferCookie is a cookie used only for FeedbackBuffer requests. -type FeedbackBufferCookie struct { +// GetConvolutionFilterCookie is a cookie used only for GetConvolutionFilter requests. +type GetConvolutionFilterCookie struct { *xgb.Cookie } -// 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 { +// 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 'FeedbackBuffer' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GetConvolutionFilter' 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} + cookie := c.NewCookie(true, true) + c.NewRequest(getConvolutionFilterRequest(c, ContextTag, Target, Format, Type, SwapBytes), cookie) + return GetConvolutionFilterCookie{cookie} } -// 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 { +// 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 'FeedbackBuffer' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GetConvolutionFilter' 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} + cookie := c.NewCookie(false, true) + c.NewRequest(getConvolutionFilterRequest(c, ContextTag, Target, Format, Type, SwapBytes), cookie) + return GetConvolutionFilterCookie{cookie} } -// Check returns an error if one occurred for checked requests that are not expecting a reply. -// This cannot be called for requests expecting a reply, nor for unchecked requests. -func (cook FeedbackBufferCookie) Check() error { - return cook.Cookie.Check() +// GetConvolutionFilterReply represents the data returned from a GetConvolutionFilter request. +type GetConvolutionFilterReply struct { + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply + // padding: 1 bytes + // padding: 8 bytes + Width int32 + Height int32 + // padding: 8 bytes + Data []byte // size: xgb.Pad(((int(Length) * 4) * 1)) } -// Write request to wire for FeedbackBuffer -// 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) +// 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 +} - buf[b] = c.Extensions["GLX"] - b += 1 +// getConvolutionFilterReply reads a byte slice into a GetConvolutionFilterReply value. +func getConvolutionFilterReply(buf []byte) *GetConvolutionFilterReply { + v := new(GetConvolutionFilterReply) + b := 1 // skip reply determinant - buf[b] = 105 // request opcode - b += 1 + b += 1 // padding - xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + v.Sequence = xgb.Get16(buf[b:]) b += 2 - xgb.Put32(buf[b:], uint32(ContextTag)) + v.Length = xgb.Get32(buf[b:]) // 4-byte units b += 4 - xgb.Put32(buf[b:], uint32(Size)) - b += 4 + b += 8 // padding - xgb.Put32(buf[b:], uint32(Type)) + v.Width = int32(xgb.Get32(buf[b:])) b += 4 - return buf -} - -// SelectBufferCookie is a cookie used only for SelectBuffer requests. -type SelectBufferCookie struct { - *xgb.Cookie -} + v.Height = int32(xgb.Get32(buf[b:])) + b += 4 -// 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} -} + b += 8 // padding -// 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} -} + 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))) -// 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() + return v } -// Write request to wire for SelectBuffer -// selectBufferRequest writes a SelectBuffer request to a byte slice. -func selectBufferRequest(c *xgb.Conn, ContextTag ContextTag, Size int32) []byte { - size := 12 +// Write request to wire for GetConvolutionFilter +// 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] = 106 // request opcode + buf[b] = 150 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units @@ -3943,53 +3488,66 @@ func selectBufferRequest(c *xgb.Conn, ContextTag ContextTag, Size int32) []byte xgb.Put32(buf[b:], uint32(ContextTag)) b += 4 - xgb.Put32(buf[b:], uint32(Size)) + 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 } -// RenderModeCookie is a cookie used only for RenderMode requests. -type RenderModeCookie struct { +// GetConvolutionParameterfvCookie is a cookie used only for GetConvolutionParameterfv requests. +type GetConvolutionParameterfvCookie struct { *xgb.Cookie } -// 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 { +// 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 'RenderMode' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GetConvolutionParameterfv' 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} + c.NewRequest(getConvolutionParameterfvRequest(c, ContextTag, Target, Pname), cookie) + return GetConvolutionParameterfvCookie{cookie} } -// RenderModeUnchecked sends an unchecked request. +// GetConvolutionParameterfvUnchecked 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 { +func GetConvolutionParameterfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetConvolutionParameterfvCookie { if _, ok := c.Extensions["GLX"]; !ok { - panic("Cannot issue request 'RenderMode' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GetConvolutionParameterfv' 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} + c.NewRequest(getConvolutionParameterfvRequest(c, ContextTag, Target, Pname), cookie) + return GetConvolutionParameterfvCookie{cookie} } -// RenderModeReply represents the data returned from a RenderMode request. -type RenderModeReply struct { +// GetConvolutionParameterfvReply represents the data returned from a GetConvolutionParameterfv request. +type GetConvolutionParameterfvReply struct { Sequence uint16 // sequence number of the request for this reply Length uint32 // number of bytes in this reply // padding: 1 bytes - RetVal uint32 - N uint32 - NewMode uint32 + // padding: 4 bytes + N uint32 + Datum Float32 // padding: 12 bytes - Data []uint32 // size: xgb.Pad((int(N) * 4)) + Data []Float32 // size: xgb.Pad((int(N) * 4)) } -// Reply blocks and returns the reply data for a RenderMode request. -func (cook RenderModeCookie) Reply() (*RenderModeReply, error) { +// 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 @@ -3997,12 +3555,12 @@ func (cook RenderModeCookie) Reply() (*RenderModeReply, error) { if buf == nil { return nil, nil } - return renderModeReply(buf), nil + return getConvolutionParameterfvReply(buf), nil } -// renderModeReply reads a byte slice into a RenderModeReply value. -func renderModeReply(buf []byte) *RenderModeReply { - v := new(RenderModeReply) +// 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 @@ -4013,20 +3571,19 @@ func renderModeReply(buf []byte) *RenderModeReply { v.Length = xgb.Get32(buf[b:]) // 4-byte units b += 4 - v.RetVal = xgb.Get32(buf[b:]) - b += 4 + b += 4 // padding v.N = xgb.Get32(buf[b:]) b += 4 - v.NewMode = xgb.Get32(buf[b:]) + v.Datum = Float32(xgb.Get32(buf[b:])) b += 4 b += 12 // padding - v.Data = make([]uint32, v.N) + v.Data = make([]Float32, v.N) for i := 0; i < int(v.N); i++ { - v.Data[i] = xgb.Get32(buf[b:]) + v.Data[i] = Float32(xgb.Get32(buf[b:])) b += 4 } b = xgb.Pad(b) @@ -4034,17 +3591,17 @@ func renderModeReply(buf []byte) *RenderModeReply { return v } -// Write request to wire for RenderMode -// renderModeRequest writes a RenderMode request to a byte slice. -func renderModeRequest(c *xgb.Conn, ContextTag ContextTag, Mode uint32) []byte { - size := 12 +// Write request to wire for GetConvolutionParameterfv +// 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] = 107 // request opcode + buf[b] = 151 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units @@ -4053,48 +3610,56 @@ func renderModeRequest(c *xgb.Conn, ContextTag ContextTag, Mode uint32) []byte { xgb.Put32(buf[b:], uint32(ContextTag)) b += 4 - xgb.Put32(buf[b:], Mode) + xgb.Put32(buf[b:], Target) + b += 4 + + xgb.Put32(buf[b:], Pname) b += 4 return buf } -// FinishCookie is a cookie used only for Finish requests. -type FinishCookie struct { +// GetConvolutionParameterivCookie is a cookie used only for GetConvolutionParameteriv requests. +type GetConvolutionParameterivCookie struct { *xgb.Cookie } -// 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 { +// 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 'Finish' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GetConvolutionParameteriv' 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} + c.NewRequest(getConvolutionParameterivRequest(c, ContextTag, Target, Pname), cookie) + return GetConvolutionParameterivCookie{cookie} } -// FinishUnchecked sends an unchecked request. +// GetConvolutionParameterivUnchecked 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 { +func GetConvolutionParameterivUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetConvolutionParameterivCookie { if _, ok := c.Extensions["GLX"]; !ok { - panic("Cannot issue request 'Finish' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GetConvolutionParameteriv' 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} + c.NewRequest(getConvolutionParameterivRequest(c, ContextTag, Target, Pname), cookie) + return GetConvolutionParameterivCookie{cookie} } -// FinishReply represents the data returned from a Finish request. -type FinishReply struct { +// GetConvolutionParameterivReply represents the data returned from a GetConvolutionParameteriv request. +type GetConvolutionParameterivReply struct { Sequence uint16 // sequence number of the request for this reply Length uint32 // number of bytes in this reply // padding: 1 bytes + // padding: 4 bytes + N uint32 + Datum int32 + // padding: 12 bytes + Data []int32 // size: xgb.Pad((int(N) * 4)) } -// Reply blocks and returns the reply data for a Finish request. -func (cook FinishCookie) Reply() (*FinishReply, error) { +// 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 @@ -4102,12 +3667,12 @@ func (cook FinishCookie) Reply() (*FinishReply, error) { if buf == nil { return nil, nil } - return finishReply(buf), nil + return getConvolutionParameterivReply(buf), nil } -// finishReply reads a byte slice into a FinishReply value. -func finishReply(buf []byte) *FinishReply { - v := new(FinishReply) +// 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 @@ -4118,20 +3683,37 @@ func finishReply(buf []byte) *FinishReply { 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 Finish -// finishRequest writes a Finish request to a byte slice. -func finishRequest(c *xgb.Conn, ContextTag ContextTag) []byte { - size := 8 +// Write request to wire for GetConvolutionParameteriv +// 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] = 108 // request opcode + buf[b] = 152 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units @@ -4140,53 +3722,110 @@ func finishRequest(c *xgb.Conn, ContextTag ContextTag) []byte { xgb.Put32(buf[b:], uint32(ContextTag)) b += 4 + xgb.Put32(buf[b:], Target) + b += 4 + + xgb.Put32(buf[b:], Pname) + b += 4 + return buf } -// PixelStorefCookie is a cookie used only for PixelStoref requests. -type PixelStorefCookie struct { +// GetDoublevCookie is a cookie used only for GetDoublev requests. +type GetDoublevCookie struct { *xgb.Cookie } -// 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 { +// 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 'PixelStoref' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GetDoublev' 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} + cookie := c.NewCookie(true, true) + c.NewRequest(getDoublevRequest(c, ContextTag, Pname), cookie) + return GetDoublevCookie{cookie} } -// 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 { +// 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 'PixelStoref' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GetDoublev' 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} + cookie := c.NewCookie(false, true) + c.NewRequest(getDoublevRequest(c, ContextTag, Pname), cookie) + return GetDoublevCookie{cookie} } -// Check returns an error if one occurred for checked requests that are not expecting a reply. -// This cannot be called for requests expecting a reply, nor for unchecked requests. -func (cook PixelStorefCookie) Check() error { - return cook.Cookie.Check() +// GetDoublevReply represents the data returned from a GetDoublev request. +type GetDoublevReply struct { + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply + // padding: 1 bytes + // padding: 4 bytes + N uint32 + Datum Float64 + // padding: 8 bytes + Data []Float64 // size: xgb.Pad((int(N) * 8)) } -// Write request to wire for PixelStoref -// pixelStorefRequest writes a PixelStoref request to a byte slice. -func pixelStorefRequest(c *xgb.Conn, ContextTag ContextTag, Pname uint32, Datum Float32) []byte { - size := 16 +// Reply blocks and returns the reply data for a GetDoublev request. +func (cook GetDoublevCookie) Reply() (*GetDoublevReply, error) { + buf, err := cook.Cookie.Reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return getDoublevReply(buf), nil +} + +// getDoublevReply reads a byte slice into a GetDoublevReply value. +func getDoublevReply(buf []byte) *GetDoublevReply { + v := new(GetDoublevReply) + b := 1 // skip reply determinant + + 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 +// 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] = 109 // request opcode + buf[b] = 114 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units @@ -4198,111 +3837,145 @@ func pixelStorefRequest(c *xgb.Conn, ContextTag ContextTag, Pname uint32, Datum xgb.Put32(buf[b:], Pname) b += 4 - xgb.Put32(buf[b:], uint32(Datum)) - b += 4 - return buf } -// PixelStoreiCookie is a cookie used only for PixelStorei requests. -type PixelStoreiCookie struct { +// GetDrawableAttributesCookie is a cookie used only for GetDrawableAttributes requests. +type GetDrawableAttributesCookie struct { *xgb.Cookie } -// PixelStorei sends an unchecked request. -// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. -func PixelStorei(c *xgb.Conn, ContextTag ContextTag, Pname uint32, Datum int32) PixelStoreiCookie { +// 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 'PixelStorei' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GetDrawableAttributes' 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} + cookie := c.NewCookie(true, true) + c.NewRequest(getDrawableAttributesRequest(c, Drawable), cookie) + return GetDrawableAttributesCookie{cookie} } -// 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 { +// 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 'PixelStorei' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GetDrawableAttributes' 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} + cookie := c.NewCookie(false, true) + c.NewRequest(getDrawableAttributesRequest(c, Drawable), cookie) + return GetDrawableAttributesCookie{cookie} } -// Check returns an error if one occurred for checked requests that are not expecting a reply. -// This cannot be called for requests expecting a reply, nor for unchecked requests. -func (cook PixelStoreiCookie) Check() error { - return cook.Cookie.Check() +// GetDrawableAttributesReply represents the data returned from a GetDrawableAttributes request. +type GetDrawableAttributesReply struct { + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply + // padding: 1 bytes + NumAttribs uint32 + // padding: 20 bytes + Attribs []uint32 // size: xgb.Pad(((int(NumAttribs) * 2) * 4)) } -// Write request to wire for PixelStorei -// pixelStoreiRequest writes a PixelStorei request to a byte slice. -func pixelStoreiRequest(c *xgb.Conn, ContextTag ContextTag, Pname uint32, Datum int32) []byte { - size := 16 +// 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 +} + +// 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 +// 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] = 110 // request opcode + 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(ContextTag)) - b += 4 - - xgb.Put32(buf[b:], Pname) - b += 4 - - xgb.Put32(buf[b:], uint32(Datum)) + xgb.Put32(buf[b:], uint32(Drawable)) b += 4 return buf } -// ReadPixelsCookie is a cookie used only for ReadPixels requests. -type ReadPixelsCookie struct { +// GetErrorCookie is a cookie used only for GetError requests. +type GetErrorCookie struct { *xgb.Cookie } -// 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 { +// 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 'ReadPixels' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GetError' 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} + c.NewRequest(getErrorRequest(c, ContextTag), cookie) + return GetErrorCookie{cookie} } -// ReadPixelsUnchecked sends an unchecked request. +// GetErrorUnchecked 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 { +func GetErrorUnchecked(c *xgb.Conn, ContextTag ContextTag) GetErrorCookie { if _, ok := c.Extensions["GLX"]; !ok { - panic("Cannot issue request 'ReadPixels' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GetError' 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} + c.NewRequest(getErrorRequest(c, ContextTag), cookie) + return GetErrorCookie{cookie} } -// ReadPixelsReply represents the data returned from a ReadPixels request. -type ReadPixelsReply struct { +// GetErrorReply represents the data returned from a GetError request. +type GetErrorReply struct { Sequence uint16 // sequence number of the request for this reply Length uint32 // number of bytes in this reply // padding: 1 bytes - // padding: 24 bytes - Data []byte // size: xgb.Pad(((int(Length) * 4) * 1)) + Error int32 } -// Reply blocks and returns the reply data for a ReadPixels request. -func (cook ReadPixelsCookie) Reply() (*ReadPixelsReply, error) { +// 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 @@ -4310,12 +3983,12 @@ func (cook ReadPixelsCookie) Reply() (*ReadPixelsReply, error) { if buf == nil { return nil, nil } - return readPixelsReply(buf), nil + return getErrorReply(buf), nil } -// readPixelsReply reads a byte slice into a ReadPixelsReply value. -func readPixelsReply(buf []byte) *ReadPixelsReply { - v := new(ReadPixelsReply) +// 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 @@ -4326,26 +3999,23 @@ func readPixelsReply(buf []byte) *ReadPixelsReply { 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))) + v.Error = int32(xgb.Get32(buf[b:])) + b += 4 return v } -// Write request to wire for ReadPixels -// 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 +// Write request to wire for GetError +// 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] = 111 // request opcode + buf[b] = 115 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units @@ -4354,82 +4024,49 @@ func readPixelsRequest(c *xgb.Conn, ContextTag ContextTag, X int32, Y int32, Wid 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 } -// GetBooleanvCookie is a cookie used only for GetBooleanv requests. -type GetBooleanvCookie struct { +// GetFBConfigsCookie is a cookie used only for GetFBConfigs requests. +type GetFBConfigsCookie struct { *xgb.Cookie } -// 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 { +// 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 'GetBooleanv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GetFBConfigs' 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} + c.NewRequest(getFBConfigsRequest(c, Screen), cookie) + return GetFBConfigsCookie{cookie} } -// GetBooleanvUnchecked sends an unchecked request. +// GetFBConfigsUnchecked 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 { +func GetFBConfigsUnchecked(c *xgb.Conn, Screen uint32) GetFBConfigsCookie { if _, ok := c.Extensions["GLX"]; !ok { - panic("Cannot issue request 'GetBooleanv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GetFBConfigs' 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} + c.NewRequest(getFBConfigsRequest(c, Screen), cookie) + return GetFBConfigsCookie{cookie} } -// GetBooleanvReply represents the data returned from a GetBooleanv request. -type GetBooleanvReply struct { +// GetFBConfigsReply represents the data returned from a GetFBConfigs request. +type GetFBConfigsReply struct { Sequence uint16 // sequence number of the request for this reply Length uint32 // number of bytes in this reply // padding: 1 bytes - // padding: 4 bytes - N uint32 - Datum bool - // padding: 15 bytes - Data []bool // size: xgb.Pad((int(N) * 1)) + NumFbConfigs uint32 + NumProperties uint32 + // padding: 16 bytes + PropertyList []uint32 // size: xgb.Pad((int(Length) * 4)) } -// Reply blocks and returns the reply data for a GetBooleanv request. -func (cook GetBooleanvCookie) Reply() (*GetBooleanvReply, error) { +// 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 @@ -4437,12 +4074,12 @@ func (cook GetBooleanvCookie) Reply() (*GetBooleanvReply, error) { if buf == nil { return nil, nil } - return getBooleanvReply(buf), nil + return getFBConfigsReply(buf), nil } -// getBooleanvReply reads a byte slice into a GetBooleanvReply value. -func getBooleanvReply(buf []byte) *GetBooleanvReply { - v := new(GetBooleanvReply) +// 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 @@ -4453,97 +4090,87 @@ func getBooleanvReply(buf []byte) *GetBooleanvReply { v.Length = xgb.Get32(buf[b:]) // 4-byte units b += 4 - b += 4 // padding - - v.N = xgb.Get32(buf[b:]) + v.NumFbConfigs = xgb.Get32(buf[b:]) b += 4 - if buf[b] == 1 { - v.Datum = true - } else { - v.Datum = false - } - b += 1 + v.NumProperties = xgb.Get32(buf[b:]) + b += 4 - b += 15 // padding + b += 16 // 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 + 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 GetBooleanv -// getBooleanvRequest writes a GetBooleanv request to a byte slice. -func getBooleanvRequest(c *xgb.Conn, ContextTag ContextTag, Pname int32) []byte { - size := 12 +// Write request to wire for GetFBConfigs +// 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] = 112 // request opcode + 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:], uint32(ContextTag)) - b += 4 - - xgb.Put32(buf[b:], uint32(Pname)) + xgb.Put32(buf[b:], Screen) b += 4 return buf } -// GetClipPlaneCookie is a cookie used only for GetClipPlane requests. -type GetClipPlaneCookie struct { +// GetFloatvCookie is a cookie used only for GetFloatv requests. +type GetFloatvCookie struct { *xgb.Cookie } -// 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 { +// 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 'GetClipPlane' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GetFloatv' 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} + c.NewRequest(getFloatvRequest(c, ContextTag, Pname), cookie) + return GetFloatvCookie{cookie} } -// GetClipPlaneUnchecked sends an unchecked request. +// GetFloatvUnchecked 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 { +func GetFloatvUnchecked(c *xgb.Conn, ContextTag ContextTag, Pname uint32) GetFloatvCookie { if _, ok := c.Extensions["GLX"]; !ok { - panic("Cannot issue request 'GetClipPlane' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GetFloatv' 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} + c.NewRequest(getFloatvRequest(c, ContextTag, Pname), cookie) + return GetFloatvCookie{cookie} } -// GetClipPlaneReply represents the data returned from a GetClipPlane request. -type GetClipPlaneReply struct { +// GetFloatvReply represents the data returned from a GetFloatv request. +type GetFloatvReply struct { Sequence uint16 // sequence number of the request for this reply Length uint32 // number of bytes in this reply // padding: 1 bytes - // padding: 24 bytes - Data []Float64 // size: xgb.Pad(((int(Length) / 2) * 8)) + // padding: 4 bytes + N uint32 + Datum Float32 + // padding: 12 bytes + Data []Float32 // size: xgb.Pad((int(N) * 4)) } -// Reply blocks and returns the reply data for a GetClipPlane request. -func (cook GetClipPlaneCookie) Reply() (*GetClipPlaneReply, error) { +// 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 @@ -4551,12 +4178,12 @@ func (cook GetClipPlaneCookie) Reply() (*GetClipPlaneReply, error) { if buf == nil { return nil, nil } - return getClipPlaneReply(buf), nil + return getFloatvReply(buf), nil } -// getClipPlaneReply reads a byte slice into a GetClipPlaneReply value. -func getClipPlaneReply(buf []byte) *GetClipPlaneReply { - v := new(GetClipPlaneReply) +// 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 @@ -4567,21 +4194,29 @@ func getClipPlaneReply(buf []byte) *GetClipPlaneReply { v.Length = xgb.Get32(buf[b:]) // 4-byte units b += 4 - b += 24 // padding + b += 4 // 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 + 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 GetClipPlane -// getClipPlaneRequest writes a GetClipPlane request to a byte slice. -func getClipPlaneRequest(c *xgb.Conn, ContextTag ContextTag, Plane int32) []byte { +// Write request to wire for GetFloatv +// 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) @@ -4589,7 +4224,7 @@ func getClipPlaneRequest(c *xgb.Conn, ContextTag ContextTag, Plane int32) []byte buf[b] = c.Extensions["GLX"] b += 1 - buf[b] = 113 // request opcode + buf[b] = 116 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units @@ -4598,53 +4233,52 @@ func getClipPlaneRequest(c *xgb.Conn, ContextTag ContextTag, Plane int32) []byte xgb.Put32(buf[b:], uint32(ContextTag)) b += 4 - xgb.Put32(buf[b:], uint32(Plane)) + xgb.Put32(buf[b:], Pname) b += 4 return buf } -// GetDoublevCookie is a cookie used only for GetDoublev requests. -type GetDoublevCookie struct { +// GetHistogramCookie is a cookie used only for GetHistogram requests. +type GetHistogramCookie struct { *xgb.Cookie } -// 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 { +// 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 'GetDoublev' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GetHistogram' 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} + c.NewRequest(getHistogramRequest(c, ContextTag, Target, Format, Type, SwapBytes, Reset), cookie) + return GetHistogramCookie{cookie} } -// GetDoublevUnchecked sends an unchecked request. +// GetHistogramUnchecked 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 { +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 'GetDoublev' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GetHistogram' 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} + c.NewRequest(getHistogramRequest(c, ContextTag, Target, Format, Type, SwapBytes, Reset), cookie) + return GetHistogramCookie{cookie} } -// GetDoublevReply represents the data returned from a GetDoublev request. -type GetDoublevReply struct { +// GetHistogramReply represents the data returned from a GetHistogram request. +type GetHistogramReply struct { Sequence uint16 // sequence number of the request for this reply Length uint32 // number of bytes in this reply // padding: 1 bytes - // padding: 4 bytes - N uint32 - Datum Float64 // padding: 8 bytes - Data []Float64 // size: xgb.Pad((int(N) * 8)) + Width int32 + // padding: 12 bytes + Data []byte // size: xgb.Pad(((int(Length) * 4) * 1)) } -// Reply blocks and returns the reply data for a GetDoublev request. -func (cook GetDoublevCookie) Reply() (*GetDoublevReply, error) { +// 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 @@ -4652,12 +4286,12 @@ func (cook GetDoublevCookie) Reply() (*GetDoublevReply, error) { if buf == nil { return nil, nil } - return getDoublevReply(buf), nil + return getHistogramReply(buf), nil } -// getDoublevReply reads a byte slice into a GetDoublevReply value. -func getDoublevReply(buf []byte) *GetDoublevReply { - v := new(GetDoublevReply) +// 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 @@ -4668,37 +4302,31 @@ func getDoublevReply(buf []byte) *GetDoublevReply { v.Length = xgb.Get32(buf[b:]) // 4-byte units b += 4 - b += 4 // padding + b += 8 // padding - v.N = xgb.Get32(buf[b:]) + v.Width = int32(xgb.Get32(buf[b:])) b += 4 - v.Datum = Float64(xgb.Get64(buf[b:])) - b += 8 - - b += 8 // padding + b += 12 // 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) + 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 GetDoublev -// getDoublevRequest writes a GetDoublev request to a byte slice. -func getDoublevRequest(c *xgb.Conn, ContextTag ContextTag, Pname uint32) []byte { - size := 12 +// Write request to wire for GetHistogram +// 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] = 114 // request opcode + buf[b] = 154 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units @@ -4707,49 +4335,73 @@ func getDoublevRequest(c *xgb.Conn, ContextTag ContextTag, Pname uint32) []byte xgb.Put32(buf[b:], uint32(ContextTag)) b += 4 - xgb.Put32(buf[b:], Pname) + 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 } -// GetErrorCookie is a cookie used only for GetError requests. -type GetErrorCookie struct { +// GetHistogramParameterfvCookie is a cookie used only for GetHistogramParameterfv requests. +type GetHistogramParameterfvCookie struct { *xgb.Cookie } -// 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 { +// 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 'GetError' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GetHistogramParameterfv' 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} + c.NewRequest(getHistogramParameterfvRequest(c, ContextTag, Target, Pname), cookie) + return GetHistogramParameterfvCookie{cookie} } -// GetErrorUnchecked sends an unchecked request. +// GetHistogramParameterfvUnchecked 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 { +func GetHistogramParameterfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetHistogramParameterfvCookie { if _, ok := c.Extensions["GLX"]; !ok { - panic("Cannot issue request 'GetError' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GetHistogramParameterfv' 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} + c.NewRequest(getHistogramParameterfvRequest(c, ContextTag, Target, Pname), cookie) + return GetHistogramParameterfvCookie{cookie} } -// GetErrorReply represents the data returned from a GetError request. -type GetErrorReply struct { +// GetHistogramParameterfvReply represents the data returned from a GetHistogramParameterfv request. +type GetHistogramParameterfvReply struct { Sequence uint16 // sequence number of the request for this reply Length uint32 // number of bytes in this reply // padding: 1 bytes - Error int32 + // padding: 4 bytes + N uint32 + Datum Float32 + // padding: 12 bytes + Data []Float32 // size: xgb.Pad((int(N) * 4)) } -// Reply blocks and returns the reply data for a GetError request. -func (cook GetErrorCookie) Reply() (*GetErrorReply, error) { +// 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 @@ -4757,12 +4409,12 @@ func (cook GetErrorCookie) Reply() (*GetErrorReply, error) { if buf == nil { return nil, nil } - return getErrorReply(buf), nil + return getHistogramParameterfvReply(buf), nil } -// getErrorReply reads a byte slice into a GetErrorReply value. -func getErrorReply(buf []byte) *GetErrorReply { - v := new(GetErrorReply) +// 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 @@ -4773,23 +4425,37 @@ func getErrorReply(buf []byte) *GetErrorReply { v.Length = xgb.Get32(buf[b:]) // 4-byte units b += 4 - v.Error = int32(xgb.Get32(buf[b:])) + 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 GetError -// getErrorRequest writes a GetError request to a byte slice. -func getErrorRequest(c *xgb.Conn, ContextTag ContextTag) []byte { - size := 8 +// Write request to wire for GetHistogramParameterfv +// 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] = 115 // request opcode + buf[b] = 155 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units @@ -4798,50 +4464,56 @@ func getErrorRequest(c *xgb.Conn, ContextTag ContextTag) []byte { xgb.Put32(buf[b:], uint32(ContextTag)) b += 4 + xgb.Put32(buf[b:], Target) + b += 4 + + xgb.Put32(buf[b:], Pname) + b += 4 + return buf } -// GetFloatvCookie is a cookie used only for GetFloatv requests. -type GetFloatvCookie struct { +// GetHistogramParameterivCookie is a cookie used only for GetHistogramParameteriv requests. +type GetHistogramParameterivCookie struct { *xgb.Cookie } -// 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 { +// 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 'GetFloatv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GetHistogramParameteriv' 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} + c.NewRequest(getHistogramParameterivRequest(c, ContextTag, Target, Pname), cookie) + return GetHistogramParameterivCookie{cookie} } -// GetFloatvUnchecked sends an unchecked request. +// GetHistogramParameterivUnchecked 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 { +func GetHistogramParameterivUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetHistogramParameterivCookie { if _, ok := c.Extensions["GLX"]; !ok { - panic("Cannot issue request 'GetFloatv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GetHistogramParameteriv' 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} + c.NewRequest(getHistogramParameterivRequest(c, ContextTag, Target, Pname), cookie) + return GetHistogramParameterivCookie{cookie} } -// GetFloatvReply represents the data returned from a GetFloatv request. -type GetFloatvReply struct { +// GetHistogramParameterivReply represents the data returned from a GetHistogramParameteriv request. +type GetHistogramParameterivReply struct { Sequence uint16 // sequence number of the request for this reply Length uint32 // number of bytes in this reply // padding: 1 bytes // padding: 4 bytes N uint32 - Datum Float32 + Datum int32 // padding: 12 bytes - Data []Float32 // size: xgb.Pad((int(N) * 4)) + Data []int32 // size: xgb.Pad((int(N) * 4)) } -// Reply blocks and returns the reply data for a GetFloatv request. -func (cook GetFloatvCookie) Reply() (*GetFloatvReply, error) { +// 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 @@ -4849,12 +4521,12 @@ func (cook GetFloatvCookie) Reply() (*GetFloatvReply, error) { if buf == nil { return nil, nil } - return getFloatvReply(buf), nil + return getHistogramParameterivReply(buf), nil } -// getFloatvReply reads a byte slice into a GetFloatvReply value. -func getFloatvReply(buf []byte) *GetFloatvReply { - v := new(GetFloatvReply) +// 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 @@ -4870,14 +4542,14 @@ func getFloatvReply(buf []byte) *GetFloatvReply { v.N = xgb.Get32(buf[b:]) b += 4 - v.Datum = Float32(xgb.Get32(buf[b:])) + v.Datum = int32(xgb.Get32(buf[b:])) b += 4 b += 12 // padding - v.Data = make([]Float32, v.N) + v.Data = make([]int32, v.N) for i := 0; i < int(v.N); i++ { - v.Data[i] = Float32(xgb.Get32(buf[b:])) + v.Data[i] = int32(xgb.Get32(buf[b:])) b += 4 } b = xgb.Pad(b) @@ -4885,17 +4557,17 @@ func getFloatvReply(buf []byte) *GetFloatvReply { return v } -// Write request to wire for GetFloatv -// getFloatvRequest writes a GetFloatv request to a byte slice. -func getFloatvRequest(c *xgb.Conn, ContextTag ContextTag, Pname uint32) []byte { - size := 12 +// Write request to wire for GetHistogramParameteriv +// 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] = 116 // request opcode + buf[b] = 156 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units @@ -4904,6 +4576,9 @@ func getFloatvRequest(c *xgb.Conn, ContextTag ContextTag, Pname uint32) []byte { xgb.Put32(buf[b:], uint32(ContextTag)) b += 4 + xgb.Put32(buf[b:], Target) + b += 4 + xgb.Put32(buf[b:], Pname) b += 4 @@ -5803,6 +5478,345 @@ func getMaterialivRequest(c *xgb.Conn, ContextTag ContextTag, Face uint32, Pname return buf } +// GetMinmaxCookie is a cookie used only for GetMinmax requests. +type GetMinmaxCookie struct { + *xgb.Cookie +} + +// 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} +} + +// 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} +} + +// GetMinmaxReply represents the data returned from a GetMinmax request. +type GetMinmaxReply struct { + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply + // padding: 1 bytes + // padding: 24 bytes + Data []byte // size: xgb.Pad(((int(Length) * 4) * 1)) +} + +// 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 +} + +// 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 +// 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 +} + +// GetMinmaxParameterfvCookie is a cookie used only for GetMinmaxParameterfv requests. +type GetMinmaxParameterfvCookie struct { + *xgb.Cookie +} + +// 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} +} + +// 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} +} + +// GetMinmaxParameterfvReply represents the data returned from a GetMinmaxParameterfv request. +type GetMinmaxParameterfvReply struct { + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply + // padding: 1 bytes + // padding: 4 bytes + N uint32 + Datum Float32 + // padding: 12 bytes + Data []Float32 // size: xgb.Pad((int(N) * 4)) +} + +// Reply blocks and returns the reply data for a 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 +} + +// 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 +// 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 +} + +// GetMinmaxParameterivCookie is a cookie used only for GetMinmaxParameteriv requests. +type GetMinmaxParameterivCookie struct { + *xgb.Cookie +} + +// 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} +} + +// 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} +} + +// GetMinmaxParameterivReply represents the data returned from a GetMinmaxParameteriv request. +type GetMinmaxParameterivReply struct { + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply + // padding: 1 bytes + // padding: 4 bytes + N uint32 + Datum int32 + // padding: 12 bytes + Data []int32 // size: xgb.Pad((int(N) * 4)) +} + +// Reply blocks and returns the reply data for a 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 +} + +// 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 +// 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 +} + // GetPixelMapfvCookie is a cookie used only for GetPixelMapfv requests. type GetPixelMapfvCookie struct { *xgb.Cookie @@ -6229,6 +6243,461 @@ func getPolygonStippleRequest(c *xgb.Conn, ContextTag ContextTag, LsbFirst bool) return buf } +// GetQueryObjectivARBCookie is a cookie used only for GetQueryObjectivARB requests. +type GetQueryObjectivARBCookie struct { + *xgb.Cookie +} + +// 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} +} + +// 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} +} + +// GetQueryObjectivARBReply represents the data returned from a GetQueryObjectivARB request. +type GetQueryObjectivARBReply struct { + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply + // padding: 1 bytes + // padding: 4 bytes + N uint32 + Datum int32 + // padding: 12 bytes + Data []int32 // size: xgb.Pad((int(N) * 4)) +} + +// Reply blocks and returns the reply data for a 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 +} + +// 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 +// 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 +} + +// GetQueryObjectuivARBCookie is a cookie used only for GetQueryObjectuivARB requests. +type GetQueryObjectuivARBCookie struct { + *xgb.Cookie +} + +// 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} +} + +// 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} +} + +// GetQueryObjectuivARBReply represents the data returned from a GetQueryObjectuivARB request. +type GetQueryObjectuivARBReply struct { + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply + // padding: 1 bytes + // padding: 4 bytes + N uint32 + Datum uint32 + // padding: 12 bytes + Data []uint32 // size: xgb.Pad((int(N) * 4)) +} + +// 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 +} + +// 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 +// 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 +} + +// GetQueryivARBCookie is a cookie used only for GetQueryivARB requests. +type GetQueryivARBCookie struct { + *xgb.Cookie +} + +// 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} +} + +// 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} +} + +// GetQueryivARBReply represents the data returned from a GetQueryivARB request. +type GetQueryivARBReply struct { + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply + // padding: 1 bytes + // padding: 4 bytes + N uint32 + Datum int32 + // padding: 12 bytes + Data []int32 // size: xgb.Pad((int(N) * 4)) +} + +// Reply blocks and returns the reply data for a 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 +} + +// 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 +// 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 +} + +// GetSeparableFilterCookie is a cookie used only for GetSeparableFilter requests. +type GetSeparableFilterCookie struct { + *xgb.Cookie +} + +// 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} +} + +// 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} +} + +// GetSeparableFilterReply represents the data returned from a GetSeparableFilter request. +type GetSeparableFilterReply struct { + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply + // padding: 1 bytes + // padding: 8 bytes + RowW int32 + ColH int32 + // padding: 8 bytes + RowsAndCols []byte // size: xgb.Pad(((int(Length) * 4) * 1)) +} + +// 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 +} + +// 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 +// 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 +} + // GetStringCookie is a cookie used only for GetString requests. type GetStringCookie struct { *xgb.Cookie @@ -7020,35 +7489,35 @@ func getTexImageRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level return buf } -// GetTexParameterfvCookie is a cookie used only for GetTexParameterfv requests. -type GetTexParameterfvCookie struct { +// GetTexLevelParameterfvCookie is a cookie used only for GetTexLevelParameterfv requests. +type GetTexLevelParameterfvCookie struct { *xgb.Cookie } -// 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 { +// 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 'GetTexParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GetTexLevelParameterfv' 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} + c.NewRequest(getTexLevelParameterfvRequest(c, ContextTag, Target, Level, Pname), cookie) + return GetTexLevelParameterfvCookie{cookie} } -// GetTexParameterfvUnchecked sends an unchecked request. +// GetTexLevelParameterfvUnchecked 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 { +func GetTexLevelParameterfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32, Pname uint32) GetTexLevelParameterfvCookie { if _, ok := c.Extensions["GLX"]; !ok { - panic("Cannot issue request 'GetTexParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GetTexLevelParameterfv' 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} + c.NewRequest(getTexLevelParameterfvRequest(c, ContextTag, Target, Level, Pname), cookie) + return GetTexLevelParameterfvCookie{cookie} } -// GetTexParameterfvReply represents the data returned from a GetTexParameterfv request. -type GetTexParameterfvReply struct { +// GetTexLevelParameterfvReply represents the data returned from a GetTexLevelParameterfv request. +type GetTexLevelParameterfvReply struct { Sequence uint16 // sequence number of the request for this reply Length uint32 // number of bytes in this reply // padding: 1 bytes @@ -7059,8 +7528,8 @@ type GetTexParameterfvReply struct { Data []Float32 // size: xgb.Pad((int(N) * 4)) } -// Reply blocks and returns the reply data for a GetTexParameterfv request. -func (cook GetTexParameterfvCookie) Reply() (*GetTexParameterfvReply, error) { +// 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 @@ -7068,12 +7537,12 @@ func (cook GetTexParameterfvCookie) Reply() (*GetTexParameterfvReply, error) { if buf == nil { return nil, nil } - return getTexParameterfvReply(buf), nil + return getTexLevelParameterfvReply(buf), nil } -// getTexParameterfvReply reads a byte slice into a GetTexParameterfvReply value. -func getTexParameterfvReply(buf []byte) *GetTexParameterfvReply { - v := new(GetTexParameterfvReply) +// 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 @@ -7104,17 +7573,17 @@ func getTexParameterfvReply(buf []byte) *GetTexParameterfvReply { return v } -// Write request to wire for GetTexParameterfv -// getTexParameterfvRequest writes a GetTexParameterfv request to a byte slice. -func getTexParameterfvRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) []byte { - size := 16 +// Write request to wire for GetTexLevelParameterfv +// 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] = 136 // request opcode + buf[b] = 138 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units @@ -7126,41 +7595,44 @@ func getTexParameterfvRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, xgb.Put32(buf[b:], Target) b += 4 + xgb.Put32(buf[b:], uint32(Level)) + b += 4 + xgb.Put32(buf[b:], Pname) b += 4 return buf } -// GetTexParameterivCookie is a cookie used only for GetTexParameteriv requests. -type GetTexParameterivCookie struct { +// GetTexLevelParameterivCookie is a cookie used only for GetTexLevelParameteriv requests. +type GetTexLevelParameterivCookie struct { *xgb.Cookie } -// 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 { +// 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 'GetTexParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GetTexLevelParameteriv' 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} + c.NewRequest(getTexLevelParameterivRequest(c, ContextTag, Target, Level, Pname), cookie) + return GetTexLevelParameterivCookie{cookie} } -// GetTexParameterivUnchecked sends an unchecked request. +// GetTexLevelParameterivUnchecked 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 { +func GetTexLevelParameterivUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32, Pname uint32) GetTexLevelParameterivCookie { if _, ok := c.Extensions["GLX"]; !ok { - panic("Cannot issue request 'GetTexParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GetTexLevelParameteriv' 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} + c.NewRequest(getTexLevelParameterivRequest(c, ContextTag, Target, Level, Pname), cookie) + return GetTexLevelParameterivCookie{cookie} } -// GetTexParameterivReply represents the data returned from a GetTexParameteriv request. -type GetTexParameterivReply struct { +// GetTexLevelParameterivReply represents the data returned from a GetTexLevelParameteriv request. +type GetTexLevelParameterivReply struct { Sequence uint16 // sequence number of the request for this reply Length uint32 // number of bytes in this reply // padding: 1 bytes @@ -7171,8 +7643,8 @@ type GetTexParameterivReply struct { Data []int32 // size: xgb.Pad((int(N) * 4)) } -// Reply blocks and returns the reply data for a GetTexParameteriv request. -func (cook GetTexParameterivCookie) Reply() (*GetTexParameterivReply, error) { +// 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 @@ -7180,12 +7652,12 @@ func (cook GetTexParameterivCookie) Reply() (*GetTexParameterivReply, error) { if buf == nil { return nil, nil } - return getTexParameterivReply(buf), nil + return getTexLevelParameterivReply(buf), nil } -// getTexParameterivReply reads a byte slice into a GetTexParameterivReply value. -func getTexParameterivReply(buf []byte) *GetTexParameterivReply { - v := new(GetTexParameterivReply) +// 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 @@ -7216,17 +7688,17 @@ func getTexParameterivReply(buf []byte) *GetTexParameterivReply { return v } -// Write request to wire for GetTexParameteriv -// getTexParameterivRequest writes a GetTexParameteriv request to a byte slice. -func getTexParameterivRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) []byte { - size := 16 +// Write request to wire for GetTexLevelParameteriv +// 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] = 137 // request opcode + buf[b] = 139 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units @@ -7238,41 +7710,44 @@ func getTexParameterivRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, xgb.Put32(buf[b:], Target) b += 4 + xgb.Put32(buf[b:], uint32(Level)) + b += 4 + xgb.Put32(buf[b:], Pname) b += 4 return buf } -// GetTexLevelParameterfvCookie is a cookie used only for GetTexLevelParameterfv requests. -type GetTexLevelParameterfvCookie struct { +// GetTexParameterfvCookie is a cookie used only for GetTexParameterfv requests. +type GetTexParameterfvCookie struct { *xgb.Cookie } -// 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 { +// 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 'GetTexLevelParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GetTexParameterfv' 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} + c.NewRequest(getTexParameterfvRequest(c, ContextTag, Target, Pname), cookie) + return GetTexParameterfvCookie{cookie} } -// GetTexLevelParameterfvUnchecked sends an unchecked request. +// GetTexParameterfvUnchecked 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 { +func GetTexParameterfvUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetTexParameterfvCookie { if _, ok := c.Extensions["GLX"]; !ok { - panic("Cannot issue request 'GetTexLevelParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GetTexParameterfv' 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} + c.NewRequest(getTexParameterfvRequest(c, ContextTag, Target, Pname), cookie) + return GetTexParameterfvCookie{cookie} } -// GetTexLevelParameterfvReply represents the data returned from a GetTexLevelParameterfv request. -type GetTexLevelParameterfvReply struct { +// GetTexParameterfvReply represents the data returned from a GetTexParameterfv request. +type GetTexParameterfvReply struct { Sequence uint16 // sequence number of the request for this reply Length uint32 // number of bytes in this reply // padding: 1 bytes @@ -7283,8 +7758,8 @@ type GetTexLevelParameterfvReply struct { Data []Float32 // size: xgb.Pad((int(N) * 4)) } -// Reply blocks and returns the reply data for a GetTexLevelParameterfv request. -func (cook GetTexLevelParameterfvCookie) Reply() (*GetTexLevelParameterfvReply, error) { +// 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 @@ -7292,12 +7767,12 @@ func (cook GetTexLevelParameterfvCookie) Reply() (*GetTexLevelParameterfvReply, if buf == nil { return nil, nil } - return getTexLevelParameterfvReply(buf), nil + return getTexParameterfvReply(buf), nil } -// getTexLevelParameterfvReply reads a byte slice into a GetTexLevelParameterfvReply value. -func getTexLevelParameterfvReply(buf []byte) *GetTexLevelParameterfvReply { - v := new(GetTexLevelParameterfvReply) +// 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 @@ -7328,17 +7803,17 @@ func getTexLevelParameterfvReply(buf []byte) *GetTexLevelParameterfvReply { return v } -// Write request to wire for GetTexLevelParameterfv -// 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 +// Write request to wire for GetTexParameterfv +// 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] = 138 // request opcode + buf[b] = 136 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units @@ -7350,44 +7825,41 @@ func getTexLevelParameterfvRequest(c *xgb.Conn, ContextTag ContextTag, Target ui xgb.Put32(buf[b:], Target) b += 4 - xgb.Put32(buf[b:], uint32(Level)) - b += 4 - xgb.Put32(buf[b:], Pname) b += 4 return buf } -// GetTexLevelParameterivCookie is a cookie used only for GetTexLevelParameteriv requests. -type GetTexLevelParameterivCookie struct { +// GetTexParameterivCookie is a cookie used only for GetTexParameteriv requests. +type GetTexParameterivCookie struct { *xgb.Cookie } -// 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 { +// 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 'GetTexLevelParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GetTexParameteriv' 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} + c.NewRequest(getTexParameterivRequest(c, ContextTag, Target, Pname), cookie) + return GetTexParameterivCookie{cookie} } -// GetTexLevelParameterivUnchecked sends an unchecked request. +// GetTexParameterivUnchecked 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 { +func GetTexParameterivUnchecked(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) GetTexParameterivCookie { if _, ok := c.Extensions["GLX"]; !ok { - panic("Cannot issue request 'GetTexLevelParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GetTexParameteriv' 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} + c.NewRequest(getTexParameterivRequest(c, ContextTag, Target, Pname), cookie) + return GetTexParameterivCookie{cookie} } -// GetTexLevelParameterivReply represents the data returned from a GetTexLevelParameteriv request. -type GetTexLevelParameterivReply struct { +// GetTexParameterivReply represents the data returned from a GetTexParameteriv request. +type GetTexParameterivReply struct { Sequence uint16 // sequence number of the request for this reply Length uint32 // number of bytes in this reply // padding: 1 bytes @@ -7398,8 +7870,8 @@ type GetTexLevelParameterivReply struct { Data []int32 // size: xgb.Pad((int(N) * 4)) } -// Reply blocks and returns the reply data for a GetTexLevelParameteriv request. -func (cook GetTexLevelParameterivCookie) Reply() (*GetTexLevelParameterivReply, error) { +// 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 @@ -7407,12 +7879,12 @@ func (cook GetTexLevelParameterivCookie) Reply() (*GetTexLevelParameterivReply, if buf == nil { return nil, nil } - return getTexLevelParameterivReply(buf), nil + return getTexParameterivReply(buf), nil } -// getTexLevelParameterivReply reads a byte slice into a GetTexLevelParameterivReply value. -func getTexLevelParameterivReply(buf []byte) *GetTexLevelParameterivReply { - v := new(GetTexLevelParameterivReply) +// 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 @@ -7443,17 +7915,17 @@ func getTexLevelParameterivReply(buf []byte) *GetTexLevelParameterivReply { return v } -// Write request to wire for GetTexLevelParameteriv -// 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 +// Write request to wire for GetTexParameteriv +// 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] = 139 // request opcode + buf[b] = 137 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units @@ -7465,52 +7937,52 @@ func getTexLevelParameterivRequest(c *xgb.Conn, ContextTag ContextTag, Target ui xgb.Put32(buf[b:], Target) b += 4 - xgb.Put32(buf[b:], uint32(Level)) - b += 4 - xgb.Put32(buf[b:], Pname) b += 4 return buf } -// IsListCookie is a cookie used only for IsList requests. -type IsListCookie struct { +// GetVisualConfigsCookie is a cookie used only for GetVisualConfigs requests. +type GetVisualConfigsCookie struct { *xgb.Cookie } -// 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 { +// 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 'IsList' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GetVisualConfigs' 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} + c.NewRequest(getVisualConfigsRequest(c, Screen), cookie) + return GetVisualConfigsCookie{cookie} } -// IsListUnchecked sends an unchecked request. +// GetVisualConfigsUnchecked 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 { +func GetVisualConfigsUnchecked(c *xgb.Conn, Screen uint32) GetVisualConfigsCookie { if _, ok := c.Extensions["GLX"]; !ok { - panic("Cannot issue request 'IsList' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'GetVisualConfigs' 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} + c.NewRequest(getVisualConfigsRequest(c, Screen), cookie) + return GetVisualConfigsCookie{cookie} } -// IsListReply represents the data returned from a IsList request. -type IsListReply struct { +// GetVisualConfigsReply represents the data returned from a GetVisualConfigs request. +type GetVisualConfigsReply struct { Sequence uint16 // sequence number of the request for this reply Length uint32 // number of bytes in this reply // padding: 1 bytes - RetVal Bool32 + NumVisuals uint32 + NumProperties uint32 + // padding: 16 bytes + PropertyList []uint32 // size: xgb.Pad((int(Length) * 4)) } -// Reply blocks and returns the reply data for a IsList request. -func (cook IsListCookie) Reply() (*IsListReply, error) { +// 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 @@ -7518,12 +7990,12 @@ func (cook IsListCookie) Reply() (*IsListReply, error) { if buf == nil { return nil, nil } - return isListReply(buf), nil + return getVisualConfigsReply(buf), nil } -// isListReply reads a byte slice into a IsListReply value. -func isListReply(buf []byte) *IsListReply { - v := new(IsListReply) +// 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 @@ -7534,73 +8006,27 @@ func isListReply(buf []byte) *IsListReply { 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 -// 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)) + v.NumVisuals = xgb.Get32(buf[b:]) b += 4 - xgb.Put32(buf[b:], List) + v.NumProperties = xgb.Get32(buf[b:]) b += 4 - return buf -} - -// FlushCookie is a cookie used only for Flush requests. -type FlushCookie struct { - *xgb.Cookie -} - -// Flush sends an unchecked request. -// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. -func Flush(c *xgb.Conn, ContextTag ContextTag) FlushCookie { - 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} -} + b += 16 // padding -// 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.") + v.PropertyList = make([]uint32, v.Length) + for i := 0; i < int(v.Length); i++ { + v.PropertyList[i] = xgb.Get32(buf[b:]) + b += 4 } - cookie := c.NewCookie(true, false) - c.NewRequest(flushRequest(c, ContextTag), cookie) - return FlushCookie{cookie} -} + b = xgb.Pad(b) -// 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() + return v } -// Write request to wire for Flush -// flushRequest writes a Flush request to a byte slice. -func flushRequest(c *xgb.Conn, ContextTag ContextTag) []byte { +// Write request to wire for GetVisualConfigs +// 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) @@ -7608,57 +8034,56 @@ func flushRequest(c *xgb.Conn, ContextTag ContextTag) []byte { buf[b] = c.Extensions["GLX"] b += 1 - buf[b] = 142 // request opcode + 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:], uint32(ContextTag)) + xgb.Put32(buf[b:], Screen) b += 4 return buf } -// AreTexturesResidentCookie is a cookie used only for AreTexturesResident requests. -type AreTexturesResidentCookie struct { +// IsDirectCookie is a cookie used only for IsDirect requests. +type IsDirectCookie struct { *xgb.Cookie } -// 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 { +// 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 'AreTexturesResident' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'IsDirect' 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} + c.NewRequest(isDirectRequest(c, Context), cookie) + return IsDirectCookie{cookie} } -// AreTexturesResidentUnchecked sends an unchecked request. +// IsDirectUnchecked 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 { +func IsDirectUnchecked(c *xgb.Conn, Context Context) IsDirectCookie { if _, ok := c.Extensions["GLX"]; !ok { - panic("Cannot issue request 'AreTexturesResident' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'IsDirect' 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} + c.NewRequest(isDirectRequest(c, Context), cookie) + return IsDirectCookie{cookie} } -// AreTexturesResidentReply represents the data returned from a AreTexturesResident request. -type AreTexturesResidentReply struct { +// IsDirectReply represents the data returned from a IsDirect request. +type IsDirectReply struct { Sequence uint16 // sequence number of the request for this reply Length uint32 // number of bytes in this reply // padding: 1 bytes - RetVal Bool32 - // padding: 20 bytes - Data []bool // size: xgb.Pad(((int(Length) * 4) * 1)) + IsDirect bool + // padding: 23 bytes } -// Reply blocks and returns the reply data for a AreTexturesResident request. -func (cook AreTexturesResidentCookie) Reply() (*AreTexturesResidentReply, error) { +// 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 @@ -7666,12 +8091,12 @@ func (cook AreTexturesResidentCookie) Reply() (*AreTexturesResidentReply, error) if buf == nil { return nil, nil } - return areTexturesResidentReply(buf), nil + return isDirectReply(buf), nil } -// areTexturesResidentReply reads a byte slice into a AreTexturesResidentReply value. -func areTexturesResidentReply(buf []byte) *AreTexturesResidentReply { - v := new(AreTexturesResidentReply) +// 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 @@ -7682,158 +8107,77 @@ func areTexturesResidentReply(buf []byte) *AreTexturesResidentReply { 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 + if buf[b] == 1 { + v.IsDirect = true + } else { + v.IsDirect = false } - b = xgb.Pad(b) - - return v -} - -// Write request to wire for AreTexturesResident -// 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 -} - -// DeleteTexturesCookie is a cookie used only for DeleteTextures requests. -type DeleteTexturesCookie struct { - *xgb.Cookie -} - -// DeleteTextures sends an unchecked request. -// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. -func DeleteTextures(c *xgb.Conn, ContextTag ContextTag, N int32, Textures []uint32) DeleteTexturesCookie { - if _, ok := c.Extensions["GLX"]; !ok { - panic("Cannot issue request 'DeleteTextures' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") - } - cookie := c.NewCookie(false, false) - c.NewRequest(deleteTexturesRequest(c, ContextTag, N, Textures), cookie) - return DeleteTexturesCookie{cookie} -} - -// DeleteTexturesChecked sends a checked request. -// 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} -} + b += 23 // padding -// 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() + return v } -// Write request to wire for DeleteTextures -// 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)))) +// Write request to wire for IsDirect +// 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] = 144 // request opcode + 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(ContextTag)) - b += 4 - - xgb.Put32(buf[b:], uint32(N)) + xgb.Put32(buf[b:], uint32(Context)) b += 4 - for i := 0; i < int(N); i++ { - xgb.Put32(buf[b:], Textures[i]) - b += 4 - } - b = xgb.Pad(b) - return buf } -// GenTexturesCookie is a cookie used only for GenTextures requests. -type GenTexturesCookie struct { +// IsListCookie is a cookie used only for IsList requests. +type IsListCookie struct { *xgb.Cookie } -// 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 { +// 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 'GenTextures' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'IsList' 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} + c.NewRequest(isListRequest(c, ContextTag, List), cookie) + return IsListCookie{cookie} } -// GenTexturesUnchecked sends an unchecked request. +// IsListUnchecked 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 { +func IsListUnchecked(c *xgb.Conn, ContextTag ContextTag, List uint32) IsListCookie { if _, ok := c.Extensions["GLX"]; !ok { - panic("Cannot issue request 'GenTextures' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'IsList' 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} + c.NewRequest(isListRequest(c, ContextTag, List), cookie) + return IsListCookie{cookie} } -// GenTexturesReply represents the data returned from a GenTextures request. -type GenTexturesReply struct { +// IsListReply represents the data returned from a IsList request. +type IsListReply struct { Sequence uint16 // sequence number of the request for this reply Length uint32 // number of bytes in this reply // padding: 1 bytes - // padding: 24 bytes - Data []uint32 // size: xgb.Pad((int(Length) * 4)) + RetVal Bool32 } -// Reply blocks and returns the reply data for a GenTextures request. -func (cook GenTexturesCookie) Reply() (*GenTexturesReply, error) { +// 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 @@ -7841,12 +8185,12 @@ func (cook GenTexturesCookie) Reply() (*GenTexturesReply, error) { if buf == nil { return nil, nil } - return genTexturesReply(buf), nil + return isListReply(buf), nil } -// genTexturesReply reads a byte slice into a GenTexturesReply value. -func genTexturesReply(buf []byte) *GenTexturesReply { - v := new(GenTexturesReply) +// 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 @@ -7857,21 +8201,15 @@ func genTexturesReply(buf []byte) *GenTexturesReply { 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) + v.RetVal = Bool32(xgb.Get32(buf[b:])) + b += 4 return v } -// Write request to wire for GenTextures -// genTexturesRequest writes a GenTextures request to a byte slice. -func genTexturesRequest(c *xgb.Conn, ContextTag ContextTag, N int32) []byte { +// Write request to wire for IsList +// 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) @@ -7879,7 +8217,7 @@ func genTexturesRequest(c *xgb.Conn, ContextTag ContextTag, N int32) []byte { buf[b] = c.Extensions["GLX"] b += 1 - buf[b] = 145 // request opcode + buf[b] = 141 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units @@ -7888,49 +8226,49 @@ func genTexturesRequest(c *xgb.Conn, ContextTag ContextTag, N int32) []byte { xgb.Put32(buf[b:], uint32(ContextTag)) b += 4 - xgb.Put32(buf[b:], uint32(N)) + xgb.Put32(buf[b:], List) b += 4 return buf } -// IsTextureCookie is a cookie used only for IsTexture requests. -type IsTextureCookie struct { +// IsQueryARBCookie is a cookie used only for IsQueryARB requests. +type IsQueryARBCookie struct { *xgb.Cookie } -// 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 { +// 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 'IsTexture' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'IsQueryARB' 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} + c.NewRequest(isQueryARBRequest(c, ContextTag, Id), cookie) + return IsQueryARBCookie{cookie} } -// IsTextureUnchecked sends an unchecked request. +// IsQueryARBUnchecked 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 { +func IsQueryARBUnchecked(c *xgb.Conn, ContextTag ContextTag, Id uint32) IsQueryARBCookie { if _, ok := c.Extensions["GLX"]; !ok { - panic("Cannot issue request 'IsTexture' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'IsQueryARB' 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} + c.NewRequest(isQueryARBRequest(c, ContextTag, Id), cookie) + return IsQueryARBCookie{cookie} } -// IsTextureReply represents the data returned from a IsTexture request. -type IsTextureReply struct { +// IsQueryARBReply represents the data returned from a IsQueryARB request. +type IsQueryARBReply struct { Sequence uint16 // sequence number of the request for this reply Length uint32 // number of bytes in this reply // padding: 1 bytes RetVal Bool32 } -// Reply blocks and returns the reply data for a IsTexture request. -func (cook IsTextureCookie) Reply() (*IsTextureReply, error) { +// 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 @@ -7938,12 +8276,12 @@ func (cook IsTextureCookie) Reply() (*IsTextureReply, error) { if buf == nil { return nil, nil } - return isTextureReply(buf), nil + return isQueryARBReply(buf), nil } -// isTextureReply reads a byte slice into a IsTextureReply value. -func isTextureReply(buf []byte) *IsTextureReply { - v := new(IsTextureReply) +// 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 @@ -7960,9 +8298,9 @@ func isTextureReply(buf []byte) *IsTextureReply { return v } -// Write request to wire for IsTexture -// isTextureRequest writes a IsTexture request to a byte slice. -func isTextureRequest(c *xgb.Conn, ContextTag ContextTag, Texture uint32) []byte { +// Write request to wire for IsQueryARB +// 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) @@ -7970,7 +8308,7 @@ func isTextureRequest(c *xgb.Conn, ContextTag ContextTag, Texture uint32) []byte buf[b] = c.Extensions["GLX"] b += 1 - buf[b] = 146 // request opcode + buf[b] = 163 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units @@ -7979,52 +8317,49 @@ func isTextureRequest(c *xgb.Conn, ContextTag ContextTag, Texture uint32) []byte xgb.Put32(buf[b:], uint32(ContextTag)) b += 4 - xgb.Put32(buf[b:], Texture) + xgb.Put32(buf[b:], Id) b += 4 return buf } -// GetColorTableCookie is a cookie used only for GetColorTable requests. -type GetColorTableCookie struct { +// IsTextureCookie is a cookie used only for IsTexture requests. +type IsTextureCookie struct { *xgb.Cookie } -// 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 { +// 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 'GetColorTable' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'IsTexture' 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} + c.NewRequest(isTextureRequest(c, ContextTag, Texture), cookie) + return IsTextureCookie{cookie} } -// GetColorTableUnchecked sends an unchecked request. +// IsTextureUnchecked 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 { +func IsTextureUnchecked(c *xgb.Conn, ContextTag ContextTag, Texture uint32) IsTextureCookie { if _, ok := c.Extensions["GLX"]; !ok { - panic("Cannot issue request 'GetColorTable' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'IsTexture' 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} + c.NewRequest(isTextureRequest(c, ContextTag, Texture), cookie) + return IsTextureCookie{cookie} } -// GetColorTableReply represents the data returned from a GetColorTable request. -type GetColorTableReply struct { +// IsTextureReply represents the data returned from a IsTexture request. +type IsTextureReply struct { Sequence uint16 // sequence number of the request for this reply Length uint32 // number of bytes in this reply // padding: 1 bytes - // padding: 8 bytes - Width int32 - // padding: 12 bytes - Data []byte // size: xgb.Pad(((int(Length) * 4) * 1)) + RetVal Bool32 } -// Reply blocks and returns the reply data for a GetColorTable request. -func (cook GetColorTableCookie) Reply() (*GetColorTableReply, error) { +// 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 @@ -8032,12 +8367,12 @@ func (cook GetColorTableCookie) Reply() (*GetColorTableReply, error) { if buf == nil { return nil, nil } - return getColorTableReply(buf), nil + return isTextureReply(buf), nil } -// getColorTableReply reads a byte slice into a GetColorTableReply value. -func getColorTableReply(buf []byte) *GetColorTableReply { - v := new(GetColorTableReply) +// 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 @@ -8048,31 +8383,23 @@ func getColorTableReply(buf []byte) *GetColorTableReply { v.Length = xgb.Get32(buf[b:]) // 4-byte units b += 4 - b += 8 // padding - - v.Width = int32(xgb.Get32(buf[b:])) + v.RetVal = Bool32(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 -// 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 +// Write request to wire for IsTexture +// 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] = 147 // request opcode + buf[b] = 146 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units @@ -8081,66 +8408,50 @@ func getColorTableRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, For 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) + xgb.Put32(buf[b:], Texture) b += 4 - if SwapBytes { - buf[b] = 1 - } else { - buf[b] = 0 - } - b += 1 - return buf } -// GetColorTableParameterfvCookie is a cookie used only for GetColorTableParameterfv requests. -type GetColorTableParameterfvCookie struct { +// MakeContextCurrentCookie is a cookie used only for MakeContextCurrent requests. +type MakeContextCurrentCookie struct { *xgb.Cookie } -// 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 { +// 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 'GetColorTableParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'MakeContextCurrent' 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} + c.NewRequest(makeContextCurrentRequest(c, OldContextTag, Drawable, ReadDrawable, Context), cookie) + return MakeContextCurrentCookie{cookie} } -// GetColorTableParameterfvUnchecked sends an unchecked request. +// MakeContextCurrentUnchecked 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 { +func MakeContextCurrentUnchecked(c *xgb.Conn, OldContextTag ContextTag, Drawable Drawable, ReadDrawable Drawable, Context Context) MakeContextCurrentCookie { if _, ok := c.Extensions["GLX"]; !ok { - panic("Cannot issue request 'GetColorTableParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'MakeContextCurrent' 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} + c.NewRequest(makeContextCurrentRequest(c, OldContextTag, Drawable, ReadDrawable, Context), cookie) + return MakeContextCurrentCookie{cookie} } -// GetColorTableParameterfvReply represents the data returned from a GetColorTableParameterfv request. -type GetColorTableParameterfvReply struct { +// MakeContextCurrentReply represents the data returned from a MakeContextCurrent request. +type MakeContextCurrentReply struct { Sequence uint16 // sequence number of the request for this reply Length uint32 // number of bytes in this reply // padding: 1 bytes - // padding: 4 bytes - N uint32 - Datum Float32 - // padding: 12 bytes - Data []Float32 // size: xgb.Pad((int(N) * 4)) + ContextTag ContextTag + // padding: 20 bytes } -// Reply blocks and returns the reply data for a GetColorTableParameterfv request. -func (cook GetColorTableParameterfvCookie) Reply() (*GetColorTableParameterfvReply, error) { +// 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 @@ -8148,12 +8459,12 @@ func (cook GetColorTableParameterfvCookie) Reply() (*GetColorTableParameterfvRep if buf == nil { return nil, nil } - return getColorTableParameterfvReply(buf), nil + return makeContextCurrentReply(buf), nil } -// getColorTableParameterfvReply reads a byte slice into a GetColorTableParameterfvReply value. -func getColorTableParameterfvReply(buf []byte) *GetColorTableParameterfvReply { - v := new(GetColorTableParameterfvReply) +// 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 @@ -8164,95 +8475,83 @@ func getColorTableParameterfvReply(buf []byte) *GetColorTableParameterfvReply { 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:])) + v.ContextTag = ContextTag(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) + b += 20 // padding return v } -// Write request to wire for GetColorTableParameterfv -// getColorTableParameterfvRequest writes a GetColorTableParameterfv request to a byte slice. -func getColorTableParameterfvRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) []byte { - size := 16 +// Write request to wire for MakeContextCurrent +// 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] = 148 // request opcode + 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(ContextTag)) + xgb.Put32(buf[b:], uint32(OldContextTag)) b += 4 - xgb.Put32(buf[b:], Target) + xgb.Put32(buf[b:], uint32(Drawable)) b += 4 - xgb.Put32(buf[b:], Pname) + xgb.Put32(buf[b:], uint32(ReadDrawable)) + b += 4 + + xgb.Put32(buf[b:], uint32(Context)) b += 4 return buf } -// GetColorTableParameterivCookie is a cookie used only for GetColorTableParameteriv requests. -type GetColorTableParameterivCookie struct { +// MakeCurrentCookie is a cookie used only for MakeCurrent requests. +type MakeCurrentCookie struct { *xgb.Cookie } -// 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 { +// 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 'GetColorTableParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'MakeCurrent' 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} + c.NewRequest(makeCurrentRequest(c, Drawable, Context, OldContextTag), cookie) + return MakeCurrentCookie{cookie} } -// GetColorTableParameterivUnchecked sends an unchecked request. +// MakeCurrentUnchecked 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 { +func MakeCurrentUnchecked(c *xgb.Conn, Drawable Drawable, Context Context, OldContextTag ContextTag) MakeCurrentCookie { if _, ok := c.Extensions["GLX"]; !ok { - panic("Cannot issue request 'GetColorTableParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'MakeCurrent' 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} + c.NewRequest(makeCurrentRequest(c, Drawable, Context, OldContextTag), cookie) + return MakeCurrentCookie{cookie} } -// GetColorTableParameterivReply represents the data returned from a GetColorTableParameteriv request. -type GetColorTableParameterivReply struct { +// MakeCurrentReply represents the data returned from a MakeCurrent request. +type MakeCurrentReply struct { Sequence uint16 // sequence number of the request for this reply Length uint32 // number of bytes in this reply // padding: 1 bytes - // padding: 4 bytes - N uint32 - Datum int32 - // padding: 12 bytes - Data []int32 // size: xgb.Pad((int(N) * 4)) + ContextTag ContextTag + // padding: 20 bytes } -// Reply blocks and returns the reply data for a GetColorTableParameteriv request. -func (cook GetColorTableParameterivCookie) Reply() (*GetColorTableParameterivReply, error) { +// 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 @@ -8260,12 +8559,12 @@ func (cook GetColorTableParameterivCookie) Reply() (*GetColorTableParameterivRep if buf == nil { return nil, nil } - return getColorTableParameterivReply(buf), nil + return makeCurrentReply(buf), nil } -// getColorTableParameterivReply reads a byte slice into a GetColorTableParameterivReply value. -func getColorTableParameterivReply(buf []byte) *GetColorTableParameterivReply { - v := new(GetColorTableParameterivReply) +// 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 @@ -8276,29 +8575,17 @@ func getColorTableParameterivReply(buf []byte) *GetColorTableParameterivReply { 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:])) + v.ContextTag = ContextTag(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) + b += 20 // padding return v } -// Write request to wire for GetColorTableParameteriv -// getColorTableParameterivRequest writes a GetColorTableParameteriv request to a byte slice. -func getColorTableParameterivRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) []byte { +// Write request to wire for MakeCurrent +// 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) @@ -8306,116 +8593,68 @@ func getColorTableParameterivRequest(c *xgb.Conn, ContextTag ContextTag, Target buf[b] = c.Extensions["GLX"] b += 1 - buf[b] = 149 // request opcode + 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(ContextTag)) + xgb.Put32(buf[b:], uint32(Drawable)) b += 4 - xgb.Put32(buf[b:], Target) + xgb.Put32(buf[b:], uint32(Context)) b += 4 - xgb.Put32(buf[b:], Pname) + xgb.Put32(buf[b:], uint32(OldContextTag)) b += 4 return buf } -// GetConvolutionFilterCookie is a cookie used only for GetConvolutionFilter requests. -type GetConvolutionFilterCookie struct { +// NewListCookie is a cookie used only for NewList requests. +type NewListCookie struct { *xgb.Cookie } -// 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} -} - -// GetConvolutionFilterUnchecked sends an unchecked request. +// NewList 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 { +func NewList(c *xgb.Conn, ContextTag ContextTag, List uint32, Mode uint32) NewListCookie { if _, ok := c.Extensions["GLX"]; !ok { - panic("Cannot issue request 'GetConvolutionFilter' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'NewList' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } - cookie := c.NewCookie(false, true) - c.NewRequest(getConvolutionFilterRequest(c, ContextTag, Target, Format, Type, SwapBytes), cookie) - return GetConvolutionFilterCookie{cookie} -} - -// GetConvolutionFilterReply represents the data returned from a GetConvolutionFilter request. -type GetConvolutionFilterReply struct { - Sequence uint16 // sequence number of the request for this reply - Length uint32 // number of bytes in this reply - // padding: 1 bytes - // padding: 8 bytes - Width int32 - Height int32 - // padding: 8 bytes - Data []byte // size: xgb.Pad(((int(Length) * 4) * 1)) + cookie := c.NewCookie(false, false) + c.NewRequest(newListRequest(c, ContextTag, List, Mode), cookie) + return NewListCookie{cookie} } -// 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 +// 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.") } - return getConvolutionFilterReply(buf), nil + cookie := c.NewCookie(true, false) + c.NewRequest(newListRequest(c, ContextTag, List, Mode), cookie) + return NewListCookie{cookie} } -// 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 +// 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 GetConvolutionFilter -// 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 +// Write request to wire for NewList +// 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] = 150 // request opcode + buf[b] = 101 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units @@ -8424,112 +8663,51 @@ func getConvolutionFilterRequest(c *xgb.Conn, ContextTag ContextTag, Target uint xgb.Put32(buf[b:], uint32(ContextTag)) b += 4 - xgb.Put32(buf[b:], Target) - b += 4 - - xgb.Put32(buf[b:], Format) + xgb.Put32(buf[b:], List) b += 4 - xgb.Put32(buf[b:], Type) + xgb.Put32(buf[b:], Mode) b += 4 - if SwapBytes { - buf[b] = 1 - } else { - buf[b] = 0 - } - b += 1 - return buf } -// GetConvolutionParameterfvCookie is a cookie used only for GetConvolutionParameterfv requests. -type GetConvolutionParameterfvCookie struct { +// PixelStorefCookie is a cookie used only for PixelStoref requests. +type PixelStorefCookie struct { *xgb.Cookie } -// 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} -} - -// GetConvolutionParameterfvUnchecked sends an unchecked request. +// PixelStoref 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 { +func PixelStoref(c *xgb.Conn, ContextTag ContextTag, Pname uint32, Datum Float32) PixelStorefCookie { if _, ok := c.Extensions["GLX"]; !ok { - panic("Cannot issue request 'GetConvolutionParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'PixelStoref' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } - cookie := c.NewCookie(false, true) - c.NewRequest(getConvolutionParameterfvRequest(c, ContextTag, Target, Pname), cookie) - return GetConvolutionParameterfvCookie{cookie} -} - -// GetConvolutionParameterfvReply represents the data returned from a GetConvolutionParameterfv request. -type GetConvolutionParameterfvReply struct { - Sequence uint16 // sequence number of the request for this reply - Length uint32 // number of bytes in this reply - // padding: 1 bytes - // padding: 4 bytes - N uint32 - Datum Float32 - // padding: 12 bytes - Data []Float32 // size: xgb.Pad((int(N) * 4)) + cookie := c.NewCookie(false, false) + c.NewRequest(pixelStorefRequest(c, ContextTag, Pname, Datum), cookie) + return PixelStorefCookie{cookie} } -// 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 +// 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.") } - return getConvolutionParameterfvReply(buf), nil + cookie := c.NewCookie(true, false) + c.NewRequest(pixelStorefRequest(c, ContextTag, Pname, Datum), cookie) + return PixelStorefCookie{cookie} } -// 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 +// 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 GetConvolutionParameterfv -// getConvolutionParameterfvRequest writes a GetConvolutionParameterfv request to a byte slice. -func getConvolutionParameterfvRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) []byte { +// Write request to wire for PixelStoref +// 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) @@ -8537,7 +8715,7 @@ func getConvolutionParameterfvRequest(c *xgb.Conn, ContextTag ContextTag, Target buf[b] = c.Extensions["GLX"] b += 1 - buf[b] = 151 // request opcode + buf[b] = 109 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units @@ -8546,102 +8724,51 @@ func getConvolutionParameterfvRequest(c *xgb.Conn, ContextTag ContextTag, Target xgb.Put32(buf[b:], uint32(ContextTag)) b += 4 - xgb.Put32(buf[b:], Target) + xgb.Put32(buf[b:], Pname) b += 4 - xgb.Put32(buf[b:], Pname) + xgb.Put32(buf[b:], uint32(Datum)) b += 4 return buf } -// GetConvolutionParameterivCookie is a cookie used only for GetConvolutionParameteriv requests. -type GetConvolutionParameterivCookie struct { +// PixelStoreiCookie is a cookie used only for PixelStorei requests. +type PixelStoreiCookie struct { *xgb.Cookie } -// 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} -} - -// GetConvolutionParameterivUnchecked sends an unchecked request. +// PixelStorei 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 { +func PixelStorei(c *xgb.Conn, ContextTag ContextTag, Pname uint32, Datum int32) PixelStoreiCookie { if _, ok := c.Extensions["GLX"]; !ok { - panic("Cannot issue request 'GetConvolutionParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'PixelStorei' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } - cookie := c.NewCookie(false, true) - c.NewRequest(getConvolutionParameterivRequest(c, ContextTag, Target, Pname), cookie) - return GetConvolutionParameterivCookie{cookie} -} - -// GetConvolutionParameterivReply represents the data returned from a GetConvolutionParameteriv request. -type GetConvolutionParameterivReply struct { - Sequence uint16 // sequence number of the request for this reply - Length uint32 // number of bytes in this reply - // padding: 1 bytes - // padding: 4 bytes - N uint32 - Datum int32 - // padding: 12 bytes - Data []int32 // size: xgb.Pad((int(N) * 4)) + cookie := c.NewCookie(false, false) + c.NewRequest(pixelStoreiRequest(c, ContextTag, Pname, Datum), cookie) + return PixelStoreiCookie{cookie} } -// 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 +// 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.") } - return getConvolutionParameterivReply(buf), nil + cookie := c.NewCookie(true, false) + c.NewRequest(pixelStoreiRequest(c, ContextTag, Pname, Datum), cookie) + return PixelStoreiCookie{cookie} } -// 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 +// 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 GetConvolutionParameteriv -// getConvolutionParameterivRequest writes a GetConvolutionParameteriv request to a byte slice. -func getConvolutionParameterivRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) []byte { +// Write request to wire for PixelStorei +// 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) @@ -8649,7 +8776,7 @@ func getConvolutionParameterivRequest(c *xgb.Conn, ContextTag ContextTag, Target buf[b] = c.Extensions["GLX"] b += 1 - buf[b] = 152 // request opcode + buf[b] = 110 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units @@ -8658,56 +8785,54 @@ func getConvolutionParameterivRequest(c *xgb.Conn, ContextTag ContextTag, Target xgb.Put32(buf[b:], uint32(ContextTag)) b += 4 - xgb.Put32(buf[b:], Target) + xgb.Put32(buf[b:], Pname) b += 4 - xgb.Put32(buf[b:], Pname) + xgb.Put32(buf[b:], uint32(Datum)) b += 4 return buf } -// GetSeparableFilterCookie is a cookie used only for GetSeparableFilter requests. -type GetSeparableFilterCookie struct { +// QueryContextCookie is a cookie used only for QueryContext requests. +type QueryContextCookie struct { *xgb.Cookie } -// 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 { +// 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 'GetSeparableFilter' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'QueryContext' 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} + c.NewRequest(queryContextRequest(c, Context), cookie) + return QueryContextCookie{cookie} } -// GetSeparableFilterUnchecked sends an unchecked request. +// QueryContextUnchecked 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 { +func QueryContextUnchecked(c *xgb.Conn, Context Context) QueryContextCookie { if _, ok := c.Extensions["GLX"]; !ok { - panic("Cannot issue request 'GetSeparableFilter' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'QueryContext' 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} + c.NewRequest(queryContextRequest(c, Context), cookie) + return QueryContextCookie{cookie} } -// GetSeparableFilterReply represents the data returned from a GetSeparableFilter request. -type GetSeparableFilterReply struct { +// QueryContextReply represents the data returned from a QueryContext request. +type QueryContextReply struct { Sequence uint16 // sequence number of the request for this reply Length uint32 // number of bytes in this reply // padding: 1 bytes - // padding: 8 bytes - RowW int32 - ColH int32 - // padding: 8 bytes - RowsAndCols []byte // size: xgb.Pad(((int(Length) * 4) * 1)) + NumAttribs uint32 + // padding: 20 bytes + Attribs []uint32 // size: xgb.Pad(((int(NumAttribs) * 2) * 4)) } -// Reply blocks and returns the reply data for a GetSeparableFilter request. -func (cook GetSeparableFilterCookie) Reply() (*GetSeparableFilterReply, error) { +// 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 @@ -8715,12 +8840,12 @@ func (cook GetSeparableFilterCookie) Reply() (*GetSeparableFilterReply, error) { if buf == nil { return nil, nil } - return getSeparableFilterReply(buf), nil + return queryContextReply(buf), nil } -// getSeparableFilterReply reads a byte slice into a GetSeparableFilterReply value. -func getSeparableFilterReply(buf []byte) *GetSeparableFilterReply { - v := new(GetSeparableFilterReply) +// 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 @@ -8731,101 +8856,82 @@ func getSeparableFilterReply(buf []byte) *GetSeparableFilterReply { 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:])) + v.NumAttribs = xgb.Get32(buf[b:]) b += 4 - b += 8 // padding + b += 20 // 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))) + 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 GetSeparableFilter -// 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 +// Write request to wire for QueryContext +// 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] = 153 // request opcode + 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(ContextTag)) - b += 4 - - xgb.Put32(buf[b:], Target) - b += 4 - - xgb.Put32(buf[b:], Format) - b += 4 - - xgb.Put32(buf[b:], Type) + xgb.Put32(buf[b:], uint32(Context)) b += 4 - if SwapBytes { - buf[b] = 1 - } else { - buf[b] = 0 - } - b += 1 - return buf } -// GetHistogramCookie is a cookie used only for GetHistogram requests. -type GetHistogramCookie struct { +// QueryExtensionsStringCookie is a cookie used only for QueryExtensionsString requests. +type QueryExtensionsStringCookie struct { *xgb.Cookie } -// 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 { +// 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 'GetHistogram' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'QueryExtensionsString' 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} + c.NewRequest(queryExtensionsStringRequest(c, Screen), cookie) + return QueryExtensionsStringCookie{cookie} } -// GetHistogramUnchecked sends an unchecked request. +// QueryExtensionsStringUnchecked 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 { +func QueryExtensionsStringUnchecked(c *xgb.Conn, Screen uint32) QueryExtensionsStringCookie { if _, ok := c.Extensions["GLX"]; !ok { - panic("Cannot issue request 'GetHistogram' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'QueryExtensionsString' 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} + c.NewRequest(queryExtensionsStringRequest(c, Screen), cookie) + return QueryExtensionsStringCookie{cookie} } -// GetHistogramReply represents the data returned from a GetHistogram request. -type GetHistogramReply struct { +// QueryExtensionsStringReply represents the data returned from a QueryExtensionsString request. +type QueryExtensionsStringReply struct { Sequence uint16 // sequence number of the request for this reply Length uint32 // number of bytes in this reply // padding: 1 bytes - // padding: 8 bytes - Width int32 - // padding: 12 bytes - Data []byte // size: xgb.Pad(((int(Length) * 4) * 1)) + // padding: 4 bytes + N uint32 + // padding: 16 bytes } -// Reply blocks and returns the reply data for a GetHistogram request. -func (cook GetHistogramCookie) Reply() (*GetHistogramReply, error) { +// 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 @@ -8833,12 +8939,12 @@ func (cook GetHistogramCookie) Reply() (*GetHistogramReply, error) { if buf == nil { return nil, nil } - return getHistogramReply(buf), nil + return queryExtensionsStringReply(buf), nil } -// getHistogramReply reads a byte slice into a GetHistogramReply value. -func getHistogramReply(buf []byte) *GetHistogramReply { - v := new(GetHistogramReply) +// 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 @@ -8849,106 +8955,78 @@ func getHistogramReply(buf []byte) *GetHistogramReply { v.Length = xgb.Get32(buf[b:]) // 4-byte units b += 4 - b += 8 // padding + b += 4 // padding - v.Width = int32(xgb.Get32(buf[b:])) + v.N = 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))) + b += 16 // padding return v } -// Write request to wire for GetHistogram -// 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 +// Write request to wire for QueryExtensionsString +// 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] = 154 // request opcode + 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:], uint32(ContextTag)) - b += 4 - - xgb.Put32(buf[b:], Target) - b += 4 - - xgb.Put32(buf[b:], Format) - b += 4 - - xgb.Put32(buf[b:], Type) + xgb.Put32(buf[b:], Screen) 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 } -// GetHistogramParameterfvCookie is a cookie used only for GetHistogramParameterfv requests. -type GetHistogramParameterfvCookie struct { +// QueryServerStringCookie is a cookie used only for QueryServerString requests. +type QueryServerStringCookie struct { *xgb.Cookie } -// 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 { +// 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 'GetHistogramParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'QueryServerString' 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} + c.NewRequest(queryServerStringRequest(c, Screen, Name), cookie) + return QueryServerStringCookie{cookie} } -// GetHistogramParameterfvUnchecked sends an unchecked request. +// QueryServerStringUnchecked 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 { +func QueryServerStringUnchecked(c *xgb.Conn, Screen uint32, Name uint32) QueryServerStringCookie { if _, ok := c.Extensions["GLX"]; !ok { - panic("Cannot issue request 'GetHistogramParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'QueryServerString' 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} + c.NewRequest(queryServerStringRequest(c, Screen, Name), cookie) + return QueryServerStringCookie{cookie} } -// GetHistogramParameterfvReply represents the data returned from a GetHistogramParameterfv request. -type GetHistogramParameterfvReply struct { +// QueryServerStringReply represents the data returned from a QueryServerString request. +type QueryServerStringReply struct { Sequence uint16 // sequence number of the request for this reply Length uint32 // number of bytes in this reply // padding: 1 bytes // padding: 4 bytes - N uint32 - Datum Float32 - // padding: 12 bytes - Data []Float32 // size: xgb.Pad((int(N) * 4)) + StrLen uint32 + // padding: 16 bytes + String string // size: xgb.Pad((int(StrLen) * 1)) } -// Reply blocks and returns the reply data for a GetHistogramParameterfv request. -func (cook GetHistogramParameterfvCookie) Reply() (*GetHistogramParameterfvReply, error) { +// 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 @@ -8956,12 +9034,12 @@ func (cook GetHistogramParameterfvCookie) Reply() (*GetHistogramParameterfvReply if buf == nil { return nil, nil } - return getHistogramParameterfvReply(buf), nil + return queryServerStringReply(buf), nil } -// getHistogramParameterfvReply reads a byte slice into a GetHistogramParameterfvReply value. -func getHistogramParameterfvReply(buf []byte) *GetHistogramParameterfvReply { - v := new(GetHistogramParameterfvReply) +// 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 @@ -8974,93 +9052,85 @@ func getHistogramParameterfvReply(buf []byte) *GetHistogramParameterfvReply { b += 4 // padding - v.N = xgb.Get32(buf[b:]) - b += 4 - - v.Datum = Float32(xgb.Get32(buf[b:])) + v.StrLen = xgb.Get32(buf[b:]) b += 4 - b += 12 // padding + b += 16 // 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 + { + byteString := make([]byte, v.StrLen) + copy(byteString[:v.StrLen], buf[b:]) + v.String = string(byteString) + b += xgb.Pad(int(v.StrLen)) } - b = xgb.Pad(b) return v } -// Write request to wire for GetHistogramParameterfv -// getHistogramParameterfvRequest writes a GetHistogramParameterfv request to a byte slice. -func getHistogramParameterfvRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) []byte { - size := 16 +// Write request to wire for QueryServerString +// 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] = 155 // request opcode + 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:], uint32(ContextTag)) - b += 4 - - xgb.Put32(buf[b:], Target) + xgb.Put32(buf[b:], Screen) b += 4 - xgb.Put32(buf[b:], Pname) + xgb.Put32(buf[b:], Name) b += 4 return buf } -// GetHistogramParameterivCookie is a cookie used only for GetHistogramParameteriv requests. -type GetHistogramParameterivCookie struct { +// QueryVersionCookie is a cookie used only for QueryVersion requests. +type QueryVersionCookie struct { *xgb.Cookie } -// 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 { +// 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 'GetHistogramParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'QueryVersion' 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} + c.NewRequest(queryVersionRequest(c, MajorVersion, MinorVersion), cookie) + return QueryVersionCookie{cookie} } -// GetHistogramParameterivUnchecked sends an unchecked request. +// QueryVersionUnchecked 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 { +func QueryVersionUnchecked(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32) QueryVersionCookie { if _, ok := c.Extensions["GLX"]; !ok { - panic("Cannot issue request 'GetHistogramParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'QueryVersion' 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} + c.NewRequest(queryVersionRequest(c, MajorVersion, MinorVersion), cookie) + return QueryVersionCookie{cookie} } -// GetHistogramParameterivReply represents the data returned from a GetHistogramParameteriv request. -type GetHistogramParameterivReply struct { +// QueryVersionReply represents the data returned from a QueryVersion request. +type QueryVersionReply struct { Sequence uint16 // sequence number of the request for this reply Length uint32 // number of bytes in this reply // padding: 1 bytes - // padding: 4 bytes - N uint32 - Datum int32 - // padding: 12 bytes - Data []int32 // size: xgb.Pad((int(N) * 4)) + MajorVersion uint32 + MinorVersion uint32 + // padding: 16 bytes } -// Reply blocks and returns the reply data for a GetHistogramParameteriv request. -func (cook GetHistogramParameterivCookie) Reply() (*GetHistogramParameterivReply, error) { +// 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 @@ -9068,12 +9138,12 @@ func (cook GetHistogramParameterivCookie) Reply() (*GetHistogramParameterivReply if buf == nil { return nil, nil } - return getHistogramParameterivReply(buf), nil + return queryVersionReply(buf), nil } -// getHistogramParameterivReply reads a byte slice into a GetHistogramParameterivReply value. -func getHistogramParameterivReply(buf []byte) *GetHistogramParameterivReply { - v := new(GetHistogramParameterivReply) +// 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 @@ -9084,83 +9154,71 @@ func getHistogramParameterivReply(buf []byte) *GetHistogramParameterivReply { v.Length = xgb.Get32(buf[b:]) // 4-byte units b += 4 - b += 4 // padding - - v.N = xgb.Get32(buf[b:]) + v.MajorVersion = xgb.Get32(buf[b:]) b += 4 - v.Datum = int32(xgb.Get32(buf[b:])) + v.MinorVersion = 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) + b += 16 // padding return v } -// Write request to wire for GetHistogramParameteriv -// getHistogramParameterivRequest writes a GetHistogramParameteriv request to a byte slice. -func getHistogramParameterivRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) []byte { - size := 16 +// Write request to wire for QueryVersion +// 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] = 156 // request opcode + 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:], uint32(ContextTag)) - b += 4 - - xgb.Put32(buf[b:], Target) + xgb.Put32(buf[b:], MajorVersion) b += 4 - xgb.Put32(buf[b:], Pname) + xgb.Put32(buf[b:], MinorVersion) b += 4 return buf } -// GetMinmaxCookie is a cookie used only for GetMinmax requests. -type GetMinmaxCookie struct { +// ReadPixelsCookie is a cookie used only for ReadPixels requests. +type ReadPixelsCookie struct { *xgb.Cookie } -// 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 { +// 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 'GetMinmax' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'ReadPixels' 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} + c.NewRequest(readPixelsRequest(c, ContextTag, X, Y, Width, Height, Format, Type, SwapBytes, LsbFirst), cookie) + return ReadPixelsCookie{cookie} } -// GetMinmaxUnchecked sends an unchecked request. +// ReadPixelsUnchecked 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 { +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 'GetMinmax' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'ReadPixels' 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} + c.NewRequest(readPixelsRequest(c, ContextTag, X, Y, Width, Height, Format, Type, SwapBytes, LsbFirst), cookie) + return ReadPixelsCookie{cookie} } -// GetMinmaxReply represents the data returned from a GetMinmax request. -type GetMinmaxReply struct { +// ReadPixelsReply represents the data returned from a ReadPixels request. +type ReadPixelsReply struct { Sequence uint16 // sequence number of the request for this reply Length uint32 // number of bytes in this reply // padding: 1 bytes @@ -9168,8 +9226,8 @@ type GetMinmaxReply struct { Data []byte // size: xgb.Pad(((int(Length) * 4) * 1)) } -// Reply blocks and returns the reply data for a GetMinmax request. -func (cook GetMinmaxCookie) Reply() (*GetMinmaxReply, error) { +// 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 @@ -9177,12 +9235,12 @@ func (cook GetMinmaxCookie) Reply() (*GetMinmaxReply, error) { if buf == nil { return nil, nil } - return getMinmaxReply(buf), nil + return readPixelsReply(buf), nil } -// getMinmaxReply reads a byte slice into a GetMinmaxReply value. -func getMinmaxReply(buf []byte) *GetMinmaxReply { - v := new(GetMinmaxReply) +// 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 @@ -9202,17 +9260,17 @@ func getMinmaxReply(buf []byte) *GetMinmaxReply { return v } -// Write request to wire for GetMinmax -// 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 +// Write request to wire for ReadPixels +// 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] = 157 // request opcode + buf[b] = 111 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units @@ -9221,7 +9279,16 @@ func getMinmaxRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Format xgb.Put32(buf[b:], uint32(ContextTag)) b += 4 - xgb.Put32(buf[b:], Target) + 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) @@ -9237,7 +9304,7 @@ func getMinmaxRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Format } b += 1 - if Reset { + if LsbFirst { buf[b] = 1 } else { buf[b] = 0 @@ -9247,101 +9314,108 @@ func getMinmaxRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Format return buf } -// GetMinmaxParameterfvCookie is a cookie used only for GetMinmaxParameterfv requests. -type GetMinmaxParameterfvCookie struct { +// RenderCookie is a cookie used only for Render requests. +type RenderCookie struct { *xgb.Cookie } -// 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 { +// 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 'GetMinmaxParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'Render' 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} + cookie := c.NewCookie(false, false) + c.NewRequest(renderRequest(c, ContextTag, Data), cookie) + return RenderCookie{cookie} } -// 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 { +// 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 'GetMinmaxParameterfv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'Render' 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} + cookie := c.NewCookie(true, false) + c.NewRequest(renderRequest(c, ContextTag, Data), cookie) + return RenderCookie{cookie} } -// GetMinmaxParameterfvReply represents the data returned from a GetMinmaxParameterfv request. -type GetMinmaxParameterfvReply struct { - Sequence uint16 // sequence number of the request for this reply - Length uint32 // number of bytes in this reply - // padding: 1 bytes - // padding: 4 bytes - N uint32 - Datum Float32 - // padding: 12 bytes - Data []Float32 // size: xgb.Pad((int(N) * 4)) +// 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() } -// 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 -} +// Write request to wire for Render +// 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) -// getMinmaxParameterfvReply reads a byte slice into a GetMinmaxParameterfvReply value. -func getMinmaxParameterfvReply(buf []byte) *GetMinmaxParameterfvReply { - v := new(GetMinmaxParameterfvReply) - b := 1 // skip reply determinant + buf[b] = c.Extensions["GLX"] + b += 1 - b += 1 // padding + buf[b] = 1 // request opcode + b += 1 - v.Sequence = xgb.Get16(buf[b:]) + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 - v.Length = xgb.Get32(buf[b:]) // 4-byte units + xgb.Put32(buf[b:], uint32(ContextTag)) b += 4 - b += 4 // padding + copy(buf[b:], Data[:len(Data)]) + b += xgb.Pad(int(len(Data))) - v.N = xgb.Get32(buf[b:]) - b += 4 + return buf +} - v.Datum = Float32(xgb.Get32(buf[b:])) - b += 4 +// RenderLargeCookie is a cookie used only for RenderLarge requests. +type RenderLargeCookie struct { + *xgb.Cookie +} - b += 12 // padding +// 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} +} - v.Data = make([]Float32, v.N) - for i := 0; i < int(v.N); i++ { - v.Data[i] = Float32(xgb.Get32(buf[b:])) - b += 4 +// 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.") } - b = xgb.Pad(b) + cookie := c.NewCookie(true, false) + c.NewRequest(renderLargeRequest(c, ContextTag, RequestNum, RequestTotal, DataLen, Data), cookie) + return RenderLargeCookie{cookie} +} - return v +// 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 GetMinmaxParameterfv -// getMinmaxParameterfvRequest writes a GetMinmaxParameterfv request to a byte slice. -func getMinmaxParameterfvRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) []byte { - size := 16 +// Write request to wire for RenderLarge +// 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] = 158 // request opcode + buf[b] = 2 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units @@ -9350,56 +9424,62 @@ func getMinmaxParameterfvRequest(c *xgb.Conn, ContextTag ContextTag, Target uint xgb.Put32(buf[b:], uint32(ContextTag)) b += 4 - xgb.Put32(buf[b:], Target) - b += 4 + xgb.Put16(buf[b:], RequestNum) + b += 2 - xgb.Put32(buf[b:], Pname) + 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 } -// GetMinmaxParameterivCookie is a cookie used only for GetMinmaxParameteriv requests. -type GetMinmaxParameterivCookie struct { +// RenderModeCookie is a cookie used only for RenderMode requests. +type RenderModeCookie struct { *xgb.Cookie } -// 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 { +// 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 'GetMinmaxParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'RenderMode' 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} + c.NewRequest(renderModeRequest(c, ContextTag, Mode), cookie) + return RenderModeCookie{cookie} } -// GetMinmaxParameterivUnchecked sends an unchecked request. +// RenderModeUnchecked 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 { +func RenderModeUnchecked(c *xgb.Conn, ContextTag ContextTag, Mode uint32) RenderModeCookie { if _, ok := c.Extensions["GLX"]; !ok { - panic("Cannot issue request 'GetMinmaxParameteriv' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'RenderMode' 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} + c.NewRequest(renderModeRequest(c, ContextTag, Mode), cookie) + return RenderModeCookie{cookie} } -// GetMinmaxParameterivReply represents the data returned from a GetMinmaxParameteriv request. -type GetMinmaxParameterivReply struct { +// RenderModeReply represents the data returned from a RenderMode request. +type RenderModeReply struct { Sequence uint16 // sequence number of the request for this reply Length uint32 // number of bytes in this reply // padding: 1 bytes - // padding: 4 bytes - N uint32 - Datum int32 + RetVal uint32 + N uint32 + NewMode uint32 // padding: 12 bytes - Data []int32 // size: xgb.Pad((int(N) * 4)) + Data []uint32 // size: xgb.Pad((int(N) * 4)) } -// Reply blocks and returns the reply data for a GetMinmaxParameteriv request. -func (cook GetMinmaxParameterivCookie) Reply() (*GetMinmaxParameterivReply, error) { +// 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 @@ -9407,12 +9487,12 @@ func (cook GetMinmaxParameterivCookie) Reply() (*GetMinmaxParameterivReply, erro if buf == nil { return nil, nil } - return getMinmaxParameterivReply(buf), nil + return renderModeReply(buf), nil } -// getMinmaxParameterivReply reads a byte slice into a GetMinmaxParameterivReply value. -func getMinmaxParameterivReply(buf []byte) *GetMinmaxParameterivReply { - v := new(GetMinmaxParameterivReply) +// 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 @@ -9423,19 +9503,20 @@ func getMinmaxParameterivReply(buf []byte) *GetMinmaxParameterivReply { v.Length = xgb.Get32(buf[b:]) // 4-byte units b += 4 - b += 4 // padding + v.RetVal = xgb.Get32(buf[b:]) + b += 4 v.N = xgb.Get32(buf[b:]) b += 4 - v.Datum = int32(xgb.Get32(buf[b:])) + v.NewMode = xgb.Get32(buf[b:]) b += 4 b += 12 // padding - v.Data = make([]int32, v.N) + v.Data = make([]uint32, v.N) for i := 0; i < int(v.N); i++ { - v.Data[i] = int32(xgb.Get32(buf[b:])) + v.Data[i] = xgb.Get32(buf[b:]) b += 4 } b = xgb.Pad(b) @@ -9443,17 +9524,17 @@ func getMinmaxParameterivReply(buf []byte) *GetMinmaxParameterivReply { return v } -// Write request to wire for GetMinmaxParameteriv -// getMinmaxParameterivRequest writes a GetMinmaxParameteriv request to a byte slice. -func getMinmaxParameterivRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) []byte { - size := 16 +// Write request to wire for RenderMode +// 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] = 159 // request opcode + buf[b] = 107 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units @@ -9462,103 +9543,56 @@ func getMinmaxParameterivRequest(c *xgb.Conn, ContextTag ContextTag, Target uint xgb.Put32(buf[b:], uint32(ContextTag)) b += 4 - xgb.Put32(buf[b:], Target) - b += 4 - - xgb.Put32(buf[b:], Pname) + xgb.Put32(buf[b:], Mode) b += 4 return buf } -// GetCompressedTexImageARBCookie is a cookie used only for GetCompressedTexImageARB requests. -type GetCompressedTexImageARBCookie struct { +// SelectBufferCookie is a cookie used only for SelectBuffer requests. +type SelectBufferCookie struct { *xgb.Cookie } -// 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} -} - -// GetCompressedTexImageARBUnchecked sends an unchecked request. +// SelectBuffer 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 { +func SelectBuffer(c *xgb.Conn, ContextTag ContextTag, Size int32) SelectBufferCookie { if _, ok := c.Extensions["GLX"]; !ok { - panic("Cannot issue request 'GetCompressedTexImageARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'SelectBuffer' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } - cookie := c.NewCookie(false, true) - c.NewRequest(getCompressedTexImageARBRequest(c, ContextTag, Target, Level), cookie) - return GetCompressedTexImageARBCookie{cookie} -} - -// GetCompressedTexImageARBReply represents the data returned from a GetCompressedTexImageARB request. -type GetCompressedTexImageARBReply struct { - Sequence uint16 // sequence number of the request for this reply - Length uint32 // number of bytes in this reply - // padding: 1 bytes - // padding: 8 bytes - Size int32 - // padding: 12 bytes - Data []byte // size: xgb.Pad(((int(Length) * 4) * 1)) + cookie := c.NewCookie(false, false) + c.NewRequest(selectBufferRequest(c, ContextTag, Size), cookie) + return SelectBufferCookie{cookie} } -// 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 +// 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.") } - return getCompressedTexImageARBReply(buf), nil + cookie := c.NewCookie(true, false) + c.NewRequest(selectBufferRequest(c, ContextTag, Size), cookie) + return SelectBufferCookie{cookie} } -// 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 +// 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 GetCompressedTexImageARB -// getCompressedTexImageARBRequest writes a GetCompressedTexImageARB request to a byte slice. -func getCompressedTexImageARBRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Level int32) []byte { - size := 16 +// Write request to wire for SelectBuffer +// 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] = 160 // request opcode + buf[b] = 106 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units @@ -9567,246 +9601,206 @@ func getCompressedTexImageARBRequest(c *xgb.Conn, ContextTag ContextTag, Target xgb.Put32(buf[b:], uint32(ContextTag)) b += 4 - xgb.Put32(buf[b:], Target) - b += 4 - - xgb.Put32(buf[b:], uint32(Level)) + xgb.Put32(buf[b:], uint32(Size)) b += 4 return buf } -// DeleteQueriesARBCookie is a cookie used only for DeleteQueriesARB requests. -type DeleteQueriesARBCookie struct { +// SetClientInfo2ARBCookie is a cookie used only for SetClientInfo2ARB requests. +type SetClientInfo2ARBCookie struct { *xgb.Cookie } -// DeleteQueriesARB sends an unchecked request. +// SetClientInfo2ARB 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 { +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 'DeleteQueriesARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'SetClientInfo2ARB' 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} + c.NewRequest(setClientInfo2ARBRequest(c, MajorVersion, MinorVersion, NumVersions, GlStrLen, GlxStrLen, GlVersions, GlExtensionString, GlxExtensionString), cookie) + return SetClientInfo2ARBCookie{cookie} } -// 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 { +// 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 'DeleteQueriesARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'SetClientInfo2ARB' 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} + c.NewRequest(setClientInfo2ARBRequest(c, MajorVersion, MinorVersion, NumVersions, GlStrLen, GlxStrLen, GlVersions, GlExtensionString, GlxExtensionString), cookie) + return SetClientInfo2ARBCookie{cookie} } // Check returns an error if one occurred for checked requests that are not expecting a reply. // This cannot be called for requests expecting a reply, nor for unchecked requests. -func (cook DeleteQueriesARBCookie) Check() error { +func (cook SetClientInfo2ARBCookie) Check() error { return cook.Cookie.Check() } -// Write request to wire for DeleteQueriesARB -// 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)))) +// Write request to wire for SetClientInfo2ARB +// setClientInfo2ARBRequest writes a SetClientInfo2ARB request to a byte slice. +func setClientInfo2ARBRequest(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32, NumVersions uint32, GlStrLen uint32, GlxStrLen uint32, GlVersions []uint32, GlExtensionString string, GlxExtensionString string) []byte { + size := xgb.Pad((((24 + xgb.Pad(((int(NumVersions) * 3) * 4))) + xgb.Pad((int(GlStrLen) * 1))) + xgb.Pad((int(GlxStrLen) * 1)))) b := 0 buf := make([]byte, size) buf[b] = c.Extensions["GLX"] b += 1 - buf[b] = 161 // request opcode + 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:], uint32(ContextTag)) + xgb.Put32(buf[b:], MajorVersion) b += 4 - xgb.Put32(buf[b:], uint32(N)) + xgb.Put32(buf[b:], MinorVersion) b += 4 - for i := 0; i < int(N); i++ { - xgb.Put32(buf[b:], Ids[i]) + 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 } -// GenQueriesARBCookie is a cookie used only for GenQueriesARB requests. -type GenQueriesARBCookie struct { +// SetClientInfoARBCookie is a cookie used only for SetClientInfoARB requests. +type SetClientInfoARBCookie struct { *xgb.Cookie } -// 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} -} - -// GenQueriesARBUnchecked sends an unchecked request. +// SetClientInfoARB 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 { +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 'GenQueriesARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'SetClientInfoARB' 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} -} - -// GenQueriesARBReply represents the data returned from a GenQueriesARB request. -type GenQueriesARBReply struct { - Sequence uint16 // sequence number of the request for this reply - Length uint32 // number of bytes in this reply - // padding: 1 bytes - // padding: 24 bytes - Data []uint32 // size: xgb.Pad((int(Length) * 4)) + cookie := c.NewCookie(false, false) + c.NewRequest(setClientInfoARBRequest(c, MajorVersion, MinorVersion, NumVersions, GlStrLen, GlxStrLen, GlVersions, GlExtensionString, GlxExtensionString), cookie) + return SetClientInfoARBCookie{cookie} } -// 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 +// 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.") } - return genQueriesARBReply(buf), nil + cookie := c.NewCookie(true, false) + c.NewRequest(setClientInfoARBRequest(c, MajorVersion, MinorVersion, NumVersions, GlStrLen, GlxStrLen, GlVersions, GlExtensionString, GlxExtensionString), cookie) + return SetClientInfoARBCookie{cookie} } -// 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 +// 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 GenQueriesARB -// genQueriesARBRequest writes a GenQueriesARB request to a byte slice. -func genQueriesARBRequest(c *xgb.Conn, ContextTag ContextTag, N int32) []byte { - size := 12 +// Write request to wire for SetClientInfoARB +// setClientInfoARBRequest writes a SetClientInfoARB request to a byte slice. +func setClientInfoARBRequest(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32, NumVersions uint32, GlStrLen uint32, GlxStrLen uint32, GlVersions []uint32, GlExtensionString string, GlxExtensionString string) []byte { + size := xgb.Pad((((24 + xgb.Pad(((int(NumVersions) * 2) * 4))) + xgb.Pad((int(GlStrLen) * 1))) + xgb.Pad((int(GlxStrLen) * 1)))) b := 0 buf := make([]byte, size) buf[b] = c.Extensions["GLX"] b += 1 - buf[b] = 162 // request opcode + 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:], uint32(ContextTag)) + xgb.Put32(buf[b:], MajorVersion) b += 4 - xgb.Put32(buf[b:], uint32(N)) + 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 } -// IsQueryARBCookie is a cookie used only for IsQueryARB requests. -type IsQueryARBCookie struct { +// SwapBuffersCookie is a cookie used only for SwapBuffers requests. +type SwapBuffersCookie struct { *xgb.Cookie } -// 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} -} - -// IsQueryARBUnchecked sends an unchecked request. +// SwapBuffers 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 { +func SwapBuffers(c *xgb.Conn, ContextTag ContextTag, Drawable Drawable) SwapBuffersCookie { if _, ok := c.Extensions["GLX"]; !ok { - panic("Cannot issue request 'IsQueryARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'SwapBuffers' 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} -} - -// IsQueryARBReply represents the data returned from a IsQueryARB request. -type IsQueryARBReply struct { - Sequence uint16 // sequence number of the request for this reply - Length uint32 // number of bytes in this reply - // padding: 1 bytes - RetVal Bool32 + cookie := c.NewCookie(false, false) + c.NewRequest(swapBuffersRequest(c, ContextTag, Drawable), cookie) + return SwapBuffersCookie{cookie} } -// 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 +// 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.") } - return isQueryARBReply(buf), nil + cookie := c.NewCookie(true, false) + c.NewRequest(swapBuffersRequest(c, ContextTag, Drawable), cookie) + return SwapBuffersCookie{cookie} } -// 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 +// 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 IsQueryARB -// isQueryARBRequest writes a IsQueryARB request to a byte slice. -func isQueryARBRequest(c *xgb.Conn, ContextTag ContextTag, Id uint32) []byte { +// Write request to wire for SwapBuffers +// 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) @@ -9814,7 +9808,7 @@ func isQueryARBRequest(c *xgb.Conn, ContextTag ContextTag, Id uint32) []byte { buf[b] = c.Extensions["GLX"] b += 1 - buf[b] = 163 // request opcode + buf[b] = 11 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units @@ -9823,165 +9817,179 @@ func isQueryARBRequest(c *xgb.Conn, ContextTag ContextTag, Id uint32) []byte { xgb.Put32(buf[b:], uint32(ContextTag)) b += 4 - xgb.Put32(buf[b:], Id) + xgb.Put32(buf[b:], uint32(Drawable)) b += 4 return buf } -// GetQueryivARBCookie is a cookie used only for GetQueryivARB requests. -type GetQueryivARBCookie struct { +// UseXFontCookie is a cookie used only for UseXFont requests. +type UseXFontCookie struct { *xgb.Cookie } -// 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 { +// 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 'GetQueryivARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'UseXFont' 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} + cookie := c.NewCookie(false, false) + c.NewRequest(useXFontRequest(c, ContextTag, Font, First, Count, ListBase), cookie) + return UseXFontCookie{cookie} } -// 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 { +// 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 'GetQueryivARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'UseXFont' 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} + cookie := c.NewCookie(true, false) + c.NewRequest(useXFontRequest(c, ContextTag, Font, First, Count, ListBase), cookie) + return UseXFontCookie{cookie} } -// GetQueryivARBReply represents the data returned from a GetQueryivARB request. -type GetQueryivARBReply struct { - Sequence uint16 // sequence number of the request for this reply - Length uint32 // number of bytes in this reply - // padding: 1 bytes - // padding: 4 bytes - N uint32 - Datum int32 - // padding: 12 bytes - Data []int32 // size: xgb.Pad((int(N) * 4)) +// 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() } -// 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 -} +// Write request to wire for UseXFont +// 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) -// getQueryivARBReply reads a byte slice into a GetQueryivARBReply value. -func getQueryivARBReply(buf []byte) *GetQueryivARBReply { - v := new(GetQueryivARBReply) - b := 1 // skip reply determinant + buf[b] = c.Extensions["GLX"] + b += 1 - b += 1 // padding + buf[b] = 12 // request opcode + b += 1 - v.Sequence = xgb.Get16(buf[b:]) + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 - v.Length = xgb.Get32(buf[b:]) // 4-byte units + xgb.Put32(buf[b:], uint32(ContextTag)) b += 4 - b += 4 // padding + xgb.Put32(buf[b:], uint32(Font)) + b += 4 - v.N = xgb.Get32(buf[b:]) + xgb.Put32(buf[b:], First) b += 4 - v.Datum = int32(xgb.Get32(buf[b:])) + xgb.Put32(buf[b:], Count) b += 4 - b += 12 // padding + xgb.Put32(buf[b:], ListBase) + b += 4 - v.Data = make([]int32, v.N) - for i := 0; i < int(v.N); i++ { - v.Data[i] = int32(xgb.Get32(buf[b:])) - b += 4 + return buf +} + +// VendorPrivateCookie is a cookie used only for VendorPrivate requests. +type VendorPrivateCookie struct { + *xgb.Cookie +} + +// VendorPrivate sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. +func VendorPrivate(c *xgb.Conn, VendorCode uint32, ContextTag ContextTag, Data []byte) VendorPrivateCookie { + if _, ok := c.Extensions["GLX"]; !ok { + panic("Cannot issue request 'VendorPrivate' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") } - b = xgb.Pad(b) + cookie := c.NewCookie(false, false) + c.NewRequest(vendorPrivateRequest(c, VendorCode, ContextTag, Data), cookie) + return VendorPrivateCookie{cookie} +} - return v +// 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} } -// Write request to wire for GetQueryivARB -// getQueryivARBRequest writes a GetQueryivARB request to a byte slice. -func getQueryivARBRequest(c *xgb.Conn, ContextTag ContextTag, Target uint32, Pname uint32) []byte { - size := 16 +// 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 +// 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] = 164 // request opcode + 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:], uint32(ContextTag)) + xgb.Put32(buf[b:], VendorCode) b += 4 - xgb.Put32(buf[b:], Target) + xgb.Put32(buf[b:], uint32(ContextTag)) b += 4 - xgb.Put32(buf[b:], Pname) - b += 4 + copy(buf[b:], Data[:len(Data)]) + b += xgb.Pad(int(len(Data))) return buf } -// GetQueryObjectivARBCookie is a cookie used only for GetQueryObjectivARB requests. -type GetQueryObjectivARBCookie struct { +// VendorPrivateWithReplyCookie is a cookie used only for VendorPrivateWithReply requests. +type VendorPrivateWithReplyCookie struct { *xgb.Cookie } -// 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 { +// 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 'GetQueryObjectivARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'VendorPrivateWithReply' 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} + c.NewRequest(vendorPrivateWithReplyRequest(c, VendorCode, ContextTag, Data), cookie) + return VendorPrivateWithReplyCookie{cookie} } -// GetQueryObjectivARBUnchecked sends an unchecked request. +// VendorPrivateWithReplyUnchecked 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 { +func VendorPrivateWithReplyUnchecked(c *xgb.Conn, VendorCode uint32, ContextTag ContextTag, Data []byte) VendorPrivateWithReplyCookie { if _, ok := c.Extensions["GLX"]; !ok { - panic("Cannot issue request 'GetQueryObjectivARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'VendorPrivateWithReply' 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} + c.NewRequest(vendorPrivateWithReplyRequest(c, VendorCode, ContextTag, Data), cookie) + return VendorPrivateWithReplyCookie{cookie} } -// GetQueryObjectivARBReply represents the data returned from a GetQueryObjectivARB request. -type GetQueryObjectivARBReply struct { +// VendorPrivateWithReplyReply represents the data returned from a VendorPrivateWithReply request. +type VendorPrivateWithReplyReply struct { Sequence uint16 // sequence number of the request for this reply Length uint32 // number of bytes in this reply // padding: 1 bytes - // padding: 4 bytes - N uint32 - Datum int32 - // padding: 12 bytes - Data []int32 // size: xgb.Pad((int(N) * 4)) + Retval uint32 + Data1 []byte // size: 24 + Data2 []byte // size: xgb.Pad(((int(Length) * 4) * 1)) } -// Reply blocks and returns the reply data for a GetQueryObjectivARB request. -func (cook GetQueryObjectivARBCookie) Reply() (*GetQueryObjectivARBReply, error) { +// 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 @@ -9989,12 +9997,12 @@ func (cook GetQueryObjectivARBCookie) Reply() (*GetQueryObjectivARBReply, error) if buf == nil { return nil, nil } - return getQueryObjectivARBReply(buf), nil + return vendorPrivateWithReplyReply(buf), nil } -// getQueryObjectivARBReply reads a byte slice into a GetQueryObjectivARBReply value. -func getQueryObjectivARBReply(buf []byte) *GetQueryObjectivARBReply { - v := new(GetQueryObjectivARBReply) +// 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 @@ -10005,149 +10013,147 @@ func getQueryObjectivARBReply(buf []byte) *GetQueryObjectivARBReply { 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:])) + v.Retval = xgb.Get32(buf[b:]) b += 4 - b += 12 // padding + v.Data1 = make([]byte, 24) + copy(v.Data1[:24], buf[b:]) + b += xgb.Pad(int(24)) - 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) + 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 GetQueryObjectivARB -// getQueryObjectivARBRequest writes a GetQueryObjectivARB request to a byte slice. -func getQueryObjectivARBRequest(c *xgb.Conn, ContextTag ContextTag, Id uint32, Pname uint32) []byte { - size := 16 +// Write request to wire for VendorPrivateWithReply +// 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] = 165 // request opcode + 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:], uint32(ContextTag)) + xgb.Put32(buf[b:], VendorCode) b += 4 - xgb.Put32(buf[b:], Id) + xgb.Put32(buf[b:], uint32(ContextTag)) b += 4 - xgb.Put32(buf[b:], Pname) - b += 4 + copy(buf[b:], Data[:len(Data)]) + b += xgb.Pad(int(len(Data))) return buf } -// GetQueryObjectuivARBCookie is a cookie used only for GetQueryObjectuivARB requests. -type GetQueryObjectuivARBCookie struct { +// WaitGLCookie is a cookie used only for WaitGL requests. +type WaitGLCookie struct { *xgb.Cookie } -// 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 { +// 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 'GetQueryObjectuivARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'WaitGL' 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} + cookie := c.NewCookie(false, false) + c.NewRequest(waitGLRequest(c, ContextTag), cookie) + return WaitGLCookie{cookie} } -// 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 { +// 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 'GetQueryObjectuivARB' using the uninitialized extension 'GLX'. glx.Init(connObj) must be called first.") + panic("Cannot issue request 'WaitGL' 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} + cookie := c.NewCookie(true, false) + c.NewRequest(waitGLRequest(c, ContextTag), cookie) + return WaitGLCookie{cookie} } -// GetQueryObjectuivARBReply represents the data returned from a GetQueryObjectuivARB request. -type GetQueryObjectuivARBReply struct { - Sequence uint16 // sequence number of the request for this reply - Length uint32 // number of bytes in this reply - // padding: 1 bytes - // padding: 4 bytes - N uint32 - Datum uint32 - // padding: 12 bytes - Data []uint32 // size: xgb.Pad((int(N) * 4)) +// 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() } -// 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 -} +// Write request to wire for WaitGL +// 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) -// getQueryObjectuivARBReply reads a byte slice into a GetQueryObjectuivARBReply value. -func getQueryObjectuivARBReply(buf []byte) *GetQueryObjectuivARBReply { - v := new(GetQueryObjectuivARBReply) - b := 1 // skip reply determinant + buf[b] = c.Extensions["GLX"] + b += 1 - b += 1 // padding + buf[b] = 8 // request opcode + b += 1 - v.Sequence = xgb.Get16(buf[b:]) + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 - v.Length = xgb.Get32(buf[b:]) // 4-byte units + xgb.Put32(buf[b:], uint32(ContextTag)) b += 4 - b += 4 // padding - - v.N = xgb.Get32(buf[b:]) - b += 4 + return buf +} - v.Datum = xgb.Get32(buf[b:]) - b += 4 +// WaitXCookie is a cookie used only for WaitX requests. +type WaitXCookie struct { + *xgb.Cookie +} - b += 12 // padding +// 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} +} - v.Data = make([]uint32, v.N) - for i := 0; i < int(v.N); i++ { - v.Data[i] = xgb.Get32(buf[b:]) - b += 4 +// 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.") } - b = xgb.Pad(b) + cookie := c.NewCookie(true, false) + c.NewRequest(waitXRequest(c, ContextTag), cookie) + return WaitXCookie{cookie} +} - return v +// 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 GetQueryObjectuivARB -// getQueryObjectuivARBRequest writes a GetQueryObjectuivARB request to a byte slice. -func getQueryObjectuivARBRequest(c *xgb.Conn, ContextTag ContextTag, Id uint32, Pname uint32) []byte { - size := 16 +// Write request to wire for WaitX +// 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] = 166 // request opcode + buf[b] = 9 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units @@ -10156,11 +10162,5 @@ func getQueryObjectuivARBRequest(c *xgb.Conn, ContextTag ContextTag, Id uint32, xgb.Put32(buf[b:], uint32(ContextTag)) b += 4 - xgb.Put32(buf[b:], Id) - b += 4 - - xgb.Put32(buf[b:], Pname) - b += 4 - return buf } |