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

wayland: Changes to 'upstream-experimental'



Rebased ref, commits from common ancestor:
commit f5ccd7a9e670e097ff9b5faae8a26b3af4bb7b60
Author: Kristian Høgsberg <krh@bitplanet.net>
Date:   Tue Jul 24 15:45:00 2012 -0400

    Bump version to 0.95.0

diff --git a/configure.ac b/configure.ac
index ae32c19..46b3cdf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,8 +1,8 @@
 AC_PREREQ([2.64])
 
 m4_define([wayland_major_version], [0])
-m4_define([wayland_minor_version], [94])
-m4_define([wayland_micro_version], [90])
+m4_define([wayland_minor_version], [95])
+m4_define([wayland_micro_version], [0])
 m4_define([wayland_version],
           [wayland_major_version.wayland_minor_version.wayland_micro_version])
 

commit 6ebde80f0f5c614a3ef95003b788ee6a7694413f
Author: Kristian Høgsberg <krh@bitplanet.net>
Date:   Tue Jul 24 15:10:12 2012 -0400

    Make distcheck work from builddir configured  with --disable-documentation

diff --git a/doc/Wayland/Makefile.am b/doc/Wayland/Makefile.am
index c14082c..6d73de8 100644
--- a/doc/Wayland/Makefile.am
+++ b/doc/Wayland/Makefile.am
@@ -1,7 +1,3 @@
-if HAVE_PUBLICAN
-noinst_DATA = Wayland $(publican_targets)
-pubdir = $(docdir)/Wayland/en-US
-
 publican_sources = \
 	$(srcdir)/en_US/Wayland.ent \
 	$(srcdir)/en_US/Architecture.xml \
@@ -16,6 +12,10 @@ publican_sources = \
 	$(srcdir)/en_US/images/wayland.png  \
 	$(srcdir)/en_US/images/x-architecture.png
 
+if HAVE_PUBLICAN
+noinst_DATA = Wayland $(publican_targets)
+pubdir = $(docdir)/Wayland/en-US
+
 publican_targets = $(publican_sources:$(srcdir)/en_US%=$(builddir)/en-US%) \
 	en-US/ProtocolSpec.xml
 
@@ -66,6 +66,6 @@ uninstall-local:
 	  fi; \
 	fi;
 
-EXTRA_DIST = $(publican_sources) publican.cfg protocol-to-docbook.xsl
-
 endif
+
+EXTRA_DIST = $(publican_sources) publican.cfg protocol-to-docbook.xsl

commit 3ec40512c7e43c5e5a223a9d33e4737a0782916a
Author: Daniel Stone <daniel@fooishbar.org>
Date:   Mon Jul 23 19:54:42 2012 +0100

    More consistent ID printing
    
    Use unsigned rather than signed for IDs, so they match up with what we
    see in other prints.
    
    Signed-off-by: Daniel Stone <daniel@fooishbar.org>

diff --git a/src/connection.c b/src/connection.c
index 4ba7f63..2733ac9 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -738,7 +738,7 @@ wl_connection_demarshal(struct wl_connection *connection,
 				 * destroyed client side */
 				*object = NULL;
 			} else if (*object == NULL && *p != 0) {
-				printf("unknown object (%d), message %s(%s)\n",
+				printf("unknown object (%u), message %s(%s)\n",
 				       *p, message->name, message->signature);
 				*object = NULL;
 				errno = EINVAL;
@@ -747,7 +747,7 @@ wl_connection_demarshal(struct wl_connection *connection,
 
 			if (*object != NULL && message->types[i-2] != NULL &&
 			    (*object)->interface != message->types[i-2]) {
-				printf("invalid object (%d), type (%s), "
+				printf("invalid object (%u), type (%s), "
 					"message %s(%s)\n",
 				       *p, (*object)->interface->name,
 				       message->name, message->signature);
diff --git a/src/wayland-client.c b/src/wayland-client.c
index 7130cb7..631ec5a 100644
--- a/src/wayland-client.c
+++ b/src/wayland-client.c
@@ -203,14 +203,14 @@ wl_proxy_marshal(struct wl_proxy *proxy, uint32_t opcode, ...)
 		abort();
 	}
 
+	if (wl_debug)
+		wl_closure_print(closure, &proxy->object, true);
+
 	if (wl_closure_send(closure, proxy->display->connection)) {
 		fprintf(stderr, "Error sending request: %m\n");
 		abort();
 	}
 
-	if (wl_debug)
-		wl_closure_print(closure, &proxy->object, true);
-
 	wl_closure_destroy(closure);
 }
 
@@ -235,7 +235,7 @@ display_handle_error(void *data,
 		     struct wl_display *display, struct wl_object *object,
 		     uint32_t code, const char *message)
 {
-	fprintf(stderr, "%s@%d: error %d: %s\n",
+	fprintf(stderr, "%s@%u: error %d: %s\n",
 		object->interface->name, object->id, code, message);
 	abort();
 }
@@ -531,14 +531,14 @@ handle_event(struct wl_display *display,
 	closure = wl_connection_demarshal(display->connection, size,
 					  &display->objects, message);
 
+	if (wl_debug)
+		wl_closure_print(closure, &proxy->object, false);
+
 	if (closure == NULL || create_proxies(display, closure) < 0) {
 		fprintf(stderr, "Error demarshalling event\n");
 		abort();
 	}
 
-	if (wl_debug)
-		wl_closure_print(closure, &proxy->object, false);
-
 	wl_closure_invoke(closure, &proxy->object,
 			  proxy->object.implementation[opcode],
 			  proxy->user_data);
diff --git a/src/wayland-server.c b/src/wayland-server.c
index 3dc8416..88e8433 100644
--- a/src/wayland-server.c
+++ b/src/wayland-server.c
@@ -243,7 +243,7 @@ wl_client_connection_data(int fd, uint32_t mask, void *data)
 		if (resource == NULL) {
 			wl_resource_post_error(client->display_resource,
 					       WL_DISPLAY_ERROR_INVALID_OBJECT,
-					       "invalid object %d", p[0]);
+					       "invalid object %u", p[0]);
 			break;
 		}
 
@@ -251,7 +251,7 @@ wl_client_connection_data(int fd, uint32_t mask, void *data)
 		if (opcode >= object->interface->method_count) {
 			wl_resource_post_error(client->display_resource,
 					       WL_DISPLAY_ERROR_INVALID_METHOD,
-					       "invalid method %d, object %s@%d",
+					       "invalid method %d, object %s@%u",
 					       opcode,
 					       object->interface->name,
 					       object->id);
@@ -263,10 +263,13 @@ wl_client_connection_data(int fd, uint32_t mask, void *data)
 						  &client->objects, message);
 		len -= size;
 
+		if (wl_debug)
+			wl_closure_print(closure, object, false);
+
 		if (closure == NULL && errno == EINVAL) {
 			wl_resource_post_error(client->display_resource,
 					       WL_DISPLAY_ERROR_INVALID_METHOD,
-					       "invalid arguments for %s@%d.%s",
+					       "invalid arguments for %s@%u.%s",
 					       object->interface->name,
 					       object->id,
 					       message->name);
@@ -278,9 +281,6 @@ wl_client_connection_data(int fd, uint32_t mask, void *data)
 
 		deref_new_objects(closure);
 
-		if (wl_debug)
-			wl_closure_print(closure, object, false);
-
 		wl_closure_invoke(closure, object,
 				  object->implementation[opcode], client);
 
diff --git a/tests/connection-test.c b/tests/connection-test.c
index a852c17..b6bcde1 100644
--- a/tests/connection-test.c
+++ b/tests/connection-test.c
@@ -236,7 +236,7 @@ TEST(connection_marshal)
 	marshal(&data, "n", 12, &object);
 	assert(data.buffer[2] == object.id);
 
-	marshal(&data, "n", 12, NULL);
+	marshal(&data, "?n", 12, NULL);
 	assert(data.buffer[2] == 0);
 
 	array.data = (void *) text;

commit db0add6d5e23deac53c834f73d5e56180600cead
Author: Daniel Stone <daniel@fooishbar.org>
Date:   Mon Jul 23 19:54:41 2012 +0100

    Make NEW_IDs nullable
    
    The connection-handling code already allows this, so make it legal in
    the protocol definition too.
    
    Signed-off-by: Daniel Stone <daniel@fooishbar.org>

diff --git a/src/connection.c b/src/connection.c
index b228c92..4ba7f63 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -532,6 +532,10 @@ wl_closure_vmarshal(struct wl_object *sender,
 			object = va_arg(ap, struct wl_object *);
 			if (end - p < 1)
 				goto err;
+
+			if (!arg.nullable && object == NULL)
+				goto err_null;
+
 			*p++ = object ? object->id : 0;
 			break;
 
@@ -719,6 +723,15 @@ wl_connection_demarshal(struct wl_connection *connection,
 			extra += sizeof *object;
 			closure->args[i] = object;
 
+			if (*p == 0 && !arg.nullable) {
+				printf("NULL new ID received on non-nullable "
+				       "type, message %s(%s)\n", message->name,
+				       message->signature);
+				*object = NULL;
+				errno = EINVAL;
+				goto err;
+			}
+
 			*object = wl_map_lookup(objects, *p);
 			if (*object == WL_ZOMBIE_OBJECT) {
 				/* references object we've already
@@ -751,6 +764,14 @@ wl_connection_demarshal(struct wl_connection *connection,
 			closure->args[i] = id;
 			*id = p;
 
+			if (*id == 0 && !arg.nullable) {
+				printf("NULL new ID received on non-nullable "
+				       "type, message %s(%s)\n", message->name,
+				       message->signature);
+				errno = EINVAL;
+				goto err;
+			}
+
 			if (wl_map_reserve_new(objects, *p) < 0) {
 				printf("not a valid new object id (%d), "
 				       "message %s(%s)\n",
@@ -935,7 +956,17 @@ wl_closure_print(struct wl_closure *closure, struct wl_object *target, int send)
 				fprintf(stderr, "nil");
 			break;
 		case 'n':
-			fprintf(stderr, "new id %u", value->uint32);
+			fprintf(stderr, "new id %s@",
+				(closure->message->types[i - 2]) ?
+				 closure->message->types[i - 2]->name :
+				  "[unknown]");
+			if (send && value->new_id != 0)
+				fprintf(stderr, "%u", value->new_id);
+			else if (!send && value->object != NULL)
+				fprintf(stderr, "%u",
+					*((uint32_t *)value->object));
+			else
+				fprintf(stderr, "nil");
 			break;
 		case 'a':
 			fprintf(stderr, "array");
diff --git a/src/scanner.c b/src/scanner.c
index 50e26c1..0fc26e7 100644
--- a/src/scanner.c
+++ b/src/scanner.c
@@ -228,6 +228,7 @@ is_nullable_type(struct arg *arg)
 	/* Strings, objects, and arrays are possibly nullable */
 	case STRING:
 	case OBJECT:
+	case NEW_ID:
 	case ARRAY:
 		return 1;
 	default:
diff --git a/src/wayland-client.c b/src/wayland-client.c
index b41fb9b..7130cb7 100644
--- a/src/wayland-client.c
+++ b/src/wayland-client.c
@@ -479,19 +479,29 @@ create_proxies(struct wl_display *display, struct wl_closure *closure)
 {
 	struct wl_proxy *proxy;
 	const char *signature;
+	struct argument_details arg;
 	uint32_t id;
 	int i;
+	int count;
 
 	signature = closure->message->signature;
-	for (i = 0; signature[i]; i++) {
-		switch (signature[i]) {
+	count = arg_count_for_signature(signature) + 2;
+	for (i = 2; i < count; i++) {
+		signature = get_next_argument(signature, &arg);
+		switch (arg.type) {
 		case 'n':
-			id = **(uint32_t **) closure->args[i + 2];
+			id = **(uint32_t **) closure->args[i];
+			if (id == 0) {
+				*(void **) closure->args[i] = NULL;
+				break;
+			}
 			proxy = wl_proxy_create_for_id(&display->proxy, id,
-						       closure->message->types[i]);		       
+						       closure->message->types[i - 2]);
 			if (proxy == NULL)
 				return -1;
-			*(void **) closure->args[i + 2] = proxy;
+			*(void **) closure->args[i] = proxy;
+			break;
+		default:
 			break;
 		}
 	}

commit efe23443d8bcdad0513d5dd9d027233b3d7dc968
Author: Daniel Stone <daniel@fooishbar.org>
Date:   Mon Jul 23 19:54:40 2012 +0100

    Unstatic arg_count_for_signature and get_next_argument
    
    Expose these to other files using wayland-private.h, so wayland-client.c
    can walk NULLables properly.
    
    Signed-off-by: Daniel Stone <daniel@fooishbar.org>

diff --git a/src/connection.c b/src/connection.c
index f4f881e..b228c92 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -404,12 +404,7 @@ wl_connection_put_fd(struct wl_connection *connection, int32_t fd)
 	return 0;
 }
 
-struct argument_details {
-	char type;
-	int nullable;
-};
-
-static const char *
+const char *
 get_next_argument(const char *signature, struct argument_details *details)
 {
 	if (*signature == '?') {
@@ -422,7 +417,7 @@ get_next_argument(const char *signature, struct argument_details *details)
 	return signature + 1;
 }
 
-static int
+int
 arg_count_for_signature(const char *signature)
 {
 	int count = 0;
diff --git a/src/wayland-private.h b/src/wayland-private.h
index 2113d83..f9fcc96 100644
--- a/src/wayland-private.h
+++ b/src/wayland-private.h
@@ -81,6 +81,17 @@ struct wl_closure {
 	uint32_t buffer[0];
 };
 
+struct argument_details {
+	char type;
+	int nullable;
+};
+
+const char *
+get_next_argument(const char *signature, struct argument_details *details);
+
+int
+arg_count_for_signature(const char *signature);
+
 struct wl_closure *
 wl_closure_vmarshal(struct wl_object *sender,
 		    uint32_t opcode, va_list ap,

commit a2c79b14a1aa58424eae77db39ded4d745acce1d
Author: Kristian Høgsberg <krh@bitplanet.net>
Date:   Mon Jul 23 20:14:33 2012 -0400

    tests: Wrap calloc by just returning NULL if we're called too early
    
    Since glibc dlsym() calls calloc, we get a call to our calloc wrapper as
    we try to look up the real calloc implementation.  dlsym() will fall back
    to a static buffer in case calloc returns NULL, so that's what we'll do.
    
    This is all highly glibc dependent, of course, but the entire malloc
    weak symbol wrapper mechanism is, so there's no loss of generality here.

diff --git a/tests/test-runner.c b/tests/test-runner.c
index 5e8ec95..63ce384 100644
--- a/tests/test-runner.c
+++ b/tests/test-runner.c
@@ -37,6 +37,7 @@ static int num_alloc;
 static void* (*sys_malloc)(size_t);
 static void (*sys_free)(void*);
 static void* (*sys_realloc)(void*, size_t);
+static void* (*sys_calloc)(size_t, size_t);
 
 extern const struct test __start_test_section, __stop_test_section;
 
@@ -63,6 +64,17 @@ realloc(void* mem, size_t size)
 	return sys_realloc(mem, size);
 }
 
+__attribute__ ((visibility("default"))) void *
+calloc(size_t nmemb, size_t size)
+{
+	if (sys_calloc == NULL)
+		return NULL;
+
+	num_alloc++;
+
+	return sys_calloc(nmemb, size);
+}
+
 static const struct test *
 find_test(const char *name)
 {
@@ -96,6 +108,7 @@ int main(int argc, char *argv[])
 	siginfo_t info;
 
 	/* Load system malloc, free, and realloc */
+	sys_calloc = dlsym(RTLD_NEXT, "calloc");
 	sys_realloc = dlsym(RTLD_NEXT, "realloc");
 	sys_malloc = dlsym(RTLD_NEXT, "malloc");
 	sys_free = dlsym(RTLD_NEXT, "free");

commit 61e9196f565e02b1774699e865a81a4efd3904bb
Author: Daniel Stone <daniel@fooishbar.org>
Date:   Mon Jul 23 19:54:39 2012 +0100

    test-runner: Wrap realloc() too
    
    So all our tests don't start failing just because we had the temerity to
    use realloc() rather than malloc().
    
    Signed-off-by: Daniel Stone <daniel@fooishbar.org>

diff --git a/tests/test-runner.c b/tests/test-runner.c
index c4a57a3..5e8ec95 100644
--- a/tests/test-runner.c
+++ b/tests/test-runner.c
@@ -36,6 +36,7 @@
 static int num_alloc;
 static void* (*sys_malloc)(size_t);
 static void (*sys_free)(void*);
+static void* (*sys_realloc)(void*, size_t);
 
 extern const struct test __start_test_section, __stop_test_section;
 
@@ -54,6 +55,14 @@ free(void* mem)
 	sys_free(mem);
 }
 
+__attribute__ ((visibility("default"))) void *
+realloc(void* mem, size_t size)
+{
+	if (mem == NULL)
+		num_alloc++;
+	return sys_realloc(mem, size);
+}
+
 static const struct test *
 find_test(const char *name)
 {
@@ -86,7 +95,8 @@ int main(int argc, char *argv[])
 	int total, pass;
 	siginfo_t info;
 
-	/* Load system malloc and free */
+	/* Load system malloc, free, and realloc */
+	sys_realloc = dlsym(RTLD_NEXT, "realloc");
 	sys_malloc = dlsym(RTLD_NEXT, "malloc");
 	sys_free = dlsym(RTLD_NEXT, "free");
 

commit 16b4c8747053e73bb963ea2bdf566cc54b9aeb90
Author: Daniel Stone <daniel@fooishbar.org>
Date:   Mon Jul 23 19:54:38 2012 +0100

    .gitignore: Add ctags and cscope files
    
    Signed-off-by: Daniel Stone <daniel@fooishbar.org>

diff --git a/.gitignore b/.gitignore
index 904eb50..0f449f5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,6 +8,8 @@
 *.swp
 *~
 .libs
+cscope.out
+ctags
 /aclocal.m4
 /wayland-scanner.m4
 /autom4te.cache

commit eadb68ec32df8ee54ccba175d19adcdedfaa5015
Author: Kristian Høgsberg <krh@bitplanet.net>
Date:   Sun Jul 22 15:46:16 2012 -0400

    protocol: Add transform argument to wl_output.geometry event

diff --git a/TODO b/TODO
index 677782d..00a32ca 100644
--- a/TODO
+++ b/TODO
@@ -1,12 +1,5 @@
 Core wayland protocol
 
- - We need rotation information in the output (multiples of 90
-   degrees) and we'll need a way for a client to communicate that it
-   has rendered its buffer according to the output rotation.  The
-   goal is to be able to pageflip directly to the client buffer, and
-   for that we need the client to render accordingly and the
-   compositor needs to know that it did.
-
  - Atomicity.  Currently a lot of the atomicity in Wayland relies on
    how we batch up all requests in a protocol buffer and only flushes
    in the "blockhandler" in the client.  Consensus was that we need
diff --git a/protocol/wayland.xml b/protocol/wayland.xml
index 96ef248..4b500e6 100644
--- a/protocol/wayland.xml
+++ b/protocol/wayland.xml
@@ -1001,6 +1001,31 @@
       <entry name="vertical_bgr" value="5"/>
     </enum>
 
+    <enum name="transform">
+      <description summary="transform from framebuffer to output">
+	This describes the transform that a compositor will apply to a
+	surface to compensate for the rotation or mirroring of an
+	output device.
+
+	The flipped values correspond to an initial flip around a
+	vertical axis followed by rotaion.
+
+	The purpose is mainly to allow clients render accordingly and
+	tell the compositor, so that for fullscreen surfaces, the
+	compositor will still be able to scan out directly from client
+	surfaces.
+      </description>
+
+      <entry name="normal" value="0"/>
+      <entry name="90" value="1"/>
+      <entry name="180" value="2"/>
+      <entry name="270" value="3"/>
+      <entry name="flipped" value="4"/>
+      <entry name="flipped_90" value="5"/>
+      <entry name="flipped_180" value="6"/>
+      <entry name="flipped_270" value="7"/>
+    </enum>
+
     <event name="geometry">
       <description summary="properties of the output"/>
       <arg name="x" type="int"
@@ -1017,6 +1042,8 @@
 	   summary="textual description of the manufacturer"/>
       <arg name="model" type="string"
 	   summary="textual description of the model"/>
+      <arg name="transform" type="int"
+	   summary="transform that maps framebuffer to output"/>
     </event>
 
     <enum name="mode">

commit 0b8b397e3438f0acad78ce2646bacc4905c97f01
Author: Mathias Fiedler <mathias.fiedler@xse.de>
Date:   Wed Jul 18 15:53:23 2012 +0200

    connection: reserve id on incoming new object
    
    If a new object id arrives ensure that there is an empty array entry
    created, otherwise we might get out of sync for new ids if object isn't
    created by interface implementation.

diff --git a/src/connection.c b/src/connection.c
index 5946556..f4f881e 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -756,14 +756,14 @@ wl_connection_demarshal(struct wl_connection *connection,
 			closure->args[i] = id;
 			*id = p;
 
-			object = wl_map_lookup(objects, *p);
-			if (object != NULL) {
-				printf("not a new object (%d), "
+			if (wl_map_reserve_new(objects, *p) < 0) {
+				printf("not a valid new object id (%d), "
 				       "message %s(%s)\n",
 				       *p, message->name, message->signature);
 				errno = EINVAL;
 				goto err;
 			}
+
 			p++;
 			break;
 		case 'a':

commit bfcd6819303b0304ba38d57af4856eb6db286907
Author: Mathias Fiedler <mathias.fiedler@xse.de>
Date:   Wed Jul 18 15:52:51 2012 +0200

    wayland-util: add method for reserving new object id
    
    wl_map_reserve_new() ensures that new id is valid and will point to an
    empty array entry.

diff --git a/src/wayland-private.h b/src/wayland-private.h
index ea70258..2113d83 100644
--- a/src/wayland-private.h
+++ b/src/wayland-private.h
@@ -46,6 +46,7 @@ void wl_map_init(struct wl_map *map);
 void wl_map_release(struct wl_map *map);
 uint32_t wl_map_insert_new(struct wl_map *map, uint32_t side, void *data);
 int wl_map_insert_at(struct wl_map *map, uint32_t i, void *data);
+int wl_map_reserve_new(struct wl_map *map, uint32_t i);
 void wl_map_remove(struct wl_map *map, uint32_t i);
 void *wl_map_lookup(struct wl_map *map, uint32_t i);
 void wl_map_for_each(struct wl_map *map, wl_iterator_func_t func, void *data);
diff --git a/src/wayland-util.c b/src/wayland-util.c
index 107b6db..eacf902 100644
--- a/src/wayland-util.c
+++ b/src/wayland-util.c
@@ -214,6 +214,39 @@ wl_map_insert_at(struct wl_map *map, uint32_t i, void *data)
 	return 0;
 }
 
+WL_EXPORT int
+wl_map_reserve_new(struct wl_map *map, uint32_t i)
+{
+	union map_entry *start;
+	uint32_t count;
+	struct wl_array *entries;
+
+	if (i < WL_SERVER_ID_START) {
+		entries = &map->client_entries;
+	} else {
+		entries = &map->server_entries;
+		i -= WL_SERVER_ID_START;
+	}
+
+	count = entries->size / sizeof *start;
+
+	if (count < i)
+		return -1;
+
+	if (count == i) {
+		wl_array_add(entries, sizeof *start);
+		start = entries->data;
+		start[i].data = NULL;
+	} else {
+		start = entries->data;
+		if (start[i].data != NULL) {
+			return -1;
+		}
+	}
+
+	return 0;
+}
+
 WL_EXPORT void
 wl_map_remove(struct wl_map *map, uint32_t i)
 {

commit 900e4b63ef185767a4f1f1eea0ea1fb9899b4da5
Author: Mathias Fiedler <mathias.fiedler@xse.de>
Date:   Wed Jul 18 15:51:45 2012 +0200

    wayland-server: send error on invalid new object id
    
    Creation of new client resources was silently ignored when
    wl_client_add_resource() was used on server side and new object id was out
    of range.
    
    An error is now send out to the client in such case.
    
    Also changed error message in wl_client_add_object, since
    wl_map_insert_at() returns -1 only at invalid new id.

diff --git a/src/wayland-server.c b/src/wayland-server.c
index df9bd07..3dc8416 100644
--- a/src/wayland-server.c
+++ b/src/wayland-server.c
@@ -395,9 +395,12 @@ wl_client_add_resource(struct wl_client *client,
 		resource->object.id =
 			wl_map_insert_new(&client->objects,
 					  WL_MAP_SERVER_SIDE, resource);
-	else
-		wl_map_insert_at(&client->objects,
-				 resource->object.id, resource);
+	else if (wl_map_insert_at(&client->objects,
+				  resource->object.id, resource) < 0)
+		wl_resource_post_error(client->display_resource,
+				       WL_DISPLAY_ERROR_INVALID_OBJECT,
+				       "invalid new id %d",
+				       resource->object.id);
 
 	resource->client = client;
 	wl_signal_init(&resource->destroy_signal);
@@ -1277,7 +1280,10 @@ wl_client_add_object(struct wl_client *client,
 	wl_signal_init(&resource->destroy_signal);
 
 	if (wl_map_insert_at(&client->objects, resource->object.id, resource) < 0) {
-		wl_resource_post_no_memory(client->display_resource);
+		wl_resource_post_error(client->display_resource,
+				       WL_DISPLAY_ERROR_INVALID_OBJECT,
+				       "invalid new id %d",
+				       resource->object.id);
 		free(resource);
 		return NULL;
 	}

commit 76bfd68f47c6cd8552151aa90efc4e5d074d14f9
Author: Kristian Høgsberg <krh@bitplanet.net>
Date:   Fri Jul 20 12:30:07 2012 -0400

    wayland-shm: Commit the width/height getters that actually compile

diff --git a/src/wayland-shm.c b/src/wayland-shm.c
index 50e4297..2161a71 100644
--- a/src/wayland-shm.c
+++ b/src/wayland-shm.c
@@ -292,18 +292,18 @@ wl_shm_buffer_get_format(struct wl_buffer *buffer_base)
 	return buffer->format;
 }
 
-WL_EXPORT uint32_t
+WL_EXPORT int32_t
 wl_shm_buffer_get_width(struct wl_buffer *buffer_base)
 {
 	struct wl_shm_buffer *buffer = (struct wl_shm_buffer *) buffer_base;
 
-	return buffer->base.width;
+	return buffer->buffer.width;
 }
 
-WL_EXPORT uint32_t
+WL_EXPORT int32_t
 wl_shm_buffer_get_height(struct wl_buffer *buffer_base)
 {
 	struct wl_shm_buffer *buffer = (struct wl_shm_buffer *) buffer_base;
 
-	return buffer->base.height;
+	return buffer->buffer.height;
 }

commit 0b4ed5fe72bb96b0b0ef6bfdb280889b51da62dc
Author: Kristian Høgsberg <krh@bitplanet.net>
Date:   Fri Jul 20 12:20:15 2012 -0400

    README: Update
    
    The wayland README had outdated build instructions for weston.  Let's just
    trim it down to build instructions for wayland and a link to the web site.

diff --git a/README b/README
index 64904ed..5f85888 100644
--- a/README
+++ b/README
@@ -17,114 +17,19 @@ protocol does not handle rendering, which is one of the features that
 makes wayland so simple.  All clients are expected to handle rendering
 themselves, typically through cairo or OpenGL.
 
-The wayland repository includes a compositor and a few clients, but
-both the compositor and clients are essentially test cases.
-
-
-Building Instructions
-
-The instructions below assume some familiarity with git and building
-and running experimental software.  And be prepared that this project
-isn't at all useful right now, it's still very much a prototype.  When
-the instructions suggest to clone a git repo, you can of course just
-add a remote and fetch instead, if you have a clone of that repo
-around already.  I usually install all software I'm working on into
-$HOME/install, so that's what I'll use in the instructions below, but
-you can use your favorite directory of course or install over your
-system copy (pass --prefix=/usr --sysconfdir=/etc, generally).
-
-
-Modesetting
-
-At this point, kernel modesetting is upstream for Intel, AMD and
-nVidia chipsets.  Most distributions ship with kernel modesetting
-enabled by default and will work with Wayland out of the box.  The
-modesetting driver must also support the page flip ioctl, which only
-the intel driver does at this point.
-
-
-Building mesa
-
-Wayland uses the mesa EGL stack, and all extensions required to run
-EGL on KMS are now upstream on the master branch.  The 7.9 release of
-mesa will have all these extensions, but for now you'll need to build
-mesa master:
-
-    $ git clone git://anongit.freedesktop.org/mesa/mesa
-    $ cd mesa
-    $ ./configure --prefix=$HOME/install  --enable-egl --enable-gles2
-    $ make && make install
-
-If you're using an intel chipset, it's best to also pass
---disable-gallium to ./configure, since otherwise libEGL will try to
-load the gallium sw rasterizer before loading the Intel DRI driver.
-
-
-libxkbcommon
-
-Wayland needs libxkbcommon for translating evdev keycodes to keysyms.
-There's a couple of repos around, and we're trying to consolidate the
-development, but for wayland you'll need the repo from my git
-repository.  For this you'll need development packages for xproto,
-kbproto and libX11.
-
-    $ git clone git://people.freedesktop.org/~krh/libxkbcommon.git
-    $ cd libxkbcommon/
-    $ ./autogen.sh --prefix=$HOME/install
-    $ make && make install
-
-
-cairo-gl
-
-The Wayland clients render using cairo-gl, which is an experimental
-cairo backend.  It has been available since cairo 1.10.  Unless your
-distribution ships cairo with the gl backend enabled, you'll need to
-compile your own version of cairo:
-
-    $ git clone git://anongit.freedesktop.org/cairo
-    $ cd cairo
-    $ ./autogen.sh --prefix=$HOME/install --enable-gl
-    $ make && make install
-
-
-Wayland
-
-With mesa and libxkbcommon in place, we can checkout and build
-Wayland.  Aside from mesa, Wayland needs development packages for
-gdk-pixbuf-2.0, libudev, libdrm, xcb-dri2, xcb-fixes (for X
-compositor) cairo-gl, glib-2.0, gdk-2.0 (for poppler) and
-poppler-glib:
-
-    $ git clone git://people.freedesktop.org/~krh/wayland
-    $ ./autogen.sh --prefix=$HOME/install
-    $ make && make install
-
-Installing into a non-/usr prefix is fine, but the 70-wayland.rules
-udev rule file has to be installed in /etc/udev/rules.d.  Once
-installed, either reboot or run
-
-    $ sudo udevadm trigger --subsystem-match=drm --subsystem-match=input
-
-to make udev label the devices wayland will use.
-
-If DISPLAY is set, the wayland compositor will run under X in a window
-and take input from X.  Otherwise it will run on the KMS framebuffer
-and take input from evdev devices.  Pick a background image that you
-like and copy it to the Wayland source directory as background.jpg or
-use the -b command line option:
-
-    $ ./wayland-system-compositor -b my-image.jpg
-
-To run clients, switch to a different VT and run the client from
-there.  Or run it under X and start up the clients from a terminal
-window.  There are a few demo clients available, but they are all
-pretty simple and mostly for testing specific features in the wayland
-protocol: 'terminal' is a simple terminal emulator, not very compliant
-at all, but works well enough for bash
-
-    'flower' moves a flower around the screen, testing the frame protocol
-    'gears' glxgears, but for wayland, currently broken
-    'image' loads the image files passed on the command line and shows them
-
-    'view' does the same for pdf files, but needs file URIs
-    (file:///path/to/pdf)
+The weston compositor is a reference implementation of a wayland
+compositor and the weston repository also includes a few example
+clients clients.
+
+Building the wayland libraries is fairly simple, aside from libffi,
+they don't have many dependencies:
+
+    $ git clone git://anongit.freedesktop.org/wayland/wayland
+    $ cd wayland
+    $ ./autogen.sh --prefix=PREFIX
+    $ make
+    $ make install
+
+where PREFIX is where you want to install the libraries.  See
+http://wayland.freedesktop.org for more complete build instructions
+for wayland, weston, xwayland and various toolkits.
\ No newline at end of file

commit 7ba218c9f80c9ce6f1a54e4e1b2f8aa66c590ade
Author: Kristian Høgsberg <krh@bitplanet.net>
Date:   Fri Jul 20 12:04:42 2012 -0400

    shm: Add shm_buffer getters for width and height

diff --git a/src/wayland-server.h b/src/wayland-server.h
index 18a8beb..f092145 100644
--- a/src/wayland-server.h
+++ b/src/wayland-server.h
@@ -428,6 +428,12 @@ wl_shm_buffer_get_stride(struct wl_buffer *buffer);
 uint32_t
 wl_shm_buffer_get_format(struct wl_buffer *buffer);
 
+int32_t
+wl_shm_buffer_get_width(struct wl_buffer *buffer);
+
+int32_t
+wl_shm_buffer_get_height(struct wl_buffer *buffer);
+
 int
 wl_buffer_is_shm(struct wl_buffer *buffer);
 
diff --git a/src/wayland-shm.c b/src/wayland-shm.c
index 2edaff4..50e4297 100644
--- a/src/wayland-shm.c
+++ b/src/wayland-shm.c
@@ -291,3 +291,19 @@ wl_shm_buffer_get_format(struct wl_buffer *buffer_base)
 
 	return buffer->format;
 }
+
+WL_EXPORT uint32_t
+wl_shm_buffer_get_width(struct wl_buffer *buffer_base)
+{
+	struct wl_shm_buffer *buffer = (struct wl_shm_buffer *) buffer_base;
+
+	return buffer->base.width;
+}
+
+WL_EXPORT uint32_t
+wl_shm_buffer_get_height(struct wl_buffer *buffer_base)
+{
+	struct wl_shm_buffer *buffer = (struct wl_shm_buffer *) buffer_base;
+
+	return buffer->base.height;
+}

commit 0a9cd16f6a6819392777e7b50601bb7e39b019da
Author: Robert Ancell <robert.ancell@canonical.com>
Date:   Tue Jul 10 15:52:12 2012 +1200

    wayland-client: Add missing newline from an error message

diff --git a/src/wayland-client.c b/src/wayland-client.c
index 881cda6..b41fb9b 100644
--- a/src/wayland-client.c
+++ b/src/wayland-client.c
@@ -545,7 +545,7 @@ wl_display_iterate(struct wl_display *display, uint32_t mask)
 	mask &= display->mask;
 	if (mask == 0) {
 		fprintf(stderr,
-			"wl_display_iterate called with unsolicited flags");
+			"wl_display_iterate called with unsolicited flags\n");
 		return;
 	}
 

commit 2e79c4877fc4f402297e9d685b5eb2c41d7dd814
Author: Dmitry Guryanov <dmitry.guryanov@gmail.com>
Date:   Tue Jul 17 18:56:03 2012 +0400

    remove listener from wl_data_source destroy_signal listener list
    
    I've found a bug during wayland exploration - if you make two
    drag'n'drops in weston client example, dnd - weston crashes with
    segfault. I've tried to investigate it and found a problem.
    
    In function drag_grab_button we first call data_device_end_drag_grab,
    which sets seat->drag_data_source to NULL. Then we remove
    listener from list only if drag_data_source is not NULL.
    
    So if client will not free wl_data_source and start another drag'n'drop,
    after the first one. Then two wl_data_source structures will be
    free'd on client exit (let's name them s1 and s2).
    
    next and prev pointer of


Reply to: