// Code generated by xtgen; DO NOT EDIT. package shape import "bnema.dev/xturbo/xproto" import "encoding/binary" // QueryVersionReply is a zero-copy view over a QueryVersion reply; offsets count from reply byte 0. // It borrows the reply bytes: valid only until the Handler callback returns, because the read ring is reused. Copy what you keep. type QueryVersionReply struct{ raw []byte } // ParseQueryVersionReply validates raw (the whole reply, 32+4*length bytes) once; getters do not re-check. func ParseQueryVersionReply(raw []byte) (QueryVersionReply, bool) { if len(raw) < 32 { return QueryVersionReply{}, false } r := QueryVersionReply{raw: raw} return r, true } func (r QueryVersionReply) Raw() []byte { return r.raw } func (r QueryVersionReply) MajorVersion() uint16 { return uint16(binary.LittleEndian.Uint16(r.raw[8:])) } func (r QueryVersionReply) MinorVersion() uint16 { return uint16(binary.LittleEndian.Uint16(r.raw[10:])) } // QueryExtentsReply is a zero-copy view over a QueryExtents reply; offsets count from reply byte 0. // It borrows the reply bytes: valid only until the Handler callback returns, because the read ring is reused. Copy what you keep. type QueryExtentsReply struct{ raw []byte } // ParseQueryExtentsReply validates raw (the whole reply, 32+4*length bytes) once; getters do not re-check. func ParseQueryExtentsReply(raw []byte) (QueryExtentsReply, bool) { if len(raw) < 32 { return QueryExtentsReply{}, false } r := QueryExtentsReply{raw: raw} return r, true } func (r QueryExtentsReply) Raw() []byte { return r.raw } func (r QueryExtentsReply) BoundingShaped() bool { return (r.raw[8:][0] != 0) } func (r QueryExtentsReply) ClipShaped() bool { return (r.raw[9:][0] != 0) } func (r QueryExtentsReply) BoundingShapeExtentsX() int16 { return int16(binary.LittleEndian.Uint16(r.raw[12:])) } func (r QueryExtentsReply) BoundingShapeExtentsY() int16 { return int16(binary.LittleEndian.Uint16(r.raw[14:])) } func (r QueryExtentsReply) BoundingShapeExtentsWidth() uint16 { return uint16(binary.LittleEndian.Uint16(r.raw[16:])) } func (r QueryExtentsReply) BoundingShapeExtentsHeight() uint16 { return uint16(binary.LittleEndian.Uint16(r.raw[18:])) } func (r QueryExtentsReply) ClipShapeExtentsX() int16 { return int16(binary.LittleEndian.Uint16(r.raw[20:])) } func (r QueryExtentsReply) ClipShapeExtentsY() int16 { return int16(binary.LittleEndian.Uint16(r.raw[22:])) } func (r QueryExtentsReply) ClipShapeExtentsWidth() uint16 { return uint16(binary.LittleEndian.Uint16(r.raw[24:])) } func (r QueryExtentsReply) ClipShapeExtentsHeight() uint16 { return uint16(binary.LittleEndian.Uint16(r.raw[26:])) } // InputSelectedReply is a zero-copy view over a InputSelected reply; offsets count from reply byte 0. // It borrows the reply bytes: valid only until the Handler callback returns, because the read ring is reused. Copy what you keep. type InputSelectedReply struct{ raw []byte } // ParseInputSelectedReply validates raw (the whole reply, 32+4*length bytes) once; getters do not re-check. func ParseInputSelectedReply(raw []byte) (InputSelectedReply, bool) { if len(raw) < 32 { return InputSelectedReply{}, false } r := InputSelectedReply{raw: raw} return r, true } func (r InputSelectedReply) Raw() []byte { return r.raw } func (r InputSelectedReply) Enabled() bool { return (r.raw[1:][0] != 0) } // GetRectanglesReply is a zero-copy view over a GetRectangles reply; offsets count from reply byte 0. // It borrows the reply bytes: valid only until the Handler callback returns, because the read ring is reused. Copy what you keep. type GetRectanglesReply struct{ raw []byte } // ParseGetRectanglesReply validates raw (the whole reply, 32+4*length bytes) once; getters do not re-check. func ParseGetRectanglesReply(raw []byte) (GetRectanglesReply, bool) { if len(raw) < 32 { return GetRectanglesReply{}, false } r := GetRectanglesReply{raw: raw} off := 32 { n := int(r.RectanglesLen()) if n < 0 || n > len(r.raw) { return GetRectanglesReply{}, false } off += n * 8 } if off > len(r.raw) { return GetRectanglesReply{}, false } if off > len(r.raw) { return GetRectanglesReply{}, false } return r, true } func (r GetRectanglesReply) Raw() []byte { return r.raw } func (r GetRectanglesReply) Ordering() xproto.ClipOrdering { return xproto.ClipOrdering(r.raw[1:][0]) } func (r GetRectanglesReply) RectanglesLen() uint32 { return uint32(binary.LittleEndian.Uint32(r.raw[8:])) } func (r GetRectanglesReply) Rectangles() RectangleList { off := 32 end := off + (int(r.RectanglesLen()))*8 return RectangleList{b: r.raw[off:end:end]} } // RectangleList is a borrowed view over a wire list of xproto.Rectangle. It shares the lifetime of the bytes it was taken from; copy what you keep. type RectangleList struct{ b []byte } func (l RectangleList) Len() int { return len(l.b) / 8 } func (l RectangleList) At(i int) xproto.Rectangle { return xproto.GetRectangle(l.b[i*8:]) }