Update to latest xproto XML.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
package shape
|
||||
|
||||
/*
|
||||
This file was generated by shape.xml on Jun 5 2012 12:11:59am EDT.
|
||||
This file was generated by shape.xml on Aug 11 2013 8:39:43pm EDT.
|
||||
This file is automatically generated. Edit at your peril!
|
||||
*/
|
||||
|
||||
@@ -40,46 +40,6 @@ func init() {
|
||||
xgb.NewExtErrorFuncs["SHAPE"] = make(map[int]xgb.NewErrorFun)
|
||||
}
|
||||
|
||||
// Skipping definition for base type 'Card8'
|
||||
|
||||
// Skipping definition for base type 'Int16'
|
||||
|
||||
// Skipping definition for base type 'Int32'
|
||||
|
||||
// Skipping definition for base type 'Void'
|
||||
|
||||
// Skipping definition for base type 'Byte'
|
||||
|
||||
// Skipping definition for base type 'Int8'
|
||||
|
||||
// Skipping definition for base type 'Card16'
|
||||
|
||||
// Skipping definition for base type 'Char'
|
||||
|
||||
// Skipping definition for base type 'Card32'
|
||||
|
||||
// Skipping definition for base type 'Double'
|
||||
|
||||
// Skipping definition for base type 'Bool'
|
||||
|
||||
// Skipping definition for base type 'Float'
|
||||
|
||||
const (
|
||||
SoSet = 0
|
||||
SoUnion = 1
|
||||
SoIntersect = 2
|
||||
SoSubtract = 3
|
||||
SoInvert = 4
|
||||
)
|
||||
|
||||
const (
|
||||
SkBounding = 0
|
||||
SkClip = 1
|
||||
SkInput = 2
|
||||
)
|
||||
|
||||
type Op byte
|
||||
|
||||
type Kind byte
|
||||
|
||||
// Notify is the event number for a NotifyEvent.
|
||||
@@ -209,240 +169,45 @@ func init() {
|
||||
xgb.NewExtEventFuncs["SHAPE"][0] = NotifyEventNew
|
||||
}
|
||||
|
||||
// QueryVersionCookie is a cookie used only for QueryVersion requests.
|
||||
type QueryVersionCookie struct {
|
||||
*xgb.Cookie
|
||||
}
|
||||
type Op byte
|
||||
|
||||
// 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) QueryVersionCookie {
|
||||
if _, ok := c.Extensions["SHAPE"]; !ok {
|
||||
panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.")
|
||||
}
|
||||
cookie := c.NewCookie(true, true)
|
||||
c.NewRequest(queryVersionRequest(c), cookie)
|
||||
return QueryVersionCookie{cookie}
|
||||
}
|
||||
const (
|
||||
SkBounding = 0
|
||||
SkClip = 1
|
||||
SkInput = 2
|
||||
)
|
||||
|
||||
// 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) QueryVersionCookie {
|
||||
if _, ok := c.Extensions["SHAPE"]; !ok {
|
||||
panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.")
|
||||
}
|
||||
cookie := c.NewCookie(false, true)
|
||||
c.NewRequest(queryVersionRequest(c), cookie)
|
||||
return QueryVersionCookie{cookie}
|
||||
}
|
||||
const (
|
||||
SoSet = 0
|
||||
SoUnion = 1
|
||||
SoIntersect = 2
|
||||
SoSubtract = 3
|
||||
SoInvert = 4
|
||||
)
|
||||
|
||||
// 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 uint16
|
||||
MinorVersion uint16
|
||||
}
|
||||
// Skipping definition for base type 'Bool'
|
||||
|
||||
// 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
|
||||
}
|
||||
// Skipping definition for base type 'Byte'
|
||||
|
||||
// queryVersionReply reads a byte slice into a QueryVersionReply value.
|
||||
func queryVersionReply(buf []byte) *QueryVersionReply {
|
||||
v := new(QueryVersionReply)
|
||||
b := 1 // skip reply determinant
|
||||
// Skipping definition for base type 'Card8'
|
||||
|
||||
b += 1 // padding
|
||||
// Skipping definition for base type 'Char'
|
||||
|
||||
v.Sequence = xgb.Get16(buf[b:])
|
||||
b += 2
|
||||
// Skipping definition for base type 'Void'
|
||||
|
||||
v.Length = xgb.Get32(buf[b:]) // 4-byte units
|
||||
b += 4
|
||||
// Skipping definition for base type 'Double'
|
||||
|
||||
v.MajorVersion = xgb.Get16(buf[b:])
|
||||
b += 2
|
||||
// Skipping definition for base type 'Float'
|
||||
|
||||
v.MinorVersion = xgb.Get16(buf[b:])
|
||||
b += 2
|
||||
// Skipping definition for base type 'Int16'
|
||||
|
||||
return v
|
||||
}
|
||||
// Skipping definition for base type 'Int32'
|
||||
|
||||
// Write request to wire for QueryVersion
|
||||
// queryVersionRequest writes a QueryVersion request to a byte slice.
|
||||
func queryVersionRequest(c *xgb.Conn) []byte {
|
||||
size := 4
|
||||
b := 0
|
||||
buf := make([]byte, size)
|
||||
// Skipping definition for base type 'Int8'
|
||||
|
||||
buf[b] = c.Extensions["SHAPE"]
|
||||
b += 1
|
||||
// Skipping definition for base type 'Card16'
|
||||
|
||||
buf[b] = 0 // request opcode
|
||||
b += 1
|
||||
|
||||
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
|
||||
b += 2
|
||||
|
||||
return buf
|
||||
}
|
||||
|
||||
// RectanglesCookie is a cookie used only for Rectangles requests.
|
||||
type RectanglesCookie struct {
|
||||
*xgb.Cookie
|
||||
}
|
||||
|
||||
// Rectangles sends an unchecked request.
|
||||
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
||||
func Rectangles(c *xgb.Conn, Operation Op, DestinationKind Kind, Ordering byte, DestinationWindow xproto.Window, XOffset int16, YOffset int16, Rectangles []xproto.Rectangle) RectanglesCookie {
|
||||
if _, ok := c.Extensions["SHAPE"]; !ok {
|
||||
panic("Cannot issue request 'Rectangles' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.")
|
||||
}
|
||||
cookie := c.NewCookie(false, false)
|
||||
c.NewRequest(rectanglesRequest(c, Operation, DestinationKind, Ordering, DestinationWindow, XOffset, YOffset, Rectangles), cookie)
|
||||
return RectanglesCookie{cookie}
|
||||
}
|
||||
|
||||
// RectanglesChecked sends a checked request.
|
||||
// If an error occurs, it can be retrieved using RectanglesCookie.Check()
|
||||
func RectanglesChecked(c *xgb.Conn, Operation Op, DestinationKind Kind, Ordering byte, DestinationWindow xproto.Window, XOffset int16, YOffset int16, Rectangles []xproto.Rectangle) RectanglesCookie {
|
||||
if _, ok := c.Extensions["SHAPE"]; !ok {
|
||||
panic("Cannot issue request 'Rectangles' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.")
|
||||
}
|
||||
cookie := c.NewCookie(true, false)
|
||||
c.NewRequest(rectanglesRequest(c, Operation, DestinationKind, Ordering, DestinationWindow, XOffset, YOffset, Rectangles), cookie)
|
||||
return RectanglesCookie{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 RectanglesCookie) Check() error {
|
||||
return cook.Cookie.Check()
|
||||
}
|
||||
|
||||
// Write request to wire for Rectangles
|
||||
// rectanglesRequest writes a Rectangles request to a byte slice.
|
||||
func rectanglesRequest(c *xgb.Conn, Operation Op, DestinationKind Kind, Ordering byte, DestinationWindow xproto.Window, XOffset int16, YOffset int16, Rectangles []xproto.Rectangle) []byte {
|
||||
size := xgb.Pad((16 + xgb.Pad((len(Rectangles) * 8))))
|
||||
b := 0
|
||||
buf := make([]byte, size)
|
||||
|
||||
buf[b] = c.Extensions["SHAPE"]
|
||||
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
|
||||
|
||||
buf[b] = byte(Operation)
|
||||
b += 1
|
||||
|
||||
buf[b] = byte(DestinationKind)
|
||||
b += 1
|
||||
|
||||
buf[b] = Ordering
|
||||
b += 1
|
||||
|
||||
b += 1 // padding
|
||||
|
||||
xgb.Put32(buf[b:], uint32(DestinationWindow))
|
||||
b += 4
|
||||
|
||||
xgb.Put16(buf[b:], uint16(XOffset))
|
||||
b += 2
|
||||
|
||||
xgb.Put16(buf[b:], uint16(YOffset))
|
||||
b += 2
|
||||
|
||||
b += xproto.RectangleListBytes(buf[b:], Rectangles)
|
||||
|
||||
return buf
|
||||
}
|
||||
|
||||
// MaskCookie is a cookie used only for Mask requests.
|
||||
type MaskCookie struct {
|
||||
*xgb.Cookie
|
||||
}
|
||||
|
||||
// Mask sends an unchecked request.
|
||||
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
||||
func Mask(c *xgb.Conn, Operation Op, DestinationKind Kind, DestinationWindow xproto.Window, XOffset int16, YOffset int16, SourceBitmap xproto.Pixmap) MaskCookie {
|
||||
if _, ok := c.Extensions["SHAPE"]; !ok {
|
||||
panic("Cannot issue request 'Mask' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.")
|
||||
}
|
||||
cookie := c.NewCookie(false, false)
|
||||
c.NewRequest(maskRequest(c, Operation, DestinationKind, DestinationWindow, XOffset, YOffset, SourceBitmap), cookie)
|
||||
return MaskCookie{cookie}
|
||||
}
|
||||
|
||||
// MaskChecked sends a checked request.
|
||||
// If an error occurs, it can be retrieved using MaskCookie.Check()
|
||||
func MaskChecked(c *xgb.Conn, Operation Op, DestinationKind Kind, DestinationWindow xproto.Window, XOffset int16, YOffset int16, SourceBitmap xproto.Pixmap) MaskCookie {
|
||||
if _, ok := c.Extensions["SHAPE"]; !ok {
|
||||
panic("Cannot issue request 'Mask' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.")
|
||||
}
|
||||
cookie := c.NewCookie(true, false)
|
||||
c.NewRequest(maskRequest(c, Operation, DestinationKind, DestinationWindow, XOffset, YOffset, SourceBitmap), cookie)
|
||||
return MaskCookie{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 MaskCookie) Check() error {
|
||||
return cook.Cookie.Check()
|
||||
}
|
||||
|
||||
// Write request to wire for Mask
|
||||
// maskRequest writes a Mask request to a byte slice.
|
||||
func maskRequest(c *xgb.Conn, Operation Op, DestinationKind Kind, DestinationWindow xproto.Window, XOffset int16, YOffset int16, SourceBitmap xproto.Pixmap) []byte {
|
||||
size := 20
|
||||
b := 0
|
||||
buf := make([]byte, size)
|
||||
|
||||
buf[b] = c.Extensions["SHAPE"]
|
||||
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
|
||||
|
||||
buf[b] = byte(Operation)
|
||||
b += 1
|
||||
|
||||
buf[b] = byte(DestinationKind)
|
||||
b += 1
|
||||
|
||||
b += 2 // padding
|
||||
|
||||
xgb.Put32(buf[b:], uint32(DestinationWindow))
|
||||
b += 4
|
||||
|
||||
xgb.Put16(buf[b:], uint16(XOffset))
|
||||
b += 2
|
||||
|
||||
xgb.Put16(buf[b:], uint16(YOffset))
|
||||
b += 2
|
||||
|
||||
xgb.Put32(buf[b:], uint32(SourceBitmap))
|
||||
b += 4
|
||||
|
||||
return buf
|
||||
}
|
||||
// Skipping definition for base type 'Card32'
|
||||
|
||||
// CombineCookie is a cookie used only for Combine requests.
|
||||
type CombineCookie struct {
|
||||
@@ -519,6 +284,268 @@ func combineRequest(c *xgb.Conn, Operation Op, DestinationKind Kind, SourceKind
|
||||
return buf
|
||||
}
|
||||
|
||||
// GetRectanglesCookie is a cookie used only for GetRectangles requests.
|
||||
type GetRectanglesCookie struct {
|
||||
*xgb.Cookie
|
||||
}
|
||||
|
||||
// GetRectangles sends a checked request.
|
||||
// If an error occurs, it will be returned with the reply by calling GetRectanglesCookie.Reply()
|
||||
func GetRectangles(c *xgb.Conn, Window xproto.Window, SourceKind Kind) GetRectanglesCookie {
|
||||
if _, ok := c.Extensions["SHAPE"]; !ok {
|
||||
panic("Cannot issue request 'GetRectangles' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.")
|
||||
}
|
||||
cookie := c.NewCookie(true, true)
|
||||
c.NewRequest(getRectanglesRequest(c, Window, SourceKind), cookie)
|
||||
return GetRectanglesCookie{cookie}
|
||||
}
|
||||
|
||||
// GetRectanglesUnchecked sends an unchecked request.
|
||||
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
||||
func GetRectanglesUnchecked(c *xgb.Conn, Window xproto.Window, SourceKind Kind) GetRectanglesCookie {
|
||||
if _, ok := c.Extensions["SHAPE"]; !ok {
|
||||
panic("Cannot issue request 'GetRectangles' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.")
|
||||
}
|
||||
cookie := c.NewCookie(false, true)
|
||||
c.NewRequest(getRectanglesRequest(c, Window, SourceKind), cookie)
|
||||
return GetRectanglesCookie{cookie}
|
||||
}
|
||||
|
||||
// GetRectanglesReply represents the data returned from a GetRectangles request.
|
||||
type GetRectanglesReply struct {
|
||||
Sequence uint16 // sequence number of the request for this reply
|
||||
Length uint32 // number of bytes in this reply
|
||||
Ordering byte
|
||||
RectanglesLen uint32
|
||||
// padding: 20 bytes
|
||||
Rectangles []xproto.Rectangle // size: xgb.Pad((int(RectanglesLen) * 8))
|
||||
}
|
||||
|
||||
// Reply blocks and returns the reply data for a GetRectangles request.
|
||||
func (cook GetRectanglesCookie) Reply() (*GetRectanglesReply, error) {
|
||||
buf, err := cook.Cookie.Reply()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if buf == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return getRectanglesReply(buf), nil
|
||||
}
|
||||
|
||||
// getRectanglesReply reads a byte slice into a GetRectanglesReply value.
|
||||
func getRectanglesReply(buf []byte) *GetRectanglesReply {
|
||||
v := new(GetRectanglesReply)
|
||||
b := 1 // skip reply determinant
|
||||
|
||||
v.Ordering = buf[b]
|
||||
b += 1
|
||||
|
||||
v.Sequence = xgb.Get16(buf[b:])
|
||||
b += 2
|
||||
|
||||
v.Length = xgb.Get32(buf[b:]) // 4-byte units
|
||||
b += 4
|
||||
|
||||
v.RectanglesLen = xgb.Get32(buf[b:])
|
||||
b += 4
|
||||
|
||||
b += 20 // padding
|
||||
|
||||
v.Rectangles = make([]xproto.Rectangle, v.RectanglesLen)
|
||||
b += xproto.RectangleReadList(buf[b:], v.Rectangles)
|
||||
|
||||
return v
|
||||
}
|
||||
|
||||
// Write request to wire for GetRectangles
|
||||
// getRectanglesRequest writes a GetRectangles request to a byte slice.
|
||||
func getRectanglesRequest(c *xgb.Conn, Window xproto.Window, SourceKind Kind) []byte {
|
||||
size := 12
|
||||
b := 0
|
||||
buf := make([]byte, size)
|
||||
|
||||
buf[b] = c.Extensions["SHAPE"]
|
||||
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
|
||||
|
||||
xgb.Put32(buf[b:], uint32(Window))
|
||||
b += 4
|
||||
|
||||
buf[b] = byte(SourceKind)
|
||||
b += 1
|
||||
|
||||
b += 3 // padding
|
||||
|
||||
return buf
|
||||
}
|
||||
|
||||
// InputSelectedCookie is a cookie used only for InputSelected requests.
|
||||
type InputSelectedCookie struct {
|
||||
*xgb.Cookie
|
||||
}
|
||||
|
||||
// InputSelected sends a checked request.
|
||||
// If an error occurs, it will be returned with the reply by calling InputSelectedCookie.Reply()
|
||||
func InputSelected(c *xgb.Conn, DestinationWindow xproto.Window) InputSelectedCookie {
|
||||
if _, ok := c.Extensions["SHAPE"]; !ok {
|
||||
panic("Cannot issue request 'InputSelected' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.")
|
||||
}
|
||||
cookie := c.NewCookie(true, true)
|
||||
c.NewRequest(inputSelectedRequest(c, DestinationWindow), cookie)
|
||||
return InputSelectedCookie{cookie}
|
||||
}
|
||||
|
||||
// InputSelectedUnchecked sends an unchecked request.
|
||||
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
||||
func InputSelectedUnchecked(c *xgb.Conn, DestinationWindow xproto.Window) InputSelectedCookie {
|
||||
if _, ok := c.Extensions["SHAPE"]; !ok {
|
||||
panic("Cannot issue request 'InputSelected' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.")
|
||||
}
|
||||
cookie := c.NewCookie(false, true)
|
||||
c.NewRequest(inputSelectedRequest(c, DestinationWindow), cookie)
|
||||
return InputSelectedCookie{cookie}
|
||||
}
|
||||
|
||||
// InputSelectedReply represents the data returned from a InputSelected request.
|
||||
type InputSelectedReply struct {
|
||||
Sequence uint16 // sequence number of the request for this reply
|
||||
Length uint32 // number of bytes in this reply
|
||||
Enabled bool
|
||||
}
|
||||
|
||||
// Reply blocks and returns the reply data for a InputSelected request.
|
||||
func (cook InputSelectedCookie) Reply() (*InputSelectedReply, error) {
|
||||
buf, err := cook.Cookie.Reply()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if buf == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return inputSelectedReply(buf), nil
|
||||
}
|
||||
|
||||
// inputSelectedReply reads a byte slice into a InputSelectedReply value.
|
||||
func inputSelectedReply(buf []byte) *InputSelectedReply {
|
||||
v := new(InputSelectedReply)
|
||||
b := 1 // skip reply determinant
|
||||
|
||||
if buf[b] == 1 {
|
||||
v.Enabled = true
|
||||
} else {
|
||||
v.Enabled = false
|
||||
}
|
||||
b += 1
|
||||
|
||||
v.Sequence = xgb.Get16(buf[b:])
|
||||
b += 2
|
||||
|
||||
v.Length = xgb.Get32(buf[b:]) // 4-byte units
|
||||
b += 4
|
||||
|
||||
return v
|
||||
}
|
||||
|
||||
// Write request to wire for InputSelected
|
||||
// inputSelectedRequest writes a InputSelected request to a byte slice.
|
||||
func inputSelectedRequest(c *xgb.Conn, DestinationWindow xproto.Window) []byte {
|
||||
size := 8
|
||||
b := 0
|
||||
buf := make([]byte, size)
|
||||
|
||||
buf[b] = c.Extensions["SHAPE"]
|
||||
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(DestinationWindow))
|
||||
b += 4
|
||||
|
||||
return buf
|
||||
}
|
||||
|
||||
// MaskCookie is a cookie used only for Mask requests.
|
||||
type MaskCookie struct {
|
||||
*xgb.Cookie
|
||||
}
|
||||
|
||||
// Mask sends an unchecked request.
|
||||
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
||||
func Mask(c *xgb.Conn, Operation Op, DestinationKind Kind, DestinationWindow xproto.Window, XOffset int16, YOffset int16, SourceBitmap xproto.Pixmap) MaskCookie {
|
||||
if _, ok := c.Extensions["SHAPE"]; !ok {
|
||||
panic("Cannot issue request 'Mask' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.")
|
||||
}
|
||||
cookie := c.NewCookie(false, false)
|
||||
c.NewRequest(maskRequest(c, Operation, DestinationKind, DestinationWindow, XOffset, YOffset, SourceBitmap), cookie)
|
||||
return MaskCookie{cookie}
|
||||
}
|
||||
|
||||
// MaskChecked sends a checked request.
|
||||
// If an error occurs, it can be retrieved using MaskCookie.Check()
|
||||
func MaskChecked(c *xgb.Conn, Operation Op, DestinationKind Kind, DestinationWindow xproto.Window, XOffset int16, YOffset int16, SourceBitmap xproto.Pixmap) MaskCookie {
|
||||
if _, ok := c.Extensions["SHAPE"]; !ok {
|
||||
panic("Cannot issue request 'Mask' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.")
|
||||
}
|
||||
cookie := c.NewCookie(true, false)
|
||||
c.NewRequest(maskRequest(c, Operation, DestinationKind, DestinationWindow, XOffset, YOffset, SourceBitmap), cookie)
|
||||
return MaskCookie{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 MaskCookie) Check() error {
|
||||
return cook.Cookie.Check()
|
||||
}
|
||||
|
||||
// Write request to wire for Mask
|
||||
// maskRequest writes a Mask request to a byte slice.
|
||||
func maskRequest(c *xgb.Conn, Operation Op, DestinationKind Kind, DestinationWindow xproto.Window, XOffset int16, YOffset int16, SourceBitmap xproto.Pixmap) []byte {
|
||||
size := 20
|
||||
b := 0
|
||||
buf := make([]byte, size)
|
||||
|
||||
buf[b] = c.Extensions["SHAPE"]
|
||||
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
|
||||
|
||||
buf[b] = byte(Operation)
|
||||
b += 1
|
||||
|
||||
buf[b] = byte(DestinationKind)
|
||||
b += 1
|
||||
|
||||
b += 2 // padding
|
||||
|
||||
xgb.Put32(buf[b:], uint32(DestinationWindow))
|
||||
b += 4
|
||||
|
||||
xgb.Put16(buf[b:], uint16(XOffset))
|
||||
b += 2
|
||||
|
||||
xgb.Put16(buf[b:], uint16(YOffset))
|
||||
b += 2
|
||||
|
||||
xgb.Put32(buf[b:], uint32(SourceBitmap))
|
||||
b += 4
|
||||
|
||||
return buf
|
||||
}
|
||||
|
||||
// OffsetCookie is a cookie used only for Offset requests.
|
||||
type OffsetCookie struct {
|
||||
*xgb.Cookie
|
||||
@@ -720,6 +747,169 @@ func queryExtentsRequest(c *xgb.Conn, DestinationWindow xproto.Window) []byte {
|
||||
return buf
|
||||
}
|
||||
|
||||
// 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) QueryVersionCookie {
|
||||
if _, ok := c.Extensions["SHAPE"]; !ok {
|
||||
panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.")
|
||||
}
|
||||
cookie := c.NewCookie(true, true)
|
||||
c.NewRequest(queryVersionRequest(c), 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) QueryVersionCookie {
|
||||
if _, ok := c.Extensions["SHAPE"]; !ok {
|
||||
panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.")
|
||||
}
|
||||
cookie := c.NewCookie(false, true)
|
||||
c.NewRequest(queryVersionRequest(c), cookie)
|
||||
return QueryVersionCookie{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 uint16
|
||||
MinorVersion uint16
|
||||
}
|
||||
|
||||
// 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.Get16(buf[b:])
|
||||
b += 2
|
||||
|
||||
v.MinorVersion = xgb.Get16(buf[b:])
|
||||
b += 2
|
||||
|
||||
return v
|
||||
}
|
||||
|
||||
// Write request to wire for QueryVersion
|
||||
// queryVersionRequest writes a QueryVersion request to a byte slice.
|
||||
func queryVersionRequest(c *xgb.Conn) []byte {
|
||||
size := 4
|
||||
b := 0
|
||||
buf := make([]byte, size)
|
||||
|
||||
buf[b] = c.Extensions["SHAPE"]
|
||||
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
|
||||
|
||||
return buf
|
||||
}
|
||||
|
||||
// RectanglesCookie is a cookie used only for Rectangles requests.
|
||||
type RectanglesCookie struct {
|
||||
*xgb.Cookie
|
||||
}
|
||||
|
||||
// Rectangles sends an unchecked request.
|
||||
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
||||
func Rectangles(c *xgb.Conn, Operation Op, DestinationKind Kind, Ordering byte, DestinationWindow xproto.Window, XOffset int16, YOffset int16, Rectangles []xproto.Rectangle) RectanglesCookie {
|
||||
if _, ok := c.Extensions["SHAPE"]; !ok {
|
||||
panic("Cannot issue request 'Rectangles' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.")
|
||||
}
|
||||
cookie := c.NewCookie(false, false)
|
||||
c.NewRequest(rectanglesRequest(c, Operation, DestinationKind, Ordering, DestinationWindow, XOffset, YOffset, Rectangles), cookie)
|
||||
return RectanglesCookie{cookie}
|
||||
}
|
||||
|
||||
// RectanglesChecked sends a checked request.
|
||||
// If an error occurs, it can be retrieved using RectanglesCookie.Check()
|
||||
func RectanglesChecked(c *xgb.Conn, Operation Op, DestinationKind Kind, Ordering byte, DestinationWindow xproto.Window, XOffset int16, YOffset int16, Rectangles []xproto.Rectangle) RectanglesCookie {
|
||||
if _, ok := c.Extensions["SHAPE"]; !ok {
|
||||
panic("Cannot issue request 'Rectangles' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.")
|
||||
}
|
||||
cookie := c.NewCookie(true, false)
|
||||
c.NewRequest(rectanglesRequest(c, Operation, DestinationKind, Ordering, DestinationWindow, XOffset, YOffset, Rectangles), cookie)
|
||||
return RectanglesCookie{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 RectanglesCookie) Check() error {
|
||||
return cook.Cookie.Check()
|
||||
}
|
||||
|
||||
// Write request to wire for Rectangles
|
||||
// rectanglesRequest writes a Rectangles request to a byte slice.
|
||||
func rectanglesRequest(c *xgb.Conn, Operation Op, DestinationKind Kind, Ordering byte, DestinationWindow xproto.Window, XOffset int16, YOffset int16, Rectangles []xproto.Rectangle) []byte {
|
||||
size := xgb.Pad((16 + xgb.Pad((len(Rectangles) * 8))))
|
||||
b := 0
|
||||
buf := make([]byte, size)
|
||||
|
||||
buf[b] = c.Extensions["SHAPE"]
|
||||
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
|
||||
|
||||
buf[b] = byte(Operation)
|
||||
b += 1
|
||||
|
||||
buf[b] = byte(DestinationKind)
|
||||
b += 1
|
||||
|
||||
buf[b] = Ordering
|
||||
b += 1
|
||||
|
||||
b += 1 // padding
|
||||
|
||||
xgb.Put32(buf[b:], uint32(DestinationWindow))
|
||||
b += 4
|
||||
|
||||
xgb.Put16(buf[b:], uint16(XOffset))
|
||||
b += 2
|
||||
|
||||
xgb.Put16(buf[b:], uint16(YOffset))
|
||||
b += 2
|
||||
|
||||
b += xproto.RectangleListBytes(buf[b:], Rectangles)
|
||||
|
||||
return buf
|
||||
}
|
||||
|
||||
// SelectInputCookie is a cookie used only for SelectInput requests.
|
||||
type SelectInputCookie struct {
|
||||
*xgb.Cookie
|
||||
@@ -783,193 +973,3 @@ func selectInputRequest(c *xgb.Conn, DestinationWindow xproto.Window, Enable boo
|
||||
|
||||
return buf
|
||||
}
|
||||
|
||||
// InputSelectedCookie is a cookie used only for InputSelected requests.
|
||||
type InputSelectedCookie struct {
|
||||
*xgb.Cookie
|
||||
}
|
||||
|
||||
// InputSelected sends a checked request.
|
||||
// If an error occurs, it will be returned with the reply by calling InputSelectedCookie.Reply()
|
||||
func InputSelected(c *xgb.Conn, DestinationWindow xproto.Window) InputSelectedCookie {
|
||||
if _, ok := c.Extensions["SHAPE"]; !ok {
|
||||
panic("Cannot issue request 'InputSelected' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.")
|
||||
}
|
||||
cookie := c.NewCookie(true, true)
|
||||
c.NewRequest(inputSelectedRequest(c, DestinationWindow), cookie)
|
||||
return InputSelectedCookie{cookie}
|
||||
}
|
||||
|
||||
// InputSelectedUnchecked sends an unchecked request.
|
||||
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
||||
func InputSelectedUnchecked(c *xgb.Conn, DestinationWindow xproto.Window) InputSelectedCookie {
|
||||
if _, ok := c.Extensions["SHAPE"]; !ok {
|
||||
panic("Cannot issue request 'InputSelected' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.")
|
||||
}
|
||||
cookie := c.NewCookie(false, true)
|
||||
c.NewRequest(inputSelectedRequest(c, DestinationWindow), cookie)
|
||||
return InputSelectedCookie{cookie}
|
||||
}
|
||||
|
||||
// InputSelectedReply represents the data returned from a InputSelected request.
|
||||
type InputSelectedReply struct {
|
||||
Sequence uint16 // sequence number of the request for this reply
|
||||
Length uint32 // number of bytes in this reply
|
||||
Enabled bool
|
||||
}
|
||||
|
||||
// Reply blocks and returns the reply data for a InputSelected request.
|
||||
func (cook InputSelectedCookie) Reply() (*InputSelectedReply, error) {
|
||||
buf, err := cook.Cookie.Reply()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if buf == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return inputSelectedReply(buf), nil
|
||||
}
|
||||
|
||||
// inputSelectedReply reads a byte slice into a InputSelectedReply value.
|
||||
func inputSelectedReply(buf []byte) *InputSelectedReply {
|
||||
v := new(InputSelectedReply)
|
||||
b := 1 // skip reply determinant
|
||||
|
||||
if buf[b] == 1 {
|
||||
v.Enabled = true
|
||||
} else {
|
||||
v.Enabled = false
|
||||
}
|
||||
b += 1
|
||||
|
||||
v.Sequence = xgb.Get16(buf[b:])
|
||||
b += 2
|
||||
|
||||
v.Length = xgb.Get32(buf[b:]) // 4-byte units
|
||||
b += 4
|
||||
|
||||
return v
|
||||
}
|
||||
|
||||
// Write request to wire for InputSelected
|
||||
// inputSelectedRequest writes a InputSelected request to a byte slice.
|
||||
func inputSelectedRequest(c *xgb.Conn, DestinationWindow xproto.Window) []byte {
|
||||
size := 8
|
||||
b := 0
|
||||
buf := make([]byte, size)
|
||||
|
||||
buf[b] = c.Extensions["SHAPE"]
|
||||
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(DestinationWindow))
|
||||
b += 4
|
||||
|
||||
return buf
|
||||
}
|
||||
|
||||
// GetRectanglesCookie is a cookie used only for GetRectangles requests.
|
||||
type GetRectanglesCookie struct {
|
||||
*xgb.Cookie
|
||||
}
|
||||
|
||||
// GetRectangles sends a checked request.
|
||||
// If an error occurs, it will be returned with the reply by calling GetRectanglesCookie.Reply()
|
||||
func GetRectangles(c *xgb.Conn, Window xproto.Window, SourceKind Kind) GetRectanglesCookie {
|
||||
if _, ok := c.Extensions["SHAPE"]; !ok {
|
||||
panic("Cannot issue request 'GetRectangles' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.")
|
||||
}
|
||||
cookie := c.NewCookie(true, true)
|
||||
c.NewRequest(getRectanglesRequest(c, Window, SourceKind), cookie)
|
||||
return GetRectanglesCookie{cookie}
|
||||
}
|
||||
|
||||
// GetRectanglesUnchecked sends an unchecked request.
|
||||
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
||||
func GetRectanglesUnchecked(c *xgb.Conn, Window xproto.Window, SourceKind Kind) GetRectanglesCookie {
|
||||
if _, ok := c.Extensions["SHAPE"]; !ok {
|
||||
panic("Cannot issue request 'GetRectangles' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.")
|
||||
}
|
||||
cookie := c.NewCookie(false, true)
|
||||
c.NewRequest(getRectanglesRequest(c, Window, SourceKind), cookie)
|
||||
return GetRectanglesCookie{cookie}
|
||||
}
|
||||
|
||||
// GetRectanglesReply represents the data returned from a GetRectangles request.
|
||||
type GetRectanglesReply struct {
|
||||
Sequence uint16 // sequence number of the request for this reply
|
||||
Length uint32 // number of bytes in this reply
|
||||
Ordering byte
|
||||
RectanglesLen uint32
|
||||
// padding: 20 bytes
|
||||
Rectangles []xproto.Rectangle // size: xgb.Pad((int(RectanglesLen) * 8))
|
||||
}
|
||||
|
||||
// Reply blocks and returns the reply data for a GetRectangles request.
|
||||
func (cook GetRectanglesCookie) Reply() (*GetRectanglesReply, error) {
|
||||
buf, err := cook.Cookie.Reply()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if buf == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return getRectanglesReply(buf), nil
|
||||
}
|
||||
|
||||
// getRectanglesReply reads a byte slice into a GetRectanglesReply value.
|
||||
func getRectanglesReply(buf []byte) *GetRectanglesReply {
|
||||
v := new(GetRectanglesReply)
|
||||
b := 1 // skip reply determinant
|
||||
|
||||
v.Ordering = buf[b]
|
||||
b += 1
|
||||
|
||||
v.Sequence = xgb.Get16(buf[b:])
|
||||
b += 2
|
||||
|
||||
v.Length = xgb.Get32(buf[b:]) // 4-byte units
|
||||
b += 4
|
||||
|
||||
v.RectanglesLen = xgb.Get32(buf[b:])
|
||||
b += 4
|
||||
|
||||
b += 20 // padding
|
||||
|
||||
v.Rectangles = make([]xproto.Rectangle, v.RectanglesLen)
|
||||
b += xproto.RectangleReadList(buf[b:], v.Rectangles)
|
||||
|
||||
return v
|
||||
}
|
||||
|
||||
// Write request to wire for GetRectangles
|
||||
// getRectanglesRequest writes a GetRectangles request to a byte slice.
|
||||
func getRectanglesRequest(c *xgb.Conn, Window xproto.Window, SourceKind Kind) []byte {
|
||||
size := 12
|
||||
b := 0
|
||||
buf := make([]byte, size)
|
||||
|
||||
buf[b] = c.Extensions["SHAPE"]
|
||||
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
|
||||
|
||||
xgb.Put32(buf[b:], uint32(Window))
|
||||
b += 4
|
||||
|
||||
buf[b] = byte(SourceKind)
|
||||
b += 1
|
||||
|
||||
b += 3 // padding
|
||||
|
||||
return buf
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user