aboutsummaryrefslogtreecommitdiff
path: root/libxcb
diff options
context:
space:
mode:
Diffstat (limited to 'libxcb')
-rw-r--r--libxcb/src/c_client.py17
-rw-r--r--libxcb/xcb-proto/doc/xml-xcb.txt8
-rw-r--r--libxcb/xcb-proto/src/xcb.xsd1
-rw-r--r--libxcb/xcb-proto/xcbgen/xtypes.py26
4 files changed, 46 insertions, 6 deletions
diff --git a/libxcb/src/c_client.py b/libxcb/src/c_client.py
index a43eae21b..078037650 100644
--- a/libxcb/src/c_client.py
+++ b/libxcb/src/c_client.py
@@ -2838,6 +2838,23 @@ def c_event(self, name):
'''
Exported function that handles event declarations.
'''
+
+ # The generic event structure xcb_ge_event_t has the full_sequence field
+ # at the 32byte boundary. That's why we've to inject this field into GE
+ # events while generating the structure for them. Otherwise we would read
+ # garbage (the internal full_sequence) when accessing normal event fields
+ # there.
+ if hasattr(self, 'is_ge_event') and self.is_ge_event and self.name == name:
+ event_size = 0
+ for field in self.fields:
+ if field.type.size != None and field.type.nmemb != None:
+ event_size += field.type.size * field.type.nmemb
+ if event_size == 32:
+ full_sequence = Field(tcard32, tcard32.name, 'full_sequence', False, True, True)
+ idx = self.fields.index(field)
+ self.fields.insert(idx + 1, full_sequence)
+ break
+
_c_type_setup(self, name, ('event',))
# Opcode define
diff --git a/libxcb/xcb-proto/doc/xml-xcb.txt b/libxcb/xcb-proto/doc/xml-xcb.txt
index cf6d14e46..7311911f6 100644
--- a/libxcb/xcb-proto/doc/xml-xcb.txt
+++ b/libxcb/xcb-proto/doc/xml-xcb.txt
@@ -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>
@@ -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>
diff --git a/libxcb/xcb-proto/src/xcb.xsd b/libxcb/xcb-proto/src/xcb.xsd
index 4ef269e10..819495b95 100644
--- a/libxcb/xcb-proto/src/xcb.xsd
+++ b/libxcb/xcb-proto/src/xcb.xsd
@@ -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>
diff --git a/libxcb/xcb-proto/xcbgen/xtypes.py b/libxcb/xcb-proto/xcbgen/xtypes.py
index 5469cd961..a4614d9d2 100644
--- a/libxcb/xcb-proto/xcbgen/xtypes.py
+++ b/libxcb/xcb-proto/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']