Commit Graph

1801 Commits

Author SHA1 Message Date
Pekka Paalanen
3dc7c2c846 Makefile: use automake rule for compiling .S
Automake seems to have its own rules for compiling an .o from an .S.
Essentially it does the same as our hand-crafted rule, but adds some
things like dependency file generation.

Remove our hand-crafted rule to use the automake rule, it is less
surprising.

http://www.gnu.org/software/automake/manual/html_node/Assembly-Support.html

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Tested-by: Víctor Jáquez <vjaquez@igalia.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-11-19 09:47:24 +02:00
Peter Hutterer
f66e2d53dd Validate the protocol xml during scanning
Embed the wayland.dtd protocol data into the scanner binary so we can validate
external protocol files without requiring makefile changes. Hat-tip to Pekka
Paalanen for the embedding trick.
The embedding trick doesn't work well if the to-be-embedded file is in a
different location than the source file, so copy/link it during configure and
then build it in from the local directory.

The current expat parser is not a validating parser, moving scanner.c to
another parser has the risk of breaking compatibility. This patch adds libxml2
as extra (optional) dependency, but that also requires parsing the input
twice.

If the protocol fails validation a warning is printed but no error is returned
otherwise.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-11-17 14:36:21 +02:00
Peter Hutterer
e65aed4616 protocol: add the new bitfields to the dtd
See 851614fa78

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Auke Booij <auke@tulcod.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-11-17 14:36:21 +02:00
Peter Hutterer
0e86192114 protocol: allow for a <description> element below <protocol>
The scanner parses this already, it doesn't do anything with it though.

The DTD requires the order to be copyright, description, then the interfaces.
That's largely a DTD limitation, the scanner doesn't care.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-11-17 14:36:21 +02:00
Peter Hutterer
9d794d9f77 Revert "Remove protocol/wayland.dtd"
This reverts commit 06fb8bd371.

Having a DTD hooked up gives an indication of what we expect the protocol to
be, which is a clearer documentation than the current "whatever scanner.c
manages to parse".

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-11-17 14:36:21 +02:00
Marek Chalupa
c7bada036d add wl_abort private function
On many places in the code we use wl_log + abort or wl_log + assert(0).
Replace these with one call to wl_abort, so that we don't mix abort(),
assert(0) and we'll save few lines

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2015-11-16 12:58:43 -08:00
Peter Hutterer
5660ea414f doc: make the doxygen output dependent on scanner.c
When the scanner changes, we need to rebuild

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-11-16 11:57:42 -08:00
Marek Chalupa
10d5f97706 event-loop: remove extra header
we don't use assert() anywhere in this file, so remove #include <assert.h>

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-11-16 11:42:01 -08:00
Derek Foreman
8bc42fbf7b shm: wl_shm_buffer_get_data() requires a valid pool.
There's no situation where a shm buffer without a pool makes sense,
so we enforce the pool's existence a little more rigidly.

Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
2015-11-06 13:42:52 +02:00
Derek Foreman
2aee2069a0 shm: Move deprecated function to the bottom of the file
In wayland-server.c we group the deprecated functions and
disable doxygen for them.  Do that here too.

Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
2015-11-06 13:42:46 +02:00
Derek Foreman
91881e8f89 shm: Deprecate wl_shm_buffer_create()
From irc:
<pq> it creates a wl_buffer object in a way that no client can ever
     access the storage.

So, let's replace it with return NULL; and mark it with attribute
deprecated in the header.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
2015-11-06 13:42:33 +02:00
Auke Booij
4a97cb3579 doc: output enum and bitfield attributes in the documentation
Signed-off-by: Auke Booij <auke@tulcod.com>
Reviewed-by: Nils Chr. Brause <nilschrbrause@googlemail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-11-04 14:54:37 -08:00
Auke Booij
1771299a5a scanner: enforce correct argument type for enums
The scanner now checks whether arguments that have an associated
<enum> have the right type.
An argument with an enum attribute must be of type int or uint,
and if the <enum> with that name has the bitfield attribute
set to true, then the argument must be of type uint.

Changes since v3:
 - Remove useless allow_null check
 - Switch to using bool
 - Clearer message on errorous input
 - Minor formatting fix

Signed-off-by: Auke Booij <auke@tulcod.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Nils Chr. Brause <nilschrbrause@googlemail.com>
2015-11-04 14:51:43 -08:00
Auke Booij
851614fa78 protocol: specify enum and bitfield attributes
Signed-off-by: Auke Booij <auke@tulcod.com>
Reviewed-by: Nils Chr. Brause <nilschrbrause@googlemail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Acked-by: Victor Berger <victor.berger@m4x.org>
2015-11-04 14:50:45 -08:00
Auke Booij
999225c17a doc: document the enum and bitfield attributes
Introduce the enum and bitfield attributes, which allow you to refer to the enum
you are expecting in an argument, and specify which enums are to be thought of
as bitfields.

Changes since v3:
 - Fix typo ("description" -> "descriptive")

Signed-off-by: Auke Booij <auke@tulcod.com>
Reviewed-by: Nils Chr. Brause <nilschrbrause@googlemail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-11-04 14:50:26 -08:00
Jon Cruz
f150d7aec2 cosmetic: fix incorrect whitespace.
Fixed instance where spaces were used instead of tabs.

Changes since v1:
* rebased

Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
2015-10-29 13:44:30 -07:00
Jon Cruz
1cf175eba4 scanner: stop adding trailing whitespace to copyright
Generated code was unconditionally adding a space to lines
in comments for copyright blocks even if the line was blank.
Updated to not add trailing whitespace for blank lines.

Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
2015-10-26 10:51:20 -07:00
Jon Cruz
9a170b9834 cosmetic: fix inconsistent code style with header prototypes.
A few of the header files had function prototypes that were not
following project conventions, sometimes even in the same file.
Corrected these to follow as per wayland-os.h.

Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
2015-10-26 10:50:48 -07:00
Derek Foreman
eba83cd5e1 shm: Add shm_buffer ref and shm_pool unref functions
Sometimes the compositor wants to make sure a shm pool doesn't disappear
out from under it.

For example, in Enlightenment, rendering happens in a separate thread
while the main thread can still dispatch events.  If a client is destroyed
during rendering, all its resources are cleaned up and its shm pools are
unmapped.  This causes the rendering thread to segfault.

This patch adds a way for the compositor to increment the refcount of the
shm pool so it can't disappear, and decrement it when it's finished.

The ref/unref are asymmetrical (ref returns the pool) because it's
possible the buffer itself will be gone when you need to unref the pool.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
2015-10-21 16:31:51 -05:00
Auke Booij
06fb8bd371 Remove protocol/wayland.dtd
The wayland scanner defines the protocol. The DTD specification is not used.
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Nils Christopher Brause <nilschrbrause@googlemail.com>
2015-10-09 15:32:34 -05:00
Jonas Ådahl
9ebdcab109 scanner: Generate 'since' macros for requests as well
We already generate WL_[INTERFACE]_[REQUEST]_SINCE_VERSION macros for
events in the server protocol headers. Lets do the same for requests in
the client protocol headers as well.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: David FORT <contact@hardening-consulting.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2015-10-09 21:02:03 +08:00
Jonas Ådahl
7c9135e1cf client: Move prepare read documentation to .._prepare_read_queue()
In the documentation we refer to "an event queue" in various places and
from the beginning it is unclear what event queue this means. So,
instead of having a paragraph in the end mentioning this, move the
detailed documentation to the function with the queue explicitly passed.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-10-08 12:49:05 +08:00
FORT David
b6809e5a80 wayland: add a release request on wl_seat
This is required if we want to correctly remove a wl_seat compositor-side. A
wl_seat is announced as a global object, then it is bound by the client. When
the compositor wants to remove the seat, it shall announce the global removal of
the object. The client can then call the release request on the wl_seat (which
means I won't use that object anymore).

Acked-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2015-10-07 17:31:57 -07:00
Jonas Ådahl
99c34e58db client: Improve wl_display_roundtrip(_queue)() documentation
Change the wording a bit to describe how it is done (which explains to
the name of the function) as well as a note about that we actually will
dispatch events that are received.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-10-05 17:28:53 -07:00
Jonas Ådahl
5e0ed91774 client: Be more clear about when one must call wl_display_flush
Blocking in general is not what means it is required to flush, but
blocking on input from the wl_display file descriptor.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-10-05 17:28:53 -07:00
Jonas Ådahl
f755dbde26 client: Reword and add documentation about the marshal functions
Some rewording to improve grammar a bit with some additions about the
type expectations of va_list arguments.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-10-05 17:28:53 -07:00
Jonas Ådahl
e74cde739e client: Fix minor grammar issue
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-10-05 17:28:53 -07:00
Bryce Harrington
e0b2166c99 scanner: Close input resource when done to prevent leak
Addresses this error reported by Denis Denisov:

  [src/scanner.c:1415]: (error) Resource leak: input

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>

v2: Also close input for other exit points in main.
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: David FORT <contact@hardening-consulting.com>
2015-10-05 16:47:58 -05:00
Pekka Paalanen
d20a0b8758 Contributing: explain Patchwork
Add general guidelines for using Patchwork, as we heavily rely on it
nowadays.

v2:

- mention also Xwayland and libinput patch management
- reword "if not found in Patchwork"
- reword "Not applicable"
- mention pwclient

Cc: Bryce Harrington <bryce@osg.samsung.com>
Cc: Olivier Fourdan <ofourdan@redhat.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
2015-09-22 14:12:32 -07:00
Bryce Harrington
b31225f91b configure.ac: bump to version 1.9.90 for open development
Master is open for new feature development again.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2015-09-22 13:39:44 -07:00
Bryce Harrington
b05668f0ad configure.ac: bump to version 1.9.0 for the official release 2015-09-21 16:52:11 -07:00
Bryce Harrington
8fd494995d configure.ac: bump to version 1.8.93 for the RC1 release 2015-09-15 20:16:37 -07:00
Bryce Harrington
b16c0a5dfa configure.ac: bump to version 1.8.92 for the beta release 2015-09-01 16:51:30 -07:00
Pekka Paalanen
c7dbaa1cfd Revert "client: require WAYLAND_DISPLAY to be set"
This reverts commit fb7e130217.

Developers have been trying to reduce the number of by default required
environment variables, and the mentioned commit is a step backwards in
that sense. The fundamental assumption is that a user has only one main
(Wayland) display server where all programs should connect to by
default, and do so with an a priori known socket name.

The commit also broke various use cases in the wild, some accidentally
due to other causes, some intentionally. This revert allows those use
cases to continue.

The original problem of running Weston in a window in an existing GNOME
X11 session and getting applications unintentionally launched into
Weston can be circumvented by letting Weston use a non-default socket
name, leaving wayland-0 unused.

Discussion:
http://lists.freedesktop.org/archives/wayland-devel/2015-August/023927.html
http://lists.freedesktop.org/archives/wayland-devel/2015-August/023937.html

Cc: Dima Ryazanov <dima@gmail.com>
Cc: Giulio Camuffo <giuliocamuffo@gmail.com>
Cc: Daniel Stone <daniel@fooishbar.org>
Cc: Jasper St. Pierre <jstpierre@mecheye.net>
Cc: Ryo Munakata <ryomnktml@gmail.com>
Cc: Ray Strode <halfline@gmail.com>
Cc: Peter Hutterer <peter.hutterer@who-t.net>
Cc: Matthias Clasen <mclasen@redhat.com>
Cc: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Ray Strode <rstrode@redhat.com>
Acked-by: Dima Ryazanov <dima@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Acked-By: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Acked-By: Ryo Munakata <ryomnktml@gmail.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-24 12:55:24 +03:00
Bryce Harrington
c0636ddcac configure.ac: bump to version 1.8.91 for the alpha release 2015-08-16 13:54:50 -07:00
Dima Ryazanov
fb7e130217 client: require WAYLAND_DISPLAY to be set
Although defaulting to wayland-0 seems convenient, it has an undesirable
side effect: clients may unintentionally connect to the wrong compositor.
Generally, it's safer to fail instead. Here's a real example:

In Fedora 22, Gtk+ prefers Wayland over X11, though the default session is still
a normal X11 Gnome session. When you launch a Gtk+ app, it will try Wayland,
fail, then try X11, and succesfully start up. That works fine.

Now suppose you launch Weston while running the Gnome session. Suddenly, all
of the Gtk+ apps launched from Gnome will show up inside Weston instead.
That's unexpected. There's also no good way to prevent that from happening
(other than perhaps setting WAYLAND_DISPLAY to an invalid value when launching
an app).

Not using wayland-0 as the default will solve that problem: an app launched
from the X11 Gnome session will use the X11 backend regardless of whether
there's a wayland compositor running at the same time.

Everything else should work as before. The compositor already sets
the WAYLAND_DISPLAY when starting the session, so the lack of the default value
should not make a difference to the user.

Signed-off-by: Dima Ryazanov <dima@gmail.com>
Acked-by: Pekka Paalanen <ppaalanen@gmail.com>
Acked-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Acked-by: Daniel Stone <daniel@fooishbar.org>
Acked-by: Jasper St. Pierre <jstpierre@mecheye.net>
Reviewed-by: Ryo Munakata <ryomnktml@gmail.com>

[Pekka: dropped the wayland-server.c hunk, adjusted summary]

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-08-14 10:14:05 +03:00
Elvis Lee
441f9bb144 wayland-client : Fix queue_release not to call proxy_destroy
proxy_destroy could be called twice by wl_proxy_destroy and wl_event_queue_release.
Then, wl_map_remove was called twice for same object id.

Signed-off-by: Elvis Lee <kwangwoong.lee@lge.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2015-08-06 08:46:56 +01:00
Marek Chalupa
bbe6795d9b scanner: check sanity of version
scanner does not complain if we put into version attribute
things like -1 1x 1:3 etc.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-07-30 18:33:31 -07:00
Marek Chalupa
765040d1a7 scanner: use zxalloc
Use xzalloc instead of xmalloc. This allows us to get rid
of manual initializing the memory to 0s and the code is
shorter and cleaner

Suggested by Bryce Harrington

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-07-30 18:24:04 -07:00
Marek Chalupa
289a75739b scanner: get rid of leaks
Free all the memory we have allocated during running.

v2.: split creating objects and getting rid of leaks
     into two patches

     move check for NULL description into free_description

v3.: rebase after previous patch fixes

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-07-30 18:23:42 -07:00
Marek Chalupa
87fab2e36c scanner: refactor creating objects
wrap creating and initializing objects (structures)
into functions and use them in the code.

v2. make create_.* functions consistent
    (no func will return NULL)

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-07-30 18:23:15 -07:00
Bryce Harrington
1c12bf48af gitignore: Ignore some dist generated files 2015-07-30 18:18:25 -07:00
Derek Foreman
de1489564c build: Build libwayland-private
This splits the bulk of libwayland-util into libwayland-private.

libwayland-util (which is just wayland-util.c) is for use with the scanner.

libwayland-private is everything else.

Most things will want to link both libs.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-23 14:23:58 -07:00
Ross Burton
21f80b8982 build: always build wayland-scanner
The previous idiom for building a cross-compiled Wayland is to build once for
the build host (with --enable-scanner --disable-libraries) to get a
wayland-scanner binary that can then be used in a cross-compile (with
--disable-scanner).  The problem with this is that the cross wayland is missing
a wayland-scanner binary, which means you then can't do any Wayland development
on the target.

Instead, always build wayland-scanner for the target and change
--enable/disable-scanner to --with/without-host-scanner.  Normal builds use the
default of --without-host-scanner and run the wayland-scanner it just built, and
cross-compiled builds pass --with-host-scanner to use a previously built host
scanner but still get a wayland-scanner to install.

(a theoretically neater solution would be to build two scanners if required (one
to run and one to install), but automake makes this overly complicated)

[daniels: Bikeshedded naming with Ross's OK.]

Signed-off-by: Ross Burton <ross.burton@intel.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2015-07-17 12:19:08 +01:00
Marek Chalupa
ba731f951c fixed-benchmark: remove unused arguments in main
Fixed benchmark uses main(int argc, char *argv[])
but does not use the arguments, so we can replace them with void

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-07-10 17:17:46 -07:00
Bryce Harrington
c2547c70a7 tests: Don't increment variables inside an assert()
Addresses this warning found by Denis Denisov:

  [tests/array-test.c:137]: (warning) Assert statement modifies 'i'.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Jon A. Cruz <jonc@osg.samsung.com>
2015-07-10 00:12:36 -07:00
Derek Foreman
ab254f7efe cosmetic: gratuitous whitespace changes in event-loop.c
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-06-23 10:27:23 +03:00
Derek Foreman
4cdc51034c build: Use AM_CFLAGS instead of GCC_CFLAGS everywhere
This will make it easier if we ever want to add new flags to everything
in the future.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-06-23 10:07:40 +03:00
Bryce Harrington
a8a86010a6 cursor: Update printed license from MIT "X11" to MIT "Expat"
The code generates a cursor-data.h file, with licensing information.
Change this from the MIT "X11" license to MIT "Expat" license for
consistency with the rest of Wayland.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-06-22 14:50:20 +03:00
Bryce Harrington
40925634e6 publican: Update docs license from MIT "X11" to MIT "Expat" style
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-06-22 14:50:10 +03:00