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-70-g09d2