summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/c_client.py32
-rw-r--r--src/xcb.h12
2 files changed, 43 insertions, 1 deletions
diff --git a/src/c_client.py b/src/c_client.py
index b0eb47c..0cbdf30 100644
--- a/src/c_client.py
+++ b/src/c_client.py
@@ -437,7 +437,11 @@ def _c_type_setup(self, name, postfix):
first_field_after_varsized = None
for field in self.fields:
- field.c_field_type = _t(field.field_type)
+ if field.type.is_event:
+ field.c_field_type = _t(field.field_type + ('event',))
+ else:
+ field.c_field_type = _t(field.field_type)
+
field.c_field_const_type = ('' if field.type.nmemb == 1 else 'const ') + field.c_field_type
field.c_field_name = _cpp(field.field_name)
field.c_subscript = '[%d]' % field.type.nmemb if (field.type.nmemb and field.type.nmemb > 1) else ''
@@ -3156,6 +3160,28 @@ def c_request(self, name):
# TODO: what about aux helpers?
_man_request(self, name, void=not self.reply, aux=False)
+
+def c_eventstruct(self, name):
+ #add fields that are needed to get the event-type in a generic way
+ self.fields.append( Field( tevent, tevent.name, 'event_header', False, True, True) )
+
+ if self.contains_ge_events:
+ #TODO: add header of ge-events as an extra field
+ raise Exception( 'eventstructs with ge-events are not yet supported' )
+
+ _c_type_setup(self, name, ())
+
+ #correct the format of the field names
+ for field in self.fields:
+ field.c_field_name = _n_item(field.c_field_name).lower()
+
+ _c_complex(self)
+ _c_iterator(self, name)
+
+ if not self.fixed_size():
+ #TODO: Create sizeof function (and maybe other accessors) for var-sized eventstructs
+ raise Exception( 'var sized eventstructs are not yet supported' )
+
def c_event(self, name):
'''
Exported function that handles event declarations.
@@ -3253,6 +3279,7 @@ output = {'open' : c_open,
'struct' : c_struct,
'union' : c_union,
'request' : c_request,
+ 'eventstruct' : c_eventstruct,
'event' : c_event,
'error' : c_error,
}
@@ -3296,6 +3323,9 @@ Refer to the README file in xcb/proto for more info.
''')
raise
+# predefined datatype globals.
+tevent = SimpleType(('xcb_raw_generic_event_t',), 32)
+
# Ensure the man subdirectory exists
try:
os.mkdir('man')
diff --git a/src/xcb.h b/src/xcb.h
index 6873e79..cbc0f2b 100644
--- a/src/xcb.h
+++ b/src/xcb.h
@@ -143,6 +143,18 @@ typedef struct {
} xcb_generic_event_t;
/**
+ * @brief Raw Generic event.
+ *
+ * A generic event structure as used on the wire, i.e., without the full_sequence field
+ */
+typedef struct {
+ uint8_t response_type; /**< Type of the response */
+ uint8_t pad0; /**< Padding */
+ uint16_t sequence; /**< Sequence number */
+ uint32_t pad[7]; /**< Padding */
+} xcb_raw_generic_event_t;
+
+/**
* @brief GE event
*
* An event as sent by the XGE extension. The length field specifies the