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/xinerama/xinerama.go | 50 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 43 insertions(+), 7 deletions(-) (limited to 'nexgb/xinerama') diff --git a/nexgb/xinerama/xinerama.go b/nexgb/xinerama/xinerama.go index b03a381..51b270a 100644 --- a/nexgb/xinerama/xinerama.go +++ b/nexgb/xinerama/xinerama.go @@ -2,7 +2,7 @@ package xinerama /* - This file was generated by xinerama.xml on May 11 2012 1:58:36am EDT. + This file was generated by xinerama.xml on May 11 2012 11:57:20pm EDT. This file is automatically generated. Edit at your peril! */ @@ -40,6 +40,12 @@ func init() { xgb.NewExtErrorFuncs["XINERAMA"] = make(map[int]xgb.NewErrorFun) } +// 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' @@ -58,12 +64,6 @@ func init() { // Skipping definition for base type 'Int16' -// Skipping definition for base type 'Int32' - -// Skipping definition for base type 'Void' - -// Skipping definition for base type 'Byte' - type ScreenInfo struct { XOrg int16 YOrg int16 @@ -140,6 +140,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, Major byte, Minor byte) QueryVersionCookie { + if _, ok := c.Extensions["XINERAMA"]; !ok { + panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'XINERAMA'. xinerama.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(queryVersionRequest(c, Major, Minor), cookie) return QueryVersionCookie{cookie} @@ -148,6 +151,9 @@ func QueryVersion(c *xgb.Conn, Major byte, Minor byte) QueryVersionCookie { // 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, Major byte, Minor byte) QueryVersionCookie { + if _, ok := c.Extensions["XINERAMA"]; !ok { + panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'XINERAMA'. xinerama.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(queryVersionRequest(c, Major, Minor), cookie) return QueryVersionCookie{cookie} @@ -229,6 +235,9 @@ type GetStateCookie struct { // GetState sends a checked request. // If an error occurs, it will be returned with the reply by calling GetStateCookie.Reply() func GetState(c *xgb.Conn, Window xproto.Window) GetStateCookie { + if _, ok := c.Extensions["XINERAMA"]; !ok { + panic("Cannot issue request 'GetState' using the uninitialized extension 'XINERAMA'. xinerama.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(getStateRequest(c, Window), cookie) return GetStateCookie{cookie} @@ -237,6 +246,9 @@ func GetState(c *xgb.Conn, Window xproto.Window) GetStateCookie { // GetStateUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetStateUnchecked(c *xgb.Conn, Window xproto.Window) GetStateCookie { + if _, ok := c.Extensions["XINERAMA"]; !ok { + panic("Cannot issue request 'GetState' using the uninitialized extension 'XINERAMA'. xinerama.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(getStateRequest(c, Window), cookie) return GetStateCookie{cookie} @@ -312,6 +324,9 @@ type GetScreenCountCookie struct { // GetScreenCount sends a checked request. // If an error occurs, it will be returned with the reply by calling GetScreenCountCookie.Reply() func GetScreenCount(c *xgb.Conn, Window xproto.Window) GetScreenCountCookie { + if _, ok := c.Extensions["XINERAMA"]; !ok { + panic("Cannot issue request 'GetScreenCount' using the uninitialized extension 'XINERAMA'. xinerama.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(getScreenCountRequest(c, Window), cookie) return GetScreenCountCookie{cookie} @@ -320,6 +335,9 @@ func GetScreenCount(c *xgb.Conn, Window xproto.Window) GetScreenCountCookie { // GetScreenCountUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetScreenCountUnchecked(c *xgb.Conn, Window xproto.Window) GetScreenCountCookie { + if _, ok := c.Extensions["XINERAMA"]; !ok { + panic("Cannot issue request 'GetScreenCount' using the uninitialized extension 'XINERAMA'. xinerama.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(getScreenCountRequest(c, Window), cookie) return GetScreenCountCookie{cookie} @@ -395,6 +413,9 @@ type GetScreenSizeCookie struct { // GetScreenSize sends a checked request. // If an error occurs, it will be returned with the reply by calling GetScreenSizeCookie.Reply() func GetScreenSize(c *xgb.Conn, Window xproto.Window, Screen uint32) GetScreenSizeCookie { + if _, ok := c.Extensions["XINERAMA"]; !ok { + panic("Cannot issue request 'GetScreenSize' using the uninitialized extension 'XINERAMA'. xinerama.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(getScreenSizeRequest(c, Window, Screen), cookie) return GetScreenSizeCookie{cookie} @@ -403,6 +424,9 @@ func GetScreenSize(c *xgb.Conn, Window xproto.Window, Screen uint32) GetScreenSi // GetScreenSizeUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetScreenSizeUnchecked(c *xgb.Conn, Window xproto.Window, Screen uint32) GetScreenSizeCookie { + if _, ok := c.Extensions["XINERAMA"]; !ok { + panic("Cannot issue request 'GetScreenSize' using the uninitialized extension 'XINERAMA'. xinerama.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(getScreenSizeRequest(c, Window, Screen), cookie) return GetScreenSizeCookie{cookie} @@ -492,6 +516,9 @@ type IsActiveCookie struct { // IsActive sends a checked request. // If an error occurs, it will be returned with the reply by calling IsActiveCookie.Reply() func IsActive(c *xgb.Conn) IsActiveCookie { + if _, ok := c.Extensions["XINERAMA"]; !ok { + panic("Cannot issue request 'IsActive' using the uninitialized extension 'XINERAMA'. xinerama.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(isActiveRequest(c), cookie) return IsActiveCookie{cookie} @@ -500,6 +527,9 @@ func IsActive(c *xgb.Conn) IsActiveCookie { // IsActiveUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func IsActiveUnchecked(c *xgb.Conn) IsActiveCookie { + if _, ok := c.Extensions["XINERAMA"]; !ok { + panic("Cannot issue request 'IsActive' using the uninitialized extension 'XINERAMA'. xinerama.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(isActiveRequest(c), cookie) return IsActiveCookie{cookie} @@ -571,6 +601,9 @@ type QueryScreensCookie struct { // QueryScreens sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryScreensCookie.Reply() func QueryScreens(c *xgb.Conn) QueryScreensCookie { + if _, ok := c.Extensions["XINERAMA"]; !ok { + panic("Cannot issue request 'QueryScreens' using the uninitialized extension 'XINERAMA'. xinerama.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(queryScreensRequest(c), cookie) return QueryScreensCookie{cookie} @@ -579,6 +612,9 @@ func QueryScreens(c *xgb.Conn) QueryScreensCookie { // QueryScreensUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryScreensUnchecked(c *xgb.Conn) QueryScreensCookie { + if _, ok := c.Extensions["XINERAMA"]; !ok { + panic("Cannot issue request 'QueryScreens' using the uninitialized extension 'XINERAMA'. xinerama.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(queryScreensRequest(c), cookie) return QueryScreensCookie{cookie} -- cgit v1.2.3