diff options
Diffstat (limited to 'nexgb/auto_shape.go')
-rw-r--r-- | nexgb/auto_shape.go | 897 |
1 files changed, 0 insertions, 897 deletions
diff --git a/nexgb/auto_shape.go b/nexgb/auto_shape.go deleted file mode 100644 index 90d67cf..0000000 --- a/nexgb/auto_shape.go +++ /dev/null @@ -1,897 +0,0 @@ -package xgb - -/* - This file was generated by shape.xml on May 10 2012 12:39:34pm EDT. - This file is automatically generated. Edit at your peril! -*/ - -// Imports are not necessary for XGB because everything is -// in one package. They are still listed here for reference. -// import "xproto" - -// ShapeInit must be called before using the SHAPE extension. -func (c *Conn) ShapeInit() error { - reply, err := c.QueryExtension(5, "SHAPE").Reply() - switch { - case err != nil: - return err - case !reply.Present: - return errorf("No extension named SHAPE could be found on on the server.") - } - - c.extLock.Lock() - c.extensions["SHAPE"] = reply.MajorOpcode - for evNum, fun := range newExtEventFuncs["SHAPE"] { - newEventFuncs[int(reply.FirstEvent)+evNum] = fun - } - for errNum, fun := range newExtErrorFuncs["SHAPE"] { - newErrorFuncs[int(reply.FirstError)+errNum] = fun - } - c.extLock.Unlock() - - return nil -} - -func init() { - newExtEventFuncs["SHAPE"] = make(map[int]newEventFun) - newExtErrorFuncs["SHAPE"] = make(map[int]newErrorFun) -} - -// Skipping definition for base type 'Int16' - -// Skipping definition for base type 'Int32' - -// Skipping definition for base type 'Void' - -// Skipping definition for base type 'Byte' - -// Skipping definition for base type 'Int8' - -// Skipping definition for base type 'Card16' - -// Skipping definition for base type 'Char' - -// Skipping definition for base type 'Card32' - -// Skipping definition for base type 'Double' - -// Skipping definition for base type 'Bool' - -// Skipping definition for base type 'Float' - -// Skipping definition for base type 'Card8' - -const ( - ShapeSoSet = 0 - ShapeSoUnion = 1 - ShapeSoIntersect = 2 - ShapeSoSubtract = 3 - ShapeSoInvert = 4 -) - -const ( - ShapeSkBounding = 0 - ShapeSkClip = 1 - ShapeSkInput = 2 -) - -type ShapeOp byte - -type ShapeKind byte - -// Event definition ShapeNotify (0) -// Size: 32 - -const ShapeNotify = 0 - -type ShapeNotifyEvent struct { - Sequence uint16 - ShapeKind ShapeKind - AffectedWindow Window - ExtentsX int16 - ExtentsY int16 - ExtentsWidth uint16 - ExtentsHeight uint16 - ServerTime Timestamp - Shaped bool - // padding: 11 bytes -} - -// Event read ShapeNotify -func NewShapeNotifyEvent(buf []byte) Event { - v := ShapeNotifyEvent{} - b := 1 // don't read event number - - v.ShapeKind = ShapeKind(buf[b]) - b += 1 - - v.Sequence = Get16(buf[b:]) - b += 2 - - v.AffectedWindow = Window(Get32(buf[b:])) - b += 4 - - v.ExtentsX = int16(Get16(buf[b:])) - b += 2 - - v.ExtentsY = int16(Get16(buf[b:])) - b += 2 - - v.ExtentsWidth = Get16(buf[b:]) - b += 2 - - v.ExtentsHeight = Get16(buf[b:]) - b += 2 - - v.ServerTime = Timestamp(Get32(buf[b:])) - b += 4 - - if buf[b] == 1 { - v.Shaped = true - } else { - v.Shaped = false - } - b += 1 - - b += 11 // padding - - return v -} - -// Event write ShapeNotify -func (v ShapeNotifyEvent) Bytes() []byte { - buf := make([]byte, 32) - b := 0 - - // write event number - buf[b] = 0 - b += 1 - - buf[b] = byte(v.ShapeKind) - b += 1 - - b += 2 // skip sequence number - - Put32(buf[b:], uint32(v.AffectedWindow)) - b += 4 - - Put16(buf[b:], uint16(v.ExtentsX)) - b += 2 - - Put16(buf[b:], uint16(v.ExtentsY)) - b += 2 - - Put16(buf[b:], v.ExtentsWidth) - b += 2 - - Put16(buf[b:], v.ExtentsHeight) - b += 2 - - Put32(buf[b:], uint32(v.ServerTime)) - b += 4 - - if v.Shaped { - buf[b] = 1 - } else { - buf[b] = 0 - } - b += 1 - - b += 11 // padding - - return buf -} - -func (v ShapeNotifyEvent) ImplementsEvent() {} - -func (v ShapeNotifyEvent) SequenceId() uint16 { - return v.Sequence -} - -func (v ShapeNotifyEvent) String() string { - fieldVals := make([]string, 0, 9) - fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) - fieldVals = append(fieldVals, sprintf("ShapeKind: %d", v.ShapeKind)) - fieldVals = append(fieldVals, sprintf("AffectedWindow: %d", v.AffectedWindow)) - fieldVals = append(fieldVals, sprintf("ExtentsX: %d", v.ExtentsX)) - fieldVals = append(fieldVals, sprintf("ExtentsY: %d", v.ExtentsY)) - fieldVals = append(fieldVals, sprintf("ExtentsWidth: %d", v.ExtentsWidth)) - fieldVals = append(fieldVals, sprintf("ExtentsHeight: %d", v.ExtentsHeight)) - fieldVals = append(fieldVals, sprintf("ServerTime: %d", v.ServerTime)) - fieldVals = append(fieldVals, sprintf("Shaped: %t", v.Shaped)) - return "ShapeNotify {" + stringsJoin(fieldVals, ", ") + "}" -} - -func init() { - newExtEventFuncs["SHAPE"][0] = NewShapeNotifyEvent -} - -// Request ShapeQueryVersion -// size: 4 -type ShapeQueryVersionCookie struct { - *cookie -} - -func (c *Conn) ShapeQueryVersion() ShapeQueryVersionCookie { - cookie := c.newCookie(true, true) - c.newRequest(c.shapeQueryVersionRequest(), cookie) - return ShapeQueryVersionCookie{cookie} -} - -func (c *Conn) ShapeQueryVersionUnchecked() ShapeQueryVersionCookie { - cookie := c.newCookie(false, true) - c.newRequest(c.shapeQueryVersionRequest(), cookie) - return ShapeQueryVersionCookie{cookie} -} - -// Request reply for ShapeQueryVersion -// size: 12 -type ShapeQueryVersionReply struct { - Sequence uint16 - Length uint32 - // padding: 1 bytes - MajorVersion uint16 - MinorVersion uint16 -} - -// Waits and reads reply data from request ShapeQueryVersion -func (cook ShapeQueryVersionCookie) Reply() (*ShapeQueryVersionReply, error) { - buf, err := cook.reply() - if err != nil { - return nil, err - } - if buf == nil { - return nil, nil - } - return shapeQueryVersionReply(buf), nil -} - -// Read reply into structure from buffer for ShapeQueryVersion -func shapeQueryVersionReply(buf []byte) *ShapeQueryVersionReply { - v := new(ShapeQueryVersionReply) - b := 1 // skip reply determinant - - b += 1 // padding - - v.Sequence = Get16(buf[b:]) - b += 2 - - v.Length = Get32(buf[b:]) // 4-byte units - b += 4 - - v.MajorVersion = Get16(buf[b:]) - b += 2 - - v.MinorVersion = Get16(buf[b:]) - b += 2 - - return v -} - -func (cook ShapeQueryVersionCookie) Check() error { - return cook.check() -} - -// Write request to wire for ShapeQueryVersion -func (c *Conn) shapeQueryVersionRequest() []byte { - size := 4 - b := 0 - buf := make([]byte, size) - - buf[b] = c.extensions["SHAPE"] - b += 1 - - buf[b] = 0 // request opcode - b += 1 - - Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units - b += 2 - - return buf -} - -// Request ShapeRectangles -// size: pad((16 + pad((len(Rectangles) * 8)))) -type ShapeRectanglesCookie struct { - *cookie -} - -// Write request to wire for ShapeRectangles -func (c *Conn) ShapeRectangles(Operation ShapeOp, DestinationKind ShapeKind, Ordering byte, DestinationWindow Window, XOffset int16, YOffset int16, Rectangles []Rectangle) ShapeRectanglesCookie { - cookie := c.newCookie(false, false) - c.newRequest(c.shapeRectanglesRequest(Operation, DestinationKind, Ordering, DestinationWindow, XOffset, YOffset, Rectangles), cookie) - return ShapeRectanglesCookie{cookie} -} - -func (c *Conn) ShapeRectanglesChecked(Operation ShapeOp, DestinationKind ShapeKind, Ordering byte, DestinationWindow Window, XOffset int16, YOffset int16, Rectangles []Rectangle) ShapeRectanglesCookie { - cookie := c.newCookie(true, false) - c.newRequest(c.shapeRectanglesRequest(Operation, DestinationKind, Ordering, DestinationWindow, XOffset, YOffset, Rectangles), cookie) - return ShapeRectanglesCookie{cookie} -} - -func (cook ShapeRectanglesCookie) Check() error { - return cook.check() -} - -// Write request to wire for ShapeRectangles -func (c *Conn) shapeRectanglesRequest(Operation ShapeOp, DestinationKind ShapeKind, Ordering byte, DestinationWindow Window, XOffset int16, YOffset int16, Rectangles []Rectangle) []byte { - size := pad((16 + pad((len(Rectangles) * 8)))) - b := 0 - buf := make([]byte, size) - - buf[b] = c.extensions["SHAPE"] - b += 1 - - buf[b] = 1 // request opcode - b += 1 - - Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units - b += 2 - - buf[b] = byte(Operation) - b += 1 - - buf[b] = byte(DestinationKind) - b += 1 - - buf[b] = Ordering - b += 1 - - b += 1 // padding - - Put32(buf[b:], uint32(DestinationWindow)) - b += 4 - - Put16(buf[b:], uint16(XOffset)) - b += 2 - - Put16(buf[b:], uint16(YOffset)) - b += 2 - - b += RectangleListBytes(buf[b:], Rectangles) - - return buf -} - -// Request ShapeMask -// size: 20 -type ShapeMaskCookie struct { - *cookie -} - -// Write request to wire for ShapeMask -func (c *Conn) ShapeMask(Operation ShapeOp, DestinationKind ShapeKind, DestinationWindow Window, XOffset int16, YOffset int16, SourceBitmap Pixmap) ShapeMaskCookie { - cookie := c.newCookie(false, false) - c.newRequest(c.shapeMaskRequest(Operation, DestinationKind, DestinationWindow, XOffset, YOffset, SourceBitmap), cookie) - return ShapeMaskCookie{cookie} -} - -func (c *Conn) ShapeMaskChecked(Operation ShapeOp, DestinationKind ShapeKind, DestinationWindow Window, XOffset int16, YOffset int16, SourceBitmap Pixmap) ShapeMaskCookie { - cookie := c.newCookie(true, false) - c.newRequest(c.shapeMaskRequest(Operation, DestinationKind, DestinationWindow, XOffset, YOffset, SourceBitmap), cookie) - return ShapeMaskCookie{cookie} -} - -func (cook ShapeMaskCookie) Check() error { - return cook.check() -} - -// Write request to wire for ShapeMask -func (c *Conn) shapeMaskRequest(Operation ShapeOp, DestinationKind ShapeKind, DestinationWindow Window, XOffset int16, YOffset int16, SourceBitmap Pixmap) []byte { - size := 20 - b := 0 - buf := make([]byte, size) - - buf[b] = c.extensions["SHAPE"] - b += 1 - - buf[b] = 2 // request opcode - b += 1 - - Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units - b += 2 - - buf[b] = byte(Operation) - b += 1 - - buf[b] = byte(DestinationKind) - b += 1 - - b += 2 // padding - - Put32(buf[b:], uint32(DestinationWindow)) - b += 4 - - Put16(buf[b:], uint16(XOffset)) - b += 2 - - Put16(buf[b:], uint16(YOffset)) - b += 2 - - Put32(buf[b:], uint32(SourceBitmap)) - b += 4 - - return buf -} - -// Request ShapeCombine -// size: 20 -type ShapeCombineCookie struct { - *cookie -} - -// Write request to wire for ShapeCombine -func (c *Conn) ShapeCombine(Operation ShapeOp, DestinationKind ShapeKind, SourceKind ShapeKind, DestinationWindow Window, XOffset int16, YOffset int16, SourceWindow Window) ShapeCombineCookie { - cookie := c.newCookie(false, false) - c.newRequest(c.shapeCombineRequest(Operation, DestinationKind, SourceKind, DestinationWindow, XOffset, YOffset, SourceWindow), cookie) - return ShapeCombineCookie{cookie} -} - -func (c *Conn) ShapeCombineChecked(Operation ShapeOp, DestinationKind ShapeKind, SourceKind ShapeKind, DestinationWindow Window, XOffset int16, YOffset int16, SourceWindow Window) ShapeCombineCookie { - cookie := c.newCookie(true, false) - c.newRequest(c.shapeCombineRequest(Operation, DestinationKind, SourceKind, DestinationWindow, XOffset, YOffset, SourceWindow), cookie) - return ShapeCombineCookie{cookie} -} - -func (cook ShapeCombineCookie) Check() error { - return cook.check() -} - -// Write request to wire for ShapeCombine -func (c *Conn) shapeCombineRequest(Operation ShapeOp, DestinationKind ShapeKind, SourceKind ShapeKind, DestinationWindow Window, XOffset int16, YOffset int16, SourceWindow Window) []byte { - size := 20 - b := 0 - buf := make([]byte, size) - - buf[b] = c.extensions["SHAPE"] - b += 1 - - buf[b] = 3 // request opcode - b += 1 - - Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units - b += 2 - - buf[b] = byte(Operation) - b += 1 - - buf[b] = byte(DestinationKind) - b += 1 - - buf[b] = byte(SourceKind) - b += 1 - - b += 1 // padding - - Put32(buf[b:], uint32(DestinationWindow)) - b += 4 - - Put16(buf[b:], uint16(XOffset)) - b += 2 - - Put16(buf[b:], uint16(YOffset)) - b += 2 - - Put32(buf[b:], uint32(SourceWindow)) - b += 4 - - return buf -} - -// Request ShapeOffset -// size: 16 -type ShapeOffsetCookie struct { - *cookie -} - -// Write request to wire for ShapeOffset -func (c *Conn) ShapeOffset(DestinationKind ShapeKind, DestinationWindow Window, XOffset int16, YOffset int16) ShapeOffsetCookie { - cookie := c.newCookie(false, false) - c.newRequest(c.shapeOffsetRequest(DestinationKind, DestinationWindow, XOffset, YOffset), cookie) - return ShapeOffsetCookie{cookie} -} - -func (c *Conn) ShapeOffsetChecked(DestinationKind ShapeKind, DestinationWindow Window, XOffset int16, YOffset int16) ShapeOffsetCookie { - cookie := c.newCookie(true, false) - c.newRequest(c.shapeOffsetRequest(DestinationKind, DestinationWindow, XOffset, YOffset), cookie) - return ShapeOffsetCookie{cookie} -} - -func (cook ShapeOffsetCookie) Check() error { - return cook.check() -} - -// Write request to wire for ShapeOffset -func (c *Conn) shapeOffsetRequest(DestinationKind ShapeKind, DestinationWindow Window, XOffset int16, YOffset int16) []byte { - size := 16 - b := 0 - buf := make([]byte, size) - - buf[b] = c.extensions["SHAPE"] - b += 1 - - buf[b] = 4 // request opcode - b += 1 - - Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units - b += 2 - - buf[b] = byte(DestinationKind) - b += 1 - - b += 3 // padding - - Put32(buf[b:], uint32(DestinationWindow)) - b += 4 - - Put16(buf[b:], uint16(XOffset)) - b += 2 - - Put16(buf[b:], uint16(YOffset)) - b += 2 - - return buf -} - -// Request ShapeQueryExtents -// size: 8 -type ShapeQueryExtentsCookie struct { - *cookie -} - -func (c *Conn) ShapeQueryExtents(DestinationWindow Window) ShapeQueryExtentsCookie { - cookie := c.newCookie(true, true) - c.newRequest(c.shapeQueryExtentsRequest(DestinationWindow), cookie) - return ShapeQueryExtentsCookie{cookie} -} - -func (c *Conn) ShapeQueryExtentsUnchecked(DestinationWindow Window) ShapeQueryExtentsCookie { - cookie := c.newCookie(false, true) - c.newRequest(c.shapeQueryExtentsRequest(DestinationWindow), cookie) - return ShapeQueryExtentsCookie{cookie} -} - -// Request reply for ShapeQueryExtents -// size: 28 -type ShapeQueryExtentsReply struct { - Sequence uint16 - Length uint32 - // padding: 1 bytes - BoundingShaped bool - ClipShaped bool - // padding: 2 bytes - BoundingShapeExtentsX int16 - BoundingShapeExtentsY int16 - BoundingShapeExtentsWidth uint16 - BoundingShapeExtentsHeight uint16 - ClipShapeExtentsX int16 - ClipShapeExtentsY int16 - ClipShapeExtentsWidth uint16 - ClipShapeExtentsHeight uint16 -} - -// Waits and reads reply data from request ShapeQueryExtents -func (cook ShapeQueryExtentsCookie) Reply() (*ShapeQueryExtentsReply, error) { - buf, err := cook.reply() - if err != nil { - return nil, err - } - if buf == nil { - return nil, nil - } - return shapeQueryExtentsReply(buf), nil -} - -// Read reply into structure from buffer for ShapeQueryExtents -func shapeQueryExtentsReply(buf []byte) *ShapeQueryExtentsReply { - v := new(ShapeQueryExtentsReply) - b := 1 // skip reply determinant - - b += 1 // padding - - v.Sequence = Get16(buf[b:]) - b += 2 - - v.Length = Get32(buf[b:]) // 4-byte units - b += 4 - - if buf[b] == 1 { - v.BoundingShaped = true - } else { - v.BoundingShaped = false - } - b += 1 - - if buf[b] == 1 { - v.ClipShaped = true - } else { - v.ClipShaped = false - } - b += 1 - - b += 2 // padding - - v.BoundingShapeExtentsX = int16(Get16(buf[b:])) - b += 2 - - v.BoundingShapeExtentsY = int16(Get16(buf[b:])) - b += 2 - - v.BoundingShapeExtentsWidth = Get16(buf[b:]) - b += 2 - - v.BoundingShapeExtentsHeight = Get16(buf[b:]) - b += 2 - - v.ClipShapeExtentsX = int16(Get16(buf[b:])) - b += 2 - - v.ClipShapeExtentsY = int16(Get16(buf[b:])) - b += 2 - - v.ClipShapeExtentsWidth = Get16(buf[b:]) - b += 2 - - v.ClipShapeExtentsHeight = Get16(buf[b:]) - b += 2 - - return v -} - -func (cook ShapeQueryExtentsCookie) Check() error { - return cook.check() -} - -// Write request to wire for ShapeQueryExtents -func (c *Conn) shapeQueryExtentsRequest(DestinationWindow Window) []byte { - size := 8 - b := 0 - buf := make([]byte, size) - - buf[b] = c.extensions["SHAPE"] - b += 1 - - buf[b] = 5 // request opcode - b += 1 - - Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units - b += 2 - - Put32(buf[b:], uint32(DestinationWindow)) - b += 4 - - return buf -} - -// Request ShapeSelectInput -// size: 12 -type ShapeSelectInputCookie struct { - *cookie -} - -// Write request to wire for ShapeSelectInput -func (c *Conn) ShapeSelectInput(DestinationWindow Window, Enable bool) ShapeSelectInputCookie { - cookie := c.newCookie(false, false) - c.newRequest(c.shapeSelectInputRequest(DestinationWindow, Enable), cookie) - return ShapeSelectInputCookie{cookie} -} - -func (c *Conn) ShapeSelectInputChecked(DestinationWindow Window, Enable bool) ShapeSelectInputCookie { - cookie := c.newCookie(true, false) - c.newRequest(c.shapeSelectInputRequest(DestinationWindow, Enable), cookie) - return ShapeSelectInputCookie{cookie} -} - -func (cook ShapeSelectInputCookie) Check() error { - return cook.check() -} - -// Write request to wire for ShapeSelectInput -func (c *Conn) shapeSelectInputRequest(DestinationWindow Window, Enable bool) []byte { - size := 12 - b := 0 - buf := make([]byte, size) - - buf[b] = c.extensions["SHAPE"] - b += 1 - - buf[b] = 6 // request opcode - b += 1 - - Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units - b += 2 - - Put32(buf[b:], uint32(DestinationWindow)) - b += 4 - - if Enable { - buf[b] = 1 - } else { - buf[b] = 0 - } - b += 1 - - b += 3 // padding - - return buf -} - -// Request ShapeInputSelected -// size: 8 -type ShapeInputSelectedCookie struct { - *cookie -} - -func (c *Conn) ShapeInputSelected(DestinationWindow Window) ShapeInputSelectedCookie { - cookie := c.newCookie(true, true) - c.newRequest(c.shapeInputSelectedRequest(DestinationWindow), cookie) - return ShapeInputSelectedCookie{cookie} -} - -func (c *Conn) ShapeInputSelectedUnchecked(DestinationWindow Window) ShapeInputSelectedCookie { - cookie := c.newCookie(false, true) - c.newRequest(c.shapeInputSelectedRequest(DestinationWindow), cookie) - return ShapeInputSelectedCookie{cookie} -} - -// Request reply for ShapeInputSelected -// size: 8 -type ShapeInputSelectedReply struct { - Sequence uint16 - Length uint32 - Enabled bool -} - -// Waits and reads reply data from request ShapeInputSelected -func (cook ShapeInputSelectedCookie) Reply() (*ShapeInputSelectedReply, error) { - buf, err := cook.reply() - if err != nil { - return nil, err - } - if buf == nil { - return nil, nil - } - return shapeInputSelectedReply(buf), nil -} - -// Read reply into structure from buffer for ShapeInputSelected -func shapeInputSelectedReply(buf []byte) *ShapeInputSelectedReply { - v := new(ShapeInputSelectedReply) - b := 1 // skip reply determinant - - if buf[b] == 1 { - v.Enabled = true - } else { - v.Enabled = false - } - b += 1 - - v.Sequence = Get16(buf[b:]) - b += 2 - - v.Length = Get32(buf[b:]) // 4-byte units - b += 4 - - return v -} - -func (cook ShapeInputSelectedCookie) Check() error { - return cook.check() -} - -// Write request to wire for ShapeInputSelected -func (c *Conn) shapeInputSelectedRequest(DestinationWindow Window) []byte { - size := 8 - b := 0 - buf := make([]byte, size) - - buf[b] = c.extensions["SHAPE"] - b += 1 - - buf[b] = 7 // request opcode - b += 1 - - Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units - b += 2 - - Put32(buf[b:], uint32(DestinationWindow)) - b += 4 - - return buf -} - -// Request ShapeGetRectangles -// size: 12 -type ShapeGetRectanglesCookie struct { - *cookie -} - -func (c *Conn) ShapeGetRectangles(Window Window, SourceKind ShapeKind) ShapeGetRectanglesCookie { - cookie := c.newCookie(true, true) - c.newRequest(c.shapeGetRectanglesRequest(Window, SourceKind), cookie) - return ShapeGetRectanglesCookie{cookie} -} - -func (c *Conn) ShapeGetRectanglesUnchecked(Window Window, SourceKind ShapeKind) ShapeGetRectanglesCookie { - cookie := c.newCookie(false, true) - c.newRequest(c.shapeGetRectanglesRequest(Window, SourceKind), cookie) - return ShapeGetRectanglesCookie{cookie} -} - -// Request reply for ShapeGetRectangles -// size: (32 + pad((int(RectanglesLen) * 8))) -type ShapeGetRectanglesReply struct { - Sequence uint16 - Length uint32 - Ordering byte - RectanglesLen uint32 - // padding: 20 bytes - Rectangles []Rectangle // size: pad((int(RectanglesLen) * 8)) -} - -// Waits and reads reply data from request ShapeGetRectangles -func (cook ShapeGetRectanglesCookie) Reply() (*ShapeGetRectanglesReply, error) { - buf, err := cook.reply() - if err != nil { - return nil, err - } - if buf == nil { - return nil, nil - } - return shapeGetRectanglesReply(buf), nil -} - -// Read reply into structure from buffer for ShapeGetRectangles -func shapeGetRectanglesReply(buf []byte) *ShapeGetRectanglesReply { - v := new(ShapeGetRectanglesReply) - b := 1 // skip reply determinant - - v.Ordering = buf[b] - b += 1 - - v.Sequence = Get16(buf[b:]) - b += 2 - - v.Length = Get32(buf[b:]) // 4-byte units - b += 4 - - v.RectanglesLen = Get32(buf[b:]) - b += 4 - - b += 20 // padding - - v.Rectangles = make([]Rectangle, v.RectanglesLen) - b += ReadRectangleList(buf[b:], v.Rectangles) - - return v -} - -func (cook ShapeGetRectanglesCookie) Check() error { - return cook.check() -} - -// Write request to wire for ShapeGetRectangles -func (c *Conn) shapeGetRectanglesRequest(Window Window, SourceKind ShapeKind) []byte { - size := 12 - b := 0 - buf := make([]byte, size) - - buf[b] = c.extensions["SHAPE"] - b += 1 - - buf[b] = 8 // request opcode - b += 1 - - Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units - b += 2 - - Put32(buf[b:], uint32(Window)) - b += 4 - - buf[b] = byte(SourceKind) - b += 1 - - b += 3 // padding - - return buf -} |