[Xcb-commit] libxcb: 3 commits - configure.ac Makefile.am src xcb-ge.pc.in

Christian Linhart clinhart at kemper.freedesktop.org
Sat Mar 11 10:08:43 UTC 2017


 Makefile.am     |    3 +++
 configure.ac    |    3 +++
 src/Makefile.am |    7 +++++++
 src/c_client.py |   41 ++++++++++++++++++++++++++++++++---------
 src/xcb.h       |   12 ++++++++++++
 xcb-ge.pc.in    |   11 +++++++++++
 6 files changed, 68 insertions(+), 9 deletions(-)

New commits:
commit ee9dfc9a7658e7fe75d27483bb5ed1ba4d1e2c86
Author: Christian Linhart <chris at demorecorder.com>
Date:   Wed Jan 25 10:21:05 2017 +0100

    add support for eventstruct
    
    eventstruct allows to use events as part of requests.
    This is, e.g., needed by xcb_input_send_extension_event.
    
    Signed-off-by: Christian Linhart <chris at demorecorder.com>

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
commit 0c2c5d50f8670da3e7601feb6a29b53509513da5
Author: Christian Linhart <chris at demorecorder.com>
Date:   Fri Jan 20 20:14:57 2017 +0100

    optionally build the GE extension
    
    xcb contains an xml-definition for the GenericEvent extension
    but this extension was neither generated nor built.
    
    This patch enables optional building of the GenericEvent extension
    with configure option --enable-ge
    
    By default, the GenericEvent extension is not built.
    Normally this is not needed by application programs
    because there is implicit support for the GE-extension
    for the specific events built with this extension.
    
    But it may be useful for X-protocol analyzers and stuff like that.
    
    Signed-off-by: Christian Linhart <chris at demorecorder.com>

diff --git a/Makefile.am b/Makefile.am
index 2475b6e..57c3a7b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -84,6 +84,9 @@ endif
 if BUILD_XVMC
 pkgconfig_DATA += xcb-xvmc.pc
 endif
+if BUILD_GE
+pkgconfig_DATA += xcb-ge.pc
+endif
 
 
 AM_TESTS_ENVIRONMENT = \
diff --git a/configure.ac b/configure.ac
index ec31542..d3165c6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -220,6 +220,7 @@ XCB_EXTENSION(Damage, yes)
 XCB_EXTENSION(DPMS, yes)
 XCB_EXTENSION(DRI2, yes)
 XCB_EXTENSION(DRI3, $have_sendmsg)
+XCB_EXTENSION(GE, no)
 XCB_EXTENSION(GLX, yes)
 XCB_EXTENSION(Present, yes)
 XCB_EXTENSION(RandR, yes)
@@ -271,6 +272,7 @@ xcb-damage.pc
 xcb-dpms.pc
 xcb-dri2.pc
 xcb-dri3.pc
+xcb-ge.pc
 xcb-glx.pc
 xcb-present.pc
 xcb-randr.pc
@@ -318,6 +320,7 @@ echo "    Damage..............: ${BUILD_DAMAGE}"
 echo "    Dpms................: ${BUILD_DPMS}"
 echo "    Dri2................: ${BUILD_DRI2}"
 echo "    Dri3................: ${BUILD_DRI3}"
+echo "    GenericEvent........: ${BUILD_GE}"
 echo "    Glx.................: ${BUILD_GLX}"
 echo "    Randr...............: ${BUILD_RANDR}"
 echo "    Record..............: ${BUILD_RECORD}"
diff --git a/src/Makefile.am b/src/Makefile.am
index e06e70b..17b64a8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -232,6 +232,13 @@ libxcb_xvmc_la_LIBADD = $(XCB_LIBS)
 nodist_libxcb_xvmc_la_SOURCES = xvmc.c xvmc.h
 endif
 
+EXTSOURCES += ge.c
+if BUILD_GE
+lib_LTLIBRARIES += libxcb-ge.la
+libxcb_ge_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@
+libxcb_ge_la_LIBADD = $(XCB_LIBS)
+nodist_libxcb_ge_la_SOURCES = ge.c ge.h
+endif
 
 EXTHEADERS=$(EXTSOURCES:.c=.h)
 xcbinclude_HEADERS = xcb.h xcbext.h
diff --git a/xcb-ge.pc.in b/xcb-ge.pc.in
new file mode 100644
index 0000000..b5f380d
--- /dev/null
+++ b/xcb-ge.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: XCB GenericEvent
+Description: XCB GenericEvent Extension
+Version: @PACKAGE_VERSION@
+Requires.private: xcb
+Libs: -L${libdir} -lxcb-ge
+Cflags: -I${includedir}
commit 9bce1f72e329cb407b7a95589b9675a08129b65d
Author: Christian Linhart <chris at demorecorder.com>
Date:   Fri Jan 20 14:40:25 2017 +0100

    move symbol lookup of sumof expr to the parser
    
    replace the complicated symboltable lookup for sumof expr
    by accessing the lenfield of the expr-object.
    
    This requires the corresponding patch for xcb/proto
    which sets the lenfield accordingly.
    
    This should be OK because for official releases we define
    that dependency in the build system.
    
    For getting versions off the HEAD of the git repo, it should
    be obvious that xcb/proto and xcb/libxcb have to be updated together.
    
    I have tested this patch and it generates exactly the same code
    as before.
    
    Tested-by: Christian Linhart <chris at demorecorder.com>
    Signed-off-by: Christian Linhart <chris at demorecorder.com>

diff --git a/src/c_client.py b/src/c_client.py
index 043338d..b0eb47c 100644
--- a/src/c_client.py
+++ b/src/c_client.py
@@ -1661,14 +1661,7 @@ def _c_accessor_get_expr(expr, field_mapping):
         return c_name
     elif expr.op == 'sumof':
         # locate the referenced list object
-        field = None
-        for f in expr.lenfield_parent.fields:
-            if f.field_name == expr.lenfield_name:
-                field = f
-                break
-
-        if field is None:
-            raise Exception("list field '%s' referenced by sumof not found" % expr.lenfield_name)
+        field = expr.lenfield
         list_name = field_mapping[field.c_field_name][0]
         c_length_func = "%s(%s)" % (field.c_length_name, list_name)
         c_length_func = _c_accessor_get_expr(field.type.expr, field_mapping)


More information about the xcb-commit mailing list