summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Martin <consume.noise@gmail.com>2013-06-08 11:20:39 +0200
committerPeter Harris <pharris@opentext.com>2013-07-12 15:56:14 -0400
commit45619dc71e9411a526d7c69595cf615b1b1206cf (patch)
tree31d7aaf358e5c70fe5b9c49d038d39a0cb0db087
parenta1e67b141a57d39cbcaff1a703d6fc0da1fbb56d (diff)
c_client.py: Inject full_sequence into GE events
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. Signed-off-by: Daniel Martin <consume.noise@gmail.com> Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Peter Harris <pharris@opentext.com>
-rw-r--r--src/c_client.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/c_client.py b/src/c_client.py
index 942e78a..c477bab 100644
--- a/src/c_client.py
+++ b/src/c_client.py
@@ -2837,6 +2837,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