Re: [PATCH wayland 4/4] doc: Add auto-generated Wayland Library chapter

2012-10-11 Thread David Herrmann
Hi Tiago On Thu, Oct 11, 2012 at 4:42 PM, Tiago Vignatti wrote: > For now only Wayland Client API is described on that chapter, which is > extracted via doxygen on ./src/wayland-client.h. We apply a stylesheet > (doxygen-to-publican) on doxygen output so it becomes docbook valid. > > Now all we n

[RFC wayland 12/12] wayland-client: forward fatal errors to caller

2012-10-11 Thread David Herrmann
If any callback or helper function fails with a fatal error, we now set the last_error flag and prevent all further I/O on the wl_display. We wake up all sleeping event-queues and notify the caller that they should shutdown wl_display. Signed-off-by: David Herrmann --- src/wayland-client.c | 106

[RFC wayland 11/12] wayland-client: duplicate fd on connect

2012-10-11 Thread David Herrmann
We need our own copy of the file-descriptor in each wl_display so we can close() it on error to wake up the main-thread. Signed-off-by: David Herrmann --- src/wayland-client.c | 17 - 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/wayland-client.c b/src/wayland

[RFC wayland 10/12] wayland-client: link all event-queues of each display into a list

2012-10-11 Thread David Herrmann
We need access to all event-queues of a single wl_display object. For instance during connection-errors, we need to be able to wake up all event queues. Otherwise, they will be stuck waiting for incoming events. The API user is responsible to keep a wl_display object around until all event-queues

[RFC wayland 09/12] connection: return error on buffer-overflow during read

2012-10-11 Thread David Herrmann
wl_connection_read() assumes that the caller dispatched all messages before calling it. wl_buffer_put_iov() does only provide enough room so we fill the buffer. So the only case when the buffer overflows, is when a previous read filled up the buffer but we couldn't parse a single message from it. I

[RFC wayland 08/12] connection: fix leaking FDs on buffer-overflow during read

2012-10-11 Thread David Herrmann
If we read more FDs than we have room for, we currently leak FDs because we overwrite previous still pending FDs. Instead, we do now close incoming FDs if the buffer is full and return EOVERFLOW. Signed-off-by: David Herrmann --- src/connection.c | 33 ++--- 1 file ch

[RFC wayland 07/12] connection: fix buffer-overflow in build_cmsg()

2012-10-11 Thread David Herrmann
Same problem as we had with close_fds(). We cannot rely on the fds_out buffer being filled with less than MAX_FDS_OUT file descriptors. Therefore, write at most MAX_FDS_OUT file-descriptors to the outgoing buffer. Signed-off-by: David Herrmann --- src/connection.c | 3 +++ 1 file changed, 3 inse

[RFC wayland 06/12] connection: close pending incoming FDs on shutdown

2012-10-11 Thread David Herrmann
Same problem as with outgoing FDs. We need to close these on shutdown, otherwise we leak open file descriptors. Signed-off-by: David Herrmann --- src/connection.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/connection.c b/src/connection.c index 355fd54..8264470 100644 --- a/src/conne

[RFC wayland 05/12] connection: fix buffer-overflow in close_fds()

2012-10-11 Thread David Herrmann
If we push two messages via wl_connection_write() and both messages contain more than MAX_FDS_OUT file-descriptors combined, then wl_connection_flush() will write only MAX_FDS_OUT of them, but close all pending ones, too. Furthermore, close_fds() will copy more FDs out of the buffer than it can ho

[RFC wayland 04/12] connection: close pending outgoing fds on shutdown

2012-10-11 Thread David Herrmann
When destroying a wl_connection object, there might still be data in the queue. We would leak open file-descriptors so we must close them. Signed-off-by: David Herrmann --- src/connection.c | 35 ++- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/

[RFC wayland 02/12] wayland-util: return -1 if wl_array_copy() fails

2012-10-11 Thread David Herrmann
We might have to perform memory allocations in wl_array_copy(), so catch out-of-memory errors in wl_array_add() and return -1 before changing any state. Signed-off-by: David Herrmann --- src/wayland-util.c | 12 +--- src/wayland-util.h | 2 +- 2 files changed, 10 insertions(+), 4 deleti

[RFC wayland 03/12] wayland-util: return -1 on OOM in wl_map_insert_new()

2012-10-11 Thread David Herrmann
If we cannot increase the array for new entries, we now return -1 instead of accessing invalid memory. Signed-off-by: David Herrmann --- src/wayland-private.h | 2 +- src/wayland-util.c| 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/wayland-private.h b/src/waylan

[RFC wayland 01/12] wayland-client: add wl_display_get_error()

2012-10-11 Thread David Herrmann
A server may asynchronously send errors via wl_display.error() events. Instead of aborting we now the a "last_error" flag inside of wl_display objects. The user can retrieve these via wl_display_get_error(). Signed-off-by: David Herrmann --- src/wayland-client.c | 39

[RFC wayland 00/12] wayland-client: error recovery

2012-10-11 Thread David Herrmann
Hi This patchset is some _untested_ (but compile-tested) proposal to add error-recovery paths to libwayland-client. The basic idea is to set a global flag when a fatal-error occurs and waking up all event-queues. All sleeping dispatchers and all further dispatches will return -1 and errno set to t

[PATCH] editor: Add support for editing text using the keyboard

2012-10-11 Thread Rob Bradford
From: Rob Bradford This simple change allows you to drive the editor using the keyboard (supporting backspace and delete and left and right arrow keys.) The idea behind this change is to allow the testing of the interoperation between a virtual keyboard and real one. Signed-off-by: Rob Bradford

[PATCH wayland 3/4] doc: Remove superfluous 'index'

2012-10-11 Thread Tiago Vignatti
We're not setting any sort of index. Remove for now. Signed-off-by: Tiago Vignatti --- doc/Wayland/en_US/Wayland.xml |1 - 1 file changed, 1 deletion(-) diff --git a/doc/Wayland/en_US/Wayland.xml b/doc/Wayland/en_US/Wayland.xml index 800d537..378d2c3 100644 --- a/doc/Wayland/en_US/Wayland.x

[PATCH wayland 2/4] doc: publican: Automate version generation

2012-10-11 Thread Tiago Vignatti
It seems reasonable to use protocol's version for the documentation as well. Signed-off-by: Tiago Vignatti --- doc/Wayland/Makefile.am |7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/doc/Wayland/Makefile.am b/doc/Wayland/Makefile.am index 600bf86..2fa3f9c 100644 ---

[PATCH wayland 1/4] doc: publican: Set table of contents depth to 1

2012-10-11 Thread Tiago Vignatti
This way looks more pretty, in particular for the Appendix which spawns a big subsections chain. Signed-off-by: Tiago Vignatti --- doc/Wayland/publican.cfg |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/Wayland/publican.cfg b/doc/Wayland/publican.cfg index 810c735..d9

Re: [PATCH wayland] client: Fix double locking bug

2012-10-11 Thread Kristian Høgsberg
On Thu, Oct 11, 2012 at 02:20:28PM +0300, Ander Conselvan de Oliveira wrote: > The function wl_proxy_create_for_id() would try to acquire the display > lock, but the only call path leading to it would call it with the lock > already acquired. > > This patch removes the attempt to acquire the lock

Re: [PATCH wayland] data-device: Don't fake an attach event on drag icon surface

2012-10-11 Thread Kristian Høgsberg
On Thu, Oct 11, 2012 at 02:05:37PM +0300, Ander Conselvan de Oliveira wrote: > Emit a new drag icon signal instead and let the compositor handle the > unmapping of the icon surface. Much better, I never liked calling back into the protocol handler. Kristian > --- > src/data-device.c | 12 ++--

Re: [PATCH v2 krh/wayland/next] protocol: fix clarification of input region on drags and pointers

2012-10-11 Thread Kristian Høgsberg
On Thu, Oct 11, 2012 at 01:58:45PM +0300, Pekka Paalanen wrote: > The previous clarification did not follow the current implementation in > Weston, where when a surface stops being a cursor or an icon, it becomes > a plain unmapped surface again. > > Rewrite the related paragraphs, and fix some ty

[PATCH wayland] client: Fix double locking bug

2012-10-11 Thread Ander Conselvan de Oliveira
The function wl_proxy_create_for_id() would try to acquire the display lock, but the only call path leading to it would call it with the lock already acquired. This patch removes the attempt to acquire the lock and makes the function static. It was exported before because client had to create prox

[PATCH krh/wayland/next] protocol: clarify multiple wl_surface.attach

2012-10-11 Thread Pekka Paalanen
Explicitly say what happens with the wl_buffer.release event, if you attach several wl_buffers without a commit in between. Reported-by: David Herrmann Signed-off-by: Pekka Paalanen --- protocol/wayland.xml |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/protocol/way

[PATCH wayland] client: Fix double locking bug

2012-10-11 Thread Ander Conselvan de Oliveira
The function wl_proxy_create_for_id() would try to acquire the display lock, but the only call path leading to it would call it with the lock already acquired. This patch removes the attempt to acquire the lock and makes the function static. It was exported before because client had to create prox

Re: [PATCH v2 krh/wayland/next] protocol: fix clarification of input region on drags and pointers

2012-10-11 Thread Ander Conselvan de Oliveira
On 10/11/2012 01:58 PM, Pekka Paalanen wrote: The previous clarification did not follow the current implementation in Weston, where when a surface stops being a cursor or an icon, it becomes a plain unmapped surface again. Rewrite the related paragraphs, and fix some typos while at it. For star

Re: [PATCH wayland 1/4] protocol: double-buffered state for wl_surface

2012-10-11 Thread Pekka Paalanen
On Thu, 11 Oct 2012 13:00:40 +0200 David Herrmann wrote: > Hi Pekka > > On Wed, Oct 10, 2012 at 11:47 AM, Pekka Paalanen wrote: > > This change breaks the protocol. > > > > The current protocol is racy in that updates to surface content and > > surface state (e.g. damage, input and opaque regio

[PATCH weston] compositor: Unmap drag icon surface when its released

2012-10-11 Thread Ander Conselvan de Oliveira
libwayland-server was changed to emit the new drag icon signal instead of faking an attach event with a NULL buffer so this has to be done on this side. --- src/compositor.c |3 +++ 1 file changed, 3 insertions(+) diff --git a/src/compositor.c b/src/compositor.c index f4c933e..f96d675 100644

[PATCH wayland] data-device: Don't fake an attach event on drag icon surface

2012-10-11 Thread Ander Conselvan de Oliveira
Emit a new drag icon signal instead and let the compositor handle the unmapping of the icon surface. --- src/data-device.c | 12 ++-- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/data-device.c b/src/data-device.c index 82020af..363a90d 100644 --- a/src/data-device.c

Re: [PATCH wayland 1/4] protocol: double-buffered state for wl_surface

2012-10-11 Thread David Herrmann
Hi Pekka On Wed, Oct 10, 2012 at 11:47 AM, Pekka Paalanen wrote: > This change breaks the protocol. > > The current protocol is racy in that updates to surface content and > surface state (e.g. damage, input and opaque regions) are not guaranteed > to happen at the same time. Due to protocol buff

[PATCH v2 krh/wayland/next] protocol: fix clarification of input region on drags and pointers

2012-10-11 Thread Pekka Paalanen
The previous clarification did not follow the current implementation in Weston, where when a surface stops being a cursor or an icon, it becomes a plain unmapped surface again. Rewrite the related paragraphs, and fix some typos while at it. For start drag, make it explicit of which surface argume

[PATCH krh/wayland/next] protocol: fix clarification of input region on drags and pointers

2012-10-11 Thread Pekka Paalanen
The previous clarification did not follow the current implementation in Weston, where when a surface stops being a cursor or an icon, it becomes a plain unmapped surface again. Rewrite the related paragraphs, and fix some typos while at it. For start drag, make it explicit of which surface argume

Re: [PATCH] Update to new fd and wl_registry APIs

2012-10-11 Thread Pekka Paalanen
On Wed, 10 Oct 2012 21:37:41 -0400 Kristian Høgsberg wrote: > This commit updates the clients and the wayland compositor backend to > use the new wl_registry mechanism and the thread safe fd API. > --- > > This is the weston patch that goes with the 8 thread-safety wayland patches. > The wl_regi

Re: [PATCH 1/8] Change filedescriptor API to be thread safe

2012-10-11 Thread Pekka Paalanen
On Wed, 10 Oct 2012 20:58:34 -0400 Kristian Høgsberg wrote: > On Wed, Oct 10, 2012 at 11:32:15AM +0300, Pekka Paalanen wrote: > > On Tue, 9 Oct 2012 22:37:58 -0400 > > Kristian Høgsberg wrote: > > > > > The update callback for the file descriptors was always a bit awkward and > > > un-intuitiv