Commit Graph

1944 Commits

Author SHA1 Message Date
Yong Bakos
e5b12aa827 doc: Formalize file comment in wayland-client.h, wayland-server.h
Publican was generating a subtle error during a build:
Error: no ID for constraint linkend: Server-wayland-server-core_8h.

This was caused by doxygen applying the doc comment at the top of
wayland-server.h as the documentation for struct wl_object. As such, the
generated documentation for wl_object was also very incorrect.

Make the file doc comments in wayland-client.h and wayland-server.h real
doxygen file doc comments with the \file command, add a \brief, make the
inclusion warning a \warning, correct the language of the comment in
wayland-server.h, and remove one unnecessary line break.

This squelches the publican error, removes the bad wl_object documentation,
and makes the comment appear in the generated html documentation.

References: d74a9c079b

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-05-11 11:03:27 -07:00
Yong Bakos
c6d204fdbc protocol: Remove double line break
All vertical whitespace should manifest as a single blank line, never two.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2016-05-10 12:06:05 +08:00
Armin Krezović
721c91c54a scanner: Add version argument to wayland-scanner
This adds a command line argument to print wayland-scanner version.

It also makes wayland-scanner emit a comment with wayland library
version to every file it generates.

v2: separate variable definitions into their own lines and remove
    old style "version" argument

Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Tested-by: Yong Bakos <ybakos@humanoriented.com>
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-05-06 15:37:33 +03:00
Bryce Harrington
08bda63ac4 configure.ac: bump to version 1.10.91 for the alpha release 2016-05-03 17:56:22 -07:00
Auke Booij
7ccf35d432 protocol: add support for cross-interface enum attributes
The enum attribute, for which scanner support was introduced in
1771299, can be used to link message arguments to <enum>s. However,
some arguments refer to <enum>s in a different <interface>.

This adds scanner support for referring to an <enum> in a different
<interface> using dot notation. It also sets the attributes in this
style in the wayland XML protocol (wl_shm_pool::create_buffer::format
to wl_shm::format, and wl_surface::set_buffer_transform::transform to
wl_output::transform), and updates the documentation XSL so that this
new style is supported.

Changes since v2:
 - add object:: prefix for all enumerations in the documentation
 - fix whitespace in scanner.c
 - minor code fixup to return early and avoid casts in scanner.c

Changes since v1:
 - several implementation bugs fixed

Signed-off-by: Auke Booij <auke@tulcod.com>
Reviewed-by: Nils Christopher Brause <nilschrbrause@googlemail.com>
Reviewed-by: Bill Spitzak <spitzak@gmail.com>
[Pekka: rebased across cde251a124]
[Pekka: wrap lines and space fixes in scanner.c]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-05-03 14:54:11 +03:00
Yong Bakos
e21aeb5d12 protocol: Add summaries to event parameters
All event arg elements now have an appropriate summary attribute.
This was conducted mostly in response to the undocumented parameter
warnings generated during 'make check'.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-05-02 18:14:43 -07:00
Eric Engestrom
ee4e21c8a3 tests: fix typo
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-05-02 17:46:35 -07:00
Eric Engestrom
3c1aafd2a9 doc: fix typos
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-05-02 17:46:32 -07:00
Eric Engestrom
479945b4f1 util: fix typo
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-05-02 17:46:29 -07:00
Eric Engestrom
8f4db349aa server: fix typo
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-05-02 17:46:25 -07:00
Eric Engestrom
519177cff7 client: fix typo
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-05-02 17:46:22 -07:00
Yong Bakos
4db76023f8 protocol: Hyphenate compound adjective surface-local
Remove superfluous 'local' from 'buffer local'.
In addition, simplify the phrasing of local x/y coordinates in parameter
summaries.

See https://lists.freedesktop.org/archives/wayland-devel/2016-April/028249.html.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-04-29 16:38:05 -07:00
Yong Bakos
3178200f0d doc: Hyphenate compound adjectives window-local, surface-local
See https://lists.freedesktop.org/archives/wayland-devel/2016-April/028249.html.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-04-29 16:38:01 -07:00
Jonas Ådahl
6fe12f02e3 client: Fix wl_display_roundtrip_queue() race condition
Without this commit, wl_display_roundtrip_queue() is vulnerable to a
race condition, causing the callback to be dispatched on the wrong
queue.

The race condition happens if some non-main thread calls
wl_display_roundtrip_queue() with its thread local queue, and the main
thread reads and dispatches the callback event from the
wl_display_sync() call before the thread local queue is set.

The issue is fixed by using a proxy wrapper, making the initialization
of the callback proxy atomic, effectively making it no longer possible
for some other thread to dispatch the proxy before the correct thread
local queue is set.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
[Pekka: check display_wrapper]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-04-29 16:03:33 +03:00
Jonas Ådahl
69ec70fb0d tests/queue-test: Add tests for proxy wrappers
Test that doing wl_display.sync on a wrapped proxy with a special queue
works as expected.

Test that creating a wrapper on a destroyed but not freed proxy fails.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-04-29 15:58:23 +03:00
Jonas Ådahl
6d29c0da3c client: Introduce proxy wrappers
Using the libwayland-client client API with multiple threads with
thread local queues are prone to race conditions.

The problem is that one thread can read and queue events after another
thread creates a proxy but before it sets the queue.

This may result in the event to the proxy being silently dropped, or
potentially dispatched on the wrong thread had the creating thread set
the implementation before setting the queue.

This patch introduces API to solve this case by introducing "proxy
wrappers". In short, a proxy wrapper is a wl_proxy struct that will
never itself proxy any events, but may be used by the client to set a
queue, and use it instead of the original proxy when sending requests
that creates new proxies. When sending requests, the wrapper will
work in the same way as the normal proxy object, but the proxy created
by sending a request (for example wl_display.sync) will inherit to the
same proxy queue as the wrapper.

https://bugs.freedesktop.org/show_bug.cgi?id=91273

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2016-04-29 15:58:23 +03:00
Jonas Ådahl
9a652c44f7 client: Make proxy_destroy a static function
proxy_destroy() is just the implementation of the atomic part of
wl_proxy_destroy(), so lets make it static.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-04-28 15:01:31 +08:00
Marek Chalupa
85b80f5cf0 connection: remove redundant assignment
the code is something like:

  if (object == NULL && ...) {
      object = NULL;
      return;
  }

first, the object is already NULL, second, the assignment has no effect
since we return from the function right away

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2016-04-23 11:38:20 +08:00
Yong Bakos
70850643f3 protocol: Correct grammar and spelling
Fix grammar, spelling, tense, and other inconsistencies, based on
correctness, consistency, and precedence both here and influenced
by wayland-protocols.

- Standardize lower case for summary attribute values.
- Minor vertical whitespace removal consistency.
- Standarize references to coordinates, preferring 'surface local'
- Fix spelling, grammar, tense, and punctuation.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
2016-04-21 15:12:01 -07:00
Emil Velikov
2c8da32484 utils: move include directives before extern "C" wrapper
Analogous to last two commits.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2016-04-19 11:46:49 +03:00
Emil Velikov
897509bc6a server: move include directives before extern "C" wrapper
Analogous to previous commit but for the server(-core) header.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2016-04-19 11:42:54 +03:00
Emil Velikov
05f7aec1d5 scanner: move include directives before extern "C" wrapper
Adding extern "C" wrapper before includes (especially system ones) is
illadvised as the headers themselves can behave diffently in that case.

See the section "Including C Headers in C++ Code" in the following
http://www.oracle.com/technetwork/articles/servers-storage-dev/mixingcandcpluspluscode-305840.html

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2016-04-19 11:06:49 +03:00
Eric Engestrom
ae78dcb1ad wayland-client: fix spelling mistake
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
2016-04-05 16:03:17 -07:00
Eric Engestrom
e40a46ca21 protocol: fix spelling mistake
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
2016-04-05 16:03:11 -07:00
Yong Bakos
5259084288 scanner: Fix spacing of @param
Adds one space to the @param lines in generated .h files,
aligning the indentation with the rest of the comment block.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-04-01 18:01:50 +03:00
Yong Bakos
0715ee5cf9 ignore: Add *.dtd.embed
Although autogen.sh has a --disable-dtd-validation option, it is
on by default, so it seems convenient to add the generated symlink
to .gitignore.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-03-10 22:24:20 -08:00
Yong Bakos
5192d4c01a doc: Ignore html subdirectory.
Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-03-10 14:55:21 -08:00
Derek Foreman
1d6e885b1d shm: Log a warning if a shm buffer address is requested when it may be invalid
If wl_shm_buffer_get_data() is called on a shm pool that has an external
reference and a pending resize, then the buffer may be outside the pool's
current mapping.

Log a warning if this happens.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-03-08 16:55:02 -08:00
Derek Foreman
ed5f5030ca shm: Defer wl_shm_pool_resize if a pool has external references
If a compositor is rendering in one thread while dispatching wayland
events in another, a wl_shm_pool_resize() could change the memory
mappings it's rendering from and cause a crash.

Now we defer wl_shm_pool_resize() if the compositor has references on a
pool, and perform the actual resize when it drops those references.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-03-08 16:54:38 -08:00
Derek Foreman
442f443586 shm: Split pool reference counting into external and internal references
This is a preliminary step towards deferring shm resize operations until
after the compositor has released all external references on a pool.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-03-08 16:54:25 -08:00
Sergi Granell
5fe7e7ca78 server: Fix shm_create_pool size fail path fd leak
If the client passed a size <= 0 to shm_create_pool, it would
go to err_free, which wouldn't close the fd, and thus leave it opened.

We can also move the size check before the struct wl_shm_pool
malloc, so in case the client passes a wrong size, it won't
do an unnecessary malloc and then free.
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-03-08 16:37:20 -08:00
Bryce Harrington
ba2ee84113 doc: Note strong recommendation to use S-o-b in contributions
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-03-07 11:57:34 -08:00
Peter Hutterer
973a70dbb5 doc: link between client and server doc and to the wayland book
And insert "client" or "server" into the PROJECT_NAME to know which one we
have.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-03-07 11:55:48 -08:00
Peter Hutterer
2b5310a367 doc: generate doxygen html output from the scanner
This switches the scanner to generate doxygen-compatible tags for the
generated protocol headers, and hooks up the doxygen build to generate server
and client-side API documentation. That documentation is now in
Client/ and Server/, respectively.

GENERATE_HTML is on by default and must be disabled for the xml/man targets to
avoid messing up the new documentation. We disable all three three targets in
the doxyfile (xml and man default to NO anyway) to make it obvious that they
need to be set in the per-target instructions.

Each protocol is a separate doxygen @page, with each interface a @subpage.
Wayland only has one protocol, wayland-protocols will have these nested.
Each protocol page has a list of interfaces and the copyright and description
where available.
All interfaces are grouped by doxygen @defgroup and @ingroups and appear in
"Modules" in the generated output. Each interface subpage has the description
and a link to the actual API doc.
Function, struct and #defines are documented in doxygen style and associated
with the matching interface.

Note that pages and groups have fixed HTML file names and are directly
linkable/bookmark-able.

The @mainpage is a separate file that's included at build time. It doesn't
contain much other than links to where the interesting bits are. It's a static
file though that supports markdown, so we can extend it easily in the future.

For doxygen we need the new options EXTRACT_ALL and OPTIMIZE_OUTPUT_FOR_C so
it scans C code properly. EXTRACT_STATIC is needed since most of the protocol
hooks are static.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-03-07 11:55:43 -08:00
Pekka Paalanen
f8f3e54aa7 scanner: avoid executable stack
Before this patch:
$ scanelf -lpqe ./wayland-scanner
RWX --- ---  ./wayland-scanner

That indicates the stack is executable, which is a bad thing for
security. Wayland-scanner does not actually need an executable stack, it
is just an oversight from using an .S file in the sources.

Add a special incantation in dtddata.S to make it not cause the stack to
become executable.

Reported-by: Mart Raudsepp <leio@gentoo.org>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Tested-by: Mart Raudsepp <leio@gentoo.org>
2016-03-02 12:05:28 +02:00
Pekka Paalanen
4a41d26c4d build: fix ./configure --disable-dtd-validation
When configured with --disable-dtd-validation:

  CPPAS    src/dtddata.o
src/dtddata.S: Assembler messages:
src/dtddata.S:39: Error: file not found: src/wayland.dtd.embed
Makefile:1520: recipe for target 'src/dtddata.o' failed

This is because the variable name used does not match the implicit
variable name in autoconf.

Fix the variable name, making both --disable-dtd-validation and
--enable-dtd-validation to what they should.

Do not try to build dtddata.S if dtd-validation is disabled. It depends
on wayland.dtd.embed which is created by configure only if
dtd-validation is enabled.

If not building dtddata.S, also make sure the extern definitions in
scanner.c are compiled out.

Bugzilla: https://bugs.gentoo.org/show_bug.cgi?id=575212
Reported-by: leio@gentoo.org
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Tested-by: Bryce Harrington <bryce@osg.samsung.com>
2016-02-29 15:32:35 -08:00
Marek Chalupa
564623653a tests: add test for receiving an error on destroyed object
test if receiving an error on already destroyed object won't
do any harm

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Tested-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-02-26 11:56:10 +02:00
Jonas Ådahl
25fcb88a26 client: Don't segfault when receiving error on destroyed object
If an error is received on a destroyed object, we'd get NULL passed
to display_handle_error() instead of a pointer to a valid wl_proxy.

The logging is changed to report [unknown interface] and [unknown id]
instead of the actual interface name and id.

The wl_display_get_protocol_error() documentation is updated to handle
the situation. For when the proxy was NULL, the object id 0 and
interface NULL is written.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
[Pekka: changed the error message wording]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Jonas Ådahl <jadahl@gmail.com>
2016-02-26 11:55:17 +02:00
Bill Spitzak
cde251a124 doc: Use enum argument type to make links in protocol documentation
Reviewed-by: Auke Booij <auke@tulcod.com>
2016-02-19 19:26:37 -08:00
Derek Foreman
3a2553ff01 Revert "server: validate resource versions at creation time"
This reverts commit 88ff135ad4.

The parent interface version may be higher than this interface version,
and the child object should inherit that version.

This check is wrong.
2016-02-18 18:23:05 -06:00
Derek Foreman
8f2da5e82b Revert "build: build distcheck with --enable-fatal-warnings"
This reverts commit 8125919b0d.

This makes things far more annoying than intended, especially since
the list of default warnings isn't consistent from distro to distro.
2016-02-17 09:12:58 -06:00
Derek Foreman
8125919b0d build: build distcheck with --enable-fatal-warnings
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-02-16 22:13:56 -08:00
Derek Foreman
8216abc587 build: Add an --enable-fatal-warnings configure option
New --enable-fatal-warnings ./configure option that just adds -Werror
to GCC_CFLAGS

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-02-16 22:13:51 -08:00
Derek Foreman
88ff135ad4 server: validate resource versions at creation time
We shouldn't ever create a resource with version less than 1 or
greater than the interface version.

Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
2016-02-16 22:07:51 -08:00
Derek Foreman
6801d2d851 resource-test: Use wl_seat instead of wl_display for testing
We're creating resources with versions up to 4.  wl_display isn't version 4,
so this is technically verifying that we can do something we shouldn't.

wl_seat already has versions this high, so switch to that.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-02-16 21:51:21 -08:00
Bryce Harrington
22acc9cec9 configure.ac: bump to version 1.10.90 for open development
Master is open for new feature development again.
2016-02-16 17:15:26 -08:00
Bryce Harrington
0ff73b7666 configure.ac: bump to version 1.10.0 for the official release 2016-02-16 12:03:40 -08:00
Jonas Ådahl
bf34ac75d0 connection: Don't add uninitialized memory as 4 byte alignment padding
When we are adding padding bytes making our wl_buffer buffer content 4
byte aligned, we are just moving the pointer. Since the buffer is
allocated using plain malloc(), this means our padding bytes are
effectively uninitialized data, which could be anything previously
allocated in the server process. As we'll be sharing this buffer
content with arbitrary clients, we are effectively sharing private
memory with every client, and even though a well behaving client will
discard any such memory, a malicious client may not.

Therefor, to avoid any potential missuse of the uninitialized padding
memory shared between the server and client, initialize the buffer
content to 0, making the padding bytes always 0.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-02-11 13:48:23 -08:00
Bryce Harrington
1906a90aab configure.ac: bump to version 1.9.93 for the RC1 release 2016-02-09 13:26:21 -08:00
Sergi Granell
d33514379d cosmetic: add an space after if 2016-02-04 16:37:40 -08:00