panic when an extension request is issued before an extension has been initialized. but give a nice error message for the happy people.

This commit is contained in:
Andrew Gallant (Ocelot)
2012-05-11 23:58:52 -04:00
parent fb3128ed2a
commit 29942bf078
29 changed files with 2876 additions and 202 deletions

View File

@@ -2,7 +2,7 @@
package xcmisc
/*
This file was generated by xc_misc.xml on May 11 2012 1:58:36am EDT.
This file was generated by xc_misc.xml on May 11 2012 11:57:19pm EDT.
This file is automatically generated. Edit at your peril!
*/
@@ -40,18 +40,6 @@ func init() {
xgb.NewExtErrorFuncs["XC-MISC"] = 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'
// Skipping definition for base type 'Byte'
// Skipping definition for base type 'Int8'
// Skipping definition for base type 'Card16'
@@ -64,6 +52,18 @@ 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'
// Skipping definition for base type 'Int32'
// Skipping definition for base type 'Void'
// Skipping definition for base type 'Byte'
// GetVersionCookie is a cookie used only for GetVersion requests.
type GetVersionCookie struct {
*xgb.Cookie
@@ -72,6 +72,9 @@ type GetVersionCookie struct {
// GetVersion sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetVersionCookie.Reply()
func GetVersion(c *xgb.Conn, ClientMajorVersion uint16, ClientMinorVersion uint16) GetVersionCookie {
if _, ok := c.Extensions["XC-MISC"]; !ok {
panic("Cannot issue request 'GetVersion' using the uninitialized extension 'XC-MISC'. xcmisc.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getVersionRequest(c, ClientMajorVersion, ClientMinorVersion), cookie)
return GetVersionCookie{cookie}
@@ -80,6 +83,9 @@ func GetVersion(c *xgb.Conn, ClientMajorVersion uint16, ClientMinorVersion uint1
// GetVersionUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetVersionUnchecked(c *xgb.Conn, ClientMajorVersion uint16, ClientMinorVersion uint16) GetVersionCookie {
if _, ok := c.Extensions["XC-MISC"]; !ok {
panic("Cannot issue request 'GetVersion' using the uninitialized extension 'XC-MISC'. xcmisc.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getVersionRequest(c, ClientMajorVersion, ClientMinorVersion), cookie)
return GetVersionCookie{cookie}
@@ -161,6 +167,9 @@ type GetXIDRangeCookie struct {
// GetXIDRange sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetXIDRangeCookie.Reply()
func GetXIDRange(c *xgb.Conn) GetXIDRangeCookie {
if _, ok := c.Extensions["XC-MISC"]; !ok {
panic("Cannot issue request 'GetXIDRange' using the uninitialized extension 'XC-MISC'. xcmisc.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getXIDRangeRequest(c), cookie)
return GetXIDRangeCookie{cookie}
@@ -169,6 +178,9 @@ func GetXIDRange(c *xgb.Conn) GetXIDRangeCookie {
// GetXIDRangeUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetXIDRangeUnchecked(c *xgb.Conn) GetXIDRangeCookie {
if _, ok := c.Extensions["XC-MISC"]; !ok {
panic("Cannot issue request 'GetXIDRange' using the uninitialized extension 'XC-MISC'. xcmisc.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getXIDRangeRequest(c), cookie)
return GetXIDRangeCookie{cookie}
@@ -244,6 +256,9 @@ type GetXIDListCookie struct {
// GetXIDList sends a checked request.
// If an error occurs, it will be returned with the reply by calling GetXIDListCookie.Reply()
func GetXIDList(c *xgb.Conn, Count uint32) GetXIDListCookie {
if _, ok := c.Extensions["XC-MISC"]; !ok {
panic("Cannot issue request 'GetXIDList' using the uninitialized extension 'XC-MISC'. xcmisc.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(getXIDListRequest(c, Count), cookie)
return GetXIDListCookie{cookie}
@@ -252,6 +267,9 @@ func GetXIDList(c *xgb.Conn, Count uint32) GetXIDListCookie {
// GetXIDListUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func GetXIDListUnchecked(c *xgb.Conn, Count uint32) GetXIDListCookie {
if _, ok := c.Extensions["XC-MISC"]; !ok {
panic("Cannot issue request 'GetXIDList' using the uninitialized extension 'XC-MISC'. xcmisc.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(getXIDListRequest(c, Count), cookie)
return GetXIDListCookie{cookie}