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/res/res.go | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) (limited to 'nexgb/res') diff --git a/nexgb/res/res.go b/nexgb/res/res.go index 56f4691..c5700c3 100644 --- a/nexgb/res/res.go +++ b/nexgb/res/res.go @@ -2,7 +2,7 @@ package res /* - This file was generated by res.xml on May 11 2012 1:58:36am EDT. + This file was generated by res.xml on May 11 2012 11:57:19pm EDT. This file is automatically generated. Edit at your peril! */ @@ -40,6 +40,12 @@ func init() { xgb.NewExtErrorFuncs["X-Resource"] = make(map[int]xgb.NewErrorFun) } +// Skipping definition for base type 'Int8' + +// Skipping definition for base type 'Card16' + +// Skipping definition for base type 'Char' + // Skipping definition for base type 'Card32' // Skipping definition for base type 'Double' @@ -58,12 +64,6 @@ func init() { // Skipping definition for base type 'Byte' -// Skipping definition for base type 'Int8' - -// Skipping definition for base type 'Card16' - -// Skipping definition for base type 'Char' - type Client struct { ResourceBase uint32 ResourceMask uint32 @@ -180,6 +180,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, ClientMajor byte, ClientMinor byte) QueryVersionCookie { + if _, ok := c.Extensions["X-RESOURCE"]; !ok { + panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'X-Resource'. res.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(queryVersionRequest(c, ClientMajor, ClientMinor), cookie) return QueryVersionCookie{cookie} @@ -188,6 +191,9 @@ func QueryVersion(c *xgb.Conn, ClientMajor byte, ClientMinor byte) QueryVersionC // QueryVersionUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryVersionUnchecked(c *xgb.Conn, ClientMajor byte, ClientMinor byte) QueryVersionCookie { + if _, ok := c.Extensions["X-RESOURCE"]; !ok { + panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'X-Resource'. res.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(queryVersionRequest(c, ClientMajor, ClientMinor), cookie) return QueryVersionCookie{cookie} @@ -269,6 +275,9 @@ type QueryClientsCookie struct { // QueryClients sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryClientsCookie.Reply() func QueryClients(c *xgb.Conn) QueryClientsCookie { + if _, ok := c.Extensions["X-RESOURCE"]; !ok { + panic("Cannot issue request 'QueryClients' using the uninitialized extension 'X-Resource'. res.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(queryClientsRequest(c), cookie) return QueryClientsCookie{cookie} @@ -277,6 +286,9 @@ func QueryClients(c *xgb.Conn) QueryClientsCookie { // QueryClientsUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryClientsUnchecked(c *xgb.Conn) QueryClientsCookie { + if _, ok := c.Extensions["X-RESOURCE"]; !ok { + panic("Cannot issue request 'QueryClients' using the uninitialized extension 'X-Resource'. res.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(queryClientsRequest(c), cookie) return QueryClientsCookie{cookie} @@ -355,6 +367,9 @@ type QueryClientResourcesCookie struct { // QueryClientResources sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryClientResourcesCookie.Reply() func QueryClientResources(c *xgb.Conn, Xid uint32) QueryClientResourcesCookie { + if _, ok := c.Extensions["X-RESOURCE"]; !ok { + panic("Cannot issue request 'QueryClientResources' using the uninitialized extension 'X-Resource'. res.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(queryClientResourcesRequest(c, Xid), cookie) return QueryClientResourcesCookie{cookie} @@ -363,6 +378,9 @@ func QueryClientResources(c *xgb.Conn, Xid uint32) QueryClientResourcesCookie { // QueryClientResourcesUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryClientResourcesUnchecked(c *xgb.Conn, Xid uint32) QueryClientResourcesCookie { + if _, ok := c.Extensions["X-RESOURCE"]; !ok { + panic("Cannot issue request 'QueryClientResources' using the uninitialized extension 'X-Resource'. res.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(queryClientResourcesRequest(c, Xid), cookie) return QueryClientResourcesCookie{cookie} @@ -444,6 +462,9 @@ type QueryClientPixmapBytesCookie struct { // QueryClientPixmapBytes sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryClientPixmapBytesCookie.Reply() func QueryClientPixmapBytes(c *xgb.Conn, Xid uint32) QueryClientPixmapBytesCookie { + if _, ok := c.Extensions["X-RESOURCE"]; !ok { + panic("Cannot issue request 'QueryClientPixmapBytes' using the uninitialized extension 'X-Resource'. res.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(queryClientPixmapBytesRequest(c, Xid), cookie) return QueryClientPixmapBytesCookie{cookie} @@ -452,6 +473,9 @@ func QueryClientPixmapBytes(c *xgb.Conn, Xid uint32) QueryClientPixmapBytesCooki // QueryClientPixmapBytesUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryClientPixmapBytesUnchecked(c *xgb.Conn, Xid uint32) QueryClientPixmapBytesCookie { + if _, ok := c.Extensions["X-RESOURCE"]; !ok { + panic("Cannot issue request 'QueryClientPixmapBytes' using the uninitialized extension 'X-Resource'. res.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(queryClientPixmapBytesRequest(c, Xid), cookie) return QueryClientPixmapBytesCookie{cookie} -- cgit v1.2.3