Skip to content

Commit

Permalink
Add support for X Generic Extension events
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Keith Packard <[email protected]>
Signed-off-by: Peter Harris <[email protected]>
  • Loading branch information
bartsch authored and peterh committed Jul 12, 2013
1 parent e6a246e commit 56a8200
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
8 changes: 7 additions & 1 deletion doc/xml-xcb.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ Top-Level Elements
requests of the same type may be combined into a single request without
affecting the semantics of the requests.

<event name="identifier" number="integer" [no-sequence-number="true"]>
<event name="identifier" number="integer"
[[no-sequence-number="true"] | [xge="true"]]>
structure contents
</event>

Expand All @@ -142,6 +143,11 @@ Top-Level Elements
include a sequence number. This is a special-case for the KeymapNotify
event in the core protocol, and should not be used in any other event.

If the optional xge attribute is true, the event is an X Generic Event and
will be treated as such.

The no-sequence-number and xge attribute can not be combined.

<error name="identifier" number="integer">
structure contents
</error>
Expand Down
1 change: 1 addition & 0 deletions src/xcb.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ authorization from the authors.
</xsd:sequence>
<xsd:attribute name="no-sequence-number" type="xsd:boolean"
use="optional" />
<xsd:attribute name="xge" type="xsd:boolean" use="optional" />
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
Expand Down
26 changes: 21 additions & 5 deletions xcbgen/xtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -602,25 +602,41 @@ def __init__(self, name, elt):

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']
Expand Down

0 comments on commit 56a8200

Please sign in to comment.