From 0c50dc6241fa21712e041cfa2bfb9db4ccaef10a Mon Sep 17 00:00:00 2001 From: "Andrew Gallant (Ocelot)" Date: Thu, 10 May 2012 17:01:42 -0400 Subject: a huge commit. splitting extensions into their own sub-packages. --- nexgb/composite/composite.go | 575 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 575 insertions(+) create mode 100644 nexgb/composite/composite.go (limited to 'nexgb/composite') diff --git a/nexgb/composite/composite.go b/nexgb/composite/composite.go new file mode 100644 index 0000000..266c087 --- /dev/null +++ b/nexgb/composite/composite.go @@ -0,0 +1,575 @@ +package composite + +/* + This file was generated by composite.xml on May 10 2012 4:20:27pm EDT. + This file is automatically generated. Edit at your peril! +*/ + +import ( + "github.com/BurntSushi/xgb" + + "github.com/BurntSushi/xgb/xfixes" + "github.com/BurntSushi/xgb/xproto" +) + +// Init must be called before using the Composite extension. +func Init(c *xgb.Conn) error { + reply, err := xproto.QueryExtension(c, 9, "Composite").Reply() + switch { + case err != nil: + return err + case !reply.Present: + return xgb.Errorf("No extension named Composite could be found on on the server.") + } + + xgb.ExtLock.Lock() + c.Extensions["Composite"] = reply.MajorOpcode + for evNum, fun := range xgb.NewExtEventFuncs["Composite"] { + xgb.NewEventFuncs[int(reply.FirstEvent)+evNum] = fun + } + for errNum, fun := range xgb.NewExtErrorFuncs["Composite"] { + xgb.NewErrorFuncs[int(reply.FirstError)+errNum] = fun + } + xgb.ExtLock.Unlock() + + return nil +} + +func init() { + xgb.NewExtEventFuncs["Composite"] = make(map[int]xgb.NewEventFun) + xgb.NewExtErrorFuncs["Composite"] = 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 ( + RedirectAutomatic = 0 + RedirectManual = 1 +) + +// Request QueryVersion +// size: 12 +type QueryVersionCookie struct { + *xgb.Cookie +} + +func QueryVersion(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVersion uint32) QueryVersionCookie { + cookie := c.NewCookie(true, true) + c.NewRequest(queryVersionRequest(c, ClientMajorVersion, ClientMinorVersion), cookie) + return QueryVersionCookie{cookie} +} + +func QueryVersionUnchecked(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVersion uint32) QueryVersionCookie { + cookie := c.NewCookie(false, true) + c.NewRequest(queryVersionRequest(c, ClientMajorVersion, ClientMinorVersion), cookie) + return QueryVersionCookie{cookie} +} + +// Request reply for QueryVersion +// size: 32 +type QueryVersionReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + MajorVersion uint32 + MinorVersion uint32 + // padding: 16 bytes +} + +// Waits and reads reply data from request QueryVersion +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 +} + +// Read reply into structure from buffer for QueryVersion +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 +func queryVersionRequest(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVersion uint32) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["COMPOSITE"] + 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 +} + +// Request RedirectWindow +// size: 12 +type RedirectWindowCookie struct { + *xgb.Cookie +} + +// Write request to wire for RedirectWindow +func RedirectWindow(c *xgb.Conn, Window xproto.Window, Update byte) RedirectWindowCookie { + cookie := c.NewCookie(false, false) + c.NewRequest(redirectWindowRequest(c, Window, Update), cookie) + return RedirectWindowCookie{cookie} +} + +func RedirectWindowChecked(c *xgb.Conn, Window xproto.Window, Update byte) RedirectWindowCookie { + cookie := c.NewCookie(true, false) + c.NewRequest(redirectWindowRequest(c, Window, Update), cookie) + return RedirectWindowCookie{cookie} +} + +func (cook RedirectWindowCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for RedirectWindow +func redirectWindowRequest(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] = 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 + + buf[b] = Update + b += 1 + + b += 3 // padding + + return buf +} + +// Request RedirectSubwindows +// size: 12 +type RedirectSubwindowsCookie struct { + *xgb.Cookie +} + +// Write request to wire for RedirectSubwindows +func RedirectSubwindows(c *xgb.Conn, Window xproto.Window, Update byte) RedirectSubwindowsCookie { + cookie := c.NewCookie(false, false) + c.NewRequest(redirectSubwindowsRequest(c, Window, Update), cookie) + return RedirectSubwindowsCookie{cookie} +} + +func RedirectSubwindowsChecked(c *xgb.Conn, Window xproto.Window, Update byte) RedirectSubwindowsCookie { + cookie := c.NewCookie(true, false) + c.NewRequest(redirectSubwindowsRequest(c, Window, Update), cookie) + return RedirectSubwindowsCookie{cookie} +} + +func (cook RedirectSubwindowsCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for RedirectSubwindows +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 +} + +// Request UnredirectWindow +// size: 12 +type UnredirectWindowCookie struct { + *xgb.Cookie +} + +// Write request to wire for UnredirectWindow +func UnredirectWindow(c *xgb.Conn, Window xproto.Window, Update byte) UnredirectWindowCookie { + cookie := c.NewCookie(false, false) + c.NewRequest(unredirectWindowRequest(c, Window, Update), cookie) + return UnredirectWindowCookie{cookie} +} + +func UnredirectWindowChecked(c *xgb.Conn, Window xproto.Window, Update byte) UnredirectWindowCookie { + cookie := c.NewCookie(true, false) + c.NewRequest(unredirectWindowRequest(c, Window, Update), cookie) + return UnredirectWindowCookie{cookie} +} + +func (cook UnredirectWindowCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for UnredirectWindow +func unredirectWindowRequest(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] = 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(Window)) + b += 4 + + buf[b] = Update + b += 1 + + b += 3 // padding + + return buf +} + +// Request UnredirectSubwindows +// size: 12 +type UnredirectSubwindowsCookie struct { + *xgb.Cookie +} + +// Write request to wire for UnredirectSubwindows +func UnredirectSubwindows(c *xgb.Conn, Window xproto.Window, Update byte) UnredirectSubwindowsCookie { + cookie := c.NewCookie(false, false) + c.NewRequest(unredirectSubwindowsRequest(c, Window, Update), cookie) + return UnredirectSubwindowsCookie{cookie} +} + +func UnredirectSubwindowsChecked(c *xgb.Conn, Window xproto.Window, Update byte) UnredirectSubwindowsCookie { + cookie := c.NewCookie(true, false) + c.NewRequest(unredirectSubwindowsRequest(c, Window, Update), cookie) + return UnredirectSubwindowsCookie{cookie} +} + +func (cook UnredirectSubwindowsCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for UnredirectSubwindows +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 +} + +// Request CreateRegionFromBorderClip +// size: 12 +type CreateRegionFromBorderClipCookie struct { + *xgb.Cookie +} + +// Write request to wire for CreateRegionFromBorderClip +func CreateRegionFromBorderClip(c *xgb.Conn, Region xfixes.Region, Window xproto.Window) CreateRegionFromBorderClipCookie { + cookie := c.NewCookie(false, false) + c.NewRequest(createRegionFromBorderClipRequest(c, Region, Window), cookie) + return CreateRegionFromBorderClipCookie{cookie} +} + +func CreateRegionFromBorderClipChecked(c *xgb.Conn, Region xfixes.Region, Window xproto.Window) CreateRegionFromBorderClipCookie { + cookie := c.NewCookie(true, false) + c.NewRequest(createRegionFromBorderClipRequest(c, Region, Window), cookie) + return CreateRegionFromBorderClipCookie{cookie} +} + +func (cook CreateRegionFromBorderClipCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for CreateRegionFromBorderClip +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 +} + +// Request NameWindowPixmap +// size: 12 +type NameWindowPixmapCookie struct { + *xgb.Cookie +} + +// Write request to wire for NameWindowPixmap +func NameWindowPixmap(c *xgb.Conn, Window xproto.Window, Pixmap xproto.Pixmap) NameWindowPixmapCookie { + cookie := c.NewCookie(false, false) + c.NewRequest(nameWindowPixmapRequest(c, Window, Pixmap), cookie) + return NameWindowPixmapCookie{cookie} +} + +func NameWindowPixmapChecked(c *xgb.Conn, Window xproto.Window, Pixmap xproto.Pixmap) NameWindowPixmapCookie { + cookie := c.NewCookie(true, false) + c.NewRequest(nameWindowPixmapRequest(c, Window, Pixmap), cookie) + return NameWindowPixmapCookie{cookie} +} + +func (cook NameWindowPixmapCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for NameWindowPixmap +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 +} + +// Request GetOverlayWindow +// size: 8 +type GetOverlayWindowCookie struct { + *xgb.Cookie +} + +func GetOverlayWindow(c *xgb.Conn, Window xproto.Window) GetOverlayWindowCookie { + cookie := c.NewCookie(true, true) + c.NewRequest(getOverlayWindowRequest(c, Window), cookie) + return GetOverlayWindowCookie{cookie} +} + +func GetOverlayWindowUnchecked(c *xgb.Conn, Window xproto.Window) GetOverlayWindowCookie { + cookie := c.NewCookie(false, true) + c.NewRequest(getOverlayWindowRequest(c, Window), cookie) + return GetOverlayWindowCookie{cookie} +} + +// Request reply for GetOverlayWindow +// size: 32 +type GetOverlayWindowReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + OverlayWin xproto.Window + // padding: 20 bytes +} + +// Waits and reads reply data from request GetOverlayWindow +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 +} + +// Read reply into structure from buffer for GetOverlayWindow +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 +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 +} + +// Request ReleaseOverlayWindow +// size: 8 +type ReleaseOverlayWindowCookie struct { + *xgb.Cookie +} + +// Write request to wire for ReleaseOverlayWindow +func ReleaseOverlayWindow(c *xgb.Conn, Window xproto.Window) ReleaseOverlayWindowCookie { + cookie := c.NewCookie(false, false) + c.NewRequest(releaseOverlayWindowRequest(c, Window), cookie) + return ReleaseOverlayWindowCookie{cookie} +} + +func ReleaseOverlayWindowChecked(c *xgb.Conn, Window xproto.Window) ReleaseOverlayWindowCookie { + cookie := c.NewCookie(true, false) + c.NewRequest(releaseOverlayWindowRequest(c, Window), cookie) + return ReleaseOverlayWindowCookie{cookie} +} + +func (cook ReleaseOverlayWindowCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for ReleaseOverlayWindow +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 +} -- cgit v1.2.3 From a3363755cdfdafdf02d5a772bd47a462e99af057 Mon Sep 17 00:00:00 2001 From: "Andrew Gallant (Ocelot)" Date: Thu, 10 May 2012 20:06:22 -0400 Subject: adding package header comments --- nexgb/composite/composite.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'nexgb/composite') diff --git a/nexgb/composite/composite.go b/nexgb/composite/composite.go index 266c087..5a3d7c4 100644 --- a/nexgb/composite/composite.go +++ b/nexgb/composite/composite.go @@ -1,7 +1,8 @@ +// Package composite is the X client API for the Composite extension. package composite /* - This file was generated by composite.xml on May 10 2012 4:20:27pm EDT. + This file was generated by composite.xml on May 10 2012 8:04:31pm EDT. This file is automatically generated. Edit at your peril! */ -- cgit v1.2.3 From c00652934e4ec68016a152b9bea10273b0be8726 Mon Sep 17 00:00:00 2001 From: "Andrew Gallant (Ocelot)" Date: Thu, 10 May 2012 23:57:34 -0400 Subject: better docs --- nexgb/composite/composite.go | 137 ++++++++++++++++++++++++++++--------------- 1 file changed, 89 insertions(+), 48 deletions(-) (limited to 'nexgb/composite') diff --git a/nexgb/composite/composite.go b/nexgb/composite/composite.go index 5a3d7c4..be56807 100644 --- a/nexgb/composite/composite.go +++ b/nexgb/composite/composite.go @@ -2,7 +2,7 @@ package composite /* - This file was generated by composite.xml on May 10 2012 8:04:31pm EDT. + This file was generated by composite.xml on May 10 2012 11:56:18pm EDT. This file is automatically generated. Edit at your peril! */ @@ -41,16 +41,6 @@ func init() { xgb.NewExtErrorFuncs["Composite"] = 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' @@ -65,41 +55,53 @@ func init() { // 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 ( RedirectAutomatic = 0 RedirectManual = 1 ) -// Request QueryVersion -// size: 12 +// 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 { 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 { cookie := c.NewCookie(false, true) c.NewRequest(queryVersionRequest(c, ClientMajorVersion, ClientMinorVersion), cookie) return QueryVersionCookie{cookie} } -// Request reply for QueryVersion -// size: 32 +// QueryVersionReply represents the data returned from a QueryVersion request. type QueryVersionReply struct { - Sequence uint16 - Length uint32 + 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 } -// Waits and reads reply data from request QueryVersion +// 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 { @@ -111,7 +113,7 @@ func (cook QueryVersionCookie) Reply() (*QueryVersionReply, error) { return queryVersionReply(buf), nil } -// Read reply into structure from buffer for QueryVersion +// queryVersionReply reads a byte slice into a QueryVersionReply value. func queryVersionReply(buf []byte) *QueryVersionReply { v := new(QueryVersionReply) b := 1 // skip reply determinant @@ -136,6 +138,7 @@ func queryVersionReply(buf []byte) *QueryVersionReply { } // 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 @@ -159,30 +162,35 @@ func queryVersionRequest(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVers return buf } -// Request RedirectWindow -// size: 12 +// RedirectWindowCookie is a cookie used only for RedirectWindow requests. type RedirectWindowCookie struct { *xgb.Cookie } -// Write request to wire for RedirectWindow +// RedirectWindow sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func RedirectWindow(c *xgb.Conn, Window xproto.Window, Update byte) RedirectWindowCookie { cookie := c.NewCookie(false, false) c.NewRequest(redirectWindowRequest(c, Window, Update), cookie) return RedirectWindowCookie{cookie} } +// RedirectWindowChecked sends a checked request. +// If an error occurs, it can be retrieved using RedirectWindowCookie.Check() func RedirectWindowChecked(c *xgb.Conn, Window xproto.Window, Update byte) RedirectWindowCookie { cookie := c.NewCookie(true, false) c.NewRequest(redirectWindowRequest(c, Window, Update), cookie) return RedirectWindowCookie{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 RedirectWindowCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for RedirectWindow +// redirectWindowRequest writes a RedirectWindow request to a byte slice. func redirectWindowRequest(c *xgb.Conn, Window xproto.Window, Update byte) []byte { size := 12 b := 0 @@ -208,30 +216,35 @@ func redirectWindowRequest(c *xgb.Conn, Window xproto.Window, Update byte) []byt return buf } -// Request RedirectSubwindows -// size: 12 +// RedirectSubwindowsCookie is a cookie used only for RedirectSubwindows requests. type RedirectSubwindowsCookie struct { *xgb.Cookie } -// Write request to wire for RedirectSubwindows +// 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 { 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 { 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 @@ -257,30 +270,35 @@ func redirectSubwindowsRequest(c *xgb.Conn, Window xproto.Window, Update byte) [ return buf } -// Request UnredirectWindow -// size: 12 +// UnredirectWindowCookie is a cookie used only for UnredirectWindow requests. type UnredirectWindowCookie struct { *xgb.Cookie } -// Write request to wire for UnredirectWindow +// UnredirectWindow sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func UnredirectWindow(c *xgb.Conn, Window xproto.Window, Update byte) UnredirectWindowCookie { cookie := c.NewCookie(false, false) c.NewRequest(unredirectWindowRequest(c, Window, Update), cookie) return UnredirectWindowCookie{cookie} } +// UnredirectWindowChecked sends a checked request. +// If an error occurs, it can be retrieved using UnredirectWindowCookie.Check() func UnredirectWindowChecked(c *xgb.Conn, Window xproto.Window, Update byte) UnredirectWindowCookie { cookie := c.NewCookie(true, false) c.NewRequest(unredirectWindowRequest(c, Window, Update), cookie) return UnredirectWindowCookie{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 UnredirectWindowCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for UnredirectWindow +// unredirectWindowRequest writes a UnredirectWindow request to a byte slice. func unredirectWindowRequest(c *xgb.Conn, Window xproto.Window, Update byte) []byte { size := 12 b := 0 @@ -306,30 +324,35 @@ func unredirectWindowRequest(c *xgb.Conn, Window xproto.Window, Update byte) []b return buf } -// Request UnredirectSubwindows -// size: 12 +// UnredirectSubwindowsCookie is a cookie used only for UnredirectSubwindows requests. type UnredirectSubwindowsCookie struct { *xgb.Cookie } -// Write request to wire for UnredirectSubwindows +// 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 { 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 { 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 @@ -355,30 +378,35 @@ func unredirectSubwindowsRequest(c *xgb.Conn, Window xproto.Window, Update byte) return buf } -// Request CreateRegionFromBorderClip -// size: 12 +// CreateRegionFromBorderClipCookie is a cookie used only for CreateRegionFromBorderClip requests. type CreateRegionFromBorderClipCookie struct { *xgb.Cookie } -// Write request to wire for CreateRegionFromBorderClip +// 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 { 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 { 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 @@ -402,30 +430,35 @@ func createRegionFromBorderClipRequest(c *xgb.Conn, Region xfixes.Region, Window return buf } -// Request NameWindowPixmap -// size: 12 +// NameWindowPixmapCookie is a cookie used only for NameWindowPixmap requests. type NameWindowPixmapCookie struct { *xgb.Cookie } -// Write request to wire for NameWindowPixmap +// 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 { 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 { 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 @@ -449,35 +482,37 @@ func nameWindowPixmapRequest(c *xgb.Conn, Window xproto.Window, Pixmap xproto.Pi return buf } -// Request GetOverlayWindow -// size: 8 +// 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 { 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 { cookie := c.NewCookie(false, true) c.NewRequest(getOverlayWindowRequest(c, Window), cookie) return GetOverlayWindowCookie{cookie} } -// Request reply for GetOverlayWindow -// size: 32 +// GetOverlayWindowReply represents the data returned from a GetOverlayWindow request. type GetOverlayWindowReply struct { - Sequence uint16 - Length uint32 + 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 } -// Waits and reads reply data from request GetOverlayWindow +// 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 { @@ -489,7 +524,7 @@ func (cook GetOverlayWindowCookie) Reply() (*GetOverlayWindowReply, error) { return getOverlayWindowReply(buf), nil } -// Read reply into structure from buffer for GetOverlayWindow +// getOverlayWindowReply reads a byte slice into a GetOverlayWindowReply value. func getOverlayWindowReply(buf []byte) *GetOverlayWindowReply { v := new(GetOverlayWindowReply) b := 1 // skip reply determinant @@ -511,6 +546,7 @@ func getOverlayWindowReply(buf []byte) *GetOverlayWindowReply { } // 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 @@ -531,30 +567,35 @@ func getOverlayWindowRequest(c *xgb.Conn, Window xproto.Window) []byte { return buf } -// Request ReleaseOverlayWindow -// size: 8 +// ReleaseOverlayWindowCookie is a cookie used only for ReleaseOverlayWindow requests. type ReleaseOverlayWindowCookie struct { *xgb.Cookie } -// Write request to wire for ReleaseOverlayWindow +// 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 { 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 { 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 -- cgit v1.2.3 From 3e6b3544934cb71e3a3b0edf9bc184241ac1ad7f Mon Sep 17 00:00:00 2001 From: "Andrew Gallant (Ocelot)" Date: Fri, 11 May 2012 01:58:52 -0400 Subject: add a little more docs for errors --- nexgb/composite/composite.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'nexgb/composite') diff --git a/nexgb/composite/composite.go b/nexgb/composite/composite.go index be56807..4217736 100644 --- a/nexgb/composite/composite.go +++ b/nexgb/composite/composite.go @@ -2,7 +2,7 @@ package composite /* - This file was generated by composite.xml on May 10 2012 11:56:18pm EDT. + This file was generated by composite.xml on May 11 2012 1:58:35am EDT. This file is automatically generated. Edit at your peril! */ @@ -41,8 +41,6 @@ func init() { xgb.NewExtErrorFuncs["Composite"] = make(map[int]xgb.NewErrorFun) } -// Skipping definition for base type 'Int8' - // Skipping definition for base type 'Card16' // Skipping definition for base type 'Char' @@ -65,6 +63,8 @@ func init() { // Skipping definition for base type 'Byte' +// Skipping definition for base type 'Int8' + const ( RedirectAutomatic = 0 RedirectManual = 1 -- cgit v1.2.3 From 29942bf078c92fea681e42ca5029592526f00718 Mon Sep 17 00:00:00 2001 From: "Andrew Gallant (Ocelot)" Date: Fri, 11 May 2012 23:58:52 -0400 Subject: panic when an extension request is issued before an extension has been initialized. but give a nice error message for the happy people. --- nexgb/composite/composite.go | 76 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 65 insertions(+), 11 deletions(-) (limited to 'nexgb/composite') diff --git a/nexgb/composite/composite.go b/nexgb/composite/composite.go index 4217736..68e8dbe 100644 --- a/nexgb/composite/composite.go +++ b/nexgb/composite/composite.go @@ -2,7 +2,7 @@ package composite /* - This file was generated by composite.xml on May 11 2012 1:58:35am EDT. + This file was generated by composite.xml on May 11 2012 11:57:18pm EDT. This file is automatically generated. Edit at your peril! */ @@ -41,6 +41,16 @@ func init() { xgb.NewExtErrorFuncs["Composite"] = make(map[int]xgb.NewErrorFun) } +// Skipping definition for base type 'Int16' + +// Skipping definition for base type 'Int32' + +// Skipping definition for base type 'Void' + +// Skipping definition for base type 'Byte' + +// Skipping definition for base type 'Int8' + // Skipping definition for base type 'Card16' // Skipping definition for base type 'Char' @@ -55,16 +65,6 @@ func init() { // 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' - const ( RedirectAutomatic = 0 RedirectManual = 1 @@ -78,6 +78,9 @@ type QueryVersionCookie struct { // 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["COMPOSITE"]; !ok { + panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(queryVersionRequest(c, ClientMajorVersion, ClientMinorVersion), cookie) return QueryVersionCookie{cookie} @@ -86,6 +89,9 @@ func QueryVersion(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVersion uin // 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["COMPOSITE"]; !ok { + panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(queryVersionRequest(c, ClientMajorVersion, ClientMinorVersion), cookie) return QueryVersionCookie{cookie} @@ -170,6 +176,9 @@ type RedirectWindowCookie struct { // RedirectWindow sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func RedirectWindow(c *xgb.Conn, Window xproto.Window, Update byte) RedirectWindowCookie { + if _, ok := c.Extensions["COMPOSITE"]; !ok { + panic("Cannot issue request 'RedirectWindow' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(redirectWindowRequest(c, Window, Update), cookie) return RedirectWindowCookie{cookie} @@ -178,6 +187,9 @@ func RedirectWindow(c *xgb.Conn, Window xproto.Window, Update byte) RedirectWind // RedirectWindowChecked sends a checked request. // If an error occurs, it can be retrieved using RedirectWindowCookie.Check() func RedirectWindowChecked(c *xgb.Conn, Window xproto.Window, Update byte) RedirectWindowCookie { + if _, ok := c.Extensions["COMPOSITE"]; !ok { + panic("Cannot issue request 'RedirectWindow' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(redirectWindowRequest(c, Window, Update), cookie) return RedirectWindowCookie{cookie} @@ -224,6 +236,9 @@ type RedirectSubwindowsCookie struct { // 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} @@ -232,6 +247,9 @@ func RedirectSubwindows(c *xgb.Conn, Window xproto.Window, Update byte) Redirect // 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} @@ -278,6 +296,9 @@ type UnredirectWindowCookie struct { // UnredirectWindow sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func UnredirectWindow(c *xgb.Conn, Window xproto.Window, Update byte) UnredirectWindowCookie { + if _, ok := c.Extensions["COMPOSITE"]; !ok { + panic("Cannot issue request 'UnredirectWindow' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(unredirectWindowRequest(c, Window, Update), cookie) return UnredirectWindowCookie{cookie} @@ -286,6 +307,9 @@ func UnredirectWindow(c *xgb.Conn, Window xproto.Window, Update byte) Unredirect // UnredirectWindowChecked sends a checked request. // If an error occurs, it can be retrieved using UnredirectWindowCookie.Check() func UnredirectWindowChecked(c *xgb.Conn, Window xproto.Window, Update byte) UnredirectWindowCookie { + if _, ok := c.Extensions["COMPOSITE"]; !ok { + panic("Cannot issue request 'UnredirectWindow' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(unredirectWindowRequest(c, Window, Update), cookie) return UnredirectWindowCookie{cookie} @@ -332,6 +356,9 @@ type UnredirectSubwindowsCookie struct { // 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} @@ -340,6 +367,9 @@ func UnredirectSubwindows(c *xgb.Conn, Window xproto.Window, Update byte) Unredi // 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} @@ -386,6 +416,9 @@ type CreateRegionFromBorderClipCookie struct { // 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} @@ -394,6 +427,9 @@ func CreateRegionFromBorderClip(c *xgb.Conn, Region xfixes.Region, Window xproto // 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} @@ -438,6 +474,9 @@ type NameWindowPixmapCookie struct { // 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} @@ -446,6 +485,9 @@ func NameWindowPixmap(c *xgb.Conn, Window xproto.Window, Pixmap xproto.Pixmap) N // 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} @@ -490,6 +532,9 @@ type GetOverlayWindowCookie struct { // 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} @@ -498,6 +543,9 @@ func GetOverlayWindow(c *xgb.Conn, Window xproto.Window) GetOverlayWindowCookie // 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} @@ -575,6 +623,9 @@ type ReleaseOverlayWindowCookie struct { // 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} @@ -583,6 +634,9 @@ func ReleaseOverlayWindow(c *xgb.Conn, Window xproto.Window) ReleaseOverlayWindo // 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} -- cgit v1.2.3 From 4ea94ca0fef7786ce21722cbb02a9cf069bdedd9 Mon Sep 17 00:00:00 2001 From: "Andrew Gallant (Ocelot)" Date: Sat, 26 May 2012 18:24:52 -0400 Subject: Bug fix in the generator that was outputting %(MISSING) crud. --- nexgb/composite/composite.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'nexgb/composite') diff --git a/nexgb/composite/composite.go b/nexgb/composite/composite.go index 68e8dbe..b188544 100644 --- a/nexgb/composite/composite.go +++ b/nexgb/composite/composite.go @@ -2,7 +2,7 @@ package composite /* - This file was generated by composite.xml on May 11 2012 11:57:18pm EDT. + This file was generated by composite.xml on May 26 2012 6:23:12pm EDT. This file is automatically generated. Edit at your peril! */ @@ -41,6 +41,10 @@ func init() { xgb.NewExtErrorFuncs["Composite"] = make(map[int]xgb.NewErrorFun) } +// Skipping definition for base type 'Float' + +// Skipping definition for base type 'Card8' + // Skipping definition for base type 'Int16' // Skipping definition for base type 'Int32' @@ -61,10 +65,6 @@ func init() { // Skipping definition for base type 'Bool' -// Skipping definition for base type 'Float' - -// Skipping definition for base type 'Card8' - const ( RedirectAutomatic = 0 RedirectManual = 1 -- cgit v1.2.3 From a9eae45cb3977bce5983e817d00d4584d176b044 Mon Sep 17 00:00:00 2001 From: "Andrew Gallant (Ocelot)" Date: Tue, 5 Jun 2012 00:14:34 -0400 Subject: Refresh build. Eh. --- nexgb/composite/composite.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'nexgb/composite') diff --git a/nexgb/composite/composite.go b/nexgb/composite/composite.go index b188544..d1f19b9 100644 --- a/nexgb/composite/composite.go +++ b/nexgb/composite/composite.go @@ -2,7 +2,7 @@ package composite /* - This file was generated by composite.xml on May 26 2012 6:23:12pm EDT. + This file was generated by composite.xml on Jun 5 2012 12:11:58am EDT. This file is automatically generated. Edit at your peril! */ @@ -41,12 +41,6 @@ func init() { xgb.NewExtErrorFuncs["Composite"] = make(map[int]xgb.NewErrorFun) } -// 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' @@ -65,6 +59,12 @@ func init() { // Skipping definition for base type 'Bool' +// Skipping definition for base type 'Float' + +// Skipping definition for base type 'Card8' + +// Skipping definition for base type 'Int16' + const ( RedirectAutomatic = 0 RedirectManual = 1 -- cgit v1.2.3 From 0685fb57e14104ee4ad9f70ec94f787a9a22c028 Mon Sep 17 00:00:00 2001 From: Andrew Gallant Date: Sun, 11 Aug 2013 20:43:26 -0400 Subject: Update to latest xproto XML. --- nexgb/composite/composite.go | 584 +++++++++++++++++++++---------------------- 1 file changed, 292 insertions(+), 292 deletions(-) (limited to 'nexgb/composite') diff --git a/nexgb/composite/composite.go b/nexgb/composite/composite.go index d1f19b9..de1b773 100644 --- a/nexgb/composite/composite.go +++ b/nexgb/composite/composite.go @@ -2,7 +2,7 @@ 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! */ @@ -41,74 +41,131 @@ func init() { xgb.NewExtErrorFuncs["Composite"] = make(map[int]xgb.NewErrorFun) } -// Skipping definition for base type 'Int32' +const ( + RedirectAutomatic = 0 + RedirectManual = 1 +) -// Skipping definition for base type 'Void' +// 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 'Char' - // 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 ( - RedirectAutomatic = 0 - RedirectManual = 1 -) + buf[b] = c.Extensions["COMPOSITE"] + b += 1 -// QueryVersionCookie is a cookie used only for QueryVersion requests. -type QueryVersionCookie struct { + 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 } -// 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 { +// 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 'QueryVersion' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") + panic("Cannot issue request 'GetOverlayWindow' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") } cookie := c.NewCookie(true, true) - c.NewRequest(queryVersionRequest(c, ClientMajorVersion, ClientMinorVersion), cookie) - return QueryVersionCookie{cookie} + c.NewRequest(getOverlayWindowRequest(c, Window), cookie) + return GetOverlayWindowCookie{cookie} } -// QueryVersionUnchecked sends an unchecked request. +// GetOverlayWindowUnchecked 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 { +func GetOverlayWindowUnchecked(c *xgb.Conn, Window xproto.Window) GetOverlayWindowCookie { if _, ok := c.Extensions["COMPOSITE"]; !ok { - panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") + panic("Cannot issue request 'GetOverlayWindow' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") } cookie := c.NewCookie(false, true) - c.NewRequest(queryVersionRequest(c, ClientMajorVersion, ClientMinorVersion), cookie) - return QueryVersionCookie{cookie} + c.NewRequest(getOverlayWindowRequest(c, Window), cookie) + return GetOverlayWindowCookie{cookie} } -// QueryVersionReply represents the data returned from a QueryVersion request. -type QueryVersionReply struct { +// 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 - MajorVersion uint32 - MinorVersion uint32 - // padding: 16 bytes + OverlayWin xproto.Window + // padding: 20 bytes } -// Reply blocks and returns the reply data for a QueryVersion request. -func (cook QueryVersionCookie) Reply() (*QueryVersionReply, error) { +// 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 @@ -116,12 +173,12 @@ func (cook QueryVersionCookie) Reply() (*QueryVersionReply, error) { if buf == nil { return nil, nil } - return queryVersionReply(buf), nil + return getOverlayWindowReply(buf), nil } -// queryVersionReply reads a byte slice into a QueryVersionReply value. -func queryVersionReply(buf []byte) *QueryVersionReply { - v := new(QueryVersionReply) +// 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 @@ -132,78 +189,72 @@ func queryVersionReply(buf []byte) *QueryVersionReply { 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:]) + v.OverlayWin = xproto.Window(xgb.Get32(buf[b:])) b += 4 - b += 16 // padding + 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 uint32, ClientMinorVersion uint32) []byte { - size := 12 +// 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] = 0 // request opcode + 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:], ClientMajorVersion) - b += 4 - - xgb.Put32(buf[b:], ClientMinorVersion) + xgb.Put32(buf[b:], uint32(Window)) b += 4 return buf } -// RedirectWindowCookie is a cookie used only for RedirectWindow requests. -type RedirectWindowCookie struct { +// NameWindowPixmapCookie is a cookie used only for NameWindowPixmap requests. +type NameWindowPixmapCookie struct { *xgb.Cookie } -// RedirectWindow sends an unchecked request. +// NameWindowPixmap sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. -func RedirectWindow(c *xgb.Conn, Window xproto.Window, Update byte) RedirectWindowCookie { +func NameWindowPixmap(c *xgb.Conn, Window xproto.Window, Pixmap xproto.Pixmap) NameWindowPixmapCookie { if _, ok := c.Extensions["COMPOSITE"]; !ok { - panic("Cannot issue request 'RedirectWindow' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") + panic("Cannot issue request 'NameWindowPixmap' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") } cookie := c.NewCookie(false, false) - c.NewRequest(redirectWindowRequest(c, Window, Update), cookie) - return RedirectWindowCookie{cookie} + c.NewRequest(nameWindowPixmapRequest(c, Window, Pixmap), cookie) + return NameWindowPixmapCookie{cookie} } -// RedirectWindowChecked sends a checked request. -// If an error occurs, it can be retrieved using RedirectWindowCookie.Check() -func RedirectWindowChecked(c *xgb.Conn, Window xproto.Window, Update byte) RedirectWindowCookie { +// 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 'RedirectWindow' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") + panic("Cannot issue request 'NameWindowPixmap' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") } cookie := c.NewCookie(true, false) - c.NewRequest(redirectWindowRequest(c, Window, Update), cookie) - return RedirectWindowCookie{cookie} + 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 RedirectWindowCookie) Check() error { +func (cook NameWindowPixmapCookie) Check() error { return cook.Cookie.Check() } -// Write request to wire for RedirectWindow -// redirectWindowRequest writes a RedirectWindow request to a byte slice. -func redirectWindowRequest(c *xgb.Conn, Window xproto.Window, Update byte) []byte { +// 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) @@ -211,7 +262,7 @@ func redirectWindowRequest(c *xgb.Conn, Window xproto.Window, Update byte) []byt buf[b] = c.Extensions["COMPOSITE"] b += 1 - buf[b] = 1 // request opcode + buf[b] = 6 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units @@ -220,110 +271,88 @@ func redirectWindowRequest(c *xgb.Conn, Window xproto.Window, Update byte) []byt xgb.Put32(buf[b:], uint32(Window)) b += 4 - buf[b] = Update - b += 1 - - b += 3 // padding + xgb.Put32(buf[b:], uint32(Pixmap)) + b += 4 return buf } -// RedirectSubwindowsCookie is a cookie used only for RedirectSubwindows requests. -type RedirectSubwindowsCookie struct { +// QueryVersionCookie is a cookie used only for QueryVersion requests. +type QueryVersionCookie 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 { +// 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["COMPOSITE"]; !ok { - panic("Cannot issue request 'RedirectSubwindows' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") + panic("Cannot issue request 'QueryVersion' 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} + cookie := c.NewCookie(true, true) + c.NewRequest(queryVersionRequest(c, ClientMajorVersion, ClientMinorVersion), cookie) + return QueryVersionCookie{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 { +// 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["COMPOSITE"]; !ok { - panic("Cannot issue request 'RedirectSubwindows' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") + panic("Cannot issue request 'QueryVersion' 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} + cookie := c.NewCookie(false, true) + c.NewRequest(queryVersionRequest(c, ClientMajorVersion, ClientMinorVersion), cookie) + return QueryVersionCookie{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() +// 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 } -// 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) +// 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 +} - buf[b] = c.Extensions["COMPOSITE"] - b += 1 +// queryVersionReply reads a byte slice into a QueryVersionReply value. +func queryVersionReply(buf []byte) *QueryVersionReply { + v := new(QueryVersionReply) + b := 1 // skip reply determinant - buf[b] = 2 // request opcode - b += 1 + b += 1 // padding - xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + v.Sequence = xgb.Get16(buf[b:]) b += 2 - xgb.Put32(buf[b:], uint32(Window)) + v.Length = xgb.Get32(buf[b:]) // 4-byte units b += 4 - buf[b] = Update - b += 1 - - b += 3 // padding - - return buf -} - -// UnredirectWindowCookie is a cookie used only for UnredirectWindow requests. -type UnredirectWindowCookie struct { - *xgb.Cookie -} + v.MajorVersion = xgb.Get32(buf[b:]) + b += 4 -// UnredirectWindow sends an unchecked request. -// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. -func UnredirectWindow(c *xgb.Conn, Window xproto.Window, Update byte) UnredirectWindowCookie { - if _, ok := c.Extensions["COMPOSITE"]; !ok { - panic("Cannot issue request 'UnredirectWindow' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") - } - cookie := c.NewCookie(false, false) - c.NewRequest(unredirectWindowRequest(c, Window, Update), cookie) - return UnredirectWindowCookie{cookie} -} + v.MinorVersion = xgb.Get32(buf[b:]) + b += 4 -// UnredirectWindowChecked sends a checked request. -// If an error occurs, it can be retrieved using UnredirectWindowCookie.Check() -func UnredirectWindowChecked(c *xgb.Conn, Window xproto.Window, Update byte) UnredirectWindowCookie { - if _, ok := c.Extensions["COMPOSITE"]; !ok { - panic("Cannot issue request 'UnredirectWindow' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") - } - cookie := c.NewCookie(true, false) - c.NewRequest(unredirectWindowRequest(c, Window, Update), cookie) - return UnredirectWindowCookie{cookie} -} + b += 16 // padding -// 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 UnredirectWindowCookie) Check() error { - return cook.Cookie.Check() + return v } -// Write request to wire for UnredirectWindow -// unredirectWindowRequest writes a UnredirectWindow request to a byte slice. -func unredirectWindowRequest(c *xgb.Conn, Window xproto.Window, Update byte) []byte { +// 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) @@ -331,59 +360,57 @@ func unredirectWindowRequest(c *xgb.Conn, Window xproto.Window, Update byte) []b buf[b] = c.Extensions["COMPOSITE"] b += 1 - buf[b] = 3 // request opcode + 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:], uint32(Window)) + xgb.Put32(buf[b:], ClientMajorVersion) b += 4 - buf[b] = Update - b += 1 - - b += 3 // padding + xgb.Put32(buf[b:], ClientMinorVersion) + b += 4 return buf } -// UnredirectSubwindowsCookie is a cookie used only for UnredirectSubwindows requests. -type UnredirectSubwindowsCookie struct { +// RedirectSubwindowsCookie is a cookie used only for RedirectSubwindows requests. +type RedirectSubwindowsCookie struct { *xgb.Cookie } -// UnredirectSubwindows sends an unchecked request. +// RedirectSubwindows 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 { +func RedirectSubwindows(c *xgb.Conn, Window xproto.Window, Update byte) RedirectSubwindowsCookie { if _, ok := c.Extensions["COMPOSITE"]; !ok { - panic("Cannot issue request 'UnredirectSubwindows' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") + panic("Cannot issue request 'RedirectSubwindows' 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} + c.NewRequest(redirectSubwindowsRequest(c, Window, Update), cookie) + return RedirectSubwindowsCookie{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 { +// 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 'UnredirectSubwindows' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") + panic("Cannot issue request 'RedirectSubwindows' 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} + 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 UnredirectSubwindowsCookie) Check() error { +func (cook RedirectSubwindowsCookie) 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 { +// 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) @@ -391,7 +418,7 @@ func unredirectSubwindowsRequest(c *xgb.Conn, Window xproto.Window, Update byte) buf[b] = c.Extensions["COMPOSITE"] b += 1 - buf[b] = 4 // request opcode + buf[b] = 2 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units @@ -408,42 +435,42 @@ func unredirectSubwindowsRequest(c *xgb.Conn, Window xproto.Window, Update byte) return buf } -// CreateRegionFromBorderClipCookie is a cookie used only for CreateRegionFromBorderClip requests. -type CreateRegionFromBorderClipCookie struct { +// RedirectWindowCookie is a cookie used only for RedirectWindow requests. +type RedirectWindowCookie struct { *xgb.Cookie } -// CreateRegionFromBorderClip sends an unchecked request. +// RedirectWindow 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 { +func RedirectWindow(c *xgb.Conn, Window xproto.Window, Update byte) RedirectWindowCookie { if _, ok := c.Extensions["COMPOSITE"]; !ok { - panic("Cannot issue request 'CreateRegionFromBorderClip' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") + panic("Cannot issue request 'RedirectWindow' 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} + c.NewRequest(redirectWindowRequest(c, Window, Update), cookie) + return RedirectWindowCookie{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 { +// RedirectWindowChecked sends a checked request. +// If an error occurs, it can be retrieved using RedirectWindowCookie.Check() +func RedirectWindowChecked(c *xgb.Conn, Window xproto.Window, Update byte) RedirectWindowCookie { if _, ok := c.Extensions["COMPOSITE"]; !ok { - panic("Cannot issue request 'CreateRegionFromBorderClip' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") + panic("Cannot issue request 'RedirectWindow' 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} + c.NewRequest(redirectWindowRequest(c, Window, Update), cookie) + return RedirectWindowCookie{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 { +func (cook RedirectWindowCookie) 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 { +// Write request to wire for RedirectWindow +// redirectWindowRequest writes a RedirectWindow request to a byte slice. +func redirectWindowRequest(c *xgb.Conn, Window xproto.Window, Update byte) []byte { size := 12 b := 0 buf := make([]byte, size) @@ -451,65 +478,67 @@ func createRegionFromBorderClipRequest(c *xgb.Conn, Region xfixes.Region, Window buf[b] = c.Extensions["COMPOSITE"] b += 1 - buf[b] = 5 // request opcode + 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(Region)) - b += 4 - xgb.Put32(buf[b:], uint32(Window)) b += 4 + buf[b] = Update + b += 1 + + b += 3 // padding + return buf } -// NameWindowPixmapCookie is a cookie used only for NameWindowPixmap requests. -type NameWindowPixmapCookie struct { +// ReleaseOverlayWindowCookie is a cookie used only for ReleaseOverlayWindow requests. +type ReleaseOverlayWindowCookie struct { *xgb.Cookie } -// NameWindowPixmap sends an unchecked request. +// ReleaseOverlayWindow 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 { +func ReleaseOverlayWindow(c *xgb.Conn, Window xproto.Window) ReleaseOverlayWindowCookie { if _, ok := c.Extensions["COMPOSITE"]; !ok { - panic("Cannot issue request 'NameWindowPixmap' 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) - c.NewRequest(nameWindowPixmapRequest(c, Window, Pixmap), cookie) - return NameWindowPixmapCookie{cookie} + c.NewRequest(releaseOverlayWindowRequest(c, Window), cookie) + return ReleaseOverlayWindowCookie{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 { +// 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 'NameWindowPixmap' 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) - c.NewRequest(nameWindowPixmapRequest(c, Window, Pixmap), cookie) - return NameWindowPixmapCookie{cookie} + 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 NameWindowPixmapCookie) Check() error { +func (cook ReleaseOverlayWindowCookie) 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 +// 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] = 6 // request opcode + buf[b] = 8 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units @@ -518,92 +547,53 @@ func nameWindowPixmapRequest(c *xgb.Conn, Window xproto.Window, Pixmap xproto.Pi 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 { +// UnredirectSubwindowsCookie is a cookie used only for UnredirectSubwindows requests. +type UnredirectSubwindowsCookie 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. +// UnredirectSubwindows 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 { +func UnredirectSubwindows(c *xgb.Conn, Window xproto.Window, Update byte) UnredirectSubwindowsCookie { if _, ok := c.Extensions["COMPOSITE"]; !ok { - panic("Cannot issue request 'GetOverlayWindow' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") + panic("Cannot issue request 'UnredirectSubwindows' 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 + cookie := c.NewCookie(false, false) + c.NewRequest(unredirectSubwindowsRequest(c, Window, Update), cookie) + return UnredirectSubwindowsCookie{cookie} } -// 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 +// 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.") } - return getOverlayWindowReply(buf), nil + cookie := c.NewCookie(true, false) + c.NewRequest(unredirectSubwindowsRequest(c, Window, Update), cookie) + return UnredirectSubwindowsCookie{cookie} } -// 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 +// 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 GetOverlayWindow -// getOverlayWindowRequest writes a GetOverlayWindow request to a byte slice. -func getOverlayWindowRequest(c *xgb.Conn, Window xproto.Window) []byte { - size := 8 +// 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] = 7 // request opcode + buf[b] = 4 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units @@ -612,53 +602,58 @@ func getOverlayWindowRequest(c *xgb.Conn, Window xproto.Window) []byte { xgb.Put32(buf[b:], uint32(Window)) b += 4 + buf[b] = Update + b += 1 + + b += 3 // padding + return buf } -// ReleaseOverlayWindowCookie is a cookie used only for ReleaseOverlayWindow requests. -type ReleaseOverlayWindowCookie struct { +// UnredirectWindowCookie is a cookie used only for UnredirectWindow requests. +type UnredirectWindowCookie struct { *xgb.Cookie } -// ReleaseOverlayWindow sends an unchecked request. +// UnredirectWindow 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 { +func UnredirectWindow(c *xgb.Conn, Window xproto.Window, Update byte) UnredirectWindowCookie { if _, ok := c.Extensions["COMPOSITE"]; !ok { - panic("Cannot issue request 'ReleaseOverlayWindow' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") + panic("Cannot issue request 'UnredirectWindow' 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} + c.NewRequest(unredirectWindowRequest(c, Window, Update), cookie) + return UnredirectWindowCookie{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 { +// UnredirectWindowChecked sends a checked request. +// If an error occurs, it can be retrieved using UnredirectWindowCookie.Check() +func UnredirectWindowChecked(c *xgb.Conn, Window xproto.Window, Update byte) UnredirectWindowCookie { if _, ok := c.Extensions["COMPOSITE"]; !ok { - panic("Cannot issue request 'ReleaseOverlayWindow' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") + panic("Cannot issue request 'UnredirectWindow' 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} + c.NewRequest(unredirectWindowRequest(c, Window, Update), cookie) + return UnredirectWindowCookie{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 { +func (cook UnredirectWindowCookie) 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 +// Write request to wire for UnredirectWindow +// unredirectWindowRequest writes a UnredirectWindow request to a byte slice. +func unredirectWindowRequest(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] = 8 // request opcode + buf[b] = 3 // request opcode b += 1 xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units @@ -667,5 +662,10 @@ func releaseOverlayWindowRequest(c *xgb.Conn, Window xproto.Window) []byte { xgb.Put32(buf[b:], uint32(Window)) b += 4 + buf[b] = Update + b += 1 + + b += 3 // padding + return buf } -- cgit v1.2.3 From b06a8ca97625c1134449c3af65d9ac3fb251a613 Mon Sep 17 00:00:00 2001 From: Andrew Gallant Date: Sun, 11 Aug 2013 20:45:36 -0400 Subject: Don't needlessly change source files every time. --- nexgb/composite/composite.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'nexgb/composite') diff --git a/nexgb/composite/composite.go b/nexgb/composite/composite.go index de1b773..c951a69 100644 --- a/nexgb/composite/composite.go +++ b/nexgb/composite/composite.go @@ -1,10 +1,7 @@ // Package composite is the X client API for the Composite extension. package composite -/* - 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 from composite.xml. Edit at your peril! import ( "github.com/BurntSushi/xgb" -- cgit v1.2.3 From 76f9adb5991081e27ebc6eec82db6bdba36c910f Mon Sep 17 00:00:00 2001 From: Andrew Gallant Date: Sat, 28 Dec 2013 10:13:20 -0500 Subject: Use consistent extension names. Close #6. --- nexgb/composite/composite.go | 54 ++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 27 deletions(-) (limited to 'nexgb/composite') diff --git a/nexgb/composite/composite.go b/nexgb/composite/composite.go index c951a69..b7ce2ad 100644 --- a/nexgb/composite/composite.go +++ b/nexgb/composite/composite.go @@ -75,7 +75,7 @@ type CreateRegionFromBorderClipCookie struct { // 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 { + 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) @@ -86,7 +86,7 @@ func CreateRegionFromBorderClip(c *xgb.Conn, Region xfixes.Region, Window xproto // 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 { + 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) @@ -107,7 +107,7 @@ func createRegionFromBorderClipRequest(c *xgb.Conn, Region xfixes.Region, Window b := 0 buf := make([]byte, size) - buf[b] = c.Extensions["COMPOSITE"] + buf[b] = c.Extensions["Composite"] b += 1 buf[b] = 5 // request opcode @@ -133,7 +133,7 @@ type GetOverlayWindowCookie struct { // 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 { + 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) @@ -144,7 +144,7 @@ func GetOverlayWindow(c *xgb.Conn, Window xproto.Window) GetOverlayWindowCookie // 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 { + 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) @@ -201,7 +201,7 @@ func getOverlayWindowRequest(c *xgb.Conn, Window xproto.Window) []byte { b := 0 buf := make([]byte, size) - buf[b] = c.Extensions["COMPOSITE"] + buf[b] = c.Extensions["Composite"] b += 1 buf[b] = 7 // request opcode @@ -224,7 +224,7 @@ type NameWindowPixmapCookie struct { // 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 { + 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) @@ -235,7 +235,7 @@ func NameWindowPixmap(c *xgb.Conn, Window xproto.Window, Pixmap xproto.Pixmap) N // 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 { + 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) @@ -256,7 +256,7 @@ func nameWindowPixmapRequest(c *xgb.Conn, Window xproto.Window, Pixmap xproto.Pi b := 0 buf := make([]byte, size) - buf[b] = c.Extensions["COMPOSITE"] + buf[b] = c.Extensions["Composite"] b += 1 buf[b] = 6 // request opcode @@ -282,7 +282,7 @@ type QueryVersionCookie struct { // 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["COMPOSITE"]; !ok { + if _, ok := c.Extensions["Composite"]; !ok { panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") } cookie := c.NewCookie(true, true) @@ -293,7 +293,7 @@ func QueryVersion(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVersion uin // 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["COMPOSITE"]; !ok { + if _, ok := c.Extensions["Composite"]; !ok { panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") } cookie := c.NewCookie(false, true) @@ -354,7 +354,7 @@ func queryVersionRequest(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVers b := 0 buf := make([]byte, size) - buf[b] = c.Extensions["COMPOSITE"] + buf[b] = c.Extensions["Composite"] b += 1 buf[b] = 0 // request opcode @@ -380,7 +380,7 @@ type RedirectSubwindowsCookie struct { // 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 { + 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) @@ -391,7 +391,7 @@ func RedirectSubwindows(c *xgb.Conn, Window xproto.Window, Update byte) Redirect // 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 { + 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) @@ -412,7 +412,7 @@ func redirectSubwindowsRequest(c *xgb.Conn, Window xproto.Window, Update byte) [ b := 0 buf := make([]byte, size) - buf[b] = c.Extensions["COMPOSITE"] + buf[b] = c.Extensions["Composite"] b += 1 buf[b] = 2 // request opcode @@ -440,7 +440,7 @@ type RedirectWindowCookie struct { // RedirectWindow sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func RedirectWindow(c *xgb.Conn, Window xproto.Window, Update byte) RedirectWindowCookie { - if _, ok := c.Extensions["COMPOSITE"]; !ok { + if _, ok := c.Extensions["Composite"]; !ok { panic("Cannot issue request 'RedirectWindow' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") } cookie := c.NewCookie(false, false) @@ -451,7 +451,7 @@ func RedirectWindow(c *xgb.Conn, Window xproto.Window, Update byte) RedirectWind // RedirectWindowChecked sends a checked request. // If an error occurs, it can be retrieved using RedirectWindowCookie.Check() func RedirectWindowChecked(c *xgb.Conn, Window xproto.Window, Update byte) RedirectWindowCookie { - if _, ok := c.Extensions["COMPOSITE"]; !ok { + if _, ok := c.Extensions["Composite"]; !ok { panic("Cannot issue request 'RedirectWindow' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") } cookie := c.NewCookie(true, false) @@ -472,7 +472,7 @@ func redirectWindowRequest(c *xgb.Conn, Window xproto.Window, Update byte) []byt b := 0 buf := make([]byte, size) - buf[b] = c.Extensions["COMPOSITE"] + buf[b] = c.Extensions["Composite"] b += 1 buf[b] = 1 // request opcode @@ -500,7 +500,7 @@ type ReleaseOverlayWindowCookie struct { // 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 { + 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) @@ -511,7 +511,7 @@ func ReleaseOverlayWindow(c *xgb.Conn, Window xproto.Window) ReleaseOverlayWindo // 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 { + 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) @@ -532,7 +532,7 @@ func releaseOverlayWindowRequest(c *xgb.Conn, Window xproto.Window) []byte { b := 0 buf := make([]byte, size) - buf[b] = c.Extensions["COMPOSITE"] + buf[b] = c.Extensions["Composite"] b += 1 buf[b] = 8 // request opcode @@ -555,7 +555,7 @@ type UnredirectSubwindowsCookie struct { // 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 { + 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) @@ -566,7 +566,7 @@ func UnredirectSubwindows(c *xgb.Conn, Window xproto.Window, Update byte) Unredi // 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 { + 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) @@ -587,7 +587,7 @@ func unredirectSubwindowsRequest(c *xgb.Conn, Window xproto.Window, Update byte) b := 0 buf := make([]byte, size) - buf[b] = c.Extensions["COMPOSITE"] + buf[b] = c.Extensions["Composite"] b += 1 buf[b] = 4 // request opcode @@ -615,7 +615,7 @@ type UnredirectWindowCookie struct { // UnredirectWindow sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func UnredirectWindow(c *xgb.Conn, Window xproto.Window, Update byte) UnredirectWindowCookie { - if _, ok := c.Extensions["COMPOSITE"]; !ok { + if _, ok := c.Extensions["Composite"]; !ok { panic("Cannot issue request 'UnredirectWindow' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") } cookie := c.NewCookie(false, false) @@ -626,7 +626,7 @@ func UnredirectWindow(c *xgb.Conn, Window xproto.Window, Update byte) Unredirect // UnredirectWindowChecked sends a checked request. // If an error occurs, it can be retrieved using UnredirectWindowCookie.Check() func UnredirectWindowChecked(c *xgb.Conn, Window xproto.Window, Update byte) UnredirectWindowCookie { - if _, ok := c.Extensions["COMPOSITE"]; !ok { + if _, ok := c.Extensions["Composite"]; !ok { panic("Cannot issue request 'UnredirectWindow' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") } cookie := c.NewCookie(true, false) @@ -647,7 +647,7 @@ func unredirectWindowRequest(c *xgb.Conn, Window xproto.Window, Update byte) []b b := 0 buf := make([]byte, size) - buf[b] = c.Extensions["COMPOSITE"] + buf[b] = c.Extensions["Composite"] b += 1 buf[b] = 3 // request opcode -- cgit v1.2.3 From becaf43dcb3e9832c3eb951ff9908ed697868152 Mon Sep 17 00:00:00 2001 From: aarzilli Date: Tue, 1 Mar 2016 15:41:38 +0100 Subject: Read/Write mutex for Extensions map --- nexgb/composite/composite.go | 59 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 56 insertions(+), 3 deletions(-) (limited to 'nexgb/composite') diff --git a/nexgb/composite/composite.go b/nexgb/composite/composite.go index b7ce2ad..1373f8b 100644 --- a/nexgb/composite/composite.go +++ b/nexgb/composite/composite.go @@ -20,16 +20,15 @@ func Init(c *xgb.Conn) error { return xgb.Errorf("No extension named Composite could be found on on the server.") } - xgb.ExtLock.Lock() + c.ExtLock.Lock() c.Extensions["Composite"] = reply.MajorOpcode + c.ExtLock.Unlock() for evNum, fun := range xgb.NewExtEventFuncs["Composite"] { xgb.NewEventFuncs[int(reply.FirstEvent)+evNum] = fun } for errNum, fun := range xgb.NewExtErrorFuncs["Composite"] { xgb.NewErrorFuncs[int(reply.FirstError)+errNum] = fun } - xgb.ExtLock.Unlock() - return nil } @@ -75,6 +74,8 @@ type CreateRegionFromBorderClipCookie struct { // 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 { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["Composite"]; !ok { panic("Cannot issue request 'CreateRegionFromBorderClip' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") } @@ -86,6 +87,8 @@ func CreateRegionFromBorderClip(c *xgb.Conn, Region xfixes.Region, Window xproto // 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 { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["Composite"]; !ok { panic("Cannot issue request 'CreateRegionFromBorderClip' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") } @@ -107,7 +110,9 @@ func createRegionFromBorderClipRequest(c *xgb.Conn, Region xfixes.Region, Window b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["Composite"] + c.ExtLock.RUnlock() b += 1 buf[b] = 5 // request opcode @@ -133,6 +138,8 @@ type GetOverlayWindowCookie struct { // 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 { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["Composite"]; !ok { panic("Cannot issue request 'GetOverlayWindow' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") } @@ -144,6 +151,8 @@ func GetOverlayWindow(c *xgb.Conn, Window xproto.Window) GetOverlayWindowCookie // 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 { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["Composite"]; !ok { panic("Cannot issue request 'GetOverlayWindow' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") } @@ -201,7 +210,9 @@ func getOverlayWindowRequest(c *xgb.Conn, Window xproto.Window) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["Composite"] + c.ExtLock.RUnlock() b += 1 buf[b] = 7 // request opcode @@ -224,6 +235,8 @@ type NameWindowPixmapCookie struct { // 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 { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["Composite"]; !ok { panic("Cannot issue request 'NameWindowPixmap' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") } @@ -235,6 +248,8 @@ func NameWindowPixmap(c *xgb.Conn, Window xproto.Window, Pixmap xproto.Pixmap) N // 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 { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["Composite"]; !ok { panic("Cannot issue request 'NameWindowPixmap' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") } @@ -256,7 +271,9 @@ func nameWindowPixmapRequest(c *xgb.Conn, Window xproto.Window, Pixmap xproto.Pi b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["Composite"] + c.ExtLock.RUnlock() b += 1 buf[b] = 6 // request opcode @@ -282,6 +299,8 @@ type QueryVersionCookie struct { // 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 { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["Composite"]; !ok { panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") } @@ -293,6 +312,8 @@ func QueryVersion(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVersion uin // 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 { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["Composite"]; !ok { panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") } @@ -354,7 +375,9 @@ func queryVersionRequest(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVers b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["Composite"] + c.ExtLock.RUnlock() b += 1 buf[b] = 0 // request opcode @@ -380,6 +403,8 @@ type RedirectSubwindowsCookie struct { // 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 { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["Composite"]; !ok { panic("Cannot issue request 'RedirectSubwindows' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") } @@ -391,6 +416,8 @@ func RedirectSubwindows(c *xgb.Conn, Window xproto.Window, Update byte) Redirect // 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 { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["Composite"]; !ok { panic("Cannot issue request 'RedirectSubwindows' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") } @@ -412,7 +439,9 @@ func redirectSubwindowsRequest(c *xgb.Conn, Window xproto.Window, Update byte) [ b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["Composite"] + c.ExtLock.RUnlock() b += 1 buf[b] = 2 // request opcode @@ -440,6 +469,8 @@ type RedirectWindowCookie struct { // RedirectWindow sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func RedirectWindow(c *xgb.Conn, Window xproto.Window, Update byte) RedirectWindowCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["Composite"]; !ok { panic("Cannot issue request 'RedirectWindow' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") } @@ -451,6 +482,8 @@ func RedirectWindow(c *xgb.Conn, Window xproto.Window, Update byte) RedirectWind // RedirectWindowChecked sends a checked request. // If an error occurs, it can be retrieved using RedirectWindowCookie.Check() func RedirectWindowChecked(c *xgb.Conn, Window xproto.Window, Update byte) RedirectWindowCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["Composite"]; !ok { panic("Cannot issue request 'RedirectWindow' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") } @@ -472,7 +505,9 @@ func redirectWindowRequest(c *xgb.Conn, Window xproto.Window, Update byte) []byt b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["Composite"] + c.ExtLock.RUnlock() b += 1 buf[b] = 1 // request opcode @@ -500,6 +535,8 @@ type ReleaseOverlayWindowCookie struct { // 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 { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["Composite"]; !ok { panic("Cannot issue request 'ReleaseOverlayWindow' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") } @@ -511,6 +548,8 @@ func ReleaseOverlayWindow(c *xgb.Conn, Window xproto.Window) ReleaseOverlayWindo // 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 { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["Composite"]; !ok { panic("Cannot issue request 'ReleaseOverlayWindow' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") } @@ -532,7 +571,9 @@ func releaseOverlayWindowRequest(c *xgb.Conn, Window xproto.Window) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["Composite"] + c.ExtLock.RUnlock() b += 1 buf[b] = 8 // request opcode @@ -555,6 +596,8 @@ type UnredirectSubwindowsCookie struct { // 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 { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["Composite"]; !ok { panic("Cannot issue request 'UnredirectSubwindows' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") } @@ -566,6 +609,8 @@ func UnredirectSubwindows(c *xgb.Conn, Window xproto.Window, Update byte) Unredi // 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 { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["Composite"]; !ok { panic("Cannot issue request 'UnredirectSubwindows' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") } @@ -587,7 +632,9 @@ func unredirectSubwindowsRequest(c *xgb.Conn, Window xproto.Window, Update byte) b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["Composite"] + c.ExtLock.RUnlock() b += 1 buf[b] = 4 // request opcode @@ -615,6 +662,8 @@ type UnredirectWindowCookie struct { // UnredirectWindow sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func UnredirectWindow(c *xgb.Conn, Window xproto.Window, Update byte) UnredirectWindowCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["Composite"]; !ok { panic("Cannot issue request 'UnredirectWindow' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") } @@ -626,6 +675,8 @@ func UnredirectWindow(c *xgb.Conn, Window xproto.Window, Update byte) Unredirect // UnredirectWindowChecked sends a checked request. // If an error occurs, it can be retrieved using UnredirectWindowCookie.Check() func UnredirectWindowChecked(c *xgb.Conn, Window xproto.Window, Update byte) UnredirectWindowCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["Composite"]; !ok { panic("Cannot issue request 'UnredirectWindow' using the uninitialized extension 'Composite'. composite.Init(connObj) must be called first.") } @@ -647,7 +698,9 @@ func unredirectWindowRequest(c *xgb.Conn, Window xproto.Window, Update byte) []b b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["Composite"] + c.ExtLock.RUnlock() b += 1 buf[b] = 3 // request opcode -- cgit v1.2.3