.gitignore | 2 Makefile.am | 6 TODO | 21 configure.ac | 28 cursor/Makefile.am | 1 cursor/convert_font.c | 531 +++++++ cursor/cursor-data.h | 548 +++++++ cursor/cursor.pcf |binary cursor/wayland-cursor.c | 73 + cursor/xcursor.c | 5 debian/changelog | 11 debian/control | 2 debian/libwayland-dev.install | 3 doc/Makefile.am | 2 doc/Wayland/Makefile.am | 35 doc/Wayland/doxygen-to-publican.xsl | 46 doc/Wayland/en_US/Architecture.xml | 2 doc/Wayland/en_US/Library.xml | 9 doc/Wayland/en_US/Protocol.xml | 458 +----- doc/Wayland/en_US/Wayland.xml | 2 doc/Wayland/protocol-interfaces-to-docbook.xsl | 56 doc/Wayland/protocol-to-docbook.xsl | 33 doc/Wayland/publican.cfg | 2 doc/doxygen/.gitignore | 1 doc/doxygen/Makefile.am | 13 doc/doxygen/wayland.doxygen.in | 1782 +++++++++++++++++++++++++ doc/man/Makefile.am | 49 doc/man/wl_display_connect.xml | 88 + protocol/wayland.xml | 366 ++++- src/connection.c | 328 ++-- src/data-device.c | 13 src/event-loop.c | 15 src/scanner.c | 157 +- src/wayland-client.c | 853 ++++++++--- src/wayland-client.h | 144 +- src/wayland-egl.h | 9 src/wayland-private.h | 25 src/wayland-server.c | 272 ++- src/wayland-server.h | 48 src/wayland-shm.c | 47 src/wayland-util.c | 14 src/wayland-util.h | 32 tests/client-test.c | 1 tests/connection-test.c | 82 - tests/os-wrappers-test.c | 31 tests/sanity-test.c | 8 tests/socket-test.c | 22 tests/test-runner.c | 10 48 files changed, 5126 insertions(+), 1160 deletions(-)
New commits: commit fe42325c6aca36063678cf44719c2c35ee785ce5 Author: Maarten Lankhorst <maarten.lankho...@canonical.com> Date: Mon Nov 19 19:15:16 2012 +0100 New upstream release * New upstream release * debian/libwayland-dev.install: - Install development man pages * debian/control: - Build-depend on doxygen - Build-depend on xsltproc diff --git a/debian/changelog b/debian/changelog index 9ccb9e1..dd50073 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,14 @@ +wayland (1.0.0-1) UNRELEASED; urgency=low + + * New upstream release + * debian/libwayland-dev.install: + - Install development man pages + * debian/control: + - Build-depend on doxygen + - Build-depend on xsltproc + + -- Robert Ancell <robert.anc...@canonical.com> Fri, 16 Nov 2012 10:07:08 +1300 + wayland (0.95.0-1) UNRELEASED; urgency=low * New upstream release. diff --git a/debian/control b/debian/control index ba493a2..e70898d 100644 --- a/debian/control +++ b/debian/control @@ -8,6 +8,8 @@ Build-Depends: quilt, dh-autoreconf, pkg-config, + doxygen, + xsltproc, libexpat1-dev, libffi-dev, Standards-Version: 3.9.3 diff --git a/debian/libwayland-dev.install b/debian/libwayland-dev.install index 9b01b5b..7fab4ad 100644 --- a/debian/libwayland-dev.install +++ b/debian/libwayland-dev.install @@ -4,6 +4,9 @@ usr/bin/wayland-scanner # Headers: usr/include +# Man pages +usr/share/man/man3 + # Use no wildcards to ensure we spot any update: usr/lib/*/libwayland-client.a usr/lib/*/libwayland-client.so commit 1f521a4f7760df73e1d1d8a6791d1c7bf536584e Author: Kristian Høgsberg <k...@bitplanet.net> Date: Mon Oct 22 14:55:06 2012 -0400 configure.ac: Bump version to 1.0.0 diff --git a/configure.ac b/configure.ac index 1a10cf8..f681fc9 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ AC_PREREQ([2.64]) -m4_define([wayland_major_version], [0]) -m4_define([wayland_minor_version], [99]) +m4_define([wayland_major_version], [1]) +m4_define([wayland_minor_version], [0]) m4_define([wayland_micro_version], [0]) m4_define([wayland_version], [wayland_major_version.wayland_minor_version.wayland_micro_version]) commit 3b7d7b0c8014e31ec8ae1d2b31fb8c6de54cbc21 Author: Kristian Høgsberg <k...@bitplanet.net> Date: Sun Oct 21 22:24:33 2012 -0400 scanner: Preserve paragraph breaks in input XML If we have a blank line in the incoming XML documentation, keep that in the emitted doxygen comments. diff --git a/src/scanner.c b/src/scanner.c index 4a4e605..5793c20 100644 --- a/src/scanner.c +++ b/src/scanner.c @@ -177,7 +177,7 @@ desc_dump(char *desc, const char *fmt, ...) { va_list ap; char buf[128], hang; - int col, i, j, k, startcol; + int col, i, j, k, startcol, newlines; va_start(ap, fmt); vsnprintf(buf, sizeof buf, fmt, ap); @@ -206,8 +206,12 @@ desc_dump(char *desc, const char *fmt, ...) for (i = 0; desc[i]; ) { k = i; - while (desc[i] && isspace(desc[i])) + newlines = 0; + while (desc[i] && isspace(desc[i])) { + if (desc[i] == '\n') + newlines++; i++; + } if (!desc[i]) break; @@ -215,7 +219,9 @@ desc_dump(char *desc, const char *fmt, ...) while (desc[i] && !isspace(desc[i])) i++; - if (col + i - j > 72) { + if (newlines > 1) + printf("\n%s*", indent(startcol)); + if (newlines > 1 || col + i - j > 72) { printf("\n%s*%c", indent(startcol), hang); col = startcol; } commit cc95db359c8b935699173ec921ba9316c762aea5 Author: Kristian Høgsberg <k...@bitplanet.net> Date: Sun Oct 21 22:10:56 2012 -0400 doc: Fix typo in generated section header We were generating headers such as 'Events provided by wl_display events', drop the last 'events'. diff --git a/doc/Wayland/protocol-to-docbook.xsl b/doc/Wayland/protocol-to-docbook.xsl index b76dbd8..ca00efb 100644 --- a/doc/Wayland/protocol-to-docbook.xsl +++ b/doc/Wayland/protocol-to-docbook.xsl @@ -71,13 +71,13 @@ </xsl:if> <xsl:if test="event"> <section> - <title>Events provided by <xsl:value-of select="@name" /> events</title> + <title>Events provided by <xsl:value-of select="@name" /></title> <xsl:apply-templates select="event" /> </section> </xsl:if> <xsl:if test="enum"> <section> - <title>Enums provided by <xsl:value-of select="@name" /> enums</title> + <title>Enums provided by <xsl:value-of select="@name" /></title> <xsl:apply-templates select="enum" /> </section> </xsl:if> commit 65eef9d817d3db2ae7c61cd02075d46cf7bd9f90 Author: Kristian Høgsberg <k...@bitplanet.net> Date: Sun Oct 21 22:08:08 2012 -0400 wayland: Add protocol documentation for various interfaces diff --git a/protocol/wayland.xml b/protocol/wayland.xml index 019816d..6171670 100644 --- a/protocol/wayland.xml +++ b/protocol/wayland.xml @@ -44,13 +44,23 @@ </request> <request name="get_registry"> + <description summary="get global registry object"> + This request creates a registry object that allows the client + to list and bind the global objects available from the + compositor. + </description> <arg name="callback" type="new_id" interface="wl_registry"/> </request> <event name="error"> <description summary="fatal error event"> The error event is sent out when a fatal (non-recoverable) - error has occurred. + error has occurred. The @object_id argument is the object + where the error occurred, most often in response to a request + to that object. The @code identifies the error and is defined + by the object interface. As such, each interface defines its + own set of error codes. The @message is an brief description + of the error, for (debugging) convenience. </description> <arg name="object_id" type="object"/> <arg name="code" type="uint"/> @@ -72,13 +82,39 @@ <event name="delete_id"> <description summary="acknowledge object id deletion"> - Server has deleted the id and client can now reuse it. + This event is used internally by the object ID management + logic. When a client deletes an object, the server will send + this event to acknowledge that it has seen the delete request. + When the client receive this event, it will know that it can + safely reuse the object ID </description> <arg name="id" type="uint" /> </event> </interface> <interface name="wl_registry" version="1"> + <description summary="global registry object"> + The global registry object. The server has a number of global + objects that are available to all clients. These objects + typically represent an actual object in the server (for example, + an input device) or they are singleton objects that provides + extension functionality. + + When a client creates a registry object, the registry object + will emit a global event for each global currently in the + regitry. Globals come and go as a result of device hotplugs, + reconfiguration or other events, and the registry will send out + @global and @global_remove events to keep the client up to date + with the changes. To mark the end of the initial burst of + events, the client can use the wl_display.sync request + immediately after calling wl_display.get_registry. + + A client can 'bind' to a global object by using the bind + request. This creates a client side handle that lets the object + emit events to the client and lets the client invoke requests on + the object. + </description> + <request name="bind"> <description summary="bind an object to the display"> Binds a new, client-created object to the server using @name as @@ -90,14 +126,7 @@ <event name="global"> <description summary="announce global object"> - Notify the client of global objects. These are objects that - are created by the server. Globals are published on the - initial client connection sequence, upon device hotplugs, - device disconnects, reconfiguration or other events. A client - can 'bind' to a global object by using the bind request. This - creates a client side handle that lets the object emit events - to the client and lets the client invoke requests on the - object. + Notify the client of global objects. </description> <arg name="name" type="uint"/> <arg name="interface" type="string"/> @@ -106,7 +135,13 @@ <event name="global_remove"> <description summary="announce removal of global object"> - Notify the client of removed global objects. + Notify the client of removed global objects. This event + notifies the client that the global identifies by @name is no + longer available. If the client bound to the global using the + 'bind' request, the client should now destroy that object. + The object remains valid and requests to the object will be + 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"/> </event> @@ -262,6 +297,15 @@ <interface name="wl_data_offer" version="1"> + <description summary="offer to transfer data"> + A wl_data_offer represents a piece of data offered for transfer + by another client (the source client). It is used by the + copy-and-paste and drag-and-drop mechanisms. The offer + describes the different mime types that the data can be + converted to and provides the mechanism for transferring the + data directly from the source client. + </description> + <request name="accept"> <description summary="accept one of the offered mime-types"> Indicate that the client can accept the given mime-type, or @@ -273,6 +317,16 @@ </request> <request name="receive"> + <description summary="request that the data is transferred"> + To transfer the offered data, the client issues this request + and indicates the mime-type it wants to receive. The transfer + happens through the passed fd (typically a pipe(7) file + descriptor). The source client writes the data in the + mime-type representation requested and then closes the fd. + The receiving client reads from the read end of the pipe until + EOF and the closes its end, at which point the transfer is + complete. + </description> <arg name="mime_type" type="string"/> <arg name="fd" type="fd"/> </request> @@ -290,6 +344,13 @@ </interface> <interface name="wl_data_source" version="1"> + <description summary="offer to transfer data"> + The wl_data_source object is the source side of a wl_data_offer. + It is created by the source client in a data transfer and + provides a way to describe the offered data and a way to respond + to requests to transfer the data. + </description> + <request name="offer"> <description summary="add an offered mime type"> This request adds a mime-type to the set of mime-types @@ -326,7 +387,8 @@ <event name="cancelled"> <description summary="selection was cancelled"> - Another selection became active. + This data source has been replaced by another data source. + The client should clean up and destroy this data source. </description> </event> @@ -387,6 +449,13 @@ </event> <event name="enter"> + <description summary="initiate drag and drop session"> + This event is sent when an active drag-and-drop pointer enters + a surface owned by the client. The position of the pointer at + enter time is provided by the @x an @y arguments, in surface + local coordinates. + </description> + <arg name="serial" type="uint"/> <arg name="surface" type="object" interface="wl_surface"/> <arg name="x" type="fixed"/> @@ -394,9 +463,21 @@ <arg name="id" type="object" interface="wl_data_offer" allow-null="true"/> </event> - <event name="leave"/> + <event name="leave"> + <description summary="end drag and drop session"> + This event is sent when the drag-and-drop pointer leaves the + surface and the session ends. The client must destroy the + wl_data_offer introduced at enter time at this point. + </description> + </event> <event name="motion"> + <description summary="drag and drop session motion"> + This event is sent when the drag-and-drop pointer moves within + the currently focused surface. The new position of the pointer + is provided by the @x an @y arguments, in surface local + coordinates. + </description> <arg name="time" type="uint"/> <arg name="x" type="fixed"/> <arg name="y" type="fixed"/> commit a04beb1298d44ec4a6b8e14efeb36353d37445f5 Author: Kristian Høgsberg <k...@bitplanet.net> Date: Sun Oct 21 20:53:37 2012 -0400 Update TODO We've knocked a few items of the list. diff --git a/TODO b/TODO index 00a32ca..8cb8d34 100644 --- a/TODO +++ b/TODO @@ -1,24 +1,9 @@ Core wayland protocol - - 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 - something more reliable and explicit. The suggestion is that we - make surface.attach a synchronization point such that everything - before that is batched and applied atomically when the - surface.attach request comes in. For cases where we need atomicity - beyond a surface.attach, we can add an atomic grouping mechanism, - that can group together multiple surface.attach requests into a - bigger atomic change. To be researched a bit. - - Maybe try to make remote wayland actually happen, to see if there is something in the protocol/architecture that makes it harder than it should be. - - Add timestamp to touch_cancel, add touch id to touch_cancel (?) - - - The output protocol needs to send all the ugly timing details for the modes. - ICCCM - mime-type guidelines for data_source (ie, both dnd and selection): @@ -53,8 +38,6 @@ EWMH EGL/gbm - - Don't wl_display_iterate in eglSwapBuffer, send an eventfd fd? - - Land Robert Braggs EGL extensions: frame age, swap with damage - Make it possible to share buffers from compositor to clients. @@ -71,6 +54,7 @@ EGL/gbm allocate a scanout buffer now" event to the fullscreen-to-be client. + Misc - glyph cache @@ -101,6 +85,7 @@ Misc switching away from. for minimized windows that we don't want live thumb nails for. etc. + Clients and ports - port gtk+ @@ -120,8 +105,6 @@ Clients and ports - SDL port, bnf has work in progress here: http://cgit.freedesktop.org/~bnf/sdl-wayland/ - - libva + eglimage + kms integration - Ideas commit c450b6e23bd9f57d8908bd11b96579ac107bed91 Author: Kristian Høgsberg <k...@bitplanet.net> Date: Sun Oct 21 10:04:17 2012 -0400 tests: Include wayland-private.h for container_of diff --git a/tests/client-test.c b/tests/client-test.c index 5521510..5cf374d 100644 --- a/tests/client-test.c +++ b/tests/client-test.c @@ -32,6 +32,7 @@ #include <sys/stat.h> #include "wayland-server.h" +#include "wayland-private.h" #include "test-runner.h" struct client_destroy_listener { commit 1bade73b6b58cf2c3187b0fca72f4aec8301c4a3 Author: Kristian Høgsberg <k...@bitplanet.net> Date: Sat Oct 20 11:38:57 2012 -0400 scanner: Fix valgrind errors diff --git a/src/scanner.c b/src/scanner.c index d0aafec..4a4e605 100644 --- a/src/scanner.c +++ b/src/scanner.c @@ -393,6 +393,8 @@ start_element(void *data, const char *element_name, const char **atts) case OBJECT: if (interface_name) arg->interface_name = strdup(interface_name); + else + arg->interface_name = NULL; break; default: if (interface_name != NULL) @@ -449,10 +451,7 @@ start_element(void *data, const char *element_name, const char **atts) fail(ctx, "description without summary"); description = malloc(sizeof *description); - if (summary) - description->summary = strdup(summary); - else - description->summary = NULL; + description->summary = strdup(summary); if (ctx->message) ctx->message->description = description; @@ -476,10 +475,9 @@ end_element(void *data, const XML_Char *name) strndup(ctx->character_data, ctx->character_data_length); } else if (strcmp(name, "description") == 0) { - char *text = strndup(ctx->character_data, - ctx->character_data_length); - if (text) - ctx->description->text = text; + ctx->description->text = + strndup(ctx->character_data, + ctx->character_data_length); ctx->description = NULL; } else if (strcmp(name, "request") == 0 || strcmp(name, "event") == 0) { @@ -1147,6 +1145,7 @@ int main(int argc, char *argv[]) protocol.type_index = 0; protocol.null_run_length = 0; protocol.copyright = NULL; + memset(&ctx, 0, sizeof ctx); ctx.protocol = &protocol; ctx.filename = "<stdin>"; commit 620d9edb2549e4cdbf07b61dae92a22d6fc7e971 Author: Kristian Høgsberg <k...@bitplanet.net> Date: Fri Oct 19 23:26:38 2012 -0400 Rename __wl_container_of macro to just wl_container_of The _* namespace and identifiers with double underscore are reserved by the C standard. That makes __wl_container_of is double plus bad, so lets just call it wl_container_of. diff --git a/src/wayland-util.h b/src/wayland-util.h index 4b1eca0..257a5d1 100644 --- a/src/wayland-util.h +++ b/src/wayland-util.h @@ -110,40 +110,40 @@ int wl_list_empty(struct wl_list *list); void wl_list_insert_list(struct wl_list *list, struct wl_list *other); #ifdef __GNUC__ -#define __wl_container_of(ptr, sample, member) \ +#define wl_container_of(ptr, sample, member) \ (__typeof__(sample))((char *)(ptr) - \ ((char *)&(sample)->member - (char *)(sample))) #else -#define __wl_container_of(ptr, sample, member) \ +#define wl_container_of(ptr, sample, member) \ (void *)((char *)(ptr) - \ ((char *)&(sample)->member - (char *)(sample))) #endif #define wl_list_for_each(pos, head, member) \ - for (pos = 0, pos = __wl_container_of((head)->next, pos, member); \ + for (pos = 0, pos = wl_container_of((head)->next, pos, member); \ &pos->member != (head); \ - pos = __wl_container_of(pos->member.next, pos, member)) + pos = wl_container_of(pos->member.next, pos, member)) #define wl_list_for_each_safe(pos, tmp, head, member) \ for (pos = 0, tmp = 0, \ - pos = __wl_container_of((head)->next, pos, member), \ - tmp = __wl_container_of((pos)->member.next, tmp, member); \ + pos = wl_container_of((head)->next, pos, member), \ + tmp = wl_container_of((pos)->member.next, tmp, member); \ &pos->member != (head); \ pos = tmp, \ - tmp = __wl_container_of(pos->member.next, tmp, member)) + tmp = wl_container_of(pos->member.next, tmp, member)) #define wl_list_for_each_reverse(pos, head, member) \ - for (pos = 0, pos = __wl_container_of((head)->prev, pos, member); \ + for (pos = 0, pos = wl_container_of((head)->prev, pos, member); \ &pos->member != (head); \ - pos = __wl_container_of(pos->member.prev, pos, member)) + pos = wl_container_of(pos->member.prev, pos, member)) #define wl_list_for_each_reverse_safe(pos, tmp, head, member) \ for (pos = 0, tmp = 0, \ - pos = __wl_container_of((head)->prev, pos, member), \ - tmp = __wl_container_of((pos)->member.prev, tmp, member); \ + pos = wl_container_of((head)->prev, pos, member), \ + tmp = wl_container_of((pos)->member.prev, tmp, member); \ &pos->member != (head); \ pos = tmp, \ - tmp = __wl_container_of(pos->member.prev, tmp, member)) + tmp = wl_container_of(pos->member.prev, tmp, member)) struct wl_array { size_t size; commit 7ec35d8e13c28b39d412127ac2459854c66cdfd5 Author: Kristian Høgsberg <k...@bitplanet.net> Date: Fri Oct 19 23:06:53 2012 -0400 Move un-namespaced container_of into private header diff --git a/src/data-device.c b/src/data-device.c index 363a90d..4255c13 100644 --- a/src/data-device.c +++ b/src/data-device.c @@ -25,6 +25,7 @@ #include <unistd.h> #include <stdio.h> +#include "wayland-private.h" #include "wayland-server.h" static void diff --git a/src/wayland-private.h b/src/wayland-private.h index 0d617a7..1b98ce2 100644 --- a/src/wayland-private.h +++ b/src/wayland-private.h @@ -30,6 +30,10 @@ #define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0]) +#define container_of(ptr, type, member) ({ \ + const __typeof__( ((type *)0)->member ) *__mptr = (ptr); \ + (type *)( (char *)__mptr - offsetof(type,member) );}) + #define WL_ZOMBIE_OBJECT ((void *) 2) #define WL_MAP_SERVER_SIDE 0 diff --git a/src/wayland-shm.c b/src/wayland-shm.c index 90c4cf7..47c126b 100644 --- a/src/wayland-shm.c +++ b/src/wayland-shm.c @@ -33,6 +33,7 @@ #include <sys/mman.h> #include <unistd.h> +#include "wayland-private.h" #include "wayland-server.h" struct wl_shm_pool { diff --git a/src/wayland-util.h b/src/wayland-util.h index 7c8f563..4b1eca0 100644 --- a/src/wayland-util.h +++ b/src/wayland-util.h @@ -39,10 +39,6 @@ extern "C" { #define WL_EXPORT #endif -#define container_of(ptr, type, member) ({ \ - const __typeof__( ((type *)0)->member ) *__mptr = (ptr); \ - (type *)( (char *)__mptr - offsetof(type,member) );}) - struct wl_message { const char *name; const char *signature; commit bdd272f024744b4ed5ba6daedef7eb023bcac7cb Author: Kristian Høgsberg <k...@bitplanet.net> Date: Fri Oct 19 17:08:38 2012 -0400 Move ARRAY_LENGTH out of public headers Exporting unprefixed symbols is a pretty bad idea so don't do that. Instea of redefining it WL_ARRAY_LENGTH, we just move the define to our private header. The scanner generates code that uses ARRAY_LENGTH, but we can just make it count the number elements and emit an integer constant instead. diff --git a/cursor/wayland-cursor.c b/cursor/wayland-cursor.c index 0d1fec7..25e51c2 100644 --- a/cursor/wayland-cursor.c +++ b/cursor/wayland-cursor.c @@ -31,6 +31,8 @@ #include "os-compatibility.h" +#define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0]) + struct shm_pool { struct wl_shm_pool *pool; int fd; diff --git a/src/event-loop.c b/src/event-loop.c index e383300..8db9c7c 100644 --- a/src/event-loop.c +++ b/src/event-loop.c @@ -35,6 +35,7 @@ #include <unistd.h> #include <assert.h> #include "wayland-server.h" +#include "wayland-private.h" #include "wayland-os.h" struct wl_event_loop { diff --git a/src/scanner.c b/src/scanner.c index 47c22cb..d0aafec 100644 --- a/src/scanner.c +++ b/src/scanner.c @@ -127,6 +127,18 @@ struct parse_context { unsigned int character_data_length; }; +static int +list_length(struct wl_list *list) +{ + struct wl_list *l; + int i; + + for (i = 0, l = list->next; l != list; i++, l = l->next) + ; + + return i; +} + static char * uppercase_dup(const char *src) { @@ -1106,14 +1118,14 @@ emit_code(struct protocol *protocol) i->name, i->name, i->version); if (!wl_list_empty(&i->request_list)) - printf("\tARRAY_LENGTH(%s_requests), %s_requests,\n", - i->name, i->name); + printf("\t%d, %s_requests,\n", + list_length(&i->request_list), i->name); else printf("\t0, NULL,\n"); if (!wl_list_empty(&i->event_list)) - printf("\tARRAY_LENGTH(%s_events), %s_events,\n", - i->name, i->name); + printf("\t%d, %s_events,\n", + list_length(&i->event_list), i->name); else printf("\t0, NULL,\n"); diff --git a/src/wayland-private.h b/src/wayland-private.h index 8adee9f..0d617a7 100644 --- a/src/wayland-private.h +++ b/src/wayland-private.h @@ -28,6 +28,8 @@ #include <ffi.h> #include "wayland-util.h" +#define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0]) + #define WL_ZOMBIE_OBJECT ((void *) 2) #define WL_MAP_SERVER_SIDE 0 diff --git a/src/wayland-util.h b/src/wayland-util.h index f54077e..7c8f563 100644 --- a/src/wayland-util.h +++ b/src/wayland-util.h @@ -39,8 +39,6 @@ extern "C" { #define WL_EXPORT #endif -#define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0]) - #define container_of(ptr, type, member) ({ \ const __typeof__( ((type *)0)->member ) *__mptr = (ptr); \ (type *)( (char *)__mptr - offsetof(type,member) );}) commit 56061674cd80e701174c1f1b1bf575aa308ecbd8 Author: Tiago Vignatti <tiago.vigna...@intel.com> Date: Fri Oct 19 18:29:54 2012 +0300 configure: Depend on a more strict version of publican Fix https://bugs.freedesktop.org/show_bug.cgi?id=56101 Signed-off-by: Tiago Vignatti <tiago.vigna...@intel.com> diff --git a/configure.ac b/configure.ac index 1c102c6..1a10cf8 100644 --- a/configure.ac +++ b/configure.ac @@ -86,6 +86,14 @@ if test "x$enable_documentation" = "xyes"; then AC_PATH_PROG(PUBLICAN, publican) + if test "x$PUBLICAN" != "x"; then + PUBLICAN_VERSION=`$PUBLICAN -v | cut -d'=' -f2` + + if test [ 1 -eq `echo "${PUBLICAN_VERSION} < 2.8" | bc` ]; then + AC_MSG_ERROR([Publican version is not supported. Install publican >= 2.8 or disable the documentation using --disable-documentation]) + fi + fi + AC_CONFIG_FILES([ doc/doxygen/wayland.doxygen ]) commit 68c4136a070178d7b4712a42140af960bb3ba1a7 Author: Ander Conselvan de Oliveira <ander.conselvan.de.olive...@intel.com> Date: Fri Oct 19 15:30:26 2012 +0300 doc: Update doxygen documentation when source files are changed diff --git a/doc/doxygen/Makefile.am b/doc/doxygen/Makefile.am index 76f4cf6..957aa3d 100644 --- a/doc/doxygen/Makefile.am +++ b/doc/doxygen/Makefile.am @@ -2,7 +2,11 @@ noinst_DATA = xml/index.xml dist_noinst_DATA = wayland.doxygen.in -xml/index.xml: +scanned_src_files = \ + $(top_srcdir)/src/wayland-client.c \ + $(top_srcdir)/src/wayland-client.h + +xml/index.xml: $(scanned_src_files) doxygen wayland.doxygen clean-local: commit 818bb399b040f9db5d6563cfbd9ec8da9131f30d Author: Ander Conselvan de Oliveira <ander.conselvan.de.olive...@intel.com> Date: Fri Oct 19 15:30:25 2012 +0300 doc: Clarify documentation about dispatching event queues Clarify on what cases each of the dispatching functions may block, what is the main thread and add some real world examples. diff --git a/src/wayland-client.c b/src/wayland-client.c index ccf8174..7e50b40 100644 --- a/src/wayland-client.c +++ b/src/wayland-client.c @@ -824,6 +824,11 @@ err_unlock: * Dispatch all incoming events for objects assigned to the given * event queue. On failure -1 is returned and errno set appropriately. * + * This function blocks if there are no events to dispatch. If calling from + * the main thread, it will block reading data from the display fd. For other + * threads this will block until the main thread queues events on the queue + * passed as argument. + * * \memberof wl_display */ WL_EXPORT int @@ -833,14 +838,25 @@ wl_display_dispatch_queue(struct wl_display *display, return dispatch_queue(display, queue, 1); } -/** Dispatch a display's main event queue +/** Process incoming events * * \param display The display context object * \return The number of dispatched events on success or -1 on failure * * Dispatch the display's main event queue. * - * \sa wl_display_dispatch_queue() + * If the main event queue is empty, this function blocks until there are + * events to be read from the display fd. Events are read and queued on + * the appropriate event queues. Finally, events on the main event queue + * are dispatched. + * + * \note It is not possible to check if there are events on the main queue + * or not. For dispatching main queue events without blocking, see \ref + * wl_display_dispatch_pending(). + * + * \note Calling this makes the current thread the main one. + * + * \sa wl_display_dispatch_pending(), wl_display_dispatch_queue() * * \memberof wl_display */ @@ -852,6 +868,44 @@ wl_display_dispatch(struct wl_display *display) return dispatch_queue(display, &display->queue, 1); } +/** Dispatch main queue events without reading from the display fd + * + * \param display The display context object + * \return The number of dispatched events or -1 on failure + * + * This function dispatches events on the main event queue. It does not + * attempt to read the display fd and simply returns zero if the main + * queue is empty, i.e., it doesn't block. + * + * This is necessary when a client's main loop wakes up on some fd other + * than the display fd (network socket, timer fd, etc) and calls \ref + * wl_display_dispatch_queue() from that callback. This may queue up + * events in the main queue while reading all data from the display fd. + * When the main thread returns to the main loop to block, the display fd + * no longer has data, causing a call to \em poll(2) (or similar + * functions) to block indefinitely, even though there are events ready + * to dispatch. + * + * To proper integrate the wayland display fd into a main loop, the + * client should always call \ref wl_display_dispatch_pending() and then + * \ref wl_display_flush() prior to going back to sleep. At that point, + * the fd typically doesn't have data so attempting I/O could block, but + * events queued up on the main queue should be dispatched. + * + * A real-world example is a main loop that wakes up on a timerfd (or a + * sound card fd becoming writable, for example in a video player), which + * then triggers GL rendering and eventually eglSwapBuffers(). + * eglSwapBuffers() may call wl_display_dispatch_queue() if it didn't + * receive the frame event for the previous frame, and as such queue + * events in the main queue. + * + * \note Calling this makes the current thread the main one. + * + * \sa wl_display_dispatch(), wl_display_dispatch_queue(), + * wl_display_flush() + * + * \memberof wl_display + */ WL_EXPORT int wl_display_dispatch_pending(struct wl_display *display) { diff --git a/src/wayland-client.h b/src/wayland-client.h index fb9c952..71fe450 100644 --- a/src/wayland-client.h +++ b/src/wayland-client.h @@ -66,18 +66,46 @@ struct wl_proxy; * representation to the display's write buffer. The data is sent to the * compositor when the client calls \ref wl_display_flush(). * - * Event handling is done in a thread-safe manner using event queues. The - * display has a \em main event queue where initially all the events are - * queued. The listeners for the events queued in it are called when the - * client calls \ref wl_display_dispatch(). - * - * The client can create additional event queues with \ref - * wl_display_create_queue() and assign different \ref wl_proxy objects to it. - * The events for a proxy are always queued only on its assign queue, that can - * be dispatched by a different thread with \ref wl_display_dispatch_queue(). - * - * All the \ref wl_display's functions are thread-safe. - * + * Incoming data is handled in two steps: queueing and dispatching. In the + * queue step, the data coming from the display fd is interpreted and + * added to a queue. On the dispatch step, the handler for the incoming + * event set by the client on the corresponding \ref wl_proxy is called. + * + * A \ref wl_display has at least one event queue, called the <em>main + * queue</em>. Clients can create additional event queues with \ref + * wl_display_create_queue() and assign \ref wl_proxy's to it. Events + * occurring in a particular proxy are always queued in its assigned queue. + * A client can ensure that a certain assumption, such as holding a lock + * or running from a given thread, is true when a proxy event handler is + * called by assigning that proxy to an event queue and making sure that + * this queue is only dispatched when the assumption holds. + * + * The main queue is dispatched by calling \ref wl_display_dispatch(). + * This will dispatch any events queued on the main queue and attempt + * to read from the display fd if its empty. Events read are then queued + * on the appropriate queues according to the proxy assignment. Calling + * that function makes the calling thread the <em>main thread</em>. + * + * A user created queue is dispatched with \ref wl_display_dispatch_queue(). + * If there are no events to dispatch this function will block. If this + * is called by the main thread, this will attempt to read data from the + * display fd and queue any events on the appropriate queues. If calling + * from any other thread, the function will block until the main thread + * queues an event on the queue being dispatched. + * + * A real world example of event queue usage is Mesa's implementation of + * eglSwapBuffers() for the Wayland platform. This function might need + * to block until a frame callback is received, but dispatching the main + * queue could cause an event handler on the client to start drawing + * again. This problem is solved using another event queue, so that only + * the events handled by the EGL code are dispatched during the block. + * + * This creates a problem where the main thread dispatches a non-main + * queue, reading all the data from the display fd. If the application -- 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/e1tavst-00045g...@vasks.debian.org