// Code generated by xtgen; DO NOT EDIT. package xfixes 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() uint32 { return uint32(binary.LittleEndian.Uint32(r.raw[8:])) } func (r QueryVersionReply) MinorVersion() uint32 { return uint32(binary.LittleEndian.Uint32(r.raw[12:])) } // GetCursorImageReply is a zero-copy view over a GetCursorImage 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 GetCursorImageReply struct{ raw []byte } // ParseGetCursorImageReply validates raw (the whole reply, 32+4*length bytes) once; getters do not re-check. func ParseGetCursorImageReply(raw []byte) (GetCursorImageReply, bool) { if len(raw) < 32 { return GetCursorImageReply{}, false } r := GetCursorImageReply{raw: raw} off := 32 { n := (int(r.Width()) * int(r.Height())) if n < 0 || n > len(r.raw) { return GetCursorImageReply{}, false } off += n * 4 } if off > len(r.raw) { return GetCursorImageReply{}, false } if off > len(r.raw) { return GetCursorImageReply{}, false } return r, true } func (r GetCursorImageReply) Raw() []byte { return r.raw } func (r GetCursorImageReply) X() int16 { return int16(binary.LittleEndian.Uint16(r.raw[8:])) } func (r GetCursorImageReply) Y() int16 { return int16(binary.LittleEndian.Uint16(r.raw[10:])) } func (r GetCursorImageReply) Width() uint16 { return uint16(binary.LittleEndian.Uint16(r.raw[12:])) } func (r GetCursorImageReply) Height() uint16 { return uint16(binary.LittleEndian.Uint16(r.raw[14:])) } func (r GetCursorImageReply) Xhot() uint16 { return uint16(binary.LittleEndian.Uint16(r.raw[16:])) } func (r GetCursorImageReply) Yhot() uint16 { return uint16(binary.LittleEndian.Uint16(r.raw[18:])) } func (r GetCursorImageReply) CursorSerial() uint32 { return uint32(binary.LittleEndian.Uint32(r.raw[20:])) } func (r GetCursorImageReply) CursorImage() Uint32List { off := 32 end := off + (int(r.Width())*int(r.Height()))*4 return Uint32List{b: r.raw[off:end:end]} } // FetchRegionReply is a zero-copy view over a FetchRegion 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 FetchRegionReply struct{ raw []byte } // ParseFetchRegionReply validates raw (the whole reply, 32+4*length bytes) once; getters do not re-check. func ParseFetchRegionReply(raw []byte) (FetchRegionReply, bool) { if len(raw) < 32 { return FetchRegionReply{}, false } r := FetchRegionReply{raw: raw} off := 32 { n := (int(binary.LittleEndian.Uint32(r.raw[4:])) / 2) if n < 0 || n > len(r.raw) { return FetchRegionReply{}, false } off += n * 8 } if off > len(r.raw) { return FetchRegionReply{}, false } if off > len(r.raw) { return FetchRegionReply{}, false } return r, true } func (r FetchRegionReply) Raw() []byte { return r.raw } func (r FetchRegionReply) Extents() xproto.Rectangle { return xproto.GetRectangle(r.raw[8:]) } func (r FetchRegionReply) Rectangles() RectangleList { off := 32 end := off + (int(binary.LittleEndian.Uint32(r.raw[4:]))/2)*8 return RectangleList{b: r.raw[off:end:end]} } // GetCursorNameReply is a zero-copy view over a GetCursorName 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 GetCursorNameReply struct{ raw []byte } // ParseGetCursorNameReply validates raw (the whole reply, 32+4*length bytes) once; getters do not re-check. func ParseGetCursorNameReply(raw []byte) (GetCursorNameReply, bool) { if len(raw) < 32 { return GetCursorNameReply{}, false } r := GetCursorNameReply{raw: raw} off := 32 { n := int(r.Nbytes()) if n < 0 || n > len(r.raw) { return GetCursorNameReply{}, false } off += n * 1 } if off > len(r.raw) { return GetCursorNameReply{}, false } if off > len(r.raw) { return GetCursorNameReply{}, false } return r, true } func (r GetCursorNameReply) Raw() []byte { return r.raw } func (r GetCursorNameReply) Atom() xproto.Atom { return xproto.Atom(binary.LittleEndian.Uint32(r.raw[8:])) } func (r GetCursorNameReply) Nbytes() uint16 { return uint16(binary.LittleEndian.Uint16(r.raw[12:])) } func (r GetCursorNameReply) Name() []byte { off := 32 end := off + int(r.Nbytes()) return r.raw[off:end:end] } // GetCursorImageAndNameReply is a zero-copy view over a GetCursorImageAndName 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 GetCursorImageAndNameReply struct{ raw []byte } // ParseGetCursorImageAndNameReply validates raw (the whole reply, 32+4*length bytes) once; getters do not re-check. func ParseGetCursorImageAndNameReply(raw []byte) (GetCursorImageAndNameReply, bool) { if len(raw) < 32 { return GetCursorImageAndNameReply{}, false } r := GetCursorImageAndNameReply{raw: raw} off := 32 { n := (int(r.Width()) * int(r.Height())) if n < 0 || n > len(r.raw) { return GetCursorImageAndNameReply{}, false } off += n * 4 } if off > len(r.raw) { return GetCursorImageAndNameReply{}, false } { n := int(r.Nbytes()) if n < 0 || n > len(r.raw) { return GetCursorImageAndNameReply{}, false } off += n * 1 } if off > len(r.raw) { return GetCursorImageAndNameReply{}, false } if off > len(r.raw) { return GetCursorImageAndNameReply{}, false } return r, true } func (r GetCursorImageAndNameReply) Raw() []byte { return r.raw } func (r GetCursorImageAndNameReply) X() int16 { return int16(binary.LittleEndian.Uint16(r.raw[8:])) } func (r GetCursorImageAndNameReply) Y() int16 { return int16(binary.LittleEndian.Uint16(r.raw[10:])) } func (r GetCursorImageAndNameReply) Width() uint16 { return uint16(binary.LittleEndian.Uint16(r.raw[12:])) } func (r GetCursorImageAndNameReply) Height() uint16 { return uint16(binary.LittleEndian.Uint16(r.raw[14:])) } func (r GetCursorImageAndNameReply) Xhot() uint16 { return uint16(binary.LittleEndian.Uint16(r.raw[16:])) } func (r GetCursorImageAndNameReply) Yhot() uint16 { return uint16(binary.LittleEndian.Uint16(r.raw[18:])) } func (r GetCursorImageAndNameReply) CursorSerial() uint32 { return uint32(binary.LittleEndian.Uint32(r.raw[20:])) } func (r GetCursorImageAndNameReply) CursorAtom() xproto.Atom { return xproto.Atom(binary.LittleEndian.Uint32(r.raw[24:])) } func (r GetCursorImageAndNameReply) Nbytes() uint16 { return uint16(binary.LittleEndian.Uint16(r.raw[28:])) } func (r GetCursorImageAndNameReply) CursorImage() Uint32List { off := 32 end := off + (int(r.Width())*int(r.Height()))*4 return Uint32List{b: r.raw[off:end:end]} } func (r GetCursorImageAndNameReply) Name() []byte { off := 32 { n := (int(r.Width()) * int(r.Height())) off += n * 4 } end := off + int(r.Nbytes()) return r.raw[off:end:end] } // GetClientDisconnectModeReply is a zero-copy view over a GetClientDisconnectMode 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 GetClientDisconnectModeReply struct{ raw []byte } // ParseGetClientDisconnectModeReply validates raw (the whole reply, 32+4*length bytes) once; getters do not re-check. func ParseGetClientDisconnectModeReply(raw []byte) (GetClientDisconnectModeReply, bool) { if len(raw) < 32 { return GetClientDisconnectModeReply{}, false } r := GetClientDisconnectModeReply{raw: raw} return r, true } func (r GetClientDisconnectModeReply) Raw() []byte { return r.raw } func (r GetClientDisconnectModeReply) DisconnectMode() ClientDisconnectFlags { return ClientDisconnectFlags(binary.LittleEndian.Uint32(r.raw[8:])) } // 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:]) } // Uint32List is a borrowed view over a wire list of uint32. It shares the lifetime of the bytes it was taken from; copy what you keep. type Uint32List struct{ b []byte } func (l Uint32List) Len() int { return len(l.b) / 4 } func (l Uint32List) At(i int) uint32 { return uint32(binary.LittleEndian.Uint32(l.b[i*4:])) }