more clean up. use log instead of fmt.Print to stderr. bug fix for event blocking (a hack fix for now).

This commit is contained in:
Andrew Gallant (Ocelot) 2012-05-07 21:58:33 -04:00
parent daad54a5e1
commit 13d598e5e7
35 changed files with 481 additions and 309 deletions

View File

@ -5,13 +5,17 @@
XPROTO=/usr/share/xcb XPROTO=/usr/share/xcb
# All of the XML files in my /usr/share/xcb directory EXCEPT XKB. -_- # 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 \ ge.xml glx.xml randr.xml record.xml render.xml res.xml \
screensaver.xml shape.xml shm.xml sync.xml xc_misc.xml \ screensaver.xml shape.xml shm.xml sync.xml xc_misc.xml \
xevie.xml xf86dri.xml xf86vidmode.xml xfixes.xml xinerama.xml \ xevie.xml xf86dri.xml xf86vidmode.xml xfixes.xml xinerama.xml \
xinput.xml xprint.xml xproto.xml xselinux.xml xtest.xml \ xinput.xml xprint.xml xproto.xml xselinux.xml xtest.xml \
xvmc.xml xv.xml xvmc.xml xv.xml
build-xgbgen:
(cd xgbgen && go build)
%.xml: %.xml:
xgbgen/xgbgen --proto-path $(XPROTO) $(XPROTO)/$*.xml > auto_$*.go xgbgen/xgbgen --proto-path $(XPROTO) $(XPROTO)/$*.xml > auto_$*.go

View File

@ -7,6 +7,9 @@ GOMAXPROCS > 1. (See the benchmarks in xgb_test.go for evidence.)
Please see doc.go for more info. 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 BurntSushi's Fork
================= =================
I've forked the XGB repository from Google Code due to inactivty upstream. I've forked the XGB repository from Google Code due to inactivty upstream.

View File

@ -1,7 +1,7 @@
package xgb 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! This file is automatically generated. Edit at your peril!
*/ */
@ -12,7 +12,7 @@ func (c *Conn) BigreqInit() error {
case err != nil: case err != nil:
return err return err
case !reply.Present: 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() c.extLock.Lock()
@ -20,6 +20,9 @@ func (c *Conn) BigreqInit() error {
for evNum, fun := range newExtEventFuncs["BIG-REQUESTS"] { for evNum, fun := range newExtEventFuncs["BIG-REQUESTS"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun newEventFuncs[int(reply.FirstEvent)+evNum] = fun
} }
for errNum, fun := range newExtErrorFuncs["BIG-REQUESTS"] {
newErrorFuncs[int(reply.FirstError)+errNum] = fun
}
c.extLock.Unlock() c.extLock.Unlock()
return nil return nil
@ -27,8 +30,19 @@ func (c *Conn) BigreqInit() error {
func init() { func init() {
newExtEventFuncs["BIG-REQUESTS"] = make(map[int]newEventFun) 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 'Float'
// Skipping definition for base type 'Id' // Skipping definition for base type 'Id'
@ -45,16 +59,6 @@ func init() {
// Skipping definition for base type 'Int8' // 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 // Request BigreqEnable
// size: 4 // size: 4
type BigreqEnableCookie struct { type BigreqEnableCookie struct {

View File

@ -1,7 +1,7 @@
package xgb 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! This file is automatically generated. Edit at your peril!
*/ */
@ -17,7 +17,7 @@ func (c *Conn) CompositeInit() error {
case err != nil: case err != nil:
return err return err
case !reply.Present: 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() c.extLock.Lock()
@ -25,6 +25,9 @@ func (c *Conn) CompositeInit() error {
for evNum, fun := range newExtEventFuncs["Composite"] { for evNum, fun := range newExtEventFuncs["Composite"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun newEventFuncs[int(reply.FirstEvent)+evNum] = fun
} }
for errNum, fun := range newExtErrorFuncs["Composite"] {
newErrorFuncs[int(reply.FirstError)+errNum] = fun
}
c.extLock.Unlock() c.extLock.Unlock()
return nil return nil
@ -32,8 +35,11 @@ func (c *Conn) CompositeInit() error {
func init() { func init() {
newExtEventFuncs["Composite"] = make(map[int]newEventFun) 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 'Void'
// Skipping definition for base type 'Byte' // Skipping definition for base type 'Byte'
@ -58,8 +64,6 @@ func init() {
// Skipping definition for base type 'Int16' // Skipping definition for base type 'Int16'
// Skipping definition for base type 'Int32'
const ( const (
CompositeRedirectAutomatic = 0 CompositeRedirectAutomatic = 0
CompositeRedirectManual = 1 CompositeRedirectManual = 1

View File

@ -1,7 +1,7 @@
package xgb 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! This file is automatically generated. Edit at your peril!
*/ */
@ -17,7 +17,7 @@ func (c *Conn) DamageInit() error {
case err != nil: case err != nil:
return err return err
case !reply.Present: 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() c.extLock.Lock()
@ -25,6 +25,9 @@ func (c *Conn) DamageInit() error {
for evNum, fun := range newExtEventFuncs["DAMAGE"] { for evNum, fun := range newExtEventFuncs["DAMAGE"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun newEventFuncs[int(reply.FirstEvent)+evNum] = fun
} }
for errNum, fun := range newExtErrorFuncs["DAMAGE"] {
newErrorFuncs[int(reply.FirstError)+errNum] = fun
}
c.extLock.Unlock() c.extLock.Unlock()
return nil return nil
@ -32,8 +35,17 @@ func (c *Conn) DamageInit() error {
func init() { func init() {
newExtEventFuncs["DAMAGE"] = make(map[int]newEventFun) 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 'Bool'
// Skipping definition for base type 'Float' // Skipping definition for base type 'Float'
@ -52,14 +64,6 @@ func init() {
// Skipping definition for base type 'Int8' // 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 ( const (
DamageReportLevelRawRectangles = 0 DamageReportLevelRawRectangles = 0
DamageReportLevelDeltaRectangles = 1 DamageReportLevelDeltaRectangles = 1
@ -213,7 +217,7 @@ func (err DamageBadDamageError) Error() string {
} }
func init() { func init() {
newErrorFuncs[0] = NewDamageBadDamageError newExtErrorFuncs["DAMAGE"][0] = NewDamageBadDamageError
} }
// Request DamageQueryVersion // Request DamageQueryVersion

View File

@ -1,7 +1,7 @@
package xgb 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! This file is automatically generated. Edit at your peril!
*/ */
@ -12,7 +12,7 @@ func (c *Conn) DpmsInit() error {
case err != nil: case err != nil:
return err return err
case !reply.Present: 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() c.extLock.Lock()
@ -20,6 +20,9 @@ func (c *Conn) DpmsInit() error {
for evNum, fun := range newExtEventFuncs["DPMS"] { for evNum, fun := range newExtEventFuncs["DPMS"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun newEventFuncs[int(reply.FirstEvent)+evNum] = fun
} }
for errNum, fun := range newExtErrorFuncs["DPMS"] {
newErrorFuncs[int(reply.FirstError)+errNum] = fun
}
c.extLock.Unlock() c.extLock.Unlock()
return nil return nil
@ -27,6 +30,7 @@ func (c *Conn) DpmsInit() error {
func init() { func init() {
newExtEventFuncs["DPMS"] = make(map[int]newEventFun) newExtEventFuncs["DPMS"] = make(map[int]newEventFun)
newExtErrorFuncs["DPMS"] = make(map[int]newErrorFun)
} }
// Skipping definition for base type 'Int32' // Skipping definition for base type 'Int32'

View File

@ -1,7 +1,7 @@
package xgb 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! This file is automatically generated. Edit at your peril!
*/ */
@ -16,7 +16,7 @@ func (c *Conn) Dri2Init() error {
case err != nil: case err != nil:
return err return err
case !reply.Present: 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() c.extLock.Lock()
@ -24,6 +24,9 @@ func (c *Conn) Dri2Init() error {
for evNum, fun := range newExtEventFuncs["DRI2"] { for evNum, fun := range newExtEventFuncs["DRI2"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun newEventFuncs[int(reply.FirstEvent)+evNum] = fun
} }
for errNum, fun := range newExtErrorFuncs["DRI2"] {
newErrorFuncs[int(reply.FirstError)+errNum] = fun
}
c.extLock.Unlock() c.extLock.Unlock()
return nil return nil
@ -31,10 +34,9 @@ func (c *Conn) Dri2Init() error {
func init() { func init() {
newExtEventFuncs["DRI2"] = make(map[int]newEventFun) 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 'Id'
// Skipping definition for base type 'Card8' // Skipping definition for base type 'Card8'
@ -59,6 +61,8 @@ func init() {
// Skipping definition for base type 'Bool' // Skipping definition for base type 'Bool'
// Skipping definition for base type 'Float'
const ( const (
Dri2AttachmentBufferFrontLeft = 0 Dri2AttachmentBufferFrontLeft = 0
Dri2AttachmentBufferBackLeft = 1 Dri2AttachmentBufferBackLeft = 1

View File

@ -1,7 +1,7 @@
package xgb 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! This file is automatically generated. Edit at your peril!
*/ */
@ -12,7 +12,7 @@ func (c *Conn) GeInit() error {
case err != nil: case err != nil:
return err return err
case !reply.Present: 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() c.extLock.Lock()
@ -20,6 +20,9 @@ func (c *Conn) GeInit() error {
for evNum, fun := range newExtEventFuncs["Generic Event Extension"] { for evNum, fun := range newExtEventFuncs["Generic Event Extension"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun newEventFuncs[int(reply.FirstEvent)+evNum] = fun
} }
for errNum, fun := range newExtErrorFuncs["Generic Event Extension"] {
newErrorFuncs[int(reply.FirstError)+errNum] = fun
}
c.extLock.Unlock() c.extLock.Unlock()
return nil return nil
@ -27,12 +30,9 @@ func (c *Conn) GeInit() error {
func init() { func init() {
newExtEventFuncs["Generic Event Extension"] = make(map[int]newEventFun) 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 'Int8'
// Skipping definition for base type 'Card16' // Skipping definition for base type 'Card16'
@ -55,6 +55,10 @@ func init() {
// Skipping definition for base type 'Int32' // Skipping definition for base type 'Int32'
// Skipping definition for base type 'Void'
// Skipping definition for base type 'Byte'
// Request GeQueryVersion // Request GeQueryVersion
// size: 8 // size: 8
type GeQueryVersionCookie struct { type GeQueryVersionCookie struct {

View File

@ -1,7 +1,7 @@
package xgb 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! This file is automatically generated. Edit at your peril!
*/ */
@ -16,7 +16,7 @@ func (c *Conn) GlxInit() error {
case err != nil: case err != nil:
return err return err
case !reply.Present: 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() c.extLock.Lock()
@ -24,6 +24,9 @@ func (c *Conn) GlxInit() error {
for evNum, fun := range newExtEventFuncs["GLX"] { for evNum, fun := range newExtEventFuncs["GLX"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun newEventFuncs[int(reply.FirstEvent)+evNum] = fun
} }
for errNum, fun := range newExtErrorFuncs["GLX"] {
newErrorFuncs[int(reply.FirstError)+errNum] = fun
}
c.extLock.Unlock() c.extLock.Unlock()
return nil return nil
@ -31,8 +34,19 @@ func (c *Conn) GlxInit() error {
func init() { func init() {
newExtEventFuncs["GLX"] = make(map[int]newEventFun) 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 'Float'
// Skipping definition for base type 'Id' // Skipping definition for base type 'Id'
@ -49,16 +63,6 @@ func init() {
// Skipping definition for base type 'Int8' // 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 ( const (
GlxPbcetDamaged = 32791 GlxPbcetDamaged = 32791
GlxPbcetSaved = 32792 GlxPbcetSaved = 32792
@ -319,7 +323,7 @@ func (err GlxGenericError) Error() string {
} }
func init() { func init() {
newErrorFuncs[-1] = NewGlxGenericError newExtErrorFuncs["GLX"][-1] = NewGlxGenericError
} }
// ErrorCopy definition GlxBadContext (0) // ErrorCopy definition GlxBadContext (0)
@ -355,7 +359,7 @@ func (err GlxBadContextError) Error() string {
} }
func init() { func init() {
newErrorFuncs[0] = NewGlxBadContextError newExtErrorFuncs["GLX"][0] = NewGlxBadContextError
} }
// ErrorCopy definition GlxBadContextState (1) // ErrorCopy definition GlxBadContextState (1)
@ -391,7 +395,7 @@ func (err GlxBadContextStateError) Error() string {
} }
func init() { func init() {
newErrorFuncs[1] = NewGlxBadContextStateError newExtErrorFuncs["GLX"][1] = NewGlxBadContextStateError
} }
// ErrorCopy definition GlxBadDrawable (2) // ErrorCopy definition GlxBadDrawable (2)
@ -427,7 +431,7 @@ func (err GlxBadDrawableError) Error() string {
} }
func init() { func init() {
newErrorFuncs[2] = NewGlxBadDrawableError newExtErrorFuncs["GLX"][2] = NewGlxBadDrawableError
} }
// ErrorCopy definition GlxBadPixmap (3) // ErrorCopy definition GlxBadPixmap (3)
@ -463,7 +467,7 @@ func (err GlxBadPixmapError) Error() string {
} }
func init() { func init() {
newErrorFuncs[3] = NewGlxBadPixmapError newExtErrorFuncs["GLX"][3] = NewGlxBadPixmapError
} }
// ErrorCopy definition GlxBadContextTag (4) // ErrorCopy definition GlxBadContextTag (4)
@ -499,7 +503,7 @@ func (err GlxBadContextTagError) Error() string {
} }
func init() { func init() {
newErrorFuncs[4] = NewGlxBadContextTagError newExtErrorFuncs["GLX"][4] = NewGlxBadContextTagError
} }
// ErrorCopy definition GlxBadCurrentWindow (5) // ErrorCopy definition GlxBadCurrentWindow (5)
@ -535,7 +539,7 @@ func (err GlxBadCurrentWindowError) Error() string {
} }
func init() { func init() {
newErrorFuncs[5] = NewGlxBadCurrentWindowError newExtErrorFuncs["GLX"][5] = NewGlxBadCurrentWindowError
} }
// ErrorCopy definition GlxBadRenderRequest (6) // ErrorCopy definition GlxBadRenderRequest (6)
@ -571,7 +575,7 @@ func (err GlxBadRenderRequestError) Error() string {
} }
func init() { func init() {
newErrorFuncs[6] = NewGlxBadRenderRequestError newExtErrorFuncs["GLX"][6] = NewGlxBadRenderRequestError
} }
// ErrorCopy definition GlxBadLargeRequest (7) // ErrorCopy definition GlxBadLargeRequest (7)
@ -607,7 +611,7 @@ func (err GlxBadLargeRequestError) Error() string {
} }
func init() { func init() {
newErrorFuncs[7] = NewGlxBadLargeRequestError newExtErrorFuncs["GLX"][7] = NewGlxBadLargeRequestError
} }
// ErrorCopy definition GlxUnsupportedPrivateRequest (8) // ErrorCopy definition GlxUnsupportedPrivateRequest (8)
@ -643,7 +647,7 @@ func (err GlxUnsupportedPrivateRequestError) Error() string {
} }
func init() { func init() {
newErrorFuncs[8] = NewGlxUnsupportedPrivateRequestError newExtErrorFuncs["GLX"][8] = NewGlxUnsupportedPrivateRequestError
} }
// ErrorCopy definition GlxBadFBConfig (9) // ErrorCopy definition GlxBadFBConfig (9)
@ -679,7 +683,7 @@ func (err GlxBadFBConfigError) Error() string {
} }
func init() { func init() {
newErrorFuncs[9] = NewGlxBadFBConfigError newExtErrorFuncs["GLX"][9] = NewGlxBadFBConfigError
} }
// ErrorCopy definition GlxBadPbuffer (10) // ErrorCopy definition GlxBadPbuffer (10)
@ -715,7 +719,7 @@ func (err GlxBadPbufferError) Error() string {
} }
func init() { func init() {
newErrorFuncs[10] = NewGlxBadPbufferError newExtErrorFuncs["GLX"][10] = NewGlxBadPbufferError
} }
// ErrorCopy definition GlxBadCurrentDrawable (11) // ErrorCopy definition GlxBadCurrentDrawable (11)
@ -751,7 +755,7 @@ func (err GlxBadCurrentDrawableError) Error() string {
} }
func init() { func init() {
newErrorFuncs[11] = NewGlxBadCurrentDrawableError newExtErrorFuncs["GLX"][11] = NewGlxBadCurrentDrawableError
} }
// ErrorCopy definition GlxBadWindow (12) // ErrorCopy definition GlxBadWindow (12)
@ -787,7 +791,7 @@ func (err GlxBadWindowError) Error() string {
} }
func init() { func init() {
newErrorFuncs[12] = NewGlxBadWindowError newExtErrorFuncs["GLX"][12] = NewGlxBadWindowError
} }
// ErrorCopy definition GlxGLXBadProfileARB (13) // ErrorCopy definition GlxGLXBadProfileARB (13)
@ -823,7 +827,7 @@ func (err GlxGLXBadProfileARBError) Error() string {
} }
func init() { func init() {
newErrorFuncs[13] = NewGlxGLXBadProfileARBError newExtErrorFuncs["GLX"][13] = NewGlxGLXBadProfileARBError
} }
// Request GlxRender // Request GlxRender

View File

@ -1,7 +1,7 @@
package xgb 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! This file is automatically generated. Edit at your peril!
*/ */
@ -17,7 +17,7 @@ func (c *Conn) RandrInit() error {
case err != nil: case err != nil:
return err return err
case !reply.Present: 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() c.extLock.Lock()
@ -25,6 +25,9 @@ func (c *Conn) RandrInit() error {
for evNum, fun := range newExtEventFuncs["RANDR"] { for evNum, fun := range newExtEventFuncs["RANDR"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun newEventFuncs[int(reply.FirstEvent)+evNum] = fun
} }
for errNum, fun := range newExtErrorFuncs["RANDR"] {
newErrorFuncs[int(reply.FirstError)+errNum] = fun
}
c.extLock.Unlock() c.extLock.Unlock()
return nil return nil
@ -32,8 +35,11 @@ func (c *Conn) RandrInit() error {
func init() { func init() {
newExtEventFuncs["RANDR"] = make(map[int]newEventFun) 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 'Card16'
// Skipping definition for base type 'Char' // Skipping definition for base type 'Char'
@ -58,8 +64,6 @@ func init() {
// Skipping definition for base type 'Byte' // Skipping definition for base type 'Byte'
// Skipping definition for base type 'Int8'
const ( const (
RandrRotationRotate0 = 1 RandrRotationRotate0 = 1
RandrRotationRotate90 = 2 RandrRotationRotate90 = 2
@ -1100,7 +1104,7 @@ func (err RandrBadOutputError) Error() string {
} }
func init() { func init() {
newErrorFuncs[0] = NewRandrBadOutputError newExtErrorFuncs["RANDR"][0] = NewRandrBadOutputError
} }
// Error definition RandrBadCrtc (1) // Error definition RandrBadCrtc (1)
@ -1145,7 +1149,7 @@ func (err RandrBadCrtcError) Error() string {
} }
func init() { func init() {
newErrorFuncs[1] = NewRandrBadCrtcError newExtErrorFuncs["RANDR"][1] = NewRandrBadCrtcError
} }
// Error definition RandrBadMode (2) // Error definition RandrBadMode (2)
@ -1190,7 +1194,7 @@ func (err RandrBadModeError) Error() string {
} }
func init() { func init() {
newErrorFuncs[2] = NewRandrBadModeError newExtErrorFuncs["RANDR"][2] = NewRandrBadModeError
} }
// Request RandrQueryVersion // Request RandrQueryVersion

View File

@ -1,7 +1,7 @@
package xgb 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! This file is automatically generated. Edit at your peril!
*/ */
@ -12,7 +12,7 @@ func (c *Conn) RecordInit() error {
case err != nil: case err != nil:
return err return err
case !reply.Present: 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() c.extLock.Lock()
@ -20,6 +20,9 @@ func (c *Conn) RecordInit() error {
for evNum, fun := range newExtEventFuncs["RECORD"] { for evNum, fun := range newExtEventFuncs["RECORD"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun newEventFuncs[int(reply.FirstEvent)+evNum] = fun
} }
for errNum, fun := range newExtErrorFuncs["RECORD"] {
newErrorFuncs[int(reply.FirstError)+errNum] = fun
}
c.extLock.Unlock() c.extLock.Unlock()
return nil return nil
@ -27,8 +30,19 @@ func (c *Conn) RecordInit() error {
func init() { func init() {
newExtEventFuncs["RECORD"] = make(map[int]newEventFun) 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 'Int8'
// Skipping definition for base type 'Card16' // Skipping definition for base type 'Card16'
@ -45,16 +59,6 @@ func init() {
// Skipping definition for base type 'Id' // 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 ( const (
RecordHTypeFromServerTime = 1 RecordHTypeFromServerTime = 1
RecordHTypeFromClientTime = 2 RecordHTypeFromClientTime = 2
@ -507,7 +511,7 @@ func (err RecordBadContextError) Error() string {
} }
func init() { func init() {
newErrorFuncs[0] = NewRecordBadContextError newExtErrorFuncs["RECORD"][0] = NewRecordBadContextError
} }
// Request RecordQueryVersion // Request RecordQueryVersion

View File

@ -1,7 +1,7 @@
package xgb 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! This file is automatically generated. Edit at your peril!
*/ */
@ -16,7 +16,7 @@ func (c *Conn) RenderInit() error {
case err != nil: case err != nil:
return err return err
case !reply.Present: 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() c.extLock.Lock()
@ -24,6 +24,9 @@ func (c *Conn) RenderInit() error {
for evNum, fun := range newExtEventFuncs["RENDER"] { for evNum, fun := range newExtEventFuncs["RENDER"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun newEventFuncs[int(reply.FirstEvent)+evNum] = fun
} }
for errNum, fun := range newExtErrorFuncs["RENDER"] {
newErrorFuncs[int(reply.FirstError)+errNum] = fun
}
c.extLock.Unlock() c.extLock.Unlock()
return nil return nil
@ -31,14 +34,9 @@ func (c *Conn) RenderInit() error {
func init() { func init() {
newExtEventFuncs["RENDER"] = make(map[int]newEventFun) 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 'Int8'
// Skipping definition for base type 'Card16' // Skipping definition for base type 'Card16'
@ -59,6 +57,12 @@ func init() {
// Skipping definition for base type 'Int16' // 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 ( const (
RenderPictTypeIndexed = 0 RenderPictTypeIndexed = 0
RenderPictTypeDirect = 1 RenderPictTypeDirect = 1
@ -1392,7 +1396,7 @@ func (err RenderPictFormatError) Error() string {
} }
func init() { func init() {
newErrorFuncs[0] = NewRenderPictFormatError newExtErrorFuncs["RENDER"][0] = NewRenderPictFormatError
} }
// Error definition RenderPicture (1) // Error definition RenderPicture (1)
@ -1437,7 +1441,7 @@ func (err RenderPictureError) Error() string {
} }
func init() { func init() {
newErrorFuncs[1] = NewRenderPictureError newExtErrorFuncs["RENDER"][1] = NewRenderPictureError
} }
// Error definition RenderPictOp (2) // Error definition RenderPictOp (2)
@ -1482,7 +1486,7 @@ func (err RenderPictOpError) Error() string {
} }
func init() { func init() {
newErrorFuncs[2] = NewRenderPictOpError newExtErrorFuncs["RENDER"][2] = NewRenderPictOpError
} }
// Error definition RenderGlyphSet (3) // Error definition RenderGlyphSet (3)
@ -1527,7 +1531,7 @@ func (err RenderGlyphSetError) Error() string {
} }
func init() { func init() {
newErrorFuncs[3] = NewRenderGlyphSetError newExtErrorFuncs["RENDER"][3] = NewRenderGlyphSetError
} }
// Error definition RenderGlyph (4) // Error definition RenderGlyph (4)
@ -1572,7 +1576,7 @@ func (err RenderGlyphError) Error() string {
} }
func init() { func init() {
newErrorFuncs[4] = NewRenderGlyphError newExtErrorFuncs["RENDER"][4] = NewRenderGlyphError
} }
// Request RenderQueryVersion // Request RenderQueryVersion

View File

@ -1,7 +1,7 @@
package xgb 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! This file is automatically generated. Edit at your peril!
*/ */
@ -16,7 +16,7 @@ func (c *Conn) ResInit() error {
case err != nil: case err != nil:
return err return err
case !reply.Present: 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() c.extLock.Lock()
@ -24,6 +24,9 @@ func (c *Conn) ResInit() error {
for evNum, fun := range newExtEventFuncs["X-Resource"] { for evNum, fun := range newExtEventFuncs["X-Resource"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun newEventFuncs[int(reply.FirstEvent)+evNum] = fun
} }
for errNum, fun := range newExtErrorFuncs["X-Resource"] {
newErrorFuncs[int(reply.FirstError)+errNum] = fun
}
c.extLock.Unlock() c.extLock.Unlock()
return nil return nil
@ -31,16 +34,9 @@ func (c *Conn) ResInit() error {
func init() { func init() {
newExtEventFuncs["X-Resource"] = make(map[int]newEventFun) 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 'Void'
// Skipping definition for base type 'Byte' // Skipping definition for base type 'Byte'
@ -59,6 +55,14 @@ func init() {
// Skipping definition for base type 'Float' // 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 // 'ResClient' struct definition
// Size: 8 // Size: 8
type ResClient struct { type ResClient struct {

View File

@ -1,7 +1,7 @@
package xgb 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! This file is automatically generated. Edit at your peril!
*/ */
@ -16,7 +16,7 @@ func (c *Conn) ScreensaverInit() error {
case err != nil: case err != nil:
return err return err
case !reply.Present: 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() c.extLock.Lock()
@ -24,6 +24,9 @@ func (c *Conn) ScreensaverInit() error {
for evNum, fun := range newExtEventFuncs["MIT-SCREEN-SAVER"] { for evNum, fun := range newExtEventFuncs["MIT-SCREEN-SAVER"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun newEventFuncs[int(reply.FirstEvent)+evNum] = fun
} }
for errNum, fun := range newExtErrorFuncs["MIT-SCREEN-SAVER"] {
newErrorFuncs[int(reply.FirstError)+errNum] = fun
}
c.extLock.Unlock() c.extLock.Unlock()
return nil return nil
@ -31,18 +34,9 @@ func (c *Conn) ScreensaverInit() error {
func init() { func init() {
newExtEventFuncs["MIT-SCREEN-SAVER"] = make(map[int]newEventFun) 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 'Card16'
// Skipping definition for base type 'Char' // Skipping definition for base type 'Char'
@ -59,6 +53,16 @@ func init() {
// Skipping definition for base type 'Card8' // 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 ( const (
ScreensaverKindBlanked = 0 ScreensaverKindBlanked = 0
ScreensaverKindInternal = 1 ScreensaverKindInternal = 1

View File

@ -1,7 +1,7 @@
package xgb 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! This file is automatically generated. Edit at your peril!
*/ */
@ -16,7 +16,7 @@ func (c *Conn) ShapeInit() error {
case err != nil: case err != nil:
return err return err
case !reply.Present: 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() c.extLock.Lock()
@ -24,6 +24,9 @@ func (c *Conn) ShapeInit() error {
for evNum, fun := range newExtEventFuncs["SHAPE"] { for evNum, fun := range newExtEventFuncs["SHAPE"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun newEventFuncs[int(reply.FirstEvent)+evNum] = fun
} }
for errNum, fun := range newExtErrorFuncs["SHAPE"] {
newErrorFuncs[int(reply.FirstError)+errNum] = fun
}
c.extLock.Unlock() c.extLock.Unlock()
return nil return nil
@ -31,8 +34,15 @@ func (c *Conn) ShapeInit() error {
func init() { func init() {
newExtEventFuncs["SHAPE"] = make(map[int]newEventFun) 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 'Card16'
// Skipping definition for base type 'Char' // Skipping definition for base type 'Char'
@ -53,12 +63,6 @@ func init() {
// Skipping definition for base type 'Int32' // 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 ( const (
ShapeSoSet = 0 ShapeSoSet = 0
ShapeSoUnion = 1 ShapeSoUnion = 1

View File

@ -1,7 +1,7 @@
package xgb 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! This file is automatically generated. Edit at your peril!
*/ */
@ -16,7 +16,7 @@ func (c *Conn) ShmInit() error {
case err != nil: case err != nil:
return err return err
case !reply.Present: 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() c.extLock.Lock()
@ -24,6 +24,9 @@ func (c *Conn) ShmInit() error {
for evNum, fun := range newExtEventFuncs["MIT-SHM"] { for evNum, fun := range newExtEventFuncs["MIT-SHM"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun newEventFuncs[int(reply.FirstEvent)+evNum] = fun
} }
for errNum, fun := range newExtErrorFuncs["MIT-SHM"] {
newErrorFuncs[int(reply.FirstError)+errNum] = fun
}
c.extLock.Unlock() c.extLock.Unlock()
return nil return nil
@ -31,8 +34,15 @@ func (c *Conn) ShmInit() error {
func init() { func init() {
newExtEventFuncs["MIT-SHM"] = make(map[int]newEventFun) 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 'Float'
// Skipping definition for base type 'Id' // Skipping definition for base type 'Id'
@ -53,12 +63,6 @@ func init() {
// Skipping definition for base type 'Char' // 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' // Skipping resource definition of 'Seg'
// Event definition ShmCompletion (0) // Event definition ShmCompletion (0)
@ -194,7 +198,7 @@ func (err ShmBadSegError) Error() string {
} }
func init() { func init() {
newErrorFuncs[0] = NewShmBadSegError newExtErrorFuncs["MIT-SHM"][0] = NewShmBadSegError
} }
// Request ShmQueryVersion // Request ShmQueryVersion

View File

@ -1,7 +1,7 @@
package xgb 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! This file is automatically generated. Edit at your peril!
*/ */
@ -16,7 +16,7 @@ func (c *Conn) SyncInit() error {
case err != nil: case err != nil:
return err return err
case !reply.Present: 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() c.extLock.Lock()
@ -24,6 +24,9 @@ func (c *Conn) SyncInit() error {
for evNum, fun := range newExtEventFuncs["SYNC"] { for evNum, fun := range newExtEventFuncs["SYNC"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun newEventFuncs[int(reply.FirstEvent)+evNum] = fun
} }
for errNum, fun := range newExtErrorFuncs["SYNC"] {
newErrorFuncs[int(reply.FirstError)+errNum] = fun
}
c.extLock.Unlock() c.extLock.Unlock()
return nil return nil
@ -31,8 +34,19 @@ func (c *Conn) SyncInit() error {
func init() { func init() {
newExtEventFuncs["SYNC"] = make(map[int]newEventFun) 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 'Float'
// Skipping definition for base type 'Id' // Skipping definition for base type 'Id'
@ -49,16 +63,6 @@ func init() {
// Skipping definition for base type 'Int8' // 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 ( const (
SyncAlarmstateActive = 0 SyncAlarmstateActive = 0
SyncAlarmstateInactive = 1 SyncAlarmstateInactive = 1
@ -656,7 +660,7 @@ func (err SyncCounterError) Error() string {
} }
func init() { func init() {
newErrorFuncs[0] = NewSyncCounterError newExtErrorFuncs["SYNC"][0] = NewSyncCounterError
} }
// Error definition SyncAlarm (1) // Error definition SyncAlarm (1)
@ -716,7 +720,7 @@ func (err SyncAlarmError) Error() string {
} }
func init() { func init() {
newErrorFuncs[1] = NewSyncAlarmError newExtErrorFuncs["SYNC"][1] = NewSyncAlarmError
} }
// Request SyncInitialize // Request SyncInitialize

View File

@ -1,7 +1,7 @@
package xgb 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! This file is automatically generated. Edit at your peril!
*/ */
@ -12,7 +12,7 @@ func (c *Conn) Xc_miscInit() error {
case err != nil: case err != nil:
return err return err
case !reply.Present: 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() c.extLock.Lock()
@ -20,6 +20,9 @@ func (c *Conn) Xc_miscInit() error {
for evNum, fun := range newExtEventFuncs["XC-MISC"] { for evNum, fun := range newExtEventFuncs["XC-MISC"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun newEventFuncs[int(reply.FirstEvent)+evNum] = fun
} }
for errNum, fun := range newExtErrorFuncs["XC-MISC"] {
newErrorFuncs[int(reply.FirstError)+errNum] = fun
}
c.extLock.Unlock() c.extLock.Unlock()
return nil return nil
@ -27,12 +30,9 @@ func (c *Conn) Xc_miscInit() error {
func init() { func init() {
newExtEventFuncs["XC-MISC"] = make(map[int]newEventFun) 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 'Card16'
// Skipping definition for base type 'Char' // Skipping definition for base type 'Char'
@ -55,6 +55,10 @@ func init() {
// Skipping definition for base type 'Void' // Skipping definition for base type 'Void'
// Skipping definition for base type 'Byte'
// Skipping definition for base type 'Int8'
// Request Xc_miscGetVersion // Request Xc_miscGetVersion
// size: 8 // size: 8
type Xc_miscGetVersionCookie struct { type Xc_miscGetVersionCookie struct {

View File

@ -1,7 +1,7 @@
package xgb 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! This file is automatically generated. Edit at your peril!
*/ */
@ -12,7 +12,7 @@ func (c *Conn) XevieInit() error {
case err != nil: case err != nil:
return err return err
case !reply.Present: 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() c.extLock.Lock()
@ -20,6 +20,9 @@ func (c *Conn) XevieInit() error {
for evNum, fun := range newExtEventFuncs["XEVIE"] { for evNum, fun := range newExtEventFuncs["XEVIE"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun newEventFuncs[int(reply.FirstEvent)+evNum] = fun
} }
for errNum, fun := range newExtErrorFuncs["XEVIE"] {
newErrorFuncs[int(reply.FirstError)+errNum] = fun
}
c.extLock.Unlock() c.extLock.Unlock()
return nil return nil
@ -27,10 +30,9 @@ func (c *Conn) XevieInit() error {
func init() { func init() {
newExtEventFuncs["XEVIE"] = make(map[int]newEventFun) 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 'Id'
// Skipping definition for base type 'Card8' // Skipping definition for base type 'Card8'
@ -55,6 +57,8 @@ func init() {
// Skipping definition for base type 'Bool' // Skipping definition for base type 'Bool'
// Skipping definition for base type 'Float'
const ( const (
XevieDatatypeUnmodified = 0 XevieDatatypeUnmodified = 0
XevieDatatypeModified = 1 XevieDatatypeModified = 1

View File

@ -1,7 +1,7 @@
package xgb 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! This file is automatically generated. Edit at your peril!
*/ */
@ -12,7 +12,7 @@ func (c *Conn) Xf86driInit() error {
case err != nil: case err != nil:
return err return err
case !reply.Present: 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() c.extLock.Lock()
@ -20,6 +20,9 @@ func (c *Conn) Xf86driInit() error {
for evNum, fun := range newExtEventFuncs["XFree86-DRI"] { for evNum, fun := range newExtEventFuncs["XFree86-DRI"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun newEventFuncs[int(reply.FirstEvent)+evNum] = fun
} }
for errNum, fun := range newExtErrorFuncs["XFree86-DRI"] {
newErrorFuncs[int(reply.FirstError)+errNum] = fun
}
c.extLock.Unlock() c.extLock.Unlock()
return nil return nil
@ -27,6 +30,7 @@ func (c *Conn) Xf86driInit() error {
func init() { func init() {
newExtEventFuncs["XFree86-DRI"] = make(map[int]newEventFun) newExtEventFuncs["XFree86-DRI"] = make(map[int]newEventFun)
newExtErrorFuncs["XFree86-DRI"] = make(map[int]newErrorFun)
} }
// Skipping definition for base type 'Int8' // Skipping definition for base type 'Int8'

View File

@ -1,7 +1,7 @@
package xgb 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! This file is automatically generated. Edit at your peril!
*/ */
@ -12,7 +12,7 @@ func (c *Conn) Xf86vidmodeInit() error {
case err != nil: case err != nil:
return err return err
case !reply.Present: 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() c.extLock.Lock()
@ -20,6 +20,9 @@ func (c *Conn) Xf86vidmodeInit() error {
for evNum, fun := range newExtEventFuncs["XFree86-VidModeExtension"] { for evNum, fun := range newExtEventFuncs["XFree86-VidModeExtension"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun newEventFuncs[int(reply.FirstEvent)+evNum] = fun
} }
for errNum, fun := range newExtErrorFuncs["XFree86-VidModeExtension"] {
newErrorFuncs[int(reply.FirstError)+errNum] = fun
}
c.extLock.Unlock() c.extLock.Unlock()
return nil return nil
@ -27,18 +30,9 @@ func (c *Conn) Xf86vidmodeInit() error {
func init() { func init() {
newExtEventFuncs["XFree86-VidModeExtension"] = make(map[int]newEventFun) 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 'Id'
// Skipping definition for base type 'Card8' // Skipping definition for base type 'Card8'
@ -55,6 +49,16 @@ func init() {
// Skipping definition for base type 'Card16' // 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 ( const (
Xf86vidmodeModeFlagPositiveHsync = 1 Xf86vidmodeModeFlagPositiveHsync = 1
Xf86vidmodeModeFlagNegativeHsync = 2 Xf86vidmodeModeFlagNegativeHsync = 2
@ -262,7 +266,7 @@ func (err Xf86vidmodeBadClockError) Error() string {
} }
func init() { func init() {
newErrorFuncs[0] = NewXf86vidmodeBadClockError newExtErrorFuncs["XFree86-VidModeExtension"][0] = NewXf86vidmodeBadClockError
} }
// Error definition Xf86vidmodeBadHTimings (1) // Error definition Xf86vidmodeBadHTimings (1)
@ -307,7 +311,7 @@ func (err Xf86vidmodeBadHTimingsError) Error() string {
} }
func init() { func init() {
newErrorFuncs[1] = NewXf86vidmodeBadHTimingsError newExtErrorFuncs["XFree86-VidModeExtension"][1] = NewXf86vidmodeBadHTimingsError
} }
// Error definition Xf86vidmodeBadVTimings (2) // Error definition Xf86vidmodeBadVTimings (2)
@ -352,7 +356,7 @@ func (err Xf86vidmodeBadVTimingsError) Error() string {
} }
func init() { func init() {
newErrorFuncs[2] = NewXf86vidmodeBadVTimingsError newExtErrorFuncs["XFree86-VidModeExtension"][2] = NewXf86vidmodeBadVTimingsError
} }
// Error definition Xf86vidmodeModeUnsuitable (3) // Error definition Xf86vidmodeModeUnsuitable (3)
@ -397,7 +401,7 @@ func (err Xf86vidmodeModeUnsuitableError) Error() string {
} }
func init() { func init() {
newErrorFuncs[3] = NewXf86vidmodeModeUnsuitableError newExtErrorFuncs["XFree86-VidModeExtension"][3] = NewXf86vidmodeModeUnsuitableError
} }
// Error definition Xf86vidmodeExtensionDisabled (4) // Error definition Xf86vidmodeExtensionDisabled (4)
@ -442,7 +446,7 @@ func (err Xf86vidmodeExtensionDisabledError) Error() string {
} }
func init() { func init() {
newErrorFuncs[4] = NewXf86vidmodeExtensionDisabledError newExtErrorFuncs["XFree86-VidModeExtension"][4] = NewXf86vidmodeExtensionDisabledError
} }
// Error definition Xf86vidmodeClientNotLocal (5) // Error definition Xf86vidmodeClientNotLocal (5)
@ -487,7 +491,7 @@ func (err Xf86vidmodeClientNotLocalError) Error() string {
} }
func init() { func init() {
newErrorFuncs[5] = NewXf86vidmodeClientNotLocalError newExtErrorFuncs["XFree86-VidModeExtension"][5] = NewXf86vidmodeClientNotLocalError
} }
// Error definition Xf86vidmodeZoomLocked (6) // Error definition Xf86vidmodeZoomLocked (6)
@ -532,7 +536,7 @@ func (err Xf86vidmodeZoomLockedError) Error() string {
} }
func init() { func init() {
newErrorFuncs[6] = NewXf86vidmodeZoomLockedError newExtErrorFuncs["XFree86-VidModeExtension"][6] = NewXf86vidmodeZoomLockedError
} }
// Request Xf86vidmodeQueryVersion // Request Xf86vidmodeQueryVersion

View File

@ -1,7 +1,7 @@
package xgb 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! This file is automatically generated. Edit at your peril!
*/ */
@ -18,7 +18,7 @@ func (c *Conn) XfixesInit() error {
case err != nil: case err != nil:
return err return err
case !reply.Present: 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() c.extLock.Lock()
@ -26,6 +26,9 @@ func (c *Conn) XfixesInit() error {
for evNum, fun := range newExtEventFuncs["XFIXES"] { for evNum, fun := range newExtEventFuncs["XFIXES"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun newEventFuncs[int(reply.FirstEvent)+evNum] = fun
} }
for errNum, fun := range newExtErrorFuncs["XFIXES"] {
newErrorFuncs[int(reply.FirstError)+errNum] = fun
}
c.extLock.Unlock() c.extLock.Unlock()
return nil return nil
@ -33,20 +36,9 @@ func (c *Conn) XfixesInit() error {
func init() { func init() {
newExtEventFuncs["XFIXES"] = make(map[int]newEventFun) 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 'Card16'
// Skipping definition for base type 'Char' // Skipping definition for base type 'Char'
@ -61,6 +53,18 @@ func init() {
// Skipping definition for base type 'Id' // 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 ( const (
XfixesSaveSetModeInsert = 0 XfixesSaveSetModeInsert = 0
XfixesSaveSetModeDelete = 1 XfixesSaveSetModeDelete = 1
@ -342,7 +346,7 @@ func (err XfixesBadRegionError) Error() string {
} }
func init() { func init() {
newErrorFuncs[0] = NewXfixesBadRegionError newExtErrorFuncs["XFIXES"][0] = NewXfixesBadRegionError
} }
// Request XfixesQueryVersion // Request XfixesQueryVersion

View File

@ -1,7 +1,7 @@
package xgb 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! This file is automatically generated. Edit at your peril!
*/ */
@ -16,7 +16,7 @@ func (c *Conn) XineramaInit() error {
case err != nil: case err != nil:
return err return err
case !reply.Present: 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() c.extLock.Lock()
@ -24,6 +24,9 @@ func (c *Conn) XineramaInit() error {
for evNum, fun := range newExtEventFuncs["XINERAMA"] { for evNum, fun := range newExtEventFuncs["XINERAMA"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun newEventFuncs[int(reply.FirstEvent)+evNum] = fun
} }
for errNum, fun := range newExtErrorFuncs["XINERAMA"] {
newErrorFuncs[int(reply.FirstError)+errNum] = fun
}
c.extLock.Unlock() c.extLock.Unlock()
return nil return nil
@ -31,8 +34,11 @@ func (c *Conn) XineramaInit() error {
func init() { func init() {
newExtEventFuncs["XINERAMA"] = make(map[int]newEventFun) 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 'Int8'
// Skipping definition for base type 'Card16' // Skipping definition for base type 'Card16'
@ -57,8 +63,6 @@ func init() {
// Skipping definition for base type 'Void' // Skipping definition for base type 'Void'
// Skipping definition for base type 'Byte'
// 'XineramaScreenInfo' struct definition // 'XineramaScreenInfo' struct definition
// Size: 8 // Size: 8
type XineramaScreenInfo struct { type XineramaScreenInfo struct {

View File

@ -1,7 +1,7 @@
package xgb 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! This file is automatically generated. Edit at your peril!
*/ */
@ -16,7 +16,7 @@ func (c *Conn) XinputInit() error {
case err != nil: case err != nil:
return err return err
case !reply.Present: 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() c.extLock.Lock()
@ -24,6 +24,9 @@ func (c *Conn) XinputInit() error {
for evNum, fun := range newExtEventFuncs["XInputExtension"] { for evNum, fun := range newExtEventFuncs["XInputExtension"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun newEventFuncs[int(reply.FirstEvent)+evNum] = fun
} }
for errNum, fun := range newExtErrorFuncs["XInputExtension"] {
newErrorFuncs[int(reply.FirstError)+errNum] = fun
}
c.extLock.Unlock() c.extLock.Unlock()
return nil return nil
@ -31,18 +34,9 @@ func (c *Conn) XinputInit() error {
func init() { func init() {
newExtEventFuncs["XInputExtension"] = make(map[int]newEventFun) 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 'Bool'
// Skipping definition for base type 'Float' // Skipping definition for base type 'Float'
@ -59,6 +53,16 @@ func init() {
// Skipping definition for base type 'Byte' // 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 ( const (
XinputValuatorModeRelative = 0 XinputValuatorModeRelative = 0
XinputValuatorModeAbsolute = 1 XinputValuatorModeAbsolute = 1
@ -4443,7 +4447,7 @@ func (err XinputDeviceError) Error() string {
} }
func init() { func init() {
newErrorFuncs[0] = NewXinputDeviceError newExtErrorFuncs["XInputExtension"][0] = NewXinputDeviceError
} }
// Error definition XinputEvent (1) // Error definition XinputEvent (1)
@ -4488,7 +4492,7 @@ func (err XinputEventError) Error() string {
} }
func init() { func init() {
newErrorFuncs[1] = NewXinputEventError newExtErrorFuncs["XInputExtension"][1] = NewXinputEventError
} }
// Error definition XinputMode (2) // Error definition XinputMode (2)
@ -4533,7 +4537,7 @@ func (err XinputModeError) Error() string {
} }
func init() { func init() {
newErrorFuncs[2] = NewXinputModeError newExtErrorFuncs["XInputExtension"][2] = NewXinputModeError
} }
// Error definition XinputDeviceBusy (3) // Error definition XinputDeviceBusy (3)
@ -4578,7 +4582,7 @@ func (err XinputDeviceBusyError) Error() string {
} }
func init() { func init() {
newErrorFuncs[3] = NewXinputDeviceBusyError newExtErrorFuncs["XInputExtension"][3] = NewXinputDeviceBusyError
} }
// Error definition XinputClass (4) // Error definition XinputClass (4)
@ -4623,7 +4627,7 @@ func (err XinputClassError) Error() string {
} }
func init() { func init() {
newErrorFuncs[4] = NewXinputClassError newExtErrorFuncs["XInputExtension"][4] = NewXinputClassError
} }
// Request XinputGetExtensionVersion // Request XinputGetExtensionVersion

View File

@ -1,7 +1,7 @@
package xgb 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! This file is automatically generated. Edit at your peril!
*/ */
@ -16,7 +16,7 @@ func (c *Conn) XprintInit() error {
case err != nil: case err != nil:
return err return err
case !reply.Present: 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() c.extLock.Lock()
@ -24,6 +24,9 @@ func (c *Conn) XprintInit() error {
for evNum, fun := range newExtEventFuncs["XpExtension"] { for evNum, fun := range newExtEventFuncs["XpExtension"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun newEventFuncs[int(reply.FirstEvent)+evNum] = fun
} }
for errNum, fun := range newExtErrorFuncs["XpExtension"] {
newErrorFuncs[int(reply.FirstError)+errNum] = fun
}
c.extLock.Unlock() c.extLock.Unlock()
return nil return nil
@ -31,6 +34,7 @@ func (c *Conn) XprintInit() error {
func init() { func init() {
newExtEventFuncs["XpExtension"] = make(map[int]newEventFun) newExtEventFuncs["XpExtension"] = make(map[int]newEventFun)
newExtErrorFuncs["XpExtension"] = make(map[int]newErrorFun)
} }
// Skipping definition for base type 'Float' // Skipping definition for base type 'Float'
@ -376,7 +380,7 @@ func (err XprintBadContextError) Error() string {
} }
func init() { func init() {
newErrorFuncs[0] = NewXprintBadContextError newExtErrorFuncs["XpExtension"][0] = NewXprintBadContextError
} }
// Error definition XprintBadSequence (1) // Error definition XprintBadSequence (1)
@ -421,7 +425,7 @@ func (err XprintBadSequenceError) Error() string {
} }
func init() { func init() {
newErrorFuncs[1] = NewXprintBadSequenceError newExtErrorFuncs["XpExtension"][1] = NewXprintBadSequenceError
} }
// Request XprintPrintQueryVersion // Request XprintPrintQueryVersion

View File

@ -1,16 +1,10 @@
package xgb 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! 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 'Card16'
// Skipping definition for base type 'Char' // Skipping definition for base type 'Char'
@ -31,6 +25,12 @@ package xgb
// Skipping definition for base type 'Int32' // 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 ( const (
VisualClassStaticGray = 0 VisualClassStaticGray = 0
VisualClassGrayScale = 1 VisualClassGrayScale = 1

View File

@ -1,7 +1,7 @@
package xgb 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! This file is automatically generated. Edit at your peril!
*/ */
@ -16,7 +16,7 @@ func (c *Conn) XselinuxInit() error {
case err != nil: case err != nil:
return err return err
case !reply.Present: 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() c.extLock.Lock()
@ -24,6 +24,9 @@ func (c *Conn) XselinuxInit() error {
for evNum, fun := range newExtEventFuncs["SELinux"] { for evNum, fun := range newExtEventFuncs["SELinux"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun newEventFuncs[int(reply.FirstEvent)+evNum] = fun
} }
for errNum, fun := range newExtErrorFuncs["SELinux"] {
newErrorFuncs[int(reply.FirstError)+errNum] = fun
}
c.extLock.Unlock() c.extLock.Unlock()
return nil return nil
@ -31,12 +34,9 @@ func (c *Conn) XselinuxInit() error {
func init() { func init() {
newExtEventFuncs["SELinux"] = make(map[int]newEventFun) 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 'Id'
// Skipping definition for base type 'Card8' // Skipping definition for base type 'Card8'
@ -59,6 +59,10 @@ func init() {
// Skipping definition for base type 'Double' // Skipping definition for base type 'Double'
// Skipping definition for base type 'Bool'
// Skipping definition for base type 'Float'
// 'XselinuxListItem' struct definition // 'XselinuxListItem' struct definition
// Size: ((12 + pad((int(ObjectContextLen) * 1))) + pad((int(DataContextLen) * 1))) // Size: ((12 + pad((int(ObjectContextLen) * 1))) + pad((int(DataContextLen) * 1)))
type XselinuxListItem struct { type XselinuxListItem struct {

View File

@ -1,7 +1,7 @@
package xgb 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! This file is automatically generated. Edit at your peril!
*/ */
@ -16,7 +16,7 @@ func (c *Conn) XtestInit() error {
case err != nil: case err != nil:
return err return err
case !reply.Present: 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() c.extLock.Lock()
@ -24,6 +24,9 @@ func (c *Conn) XtestInit() error {
for evNum, fun := range newExtEventFuncs["XTEST"] { for evNum, fun := range newExtEventFuncs["XTEST"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun newEventFuncs[int(reply.FirstEvent)+evNum] = fun
} }
for errNum, fun := range newExtErrorFuncs["XTEST"] {
newErrorFuncs[int(reply.FirstError)+errNum] = fun
}
c.extLock.Unlock() c.extLock.Unlock()
return nil return nil
@ -31,10 +34,9 @@ func (c *Conn) XtestInit() error {
func init() { func init() {
newExtEventFuncs["XTEST"] = make(map[int]newEventFun) 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 'Float'
// Skipping definition for base type 'Id' // Skipping definition for base type 'Id'
@ -59,6 +61,8 @@ func init() {
// Skipping definition for base type 'Double' // Skipping definition for base type 'Double'
// Skipping definition for base type 'Bool'
const ( const (
XtestCursorNone = 0 XtestCursorNone = 0
XtestCursorCurrent = 1 XtestCursorCurrent = 1

View File

@ -1,7 +1,7 @@
package xgb 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! This file is automatically generated. Edit at your peril!
*/ */
@ -17,7 +17,7 @@ func (c *Conn) XvInit() error {
case err != nil: case err != nil:
return err return err
case !reply.Present: 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() c.extLock.Lock()
@ -25,6 +25,9 @@ func (c *Conn) XvInit() error {
for evNum, fun := range newExtEventFuncs["XVideo"] { for evNum, fun := range newExtEventFuncs["XVideo"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun newEventFuncs[int(reply.FirstEvent)+evNum] = fun
} }
for errNum, fun := range newExtErrorFuncs["XVideo"] {
newErrorFuncs[int(reply.FirstError)+errNum] = fun
}
c.extLock.Unlock() c.extLock.Unlock()
return nil return nil
@ -32,14 +35,9 @@ func (c *Conn) XvInit() error {
func init() { func init() {
newExtEventFuncs["XVideo"] = make(map[int]newEventFun) 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 'Card16'
// Skipping definition for base type 'Char' // Skipping definition for base type 'Char'
@ -60,6 +58,12 @@ func init() {
// Skipping definition for base type 'Int32' // 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 ( const (
XvTypeInputMask = 1 XvTypeInputMask = 1
XvTypeOutputMask = 2 XvTypeOutputMask = 2
@ -1094,7 +1098,7 @@ func (err XvBadPortError) Error() string {
} }
func init() { func init() {
newErrorFuncs[0] = NewXvBadPortError newExtErrorFuncs["XVideo"][0] = NewXvBadPortError
} }
// Error definition XvBadEncoding (1) // Error definition XvBadEncoding (1)
@ -1139,7 +1143,7 @@ func (err XvBadEncodingError) Error() string {
} }
func init() { func init() {
newErrorFuncs[1] = NewXvBadEncodingError newExtErrorFuncs["XVideo"][1] = NewXvBadEncodingError
} }
// Error definition XvBadControl (2) // Error definition XvBadControl (2)
@ -1184,7 +1188,7 @@ func (err XvBadControlError) Error() string {
} }
func init() { func init() {
newErrorFuncs[2] = NewXvBadControlError newExtErrorFuncs["XVideo"][2] = NewXvBadControlError
} }
// Request XvQueryExtension // Request XvQueryExtension

View File

@ -1,7 +1,7 @@
package xgb 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! This file is automatically generated. Edit at your peril!
*/ */
@ -16,7 +16,7 @@ func (c *Conn) XvmcInit() error {
case err != nil: case err != nil:
return err return err
case !reply.Present: 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() c.extLock.Lock()
@ -24,6 +24,9 @@ func (c *Conn) XvmcInit() error {
for evNum, fun := range newExtEventFuncs["XVideo-MotionCompensation"] { for evNum, fun := range newExtEventFuncs["XVideo-MotionCompensation"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun newEventFuncs[int(reply.FirstEvent)+evNum] = fun
} }
for errNum, fun := range newExtErrorFuncs["XVideo-MotionCompensation"] {
newErrorFuncs[int(reply.FirstError)+errNum] = fun
}
c.extLock.Unlock() c.extLock.Unlock()
return nil return nil
@ -31,8 +34,11 @@ func (c *Conn) XvmcInit() error {
func init() { func init() {
newExtEventFuncs["XVideo-MotionCompensation"] = make(map[int]newEventFun) 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 'Void'
// Skipping definition for base type 'Byte' // Skipping definition for base type 'Byte'
@ -57,8 +63,6 @@ func init() {
// Skipping definition for base type 'Int16' // Skipping definition for base type 'Int16'
// Skipping definition for base type 'Int32'
// Skipping resource definition of 'Context' // Skipping resource definition of 'Context'
// Skipping resource definition of 'Surface' // Skipping resource definition of 'Surface'

View File

@ -2,19 +2,43 @@ package xgb
import ( import (
"errors" "errors"
"fmt" "log"
"io" "io"
"net" "net"
"os"
"sync" "sync"
) )
func init() {
log.SetFlags(0)
log.SetPrefix("XGB:")
}
const ( const (
// cookieBuffer represents the queue size of cookies existing at any // cookieBuffer represents the queue size of cookies existing at any
// point in time. The size of the buffer is really only important when // point in time. The size of the buffer is really only important when
// there are many requests without replies made in sequence. Once the // there are many requests without replies made in sequence. Once the
// buffer fills, a round trip request is made to clear the buffer. // buffer fills, a round trip request is made to clear the buffer.
cookieBuffer = 1000 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. // 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.extensions = make(map[string]byte)
conn.cookieChan = make(chan *cookie, cookieBuffer) conn.cookieChan = make(chan *cookie, cookieBuffer)
conn.xidChan = make(chan xid, 5) conn.xidChan = make(chan xid, xidBuffer)
conn.seqChan = make(chan uint16, 20) conn.seqChan = make(chan uint16, seqBuffer)
conn.reqChan = make(chan *request, 100) conn.reqChan = make(chan *request, reqBuffer)
conn.eventChan = make(chan eventOrError, 100) conn.eventChan = make(chan eventOrError, eventBuffer)
go conn.generateXIds() go conn.generateXIds()
go conn.generateSeqIds() go conn.generateSeqIds()
@ -106,7 +130,7 @@ type newEventFun func(buf []byte) Event
var newEventFuncs = make(map[int]newEventFun) var newEventFuncs = make(map[int]newEventFun)
// newExtEventFuncs is a temporary map that stores event constructor functions // 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. // extension is added to the 'newEventFuncs' map.
var newExtEventFuncs = make(map[string]map[int]newEventFun) var newExtEventFuncs = make(map[string]map[int]newEventFun)
@ -119,9 +143,16 @@ type Error interface {
Error() string Error() string
} }
type newErrorFun func(buf []byte) Error
// newErrorFuncs is a map from error numbers to functions that create // newErrorFuncs is a map from error numbers to functions that create
// the corresponding error. // 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 // eventOrError corresponds to values that can be either an event or an
// error. // error.
@ -239,28 +270,22 @@ func (c *Conn) sendRequests() {
cookie := c.newCookie(true, true) cookie := c.newCookie(true, true)
cookie.Sequence = c.newSequenceId() cookie.Sequence = c.newSequenceId()
c.cookieChan <- cookie c.cookieChan <- cookie
if !c.writeBuffer(c.getInputFocusRequest()) { c.writeBuffer(c.getInputFocusRequest())
return
}
GetInputFocusCookie{cookie}.Reply() // wait for the buffer to clear GetInputFocusCookie{cookie}.Reply() // wait for the buffer to clear
} }
req.cookie.Sequence = c.newSequenceId() req.cookie.Sequence = c.newSequenceId()
c.cookieChan <- req.cookie c.cookieChan <- req.cookie
if !c.writeBuffer(req.buf) { c.writeBuffer(req.buf)
return
}
} }
} }
// writeBuffer is a convenience function for writing a byte slice to the wire. // 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 { if _, err := c.conn.Write(buf); err != nil {
fmt.Fprintf(os.Stderr, "x protocol write error: %s\n", err) log.Printf("Write error: %s", err)
close(c.reqChan) log.Fatal("A write error is unrecoverable. Exiting...")
return false
} }
return true
} }
// readResponses is a goroutine that reads events, errors and // readResponses is a goroutine that reads events, errors and
@ -285,9 +310,8 @@ func (c *Conn) readResponses() {
err, event, seq = nil, nil, 0 err, event, seq = nil, nil, 0
if _, err := io.ReadFull(c.conn, buf); err != nil { if _, err := io.ReadFull(c.conn, buf); err != nil {
fmt.Fprintf(os.Stderr, "x protocol read error: %s\n", err) log.Printf("Read error: %s", err)
close(c.eventChan) log.Fatal("A read error is unrecoverable. Exiting...")
break
} }
switch buf[0] { switch buf[0] {
@ -296,10 +320,8 @@ func (c *Conn) readResponses() {
// generated) by looking it up by the error number. // generated) by looking it up by the error number.
newErrFun, ok := newErrorFuncs[int(buf[1])] newErrFun, ok := newErrorFuncs[int(buf[1])]
if !ok { if !ok {
fmt.Fprintf(os.Stderr, log.Printf("BUG: Could not find error constructor function " +
"BUG: "+ "for error with number %d.", buf[1])
"Could not find error constructor function for error "+
"with number %d.\n", buf[1])
continue continue
} }
err = newErrFun(buf) err = newErrFun(buf)
@ -317,9 +339,8 @@ func (c *Conn) readResponses() {
biggerBuf := make([]byte, byteCount) biggerBuf := make([]byte, byteCount)
copy(biggerBuf[:32], buf) copy(biggerBuf[:32], buf)
if _, err := io.ReadFull(c.conn, biggerBuf[32:]); err != nil { if _, err := io.ReadFull(c.conn, biggerBuf[32:]); err != nil {
fmt.Fprintf(os.Stderr, "x protocol read error: %s\n", err) log.Printf("Read error: %s", err)
close(c.eventChan) log.Fatal("A read error is unrecoverable. Exiting...")
break
} }
replyBytes = biggerBuf replyBytes = biggerBuf
} else { } else {
@ -336,17 +357,24 @@ func (c *Conn) readResponses() {
evNum := int(buf[0] & 127) evNum := int(buf[0] & 127)
newEventFun, ok := newEventFuncs[evNum] newEventFun, ok := newEventFuncs[evNum]
if !ok { if !ok {
fmt.Fprintf(os.Stderr, log.Printf("BUG: Could not find event construct function " +
"BUG: "+ "for event with number %d.", evNum)
"Could not find event constructor function for event "+
"with number %d.", evNum)
continue continue
} }
event = newEventFun(buf) event = newEventFun(buf)
// Put the event into the queue. // 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. // No more processing for events.
continue continue
@ -376,9 +404,8 @@ func (c *Conn) readResponses() {
} }
} else { // this is a reply } else { // this is a reply
if cookie.replyChan == nil { if cookie.replyChan == nil {
fmt.Fprintf(os.Stderr, log.Printf("Reply with sequence id %d does not have a "+
"Reply with sequence id %d does not have a "+ "cookie with a valid reply channel.", seq)
"cookie with a valid reply channel.\n", seq)
continue continue
} else { } else {
cookie.replyChan <- replyBytes cookie.replyChan <- replyBytes
@ -390,16 +417,14 @@ func (c *Conn) readResponses() {
switch { switch {
// Checked requests with replies // Checked requests with replies
case cookie.replyChan != nil && cookie.errorChan != nil: case cookie.replyChan != nil && cookie.errorChan != nil:
fmt.Fprintf(os.Stderr, log.Printf("Found cookie with sequence id %d that is " +
"Found cookie with sequence id %d that is expecting a "+ "expecting a reply but will never get it. Currently " +
"reply but will never get it. Currently on sequence "+ "on sequence number %d", cookie.Sequence, seq)
"number %d\n", cookie.Sequence, seq)
// Unchecked requests with replies // Unchecked requests with replies
case cookie.replyChan != nil && cookie.pingChan != nil: case cookie.replyChan != nil && cookie.pingChan != nil:
fmt.Fprintf(os.Stderr, log.Printf("Found cookie with sequence id %d that is " +
"Found cookie with sequence id %d that is expecting a "+ "expecting a reply (and not an error) but will never " +
"reply (and not an error) but will never get it. "+ "get it. Currently on sequence number %d",
"Currently on sequence number %d\n",
cookie.Sequence, seq) cookie.Sequence, seq)
// Checked requests without replies // Checked requests without replies
case cookie.pingChan != nil && cookie.errorChan != nil: case cookie.pingChan != nil && cookie.errorChan != nil:
@ -420,7 +445,7 @@ func processEventOrError(everr eventOrError) (Event, Error) {
case Error: case Error:
return nil, ee return nil, ee
default: default:
fmt.Fprintf(os.Stderr, "Invalid event/error type: %T\n", everr) log.Printf("Invalid event/error type: %T", everr)
return nil, nil return nil, nil
} }
panic("unreachable") panic("unreachable")

View File

@ -1,7 +1,6 @@
package xgb package xgb
import ( import (
"errors"
"fmt" "fmt"
"strings" "strings"
) )
@ -17,10 +16,10 @@ func sprintf(format string, v ...interface{}) string {
return fmt.Sprintf(format, v...) 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. // that 'stringsJoin' and 'sprintf' exists.
func newError(format string, v ...interface{}) error { func errorf(format string, v ...interface{}) error {
return errors.New(fmt.Sprintf(format, v...)) return fmt.Errorf(format, v...)
} }
// Pad a length to align on 4 bytes. // Pad a length to align on 4 bytes.

View File

@ -162,6 +162,24 @@ func TestWindowEvents(t *testing.T) {
t.Fatalf("ConfigureWindow: %s", err) 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) evOrErr := waitForEvent(t, 5)
switch event := evOrErr.ev.(type) { switch event := evOrErr.ev.(type) {
case ConfigureNotifyEvent: case ConfigureNotifyEvent:

View File

@ -86,7 +86,7 @@ func (c *Context) Morph(xmlBytes []byte) {
c.Putln("case err != nil:") c.Putln("case err != nil:")
c.Putln("return err") c.Putln("return err")
c.Putln("case !reply.Present:") 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) "on the server.\")", xname)
c.Putln("}") c.Putln("}")
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("for evNum, fun := range newExtEventFuncs[\"%s\"] {", xname)
c.Putln("newEventFuncs[int(reply.FirstEvent) + evNum] = fun") c.Putln("newEventFuncs[int(reply.FirstEvent) + evNum] = fun")
c.Putln("}") 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.extLock.Unlock()")
c.Putln("") c.Putln("")
c.Putln("return nil") c.Putln("return nil")
@ -102,8 +105,10 @@ func (c *Context) Morph(xmlBytes []byte) {
c.Putln("") c.Putln("")
// Make sure newExtEventFuncs["EXT_NAME"] map is initialized. // Make sure newExtEventFuncs["EXT_NAME"] map is initialized.
// Same deal for newExtErrorFuncs["EXT_NAME"]
c.Putln("func init() {") c.Putln("func init() {")
c.Putln("newExtEventFuncs[\"%s\"] = make(map[int]newEventFun)", xname) c.Putln("newExtEventFuncs[\"%s\"] = make(map[int]newEventFun)", xname)
c.Putln("newExtErrorFuncs[\"%s\"] = make(map[int]newErrorFun)", xname)
c.Putln("}") c.Putln("}")
c.Putln("") c.Putln("")
} }

View File

@ -29,7 +29,12 @@ func (e *Error) Define(c *Context) {
// Let's the XGB event loop read this error. // Let's the XGB event loop read this error.
c.Putln("func init() {") 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("}")
c.Putln("") c.Putln("")
} }
@ -95,7 +100,12 @@ func (e *ErrorCopy) Define(c *Context) {
// Let's the XGB know how to read this error. // Let's the XGB know how to read this error.
c.Putln("func init() {") 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("}")
c.Putln("") c.Putln("")
} }