Changed xgbgen to support xcb-proto 1.12

* Added minimal support for switch fields.
* Changed the way Size is calculated to accomodate for lists inside structs
  (added to randr)
* Removed heuristic to place alignment gaps, they are now explicitly
  described in xml
This commit is contained in:
aarzilli
2017-01-18 09:53:26 +01:00
committed by Přemysl Janouch
parent a102c4056f
commit 1c01d79ba1
9 changed files with 174 additions and 158 deletions

View File

@@ -49,8 +49,23 @@ func (c *Context) Morph(xmlBytes []byte) {
// Translate XML types to nice types
c.protocol = parsedXml.Translate(nil)
c.protocol.AddAlignGaps()
// For backwards compatibility we patch the type of the send_event field of
// PutImage to be byte
if c.protocol.Name == "shm" {
for _, req := range c.protocol.Requests {
if req.xmlName != "PutImage" {
continue
}
for _, ifield := range req.Fields {
field, ok := ifield.(*SingleField)
if !ok || field.xmlName != "send_event" {
continue
}
field.Type = &Base{ srcName: "byte", xmlName: "CARD8", size: newFixedSize(1, true) }
}
}
}
// Start with Go header.
c.Putln("// Package %s is the X client API for the %s extension.",