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/xevie/xevie.go | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'nexgb/xevie') diff --git a/nexgb/xevie/xevie.go b/nexgb/xevie/xevie.go index ef02e2c..0628ffd 100644 --- a/nexgb/xevie/xevie.go +++ b/nexgb/xevie/xevie.go @@ -2,7 +2,7 @@ package xevie /* - This file was generated by xevie.xml on May 11 2012 1:58:36am EDT. + This file was generated by xevie.xml on May 11 2012 11:57:19pm EDT. This file is automatically generated. Edit at your peril! */ @@ -122,6 +122,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 uint16, ClientMinorVersion uint16) QueryVersionCookie { + if _, ok := c.Extensions["XEVIE"]; !ok { + panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'XEVIE'. xevie.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(queryVersionRequest(c, ClientMajorVersion, ClientMinorVersion), cookie) return QueryVersionCookie{cookie} @@ -130,6 +133,9 @@ func QueryVersion(c *xgb.Conn, ClientMajorVersion uint16, 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 uint16, ClientMinorVersion uint16) QueryVersionCookie { + if _, ok := c.Extensions["XEVIE"]; !ok { + panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'XEVIE'. xevie.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(queryVersionRequest(c, ClientMajorVersion, ClientMinorVersion), cookie) return QueryVersionCookie{cookie} @@ -214,6 +220,9 @@ type StartCookie struct { // Start sends a checked request. // If an error occurs, it will be returned with the reply by calling StartCookie.Reply() func Start(c *xgb.Conn, Screen uint32) StartCookie { + if _, ok := c.Extensions["XEVIE"]; !ok { + panic("Cannot issue request 'Start' using the uninitialized extension 'XEVIE'. xevie.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(startRequest(c, Screen), cookie) return StartCookie{cookie} @@ -222,6 +231,9 @@ func Start(c *xgb.Conn, Screen uint32) StartCookie { // StartUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func StartUnchecked(c *xgb.Conn, Screen uint32) StartCookie { + if _, ok := c.Extensions["XEVIE"]; !ok { + panic("Cannot issue request 'Start' using the uninitialized extension 'XEVIE'. xevie.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(startRequest(c, Screen), cookie) return StartCookie{cookie} @@ -295,6 +307,9 @@ type EndCookie struct { // End sends a checked request. // If an error occurs, it will be returned with the reply by calling EndCookie.Reply() func End(c *xgb.Conn, Cmap uint32) EndCookie { + if _, ok := c.Extensions["XEVIE"]; !ok { + panic("Cannot issue request 'End' using the uninitialized extension 'XEVIE'. xevie.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(endRequest(c, Cmap), cookie) return EndCookie{cookie} @@ -303,6 +318,9 @@ func End(c *xgb.Conn, Cmap uint32) EndCookie { // EndUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func EndUnchecked(c *xgb.Conn, Cmap uint32) EndCookie { + if _, ok := c.Extensions["XEVIE"]; !ok { + panic("Cannot issue request 'End' using the uninitialized extension 'XEVIE'. xevie.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(endRequest(c, Cmap), cookie) return EndCookie{cookie} @@ -376,6 +394,9 @@ type SendCookie struct { // Send sends a checked request. // If an error occurs, it will be returned with the reply by calling SendCookie.Reply() func Send(c *xgb.Conn, Event Event, DataType uint32) SendCookie { + if _, ok := c.Extensions["XEVIE"]; !ok { + panic("Cannot issue request 'Send' using the uninitialized extension 'XEVIE'. xevie.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(sendRequest(c, Event, DataType), cookie) return SendCookie{cookie} @@ -384,6 +405,9 @@ func Send(c *xgb.Conn, Event Event, DataType uint32) SendCookie { // SendUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SendUnchecked(c *xgb.Conn, Event Event, DataType uint32) SendCookie { + if _, ok := c.Extensions["XEVIE"]; !ok { + panic("Cannot issue request 'Send' using the uninitialized extension 'XEVIE'. xevie.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(sendRequest(c, Event, DataType), cookie) return SendCookie{cookie} @@ -465,6 +489,9 @@ type SelectInputCookie struct { // SelectInput sends a checked request. // If an error occurs, it will be returned with the reply by calling SelectInputCookie.Reply() func SelectInput(c *xgb.Conn, EventMask uint32) SelectInputCookie { + if _, ok := c.Extensions["XEVIE"]; !ok { + panic("Cannot issue request 'SelectInput' using the uninitialized extension 'XEVIE'. xevie.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(selectInputRequest(c, EventMask), cookie) return SelectInputCookie{cookie} @@ -473,6 +500,9 @@ func SelectInput(c *xgb.Conn, EventMask uint32) SelectInputCookie { // SelectInputUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SelectInputUnchecked(c *xgb.Conn, EventMask uint32) SelectInputCookie { + if _, ok := c.Extensions["XEVIE"]; !ok { + panic("Cannot issue request 'SelectInput' using the uninitialized extension 'XEVIE'. xevie.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(selectInputRequest(c, EventMask), cookie) return SelectInputCookie{cookie} -- cgit v1.2.3-70-g09d2