Update to latest xproto XML.
This commit is contained in:
parent
4b20ffaf4f
commit
0685fb57e1
|
@ -2,7 +2,7 @@
|
||||||
package bigreq
|
package bigreq
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This file was generated by bigreq.xml on Jun 5 2012 12:11:58am EDT.
|
This file was generated by bigreq.xml on Aug 11 2013 8:39:42pm EDT.
|
||||||
This file is automatically generated. Edit at your peril!
|
This file is automatically generated. Edit at your peril!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -40,30 +40,30 @@ func init() {
|
||||||
xgb.NewExtErrorFuncs["BIG-REQUESTS"] = make(map[int]xgb.NewErrorFun)
|
xgb.NewExtErrorFuncs["BIG-REQUESTS"] = make(map[int]xgb.NewErrorFun)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skipping definition for base type 'Void'
|
// Skipping definition for base type 'Bool'
|
||||||
|
|
||||||
// Skipping definition for base type 'Byte'
|
// Skipping definition for base type 'Byte'
|
||||||
|
|
||||||
|
// Skipping definition for base type 'Card8'
|
||||||
|
|
||||||
|
// Skipping definition for base type 'Char'
|
||||||
|
|
||||||
|
// Skipping definition for base type 'Void'
|
||||||
|
|
||||||
|
// Skipping definition for base type 'Double'
|
||||||
|
|
||||||
|
// Skipping definition for base type 'Float'
|
||||||
|
|
||||||
|
// Skipping definition for base type 'Int16'
|
||||||
|
|
||||||
|
// Skipping definition for base type 'Int32'
|
||||||
|
|
||||||
// Skipping definition for base type 'Int8'
|
// Skipping definition for base type 'Int8'
|
||||||
|
|
||||||
// Skipping definition for base type 'Card16'
|
// Skipping definition for base type 'Card16'
|
||||||
|
|
||||||
// Skipping definition for base type 'Char'
|
|
||||||
|
|
||||||
// Skipping definition for base type 'Card32'
|
// 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'
|
|
||||||
|
|
||||||
// Skipping definition for base type 'Int32'
|
|
||||||
|
|
||||||
// EnableCookie is a cookie used only for Enable requests.
|
// EnableCookie is a cookie used only for Enable requests.
|
||||||
type EnableCookie struct {
|
type EnableCookie struct {
|
||||||
*xgb.Cookie
|
*xgb.Cookie
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
package composite
|
package composite
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This file was generated by composite.xml on Jun 5 2012 12:11:58am EDT.
|
This file was generated by composite.xml on Aug 11 2013 8:39:43pm EDT.
|
||||||
This file is automatically generated. Edit at your peril!
|
This file is automatically generated. Edit at your peril!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -41,34 +41,241 @@ func init() {
|
||||||
xgb.NewExtErrorFuncs["Composite"] = make(map[int]xgb.NewErrorFun)
|
xgb.NewExtErrorFuncs["Composite"] = make(map[int]xgb.NewErrorFun)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skipping definition for base type 'Int32'
|
const (
|
||||||
|
RedirectAutomatic = 0
|
||||||
|
RedirectManual = 1
|
||||||
|
)
|
||||||
|
|
||||||
|
// Skipping definition for base type 'Bool'
|
||||||
|
|
||||||
|
// Skipping definition for base type 'Byte'
|
||||||
|
|
||||||
|
// Skipping definition for base type 'Card8'
|
||||||
|
|
||||||
|
// Skipping definition for base type 'Char'
|
||||||
|
|
||||||
// Skipping definition for base type 'Void'
|
// Skipping definition for base type 'Void'
|
||||||
|
|
||||||
// Skipping definition for base type 'Byte'
|
// Skipping definition for base type 'Double'
|
||||||
|
|
||||||
|
// Skipping definition for base type 'Float'
|
||||||
|
|
||||||
|
// Skipping definition for base type 'Int16'
|
||||||
|
|
||||||
|
// Skipping definition for base type 'Int32'
|
||||||
|
|
||||||
// Skipping definition for base type 'Int8'
|
// Skipping definition for base type 'Int8'
|
||||||
|
|
||||||
// Skipping definition for base type 'Card16'
|
// Skipping definition for base type 'Card16'
|
||||||
|
|
||||||
// Skipping definition for base type 'Char'
|
|
||||||
|
|
||||||
// Skipping definition for base type 'Card32'
|
// Skipping definition for base type 'Card32'
|
||||||
|
|
||||||
// Skipping definition for base type 'Double'
|
// CreateRegionFromBorderClipCookie is a cookie used only for CreateRegionFromBorderClip requests.
|
||||||
|
type CreateRegionFromBorderClipCookie struct {
|
||||||
|
*xgb.Cookie
|
||||||
|
}
|
||||||
|
|
||||||
// Skipping definition for base type 'Bool'
|
// CreateRegionFromBorderClip sends an unchecked request.
|
||||||
|
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
||||||
|
func CreateRegionFromBorderClip(c *xgb.Conn, Region xfixes.Region, Window xproto.Window) CreateRegionFromBorderClipCookie {
|
||||||
|
if _, ok := c.Extensions["COMPOSITE"]; !ok {
|
||||||
|
panic("Cannot issue request 'CreateRegionFromBorderClip' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.")
|
||||||
|
}
|
||||||
|
cookie := c.NewCookie(false, false)
|
||||||
|
c.NewRequest(createRegionFromBorderClipRequest(c, Region, Window), cookie)
|
||||||
|
return CreateRegionFromBorderClipCookie{cookie}
|
||||||
|
}
|
||||||
|
|
||||||
// Skipping definition for base type 'Float'
|
// CreateRegionFromBorderClipChecked sends a checked request.
|
||||||
|
// If an error occurs, it can be retrieved using CreateRegionFromBorderClipCookie.Check()
|
||||||
|
func CreateRegionFromBorderClipChecked(c *xgb.Conn, Region xfixes.Region, Window xproto.Window) CreateRegionFromBorderClipCookie {
|
||||||
|
if _, ok := c.Extensions["COMPOSITE"]; !ok {
|
||||||
|
panic("Cannot issue request 'CreateRegionFromBorderClip' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.")
|
||||||
|
}
|
||||||
|
cookie := c.NewCookie(true, false)
|
||||||
|
c.NewRequest(createRegionFromBorderClipRequest(c, Region, Window), cookie)
|
||||||
|
return CreateRegionFromBorderClipCookie{cookie}
|
||||||
|
}
|
||||||
|
|
||||||
// Skipping definition for base type 'Card8'
|
// 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 CreateRegionFromBorderClipCookie) Check() error {
|
||||||
|
return cook.Cookie.Check()
|
||||||
|
}
|
||||||
|
|
||||||
// Skipping definition for base type 'Int16'
|
// Write request to wire for CreateRegionFromBorderClip
|
||||||
|
// createRegionFromBorderClipRequest writes a CreateRegionFromBorderClip request to a byte slice.
|
||||||
|
func createRegionFromBorderClipRequest(c *xgb.Conn, Region xfixes.Region, Window xproto.Window) []byte {
|
||||||
|
size := 12
|
||||||
|
b := 0
|
||||||
|
buf := make([]byte, size)
|
||||||
|
|
||||||
const (
|
buf[b] = c.Extensions["COMPOSITE"]
|
||||||
RedirectAutomatic = 0
|
b += 1
|
||||||
RedirectManual = 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(Region))
|
||||||
|
b += 4
|
||||||
|
|
||||||
|
xgb.Put32(buf[b:], uint32(Window))
|
||||||
|
b += 4
|
||||||
|
|
||||||
|
return buf
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOverlayWindowCookie is a cookie used only for GetOverlayWindow requests.
|
||||||
|
type GetOverlayWindowCookie struct {
|
||||||
|
*xgb.Cookie
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOverlayWindow sends a checked request.
|
||||||
|
// If an error occurs, it will be returned with the reply by calling GetOverlayWindowCookie.Reply()
|
||||||
|
func GetOverlayWindow(c *xgb.Conn, Window xproto.Window) GetOverlayWindowCookie {
|
||||||
|
if _, ok := c.Extensions["COMPOSITE"]; !ok {
|
||||||
|
panic("Cannot issue request 'GetOverlayWindow' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.")
|
||||||
|
}
|
||||||
|
cookie := c.NewCookie(true, true)
|
||||||
|
c.NewRequest(getOverlayWindowRequest(c, Window), cookie)
|
||||||
|
return GetOverlayWindowCookie{cookie}
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOverlayWindowUnchecked sends an unchecked request.
|
||||||
|
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
||||||
|
func GetOverlayWindowUnchecked(c *xgb.Conn, Window xproto.Window) GetOverlayWindowCookie {
|
||||||
|
if _, ok := c.Extensions["COMPOSITE"]; !ok {
|
||||||
|
panic("Cannot issue request 'GetOverlayWindow' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.")
|
||||||
|
}
|
||||||
|
cookie := c.NewCookie(false, true)
|
||||||
|
c.NewRequest(getOverlayWindowRequest(c, Window), cookie)
|
||||||
|
return GetOverlayWindowCookie{cookie}
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOverlayWindowReply represents the data returned from a GetOverlayWindow request.
|
||||||
|
type GetOverlayWindowReply struct {
|
||||||
|
Sequence uint16 // sequence number of the request for this reply
|
||||||
|
Length uint32 // number of bytes in this reply
|
||||||
|
// padding: 1 bytes
|
||||||
|
OverlayWin xproto.Window
|
||||||
|
// padding: 20 bytes
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reply blocks and returns the reply data for a GetOverlayWindow request.
|
||||||
|
func (cook GetOverlayWindowCookie) Reply() (*GetOverlayWindowReply, error) {
|
||||||
|
buf, err := cook.Cookie.Reply()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if buf == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return getOverlayWindowReply(buf), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// getOverlayWindowReply reads a byte slice into a GetOverlayWindowReply value.
|
||||||
|
func getOverlayWindowReply(buf []byte) *GetOverlayWindowReply {
|
||||||
|
v := new(GetOverlayWindowReply)
|
||||||
|
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.OverlayWin = xproto.Window(xgb.Get32(buf[b:]))
|
||||||
|
b += 4
|
||||||
|
|
||||||
|
b += 20 // padding
|
||||||
|
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write request to wire for GetOverlayWindow
|
||||||
|
// getOverlayWindowRequest writes a GetOverlayWindow request to a byte slice.
|
||||||
|
func getOverlayWindowRequest(c *xgb.Conn, Window xproto.Window) []byte {
|
||||||
|
size := 8
|
||||||
|
b := 0
|
||||||
|
buf := make([]byte, size)
|
||||||
|
|
||||||
|
buf[b] = c.Extensions["COMPOSITE"]
|
||||||
|
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(Window))
|
||||||
|
b += 4
|
||||||
|
|
||||||
|
return buf
|
||||||
|
}
|
||||||
|
|
||||||
|
// NameWindowPixmapCookie is a cookie used only for NameWindowPixmap requests.
|
||||||
|
type NameWindowPixmapCookie struct {
|
||||||
|
*xgb.Cookie
|
||||||
|
}
|
||||||
|
|
||||||
|
// NameWindowPixmap sends an unchecked request.
|
||||||
|
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
||||||
|
func NameWindowPixmap(c *xgb.Conn, Window xproto.Window, Pixmap xproto.Pixmap) NameWindowPixmapCookie {
|
||||||
|
if _, ok := c.Extensions["COMPOSITE"]; !ok {
|
||||||
|
panic("Cannot issue request 'NameWindowPixmap' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.")
|
||||||
|
}
|
||||||
|
cookie := c.NewCookie(false, false)
|
||||||
|
c.NewRequest(nameWindowPixmapRequest(c, Window, Pixmap), cookie)
|
||||||
|
return NameWindowPixmapCookie{cookie}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NameWindowPixmapChecked sends a checked request.
|
||||||
|
// If an error occurs, it can be retrieved using NameWindowPixmapCookie.Check()
|
||||||
|
func NameWindowPixmapChecked(c *xgb.Conn, Window xproto.Window, Pixmap xproto.Pixmap) NameWindowPixmapCookie {
|
||||||
|
if _, ok := c.Extensions["COMPOSITE"]; !ok {
|
||||||
|
panic("Cannot issue request 'NameWindowPixmap' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.")
|
||||||
|
}
|
||||||
|
cookie := c.NewCookie(true, false)
|
||||||
|
c.NewRequest(nameWindowPixmapRequest(c, Window, Pixmap), cookie)
|
||||||
|
return NameWindowPixmapCookie{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 NameWindowPixmapCookie) Check() error {
|
||||||
|
return cook.Cookie.Check()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write request to wire for NameWindowPixmap
|
||||||
|
// nameWindowPixmapRequest writes a NameWindowPixmap request to a byte slice.
|
||||||
|
func nameWindowPixmapRequest(c *xgb.Conn, Window xproto.Window, Pixmap xproto.Pixmap) []byte {
|
||||||
|
size := 12
|
||||||
|
b := 0
|
||||||
|
buf := make([]byte, size)
|
||||||
|
|
||||||
|
buf[b] = c.Extensions["COMPOSITE"]
|
||||||
|
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(Window))
|
||||||
|
b += 4
|
||||||
|
|
||||||
|
xgb.Put32(buf[b:], uint32(Pixmap))
|
||||||
|
b += 4
|
||||||
|
|
||||||
|
return buf
|
||||||
|
}
|
||||||
|
|
||||||
// QueryVersionCookie is a cookie used only for QueryVersion requests.
|
// QueryVersionCookie is a cookie used only for QueryVersion requests.
|
||||||
type QueryVersionCookie struct {
|
type QueryVersionCookie struct {
|
||||||
|
@ -168,6 +375,66 @@ func queryVersionRequest(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVers
|
||||||
return buf
|
return buf
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RedirectSubwindowsCookie is a cookie used only for RedirectSubwindows requests.
|
||||||
|
type RedirectSubwindowsCookie struct {
|
||||||
|
*xgb.Cookie
|
||||||
|
}
|
||||||
|
|
||||||
|
// RedirectSubwindows sends an unchecked request.
|
||||||
|
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
||||||
|
func RedirectSubwindows(c *xgb.Conn, Window xproto.Window, Update byte) RedirectSubwindowsCookie {
|
||||||
|
if _, ok := c.Extensions["COMPOSITE"]; !ok {
|
||||||
|
panic("Cannot issue request 'RedirectSubwindows' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.")
|
||||||
|
}
|
||||||
|
cookie := c.NewCookie(false, false)
|
||||||
|
c.NewRequest(redirectSubwindowsRequest(c, Window, Update), cookie)
|
||||||
|
return RedirectSubwindowsCookie{cookie}
|
||||||
|
}
|
||||||
|
|
||||||
|
// RedirectSubwindowsChecked sends a checked request.
|
||||||
|
// If an error occurs, it can be retrieved using RedirectSubwindowsCookie.Check()
|
||||||
|
func RedirectSubwindowsChecked(c *xgb.Conn, Window xproto.Window, Update byte) RedirectSubwindowsCookie {
|
||||||
|
if _, ok := c.Extensions["COMPOSITE"]; !ok {
|
||||||
|
panic("Cannot issue request 'RedirectSubwindows' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.")
|
||||||
|
}
|
||||||
|
cookie := c.NewCookie(true, false)
|
||||||
|
c.NewRequest(redirectSubwindowsRequest(c, Window, Update), cookie)
|
||||||
|
return RedirectSubwindowsCookie{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 RedirectSubwindowsCookie) Check() error {
|
||||||
|
return cook.Cookie.Check()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write request to wire for RedirectSubwindows
|
||||||
|
// redirectSubwindowsRequest writes a RedirectSubwindows request to a byte slice.
|
||||||
|
func redirectSubwindowsRequest(c *xgb.Conn, Window xproto.Window, Update byte) []byte {
|
||||||
|
size := 12
|
||||||
|
b := 0
|
||||||
|
buf := make([]byte, size)
|
||||||
|
|
||||||
|
buf[b] = c.Extensions["COMPOSITE"]
|
||||||
|
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(Window))
|
||||||
|
b += 4
|
||||||
|
|
||||||
|
buf[b] = Update
|
||||||
|
b += 1
|
||||||
|
|
||||||
|
b += 3 // padding
|
||||||
|
|
||||||
|
return buf
|
||||||
|
}
|
||||||
|
|
||||||
// RedirectWindowCookie is a cookie used only for RedirectWindow requests.
|
// RedirectWindowCookie is a cookie used only for RedirectWindow requests.
|
||||||
type RedirectWindowCookie struct {
|
type RedirectWindowCookie struct {
|
||||||
*xgb.Cookie
|
*xgb.Cookie
|
||||||
|
@ -228,42 +495,97 @@ func redirectWindowRequest(c *xgb.Conn, Window xproto.Window, Update byte) []byt
|
||||||
return buf
|
return buf
|
||||||
}
|
}
|
||||||
|
|
||||||
// RedirectSubwindowsCookie is a cookie used only for RedirectSubwindows requests.
|
// ReleaseOverlayWindowCookie is a cookie used only for ReleaseOverlayWindow requests.
|
||||||
type RedirectSubwindowsCookie struct {
|
type ReleaseOverlayWindowCookie struct {
|
||||||
*xgb.Cookie
|
*xgb.Cookie
|
||||||
}
|
}
|
||||||
|
|
||||||
// RedirectSubwindows sends an unchecked request.
|
// ReleaseOverlayWindow sends an unchecked request.
|
||||||
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
||||||
func RedirectSubwindows(c *xgb.Conn, Window xproto.Window, Update byte) RedirectSubwindowsCookie {
|
func ReleaseOverlayWindow(c *xgb.Conn, Window xproto.Window) ReleaseOverlayWindowCookie {
|
||||||
if _, ok := c.Extensions["COMPOSITE"]; !ok {
|
if _, ok := c.Extensions["COMPOSITE"]; !ok {
|
||||||
panic("Cannot issue request 'RedirectSubwindows' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.")
|
panic("Cannot issue request 'ReleaseOverlayWindow' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.")
|
||||||
}
|
}
|
||||||
cookie := c.NewCookie(false, false)
|
cookie := c.NewCookie(false, false)
|
||||||
c.NewRequest(redirectSubwindowsRequest(c, Window, Update), cookie)
|
c.NewRequest(releaseOverlayWindowRequest(c, Window), cookie)
|
||||||
return RedirectSubwindowsCookie{cookie}
|
return ReleaseOverlayWindowCookie{cookie}
|
||||||
}
|
}
|
||||||
|
|
||||||
// RedirectSubwindowsChecked sends a checked request.
|
// ReleaseOverlayWindowChecked sends a checked request.
|
||||||
// If an error occurs, it can be retrieved using RedirectSubwindowsCookie.Check()
|
// If an error occurs, it can be retrieved using ReleaseOverlayWindowCookie.Check()
|
||||||
func RedirectSubwindowsChecked(c *xgb.Conn, Window xproto.Window, Update byte) RedirectSubwindowsCookie {
|
func ReleaseOverlayWindowChecked(c *xgb.Conn, Window xproto.Window) ReleaseOverlayWindowCookie {
|
||||||
if _, ok := c.Extensions["COMPOSITE"]; !ok {
|
if _, ok := c.Extensions["COMPOSITE"]; !ok {
|
||||||
panic("Cannot issue request 'RedirectSubwindows' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.")
|
panic("Cannot issue request 'ReleaseOverlayWindow' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.")
|
||||||
}
|
}
|
||||||
cookie := c.NewCookie(true, false)
|
cookie := c.NewCookie(true, false)
|
||||||
c.NewRequest(redirectSubwindowsRequest(c, Window, Update), cookie)
|
c.NewRequest(releaseOverlayWindowRequest(c, Window), cookie)
|
||||||
return RedirectSubwindowsCookie{cookie}
|
return ReleaseOverlayWindowCookie{cookie}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check returns an error if one occurred for checked requests that are not expecting a reply.
|
// 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.
|
// This cannot be called for requests expecting a reply, nor for unchecked requests.
|
||||||
func (cook RedirectSubwindowsCookie) Check() error {
|
func (cook ReleaseOverlayWindowCookie) Check() error {
|
||||||
return cook.Cookie.Check()
|
return cook.Cookie.Check()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write request to wire for RedirectSubwindows
|
// Write request to wire for ReleaseOverlayWindow
|
||||||
// redirectSubwindowsRequest writes a RedirectSubwindows request to a byte slice.
|
// releaseOverlayWindowRequest writes a ReleaseOverlayWindow request to a byte slice.
|
||||||
func redirectSubwindowsRequest(c *xgb.Conn, Window xproto.Window, Update byte) []byte {
|
func releaseOverlayWindowRequest(c *xgb.Conn, Window xproto.Window) []byte {
|
||||||
|
size := 8
|
||||||
|
b := 0
|
||||||
|
buf := make([]byte, size)
|
||||||
|
|
||||||
|
buf[b] = c.Extensions["COMPOSITE"]
|
||||||
|
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
|
||||||
|
|
||||||
|
return buf
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnredirectSubwindowsCookie is a cookie used only for UnredirectSubwindows requests.
|
||||||
|
type UnredirectSubwindowsCookie struct {
|
||||||
|
*xgb.Cookie
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnredirectSubwindows sends an unchecked request.
|
||||||
|
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
||||||
|
func UnredirectSubwindows(c *xgb.Conn, Window xproto.Window, Update byte) UnredirectSubwindowsCookie {
|
||||||
|
if _, ok := c.Extensions["COMPOSITE"]; !ok {
|
||||||
|
panic("Cannot issue request 'UnredirectSubwindows' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.")
|
||||||
|
}
|
||||||
|
cookie := c.NewCookie(false, false)
|
||||||
|
c.NewRequest(unredirectSubwindowsRequest(c, Window, Update), cookie)
|
||||||
|
return UnredirectSubwindowsCookie{cookie}
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnredirectSubwindowsChecked sends a checked request.
|
||||||
|
// If an error occurs, it can be retrieved using UnredirectSubwindowsCookie.Check()
|
||||||
|
func UnredirectSubwindowsChecked(c *xgb.Conn, Window xproto.Window, Update byte) UnredirectSubwindowsCookie {
|
||||||
|
if _, ok := c.Extensions["COMPOSITE"]; !ok {
|
||||||
|
panic("Cannot issue request 'UnredirectSubwindows' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.")
|
||||||
|
}
|
||||||
|
cookie := c.NewCookie(true, false)
|
||||||
|
c.NewRequest(unredirectSubwindowsRequest(c, Window, Update), cookie)
|
||||||
|
return UnredirectSubwindowsCookie{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 UnredirectSubwindowsCookie) Check() error {
|
||||||
|
return cook.Cookie.Check()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write request to wire for UnredirectSubwindows
|
||||||
|
// unredirectSubwindowsRequest writes a UnredirectSubwindows request to a byte slice.
|
||||||
|
func unredirectSubwindowsRequest(c *xgb.Conn, Window xproto.Window, Update byte) []byte {
|
||||||
size := 12
|
size := 12
|
||||||
b := 0
|
b := 0
|
||||||
buf := make([]byte, size)
|
buf := make([]byte, size)
|
||||||
|
@ -271,7 +593,7 @@ func redirectSubwindowsRequest(c *xgb.Conn, Window xproto.Window, Update byte) [
|
||||||
buf[b] = c.Extensions["COMPOSITE"]
|
buf[b] = c.Extensions["COMPOSITE"]
|
||||||
b += 1
|
b += 1
|
||||||
|
|
||||||
buf[b] = 2 // request opcode
|
buf[b] = 4 // request opcode
|
||||||
b += 1
|
b += 1
|
||||||
|
|
||||||
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
|
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
|
||||||
|
@ -347,325 +669,3 @@ func unredirectWindowRequest(c *xgb.Conn, Window xproto.Window, Update byte) []b
|
||||||
|
|
||||||
return buf
|
return buf
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnredirectSubwindowsCookie is a cookie used only for UnredirectSubwindows requests.
|
|
||||||
type UnredirectSubwindowsCookie struct {
|
|
||||||
*xgb.Cookie
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnredirectSubwindows sends an unchecked request.
|
|
||||||
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
|
||||||
func UnredirectSubwindows(c *xgb.Conn, Window xproto.Window, Update byte) UnredirectSubwindowsCookie {
|
|
||||||
if _, ok := c.Extensions["COMPOSITE"]; !ok {
|
|
||||||
panic("Cannot issue request 'UnredirectSubwindows' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.")
|
|
||||||
}
|
|
||||||
cookie := c.NewCookie(false, false)
|
|
||||||
c.NewRequest(unredirectSubwindowsRequest(c, Window, Update), cookie)
|
|
||||||
return UnredirectSubwindowsCookie{cookie}
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnredirectSubwindowsChecked sends a checked request.
|
|
||||||
// If an error occurs, it can be retrieved using UnredirectSubwindowsCookie.Check()
|
|
||||||
func UnredirectSubwindowsChecked(c *xgb.Conn, Window xproto.Window, Update byte) UnredirectSubwindowsCookie {
|
|
||||||
if _, ok := c.Extensions["COMPOSITE"]; !ok {
|
|
||||||
panic("Cannot issue request 'UnredirectSubwindows' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.")
|
|
||||||
}
|
|
||||||
cookie := c.NewCookie(true, false)
|
|
||||||
c.NewRequest(unredirectSubwindowsRequest(c, Window, Update), cookie)
|
|
||||||
return UnredirectSubwindowsCookie{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 UnredirectSubwindowsCookie) Check() error {
|
|
||||||
return cook.Cookie.Check()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write request to wire for UnredirectSubwindows
|
|
||||||
// unredirectSubwindowsRequest writes a UnredirectSubwindows request to a byte slice.
|
|
||||||
func unredirectSubwindowsRequest(c *xgb.Conn, Window xproto.Window, Update byte) []byte {
|
|
||||||
size := 12
|
|
||||||
b := 0
|
|
||||||
buf := make([]byte, size)
|
|
||||||
|
|
||||||
buf[b] = c.Extensions["COMPOSITE"]
|
|
||||||
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(Window))
|
|
||||||
b += 4
|
|
||||||
|
|
||||||
buf[b] = Update
|
|
||||||
b += 1
|
|
||||||
|
|
||||||
b += 3 // padding
|
|
||||||
|
|
||||||
return buf
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateRegionFromBorderClipCookie is a cookie used only for CreateRegionFromBorderClip requests.
|
|
||||||
type CreateRegionFromBorderClipCookie struct {
|
|
||||||
*xgb.Cookie
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateRegionFromBorderClip sends an unchecked request.
|
|
||||||
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
|
||||||
func CreateRegionFromBorderClip(c *xgb.Conn, Region xfixes.Region, Window xproto.Window) CreateRegionFromBorderClipCookie {
|
|
||||||
if _, ok := c.Extensions["COMPOSITE"]; !ok {
|
|
||||||
panic("Cannot issue request 'CreateRegionFromBorderClip' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.")
|
|
||||||
}
|
|
||||||
cookie := c.NewCookie(false, false)
|
|
||||||
c.NewRequest(createRegionFromBorderClipRequest(c, Region, Window), cookie)
|
|
||||||
return CreateRegionFromBorderClipCookie{cookie}
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateRegionFromBorderClipChecked sends a checked request.
|
|
||||||
// If an error occurs, it can be retrieved using CreateRegionFromBorderClipCookie.Check()
|
|
||||||
func CreateRegionFromBorderClipChecked(c *xgb.Conn, Region xfixes.Region, Window xproto.Window) CreateRegionFromBorderClipCookie {
|
|
||||||
if _, ok := c.Extensions["COMPOSITE"]; !ok {
|
|
||||||
panic("Cannot issue request 'CreateRegionFromBorderClip' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.")
|
|
||||||
}
|
|
||||||
cookie := c.NewCookie(true, false)
|
|
||||||
c.NewRequest(createRegionFromBorderClipRequest(c, Region, Window), cookie)
|
|
||||||
return CreateRegionFromBorderClipCookie{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 CreateRegionFromBorderClipCookie) Check() error {
|
|
||||||
return cook.Cookie.Check()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write request to wire for CreateRegionFromBorderClip
|
|
||||||
// createRegionFromBorderClipRequest writes a CreateRegionFromBorderClip request to a byte slice.
|
|
||||||
func createRegionFromBorderClipRequest(c *xgb.Conn, Region xfixes.Region, Window xproto.Window) []byte {
|
|
||||||
size := 12
|
|
||||||
b := 0
|
|
||||||
buf := make([]byte, size)
|
|
||||||
|
|
||||||
buf[b] = c.Extensions["COMPOSITE"]
|
|
||||||
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(Region))
|
|
||||||
b += 4
|
|
||||||
|
|
||||||
xgb.Put32(buf[b:], uint32(Window))
|
|
||||||
b += 4
|
|
||||||
|
|
||||||
return buf
|
|
||||||
}
|
|
||||||
|
|
||||||
// NameWindowPixmapCookie is a cookie used only for NameWindowPixmap requests.
|
|
||||||
type NameWindowPixmapCookie struct {
|
|
||||||
*xgb.Cookie
|
|
||||||
}
|
|
||||||
|
|
||||||
// NameWindowPixmap sends an unchecked request.
|
|
||||||
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
|
||||||
func NameWindowPixmap(c *xgb.Conn, Window xproto.Window, Pixmap xproto.Pixmap) NameWindowPixmapCookie {
|
|
||||||
if _, ok := c.Extensions["COMPOSITE"]; !ok {
|
|
||||||
panic("Cannot issue request 'NameWindowPixmap' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.")
|
|
||||||
}
|
|
||||||
cookie := c.NewCookie(false, false)
|
|
||||||
c.NewRequest(nameWindowPixmapRequest(c, Window, Pixmap), cookie)
|
|
||||||
return NameWindowPixmapCookie{cookie}
|
|
||||||
}
|
|
||||||
|
|
||||||
// NameWindowPixmapChecked sends a checked request.
|
|
||||||
// If an error occurs, it can be retrieved using NameWindowPixmapCookie.Check()
|
|
||||||
func NameWindowPixmapChecked(c *xgb.Conn, Window xproto.Window, Pixmap xproto.Pixmap) NameWindowPixmapCookie {
|
|
||||||
if _, ok := c.Extensions["COMPOSITE"]; !ok {
|
|
||||||
panic("Cannot issue request 'NameWindowPixmap' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.")
|
|
||||||
}
|
|
||||||
cookie := c.NewCookie(true, false)
|
|
||||||
c.NewRequest(nameWindowPixmapRequest(c, Window, Pixmap), cookie)
|
|
||||||
return NameWindowPixmapCookie{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 NameWindowPixmapCookie) Check() error {
|
|
||||||
return cook.Cookie.Check()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write request to wire for NameWindowPixmap
|
|
||||||
// nameWindowPixmapRequest writes a NameWindowPixmap request to a byte slice.
|
|
||||||
func nameWindowPixmapRequest(c *xgb.Conn, Window xproto.Window, Pixmap xproto.Pixmap) []byte {
|
|
||||||
size := 12
|
|
||||||
b := 0
|
|
||||||
buf := make([]byte, size)
|
|
||||||
|
|
||||||
buf[b] = c.Extensions["COMPOSITE"]
|
|
||||||
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(Window))
|
|
||||||
b += 4
|
|
||||||
|
|
||||||
xgb.Put32(buf[b:], uint32(Pixmap))
|
|
||||||
b += 4
|
|
||||||
|
|
||||||
return buf
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetOverlayWindowCookie is a cookie used only for GetOverlayWindow requests.
|
|
||||||
type GetOverlayWindowCookie struct {
|
|
||||||
*xgb.Cookie
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetOverlayWindow sends a checked request.
|
|
||||||
// If an error occurs, it will be returned with the reply by calling GetOverlayWindowCookie.Reply()
|
|
||||||
func GetOverlayWindow(c *xgb.Conn, Window xproto.Window) GetOverlayWindowCookie {
|
|
||||||
if _, ok := c.Extensions["COMPOSITE"]; !ok {
|
|
||||||
panic("Cannot issue request 'GetOverlayWindow' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.")
|
|
||||||
}
|
|
||||||
cookie := c.NewCookie(true, true)
|
|
||||||
c.NewRequest(getOverlayWindowRequest(c, Window), cookie)
|
|
||||||
return GetOverlayWindowCookie{cookie}
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetOverlayWindowUnchecked sends an unchecked request.
|
|
||||||
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
|
||||||
func GetOverlayWindowUnchecked(c *xgb.Conn, Window xproto.Window) GetOverlayWindowCookie {
|
|
||||||
if _, ok := c.Extensions["COMPOSITE"]; !ok {
|
|
||||||
panic("Cannot issue request 'GetOverlayWindow' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.")
|
|
||||||
}
|
|
||||||
cookie := c.NewCookie(false, true)
|
|
||||||
c.NewRequest(getOverlayWindowRequest(c, Window), cookie)
|
|
||||||
return GetOverlayWindowCookie{cookie}
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetOverlayWindowReply represents the data returned from a GetOverlayWindow request.
|
|
||||||
type GetOverlayWindowReply struct {
|
|
||||||
Sequence uint16 // sequence number of the request for this reply
|
|
||||||
Length uint32 // number of bytes in this reply
|
|
||||||
// padding: 1 bytes
|
|
||||||
OverlayWin xproto.Window
|
|
||||||
// padding: 20 bytes
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reply blocks and returns the reply data for a GetOverlayWindow request.
|
|
||||||
func (cook GetOverlayWindowCookie) Reply() (*GetOverlayWindowReply, error) {
|
|
||||||
buf, err := cook.Cookie.Reply()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if buf == nil {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
return getOverlayWindowReply(buf), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// getOverlayWindowReply reads a byte slice into a GetOverlayWindowReply value.
|
|
||||||
func getOverlayWindowReply(buf []byte) *GetOverlayWindowReply {
|
|
||||||
v := new(GetOverlayWindowReply)
|
|
||||||
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.OverlayWin = xproto.Window(xgb.Get32(buf[b:]))
|
|
||||||
b += 4
|
|
||||||
|
|
||||||
b += 20 // padding
|
|
||||||
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write request to wire for GetOverlayWindow
|
|
||||||
// getOverlayWindowRequest writes a GetOverlayWindow request to a byte slice.
|
|
||||||
func getOverlayWindowRequest(c *xgb.Conn, Window xproto.Window) []byte {
|
|
||||||
size := 8
|
|
||||||
b := 0
|
|
||||||
buf := make([]byte, size)
|
|
||||||
|
|
||||||
buf[b] = c.Extensions["COMPOSITE"]
|
|
||||||
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(Window))
|
|
||||||
b += 4
|
|
||||||
|
|
||||||
return buf
|
|
||||||
}
|
|
||||||
|
|
||||||
// ReleaseOverlayWindowCookie is a cookie used only for ReleaseOverlayWindow requests.
|
|
||||||
type ReleaseOverlayWindowCookie struct {
|
|
||||||
*xgb.Cookie
|
|
||||||
}
|
|
||||||
|
|
||||||
// ReleaseOverlayWindow sends an unchecked request.
|
|
||||||
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
|
||||||
func ReleaseOverlayWindow(c *xgb.Conn, Window xproto.Window) ReleaseOverlayWindowCookie {
|
|
||||||
if _, ok := c.Extensions["COMPOSITE"]; !ok {
|
|
||||||
panic("Cannot issue request 'ReleaseOverlayWindow' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.")
|
|
||||||
}
|
|
||||||
cookie := c.NewCookie(false, false)
|
|
||||||
c.NewRequest(releaseOverlayWindowRequest(c, Window), cookie)
|
|
||||||
return ReleaseOverlayWindowCookie{cookie}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ReleaseOverlayWindowChecked sends a checked request.
|
|
||||||
// If an error occurs, it can be retrieved using ReleaseOverlayWindowCookie.Check()
|
|
||||||
func ReleaseOverlayWindowChecked(c *xgb.Conn, Window xproto.Window) ReleaseOverlayWindowCookie {
|
|
||||||
if _, ok := c.Extensions["COMPOSITE"]; !ok {
|
|
||||||
panic("Cannot issue request 'ReleaseOverlayWindow' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.")
|
|
||||||
}
|
|
||||||
cookie := c.NewCookie(true, false)
|
|
||||||
c.NewRequest(releaseOverlayWindowRequest(c, Window), cookie)
|
|
||||||
return ReleaseOverlayWindowCookie{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 ReleaseOverlayWindowCookie) Check() error {
|
|
||||||
return cook.Cookie.Check()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write request to wire for ReleaseOverlayWindow
|
|
||||||
// releaseOverlayWindowRequest writes a ReleaseOverlayWindow request to a byte slice.
|
|
||||||
func releaseOverlayWindowRequest(c *xgb.Conn, Window xproto.Window) []byte {
|
|
||||||
size := 8
|
|
||||||
b := 0
|
|
||||||
buf := make([]byte, size)
|
|
||||||
|
|
||||||
buf[b] = c.Extensions["COMPOSITE"]
|
|
||||||
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
|
|
||||||
|
|
||||||
return buf
|
|
||||||
}
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
package damage
|
package damage
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This file was generated by damage.xml on Jun 5 2012 12:11:59am EDT.
|
This file was generated by damage.xml on Aug 11 2013 8:39:43pm EDT.
|
||||||
This file is automatically generated. Edit at your peril!
|
This file is automatically generated. Edit at your peril!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -41,36 +41,51 @@ func init() {
|
||||||
xgb.NewExtErrorFuncs["DAMAGE"] = make(map[int]xgb.NewErrorFun)
|
xgb.NewExtErrorFuncs["DAMAGE"] = make(map[int]xgb.NewErrorFun)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skipping definition for base type 'Int16'
|
// BadBadDamage is the error number for a BadBadDamage.
|
||||||
|
const BadBadDamage = 0
|
||||||
|
|
||||||
// Skipping definition for base type 'Int32'
|
type BadDamageError struct {
|
||||||
|
Sequence uint16
|
||||||
|
NiceName string
|
||||||
|
}
|
||||||
|
|
||||||
// Skipping definition for base type 'Void'
|
// BadDamageErrorNew constructs a BadDamageError value that implements xgb.Error from a byte slice.
|
||||||
|
func BadDamageErrorNew(buf []byte) xgb.Error {
|
||||||
|
v := BadDamageError{}
|
||||||
|
v.NiceName = "BadDamage"
|
||||||
|
|
||||||
// Skipping definition for base type 'Byte'
|
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 'Char'
|
// SequenceId returns the sequence id attached to the BadBadDamage error.
|
||||||
|
// This is mostly used internally.
|
||||||
|
func (err BadDamageError) SequenceId() uint16 {
|
||||||
|
return err.Sequence
|
||||||
|
}
|
||||||
|
|
||||||
// Skipping definition for base type 'Card32'
|
// BadId returns the 'BadValue' number if one exists for the BadBadDamage error. If no bad value exists, 0 is returned.
|
||||||
|
func (err BadDamageError) BadId() uint32 {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
// Skipping definition for base type 'Double'
|
// Error returns a rudimentary string representation of the BadBadDamage error.
|
||||||
|
|
||||||
// Skipping definition for base type 'Bool'
|
func (err BadDamageError) Error() string {
|
||||||
|
fieldVals := make([]string, 0, 0)
|
||||||
|
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
|
||||||
|
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
|
||||||
|
return "BadBadDamage {" + xgb.StringsJoin(fieldVals, ", ") + "}"
|
||||||
|
}
|
||||||
|
|
||||||
// Skipping definition for base type 'Float'
|
func init() {
|
||||||
|
xgb.NewExtErrorFuncs["DAMAGE"][0] = BadDamageErrorNew
|
||||||
// Skipping definition for base type 'Card8'
|
}
|
||||||
|
|
||||||
const (
|
|
||||||
ReportLevelRawRectangles = 0
|
|
||||||
ReportLevelDeltaRectangles = 1
|
|
||||||
ReportLevelBoundingBox = 2
|
|
||||||
ReportLevelNonEmpty = 3
|
|
||||||
)
|
|
||||||
|
|
||||||
type Damage uint32
|
type Damage uint32
|
||||||
|
|
||||||
|
@ -184,128 +199,73 @@ func init() {
|
||||||
xgb.NewExtEventFuncs["DAMAGE"][0] = NotifyEventNew
|
xgb.NewExtEventFuncs["DAMAGE"][0] = NotifyEventNew
|
||||||
}
|
}
|
||||||
|
|
||||||
// BadBadDamage is the error number for a BadBadDamage.
|
const (
|
||||||
const BadBadDamage = 0
|
ReportLevelRawRectangles = 0
|
||||||
|
ReportLevelDeltaRectangles = 1
|
||||||
|
ReportLevelBoundingBox = 2
|
||||||
|
ReportLevelNonEmpty = 3
|
||||||
|
)
|
||||||
|
|
||||||
type BadDamageError struct {
|
// Skipping definition for base type 'Bool'
|
||||||
Sequence uint16
|
|
||||||
NiceName string
|
|
||||||
}
|
|
||||||
|
|
||||||
// BadDamageErrorNew constructs a BadDamageError value that implements xgb.Error from a byte slice.
|
// Skipping definition for base type 'Byte'
|
||||||
func BadDamageErrorNew(buf []byte) xgb.Error {
|
|
||||||
v := BadDamageError{}
|
|
||||||
v.NiceName = "BadDamage"
|
|
||||||
|
|
||||||
b := 1 // skip error determinant
|
// Skipping definition for base type 'Card8'
|
||||||
b += 1 // don't read error number
|
|
||||||
|
|
||||||
v.Sequence = xgb.Get16(buf[b:])
|
// Skipping definition for base type 'Char'
|
||||||
b += 2
|
|
||||||
|
|
||||||
return v
|
// Skipping definition for base type 'Void'
|
||||||
}
|
|
||||||
|
|
||||||
// SequenceId returns the sequence id attached to the BadBadDamage error.
|
// Skipping definition for base type 'Double'
|
||||||
// This is mostly used internally.
|
|
||||||
func (err BadDamageError) SequenceId() uint16 {
|
|
||||||
return err.Sequence
|
|
||||||
}
|
|
||||||
|
|
||||||
// BadId returns the 'BadValue' number if one exists for the BadBadDamage error. If no bad value exists, 0 is returned.
|
// Skipping definition for base type 'Float'
|
||||||
func (err BadDamageError) BadId() uint32 {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
// Error returns a rudimentary string representation of the BadBadDamage error.
|
// Skipping definition for base type 'Int16'
|
||||||
|
|
||||||
func (err BadDamageError) Error() string {
|
// Skipping definition for base type 'Int32'
|
||||||
fieldVals := make([]string, 0, 0)
|
|
||||||
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
|
|
||||||
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
|
|
||||||
return "BadBadDamage {" + xgb.StringsJoin(fieldVals, ", ") + "}"
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() {
|
// Skipping definition for base type 'Int8'
|
||||||
xgb.NewExtErrorFuncs["DAMAGE"][0] = BadDamageErrorNew
|
|
||||||
}
|
|
||||||
|
|
||||||
// QueryVersionCookie is a cookie used only for QueryVersion requests.
|
// Skipping definition for base type 'Card16'
|
||||||
type QueryVersionCookie struct {
|
|
||||||
|
// Skipping definition for base type 'Card32'
|
||||||
|
|
||||||
|
// AddCookie is a cookie used only for Add requests.
|
||||||
|
type AddCookie struct {
|
||||||
*xgb.Cookie
|
*xgb.Cookie
|
||||||
}
|
}
|
||||||
|
|
||||||
// QueryVersion sends a checked request.
|
// Add sends an unchecked 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["DAMAGE"]; !ok {
|
|
||||||
panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'DAMAGE'. damage.Init(connObj) must be called first.")
|
|
||||||
}
|
|
||||||
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.
|
// 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 {
|
func Add(c *xgb.Conn, Drawable xproto.Drawable, Region xfixes.Region) AddCookie {
|
||||||
if _, ok := c.Extensions["DAMAGE"]; !ok {
|
if _, ok := c.Extensions["DAMAGE"]; !ok {
|
||||||
panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'DAMAGE'. damage.Init(connObj) must be called first.")
|
panic("Cannot issue request 'Add' using the uninitialized extension 'DAMAGE'. damage.Init(connObj) must be called first.")
|
||||||
}
|
}
|
||||||
cookie := c.NewCookie(false, true)
|
cookie := c.NewCookie(false, false)
|
||||||
c.NewRequest(queryVersionRequest(c, ClientMajorVersion, ClientMinorVersion), cookie)
|
c.NewRequest(addRequest(c, Drawable, Region), cookie)
|
||||||
return QueryVersionCookie{cookie}
|
return AddCookie{cookie}
|
||||||
}
|
}
|
||||||
|
|
||||||
// QueryVersionReply represents the data returned from a QueryVersion request.
|
// AddChecked sends a checked request.
|
||||||
type QueryVersionReply struct {
|
// If an error occurs, it can be retrieved using AddCookie.Check()
|
||||||
Sequence uint16 // sequence number of the request for this reply
|
func AddChecked(c *xgb.Conn, Drawable xproto.Drawable, Region xfixes.Region) AddCookie {
|
||||||
Length uint32 // number of bytes in this reply
|
if _, ok := c.Extensions["DAMAGE"]; !ok {
|
||||||
// padding: 1 bytes
|
panic("Cannot issue request 'Add' using the uninitialized extension 'DAMAGE'. damage.Init(connObj) must be called first.")
|
||||||
MajorVersion uint32
|
|
||||||
MinorVersion uint32
|
|
||||||
// padding: 16 bytes
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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 {
|
cookie := c.NewCookie(true, false)
|
||||||
return nil, nil
|
c.NewRequest(addRequest(c, Drawable, Region), cookie)
|
||||||
}
|
return AddCookie{cookie}
|
||||||
return queryVersionReply(buf), nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// queryVersionReply reads a byte slice into a QueryVersionReply value.
|
// Check returns an error if one occurred for checked requests that are not expecting a reply.
|
||||||
func queryVersionReply(buf []byte) *QueryVersionReply {
|
// This cannot be called for requests expecting a reply, nor for unchecked requests.
|
||||||
v := new(QueryVersionReply)
|
func (cook AddCookie) Check() error {
|
||||||
b := 1 // skip reply determinant
|
return cook.Cookie.Check()
|
||||||
|
|
||||||
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
|
// Write request to wire for Add
|
||||||
// queryVersionRequest writes a QueryVersion request to a byte slice.
|
// addRequest writes a Add request to a byte slice.
|
||||||
func queryVersionRequest(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVersion uint32) []byte {
|
func addRequest(c *xgb.Conn, Drawable xproto.Drawable, Region xfixes.Region) []byte {
|
||||||
size := 12
|
size := 12
|
||||||
b := 0
|
b := 0
|
||||||
buf := make([]byte, size)
|
buf := make([]byte, size)
|
||||||
|
@ -313,16 +273,16 @@ func queryVersionRequest(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVers
|
||||||
buf[b] = c.Extensions["DAMAGE"]
|
buf[b] = c.Extensions["DAMAGE"]
|
||||||
b += 1
|
b += 1
|
||||||
|
|
||||||
buf[b] = 0 // request opcode
|
buf[b] = 4 // request opcode
|
||||||
b += 1
|
b += 1
|
||||||
|
|
||||||
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
|
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
|
||||||
b += 2
|
b += 2
|
||||||
|
|
||||||
xgb.Put32(buf[b:], ClientMajorVersion)
|
xgb.Put32(buf[b:], uint32(Drawable))
|
||||||
b += 4
|
b += 4
|
||||||
|
|
||||||
xgb.Put32(buf[b:], ClientMinorVersion)
|
xgb.Put32(buf[b:], uint32(Region))
|
||||||
b += 4
|
b += 4
|
||||||
|
|
||||||
return buf
|
return buf
|
||||||
|
@ -446,6 +406,104 @@ func destroyRequest(c *xgb.Conn, Damage Damage) []byte {
|
||||||
return buf
|
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, ClientMajorVersion uint32, ClientMinorVersion uint32) QueryVersionCookie {
|
||||||
|
if _, ok := c.Extensions["DAMAGE"]; !ok {
|
||||||
|
panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'DAMAGE'. damage.Init(connObj) must be called first.")
|
||||||
|
}
|
||||||
|
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 {
|
||||||
|
if _, ok := c.Extensions["DAMAGE"]; !ok {
|
||||||
|
panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'DAMAGE'. damage.Init(connObj) must be called first.")
|
||||||
|
}
|
||||||
|
cookie := c.NewCookie(false, true)
|
||||||
|
c.NewRequest(queryVersionRequest(c, ClientMajorVersion, ClientMinorVersion), 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 uint32
|
||||||
|
MinorVersion uint32
|
||||||
|
// padding: 16 bytes
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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["DAMAGE"]
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
// SubtractCookie is a cookie used only for Subtract requests.
|
// SubtractCookie is a cookie used only for Subtract requests.
|
||||||
type SubtractCookie struct {
|
type SubtractCookie struct {
|
||||||
*xgb.Cookie
|
*xgb.Cookie
|
||||||
|
@ -506,61 +564,3 @@ func subtractRequest(c *xgb.Conn, Damage Damage, Repair xfixes.Region, Parts xfi
|
||||||
|
|
||||||
return buf
|
return buf
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddCookie is a cookie used only for Add requests.
|
|
||||||
type AddCookie struct {
|
|
||||||
*xgb.Cookie
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add sends an unchecked request.
|
|
||||||
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
|
||||||
func Add(c *xgb.Conn, Drawable xproto.Drawable, Region xfixes.Region) AddCookie {
|
|
||||||
if _, ok := c.Extensions["DAMAGE"]; !ok {
|
|
||||||
panic("Cannot issue request 'Add' using the uninitialized extension 'DAMAGE'. damage.Init(connObj) must be called first.")
|
|
||||||
}
|
|
||||||
cookie := c.NewCookie(false, false)
|
|
||||||
c.NewRequest(addRequest(c, Drawable, Region), cookie)
|
|
||||||
return AddCookie{cookie}
|
|
||||||
}
|
|
||||||
|
|
||||||
// AddChecked sends a checked request.
|
|
||||||
// If an error occurs, it can be retrieved using AddCookie.Check()
|
|
||||||
func AddChecked(c *xgb.Conn, Drawable xproto.Drawable, Region xfixes.Region) AddCookie {
|
|
||||||
if _, ok := c.Extensions["DAMAGE"]; !ok {
|
|
||||||
panic("Cannot issue request 'Add' using the uninitialized extension 'DAMAGE'. damage.Init(connObj) must be called first.")
|
|
||||||
}
|
|
||||||
cookie := c.NewCookie(true, false)
|
|
||||||
c.NewRequest(addRequest(c, Drawable, Region), cookie)
|
|
||||||
return AddCookie{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 AddCookie) Check() error {
|
|
||||||
return cook.Cookie.Check()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write request to wire for Add
|
|
||||||
// addRequest writes a Add request to a byte slice.
|
|
||||||
func addRequest(c *xgb.Conn, Drawable xproto.Drawable, Region xfixes.Region) []byte {
|
|
||||||
size := 12
|
|
||||||
b := 0
|
|
||||||
buf := make([]byte, size)
|
|
||||||
|
|
||||||
buf[b] = c.Extensions["DAMAGE"]
|
|
||||||
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(Drawable))
|
|
||||||
b += 4
|
|
||||||
|
|
||||||
xgb.Put32(buf[b:], uint32(Region))
|
|
||||||
b += 4
|
|
||||||
|
|
||||||
return buf
|
|
||||||
}
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
package dpms
|
package dpms
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This file was generated by dpms.xml on Jun 5 2012 12:11:59am EDT.
|
This file was generated by dpms.xml on Aug 11 2013 8:39:43pm EDT.
|
||||||
This file is automatically generated. Edit at your peril!
|
This file is automatically generated. Edit at your peril!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -40,30 +40,6 @@ func init() {
|
||||||
xgb.NewExtErrorFuncs["DPMS"] = make(map[int]xgb.NewErrorFun)
|
xgb.NewExtErrorFuncs["DPMS"] = 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'
|
|
||||||
|
|
||||||
// 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 (
|
const (
|
||||||
DPMSModeOn = 0
|
DPMSModeOn = 0
|
||||||
DPMSModeStandby = 1
|
DPMSModeStandby = 1
|
||||||
|
@ -71,100 +47,29 @@ const (
|
||||||
DPMSModeOff = 3
|
DPMSModeOff = 3
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetVersionCookie is a cookie used only for GetVersion requests.
|
// Skipping definition for base type 'Bool'
|
||||||
type GetVersionCookie struct {
|
|
||||||
*xgb.Cookie
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetVersion sends a checked request.
|
// Skipping definition for base type 'Byte'
|
||||||
// If an error occurs, it will be returned with the reply by calling GetVersionCookie.Reply()
|
|
||||||
func GetVersion(c *xgb.Conn, ClientMajorVersion uint16, ClientMinorVersion uint16) GetVersionCookie {
|
|
||||||
if _, ok := c.Extensions["DPMS"]; !ok {
|
|
||||||
panic("Cannot issue request 'GetVersion' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.")
|
|
||||||
}
|
|
||||||
cookie := c.NewCookie(true, true)
|
|
||||||
c.NewRequest(getVersionRequest(c, ClientMajorVersion, ClientMinorVersion), cookie)
|
|
||||||
return GetVersionCookie{cookie}
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetVersionUnchecked sends an unchecked request.
|
// Skipping definition for base type 'Card8'
|
||||||
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
|
||||||
func GetVersionUnchecked(c *xgb.Conn, ClientMajorVersion uint16, ClientMinorVersion uint16) GetVersionCookie {
|
|
||||||
if _, ok := c.Extensions["DPMS"]; !ok {
|
|
||||||
panic("Cannot issue request 'GetVersion' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.")
|
|
||||||
}
|
|
||||||
cookie := c.NewCookie(false, true)
|
|
||||||
c.NewRequest(getVersionRequest(c, ClientMajorVersion, ClientMinorVersion), cookie)
|
|
||||||
return GetVersionCookie{cookie}
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetVersionReply represents the data returned from a GetVersion request.
|
// Skipping definition for base type 'Char'
|
||||||
type GetVersionReply struct {
|
|
||||||
Sequence uint16 // sequence number of the request for this reply
|
|
||||||
Length uint32 // number of bytes in this reply
|
|
||||||
// padding: 1 bytes
|
|
||||||
ServerMajorVersion uint16
|
|
||||||
ServerMinorVersion uint16
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reply blocks and returns the reply data for a GetVersion request.
|
// Skipping definition for base type 'Void'
|
||||||
func (cook GetVersionCookie) Reply() (*GetVersionReply, error) {
|
|
||||||
buf, err := cook.Cookie.Reply()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if buf == nil {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
return getVersionReply(buf), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// getVersionReply reads a byte slice into a GetVersionReply value.
|
// Skipping definition for base type 'Double'
|
||||||
func getVersionReply(buf []byte) *GetVersionReply {
|
|
||||||
v := new(GetVersionReply)
|
|
||||||
b := 1 // skip reply determinant
|
|
||||||
|
|
||||||
b += 1 // padding
|
// Skipping definition for base type 'Float'
|
||||||
|
|
||||||
v.Sequence = xgb.Get16(buf[b:])
|
// Skipping definition for base type 'Int16'
|
||||||
b += 2
|
|
||||||
|
|
||||||
v.Length = xgb.Get32(buf[b:]) // 4-byte units
|
// Skipping definition for base type 'Int32'
|
||||||
b += 4
|
|
||||||
|
|
||||||
v.ServerMajorVersion = xgb.Get16(buf[b:])
|
// Skipping definition for base type 'Int8'
|
||||||
b += 2
|
|
||||||
|
|
||||||
v.ServerMinorVersion = xgb.Get16(buf[b:])
|
// Skipping definition for base type 'Card16'
|
||||||
b += 2
|
|
||||||
|
|
||||||
return v
|
// Skipping definition for base type 'Card32'
|
||||||
}
|
|
||||||
|
|
||||||
// Write request to wire for GetVersion
|
|
||||||
// getVersionRequest writes a GetVersion request to a byte slice.
|
|
||||||
func getVersionRequest(c *xgb.Conn, ClientMajorVersion uint16, ClientMinorVersion uint16) []byte {
|
|
||||||
size := 8
|
|
||||||
b := 0
|
|
||||||
buf := make([]byte, size)
|
|
||||||
|
|
||||||
buf[b] = c.Extensions["DPMS"]
|
|
||||||
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.Put16(buf[b:], ClientMajorVersion)
|
|
||||||
b += 2
|
|
||||||
|
|
||||||
xgb.Put16(buf[b:], ClientMinorVersion)
|
|
||||||
b += 2
|
|
||||||
|
|
||||||
return buf
|
|
||||||
}
|
|
||||||
|
|
||||||
// CapableCookie is a cookie used only for Capable requests.
|
// CapableCookie is a cookie used only for Capable requests.
|
||||||
type CapableCookie struct {
|
type CapableCookie struct {
|
||||||
|
@ -258,6 +163,165 @@ func capableRequest(c *xgb.Conn) []byte {
|
||||||
return buf
|
return buf
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DisableCookie is a cookie used only for Disable requests.
|
||||||
|
type DisableCookie struct {
|
||||||
|
*xgb.Cookie
|
||||||
|
}
|
||||||
|
|
||||||
|
// Disable sends an unchecked request.
|
||||||
|
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
||||||
|
func Disable(c *xgb.Conn) DisableCookie {
|
||||||
|
if _, ok := c.Extensions["DPMS"]; !ok {
|
||||||
|
panic("Cannot issue request 'Disable' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.")
|
||||||
|
}
|
||||||
|
cookie := c.NewCookie(false, false)
|
||||||
|
c.NewRequest(disableRequest(c), cookie)
|
||||||
|
return DisableCookie{cookie}
|
||||||
|
}
|
||||||
|
|
||||||
|
// DisableChecked sends a checked request.
|
||||||
|
// If an error occurs, it can be retrieved using DisableCookie.Check()
|
||||||
|
func DisableChecked(c *xgb.Conn) DisableCookie {
|
||||||
|
if _, ok := c.Extensions["DPMS"]; !ok {
|
||||||
|
panic("Cannot issue request 'Disable' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.")
|
||||||
|
}
|
||||||
|
cookie := c.NewCookie(true, false)
|
||||||
|
c.NewRequest(disableRequest(c), cookie)
|
||||||
|
return DisableCookie{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 DisableCookie) Check() error {
|
||||||
|
return cook.Cookie.Check()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write request to wire for Disable
|
||||||
|
// disableRequest writes a Disable request to a byte slice.
|
||||||
|
func disableRequest(c *xgb.Conn) []byte {
|
||||||
|
size := 4
|
||||||
|
b := 0
|
||||||
|
buf := make([]byte, size)
|
||||||
|
|
||||||
|
buf[b] = c.Extensions["DPMS"]
|
||||||
|
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
|
||||||
|
|
||||||
|
return buf
|
||||||
|
}
|
||||||
|
|
||||||
|
// EnableCookie is a cookie used only for Enable requests.
|
||||||
|
type EnableCookie struct {
|
||||||
|
*xgb.Cookie
|
||||||
|
}
|
||||||
|
|
||||||
|
// Enable sends an unchecked request.
|
||||||
|
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
||||||
|
func Enable(c *xgb.Conn) EnableCookie {
|
||||||
|
if _, ok := c.Extensions["DPMS"]; !ok {
|
||||||
|
panic("Cannot issue request 'Enable' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.")
|
||||||
|
}
|
||||||
|
cookie := c.NewCookie(false, false)
|
||||||
|
c.NewRequest(enableRequest(c), cookie)
|
||||||
|
return EnableCookie{cookie}
|
||||||
|
}
|
||||||
|
|
||||||
|
// EnableChecked sends a checked request.
|
||||||
|
// If an error occurs, it can be retrieved using EnableCookie.Check()
|
||||||
|
func EnableChecked(c *xgb.Conn) EnableCookie {
|
||||||
|
if _, ok := c.Extensions["DPMS"]; !ok {
|
||||||
|
panic("Cannot issue request 'Enable' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.")
|
||||||
|
}
|
||||||
|
cookie := c.NewCookie(true, false)
|
||||||
|
c.NewRequest(enableRequest(c), cookie)
|
||||||
|
return EnableCookie{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 EnableCookie) Check() error {
|
||||||
|
return cook.Cookie.Check()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write request to wire for Enable
|
||||||
|
// enableRequest writes a Enable request to a byte slice.
|
||||||
|
func enableRequest(c *xgb.Conn) []byte {
|
||||||
|
size := 4
|
||||||
|
b := 0
|
||||||
|
buf := make([]byte, size)
|
||||||
|
|
||||||
|
buf[b] = c.Extensions["DPMS"]
|
||||||
|
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
|
||||||
|
|
||||||
|
return buf
|
||||||
|
}
|
||||||
|
|
||||||
|
// ForceLevelCookie is a cookie used only for ForceLevel requests.
|
||||||
|
type ForceLevelCookie struct {
|
||||||
|
*xgb.Cookie
|
||||||
|
}
|
||||||
|
|
||||||
|
// ForceLevel sends an unchecked request.
|
||||||
|
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
||||||
|
func ForceLevel(c *xgb.Conn, PowerLevel uint16) ForceLevelCookie {
|
||||||
|
if _, ok := c.Extensions["DPMS"]; !ok {
|
||||||
|
panic("Cannot issue request 'ForceLevel' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.")
|
||||||
|
}
|
||||||
|
cookie := c.NewCookie(false, false)
|
||||||
|
c.NewRequest(forceLevelRequest(c, PowerLevel), cookie)
|
||||||
|
return ForceLevelCookie{cookie}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ForceLevelChecked sends a checked request.
|
||||||
|
// If an error occurs, it can be retrieved using ForceLevelCookie.Check()
|
||||||
|
func ForceLevelChecked(c *xgb.Conn, PowerLevel uint16) ForceLevelCookie {
|
||||||
|
if _, ok := c.Extensions["DPMS"]; !ok {
|
||||||
|
panic("Cannot issue request 'ForceLevel' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.")
|
||||||
|
}
|
||||||
|
cookie := c.NewCookie(true, false)
|
||||||
|
c.NewRequest(forceLevelRequest(c, PowerLevel), cookie)
|
||||||
|
return ForceLevelCookie{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 ForceLevelCookie) Check() error {
|
||||||
|
return cook.Cookie.Check()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write request to wire for ForceLevel
|
||||||
|
// forceLevelRequest writes a ForceLevel request to a byte slice.
|
||||||
|
func forceLevelRequest(c *xgb.Conn, PowerLevel uint16) []byte {
|
||||||
|
size := 8
|
||||||
|
b := 0
|
||||||
|
buf := make([]byte, size)
|
||||||
|
|
||||||
|
buf[b] = c.Extensions["DPMS"]
|
||||||
|
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.Put16(buf[b:], PowerLevel)
|
||||||
|
b += 2
|
||||||
|
|
||||||
|
return buf
|
||||||
|
}
|
||||||
|
|
||||||
// GetTimeoutsCookie is a cookie used only for GetTimeouts requests.
|
// GetTimeoutsCookie is a cookie used only for GetTimeouts requests.
|
||||||
type GetTimeoutsCookie struct {
|
type GetTimeoutsCookie struct {
|
||||||
*xgb.Cookie
|
*xgb.Cookie
|
||||||
|
@ -354,207 +418,79 @@ func getTimeoutsRequest(c *xgb.Conn) []byte {
|
||||||
return buf
|
return buf
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetTimeoutsCookie is a cookie used only for SetTimeouts requests.
|
// GetVersionCookie is a cookie used only for GetVersion requests.
|
||||||
type SetTimeoutsCookie struct {
|
type GetVersionCookie struct {
|
||||||
*xgb.Cookie
|
*xgb.Cookie
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetTimeouts sends an unchecked request.
|
// GetVersion sends a checked request.
|
||||||
|
// If an error occurs, it will be returned with the reply by calling GetVersionCookie.Reply()
|
||||||
|
func GetVersion(c *xgb.Conn, ClientMajorVersion uint16, ClientMinorVersion uint16) GetVersionCookie {
|
||||||
|
if _, ok := c.Extensions["DPMS"]; !ok {
|
||||||
|
panic("Cannot issue request 'GetVersion' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.")
|
||||||
|
}
|
||||||
|
cookie := c.NewCookie(true, true)
|
||||||
|
c.NewRequest(getVersionRequest(c, ClientMajorVersion, ClientMinorVersion), cookie)
|
||||||
|
return GetVersionCookie{cookie}
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetVersionUnchecked sends an unchecked request.
|
||||||
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
||||||
func SetTimeouts(c *xgb.Conn, StandbyTimeout uint16, SuspendTimeout uint16, OffTimeout uint16) SetTimeoutsCookie {
|
func GetVersionUnchecked(c *xgb.Conn, ClientMajorVersion uint16, ClientMinorVersion uint16) GetVersionCookie {
|
||||||
if _, ok := c.Extensions["DPMS"]; !ok {
|
if _, ok := c.Extensions["DPMS"]; !ok {
|
||||||
panic("Cannot issue request 'SetTimeouts' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.")
|
panic("Cannot issue request 'GetVersion' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.")
|
||||||
}
|
}
|
||||||
cookie := c.NewCookie(false, false)
|
cookie := c.NewCookie(false, true)
|
||||||
c.NewRequest(setTimeoutsRequest(c, StandbyTimeout, SuspendTimeout, OffTimeout), cookie)
|
c.NewRequest(getVersionRequest(c, ClientMajorVersion, ClientMinorVersion), cookie)
|
||||||
return SetTimeoutsCookie{cookie}
|
return GetVersionCookie{cookie}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetTimeoutsChecked sends a checked request.
|
// GetVersionReply represents the data returned from a GetVersion request.
|
||||||
// If an error occurs, it can be retrieved using SetTimeoutsCookie.Check()
|
type GetVersionReply struct {
|
||||||
func SetTimeoutsChecked(c *xgb.Conn, StandbyTimeout uint16, SuspendTimeout uint16, OffTimeout uint16) SetTimeoutsCookie {
|
Sequence uint16 // sequence number of the request for this reply
|
||||||
if _, ok := c.Extensions["DPMS"]; !ok {
|
Length uint32 // number of bytes in this reply
|
||||||
panic("Cannot issue request 'SetTimeouts' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.")
|
// padding: 1 bytes
|
||||||
|
ServerMajorVersion uint16
|
||||||
|
ServerMinorVersion uint16
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reply blocks and returns the reply data for a GetVersion request.
|
||||||
|
func (cook GetVersionCookie) Reply() (*GetVersionReply, error) {
|
||||||
|
buf, err := cook.Cookie.Reply()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
}
|
}
|
||||||
cookie := c.NewCookie(true, false)
|
if buf == nil {
|
||||||
c.NewRequest(setTimeoutsRequest(c, StandbyTimeout, SuspendTimeout, OffTimeout), cookie)
|
return nil, nil
|
||||||
return SetTimeoutsCookie{cookie}
|
}
|
||||||
|
return getVersionReply(buf), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check returns an error if one occurred for checked requests that are not expecting a reply.
|
// getVersionReply reads a byte slice into a GetVersionReply value.
|
||||||
// This cannot be called for requests expecting a reply, nor for unchecked requests.
|
func getVersionReply(buf []byte) *GetVersionReply {
|
||||||
func (cook SetTimeoutsCookie) Check() error {
|
v := new(GetVersionReply)
|
||||||
return cook.Cookie.Check()
|
b := 1 // skip reply determinant
|
||||||
}
|
|
||||||
|
|
||||||
// Write request to wire for SetTimeouts
|
b += 1 // padding
|
||||||
// setTimeoutsRequest writes a SetTimeouts request to a byte slice.
|
|
||||||
func setTimeoutsRequest(c *xgb.Conn, StandbyTimeout uint16, SuspendTimeout uint16, OffTimeout uint16) []byte {
|
|
||||||
size := 12
|
|
||||||
b := 0
|
|
||||||
buf := make([]byte, size)
|
|
||||||
|
|
||||||
buf[b] = c.Extensions["DPMS"]
|
v.Sequence = xgb.Get16(buf[b:])
|
||||||
b += 1
|
|
||||||
|
|
||||||
buf[b] = 3 // request opcode
|
|
||||||
b += 1
|
|
||||||
|
|
||||||
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
|
|
||||||
b += 2
|
b += 2
|
||||||
|
|
||||||
xgb.Put16(buf[b:], StandbyTimeout)
|
v.Length = xgb.Get32(buf[b:]) // 4-byte units
|
||||||
|
b += 4
|
||||||
|
|
||||||
|
v.ServerMajorVersion = xgb.Get16(buf[b:])
|
||||||
b += 2
|
b += 2
|
||||||
|
|
||||||
xgb.Put16(buf[b:], SuspendTimeout)
|
v.ServerMinorVersion = xgb.Get16(buf[b:])
|
||||||
b += 2
|
b += 2
|
||||||
|
|
||||||
xgb.Put16(buf[b:], OffTimeout)
|
return v
|
||||||
b += 2
|
|
||||||
|
|
||||||
return buf
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// EnableCookie is a cookie used only for Enable requests.
|
// Write request to wire for GetVersion
|
||||||
type EnableCookie struct {
|
// getVersionRequest writes a GetVersion request to a byte slice.
|
||||||
*xgb.Cookie
|
func getVersionRequest(c *xgb.Conn, ClientMajorVersion uint16, ClientMinorVersion uint16) []byte {
|
||||||
}
|
|
||||||
|
|
||||||
// Enable sends an unchecked request.
|
|
||||||
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
|
||||||
func Enable(c *xgb.Conn) EnableCookie {
|
|
||||||
if _, ok := c.Extensions["DPMS"]; !ok {
|
|
||||||
panic("Cannot issue request 'Enable' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.")
|
|
||||||
}
|
|
||||||
cookie := c.NewCookie(false, false)
|
|
||||||
c.NewRequest(enableRequest(c), cookie)
|
|
||||||
return EnableCookie{cookie}
|
|
||||||
}
|
|
||||||
|
|
||||||
// EnableChecked sends a checked request.
|
|
||||||
// If an error occurs, it can be retrieved using EnableCookie.Check()
|
|
||||||
func EnableChecked(c *xgb.Conn) EnableCookie {
|
|
||||||
if _, ok := c.Extensions["DPMS"]; !ok {
|
|
||||||
panic("Cannot issue request 'Enable' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.")
|
|
||||||
}
|
|
||||||
cookie := c.NewCookie(true, false)
|
|
||||||
c.NewRequest(enableRequest(c), cookie)
|
|
||||||
return EnableCookie{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 EnableCookie) Check() error {
|
|
||||||
return cook.Cookie.Check()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write request to wire for Enable
|
|
||||||
// enableRequest writes a Enable request to a byte slice.
|
|
||||||
func enableRequest(c *xgb.Conn) []byte {
|
|
||||||
size := 4
|
|
||||||
b := 0
|
|
||||||
buf := make([]byte, size)
|
|
||||||
|
|
||||||
buf[b] = c.Extensions["DPMS"]
|
|
||||||
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
|
|
||||||
|
|
||||||
return buf
|
|
||||||
}
|
|
||||||
|
|
||||||
// DisableCookie is a cookie used only for Disable requests.
|
|
||||||
type DisableCookie struct {
|
|
||||||
*xgb.Cookie
|
|
||||||
}
|
|
||||||
|
|
||||||
// Disable sends an unchecked request.
|
|
||||||
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
|
||||||
func Disable(c *xgb.Conn) DisableCookie {
|
|
||||||
if _, ok := c.Extensions["DPMS"]; !ok {
|
|
||||||
panic("Cannot issue request 'Disable' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.")
|
|
||||||
}
|
|
||||||
cookie := c.NewCookie(false, false)
|
|
||||||
c.NewRequest(disableRequest(c), cookie)
|
|
||||||
return DisableCookie{cookie}
|
|
||||||
}
|
|
||||||
|
|
||||||
// DisableChecked sends a checked request.
|
|
||||||
// If an error occurs, it can be retrieved using DisableCookie.Check()
|
|
||||||
func DisableChecked(c *xgb.Conn) DisableCookie {
|
|
||||||
if _, ok := c.Extensions["DPMS"]; !ok {
|
|
||||||
panic("Cannot issue request 'Disable' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.")
|
|
||||||
}
|
|
||||||
cookie := c.NewCookie(true, false)
|
|
||||||
c.NewRequest(disableRequest(c), cookie)
|
|
||||||
return DisableCookie{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 DisableCookie) Check() error {
|
|
||||||
return cook.Cookie.Check()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write request to wire for Disable
|
|
||||||
// disableRequest writes a Disable request to a byte slice.
|
|
||||||
func disableRequest(c *xgb.Conn) []byte {
|
|
||||||
size := 4
|
|
||||||
b := 0
|
|
||||||
buf := make([]byte, size)
|
|
||||||
|
|
||||||
buf[b] = c.Extensions["DPMS"]
|
|
||||||
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
|
|
||||||
|
|
||||||
return buf
|
|
||||||
}
|
|
||||||
|
|
||||||
// ForceLevelCookie is a cookie used only for ForceLevel requests.
|
|
||||||
type ForceLevelCookie struct {
|
|
||||||
*xgb.Cookie
|
|
||||||
}
|
|
||||||
|
|
||||||
// ForceLevel sends an unchecked request.
|
|
||||||
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
|
||||||
func ForceLevel(c *xgb.Conn, PowerLevel uint16) ForceLevelCookie {
|
|
||||||
if _, ok := c.Extensions["DPMS"]; !ok {
|
|
||||||
panic("Cannot issue request 'ForceLevel' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.")
|
|
||||||
}
|
|
||||||
cookie := c.NewCookie(false, false)
|
|
||||||
c.NewRequest(forceLevelRequest(c, PowerLevel), cookie)
|
|
||||||
return ForceLevelCookie{cookie}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ForceLevelChecked sends a checked request.
|
|
||||||
// If an error occurs, it can be retrieved using ForceLevelCookie.Check()
|
|
||||||
func ForceLevelChecked(c *xgb.Conn, PowerLevel uint16) ForceLevelCookie {
|
|
||||||
if _, ok := c.Extensions["DPMS"]; !ok {
|
|
||||||
panic("Cannot issue request 'ForceLevel' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.")
|
|
||||||
}
|
|
||||||
cookie := c.NewCookie(true, false)
|
|
||||||
c.NewRequest(forceLevelRequest(c, PowerLevel), cookie)
|
|
||||||
return ForceLevelCookie{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 ForceLevelCookie) Check() error {
|
|
||||||
return cook.Cookie.Check()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write request to wire for ForceLevel
|
|
||||||
// forceLevelRequest writes a ForceLevel request to a byte slice.
|
|
||||||
func forceLevelRequest(c *xgb.Conn, PowerLevel uint16) []byte {
|
|
||||||
size := 8
|
size := 8
|
||||||
b := 0
|
b := 0
|
||||||
buf := make([]byte, size)
|
buf := make([]byte, size)
|
||||||
|
@ -562,13 +498,16 @@ func forceLevelRequest(c *xgb.Conn, PowerLevel uint16) []byte {
|
||||||
buf[b] = c.Extensions["DPMS"]
|
buf[b] = c.Extensions["DPMS"]
|
||||||
b += 1
|
b += 1
|
||||||
|
|
||||||
buf[b] = 6 // request opcode
|
buf[b] = 0 // request opcode
|
||||||
b += 1
|
b += 1
|
||||||
|
|
||||||
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
|
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
|
||||||
b += 2
|
b += 2
|
||||||
|
|
||||||
xgb.Put16(buf[b:], PowerLevel)
|
xgb.Put16(buf[b:], ClientMajorVersion)
|
||||||
|
b += 2
|
||||||
|
|
||||||
|
xgb.Put16(buf[b:], ClientMinorVersion)
|
||||||
b += 2
|
b += 2
|
||||||
|
|
||||||
return buf
|
return buf
|
||||||
|
@ -669,3 +608,64 @@ func infoRequest(c *xgb.Conn) []byte {
|
||||||
|
|
||||||
return buf
|
return buf
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetTimeoutsCookie is a cookie used only for SetTimeouts requests.
|
||||||
|
type SetTimeoutsCookie struct {
|
||||||
|
*xgb.Cookie
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeouts sends an unchecked request.
|
||||||
|
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
||||||
|
func SetTimeouts(c *xgb.Conn, StandbyTimeout uint16, SuspendTimeout uint16, OffTimeout uint16) SetTimeoutsCookie {
|
||||||
|
if _, ok := c.Extensions["DPMS"]; !ok {
|
||||||
|
panic("Cannot issue request 'SetTimeouts' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.")
|
||||||
|
}
|
||||||
|
cookie := c.NewCookie(false, false)
|
||||||
|
c.NewRequest(setTimeoutsRequest(c, StandbyTimeout, SuspendTimeout, OffTimeout), cookie)
|
||||||
|
return SetTimeoutsCookie{cookie}
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTimeoutsChecked sends a checked request.
|
||||||
|
// If an error occurs, it can be retrieved using SetTimeoutsCookie.Check()
|
||||||
|
func SetTimeoutsChecked(c *xgb.Conn, StandbyTimeout uint16, SuspendTimeout uint16, OffTimeout uint16) SetTimeoutsCookie {
|
||||||
|
if _, ok := c.Extensions["DPMS"]; !ok {
|
||||||
|
panic("Cannot issue request 'SetTimeouts' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.")
|
||||||
|
}
|
||||||
|
cookie := c.NewCookie(true, false)
|
||||||
|
c.NewRequest(setTimeoutsRequest(c, StandbyTimeout, SuspendTimeout, OffTimeout), cookie)
|
||||||
|
return SetTimeoutsCookie{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 SetTimeoutsCookie) Check() error {
|
||||||
|
return cook.Cookie.Check()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write request to wire for SetTimeouts
|
||||||
|
// setTimeoutsRequest writes a SetTimeouts request to a byte slice.
|
||||||
|
func setTimeoutsRequest(c *xgb.Conn, StandbyTimeout uint16, SuspendTimeout uint16, OffTimeout uint16) []byte {
|
||||||
|
size := 12
|
||||||
|
b := 0
|
||||||
|
buf := make([]byte, size)
|
||||||
|
|
||||||
|
buf[b] = c.Extensions["DPMS"]
|
||||||
|
b += 1
|
||||||
|
|
||||||
|
buf[b] = 3 // request opcode
|
||||||
|
b += 1
|
||||||
|
|
||||||
|
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
|
||||||
|
b += 2
|
||||||
|
|
||||||
|
xgb.Put16(buf[b:], StandbyTimeout)
|
||||||
|
b += 2
|
||||||
|
|
||||||
|
xgb.Put16(buf[b:], SuspendTimeout)
|
||||||
|
b += 2
|
||||||
|
|
||||||
|
xgb.Put16(buf[b:], OffTimeout)
|
||||||
|
b += 2
|
||||||
|
|
||||||
|
return buf
|
||||||
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -2,7 +2,7 @@
|
||||||
package ge
|
package ge
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This file was generated by ge.xml on Jun 5 2012 12:11:59am EDT.
|
This file was generated by ge.xml on Aug 11 2013 8:39:43pm EDT.
|
||||||
This file is automatically generated. Edit at your peril!
|
This file is automatically generated. Edit at your peril!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -40,30 +40,30 @@ func init() {
|
||||||
xgb.NewExtErrorFuncs["Generic Event Extension"] = make(map[int]xgb.NewErrorFun)
|
xgb.NewExtErrorFuncs["Generic Event Extension"] = make(map[int]xgb.NewErrorFun)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skipping definition for base type 'Card16'
|
// Skipping definition for base type 'Bool'
|
||||||
|
|
||||||
|
// Skipping definition for base type 'Byte'
|
||||||
|
|
||||||
|
// Skipping definition for base type 'Card8'
|
||||||
|
|
||||||
// Skipping definition for base type 'Char'
|
// Skipping definition for base type 'Char'
|
||||||
|
|
||||||
// Skipping definition for base type 'Card32'
|
// Skipping definition for base type 'Void'
|
||||||
|
|
||||||
// Skipping definition for base type 'Double'
|
// Skipping definition for base type 'Double'
|
||||||
|
|
||||||
// Skipping definition for base type 'Bool'
|
|
||||||
|
|
||||||
// Skipping definition for base type 'Float'
|
// Skipping definition for base type 'Float'
|
||||||
|
|
||||||
// Skipping definition for base type 'Card8'
|
|
||||||
|
|
||||||
// Skipping definition for base type 'Int16'
|
// Skipping definition for base type 'Int16'
|
||||||
|
|
||||||
// Skipping definition for base type 'Int32'
|
// 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 'Int8'
|
||||||
|
|
||||||
|
// Skipping definition for base type 'Card16'
|
||||||
|
|
||||||
|
// Skipping definition for base type 'Card32'
|
||||||
|
|
||||||
// QueryVersionCookie is a cookie used only for QueryVersion requests.
|
// QueryVersionCookie is a cookie used only for QueryVersion requests.
|
||||||
type QueryVersionCookie struct {
|
type QueryVersionCookie struct {
|
||||||
*xgb.Cookie
|
*xgb.Cookie
|
||||||
|
|
11352
nexgb/glx/glx.go
11352
nexgb/glx/glx.go
File diff suppressed because it is too large
Load Diff
5150
nexgb/randr/randr.go
5150
nexgb/randr/randr.go
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
368
nexgb/res/res.go
368
nexgb/res/res.go
|
@ -2,7 +2,7 @@
|
||||||
package res
|
package res
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This file was generated by res.xml on Jun 5 2012 12:11:59am EDT.
|
This file was generated by res.xml on Aug 11 2013 8:39:43pm EDT.
|
||||||
This file is automatically generated. Edit at your peril!
|
This file is automatically generated. Edit at your peril!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -40,30 +40,6 @@ func init() {
|
||||||
xgb.NewExtErrorFuncs["X-Resource"] = make(map[int]xgb.NewErrorFun)
|
xgb.NewExtErrorFuncs["X-Resource"] = make(map[int]xgb.NewErrorFun)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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'
|
|
||||||
|
|
||||||
// Skipping definition for base type 'Int32'
|
|
||||||
|
|
||||||
// Skipping definition for base type 'Void'
|
|
||||||
|
|
||||||
// Skipping definition for base type 'Byte'
|
|
||||||
|
|
||||||
// Skipping definition for base type 'Int8'
|
|
||||||
|
|
||||||
type Client struct {
|
type Client struct {
|
||||||
ResourceBase uint32
|
ResourceBase uint32
|
||||||
ResourceMask uint32
|
ResourceMask uint32
|
||||||
|
@ -172,44 +148,68 @@ func TypeListBytes(buf []byte, list []Type) int {
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
// QueryVersionCookie is a cookie used only for QueryVersion requests.
|
// Skipping definition for base type 'Bool'
|
||||||
type QueryVersionCookie struct {
|
|
||||||
|
// Skipping definition for base type 'Byte'
|
||||||
|
|
||||||
|
// Skipping definition for base type 'Card8'
|
||||||
|
|
||||||
|
// Skipping definition for base type 'Char'
|
||||||
|
|
||||||
|
// Skipping definition for base type 'Void'
|
||||||
|
|
||||||
|
// Skipping definition for base type 'Double'
|
||||||
|
|
||||||
|
// Skipping definition for base type 'Float'
|
||||||
|
|
||||||
|
// Skipping definition for base type 'Int16'
|
||||||
|
|
||||||
|
// Skipping definition for base type 'Int32'
|
||||||
|
|
||||||
|
// Skipping definition for base type 'Int8'
|
||||||
|
|
||||||
|
// Skipping definition for base type 'Card16'
|
||||||
|
|
||||||
|
// Skipping definition for base type 'Card32'
|
||||||
|
|
||||||
|
// QueryClientPixmapBytesCookie is a cookie used only for QueryClientPixmapBytes requests.
|
||||||
|
type QueryClientPixmapBytesCookie struct {
|
||||||
*xgb.Cookie
|
*xgb.Cookie
|
||||||
}
|
}
|
||||||
|
|
||||||
// QueryVersion sends a checked request.
|
// QueryClientPixmapBytes sends a checked request.
|
||||||
// If an error occurs, it will be returned with the reply by calling QueryVersionCookie.Reply()
|
// If an error occurs, it will be returned with the reply by calling QueryClientPixmapBytesCookie.Reply()
|
||||||
func QueryVersion(c *xgb.Conn, ClientMajor byte, ClientMinor byte) QueryVersionCookie {
|
func QueryClientPixmapBytes(c *xgb.Conn, Xid uint32) QueryClientPixmapBytesCookie {
|
||||||
if _, ok := c.Extensions["X-RESOURCE"]; !ok {
|
if _, ok := c.Extensions["X-RESOURCE"]; !ok {
|
||||||
panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'X-Resource'. res.Init(connObj) must be called first.")
|
panic("Cannot issue request 'QueryClientPixmapBytes' using the uninitialized extension 'X-Resource'. res.Init(connObj) must be called first.")
|
||||||
}
|
}
|
||||||
cookie := c.NewCookie(true, true)
|
cookie := c.NewCookie(true, true)
|
||||||
c.NewRequest(queryVersionRequest(c, ClientMajor, ClientMinor), cookie)
|
c.NewRequest(queryClientPixmapBytesRequest(c, Xid), cookie)
|
||||||
return QueryVersionCookie{cookie}
|
return QueryClientPixmapBytesCookie{cookie}
|
||||||
}
|
}
|
||||||
|
|
||||||
// QueryVersionUnchecked sends an unchecked request.
|
// QueryClientPixmapBytesUnchecked sends an unchecked request.
|
||||||
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
||||||
func QueryVersionUnchecked(c *xgb.Conn, ClientMajor byte, ClientMinor byte) QueryVersionCookie {
|
func QueryClientPixmapBytesUnchecked(c *xgb.Conn, Xid uint32) QueryClientPixmapBytesCookie {
|
||||||
if _, ok := c.Extensions["X-RESOURCE"]; !ok {
|
if _, ok := c.Extensions["X-RESOURCE"]; !ok {
|
||||||
panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'X-Resource'. res.Init(connObj) must be called first.")
|
panic("Cannot issue request 'QueryClientPixmapBytes' using the uninitialized extension 'X-Resource'. res.Init(connObj) must be called first.")
|
||||||
}
|
}
|
||||||
cookie := c.NewCookie(false, true)
|
cookie := c.NewCookie(false, true)
|
||||||
c.NewRequest(queryVersionRequest(c, ClientMajor, ClientMinor), cookie)
|
c.NewRequest(queryClientPixmapBytesRequest(c, Xid), cookie)
|
||||||
return QueryVersionCookie{cookie}
|
return QueryClientPixmapBytesCookie{cookie}
|
||||||
}
|
}
|
||||||
|
|
||||||
// QueryVersionReply represents the data returned from a QueryVersion request.
|
// QueryClientPixmapBytesReply represents the data returned from a QueryClientPixmapBytes request.
|
||||||
type QueryVersionReply struct {
|
type QueryClientPixmapBytesReply struct {
|
||||||
Sequence uint16 // sequence number of the request for this reply
|
Sequence uint16 // sequence number of the request for this reply
|
||||||
Length uint32 // number of bytes in this reply
|
Length uint32 // number of bytes in this reply
|
||||||
// padding: 1 bytes
|
// padding: 1 bytes
|
||||||
ServerMajor uint16
|
Bytes uint32
|
||||||
ServerMinor uint16
|
BytesOverflow uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reply blocks and returns the reply data for a QueryVersion request.
|
// Reply blocks and returns the reply data for a QueryClientPixmapBytes request.
|
||||||
func (cook QueryVersionCookie) Reply() (*QueryVersionReply, error) {
|
func (cook QueryClientPixmapBytesCookie) Reply() (*QueryClientPixmapBytesReply, error) {
|
||||||
buf, err := cook.Cookie.Reply()
|
buf, err := cook.Cookie.Reply()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -217,12 +217,12 @@ func (cook QueryVersionCookie) Reply() (*QueryVersionReply, error) {
|
||||||
if buf == nil {
|
if buf == nil {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
return queryVersionReply(buf), nil
|
return queryClientPixmapBytesReply(buf), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// queryVersionReply reads a byte slice into a QueryVersionReply value.
|
// queryClientPixmapBytesReply reads a byte slice into a QueryClientPixmapBytesReply value.
|
||||||
func queryVersionReply(buf []byte) *QueryVersionReply {
|
func queryClientPixmapBytesReply(buf []byte) *QueryClientPixmapBytesReply {
|
||||||
v := new(QueryVersionReply)
|
v := new(QueryClientPixmapBytesReply)
|
||||||
b := 1 // skip reply determinant
|
b := 1 // skip reply determinant
|
||||||
|
|
||||||
b += 1 // padding
|
b += 1 // padding
|
||||||
|
@ -233,18 +233,18 @@ func queryVersionReply(buf []byte) *QueryVersionReply {
|
||||||
v.Length = xgb.Get32(buf[b:]) // 4-byte units
|
v.Length = xgb.Get32(buf[b:]) // 4-byte units
|
||||||
b += 4
|
b += 4
|
||||||
|
|
||||||
v.ServerMajor = xgb.Get16(buf[b:])
|
v.Bytes = xgb.Get32(buf[b:])
|
||||||
b += 2
|
b += 4
|
||||||
|
|
||||||
v.ServerMinor = xgb.Get16(buf[b:])
|
v.BytesOverflow = xgb.Get32(buf[b:])
|
||||||
b += 2
|
b += 4
|
||||||
|
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write request to wire for QueryVersion
|
// Write request to wire for QueryClientPixmapBytes
|
||||||
// queryVersionRequest writes a QueryVersion request to a byte slice.
|
// queryClientPixmapBytesRequest writes a QueryClientPixmapBytes request to a byte slice.
|
||||||
func queryVersionRequest(c *xgb.Conn, ClientMajor byte, ClientMinor byte) []byte {
|
func queryClientPixmapBytesRequest(c *xgb.Conn, Xid uint32) []byte {
|
||||||
size := 8
|
size := 8
|
||||||
b := 0
|
b := 0
|
||||||
buf := make([]byte, size)
|
buf := make([]byte, size)
|
||||||
|
@ -252,110 +252,15 @@ func queryVersionRequest(c *xgb.Conn, ClientMajor byte, ClientMinor byte) []byte
|
||||||
buf[b] = c.Extensions["X-RESOURCE"]
|
buf[b] = c.Extensions["X-RESOURCE"]
|
||||||
b += 1
|
b += 1
|
||||||
|
|
||||||
buf[b] = 0 // request opcode
|
buf[b] = 3 // request opcode
|
||||||
b += 1
|
b += 1
|
||||||
|
|
||||||
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
|
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
|
||||||
b += 2
|
b += 2
|
||||||
|
|
||||||
buf[b] = ClientMajor
|
xgb.Put32(buf[b:], Xid)
|
||||||
b += 1
|
|
||||||
|
|
||||||
buf[b] = ClientMinor
|
|
||||||
b += 1
|
|
||||||
|
|
||||||
return buf
|
|
||||||
}
|
|
||||||
|
|
||||||
// QueryClientsCookie is a cookie used only for QueryClients requests.
|
|
||||||
type QueryClientsCookie struct {
|
|
||||||
*xgb.Cookie
|
|
||||||
}
|
|
||||||
|
|
||||||
// QueryClients sends a checked request.
|
|
||||||
// If an error occurs, it will be returned with the reply by calling QueryClientsCookie.Reply()
|
|
||||||
func QueryClients(c *xgb.Conn) QueryClientsCookie {
|
|
||||||
if _, ok := c.Extensions["X-RESOURCE"]; !ok {
|
|
||||||
panic("Cannot issue request 'QueryClients' using the uninitialized extension 'X-Resource'. res.Init(connObj) must be called first.")
|
|
||||||
}
|
|
||||||
cookie := c.NewCookie(true, true)
|
|
||||||
c.NewRequest(queryClientsRequest(c), cookie)
|
|
||||||
return QueryClientsCookie{cookie}
|
|
||||||
}
|
|
||||||
|
|
||||||
// QueryClientsUnchecked sends an unchecked request.
|
|
||||||
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
|
||||||
func QueryClientsUnchecked(c *xgb.Conn) QueryClientsCookie {
|
|
||||||
if _, ok := c.Extensions["X-RESOURCE"]; !ok {
|
|
||||||
panic("Cannot issue request 'QueryClients' using the uninitialized extension 'X-Resource'. res.Init(connObj) must be called first.")
|
|
||||||
}
|
|
||||||
cookie := c.NewCookie(false, true)
|
|
||||||
c.NewRequest(queryClientsRequest(c), cookie)
|
|
||||||
return QueryClientsCookie{cookie}
|
|
||||||
}
|
|
||||||
|
|
||||||
// QueryClientsReply represents the data returned from a QueryClients request.
|
|
||||||
type QueryClientsReply struct {
|
|
||||||
Sequence uint16 // sequence number of the request for this reply
|
|
||||||
Length uint32 // number of bytes in this reply
|
|
||||||
// padding: 1 bytes
|
|
||||||
NumClients uint32
|
|
||||||
// padding: 20 bytes
|
|
||||||
Clients []Client // size: xgb.Pad((int(NumClients) * 8))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reply blocks and returns the reply data for a QueryClients request.
|
|
||||||
func (cook QueryClientsCookie) Reply() (*QueryClientsReply, error) {
|
|
||||||
buf, err := cook.Cookie.Reply()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if buf == nil {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
return queryClientsReply(buf), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// queryClientsReply reads a byte slice into a QueryClientsReply value.
|
|
||||||
func queryClientsReply(buf []byte) *QueryClientsReply {
|
|
||||||
v := new(QueryClientsReply)
|
|
||||||
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
|
b += 4
|
||||||
|
|
||||||
v.NumClients = xgb.Get32(buf[b:])
|
|
||||||
b += 4
|
|
||||||
|
|
||||||
b += 20 // padding
|
|
||||||
|
|
||||||
v.Clients = make([]Client, v.NumClients)
|
|
||||||
b += ClientReadList(buf[b:], v.Clients)
|
|
||||||
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write request to wire for QueryClients
|
|
||||||
// queryClientsRequest writes a QueryClients request to a byte slice.
|
|
||||||
func queryClientsRequest(c *xgb.Conn) []byte {
|
|
||||||
size := 4
|
|
||||||
b := 0
|
|
||||||
buf := make([]byte, size)
|
|
||||||
|
|
||||||
buf[b] = c.Extensions["X-RESOURCE"]
|
|
||||||
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
|
return buf
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -454,44 +359,45 @@ func queryClientResourcesRequest(c *xgb.Conn, Xid uint32) []byte {
|
||||||
return buf
|
return buf
|
||||||
}
|
}
|
||||||
|
|
||||||
// QueryClientPixmapBytesCookie is a cookie used only for QueryClientPixmapBytes requests.
|
// QueryClientsCookie is a cookie used only for QueryClients requests.
|
||||||
type QueryClientPixmapBytesCookie struct {
|
type QueryClientsCookie struct {
|
||||||
*xgb.Cookie
|
*xgb.Cookie
|
||||||
}
|
}
|
||||||
|
|
||||||
// QueryClientPixmapBytes sends a checked request.
|
// QueryClients sends a checked request.
|
||||||
// If an error occurs, it will be returned with the reply by calling QueryClientPixmapBytesCookie.Reply()
|
// If an error occurs, it will be returned with the reply by calling QueryClientsCookie.Reply()
|
||||||
func QueryClientPixmapBytes(c *xgb.Conn, Xid uint32) QueryClientPixmapBytesCookie {
|
func QueryClients(c *xgb.Conn) QueryClientsCookie {
|
||||||
if _, ok := c.Extensions["X-RESOURCE"]; !ok {
|
if _, ok := c.Extensions["X-RESOURCE"]; !ok {
|
||||||
panic("Cannot issue request 'QueryClientPixmapBytes' using the uninitialized extension 'X-Resource'. res.Init(connObj) must be called first.")
|
panic("Cannot issue request 'QueryClients' using the uninitialized extension 'X-Resource'. res.Init(connObj) must be called first.")
|
||||||
}
|
}
|
||||||
cookie := c.NewCookie(true, true)
|
cookie := c.NewCookie(true, true)
|
||||||
c.NewRequest(queryClientPixmapBytesRequest(c, Xid), cookie)
|
c.NewRequest(queryClientsRequest(c), cookie)
|
||||||
return QueryClientPixmapBytesCookie{cookie}
|
return QueryClientsCookie{cookie}
|
||||||
}
|
}
|
||||||
|
|
||||||
// QueryClientPixmapBytesUnchecked sends an unchecked request.
|
// QueryClientsUnchecked sends an unchecked request.
|
||||||
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
||||||
func QueryClientPixmapBytesUnchecked(c *xgb.Conn, Xid uint32) QueryClientPixmapBytesCookie {
|
func QueryClientsUnchecked(c *xgb.Conn) QueryClientsCookie {
|
||||||
if _, ok := c.Extensions["X-RESOURCE"]; !ok {
|
if _, ok := c.Extensions["X-RESOURCE"]; !ok {
|
||||||
panic("Cannot issue request 'QueryClientPixmapBytes' using the uninitialized extension 'X-Resource'. res.Init(connObj) must be called first.")
|
panic("Cannot issue request 'QueryClients' using the uninitialized extension 'X-Resource'. res.Init(connObj) must be called first.")
|
||||||
}
|
}
|
||||||
cookie := c.NewCookie(false, true)
|
cookie := c.NewCookie(false, true)
|
||||||
c.NewRequest(queryClientPixmapBytesRequest(c, Xid), cookie)
|
c.NewRequest(queryClientsRequest(c), cookie)
|
||||||
return QueryClientPixmapBytesCookie{cookie}
|
return QueryClientsCookie{cookie}
|
||||||
}
|
}
|
||||||
|
|
||||||
// QueryClientPixmapBytesReply represents the data returned from a QueryClientPixmapBytes request.
|
// QueryClientsReply represents the data returned from a QueryClients request.
|
||||||
type QueryClientPixmapBytesReply struct {
|
type QueryClientsReply struct {
|
||||||
Sequence uint16 // sequence number of the request for this reply
|
Sequence uint16 // sequence number of the request for this reply
|
||||||
Length uint32 // number of bytes in this reply
|
Length uint32 // number of bytes in this reply
|
||||||
// padding: 1 bytes
|
// padding: 1 bytes
|
||||||
Bytes uint32
|
NumClients uint32
|
||||||
BytesOverflow uint32
|
// padding: 20 bytes
|
||||||
|
Clients []Client // size: xgb.Pad((int(NumClients) * 8))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reply blocks and returns the reply data for a QueryClientPixmapBytes request.
|
// Reply blocks and returns the reply data for a QueryClients request.
|
||||||
func (cook QueryClientPixmapBytesCookie) Reply() (*QueryClientPixmapBytesReply, error) {
|
func (cook QueryClientsCookie) Reply() (*QueryClientsReply, error) {
|
||||||
buf, err := cook.Cookie.Reply()
|
buf, err := cook.Cookie.Reply()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -499,12 +405,12 @@ func (cook QueryClientPixmapBytesCookie) Reply() (*QueryClientPixmapBytesReply,
|
||||||
if buf == nil {
|
if buf == nil {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
return queryClientPixmapBytesReply(buf), nil
|
return queryClientsReply(buf), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// queryClientPixmapBytesReply reads a byte slice into a QueryClientPixmapBytesReply value.
|
// queryClientsReply reads a byte slice into a QueryClientsReply value.
|
||||||
func queryClientPixmapBytesReply(buf []byte) *QueryClientPixmapBytesReply {
|
func queryClientsReply(buf []byte) *QueryClientsReply {
|
||||||
v := new(QueryClientPixmapBytesReply)
|
v := new(QueryClientsReply)
|
||||||
b := 1 // skip reply determinant
|
b := 1 // skip reply determinant
|
||||||
|
|
||||||
b += 1 // padding
|
b += 1 // padding
|
||||||
|
@ -515,18 +421,109 @@ func queryClientPixmapBytesReply(buf []byte) *QueryClientPixmapBytesReply {
|
||||||
v.Length = xgb.Get32(buf[b:]) // 4-byte units
|
v.Length = xgb.Get32(buf[b:]) // 4-byte units
|
||||||
b += 4
|
b += 4
|
||||||
|
|
||||||
v.Bytes = xgb.Get32(buf[b:])
|
v.NumClients = xgb.Get32(buf[b:])
|
||||||
b += 4
|
b += 4
|
||||||
|
|
||||||
v.BytesOverflow = xgb.Get32(buf[b:])
|
b += 20 // padding
|
||||||
b += 4
|
|
||||||
|
v.Clients = make([]Client, v.NumClients)
|
||||||
|
b += ClientReadList(buf[b:], v.Clients)
|
||||||
|
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write request to wire for QueryClientPixmapBytes
|
// Write request to wire for QueryClients
|
||||||
// queryClientPixmapBytesRequest writes a QueryClientPixmapBytes request to a byte slice.
|
// queryClientsRequest writes a QueryClients request to a byte slice.
|
||||||
func queryClientPixmapBytesRequest(c *xgb.Conn, Xid uint32) []byte {
|
func queryClientsRequest(c *xgb.Conn) []byte {
|
||||||
|
size := 4
|
||||||
|
b := 0
|
||||||
|
buf := make([]byte, size)
|
||||||
|
|
||||||
|
buf[b] = c.Extensions["X-RESOURCE"]
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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, ClientMajor byte, ClientMinor byte) QueryVersionCookie {
|
||||||
|
if _, ok := c.Extensions["X-RESOURCE"]; !ok {
|
||||||
|
panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'X-Resource'. res.Init(connObj) must be called first.")
|
||||||
|
}
|
||||||
|
cookie := c.NewCookie(true, true)
|
||||||
|
c.NewRequest(queryVersionRequest(c, ClientMajor, ClientMinor), 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, ClientMajor byte, ClientMinor byte) QueryVersionCookie {
|
||||||
|
if _, ok := c.Extensions["X-RESOURCE"]; !ok {
|
||||||
|
panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'X-Resource'. res.Init(connObj) must be called first.")
|
||||||
|
}
|
||||||
|
cookie := c.NewCookie(false, true)
|
||||||
|
c.NewRequest(queryVersionRequest(c, ClientMajor, ClientMinor), 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
|
||||||
|
ServerMajor uint16
|
||||||
|
ServerMinor 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.ServerMajor = xgb.Get16(buf[b:])
|
||||||
|
b += 2
|
||||||
|
|
||||||
|
v.ServerMinor = 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, ClientMajor byte, ClientMinor byte) []byte {
|
||||||
size := 8
|
size := 8
|
||||||
b := 0
|
b := 0
|
||||||
buf := make([]byte, size)
|
buf := make([]byte, size)
|
||||||
|
@ -534,14 +531,17 @@ func queryClientPixmapBytesRequest(c *xgb.Conn, Xid uint32) []byte {
|
||||||
buf[b] = c.Extensions["X-RESOURCE"]
|
buf[b] = c.Extensions["X-RESOURCE"]
|
||||||
b += 1
|
b += 1
|
||||||
|
|
||||||
buf[b] = 3 // request opcode
|
buf[b] = 0 // request opcode
|
||||||
b += 1
|
b += 1
|
||||||
|
|
||||||
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
|
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
|
||||||
b += 2
|
b += 2
|
||||||
|
|
||||||
xgb.Put32(buf[b:], Xid)
|
buf[b] = ClientMajor
|
||||||
b += 4
|
b += 1
|
||||||
|
|
||||||
|
buf[b] = ClientMinor
|
||||||
|
b += 1
|
||||||
|
|
||||||
return buf
|
return buf
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
package screensaver
|
package screensaver
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This file was generated by screensaver.xml on Jun 5 2012 12:11:59am EDT.
|
This file was generated by screensaver.xml on Aug 11 2013 8:39:43pm EDT.
|
||||||
This file is automatically generated. Edit at your peril!
|
This file is automatically generated. Edit at your peril!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -40,46 +40,15 @@ func init() {
|
||||||
xgb.NewExtErrorFuncs["MIT-SCREEN-SAVER"] = make(map[int]xgb.NewErrorFun)
|
xgb.NewExtErrorFuncs["MIT-SCREEN-SAVER"] = make(map[int]xgb.NewErrorFun)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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'
|
|
||||||
|
|
||||||
// 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'
|
|
||||||
|
|
||||||
const (
|
|
||||||
KindBlanked = 0
|
|
||||||
KindInternal = 1
|
|
||||||
KindExternal = 2
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
const (
|
||||||
EventNotifyMask = 1
|
EventNotifyMask = 1
|
||||||
EventCycleMask = 2
|
EventCycleMask = 2
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
StateOff = 0
|
KindBlanked = 0
|
||||||
StateOn = 1
|
KindInternal = 1
|
||||||
StateCycle = 2
|
KindExternal = 2
|
||||||
StateDisabled = 3
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Notify is the event number for a NotifyEvent.
|
// Notify is the event number for a NotifyEvent.
|
||||||
|
@ -214,105 +183,36 @@ func init() {
|
||||||
xgb.NewExtEventFuncs["MIT-SCREEN-SAVER"][0] = NotifyEventNew
|
xgb.NewExtEventFuncs["MIT-SCREEN-SAVER"][0] = NotifyEventNew
|
||||||
}
|
}
|
||||||
|
|
||||||
// QueryVersionCookie is a cookie used only for QueryVersion requests.
|
const (
|
||||||
type QueryVersionCookie struct {
|
StateOff = 0
|
||||||
*xgb.Cookie
|
StateOn = 1
|
||||||
}
|
StateCycle = 2
|
||||||
|
StateDisabled = 3
|
||||||
|
)
|
||||||
|
|
||||||
// QueryVersion sends a checked request.
|
// Skipping definition for base type 'Bool'
|
||||||
// If an error occurs, it will be returned with the reply by calling QueryVersionCookie.Reply()
|
|
||||||
func QueryVersion(c *xgb.Conn, ClientMajorVersion byte, ClientMinorVersion byte) QueryVersionCookie {
|
|
||||||
if _, ok := c.Extensions["MIT-SCREEN-SAVER"]; !ok {
|
|
||||||
panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'MIT-SCREEN-SAVER'. screensaver.Init(connObj) must be called first.")
|
|
||||||
}
|
|
||||||
cookie := c.NewCookie(true, true)
|
|
||||||
c.NewRequest(queryVersionRequest(c, ClientMajorVersion, ClientMinorVersion), cookie)
|
|
||||||
return QueryVersionCookie{cookie}
|
|
||||||
}
|
|
||||||
|
|
||||||
// QueryVersionUnchecked sends an unchecked request.
|
// Skipping definition for base type 'Byte'
|
||||||
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
|
||||||
func QueryVersionUnchecked(c *xgb.Conn, ClientMajorVersion byte, ClientMinorVersion byte) QueryVersionCookie {
|
|
||||||
if _, ok := c.Extensions["MIT-SCREEN-SAVER"]; !ok {
|
|
||||||
panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'MIT-SCREEN-SAVER'. screensaver.Init(connObj) must be called first.")
|
|
||||||
}
|
|
||||||
cookie := c.NewCookie(false, true)
|
|
||||||
c.NewRequest(queryVersionRequest(c, ClientMajorVersion, ClientMinorVersion), cookie)
|
|
||||||
return QueryVersionCookie{cookie}
|
|
||||||
}
|
|
||||||
|
|
||||||
// QueryVersionReply represents the data returned from a QueryVersion request.
|
// Skipping definition for base type 'Card8'
|
||||||
type QueryVersionReply struct {
|
|
||||||
Sequence uint16 // sequence number of the request for this reply
|
|
||||||
Length uint32 // number of bytes in this reply
|
|
||||||
// padding: 1 bytes
|
|
||||||
ServerMajorVersion uint16
|
|
||||||
ServerMinorVersion uint16
|
|
||||||
// padding: 20 bytes
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reply blocks and returns the reply data for a QueryVersion request.
|
// Skipping definition for base type 'Char'
|
||||||
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.
|
// Skipping definition for base type 'Void'
|
||||||
func queryVersionReply(buf []byte) *QueryVersionReply {
|
|
||||||
v := new(QueryVersionReply)
|
|
||||||
b := 1 // skip reply determinant
|
|
||||||
|
|
||||||
b += 1 // padding
|
// Skipping definition for base type 'Double'
|
||||||
|
|
||||||
v.Sequence = xgb.Get16(buf[b:])
|
// Skipping definition for base type 'Float'
|
||||||
b += 2
|
|
||||||
|
|
||||||
v.Length = xgb.Get32(buf[b:]) // 4-byte units
|
// Skipping definition for base type 'Int16'
|
||||||
b += 4
|
|
||||||
|
|
||||||
v.ServerMajorVersion = xgb.Get16(buf[b:])
|
// Skipping definition for base type 'Int32'
|
||||||
b += 2
|
|
||||||
|
|
||||||
v.ServerMinorVersion = xgb.Get16(buf[b:])
|
// Skipping definition for base type 'Int8'
|
||||||
b += 2
|
|
||||||
|
|
||||||
b += 20 // padding
|
// Skipping definition for base type 'Card16'
|
||||||
|
|
||||||
return v
|
// Skipping definition for base type 'Card32'
|
||||||
}
|
|
||||||
|
|
||||||
// Write request to wire for QueryVersion
|
|
||||||
// queryVersionRequest writes a QueryVersion request to a byte slice.
|
|
||||||
func queryVersionRequest(c *xgb.Conn, ClientMajorVersion byte, ClientMinorVersion byte) []byte {
|
|
||||||
size := 8
|
|
||||||
b := 0
|
|
||||||
buf := make([]byte, size)
|
|
||||||
|
|
||||||
buf[b] = c.Extensions["MIT-SCREEN-SAVER"]
|
|
||||||
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
|
|
||||||
|
|
||||||
buf[b] = ClientMajorVersion
|
|
||||||
b += 1
|
|
||||||
|
|
||||||
buf[b] = ClientMinorVersion
|
|
||||||
b += 1
|
|
||||||
|
|
||||||
b += 2 // padding
|
|
||||||
|
|
||||||
return buf
|
|
||||||
}
|
|
||||||
|
|
||||||
// QueryInfoCookie is a cookie used only for QueryInfo requests.
|
// QueryInfoCookie is a cookie used only for QueryInfo requests.
|
||||||
type QueryInfoCookie struct {
|
type QueryInfoCookie struct {
|
||||||
|
@ -422,6 +322,106 @@ func queryInfoRequest(c *xgb.Conn, Drawable xproto.Drawable) []byte {
|
||||||
return buf
|
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, ClientMajorVersion byte, ClientMinorVersion byte) QueryVersionCookie {
|
||||||
|
if _, ok := c.Extensions["MIT-SCREEN-SAVER"]; !ok {
|
||||||
|
panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'MIT-SCREEN-SAVER'. screensaver.Init(connObj) must be called first.")
|
||||||
|
}
|
||||||
|
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 byte, ClientMinorVersion byte) QueryVersionCookie {
|
||||||
|
if _, ok := c.Extensions["MIT-SCREEN-SAVER"]; !ok {
|
||||||
|
panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'MIT-SCREEN-SAVER'. screensaver.Init(connObj) must be called first.")
|
||||||
|
}
|
||||||
|
cookie := c.NewCookie(false, true)
|
||||||
|
c.NewRequest(queryVersionRequest(c, ClientMajorVersion, ClientMinorVersion), 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
|
||||||
|
ServerMajorVersion uint16
|
||||||
|
ServerMinorVersion uint16
|
||||||
|
// padding: 20 bytes
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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.ServerMajorVersion = xgb.Get16(buf[b:])
|
||||||
|
b += 2
|
||||||
|
|
||||||
|
v.ServerMinorVersion = xgb.Get16(buf[b:])
|
||||||
|
b += 2
|
||||||
|
|
||||||
|
b += 20 // padding
|
||||||
|
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write request to wire for QueryVersion
|
||||||
|
// queryVersionRequest writes a QueryVersion request to a byte slice.
|
||||||
|
func queryVersionRequest(c *xgb.Conn, ClientMajorVersion byte, ClientMinorVersion byte) []byte {
|
||||||
|
size := 8
|
||||||
|
b := 0
|
||||||
|
buf := make([]byte, size)
|
||||||
|
|
||||||
|
buf[b] = c.Extensions["MIT-SCREEN-SAVER"]
|
||||||
|
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
|
||||||
|
|
||||||
|
buf[b] = ClientMajorVersion
|
||||||
|
b += 1
|
||||||
|
|
||||||
|
buf[b] = ClientMinorVersion
|
||||||
|
b += 1
|
||||||
|
|
||||||
|
b += 2 // padding
|
||||||
|
|
||||||
|
return buf
|
||||||
|
}
|
||||||
|
|
||||||
// SelectInputCookie is a cookie used only for SelectInput requests.
|
// SelectInputCookie is a cookie used only for SelectInput requests.
|
||||||
type SelectInputCookie struct {
|
type SelectInputCookie struct {
|
||||||
*xgb.Cookie
|
*xgb.Cookie
|
||||||
|
@ -567,61 +567,6 @@ func setAttributesRequest(c *xgb.Conn, Drawable xproto.Drawable, X int16, Y int1
|
||||||
return buf
|
return buf
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnsetAttributesCookie is a cookie used only for UnsetAttributes requests.
|
|
||||||
type UnsetAttributesCookie struct {
|
|
||||||
*xgb.Cookie
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnsetAttributes sends an unchecked request.
|
|
||||||
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
|
||||||
func UnsetAttributes(c *xgb.Conn, Drawable xproto.Drawable) UnsetAttributesCookie {
|
|
||||||
if _, ok := c.Extensions["MIT-SCREEN-SAVER"]; !ok {
|
|
||||||
panic("Cannot issue request 'UnsetAttributes' using the uninitialized extension 'MIT-SCREEN-SAVER'. screensaver.Init(connObj) must be called first.")
|
|
||||||
}
|
|
||||||
cookie := c.NewCookie(false, false)
|
|
||||||
c.NewRequest(unsetAttributesRequest(c, Drawable), cookie)
|
|
||||||
return UnsetAttributesCookie{cookie}
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnsetAttributesChecked sends a checked request.
|
|
||||||
// If an error occurs, it can be retrieved using UnsetAttributesCookie.Check()
|
|
||||||
func UnsetAttributesChecked(c *xgb.Conn, Drawable xproto.Drawable) UnsetAttributesCookie {
|
|
||||||
if _, ok := c.Extensions["MIT-SCREEN-SAVER"]; !ok {
|
|
||||||
panic("Cannot issue request 'UnsetAttributes' using the uninitialized extension 'MIT-SCREEN-SAVER'. screensaver.Init(connObj) must be called first.")
|
|
||||||
}
|
|
||||||
cookie := c.NewCookie(true, false)
|
|
||||||
c.NewRequest(unsetAttributesRequest(c, Drawable), cookie)
|
|
||||||
return UnsetAttributesCookie{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 UnsetAttributesCookie) Check() error {
|
|
||||||
return cook.Cookie.Check()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write request to wire for UnsetAttributes
|
|
||||||
// unsetAttributesRequest writes a UnsetAttributes request to a byte slice.
|
|
||||||
func unsetAttributesRequest(c *xgb.Conn, Drawable xproto.Drawable) []byte {
|
|
||||||
size := 8
|
|
||||||
b := 0
|
|
||||||
buf := make([]byte, size)
|
|
||||||
|
|
||||||
buf[b] = c.Extensions["MIT-SCREEN-SAVER"]
|
|
||||||
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(Drawable))
|
|
||||||
b += 4
|
|
||||||
|
|
||||||
return buf
|
|
||||||
}
|
|
||||||
|
|
||||||
// SuspendCookie is a cookie used only for Suspend requests.
|
// SuspendCookie is a cookie used only for Suspend requests.
|
||||||
type SuspendCookie struct {
|
type SuspendCookie struct {
|
||||||
*xgb.Cookie
|
*xgb.Cookie
|
||||||
|
@ -682,3 +627,58 @@ func suspendRequest(c *xgb.Conn, Suspend bool) []byte {
|
||||||
|
|
||||||
return buf
|
return buf
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UnsetAttributesCookie is a cookie used only for UnsetAttributes requests.
|
||||||
|
type UnsetAttributesCookie struct {
|
||||||
|
*xgb.Cookie
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnsetAttributes sends an unchecked request.
|
||||||
|
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
||||||
|
func UnsetAttributes(c *xgb.Conn, Drawable xproto.Drawable) UnsetAttributesCookie {
|
||||||
|
if _, ok := c.Extensions["MIT-SCREEN-SAVER"]; !ok {
|
||||||
|
panic("Cannot issue request 'UnsetAttributes' using the uninitialized extension 'MIT-SCREEN-SAVER'. screensaver.Init(connObj) must be called first.")
|
||||||
|
}
|
||||||
|
cookie := c.NewCookie(false, false)
|
||||||
|
c.NewRequest(unsetAttributesRequest(c, Drawable), cookie)
|
||||||
|
return UnsetAttributesCookie{cookie}
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnsetAttributesChecked sends a checked request.
|
||||||
|
// If an error occurs, it can be retrieved using UnsetAttributesCookie.Check()
|
||||||
|
func UnsetAttributesChecked(c *xgb.Conn, Drawable xproto.Drawable) UnsetAttributesCookie {
|
||||||
|
if _, ok := c.Extensions["MIT-SCREEN-SAVER"]; !ok {
|
||||||
|
panic("Cannot issue request 'UnsetAttributes' using the uninitialized extension 'MIT-SCREEN-SAVER'. screensaver.Init(connObj) must be called first.")
|
||||||
|
}
|
||||||
|
cookie := c.NewCookie(true, false)
|
||||||
|
c.NewRequest(unsetAttributesRequest(c, Drawable), cookie)
|
||||||
|
return UnsetAttributesCookie{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 UnsetAttributesCookie) Check() error {
|
||||||
|
return cook.Cookie.Check()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write request to wire for UnsetAttributes
|
||||||
|
// unsetAttributesRequest writes a UnsetAttributes request to a byte slice.
|
||||||
|
func unsetAttributesRequest(c *xgb.Conn, Drawable xproto.Drawable) []byte {
|
||||||
|
size := 8
|
||||||
|
b := 0
|
||||||
|
buf := make([]byte, size)
|
||||||
|
|
||||||
|
buf[b] = c.Extensions["MIT-SCREEN-SAVER"]
|
||||||
|
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(Drawable))
|
||||||
|
b += 4
|
||||||
|
|
||||||
|
return buf
|
||||||
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
package shape
|
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!
|
This file is automatically generated. Edit at your peril!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -40,46 +40,6 @@ func init() {
|
||||||
xgb.NewExtErrorFuncs["SHAPE"] = make(map[int]xgb.NewErrorFun)
|
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
|
type Kind byte
|
||||||
|
|
||||||
// Notify is the event number for a NotifyEvent.
|
// Notify is the event number for a NotifyEvent.
|
||||||
|
@ -209,240 +169,45 @@ func init() {
|
||||||
xgb.NewExtEventFuncs["SHAPE"][0] = NotifyEventNew
|
xgb.NewExtEventFuncs["SHAPE"][0] = NotifyEventNew
|
||||||
}
|
}
|
||||||
|
|
||||||
// QueryVersionCookie is a cookie used only for QueryVersion requests.
|
type Op byte
|
||||||
type QueryVersionCookie struct {
|
|
||||||
*xgb.Cookie
|
|
||||||
}
|
|
||||||
|
|
||||||
// QueryVersion sends a checked request.
|
const (
|
||||||
// If an error occurs, it will be returned with the reply by calling QueryVersionCookie.Reply()
|
SkBounding = 0
|
||||||
func QueryVersion(c *xgb.Conn) QueryVersionCookie {
|
SkClip = 1
|
||||||
if _, ok := c.Extensions["SHAPE"]; !ok {
|
SkInput = 2
|
||||||
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.
|
const (
|
||||||
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
SoSet = 0
|
||||||
func QueryVersionUnchecked(c *xgb.Conn) QueryVersionCookie {
|
SoUnion = 1
|
||||||
if _, ok := c.Extensions["SHAPE"]; !ok {
|
SoIntersect = 2
|
||||||
panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.")
|
SoSubtract = 3
|
||||||
}
|
SoInvert = 4
|
||||||
cookie := c.NewCookie(false, true)
|
)
|
||||||
c.NewRequest(queryVersionRequest(c), cookie)
|
|
||||||
return QueryVersionCookie{cookie}
|
|
||||||
}
|
|
||||||
|
|
||||||
// QueryVersionReply represents the data returned from a QueryVersion request.
|
// Skipping definition for base type 'Bool'
|
||||||
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.
|
// Skipping definition for base type 'Byte'
|
||||||
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.
|
// Skipping definition for base type 'Card8'
|
||||||
func queryVersionReply(buf []byte) *QueryVersionReply {
|
|
||||||
v := new(QueryVersionReply)
|
|
||||||
b := 1 // skip reply determinant
|
|
||||||
|
|
||||||
b += 1 // padding
|
// Skipping definition for base type 'Char'
|
||||||
|
|
||||||
v.Sequence = xgb.Get16(buf[b:])
|
// Skipping definition for base type 'Void'
|
||||||
b += 2
|
|
||||||
|
|
||||||
v.Length = xgb.Get32(buf[b:]) // 4-byte units
|
// Skipping definition for base type 'Double'
|
||||||
b += 4
|
|
||||||
|
|
||||||
v.MajorVersion = xgb.Get16(buf[b:])
|
// Skipping definition for base type 'Float'
|
||||||
b += 2
|
|
||||||
|
|
||||||
v.MinorVersion = xgb.Get16(buf[b:])
|
// Skipping definition for base type 'Int16'
|
||||||
b += 2
|
|
||||||
|
|
||||||
return v
|
// Skipping definition for base type 'Int32'
|
||||||
}
|
|
||||||
|
|
||||||
// Write request to wire for QueryVersion
|
// Skipping definition for base type 'Int8'
|
||||||
// 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"]
|
// Skipping definition for base type 'Card16'
|
||||||
b += 1
|
|
||||||
|
|
||||||
buf[b] = 0 // request opcode
|
// Skipping definition for base type 'Card32'
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
// CombineCookie is a cookie used only for Combine requests.
|
// CombineCookie is a cookie used only for Combine requests.
|
||||||
type CombineCookie struct {
|
type CombineCookie struct {
|
||||||
|
@ -519,6 +284,268 @@ func combineRequest(c *xgb.Conn, Operation Op, DestinationKind Kind, SourceKind
|
||||||
return buf
|
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.
|
// OffsetCookie is a cookie used only for Offset requests.
|
||||||
type OffsetCookie struct {
|
type OffsetCookie struct {
|
||||||
*xgb.Cookie
|
*xgb.Cookie
|
||||||
|
@ -720,6 +747,169 @@ func queryExtentsRequest(c *xgb.Conn, DestinationWindow xproto.Window) []byte {
|
||||||
return buf
|
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.
|
// SelectInputCookie is a cookie used only for SelectInput requests.
|
||||||
type SelectInputCookie struct {
|
type SelectInputCookie struct {
|
||||||
*xgb.Cookie
|
*xgb.Cookie
|
||||||
|
@ -783,193 +973,3 @@ func selectInputRequest(c *xgb.Conn, DestinationWindow xproto.Window, Enable boo
|
||||||
|
|
||||||
return buf
|
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
|
|
||||||
}
|
|
||||||
|
|
562
nexgb/shm/shm.go
562
nexgb/shm/shm.go
|
@ -2,7 +2,7 @@
|
||||||
package shm
|
package shm
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This file was generated by shm.xml on Jun 5 2012 12:11:59am EDT.
|
This file was generated by shm.xml on Aug 11 2013 8:39:43pm EDT.
|
||||||
This file is automatically generated. Edit at your peril!
|
This file is automatically generated. Edit at your peril!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -40,38 +40,42 @@ func init() {
|
||||||
xgb.NewExtErrorFuncs["MIT-SHM"] = make(map[int]xgb.NewErrorFun)
|
xgb.NewExtErrorFuncs["MIT-SHM"] = make(map[int]xgb.NewErrorFun)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skipping definition for base type 'Char'
|
// BadBadSeg is the error number for a BadBadSeg.
|
||||||
|
const BadBadSeg = 0
|
||||||
|
|
||||||
// Skipping definition for base type 'Card32'
|
type BadSegError xproto.ValueError
|
||||||
|
|
||||||
// Skipping definition for base type 'Double'
|
// BadSegErrorNew constructs a BadSegError value that implements xgb.Error from a byte slice.
|
||||||
|
func BadSegErrorNew(buf []byte) xgb.Error {
|
||||||
|
v := BadSegError(xproto.ValueErrorNew(buf).(xproto.ValueError))
|
||||||
|
v.NiceName = "BadSeg"
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
|
||||||
// Skipping definition for base type 'Bool'
|
// SequenceId returns the sequence id attached to the BadBadSeg error.
|
||||||
|
// This is mostly used internally.
|
||||||
|
func (err BadSegError) SequenceId() uint16 {
|
||||||
|
return err.Sequence
|
||||||
|
}
|
||||||
|
|
||||||
// Skipping definition for base type 'Float'
|
// BadId returns the 'BadValue' number if one exists for the BadBadSeg error. If no bad value exists, 0 is returned.
|
||||||
|
func (err BadSegError) BadId() uint32 {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
// Skipping definition for base type 'Card8'
|
// Error returns a rudimentary string representation of the BadBadSeg error.
|
||||||
|
func (err BadSegError) Error() string {
|
||||||
|
fieldVals := make([]string, 0, 4)
|
||||||
|
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
|
||||||
|
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
|
||||||
|
fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue))
|
||||||
|
fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode))
|
||||||
|
fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode))
|
||||||
|
return "BadBadSeg {" + xgb.StringsJoin(fieldVals, ", ") + "}"
|
||||||
|
}
|
||||||
|
|
||||||
// Skipping definition for base type 'Int16'
|
func init() {
|
||||||
|
xgb.NewExtErrorFuncs["MIT-SHM"][0] = BadSegErrorNew
|
||||||
// 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'
|
|
||||||
|
|
||||||
type Seg uint32
|
|
||||||
|
|
||||||
func NewSegId(c *xgb.Conn) (Seg, error) {
|
|
||||||
id, err := c.NewId()
|
|
||||||
if err != nil {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
return Seg(id), nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Completion is the event number for a CompletionEvent.
|
// Completion is the event number for a CompletionEvent.
|
||||||
|
@ -174,152 +178,39 @@ func init() {
|
||||||
xgb.NewExtEventFuncs["MIT-SHM"][0] = CompletionEventNew
|
xgb.NewExtEventFuncs["MIT-SHM"][0] = CompletionEventNew
|
||||||
}
|
}
|
||||||
|
|
||||||
// BadBadSeg is the error number for a BadBadSeg.
|
type Seg uint32
|
||||||
const BadBadSeg = 0
|
|
||||||
|
|
||||||
type BadSegError xproto.ValueError
|
func NewSegId(c *xgb.Conn) (Seg, error) {
|
||||||
|
id, err := c.NewId()
|
||||||
// BadSegErrorNew constructs a BadSegError value that implements xgb.Error from a byte slice.
|
|
||||||
func BadSegErrorNew(buf []byte) xgb.Error {
|
|
||||||
v := BadSegError(xproto.ValueErrorNew(buf).(xproto.ValueError))
|
|
||||||
v.NiceName = "BadSeg"
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
// SequenceId returns the sequence id attached to the BadBadSeg error.
|
|
||||||
// This is mostly used internally.
|
|
||||||
func (err BadSegError) SequenceId() uint16 {
|
|
||||||
return err.Sequence
|
|
||||||
}
|
|
||||||
|
|
||||||
// BadId returns the 'BadValue' number if one exists for the BadBadSeg error. If no bad value exists, 0 is returned.
|
|
||||||
func (err BadSegError) BadId() uint32 {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
// Error returns a rudimentary string representation of the BadBadSeg error.
|
|
||||||
func (err BadSegError) Error() string {
|
|
||||||
fieldVals := make([]string, 0, 4)
|
|
||||||
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
|
|
||||||
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
|
|
||||||
fieldVals = append(fieldVals, xgb.Sprintf("BadValue: %d", err.BadValue))
|
|
||||||
fieldVals = append(fieldVals, xgb.Sprintf("MinorOpcode: %d", err.MinorOpcode))
|
|
||||||
fieldVals = append(fieldVals, xgb.Sprintf("MajorOpcode: %d", err.MajorOpcode))
|
|
||||||
return "BadBadSeg {" + xgb.StringsJoin(fieldVals, ", ") + "}"
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
xgb.NewExtErrorFuncs["MIT-SHM"][0] = BadSegErrorNew
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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["MIT-SHM"]; !ok {
|
|
||||||
panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'MIT-SHM'. shm.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["MIT-SHM"]; !ok {
|
|
||||||
panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'MIT-SHM'. shm.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
|
|
||||||
SharedPixmaps bool
|
|
||||||
MajorVersion uint16
|
|
||||||
MinorVersion uint16
|
|
||||||
Uid uint16
|
|
||||||
Gid uint16
|
|
||||||
PixmapFormat byte
|
|
||||||
// padding: 15 bytes
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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 {
|
if err != nil {
|
||||||
return nil, err
|
return 0, err
|
||||||
}
|
}
|
||||||
if buf == nil {
|
return Seg(id), nil
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
return queryVersionReply(buf), nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// queryVersionReply reads a byte slice into a QueryVersionReply value.
|
// Skipping definition for base type 'Bool'
|
||||||
func queryVersionReply(buf []byte) *QueryVersionReply {
|
|
||||||
v := new(QueryVersionReply)
|
|
||||||
b := 1 // skip reply determinant
|
|
||||||
|
|
||||||
if buf[b] == 1 {
|
// Skipping definition for base type 'Byte'
|
||||||
v.SharedPixmaps = true
|
|
||||||
} else {
|
|
||||||
v.SharedPixmaps = false
|
|
||||||
}
|
|
||||||
b += 1
|
|
||||||
|
|
||||||
v.Sequence = xgb.Get16(buf[b:])
|
// Skipping definition for base type 'Card8'
|
||||||
b += 2
|
|
||||||
|
|
||||||
v.Length = xgb.Get32(buf[b:]) // 4-byte units
|
// Skipping definition for base type 'Char'
|
||||||
b += 4
|
|
||||||
|
|
||||||
v.MajorVersion = xgb.Get16(buf[b:])
|
// Skipping definition for base type 'Void'
|
||||||
b += 2
|
|
||||||
|
|
||||||
v.MinorVersion = xgb.Get16(buf[b:])
|
// Skipping definition for base type 'Double'
|
||||||
b += 2
|
|
||||||
|
|
||||||
v.Uid = xgb.Get16(buf[b:])
|
// Skipping definition for base type 'Float'
|
||||||
b += 2
|
|
||||||
|
|
||||||
v.Gid = xgb.Get16(buf[b:])
|
// Skipping definition for base type 'Int16'
|
||||||
b += 2
|
|
||||||
|
|
||||||
v.PixmapFormat = buf[b]
|
// Skipping definition for base type 'Int32'
|
||||||
b += 1
|
|
||||||
|
|
||||||
b += 15 // padding
|
// Skipping definition for base type 'Int8'
|
||||||
|
|
||||||
return v
|
// Skipping definition for base type 'Card16'
|
||||||
}
|
|
||||||
|
|
||||||
// Write request to wire for QueryVersion
|
// Skipping definition for base type 'Card32'
|
||||||
// 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["MIT-SHM"]
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
// AttachCookie is a cookie used only for Attach requests.
|
// AttachCookie is a cookie used only for Attach requests.
|
||||||
type AttachCookie struct {
|
type AttachCookie struct {
|
||||||
|
@ -388,6 +279,81 @@ func attachRequest(c *xgb.Conn, Shmseg Seg, Shmid uint32, ReadOnly bool) []byte
|
||||||
return buf
|
return buf
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CreatePixmapCookie is a cookie used only for CreatePixmap requests.
|
||||||
|
type CreatePixmapCookie struct {
|
||||||
|
*xgb.Cookie
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreatePixmap sends an unchecked request.
|
||||||
|
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
||||||
|
func CreatePixmap(c *xgb.Conn, Pid xproto.Pixmap, Drawable xproto.Drawable, Width uint16, Height uint16, Depth byte, Shmseg Seg, Offset uint32) CreatePixmapCookie {
|
||||||
|
if _, ok := c.Extensions["MIT-SHM"]; !ok {
|
||||||
|
panic("Cannot issue request 'CreatePixmap' using the uninitialized extension 'MIT-SHM'. shm.Init(connObj) must be called first.")
|
||||||
|
}
|
||||||
|
cookie := c.NewCookie(false, false)
|
||||||
|
c.NewRequest(createPixmapRequest(c, Pid, Drawable, Width, Height, Depth, Shmseg, Offset), cookie)
|
||||||
|
return CreatePixmapCookie{cookie}
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreatePixmapChecked sends a checked request.
|
||||||
|
// If an error occurs, it can be retrieved using CreatePixmapCookie.Check()
|
||||||
|
func CreatePixmapChecked(c *xgb.Conn, Pid xproto.Pixmap, Drawable xproto.Drawable, Width uint16, Height uint16, Depth byte, Shmseg Seg, Offset uint32) CreatePixmapCookie {
|
||||||
|
if _, ok := c.Extensions["MIT-SHM"]; !ok {
|
||||||
|
panic("Cannot issue request 'CreatePixmap' using the uninitialized extension 'MIT-SHM'. shm.Init(connObj) must be called first.")
|
||||||
|
}
|
||||||
|
cookie := c.NewCookie(true, false)
|
||||||
|
c.NewRequest(createPixmapRequest(c, Pid, Drawable, Width, Height, Depth, Shmseg, Offset), cookie)
|
||||||
|
return CreatePixmapCookie{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 CreatePixmapCookie) Check() error {
|
||||||
|
return cook.Cookie.Check()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write request to wire for CreatePixmap
|
||||||
|
// createPixmapRequest writes a CreatePixmap request to a byte slice.
|
||||||
|
func createPixmapRequest(c *xgb.Conn, Pid xproto.Pixmap, Drawable xproto.Drawable, Width uint16, Height uint16, Depth byte, Shmseg Seg, Offset uint32) []byte {
|
||||||
|
size := 28
|
||||||
|
b := 0
|
||||||
|
buf := make([]byte, size)
|
||||||
|
|
||||||
|
buf[b] = c.Extensions["MIT-SHM"]
|
||||||
|
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(Pid))
|
||||||
|
b += 4
|
||||||
|
|
||||||
|
xgb.Put32(buf[b:], uint32(Drawable))
|
||||||
|
b += 4
|
||||||
|
|
||||||
|
xgb.Put16(buf[b:], Width)
|
||||||
|
b += 2
|
||||||
|
|
||||||
|
xgb.Put16(buf[b:], Height)
|
||||||
|
b += 2
|
||||||
|
|
||||||
|
buf[b] = Depth
|
||||||
|
b += 1
|
||||||
|
|
||||||
|
b += 3 // padding
|
||||||
|
|
||||||
|
xgb.Put32(buf[b:], uint32(Shmseg))
|
||||||
|
b += 4
|
||||||
|
|
||||||
|
xgb.Put32(buf[b:], Offset)
|
||||||
|
b += 4
|
||||||
|
|
||||||
|
return buf
|
||||||
|
}
|
||||||
|
|
||||||
// DetachCookie is a cookie used only for Detach requests.
|
// DetachCookie is a cookie used only for Detach requests.
|
||||||
type DetachCookie struct {
|
type DetachCookie struct {
|
||||||
*xgb.Cookie
|
*xgb.Cookie
|
||||||
|
@ -443,105 +409,6 @@ func detachRequest(c *xgb.Conn, Shmseg Seg) []byte {
|
||||||
return buf
|
return buf
|
||||||
}
|
}
|
||||||
|
|
||||||
// PutImageCookie is a cookie used only for PutImage requests.
|
|
||||||
type PutImageCookie struct {
|
|
||||||
*xgb.Cookie
|
|
||||||
}
|
|
||||||
|
|
||||||
// PutImage sends an unchecked request.
|
|
||||||
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
|
||||||
func PutImage(c *xgb.Conn, Drawable xproto.Drawable, Gc xproto.Gcontext, TotalWidth uint16, TotalHeight uint16, SrcX uint16, SrcY uint16, SrcWidth uint16, SrcHeight uint16, DstX int16, DstY int16, Depth byte, Format byte, SendEvent byte, Shmseg Seg, Offset uint32) PutImageCookie {
|
|
||||||
if _, ok := c.Extensions["MIT-SHM"]; !ok {
|
|
||||||
panic("Cannot issue request 'PutImage' using the uninitialized extension 'MIT-SHM'. shm.Init(connObj) must be called first.")
|
|
||||||
}
|
|
||||||
cookie := c.NewCookie(false, false)
|
|
||||||
c.NewRequest(putImageRequest(c, Drawable, Gc, TotalWidth, TotalHeight, SrcX, SrcY, SrcWidth, SrcHeight, DstX, DstY, Depth, Format, SendEvent, Shmseg, Offset), cookie)
|
|
||||||
return PutImageCookie{cookie}
|
|
||||||
}
|
|
||||||
|
|
||||||
// PutImageChecked sends a checked request.
|
|
||||||
// If an error occurs, it can be retrieved using PutImageCookie.Check()
|
|
||||||
func PutImageChecked(c *xgb.Conn, Drawable xproto.Drawable, Gc xproto.Gcontext, TotalWidth uint16, TotalHeight uint16, SrcX uint16, SrcY uint16, SrcWidth uint16, SrcHeight uint16, DstX int16, DstY int16, Depth byte, Format byte, SendEvent byte, Shmseg Seg, Offset uint32) PutImageCookie {
|
|
||||||
if _, ok := c.Extensions["MIT-SHM"]; !ok {
|
|
||||||
panic("Cannot issue request 'PutImage' using the uninitialized extension 'MIT-SHM'. shm.Init(connObj) must be called first.")
|
|
||||||
}
|
|
||||||
cookie := c.NewCookie(true, false)
|
|
||||||
c.NewRequest(putImageRequest(c, Drawable, Gc, TotalWidth, TotalHeight, SrcX, SrcY, SrcWidth, SrcHeight, DstX, DstY, Depth, Format, SendEvent, Shmseg, Offset), cookie)
|
|
||||||
return PutImageCookie{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 PutImageCookie) Check() error {
|
|
||||||
return cook.Cookie.Check()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write request to wire for PutImage
|
|
||||||
// putImageRequest writes a PutImage request to a byte slice.
|
|
||||||
func putImageRequest(c *xgb.Conn, Drawable xproto.Drawable, Gc xproto.Gcontext, TotalWidth uint16, TotalHeight uint16, SrcX uint16, SrcY uint16, SrcWidth uint16, SrcHeight uint16, DstX int16, DstY int16, Depth byte, Format byte, SendEvent byte, Shmseg Seg, Offset uint32) []byte {
|
|
||||||
size := 40
|
|
||||||
b := 0
|
|
||||||
buf := make([]byte, size)
|
|
||||||
|
|
||||||
buf[b] = c.Extensions["MIT-SHM"]
|
|
||||||
b += 1
|
|
||||||
|
|
||||||
buf[b] = 3 // 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
|
|
||||||
|
|
||||||
xgb.Put32(buf[b:], uint32(Gc))
|
|
||||||
b += 4
|
|
||||||
|
|
||||||
xgb.Put16(buf[b:], TotalWidth)
|
|
||||||
b += 2
|
|
||||||
|
|
||||||
xgb.Put16(buf[b:], TotalHeight)
|
|
||||||
b += 2
|
|
||||||
|
|
||||||
xgb.Put16(buf[b:], SrcX)
|
|
||||||
b += 2
|
|
||||||
|
|
||||||
xgb.Put16(buf[b:], SrcY)
|
|
||||||
b += 2
|
|
||||||
|
|
||||||
xgb.Put16(buf[b:], SrcWidth)
|
|
||||||
b += 2
|
|
||||||
|
|
||||||
xgb.Put16(buf[b:], SrcHeight)
|
|
||||||
b += 2
|
|
||||||
|
|
||||||
xgb.Put16(buf[b:], uint16(DstX))
|
|
||||||
b += 2
|
|
||||||
|
|
||||||
xgb.Put16(buf[b:], uint16(DstY))
|
|
||||||
b += 2
|
|
||||||
|
|
||||||
buf[b] = Depth
|
|
||||||
b += 1
|
|
||||||
|
|
||||||
buf[b] = Format
|
|
||||||
b += 1
|
|
||||||
|
|
||||||
buf[b] = SendEvent
|
|
||||||
b += 1
|
|
||||||
|
|
||||||
b += 1 // padding
|
|
||||||
|
|
||||||
xgb.Put32(buf[b:], uint32(Shmseg))
|
|
||||||
b += 4
|
|
||||||
|
|
||||||
xgb.Put32(buf[b:], Offset)
|
|
||||||
b += 4
|
|
||||||
|
|
||||||
return buf
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetImageCookie is a cookie used only for GetImage requests.
|
// GetImageCookie is a cookie used only for GetImage requests.
|
||||||
type GetImageCookie struct {
|
type GetImageCookie struct {
|
||||||
*xgb.Cookie
|
*xgb.Cookie
|
||||||
|
@ -661,71 +528,95 @@ func getImageRequest(c *xgb.Conn, Drawable xproto.Drawable, X int16, Y int16, Wi
|
||||||
return buf
|
return buf
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreatePixmapCookie is a cookie used only for CreatePixmap requests.
|
// PutImageCookie is a cookie used only for PutImage requests.
|
||||||
type CreatePixmapCookie struct {
|
type PutImageCookie struct {
|
||||||
*xgb.Cookie
|
*xgb.Cookie
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreatePixmap sends an unchecked request.
|
// PutImage sends an unchecked request.
|
||||||
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
||||||
func CreatePixmap(c *xgb.Conn, Pid xproto.Pixmap, Drawable xproto.Drawable, Width uint16, Height uint16, Depth byte, Shmseg Seg, Offset uint32) CreatePixmapCookie {
|
func PutImage(c *xgb.Conn, Drawable xproto.Drawable, Gc xproto.Gcontext, TotalWidth uint16, TotalHeight uint16, SrcX uint16, SrcY uint16, SrcWidth uint16, SrcHeight uint16, DstX int16, DstY int16, Depth byte, Format byte, SendEvent byte, Shmseg Seg, Offset uint32) PutImageCookie {
|
||||||
if _, ok := c.Extensions["MIT-SHM"]; !ok {
|
if _, ok := c.Extensions["MIT-SHM"]; !ok {
|
||||||
panic("Cannot issue request 'CreatePixmap' using the uninitialized extension 'MIT-SHM'. shm.Init(connObj) must be called first.")
|
panic("Cannot issue request 'PutImage' using the uninitialized extension 'MIT-SHM'. shm.Init(connObj) must be called first.")
|
||||||
}
|
}
|
||||||
cookie := c.NewCookie(false, false)
|
cookie := c.NewCookie(false, false)
|
||||||
c.NewRequest(createPixmapRequest(c, Pid, Drawable, Width, Height, Depth, Shmseg, Offset), cookie)
|
c.NewRequest(putImageRequest(c, Drawable, Gc, TotalWidth, TotalHeight, SrcX, SrcY, SrcWidth, SrcHeight, DstX, DstY, Depth, Format, SendEvent, Shmseg, Offset), cookie)
|
||||||
return CreatePixmapCookie{cookie}
|
return PutImageCookie{cookie}
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreatePixmapChecked sends a checked request.
|
// PutImageChecked sends a checked request.
|
||||||
// If an error occurs, it can be retrieved using CreatePixmapCookie.Check()
|
// If an error occurs, it can be retrieved using PutImageCookie.Check()
|
||||||
func CreatePixmapChecked(c *xgb.Conn, Pid xproto.Pixmap, Drawable xproto.Drawable, Width uint16, Height uint16, Depth byte, Shmseg Seg, Offset uint32) CreatePixmapCookie {
|
func PutImageChecked(c *xgb.Conn, Drawable xproto.Drawable, Gc xproto.Gcontext, TotalWidth uint16, TotalHeight uint16, SrcX uint16, SrcY uint16, SrcWidth uint16, SrcHeight uint16, DstX int16, DstY int16, Depth byte, Format byte, SendEvent byte, Shmseg Seg, Offset uint32) PutImageCookie {
|
||||||
if _, ok := c.Extensions["MIT-SHM"]; !ok {
|
if _, ok := c.Extensions["MIT-SHM"]; !ok {
|
||||||
panic("Cannot issue request 'CreatePixmap' using the uninitialized extension 'MIT-SHM'. shm.Init(connObj) must be called first.")
|
panic("Cannot issue request 'PutImage' using the uninitialized extension 'MIT-SHM'. shm.Init(connObj) must be called first.")
|
||||||
}
|
}
|
||||||
cookie := c.NewCookie(true, false)
|
cookie := c.NewCookie(true, false)
|
||||||
c.NewRequest(createPixmapRequest(c, Pid, Drawable, Width, Height, Depth, Shmseg, Offset), cookie)
|
c.NewRequest(putImageRequest(c, Drawable, Gc, TotalWidth, TotalHeight, SrcX, SrcY, SrcWidth, SrcHeight, DstX, DstY, Depth, Format, SendEvent, Shmseg, Offset), cookie)
|
||||||
return CreatePixmapCookie{cookie}
|
return PutImageCookie{cookie}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check returns an error if one occurred for checked requests that are not expecting a reply.
|
// 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.
|
// This cannot be called for requests expecting a reply, nor for unchecked requests.
|
||||||
func (cook CreatePixmapCookie) Check() error {
|
func (cook PutImageCookie) Check() error {
|
||||||
return cook.Cookie.Check()
|
return cook.Cookie.Check()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write request to wire for CreatePixmap
|
// Write request to wire for PutImage
|
||||||
// createPixmapRequest writes a CreatePixmap request to a byte slice.
|
// putImageRequest writes a PutImage request to a byte slice.
|
||||||
func createPixmapRequest(c *xgb.Conn, Pid xproto.Pixmap, Drawable xproto.Drawable, Width uint16, Height uint16, Depth byte, Shmseg Seg, Offset uint32) []byte {
|
func putImageRequest(c *xgb.Conn, Drawable xproto.Drawable, Gc xproto.Gcontext, TotalWidth uint16, TotalHeight uint16, SrcX uint16, SrcY uint16, SrcWidth uint16, SrcHeight uint16, DstX int16, DstY int16, Depth byte, Format byte, SendEvent byte, Shmseg Seg, Offset uint32) []byte {
|
||||||
size := 28
|
size := 40
|
||||||
b := 0
|
b := 0
|
||||||
buf := make([]byte, size)
|
buf := make([]byte, size)
|
||||||
|
|
||||||
buf[b] = c.Extensions["MIT-SHM"]
|
buf[b] = c.Extensions["MIT-SHM"]
|
||||||
b += 1
|
b += 1
|
||||||
|
|
||||||
buf[b] = 5 // request opcode
|
buf[b] = 3 // request opcode
|
||||||
b += 1
|
b += 1
|
||||||
|
|
||||||
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
|
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
|
||||||
b += 2
|
b += 2
|
||||||
|
|
||||||
xgb.Put32(buf[b:], uint32(Pid))
|
|
||||||
b += 4
|
|
||||||
|
|
||||||
xgb.Put32(buf[b:], uint32(Drawable))
|
xgb.Put32(buf[b:], uint32(Drawable))
|
||||||
b += 4
|
b += 4
|
||||||
|
|
||||||
xgb.Put16(buf[b:], Width)
|
xgb.Put32(buf[b:], uint32(Gc))
|
||||||
|
b += 4
|
||||||
|
|
||||||
|
xgb.Put16(buf[b:], TotalWidth)
|
||||||
b += 2
|
b += 2
|
||||||
|
|
||||||
xgb.Put16(buf[b:], Height)
|
xgb.Put16(buf[b:], TotalHeight)
|
||||||
|
b += 2
|
||||||
|
|
||||||
|
xgb.Put16(buf[b:], SrcX)
|
||||||
|
b += 2
|
||||||
|
|
||||||
|
xgb.Put16(buf[b:], SrcY)
|
||||||
|
b += 2
|
||||||
|
|
||||||
|
xgb.Put16(buf[b:], SrcWidth)
|
||||||
|
b += 2
|
||||||
|
|
||||||
|
xgb.Put16(buf[b:], SrcHeight)
|
||||||
|
b += 2
|
||||||
|
|
||||||
|
xgb.Put16(buf[b:], uint16(DstX))
|
||||||
|
b += 2
|
||||||
|
|
||||||
|
xgb.Put16(buf[b:], uint16(DstY))
|
||||||
b += 2
|
b += 2
|
||||||
|
|
||||||
buf[b] = Depth
|
buf[b] = Depth
|
||||||
b += 1
|
b += 1
|
||||||
|
|
||||||
b += 3 // padding
|
buf[b] = Format
|
||||||
|
b += 1
|
||||||
|
|
||||||
|
buf[b] = SendEvent
|
||||||
|
b += 1
|
||||||
|
|
||||||
|
b += 1 // padding
|
||||||
|
|
||||||
xgb.Put32(buf[b:], uint32(Shmseg))
|
xgb.Put32(buf[b:], uint32(Shmseg))
|
||||||
b += 4
|
b += 4
|
||||||
|
@ -735,3 +626,112 @@ func createPixmapRequest(c *xgb.Conn, Pid xproto.Pixmap, Drawable xproto.Drawabl
|
||||||
|
|
||||||
return buf
|
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["MIT-SHM"]; !ok {
|
||||||
|
panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'MIT-SHM'. shm.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["MIT-SHM"]; !ok {
|
||||||
|
panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'MIT-SHM'. shm.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
|
||||||
|
SharedPixmaps bool
|
||||||
|
MajorVersion uint16
|
||||||
|
MinorVersion uint16
|
||||||
|
Uid uint16
|
||||||
|
Gid uint16
|
||||||
|
PixmapFormat byte
|
||||||
|
// padding: 15 bytes
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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
|
||||||
|
|
||||||
|
if buf[b] == 1 {
|
||||||
|
v.SharedPixmaps = true
|
||||||
|
} else {
|
||||||
|
v.SharedPixmaps = false
|
||||||
|
}
|
||||||
|
b += 1
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
v.Uid = xgb.Get16(buf[b:])
|
||||||
|
b += 2
|
||||||
|
|
||||||
|
v.Gid = xgb.Get16(buf[b:])
|
||||||
|
b += 2
|
||||||
|
|
||||||
|
v.PixmapFormat = buf[b]
|
||||||
|
b += 1
|
||||||
|
|
||||||
|
b += 15 // padding
|
||||||
|
|
||||||
|
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["MIT-SHM"]
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
2490
nexgb/sync/sync.go
2490
nexgb/sync/sync.go
File diff suppressed because it is too large
Load Diff
|
@ -2,7 +2,7 @@
|
||||||
package xcmisc
|
package xcmisc
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This file was generated by xc_misc.xml on Jun 5 2012 12:11:59am EDT.
|
This file was generated by xc_misc.xml on Aug 11 2013 8:39:43pm EDT.
|
||||||
This file is automatically generated. Edit at your peril!
|
This file is automatically generated. Edit at your peril!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -40,29 +40,29 @@ func init() {
|
||||||
xgb.NewExtErrorFuncs["XC-MISC"] = make(map[int]xgb.NewErrorFun)
|
xgb.NewExtErrorFuncs["XC-MISC"] = make(map[int]xgb.NewErrorFun)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skipping definition for base type 'Int8'
|
// Skipping definition for base type 'Bool'
|
||||||
|
|
||||||
// Skipping definition for base type 'Card16'
|
// Skipping definition for base type 'Byte'
|
||||||
|
|
||||||
|
// Skipping definition for base type 'Card8'
|
||||||
|
|
||||||
// Skipping definition for base type 'Char'
|
// Skipping definition for base type 'Char'
|
||||||
|
|
||||||
// Skipping definition for base type 'Card32'
|
// Skipping definition for base type 'Void'
|
||||||
|
|
||||||
// Skipping definition for base type 'Double'
|
// Skipping definition for base type 'Double'
|
||||||
|
|
||||||
// Skipping definition for base type 'Bool'
|
|
||||||
|
|
||||||
// Skipping definition for base type 'Float'
|
// Skipping definition for base type 'Float'
|
||||||
|
|
||||||
// Skipping definition for base type 'Card8'
|
|
||||||
|
|
||||||
// Skipping definition for base type 'Int16'
|
// Skipping definition for base type 'Int16'
|
||||||
|
|
||||||
// Skipping definition for base type 'Int32'
|
// Skipping definition for base type 'Int32'
|
||||||
|
|
||||||
// Skipping definition for base type 'Void'
|
// Skipping definition for base type 'Int8'
|
||||||
|
|
||||||
// Skipping definition for base type 'Byte'
|
// Skipping definition for base type 'Card16'
|
||||||
|
|
||||||
|
// Skipping definition for base type 'Card32'
|
||||||
|
|
||||||
// GetVersionCookie is a cookie used only for GetVersion requests.
|
// GetVersionCookie is a cookie used only for GetVersion requests.
|
||||||
type GetVersionCookie struct {
|
type GetVersionCookie struct {
|
||||||
|
@ -159,95 +159,6 @@ func getVersionRequest(c *xgb.Conn, ClientMajorVersion uint16, ClientMinorVersio
|
||||||
return buf
|
return buf
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetXIDRangeCookie is a cookie used only for GetXIDRange requests.
|
|
||||||
type GetXIDRangeCookie struct {
|
|
||||||
*xgb.Cookie
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetXIDRange sends a checked request.
|
|
||||||
// If an error occurs, it will be returned with the reply by calling GetXIDRangeCookie.Reply()
|
|
||||||
func GetXIDRange(c *xgb.Conn) GetXIDRangeCookie {
|
|
||||||
if _, ok := c.Extensions["XC-MISC"]; !ok {
|
|
||||||
panic("Cannot issue request 'GetXIDRange' using the uninitialized extension 'XC-MISC'. xcmisc.Init(connObj) must be called first.")
|
|
||||||
}
|
|
||||||
cookie := c.NewCookie(true, true)
|
|
||||||
c.NewRequest(getXIDRangeRequest(c), cookie)
|
|
||||||
return GetXIDRangeCookie{cookie}
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetXIDRangeUnchecked sends an unchecked request.
|
|
||||||
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
|
||||||
func GetXIDRangeUnchecked(c *xgb.Conn) GetXIDRangeCookie {
|
|
||||||
if _, ok := c.Extensions["XC-MISC"]; !ok {
|
|
||||||
panic("Cannot issue request 'GetXIDRange' using the uninitialized extension 'XC-MISC'. xcmisc.Init(connObj) must be called first.")
|
|
||||||
}
|
|
||||||
cookie := c.NewCookie(false, true)
|
|
||||||
c.NewRequest(getXIDRangeRequest(c), cookie)
|
|
||||||
return GetXIDRangeCookie{cookie}
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetXIDRangeReply represents the data returned from a GetXIDRange request.
|
|
||||||
type GetXIDRangeReply struct {
|
|
||||||
Sequence uint16 // sequence number of the request for this reply
|
|
||||||
Length uint32 // number of bytes in this reply
|
|
||||||
// padding: 1 bytes
|
|
||||||
StartId uint32
|
|
||||||
Count uint32
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reply blocks and returns the reply data for a GetXIDRange request.
|
|
||||||
func (cook GetXIDRangeCookie) Reply() (*GetXIDRangeReply, error) {
|
|
||||||
buf, err := cook.Cookie.Reply()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if buf == nil {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
return getXIDRangeReply(buf), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// getXIDRangeReply reads a byte slice into a GetXIDRangeReply value.
|
|
||||||
func getXIDRangeReply(buf []byte) *GetXIDRangeReply {
|
|
||||||
v := new(GetXIDRangeReply)
|
|
||||||
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.StartId = xgb.Get32(buf[b:])
|
|
||||||
b += 4
|
|
||||||
|
|
||||||
v.Count = xgb.Get32(buf[b:])
|
|
||||||
b += 4
|
|
||||||
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write request to wire for GetXIDRange
|
|
||||||
// getXIDRangeRequest writes a GetXIDRange request to a byte slice.
|
|
||||||
func getXIDRangeRequest(c *xgb.Conn) []byte {
|
|
||||||
size := 4
|
|
||||||
b := 0
|
|
||||||
buf := make([]byte, size)
|
|
||||||
|
|
||||||
buf[b] = c.Extensions["XC-MISC"]
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetXIDListCookie is a cookie used only for GetXIDList requests.
|
// GetXIDListCookie is a cookie used only for GetXIDList requests.
|
||||||
type GetXIDListCookie struct {
|
type GetXIDListCookie struct {
|
||||||
*xgb.Cookie
|
*xgb.Cookie
|
||||||
|
@ -346,3 +257,92 @@ func getXIDListRequest(c *xgb.Conn, Count uint32) []byte {
|
||||||
|
|
||||||
return buf
|
return buf
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetXIDRangeCookie is a cookie used only for GetXIDRange requests.
|
||||||
|
type GetXIDRangeCookie struct {
|
||||||
|
*xgb.Cookie
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetXIDRange sends a checked request.
|
||||||
|
// If an error occurs, it will be returned with the reply by calling GetXIDRangeCookie.Reply()
|
||||||
|
func GetXIDRange(c *xgb.Conn) GetXIDRangeCookie {
|
||||||
|
if _, ok := c.Extensions["XC-MISC"]; !ok {
|
||||||
|
panic("Cannot issue request 'GetXIDRange' using the uninitialized extension 'XC-MISC'. xcmisc.Init(connObj) must be called first.")
|
||||||
|
}
|
||||||
|
cookie := c.NewCookie(true, true)
|
||||||
|
c.NewRequest(getXIDRangeRequest(c), cookie)
|
||||||
|
return GetXIDRangeCookie{cookie}
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetXIDRangeUnchecked sends an unchecked request.
|
||||||
|
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
||||||
|
func GetXIDRangeUnchecked(c *xgb.Conn) GetXIDRangeCookie {
|
||||||
|
if _, ok := c.Extensions["XC-MISC"]; !ok {
|
||||||
|
panic("Cannot issue request 'GetXIDRange' using the uninitialized extension 'XC-MISC'. xcmisc.Init(connObj) must be called first.")
|
||||||
|
}
|
||||||
|
cookie := c.NewCookie(false, true)
|
||||||
|
c.NewRequest(getXIDRangeRequest(c), cookie)
|
||||||
|
return GetXIDRangeCookie{cookie}
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetXIDRangeReply represents the data returned from a GetXIDRange request.
|
||||||
|
type GetXIDRangeReply struct {
|
||||||
|
Sequence uint16 // sequence number of the request for this reply
|
||||||
|
Length uint32 // number of bytes in this reply
|
||||||
|
// padding: 1 bytes
|
||||||
|
StartId uint32
|
||||||
|
Count uint32
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reply blocks and returns the reply data for a GetXIDRange request.
|
||||||
|
func (cook GetXIDRangeCookie) Reply() (*GetXIDRangeReply, error) {
|
||||||
|
buf, err := cook.Cookie.Reply()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if buf == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return getXIDRangeReply(buf), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// getXIDRangeReply reads a byte slice into a GetXIDRangeReply value.
|
||||||
|
func getXIDRangeReply(buf []byte) *GetXIDRangeReply {
|
||||||
|
v := new(GetXIDRangeReply)
|
||||||
|
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.StartId = xgb.Get32(buf[b:])
|
||||||
|
b += 4
|
||||||
|
|
||||||
|
v.Count = xgb.Get32(buf[b:])
|
||||||
|
b += 4
|
||||||
|
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write request to wire for GetXIDRange
|
||||||
|
// getXIDRangeRequest writes a GetXIDRange request to a byte slice.
|
||||||
|
func getXIDRangeRequest(c *xgb.Conn) []byte {
|
||||||
|
size := 4
|
||||||
|
b := 0
|
||||||
|
buf := make([]byte, size)
|
||||||
|
|
||||||
|
buf[b] = c.Extensions["XC-MISC"]
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
package xevie
|
package xevie
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This file was generated by xevie.xml on Jun 5 2012 12:11:59am EDT.
|
This file was generated by xevie.xml on Aug 11 2013 8:39:43pm EDT.
|
||||||
This file is automatically generated. Edit at your peril!
|
This file is automatically generated. Edit at your peril!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -40,30 +40,6 @@ func init() {
|
||||||
xgb.NewExtErrorFuncs["XEVIE"] = make(map[int]xgb.NewErrorFun)
|
xgb.NewExtErrorFuncs["XEVIE"] = 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 (
|
const (
|
||||||
DatatypeUnmodified = 0
|
DatatypeUnmodified = 0
|
||||||
DatatypeModified = 1
|
DatatypeModified = 1
|
||||||
|
@ -114,6 +90,117 @@ func EventListBytes(buf []byte, list []Event) int {
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Skipping definition for base type 'Bool'
|
||||||
|
|
||||||
|
// Skipping definition for base type 'Byte'
|
||||||
|
|
||||||
|
// Skipping definition for base type 'Card8'
|
||||||
|
|
||||||
|
// Skipping definition for base type 'Char'
|
||||||
|
|
||||||
|
// Skipping definition for base type 'Void'
|
||||||
|
|
||||||
|
// Skipping definition for base type 'Double'
|
||||||
|
|
||||||
|
// Skipping definition for base type 'Float'
|
||||||
|
|
||||||
|
// Skipping definition for base type 'Int16'
|
||||||
|
|
||||||
|
// Skipping definition for base type 'Int32'
|
||||||
|
|
||||||
|
// Skipping definition for base type 'Int8'
|
||||||
|
|
||||||
|
// Skipping definition for base type 'Card16'
|
||||||
|
|
||||||
|
// Skipping definition for base type 'Card32'
|
||||||
|
|
||||||
|
// EndCookie is a cookie used only for End requests.
|
||||||
|
type EndCookie struct {
|
||||||
|
*xgb.Cookie
|
||||||
|
}
|
||||||
|
|
||||||
|
// End sends a checked request.
|
||||||
|
// If an error occurs, it will be returned with the reply by calling EndCookie.Reply()
|
||||||
|
func End(c *xgb.Conn, Cmap uint32) EndCookie {
|
||||||
|
if _, ok := c.Extensions["XEVIE"]; !ok {
|
||||||
|
panic("Cannot issue request 'End' using the uninitialized extension 'XEVIE'. xevie.Init(connObj) must be called first.")
|
||||||
|
}
|
||||||
|
cookie := c.NewCookie(true, true)
|
||||||
|
c.NewRequest(endRequest(c, Cmap), cookie)
|
||||||
|
return EndCookie{cookie}
|
||||||
|
}
|
||||||
|
|
||||||
|
// EndUnchecked sends an unchecked request.
|
||||||
|
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
||||||
|
func EndUnchecked(c *xgb.Conn, Cmap uint32) EndCookie {
|
||||||
|
if _, ok := c.Extensions["XEVIE"]; !ok {
|
||||||
|
panic("Cannot issue request 'End' using the uninitialized extension 'XEVIE'. xevie.Init(connObj) must be called first.")
|
||||||
|
}
|
||||||
|
cookie := c.NewCookie(false, true)
|
||||||
|
c.NewRequest(endRequest(c, Cmap), cookie)
|
||||||
|
return EndCookie{cookie}
|
||||||
|
}
|
||||||
|
|
||||||
|
// EndReply represents the data returned from a End request.
|
||||||
|
type EndReply struct {
|
||||||
|
Sequence uint16 // sequence number of the request for this reply
|
||||||
|
Length uint32 // number of bytes in this reply
|
||||||
|
// padding: 1 bytes
|
||||||
|
// padding: 24 bytes
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reply blocks and returns the reply data for a End request.
|
||||||
|
func (cook EndCookie) Reply() (*EndReply, error) {
|
||||||
|
buf, err := cook.Cookie.Reply()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if buf == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return endReply(buf), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// endReply reads a byte slice into a EndReply value.
|
||||||
|
func endReply(buf []byte) *EndReply {
|
||||||
|
v := new(EndReply)
|
||||||
|
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
|
||||||
|
|
||||||
|
b += 24 // padding
|
||||||
|
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write request to wire for End
|
||||||
|
// endRequest writes a End request to a byte slice.
|
||||||
|
func endRequest(c *xgb.Conn, Cmap uint32) []byte {
|
||||||
|
size := 8
|
||||||
|
b := 0
|
||||||
|
buf := make([]byte, size)
|
||||||
|
|
||||||
|
buf[b] = c.Extensions["XEVIE"]
|
||||||
|
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:], Cmap)
|
||||||
|
b += 4
|
||||||
|
|
||||||
|
return buf
|
||||||
|
}
|
||||||
|
|
||||||
// QueryVersionCookie is a cookie used only for QueryVersion requests.
|
// QueryVersionCookie is a cookie used only for QueryVersion requests.
|
||||||
type QueryVersionCookie struct {
|
type QueryVersionCookie struct {
|
||||||
*xgb.Cookie
|
*xgb.Cookie
|
||||||
|
@ -212,43 +299,43 @@ func queryVersionRequest(c *xgb.Conn, ClientMajorVersion uint16, ClientMinorVers
|
||||||
return buf
|
return buf
|
||||||
}
|
}
|
||||||
|
|
||||||
// StartCookie is a cookie used only for Start requests.
|
// SelectInputCookie is a cookie used only for SelectInput requests.
|
||||||
type StartCookie struct {
|
type SelectInputCookie struct {
|
||||||
*xgb.Cookie
|
*xgb.Cookie
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start sends a checked request.
|
// SelectInput sends a checked request.
|
||||||
// If an error occurs, it will be returned with the reply by calling StartCookie.Reply()
|
// If an error occurs, it will be returned with the reply by calling SelectInputCookie.Reply()
|
||||||
func Start(c *xgb.Conn, Screen uint32) StartCookie {
|
func SelectInput(c *xgb.Conn, EventMask uint32) SelectInputCookie {
|
||||||
if _, ok := c.Extensions["XEVIE"]; !ok {
|
if _, ok := c.Extensions["XEVIE"]; !ok {
|
||||||
panic("Cannot issue request 'Start' using the uninitialized extension 'XEVIE'. xevie.Init(connObj) must be called first.")
|
panic("Cannot issue request 'SelectInput' using the uninitialized extension 'XEVIE'. xevie.Init(connObj) must be called first.")
|
||||||
}
|
}
|
||||||
cookie := c.NewCookie(true, true)
|
cookie := c.NewCookie(true, true)
|
||||||
c.NewRequest(startRequest(c, Screen), cookie)
|
c.NewRequest(selectInputRequest(c, EventMask), cookie)
|
||||||
return StartCookie{cookie}
|
return SelectInputCookie{cookie}
|
||||||
}
|
}
|
||||||
|
|
||||||
// StartUnchecked sends an unchecked request.
|
// SelectInputUnchecked sends an unchecked request.
|
||||||
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
||||||
func StartUnchecked(c *xgb.Conn, Screen uint32) StartCookie {
|
func SelectInputUnchecked(c *xgb.Conn, EventMask uint32) SelectInputCookie {
|
||||||
if _, ok := c.Extensions["XEVIE"]; !ok {
|
if _, ok := c.Extensions["XEVIE"]; !ok {
|
||||||
panic("Cannot issue request 'Start' using the uninitialized extension 'XEVIE'. xevie.Init(connObj) must be called first.")
|
panic("Cannot issue request 'SelectInput' using the uninitialized extension 'XEVIE'. xevie.Init(connObj) must be called first.")
|
||||||
}
|
}
|
||||||
cookie := c.NewCookie(false, true)
|
cookie := c.NewCookie(false, true)
|
||||||
c.NewRequest(startRequest(c, Screen), cookie)
|
c.NewRequest(selectInputRequest(c, EventMask), cookie)
|
||||||
return StartCookie{cookie}
|
return SelectInputCookie{cookie}
|
||||||
}
|
}
|
||||||
|
|
||||||
// StartReply represents the data returned from a Start request.
|
// SelectInputReply represents the data returned from a SelectInput request.
|
||||||
type StartReply struct {
|
type SelectInputReply struct {
|
||||||
Sequence uint16 // sequence number of the request for this reply
|
Sequence uint16 // sequence number of the request for this reply
|
||||||
Length uint32 // number of bytes in this reply
|
Length uint32 // number of bytes in this reply
|
||||||
// padding: 1 bytes
|
// padding: 1 bytes
|
||||||
// padding: 24 bytes
|
// padding: 24 bytes
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reply blocks and returns the reply data for a Start request.
|
// Reply blocks and returns the reply data for a SelectInput request.
|
||||||
func (cook StartCookie) Reply() (*StartReply, error) {
|
func (cook SelectInputCookie) Reply() (*SelectInputReply, error) {
|
||||||
buf, err := cook.Cookie.Reply()
|
buf, err := cook.Cookie.Reply()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -256,12 +343,12 @@ func (cook StartCookie) Reply() (*StartReply, error) {
|
||||||
if buf == nil {
|
if buf == nil {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
return startReply(buf), nil
|
return selectInputReply(buf), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// startReply reads a byte slice into a StartReply value.
|
// selectInputReply reads a byte slice into a SelectInputReply value.
|
||||||
func startReply(buf []byte) *StartReply {
|
func selectInputReply(buf []byte) *SelectInputReply {
|
||||||
v := new(StartReply)
|
v := new(SelectInputReply)
|
||||||
b := 1 // skip reply determinant
|
b := 1 // skip reply determinant
|
||||||
|
|
||||||
b += 1 // padding
|
b += 1 // padding
|
||||||
|
@ -277,9 +364,9 @@ func startReply(buf []byte) *StartReply {
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write request to wire for Start
|
// Write request to wire for SelectInput
|
||||||
// startRequest writes a Start request to a byte slice.
|
// selectInputRequest writes a SelectInput request to a byte slice.
|
||||||
func startRequest(c *xgb.Conn, Screen uint32) []byte {
|
func selectInputRequest(c *xgb.Conn, EventMask uint32) []byte {
|
||||||
size := 8
|
size := 8
|
||||||
b := 0
|
b := 0
|
||||||
buf := make([]byte, size)
|
buf := make([]byte, size)
|
||||||
|
@ -287,100 +374,13 @@ func startRequest(c *xgb.Conn, Screen uint32) []byte {
|
||||||
buf[b] = c.Extensions["XEVIE"]
|
buf[b] = c.Extensions["XEVIE"]
|
||||||
b += 1
|
b += 1
|
||||||
|
|
||||||
buf[b] = 1 // request opcode
|
buf[b] = 4 // request opcode
|
||||||
b += 1
|
b += 1
|
||||||
|
|
||||||
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
|
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
|
||||||
b += 2
|
b += 2
|
||||||
|
|
||||||
xgb.Put32(buf[b:], Screen)
|
xgb.Put32(buf[b:], EventMask)
|
||||||
b += 4
|
|
||||||
|
|
||||||
return buf
|
|
||||||
}
|
|
||||||
|
|
||||||
// EndCookie is a cookie used only for End requests.
|
|
||||||
type EndCookie struct {
|
|
||||||
*xgb.Cookie
|
|
||||||
}
|
|
||||||
|
|
||||||
// End sends a checked request.
|
|
||||||
// If an error occurs, it will be returned with the reply by calling EndCookie.Reply()
|
|
||||||
func End(c *xgb.Conn, Cmap uint32) EndCookie {
|
|
||||||
if _, ok := c.Extensions["XEVIE"]; !ok {
|
|
||||||
panic("Cannot issue request 'End' using the uninitialized extension 'XEVIE'. xevie.Init(connObj) must be called first.")
|
|
||||||
}
|
|
||||||
cookie := c.NewCookie(true, true)
|
|
||||||
c.NewRequest(endRequest(c, Cmap), cookie)
|
|
||||||
return EndCookie{cookie}
|
|
||||||
}
|
|
||||||
|
|
||||||
// EndUnchecked sends an unchecked request.
|
|
||||||
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
|
||||||
func EndUnchecked(c *xgb.Conn, Cmap uint32) EndCookie {
|
|
||||||
if _, ok := c.Extensions["XEVIE"]; !ok {
|
|
||||||
panic("Cannot issue request 'End' using the uninitialized extension 'XEVIE'. xevie.Init(connObj) must be called first.")
|
|
||||||
}
|
|
||||||
cookie := c.NewCookie(false, true)
|
|
||||||
c.NewRequest(endRequest(c, Cmap), cookie)
|
|
||||||
return EndCookie{cookie}
|
|
||||||
}
|
|
||||||
|
|
||||||
// EndReply represents the data returned from a End request.
|
|
||||||
type EndReply struct {
|
|
||||||
Sequence uint16 // sequence number of the request for this reply
|
|
||||||
Length uint32 // number of bytes in this reply
|
|
||||||
// padding: 1 bytes
|
|
||||||
// padding: 24 bytes
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reply blocks and returns the reply data for a End request.
|
|
||||||
func (cook EndCookie) Reply() (*EndReply, error) {
|
|
||||||
buf, err := cook.Cookie.Reply()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if buf == nil {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
return endReply(buf), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// endReply reads a byte slice into a EndReply value.
|
|
||||||
func endReply(buf []byte) *EndReply {
|
|
||||||
v := new(EndReply)
|
|
||||||
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
|
|
||||||
|
|
||||||
b += 24 // padding
|
|
||||||
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write request to wire for End
|
|
||||||
// endRequest writes a End request to a byte slice.
|
|
||||||
func endRequest(c *xgb.Conn, Cmap uint32) []byte {
|
|
||||||
size := 8
|
|
||||||
b := 0
|
|
||||||
buf := make([]byte, size)
|
|
||||||
|
|
||||||
buf[b] = c.Extensions["XEVIE"]
|
|
||||||
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:], Cmap)
|
|
||||||
b += 4
|
b += 4
|
||||||
|
|
||||||
return buf
|
return buf
|
||||||
|
@ -481,43 +481,43 @@ func sendRequest(c *xgb.Conn, Event Event, DataType uint32) []byte {
|
||||||
return buf
|
return buf
|
||||||
}
|
}
|
||||||
|
|
||||||
// SelectInputCookie is a cookie used only for SelectInput requests.
|
// StartCookie is a cookie used only for Start requests.
|
||||||
type SelectInputCookie struct {
|
type StartCookie struct {
|
||||||
*xgb.Cookie
|
*xgb.Cookie
|
||||||
}
|
}
|
||||||
|
|
||||||
// SelectInput sends a checked request.
|
// Start sends a checked request.
|
||||||
// If an error occurs, it will be returned with the reply by calling SelectInputCookie.Reply()
|
// If an error occurs, it will be returned with the reply by calling StartCookie.Reply()
|
||||||
func SelectInput(c *xgb.Conn, EventMask uint32) SelectInputCookie {
|
func Start(c *xgb.Conn, Screen uint32) StartCookie {
|
||||||
if _, ok := c.Extensions["XEVIE"]; !ok {
|
if _, ok := c.Extensions["XEVIE"]; !ok {
|
||||||
panic("Cannot issue request 'SelectInput' using the uninitialized extension 'XEVIE'. xevie.Init(connObj) must be called first.")
|
panic("Cannot issue request 'Start' using the uninitialized extension 'XEVIE'. xevie.Init(connObj) must be called first.")
|
||||||
}
|
}
|
||||||
cookie := c.NewCookie(true, true)
|
cookie := c.NewCookie(true, true)
|
||||||
c.NewRequest(selectInputRequest(c, EventMask), cookie)
|
c.NewRequest(startRequest(c, Screen), cookie)
|
||||||
return SelectInputCookie{cookie}
|
return StartCookie{cookie}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SelectInputUnchecked sends an unchecked request.
|
// StartUnchecked sends an unchecked request.
|
||||||
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
||||||
func SelectInputUnchecked(c *xgb.Conn, EventMask uint32) SelectInputCookie {
|
func StartUnchecked(c *xgb.Conn, Screen uint32) StartCookie {
|
||||||
if _, ok := c.Extensions["XEVIE"]; !ok {
|
if _, ok := c.Extensions["XEVIE"]; !ok {
|
||||||
panic("Cannot issue request 'SelectInput' using the uninitialized extension 'XEVIE'. xevie.Init(connObj) must be called first.")
|
panic("Cannot issue request 'Start' using the uninitialized extension 'XEVIE'. xevie.Init(connObj) must be called first.")
|
||||||
}
|
}
|
||||||
cookie := c.NewCookie(false, true)
|
cookie := c.NewCookie(false, true)
|
||||||
c.NewRequest(selectInputRequest(c, EventMask), cookie)
|
c.NewRequest(startRequest(c, Screen), cookie)
|
||||||
return SelectInputCookie{cookie}
|
return StartCookie{cookie}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SelectInputReply represents the data returned from a SelectInput request.
|
// StartReply represents the data returned from a Start request.
|
||||||
type SelectInputReply struct {
|
type StartReply struct {
|
||||||
Sequence uint16 // sequence number of the request for this reply
|
Sequence uint16 // sequence number of the request for this reply
|
||||||
Length uint32 // number of bytes in this reply
|
Length uint32 // number of bytes in this reply
|
||||||
// padding: 1 bytes
|
// padding: 1 bytes
|
||||||
// padding: 24 bytes
|
// padding: 24 bytes
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reply blocks and returns the reply data for a SelectInput request.
|
// Reply blocks and returns the reply data for a Start request.
|
||||||
func (cook SelectInputCookie) Reply() (*SelectInputReply, error) {
|
func (cook StartCookie) Reply() (*StartReply, error) {
|
||||||
buf, err := cook.Cookie.Reply()
|
buf, err := cook.Cookie.Reply()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -525,12 +525,12 @@ func (cook SelectInputCookie) Reply() (*SelectInputReply, error) {
|
||||||
if buf == nil {
|
if buf == nil {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
return selectInputReply(buf), nil
|
return startReply(buf), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// selectInputReply reads a byte slice into a SelectInputReply value.
|
// startReply reads a byte slice into a StartReply value.
|
||||||
func selectInputReply(buf []byte) *SelectInputReply {
|
func startReply(buf []byte) *StartReply {
|
||||||
v := new(SelectInputReply)
|
v := new(StartReply)
|
||||||
b := 1 // skip reply determinant
|
b := 1 // skip reply determinant
|
||||||
|
|
||||||
b += 1 // padding
|
b += 1 // padding
|
||||||
|
@ -546,9 +546,9 @@ func selectInputReply(buf []byte) *SelectInputReply {
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write request to wire for SelectInput
|
// Write request to wire for Start
|
||||||
// selectInputRequest writes a SelectInput request to a byte slice.
|
// startRequest writes a Start request to a byte slice.
|
||||||
func selectInputRequest(c *xgb.Conn, EventMask uint32) []byte {
|
func startRequest(c *xgb.Conn, Screen uint32) []byte {
|
||||||
size := 8
|
size := 8
|
||||||
b := 0
|
b := 0
|
||||||
buf := make([]byte, size)
|
buf := make([]byte, size)
|
||||||
|
@ -556,13 +556,13 @@ func selectInputRequest(c *xgb.Conn, EventMask uint32) []byte {
|
||||||
buf[b] = c.Extensions["XEVIE"]
|
buf[b] = c.Extensions["XEVIE"]
|
||||||
b += 1
|
b += 1
|
||||||
|
|
||||||
buf[b] = 4 // request opcode
|
buf[b] = 1 // request opcode
|
||||||
b += 1
|
b += 1
|
||||||
|
|
||||||
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
|
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
|
||||||
b += 2
|
b += 2
|
||||||
|
|
||||||
xgb.Put32(buf[b:], EventMask)
|
xgb.Put32(buf[b:], Screen)
|
||||||
b += 4
|
b += 4
|
||||||
|
|
||||||
return buf
|
return buf
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -2,7 +2,7 @@
|
||||||
package xinerama
|
package xinerama
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This file was generated by xinerama.xml on Jun 5 2012 12:12:00am EDT.
|
This file was generated by xinerama.xml on Aug 11 2013 8:39:44pm EDT.
|
||||||
This file is automatically generated. Edit at your peril!
|
This file is automatically generated. Edit at your peril!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -40,30 +40,6 @@ func init() {
|
||||||
xgb.NewExtErrorFuncs["XINERAMA"] = make(map[int]xgb.NewErrorFun)
|
xgb.NewExtErrorFuncs["XINERAMA"] = 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'
|
|
||||||
|
|
||||||
type ScreenInfo struct {
|
type ScreenInfo struct {
|
||||||
XOrg int16
|
XOrg int16
|
||||||
YOrg int16
|
YOrg int16
|
||||||
|
@ -132,189 +108,29 @@ func ScreenInfoListBytes(buf []byte, list []ScreenInfo) int {
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
// QueryVersionCookie is a cookie used only for QueryVersion requests.
|
// Skipping definition for base type 'Bool'
|
||||||
type QueryVersionCookie struct {
|
|
||||||
*xgb.Cookie
|
|
||||||
}
|
|
||||||
|
|
||||||
// QueryVersion sends a checked request.
|
// Skipping definition for base type 'Byte'
|
||||||
// If an error occurs, it will be returned with the reply by calling QueryVersionCookie.Reply()
|
|
||||||
func QueryVersion(c *xgb.Conn, Major byte, Minor byte) QueryVersionCookie {
|
|
||||||
if _, ok := c.Extensions["XINERAMA"]; !ok {
|
|
||||||
panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'XINERAMA'. xinerama.Init(connObj) must be called first.")
|
|
||||||
}
|
|
||||||
cookie := c.NewCookie(true, true)
|
|
||||||
c.NewRequest(queryVersionRequest(c, Major, Minor), cookie)
|
|
||||||
return QueryVersionCookie{cookie}
|
|
||||||
}
|
|
||||||
|
|
||||||
// QueryVersionUnchecked sends an unchecked request.
|
// Skipping definition for base type 'Card8'
|
||||||
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
|
||||||
func QueryVersionUnchecked(c *xgb.Conn, Major byte, Minor byte) QueryVersionCookie {
|
|
||||||
if _, ok := c.Extensions["XINERAMA"]; !ok {
|
|
||||||
panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'XINERAMA'. xinerama.Init(connObj) must be called first.")
|
|
||||||
}
|
|
||||||
cookie := c.NewCookie(false, true)
|
|
||||||
c.NewRequest(queryVersionRequest(c, Major, Minor), cookie)
|
|
||||||
return QueryVersionCookie{cookie}
|
|
||||||
}
|
|
||||||
|
|
||||||
// QueryVersionReply represents the data returned from a QueryVersion request.
|
// Skipping definition for base type 'Char'
|
||||||
type QueryVersionReply struct {
|
|
||||||
Sequence uint16 // sequence number of the request for this reply
|
|
||||||
Length uint32 // number of bytes in this reply
|
|
||||||
// padding: 1 bytes
|
|
||||||
Major uint16
|
|
||||||
Minor uint16
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reply blocks and returns the reply data for a QueryVersion request.
|
// Skipping definition for base type 'Void'
|
||||||
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.
|
// Skipping definition for base type 'Double'
|
||||||
func queryVersionReply(buf []byte) *QueryVersionReply {
|
|
||||||
v := new(QueryVersionReply)
|
|
||||||
b := 1 // skip reply determinant
|
|
||||||
|
|
||||||
b += 1 // padding
|
// Skipping definition for base type 'Float'
|
||||||
|
|
||||||
v.Sequence = xgb.Get16(buf[b:])
|
// Skipping definition for base type 'Int16'
|
||||||
b += 2
|
|
||||||
|
|
||||||
v.Length = xgb.Get32(buf[b:]) // 4-byte units
|
// Skipping definition for base type 'Int32'
|
||||||
b += 4
|
|
||||||
|
|
||||||
v.Major = xgb.Get16(buf[b:])
|
// Skipping definition for base type 'Int8'
|
||||||
b += 2
|
|
||||||
|
|
||||||
v.Minor = xgb.Get16(buf[b:])
|
// Skipping definition for base type 'Card16'
|
||||||
b += 2
|
|
||||||
|
|
||||||
return v
|
// Skipping definition for base type 'Card32'
|
||||||
}
|
|
||||||
|
|
||||||
// Write request to wire for QueryVersion
|
|
||||||
// queryVersionRequest writes a QueryVersion request to a byte slice.
|
|
||||||
func queryVersionRequest(c *xgb.Conn, Major byte, Minor byte) []byte {
|
|
||||||
size := 8
|
|
||||||
b := 0
|
|
||||||
buf := make([]byte, size)
|
|
||||||
|
|
||||||
buf[b] = c.Extensions["XINERAMA"]
|
|
||||||
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
|
|
||||||
|
|
||||||
buf[b] = Major
|
|
||||||
b += 1
|
|
||||||
|
|
||||||
buf[b] = Minor
|
|
||||||
b += 1
|
|
||||||
|
|
||||||
return buf
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetStateCookie is a cookie used only for GetState requests.
|
|
||||||
type GetStateCookie struct {
|
|
||||||
*xgb.Cookie
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetState sends a checked request.
|
|
||||||
// If an error occurs, it will be returned with the reply by calling GetStateCookie.Reply()
|
|
||||||
func GetState(c *xgb.Conn, Window xproto.Window) GetStateCookie {
|
|
||||||
if _, ok := c.Extensions["XINERAMA"]; !ok {
|
|
||||||
panic("Cannot issue request 'GetState' using the uninitialized extension 'XINERAMA'. xinerama.Init(connObj) must be called first.")
|
|
||||||
}
|
|
||||||
cookie := c.NewCookie(true, true)
|
|
||||||
c.NewRequest(getStateRequest(c, Window), cookie)
|
|
||||||
return GetStateCookie{cookie}
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetStateUnchecked sends an unchecked request.
|
|
||||||
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
|
||||||
func GetStateUnchecked(c *xgb.Conn, Window xproto.Window) GetStateCookie {
|
|
||||||
if _, ok := c.Extensions["XINERAMA"]; !ok {
|
|
||||||
panic("Cannot issue request 'GetState' using the uninitialized extension 'XINERAMA'. xinerama.Init(connObj) must be called first.")
|
|
||||||
}
|
|
||||||
cookie := c.NewCookie(false, true)
|
|
||||||
c.NewRequest(getStateRequest(c, Window), cookie)
|
|
||||||
return GetStateCookie{cookie}
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetStateReply represents the data returned from a GetState request.
|
|
||||||
type GetStateReply struct {
|
|
||||||
Sequence uint16 // sequence number of the request for this reply
|
|
||||||
Length uint32 // number of bytes in this reply
|
|
||||||
State byte
|
|
||||||
Window xproto.Window
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reply blocks and returns the reply data for a GetState request.
|
|
||||||
func (cook GetStateCookie) Reply() (*GetStateReply, error) {
|
|
||||||
buf, err := cook.Cookie.Reply()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if buf == nil {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
return getStateReply(buf), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// getStateReply reads a byte slice into a GetStateReply value.
|
|
||||||
func getStateReply(buf []byte) *GetStateReply {
|
|
||||||
v := new(GetStateReply)
|
|
||||||
b := 1 // skip reply determinant
|
|
||||||
|
|
||||||
v.State = buf[b]
|
|
||||||
b += 1
|
|
||||||
|
|
||||||
v.Sequence = xgb.Get16(buf[b:])
|
|
||||||
b += 2
|
|
||||||
|
|
||||||
v.Length = xgb.Get32(buf[b:]) // 4-byte units
|
|
||||||
b += 4
|
|
||||||
|
|
||||||
v.Window = xproto.Window(xgb.Get32(buf[b:]))
|
|
||||||
b += 4
|
|
||||||
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write request to wire for GetState
|
|
||||||
// getStateRequest writes a GetState request to a byte slice.
|
|
||||||
func getStateRequest(c *xgb.Conn, Window xproto.Window) []byte {
|
|
||||||
size := 8
|
|
||||||
b := 0
|
|
||||||
buf := make([]byte, size)
|
|
||||||
|
|
||||||
buf[b] = c.Extensions["XINERAMA"]
|
|
||||||
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
|
|
||||||
|
|
||||||
xgb.Put32(buf[b:], uint32(Window))
|
|
||||||
b += 4
|
|
||||||
|
|
||||||
return buf
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetScreenCountCookie is a cookie used only for GetScreenCount requests.
|
// GetScreenCountCookie is a cookie used only for GetScreenCount requests.
|
||||||
type GetScreenCountCookie struct {
|
type GetScreenCountCookie struct {
|
||||||
|
@ -508,6 +324,95 @@ func getScreenSizeRequest(c *xgb.Conn, Window xproto.Window, Screen uint32) []by
|
||||||
return buf
|
return buf
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetStateCookie is a cookie used only for GetState requests.
|
||||||
|
type GetStateCookie struct {
|
||||||
|
*xgb.Cookie
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetState sends a checked request.
|
||||||
|
// If an error occurs, it will be returned with the reply by calling GetStateCookie.Reply()
|
||||||
|
func GetState(c *xgb.Conn, Window xproto.Window) GetStateCookie {
|
||||||
|
if _, ok := c.Extensions["XINERAMA"]; !ok {
|
||||||
|
panic("Cannot issue request 'GetState' using the uninitialized extension 'XINERAMA'. xinerama.Init(connObj) must be called first.")
|
||||||
|
}
|
||||||
|
cookie := c.NewCookie(true, true)
|
||||||
|
c.NewRequest(getStateRequest(c, Window), cookie)
|
||||||
|
return GetStateCookie{cookie}
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetStateUnchecked sends an unchecked request.
|
||||||
|
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
||||||
|
func GetStateUnchecked(c *xgb.Conn, Window xproto.Window) GetStateCookie {
|
||||||
|
if _, ok := c.Extensions["XINERAMA"]; !ok {
|
||||||
|
panic("Cannot issue request 'GetState' using the uninitialized extension 'XINERAMA'. xinerama.Init(connObj) must be called first.")
|
||||||
|
}
|
||||||
|
cookie := c.NewCookie(false, true)
|
||||||
|
c.NewRequest(getStateRequest(c, Window), cookie)
|
||||||
|
return GetStateCookie{cookie}
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetStateReply represents the data returned from a GetState request.
|
||||||
|
type GetStateReply struct {
|
||||||
|
Sequence uint16 // sequence number of the request for this reply
|
||||||
|
Length uint32 // number of bytes in this reply
|
||||||
|
State byte
|
||||||
|
Window xproto.Window
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reply blocks and returns the reply data for a GetState request.
|
||||||
|
func (cook GetStateCookie) Reply() (*GetStateReply, error) {
|
||||||
|
buf, err := cook.Cookie.Reply()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if buf == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return getStateReply(buf), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// getStateReply reads a byte slice into a GetStateReply value.
|
||||||
|
func getStateReply(buf []byte) *GetStateReply {
|
||||||
|
v := new(GetStateReply)
|
||||||
|
b := 1 // skip reply determinant
|
||||||
|
|
||||||
|
v.State = buf[b]
|
||||||
|
b += 1
|
||||||
|
|
||||||
|
v.Sequence = xgb.Get16(buf[b:])
|
||||||
|
b += 2
|
||||||
|
|
||||||
|
v.Length = xgb.Get32(buf[b:]) // 4-byte units
|
||||||
|
b += 4
|
||||||
|
|
||||||
|
v.Window = xproto.Window(xgb.Get32(buf[b:]))
|
||||||
|
b += 4
|
||||||
|
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write request to wire for GetState
|
||||||
|
// getStateRequest writes a GetState request to a byte slice.
|
||||||
|
func getStateRequest(c *xgb.Conn, Window xproto.Window) []byte {
|
||||||
|
size := 8
|
||||||
|
b := 0
|
||||||
|
buf := make([]byte, size)
|
||||||
|
|
||||||
|
buf[b] = c.Extensions["XINERAMA"]
|
||||||
|
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
|
||||||
|
|
||||||
|
xgb.Put32(buf[b:], uint32(Window))
|
||||||
|
b += 4
|
||||||
|
|
||||||
|
return buf
|
||||||
|
}
|
||||||
|
|
||||||
// IsActiveCookie is a cookie used only for IsActive requests.
|
// IsActiveCookie is a cookie used only for IsActive requests.
|
||||||
type IsActiveCookie struct {
|
type IsActiveCookie struct {
|
||||||
*xgb.Cookie
|
*xgb.Cookie
|
||||||
|
@ -684,3 +589,98 @@ func queryScreensRequest(c *xgb.Conn) []byte {
|
||||||
|
|
||||||
return buf
|
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, Major byte, Minor byte) QueryVersionCookie {
|
||||||
|
if _, ok := c.Extensions["XINERAMA"]; !ok {
|
||||||
|
panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'XINERAMA'. xinerama.Init(connObj) must be called first.")
|
||||||
|
}
|
||||||
|
cookie := c.NewCookie(true, true)
|
||||||
|
c.NewRequest(queryVersionRequest(c, Major, Minor), 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, Major byte, Minor byte) QueryVersionCookie {
|
||||||
|
if _, ok := c.Extensions["XINERAMA"]; !ok {
|
||||||
|
panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'XINERAMA'. xinerama.Init(connObj) must be called first.")
|
||||||
|
}
|
||||||
|
cookie := c.NewCookie(false, true)
|
||||||
|
c.NewRequest(queryVersionRequest(c, Major, Minor), 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
|
||||||
|
Major uint16
|
||||||
|
Minor 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.Major = xgb.Get16(buf[b:])
|
||||||
|
b += 2
|
||||||
|
|
||||||
|
v.Minor = 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, Major byte, Minor byte) []byte {
|
||||||
|
size := 8
|
||||||
|
b := 0
|
||||||
|
buf := make([]byte, size)
|
||||||
|
|
||||||
|
buf[b] = c.Extensions["XINERAMA"]
|
||||||
|
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
|
||||||
|
|
||||||
|
buf[b] = Major
|
||||||
|
b += 1
|
||||||
|
|
||||||
|
buf[b] = Minor
|
||||||
|
b += 1
|
||||||
|
|
||||||
|
return buf
|
||||||
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
22928
nexgb/xproto/xproto.go
22928
nexgb/xproto/xproto.go
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -2,7 +2,7 @@
|
||||||
package xtest
|
package xtest
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This file was generated by xtest.xml on Jun 5 2012 12:12:00am EDT.
|
This file was generated by xtest.xml on Aug 11 2013 8:39:44pm EDT.
|
||||||
This file is automatically generated. Edit at your peril!
|
This file is automatically generated. Edit at your peril!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -40,128 +40,34 @@ func init() {
|
||||||
xgb.NewExtErrorFuncs["XTEST"] = make(map[int]xgb.NewErrorFun)
|
xgb.NewExtErrorFuncs["XTEST"] = make(map[int]xgb.NewErrorFun)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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'
|
|
||||||
|
|
||||||
// Skipping definition for base type 'Int32'
|
|
||||||
|
|
||||||
const (
|
const (
|
||||||
CursorNone = 0
|
CursorNone = 0
|
||||||
CursorCurrent = 1
|
CursorCurrent = 1
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetVersionCookie is a cookie used only for GetVersion requests.
|
// Skipping definition for base type 'Bool'
|
||||||
type GetVersionCookie struct {
|
|
||||||
*xgb.Cookie
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetVersion sends a checked request.
|
// Skipping definition for base type 'Byte'
|
||||||
// If an error occurs, it will be returned with the reply by calling GetVersionCookie.Reply()
|
|
||||||
func GetVersion(c *xgb.Conn, MajorVersion byte, MinorVersion uint16) GetVersionCookie {
|
|
||||||
if _, ok := c.Extensions["XTEST"]; !ok {
|
|
||||||
panic("Cannot issue request 'GetVersion' using the uninitialized extension 'XTEST'. xtest.Init(connObj) must be called first.")
|
|
||||||
}
|
|
||||||
cookie := c.NewCookie(true, true)
|
|
||||||
c.NewRequest(getVersionRequest(c, MajorVersion, MinorVersion), cookie)
|
|
||||||
return GetVersionCookie{cookie}
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetVersionUnchecked sends an unchecked request.
|
// Skipping definition for base type 'Card8'
|
||||||
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
|
||||||
func GetVersionUnchecked(c *xgb.Conn, MajorVersion byte, MinorVersion uint16) GetVersionCookie {
|
|
||||||
if _, ok := c.Extensions["XTEST"]; !ok {
|
|
||||||
panic("Cannot issue request 'GetVersion' using the uninitialized extension 'XTEST'. xtest.Init(connObj) must be called first.")
|
|
||||||
}
|
|
||||||
cookie := c.NewCookie(false, true)
|
|
||||||
c.NewRequest(getVersionRequest(c, MajorVersion, MinorVersion), cookie)
|
|
||||||
return GetVersionCookie{cookie}
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetVersionReply represents the data returned from a GetVersion request.
|
// Skipping definition for base type 'Char'
|
||||||
type GetVersionReply struct {
|
|
||||||
Sequence uint16 // sequence number of the request for this reply
|
|
||||||
Length uint32 // number of bytes in this reply
|
|
||||||
MajorVersion byte
|
|
||||||
MinorVersion uint16
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reply blocks and returns the reply data for a GetVersion request.
|
// Skipping definition for base type 'Void'
|
||||||
func (cook GetVersionCookie) Reply() (*GetVersionReply, error) {
|
|
||||||
buf, err := cook.Cookie.Reply()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if buf == nil {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
return getVersionReply(buf), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// getVersionReply reads a byte slice into a GetVersionReply value.
|
// Skipping definition for base type 'Double'
|
||||||
func getVersionReply(buf []byte) *GetVersionReply {
|
|
||||||
v := new(GetVersionReply)
|
|
||||||
b := 1 // skip reply determinant
|
|
||||||
|
|
||||||
v.MajorVersion = buf[b]
|
// Skipping definition for base type 'Float'
|
||||||
b += 1
|
|
||||||
|
|
||||||
v.Sequence = xgb.Get16(buf[b:])
|
// Skipping definition for base type 'Int16'
|
||||||
b += 2
|
|
||||||
|
|
||||||
v.Length = xgb.Get32(buf[b:]) // 4-byte units
|
// Skipping definition for base type 'Int32'
|
||||||
b += 4
|
|
||||||
|
|
||||||
v.MinorVersion = xgb.Get16(buf[b:])
|
// Skipping definition for base type 'Int8'
|
||||||
b += 2
|
|
||||||
|
|
||||||
return v
|
// Skipping definition for base type 'Card16'
|
||||||
}
|
|
||||||
|
|
||||||
// Write request to wire for GetVersion
|
// Skipping definition for base type 'Card32'
|
||||||
// getVersionRequest writes a GetVersion request to a byte slice.
|
|
||||||
func getVersionRequest(c *xgb.Conn, MajorVersion byte, MinorVersion uint16) []byte {
|
|
||||||
size := 8
|
|
||||||
b := 0
|
|
||||||
buf := make([]byte, size)
|
|
||||||
|
|
||||||
buf[b] = c.Extensions["XTEST"]
|
|
||||||
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
|
|
||||||
|
|
||||||
buf[b] = MajorVersion
|
|
||||||
b += 1
|
|
||||||
|
|
||||||
b += 1 // padding
|
|
||||||
|
|
||||||
xgb.Put16(buf[b:], MinorVersion)
|
|
||||||
b += 2
|
|
||||||
|
|
||||||
return buf
|
|
||||||
}
|
|
||||||
|
|
||||||
// CompareCursorCookie is a cookie used only for CompareCursor requests.
|
// CompareCursorCookie is a cookie used only for CompareCursor requests.
|
||||||
type CompareCursorCookie struct {
|
type CompareCursorCookie struct {
|
||||||
|
@ -334,6 +240,100 @@ func fakeInputRequest(c *xgb.Conn, Type byte, Detail byte, Time uint32, Root xpr
|
||||||
return buf
|
return buf
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetVersionCookie is a cookie used only for GetVersion requests.
|
||||||
|
type GetVersionCookie struct {
|
||||||
|
*xgb.Cookie
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetVersion sends a checked request.
|
||||||
|
// If an error occurs, it will be returned with the reply by calling GetVersionCookie.Reply()
|
||||||
|
func GetVersion(c *xgb.Conn, MajorVersion byte, MinorVersion uint16) GetVersionCookie {
|
||||||
|
if _, ok := c.Extensions["XTEST"]; !ok {
|
||||||
|
panic("Cannot issue request 'GetVersion' using the uninitialized extension 'XTEST'. xtest.Init(connObj) must be called first.")
|
||||||
|
}
|
||||||
|
cookie := c.NewCookie(true, true)
|
||||||
|
c.NewRequest(getVersionRequest(c, MajorVersion, MinorVersion), cookie)
|
||||||
|
return GetVersionCookie{cookie}
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetVersionUnchecked sends an unchecked request.
|
||||||
|
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
||||||
|
func GetVersionUnchecked(c *xgb.Conn, MajorVersion byte, MinorVersion uint16) GetVersionCookie {
|
||||||
|
if _, ok := c.Extensions["XTEST"]; !ok {
|
||||||
|
panic("Cannot issue request 'GetVersion' using the uninitialized extension 'XTEST'. xtest.Init(connObj) must be called first.")
|
||||||
|
}
|
||||||
|
cookie := c.NewCookie(false, true)
|
||||||
|
c.NewRequest(getVersionRequest(c, MajorVersion, MinorVersion), cookie)
|
||||||
|
return GetVersionCookie{cookie}
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetVersionReply represents the data returned from a GetVersion request.
|
||||||
|
type GetVersionReply struct {
|
||||||
|
Sequence uint16 // sequence number of the request for this reply
|
||||||
|
Length uint32 // number of bytes in this reply
|
||||||
|
MajorVersion byte
|
||||||
|
MinorVersion uint16
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reply blocks and returns the reply data for a GetVersion request.
|
||||||
|
func (cook GetVersionCookie) Reply() (*GetVersionReply, error) {
|
||||||
|
buf, err := cook.Cookie.Reply()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if buf == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return getVersionReply(buf), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// getVersionReply reads a byte slice into a GetVersionReply value.
|
||||||
|
func getVersionReply(buf []byte) *GetVersionReply {
|
||||||
|
v := new(GetVersionReply)
|
||||||
|
b := 1 // skip reply determinant
|
||||||
|
|
||||||
|
v.MajorVersion = buf[b]
|
||||||
|
b += 1
|
||||||
|
|
||||||
|
v.Sequence = xgb.Get16(buf[b:])
|
||||||
|
b += 2
|
||||||
|
|
||||||
|
v.Length = xgb.Get32(buf[b:]) // 4-byte units
|
||||||
|
b += 4
|
||||||
|
|
||||||
|
v.MinorVersion = xgb.Get16(buf[b:])
|
||||||
|
b += 2
|
||||||
|
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write request to wire for GetVersion
|
||||||
|
// getVersionRequest writes a GetVersion request to a byte slice.
|
||||||
|
func getVersionRequest(c *xgb.Conn, MajorVersion byte, MinorVersion uint16) []byte {
|
||||||
|
size := 8
|
||||||
|
b := 0
|
||||||
|
buf := make([]byte, size)
|
||||||
|
|
||||||
|
buf[b] = c.Extensions["XTEST"]
|
||||||
|
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
|
||||||
|
|
||||||
|
buf[b] = MajorVersion
|
||||||
|
b += 1
|
||||||
|
|
||||||
|
b += 1 // padding
|
||||||
|
|
||||||
|
xgb.Put16(buf[b:], MinorVersion)
|
||||||
|
b += 2
|
||||||
|
|
||||||
|
return buf
|
||||||
|
}
|
||||||
|
|
||||||
// GrabControlCookie is a cookie used only for GrabControl requests.
|
// GrabControlCookie is a cookie used only for GrabControl requests.
|
||||||
type GrabControlCookie struct {
|
type GrabControlCookie struct {
|
||||||
*xgb.Cookie
|
*xgb.Cookie
|
||||||
|
|
2730
nexgb/xv/xv.go
2730
nexgb/xv/xv.go
File diff suppressed because it is too large
Load Diff
|
@ -2,7 +2,7 @@
|
||||||
package xvmc
|
package xvmc
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This file was generated by xvmc.xml on Jun 5 2012 12:12:00am EDT.
|
This file was generated by xvmc.xml on Aug 11 2013 8:39:44pm EDT.
|
||||||
This file is automatically generated. Edit at your peril!
|
This file is automatically generated. Edit at your peril!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -41,30 +41,6 @@ func init() {
|
||||||
xgb.NewExtErrorFuncs["XVideo-MotionCompensation"] = make(map[int]xgb.NewErrorFun)
|
xgb.NewExtErrorFuncs["XVideo-MotionCompensation"] = 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'
|
|
||||||
|
|
||||||
type Context uint32
|
type Context uint32
|
||||||
|
|
||||||
func NewContextId(c *xgb.Conn) (Context, error) {
|
func NewContextId(c *xgb.Conn) (Context, error) {
|
||||||
|
@ -75,16 +51,6 @@ func NewContextId(c *xgb.Conn) (Context, error) {
|
||||||
return Context(id), nil
|
return Context(id), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type Surface uint32
|
|
||||||
|
|
||||||
func NewSurfaceId(c *xgb.Conn) (Surface, error) {
|
|
||||||
id, err := c.NewId()
|
|
||||||
if err != nil {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
return Surface(id), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type Subpicture uint32
|
type Subpicture uint32
|
||||||
|
|
||||||
func NewSubpictureId(c *xgb.Conn) (Subpicture, error) {
|
func NewSubpictureId(c *xgb.Conn) (Subpicture, error) {
|
||||||
|
@ -95,6 +61,16 @@ func NewSubpictureId(c *xgb.Conn) (Subpicture, error) {
|
||||||
return Subpicture(id), nil
|
return Subpicture(id), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Surface uint32
|
||||||
|
|
||||||
|
func NewSurfaceId(c *xgb.Conn) (Surface, error) {
|
||||||
|
id, err := c.NewId()
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
return Surface(id), nil
|
||||||
|
}
|
||||||
|
|
||||||
type SurfaceInfo struct {
|
type SurfaceInfo struct {
|
||||||
Id Surface
|
Id Surface
|
||||||
ChromaFormat uint16
|
ChromaFormat uint16
|
||||||
|
@ -198,189 +174,29 @@ func SurfaceInfoListBytes(buf []byte, list []SurfaceInfo) int {
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
// QueryVersionCookie is a cookie used only for QueryVersion requests.
|
// Skipping definition for base type 'Bool'
|
||||||
type QueryVersionCookie struct {
|
|
||||||
*xgb.Cookie
|
|
||||||
}
|
|
||||||
|
|
||||||
// QueryVersion sends a checked request.
|
// Skipping definition for base type 'Byte'
|
||||||
// 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["XVIDEO-MOTIONCOMPENSATION"]; !ok {
|
|
||||||
panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.")
|
|
||||||
}
|
|
||||||
cookie := c.NewCookie(true, true)
|
|
||||||
c.NewRequest(queryVersionRequest(c), cookie)
|
|
||||||
return QueryVersionCookie{cookie}
|
|
||||||
}
|
|
||||||
|
|
||||||
// QueryVersionUnchecked sends an unchecked request.
|
// Skipping definition for base type 'Card8'
|
||||||
// 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["XVIDEO-MOTIONCOMPENSATION"]; !ok {
|
|
||||||
panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.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.
|
// Skipping definition for base type 'Char'
|
||||||
type QueryVersionReply struct {
|
|
||||||
Sequence uint16 // sequence number of the request for this reply
|
|
||||||
Length uint32 // number of bytes in this reply
|
|
||||||
// padding: 1 bytes
|
|
||||||
Major uint32
|
|
||||||
Minor uint32
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reply blocks and returns the reply data for a QueryVersion request.
|
// Skipping definition for base type 'Void'
|
||||||
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.
|
// Skipping definition for base type 'Double'
|
||||||
func queryVersionReply(buf []byte) *QueryVersionReply {
|
|
||||||
v := new(QueryVersionReply)
|
|
||||||
b := 1 // skip reply determinant
|
|
||||||
|
|
||||||
b += 1 // padding
|
// Skipping definition for base type 'Float'
|
||||||
|
|
||||||
v.Sequence = xgb.Get16(buf[b:])
|
// Skipping definition for base type 'Int16'
|
||||||
b += 2
|
|
||||||
|
|
||||||
v.Length = xgb.Get32(buf[b:]) // 4-byte units
|
// Skipping definition for base type 'Int32'
|
||||||
b += 4
|
|
||||||
|
|
||||||
v.Major = xgb.Get32(buf[b:])
|
// Skipping definition for base type 'Int8'
|
||||||
b += 4
|
|
||||||
|
|
||||||
v.Minor = xgb.Get32(buf[b:])
|
// Skipping definition for base type 'Card16'
|
||||||
b += 4
|
|
||||||
|
|
||||||
return v
|
// Skipping definition for base type 'Card32'
|
||||||
}
|
|
||||||
|
|
||||||
// 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["XVIDEO-MOTIONCOMPENSATION"]
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListSurfaceTypesCookie is a cookie used only for ListSurfaceTypes requests.
|
|
||||||
type ListSurfaceTypesCookie struct {
|
|
||||||
*xgb.Cookie
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListSurfaceTypes sends a checked request.
|
|
||||||
// If an error occurs, it will be returned with the reply by calling ListSurfaceTypesCookie.Reply()
|
|
||||||
func ListSurfaceTypes(c *xgb.Conn, PortId xv.Port) ListSurfaceTypesCookie {
|
|
||||||
if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok {
|
|
||||||
panic("Cannot issue request 'ListSurfaceTypes' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.")
|
|
||||||
}
|
|
||||||
cookie := c.NewCookie(true, true)
|
|
||||||
c.NewRequest(listSurfaceTypesRequest(c, PortId), cookie)
|
|
||||||
return ListSurfaceTypesCookie{cookie}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListSurfaceTypesUnchecked sends an unchecked request.
|
|
||||||
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
|
||||||
func ListSurfaceTypesUnchecked(c *xgb.Conn, PortId xv.Port) ListSurfaceTypesCookie {
|
|
||||||
if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok {
|
|
||||||
panic("Cannot issue request 'ListSurfaceTypes' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.")
|
|
||||||
}
|
|
||||||
cookie := c.NewCookie(false, true)
|
|
||||||
c.NewRequest(listSurfaceTypesRequest(c, PortId), cookie)
|
|
||||||
return ListSurfaceTypesCookie{cookie}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListSurfaceTypesReply represents the data returned from a ListSurfaceTypes request.
|
|
||||||
type ListSurfaceTypesReply struct {
|
|
||||||
Sequence uint16 // sequence number of the request for this reply
|
|
||||||
Length uint32 // number of bytes in this reply
|
|
||||||
// padding: 1 bytes
|
|
||||||
Num uint32
|
|
||||||
// padding: 20 bytes
|
|
||||||
Surfaces []SurfaceInfo // size: xgb.Pad((int(Num) * 24))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reply blocks and returns the reply data for a ListSurfaceTypes request.
|
|
||||||
func (cook ListSurfaceTypesCookie) Reply() (*ListSurfaceTypesReply, error) {
|
|
||||||
buf, err := cook.Cookie.Reply()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if buf == nil {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
return listSurfaceTypesReply(buf), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// listSurfaceTypesReply reads a byte slice into a ListSurfaceTypesReply value.
|
|
||||||
func listSurfaceTypesReply(buf []byte) *ListSurfaceTypesReply {
|
|
||||||
v := new(ListSurfaceTypesReply)
|
|
||||||
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.Num = xgb.Get32(buf[b:])
|
|
||||||
b += 4
|
|
||||||
|
|
||||||
b += 20 // padding
|
|
||||||
|
|
||||||
v.Surfaces = make([]SurfaceInfo, v.Num)
|
|
||||||
b += SurfaceInfoReadList(buf[b:], v.Surfaces)
|
|
||||||
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write request to wire for ListSurfaceTypes
|
|
||||||
// listSurfaceTypesRequest writes a ListSurfaceTypes request to a byte slice.
|
|
||||||
func listSurfaceTypesRequest(c *xgb.Conn, PortId xv.Port) []byte {
|
|
||||||
size := 8
|
|
||||||
b := 0
|
|
||||||
buf := make([]byte, size)
|
|
||||||
|
|
||||||
buf[b] = c.Extensions["XVIDEO-MOTIONCOMPENSATION"]
|
|
||||||
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
|
|
||||||
|
|
||||||
xgb.Put32(buf[b:], uint32(PortId))
|
|
||||||
b += 4
|
|
||||||
|
|
||||||
return buf
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateContextCookie is a cookie used only for CreateContext requests.
|
// CreateContextCookie is a cookie used only for CreateContext requests.
|
||||||
type CreateContextCookie struct {
|
type CreateContextCookie struct {
|
||||||
|
@ -504,214 +320,6 @@ func createContextRequest(c *xgb.Conn, ContextId Context, PortId xv.Port, Surfac
|
||||||
return buf
|
return buf
|
||||||
}
|
}
|
||||||
|
|
||||||
// DestroyContextCookie is a cookie used only for DestroyContext requests.
|
|
||||||
type DestroyContextCookie struct {
|
|
||||||
*xgb.Cookie
|
|
||||||
}
|
|
||||||
|
|
||||||
// DestroyContext sends an unchecked request.
|
|
||||||
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
|
||||||
func DestroyContext(c *xgb.Conn, ContextId Context) DestroyContextCookie {
|
|
||||||
if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok {
|
|
||||||
panic("Cannot issue request 'DestroyContext' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.")
|
|
||||||
}
|
|
||||||
cookie := c.NewCookie(false, false)
|
|
||||||
c.NewRequest(destroyContextRequest(c, ContextId), cookie)
|
|
||||||
return DestroyContextCookie{cookie}
|
|
||||||
}
|
|
||||||
|
|
||||||
// DestroyContextChecked sends a checked request.
|
|
||||||
// If an error occurs, it can be retrieved using DestroyContextCookie.Check()
|
|
||||||
func DestroyContextChecked(c *xgb.Conn, ContextId Context) DestroyContextCookie {
|
|
||||||
if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok {
|
|
||||||
panic("Cannot issue request 'DestroyContext' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.")
|
|
||||||
}
|
|
||||||
cookie := c.NewCookie(true, false)
|
|
||||||
c.NewRequest(destroyContextRequest(c, ContextId), cookie)
|
|
||||||
return DestroyContextCookie{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 DestroyContextCookie) Check() error {
|
|
||||||
return cook.Cookie.Check()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write request to wire for DestroyContext
|
|
||||||
// destroyContextRequest writes a DestroyContext request to a byte slice.
|
|
||||||
func destroyContextRequest(c *xgb.Conn, ContextId Context) []byte {
|
|
||||||
size := 8
|
|
||||||
b := 0
|
|
||||||
buf := make([]byte, size)
|
|
||||||
|
|
||||||
buf[b] = c.Extensions["XVIDEO-MOTIONCOMPENSATION"]
|
|
||||||
b += 1
|
|
||||||
|
|
||||||
buf[b] = 3 // 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(ContextId))
|
|
||||||
b += 4
|
|
||||||
|
|
||||||
return buf
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateSurfaceCookie is a cookie used only for CreateSurface requests.
|
|
||||||
type CreateSurfaceCookie struct {
|
|
||||||
*xgb.Cookie
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateSurface sends a checked request.
|
|
||||||
// If an error occurs, it will be returned with the reply by calling CreateSurfaceCookie.Reply()
|
|
||||||
func CreateSurface(c *xgb.Conn, SurfaceId Surface, ContextId Context) CreateSurfaceCookie {
|
|
||||||
if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok {
|
|
||||||
panic("Cannot issue request 'CreateSurface' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.")
|
|
||||||
}
|
|
||||||
cookie := c.NewCookie(true, true)
|
|
||||||
c.NewRequest(createSurfaceRequest(c, SurfaceId, ContextId), cookie)
|
|
||||||
return CreateSurfaceCookie{cookie}
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateSurfaceUnchecked sends an unchecked request.
|
|
||||||
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
|
||||||
func CreateSurfaceUnchecked(c *xgb.Conn, SurfaceId Surface, ContextId Context) CreateSurfaceCookie {
|
|
||||||
if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok {
|
|
||||||
panic("Cannot issue request 'CreateSurface' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.")
|
|
||||||
}
|
|
||||||
cookie := c.NewCookie(false, true)
|
|
||||||
c.NewRequest(createSurfaceRequest(c, SurfaceId, ContextId), cookie)
|
|
||||||
return CreateSurfaceCookie{cookie}
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateSurfaceReply represents the data returned from a CreateSurface request.
|
|
||||||
type CreateSurfaceReply struct {
|
|
||||||
Sequence uint16 // sequence number of the request for this reply
|
|
||||||
Length uint32 // number of bytes in this reply
|
|
||||||
// padding: 1 bytes
|
|
||||||
// padding: 24 bytes
|
|
||||||
PrivData []uint32 // size: xgb.Pad((int(Length) * 4))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reply blocks and returns the reply data for a CreateSurface request.
|
|
||||||
func (cook CreateSurfaceCookie) Reply() (*CreateSurfaceReply, error) {
|
|
||||||
buf, err := cook.Cookie.Reply()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if buf == nil {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
return createSurfaceReply(buf), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// createSurfaceReply reads a byte slice into a CreateSurfaceReply value.
|
|
||||||
func createSurfaceReply(buf []byte) *CreateSurfaceReply {
|
|
||||||
v := new(CreateSurfaceReply)
|
|
||||||
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
|
|
||||||
|
|
||||||
b += 24 // padding
|
|
||||||
|
|
||||||
v.PrivData = make([]uint32, v.Length)
|
|
||||||
for i := 0; i < int(v.Length); i++ {
|
|
||||||
v.PrivData[i] = xgb.Get32(buf[b:])
|
|
||||||
b += 4
|
|
||||||
}
|
|
||||||
b = xgb.Pad(b)
|
|
||||||
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write request to wire for CreateSurface
|
|
||||||
// createSurfaceRequest writes a CreateSurface request to a byte slice.
|
|
||||||
func createSurfaceRequest(c *xgb.Conn, SurfaceId Surface, ContextId Context) []byte {
|
|
||||||
size := 12
|
|
||||||
b := 0
|
|
||||||
buf := make([]byte, size)
|
|
||||||
|
|
||||||
buf[b] = c.Extensions["XVIDEO-MOTIONCOMPENSATION"]
|
|
||||||
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(SurfaceId))
|
|
||||||
b += 4
|
|
||||||
|
|
||||||
xgb.Put32(buf[b:], uint32(ContextId))
|
|
||||||
b += 4
|
|
||||||
|
|
||||||
return buf
|
|
||||||
}
|
|
||||||
|
|
||||||
// DestroySurfaceCookie is a cookie used only for DestroySurface requests.
|
|
||||||
type DestroySurfaceCookie struct {
|
|
||||||
*xgb.Cookie
|
|
||||||
}
|
|
||||||
|
|
||||||
// DestroySurface sends an unchecked request.
|
|
||||||
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
|
||||||
func DestroySurface(c *xgb.Conn, SurfaceId Surface) DestroySurfaceCookie {
|
|
||||||
if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok {
|
|
||||||
panic("Cannot issue request 'DestroySurface' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.")
|
|
||||||
}
|
|
||||||
cookie := c.NewCookie(false, false)
|
|
||||||
c.NewRequest(destroySurfaceRequest(c, SurfaceId), cookie)
|
|
||||||
return DestroySurfaceCookie{cookie}
|
|
||||||
}
|
|
||||||
|
|
||||||
// DestroySurfaceChecked sends a checked request.
|
|
||||||
// If an error occurs, it can be retrieved using DestroySurfaceCookie.Check()
|
|
||||||
func DestroySurfaceChecked(c *xgb.Conn, SurfaceId Surface) DestroySurfaceCookie {
|
|
||||||
if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok {
|
|
||||||
panic("Cannot issue request 'DestroySurface' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.")
|
|
||||||
}
|
|
||||||
cookie := c.NewCookie(true, false)
|
|
||||||
c.NewRequest(destroySurfaceRequest(c, SurfaceId), cookie)
|
|
||||||
return DestroySurfaceCookie{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 DestroySurfaceCookie) Check() error {
|
|
||||||
return cook.Cookie.Check()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write request to wire for DestroySurface
|
|
||||||
// destroySurfaceRequest writes a DestroySurface request to a byte slice.
|
|
||||||
func destroySurfaceRequest(c *xgb.Conn, SurfaceId Surface) []byte {
|
|
||||||
size := 8
|
|
||||||
b := 0
|
|
||||||
buf := make([]byte, size)
|
|
||||||
|
|
||||||
buf[b] = c.Extensions["XVIDEO-MOTIONCOMPENSATION"]
|
|
||||||
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(SurfaceId))
|
|
||||||
b += 4
|
|
||||||
|
|
||||||
return buf
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateSubpictureCookie is a cookie used only for CreateSubpicture requests.
|
// CreateSubpictureCookie is a cookie used only for CreateSubpicture requests.
|
||||||
type CreateSubpictureCookie struct {
|
type CreateSubpictureCookie struct {
|
||||||
*xgb.Cookie
|
*xgb.Cookie
|
||||||
|
@ -840,6 +448,159 @@ func createSubpictureRequest(c *xgb.Conn, SubpictureId Subpicture, Context Conte
|
||||||
return buf
|
return buf
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CreateSurfaceCookie is a cookie used only for CreateSurface requests.
|
||||||
|
type CreateSurfaceCookie struct {
|
||||||
|
*xgb.Cookie
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateSurface sends a checked request.
|
||||||
|
// If an error occurs, it will be returned with the reply by calling CreateSurfaceCookie.Reply()
|
||||||
|
func CreateSurface(c *xgb.Conn, SurfaceId Surface, ContextId Context) CreateSurfaceCookie {
|
||||||
|
if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok {
|
||||||
|
panic("Cannot issue request 'CreateSurface' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.")
|
||||||
|
}
|
||||||
|
cookie := c.NewCookie(true, true)
|
||||||
|
c.NewRequest(createSurfaceRequest(c, SurfaceId, ContextId), cookie)
|
||||||
|
return CreateSurfaceCookie{cookie}
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateSurfaceUnchecked sends an unchecked request.
|
||||||
|
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
||||||
|
func CreateSurfaceUnchecked(c *xgb.Conn, SurfaceId Surface, ContextId Context) CreateSurfaceCookie {
|
||||||
|
if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok {
|
||||||
|
panic("Cannot issue request 'CreateSurface' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.")
|
||||||
|
}
|
||||||
|
cookie := c.NewCookie(false, true)
|
||||||
|
c.NewRequest(createSurfaceRequest(c, SurfaceId, ContextId), cookie)
|
||||||
|
return CreateSurfaceCookie{cookie}
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateSurfaceReply represents the data returned from a CreateSurface request.
|
||||||
|
type CreateSurfaceReply struct {
|
||||||
|
Sequence uint16 // sequence number of the request for this reply
|
||||||
|
Length uint32 // number of bytes in this reply
|
||||||
|
// padding: 1 bytes
|
||||||
|
// padding: 24 bytes
|
||||||
|
PrivData []uint32 // size: xgb.Pad((int(Length) * 4))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reply blocks and returns the reply data for a CreateSurface request.
|
||||||
|
func (cook CreateSurfaceCookie) Reply() (*CreateSurfaceReply, error) {
|
||||||
|
buf, err := cook.Cookie.Reply()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if buf == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return createSurfaceReply(buf), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// createSurfaceReply reads a byte slice into a CreateSurfaceReply value.
|
||||||
|
func createSurfaceReply(buf []byte) *CreateSurfaceReply {
|
||||||
|
v := new(CreateSurfaceReply)
|
||||||
|
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
|
||||||
|
|
||||||
|
b += 24 // padding
|
||||||
|
|
||||||
|
v.PrivData = make([]uint32, v.Length)
|
||||||
|
for i := 0; i < int(v.Length); i++ {
|
||||||
|
v.PrivData[i] = xgb.Get32(buf[b:])
|
||||||
|
b += 4
|
||||||
|
}
|
||||||
|
b = xgb.Pad(b)
|
||||||
|
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write request to wire for CreateSurface
|
||||||
|
// createSurfaceRequest writes a CreateSurface request to a byte slice.
|
||||||
|
func createSurfaceRequest(c *xgb.Conn, SurfaceId Surface, ContextId Context) []byte {
|
||||||
|
size := 12
|
||||||
|
b := 0
|
||||||
|
buf := make([]byte, size)
|
||||||
|
|
||||||
|
buf[b] = c.Extensions["XVIDEO-MOTIONCOMPENSATION"]
|
||||||
|
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(SurfaceId))
|
||||||
|
b += 4
|
||||||
|
|
||||||
|
xgb.Put32(buf[b:], uint32(ContextId))
|
||||||
|
b += 4
|
||||||
|
|
||||||
|
return buf
|
||||||
|
}
|
||||||
|
|
||||||
|
// DestroyContextCookie is a cookie used only for DestroyContext requests.
|
||||||
|
type DestroyContextCookie struct {
|
||||||
|
*xgb.Cookie
|
||||||
|
}
|
||||||
|
|
||||||
|
// DestroyContext sends an unchecked request.
|
||||||
|
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
||||||
|
func DestroyContext(c *xgb.Conn, ContextId Context) DestroyContextCookie {
|
||||||
|
if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok {
|
||||||
|
panic("Cannot issue request 'DestroyContext' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.")
|
||||||
|
}
|
||||||
|
cookie := c.NewCookie(false, false)
|
||||||
|
c.NewRequest(destroyContextRequest(c, ContextId), cookie)
|
||||||
|
return DestroyContextCookie{cookie}
|
||||||
|
}
|
||||||
|
|
||||||
|
// DestroyContextChecked sends a checked request.
|
||||||
|
// If an error occurs, it can be retrieved using DestroyContextCookie.Check()
|
||||||
|
func DestroyContextChecked(c *xgb.Conn, ContextId Context) DestroyContextCookie {
|
||||||
|
if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok {
|
||||||
|
panic("Cannot issue request 'DestroyContext' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.")
|
||||||
|
}
|
||||||
|
cookie := c.NewCookie(true, false)
|
||||||
|
c.NewRequest(destroyContextRequest(c, ContextId), cookie)
|
||||||
|
return DestroyContextCookie{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 DestroyContextCookie) Check() error {
|
||||||
|
return cook.Cookie.Check()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write request to wire for DestroyContext
|
||||||
|
// destroyContextRequest writes a DestroyContext request to a byte slice.
|
||||||
|
func destroyContextRequest(c *xgb.Conn, ContextId Context) []byte {
|
||||||
|
size := 8
|
||||||
|
b := 0
|
||||||
|
buf := make([]byte, size)
|
||||||
|
|
||||||
|
buf[b] = c.Extensions["XVIDEO-MOTIONCOMPENSATION"]
|
||||||
|
b += 1
|
||||||
|
|
||||||
|
buf[b] = 3 // 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(ContextId))
|
||||||
|
b += 4
|
||||||
|
|
||||||
|
return buf
|
||||||
|
}
|
||||||
|
|
||||||
// DestroySubpictureCookie is a cookie used only for DestroySubpicture requests.
|
// DestroySubpictureCookie is a cookie used only for DestroySubpicture requests.
|
||||||
type DestroySubpictureCookie struct {
|
type DestroySubpictureCookie struct {
|
||||||
*xgb.Cookie
|
*xgb.Cookie
|
||||||
|
@ -895,6 +656,61 @@ func destroySubpictureRequest(c *xgb.Conn, SubpictureId Subpicture) []byte {
|
||||||
return buf
|
return buf
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DestroySurfaceCookie is a cookie used only for DestroySurface requests.
|
||||||
|
type DestroySurfaceCookie struct {
|
||||||
|
*xgb.Cookie
|
||||||
|
}
|
||||||
|
|
||||||
|
// DestroySurface sends an unchecked request.
|
||||||
|
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
||||||
|
func DestroySurface(c *xgb.Conn, SurfaceId Surface) DestroySurfaceCookie {
|
||||||
|
if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok {
|
||||||
|
panic("Cannot issue request 'DestroySurface' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.")
|
||||||
|
}
|
||||||
|
cookie := c.NewCookie(false, false)
|
||||||
|
c.NewRequest(destroySurfaceRequest(c, SurfaceId), cookie)
|
||||||
|
return DestroySurfaceCookie{cookie}
|
||||||
|
}
|
||||||
|
|
||||||
|
// DestroySurfaceChecked sends a checked request.
|
||||||
|
// If an error occurs, it can be retrieved using DestroySurfaceCookie.Check()
|
||||||
|
func DestroySurfaceChecked(c *xgb.Conn, SurfaceId Surface) DestroySurfaceCookie {
|
||||||
|
if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok {
|
||||||
|
panic("Cannot issue request 'DestroySurface' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.")
|
||||||
|
}
|
||||||
|
cookie := c.NewCookie(true, false)
|
||||||
|
c.NewRequest(destroySurfaceRequest(c, SurfaceId), cookie)
|
||||||
|
return DestroySurfaceCookie{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 DestroySurfaceCookie) Check() error {
|
||||||
|
return cook.Cookie.Check()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write request to wire for DestroySurface
|
||||||
|
// destroySurfaceRequest writes a DestroySurface request to a byte slice.
|
||||||
|
func destroySurfaceRequest(c *xgb.Conn, SurfaceId Surface) []byte {
|
||||||
|
size := 8
|
||||||
|
b := 0
|
||||||
|
buf := make([]byte, size)
|
||||||
|
|
||||||
|
buf[b] = c.Extensions["XVIDEO-MOTIONCOMPENSATION"]
|
||||||
|
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(SurfaceId))
|
||||||
|
b += 4
|
||||||
|
|
||||||
|
return buf
|
||||||
|
}
|
||||||
|
|
||||||
// ListSubpictureTypesCookie is a cookie used only for ListSubpictureTypes requests.
|
// ListSubpictureTypesCookie is a cookie used only for ListSubpictureTypes requests.
|
||||||
type ListSubpictureTypesCookie struct {
|
type ListSubpictureTypesCookie struct {
|
||||||
*xgb.Cookie
|
*xgb.Cookie
|
||||||
|
@ -992,3 +808,187 @@ func listSubpictureTypesRequest(c *xgb.Conn, PortId xv.Port, SurfaceId Surface)
|
||||||
|
|
||||||
return buf
|
return buf
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ListSurfaceTypesCookie is a cookie used only for ListSurfaceTypes requests.
|
||||||
|
type ListSurfaceTypesCookie struct {
|
||||||
|
*xgb.Cookie
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListSurfaceTypes sends a checked request.
|
||||||
|
// If an error occurs, it will be returned with the reply by calling ListSurfaceTypesCookie.Reply()
|
||||||
|
func ListSurfaceTypes(c *xgb.Conn, PortId xv.Port) ListSurfaceTypesCookie {
|
||||||
|
if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok {
|
||||||
|
panic("Cannot issue request 'ListSurfaceTypes' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.")
|
||||||
|
}
|
||||||
|
cookie := c.NewCookie(true, true)
|
||||||
|
c.NewRequest(listSurfaceTypesRequest(c, PortId), cookie)
|
||||||
|
return ListSurfaceTypesCookie{cookie}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListSurfaceTypesUnchecked sends an unchecked request.
|
||||||
|
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
|
||||||
|
func ListSurfaceTypesUnchecked(c *xgb.Conn, PortId xv.Port) ListSurfaceTypesCookie {
|
||||||
|
if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok {
|
||||||
|
panic("Cannot issue request 'ListSurfaceTypes' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.")
|
||||||
|
}
|
||||||
|
cookie := c.NewCookie(false, true)
|
||||||
|
c.NewRequest(listSurfaceTypesRequest(c, PortId), cookie)
|
||||||
|
return ListSurfaceTypesCookie{cookie}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListSurfaceTypesReply represents the data returned from a ListSurfaceTypes request.
|
||||||
|
type ListSurfaceTypesReply struct {
|
||||||
|
Sequence uint16 // sequence number of the request for this reply
|
||||||
|
Length uint32 // number of bytes in this reply
|
||||||
|
// padding: 1 bytes
|
||||||
|
Num uint32
|
||||||
|
// padding: 20 bytes
|
||||||
|
Surfaces []SurfaceInfo // size: xgb.Pad((int(Num) * 24))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reply blocks and returns the reply data for a ListSurfaceTypes request.
|
||||||
|
func (cook ListSurfaceTypesCookie) Reply() (*ListSurfaceTypesReply, error) {
|
||||||
|
buf, err := cook.Cookie.Reply()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if buf == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return listSurfaceTypesReply(buf), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// listSurfaceTypesReply reads a byte slice into a ListSurfaceTypesReply value.
|
||||||
|
func listSurfaceTypesReply(buf []byte) *ListSurfaceTypesReply {
|
||||||
|
v := new(ListSurfaceTypesReply)
|
||||||
|
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.Num = xgb.Get32(buf[b:])
|
||||||
|
b += 4
|
||||||
|
|
||||||
|
b += 20 // padding
|
||||||
|
|
||||||
|
v.Surfaces = make([]SurfaceInfo, v.Num)
|
||||||
|
b += SurfaceInfoReadList(buf[b:], v.Surfaces)
|
||||||
|
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write request to wire for ListSurfaceTypes
|
||||||
|
// listSurfaceTypesRequest writes a ListSurfaceTypes request to a byte slice.
|
||||||
|
func listSurfaceTypesRequest(c *xgb.Conn, PortId xv.Port) []byte {
|
||||||
|
size := 8
|
||||||
|
b := 0
|
||||||
|
buf := make([]byte, size)
|
||||||
|
|
||||||
|
buf[b] = c.Extensions["XVIDEO-MOTIONCOMPENSATION"]
|
||||||
|
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
|
||||||
|
|
||||||
|
xgb.Put32(buf[b:], uint32(PortId))
|
||||||
|
b += 4
|
||||||
|
|
||||||
|
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["XVIDEO-MOTIONCOMPENSATION"]; !ok {
|
||||||
|
panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.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["XVIDEO-MOTIONCOMPENSATION"]; !ok {
|
||||||
|
panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.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
|
||||||
|
Major uint32
|
||||||
|
Minor uint32
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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.Major = xgb.Get32(buf[b:])
|
||||||
|
b += 4
|
||||||
|
|
||||||
|
v.Minor = xgb.Get32(buf[b:])
|
||||||
|
b += 4
|
||||||
|
|
||||||
|
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["XVIDEO-MOTIONCOMPENSATION"]
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue