[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

wayland: Changes to 'debian-unstable'



 Makefile.am                           |    5 
 configure.ac                          |   18 +
 debian/control                        |   21 ++
 debian/libwayland-bin.install         |    4 
 debian/libwayland-dev.install         |    5 
 doc/Contributing                      |   19 +
 doc/doxygen/.gitignore                |    1 
 doc/doxygen/Makefile.am               |   28 ++
 doc/doxygen/mainpage.dox              |   22 ++
 doc/doxygen/wayland.doxygen.in        |    6 
 doc/publican/protocol-to-docbook.xsl  |   39 +++
 doc/publican/sources/Architecture.xml |    4 
 doc/publican/sources/Protocol.xml     |    4 
 protocol/wayland.xml                  |  344 ++++++++++++++++------------------
 src/.gitignore                        |    1 
 src/connection.c                      |   14 -
 src/dtddata.S                         |    8 
 src/scanner.c                         |  329 ++++++++++++++++++++++----------
 src/wayland-client-core.h             |    6 
 src/wayland-client.c                  |  172 ++++++++++++++---
 src/wayland-client.h                  |    7 
 src/wayland-private.h                 |   12 -
 src/wayland-server-core.h             |    8 
 src/wayland-server.c                  |    2 
 src/wayland-server.h                  |    9 
 src/wayland-shm.c                     |   99 ++++++---
 src/wayland-util.c                    |   13 +
 src/wayland-util.h                    |   10 
 tests/display-test.c                  |   54 +++++
 tests/headers-protocol-core-test.c    |    7 
 tests/queue-test.c                    |  122 ++++++++++++
 tests/resources-test.c                |   10 
 tests/test-runner.c                   |    2 
 33 files changed, 1005 insertions(+), 400 deletions(-)

New commits:
commit a9d490ccbacc8646d402326790e65439e580e0f2
Author: Héctor Orón Martínez <zumbi@debian.org>
Date:   Thu Jun 2 11:11:34 2016 +0200

    make libwayland-dev multiarch aware
    
    This patch that makes libwayland-dev Multi-Arch:same. This is done by
    splitting that package into -dev and -bin. The -bin package contains
    the wayland-scanner executable, and it is Multi-Arch:foreign.
    
    Based on a patch from Dima Kogan
    
    Closes: #739400
    
    Signed-off-by: Héctor Orón Martínez <zumbi@debian.org>

diff --git a/debian/control b/debian/control
index c610c86..039f1db 100644
--- a/debian/control
+++ b/debian/control
@@ -96,6 +96,7 @@ Depends:
  libwayland-cursor0 (= ${binary:Version}),
  ${shlibs:Depends},
  ${misc:Depends},
+Multi-Arch: same
 Description: wayland compositor infrastructure - development files
  Wayland is a protocol for a compositor to talk to its clients as well
  as a C library implementation of that protocol. The compositor can be
@@ -113,6 +114,7 @@ Architecture: all
 Priority: extra
 Depends:
  ${misc:Depends},
+Multi-Arch: foreign
 Conflicts: libwayland-dev (<< 1.10.0-2)
 Replaces: libwayland-dev (<< 1.10.0-2)
 Description: wayland compositor infrastructure - documentation files
@@ -125,3 +127,22 @@ Description: wayland compositor infrastructure - documentation files
  .
  This package contains the documentation for the Wayland libraries.
  Non-developers likely have little use for this package.
+
+Package: libwayland-bin
+Section: libdevel
+Architecture: any
+Priority: extra
+Depends:
+ ${shlibs:Depends},
+ ${misc:Depends},
+ libwayland-dev
+Multi-Arch: foreign
+Description: wayland compositor infrastructure - binary utilities
+ Wayland is a protocol for a compositor to talk to its clients as well
+ as a C library implementation of that protocol. The compositor can be
+ a standalone display server running on Linux kernel modesetting and
+ evdev input devices, an X application, or a wayland client
+ itself. The clients can be traditional applications, X servers
+ (rootless or fullscreen) or other display servers.
+ .
+ This package contains the development binary utilities
diff --git a/debian/libwayland-bin.install b/debian/libwayland-bin.install
new file mode 100644
index 0000000..227f5b5
--- /dev/null
+++ b/debian/libwayland-bin.install
@@ -0,0 +1,4 @@
+# Tool to build various other packages:
+usr/bin/wayland-scanner
+usr/share/aclocal/wayland-scanner.m4
+usr/share/wayland/wayland-scanner.mk
diff --git a/debian/libwayland-dev.install b/debian/libwayland-dev.install
index 955af85..16b7996 100644
--- a/debian/libwayland-dev.install
+++ b/debian/libwayland-dev.install
@@ -1,6 +1,3 @@
-# Tool to build various other packages:
-usr/bin/wayland-scanner
-
 # Headers:
 usr/include
 
@@ -15,8 +12,6 @@ usr/lib/*/pkgconfig/wayland-client.pc
 usr/lib/*/pkgconfig/wayland-cursor.pc
 usr/lib/*/pkgconfig/wayland-server.pc
 usr/lib/*/pkgconfig/wayland-scanner.pc
-usr/share/aclocal/wayland-scanner.m4
-usr/share/wayland/wayland-scanner.mk
 
 # Documentation
 usr/share/wayland/wayland.xml

commit e56baa4aaaf20e9a3107089b74465af473481ef9
Author: Bryce Harrington <bryce@osg.samsung.com>
Date:   Tue May 31 17:11:20 2016 -0700

    configure.ac: bump to version 1.11.0 for the official release

diff --git a/configure.ac b/configure.ac
index 7dba928..cf96529 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,8 +1,8 @@
 AC_PREREQ([2.64])
 
 m4_define([wayland_major_version],  [1])
-m4_define([wayland_minor_version], [10])
-m4_define([wayland_micro_version], [93])
+m4_define([wayland_minor_version], [11])
+m4_define([wayland_micro_version],  [0])
 m4_define([wayland_version],
           [wayland_major_version.wayland_minor_version.wayland_micro_version])
 

commit 78c600e16c7d7cab288678fc6440196f16c1a09f
Author: Bryce Harrington <bryce@osg.samsung.com>
Date:   Tue May 24 12:29:59 2016 -0700

    configure.ac: bump to version 1.10.93 for the RC1 release

diff --git a/configure.ac b/configure.ac
index ca6e8c5..7dba928 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@ AC_PREREQ([2.64])
 
 m4_define([wayland_major_version],  [1])
 m4_define([wayland_minor_version], [10])
-m4_define([wayland_micro_version], [92])
+m4_define([wayland_micro_version], [93])
 m4_define([wayland_version],
           [wayland_major_version.wayland_minor_version.wayland_micro_version])
 

commit b8f3c199e3048cd4b0386d121e2f672ca31c9aa0
Author: Yong Bakos <ybakos@humanoriented.com>
Date:   Thu May 19 20:31:16 2016 -0600

    scanner: Remove unused forward decs from client protocol
    
    wayland-client-protocol.h had forward declarations for wl_client and
    wl_resource, yet nothing on the client side references these types.
    
    Add a 'side' condition to only generate these forward declarations in the
    server protocol header.
    
    Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
    Reviewed-by: <pekka.paalanen@collabora.co.uk>
    Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>

diff --git a/src/scanner.c b/src/scanner.c
index 037ebdb..5f06e8e 100644
--- a/src/scanner.c
+++ b/src/scanner.c
@@ -1477,13 +1477,13 @@ emit_header(struct protocol *protocol, enum side side)
 	       "#include \"%s\"\n\n"
 	       "#ifdef  __cplusplus\n"
 	       "extern \"C\" {\n"
-	       "#endif\n"
-	       "\n"
-	       "struct wl_client;\n"
-	       "struct wl_resource;\n\n",
+	       "#endif\n\n",
 	       protocol->uppercase_name, s,
 	       protocol->uppercase_name, s,
 	       get_include_name(protocol->core_headers, side));
+	if (side == SERVER)
+		printf("struct wl_client;\n"
+		       "struct wl_resource;\n\n");
 
 	emit_mainpage_blurb(protocol, side);
 

commit 5cb57d72685bea127e22f4305ec55fdc7ce2291f
Author: Marek Chalupa <mchqwerty@gmail.com>
Date:   Fri May 13 15:01:18 2016 +0200

    display-test: move a misplaced comment
    
    we split a function while refactoring in c643781 and now
    the comment makes no sense
    
    Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
    Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>

diff --git a/tests/display-test.c b/tests/display-test.c
index f9f8160..17956db 100644
--- a/tests/display-test.c
+++ b/tests/display-test.c
@@ -211,8 +211,6 @@ find_client_info(struct display *d, struct wl_client *client)
 {
 	struct client_info *ci;
 
-	/* find the right client_info struct and save the
-	 * resource as its data, so that we can use it later */
 	wl_list_for_each(ci, &d->clients, link) {
 		if (ci->wl_client == client)
 			return ci;
@@ -235,6 +233,8 @@ bind_seat(struct wl_client *client, void *data,
 	res = wl_resource_create(client, &wl_seat_interface, vers, id);
 	assert(res);
 
+	/* save the resource as client's info data,
+	 * so that we can use it later */
 	ci->data = res;
 }
 

commit 19a25d5e19e44cd19910a3a0b2b1dbcb1379bef0
Author: Yong Bakos <ybakos@humanoriented.com>
Date:   Thu May 19 10:27:29 2016 -0600

    tests: Check for client/server-core.h inclusion
    
    The purpose of wayland-*-protocol-core.h is to mimc the
    wayland-*-protocol.h generated by scanner --include-core-only.
    The only difference being what wayland-*-protocol.h should include.
    
    Add an include check in the headers-protocol-core-test, to be sure that
    a wayland-*-protocol.h generated with the --include-core-only option
    properly includes wayland-*-core.h.
    
    Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
    Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>

diff --git a/tests/headers-protocol-core-test.c b/tests/headers-protocol-core-test.c
index aabcb0b..5c2baf3 100644
--- a/tests/headers-protocol-core-test.c
+++ b/tests/headers-protocol-core-test.c
@@ -26,6 +26,13 @@
 #include "wayland-client-protocol-core.h"
 #include "wayland-server-protocol-core.h"
 
+#ifndef WAYLAND_CLIENT_CORE_H
+#error including wayland-client-protocol-core.h did not include wayland-client-core.h!
+#endif
+#ifndef WAYLAND_SERVER_CORE_H
+#error including wayland-server-protocol-core.h did not include wayland-server-core.h!
+#endif
+
 #ifdef WAYLAND_CLIENT_H
 #error including wayland-client-protocol-core.h included wayland-client.h!
 #endif

commit 8fb18a360ecccfb832b76a0c16e7843e64454395
Author: Bryce Harrington <bryce@osg.samsung.com>
Date:   Tue May 17 22:07:48 2016 -0700

    configure.ac: bump to version 1.10.92 for the beta release

diff --git a/configure.ac b/configure.ac
index a42dfc0..ca6e8c5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@ AC_PREREQ([2.64])
 
 m4_define([wayland_major_version],  [1])
 m4_define([wayland_minor_version], [10])
-m4_define([wayland_micro_version], [91])
+m4_define([wayland_micro_version], [92])
 m4_define([wayland_version],
           [wayland_major_version.wayland_minor_version.wayland_micro_version])
 

commit d2b75dd9730bf8d83c94858014b53265fc1dc681
Author: Yong Bakos <ybakos@humanoriented.com>
Date:   Sat May 7 09:11:30 2016 -0500

    private: Remove unnecessary forward declarations
    
    Declarations for wl_connection and wl_closure are not needed here.
    wl_closure already has a complete definition.
    Removing these forward declarations results in a clean, warning-free compile.
    
    Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
    Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
    [Updated to apply to trunk]
    Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>

diff --git a/src/wayland-private.h b/src/wayland-private.h
index a9a07a8..045109b 100644
--- a/src/wayland-private.h
+++ b/src/wayland-private.h
@@ -103,10 +103,6 @@ wl_map_lookup_flags(struct wl_map *map, uint32_t i);
 void
 wl_map_for_each(struct wl_map *map, wl_iterator_func_t func, void *data);
 
-struct wl_connection;
-struct wl_closure;
-struct wl_proxy;
-
 struct wl_connection *
 wl_connection_create(int fd);
 

commit 5e175a989cc8ef37407d289aad1faeb372463042
Author: Yong Bakos <ybakos@humanoriented.com>
Date:   Sun May 8 08:44:08 2016 -0500

    connection: Move wl_interface_equal to util
    
    Move the wl_interface_equal prototype to the top of wayland-private, where
    it is not buried in the middle of map, connection and closure functions.
    
    Move the implementation out of connection and into util. This is a utility
    function, not specific to connections, and has call sites within connection,
    wayland-client and wayland-server.
    
    Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
    Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
    Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>

diff --git a/src/connection.c b/src/connection.c
index 747229e..c3293a9 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -798,19 +798,6 @@ wl_connection_demarshal(struct wl_connection *connection,
 }
 
 int
-wl_interface_equal(const struct wl_interface *a, const struct wl_interface *b)
-{
-	/* In most cases the pointer equality test is sufficient.
-	 * However, in some cases, depending on how things are split
-	 * across shared objects, we can end up with multiple
-	 * instances of the interface metadata constants.  So if the
-	 * pointers match, the interfaces are equal, if they don't
-	 * match we have to compare the interface names. */
-
-	return a == b || strcmp(a->name, b->name) == 0;
-}
-
-int
 wl_closure_lookup_objects(struct wl_closure *closure, struct wl_map *objects)
 {
 	struct wl_object *object;
diff --git a/src/wayland-private.h b/src/wayland-private.h
index 994bc45..a9a07a8 100644
--- a/src/wayland-private.h
+++ b/src/wayland-private.h
@@ -55,6 +55,10 @@ struct wl_object {
 extern struct wl_object global_zombie_object;
 #define WL_ZOMBIE_OBJECT ((void*)&global_zombie_object)
 
+int
+wl_interface_equal(const struct wl_interface *iface1,
+		   const struct wl_interface *iface2);
+
 /* Flags for wl_map_insert_new and wl_map_insert_at.  Flags can be queried with
  * wl_map_lookup_flags.  The current implementation has room for 1 bit worth of
  * flags.  If more flags are ever added, the implementation of wl_map will have
@@ -103,10 +107,6 @@ struct wl_connection;
 struct wl_closure;
 struct wl_proxy;
 
-int
-wl_interface_equal(const struct wl_interface *iface1,
-		   const struct wl_interface *iface2);
-
 struct wl_connection *
 wl_connection_create(int fd);
 
diff --git a/src/wayland-util.c b/src/wayland-util.c
index 748476a..5bfb7e1 100644
--- a/src/wayland-util.c
+++ b/src/wayland-util.c
@@ -35,6 +35,19 @@
 
 struct wl_object global_zombie_object;
 
+int
+wl_interface_equal(const struct wl_interface *a, const struct wl_interface *b)
+{
+	/* In most cases the pointer equality test is sufficient.
+	 * However, in some cases, depending on how things are split
+	 * across shared objects, we can end up with multiple
+	 * instances of the interface metadata constants.  So if the
+	 * pointers match, the interfaces are equal, if they don't
+	 * match we have to compare the interface names.
+	 */
+	return a == b || strcmp(a->name, b->name) == 0;
+}
+
 WL_EXPORT void
 wl_list_init(struct wl_list *list)
 {

commit 1faebf6bcc60d2a59cc05a163d21211b707e1b7b
Author: Yong Bakos <ybakos@humanoriented.com>
Date:   Sun May 8 14:42:28 2016 -0500

    doc: Formalize file comment in wayland-client.h, wayland-server.h
    
    Publican was generating a subtle error during a build:
    Error: no ID for constraint linkend: Server-wayland-server-core_8h.
    
    This was caused by doxygen applying the doc comment at the top of
    wayland-server.h as the documentation for struct wl_object. As such, the
    generated documentation for wl_object was also very incorrect.
    
    Make the file doc comments in wayland-client.h and wayland-server.h real
    doxygen file doc comments with the \file command, add a \brief, make the
    inclusion warning a \warning, correct the language of the comment in
    wayland-server.h, and remove one unnecessary line break.
    
    This squelches the publican error, removes the bad wl_object documentation,
    and makes the comment appear in the generated html documentation.
    
    References: d74a9c079b1aeb44f69b4132dc2c38362e21f281
    
    Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
    Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>

diff --git a/src/wayland-client.h b/src/wayland-client.h
index 3856535..9f70fa3 100644
--- a/src/wayland-client.h
+++ b/src/wayland-client.h
@@ -23,8 +23,11 @@
  * SOFTWARE.
  */
 
-
-/** Use of this header file is discouraged. Prefer including
+/** \file
+ *
+ *  \brief Include the client API and protocol C API.
+ *
+ *  \warning Use of this header file is discouraged. Prefer including
  *  wayland-client-core.h instead, which does not include the
  *  client protocol header and as such only defines the library
  *  API.
diff --git a/src/wayland-server.h b/src/wayland-server.h
index b6d0e2b..3124703 100644
--- a/src/wayland-server.h
+++ b/src/wayland-server.h
@@ -23,10 +23,13 @@
  * SOFTWARE.
  */
 
-
-/** Use of this header file is discouraged. Prefer including
+/** \file
+ *
+ *  \brief Include the server API, deprecations and protocol C API.
+ *
+ *  \warning Use of this header file is discouraged. Prefer including
  *  wayland-server-core.h instead, which does not include the
- *  client protocol header and as such only defines the library
+ *  server protocol header and as such only defines the library
  *  API, excluding the deprecated API below.
  */
 

commit cfde76de1d804f0a533d9b356dfe6a234c7fc750
Author: Yong Bakos <ybakos@humanoriented.com>
Date:   Sat May 7 18:14:11 2016 -0500

    protocol: Remove double line break
    
    All vertical whitespace should manifest as a single blank line, never two.
    
    Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
    Reviewed-by: Jonas Ådahl <jadahl@gmail.com>

diff --git a/protocol/wayland.xml b/protocol/wayland.xml
index 92e3f43..700ef03 100644
--- a/protocol/wayland.xml
+++ b/protocol/wayland.xml
@@ -407,7 +407,6 @@
     </event>
   </interface>
 
-
   <interface name="wl_data_offer" version="3">
     <description summary="offer to transfer data">
       A wl_data_offer represents a piece of data offered for transfer

commit 14a01aaa97eaca3fde71f11b004ab4129c229b3a
Author: Armin Krezović <krezovic.armin@gmail.com>
Date:   Thu May 5 17:27:57 2016 +0200

    scanner: Add version argument to wayland-scanner
    
    This adds a command line argument to print wayland-scanner version.
    
    It also makes wayland-scanner emit a comment with wayland library
    version to every file it generates.
    
    v2: separate variable definitions into their own lines and remove
        old style "version" argument
    
    Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
    Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
    Tested-by: Yong Bakos <ybakos@humanoriented.com>
    Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
    Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>

diff --git a/src/scanner.c b/src/scanner.c
index 1317a06..037ebdb 100644
--- a/src/scanner.c
+++ b/src/scanner.c
@@ -26,6 +26,7 @@
  */
 
 #include "config.h"
+#include "wayland-version.h"
 
 #include <stdbool.h>
 #include <stdio.h>
@@ -64,12 +65,21 @@ usage(int ret)
 			"headers, server headers, or protocol marshalling code.\n\n");
 	fprintf(stderr, "options:\n");
 	fprintf(stderr, "    -h,  --help                  display this help and exit.\n"
+			"    -v,  --version               print the wayland library version that\n"
+			"                                 the scanner was built against.\n"
 		        "    -c,  --include-core-only     include the core version of the headers,\n"
 	                "                                 that is e.g. wayland-client-core.h instead\n"
 	                "                                 of wayland-client.h.\n");
 	exit(ret);
 }
 
+static int
+scanner_version(int ret)
+{
+	fprintf(stderr, "wayland-scanner %s\n", WAYLAND_VERSION);
+	exit(ret);
+}
+
 static bool
 is_dtd_valid(FILE *input, const char *filename)
 {
@@ -1457,6 +1467,8 @@ emit_header(struct protocol *protocol, enum side side)
 	const char *s = (side == SERVER) ? "SERVER" : "CLIENT";
 	char **p, *prev;
 
+	printf("/* Generated by wayland-scanner %s */\n\n", WAYLAND_VERSION);
+
 	printf("#ifndef %s_%s_PROTOCOL_H\n"
 	       "#define %s_%s_PROTOCOL_H\n"
 	       "\n"
@@ -1658,6 +1670,8 @@ emit_code(struct protocol *protocol)
 	struct wl_array types;
 	char **p, *prev;
 
+	printf("/* Generated by wayland-scanner %s */\n\n", WAYLAND_VERSION);
+
 	if (protocol->copyright)
 		format_text_to_comment(protocol->copyright, true);
 
@@ -1735,7 +1749,9 @@ int main(int argc, char *argv[])
 	char *input_filename = NULL;
 	int len;
 	void *buf;
-	bool help = false, core_headers = false;
+	bool help = false;
+	bool core_headers = false;
+	bool version = false;
 	bool fail = false;
 	int opt;
 	enum {
@@ -1746,12 +1762,13 @@ int main(int argc, char *argv[])
 
 	static const struct option options[] = {
 		{ "help",              no_argument, NULL, 'h' },
+		{ "version",           no_argument, NULL, 'v' },
 		{ "include-core-only", no_argument, NULL, 'c' },
 		{ 0,                   0,           NULL, 0 }
 	};
 
 	while (1) {
-		opt = getopt_long(argc, argv, "hc", options, NULL);
+		opt = getopt_long(argc, argv, "hvc", options, NULL);
 
 		if (opt == -1)
 			break;
@@ -1760,6 +1777,9 @@ int main(int argc, char *argv[])
 		case 'h':
 			help = true;
 			break;
+		case 'v':
+			version = true;
+			break;
 		case 'c':
 			core_headers = true;
 			break;
@@ -1774,6 +1794,8 @@ int main(int argc, char *argv[])
 
 	if (help)
 		usage(EXIT_SUCCESS);
+	else if (version)
+		scanner_version(EXIT_SUCCESS);
 	else if ((argc != 1 && argc != 3) || fail)
 		usage(EXIT_FAILURE);
 	else if (strcmp(argv[0], "help") == 0)

commit b8ac6bb8c9d719b059c677c1ae3edb3ec1dc0016
Author: Bryce Harrington <bryce@osg.samsung.com>
Date:   Tue May 3 17:56:22 2016 -0700

    configure.ac: bump to version 1.10.91 for the alpha release

diff --git a/configure.ac b/configure.ac
index bbe62f7..a42dfc0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@ AC_PREREQ([2.64])
 
 m4_define([wayland_major_version],  [1])
 m4_define([wayland_minor_version], [10])
-m4_define([wayland_micro_version], [90])
+m4_define([wayland_micro_version], [91])
 m4_define([wayland_version],
           [wayland_major_version.wayland_minor_version.wayland_micro_version])
 

commit 2b9c17608f2d45dc41bfe46982eadc18cc3755f9
Author: Auke Booij <auke@tulcod.com>
Date:   Sat Dec 5 12:39:12 2015 +0000

    protocol: add support for cross-interface enum attributes
    
    The enum attribute, for which scanner support was introduced in
    1771299, can be used to link message arguments to <enum>s. However,
    some arguments refer to <enum>s in a different <interface>.
    
    This adds scanner support for referring to an <enum> in a different
    <interface> using dot notation. It also sets the attributes in this
    style in the wayland XML protocol (wl_shm_pool::create_buffer::format
    to wl_shm::format, and wl_surface::set_buffer_transform::transform to
    wl_output::transform), and updates the documentation XSL so that this
    new style is supported.
    
    Changes since v2:
     - add object:: prefix for all enumerations in the documentation
     - fix whitespace in scanner.c
     - minor code fixup to return early and avoid casts in scanner.c
    
    Changes since v1:
     - several implementation bugs fixed
    
    Signed-off-by: Auke Booij <auke@tulcod.com>
    Reviewed-by: Nils Christopher Brause <nilschrbrause@googlemail.com>
    Reviewed-by: Bill Spitzak <spitzak@gmail.com>
    [Pekka: rebased across cde251a124d41977b447098cc530fcad2834a45f]
    [Pekka: wrap lines and space fixes in scanner.c]
    Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>

diff --git a/doc/publican/protocol-to-docbook.xsl b/doc/publican/protocol-to-docbook.xsl
index 5344442..210e0db 100644
--- a/doc/publican/protocol-to-docbook.xsl
+++ b/doc/publican/protocol-to-docbook.xsl
@@ -152,9 +152,22 @@
     <term><xsl:value-of select="@name"/></term>
     <listitem>
         <simpara>
-          <link linkend="protocol-spec-{../../@name}-enum-{@enum}">
-            <xsl:value-of select="../../@name"/>::<xsl:value-of select="@enum"/>
-          </link>
+          <xsl:choose>
+            <xsl:when test="contains(@enum, '.')">
+              <link linkend="protocol-spec-{substring-before(@enum, '.')}-enum-{substring-after(@enum, '.')}">
+                <xsl:value-of select="substring-before(@enum, '.')"/>
+                <xsl:text>::</xsl:text>
+                <xsl:value-of select="substring-after(@enum, '.')"/>
+              </link>
+            </xsl:when>
+            <xsl:otherwise>
+              <link linkend="protocol-spec-{../../@name}-enum-{@enum}">
+                <xsl:value-of select="../../@name"/>
+                <xsl:text>::</xsl:text>
+                <xsl:value-of select="@enum"/>
+              </link>
+            </xsl:otherwise>
+          </xsl:choose>
           (<xsl:value-of select="@type"/>)
           <xsl:if test="@summary" >
             - <xsl:value-of select="@summary"/>
diff --git a/protocol/wayland.xml b/protocol/wayland.xml
index 1555677..92e3f43 100644
--- a/protocol/wayland.xml
+++ b/protocol/wayland.xml
@@ -229,7 +229,7 @@
       <arg name="width" type="int"/>
       <arg name="height" type="int"/>
       <arg name="stride" type="int"/>
-      <arg name="format" type="uint"/>
+      <arg name="format" type="uint" enum="wl_shm.format"/>
     </request>
 
     <request name="destroy" type="destructor">
@@ -1580,7 +1580,7 @@
 	wl_output.transform enum the invalid_transform protocol error
 	is raised.
       </description>
-      <arg name="transform" type="int"/>
+      <arg name="transform" type="int" enum="wl_output.transform"/>
     </request>
 
     <!-- Version 3 additions -->
diff --git a/src/scanner.c b/src/scanner.c
index 52c07a6..1317a06 100644
--- a/src/scanner.c
+++ b/src/scanner.c
@@ -752,8 +752,8 @@ start_element(void *data, const char *element_name, const char **atts)
 			enumeration->bitfield = true;
 		else
 			fail(&ctx->loc,
-                             "invalid value (%s) for bitfield attribute (only true/false are accepted)",
-                             bitfield);
+			     "invalid value (%s) for bitfield attribute (only true/false are accepted)",
+			     bitfield);
 
 		wl_list_insert(ctx->interface->enumeration_list.prev,
 			       &enumeration->link);
@@ -790,32 +790,68 @@ start_element(void *data, const char *element_name, const char **atts)
 	}
 }
 
+static struct enumeration *
+find_enumeration(struct protocol *protocol,
+		 struct interface *interface,
+		 char *enum_attribute)
+{
+	struct interface *i;
+	struct enumeration *e;
+	char *enum_name;
+	uint idx = 0, j;
+
+	for (j = 0; j + 1 < strlen(enum_attribute); j++) {
+		if (enum_attribute[j] == '.') {
+			idx = j;
+		}
+	}
+
+	if (idx > 0) {
+		enum_name = enum_attribute + idx + 1;
+
+		wl_list_for_each(i, &protocol->interface_list, link)
+			if (strncmp(i->name, enum_attribute, idx) == 0)
+				wl_list_for_each(e, &i->enumeration_list, link)
+					if (strcmp(e->name, enum_name) == 0)
+						return e;
+	} else if (interface) {
+		enum_name = enum_attribute;
+
+		wl_list_for_each(e, &interface->enumeration_list, link)
+			if (strcmp(e->name, enum_name) == 0)
+				return e;
+	}
+
+	return NULL;
+}
+
 static void
-verify_arguments(struct parse_context *ctx, struct wl_list *messages, struct wl_list *enumerations)
+verify_arguments(struct parse_context *ctx,
+		 struct interface *interface,
+		 struct wl_list *messages,
+		 struct wl_list *enumerations)
 {
 	struct message *m;
 	wl_list_for_each(m, messages, link) {
 		struct arg *a;
 		wl_list_for_each(a, &m->arg_list, link) {
-			struct enumeration *e, *f;
+			struct enumeration *e;
 
 			if (!a->enumeration_name)
 				continue;
 
-			f = NULL;
-			wl_list_for_each(e, enumerations, link) {
-				if(strcmp(e->name, a->enumeration_name) == 0)
-					f = e;
-			}
 
-			if (f == NULL)
+			e = find_enumeration(ctx->protocol, interface,
+					     a->enumeration_name);
+
+			if (e == NULL)
 				fail(&ctx->loc,
 				     "could not find enumeration %s",
 				     a->enumeration_name);
 
 			switch (a->type) {
 			case INT:
-				if (f->bitfield)
+				if (e->bitfield)
 					fail(&ctx->loc,
 					     "bitfield-style enum must only be referenced by uint");
 				break;
@@ -853,12 +889,13 @@ end_element(void *data, const XML_Char *name)
 			     ctx->enumeration->name);
 		}
 		ctx->enumeration = NULL;
-	} else if (strcmp(name, "interface") == 0) {
-		struct interface *i = ctx->interface;
-
-		verify_arguments(ctx, &i->request_list, &i->enumeration_list);
-		verify_arguments(ctx, &i->event_list, &i->enumeration_list);
+	} else if (strcmp(name, "protocol") == 0) {
+		struct interface *i;
 
+		wl_list_for_each(i, &ctx->protocol->interface_list, link) {
+			verify_arguments(ctx, i, &i->request_list, &i->enumeration_list);
+			verify_arguments(ctx, i, &i->event_list, &i->enumeration_list);
+		}
 	}
 }
 

commit fdfd5dc94363a7c35c687d29f02eee79dcc2cadf
Author: Yong Bakos <ybakos@humanoriented.com>
Date:   Sat Apr 30 07:35:50 2016 -0500

    protocol: Add summaries to event parameters
    
    All event arg elements now have an appropriate summary attribute.
    This was conducted mostly in response to the undocumented parameter
    warnings generated during 'make check'.
    
    Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
    Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
    Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>

diff --git a/protocol/wayland.xml b/protocol/wayland.xml
index 378879e..1555677 100644
--- a/protocol/wayland.xml
+++ b/protocol/wayland.xml
@@ -70,9 +70,9 @@
 	own set of error codes.  The message is a brief description
 	of the error, for (debugging) convenience.
       </description>
-      <arg name="object_id" type="object"/>
-      <arg name="code" type="uint"/>
-      <arg name="message" type="string"/>
+      <arg name="object_id" type="object" summary="object where the error occurred"/>
+      <arg name="code" type="uint" summary="error code"/>
+      <arg name="message" type="string" summary="error description"/>
     </event>
 
     <enum name="error">
@@ -96,7 +96,7 @@
 	When the client receives this event, it will know that it can
 	safely reuse the object ID.
       </description>
-      <arg name="id" type="uint" />
+      <arg name="id" type="uint" summary="deleted object id"/>
     </event>
   </interface>
 
@@ -141,9 +141,9 @@
         the given name is now available, and it implements the
         given version of the given interface.
       </description>
-      <arg name="name" type="uint"/>
-      <arg name="interface" type="string"/>
-      <arg name="version" type="uint"/>
+      <arg name="name" type="uint" summary="numeric name of the global object"/>
+      <arg name="interface" type="string" summary="interface implemented by the object"/>
+      <arg name="version" type="uint" summary="interface version"/>
     </event>
 
     <event name="global_remove">
@@ -159,7 +159,7 @@
 	ignored until the client destroys it, to avoid races between
 	the global going away and a client sending a request to it.
       </description>
-      <arg name="name" type="uint"/>
+      <arg name="name" type="uint" summary="numeric name of the global object"/>
     </event>
   </interface>
 
@@ -367,7 +367,7 @@
 	can be used for buffers. Known formats include
 	argb8888 and xrgb8888.
       </description>
-      <arg name="format" type="uint" enum="format"/>
+      <arg name="format" type="uint" enum="format" summary="buffer pixel format"/>
     </event>
   </interface>
 
@@ -485,7 +485,7 @@
 	event per offered mime type.
       </description>
 
-      <arg name="mime_type" type="string"/>
+      <arg name="mime_type" type="string" summary="offered mime type"/>
     </event>
 
     <!-- Version 3 additions -->
@@ -550,7 +550,7 @@
 	will be sent right after wl_data_device.enter, or anytime the source
 	side changes its offered actions through wl_data_source.set_actions.
       </description>
-      <arg name="source_actions" type="uint"/>
+      <arg name="source_actions" type="uint" summary="actions offered by the data source"/>
     </event>
 
     <event name="action" since="3">
@@ -591,7 +591,7 @@
 	final wl_data_offer.set_actions and wl_data_offer.accept requests
 	must happen before the call to wl_data_offer.finish.
       </description>
-      <arg name="dnd_action" type="uint"/>
+      <arg name="dnd_action" type="uint" summary="action selected by the compositor"/>
     </event>
   </interface>
 
@@ -633,7 +633,7 @@
 	Used for feedback during drag-and-drop.
       </description>
 
-      <arg name="mime_type" type="string" allow-null="true"/>
+      <arg name="mime_type" type="string" allow-null="true" summary="mime type accepted by the target"/>
     </event>
 
     <event name="send">
@@ -643,8 +643,8 @@
 	close it.
       </description>
 
-      <arg name="mime_type" type="string"/>
-      <arg name="fd" type="fd"/>
+      <arg name="mime_type" type="string" summary="mime type for the data"/>
+      <arg name="fd" type="fd" summary="file descriptor for the data"/>
     </event>
 
     <event name="cancelled">
@@ -746,7 +746,7 @@
 	Clients can trigger cursor surface changes from this point, so
 	they reflect the current action.
       </description>
-      <arg name="dnd_action" type="uint"/>
+      <arg name="dnd_action" type="uint" summary="action selected by the compositor"/>
     </event>
   </interface>
 
@@ -821,7 +821,7 @@
 	mime types it offers.
       </description>
 
-      <arg name="id" type="new_id" interface="wl_data_offer"/>
+      <arg name="id" type="new_id" interface="wl_data_offer" summary="the new data_offer object"/>
     </event>
 
     <event name="enter">
@@ -832,11 +832,12 @@
 	coordinates.
       </description>
 
-      <arg name="serial" type="uint"/>
-      <arg name="surface" type="object" interface="wl_surface"/>
-      <arg name="x" type="fixed"/>
-      <arg name="y" type="fixed"/>
-      <arg name="id" type="object" interface="wl_data_offer" allow-null="true"/>
+      <arg name="serial" type="uint" summary="serial number of the enter event"/>
+      <arg name="surface" type="object" interface="wl_surface" summary="client surface entered"/>
+      <arg name="x" type="fixed" summary="surface-local x coordinate"/>
+      <arg name="y" type="fixed" summary="surface-local y coordinate"/>
+      <arg name="id" type="object" interface="wl_data_offer" allow-null="true"
+	   summary="source data_offer object"/>
     </event>
 
     <event name="leave">


Reply to: