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/shape/shape.go | 64 ++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 59 insertions(+), 5 deletions(-) (limited to 'nexgb/shape/shape.go') diff --git a/nexgb/shape/shape.go b/nexgb/shape/shape.go index 8989000..83d9020 100644 --- a/nexgb/shape/shape.go +++ b/nexgb/shape/shape.go @@ -2,7 +2,7 @@ package shape /* - This file was generated by shape.xml on May 11 2012 1:58:36am EDT. + This file was generated by shape.xml on May 11 2012 11:57:19pm EDT. This file is automatically generated. Edit at your peril! */ @@ -40,6 +40,10 @@ func init() { xgb.NewExtErrorFuncs["SHAPE"] = make(map[int]xgb.NewErrorFun) } +// Skipping definition for base type 'Card8' + +// Skipping definition for base type 'Int16' + // Skipping definition for base type 'Int32' // Skipping definition for base type 'Void' @@ -60,10 +64,6 @@ func init() { // Skipping definition for base type 'Float' -// Skipping definition for base type 'Card8' - -// Skipping definition for base type 'Int16' - const ( SoSet = 0 SoUnion = 1 @@ -217,6 +217,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) QueryVersionCookie { + if _, ok := c.Extensions["SHAPE"]; !ok { + panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(queryVersionRequest(c), cookie) return QueryVersionCookie{cookie} @@ -225,6 +228,9 @@ func QueryVersion(c *xgb.Conn) 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) QueryVersionCookie { + if _, ok := c.Extensions["SHAPE"]; !ok { + panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(queryVersionRequest(c), cookie) return QueryVersionCookie{cookie} @@ -300,6 +306,9 @@ type RectanglesCookie struct { // Rectangles sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func Rectangles(c *xgb.Conn, Operation Op, DestinationKind Kind, Ordering byte, DestinationWindow xproto.Window, XOffset int16, YOffset int16, Rectangles []xproto.Rectangle) RectanglesCookie { + if _, ok := c.Extensions["SHAPE"]; !ok { + panic("Cannot issue request 'Rectangles' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(rectanglesRequest(c, Operation, DestinationKind, Ordering, DestinationWindow, XOffset, YOffset, Rectangles), cookie) return RectanglesCookie{cookie} @@ -308,6 +317,9 @@ func Rectangles(c *xgb.Conn, Operation Op, DestinationKind Kind, Ordering byte, // RectanglesChecked sends a checked request. // If an error occurs, it can be retrieved using RectanglesCookie.Check() func RectanglesChecked(c *xgb.Conn, Operation Op, DestinationKind Kind, Ordering byte, DestinationWindow xproto.Window, XOffset int16, YOffset int16, Rectangles []xproto.Rectangle) RectanglesCookie { + if _, ok := c.Extensions["SHAPE"]; !ok { + panic("Cannot issue request 'Rectangles' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(rectanglesRequest(c, Operation, DestinationKind, Ordering, DestinationWindow, XOffset, YOffset, Rectangles), cookie) return RectanglesCookie{cookie} @@ -368,6 +380,9 @@ type MaskCookie struct { // Mask sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func Mask(c *xgb.Conn, Operation Op, DestinationKind Kind, DestinationWindow xproto.Window, XOffset int16, YOffset int16, SourceBitmap xproto.Pixmap) MaskCookie { + if _, ok := c.Extensions["SHAPE"]; !ok { + panic("Cannot issue request 'Mask' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(maskRequest(c, Operation, DestinationKind, DestinationWindow, XOffset, YOffset, SourceBitmap), cookie) return MaskCookie{cookie} @@ -376,6 +391,9 @@ func Mask(c *xgb.Conn, Operation Op, DestinationKind Kind, DestinationWindow xpr // MaskChecked sends a checked request. // If an error occurs, it can be retrieved using MaskCookie.Check() func MaskChecked(c *xgb.Conn, Operation Op, DestinationKind Kind, DestinationWindow xproto.Window, XOffset int16, YOffset int16, SourceBitmap xproto.Pixmap) MaskCookie { + if _, ok := c.Extensions["SHAPE"]; !ok { + panic("Cannot issue request 'Mask' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(maskRequest(c, Operation, DestinationKind, DestinationWindow, XOffset, YOffset, SourceBitmap), cookie) return MaskCookie{cookie} @@ -434,6 +452,9 @@ type CombineCookie struct { // Combine sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func Combine(c *xgb.Conn, Operation Op, DestinationKind Kind, SourceKind Kind, DestinationWindow xproto.Window, XOffset int16, YOffset int16, SourceWindow xproto.Window) CombineCookie { + if _, ok := c.Extensions["SHAPE"]; !ok { + panic("Cannot issue request 'Combine' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(combineRequest(c, Operation, DestinationKind, SourceKind, DestinationWindow, XOffset, YOffset, SourceWindow), cookie) return CombineCookie{cookie} @@ -442,6 +463,9 @@ func Combine(c *xgb.Conn, Operation Op, DestinationKind Kind, SourceKind Kind, D // CombineChecked sends a checked request. // If an error occurs, it can be retrieved using CombineCookie.Check() func CombineChecked(c *xgb.Conn, Operation Op, DestinationKind Kind, SourceKind Kind, DestinationWindow xproto.Window, XOffset int16, YOffset int16, SourceWindow xproto.Window) CombineCookie { + if _, ok := c.Extensions["SHAPE"]; !ok { + panic("Cannot issue request 'Combine' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(combineRequest(c, Operation, DestinationKind, SourceKind, DestinationWindow, XOffset, YOffset, SourceWindow), cookie) return CombineCookie{cookie} @@ -503,6 +527,9 @@ type OffsetCookie struct { // Offset sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func Offset(c *xgb.Conn, DestinationKind Kind, DestinationWindow xproto.Window, XOffset int16, YOffset int16) OffsetCookie { + if _, ok := c.Extensions["SHAPE"]; !ok { + panic("Cannot issue request 'Offset' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(offsetRequest(c, DestinationKind, DestinationWindow, XOffset, YOffset), cookie) return OffsetCookie{cookie} @@ -511,6 +538,9 @@ func Offset(c *xgb.Conn, DestinationKind Kind, DestinationWindow xproto.Window, // OffsetChecked sends a checked request. // If an error occurs, it can be retrieved using OffsetCookie.Check() func OffsetChecked(c *xgb.Conn, DestinationKind Kind, DestinationWindow xproto.Window, XOffset int16, YOffset int16) OffsetCookie { + if _, ok := c.Extensions["SHAPE"]; !ok { + panic("Cannot issue request 'Offset' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(offsetRequest(c, DestinationKind, DestinationWindow, XOffset, YOffset), cookie) return OffsetCookie{cookie} @@ -563,6 +593,9 @@ type QueryExtentsCookie struct { // QueryExtents sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryExtentsCookie.Reply() func QueryExtents(c *xgb.Conn, DestinationWindow xproto.Window) QueryExtentsCookie { + if _, ok := c.Extensions["SHAPE"]; !ok { + panic("Cannot issue request 'QueryExtents' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(queryExtentsRequest(c, DestinationWindow), cookie) return QueryExtentsCookie{cookie} @@ -571,6 +604,9 @@ func QueryExtents(c *xgb.Conn, DestinationWindow xproto.Window) QueryExtentsCook // QueryExtentsUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryExtentsUnchecked(c *xgb.Conn, DestinationWindow xproto.Window) QueryExtentsCookie { + if _, ok := c.Extensions["SHAPE"]; !ok { + panic("Cannot issue request 'QueryExtents' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(queryExtentsRequest(c, DestinationWindow), cookie) return QueryExtentsCookie{cookie} @@ -692,6 +728,9 @@ type SelectInputCookie struct { // SelectInput sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SelectInput(c *xgb.Conn, DestinationWindow xproto.Window, Enable bool) SelectInputCookie { + if _, ok := c.Extensions["SHAPE"]; !ok { + panic("Cannot issue request 'SelectInput' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(selectInputRequest(c, DestinationWindow, Enable), cookie) return SelectInputCookie{cookie} @@ -700,6 +739,9 @@ func SelectInput(c *xgb.Conn, DestinationWindow xproto.Window, Enable bool) Sele // SelectInputChecked sends a checked request. // If an error occurs, it can be retrieved using SelectInputCookie.Check() func SelectInputChecked(c *xgb.Conn, DestinationWindow xproto.Window, Enable bool) SelectInputCookie { + if _, ok := c.Extensions["SHAPE"]; !ok { + panic("Cannot issue request 'SelectInput' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(selectInputRequest(c, DestinationWindow, Enable), cookie) return SelectInputCookie{cookie} @@ -750,6 +792,9 @@ type InputSelectedCookie struct { // InputSelected sends a checked request. // If an error occurs, it will be returned with the reply by calling InputSelectedCookie.Reply() func InputSelected(c *xgb.Conn, DestinationWindow xproto.Window) InputSelectedCookie { + if _, ok := c.Extensions["SHAPE"]; !ok { + panic("Cannot issue request 'InputSelected' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(inputSelectedRequest(c, DestinationWindow), cookie) return InputSelectedCookie{cookie} @@ -758,6 +803,9 @@ func InputSelected(c *xgb.Conn, DestinationWindow xproto.Window) InputSelectedCo // InputSelectedUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func InputSelectedUnchecked(c *xgb.Conn, DestinationWindow xproto.Window) InputSelectedCookie { + if _, ok := c.Extensions["SHAPE"]; !ok { + panic("Cannot issue request 'InputSelected' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(inputSelectedRequest(c, DestinationWindow), cookie) return InputSelectedCookie{cookie} @@ -833,6 +881,9 @@ type GetRectanglesCookie struct { // GetRectangles sends a checked request. // If an error occurs, it will be returned with the reply by calling GetRectanglesCookie.Reply() func GetRectangles(c *xgb.Conn, Window xproto.Window, SourceKind Kind) GetRectanglesCookie { + if _, ok := c.Extensions["SHAPE"]; !ok { + panic("Cannot issue request 'GetRectangles' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(getRectanglesRequest(c, Window, SourceKind), cookie) return GetRectanglesCookie{cookie} @@ -841,6 +892,9 @@ func GetRectangles(c *xgb.Conn, Window xproto.Window, SourceKind Kind) GetRectan // GetRectanglesUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetRectanglesUnchecked(c *xgb.Conn, Window xproto.Window, SourceKind Kind) GetRectanglesCookie { + if _, ok := c.Extensions["SHAPE"]; !ok { + panic("Cannot issue request 'GetRectangles' using the uninitialized extension 'SHAPE'. shape.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(getRectanglesRequest(c, Window, SourceKind), cookie) return GetRectanglesCookie{cookie} -- cgit v1.2.3