[Xcb] [PATCH libxcb 1/1] make support for server side stuff optional

Christian Linhart chris at demorecorder.com
Thu Jun 11 09:58:38 PDT 2015


and make it disabled by default with an EXPERIMENTAL warning

reason: this feature is unfinished and we want to have flexibility for
ABI/API changes, while still being able to make a release soon

Signed-off-by: Christian Linhart <chris at demorecorder.com>
---
 configure.ac    |  4 ++++
 src/Makefile.am |  6 ++++++
 src/c_client.py | 10 ++++++++--
 3 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 6e7e9c3..44feba3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -239,14 +239,18 @@ if test "x$LAUNCHD" = xauto; then
         AC_CHECK_PROG(LAUNCHD, [launchd], [yes], [no], [$PATH$PATH_SEPARATOR/sbin])
 fi
 
 if test "x$LAUNCHD" = xyes ; then
         AC_DEFINE(HAVE_LAUNCHD, 1, [launchd support available])
 fi
 
+AC_ARG_WITH(serverside-support, AS_HELP_STRING([--with-serverside-support], [Build with support for server-side usage of xcb. This is still EXPERIMENTAL! ABI/API may change! (default: no)]), [XCB_SERVERSIDE_SUPPORT=$withval], [XCB_SERVERSIDE_SUPPORT=no])
+
+AM_CONDITIONAL(XCB_SERVERSIDE_SUPPORT, test "x$XCB_SERVERSIDE_SUPPORT" = "xyes")
+
 AC_CONFIG_FILES([
 Makefile
 doc/Makefile
 man/Makefile
 src/Makefile
 tests/Makefile
 ])
diff --git a/src/Makefile.am b/src/Makefile.am
index 5a3c52a..e06e70b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -244,13 +244,19 @@ noinst_HEADERS = xcbint.h
 BUILT_MAN_PAGES = man/xcb_*
 libmandir = $(LIB_MAN_DIR)
 libman_DATA = $(BUILT_MAN_PAGES)
 
 BUILT_SOURCES = $(EXTSOURCES) $(BUILT_MAN_PAGES)
 CLEANFILES = $(EXTSOURCES) $(EXTHEADERS) $(BUILT_MAN_PAGES)
 
+C_CLIENT_PY_EXTRA_ARGS =
+if XCB_SERVERSIDE_SUPPORT
+C_CLIENT_PY_EXTRA_ARGS += --server-side
+endif
+
 $(EXTSOURCES): c_client.py $(XCBPROTO_XCBINCLUDEDIR)/$(@:.c=.xml)
 	$(AM_V_GEN)$(PYTHON) $(srcdir)/c_client.py	-c "$(PACKAGE_STRING)" -l "$(XORG_MAN_PAGE)" \
 		-s "$(LIB_MAN_SUFFIX)" -p $(XCBPROTO_XCBPYTHONDIR) \
+		$(C_CLIENT_PY_EXTRA_ARGS) \
 		$(XCBPROTO_XCBINCLUDEDIR)/$(@:.c=.xml)
 
 $(BUILT_MAN_PAGES): $(EXTSOURCES)
diff --git a/src/c_client.py b/src/c_client.py
index 9a7c67c..50ca753 100644
--- a/src/c_client.py
+++ b/src/c_client.py
@@ -4,14 +4,17 @@ import getopt
 import os
 import sys
 import errno
 import re
 
 # Jump to the bottom of this file for the main routine
 
+#config settings (can be changed with commandline options)
+config_server_side = False
+
 # Some hacks to make the API more readable, and to keep backwards compability
 _cname_re = re.compile('([A-Z0-9][a-z]+|[A-Z0-9]+(?![a-z])|[a-z]+)')
 _cname_special_cases = {'DECnet':'decnet'}
 
 _extension_special_cases = ['XPrint', 'XCMisc', 'BigRequests']
 
 _cplusplus_annoyances = {'class' : '_class',
@@ -3091,15 +3094,16 @@ def c_request(self, name):
     else:
         # Request prototypes
         _c_request_helper(self, name, void=True, regular=False)
         _c_request_helper(self, name, void=True, regular=True)
         if self.c_need_aux:
             _c_request_helper(self, name, void=True, regular=False, aux=True)
             _c_request_helper(self, name, void=True, regular=True, aux=True)
-        _c_accessors(self, name, name)
+        if config_server_side:
+            _c_accessors(self, name, name)
 
     # We generate the manpage afterwards because _c_type_setup has been called.
     # TODO: what about aux helpers?
     _man_request(self, name, void=not self.reply, aux=False)
 
 def c_event(self, name):
     '''
@@ -3202,29 +3206,31 @@ output = {'open'    : c_open,
           'error'   : c_error,
           }
 
 # Boilerplate below this point
 
 # Check for the argument that specifies path to the xcbgen python package.
 try:
-    opts, args = getopt.getopt(sys.argv[1:], 'c:l:s:p:m')
+    opts, args = getopt.getopt(sys.argv[1:], 'c:l:s:p:m', ["server-side"])
 except getopt.GetoptError as err:
     print(err)
     print('Usage: c_client.py -c center_footer -l left_footer -s section [-p path] file.xml')
     sys.exit(1)
 
 for (opt, arg) in opts:
     if opt == '-c':
         center_footer=arg
     if opt == '-l':
         left_footer=arg
     if opt == '-s':
         section=arg
     if opt == '-p':
         sys.path.insert(1, arg)
+    if opt == '--server-side':
+        config_server_side=True
     elif opt == '-m':
         manpaths = True
         sys.stdout.write('man_MANS = ')
 
 # Import the module class
 try:
     from xcbgen.state import Module
-- 
2.0.1



More information about the Xcb mailing list