From 0c50dc6241fa21712e041cfa2bfb9db4ccaef10a Mon Sep 17 00:00:00 2001 From: "Andrew Gallant (Ocelot)" Date: Thu, 10 May 2012 17:01:42 -0400 Subject: a huge commit. splitting extensions into their own sub-packages. --- nexgb/render/render.go | 3542 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 3542 insertions(+) create mode 100644 nexgb/render/render.go (limited to 'nexgb/render') diff --git a/nexgb/render/render.go b/nexgb/render/render.go new file mode 100644 index 0000000..a939ed9 --- /dev/null +++ b/nexgb/render/render.go @@ -0,0 +1,3542 @@ +package render + +/* + This file was generated by render.xml on May 10 2012 4:20:28pm EDT. + This file is automatically generated. Edit at your peril! +*/ + +import ( + "github.com/BurntSushi/xgb" + + "github.com/BurntSushi/xgb/xproto" +) + +// Init must be called before using the RENDER extension. +func Init(c *xgb.Conn) error { + reply, err := xproto.QueryExtension(c, 6, "RENDER").Reply() + switch { + case err != nil: + return err + case !reply.Present: + return xgb.Errorf("No extension named RENDER could be found on on the server.") + } + + xgb.ExtLock.Lock() + c.Extensions["RENDER"] = reply.MajorOpcode + for evNum, fun := range xgb.NewExtEventFuncs["RENDER"] { + xgb.NewEventFuncs[int(reply.FirstEvent)+evNum] = fun + } + for errNum, fun := range xgb.NewExtErrorFuncs["RENDER"] { + xgb.NewErrorFuncs[int(reply.FirstError)+errNum] = fun + } + xgb.ExtLock.Unlock() + + return nil +} + +func init() { + xgb.NewExtEventFuncs["RENDER"] = make(map[int]xgb.NewEventFun) + xgb.NewExtErrorFuncs["RENDER"] = make(map[int]xgb.NewErrorFun) +} + +// 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' + +// Skipping definition for base type 'Card8' + +// Skipping definition for base type 'Int16' + +const ( + PictTypeIndexed = 0 + PictTypeDirect = 1 +) + +const ( + PictureNone = 0 +) + +const ( + PictOpClear = 0 + PictOpSrc = 1 + PictOpDst = 2 + PictOpOver = 3 + PictOpOverReverse = 4 + PictOpIn = 5 + PictOpInReverse = 6 + PictOpOut = 7 + PictOpOutReverse = 8 + PictOpAtop = 9 + PictOpAtopReverse = 10 + PictOpXor = 11 + PictOpAdd = 12 + PictOpSaturate = 13 + PictOpDisjointClear = 16 + PictOpDisjointSrc = 17 + PictOpDisjointDst = 18 + PictOpDisjointOver = 19 + PictOpDisjointOverReverse = 20 + PictOpDisjointIn = 21 + PictOpDisjointInReverse = 22 + PictOpDisjointOut = 23 + PictOpDisjointOutReverse = 24 + PictOpDisjointAtop = 25 + PictOpDisjointAtopReverse = 26 + PictOpDisjointXor = 27 + PictOpConjointClear = 32 + PictOpConjointSrc = 33 + PictOpConjointDst = 34 + PictOpConjointOver = 35 + PictOpConjointOverReverse = 36 + PictOpConjointIn = 37 + PictOpConjointInReverse = 38 + PictOpConjointOut = 39 + PictOpConjointOutReverse = 40 + PictOpConjointAtop = 41 + PictOpConjointAtopReverse = 42 + PictOpConjointXor = 43 + PictOpMultiply = 48 + PictOpScreen = 49 + PictOpOverlay = 50 + PictOpDarken = 51 + PictOpLighten = 52 + PictOpColorDodge = 53 + PictOpColorBurn = 54 + PictOpHardLight = 55 + PictOpSoftLight = 56 + PictOpDifference = 57 + PictOpExclusion = 58 + PictOpHSLHue = 59 + PictOpHSLSaturation = 60 + PictOpHSLColor = 61 + PictOpHSLLuminosity = 62 +) + +const ( + PolyEdgeSharp = 0 + PolyEdgeSmooth = 1 +) + +const ( + PolyModePrecise = 0 + PolyModeImprecise = 1 +) + +const ( + CpRepeat = 1 + CpAlphaMap = 2 + CpAlphaXOrigin = 4 + CpAlphaYOrigin = 8 + CpClipXOrigin = 16 + CpClipYOrigin = 32 + CpClipMask = 64 + CpGraphicsExposure = 128 + CpSubwindowMode = 256 + CpPolyEdge = 512 + CpPolyMode = 1024 + CpDither = 2048 + CpComponentAlpha = 4096 +) + +const ( + SubPixelUnknown = 0 + SubPixelHorizontalRGB = 1 + SubPixelHorizontalBGR = 2 + SubPixelVerticalRGB = 3 + SubPixelVerticalBGR = 4 + SubPixelNone = 5 +) + +const ( + RepeatNone = 0 + RepeatNormal = 1 + RepeatPad = 2 + RepeatReflect = 3 +) + +type Glyphset uint32 + +func NewGlyphsetId(c *xgb.Conn) (Glyphset, error) { + id, err := c.NewId() + if err != nil { + return 0, err + } + return Glyphset(id), nil +} + +type Picture uint32 + +func NewPictureId(c *xgb.Conn) (Picture, error) { + id, err := c.NewId() + if err != nil { + return 0, err + } + return Picture(id), nil +} + +type Pictformat uint32 + +func NewPictformatId(c *xgb.Conn) (Pictformat, error) { + id, err := c.NewId() + if err != nil { + return 0, err + } + return Pictformat(id), nil +} + +type Glyph uint32 + +type Fixed int32 + +// 'Directformat' struct definition +// Size: 16 +type Directformat struct { + RedShift uint16 + RedMask uint16 + GreenShift uint16 + GreenMask uint16 + BlueShift uint16 + BlueMask uint16 + AlphaShift uint16 + AlphaMask uint16 +} + +// Struct read Directformat +func DirectformatRead(buf []byte, v *Directformat) int { + b := 0 + + v.RedShift = xgb.Get16(buf[b:]) + b += 2 + + v.RedMask = xgb.Get16(buf[b:]) + b += 2 + + v.GreenShift = xgb.Get16(buf[b:]) + b += 2 + + v.GreenMask = xgb.Get16(buf[b:]) + b += 2 + + v.BlueShift = xgb.Get16(buf[b:]) + b += 2 + + v.BlueMask = xgb.Get16(buf[b:]) + b += 2 + + v.AlphaShift = xgb.Get16(buf[b:]) + b += 2 + + v.AlphaMask = xgb.Get16(buf[b:]) + b += 2 + + return b +} + +// Struct list read Directformat +func DirectformatReadList(buf []byte, dest []Directformat) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = Directformat{} + b += DirectformatRead(buf[b:], &dest[i]) + } + return xgb.Pad(b) +} + +// Struct write Directformat +func (v Directformat) Bytes() []byte { + buf := make([]byte, 16) + b := 0 + + xgb.Put16(buf[b:], v.RedShift) + b += 2 + + xgb.Put16(buf[b:], v.RedMask) + b += 2 + + xgb.Put16(buf[b:], v.GreenShift) + b += 2 + + xgb.Put16(buf[b:], v.GreenMask) + b += 2 + + xgb.Put16(buf[b:], v.BlueShift) + b += 2 + + xgb.Put16(buf[b:], v.BlueMask) + b += 2 + + xgb.Put16(buf[b:], v.AlphaShift) + b += 2 + + xgb.Put16(buf[b:], v.AlphaMask) + b += 2 + + return buf +} + +// Write struct list Directformat +func DirectformatListBytes(buf []byte, list []Directformat) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } + return b +} + +// 'Pictforminfo' struct definition +// Size: 28 +type Pictforminfo struct { + Id Pictformat + Type byte + Depth byte + // padding: 2 bytes + Direct Directformat + Colormap xproto.Colormap +} + +// Struct read Pictforminfo +func PictforminfoRead(buf []byte, v *Pictforminfo) int { + b := 0 + + v.Id = Pictformat(xgb.Get32(buf[b:])) + b += 4 + + v.Type = buf[b] + b += 1 + + v.Depth = buf[b] + b += 1 + + b += 2 // padding + + v.Direct = Directformat{} + b += DirectformatRead(buf[b:], &v.Direct) + + v.Colormap = xproto.Colormap(xgb.Get32(buf[b:])) + b += 4 + + return b +} + +// Struct list read Pictforminfo +func PictforminfoReadList(buf []byte, dest []Pictforminfo) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = Pictforminfo{} + b += PictforminfoRead(buf[b:], &dest[i]) + } + return xgb.Pad(b) +} + +// Struct write Pictforminfo +func (v Pictforminfo) Bytes() []byte { + buf := make([]byte, 28) + b := 0 + + xgb.Put32(buf[b:], uint32(v.Id)) + b += 4 + + buf[b] = v.Type + b += 1 + + buf[b] = v.Depth + b += 1 + + b += 2 // padding + + { + structBytes := v.Direct.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } + + xgb.Put32(buf[b:], uint32(v.Colormap)) + b += 4 + + return buf +} + +// Write struct list Pictforminfo +func PictforminfoListBytes(buf []byte, list []Pictforminfo) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } + return b +} + +// 'Pictvisual' struct definition +// Size: 8 +type Pictvisual struct { + Visual xproto.Visualid + Format Pictformat +} + +// Struct read Pictvisual +func PictvisualRead(buf []byte, v *Pictvisual) int { + b := 0 + + v.Visual = xproto.Visualid(xgb.Get32(buf[b:])) + b += 4 + + v.Format = Pictformat(xgb.Get32(buf[b:])) + b += 4 + + return b +} + +// Struct list read Pictvisual +func PictvisualReadList(buf []byte, dest []Pictvisual) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = Pictvisual{} + b += PictvisualRead(buf[b:], &dest[i]) + } + return xgb.Pad(b) +} + +// Struct write Pictvisual +func (v Pictvisual) Bytes() []byte { + buf := make([]byte, 8) + b := 0 + + xgb.Put32(buf[b:], uint32(v.Visual)) + b += 4 + + xgb.Put32(buf[b:], uint32(v.Format)) + b += 4 + + return buf +} + +// Write struct list Pictvisual +func PictvisualListBytes(buf []byte, list []Pictvisual) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } + return b +} + +// 'Pictdepth' struct definition +// Size: (8 + xgb.Pad((int(NumVisuals) * 8))) +type Pictdepth struct { + Depth byte + // padding: 1 bytes + NumVisuals uint16 + // padding: 4 bytes + Visuals []Pictvisual // size: xgb.Pad((int(NumVisuals) * 8)) +} + +// Struct read Pictdepth +func PictdepthRead(buf []byte, v *Pictdepth) int { + b := 0 + + v.Depth = buf[b] + b += 1 + + b += 1 // padding + + v.NumVisuals = xgb.Get16(buf[b:]) + b += 2 + + b += 4 // padding + + v.Visuals = make([]Pictvisual, v.NumVisuals) + b += PictvisualReadList(buf[b:], v.Visuals) + + return b +} + +// Struct list read Pictdepth +func PictdepthReadList(buf []byte, dest []Pictdepth) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = Pictdepth{} + b += PictdepthRead(buf[b:], &dest[i]) + } + return xgb.Pad(b) +} + +// Struct write Pictdepth +func (v Pictdepth) Bytes() []byte { + buf := make([]byte, (8 + xgb.Pad((int(v.NumVisuals) * 8)))) + b := 0 + + buf[b] = v.Depth + b += 1 + + b += 1 // padding + + xgb.Put16(buf[b:], v.NumVisuals) + b += 2 + + b += 4 // padding + + b += PictvisualListBytes(buf[b:], v.Visuals) + + return buf +} + +// Write struct list Pictdepth +func PictdepthListBytes(buf []byte, list []Pictdepth) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } + return b +} + +// Struct list size Pictdepth +func PictdepthListSize(list []Pictdepth) int { + size := 0 + for _, item := range list { + size += (8 + xgb.Pad((int(item.NumVisuals) * 8))) + } + return size +} + +// 'Pictscreen' struct definition +// Size: (8 + PictdepthListSize(Depths)) +type Pictscreen struct { + NumDepths uint32 + Fallback Pictformat + Depths []Pictdepth // size: PictdepthListSize(Depths) +} + +// Struct read Pictscreen +func PictscreenRead(buf []byte, v *Pictscreen) int { + b := 0 + + v.NumDepths = xgb.Get32(buf[b:]) + b += 4 + + v.Fallback = Pictformat(xgb.Get32(buf[b:])) + b += 4 + + v.Depths = make([]Pictdepth, v.NumDepths) + b += PictdepthReadList(buf[b:], v.Depths) + + return b +} + +// Struct list read Pictscreen +func PictscreenReadList(buf []byte, dest []Pictscreen) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = Pictscreen{} + b += PictscreenRead(buf[b:], &dest[i]) + } + return xgb.Pad(b) +} + +// Struct write Pictscreen +func (v Pictscreen) Bytes() []byte { + buf := make([]byte, (8 + PictdepthListSize(v.Depths))) + b := 0 + + xgb.Put32(buf[b:], v.NumDepths) + b += 4 + + xgb.Put32(buf[b:], uint32(v.Fallback)) + b += 4 + + b += PictdepthListBytes(buf[b:], v.Depths) + + return buf +} + +// Write struct list Pictscreen +func PictscreenListBytes(buf []byte, list []Pictscreen) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } + return b +} + +// Struct list size Pictscreen +func PictscreenListSize(list []Pictscreen) int { + size := 0 + for _, item := range list { + size += (8 + PictdepthListSize(item.Depths)) + } + return size +} + +// 'Indexvalue' struct definition +// Size: 12 +type Indexvalue struct { + Pixel uint32 + Red uint16 + Green uint16 + Blue uint16 + Alpha uint16 +} + +// Struct read Indexvalue +func IndexvalueRead(buf []byte, v *Indexvalue) int { + b := 0 + + v.Pixel = xgb.Get32(buf[b:]) + b += 4 + + v.Red = xgb.Get16(buf[b:]) + b += 2 + + v.Green = xgb.Get16(buf[b:]) + b += 2 + + v.Blue = xgb.Get16(buf[b:]) + b += 2 + + v.Alpha = xgb.Get16(buf[b:]) + b += 2 + + return b +} + +// Struct list read Indexvalue +func IndexvalueReadList(buf []byte, dest []Indexvalue) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = Indexvalue{} + b += IndexvalueRead(buf[b:], &dest[i]) + } + return xgb.Pad(b) +} + +// Struct write Indexvalue +func (v Indexvalue) Bytes() []byte { + buf := make([]byte, 12) + b := 0 + + xgb.Put32(buf[b:], v.Pixel) + b += 4 + + xgb.Put16(buf[b:], v.Red) + b += 2 + + xgb.Put16(buf[b:], v.Green) + b += 2 + + xgb.Put16(buf[b:], v.Blue) + b += 2 + + xgb.Put16(buf[b:], v.Alpha) + b += 2 + + return buf +} + +// Write struct list Indexvalue +func IndexvalueListBytes(buf []byte, list []Indexvalue) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } + return b +} + +// 'Color' struct definition +// Size: 8 +type Color struct { + Red uint16 + Green uint16 + Blue uint16 + Alpha uint16 +} + +// Struct read Color +func ColorRead(buf []byte, v *Color) int { + b := 0 + + v.Red = xgb.Get16(buf[b:]) + b += 2 + + v.Green = xgb.Get16(buf[b:]) + b += 2 + + v.Blue = xgb.Get16(buf[b:]) + b += 2 + + v.Alpha = xgb.Get16(buf[b:]) + b += 2 + + return b +} + +// Struct list read Color +func ColorReadList(buf []byte, dest []Color) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = Color{} + b += ColorRead(buf[b:], &dest[i]) + } + return xgb.Pad(b) +} + +// Struct write Color +func (v Color) Bytes() []byte { + buf := make([]byte, 8) + b := 0 + + xgb.Put16(buf[b:], v.Red) + b += 2 + + xgb.Put16(buf[b:], v.Green) + b += 2 + + xgb.Put16(buf[b:], v.Blue) + b += 2 + + xgb.Put16(buf[b:], v.Alpha) + b += 2 + + return buf +} + +// Write struct list Color +func ColorListBytes(buf []byte, list []Color) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } + return b +} + +// 'Pointfix' struct definition +// Size: 8 +type Pointfix struct { + X Fixed + Y Fixed +} + +// Struct read Pointfix +func PointfixRead(buf []byte, v *Pointfix) int { + b := 0 + + v.X = Fixed(xgb.Get32(buf[b:])) + b += 4 + + v.Y = Fixed(xgb.Get32(buf[b:])) + b += 4 + + return b +} + +// Struct list read Pointfix +func PointfixReadList(buf []byte, dest []Pointfix) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = Pointfix{} + b += PointfixRead(buf[b:], &dest[i]) + } + return xgb.Pad(b) +} + +// Struct write Pointfix +func (v Pointfix) Bytes() []byte { + buf := make([]byte, 8) + b := 0 + + xgb.Put32(buf[b:], uint32(v.X)) + b += 4 + + xgb.Put32(buf[b:], uint32(v.Y)) + b += 4 + + return buf +} + +// Write struct list Pointfix +func PointfixListBytes(buf []byte, list []Pointfix) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } + return b +} + +// 'Linefix' struct definition +// Size: 16 +type Linefix struct { + P1 Pointfix + P2 Pointfix +} + +// Struct read Linefix +func LinefixRead(buf []byte, v *Linefix) int { + b := 0 + + v.P1 = Pointfix{} + b += PointfixRead(buf[b:], &v.P1) + + v.P2 = Pointfix{} + b += PointfixRead(buf[b:], &v.P2) + + return b +} + +// Struct list read Linefix +func LinefixReadList(buf []byte, dest []Linefix) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = Linefix{} + b += LinefixRead(buf[b:], &dest[i]) + } + return xgb.Pad(b) +} + +// Struct write Linefix +func (v Linefix) Bytes() []byte { + buf := make([]byte, 16) + b := 0 + + { + structBytes := v.P1.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } + + { + structBytes := v.P2.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } + + return buf +} + +// Write struct list Linefix +func LinefixListBytes(buf []byte, list []Linefix) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } + return b +} + +// 'Triangle' struct definition +// Size: 24 +type Triangle struct { + P1 Pointfix + P2 Pointfix + P3 Pointfix +} + +// Struct read Triangle +func TriangleRead(buf []byte, v *Triangle) int { + b := 0 + + v.P1 = Pointfix{} + b += PointfixRead(buf[b:], &v.P1) + + v.P2 = Pointfix{} + b += PointfixRead(buf[b:], &v.P2) + + v.P3 = Pointfix{} + b += PointfixRead(buf[b:], &v.P3) + + return b +} + +// Struct list read Triangle +func TriangleReadList(buf []byte, dest []Triangle) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = Triangle{} + b += TriangleRead(buf[b:], &dest[i]) + } + return xgb.Pad(b) +} + +// Struct write Triangle +func (v Triangle) Bytes() []byte { + buf := make([]byte, 24) + b := 0 + + { + structBytes := v.P1.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } + + { + structBytes := v.P2.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } + + { + structBytes := v.P3.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } + + return buf +} + +// Write struct list Triangle +func TriangleListBytes(buf []byte, list []Triangle) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } + return b +} + +// 'Trapezoid' struct definition +// Size: 40 +type Trapezoid struct { + Top Fixed + Bottom Fixed + Left Linefix + Right Linefix +} + +// Struct read Trapezoid +func TrapezoidRead(buf []byte, v *Trapezoid) int { + b := 0 + + v.Top = Fixed(xgb.Get32(buf[b:])) + b += 4 + + v.Bottom = Fixed(xgb.Get32(buf[b:])) + b += 4 + + v.Left = Linefix{} + b += LinefixRead(buf[b:], &v.Left) + + v.Right = Linefix{} + b += LinefixRead(buf[b:], &v.Right) + + return b +} + +// Struct list read Trapezoid +func TrapezoidReadList(buf []byte, dest []Trapezoid) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = Trapezoid{} + b += TrapezoidRead(buf[b:], &dest[i]) + } + return xgb.Pad(b) +} + +// Struct write Trapezoid +func (v Trapezoid) Bytes() []byte { + buf := make([]byte, 40) + b := 0 + + xgb.Put32(buf[b:], uint32(v.Top)) + b += 4 + + xgb.Put32(buf[b:], uint32(v.Bottom)) + b += 4 + + { + structBytes := v.Left.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } + + { + structBytes := v.Right.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } + + return buf +} + +// Write struct list Trapezoid +func TrapezoidListBytes(buf []byte, list []Trapezoid) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } + return b +} + +// 'Glyphinfo' struct definition +// Size: 12 +type Glyphinfo struct { + Width uint16 + Height uint16 + X int16 + Y int16 + XOff int16 + YOff int16 +} + +// Struct read Glyphinfo +func GlyphinfoRead(buf []byte, v *Glyphinfo) int { + b := 0 + + v.Width = xgb.Get16(buf[b:]) + b += 2 + + v.Height = xgb.Get16(buf[b:]) + b += 2 + + v.X = int16(xgb.Get16(buf[b:])) + b += 2 + + v.Y = int16(xgb.Get16(buf[b:])) + b += 2 + + v.XOff = int16(xgb.Get16(buf[b:])) + b += 2 + + v.YOff = int16(xgb.Get16(buf[b:])) + b += 2 + + return b +} + +// Struct list read Glyphinfo +func GlyphinfoReadList(buf []byte, dest []Glyphinfo) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = Glyphinfo{} + b += GlyphinfoRead(buf[b:], &dest[i]) + } + return xgb.Pad(b) +} + +// Struct write Glyphinfo +func (v Glyphinfo) Bytes() []byte { + buf := make([]byte, 12) + b := 0 + + xgb.Put16(buf[b:], v.Width) + b += 2 + + xgb.Put16(buf[b:], v.Height) + b += 2 + + xgb.Put16(buf[b:], uint16(v.X)) + b += 2 + + xgb.Put16(buf[b:], uint16(v.Y)) + b += 2 + + xgb.Put16(buf[b:], uint16(v.XOff)) + b += 2 + + xgb.Put16(buf[b:], uint16(v.YOff)) + b += 2 + + return buf +} + +// Write struct list Glyphinfo +func GlyphinfoListBytes(buf []byte, list []Glyphinfo) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } + return b +} + +// 'Transform' struct definition +// Size: 36 +type Transform struct { + Matrix11 Fixed + Matrix12 Fixed + Matrix13 Fixed + Matrix21 Fixed + Matrix22 Fixed + Matrix23 Fixed + Matrix31 Fixed + Matrix32 Fixed + Matrix33 Fixed +} + +// Struct read Transform +func TransformRead(buf []byte, v *Transform) int { + b := 0 + + v.Matrix11 = Fixed(xgb.Get32(buf[b:])) + b += 4 + + v.Matrix12 = Fixed(xgb.Get32(buf[b:])) + b += 4 + + v.Matrix13 = Fixed(xgb.Get32(buf[b:])) + b += 4 + + v.Matrix21 = Fixed(xgb.Get32(buf[b:])) + b += 4 + + v.Matrix22 = Fixed(xgb.Get32(buf[b:])) + b += 4 + + v.Matrix23 = Fixed(xgb.Get32(buf[b:])) + b += 4 + + v.Matrix31 = Fixed(xgb.Get32(buf[b:])) + b += 4 + + v.Matrix32 = Fixed(xgb.Get32(buf[b:])) + b += 4 + + v.Matrix33 = Fixed(xgb.Get32(buf[b:])) + b += 4 + + return b +} + +// Struct list read Transform +func TransformReadList(buf []byte, dest []Transform) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = Transform{} + b += TransformRead(buf[b:], &dest[i]) + } + return xgb.Pad(b) +} + +// Struct write Transform +func (v Transform) Bytes() []byte { + buf := make([]byte, 36) + b := 0 + + xgb.Put32(buf[b:], uint32(v.Matrix11)) + b += 4 + + xgb.Put32(buf[b:], uint32(v.Matrix12)) + b += 4 + + xgb.Put32(buf[b:], uint32(v.Matrix13)) + b += 4 + + xgb.Put32(buf[b:], uint32(v.Matrix21)) + b += 4 + + xgb.Put32(buf[b:], uint32(v.Matrix22)) + b += 4 + + xgb.Put32(buf[b:], uint32(v.Matrix23)) + b += 4 + + xgb.Put32(buf[b:], uint32(v.Matrix31)) + b += 4 + + xgb.Put32(buf[b:], uint32(v.Matrix32)) + b += 4 + + xgb.Put32(buf[b:], uint32(v.Matrix33)) + b += 4 + + return buf +} + +// Write struct list Transform +func TransformListBytes(buf []byte, list []Transform) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } + return b +} + +// 'Animcursorelt' struct definition +// Size: 8 +type Animcursorelt struct { + Cursor xproto.Cursor + Delay uint32 +} + +// Struct read Animcursorelt +func AnimcursoreltRead(buf []byte, v *Animcursorelt) int { + b := 0 + + v.Cursor = xproto.Cursor(xgb.Get32(buf[b:])) + b += 4 + + v.Delay = xgb.Get32(buf[b:]) + b += 4 + + return b +} + +// Struct list read Animcursorelt +func AnimcursoreltReadList(buf []byte, dest []Animcursorelt) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = Animcursorelt{} + b += AnimcursoreltRead(buf[b:], &dest[i]) + } + return xgb.Pad(b) +} + +// Struct write Animcursorelt +func (v Animcursorelt) Bytes() []byte { + buf := make([]byte, 8) + b := 0 + + xgb.Put32(buf[b:], uint32(v.Cursor)) + b += 4 + + xgb.Put32(buf[b:], v.Delay) + b += 4 + + return buf +} + +// Write struct list Animcursorelt +func AnimcursoreltListBytes(buf []byte, list []Animcursorelt) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } + return b +} + +// 'Spanfix' struct definition +// Size: 12 +type Spanfix struct { + L Fixed + R Fixed + Y Fixed +} + +// Struct read Spanfix +func SpanfixRead(buf []byte, v *Spanfix) int { + b := 0 + + v.L = Fixed(xgb.Get32(buf[b:])) + b += 4 + + v.R = Fixed(xgb.Get32(buf[b:])) + b += 4 + + v.Y = Fixed(xgb.Get32(buf[b:])) + b += 4 + + return b +} + +// Struct list read Spanfix +func SpanfixReadList(buf []byte, dest []Spanfix) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = Spanfix{} + b += SpanfixRead(buf[b:], &dest[i]) + } + return xgb.Pad(b) +} + +// Struct write Spanfix +func (v Spanfix) Bytes() []byte { + buf := make([]byte, 12) + b := 0 + + xgb.Put32(buf[b:], uint32(v.L)) + b += 4 + + xgb.Put32(buf[b:], uint32(v.R)) + b += 4 + + xgb.Put32(buf[b:], uint32(v.Y)) + b += 4 + + return buf +} + +// Write struct list Spanfix +func SpanfixListBytes(buf []byte, list []Spanfix) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } + return b +} + +// 'Trap' struct definition +// Size: 24 +type Trap struct { + Top Spanfix + Bot Spanfix +} + +// Struct read Trap +func TrapRead(buf []byte, v *Trap) int { + b := 0 + + v.Top = Spanfix{} + b += SpanfixRead(buf[b:], &v.Top) + + v.Bot = Spanfix{} + b += SpanfixRead(buf[b:], &v.Bot) + + return b +} + +// Struct list read Trap +func TrapReadList(buf []byte, dest []Trap) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = Trap{} + b += TrapRead(buf[b:], &dest[i]) + } + return xgb.Pad(b) +} + +// Struct write Trap +func (v Trap) Bytes() []byte { + buf := make([]byte, 24) + b := 0 + + { + structBytes := v.Top.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } + + { + structBytes := v.Bot.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } + + return buf +} + +// Write struct list Trap +func TrapListBytes(buf []byte, list []Trap) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } + return b +} + +// Error definition PictFormat (0) +// Size: 32 + +const BadPictFormat = 0 + +type PictFormatError struct { + Sequence uint16 + NiceName string +} + +// Error read PictFormat +func PictFormatErrorNew(buf []byte) xgb.Error { + v := PictFormatError{} + v.NiceName = "PictFormat" + + b := 1 // skip error determinant + b += 1 // don't read error number + + v.Sequence = xgb.Get16(buf[b:]) + b += 2 + + return v +} + +func (err PictFormatError) ImplementsError() {} + +func (err PictFormatError) SequenceId() uint16 { + return err.Sequence +} + +func (err PictFormatError) BadId() uint32 { + return 0 +} + +func (err PictFormatError) Error() string { + fieldVals := make([]string, 0, 0) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence)) + return "BadPictFormat {" + xgb.StringsJoin(fieldVals, ", ") + "}" +} + +func init() { + xgb.NewExtErrorFuncs["RENDER"][0] = PictFormatErrorNew +} + +// Error definition Picture (1) +// Size: 32 + +const BadPicture = 1 + +type PictureError struct { + Sequence uint16 + NiceName string +} + +// Error read Picture +func PictureErrorNew(buf []byte) xgb.Error { + v := PictureError{} + v.NiceName = "Picture" + + b := 1 // skip error determinant + b += 1 // don't read error number + + v.Sequence = xgb.Get16(buf[b:]) + b += 2 + + return v +} + +func (err PictureError) ImplementsError() {} + +func (err PictureError) SequenceId() uint16 { + return err.Sequence +} + +func (err PictureError) BadId() uint32 { + return 0 +} + +func (err PictureError) Error() string { + fieldVals := make([]string, 0, 0) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence)) + return "BadPicture {" + xgb.StringsJoin(fieldVals, ", ") + "}" +} + +func init() { + xgb.NewExtErrorFuncs["RENDER"][1] = PictureErrorNew +} + +// Error definition PictOp (2) +// Size: 32 + +const BadPictOp = 2 + +type PictOpError struct { + Sequence uint16 + NiceName string +} + +// Error read PictOp +func PictOpErrorNew(buf []byte) xgb.Error { + v := PictOpError{} + v.NiceName = "PictOp" + + b := 1 // skip error determinant + b += 1 // don't read error number + + v.Sequence = xgb.Get16(buf[b:]) + b += 2 + + return v +} + +func (err PictOpError) ImplementsError() {} + +func (err PictOpError) SequenceId() uint16 { + return err.Sequence +} + +func (err PictOpError) BadId() uint32 { + return 0 +} + +func (err PictOpError) Error() string { + fieldVals := make([]string, 0, 0) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence)) + return "BadPictOp {" + xgb.StringsJoin(fieldVals, ", ") + "}" +} + +func init() { + xgb.NewExtErrorFuncs["RENDER"][2] = PictOpErrorNew +} + +// Error definition GlyphSet (3) +// Size: 32 + +const BadGlyphSet = 3 + +type GlyphSetError struct { + Sequence uint16 + NiceName string +} + +// Error read GlyphSet +func GlyphSetErrorNew(buf []byte) xgb.Error { + v := GlyphSetError{} + v.NiceName = "GlyphSet" + + b := 1 // skip error determinant + b += 1 // don't read error number + + v.Sequence = xgb.Get16(buf[b:]) + b += 2 + + return v +} + +func (err GlyphSetError) ImplementsError() {} + +func (err GlyphSetError) SequenceId() uint16 { + return err.Sequence +} + +func (err GlyphSetError) BadId() uint32 { + return 0 +} + +func (err GlyphSetError) Error() string { + fieldVals := make([]string, 0, 0) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence)) + return "BadGlyphSet {" + xgb.StringsJoin(fieldVals, ", ") + "}" +} + +func init() { + xgb.NewExtErrorFuncs["RENDER"][3] = GlyphSetErrorNew +} + +// Error definition Glyph (4) +// Size: 32 + +const BadGlyph = 4 + +type GlyphError struct { + Sequence uint16 + NiceName string +} + +// Error read Glyph +func GlyphErrorNew(buf []byte) xgb.Error { + v := GlyphError{} + v.NiceName = "Glyph" + + b := 1 // skip error determinant + b += 1 // don't read error number + + v.Sequence = xgb.Get16(buf[b:]) + b += 2 + + return v +} + +func (err GlyphError) ImplementsError() {} + +func (err GlyphError) SequenceId() uint16 { + return err.Sequence +} + +func (err GlyphError) BadId() uint32 { + return 0 +} + +func (err GlyphError) Error() string { + fieldVals := make([]string, 0, 0) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence)) + return "BadGlyph {" + xgb.StringsJoin(fieldVals, ", ") + "}" +} + +func init() { + xgb.NewExtErrorFuncs["RENDER"][4] = GlyphErrorNew +} + +// Request QueryVersion +// size: 12 +type QueryVersionCookie struct { + *xgb.Cookie +} + +func QueryVersion(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVersion uint32) QueryVersionCookie { + cookie := c.NewCookie(true, true) + c.NewRequest(queryVersionRequest(c, ClientMajorVersion, ClientMinorVersion), cookie) + return QueryVersionCookie{cookie} +} + +func QueryVersionUnchecked(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVersion uint32) QueryVersionCookie { + cookie := c.NewCookie(false, true) + c.NewRequest(queryVersionRequest(c, ClientMajorVersion, ClientMinorVersion), cookie) + return QueryVersionCookie{cookie} +} + +// Request reply for QueryVersion +// size: 32 +type QueryVersionReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + MajorVersion uint32 + MinorVersion uint32 + // padding: 16 bytes +} + +// Waits and reads reply data from request QueryVersion +func (cook QueryVersionCookie) Reply() (*QueryVersionReply, error) { + buf, err := cook.Cookie.Reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return queryVersionReply(buf), nil +} + +// Read reply into structure from buffer for QueryVersion +func queryVersionReply(buf []byte) *QueryVersionReply { + v := new(QueryVersionReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = xgb.Get16(buf[b:]) + b += 2 + + v.Length = xgb.Get32(buf[b:]) // 4-byte units + b += 4 + + v.MajorVersion = xgb.Get32(buf[b:]) + b += 4 + + v.MinorVersion = xgb.Get32(buf[b:]) + b += 4 + + b += 16 // padding + + return v +} + +// Write request to wire for QueryVersion +func queryVersionRequest(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVersion uint32) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["RENDER"] + b += 1 + + buf[b] = 0 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + xgb.Put32(buf[b:], ClientMajorVersion) + b += 4 + + xgb.Put32(buf[b:], ClientMinorVersion) + b += 4 + + return buf +} + +// Request QueryPictFormats +// size: 4 +type QueryPictFormatsCookie struct { + *xgb.Cookie +} + +func QueryPictFormats(c *xgb.Conn) QueryPictFormatsCookie { + cookie := c.NewCookie(true, true) + c.NewRequest(queryPictFormatsRequest(c), cookie) + return QueryPictFormatsCookie{cookie} +} + +func QueryPictFormatsUnchecked(c *xgb.Conn) QueryPictFormatsCookie { + cookie := c.NewCookie(false, true) + c.NewRequest(queryPictFormatsRequest(c), cookie) + return QueryPictFormatsCookie{cookie} +} + +// Request reply for QueryPictFormats +// size: (((32 + xgb.Pad((int(NumFormats) * 28))) + PictscreenListSize(Screens)) + xgb.Pad((int(NumSubpixel) * 4))) +type QueryPictFormatsReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + NumFormats uint32 + NumScreens uint32 + NumDepths uint32 + NumVisuals uint32 + NumSubpixel uint32 + // padding: 4 bytes + Formats []Pictforminfo // size: xgb.Pad((int(NumFormats) * 28)) + Screens []Pictscreen // size: PictscreenListSize(Screens) + Subpixels []uint32 // size: xgb.Pad((int(NumSubpixel) * 4)) +} + +// Waits and reads reply data from request QueryPictFormats +func (cook QueryPictFormatsCookie) Reply() (*QueryPictFormatsReply, error) { + buf, err := cook.Cookie.Reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return queryPictFormatsReply(buf), nil +} + +// Read reply into structure from buffer for QueryPictFormats +func queryPictFormatsReply(buf []byte) *QueryPictFormatsReply { + v := new(QueryPictFormatsReply) + 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.NumFormats = xgb.Get32(buf[b:]) + b += 4 + + v.NumScreens = xgb.Get32(buf[b:]) + b += 4 + + v.NumDepths = xgb.Get32(buf[b:]) + b += 4 + + v.NumVisuals = xgb.Get32(buf[b:]) + b += 4 + + v.NumSubpixel = xgb.Get32(buf[b:]) + b += 4 + + b += 4 // padding + + v.Formats = make([]Pictforminfo, v.NumFormats) + b += PictforminfoReadList(buf[b:], v.Formats) + + v.Screens = make([]Pictscreen, v.NumScreens) + b += PictscreenReadList(buf[b:], v.Screens) + + v.Subpixels = make([]uint32, v.NumSubpixel) + for i := 0; i < int(v.NumSubpixel); i++ { + v.Subpixels[i] = xgb.Get32(buf[b:]) + b += 4 + } + b = xgb.Pad(b) + + return v +} + +// Write request to wire for QueryPictFormats +func queryPictFormatsRequest(c *xgb.Conn) []byte { + size := 4 + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["RENDER"] + b += 1 + + buf[b] = 1 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + return buf +} + +// Request QueryPictIndexValues +// size: 8 +type QueryPictIndexValuesCookie struct { + *xgb.Cookie +} + +func QueryPictIndexValues(c *xgb.Conn, Format Pictformat) QueryPictIndexValuesCookie { + cookie := c.NewCookie(true, true) + c.NewRequest(queryPictIndexValuesRequest(c, Format), cookie) + return QueryPictIndexValuesCookie{cookie} +} + +func QueryPictIndexValuesUnchecked(c *xgb.Conn, Format Pictformat) QueryPictIndexValuesCookie { + cookie := c.NewCookie(false, true) + c.NewRequest(queryPictIndexValuesRequest(c, Format), cookie) + return QueryPictIndexValuesCookie{cookie} +} + +// Request reply for QueryPictIndexValues +// size: (32 + xgb.Pad((int(NumValues) * 12))) +type QueryPictIndexValuesReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + NumValues uint32 + // padding: 20 bytes + Values []Indexvalue // size: xgb.Pad((int(NumValues) * 12)) +} + +// Waits and reads reply data from request QueryPictIndexValues +func (cook QueryPictIndexValuesCookie) Reply() (*QueryPictIndexValuesReply, error) { + buf, err := cook.Cookie.Reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return queryPictIndexValuesReply(buf), nil +} + +// Read reply into structure from buffer for QueryPictIndexValues +func queryPictIndexValuesReply(buf []byte) *QueryPictIndexValuesReply { + v := new(QueryPictIndexValuesReply) + 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.NumValues = xgb.Get32(buf[b:]) + b += 4 + + b += 20 // padding + + v.Values = make([]Indexvalue, v.NumValues) + b += IndexvalueReadList(buf[b:], v.Values) + + return v +} + +// Write request to wire for QueryPictIndexValues +func queryPictIndexValuesRequest(c *xgb.Conn, Format Pictformat) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["RENDER"] + b += 1 + + buf[b] = 2 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + xgb.Put32(buf[b:], uint32(Format)) + b += 4 + + return buf +} + +// Request CreatePicture +// size: xgb.Pad((16 + (4 + xgb.Pad((4 * xgb.PopCount(int(ValueMask))))))) +type CreatePictureCookie struct { + *xgb.Cookie +} + +// Write request to wire for CreatePicture +func CreatePicture(c *xgb.Conn, Pid Picture, Drawable xproto.Drawable, Format Pictformat, ValueMask uint32, ValueList []uint32) CreatePictureCookie { + cookie := c.NewCookie(false, false) + c.NewRequest(createPictureRequest(c, Pid, Drawable, Format, ValueMask, ValueList), cookie) + return CreatePictureCookie{cookie} +} + +func CreatePictureChecked(c *xgb.Conn, Pid Picture, Drawable xproto.Drawable, Format Pictformat, ValueMask uint32, ValueList []uint32) CreatePictureCookie { + cookie := c.NewCookie(true, false) + c.NewRequest(createPictureRequest(c, Pid, Drawable, Format, ValueMask, ValueList), cookie) + return CreatePictureCookie{cookie} +} + +func (cook CreatePictureCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for CreatePicture +func createPictureRequest(c *xgb.Conn, Pid Picture, Drawable xproto.Drawable, Format Pictformat, ValueMask uint32, ValueList []uint32) []byte { + size := xgb.Pad((16 + (4 + xgb.Pad((4 * xgb.PopCount(int(ValueMask))))))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["RENDER"] + b += 1 + + buf[b] = 4 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + xgb.Put32(buf[b:], uint32(Pid)) + b += 4 + + xgb.Put32(buf[b:], uint32(Drawable)) + b += 4 + + xgb.Put32(buf[b:], uint32(Format)) + b += 4 + + xgb.Put32(buf[b:], ValueMask) + b += 4 + for i := 0; i < xgb.PopCount(int(ValueMask)); i++ { + xgb.Put32(buf[b:], ValueList[i]) + b += 4 + } + b = xgb.Pad(b) + + return buf +} + +// Request ChangePicture +// size: xgb.Pad((8 + (4 + xgb.Pad((4 * xgb.PopCount(int(ValueMask))))))) +type ChangePictureCookie struct { + *xgb.Cookie +} + +// Write request to wire for ChangePicture +func ChangePicture(c *xgb.Conn, Picture Picture, ValueMask uint32, ValueList []uint32) ChangePictureCookie { + cookie := c.NewCookie(false, false) + c.NewRequest(changePictureRequest(c, Picture, ValueMask, ValueList), cookie) + return ChangePictureCookie{cookie} +} + +func ChangePictureChecked(c *xgb.Conn, Picture Picture, ValueMask uint32, ValueList []uint32) ChangePictureCookie { + cookie := c.NewCookie(true, false) + c.NewRequest(changePictureRequest(c, Picture, ValueMask, ValueList), cookie) + return ChangePictureCookie{cookie} +} + +func (cook ChangePictureCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for ChangePicture +func changePictureRequest(c *xgb.Conn, Picture Picture, ValueMask uint32, ValueList []uint32) []byte { + size := xgb.Pad((8 + (4 + xgb.Pad((4 * xgb.PopCount(int(ValueMask))))))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["RENDER"] + 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(Picture)) + b += 4 + + xgb.Put32(buf[b:], ValueMask) + b += 4 + for i := 0; i < xgb.PopCount(int(ValueMask)); i++ { + xgb.Put32(buf[b:], ValueList[i]) + b += 4 + } + b = xgb.Pad(b) + + return buf +} + +// Request SetPictureClipRectangles +// size: xgb.Pad((12 + xgb.Pad((len(Rectangles) * 8)))) +type SetPictureClipRectanglesCookie struct { + *xgb.Cookie +} + +// Write request to wire for SetPictureClipRectangles +func SetPictureClipRectangles(c *xgb.Conn, Picture Picture, ClipXOrigin int16, ClipYOrigin int16, Rectangles []xproto.Rectangle) SetPictureClipRectanglesCookie { + cookie := c.NewCookie(false, false) + c.NewRequest(setPictureClipRectanglesRequest(c, Picture, ClipXOrigin, ClipYOrigin, Rectangles), cookie) + return SetPictureClipRectanglesCookie{cookie} +} + +func SetPictureClipRectanglesChecked(c *xgb.Conn, Picture Picture, ClipXOrigin int16, ClipYOrigin int16, Rectangles []xproto.Rectangle) SetPictureClipRectanglesCookie { + cookie := c.NewCookie(true, false) + c.NewRequest(setPictureClipRectanglesRequest(c, Picture, ClipXOrigin, ClipYOrigin, Rectangles), cookie) + return SetPictureClipRectanglesCookie{cookie} +} + +func (cook SetPictureClipRectanglesCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for SetPictureClipRectangles +func setPictureClipRectanglesRequest(c *xgb.Conn, Picture Picture, ClipXOrigin int16, ClipYOrigin int16, Rectangles []xproto.Rectangle) []byte { + size := xgb.Pad((12 + xgb.Pad((len(Rectangles) * 8)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["RENDER"] + b += 1 + + buf[b] = 6 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + xgb.Put32(buf[b:], uint32(Picture)) + b += 4 + + xgb.Put16(buf[b:], uint16(ClipXOrigin)) + b += 2 + + xgb.Put16(buf[b:], uint16(ClipYOrigin)) + b += 2 + + b += xproto.RectangleListBytes(buf[b:], Rectangles) + + return buf +} + +// Request FreePicture +// size: 8 +type FreePictureCookie struct { + *xgb.Cookie +} + +// Write request to wire for FreePicture +func FreePicture(c *xgb.Conn, Picture Picture) FreePictureCookie { + cookie := c.NewCookie(false, false) + c.NewRequest(freePictureRequest(c, Picture), cookie) + return FreePictureCookie{cookie} +} + +func FreePictureChecked(c *xgb.Conn, Picture Picture) FreePictureCookie { + cookie := c.NewCookie(true, false) + c.NewRequest(freePictureRequest(c, Picture), cookie) + return FreePictureCookie{cookie} +} + +func (cook FreePictureCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for FreePicture +func freePictureRequest(c *xgb.Conn, Picture Picture) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["RENDER"] + b += 1 + + buf[b] = 7 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + xgb.Put32(buf[b:], uint32(Picture)) + b += 4 + + return buf +} + +// Request Composite +// size: 36 +type CompositeCookie struct { + *xgb.Cookie +} + +// Write request to wire for Composite +func Composite(c *xgb.Conn, Op byte, Src Picture, Mask Picture, Dst Picture, SrcX int16, SrcY int16, MaskX int16, MaskY int16, DstX int16, DstY int16, Width uint16, Height uint16) CompositeCookie { + cookie := c.NewCookie(false, false) + c.NewRequest(compositeRequest(c, Op, Src, Mask, Dst, SrcX, SrcY, MaskX, MaskY, DstX, DstY, Width, Height), cookie) + return CompositeCookie{cookie} +} + +func CompositeChecked(c *xgb.Conn, Op byte, Src Picture, Mask Picture, Dst Picture, SrcX int16, SrcY int16, MaskX int16, MaskY int16, DstX int16, DstY int16, Width uint16, Height uint16) CompositeCookie { + cookie := c.NewCookie(true, false) + c.NewRequest(compositeRequest(c, Op, Src, Mask, Dst, SrcX, SrcY, MaskX, MaskY, DstX, DstY, Width, Height), cookie) + return CompositeCookie{cookie} +} + +func (cook CompositeCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for Composite +func compositeRequest(c *xgb.Conn, Op byte, Src Picture, Mask Picture, Dst Picture, SrcX int16, SrcY int16, MaskX int16, MaskY int16, DstX int16, DstY int16, Width uint16, Height uint16) []byte { + size := 36 + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["RENDER"] + b += 1 + + buf[b] = 8 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = Op + b += 1 + + b += 3 // padding + + xgb.Put32(buf[b:], uint32(Src)) + b += 4 + + xgb.Put32(buf[b:], uint32(Mask)) + b += 4 + + xgb.Put32(buf[b:], uint32(Dst)) + b += 4 + + xgb.Put16(buf[b:], uint16(SrcX)) + b += 2 + + xgb.Put16(buf[b:], uint16(SrcY)) + b += 2 + + xgb.Put16(buf[b:], uint16(MaskX)) + b += 2 + + xgb.Put16(buf[b:], uint16(MaskY)) + b += 2 + + xgb.Put16(buf[b:], uint16(DstX)) + b += 2 + + xgb.Put16(buf[b:], uint16(DstY)) + b += 2 + + xgb.Put16(buf[b:], Width) + b += 2 + + xgb.Put16(buf[b:], Height) + b += 2 + + return buf +} + +// Request Trapezoids +// size: xgb.Pad((24 + xgb.Pad((len(Traps) * 40)))) +type TrapezoidsCookie struct { + *xgb.Cookie +} + +// Write request to wire for Trapezoids +func Trapezoids(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Traps []Trapezoid) TrapezoidsCookie { + cookie := c.NewCookie(false, false) + c.NewRequest(trapezoidsRequest(c, Op, Src, Dst, MaskFormat, SrcX, SrcY, Traps), cookie) + return TrapezoidsCookie{cookie} +} + +func TrapezoidsChecked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Traps []Trapezoid) TrapezoidsCookie { + cookie := c.NewCookie(true, false) + c.NewRequest(trapezoidsRequest(c, Op, Src, Dst, MaskFormat, SrcX, SrcY, Traps), cookie) + return TrapezoidsCookie{cookie} +} + +func (cook TrapezoidsCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for Trapezoids +func trapezoidsRequest(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Traps []Trapezoid) []byte { + size := xgb.Pad((24 + xgb.Pad((len(Traps) * 40)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["RENDER"] + b += 1 + + buf[b] = 10 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = Op + b += 1 + + b += 3 // padding + + xgb.Put32(buf[b:], uint32(Src)) + b += 4 + + xgb.Put32(buf[b:], uint32(Dst)) + b += 4 + + xgb.Put32(buf[b:], uint32(MaskFormat)) + b += 4 + + xgb.Put16(buf[b:], uint16(SrcX)) + b += 2 + + xgb.Put16(buf[b:], uint16(SrcY)) + b += 2 + + b += TrapezoidListBytes(buf[b:], Traps) + + return buf +} + +// Request Triangles +// size: xgb.Pad((24 + xgb.Pad((len(Triangles) * 24)))) +type TrianglesCookie struct { + *xgb.Cookie +} + +// Write request to wire for Triangles +func Triangles(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Triangles []Triangle) TrianglesCookie { + cookie := c.NewCookie(false, false) + c.NewRequest(trianglesRequest(c, Op, Src, Dst, MaskFormat, SrcX, SrcY, Triangles), cookie) + return TrianglesCookie{cookie} +} + +func TrianglesChecked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Triangles []Triangle) TrianglesCookie { + cookie := c.NewCookie(true, false) + c.NewRequest(trianglesRequest(c, Op, Src, Dst, MaskFormat, SrcX, SrcY, Triangles), cookie) + return TrianglesCookie{cookie} +} + +func (cook TrianglesCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for Triangles +func trianglesRequest(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Triangles []Triangle) []byte { + size := xgb.Pad((24 + xgb.Pad((len(Triangles) * 24)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["RENDER"] + b += 1 + + buf[b] = 11 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = Op + b += 1 + + b += 3 // padding + + xgb.Put32(buf[b:], uint32(Src)) + b += 4 + + xgb.Put32(buf[b:], uint32(Dst)) + b += 4 + + xgb.Put32(buf[b:], uint32(MaskFormat)) + b += 4 + + xgb.Put16(buf[b:], uint16(SrcX)) + b += 2 + + xgb.Put16(buf[b:], uint16(SrcY)) + b += 2 + + b += TriangleListBytes(buf[b:], Triangles) + + return buf +} + +// Request TriStrip +// size: xgb.Pad((24 + xgb.Pad((len(Points) * 8)))) +type TriStripCookie struct { + *xgb.Cookie +} + +// Write request to wire for TriStrip +func TriStrip(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Points []Pointfix) TriStripCookie { + cookie := c.NewCookie(false, false) + c.NewRequest(triStripRequest(c, Op, Src, Dst, MaskFormat, SrcX, SrcY, Points), cookie) + return TriStripCookie{cookie} +} + +func TriStripChecked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Points []Pointfix) TriStripCookie { + cookie := c.NewCookie(true, false) + c.NewRequest(triStripRequest(c, Op, Src, Dst, MaskFormat, SrcX, SrcY, Points), cookie) + return TriStripCookie{cookie} +} + +func (cook TriStripCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for TriStrip +func triStripRequest(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Points []Pointfix) []byte { + size := xgb.Pad((24 + xgb.Pad((len(Points) * 8)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["RENDER"] + b += 1 + + buf[b] = 12 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = Op + b += 1 + + b += 3 // padding + + xgb.Put32(buf[b:], uint32(Src)) + b += 4 + + xgb.Put32(buf[b:], uint32(Dst)) + b += 4 + + xgb.Put32(buf[b:], uint32(MaskFormat)) + b += 4 + + xgb.Put16(buf[b:], uint16(SrcX)) + b += 2 + + xgb.Put16(buf[b:], uint16(SrcY)) + b += 2 + + b += PointfixListBytes(buf[b:], Points) + + return buf +} + +// Request TriFan +// size: xgb.Pad((24 + xgb.Pad((len(Points) * 8)))) +type TriFanCookie struct { + *xgb.Cookie +} + +// Write request to wire for TriFan +func TriFan(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Points []Pointfix) TriFanCookie { + cookie := c.NewCookie(false, false) + c.NewRequest(triFanRequest(c, Op, Src, Dst, MaskFormat, SrcX, SrcY, Points), cookie) + return TriFanCookie{cookie} +} + +func TriFanChecked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Points []Pointfix) TriFanCookie { + cookie := c.NewCookie(true, false) + c.NewRequest(triFanRequest(c, Op, Src, Dst, MaskFormat, SrcX, SrcY, Points), cookie) + return TriFanCookie{cookie} +} + +func (cook TriFanCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for TriFan +func triFanRequest(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Points []Pointfix) []byte { + size := xgb.Pad((24 + xgb.Pad((len(Points) * 8)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["RENDER"] + b += 1 + + buf[b] = 13 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = Op + b += 1 + + b += 3 // padding + + xgb.Put32(buf[b:], uint32(Src)) + b += 4 + + xgb.Put32(buf[b:], uint32(Dst)) + b += 4 + + xgb.Put32(buf[b:], uint32(MaskFormat)) + b += 4 + + xgb.Put16(buf[b:], uint16(SrcX)) + b += 2 + + xgb.Put16(buf[b:], uint16(SrcY)) + b += 2 + + b += PointfixListBytes(buf[b:], Points) + + return buf +} + +// Request CreateGlyphSet +// size: 12 +type CreateGlyphSetCookie struct { + *xgb.Cookie +} + +// Write request to wire for CreateGlyphSet +func CreateGlyphSet(c *xgb.Conn, Gsid Glyphset, Format Pictformat) CreateGlyphSetCookie { + cookie := c.NewCookie(false, false) + c.NewRequest(createGlyphSetRequest(c, Gsid, Format), cookie) + return CreateGlyphSetCookie{cookie} +} + +func CreateGlyphSetChecked(c *xgb.Conn, Gsid Glyphset, Format Pictformat) CreateGlyphSetCookie { + cookie := c.NewCookie(true, false) + c.NewRequest(createGlyphSetRequest(c, Gsid, Format), cookie) + return CreateGlyphSetCookie{cookie} +} + +func (cook CreateGlyphSetCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for CreateGlyphSet +func createGlyphSetRequest(c *xgb.Conn, Gsid Glyphset, Format Pictformat) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["RENDER"] + b += 1 + + buf[b] = 17 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + xgb.Put32(buf[b:], uint32(Gsid)) + b += 4 + + xgb.Put32(buf[b:], uint32(Format)) + b += 4 + + return buf +} + +// Request ReferenceGlyphSet +// size: 12 +type ReferenceGlyphSetCookie struct { + *xgb.Cookie +} + +// Write request to wire for ReferenceGlyphSet +func ReferenceGlyphSet(c *xgb.Conn, Gsid Glyphset, Existing Glyphset) ReferenceGlyphSetCookie { + cookie := c.NewCookie(false, false) + c.NewRequest(referenceGlyphSetRequest(c, Gsid, Existing), cookie) + return ReferenceGlyphSetCookie{cookie} +} + +func ReferenceGlyphSetChecked(c *xgb.Conn, Gsid Glyphset, Existing Glyphset) ReferenceGlyphSetCookie { + cookie := c.NewCookie(true, false) + c.NewRequest(referenceGlyphSetRequest(c, Gsid, Existing), cookie) + return ReferenceGlyphSetCookie{cookie} +} + +func (cook ReferenceGlyphSetCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for ReferenceGlyphSet +func referenceGlyphSetRequest(c *xgb.Conn, Gsid Glyphset, Existing Glyphset) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["RENDER"] + b += 1 + + buf[b] = 18 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + xgb.Put32(buf[b:], uint32(Gsid)) + b += 4 + + xgb.Put32(buf[b:], uint32(Existing)) + b += 4 + + return buf +} + +// Request FreeGlyphSet +// size: 8 +type FreeGlyphSetCookie struct { + *xgb.Cookie +} + +// Write request to wire for FreeGlyphSet +func FreeGlyphSet(c *xgb.Conn, Glyphset Glyphset) FreeGlyphSetCookie { + cookie := c.NewCookie(false, false) + c.NewRequest(freeGlyphSetRequest(c, Glyphset), cookie) + return FreeGlyphSetCookie{cookie} +} + +func FreeGlyphSetChecked(c *xgb.Conn, Glyphset Glyphset) FreeGlyphSetCookie { + cookie := c.NewCookie(true, false) + c.NewRequest(freeGlyphSetRequest(c, Glyphset), cookie) + return FreeGlyphSetCookie{cookie} +} + +func (cook FreeGlyphSetCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for FreeGlyphSet +func freeGlyphSetRequest(c *xgb.Conn, Glyphset Glyphset) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["RENDER"] + b += 1 + + buf[b] = 19 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + xgb.Put32(buf[b:], uint32(Glyphset)) + b += 4 + + return buf +} + +// Request AddGlyphs +// size: xgb.Pad((((12 + xgb.Pad((int(GlyphsLen) * 4))) + xgb.Pad((int(GlyphsLen) * 12))) + xgb.Pad((len(Data) * 1)))) +type AddGlyphsCookie struct { + *xgb.Cookie +} + +// Write request to wire for AddGlyphs +func AddGlyphs(c *xgb.Conn, Glyphset Glyphset, GlyphsLen uint32, Glyphids []uint32, Glyphs []Glyphinfo, Data []byte) AddGlyphsCookie { + cookie := c.NewCookie(false, false) + c.NewRequest(addGlyphsRequest(c, Glyphset, GlyphsLen, Glyphids, Glyphs, Data), cookie) + return AddGlyphsCookie{cookie} +} + +func AddGlyphsChecked(c *xgb.Conn, Glyphset Glyphset, GlyphsLen uint32, Glyphids []uint32, Glyphs []Glyphinfo, Data []byte) AddGlyphsCookie { + cookie := c.NewCookie(true, false) + c.NewRequest(addGlyphsRequest(c, Glyphset, GlyphsLen, Glyphids, Glyphs, Data), cookie) + return AddGlyphsCookie{cookie} +} + +func (cook AddGlyphsCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for AddGlyphs +func addGlyphsRequest(c *xgb.Conn, Glyphset Glyphset, GlyphsLen uint32, Glyphids []uint32, Glyphs []Glyphinfo, Data []byte) []byte { + size := xgb.Pad((((12 + xgb.Pad((int(GlyphsLen) * 4))) + xgb.Pad((int(GlyphsLen) * 12))) + xgb.Pad((len(Data) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["RENDER"] + b += 1 + + buf[b] = 20 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + xgb.Put32(buf[b:], uint32(Glyphset)) + b += 4 + + xgb.Put32(buf[b:], GlyphsLen) + b += 4 + + for i := 0; i < int(GlyphsLen); i++ { + xgb.Put32(buf[b:], Glyphids[i]) + b += 4 + } + b = xgb.Pad(b) + + b += GlyphinfoListBytes(buf[b:], Glyphs) + + copy(buf[b:], Data[:len(Data)]) + b += xgb.Pad(int(len(Data))) + + return buf +} + +// Request FreeGlyphs +// size: xgb.Pad((8 + xgb.Pad((len(Glyphs) * 4)))) +type FreeGlyphsCookie struct { + *xgb.Cookie +} + +// Write request to wire for FreeGlyphs +func FreeGlyphs(c *xgb.Conn, Glyphset Glyphset, Glyphs []Glyph) FreeGlyphsCookie { + cookie := c.NewCookie(false, false) + c.NewRequest(freeGlyphsRequest(c, Glyphset, Glyphs), cookie) + return FreeGlyphsCookie{cookie} +} + +func FreeGlyphsChecked(c *xgb.Conn, Glyphset Glyphset, Glyphs []Glyph) FreeGlyphsCookie { + cookie := c.NewCookie(true, false) + c.NewRequest(freeGlyphsRequest(c, Glyphset, Glyphs), cookie) + return FreeGlyphsCookie{cookie} +} + +func (cook FreeGlyphsCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for FreeGlyphs +func freeGlyphsRequest(c *xgb.Conn, Glyphset Glyphset, Glyphs []Glyph) []byte { + size := xgb.Pad((8 + xgb.Pad((len(Glyphs) * 4)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["RENDER"] + b += 1 + + buf[b] = 22 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + xgb.Put32(buf[b:], uint32(Glyphset)) + b += 4 + + for i := 0; i < int(len(Glyphs)); i++ { + xgb.Put32(buf[b:], uint32(Glyphs[i])) + b += 4 + } + b = xgb.Pad(b) + + return buf +} + +// Request CompositeGlyphs8 +// size: xgb.Pad((28 + xgb.Pad((len(Glyphcmds) * 1)))) +type CompositeGlyphs8Cookie struct { + *xgb.Cookie +} + +// Write request to wire for CompositeGlyphs8 +func CompositeGlyphs8(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) CompositeGlyphs8Cookie { + cookie := c.NewCookie(false, false) + c.NewRequest(compositeGlyphs8Request(c, Op, Src, Dst, MaskFormat, Glyphset, SrcX, SrcY, Glyphcmds), cookie) + return CompositeGlyphs8Cookie{cookie} +} + +func CompositeGlyphs8Checked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) CompositeGlyphs8Cookie { + cookie := c.NewCookie(true, false) + c.NewRequest(compositeGlyphs8Request(c, Op, Src, Dst, MaskFormat, Glyphset, SrcX, SrcY, Glyphcmds), cookie) + return CompositeGlyphs8Cookie{cookie} +} + +func (cook CompositeGlyphs8Cookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for CompositeGlyphs8 +func compositeGlyphs8Request(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) []byte { + size := xgb.Pad((28 + xgb.Pad((len(Glyphcmds) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["RENDER"] + b += 1 + + buf[b] = 23 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = Op + b += 1 + + b += 3 // padding + + xgb.Put32(buf[b:], uint32(Src)) + b += 4 + + xgb.Put32(buf[b:], uint32(Dst)) + b += 4 + + xgb.Put32(buf[b:], uint32(MaskFormat)) + b += 4 + + xgb.Put32(buf[b:], uint32(Glyphset)) + b += 4 + + xgb.Put16(buf[b:], uint16(SrcX)) + b += 2 + + xgb.Put16(buf[b:], uint16(SrcY)) + b += 2 + + copy(buf[b:], Glyphcmds[:len(Glyphcmds)]) + b += xgb.Pad(int(len(Glyphcmds))) + + return buf +} + +// Request CompositeGlyphs16 +// size: xgb.Pad((28 + xgb.Pad((len(Glyphcmds) * 1)))) +type CompositeGlyphs16Cookie struct { + *xgb.Cookie +} + +// Write request to wire for CompositeGlyphs16 +func CompositeGlyphs16(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) CompositeGlyphs16Cookie { + cookie := c.NewCookie(false, false) + c.NewRequest(compositeGlyphs16Request(c, Op, Src, Dst, MaskFormat, Glyphset, SrcX, SrcY, Glyphcmds), cookie) + return CompositeGlyphs16Cookie{cookie} +} + +func CompositeGlyphs16Checked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) CompositeGlyphs16Cookie { + cookie := c.NewCookie(true, false) + c.NewRequest(compositeGlyphs16Request(c, Op, Src, Dst, MaskFormat, Glyphset, SrcX, SrcY, Glyphcmds), cookie) + return CompositeGlyphs16Cookie{cookie} +} + +func (cook CompositeGlyphs16Cookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for CompositeGlyphs16 +func compositeGlyphs16Request(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) []byte { + size := xgb.Pad((28 + xgb.Pad((len(Glyphcmds) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["RENDER"] + b += 1 + + buf[b] = 24 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = Op + b += 1 + + b += 3 // padding + + xgb.Put32(buf[b:], uint32(Src)) + b += 4 + + xgb.Put32(buf[b:], uint32(Dst)) + b += 4 + + xgb.Put32(buf[b:], uint32(MaskFormat)) + b += 4 + + xgb.Put32(buf[b:], uint32(Glyphset)) + b += 4 + + xgb.Put16(buf[b:], uint16(SrcX)) + b += 2 + + xgb.Put16(buf[b:], uint16(SrcY)) + b += 2 + + copy(buf[b:], Glyphcmds[:len(Glyphcmds)]) + b += xgb.Pad(int(len(Glyphcmds))) + + return buf +} + +// Request CompositeGlyphs32 +// size: xgb.Pad((28 + xgb.Pad((len(Glyphcmds) * 1)))) +type CompositeGlyphs32Cookie struct { + *xgb.Cookie +} + +// Write request to wire for CompositeGlyphs32 +func CompositeGlyphs32(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) CompositeGlyphs32Cookie { + cookie := c.NewCookie(false, false) + c.NewRequest(compositeGlyphs32Request(c, Op, Src, Dst, MaskFormat, Glyphset, SrcX, SrcY, Glyphcmds), cookie) + return CompositeGlyphs32Cookie{cookie} +} + +func CompositeGlyphs32Checked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) CompositeGlyphs32Cookie { + cookie := c.NewCookie(true, false) + c.NewRequest(compositeGlyphs32Request(c, Op, Src, Dst, MaskFormat, Glyphset, SrcX, SrcY, Glyphcmds), cookie) + return CompositeGlyphs32Cookie{cookie} +} + +func (cook CompositeGlyphs32Cookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for CompositeGlyphs32 +func compositeGlyphs32Request(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) []byte { + size := xgb.Pad((28 + xgb.Pad((len(Glyphcmds) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["RENDER"] + b += 1 + + buf[b] = 25 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = Op + b += 1 + + b += 3 // padding + + xgb.Put32(buf[b:], uint32(Src)) + b += 4 + + xgb.Put32(buf[b:], uint32(Dst)) + b += 4 + + xgb.Put32(buf[b:], uint32(MaskFormat)) + b += 4 + + xgb.Put32(buf[b:], uint32(Glyphset)) + b += 4 + + xgb.Put16(buf[b:], uint16(SrcX)) + b += 2 + + xgb.Put16(buf[b:], uint16(SrcY)) + b += 2 + + copy(buf[b:], Glyphcmds[:len(Glyphcmds)]) + b += xgb.Pad(int(len(Glyphcmds))) + + return buf +} + +// Request FillRectangles +// size: xgb.Pad((20 + xgb.Pad((len(Rects) * 8)))) +type FillRectanglesCookie struct { + *xgb.Cookie +} + +// Write request to wire for FillRectangles +func FillRectangles(c *xgb.Conn, Op byte, Dst Picture, Color Color, Rects []xproto.Rectangle) FillRectanglesCookie { + cookie := c.NewCookie(false, false) + c.NewRequest(fillRectanglesRequest(c, Op, Dst, Color, Rects), cookie) + return FillRectanglesCookie{cookie} +} + +func FillRectanglesChecked(c *xgb.Conn, Op byte, Dst Picture, Color Color, Rects []xproto.Rectangle) FillRectanglesCookie { + cookie := c.NewCookie(true, false) + c.NewRequest(fillRectanglesRequest(c, Op, Dst, Color, Rects), cookie) + return FillRectanglesCookie{cookie} +} + +func (cook FillRectanglesCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for FillRectangles +func fillRectanglesRequest(c *xgb.Conn, Op byte, Dst Picture, Color Color, Rects []xproto.Rectangle) []byte { + size := xgb.Pad((20 + xgb.Pad((len(Rects) * 8)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["RENDER"] + b += 1 + + buf[b] = 26 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = Op + b += 1 + + b += 3 // padding + + xgb.Put32(buf[b:], uint32(Dst)) + b += 4 + + { + structBytes := Color.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } + + b += xproto.RectangleListBytes(buf[b:], Rects) + + return buf +} + +// Request CreateCursor +// size: 16 +type CreateCursorCookie struct { + *xgb.Cookie +} + +// Write request to wire for CreateCursor +func CreateCursor(c *xgb.Conn, Cid xproto.Cursor, Source Picture, X uint16, Y uint16) CreateCursorCookie { + cookie := c.NewCookie(false, false) + c.NewRequest(createCursorRequest(c, Cid, Source, X, Y), cookie) + return CreateCursorCookie{cookie} +} + +func CreateCursorChecked(c *xgb.Conn, Cid xproto.Cursor, Source Picture, X uint16, Y uint16) CreateCursorCookie { + cookie := c.NewCookie(true, false) + c.NewRequest(createCursorRequest(c, Cid, Source, X, Y), cookie) + return CreateCursorCookie{cookie} +} + +func (cook CreateCursorCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for CreateCursor +func createCursorRequest(c *xgb.Conn, Cid xproto.Cursor, Source Picture, X uint16, Y uint16) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["RENDER"] + b += 1 + + buf[b] = 27 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + xgb.Put32(buf[b:], uint32(Cid)) + b += 4 + + xgb.Put32(buf[b:], uint32(Source)) + b += 4 + + xgb.Put16(buf[b:], X) + b += 2 + + xgb.Put16(buf[b:], Y) + b += 2 + + return buf +} + +// Request SetPictureTransform +// size: 44 +type SetPictureTransformCookie struct { + *xgb.Cookie +} + +// Write request to wire for SetPictureTransform +func SetPictureTransform(c *xgb.Conn, Picture Picture, Transform Transform) SetPictureTransformCookie { + cookie := c.NewCookie(false, false) + c.NewRequest(setPictureTransformRequest(c, Picture, Transform), cookie) + return SetPictureTransformCookie{cookie} +} + +func SetPictureTransformChecked(c *xgb.Conn, Picture Picture, Transform Transform) SetPictureTransformCookie { + cookie := c.NewCookie(true, false) + c.NewRequest(setPictureTransformRequest(c, Picture, Transform), cookie) + return SetPictureTransformCookie{cookie} +} + +func (cook SetPictureTransformCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for SetPictureTransform +func setPictureTransformRequest(c *xgb.Conn, Picture Picture, Transform Transform) []byte { + size := 44 + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["RENDER"] + b += 1 + + buf[b] = 28 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + xgb.Put32(buf[b:], uint32(Picture)) + b += 4 + + { + structBytes := Transform.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } + + return buf +} + +// Request QueryFilters +// size: 8 +type QueryFiltersCookie struct { + *xgb.Cookie +} + +func QueryFilters(c *xgb.Conn, Drawable xproto.Drawable) QueryFiltersCookie { + cookie := c.NewCookie(true, true) + c.NewRequest(queryFiltersRequest(c, Drawable), cookie) + return QueryFiltersCookie{cookie} +} + +func QueryFiltersUnchecked(c *xgb.Conn, Drawable xproto.Drawable) QueryFiltersCookie { + cookie := c.NewCookie(false, true) + c.NewRequest(queryFiltersRequest(c, Drawable), cookie) + return QueryFiltersCookie{cookie} +} + +// Request reply for QueryFilters +// size: ((32 + xgb.Pad((int(NumAliases) * 2))) + xproto.StrListSize(Filters)) +type QueryFiltersReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + NumAliases uint32 + NumFilters uint32 + // padding: 16 bytes + Aliases []uint16 // size: xgb.Pad((int(NumAliases) * 2)) + Filters []xproto.Str // size: xproto.StrListSize(Filters) +} + +// Waits and reads reply data from request QueryFilters +func (cook QueryFiltersCookie) Reply() (*QueryFiltersReply, error) { + buf, err := cook.Cookie.Reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return queryFiltersReply(buf), nil +} + +// Read reply into structure from buffer for QueryFilters +func queryFiltersReply(buf []byte) *QueryFiltersReply { + v := new(QueryFiltersReply) + 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.NumAliases = xgb.Get32(buf[b:]) + b += 4 + + v.NumFilters = xgb.Get32(buf[b:]) + b += 4 + + b += 16 // padding + + v.Aliases = make([]uint16, v.NumAliases) + for i := 0; i < int(v.NumAliases); i++ { + v.Aliases[i] = xgb.Get16(buf[b:]) + b += 2 + } + b = xgb.Pad(b) + + v.Filters = make([]xproto.Str, v.NumFilters) + b += xproto.StrReadList(buf[b:], v.Filters) + + return v +} + +// Write request to wire for QueryFilters +func queryFiltersRequest(c *xgb.Conn, Drawable xproto.Drawable) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["RENDER"] + b += 1 + + buf[b] = 29 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + xgb.Put32(buf[b:], uint32(Drawable)) + b += 4 + + return buf +} + +// Request SetPictureFilter +// size: xgb.Pad(((12 + xgb.Pad((int(FilterLen) * 1))) + xgb.Pad((len(Values) * 4)))) +type SetPictureFilterCookie struct { + *xgb.Cookie +} + +// Write request to wire for SetPictureFilter +func SetPictureFilter(c *xgb.Conn, Picture Picture, FilterLen uint16, Filter string, Values []Fixed) SetPictureFilterCookie { + cookie := c.NewCookie(false, false) + c.NewRequest(setPictureFilterRequest(c, Picture, FilterLen, Filter, Values), cookie) + return SetPictureFilterCookie{cookie} +} + +func SetPictureFilterChecked(c *xgb.Conn, Picture Picture, FilterLen uint16, Filter string, Values []Fixed) SetPictureFilterCookie { + cookie := c.NewCookie(true, false) + c.NewRequest(setPictureFilterRequest(c, Picture, FilterLen, Filter, Values), cookie) + return SetPictureFilterCookie{cookie} +} + +func (cook SetPictureFilterCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for SetPictureFilter +func setPictureFilterRequest(c *xgb.Conn, Picture Picture, FilterLen uint16, Filter string, Values []Fixed) []byte { + size := xgb.Pad(((12 + xgb.Pad((int(FilterLen) * 1))) + xgb.Pad((len(Values) * 4)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["RENDER"] + b += 1 + + buf[b] = 30 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + xgb.Put32(buf[b:], uint32(Picture)) + b += 4 + + xgb.Put16(buf[b:], FilterLen) + b += 2 + + b += 2 // padding + + copy(buf[b:], Filter[:FilterLen]) + b += xgb.Pad(int(FilterLen)) + + for i := 0; i < int(len(Values)); i++ { + xgb.Put32(buf[b:], uint32(Values[i])) + b += 4 + } + b = xgb.Pad(b) + + return buf +} + +// Request CreateAnimCursor +// size: xgb.Pad((8 + xgb.Pad((len(Cursors) * 8)))) +type CreateAnimCursorCookie struct { + *xgb.Cookie +} + +// Write request to wire for CreateAnimCursor +func CreateAnimCursor(c *xgb.Conn, Cid xproto.Cursor, Cursors []Animcursorelt) CreateAnimCursorCookie { + cookie := c.NewCookie(false, false) + c.NewRequest(createAnimCursorRequest(c, Cid, Cursors), cookie) + return CreateAnimCursorCookie{cookie} +} + +func CreateAnimCursorChecked(c *xgb.Conn, Cid xproto.Cursor, Cursors []Animcursorelt) CreateAnimCursorCookie { + cookie := c.NewCookie(true, false) + c.NewRequest(createAnimCursorRequest(c, Cid, Cursors), cookie) + return CreateAnimCursorCookie{cookie} +} + +func (cook CreateAnimCursorCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for CreateAnimCursor +func createAnimCursorRequest(c *xgb.Conn, Cid xproto.Cursor, Cursors []Animcursorelt) []byte { + size := xgb.Pad((8 + xgb.Pad((len(Cursors) * 8)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["RENDER"] + b += 1 + + buf[b] = 31 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + xgb.Put32(buf[b:], uint32(Cid)) + b += 4 + + b += AnimcursoreltListBytes(buf[b:], Cursors) + + return buf +} + +// Request AddTraps +// size: xgb.Pad((12 + xgb.Pad((len(Traps) * 24)))) +type AddTrapsCookie struct { + *xgb.Cookie +} + +// Write request to wire for AddTraps +func AddTraps(c *xgb.Conn, Picture Picture, XOff int16, YOff int16, Traps []Trap) AddTrapsCookie { + cookie := c.NewCookie(false, false) + c.NewRequest(addTrapsRequest(c, Picture, XOff, YOff, Traps), cookie) + return AddTrapsCookie{cookie} +} + +func AddTrapsChecked(c *xgb.Conn, Picture Picture, XOff int16, YOff int16, Traps []Trap) AddTrapsCookie { + cookie := c.NewCookie(true, false) + c.NewRequest(addTrapsRequest(c, Picture, XOff, YOff, Traps), cookie) + return AddTrapsCookie{cookie} +} + +func (cook AddTrapsCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for AddTraps +func addTrapsRequest(c *xgb.Conn, Picture Picture, XOff int16, YOff int16, Traps []Trap) []byte { + size := xgb.Pad((12 + xgb.Pad((len(Traps) * 24)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["RENDER"] + b += 1 + + buf[b] = 32 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + xgb.Put32(buf[b:], uint32(Picture)) + b += 4 + + xgb.Put16(buf[b:], uint16(XOff)) + b += 2 + + xgb.Put16(buf[b:], uint16(YOff)) + b += 2 + + b += TrapListBytes(buf[b:], Traps) + + return buf +} + +// Request CreateSolidFill +// size: 16 +type CreateSolidFillCookie struct { + *xgb.Cookie +} + +// Write request to wire for CreateSolidFill +func CreateSolidFill(c *xgb.Conn, Picture Picture, Color Color) CreateSolidFillCookie { + cookie := c.NewCookie(false, false) + c.NewRequest(createSolidFillRequest(c, Picture, Color), cookie) + return CreateSolidFillCookie{cookie} +} + +func CreateSolidFillChecked(c *xgb.Conn, Picture Picture, Color Color) CreateSolidFillCookie { + cookie := c.NewCookie(true, false) + c.NewRequest(createSolidFillRequest(c, Picture, Color), cookie) + return CreateSolidFillCookie{cookie} +} + +func (cook CreateSolidFillCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for CreateSolidFill +func createSolidFillRequest(c *xgb.Conn, Picture Picture, Color Color) []byte { + size := 16 + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["RENDER"] + b += 1 + + buf[b] = 33 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + xgb.Put32(buf[b:], uint32(Picture)) + b += 4 + + { + structBytes := Color.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } + + return buf +} + +// Request CreateLinearGradient +// size: xgb.Pad(((28 + xgb.Pad((int(NumStops) * 4))) + xgb.Pad((int(NumStops) * 8)))) +type CreateLinearGradientCookie struct { + *xgb.Cookie +} + +// Write request to wire for CreateLinearGradient +func CreateLinearGradient(c *xgb.Conn, Picture Picture, P1 Pointfix, P2 Pointfix, NumStops uint32, Stops []Fixed, Colors []Color) CreateLinearGradientCookie { + cookie := c.NewCookie(false, false) + c.NewRequest(createLinearGradientRequest(c, Picture, P1, P2, NumStops, Stops, Colors), cookie) + return CreateLinearGradientCookie{cookie} +} + +func CreateLinearGradientChecked(c *xgb.Conn, Picture Picture, P1 Pointfix, P2 Pointfix, NumStops uint32, Stops []Fixed, Colors []Color) CreateLinearGradientCookie { + cookie := c.NewCookie(true, false) + c.NewRequest(createLinearGradientRequest(c, Picture, P1, P2, NumStops, Stops, Colors), cookie) + return CreateLinearGradientCookie{cookie} +} + +func (cook CreateLinearGradientCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for CreateLinearGradient +func createLinearGradientRequest(c *xgb.Conn, Picture Picture, P1 Pointfix, P2 Pointfix, NumStops uint32, Stops []Fixed, Colors []Color) []byte { + size := xgb.Pad(((28 + xgb.Pad((int(NumStops) * 4))) + xgb.Pad((int(NumStops) * 8)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["RENDER"] + b += 1 + + buf[b] = 34 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + xgb.Put32(buf[b:], uint32(Picture)) + b += 4 + + { + structBytes := P1.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } + + { + structBytes := P2.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } + + xgb.Put32(buf[b:], NumStops) + b += 4 + + for i := 0; i < int(NumStops); i++ { + xgb.Put32(buf[b:], uint32(Stops[i])) + b += 4 + } + b = xgb.Pad(b) + + b += ColorListBytes(buf[b:], Colors) + + return buf +} + +// Request CreateRadialGradient +// size: xgb.Pad(((36 + xgb.Pad((int(NumStops) * 4))) + xgb.Pad((int(NumStops) * 8)))) +type CreateRadialGradientCookie struct { + *xgb.Cookie +} + +// Write request to wire for CreateRadialGradient +func CreateRadialGradient(c *xgb.Conn, Picture Picture, Inner Pointfix, Outer Pointfix, InnerRadius Fixed, OuterRadius Fixed, NumStops uint32, Stops []Fixed, Colors []Color) CreateRadialGradientCookie { + cookie := c.NewCookie(false, false) + c.NewRequest(createRadialGradientRequest(c, Picture, Inner, Outer, InnerRadius, OuterRadius, NumStops, Stops, Colors), cookie) + return CreateRadialGradientCookie{cookie} +} + +func CreateRadialGradientChecked(c *xgb.Conn, Picture Picture, Inner Pointfix, Outer Pointfix, InnerRadius Fixed, OuterRadius Fixed, NumStops uint32, Stops []Fixed, Colors []Color) CreateRadialGradientCookie { + cookie := c.NewCookie(true, false) + c.NewRequest(createRadialGradientRequest(c, Picture, Inner, Outer, InnerRadius, OuterRadius, NumStops, Stops, Colors), cookie) + return CreateRadialGradientCookie{cookie} +} + +func (cook CreateRadialGradientCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for CreateRadialGradient +func createRadialGradientRequest(c *xgb.Conn, Picture Picture, Inner Pointfix, Outer Pointfix, InnerRadius Fixed, OuterRadius Fixed, NumStops uint32, Stops []Fixed, Colors []Color) []byte { + size := xgb.Pad(((36 + xgb.Pad((int(NumStops) * 4))) + xgb.Pad((int(NumStops) * 8)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["RENDER"] + b += 1 + + buf[b] = 35 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + xgb.Put32(buf[b:], uint32(Picture)) + b += 4 + + { + structBytes := Inner.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } + + { + structBytes := Outer.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } + + xgb.Put32(buf[b:], uint32(InnerRadius)) + b += 4 + + xgb.Put32(buf[b:], uint32(OuterRadius)) + b += 4 + + xgb.Put32(buf[b:], NumStops) + b += 4 + + for i := 0; i < int(NumStops); i++ { + xgb.Put32(buf[b:], uint32(Stops[i])) + b += 4 + } + b = xgb.Pad(b) + + b += ColorListBytes(buf[b:], Colors) + + return buf +} + +// Request CreateConicalGradient +// size: xgb.Pad(((24 + xgb.Pad((int(NumStops) * 4))) + xgb.Pad((int(NumStops) * 8)))) +type CreateConicalGradientCookie struct { + *xgb.Cookie +} + +// Write request to wire for CreateConicalGradient +func CreateConicalGradient(c *xgb.Conn, Picture Picture, Center Pointfix, Angle Fixed, NumStops uint32, Stops []Fixed, Colors []Color) CreateConicalGradientCookie { + cookie := c.NewCookie(false, false) + c.NewRequest(createConicalGradientRequest(c, Picture, Center, Angle, NumStops, Stops, Colors), cookie) + return CreateConicalGradientCookie{cookie} +} + +func CreateConicalGradientChecked(c *xgb.Conn, Picture Picture, Center Pointfix, Angle Fixed, NumStops uint32, Stops []Fixed, Colors []Color) CreateConicalGradientCookie { + cookie := c.NewCookie(true, false) + c.NewRequest(createConicalGradientRequest(c, Picture, Center, Angle, NumStops, Stops, Colors), cookie) + return CreateConicalGradientCookie{cookie} +} + +func (cook CreateConicalGradientCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for CreateConicalGradient +func createConicalGradientRequest(c *xgb.Conn, Picture Picture, Center Pointfix, Angle Fixed, NumStops uint32, Stops []Fixed, Colors []Color) []byte { + size := xgb.Pad(((24 + xgb.Pad((int(NumStops) * 4))) + xgb.Pad((int(NumStops) * 8)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["RENDER"] + b += 1 + + buf[b] = 36 // 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(Picture)) + b += 4 + + { + structBytes := Center.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } + + xgb.Put32(buf[b:], uint32(Angle)) + b += 4 + + xgb.Put32(buf[b:], NumStops) + b += 4 + + for i := 0; i < int(NumStops); i++ { + xgb.Put32(buf[b:], uint32(Stops[i])) + b += 4 + } + b = xgb.Pad(b) + + b += ColorListBytes(buf[b:], Colors) + + return buf +} -- cgit v1.2.3 From a3363755cdfdafdf02d5a772bd47a462e99af057 Mon Sep 17 00:00:00 2001 From: "Andrew Gallant (Ocelot)" Date: Thu, 10 May 2012 20:06:22 -0400 Subject: adding package header comments --- nexgb/render/render.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'nexgb/render') diff --git a/nexgb/render/render.go b/nexgb/render/render.go index a939ed9..ca3f9bd 100644 --- a/nexgb/render/render.go +++ b/nexgb/render/render.go @@ -1,7 +1,8 @@ +// Package render is the X client API for the RENDER extension. package render /* - This file was generated by render.xml on May 10 2012 4:20:28pm EDT. + This file was generated by render.xml on May 10 2012 8:04:32pm EDT. This file is automatically generated. Edit at your peril! */ @@ -39,6 +40,10 @@ func init() { xgb.NewExtErrorFuncs["RENDER"] = 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' @@ -59,10 +64,6 @@ func init() { // Skipping definition for base type 'Float' -// Skipping definition for base type 'Card8' - -// Skipping definition for base type 'Int16' - const ( PictTypeIndexed = 0 PictTypeDirect = 1 -- cgit v1.2.3 From c00652934e4ec68016a152b9bea10273b0be8726 Mon Sep 17 00:00:00 2001 From: "Andrew Gallant (Ocelot)" Date: Thu, 10 May 2012 23:57:34 -0400 Subject: better docs --- nexgb/render/render.go | 597 +++++++++++++++++++++++++++++-------------------- 1 file changed, 351 insertions(+), 246 deletions(-) (limited to 'nexgb/render') diff --git a/nexgb/render/render.go b/nexgb/render/render.go index ca3f9bd..61f0b96 100644 --- a/nexgb/render/render.go +++ b/nexgb/render/render.go @@ -2,7 +2,7 @@ package render /* - This file was generated by render.xml on May 10 2012 8:04:32pm EDT. + This file was generated by render.xml on May 10 2012 11:56:19pm EDT. This file is automatically generated. Edit at your peril! */ @@ -40,10 +40,6 @@ func init() { xgb.NewExtErrorFuncs["RENDER"] = 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' @@ -64,6 +60,10 @@ func init() { // Skipping definition for base type 'Float' +// Skipping definition for base type 'Card8' + +// Skipping definition for base type 'Int16' + const ( PictTypeIndexed = 0 PictTypeDirect = 1 @@ -205,8 +205,6 @@ type Glyph uint32 type Fixed int32 -// 'Directformat' struct definition -// Size: 16 type Directformat struct { RedShift uint16 RedMask uint16 @@ -218,7 +216,7 @@ type Directformat struct { AlphaMask uint16 } -// Struct read Directformat +// DirectformatRead reads a byte slice into a Directformat value. func DirectformatRead(buf []byte, v *Directformat) int { b := 0 @@ -249,7 +247,7 @@ func DirectformatRead(buf []byte, v *Directformat) int { return b } -// Struct list read Directformat +// DirectformatReadList reads a byte slice into a list of Directformat values. func DirectformatReadList(buf []byte, dest []Directformat) int { b := 0 for i := 0; i < len(dest); i++ { @@ -259,7 +257,7 @@ func DirectformatReadList(buf []byte, dest []Directformat) int { return xgb.Pad(b) } -// Struct write Directformat +// Bytes writes a Directformat value to a byte slice. func (v Directformat) Bytes() []byte { buf := make([]byte, 16) b := 0 @@ -291,7 +289,7 @@ func (v Directformat) Bytes() []byte { return buf } -// Write struct list Directformat +// DirectformatListBytes writes a list of %s(MISSING) values to a byte slice. func DirectformatListBytes(buf []byte, list []Directformat) int { b := 0 var structBytes []byte @@ -303,8 +301,6 @@ func DirectformatListBytes(buf []byte, list []Directformat) int { return b } -// 'Pictforminfo' struct definition -// Size: 28 type Pictforminfo struct { Id Pictformat Type byte @@ -314,7 +310,7 @@ type Pictforminfo struct { Colormap xproto.Colormap } -// Struct read Pictforminfo +// PictforminfoRead reads a byte slice into a Pictforminfo value. func PictforminfoRead(buf []byte, v *Pictforminfo) int { b := 0 @@ -338,7 +334,7 @@ func PictforminfoRead(buf []byte, v *Pictforminfo) int { return b } -// Struct list read Pictforminfo +// PictforminfoReadList reads a byte slice into a list of Pictforminfo values. func PictforminfoReadList(buf []byte, dest []Pictforminfo) int { b := 0 for i := 0; i < len(dest); i++ { @@ -348,7 +344,7 @@ func PictforminfoReadList(buf []byte, dest []Pictforminfo) int { return xgb.Pad(b) } -// Struct write Pictforminfo +// Bytes writes a Pictforminfo value to a byte slice. func (v Pictforminfo) Bytes() []byte { buf := make([]byte, 28) b := 0 @@ -376,7 +372,7 @@ func (v Pictforminfo) Bytes() []byte { return buf } -// Write struct list Pictforminfo +// PictforminfoListBytes writes a list of %s(MISSING) values to a byte slice. func PictforminfoListBytes(buf []byte, list []Pictforminfo) int { b := 0 var structBytes []byte @@ -388,14 +384,12 @@ func PictforminfoListBytes(buf []byte, list []Pictforminfo) int { return b } -// 'Pictvisual' struct definition -// Size: 8 type Pictvisual struct { Visual xproto.Visualid Format Pictformat } -// Struct read Pictvisual +// PictvisualRead reads a byte slice into a Pictvisual value. func PictvisualRead(buf []byte, v *Pictvisual) int { b := 0 @@ -408,7 +402,7 @@ func PictvisualRead(buf []byte, v *Pictvisual) int { return b } -// Struct list read Pictvisual +// PictvisualReadList reads a byte slice into a list of Pictvisual values. func PictvisualReadList(buf []byte, dest []Pictvisual) int { b := 0 for i := 0; i < len(dest); i++ { @@ -418,7 +412,7 @@ func PictvisualReadList(buf []byte, dest []Pictvisual) int { return xgb.Pad(b) } -// Struct write Pictvisual +// Bytes writes a Pictvisual value to a byte slice. func (v Pictvisual) Bytes() []byte { buf := make([]byte, 8) b := 0 @@ -432,7 +426,7 @@ func (v Pictvisual) Bytes() []byte { return buf } -// Write struct list Pictvisual +// PictvisualListBytes writes a list of %s(MISSING) values to a byte slice. func PictvisualListBytes(buf []byte, list []Pictvisual) int { b := 0 var structBytes []byte @@ -444,8 +438,6 @@ func PictvisualListBytes(buf []byte, list []Pictvisual) int { return b } -// 'Pictdepth' struct definition -// Size: (8 + xgb.Pad((int(NumVisuals) * 8))) type Pictdepth struct { Depth byte // padding: 1 bytes @@ -454,7 +446,7 @@ type Pictdepth struct { Visuals []Pictvisual // size: xgb.Pad((int(NumVisuals) * 8)) } -// Struct read Pictdepth +// PictdepthRead reads a byte slice into a Pictdepth value. func PictdepthRead(buf []byte, v *Pictdepth) int { b := 0 @@ -474,7 +466,7 @@ func PictdepthRead(buf []byte, v *Pictdepth) int { return b } -// Struct list read Pictdepth +// PictdepthReadList reads a byte slice into a list of Pictdepth values. func PictdepthReadList(buf []byte, dest []Pictdepth) int { b := 0 for i := 0; i < len(dest); i++ { @@ -484,7 +476,7 @@ func PictdepthReadList(buf []byte, dest []Pictdepth) int { return xgb.Pad(b) } -// Struct write Pictdepth +// Bytes writes a Pictdepth value to a byte slice. func (v Pictdepth) Bytes() []byte { buf := make([]byte, (8 + xgb.Pad((int(v.NumVisuals) * 8)))) b := 0 @@ -504,7 +496,7 @@ func (v Pictdepth) Bytes() []byte { return buf } -// Write struct list Pictdepth +// PictdepthListBytes writes a list of %s(MISSING) values to a byte slice. func PictdepthListBytes(buf []byte, list []Pictdepth) int { b := 0 var structBytes []byte @@ -516,7 +508,7 @@ func PictdepthListBytes(buf []byte, list []Pictdepth) int { return b } -// Struct list size Pictdepth +// PictdepthListSize computes the size (bytes) of a list of Pictdepth values. func PictdepthListSize(list []Pictdepth) int { size := 0 for _, item := range list { @@ -525,15 +517,13 @@ func PictdepthListSize(list []Pictdepth) int { return size } -// 'Pictscreen' struct definition -// Size: (8 + PictdepthListSize(Depths)) type Pictscreen struct { NumDepths uint32 Fallback Pictformat Depths []Pictdepth // size: PictdepthListSize(Depths) } -// Struct read Pictscreen +// PictscreenRead reads a byte slice into a Pictscreen value. func PictscreenRead(buf []byte, v *Pictscreen) int { b := 0 @@ -549,7 +539,7 @@ func PictscreenRead(buf []byte, v *Pictscreen) int { return b } -// Struct list read Pictscreen +// PictscreenReadList reads a byte slice into a list of Pictscreen values. func PictscreenReadList(buf []byte, dest []Pictscreen) int { b := 0 for i := 0; i < len(dest); i++ { @@ -559,7 +549,7 @@ func PictscreenReadList(buf []byte, dest []Pictscreen) int { return xgb.Pad(b) } -// Struct write Pictscreen +// Bytes writes a Pictscreen value to a byte slice. func (v Pictscreen) Bytes() []byte { buf := make([]byte, (8 + PictdepthListSize(v.Depths))) b := 0 @@ -575,7 +565,7 @@ func (v Pictscreen) Bytes() []byte { return buf } -// Write struct list Pictscreen +// PictscreenListBytes writes a list of %s(MISSING) values to a byte slice. func PictscreenListBytes(buf []byte, list []Pictscreen) int { b := 0 var structBytes []byte @@ -587,7 +577,7 @@ func PictscreenListBytes(buf []byte, list []Pictscreen) int { return b } -// Struct list size Pictscreen +// PictscreenListSize computes the size (bytes) of a list of Pictscreen values. func PictscreenListSize(list []Pictscreen) int { size := 0 for _, item := range list { @@ -596,8 +586,6 @@ func PictscreenListSize(list []Pictscreen) int { return size } -// 'Indexvalue' struct definition -// Size: 12 type Indexvalue struct { Pixel uint32 Red uint16 @@ -606,7 +594,7 @@ type Indexvalue struct { Alpha uint16 } -// Struct read Indexvalue +// IndexvalueRead reads a byte slice into a Indexvalue value. func IndexvalueRead(buf []byte, v *Indexvalue) int { b := 0 @@ -628,7 +616,7 @@ func IndexvalueRead(buf []byte, v *Indexvalue) int { return b } -// Struct list read Indexvalue +// IndexvalueReadList reads a byte slice into a list of Indexvalue values. func IndexvalueReadList(buf []byte, dest []Indexvalue) int { b := 0 for i := 0; i < len(dest); i++ { @@ -638,7 +626,7 @@ func IndexvalueReadList(buf []byte, dest []Indexvalue) int { return xgb.Pad(b) } -// Struct write Indexvalue +// Bytes writes a Indexvalue value to a byte slice. func (v Indexvalue) Bytes() []byte { buf := make([]byte, 12) b := 0 @@ -661,7 +649,7 @@ func (v Indexvalue) Bytes() []byte { return buf } -// Write struct list Indexvalue +// IndexvalueListBytes writes a list of %s(MISSING) values to a byte slice. func IndexvalueListBytes(buf []byte, list []Indexvalue) int { b := 0 var structBytes []byte @@ -673,8 +661,6 @@ func IndexvalueListBytes(buf []byte, list []Indexvalue) int { return b } -// 'Color' struct definition -// Size: 8 type Color struct { Red uint16 Green uint16 @@ -682,7 +668,7 @@ type Color struct { Alpha uint16 } -// Struct read Color +// ColorRead reads a byte slice into a Color value. func ColorRead(buf []byte, v *Color) int { b := 0 @@ -701,7 +687,7 @@ func ColorRead(buf []byte, v *Color) int { return b } -// Struct list read Color +// ColorReadList reads a byte slice into a list of Color values. func ColorReadList(buf []byte, dest []Color) int { b := 0 for i := 0; i < len(dest); i++ { @@ -711,7 +697,7 @@ func ColorReadList(buf []byte, dest []Color) int { return xgb.Pad(b) } -// Struct write Color +// Bytes writes a Color value to a byte slice. func (v Color) Bytes() []byte { buf := make([]byte, 8) b := 0 @@ -731,7 +717,7 @@ func (v Color) Bytes() []byte { return buf } -// Write struct list Color +// ColorListBytes writes a list of %s(MISSING) values to a byte slice. func ColorListBytes(buf []byte, list []Color) int { b := 0 var structBytes []byte @@ -743,14 +729,12 @@ func ColorListBytes(buf []byte, list []Color) int { return b } -// 'Pointfix' struct definition -// Size: 8 type Pointfix struct { X Fixed Y Fixed } -// Struct read Pointfix +// PointfixRead reads a byte slice into a Pointfix value. func PointfixRead(buf []byte, v *Pointfix) int { b := 0 @@ -763,7 +747,7 @@ func PointfixRead(buf []byte, v *Pointfix) int { return b } -// Struct list read Pointfix +// PointfixReadList reads a byte slice into a list of Pointfix values. func PointfixReadList(buf []byte, dest []Pointfix) int { b := 0 for i := 0; i < len(dest); i++ { @@ -773,7 +757,7 @@ func PointfixReadList(buf []byte, dest []Pointfix) int { return xgb.Pad(b) } -// Struct write Pointfix +// Bytes writes a Pointfix value to a byte slice. func (v Pointfix) Bytes() []byte { buf := make([]byte, 8) b := 0 @@ -787,7 +771,7 @@ func (v Pointfix) Bytes() []byte { return buf } -// Write struct list Pointfix +// PointfixListBytes writes a list of %s(MISSING) values to a byte slice. func PointfixListBytes(buf []byte, list []Pointfix) int { b := 0 var structBytes []byte @@ -799,14 +783,12 @@ func PointfixListBytes(buf []byte, list []Pointfix) int { return b } -// 'Linefix' struct definition -// Size: 16 type Linefix struct { P1 Pointfix P2 Pointfix } -// Struct read Linefix +// LinefixRead reads a byte slice into a Linefix value. func LinefixRead(buf []byte, v *Linefix) int { b := 0 @@ -819,7 +801,7 @@ func LinefixRead(buf []byte, v *Linefix) int { return b } -// Struct list read Linefix +// LinefixReadList reads a byte slice into a list of Linefix values. func LinefixReadList(buf []byte, dest []Linefix) int { b := 0 for i := 0; i < len(dest); i++ { @@ -829,7 +811,7 @@ func LinefixReadList(buf []byte, dest []Linefix) int { return xgb.Pad(b) } -// Struct write Linefix +// Bytes writes a Linefix value to a byte slice. func (v Linefix) Bytes() []byte { buf := make([]byte, 16) b := 0 @@ -849,7 +831,7 @@ func (v Linefix) Bytes() []byte { return buf } -// Write struct list Linefix +// LinefixListBytes writes a list of %s(MISSING) values to a byte slice. func LinefixListBytes(buf []byte, list []Linefix) int { b := 0 var structBytes []byte @@ -861,15 +843,13 @@ func LinefixListBytes(buf []byte, list []Linefix) int { return b } -// 'Triangle' struct definition -// Size: 24 type Triangle struct { P1 Pointfix P2 Pointfix P3 Pointfix } -// Struct read Triangle +// TriangleRead reads a byte slice into a Triangle value. func TriangleRead(buf []byte, v *Triangle) int { b := 0 @@ -885,7 +865,7 @@ func TriangleRead(buf []byte, v *Triangle) int { return b } -// Struct list read Triangle +// TriangleReadList reads a byte slice into a list of Triangle values. func TriangleReadList(buf []byte, dest []Triangle) int { b := 0 for i := 0; i < len(dest); i++ { @@ -895,7 +875,7 @@ func TriangleReadList(buf []byte, dest []Triangle) int { return xgb.Pad(b) } -// Struct write Triangle +// Bytes writes a Triangle value to a byte slice. func (v Triangle) Bytes() []byte { buf := make([]byte, 24) b := 0 @@ -921,7 +901,7 @@ func (v Triangle) Bytes() []byte { return buf } -// Write struct list Triangle +// TriangleListBytes writes a list of %s(MISSING) values to a byte slice. func TriangleListBytes(buf []byte, list []Triangle) int { b := 0 var structBytes []byte @@ -933,8 +913,6 @@ func TriangleListBytes(buf []byte, list []Triangle) int { return b } -// 'Trapezoid' struct definition -// Size: 40 type Trapezoid struct { Top Fixed Bottom Fixed @@ -942,7 +920,7 @@ type Trapezoid struct { Right Linefix } -// Struct read Trapezoid +// TrapezoidRead reads a byte slice into a Trapezoid value. func TrapezoidRead(buf []byte, v *Trapezoid) int { b := 0 @@ -961,7 +939,7 @@ func TrapezoidRead(buf []byte, v *Trapezoid) int { return b } -// Struct list read Trapezoid +// TrapezoidReadList reads a byte slice into a list of Trapezoid values. func TrapezoidReadList(buf []byte, dest []Trapezoid) int { b := 0 for i := 0; i < len(dest); i++ { @@ -971,7 +949,7 @@ func TrapezoidReadList(buf []byte, dest []Trapezoid) int { return xgb.Pad(b) } -// Struct write Trapezoid +// Bytes writes a Trapezoid value to a byte slice. func (v Trapezoid) Bytes() []byte { buf := make([]byte, 40) b := 0 @@ -997,7 +975,7 @@ func (v Trapezoid) Bytes() []byte { return buf } -// Write struct list Trapezoid +// TrapezoidListBytes writes a list of %s(MISSING) values to a byte slice. func TrapezoidListBytes(buf []byte, list []Trapezoid) int { b := 0 var structBytes []byte @@ -1009,8 +987,6 @@ func TrapezoidListBytes(buf []byte, list []Trapezoid) int { return b } -// 'Glyphinfo' struct definition -// Size: 12 type Glyphinfo struct { Width uint16 Height uint16 @@ -1020,7 +996,7 @@ type Glyphinfo struct { YOff int16 } -// Struct read Glyphinfo +// GlyphinfoRead reads a byte slice into a Glyphinfo value. func GlyphinfoRead(buf []byte, v *Glyphinfo) int { b := 0 @@ -1045,7 +1021,7 @@ func GlyphinfoRead(buf []byte, v *Glyphinfo) int { return b } -// Struct list read Glyphinfo +// GlyphinfoReadList reads a byte slice into a list of Glyphinfo values. func GlyphinfoReadList(buf []byte, dest []Glyphinfo) int { b := 0 for i := 0; i < len(dest); i++ { @@ -1055,7 +1031,7 @@ func GlyphinfoReadList(buf []byte, dest []Glyphinfo) int { return xgb.Pad(b) } -// Struct write Glyphinfo +// Bytes writes a Glyphinfo value to a byte slice. func (v Glyphinfo) Bytes() []byte { buf := make([]byte, 12) b := 0 @@ -1081,7 +1057,7 @@ func (v Glyphinfo) Bytes() []byte { return buf } -// Write struct list Glyphinfo +// GlyphinfoListBytes writes a list of %s(MISSING) values to a byte slice. func GlyphinfoListBytes(buf []byte, list []Glyphinfo) int { b := 0 var structBytes []byte @@ -1093,8 +1069,6 @@ func GlyphinfoListBytes(buf []byte, list []Glyphinfo) int { return b } -// 'Transform' struct definition -// Size: 36 type Transform struct { Matrix11 Fixed Matrix12 Fixed @@ -1107,7 +1081,7 @@ type Transform struct { Matrix33 Fixed } -// Struct read Transform +// TransformRead reads a byte slice into a Transform value. func TransformRead(buf []byte, v *Transform) int { b := 0 @@ -1141,7 +1115,7 @@ func TransformRead(buf []byte, v *Transform) int { return b } -// Struct list read Transform +// TransformReadList reads a byte slice into a list of Transform values. func TransformReadList(buf []byte, dest []Transform) int { b := 0 for i := 0; i < len(dest); i++ { @@ -1151,7 +1125,7 @@ func TransformReadList(buf []byte, dest []Transform) int { return xgb.Pad(b) } -// Struct write Transform +// Bytes writes a Transform value to a byte slice. func (v Transform) Bytes() []byte { buf := make([]byte, 36) b := 0 @@ -1186,7 +1160,7 @@ func (v Transform) Bytes() []byte { return buf } -// Write struct list Transform +// TransformListBytes writes a list of %s(MISSING) values to a byte slice. func TransformListBytes(buf []byte, list []Transform) int { b := 0 var structBytes []byte @@ -1198,14 +1172,12 @@ func TransformListBytes(buf []byte, list []Transform) int { return b } -// 'Animcursorelt' struct definition -// Size: 8 type Animcursorelt struct { Cursor xproto.Cursor Delay uint32 } -// Struct read Animcursorelt +// AnimcursoreltRead reads a byte slice into a Animcursorelt value. func AnimcursoreltRead(buf []byte, v *Animcursorelt) int { b := 0 @@ -1218,7 +1190,7 @@ func AnimcursoreltRead(buf []byte, v *Animcursorelt) int { return b } -// Struct list read Animcursorelt +// AnimcursoreltReadList reads a byte slice into a list of Animcursorelt values. func AnimcursoreltReadList(buf []byte, dest []Animcursorelt) int { b := 0 for i := 0; i < len(dest); i++ { @@ -1228,7 +1200,7 @@ func AnimcursoreltReadList(buf []byte, dest []Animcursorelt) int { return xgb.Pad(b) } -// Struct write Animcursorelt +// Bytes writes a Animcursorelt value to a byte slice. func (v Animcursorelt) Bytes() []byte { buf := make([]byte, 8) b := 0 @@ -1242,7 +1214,7 @@ func (v Animcursorelt) Bytes() []byte { return buf } -// Write struct list Animcursorelt +// AnimcursoreltListBytes writes a list of %s(MISSING) values to a byte slice. func AnimcursoreltListBytes(buf []byte, list []Animcursorelt) int { b := 0 var structBytes []byte @@ -1254,15 +1226,13 @@ func AnimcursoreltListBytes(buf []byte, list []Animcursorelt) int { return b } -// 'Spanfix' struct definition -// Size: 12 type Spanfix struct { L Fixed R Fixed Y Fixed } -// Struct read Spanfix +// SpanfixRead reads a byte slice into a Spanfix value. func SpanfixRead(buf []byte, v *Spanfix) int { b := 0 @@ -1278,7 +1248,7 @@ func SpanfixRead(buf []byte, v *Spanfix) int { return b } -// Struct list read Spanfix +// SpanfixReadList reads a byte slice into a list of Spanfix values. func SpanfixReadList(buf []byte, dest []Spanfix) int { b := 0 for i := 0; i < len(dest); i++ { @@ -1288,7 +1258,7 @@ func SpanfixReadList(buf []byte, dest []Spanfix) int { return xgb.Pad(b) } -// Struct write Spanfix +// Bytes writes a Spanfix value to a byte slice. func (v Spanfix) Bytes() []byte { buf := make([]byte, 12) b := 0 @@ -1305,7 +1275,7 @@ func (v Spanfix) Bytes() []byte { return buf } -// Write struct list Spanfix +// SpanfixListBytes writes a list of %s(MISSING) values to a byte slice. func SpanfixListBytes(buf []byte, list []Spanfix) int { b := 0 var structBytes []byte @@ -1317,14 +1287,12 @@ func SpanfixListBytes(buf []byte, list []Spanfix) int { return b } -// 'Trap' struct definition -// Size: 24 type Trap struct { Top Spanfix Bot Spanfix } -// Struct read Trap +// TrapRead reads a byte slice into a Trap value. func TrapRead(buf []byte, v *Trap) int { b := 0 @@ -1337,7 +1305,7 @@ func TrapRead(buf []byte, v *Trap) int { return b } -// Struct list read Trap +// TrapReadList reads a byte slice into a list of Trap values. func TrapReadList(buf []byte, dest []Trap) int { b := 0 for i := 0; i < len(dest); i++ { @@ -1347,7 +1315,7 @@ func TrapReadList(buf []byte, dest []Trap) int { return xgb.Pad(b) } -// Struct write Trap +// Bytes writes a Trap value to a byte slice. func (v Trap) Bytes() []byte { buf := make([]byte, 24) b := 0 @@ -1367,7 +1335,7 @@ func (v Trap) Bytes() []byte { return buf } -// Write struct list Trap +// TrapListBytes writes a list of %s(MISSING) values to a byte slice. func TrapListBytes(buf []byte, list []Trap) int { b := 0 var structBytes []byte @@ -1379,9 +1347,7 @@ func TrapListBytes(buf []byte, list []Trap) int { return b } -// Error definition PictFormat (0) -// Size: 32 - +// BadPictFormat is the error number for a BadPictFormat. const BadPictFormat = 0 type PictFormatError struct { @@ -1389,7 +1355,7 @@ type PictFormatError struct { NiceName string } -// Error read PictFormat +// PictFormatErrorNew constructs a PictFormatError value that implements xgb.Error from a byte slice. func PictFormatErrorNew(buf []byte) xgb.Error { v := PictFormatError{} v.NiceName = "PictFormat" @@ -1403,8 +1369,8 @@ func PictFormatErrorNew(buf []byte) xgb.Error { return v } -func (err PictFormatError) ImplementsError() {} - +// SequenceId returns the sequence id attached to the BadPictFormat error. +// This is mostly used internally. func (err PictFormatError) SequenceId() uint16 { return err.Sequence } @@ -1424,9 +1390,7 @@ func init() { xgb.NewExtErrorFuncs["RENDER"][0] = PictFormatErrorNew } -// Error definition Picture (1) -// Size: 32 - +// BadPicture is the error number for a BadPicture. const BadPicture = 1 type PictureError struct { @@ -1434,7 +1398,7 @@ type PictureError struct { NiceName string } -// Error read Picture +// PictureErrorNew constructs a PictureError value that implements xgb.Error from a byte slice. func PictureErrorNew(buf []byte) xgb.Error { v := PictureError{} v.NiceName = "Picture" @@ -1448,8 +1412,8 @@ func PictureErrorNew(buf []byte) xgb.Error { return v } -func (err PictureError) ImplementsError() {} - +// SequenceId returns the sequence id attached to the BadPicture error. +// This is mostly used internally. func (err PictureError) SequenceId() uint16 { return err.Sequence } @@ -1469,9 +1433,7 @@ func init() { xgb.NewExtErrorFuncs["RENDER"][1] = PictureErrorNew } -// Error definition PictOp (2) -// Size: 32 - +// BadPictOp is the error number for a BadPictOp. const BadPictOp = 2 type PictOpError struct { @@ -1479,7 +1441,7 @@ type PictOpError struct { NiceName string } -// Error read PictOp +// PictOpErrorNew constructs a PictOpError value that implements xgb.Error from a byte slice. func PictOpErrorNew(buf []byte) xgb.Error { v := PictOpError{} v.NiceName = "PictOp" @@ -1493,8 +1455,8 @@ func PictOpErrorNew(buf []byte) xgb.Error { return v } -func (err PictOpError) ImplementsError() {} - +// SequenceId returns the sequence id attached to the BadPictOp error. +// This is mostly used internally. func (err PictOpError) SequenceId() uint16 { return err.Sequence } @@ -1514,9 +1476,7 @@ func init() { xgb.NewExtErrorFuncs["RENDER"][2] = PictOpErrorNew } -// Error definition GlyphSet (3) -// Size: 32 - +// BadGlyphSet is the error number for a BadGlyphSet. const BadGlyphSet = 3 type GlyphSetError struct { @@ -1524,7 +1484,7 @@ type GlyphSetError struct { NiceName string } -// Error read GlyphSet +// GlyphSetErrorNew constructs a GlyphSetError value that implements xgb.Error from a byte slice. func GlyphSetErrorNew(buf []byte) xgb.Error { v := GlyphSetError{} v.NiceName = "GlyphSet" @@ -1538,8 +1498,8 @@ func GlyphSetErrorNew(buf []byte) xgb.Error { return v } -func (err GlyphSetError) ImplementsError() {} - +// SequenceId returns the sequence id attached to the BadGlyphSet error. +// This is mostly used internally. func (err GlyphSetError) SequenceId() uint16 { return err.Sequence } @@ -1559,9 +1519,7 @@ func init() { xgb.NewExtErrorFuncs["RENDER"][3] = GlyphSetErrorNew } -// Error definition Glyph (4) -// Size: 32 - +// BadGlyph is the error number for a BadGlyph. const BadGlyph = 4 type GlyphError struct { @@ -1569,7 +1527,7 @@ type GlyphError struct { NiceName string } -// Error read Glyph +// GlyphErrorNew constructs a GlyphError value that implements xgb.Error from a byte slice. func GlyphErrorNew(buf []byte) xgb.Error { v := GlyphError{} v.NiceName = "Glyph" @@ -1583,8 +1541,8 @@ func GlyphErrorNew(buf []byte) xgb.Error { return v } -func (err GlyphError) ImplementsError() {} - +// SequenceId returns the sequence id attached to the BadGlyph error. +// This is mostly used internally. func (err GlyphError) SequenceId() uint16 { return err.Sequence } @@ -1604,36 +1562,38 @@ func init() { xgb.NewExtErrorFuncs["RENDER"][4] = GlyphErrorNew } -// Request QueryVersion -// size: 12 +// QueryVersionCookie is a cookie used only for QueryVersion requests. type QueryVersionCookie 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, ClientMajorVersion uint32, ClientMinorVersion uint32) QueryVersionCookie { cookie := c.NewCookie(true, true) c.NewRequest(queryVersionRequest(c, ClientMajorVersion, ClientMinorVersion), cookie) return QueryVersionCookie{cookie} } +// QueryVersionUnchecked sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryVersionUnchecked(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVersion uint32) QueryVersionCookie { cookie := c.NewCookie(false, true) c.NewRequest(queryVersionRequest(c, ClientMajorVersion, ClientMinorVersion), cookie) return QueryVersionCookie{cookie} } -// Request reply for QueryVersion -// size: 32 +// QueryVersionReply represents the data returned from a QueryVersion request. type QueryVersionReply struct { - Sequence uint16 - Length uint32 + 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 } -// Waits and reads reply data from request QueryVersion +// 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 { @@ -1645,7 +1605,7 @@ func (cook QueryVersionCookie) Reply() (*QueryVersionReply, error) { return queryVersionReply(buf), nil } -// Read reply into structure from buffer for QueryVersion +// queryVersionReply reads a byte slice into a QueryVersionReply value. func queryVersionReply(buf []byte) *QueryVersionReply { v := new(QueryVersionReply) b := 1 // skip reply determinant @@ -1670,6 +1630,7 @@ func queryVersionReply(buf []byte) *QueryVersionReply { } // Write request to wire for QueryVersion +// queryVersionRequest writes a QueryVersion request to a byte slice. func queryVersionRequest(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVersion uint32) []byte { size := 12 b := 0 @@ -1693,29 +1654,31 @@ func queryVersionRequest(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVers return buf } -// Request QueryPictFormats -// size: 4 +// QueryPictFormatsCookie is a cookie used only for QueryPictFormats requests. type QueryPictFormatsCookie struct { *xgb.Cookie } +// QueryPictFormats sends a checked request. +// If an error occurs, it will be returned with the reply by calling QueryPictFormatsCookie.Reply() func QueryPictFormats(c *xgb.Conn) QueryPictFormatsCookie { cookie := c.NewCookie(true, true) c.NewRequest(queryPictFormatsRequest(c), cookie) return QueryPictFormatsCookie{cookie} } +// QueryPictFormatsUnchecked sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryPictFormatsUnchecked(c *xgb.Conn) QueryPictFormatsCookie { cookie := c.NewCookie(false, true) c.NewRequest(queryPictFormatsRequest(c), cookie) return QueryPictFormatsCookie{cookie} } -// Request reply for QueryPictFormats -// size: (((32 + xgb.Pad((int(NumFormats) * 28))) + PictscreenListSize(Screens)) + xgb.Pad((int(NumSubpixel) * 4))) +// QueryPictFormatsReply represents the data returned from a QueryPictFormats request. type QueryPictFormatsReply struct { - Sequence uint16 - Length uint32 + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply // padding: 1 bytes NumFormats uint32 NumScreens uint32 @@ -1728,7 +1691,7 @@ type QueryPictFormatsReply struct { Subpixels []uint32 // size: xgb.Pad((int(NumSubpixel) * 4)) } -// Waits and reads reply data from request QueryPictFormats +// Reply blocks and returns the reply data for a QueryPictFormats request. func (cook QueryPictFormatsCookie) Reply() (*QueryPictFormatsReply, error) { buf, err := cook.Cookie.Reply() if err != nil { @@ -1740,7 +1703,7 @@ func (cook QueryPictFormatsCookie) Reply() (*QueryPictFormatsReply, error) { return queryPictFormatsReply(buf), nil } -// Read reply into structure from buffer for QueryPictFormats +// queryPictFormatsReply reads a byte slice into a QueryPictFormatsReply value. func queryPictFormatsReply(buf []byte) *QueryPictFormatsReply { v := new(QueryPictFormatsReply) b := 1 // skip reply determinant @@ -1787,6 +1750,7 @@ func queryPictFormatsReply(buf []byte) *QueryPictFormatsReply { } // Write request to wire for QueryPictFormats +// queryPictFormatsRequest writes a QueryPictFormats request to a byte slice. func queryPictFormatsRequest(c *xgb.Conn) []byte { size := 4 b := 0 @@ -1804,36 +1768,38 @@ func queryPictFormatsRequest(c *xgb.Conn) []byte { return buf } -// Request QueryPictIndexValues -// size: 8 +// QueryPictIndexValuesCookie is a cookie used only for QueryPictIndexValues requests. type QueryPictIndexValuesCookie struct { *xgb.Cookie } +// QueryPictIndexValues sends a checked request. +// If an error occurs, it will be returned with the reply by calling QueryPictIndexValuesCookie.Reply() func QueryPictIndexValues(c *xgb.Conn, Format Pictformat) QueryPictIndexValuesCookie { cookie := c.NewCookie(true, true) c.NewRequest(queryPictIndexValuesRequest(c, Format), cookie) return QueryPictIndexValuesCookie{cookie} } +// QueryPictIndexValuesUnchecked sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryPictIndexValuesUnchecked(c *xgb.Conn, Format Pictformat) QueryPictIndexValuesCookie { cookie := c.NewCookie(false, true) c.NewRequest(queryPictIndexValuesRequest(c, Format), cookie) return QueryPictIndexValuesCookie{cookie} } -// Request reply for QueryPictIndexValues -// size: (32 + xgb.Pad((int(NumValues) * 12))) +// QueryPictIndexValuesReply represents the data returned from a QueryPictIndexValues request. type QueryPictIndexValuesReply struct { - Sequence uint16 - Length uint32 + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply // padding: 1 bytes NumValues uint32 // padding: 20 bytes Values []Indexvalue // size: xgb.Pad((int(NumValues) * 12)) } -// Waits and reads reply data from request QueryPictIndexValues +// Reply blocks and returns the reply data for a QueryPictIndexValues request. func (cook QueryPictIndexValuesCookie) Reply() (*QueryPictIndexValuesReply, error) { buf, err := cook.Cookie.Reply() if err != nil { @@ -1845,7 +1811,7 @@ func (cook QueryPictIndexValuesCookie) Reply() (*QueryPictIndexValuesReply, erro return queryPictIndexValuesReply(buf), nil } -// Read reply into structure from buffer for QueryPictIndexValues +// queryPictIndexValuesReply reads a byte slice into a QueryPictIndexValuesReply value. func queryPictIndexValuesReply(buf []byte) *QueryPictIndexValuesReply { v := new(QueryPictIndexValuesReply) b := 1 // skip reply determinant @@ -1870,6 +1836,7 @@ func queryPictIndexValuesReply(buf []byte) *QueryPictIndexValuesReply { } // Write request to wire for QueryPictIndexValues +// queryPictIndexValuesRequest writes a QueryPictIndexValues request to a byte slice. func queryPictIndexValuesRequest(c *xgb.Conn, Format Pictformat) []byte { size := 8 b := 0 @@ -1890,30 +1857,35 @@ func queryPictIndexValuesRequest(c *xgb.Conn, Format Pictformat) []byte { return buf } -// Request CreatePicture -// size: xgb.Pad((16 + (4 + xgb.Pad((4 * xgb.PopCount(int(ValueMask))))))) +// CreatePictureCookie is a cookie used only for CreatePicture requests. type CreatePictureCookie struct { *xgb.Cookie } -// Write request to wire for CreatePicture +// CreatePicture sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreatePicture(c *xgb.Conn, Pid Picture, Drawable xproto.Drawable, Format Pictformat, ValueMask uint32, ValueList []uint32) CreatePictureCookie { cookie := c.NewCookie(false, false) c.NewRequest(createPictureRequest(c, Pid, Drawable, Format, ValueMask, ValueList), cookie) return CreatePictureCookie{cookie} } +// CreatePictureChecked sends a checked request. +// If an error occurs, it can be retrieved using CreatePictureCookie.Check() func CreatePictureChecked(c *xgb.Conn, Pid Picture, Drawable xproto.Drawable, Format Pictformat, ValueMask uint32, ValueList []uint32) CreatePictureCookie { cookie := c.NewCookie(true, false) c.NewRequest(createPictureRequest(c, Pid, Drawable, Format, ValueMask, ValueList), cookie) return CreatePictureCookie{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 CreatePictureCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for CreatePicture +// createPictureRequest writes a CreatePicture request to a byte slice. func createPictureRequest(c *xgb.Conn, Pid Picture, Drawable xproto.Drawable, Format Pictformat, ValueMask uint32, ValueList []uint32) []byte { size := xgb.Pad((16 + (4 + xgb.Pad((4 * xgb.PopCount(int(ValueMask))))))) b := 0 @@ -1948,30 +1920,35 @@ func createPictureRequest(c *xgb.Conn, Pid Picture, Drawable xproto.Drawable, Fo return buf } -// Request ChangePicture -// size: xgb.Pad((8 + (4 + xgb.Pad((4 * xgb.PopCount(int(ValueMask))))))) +// ChangePictureCookie is a cookie used only for ChangePicture requests. type ChangePictureCookie struct { *xgb.Cookie } -// Write request to wire for ChangePicture +// ChangePicture sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ChangePicture(c *xgb.Conn, Picture Picture, ValueMask uint32, ValueList []uint32) ChangePictureCookie { cookie := c.NewCookie(false, false) c.NewRequest(changePictureRequest(c, Picture, ValueMask, ValueList), cookie) return ChangePictureCookie{cookie} } +// ChangePictureChecked sends a checked request. +// If an error occurs, it can be retrieved using ChangePictureCookie.Check() func ChangePictureChecked(c *xgb.Conn, Picture Picture, ValueMask uint32, ValueList []uint32) ChangePictureCookie { cookie := c.NewCookie(true, false) c.NewRequest(changePictureRequest(c, Picture, ValueMask, ValueList), cookie) return ChangePictureCookie{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 ChangePictureCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for ChangePicture +// changePictureRequest writes a ChangePicture request to a byte slice. func changePictureRequest(c *xgb.Conn, Picture Picture, ValueMask uint32, ValueList []uint32) []byte { size := xgb.Pad((8 + (4 + xgb.Pad((4 * xgb.PopCount(int(ValueMask))))))) b := 0 @@ -2000,30 +1977,35 @@ func changePictureRequest(c *xgb.Conn, Picture Picture, ValueMask uint32, ValueL return buf } -// Request SetPictureClipRectangles -// size: xgb.Pad((12 + xgb.Pad((len(Rectangles) * 8)))) +// SetPictureClipRectanglesCookie is a cookie used only for SetPictureClipRectangles requests. type SetPictureClipRectanglesCookie struct { *xgb.Cookie } -// Write request to wire for SetPictureClipRectangles +// SetPictureClipRectangles sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetPictureClipRectangles(c *xgb.Conn, Picture Picture, ClipXOrigin int16, ClipYOrigin int16, Rectangles []xproto.Rectangle) SetPictureClipRectanglesCookie { cookie := c.NewCookie(false, false) c.NewRequest(setPictureClipRectanglesRequest(c, Picture, ClipXOrigin, ClipYOrigin, Rectangles), cookie) return SetPictureClipRectanglesCookie{cookie} } +// SetPictureClipRectanglesChecked sends a checked request. +// If an error occurs, it can be retrieved using SetPictureClipRectanglesCookie.Check() func SetPictureClipRectanglesChecked(c *xgb.Conn, Picture Picture, ClipXOrigin int16, ClipYOrigin int16, Rectangles []xproto.Rectangle) SetPictureClipRectanglesCookie { cookie := c.NewCookie(true, false) c.NewRequest(setPictureClipRectanglesRequest(c, Picture, ClipXOrigin, ClipYOrigin, Rectangles), cookie) return SetPictureClipRectanglesCookie{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 SetPictureClipRectanglesCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for SetPictureClipRectangles +// setPictureClipRectanglesRequest writes a SetPictureClipRectangles request to a byte slice. func setPictureClipRectanglesRequest(c *xgb.Conn, Picture Picture, ClipXOrigin int16, ClipYOrigin int16, Rectangles []xproto.Rectangle) []byte { size := xgb.Pad((12 + xgb.Pad((len(Rectangles) * 8)))) b := 0 @@ -2052,30 +2034,35 @@ func setPictureClipRectanglesRequest(c *xgb.Conn, Picture Picture, ClipXOrigin i return buf } -// Request FreePicture -// size: 8 +// FreePictureCookie is a cookie used only for FreePicture requests. type FreePictureCookie struct { *xgb.Cookie } -// Write request to wire for FreePicture +// FreePicture sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func FreePicture(c *xgb.Conn, Picture Picture) FreePictureCookie { cookie := c.NewCookie(false, false) c.NewRequest(freePictureRequest(c, Picture), cookie) return FreePictureCookie{cookie} } +// FreePictureChecked sends a checked request. +// If an error occurs, it can be retrieved using FreePictureCookie.Check() func FreePictureChecked(c *xgb.Conn, Picture Picture) FreePictureCookie { cookie := c.NewCookie(true, false) c.NewRequest(freePictureRequest(c, Picture), cookie) return FreePictureCookie{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 FreePictureCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for FreePicture +// freePictureRequest writes a FreePicture request to a byte slice. func freePictureRequest(c *xgb.Conn, Picture Picture) []byte { size := 8 b := 0 @@ -2096,30 +2083,35 @@ func freePictureRequest(c *xgb.Conn, Picture Picture) []byte { return buf } -// Request Composite -// size: 36 +// CompositeCookie is a cookie used only for Composite requests. type CompositeCookie struct { *xgb.Cookie } -// Write request to wire for Composite +// Composite sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func Composite(c *xgb.Conn, Op byte, Src Picture, Mask Picture, Dst Picture, SrcX int16, SrcY int16, MaskX int16, MaskY int16, DstX int16, DstY int16, Width uint16, Height uint16) CompositeCookie { cookie := c.NewCookie(false, false) c.NewRequest(compositeRequest(c, Op, Src, Mask, Dst, SrcX, SrcY, MaskX, MaskY, DstX, DstY, Width, Height), cookie) return CompositeCookie{cookie} } +// CompositeChecked sends a checked request. +// If an error occurs, it can be retrieved using CompositeCookie.Check() func CompositeChecked(c *xgb.Conn, Op byte, Src Picture, Mask Picture, Dst Picture, SrcX int16, SrcY int16, MaskX int16, MaskY int16, DstX int16, DstY int16, Width uint16, Height uint16) CompositeCookie { cookie := c.NewCookie(true, false) c.NewRequest(compositeRequest(c, Op, Src, Mask, Dst, SrcX, SrcY, MaskX, MaskY, DstX, DstY, Width, Height), cookie) return CompositeCookie{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 CompositeCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for Composite +// compositeRequest writes a Composite request to a byte slice. func compositeRequest(c *xgb.Conn, Op byte, Src Picture, Mask Picture, Dst Picture, SrcX int16, SrcY int16, MaskX int16, MaskY int16, DstX int16, DstY int16, Width uint16, Height uint16) []byte { size := 36 b := 0 @@ -2175,30 +2167,35 @@ func compositeRequest(c *xgb.Conn, Op byte, Src Picture, Mask Picture, Dst Pictu return buf } -// Request Trapezoids -// size: xgb.Pad((24 + xgb.Pad((len(Traps) * 40)))) +// TrapezoidsCookie is a cookie used only for Trapezoids requests. type TrapezoidsCookie struct { *xgb.Cookie } -// Write request to wire for Trapezoids +// Trapezoids sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func Trapezoids(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Traps []Trapezoid) TrapezoidsCookie { cookie := c.NewCookie(false, false) c.NewRequest(trapezoidsRequest(c, Op, Src, Dst, MaskFormat, SrcX, SrcY, Traps), cookie) return TrapezoidsCookie{cookie} } +// TrapezoidsChecked sends a checked request. +// If an error occurs, it can be retrieved using TrapezoidsCookie.Check() func TrapezoidsChecked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Traps []Trapezoid) TrapezoidsCookie { cookie := c.NewCookie(true, false) c.NewRequest(trapezoidsRequest(c, Op, Src, Dst, MaskFormat, SrcX, SrcY, Traps), cookie) return TrapezoidsCookie{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 TrapezoidsCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for Trapezoids +// trapezoidsRequest writes a Trapezoids request to a byte slice. func trapezoidsRequest(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Traps []Trapezoid) []byte { size := xgb.Pad((24 + xgb.Pad((len(Traps) * 40)))) b := 0 @@ -2238,30 +2235,35 @@ func trapezoidsRequest(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskForma return buf } -// Request Triangles -// size: xgb.Pad((24 + xgb.Pad((len(Triangles) * 24)))) +// TrianglesCookie is a cookie used only for Triangles requests. type TrianglesCookie struct { *xgb.Cookie } -// Write request to wire for Triangles +// Triangles sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func Triangles(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Triangles []Triangle) TrianglesCookie { cookie := c.NewCookie(false, false) c.NewRequest(trianglesRequest(c, Op, Src, Dst, MaskFormat, SrcX, SrcY, Triangles), cookie) return TrianglesCookie{cookie} } +// TrianglesChecked sends a checked request. +// If an error occurs, it can be retrieved using TrianglesCookie.Check() func TrianglesChecked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Triangles []Triangle) TrianglesCookie { cookie := c.NewCookie(true, false) c.NewRequest(trianglesRequest(c, Op, Src, Dst, MaskFormat, SrcX, SrcY, Triangles), cookie) return TrianglesCookie{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 TrianglesCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for Triangles +// trianglesRequest writes a Triangles request to a byte slice. func trianglesRequest(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Triangles []Triangle) []byte { size := xgb.Pad((24 + xgb.Pad((len(Triangles) * 24)))) b := 0 @@ -2301,30 +2303,35 @@ func trianglesRequest(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat return buf } -// Request TriStrip -// size: xgb.Pad((24 + xgb.Pad((len(Points) * 8)))) +// TriStripCookie is a cookie used only for TriStrip requests. type TriStripCookie struct { *xgb.Cookie } -// Write request to wire for TriStrip +// TriStrip sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func TriStrip(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Points []Pointfix) TriStripCookie { cookie := c.NewCookie(false, false) c.NewRequest(triStripRequest(c, Op, Src, Dst, MaskFormat, SrcX, SrcY, Points), cookie) return TriStripCookie{cookie} } +// TriStripChecked sends a checked request. +// If an error occurs, it can be retrieved using TriStripCookie.Check() func TriStripChecked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Points []Pointfix) TriStripCookie { cookie := c.NewCookie(true, false) c.NewRequest(triStripRequest(c, Op, Src, Dst, MaskFormat, SrcX, SrcY, Points), cookie) return TriStripCookie{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 TriStripCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for TriStrip +// triStripRequest writes a TriStrip request to a byte slice. func triStripRequest(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Points []Pointfix) []byte { size := xgb.Pad((24 + xgb.Pad((len(Points) * 8)))) b := 0 @@ -2364,30 +2371,35 @@ func triStripRequest(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat return buf } -// Request TriFan -// size: xgb.Pad((24 + xgb.Pad((len(Points) * 8)))) +// TriFanCookie is a cookie used only for TriFan requests. type TriFanCookie struct { *xgb.Cookie } -// Write request to wire for TriFan +// TriFan sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func TriFan(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Points []Pointfix) TriFanCookie { cookie := c.NewCookie(false, false) c.NewRequest(triFanRequest(c, Op, Src, Dst, MaskFormat, SrcX, SrcY, Points), cookie) return TriFanCookie{cookie} } +// TriFanChecked sends a checked request. +// If an error occurs, it can be retrieved using TriFanCookie.Check() func TriFanChecked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Points []Pointfix) TriFanCookie { cookie := c.NewCookie(true, false) c.NewRequest(triFanRequest(c, Op, Src, Dst, MaskFormat, SrcX, SrcY, Points), cookie) return TriFanCookie{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 TriFanCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for TriFan +// triFanRequest writes a TriFan request to a byte slice. func triFanRequest(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Points []Pointfix) []byte { size := xgb.Pad((24 + xgb.Pad((len(Points) * 8)))) b := 0 @@ -2427,30 +2439,35 @@ func triFanRequest(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pi return buf } -// Request CreateGlyphSet -// size: 12 +// CreateGlyphSetCookie is a cookie used only for CreateGlyphSet requests. type CreateGlyphSetCookie struct { *xgb.Cookie } -// Write request to wire for CreateGlyphSet +// CreateGlyphSet sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateGlyphSet(c *xgb.Conn, Gsid Glyphset, Format Pictformat) CreateGlyphSetCookie { cookie := c.NewCookie(false, false) c.NewRequest(createGlyphSetRequest(c, Gsid, Format), cookie) return CreateGlyphSetCookie{cookie} } +// CreateGlyphSetChecked sends a checked request. +// If an error occurs, it can be retrieved using CreateGlyphSetCookie.Check() func CreateGlyphSetChecked(c *xgb.Conn, Gsid Glyphset, Format Pictformat) CreateGlyphSetCookie { cookie := c.NewCookie(true, false) c.NewRequest(createGlyphSetRequest(c, Gsid, Format), cookie) return CreateGlyphSetCookie{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 CreateGlyphSetCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for CreateGlyphSet +// createGlyphSetRequest writes a CreateGlyphSet request to a byte slice. func createGlyphSetRequest(c *xgb.Conn, Gsid Glyphset, Format Pictformat) []byte { size := 12 b := 0 @@ -2474,30 +2491,35 @@ func createGlyphSetRequest(c *xgb.Conn, Gsid Glyphset, Format Pictformat) []byte return buf } -// Request ReferenceGlyphSet -// size: 12 +// ReferenceGlyphSetCookie is a cookie used only for ReferenceGlyphSet requests. type ReferenceGlyphSetCookie struct { *xgb.Cookie } -// Write request to wire for ReferenceGlyphSet +// ReferenceGlyphSet sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ReferenceGlyphSet(c *xgb.Conn, Gsid Glyphset, Existing Glyphset) ReferenceGlyphSetCookie { cookie := c.NewCookie(false, false) c.NewRequest(referenceGlyphSetRequest(c, Gsid, Existing), cookie) return ReferenceGlyphSetCookie{cookie} } +// ReferenceGlyphSetChecked sends a checked request. +// If an error occurs, it can be retrieved using ReferenceGlyphSetCookie.Check() func ReferenceGlyphSetChecked(c *xgb.Conn, Gsid Glyphset, Existing Glyphset) ReferenceGlyphSetCookie { cookie := c.NewCookie(true, false) c.NewRequest(referenceGlyphSetRequest(c, Gsid, Existing), cookie) return ReferenceGlyphSetCookie{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 ReferenceGlyphSetCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for ReferenceGlyphSet +// referenceGlyphSetRequest writes a ReferenceGlyphSet request to a byte slice. func referenceGlyphSetRequest(c *xgb.Conn, Gsid Glyphset, Existing Glyphset) []byte { size := 12 b := 0 @@ -2521,30 +2543,35 @@ func referenceGlyphSetRequest(c *xgb.Conn, Gsid Glyphset, Existing Glyphset) []b return buf } -// Request FreeGlyphSet -// size: 8 +// FreeGlyphSetCookie is a cookie used only for FreeGlyphSet requests. type FreeGlyphSetCookie struct { *xgb.Cookie } -// Write request to wire for FreeGlyphSet +// FreeGlyphSet sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func FreeGlyphSet(c *xgb.Conn, Glyphset Glyphset) FreeGlyphSetCookie { cookie := c.NewCookie(false, false) c.NewRequest(freeGlyphSetRequest(c, Glyphset), cookie) return FreeGlyphSetCookie{cookie} } +// FreeGlyphSetChecked sends a checked request. +// If an error occurs, it can be retrieved using FreeGlyphSetCookie.Check() func FreeGlyphSetChecked(c *xgb.Conn, Glyphset Glyphset) FreeGlyphSetCookie { cookie := c.NewCookie(true, false) c.NewRequest(freeGlyphSetRequest(c, Glyphset), cookie) return FreeGlyphSetCookie{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 FreeGlyphSetCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for FreeGlyphSet +// freeGlyphSetRequest writes a FreeGlyphSet request to a byte slice. func freeGlyphSetRequest(c *xgb.Conn, Glyphset Glyphset) []byte { size := 8 b := 0 @@ -2565,30 +2592,35 @@ func freeGlyphSetRequest(c *xgb.Conn, Glyphset Glyphset) []byte { return buf } -// Request AddGlyphs -// size: xgb.Pad((((12 + xgb.Pad((int(GlyphsLen) * 4))) + xgb.Pad((int(GlyphsLen) * 12))) + xgb.Pad((len(Data) * 1)))) +// AddGlyphsCookie is a cookie used only for AddGlyphs requests. type AddGlyphsCookie struct { *xgb.Cookie } -// Write request to wire for AddGlyphs +// AddGlyphs sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func AddGlyphs(c *xgb.Conn, Glyphset Glyphset, GlyphsLen uint32, Glyphids []uint32, Glyphs []Glyphinfo, Data []byte) AddGlyphsCookie { cookie := c.NewCookie(false, false) c.NewRequest(addGlyphsRequest(c, Glyphset, GlyphsLen, Glyphids, Glyphs, Data), cookie) return AddGlyphsCookie{cookie} } +// AddGlyphsChecked sends a checked request. +// If an error occurs, it can be retrieved using AddGlyphsCookie.Check() func AddGlyphsChecked(c *xgb.Conn, Glyphset Glyphset, GlyphsLen uint32, Glyphids []uint32, Glyphs []Glyphinfo, Data []byte) AddGlyphsCookie { cookie := c.NewCookie(true, false) c.NewRequest(addGlyphsRequest(c, Glyphset, GlyphsLen, Glyphids, Glyphs, Data), cookie) return AddGlyphsCookie{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 AddGlyphsCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for AddGlyphs +// addGlyphsRequest writes a AddGlyphs request to a byte slice. func addGlyphsRequest(c *xgb.Conn, Glyphset Glyphset, GlyphsLen uint32, Glyphids []uint32, Glyphs []Glyphinfo, Data []byte) []byte { size := xgb.Pad((((12 + xgb.Pad((int(GlyphsLen) * 4))) + xgb.Pad((int(GlyphsLen) * 12))) + xgb.Pad((len(Data) * 1)))) b := 0 @@ -2623,30 +2655,35 @@ func addGlyphsRequest(c *xgb.Conn, Glyphset Glyphset, GlyphsLen uint32, Glyphids return buf } -// Request FreeGlyphs -// size: xgb.Pad((8 + xgb.Pad((len(Glyphs) * 4)))) +// FreeGlyphsCookie is a cookie used only for FreeGlyphs requests. type FreeGlyphsCookie struct { *xgb.Cookie } -// Write request to wire for FreeGlyphs +// FreeGlyphs sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func FreeGlyphs(c *xgb.Conn, Glyphset Glyphset, Glyphs []Glyph) FreeGlyphsCookie { cookie := c.NewCookie(false, false) c.NewRequest(freeGlyphsRequest(c, Glyphset, Glyphs), cookie) return FreeGlyphsCookie{cookie} } +// FreeGlyphsChecked sends a checked request. +// If an error occurs, it can be retrieved using FreeGlyphsCookie.Check() func FreeGlyphsChecked(c *xgb.Conn, Glyphset Glyphset, Glyphs []Glyph) FreeGlyphsCookie { cookie := c.NewCookie(true, false) c.NewRequest(freeGlyphsRequest(c, Glyphset, Glyphs), cookie) return FreeGlyphsCookie{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 FreeGlyphsCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for FreeGlyphs +// freeGlyphsRequest writes a FreeGlyphs request to a byte slice. func freeGlyphsRequest(c *xgb.Conn, Glyphset Glyphset, Glyphs []Glyph) []byte { size := xgb.Pad((8 + xgb.Pad((len(Glyphs) * 4)))) b := 0 @@ -2673,30 +2710,35 @@ func freeGlyphsRequest(c *xgb.Conn, Glyphset Glyphset, Glyphs []Glyph) []byte { return buf } -// Request CompositeGlyphs8 -// size: xgb.Pad((28 + xgb.Pad((len(Glyphcmds) * 1)))) +// CompositeGlyphs8Cookie is a cookie used only for CompositeGlyphs8 requests. type CompositeGlyphs8Cookie struct { *xgb.Cookie } -// Write request to wire for CompositeGlyphs8 +// CompositeGlyphs8 sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CompositeGlyphs8(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) CompositeGlyphs8Cookie { cookie := c.NewCookie(false, false) c.NewRequest(compositeGlyphs8Request(c, Op, Src, Dst, MaskFormat, Glyphset, SrcX, SrcY, Glyphcmds), cookie) return CompositeGlyphs8Cookie{cookie} } +// CompositeGlyphs8Checked sends a checked request. +// If an error occurs, it can be retrieved using CompositeGlyphs8Cookie.Check() func CompositeGlyphs8Checked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) CompositeGlyphs8Cookie { cookie := c.NewCookie(true, false) c.NewRequest(compositeGlyphs8Request(c, Op, Src, Dst, MaskFormat, Glyphset, SrcX, SrcY, Glyphcmds), cookie) return CompositeGlyphs8Cookie{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 CompositeGlyphs8Cookie) Check() error { return cook.Cookie.Check() } // Write request to wire for CompositeGlyphs8 +// compositeGlyphs8Request writes a CompositeGlyphs8 request to a byte slice. func compositeGlyphs8Request(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) []byte { size := xgb.Pad((28 + xgb.Pad((len(Glyphcmds) * 1)))) b := 0 @@ -2740,30 +2782,35 @@ func compositeGlyphs8Request(c *xgb.Conn, Op byte, Src Picture, Dst Picture, Mas return buf } -// Request CompositeGlyphs16 -// size: xgb.Pad((28 + xgb.Pad((len(Glyphcmds) * 1)))) +// CompositeGlyphs16Cookie is a cookie used only for CompositeGlyphs16 requests. type CompositeGlyphs16Cookie struct { *xgb.Cookie } -// Write request to wire for CompositeGlyphs16 +// CompositeGlyphs16 sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CompositeGlyphs16(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) CompositeGlyphs16Cookie { cookie := c.NewCookie(false, false) c.NewRequest(compositeGlyphs16Request(c, Op, Src, Dst, MaskFormat, Glyphset, SrcX, SrcY, Glyphcmds), cookie) return CompositeGlyphs16Cookie{cookie} } +// CompositeGlyphs16Checked sends a checked request. +// If an error occurs, it can be retrieved using CompositeGlyphs16Cookie.Check() func CompositeGlyphs16Checked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) CompositeGlyphs16Cookie { cookie := c.NewCookie(true, false) c.NewRequest(compositeGlyphs16Request(c, Op, Src, Dst, MaskFormat, Glyphset, SrcX, SrcY, Glyphcmds), cookie) return CompositeGlyphs16Cookie{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 CompositeGlyphs16Cookie) Check() error { return cook.Cookie.Check() } // Write request to wire for CompositeGlyphs16 +// compositeGlyphs16Request writes a CompositeGlyphs16 request to a byte slice. func compositeGlyphs16Request(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) []byte { size := xgb.Pad((28 + xgb.Pad((len(Glyphcmds) * 1)))) b := 0 @@ -2807,30 +2854,35 @@ func compositeGlyphs16Request(c *xgb.Conn, Op byte, Src Picture, Dst Picture, Ma return buf } -// Request CompositeGlyphs32 -// size: xgb.Pad((28 + xgb.Pad((len(Glyphcmds) * 1)))) +// CompositeGlyphs32Cookie is a cookie used only for CompositeGlyphs32 requests. type CompositeGlyphs32Cookie struct { *xgb.Cookie } -// Write request to wire for CompositeGlyphs32 +// CompositeGlyphs32 sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CompositeGlyphs32(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) CompositeGlyphs32Cookie { cookie := c.NewCookie(false, false) c.NewRequest(compositeGlyphs32Request(c, Op, Src, Dst, MaskFormat, Glyphset, SrcX, SrcY, Glyphcmds), cookie) return CompositeGlyphs32Cookie{cookie} } +// CompositeGlyphs32Checked sends a checked request. +// If an error occurs, it can be retrieved using CompositeGlyphs32Cookie.Check() func CompositeGlyphs32Checked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) CompositeGlyphs32Cookie { cookie := c.NewCookie(true, false) c.NewRequest(compositeGlyphs32Request(c, Op, Src, Dst, MaskFormat, Glyphset, SrcX, SrcY, Glyphcmds), cookie) return CompositeGlyphs32Cookie{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 CompositeGlyphs32Cookie) Check() error { return cook.Cookie.Check() } // Write request to wire for CompositeGlyphs32 +// compositeGlyphs32Request writes a CompositeGlyphs32 request to a byte slice. func compositeGlyphs32Request(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) []byte { size := xgb.Pad((28 + xgb.Pad((len(Glyphcmds) * 1)))) b := 0 @@ -2874,30 +2926,35 @@ func compositeGlyphs32Request(c *xgb.Conn, Op byte, Src Picture, Dst Picture, Ma return buf } -// Request FillRectangles -// size: xgb.Pad((20 + xgb.Pad((len(Rects) * 8)))) +// FillRectanglesCookie is a cookie used only for FillRectangles requests. type FillRectanglesCookie struct { *xgb.Cookie } -// Write request to wire for FillRectangles +// FillRectangles sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func FillRectangles(c *xgb.Conn, Op byte, Dst Picture, Color Color, Rects []xproto.Rectangle) FillRectanglesCookie { cookie := c.NewCookie(false, false) c.NewRequest(fillRectanglesRequest(c, Op, Dst, Color, Rects), cookie) return FillRectanglesCookie{cookie} } +// FillRectanglesChecked sends a checked request. +// If an error occurs, it can be retrieved using FillRectanglesCookie.Check() func FillRectanglesChecked(c *xgb.Conn, Op byte, Dst Picture, Color Color, Rects []xproto.Rectangle) FillRectanglesCookie { cookie := c.NewCookie(true, false) c.NewRequest(fillRectanglesRequest(c, Op, Dst, Color, Rects), cookie) return FillRectanglesCookie{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 FillRectanglesCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for FillRectangles +// fillRectanglesRequest writes a FillRectangles request to a byte slice. func fillRectanglesRequest(c *xgb.Conn, Op byte, Dst Picture, Color Color, Rects []xproto.Rectangle) []byte { size := xgb.Pad((20 + xgb.Pad((len(Rects) * 8)))) b := 0 @@ -2931,30 +2988,35 @@ func fillRectanglesRequest(c *xgb.Conn, Op byte, Dst Picture, Color Color, Rects return buf } -// Request CreateCursor -// size: 16 +// CreateCursorCookie is a cookie used only for CreateCursor requests. type CreateCursorCookie struct { *xgb.Cookie } -// Write request to wire for CreateCursor +// CreateCursor sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateCursor(c *xgb.Conn, Cid xproto.Cursor, Source Picture, X uint16, Y uint16) CreateCursorCookie { cookie := c.NewCookie(false, false) c.NewRequest(createCursorRequest(c, Cid, Source, X, Y), cookie) return CreateCursorCookie{cookie} } +// CreateCursorChecked sends a checked request. +// If an error occurs, it can be retrieved using CreateCursorCookie.Check() func CreateCursorChecked(c *xgb.Conn, Cid xproto.Cursor, Source Picture, X uint16, Y uint16) CreateCursorCookie { cookie := c.NewCookie(true, false) c.NewRequest(createCursorRequest(c, Cid, Source, X, Y), cookie) return CreateCursorCookie{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 CreateCursorCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for CreateCursor +// createCursorRequest writes a CreateCursor request to a byte slice. func createCursorRequest(c *xgb.Conn, Cid xproto.Cursor, Source Picture, X uint16, Y uint16) []byte { size := 16 b := 0 @@ -2984,30 +3046,35 @@ func createCursorRequest(c *xgb.Conn, Cid xproto.Cursor, Source Picture, X uint1 return buf } -// Request SetPictureTransform -// size: 44 +// SetPictureTransformCookie is a cookie used only for SetPictureTransform requests. type SetPictureTransformCookie struct { *xgb.Cookie } -// Write request to wire for SetPictureTransform +// SetPictureTransform sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetPictureTransform(c *xgb.Conn, Picture Picture, Transform Transform) SetPictureTransformCookie { cookie := c.NewCookie(false, false) c.NewRequest(setPictureTransformRequest(c, Picture, Transform), cookie) return SetPictureTransformCookie{cookie} } +// SetPictureTransformChecked sends a checked request. +// If an error occurs, it can be retrieved using SetPictureTransformCookie.Check() func SetPictureTransformChecked(c *xgb.Conn, Picture Picture, Transform Transform) SetPictureTransformCookie { cookie := c.NewCookie(true, false) c.NewRequest(setPictureTransformRequest(c, Picture, Transform), cookie) return SetPictureTransformCookie{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 SetPictureTransformCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for SetPictureTransform +// setPictureTransformRequest writes a SetPictureTransform request to a byte slice. func setPictureTransformRequest(c *xgb.Conn, Picture Picture, Transform Transform) []byte { size := 44 b := 0 @@ -3034,29 +3101,31 @@ func setPictureTransformRequest(c *xgb.Conn, Picture Picture, Transform Transfor return buf } -// Request QueryFilters -// size: 8 +// QueryFiltersCookie is a cookie used only for QueryFilters requests. type QueryFiltersCookie struct { *xgb.Cookie } +// QueryFilters sends a checked request. +// If an error occurs, it will be returned with the reply by calling QueryFiltersCookie.Reply() func QueryFilters(c *xgb.Conn, Drawable xproto.Drawable) QueryFiltersCookie { cookie := c.NewCookie(true, true) c.NewRequest(queryFiltersRequest(c, Drawable), cookie) return QueryFiltersCookie{cookie} } +// QueryFiltersUnchecked sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryFiltersUnchecked(c *xgb.Conn, Drawable xproto.Drawable) QueryFiltersCookie { cookie := c.NewCookie(false, true) c.NewRequest(queryFiltersRequest(c, Drawable), cookie) return QueryFiltersCookie{cookie} } -// Request reply for QueryFilters -// size: ((32 + xgb.Pad((int(NumAliases) * 2))) + xproto.StrListSize(Filters)) +// QueryFiltersReply represents the data returned from a QueryFilters request. type QueryFiltersReply struct { - Sequence uint16 - Length uint32 + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply // padding: 1 bytes NumAliases uint32 NumFilters uint32 @@ -3065,7 +3134,7 @@ type QueryFiltersReply struct { Filters []xproto.Str // size: xproto.StrListSize(Filters) } -// Waits and reads reply data from request QueryFilters +// Reply blocks and returns the reply data for a QueryFilters request. func (cook QueryFiltersCookie) Reply() (*QueryFiltersReply, error) { buf, err := cook.Cookie.Reply() if err != nil { @@ -3077,7 +3146,7 @@ func (cook QueryFiltersCookie) Reply() (*QueryFiltersReply, error) { return queryFiltersReply(buf), nil } -// Read reply into structure from buffer for QueryFilters +// queryFiltersReply reads a byte slice into a QueryFiltersReply value. func queryFiltersReply(buf []byte) *QueryFiltersReply { v := new(QueryFiltersReply) b := 1 // skip reply determinant @@ -3112,6 +3181,7 @@ func queryFiltersReply(buf []byte) *QueryFiltersReply { } // Write request to wire for QueryFilters +// queryFiltersRequest writes a QueryFilters request to a byte slice. func queryFiltersRequest(c *xgb.Conn, Drawable xproto.Drawable) []byte { size := 8 b := 0 @@ -3132,30 +3202,35 @@ func queryFiltersRequest(c *xgb.Conn, Drawable xproto.Drawable) []byte { return buf } -// Request SetPictureFilter -// size: xgb.Pad(((12 + xgb.Pad((int(FilterLen) * 1))) + xgb.Pad((len(Values) * 4)))) +// SetPictureFilterCookie is a cookie used only for SetPictureFilter requests. type SetPictureFilterCookie struct { *xgb.Cookie } -// Write request to wire for SetPictureFilter +// SetPictureFilter sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetPictureFilter(c *xgb.Conn, Picture Picture, FilterLen uint16, Filter string, Values []Fixed) SetPictureFilterCookie { cookie := c.NewCookie(false, false) c.NewRequest(setPictureFilterRequest(c, Picture, FilterLen, Filter, Values), cookie) return SetPictureFilterCookie{cookie} } +// SetPictureFilterChecked sends a checked request. +// If an error occurs, it can be retrieved using SetPictureFilterCookie.Check() func SetPictureFilterChecked(c *xgb.Conn, Picture Picture, FilterLen uint16, Filter string, Values []Fixed) SetPictureFilterCookie { cookie := c.NewCookie(true, false) c.NewRequest(setPictureFilterRequest(c, Picture, FilterLen, Filter, Values), cookie) return SetPictureFilterCookie{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 SetPictureFilterCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for SetPictureFilter +// setPictureFilterRequest writes a SetPictureFilter request to a byte slice. func setPictureFilterRequest(c *xgb.Conn, Picture Picture, FilterLen uint16, Filter string, Values []Fixed) []byte { size := xgb.Pad(((12 + xgb.Pad((int(FilterLen) * 1))) + xgb.Pad((len(Values) * 4)))) b := 0 @@ -3190,30 +3265,35 @@ func setPictureFilterRequest(c *xgb.Conn, Picture Picture, FilterLen uint16, Fil return buf } -// Request CreateAnimCursor -// size: xgb.Pad((8 + xgb.Pad((len(Cursors) * 8)))) +// CreateAnimCursorCookie is a cookie used only for CreateAnimCursor requests. type CreateAnimCursorCookie struct { *xgb.Cookie } -// Write request to wire for CreateAnimCursor +// CreateAnimCursor sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateAnimCursor(c *xgb.Conn, Cid xproto.Cursor, Cursors []Animcursorelt) CreateAnimCursorCookie { cookie := c.NewCookie(false, false) c.NewRequest(createAnimCursorRequest(c, Cid, Cursors), cookie) return CreateAnimCursorCookie{cookie} } +// CreateAnimCursorChecked sends a checked request. +// If an error occurs, it can be retrieved using CreateAnimCursorCookie.Check() func CreateAnimCursorChecked(c *xgb.Conn, Cid xproto.Cursor, Cursors []Animcursorelt) CreateAnimCursorCookie { cookie := c.NewCookie(true, false) c.NewRequest(createAnimCursorRequest(c, Cid, Cursors), cookie) return CreateAnimCursorCookie{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 CreateAnimCursorCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for CreateAnimCursor +// createAnimCursorRequest writes a CreateAnimCursor request to a byte slice. func createAnimCursorRequest(c *xgb.Conn, Cid xproto.Cursor, Cursors []Animcursorelt) []byte { size := xgb.Pad((8 + xgb.Pad((len(Cursors) * 8)))) b := 0 @@ -3236,30 +3316,35 @@ func createAnimCursorRequest(c *xgb.Conn, Cid xproto.Cursor, Cursors []Animcurso return buf } -// Request AddTraps -// size: xgb.Pad((12 + xgb.Pad((len(Traps) * 24)))) +// AddTrapsCookie is a cookie used only for AddTraps requests. type AddTrapsCookie struct { *xgb.Cookie } -// Write request to wire for AddTraps +// AddTraps sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func AddTraps(c *xgb.Conn, Picture Picture, XOff int16, YOff int16, Traps []Trap) AddTrapsCookie { cookie := c.NewCookie(false, false) c.NewRequest(addTrapsRequest(c, Picture, XOff, YOff, Traps), cookie) return AddTrapsCookie{cookie} } +// AddTrapsChecked sends a checked request. +// If an error occurs, it can be retrieved using AddTrapsCookie.Check() func AddTrapsChecked(c *xgb.Conn, Picture Picture, XOff int16, YOff int16, Traps []Trap) AddTrapsCookie { cookie := c.NewCookie(true, false) c.NewRequest(addTrapsRequest(c, Picture, XOff, YOff, Traps), cookie) return AddTrapsCookie{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 AddTrapsCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for AddTraps +// addTrapsRequest writes a AddTraps request to a byte slice. func addTrapsRequest(c *xgb.Conn, Picture Picture, XOff int16, YOff int16, Traps []Trap) []byte { size := xgb.Pad((12 + xgb.Pad((len(Traps) * 24)))) b := 0 @@ -3288,30 +3373,35 @@ func addTrapsRequest(c *xgb.Conn, Picture Picture, XOff int16, YOff int16, Traps return buf } -// Request CreateSolidFill -// size: 16 +// CreateSolidFillCookie is a cookie used only for CreateSolidFill requests. type CreateSolidFillCookie struct { *xgb.Cookie } -// Write request to wire for CreateSolidFill +// CreateSolidFill sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateSolidFill(c *xgb.Conn, Picture Picture, Color Color) CreateSolidFillCookie { cookie := c.NewCookie(false, false) c.NewRequest(createSolidFillRequest(c, Picture, Color), cookie) return CreateSolidFillCookie{cookie} } +// CreateSolidFillChecked sends a checked request. +// If an error occurs, it can be retrieved using CreateSolidFillCookie.Check() func CreateSolidFillChecked(c *xgb.Conn, Picture Picture, Color Color) CreateSolidFillCookie { cookie := c.NewCookie(true, false) c.NewRequest(createSolidFillRequest(c, Picture, Color), cookie) return CreateSolidFillCookie{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 CreateSolidFillCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for CreateSolidFill +// createSolidFillRequest writes a CreateSolidFill request to a byte slice. func createSolidFillRequest(c *xgb.Conn, Picture Picture, Color Color) []byte { size := 16 b := 0 @@ -3338,30 +3428,35 @@ func createSolidFillRequest(c *xgb.Conn, Picture Picture, Color Color) []byte { return buf } -// Request CreateLinearGradient -// size: xgb.Pad(((28 + xgb.Pad((int(NumStops) * 4))) + xgb.Pad((int(NumStops) * 8)))) +// CreateLinearGradientCookie is a cookie used only for CreateLinearGradient requests. type CreateLinearGradientCookie struct { *xgb.Cookie } -// Write request to wire for CreateLinearGradient +// CreateLinearGradient sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateLinearGradient(c *xgb.Conn, Picture Picture, P1 Pointfix, P2 Pointfix, NumStops uint32, Stops []Fixed, Colors []Color) CreateLinearGradientCookie { cookie := c.NewCookie(false, false) c.NewRequest(createLinearGradientRequest(c, Picture, P1, P2, NumStops, Stops, Colors), cookie) return CreateLinearGradientCookie{cookie} } +// CreateLinearGradientChecked sends a checked request. +// If an error occurs, it can be retrieved using CreateLinearGradientCookie.Check() func CreateLinearGradientChecked(c *xgb.Conn, Picture Picture, P1 Pointfix, P2 Pointfix, NumStops uint32, Stops []Fixed, Colors []Color) CreateLinearGradientCookie { cookie := c.NewCookie(true, false) c.NewRequest(createLinearGradientRequest(c, Picture, P1, P2, NumStops, Stops, Colors), cookie) return CreateLinearGradientCookie{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 CreateLinearGradientCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for CreateLinearGradient +// createLinearGradientRequest writes a CreateLinearGradient request to a byte slice. func createLinearGradientRequest(c *xgb.Conn, Picture Picture, P1 Pointfix, P2 Pointfix, NumStops uint32, Stops []Fixed, Colors []Color) []byte { size := xgb.Pad(((28 + xgb.Pad((int(NumStops) * 4))) + xgb.Pad((int(NumStops) * 8)))) b := 0 @@ -3405,30 +3500,35 @@ func createLinearGradientRequest(c *xgb.Conn, Picture Picture, P1 Pointfix, P2 P return buf } -// Request CreateRadialGradient -// size: xgb.Pad(((36 + xgb.Pad((int(NumStops) * 4))) + xgb.Pad((int(NumStops) * 8)))) +// CreateRadialGradientCookie is a cookie used only for CreateRadialGradient requests. type CreateRadialGradientCookie struct { *xgb.Cookie } -// Write request to wire for CreateRadialGradient +// CreateRadialGradient sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateRadialGradient(c *xgb.Conn, Picture Picture, Inner Pointfix, Outer Pointfix, InnerRadius Fixed, OuterRadius Fixed, NumStops uint32, Stops []Fixed, Colors []Color) CreateRadialGradientCookie { cookie := c.NewCookie(false, false) c.NewRequest(createRadialGradientRequest(c, Picture, Inner, Outer, InnerRadius, OuterRadius, NumStops, Stops, Colors), cookie) return CreateRadialGradientCookie{cookie} } +// CreateRadialGradientChecked sends a checked request. +// If an error occurs, it can be retrieved using CreateRadialGradientCookie.Check() func CreateRadialGradientChecked(c *xgb.Conn, Picture Picture, Inner Pointfix, Outer Pointfix, InnerRadius Fixed, OuterRadius Fixed, NumStops uint32, Stops []Fixed, Colors []Color) CreateRadialGradientCookie { cookie := c.NewCookie(true, false) c.NewRequest(createRadialGradientRequest(c, Picture, Inner, Outer, InnerRadius, OuterRadius, NumStops, Stops, Colors), cookie) return CreateRadialGradientCookie{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 CreateRadialGradientCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for CreateRadialGradient +// createRadialGradientRequest writes a CreateRadialGradient request to a byte slice. func createRadialGradientRequest(c *xgb.Conn, Picture Picture, Inner Pointfix, Outer Pointfix, InnerRadius Fixed, OuterRadius Fixed, NumStops uint32, Stops []Fixed, Colors []Color) []byte { size := xgb.Pad(((36 + xgb.Pad((int(NumStops) * 4))) + xgb.Pad((int(NumStops) * 8)))) b := 0 @@ -3478,30 +3578,35 @@ func createRadialGradientRequest(c *xgb.Conn, Picture Picture, Inner Pointfix, O return buf } -// Request CreateConicalGradient -// size: xgb.Pad(((24 + xgb.Pad((int(NumStops) * 4))) + xgb.Pad((int(NumStops) * 8)))) +// CreateConicalGradientCookie is a cookie used only for CreateConicalGradient requests. type CreateConicalGradientCookie struct { *xgb.Cookie } -// Write request to wire for CreateConicalGradient +// CreateConicalGradient sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateConicalGradient(c *xgb.Conn, Picture Picture, Center Pointfix, Angle Fixed, NumStops uint32, Stops []Fixed, Colors []Color) CreateConicalGradientCookie { cookie := c.NewCookie(false, false) c.NewRequest(createConicalGradientRequest(c, Picture, Center, Angle, NumStops, Stops, Colors), cookie) return CreateConicalGradientCookie{cookie} } +// CreateConicalGradientChecked sends a checked request. +// If an error occurs, it can be retrieved using CreateConicalGradientCookie.Check() func CreateConicalGradientChecked(c *xgb.Conn, Picture Picture, Center Pointfix, Angle Fixed, NumStops uint32, Stops []Fixed, Colors []Color) CreateConicalGradientCookie { cookie := c.NewCookie(true, false) c.NewRequest(createConicalGradientRequest(c, Picture, Center, Angle, NumStops, Stops, Colors), cookie) return CreateConicalGradientCookie{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 CreateConicalGradientCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for CreateConicalGradient +// createConicalGradientRequest writes a CreateConicalGradient request to a byte slice. func createConicalGradientRequest(c *xgb.Conn, Picture Picture, Center Pointfix, Angle Fixed, NumStops uint32, Stops []Fixed, Colors []Color) []byte { size := xgb.Pad(((24 + xgb.Pad((int(NumStops) * 4))) + xgb.Pad((int(NumStops) * 8)))) b := 0 -- cgit v1.2.3 From 3e6b3544934cb71e3a3b0edf9bc184241ac1ad7f Mon Sep 17 00:00:00 2001 From: "Andrew Gallant (Ocelot)" Date: Fri, 11 May 2012 01:58:52 -0400 Subject: add a little more docs for errors --- nexgb/render/render.go | 41 ++++++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 13 deletions(-) (limited to 'nexgb/render') diff --git a/nexgb/render/render.go b/nexgb/render/render.go index 61f0b96..65b0723 100644 --- a/nexgb/render/render.go +++ b/nexgb/render/render.go @@ -2,7 +2,7 @@ package render /* - This file was generated by render.xml on May 10 2012 11:56:19pm EDT. + This file was generated by render.xml on May 11 2012 1:58:36am EDT. This file is automatically generated. Edit at your peril! */ @@ -40,18 +40,6 @@ func init() { xgb.NewExtErrorFuncs["RENDER"] = make(map[int]xgb.NewErrorFun) } -// 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' @@ -64,6 +52,18 @@ func init() { // 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' + const ( PictTypeIndexed = 0 PictTypeDirect = 1 @@ -1375,10 +1375,13 @@ func (err PictFormatError) SequenceId() uint16 { return err.Sequence } +// BadId returns the 'BadValue' number if one exists for the BadPictFormat error. If no bad value exists, 0 is returned. func (err PictFormatError) BadId() uint32 { return 0 } +// Error returns a rudimentary string representation of the BadPictFormat error. + func (err PictFormatError) Error() string { fieldVals := make([]string, 0, 0) fieldVals = append(fieldVals, "NiceName: "+err.NiceName) @@ -1418,10 +1421,13 @@ func (err PictureError) SequenceId() uint16 { return err.Sequence } +// BadId returns the 'BadValue' number if one exists for the BadPicture error. If no bad value exists, 0 is returned. func (err PictureError) BadId() uint32 { return 0 } +// Error returns a rudimentary string representation of the BadPicture error. + func (err PictureError) Error() string { fieldVals := make([]string, 0, 0) fieldVals = append(fieldVals, "NiceName: "+err.NiceName) @@ -1461,10 +1467,13 @@ func (err PictOpError) SequenceId() uint16 { return err.Sequence } +// BadId returns the 'BadValue' number if one exists for the BadPictOp error. If no bad value exists, 0 is returned. func (err PictOpError) BadId() uint32 { return 0 } +// Error returns a rudimentary string representation of the BadPictOp error. + func (err PictOpError) Error() string { fieldVals := make([]string, 0, 0) fieldVals = append(fieldVals, "NiceName: "+err.NiceName) @@ -1504,10 +1513,13 @@ func (err GlyphSetError) SequenceId() uint16 { return err.Sequence } +// BadId returns the 'BadValue' number if one exists for the BadGlyphSet error. If no bad value exists, 0 is returned. func (err GlyphSetError) BadId() uint32 { return 0 } +// Error returns a rudimentary string representation of the BadGlyphSet error. + func (err GlyphSetError) Error() string { fieldVals := make([]string, 0, 0) fieldVals = append(fieldVals, "NiceName: "+err.NiceName) @@ -1547,10 +1559,13 @@ func (err GlyphError) SequenceId() uint16 { return err.Sequence } +// BadId returns the 'BadValue' number if one exists for the BadGlyph error. If no bad value exists, 0 is returned. func (err GlyphError) BadId() uint32 { return 0 } +// Error returns a rudimentary string representation of the BadGlyph error. + func (err GlyphError) Error() string { fieldVals := make([]string, 0, 0) fieldVals = append(fieldVals, "NiceName: "+err.NiceName) -- cgit v1.2.3 From 29942bf078c92fea681e42ca5029592526f00718 Mon Sep 17 00:00:00 2001 From: "Andrew Gallant (Ocelot)" Date: Fri, 11 May 2012 23:58:52 -0400 Subject: panic when an extension request is issued before an extension has been initialized. but give a nice error message for the happy people. --- nexgb/render/render.go | 200 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 193 insertions(+), 7 deletions(-) (limited to 'nexgb/render') diff --git a/nexgb/render/render.go b/nexgb/render/render.go index 65b0723..f7fa79f 100644 --- a/nexgb/render/render.go +++ b/nexgb/render/render.go @@ -2,7 +2,7 @@ package render /* - This file was generated by render.xml on May 11 2012 1:58:36am EDT. + This file was generated by render.xml on May 11 2012 11:57:19pm EDT. This file is automatically generated. Edit at your peril! */ @@ -40,12 +40,6 @@ func init() { xgb.NewExtErrorFuncs["RENDER"] = make(map[int]xgb.NewErrorFun) } -// Skipping definition for base type 'Card32' - -// Skipping definition for base type 'Double' - -// Skipping definition for base type 'Bool' - // Skipping definition for base type 'Float' // Skipping definition for base type 'Card8' @@ -64,6 +58,12 @@ func init() { // Skipping definition for base type 'Char' +// Skipping definition for base type 'Card32' + +// Skipping definition for base type 'Double' + +// Skipping definition for base type 'Bool' + const ( PictTypeIndexed = 0 PictTypeDirect = 1 @@ -1585,6 +1585,9 @@ type QueryVersionCookie struct { // 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, ClientMajorVersion uint32, ClientMinorVersion uint32) QueryVersionCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(queryVersionRequest(c, ClientMajorVersion, ClientMinorVersion), cookie) return QueryVersionCookie{cookie} @@ -1593,6 +1596,9 @@ func QueryVersion(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVersion uin // QueryVersionUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryVersionUnchecked(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVersion uint32) QueryVersionCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(queryVersionRequest(c, ClientMajorVersion, ClientMinorVersion), cookie) return QueryVersionCookie{cookie} @@ -1677,6 +1683,9 @@ type QueryPictFormatsCookie struct { // QueryPictFormats sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryPictFormatsCookie.Reply() func QueryPictFormats(c *xgb.Conn) QueryPictFormatsCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'QueryPictFormats' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(queryPictFormatsRequest(c), cookie) return QueryPictFormatsCookie{cookie} @@ -1685,6 +1694,9 @@ func QueryPictFormats(c *xgb.Conn) QueryPictFormatsCookie { // QueryPictFormatsUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryPictFormatsUnchecked(c *xgb.Conn) QueryPictFormatsCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'QueryPictFormats' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(queryPictFormatsRequest(c), cookie) return QueryPictFormatsCookie{cookie} @@ -1791,6 +1803,9 @@ type QueryPictIndexValuesCookie struct { // QueryPictIndexValues sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryPictIndexValuesCookie.Reply() func QueryPictIndexValues(c *xgb.Conn, Format Pictformat) QueryPictIndexValuesCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'QueryPictIndexValues' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(queryPictIndexValuesRequest(c, Format), cookie) return QueryPictIndexValuesCookie{cookie} @@ -1799,6 +1814,9 @@ func QueryPictIndexValues(c *xgb.Conn, Format Pictformat) QueryPictIndexValuesCo // QueryPictIndexValuesUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryPictIndexValuesUnchecked(c *xgb.Conn, Format Pictformat) QueryPictIndexValuesCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'QueryPictIndexValues' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(queryPictIndexValuesRequest(c, Format), cookie) return QueryPictIndexValuesCookie{cookie} @@ -1880,6 +1898,9 @@ type CreatePictureCookie struct { // CreatePicture sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreatePicture(c *xgb.Conn, Pid Picture, Drawable xproto.Drawable, Format Pictformat, ValueMask uint32, ValueList []uint32) CreatePictureCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'CreatePicture' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(createPictureRequest(c, Pid, Drawable, Format, ValueMask, ValueList), cookie) return CreatePictureCookie{cookie} @@ -1888,6 +1909,9 @@ func CreatePicture(c *xgb.Conn, Pid Picture, Drawable xproto.Drawable, Format Pi // CreatePictureChecked sends a checked request. // If an error occurs, it can be retrieved using CreatePictureCookie.Check() func CreatePictureChecked(c *xgb.Conn, Pid Picture, Drawable xproto.Drawable, Format Pictformat, ValueMask uint32, ValueList []uint32) CreatePictureCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'CreatePicture' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(createPictureRequest(c, Pid, Drawable, Format, ValueMask, ValueList), cookie) return CreatePictureCookie{cookie} @@ -1943,6 +1967,9 @@ type ChangePictureCookie struct { // ChangePicture sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ChangePicture(c *xgb.Conn, Picture Picture, ValueMask uint32, ValueList []uint32) ChangePictureCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'ChangePicture' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(changePictureRequest(c, Picture, ValueMask, ValueList), cookie) return ChangePictureCookie{cookie} @@ -1951,6 +1978,9 @@ func ChangePicture(c *xgb.Conn, Picture Picture, ValueMask uint32, ValueList []u // ChangePictureChecked sends a checked request. // If an error occurs, it can be retrieved using ChangePictureCookie.Check() func ChangePictureChecked(c *xgb.Conn, Picture Picture, ValueMask uint32, ValueList []uint32) ChangePictureCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'ChangePicture' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(changePictureRequest(c, Picture, ValueMask, ValueList), cookie) return ChangePictureCookie{cookie} @@ -2000,6 +2030,9 @@ type SetPictureClipRectanglesCookie struct { // SetPictureClipRectangles sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetPictureClipRectangles(c *xgb.Conn, Picture Picture, ClipXOrigin int16, ClipYOrigin int16, Rectangles []xproto.Rectangle) SetPictureClipRectanglesCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'SetPictureClipRectangles' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(setPictureClipRectanglesRequest(c, Picture, ClipXOrigin, ClipYOrigin, Rectangles), cookie) return SetPictureClipRectanglesCookie{cookie} @@ -2008,6 +2041,9 @@ func SetPictureClipRectangles(c *xgb.Conn, Picture Picture, ClipXOrigin int16, C // SetPictureClipRectanglesChecked sends a checked request. // If an error occurs, it can be retrieved using SetPictureClipRectanglesCookie.Check() func SetPictureClipRectanglesChecked(c *xgb.Conn, Picture Picture, ClipXOrigin int16, ClipYOrigin int16, Rectangles []xproto.Rectangle) SetPictureClipRectanglesCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'SetPictureClipRectangles' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(setPictureClipRectanglesRequest(c, Picture, ClipXOrigin, ClipYOrigin, Rectangles), cookie) return SetPictureClipRectanglesCookie{cookie} @@ -2057,6 +2093,9 @@ type FreePictureCookie struct { // FreePicture sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func FreePicture(c *xgb.Conn, Picture Picture) FreePictureCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'FreePicture' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(freePictureRequest(c, Picture), cookie) return FreePictureCookie{cookie} @@ -2065,6 +2104,9 @@ func FreePicture(c *xgb.Conn, Picture Picture) FreePictureCookie { // FreePictureChecked sends a checked request. // If an error occurs, it can be retrieved using FreePictureCookie.Check() func FreePictureChecked(c *xgb.Conn, Picture Picture) FreePictureCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'FreePicture' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(freePictureRequest(c, Picture), cookie) return FreePictureCookie{cookie} @@ -2106,6 +2148,9 @@ type CompositeCookie struct { // Composite sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func Composite(c *xgb.Conn, Op byte, Src Picture, Mask Picture, Dst Picture, SrcX int16, SrcY int16, MaskX int16, MaskY int16, DstX int16, DstY int16, Width uint16, Height uint16) CompositeCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'Composite' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(compositeRequest(c, Op, Src, Mask, Dst, SrcX, SrcY, MaskX, MaskY, DstX, DstY, Width, Height), cookie) return CompositeCookie{cookie} @@ -2114,6 +2159,9 @@ func Composite(c *xgb.Conn, Op byte, Src Picture, Mask Picture, Dst Picture, Src // CompositeChecked sends a checked request. // If an error occurs, it can be retrieved using CompositeCookie.Check() func CompositeChecked(c *xgb.Conn, Op byte, Src Picture, Mask Picture, Dst Picture, SrcX int16, SrcY int16, MaskX int16, MaskY int16, DstX int16, DstY int16, Width uint16, Height uint16) CompositeCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'Composite' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(compositeRequest(c, Op, Src, Mask, Dst, SrcX, SrcY, MaskX, MaskY, DstX, DstY, Width, Height), cookie) return CompositeCookie{cookie} @@ -2190,6 +2238,9 @@ type TrapezoidsCookie struct { // Trapezoids sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func Trapezoids(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Traps []Trapezoid) TrapezoidsCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'Trapezoids' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(trapezoidsRequest(c, Op, Src, Dst, MaskFormat, SrcX, SrcY, Traps), cookie) return TrapezoidsCookie{cookie} @@ -2198,6 +2249,9 @@ func Trapezoids(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictf // TrapezoidsChecked sends a checked request. // If an error occurs, it can be retrieved using TrapezoidsCookie.Check() func TrapezoidsChecked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Traps []Trapezoid) TrapezoidsCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'Trapezoids' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(trapezoidsRequest(c, Op, Src, Dst, MaskFormat, SrcX, SrcY, Traps), cookie) return TrapezoidsCookie{cookie} @@ -2258,6 +2312,9 @@ type TrianglesCookie struct { // Triangles sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func Triangles(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Triangles []Triangle) TrianglesCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'Triangles' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(trianglesRequest(c, Op, Src, Dst, MaskFormat, SrcX, SrcY, Triangles), cookie) return TrianglesCookie{cookie} @@ -2266,6 +2323,9 @@ func Triangles(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictfo // TrianglesChecked sends a checked request. // If an error occurs, it can be retrieved using TrianglesCookie.Check() func TrianglesChecked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Triangles []Triangle) TrianglesCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'Triangles' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(trianglesRequest(c, Op, Src, Dst, MaskFormat, SrcX, SrcY, Triangles), cookie) return TrianglesCookie{cookie} @@ -2326,6 +2386,9 @@ type TriStripCookie struct { // TriStrip sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func TriStrip(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Points []Pointfix) TriStripCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'TriStrip' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(triStripRequest(c, Op, Src, Dst, MaskFormat, SrcX, SrcY, Points), cookie) return TriStripCookie{cookie} @@ -2334,6 +2397,9 @@ func TriStrip(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictfor // TriStripChecked sends a checked request. // If an error occurs, it can be retrieved using TriStripCookie.Check() func TriStripChecked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Points []Pointfix) TriStripCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'TriStrip' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(triStripRequest(c, Op, Src, Dst, MaskFormat, SrcX, SrcY, Points), cookie) return TriStripCookie{cookie} @@ -2394,6 +2460,9 @@ type TriFanCookie struct { // TriFan sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func TriFan(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Points []Pointfix) TriFanCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'TriFan' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(triFanRequest(c, Op, Src, Dst, MaskFormat, SrcX, SrcY, Points), cookie) return TriFanCookie{cookie} @@ -2402,6 +2471,9 @@ func TriFan(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictforma // TriFanChecked sends a checked request. // If an error occurs, it can be retrieved using TriFanCookie.Check() func TriFanChecked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Points []Pointfix) TriFanCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'TriFan' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(triFanRequest(c, Op, Src, Dst, MaskFormat, SrcX, SrcY, Points), cookie) return TriFanCookie{cookie} @@ -2462,6 +2534,9 @@ type CreateGlyphSetCookie struct { // CreateGlyphSet sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateGlyphSet(c *xgb.Conn, Gsid Glyphset, Format Pictformat) CreateGlyphSetCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'CreateGlyphSet' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(createGlyphSetRequest(c, Gsid, Format), cookie) return CreateGlyphSetCookie{cookie} @@ -2470,6 +2545,9 @@ func CreateGlyphSet(c *xgb.Conn, Gsid Glyphset, Format Pictformat) CreateGlyphSe // CreateGlyphSetChecked sends a checked request. // If an error occurs, it can be retrieved using CreateGlyphSetCookie.Check() func CreateGlyphSetChecked(c *xgb.Conn, Gsid Glyphset, Format Pictformat) CreateGlyphSetCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'CreateGlyphSet' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(createGlyphSetRequest(c, Gsid, Format), cookie) return CreateGlyphSetCookie{cookie} @@ -2514,6 +2592,9 @@ type ReferenceGlyphSetCookie struct { // ReferenceGlyphSet sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ReferenceGlyphSet(c *xgb.Conn, Gsid Glyphset, Existing Glyphset) ReferenceGlyphSetCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'ReferenceGlyphSet' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(referenceGlyphSetRequest(c, Gsid, Existing), cookie) return ReferenceGlyphSetCookie{cookie} @@ -2522,6 +2603,9 @@ func ReferenceGlyphSet(c *xgb.Conn, Gsid Glyphset, Existing Glyphset) ReferenceG // ReferenceGlyphSetChecked sends a checked request. // If an error occurs, it can be retrieved using ReferenceGlyphSetCookie.Check() func ReferenceGlyphSetChecked(c *xgb.Conn, Gsid Glyphset, Existing Glyphset) ReferenceGlyphSetCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'ReferenceGlyphSet' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(referenceGlyphSetRequest(c, Gsid, Existing), cookie) return ReferenceGlyphSetCookie{cookie} @@ -2566,6 +2650,9 @@ type FreeGlyphSetCookie struct { // FreeGlyphSet sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func FreeGlyphSet(c *xgb.Conn, Glyphset Glyphset) FreeGlyphSetCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'FreeGlyphSet' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(freeGlyphSetRequest(c, Glyphset), cookie) return FreeGlyphSetCookie{cookie} @@ -2574,6 +2661,9 @@ func FreeGlyphSet(c *xgb.Conn, Glyphset Glyphset) FreeGlyphSetCookie { // FreeGlyphSetChecked sends a checked request. // If an error occurs, it can be retrieved using FreeGlyphSetCookie.Check() func FreeGlyphSetChecked(c *xgb.Conn, Glyphset Glyphset) FreeGlyphSetCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'FreeGlyphSet' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(freeGlyphSetRequest(c, Glyphset), cookie) return FreeGlyphSetCookie{cookie} @@ -2615,6 +2705,9 @@ type AddGlyphsCookie struct { // AddGlyphs sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func AddGlyphs(c *xgb.Conn, Glyphset Glyphset, GlyphsLen uint32, Glyphids []uint32, Glyphs []Glyphinfo, Data []byte) AddGlyphsCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'AddGlyphs' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(addGlyphsRequest(c, Glyphset, GlyphsLen, Glyphids, Glyphs, Data), cookie) return AddGlyphsCookie{cookie} @@ -2623,6 +2716,9 @@ func AddGlyphs(c *xgb.Conn, Glyphset Glyphset, GlyphsLen uint32, Glyphids []uint // AddGlyphsChecked sends a checked request. // If an error occurs, it can be retrieved using AddGlyphsCookie.Check() func AddGlyphsChecked(c *xgb.Conn, Glyphset Glyphset, GlyphsLen uint32, Glyphids []uint32, Glyphs []Glyphinfo, Data []byte) AddGlyphsCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'AddGlyphs' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(addGlyphsRequest(c, Glyphset, GlyphsLen, Glyphids, Glyphs, Data), cookie) return AddGlyphsCookie{cookie} @@ -2678,6 +2774,9 @@ type FreeGlyphsCookie struct { // FreeGlyphs sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func FreeGlyphs(c *xgb.Conn, Glyphset Glyphset, Glyphs []Glyph) FreeGlyphsCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'FreeGlyphs' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(freeGlyphsRequest(c, Glyphset, Glyphs), cookie) return FreeGlyphsCookie{cookie} @@ -2686,6 +2785,9 @@ func FreeGlyphs(c *xgb.Conn, Glyphset Glyphset, Glyphs []Glyph) FreeGlyphsCookie // FreeGlyphsChecked sends a checked request. // If an error occurs, it can be retrieved using FreeGlyphsCookie.Check() func FreeGlyphsChecked(c *xgb.Conn, Glyphset Glyphset, Glyphs []Glyph) FreeGlyphsCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'FreeGlyphs' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(freeGlyphsRequest(c, Glyphset, Glyphs), cookie) return FreeGlyphsCookie{cookie} @@ -2733,6 +2835,9 @@ type CompositeGlyphs8Cookie struct { // CompositeGlyphs8 sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CompositeGlyphs8(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) CompositeGlyphs8Cookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'CompositeGlyphs8' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(compositeGlyphs8Request(c, Op, Src, Dst, MaskFormat, Glyphset, SrcX, SrcY, Glyphcmds), cookie) return CompositeGlyphs8Cookie{cookie} @@ -2741,6 +2846,9 @@ func CompositeGlyphs8(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat // CompositeGlyphs8Checked sends a checked request. // If an error occurs, it can be retrieved using CompositeGlyphs8Cookie.Check() func CompositeGlyphs8Checked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) CompositeGlyphs8Cookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'CompositeGlyphs8' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(compositeGlyphs8Request(c, Op, Src, Dst, MaskFormat, Glyphset, SrcX, SrcY, Glyphcmds), cookie) return CompositeGlyphs8Cookie{cookie} @@ -2805,6 +2913,9 @@ type CompositeGlyphs16Cookie struct { // CompositeGlyphs16 sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CompositeGlyphs16(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) CompositeGlyphs16Cookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'CompositeGlyphs16' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(compositeGlyphs16Request(c, Op, Src, Dst, MaskFormat, Glyphset, SrcX, SrcY, Glyphcmds), cookie) return CompositeGlyphs16Cookie{cookie} @@ -2813,6 +2924,9 @@ func CompositeGlyphs16(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskForma // CompositeGlyphs16Checked sends a checked request. // If an error occurs, it can be retrieved using CompositeGlyphs16Cookie.Check() func CompositeGlyphs16Checked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) CompositeGlyphs16Cookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'CompositeGlyphs16' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(compositeGlyphs16Request(c, Op, Src, Dst, MaskFormat, Glyphset, SrcX, SrcY, Glyphcmds), cookie) return CompositeGlyphs16Cookie{cookie} @@ -2877,6 +2991,9 @@ type CompositeGlyphs32Cookie struct { // CompositeGlyphs32 sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CompositeGlyphs32(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) CompositeGlyphs32Cookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'CompositeGlyphs32' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(compositeGlyphs32Request(c, Op, Src, Dst, MaskFormat, Glyphset, SrcX, SrcY, Glyphcmds), cookie) return CompositeGlyphs32Cookie{cookie} @@ -2885,6 +3002,9 @@ func CompositeGlyphs32(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskForma // CompositeGlyphs32Checked sends a checked request. // If an error occurs, it can be retrieved using CompositeGlyphs32Cookie.Check() func CompositeGlyphs32Checked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) CompositeGlyphs32Cookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'CompositeGlyphs32' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(compositeGlyphs32Request(c, Op, Src, Dst, MaskFormat, Glyphset, SrcX, SrcY, Glyphcmds), cookie) return CompositeGlyphs32Cookie{cookie} @@ -2949,6 +3069,9 @@ type FillRectanglesCookie struct { // FillRectangles sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func FillRectangles(c *xgb.Conn, Op byte, Dst Picture, Color Color, Rects []xproto.Rectangle) FillRectanglesCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'FillRectangles' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(fillRectanglesRequest(c, Op, Dst, Color, Rects), cookie) return FillRectanglesCookie{cookie} @@ -2957,6 +3080,9 @@ func FillRectangles(c *xgb.Conn, Op byte, Dst Picture, Color Color, Rects []xpro // FillRectanglesChecked sends a checked request. // If an error occurs, it can be retrieved using FillRectanglesCookie.Check() func FillRectanglesChecked(c *xgb.Conn, Op byte, Dst Picture, Color Color, Rects []xproto.Rectangle) FillRectanglesCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'FillRectangles' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(fillRectanglesRequest(c, Op, Dst, Color, Rects), cookie) return FillRectanglesCookie{cookie} @@ -3011,6 +3137,9 @@ type CreateCursorCookie struct { // CreateCursor sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateCursor(c *xgb.Conn, Cid xproto.Cursor, Source Picture, X uint16, Y uint16) CreateCursorCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'CreateCursor' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(createCursorRequest(c, Cid, Source, X, Y), cookie) return CreateCursorCookie{cookie} @@ -3019,6 +3148,9 @@ func CreateCursor(c *xgb.Conn, Cid xproto.Cursor, Source Picture, X uint16, Y ui // CreateCursorChecked sends a checked request. // If an error occurs, it can be retrieved using CreateCursorCookie.Check() func CreateCursorChecked(c *xgb.Conn, Cid xproto.Cursor, Source Picture, X uint16, Y uint16) CreateCursorCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'CreateCursor' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(createCursorRequest(c, Cid, Source, X, Y), cookie) return CreateCursorCookie{cookie} @@ -3069,6 +3201,9 @@ type SetPictureTransformCookie struct { // SetPictureTransform sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetPictureTransform(c *xgb.Conn, Picture Picture, Transform Transform) SetPictureTransformCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'SetPictureTransform' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(setPictureTransformRequest(c, Picture, Transform), cookie) return SetPictureTransformCookie{cookie} @@ -3077,6 +3212,9 @@ func SetPictureTransform(c *xgb.Conn, Picture Picture, Transform Transform) SetP // SetPictureTransformChecked sends a checked request. // If an error occurs, it can be retrieved using SetPictureTransformCookie.Check() func SetPictureTransformChecked(c *xgb.Conn, Picture Picture, Transform Transform) SetPictureTransformCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'SetPictureTransform' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(setPictureTransformRequest(c, Picture, Transform), cookie) return SetPictureTransformCookie{cookie} @@ -3124,6 +3262,9 @@ type QueryFiltersCookie struct { // QueryFilters sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryFiltersCookie.Reply() func QueryFilters(c *xgb.Conn, Drawable xproto.Drawable) QueryFiltersCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'QueryFilters' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(queryFiltersRequest(c, Drawable), cookie) return QueryFiltersCookie{cookie} @@ -3132,6 +3273,9 @@ func QueryFilters(c *xgb.Conn, Drawable xproto.Drawable) QueryFiltersCookie { // QueryFiltersUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryFiltersUnchecked(c *xgb.Conn, Drawable xproto.Drawable) QueryFiltersCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'QueryFilters' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(queryFiltersRequest(c, Drawable), cookie) return QueryFiltersCookie{cookie} @@ -3225,6 +3369,9 @@ type SetPictureFilterCookie struct { // SetPictureFilter sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetPictureFilter(c *xgb.Conn, Picture Picture, FilterLen uint16, Filter string, Values []Fixed) SetPictureFilterCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'SetPictureFilter' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(setPictureFilterRequest(c, Picture, FilterLen, Filter, Values), cookie) return SetPictureFilterCookie{cookie} @@ -3233,6 +3380,9 @@ func SetPictureFilter(c *xgb.Conn, Picture Picture, FilterLen uint16, Filter str // SetPictureFilterChecked sends a checked request. // If an error occurs, it can be retrieved using SetPictureFilterCookie.Check() func SetPictureFilterChecked(c *xgb.Conn, Picture Picture, FilterLen uint16, Filter string, Values []Fixed) SetPictureFilterCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'SetPictureFilter' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(setPictureFilterRequest(c, Picture, FilterLen, Filter, Values), cookie) return SetPictureFilterCookie{cookie} @@ -3288,6 +3438,9 @@ type CreateAnimCursorCookie struct { // CreateAnimCursor sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateAnimCursor(c *xgb.Conn, Cid xproto.Cursor, Cursors []Animcursorelt) CreateAnimCursorCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'CreateAnimCursor' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(createAnimCursorRequest(c, Cid, Cursors), cookie) return CreateAnimCursorCookie{cookie} @@ -3296,6 +3449,9 @@ func CreateAnimCursor(c *xgb.Conn, Cid xproto.Cursor, Cursors []Animcursorelt) C // CreateAnimCursorChecked sends a checked request. // If an error occurs, it can be retrieved using CreateAnimCursorCookie.Check() func CreateAnimCursorChecked(c *xgb.Conn, Cid xproto.Cursor, Cursors []Animcursorelt) CreateAnimCursorCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'CreateAnimCursor' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(createAnimCursorRequest(c, Cid, Cursors), cookie) return CreateAnimCursorCookie{cookie} @@ -3339,6 +3495,9 @@ type AddTrapsCookie struct { // AddTraps sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func AddTraps(c *xgb.Conn, Picture Picture, XOff int16, YOff int16, Traps []Trap) AddTrapsCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'AddTraps' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(addTrapsRequest(c, Picture, XOff, YOff, Traps), cookie) return AddTrapsCookie{cookie} @@ -3347,6 +3506,9 @@ func AddTraps(c *xgb.Conn, Picture Picture, XOff int16, YOff int16, Traps []Trap // AddTrapsChecked sends a checked request. // If an error occurs, it can be retrieved using AddTrapsCookie.Check() func AddTrapsChecked(c *xgb.Conn, Picture Picture, XOff int16, YOff int16, Traps []Trap) AddTrapsCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'AddTraps' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(addTrapsRequest(c, Picture, XOff, YOff, Traps), cookie) return AddTrapsCookie{cookie} @@ -3396,6 +3558,9 @@ type CreateSolidFillCookie struct { // CreateSolidFill sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateSolidFill(c *xgb.Conn, Picture Picture, Color Color) CreateSolidFillCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'CreateSolidFill' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(createSolidFillRequest(c, Picture, Color), cookie) return CreateSolidFillCookie{cookie} @@ -3404,6 +3569,9 @@ func CreateSolidFill(c *xgb.Conn, Picture Picture, Color Color) CreateSolidFillC // CreateSolidFillChecked sends a checked request. // If an error occurs, it can be retrieved using CreateSolidFillCookie.Check() func CreateSolidFillChecked(c *xgb.Conn, Picture Picture, Color Color) CreateSolidFillCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'CreateSolidFill' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(createSolidFillRequest(c, Picture, Color), cookie) return CreateSolidFillCookie{cookie} @@ -3451,6 +3619,9 @@ type CreateLinearGradientCookie struct { // CreateLinearGradient sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateLinearGradient(c *xgb.Conn, Picture Picture, P1 Pointfix, P2 Pointfix, NumStops uint32, Stops []Fixed, Colors []Color) CreateLinearGradientCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'CreateLinearGradient' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(createLinearGradientRequest(c, Picture, P1, P2, NumStops, Stops, Colors), cookie) return CreateLinearGradientCookie{cookie} @@ -3459,6 +3630,9 @@ func CreateLinearGradient(c *xgb.Conn, Picture Picture, P1 Pointfix, P2 Pointfix // CreateLinearGradientChecked sends a checked request. // If an error occurs, it can be retrieved using CreateLinearGradientCookie.Check() func CreateLinearGradientChecked(c *xgb.Conn, Picture Picture, P1 Pointfix, P2 Pointfix, NumStops uint32, Stops []Fixed, Colors []Color) CreateLinearGradientCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'CreateLinearGradient' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(createLinearGradientRequest(c, Picture, P1, P2, NumStops, Stops, Colors), cookie) return CreateLinearGradientCookie{cookie} @@ -3523,6 +3697,9 @@ type CreateRadialGradientCookie struct { // CreateRadialGradient sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateRadialGradient(c *xgb.Conn, Picture Picture, Inner Pointfix, Outer Pointfix, InnerRadius Fixed, OuterRadius Fixed, NumStops uint32, Stops []Fixed, Colors []Color) CreateRadialGradientCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'CreateRadialGradient' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(createRadialGradientRequest(c, Picture, Inner, Outer, InnerRadius, OuterRadius, NumStops, Stops, Colors), cookie) return CreateRadialGradientCookie{cookie} @@ -3531,6 +3708,9 @@ func CreateRadialGradient(c *xgb.Conn, Picture Picture, Inner Pointfix, Outer Po // CreateRadialGradientChecked sends a checked request. // If an error occurs, it can be retrieved using CreateRadialGradientCookie.Check() func CreateRadialGradientChecked(c *xgb.Conn, Picture Picture, Inner Pointfix, Outer Pointfix, InnerRadius Fixed, OuterRadius Fixed, NumStops uint32, Stops []Fixed, Colors []Color) CreateRadialGradientCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'CreateRadialGradient' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(createRadialGradientRequest(c, Picture, Inner, Outer, InnerRadius, OuterRadius, NumStops, Stops, Colors), cookie) return CreateRadialGradientCookie{cookie} @@ -3601,6 +3781,9 @@ type CreateConicalGradientCookie struct { // CreateConicalGradient sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateConicalGradient(c *xgb.Conn, Picture Picture, Center Pointfix, Angle Fixed, NumStops uint32, Stops []Fixed, Colors []Color) CreateConicalGradientCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'CreateConicalGradient' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(createConicalGradientRequest(c, Picture, Center, Angle, NumStops, Stops, Colors), cookie) return CreateConicalGradientCookie{cookie} @@ -3609,6 +3792,9 @@ func CreateConicalGradient(c *xgb.Conn, Picture Picture, Center Pointfix, Angle // CreateConicalGradientChecked sends a checked request. // If an error occurs, it can be retrieved using CreateConicalGradientCookie.Check() func CreateConicalGradientChecked(c *xgb.Conn, Picture Picture, Center Pointfix, Angle Fixed, NumStops uint32, Stops []Fixed, Colors []Color) CreateConicalGradientCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'CreateConicalGradient' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(createConicalGradientRequest(c, Picture, Center, Angle, NumStops, Stops, Colors), cookie) return CreateConicalGradientCookie{cookie} -- cgit v1.2.3 From 4ea94ca0fef7786ce21722cbb02a9cf069bdedd9 Mon Sep 17 00:00:00 2001 From: "Andrew Gallant (Ocelot)" Date: Sat, 26 May 2012 18:24:52 -0400 Subject: Bug fix in the generator that was outputting %(MISSING) crud. --- nexgb/render/render.go | 58 +++++++++++++++++++++++++------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) (limited to 'nexgb/render') diff --git a/nexgb/render/render.go b/nexgb/render/render.go index f7fa79f..e435aa8 100644 --- a/nexgb/render/render.go +++ b/nexgb/render/render.go @@ -2,7 +2,7 @@ package render /* - This file was generated by render.xml on May 11 2012 11:57:19pm EDT. + This file was generated by render.xml on May 26 2012 6:23:13pm EDT. This file is automatically generated. Edit at your peril! */ @@ -40,18 +40,6 @@ func init() { xgb.NewExtErrorFuncs["RENDER"] = make(map[int]xgb.NewErrorFun) } -// Skipping definition for base type 'Float' - -// Skipping definition for base type 'Card8' - -// Skipping definition for base type 'Int16' - -// Skipping definition for base type 'Int32' - -// Skipping definition for base type 'Void' - -// Skipping definition for base type 'Byte' - // Skipping definition for base type 'Int8' // Skipping definition for base type 'Card16' @@ -64,6 +52,18 @@ func init() { // Skipping definition for base type 'Bool' +// Skipping definition for base type 'Float' + +// Skipping definition for base type 'Card8' + +// Skipping definition for base type 'Int16' + +// Skipping definition for base type 'Int32' + +// Skipping definition for base type 'Void' + +// Skipping definition for base type 'Byte' + const ( PictTypeIndexed = 0 PictTypeDirect = 1 @@ -289,7 +289,7 @@ func (v Directformat) Bytes() []byte { return buf } -// DirectformatListBytes writes a list of %s(MISSING) values to a byte slice. +// DirectformatListBytes writes a list of Directformat values to a byte slice. func DirectformatListBytes(buf []byte, list []Directformat) int { b := 0 var structBytes []byte @@ -372,7 +372,7 @@ func (v Pictforminfo) Bytes() []byte { return buf } -// PictforminfoListBytes writes a list of %s(MISSING) values to a byte slice. +// PictforminfoListBytes writes a list of Pictforminfo values to a byte slice. func PictforminfoListBytes(buf []byte, list []Pictforminfo) int { b := 0 var structBytes []byte @@ -426,7 +426,7 @@ func (v Pictvisual) Bytes() []byte { return buf } -// PictvisualListBytes writes a list of %s(MISSING) values to a byte slice. +// PictvisualListBytes writes a list of Pictvisual values to a byte slice. func PictvisualListBytes(buf []byte, list []Pictvisual) int { b := 0 var structBytes []byte @@ -496,7 +496,7 @@ func (v Pictdepth) Bytes() []byte { return buf } -// PictdepthListBytes writes a list of %s(MISSING) values to a byte slice. +// PictdepthListBytes writes a list of Pictdepth values to a byte slice. func PictdepthListBytes(buf []byte, list []Pictdepth) int { b := 0 var structBytes []byte @@ -565,7 +565,7 @@ func (v Pictscreen) Bytes() []byte { return buf } -// PictscreenListBytes writes a list of %s(MISSING) values to a byte slice. +// PictscreenListBytes writes a list of Pictscreen values to a byte slice. func PictscreenListBytes(buf []byte, list []Pictscreen) int { b := 0 var structBytes []byte @@ -649,7 +649,7 @@ func (v Indexvalue) Bytes() []byte { return buf } -// IndexvalueListBytes writes a list of %s(MISSING) values to a byte slice. +// IndexvalueListBytes writes a list of Indexvalue values to a byte slice. func IndexvalueListBytes(buf []byte, list []Indexvalue) int { b := 0 var structBytes []byte @@ -717,7 +717,7 @@ func (v Color) Bytes() []byte { return buf } -// ColorListBytes writes a list of %s(MISSING) values to a byte slice. +// ColorListBytes writes a list of Color values to a byte slice. func ColorListBytes(buf []byte, list []Color) int { b := 0 var structBytes []byte @@ -771,7 +771,7 @@ func (v Pointfix) Bytes() []byte { return buf } -// PointfixListBytes writes a list of %s(MISSING) values to a byte slice. +// PointfixListBytes writes a list of Pointfix values to a byte slice. func PointfixListBytes(buf []byte, list []Pointfix) int { b := 0 var structBytes []byte @@ -831,7 +831,7 @@ func (v Linefix) Bytes() []byte { return buf } -// LinefixListBytes writes a list of %s(MISSING) values to a byte slice. +// LinefixListBytes writes a list of Linefix values to a byte slice. func LinefixListBytes(buf []byte, list []Linefix) int { b := 0 var structBytes []byte @@ -901,7 +901,7 @@ func (v Triangle) Bytes() []byte { return buf } -// TriangleListBytes writes a list of %s(MISSING) values to a byte slice. +// TriangleListBytes writes a list of Triangle values to a byte slice. func TriangleListBytes(buf []byte, list []Triangle) int { b := 0 var structBytes []byte @@ -975,7 +975,7 @@ func (v Trapezoid) Bytes() []byte { return buf } -// TrapezoidListBytes writes a list of %s(MISSING) values to a byte slice. +// TrapezoidListBytes writes a list of Trapezoid values to a byte slice. func TrapezoidListBytes(buf []byte, list []Trapezoid) int { b := 0 var structBytes []byte @@ -1057,7 +1057,7 @@ func (v Glyphinfo) Bytes() []byte { return buf } -// GlyphinfoListBytes writes a list of %s(MISSING) values to a byte slice. +// GlyphinfoListBytes writes a list of Glyphinfo values to a byte slice. func GlyphinfoListBytes(buf []byte, list []Glyphinfo) int { b := 0 var structBytes []byte @@ -1160,7 +1160,7 @@ func (v Transform) Bytes() []byte { return buf } -// TransformListBytes writes a list of %s(MISSING) values to a byte slice. +// TransformListBytes writes a list of Transform values to a byte slice. func TransformListBytes(buf []byte, list []Transform) int { b := 0 var structBytes []byte @@ -1214,7 +1214,7 @@ func (v Animcursorelt) Bytes() []byte { return buf } -// AnimcursoreltListBytes writes a list of %s(MISSING) values to a byte slice. +// AnimcursoreltListBytes writes a list of Animcursorelt values to a byte slice. func AnimcursoreltListBytes(buf []byte, list []Animcursorelt) int { b := 0 var structBytes []byte @@ -1275,7 +1275,7 @@ func (v Spanfix) Bytes() []byte { return buf } -// SpanfixListBytes writes a list of %s(MISSING) values to a byte slice. +// SpanfixListBytes writes a list of Spanfix values to a byte slice. func SpanfixListBytes(buf []byte, list []Spanfix) int { b := 0 var structBytes []byte @@ -1335,7 +1335,7 @@ func (v Trap) Bytes() []byte { return buf } -// TrapListBytes writes a list of %s(MISSING) values to a byte slice. +// TrapListBytes writes a list of Trap values to a byte slice. func TrapListBytes(buf []byte, list []Trap) int { b := 0 var structBytes []byte -- cgit v1.2.3 From a9eae45cb3977bce5983e817d00d4584d176b044 Mon Sep 17 00:00:00 2001 From: "Andrew Gallant (Ocelot)" Date: Tue, 5 Jun 2012 00:14:34 -0400 Subject: Refresh build. Eh. --- nexgb/render/render.go | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'nexgb/render') diff --git a/nexgb/render/render.go b/nexgb/render/render.go index e435aa8..2f1ae13 100644 --- a/nexgb/render/render.go +++ b/nexgb/render/render.go @@ -2,7 +2,7 @@ package render /* - This file was generated by render.xml on May 26 2012 6:23:13pm EDT. + This file was generated by render.xml on Jun 5 2012 12:11:59am EDT. This file is automatically generated. Edit at your peril! */ @@ -40,18 +40,6 @@ func init() { xgb.NewExtErrorFuncs["RENDER"] = make(map[int]xgb.NewErrorFun) } -// 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' // Skipping definition for base type 'Card8' @@ -64,6 +52,18 @@ func init() { // Skipping definition for base type 'Byte' +// Skipping definition for base type 'Int8' + +// Skipping definition for base type 'Card16' + +// Skipping definition for base type 'Char' + +// Skipping definition for base type 'Card32' + +// Skipping definition for base type 'Double' + +// Skipping definition for base type 'Bool' + const ( PictTypeIndexed = 0 PictTypeDirect = 1 -- cgit v1.2.3 From 0685fb57e14104ee4ad9f70ec94f787a9a22c028 Mon Sep 17 00:00:00 2001 From: Andrew Gallant Date: Sun, 11 Aug 2013 20:43:26 -0400 Subject: Update to latest xproto XML. --- nexgb/render/render.go | 4026 ++++++++++++++++++++++++------------------------ 1 file changed, 2013 insertions(+), 2013 deletions(-) (limited to 'nexgb/render') diff --git a/nexgb/render/render.go b/nexgb/render/render.go index 2f1ae13..c6f5095 100644 --- a/nexgb/render/render.go +++ b/nexgb/render/render.go @@ -2,7 +2,7 @@ package render /* - This file was generated by render.xml on Jun 5 2012 12:11:59am EDT. + This file was generated by render.xml on Aug 11 2013 8:39:43pm EDT. This file is automatically generated. Edit at your peril! */ @@ -40,104 +40,127 @@ func init() { xgb.NewExtErrorFuncs["RENDER"] = make(map[int]xgb.NewErrorFun) } -// Skipping definition for base type 'Float' +type Animcursorelt struct { + Cursor xproto.Cursor + Delay uint32 +} -// Skipping definition for base type 'Card8' +// AnimcursoreltRead reads a byte slice into a Animcursorelt value. +func AnimcursoreltRead(buf []byte, v *Animcursorelt) int { + b := 0 -// Skipping definition for base type 'Int16' + v.Cursor = xproto.Cursor(xgb.Get32(buf[b:])) + b += 4 -// Skipping definition for base type 'Int32' + v.Delay = xgb.Get32(buf[b:]) + b += 4 -// Skipping definition for base type 'Void' + return b +} -// Skipping definition for base type 'Byte' +// AnimcursoreltReadList reads a byte slice into a list of Animcursorelt values. +func AnimcursoreltReadList(buf []byte, dest []Animcursorelt) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = Animcursorelt{} + b += AnimcursoreltRead(buf[b:], &dest[i]) + } + return xgb.Pad(b) +} -// Skipping definition for base type 'Int8' +// Bytes writes a Animcursorelt value to a byte slice. +func (v Animcursorelt) Bytes() []byte { + buf := make([]byte, 8) + b := 0 -// Skipping definition for base type 'Card16' + xgb.Put32(buf[b:], uint32(v.Cursor)) + b += 4 -// Skipping definition for base type 'Char' + xgb.Put32(buf[b:], v.Delay) + b += 4 -// Skipping definition for base type 'Card32' + return buf +} -// Skipping definition for base type 'Double' +// AnimcursoreltListBytes writes a list of Animcursorelt values to a byte slice. +func AnimcursoreltListBytes(buf []byte, list []Animcursorelt) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } + return b +} -// Skipping definition for base type 'Bool' +type Color struct { + Red uint16 + Green uint16 + Blue uint16 + Alpha uint16 +} -const ( - PictTypeIndexed = 0 - PictTypeDirect = 1 -) +// ColorRead reads a byte slice into a Color value. +func ColorRead(buf []byte, v *Color) int { + b := 0 -const ( - PictureNone = 0 -) + v.Red = xgb.Get16(buf[b:]) + b += 2 -const ( - PictOpClear = 0 - PictOpSrc = 1 - PictOpDst = 2 - PictOpOver = 3 - PictOpOverReverse = 4 - PictOpIn = 5 - PictOpInReverse = 6 - PictOpOut = 7 - PictOpOutReverse = 8 - PictOpAtop = 9 - PictOpAtopReverse = 10 - PictOpXor = 11 - PictOpAdd = 12 - PictOpSaturate = 13 - PictOpDisjointClear = 16 - PictOpDisjointSrc = 17 - PictOpDisjointDst = 18 - PictOpDisjointOver = 19 - PictOpDisjointOverReverse = 20 - PictOpDisjointIn = 21 - PictOpDisjointInReverse = 22 - PictOpDisjointOut = 23 - PictOpDisjointOutReverse = 24 - PictOpDisjointAtop = 25 - PictOpDisjointAtopReverse = 26 - PictOpDisjointXor = 27 - PictOpConjointClear = 32 - PictOpConjointSrc = 33 - PictOpConjointDst = 34 - PictOpConjointOver = 35 - PictOpConjointOverReverse = 36 - PictOpConjointIn = 37 - PictOpConjointInReverse = 38 - PictOpConjointOut = 39 - PictOpConjointOutReverse = 40 - PictOpConjointAtop = 41 - PictOpConjointAtopReverse = 42 - PictOpConjointXor = 43 - PictOpMultiply = 48 - PictOpScreen = 49 - PictOpOverlay = 50 - PictOpDarken = 51 - PictOpLighten = 52 - PictOpColorDodge = 53 - PictOpColorBurn = 54 - PictOpHardLight = 55 - PictOpSoftLight = 56 - PictOpDifference = 57 - PictOpExclusion = 58 - PictOpHSLHue = 59 - PictOpHSLSaturation = 60 - PictOpHSLColor = 61 - PictOpHSLLuminosity = 62 -) + v.Green = xgb.Get16(buf[b:]) + b += 2 -const ( - PolyEdgeSharp = 0 - PolyEdgeSmooth = 1 -) + v.Blue = xgb.Get16(buf[b:]) + b += 2 -const ( - PolyModePrecise = 0 - PolyModeImprecise = 1 -) + v.Alpha = xgb.Get16(buf[b:]) + b += 2 + + return b +} + +// ColorReadList reads a byte slice into a list of Color values. +func ColorReadList(buf []byte, dest []Color) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = Color{} + b += ColorRead(buf[b:], &dest[i]) + } + return xgb.Pad(b) +} + +// Bytes writes a Color value to a byte slice. +func (v Color) Bytes() []byte { + buf := make([]byte, 8) + b := 0 + + xgb.Put16(buf[b:], v.Red) + b += 2 + + xgb.Put16(buf[b:], v.Green) + b += 2 + + xgb.Put16(buf[b:], v.Blue) + b += 2 + + xgb.Put16(buf[b:], v.Alpha) + b += 2 + + return buf +} + +// ColorListBytes writes a list of Color values to a byte slice. +func ColorListBytes(buf []byte, list []Color) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } + return b +} const ( CpRepeat = 1 @@ -155,56 +178,6 @@ const ( CpComponentAlpha = 4096 ) -const ( - SubPixelUnknown = 0 - SubPixelHorizontalRGB = 1 - SubPixelHorizontalBGR = 2 - SubPixelVerticalRGB = 3 - SubPixelVerticalBGR = 4 - SubPixelNone = 5 -) - -const ( - RepeatNone = 0 - RepeatNormal = 1 - RepeatPad = 2 - RepeatReflect = 3 -) - -type Glyphset uint32 - -func NewGlyphsetId(c *xgb.Conn) (Glyphset, error) { - id, err := c.NewId() - if err != nil { - return 0, err - } - return Glyphset(id), nil -} - -type Picture uint32 - -func NewPictureId(c *xgb.Conn) (Picture, error) { - id, err := c.NewId() - if err != nil { - return 0, err - } - return Picture(id), nil -} - -type Pictformat uint32 - -func NewPictformatId(c *xgb.Conn) (Pictformat, error) { - id, err := c.NewId() - if err != nil { - return 0, err - } - return Pictformat(id), nil -} - -type Glyph uint32 - -type Fixed int32 - type Directformat struct { RedShift uint16 RedMask uint16 @@ -301,203 +274,174 @@ func DirectformatListBytes(buf []byte, list []Directformat) int { return b } -type Pictforminfo struct { - Id Pictformat - Type byte - Depth byte - // padding: 2 bytes - Direct Directformat - Colormap xproto.Colormap -} +type Fixed int32 -// PictforminfoRead reads a byte slice into a Pictforminfo value. -func PictforminfoRead(buf []byte, v *Pictforminfo) int { - b := 0 +type Glyph uint32 - v.Id = Pictformat(xgb.Get32(buf[b:])) - b += 4 +// BadGlyph is the error number for a BadGlyph. +const BadGlyph = 4 - v.Type = buf[b] - b += 1 - - v.Depth = buf[b] - b += 1 +type GlyphError struct { + Sequence uint16 + NiceName string +} - b += 2 // padding +// GlyphErrorNew constructs a GlyphError value that implements xgb.Error from a byte slice. +func GlyphErrorNew(buf []byte) xgb.Error { + v := GlyphError{} + v.NiceName = "Glyph" - v.Direct = Directformat{} - b += DirectformatRead(buf[b:], &v.Direct) + b := 1 // skip error determinant + b += 1 // don't read error number - v.Colormap = xproto.Colormap(xgb.Get32(buf[b:])) - b += 4 + v.Sequence = xgb.Get16(buf[b:]) + b += 2 - return b + return v } -// PictforminfoReadList reads a byte slice into a list of Pictforminfo values. -func PictforminfoReadList(buf []byte, dest []Pictforminfo) int { - b := 0 - for i := 0; i < len(dest); i++ { - dest[i] = Pictforminfo{} - b += PictforminfoRead(buf[b:], &dest[i]) - } - return xgb.Pad(b) +// SequenceId returns the sequence id attached to the BadGlyph error. +// This is mostly used internally. +func (err GlyphError) SequenceId() uint16 { + return err.Sequence } -// Bytes writes a Pictforminfo value to a byte slice. -func (v Pictforminfo) Bytes() []byte { - buf := make([]byte, 28) - b := 0 - - xgb.Put32(buf[b:], uint32(v.Id)) - b += 4 - - buf[b] = v.Type - b += 1 - - buf[b] = v.Depth - b += 1 - - b += 2 // padding - - { - structBytes := v.Direct.Bytes() - copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) - } +// BadId returns the 'BadValue' number if one exists for the BadGlyph error. If no bad value exists, 0 is returned. +func (err GlyphError) BadId() uint32 { + return 0 +} - xgb.Put32(buf[b:], uint32(v.Colormap)) - b += 4 +// Error returns a rudimentary string representation of the BadGlyph error. - return buf +func (err GlyphError) Error() string { + fieldVals := make([]string, 0, 0) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence)) + return "BadGlyph {" + xgb.StringsJoin(fieldVals, ", ") + "}" } -// PictforminfoListBytes writes a list of Pictforminfo values to a byte slice. -func PictforminfoListBytes(buf []byte, list []Pictforminfo) int { - b := 0 - var structBytes []byte - for _, item := range list { - structBytes = item.Bytes() - copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) - } - return b +func init() { + xgb.NewExtErrorFuncs["RENDER"][4] = GlyphErrorNew } -type Pictvisual struct { - Visual xproto.Visualid - Format Pictformat +// BadGlyphSet is the error number for a BadGlyphSet. +const BadGlyphSet = 3 + +type GlyphSetError struct { + Sequence uint16 + NiceName string } -// PictvisualRead reads a byte slice into a Pictvisual value. -func PictvisualRead(buf []byte, v *Pictvisual) int { - b := 0 +// GlyphSetErrorNew constructs a GlyphSetError value that implements xgb.Error from a byte slice. +func GlyphSetErrorNew(buf []byte) xgb.Error { + v := GlyphSetError{} + v.NiceName = "GlyphSet" - v.Visual = xproto.Visualid(xgb.Get32(buf[b:])) - b += 4 + b := 1 // skip error determinant + b += 1 // don't read error number - v.Format = Pictformat(xgb.Get32(buf[b:])) - b += 4 + v.Sequence = xgb.Get16(buf[b:]) + b += 2 - return b + return v } -// PictvisualReadList reads a byte slice into a list of Pictvisual values. -func PictvisualReadList(buf []byte, dest []Pictvisual) int { - b := 0 - for i := 0; i < len(dest); i++ { - dest[i] = Pictvisual{} - b += PictvisualRead(buf[b:], &dest[i]) - } - return xgb.Pad(b) +// SequenceId returns the sequence id attached to the BadGlyphSet error. +// This is mostly used internally. +func (err GlyphSetError) SequenceId() uint16 { + return err.Sequence } -// Bytes writes a Pictvisual value to a byte slice. -func (v Pictvisual) Bytes() []byte { - buf := make([]byte, 8) - b := 0 - - xgb.Put32(buf[b:], uint32(v.Visual)) - b += 4 +// BadId returns the 'BadValue' number if one exists for the BadGlyphSet error. If no bad value exists, 0 is returned. +func (err GlyphSetError) BadId() uint32 { + return 0 +} - xgb.Put32(buf[b:], uint32(v.Format)) - b += 4 +// Error returns a rudimentary string representation of the BadGlyphSet error. - return buf +func (err GlyphSetError) Error() string { + fieldVals := make([]string, 0, 0) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence)) + return "BadGlyphSet {" + xgb.StringsJoin(fieldVals, ", ") + "}" } -// PictvisualListBytes writes a list of Pictvisual values to a byte slice. -func PictvisualListBytes(buf []byte, list []Pictvisual) int { - b := 0 - var structBytes []byte - for _, item := range list { - structBytes = item.Bytes() - copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) - } - return b +func init() { + xgb.NewExtErrorFuncs["RENDER"][3] = GlyphSetErrorNew } -type Pictdepth struct { - Depth byte - // padding: 1 bytes - NumVisuals uint16 - // padding: 4 bytes - Visuals []Pictvisual // size: xgb.Pad((int(NumVisuals) * 8)) +type Glyphinfo struct { + Width uint16 + Height uint16 + X int16 + Y int16 + XOff int16 + YOff int16 } -// PictdepthRead reads a byte slice into a Pictdepth value. -func PictdepthRead(buf []byte, v *Pictdepth) int { +// GlyphinfoRead reads a byte slice into a Glyphinfo value. +func GlyphinfoRead(buf []byte, v *Glyphinfo) int { b := 0 - v.Depth = buf[b] - b += 1 + v.Width = xgb.Get16(buf[b:]) + b += 2 - b += 1 // padding + v.Height = xgb.Get16(buf[b:]) + b += 2 - v.NumVisuals = xgb.Get16(buf[b:]) + v.X = int16(xgb.Get16(buf[b:])) b += 2 - b += 4 // padding + v.Y = int16(xgb.Get16(buf[b:])) + b += 2 - v.Visuals = make([]Pictvisual, v.NumVisuals) - b += PictvisualReadList(buf[b:], v.Visuals) + v.XOff = int16(xgb.Get16(buf[b:])) + b += 2 + + v.YOff = int16(xgb.Get16(buf[b:])) + b += 2 return b } -// PictdepthReadList reads a byte slice into a list of Pictdepth values. -func PictdepthReadList(buf []byte, dest []Pictdepth) int { +// GlyphinfoReadList reads a byte slice into a list of Glyphinfo values. +func GlyphinfoReadList(buf []byte, dest []Glyphinfo) int { b := 0 for i := 0; i < len(dest); i++ { - dest[i] = Pictdepth{} - b += PictdepthRead(buf[b:], &dest[i]) + dest[i] = Glyphinfo{} + b += GlyphinfoRead(buf[b:], &dest[i]) } return xgb.Pad(b) } -// Bytes writes a Pictdepth value to a byte slice. -func (v Pictdepth) Bytes() []byte { - buf := make([]byte, (8 + xgb.Pad((int(v.NumVisuals) * 8)))) +// Bytes writes a Glyphinfo value to a byte slice. +func (v Glyphinfo) Bytes() []byte { + buf := make([]byte, 12) b := 0 - buf[b] = v.Depth - b += 1 + xgb.Put16(buf[b:], v.Width) + b += 2 - b += 1 // padding + xgb.Put16(buf[b:], v.Height) + b += 2 - xgb.Put16(buf[b:], v.NumVisuals) + xgb.Put16(buf[b:], uint16(v.X)) b += 2 - b += 4 // padding + xgb.Put16(buf[b:], uint16(v.Y)) + b += 2 - b += PictvisualListBytes(buf[b:], v.Visuals) + xgb.Put16(buf[b:], uint16(v.XOff)) + b += 2 + + xgb.Put16(buf[b:], uint16(v.YOff)) + b += 2 return buf } -// PictdepthListBytes writes a list of Pictdepth values to a byte slice. -func PictdepthListBytes(buf []byte, list []Pictdepth) int { +// GlyphinfoListBytes writes a list of Glyphinfo values to a byte slice. +func GlyphinfoListBytes(buf []byte, list []Glyphinfo) int { b := 0 var structBytes []byte for _, item := range list { @@ -508,101 +452,33 @@ func PictdepthListBytes(buf []byte, list []Pictdepth) int { return b } -// PictdepthListSize computes the size (bytes) of a list of Pictdepth values. -func PictdepthListSize(list []Pictdepth) int { - size := 0 - for _, item := range list { - size += (8 + xgb.Pad((int(item.NumVisuals) * 8))) +type Glyphset uint32 + +func NewGlyphsetId(c *xgb.Conn) (Glyphset, error) { + id, err := c.NewId() + if err != nil { + return 0, err } - return size + return Glyphset(id), nil } -type Pictscreen struct { - NumDepths uint32 - Fallback Pictformat - Depths []Pictdepth // size: PictdepthListSize(Depths) +type Indexvalue struct { + Pixel uint32 + Red uint16 + Green uint16 + Blue uint16 + Alpha uint16 } -// PictscreenRead reads a byte slice into a Pictscreen value. -func PictscreenRead(buf []byte, v *Pictscreen) int { +// IndexvalueRead reads a byte slice into a Indexvalue value. +func IndexvalueRead(buf []byte, v *Indexvalue) int { b := 0 - v.NumDepths = xgb.Get32(buf[b:]) + v.Pixel = xgb.Get32(buf[b:]) b += 4 - v.Fallback = Pictformat(xgb.Get32(buf[b:])) - b += 4 - - v.Depths = make([]Pictdepth, v.NumDepths) - b += PictdepthReadList(buf[b:], v.Depths) - - return b -} - -// PictscreenReadList reads a byte slice into a list of Pictscreen values. -func PictscreenReadList(buf []byte, dest []Pictscreen) int { - b := 0 - for i := 0; i < len(dest); i++ { - dest[i] = Pictscreen{} - b += PictscreenRead(buf[b:], &dest[i]) - } - return xgb.Pad(b) -} - -// Bytes writes a Pictscreen value to a byte slice. -func (v Pictscreen) Bytes() []byte { - buf := make([]byte, (8 + PictdepthListSize(v.Depths))) - b := 0 - - xgb.Put32(buf[b:], v.NumDepths) - b += 4 - - xgb.Put32(buf[b:], uint32(v.Fallback)) - b += 4 - - b += PictdepthListBytes(buf[b:], v.Depths) - - return buf -} - -// PictscreenListBytes writes a list of Pictscreen values to a byte slice. -func PictscreenListBytes(buf []byte, list []Pictscreen) int { - b := 0 - var structBytes []byte - for _, item := range list { - structBytes = item.Bytes() - copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) - } - return b -} - -// PictscreenListSize computes the size (bytes) of a list of Pictscreen values. -func PictscreenListSize(list []Pictscreen) int { - size := 0 - for _, item := range list { - size += (8 + PictdepthListSize(item.Depths)) - } - return size -} - -type Indexvalue struct { - Pixel uint32 - Red uint16 - Green uint16 - Blue uint16 - Alpha uint16 -} - -// IndexvalueRead reads a byte slice into a Indexvalue value. -func IndexvalueRead(buf []byte, v *Indexvalue) int { - b := 0 - - v.Pixel = xgb.Get32(buf[b:]) - b += 4 - - v.Red = xgb.Get16(buf[b:]) - b += 2 + v.Red = xgb.Get16(buf[b:]) + b += 2 v.Green = xgb.Get16(buf[b:]) b += 2 @@ -661,128 +537,6 @@ func IndexvalueListBytes(buf []byte, list []Indexvalue) int { return b } -type Color struct { - Red uint16 - Green uint16 - Blue uint16 - Alpha uint16 -} - -// ColorRead reads a byte slice into a Color value. -func ColorRead(buf []byte, v *Color) int { - b := 0 - - v.Red = xgb.Get16(buf[b:]) - b += 2 - - v.Green = xgb.Get16(buf[b:]) - b += 2 - - v.Blue = xgb.Get16(buf[b:]) - b += 2 - - v.Alpha = xgb.Get16(buf[b:]) - b += 2 - - return b -} - -// ColorReadList reads a byte slice into a list of Color values. -func ColorReadList(buf []byte, dest []Color) int { - b := 0 - for i := 0; i < len(dest); i++ { - dest[i] = Color{} - b += ColorRead(buf[b:], &dest[i]) - } - return xgb.Pad(b) -} - -// Bytes writes a Color value to a byte slice. -func (v Color) Bytes() []byte { - buf := make([]byte, 8) - b := 0 - - xgb.Put16(buf[b:], v.Red) - b += 2 - - xgb.Put16(buf[b:], v.Green) - b += 2 - - xgb.Put16(buf[b:], v.Blue) - b += 2 - - xgb.Put16(buf[b:], v.Alpha) - b += 2 - - return buf -} - -// ColorListBytes writes a list of Color values to a byte slice. -func ColorListBytes(buf []byte, list []Color) int { - b := 0 - var structBytes []byte - for _, item := range list { - structBytes = item.Bytes() - copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) - } - return b -} - -type Pointfix struct { - X Fixed - Y Fixed -} - -// PointfixRead reads a byte slice into a Pointfix value. -func PointfixRead(buf []byte, v *Pointfix) int { - b := 0 - - v.X = Fixed(xgb.Get32(buf[b:])) - b += 4 - - v.Y = Fixed(xgb.Get32(buf[b:])) - b += 4 - - return b -} - -// PointfixReadList reads a byte slice into a list of Pointfix values. -func PointfixReadList(buf []byte, dest []Pointfix) int { - b := 0 - for i := 0; i < len(dest); i++ { - dest[i] = Pointfix{} - b += PointfixRead(buf[b:], &dest[i]) - } - return xgb.Pad(b) -} - -// Bytes writes a Pointfix value to a byte slice. -func (v Pointfix) Bytes() []byte { - buf := make([]byte, 8) - b := 0 - - xgb.Put32(buf[b:], uint32(v.X)) - b += 4 - - xgb.Put32(buf[b:], uint32(v.Y)) - b += 4 - - return buf -} - -// PointfixListBytes writes a list of Pointfix values to a byte slice. -func PointfixListBytes(buf []byte, list []Pointfix) int { - b := 0 - var structBytes []byte - for _, item := range list { - structBytes = item.Bytes() - copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) - } - return b -} - type Linefix struct { P1 Pointfix P2 Pointfix @@ -843,66 +597,504 @@ func LinefixListBytes(buf []byte, list []Linefix) int { return b } -type Triangle struct { - P1 Pointfix - P2 Pointfix - P3 Pointfix +// BadPictFormat is the error number for a BadPictFormat. +const BadPictFormat = 0 + +type PictFormatError struct { + Sequence uint16 + NiceName string } -// TriangleRead reads a byte slice into a Triangle value. -func TriangleRead(buf []byte, v *Triangle) int { - b := 0 +// PictFormatErrorNew constructs a PictFormatError value that implements xgb.Error from a byte slice. +func PictFormatErrorNew(buf []byte) xgb.Error { + v := PictFormatError{} + v.NiceName = "PictFormat" - v.P1 = Pointfix{} - b += PointfixRead(buf[b:], &v.P1) + b := 1 // skip error determinant + b += 1 // don't read error number - v.P2 = Pointfix{} - b += PointfixRead(buf[b:], &v.P2) + v.Sequence = xgb.Get16(buf[b:]) + b += 2 - v.P3 = Pointfix{} - b += PointfixRead(buf[b:], &v.P3) + return v +} - return b +// SequenceId returns the sequence id attached to the BadPictFormat error. +// This is mostly used internally. +func (err PictFormatError) SequenceId() uint16 { + return err.Sequence } -// TriangleReadList reads a byte slice into a list of Triangle values. -func TriangleReadList(buf []byte, dest []Triangle) int { - b := 0 - for i := 0; i < len(dest); i++ { - dest[i] = Triangle{} - b += TriangleRead(buf[b:], &dest[i]) - } - return xgb.Pad(b) +// BadId returns the 'BadValue' number if one exists for the BadPictFormat error. If no bad value exists, 0 is returned. +func (err PictFormatError) BadId() uint32 { + return 0 } -// Bytes writes a Triangle value to a byte slice. -func (v Triangle) Bytes() []byte { - buf := make([]byte, 24) - b := 0 +// Error returns a rudimentary string representation of the BadPictFormat error. - { - structBytes := v.P1.Bytes() - copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) - } +func (err PictFormatError) Error() string { + fieldVals := make([]string, 0, 0) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence)) + return "BadPictFormat {" + xgb.StringsJoin(fieldVals, ", ") + "}" +} - { - structBytes := v.P2.Bytes() - copy(buf[b:], structBytes) +func init() { + xgb.NewExtErrorFuncs["RENDER"][0] = PictFormatErrorNew +} + +// BadPictOp is the error number for a BadPictOp. +const BadPictOp = 2 + +type PictOpError struct { + Sequence uint16 + NiceName string +} + +// PictOpErrorNew constructs a PictOpError value that implements xgb.Error from a byte slice. +func PictOpErrorNew(buf []byte) xgb.Error { + v := PictOpError{} + v.NiceName = "PictOp" + + b := 1 // skip error determinant + b += 1 // don't read error number + + v.Sequence = xgb.Get16(buf[b:]) + b += 2 + + return v +} + +// SequenceId returns the sequence id attached to the BadPictOp error. +// This is mostly used internally. +func (err PictOpError) SequenceId() uint16 { + return err.Sequence +} + +// BadId returns the 'BadValue' number if one exists for the BadPictOp error. If no bad value exists, 0 is returned. +func (err PictOpError) BadId() uint32 { + return 0 +} + +// Error returns a rudimentary string representation of the BadPictOp error. + +func (err PictOpError) Error() string { + fieldVals := make([]string, 0, 0) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence)) + return "BadPictOp {" + xgb.StringsJoin(fieldVals, ", ") + "}" +} + +func init() { + xgb.NewExtErrorFuncs["RENDER"][2] = PictOpErrorNew +} + +const ( + PictOpClear = 0 + PictOpSrc = 1 + PictOpDst = 2 + PictOpOver = 3 + PictOpOverReverse = 4 + PictOpIn = 5 + PictOpInReverse = 6 + PictOpOut = 7 + PictOpOutReverse = 8 + PictOpAtop = 9 + PictOpAtopReverse = 10 + PictOpXor = 11 + PictOpAdd = 12 + PictOpSaturate = 13 + PictOpDisjointClear = 16 + PictOpDisjointSrc = 17 + PictOpDisjointDst = 18 + PictOpDisjointOver = 19 + PictOpDisjointOverReverse = 20 + PictOpDisjointIn = 21 + PictOpDisjointInReverse = 22 + PictOpDisjointOut = 23 + PictOpDisjointOutReverse = 24 + PictOpDisjointAtop = 25 + PictOpDisjointAtopReverse = 26 + PictOpDisjointXor = 27 + PictOpConjointClear = 32 + PictOpConjointSrc = 33 + PictOpConjointDst = 34 + PictOpConjointOver = 35 + PictOpConjointOverReverse = 36 + PictOpConjointIn = 37 + PictOpConjointInReverse = 38 + PictOpConjointOut = 39 + PictOpConjointOutReverse = 40 + PictOpConjointAtop = 41 + PictOpConjointAtopReverse = 42 + PictOpConjointXor = 43 + PictOpMultiply = 48 + PictOpScreen = 49 + PictOpOverlay = 50 + PictOpDarken = 51 + PictOpLighten = 52 + PictOpColorDodge = 53 + PictOpColorBurn = 54 + PictOpHardLight = 55 + PictOpSoftLight = 56 + PictOpDifference = 57 + PictOpExclusion = 58 + PictOpHSLHue = 59 + PictOpHSLSaturation = 60 + PictOpHSLColor = 61 + PictOpHSLLuminosity = 62 +) + +const ( + PictTypeIndexed = 0 + PictTypeDirect = 1 +) + +type Pictdepth struct { + Depth byte + // padding: 1 bytes + NumVisuals uint16 + // padding: 4 bytes + Visuals []Pictvisual // size: xgb.Pad((int(NumVisuals) * 8)) +} + +// PictdepthRead reads a byte slice into a Pictdepth value. +func PictdepthRead(buf []byte, v *Pictdepth) int { + b := 0 + + v.Depth = buf[b] + b += 1 + + b += 1 // padding + + v.NumVisuals = xgb.Get16(buf[b:]) + b += 2 + + b += 4 // padding + + v.Visuals = make([]Pictvisual, v.NumVisuals) + b += PictvisualReadList(buf[b:], v.Visuals) + + return b +} + +// PictdepthReadList reads a byte slice into a list of Pictdepth values. +func PictdepthReadList(buf []byte, dest []Pictdepth) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = Pictdepth{} + b += PictdepthRead(buf[b:], &dest[i]) + } + return xgb.Pad(b) +} + +// Bytes writes a Pictdepth value to a byte slice. +func (v Pictdepth) Bytes() []byte { + buf := make([]byte, (8 + xgb.Pad((int(v.NumVisuals) * 8)))) + b := 0 + + buf[b] = v.Depth + b += 1 + + b += 1 // padding + + xgb.Put16(buf[b:], v.NumVisuals) + b += 2 + + b += 4 // padding + + b += PictvisualListBytes(buf[b:], v.Visuals) + + return buf +} + +// PictdepthListBytes writes a list of Pictdepth values to a byte slice. +func PictdepthListBytes(buf []byte, list []Pictdepth) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) b += xgb.Pad(len(structBytes)) } + return b +} + +// PictdepthListSize computes the size (bytes) of a list of Pictdepth values. +func PictdepthListSize(list []Pictdepth) int { + size := 0 + for _, item := range list { + size += (8 + xgb.Pad((int(item.NumVisuals) * 8))) + } + return size +} + +type Pictformat uint32 + +func NewPictformatId(c *xgb.Conn) (Pictformat, error) { + id, err := c.NewId() + if err != nil { + return 0, err + } + return Pictformat(id), nil +} + +type Pictforminfo struct { + Id Pictformat + Type byte + Depth byte + // padding: 2 bytes + Direct Directformat + Colormap xproto.Colormap +} + +// PictforminfoRead reads a byte slice into a Pictforminfo value. +func PictforminfoRead(buf []byte, v *Pictforminfo) int { + b := 0 + + v.Id = Pictformat(xgb.Get32(buf[b:])) + b += 4 + + v.Type = buf[b] + b += 1 + + v.Depth = buf[b] + b += 1 + + b += 2 // padding + + v.Direct = Directformat{} + b += DirectformatRead(buf[b:], &v.Direct) + + v.Colormap = xproto.Colormap(xgb.Get32(buf[b:])) + b += 4 + + return b +} + +// PictforminfoReadList reads a byte slice into a list of Pictforminfo values. +func PictforminfoReadList(buf []byte, dest []Pictforminfo) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = Pictforminfo{} + b += PictforminfoRead(buf[b:], &dest[i]) + } + return xgb.Pad(b) +} + +// Bytes writes a Pictforminfo value to a byte slice. +func (v Pictforminfo) Bytes() []byte { + buf := make([]byte, 28) + b := 0 + + xgb.Put32(buf[b:], uint32(v.Id)) + b += 4 + + buf[b] = v.Type + b += 1 + + buf[b] = v.Depth + b += 1 + + b += 2 // padding { - structBytes := v.P3.Bytes() + structBytes := v.Direct.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } + + xgb.Put32(buf[b:], uint32(v.Colormap)) + b += 4 + + return buf +} + +// PictforminfoListBytes writes a list of Pictforminfo values to a byte slice. +func PictforminfoListBytes(buf []byte, list []Pictforminfo) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } + return b +} + +type Pictscreen struct { + NumDepths uint32 + Fallback Pictformat + Depths []Pictdepth // size: PictdepthListSize(Depths) +} + +// PictscreenRead reads a byte slice into a Pictscreen value. +func PictscreenRead(buf []byte, v *Pictscreen) int { + b := 0 + + v.NumDepths = xgb.Get32(buf[b:]) + b += 4 + + v.Fallback = Pictformat(xgb.Get32(buf[b:])) + b += 4 + + v.Depths = make([]Pictdepth, v.NumDepths) + b += PictdepthReadList(buf[b:], v.Depths) + + return b +} + +// PictscreenReadList reads a byte slice into a list of Pictscreen values. +func PictscreenReadList(buf []byte, dest []Pictscreen) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = Pictscreen{} + b += PictscreenRead(buf[b:], &dest[i]) + } + return xgb.Pad(b) +} + +// Bytes writes a Pictscreen value to a byte slice. +func (v Pictscreen) Bytes() []byte { + buf := make([]byte, (8 + PictdepthListSize(v.Depths))) + b := 0 + + xgb.Put32(buf[b:], v.NumDepths) + b += 4 + + xgb.Put32(buf[b:], uint32(v.Fallback)) + b += 4 + + b += PictdepthListBytes(buf[b:], v.Depths) + + return buf +} + +// PictscreenListBytes writes a list of Pictscreen values to a byte slice. +func PictscreenListBytes(buf []byte, list []Pictscreen) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() copy(buf[b:], structBytes) b += xgb.Pad(len(structBytes)) } + return b +} + +// PictscreenListSize computes the size (bytes) of a list of Pictscreen values. +func PictscreenListSize(list []Pictscreen) int { + size := 0 + for _, item := range list { + size += (8 + PictdepthListSize(item.Depths)) + } + return size +} + +type Picture uint32 + +func NewPictureId(c *xgb.Conn) (Picture, error) { + id, err := c.NewId() + if err != nil { + return 0, err + } + return Picture(id), nil +} + +// BadPicture is the error number for a BadPicture. +const BadPicture = 1 + +type PictureError struct { + Sequence uint16 + NiceName string +} + +// PictureErrorNew constructs a PictureError value that implements xgb.Error from a byte slice. +func PictureErrorNew(buf []byte) xgb.Error { + v := PictureError{} + v.NiceName = "Picture" + + b := 1 // skip error determinant + b += 1 // don't read error number + + v.Sequence = xgb.Get16(buf[b:]) + b += 2 + + return v +} + +// SequenceId returns the sequence id attached to the BadPicture error. +// This is mostly used internally. +func (err PictureError) SequenceId() uint16 { + return err.Sequence +} + +// BadId returns the 'BadValue' number if one exists for the BadPicture error. If no bad value exists, 0 is returned. +func (err PictureError) BadId() uint32 { + return 0 +} + +// Error returns a rudimentary string representation of the BadPicture error. + +func (err PictureError) Error() string { + fieldVals := make([]string, 0, 0) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence)) + return "BadPicture {" + xgb.StringsJoin(fieldVals, ", ") + "}" +} + +func init() { + xgb.NewExtErrorFuncs["RENDER"][1] = PictureErrorNew +} + +const ( + PictureNone = 0 +) + +type Pictvisual struct { + Visual xproto.Visualid + Format Pictformat +} + +// PictvisualRead reads a byte slice into a Pictvisual value. +func PictvisualRead(buf []byte, v *Pictvisual) int { + b := 0 + + v.Visual = xproto.Visualid(xgb.Get32(buf[b:])) + b += 4 + + v.Format = Pictformat(xgb.Get32(buf[b:])) + b += 4 + + return b +} + +// PictvisualReadList reads a byte slice into a list of Pictvisual values. +func PictvisualReadList(buf []byte, dest []Pictvisual) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = Pictvisual{} + b += PictvisualRead(buf[b:], &dest[i]) + } + return xgb.Pad(b) +} + +// Bytes writes a Pictvisual value to a byte slice. +func (v Pictvisual) Bytes() []byte { + buf := make([]byte, 8) + b := 0 + + xgb.Put32(buf[b:], uint32(v.Visual)) + b += 4 + + xgb.Put32(buf[b:], uint32(v.Format)) + b += 4 return buf } -// TriangleListBytes writes a list of Triangle values to a byte slice. -func TriangleListBytes(buf []byte, list []Triangle) int { +// PictvisualListBytes writes a list of Pictvisual values to a byte slice. +func PictvisualListBytes(buf []byte, list []Pictvisual) int { b := 0 var structBytes []byte for _, item := range list { @@ -913,70 +1105,50 @@ func TriangleListBytes(buf []byte, list []Triangle) int { return b } -type Trapezoid struct { - Top Fixed - Bottom Fixed - Left Linefix - Right Linefix +type Pointfix struct { + X Fixed + Y Fixed } -// TrapezoidRead reads a byte slice into a Trapezoid value. -func TrapezoidRead(buf []byte, v *Trapezoid) int { +// PointfixRead reads a byte slice into a Pointfix value. +func PointfixRead(buf []byte, v *Pointfix) int { b := 0 - v.Top = Fixed(xgb.Get32(buf[b:])) + v.X = Fixed(xgb.Get32(buf[b:])) b += 4 - v.Bottom = Fixed(xgb.Get32(buf[b:])) + v.Y = Fixed(xgb.Get32(buf[b:])) b += 4 - v.Left = Linefix{} - b += LinefixRead(buf[b:], &v.Left) - - v.Right = Linefix{} - b += LinefixRead(buf[b:], &v.Right) - return b } -// TrapezoidReadList reads a byte slice into a list of Trapezoid values. -func TrapezoidReadList(buf []byte, dest []Trapezoid) int { +// PointfixReadList reads a byte slice into a list of Pointfix values. +func PointfixReadList(buf []byte, dest []Pointfix) int { b := 0 for i := 0; i < len(dest); i++ { - dest[i] = Trapezoid{} - b += TrapezoidRead(buf[b:], &dest[i]) + dest[i] = Pointfix{} + b += PointfixRead(buf[b:], &dest[i]) } return xgb.Pad(b) } -// Bytes writes a Trapezoid value to a byte slice. -func (v Trapezoid) Bytes() []byte { - buf := make([]byte, 40) +// Bytes writes a Pointfix value to a byte slice. +func (v Pointfix) Bytes() []byte { + buf := make([]byte, 8) b := 0 - xgb.Put32(buf[b:], uint32(v.Top)) + xgb.Put32(buf[b:], uint32(v.X)) b += 4 - xgb.Put32(buf[b:], uint32(v.Bottom)) + xgb.Put32(buf[b:], uint32(v.Y)) b += 4 - { - structBytes := v.Left.Bytes() - copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) - } - - { - structBytes := v.Right.Bytes() - copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) - } - return buf } -// TrapezoidListBytes writes a list of Trapezoid values to a byte slice. -func TrapezoidListBytes(buf []byte, list []Trapezoid) int { +// PointfixListBytes writes a list of Pointfix values to a byte slice. +func PointfixListBytes(buf []byte, list []Pointfix) int { b := 0 var structBytes []byte for _, item := range list { @@ -987,78 +1159,74 @@ func TrapezoidListBytes(buf []byte, list []Trapezoid) int { return b } -type Glyphinfo struct { - Width uint16 - Height uint16 - X int16 - Y int16 - XOff int16 - YOff int16 -} +const ( + PolyEdgeSharp = 0 + PolyEdgeSmooth = 1 +) -// GlyphinfoRead reads a byte slice into a Glyphinfo value. -func GlyphinfoRead(buf []byte, v *Glyphinfo) int { - b := 0 +const ( + PolyModePrecise = 0 + PolyModeImprecise = 1 +) - v.Width = xgb.Get16(buf[b:]) - b += 2 +const ( + RepeatNone = 0 + RepeatNormal = 1 + RepeatPad = 2 + RepeatReflect = 3 +) - v.Height = xgb.Get16(buf[b:]) - b += 2 +type Spanfix struct { + L Fixed + R Fixed + Y Fixed +} - v.X = int16(xgb.Get16(buf[b:])) - b += 2 +// SpanfixRead reads a byte slice into a Spanfix value. +func SpanfixRead(buf []byte, v *Spanfix) int { + b := 0 - v.Y = int16(xgb.Get16(buf[b:])) - b += 2 + v.L = Fixed(xgb.Get32(buf[b:])) + b += 4 - v.XOff = int16(xgb.Get16(buf[b:])) - b += 2 + v.R = Fixed(xgb.Get32(buf[b:])) + b += 4 - v.YOff = int16(xgb.Get16(buf[b:])) - b += 2 + v.Y = Fixed(xgb.Get32(buf[b:])) + b += 4 return b } -// GlyphinfoReadList reads a byte slice into a list of Glyphinfo values. -func GlyphinfoReadList(buf []byte, dest []Glyphinfo) int { +// SpanfixReadList reads a byte slice into a list of Spanfix values. +func SpanfixReadList(buf []byte, dest []Spanfix) int { b := 0 for i := 0; i < len(dest); i++ { - dest[i] = Glyphinfo{} - b += GlyphinfoRead(buf[b:], &dest[i]) + dest[i] = Spanfix{} + b += SpanfixRead(buf[b:], &dest[i]) } return xgb.Pad(b) } -// Bytes writes a Glyphinfo value to a byte slice. -func (v Glyphinfo) Bytes() []byte { +// Bytes writes a Spanfix value to a byte slice. +func (v Spanfix) Bytes() []byte { buf := make([]byte, 12) b := 0 - xgb.Put16(buf[b:], v.Width) - b += 2 - - xgb.Put16(buf[b:], v.Height) - b += 2 - - xgb.Put16(buf[b:], uint16(v.X)) - b += 2 - - xgb.Put16(buf[b:], uint16(v.Y)) - b += 2 + xgb.Put32(buf[b:], uint32(v.L)) + b += 4 - xgb.Put16(buf[b:], uint16(v.XOff)) - b += 2 + xgb.Put32(buf[b:], uint32(v.R)) + b += 4 - xgb.Put16(buf[b:], uint16(v.YOff)) - b += 2 + xgb.Put32(buf[b:], uint32(v.Y)) + b += 4 return buf } -// GlyphinfoListBytes writes a list of Glyphinfo values to a byte slice. -func GlyphinfoListBytes(buf []byte, list []Glyphinfo) int { +// SpanfixListBytes writes a list of Spanfix values to a byte slice. +func SpanfixListBytes(buf []byte, list []Spanfix) int { b := 0 var structBytes []byte for _, item := range list { @@ -1069,6 +1237,15 @@ func GlyphinfoListBytes(buf []byte, list []Glyphinfo) int { return b } +const ( + SubPixelUnknown = 0 + SubPixelHorizontalRGB = 1 + SubPixelHorizontalBGR = 2 + SubPixelVerticalRGB = 3 + SubPixelVerticalBGR = 4 + SubPixelNone = 5 +) + type Transform struct { Matrix11 Fixed Matrix12 Fixed @@ -1172,50 +1349,56 @@ func TransformListBytes(buf []byte, list []Transform) int { return b } -type Animcursorelt struct { - Cursor xproto.Cursor - Delay uint32 +type Trap struct { + Top Spanfix + Bot Spanfix } -// AnimcursoreltRead reads a byte slice into a Animcursorelt value. -func AnimcursoreltRead(buf []byte, v *Animcursorelt) int { +// TrapRead reads a byte slice into a Trap value. +func TrapRead(buf []byte, v *Trap) int { b := 0 - v.Cursor = xproto.Cursor(xgb.Get32(buf[b:])) - b += 4 + v.Top = Spanfix{} + b += SpanfixRead(buf[b:], &v.Top) - v.Delay = xgb.Get32(buf[b:]) - b += 4 + v.Bot = Spanfix{} + b += SpanfixRead(buf[b:], &v.Bot) return b } -// AnimcursoreltReadList reads a byte slice into a list of Animcursorelt values. -func AnimcursoreltReadList(buf []byte, dest []Animcursorelt) int { +// TrapReadList reads a byte slice into a list of Trap values. +func TrapReadList(buf []byte, dest []Trap) int { b := 0 for i := 0; i < len(dest); i++ { - dest[i] = Animcursorelt{} - b += AnimcursoreltRead(buf[b:], &dest[i]) + dest[i] = Trap{} + b += TrapRead(buf[b:], &dest[i]) } return xgb.Pad(b) } -// Bytes writes a Animcursorelt value to a byte slice. -func (v Animcursorelt) Bytes() []byte { - buf := make([]byte, 8) +// Bytes writes a Trap value to a byte slice. +func (v Trap) Bytes() []byte { + buf := make([]byte, 24) b := 0 - xgb.Put32(buf[b:], uint32(v.Cursor)) - b += 4 + { + structBytes := v.Top.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } - xgb.Put32(buf[b:], v.Delay) - b += 4 + { + structBytes := v.Bot.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } return buf } -// AnimcursoreltListBytes writes a list of Animcursorelt values to a byte slice. -func AnimcursoreltListBytes(buf []byte, list []Animcursorelt) int { +// TrapListBytes writes a list of Trap values to a byte slice. +func TrapListBytes(buf []byte, list []Trap) int { b := 0 var structBytes []byte for _, item := range list { @@ -1226,57 +1409,70 @@ func AnimcursoreltListBytes(buf []byte, list []Animcursorelt) int { return b } -type Spanfix struct { - L Fixed - R Fixed - Y Fixed +type Trapezoid struct { + Top Fixed + Bottom Fixed + Left Linefix + Right Linefix } -// SpanfixRead reads a byte slice into a Spanfix value. -func SpanfixRead(buf []byte, v *Spanfix) int { +// TrapezoidRead reads a byte slice into a Trapezoid value. +func TrapezoidRead(buf []byte, v *Trapezoid) int { b := 0 - v.L = Fixed(xgb.Get32(buf[b:])) + v.Top = Fixed(xgb.Get32(buf[b:])) b += 4 - v.R = Fixed(xgb.Get32(buf[b:])) + v.Bottom = Fixed(xgb.Get32(buf[b:])) b += 4 - v.Y = Fixed(xgb.Get32(buf[b:])) - b += 4 + v.Left = Linefix{} + b += LinefixRead(buf[b:], &v.Left) + + v.Right = Linefix{} + b += LinefixRead(buf[b:], &v.Right) return b } -// SpanfixReadList reads a byte slice into a list of Spanfix values. -func SpanfixReadList(buf []byte, dest []Spanfix) int { +// TrapezoidReadList reads a byte slice into a list of Trapezoid values. +func TrapezoidReadList(buf []byte, dest []Trapezoid) int { b := 0 for i := 0; i < len(dest); i++ { - dest[i] = Spanfix{} - b += SpanfixRead(buf[b:], &dest[i]) + dest[i] = Trapezoid{} + b += TrapezoidRead(buf[b:], &dest[i]) } return xgb.Pad(b) } -// Bytes writes a Spanfix value to a byte slice. -func (v Spanfix) Bytes() []byte { - buf := make([]byte, 12) +// Bytes writes a Trapezoid value to a byte slice. +func (v Trapezoid) Bytes() []byte { + buf := make([]byte, 40) b := 0 - xgb.Put32(buf[b:], uint32(v.L)) + xgb.Put32(buf[b:], uint32(v.Top)) b += 4 - xgb.Put32(buf[b:], uint32(v.R)) + xgb.Put32(buf[b:], uint32(v.Bottom)) b += 4 - xgb.Put32(buf[b:], uint32(v.Y)) - b += 4 + { + structBytes := v.Left.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } + + { + structBytes := v.Right.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } return buf } -// SpanfixListBytes writes a list of Spanfix values to a byte slice. -func SpanfixListBytes(buf []byte, list []Spanfix) int { +// TrapezoidListBytes writes a list of Trapezoid values to a byte slice. +func TrapezoidListBytes(buf []byte, list []Trapezoid) int { b := 0 var structBytes []byte for _, item := range list { @@ -1287,47 +1483,57 @@ func SpanfixListBytes(buf []byte, list []Spanfix) int { return b } -type Trap struct { - Top Spanfix - Bot Spanfix +type Triangle struct { + P1 Pointfix + P2 Pointfix + P3 Pointfix } -// TrapRead reads a byte slice into a Trap value. -func TrapRead(buf []byte, v *Trap) int { +// TriangleRead reads a byte slice into a Triangle value. +func TriangleRead(buf []byte, v *Triangle) int { b := 0 - v.Top = Spanfix{} - b += SpanfixRead(buf[b:], &v.Top) + v.P1 = Pointfix{} + b += PointfixRead(buf[b:], &v.P1) - v.Bot = Spanfix{} - b += SpanfixRead(buf[b:], &v.Bot) + v.P2 = Pointfix{} + b += PointfixRead(buf[b:], &v.P2) + + v.P3 = Pointfix{} + b += PointfixRead(buf[b:], &v.P3) return b } -// TrapReadList reads a byte slice into a list of Trap values. -func TrapReadList(buf []byte, dest []Trap) int { +// TriangleReadList reads a byte slice into a list of Triangle values. +func TriangleReadList(buf []byte, dest []Triangle) int { b := 0 for i := 0; i < len(dest); i++ { - dest[i] = Trap{} - b += TrapRead(buf[b:], &dest[i]) + dest[i] = Triangle{} + b += TriangleRead(buf[b:], &dest[i]) } return xgb.Pad(b) } -// Bytes writes a Trap value to a byte slice. -func (v Trap) Bytes() []byte { +// Bytes writes a Triangle value to a byte slice. +func (v Triangle) Bytes() []byte { buf := make([]byte, 24) b := 0 { - structBytes := v.Top.Bytes() + structBytes := v.P1.Bytes() copy(buf[b:], structBytes) b += xgb.Pad(len(structBytes)) } { - structBytes := v.Bot.Bytes() + structBytes := v.P2.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } + + { + structBytes := v.P3.Bytes() copy(buf[b:], structBytes) b += xgb.Pad(len(structBytes)) } @@ -1335,8 +1541,8 @@ func (v Trap) Bytes() []byte { return buf } -// TrapListBytes writes a list of Trap values to a byte slice. -func TrapListBytes(buf []byte, list []Trap) int { +// TriangleListBytes writes a list of Triangle values to a byte slice. +func TriangleListBytes(buf []byte, list []Triangle) int { b := 0 var structBytes []byte for _, item := range list { @@ -1347,788 +1553,650 @@ func TrapListBytes(buf []byte, list []Trap) int { return b } -// BadPictFormat is the error number for a BadPictFormat. -const BadPictFormat = 0 - -type PictFormatError struct { - Sequence uint16 - NiceName string -} - -// PictFormatErrorNew constructs a PictFormatError value that implements xgb.Error from a byte slice. -func PictFormatErrorNew(buf []byte) xgb.Error { - v := PictFormatError{} - v.NiceName = "PictFormat" - - b := 1 // skip error determinant - b += 1 // don't read error number - - v.Sequence = xgb.Get16(buf[b:]) - b += 2 - - return v -} - -// SequenceId returns the sequence id attached to the BadPictFormat error. -// This is mostly used internally. -func (err PictFormatError) SequenceId() uint16 { - return err.Sequence -} - -// BadId returns the 'BadValue' number if one exists for the BadPictFormat error. If no bad value exists, 0 is returned. -func (err PictFormatError) BadId() uint32 { - return 0 -} - -// Error returns a rudimentary string representation of the BadPictFormat error. - -func (err PictFormatError) Error() string { - fieldVals := make([]string, 0, 0) - fieldVals = append(fieldVals, "NiceName: "+err.NiceName) - fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence)) - return "BadPictFormat {" + xgb.StringsJoin(fieldVals, ", ") + "}" -} - -func init() { - xgb.NewExtErrorFuncs["RENDER"][0] = PictFormatErrorNew -} - -// BadPicture is the error number for a BadPicture. -const BadPicture = 1 - -type PictureError struct { - Sequence uint16 - NiceName string -} - -// PictureErrorNew constructs a PictureError value that implements xgb.Error from a byte slice. -func PictureErrorNew(buf []byte) xgb.Error { - v := PictureError{} - v.NiceName = "Picture" - - b := 1 // skip error determinant - b += 1 // don't read error number - - v.Sequence = xgb.Get16(buf[b:]) - b += 2 - - return v -} - -// SequenceId returns the sequence id attached to the BadPicture error. -// This is mostly used internally. -func (err PictureError) SequenceId() uint16 { - return err.Sequence -} - -// BadId returns the 'BadValue' number if one exists for the BadPicture error. If no bad value exists, 0 is returned. -func (err PictureError) BadId() uint32 { - return 0 -} - -// Error returns a rudimentary string representation of the BadPicture error. - -func (err PictureError) Error() string { - fieldVals := make([]string, 0, 0) - fieldVals = append(fieldVals, "NiceName: "+err.NiceName) - fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence)) - return "BadPicture {" + xgb.StringsJoin(fieldVals, ", ") + "}" -} - -func init() { - xgb.NewExtErrorFuncs["RENDER"][1] = PictureErrorNew -} - -// BadPictOp is the error number for a BadPictOp. -const BadPictOp = 2 - -type PictOpError struct { - Sequence uint16 - NiceName string -} - -// PictOpErrorNew constructs a PictOpError value that implements xgb.Error from a byte slice. -func PictOpErrorNew(buf []byte) xgb.Error { - v := PictOpError{} - v.NiceName = "PictOp" - - b := 1 // skip error determinant - b += 1 // don't read error number - - v.Sequence = xgb.Get16(buf[b:]) - b += 2 - - return v -} +// Skipping definition for base type 'Bool' -// SequenceId returns the sequence id attached to the BadPictOp error. -// This is mostly used internally. -func (err PictOpError) SequenceId() uint16 { - return err.Sequence -} +// Skipping definition for base type 'Byte' -// BadId returns the 'BadValue' number if one exists for the BadPictOp error. If no bad value exists, 0 is returned. -func (err PictOpError) BadId() uint32 { - return 0 -} +// Skipping definition for base type 'Card8' -// Error returns a rudimentary string representation of the BadPictOp error. +// Skipping definition for base type 'Char' -func (err PictOpError) Error() string { - fieldVals := make([]string, 0, 0) - fieldVals = append(fieldVals, "NiceName: "+err.NiceName) - fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence)) - return "BadPictOp {" + xgb.StringsJoin(fieldVals, ", ") + "}" -} +// Skipping definition for base type 'Void' -func init() { - xgb.NewExtErrorFuncs["RENDER"][2] = PictOpErrorNew -} +// Skipping definition for base type 'Double' -// BadGlyphSet is the error number for a BadGlyphSet. -const BadGlyphSet = 3 +// Skipping definition for base type 'Float' -type GlyphSetError struct { - Sequence uint16 - NiceName string -} +// Skipping definition for base type 'Int16' -// GlyphSetErrorNew constructs a GlyphSetError value that implements xgb.Error from a byte slice. -func GlyphSetErrorNew(buf []byte) xgb.Error { - v := GlyphSetError{} - v.NiceName = "GlyphSet" +// Skipping definition for base type 'Int32' - b := 1 // skip error determinant - b += 1 // don't read error number +// Skipping definition for base type 'Int8' - v.Sequence = xgb.Get16(buf[b:]) - b += 2 +// Skipping definition for base type 'Card16' - return v -} +// Skipping definition for base type 'Card32' -// SequenceId returns the sequence id attached to the BadGlyphSet error. -// This is mostly used internally. -func (err GlyphSetError) SequenceId() uint16 { - return err.Sequence +// AddGlyphsCookie is a cookie used only for AddGlyphs requests. +type AddGlyphsCookie struct { + *xgb.Cookie } -// BadId returns the 'BadValue' number if one exists for the BadGlyphSet error. If no bad value exists, 0 is returned. -func (err GlyphSetError) BadId() uint32 { - return 0 +// AddGlyphs sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. +func AddGlyphs(c *xgb.Conn, Glyphset Glyphset, GlyphsLen uint32, Glyphids []uint32, Glyphs []Glyphinfo, Data []byte) AddGlyphsCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'AddGlyphs' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } + cookie := c.NewCookie(false, false) + c.NewRequest(addGlyphsRequest(c, Glyphset, GlyphsLen, Glyphids, Glyphs, Data), cookie) + return AddGlyphsCookie{cookie} } -// Error returns a rudimentary string representation of the BadGlyphSet error. - -func (err GlyphSetError) Error() string { - fieldVals := make([]string, 0, 0) - fieldVals = append(fieldVals, "NiceName: "+err.NiceName) - fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence)) - return "BadGlyphSet {" + xgb.StringsJoin(fieldVals, ", ") + "}" +// AddGlyphsChecked sends a checked request. +// If an error occurs, it can be retrieved using AddGlyphsCookie.Check() +func AddGlyphsChecked(c *xgb.Conn, Glyphset Glyphset, GlyphsLen uint32, Glyphids []uint32, Glyphs []Glyphinfo, Data []byte) AddGlyphsCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'AddGlyphs' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } + cookie := c.NewCookie(true, false) + c.NewRequest(addGlyphsRequest(c, Glyphset, GlyphsLen, Glyphids, Glyphs, Data), cookie) + return AddGlyphsCookie{cookie} } -func init() { - xgb.NewExtErrorFuncs["RENDER"][3] = GlyphSetErrorNew +// 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 AddGlyphsCookie) Check() error { + return cook.Cookie.Check() } -// BadGlyph is the error number for a BadGlyph. -const BadGlyph = 4 - -type GlyphError struct { - Sequence uint16 - NiceName string -} +// Write request to wire for AddGlyphs +// addGlyphsRequest writes a AddGlyphs request to a byte slice. +func addGlyphsRequest(c *xgb.Conn, Glyphset Glyphset, GlyphsLen uint32, Glyphids []uint32, Glyphs []Glyphinfo, Data []byte) []byte { + size := xgb.Pad((((12 + xgb.Pad((int(GlyphsLen) * 4))) + xgb.Pad((int(GlyphsLen) * 12))) + xgb.Pad((len(Data) * 1)))) + b := 0 + buf := make([]byte, size) -// GlyphErrorNew constructs a GlyphError value that implements xgb.Error from a byte slice. -func GlyphErrorNew(buf []byte) xgb.Error { - v := GlyphError{} - v.NiceName = "Glyph" + buf[b] = c.Extensions["RENDER"] + b += 1 - b := 1 // skip error determinant - b += 1 // don't read error number + buf[b] = 20 // 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 - return v -} + xgb.Put32(buf[b:], uint32(Glyphset)) + b += 4 -// SequenceId returns the sequence id attached to the BadGlyph error. -// This is mostly used internally. -func (err GlyphError) SequenceId() uint16 { - return err.Sequence -} + xgb.Put32(buf[b:], GlyphsLen) + b += 4 -// BadId returns the 'BadValue' number if one exists for the BadGlyph error. If no bad value exists, 0 is returned. -func (err GlyphError) BadId() uint32 { - return 0 -} + for i := 0; i < int(GlyphsLen); i++ { + xgb.Put32(buf[b:], Glyphids[i]) + b += 4 + } + b = xgb.Pad(b) -// Error returns a rudimentary string representation of the BadGlyph error. + b += GlyphinfoListBytes(buf[b:], Glyphs) -func (err GlyphError) Error() string { - fieldVals := make([]string, 0, 0) - fieldVals = append(fieldVals, "NiceName: "+err.NiceName) - fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence)) - return "BadGlyph {" + xgb.StringsJoin(fieldVals, ", ") + "}" -} + copy(buf[b:], Data[:len(Data)]) + b += xgb.Pad(int(len(Data))) -func init() { - xgb.NewExtErrorFuncs["RENDER"][4] = GlyphErrorNew + return buf } -// QueryVersionCookie is a cookie used only for QueryVersion requests. -type QueryVersionCookie struct { +// AddTrapsCookie is a cookie used only for AddTraps requests. +type AddTrapsCookie 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, ClientMajorVersion uint32, ClientMinorVersion uint32) QueryVersionCookie { +// AddTraps sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. +func AddTraps(c *xgb.Conn, Picture Picture, XOff int16, YOff int16, Traps []Trap) AddTrapsCookie { if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + panic("Cannot issue request 'AddTraps' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } - cookie := c.NewCookie(true, true) - c.NewRequest(queryVersionRequest(c, ClientMajorVersion, ClientMinorVersion), cookie) - return QueryVersionCookie{cookie} + cookie := c.NewCookie(false, false) + c.NewRequest(addTrapsRequest(c, Picture, XOff, YOff, Traps), cookie) + return AddTrapsCookie{cookie} } -// QueryVersionUnchecked sends an unchecked request. -// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. -func QueryVersionUnchecked(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVersion uint32) QueryVersionCookie { +// AddTrapsChecked sends a checked request. +// If an error occurs, it can be retrieved using AddTrapsCookie.Check() +func AddTrapsChecked(c *xgb.Conn, Picture Picture, XOff int16, YOff int16, Traps []Trap) AddTrapsCookie { if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + panic("Cannot issue request 'AddTraps' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } - cookie := c.NewCookie(false, true) - c.NewRequest(queryVersionRequest(c, ClientMajorVersion, ClientMinorVersion), cookie) - return QueryVersionCookie{cookie} + cookie := c.NewCookie(true, false) + c.NewRequest(addTrapsRequest(c, Picture, XOff, YOff, Traps), cookie) + return AddTrapsCookie{cookie} } -// 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 - MajorVersion uint32 - MinorVersion uint32 - // padding: 16 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 AddTrapsCookie) Check() error { + return cook.Cookie.Check() } -// Reply blocks and returns the reply data for a QueryVersion request. -func (cook QueryVersionCookie) Reply() (*QueryVersionReply, error) { - buf, err := cook.Cookie.Reply() - if err != nil { - return nil, err - } - if buf == nil { - return nil, nil - } - return queryVersionReply(buf), nil -} +// Write request to wire for AddTraps +// addTrapsRequest writes a AddTraps request to a byte slice. +func addTrapsRequest(c *xgb.Conn, Picture Picture, XOff int16, YOff int16, Traps []Trap) []byte { + size := xgb.Pad((12 + xgb.Pad((len(Traps) * 24)))) + b := 0 + buf := make([]byte, size) -// queryVersionReply reads a byte slice into a QueryVersionReply value. -func queryVersionReply(buf []byte) *QueryVersionReply { - v := new(QueryVersionReply) - b := 1 // skip reply determinant + buf[b] = c.Extensions["RENDER"] + b += 1 - b += 1 // padding + buf[b] = 32 // 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(Picture)) b += 4 - v.MajorVersion = xgb.Get32(buf[b:]) - b += 4 + xgb.Put16(buf[b:], uint16(XOff)) + b += 2 - v.MinorVersion = xgb.Get32(buf[b:]) - b += 4 + xgb.Put16(buf[b:], uint16(YOff)) + b += 2 - b += 16 // padding + b += TrapListBytes(buf[b:], Traps) - return v + return buf } -// Write request to wire for QueryVersion -// queryVersionRequest writes a QueryVersion request to a byte slice. -func queryVersionRequest(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVersion uint32) []byte { - size := 12 +// ChangePictureCookie is a cookie used only for ChangePicture requests. +type ChangePictureCookie struct { + *xgb.Cookie +} + +// ChangePicture sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. +func ChangePicture(c *xgb.Conn, Picture Picture, ValueMask uint32, ValueList []uint32) ChangePictureCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'ChangePicture' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } + cookie := c.NewCookie(false, false) + c.NewRequest(changePictureRequest(c, Picture, ValueMask, ValueList), cookie) + return ChangePictureCookie{cookie} +} + +// ChangePictureChecked sends a checked request. +// If an error occurs, it can be retrieved using ChangePictureCookie.Check() +func ChangePictureChecked(c *xgb.Conn, Picture Picture, ValueMask uint32, ValueList []uint32) ChangePictureCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'ChangePicture' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } + cookie := c.NewCookie(true, false) + c.NewRequest(changePictureRequest(c, Picture, ValueMask, ValueList), cookie) + return ChangePictureCookie{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 ChangePictureCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for ChangePicture +// changePictureRequest writes a ChangePicture request to a byte slice. +func changePictureRequest(c *xgb.Conn, Picture Picture, ValueMask uint32, ValueList []uint32) []byte { + size := xgb.Pad((8 + (4 + xgb.Pad((4 * xgb.PopCount(int(ValueMask))))))) b := 0 buf := make([]byte, size) buf[b] = c.Extensions["RENDER"] b += 1 - buf[b] = 0 // 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:], ClientMajorVersion) + xgb.Put32(buf[b:], uint32(Picture)) b += 4 - xgb.Put32(buf[b:], ClientMinorVersion) + xgb.Put32(buf[b:], ValueMask) b += 4 + for i := 0; i < xgb.PopCount(int(ValueMask)); i++ { + xgb.Put32(buf[b:], ValueList[i]) + b += 4 + } + b = xgb.Pad(b) return buf } -// QueryPictFormatsCookie is a cookie used only for QueryPictFormats requests. -type QueryPictFormatsCookie struct { +// CompositeCookie is a cookie used only for Composite requests. +type CompositeCookie struct { *xgb.Cookie } -// QueryPictFormats sends a checked request. -// If an error occurs, it will be returned with the reply by calling QueryPictFormatsCookie.Reply() -func QueryPictFormats(c *xgb.Conn) QueryPictFormatsCookie { - if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'QueryPictFormats' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") - } - cookie := c.NewCookie(true, true) - c.NewRequest(queryPictFormatsRequest(c), cookie) - return QueryPictFormatsCookie{cookie} -} - -// QueryPictFormatsUnchecked sends an unchecked request. +// Composite sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. -func QueryPictFormatsUnchecked(c *xgb.Conn) QueryPictFormatsCookie { +func Composite(c *xgb.Conn, Op byte, Src Picture, Mask Picture, Dst Picture, SrcX int16, SrcY int16, MaskX int16, MaskY int16, DstX int16, DstY int16, Width uint16, Height uint16) CompositeCookie { if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'QueryPictFormats' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + panic("Cannot issue request 'Composite' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } - cookie := c.NewCookie(false, true) - c.NewRequest(queryPictFormatsRequest(c), cookie) - return QueryPictFormatsCookie{cookie} -} - -// QueryPictFormatsReply represents the data returned from a QueryPictFormats request. -type QueryPictFormatsReply struct { - Sequence uint16 // sequence number of the request for this reply - Length uint32 // number of bytes in this reply - // padding: 1 bytes - NumFormats uint32 - NumScreens uint32 - NumDepths uint32 - NumVisuals uint32 - NumSubpixel uint32 - // padding: 4 bytes - Formats []Pictforminfo // size: xgb.Pad((int(NumFormats) * 28)) - Screens []Pictscreen // size: PictscreenListSize(Screens) - Subpixels []uint32 // size: xgb.Pad((int(NumSubpixel) * 4)) + cookie := c.NewCookie(false, false) + c.NewRequest(compositeRequest(c, Op, Src, Mask, Dst, SrcX, SrcY, MaskX, MaskY, DstX, DstY, Width, Height), cookie) + return CompositeCookie{cookie} } -// Reply blocks and returns the reply data for a QueryPictFormats request. -func (cook QueryPictFormatsCookie) Reply() (*QueryPictFormatsReply, error) { - buf, err := cook.Cookie.Reply() - if err != nil { - return nil, err - } - if buf == nil { - return nil, nil +// CompositeChecked sends a checked request. +// If an error occurs, it can be retrieved using CompositeCookie.Check() +func CompositeChecked(c *xgb.Conn, Op byte, Src Picture, Mask Picture, Dst Picture, SrcX int16, SrcY int16, MaskX int16, MaskY int16, DstX int16, DstY int16, Width uint16, Height uint16) CompositeCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'Composite' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } - return queryPictFormatsReply(buf), nil + cookie := c.NewCookie(true, false) + c.NewRequest(compositeRequest(c, Op, Src, Mask, Dst, SrcX, SrcY, MaskX, MaskY, DstX, DstY, Width, Height), cookie) + return CompositeCookie{cookie} } -// queryPictFormatsReply reads a byte slice into a QueryPictFormatsReply value. -func queryPictFormatsReply(buf []byte) *QueryPictFormatsReply { - v := new(QueryPictFormatsReply) - b := 1 // skip reply determinant +// 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 CompositeCookie) Check() error { + return cook.Cookie.Check() +} - b += 1 // padding +// Write request to wire for Composite +// compositeRequest writes a Composite request to a byte slice. +func compositeRequest(c *xgb.Conn, Op byte, Src Picture, Mask Picture, Dst Picture, SrcX int16, SrcY int16, MaskX int16, MaskY int16, DstX int16, DstY int16, Width uint16, Height uint16) []byte { + size := 36 + b := 0 + buf := make([]byte, size) - v.Sequence = xgb.Get16(buf[b:]) - b += 2 + buf[b] = c.Extensions["RENDER"] + b += 1 - v.Length = xgb.Get32(buf[b:]) // 4-byte units - b += 4 + buf[b] = 8 // request opcode + b += 1 - v.NumFormats = xgb.Get32(buf[b:]) - b += 4 + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 - v.NumScreens = xgb.Get32(buf[b:]) - b += 4 + buf[b] = Op + b += 1 - v.NumDepths = xgb.Get32(buf[b:]) - b += 4 + b += 3 // padding - v.NumVisuals = xgb.Get32(buf[b:]) + xgb.Put32(buf[b:], uint32(Src)) b += 4 - v.NumSubpixel = xgb.Get32(buf[b:]) + xgb.Put32(buf[b:], uint32(Mask)) b += 4 - b += 4 // padding + xgb.Put32(buf[b:], uint32(Dst)) + b += 4 - v.Formats = make([]Pictforminfo, v.NumFormats) - b += PictforminfoReadList(buf[b:], v.Formats) + xgb.Put16(buf[b:], uint16(SrcX)) + b += 2 - v.Screens = make([]Pictscreen, v.NumScreens) - b += PictscreenReadList(buf[b:], v.Screens) + xgb.Put16(buf[b:], uint16(SrcY)) + b += 2 - v.Subpixels = make([]uint32, v.NumSubpixel) - for i := 0; i < int(v.NumSubpixel); i++ { - v.Subpixels[i] = xgb.Get32(buf[b:]) - b += 4 - } - b = xgb.Pad(b) + xgb.Put16(buf[b:], uint16(MaskX)) + b += 2 - return v -} + xgb.Put16(buf[b:], uint16(MaskY)) + b += 2 -// Write request to wire for QueryPictFormats -// queryPictFormatsRequest writes a QueryPictFormats request to a byte slice. -func queryPictFormatsRequest(c *xgb.Conn) []byte { - size := 4 - b := 0 - buf := make([]byte, size) + xgb.Put16(buf[b:], uint16(DstX)) + b += 2 - buf[b] = c.Extensions["RENDER"] - b += 1 + xgb.Put16(buf[b:], uint16(DstY)) + b += 2 - buf[b] = 1 // request opcode - b += 1 + xgb.Put16(buf[b:], Width) + b += 2 - xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + xgb.Put16(buf[b:], Height) b += 2 return buf } -// QueryPictIndexValuesCookie is a cookie used only for QueryPictIndexValues requests. -type QueryPictIndexValuesCookie struct { +// CompositeGlyphs16Cookie is a cookie used only for CompositeGlyphs16 requests. +type CompositeGlyphs16Cookie struct { *xgb.Cookie } -// QueryPictIndexValues sends a checked request. -// If an error occurs, it will be returned with the reply by calling QueryPictIndexValuesCookie.Reply() -func QueryPictIndexValues(c *xgb.Conn, Format Pictformat) QueryPictIndexValuesCookie { +// CompositeGlyphs16 sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. +func CompositeGlyphs16(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) CompositeGlyphs16Cookie { if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'QueryPictIndexValues' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + panic("Cannot issue request 'CompositeGlyphs16' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } - cookie := c.NewCookie(true, true) - c.NewRequest(queryPictIndexValuesRequest(c, Format), cookie) - return QueryPictIndexValuesCookie{cookie} + cookie := c.NewCookie(false, false) + c.NewRequest(compositeGlyphs16Request(c, Op, Src, Dst, MaskFormat, Glyphset, SrcX, SrcY, Glyphcmds), cookie) + return CompositeGlyphs16Cookie{cookie} } -// QueryPictIndexValuesUnchecked sends an unchecked request. -// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. -func QueryPictIndexValuesUnchecked(c *xgb.Conn, Format Pictformat) QueryPictIndexValuesCookie { +// CompositeGlyphs16Checked sends a checked request. +// If an error occurs, it can be retrieved using CompositeGlyphs16Cookie.Check() +func CompositeGlyphs16Checked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) CompositeGlyphs16Cookie { if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'QueryPictIndexValues' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + panic("Cannot issue request 'CompositeGlyphs16' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } - cookie := c.NewCookie(false, true) - c.NewRequest(queryPictIndexValuesRequest(c, Format), cookie) - return QueryPictIndexValuesCookie{cookie} + cookie := c.NewCookie(true, false) + c.NewRequest(compositeGlyphs16Request(c, Op, Src, Dst, MaskFormat, Glyphset, SrcX, SrcY, Glyphcmds), cookie) + return CompositeGlyphs16Cookie{cookie} } -// QueryPictIndexValuesReply represents the data returned from a QueryPictIndexValues request. -type QueryPictIndexValuesReply struct { - Sequence uint16 // sequence number of the request for this reply - Length uint32 // number of bytes in this reply - // padding: 1 bytes - NumValues uint32 - // padding: 20 bytes - Values []Indexvalue // size: xgb.Pad((int(NumValues) * 12)) +// 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 CompositeGlyphs16Cookie) Check() error { + return cook.Cookie.Check() } -// Reply blocks and returns the reply data for a QueryPictIndexValues request. -func (cook QueryPictIndexValuesCookie) Reply() (*QueryPictIndexValuesReply, error) { - buf, err := cook.Cookie.Reply() - if err != nil { - return nil, err - } - if buf == nil { - return nil, nil - } - return queryPictIndexValuesReply(buf), nil -} +// Write request to wire for CompositeGlyphs16 +// compositeGlyphs16Request writes a CompositeGlyphs16 request to a byte slice. +func compositeGlyphs16Request(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) []byte { + size := xgb.Pad((28 + xgb.Pad((len(Glyphcmds) * 1)))) + b := 0 + buf := make([]byte, size) -// queryPictIndexValuesReply reads a byte slice into a QueryPictIndexValuesReply value. -func queryPictIndexValuesReply(buf []byte) *QueryPictIndexValuesReply { - v := new(QueryPictIndexValuesReply) - b := 1 // skip reply determinant + buf[b] = c.Extensions["RENDER"] + 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 - b += 4 - - v.NumValues = xgb.Get32(buf[b:]) - b += 4 + buf[b] = Op + b += 1 - b += 20 // padding + b += 3 // padding - v.Values = make([]Indexvalue, v.NumValues) - b += IndexvalueReadList(buf[b:], v.Values) + xgb.Put32(buf[b:], uint32(Src)) + b += 4 - return v -} + xgb.Put32(buf[b:], uint32(Dst)) + b += 4 -// Write request to wire for QueryPictIndexValues -// queryPictIndexValuesRequest writes a QueryPictIndexValues request to a byte slice. -func queryPictIndexValuesRequest(c *xgb.Conn, Format Pictformat) []byte { - size := 8 - b := 0 - buf := make([]byte, size) + xgb.Put32(buf[b:], uint32(MaskFormat)) + b += 4 - buf[b] = c.Extensions["RENDER"] - b += 1 + xgb.Put32(buf[b:], uint32(Glyphset)) + b += 4 - buf[b] = 2 // request opcode - b += 1 + xgb.Put16(buf[b:], uint16(SrcX)) + b += 2 - xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + xgb.Put16(buf[b:], uint16(SrcY)) b += 2 - xgb.Put32(buf[b:], uint32(Format)) - b += 4 + copy(buf[b:], Glyphcmds[:len(Glyphcmds)]) + b += xgb.Pad(int(len(Glyphcmds))) return buf } -// CreatePictureCookie is a cookie used only for CreatePicture requests. -type CreatePictureCookie struct { +// CompositeGlyphs32Cookie is a cookie used only for CompositeGlyphs32 requests. +type CompositeGlyphs32Cookie struct { *xgb.Cookie } -// CreatePicture sends an unchecked request. +// CompositeGlyphs32 sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. -func CreatePicture(c *xgb.Conn, Pid Picture, Drawable xproto.Drawable, Format Pictformat, ValueMask uint32, ValueList []uint32) CreatePictureCookie { +func CompositeGlyphs32(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) CompositeGlyphs32Cookie { if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'CreatePicture' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + panic("Cannot issue request 'CompositeGlyphs32' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } cookie := c.NewCookie(false, false) - c.NewRequest(createPictureRequest(c, Pid, Drawable, Format, ValueMask, ValueList), cookie) - return CreatePictureCookie{cookie} + c.NewRequest(compositeGlyphs32Request(c, Op, Src, Dst, MaskFormat, Glyphset, SrcX, SrcY, Glyphcmds), cookie) + return CompositeGlyphs32Cookie{cookie} } -// CreatePictureChecked sends a checked request. -// If an error occurs, it can be retrieved using CreatePictureCookie.Check() -func CreatePictureChecked(c *xgb.Conn, Pid Picture, Drawable xproto.Drawable, Format Pictformat, ValueMask uint32, ValueList []uint32) CreatePictureCookie { +// CompositeGlyphs32Checked sends a checked request. +// If an error occurs, it can be retrieved using CompositeGlyphs32Cookie.Check() +func CompositeGlyphs32Checked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) CompositeGlyphs32Cookie { if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'CreatePicture' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + panic("Cannot issue request 'CompositeGlyphs32' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } cookie := c.NewCookie(true, false) - c.NewRequest(createPictureRequest(c, Pid, Drawable, Format, ValueMask, ValueList), cookie) - return CreatePictureCookie{cookie} + c.NewRequest(compositeGlyphs32Request(c, Op, Src, Dst, MaskFormat, Glyphset, SrcX, SrcY, Glyphcmds), cookie) + return CompositeGlyphs32Cookie{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 CreatePictureCookie) Check() error { +func (cook CompositeGlyphs32Cookie) Check() error { return cook.Cookie.Check() } -// Write request to wire for CreatePicture -// createPictureRequest writes a CreatePicture request to a byte slice. -func createPictureRequest(c *xgb.Conn, Pid Picture, Drawable xproto.Drawable, Format Pictformat, ValueMask uint32, ValueList []uint32) []byte { - size := xgb.Pad((16 + (4 + xgb.Pad((4 * xgb.PopCount(int(ValueMask))))))) +// Write request to wire for CompositeGlyphs32 +// compositeGlyphs32Request writes a CompositeGlyphs32 request to a byte slice. +func compositeGlyphs32Request(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) []byte { + size := xgb.Pad((28 + xgb.Pad((len(Glyphcmds) * 1)))) b := 0 buf := make([]byte, size) buf[b] = c.Extensions["RENDER"] b += 1 - buf[b] = 4 // 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(Pid)) + buf[b] = Op + b += 1 + + b += 3 // padding + + xgb.Put32(buf[b:], uint32(Src)) b += 4 - xgb.Put32(buf[b:], uint32(Drawable)) + xgb.Put32(buf[b:], uint32(Dst)) b += 4 - xgb.Put32(buf[b:], uint32(Format)) + xgb.Put32(buf[b:], uint32(MaskFormat)) b += 4 - xgb.Put32(buf[b:], ValueMask) + xgb.Put32(buf[b:], uint32(Glyphset)) b += 4 - for i := 0; i < xgb.PopCount(int(ValueMask)); i++ { - xgb.Put32(buf[b:], ValueList[i]) - b += 4 - } - b = xgb.Pad(b) + + xgb.Put16(buf[b:], uint16(SrcX)) + b += 2 + + xgb.Put16(buf[b:], uint16(SrcY)) + b += 2 + + copy(buf[b:], Glyphcmds[:len(Glyphcmds)]) + b += xgb.Pad(int(len(Glyphcmds))) return buf } -// ChangePictureCookie is a cookie used only for ChangePicture requests. -type ChangePictureCookie struct { +// CompositeGlyphs8Cookie is a cookie used only for CompositeGlyphs8 requests. +type CompositeGlyphs8Cookie struct { *xgb.Cookie } -// ChangePicture sends an unchecked request. +// CompositeGlyphs8 sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. -func ChangePicture(c *xgb.Conn, Picture Picture, ValueMask uint32, ValueList []uint32) ChangePictureCookie { +func CompositeGlyphs8(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) CompositeGlyphs8Cookie { if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'ChangePicture' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + panic("Cannot issue request 'CompositeGlyphs8' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } cookie := c.NewCookie(false, false) - c.NewRequest(changePictureRequest(c, Picture, ValueMask, ValueList), cookie) - return ChangePictureCookie{cookie} + c.NewRequest(compositeGlyphs8Request(c, Op, Src, Dst, MaskFormat, Glyphset, SrcX, SrcY, Glyphcmds), cookie) + return CompositeGlyphs8Cookie{cookie} } -// ChangePictureChecked sends a checked request. -// If an error occurs, it can be retrieved using ChangePictureCookie.Check() -func ChangePictureChecked(c *xgb.Conn, Picture Picture, ValueMask uint32, ValueList []uint32) ChangePictureCookie { +// CompositeGlyphs8Checked sends a checked request. +// If an error occurs, it can be retrieved using CompositeGlyphs8Cookie.Check() +func CompositeGlyphs8Checked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) CompositeGlyphs8Cookie { if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'ChangePicture' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + panic("Cannot issue request 'CompositeGlyphs8' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } cookie := c.NewCookie(true, false) - c.NewRequest(changePictureRequest(c, Picture, ValueMask, ValueList), cookie) - return ChangePictureCookie{cookie} + c.NewRequest(compositeGlyphs8Request(c, Op, Src, Dst, MaskFormat, Glyphset, SrcX, SrcY, Glyphcmds), cookie) + return CompositeGlyphs8Cookie{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 ChangePictureCookie) Check() error { +func (cook CompositeGlyphs8Cookie) Check() error { return cook.Cookie.Check() } -// Write request to wire for ChangePicture -// changePictureRequest writes a ChangePicture request to a byte slice. -func changePictureRequest(c *xgb.Conn, Picture Picture, ValueMask uint32, ValueList []uint32) []byte { - size := xgb.Pad((8 + (4 + xgb.Pad((4 * xgb.PopCount(int(ValueMask))))))) +// Write request to wire for CompositeGlyphs8 +// compositeGlyphs8Request writes a CompositeGlyphs8 request to a byte slice. +func compositeGlyphs8Request(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) []byte { + size := xgb.Pad((28 + xgb.Pad((len(Glyphcmds) * 1)))) b := 0 buf := make([]byte, size) buf[b] = c.Extensions["RENDER"] b += 1 - buf[b] = 5 // request opcode + buf[b] = 23 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 - xgb.Put32(buf[b:], uint32(Picture)) + buf[b] = Op + b += 1 + + b += 3 // padding + + xgb.Put32(buf[b:], uint32(Src)) b += 4 - xgb.Put32(buf[b:], ValueMask) + xgb.Put32(buf[b:], uint32(Dst)) b += 4 - for i := 0; i < xgb.PopCount(int(ValueMask)); i++ { - xgb.Put32(buf[b:], ValueList[i]) - b += 4 - } - b = xgb.Pad(b) + + xgb.Put32(buf[b:], uint32(MaskFormat)) + b += 4 + + xgb.Put32(buf[b:], uint32(Glyphset)) + b += 4 + + xgb.Put16(buf[b:], uint16(SrcX)) + b += 2 + + xgb.Put16(buf[b:], uint16(SrcY)) + b += 2 + + copy(buf[b:], Glyphcmds[:len(Glyphcmds)]) + b += xgb.Pad(int(len(Glyphcmds))) return buf } -// SetPictureClipRectanglesCookie is a cookie used only for SetPictureClipRectangles requests. -type SetPictureClipRectanglesCookie struct { +// CreateAnimCursorCookie is a cookie used only for CreateAnimCursor requests. +type CreateAnimCursorCookie struct { *xgb.Cookie } -// SetPictureClipRectangles sends an unchecked request. +// CreateAnimCursor sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. -func SetPictureClipRectangles(c *xgb.Conn, Picture Picture, ClipXOrigin int16, ClipYOrigin int16, Rectangles []xproto.Rectangle) SetPictureClipRectanglesCookie { +func CreateAnimCursor(c *xgb.Conn, Cid xproto.Cursor, Cursors []Animcursorelt) CreateAnimCursorCookie { if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'SetPictureClipRectangles' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + panic("Cannot issue request 'CreateAnimCursor' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } cookie := c.NewCookie(false, false) - c.NewRequest(setPictureClipRectanglesRequest(c, Picture, ClipXOrigin, ClipYOrigin, Rectangles), cookie) - return SetPictureClipRectanglesCookie{cookie} + c.NewRequest(createAnimCursorRequest(c, Cid, Cursors), cookie) + return CreateAnimCursorCookie{cookie} } -// SetPictureClipRectanglesChecked sends a checked request. -// If an error occurs, it can be retrieved using SetPictureClipRectanglesCookie.Check() -func SetPictureClipRectanglesChecked(c *xgb.Conn, Picture Picture, ClipXOrigin int16, ClipYOrigin int16, Rectangles []xproto.Rectangle) SetPictureClipRectanglesCookie { +// CreateAnimCursorChecked sends a checked request. +// If an error occurs, it can be retrieved using CreateAnimCursorCookie.Check() +func CreateAnimCursorChecked(c *xgb.Conn, Cid xproto.Cursor, Cursors []Animcursorelt) CreateAnimCursorCookie { if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'SetPictureClipRectangles' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + panic("Cannot issue request 'CreateAnimCursor' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } cookie := c.NewCookie(true, false) - c.NewRequest(setPictureClipRectanglesRequest(c, Picture, ClipXOrigin, ClipYOrigin, Rectangles), cookie) - return SetPictureClipRectanglesCookie{cookie} + c.NewRequest(createAnimCursorRequest(c, Cid, Cursors), cookie) + return CreateAnimCursorCookie{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 SetPictureClipRectanglesCookie) Check() error { +func (cook CreateAnimCursorCookie) Check() error { return cook.Cookie.Check() } -// Write request to wire for SetPictureClipRectangles -// setPictureClipRectanglesRequest writes a SetPictureClipRectangles request to a byte slice. -func setPictureClipRectanglesRequest(c *xgb.Conn, Picture Picture, ClipXOrigin int16, ClipYOrigin int16, Rectangles []xproto.Rectangle) []byte { - size := xgb.Pad((12 + xgb.Pad((len(Rectangles) * 8)))) +// Write request to wire for CreateAnimCursor +// createAnimCursorRequest writes a CreateAnimCursor request to a byte slice. +func createAnimCursorRequest(c *xgb.Conn, Cid xproto.Cursor, Cursors []Animcursorelt) []byte { + size := xgb.Pad((8 + xgb.Pad((len(Cursors) * 8)))) b := 0 buf := make([]byte, size) buf[b] = c.Extensions["RENDER"] b += 1 - buf[b] = 6 // 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:], uint32(Picture)) + xgb.Put32(buf[b:], uint32(Cid)) b += 4 - xgb.Put16(buf[b:], uint16(ClipXOrigin)) - b += 2 - - xgb.Put16(buf[b:], uint16(ClipYOrigin)) - b += 2 - - b += xproto.RectangleListBytes(buf[b:], Rectangles) + b += AnimcursoreltListBytes(buf[b:], Cursors) return buf } -// FreePictureCookie is a cookie used only for FreePicture requests. -type FreePictureCookie struct { +// CreateConicalGradientCookie is a cookie used only for CreateConicalGradient requests. +type CreateConicalGradientCookie struct { *xgb.Cookie } -// FreePicture sends an unchecked request. +// CreateConicalGradient sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. -func FreePicture(c *xgb.Conn, Picture Picture) FreePictureCookie { +func CreateConicalGradient(c *xgb.Conn, Picture Picture, Center Pointfix, Angle Fixed, NumStops uint32, Stops []Fixed, Colors []Color) CreateConicalGradientCookie { if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'FreePicture' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + panic("Cannot issue request 'CreateConicalGradient' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } cookie := c.NewCookie(false, false) - c.NewRequest(freePictureRequest(c, Picture), cookie) - return FreePictureCookie{cookie} + c.NewRequest(createConicalGradientRequest(c, Picture, Center, Angle, NumStops, Stops, Colors), cookie) + return CreateConicalGradientCookie{cookie} } -// FreePictureChecked sends a checked request. -// If an error occurs, it can be retrieved using FreePictureCookie.Check() -func FreePictureChecked(c *xgb.Conn, Picture Picture) FreePictureCookie { +// CreateConicalGradientChecked sends a checked request. +// If an error occurs, it can be retrieved using CreateConicalGradientCookie.Check() +func CreateConicalGradientChecked(c *xgb.Conn, Picture Picture, Center Pointfix, Angle Fixed, NumStops uint32, Stops []Fixed, Colors []Color) CreateConicalGradientCookie { if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'FreePicture' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + panic("Cannot issue request 'CreateConicalGradient' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } cookie := c.NewCookie(true, false) - c.NewRequest(freePictureRequest(c, Picture), cookie) - return FreePictureCookie{cookie} + c.NewRequest(createConicalGradientRequest(c, Picture, Center, Angle, NumStops, Stops, Colors), cookie) + return CreateConicalGradientCookie{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 FreePictureCookie) Check() error { +func (cook CreateConicalGradientCookie) Check() error { return cook.Cookie.Check() } -// Write request to wire for FreePicture -// freePictureRequest writes a FreePicture request to a byte slice. -func freePictureRequest(c *xgb.Conn, Picture Picture) []byte { - size := 8 +// Write request to wire for CreateConicalGradient +// createConicalGradientRequest writes a CreateConicalGradient request to a byte slice. +func createConicalGradientRequest(c *xgb.Conn, Picture Picture, Center Pointfix, Angle Fixed, NumStops uint32, Stops []Fixed, Colors []Color) []byte { + size := xgb.Pad(((24 + xgb.Pad((int(NumStops) * 4))) + xgb.Pad((int(NumStops) * 8)))) b := 0 buf := make([]byte, size) buf[b] = c.Extensions["RENDER"] b += 1 - buf[b] = 7 // request opcode + buf[b] = 36 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units @@ -2137,508 +2205,508 @@ func freePictureRequest(c *xgb.Conn, Picture Picture) []byte { xgb.Put32(buf[b:], uint32(Picture)) b += 4 + { + structBytes := Center.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } + + xgb.Put32(buf[b:], uint32(Angle)) + b += 4 + + xgb.Put32(buf[b:], NumStops) + b += 4 + + for i := 0; i < int(NumStops); i++ { + xgb.Put32(buf[b:], uint32(Stops[i])) + b += 4 + } + b = xgb.Pad(b) + + b += ColorListBytes(buf[b:], Colors) + return buf } -// CompositeCookie is a cookie used only for Composite requests. -type CompositeCookie struct { +// CreateCursorCookie is a cookie used only for CreateCursor requests. +type CreateCursorCookie struct { *xgb.Cookie } -// Composite sends an unchecked request. +// CreateCursor sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. -func Composite(c *xgb.Conn, Op byte, Src Picture, Mask Picture, Dst Picture, SrcX int16, SrcY int16, MaskX int16, MaskY int16, DstX int16, DstY int16, Width uint16, Height uint16) CompositeCookie { +func CreateCursor(c *xgb.Conn, Cid xproto.Cursor, Source Picture, X uint16, Y uint16) CreateCursorCookie { if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'Composite' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + panic("Cannot issue request 'CreateCursor' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } cookie := c.NewCookie(false, false) - c.NewRequest(compositeRequest(c, Op, Src, Mask, Dst, SrcX, SrcY, MaskX, MaskY, DstX, DstY, Width, Height), cookie) - return CompositeCookie{cookie} + c.NewRequest(createCursorRequest(c, Cid, Source, X, Y), cookie) + return CreateCursorCookie{cookie} } -// CompositeChecked sends a checked request. -// If an error occurs, it can be retrieved using CompositeCookie.Check() -func CompositeChecked(c *xgb.Conn, Op byte, Src Picture, Mask Picture, Dst Picture, SrcX int16, SrcY int16, MaskX int16, MaskY int16, DstX int16, DstY int16, Width uint16, Height uint16) CompositeCookie { +// CreateCursorChecked sends a checked request. +// If an error occurs, it can be retrieved using CreateCursorCookie.Check() +func CreateCursorChecked(c *xgb.Conn, Cid xproto.Cursor, Source Picture, X uint16, Y uint16) CreateCursorCookie { if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'Composite' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + panic("Cannot issue request 'CreateCursor' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } cookie := c.NewCookie(true, false) - c.NewRequest(compositeRequest(c, Op, Src, Mask, Dst, SrcX, SrcY, MaskX, MaskY, DstX, DstY, Width, Height), cookie) - return CompositeCookie{cookie} + c.NewRequest(createCursorRequest(c, Cid, Source, X, Y), cookie) + return CreateCursorCookie{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 CompositeCookie) Check() error { +func (cook CreateCursorCookie) Check() error { return cook.Cookie.Check() } -// Write request to wire for Composite -// compositeRequest writes a Composite request to a byte slice. -func compositeRequest(c *xgb.Conn, Op byte, Src Picture, Mask Picture, Dst Picture, SrcX int16, SrcY int16, MaskX int16, MaskY int16, DstX int16, DstY int16, Width uint16, Height uint16) []byte { - size := 36 +// Write request to wire for CreateCursor +// createCursorRequest writes a CreateCursor request to a byte slice. +func createCursorRequest(c *xgb.Conn, Cid xproto.Cursor, Source Picture, X uint16, Y uint16) []byte { + size := 16 b := 0 buf := make([]byte, size) buf[b] = c.Extensions["RENDER"] b += 1 - buf[b] = 8 // request opcode + buf[b] = 27 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 - buf[b] = Op - b += 1 - - b += 3 // padding - - xgb.Put32(buf[b:], uint32(Src)) - b += 4 - - xgb.Put32(buf[b:], uint32(Mask)) + xgb.Put32(buf[b:], uint32(Cid)) b += 4 - xgb.Put32(buf[b:], uint32(Dst)) + xgb.Put32(buf[b:], uint32(Source)) b += 4 - xgb.Put16(buf[b:], uint16(SrcX)) - b += 2 - - xgb.Put16(buf[b:], uint16(SrcY)) - b += 2 - - xgb.Put16(buf[b:], uint16(MaskX)) - b += 2 - - xgb.Put16(buf[b:], uint16(MaskY)) - b += 2 - - xgb.Put16(buf[b:], uint16(DstX)) - b += 2 - - xgb.Put16(buf[b:], uint16(DstY)) - b += 2 - - xgb.Put16(buf[b:], Width) + xgb.Put16(buf[b:], X) b += 2 - xgb.Put16(buf[b:], Height) + xgb.Put16(buf[b:], Y) b += 2 return buf } -// TrapezoidsCookie is a cookie used only for Trapezoids requests. -type TrapezoidsCookie struct { +// CreateGlyphSetCookie is a cookie used only for CreateGlyphSet requests. +type CreateGlyphSetCookie struct { *xgb.Cookie } -// Trapezoids sends an unchecked request. +// CreateGlyphSet sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. -func Trapezoids(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Traps []Trapezoid) TrapezoidsCookie { +func CreateGlyphSet(c *xgb.Conn, Gsid Glyphset, Format Pictformat) CreateGlyphSetCookie { if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'Trapezoids' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + panic("Cannot issue request 'CreateGlyphSet' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } cookie := c.NewCookie(false, false) - c.NewRequest(trapezoidsRequest(c, Op, Src, Dst, MaskFormat, SrcX, SrcY, Traps), cookie) - return TrapezoidsCookie{cookie} + c.NewRequest(createGlyphSetRequest(c, Gsid, Format), cookie) + return CreateGlyphSetCookie{cookie} } -// TrapezoidsChecked sends a checked request. -// If an error occurs, it can be retrieved using TrapezoidsCookie.Check() -func TrapezoidsChecked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Traps []Trapezoid) TrapezoidsCookie { +// CreateGlyphSetChecked sends a checked request. +// If an error occurs, it can be retrieved using CreateGlyphSetCookie.Check() +func CreateGlyphSetChecked(c *xgb.Conn, Gsid Glyphset, Format Pictformat) CreateGlyphSetCookie { if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'Trapezoids' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + panic("Cannot issue request 'CreateGlyphSet' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } cookie := c.NewCookie(true, false) - c.NewRequest(trapezoidsRequest(c, Op, Src, Dst, MaskFormat, SrcX, SrcY, Traps), cookie) - return TrapezoidsCookie{cookie} + c.NewRequest(createGlyphSetRequest(c, Gsid, Format), cookie) + return CreateGlyphSetCookie{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 TrapezoidsCookie) Check() error { +func (cook CreateGlyphSetCookie) Check() error { return cook.Cookie.Check() } -// Write request to wire for Trapezoids -// trapezoidsRequest writes a Trapezoids request to a byte slice. -func trapezoidsRequest(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Traps []Trapezoid) []byte { - size := xgb.Pad((24 + xgb.Pad((len(Traps) * 40)))) +// Write request to wire for CreateGlyphSet +// createGlyphSetRequest writes a CreateGlyphSet request to a byte slice. +func createGlyphSetRequest(c *xgb.Conn, Gsid Glyphset, Format Pictformat) []byte { + size := 12 b := 0 buf := make([]byte, size) buf[b] = c.Extensions["RENDER"] b += 1 - buf[b] = 10 // 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 - buf[b] = Op - b += 1 - - b += 3 // padding - - xgb.Put32(buf[b:], uint32(Src)) - b += 4 - - xgb.Put32(buf[b:], uint32(Dst)) + xgb.Put32(buf[b:], uint32(Gsid)) b += 4 - xgb.Put32(buf[b:], uint32(MaskFormat)) + xgb.Put32(buf[b:], uint32(Format)) b += 4 - xgb.Put16(buf[b:], uint16(SrcX)) - b += 2 - - xgb.Put16(buf[b:], uint16(SrcY)) - b += 2 - - b += TrapezoidListBytes(buf[b:], Traps) - return buf } -// TrianglesCookie is a cookie used only for Triangles requests. -type TrianglesCookie struct { +// CreateLinearGradientCookie is a cookie used only for CreateLinearGradient requests. +type CreateLinearGradientCookie struct { *xgb.Cookie } -// Triangles sends an unchecked request. +// CreateLinearGradient sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. -func Triangles(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Triangles []Triangle) TrianglesCookie { +func CreateLinearGradient(c *xgb.Conn, Picture Picture, P1 Pointfix, P2 Pointfix, NumStops uint32, Stops []Fixed, Colors []Color) CreateLinearGradientCookie { if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'Triangles' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + panic("Cannot issue request 'CreateLinearGradient' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } cookie := c.NewCookie(false, false) - c.NewRequest(trianglesRequest(c, Op, Src, Dst, MaskFormat, SrcX, SrcY, Triangles), cookie) - return TrianglesCookie{cookie} + c.NewRequest(createLinearGradientRequest(c, Picture, P1, P2, NumStops, Stops, Colors), cookie) + return CreateLinearGradientCookie{cookie} } -// TrianglesChecked sends a checked request. -// If an error occurs, it can be retrieved using TrianglesCookie.Check() -func TrianglesChecked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Triangles []Triangle) TrianglesCookie { +// CreateLinearGradientChecked sends a checked request. +// If an error occurs, it can be retrieved using CreateLinearGradientCookie.Check() +func CreateLinearGradientChecked(c *xgb.Conn, Picture Picture, P1 Pointfix, P2 Pointfix, NumStops uint32, Stops []Fixed, Colors []Color) CreateLinearGradientCookie { if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'Triangles' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + panic("Cannot issue request 'CreateLinearGradient' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } cookie := c.NewCookie(true, false) - c.NewRequest(trianglesRequest(c, Op, Src, Dst, MaskFormat, SrcX, SrcY, Triangles), cookie) - return TrianglesCookie{cookie} + c.NewRequest(createLinearGradientRequest(c, Picture, P1, P2, NumStops, Stops, Colors), cookie) + return CreateLinearGradientCookie{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 TrianglesCookie) Check() error { +func (cook CreateLinearGradientCookie) Check() error { return cook.Cookie.Check() } -// Write request to wire for Triangles -// trianglesRequest writes a Triangles request to a byte slice. -func trianglesRequest(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Triangles []Triangle) []byte { - size := xgb.Pad((24 + xgb.Pad((len(Triangles) * 24)))) +// Write request to wire for CreateLinearGradient +// createLinearGradientRequest writes a CreateLinearGradient request to a byte slice. +func createLinearGradientRequest(c *xgb.Conn, Picture Picture, P1 Pointfix, P2 Pointfix, NumStops uint32, Stops []Fixed, Colors []Color) []byte { + size := xgb.Pad(((28 + xgb.Pad((int(NumStops) * 4))) + xgb.Pad((int(NumStops) * 8)))) b := 0 buf := make([]byte, size) buf[b] = c.Extensions["RENDER"] b += 1 - buf[b] = 11 // 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 - buf[b] = Op - b += 1 - - b += 3 // padding - - xgb.Put32(buf[b:], uint32(Src)) + xgb.Put32(buf[b:], uint32(Picture)) b += 4 - xgb.Put32(buf[b:], uint32(Dst)) - b += 4 + { + structBytes := P1.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } - xgb.Put32(buf[b:], uint32(MaskFormat)) - b += 4 + { + structBytes := P2.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } - xgb.Put16(buf[b:], uint16(SrcX)) - b += 2 + xgb.Put32(buf[b:], NumStops) + b += 4 - xgb.Put16(buf[b:], uint16(SrcY)) - b += 2 + for i := 0; i < int(NumStops); i++ { + xgb.Put32(buf[b:], uint32(Stops[i])) + b += 4 + } + b = xgb.Pad(b) - b += TriangleListBytes(buf[b:], Triangles) + b += ColorListBytes(buf[b:], Colors) return buf } -// TriStripCookie is a cookie used only for TriStrip requests. -type TriStripCookie struct { +// CreatePictureCookie is a cookie used only for CreatePicture requests. +type CreatePictureCookie struct { *xgb.Cookie } -// TriStrip sends an unchecked request. +// CreatePicture sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. -func TriStrip(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Points []Pointfix) TriStripCookie { +func CreatePicture(c *xgb.Conn, Pid Picture, Drawable xproto.Drawable, Format Pictformat, ValueMask uint32, ValueList []uint32) CreatePictureCookie { if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'TriStrip' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + panic("Cannot issue request 'CreatePicture' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } cookie := c.NewCookie(false, false) - c.NewRequest(triStripRequest(c, Op, Src, Dst, MaskFormat, SrcX, SrcY, Points), cookie) - return TriStripCookie{cookie} + c.NewRequest(createPictureRequest(c, Pid, Drawable, Format, ValueMask, ValueList), cookie) + return CreatePictureCookie{cookie} } -// TriStripChecked sends a checked request. -// If an error occurs, it can be retrieved using TriStripCookie.Check() -func TriStripChecked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Points []Pointfix) TriStripCookie { +// CreatePictureChecked sends a checked request. +// If an error occurs, it can be retrieved using CreatePictureCookie.Check() +func CreatePictureChecked(c *xgb.Conn, Pid Picture, Drawable xproto.Drawable, Format Pictformat, ValueMask uint32, ValueList []uint32) CreatePictureCookie { if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'TriStrip' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + panic("Cannot issue request 'CreatePicture' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } cookie := c.NewCookie(true, false) - c.NewRequest(triStripRequest(c, Op, Src, Dst, MaskFormat, SrcX, SrcY, Points), cookie) - return TriStripCookie{cookie} + c.NewRequest(createPictureRequest(c, Pid, Drawable, Format, ValueMask, ValueList), cookie) + return CreatePictureCookie{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 TriStripCookie) Check() error { +func (cook CreatePictureCookie) Check() error { return cook.Cookie.Check() } -// Write request to wire for TriStrip -// triStripRequest writes a TriStrip request to a byte slice. -func triStripRequest(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Points []Pointfix) []byte { - size := xgb.Pad((24 + xgb.Pad((len(Points) * 8)))) +// Write request to wire for CreatePicture +// createPictureRequest writes a CreatePicture request to a byte slice. +func createPictureRequest(c *xgb.Conn, Pid Picture, Drawable xproto.Drawable, Format Pictformat, ValueMask uint32, ValueList []uint32) []byte { + size := xgb.Pad((16 + (4 + xgb.Pad((4 * xgb.PopCount(int(ValueMask))))))) b := 0 buf := make([]byte, size) buf[b] = c.Extensions["RENDER"] b += 1 - buf[b] = 12 // request opcode + buf[b] = 4 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 - buf[b] = Op - b += 1 - - b += 3 // padding - - xgb.Put32(buf[b:], uint32(Src)) + xgb.Put32(buf[b:], uint32(Pid)) b += 4 - xgb.Put32(buf[b:], uint32(Dst)) + xgb.Put32(buf[b:], uint32(Drawable)) b += 4 - xgb.Put32(buf[b:], uint32(MaskFormat)) + xgb.Put32(buf[b:], uint32(Format)) b += 4 - xgb.Put16(buf[b:], uint16(SrcX)) - b += 2 - - xgb.Put16(buf[b:], uint16(SrcY)) - b += 2 - - b += PointfixListBytes(buf[b:], Points) + xgb.Put32(buf[b:], ValueMask) + b += 4 + for i := 0; i < xgb.PopCount(int(ValueMask)); i++ { + xgb.Put32(buf[b:], ValueList[i]) + b += 4 + } + b = xgb.Pad(b) return buf } -// TriFanCookie is a cookie used only for TriFan requests. -type TriFanCookie struct { +// CreateRadialGradientCookie is a cookie used only for CreateRadialGradient requests. +type CreateRadialGradientCookie struct { *xgb.Cookie } -// TriFan sends an unchecked request. +// CreateRadialGradient sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. -func TriFan(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Points []Pointfix) TriFanCookie { +func CreateRadialGradient(c *xgb.Conn, Picture Picture, Inner Pointfix, Outer Pointfix, InnerRadius Fixed, OuterRadius Fixed, NumStops uint32, Stops []Fixed, Colors []Color) CreateRadialGradientCookie { if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'TriFan' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + panic("Cannot issue request 'CreateRadialGradient' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } cookie := c.NewCookie(false, false) - c.NewRequest(triFanRequest(c, Op, Src, Dst, MaskFormat, SrcX, SrcY, Points), cookie) - return TriFanCookie{cookie} + c.NewRequest(createRadialGradientRequest(c, Picture, Inner, Outer, InnerRadius, OuterRadius, NumStops, Stops, Colors), cookie) + return CreateRadialGradientCookie{cookie} } -// TriFanChecked sends a checked request. -// If an error occurs, it can be retrieved using TriFanCookie.Check() -func TriFanChecked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Points []Pointfix) TriFanCookie { +// CreateRadialGradientChecked sends a checked request. +// If an error occurs, it can be retrieved using CreateRadialGradientCookie.Check() +func CreateRadialGradientChecked(c *xgb.Conn, Picture Picture, Inner Pointfix, Outer Pointfix, InnerRadius Fixed, OuterRadius Fixed, NumStops uint32, Stops []Fixed, Colors []Color) CreateRadialGradientCookie { if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'TriFan' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + panic("Cannot issue request 'CreateRadialGradient' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } cookie := c.NewCookie(true, false) - c.NewRequest(triFanRequest(c, Op, Src, Dst, MaskFormat, SrcX, SrcY, Points), cookie) - return TriFanCookie{cookie} + c.NewRequest(createRadialGradientRequest(c, Picture, Inner, Outer, InnerRadius, OuterRadius, NumStops, Stops, Colors), cookie) + return CreateRadialGradientCookie{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 TriFanCookie) Check() error { +func (cook CreateRadialGradientCookie) Check() error { return cook.Cookie.Check() } -// Write request to wire for TriFan -// triFanRequest writes a TriFan request to a byte slice. -func triFanRequest(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Points []Pointfix) []byte { - size := xgb.Pad((24 + xgb.Pad((len(Points) * 8)))) +// Write request to wire for CreateRadialGradient +// createRadialGradientRequest writes a CreateRadialGradient request to a byte slice. +func createRadialGradientRequest(c *xgb.Conn, Picture Picture, Inner Pointfix, Outer Pointfix, InnerRadius Fixed, OuterRadius Fixed, NumStops uint32, Stops []Fixed, Colors []Color) []byte { + size := xgb.Pad(((36 + xgb.Pad((int(NumStops) * 4))) + xgb.Pad((int(NumStops) * 8)))) b := 0 buf := make([]byte, size) buf[b] = c.Extensions["RENDER"] b += 1 - buf[b] = 13 // 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 - buf[b] = Op - b += 1 + xgb.Put32(buf[b:], uint32(Picture)) + b += 4 - b += 3 // padding + { + structBytes := Inner.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } - xgb.Put32(buf[b:], uint32(Src)) - b += 4 + { + structBytes := Outer.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } - xgb.Put32(buf[b:], uint32(Dst)) + xgb.Put32(buf[b:], uint32(InnerRadius)) b += 4 - xgb.Put32(buf[b:], uint32(MaskFormat)) + xgb.Put32(buf[b:], uint32(OuterRadius)) b += 4 - xgb.Put16(buf[b:], uint16(SrcX)) - b += 2 + xgb.Put32(buf[b:], NumStops) + b += 4 - xgb.Put16(buf[b:], uint16(SrcY)) - b += 2 + for i := 0; i < int(NumStops); i++ { + xgb.Put32(buf[b:], uint32(Stops[i])) + b += 4 + } + b = xgb.Pad(b) - b += PointfixListBytes(buf[b:], Points) + b += ColorListBytes(buf[b:], Colors) return buf } -// CreateGlyphSetCookie is a cookie used only for CreateGlyphSet requests. -type CreateGlyphSetCookie struct { +// CreateSolidFillCookie is a cookie used only for CreateSolidFill requests. +type CreateSolidFillCookie struct { *xgb.Cookie } -// CreateGlyphSet sends an unchecked request. +// CreateSolidFill sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. -func CreateGlyphSet(c *xgb.Conn, Gsid Glyphset, Format Pictformat) CreateGlyphSetCookie { +func CreateSolidFill(c *xgb.Conn, Picture Picture, Color Color) CreateSolidFillCookie { if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'CreateGlyphSet' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + panic("Cannot issue request 'CreateSolidFill' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } cookie := c.NewCookie(false, false) - c.NewRequest(createGlyphSetRequest(c, Gsid, Format), cookie) - return CreateGlyphSetCookie{cookie} + c.NewRequest(createSolidFillRequest(c, Picture, Color), cookie) + return CreateSolidFillCookie{cookie} } -// CreateGlyphSetChecked sends a checked request. -// If an error occurs, it can be retrieved using CreateGlyphSetCookie.Check() -func CreateGlyphSetChecked(c *xgb.Conn, Gsid Glyphset, Format Pictformat) CreateGlyphSetCookie { +// CreateSolidFillChecked sends a checked request. +// If an error occurs, it can be retrieved using CreateSolidFillCookie.Check() +func CreateSolidFillChecked(c *xgb.Conn, Picture Picture, Color Color) CreateSolidFillCookie { if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'CreateGlyphSet' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + panic("Cannot issue request 'CreateSolidFill' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } cookie := c.NewCookie(true, false) - c.NewRequest(createGlyphSetRequest(c, Gsid, Format), cookie) - return CreateGlyphSetCookie{cookie} + c.NewRequest(createSolidFillRequest(c, Picture, Color), cookie) + return CreateSolidFillCookie{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 CreateGlyphSetCookie) Check() error { +func (cook CreateSolidFillCookie) Check() error { return cook.Cookie.Check() } -// Write request to wire for CreateGlyphSet -// createGlyphSetRequest writes a CreateGlyphSet request to a byte slice. -func createGlyphSetRequest(c *xgb.Conn, Gsid Glyphset, Format Pictformat) []byte { - size := 12 +// Write request to wire for CreateSolidFill +// createSolidFillRequest writes a CreateSolidFill request to a byte slice. +func createSolidFillRequest(c *xgb.Conn, Picture Picture, Color Color) []byte { + size := 16 b := 0 buf := make([]byte, size) buf[b] = c.Extensions["RENDER"] b += 1 - buf[b] = 17 // 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(Gsid)) + xgb.Put32(buf[b:], uint32(Picture)) b += 4 - xgb.Put32(buf[b:], uint32(Format)) - b += 4 + { + structBytes := Color.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } return buf } -// ReferenceGlyphSetCookie is a cookie used only for ReferenceGlyphSet requests. -type ReferenceGlyphSetCookie struct { +// FillRectanglesCookie is a cookie used only for FillRectangles requests. +type FillRectanglesCookie struct { *xgb.Cookie } -// ReferenceGlyphSet sends an unchecked request. +// FillRectangles sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. -func ReferenceGlyphSet(c *xgb.Conn, Gsid Glyphset, Existing Glyphset) ReferenceGlyphSetCookie { +func FillRectangles(c *xgb.Conn, Op byte, Dst Picture, Color Color, Rects []xproto.Rectangle) FillRectanglesCookie { if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'ReferenceGlyphSet' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + panic("Cannot issue request 'FillRectangles' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } cookie := c.NewCookie(false, false) - c.NewRequest(referenceGlyphSetRequest(c, Gsid, Existing), cookie) - return ReferenceGlyphSetCookie{cookie} + c.NewRequest(fillRectanglesRequest(c, Op, Dst, Color, Rects), cookie) + return FillRectanglesCookie{cookie} } -// ReferenceGlyphSetChecked sends a checked request. -// If an error occurs, it can be retrieved using ReferenceGlyphSetCookie.Check() -func ReferenceGlyphSetChecked(c *xgb.Conn, Gsid Glyphset, Existing Glyphset) ReferenceGlyphSetCookie { +// FillRectanglesChecked sends a checked request. +// If an error occurs, it can be retrieved using FillRectanglesCookie.Check() +func FillRectanglesChecked(c *xgb.Conn, Op byte, Dst Picture, Color Color, Rects []xproto.Rectangle) FillRectanglesCookie { if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'ReferenceGlyphSet' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + panic("Cannot issue request 'FillRectangles' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } cookie := c.NewCookie(true, false) - c.NewRequest(referenceGlyphSetRequest(c, Gsid, Existing), cookie) - return ReferenceGlyphSetCookie{cookie} + c.NewRequest(fillRectanglesRequest(c, Op, Dst, Color, Rects), cookie) + return FillRectanglesCookie{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 ReferenceGlyphSetCookie) Check() error { +func (cook FillRectanglesCookie) Check() error { return cook.Cookie.Check() } -// Write request to wire for ReferenceGlyphSet -// referenceGlyphSetRequest writes a ReferenceGlyphSet request to a byte slice. -func referenceGlyphSetRequest(c *xgb.Conn, Gsid Glyphset, Existing Glyphset) []byte { - size := 12 +// Write request to wire for FillRectangles +// fillRectanglesRequest writes a FillRectangles request to a byte slice. +func fillRectanglesRequest(c *xgb.Conn, Op byte, Dst Picture, Color Color, Rects []xproto.Rectangle) []byte { + size := xgb.Pad((20 + xgb.Pad((len(Rects) * 8)))) b := 0 buf := make([]byte, size) buf[b] = c.Extensions["RENDER"] b += 1 - buf[b] = 18 // 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(Gsid)) - b += 4 + buf[b] = Op + b += 1 - xgb.Put32(buf[b:], uint32(Existing)) + b += 3 // padding + + xgb.Put32(buf[b:], uint32(Dst)) b += 4 + { + structBytes := Color.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } + + b += xproto.RectangleListBytes(buf[b:], Rects) + return buf } @@ -2697,75 +2765,6 @@ func freeGlyphSetRequest(c *xgb.Conn, Glyphset Glyphset) []byte { return buf } -// AddGlyphsCookie is a cookie used only for AddGlyphs requests. -type AddGlyphsCookie struct { - *xgb.Cookie -} - -// AddGlyphs sends an unchecked request. -// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. -func AddGlyphs(c *xgb.Conn, Glyphset Glyphset, GlyphsLen uint32, Glyphids []uint32, Glyphs []Glyphinfo, Data []byte) AddGlyphsCookie { - if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'AddGlyphs' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") - } - cookie := c.NewCookie(false, false) - c.NewRequest(addGlyphsRequest(c, Glyphset, GlyphsLen, Glyphids, Glyphs, Data), cookie) - return AddGlyphsCookie{cookie} -} - -// AddGlyphsChecked sends a checked request. -// If an error occurs, it can be retrieved using AddGlyphsCookie.Check() -func AddGlyphsChecked(c *xgb.Conn, Glyphset Glyphset, GlyphsLen uint32, Glyphids []uint32, Glyphs []Glyphinfo, Data []byte) AddGlyphsCookie { - if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'AddGlyphs' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") - } - cookie := c.NewCookie(true, false) - c.NewRequest(addGlyphsRequest(c, Glyphset, GlyphsLen, Glyphids, Glyphs, Data), cookie) - return AddGlyphsCookie{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 AddGlyphsCookie) Check() error { - return cook.Cookie.Check() -} - -// Write request to wire for AddGlyphs -// addGlyphsRequest writes a AddGlyphs request to a byte slice. -func addGlyphsRequest(c *xgb.Conn, Glyphset Glyphset, GlyphsLen uint32, Glyphids []uint32, Glyphs []Glyphinfo, Data []byte) []byte { - size := xgb.Pad((((12 + xgb.Pad((int(GlyphsLen) * 4))) + xgb.Pad((int(GlyphsLen) * 12))) + xgb.Pad((len(Data) * 1)))) - b := 0 - buf := make([]byte, size) - - buf[b] = c.Extensions["RENDER"] - b += 1 - - buf[b] = 20 // request opcode - b += 1 - - xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units - b += 2 - - xgb.Put32(buf[b:], uint32(Glyphset)) - b += 4 - - xgb.Put32(buf[b:], GlyphsLen) - b += 4 - - for i := 0; i < int(GlyphsLen); i++ { - xgb.Put32(buf[b:], Glyphids[i]) - b += 4 - } - b = xgb.Pad(b) - - b += GlyphinfoListBytes(buf[b:], Glyphs) - - copy(buf[b:], Data[:len(Data)]) - b += xgb.Pad(int(len(Data))) - - return buf -} - // FreeGlyphsCookie is a cookie used only for FreeGlyphs requests. type FreeGlyphsCookie struct { *xgb.Cookie @@ -2827,537 +2826,599 @@ func freeGlyphsRequest(c *xgb.Conn, Glyphset Glyphset, Glyphs []Glyph) []byte { return buf } -// CompositeGlyphs8Cookie is a cookie used only for CompositeGlyphs8 requests. -type CompositeGlyphs8Cookie struct { - *xgb.Cookie -} - -// CompositeGlyphs8 sends an unchecked request. -// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. -func CompositeGlyphs8(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) CompositeGlyphs8Cookie { - if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'CompositeGlyphs8' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") - } - cookie := c.NewCookie(false, false) - c.NewRequest(compositeGlyphs8Request(c, Op, Src, Dst, MaskFormat, Glyphset, SrcX, SrcY, Glyphcmds), cookie) - return CompositeGlyphs8Cookie{cookie} -} - -// CompositeGlyphs8Checked sends a checked request. -// If an error occurs, it can be retrieved using CompositeGlyphs8Cookie.Check() -func CompositeGlyphs8Checked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) CompositeGlyphs8Cookie { - if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'CompositeGlyphs8' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") - } - cookie := c.NewCookie(true, false) - c.NewRequest(compositeGlyphs8Request(c, Op, Src, Dst, MaskFormat, Glyphset, SrcX, SrcY, Glyphcmds), cookie) - return CompositeGlyphs8Cookie{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 CompositeGlyphs8Cookie) Check() error { - return cook.Cookie.Check() -} - -// Write request to wire for CompositeGlyphs8 -// compositeGlyphs8Request writes a CompositeGlyphs8 request to a byte slice. -func compositeGlyphs8Request(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) []byte { - size := xgb.Pad((28 + xgb.Pad((len(Glyphcmds) * 1)))) - b := 0 - buf := make([]byte, size) - - buf[b] = c.Extensions["RENDER"] - b += 1 - - buf[b] = 23 // request opcode - b += 1 - - xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units - b += 2 - - buf[b] = Op - b += 1 - - b += 3 // padding - - xgb.Put32(buf[b:], uint32(Src)) - b += 4 - - xgb.Put32(buf[b:], uint32(Dst)) - b += 4 - - xgb.Put32(buf[b:], uint32(MaskFormat)) - b += 4 - - xgb.Put32(buf[b:], uint32(Glyphset)) - b += 4 - - xgb.Put16(buf[b:], uint16(SrcX)) - b += 2 - - xgb.Put16(buf[b:], uint16(SrcY)) - b += 2 - - copy(buf[b:], Glyphcmds[:len(Glyphcmds)]) - b += xgb.Pad(int(len(Glyphcmds))) - - return buf -} - -// CompositeGlyphs16Cookie is a cookie used only for CompositeGlyphs16 requests. -type CompositeGlyphs16Cookie struct { +// FreePictureCookie is a cookie used only for FreePicture requests. +type FreePictureCookie struct { *xgb.Cookie } -// CompositeGlyphs16 sends an unchecked request. +// FreePicture sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. -func CompositeGlyphs16(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) CompositeGlyphs16Cookie { +func FreePicture(c *xgb.Conn, Picture Picture) FreePictureCookie { if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'CompositeGlyphs16' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + panic("Cannot issue request 'FreePicture' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } cookie := c.NewCookie(false, false) - c.NewRequest(compositeGlyphs16Request(c, Op, Src, Dst, MaskFormat, Glyphset, SrcX, SrcY, Glyphcmds), cookie) - return CompositeGlyphs16Cookie{cookie} + c.NewRequest(freePictureRequest(c, Picture), cookie) + return FreePictureCookie{cookie} } -// CompositeGlyphs16Checked sends a checked request. -// If an error occurs, it can be retrieved using CompositeGlyphs16Cookie.Check() -func CompositeGlyphs16Checked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) CompositeGlyphs16Cookie { +// FreePictureChecked sends a checked request. +// If an error occurs, it can be retrieved using FreePictureCookie.Check() +func FreePictureChecked(c *xgb.Conn, Picture Picture) FreePictureCookie { if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'CompositeGlyphs16' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + panic("Cannot issue request 'FreePicture' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } cookie := c.NewCookie(true, false) - c.NewRequest(compositeGlyphs16Request(c, Op, Src, Dst, MaskFormat, Glyphset, SrcX, SrcY, Glyphcmds), cookie) - return CompositeGlyphs16Cookie{cookie} + c.NewRequest(freePictureRequest(c, Picture), cookie) + return FreePictureCookie{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 CompositeGlyphs16Cookie) Check() error { +func (cook FreePictureCookie) Check() error { return cook.Cookie.Check() } -// Write request to wire for CompositeGlyphs16 -// compositeGlyphs16Request writes a CompositeGlyphs16 request to a byte slice. -func compositeGlyphs16Request(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) []byte { - size := xgb.Pad((28 + xgb.Pad((len(Glyphcmds) * 1)))) +// Write request to wire for FreePicture +// freePictureRequest writes a FreePicture request to a byte slice. +func freePictureRequest(c *xgb.Conn, Picture Picture) []byte { + size := 8 b := 0 buf := make([]byte, size) buf[b] = c.Extensions["RENDER"] b += 1 - buf[b] = 24 // 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 - buf[b] = Op - b += 1 + xgb.Put32(buf[b:], uint32(Picture)) + b += 4 - b += 3 // padding + return buf +} - xgb.Put32(buf[b:], uint32(Src)) - b += 4 +// QueryFiltersCookie is a cookie used only for QueryFilters requests. +type QueryFiltersCookie struct { + *xgb.Cookie +} - xgb.Put32(buf[b:], uint32(Dst)) +// QueryFilters sends a checked request. +// If an error occurs, it will be returned with the reply by calling QueryFiltersCookie.Reply() +func QueryFilters(c *xgb.Conn, Drawable xproto.Drawable) QueryFiltersCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'QueryFilters' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } + cookie := c.NewCookie(true, true) + c.NewRequest(queryFiltersRequest(c, Drawable), cookie) + return QueryFiltersCookie{cookie} +} + +// QueryFiltersUnchecked sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. +func QueryFiltersUnchecked(c *xgb.Conn, Drawable xproto.Drawable) QueryFiltersCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'QueryFilters' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + } + cookie := c.NewCookie(false, true) + c.NewRequest(queryFiltersRequest(c, Drawable), cookie) + return QueryFiltersCookie{cookie} +} + +// QueryFiltersReply represents the data returned from a QueryFilters request. +type QueryFiltersReply struct { + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply + // padding: 1 bytes + NumAliases uint32 + NumFilters uint32 + // padding: 16 bytes + Aliases []uint16 // size: xgb.Pad((int(NumAliases) * 2)) + Filters []xproto.Str // size: xproto.StrListSize(Filters) +} + +// Reply blocks and returns the reply data for a QueryFilters request. +func (cook QueryFiltersCookie) Reply() (*QueryFiltersReply, error) { + buf, err := cook.Cookie.Reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return queryFiltersReply(buf), nil +} + +// queryFiltersReply reads a byte slice into a QueryFiltersReply value. +func queryFiltersReply(buf []byte) *QueryFiltersReply { + v := new(QueryFiltersReply) + 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 - xgb.Put32(buf[b:], uint32(MaskFormat)) + v.NumAliases = xgb.Get32(buf[b:]) b += 4 - xgb.Put32(buf[b:], uint32(Glyphset)) + v.NumFilters = xgb.Get32(buf[b:]) b += 4 - xgb.Put16(buf[b:], uint16(SrcX)) - b += 2 + b += 16 // padding - xgb.Put16(buf[b:], uint16(SrcY)) + v.Aliases = make([]uint16, v.NumAliases) + for i := 0; i < int(v.NumAliases); i++ { + v.Aliases[i] = xgb.Get16(buf[b:]) + b += 2 + } + b = xgb.Pad(b) + + v.Filters = make([]xproto.Str, v.NumFilters) + b += xproto.StrReadList(buf[b:], v.Filters) + + return v +} + +// Write request to wire for QueryFilters +// queryFiltersRequest writes a QueryFilters request to a byte slice. +func queryFiltersRequest(c *xgb.Conn, Drawable xproto.Drawable) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["RENDER"] + b += 1 + + buf[b] = 29 // request opcode + b += 1 + + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 - copy(buf[b:], Glyphcmds[:len(Glyphcmds)]) - b += xgb.Pad(int(len(Glyphcmds))) + xgb.Put32(buf[b:], uint32(Drawable)) + b += 4 return buf } -// CompositeGlyphs32Cookie is a cookie used only for CompositeGlyphs32 requests. -type CompositeGlyphs32Cookie struct { +// QueryPictFormatsCookie is a cookie used only for QueryPictFormats requests. +type QueryPictFormatsCookie struct { *xgb.Cookie } -// CompositeGlyphs32 sends an unchecked request. -// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. -func CompositeGlyphs32(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) CompositeGlyphs32Cookie { +// QueryPictFormats sends a checked request. +// If an error occurs, it will be returned with the reply by calling QueryPictFormatsCookie.Reply() +func QueryPictFormats(c *xgb.Conn) QueryPictFormatsCookie { if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'CompositeGlyphs32' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + panic("Cannot issue request 'QueryPictFormats' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } - cookie := c.NewCookie(false, false) - c.NewRequest(compositeGlyphs32Request(c, Op, Src, Dst, MaskFormat, Glyphset, SrcX, SrcY, Glyphcmds), cookie) - return CompositeGlyphs32Cookie{cookie} + cookie := c.NewCookie(true, true) + c.NewRequest(queryPictFormatsRequest(c), cookie) + return QueryPictFormatsCookie{cookie} } -// CompositeGlyphs32Checked sends a checked request. -// If an error occurs, it can be retrieved using CompositeGlyphs32Cookie.Check() -func CompositeGlyphs32Checked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) CompositeGlyphs32Cookie { +// QueryPictFormatsUnchecked sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. +func QueryPictFormatsUnchecked(c *xgb.Conn) QueryPictFormatsCookie { if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'CompositeGlyphs32' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + panic("Cannot issue request 'QueryPictFormats' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } - cookie := c.NewCookie(true, false) - c.NewRequest(compositeGlyphs32Request(c, Op, Src, Dst, MaskFormat, Glyphset, SrcX, SrcY, Glyphcmds), cookie) - return CompositeGlyphs32Cookie{cookie} + cookie := c.NewCookie(false, true) + c.NewRequest(queryPictFormatsRequest(c), cookie) + return QueryPictFormatsCookie{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 CompositeGlyphs32Cookie) Check() error { - return cook.Cookie.Check() +// QueryPictFormatsReply represents the data returned from a QueryPictFormats request. +type QueryPictFormatsReply struct { + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply + // padding: 1 bytes + NumFormats uint32 + NumScreens uint32 + NumDepths uint32 + NumVisuals uint32 + NumSubpixel uint32 + // padding: 4 bytes + Formats []Pictforminfo // size: xgb.Pad((int(NumFormats) * 28)) + Screens []Pictscreen // size: PictscreenListSize(Screens) + Subpixels []uint32 // size: xgb.Pad((int(NumSubpixel) * 4)) } -// Write request to wire for CompositeGlyphs32 -// compositeGlyphs32Request writes a CompositeGlyphs32 request to a byte slice. -func compositeGlyphs32Request(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) []byte { - size := xgb.Pad((28 + xgb.Pad((len(Glyphcmds) * 1)))) - b := 0 - buf := make([]byte, size) +// Reply blocks and returns the reply data for a QueryPictFormats request. +func (cook QueryPictFormatsCookie) Reply() (*QueryPictFormatsReply, error) { + buf, err := cook.Cookie.Reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return queryPictFormatsReply(buf), nil +} - buf[b] = c.Extensions["RENDER"] - b += 1 +// queryPictFormatsReply reads a byte slice into a QueryPictFormatsReply value. +func queryPictFormatsReply(buf []byte) *QueryPictFormatsReply { + v := new(QueryPictFormatsReply) + b := 1 // skip reply determinant - buf[b] = 25 // 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 - buf[b] = Op - b += 1 + v.Length = xgb.Get32(buf[b:]) // 4-byte units + b += 4 - b += 3 // padding + v.NumFormats = xgb.Get32(buf[b:]) + b += 4 - xgb.Put32(buf[b:], uint32(Src)) + v.NumScreens = xgb.Get32(buf[b:]) b += 4 - xgb.Put32(buf[b:], uint32(Dst)) + v.NumDepths = xgb.Get32(buf[b:]) + b += 4 + + v.NumVisuals = xgb.Get32(buf[b:]) + b += 4 + + v.NumSubpixel = xgb.Get32(buf[b:]) b += 4 - xgb.Put32(buf[b:], uint32(MaskFormat)) - b += 4 + b += 4 // padding + + v.Formats = make([]Pictforminfo, v.NumFormats) + b += PictforminfoReadList(buf[b:], v.Formats) + + v.Screens = make([]Pictscreen, v.NumScreens) + b += PictscreenReadList(buf[b:], v.Screens) + + v.Subpixels = make([]uint32, v.NumSubpixel) + for i := 0; i < int(v.NumSubpixel); i++ { + v.Subpixels[i] = xgb.Get32(buf[b:]) + b += 4 + } + b = xgb.Pad(b) + + return v +} + +// Write request to wire for QueryPictFormats +// queryPictFormatsRequest writes a QueryPictFormats request to a byte slice. +func queryPictFormatsRequest(c *xgb.Conn) []byte { + size := 4 + b := 0 + buf := make([]byte, size) - xgb.Put32(buf[b:], uint32(Glyphset)) - b += 4 + buf[b] = c.Extensions["RENDER"] + b += 1 - xgb.Put16(buf[b:], uint16(SrcX)) - b += 2 + buf[b] = 1 // request opcode + b += 1 - xgb.Put16(buf[b:], uint16(SrcY)) + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 - copy(buf[b:], Glyphcmds[:len(Glyphcmds)]) - b += xgb.Pad(int(len(Glyphcmds))) - return buf } -// FillRectanglesCookie is a cookie used only for FillRectangles requests. -type FillRectanglesCookie struct { +// QueryPictIndexValuesCookie is a cookie used only for QueryPictIndexValues requests. +type QueryPictIndexValuesCookie struct { *xgb.Cookie } -// FillRectangles sends an unchecked request. -// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. -func FillRectangles(c *xgb.Conn, Op byte, Dst Picture, Color Color, Rects []xproto.Rectangle) FillRectanglesCookie { +// QueryPictIndexValues sends a checked request. +// If an error occurs, it will be returned with the reply by calling QueryPictIndexValuesCookie.Reply() +func QueryPictIndexValues(c *xgb.Conn, Format Pictformat) QueryPictIndexValuesCookie { if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'FillRectangles' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + panic("Cannot issue request 'QueryPictIndexValues' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } - cookie := c.NewCookie(false, false) - c.NewRequest(fillRectanglesRequest(c, Op, Dst, Color, Rects), cookie) - return FillRectanglesCookie{cookie} + cookie := c.NewCookie(true, true) + c.NewRequest(queryPictIndexValuesRequest(c, Format), cookie) + return QueryPictIndexValuesCookie{cookie} } -// FillRectanglesChecked sends a checked request. -// If an error occurs, it can be retrieved using FillRectanglesCookie.Check() -func FillRectanglesChecked(c *xgb.Conn, Op byte, Dst Picture, Color Color, Rects []xproto.Rectangle) FillRectanglesCookie { +// QueryPictIndexValuesUnchecked sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. +func QueryPictIndexValuesUnchecked(c *xgb.Conn, Format Pictformat) QueryPictIndexValuesCookie { if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'FillRectangles' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + panic("Cannot issue request 'QueryPictIndexValues' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } - cookie := c.NewCookie(true, false) - c.NewRequest(fillRectanglesRequest(c, Op, Dst, Color, Rects), cookie) - return FillRectanglesCookie{cookie} + cookie := c.NewCookie(false, true) + c.NewRequest(queryPictIndexValuesRequest(c, Format), cookie) + return QueryPictIndexValuesCookie{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 FillRectanglesCookie) Check() error { - return cook.Cookie.Check() +// QueryPictIndexValuesReply represents the data returned from a QueryPictIndexValues request. +type QueryPictIndexValuesReply struct { + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply + // padding: 1 bytes + NumValues uint32 + // padding: 20 bytes + Values []Indexvalue // size: xgb.Pad((int(NumValues) * 12)) } -// Write request to wire for FillRectangles -// fillRectanglesRequest writes a FillRectangles request to a byte slice. -func fillRectanglesRequest(c *xgb.Conn, Op byte, Dst Picture, Color Color, Rects []xproto.Rectangle) []byte { - size := xgb.Pad((20 + xgb.Pad((len(Rects) * 8)))) +// Reply blocks and returns the reply data for a QueryPictIndexValues request. +func (cook QueryPictIndexValuesCookie) Reply() (*QueryPictIndexValuesReply, error) { + buf, err := cook.Cookie.Reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return queryPictIndexValuesReply(buf), nil +} + +// queryPictIndexValuesReply reads a byte slice into a QueryPictIndexValuesReply value. +func queryPictIndexValuesReply(buf []byte) *QueryPictIndexValuesReply { + v := new(QueryPictIndexValuesReply) + 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.NumValues = xgb.Get32(buf[b:]) + b += 4 + + b += 20 // padding + + v.Values = make([]Indexvalue, v.NumValues) + b += IndexvalueReadList(buf[b:], v.Values) + + return v +} + +// Write request to wire for QueryPictIndexValues +// queryPictIndexValuesRequest writes a QueryPictIndexValues request to a byte slice. +func queryPictIndexValuesRequest(c *xgb.Conn, Format Pictformat) []byte { + size := 8 b := 0 buf := make([]byte, size) buf[b] = c.Extensions["RENDER"] b += 1 - buf[b] = 26 // request opcode + buf[b] = 2 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 - buf[b] = Op - b += 1 - - b += 3 // padding - - xgb.Put32(buf[b:], uint32(Dst)) + xgb.Put32(buf[b:], uint32(Format)) b += 4 - { - structBytes := Color.Bytes() - copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) - } - - b += xproto.RectangleListBytes(buf[b:], Rects) - return buf } -// CreateCursorCookie is a cookie used only for CreateCursor requests. -type CreateCursorCookie struct { +// QueryVersionCookie is a cookie used only for QueryVersion requests. +type QueryVersionCookie struct { *xgb.Cookie } -// CreateCursor sends an unchecked request. -// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. -func CreateCursor(c *xgb.Conn, Cid xproto.Cursor, Source Picture, X uint16, Y uint16) CreateCursorCookie { +// 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, ClientMajorVersion uint32, ClientMinorVersion uint32) QueryVersionCookie { if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'CreateCursor' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } - cookie := c.NewCookie(false, false) - c.NewRequest(createCursorRequest(c, Cid, Source, X, Y), cookie) - return CreateCursorCookie{cookie} + cookie := c.NewCookie(true, true) + c.NewRequest(queryVersionRequest(c, ClientMajorVersion, ClientMinorVersion), cookie) + return QueryVersionCookie{cookie} } -// CreateCursorChecked sends a checked request. -// If an error occurs, it can be retrieved using CreateCursorCookie.Check() -func CreateCursorChecked(c *xgb.Conn, Cid xproto.Cursor, Source Picture, X uint16, Y uint16) CreateCursorCookie { +// QueryVersionUnchecked sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. +func QueryVersionUnchecked(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVersion uint32) QueryVersionCookie { if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'CreateCursor' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } - cookie := c.NewCookie(true, false) - c.NewRequest(createCursorRequest(c, Cid, Source, X, Y), cookie) - return CreateCursorCookie{cookie} + cookie := c.NewCookie(false, true) + c.NewRequest(queryVersionRequest(c, ClientMajorVersion, ClientMinorVersion), cookie) + return QueryVersionCookie{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 CreateCursorCookie) Check() error { - return cook.Cookie.Check() +// 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 + MajorVersion uint32 + MinorVersion uint32 + // padding: 16 bytes } -// Write request to wire for CreateCursor -// createCursorRequest writes a CreateCursor request to a byte slice. -func createCursorRequest(c *xgb.Conn, Cid xproto.Cursor, Source Picture, X uint16, Y uint16) []byte { - size := 16 +// Reply blocks and returns the reply data for a QueryVersion request. +func (cook QueryVersionCookie) Reply() (*QueryVersionReply, error) { + buf, err := cook.Cookie.Reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return queryVersionReply(buf), nil +} + +// queryVersionReply reads a byte slice into a QueryVersionReply value. +func queryVersionReply(buf []byte) *QueryVersionReply { + v := new(QueryVersionReply) + b := 1 // skip reply determinant + + b += 1 // padding + + v.Sequence = xgb.Get16(buf[b:]) + b += 2 + + v.Length = xgb.Get32(buf[b:]) // 4-byte units + b += 4 + + v.MajorVersion = xgb.Get32(buf[b:]) + b += 4 + + v.MinorVersion = xgb.Get32(buf[b:]) + b += 4 + + b += 16 // padding + + return v +} + +// Write request to wire for QueryVersion +// queryVersionRequest writes a QueryVersion request to a byte slice. +func queryVersionRequest(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVersion uint32) []byte { + size := 12 b := 0 buf := make([]byte, size) buf[b] = c.Extensions["RENDER"] b += 1 - buf[b] = 27 // request opcode + buf[b] = 0 // 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(Cid)) + xgb.Put32(buf[b:], ClientMajorVersion) b += 4 - xgb.Put32(buf[b:], uint32(Source)) + xgb.Put32(buf[b:], ClientMinorVersion) b += 4 - xgb.Put16(buf[b:], X) - b += 2 - - xgb.Put16(buf[b:], Y) - b += 2 - return buf } -// SetPictureTransformCookie is a cookie used only for SetPictureTransform requests. -type SetPictureTransformCookie struct { +// ReferenceGlyphSetCookie is a cookie used only for ReferenceGlyphSet requests. +type ReferenceGlyphSetCookie struct { *xgb.Cookie } -// SetPictureTransform sends an unchecked request. +// ReferenceGlyphSet sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. -func SetPictureTransform(c *xgb.Conn, Picture Picture, Transform Transform) SetPictureTransformCookie { +func ReferenceGlyphSet(c *xgb.Conn, Gsid Glyphset, Existing Glyphset) ReferenceGlyphSetCookie { if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'SetPictureTransform' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + panic("Cannot issue request 'ReferenceGlyphSet' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } cookie := c.NewCookie(false, false) - c.NewRequest(setPictureTransformRequest(c, Picture, Transform), cookie) - return SetPictureTransformCookie{cookie} + c.NewRequest(referenceGlyphSetRequest(c, Gsid, Existing), cookie) + return ReferenceGlyphSetCookie{cookie} } -// SetPictureTransformChecked sends a checked request. -// If an error occurs, it can be retrieved using SetPictureTransformCookie.Check() -func SetPictureTransformChecked(c *xgb.Conn, Picture Picture, Transform Transform) SetPictureTransformCookie { +// ReferenceGlyphSetChecked sends a checked request. +// If an error occurs, it can be retrieved using ReferenceGlyphSetCookie.Check() +func ReferenceGlyphSetChecked(c *xgb.Conn, Gsid Glyphset, Existing Glyphset) ReferenceGlyphSetCookie { if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'SetPictureTransform' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + panic("Cannot issue request 'ReferenceGlyphSet' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } cookie := c.NewCookie(true, false) - c.NewRequest(setPictureTransformRequest(c, Picture, Transform), cookie) - return SetPictureTransformCookie{cookie} + c.NewRequest(referenceGlyphSetRequest(c, Gsid, Existing), cookie) + return ReferenceGlyphSetCookie{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 SetPictureTransformCookie) Check() error { +func (cook ReferenceGlyphSetCookie) Check() error { return cook.Cookie.Check() } -// Write request to wire for SetPictureTransform -// setPictureTransformRequest writes a SetPictureTransform request to a byte slice. -func setPictureTransformRequest(c *xgb.Conn, Picture Picture, Transform Transform) []byte { - size := 44 +// Write request to wire for ReferenceGlyphSet +// referenceGlyphSetRequest writes a ReferenceGlyphSet request to a byte slice. +func referenceGlyphSetRequest(c *xgb.Conn, Gsid Glyphset, Existing Glyphset) []byte { + size := 12 b := 0 buf := make([]byte, size) buf[b] = c.Extensions["RENDER"] b += 1 - buf[b] = 28 // 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(Picture)) + xgb.Put32(buf[b:], uint32(Gsid)) b += 4 - { - structBytes := Transform.Bytes() - copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) - } + xgb.Put32(buf[b:], uint32(Existing)) + b += 4 return buf } -// QueryFiltersCookie is a cookie used only for QueryFilters requests. -type QueryFiltersCookie struct { +// SetPictureClipRectanglesCookie is a cookie used only for SetPictureClipRectangles requests. +type SetPictureClipRectanglesCookie struct { *xgb.Cookie } -// QueryFilters sends a checked request. -// If an error occurs, it will be returned with the reply by calling QueryFiltersCookie.Reply() -func QueryFilters(c *xgb.Conn, Drawable xproto.Drawable) QueryFiltersCookie { - if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'QueryFilters' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") - } - cookie := c.NewCookie(true, true) - c.NewRequest(queryFiltersRequest(c, Drawable), cookie) - return QueryFiltersCookie{cookie} -} - -// QueryFiltersUnchecked sends an unchecked request. +// SetPictureClipRectangles sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. -func QueryFiltersUnchecked(c *xgb.Conn, Drawable xproto.Drawable) QueryFiltersCookie { +func SetPictureClipRectangles(c *xgb.Conn, Picture Picture, ClipXOrigin int16, ClipYOrigin int16, Rectangles []xproto.Rectangle) SetPictureClipRectanglesCookie { if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'QueryFilters' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + panic("Cannot issue request 'SetPictureClipRectangles' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } - cookie := c.NewCookie(false, true) - c.NewRequest(queryFiltersRequest(c, Drawable), cookie) - return QueryFiltersCookie{cookie} -} - -// QueryFiltersReply represents the data returned from a QueryFilters request. -type QueryFiltersReply struct { - Sequence uint16 // sequence number of the request for this reply - Length uint32 // number of bytes in this reply - // padding: 1 bytes - NumAliases uint32 - NumFilters uint32 - // padding: 16 bytes - Aliases []uint16 // size: xgb.Pad((int(NumAliases) * 2)) - Filters []xproto.Str // size: xproto.StrListSize(Filters) + cookie := c.NewCookie(false, false) + c.NewRequest(setPictureClipRectanglesRequest(c, Picture, ClipXOrigin, ClipYOrigin, Rectangles), cookie) + return SetPictureClipRectanglesCookie{cookie} } -// Reply blocks and returns the reply data for a QueryFilters request. -func (cook QueryFiltersCookie) Reply() (*QueryFiltersReply, error) { - buf, err := cook.Cookie.Reply() - if err != nil { - return nil, err - } - if buf == nil { - return nil, nil +// SetPictureClipRectanglesChecked sends a checked request. +// If an error occurs, it can be retrieved using SetPictureClipRectanglesCookie.Check() +func SetPictureClipRectanglesChecked(c *xgb.Conn, Picture Picture, ClipXOrigin int16, ClipYOrigin int16, Rectangles []xproto.Rectangle) SetPictureClipRectanglesCookie { + if _, ok := c.Extensions["RENDER"]; !ok { + panic("Cannot issue request 'SetPictureClipRectangles' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } - return queryFiltersReply(buf), nil + cookie := c.NewCookie(true, false) + c.NewRequest(setPictureClipRectanglesRequest(c, Picture, ClipXOrigin, ClipYOrigin, Rectangles), cookie) + return SetPictureClipRectanglesCookie{cookie} } -// queryFiltersReply reads a byte slice into a QueryFiltersReply value. -func queryFiltersReply(buf []byte) *QueryFiltersReply { - v := new(QueryFiltersReply) - 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.NumAliases = xgb.Get32(buf[b:]) - b += 4 - - v.NumFilters = xgb.Get32(buf[b:]) - b += 4 - - b += 16 // padding - - v.Aliases = make([]uint16, v.NumAliases) - for i := 0; i < int(v.NumAliases); i++ { - v.Aliases[i] = xgb.Get16(buf[b:]) - b += 2 - } - b = xgb.Pad(b) - - v.Filters = make([]xproto.Str, v.NumFilters) - b += xproto.StrReadList(buf[b:], v.Filters) - - 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 SetPictureClipRectanglesCookie) Check() error { + return cook.Cookie.Check() } -// Write request to wire for QueryFilters -// queryFiltersRequest writes a QueryFilters request to a byte slice. -func queryFiltersRequest(c *xgb.Conn, Drawable xproto.Drawable) []byte { - size := 8 +// Write request to wire for SetPictureClipRectangles +// setPictureClipRectanglesRequest writes a SetPictureClipRectangles request to a byte slice. +func setPictureClipRectanglesRequest(c *xgb.Conn, Picture Picture, ClipXOrigin int16, ClipYOrigin int16, Rectangles []xproto.Rectangle) []byte { + size := xgb.Pad((12 + xgb.Pad((len(Rectangles) * 8)))) b := 0 buf := make([]byte, size) buf[b] = c.Extensions["RENDER"] b += 1 - buf[b] = 29 // 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(Drawable)) + xgb.Put32(buf[b:], uint32(Picture)) b += 4 + xgb.Put16(buf[b:], uint16(ClipXOrigin)) + b += 2 + + xgb.Put16(buf[b:], uint16(ClipYOrigin)) + b += 2 + + b += xproto.RectangleListBytes(buf[b:], Rectangles) + return buf } @@ -3430,107 +3491,50 @@ func setPictureFilterRequest(c *xgb.Conn, Picture Picture, FilterLen uint16, Fil return buf } -// CreateAnimCursorCookie is a cookie used only for CreateAnimCursor requests. -type CreateAnimCursorCookie struct { - *xgb.Cookie -} - -// CreateAnimCursor sends an unchecked request. -// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. -func CreateAnimCursor(c *xgb.Conn, Cid xproto.Cursor, Cursors []Animcursorelt) CreateAnimCursorCookie { - if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'CreateAnimCursor' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") - } - cookie := c.NewCookie(false, false) - c.NewRequest(createAnimCursorRequest(c, Cid, Cursors), cookie) - return CreateAnimCursorCookie{cookie} -} - -// CreateAnimCursorChecked sends a checked request. -// If an error occurs, it can be retrieved using CreateAnimCursorCookie.Check() -func CreateAnimCursorChecked(c *xgb.Conn, Cid xproto.Cursor, Cursors []Animcursorelt) CreateAnimCursorCookie { - if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'CreateAnimCursor' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") - } - cookie := c.NewCookie(true, false) - c.NewRequest(createAnimCursorRequest(c, Cid, Cursors), cookie) - return CreateAnimCursorCookie{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 CreateAnimCursorCookie) Check() error { - return cook.Cookie.Check() -} - -// Write request to wire for CreateAnimCursor -// createAnimCursorRequest writes a CreateAnimCursor request to a byte slice. -func createAnimCursorRequest(c *xgb.Conn, Cid xproto.Cursor, Cursors []Animcursorelt) []byte { - size := xgb.Pad((8 + xgb.Pad((len(Cursors) * 8)))) - b := 0 - buf := make([]byte, size) - - buf[b] = c.Extensions["RENDER"] - b += 1 - - buf[b] = 31 // request opcode - b += 1 - - xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units - b += 2 - - xgb.Put32(buf[b:], uint32(Cid)) - b += 4 - - b += AnimcursoreltListBytes(buf[b:], Cursors) - - return buf -} - -// AddTrapsCookie is a cookie used only for AddTraps requests. -type AddTrapsCookie struct { +// SetPictureTransformCookie is a cookie used only for SetPictureTransform requests. +type SetPictureTransformCookie struct { *xgb.Cookie } -// AddTraps sends an unchecked request. +// SetPictureTransform sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. -func AddTraps(c *xgb.Conn, Picture Picture, XOff int16, YOff int16, Traps []Trap) AddTrapsCookie { +func SetPictureTransform(c *xgb.Conn, Picture Picture, Transform Transform) SetPictureTransformCookie { if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'AddTraps' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + panic("Cannot issue request 'SetPictureTransform' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } cookie := c.NewCookie(false, false) - c.NewRequest(addTrapsRequest(c, Picture, XOff, YOff, Traps), cookie) - return AddTrapsCookie{cookie} + c.NewRequest(setPictureTransformRequest(c, Picture, Transform), cookie) + return SetPictureTransformCookie{cookie} } -// AddTrapsChecked sends a checked request. -// If an error occurs, it can be retrieved using AddTrapsCookie.Check() -func AddTrapsChecked(c *xgb.Conn, Picture Picture, XOff int16, YOff int16, Traps []Trap) AddTrapsCookie { +// SetPictureTransformChecked sends a checked request. +// If an error occurs, it can be retrieved using SetPictureTransformCookie.Check() +func SetPictureTransformChecked(c *xgb.Conn, Picture Picture, Transform Transform) SetPictureTransformCookie { if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'AddTraps' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + panic("Cannot issue request 'SetPictureTransform' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } cookie := c.NewCookie(true, false) - c.NewRequest(addTrapsRequest(c, Picture, XOff, YOff, Traps), cookie) - return AddTrapsCookie{cookie} + c.NewRequest(setPictureTransformRequest(c, Picture, Transform), cookie) + return SetPictureTransformCookie{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 AddTrapsCookie) Check() error { +func (cook SetPictureTransformCookie) Check() error { return cook.Cookie.Check() } -// Write request to wire for AddTraps -// addTrapsRequest writes a AddTraps request to a byte slice. -func addTrapsRequest(c *xgb.Conn, Picture Picture, XOff int16, YOff int16, Traps []Trap) []byte { - size := xgb.Pad((12 + xgb.Pad((len(Traps) * 24)))) +// Write request to wire for SetPictureTransform +// setPictureTransformRequest writes a SetPictureTransform request to a byte slice. +func setPictureTransformRequest(c *xgb.Conn, Picture Picture, Transform Transform) []byte { + size := 44 b := 0 buf := make([]byte, size) buf[b] = c.Extensions["RENDER"] b += 1 - buf[b] = 32 // request opcode + buf[b] = 28 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units @@ -3539,311 +3543,307 @@ func addTrapsRequest(c *xgb.Conn, Picture Picture, XOff int16, YOff int16, Traps xgb.Put32(buf[b:], uint32(Picture)) b += 4 - xgb.Put16(buf[b:], uint16(XOff)) - b += 2 - - xgb.Put16(buf[b:], uint16(YOff)) - b += 2 - - b += TrapListBytes(buf[b:], Traps) + { + structBytes := Transform.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } return buf } -// CreateSolidFillCookie is a cookie used only for CreateSolidFill requests. -type CreateSolidFillCookie struct { +// TrapezoidsCookie is a cookie used only for Trapezoids requests. +type TrapezoidsCookie struct { *xgb.Cookie } -// CreateSolidFill sends an unchecked request. +// Trapezoids sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. -func CreateSolidFill(c *xgb.Conn, Picture Picture, Color Color) CreateSolidFillCookie { +func Trapezoids(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Traps []Trapezoid) TrapezoidsCookie { if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'CreateSolidFill' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + panic("Cannot issue request 'Trapezoids' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } cookie := c.NewCookie(false, false) - c.NewRequest(createSolidFillRequest(c, Picture, Color), cookie) - return CreateSolidFillCookie{cookie} + c.NewRequest(trapezoidsRequest(c, Op, Src, Dst, MaskFormat, SrcX, SrcY, Traps), cookie) + return TrapezoidsCookie{cookie} } -// CreateSolidFillChecked sends a checked request. -// If an error occurs, it can be retrieved using CreateSolidFillCookie.Check() -func CreateSolidFillChecked(c *xgb.Conn, Picture Picture, Color Color) CreateSolidFillCookie { +// TrapezoidsChecked sends a checked request. +// If an error occurs, it can be retrieved using TrapezoidsCookie.Check() +func TrapezoidsChecked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Traps []Trapezoid) TrapezoidsCookie { if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'CreateSolidFill' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + panic("Cannot issue request 'Trapezoids' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } cookie := c.NewCookie(true, false) - c.NewRequest(createSolidFillRequest(c, Picture, Color), cookie) - return CreateSolidFillCookie{cookie} + c.NewRequest(trapezoidsRequest(c, Op, Src, Dst, MaskFormat, SrcX, SrcY, Traps), cookie) + return TrapezoidsCookie{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 CreateSolidFillCookie) Check() error { +func (cook TrapezoidsCookie) Check() error { return cook.Cookie.Check() } -// Write request to wire for CreateSolidFill -// createSolidFillRequest writes a CreateSolidFill request to a byte slice. -func createSolidFillRequest(c *xgb.Conn, Picture Picture, Color Color) []byte { - size := 16 +// Write request to wire for Trapezoids +// trapezoidsRequest writes a Trapezoids request to a byte slice. +func trapezoidsRequest(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Traps []Trapezoid) []byte { + size := xgb.Pad((24 + xgb.Pad((len(Traps) * 40)))) b := 0 buf := make([]byte, size) buf[b] = c.Extensions["RENDER"] b += 1 - buf[b] = 33 // request opcode + buf[b] = 10 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 - xgb.Put32(buf[b:], uint32(Picture)) + buf[b] = Op + b += 1 + + b += 3 // padding + + xgb.Put32(buf[b:], uint32(Src)) b += 4 - { - structBytes := Color.Bytes() - copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) - } + xgb.Put32(buf[b:], uint32(Dst)) + b += 4 + + xgb.Put32(buf[b:], uint32(MaskFormat)) + b += 4 + + xgb.Put16(buf[b:], uint16(SrcX)) + b += 2 + + xgb.Put16(buf[b:], uint16(SrcY)) + b += 2 + + b += TrapezoidListBytes(buf[b:], Traps) return buf } -// CreateLinearGradientCookie is a cookie used only for CreateLinearGradient requests. -type CreateLinearGradientCookie struct { +// TriFanCookie is a cookie used only for TriFan requests. +type TriFanCookie struct { *xgb.Cookie } -// CreateLinearGradient sends an unchecked request. +// TriFan sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. -func CreateLinearGradient(c *xgb.Conn, Picture Picture, P1 Pointfix, P2 Pointfix, NumStops uint32, Stops []Fixed, Colors []Color) CreateLinearGradientCookie { +func TriFan(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Points []Pointfix) TriFanCookie { if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'CreateLinearGradient' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + panic("Cannot issue request 'TriFan' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } cookie := c.NewCookie(false, false) - c.NewRequest(createLinearGradientRequest(c, Picture, P1, P2, NumStops, Stops, Colors), cookie) - return CreateLinearGradientCookie{cookie} + c.NewRequest(triFanRequest(c, Op, Src, Dst, MaskFormat, SrcX, SrcY, Points), cookie) + return TriFanCookie{cookie} } -// CreateLinearGradientChecked sends a checked request. -// If an error occurs, it can be retrieved using CreateLinearGradientCookie.Check() -func CreateLinearGradientChecked(c *xgb.Conn, Picture Picture, P1 Pointfix, P2 Pointfix, NumStops uint32, Stops []Fixed, Colors []Color) CreateLinearGradientCookie { +// TriFanChecked sends a checked request. +// If an error occurs, it can be retrieved using TriFanCookie.Check() +func TriFanChecked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Points []Pointfix) TriFanCookie { if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'CreateLinearGradient' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + panic("Cannot issue request 'TriFan' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } cookie := c.NewCookie(true, false) - c.NewRequest(createLinearGradientRequest(c, Picture, P1, P2, NumStops, Stops, Colors), cookie) - return CreateLinearGradientCookie{cookie} + c.NewRequest(triFanRequest(c, Op, Src, Dst, MaskFormat, SrcX, SrcY, Points), cookie) + return TriFanCookie{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 CreateLinearGradientCookie) Check() error { +func (cook TriFanCookie) Check() error { return cook.Cookie.Check() } -// Write request to wire for CreateLinearGradient -// createLinearGradientRequest writes a CreateLinearGradient request to a byte slice. -func createLinearGradientRequest(c *xgb.Conn, Picture Picture, P1 Pointfix, P2 Pointfix, NumStops uint32, Stops []Fixed, Colors []Color) []byte { - size := xgb.Pad(((28 + xgb.Pad((int(NumStops) * 4))) + xgb.Pad((int(NumStops) * 8)))) +// Write request to wire for TriFan +// triFanRequest writes a TriFan request to a byte slice. +func triFanRequest(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Points []Pointfix) []byte { + size := xgb.Pad((24 + xgb.Pad((len(Points) * 8)))) b := 0 buf := make([]byte, size) buf[b] = c.Extensions["RENDER"] b += 1 - buf[b] = 34 // request opcode + buf[b] = 13 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 - xgb.Put32(buf[b:], uint32(Picture)) - b += 4 + buf[b] = Op + b += 1 - { - structBytes := P1.Bytes() - copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) - } + b += 3 // padding - { - structBytes := P2.Bytes() - copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) - } + xgb.Put32(buf[b:], uint32(Src)) + b += 4 - xgb.Put32(buf[b:], NumStops) + xgb.Put32(buf[b:], uint32(Dst)) b += 4 - for i := 0; i < int(NumStops); i++ { - xgb.Put32(buf[b:], uint32(Stops[i])) - b += 4 - } - b = xgb.Pad(b) + xgb.Put32(buf[b:], uint32(MaskFormat)) + b += 4 - b += ColorListBytes(buf[b:], Colors) + xgb.Put16(buf[b:], uint16(SrcX)) + b += 2 + + xgb.Put16(buf[b:], uint16(SrcY)) + b += 2 + + b += PointfixListBytes(buf[b:], Points) return buf } -// CreateRadialGradientCookie is a cookie used only for CreateRadialGradient requests. -type CreateRadialGradientCookie struct { +// TriStripCookie is a cookie used only for TriStrip requests. +type TriStripCookie struct { *xgb.Cookie } -// CreateRadialGradient sends an unchecked request. +// TriStrip sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. -func CreateRadialGradient(c *xgb.Conn, Picture Picture, Inner Pointfix, Outer Pointfix, InnerRadius Fixed, OuterRadius Fixed, NumStops uint32, Stops []Fixed, Colors []Color) CreateRadialGradientCookie { +func TriStrip(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Points []Pointfix) TriStripCookie { if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'CreateRadialGradient' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + panic("Cannot issue request 'TriStrip' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } cookie := c.NewCookie(false, false) - c.NewRequest(createRadialGradientRequest(c, Picture, Inner, Outer, InnerRadius, OuterRadius, NumStops, Stops, Colors), cookie) - return CreateRadialGradientCookie{cookie} + c.NewRequest(triStripRequest(c, Op, Src, Dst, MaskFormat, SrcX, SrcY, Points), cookie) + return TriStripCookie{cookie} } -// CreateRadialGradientChecked sends a checked request. -// If an error occurs, it can be retrieved using CreateRadialGradientCookie.Check() -func CreateRadialGradientChecked(c *xgb.Conn, Picture Picture, Inner Pointfix, Outer Pointfix, InnerRadius Fixed, OuterRadius Fixed, NumStops uint32, Stops []Fixed, Colors []Color) CreateRadialGradientCookie { +// TriStripChecked sends a checked request. +// If an error occurs, it can be retrieved using TriStripCookie.Check() +func TriStripChecked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Points []Pointfix) TriStripCookie { if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'CreateRadialGradient' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + panic("Cannot issue request 'TriStrip' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } cookie := c.NewCookie(true, false) - c.NewRequest(createRadialGradientRequest(c, Picture, Inner, Outer, InnerRadius, OuterRadius, NumStops, Stops, Colors), cookie) - return CreateRadialGradientCookie{cookie} + c.NewRequest(triStripRequest(c, Op, Src, Dst, MaskFormat, SrcX, SrcY, Points), cookie) + return TriStripCookie{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 CreateRadialGradientCookie) Check() error { +func (cook TriStripCookie) Check() error { return cook.Cookie.Check() } -// Write request to wire for CreateRadialGradient -// createRadialGradientRequest writes a CreateRadialGradient request to a byte slice. -func createRadialGradientRequest(c *xgb.Conn, Picture Picture, Inner Pointfix, Outer Pointfix, InnerRadius Fixed, OuterRadius Fixed, NumStops uint32, Stops []Fixed, Colors []Color) []byte { - size := xgb.Pad(((36 + xgb.Pad((int(NumStops) * 4))) + xgb.Pad((int(NumStops) * 8)))) +// Write request to wire for TriStrip +// triStripRequest writes a TriStrip request to a byte slice. +func triStripRequest(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Points []Pointfix) []byte { + size := xgb.Pad((24 + xgb.Pad((len(Points) * 8)))) b := 0 buf := make([]byte, size) buf[b] = c.Extensions["RENDER"] b += 1 - buf[b] = 35 // request opcode + buf[b] = 12 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 - xgb.Put32(buf[b:], uint32(Picture)) - b += 4 - - { - structBytes := Inner.Bytes() - copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) - } + buf[b] = Op + b += 1 - { - structBytes := Outer.Bytes() - copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) - } + b += 3 // padding - xgb.Put32(buf[b:], uint32(InnerRadius)) + xgb.Put32(buf[b:], uint32(Src)) b += 4 - xgb.Put32(buf[b:], uint32(OuterRadius)) + xgb.Put32(buf[b:], uint32(Dst)) b += 4 - xgb.Put32(buf[b:], NumStops) + xgb.Put32(buf[b:], uint32(MaskFormat)) b += 4 - for i := 0; i < int(NumStops); i++ { - xgb.Put32(buf[b:], uint32(Stops[i])) - b += 4 - } - b = xgb.Pad(b) + xgb.Put16(buf[b:], uint16(SrcX)) + b += 2 - b += ColorListBytes(buf[b:], Colors) + xgb.Put16(buf[b:], uint16(SrcY)) + b += 2 + + b += PointfixListBytes(buf[b:], Points) return buf } -// CreateConicalGradientCookie is a cookie used only for CreateConicalGradient requests. -type CreateConicalGradientCookie struct { +// TrianglesCookie is a cookie used only for Triangles requests. +type TrianglesCookie struct { *xgb.Cookie } -// CreateConicalGradient sends an unchecked request. +// Triangles sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. -func CreateConicalGradient(c *xgb.Conn, Picture Picture, Center Pointfix, Angle Fixed, NumStops uint32, Stops []Fixed, Colors []Color) CreateConicalGradientCookie { +func Triangles(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Triangles []Triangle) TrianglesCookie { if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'CreateConicalGradient' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + panic("Cannot issue request 'Triangles' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } cookie := c.NewCookie(false, false) - c.NewRequest(createConicalGradientRequest(c, Picture, Center, Angle, NumStops, Stops, Colors), cookie) - return CreateConicalGradientCookie{cookie} + c.NewRequest(trianglesRequest(c, Op, Src, Dst, MaskFormat, SrcX, SrcY, Triangles), cookie) + return TrianglesCookie{cookie} } -// CreateConicalGradientChecked sends a checked request. -// If an error occurs, it can be retrieved using CreateConicalGradientCookie.Check() -func CreateConicalGradientChecked(c *xgb.Conn, Picture Picture, Center Pointfix, Angle Fixed, NumStops uint32, Stops []Fixed, Colors []Color) CreateConicalGradientCookie { +// TrianglesChecked sends a checked request. +// If an error occurs, it can be retrieved using TrianglesCookie.Check() +func TrianglesChecked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Triangles []Triangle) TrianglesCookie { if _, ok := c.Extensions["RENDER"]; !ok { - panic("Cannot issue request 'CreateConicalGradient' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") + panic("Cannot issue request 'Triangles' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } cookie := c.NewCookie(true, false) - c.NewRequest(createConicalGradientRequest(c, Picture, Center, Angle, NumStops, Stops, Colors), cookie) - return CreateConicalGradientCookie{cookie} + c.NewRequest(trianglesRequest(c, Op, Src, Dst, MaskFormat, SrcX, SrcY, Triangles), cookie) + return TrianglesCookie{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 CreateConicalGradientCookie) Check() error { +func (cook TrianglesCookie) Check() error { return cook.Cookie.Check() } -// Write request to wire for CreateConicalGradient -// createConicalGradientRequest writes a CreateConicalGradient request to a byte slice. -func createConicalGradientRequest(c *xgb.Conn, Picture Picture, Center Pointfix, Angle Fixed, NumStops uint32, Stops []Fixed, Colors []Color) []byte { - size := xgb.Pad(((24 + xgb.Pad((int(NumStops) * 4))) + xgb.Pad((int(NumStops) * 8)))) +// Write request to wire for Triangles +// trianglesRequest writes a Triangles request to a byte slice. +func trianglesRequest(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Triangles []Triangle) []byte { + size := xgb.Pad((24 + xgb.Pad((len(Triangles) * 24)))) b := 0 buf := make([]byte, size) buf[b] = c.Extensions["RENDER"] b += 1 - buf[b] = 36 // request opcode + buf[b] = 11 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 - xgb.Put32(buf[b:], uint32(Picture)) - b += 4 + buf[b] = Op + b += 1 - { - structBytes := Center.Bytes() - copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) - } + b += 3 // padding - xgb.Put32(buf[b:], uint32(Angle)) + xgb.Put32(buf[b:], uint32(Src)) b += 4 - xgb.Put32(buf[b:], NumStops) + xgb.Put32(buf[b:], uint32(Dst)) b += 4 - for i := 0; i < int(NumStops); i++ { - xgb.Put32(buf[b:], uint32(Stops[i])) - b += 4 - } - b = xgb.Pad(b) + xgb.Put32(buf[b:], uint32(MaskFormat)) + b += 4 - b += ColorListBytes(buf[b:], Colors) + xgb.Put16(buf[b:], uint16(SrcX)) + b += 2 + + xgb.Put16(buf[b:], uint16(SrcY)) + b += 2 + + b += TriangleListBytes(buf[b:], Triangles) return buf } -- cgit v1.2.3 From b06a8ca97625c1134449c3af65d9ac3fb251a613 Mon Sep 17 00:00:00 2001 From: Andrew Gallant Date: Sun, 11 Aug 2013 20:45:36 -0400 Subject: Don't needlessly change source files every time. --- nexgb/render/render.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'nexgb/render') diff --git a/nexgb/render/render.go b/nexgb/render/render.go index c6f5095..7851e02 100644 --- a/nexgb/render/render.go +++ b/nexgb/render/render.go @@ -1,10 +1,7 @@ // Package render is the X client API for the RENDER extension. package render -/* - This file was generated by render.xml on Aug 11 2013 8:39:43pm EDT. - This file is automatically generated. Edit at your peril! -*/ +// This file is automatically generated from render.xml. Edit at your peril! import ( "github.com/BurntSushi/xgb" -- cgit v1.2.3 From 38b293e74db6631873d5dfd74cf731eb7b76737d Mon Sep 17 00:00:00 2001 From: Andrew Gallant Date: Sun, 11 Aug 2013 20:54:15 -0400 Subject: Padding on a list is on the length of the list. There was a bug where padding was being computed on each element of the list. Close #5. --- nexgb/render/render.go | 64 +++++++++++++++++++++++++------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) (limited to 'nexgb/render') diff --git a/nexgb/render/render.go b/nexgb/render/render.go index 7851e02..7185d18 100644 --- a/nexgb/render/render.go +++ b/nexgb/render/render.go @@ -86,9 +86,9 @@ func AnimcursoreltListBytes(buf []byte, list []Animcursorelt) int { for _, item := range list { structBytes = item.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } - return b + return xgb.Pad(b) } type Color struct { @@ -154,9 +154,9 @@ func ColorListBytes(buf []byte, list []Color) int { for _, item := range list { structBytes = item.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } - return b + return xgb.Pad(b) } const ( @@ -266,9 +266,9 @@ func DirectformatListBytes(buf []byte, list []Directformat) int { for _, item := range list { structBytes = item.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } - return b + return xgb.Pad(b) } type Fixed int32 @@ -444,9 +444,9 @@ func GlyphinfoListBytes(buf []byte, list []Glyphinfo) int { for _, item := range list { structBytes = item.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } - return b + return xgb.Pad(b) } type Glyphset uint32 @@ -529,9 +529,9 @@ func IndexvalueListBytes(buf []byte, list []Indexvalue) int { for _, item := range list { structBytes = item.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } - return b + return xgb.Pad(b) } type Linefix struct { @@ -589,9 +589,9 @@ func LinefixListBytes(buf []byte, list []Linefix) int { for _, item := range list { structBytes = item.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } - return b + return xgb.Pad(b) } // BadPictFormat is the error number for a BadPictFormat. @@ -812,9 +812,9 @@ func PictdepthListBytes(buf []byte, list []Pictdepth) int { for _, item := range list { structBytes = item.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } - return b + return xgb.Pad(b) } // PictdepthListSize computes the size (bytes) of a list of Pictdepth values. @@ -914,9 +914,9 @@ func PictforminfoListBytes(buf []byte, list []Pictforminfo) int { for _, item := range list { structBytes = item.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } - return b + return xgb.Pad(b) } type Pictscreen struct { @@ -974,9 +974,9 @@ func PictscreenListBytes(buf []byte, list []Pictscreen) int { for _, item := range list { structBytes = item.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } - return b + return xgb.Pad(b) } // PictscreenListSize computes the size (bytes) of a list of Pictscreen values. @@ -1097,9 +1097,9 @@ func PictvisualListBytes(buf []byte, list []Pictvisual) int { for _, item := range list { structBytes = item.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } - return b + return xgb.Pad(b) } type Pointfix struct { @@ -1151,9 +1151,9 @@ func PointfixListBytes(buf []byte, list []Pointfix) int { for _, item := range list { structBytes = item.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } - return b + return xgb.Pad(b) } const ( @@ -1229,9 +1229,9 @@ func SpanfixListBytes(buf []byte, list []Spanfix) int { for _, item := range list { structBytes = item.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } - return b + return xgb.Pad(b) } const ( @@ -1341,9 +1341,9 @@ func TransformListBytes(buf []byte, list []Transform) int { for _, item := range list { structBytes = item.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } - return b + return xgb.Pad(b) } type Trap struct { @@ -1401,9 +1401,9 @@ func TrapListBytes(buf []byte, list []Trap) int { for _, item := range list { structBytes = item.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } - return b + return xgb.Pad(b) } type Trapezoid struct { @@ -1475,9 +1475,9 @@ func TrapezoidListBytes(buf []byte, list []Trapezoid) int { for _, item := range list { structBytes = item.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } - return b + return xgb.Pad(b) } type Triangle struct { @@ -1545,9 +1545,9 @@ func TriangleListBytes(buf []byte, list []Triangle) int { for _, item := range list { structBytes = item.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } - return b + return xgb.Pad(b) } // Skipping definition for base type 'Bool' -- cgit v1.2.3 From 2dc9914b5e6b74c353771e56e90dfd2dd33e0202 Mon Sep 17 00:00:00 2001 From: Andrew Gallant Date: Sat, 28 Dec 2013 09:33:09 -0500 Subject: When writing, don't pad the length of bytes produced from inner structs/unions. Each type should take care of its own padding. Close #14. --- nexgb/render/render.go | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'nexgb/render') diff --git a/nexgb/render/render.go b/nexgb/render/render.go index 7185d18..80f4be7 100644 --- a/nexgb/render/render.go +++ b/nexgb/render/render.go @@ -570,13 +570,13 @@ func (v Linefix) Bytes() []byte { { structBytes := v.P1.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } { structBytes := v.P2.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } return buf @@ -898,7 +898,7 @@ func (v Pictforminfo) Bytes() []byte { { structBytes := v.Direct.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } xgb.Put32(buf[b:], uint32(v.Colormap)) @@ -1382,13 +1382,13 @@ func (v Trap) Bytes() []byte { { structBytes := v.Top.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } { structBytes := v.Bot.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } return buf @@ -1456,13 +1456,13 @@ func (v Trapezoid) Bytes() []byte { { structBytes := v.Left.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } { structBytes := v.Right.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } return buf @@ -1520,19 +1520,19 @@ func (v Triangle) Bytes() []byte { { structBytes := v.P1.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } { structBytes := v.P2.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } { structBytes := v.P3.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } return buf @@ -2205,7 +2205,7 @@ func createConicalGradientRequest(c *xgb.Conn, Picture Picture, Center Pointfix, { structBytes := Center.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } xgb.Put32(buf[b:], uint32(Angle)) @@ -2402,13 +2402,13 @@ func createLinearGradientRequest(c *xgb.Conn, Picture Picture, P1 Pointfix, P2 P { structBytes := P1.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } { structBytes := P2.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } xgb.Put32(buf[b:], NumStops) @@ -2549,13 +2549,13 @@ func createRadialGradientRequest(c *xgb.Conn, Picture Picture, Inner Pointfix, O { structBytes := Inner.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } { structBytes := Outer.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } xgb.Put32(buf[b:], uint32(InnerRadius)) @@ -2633,7 +2633,7 @@ func createSolidFillRequest(c *xgb.Conn, Picture Picture, Color Color) []byte { { structBytes := Color.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } return buf @@ -2699,7 +2699,7 @@ func fillRectanglesRequest(c *xgb.Conn, Op byte, Dst Picture, Color Color, Rects { structBytes := Color.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } b += xproto.RectangleListBytes(buf[b:], Rects) @@ -3543,7 +3543,7 @@ func setPictureTransformRequest(c *xgb.Conn, Picture Picture, Transform Transfor { structBytes := Transform.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } return buf -- cgit v1.2.3 From a548d9d0f7b889627c43b18811357fad88760b2d Mon Sep 17 00:00:00 2001 From: aarzilli Date: Fri, 2 May 2014 15:09:23 +0200 Subject: Fix Issue #21: automatic calculation of alignment padding after lists --- nexgb/render/render.go | 112 ++++++++++++++++++++++++++++--------------------- 1 file changed, 65 insertions(+), 47 deletions(-) (limited to 'nexgb/render') diff --git a/nexgb/render/render.go b/nexgb/render/render.go index 80f4be7..f90065b 100644 --- a/nexgb/render/render.go +++ b/nexgb/render/render.go @@ -76,7 +76,7 @@ func (v Animcursorelt) Bytes() []byte { xgb.Put32(buf[b:], v.Delay) b += 4 - return buf + return buf[:b] } // AnimcursoreltListBytes writes a list of Animcursorelt values to a byte slice. @@ -144,7 +144,7 @@ func (v Color) Bytes() []byte { xgb.Put16(buf[b:], v.Alpha) b += 2 - return buf + return buf[:b] } // ColorListBytes writes a list of Color values to a byte slice. @@ -256,7 +256,7 @@ func (v Directformat) Bytes() []byte { xgb.Put16(buf[b:], v.AlphaMask) b += 2 - return buf + return buf[:b] } // DirectformatListBytes writes a list of Directformat values to a byte slice. @@ -434,7 +434,7 @@ func (v Glyphinfo) Bytes() []byte { xgb.Put16(buf[b:], uint16(v.YOff)) b += 2 - return buf + return buf[:b] } // GlyphinfoListBytes writes a list of Glyphinfo values to a byte slice. @@ -519,7 +519,7 @@ func (v Indexvalue) Bytes() []byte { xgb.Put16(buf[b:], v.Alpha) b += 2 - return buf + return buf[:b] } // IndexvalueListBytes writes a list of Indexvalue values to a byte slice. @@ -579,7 +579,7 @@ func (v Linefix) Bytes() []byte { b += len(structBytes) } - return buf + return buf[:b] } // LinefixListBytes writes a list of Linefix values to a byte slice. @@ -802,7 +802,7 @@ func (v Pictdepth) Bytes() []byte { b += PictvisualListBytes(buf[b:], v.Visuals) - return buf + return buf[:b] } // PictdepthListBytes writes a list of Pictdepth values to a byte slice. @@ -904,7 +904,7 @@ func (v Pictforminfo) Bytes() []byte { xgb.Put32(buf[b:], uint32(v.Colormap)) b += 4 - return buf + return buf[:b] } // PictforminfoListBytes writes a list of Pictforminfo values to a byte slice. @@ -964,7 +964,7 @@ func (v Pictscreen) Bytes() []byte { b += PictdepthListBytes(buf[b:], v.Depths) - return buf + return buf[:b] } // PictscreenListBytes writes a list of Pictscreen values to a byte slice. @@ -1087,7 +1087,7 @@ func (v Pictvisual) Bytes() []byte { xgb.Put32(buf[b:], uint32(v.Format)) b += 4 - return buf + return buf[:b] } // PictvisualListBytes writes a list of Pictvisual values to a byte slice. @@ -1141,7 +1141,7 @@ func (v Pointfix) Bytes() []byte { xgb.Put32(buf[b:], uint32(v.Y)) b += 4 - return buf + return buf[:b] } // PointfixListBytes writes a list of Pointfix values to a byte slice. @@ -1219,7 +1219,7 @@ func (v Spanfix) Bytes() []byte { xgb.Put32(buf[b:], uint32(v.Y)) b += 4 - return buf + return buf[:b] } // SpanfixListBytes writes a list of Spanfix values to a byte slice. @@ -1331,7 +1331,7 @@ func (v Transform) Bytes() []byte { xgb.Put32(buf[b:], uint32(v.Matrix33)) b += 4 - return buf + return buf[:b] } // TransformListBytes writes a list of Transform values to a byte slice. @@ -1391,7 +1391,7 @@ func (v Trap) Bytes() []byte { b += len(structBytes) } - return buf + return buf[:b] } // TrapListBytes writes a list of Trap values to a byte slice. @@ -1465,7 +1465,7 @@ func (v Trapezoid) Bytes() []byte { b += len(structBytes) } - return buf + return buf[:b] } // TrapezoidListBytes writes a list of Trapezoid values to a byte slice. @@ -1535,7 +1535,7 @@ func (v Triangle) Bytes() []byte { b += len(structBytes) } - return buf + return buf[:b] } // TriangleListBytes writes a list of Triangle values to a byte slice. @@ -1610,7 +1610,7 @@ func (cook AddGlyphsCookie) Check() error { // Write request to wire for AddGlyphs // addGlyphsRequest writes a AddGlyphs request to a byte slice. func addGlyphsRequest(c *xgb.Conn, Glyphset Glyphset, GlyphsLen uint32, Glyphids []uint32, Glyphs []Glyphinfo, Data []byte) []byte { - size := xgb.Pad((((12 + xgb.Pad((int(GlyphsLen) * 4))) + xgb.Pad((int(GlyphsLen) * 12))) + xgb.Pad((len(Data) * 1)))) + size := xgb.Pad(((((12 + xgb.Pad((int(GlyphsLen) * 4))) + 4) + xgb.Pad((int(GlyphsLen) * 12))) + xgb.Pad((len(Data) * 1)))) b := 0 buf := make([]byte, size) @@ -1620,7 +1620,7 @@ func addGlyphsRequest(c *xgb.Conn, Glyphset Glyphset, GlyphsLen uint32, Glyphids buf[b] = 20 // request opcode b += 1 - xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + blen := b b += 2 xgb.Put32(buf[b:], uint32(Glyphset)) @@ -1633,14 +1633,17 @@ func addGlyphsRequest(c *xgb.Conn, Glyphset Glyphset, GlyphsLen uint32, Glyphids xgb.Put32(buf[b:], Glyphids[i]) b += 4 } - b = xgb.Pad(b) + + b = (b + 3) & ^3 // alignment gap b += GlyphinfoListBytes(buf[b:], Glyphs) copy(buf[b:], Data[:len(Data)]) - b += xgb.Pad(int(len(Data))) + b += int(len(Data)) - return buf + b = xgb.Pad(b) + xgb.Put16(buf[blen:], uint16(b/4)) // write request size in 4-byte units + return buf[:b] } // AddTrapsCookie is a cookie used only for AddTraps requests. @@ -1932,7 +1935,7 @@ func compositeGlyphs16Request(c *xgb.Conn, Op byte, Src Picture, Dst Picture, Ma b += 2 copy(buf[b:], Glyphcmds[:len(Glyphcmds)]) - b += xgb.Pad(int(len(Glyphcmds))) + b += int(len(Glyphcmds)) return buf } @@ -2010,7 +2013,7 @@ func compositeGlyphs32Request(c *xgb.Conn, Op byte, Src Picture, Dst Picture, Ma b += 2 copy(buf[b:], Glyphcmds[:len(Glyphcmds)]) - b += xgb.Pad(int(len(Glyphcmds))) + b += int(len(Glyphcmds)) return buf } @@ -2088,7 +2091,7 @@ func compositeGlyphs8Request(c *xgb.Conn, Op byte, Src Picture, Dst Picture, Mas b += 2 copy(buf[b:], Glyphcmds[:len(Glyphcmds)]) - b += xgb.Pad(int(len(Glyphcmds))) + b += int(len(Glyphcmds)) return buf } @@ -2186,7 +2189,7 @@ func (cook CreateConicalGradientCookie) Check() error { // Write request to wire for CreateConicalGradient // createConicalGradientRequest writes a CreateConicalGradient request to a byte slice. func createConicalGradientRequest(c *xgb.Conn, Picture Picture, Center Pointfix, Angle Fixed, NumStops uint32, Stops []Fixed, Colors []Color) []byte { - size := xgb.Pad(((24 + xgb.Pad((int(NumStops) * 4))) + xgb.Pad((int(NumStops) * 8)))) + size := xgb.Pad((((24 + xgb.Pad((int(NumStops) * 4))) + 4) + xgb.Pad((int(NumStops) * 8)))) b := 0 buf := make([]byte, size) @@ -2196,7 +2199,7 @@ func createConicalGradientRequest(c *xgb.Conn, Picture Picture, Center Pointfix, buf[b] = 36 // request opcode b += 1 - xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + blen := b b += 2 xgb.Put32(buf[b:], uint32(Picture)) @@ -2218,11 +2221,14 @@ func createConicalGradientRequest(c *xgb.Conn, Picture Picture, Center Pointfix, xgb.Put32(buf[b:], uint32(Stops[i])) b += 4 } - b = xgb.Pad(b) + + b = (b + 3) & ^3 // alignment gap b += ColorListBytes(buf[b:], Colors) - return buf + b = xgb.Pad(b) + xgb.Put16(buf[blen:], uint16(b/4)) // write request size in 4-byte units + return buf[:b] } // CreateCursorCookie is a cookie used only for CreateCursor requests. @@ -2383,7 +2389,7 @@ func (cook CreateLinearGradientCookie) Check() error { // Write request to wire for CreateLinearGradient // createLinearGradientRequest writes a CreateLinearGradient request to a byte slice. func createLinearGradientRequest(c *xgb.Conn, Picture Picture, P1 Pointfix, P2 Pointfix, NumStops uint32, Stops []Fixed, Colors []Color) []byte { - size := xgb.Pad(((28 + xgb.Pad((int(NumStops) * 4))) + xgb.Pad((int(NumStops) * 8)))) + size := xgb.Pad((((28 + xgb.Pad((int(NumStops) * 4))) + 4) + xgb.Pad((int(NumStops) * 8)))) b := 0 buf := make([]byte, size) @@ -2393,7 +2399,7 @@ func createLinearGradientRequest(c *xgb.Conn, Picture Picture, P1 Pointfix, P2 P buf[b] = 34 // request opcode b += 1 - xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + blen := b b += 2 xgb.Put32(buf[b:], uint32(Picture)) @@ -2418,11 +2424,14 @@ func createLinearGradientRequest(c *xgb.Conn, Picture Picture, P1 Pointfix, P2 P xgb.Put32(buf[b:], uint32(Stops[i])) b += 4 } - b = xgb.Pad(b) + + b = (b + 3) & ^3 // alignment gap b += ColorListBytes(buf[b:], Colors) - return buf + b = xgb.Pad(b) + xgb.Put16(buf[blen:], uint16(b/4)) // write request size in 4-byte units + return buf[:b] } // CreatePictureCookie is a cookie used only for CreatePicture requests. @@ -2530,7 +2539,7 @@ func (cook CreateRadialGradientCookie) Check() error { // Write request to wire for CreateRadialGradient // createRadialGradientRequest writes a CreateRadialGradient request to a byte slice. func createRadialGradientRequest(c *xgb.Conn, Picture Picture, Inner Pointfix, Outer Pointfix, InnerRadius Fixed, OuterRadius Fixed, NumStops uint32, Stops []Fixed, Colors []Color) []byte { - size := xgb.Pad(((36 + xgb.Pad((int(NumStops) * 4))) + xgb.Pad((int(NumStops) * 8)))) + size := xgb.Pad((((36 + xgb.Pad((int(NumStops) * 4))) + 4) + xgb.Pad((int(NumStops) * 8)))) b := 0 buf := make([]byte, size) @@ -2540,7 +2549,7 @@ func createRadialGradientRequest(c *xgb.Conn, Picture Picture, Inner Pointfix, O buf[b] = 35 // request opcode b += 1 - xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + blen := b b += 2 xgb.Put32(buf[b:], uint32(Picture)) @@ -2571,11 +2580,14 @@ func createRadialGradientRequest(c *xgb.Conn, Picture Picture, Inner Pointfix, O xgb.Put32(buf[b:], uint32(Stops[i])) b += 4 } - b = xgb.Pad(b) + + b = (b + 3) & ^3 // alignment gap b += ColorListBytes(buf[b:], Colors) - return buf + b = xgb.Pad(b) + xgb.Put16(buf[blen:], uint16(b/4)) // write request size in 4-byte units + return buf[:b] } // CreateSolidFillCookie is a cookie used only for CreateSolidFill requests. @@ -2818,7 +2830,6 @@ func freeGlyphsRequest(c *xgb.Conn, Glyphset Glyphset, Glyphs []Glyph) []byte { xgb.Put32(buf[b:], uint32(Glyphs[i])) b += 4 } - b = xgb.Pad(b) return buf } @@ -2955,7 +2966,6 @@ func queryFiltersReply(buf []byte) *QueryFiltersReply { v.Aliases[i] = xgb.Get16(buf[b:]) b += 2 } - b = xgb.Pad(b) v.Filters = make([]xproto.Str, v.NumFilters) b += xproto.StrReadList(buf[b:], v.Filters) @@ -3023,9 +3033,11 @@ type QueryPictFormatsReply struct { NumVisuals uint32 NumSubpixel uint32 // padding: 4 bytes - Formats []Pictforminfo // size: xgb.Pad((int(NumFormats) * 28)) - Screens []Pictscreen // size: PictscreenListSize(Screens) - Subpixels []uint32 // size: xgb.Pad((int(NumSubpixel) * 4)) + Formats []Pictforminfo // size: xgb.Pad((int(NumFormats) * 28)) + // alignment gap to multiple of 4 + Screens []Pictscreen // size: PictscreenListSize(Screens) + // alignment gap to multiple of 4 + Subpixels []uint32 // size: xgb.Pad((int(NumSubpixel) * 4)) } // Reply blocks and returns the reply data for a QueryPictFormats request. @@ -3073,15 +3085,18 @@ func queryPictFormatsReply(buf []byte) *QueryPictFormatsReply { v.Formats = make([]Pictforminfo, v.NumFormats) b += PictforminfoReadList(buf[b:], v.Formats) + b = (b + 3) & ^3 // alignment gap + v.Screens = make([]Pictscreen, v.NumScreens) b += PictscreenReadList(buf[b:], v.Screens) + b = (b + 3) & ^3 // alignment gap + v.Subpixels = make([]uint32, v.NumSubpixel) for i := 0; i < int(v.NumSubpixel); i++ { v.Subpixels[i] = xgb.Get32(buf[b:]) b += 4 } - b = xgb.Pad(b) return v } @@ -3455,7 +3470,7 @@ func (cook SetPictureFilterCookie) Check() error { // Write request to wire for SetPictureFilter // setPictureFilterRequest writes a SetPictureFilter request to a byte slice. func setPictureFilterRequest(c *xgb.Conn, Picture Picture, FilterLen uint16, Filter string, Values []Fixed) []byte { - size := xgb.Pad(((12 + xgb.Pad((int(FilterLen) * 1))) + xgb.Pad((len(Values) * 4)))) + size := xgb.Pad((((12 + xgb.Pad((int(FilterLen) * 1))) + 4) + xgb.Pad((len(Values) * 4)))) b := 0 buf := make([]byte, size) @@ -3465,7 +3480,7 @@ func setPictureFilterRequest(c *xgb.Conn, Picture Picture, FilterLen uint16, Fil buf[b] = 30 // request opcode b += 1 - xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + blen := b b += 2 xgb.Put32(buf[b:], uint32(Picture)) @@ -3477,15 +3492,18 @@ func setPictureFilterRequest(c *xgb.Conn, Picture Picture, FilterLen uint16, Fil b += 2 // padding copy(buf[b:], Filter[:FilterLen]) - b += xgb.Pad(int(FilterLen)) + b += int(FilterLen) + + b = (b + 3) & ^3 // alignment gap for i := 0; i < int(len(Values)); i++ { xgb.Put32(buf[b:], uint32(Values[i])) b += 4 } - b = xgb.Pad(b) - return buf + b = xgb.Pad(b) + xgb.Put16(buf[blen:], uint16(b/4)) // write request size in 4-byte units + return buf[:b] } // SetPictureTransformCookie is a cookie used only for SetPictureTransform requests. -- cgit v1.2.3 From becaf43dcb3e9832c3eb951ff9908ed697868152 Mon Sep 17 00:00:00 2001 From: aarzilli Date: Tue, 1 Mar 2016 15:41:38 +0100 Subject: Read/Write mutex for Extensions map --- nexgb/render/render.go | 191 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 188 insertions(+), 3 deletions(-) (limited to 'nexgb/render') diff --git a/nexgb/render/render.go b/nexgb/render/render.go index f90065b..e15bd67 100644 --- a/nexgb/render/render.go +++ b/nexgb/render/render.go @@ -19,16 +19,15 @@ func Init(c *xgb.Conn) error { return xgb.Errorf("No extension named RENDER could be found on on the server.") } - xgb.ExtLock.Lock() + c.ExtLock.Lock() c.Extensions["RENDER"] = reply.MajorOpcode + c.ExtLock.Unlock() for evNum, fun := range xgb.NewExtEventFuncs["RENDER"] { xgb.NewEventFuncs[int(reply.FirstEvent)+evNum] = fun } for errNum, fun := range xgb.NewExtErrorFuncs["RENDER"] { xgb.NewErrorFuncs[int(reply.FirstError)+errNum] = fun } - xgb.ExtLock.Unlock() - return nil } @@ -1582,6 +1581,8 @@ type AddGlyphsCookie struct { // AddGlyphs sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func AddGlyphs(c *xgb.Conn, Glyphset Glyphset, GlyphsLen uint32, Glyphids []uint32, Glyphs []Glyphinfo, Data []byte) AddGlyphsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'AddGlyphs' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -1593,6 +1594,8 @@ func AddGlyphs(c *xgb.Conn, Glyphset Glyphset, GlyphsLen uint32, Glyphids []uint // AddGlyphsChecked sends a checked request. // If an error occurs, it can be retrieved using AddGlyphsCookie.Check() func AddGlyphsChecked(c *xgb.Conn, Glyphset Glyphset, GlyphsLen uint32, Glyphids []uint32, Glyphs []Glyphinfo, Data []byte) AddGlyphsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'AddGlyphs' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -1614,7 +1617,9 @@ func addGlyphsRequest(c *xgb.Conn, Glyphset Glyphset, GlyphsLen uint32, Glyphids b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 20 // request opcode @@ -1654,6 +1659,8 @@ type AddTrapsCookie struct { // AddTraps sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func AddTraps(c *xgb.Conn, Picture Picture, XOff int16, YOff int16, Traps []Trap) AddTrapsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'AddTraps' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -1665,6 +1672,8 @@ func AddTraps(c *xgb.Conn, Picture Picture, XOff int16, YOff int16, Traps []Trap // AddTrapsChecked sends a checked request. // If an error occurs, it can be retrieved using AddTrapsCookie.Check() func AddTrapsChecked(c *xgb.Conn, Picture Picture, XOff int16, YOff int16, Traps []Trap) AddTrapsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'AddTraps' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -1686,7 +1695,9 @@ func addTrapsRequest(c *xgb.Conn, Picture Picture, XOff int16, YOff int16, Traps b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 32 // request opcode @@ -1717,6 +1728,8 @@ type ChangePictureCookie struct { // ChangePicture sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ChangePicture(c *xgb.Conn, Picture Picture, ValueMask uint32, ValueList []uint32) ChangePictureCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'ChangePicture' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -1728,6 +1741,8 @@ func ChangePicture(c *xgb.Conn, Picture Picture, ValueMask uint32, ValueList []u // ChangePictureChecked sends a checked request. // If an error occurs, it can be retrieved using ChangePictureCookie.Check() func ChangePictureChecked(c *xgb.Conn, Picture Picture, ValueMask uint32, ValueList []uint32) ChangePictureCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'ChangePicture' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -1749,7 +1764,9 @@ func changePictureRequest(c *xgb.Conn, Picture Picture, ValueMask uint32, ValueL b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 5 // request opcode @@ -1780,6 +1797,8 @@ type CompositeCookie struct { // Composite sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func Composite(c *xgb.Conn, Op byte, Src Picture, Mask Picture, Dst Picture, SrcX int16, SrcY int16, MaskX int16, MaskY int16, DstX int16, DstY int16, Width uint16, Height uint16) CompositeCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'Composite' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -1791,6 +1810,8 @@ func Composite(c *xgb.Conn, Op byte, Src Picture, Mask Picture, Dst Picture, Src // CompositeChecked sends a checked request. // If an error occurs, it can be retrieved using CompositeCookie.Check() func CompositeChecked(c *xgb.Conn, Op byte, Src Picture, Mask Picture, Dst Picture, SrcX int16, SrcY int16, MaskX int16, MaskY int16, DstX int16, DstY int16, Width uint16, Height uint16) CompositeCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'Composite' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -1812,7 +1833,9 @@ func compositeRequest(c *xgb.Conn, Op byte, Src Picture, Mask Picture, Dst Pictu b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 8 // request opcode @@ -1870,6 +1893,8 @@ type CompositeGlyphs16Cookie struct { // CompositeGlyphs16 sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CompositeGlyphs16(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) CompositeGlyphs16Cookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'CompositeGlyphs16' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -1881,6 +1906,8 @@ func CompositeGlyphs16(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskForma // CompositeGlyphs16Checked sends a checked request. // If an error occurs, it can be retrieved using CompositeGlyphs16Cookie.Check() func CompositeGlyphs16Checked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) CompositeGlyphs16Cookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'CompositeGlyphs16' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -1902,7 +1929,9 @@ func compositeGlyphs16Request(c *xgb.Conn, Op byte, Src Picture, Dst Picture, Ma b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 24 // request opcode @@ -1948,6 +1977,8 @@ type CompositeGlyphs32Cookie struct { // CompositeGlyphs32 sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CompositeGlyphs32(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) CompositeGlyphs32Cookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'CompositeGlyphs32' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -1959,6 +1990,8 @@ func CompositeGlyphs32(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskForma // CompositeGlyphs32Checked sends a checked request. // If an error occurs, it can be retrieved using CompositeGlyphs32Cookie.Check() func CompositeGlyphs32Checked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) CompositeGlyphs32Cookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'CompositeGlyphs32' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -1980,7 +2013,9 @@ func compositeGlyphs32Request(c *xgb.Conn, Op byte, Src Picture, Dst Picture, Ma b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 25 // request opcode @@ -2026,6 +2061,8 @@ type CompositeGlyphs8Cookie struct { // CompositeGlyphs8 sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CompositeGlyphs8(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) CompositeGlyphs8Cookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'CompositeGlyphs8' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2037,6 +2074,8 @@ func CompositeGlyphs8(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat // CompositeGlyphs8Checked sends a checked request. // If an error occurs, it can be retrieved using CompositeGlyphs8Cookie.Check() func CompositeGlyphs8Checked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) CompositeGlyphs8Cookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'CompositeGlyphs8' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2058,7 +2097,9 @@ func compositeGlyphs8Request(c *xgb.Conn, Op byte, Src Picture, Dst Picture, Mas b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 23 // request opcode @@ -2104,6 +2145,8 @@ type CreateAnimCursorCookie struct { // CreateAnimCursor sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateAnimCursor(c *xgb.Conn, Cid xproto.Cursor, Cursors []Animcursorelt) CreateAnimCursorCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'CreateAnimCursor' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2115,6 +2158,8 @@ func CreateAnimCursor(c *xgb.Conn, Cid xproto.Cursor, Cursors []Animcursorelt) C // CreateAnimCursorChecked sends a checked request. // If an error occurs, it can be retrieved using CreateAnimCursorCookie.Check() func CreateAnimCursorChecked(c *xgb.Conn, Cid xproto.Cursor, Cursors []Animcursorelt) CreateAnimCursorCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'CreateAnimCursor' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2136,7 +2181,9 @@ func createAnimCursorRequest(c *xgb.Conn, Cid xproto.Cursor, Cursors []Animcurso b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 31 // request opcode @@ -2161,6 +2208,8 @@ type CreateConicalGradientCookie struct { // CreateConicalGradient sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateConicalGradient(c *xgb.Conn, Picture Picture, Center Pointfix, Angle Fixed, NumStops uint32, Stops []Fixed, Colors []Color) CreateConicalGradientCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'CreateConicalGradient' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2172,6 +2221,8 @@ func CreateConicalGradient(c *xgb.Conn, Picture Picture, Center Pointfix, Angle // CreateConicalGradientChecked sends a checked request. // If an error occurs, it can be retrieved using CreateConicalGradientCookie.Check() func CreateConicalGradientChecked(c *xgb.Conn, Picture Picture, Center Pointfix, Angle Fixed, NumStops uint32, Stops []Fixed, Colors []Color) CreateConicalGradientCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'CreateConicalGradient' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2193,7 +2244,9 @@ func createConicalGradientRequest(c *xgb.Conn, Picture Picture, Center Pointfix, b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 36 // request opcode @@ -2239,6 +2292,8 @@ type CreateCursorCookie struct { // CreateCursor sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateCursor(c *xgb.Conn, Cid xproto.Cursor, Source Picture, X uint16, Y uint16) CreateCursorCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'CreateCursor' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2250,6 +2305,8 @@ func CreateCursor(c *xgb.Conn, Cid xproto.Cursor, Source Picture, X uint16, Y ui // CreateCursorChecked sends a checked request. // If an error occurs, it can be retrieved using CreateCursorCookie.Check() func CreateCursorChecked(c *xgb.Conn, Cid xproto.Cursor, Source Picture, X uint16, Y uint16) CreateCursorCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'CreateCursor' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2271,7 +2328,9 @@ func createCursorRequest(c *xgb.Conn, Cid xproto.Cursor, Source Picture, X uint1 b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 27 // request opcode @@ -2303,6 +2362,8 @@ type CreateGlyphSetCookie struct { // CreateGlyphSet sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateGlyphSet(c *xgb.Conn, Gsid Glyphset, Format Pictformat) CreateGlyphSetCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'CreateGlyphSet' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2314,6 +2375,8 @@ func CreateGlyphSet(c *xgb.Conn, Gsid Glyphset, Format Pictformat) CreateGlyphSe // CreateGlyphSetChecked sends a checked request. // If an error occurs, it can be retrieved using CreateGlyphSetCookie.Check() func CreateGlyphSetChecked(c *xgb.Conn, Gsid Glyphset, Format Pictformat) CreateGlyphSetCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'CreateGlyphSet' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2335,7 +2398,9 @@ func createGlyphSetRequest(c *xgb.Conn, Gsid Glyphset, Format Pictformat) []byte b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 17 // request opcode @@ -2361,6 +2426,8 @@ type CreateLinearGradientCookie struct { // CreateLinearGradient sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateLinearGradient(c *xgb.Conn, Picture Picture, P1 Pointfix, P2 Pointfix, NumStops uint32, Stops []Fixed, Colors []Color) CreateLinearGradientCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'CreateLinearGradient' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2372,6 +2439,8 @@ func CreateLinearGradient(c *xgb.Conn, Picture Picture, P1 Pointfix, P2 Pointfix // CreateLinearGradientChecked sends a checked request. // If an error occurs, it can be retrieved using CreateLinearGradientCookie.Check() func CreateLinearGradientChecked(c *xgb.Conn, Picture Picture, P1 Pointfix, P2 Pointfix, NumStops uint32, Stops []Fixed, Colors []Color) CreateLinearGradientCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'CreateLinearGradient' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2393,7 +2462,9 @@ func createLinearGradientRequest(c *xgb.Conn, Picture Picture, P1 Pointfix, P2 P b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 34 // request opcode @@ -2442,6 +2513,8 @@ type CreatePictureCookie struct { // CreatePicture sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreatePicture(c *xgb.Conn, Pid Picture, Drawable xproto.Drawable, Format Pictformat, ValueMask uint32, ValueList []uint32) CreatePictureCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'CreatePicture' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2453,6 +2526,8 @@ func CreatePicture(c *xgb.Conn, Pid Picture, Drawable xproto.Drawable, Format Pi // CreatePictureChecked sends a checked request. // If an error occurs, it can be retrieved using CreatePictureCookie.Check() func CreatePictureChecked(c *xgb.Conn, Pid Picture, Drawable xproto.Drawable, Format Pictformat, ValueMask uint32, ValueList []uint32) CreatePictureCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'CreatePicture' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2474,7 +2549,9 @@ func createPictureRequest(c *xgb.Conn, Pid Picture, Drawable xproto.Drawable, Fo b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 4 // request opcode @@ -2511,6 +2588,8 @@ type CreateRadialGradientCookie struct { // CreateRadialGradient sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateRadialGradient(c *xgb.Conn, Picture Picture, Inner Pointfix, Outer Pointfix, InnerRadius Fixed, OuterRadius Fixed, NumStops uint32, Stops []Fixed, Colors []Color) CreateRadialGradientCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'CreateRadialGradient' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2522,6 +2601,8 @@ func CreateRadialGradient(c *xgb.Conn, Picture Picture, Inner Pointfix, Outer Po // CreateRadialGradientChecked sends a checked request. // If an error occurs, it can be retrieved using CreateRadialGradientCookie.Check() func CreateRadialGradientChecked(c *xgb.Conn, Picture Picture, Inner Pointfix, Outer Pointfix, InnerRadius Fixed, OuterRadius Fixed, NumStops uint32, Stops []Fixed, Colors []Color) CreateRadialGradientCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'CreateRadialGradient' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2543,7 +2624,9 @@ func createRadialGradientRequest(c *xgb.Conn, Picture Picture, Inner Pointfix, O b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 35 // request opcode @@ -2598,6 +2681,8 @@ type CreateSolidFillCookie struct { // CreateSolidFill sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateSolidFill(c *xgb.Conn, Picture Picture, Color Color) CreateSolidFillCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'CreateSolidFill' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2609,6 +2694,8 @@ func CreateSolidFill(c *xgb.Conn, Picture Picture, Color Color) CreateSolidFillC // CreateSolidFillChecked sends a checked request. // If an error occurs, it can be retrieved using CreateSolidFillCookie.Check() func CreateSolidFillChecked(c *xgb.Conn, Picture Picture, Color Color) CreateSolidFillCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'CreateSolidFill' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2630,7 +2717,9 @@ func createSolidFillRequest(c *xgb.Conn, Picture Picture, Color Color) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 33 // request opcode @@ -2659,6 +2748,8 @@ type FillRectanglesCookie struct { // FillRectangles sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func FillRectangles(c *xgb.Conn, Op byte, Dst Picture, Color Color, Rects []xproto.Rectangle) FillRectanglesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'FillRectangles' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2670,6 +2761,8 @@ func FillRectangles(c *xgb.Conn, Op byte, Dst Picture, Color Color, Rects []xpro // FillRectanglesChecked sends a checked request. // If an error occurs, it can be retrieved using FillRectanglesCookie.Check() func FillRectanglesChecked(c *xgb.Conn, Op byte, Dst Picture, Color Color, Rects []xproto.Rectangle) FillRectanglesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'FillRectangles' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2691,7 +2784,9 @@ func fillRectanglesRequest(c *xgb.Conn, Op byte, Dst Picture, Color Color, Rects b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 26 // request opcode @@ -2727,6 +2822,8 @@ type FreeGlyphSetCookie struct { // FreeGlyphSet sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func FreeGlyphSet(c *xgb.Conn, Glyphset Glyphset) FreeGlyphSetCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'FreeGlyphSet' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2738,6 +2835,8 @@ func FreeGlyphSet(c *xgb.Conn, Glyphset Glyphset) FreeGlyphSetCookie { // FreeGlyphSetChecked sends a checked request. // If an error occurs, it can be retrieved using FreeGlyphSetCookie.Check() func FreeGlyphSetChecked(c *xgb.Conn, Glyphset Glyphset) FreeGlyphSetCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'FreeGlyphSet' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2759,7 +2858,9 @@ func freeGlyphSetRequest(c *xgb.Conn, Glyphset Glyphset) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 19 // request opcode @@ -2782,6 +2883,8 @@ type FreeGlyphsCookie struct { // FreeGlyphs sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func FreeGlyphs(c *xgb.Conn, Glyphset Glyphset, Glyphs []Glyph) FreeGlyphsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'FreeGlyphs' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2793,6 +2896,8 @@ func FreeGlyphs(c *xgb.Conn, Glyphset Glyphset, Glyphs []Glyph) FreeGlyphsCookie // FreeGlyphsChecked sends a checked request. // If an error occurs, it can be retrieved using FreeGlyphsCookie.Check() func FreeGlyphsChecked(c *xgb.Conn, Glyphset Glyphset, Glyphs []Glyph) FreeGlyphsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'FreeGlyphs' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2814,7 +2919,9 @@ func freeGlyphsRequest(c *xgb.Conn, Glyphset Glyphset, Glyphs []Glyph) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 22 // request opcode @@ -2842,6 +2949,8 @@ type FreePictureCookie struct { // FreePicture sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func FreePicture(c *xgb.Conn, Picture Picture) FreePictureCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'FreePicture' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2853,6 +2962,8 @@ func FreePicture(c *xgb.Conn, Picture Picture) FreePictureCookie { // FreePictureChecked sends a checked request. // If an error occurs, it can be retrieved using FreePictureCookie.Check() func FreePictureChecked(c *xgb.Conn, Picture Picture) FreePictureCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'FreePicture' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2874,7 +2985,9 @@ func freePictureRequest(c *xgb.Conn, Picture Picture) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 7 // request opcode @@ -2897,6 +3010,8 @@ type QueryFiltersCookie struct { // QueryFilters sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryFiltersCookie.Reply() func QueryFilters(c *xgb.Conn, Drawable xproto.Drawable) QueryFiltersCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'QueryFilters' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2908,6 +3023,8 @@ func QueryFilters(c *xgb.Conn, Drawable xproto.Drawable) QueryFiltersCookie { // QueryFiltersUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryFiltersUnchecked(c *xgb.Conn, Drawable xproto.Drawable) QueryFiltersCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'QueryFilters' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -2980,7 +3097,9 @@ func queryFiltersRequest(c *xgb.Conn, Drawable xproto.Drawable) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 29 // request opcode @@ -3003,6 +3122,8 @@ type QueryPictFormatsCookie struct { // QueryPictFormats sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryPictFormatsCookie.Reply() func QueryPictFormats(c *xgb.Conn) QueryPictFormatsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'QueryPictFormats' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -3014,6 +3135,8 @@ func QueryPictFormats(c *xgb.Conn) QueryPictFormatsCookie { // QueryPictFormatsUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryPictFormatsUnchecked(c *xgb.Conn) QueryPictFormatsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'QueryPictFormats' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -3108,7 +3231,9 @@ func queryPictFormatsRequest(c *xgb.Conn) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 1 // request opcode @@ -3128,6 +3253,8 @@ type QueryPictIndexValuesCookie struct { // QueryPictIndexValues sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryPictIndexValuesCookie.Reply() func QueryPictIndexValues(c *xgb.Conn, Format Pictformat) QueryPictIndexValuesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'QueryPictIndexValues' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -3139,6 +3266,8 @@ func QueryPictIndexValues(c *xgb.Conn, Format Pictformat) QueryPictIndexValuesCo // QueryPictIndexValuesUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryPictIndexValuesUnchecked(c *xgb.Conn, Format Pictformat) QueryPictIndexValuesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'QueryPictIndexValues' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -3200,7 +3329,9 @@ func queryPictIndexValuesRequest(c *xgb.Conn, Format Pictformat) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 2 // request opcode @@ -3223,6 +3354,8 @@ type QueryVersionCookie struct { // 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, ClientMajorVersion uint32, ClientMinorVersion uint32) QueryVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -3234,6 +3367,8 @@ func QueryVersion(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVersion uin // QueryVersionUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryVersionUnchecked(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVersion uint32) QueryVersionCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -3295,7 +3430,9 @@ func queryVersionRequest(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVers b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 0 // request opcode @@ -3321,6 +3458,8 @@ type ReferenceGlyphSetCookie struct { // ReferenceGlyphSet sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ReferenceGlyphSet(c *xgb.Conn, Gsid Glyphset, Existing Glyphset) ReferenceGlyphSetCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'ReferenceGlyphSet' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -3332,6 +3471,8 @@ func ReferenceGlyphSet(c *xgb.Conn, Gsid Glyphset, Existing Glyphset) ReferenceG // ReferenceGlyphSetChecked sends a checked request. // If an error occurs, it can be retrieved using ReferenceGlyphSetCookie.Check() func ReferenceGlyphSetChecked(c *xgb.Conn, Gsid Glyphset, Existing Glyphset) ReferenceGlyphSetCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'ReferenceGlyphSet' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -3353,7 +3494,9 @@ func referenceGlyphSetRequest(c *xgb.Conn, Gsid Glyphset, Existing Glyphset) []b b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 18 // request opcode @@ -3379,6 +3522,8 @@ type SetPictureClipRectanglesCookie struct { // SetPictureClipRectangles sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetPictureClipRectangles(c *xgb.Conn, Picture Picture, ClipXOrigin int16, ClipYOrigin int16, Rectangles []xproto.Rectangle) SetPictureClipRectanglesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'SetPictureClipRectangles' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -3390,6 +3535,8 @@ func SetPictureClipRectangles(c *xgb.Conn, Picture Picture, ClipXOrigin int16, C // SetPictureClipRectanglesChecked sends a checked request. // If an error occurs, it can be retrieved using SetPictureClipRectanglesCookie.Check() func SetPictureClipRectanglesChecked(c *xgb.Conn, Picture Picture, ClipXOrigin int16, ClipYOrigin int16, Rectangles []xproto.Rectangle) SetPictureClipRectanglesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'SetPictureClipRectangles' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -3411,7 +3558,9 @@ func setPictureClipRectanglesRequest(c *xgb.Conn, Picture Picture, ClipXOrigin i b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 6 // request opcode @@ -3442,6 +3591,8 @@ type SetPictureFilterCookie struct { // SetPictureFilter sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetPictureFilter(c *xgb.Conn, Picture Picture, FilterLen uint16, Filter string, Values []Fixed) SetPictureFilterCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'SetPictureFilter' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -3453,6 +3604,8 @@ func SetPictureFilter(c *xgb.Conn, Picture Picture, FilterLen uint16, Filter str // SetPictureFilterChecked sends a checked request. // If an error occurs, it can be retrieved using SetPictureFilterCookie.Check() func SetPictureFilterChecked(c *xgb.Conn, Picture Picture, FilterLen uint16, Filter string, Values []Fixed) SetPictureFilterCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'SetPictureFilter' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -3474,7 +3627,9 @@ func setPictureFilterRequest(c *xgb.Conn, Picture Picture, FilterLen uint16, Fil b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 30 // request opcode @@ -3514,6 +3669,8 @@ type SetPictureTransformCookie struct { // SetPictureTransform sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetPictureTransform(c *xgb.Conn, Picture Picture, Transform Transform) SetPictureTransformCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'SetPictureTransform' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -3525,6 +3682,8 @@ func SetPictureTransform(c *xgb.Conn, Picture Picture, Transform Transform) SetP // SetPictureTransformChecked sends a checked request. // If an error occurs, it can be retrieved using SetPictureTransformCookie.Check() func SetPictureTransformChecked(c *xgb.Conn, Picture Picture, Transform Transform) SetPictureTransformCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'SetPictureTransform' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -3546,7 +3705,9 @@ func setPictureTransformRequest(c *xgb.Conn, Picture Picture, Transform Transfor b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 28 // request opcode @@ -3575,6 +3736,8 @@ type TrapezoidsCookie struct { // Trapezoids sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func Trapezoids(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Traps []Trapezoid) TrapezoidsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'Trapezoids' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -3586,6 +3749,8 @@ func Trapezoids(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictf // TrapezoidsChecked sends a checked request. // If an error occurs, it can be retrieved using TrapezoidsCookie.Check() func TrapezoidsChecked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Traps []Trapezoid) TrapezoidsCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'Trapezoids' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -3607,7 +3772,9 @@ func trapezoidsRequest(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskForma b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 10 // request opcode @@ -3649,6 +3816,8 @@ type TriFanCookie struct { // TriFan sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func TriFan(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Points []Pointfix) TriFanCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'TriFan' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -3660,6 +3829,8 @@ func TriFan(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictforma // TriFanChecked sends a checked request. // If an error occurs, it can be retrieved using TriFanCookie.Check() func TriFanChecked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Points []Pointfix) TriFanCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'TriFan' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -3681,7 +3852,9 @@ func triFanRequest(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pi b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 13 // request opcode @@ -3723,6 +3896,8 @@ type TriStripCookie struct { // TriStrip sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func TriStrip(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Points []Pointfix) TriStripCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'TriStrip' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -3734,6 +3909,8 @@ func TriStrip(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictfor // TriStripChecked sends a checked request. // If an error occurs, it can be retrieved using TriStripCookie.Check() func TriStripChecked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Points []Pointfix) TriStripCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'TriStrip' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -3755,7 +3932,9 @@ func triStripRequest(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 12 // request opcode @@ -3797,6 +3976,8 @@ type TrianglesCookie struct { // Triangles sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func Triangles(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Triangles []Triangle) TrianglesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'Triangles' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -3808,6 +3989,8 @@ func Triangles(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictfo // TrianglesChecked sends a checked request. // If an error occurs, it can be retrieved using TrianglesCookie.Check() func TrianglesChecked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Triangles []Triangle) TrianglesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["RENDER"]; !ok { panic("Cannot issue request 'Triangles' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.") } @@ -3829,7 +4012,9 @@ func trianglesRequest(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["RENDER"] + c.ExtLock.RUnlock() b += 1 buf[b] = 11 // request opcode -- cgit v1.2.3 From 3906399e7c2a40fbaf355de572cf50a314083f64 Mon Sep 17 00:00:00 2001 From: aarzilli Date: Wed, 18 Jan 2017 10:52:16 +0100 Subject: Regenerated from xcb-proto 1.12 --- nexgb/render/render.go | 58 +++++++++++++++++--------------------------------- 1 file changed, 19 insertions(+), 39 deletions(-) (limited to 'nexgb/render') diff --git a/nexgb/render/render.go b/nexgb/render/render.go index e15bd67..01ea481 100644 --- a/nexgb/render/render.go +++ b/nexgb/render/render.go @@ -1613,7 +1613,7 @@ func (cook AddGlyphsCookie) Check() error { // Write request to wire for AddGlyphs // addGlyphsRequest writes a AddGlyphs request to a byte slice. func addGlyphsRequest(c *xgb.Conn, Glyphset Glyphset, GlyphsLen uint32, Glyphids []uint32, Glyphs []Glyphinfo, Data []byte) []byte { - size := xgb.Pad(((((12 + xgb.Pad((int(GlyphsLen) * 4))) + 4) + xgb.Pad((int(GlyphsLen) * 12))) + xgb.Pad((len(Data) * 1)))) + size := xgb.Pad((((12 + xgb.Pad((int(GlyphsLen) * 4))) + xgb.Pad((int(GlyphsLen) * 12))) + xgb.Pad((len(Data) * 1)))) b := 0 buf := make([]byte, size) @@ -1625,7 +1625,7 @@ func addGlyphsRequest(c *xgb.Conn, Glyphset Glyphset, GlyphsLen uint32, Glyphids buf[b] = 20 // request opcode b += 1 - blen := b + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 xgb.Put32(buf[b:], uint32(Glyphset)) @@ -1639,16 +1639,12 @@ func addGlyphsRequest(c *xgb.Conn, Glyphset Glyphset, GlyphsLen uint32, Glyphids b += 4 } - b = (b + 3) & ^3 // alignment gap - b += GlyphinfoListBytes(buf[b:], Glyphs) copy(buf[b:], Data[:len(Data)]) b += int(len(Data)) - b = xgb.Pad(b) - xgb.Put16(buf[blen:], uint16(b/4)) // write request size in 4-byte units - return buf[:b] + return buf } // AddTrapsCookie is a cookie used only for AddTraps requests. @@ -1760,7 +1756,7 @@ func (cook ChangePictureCookie) Check() error { // Write request to wire for ChangePicture // changePictureRequest writes a ChangePicture request to a byte slice. func changePictureRequest(c *xgb.Conn, Picture Picture, ValueMask uint32, ValueList []uint32) []byte { - size := xgb.Pad((8 + (4 + xgb.Pad((4 * xgb.PopCount(int(ValueMask))))))) + size := xgb.Pad((12 + xgb.Pad((4 * xgb.PopCount(int(ValueMask)))))) b := 0 buf := make([]byte, size) @@ -1780,6 +1776,7 @@ func changePictureRequest(c *xgb.Conn, Picture Picture, ValueMask uint32, ValueL xgb.Put32(buf[b:], ValueMask) b += 4 + for i := 0; i < xgb.PopCount(int(ValueMask)); i++ { xgb.Put32(buf[b:], ValueList[i]) b += 4 @@ -2240,7 +2237,7 @@ func (cook CreateConicalGradientCookie) Check() error { // Write request to wire for CreateConicalGradient // createConicalGradientRequest writes a CreateConicalGradient request to a byte slice. func createConicalGradientRequest(c *xgb.Conn, Picture Picture, Center Pointfix, Angle Fixed, NumStops uint32, Stops []Fixed, Colors []Color) []byte { - size := xgb.Pad((((24 + xgb.Pad((int(NumStops) * 4))) + 4) + xgb.Pad((int(NumStops) * 8)))) + size := xgb.Pad(((24 + xgb.Pad((int(NumStops) * 4))) + xgb.Pad((int(NumStops) * 8)))) b := 0 buf := make([]byte, size) @@ -2252,7 +2249,7 @@ func createConicalGradientRequest(c *xgb.Conn, Picture Picture, Center Pointfix, buf[b] = 36 // request opcode b += 1 - blen := b + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 xgb.Put32(buf[b:], uint32(Picture)) @@ -2275,13 +2272,9 @@ func createConicalGradientRequest(c *xgb.Conn, Picture Picture, Center Pointfix, b += 4 } - b = (b + 3) & ^3 // alignment gap - b += ColorListBytes(buf[b:], Colors) - b = xgb.Pad(b) - xgb.Put16(buf[blen:], uint16(b/4)) // write request size in 4-byte units - return buf[:b] + return buf } // CreateCursorCookie is a cookie used only for CreateCursor requests. @@ -2458,7 +2451,7 @@ func (cook CreateLinearGradientCookie) Check() error { // Write request to wire for CreateLinearGradient // createLinearGradientRequest writes a CreateLinearGradient request to a byte slice. func createLinearGradientRequest(c *xgb.Conn, Picture Picture, P1 Pointfix, P2 Pointfix, NumStops uint32, Stops []Fixed, Colors []Color) []byte { - size := xgb.Pad((((28 + xgb.Pad((int(NumStops) * 4))) + 4) + xgb.Pad((int(NumStops) * 8)))) + size := xgb.Pad(((28 + xgb.Pad((int(NumStops) * 4))) + xgb.Pad((int(NumStops) * 8)))) b := 0 buf := make([]byte, size) @@ -2470,7 +2463,7 @@ func createLinearGradientRequest(c *xgb.Conn, Picture Picture, P1 Pointfix, P2 P buf[b] = 34 // request opcode b += 1 - blen := b + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 xgb.Put32(buf[b:], uint32(Picture)) @@ -2496,13 +2489,9 @@ func createLinearGradientRequest(c *xgb.Conn, Picture Picture, P1 Pointfix, P2 P b += 4 } - b = (b + 3) & ^3 // alignment gap - b += ColorListBytes(buf[b:], Colors) - b = xgb.Pad(b) - xgb.Put16(buf[blen:], uint16(b/4)) // write request size in 4-byte units - return buf[:b] + return buf } // CreatePictureCookie is a cookie used only for CreatePicture requests. @@ -2545,7 +2534,7 @@ func (cook CreatePictureCookie) Check() error { // Write request to wire for CreatePicture // createPictureRequest writes a CreatePicture request to a byte slice. func createPictureRequest(c *xgb.Conn, Pid Picture, Drawable xproto.Drawable, Format Pictformat, ValueMask uint32, ValueList []uint32) []byte { - size := xgb.Pad((16 + (4 + xgb.Pad((4 * xgb.PopCount(int(ValueMask))))))) + size := xgb.Pad((20 + xgb.Pad((4 * xgb.PopCount(int(ValueMask)))))) b := 0 buf := make([]byte, size) @@ -2571,6 +2560,7 @@ func createPictureRequest(c *xgb.Conn, Pid Picture, Drawable xproto.Drawable, Fo xgb.Put32(buf[b:], ValueMask) b += 4 + for i := 0; i < xgb.PopCount(int(ValueMask)); i++ { xgb.Put32(buf[b:], ValueList[i]) b += 4 @@ -2620,7 +2610,7 @@ func (cook CreateRadialGradientCookie) Check() error { // Write request to wire for CreateRadialGradient // createRadialGradientRequest writes a CreateRadialGradient request to a byte slice. func createRadialGradientRequest(c *xgb.Conn, Picture Picture, Inner Pointfix, Outer Pointfix, InnerRadius Fixed, OuterRadius Fixed, NumStops uint32, Stops []Fixed, Colors []Color) []byte { - size := xgb.Pad((((36 + xgb.Pad((int(NumStops) * 4))) + 4) + xgb.Pad((int(NumStops) * 8)))) + size := xgb.Pad(((36 + xgb.Pad((int(NumStops) * 4))) + xgb.Pad((int(NumStops) * 8)))) b := 0 buf := make([]byte, size) @@ -2632,7 +2622,7 @@ func createRadialGradientRequest(c *xgb.Conn, Picture Picture, Inner Pointfix, O buf[b] = 35 // request opcode b += 1 - blen := b + xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units b += 2 xgb.Put32(buf[b:], uint32(Picture)) @@ -2664,13 +2654,9 @@ func createRadialGradientRequest(c *xgb.Conn, Picture Picture, Inner Pointfix, O b += 4 } - b = (b + 3) & ^3 // alignment gap - b += ColorListBytes(buf[b:], Colors) - b = xgb.Pad(b) - xgb.Put16(buf[blen:], uint16(b/4)) // write request size in 4-byte units - return buf[:b] + return buf } // CreateSolidFillCookie is a cookie used only for CreateSolidFill requests. @@ -3156,11 +3142,9 @@ type QueryPictFormatsReply struct { NumVisuals uint32 NumSubpixel uint32 // padding: 4 bytes - Formats []Pictforminfo // size: xgb.Pad((int(NumFormats) * 28)) - // alignment gap to multiple of 4 - Screens []Pictscreen // size: PictscreenListSize(Screens) - // alignment gap to multiple of 4 - Subpixels []uint32 // size: xgb.Pad((int(NumSubpixel) * 4)) + Formats []Pictforminfo // size: xgb.Pad((int(NumFormats) * 28)) + Screens []Pictscreen // size: PictscreenListSize(Screens) + Subpixels []uint32 // size: xgb.Pad((int(NumSubpixel) * 4)) } // Reply blocks and returns the reply data for a QueryPictFormats request. @@ -3208,13 +3192,9 @@ func queryPictFormatsReply(buf []byte) *QueryPictFormatsReply { v.Formats = make([]Pictforminfo, v.NumFormats) b += PictforminfoReadList(buf[b:], v.Formats) - b = (b + 3) & ^3 // alignment gap - v.Screens = make([]Pictscreen, v.NumScreens) b += PictscreenReadList(buf[b:], v.Screens) - b = (b + 3) & ^3 // alignment gap - v.Subpixels = make([]uint32, v.NumSubpixel) for i := 0; i < int(v.NumSubpixel); i++ { v.Subpixels[i] = xgb.Get32(buf[b:]) -- cgit v1.2.3