From fd30f1512a713ae5b3cbacddfe9f29dfccc82047 Mon Sep 17 00:00:00 2001 From: "Andrew Gallant (Ocelot)" Date: Mon, 7 May 2012 01:00:45 -0400 Subject: added tests --- nexgb/auto_sync.go | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) (limited to 'nexgb/auto_sync.go') diff --git a/nexgb/auto_sync.go b/nexgb/auto_sync.go index e87c488..a59cf20 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 3:00:44am EDT. + This file was generated by sync.xml on May 6 2012 5:48:47pm EDT. This file is automatically generated. Edit at your peril! */ @@ -9,6 +9,30 @@ package xgb // in one package. They are still listed here for reference. // import "xproto" +// SyncInit must be called before using the SYNC extension. +func (c *Conn) SyncInit() error { + reply, err := c.QueryExtension(4, "SYNC").Reply() + switch { + case err != nil: + return err + case !reply.Present: + return newError("No extension named SYNC could be found on on the server.") + } + + c.extLock.Lock() + c.extensions["SYNC"] = reply.MajorOpcode + for evNum, fun := range newExtEventFuncs["SYNC"] { + newEventFuncs[int(reply.FirstEvent)+evNum] = fun + } + c.extLock.Unlock() + + return nil +} + +func init() { + newExtEventFuncs["SYNC"] = make(map[int]newEventFun) +} + // Skipping definition for base type 'Float' // Skipping definition for base type 'Id' @@ -465,7 +489,7 @@ func (v SyncCounterNotifyEvent) String() string { } func init() { - newEventFuncs[0] = NewSyncCounterNotifyEvent + newExtEventFuncs["SYNC"][0] = NewSyncCounterNotifyEvent } // Event definition SyncAlarmNotify (1) @@ -572,7 +596,7 @@ func (v SyncAlarmNotifyEvent) String() string { } func init() { - newEventFuncs[1] = NewSyncAlarmNotifyEvent + newExtEventFuncs["SYNC"][1] = NewSyncAlarmNotifyEvent } // Error definition SyncCounter (0) -- cgit v1.2.3-70-g09d2