platform/upstream/wayland.git
6 years agoclient: Restructure delete_id handler control flow
Derek Foreman [Thu, 28 Dec 2017 15:28:11 +0000 (15:28 +0000)]
client: Restructure delete_id handler control flow

This makes it easier for future patches in the series, which can
possibly return NULL for extant map entries.

[daniels: Extracted from Derek's bespoke-zombie patch as an intermediate
          step.]

Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agoclient: Add WL_MAP_ENTRY_ZOMBIE flag
Derek Foreman [Thu, 28 Dec 2017 15:22:25 +0000 (15:22 +0000)]
client: Add WL_MAP_ENTRY_ZOMBIE flag

Add a new map entry flag to indicate that the object received is valid,
but a zombie. Previously this relied on a fixed object pointer, but
future patches in this series will have map entries returning either
NULL, or a different structure type entirely, for zombie objects.

wl_object_is_zombie() now solely uses the new flag to determine whether
or not the object is a zombie.

[daniels: Extracted from Derek's bespoke-zombie patch as an intermediate
          step.]

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agoclient: Add wl_object_is_zombie() helper function
Derek Foreman [Thu, 28 Dec 2017 15:15:46 +0000 (15:15 +0000)]
client: Add wl_object_is_zombie() helper function

Add a helper function which determines whether or not an object is a
zombie.

[daniels: Extracted from Derek's bespoke-zombie patch as an intermediate
          step.]

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agoutil: Pass flags to map iterators
Derek Foreman [Wed, 6 Dec 2017 17:22:21 +0000 (11:22 -0600)]
util: Pass flags to map iterators

On the client side we're going to need to know if an object from the
map is a zombie before we attempt to dereference it, so we need to
pass this to the iterator.

Reviewed-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
6 years agoconnection: Make wl_closure_destroy() close fds of undispatched closures
Derek Foreman [Wed, 6 Dec 2017 17:22:20 +0000 (11:22 -0600)]
connection: Make wl_closure_destroy() close fds of undispatched closures

When we have a closure that can't be dispatched for some reason, and it
contains file descriptors, we must close those descriptors to prevent
leaking them.

Previous commits ensure that only FDs belonging to this invocation of
the closure, i.e. not FDs provided by the client for marshalling, nor
FDs which have already been dispatched to either client or server, will
be left in the closure by destroy time.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agoconnection: Clear fds we shouldn't close to -1
Derek Foreman [Wed, 6 Dec 2017 17:22:19 +0000 (11:22 -0600)]
connection: Clear fds we shouldn't close to -1

This initializes all the fd arguments in closures to -1 and clears
them back to -1 when they've been dispatched or serialized.

This means that any valid fd in a closure is currently libwayland's
responsibility to close in the case of an error.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agoconnection: Refactor out closure allocation
Derek Foreman [Wed, 6 Dec 2017 17:22:18 +0000 (11:22 -0600)]
connection: Refactor out closure allocation

Moves the common/similar bits into one place.

This has a minor functional change - count and message are now initialized
immediately, previously they'd only be set if (de)marshal was successful.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agoserver: Log closure before sending it
Derek Foreman [Wed, 6 Dec 2017 17:22:17 +0000 (11:22 -0600)]
server: Log closure before sending it

This seems foolishly cosmetic on the surface - and will reorder log
messages in certain failure cases.  "request could not be marshalled"
will now appear after logging the request that failed to marshal
instead of before.

The real point of this is that a follow up patch will make
wl_closure_send() set fds to -1 as it buffers them for send, so
they can be more easily cleaned up.

Doing that while leaving this order unchanged would result in
printing -1 for fds instead of their value.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agoconnection: Don't declare a local variable just to takes its size
Derek Foreman [Wed, 6 Dec 2017 17:22:16 +0000 (11:22 -0600)]
connection: Don't declare a local variable just to takes its size

We can sizeof the struct type instead of declaring a pointer and
taking the size of what it points to.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agodoc: start documenting Xwayland
Pekka Paalanen [Mon, 21 Nov 2016 10:09:46 +0000 (12:09 +0200)]
doc: start documenting Xwayland

This is a rough intro to what Xwayland is and does, with just one
implementation detail so far (Window identification).

I paid no attention to formatting details, those can be polished in
follow-ups. I just want the prose out.

I also just quickly whacked up the diagram, would be happy to see
someone replace it with a nicer one. I just didn't have time to learn
dot for now.

v2:
- typo fix
- rephrase "talking to hardware" as "driving the displays"
- mention circular dependency in intro
- add section to explain rootless and rootful modes
- remove paragraph about Xwayland protocol usage
- move TBD part to the end under a new section header

v3:
- use "advantage" and "disadvantage" instead of "pro" and "con"
- slight rewording on rootful mode and rootless mode paragraphs
- removed the paragraph about the lack of shell and special Wayland
  protocol extensions
- removed the commented out list of ideas to write

v4:
- typo fixes pointed out by Yong

Cc: Olivier Fourdan <ofourdan@redhat.com>
Cc: Jonas Ådahl <jadahl@gmail.com>
Cc: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
6 years agoclient: Allow absolute paths in WAYLAND_DISPLAY
Matt Hoosier [Mon, 27 Nov 2017 14:54:54 +0000 (08:54 -0600)]
client: Allow absolute paths in WAYLAND_DISPLAY

In order to support system compositor instances, it is necessary to
allow clients' wl_display_connect() to find the compositor's listening
socket somewhere outside of XDG_RUNTIME_DIR. For a full account, see
the discussion beginning here:

https://lists.freedesktop.org/archives/wayland-devel/2017-November/035664.html

This change adjusts the client-side connection logic so that, if
WAYLAND_DISPLAY is formatted as an absolute pathname, the socket
connection attempt is made to just $WAYLAND_DISPLAY rather than
usual user-private location $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY.

This change is based on Davide Bettio's submission of the same concept
at:

https://lists.freedesktop.org/archives/wayland-devel/2015-August/023838.html.

v4 changes:

* Improved internal comments and some boundary-condition
  error checks in test case.
* Refer to compositor as "Wayland server" rather than "Wayland
  display" in wl_display_connect() doxygen comments.
* Remove redundant descriptions of parameter-interpretation
  mechanics from wl_display_connect() manpage. Reworked things
  to make it clear that 'name' and $WAYLAND_DISLAY are each
  capable of encoding absolute server socket paths.
* Remove callout to reference implementation behavior in protocol
  documented. In its place there is now a simple statement that
  implementations can optionally support absolute socket paths.

v3 changes:

* Added test case.
* Clarified documentation to note that 'name' parameter to wl_display_connect()
  can also be an absolute path.

v2 changes:

* Added backward incompatibility note to wl_display_connect() manpage.
* Rephased wl_display_connect() manpage changes to precisely match actual
  changed behavior.
* Added mention of new absolute path behavior in wl_display_connect()
  doxygen comments.
* Mentioned new absolute path interpretation of WAYLAND_DISPLAY in
  protocol documentation.

Signed-off-by: Matt Hoosier <matt.hoosier@gmail.com>
Acked-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agoprotocol: make get_subsurface double-buffered
Pekka Paalanen [Mon, 9 May 2016 11:45:05 +0000 (14:45 +0300)]
protocol: make get_subsurface double-buffered

The existing specification was not explicitly clear on when
wl_subcompositor.get_subsurface request actually adds the sub-surface to
the parent in the compositor's scenegraph. The implicit assumption was
that this happens immediately, but it was not written anywhere.

If it happens immediately, the client doing things in a wrong order may
cause a glitch on screen. Particularly, if the wl_surface B that is
going to be a sub-surface for wl_surface A (the parent) already has a
buffer committed, and the parent surface is mapped, then get_subsurface
will (may?) cause wl_surface B to become mapped immediately. That leaves
no time to set up the sub-surface z-order or position before mapping,
hence there can be a visible glitch.

The way to avoid that, given that the parent surface is mapped, is to
not commit a buffer to wl_surface B until all the sub-surface setup is
done.

However, doing the sub-surface setup always requires a wl_surface.commit
on the parent surface unless the defaults happen to be correct.

To make setting up a subsurface slightly easier by removing one
possibility for a glitch, this patch amends the specification to require
a wl_surface.commit on the parent surface for get_subsurface to
complete. The sub-surface cannot become mapped before a parent commit.

This change may break existing clients that relied on the glitchy
sequence to not need a parent surface commit to map the sub-surface.
However, presumably all uses would at least issue a
wl_subsurface.set_position, which requires a parent surface commit to
apply. That would guarantee that there is a parent surface commit after
get_subsurface, and so reduces the chances of breaking anything.

In other cases, this change may simply remove a possibility for the
glitch.

This patch also adds a note about changing wl_surface.commit behaviour
on wl_subcompositor.get_subsurface. (That could be a separate patch.)

The behaviour of wl_subsurface.destroy remains as specified, even though
it is now slightly asymmetrical to get_subsurface. This is emphasized by
adding the word "immediately". The effects of destruction were already
explicitly documented, as is the way to achieve synchronized unmapping,
so changing destruction behaviour would likely be more disruptive, and
also open up more corner cases (what would happen between destroy and
unmapping?).

Bug: https://phabricator.freedesktop.org/T7358
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Martin Gräßlin <mgraesslin@kde.org>
6 years agoscanner: Add --strict flag
Jonas Ådahl [Wed, 11 Oct 2017 09:31:33 +0000 (17:31 +0800)]
scanner: Add --strict flag

Add a --strict flag for making wayland-scanner fail if the DTD
verification fails. This is useful for testing, so that a test case can
fail a scan when the protocol doesn't comply with the DTD.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
6 years agoconnection: Use wl_buffer_size() for all buffer size calculations
Derek Foreman [Thu, 13 Apr 2017 16:51:51 +0000 (11:51 -0500)]
connection: Use wl_buffer_size() for all buffer size calculations

There were two places where we did the same calculation manually.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agoclient: Simplify some logic in queue_event
Derek Foreman [Thu, 13 Apr 2017 16:51:47 +0000 (11:51 -0500)]
client: Simplify some logic in queue_event

Both the blocks in this if/else clause do the same thing, so combine
the comparisons into one.

No functional change.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agoconnection: close_fds() should only remove fds it closed from the buffer
Derek Foreman [Thu, 13 Apr 2017 16:51:43 +0000 (11:51 -0500)]
connection: close_fds() should only remove fds it closed from the buffer

All current callers close all fds, so this has gone unnoticed, but if
we close less than all fds with close_fds() we leak all the unclosed
ones and ruin further event demarshalling.

A future patch will close less than the full buffer's worth of fds,
so this is now noticed.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agoDo not create man page links with doxygen
Armin Krezović [Thu, 27 Jul 2017 12:08:37 +0000 (14:08 +0200)]
Do not create man page links with doxygen

There is a lot of files created with .so links to non-installed
files, making most of installed pages useless. The files
referenced in .so links are not suitable for installation nor
do they contain any useful information for them to be worth
fixing.

Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Acked-by: Daniel Stone <daniels@collabora.com>
6 years agoeventloop: clarify post_dispatch_check()
Christopher James Halse Rogers [Mon, 28 Aug 2017 08:03:38 +0000 (18:03 +1000)]
eventloop: clarify post_dispatch_check()

This *technically* changes the semantics of the return value of the source callbacks.
Previously you could return a negative number from a source callback and it would prevent
*other* source callbacks from triggering a subsequent recheck.

Doing that seems like such a bad idea it's not worth supporting.

v2: Log this case if it is hit, so we don't silently change behaviour.

Signed-off-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agoprotocol: Add deprecation note about wl_shell
Jonas Ådahl [Sat, 2 Dec 2017 02:57:45 +0000 (10:57 +0800)]
protocol: Add deprecation note about wl_shell

Now that xdg_shell is stable and much better defined than wl_shell we
can finally deprecate wl_shell and guide users towards xdg_shell
instead.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agocursor: add forward declaration for struct wl_buffer
Emil Velikov [Thu, 12 Oct 2017 12:39:17 +0000 (13:39 +0100)]
cursor: add forward declaration for struct wl_buffer

This makes the header self-contained, since the struct is considered
opaque from waylad-cursor POV.

As we're here move the wl_shm fwd. declaration alongside the others.
Making it easier to read and track.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
6 years agotests: Mark tests used so they don’t get removed at link time
Emmanuel Gil Peyrot [Fri, 14 Apr 2017 18:48:05 +0000 (19:48 +0100)]
tests: Mark tests used so they don’t get removed at link time

Without this attribute, these macros were making Weston’s tests fail to
build with LTO enabled.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94602
Signed-off-by: Markus Trippelsdorf <markus@trippelsdorf.de>
Signed-off-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>
Tested-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agotests: Add one more indentation level to some macros
Emmanuel Gil Peyrot [Fri, 14 Apr 2017 18:48:04 +0000 (19:48 +0100)]
tests: Add one more indentation level to some macros

This is a preparatory patch for the next one.

Signed-off-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agocursor: Fix heap overflows when parsing malicious files.
Tobias Stoeckmann [Tue, 28 Nov 2017 20:38:07 +0000 (21:38 +0100)]
cursor: Fix heap overflows when parsing malicious files.

It is possible to trigger heap overflows due to an integer overflow
while parsing images.

The integer overflow occurs because the chosen limit 0x10000 for
dimensions is too large for 32 bit systems, because each pixel takes
4 bytes. Properly chosen values allow an overflow which in turn will
lead to less allocated memory than needed for subsequent reads.

See also: https://cgit.freedesktop.org/xorg/lib/libXcursor/commit/?id=4794b5dd34688158fb51a2943032569d3780c4b8
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=103961

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
[Pekka: add link to the corresponding libXcursor commit]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agowayland-server: document WL_HIDE_DEPRECATED
Emil Velikov [Fri, 8 Sep 2017 10:49:53 +0000 (11:49 +0100)]
wayland-server: document WL_HIDE_DEPRECATED

Add some inline information, what the macro is used for, why it came to
be and what we shouldn't do if we consider further deprecation in the future
deprecation.

Cc: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agoprotocol: Suggest get_registry not be called frequently
Derek Foreman [Fri, 29 Sep 2017 18:46:28 +0000 (13:46 -0500)]
protocol: Suggest get_registry not be called frequently

I've heard some complaints that wl_display.get_registry "leaks"
server memory because wl_registry has no destructor.  While this isn't
strictly true - all those resources are freed when the client
disconnects - it's a bit of a gotcha for neophytes.

Since wl_registry's version is not requested in any way through
wl_display.get_registry, we can't add a destructor request without
breaking ABI.  So let's be a little more clear about the result
of getting too many wl_registry objects.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agobuild: remove wayland-version.h.in from EXTRA_DIST
Emil Velikov [Thu, 14 Sep 2017 17:32:18 +0000 (18:32 +0100)]
build: remove wayland-version.h.in from EXTRA_DIST

All the foo.in files are in the tarball, as long as their foo
counterparts are listed in AC_CONFIG_FILES

For example - *.pc.in, Makefile.in files, etc.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agoserver: document wl_event_loop and wl_event_source
Pekka Paalanen [Fri, 3 Mar 2017 15:50:22 +0000 (17:50 +0200)]
server: document wl_event_loop and wl_event_source

This documents all the public API related to wl_event_loop and
wl_event_source objects.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
[Pekka: fixed typos pointed by Yong]
[Pekka: fixed typos pointed by Christopher]
Reviewed-By: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
6 years agoPass input/output files as arguments to wayland-scanner
Jonas Ådahl [Mon, 3 Jul 2017 09:16:44 +0000 (17:16 +0800)]
Pass input/output files as arguments to wayland-scanner

When input/output files are passed as arguments to wayland-scanner,
instead of using stdin/stdout, warning and error messages will contain
the file name, together with line number, of the warning/error. Doing
this helps IDEs jump to the correct line.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
[Pekka: dropped the src/scanner.mk hunk, file deleted]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agoscanner: use tabs for indentation.
Emil Velikov [Wed, 26 Jul 2017 13:56:18 +0000 (14:56 +0100)]
scanner: use tabs for indentation.

File uses tabs, barring the few instances fixed with this patch.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agoscanner: remove unused scanner.mk
Emil Velikov [Wed, 26 Jul 2017 13:56:17 +0000 (14:56 +0100)]
scanner: remove unused scanner.mk

Nothing in the existing codebase references the file.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agoReopen master for regular development
Bryce Harrington [Tue, 8 Aug 2017 19:03:27 +0000 (12:03 -0700)]
Reopen master for regular development

A 1.14 branch has been established for stable release work.

6 years agoconfigure.ac: bump to version 1.14.0 for the official release 1.14.0 upstream/1.14.0
Bryce Harrington [Tue, 8 Aug 2017 18:20:35 +0000 (11:20 -0700)]
configure.ac: bump to version 1.14.0 for the official release

6 years agoconfigure.ac: bump to version 1.13.93 for the RC1 release 1.13.93
Bryce Harrington [Tue, 1 Aug 2017 18:12:43 +0000 (11:12 -0700)]
configure.ac: bump to version 1.13.93 for the RC1 release

7 years agoSwitch graphviz files to use HTML-style labels
Owen W. Taylor [Fri, 2 Jun 2017 02:48:29 +0000 (22:48 -0400)]
Switch graphviz files to use HTML-style labels

With recent versions of graphviz, generation of the diagrams in the documentation
fails with:

 /usr/bin/dot -Tpng -oxml/x-architecture.png dot/x-architecture.gv
 Warning: flat edge between adjacent nodes one of which has a record shape - replace records with HTML-like labels
   Edge xserver -> comp
 Error: getsplinepoints: no spline points available for edge (xserver,comp)
 Error: lost xserver comp edge
 Error: lost xserver comp edge
 Error: lost comp xserver edge
 Error: lost comp xserver edge

http://www.graphviz.org/content/i-havent-been-able-render-these-files-graphviz-226 indicates
that the error message basically means that the authors of graphviz consider record-style
labels to be deprecated and are no longer fixing errors with them. This patch changes
the labels to be in the HTML style, which seems to require duplicating style between all
the nodes, but it's not like these files are often edited.

The result is not exactly the same but is quite similar.

Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
Tested-by: Armin Krezović <krezovic.armin@gmail.com>
7 years agoconfigure.ac: bump to version 1.13.92 for the beta release 1.13.92
Bryce Harrington [Tue, 25 Jul 2017 23:25:01 +0000 (16:25 -0700)]
configure.ac: bump to version 1.13.92 for the beta release

7 years agoconfigure.ac: bump to version 1.13.91 for the alpha release 1.13.91
Bryce Harrington [Wed, 12 Jul 2017 02:07:55 +0000 (19:07 -0700)]
configure.ac: bump to version 1.13.91 for the alpha release

7 years agodocs: Reference Contributor Covenant
Daniel Stone [Thu, 6 Apr 2017 14:09:37 +0000 (15:09 +0100)]
docs: Reference Contributor Covenant

All fd.o projects are now covered by the Contributor Covenant. Include a
reference to this in the Contributing doc, making it clear that we are
all expected to behave like human beings.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Jonas Ådahl <jadahl@gmail.com>
7 years agoscanner: Reword fallthrough comment to quiet GCC
Daniel Stone [Fri, 17 Mar 2017 17:35:38 +0000 (17:35 +0000)]
scanner: Reword fallthrough comment to quiet GCC

GCC 7 now requires an explicit comment noting that case statements
without a break fall through. We already had one of those in the
scanner, but GCC wasn't smart enough to pick it up.

Quiet the warning by making the comment less elaborate.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
7 years agoconnection-test: fix assert
Eric Engestrom [Thu, 16 Mar 2017 11:46:06 +0000 (11:46 +0000)]
connection-test: fix assert

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agowayland-util: do not export the wl_map_* API
Emil Velikov [Tue, 21 Feb 2017 16:14:26 +0000 (16:14 +0000)]
wayland-util: do not export the wl_map_* API

Used only internally and explicitly marked as such with commit
cf04b0a18f2 ("Move private definitions and prototypes to new
zwayland-private.h")

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agowayland-server: Remove unused members from struct wl_client
Sergi Granell [Sun, 26 Feb 2017 21:55:53 +0000 (22:55 +0100)]
wayland-server: Remove unused members from struct wl_client

Those struct members are no longer used so we can remove them.

Signed-off-by: Sergi Granell <xerpi.g.12@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agotests: Fix "new ID" type handling in argument_from_va_list test
Carlos Garnacho [Thu, 23 Feb 2017 12:47:41 +0000 (13:47 +0100)]
tests: Fix "new ID" type handling in argument_from_va_list test

New IDs are internally dealt with as objects, however this test
expected to deal with 'n' as the uint32_t type that's just seen
through the wire. We should give it an object instead, and
expect an object from it.

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

Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Tested-by: Kalev Lember <kalevlember@gmail.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
7 years agoconfigure.ac: bump version to 1.13.90 for open development
Bryce Harrington [Tue, 21 Feb 2017 22:25:03 +0000 (14:25 -0800)]
configure.ac: bump version to 1.13.90 for open development

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
7 years agoconfigure.ac: bump to version 1.13.0 for the official release 1.13.0 upstream/1.13.0
Bryce Harrington [Tue, 21 Feb 2017 21:27:16 +0000 (13:27 -0800)]
configure.ac: bump to version 1.13.0 for the official release

7 years agoconfigure.ac: bump to version 1.12.93 for the RC1 release 1.12.93
Bryce Harrington [Tue, 14 Feb 2017 20:56:55 +0000 (12:56 -0800)]
configure.ac: bump to version 1.12.93 for the RC1 release

7 years agoconfigure.ac: bump to version 1.12.92 for the beta release 1.12.92
Bryce Harrington [Tue, 7 Feb 2017 23:14:56 +0000 (15:14 -0800)]
configure.ac: bump to version 1.12.92 for the beta release

7 years agowayland-server: hide wl_priv_signal from doxygen
Pekka Paalanen [Wed, 25 Jan 2017 12:24:44 +0000 (14:24 +0200)]
wayland-server: hide wl_priv_signal from doxygen

Fix this set of warnings appearing three times during a build:

/home/pq/git/wayland/src/wayland-server.c:1868: warning: class
`wl_priv_signal' for related function `wl_priv_signal_init' is not
documented.
/home/pq/git/wayland/src/wayland-server.c:1884: warning: class
`wl_priv_signal' for related function `wl_priv_signal_add' is not
documented.
/home/pq/git/wayland/src/wayland-server.c:1899: warning: class
`wl_priv_signal' for related function `wl_priv_signal_get' is not
documented.

Our Wayland docbook don't include private things, so make sure these do
not end up there. This removes the mention of wl_priv_signal_emit from
the Server API docbook. I have no idea why the other functions did not
appear there.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
7 years agotests: Test wl_argument_from_va_list
Yong Bakos [Wed, 23 Nov 2016 15:38:01 +0000 (07:38 -0800)]
tests: Test wl_argument_from_va_list

connection-test.c did not cover wl_argument_from_va_list, so add one
test that specifically tests this method.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agodtddata: Use standard permission notice
Yong Bakos [Mon, 23 Jan 2017 14:16:30 +0000 (06:16 -0800)]
dtddata: Use standard permission notice

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agowayland-server: log an error for events with wrong client objects
Derek Foreman [Tue, 24 Jan 2017 18:07:21 +0000 (12:07 -0600)]
wayland-server: log an error for events with wrong client objects

Check that all the objects in an event belong to the same client as
the resource posting it.  This prevents a compositor from accidentally
mixing client objects and posting an event that causes a client to
abort with a cryptic message.

Instead the client will now be disconnected as it is when the compositor
tries to send a null for a non-nullable object, and a log message
will be printed by the compositor.

Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoserver: Disallow sending events to clients after posting an error
Derek Foreman [Tue, 24 Jan 2017 18:07:20 +0000 (12:07 -0600)]
server: Disallow sending events to clients after posting an error

Until now, we haven't done anything to prevent sending additional
events to clients after posting an error.

Acked-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoserver: Refactor array send functions
Derek Foreman [Tue, 24 Jan 2017 18:07:19 +0000 (12:07 -0600)]
server: Refactor array send functions

These have grown a little in size but are almost identical, factor
out the common code.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoserver: use the new wl_priv_signal for wl_resource
Giulio Camuffo [Tue, 24 Jan 2017 14:34:30 +0000 (16:34 +0200)]
server: use the new wl_priv_signal for wl_resource

The old wl_signal is kept for backwards compatibility, as that is also
present in the deprecated public wl_resource struct, and that must be
kept working.

Signed-off-by: Giulio Camuffo <giulio.camuffo@kdab.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoserver: use the new wl_priv_signal in wl_client
Giulio Camuffo [Tue, 24 Jan 2017 14:34:29 +0000 (16:34 +0200)]
server: use the new wl_priv_signal in wl_client

Signed-off-by: Giulio Camuffo <giulio.camuffo@kdab.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoserver: add a safer signal type and port wl_display to it
Giulio Camuffo [Tue, 24 Jan 2017 14:34:28 +0000 (16:34 +0200)]
server: add a safer signal type and port wl_display to it

wl_list_for_each_safe, which is used by wl_signal_emit is not really
safe. If a signal has two listeners, and the first one removes and
re-inits the second one, it would enter an infinite loop, which was hit
in weston on resource destruction, which emits a signal.
This commit adds a new version of wl_signal, called wl_priv_signal,
which is private in wayland-server.c and which does not have this problem.
The old wl_signal cannot be improved without breaking backwards compatibility.

Signed-off-by: Giulio Camuffo <giulio.camuffo@kdab.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agotests: Add a test for global filter
Olivier Fourdan [Tue, 24 Jan 2017 15:54:04 +0000 (16:54 +0100)]
tests: Add a test for global filter

Test if the global filter is effectively filtering out the global when
the filter returns false.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
7 years agoconfigure.ac: bump to version 1.12.91 for the alpha release 1.12.91
Bryce Harrington [Wed, 25 Jan 2017 02:13:26 +0000 (18:13 -0800)]
configure.ac: bump to version 1.12.91 for the alpha release

7 years agowayland-server: Add functions to wl_global
Olivier Fourdan [Tue, 18 Oct 2016 14:23:40 +0000 (16:23 +0200)]
wayland-server: Add functions to wl_global

When using a wl_global, a server may need to retrieve the associated
wl_interface and user data.

Add a couple of convenient functions wl_global_get_interface() and
wl_global_get_user_data() for this purpose.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agowayland-server: Add API to control globals visibility
Olivier Fourdan [Tue, 18 Oct 2016 14:23:39 +0000 (16:23 +0200)]
wayland-server: Add API to control globals visibility

Add a new API to let compositor decide whether or not a wl_global
should be advertised to the clients via wl_registry_bind() or
display_get_registry()

By using its own filter, the compositor can decide which wl_global would
be listed to clients.

Compositors can use this mechanism to hide their own private interfaces
that regular clients should not use.

- Hiding interfaces that expose compositor implementation details
  makes it harder for clients to identify the compositor. Therefore
  clients are a little less likely to develop compositor-specific
  workarounds instead of reporting problems upstream.

- Hiding can be used to diminish the problems from missing namespacing:
  if two compositors happen to use the same named global with
  different interfaces for their special-purpose clients, the client
  expecting the different interface would probably never see it
  advertised.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoprotocol: add axis_source.wheel_tilt
Peter Hutterer [Mon, 23 Jan 2017 23:56:39 +0000 (09:56 +1000)]
protocol: add axis_source.wheel_tilt

Unlike a wheel rotation, a wheel tilt is a discrete-only axis. Wheel rotations
are mapped to degrees in libinput but that that does not apply to wheel tilt
axes where there is no physical equivalent.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
7 years agoscanner: support "since" attribute for enum entries
Peter Hutterer [Mon, 23 Jan 2017 23:56:38 +0000 (09:56 +1000)]
scanner: support "since" attribute for enum entries

This was already in the DTD but not supported by the scanner.

The check for ever-increasing "since" tags is not strictly required for enum
entries as we control the binary value. But it keeps the xml file in
good order, preventing things like:

      <entry name="first" value="…" />
      <entry name="second" value="…" since="3"/>
      <entry name="third" value="…" since="2"/>
      <entry name="fourth" value="…" since="3"/>

If this is undesirable in the future the check can be removed without
side-effects.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoscanner: add helper function to convert "since" to a version
Peter Hutterer [Mon, 23 Jan 2017 23:56:37 +0000 (09:56 +1000)]
scanner: add helper function to convert "since" to a version

Same code we already had, just moved into a helper function

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agotests: sync example.xml with wayland.xml
Peter Hutterer [Mon, 23 Jan 2017 23:56:36 +0000 (09:56 +1000)]
tests: sync example.xml with wayland.xml

These are the protocol.xml changes from:
66a26aeb2a: protocol: Remove inconsistent line breaks
a26ed0949e: protocol: indentation fixes
6a18a87727: protocol: Extend wl_touch with touchpoint shape and orientation

and a few other, smaller ones.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Tested-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoutil: Document wl_array and wl_list members
Yong Bakos [Tue, 6 Dec 2016 15:21:56 +0000 (07:21 -0800)]
util: Document wl_array and wl_list members

Despite their clear names, wl_array and wl_list members are undocumented,
resulting in doxygen warnings[1] when building documentation.

Document these members, suppressing the warnings.

[1] Warnings are visible when EXTRACT_ALL = NO.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agodoc: Remove wayland-util.c from file list
Yong Bakos [Fri, 25 Nov 2016 18:48:36 +0000 (10:48 -0800)]
doc: Remove wayland-util.c from file list

Documentation generation via doxygen includes wayland-util.c in its file
list. Although functions are documented in wayland-util.h, doxygen is
not automatically using the same documentation for functions in
wayland-util.c. In addition, everything listed in the doxygen page for
wayland-util.c is documented in the page for wayland-util.h and the
pages for corresponding structures. As such, the doxygen page for
wayland-util.c has no value, and is redundant.

Remove the doxygen page for wayland-util.c.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agodoc: Remove display of WL_PRINTF attribute
Yong Bakos [Tue, 22 Nov 2016 16:13:43 +0000 (08:13 -0800)]
doc: Remove display of WL_PRINTF attribute

Doxygen truncates a WL_PRINTF function attribute, and there does not
seem to be any workaround[1]. When using the attribute like this:

typedef void (*wl_log_func_t)(const char *, va_list) WL_PRINTF(1, 0);

Doxygen generates something that looks like this:

typedef void (*wl_log_func_t)(const char *, va_list) WL_PRINTF(1,

Configure doxygen to consider WL_PRINTF(x,y) as predefined, so it does
not display the attribute at all in the generated documentation.

[1] https://bugzilla.gnome.org/show_bug.cgi?id=774741

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotests: add scanner tests
Pekka Paalanen [Fri, 30 Sep 2016 12:12:47 +0000 (15:12 +0300)]
tests: add scanner tests

Add tests that ensure that wayland-scanner output for a given input does
not change unexpectedly. This makes it very easy to review
wayland-scanner patches.

Before, when patches were proposed for wayland-scanner, I had to
build wayland without the patches, save the generated files into a
temporary directory, apply the patches, build again, and diff the old
vs. new generated file.

No more. Now whenever someone makes intentional changes to
wayland-scanner's output, he will also have to patch the example output
files to match. That means that reviewers see the diff of the generated
files straight from the patch itself. Verifying the diff is true is as
easy as 'make check'.

The tests use separate example XML files instead of wayland.xml
directly, so that wayland.xml can be updated without fixing scanner
tests, avoiding the churn.

example.xml starts as a copy of wayland.xml. If wayland.xml starts using
new wayland-scanner features, they should be copied into example.xml
again to be covered by the tests.

This patch relies on the previous patch to actually add all the data
files for input and reference output.

The scanner output is fed through sed to remove parts that are allowed
to vary: the scanner version string.

v2: no need for scanner-test.sh to depend on the test data

Task: https://phabricator.freedesktop.org/T3313
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk> (v1)
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Tested-by: Yong Bakos <ybakos@humanoriented.com>
7 years agotests: add data files for future wayland-scanner test
Pekka Paalanen [Tue, 4 Oct 2016 14:26:40 +0000 (17:26 +0300)]
tests: add data files for future wayland-scanner test

This patch adds the input and reference output data files for the
wayland-scanner tests to be added by the following patch.

The data files are split into their own patch because they are extremely
uninteresting to review:
- example.xml is just a copy wayland.xml from 1.12.0
- small.xml is a tiny dummy definition used for testing scanner
  variations without causing lots of big output files
- the other files are wayland-scanner products from the xml files

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
v2: update output due to 2c6350beb92816eb9213c4944d197485e788ef6d
Acked-by: Yong Bakos <ybakos@humanoriented.com>
7 years agoutil: Clarify documentation of wl_dispatcher_func_t
Yong Bakos [Mon, 21 Nov 2016 13:44:44 +0000 (05:44 -0800)]
util: Clarify documentation of wl_dispatcher_func_t

Adjust the brief, clarify the behavior and arguments, correct a grammar
error, document the parameters, and document the return type.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoprotocol: indentation fixes
Peter Hutterer [Mon, 21 Nov 2016 11:43:22 +0000 (11:43 +0000)]
protocol: indentation fixes

8 spaces changed to one tab

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Bryce Harrington <bryce@osg.samsung.com>
7 years agowayland-client: Require base 10 for WAYLAND_SOCKET, explicitly
Bryce Harrington [Fri, 8 Jul 2016 23:42:30 +0000 (16:42 -0700)]
wayland-client: Require base 10 for WAYLAND_SOCKET, explicitly

The third arg to strtol() specifies the base to assume for the number.
When 0 is passed, as is currently done in wayland-client.c, hexadecimal
and octal numbers are permitted and automatically detected and
converted.

I can find no indication that we would ever expect use of hexadecimal or
octal for socket fd's.  So be explicit about what base we're assuming
here and avoid any potential surprises.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoutil: Document wl_log_func_t
Yong Bakos [Sun, 20 Nov 2016 16:59:15 +0000 (08:59 -0800)]
util: Document wl_log_func_t

Add a doxygen comment for wl_log_func_t.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agobuildsystem: adjust uninstalled -client/server pkg-config infra
Reynaldo H. Verdejo Pinochet [Fri, 26 Aug 2016 21:04:02 +0000 (16:04 -0500)]
buildsystem: adjust uninstalled -client/server pkg-config infra

Add missing protocol dir to uninstalled include path.

Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Acked-by: Bryce Harrington <bryce@osg.samsung.com>
Signed-off-by: Daniel Stone <daniels@collabora.com>
7 years agobuild: Fix scanner path in uninstalled pkg-config file
Derek Foreman [Fri, 26 Aug 2016 21:04:03 +0000 (16:04 -0500)]
build: Fix scanner path in uninstalled pkg-config file

this was generating a pkg-config file that said wayland-scanner was
wayland/src/wayland-scanner when it's actually wayland/wayland-scanner

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Acked-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoutil: Improve documentation of wl_iterator_result
Yong Bakos [Sun, 20 Nov 2016 17:26:08 +0000 (09:26 -0800)]
util: Improve documentation of wl_iterator_result

Use declarative voice, remove the unnecessary doxygen \enum tag, and add
two see-also's. This keeps the output the same but makes the comment
voice consistent, a little more readable, and refers to documented
functions that use this enum type.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoprotocol: spell out that we're using linux/input-event-codes.h button codes
Peter Hutterer [Fri, 18 Nov 2016 02:35:27 +0000 (12:35 +1000)]
protocol: spell out that we're using linux/input-event-codes.h button codes

Because we already rely on it in the callers anyway. This is a retrofit, which
is not ideal but I'm not sure any compositor out there uses anything else.
Might as well define it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agocursor: Remove "weston" from anonymous shm filenames
Derek Foreman [Wed, 27 Jul 2016 16:06:24 +0000 (11:06 -0500)]
cursor: Remove "weston" from anonymous shm filenames

This mildly confused me during some debugging, so I guess it wouldn't
hurt to make the filename more indicative of where it was actually
created.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoutil: Improve documentation of wl_argument
Yong Bakos [Sat, 12 Nov 2016 18:11:21 +0000 (10:11 -0800)]
util: Improve documentation of wl_argument

Standardize the doxygen comment format, add clarity to the writing, decouple
the description from specifics of usage, add see-also's, and massage the union
member type comments.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agotests: Add nullable check to wl_message_count_arrays
Yong Bakos [Fri, 11 Nov 2016 15:08:09 +0000 (07:08 -0800)]
tests: Add nullable check to wl_message_count_arrays

Array argument symbols in a wl_message may be nullable, but the test for
wl_message_count_arrays did not test this. Add one more wl_message with
nullable array arguments.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agotests: Test wl_interface_equal
Yong Bakos [Tue, 8 Nov 2016 15:56:30 +0000 (07:56 -0800)]
tests: Test wl_interface_equal

The test suite did not cover wl_interface_equal, so add one test that
specifically tests this method. Add the new test to Makefile.am.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
[Pekka: add assert(&wl_registry_interface != &copy);]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoutil: Document wl_interface
Yong Bakos [Mon, 7 Nov 2016 02:25:37 +0000 (18:25 -0800)]
util: Document wl_interface

Add doxygen comments for wl_interface.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoMakefile: build also test programs during a normal build
Pekka Paalanen [Wed, 16 Nov 2016 11:42:21 +0000 (13:42 +0200)]
Makefile: build also test programs during a normal build

Put also test programs into noinst_PROGRAMS so that they get always
built. In check_PROGRAMS they are built for 'make check' but not for
'make'.

This makes it harder to accidentally break the test programs.

v2: also change check_LTLIBRARIES to noinst_LTLIBRARIES

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agodoc: Fix a typo in the client documentation
Moritz Kiefer [Sun, 6 Nov 2016 17:35:19 +0000 (18:35 +0100)]
doc: Fix a typo in the client documentation

Signed-off-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
7 years agoprotocol: Extend wl_touch with touchpoint shape and orientation
Dennis Kempin [Fri, 11 Nov 2016 19:40:55 +0000 (11:40 -0800)]
protocol: Extend wl_touch with touchpoint shape and orientation

This CL updates the wl_touch interface with a shape and
orientation event.
The shape/orientation of a touch point is not relevant for most UI
applications, but allows a better experience in some cases
such as drawing apps.

The events are used by the compositor to inform the client
about changes in the shape and orientation of a touchpoint, which is
approximated by an ellipse and it's angle to the y-axis.

The event is optional and only sent when compositor and the
touch device support this type of information. The client is
responsible for making a reasonable assumption about the
touch shape if no shape is reported.

Signed-off-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoutil: Document wl_fixed_t
Yong Bakos [Fri, 11 Nov 2016 15:55:38 +0000 (07:55 -0800)]
util: Document wl_fixed_t

Add doxygen comments for wl_fixed_t and its methods.

Although wl_fixed_t can be thought of as an opaque struct, it is a typedef. As
such, doxygen does not provide an elegant means of documenting it as both a
'class' with members and as a typedef. In other words, documenting it as a class
gives us a nice doxygen page for wl_fixed_t and its related methods, but this
leaves the typedef documentation blank in the documentation for wayland-util,
and does not provide a link to the documentation for wl_fixed_t. Hence, this
patch does not treat wl_fixed_t as a class/struct, resulting in the typedef
being documented and keeping the functions listed in wayland-util, rather than a
separate unlinked page devoted to just wl_fixed_t.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoutil: Remove stray space from function signature
Yong Bakos [Tue, 8 Nov 2016 16:02:12 +0000 (08:02 -0800)]
util: Remove stray space from function signature

wl_fixed_to_double had a stray space before the parameter list.
Remove this space.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoscanner: Fixed doxygen group name for _add_listener
Bill Spitzak [Tue, 17 May 2016 06:18:06 +0000 (23:18 -0700)]
scanner: Fixed doxygen group name for _add_listener

Signed-off-by: Bill Spitzak <spitzak@gmail.com>
Acked-by: Yong Bakos <ybakos@humanoriented.com>
7 years agoMakefile: do not put TESTS into check_PROGRAMS
Pekka Paalanen [Wed, 9 Nov 2016 15:16:51 +0000 (17:16 +0200)]
Makefile: do not put TESTS into check_PROGRAMS

If you assign TESTS into check_PROGRAMS, you cannot add a test that is
not built from source files.

Instead, use a temporary variable built_test_programs to hold the names
that are both programs built from source files and tests to execute.

This change is required by the following patch adding wayland-scanner
test script.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotests: Test wl_message_count_arrays
Yong Bakos [Thu, 3 Nov 2016 20:42:54 +0000 (13:42 -0700)]
tests: Test wl_message_count_arrays

message-test.c did not cover wl_message_count_arrays, so add one test that
specifically tests this method. Note that this exposes wl_message_count_arrays
in a private header (wayland-private.h), and removes the `static` modifier of
the implementation.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoprotocol: Remove inconsistent line breaks
Yong Bakos [Mon, 31 Oct 2016 13:46:18 +0000 (06:46 -0700)]
protocol: Remove inconsistent line breaks

Enum entries and message arguments are sometimes preceded by a blank line, but
often aren't.

Standardize the format of the protocol specification by removing blank lines
preceding a list of message arguments and enum entries.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoutil: Document wl_message
Yong Bakos [Thu, 27 Oct 2016 15:55:01 +0000 (08:55 -0700)]
util: Document wl_message

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoscanner: Remove return doxygen annotation
Yong Bakos [Wed, 7 Sep 2016 13:25:27 +0000 (06:25 -0700)]
scanner: Remove return doxygen annotation

Replace \returns with just Returns, as this is not a doxygen comment block.
(Avoids differing with the existing convention of \return for return values.)

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agotests: Use unique XDG_RUNTIME_DIR
Daniel Stone [Thu, 10 Nov 2016 11:14:03 +0000 (11:14 +0000)]
tests: Use unique XDG_RUNTIME_DIR

Rather than using a hardcoded 'wayland-tests' directory under
the existing XDG_RUNTIME_DIR to use as the new runtime dir, use mkdtemp
to guarantee uniqueness. This fixes make -jN check, as well as just
happening to run 'make check' twice from the same session.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reported-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoprotocol: Use singleton global consistently
Yong Bakos [Sun, 2 Oct 2016 16:09:59 +0000 (09:09 -0700)]
protocol: Use singleton global consistently

The protocol describes wl_shm as a "global singleton" rather than
"singleton global," which is the order used throughout other protocol
object descriptions.

Re-order the terms for consistency.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoprotocol: Describe wl_registry as singleton
Yong Bakos [Fri, 30 Sep 2016 06:59:58 +0000 (23:59 -0700)]
protocol: Describe wl_registry as singleton

Other singleton objects in the protocol are described as such.

Add a singleton adjective to the wl_registry description, making it
similar to other descriptions.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoshm: Make shm_pool_interface static const
Yong Bakos [Fri, 12 Aug 2016 19:04:41 +0000 (12:04 -0700)]
shm: Make shm_pool_interface static const

Add static const modifiers to the shm_pool_interface definition,
making it consistent with the other wl_*_interface definitions and
mundanely safer.

Note that this does not affect the ABI, according to abi-dumper and
abi-compliance-checker[1]; and weston and its shm-backed clients still
run as expected.

[1]: http://lvc.github.io/abi-compliance-checker/

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Tested-by: Yong Bakos <ybakos@humanoriented.com>
Acked-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoutil: Document GCC attributes
Yong Bakos [Sat, 17 Sep 2016 22:04:32 +0000 (15:04 -0700)]
util: Document GCC attributes

Add doxygen comment blocks so these annotations are documented in the html
documentation.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoarray-test: Include wayland-util.h and simplify init test
Yong Bakos [Tue, 27 Sep 2016 18:03:50 +0000 (13:03 -0500)]
array-test: Include wayland-util.h and simplify init test

Include wayland-util.h in addition to wayland-private.h, to be more explicit
about where wl_array is defined.

Remove the useless repeated testing of wl_array_init, because if it fails once
out of thousands of iterations we're all doomed anyway.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
[Pekka: add the memset]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agotests: Test wl_array_release
Yong Bakos [Tue, 27 Sep 2016 18:03:49 +0000 (13:03 -0500)]
tests: Test wl_array_release

array-test.c did not cover wl_array_release, so add one test that specifically
tests this method.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
[Pekka: do not overwrite array.data]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agowl_array: Set data to invalid address after free
Yong Bakos [Tue, 27 Sep 2016 18:03:48 +0000 (13:03 -0500)]
wl_array: Set data to invalid address after free

Explicitly set the data member to an invalid memory address during
wl_array_release, such that re-using a freed wl_array without re-initializing
causes a crash. In addition, this pointer assignment makes wl_array_release
testable.

Define a constant for the invalid memory address, and add documentation about
this behavior, starting at libwayland version 1.13.

See https://lists.freedesktop.org/archives/wayland-devel/2016-September/031116.html

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
[Pekka: remove the doc about crashing]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>