[Xcb] [PATCH libxcb 2/4] generator: generate accessors for events, too

Christian Linhart chris at demorecorder.com
Thu Sep 4 08:50:49 PDT 2014

Accessors are generally needed for var-sized fields
and fields after var-sized fields.

Generic events can have ver-sized fields.
Therefore they need accessors.
 src/c_client.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/c_client.py b/src/c_client.py
index ab0b59e..4771bdd 100644
--- a/src/c_client.py
+++ b/src/c_client.py
@@ -3083,14 +3083,18 @@ def c_event(self, name):
                 # to remain aligned on a 64-bit boundary.  Adding full_sequence
                 # would normally break that; force the struct to be packed.
                 force_packed = any(f.type.size == 8 and f.type.is_simple for f in self.fields[(idx+1):])
     if self.name == name:
         _c_type_setup(self, name, ('event',))
+        # generate accessors
+        # (needed for fields after var-sized fields, for lists with var-sized elements,
+        # switches, ...)
+        _c_accessors(self, name, name)
         #no type-setup needed for eventcopies
         #(the type-setup of an eventcopy would overwrite members of the original
         #event, and it would create sizeof-etc funtions which
         #called undefined accessor functions)

More information about the Xcb mailing list