summaryrefslogtreecommitdiff
path: root/xcbgen
diff options
context:
space:
mode:
authorDaniel Martin <consume.noise@gmail.com>2013-06-08 11:20:38 +0200
committerPeter Harris <pharris@opentext.com>2013-07-12 15:54:14 -0400
commit56a82005ac388fcb7a4d1c82e07c7e72eaf69a32 (patch)
tree13cb5e7d760ff97b7a38d583462b706acda54de2 /xcbgen
parente6a246e50e62cbcba33d0e1d2371e69e6e089383 (diff)
downloadxcb-proto-56a82005ac388fcb7a4d1c82e07c7e72eaf69a32.tar.gz
Add support for X Generic Extension events
With these patches, we are able to mark an XGE event as such and generate the correct header for it. XGE events can be found in the X Input Extension v2++. Signed-off-by: Daniel Martin <consume.noise@gmail.com> Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Peter Harris <pharris@opentext.com>
Diffstat (limited to 'xcbgen')
-rw-r--r--xcbgen/xtypes.py26
1 files changed, 21 insertions, 5 deletions
diff --git a/xcbgen/xtypes.py b/xcbgen/xtypes.py
index 5469cd9..a4614d9 100644
--- a/xcbgen/xtypes.py
+++ b/xcbgen/xtypes.py
@@ -602,25 +602,41 @@ class Event(ComplexType):
self.has_seq = not bool(elt.get('no-sequence-number'))
+ self.is_ge_event = bool(elt.get('xge'))
+
self.doc = None
for item in list(elt):
if item.tag == 'doc':
self.doc = Doc(name, item)
-
+
def add_opcode(self, opcode, name, main):
self.opcodes[name] = opcode
if main:
self.name = name
def resolve(self, module):
+ def add_event_header():
+ self.fields.append(Field(tcard8, tcard8.name, 'response_type', False, True, True))
+ if self.has_seq:
+ self.fields.append(_placeholder_byte)
+ self.fields.append(Field(tcard16, tcard16.name, 'sequence', False, True, True))
+
+ def add_ge_event_header():
+ self.fields.append(Field(tcard8, tcard8.name, 'response_type', False, True, True))
+ self.fields.append(Field(tcard8, tcard8.name, 'extension', False, True, True))
+ self.fields.append(Field(tcard16, tcard16.name, 'sequence', False, True, True))
+ self.fields.append(Field(tcard32, tcard32.name, 'length', False, True, True))
+ self.fields.append(Field(tcard16, tcard16.name, 'event_type', False, True, True))
+
if self.resolved:
return
# Add the automatic protocol fields
- self.fields.append(Field(tcard8, tcard8.name, 'response_type', False, True, True))
- if self.has_seq:
- self.fields.append(_placeholder_byte)
- self.fields.append(Field(tcard16, tcard16.name, 'sequence', False, True, True))
+ if self.is_ge_event:
+ add_ge_event_header()
+ else:
+ add_event_header()
+
ComplexType.resolve(self, module)
out = __main__.output['event']