diff options
Diffstat (limited to 'libxcb/src/c_client.py')
-rw-r--r-- | libxcb/src/c_client.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/libxcb/src/c_client.py b/libxcb/src/c_client.py index fa65c1baa..f56e39c0d 100644 --- a/libxcb/src/c_client.py +++ b/libxcb/src/c_client.py @@ -172,6 +172,7 @@ def c_open(self): _c('#include <assert.h>')
_c('#include "xcbext.h"')
_c('#include "%s.h"', _ns.header)
+ _c('#include <X11/Xtrans/Xtrans.h>')
if _ns.is_ext:
for (n, h) in self.imports:
@@ -1456,8 +1457,8 @@ def _c_accessors_field(self, field): _c(' return (%s *) (R + 1);', field.c_field_type)
else:
_c(' xcb_generic_iterator_t prev = %s;', _c_iterator_get_end(field.prev_varsized_field, 'R'))
- _c(' return * (%s *) ((char *) prev.data + XCB_TYPE_PAD(%s, prev.index) + %d);',
- field.c_field_type, field.first_field_after_varsized.type.c_type, field.prev_varsized_offset)
+ sizeoftype='char' if field.first_field_after_varsized.type.c_type == 'void' else field.first_field_after_varsized.type.c_type
+ _c(' return * (%s *) ((char *) prev.data + XCB_TYPE_PAD(%s, prev.index) + %d);', field.c_field_type, sizeoftype, field.prev_varsized_offset)
_c('}')
else:
_hc('')
@@ -1487,8 +1488,8 @@ def _c_accessors_field(self, field): # 'corrected' in the reply function
else:
_c(' xcb_generic_iterator_t prev = %s;', _c_iterator_get_end(field.prev_varsized_field, 'R'))
- _c(' return (%s) ((char *) prev.data + XCB_TYPE_PAD(%s, prev.index) + %d);',
- return_type, field.first_field_after_varsized.type.c_type, field.prev_varsized_offset)
+ sizeoftype='char' if field.first_field_after_varsized.type.c_type == 'void' else field.first_field_after_varsized.type.c_type
+ _c(' return (%s) ((char *) prev.data + XCB_TYPE_PAD(%s, prev.index) + %d);', return_type, sizeoftype, field.prev_varsized_offset)
_c('}')
@@ -1574,8 +1575,8 @@ def _c_accessors_list(self, field): _c(' return (%s *) (R + 1);', field.c_field_type)
else:
_c(' xcb_generic_iterator_t prev = %s;', _c_iterator_get_end(field.prev_varsized_field, 'R'))
- _c(' return (%s *) ((char *) prev.data + XCB_TYPE_PAD(%s, prev.index) + %d);',
- field.c_field_type, field.first_field_after_varsized.type.c_type, field.prev_varsized_offset)
+ sizeoftype='char' if field.first_field_after_varsized.type.c_type == 'void' else field.first_field_after_varsized.type.c_type
+ _c(' return (%s *) ((char *) prev.data + XCB_TYPE_PAD(%s, prev.index) + %d);', field.c_field_type, sizeoftype, field.prev_varsized_offset)
_c('}')
_hc('')
@@ -1678,8 +1679,8 @@ def _c_accessors_list(self, field): _c(' i.data = (%s *) (R + 1);', field.c_field_type)
else:
_c(' xcb_generic_iterator_t prev = %s;', _c_iterator_get_end(field.prev_varsized_field, 'R'))
- _c(' i.data = (%s *) ((char *) prev.data + XCB_TYPE_PAD(%s, prev.index));',
- field.c_field_type, field.c_field_type)
+ sizeoftype='char' if field.c_field_type == 'void' else field.c_field_type
+ _c(' i.data = (%s *) ((char *) prev.data + XCB_TYPE_PAD(%s, prev.index));', field.c_field_type, sizeoftype)
if switch_obj is None:
_c(' i.rem = %s;', _c_accessor_get_expr(field.type.expr, fields))
_c(' i.index = (char *) i.data - (char *) %s;', 'R' if switch_obj is None else 'S' )
|