Makefile.am | 4 configure.ac | 16 debian/changelog | 9 debian/control | 1 debian/libwayland-client0.symbols | 5 debian/libwayland-dev.install | 3 debian/libwayland-server0.symbols | 43 - doc/Contributing | 83 +++ doc/Makefile.am | 2 doc/publican/sources/Protocol.xml | 2 protocol/wayland.xml | 161 +++++- src/Makefile.am | 5 src/connection.c | 66 ++ src/data-device.c | 539 ---------------------- src/event-loop.c | 2 src/scanner.c | 65 +- src/wayland-client.c | 343 +++++++++++--- src/wayland-client.h | 6 src/wayland-private.h | 36 + src/wayland-scanner-uninstalled.pc.in | 6 src/wayland-scanner.pc.in | 9 src/wayland-server.c | 811 +++++++++++----------------------- src/wayland-server.h | 362 +++------------ src/wayland-shm.c | 133 ++--- src/wayland-util.c | 60 ++ src/wayland-util.h | 13 tests/client-test.c | 2 tests/connection-test.c | 4 tests/display-test.c | 2 tests/event-loop-test.c | 3 tests/map-test.c | 54 +- tests/os-wrappers-test.c | 2 tests/queue-test.c | 5 wayland-scanner.m4 | 11 wayland-scanner.m4.in | 16 35 files changed, 1252 insertions(+), 1632 deletions(-)
New commits: commit a5e1d00f3a9bc86dfdb6f22010ec8574dff3be3f Author: Sven Joachim <svenj...@gmx.de> Date: Sun Jul 14 18:38:24 2013 +0200 Update symbols files 24 symbols disappeared from libwayland-server0, breaking weston releases prior to 1.2.0. diff --git a/debian/changelog b/debian/changelog index 75114d6..e04242f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,9 @@ wayland (1.2.0-1) UNRELEASED; urgency=low * New upstream release. + * Update symbols files. + - ABI break: libwayland-server0 removed several symbols used by + weston releases prior to 1.2, add a Breaks to accommodate that. -- Sven Joachim <svenj...@gmx.de> Sun, 14 Jul 2013 18:00:05 +0200 diff --git a/debian/control b/debian/control index 6140d23..b98974c 100644 --- a/debian/control +++ b/debian/control @@ -67,6 +67,7 @@ Depends: ${misc:Depends}, Conflicts: libwayland0 (<< 1.0.5) Replaces: libwayland0 (<< 1.0.5) +Breaks: weston (<< 1.2.0) Description: wayland compositor infrastructure - server library 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 diff --git a/debian/libwayland-client0.symbols b/debian/libwayland-client0.symbols index e418551..4900ad4 100644 --- a/debian/libwayland-client0.symbols +++ b/debian/libwayland-client0.symbols @@ -11,6 +11,7 @@ libwayland-client.so.0 libwayland-client0 #MINVER# wl_data_device_manager_interface@Base 1.0.2 wl_data_offer_interface@Base 1.0.2 wl_data_source_interface@Base 1.0.2 + wl_display_cancel_read@Base 1.2.0 wl_display_connect@Base 1.0.2 wl_display_connect_to_fd@Base 1.0.2 wl_display_create_queue@Base 1.0.2 @@ -23,6 +24,9 @@ libwayland-client.so.0 libwayland-client0 #MINVER# wl_display_get_error@Base 1.0.2 wl_display_get_fd@Base 1.0.2 wl_display_interface@Base 1.0.2 + wl_display_prepare_read@Base 1.2.0 + wl_display_prepare_read_queue@Base 1.2.0 + wl_display_read_events@Base 1.2.0 wl_display_roundtrip@Base 1.0.2 wl_event_queue_destroy@Base 1.0.2 wl_keyboard_interface@Base 1.0.2 @@ -38,6 +42,7 @@ libwayland-client.so.0 libwayland-client0 #MINVER# wl_map_insert_at@Base 1.0.2 wl_map_insert_new@Base 1.0.2 wl_map_lookup@Base 1.0.2 + wl_map_lookup_flags@Base 1.2.0 wl_map_release@Base 1.0.2 wl_map_remove@Base 1.0.2 wl_map_reserve_new@Base 1.0.2 diff --git a/debian/libwayland-server0.symbols b/debian/libwayland-server0.symbols index e1cdc34..4c3f94b 100644 --- a/debian/libwayland-server0.symbols +++ b/debian/libwayland-server0.symbols @@ -5,7 +5,6 @@ libwayland-server.so.0 libwayland-server0 #MINVER# wl_array_init@Base 1.0.2 wl_array_release@Base 1.0.2 wl_buffer_interface@Base 1.0.2 - wl_buffer_is_shm@Base 1.0.2 wl_callback_interface@Base 1.0.2 wl_client_add_destroy_listener@Base 1.0.2 wl_client_add_object@Base 1.0.2 @@ -18,11 +17,10 @@ libwayland-server.so.0 libwayland-server0 #MINVER# wl_client_get_display@Base 1.0.2 wl_client_get_object@Base 1.0.2 wl_client_new_object@Base 1.0.2 + wl_client_post_no_memory@Base 1.2.0 wl_compositor_interface@Base 1.0.2 wl_data_device_interface@Base 1.0.2 - wl_data_device_manager_init@Base 1.0.2 wl_data_device_manager_interface@Base 1.0.2 - wl_data_device_set_keyboard_focus@Base 1.0.2 wl_data_offer_interface@Base 1.0.2 wl_data_source_interface@Base 1.0.2 wl_display_add_destroy_listener@Base 1.0.4 @@ -55,12 +53,9 @@ libwayland-server.so.0 libwayland-server0 #MINVER# wl_event_source_fd_update@Base 1.0.2 wl_event_source_remove@Base 1.0.2 wl_event_source_timer_update@Base 1.0.2 - wl_keyboard_end_grab@Base 1.0.2 - wl_keyboard_init@Base 1.0.2 + wl_global_create@Base 1.2.0 + wl_global_destroy@Base 1.2.0 wl_keyboard_interface@Base 1.0.2 - wl_keyboard_release@Base 1.0.2 - wl_keyboard_set_focus@Base 1.0.2 - wl_keyboard_start_grab@Base 1.0.2 wl_list_empty@Base 1.0.2 wl_list_init@Base 1.0.2 wl_list_insert@Base 1.0.2 @@ -73,34 +68,38 @@ libwayland-server.so.0 libwayland-server0 #MINVER# wl_map_insert_at@Base 1.0.2 wl_map_insert_new@Base 1.0.2 wl_map_lookup@Base 1.0.2 + wl_map_lookup_flags@Base 1.2.0 wl_map_release@Base 1.0.2 wl_map_remove@Base 1.0.2 wl_map_reserve_new@Base 1.0.2 wl_output_interface@Base 1.0.2 - wl_pointer_end_grab@Base 1.0.2 - wl_pointer_init@Base 1.0.2 wl_pointer_interface@Base 1.0.2 - wl_pointer_release@Base 1.0.2 - wl_pointer_set_current@Base 1.1.0 - wl_pointer_set_focus@Base 1.0.2 - wl_pointer_start_grab@Base 1.0.2 wl_region_interface@Base 1.0.2 wl_registry_interface@Base 1.0.2 + wl_resource_add_destroy_listener@Base 1.2.0 + wl_resource_create@Base 1.2.0 wl_resource_destroy@Base 1.0.2 + wl_resource_find_for_client@Base 1.2.0 + wl_resource_from_link@Base 1.2.0 + wl_resource_get_client@Base 1.2.0 + wl_resource_get_destroy_listener@Base 1.2.0 + wl_resource_get_id@Base 1.2.0 + wl_resource_get_link@Base 1.2.0 + wl_resource_get_user_data@Base 1.2.0 + wl_resource_get_version@Base 1.2.0 + wl_resource_instance_of@Base 1.2.0 wl_resource_post_error@Base 1.0.2 wl_resource_post_event@Base 1.0.2 wl_resource_post_no_memory@Base 1.0.2 wl_resource_queue_event@Base 1.0.2 - wl_seat_init@Base 1.0.2 + wl_resource_set_destructor@Base 1.2.0 + wl_resource_set_implementation@Base 1.2.0 + wl_resource_set_user_data@Base 1.2.0 wl_seat_interface@Base 1.0.2 - wl_seat_release@Base 1.0.2 - wl_seat_set_keyboard@Base 1.0.2 - wl_seat_set_pointer@Base 1.0.2 - wl_seat_set_selection@Base 1.0.2 - wl_seat_set_touch@Base 1.0.2 wl_shell_interface@Base 1.0.2 wl_shell_surface_interface@Base 1.0.2 wl_shm_buffer_create@Base 1.0.2 + wl_shm_buffer_get@Base 1.2.0 wl_shm_buffer_get_data@Base 1.0.2 wl_shm_buffer_get_format@Base 1.0.2 wl_shm_buffer_get_height@Base 1.0.2 @@ -109,8 +108,4 @@ libwayland-server.so.0 libwayland-server0 #MINVER# wl_shm_interface@Base 1.0.2 wl_shm_pool_interface@Base 1.0.2 wl_surface_interface@Base 1.0.2 - wl_touch_end_grab@Base 1.0.2 - wl_touch_init@Base 1.0.2 wl_touch_interface@Base 1.0.2 - wl_touch_release@Base 1.0.2 - wl_touch_start_grab@Base 1.0.2 commit cfb1345adeae2f250ae22f19e3f37fbec548fe2c Author: Sven Joachim <svenj...@gmx.de> Date: Sun Jul 14 18:13:09 2013 +0200 Update libwayland-dev.install Add wayland-scanner.pc as per commit 40fc79d5b095e330ab6f. Adjust wayland-scanner.mk location per commit 60fc83af6ea47bd6. diff --git a/debian/libwayland-dev.install b/debian/libwayland-dev.install index 7fab4ad..66840ea 100644 --- a/debian/libwayland-dev.install +++ b/debian/libwayland-dev.install @@ -17,5 +17,6 @@ usr/lib/*/libwayland-server.so usr/lib/*/pkgconfig/wayland-client.pc usr/lib/*/pkgconfig/wayland-cursor.pc usr/lib/*/pkgconfig/wayland-server.pc +usr/share/pkgconfig/wayland-scanner.pc usr/share/aclocal/wayland-scanner.m4 -usr/share/aclocal/wayland-scanner.mk +usr/share/wayland/wayland-scanner.mk commit 04852dbe2b43eb4d0cc513bf00f327d67ff2f9b8 Author: Sven Joachim <svenj...@gmx.de> Date: Sun Jul 14 18:00:10 2013 +0200 New upstream release diff --git a/debian/changelog b/debian/changelog index b33e1ed..75114d6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +wayland (1.2.0-1) UNRELEASED; urgency=low + + * New upstream release. + + -- Sven Joachim <svenj...@gmx.de> Sun, 14 Jul 2013 18:00:05 +0200 + wayland (1.1.0-2) unstable; urgency=low * Team upload. commit 6ef06ad06d0c32bff6bbd471a50a17bd7f92e0bc Author: Kristian Høgsberg <k...@bitplanet.net> Date: Sat Jul 13 01:30:45 2013 -0400 Bump version to 1.2.0 diff --git a/configure.ac b/configure.ac index 82e55e4..536df9e 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], [1]) -m4_define([wayland_micro_version], [91]) +m4_define([wayland_minor_version], [2]) +m4_define([wayland_micro_version], [0]) m4_define([wayland_version], [wayland_major_version.wayland_minor_version.wayland_micro_version]) commit e0579bfb61320653e3af74f5abb3bd50785c10b1 Author: Kristian Høgsberg <k...@bitplanet.net> Date: Sat Jul 13 00:42:14 2013 -0400 wayland-client: Handle potential NULL-deref Instead, return -1 on out-of-memory. errno will be set to ENOMEM by the failing malloc. diff --git a/src/wayland-client.c b/src/wayland-client.c index 34c8196..2887a40 100644 --- a/src/wayland-client.c +++ b/src/wayland-client.c @@ -662,6 +662,8 @@ wl_display_roundtrip(struct wl_display *display) done = 0; callback = wl_display_sync(display); + if (callback == NULL) + return -1; wl_callback_add_listener(callback, &sync_listener, &done); while (!done && ret >= 0) ret = wl_display_dispatch(display); commit 8bd93c5c9df2c40d01b7918c666edd68c0be1544 Author: Kristian Høgsberg <k...@bitplanet.net> Date: Sat Jul 13 00:35:21 2013 -0400 scanner: Fail more gracefully on out-of-memory Failing with an error message and error code is little nicer. I doubt we'll hit this case much, but it makes the static analysis happy. diff --git a/src/scanner.c b/src/scanner.c index cc3a745..4aa70d1 100644 --- a/src/scanner.c +++ b/src/scanner.c @@ -127,13 +127,36 @@ struct parse_context { unsigned int character_data_length; }; +static void * +fail_on_null(void *p) +{ + if (p == NULL) { + fprintf(stderr, "wayland-scanner: out of memory\n"); + exit(EXIT_FAILURE); + } + + return p; +} + +static void * +xmalloc(size_t s) +{ + return fail_on_null(malloc(s)); +} + +static char * +xstrdup(const char *s) +{ + return fail_on_null(strdup(s)); +} + static char * uppercase_dup(const char *src) { char *u; int i; - u = strdup(src); + u = xstrdup(src); for (i = 0; u[i]; i++) u[i] = toupper(u[i]); u[i] = '\0'; @@ -292,7 +315,7 @@ start_element(void *data, const char *element_name, const char **atts) if (name == NULL) fail(ctx, "no protocol name given"); - ctx->protocol->name = strdup(name); + ctx->protocol->name = xstrdup(name); ctx->protocol->uppercase_name = uppercase_dup(name); ctx->protocol->description = NULL; } else if (strcmp(element_name, "copyright") == 0) { @@ -304,8 +327,8 @@ start_element(void *data, const char *element_name, const char **atts) if (version == 0) fail(ctx, "no interface version given"); - interface = malloc(sizeof *interface); - interface->name = strdup(name); + interface = xmalloc(sizeof *interface); + interface->name = xstrdup(name); interface->uppercase_name = uppercase_dup(name); interface->version = version; interface->description = NULL; @@ -321,8 +344,8 @@ start_element(void *data, const char *element_name, const char **atts) if (name == NULL) fail(ctx, "no request name given"); - message = malloc(sizeof *message); - message->name = strdup(name); + message = xmalloc(sizeof *message); + message->name = xstrdup(name); message->uppercase_name = uppercase_dup(name); wl_list_init(&message->arg_list); message->arg_count = 0; @@ -359,8 +382,8 @@ start_element(void *data, const char *element_name, const char **atts) if (name == NULL) fail(ctx, "no argument name given"); - arg = malloc(sizeof *arg); - arg->name = strdup(name); + arg = xmalloc(sizeof *arg); + arg->name = xstrdup(name); if (strcmp(type, "int") == 0) arg->type = INT; @@ -386,7 +409,7 @@ start_element(void *data, const char *element_name, const char **atts) case NEW_ID: case OBJECT: if (interface_name) - arg->interface_name = strdup(interface_name); + arg->interface_name = xstrdup(interface_name); else arg->interface_name = NULL; break; @@ -408,7 +431,7 @@ start_element(void *data, const char *element_name, const char **atts) arg->summary = NULL; if (summary) - arg->summary = strdup(summary); + arg->summary = xstrdup(summary); wl_list_insert(ctx->message->arg_list.prev, &arg->link); ctx->message->arg_count++; @@ -416,8 +439,8 @@ start_element(void *data, const char *element_name, const char **atts) if (name == NULL) fail(ctx, "no enum name given"); - enumeration = malloc(sizeof *enumeration); - enumeration->name = strdup(name); + enumeration = xmalloc(sizeof *enumeration); + enumeration->name = xstrdup(name); enumeration->uppercase_name = uppercase_dup(name); enumeration->description = NULL; wl_list_init(&enumeration->entry_list); @@ -430,12 +453,12 @@ start_element(void *data, const char *element_name, const char **atts) if (name == NULL) fail(ctx, "no entry name given"); - entry = malloc(sizeof *entry); - entry->name = strdup(name); + entry = xmalloc(sizeof *entry); + entry->name = xstrdup(name); entry->uppercase_name = uppercase_dup(name); - entry->value = strdup(value); + entry->value = xstrdup(value); if (summary) - entry->summary = strdup(summary); + entry->summary = xstrdup(summary); else entry->summary = NULL; wl_list_insert(ctx->enumeration->entry_list.prev, @@ -444,8 +467,8 @@ start_element(void *data, const char *element_name, const char **atts) if (summary == NULL) fail(ctx, "description without summary"); - description = malloc(sizeof *description); - description->summary = strdup(summary); + description = xmalloc(sizeof *description); + description->summary = xstrdup(summary); if (ctx->message) ctx->message->description = description; commit 43f7268989d8feb4b57c0f17af96f8c4ca2e6dd0 Author: Mariusz Ceier <mceier+wayl...@gmail.com> Date: Wed Jul 10 23:40:56 2013 +0200 connection: Handle empty signature and signature with just a version. Functions like wl_argument_from_va_list expect from get_next_argument, to initialize details->type but when the signature is empty or contains only version (like in desktop-shell-protocol.c in weston) it is left uninitialized. This patch fixes it, by initializing details->type with '\0' value, signaling end of arguments. Signed-off-by: Mariusz Ceier <mceier+wayl...@gmail.com> diff --git a/src/connection.c b/src/connection.c index 2ca9bce..9bb850c 100644 --- a/src/connection.c +++ b/src/connection.c @@ -419,6 +419,7 @@ get_next_argument(const char *signature, struct argument_details *details) details->nullable = 1; } } + details->type = '\0'; return signature; } commit 3f3671e92e5c6e7e6e7a4b22371b1cccb7de8ca2 Author: Kristian Høgsberg <k...@bitplanet.net> Date: Tue Jul 9 19:27:08 2013 -0400 Bump version to 1.1.91 diff --git a/configure.ac b/configure.ac index 72ab1f9..82e55e4 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], [1]) -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 7100a5e0bb07d77f1700abe53968ffc5ba3749ce Author: Kristian Høgsberg <k...@bitplanet.net> Date: Tue Jul 9 19:18:10 2013 -0400 Replace two remaining wl_display_add_gloavl() occurences diff --git a/src/wayland-shm.c b/src/wayland-shm.c index 0d3c95c..1699058 100644 --- a/src/wayland-shm.c +++ b/src/wayland-shm.c @@ -258,7 +258,7 @@ bind_shm(struct wl_client *client, WL_EXPORT int wl_display_init_shm(struct wl_display *display) { - if (!wl_display_add_global(display, &wl_shm_interface, NULL, bind_shm)) + if (!wl_global_create(display, &wl_shm_interface, 1, NULL, bind_shm)) return -1; return 0; diff --git a/tests/queue-test.c b/tests/queue-test.c index 3abb71f..87147c1 100644 --- a/tests/queue-test.c +++ b/tests/queue-test.c @@ -266,8 +266,9 @@ TEST(queue) } for (i = 0; i < ARRAY_LENGTH(dummy_interfaces); i++) - wl_display_add_global(display.display, dummy_interfaces[i], - NULL, dummy_bind); + wl_global_create(display.display, dummy_interfaces[i], + dummy_interfaces[i]->version, + NULL, dummy_bind); ret = wl_display_add_socket(display.display, SOCKET_NAME); assert(ret == 0); commit 93d888aec6331ce30e61188cc00ab3dc9f137efb Author: Kristian Høgsberg <k...@bitplanet.net> Date: Tue Jul 9 18:59:11 2013 -0400 wayland-server: Don't close display fd in fatal error handler We can't do that there, we have to make sure it stays a valid fd until the application calls wl_display_disconnect(). Otherwise the application may end up poll()ing on a stale or wrong fd in case another part of the application (or another thread) triggered a fatal error. diff --git a/src/wayland-client.c b/src/wayland-client.c index 7bd7f0d..34c8196 100644 --- a/src/wayland-client.c +++ b/src/wayland-client.c @@ -107,8 +107,6 @@ display_fatal_error(struct wl_display *display, int error) error = 1; display->last_error = error; - close(display->fd); - display->fd = -1; wl_list_for_each(iter, &display->event_queue_list, link) pthread_cond_broadcast(&iter->cond); @@ -612,8 +610,7 @@ wl_display_disconnect(struct wl_display *display) wl_event_queue_release(&display->queue); pthread_mutex_destroy(&display->mutex); pthread_cond_destroy(&display->reader_cond); - if (display->fd > 0) - close(display->fd); + close(display->fd); free(display); } commit becca5fcf7a69e5e7b2d287a8a24d93d9d29fa5a Author: Kristian Høgsberg <k...@bitplanet.net> Date: Tue Jul 9 17:55:45 2013 -0400 wayland-server: Return 0 from read_events() in case of EAGAIN Getting no data from the socket is not an error condition. This may happen in case of calling prepare_read() and then read_events() with no other pending readers and no data in the socket. In general, read_events() may not queue up events in the given event queue. From a given threads point of view it doesn't matter whether events were read and put in a different event queue or no events were read at all. diff --git a/src/wayland-client.c b/src/wayland-client.c index 45aa372..7bd7f0d 100644 --- a/src/wayland-client.c +++ b/src/wayland-client.c @@ -873,8 +873,10 @@ read_events(struct wl_display *display) if (display->reader_count == 0) { total = wl_connection_read(display->connection); if (total == -1) { - if (errno != EAGAIN) - display_fatal_error(display, errno); + if (errno == EAGAIN) + return 0; + + display_fatal_error(display, errno); return -1; } else if (total == 0) { /* The compositor has closed the socket. This commit 12cea9559313c3503a7a321e684e3ef1ec7a6e49 Author: Neil Roberts <n...@linux.intel.com> Date: Tue Jul 9 14:10:45 2013 +0100 wayland-client: Treat EOF when reading the wayland socket as an error If EOF is encountered while reading from the Wayland socket, make wl_display_read_events() return -1 so that it will be treated as an error. The documentation for this function states that it will set errno when there is an error so it additionally makes up an errno of EPIPE. If we don't do this then when the compositor quits the Wayland socket will be become ready for reading but wl_display_dispatch will do nothing which typically makes the application take up 100% CPU. In particular eglSwapBuffers will likely get stuck in an infinite busy loop because it repeatedly calls wl_display_dispatch_queue while it waits for the frame callback. https://bugzilla.gnome.org/show_bug.cgi?id=703892 diff --git a/src/wayland-client.c b/src/wayland-client.c index cb091ab..45aa372 100644 --- a/src/wayland-client.c +++ b/src/wayland-client.c @@ -876,7 +876,15 @@ read_events(struct wl_display *display) if (errno != EAGAIN) display_fatal_error(display, errno); return -1; + } else if (total == 0) { + /* The compositor has closed the socket. This + * should be considered an error so we'll fake + * an errno */ + errno = EPIPE; + display_fatal_error(display, errno); + return -1; } + for (rem = total; rem >= 8; rem -= size) { size = queue_event(display, rem); if (size == -1) { commit 4cffa0fd61fde7760f2506b154b2af7d24b8c25f Author: Kristian Høgsberg <k...@bitplanet.net> Date: Mon Jul 8 18:45:41 2013 -0400 wayland-server: Add wl_global_create/destroy() This patch introduces wl_global_create() and wl_global_destroy() as replacements for wl_display_add_global() and wl_display_remove_global(). The add/remove_global API did not allow a compositor to indicate the implemented version of a global, it just took the version from the interface meta data. The problem is that the meta data (which lives in libwayland-server.so) can get out of sync with a compositor implementation. The compositor will then advertise a higher version of a global than what it actually implements. The new API lets a compositor pass in a version when it registers a global, which solves the problem. The add/remove API is deprecated with this patch and will be removed. diff --git a/src/wayland-server.c b/src/wayland-server.c index 32310b1..0a6e112 100644 --- a/src/wayland-server.c +++ b/src/wayland-server.c @@ -95,8 +95,10 @@ struct wl_display { }; struct wl_global { + struct wl_display *display; const struct wl_interface *interface; uint32_t name; + uint32_t version; void *data; wl_global_bind_func_t bind; struct wl_list link; @@ -589,7 +591,8 @@ registry_bind(struct wl_client *client, if (global->name == name) break; - if (&global->link == &display->global_list) + if (&global->link == &display->global_list || + global->version < version) wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT, "invalid global %d", name); @@ -652,7 +655,7 @@ display_get_registry(struct wl_client *client, WL_REGISTRY_GLOBAL, global->name, global->interface->name, - global->interface->version); + global->version); } static const struct wl_display_interface display_interface = { @@ -714,8 +717,8 @@ wl_display_create(void) display->id = 1; display->serial = 0; - if (!wl_display_add_global(display, &wl_display_interface, - display, bind_display)) { + if (!wl_global_create(display, &wl_display_interface, 1, + display, bind_display)) { wl_event_loop_destroy(display->loop); free(display); return NULL; @@ -749,19 +752,27 @@ wl_display_destroy(struct wl_display *display) } WL_EXPORT struct wl_global * -wl_display_add_global(struct wl_display *display, - const struct wl_interface *interface, - void *data, wl_global_bind_func_t bind) +wl_global_create(struct wl_display *display, + const struct wl_interface *interface, int version, + void *data, wl_global_bind_func_t bind) { struct wl_global *global; struct wl_resource *resource; + if (interface->version < version) { + wl_log("wl_global_create: implemented version higher " + "than interface version%m\n"); + return NULL; + } + global = malloc(sizeof *global); if (global == NULL) return NULL; + global->display = display; global->name = display->id++; global->interface = interface; + global->version = version; global->data = data; global->bind = bind; wl_list_insert(display->global_list.prev, &global->link); @@ -771,14 +782,15 @@ wl_display_add_global(struct wl_display *display, WL_REGISTRY_GLOBAL, global->name, global->interface->name, - global->interface->version); + global->version); return global; } WL_EXPORT void -wl_display_remove_global(struct wl_display *display, struct wl_global *global) +wl_global_destroy(struct wl_global *global) { + struct wl_display *display = global->display; struct wl_resource *resource; wl_list_for_each(resource, &display->registry_resource_list, link) @@ -1139,3 +1151,26 @@ wl_client_new_object(struct wl_client *client, return resource; } + +struct wl_global * +wl_display_add_global(struct wl_display *display, + const struct wl_interface *interface, + void *data, wl_global_bind_func_t bind) WL_DEPRECATED; + +WL_EXPORT struct wl_global * +wl_display_add_global(struct wl_display *display, + const struct wl_interface *interface, + void *data, wl_global_bind_func_t bind) +{ + return wl_global_create(display, interface, interface->version, data, bind); +} + +void +wl_display_remove_global(struct wl_display *display, + struct wl_global *global) WL_DEPRECATED; + +WL_EXPORT void +wl_display_remove_global(struct wl_display *display, struct wl_global *global) +{ + wl_global_destroy(global); +} diff --git a/src/wayland-server.h b/src/wayland-server.h index 0a798f4..9e16d0e 100644 --- a/src/wayland-server.h +++ b/src/wayland-server.h @@ -99,14 +99,6 @@ void wl_display_flush_clients(struct wl_display *display); typedef void (*wl_global_bind_func_t)(struct wl_client *client, void *data, uint32_t version, uint32_t id); -struct wl_global *wl_display_add_global(struct wl_display *display, - const struct wl_interface *interface, - void *data, - wl_global_bind_func_t bind); - -void wl_display_remove_global(struct wl_display *display, - struct wl_global *global); - uint32_t wl_display_get_serial(struct wl_display *display); uint32_t wl_display_next_serial(struct wl_display *display); @@ -115,6 +107,12 @@ void wl_display_add_destroy_listener(struct wl_display *display, struct wl_listener *wl_display_get_destroy_listener(struct wl_display *display, wl_notify_func_t notify); +struct wl_global *wl_global_create(struct wl_display *display, + const struct wl_interface *interface, + int version, + void *data, wl_global_bind_func_t bind); +void wl_global_destroy(struct wl_global *global); + struct wl_client *wl_client_create(struct wl_display *display, int fd); void wl_client_destroy(struct wl_client *client); void wl_client_flush(struct wl_client *client); @@ -213,6 +211,16 @@ wl_client_new_object(struct wl_client *client, const struct wl_interface *interface, const void *implementation, void *data) WL_DEPRECATED; +struct wl_global * +wl_display_add_global(struct wl_display *display, + const struct wl_interface *interface, + void *data, + wl_global_bind_func_t bind) WL_DEPRECATED; + +void +wl_display_remove_global(struct wl_display *display, + struct wl_global *global) WL_DEPRECATED; + #endif /* commit 40fc79d5b095e330ab6f851e35ba54a65781679f Author: Daiki Ueno <u...@gnu.org> Date: Tue Jul 2 18:38:15 2013 +0900 build: Add wayland-scanner.pc. To allow user program to include wayland-scanner.m4 in tarball, move the path variables from it into wayland-scanner.pc. diff --git a/Makefile.am b/Makefile.am index df6d4b3..ddf39d1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -7,6 +7,6 @@ SUBDIRS = src protocol $(doc_subdir) tests cursor ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} aclocaldir = $(datadir)/aclocal -aclocal_DATA = wayland-scanner.m4 +dist_aclocal_DATA = wayland-scanner.m4 dist_pkgdata_DATA = wayland-scanner.mk diff --git a/configure.ac b/configure.ac index 7ca70da..72ab1f9 100644 --- a/configure.ac +++ b/configure.ac @@ -127,7 +127,6 @@ fi AM_CONDITIONAL([HAVE_PUBLICAN], [test "x$PUBLICAN" != "x"]) AC_CONFIG_FILES([Makefile - wayland-scanner.m4 cursor/Makefile cursor/wayland-cursor.pc cursor/wayland-cursor-uninstalled.pc @@ -138,8 +137,10 @@ AC_CONFIG_FILES([Makefile src/Makefile src/wayland-server-uninstalled.pc src/wayland-client-uninstalled.pc + src/wayland-scanner-uninstalled.pc src/wayland-server.pc src/wayland-client.pc + src/wayland-scanner.pc src/wayland-version.h protocol/Makefile tests/Makefile]) diff --git a/src/Makefile.am b/src/Makefile.am index 4fa7425..4226f63 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -57,6 +57,9 @@ wayland_scanner_SOURCES = \ wayland_scanner_LDADD = $(EXPAT_LIBS) libwayland-util.la $(BUILT_SOURCES) : wayland-scanner + +scannerpkgconfigdir = $(datadir)/pkgconfig +scannerpkgconfig_DATA = wayland-scanner.pc endif BUILT_SOURCES = \ diff --git a/src/wayland-scanner-uninstalled.pc.in b/src/wayland-scanner-uninstalled.pc.in new file mode 100644 index 0000000..8dcfef3 --- /dev/null +++ b/src/wayland-scanner-uninstalled.pc.in @@ -0,0 +1,6 @@ +pkgdatadir=@abs_top_srcdir@ +wayland_scanner=@abs_builddir@/wayland-scanner + +Name: Wayland Scanner +Description: Wayland scanner (not installed) +Version: @PACKAGE_VERSION@ diff --git a/src/wayland-scanner.pc.in b/src/wayland-scanner.pc.in new file mode 100644 index 0000000..7b2a4c9 --- /dev/null +++ b/src/wayland-scanner.pc.in @@ -0,0 +1,9 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +datarootdir=@datarootdir@ +pkgdatadir=@datadir@/@PACKAGE@ +wayland_scanner=@bindir@/wayland-scanner + +Name: Wayland Scanner +Description: Wayland scanner +Version: @WAYLAND_VERSION@ diff --git a/wayland-scanner.m4 b/wayland-scanner.m4 new file mode 100644 index 0000000..2b87c5f --- /dev/null +++ b/wayland-scanner.m4 @@ -0,0 +1,11 @@ +AC_DEFUN([WAYLAND_SCANNER_RULES], [ + PKG_PROG_PKG_CONFIG + + wayland_scanner=`$PKG_CONFIG --variable=wayland_scanner wayland-scanner` + AC_SUBST([wayland_scanner]) + + wayland_scanner_rules=`$PKG_CONFIG --variable=pkgdatadir wayland-scanner`/wayland-scanner.mk + AC_SUBST_FILE([wayland_scanner_rules]) + + AC_SUBST([wayland_protocoldir], [$1]) +]) diff --git a/wayland-scanner.m4.in b/wayland-scanner.m4.in deleted file mode 100644 index 29bc788..0000000 --- a/wayland-scanner.m4.in +++ /dev/null @@ -1,16 +0,0 @@ -AC_DEFUN([WAYLAND_SCANNER_RULES], [ - wayland__prefix=${prefix} - wayland__exec_prefix=${exec_prefix} - - prefix=@prefix@ - exec_prefix=@exec_prefix@ - - AC_PATH_PROG([wayland_scanner], [wayland-scanner], [/bin/false], - [@bindir@$PATH_SEPARATOR$PATH]) - AC_SUBST_FILE([wayland_scanner_rules]) - AC_SUBST([wayland_protocoldir], [$1]) - wayland_scanner_rules=@datarootdir@/aclocal/wayland-scanner.mk - - prefix=${wayland__prefix} - exec_prefix=${wayland__exec_prefix} -]) commit 60fc83af6ea47bd6cca248a04aff5fb60115977a Author: Daiki Ueno <u...@gnu.org> Date: Tue Jul 2 18:38:14 2013 +0900 build: Install wayland-scanner.mk under $(pkgdatadir). diff --git a/Makefile.am b/Makefile.am index 306d7b3..df6d4b3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -7,6 +7,6 @@ SUBDIRS = src protocol $(doc_subdir) tests cursor ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} aclocaldir = $(datadir)/aclocal -aclocal_DATA = wayland-scanner.m4 wayland-scanner.mk +aclocal_DATA = wayland-scanner.m4 -EXTRA_DIST = wayland-scanner.mk +dist_pkgdata_DATA = wayland-scanner.mk commit 3cff4693ea2d547191a2d4270d9444da7df7d462 Author: Kristian Høgsberg <k...@bitplanet.net> Date: Tue Jul 2 16:59:44 2013 -0400 wayland-server: Free non-legacy wl_resource structs during wl_client_destroy We need to free the non-legacy resources during client shutdown as well. diff --git a/src/wayland-server.c b/src/wayland-server.c index 5410553..32310b1 100644 --- a/src/wayland-server.c +++ b/src/wayland-server.c @@ -422,11 +422,17 @@ static void destroy_resource(void *element, void *data) { struct wl_resource *resource = element; + struct wl_client *client = resource->client; + uint32_t flags; wl_signal_emit(&resource->destroy_signal, resource); + flags = wl_map_lookup_flags(&client->objects, resource->object.id); if (resource->destroy) resource->destroy(resource); + + if (!(flags & WL_MAP_ENTRY_LEGACY)) + free(resource); } -- To UNSUBSCRIBE, email to debian-x-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/e1uyq5h-00066v...@vasks.debian.org