converting to new reply/cookie scheme

This commit is contained in:
Andrew Gallant (Ocelot)
2012-05-05 02:55:38 -04:00
parent a5d4ad6c9d
commit c222d406b0
4 changed files with 122 additions and 28 deletions

View File

@@ -28,6 +28,14 @@ func (e *Event) Define(c *Context) {
// Makes sure that this event type is an Event interface.
c.Putln("func (v %s) ImplementsEvent() { }", e.EvType())
c.Putln("")
c.Putln("func (v %s) SequenceId() uint16 {", e.EvType())
if e.NoSequence {
c.Putln("return uint16(0)")
} else {
c.Putln("return v.Sequence")
}
c.Putln("}")
c.Putln("")
// Let's the XGB event loop read this event.
c.Putln("func init() {")
@@ -99,6 +107,14 @@ func (e *EventCopy) Define(c *Context) {
// Makes sure that this event type is an Event interface.
c.Putln("func (v %s) ImplementsEvent() { }", e.EvType())
c.Putln("")
c.Putln("func (v %s) SequenceId() uint16 {", e.EvType())
if e.Old.(*Event).NoSequence {
c.Putln("return uint16(0)")
} else {
c.Putln("return v.Sequence")
}
c.Putln("}")
c.Putln("")
// Let's the XGB event loop read this event.
c.Putln("func init() {")