Commit Graph

1600 Commits

Author SHA1 Message Date
Benjamin Herr
4a661c5b0c doc: Translate doxygen <sp/> tags to spaces
Doxygen represents all spacing in code blocks with <sp/> tags, so these
need to be turned back into spaces.

Signed-off-by: Benjamin Herr <ben@0x539.de>
2014-11-03 15:53:01 +02:00
Benjamin Herr
6b511090c5 doc: Mostly use apply-templates over value-of
xsl:value-of would strip all the nested markup of the selected doxygen
elements, so that \ref, \sa and \code formatting didn't actually work.

Signed-off-by: Benjamin Herr <ben@0x539.de>
2014-11-03 15:51:12 +02:00
Benjamin Herr
5b353ad44d doc: Mark up some code examples
These blocks were misformatted in normal paragraph style in the
generated docs. Also, added \comment{} for comments within one code
example.

Signed-off-by: Benjamin Herr <ben@0x539.de>
2014-11-03 15:09:06 +02:00
Daniel Stone
37ffae3164 README: Tiny cosmetic change 2014-10-08 12:20:17 +01:00
Pekka Paalanen
7a0b86ab22 protocol: define error codes for role reassignment
On the interfaces where it was missing:
- wl_data_device
- wl_shell
- wl_pointer
add an error code for requests that set a wl_surface role when the
wl_surface already has a different role.

This is needed for compositors to appropriately report wl_surface
role violations.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
Acked-by: Jason Ekstrand <jason.ekstrand@intel.com>
2014-10-08 13:09:56 +03:00
Pekka Paalanen
aee813f1ff protocol: wl_shell.get_shell_surface gives a role
Now that we have defined "role", use the term.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2014-10-01 11:50:48 +03:00
Pekka Paalanen
96fdcfaec7 protocol: wl_subcompositor.get_subsurface gives a role
Reword the conditions to make use of the definition of "role".

It is still forbidden to create more than one wl_subsurface for a
wl_surface at a time.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2014-10-01 11:50:48 +03:00
Pekka Paalanen
58743c29f8 protocol: wl_data_device.start_drag may give a role
Now that we have defined "role", use the term.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2014-10-01 11:50:47 +03:00
Pekka Paalanen
a27501f40e protocol: wl_pointer.set_cursor gives a role
Now that we have defined "role", use the term.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2014-10-01 11:50:47 +03:00
Pekka Paalanen
ff2df60b1a protocol: define the concept of wl_surface role
Define what a role is, and what restrictions there are.

A change to existing behaviour is that a role cannot be changed at all
once set. However, this is unlikely to cause problems, as there is no
reason to re-use wl_surfaces in clients.

v2: give more concrete examples of roles, define losing a role, Jasper
rewrote the paragraph on how a role is set.

v3: make role permanent, there is no such thing as "losing a role".
Re-issuing the same role again must be allowed for wl_pointer.set_cursor
et al. to work.

v4: clarify the semantics of destroying a role object.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2014-10-01 11:50:47 +03:00
Jonas Ådahl
9dba854547 scanner: Remove stray newline
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2014-09-23 11:40:46 +03:00
Jonas Ådahl
2028227acc scanner: Improve XML parse error reporting
Print the parse error and exit with a failure if expat can't parse the
XML.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2014-09-23 11:40:46 +03:00
Peter Hutterer
f3e7eedf1c doc: replace publican with xmlto
Publican isn't packaged for some distros, xmlto is a lot more common. Most of
what publican provides for us is the stylesheet anyway, so we can just use
xmlto and the publican stylesheet to get roughly the same look.

PDF and XML generation has been dropped, this needs a bit more more effort
than a mere switchover to xmlto.

The top-level directory structure imposed by publican is kept for now
(specifically the Wayland/en-US/html tree). This makes it easier to transition over
for packagers. Note that the list of files inside has changed.

CSS files are taken from publican to keep a uniform look compared to previous
documentations. Stylesheets are licensed under CC0 1.0 Universal license, see
publican/LICENSE:

1.  Files in the datadir/Common_Content directory and its subdirectories are
    licensed under the CC0 1.0 Universal license.

    To the extent possible under law, the developers of Publican waive all
    copyright and related or neighboring rights to the files contained
    in the datadir/Common_Content directory and its subdirectories.

Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-09-22 10:30:41 +03:00
Pekka Paalanen
472f0c48e6 configure.ac: bump version to 1.6.90
Master is open for new features again.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-09-22 09:51:20 +03:00
Pekka Paalanen
339e83aa57 configure.ac: bump version to 1.6.0
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-09-19 12:36:04 +03:00
Pekka Paalanen
edf4e7abea configure.ac: bump version to 1.5.93 for rc2
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-09-12 12:26:50 +03:00
Derek Foreman
4d7dfa0867 shm: fix error in comment 2014-09-11 11:46:45 +03:00
Marek Chalupa
083d8da432 client: cancel read in wl_display_read_events() when last_error is set
Calling wl_display_read_events() after an error should be equivalent
to wl_display_cancel_read(), so that display state is consistent.

Thanks to Pekka Paalanen <pekka.paalanen@collabora.co.uk>
for pointing that out.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-09-11 11:41:58 +03:00
Marek Chalupa
a31a736009 client: wake-up threads on all return paths from read_events
If wl_connection_read returned EAGAIN, we must wake up sleeping
threads. If we don't do this and the thread calling
wl_connection_read won't call wl_display_read_events again,
the sleeping threads will sleep indefinitely.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-09-11 10:22:44 +03:00
Marek Chalupa
65d02b7a83 display-test: test if threads are woken up on EAGAIN
When wl_connection_read() in wl_display_read_events() returns with EAGAIN,
we want the sleeping threads to be woken up. Test it!

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-09-11 10:21:08 +03:00
Marek Chalupa
d837741166 tests: use nanosleep instead of usleep
man usleep says that bahaviour of using usleep with SIGALRM signal
is unspecified. So create our own usleep that calls nanosleep instead.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-09-09 12:43:38 +03:00
Pekka Paalanen
44bf13ba0f configure.ac: bump version to 1.5.92 for rc1
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-09-05 14:57:03 +03:00
Bryce W. Harrington
7af5920031 doc: Quell warnings about missing man3 directory before its been built
The shell command for dist_man3_MANS gets invoked several times during
the make process but before the man pages have been generated, which
causes the following warnings when running `make`:

    find: `man/man3': No such file or directory
    find: `man/man3': No such file or directory
    find: `man/man3': No such file or directory
      GEN    xml/client/index.xml

Despite these error messages, the generated dist tarball contains the
man3 pages as intended, both before and after this patch.

    $ make dist
    $ tar xxf wayland-1.5.90.tar.xz
    $ find wayland-1.5.90/doc/doxygen/man/man3 -name "wl_*.3" | wc -l
    85

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-09-05 11:53:13 +03:00
Marek Chalupa
aa49a79d7a display-test: make use of create_thread function
This function is used in one test only, but its functionality can be
used in another tests to (create thread and wait until it is sleeping).
We just need to pass the starting function for the thread as an argument.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-09-04 15:47:04 +03:00
Marek Chalupa
1e0f9698d4 client: add display_wakeup_threads function
This helper function wraps the always-repeated pattern:

  display->read_serial++;
  pthread_cond_broadcast(&display->reader_cond);

[Pekka Paalanen: minor whitespace and comment fixes.]

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-09-04 15:32:41 +03:00
Nils Chr. Brause
5c7d30b691 wayland-client: Initialize newly created wl_proxys to zero
Up until now, newly created wl_proxys (with proxy_create or
wl_proxy_create_for_id) are not initialized properly after memory
allocation. The wl_display object in contrast is. To prevent giving
uninitialized data to the user (e.g. user_data) an appropriate memset
has been added. Also, after a memset members don't have to be
explicitly initialized with zero anymore.

Signed-off-by: Nils Chr. Brause <nilschrbrause@googlemail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-09-04 15:05:41 +03:00
Peter Hutterer
fb97550ce6 doc/publican: stop excessive rebuilds
Traced down to the server/client target always rebuilding, causing a rebuild
of everything else. Rework this so the target name is a file we actually
produce and can check for a timestamp.

Note: this also changes the generated file from the doxygen directory into the
en-US publican path and renames it to (server|client)API.xml.tmp to avoid
copying it into the xml output directory.
2014-09-03 16:25:27 +03:00
Pekka Paalanen
6d0f298665 configure.ac: Bump version to 1.5.91 for the alpha release
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-22 18:01:35 +03:00
Marek Chalupa
8c061d1b7e client: check for error in wl_display_read_events
This prevents from blocking shown in one display test. Also, it
makes sense to not proceed further in the code of the function
when an error ocurred.

v2. set errno
    put note about the errno into wl_display_prepare_read doc
    check for error with mutex locked

v3.
    set errno to display->last_error

    check for the error only in wl_display_read_events. It's sufficient
    as prevention for the hanging and programmer doesn't need to
    check if wl_display_prepare_read (that was previously covered by
    this patch too) returned an error or the queue just was not empty.
    Without the check, it could result in indefinite looping.

Thanks to Pekka Paalanen <pekka.paalanen@collabora.co.uk> for
constant reviewing and discussing this patch.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-22 15:33:49 +03:00
Marek Chalupa
574b710ef8 client: broadcast the right pthread_cond variable
In previous commit we removed unused variables. One of them was
pthread_cond_t that was formerly used when reading from display, but
later was (erroneously) made unused. This patch fixes this error
and is a fix for the failing test introduced few patches ago (tests:
test if thread can block on error)

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-22 15:01:05 +03:00
Olivier Blin
0cb9862c93 client: drop unused event queue cond and list variables
The wl_event_queue cond variable has been replaced by the wl_display
reader_cond variable (commit 3c7e8bfbb4).
This cond variable is never waited for anymore, just
signaled/broadcasted, and thus can be safely removed.

The wl_display event_queue_list and link from wl_event_queue
can be removed as well, since it was only used to iterate over
the event queue list in order to broadcast the now unused cond.

No regression on queue unit tests.

Signed-off-by: Olivier Blin <olivier.blin@softathome.com>

v2: fixed and rebased after 886b09c9a3
    added signed-off-by

v3: removed link from wl_event_queue

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-22 15:00:54 +03:00
Marek Chalupa
71141288f0 tests: add test for reading after an error occurred
This test shows that it's possible to successfully call wl_display_prepare_read
and wl_display_read_events after an error occurred. That may lead to
deadlock.

When you call prepare read from two threads and then call read_events,
one thread gets sleeping. The call from the other thread will return -1 and invokes
display_fatal_error, but since
we have display->last_error already set, the broadcast is not called and
the sleeping thread sleeps indefinitely.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-22 12:58:25 +03:00
Marek Chalupa
213366e698 tests: add tests for wl_display_cancel_read
Test if wl_display_cancel_read wakes up other threads.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-22 12:55:37 +03:00
Marek Chalupa
171e0bdace tests: test if thread can block on error
wl_display_read_events() can make a thread wait until some other thread
ends reading. Normally it wakes up all threads after the reading is
done. But there's a place when it does not get to waking up the threads
- when an error occurs. This test reveals bug that can block programs.

If a thread is waiting in wl_display_read_events() and another thread
calls wl_display_read_events and the reading fails,
then the sleeping thread is not woken up. This is because
display_handle_error is using old pthread_cond instead of new
display->reader_cond, that was added along with wl_display_read_events().

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-22 12:53:49 +03:00
Marek Chalupa
47208d2ab1 tests: test posting errors
Test posting errors to one and more clients.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-22 12:43:38 +03:00
Marek Chalupa
93e654061b tests: use test compositor in queue-test
Most of the code of the queue-test is covered by the test compositor,
so we can save few lines and use the test compositor instead.
I think it's also more readable.

This patch removes timeout from the test. We plan to add timeout
to all tests later, though.

v2.
  rebased to master

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-22 12:39:52 +03:00
Marek Chalupa
85d08e8bd6 tests: add test-compositor
This patch introduces a set of functions that can create a display
and clients for tests.
On server side the user can use functions:
  display_create()
  display_destroy()
  create_client()
  display_run()
  display_resume()
and on client side the user can use:
  client_connect()
  client_disconnect()
  stop_display()

The stop_display() and display_resume() are functions that serve as a barrier
and also allow the display to take some action after the display_run() was called,
because after the display is stopped, it can run arbitrary code until it calls
display_resume().

client_connect() function connects to wayland display and creates a proxy to
test_compositor global object, so it can ask for stopping the display later
using stop_display().

An example:

  void
  client_main()
  {
        /* or client can use wl_display_connect(NULL)
         * and do all the stuff manually */
        struct client *c = client_connect();

        /* do some stuff, ... */

        /* stop the display so that it can
         * do some other stuff */
        stop_display(c, 1);

        /* ... */

        client_disconnect(c);
  }

  TEST(dummy_tst)
  {
       struct display *d = display_create();

       /* set up the display */
       wl_global_create(d->wl_display, ...);

       /* ... */

       create_client(d, client_main);
       display_run();

       /* if we are here, the display has been stopped
        * and we can do some code, i. e. create another global or so */
       wl_global_create(d->wl_display, ...);

       /* ... */

       display_resume(d); /* resume display and clients */

       display_destroy(d);
  }

v2:
  added/changed message in few asserts that were not clear
  fixed codying style issues and typo
  client_create_with_name: fixed a condition in an assert
  get_socket_name: use also pid
  check_error: fix errno -> err

[Pekka Paalanen: added test-compositor.h to SOURCES, added
WL_HIDE_DEPRECATED to get rid of deprecated defs and lots of warnings,
fixed one unchecked return value from write().]

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-22 12:34:33 +03:00
Marek Chalupa
ded9bb1f8b client: remove unused variable
display_thread variable is unused since
3c7e8bfbb4

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-21 14:45:03 +03:00
Marek Chalupa
c6d98e15ca tests: remove unnecessary lines from queue-test
Earlier, the wl_display_dispatch_pending were setting number of thread
that can dispatch events. This behaviour was removed later,
so now these lines are redundant.

Related commits:

385fe30e8b
78cfa96768
3c7e8bfbb4

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-21 14:44:51 +03:00
Marek Chalupa
8cf7a23e57 tests: remove leaks from queue-test
Destroy all objects that we have created

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-21 14:44:39 +03:00
Jasper St. Pierre
78d8047407 server: Don't expose wl_display as a global
The idea here was that once upon a time, clients could rebind wl_display
to a higher version, so we offered the ability to rebind it
here. However, this is particularly broken. The existing bind
implementation actually still hardcodes version numbers, and it leaks
previous resources, overwriting the existing one.

The newly bound resource *also* won't have any listeners attached by the
client, meaning that the error and delete_id events won't get delivered
correctly. Unless the client poked into libwayland internals, it also
can't possibly set up these handlers correctly either, so the client
will sustain errors and leak all deleted globals.

Since this never worked correctly in the first place, we can feel safe
removing it.

Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-21 13:51:07 +03:00
Giulio Camuffo
a52357f6fb tests: test the wl_display_roundtrip_queue() function
[Pekka Paalanen: moved variable declarations to before code. Added some
comments, and added the re-arm to additionally test the opposite case.]

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-21 10:30:26 +03:00
Giulio Camuffo
77dd068d42 client: add a public function to make a roundtrip on a custom queue
wl_display_roundtrip() works on the default queue. Add a parallel
wl_display_roundtrip_queue().

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-21 10:12:46 +03:00
Ryo Munakata
06472737a9 wl_surface: clarify the base of time passed in the callback of frame
Signed-off-by: Ryo Munakata <ryomnktml@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-21 10:01:17 +03:00
Marek Chalupa
b24fa4c821 tests: fix event_loop_timer_updates
It may happen that there's some time between the first and the other timer expire.
If epoll_wait is called after the first timer expired and
the other not, it returns only one source to dispatch and therefore
the test fails. To fix that, sleep a while before
wl_event_loop_dispatch() to make sure both timers expired.

To be 100% sure, we could use poll() before calling
wl_event_loop_dispatch(), but that would need modification in libwayland
(need to get the source's fd somehow)

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

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-19 14:34:50 +03:00
Marek Chalupa
12ec657014 tests: event_loop_timer_updates - add asserts and fix indentation
Make sure the wl_event_source_timer_update suceeded. Also, fix weird
indentation.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-19 14:34:34 +03:00
Marek Chalupa
5bed9e46e7 tests: add one more test for event-loop signal source
Test if when we get a signal, all signal sources for that signal
get dispatched.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-18 13:36:22 +03:00
Marek Chalupa
f2338c8f3b event-loop: make signalfd non-blocking
When we add more that one source to a signal, then wayland will
block in wl_event_loop_dispatch. This is due to the attampt to read
from signal's fd each time the source is dispatched.

  wl_event_loop_add_signal(loop, SIGINT, ...);
  wl_event_loop_add_signal(loop, SIGINT, ...);

  /* raise signal .. */

  /* we got two fd's ready, both for the one SIGINT */
  epoll_wait(...) = 2

  [ for (i == 0) ]
      source1->dispatch() --> read(fd1);
  [ for (i == 1) ]
      source2->dispatch() --> read(fd2); /* blocking! */

Reading from fd2 will block, because we got only one signal,
and it was read from fd1.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-18 13:03:00 +03:00
Marek Chalupa
5504c9338b tests: make event-loop-test more explicit
Check value set in handler against an explicit value instead of:
  assert(value);

also add one assert() for non-NULL value.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-18 12:55:35 +03:00
Jasper St. Pierre
edddb0f58e scanner: Make emit_structs more explicit
"is_interface" is a really terrible name for the client or server
variants, and instead of checking whether we were passed the requests or
the events, just pass an argument through.

Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-18 11:31:48 +03:00