aboutsummaryrefslogtreecommitdiff
path: root/nexgb
diff options
context:
space:
mode:
authorAndrew Gallant (Ocelot) <Andrew.Gallant@tufts.edu>2012-05-07 21:58:33 -0400
committerAndrew Gallant (Ocelot) <Andrew.Gallant@tufts.edu>2012-05-07 21:58:33 -0400
commit13d598e5e7f26bc6177ae3f7d52f4f19729ab2f3 (patch)
tree216dde82bd19b1beb01d9fd0654daa3538e73f92 /nexgb
parentdaad54a5e114dcff9ef62abbbd18ea52929d01e5 (diff)
downloadhaven-13d598e5e7f26bc6177ae3f7d52f4f19729ab2f3.tar.gz
haven-13d598e5e7f26bc6177ae3f7d52f4f19729ab2f3.tar.xz
haven-13d598e5e7f26bc6177ae3f7d52f4f19729ab2f3.zip
more clean up. use log instead of fmt.Print to stderr. bug fix for event blocking (a hack fix for now).
Diffstat (limited to 'nexgb')
-rw-r--r--nexgb/Makefile6
-rw-r--r--nexgb/README3
-rw-r--r--nexgb/auto_bigreq.go28
-rw-r--r--nexgb/auto_composite.go12
-rw-r--r--nexgb/auto_damage.go26
-rw-r--r--nexgb/auto_dpms.go8
-rw-r--r--nexgb/auto_dri2.go12
-rw-r--r--nexgb/auto_ge.go16
-rw-r--r--nexgb/auto_glx.go58
-rw-r--r--nexgb/auto_randr.go18
-rw-r--r--nexgb/auto_record.go30
-rw-r--r--nexgb/auto_render.go30
-rw-r--r--nexgb/auto_res.go24
-rw-r--r--nexgb/auto_screensaver.go28
-rw-r--r--nexgb/auto_shape.go20
-rw-r--r--nexgb/auto_shm.go22
-rw-r--r--nexgb/auto_sync.go32
-rw-r--r--nexgb/auto_xc_misc.go16
-rw-r--r--nexgb/auto_xevie.go12
-rw-r--r--nexgb/auto_xf86dri.go8
-rw-r--r--nexgb/auto_xf86vidmode.go42
-rw-r--r--nexgb/auto_xfixes.go34
-rw-r--r--nexgb/auto_xinerama.go12
-rw-r--r--nexgb/auto_xinput.go38
-rw-r--r--nexgb/auto_xprint.go12
-rw-r--r--nexgb/auto_xproto.go14
-rw-r--r--nexgb/auto_xselinux.go16
-rw-r--r--nexgb/auto_xtest.go12
-rw-r--r--nexgb/auto_xv.go26
-rw-r--r--nexgb/auto_xvmc.go12
-rw-r--r--nexgb/xgb.go117
-rw-r--r--nexgb/xgb_help.go7
-rw-r--r--nexgb/xgb_test.go18
-rw-r--r--nexgb/xgbgen/context.go7
-rw-r--r--nexgb/xgbgen/go_error.go14
35 files changed, 481 insertions, 309 deletions
diff --git a/nexgb/Makefile b/nexgb/Makefile
index 7ba1cb4..56738f4 100644
--- a/nexgb/Makefile
+++ b/nexgb/Makefile
@@ -5,13 +5,17 @@
XPROTO=/usr/share/xcb
# All of the XML files in my /usr/share/xcb directory EXCEPT XKB. -_-
-all: bigreq.xml composite.xml damage.xml dpms.xml dri2.xml \
+all: build-xgbgen \
+ bigreq.xml composite.xml damage.xml dpms.xml dri2.xml \
ge.xml glx.xml randr.xml record.xml render.xml res.xml \
screensaver.xml shape.xml shm.xml sync.xml xc_misc.xml \
xevie.xml xf86dri.xml xf86vidmode.xml xfixes.xml xinerama.xml \
xinput.xml xprint.xml xproto.xml xselinux.xml xtest.xml \
xvmc.xml xv.xml
+build-xgbgen:
+ (cd xgbgen && go build)
+
%.xml:
xgbgen/xgbgen --proto-path $(XPROTO) $(XPROTO)/$*.xml > auto_$*.go
diff --git a/nexgb/README b/nexgb/README
index f5862b1..22aded8 100644
--- a/nexgb/README
+++ b/nexgb/README
@@ -7,6 +7,9 @@ GOMAXPROCS > 1. (See the benchmarks in xgb_test.go for evidence.)
Please see doc.go for more info.
+Note that unless you know you need XGB, you can probably make your life
+easier by using a slightly higher level library: xgbutil.
+
BurntSushi's Fork
=================
I've forked the XGB repository from Google Code due to inactivty upstream.
diff --git a/nexgb/auto_bigreq.go b/nexgb/auto_bigreq.go
index 3389470..c1eb4d0 100644
--- a/nexgb/auto_bigreq.go
+++ b/nexgb/auto_bigreq.go
@@ -1,7 +1,7 @@
package xgb
/*
- This file was generated by bigreq.xml on May 6 2012 5:48:46pm EDT.
+ This file was generated by bigreq.xml on May 7 2012 9:17:56pm EDT.
This file is automatically generated. Edit at your peril!
*/
@@ -12,7 +12,7 @@ func (c *Conn) BigreqInit() error {
case err != nil:
return err
case !reply.Present:
- return newError("No extension named BIG-REQUESTS could be found on on the server.")
+ return errorf("No extension named BIG-REQUESTS could be found on on the server.")
}
c.extLock.Lock()
@@ -20,6 +20,9 @@ func (c *Conn) BigreqInit() error {
for evNum, fun := range newExtEventFuncs["BIG-REQUESTS"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun
}
+ for errNum, fun := range newExtErrorFuncs["BIG-REQUESTS"] {
+ newErrorFuncs[int(reply.FirstError)+errNum] = fun
+ }
c.extLock.Unlock()
return nil
@@ -27,8 +30,19 @@ func (c *Conn) BigreqInit() error {
func init() {
newExtEventFuncs["BIG-REQUESTS"] = make(map[int]newEventFun)
+ newExtErrorFuncs["BIG-REQUESTS"] = make(map[int]newErrorFun)
}
+// Skipping definition for base type 'Card16'
+
+// Skipping definition for base type 'Char'
+
+// Skipping definition for base type 'Card32'
+
+// Skipping definition for base type 'Double'
+
+// Skipping definition for base type 'Bool'
+
// Skipping definition for base type 'Float'
// Skipping definition for base type 'Id'
@@ -45,16 +59,6 @@ func init() {
// 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'
-
-// Skipping definition for base type 'Bool'
-
// Request BigreqEnable
// size: 4
type BigreqEnableCookie struct {
diff --git a/nexgb/auto_composite.go b/nexgb/auto_composite.go
index aec15c9..4262468 100644
--- a/nexgb/auto_composite.go
+++ b/nexgb/auto_composite.go
@@ -1,7 +1,7 @@
package xgb
/*
- This file was generated by composite.xml on May 6 2012 5:48:46pm EDT.
+ This file was generated by composite.xml on May 7 2012 9:17:56pm EDT.
This file is automatically generated. Edit at your peril!
*/
@@ -17,7 +17,7 @@ func (c *Conn) CompositeInit() error {
case err != nil:
return err
case !reply.Present:
- return newError("No extension named Composite could be found on on the server.")
+ return errorf("No extension named Composite could be found on on the server.")
}
c.extLock.Lock()
@@ -25,6 +25,9 @@ func (c *Conn) CompositeInit() error {
for evNum, fun := range newExtEventFuncs["Composite"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun
}
+ for errNum, fun := range newExtErrorFuncs["Composite"] {
+ newErrorFuncs[int(reply.FirstError)+errNum] = fun
+ }
c.extLock.Unlock()
return nil
@@ -32,8 +35,11 @@ func (c *Conn) CompositeInit() error {
func init() {
newExtEventFuncs["Composite"] = make(map[int]newEventFun)
+ newExtErrorFuncs["Composite"] = make(map[int]newErrorFun)
}
+// Skipping definition for base type 'Int32'
+
// Skipping definition for base type 'Void'
// Skipping definition for base type 'Byte'
@@ -58,8 +64,6 @@ func init() {
// Skipping definition for base type 'Int16'
-// Skipping definition for base type 'Int32'
-
const (
CompositeRedirectAutomatic = 0
CompositeRedirectManual = 1
diff --git a/nexgb/auto_damage.go b/nexgb/auto_damage.go
index 8339e6a..c3d2734 100644
--- a/nexgb/auto_damage.go
+++ b/nexgb/auto_damage.go
@@ -1,7 +1,7 @@
package xgb
/*
- This file was generated by damage.xml on May 6 2012 5:48:47pm EDT.
+ This file was generated by damage.xml on May 7 2012 9:17:56pm EDT.
This file is automatically generated. Edit at your peril!
*/
@@ -17,7 +17,7 @@ func (c *Conn) DamageInit() error {
case err != nil:
return err
case !reply.Present:
- return newError("No extension named DAMAGE could be found on on the server.")
+ return errorf("No extension named DAMAGE could be found on on the server.")
}
c.extLock.Lock()
@@ -25,6 +25,9 @@ func (c *Conn) DamageInit() error {
for evNum, fun := range newExtEventFuncs["DAMAGE"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun
}
+ for errNum, fun := range newExtErrorFuncs["DAMAGE"] {
+ newErrorFuncs[int(reply.FirstError)+errNum] = fun
+ }
c.extLock.Unlock()
return nil
@@ -32,8 +35,17 @@ func (c *Conn) DamageInit() error {
func init() {
newExtEventFuncs["DAMAGE"] = make(map[int]newEventFun)
+ newExtErrorFuncs["DAMAGE"] = make(map[int]newErrorFun)
}
+// Skipping definition for base type 'Card16'
+
+// Skipping definition for base type 'Char'
+
+// Skipping definition for base type 'Card32'
+
+// Skipping definition for base type 'Double'
+
// Skipping definition for base type 'Bool'
// Skipping definition for base type 'Float'
@@ -52,14 +64,6 @@ func init() {
// 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'
-
const (
DamageReportLevelRawRectangles = 0
DamageReportLevelDeltaRectangles = 1
@@ -213,7 +217,7 @@ func (err DamageBadDamageError) Error() string {
}
func init() {
- newErrorFuncs[0] = NewDamageBadDamageError
+ newExtErrorFuncs["DAMAGE"][0] = NewDamageBadDamageError
}
// Request DamageQueryVersion
diff --git a/nexgb/auto_dpms.go b/nexgb/auto_dpms.go
index eee6688..5200bfa 100644
--- a/nexgb/auto_dpms.go
+++ b/nexgb/auto_dpms.go
@@ -1,7 +1,7 @@
package xgb
/*
- This file was generated by dpms.xml on May 6 2012 5:48:47pm EDT.
+ This file was generated by dpms.xml on May 7 2012 9:17:56pm EDT.
This file is automatically generated. Edit at your peril!
*/
@@ -12,7 +12,7 @@ func (c *Conn) DpmsInit() error {
case err != nil:
return err
case !reply.Present:
- return newError("No extension named DPMS could be found on on the server.")
+ return errorf("No extension named DPMS could be found on on the server.")
}
c.extLock.Lock()
@@ -20,6 +20,9 @@ func (c *Conn) DpmsInit() error {
for evNum, fun := range newExtEventFuncs["DPMS"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun
}
+ for errNum, fun := range newExtErrorFuncs["DPMS"] {
+ newErrorFuncs[int(reply.FirstError)+errNum] = fun
+ }
c.extLock.Unlock()
return nil
@@ -27,6 +30,7 @@ func (c *Conn) DpmsInit() error {
func init() {
newExtEventFuncs["DPMS"] = make(map[int]newEventFun)
+ newExtErrorFuncs["DPMS"] = make(map[int]newErrorFun)
}
// Skipping definition for base type 'Int32'
diff --git a/nexgb/auto_dri2.go b/nexgb/auto_dri2.go
index 0712891..68d6084 100644
--- a/nexgb/auto_dri2.go
+++ b/nexgb/auto_dri2.go
@@ -1,7 +1,7 @@
package xgb
/*
- This file was generated by dri2.xml on May 6 2012 5:48:47pm EDT.
+ This file was generated by dri2.xml on May 7 2012 9:17:56pm EDT.
This file is automatically generated. Edit at your peril!
*/
@@ -16,7 +16,7 @@ func (c *Conn) Dri2Init() error {
case err != nil:
return err
case !reply.Present:
- return newError("No extension named DRI2 could be found on on the server.")
+ return errorf("No extension named DRI2 could be found on on the server.")
}
c.extLock.Lock()
@@ -24,6 +24,9 @@ func (c *Conn) Dri2Init() error {
for evNum, fun := range newExtEventFuncs["DRI2"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun
}
+ for errNum, fun := range newExtErrorFuncs["DRI2"] {
+ newErrorFuncs[int(reply.FirstError)+errNum] = fun
+ }
c.extLock.Unlock()
return nil
@@ -31,10 +34,9 @@ func (c *Conn) Dri2Init() error {
func init() {
newExtEventFuncs["DRI2"] = make(map[int]newEventFun)
+ newExtErrorFuncs["DRI2"] = make(map[int]newErrorFun)
}
-// Skipping definition for base type 'Float'
-
// Skipping definition for base type 'Id'
// Skipping definition for base type 'Card8'
@@ -59,6 +61,8 @@ func init() {
// Skipping definition for base type 'Bool'
+// Skipping definition for base type 'Float'
+
const (
Dri2AttachmentBufferFrontLeft = 0
Dri2AttachmentBufferBackLeft = 1
diff --git a/nexgb/auto_ge.go b/nexgb/auto_ge.go
index 9a06265..ef80ebf 100644
--- a/nexgb/auto_ge.go
+++ b/nexgb/auto_ge.go
@@ -1,7 +1,7 @@
package xgb
/*
- This file was generated by ge.xml on May 6 2012 5:48:47pm EDT.
+ This file was generated by ge.xml on May 7 2012 9:17:56pm EDT.
This file is automatically generated. Edit at your peril!
*/
@@ -12,7 +12,7 @@ func (c *Conn) GeInit() error {
case err != nil:
return err
case !reply.Present:
- return newError("No extension named Generic Event Extension could be found on on the server.")
+ return errorf("No extension named Generic Event Extension could be found on on the server.")
}
c.extLock.Lock()
@@ -20,6 +20,9 @@ func (c *Conn) GeInit() error {
for evNum, fun := range newExtEventFuncs["Generic Event Extension"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun
}
+ for errNum, fun := range newExtErrorFuncs["Generic Event Extension"] {
+ newErrorFuncs[int(reply.FirstError)+errNum] = fun
+ }
c.extLock.Unlock()
return nil
@@ -27,12 +30,9 @@ func (c *Conn) GeInit() error {
func init() {
newExtEventFuncs["Generic Event Extension"] = make(map[int]newEventFun)
+ newExtErrorFuncs["Generic Event Extension"] = make(map[int]newErrorFun)
}
-// Skipping definition for base type 'Void'
-
-// Skipping definition for base type 'Byte'
-
// Skipping definition for base type 'Int8'
// Skipping definition for base type 'Card16'
@@ -55,6 +55,10 @@ func init() {
// Skipping definition for base type 'Int32'
+// Skipping definition for base type 'Void'
+
+// Skipping definition for base type 'Byte'
+
// Request GeQueryVersion
// size: 8
type GeQueryVersionCookie struct {
diff --git a/nexgb/auto_glx.go b/nexgb/auto_glx.go
index 1b88e6c..67c79d7 100644
--- a/nexgb/auto_glx.go
+++ b/nexgb/auto_glx.go
@@ -1,7 +1,7 @@
package xgb
/*
- This file was generated by glx.xml on May 6 2012 5:48:47pm EDT.
+ This file was generated by glx.xml on May 7 2012 9:17:56pm EDT.
This file is automatically generated. Edit at your peril!
*/
@@ -16,7 +16,7 @@ func (c *Conn) GlxInit() error {
case err != nil:
return err
case !reply.Present:
- return newError("No extension named GLX could be found on on the server.")
+ return errorf("No extension named GLX could be found on on the server.")
}
c.extLock.Lock()
@@ -24,6 +24,9 @@ func (c *Conn) GlxInit() error {
for evNum, fun := range newExtEventFuncs["GLX"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun
}
+ for errNum, fun := range newExtErrorFuncs["GLX"] {
+ newErrorFuncs[int(reply.FirstError)+errNum] = fun
+ }
c.extLock.Unlock()
return nil
@@ -31,8 +34,19 @@ func (c *Conn) GlxInit() error {
func init() {
newExtEventFuncs["GLX"] = make(map[int]newEventFun)
+ newExtErrorFuncs["GLX"] = make(map[int]newErrorFun)
}
+// Skipping definition for base type 'Card16'
+
+// Skipping definition for base type 'Char'
+
+// Skipping definition for base type 'Card32'
+
+// Skipping definition for base type 'Double'
+
+// Skipping definition for base type 'Bool'
+
// Skipping definition for base type 'Float'
// Skipping definition for base type 'Id'
@@ -49,16 +63,6 @@ func init() {
// 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'
-
-// Skipping definition for base type 'Bool'
-
const (
GlxPbcetDamaged = 32791
GlxPbcetSaved = 32792
@@ -319,7 +323,7 @@ func (err GlxGenericError) Error() string {
}
func init() {
- newErrorFuncs[-1] = NewGlxGenericError
+ newExtErrorFuncs["GLX"][-1] = NewGlxGenericError
}
// ErrorCopy definition GlxBadContext (0)
@@ -355,7 +359,7 @@ func (err GlxBadContextError) Error() string {
}
func init() {
- newErrorFuncs[0] = NewGlxBadContextError
+ newExtErrorFuncs["GLX"][0] = NewGlxBadContextError
}
// ErrorCopy definition GlxBadContextState (1)
@@ -391,7 +395,7 @@ func (err GlxBadContextStateError) Error() string {
}
func init() {
- newErrorFuncs[1] = NewGlxBadContextStateError
+ newExtErrorFuncs["GLX"][1] = NewGlxBadContextStateError
}
// ErrorCopy definition GlxBadDrawable (2)
@@ -427,7 +431,7 @@ func (err GlxBadDrawableError) Error() string {
}
func init() {
- newErrorFuncs[2] = NewGlxBadDrawableError
+ newExtErrorFuncs["GLX"][2] = NewGlxBadDrawableError
}
// ErrorCopy definition GlxBadPixmap (3)
@@ -463,7 +467,7 @@ func (err GlxBadPixmapError) Error() string {
}
func init() {
- newErrorFuncs[3] = NewGlxBadPixmapError
+ newExtErrorFuncs["GLX"][3] = NewGlxBadPixmapError
}
// ErrorCopy definition GlxBadContextTag (4)
@@ -499,7 +503,7 @@ func (err GlxBadContextTagError) Error() string {
}
func init() {
- newErrorFuncs[4] = NewGlxBadContextTagError
+ newExtErrorFuncs["GLX"][4] = NewGlxBadContextTagError
}
// ErrorCopy definition GlxBadCurrentWindow (5)
@@ -535,7 +539,7 @@ func (err GlxBadCurrentWindowError) Error() string {
}
func init() {
- newErrorFuncs[5] = NewGlxBadCurrentWindowError
+ newExtErrorFuncs["GLX"][5] = NewGlxBadCurrentWindowError
}
// ErrorCopy definition GlxBadRenderRequest (6)
@@ -571,7 +575,7 @@ func (err GlxBadRenderRequestError) Error() string {
}
func init() {
- newErrorFuncs[6] = NewGlxBadRenderRequestError
+ newExtErrorFuncs["GLX"][6] = NewGlxBadRenderRequestError
}
// ErrorCopy definition GlxBadLargeRequest (7)
@@ -607,7 +611,7 @@ func (err GlxBadLargeRequestError) Error() string {
}
func init() {
- newErrorFuncs[7] = NewGlxBadLargeRequestError
+ newExtErrorFuncs["GLX"][7] = NewGlxBadLargeRequestError
}
// ErrorCopy definition GlxUnsupportedPrivateRequest (8)
@@ -643,7 +647,7 @@ func (err GlxUnsupportedPrivateRequestError) Error() string {
}
func init() {
- newErrorFuncs[8] = NewGlxUnsupportedPrivateRequestError
+ newExtErrorFuncs["GLX"][8] = NewGlxUnsupportedPrivateRequestError
}
// ErrorCopy definition GlxBadFBConfig (9)
@@ -679,7 +683,7 @@ func (err GlxBadFBConfigError) Error() string {
}
func init() {
- newErrorFuncs[9] = NewGlxBadFBConfigError
+ newExtErrorFuncs["GLX"][9] = NewGlxBadFBConfigError
}
// ErrorCopy definition GlxBadPbuffer (10)
@@ -715,7 +719,7 @@ func (err GlxBadPbufferError) Error() string {
}
func init() {
- newErrorFuncs[10] = NewGlxBadPbufferError
+ newExtErrorFuncs["GLX"][10] = NewGlxBadPbufferError
}
// ErrorCopy definition GlxBadCurrentDrawable (11)
@@ -751,7 +755,7 @@ func (err GlxBadCurrentDrawableError) Error() string {
}
func init() {
- newErrorFuncs[11] = NewGlxBadCurrentDrawableError
+ newExtErrorFuncs["GLX"][11] = NewGlxBadCurrentDrawableError
}
// ErrorCopy definition GlxBadWindow (12)
@@ -787,7 +791,7 @@ func (err GlxBadWindowError) Error() string {
}
func init() {
- newErrorFuncs[12] = NewGlxBadWindowError
+ newExtErrorFuncs["GLX"][12] = NewGlxBadWindowError
}
// ErrorCopy definition GlxGLXBadProfileARB (13)
@@ -823,7 +827,7 @@ func (err GlxGLXBadProfileARBError) Error() string {
}
func init() {
- newErrorFuncs[13] = NewGlxGLXBadProfileARBError
+ newExtErrorFuncs["GLX"][13] = NewGlxGLXBadProfileARBError
}
// Request GlxRender
diff --git a/nexgb/auto_randr.go b/nexgb/auto_randr.go
index cc5e760..4e707e6 100644
--- a/nexgb/auto_randr.go
+++ b/nexgb/auto_randr.go
@@ -1,7 +1,7 @@
package xgb
/*
- This file was generated by randr.xml on May 6 2012 5:48:47pm EDT.
+ This file was generated by randr.xml on May 7 2012 9:17:56pm EDT.
This file is automatically generated. Edit at your peril!
*/
@@ -17,7 +17,7 @@ func (c *Conn) RandrInit() error {
case err != nil:
return err
case !reply.Present:
- return newError("No extension named RANDR could be found on on the server.")
+ return errorf("No extension named RANDR could be found on on the server.")
}
c.extLock.Lock()
@@ -25,6 +25,9 @@ func (c *Conn) RandrInit() error {
for evNum, fun := range newExtEventFuncs["RANDR"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun
}
+ for errNum, fun := range newExtErrorFuncs["RANDR"] {
+ newErrorFuncs[int(reply.FirstError)+errNum] = fun
+ }
c.extLock.Unlock()
return nil
@@ -32,8 +35,11 @@ func (c *Conn) RandrInit() error {
func init() {
newExtEventFuncs["RANDR"] = make(map[int]newEventFun)
+ newExtErrorFuncs["RANDR"] = make(map[int]newErrorFun)
}
+// Skipping definition for base type 'Int8'
+
// Skipping definition for base type 'Card16'
// Skipping definition for base type 'Char'
@@ -58,8 +64,6 @@ func init() {
// Skipping definition for base type 'Byte'
-// Skipping definition for base type 'Int8'
-
const (
RandrRotationRotate0 = 1
RandrRotationRotate90 = 2
@@ -1100,7 +1104,7 @@ func (err RandrBadOutputError) Error() string {
}
func init() {
- newErrorFuncs[0] = NewRandrBadOutputError
+ newExtErrorFuncs["RANDR"][0] = NewRandrBadOutputError
}
// Error definition RandrBadCrtc (1)
@@ -1145,7 +1149,7 @@ func (err RandrBadCrtcError) Error() string {
}
func init() {
- newErrorFuncs[1] = NewRandrBadCrtcError
+ newExtErrorFuncs["RANDR"][1] = NewRandrBadCrtcError
}
// Error definition RandrBadMode (2)
@@ -1190,7 +1194,7 @@ func (err RandrBadModeError) Error() string {
}
func init() {
- newErrorFuncs[2] = NewRandrBadModeError
+ newExtErrorFuncs["RANDR"][2] = NewRandrBadModeError
}
// Request RandrQueryVersion
diff --git a/nexgb/auto_record.go b/nexgb/auto_record.go
index 6fb966b..32e1715 100644
--- a/nexgb/auto_record.go
+++ b/nexgb/auto_record.go
@@ -1,7 +1,7 @@
package xgb
/*
- This file was generated by record.xml on May 6 2012 5:48:47pm EDT.
+ This file was generated by record.xml on May 7 2012 9:17:57pm EDT.
This file is automatically generated. Edit at your peril!
*/
@@ -12,7 +12,7 @@ func (c *Conn) RecordInit() error {
case err != nil:
return err
case !reply.Present:
- return newError("No extension named RECORD could be found on on the server.")
+ return errorf("No extension named RECORD could be found on on the server.")
}
c.extLock.Lock()
@@ -20,6 +20,9 @@ func (c *Conn) RecordInit() error {
for evNum, fun := range newExtEventFuncs["RECORD"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun
}
+ for errNum, fun := range newExtErrorFuncs["RECORD"] {
+ newErrorFuncs[int(reply.FirstError)+errNum] = fun
+ }
c.extLock.Unlock()
return nil
@@ -27,8 +30,19 @@ func (c *Conn) RecordInit() error {
func init() {
newExtEventFuncs["RECORD"] = make(map[int]newEventFun)
+ newExtErrorFuncs["RECORD"] = make(map[int]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'
+
+// Skipping definition for base type 'Byte'
+
// Skipping definition for base type 'Int8'
// Skipping definition for base type 'Card16'
@@ -45,16 +59,6 @@ func init() {
// Skipping definition for base type 'Id'
-// 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'
-
const (
RecordHTypeFromServerTime = 1
RecordHTypeFromClientTime = 2
@@ -507,7 +511,7 @@ func (err RecordBadContextError) Error() string {
}
func init() {
- newErrorFuncs[0] = NewRecordBadContextError
+ newExtErrorFuncs["RECORD"][0] = NewRecordBadContextError
}
// Request RecordQueryVersion
diff --git a/nexgb/auto_render.go b/nexgb/auto_render.go
index c9fc097..fa0c5f2 100644
--- a/nexgb/auto_render.go
+++ b/nexgb/auto_render.go
@@ -1,7 +1,7 @@
package xgb
/*
- This file was generated by render.xml on May 6 2012 5:48:47pm EDT.
+ This file was generated by render.xml on May 7 2012 9:17:57pm EDT.
This file is automatically generated. Edit at your peril!
*/
@@ -16,7 +16,7 @@ func (c *Conn) RenderInit() error {
case err != nil:
return err
case !reply.Present:
- return newError("No extension named RENDER could be found on on the server.")
+ return errorf("No extension named RENDER could be found on on the server.")
}
c.extLock.Lock()
@@ -24,6 +24,9 @@ func (c *Conn) RenderInit() error {
for evNum, fun := range newExtEventFuncs["RENDER"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun
}
+ for errNum, fun := range newExtErrorFuncs["RENDER"] {
+ newErrorFuncs[int(reply.FirstError)+errNum] = fun
+ }
c.extLock.Unlock()
return nil
@@ -31,14 +34,9 @@ func (c *Conn) RenderInit() error {
func init() {
newExtEventFuncs["RENDER"] = make(map[int]newEventFun)
+ newExtErrorFuncs["RENDER"] = make(map[int]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'
@@ -59,6 +57,12 @@ 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'
+
const (
RenderPictTypeIndexed = 0
RenderPictTypeDirect = 1
@@ -1392,7 +1396,7 @@ func (err RenderPictFormatError) Error() string {
}
func init() {
- newErrorFuncs[0] = NewRenderPictFormatError
+ newExtErrorFuncs["RENDER"][0] = NewRenderPictFormatError
}
// Error definition RenderPicture (1)
@@ -1437,7 +1441,7 @@ func (err RenderPictureError) Error() string {
}
func init() {
- newErrorFuncs[1] = NewRenderPictureError
+ newExtErrorFuncs["RENDER"][1] = NewRenderPictureError
}
// Error definition RenderPictOp (2)
@@ -1482,7 +1486,7 @@ func (err RenderPictOpError) Error() string {
}
func init() {
- newErrorFuncs[2] = NewRenderPictOpError
+ newExtErrorFuncs["RENDER"][2] = NewRenderPictOpError
}
// Error definition RenderGlyphSet (3)
@@ -1527,7 +1531,7 @@ func (err RenderGlyphSetError) Error() string {
}
func init() {
- newErrorFuncs[3] = NewRenderGlyphSetError
+ newExtErrorFuncs["RENDER"][3] = NewRenderGlyphSetError
}
// Error definition RenderGlyph (4)
@@ -1572,7 +1576,7 @@ func (err RenderGlyphError) Error() string {
}
func init() {
- newErrorFuncs[4] = NewRenderGlyphError
+ newExtErrorFuncs["RENDER"][4] = NewRenderGlyphError
}
// Request RenderQueryVersion
diff --git a/nexgb/auto_res.go b/nexgb/auto_res.go
index d3f0f0b..eeaf01f 100644
--- a/nexgb/auto_res.go
+++ b/nexgb/auto_res.go
@@ -1,7 +1,7 @@
package xgb
/*
- This file was generated by res.xml on May 6 2012 5:48:47pm EDT.
+ This file was generated by res.xml on May 7 2012 9:17:57pm EDT.
This file is automatically generated. Edit at your peril!
*/
@@ -16,7 +16,7 @@ func (c *Conn) ResInit() error {
case err != nil:
return err
case !reply.Present:
- return newError("No extension named X-Resource could be found on on the server.")
+ return errorf("No extension named X-Resource could be found on on the server.")
}
c.extLock.Lock()
@@ -24,6 +24,9 @@ func (c *Conn) ResInit() error {
for evNum, fun := range newExtEventFuncs["X-Resource"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun
}
+ for errNum, fun := range newExtErrorFuncs["X-Resource"] {
+ newErrorFuncs[int(reply.FirstError)+errNum] = fun
+ }
c.extLock.Unlock()
return nil
@@ -31,16 +34,9 @@ func (c *Conn) ResInit() error {
func init() {
newExtEventFuncs["X-Resource"] = make(map[int]newEventFun)
+ newExtErrorFuncs["X-Resource"] = make(map[int]newErrorFun)
}
-// Skipping definition for base type 'Id'
-
-// 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'
@@ -59,6 +55,14 @@ func init() {
// Skipping definition for base type 'Float'
+// Skipping definition for base type 'Id'
+
+// Skipping definition for base type 'Card8'
+
+// Skipping definition for base type 'Int16'
+
+// Skipping definition for base type 'Int32'
+
// 'ResClient' struct definition
// Size: 8
type ResClient struct {
diff --git a/nexgb/auto_screensaver.go b/nexgb/auto_screensaver.go
index 1e47b91..13aa818 100644
--- a/nexgb/auto_screensaver.go
+++ b/nexgb/auto_screensaver.go
@@ -1,7 +1,7 @@
package xgb
/*
- This file was generated by screensaver.xml on May 6 2012 5:48:47pm EDT.
+ This file was generated by screensaver.xml on May 7 2012 9:17:57pm EDT.
This file is automatically generated. Edit at your peril!
*/
@@ -16,7 +16,7 @@ func (c *Conn) ScreensaverInit() error {
case err != nil:
return err
case !reply.Present:
- return newError("No extension named MIT-SCREEN-SAVER could be found on on the server.")
+ return errorf("No extension named MIT-SCREEN-SAVER could be found on on the server.")
}
c.extLock.Lock()
@@ -24,6 +24,9 @@ func (c *Conn) ScreensaverInit() error {
for evNum, fun := range newExtEventFuncs["MIT-SCREEN-SAVER"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun
}
+ for errNum, fun := range newExtErrorFuncs["MIT-SCREEN-SAVER"] {
+ newErrorFuncs[int(reply.FirstError)+errNum] = fun
+ }
c.extLock.Unlock()
return nil
@@ -31,18 +34,9 @@ func (c *Conn) ScreensaverInit() error {
func init() {
newExtEventFuncs["MIT-SCREEN-SAVER"] = make(map[int]newEventFun)
+ newExtErrorFuncs["MIT-SCREEN-SAVER"] = make(map[int]newErrorFun)
}
-// 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'
// Skipping definition for base type 'Char'
@@ -59,6 +53,16 @@ func init() {
// 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'
+
const (
ScreensaverKindBlanked = 0
ScreensaverKindInternal = 1
diff --git a/nexgb/auto_shape.go b/nexgb/auto_shape.go
index a28836c..4b52a5d 100644
--- a/nexgb/auto_shape.go
+++ b/nexgb/auto_shape.go
@@ -1,7 +1,7 @@
package xgb
/*
- This file was generated by shape.xml on May 6 2012 5:48:47pm EDT.
+ This file was generated by shape.xml on May 7 2012 9:17:57pm EDT.
This file is automatically generated. Edit at your peril!
*/
@@ -16,7 +16,7 @@ func (c *Conn) ShapeInit() error {
case err != nil:
return err
case !reply.Present:
- return newError("No extension named SHAPE could be found on on the server.")
+ return errorf("No extension named SHAPE could be found on on the server.")
}
c.extLock.Lock()
@@ -24,6 +24,9 @@ func (c *Conn) ShapeInit() error {
for evNum, fun := range newExtEventFuncs["SHAPE"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun
}
+ for errNum, fun := range newExtErrorFuncs["SHAPE"] {
+ newErrorFuncs[int(reply.FirstError)+errNum] = fun
+ }
c.extLock.Unlock()
return nil
@@ -31,8 +34,15 @@ func (c *Conn) ShapeInit() error {
func init() {
newExtEventFuncs["SHAPE"] = make(map[int]newEventFun)
+ newExtErrorFuncs["SHAPE"] = make(map[int]newErrorFun)
}
+// Skipping definition for base type 'Void'
+
+// Skipping definition for base type 'Byte'
+
+// Skipping definition for base type 'Int8'
+
// Skipping definition for base type 'Card16'
// Skipping definition for base type 'Char'
@@ -53,12 +63,6 @@ func init() {
// Skipping definition for base type 'Int32'
-// Skipping definition for base type 'Void'
-
-// Skipping definition for base type 'Byte'
-
-// Skipping definition for base type 'Int8'
-
const (
ShapeSoSet = 0
ShapeSoUnion = 1
diff --git a/nexgb/auto_shm.go b/nexgb/auto_shm.go
index 514dc03..a6d64a2 100644
--- a/nexgb/auto_shm.go
+++ b/nexgb/auto_shm.go
@@ -1,7 +1,7 @@
package xgb
/*
- This file was generated by shm.xml on May 6 2012 5:48:47pm EDT.
+ This file was generated by shm.xml on May 7 2012 9:17:57pm EDT.
This file is automatically generated. Edit at your peril!
*/
@@ -16,7 +16,7 @@ func (c *Conn) ShmInit() error {
case err != nil:
return err
case !reply.Present:
- return newError("No extension named MIT-SHM could be found on on the server.")
+ return errorf("No extension named MIT-SHM could be found on on the server.")
}
c.extLock.Lock()
@@ -24,6 +24,9 @@ func (c *Conn) ShmInit() error {
for evNum, fun := range newExtEventFuncs["MIT-SHM"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun
}
+ for errNum, fun := range newExtErrorFuncs["MIT-SHM"] {
+ newErrorFuncs[int(reply.FirstError)+errNum] = fun
+ }
c.extLock.Unlock()
return nil
@@ -31,8 +34,15 @@ func (c *Conn) ShmInit() error {
func init() {
newExtEventFuncs["MIT-SHM"] = make(map[int]newEventFun)
+ newExtErrorFuncs["MIT-SHM"] = make(map[int]newErrorFun)
}
+// Skipping definition for base type 'Card32'
+
+// Skipping definition for base type 'Double'
+
+// Skipping definition for base type 'Bool'
+
// Skipping definition for base type 'Float'
// Skipping definition for base type 'Id'
@@ -53,12 +63,6 @@ func init() {
// Skipping definition for base type 'Char'
-// Skipping definition for base type 'Card32'
-
-// Skipping definition for base type 'Double'
-
-// Skipping definition for base type 'Bool'
-
// Skipping resource definition of 'Seg'
// Event definition ShmCompletion (0)
@@ -194,7 +198,7 @@ func (err ShmBadSegError) Error() string {
}
func init() {
- newErrorFuncs[0] = NewShmBadSegError
+ newExtErrorFuncs["MIT-SHM"][0] = NewShmBadSegError
}
// Request ShmQueryVersion
diff --git a/nexgb/auto_sync.go b/nexgb/auto_sync.go
index a59cf20..ef69ebe 100644
--- a/nexgb/auto_sync.go
+++ b/nexgb/auto_sync.go
@@ -1,7 +1,7 @@
package xgb
/*
- This file was generated by sync.xml on May 6 2012 5:48:47pm EDT.
+ This file was generated by sync.xml on May 7 2012 9:17:57pm EDT.
This file is automatically generated. Edit at your peril!
*/
@@ -16,7 +16,7 @@ func (c *Conn) SyncInit() error {
case err != nil:
return err
case !reply.Present:
- return newError("No extension named SYNC could be found on on the server.")
+ return errorf("No extension named SYNC could be found on on the server.")
}
c.extLock.Lock()
@@ -24,6 +24,9 @@ func (c *Conn) SyncInit() error {
for evNum, fun := range newExtEventFuncs["SYNC"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun
}
+ for errNum, fun := range newExtErrorFuncs["SYNC"] {
+ newErrorFuncs[int(reply.FirstError)+errNum] = fun
+ }
c.extLock.Unlock()
return nil
@@ -31,8 +34,19 @@ func (c *Conn) SyncInit() error {
func init() {
newExtEventFuncs["SYNC"] = make(map[int]newEventFun)
+ newExtErrorFuncs["SYNC"] = make(map[int]newErrorFun)
}
+// Skipping definition for base type 'Card16'
+
+// Skipping definition for base type 'Char'
+
+// Skipping definition for base type 'Card32'
+
+// Skipping definition for base type 'Double'
+
+// Skipping definition for base type 'Bool'
+
// Skipping definition for base type 'Float'
// Skipping definition for base type 'Id'
@@ -49,16 +63,6 @@ func init() {
// 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'
-
-// Skipping definition for base type 'Bool'
-
const (
SyncAlarmstateActive = 0
SyncAlarmstateInactive = 1
@@ -656,7 +660,7 @@ func (err SyncCounterError) Error() string {
}
func init() {
- newErrorFuncs[0] = NewSyncCounterError
+ newExtErrorFuncs["SYNC"][0] = NewSyncCounterError
}
// Error definition SyncAlarm (1)
@@ -716,7 +720,7 @@ func (err SyncAlarmError) Error() string {
}
func init() {
- newErrorFuncs[1] = NewSyncAlarmError
+ newExtErrorFuncs["SYNC"][1] = NewSyncAlarmError
}
// Request SyncInitialize
diff --git a/nexgb/auto_xc_misc.go b/nexgb/auto_xc_misc.go
index 66ad03a..4d5c03c 100644
--- a/nexgb/auto_xc_misc.go
+++ b/nexgb/auto_xc_misc.go
@@ -1,7 +1,7 @@
package xgb
/*
- This file was generated by xc_misc.xml on May 6 2012 5:48:47pm EDT.
+ This file was generated by xc_misc.xml on May 7 2012 9:17:57pm EDT.
This file is automatically generated. Edit at your peril!
*/
@@ -12,7 +12,7 @@ func (c *Conn) Xc_miscInit() error {
case err != nil:
return err
case !reply.Present:
- return newError("No extension named XC-MISC could be found on on the server.")
+ return errorf("No extension named XC-MISC could be found on on the server.")
}
c.extLock.Lock()
@@ -20,6 +20,9 @@ func (c *Conn) Xc_miscInit() error {
for evNum, fun := range newExtEventFuncs["XC-MISC"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun
}
+ for errNum, fun := range newExtErrorFuncs["XC-MISC"] {
+ newErrorFuncs[int(reply.FirstError)+errNum] = fun
+ }
c.extLock.Unlock()
return nil
@@ -27,12 +30,9 @@ func (c *Conn) Xc_miscInit() error {
func init() {
newExtEventFuncs["XC-MISC"] = make(map[int]newEventFun)
+ newExtErrorFuncs["XC-MISC"] = make(map[int]newErrorFun)
}
-// Skipping definition for base type 'Byte'
-
-// Skipping definition for base type 'Int8'
-
// Skipping definition for base type 'Card16'
// Skipping definition for base type 'Char'
@@ -55,6 +55,10 @@ func init() {
// Skipping definition for base type 'Void'
+// Skipping definition for base type 'Byte'
+
+// Skipping definition for base type 'Int8'
+
// Request Xc_miscGetVersion
// size: 8
type Xc_miscGetVersionCookie struct {
diff --git a/nexgb/auto_xevie.go b/nexgb/auto_xevie.go
index eed775e..1046f1b 100644
--- a/nexgb/auto_xevie.go
+++ b/nexgb/auto_xevie.go
@@ -1,7 +1,7 @@
package xgb
/*
- This file was generated by xevie.xml on May 6 2012 5:48:47pm EDT.
+ This file was generated by xevie.xml on May 7 2012 9:17:57pm EDT.
This file is automatically generated. Edit at your peril!
*/
@@ -12,7 +12,7 @@ func (c *Conn) XevieInit() error {
case err != nil:
return err
case !reply.Present:
- return newError("No extension named XEVIE could be found on on the server.")
+ return errorf("No extension named XEVIE could be found on on the server.")
}
c.extLock.Lock()
@@ -20,6 +20,9 @@ func (c *Conn) XevieInit() error {
for evNum, fun := range newExtEventFuncs["XEVIE"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun
}
+ for errNum, fun := range newExtErrorFuncs["XEVIE"] {
+ newErrorFuncs[int(reply.FirstError)+errNum] = fun
+ }
c.extLock.Unlock()
return nil
@@ -27,10 +30,9 @@ func (c *Conn) XevieInit() error {
func init() {
newExtEventFuncs["XEVIE"] = make(map[int]newEventFun)
+ newExtErrorFuncs["XEVIE"] = make(map[int]newErrorFun)
}
-// Skipping definition for base type 'Float'
-
// Skipping definition for base type 'Id'
// Skipping definition for base type 'Card8'
@@ -55,6 +57,8 @@ func init() {
// Skipping definition for base type 'Bool'
+// Skipping definition for base type 'Float'
+
const (
XevieDatatypeUnmodified = 0
XevieDatatypeModified = 1
diff --git a/nexgb/auto_xf86dri.go b/nexgb/auto_xf86dri.go
index 7407d24..362fa40 100644
--- a/nexgb/auto_xf86dri.go
+++ b/nexgb/auto_xf86dri.go
@@ -1,7 +1,7 @@
package xgb
/*
- This file was generated by xf86dri.xml on May 6 2012 5:48:47pm EDT.
+ This file was generated by xf86dri.xml on May 7 2012 9:17:57pm EDT.
This file is automatically generated. Edit at your peril!
*/
@@ -12,7 +12,7 @@ func (c *Conn) Xf86driInit() error {
case err != nil:
return err
case !reply.Present:
- return newError("No extension named XFree86-DRI could be found on on the server.")
+ return errorf("No extension named XFree86-DRI could be found on on the server.")
}
c.extLock.Lock()
@@ -20,6 +20,9 @@ func (c *Conn) Xf86driInit() error {
for evNum, fun := range newExtEventFuncs["XFree86-DRI"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun
}
+ for errNum, fun := range newExtErrorFuncs["XFree86-DRI"] {
+ newErrorFuncs[int(reply.FirstError)+errNum] = fun
+ }
c.extLock.Unlock()
return nil
@@ -27,6 +30,7 @@ func (c *Conn) Xf86driInit() error {
func init() {
newExtEventFuncs["XFree86-DRI"] = make(map[int]newEventFun)
+ newExtErrorFuncs["XFree86-DRI"] = make(map[int]newErrorFun)
}
// Skipping definition for base type 'Int8'
diff --git a/nexgb/auto_xf86vidmode.go b/nexgb/auto_xf86vidmode.go
index 649244d..d44105d 100644
--- a/nexgb/auto_xf86vidmode.go
+++ b/nexgb/auto_xf86vidmode.go
@@ -1,7 +1,7 @@
package xgb
/*
- This file was generated by xf86vidmode.xml on May 6 2012 5:48:47pm EDT.
+ This file was generated by xf86vidmode.xml on May 7 2012 9:17:57pm EDT.
This file is automatically generated. Edit at your peril!
*/
@@ -12,7 +12,7 @@ func (c *Conn) Xf86vidmodeInit() error {
case err != nil:
return err
case !reply.Present:
- return newError("No extension named XFree86-VidModeExtension could be found on on the server.")
+ return errorf("No extension named XFree86-VidModeExtension could be found on on the server.")
}
c.extLock.Lock()
@@ -20,6 +20,9 @@ func (c *Conn) Xf86vidmodeInit() error {
for evNum, fun := range newExtEventFuncs["XFree86-VidModeExtension"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun
}
+ for errNum, fun := range newExtErrorFuncs["XFree86-VidModeExtension"] {
+ newErrorFuncs[int(reply.FirstError)+errNum] = fun
+ }
c.extLock.Unlock()
return nil
@@ -27,18 +30,9 @@ func (c *Conn) Xf86vidmodeInit() error {
func init() {
newExtEventFuncs["XFree86-VidModeExtension"] = make(map[int]newEventFun)
+ newExtErrorFuncs["XFree86-VidModeExtension"] = make(map[int]newErrorFun)
}
-// Skipping definition for base type 'Char'
-
-// Skipping definition for base type 'Card32'
-
-// Skipping definition for base type 'Double'
-
-// Skipping definition for base type 'Bool'
-
-// Skipping definition for base type 'Float'
-
// Skipping definition for base type 'Id'
// Skipping definition for base type 'Card8'
@@ -55,6 +49,16 @@ func init() {
// Skipping definition for base type 'Card16'
+// Skipping definition for base type 'Char'
+
+// Skipping definition for base type 'Card32'
+
+// Skipping definition for base type 'Double'
+
+// Skipping definition for base type 'Bool'
+
+// Skipping definition for base type 'Float'
+
const (
Xf86vidmodeModeFlagPositiveHsync = 1
Xf86vidmodeModeFlagNegativeHsync = 2
@@ -262,7 +266,7 @@ func (err Xf86vidmodeBadClockError) Error() string {
}
func init() {
- newErrorFuncs[0] = NewXf86vidmodeBadClockError
+ newExtErrorFuncs["XFree86-VidModeExtension"][0] = NewXf86vidmodeBadClockError
}
// Error definition Xf86vidmodeBadHTimings (1)
@@ -307,7 +311,7 @@ func (err Xf86vidmodeBadHTimingsError) Error() string {
}
func init() {
- newErrorFuncs[1] = NewXf86vidmodeBadHTimingsError
+ newExtErrorFuncs["XFree86-VidModeExtension"][1] = NewXf86vidmodeBadHTimingsError
}
// Error definition Xf86vidmodeBadVTimings (2)
@@ -352,7 +356,7 @@ func (err Xf86vidmodeBadVTimingsError) Error() string {
}
func init() {
- newErrorFuncs[2] = NewXf86vidmodeBadVTimingsError
+ newExtErrorFuncs["XFree86-VidModeExtension"][2] = NewXf86vidmodeBadVTimingsError
}
// Error definition Xf86vidmodeModeUnsuitable (3)
@@ -397,7 +401,7 @@ func (err Xf86vidmodeModeUnsuitableError) Error() string {
}
func init() {
- newErrorFuncs[3] = NewXf86vidmodeModeUnsuitableError
+ newExtErrorFuncs["XFree86-VidModeExtension"][3] = NewXf86vidmodeModeUnsuitableError
}
// Error definition Xf86vidmodeExtensionDisabled (4)
@@ -442,7 +446,7 @@ func (err Xf86vidmodeExtensionDisabledError) Error() string {
}
func init() {
- newErrorFuncs[4] = NewXf86vidmodeExtensionDisabledError
+ newExtErrorFuncs["XFree86-VidModeExtension"][4] = NewXf86vidmodeExtensionDisabledError
}
// Error definition Xf86vidmodeClientNotLocal (5)
@@ -487,7 +491,7 @@ func (err Xf86vidmodeClientNotLocalError) Error() string {
}
func init() {
- newErrorFuncs[5] = NewXf86vidmodeClientNotLocalError
+ newExtErrorFuncs["XFree86-VidModeExtension"][5] = NewXf86vidmodeClientNotLocalError
}
// Error definition Xf86vidmodeZoomLocked (6)
@@ -532,7 +536,7 @@ func (err Xf86vidmodeZoomLockedError) Error() string {
}
func init() {
- newErrorFuncs[6] = NewXf86vidmodeZoomLockedError
+ newExtErrorFuncs["XFree86-VidModeExtension"][6] = NewXf86vidmodeZoomLockedError
}
// Request Xf86vidmodeQueryVersion
diff --git a/nexgb/auto_xfixes.go b/nexgb/auto_xfixes.go
index aae1afb..f188be0 100644
--- a/nexgb/auto_xfixes.go
+++ b/nexgb/auto_xfixes.go
@@ -1,7 +1,7 @@
package xgb
/*
- This file was generated by xfixes.xml on May 6 2012 5:48:48pm EDT.
+ This file was generated by xfixes.xml on May 7 2012 9:17:57pm EDT.
This file is automatically generated. Edit at your peril!
*/
@@ -18,7 +18,7 @@ func (c *Conn) XfixesInit() error {
case err != nil:
return err
case !reply.Present:
- return newError("No extension named XFIXES could be found on on the server.")
+ return errorf("No extension named XFIXES could be found on on the server.")
}
c.extLock.Lock()
@@ -26,6 +26,9 @@ func (c *Conn) XfixesInit() error {
for evNum, fun := range newExtEventFuncs["XFIXES"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun
}
+ for errNum, fun := range newExtErrorFuncs["XFIXES"] {
+ newErrorFuncs[int(reply.FirstError)+errNum] = fun
+ }
c.extLock.Unlock()
return nil
@@ -33,20 +36,9 @@ func (c *Conn) XfixesInit() error {
func init() {
newExtEventFuncs["XFIXES"] = make(map[int]newEventFun)
+ newExtErrorFuncs["XFIXES"] = make(map[int]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'
-
-// Skipping definition for base type 'Byte'
-
-// Skipping definition for base type 'Int8'
-
// Skipping definition for base type 'Card16'
// Skipping definition for base type 'Char'
@@ -61,6 +53,18 @@ func init() {
// Skipping definition for base type 'Id'
+// 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'
+
const (
XfixesSaveSetModeInsert = 0
XfixesSaveSetModeDelete = 1
@@ -342,7 +346,7 @@ func (err XfixesBadRegionError) Error() string {
}
func init() {
- newErrorFuncs[0] = NewXfixesBadRegionError
+ newExtErrorFuncs["XFIXES"][0] = NewXfixesBadRegionError
}
// Request XfixesQueryVersion
diff --git a/nexgb/auto_xinerama.go b/nexgb/auto_xinerama.go
index d751710..ff7453c 100644
--- a/nexgb/auto_xinerama.go
+++ b/nexgb/auto_xinerama.go
@@ -1,7 +1,7 @@
package xgb
/*
- This file was generated by xinerama.xml on May 6 2012 5:48:48pm EDT.
+ This file was generated by xinerama.xml on May 7 2012 9:17:57pm EDT.
This file is automatically generated. Edit at your peril!
*/
@@ -16,7 +16,7 @@ func (c *Conn) XineramaInit() error {
case err != nil:
return err
case !reply.Present:
- return newError("No extension named XINERAMA could be found on on the server.")
+ return errorf("No extension named XINERAMA could be found on on the server.")
}
c.extLock.Lock()
@@ -24,6 +24,9 @@ func (c *Conn) XineramaInit() error {
for evNum, fun := range newExtEventFuncs["XINERAMA"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun
}
+ for errNum, fun := range newExtErrorFuncs["XINERAMA"] {
+ newErrorFuncs[int(reply.FirstError)+errNum] = fun
+ }
c.extLock.Unlock()
return nil
@@ -31,8 +34,11 @@ func (c *Conn) XineramaInit() error {
func init() {
newExtEventFuncs["XINERAMA"] = make(map[int]newEventFun)
+ newExtErrorFuncs["XINERAMA"] = make(map[int]newErrorFun)
}
+// Skipping definition for base type 'Byte'
+
// Skipping definition for base type 'Int8'
// Skipping definition for base type 'Card16'
@@ -57,8 +63,6 @@ func init() {
// Skipping definition for base type 'Void'
-// Skipping definition for base type 'Byte'
-
// 'XineramaScreenInfo' struct definition
// Size: 8
type XineramaScreenInfo struct {
diff --git a/nexgb/auto_xinput.go b/nexgb/auto_xinput.go
index ae122b8..7305d2d 100644
--- a/nexgb/auto_xinput.go
+++ b/nexgb/auto_xinput.go
@@ -1,7 +1,7 @@
package xgb
/*
- This file was generated by xinput.xml on May 6 2012 5:48:48pm EDT.
+ This file was generated by xinput.xml on May 7 2012 9:17:57pm EDT.
This file is automatically generated. Edit at your peril!
*/
@@ -16,7 +16,7 @@ func (c *Conn) XinputInit() error {
case err != nil:
return err
case !reply.Present:
- return newError("No extension named XInputExtension could be found on on the server.")
+ return errorf("No extension named XInputExtension could be found on on the server.")
}
c.extLock.Lock()
@@ -24,6 +24,9 @@ func (c *Conn) XinputInit() error {
for evNum, fun := range newExtEventFuncs["XInputExtension"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun
}
+ for errNum, fun := range newExtErrorFuncs["XInputExtension"] {
+ newErrorFuncs[int(reply.FirstError)+errNum] = fun
+ }
c.extLock.Unlock()
return nil
@@ -31,18 +34,9 @@ func (c *Conn) XinputInit() error {
func init() {
newExtEventFuncs["XInputExtension"] = make(map[int]newEventFun)
+ newExtErrorFuncs["XInputExtension"] = make(map[int]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'
-
// Skipping definition for base type 'Bool'
// Skipping definition for base type 'Float'
@@ -59,6 +53,16 @@ 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'
+
+// Skipping definition for base type 'Card32'
+
+// Skipping definition for base type 'Double'
+
const (
XinputValuatorModeRelative = 0
XinputValuatorModeAbsolute = 1
@@ -4443,7 +4447,7 @@ func (err XinputDeviceError) Error() string {
}
func init() {
- newErrorFuncs[0] = NewXinputDeviceError
+ newExtErrorFuncs["XInputExtension"][0] = NewXinputDeviceError
}
// Error definition XinputEvent (1)
@@ -4488,7 +4492,7 @@ func (err XinputEventError) Error() string {
}
func init() {
- newErrorFuncs[1] = NewXinputEventError
+ newExtErrorFuncs["XInputExtension"][1] = NewXinputEventError
}
// Error definition XinputMode (2)
@@ -4533,7 +4537,7 @@ func (err XinputModeError) Error() string {
}
func init() {
- newErrorFuncs[2] = NewXinputModeError
+ newExtErrorFuncs["XInputExtension"][2] = NewXinputModeError
}
// Error definition XinputDeviceBusy (3)
@@ -4578,7 +4582,7 @@ func (err XinputDeviceBusyError) Error() string {
}
func init() {
- newErrorFuncs[3] = NewXinputDeviceBusyError
+ newExtErrorFuncs["XInputExtension"][3] = NewXinputDeviceBusyError
}
// Error definition XinputClass (4)
@@ -4623,7 +4627,7 @@ func (err XinputClassError) Error() string {
}
func init() {
- newErrorFuncs[4] = NewXinputClassError
+ newExtErrorFuncs["XInputExtension"][4] = NewXinputClassError
}
// Request XinputGetExtensionVersion
diff --git a/nexgb/auto_xprint.go b/nexgb/auto_xprint.go
index 6c9be85..9bb8ea7 100644
--- a/nexgb/auto_xprint.go
+++ b/nexgb/auto_xprint.go
@@ -1,7 +1,7 @@
package xgb
/*
- This file was generated by xprint.xml on May 6 2012 5:48:48pm EDT.
+ This file was generated by xprint.xml on May 7 2012 9:17:57pm EDT.
This file is automatically generated. Edit at your peril!
*/
@@ -16,7 +16,7 @@ func (c *Conn) XprintInit() error {
case err != nil:
return err
case !reply.Present:
- return newError("No extension named XpExtension could be found on on the server.")
+ return errorf("No extension named XpExtension could be found on on the server.")
}
c.extLock.Lock()
@@ -24,6 +24,9 @@ func (c *Conn) XprintInit() error {
for evNum, fun := range newExtEventFuncs["XpExtension"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun
}
+ for errNum, fun := range newExtErrorFuncs["XpExtension"] {
+ newErrorFuncs[int(reply.FirstError)+errNum] = fun
+ }
c.extLock.Unlock()
return nil
@@ -31,6 +34,7 @@ func (c *Conn) XprintInit() error {
func init() {
newExtEventFuncs["XpExtension"] = make(map[int]newEventFun)
+ newExtErrorFuncs["XpExtension"] = make(map[int]newErrorFun)
}
// Skipping definition for base type 'Float'
@@ -376,7 +380,7 @@ func (err XprintBadContextError) Error() string {
}
func init() {
- newErrorFuncs[0] = NewXprintBadContextError
+ newExtErrorFuncs["XpExtension"][0] = NewXprintBadContextError
}
// Error definition XprintBadSequence (1)
@@ -421,7 +425,7 @@ func (err XprintBadSequenceError) Error() string {
}
func init() {
- newErrorFuncs[1] = NewXprintBadSequenceError
+ newExtErrorFuncs["XpExtension"][1] = NewXprintBadSequenceError
}
// Request XprintPrintQueryVersion
diff --git a/nexgb/auto_xproto.go b/nexgb/auto_xproto.go
index 84b193d..20152c8 100644
--- a/nexgb/auto_xproto.go
+++ b/nexgb/auto_xproto.go
@@ -1,16 +1,10 @@
package xgb
/*
- This file was generated by xproto.xml on May 6 2012 5:48:48pm EDT.
+ This file was generated by xproto.xml on May 7 2012 9:17:57pm EDT.
This file is automatically generated. Edit at your peril!
*/
-// Skipping definition for base type 'Void'
-
-// Skipping definition for base type 'Byte'
-
-// Skipping definition for base type 'Int8'
-
// Skipping definition for base type 'Card16'
// Skipping definition for base type 'Char'
@@ -31,6 +25,12 @@ package xgb
// Skipping definition for base type 'Int32'
+// Skipping definition for base type 'Void'
+
+// Skipping definition for base type 'Byte'
+
+// Skipping definition for base type 'Int8'
+
const (
VisualClassStaticGray = 0
VisualClassGrayScale = 1
diff --git a/nexgb/auto_xselinux.go b/nexgb/auto_xselinux.go
index e3dfbf3..a51346a 100644
--- a/nexgb/auto_xselinux.go
+++ b/nexgb/auto_xselinux.go
@@ -1,7 +1,7 @@
package xgb
/*
- This file was generated by xselinux.xml on May 6 2012 5:48:48pm EDT.
+ This file was generated by xselinux.xml on May 7 2012 9:17:58pm EDT.
This file is automatically generated. Edit at your peril!
*/
@@ -16,7 +16,7 @@ func (c *Conn) XselinuxInit() error {
case err != nil:
return err
case !reply.Present:
- return newError("No extension named SELinux could be found on on the server.")
+ return errorf("No extension named SELinux could be found on on the server.")
}
c.extLock.Lock()
@@ -24,6 +24,9 @@ func (c *Conn) XselinuxInit() error {
for evNum, fun := range newExtEventFuncs["SELinux"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun
}
+ for errNum, fun := range newExtErrorFuncs["SELinux"] {
+ newErrorFuncs[int(reply.FirstError)+errNum] = fun
+ }
c.extLock.Unlock()
return nil
@@ -31,12 +34,9 @@ func (c *Conn) XselinuxInit() error {
func init() {
newExtEventFuncs["SELinux"] = make(map[int]newEventFun)
+ newExtErrorFuncs["SELinux"] = make(map[int]newErrorFun)
}
-// Skipping definition for base type 'Bool'
-
-// Skipping definition for base type 'Float'
-
// Skipping definition for base type 'Id'
// Skipping definition for base type 'Card8'
@@ -59,6 +59,10 @@ func init() {
// Skipping definition for base type 'Double'
+// Skipping definition for base type 'Bool'
+
+// Skipping definition for base type 'Float'
+
// 'XselinuxListItem' struct definition
// Size: ((12 + pad((int(ObjectContextLen) * 1))) + pad((int(DataContextLen) * 1)))
type XselinuxListItem struct {
diff --git a/nexgb/auto_xtest.go b/nexgb/auto_xtest.go
index 565c3d1..8a43878 100644
--- a/nexgb/auto_xtest.go
+++ b/nexgb/auto_xtest.go
@@ -1,7 +1,7 @@
package xgb
/*
- This file was generated by xtest.xml on May 6 2012 5:48:48pm EDT.
+ This file was generated by xtest.xml on May 7 2012 9:17:58pm EDT.
This file is automatically generated. Edit at your peril!
*/
@@ -16,7 +16,7 @@ func (c *Conn) XtestInit() error {
case err != nil:
return err
case !reply.Present:
- return newError("No extension named XTEST could be found on on the server.")
+ return errorf("No extension named XTEST could be found on on the server.")
}
c.extLock.Lock()
@@ -24,6 +24,9 @@ func (c *Conn) XtestInit() error {
for evNum, fun := range newExtEventFuncs["XTEST"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun
}
+ for errNum, fun := range newExtErrorFuncs["XTEST"] {
+ newErrorFuncs[int(reply.FirstError)+errNum] = fun
+ }
c.extLock.Unlock()
return nil
@@ -31,10 +34,9 @@ func (c *Conn) XtestInit() error {
func init() {
newExtEventFuncs["XTEST"] = make(map[int]newEventFun)
+ newExtErrorFuncs["XTEST"] = make(map[int]newErrorFun)
}
-// Skipping definition for base type 'Bool'
-
// Skipping definition for base type 'Float'
// Skipping definition for base type 'Id'
@@ -59,6 +61,8 @@ func init() {
// Skipping definition for base type 'Double'
+// Skipping definition for base type 'Bool'
+
const (
XtestCursorNone = 0
XtestCursorCurrent = 1
diff --git a/nexgb/auto_xv.go b/nexgb/auto_xv.go
index 0ce0c64..dc2826b 100644
--- a/nexgb/auto_xv.go
+++ b/nexgb/auto_xv.go
@@ -1,7 +1,7 @@
package xgb
/*
- This file was generated by xv.xml on May 6 2012 5:48:48pm EDT.
+ This file was generated by xv.xml on May 7 2012 9:17:58pm EDT.
This file is automatically generated. Edit at your peril!
*/
@@ -17,7 +17,7 @@ func (c *Conn) XvInit() error {
case err != nil:
return err
case !reply.Present:
- return newError("No extension named XVideo could be found on on the server.")
+ return errorf("No extension named XVideo could be found on on the server.")
}
c.extLock.Lock()
@@ -25,6 +25,9 @@ func (c *Conn) XvInit() error {
for evNum, fun := range newExtEventFuncs["XVideo"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun
}
+ for errNum, fun := range newExtErrorFuncs["XVideo"] {
+ newErrorFuncs[int(reply.FirstError)+errNum] = fun
+ }
c.extLock.Unlock()
return nil
@@ -32,14 +35,9 @@ func (c *Conn) XvInit() error {
func init() {
newExtEventFuncs["XVideo"] = make(map[int]newEventFun)
+ newExtErrorFuncs["XVideo"] = make(map[int]newErrorFun)
}
-// Skipping definition for base type 'Void'
-
-// Skipping definition for base type 'Byte'
-
-// Skipping definition for base type 'Int8'
-
// Skipping definition for base type 'Card16'
// Skipping definition for base type 'Char'
@@ -60,6 +58,12 @@ func init() {
// Skipping definition for base type 'Int32'
+// Skipping definition for base type 'Void'
+
+// Skipping definition for base type 'Byte'
+
+// Skipping definition for base type 'Int8'
+
const (
XvTypeInputMask = 1
XvTypeOutputMask = 2
@@ -1094,7 +1098,7 @@ func (err XvBadPortError) Error() string {
}
func init() {
- newErrorFuncs[0] = NewXvBadPortError
+ newExtErrorFuncs["XVideo"][0] = NewXvBadPortError
}
// Error definition XvBadEncoding (1)
@@ -1139,7 +1143,7 @@ func (err XvBadEncodingError) Error() string {
}
func init() {
- newErrorFuncs[1] = NewXvBadEncodingError
+ newExtErrorFuncs["XVideo"][1] = NewXvBadEncodingError
}
// Error definition XvBadControl (2)
@@ -1184,7 +1188,7 @@ func (err XvBadControlError) Error() string {
}
func init() {
- newErrorFuncs[2] = NewXvBadControlError
+ newExtErrorFuncs["XVideo"][2] = NewXvBadControlError
}
// Request XvQueryExtension
diff --git a/nexgb/auto_xvmc.go b/nexgb/auto_xvmc.go
index 61eab40..9c53a59 100644
--- a/nexgb/auto_xvmc.go
+++ b/nexgb/auto_xvmc.go
@@ -1,7 +1,7 @@
package xgb
/*
- This file was generated by xvmc.xml on May 6 2012 5:48:48pm EDT.
+ This file was generated by xvmc.xml on May 7 2012 9:17:58pm EDT.
This file is automatically generated. Edit at your peril!
*/
@@ -16,7 +16,7 @@ func (c *Conn) XvmcInit() error {
case err != nil:
return err
case !reply.Present:
- return newError("No extension named XVideo-MotionCompensation could be found on on the server.")
+ return errorf("No extension named XVideo-MotionCompensation could be found on on the server.")
}
c.extLock.Lock()
@@ -24,6 +24,9 @@ func (c *Conn) XvmcInit() error {
for evNum, fun := range newExtEventFuncs["XVideo-MotionCompensation"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun
}
+ for errNum, fun := range newExtErrorFuncs["XVideo-MotionCompensation"] {
+ newErrorFuncs[int(reply.FirstError)+errNum] = fun
+ }
c.extLock.Unlock()
return nil
@@ -31,8 +34,11 @@ func (c *Conn) XvmcInit() error {
func init() {
newExtEventFuncs["XVideo-MotionCompensation"] = make(map[int]newEventFun)
+ newExtErrorFuncs["XVideo-MotionCompensation"] = make(map[int]newErrorFun)
}
+// Skipping definition for base type 'Int32'
+
// Skipping definition for base type 'Void'
// Skipping definition for base type 'Byte'
@@ -57,8 +63,6 @@ func init() {
// Skipping definition for base type 'Int16'
-// Skipping definition for base type 'Int32'
-
// Skipping resource definition of 'Context'
// Skipping resource definition of 'Surface'
diff --git a/nexgb/xgb.go b/nexgb/xgb.go
index c9a265f..cec06d6 100644
--- a/nexgb/xgb.go
+++ b/nexgb/xgb.go
@@ -2,19 +2,43 @@ package xgb
import (
"errors"
- "fmt"
+ "log"
"io"
"net"
- "os"
"sync"
)
+func init() {
+ log.SetFlags(0)
+ log.SetPrefix("XGB:")
+}
+
const (
// cookieBuffer represents the queue size of cookies existing at any
// point in time. The size of the buffer is really only important when
// there are many requests without replies made in sequence. Once the
// buffer fills, a round trip request is made to clear the buffer.
cookieBuffer = 1000
+
+ // xidBuffer represents the queue size of the xid channel.
+ // I don't think this value matters much, since xid generation is not
+ // that expensive.
+ xidBuffer = 5
+
+ // seqBuffer represents the queue size of the sequence number channel.
+ // I don't think this value matters much, since sequence number generation
+ // is not that expensive.
+ seqBuffer = 5
+
+ // reqBuffer represents the queue size of the number of requests that
+ // can be made until new ones block. This value seems OK.
+ reqBuffer = 100
+
+ // eventBuffer represents the queue size of the number of events or errors
+ // that can be loaded off the wire and not grabbed with WaitForEvent
+ // until reading an event blocks. This value should be big enough to handle
+ // bursts of events.
+ eventBuffer = 500
)
// A Conn represents a connection to an X server.
@@ -64,10 +88,10 @@ func NewConnDisplay(display string) (*Conn, error) {
conn.extensions = make(map[string]byte)
conn.cookieChan = make(chan *cookie, cookieBuffer)
- conn.xidChan = make(chan xid, 5)
- conn.seqChan = make(chan uint16, 20)
- conn.reqChan = make(chan *request, 100)
- conn.eventChan = make(chan eventOrError, 100)
+ conn.xidChan = make(chan xid, xidBuffer)
+ conn.seqChan = make(chan uint16, seqBuffer)
+ conn.reqChan = make(chan *request, reqBuffer)
+ conn.eventChan = make(chan eventOrError, eventBuffer)
go conn.generateXIds()
go conn.generateSeqIds()
@@ -106,7 +130,7 @@ type newEventFun func(buf []byte) Event
var newEventFuncs = make(map[int]newEventFun)
// newExtEventFuncs is a temporary map that stores event constructor functions
-// for each extension. When an extension is initialize, each event for that
+// for each extension. When an extension is initialized, each event for that
// extension is added to the 'newEventFuncs' map.
var newExtEventFuncs = make(map[string]map[int]newEventFun)
@@ -119,9 +143,16 @@ type Error interface {
Error() string
}
+type newErrorFun func(buf []byte) Error
+
// newErrorFuncs is a map from error numbers to functions that create
// the corresponding error.
-var newErrorFuncs = map[int]func(buf []byte) Error{}
+var newErrorFuncs = make(map[int]newErrorFun)
+
+// newExtErrorFuncs is a temporary map that stores error constructor functions
+// for each extension. When an extension is initialized, each error for that
+// extension is added to the 'newErrorFuncs' map.
+var newExtErrorFuncs = make(map[string]map[int]newErrorFun)
// eventOrError corresponds to values that can be either an event or an
// error.
@@ -239,28 +270,22 @@ func (c *Conn) sendRequests() {
cookie := c.newCookie(true, true)
cookie.Sequence = c.newSequenceId()
c.cookieChan <- cookie
- if !c.writeBuffer(c.getInputFocusRequest()) {
- return
- }
+ c.writeBuffer(c.getInputFocusRequest())
GetInputFocusCookie{cookie}.Reply() // wait for the buffer to clear
}
req.cookie.Sequence = c.newSequenceId()
c.cookieChan <- req.cookie
- if !c.writeBuffer(req.buf) {
- return
- }
+ c.writeBuffer(req.buf)
}
}
// writeBuffer is a convenience function for writing a byte slice to the wire.
-func (c *Conn) writeBuffer(buf []byte) bool {
+func (c *Conn) writeBuffer(buf []byte) {
if _, err := c.conn.Write(buf); err != nil {
- fmt.Fprintf(os.Stderr, "x protocol write error: %s\n", err)
- close(c.reqChan)
- return false
+ log.Printf("Write error: %s", err)
+ log.Fatal("A write error is unrecoverable. Exiting...")
}
- return true
}
// readResponses is a goroutine that reads events, errors and
@@ -285,9 +310,8 @@ func (c *Conn) readResponses() {
err, event, seq = nil, nil, 0
if _, err := io.ReadFull(c.conn, buf); err != nil {
- fmt.Fprintf(os.Stderr, "x protocol read error: %s\n", err)
- close(c.eventChan)
- break
+ log.Printf("Read error: %s", err)
+ log.Fatal("A read error is unrecoverable. Exiting...")
}
switch buf[0] {
@@ -296,10 +320,8 @@ func (c *Conn) readResponses() {
// generated) by looking it up by the error number.
newErrFun, ok := newErrorFuncs[int(buf[1])]
if !ok {
- fmt.Fprintf(os.Stderr,
- "BUG: "+
- "Could not find error constructor function for error "+
- "with number %d.\n", buf[1])
+ log.Printf("BUG: Could not find error constructor function " +
+ "for error with number %d.", buf[1])
continue
}
err = newErrFun(buf)
@@ -317,9 +339,8 @@ func (c *Conn) readResponses() {
biggerBuf := make([]byte, byteCount)
copy(biggerBuf[:32], buf)
if _, err := io.ReadFull(c.conn, biggerBuf[32:]); err != nil {
- fmt.Fprintf(os.Stderr, "x protocol read error: %s\n", err)
- close(c.eventChan)
- break
+ log.Printf("Read error: %s", err)
+ log.Fatal("A read error is unrecoverable. Exiting...")
}
replyBytes = biggerBuf
} else {
@@ -336,17 +357,24 @@ func (c *Conn) readResponses() {
evNum := int(buf[0] & 127)
newEventFun, ok := newEventFuncs[evNum]
if !ok {
- fmt.Fprintf(os.Stderr,
- "BUG: "+
- "Could not find event constructor function for event "+
- "with number %d.", evNum)
+ log.Printf("BUG: Could not find event construct function " +
+ "for event with number %d.", evNum)
continue
}
event = newEventFun(buf)
// Put the event into the queue.
- c.eventChan <- event
+ // FIXME: I'm not sure if using a goroutine here to guarantee
+ // a non-blocking send is the right way to go. I should implement
+ // a proper dynamic queue.
+ if cap(c.eventChan) == len(c.eventChan) {
+ go func() {
+ c.eventChan <- event
+ }()
+ } else {
+ c.eventChan <- event
+ }
// No more processing for events.
continue
@@ -376,9 +404,8 @@ func (c *Conn) readResponses() {
}
} else { // this is a reply
if cookie.replyChan == nil {
- fmt.Fprintf(os.Stderr,
- "Reply with sequence id %d does not have a "+
- "cookie with a valid reply channel.\n", seq)
+ log.Printf("Reply with sequence id %d does not have a "+
+ "cookie with a valid reply channel.", seq)
continue
} else {
cookie.replyChan <- replyBytes
@@ -390,16 +417,14 @@ func (c *Conn) readResponses() {
switch {
// Checked requests with replies
case cookie.replyChan != nil && cookie.errorChan != nil:
- fmt.Fprintf(os.Stderr,
- "Found cookie with sequence id %d that is expecting a "+
- "reply but will never get it. Currently on sequence "+
- "number %d\n", cookie.Sequence, seq)
+ log.Printf("Found cookie with sequence id %d that is " +
+ "expecting a reply but will never get it. Currently " +
+ "on sequence number %d", cookie.Sequence, seq)
// Unchecked requests with replies
case cookie.replyChan != nil && cookie.pingChan != nil:
- fmt.Fprintf(os.Stderr,
- "Found cookie with sequence id %d that is expecting a "+
- "reply (and not an error) but will never get it. "+
- "Currently on sequence number %d\n",
+ log.Printf("Found cookie with sequence id %d that is " +
+ "expecting a reply (and not an error) but will never " +
+ "get it. Currently on sequence number %d",
cookie.Sequence, seq)
// Checked requests without replies
case cookie.pingChan != nil && cookie.errorChan != nil:
@@ -420,7 +445,7 @@ func processEventOrError(everr eventOrError) (Event, Error) {
case Error:
return nil, ee
default:
- fmt.Fprintf(os.Stderr, "Invalid event/error type: %T\n", everr)
+ log.Printf("Invalid event/error type: %T", everr)
return nil, nil
}
panic("unreachable")
diff --git a/nexgb/xgb_help.go b/nexgb/xgb_help.go
index 6d07938..6c3b40a 100644
--- a/nexgb/xgb_help.go
+++ b/nexgb/xgb_help.go
@@ -1,7 +1,6 @@
package xgb
import (
- "errors"
"fmt"
"strings"
)
@@ -17,10 +16,10 @@ func sprintf(format string, v ...interface{}) string {
return fmt.Sprintf(format, v...)
}
-// newError is just a wrapper for errors.New. Exists for the same reason
+// errorf is just a wrapper for fmt.Errorf. Exists for the same reason
// that 'stringsJoin' and 'sprintf' exists.
-func newError(format string, v ...interface{}) error {
- return errors.New(fmt.Sprintf(format, v...))
+func errorf(format string, v ...interface{}) error {
+ return fmt.Errorf(format, v...)
}
// Pad a length to align on 4 bytes.
diff --git a/nexgb/xgb_test.go b/nexgb/xgb_test.go
index b70ff5e..7eea19b 100644
--- a/nexgb/xgb_test.go
+++ b/nexgb/xgb_test.go
@@ -162,6 +162,24 @@ func TestWindowEvents(t *testing.T) {
t.Fatalf("ConfigureWindow: %s", err)
}
+ err = X.ConfigureWindowChecked(wid,
+ ConfigWindowX|ConfigWindowY|
+ ConfigWindowWidth|ConfigWindowHeight,
+ []uint32{uint32(gx + 2), uint32(gy), uint32(gw), uint32(gh)}).Check()
+ if err != nil {
+ t.Fatalf("ConfigureWindow: %s", err)
+ }
+
+ err = X.ConfigureWindowChecked(wid,
+ ConfigWindowX|ConfigWindowY|
+ ConfigWindowWidth|ConfigWindowHeight,
+ []uint32{uint32(gx + 1), uint32(gy), uint32(gw), uint32(gh)}).Check()
+ if err != nil {
+ t.Fatalf("ConfigureWindow: %s", err)
+ }
+
+ TestProperty(t)
+
evOrErr := waitForEvent(t, 5)
switch event := evOrErr.ev.(type) {
case ConfigureNotifyEvent:
diff --git a/nexgb/xgbgen/context.go b/nexgb/xgbgen/context.go
index f1762d3..a7a1d1d 100644
--- a/nexgb/xgbgen/context.go
+++ b/nexgb/xgbgen/context.go
@@ -86,7 +86,7 @@ func (c *Context) Morph(xmlBytes []byte) {
c.Putln("case err != nil:")
c.Putln("return err")
c.Putln("case !reply.Present:")
- c.Putln("return newError(\"No extension named %s could be found on "+
+ c.Putln("return errorf(\"No extension named %s could be found on "+
"on the server.\")", xname)
c.Putln("}")
c.Putln("")
@@ -95,6 +95,9 @@ func (c *Context) Morph(xmlBytes []byte) {
c.Putln("for evNum, fun := range newExtEventFuncs[\"%s\"] {", xname)
c.Putln("newEventFuncs[int(reply.FirstEvent) + evNum] = fun")
c.Putln("}")
+ c.Putln("for errNum, fun := range newExtErrorFuncs[\"%s\"] {", xname)
+ c.Putln("newErrorFuncs[int(reply.FirstError) + errNum] = fun")
+ c.Putln("}")
c.Putln("c.extLock.Unlock()")
c.Putln("")
c.Putln("return nil")
@@ -102,8 +105,10 @@ func (c *Context) Morph(xmlBytes []byte) {
c.Putln("")
// Make sure newExtEventFuncs["EXT_NAME"] map is initialized.
+ // Same deal for newExtErrorFuncs["EXT_NAME"]
c.Putln("func init() {")
c.Putln("newExtEventFuncs[\"%s\"] = make(map[int]newEventFun)", xname)
+ c.Putln("newExtErrorFuncs[\"%s\"] = make(map[int]newErrorFun)", xname)
c.Putln("}")
c.Putln("")
}
diff --git a/nexgb/xgbgen/go_error.go b/nexgb/xgbgen/go_error.go
index 9e01042..c96866c 100644
--- a/nexgb/xgbgen/go_error.go
+++ b/nexgb/xgbgen/go_error.go
@@ -29,7 +29,12 @@ func (e *Error) Define(c *Context) {
// Let's the XGB event loop read this error.
c.Putln("func init() {")
- c.Putln("newErrorFuncs[%d] = New%s", e.Number, e.ErrType())
+ if c.protocol.isExt() {
+ c.Putln("newExtErrorFuncs[\"%s\"][%d] = New%s",
+ c.protocol.ExtXName, e.Number, e.ErrType())
+ } else {
+ c.Putln("newErrorFuncs[%d] = New%s", e.Number, e.ErrType())
+ }
c.Putln("}")
c.Putln("")
}
@@ -95,7 +100,12 @@ func (e *ErrorCopy) Define(c *Context) {
// Let's the XGB know how to read this error.
c.Putln("func init() {")
- c.Putln("newErrorFuncs[%d] = New%s", e.Number, e.ErrType())
+ if c.protocol.isExt() {
+ c.Putln("newExtErrorFuncs[\"%s\"][%d] = New%s",
+ c.protocol.ExtXName, e.Number, e.ErrType())
+ } else {
+ c.Putln("newErrorFuncs[%d] = New%s", e.Number, e.ErrType())
+ }
c.Putln("}")
c.Putln("")
}