Compare commits

...

1153 commits
1.5.92 ... main

Author SHA1 Message Date
YaNing Lu
e647f6304d util: fix use-after-free in for_each_helper
for_each_helper caches the entries->data pointer and array size before
iterating. If a compositor calls wl_client_for_each_resource() and the
provided callback triggers the creation of a new client object, the
underlying wl_array may be reallocated via realloc().

When this happens, the cached start pointer becomes dangling. Subsequent
iterations will read from the freed memory block, causing already-destroyed
resources to be destroyed a second time (e.g., leading to a double-free
crash in wl_list_remove()).

Fix this by dynamically re-fetching entries->data and entries->size on
every loop iteration, ensuring the iterator always accesses the valid
live array.

Signed-off-by: YaNing Lu <luyaning@uniontech.com>
2026-03-30 08:52:42 +08:00
Vlad Zahorodnii
44b26e34e5 Send wl_registry.global_remove to global's offer list
Since the globals track the registries that received global
announcements, we can use that instead of going through all present
registries and duplicate some filtering logic.

Signed-off-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
2026-03-24 13:45:00 +02:00
Vlad Zahorodnii
c048101ca9 Add wl_fixes.ack_global_remove()
The wl_global_remove() function was introduce to help mitigate clients
getting unintentionally disconnected if a global is added and removed in
a short burst.

The intended usage was:

 - the compositor calls wl_global_remove()
 - after a certain period of time, the compositor calls
   wl_global_destroy()

Unfortunately, it did not fully fix the issue due to the way monotonic
clock works on Linux. Specifically, it can tick even during sleep.

This change adds a slightly better way to handle global removal. With
the proposed changes, the clients need to signal to the compositor that
they won't bind the global anymore.

After all clients have acknowledged a wl_registry.global_remove, the
compositor can finally destroy the global.

Signed-off-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
2026-03-24 13:45:00 +02:00
Simon Ser
53509f09ba build: re-open main branch for regular development
Signed-off-by: Simon Ser <contact@emersion.fr>
2026-03-20 11:17:40 +01:00
Simon Ser
bec2bcddd8 ci: upgrade FreeBSD to v14.4
Signed-off-by: Simon Ser <contact@emersion.fr>
2026-03-10 12:31:35 +01:00
Simon Ser
e6aeed9816 build: bump version to 1.24.91 for the RC1 release
Signed-off-by: Simon Ser <contact@emersion.fr>
2026-03-05 19:10:51 +01:00
Kirill Primak
13d906a629 server: improve wl_registry.bind error messages
- Consistently use PRIu32 for global names (uint32_t)
- Use expected/got instead of have/wanted (which were used differently anyway)

Signed-off-by: Kirill Primak <vyivel@eclair.cafe>
2026-03-05 17:34:24 +00:00
Kirill Primak
69aabecd18 server: don't disclose the existence of invisible globals
Otherwise, a client iterate over a range of names binding with deliberately
incorrect interfaces and receive error messages with expected interfaces
regardless of global visibility.

Signed-off-by: Kirill Primak <vyivel@eclair.cafe>
2026-03-05 17:34:24 +00:00
Isaac Freund
c0a6e73606 scanner: enforce frozen attribute
Signed-off-by: Isaac Freund <mail@isaacfreund.com>
2026-03-05 12:00:35 +00:00
Isaac Freund
a58bcd7481 doc: add frozen=true interface attribute
This is useful for scanners that use knowledge of the object creation
hierarchy such as zig-wayland [1]. Currently zig-wayland uses a
hardcoded list of frozen interfaces.

[1]: https://codeberg.org/ifreund/zig-wayland

Signed-off-by: Isaac Freund <mail@isaacfreund.com>
2026-03-05 12:00:35 +00:00
Kirill Primak
4d13366fcc server: improve version mismatch error message
"1 < 2" is obviously true but not very useful information by itself. Provide a
bit more context.

Signed-off-by: Kirill Primak <vyivel@eclair.cafe>
2026-03-05 11:18:53 +00:00
Rudi Heitbaum
fe4d7620dd cursor: fix discards 'const' qualifier
Fixes:
../cursor/xcursor.c: In function 'xcursor_next_path':
../cursor/xcursor.c:610:23: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  610 |         char *colon = strchr(path, ':');
      |                       ^~~~~~

Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
2026-03-03 21:36:37 +00:00
Diego Viola
df10ef181e Fix typos
Signed-off-by: Diego Viola <diego.viola@gmail.com>
2026-03-03 08:17:13 -03:00
Simon Ser
fe3a02c18a util: assert alloc is consistent with data in wl_array_add()
struct wl_array may be constructed by users manually from a
foreign data pointer:

    uint32_t states[] = {1, 2, 3};
    struct wl_array arr = {
        .data = states,
        .size = sizeof(states) / sizeof(states[0]),
    };

This is useful to avoid the need to allocate when sending Wayland
messages.

Users need to be careful not to use wl_array_add() on such arrays:
the function will misbehave by leaving garbage at the start of the
new buffer when reallocating.

Add an assert to guard against wl_array_add() calls in this
situation, to have a clear crash instead of undefined behavior.

Signed-off-by: Simon Ser <contact@emersion.fr>
2026-03-03 11:31:53 +02:00
Manuel Stoeckl
290ce2a9c1 protocol: elaborate on drm_fourcc.h and wl_shm.format codes
Wayland clients should not assume the format list will not grow, or
assume the format descriptions in the Wayland protocol are complete.
(The latter fact is clear for descriptionless enum entries like
XRGB8888_A8; but, for example, the full XRGB16161616F format
description explicitly requires IEEE 754 binary16 floats instead
of bfloat16 or ARM's alternative half precision variant.)

Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
2026-02-28 20:17:00 -05:00
Alexandros Frantzis
dad4404d92 tests: Add test for using a proxy with a destroyed queue as a factory
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2026-03-01 01:03:37 +00:00
Loïc Yhuel
cd4e6a1451 client: fix crash when creating proxies with no queue
Before, it worked if the client did set a queue on the proxy before any event was received.
Now we have the "warning: queue xxx destroyed while proxies still attached", then a crash if one of
the proxies is used to create a proxy.

Fixes: 674145dc3f ("client: Track the proxies attached to a queue")
Fixes: 0ba650202e ("client: Warn when a queue is destroyed with attached proxies")
Signed-off-by: Loïc Yhuel <loic.yhuel@softathome.com>
2026-03-01 01:03:37 +00:00
Julian Orth
cba2754230 protocol: add wl_data_device_manager destructors
Signed-off-by: Julian Orth <ju.orth@gmail.com>
2026-02-28 10:44:25 +00:00
Julian Orth
bb2fda519a protocol: add wl_compositor destructor
Signed-off-by: Julian Orth <ju.orth@gmail.com>
2026-02-28 10:44:25 +00:00
Julian Orth
ef336e8b80 protocol: fix wl_region version
wl_region is not a frozen interface and therefore should have the
version of the parent object, wl_compositor.

Signed-off-by: Julian Orth <ju.orth@gmail.com>
2026-02-28 10:44:25 +00:00
Simon Ser
7e47803e43 protocol: introduce wl_surface.get_release
This new request allows clients to get per-surface-commit buffer
release events. It supersedes wl_buffer.release.

This functionality is also available via the linux-explicit-synchronization
protocol, but requires the compositor to also support Linux
synchronization fences. Adding this new request to the core protocol
allows any compositor to implement the functionality.

Signed-off-by: Simon Ser <contact@emersion.fr>
Closes: https://gitlab.freedesktop.org/wayland/wayland/-/issues/203
References: https://gitlab.freedesktop.org/wayland/wayland/-/issues/46
2026-02-28 09:27:32 +00:00
Isaac Freund
72805582ee
doc: fix cname-(suffix-)requirements
These used to be macro-like xml things that expanded to the text this
commit replaces them with.

Signed-off-by: Isaac Freund <mail@isaacfreund.com>
2026-02-24 13:16:52 +01:00
Julian Orth
5231c0ee20 doc: restore missing image files in docbook
Signed-off-by: Julian Orth <ju.orth@gmail.com>
2026-02-12 15:45:57 +01:00
Julian Orth
4897da68e6 doc: turn captions into third-level headers in book
Signed-off-by: Julian Orth <ju.orth@gmail.com>
2026-02-12 15:17:33 +01:00
Julian Orth
bc7a55a134 doc: reword docbook foreword to capture new scope
Signed-off-by: Julian Orth <ju.orth@gmail.com>
2026-02-12 15:17:33 +01:00
Julian Orth
ddd4f65240 doc: remove most content from docbook
Signed-off-by: Julian Orth <ju.orth@gmail.com>
2026-02-12 15:17:33 +01:00
Julian Orth
1915dd17f0 doc: link to website in doxygen
Signed-off-by: Julian Orth <ju.orth@gmail.com>
2026-02-12 15:17:33 +01:00
Julian Orth
4f6ea74a0f doc: add meson.build for book
Signed-off-by: Julian Orth <ju.orth@gmail.com>
2026-02-12 15:17:33 +01:00
Julian Orth
cb4e8ada94 doc: rewrite the book foreword
Signed-off-by: Julian Orth <ju.orth@gmail.com>
2026-02-12 15:17:31 +01:00
Julian Orth
4bddeba215 doc: copy images to mdbook
Signed-off-by: Julian Orth <ju.orth@gmail.com>
2026-02-12 15:08:06 +01:00
Julian Orth
df7f2fb9e8 doc: add copyright notice to mdbook
Signed-off-by: Julian Orth <ju.orth@gmail.com>
2026-02-05 13:02:45 +01:00
Julian Orth
131b8d0dd0 doc: remove docbook -> mdbook conversion tool
Signed-off-by: Julian Orth <ju.orth@gmail.com>
2026-02-05 13:02:45 +01:00
Julian Orth
cff1224848 doc: run docbook -> mdbook conversion tool
To reproduce this commit, delete the contents of the src directory and
run the tool.

Signed-off-by: Julian Orth <ju.orth@gmail.com>
2026-02-05 13:02:45 +01:00
Julian Orth
5818c9361a doc: add docbook -> mdbook conversion tool
Signed-off-by: Julian Orth <ju.orth@gmail.com>
2026-02-05 13:02:45 +01:00
Pekka Paalanen
e12bbe4969 doc: make DocBook validation optional
It turns out that changes in the building environment, the version of
Doxygen being a prime suspect, can break the validation. Invalid DocBook
XML does lead to likely broken documentation, but perhaps it is better
than failing to build or having to disable documentation completely.

CI turns DocBook validation on, because the CI environment is stable and
known, and we do want to catch mistakes in hand-written DocBook files.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-02-04 15:12:04 +00:00
Julian Orth
dbf45d11a3 fix .git-blame-ignore-revs revision
The commit hash was changed during merge.

Signed-off-by: Julian Orth <ju.orth@gmail.com>
2026-02-02 14:00:28 +01:00
Julian Orth
a7ee144aec add .git-blame-ignore-revs file
This can be used with

    git config blame.ignoreRevsFile .git-blame-ignore-revs

Signed-off-by: Julian Orth <ju.orth@gmail.com>
2026-02-02 14:54:52 +02:00
Julian Orth
77b9eb7636 protocol: reindent wayland.xml
The file used a mixture of tabs and spaces. According to .editorconfig,
all xml files should be indented with spaces, so this seems like the
correct choice if we wanted to reindent the file.

I used vim's :retab command to expand all tabs to 8 spaces.

Signed-off-by: Julian Orth <ju.orth@gmail.com>
2026-02-02 14:54:52 +02:00
Julian Orth
bb7b284623 doc: update GPU buffer exchange section
Finally, a buffer exchange mechanism for the 21st century.

Signed-off-by: Julian Orth <ju.orth@gmail.com>
2026-01-29 14:17:16 +01:00
Pekka Paalanen
8b102c3bc4 doc/css: adjust code and userinput styles
I don't know why <code> was defined to be bold, it looks bad to me. The
same with <synopsis> which would inherit bold from <dt> when used inside
a variablelist term. So, to make the code snippets look better, force
them to use normal weight.

<userinput> should differentiate from normal code somehow, and italic
seems fine for it.

<literal> already has bold, and I think it's fine, so no need to touch
it.

These changes are mainly for the new XML dialect documentation chapter.
I didn't notice anything changing for the older or generated parts of the
docs.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
2026-01-22 11:08:28 +02:00
Pekka Paalanen
95c6014a7f doc: document the Wayland XML dialect
Document the XML tags used to describe Wayland protocols. Previously we
only had the informal specification in the Protocol chapter, and the
DTD. Better late than never.

I have looked into wayland-scanner and libwayland for various
limitations documented here possibly for the first time. I have also
forbid things that are not in use or are known broken, including
unspecified interface for a new_id in an event, or an object argument
with an unspecified interface.

I did investigate writing a RELAX NG compact schema for Wayland and
documenting everything there, then generating DocBook XML from it.
However, it seems generating documentation from schema is actually
really complicated. I found these tools:

- xs3p stylesheet: website looks dead, though Sourceforge still
  has it. Produces XHTML, not DocBook. Has an unfamiliar license.
- xsddoc: the authors wrote that XSLT is not really sufficient, so they
  abandoned this approach and went for Java to create xnsdoc.
- xnsdoc: seems to be proprietary licensed, although one could ask for a
  free license for a FLOSS project.

All in all, it seems to be much easier to just write the documentation
in DocBook, copying the strcture from the DTD manually, than to generate
it. It's not doing to change often, anyway. It also allowed me to
leverage DocBook syntax in full.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-01-22 11:08:28 +02:00
Pekka Paalanen
f7f08140c0 doc: fix a root element validation error
Once I got XML validation working in VSCode, it found an error:

  Document root element "preface", must match DOCTYPE root "chapter".

I guess DOCTYPE declares which element is used as root in the
file.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
2026-01-22 11:08:28 +02:00
Pekka Paalanen
11be42e8ea editorconfig: follow wayland-protocols XML style
It's unlikely that protocols/wayland.xml sees much change anymore, but
files in doc/ might. To make writing documentation easier, stick to an
unsurprising indentation style that is already in use in
wayland-protocols and for the XSL files.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
2026-01-22 11:08:28 +02:00
Sebastian Wick
1807450a7b doc: Add a chapter on content updates
The behavior of content updates, specifically in combination with sync
subsrufaces and constrains can become quite complicated. This introduces
a chapter in the wayland book which explains the behavior of the core
specification in this regard, and shows examples.

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2026-01-22 10:49:37 +02:00
Sebastian Wick
dd8afabdcc protocol: Define Content Update behavior
The protocol currently is in a state where we define that commits create
content updates and they are queued up until they are applied, and the
old view that commit applies the state or caches it in the parent state.

This commit moves the protocol completely to the new model which retains
the old behavior when no constraints are being used but allows for
constraints to be used to hold back a group of synchronized content
updates.

To convince yourself that this indeed retains the original behavior I
suggest to play around with a few examples and look at the resulting
graphs, as is done here:

https://gitlab.freedesktop.org/wayland/wayland/-/issues/457#note_2403135

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2026-01-22 10:49:37 +02:00
Pekka Paalanen
fc33162673 doc: drop non-existing refs from CSS
It seems these images were never in the repository. They might have
existed when the documentation was still built with Publican, but since
the migration to xmlto I think these have all been just 404.

Removing div.warning:before, div.note:before and div.important:before
would actually delete some unexpected empty space if the Docbook
<warning>, <note> or <important> elements were used. They are not used
now, but may be in the future.

.draft is never used, so I replaced the image with whatever.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-01-21 10:32:57 +02:00
Pekka Paalanen
924d79097b doc: remove unused CSS files
I could not find them referenced anywhere.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-01-21 10:32:57 +02:00
Pekka Paalanen
ad1692d111 doc: remove Revision_History.xml
This was never used.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-01-20 16:31:42 +02:00
Pekka Paalanen
0e0c0d5016 doc: remove Preface.xml
This was never filled out, so might as well just delete it.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2026-01-20 16:31:38 +02:00
Simon Ser
5a45a89a83 ci: install to prefix after building in Debian
Artifacts include the prefix directory, but it was empty: we
weren't running the install step. Run it to align Debian with
FreeBSD.

This allows reviewers to check the HTML documentation output.

Signed-off-by: Simon Ser <contact@emersion.fr>
2026-01-13 20:22:48 +00:00
Simon Ser
92229a00d1 ci: bump Debian to Trixie
Signed-off-by: Simon Ser <contact@emersion.fr>
2026-01-08 11:09:24 +00:00
Simon Ser
8c0947892b tests: cast pid_t and struct timeval fields before printing
The exact type behind these might depend on the architecture. For
instance, on ARMv7, struct timeval fields are long long int instead
of long int:

    FAILED: tests/libtest-runner.a.p/test-compositor.c.o
    cc -Itests/libtest-runner.a.p -Itests -I../tests -I. -I.. -Isrc -I../src -fdiagnostics-color=always -fsanitize=address,undefined -fno-omit-frame-pointer -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Werror -std=c99 -O0 -g -D_POSIX_C_SOURCE=200809L -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -fvisibility=hidden -fPIC -pthread -MD -MQ tests/libtest-runner.a.p/test-compositor.c.o -MF tests/libtest-runner.a.p/test-compositor.c.o.d -o tests/libtest-runner.a.p/test-compositor.c.o -c ../tests/test-compositor.c
    ../tests/test-compositor.c: In function 'get_socket_name':
    ../tests/test-compositor.c:95:60: error: format '%ld' expects argument of type 'long int', but argument 5 has type '__time64_t' {aka 'long long int'} [-Werror=format=]
       95 |         snprintf(retval, sizeof retval, "wayland-test-%d-%ld%ld",
          |                                                          ~~^
          |                                                            |
          |                                                            long int
          |                                                          %lld
       96 |                  getpid(), tv.tv_sec, tv.tv_usec);
          |                            ~~~~~~~~~
          |                              |
          |                              __time64_t {aka long long int}
    ../tests/test-compositor.c:95:63: error: format '%ld' expects argument of type 'long int', but argument 6 has type '__suseconds64_t' {aka 'long long int'} [-Werror=format=]
       95 |         snprintf(retval, sizeof retval, "wayland-test-%d-%ld%ld",
          |                                                             ~~^
          |                                                               |
          |                                                               long int
          |                                                             %lld
       96 |                  getpid(), tv.tv_sec, tv.tv_usec);
          |                                       ~~~~~~~~~~
          |                                         |
          |                                         __suseconds64_t {aka long long int}

Signed-off-by: Simon Ser <contact@emersion.fr>
2026-01-08 11:09:24 +00:00
Sebastian Wick
f72e3fae4a server: document protocol logger callback function
This fixes a validation error in the documentation which are not fatal.

The idea is the same as in 12ec67a ("server: document listener fields
and a vfunc"), which seems to have missed the reference to the
wl_protocol_logger_func_t from the note in wl_log_func_t.

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2026-01-03 15:16:50 +01:00
Pekka Paalanen
f9e6b471f7 doc: validate doc XML again
Now that all XML validation errors have been fixed, it is time to turn
the validation back on to make sure the errors stay out.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
2025-12-29 16:27:44 +02:00
Pekka Paalanen
4216a08b96 doc/xsl: rearrange member doc generation
Creating an empty <variablelist> is illegal. This can already be seen in
the XSL anywhere it is generated. The used XSL programming pattern
requires the look-up conditions to be repeated between the <xsl:if> and
<xsl:apply-templates> tags. Usually this is not a problem, but the
conditions for memberdef is too much to copy around.

The conditions between the if and the apply-templates have already
diverged, causing validation errors (that are currently suppressed).

Rearrange the XSL so that the applicable memberdef are stored in a
variable, so that both the if and the apply-templates operate on the
exact same set of matches. This avoids emitting empty <variablelist>.

As a result, the members of structures wl_argument, wl_interface,
wl_message, and wl_listener newly appear in the documentation.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
2025-12-29 16:27:42 +02:00
Pekka Paalanen
12ec67aed5 server: document listener fields and a vfunc
Adding these simple documentation comments allows us to have meaningful
link targets in the generated API documentation. That will help getting
rid of broken links which cause XML validation to fail.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
2025-12-29 16:27:14 +02:00
Pekka Paalanen
7736d8793b build/doc: explain two XML conversions
Now that I figured out what these do, I might as well add comments about
it for others.

The target names are changed to be more descriptive of what the target
does.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
2025-12-29 16:27:14 +02:00
Pekka Paalanen
da2e9b5c63 doc/xsl: include static inline functions
When generating documentation, xmllint complained:

  element link: validity error : IDREF attribute linkend references an
  unknown ID "Server-structwl__signal_1afe73f44f7f1b517c9c0ba90829c93309"

  element link: validity error : IDREF attribute linkend references an
  unknown ID "Server-structwl__signal_1afe73f44f7f1b517c9c0ba90829c93309"

  element link: validity error : IDREF attribute linkend references an
  unknown ID "Server-structwl__signal_1aa8bcd3b8e250cfe35ed064d5af589096"

These were referring to wl_signal_add() and wl_signal_emit() I think,
which are static inlines in a public header.

The XSLT ignored static functions, probably assuming that they cannot be
public API. Internal (static) functions are present in the Doxygen XML,
so they do need to be excluded. Now we include static functions if their
body is in a header. We de not scan private headers, so they must be
public API.

Comparing the final generated HTML documentation, these functions are
added to both Client and Server APIs:

  wl_fixed_to_double
  wl_fixed_from_double
  wl_fixed_to_int
  wl_fixed_from_int

These functions are added to the Server API:

  wl_signal_init
  wl_signal_add
  wl_signal_get
  wl_signal_emit

Signed-off-by: Pekka Paalanen <pq@iki.fi>
2025-12-29 16:26:41 +02:00
Pekka Paalanen
256f853261 doc: fix Xwayland image validity
xmllint complained:

  element imageobjectco: validity error : Element imageobjectco content
  does not follow the DTD, expecting (areaspec , imageobject ,
  calloutlist*), got (imageobject )

This image has no callouts (clickable items explained in the text), so
it must not use the tags that assume callouts.

I probably cargo-culted this from the X11 and Wayland diagrams which
have callouts when writing Xwayland.xml.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
2025-12-29 11:19:01 +02:00
Pekka Paalanen
d1b8f352c3 server: fix wl_signal_add Doxygen warning
$ meson compile -C build -v xml-Server-doc
INFO: autodetecting backend as ninja
INFO: calculating backend command to run: /usr/bin/ninja -C /home/pq/git/wayland/build -v doc/doxygen/xml/Server/combine.xslt doc/doxygen/xml/Server/index.xml
ninja: Entering directory `/home/pq/git/wayland/build'
[1/1] /home/pq/git/wayland/doc/doxygen/gen-doxygen.py --builddir=doc/doxygen/xml/Server --section=Server --output-format=xml doc/doxygen/wayland.doxygen ../doc/doxygen/../../src/wayland-util.h ../doc/doxygen/../../src/event-loop.c ../doc/doxygen/../../src/wayland-server.c ../doc/doxygen/../../src/wayland-server.h ../doc/doxygen/../../src/wayland-server-core.h ../doc/doxygen/../../src/wayland-shm.c
/home/pq/git/wayland/src/wayland-server-core.h:394: warning: explicit link request to 'wl_signal_add' could not be resolved

I don't know why, but the "explicit link" mark-up fails, while the
automatic link mark-up works. This warning disappears.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
2025-12-29 11:19:01 +02:00
Pekka Paalanen
e1e8ccd4ae doc: reinstate image maps
This fixes the errors during the compilation of Architecture.xml that
the .map files cannot be found. As a result, the architure diagrams
become clickable in the HTML document once again.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
2025-12-29 11:19:01 +02:00
Pekka Paalanen
573c95cb1a doc/xsl: fix malformed <variablelist>
For all requests and events that do not have any arguments, enabling XML
validation would lead to many errors like this:

/home/pq/git/wayland/build/doc/publican/Wayland.xml:5287: element
variablelist: validity error : Element variablelist content does not
follow the DTD, expecting (blockinfo? , (title , titleabbrev?)? ,
(caution | important | note | tip | warning | literallayout |
programlisting | programlistingco | screen | screenco | screenshot |
synopsis | cmdsynopsis | funcsynopsis | classsynopsis | fieldsynopsis |
constructorsynopsis | destructorsynopsis | methodsynopsis | formalpara |
para | simpara | address | blockquote | graphic | graphicco |
mediaobject | mediaobjectco | informalequation | informalexample |
informalfigure | informaltable | anchor | bridgehead | remark |
highlights | abstract | authorblurb | epigraph | indexterm | beginpage)*
, varlistentry+), got

The reason is that a <variablelist> without any <varlistentry> inside it
is illegal.

If there are no <arg> at all, do not emit the list paragraph.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
2025-12-29 11:15:11 +02:00
Pekka Paalanen
0519f2fbf8 doc: remove HTML_TIMESTAMP
to fix the Doxygen message:

  warning: Tag 'HTML_TIMESTAMP' at line 8 of file '-' has become
  obsolete.  To avoid this warning please remove this line from your
  configuration file or upgrade it using "doxygen -u"

Observed with Doxygen 1.9.8.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
2025-12-29 11:15:10 +02:00
Pekka Paalanen
5b59b34a27 editorconfig: indent .xsl with 2 spaces
The XSL files are mostly indented with 2 spaces. Using the default
editorconfig rules in VSCode constantly tries to mix in tabs. Add the
2-space rule for .xsl files to fix this.

The .xsl files, like .xml files, use a tab character in place of 8
spaces. This complicates things, and the new rule will prefer just
spaces. To keep the existing sometimes-tab-indented code looking right,
the tab width must be explicitly set to 8.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
2025-12-29 11:15:10 +02:00
Joshua Watt
99638501a1 tests/event-loop-test: Remove event loop timer test
The event loop timer test has very precise sequencing and timing
constraints, which make it difficult to pass reliably on loaded systems.
Since this test isn't providing much value, remove it to prevent the
erroneous errors.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
2025-12-12 11:48:19 +00:00
Sebastian Wick
bbb5fa66a7 doc: Refactor the build system for complete build dir docs
By structuring things differently, it becomes possible to have a
complete build of the docs in the build dir, without having to install
anything.

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2025-11-27 17:39:11 +02:00
Sebastian Wick
c8a0996703 build: Bump to meson version 0.64.0
This version will be required in the next commit.

Bumps the CI image to get the required version from the debian package
instead of from pip.

Removes the bindir builtin directory from pkgconfig.generate() which is
deprecated since 0.62.0. It will be automatically included when
referenced.

Use `meson setup` everywhere instead of relying on deprecated automatic
detection of the setup command.

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2025-11-27 17:39:11 +02:00
Julian Orth
dfab16e236 protocol: add new formats
Generated from libdrm 2.4.129.

Signed-off-by: Julian Orth <ju.orth@gmail.com>
2025-11-26 10:47:34 +01:00
Isaac Freund
d81525a235 client: add wl_display_dispatch_pending_single
As well as wl_display_dispatch_queue_pending_single.

The motivation is writing libwayland bindings for a dynamic language
with exceptions/non-local returns. Since it is invalid for a
wl_dispatcher_func_t callback provided to libwayland to not return,
there is no way to prevent dispatching of further events in the case of
an exception in the dynamic language event handler.

Furthermore, since creating/destroying Wayland objects in an event
handler affects the dispatching of subsequent events by libwayland,
it is not possible to collect Wayland events in a queue outside
libwayland and dispatch them one-by-one after
wl_display_dispatch_pending() returns.

Adding libwayland API to dispatch at most one pending event solves this
problem cleanly. The bindings can have libwayland dispatch a single
event, wait for wl_display_dispatch_pending_single() to return, run the
dynamic language event handler (which may longjmp away), and continue
the loop for as long as there are more events to dispatch.

References: https://codeberg.org/ifreund/janet-wayland
Signed-off-by: Isaac Freund <mail@isaacfreund.com>
2025-09-16 11:48:33 +03:00
Kyle Brenneman
4673ef7e9c connection: Add a thread ID to WAYLAND_DEBUG output.
If WAYLAND_DEBUG contains the token "thread_id", and gettid() is
available, then include the current thread ID in the output from
wl_closure_print.

If multiple threads are sending requests, then those requests can get
interleaved. That's usually fine, but for wl_surface requests and
commits, that can cause problems ranging from incorrect behavior to
protocol errors.

Being able to see which requests are sent by different threads would
make such problems much easier to diagnose.

Signed-off-by: Kyle Brenneman <kbrenneman@nvidia.com>
2025-09-15 14:45:53 +01:00
Kyle Brenneman
77730f10a0 connection: Add a function to parse WAYLAND_DEBUG tokens
Add a new function, wl_check_env_token, to scan for a token in a
comma-separated string.

Change wl_display_create in wayland-server.c and
wl_display_connect_to_fd in wayland-client.c to use that instead of a
simple substring search.

This means that WAYLAND_DEBUG will accept a value like "client,server"
but not "clientserver". But, this will make it easier to add other
tokens without worrying about overlap between them.

Signed-off-by: Kyle Brenneman <kbrenneman@nvidia.com>
2025-09-15 14:45:53 +01:00
YaoBing Xiao
264da6a92b cursor: Free theme when size check fails to avoid memory leak
Signed-off-by: YaoBing Xiao <xiaoyaobing@uniontech.com>
2025-08-03 11:36:34 +00:00
ykla
cd0d1543c0 ci: upgrade FreeBSD to 14.3
Signed-off-by: ykla yklaxds@gmail.com
2025-07-20 02:09:35 +00:00
ykla
90187031e6
ci: upgrade FreeBSD to 14.2
Signed-off-by: ykla <yklaxds@gmail.com>
2025-06-25 07:18:28 +08:00
Simon Ser
eecf3f7635 build: re-open main branch for regular development
Signed-off-by: Simon Ser <contact@emersion.fr>
2025-06-21 13:38:28 +02:00
Demi Marie Obenour
adf84614ca connection: Do not busy-loop if a message exceeds the buffer size
If the length of a message exceeds the maximum length of the buffer, the
buffer size will reach its maximum value and stay there forever, with no
message ever being successfully processed.  Since libwayland uses
level-triggered epoll, this will cause the compositor to loop forever
and consume CPU time.  In libwayland 1.22 and below, there was an
explicit check that caused messages exceeding 4096 bytes to result in an
EOVERFLOW error, preventing the loop.  However, this check was removed
between d074d52902 ("connection: Dynamically resize connection buffers").

To prevent this problem, always limit the size of messages to 4096 bytes.
Since the default and minimum buffer size is 4096 bytes, this ensures
that a single message will always fit in the buffer.  It would be
possible to allow larger messages if the buffer size was larger, but the
maximum size of a message should not depend on the buffer size chosen by
the compositor.

Rejecting messages that exceed 4092 bytes seems to have the advantage of
reserving 4 bits, not 3, in the size field for future use.  However,
message sizes in the range [0x0, 0x7] are invalid, so one can obtain a
fourth bit by negating the meaning of bit 12 if bits 0 through 11
(inclusive) are 0.  Allowing 4096-byte messages provides the far more
important advantage that regressions compared to 1.22 are impossible
and regressions compared to 1.23 are extremely unlikely.  The only case
where a regression is possible is:

- The receiving side is using libwayland 1.23.
- The sending side is either using libwayland 1.23 or is not using
  libwayland.
- The sender sends a message exceeding 4096 bytes.
- If the sender of the large message is the client, the server has
  increased the buffer size from the default value.

This combination is considered extremely unlikely, as libwayland 1.22
and below would disconnect upon receiving such a large message.
4096-byte messages, however, have always worked, so there was no reason
to avoid sending them.

Fixes: d074d52902 ("connection: Dynamically resize connection buffers").
Fixes: #494
Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
2025-06-21 11:29:04 +00:00
Pekka Paalanen
ba9f9a446f doc: add a section on color management
I think the docbook deserves an introduction to how color management is
designed in Wayland, aimed at people who are familiar with pixels but
new to the topic.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-06-12 14:37:32 +03:00
Matt Turner
53fbc2b0c1 egl: Make wayland-egl symbols check depend on wayland_egl
Closes: https://gitlab.freedesktop.org/wayland/wayland/-/issues/515
Signed-off-by: Matt Turner <mattst88@gmail.com>
2025-06-08 17:30:55 +00:00
Matt Turner
fdac631d17 tests: Depend on exec-fd-leak-checker
Closes: https://gitlab.freedesktop.org/wayland/wayland/-/issues/514
Signed-off-by: Matt Turner <mattst88@gmail.com>
2025-06-08 17:30:55 +00:00
Matt Turner
6c1da92018 tests: Add support for specifying runtime dependencies
Signed-off-by: Matt Turner <mattst88@gmail.com>
2025-06-08 17:30:55 +00:00
Matt Turner
ca83185e8a tests: Make tests dict elements dicts themselves
Previously each value was a list of extra sources. The next commit will add an
additional field to each test, so they need to be dicts themselves.

Signed-off-by: Matt Turner <mattst88@gmail.com>
2025-06-08 17:30:55 +00:00
Manuel Stoeckl
4a0c4e2119 doc: Further explain typical display socket lookup
This change mentions the case where WAYLAND_SOCKET is used, which helps
people avoid just testing 'getenv(WAYLAND_DISPLAY)' to see if a
Wayland compositor is available;

Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
2025-06-08 16:20:35 +00:00
Manuel Stoeckl
387adc6a79 server: Document wl_display_add_socket_auto
The exact sequence of names tried has de facto become part of the API.

Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
2025-06-08 16:20:35 +00:00
Tobias Stoeckmann
0de833da29 cursor: Properly check realloc for errors
Do not override realloc's input pointer before checking for errors,
otherwise it's not possible to keep old value, as intended.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2025-06-08 16:16:09 +00:00
Tobias Stoeckmann
2978fd701a cursor: Ignore invalid cursor files
The header offset must not be smaller than file header length.
Ignore such invalid files.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2025-06-08 16:16:09 +00:00
Tobias Stoeckmann
5c2f31d8d6 cursor: Gracefully handle huge cursor files
If cursor files require more than INT_MAX bytes, it is possible to
trigger out of boundary writes.

Since these sizes are most likely not desired anyway, gracefully
handle these situations like out of memory errors.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2025-06-08 16:16:09 +00:00
Tobias Stoeckmann
ce0ac4f29e cursor: Gracefully handle out of memory condition
If the full path could not be constructed, avoid calling opendir(NULL)
which, depending on library, might trigger undefined behavior.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2025-06-08 16:16:09 +00:00
Tobias Stoeckmann
1bee7aa4a7 cursor: Fix undefined behavior with huge names
If an index.theme contains a theme name which gets close to INT_MAX,
then creation of full path can lead to a signed integer overflow,
which is undefined behavior.

Fix this by turning one of the values to size_t. Easy solution for a
probably never occurring issue.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2025-06-08 16:16:09 +00:00
Kirill Primak
6281ccbd3d client: fix conversion specifier in the discarded event log message
Signed-off-by: Kirill Primak <vyivel@eclair.cafe>
2025-06-01 14:56:34 +03:00
Caitlyn
ecff0ee10c debug: Colorize output for easier reading
Signed-off-by: Caitlyn <caitlynrosestewart@gmail.com>
2025-06-01 11:21:36 +00:00
Caitlyn Stewart
827d0c30ad connection: fix segfault in wl_closure_invoke()
Signed-off-by: Caitlyn Stewart <caitlynrosestewart@gmail.com>
2025-05-27 14:45:32 +01:00
Simon Ser
62cd0990e8 build: bump version to 1.23.90 for the RC1 release
Signed-off-by: Simon Ser <contact@emersion.fr>
2025-05-22 21:00:30 +02:00
Simon Ser
9b169ff945 protocol: drop reference to linux-explicit-synchronization
This protocol has been superseded. Replace this outdated reference
with a generic hint that protocol extensions may provide this
functionality.

Signed-off-by: Simon Ser <contact@emersion.fr>
2025-05-20 20:57:52 +00:00
Tobias Stoeckmann
cc06c3825f Fix typos
Typos found with codespell and during code audit.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2025-05-20 20:49:32 +00:00
Isaac Freund
8cad6f7b82 server: add wl_resource_get_interface()
This is useful for the wayland bindings/scanner I'm working on for a
dynamically typed language.

Signed-off-by: Isaac Freund <mail@isaacfreund.com>
2025-05-20 20:31:16 +00:00
Isaac Freund
4497232102 client: add wl_proxy_get_interface()
This is useful for the wayland bindings/scanner I'm working on for a
dynamically typed language.

Signed-off-by: Isaac Freund <mail@isaacfreund.com>
2025-05-20 20:31:16 +00:00
David Edmundson
3214f858e2 protocol: Clarify sending of wl_seat.capabilities
It wasn't explicitly stated that wl_seat.capabilities should also
be sent on bind. Everyone did because it was obviously sensible.

This also clarifies that static seat name should be sent before
announcing capabilities so clients can associate these devices with the
right seat name.

Signed-off-by: David Edmundson <davidedmundson@kde.org>
2025-05-20 20:20:13 +00:00
Simon Ser
66fc3f007d shm: linkify function references in docs
Parentheses make it so the generated HTML documentation contains
links, which makes navigation easier.

Signed-off-by: Simon Ser <contact@emersion.fr>
2025-05-20 20:14:52 +00:00
Simon Ser
9dd1b2d7e3 shm: fix comment about wl_shm_buffer_begin_access() safety
The paragraph later says that accessing different buffers is
allowed. The function checks whether the same pool is accessed.

Signed-off-by: Simon Ser <contact@emersion.fr>
2025-05-20 20:14:52 +00:00
Sebastian Wick
d2a3d33063 shm: Generate an error when shm access failed even without a resource
Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2025-05-20 21:50:22 +02:00
Sebastian Wick
9367c4da76 shm: Add wl_shm_buffer ref and unref functions
Shared memory buffers are currently tied to the lifetime of their
underlying wl_buffer resource. This becomes problematic when the client
destroys the resource after committing new state which references the
wl_buffer because a compositor might have to defer applying the commit.

This commit adds methods to keep the wl_shm_buffer alive longer than the
underlying resource. This implicitly also keeps the buffer pool alive
and because the wl_shm_buffer uses offsets into the pool, it even works
when the underlying storage gets remapped somewhere else, which can
happen when the client resizes the pool.

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2025-05-20 21:50:22 +02:00
Sebastian Wick
af453f876e shm: Remove refcount check which cannot be triggered
If the pool refcount reaches zero, it is freed, so accessing its members
is UB which ASan would catch.

Also simplify check for negative refcounts.

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2025-05-20 21:50:09 +02:00
Sebastian Wick
9ec01ab2dc shm: Linkify wl_shm_pool_unref in the ref_pool documentation
Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2025-05-20 21:30:56 +02:00
Michel Dänzer
6137c8c213 protocol: Clarify wl_buffer.release description
Sebastian pointed out that the existing text could be read as
wl_buffer.destroy not being allowed before the wl_buffer.release event
arrives, contrary to what the wl_surface.attach description says.
Clarify to be consistent with the latter.

This is a follow-up for
https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/141 .

Signed-off-by: Michel Dänzer <mdaenzer@redhat.com>

v2:
* Simplify clarification, don't talk about callbacks. (Julian Orth)
* Add reference to details in the description of wl_surface.attach.
  (Daniel Stone)
v3:
* Tweak clarification again. (Sebastian Wick)
v4:
* Make clarification even less ambiguous. (Simon Ser, Julian Orth)
v5:
* Just refer to the description of wl_surface.attach instead of trying
  to clarify anything here. (Sebastian Wick)
2025-03-15 23:12:07 +00:00
Julian Orth
7033e74857 client: document get_listener behavior for dispatchers
This seems to have been the case since 2013.

This is useful for wrappers that need two pointers to identify proxies.
One pointer (stored in the user data) pointing to a singleton object to
identify that the proxy has a known structure. And one pointer (stored
in the dispatcher data) pointing to per-proxy data.

Signed-off-by: Julian Orth <ju.orth@gmail.com>
2025-03-15 23:07:39 +00:00
Simon Ser
dbfa8d784e scanner: use separate guards for validator functions
Generated XXX_is_valid() functions for enums are guarded behind the
same #define as the enum itself. This worked fine until recently,
but since fbd7460737 ("scanner: add new enum-header mode") we're
also generating enum-only headers.

When including the enum-only header first, and then the server
header, the validator functions are missing.

Define a separate guard to fix this.

Signed-off-by: Simon Ser <contact@emersion.fr>
2025-02-23 23:38:15 +01:00
Vlad Zahorodnii
1ab6b693b1 Forward declarate timespec struct
The `timespec` struct is defined in `time.h` header but only if
`_POSIX_C_SOURCE` is set or when using the C11 standard.

Signed-off-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
2025-02-06 10:18:17 +00:00
David Redondo
afd498b6f5 Also use [[deprecated]] when compiling with at least C++14
Signed-off-by: David Redondo <kde@david-redondo.de>
2025-02-05 09:43:21 +01:00
David Redondo
7c2ffb0d71 Make wayland-util.h -Wundef safe when compiled by a C++ compiler
Fixes #522
Signed-off-by: David Redondo <kde@david-redondo.de>
2025-02-05 09:21:43 +01:00
Daniel Stone
02ad102e2d build: Add -lm to pkg-config dependencies
Now that wl_fixed_from_double() calls round() from a function declared
in a header, our users need to explicitly pick that dependency up in
order to avoid build errors.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Closes: wayland/weston#991
2025-02-05 06:52:53 +00:00
Sebastian Wick
74f322c35a tests: Add dispatch timeout tests
Add tests which verify that...

* wl_display_dispatch_timeout with a big enough timeout behaves the same
  as wl_display_dispatch
* wl_display_dispatch_timeout will time out when there are no messages
  to dispatch

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2025-02-04 14:09:51 +00:00
Sebastian Wick
00dcf6b323 client: Add wl_display_dispatch_timeout
A variant of wl_display_dispatch_queue_timeout for the default queue.

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2025-02-04 14:09:51 +00:00
Sebastian Wick
ddd348da7e client: Add wl_display_dispatch_queue_timeout
For dispatching messages on a queue with a timeout.

This slightly changes the samantics of wl_display_dispatch. Previously
it was possible for it to return even though there wasn't a single
dispatched event. The function correctly returned 0 in this case but it
is now used to indicate a timeout.

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2025-02-04 14:09:51 +00:00
Sebastian Wick
ff8b885523 event-loop: Use timespec utils instead of hand-rolling our own
Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2025-02-04 14:09:51 +00:00
Sebastian Wick
893e4fc46d timespec: Implement saturating timespec substraction
Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2025-02-04 14:09:51 +00:00
Sebastian Wick
9d5de6062b timespec: Pull in timespec_after and timespec_add from mesa
Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2025-02-04 14:09:51 +00:00
Sebastian Wick
37469d5ced timespec: Pull in timespec.h from weston
Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2025-02-04 14:09:51 +00:00
Sebastian Wick
bdba21ec92 server: add const qualifier to function arguments where possible
Makes it possible to e.g. `call wl_client_get_credentials` with a `const
struct wl_client *` from a global filter callback.

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2025-01-22 14:28:50 +00:00
Daniel Stone
597a6b94f5 ci: Update ci-templates
This includes an explicit way to specify the container architecture,
which fixes our rebuilds on ARMv7.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2025-01-21 16:43:45 +00:00
Haihua Hu
f246e619d1 util: reduce error of wl_fixed_from_double()
when cast double to fixed pointer, there will be big
error, eg 1919.9998 to 1919. Call round before cast
to get nearest value 1920 of 1919.9998

Signed-off-by: Haihua Hu <jared.hu@nxp.com>
2025-01-09 09:58:32 +09:00
Demi Marie Obenour
9cb3d7aa9d connection: Fix wrong format string
Prevents undefined behavior if there is not enough space in the buffer
for a queued message.

Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
2024-11-30 16:02:55 -05:00
Demi Marie Obenour
290c36bc50 tests: Avoid calling function with wrong type
Calling a function with the wrong type is immediate undefined behavior,
even if the ABI says it should be harmless.  UBSAN picks it up
immediately, and any decent control-flow integrity mechanism will as
well.

Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
2024-11-30 11:31:36 -05:00
Demi Marie Obenour
4273a5edc8 connection: Avoid undefined pointer arithmetic
Creating a pointer that is more than one element past the end of an
array is undefined behavior, even if the pointer is not dereferenced.
Avoid this undefined behavior by using `p >= end` instead of
`p + 1 > end` and `SOMETHING > end - p` instead of
`p + SOMETHING > end`.

Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
2024-11-29 19:19:45 -05:00
Julian Orth
10df74c240 protocol: add wl_fixes interface
This commit describes a new wl_fixes interface that can be used to
destroy wl_registry objects.

Users of libwayland-client should use it as follows:

- call wl_fixes_destroy_registry(registry)
- call wl_registry_destroy(registry)

Users of libwayland-server should, in their implementation of the
request, call wl_resource_destroy(registry).

It should be similar in other protocol implementations.

Signed-off-by: Julian Orth <ju.orth@gmail.com>
2024-11-18 09:25:20 +00:00
YaoBing Xiao
f67db75ec1 cursor: add check to ensure wl_shm_create_pool succeeded
Signed-off-by: YaoBing Xiao <xiaoyaobing@uniontech.com>
2024-10-18 16:49:45 +08:00
Simon Ser
38f91fe6ad protocol: document that wl_surface.offset is role-specific
This request doesn't make sense for all surface roles. For instance,
for maximized/tiled/fullscreen xdg_toplevel, for xdg_popup, for
layer-shell surfaces, etc.

Signed-off-by: Simon Ser <contact@emersion.fr>
2024-10-05 14:06:51 +00:00
Andri Yngvason
1b0d45e9c6 Add wl_keyboard key repeat events
This allows the compositor to take over the responsibility of repeating
keys.

Signed-off-by: Andri Yngvason <andri@yngvason.is>
2024-09-23 15:23:45 +00:00
Julian Orth
7c6259e9ad protocol: clients should not emulate key-press events on enter
The previous change introducing the logical state caused some confusion.
Clarify that most application should not use the list of pressed keys.

Signed-off-by: Julian Orth <ju.orth@gmail.com>
2024-09-10 07:36:48 +00:00
Demi Marie Obenour
6c4a695045 connection: Reject strings containing NUL bytes
libwayland cannot construct these messages as it uses strlen() to
determine string lengths.  libwayland is also guaranteed to misinterpret
these messages, since message handlers only get a pointer and no length.
Therefore, reject strings containing NUL bytes.

Also remove a redundant check from the unmarshalling code.  The
zero-length case has already been checked for.

Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
2024-08-18 17:08:56 +00:00
Joaquim Monteiro
0239b082b9
meson: Fix use of install_data() without specifying install_dir
This was broken (when in a subproject) before Meson 1.3.0, and so
Meson warns against this unless the project targets 1.3.0 or newer.

Signed-off-by: Joaquim Monteiro <joaquim.monteiro@protonmail.com>
2024-08-15 14:13:57 +01:00
Fangzhou Ge
5b692b50b9 client: Log the object and methods when marshalling or sending fails
The log that appears before a display_error can be captured as crash
signature. Useful to know what it is.

This is cherry-picked from chromium https://crrev.com/c/4697877

Signed-off-by: Fangzhou Ge <fangzhoug@chromium.org>
2024-08-12 15:49:14 -04:00
Simon Ser
efa648056a ci: use detached MR pipelines
See the freedesktop wiki [1]. This allows external contributors to
have CI run properly.

[1]: https://gitlab.freedesktop.org/freedesktop/freedesktop/-/wikis/GitLab-CI#for-project-developers

Signed-off-by: Simon Ser <contact@emersion.fr>
2024-08-09 20:46:58 +00:00
Derek Foreman
58bb6c7211 src: Finish assert() clean-up
From cleanup commit 0cecde304:
assert()s can be compiled away by #defining NDEBUG. Some build systems
do this. Using wl_abort gives a human readable error message and it
isn't compiled away.

That commit missed one final assert, presumably due to missing it with
grep because of a coding style issue. Fix that up, and remove inclusion
of <assert.h> as appropriate.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-08-09 20:38:52 +00:00
Sebastian Wick
2bbd80c8df doc: Require strings to be UTF-8
Nothing checks this yet but this gives us the opportunity to do so when
we want.

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2024-08-09 20:33:05 +00:00
Kirill Primak
65454cf7db server: expose wl_resource_post_error_vargs()
Signed-off-by: Kirill Primak <vyivel@eclair.cafe>
2024-08-09 20:29:24 +00:00
Kirill Primak
64248963d3 server: add wl_resource_post_error() docs
Signed-off-by: Kirill Primak <vyivel@eclair.cafe>
2024-08-09 20:29:24 +00:00
Kirill Primak
a6a4e081da Put WL_DEPRECATED in front of the function declarations
This fixes the following clang error when using C23:

../src/wayland-server-core.h:680:41: error: 'deprecated' attribute cannot be applied to types
  680 |                      int32_t stride, uint32_t format) WL_DEPRECATED;
      |                                                       ^
../src/wayland-util.h:52:25: note: expanded from macro 'WL_DEPRECATED'
   52 | #define WL_DEPRECATED [[deprecated]]
      |                         ^

Signed-off-by: Kirill Primak <vyivel@eclair.cafe>
2024-08-09 20:25:11 +00:00
Sebastian Wick
f6f0a3cdec client: Handle proxies with no queue
wl_proxy_get_queue can return NULL if the queue of the proxy was already
destroyed with wl_event_queue_destroy. In this case, the queue also has
no name anymore.

Fixes: b42218f ("client: Allow setting names for queues")
Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2024-07-26 18:33:28 +02:00
meltq
0cecde304f src: switch asserts to wl_abort
assert()s can be compiled away by #defining NDEBUG. Some build systems
do this. Using wl_abort gives a human readable error message and it
isn't compiled away. This commit closes issue #230.

Signed-off-by: meltq <tejasvipin76@gmail.com>
2024-07-11 17:44:04 +00:00
Simon Ser
fa1811ce3e tests: add enum bitfield test
Signed-off-by: Simon Ser <contact@emersion.fr>
2024-07-09 18:22:10 +02:00
Simon Ser
c669d99259 scanner: fix validator for bitfields
Bitfields are valid if the value only contains bits inside of
the supported entries for the given version.

Signed-off-by: Simon Ser <contact@emersion.fr>
2024-07-09 18:22:10 +02:00
Simon Ser
caaa308c0d scanner: extract validator function emission to helper function
This function will grow in the next commit.

Signed-off-by: Simon Ser <contact@emersion.fr>
2024-07-09 18:22:10 +02:00
Simon Ser
1d5772b7b9 build: re-open main branch for regular development
Signed-off-by: Simon Ser <contact@emersion.fr>
2024-05-30 21:07:24 +02:00
Simon Ser
a156431ea6 build: bump to version 1.23.0 for the official release
Signed-off-by: Simon Ser <contact@emersion.fr>
2024-05-30 20:59:51 +02:00
Hugo Osvaldo Barrera
26c419e046 protocol: clarify divergence in compositor behaviour
This is intended to only document the current situation. Whether further
behaviour will be defined is out of scope and left for protocol v7.

See: https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/363
Signed-off-by: Hugo Osvaldo Barrera <hugo@whynothugo.nl>
2024-05-29 14:23:38 +02:00
Simon Ser
0b1626f473 build: bump to version 1.22.93 for the RC1 release
Signed-off-by: Simon Ser <contact@emersion.fr>
2024-05-23 18:12:41 +02:00
Simon Ser
4bade62938 server: document wl_display_add_socket_fd() ownership
wl_socket_destroy() will close the socket.

Signed-off-by: Simon Ser <contact@emersion.fr>
2024-05-22 08:55:03 +00:00
Vlad Zahorodnii
17965d99e8 server: Clarify fd ownership in wl_client_create()
It's unclear whether one needs to call close() if wl_client_create()
fails. Hopefully this change makes it more clear.

Signed-off-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
2024-05-16 12:57:42 +03:00
Simon Ser
f870320958 build: bump to version 1.22.92 for the beta release
Signed-off-by: Simon Ser <contact@emersion.fr>
2024-05-09 16:50:40 +02:00
Julian Orth
9e4f256927 protocol: explicitly describe wl_keyboard state
And the allowed state transitions.

There has been some confusion regarding which state transitions are
allowed. This change should clarify this.

Signed-off-by: Julian Orth <ju.orth@gmail.com>
2024-05-09 14:43:19 +00:00
Simon Ser
6963320218 build: bump to version 1.22.91 for the alpha release
Signed-off-by: Simon Ser <contact@emersion.fr>
2024-04-25 17:46:07 +02:00
Derek Foreman
e60c631ff2 client: print debug events that have no listener
Currently WAYLAND_DEBUG text ignores events that have no listener.

It can be helpful to know when you're receiving unhandled events,
as you may have forgotten to add a listener, or adding a dispatch
may have magically seemed to fix code that doesn't appear to be
dispatching anything.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-04-24 16:40:18 +00:00
Sebastian Wick
9069af78a7 protocol: define content updates and their internal queue
Multiple protocols use the term content update without a fill
definition. It makes sense to define it in the core protocol so that not
every other protocol has to define it.

This is supposed to retain the current semantics and only changes the
documentation while defining new terms.

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2024-04-24 16:32:06 +00:00
Simon Ser
6e1db53916 client: fix invalid doc command for WL_MARSHAL_FLAG_DESTROY
Fixes the following warning:

    src/wayland-client-core.h:125: warning: Found non-existing group 'wl_proxy' for the command '@ingroup', ignoring command

"\memberof" cannot be used here because it only works on functions.
The docs for "\memberof" say that "\relates" works in a similar way.

While at it, use a "\" command instead of a "@" command for
consistency with the rest of the file.

Signed-off-by: Simon Ser <contact@emersion.fr>
2024-04-24 16:27:50 +00:00
Simon Ser
80c65f862f tests: add deprecated-since attributes
Add a new event and enum entry to small.xml with a deprecated-since
attribute to exercise the scanner code generation.

Signed-off-by: Simon Ser <contact@emersion.fr>
2024-04-24 16:18:28 +00:00
Simon Ser
da8e1bbc45 protocol: mark wl_pointer.axis_discrete as deprecated
Since version 8, this event isn't sent anymore.

Signed-off-by: Simon Ser <contact@emersion.fr>
2024-04-24 16:18:28 +00:00
Simon Ser
ee12e69b8f Add support for the deprecated-since XML attribute
This marks a request, event or enum entry as deprecated since a
given version.

Note that it's not clear what it means if an entry is deprecated
at some version, and the enum is used from some completely different
interface than where it was defined. However, that's a more general
issue with enums, see:
https://gitlab.freedesktop.org/wayland/wayland/-/issues/435

Signed-off-by: Simon Ser <contact@emersion.fr>
References: https://gitlab.freedesktop.org/wayland/wayland/-/issues/89
2024-04-24 16:18:28 +00:00
Chloé Vulquin
16aee2ec38 xcursor: catch theme inheritance loops
As of currently, when an xcursor theme depends on itself or another theme
that will eventually depend on it, `xcursor_load_theme` will recurse
infinitely while processing the inherits.

This change introduces a stack-allocated linked list of visited nodes
by name, and skips any already visited nodes in the inherit list.

Side effects:
* Since the linked list is stack-allocated, there is a potential for an
  overflow if there is a very long list of dependencies. If this turns out
  to be a legitimate concern, the linked list is trivial to convert to
  being heap-allocated.
* There is an existing linked list (technically doubly linked list)
  implementation in the wayland codebase. As of currently, the xcursor
  codebase does not refer to it. Consequently, this change writes a
  minimal single linked list implementation to utilize directly.

This changeset fixes #317.

Signed-off-by: Chloé Vulquin <toast@bunkerlabs.net>
2024-04-24 12:28:38 +02:00
Simon Ser
b258d5f361 scanner: add validators for enums
Right now compositors need to manually check that enum values sent
by the client are valid. In particular:

- Check that the value sent by the client is not outside of the enum.
- Check that the version of the enum entry is consistent with the
  object version.

Automatically generate validator functions to perform these tasks.

Signed-off-by: Simon Ser <contact@emersion.fr>
Closes: https://gitlab.freedesktop.org/wayland/wayland/-/issues/104
2024-04-23 09:17:02 +00:00
Julian Orth
5eeaac6e11 Clarify behavior of buffer transformations
The new text describes how

- Mutter
- Plasma
- Sway 1.8
- Jay

behave.

Sway 1.9 flipped the behavior of 90 degree and 270 degree
set_buffer_transform requests. [mpv] also changed the behavior of its
vo_wayland_dmabuf backend which makes it only work correctly on sway
1.9.

[mpv]: https://github.com/mpv-player/mpv/pull/12509

It seems that the previous text was open to interpretation or at least
caused some amount of confusion.

Signed-off-by: Julian Orth <ju.orth@gmail.com>
2024-04-23 09:08:09 +00:00
Colin Kinloch
af1dc3ef4b protocol: Undefine wl_display_sync callback data
Signed-off-by: Colin Kinloch <colin.kinloch@collabora.com>
2024-04-23 08:43:44 +00:00
6t8k
03e304544b
cursor: memfd_create: try MFD_NOEXEC_SEAL
Effective from Linux 6.3 onward, this creates the memfd without execute
permissions and prevents that setting from ever being changed. A
run-time fallback is made to not using MFD_NOEXEC_SEAL when a
libwayland-cursor compiled on Linux >= 6.3 is run on Linux < 6.3.

This is a defense-in-depth security measure and silences a respective
kernel warning; see: https://lwn.net/Articles/918106/

This implementation is adopted from dnkl's `foot` terminal emulator.

Signed-off-by: 6t8k <6t8k@noreply.codeberg.org>
2024-04-21 19:17:46 +02:00
Simon Ser
c5d145a602 ci: turn on -Dwerror=true for FreeBSD
It was turned on for Linux only.

Signed-off-by: Simon Ser <contact@emersion.fr>
2024-04-09 00:48:18 +00:00
Simon Ser
37699a98b1 ci: use --fatal-meson-warnings
Turns Meson warnings into errors. Useful to avoid missing warnings.

Signed-off-by: Simon Ser <contact@emersion.fr>
2024-04-09 00:48:18 +00:00
Simon Ser
e7df1f2af2 build: bump minimum Meson version to 0.57
Fixes the following warning:

    tests/meson.build:91: WARNING: Project targets '>= 0.56.0' but uses feature introduced in '0.57.0': env arg in run_target.

Signed-off-by: Simon Ser <contact@emersion.fr>
2024-04-09 00:48:18 +00:00
Simon Ser
ad4ed17335 ci: bump Meson version to 0.57
Signed-off-by: Simon Ser <contact@emersion.fr>
2024-04-09 00:48:18 +00:00
Manuel Stoeckl
d074d52902 connection: Dynamically resize connection buffers
When using fixed size connection buffers, if either the client or the
server is sending requests faster than the other end can cope with, the
connection buffers will fill up, eventually killing the connection.

This can be a problem for example with Xwayland mapping a lot of
windows, faster than the Wayland compositor can cope with, or a
high-rate mouse flooding the Wayland client with pointer events.

To avoid the issue, resize the connection buffers dynamically when they
get full.

Both data and fd buffers are resized on demand.

The default max buffer size is controlled via the wl_display interface
while each client's connection buffer size is adjustable for finer
control.

The purpose is to explicitly have larger connection buffers for specific
clients such as Xwayland, or set a larger buffer size for the client
with pointer focus to deal with a higher input events rate.

v0: Manuel:
   Dynamically resize connection buffers - Both data and fd buffers are
   resized on demand.
v1: Olivier
1. Add support for unbounded buffers on the client side and growable
   (yet limited) connection buffers on the server side.
2. Add the API to set the default maximum size and a limit for a given
   client.
3. Add tests for growable connection buffers and adjustable limits.
v2: Additional fixes by John:
1. Fix the size calculation in ring_buffer_check_space()
2. Fix wl_connection_read() to return gracefully once it has read up to
   the max buffer size, rather than returning an error.
3. If wl_connection_flush() fails with EAGAIN but the transmit
   ring-buffer has space remaining (or can be expanded),
   wl_connection_queue() should store the message rather than
   returning an error.
4. When the receive ring-buffer is at capacity but more data is
   available to be read, wl_connection_read() should attempt to
   expand the ring-buffer in order to read the remaining data.
v3: Thomas Lukaszewicz <tluk@chromium.org>
   Add a test for unbounded buffers
v4: Add a client API as well to force bounded buffers (unbounded
    by default (Olivier)
v5: Simplify ring_buffer_ensure_space() (Sebastian)

Co-authored-by: Olivier Fourdan <ofourdan@redhat.com>
Co-authored-by: John Lindgren <john@jlindgren.net>
Co-authored-by: Sebastian Wick <sebastian@sebastianwick.net>
Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Signed-off-by: John Lindgren <john@jlindgren.net>
Signed-off-by: Sebastian Wick <sebastian@sebastianwick.net>
Closes: https://gitlab.freedesktop.org/wayland/wayland/-/issues/237
2024-04-08 14:05:32 +00:00
Simon Ser
36cef8653f util: convert macros to inline functions
Functionally equivalent except the usual macro footguns are avoided
and type safety is increased.

Signed-off-by: Simon Ser <contact@emersion.fr>
2024-03-28 17:56:34 +01:00
Isaac Freund
4945f2664f wl_touch.cancel: document lack of frame event
This appears to be what at least wlroots-based compositors and kwin do
in practice. However, it's not abundantly clear from the protocol text
what the expected behavior here is. This patch fixes that.

Signed-off-by: Isaac Freund <mail@isaacfreund.com>
2024-03-28 13:27:54 +00:00
Simon Ser
2e0dbb7021 tests: add scanner test for enum-header
Signed-off-by: Simon Ser <contact@emersion.fr>
2024-03-28 13:21:28 +00:00
Simon Ser
fbd7460737 scanner: add new enum-header mode
This generates a header with only enum definitions. This is useful
to share enum headers between libraries and library users.

Signed-off-by: Simon Ser <contact@emersion.fr>
2024-03-28 13:21:28 +00:00
Jordan Williams
2621484037 egl: Disable symbols check for static builds
The symbols check only works for dynamic libraries.
When building statically, the test fails.
This is caused by the check filtering out non-dynamic symbols with nm.
This change skips the check when building only static libraries.

Signed-off-by: Jordan Williams <jordan@jwillikers.com>
2024-03-28 13:13:47 +00:00
David Benjamin
8a7ecd774c util: fix undefined behavior in wl_array_for_each
If a wl_array has size zero, wl_array_for_each computes NULL + 0 to get
to the end pointer. This should be fine, and indeed it would be fine in
C++. But the C specification has a mistake here and it is actually
undefined behavior. See
https://davidben.net/2024/01/15/empty-slices.html

Clang's -fsanitize=undefined flags this. I ran into this in Chromium's
build with wayland-scanner on one of our XML files.

../../third_party/wayland/src/src/scanner.c:1853:2: runtime error: applying zero offset to null pointer
    #0 0x55c979b8e02c in emit_code third_party/wayland/src/src/scanner.c:1853:2
    #1 0x55c979b89323 in main third_party/wayland/src/src/scanner.c
    #2 0x7f8dfdb8c6c9 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #3 0x7f8dfdb8c784 in __libc_start_main csu/../csu/libc-start.c:360:3
    #4 0x55c979b70f39 in _start (...)

An empty XML file is sufficient to hit this case, so I've added it as a
test. To reproduce, undo the fix and include only the test, then build
with:

  CC=clang CFLAGS="-fno-sanitize-recover=undefined" meson build/ -Db_sanitize=undefined -Db_lundef=false
  ninja -C build test

Signed-off-by: David Benjamin <davidben@google.com>
2024-03-24 20:00:01 -04:00
Simon Ser
aa2a6d560b protocol: document that color channels provide electrical values
Expand the work done in [1] to document that all channels store
electrical values. See the discussion in [2].

[1]: https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/316
[2]: https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/250#note_2311377

Signed-off-by: Simon Ser <contact@emersion.fr>
2024-03-12 13:04:51 +00:00
Simon Ser
44b1c0c737 connection: use enum wl_arg_type in wl_message_count_arrays()
Missed it in 155dd63b58 ("Introduce enum wl_arg_type").

Signed-off-by: Simon Ser <contact@emersion.fr>
2024-03-06 19:09:35 +01:00
Simon Ser
440defbd2b client: simplify create_proxies() loop
Decrease the indentation a bit. No functional change.

Signed-off-by: Simon Ser <contact@emersion.fr>
2024-03-06 14:18:37 +01:00
Simon Ser
7a1e7dd549 client: simplify create_outgoing_proxy() loop
Decrease the indentation a bit. No functional change.

Signed-off-by: Simon Ser <contact@emersion.fr>
2024-03-06 14:18:18 +01:00
Simon Ser
830883e5b2 connection: simplify wl_closure_lookup_objects() loop
Decrease the indentation a bit. No functional change.

Signed-off-by: Simon Ser <contact@emersion.fr>
2024-03-06 14:18:18 +01:00
Simon Ser
155dd63b58 Introduce enum wl_arg_type
This is less cryptic to read than letters, and allows the compiler
to check switch statements exhaustiveness.

Signed-off-by: Simon Ser <contact@emersion.fr>
2024-03-06 14:17:48 +01:00
Thomas Lukaszewicz
47de87263c Mitigate UAF crashes due to wl_client_destroy reentrancy
There are situations in which a call into wl_client_destroy() can
result in a reentrant call into wl_client_destroy() - which
results in UAF / double free crashes.

For example, this can occur in the following scenario.

1. Server receives a message notifying it that a client has
   disconnected (WL_EVENT_HANGUP [1])

2. This beings client destruction with a call to wl_client_destroy()

3. wl_client_destroy() kicks off callbacks as client-associated
   resources are cleaned up and their destructors and destruction
   signals are invoked.

4. These callbacks eventually lead to an explicit call to
   wl_display_flush_clients() as the server attempts to flush
   events to other connected clients.

5. Since the client has already begun destruction, when it is
   reached in the iteration the flush fails wl_client_destroy()
   is called again [2].

This patch guards against this reentrant condition by removing
the client from the display's client list when wl_client_destroy()
is first called. This prevents access / iteration over the client
after wl_client_destroy() is called.

In the example above, wl_display_flush_clients() will pass over
the client currently undergoing destruction and the reentrant
call is avoided.

[1] 8f499bf404/src/wayland-server.c (L342)

[2] 8f499bf404/src/wayland-server.c (L1512)

Signed-off-by: Thomas Lukaszewicz [thomaslukaszewicz@gmail.com](mailto:thomaslukaszewicz@gmail.com)
2024-02-23 00:40:32 +00:00
Sébastien Marie
d80bce5f1a build: fix build and provide compat for OpenBSD
- wayland-egl-abi-check: try to use llvm-nm first instead of BSD nm (incompatible options)
- avoid forcing _POSIX_C_SOURCE=200809L (SOCK_CLOEXEC become available)
- epoll(7) is provided by a userspace wrapper around kqueue(2) as FreeBSD
- when using SO_PEERCRED, the struct to use is `struct sockpeercred` instead of `struct ucred` on OpenBSD
- provide a compatibility layer for count_open_fds() using sysctl(2) as FreeBSD

Signed-off-by: Sebastien Marie <semarie@online.fr>
2024-02-21 15:46:41 +00:00
Sébastien Marie
791912c678 compat: prefer waitpid() over waitid()
while both are defined by POSIX, waitpid() is more common than waitid().

Signed-off-by: Sebastien Marie <semarie@online.fr>
2024-02-21 15:46:41 +00:00
Simon Ser
a74aa93394 protocol: mention wl_surface events from wl_output.{scale,transform}
The wl_output events should not be used anymore for guessing the
preferred scale and transform of a surface. We have explicit events
for that now.

Signed-off-by: Simon Ser <contact@emersion.fr>
2024-02-21 09:14:23 +00:00
Sebastian Wick
9c4213ed3e server: add wl_client_get_user_data/wl_client_set_user_data
The only way to attach some data to a wl_client seems to be setting up a
destroy listener and use wl_container_of. Let's make it straight forward
to attach some data.

Having an explicit destroy callback for the user data makes managing the
user data lifetime much more convenient. All other callbacks, be they
wl_resource request listeners, destroy listeners or destructors, or
wl_client destroy listeners, can assume that the wl_client user data
still exists if it was set. Otherwise making that guarantee would be
complicated.

Co-authored-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Signed-off-by: Sebastian Wick <sebastian@sebastianwick.net>
2024-02-15 10:53:21 +00:00
Kirill Primak
6a7284c632 event-loop: use wl_priv_signal for the destroy signal
Signed-off-by: Kirill Primak <vyivel@eclair.cafe>
2024-02-08 17:18:28 +00:00
Thomas Lukaszewicz
d275bc7f84 Mitigate UAF crashes due to iteration over freed wl_resources
Currently it is possible to iterate over client-owned resources
during client destruction that have had their associated memory
released.

This can occur when client code calls wl_client_destroy(). The
following sequence illustrates how this may occur.

 1. The server initiates destruction of the connected client via
    call to wl_client_destroy().

 2. Resource destroy listeners / destructors are invoked and
    resource memory is freed one resource at a time [1].

 3. If a listener / destructor for a resource results in a call
    to wl_client_for_each_resource(), the iteration will proceed
    over resources that have been previously freed in step 2,
    resulting in UAFs / crashes.

The issue is that resources remain in the client's object map
even after they have had their memory freed, and are removed
from the map only after each individual resource has had its
memory released.

This patch corrects this by ensuring resource destruction first
invokes listeners / destructors and then removing them from the
client's object map before releasing the associated memory.

[1] https://gitlab.freedesktop.org/wayland/wayland/-/blob/main/src/wayland-server.c?ref_type=heads#L928

Signed-off-by: Thomas Lukaszewicz thomaslukaszewicz@gmail.com
2024-02-07 09:45:41 +00:00
Kirill Primak
8f499bf404 protocol: clarify pending wl_buffer destruction
This matches the current behavior of KWin, Mutter, and Weston.

References: https://gitlab.freedesktop.org/wayland/wayland/-/issues/387
Signed-off-by: Kirill Primak <vyivel@eclair.cafe>
2024-01-27 15:17:28 +00:00
Mikhail Gusarov
88ece8a44d doc: Improve wording for packed IDs
"is incompatible with the implementation in libwayland" is a common
source of confusion as evidenced by repeated discussions in IRC
channel.

Improve the wording by making clear that
- packing IDs is a protocol requirement
- there are implementations (including libwayland) that enforce it

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
2024-01-22 12:37:26 +00:00
Derek Foreman
b42218f790 client: Allow setting names for queues
Allow setting a name for an event queue. The queue is used only for
printing additional debug information.

Debug output can now show the name of the event queue an event is
dispatched from, or the event queue of a proxy when a request is made.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-01-22 12:34:14 +00:00
Erik Chen
2f17d480e8 connection: Spruce up logging for client errors.
Some code paths that lead to a client error and connection termination
have no associated logging, or insufficient logging. This makes it
difficult to understand what went wrong. This commit adds or supplements
logging for all these code paths.

Signed-off-by: Erik Chen <erikchen@chromium.org>
2024-01-19 15:51:33 +00:00
John Lindgren
9867bdb111 connection: Small simplification to wl_connection_write()
wl_connection_write() contained an exact copy of the logic in
wl_connection_queue().  Simplify things by just calling
wl_connection_queue() from wl_connection_write().

Signed-off-by: John Lindgren <john@jlindgren.net>
2024-01-19 15:25:54 +00:00
Andreas Cord-Landwehr
8c49ee3112 Consider pkgconfig sysroot for pkgdatadir
For libs/cflags this is done automatically, but not for manually accessed
variables. This matches what wayland-protocols does.

Signed-off-by: Andreas Cord-Landwehr <cordlandwehr@kde.org>
2024-01-19 15:18:23 +00:00
Simon Ser
fd42f70baf shm: implement version 2
This version adds a release request.

Signed-off-by: Simon Ser <contact@emersion.fr>
2024-01-19 15:12:29 +00:00
Simon Ser
f06736a8a0 protocol: add wl_shm.release request
Allows clients to cleanly release wl_shm objects. Useful for clients
using multiple wl_registry objects (e.g. via libraries).

Signed-off-by: Simon Ser <contact@emersion.fr>
2024-01-19 15:12:29 +00:00
Simon Ser
9e233e31a2 shm: fix resource versions
This was hardcoded to 1 regardless of the version passed to the
callback or the version of the parent resource.

Signed-off-by: Simon Ser <contact@emersion.fr>
2024-01-19 15:12:29 +00:00
Ben Widawsky
8072ab0a50 protocol: clarify scale expecations
Since the positivity of zero is debatable, and, in some cases scale was simply
underspecified, clarify the situation.

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
2024-01-19 14:35:06 +00:00
Simon Ser
647398ead4 util: use C23 deprecated attribute
Signed-off-by: Simon Ser <contact@emersion.fr>
2024-01-19 14:21:59 +00:00
Simon Ser
56b9c92b98 util: use C23 typeof if available
Instead of using the non-standard __typeof__, prefer the standard
typeof operator introduced in C23.

Signed-off-by: Simon Ser <contact@emersion.fr>
2024-01-19 14:21:59 +00:00
Simon Ser
dc1da181db protocol: document wl_surface.offset for sub-surfaces
Document that the request is ignored, since this is the behavior
of most compositors.

Signed-off-by: Simon Ser <contact@emersion.fr>
2024-01-19 14:14:15 +00:00
Consolatis
6daa1b8713 cursor: add aliases for cursor name spec
The cursor name spec [1] describes how cursors should be named,
and is widely used. Add aliases so that users can pass these
names to libwayland-cursor without having to add fallbacks for
X11 cursor names.

[1]: https://www.freedesktop.org/wiki/Specifications/cursor-spec/

Signed-off-by: Simon Ser <contact@emersion.fr>
2024-01-19 14:08:16 +00:00
Simon Ser
0e139cfbc7 build: add a gen-scanner-test target
This adds a command to re-generate the test data. This needs to be
done when either an XML source file or the scanner's output is
changed.

Signed-off-by: Simon Ser <contact@emersion.fr>
2024-01-15 14:29:10 +01:00
Julian Orth
6626d4d98c protocol: wl_subsurface will never be focused
The spec does not describe which actions cause the compositor to assign
keyboard focus to a surface, leaving this up to the compositor.
Compositors differ in their behavior when the user clicks on a
sub-surface. Some will move the keyboard focus to the subsurface whereas
others will only ever assign the keyboard focus to toplevel surfaces.
Some applications (e.g. firefox) seem to require the second behavior.

This patch specifies that sub-surfaces never get the keyboard focus.

Signed-off-by: Julian Orth <ju.orth@gmail.com>
2023-12-27 18:02:07 +00:00
Francesco Guastella
86588fbdeb build: define tests in egl/meson.build when the 'tests' option is enabled
Signed-off-by: Francesco Guastella <guastella.francesco@gmail.com>
2023-12-10 14:58:04 +00:00
Kirill Primak
82d8b21827 protocol: improve wl_subsurface.{set_position,place_above} description
Don't mention when the parent surface state is applied; the parent
surface isn't necessarily a sub-surface.

Signed-off-by: Kirill Primak <vyivel@eclair.cafe>
2023-11-21 15:54:58 +00:00
Kirill Chibisov
8a19dc19a1 protocol: clarify defaults with wl_compositor@v6
This should be sufficient for clients to not decide to fallback to
output based logic to determine scaling/transform when compositor
doesn't send any of the v6 events.

Signed-off-by: Kirill Chibisov <contact@kchibisov.com>
2023-11-21 15:50:11 +00:00
Simon Ser
2a91f01d6c util: simplify wl_fixed_from_double()
Same as 0e0ae7e290 ("util: simplify wl_fixed_to_double()"), but
for the reverse function.

Signed-off-by: Simon Ser <contact@emersion.fr>
2023-11-21 15:47:13 +00:00
Simon Ser
3007718b0c gitlab: make issue template the default
The issue template is hard to notice because it's not the default.
Users have to explicitly select it from the easy-to-miss dropdown
to get the warning.

Make the template the default one, so that new users are less likely
to miss it.

Signed-off-by: Simon Ser <contact@emersion.fr>
2023-11-21 15:44:31 +00:00
Simon Ser
e4eb42d073 protocol: refer to wl_surface.offset in wl_data_device.start_drag
Passing an offset to wl_surface.attach is not supported in the
latest version of the interface.

Signed-off-by: Simon Ser <contact@emersion.fr>
2023-11-21 15:36:00 +00:00
David Benjamin
50ea9c5b1c connection: avoid calling memcpy on NULL, 0
Due to what is arguably a mistake in the C language specification,
passing NULL to memcpy and friends is undefined behavior (UB) even when
the count is 0. C additionally mistakenly leaves NULL + 0 and NULL -
NULL undefined. (C++ fixes this mistake.) These are very problematic
because (NULL, 0) is a natural representation of the empty slice.

Some details:
https://github.com/llvm/llvm-project/issues/49459
https://www.imperialviolet.org/2016/06/26/nonnull.html

Unfortunately, despite how clearly this is a mistake, glibc headers and
GCC now try to exploit this specification mistake and will miscompile
code, so C projects need to workaround this. In particular, UBSan from
Clang will flag this as a bug (although Clang itself has the good sense
to never lean on this bug). We've run into a few UBSan errors in
Chromium stemming from Wayland's memcpy calls. Add runtime guards as
needed to avoid these cases.

Note: Chromium's copy of wayland has
https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/188
applied. It is possible the ring_buffer_copy UB cases are only reachable
with that MR applied, I'm not sure. But it seemed simplest to just add
the fix to wayland as-is. Then when/if that MR lands, it will pick this
up.

Signed-off-by: David Benjamin <davidben@google.com>
2023-11-08 08:41:16 -05:00
David Edmundson
edb943dc64 client: Add method to get display for a given proxy
This can be useful for additional validation purposes when handling
proxies. This is similar to existing server side API
wl_global_get_display.

Signed-off-by: David Edmundson <david@davidedmundson.co.uk>
2023-08-07 13:38:01 +00:00
Simon Ser
379a6f6759 ci: upgrade FreeBSD to 13.2
Signed-off-by: Simon Ser <contact@emersion.fr>
2023-08-02 16:47:07 +02:00
Simon Ser
63b0050561 ci: upgrade Debian to bookworm
This is the current Debian stable release.

Signed-off-by: Simon Ser <contact@emersion.fr>
2023-08-02 16:47:07 +02:00
Simon Ser
a81f947aff ci: upgrade ci-templates
Newer ci-templates contains bugfixes.

While at it, stop using a GitLab YAML reference, because we only
use this value in one spot.

Signed-off-by: Simon Ser <contact@emersion.fr>
2023-08-02 16:47:07 +02:00
Simon Ser
7b27881cd1 cursor: check return value of snprintf()
Fixes a new warning in GCC 7:

    FAILED: cursor/libwayland-cursor.so.0.22.90.p/xcursor.c.o
    cc -Icursor/libwayland-cursor.so.0.22.90.p -Icursor -I../cursor -I. -I.. -Isrc -I../src -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Werror -std=c99 -O3 -D_POSIX_C_SOURCE=200809L -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -fvisibility=hidden -fPIC '-DICONDIR="/usr/share/X11/icons"' -MD -MQ cursor/libwayland-cursor.so.0.22.90.p/xcursor.c.o -MF cursor/libwayland-cursor.so.0.22.90.p/xcursor.c.o.d -o cursor/libwayland-cursor.so.0.22.90.p/xcursor.c.o -c ../cursor/xcursor.c
    ../cursor/xcursor.c: In function 'xcursor_load_theme':
    ../cursor/xcursor.c:596:39: error: '%s' directive output between 7 and 7 bytes may cause result to exceed 'INT_MAX' [-Werror=format-truncation=]
      596 |         snprintf(full, full_size, "%s/%s/%s", dir, subdir, file);
          |                                       ^~
    ......
      764 |                 full = xcursor_build_fullname(dir, "cursors", "");
          |                                                    ~~~~~~~~~
    ../cursor/xcursor.c:596:41: error: '/' directive output between 1 and 1 bytes may cause result to exceed 'INT_MAX' [-Werror=format-truncation=]
      596 |         snprintf(full, full_size, "%s/%s/%s", dir, subdir, file);
          |                                         ^
    cc1: all warnings being treated as errors

Signed-off-by: Simon Ser <contact@emersion.fr>
2023-08-02 16:47:07 +02:00
Simon Ser
72da004b3e protocol: fix whitespace
This file uses tabs instead of 8 spaces.

Signed-off-by: Simon Ser <contact@emersion.fr>
2023-07-19 11:01:17 +00:00
Peter Hutterer
e3908eb360 Add a triage-policies file for bugbot
With a default template for the common case of "this is not a protocol bug".

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-07-07 21:18:08 +10:00
Alex Yang
6d33346571 debug: Replace "@<id>" with "#<id>" in logs
Wayland debug logs resemble email addresses. This is a problem when
anonymizing logs from users. For example:

[2512874.343] xdg_surface@700.configure(333)

In the above log line, the substring "surface@700.config" can be
mistaken for an email address and redacted during anonymization.

Signed-off-by: Alex Yang <aycyang@google.com>
2023-06-27 14:08:25 -07:00
Simon Ser
4ec379ebcc tests: manually wrap libc functions
The way we're wrapping libc functions via dlsym() is pretty fragile
and breaks on FreeBSD. The failures happen in our CI and are pretty
random, see e.g. [1].

Use a more manual way to wrap via a function pointer.

[1]: https://gitlab.freedesktop.org/wayland/wayland/-/jobs/44204010

Signed-off-by: Simon Ser <contact@emersion.fr>
2023-06-27 13:31:50 +02:00
Simon Ser
4a7348e48c egl: add missing ABI check test
We were building the executable for the test, but not declaring
the test.

Signed-off-by: Simon Ser <contact@emersion.fr>
2023-06-20 09:20:49 +02:00
Simon Ser
f181de1bcf tests: add missing proxy-test
This was probably lost during a rebase.

Signed-off-by: Simon Ser <contact@emersion.fr>
2023-06-20 09:20:49 +02:00
Simon Ser
56dfdb7614 server: use bool in struct fields
Use bool instead of int for boolean values, to make it more
explicit what the field contains. For instance "error" is not to
be confused with an error code.

This is all private API.

Signed-off-by: Simon Ser <contact@emersion.fr>
2023-05-30 09:18:34 +00:00
Simon Ser
a3c499493b protocol: refer to wl_surface.offset in set_cursor
The offset in wl_surface.attach has been superseded by
wl_surface.offset. Refer to the new request instead of using the
deprecated one.

Signed-off-by: Simon Ser <contact@emersion.fr>
2023-05-23 09:33:43 +00:00
Sebastian Wick
f3026c916e protocol: specify the exact form of premultiplication
There are two ways to do pre-multiplication of the alpha channel into
the color channels: on optical values or on electrical values. While
pre-multiplication with optical values is arguably more correct, because
operations like blending or scaling require pre-multiplied, optical
color channels, wayland and compositors by default work with
pre-multiplied electrical values. This is most likely a convention that
Wayland took from Cairo.

This commit makes sure that the expectation of pre-multiplied electrical
values is properly documented.

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2023-05-09 14:52:58 +02:00
Simon Ser
2aec19ce41 build: override wayland-scanner dep
This allows a parent project to find wayland-scanner.

Signed-off-by: Simon Ser <contact@emersion.fr>
2023-05-09 09:56:18 +00:00
Simon Ser
8f2a33cffc server: stop wl_display_run() on dispatch error
If wl_event_loop_dispatch() fails, we could enter an infinite loop,
repeatedly calling a failing wl_event_loop_dispatch() forever.

Signed-off-by: Simon Ser <contact@emersion.fr>
2023-05-09 09:50:53 +00:00
Simon Ser
0e0ae7e290 util: simplify wl_fixed_to_double()
We can just use a simple division instead of bit operations with
magic numbers. Readability matters more than performance here.

References: https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/296
Signed-off-by: Simon Ser <contact@emersion.fr>
2023-05-09 09:33:06 +00:00
Yang Wang
11b17c1286 event-loop: optimize timer check logic
the 'has_timers' flag can be returned directly without having to track all the ready events
when a timer is found ready.

Signed-off-by: Yang Wang <KevinYang.Wang@amd.com>
2023-05-03 19:21:17 +00:00
Manuel Stoeckl
b1b97e8d34 tests: drop misleading fixed-benchmark
Because this benchmark performed wl_fixed_to_double conversions
on a long sequence of consecutive integers, the compiler could
optimize away the addition performed in wl_fixed_to_double, merging
it with the loop iteration code. This made tests/fixed-benchmark.c
significantly underestimate the actual cost of the current
wl_fixed_to_double implementation.

Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
2023-05-03 19:15:12 +00:00
Manuel Stoeckl
d40052e083 protocol: add new shm formats
This brings the format list up to date with libdrm 2.4.115.

Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
2023-05-03 19:10:32 +00:00
Joshua Ashton
3bac2e5fb8 event-loop: Handle EINTR and EAGAIN in wl_event_loop_dispatch
This fixes an issue where it was not possible to start Gamescope under GDB on some setups.
https://github.com/ValveSoftware/gamescope/issues/743

Any signals would cause epoll_wait to return -1 and set errno to EINTR.

This also handles the EAGAIN case like the other polling loops in libwayland.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2023-05-02 12:36:35 +01:00
Xaver Hugl
1e259a255a protocol: improve wl_keyboard focus documentation
The compositor must not send any key events while a surface is not focused,
but in order to allow for common actions like ctrl+scroll for zooming to work
with unfocused surfaces it may do so with modifiers.

Signed-off-by: Xaver Hugl <xaver.hugl@gmail.com>
2023-04-12 13:37:51 +00:00
Simon Ser
307b23626d protocol: disallow re-using wl_data_source
As pointed out in [1], re-using a wl_data_source for multiple start_drag or
set_selection requests has bad consequences, because this object has events
that allo tracking the state of a selection/drag-and-drop operation. Tracking
two operations at the same time isn't possible with this interface.

[1]: https://lists.freedesktop.org/archives/wayland-devel/2019-January/039936.html

Signed-off-by: Simon Ser <contact@emersion.fr>
Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-04-04 11:39:08 +00:00
Simon Ser
cdd890a6f8 build: re-open main branch for regular development 2023-04-04 13:38:18 +02:00
Simon Ser
b2649cb3ee build: bump to version 1.22.0 for the official release 2023-04-04 09:58:31 +02:00
Simon Ser
cd036bb7b8 build: bump to version 1.21.93 for the RC1 release 2023-03-28 20:03:14 +02:00
Faith Ekstrand
eb19f99a5b Add a .mailmap file
This will let command-line Git tools re-map my name and e-mail address properly.
I'm using my personal e-mail address and not my Collabora address because I'm
not actively contributing to Wayland anymore and this is mostly for letting
people find me should they dig me up in the project history.

Signed-off-by: Faith Ekstrand <faith@gfxstrand.net>
2023-03-25 11:17:32 -05:00
Simon Ser
002e1f1d3a build: bump version to 1.21.92 for the beta release 2023-03-16 01:08:44 +01:00
Simon Ser
3956948fac client: fix wl_display_disconnect() documentation
Signed-off-by: Simon Ser <contact@emersion.fr>
Closes: https://gitlab.freedesktop.org/wayland/wayland/-/issues/361
2023-03-07 13:22:43 +00:00
Alexandros Frantzis
b01a85dfd5 client: Do not warn about attached proxies on default queue destruction.
If the default queue is being destroyed, the client is disconnecting
from the wl_display, so there is no possibility of subsequent events
being queued to the destroyed default queue, which is what this warning
is about.

Note that interacting with (e.g., destroying) a wl_proxy after its
wl_display is destroyed is a certain memory error, and this warning will
indirectly warn about this issue. However, this memory error should be
detected and warned about through a more deliberate mechanism.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2023-03-01 15:50:02 +02:00
Simon Ser
344d31f871 build: bump version to 1.21.91 for the alpha release 2023-02-28 17:15:31 +01:00
Alexandros Frantzis
d72f9007c3 client: Abort when trying to add an event to a destroyed queue
Detect when we are trying to add an event to a destroyed queue,
and abort instead of causing a use-after-free memory error.

This situation can occur when an wl_event_queue is destroyed before
its attached wl_proxy objects.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2023-02-28 11:22:04 +00:00
Alexandros Frantzis
e09010f470 tests: Support tests that check for client failure
Add the display_destroy_expect_signal() function to check that test
clients exit due to a particular signal. This is useful for checking
that clients fail in an expected way.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2023-02-28 11:22:04 +00:00
Alexandros Frantzis
0ba650202e client: Warn when a queue is destroyed with attached proxies
Log a warning if the queue is destroyed while proxies are still
attached, to help developers debug and fix potential memory errors.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2023-02-28 11:22:04 +00:00
Alexandros Frantzis
d4d3228853 tests: Capture the test client log
Capture the test client log to a temporary fd, so that is accessible by both
the test server process and the test client process.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2023-02-28 11:22:04 +00:00
Alexandros Frantzis
674145dc3f client: Track the proxies attached to a queue
Maintain a list of all wl_proxy objects that are attached to a
wl_event_queue. We will use this information in upcoming commits to warn
about improper object destruction order that can lead to memory errors.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2023-02-28 11:22:04 +00:00
Simon Ser
ab526f8d7c shm: fix segfault when accessing destroyed pool resource
With wl_shm_buffer_ref_pool(), it's possible for a wl_shm_pool
to outlive its wl_resource. We need to be careful not to access
wl_shm_pool.resource if it's been destroyed.

Reset resource to NULL in the resource destroy handler, and add
NULL checks.

Signed-off-by: Simon Ser <contact@emersion.fr>
2023-02-27 21:00:10 +00:00
Mikhail Gusarov
6cdeae1bec protocol: Clarify meaning of input region for cursors, DnD icons
Input region is ignored for cursors, DnD icons. Current wording
implies that this state is temporary, but surfaces never lose the
role once assigned, so reword to make it clearer.

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
2023-02-27 20:51:51 +00:00
Vlad Zahorodnii
3815803633 protocol: reorder wl_data_offer.source_actions and wl_data_device.enter
Most compositors send the wl_data_offer.source_actions event before the
wl_data_device.enter event, i.e. after creation of the data offer. This
contradicts to the wayland spec.

On the other hand, it's reasonable to send all the information useful to
the client before the enter event, rather than send mime types before the
enter event and source actions (that don't depend on drop target) after
the enter event.

On the client side, toolkits such as Qt and GTK already expect to see the
source actions before receiving the enter event.

Given all of that, this change adjusts the spec to match the behavior
observed in the compositors in the wild.

Signed-off-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
2023-02-27 20:43:41 +00:00
Sebastian Wick
2aec8f59e9 protocol: do not change pending x and y when attaching a buffer
Attaching a buffer with interface version 5 requires clients to pass
zero to x and y but it still affects the pending surface state.
Attaching a buffer after a request to offset therefore sets the pending
x and y to zero. The intent of version 5 was to allow exactly this
sequence of requests to work so let's just make sure the protocol
actually spells it out.

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2023-02-27 20:39:41 +00:00
Peter Hutterer
1ef773be76 protocol: add wl_pointer's axis relative physical direction
This event adds the physical direction of the axis motion, relative to the
axis event we get. Right now, when natural scrolling is enabled things like
virtual volume sliders move the wrong way round.

By adding the axis motion direction, we can have toolkits swap the scroll
direction for applicable widgets, getting the right behavior on all widgets.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
2023-02-21 15:32:03 +00:00
Simon Ser
a782152de0 readme: convert to Markdown
Gives us nice links and code blocks.

Signed-off-by: Simon Ser <contact@emersion.fr>
2023-02-13 19:57:15 +01:00
Simon Ser
20498d9ea1 readme: reword website description
The website is most useful for docs. Build instructions have been
mostly dropped from it: they're better described in downstream
projects' READMEs.

Signed-off-by: Simon Ser <contact@emersion.fr>
2023-02-13 19:55:42 +01:00
Simon Ser
8ffd7db24f readme: drop paragraph about Weston
There are many Wayland compositors nowadays.

Signed-off-by: Simon Ser <contact@emersion.fr>
2023-02-13 19:54:13 +01:00
Andri Yngvason
d16d39f74a wayland-server: Add method to get global name
This is useful for protocol designs where globals need to be referenced
in some manner.

Signed-off-by: Andri Yngvason <andri@yngvason.is>
2023-02-11 12:19:56 +00:00
Simon Ser
d443241635 protocol: add wl_surface.preferred_buffer_transform
Same as the new wl_surface.preferred_buffer_scale event but for
transform.

No version bump needed since the previous commit did that.

Signed-off-by: Simon Ser <contact@emersion.fr>
2023-02-07 14:33:09 +01:00
Simon Ser
9afab91d21 protocol: add wl_surface.preferred_buffer_scale
Right now, clients need to bind to wl_output globals, listen to wl_output.scale,
listen to wl_surface.enter/leave, pick the highest scale factor.

This is an issue because it breaks Wayland's "policy, not mechanism" motto.
Clients take the decision of which scale to use depending on the outputs they're
on, compositors have no say in this (apart from faking output events, which
isn't great).

This commit introduces a new wl_surface.preferred_buffer_scale event to allow
compositors to directly indicate the preferred scale factor for each surface.

This unlocks features which require dynamically changing the scale such as:

- Accessibility features such as screen magnifier
- In a VR environment, render surfaces close to the eye at a higher scale
- HiDPI screenshots on LoDPI screens

Signed-off-by: Simon Ser <contact@emersion.fr>
Closes: https://gitlab.freedesktop.org/wayland/wayland/-/issues/271
2023-02-07 14:33:09 +01:00
Simon Ser
83e9c9e117 server: rename wl_display.id to next_global_name
This is much more descriptive. This value is a counter incremented
each time a new global is created.

Signed-off-by: Simon Ser <contact@emersion.fr>
2023-01-25 11:14:10 +01:00
Simon Ser
be31c5a8c8 server: fail on global name overflow
display->id is initialized to 1, making 0 a convenient value to
indicate an invalid global name. Make sure to not return a zero
global name on overflow. Moreover, if we wrap around, we might
cycle back to a global name which is already in-use.

Signed-off-by: Simon Ser <contact@emersion.fr>
2023-01-25 11:12:59 +01:00
Mikhail Gusarov
9700155eda protocol: wl_subsurface::destroy does not remove the role
Role assigned to wl_surface cannot be removed.
Delete contradicting text from wl_subsurface::destroy documentation.

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
2023-01-16 10:09:32 +00:00
Marius Vlad
b27961e48d release.sh: Don't push *all* tags
Rather than trying to push all possible tags just push the one
created for that release.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-01-16 10:03:54 +00:00
Fergus Dall
41aed7a38a scanner: Fix undefined behavior around qsort
According to clang, qsort cannot be passed a null pointer, even if the size is
specified to be zero. The scanner can hit this while trying to sort forward
declarations if it happens to be building a protocol file that doesn't require
any, either in the header or the source.

Signed-off-by: Fergus Dall <sidereal@google.com>
2023-01-03 11:05:35 +00:00
Simon Ser
7f1c51a556 protocol: add note about wl_buffer/wl_callback version
This is an exception which can be confusing. Add an explicit note
about it in the protocol text.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-12-07 10:04:49 +01:00
Kirill Primak
0dc23e380a protocol: add defunct_role_object error
This commit adds wl_surface.defunct_role_object error, which has
semantics similar to xdg_wm_base.defunct_surfaces error, and is sent
when a client destroys a surface while the corresponding role object
still exists.

Signed-off-by: Kirill Primak <vyivel@eclair.cafe>
2022-11-29 13:46:54 +00:00
Kirill Primak
68dfa1183f protocol: remove wl_subsurface lifetime contradiction
This statement assumes that a wl_surface can be destroyed before the
corresponding wl_subsurface, which is not true, as wl_surface
description explicitly states that the role object must be destroyed
before the wl_surface itself.

Signed-off-by: Kirill Primak <vyivel@eclair.cafe>
2022-11-29 13:46:54 +00:00
Daniel Stone
86d73b2da2 tests: Ensure resource vs. client destroy handler order
Make sure that the client destroy handler runs strictly before the
resource destroy handler, which runs strictly before the client
late-destroy handler.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-10-20 11:26:22 +00:00
Daniel Stone
51d788de5b wayland-server: Add wl_client_add_destroy_late_listener
A late-destroy listener for a client is called after all the client's
resources have been destroyed and the destroy callbacks emitted. This
lives in parallel to the existing client destroy listener, called
immediately before the client's objects get destroyed.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Fixes: wayland/wayland#207
2022-10-20 11:26:22 +00:00
Daniel Stone
e886b456ab tests: Use bool for client test
A 0/1-only int is a bool.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-10-20 11:26:22 +00:00
Simon Ser
b9632822b7 protocol: add wl_compositor.error.bad_parent
This forbids loops in sub-surface trees.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-09-21 10:17:57 +00:00
Simon Ser
c2c6ef9cbe protocol: mention protocol error name in wl_subcompositor.get_subsurface
Let's be explicit here.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-09-21 10:17:57 +00:00
Simon Ser
985ab55d59 ci: upgrade images
Upgrade Debian to bullseye and FreeBSD to 13.1. FreeBSD 13.0 is
not supported anymore, and this ensures we still build on fresh
images.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-09-13 18:46:46 +00:00
Simon Ser
e105360783 ci: set ASAN_OPTIONS=detect_odr_violation=0
Signed-off-by: Simon Ser <contact@emersion.fr>
References: https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/154
2022-09-13 18:46:46 +00:00
Simon Ser
2d5acfa5c3 cursor: make param names match with documentation
There was a mismatch here.

Use a good-looking function param name because that's what will
show up in docs. Use an abbreviation inside the function.

Fixes the following warnings:

    cursor/wayland-cursor.c:504: warning: argument 'cursor' of command @param is not found in the argument list of wl_cursor_frame(struct wl_cursor *_cursor, uint32_t time)
    cursor/wayland-cursor.c:504: warning: The following parameter of wl_cursor_frame(struct wl_cursor *_cursor, uint32_t time) is not documented:
      parameter '_cursor'
    cursor/wayland-cursor.c:452: warning: argument 'cursor' of command @param is not found in the argument list of wl_cursor_frame_and_duration(struct wl_cursor *_cursor, uint32_t time, uint32_t *duration)
    cursor/wayland-cursor.c:452: warning: The following parameter of wl_cursor_frame_and_duration(struct wl_cursor *_cursor, uint32_t time, uint32_t *duration) is not documented:
      parameter '_cursor'
    cursor/wayland-cursor.c:147: warning: argument 'image' of command @param is not found in the argument list of wl_cursor_image_get_buffer(struct wl_cursor_image *_img)
    cursor/wayland-cursor.c:147: warning: The following parameter of wl_cursor_image_get_buffer(struct wl_cursor_image *_img) is not documented:
      parameter '_img'
    cursor/wayland-cursor.c:504: warning: argument 'cursor' of command @param is not found in the argument list of wl_cursor_frame(struct wl_cursor *_cursor, uint32_t time)
    cursor/wayland-cursor.c:504: warning: The following parameter of wl_cursor_frame(struct wl_cursor *_cursor, uint32_t time) is not documented:
      parameter '_cursor'
    cursor/wayland-cursor.c:452: warning: argument 'cursor' of command @param is not found in the argument list of wl_cursor_frame_and_duration(struct wl_cursor *_cursor, uint32_t time, uint32_t *duration)
    cursor/wayland-cursor.c:452: warning: The following parameter of wl_cursor_frame_and_duration(struct wl_cursor *_cursor, uint32_t time, uint32_t *duration) is not documented:
      parameter '_cursor'
    cursor/wayland-cursor.c:147: warning: argument 'image' of command @param is not found in the argument list of wl_cursor_image_get_buffer(struct wl_cursor_image *_img)
    cursor/wayland-cursor.c:147: warning: The following parameter of wl_cursor_image_get_buffer(struct wl_cursor_image *_img) is not documented:
      parameter '_img'

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-09-13 18:01:57 +00:00
Simon Ser
7d78ea5628 server: don't document void return values
Fixes the following warnings:

    src/wayland-server.c:1152: warning: documented empty return type of wl_display::wl_display_destroy
    src/wayland-server.c:1193: warning: documented empty return type of wl_display::wl_display_set_global_filter

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-09-13 18:01:57 +00:00
Simon Ser
1db6153cc2 util: name function typedef arguments
Doxygen doesn't support documenting unnamed function arguments.

Fixes the following warnings:

    src/wayland-util.h:697: warning: argument 'const' of command @param is not found in the argument list of wl_dispatcher_func_t(const void *, void *, uint32_t, const struct wl_message *, union wl_argument *)
    src/wayland-util.h:697: warning: argument 'void' of command @param is not found in the argument list of wl_dispatcher_func_t(const void *, void *, uint32_t, const struct wl_message *, union wl_argument *)
    src/wayland-util.h:697: warning: argument 'void' of command @param is not found in the argument list of wl_dispatcher_func_t(const void *, void *, uint32_t, const struct wl_message *, union wl_argument *)
    src/wayland-util.h:697: warning: argument 'uint32_t' of command @param is not found in the argument list of wl_dispatcher_func_t(const void *, void *, uint32_t, const struct wl_message *, union wl_argument *)
    src/wayland-util.h:697: warning: argument 'const' of command @param is not found in the argument list of wl_dispatcher_func_t(const void *, void *, uint32_t, const struct wl_message *, union wl_argument *)
    src/wayland-util.h:697: warning: argument 'struct' of command @param is not found in the argument list of wl_dispatcher_func_t(const void *, void *, uint32_t, const struct wl_message *, union wl_argument *)
    src/wayland-util.h:697: warning: argument 'wl_message' of command @param is not found in the argument list of wl_dispatcher_func_t(const void *, void *, uint32_t, const struct wl_message *, union wl_argument *)
    src/wayland-util.h:697: warning: argument 'union' of command @param is not found in the argument list of wl_dispatcher_func_t(const void *, void *, uint32_t, const struct wl_message *, union wl_argument *)
    src/wayland-util.h:697: warning: argument 'wl_argument' of command @param is not found in the argument list of wl_dispatcher_func_t(const void *, void *, uint32_t, const struct wl_message *, union wl_argument *)
    src/wayland-util.h:725: warning: argument 'const' of command @param is not found in the argument list of wl_log_func_t(const char *, va_list)
    src/wayland-util.h:725: warning: argument 'char' of command @param is not found in the argument list of wl_log_func_t(const char *, va_list)
    src/wayland-util.h:725: warning: argument 'va_list' of command @param is not found in the argument list of wl_log_func_t(const char *, va_list)
    src/wayland-util.h:697: warning: argument 'const' of command @param is not found in the argument list of wl_dispatcher_func_t(const void *, void *, uint32_t, const struct wl_message *, union wl_argument *)
    src/wayland-util.h:697: warning: argument 'void' of command @param is not found in the argument list of wl_dispatcher_func_t(const void *, void *, uint32_t, const struct wl_message *, union wl_argument *)
    src/wayland-util.h:697: warning: argument 'void' of command @param is not found in the argument list of wl_dispatcher_func_t(const void *, void *, uint32_t, const struct wl_message *, union wl_argument *)
    src/wayland-util.h:697: warning: argument 'uint32_t' of command @param is not found in the argument list of wl_dispatcher_func_t(const void *, void *, uint32_t, const struct wl_message *, union wl_argument *)
    src/wayland-util.h:697: warning: argument 'const' of command @param is not found in the argument list of wl_dispatcher_func_t(const void *, void *, uint32_t, const struct wl_message *, union wl_argument *)
    src/wayland-util.h:697: warning: argument 'struct' of command @param is not found in the argument list of wl_dispatcher_func_t(const void *, void *, uint32_t, const struct wl_message *, union wl_argument *)
    src/wayland-util.h:697: warning: argument 'wl_message' of command @param is not found in the argument list of wl_dispatcher_func_t(const void *, void *, uint32_t, const struct wl_message *, union wl_argument *)
    src/wayland-util.h:697: warning: argument 'union' of command @param is not found in the argument list of wl_dispatcher_func_t(const void *, void *, uint32_t, const struct wl_message *, union wl_argument *)
    src/wayland-util.h:697: warning: argument 'wl_argument' of command @param is not found in the argument list of wl_dispatcher_func_t(const void *, void *, uint32_t, const struct wl_message *, union wl_argument *)
    src/wayland-util.h:725: warning: argument 'const' of command @param is not found in the argument list of wl_log_func_t(const char *, va_list)
    src/wayland-util.h:725: warning: argument 'char' of command @param is not found in the argument list of wl_log_func_t(const char *, va_list)
    src/wayland-util.h:725: warning: argument 'va_list' of command @param is not found in the argument list of wl_log_func_t(const char *, va_list)

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-09-13 18:01:57 +00:00
Olivier Fourdan
68fef9922e build: Make release.sh generic
The "release.sh" script is a convenient and documented way to release
Wayland packages.

Unfortunately, the actual package name is hardcoded, meaning that to
reuse that script in other Wayland projects, one needs to duplicate the
script and amend it.

Use meson to determine the actual project name, so that the same script
can be invoked from any relevant Wayland project.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2022-09-06 15:15:56 +02:00
Carlos Garnacho
73468bab7d server: Extend display name string size
Typically this is a number between 0 and 32. Just that the compiler doesn't
know that well. Make the string buffer a bit larger, so that it fits the
longer integers. Fixes build warnings like:

../subprojects/wayland/src/wayland-server.c: In function ‘wl_display_add_socket_auto’:
../subprojects/wayland/src/wayland-server.c:1649:70: error: ‘%d’ directive output may be truncated writing between 1 and 11 bytes into a region of size 8 [-Werror=format-truncation=]
 1649 |                 snprintf(display_name, sizeof display_name, "wayland-%d", displayno);
      |                                                                      ^~
../subprojects/wayland/src/wayland-server.c:1649:61: note: directive argument in the range [-2147483647, 32]
 1649 |                 snprintf(display_name, sizeof display_name, "wayland-%d", displayno);
      |                                                             ^~~~~~~~~~~~
../subprojects/wayland/src/wayland-server.c:1649:17: note: ‘snprintf’ output between 10 and 20 bytes into a destination of size 16
 1649 |                 snprintf(display_name, sizeof display_name, "wayland-%d", displayno);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

Seen in GTK CI.

Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
2022-08-05 01:26:10 +02:00
Ian Douglas Scott
60827b862e Document which type are nullable, and wire format for null value
Signed-off-by: Ian Douglas Scott <idscott@system76.com>
2022-07-14 08:38:49 -07:00
Ian Douglas Scott
971f8e4ace Do not allow nullable new_id
The usefulness of this is limited, and `libwayland-client` doesn't
provide a way to pass a null `new_id` since the id is generated by the
library and given to the caller as the return value.

Signed-off-by: Ian Douglas Scott <idscott@system76.com>
2022-07-14 08:38:49 -07:00
Ian Douglas Scott
13b05c9ed1 Do not allow nullable arrays, which were not correctly implemented
Nullable arrays, which are not used anywhere, were marshalled the same
way as an empty non-null array. The demarshalling logic did not
recognize anything as a null array. Given this, it seems better to just
explicitly not support it.

Fixes https://gitlab.freedesktop.org/wayland/wayland/-/issues/306.

Signed-off-by: Ian Douglas Scott <idscott@system76.com>
2022-07-14 08:10:38 -07:00
Simon Ser
7cdc20cee6 Add release.sh
Replace xorg-util-modular's release script with our own, tailored
for Wayland only. Does the same thing but in 71 lines of code
instead of 1k. Creates a GitLab release via glab instead of trying
to upload to a web server via ssh.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-07-14 08:04:43 +00:00
Simon Ser
4f6c6e7c0f build: re-open main branch for regular development 2022-07-01 00:11:50 +02:00
Simon Ser
8135e856eb build: bump to version 1.21.0 for the official release 2022-06-30 23:59:11 +02:00
Peter Hutterer
68842b3403 protocol: minor clarification for axis_discrete events
Explicitly spell out that multiple axis_discrete events *for the same axis*
within the same wl_pointer.frame are not permitted.

References: https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/911#note_1438099

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-06-30 09:12:08 +00:00
Simon Ser
c7fc1e79ca util: set errno when hitting WL_MAP_MAX_OBJECTS
Callers may check errno when wl_map_insert_* functions return an
error (since [1]). Make sure it's always set to a meaningful value
when returning an error, otherwise callers might end up checking an
errno coming from a completely different function.

[1]: https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/205

Signed-off-by: Simon Ser <contact@emersion.fr>
Fixes: b19488c715 ("util: Limit size of wl_map")
2022-06-28 11:59:26 +02:00
Simon Ser
8e322a5a99 build: bump to version 1.20.93 for the RC1 release 2022-06-23 21:59:18 +02:00
Simon Ser
41b10c7458 server: warn about global filtering consistency
The filtering needs to be static given a client and a global,
otherwise libwayland will misbehave.

Signed-off-by: Simon Ser <contact@emersion.fr>
References: https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/241#note_1421888
2022-06-15 10:37:18 +02:00
Simon Ser
7eb00b070d server: add PID race condition disclaimer to wl_client_get_credentials
PIDs are re-used and cannot be used to reliably check the identity of
a Wayland client.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-15 07:57:12 +00:00
Simon Ser
2fb4cdebbe tests: add a test for dynamic filtered globals
Ensure dynamically created and destroyed globals which are filtered
don't trigger any global/global_remove event.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-15 07:53:19 +00:00
Simon Ser
1b00df864c server: check visibility before sending global/global_remove
See the previous discussion at [1]: libwayland incorrectly skips
the visibility checks when sending global/global_remove events.
The check is only performed when a client performs a
wl_display.get_registry request.

[1]: https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/148

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-15 07:53:19 +00:00
Olivier Fourdan
dd00220b1e cursor/os-compatibility: handle EINTR gracefully
If os_resize_anonymous_file() called from os_create_anonymous_file()
fails with EINTR (Interrupted system call), then the buffer allocation
fails.

To avoid that, retry posix_fallocate() on EINTR.

However, in the presence of an alarm, the interrupt may trigger
repeatedly and prevent a large posix_fallocate() to ever complete
successfully, so we need to first block SIGALRM to prevent this.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2022-06-09 19:18:47 +00:00
Simon Ser
07c8f41576 build: bump to version 1.20.92 for the beta release
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-09 20:52:32 +02:00
Alexandros Frantzis
444d0ff338 client: Lock display when setting a proxy event queue
Assignments to a wl_proxy's queue member are currently not synchronized
with potential reads of that member during event reading/queuing.
Assuming atomic pointer value reads and writes (which is a reasonable
assumption), and using the documented best practices to handle event
queue changes, a queue change should still be safe to perform.

That being said, such implicitly atomic accesses are difficult to assess
for correctness, especially since they do not introduce memory barriers.

To make the code more obviously correct, and handle any potential races
we are not currently aware of, this commit updates wl_proxy_set_queue()
to set the proxy's event queue under the display lock (all other
proxy queue accesses are already done under the display lock).

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Suggested-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-06-09 18:38:53 +00:00
Alexandros Frantzis
a8246a9f0f client: Document best practices for event queue changes
Document the proper way to deal with event queue changes, in order to
guarantee proper handing of all events which were queued before the
queue change takes effect, especially in multi-threaded setups.

Make a special note about queue changes of newly created proxies,
which require the use of a proxy wrapper for thread safety.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Suggested-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-06-09 18:38:53 +00:00
Antonin Décimo
9434e8d69f Check that XDG base directories paths are absolute
The [spec][1] reads:

> All paths set in these environment variables must be absolute. If an
> implementation encounters a relative path in any of these variables it should
> consider the path invalid and ignore it.

and

> If $XDG_DATA_HOME is either not set or empty, a default equal to
> $HOME/.local/share should be used.

Testing that the path is absolute also entails that is is non-empty.

[1]: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

Signed-off-by: Antonin Décimo <antonin.decimo@gmail.com>
2022-06-09 18:34:17 +00:00
Simon Ser
f710d01663 cursor/os-compatibility: fix trailing space
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-04 22:58:50 +02:00
Simon Ser
0297c2c47a cursor/os-compatibility: remove strcpy/strcat usage
These functions don't perform bounds checking, so they are easy to
misuse and complicate audits.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-06-04 22:58:47 +02:00
Simon Ser
355c8e885c cursor: move xcursor_theme_inherits declarations at the top
Per code style, declarations need to be at the start of the block.

And make l const while at it.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-27 22:41:12 +02:00
Simon Ser
dfe820efce cursor: drop xcursor_add_path_elt
Just use snprintf instead. It doesn't really matter if we have
some duplicate slashes in filenames.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-27 22:41:12 +02:00
Simon Ser
ccca002691 cursor: drop unused XCursor comment declarations
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-27 22:41:12 +02:00
Simon Ser
1cb728246b cursor: fix indentation of xcursor_load_theme declaration
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-27 22:41:12 +02:00
Simon Ser
7a399383fc cursor: simplify xcursor_library_path
- Use early returns
- De-duplicate XDG_DATA_HOME code-paths
- Don't crash on allocation failure
- Use size_t when appropriate
- Fix indentation

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-27 22:41:11 +02:00
Simon Ser
f33356742e cursor: remove unnecessary ifs in xcursor_load_theme
load_all_cursors_from_dir and xcursor_theme_inherits already have
the NULL checks we want.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-27 22:41:11 +02:00
Simon Ser
6c49a8f7e5 cursor: drop xcursor_images_set_name
We don't ever need to set the name multiple times for a single
struct xcursor_images, so we can just set the field directly. Also
replace the hand-rolled logic with strdup.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-27 22:41:11 +02:00
Simon Ser
6cf5e8f932 cursor: use getline instead of fgets
This avoids storing 8KiB on the stack, and removes the line length
limit.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-27 22:41:11 +02:00
Simon Ser
0b8793ab0c cursor: remove unnecessary parentheses in load_all_cursors_from_dir
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-27 22:41:10 +02:00
Simon Ser
c2a150f7c2 cursor: remove xcursor_file_load_images wrapper
It's just calling xcursor_xc_file_load_images.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-27 16:01:42 +02:00
Simon Ser
73d4d2410e build: bump to version 1.20.91 for the alpha release
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-26 20:15:35 +02:00
Xavier Claessens
24244f26bf Meson: Override wayland-scanner if it can be run
This allows projects to use Wayland as a Meson subproject and get the
wayland-scanner executable when doing find_program('wayland-scanner').

Signed-off-by: Xavier Claessens <xavier.claessens@collabora.com>
2022-05-24 14:09:33 +00:00
Simon Ser
5e4253ed50 util: fix code block language in docs
Without {.xml}, Doxygen interprets the code as C. See [1] for
details.

[1]: https://www.doxygen.nl/manual/commands.html#cmdcode

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-23 10:13:46 +00:00
Simon Ser
93b61fde1f cursor: rename local variables to snake case
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-23 08:59:05 +00:00
Simon Ser
cf9065dfb8 cursor: drop xcursor_file abstraction
Just use FILE * directly instead.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-23 08:59:05 +00:00
Simon Ser
245d30ecb8 cursor: refactor xcursor_theme_inherits
Use early returns and breaks to avoid dealing with very long
indentation lines.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-23 08:59:05 +00:00
Simon Ser
963014459c cursor: convert macros to functions
Improves readability since there's no need for so many parentheses
anymore, adds type safety. The compiler will inline the function
automatically as necessary.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-23 08:59:05 +00:00
Simon Ser
bcfcd49232 cursor: rename functions to snake case
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-23 08:59:05 +00:00
Simon Ser
3c12a7a1be cursor: fix whitespace in function args definitions
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-23 08:59:05 +00:00
Simon Ser
a46d8be4e1 cursor: remove struct typedefs, rename to snake case
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-23 08:59:05 +00:00
Simon Ser
21394fd5f7 cursor: fix spacing around conditions and loops
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-23 08:59:05 +00:00
Simon Ser
315126d3bd cursor: fix indentation
Use tabs.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-23 08:59:05 +00:00
Simon Ser
450bb7c145 cursor: remove unnecessary if before free
free(NULL) is valid and is a no-op.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-23 08:59:05 +00:00
Simon Ser
92e758834c cursor: fix variable declaration style
Use a single space between type and variable name.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-23 08:59:05 +00:00
Simon Ser
b0a4e63351 cursor: fix struct declaration style
Use tabs for indentation, don't use tabs to align field names.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-23 08:59:05 +00:00
Simon Ser
329be63d6b cursor: fix define style
Don't use tabs, don't align.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-23 08:59:05 +00:00
Simon Ser
5f5f1da691 cursor: drop whitespace before parens in function calls
This is in line with the rest of the Wayland code style.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-23 08:59:05 +00:00
Simon Ser
13d4ae01cb cursor: drop XCURSOR_LIB_* defines
These are unused.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-23 08:59:05 +00:00
Simon Ser
7658cff241 cursor: drop XcursorTrue and XcursorFalse
Just use <stdbool.h> instead.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-23 08:59:05 +00:00
Simon Ser
4ea5ad1d11 cursor: remove private Xcursor int typedefs
Just use the types directly instead.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-23 08:59:05 +00:00
Simon Ser
d01868413f server: add wl_global_get_version
Add a helper to check the advertised version of a global. This can
be handy when checking whether a compositor feature is supported,
instead of having to store the version passed to wl_global_create
separately.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-23 08:53:19 +00:00
Derek Foreman
b19488c715 util: Limit size of wl_map
Since server IDs are basically indistinguishable from really big client
IDs at many points in the source, it's theoretically possible to overflow
a map and either overflow server IDs into the client ID space, or grow
client IDs into the server ID space. This would currently take a massive
amount of RAM, but the definition of massive changes yearly.

Prevent this by placing a ridiculous but arbitrary upper bound on the
number of items we can put in a map: 0xF00000, somewhere over 15 million.
This should satisfy pathological clients without restriction, but stays
well clear of the 0xFF000000 transition point between server and client
IDs. It will still take an improbable amount of RAM to hit this, and a
client could still exhaust all RAM in this way, but our goal is to prevent
overflow and undefined behaviour.

Fixes #224

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-05-16 14:39:21 +00:00
Simon Ser
f7ca2c65f3 docs/publican: ensure output encoding is UTF-8
Without this, DocBook picks the output encoding and on some setups
we end up with ISO-8859-1. Tested by booting a fresh Alpine VM,
verifying that the generated HTML is using the incorrect charset,
applying the patch, and verifying that the generated HTML is fixed.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-11 07:21:14 +00:00
Simon Ser
9402afc353 build: sanity check options
Fail when tests/documentation is enabled without libraries. Fail
when neither scanner nor libraries is enabled, because we don't
build anything in that case.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-10 14:02:51 +00:00
Simon Ser
2dcc35af81 cursor: use MAP_FAILED instead of hardcoded constant
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-06 21:57:24 +02:00
Simon Ser
04efea1727 Remove publish-doc
We don't use this script anymore.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-05 11:24:11 +02:00
Demi Marie Obenour
1078ee4993 wl_shell is not mandatory
Even though it is part of wayland.xml, wl_shell is not mandatory for
compositors to implement, and may be removed in a future version.

Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
2022-04-11 23:04:26 +00:00
Simon Ser
ff972f85b2 os: drop unnecessary memcpy in wl_os_mremap_maymove
FreeBSD doesn't support mremap [1], so we have a fallback
implementation based on munmap+mmap. We memcpy from the old memory
region to the new one, however this is unnecessary because the new
mapping references the same file as the old one.

Use msync to make sure any pending write is flushed to the underlying
file before we map the new region.

[1]: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=59912

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-04-11 09:21:53 +00:00
Olivier Fourdan
6c424e9d4c shm: Close file descriptors not needed
Commit 5a981ee8 implemented a fallback path for platforms which do not
support mremap() such as FreeBSD.

To do so, the file descriptor for the mmap() is not closed immediately
but instead kept as long as the pool exists.

That induces more file descriptors kept open for longer, which in turn
may cause problems as wl_shm may be using a lot of file descriptors,
especially with Xwayland which can create a lot of pixmaps on behalf of
its X11 clients.

For platforms where mremap() is available, keeping those file
descriptors opened is a bit of a waste and may cause exhaustion of file
descriptors sooner that before commit 5a981ee8.

Only keep the mmap() file descriptor open on platforms which do not
implement mremap()  and close it immediately as before on others.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1283
2022-04-05 10:42:03 +00:00
Sigrid Solveig Haflínudóttir
2bcc27ff36 connection: change clen type in build_cmsg to size_t
To avoid implicit conversion since msg_control's type is size_t.

Signed-off-by: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
2022-04-03 16:17:40 +00:00
Sigrid Solveig Haflínudóttir
d066c4bd4e connection: fix asan report on sendmsg call
Initialiaze the entire msghdr struct to 0 before use.

Example of the report fixed with this change:

AddressSanitizer:DEADLYSIGNAL
=================================================================
==20035==ERROR: AddressSanitizer: SEGV on unknown address 0x2dad4dbffffa0d (pc 0x0055555c7488 bp 0x007fffffc760 sp 0x007fffffc760 T0)
==20035==The signal is caused by a READ memory access.
    #0 0x55555c7488 in read_msghdr(void*, __sanitizer::__sanitizer_msghdr*, long) (/home/ftrvx/w/_/uxn/bin/uxnemu+0x77488)
    #1 0x55555c810c in sendmsg (/home/ftrvx/w/_/uxn/bin/uxnemu+0x7810c)
    #2 0x7ff7f2db20 in wl_connection_flush /home/ftrvx/q/wayland/build/../src/connection.c:315:10
    #3 0x7ff7f2d014 in wl_display_flush /home/ftrvx/q/wayland/build/../src/wayland-client.c:2154:9
    #4 0x7ff7e80bc0  (/lib/libSDL2-2.0.so.0+0x104bc0)
    #5 0x7ff7e523b0  (/lib/libSDL2-2.0.so.0+0xd63b0)
    #6 0x7ff7e534e4  (/lib/libSDL2-2.0.so.0+0xd74e4)
    #7 0x7ff7e535e8  (/lib/libSDL2-2.0.so.0+0xd75e8)
    #8 0x7ff7daad54  (/lib/libSDL2-2.0.so.0+0x2ed54)
    #9 0x7ff7dab130  (/lib/libSDL2-2.0.so.0+0x2f130)
    #10 0x555565bb40 in main /home/ftrvx/w/_/uxn/src/uxnemu.c:519:2
    #11 0x7ff7f62484 in libc_start_main_stage2 /builddir/musl-1.1.24/src/env/__libc_start_main.c:94:2

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/home/ftrvx/w/_/uxn/bin/uxnemu+0x77488) in read_msghdr(void*, __sanitizer::__sanitizer_msghdr*, long)
==20035==ABORTING

Signed-off-by: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
2022-04-03 16:17:40 +00:00
illiliti
de57106c94 meson: Use proper type for bools
Fix invalid usage of bools which violates official meson specification and thus
breaks muon, an implementation of meson written in C.

Signed-off-by: illiliti <illiliti@protonmail.com>
2022-04-02 17:04:08 +03:00
Simon Ser
962aefda42 server: introduce wl_signal_emit_mutable
wl_signal_emit doesn't handle well situations where a listener removes
another listener. This can happen in practice: wlroots and Weston [1]
both have private helpers to workaround this defect.

wl_signal_emit can't be fixed without breaking the API. Instead,
introduce a new function. Callers need to make sure to always remove
listeners when they are free'd.

[1]: https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/457

Signed-off-by: Simon Ser <contact@emersion.fr>
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2022-03-28 19:06:16 +00:00
Peter Hutterer
868eb99eb0 protocol: add the wl_pointer.axis_value120 events
These events are for high-resolution wheels. Each logical wheel click
represents an axis value120 value of 120, fractions of a wheel click an
integer fraction thereof. The new event replaces
wl_pointer.axis_discrete for wl_pointer versions 8 and above.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-03-28 17:31:27 +00:00
Aleksandr Mezin
79c84ed3f1 client, server: handle wl_map_insert_new() failures
Signed-off-by: Aleksandr Mezin <mezin.alexander@gmail.com>
2022-03-25 09:43:53 +00:00
Aleksandr Mezin
884d5fe3ab util: set errno in wl_map_insert_at()
And add errno checks in callers, where it seems to be necessary.

Signed-off-by: Aleksandr Mezin <mezin.alexander@gmail.com>
2022-03-25 09:43:53 +00:00
Aleksandr Mezin
03e8a1f84b util: set errno in wl_map_reserve_new()
And also fix wl_connection_demarshal() to pass through that errno.

Signed-off-by: Aleksandr Mezin <mezin.alexander@gmail.com>
2022-03-25 09:43:53 +00:00
Aleksandr Mezin
ae263cca3e util: always check result of wl_array_add()
Not checking the result of wl_array_add() can cause writes past the end of the
allocated buffer if realloc fails.

Signed-off-by: Aleksandr Mezin <mezin.alexander@gmail.com>
2022-03-25 09:43:53 +00:00
Simon Ser
b6bbc0c44d build: use get_variable(pkgconfig) instead of get_pkgconfig_variable()
We don't get a warning for it yet, but get_pkgconfig_variable() is
deprecated.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-03-25 09:14:08 +00:00
Simon Ser
24e0a7b622 build: specify native arg in add_languages()
Fixes the following warning:

    WARNING: add_languages is missing native:, assuming languages are wanted for
    both host and build.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-03-25 09:14:08 +00:00
Simon Ser
02661fde24 build: use full_path() instead of path()
Fixes the following warning:

    WARNING: Project targeting '>= 0.56.0' but tried to use feature deprecated
    since '0.55.0': ExternalProgram.path. use ExternalProgram.full_path() instead

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-03-25 09:14:08 +00:00
Alexander Irion
ca4678354c connection: Make wl_closure_print output atomic
When multiple threads are used, output from different threads was intermixed in one line. That what breaking parsing of the log messages. Now, intermixing is prevented by using a memstream.

Signed-off-by: Alexander Irion <alexander_irion@mentor.com>
2022-03-08 14:48:53 +01:00
Mikhail Gusarov
af8b5c0782 protocol: wl_shm.format events are actually sent after bind
Protocol documentation mistakenly specified that wl_shm.format
events are sent at connection setup time, but that's impossible
(clients do not yet know ID of wl_shm object at the time) and
contradicts implementation in libwayland.

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
2022-02-21 11:13:45 +01:00
Simon Ser
d690712b7b meson: use absolute paths for doxygen stamp files
The relative paths are incorrect when running as a subproject.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-02-05 15:39:23 +01:00
Simon Ser
7816f0b842 meson: use project build root for doxygen output
meson.build_root() returns the parent's build directory if Wayland is
a subproject. This fails with:

    error: tag OUTPUT_DIRECTORY: Output directory '<parent-build-dir>/doc/doxygen' does not exist and cannot be created

Instead, use meson.project_build_root(), which returns the subproject's
build directory.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-02-05 15:39:23 +01:00
Simon Ser
c78807520f meson: build requirement to 0.56.0
meson.project_build_root() is only available with 0.56.0.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-02-05 15:39:21 +01:00
Vlad Zahorodnii
4ebd997de2 cursor: Remove unused XcursorLibraryLoadImages() function
XcursorLibraryLoadImages() function is unused and not exported according to
objdump, so its removal should be an ABI compatible change.

Signed-off-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
2022-02-05 14:33:32 +00:00
Fergus Dall
e949b3bfbb display-test: Fix a race condition in test suite
Several tests in this suite use setting and checking client.display_stopped (in
test-compositor.h) to synchronise between threads. This is a data race because
display_stopped is a non-atomic int. Fix this by making it an atomic_bool
instead. We don't need to change the access code because reads and writes are
sequentially consistent by default.

This can be reproduced (with both clang and gcc) by running
```
meson -Db_sanitize=thread build
cd build
ninja
meson test
```

Signed-off-by: Fergus Dall <sidereal@google.com>
2022-02-05 14:29:39 +00:00
Simon Ser
5eb5620cbd Use zalloc for structs
When allocating memory for structs, use zalloc instead of malloc.
This ensures the memory is zero-initialized, and reduces the risk
of forgetting to initialize all struct fields.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-02-05 14:25:19 +00:00
Simon Ser
4b05ecb8f7 build: explicitly set check arg in run_command()
Fixes the following warning:

    WARNING: You should add the boolean check kwarg to the run_command call.
             It currently defaults to false,
             but it will default to true in future releases of meson.
             See also: https://github.com/mesonbuild/meson/issues/9300

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-02-02 15:04:42 +01:00
Julian Orth
ee92898cb5 protocol: xkb_v1 is null-terminated
Closes #270

Signed-off-by: Julian Orth <ju.orth@gmail.com>
2022-01-31 21:31:07 +00:00
Simon Ser
40c275f642 build: set c_std=c99
Set explicitly the C standard to use to make sure we don't use
features not available on our target platforms.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-01-10 15:08:46 +01:00
Simon Ser
0d314c4a04 build: don't rely on implicit GNU extensions
Currently libwayland assumes GNU extensions will be available, but
doesn't define the C standard to use. Instead, let's unconditionally
enable POSIX extensions, and enable GNU extensions on a case-by-case
basis as needed.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-01-10 15:08:46 +01:00
Simon Ser
65616e946b tests: use __typeof__ instead of typeof
typeof is a GNU extension. Compiler extensions should be prefixed
with __ per the C standard.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-01-10 14:51:09 +01:00
Simon Ser
31b17e3d85 build: re-open main branch for regular development 2022-01-10 11:13:16 +01:00
shierote
aa6a07c2fe doc: fix typo in wl_data_device.data_offer
Signed-off-by: Taishi Eguchi <taishi2060@gmail.com>
2022-01-10 10:07:22 +00:00
Derek Foreman
ea237db7f6 tests: Fix tc_client_fd_leaks_exec test
tc_client_fd_leaks and tc_client_fd_leaks_exec are currently the exact
same test. It seems clear from the name that the latter was intended to
spawn sanity_fd_leak_exec instead of sanity_fd_leak.

Fixes #121

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-01-10 09:52:00 +00:00
Max Ihlenfeldt
8893573651 protocol: clarify wl_shm_pool.resize
Add a note that the request only changes the size of the memory mapping
and does not touch the mapped file.

Signed-off-by: Max Ihlenfeldt <mihlenfeldt@igalia.com>
2022-01-07 13:30:29 +00:00
Mikhail Gusarov
eca836add5 doc: Clarify that null terminator is included in string length
Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
2021-12-18 15:01:21 +01:00
Mikhail Gusarov
971a0a8b84 doc: Clarify position of file descriptors in the stream
The specification left the position and order of file
descriptors unspecified. Specify that

- order of file descriptors is maintained
- position of file descriptors is bounded, but loose

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
2021-12-12 15:09:00 +01:00
Simon Ser
75c1a93e20 build: bump to version 1.20.0 for the official release 2021-12-09 17:20:36 +01:00
Simon Ser
ba82e0d806 meson: override dependencies to ease use as subproject
Make it easier to use Wayland as a Meson subproject by overriding
dependencies we define. This allows to easily build Wayland as a
subproject like so:

    subproject('wayland', required: false, default_options: ['documentation=false'])

After this statement, the wayland-* dependencies will use the subproject
instead of the system if available.

Signed-off-by: Simon Ser <contact@emersion.fr>
2021-12-08 00:27:58 +01:00
Simon Ser
28c2d8321b build: bump to version 1.19.93 for the RC1 release 2021-12-02 20:51:39 +01:00
Simon Ser
dcd8a62b18 build: bump to version 1.19.92 for the beta release 2021-11-18 16:30:09 +01:00
Jan Grulich
78590b3aff protocol: clarify wl_data_offer::selection
Clearly specify that switching focus within the same client
doesn't mean a new selection will be send.

Signed-off-by: Jan Grulich <jgrulich@redhat.com>
2021-11-15 13:20:41 +00:00
Manuel Stoeckl
1638dad613 protocol: sync wl_shm.format with libdrm 2.4.108
The four new formats added (all 16 bpc, RGB colorspace) are very useful
for applications providing high bit depth content and rendering their
buffers on CPU, as computations with 16 bit unsigned integers are often
more efficient than with the (half float, 10 bit) alternative formats.

Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
2021-11-11 20:15:22 -05:00
Simon Ser
5420619f91 build: bump to version 1.19.91 for the alpha release 2021-11-04 20:39:22 +01:00
Duncan McIntosh
20fd3b3af9 wayland-shm: Check the size of sealed memory if ignoring SIGBUS handlers
In 11623e8f, SIGBUS handlers aren't set if F_SEAL_SHRINK is configured on
the memory. This helps avoid setting up handlers with cooperative clients;
however, if an application gives an incorrect size, the compositor would
access it anyways, figuring SIGBUS is impossible, and crash.

This can be fixed by simply removing the seal-checking logic and always
setting the signal handler. However, it seems that fstat can give the size
of the memfd, so we can check that the size we were told is within the
region. Since it's sealed to shrinking, it must never be shrunk in future,
so we can really (hopefully) ignore SIGBUS.

I was worried that fstat wasn't supported for this, but shm_overview(7) does
mention that it is a possible use.

The best solution would likely be avoiding SIGBUS entirely with
MAP_NOSIGBUS, but that hasn't been merged yet and wouldn't help systems
without it (e.g. with older kernels).

A proof-of-concept of this crash is attached with the merge request. Running
it with this patch gives an invalid-shm error, which is correct.

Signed-off-by: Duncan McIntosh <duncan82013@live.ca>
2021-11-04 09:02:19 +00:00
Simon Ser
ebfc70cdf7 protocol: wl_shm uses pre-multiplied alpha
Add a note about pre-multiplied alpha for all wl_shm formats.
Include an escape hatch in the spec to allow other protocol
extensions to override this.

Signed-off-by: Simon Ser <contact@emersion.fr>
Closes: https://gitlab.freedesktop.org/wayland/wayland/-/issues/61
2021-11-04 08:53:47 +00:00
Derek Foreman
ca893075ef debug: Fix printing of new ids
The client side closure traces have incorrect object ids for new server
generated objects. This is because create_proxies() overwrites the id in
'n' type arguments by storing a pointer to the actual object in the 'o'
field of the union.

Getting back to an id from this pointer requires accessing a structure
that isn't visible outside of wayland-client.c.

Add a function pointer to fish the correct value out of the argument and
pass it to wl_closure_print.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2021-11-02 11:27:51 +00:00
Simon Ser
9c05e6c475 protocol: add wl_output.{name,description}
This is inspired from xdg-output-unstable-v1. This allows clients to
get the name and description without having to use xdg_output. This
should eventually allow us to restrict xdg_output to clients like
Xwayland.

The name is a unique non-persistent user-friendly string that can be
used to refer to an output. This can be used by Wayland clients to
refer to a specific wl_output (e.g. across processes or in CLI
arguments).

The description is a non-unique user-friendly string that can be
displayed to the user.

Signed-off-by: Simon Ser <contact@emersion.fr>
References: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/issues/7
2021-10-28 14:03:04 +00:00
Simon Ser
aa88321517 protocol: add note about wl_output.done in events
Mention that geometry, mode and scale wl_output events are followed
by a done event.

Signed-off-by: Simon Ser <contact@emersion.fr>
2021-10-28 14:03:04 +00:00
Simon McVittie
0cdd2a5c54 build: Include the Wayland minor version in libraries' ABI versions
The ABI of a shared library on Linux is given by a major version, which
is part of the SONAME and is incremented (rarely) on incompatible
changes, and a minor version, which is part of the basename of the
regular file to which the SONAME provides a symlink.

Until now, the ABI minor version was hard-coded, which means we can't
tell which of a pair of Wayland libraries is newer (and therefore
likely to have more symbols and/or fewer bugs).

libwayland-egl already had ABI major version 1, so we can use the
"marketing" version number as the ABI major.minor version number
directly, so Wayland 1.19.90 would produce
libwayland-egl.so.1 -> libwayland-egl.so.1.19.90.

libwayland-cursor and libwayland-server have ABI major version 0,
and OS distributions don't like it when there's a SONAME bump for no
good reason, so use their existing ABI major version together with
the "marketing" minor version:
libwayland-cursor.so.0 -> libwayland-cursor.so.0.19.90.

If the Wayland major version number is incremented to 2, we'll have to
rethink this, so add some error() to break the build if/when that
happens. Assuming that Wayland 2.0 would involve breaking changes,
the best way would probably to bump all the SONAMEs to
libwayland-foo.so.2.

Resolves: https://gitlab.freedesktop.org/wayland/wayland/-/issues/175
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-10-28 12:46:06 +00:00
Jonas Ådahl
fceabb7e9e protocol: Add wl_surface.offset
This is meant to address the issue where the call to 'wl_surface.attach'
is done by e.g. Vulkan, meaning applications cannot affect the values of
the offset passed as the x and y arguments.

The lack of ability to pass these is problematic when using the Vulkan
for e.g. drawing DND surfaces, as the buffer offset is used to implement
the drag icon hotspots.

Closes: https://gitlab.freedesktop.org/wayland/wayland/-/issues/148
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
2021-10-28 12:39:39 +00:00
Manuel Stoeckl
f00cfda737 client: handle fcntl error on bad fd in wl_display_connect
This makes wl_display_connect fail immediately instead of
succeeding when the integer provided by WAYLAND_SOCKET does
not refer to a valid file descriptor.

Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
2021-10-28 12:30:43 +00:00
Damian Hobson-Garcia
d564823cfd server: stop wl_display event loop from any context
Calling wl_display_terminate() will exit the wl_display event loop
at the start of the next loop iteration.  This works fine when
wl_display_terminate() is called after the event loop wakes up
from polling on the added event sources.  If, however, it is
called before polling starts, the event loop will not exit until
one or more event sources trigger.  Depending on the types of event
sources, they may never trigger (or may not trigger for a long time),
so the event loop may never exit.

Add an extra event source to the wl_display event loop that will trigger
whenever wl_display_terminate() is called, so that the event loop will
always exit.

Fixes #201

Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
2021-10-09 13:09:04 +00:00
Matt Hoosier
c6c1bbe4ab protocol: mention that buffers with alpha are assumed premultiplied
This turns out to be the default assumption by compositors, OpenGL, and the DRM
framework. Let's say it explicitly to avoid misinterpretation.

See https://lists.freedesktop.org/archives/wayland-devel/2021-September/041990.html.

Signed-off-by: Matt Hoosier <matt.hoosier@garmin.com>
2021-09-29 09:43:21 -05:00
Olivier Fourdan
616b4ae618 shm: Relax shm_pool_create_buffer() validity check
shm_pool_create_buffer() can raise a false WL_SHM_ERROR_INVALID_STRIDE
error under some circumstances because of integer division.

Fix this by using a strict comparison operator instead of lower or
equal.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Demi Marie Obenour <demi@invisiblethingslab.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Closes: https://gitlab.freedesktop.org/wayland/wayland/-/issues/235
2021-09-16 17:31:09 +02:00
Simon Ser
7ef305d073 protocol: mention that keymap mapping must be read-only
It may be obvious that the mapping must be established in read-only
mode, but it wasn't specified in the specification text.

Signed-off-by: Simon Ser <contact@emersion.fr>
2021-09-16 08:25:05 +00:00
Alex Richardson
4d473310eb gitlab-ci: add a FreeBSD test job
This uses the new FreeBSD supported added in
https://gitlab.freedesktop.org/freedesktop/ci-templates/-/merge_requests/114
After the latest series of commits, we should be able to compile and
successfully run all tests, so adding this CI job will prevent any future
FreeBSD regressions.

Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
2021-09-10 11:35:54 +00:00
Alex Richardson
ed423b8ac6 Allow event-loop signal tests to pass on FreeBSD
On Linux the signal will be immediately visible in the epoll_wait() call.
However, on FreeBSD we may need a small delay between kill() call and the
signal being visible to the kevent() call. This sometimes happens when the
signal processing and kevent processing runs on different CPUs in the
kernel, so becomes more likely when the system is under load (e.g. running
all tests in parallel).

See https://github.com/jiixyj/epoll-shim/pull/32

Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
2021-09-10 11:35:54 +00:00
Alex Richardson
382f368a27 Detect FreeBSD versions with broken MSG_CMSG_CLOEXEC
If we are compiling against a version of FreeBSD where MSG_CMSG_CLOEXEC
does not work, use the fallback directly. This was only fixed recently
(in https://cgit.freebsd.org/src/commit/?id=6ceacebdf52211).

Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
2021-09-10 11:35:54 +00:00
Alex Richardson
42bf011f65 test-helpers: use sysctl() to count open fds on FreeBSD
This allows running the tests on FreeBSD without mounting fdescfs.
Previously you had to run `mount -t fdescfs -o linrdlnk null /dev/fd` to
get file descriptors >=3 listed in /dev/fd.

Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
2021-09-10 11:35:54 +00:00
Alex Richardson
bb92828807 test-runner: Implement is_debugger_attached() for FreeBSD
FreeBSD provides a PROC_TRACE_STATUS procctl(2) to detect this directly.

Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
2021-09-10 11:35:54 +00:00
Alex Richardson
644efe9517 Use /dev/fd instead of /proc/self/fd
/dev/fd exists on all operating systems I can test (Linux, FreeBSD, macOS),
whereas /proc/self/fd only appears to exist on Linux.

Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
2021-09-10 11:35:54 +00:00
Alex Richardson
5a981ee823 shm: Add mmap+memmove fallback if mremap() does not exist
Some operating systems (e.g. FreeBSD) do not implement mremap.
In that case we can grow the mapping by trying to map adjacent memory.
If that fails we can fall back to creating a new larger mapping and
moving the old memory contents there.

Co-authored-by: Koop Mast <kwm@rainbow-runner.nl>
Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
2021-09-10 11:35:54 +00:00
Alex Richardson
54b237a612 Support reading ucred from the socket on FreeBSD
On FreeBSD we have to use getsockopt(fd, SOL_LOCAL, LOCAL_PEERCRED)
instead. This change is based on a downstream patch in FreeBSD ports.

Co-authored-by: Greg V <greg@unrelenting.technology>
Co-authored-by: Koop Mast <kwm@rainbow-runner.nl>
Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
2021-09-10 11:35:54 +00:00
Alex Richardson
f1552700ce gitlab-ci: add junit reports to the debian builder
Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
2021-09-10 11:35:54 +00:00
Alex Richardson
c0e8990e65 gitlab-ci: Fix copy-paste error in a comment
Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
2021-09-10 11:35:54 +00:00
Alex Richardson
3288a076eb gitlab-ci: remove duplicated lines in ci-templates include
The file key can have multiple values, so we don't need another "project".

Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
2021-09-10 11:35:54 +00:00
Alex Richardson
c260d57750 gitlab-ci: update ci-templates to the latest commit
This is in preparation for adding FreeBSD CI support.

Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
2021-09-10 11:35:54 +00:00
Alex Richardson
c65f852fc8 Use epoll-shim to emulate epoll(7) on FreeBSD
FreeBSD does not provide epoll(7) and instead requires an external library,
epoll-shim, that implements epoll() using kqueue(2)

Co-authored-by: Jan Beich <jbeich@FreeBSD.org>
Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
2021-09-10 11:35:54 +00:00
Alex Richardson
8ec25be6db os-wrappers-test: Handle fcntl() being declared as a macro
On some systems (e.g. FreeBSD with the latest epoll-shim), fcntl is
declared as a macro instead of a function. Wrap the definition here in
parantheses to avoid function-macro expansion.

Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
2021-09-10 11:35:54 +00:00
Derek Foreman
bf98c1a8f2 tests: Destroy custom global object
Destroy our custom global object at end of run so we no longer "leak"
it.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2021-08-27 09:56:17 -05:00
Derek Foreman
f736f11f99 connection: Rename wl_buffer
struct wl_buffer has other meaning in wayland, thus making this a pretty
confusing structure name. Function names like wl_buffer_put() just
compound the confusion.

Rename the struct and the associated functions (none of which are called
from outside this file anyway). The struct retains a wl_ prefix, as is
the custom for wayland internal data structures. The function names
have not retained this prefix, as we have many static function that
aren't prefixed.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2021-08-09 11:51:58 -05:00
Derek Foreman
0e0274af0c scanner: Use the new atomic marshal/destroy function
Use the new flagged marshal+destroy function in generated code.

It's intended as a replacement for all existing wl_proxy_marshal_*
functions, so I've used it to replace them all. This results in a large
update to the scanner test files as well.

We now pass the new WL_MARSHAL_FLAG_DESTROY flag when appropriate, so
the race condition in #86 caused by releasing the display mutex between
marshalling the proxy and destroying the proxy is now gone.

Fixes #86

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2021-08-07 11:53:23 +00:00
Derek Foreman
23e4a70600 client: Add new proxy marshalling functions with flags
There's a race when destroying wayland objects in a multi-threaded client.
This occurs because we call:
wl_proxy_marshal(foo);
wl_proxy_destroy(foo);

And each of these functions takes, and releases, the display mutex.
Between the two calls, the display is not locked.

In order to allow atomically marshalling the proxy and destroying the
proxy without releasing the lock, add yet more wl_proxy_marshal_*
functions.  This time add flags and jam in all existing warts with the
hope that we can make it future proof this time.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2021-08-07 11:53:23 +00:00
Derek Foreman
942f1d8843 client: Refactor wl_proxy_destroy critical section
Split wl_proxy_destroy into two pieces, wl_proxy_destroy_unlocked which
performs the critical section code with no locking, and wl_proxy_destroy
which locks before calling that.

We'll use the new unlocked variant later in code that already holds the
lock.

There is a slight functional change - an aborting check is now called
with the lock held. This should be harmless as wl_abort() performs
no locking.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2021-08-07 11:53:23 +00:00
Simon Ser
6ebe3cfed0 cursor: remove unused wl_cursor_theme.name
Let's just delete this field since it's not used anywhere and not
exposed in our public API.

Signed-off-by: Simon Ser <contact@emersion.fr>
2021-08-06 09:26:03 +00:00
Simon Ser
2dfa0dcb24 cursor: rename load_default_theme to load_fallback_theme
The theme getting loaded by this function is not to be confused
with the theme named "default" located on the filesystem. Instead,
it's a minimal theme directly bundled into libwayland-cursor.

Make this clearer by naming this theme "fallback".

Signed-off-by: Simon Ser <contact@emersion.fr>
2021-08-05 17:24:02 +02:00
Olivier Tilloy
f80879c03c cursor: Try to fall back to a default xcursor theme first
The use case is systems where for some reason the current xcursor theme
cannot be accessed (an application packaged as a strictly confined snap,
for example).

Before falling back to wayland's default cursor theme, it is worth
trying the xcursor theme called "default", which hopefully looks better
than the former.

Fixes: https://gitlab.gnome.org/Community/Ubuntu/gnome-sdk/-/issues/6

Signed-off-by: Olivier Tilloy <olivier.tilloy@canonical.com>
2021-08-05 17:09:40 +02:00
Daniel Stone
c4453ce1a5 ci: Sanitise build and install paths
No sense in generating enormously long paths. This also happens to fix
artifacts not actually recording anything because we had a mismatch in
artifact paths vs. actual paths.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2021-08-04 18:20:27 +01:00
Daniel Stone
7769b63141 ci: Use Werror
No point warning on stuff if we don't make it fail.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2021-08-04 18:20:27 +01:00
Daniel Stone
0d3e47abdc ci: Use appropriate concurrency level
The appropriate concurrency level is not necessarily the number of
available CPUs; limit it to what the runners tell us we should be using.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2021-08-04 18:20:27 +01:00
Daniel Stone
71ff5fe0af ci: Add release builds
Signed-off-by: Daniel Stone <daniels@collabora.com>
2021-08-04 18:20:26 +01:00
Daniel Stone
705154a09d ci: Use consistent YAML indendation
Signed-off-by: Daniel Stone <daniels@collabora.com>
2021-08-04 18:16:59 +01:00
Daniel Stone
e4deb4dc66 ci: Only run ci-fairy on MRs
This requires adding rules to all the jobs, as it's all or nothing.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2021-08-04 18:16:59 +01:00
Daniel Stone
c4865c774b ci: Add ARMv7 build
Signed-off-by: Daniel Stone <daniels@collabora.com>
2021-08-04 18:16:59 +01:00
Daniel Stone
33767673bc ci: Add AArch64 build
Signed-off-by: Daniel Stone <daniels@collabora.com>
2021-08-04 18:16:55 +01:00
Daniel Stone
b88e1d40b0 ci: Parameterise and template build
This will make it a lot easier to add other variants later.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2021-08-03 21:22:15 +01:00
Daniel Stone
7940bbb735 ci: Add comments, rename build stages
No non-cosmetic changes, just making things more accessible.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2021-08-03 21:10:51 +01:00
Simon Ser
2aa0a83d36 connection: print array size
This makes it easier to understand how an xdg_toplevel is configured for
instance.

Signed-off-by: Simon Ser <contact@emersion.fr>
2021-07-31 16:54:57 +00:00
Manuel Stoeckl
2f05ceeb4d connection, client: Avoid locale-dependent float printing
Specifically, in the log formed when WAYLAND_DEBUG is set, this commit
ensures that floating point numbers are formatted using '.' instead of
the locale-specific decimal separator. As the debug logs are not
otherwise localized for end-users, and may be parsed by scripts, it is
better to have consistent output here.

The 24.8 fixed point numbers are now represented with 8 digits after
the decimal, since this is both exact and simpler to compute.

Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
2021-07-31 16:49:54 +00:00
Fergus Dall
91d98b622f os-wrappers-test: Make syscall intercepts work with sanitizers
Sanitizers need to intercept syscalls in the compiler run-time library, as
do these tests. We try to make this work by using dlsym(RTLD_NEXT) to find
the next definition in the chain, but here this approach won't work because
the compiler run-time library is linked into the same elf object as the test
interceptors are.

The sanitizer library supports this by giving the intercept functions a
prefix and making them only weakly alias the real names, so our interceptors
can call the sanitizers interceptors explicitly, which will then use dlsym
to call the real function.

By making our declarations of the sanitizer interceptor function weak we can
handle any combination of intercepts (including none, if there is no
sanitizer). If our declaration is resolves to a NULL pointer, we just use
dlsym.

Signed-off-by: Fergus Dall <sidereal@google.com>
2021-07-22 22:27:45 +00:00
Fergus Dall
e5c3ac9bcd connection-test: Pad out strings with null bytes
The connection_demarshal test writes a 10 byte string into a wayland message,
but doesn't pad it out to a four byte boundary. This leads to the last 32-bit
word of the message being partially uninitialized, which triggers an msan
violation when the message is written to the socket.

Signed-off-by: Fergus Dall <sidereal@google.com>
2021-07-22 22:27:45 +00:00
Fergus Dall
f6b78b76b2 server: Fix undefined behavior in wl_socket_init_for_display_name
This function constructs a socket path in sun_path using snprintf, which
returns the amount of space that would have been used if the buffer was
large enough. It then checks if this is larger then the actual buffer size
and, if so, returns ENAMETOOLONG. This is correct.

However, after calling snprintf and before checking that the length isn't too
long, it tries to compute a pointer to the part of the path that matches the
input name. It does this by adding the computed path length to the pointer to
the start of the path buffer, which will take it to one-past the null
terminator, and then walking backwards. If the path fits in the buffer, this
will take it at most one-past-the-end of the allocation, which is allowed, but
if the path is longer then the buffer then the pointer addition is undefined behavior.

Fix this by moving the display name computation past the check that the path
length is not too long.

This is detected by the test socket_path_overflow_server_create under ubsan.

Signed-off-by: Fergus Dall <sidereal@google.com>
2021-07-21 11:42:42 +00:00
Fergus Dall
80164ef300 util: Avoid undefined behaviour in for_each_helper
for_each_helper tries to calculate a one-past-the-end pointer for its
wl_array input. This is fine when the array has one or more entries, but we
initialize arrays by setting wl_array.data to NULL. Pointer arithmetic is
only defined when both the pointer operand and the result point to the same
allocation, or one-past-the-end of that allocation. As NULL points to no
allocation, no pointer arithmetic can be performed on it, not even adding 0,
even if the result is never dereferenced.

This is caught by clang's ubsan from version 10.

Many tests already hit this case, but I added an explicit test for iterating
over an empty wl_map.

Signed-off-by: Fergus Dall <sidereal@google.com>
2021-07-21 11:42:42 +00:00
Manuel Stoeckl
ada25fbd52 client: print discarded events in debug log
Before this patch, setting WAYLAND_DEBUG=1 or WAYLAND_DEBUG=client made
a program log all requests sent and events that it processes. However,
some events received are not processed. This can happen when a Wayland
server sends an event to an object that does not exist, or was recently
destroyed by the client program (either before the event was decoded,
or after being decoded but before being dispatched.)

This commit prints all discarded messages in the debug log, producing
lines like:

[1234567.890] discarded [unknown]@42.[event 0](0 fd, 12 byte)
[1234567.890] discarded wl_callback@3.done(34567)
[1234567.890] discarded [zombie]@13.[event 1](3 fd, 8 byte)

The first indicates an event to an object that does not exist; the
second, an event to an object that was deleted after decoding, but
before dispatch; the third, an event to an object that left a
'zombie' marker behind to indicate which events have associated
file descriptors.

Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
2021-07-20 09:20:38 +00:00
Pekka Paalanen
13ccd1c4db wayland-util: avoid memcpy(NULL) in wl_array_copy()
The problem was found running Weston, with both Weston and Wayland built
with ASan:

../../git/wayland/src/wayland-util.c:150:2: runtime error: null pointer passed as argument 1, which is declared to never be null
../../git/wayland/src/wayland-util.c:150:2: runtime error: null pointer passed as argument 2, which is declared to never be null

This turns out to be caused by copying an empty array into an empty
array.

That seems to be completely valid thing to do, and wl_array_init()
initializes the pointers to NULL and size to zero. Copying initialized
arrays must always be valid.

The error are caused by calling memcpy() with NULL pointers. It doesn't
explode, because also the size is zero.

Fix the problem by calling memcpy() only if size is not zero. This
should keep things like copying an empty array into a non-empty array
work.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-07-14 07:21:40 +00:00
Simon Ser
8899310fc8 shm: document wl_shm_buffer
The main motivation is to make it clear when a wl_shm_buffer is
destroyed.

Signed-off-by: Simon Ser <contact@emersion.fr>
2021-07-13 15:52:31 +02:00
James Legg
b7153f2273 tests: Test wayland-scanner with a description in an entry
This previously would have caused a memory leak and incorrect
comments.

Signed-off-by: James Legg <lankyleggy@gmail.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-07-07 12:11:42 +00:00
James Legg
51d336ec14 scanner: Use descriptions in entries
entry may have a description according to the DTD. This is used in
some protocols including xdg-shell.

Fixes the code comment on an enum declaration using the description of
the last enum that had one, adds the descriptions to the comments on
enumerators, and avoids leaking the previously missing descriptions.

Fixes #208

Signed-off-by: James Legg <lankyleggy@gmail.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-07-07 12:11:42 +00:00
Simon Ser
767765d584 protocol: clarify wl_seat.name description
Define the expected properties of the seat name.

Signed-off-by: Simon Ser <contact@emersion.fr>
2021-07-06 11:57:39 +00:00
Pekka Paalanen
92038fa394 CI: turn on ASan and UBSan
I just noticed that libwayland test suite is ASan and UBSan clean, so
let's turn that on in CI to avoid regressing.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-07-01 16:28:08 +03:00
Simon Ser
817fdb9009 shm: add safety assertions
Catch any API mis-use with an assert. This should abort when the
user calls unreferences the pool more times than it's referenced.

Also change the refcount check to explicitly check for positive
counts. That makes the condition more readable.

Signed-off-by: Simon Ser <contact@emersion.fr>
2021-06-29 11:17:44 +02:00
Fergus Dall
ccc9612e82 connection: Handle non-nullable strings in wl_connection_demarshal
Currently a null string passed into a non-nullable argument of a message
will decode succesfully, probably resulting in the handler function
crashing. Instead treat it the same way we do non-nullable objects and ids.

Signed-off-by: Fergus Dall <sidereal@google.com>
2021-06-22 20:15:39 +10:00
Fergus Dall
4f53613e70 connection-test: Encode size in message headers correctly
In these tests, message sizes are inconsistently encoded in either the upper
or lower 16 bits of the second word of the message. Resolve this in favour
of using the upper 16 bits, as this is how messages are supposed to be
encoded, even though that aspect of message decoding isn't being tested
here.

Signed-off-by: Fergus Dall <sidereal@google.com>
2021-06-22 20:15:32 +10:00
Simon Ser
3e897faa29 protocol: allow immediate wl_buffer.destroy if not re-used
Allow wl_buffer objects to be destroyed without having to wait for
wl_buffer.release if the underlying storage isn't going to be
re-used.

The main motivation for this is to avoid glitches when a client is
torn down. When a client disconnects, all of its objects are destroyed
in arbitrary order. However some compositors will still need to
access the destroyed buffer's underlying storage afterwards, e.g. for
visual effects (fade-out) or for atomic layout updates (wait for other
clients to commit a new buffer before hiding the buffer).

It's still incorrect for clients to destroy a wl_buffer and mutate
the underlying storage without waiting for wl_buffer.release.

Signed-off-by: Simon Ser <contact@emersion.fr>
Closes: https://gitlab.freedesktop.org/wayland/wayland/-/issues/185
2021-06-11 14:05:27 +00:00
Simon Ser
ba0c63dee8 shm: remove wl_shm_buffer.pool NULL checks
wl_shm_buffer.pool is never set to NULL. The only time it's set is
in shm_pool_create_buffer, and the pool is guaranteed to be non-NULL
there.

Signed-off-by: Simon Ser <contact@emersion.fr>
2021-06-10 14:33:32 +00:00
Tobias Stoeckmann
abcf1048e2 cursor: fix crash with weird input files
If a cursor file contains multiple images for the same size, this
typically indicates an animation. The compositor weston uses
wl_cursor_frame_and_duration to figure out at which time a specific image
should be shown.

The total delay is the sum of all image delays. But if all images have a
delay of 0, the total delay is 0 as well. The code does not check for this
special condition and triggers a floating point exception by eventually
performing a modulo operation with 0.

This, of course, could also happen if the sum of all image delays
triggers an unsigned int overflow. But since a comment in the code
already indicates that it does not try to "fix" handling of weird files,
I would argue that it's "okay" if that happens. At least the program
won't crash.

Proof of Concept:

install -D ~/.icons/poc/cursors
base64 -d > ~/.icons/poc/cursors/left_ptr << EOF
WGN1chAAAAAAAAEAAgAAAAIA/f8BAAAAKAAAAAIA/f8BAAAAKAAAACQAAAACAP3/AQAAAAEAAAAB
AAAAAQAAAAEAAAABAAAAAAAAAAAAAAA=
EOF
cat > /tmp/weston.ini << EOF
[shell]
cursor-theme=poc
EOF
weston -c /tmp/weston.ini

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2021-06-02 13:46:33 +00:00
Simon Ser
f8bea2450d protocol: drop reference to wl_drm
Change the wl_drm reference to linux-dmabuf. wl_drm is a legacy,
private Mesa protocol that shouldn't be used by regular clients.

Signed-off-by: Simon Ser <contact@emersion.fr>
2021-05-27 10:48:40 +02:00
Simon Ser
f452e41264 build: replace assembly embedding with Python script
This allows Meson to properly track dependencies and re-build the scanner when
editing the dtd. We also stop depending on GNU as' .incbin and make the
embedding less obscure.

Signed-off-by: Simon Ser <contact@emersion.fr>
2021-05-10 22:08:45 +00:00
Marius Vlad
e475decf1d src: Add missing new lines to log messages
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-05-07 11:07:54 +03:00
Nick Diego Yamane
208fc99e66 Document serial param usage in wl_pointer.set_cursor
Serial is supposed to contain the latest wl_pointer.enter value received
by clients but it was not even mentioned in the docs, so add it to avoid
misinterpretations.

Signed-off-by: Nick Diego Yamane <nickdiego@igalia.com>
2021-05-04 15:26:48 +00:00
Tobias Stoeckmann
ed55438366 cursor: fix CVE-2013-2003
The libXcursor fix for CVE-2013-2003 has never been imported into
wayland, leaving it vulnerable to it.

Changing the argument type to an unsigned type is an effective merge of
Ilja Van Sprundel's commit in libXcursor.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2021-05-02 21:35:23 +02:00
Alexander Dunaev
0aebb5b94d cursor: add one more directory to XCURSORPATH
The user may install cursor themes manually, and the desktop environment
may provide a special directory for storing them.  For instance, GTK puts
those themes into ~/.local/share/icons, and many Linux distributions suggest
using that directory for user-specific themes.  However, users of
libwayland-cursor cannot load these themes using the API provided by the
library because the latter does not look into that directory.

This patch adds ~/.local/share/icons to the search path, so user-specific
themes can be loaded through the API provided by libwayland-cursor.

Signed-off-by: Alexander Dunaev <adunaev@igalia.com>
Reviewed-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
Reviewed-by: Simon Ser <contact@emersion.fr>
2021-04-27 11:16:17 +00:00
James Hilliard
88f1605a82 build: add option to disable tests
When building for a product, tests are not needed.

Besides, one test requires a C++ compiler, which is not always
available.

So, add an option to configure to disable building tests altogether.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
2021-04-16 03:45:06 -06:00
James Hilliard
4c21053123 meson: only require cpp for tests
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
2021-04-16 03:04:56 -06:00
Alex Richardson
34306efeb2 Change wl_os_dupfd_cloexec minfd to be int
The fcntl() argument is defined to be an int and not a long. This does not
matter on most architectures since the value is passed in registers, but
it causes issues on big-endian architectures that pass variadic arguments
on the stack.

Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
Reviewed-by: Simon Ser <contact@emersion.fr>
2021-04-15 07:34:53 +00:00
Alex Richardson
e881934927 os-wrappers-test.c: Correctly forward arguments to fcntl
We can't just unconditionally read the optional arguments (and also read
it as a void* despite actually being an int).
While this happens to work on most architectures because the first few
variadic arguments are passed in registers, this is non-portable and
causes a crash on architectures that set bounds on variadic function
arguments (for example CHERI-enabled architectures). It could also cause
problems on big-endian architectures that pass variadic arguments on the
stack rather than in registers.

For CHERI-MIPS, reading sizeof(void*) causes a read of 16 bytes from the
bounded varargs capability. This always crashes since even calls with the
optional argument only have 4 bytes available.

Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
Reviewed-by: Simon Ser <contact@emersion.fr>
2021-04-15 07:34:53 +00:00
Michael Weiss
e4659ffbf5
meson: Only require expat when building wayland-scanner
This code is only required for building wayland-scanner so it should be
scoped accordingly. libxml-2.0 will only be required if both "scanner"
and "dtd_validation" are set to true.

Signed-off-by: Michael Weiss <dev.primeos@gmail.com>
2021-04-02 20:55:15 +02:00
Jonas Ådahl
d224e6ccf3 ci: Use ci-fairy to check for Signed-off-by
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2021-03-26 17:24:47 +01:00
Alex Richardson
1349d3d15b Use MAP_FAILED instead of (void *) -1
While MAP_FAILED is generally defined to that value, we should not be
relying on implementation details of system headers.

Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
Reviewed-by: Simon Ser <contact@emersion.fr>
2021-03-22 14:05:11 +00:00
Simon Ser
3bda3d1b47 build: drop autotools
Meson now replaces autotools.

Signed-off-by: Simon Ser <contact@emersion.fr>
2021-03-05 09:15:04 +00:00
Vlad Zahorodnii
2b22160fb6 server: add wl_display getter for wl_global
This can be useful if the compositor wants to call wl_global_destroy() with some
delay but it doesn't have the wl_display object associated with the global,
which is needed to get access to the event loop.

Signed-off-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
2021-03-05 09:12:33 +00:00
Simon Ser
727c7903b2 client: assert queue display matches proxy
In wl_proxy_set_queue, passing a wl_event_queue from a completely
unrelated wl_display could lead to object IDs mismatches.

Add an assertion to catch this case. It's always a user bug if this
happens.

Signed-off-by: Simon Ser <contact@emersion.fr>
2021-02-25 23:49:00 +01:00
sheepwall
70f1c83fd9 server: remove duplicate include
Signed-off-by: August Svensson <a.sve@live.se>
2021-02-22 19:09:08 +01:00
Tadeo Kondrak
ddf21afa6e protocol: Specify wl_callback::done to be a destructor event
It's the only destructor event in the core protocol, and destructor
events were previously unannotated.

Signed-off-by: Tadeo Kondrak <me@tadeo.ca>
2021-01-27 17:49:10 +00:00
Tadeo Kondrak
efab39642e protocol: Add type attribute to events
This allows specifying events to be destructors, which is useful for
non-C language bindings. It is unused in wayland-scanner.

Signed-off-by: Tadeo Kondrak <me@tadeo.ca>
2021-01-27 17:49:10 +00:00
Simon Ser
f1cc5d0c37 build: re-open master for regular development 2021-01-27 18:45:57 +01:00
Simon Ser
e60398b175 build: bump to version 1.19.0 for the official release 2021-01-27 17:48:01 +01:00
Simon Ser
0344e08ce0 build: bump to 1.18.93 for the RC1 release 2021-01-20 22:35:34 +01:00
Simon Ser
db8b64ca5e protocol: sync wl_shm.format with libdrm 2.4.104
This adds 4 new formats.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Acked-by: Daniel Stone <daniels@collabora.com>
2021-01-19 17:16:54 +01:00
Loïc Yhuel
d32e77692c server: Allow absolute paths in WAYLAND_DISPLAY
The compositor should handle absolute paths in WAYLAND_DISPLAY like the clients, ie not
adding the XDG_RUNTIME_DIR prefix if it's an absolute path.

This allows to create the wayland socket in a separate directory for system compositors if
desired. Clients could then directly inherit the environment variable.

Signed-off-by: Loïc Yhuel <loic.yhuel@softathome.com>
2021-01-13 17:01:15 +01:00
Simon Ser
69b8eaf385
build: bump to version 1.18.92 for the beta release 2021-01-06 20:18:58 +01:00
Simon Ser
d01dee9784 Remove TODO
These TODO items are outdated (either done or not applicable anymore). Let's
migrate items that we want to keep to GitLab issues.

Signed-off-by: Simon Ser <contact@emersion.fr>
2020-12-28 10:15:28 +00:00
Loïc Yhuel
74182eb605 meson: link with -lrt if needed for clock_gettime
This is already done in autotools, and fixes the build with glibc < 2.17.

Signed-off-by: Loïc Yhuel <loic.yhuel@softathome.com>
2020-12-23 15:37:58 +01:00
Simon Ser
ea09c2fde7
build: bump to version 1.18.91 for the alpha release 2020-12-21 11:16:05 +01:00
Maxime Roussin-Bélanger
dad8575a4b server: fix typos 2020-12-17 16:03:14 -05:00
Maxime Roussin-Bélanger
4c086a8ce2 egl: fix typo "Backards" 2020-12-17 16:03:14 -05:00
Maxime Roussin-Bélanger
0f0951d5c4 cursor: fix typo "insufficent" 2020-12-17 16:03:14 -05:00
Maxime Roussin-Bélanger
b52e71c8ec CONTRIBUTING: fix typo "excercising" 2020-12-17 16:03:14 -05:00
Maxime Roussin-Bélanger
efa5e3c8c6 tests: fix typos 2020-12-17 16:03:14 -05:00
Maxime Roussin-Bélanger
0f5cc8b71b doc: fix typos 2020-12-17 16:03:14 -05:00
Simon Ser
6741dafbf7 protocol: deprecate non-current wl_output.mode
The current wl_output.mode event has several issues when used to advertise
modes that aren't current:

- It's not possible to remove some modes. This is an issue for virtual
  outputs and when the kernel prunes some modes because of link limitations.
- wl_output.mode fails to carry metadata such as aspect ratio, which results
  in duplicated or missing modes.
- It's not clear, given the current set of protocols, how non-current modes
  are useful to clients. Xwayland ignores non-current modes.

GNOME and wlroots already only advertise the current mode because of these
issues.

If a protocol needs the clients to know about all available modes, it should
advertise these modes itself instead of relying on wl_output.mode.

Signed-off-by: Simon Ser <contact@emersion.fr>
Closes: https://gitlab.freedesktop.org/wayland/wayland/-/issues/92
2020-10-29 13:07:20 +00:00
Simon Ser
d42b39ccab protocol: make it clear wl_surface.enter/leave are not for frame throttling
Some clients rely on wl_surface.enter/leave to start/stop their rendering
loop.

There are cases where this doesn't work:

- Some compositors don't send wl_surface.leave when a toplevel is hidden.
  For instance Sway doesn't send this event when a toplevel is on an inactive
  workspace (but doesn't send wl_surface.frame events).
- Some compositors might still want applications to continue to render even if
  away from outputs. For instance a compositor that allows to screen record
  individual toplevels might not send a wl_surface.enter event for hidden
  toplevels.

Signed-off-by: Simon Ser <contact@emersion.fr>
2020-10-29 13:02:50 +00:00
ganjing
1ea08d748c cursor/convert_font.c: malloc cannot guarantee that the memory allocated is always successful 2020-10-29 13:00:20 +00:00
Alyssa Ross
e53e0edf0f doc: make reproducible
This setting makes Docbook section IDs consistent, and should allow
Wayland builds that include documentation to be fully reproducible.

Signed-off-by: Alyssa Ross <hi@alyssa.is>
2020-10-29 12:56:15 +00:00
Nick Diego Yamane
53dd99793d protocol: Clarify how clients can cancel a drag operation
Explicitly say that destroying a wl_data_source previously used in a
wl_data_device::start_drag request will cancel the DND session. This
is currently the only way to do it from client side (besides those
"indirect" ones already documented) and all compositors work like that
but it is not clear spec-wise it is the expected behaviour.

Signed-off-by: Nick Diego Yamane <nickdiego@igalia.com>
2020-10-29 12:17:28 +00:00
Valentin
1ab6a81816 Fix undefined behavior
Without the casts the bytes accesses get converted to int. but int is
not guaranteed to be 4 bytes large. Even when it is 4 bytes large
`bytes[3] << 24` does not fit because int is signed.

Signed-off-by: Valentin Kettner <vakevk@gmail.com>
2020-09-04 12:27:33 +02:00
Valentin
fc3beac71f Use fixed size integer type
This type is meant to be 4 bytes large as seen in _XcursorReadUInt which
always reads 4 bytes. An unsigned int is often 4 bytes large but this
isnt' guaranteed so it is cleaner to use the exact type we want.

Signed-off-by: Valentin Kettner <vakevk@gmail.com>
2020-09-04 12:27:23 +02:00
Peter Hutterer
9b7171f955 Add a basic gitlab issue template
This makes the Bug template available in the new issues form. Ideally a majority
of users will select this template and then realize that they're in the wrong
repo.

Making this a default is a feature of the enterprise gitlab version only, see
https://docs.gitlab.com/ce/user/project/description_templates.html#overview

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-18 07:57:26 +00:00
Christopher James Halse Rogers
4e16ef0aed
protocol: Minor gramatical fix.
Signed-off-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
2020-08-14 10:30:22 +10:00
Simon Ser
1dfd2169da
protocol: disambiguate key codes in wl_keyboard.key
Explain that wl_keyboard.key yields platform-specific key codes.
Some compositors use Linux key codes (defined in the
linux/input-event-codes.h header file, e.g. KEY_ESC), however
clients should not assume that this is always the case. The only
reliable way for clients to interpret key codes is to feed them
into a keyboard mapping.

Signed-off-by: Simon Ser <contact@emersion.fr>
2020-06-16 11:35:14 +02:00
Kirill Chibisov
57b7c7d946 Clarify clients behavior on wl_keyboard.leave
Clients must assume that every key, including modifiers, are lifted
after getting wl_keyboard.leave event, not doing so could lead to key repeat
keep going after the user changes focus, or stuck modifiers, when the user
interacts with client without keyboard focus.

Signed-off-by: Kirill Chibisov <contact@kchibisov.com>
2020-06-12 21:15:11 +00:00
Kirill Chibisov
4aa6eb868a Clarify the order of wl_keyboard.modifiers
Consider that we set the modifier for the modifier key as well, and that
you have the option to change your layout when both shifts pressed. This
realized by making the shift keys produce 'Group_switch' when you press
the shift key and the shift modifier is already active. So sending modifier
before the key event will result in 'Group_switch' each time you press
shift.

That being said, the order of modifiers should be updated after the
key/enter event, so it'll only affect future keypresses, not the current one.

See: https://lists.x.org/archives/xorg-devel/2014-July/043110.html

Signed-off-by: Kirill Chibisov <contact@kchibisov.com>
2020-06-12 21:15:11 +00:00
Emmanuel Gil Peyrot
a61ae8eca8 doc: Document libwayland-cursor with meson
Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
2020-06-05 11:05:20 +00:00
Emmanuel Gil Peyrot
3feed6e723 doc: Document libwayland-cursor with autotools
Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
2020-06-05 11:05:20 +00:00
Emmanuel Gil Peyrot
c81cbae3f2 cursor: Properly document wl_cursor_image and wl_cursor
Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
2020-06-05 11:05:20 +00:00
Emmanuel Gil Peyrot
95a3272625 cursor: Use spaces for alignment in the header
Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
2020-06-05 11:05:20 +00:00
Simon Ser
21fad23a47 protocol: add seat missing_capability error
The protocol says:

> It is a protocol violation to issue this request on a seat that
> has never had the pointer capability.

But never defines an error code.

Signed-off-by: Simon Ser <contact@emersion.fr>
Closes: https://gitlab.freedesktop.org/wayland/wayland/-/issues/165
2020-06-05 09:36:39 +00:00
Peter Hutterer
cf20f24140 gitlab CI: update to use the fdo ci templates
Instead of building a new debian image every time we build the repo, let's build
it once and re-use it. This way we're more  likely to spot actual bugs vs issues
with the distribution (or mirrors). This is the same approach mesa, gstreamer,
libinput, etc. already use.

The pipeline consists of two parts: container-build and distribution-image. Both
use the FDO_DISTRIBUTION_... variables to do their thing, the former to build an
image, the latter to use that image. The container-build step is a noop if an
image with that tag already exists in the registry, the templates take care of
all that.

The .debian.buster section groups the variables needed to easily extend all jobs
requiring buster. Not all variables are used by all jobs but meh.

The grouping is slightly odd because some debian-specific variables are in
the global variables and others in the .debian.buster section. This grouping
will make things easier if we extend to build on other distributions - then we
have all packages and tags in one place.

Because buster doesn't have a recent-enough version of meson, we install that
from pip.

Fixes #79

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2020-06-05 09:33:31 +10:00
Peter Hutterer
94c036d72b editorconfig: add settings for the .gitlab-ci.yml file
Different indentation and we don't want a fixed line length here, wrapping yaml
is prone to introduce bugs.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2020-06-05 08:22:34 +10:00
Yann Dirson
ef611a803e doc: fix and clarify pointer image behaviour
Signed-off-by: Yann Dirson <ydirson@free.fr>
2020-06-03 12:49:43 +00:00
Peter Hutterer
df969706f4 Replace initial 8 spaces with a tab for all xml files
This is the style used in wayland.xml which is the only file we really
care about for git blame information. So let's adjust all others to that
style for consistency and fix editorconfig to avoid messing this up in
the future.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-04-29 12:21:33 +00:00
Guido Günther
cc8b6aa3d9 scanner: Guard interface declarations
This allows to include client and server headers in the same file
fixing warnings like

In file included from ../subprojects/wlroots/include/wlr/types/wlr_layer_shell_v1.h:16,
                 from ../src/desktop.h:16,
                 from ../src/server.h:13,
                 from ../tests/testlib.c:8:
tests/59830eb@@footest@sta/wlr-layer-shell-unstable-v1-protocol.h:80:34: warning: redundant redeclaration of ‘zwlr_layer_shell_v1_interface’ [-Wredundant-decls]
   80 | extern const struct wl_interface zwlr_layer_shell_v1_interface;
      |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../tests/testlib.h:8,
                 from ../tests/testlib.c:7:
tests/59830eb@@footest@sta/wlr-layer-shell-unstable-v1-client-protocol.h:77:34: note: previous declaration of ‘zwlr_layer_shell_v1_interface’ was here
   77 | extern const struct wl_interface zwlr_layer_shell_v1_interface;
      |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../subprojects/wlroots/include/wlr/types/wlr_layer_shell_v1.h:16,
                 from ../src/desktop.h:16,
                 from ../src/server.h:13,
                 from ../tests/testlib.c:8:
tests/59830eb@@footest@sta/wlr-layer-shell-unstable-v1-protocol.h:106:34: warning: redundant redeclaration of ‘zwlr_layer_surface_v1_interface’ [-Wredundant-decls]
  106 | extern const struct wl_interface zwlr_layer_surface_v1_interface;
      |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../tests/testlib.h:8,
                 from ../tests/testlib.c:7:
tests/59830eb@@footest@sta/wlr-layer-shell-unstable-v1-client-protocol.h:103:34: note: previous declaration of ‘zwlr_layer_surface_v1_interface’ was here
  103 | extern const struct wl_interface zwlr_layer_surface_v1_interface;

Signed-off-by: Guido Günther <agx@sigxcpu.org>
Closes: #158
2020-04-23 10:17:18 +02:00
Simon Ser
7d3d2ae310
doc/man: remove manually written man pages
There is only one page written. Having manually-written man pages duplicates
information with doc comments. Besides, man pages are already generated by
Doxygen.

Signed-off-by: Simon Ser <contact@emersion.fr>
Closes: https://gitlab.freedesktop.org/wayland/wayland/-/issues/156
2020-04-16 19:53:28 +02:00
Simon Ser
24ca1a5b57
client: improve wl_display_connect docs
Add a paragraph about WAYLAND_SOCKET and describe what happens when the display
name is a relative path.

Signed-off-by: Simon Ser <contact@emersion.fr>
2020-04-16 19:49:12 +02:00
Ricardo Quesada
25f216d97f README with upadated compile instructions
This commit updates the README build & install instructions.
It replaces that obsolete "autogen && make" with "meson && ninja"

Signed-off-by: Ricardo Quesada <ricardoquesada@gmail.com>
2020-04-07 10:55:19 -07:00
Matt Turner
6d44973710 meson: Deduplicate generation of wayland-version.h
Signed-off-by: Matt Turner <mattst88@gmail.com>
2020-03-18 13:37:25 -07:00
Matt Turner
9f9e971f56 meson: Raise requirement to meson >= 0.52.1
Many new and valuable features were added between Meson 0.49 and 0.52.1.
We would like to use some of them.

Signed-off-by: Matt Turner <mattst88@gmail.com>
2020-03-18 13:36:44 -07:00
Matt Turner
d840681707 .gitlab-ci.yml: Switch from Stretch to Buster
Stretch is old-stable and will reach end of life this year.

buster-backports has newer Meson available, so switching to Buster will
allow us to bump the Meson requirements.

Signed-off-by: Matt Turner <mattst88@gmail.com>
2020-03-18 13:35:25 -07:00
Matt Turner
618663c791 meson: Add option to control building wayland-scanner
Wayland requires a binary, wayland-scanner, to be run during the build
process. For any configuration other than native builds (including
cross compiling and even 32-bit x86 builds on an x86-64 build machine)
Wayland's build process builds and uses its own wayland-scanner.

For any builds using a cross file, wayland-scanner is built for the host
machine and therefore cannot be executed during the build of the Wayland
libraries. Instead builds using a cross file must execute the build
machine's wayland-scanner (typically /usr/bin/wayland-scanner).

As such, to build Wayland's libraries for a non-native ABI a package
manager must build and install /usr/bin/wayland-scanner first. But then
the build for the native ABI then rebuilds wayland-scanner itself and
doesn't use the system's, and worse, wants to install its own, which
conflicts with the /usr/bin/wayland-scanner already installed!

So, add the -Dscanner=... option to control whether to install
wayland-scanner.

Signed-off-by: Matt Turner <mattst88@gmail.com>
2020-03-13 10:25:24 -07:00
Matt Turner
5ddb8dff87 meson: Require wayland-scanner of a matching version
We have always built libwayland with the scanner from the same build so
that the generated code and installed headers are exactly up-to-date
with the libwayland version. If libwayland was to use a scanner later
than itself, the scanner might do things that are not available in the
libwayland at hand, leading to a broken build or a broken library
(headers).

Signed-off-by: Matt Turner <mattst88@gmail.com>
2020-03-09 11:31:50 -07:00
Simon Ser
8d5fadad47 protocol: add invalid_size error to wl_surface
This allows the compositor to send an error when the client submits a buffer
whose size is not divisible by the buffer scale. Previously, the protocol said
it was a client error but didn't specify any error code.

Signed-off-by: Simon Ser <contact@emersion.fr>
Closes: https://gitlab.freedesktop.org/wayland/wayland/issues/145
2020-03-05 14:48:36 +00:00
Tomek Bury
ef40f82ac1 util: fix compiler warning
conversion to 'wl_fixed_t {aka int}' from 'int64_t {aka long int}'
may alter its value [-Werror=conversion]
2020-02-24 11:02:44 +00:00
Jan Beich
230885ebb4 cursor/os-compatibility: move resizing into a separate function
Signed-off-by: Jan Beich <jbeich@FreeBSD.org>
2020-02-23 20:42:54 +00:00
Jan Beich
3a3dd0820d cursor: ignore posix_fallocate in shm_pool_resize if not supported by FS
Signed-off-by: Jan Beich <jbeich@FreeBSD.org>
2020-02-23 20:42:54 +00:00
Jan Beich
1283d54dac cursor: posix_fallocate may fail with EINVAL if not supported
ZFS on FreeBSD >= 12.0 returns EINVAL, see
https://svnweb.freebsd.org/changeset/base/325320

Signed-off-by: Jan Beich <jbeich@FreeBSD.org>
2020-02-23 20:42:54 +00:00
Jan Beich
0fc00fff30 meson/tests: add missing dependencies on protocol headers
In file included from ../tests/connection-test.c:43:
In file included from ../tests/test-compositor.h:30:
../src/wayland-client.h:40:10: fatal error: 'wayland-client-protocol.h' file not found
 #include "wayland-client-protocol.h"
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../tests/display-test.c:45:
In file included from ../src/wayland-server.h:104:
src/wayland-server-protocol.h:4454:2: error: unterminated /* comment
        /**
        ^
In file included from ../tests/cpp-compile-test.cpp:2:
In file included from src/wayland-server-protocol.h:8:
In file included from ../src/wayland-server.h:104:
src/wayland-server-protocol.h:3:2: error: unterminated conditional directive
 #ifndef WAYLAND_SERVER_PROTOCOL_H
  ^
../tests/headers-protocol-test.c:33:2: error: including wayland-server-protocol.h did not include wayland-server.h!
 #error including wayland-server-protocol.h did not include wayland-server.h!
  ^
In file included from ../tests/headers-protocol-test.c:26:
In file included from src/wayland-client-protocol.h:8:
In file included from ../src/wayland-client.h:40:
src/wayland-client-protocol.h:1358:2: error: unterminated conditional directive
 #ifndef WL_SHM_FORMAT_ENUM
  ^
In file included from ../tests/protocol-logger-test.c:34:
In file included from ../src/wayland-client.h:40:
src/wayland-client-protocol.h:2613:1: error: unterminated /* comment
/**
^
../tests/resources-test.c:49:36: error: use of undeclared identifier 'wl_seat_interface'
        res = wl_resource_create(client, &wl_seat_interface, 4, 0);
                                          ^
2020-02-15 02:55:00 +00:00
Simon Ser
c57157e390
build: re-open master for regular development 2020-02-12 00:55:32 +01:00
Simon Ser
eb1339edd3
build: bump to version 1.18.0 for the official release 2020-02-12 00:45:15 +01:00
Simon Ser
57f17de0ec
build: bump to version 1.17.93 for the RC1 release 2020-02-05 00:32:03 +01:00
Simon Ser
3d1c6c6f68
autotools: add Meson files to EXTRA_DIST
This allows users to build Wayland with Meson from an autotools-generated
release tarball.

Signed-off-by: Simon Ser <contact@emersion.fr>
Closes: https://gitlab.freedesktop.org/wayland/wayland/issues/141
2020-02-04 17:43:07 +01:00
Simon Ser
367d2985f3
build: bump to version 1.17.92 for the beta release 2020-01-28 22:02:25 +01:00
Simon Ser
96a8465e38 tests: fix memory leak in proxy-test
When running tests with ASan, proxy-test fails at the proxy_tag test:

    ==27843==ERROR: LeakSanitizer: detected memory leaks

    Direct leak of 32 byte(s) in 1 object(s) allocated from:
        #0 0x7f65a732dada in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cc:144
        #1 0x7f65a71cb3ea in wl_display_add_protocol_logger src/wayland-server.c:1813
        #2 0x557c640c0980 in proxy_tag tests/proxy-test.c:104
        #3 0x557c640c1159 in run_test tests/test-runner.c:153
        #4 0x557c640c1e2e in main tests/test-runner.c:337
        #5 0x7f65a6ea0ee2 in __libc_start_main (/usr/lib/libc.so.6+0x26ee2)

    SUMMARY: AddressSanitizer: 32 byte(s) leaked in 1 allocation(s).

Destroying the logger fixes the leak.

Signed-off-by: Simon Ser <contact@emersion.fr>
Fixes: 493ab79bd2 ("proxy: Add API to tag proxy objects")
2020-01-28 20:57:52 +00:00
Ihor Antonov
8e2199644e os: fallback for unsupported posix_fallocate
Some filesystems do not support fallocate and return EOPNOTSUPP.

On musl-based distros libwayland-cursor exits abruptly which causes the
application to crash. Unlike glibc, musl does not provide a fallback
mechanism for handling unsupported fallocate. Instead, musl developers
argue that application should handle the case of unsupported system
call.

This commit allows falback to ftruncate in case when EOPNOTSUPP
was recieved.

Signed-off-by: Ihor Antonov <ihor@antonovs.family>
2020-01-23 20:32:59 +00:00
Emmanuel Gil Peyrot
501cad1188 Remove unused HAVE_CONFIG_H define in meson
Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
2020-01-22 13:41:07 +01:00
Simon Ser
75e644c23d
build: bump to version 1.17.91 for the alpha release 2020-01-21 15:18:48 +01:00
Simon Ser
d377ab9c07 protocol: add missing enums for wl_data_device_manager.dnd_action
Signed-off-by: Simon Ser <contact@emersion.fr>
2020-01-21 11:40:09 +00:00
Manuel Stoeckl
2f88814d9b event-loop-test: Add test to verify timer ordering
The new test verifies that, for a set of timers and a short sequence
of timer update calls, when the event loop is run the timer callbacks
are run in the expected order.

Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
2020-01-21 11:31:35 +00:00
Manuel Stoeckl
60a8d29ad8 event-loop: Track timer event sources in userspace
libwayland now uses only one file descriptor to keep track of all
the timer event sources associated with an event loop. An array-based
binary heap is used to determine which event source has the earliest
deadline.

(Previously, each timer event source had its own timerfd, making it easy
for the a process using many timer event sources to run out of file
descriptors.)

Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
2020-01-21 11:31:35 +00:00
Manuel Stoeckl
75d1483457 event-loop-test: Confirm distant timers do not fire
This change expands the `event_loop_timer` test to use two different
timers with different timeouts; it now implicitly checks that e.g.
both timers do not expire at the same time, and that the first timer
expiring does not prevent the second from doing so. (While such failure
modes are unlikely with timer event sources based on individual
timerfds, they are possible when multiple timers share a common timerfd.)

Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
2020-01-21 11:31:35 +00:00
Manuel Stoeckl
a0d941e411 event-loop-test: Verify proper timer cancellation
The implementation of timer event sources based on timerfds ensured
specific edge-case behavior with regards to removing and updating timers:

Calls to `wl_event_loop_dispatch` will dispatch all timer event sources
that have expired up to that point, with one exception. When multiple
timer event sources are due to be dispatched in a single call of
`wl_event_loop_dispatch`, calling wl_event_source_remove` from within a
timer event source callback will prevent the removed event source's
callback from being called. Note that disarming or updating one of the
later timers that is due to be dispatched, from within a timer callback,
will NOT prevent that timer's callback from being invoked by
`wl_event_loop_dispatch`.

This commit adds a test that verifies the above behavior. (Because
epoll_wait is not documented to return timerfds in chronological order,
(although it does, in practice), the test code does not depend on the
order in which timers are dispatched.)

Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
2020-01-21 11:31:35 +00:00
Simon Ser
fab3cb3bfe
build: check wayland-scanner version
We need the --strict flag, released in wayland 1.14.0.

Signed-off-by: Simon Ser <contact@emersion.fr>
2020-01-16 17:25:06 +01:00
Simon Ser
bfd4362fc2 autotools: use strict wayland-scanner mode
Otherwise an invalid protocol will print warnings to stdout but won't
make the build fail.

Signed-off-by: Simon Ser <contact@emersion.fr>
2020-01-15 13:26:20 +00:00
Simon Ser
1f8fe8b966 meson: use strict wayland-scanner mode
Otherwise an invalid protocol will print warnings to stdout but won't
make the build fail.

Signed-off-by: Simon Ser <contact@emersion.fr>
2020-01-15 13:26:20 +00:00
Manuel Stoeckl
6ddd0636e0 tests: Ensure that overflow test always overflows
While the default Unix socket buffer size on Linux is relatively
small, on some computers the default size may be configured to
be huge, making the overflow test never actually overflow the
Wayland display socket.

The changed code now explicitly sets the display socket send buffer
size to be small enough to guarantee an overflow.

Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
2020-01-15 13:18:56 +00:00
Manuel Stoeckl
e449232f37 tests: Fix race condition in send overflow test
This change ensures that the compositor process is not able to respond
to any of the noop requests sent by the client process, by using the
test compositor's `stop_display` mechanism to coordinate when the
compositor should stop processing messages.

(Before this change, it was possible that one of the calls of
wl_event_loop_dispatch in the compositor process could respond to all
the client's noop requests before returning.)

Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
2020-01-15 13:18:56 +00:00
Simon Ser
555d3b8a9b
Revert "build: check wayland-scanner version"
This reverts commit c2ce50b9d7.

Pushed by mistake. Sorry about that.
2020-01-13 19:32:44 +01:00
Simon Ser
c2ce50b9d7
build: check wayland-scanner version
We need the --strict flag, released in wayland 1.14.0.

Signed-off-by: Simon Ser <contact@emersion.fr>
2020-01-13 19:31:50 +01:00
Daniel Stone
89a38bfaa4 display-test: Remove unused variables
At higher warning levels, GCC complains about unused variables.

Remove two completely unused, and one set-but-not-used, variables from
display-test to make it happy.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2020-01-13 13:51:43 +00:00
Emmanuele Bassi
60acba6e0f
Add Meson build
Meson is a next generation build system, simpler than Autotools and also faster
and more portable. Most importantly, it will make integrating ASan easier in
CI.

The goal is to maintain feature parity of the Meson build with the
Autotools build, until such time when we can drop the latter.

Add a script which generates the desired Doxygen configuration for our various
output formats and executes it using that configuration. This is not something
Meson can or should do.

Fixes: https://gitlab.freedesktop.org/wayland/wayland/issues/80

[daniels: Changed to bump version, use GitLab issues URL, remove header
          checks not used in any code, remove pre-pkg-config Expat
	  support, added missing include paths to wayland-egl and
	  cpp-compile-test, added GitLab CI.
	  Bumped version, removed unnecessary pkg-config paths.]

[daniels: Properly install into mandir/man3 via some gross
          paramaterisation, generate real stamp files.]

Pekka:
- squashed patches
- removed MAKEFLAGS from meson CI
- remove unused PACKAGE* defines
- fix up scanner dependency handling
- instead of host_scanner option, build wayland-scanner twice when cross-compiling
- changed .pc files to match more closely the autotools versions
- reorder doxygen man sources to reduce diff to autotools
- fix pkgconfig.generate syntax warnings (new in Meson)
- bump meson version to 0.47 for configure_file(copy) and run_command(check)
- move doc tool checks into doc/meson.build, needed in more places
- make all doc tools mandatory if building docs
- check dot and doxygen versions
- add build files under doc/publican
- reindent to match Weston Meson style

Simon:
- Remove install arg from configure_file
- Don't build wayland-scanner twice during cross-build
- Fix naming of the threads dependency
- Store tests in dict
- Add missing HAVE_* decls for functions
- Remove unused cc_native variable
- Make doxygen targets a dict
- Make dot_gv a dict
- Use dicts in man_pages
- Make decls use dicts
- Make generated_headers use dicts
- Align Meson version number with autotool's

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Signed-off-by: Simon Ser <contact@emersion.fr>
2020-01-10 23:44:38 +01:00
Pekka Paalanen
0d3044f2ea
scanner: include config.h from command line
Meson will need to build wayland-scanner twice with different config.h files,
once for build and another for host machine. It will be easier to include the
right config.h from compiler command line than playing with files.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2020-01-10 23:42:59 +01:00
Emmanuele Bassi
a77f6bf6c4
Support running tests from different build directories
The tests that run exec-fd-leak-checker expect the binary to be located
in the current directory. This is not always the case; for instance, the
binaries could be built under `tests`, but be invoked under the
top-level build directory.

We can use an environment variable to control what's the location of the
test binaries, and fall back to the current directory if the variable is
unset.

Reviewed-by: Daniel Stone <daniels@collabora.com>
2020-01-10 23:42:59 +01:00
Daniel Stone
8497144faa
build/doc: Ensure destination dir exists despite VPATH
Make considers a variable called VPATH when trying to satisfy
dependencies, e.g. for a target 'foo', it will consider the target
extant if VPATH is '../../bar' and '../../bar/foo' exists.

Part of the doc build, the '$(alldirs)' target, exists to create the
target directories if they do not exist. For example, before generating
xml/wayland-architecture.png, it will ensure the 'xml' target is
considered up-to-date thanks to the target dependency.

Creating $(srcdir)/doc/doxygen/xml thus means that the 'xml' dependency
will be satisfied, so we'll never create the output directory, and the
doc build will fail.

Change the alldirs target list to be absolute paths, so VPATH will not
be consulted and defeat the entire point of what we're trying to do.
This fixes the Meson build, where we later create
doc/doxygen/xml/meson.build.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2020-01-10 23:42:59 +01:00
asynts
b5bd24476d doc: Expand the abbreviation "hw" to "hardware".
Out of the context it is reasonably clear that "hw" is indeed an abbreviation
for "hardware".

The use of "hw" in this place doesn't seem to be a stylistic choice, but rather
an oversight.

Signed-off-by: Paul Scharnofske <asynts@gmail.com>
2020-01-04 14:40:09 +01:00
Michael Forney
3a05d94dc2 protocol: fix typo in wl_data_offer.set_actions description
Signed-off-by: Michael Forney <mforney@mforney.org>
2020-01-02 21:13:49 -08:00
Joshua Watt
e7d88f35eb Move wl_priv_signal to wayland-server-private.h
Including wayland-server-core.h in wayland-private.h is problematic
because wayland-private.h is included by wayland-scanner which should be
able to build against non-POSIX platforms (e.g. MinGW). The only reason
that wayland-server-core.h was included in wayland-private.h was for the
wl_private_signal definitions, so move those to a
wayland-server-private.h file that can be included by both
wayland-server.c and the tests.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
2019-11-06 08:24:14 -06:00
Joshua Watt
4a1f348c20 scanner: Add configure check for strndup
Some platforms may not have strndup() (e.g. MinGW), so provide a
equivalent implementation if it's not found.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
2019-11-05 08:59:58 -06:00
Jiayuan Ren
8e0513410d adding O_RDWR flag in the open()
According to the manual of open:
"The argument flags must include one of the following access modes:
O_RDONLY, O_WRONLY, or O_RDWR."
2019-10-24 22:31:56 +00:00
Simon Ser
4162863c41
tests: add a test for wl_global_remove
This test makes sure that after wl_global_remove:

* The global_remove event is sent to existing clients
* Binding to the removed global still works
* A new client will not see the removed global advertised

Signed-off-by: Simon Ser <contact@emersion.fr>
2019-10-16 16:33:53 +03:00
Simon Ser
39852f1146
server: add wl_global_remove
This commit adds a new wl_global_remove function that just sends a global
remove event without destroying it. See [1] for details.

Removing a global is racy, because clients have no way to acknowledge they
received the removal event.

It's possible to mitigate the issue by sending the removal event, waiting a
little and then destructing the global for real. The "wait a little" part is
compositor policy.

[1]: https://gitlab.freedesktop.org/wayland/wayland/issues/10

Signed-off-by: Simon Ser <contact@emersion.fr>
2019-10-16 16:32:17 +03:00
Emmanuel Gil Peyrot
11623e8fdd wayland-shm: Don’t set SIGBUS handlers on unshrinkable fd
If a client set the F_SEAL_SHRINK seal on the fd before passing it to
the compositor, the kernel will ensure this fd won’t be able to shrink,
ever.  This allows us to avoid setting up the SIGBUS handlers on such
file descriptors.

Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
2019-10-14 21:49:08 +00:00
Simon Ser
d5055ad913 server: add wl_global_set_user_data
When implementing a workaround for [1], one needs to accept a global to be
bound even though it has become stale.

Often, a global's user data is free'd when the global needs to be destroyed.
Being able to set the global's user data (e.g. to NULL) can help preventing a
use-after-free.

(The alternative is to make the compositor responsible for keeping track of
stale user data objects via e.g. refcounting.)

[1]: https://gitlab.freedesktop.org/wayland/wayland/issues/10

Signed-off-by: Simon Ser <contact@emersion.fr>
2019-09-27 09:14:52 +00:00
Mosè Giordano
766edf0243 Add $(RT_LIBS) to fixed-benchmark LD dependencies
`tests/fixed-benchmark.c` calls `clock_gettime`.
2019-09-17 16:38:28 +01:00
Marty E. Plummer
9f004d8b0f
scanner: prepend protocol name to types symbol
When doing unity builds via meson (example project:
https://github.com/swaywm/sway) multiple source files are glued together
via #include directives. Having every wayland-scanner generated source
file have an identifier named '*types[]' will lead to errors in these
unity builds if two or more of these are joined.

Signed-off-by: Marty E. Plummer <hanetzer@startmail.com>
2019-09-11 13:27:03 -05:00
Manuel Stoeckl
a89a5349af tests: Test that send overflow doesn't abort
The new display test runs a client that makes a very large number of
trivial requests. After responding to initial setup requests, the server
is paused, letting the trivial requests fill up the Unix socket buffer,
making further writes to the socket fail. The test then checks that the
client sets an appropriate error code, and does not abort or crash.

Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
2019-09-10 07:59:50 -04:00
Manuel Stoeckl
8a831ac6ec client: Don't abort when sending a request fails
Instead, set a fatal display error which will let an application
using libwayland-client shutdown cleanly.

Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
2019-09-10 07:59:50 -04:00
Manuel Stoeckl
6265dd4f07 client: Ignore new requests if display has a fatal error
Once there has been a fatal display error, any new object requests
potentially rely on invalid state. (For example, a failure to read
from the compositor could hide a important event.) The safest way to
handle the new requests is not to make them.

Proxies produced by the request are still created, to ensure that
any code using the library does not crash from an unexpected NULL
pointer.

Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
2019-09-10 07:59:50 -04:00
Simon Ser
4c2b737561 protocol: invalid_method is sent on malformed request
Currently libwayland sends a wl_display.invalid_method when arguments provided
with a request are invalid (e.g. too short, see wl_client_connection_data).

Clarify the protocol by adding that invalid_method can be sent on malformed
request.

Signed-off-by: Simon Ser <contact@emersion.fr>
2019-09-10 09:47:19 +00:00
Simon Ser
6e5cedc20a tests: test that binding to a global with an interface mismatch fails
This test creates a wl_seat global, then tries to bind to it with the wl_output
interface.

Signed-off-by: Simon Ser <simon.ser@intel.com>
2019-09-06 12:22:01 +00:00
Simon Ser
e18e3e195b server: check global interface on bind
The interface name provided by the client isn't used at all.

Check it matches the global's interface name to prevent object interface
mismatches between the client and the server. These are especially easy to get
when mixing up global names and other IDs in the client.

Signed-off-by: Simon Ser <simon.ser@intel.com>
Closes: https://gitlab.freedesktop.org/wayland/wayland/issues/113
2019-09-06 12:22:01 +00:00
Simon Ser
b69e547fa4 protocol: sync wl_shm.format with libdrm 2.4.99
This adds 42 new formats.

Signed-off-by: Simon Ser <contact@emersion.fr>
2019-09-06 12:09:22 +00:00
Simon Ser
e771ca91d7 protocol: add a comment about the wl_shm.format script
Add a comment to wl_shm.format to advise contributors to use the automated
script (generate-shm-formats.py) instead of updating the list manually.

Signed-off-by: Simon Ser <contact@emersion.fr>
2019-09-06 12:09:22 +00:00
Simon Ser
8854f64bae Add an automated script to update wl_shm.format
This prevents mismatches and missing formats between wl_shm.formats and
drm_fourcc.h.

The script collects DRM_FORMAT_* constants from drm_fourcc.h, compares the list
with the current wayland.xml entries (checking for any mismatch) and then
appends missing entries to wayland.xml.

Enum values are obtained by executing a generated C file which prints the
constants. There is no other reliable way to get these values as they are
defined via various macros.

There is no widespread Python library able to parse an XML file and format it
with all whitespace preserved. For this reason, we don't use an XML library to
create the new XML elements. Instead, we keep track of the line number of the
last wl_shm.format enum entry and add new entries right after. To be able to
read the line number of an element, we use lxml (the standard library doesn't
retain line number information).

Signed-off-by: Simon Ser <contact@emersion.fr>
2019-09-06 12:09:22 +00:00
Simon Ser
cd9b3ef0cd Update .editorconfig for Python
This uses the idiomatic Python indentation rules.

Signed-off-by: Simon Ser <contact@emersion.fr>
2019-09-06 12:09:22 +00:00
Simon Ser
a277cc6d52 client: check event opcode in queue_event
If the client binds to a global with an interface mismatch, it may receive an
event from the server with an unknown opcode. See [1].

Instead of crashing, print a more useful debug message and close the connection.

[1]: https://gitlab.freedesktop.org/wayland/wayland/issues/113

Signed-off-by: Simon Ser <simon.ser@intel.com>
2019-09-05 11:01:12 +00:00
Liu Wenlong
152c9ed968 server: Fix fake "Address already in use" error
In the current workflow, socket file will be deleted if it already exists.
However, if the socket file is a symbolic link and the file that it refers
to doesn't exist, we will got "Address already in use" because bind()
thinks the socket file exists and won't create it.

Now, use lstat() to determine whether the socket file exists.

Signed-off-by: Liu Wenlong <liuwl.fnst@cn.fujitsu.com>
2019-08-27 01:32:45 +08:00
Drew DeVault
17e49ba844 Improve description of wl_surface
The original text makes some assumptions about surfaces which may not be
true and fails to capture some details which are important to the
essential traits of a wl_surface.
2019-08-17 11:12:54 +00:00
Drew DeVault
790dd9da16 Add .editorconfig
This is copied from Weston
2019-08-05 08:43:45 +00:00
Drew DeVault
a2f1343b7e Document unusual wl_registry.bind new_id behavior
When wayland-scanner encounters a new_id field with no corresponding
interface name defined, instead of emitting a function whose signature
lines up with the usual case (a uint32_t ID), it adds the interface name
as a string and the version number so that the interface can be
identified from the protcol message.

Without docs, this was previously left for the interprid wire protocol
implementor (e.g. me an hour ago) to discover when Wayland clients send
them apparently bogus messages.

I would have preferred if a different primitive type were used here
(e.g. typed_new_id) to reflect the fact that the wire protocol is
different, but I felt it unwise to add a new primitive to wayland.xml in
$current_year.
2019-07-30 07:32:29 -04:00
Jonas Ådahl
493ab79bd2 proxy: Add API to tag proxy objects
When an application and a toolkit share the same Wayland connection,
it will receive events with each others objects. For example if the
toolkit manages a set of surfaces, and the application another set, if
both the toolkit and application listen to pointer focus events,
they'll receive focus events for each others surfaces.

In order for the toolkit and application layers to identify whether a
surface is managed by itself or not, it cannot only rely on retrieving
the proxy user data, without going through all it's own proxy objects
finding whether it's one of them.

By adding the ability to "tag" a proxy object, the toolkit and
application can use the tag to identify what the user data pointer
points to something known.

To create a tag, the recommended way is to define a statically allocated
constant char array containing some descriptive string. The tag will be
the pointer to the non-const pointer to the beginning of the array.

For example, to identify whether a focus event is for a surface managed
by the code in question:

	static const char *my_tag = "my tag";

	static void
	pointer_enter(void *data,
		      struct wl_pointer *wl_pointer,
		      uint32_t serial,
		      struct wl_surface *surface,
		      wl_fixed_t surface_x,
		      wl_fixed_t surface_y)
	{
		struct window *window;
		const char * const *tag;

		tag = wl_proxy_get_tag((struct wl_proxy *) surface);

		if (tag != &my_tag)
			return;

		window = wl_surface_get_user_data(surface);

		...
	}

	...

	static void
	init_window_surface(struct window *window)
	{
		struct wl_surface *surface;

		surface = wl_compositor_create_surface(compositor);
		wl_surface_set_user_data(surface, window);
		wl_proxy_set_tag((struct wl_proxy *) surface,
				 &my_tag);
	}

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2019-07-29 16:47:36 +00:00
Emmanuel Gil Peyrot
6908c8c85a cursor: Use memfd_create() when available
This (so-far) Linux-only API lets users create file descriptors purely
in memory, without any backing file on the filesystem and the race
condition which could ensue when unlink()ing it.

It also allows seals to be placed on the file, ensuring to every other
process that we won’t be allowed to shrink the contents, potentially
causing a SIGBUS when they try reading it.

This patch is best viewed with the -w option of git log -p.

Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
Reviewed-by: Simon Ser <contact@emersion.fr>
2019-07-21 09:06:43 +00:00
Manuel Stoeckl
9d63c9ff84 connection: do not abort when dup(fd) fails
Instead, cleanly exit wl_closure_marshal and let the caller handler
the error. For wayland-client, the sole calling function will call
wl_abort() anyway. For wayland-server, the calling function will
cleanly shutdown the client.

This change ensures that compositors run with low file descriptor
limits or internal leaks need not crash suddenly (and sometimes
far from the problem) when space runs out.

Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
2019-07-09 17:30:13 +00:00
Scott Anderson
a281783339 wayland.xml: Make releases for multiple 'wl_surface.attach' undefined
Fixes #46

The way wl_buffer is specified makes this situation inherently racy,
meaning there is no way this can be done unambiguously. Current real
compositor implementations already have differing behaviour for this, so
any client relying on it was already broken, if any such client exists.

This specifically only singles out wl_buffer.release as being undefined;
every other aspect of it should still be valid. This is so existing and
correct uses of multiple attaches are still valid, where a
"static"/immutable wl_buffer is being used (i.e. they don't care about
the release event).

Signed-off-by: Scott Anderson <scott.anderson@collabora.com>
2019-07-09 17:26:11 +00:00
Manuel Stoeckl
6dbf9f72b6 protocol: clarify wl_display.delete_id description
libwayland-server only sends wl_display.delete_id events when
it responds to a client's destruction of a client-allocated
object. server-allocated objects are silently removed, as per
`wl_resource_destroy`.

Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
2019-07-05 19:42:24 -04:00
Michael Forney
678c8681e2 Avoid pointer arithmetic on void *
The pointer operand to the binary `+` operator must be to a complete
object type. Since we are working with byte sizes, use `char *` for
arithmetic instead.

Signed-off-by: Michael Forney <mforney@mforney.org>
2019-06-05 10:01:07 +00:00
Michael Forney
55d044810c Use wl_container_of internally
Rather than have two versions of the macro with slightly different
interfaces, just use wl_container_of internally.

This also removes use of statement expressions, a GNU C extension.

Signed-off-by: Michael Forney <mforney@mforney.org>
2019-06-05 09:58:14 +00:00
orbea
2485a5c274 Add a missing -pthread to fix compile with slibtool.
When compiling wayland with slibtool instead of GNU libtool
it will fail building libtest_runner with an undefined
reference to pthread_join@@GLIBC_2.2.5. This is because
-pthread (Or -lpthread) is missing from display_test. If its
added the build succeeds as expected with slibtool and
continues to work with libtool. Its likely that libtool is
hiding this failure by silently adding the missing flag which
is not uncommon...

Exposed in commit aa51a833eb.

Fixes https://gitlab.freedesktop.org/wayland/wayland/issues/91

Signed-off-by: orbea <orbea@riseup.net>
2019-05-31 08:38:50 -07:00
Antonio Borneo
294ed97e64 log: remove "%m" from format strings by using strerror(errno)
The printf() format specifier "%m" is a glibc extension to print
the string returned by strerror(errno). While supported by other
libraries (e.g. uClibc and musl), it is not widely portable.

In Wayland code the format string is often passed to a logging
function that calls other syscalls before the conversion of "%m"
takes place. If one of such syscall modifies the value in errno,
the conversion of "%m" will incorrectly report the error string
corresponding to the new value of errno.

Remove all the occurrences of the specifier "%m" in Wayland code
by using directly the string returned by strerror(errno).

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2019-05-02 22:14:53 +02:00
Manuel Stoeckl
6db761d162 tests: Verify that wayland_scanner can catch bad identifiers
The test runs wayland_scanner on a set of XML protocol files which
have malformed element names, and confirms that an error is produced
and indicates the correct line.

Copyright notifications are not included in the test files, as
they are not code; of course, the project license still applies.

Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
2019-05-02 17:42:59 +00:00
Manuel Stoeckl
6ce4bbb3dd scanner: error when element names will not compile
This change checks that the "name" fields of the various structures in
a Wayland protocol XML file will be converted into C identifiers that
can be successfully compiled.

For names which will be inserted as the prefix of an identifier
enforce a match with [_a-zA-Z][_0-9a-zA-Z]* . For types only inserted
as the suffix of an identifier (enum, entry), enforce a format of
[_0-9a-zA-Z]+ .

Unicode characters (and escape sequences like \u0394) are not allowed,
because most older and some newer C compilers do not support them by
default.

For sake of simplicity, this patch does not check for collisions
with reserved words or standard library names.

Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
2019-05-02 17:42:59 +00:00
Simon Ser
3ab56ef8fa protocol: allow to send a zero output refresh rate
Fixed refresh rate doesn't always make sense for all outputs. In case
it's not available or not relevant, allow compositors to send zero.

For instance the can be the case for virtual outputs.

Signed-off-by: Simon Ser <contact@emersion.fr>
2019-04-27 21:44:04 +00:00
Harish Krupo
ea11878d00 wayland.xml: document invalid_finish error in wl_data_offer.finish
Explicitly state that the invalid_finish protocol error would be raised
when wl_data_offer.finish request is sent for non drag-and-drop
operations.

Signed-off-by: Harish Krupo <harishkrupo@gmail.com>
2019-04-19 22:02:08 +05:30
Harish Krupo
b77cf86290 docs: Abort configure if docbook-xsl package is missing
The docbook-xsl package includes all the stylesheets required to build
the docs without internet access.

Test:
One way to emulate missing style sheets is to move /etc/xml/catalog file
to a different location. Doing so should cause configure to fail with
"checking for docbook stylesheets... no"

v2: add AC_MSG_RESULT (Pekka)

Signed-off-by: Harish Krupo <harishkrupo@gmail.com>
2019-04-19 19:34:09 +05:30
Simon Ser
de64489b95
releasing: fixup section numbers
Signed-off-by: Simon Ser <contact@emersion.fr>
2019-04-12 11:31:06 +03:00
Simon Ser
724bf08e2f
releasing: adapt for Wayland
Remove Weston-specific bits, strip off outdated instructions.

Signed-off-by: Simon Ser <contact@emersion.fr>
2019-04-11 19:53:06 +03:00
Simon Ser
b8933d4688
Add releasing.txt
This file is imported from Weston (commit 53d7c243).

Signed-off-by: Simon Ser <contact@emersion.fr>
2019-04-11 19:53:06 +03:00
Pekka Paalanen
ca5a59ec4c configure.ac: reopen master for regular development
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-04-08 10:26:24 +03:00
Leonid Bobrov
dd3ba21457 configure: detect libdl and librt
Signed-off-by: Leonid Bobrov <mazocomp@disroot.org>
2019-04-06 19:53:25 +00:00
Derek Foreman
e091839dd0 configure.ac: bump to version 1.17.0 for the official release 2019-03-20 19:54:18 -05:00
Derek Foreman
cbdfa87ce3 configure.ac: bump version to 1.16.93 for the RC1 release 2019-03-13 21:27:59 -05:00
Derek Foreman
5935332a42 Merge branch 'mr/request-bad-size' into 'master'
Fix demarshal of invalid size in message header

Closes #52

See merge request wayland/wayland!2
2019-03-13 12:18:53 +00:00
Pekka Paalanen
bace3cd819 connection: fix demarshal of invalid header
The size argument to wl_connection_demarshal() is taken from the message by the
caller wl_client_connection_data(), therefore 'size' is untrusted data
controllable by a Wayland client. The size should always be at least the header
size, otherwise the header is invalid.

If the size is smaller than header size, it leads to reading past the end of
allocated memory. Furthermore if size is zero, wl_closure_init() changes
behaviour and leaves num_arrays uninitialized, leading to access of arbitrary
memory.

Check that 'size' fits at least the header. The space for arguments is already
properly checked.

This makes the request_bogus_size test free of errors under Valgrind.

Fixes: https://gitlab.freedesktop.org/wayland/wayland/issues/52

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
2019-03-13 12:39:16 +02:00
Pekka Paalanen
446047edf2 tests: add request_bogus_size
This attempts to reproduce the error conditions from
https://gitlab.freedesktop.org/wayland/wayland/issues/52 and make it crash.
While the crash was repeatable in my tests, it depends on garbage on stack
leading to access of invalid memory, which is not guaranteed.

This is a FAIL_TEST, so that the following fix commit can be verified.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
2019-03-13 12:39:16 +02:00
Pekka Paalanen
808bca8965 contributing: use Gitlab merge request workflow
The experience from Weston shows that the Gitlab merge request based workflow
works really well. Recently there have also been issues with the mailing list
that have made the email based workflow more painful than it used to be. Those
issues might have been temporary or occasional, but they probably are only
going to increase.

The MR workflow is different, it has its issues
(https://gitlab.freedesktop.org/freedesktop/freedesktop/issues/74) and we
likely lose the explicit Reviewed-by etc. tags from commit messages, but it is
also much easier to work with: no more whitespace damaged patches, lost email,
setting up git-send-email; we gain automated CI before any human reviewer even
looks at anything, and people can jump in to an ongoing discussion even if they
weren't subscribed before.

If you still want email, you can subscribe to that selectively(!) in Gitlab
yourself.

This text has been copied from Weston's CONTRIBUTING.md of the 5.0.91 release
and slightly altered for Wayland.

Fixes: https://gitlab.freedesktop.org/wayland/wayland/issues/49

v2: fixed two left-over mentions of Weston

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
v1 Reviewed-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Scott Anderson <scott.anderson@collabora.com>
Acked-by: Ian Ray <ian.ray@ge.com>
Acked-by: Derek Foreman <derek.foreman.wayland@gmail.com>
2019-03-07 14:35:22 +02:00
Chris Billington
15cba8b074 wayland-util.h: add forward declaration for wl_object
The definition of wl_argument in wayland-util.h references wl_object,
so wl_object ought to be defined in wayland-util.h. This resolves
gitlab issue #78.

Fixes: https://gitlab.freedesktop.org/wayland/wayland/issues/78

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-03-07 11:33:26 +02:00
Derek Foreman
75bd70c0b3 configure.ac: bump to version 1.16.92 for the beta release 2019-03-05 17:22:24 -06:00
Leonid Bobrov via wayland-devel
c70fd8a812 tests: fix main symbol duplication
So far I got these errors before patching:

libtool: link: cc -o .libs/headers-test -pthread -Wall -Wextra -Wno-unused-parameter -g -Wstrict-prototypes -Wmissing-prototypes -fvisibility=hidden -O2 -pipe tests/headers-test.o tests/headers-protocol-test.o tests/headers-protocol-core-test.o /tmp/obj/wayland-1.16.0/build-amd64/.libs/libtest-runner.a -L.libs -lwayland-client -lffi -lm -lwayland-server -lkvm -Wl,-rpath-link,/usr/local/lib
ld: error: duplicate symbol: main
>>> defined at headers-test.c:53 (/tmp/obj/wayland-1.16.0/wayland-1.16.0/tests/headers-test.c:53)
>>>            tests/headers-test.o:(main)
>>> defined at test-runner.c:377 (/tmp/obj/wayland-1.16.0/wayland-1.16.0/tests/test-runner.c:377)
>>>            test-runner.o:(.text+0x250) in archive /tmp/obj/wayland-1.16.0/build-amd64/.libs/libtest-runner.a

libtool: link: cc -o .libs/exec-fd-leak-checker -pthread -Wall -Wextra -Wno-unused-parameter -g -Wstrict-prototypes -Wmissing-prototypes -fvisibility=hidden -O2 -pipe tests/exec-fd-leak-checker.o /tmp/obj/wayland-1.16.0/build-amd64/.libs/libtest-runner.a -L.libs -lwayland-client -lffi -lm -lwayland-server -lkvm -Wl,-rpath-link,/usr/local/lib
ld: error: duplicate symbol: main
>>> defined at exec-fd-leak-checker.c:57 (/tmp/obj/wayland-1.16.0/wayland-1.16.0/tests/exec-fd-leak-checker.c:57)
>>>            tests/exec-fd-leak-checker.o:(main)
>>> defined at test-runner.c:377 (/tmp/obj/wayland-1.16.0/wayland-1.16.0/tests/test-runner.c:377)
>>>            test-runner.o:(.text+0x250) in archive /tmp/obj/wayland-1.16.0/build-amd64/.libs/libtest-runner.a

Makefile.am: error: object 'tests/test-helpers.$(OBJEXT)' created both with libtool and without

libtool: link: cc -o .libs/fixed-benchmark -pthread -Wall -Wextra -Wno-unused-parameter -g -Wstrict-prototypes -Wmissing-prototypes -fvisibility=hidden -O2 -pipe tests/fixed-benchmark.o /tmp/obj/wayland-1.16.0/build-amd64/.libs/libtest-runner.a -L.libs -lwayland-client -lffi -lm -lwayland-server -lkvm -Wl,-rpath-link,/usr/local/lib
ld: error: duplicate symbol: main
>>> defined at fixed-benchmark.c:100 (/tmp/obj/wayland-1.16.0/wayland-1.16.0/tests/fixed-benchmark.c:100)
>>>            tests/fixed-benchmark.o:(main)
>>> defined at test-runner.c:377 (/tmp/obj/wayland-1.16.0/wayland-1.16.0/tests/test-runner.c:377)
>>>            test-runner.o:(.text+0x250) in archive /tmp/obj/wayland-1.16.0/build-amd64/.libs/libtest-runner.a

This commit fixes all of that.

Signed-off-by: Leonid Bobrov <mazocomp@disroot.org>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-02-25 13:00:00 +02:00
Simon Ser
8c121e1017 protocol: warn clients about some wl_output properties
All wl_output properties don't always make sense for all
compositors.

Some compositors might not implement a "global compositor space",
(e.g. 3D compositors) in which case properties like x and y don't
make sense.

Some compositors might expose virtual outputs, in which case modes,
make and model are not relevant.

In a lot of these situations, information from xdg_output is better
suited.

Compositors also expose output refresh rate, which shouldn't be used
for synchronization purposes.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Derek Foreman <derek.foreman.wayland@gmail.com>
2019-02-20 10:07:05 -06:00
Derek Foreman
a94b77d0a6 configure.ac: bump version to 1.16.91 for the alpha release 2019-02-19 13:32:36 -06:00
Eric Engestrom
d7b0b7922e TODO: remove "SDL port", it's been done by now
Upstream SDL supports Wayland since v2.0.4 (June 2015):
https://forums.libsdl.org/viewtopic.php?t=11294

Just set SDL_VIDEODRIVER=wayland and SDL will do the right thing :)

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-02-05 15:04:03 +02:00
Simon Ser
6afb152122 Print NULL strings as "nil" in wl_closure_print
Calling printf("%s", NULL) is undefined behaviour.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-01-30 15:49:04 +02:00
Christopher James Halse Rogers
d325140289 proto, server: Add internal server error message. (v2)
Many languages such as C++ or Rust have an unwinding error-reporting
mechanism. Code in these languages can (and must!) wrap request handling
callbacks in unwind guards to avoid undefined behaviour.

As a consequence such code will detect internal server errors, but have
no way to communicate such failures to the client.

This adds a WL_DISPLAY_ERROR_IMPLEMENTATION error to wl_display so that
such code can notify (and disconnect) clients which hit internal bugs.
While servers can currently abuse other wl_display errors for the same
effect, adding an explicit error code allows clients to tell the
difference between errors which are their fault and errors which are the
server's fault. This is particularly interesting for automated bug
reporting.

v2: Rename error from "internal" to "implementation", in sympathy with
    X11's BadImplementation error.
    Add more justification in the commit message.

Signed-off-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-01-29 15:58:19 +02:00
Christopher James Halse Rogers
10c1f37a7c server: Split out varargs version of wl_resource_post_error.
This will allow other wrappers around wl_resource_post_error to accept
variable argument lists.

Signed-off-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-01-29 15:58:19 +02:00
Simon Ser
921d054803 protocol: prefer wl_surface.damage_buffer
This commit makes wl_surface.damage_buffer preferred over wl_surface.damage.
wl_surface.damage can be implemented in a non-optimal way by the compositor
(e.g. by always damaging the whole buffer).

Having two requests makes it complicated for the compositor to handle damage,
making it necessary to transform one into the other's coordinates.

Moreover, integration with wp_viewporter is tricky.

Signed-off-by: Simon Ser <contact@emersion.fr>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Derek Foreman <derek.foreman.samsung@gmail.com>
2018-11-30 09:25:14 -06:00
Derek Foreman
905c0a341d protocol: Bump seat to version 7 and require keymaps be private
Weston commit 76829fc4eaea329d2a525c3978271e13bd76c078 (and similar
commits for other compositors) protects the compositor's keyboard
mapping from client damage by duplicating the keymap for every
client.

On some systems there are other potential fixes for this - such as
using sealed memfds on linux - but we can't use them since
essentially all client code anywhere has mapped the keyboard map
with a MAP_SHARED mmap() call.

While we can't break years worth of code, we can require any future
clients to use MAP_PRIVATE if they use a seat version above 6.

If a compositor can't use sealing or a similar facility, it should
still protect itself with copied keymaps, but clients must always
assume shared mapping of a keymap will fail.

Signed-off-by: Derek Foreman <derek.foreman.samsung@gmail.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Philipp Kerling <pkerling@casix.org>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-11-30 09:17:57 -06:00
Daniel Stone
01095a9ce4 tests: Remove memory leak checking infrastructure
There are far better ways to detect memory leaks, such as either
valgrind or ASan. Having Meson makes it really easy to use these tools
in our tests, and we can do that in CI as well.

Having these local wrappers actually completely broke ASan usage, so
remove them in favour of using the more powerful options.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-29 09:59:04 +01:00
Daniel Stone
cb9a2557e1 tests: Overly elaborate compiler warning workaround
Clang will rightly point out that example_sockaddr_un in socket-test
will get discarded from the compilation unit as it is completely unused.
Put in a couple of lines which of no value other than stopping Clang
from complaining.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-29 09:59:04 +01:00
Daniel Stone
9575d1c772 tests: Use volatile pointer for NULL dereference
Clang warns that it can silently discard a non-volatile write to a NULL
pointer (perhaps it constitutes undefined behaviour?), and recommends
changing it to volatile.

This patch slavishly complies with the demand of the unfeeling machine.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-29 09:59:04 +01:00
Daniel Stone
4939923d3a scanner: Reverse expat/libxml include order
libxml2 unconditonally defines XMLCALL to nothing. Expat does not
redefine XMLCALL if it is already defined, but if it is not, and we are
building with gcc on i386 (not x86-64), it will define it as 'cdecl'.

Including Expat before libxml thus results in a warning about XMLCALL
being redefined. Luckily we can get around this by just reversing the
include order: cdecl is a no-op on Unix-like systems, so by having
libxml first define XMLCALL to nothing and including Expat afterwards,
we avoid the warning and lose nothing.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-29 09:58:49 +01:00
Daniel Stone
5fab243a72 scanner: Mark fail() as noreturn
Help static analysers by letting them know that once we fail(),
execution will terminally complete.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-29 09:56:56 +01:00
Daniel Stone
a2ed67e85c scanner: Plug two memory leaks
Found with both ASan leak sanitizer and Valgrind. We were trivially
leaking the enum name for every arg parsed by the scanner which had one.
If libxml-based DTD validation was enabled, we would also leak the DTD
itself, despite diligently freeing the document, context, etc.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-29 09:56:39 +01:00
Derek Foreman
f1d10fb609 configure.ac: Reopen master for regular development 2018-08-24 13:41:14 -05:00
Derek Foreman
254bef7b4a configure.ac: bump to version 1.16.0 for the official release 2018-08-24 12:39:14 -05:00
Michal Srb
581c62841f tests: Demarshalling of very long array/string lengths.
Attempting to demarshal message with array or string longer than its
body should return failure. Handling the length correctly is tricky when
it gets to near-UINT32_MAX values. Unexpected overflows can cause
crashes and other security issues.

These tests verify that demarshalling such message gives failure instead
of crash.

v2: Added consts, serialized opcode and size properly, updated style.
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Derek Foreman <derek.foreman.samsung@gmail.com>
2018-08-24 12:31:02 -05:00
Derek Foreman
de3079685c configure.ac: bump to version 1.15.94 for the RC2 release 2018-08-17 11:19:45 -05:00
Michal Srb
f7fdface41 connection: Prevent pointer overflow from large lengths.
If the remote side sends sufficiently large `length` field, it will
overflow the `p` pointer. Technically it is undefined behavior, in
practice it makes `p < end`, so the length check passes. Attempts to
access the data later causes crashes.

This issue manifests only on 32bit systems, but the behavior is
undefined everywhere.
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Derek Foreman <derek.foreman.samsung@gmail.com>
2018-08-17 10:59:20 -05:00
Michal Srb
f5b9e3b9a1 connection: Prevent integer overflow in DIV_ROUNDUP.
The DIV_ROUNDUP macro would overflow when trying to round values higher
than MAX_UINT32 - (a - 1). The result is 0 after the division. This is
potential security issue when demarshalling an array because the length
check is performed with the overflowed value, but then the original huge
value is stored for later use.

The issue was present only on 32bit platforms. The use of size_t in the
DIV_ROUNDUP macro already promoted everything to 64 bit size on 64 bit
systems.
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Derek Foreman <derek.foreman.samsung@gmail.com>

Style changes by Derek Foreman
2018-08-17 10:57:41 -05:00
Derek Foreman
fde60465c3 configure.ac: bump to version 1.15.93 for the RC1 release 2018-08-10 13:01:10 -05:00
Daniel Stone
1e4af929d2 contributing: Weston now uses GitLab MRs
Note that Weston uses GitLab MRs for review, not mail.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-08-07 14:35:29 +01:00
Derek Foreman
6ac3ff1c3f configure.ac: bump to version 1.15.92 for the beta release 2018-07-27 11:46:27 -05:00
Daniel Stone
614c137200 spec: Delete old unused directory
The protocol spec used to live here, but it's now part of the regular
doc build. The PNG files are created as part of the doc build. Delete
the pre-generated versions.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derek.foreman.samsung@gmail.com>
2018-07-27 11:16:32 -05:00
Daniel Stone
bd56f9e29f build: Remove support for non-pkg-config Expat
The Expat XML library has shipped a pkg-config file for long enough to
be in Debian's oldstable (Jessie, April 2015) and Ubuntu's oldest
supported LTS (Trusty, 14.04). The pkg-config file was added in Expat
upstream's commit 352cfc8f59a7, in September 2007.

Drop build support for versions of Expat which do not ship a
pkg-config file.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derek.foreman.samsung@gmail.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2018-07-26 16:23:35 +01:00
Daniel Stone
99c3c10ad0 build: Remove execinfo.h check
The check for the execinfo.h header is only advisory; the build will not
fail if it is not present, and set HAVE_EXECINFO_H if it is. The check
was added in commit bc3e020475 ("build: Add declaration checks to check for
required syscall flags") with no obvious use or reasoning.

Remove the no-op check.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derek.foreman.samsung@gmail.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2018-07-26 16:21:46 +01:00
Derek Foreman
e614d79b65 wayland-server: Finally remove deprecated struct wl_buffer definition
commit d94a8722cb
warned this was coming, back in 2013.

I've seen libraries that have wayland client and server using functions
in the same file.  Since struct wl_buffer still exists as an opaque
entity in client code, the vestigial deprecated wl_buffer from the
server include will generate warnings when not building with
WL_HIDE_DEPRECATED.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Acked-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-07-25 12:08:16 -05:00
Simon Ser
504db9d8e5 protocol: allow to send a zero physical output size
Physical size doesn't always make sense for all outputs. In case
it's not available or not relevant, allow compositors to send zero.

Acked-by: Daniel Stone <daniels@collabora.com>
Acked-by: Jonas Ådahl <jadahl@gmail.com>
Acked-by: Olivier Fourdan <ofourdan@redhat.com>
2018-07-24 11:26:17 +01:00
Derek Foreman
4cc1c1519a configure.ac: bump to version 1.15.91 for the alpha release 2018-07-13 11:27:03 -05:00
Pekka Paalanen
14705824a6 contributing: document the release cycle freezes
These should be the conventions we have been using since 1.0, written
down more accurately.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derek.foreman.samsung@gmail.com>
2018-07-13 11:20:31 -05:00
Pekka Paalanen
9f80af930b contributing: about re-sending patches
This is what is generally expected from people who re-send patches,
whether the patches are their own or not.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derek.foreman.samsung@gmail.com>
2018-07-13 11:20:07 -05:00
Pekka Paalanen
3cfdd56af4 contributing: review rules for bugs
Half of the ideas came from Daniel but most of them are reworded, the
rest are my thoughts.

Mention compiler warnings specifically, and be more explicit on what
kind of code or bugs or bug fixes are acceptable or not. Clarify commit
scope.

v2: move the "In a patch series" rule to the bottom, reworded.

Cc: Daniel Stone <daniels@collabora.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derek.foreman.samsung@gmail.com>
2018-07-13 11:19:12 -05:00
Pekka Paalanen
b5f97895da contributing: how to read the review rules
This is to avoid fighting around the letter of the guidelines. This is
not a protocol spec.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derek.foreman.samsung@gmail.com>
2018-07-13 11:17:35 -05:00
Pekka Paalanen
7cbaa871cc client: remove definition of wl_global
Nothing on the client side uses it since
9fe75537ad which was just before the 0.99
release.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-By: Markus Ongyerth <wl@ongy.net>
2018-06-28 14:35:40 +03:00
Simon Ser
a9ff9cc7d5 doc: update IANA MIME types registry URL
Use a more official one, served over HTTP rather than FTP.

Reviewed-by: Matheus Santana <embs@cin.ufpe.br>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-06-28 14:13:13 +03:00
Pekka Paalanen
bb1a8ca91e contributing: commit rights
This has been copied from
https://cgit.freedesktop.org/xorg/app/intel-gpu-tools/tree/CONTRIBUTING?id=eccae1360d6d01e73c6af2bd97122cef708207ef
and slightly edited to better with Wayland and Weston.

The intention is to make it easier to give out commit access to new
people, let them know what is expected of them, and help the community
to grow. Hopefully this will in time improve the patch review throughput
and timeliness.

The original text was introduced in
https://cgit.freedesktop.org/xorg/app/intel-gpu-tools/commit/CONTRIBUTING?id=0350f0e7f6a0e07281445fc3082aa70419f4aac7

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Matheus Santana <embs@cin.ufpe.br>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Derek Foreman <derek.foreman.samsung@gmail.com>
2018-06-18 16:15:58 +03:00
Pekka Paalanen
f16eae15e1 contributing: add review guidelines
This sets up the standards for patch review, and defines when a patch
can be merged. I believe these are the practises we have been using
already for a long time, now they are just written down explicitly.

It's not an exhaustive list of criteria and likely cannot ever be, but
it should give a good idea of what level of review we want to have.

It has been written in general terms, so that we can easily apply the
same text not just to Wayland, but also Weston and other projects as
necessary.

This addition is not redundant with
https://wayland.freedesktop.org/reviewing.html .

The web page is a friendly introduction and encouragement for people to
get involved. The guidelines here are more specific and aimed for people
who seek commit rights or maintainership.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Matheus Santana <embs@cin.ufpe.br>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Derek Foreman <derek.foreman.samsung@gmail.com>
2018-06-18 16:04:57 +03:00
Emil Velikov
35d0425e39 .gitlab-ci.yml: collect the distcheck error logs
Currently we issue both check and distcheck, as reportedly there has
been cases in the past one works, while the other doesn't.

Yet we only collect the check artefacts (test logs).

Correct that, by picking the distcheck ones as well.
Note: the build-*/wayland*/ directory is purged by distcheck if it runs
successfully.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-06-18 12:17:11 +03:00
Pekka Paalanen
630c25f4c1 contributing: format as markdown
Format for nice viewing through Gitlab.

Conduct and Licensing were raised to first level headings as they are
not technical guidelines for contributing patches. It's nice to use the
first level headings more.

Reformat patchwork link and add Xorg patchwork link for Xwayland.

v2: Unfortunately Gitlab harcodes a tab character to mean 4 spaces, so we
cannot reasonably spell the coding style examples correctly. Hence, tab
characters have been replaced with eight spaces so that they at least
look right in both the file and through gitlab web UI.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-06-14 14:40:32 +03:00
Pekka Paalanen
d95cf31201 doc: move Contributing
Gitlab expects a CONTRIBUTING.md in the root directory, so move our
guide there.

Conversion to proper markup is a follow-up patch.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-06-14 14:39:47 +03:00
Daniel Stone
7846d4beea doc: Update URLs for GitLab transition
Update bug and Git URLs for GitLab; the site has also been served over
HTTPS for quite some time.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-06-11 12:03:39 +03:00
Simon Ser
8b2ba84bd0 scanner: allow referencing foreign enums
It's already possible to reference foreign interfaces, so it
should also be possible to reference foreign enums.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Silvan Jegen <s.jegen@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-06-07 11:52:06 +03:00
Daniel Stone
a060822399 Add .gitlab-ci.yml
Add a GitLab CI configuration which tests building, 'make check', and
'make distcheck' of the tree inside a Debian Stretch container. The
choice of distribution base was arbitrary and may easily be changed.

When commits are pushed to upstream, the commits will run this CI
pipeline to run these tests, and capture the result as an artifact
bundle, including the compiled binaries and full test suite logs.

Results can be seen at:
    https://gitlab.freedesktop.org/wayland/wayland/pipelines/

Signed-off-by: Daniel Stone <daniels@collabora.com>
2018-06-07 08:48:24 +01:00
Markus Ongyerth
0e6ac72288 tests: Add free-without-remove test
[Derek Foreman <derekf@osg.samsung.com> moved this into resources-test]

Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2018-04-20 13:19:13 -05:00
Derek Foreman
5e0f7ad1bf server: Add special case destroy signal emitter
In the past much code (weston, efl/enlightenment, mutter) has
freed structures containing wl_listeners from destroy handlers
without first removing the listener from the signal.  As the
destroy notifier only fires once, this has largely gone
unnoticed until recently.

Other code does not (Qt, wlroots) - and removes itself from
the signal before free.

If somehow a destroy signal is listened to by code from both
kinds of callers, those that free will corrupt the lists for
those that don't, and Bad Things will happen.

To avoid these bad things, remove every item from the signal list
during destroy emit, and put it in a list all its own.  This way
whether the listener is removed or not has no impact on the
following emits.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Markus Ongyerth <wl@ongy.net>
2018-04-20 13:19:13 -05:00
Derek Foreman
58ee271bff tests: Test for use after free in resource destruction signals
For years it's been common practice to free the object containing
the wl_listener inside resource destruction notifiers, but not
remove the listener from the list.

That is: It's been safe to assume (when only one listener is present)
that the wl_listener will never be touched again, since this is
a destruction callback.

Recently some patches were reviewed that made some positive changes
to our internal signal handling code, but would've violated this
assumption, and changed free()d memory in several existing compositors
(weston, mutter, enlightenment).

Since the breakage was extremely subtle, codify this assumption in
a test case (thus promoting it to an ABI promise).

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Markus Ongyerth <wl@ongy.net>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
2018-04-20 13:12:57 -05:00
Dipen Somani
685f9a0909 wayland-server: Properly handle EAGAIN from wl_connection_read()
commit 3cddb3c692 casted len to an
unsigned value to compare to sizeof results.  However,
wl_connection_read() can fail, setting errno to EAGAIN and returning
a value of -1.

When cast to an unsigned type this leads to a loop condition of true
when it should be false.

Signed-off-by: Dipen Somani <dipen.somani@samsung.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2018-04-20 13:05:09 -05:00
Derek Foreman
e09c1a98f9 configure.ac: Reopen master for regular development 2018-04-09 13:15:31 -05:00
Derek Foreman
4fdb8530a3 configure.ac: bump to version 1.15.0 for the official release 2018-04-09 11:54:10 -05:00
Derek Foreman
8be9aa86a2 configure.ac: bump to version 1.14.93 for the RC1 release 2018-04-02 12:50:16 -05:00
Emil Velikov
dbcd4cd96e .gitignore: add wayland-egl-abi-check
Instruct git go ignore the file, in case we've done an in-tree build.

Cc: Derek Foreman <derekf@osg.samsung.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2018-04-02 11:01:33 -05:00
Daniel Stone
05fd07f427 wayland-egl: Ignore underscored symbols in ABI check
Rather than a hard-coded list of platform symbols, just ignore anything
prefaced with an underscore. This fixes breakage on ARM, which declares
several slightly different platform symbols to x86.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Fixes: 21b1f22eb0 ("wayland-egl: enhance the symbol test")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105620
Cc: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2018-03-20 10:01:19 -05:00
Derek Foreman
d3fe626219 configure.ac: bump to version 1.14.92 for the beta release 2018-03-19 15:39:39 -05:00
Daniel Stone
3de11b8d79 wayland-egl: Make symbol test fail on failure
The previous rewrite of the wayland-egl ABI checker introduced checks
for removed symbols as well as added symbols, but broke some failure
conditions. Add an explict return-code variable set in failure paths,
rather than chaining or conditions.

If we cannot find the binary or nm, we regard this as an error
condition, rather than test failure.

v2: Don't test if we can execute $NM.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reported-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Fixes: 21b1f22eb0 ("wayland-egl: enhance the symbol test")
Cc: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2018-03-19 11:44:28 -05:00
Daniel Stone
2031bcf5da wayland-egl: Pass nm path to check script
A previous patch used $NM as an environment variable, but this was only
set as a make variable. Make sure it is passed through from make to the
environment we use to run tests.

v2: Quote argument when passing to shell.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reported-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Fixes: 6903e4d539 ("wayland-egl: use correct `nm` path when cross-compiling")
Cc: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2018-03-19 11:39:11 -05:00
Emil Velikov
5f5945b71b wayland-egl: bump the version number to 18.1.0
Seems like I was overoptimistic with my earlier assumption, namely:

"... 17.3.x should be the last version that ships the library."

Mesa 18.0.0 and its wayland-egl is about to be released any time soon,
so bump the number since it must no be smaller. As soon as we get
a wayland release I'll drop the Mesa copy but for now.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-03-19 11:40:47 +02:00
Emil Velikov
21b1f22eb0 wayland-egl: enhance the symbol test
The current test had a few fall-outs:
 - it was checking only for T (.text) symbols
 - did not consider symbol removal

Fix that by fetching all the symbols and doing a bidirectional check -
for added and removed symbols. Error out with informative message for
each case.

v2: Rebase on top of $NM patch.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-03-19 11:40:39 +02:00
Emil Velikov
2ba70f1f6d wayland-egl: fail the symbol check if lib is missing
Based on a similar patch (in Mesa) by Eric Engestrom.

v2: Rebase on top of $NM patch
v3: Rebase

Reviewed-by: Eric Engestrom <eric@engestrom.ch> (v1)
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-03-19 11:40:20 +02:00
Emil Velikov
79cc3ad6bd wayland-egl: set the correct path to libwayland-egl.so
Earlier commit changed to passing the binary name as env. variable
introducing a typo.

That went unnoticed, since we do not check if the file is present or
not.

Cc: Pukka Paalanen <ppaalanen@gmail.com>
Cc: Daniel Stone <daniels@collabora.com>
Fixes: 85cb5ed64a ("wayland-egl-symbols-check: pass the DSO name via
the build system")
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-03-19 11:39:49 +02:00
Emil Velikov
f34af17b21 configure.ac: don't install the static libraries
One should always be using the shared libraries.

Spotted while going through the Debian packaing.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-03-16 12:18:07 +02:00
Pekka Paalanen
371c26d52b tests: disable coredumps on sanity-test
SEGV and ABRT by default cause a core dump, which may create a file,
launch crash handlers, and so on. sanity-test has 21 processes that
are expected to crash like this. Disable core dumps on them all.

I counted 21 entries in coredumpctl list, while only 16 functions needed
patching. After this patch no entries appear in coredumpctl list.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-03-15 14:59:24 +02:00
Derek Foreman
adda7cbbb8 walyand-client: Fix trivial build break from previous commit
previous commit, a9187853d4 added
a trailing { on a line it shouldn't have, and I pushed without
building first.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
2018-03-07 13:38:53 -06:00
Derek Foreman
a9187853d4 client: Don't inappropriatly close fds for zombie objects
commit 239ba39331 which was intended
to stop leaking fds in events for zombie objects didn't notice that
passing 0 to wl_connection_close_fds_in() would still close fds.

Test the fd count before calling.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-03-07 09:21:28 -06:00
Derek Foreman
97351f995c configure.ac: bump to version 1.14.91 for the alpha release 2018-02-26 11:37:44 -06:00
Pekka Paalanen
400df40dfa tests: fix scanner private-code test reference data
Commit e501230d1d "scanner: Fix broken
private-code generation" changed the scanner output without updating the
reference output for scanner tests.

Update the reference data. This fixes 'make check'.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2018-02-26 07:35:04 -06:00
Derek Foreman
e501230d1d scanner: Fix broken private-code generation
Missing a closing bracket.

Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-02-23 16:41:40 -06:00
Emil Velikov
6903e4d539 wayland-egl: use correct nm path when cross-compiling
Inspired by Heiko Becker and Eric's work in libdrm and Mesa
respectively.

Cc: Eric Engestrom <eric.engestrom@imgtec.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-02-23 17:38:22 +00:00
Emil Velikov
b02c4013e3 tests: add code, public-code and private-code tests
First one is deprecated in favour of the second option.

The latter is newly introduced and annotates the generated symbols
accordingly.

v2: Don't introduce small-public-code.c - reuse small-code.c (Pekka)

Cc: Pekka Paalanen <ppaalanen@gmail.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2018-02-22 13:51:50 +02:00
Emil Velikov
bd92689382 scanner: make use of __has_attribute()
A more generic way to evaluating various attributes, __has_attribute is
available with gcc, clang, even the Oracle/Sun compiler.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2018-02-22 11:56:57 +02:00
Emil Velikov
ab6b156920 build: use public-code when using the local wayland-scanner
The core wayland interfaces are public, via the libwayland-server and
libwayland-client DSOs. Hence use "public-code" cmdline option, instead
of the deprecated code".

As the host wayland-scanner may not know about the new option, use the
legacy "code".

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2018-02-22 11:56:57 +02:00
Emil Velikov
9b76def674 scanner: introduce "public-code" and "private-code"
The options are used to indicate how the code will be used - will it be
public, as part of a DSO or private.

In nearly every instance, people want to use the latter. One noticeable
exception is the wayland libraries. They provide the base marshalling
protocol that everyone uses.

The option "code" was deprecated in favour of "public-code" with a
warning message produced to guide people.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2018-02-22 11:56:57 +02:00
Emil Velikov
76a4e4251c build: remove white space in -uninstalled.pc.in files
v2: Rebase, address wayland-client-uninstalled

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com> (v1)
2018-02-16 14:41:08 +00:00
Derek Foreman
68398ec2ce connection: Fix broken log message when demarshalling short closure
Like the similar wl_log() message further into this function that was
fixed in commit 2fc248dc2c this should
be printing the sender_id saved earlier instead of *p.

Since p is incremented during the loop it would not only print an
incorrect object id, it could read past the end of the array.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-15 09:26:08 +02:00
Emil Velikov
9fa60983b5 wayland-egl: rename wl_egl_window::private to driver_private
private is a reserved keyword in C++. Thus if one is to have a backend
driver written in said language build will fail as below:

.../wayland-egl-backend.h:56:8: expected unqualified-id before ‘private’

Rename it to driver_private and update the test.

NOTE: version bump is not required since:
 - this is a pure API change, ABI is identical
 - hardware drivers already require [minor] changes to move to the
upstream wayland-egl-backend.h

Cc: Arnaud Vrac <rawoul@gmail.com>
Cc: Miguel A . Vico <mvicomoya@nvidia.com>
Suggested-by: Arnaud Vrac <rawoul@gmail.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Miguel A Vico Moya <mvicomoya@nvidia.com>
2018-02-09 17:34:19 +00:00
Emil Velikov
8d8f2600ec wayland-egl: move the wayland-egl{, -core}.h headers to egl/
Now we have all the wayland-egl bits in a single place.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Arnaud Vrac <avrac@freebox.fr>
2018-02-09 17:31:06 +00:00
Emil Velikov
85cb5ed64a wayland-egl-symbols-check: pass the DSO name via the build system
The location of the file is build system specific so, keep it there.

Cc: Daniel Stone <daniels@collabora.com>
Suggested-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Arnaud Vrac <avrac@freebox.fr>
2018-02-09 17:31:03 +00:00
Emil Velikov
1fcb4d1387 build: wire-up wayland-egl
Wire-up the imported sources, test and pkg-config files.

v2:
 - Don't mangle with existing EXTRA_DIST list
 - Add the symbols check script to the `make check' target
 - Rename wayland-egl-{priv,backend}.h

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Arnaud Vrac <avrac@freebox.fr>
2018-02-09 17:31:00 +00:00
Emil Velikov
066113a4c8 wayland-egl: add a note about keeping the backend version in sync
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Arnaud Vrac <avrac@freebox.fr>
2018-02-09 17:30:57 +00:00
Emil Velikov
bf3f9e2413 wayland-egl: introduce wayland-egl-backend.pc
File will be installed alongside the backend header.

This way vendor implementations have enough information about the
interface and they can build their backend/driver library accordingly.

Cc: Miguel A. Vico <mvicomoya@nvidia.com>
Cc: James Jones <jajones@nvidia.com>
Cc: Daniel Stone <daniels@collabora.com>
Cc: duncan-roe <duncan_roe@optusnet.com.au>
Cc: Takanari Hayama <taki@igel.co.jp>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Miguel A Vico Moya <mvicomoya@nvidia.com>
Reviewed-by: Arnaud Vrac <avrac@freebox.fr>
2018-02-09 17:30:54 +00:00
Emil Velikov
6c7f96e8fe wayland-egl: correct wayland-egl.pc description/version
Drop the "Mesa" part from the commit message and change the version to
17.4.0. The number bears references from its Mesa heritage.

Currently Mesa provides 17.2.x while 17.3.x should be the last version
that ships the library.

Some version numbers of wayland-egl.pc providers and users.
The latter is taken from Ubuntu 17.04.

Providers:
 - Mali: 7.10
 - Mesa: 17.2.2

Users:
 - retroarch: NA
 - qtwayland5: NA
 - mpv, libmpv1: 9.0
 - mesa-utils-extra: NA
 - weston, libweston-1-0: NA

 - libwaffle-1-0: 9.1
 - libsdl2-2.0-0: NA

 - libgstreamer-plugins-bad1.0-0: autotools 9.0, meson 1.0
 - libglfw3-wayland: NA

 - kwin-wayland, kwin-wayland-backend-wayland: NA?
 - glmark2-wayland, glmark2-es2-wayland: NA

 - libwebkit2gtk-4.0-37, libwebkit2gtk-4.0-37-gtk2, (webkit overall): NA
 - libgtk-3-0 (gtk overall): NA
 - libcogl20 (cogl overall): 1.0.0

v2: Bump the version to 17.4.0

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Arnaud Vrac <avrac@freebox.fr>
2018-02-09 17:30:50 +00:00
Emil Velikov
d71e4ca501 wayland-egl: reuse the existing WL_EXPORT macro
There's little point if redefining new one ourselves. Just reuse the one
that's already available.

Cc: Daniel Stone <daniels@collabora.com>
Suggested-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Arnaud Vrac <avrac@freebox.fr>
2018-02-09 17:30:47 +00:00
Emil Velikov
549a5ea710 wayland-egl: import libwayland-egl.so frontend library from Mesa
Currently the client-facing libwayland-egl API is defined by a header
file shipped by Wayland, but the implementation is left to each vendor.

This can cause collisions when multiple implementations are installed on
the same system. Importing the implementation into Wayland with a stable
and versioned driver-facing ABI allows multiple drivers to coexist on
the same system.

Pull the sample implementation from Mesa commit 677edff5cfd
("wayland-egl: rework and simplify wl_egl_window initialization")
It has been used by the Mesa open source drivers, NVIDIA and others[1].

v2: Reword commit message, rebase on top of newer Mesa.

[1] https://github.com/thayama/wayland-egl

Cc: Miguel A. Vico <mvicomoya@nvidia.com>
Cc: James Jones <jajones@nvidia.com>
Cc: Daniel Stone <daniels@collabora.com>
Cc: duncan-roe <duncan_roe@optusnet.com.au>
Cc: Takanari Hayama <taki@igel.co.jp>
Suggested-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Miguel A Vico Moya <mvicomoya@nvidia.com>
Reviewed-by: Arnaud Vrac <avrac@freebox.fr>
2018-02-09 17:30:36 +00:00
Olivier Fourdan
0fa3474be3 shm: provide actual error on mmap failed
When an mmap() fails, a WL_SHM_ERROR_INVALID_FD is raised and the client
is killed.

However, there is no indication of the actual system error that caused
mmap() to fail, which makes such error harder to investigate.

Provide the actual error message that caused mmap() to fail.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2018-02-09 17:03:28 +00:00
Simon Ser
bf7cc68053 server: add wl_display_destroy_clients()
Bug [1] reported that wl_display_destroy() doesn't destroy clients, so
client socket file descriptors are being kept open until the compositor
process exits.

Patch [2] proposed to destroy clients in wl_display_destroy(). The
patch was not accepted because doing so changes the ABI.

Thus, a new wl_display_destroy_clients() function is added in this
patch. It should be called by compositors right before
wl_display_destroy().

[1] https://bugs.freedesktop.org/show_bug.cgi?id=99142
[2] https://patchwork.freedesktop.org/patch/128832/

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Daniel Stone <daniels@collabora.com>
2018-02-09 17:00:04 +00:00
Philipp Kerling
ef48ff21f0 doc: Document behavior of non-nullable object arguments in clients
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-09 10:06:33 +02:00
Derek Foreman
e5b52f673c connection: Clear correct args when clearing fds to -1
commit 52609ddf79 was intended to
set fds to -1 in the arg list, however it failed to account for
version information at the start of signatures.

Most noticably, this broke mesa's create_prime_buffer by setting
width to -1 instead of the fd, as the width was the argument
following the fd, and the version was one byte long.

This should close https://bugs.kde.org/show_bug.cgi?id=389200

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-01-22 09:45:47 +00:00
Derek Foreman
118aaec480 tests: Add missing file to distribution
In f74c9b98db I added tests.xml to the
repository, but not to the distribution tarball.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-01-19 11:54:26 -06:00
Fiedler, Mathias
35ab47567c server: add log message when client connection is destroyed due to an error
The client connection is destroyed by the server in several
circumstances. This patch adds log messages in case the connection is
destroyed due to an error other than normal hangup.

Signed-off-by: Mathias Fiedler <mathias_fiedler@mentor.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2018-01-19 11:05:59 -06:00
Derek Foreman
ff992951a7 tests: Check for wrong fd delivery with zombie objects
Until recently, if an event attempting to deliver an fd to a zombie
object was demarshalled after the object was made into a zombie, we
leaked the fd and left it in the buffer.

If another event attempting to deliver an fd to a live object was in that
same buffer, the zombie's fd would be delivered instead.

This test recreates that situation.

While this is a ridiculously contrived way to force this race - delivering
an event from a destruction handler - I do have reports of this race
being hit in real world code.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Acked-by: Daniel Stone <daniels@collabora.com>
2018-01-09 15:20:00 +00:00
Derek Foreman
f74c9b98db tests: Add a test for fd leaks on zombie objects
Until recently, if a client destroying a resource raced with the
server generating an event on that resource that delivered a file
descriptor, we would leak the fd.

This tests for a leaked fd from that race condition.

Reviewed-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
2018-01-09 15:20:00 +00:00
Derek Foreman
239ba39331 client: Consume file descriptors destined for zombie proxies
We need to close file descriptors sent to zombie proxies to avoid leaking
them, and perhaps more importantly, to prevent them from being dispatched
in events on other objects (since they would previously be left in the
buffer and potentially fed to following events destined for live proxies)

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-01-09 15:20:00 +00:00
Derek Foreman
4485ed1f59 client: Replace the singleton zombie with bespoke zombies
Using the singleton zombie object doesn't allow us to posthumously retain
object interface information, which makes it difficult to properly inter
future events destined for the recently deceased proxy.

Notably, this makes it impossible for zombie proxy destined file
descriptors to be properly consumed.

When we create a proxy, we now create a zombie-state object to hold
information about the file descriptors in events it can receive. This
will allow us, in a future patch, to close those FDs.

[daniels: Split Derek's patch into a few smaller ones.]

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-01-09 15:20:00 +00:00
Daniel Stone
9744de9f47 client: Plug a race in proxy destruction vs. dispatch
Closures created to hold events which will be dispatched on the client,
take a reference to the proxy for the object the event was sent to, as
well as the proxies for all objects referenced in that event.

These references are dropped immediately before dispatch, with the
display lock also being released. This leaves the potential for a
vanishingly small race, where another thread drops the last reference
on one of the proxies used in an event as it is being dispatched.

Fix this by splitting decrease_closure_args_refcount into two functions:
one which validates the objects (to ensure that clients are not returned
objects which they have destroyed), and another which unrefs all proxies
on the closure (object event was sent to, all referenced objects) as
well as the closure itself. For symmetry, increase_closure_args_refcount
is now the place where the refcount for the proxy for the object the
event was sent to, is increased.

This also happens to fix a bug: previously, if an event was sent to a
client-destroyed object, and the event had object arguments, a reference
would be leaked on the proxy for each of the object arguments.

Found by inspection whilst reviewing the zombie-FD-leak series.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Cc: Jonas Ådahl <jadahl@gmail.com>
Cc: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-01-09 15:19:52 +00:00
Daniel Stone
430c7820c3 client: Add wl_proxy_unref helper
Rather than open-coded decrement-and-maybe-free, introduce a
wl_proxy_unref helper to do this for us. This will come in useful for
future patches, where we may also have to free a zombie object.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Cc: Jonas Ådahl <jadahl@gmail.com>
2018-01-09 15:18:04 +00:00
Daniel Stone
b39d893397 client: Use refcount exclusively for destruction
Commit e273c7cde added a refcount to wl_proxy. The refcount is set to 1
on creation, decreased when the client explicitly destroys the proxy,
and is increased and decreased every time an event referencing that
proxy is queued.

Assuming no bugs, this means the refcount cannot reach 0 without the
proxy being explicitly destroyed. However, some (not all) of the
proxy-unref paths were only destroying the proxy if it had already been
deleted. This should already be enforced by refcounting, so remove the
check and rely solely on the refcount as the arbiter of when to free a
proxy.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Cc: Jonas Ådahl <jadahl@gmail.com>
2018-01-09 15:17:58 +00:00
Derek Foreman
c380adc554 client: Remove WL_ZOMBIE_OBJECT global
Since we now have the WL_MAP_ENTRY_ZOMBIE flag to determine whether or
not a client-side object is a zombie, we can remove the faux object.

[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>
2017-12-28 19:43:20 +00:00
Derek Foreman
712ba320db 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>
2017-12-28 19:43:20 +00:00
Derek Foreman
07d7a9968d 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>
2017-12-28 19:43:20 +00:00
Derek Foreman
69fab4fffc 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>
2017-12-28 15:16:37 +00:00
Derek Foreman
b4cf9e7d5e 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>
2017-12-27 14:18:51 +00:00
Derek Foreman
46e4ea43a2 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>
2017-12-27 14:14:31 +00:00
Derek Foreman
52609ddf79 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>
2017-12-27 14:14:04 +00:00
Derek Foreman
e802094c9b 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>
2017-12-27 13:59:48 +00:00
Derek Foreman
383b2d965a 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>
2017-12-27 13:51:19 +00:00
Derek Foreman
9a2735c2b7 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>
2017-12-27 13:49:51 +00:00
Pekka Paalanen
147617800d 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>
2017-12-18 12:05:03 +02:00
Matt Hoosier
1b6521e695 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>
2017-12-11 10:03:59 +02:00
Pekka Paalanen
de24f4dd76 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>
2017-12-05 10:43:17 +00:00
Jonas Ådahl
8d4250ab5e 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>
2017-12-04 22:38:56 +00:00
Derek Foreman
a46d89de9a 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>
2017-12-04 22:22:47 +00:00
Derek Foreman
56696e5148 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>
2017-12-04 22:21:45 +00:00
Derek Foreman
971a9e7873 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>
2017-12-04 22:21:37 +00:00
Armin Krezović
c3ff179a95 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>
2017-12-04 19:53:26 +00:00
Christopher James Halse Rogers
ed7ad31ac2 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>
2017-12-04 19:45:38 +00:00
Jonas Ådahl
698dde1958 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>
2017-12-04 19:45:38 +00:00
Emil Velikov
2f392daadb 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>
2017-12-04 19:45:38 +00:00
Emmanuel Gil Peyrot
4c920f0f5e 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>
2017-12-01 16:56:02 +00:00
Emmanuel Gil Peyrot
341bb12a0d 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>
2017-12-01 16:55:55 +00:00
Tobias Stoeckmann
5d201df72f 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>
2017-11-29 09:45:10 +02:00
Emil Velikov
242005636d 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>
2017-10-13 14:26:46 +03:00
Derek Foreman
f6bbc975d3 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>
2017-10-02 11:45:56 +03:00
Emil Velikov
5bb8268766 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>
2017-09-18 12:21:55 +03:00
Pekka Paalanen
3ea73cba04 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>
2017-08-25 10:35:05 +03:00
Jonas Ådahl
b88ada0760 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>
2017-08-18 15:20:24 +03:00
Emil Velikov
22be3c7b90 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>
2017-08-18 14:55:35 +03:00
Emil Velikov
12509e46b7 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>
2017-08-18 14:51:57 +03:00
Bryce Harrington
0b991b62b8 Reopen master for regular development
A 1.14 branch has been established for stable release work.
2017-08-08 12:03:27 -07:00
Bryce Harrington
989cf03d1c configure.ac: bump to version 1.14.0 for the official release 2017-08-08 11:20:35 -07:00
Bryce Harrington
269c1434b4 configure.ac: bump to version 1.13.93 for the RC1 release 2017-08-01 11:12:43 -07:00
Owen W. Taylor
042e7eadd8 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>
2017-07-27 14:56:26 +03:00
Bryce Harrington
897256d419 configure.ac: bump to version 1.13.92 for the beta release 2017-07-25 16:25:01 -07:00
Bryce Harrington
f52c50baad configure.ac: bump to version 1.13.91 for the alpha release 2017-07-11 19:07:55 -07:00
Daniel Stone
0eefe99fe0 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>
2017-04-07 16:11:44 +01:00
Daniel Stone
3f2c194697 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>
2017-03-17 17:55:44 +00:00
Eric Engestrom
9452cc53da connection-test: fix assert
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-03-16 14:10:47 +02:00
Emil Velikov
654dee85c6 wayland-util: do not export the wl_map_* API
Used only internally and explicitly marked as such with commit
cf04b0a18f ("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>
2017-03-14 12:54:01 +02:00
Sergi Granell
9b78be6bb0 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>
2017-02-28 16:37:49 +02:00
Carlos Garnacho
680a6b32de 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>
2017-02-23 16:42:28 +02:00
Bryce Harrington
f8c93078f8 configure.ac: bump version to 1.13.90 for open development
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2017-02-21 14:27:16 -08:00
Bryce Harrington
1361da9cd5 configure.ac: bump to version 1.13.0 for the official release 2017-02-21 13:27:16 -08:00
Bryce Harrington
24df0fb6b3 configure.ac: bump to version 1.12.93 for the RC1 release 2017-02-14 12:56:55 -08:00
Bryce Harrington
6161d7dd0e configure.ac: bump to version 1.12.92 for the beta release 2017-02-07 15:14:56 -08:00
Pekka Paalanen
56f2dad6d2 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>
2017-01-27 10:36:23 +02:00
Yong Bakos
8fe8a2bb1e 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>
2017-01-26 14:49:55 +00:00
Yong Bakos
e89d0a6684 dtddata: Use standard permission notice
Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2017-01-26 14:49:55 +00:00
Derek Foreman
de90865894 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>
2017-01-25 14:59:02 +02:00
Derek Foreman
efae9532e8 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>
2017-01-25 14:59:02 +02:00
Derek Foreman
5fbc9daa40 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>
2017-01-25 14:59:02 +02:00
Giulio Camuffo
c44eed1c06 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>
2017-01-25 13:47:05 +02:00
Giulio Camuffo
7454aa9bb9 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>
2017-01-25 13:46:56 +02:00
Giulio Camuffo
5e6eb03229 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>
2017-01-25 13:46:23 +02:00
Olivier Fourdan
23d8bc5a64 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>
2017-01-25 12:19:30 +02:00
Bryce Harrington
ad4f04872a configure.ac: bump to version 1.12.91 for the alpha release 2017-01-24 18:13:26 -08:00
Olivier Fourdan
65b773e51f 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>
2017-01-24 15:49:03 +02:00
Olivier Fourdan
d915447365 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>
2017-01-24 15:47:59 +02:00
Peter Hutterer
2f72d0a8a8 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>
2017-01-24 12:00:19 +02:00
Peter Hutterer
f8ab47690c 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>
2017-01-24 11:59:00 +02:00
Peter Hutterer
6c481003a2 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>
2017-01-24 11:58:42 +02:00
Peter Hutterer
493eda337a 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>
2017-01-24 11:48:46 +02:00
Yong Bakos
721e0b4a97 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>
2016-12-10 00:37:02 +00:00
Yong Bakos
deb370cc8f 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>
2016-11-28 11:25:08 +00:00
Yong Bakos
20742b7449 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>
2016-11-23 10:11:49 +00:00
Pekka Paalanen
c9f64544a3 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>
2016-11-23 10:18:44 +02:00
Pekka Paalanen
992b451dc4 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 2c6350beb9
Acked-by: Yong Bakos <ybakos@humanoriented.com>
2016-11-23 10:18:29 +02:00
Yong Bakos
024200745f 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>
2016-11-21 21:16:42 +00:00
Peter Hutterer
a26ed0949e 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>
2016-11-21 11:43:22 +00:00
Bryce Harrington
a2cbdefc92 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>
2016-11-21 11:35:15 +00:00
Yong Bakos
b05baa6aa8 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>
2016-11-21 11:27:47 +00:00
Reynaldo H. Verdejo Pinochet
84776648a5 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>
2016-11-21 11:17:17 +00:00
Derek Foreman
8d335bf264 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>
2016-11-21 11:17:06 +00:00
Yong Bakos
013cfd9408 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>
2016-11-21 11:07:54 +00:00
Peter Hutterer
b4636b5e60 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>
2016-11-21 11:07:12 +00:00
Derek Foreman
5c48aac33b 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>
2016-11-21 09:58:25 +00:00
Yong Bakos
9ac70f4349 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>
2016-11-18 17:10:21 +02:00
Yong Bakos
2d328a4559 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>
2016-11-18 16:59:23 +02:00
Yong Bakos
b0cd65deac 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>
2016-11-18 16:21:19 +02:00
Yong Bakos
0cdc3229b0 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>
2016-11-18 16:08:14 +02:00
Pekka Paalanen
aa51a833eb 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>
2016-11-17 13:33:31 +02:00
Moritz Kiefer
06b7c471b7 doc: Fix a typo in the client documentation
Signed-off-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
2016-11-16 16:39:44 +00:00
Dennis Kempin
6a18a87727 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>
2016-11-16 16:35:19 +00:00
Yong Bakos
fd75029fb9 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>
2016-11-16 16:35:18 +00:00
Yong Bakos
2281bc08b2 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>
2016-11-16 15:57:51 +00:00
Bill Spitzak
2c6350beb9 scanner: Fixed doxygen group name for _add_listener
Signed-off-by: Bill Spitzak <spitzak@gmail.com>
Acked-by: Yong Bakos <ybakos@humanoriented.com>
2016-11-16 15:29:13 +00:00
Pekka Paalanen
edd62e62b7 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>
2016-11-16 13:23:43 +02:00
Yong Bakos
9618087c6a 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>
2016-11-10 17:12:04 +02:00
Yong Bakos
66a26aeb2a 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>
2016-11-10 16:41:40 +02:00
Yong Bakos
a6cf19842c 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>
2016-11-10 13:52:59 +02:00
Yong Bakos
ed7a688025 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>
2016-11-10 13:37:30 +02:00
Daniel Stone
23d3c67c9a 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>
2016-11-10 13:30:28 +02:00
Yong Bakos
b802108f6e 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>
2016-11-10 13:11:17 +02:00
Yong Bakos
9e2e3bcaa7 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>
2016-11-10 13:10:40 +02:00
Yong Bakos
da58e07c3d 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>
2016-11-10 13:03:47 +02:00
Yong Bakos
ae139d8b6b 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>
2016-10-18 12:58:39 +03:00
Yong Bakos
a1ab2c03ae 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>
2016-10-18 12:24:53 +03:00
Yong Bakos
f04f218781 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>
2016-10-18 12:24:53 +03:00
Yong Bakos
e8ad23266f 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>
2016-10-18 12:24:53 +03:00
Yong Bakos
db61796026 util: Document wl_array
Add doxygen comments for wl_array and its methods.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-10-18 12:24:35 +03:00
Yong Bakos
f7e1dcc20b util: Document wl_list methods
Add doxygen comment blocks to all wl_list methods.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
[Pekka: removed "itself" as suggested by Bryce]
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-09-26 15:42:55 +03:00
Bryce Harrington
454df51dce configure.ac: bump version to 1.12.90 for open development
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2016-09-22 10:31:53 -07:00
Bryce Harrington
a0d76ffda5 configure.ac: bump to version 1.12.0 for the official release 2016-09-20 10:45:10 -07:00
Bryce Harrington
a4aba37ba1 configure.ac: bump to version 1.11.94 for the RC2 release 2016-09-13 12:13:57 -07:00
Yong Bakos
9afa4bfb7b server: Document display parameter
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>
2016-09-13 15:34:00 +03:00
Yong Bakos
2c8fc3eae2 protocol: Replace '#defines' with 'macros'
The use of # within a description causes the documentation generator
to mistake C syntax with a documentation link.

Remove the # from the documentation, suppressing the warning.

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>
2016-09-13 15:31:41 +03:00
Bryce Harrington
da58173cfe configure.ac: bump to version 1.11.93 for the RC1 release 2016-09-06 14:22:03 -07:00
Yong Bakos
2bdbb741e2 tests: Add test for wl_list_length
list-test.c did not cover wl_list_length, 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>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-09-05 15:10:43 +03:00
Yong Bakos
d9ef882139 doc: Correct docbook title
The docbook title was "The Wayland display server," which is inaccurate.

Change the title to "The Wayland Protocol".

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-09-05 13:55:29 +03:00
Bryce Harrington
2d7b34e2ee configure.ac: bump to version 1.11.92 for the beta release 2016-08-30 11:40:23 -07:00
Bryce Harrington
2a6b08896a configure.ac: bump to version 1.11.91 for the alpha release 2016-08-16 11:25:12 -07:00
Yong Bakos
a285fa939c protocol: Specify upper left corner of damage rectangle
Specify x and y args as the upper left corner of the surface / buffer
damage rectangle.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-08-12 12:46:02 -07:00
Yong Bakos
8e7e52f335 protocol: Describe serial as serial number
Change "serial" to "serial number" in arg summaries, for consistency
and clarity.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-08-12 12:45:55 -07:00
Yong Bakos
7aa1f6cb2f protocol: Remove wl_ prefix from summary descriptions
Summary attributes sometime describe objects using their wl-prefixed type,
but more often don't.

Remove the wl_ prefix from summary descriptions, since they tend to describe
concepts.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-08-12 12:45:48 -07:00
Yong Bakos
40feca914b protocol: Correct description indentation
Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-08-12 12:45:41 -07:00
Yong Bakos
3f1104d64c protocol: Add missing line break
Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-08-12 12:45:34 -07:00
Yong Bakos
83ec381bf8 protocol: Capitalize ID for consistency
Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-08-12 12:45:26 -07:00
Yong Bakos
aaf2c91873 protocol: Hyphenate subsurface
Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-08-12 12:45:19 -07:00
Yong Bakos
d7cb6c3570 protocol: Add summary attributes to request params and enum entries
Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-08-12 12:45:09 -07:00
Yong Bakos
1c3213adf0 server: Add doxygen comment for wl_client_for_each
Commit 596024f728 includes a doc comment
with a link to the wl_client_for_each macro, causing an error when generating
documentation.

Add a doc comment to wl_client_for_each, enabling the hyperlink and removing
the error.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-08-12 12:43:37 -07:00
Giulio Camuffo
450f06e21a Add API to install protocol loggers on the server wl_display
The new wl_display_add_protocol_logger allows to set a function as
a logger, which will get called when a new request is received or an
event is sent.
This is akin to setting WAYLAND_DEBUG=1, but more powerful because it
can be enabled at run time and allows to show the log e.g. in a UI view.
A test is added for the new functionality.

Signed-off-by: Giulio Camuffo <giulio.camuffo@kdab.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-08-12 11:59:46 +03:00
Giulio Camuffo
2f617250d2 Add API to retrieve and iterate over the resources list of a client
To complement on the new resource created signal, this allows to
iterate over the existing resources of a client.

Signed-off-by: Giulio Camuffo <giulio.camuffo@kdab.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
[Pekka: added empty lines, init ret in for_each_helper()]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-08-12 11:53:16 +03:00
Giulio Camuffo
c55c1d787c Add a resource creation signal
This change allows to add a resource creation listener to a wl_client,
which will be notified when a new resource is created for that client.
The alternative would be to have a per wl_display listener, but i think
that resources are really client specific objects, so it makes sense
to use the wl_client as the context.

Signed-off-by: Giulio Camuffo <giulio.camuffo@kdab.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
[Pekka: added wl_list_remove() in TEST(new_resource).]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-08-12 11:43:02 +03:00
Giulio Camuffo
596024f728 Add API to get the list of connected clients
This patch chooses the wl_list_for_each-style of iterating over
the clients, instead of using an iterator function, because i think
it is easier to use.

Signed-off-by: Giulio Camuffo <giulio.camuffo@kdab.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-08-11 15:52:15 +03:00
Giulio Camuffo
68abfa6732 Add API to retrieve the interface name of a wl_resource
Signed-off-by: Giulio Camuffo <giulio.camuffo@kdab.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
2016-08-11 15:52:07 +03:00
Sungjae Park
be48da6a42 server: add listener API for new clients
Using display object, Emit a signal if a new client is created.

In the server-side, we can get the destroy event of a client,
But there is no way to get the created event of it.
Of course, we can get the client object from the global registry
binding callbacks.
But it can be called several times with same client object.
And even if A client creates display object,
(so there is a connection), The server could not know that.
There could be more use-cases not only for this.

Giulio: a test is added for the new functionality

Signed-off-by: Sung-jae Park <nicesj@nicesj.com>
Signed-off-by: Giulio Camuffo <giulio.camuffo@kdab.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-08-11 14:35:28 +03:00
Quentin Glidic
5636cb2f05 scanner: Generate all SINCE_VERSION macros for everyone
Practical example: a client supporting version 2 of wl_output will wait
for the wl_output.done event before starting wl_output-related
operations. However, if the server only supports version 1, no event
will ever come, and it must fallback to use the wl_output.geometry event
alone.
Without this macro, it cannot check for that in a nice way.

This patch introduces the same #defines in both server and client
headers. We rely on both being generated from the same XML file and
https://gcc.gnu.org/onlinedocs/cpp/Undefining-and-Redefining-Macros.html
to not cause compiler errors or warning due to redefinitions. We also
assume that no-one uses the same name in the same interface for both a
request and an event.

If this patch does cause grief due to identical redefinitions, the
contingency plan is to change the generator to produce
 #ifndef/#define/#endif instead of just #define.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
[Pekka: add paragraphs to commit message.]
2016-08-11 13:49:50 +03:00
Quentin Glidic
bad9dc5186 protocol: Add release (destructor) request to wl_output
Outputs come and go, and this is needed to clean up wl_resources on the
server side. All protocol objects need a way to be destroyed.

Cc: Neil Roberts <neil@linux.intel.com>
Cc: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
[Pekka: added commit message]
2016-08-08 16:22:52 +03:00
Yong Bakos
993df57928 display-test: Remove redundant stdbool include
display-test.c includes stdbool.h twice. Remove the redundant include.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-07-25 18:41:14 -07:00
Yong Bakos
2b1c1b2d66 (multiple): Include stdint.h
Some headers and source files have been using types such as uint32_t
without explicitly including stdint.h.

Explicitly include stdint.h where appropriate.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2016-07-25 18:39:32 -07:00
Khem Raj
6750b47d9e scanner: Use uint32_t instead of uint
uint32_t is C99 defined stdint type

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-07-18 11:12:56 +01:00
Bryce Harrington
c88ec7e291 scanner: Improve documentation for strtouint()
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
2016-07-11 14:00:34 -07:00
Bryce Harrington
1cda73f3f8 tests: Require base 10 for the string specifying the number of open fd's
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.

exec-fd-leak-checker's single argument is the count of file descriptors
it should expect to be open.  We should expect this to be specified only
as a decimal number, there's no reason why one would want to use octal
or hexadecimal for that.

Suggested by Yong Bakos.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
2016-07-11 13:32:15 -07:00
Yong Bakos
d6d7dab487 scanner: Move PROGRAM_NAME define
PROGRAM_NAME was defined within the if block of HAVE_LIBXML, causing a
compilation failure when libxml is not present.

Move the define of PROGRAM_NAME out of the if block.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2016-06-07 10:22:59 -05:00
Yong Bakos
e1f2ba2b37 server-core, event-loop: Fix parameter alignment.
Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-06-07 16:33:28 +03:00
Yong Bakos
0cc2eb9ef0 scanner: Replace #define tab with space
wayland-client-protocol.h and wayland-server-protocol.h use a tab
between the identifier and token of generated #defines for request/event
opcodes and versions. While this sometimes enables vertical alignment,
it more frequently doesn't, and leads to awkward spacing.

Replace the tab with a space, for consistency and readability.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Tested-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2016-06-07 16:30:22 +03:00
Yong Bakos
826b16641a server, server-core: Minimize fwd decs, use macro, and format
wayland-server.h: Adjust line breaks between prototypes.

wayland-server-core.h:
Adjust line breaks between prototypes.
Adjust space between splats and identifiers.
Remove unconventional linebreak before first parameter.
Add line breaks after return types.
Remove unnecessary forward declarations, and:
- move 'struct wl_client' declaration close to the dependent typedef
- tastefully move 'wl_shm_buffer_get' to leverage the return type
Replace explicit __attribute__ with WL_PRINTF macro.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-06-07 16:11:05 +03:00
Yong Bakos
e5bd4122e9 client-core: Add missing line breaks
Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-06-07 16:10:35 +03:00
Yong Bakos
fe31d2f9af event-loop: Include wayland-util.h
event-loop.c uses WL_EXPORT and wl_list, which are defined in
wayland-util.h.

Include wayland-util.h explicitly, rather than transitively through
wayland-server-core.h.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Sam Spilsbury <smspillaz@gmail.com>
2016-06-07 16:07:08 +03:00
Yong Bakos
9000c0f20e wayland-shm: Include wayland-util.h
wayland-shm.c uses WL_EXPORT and wl_array, which are defined in
wayland-util.h.

Include wayland-util.h explicitly, rather than transitively through
wayland-server.h.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Sam Spilsbury <smspillaz@gmail.com>
2016-06-07 16:07:01 +03:00
Bryce Harrington
36aeaf037b scanner: Fix reported executable name to 'wayland-scanner'
'wayland-scanner -v' (correctly) reports the program as named
"wayland-scanner", but 'wayland-scanner -h' was inconsistent, referring
to it as './scanner'.

Also refactor this and other references to the program name to use a
common #define, PROGRAM_NAME.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Tested-by: Yong Bakos <ybakos@humanoriented.com>
2016-06-07 16:02:19 +03:00
Yong Bakos
d588efcbc8 wayland-server: Clarify included header dependencies
wayland-server.c directly depends on wayland-util.h, and will include
wayland-server-protocol.h via wayland-server.h.

Explicitly include wayland-util.h, making this dependency clear.
Remove the redundant inclusion of wayland-server-protocol.h.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-06-01 19:22:19 -07:00
Yong Bakos
972f1a2cf7 event-loop: Make transitive include explicit
The explicit inclusion of wayland-server.h hides the real dependency, which
is wayland-server-core.h.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2016-06-01 18:42:36 -07:00
Yong Bakos
a1bce0ead5 doc: Unpublish global_zombie_object and wl_interface_equal
Both global_zombie_object and wl_interface_equal are private, yet were
part of public documentation despite not being part of the public API.

Move these two definitions to the top of an existing doxygen \cond block,
which removes them from the public documentation.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-06-01 17:34:30 -07:00
Yong Bakos
d29b923305 doc: Unpublish wl_log* and wl_abort
The public documentation included descriptions of wl_log_stderr_handler,
wl_log_func_t wl_log_handler, wl_log and wl_abort. These are not accessible
via the public API.

Move the doxygen \endcond command to wrap these definitions, removing them
from publication.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-06-01 17:34:21 -07:00
Yong Bakos
3e58aa1e06 doc: Unpublish wl_display_get_additional_shm_formats
The Wayland docbook and the doxygen html docs had been presenting
wl_display_get_additional_shm_formats as part of the public API, but the
prototype for this function is in wayland-private.h.

Add a \private annotation to the doc comment, preventing doxygen from
publishing this function as public.
Add logic to the publican xsl to only transform elements with a "prot"
attribute value of "public".

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-06-01 17:34:17 -07:00
Pekka Paalanen
98d94b5c1d configure.ac: bump version to 1.11.90 for open development
As announced in 1.11.0 release notes, master is open again.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-06-01 11:08:02 +03:00
Bryce Harrington
47163797f8 configure.ac: bump to version 1.11.0 for the official release 2016-05-31 17:11:20 -07:00
Bryce Harrington
62d67fe8fa configure.ac: bump to version 1.10.93 for the RC1 release 2016-05-24 12:29:59 -07:00
Yong Bakos
97fef48213 scanner: Remove unused forward decs from client protocol
wayland-client-protocol.h had forward declarations for wl_client and
wl_resource, yet nothing on the client side references these types.

Add a 'side' condition to only generate these forward declarations in the
server protocol header.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: <pekka.paalanen@collabora.co.uk>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-05-20 14:58:59 -07:00
Marek Chalupa
cc11b49342 display-test: move a misplaced comment
we split a function while refactoring in c643781 and now
the comment makes no sense

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-05-19 17:57:18 -07:00
Yong Bakos
9ca9f8e4b2 tests: Check for client/server-core.h inclusion
The purpose of wayland-*-protocol-core.h is to mimc the
wayland-*-protocol.h generated by scanner --include-core-only.
The only difference being what wayland-*-protocol.h should include.

Add an include check in the headers-protocol-core-test, to be sure that
a wayland-*-protocol.h generated with the --include-core-only option
properly includes wayland-*-core.h.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-05-19 14:31:18 -07:00
Bryce Harrington
f19b569ec2 configure.ac: bump to version 1.10.92 for the beta release 2016-05-17 22:07:48 -07:00
Yong Bakos
f86fbe1a11 private: Remove unnecessary forward declarations
Declarations for wl_connection and wl_closure are not needed here.
wl_closure already has a complete definition.
Removing these forward declarations results in a clean, warning-free compile.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
[Updated to apply to trunk]
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-05-11 11:09:20 -07:00
Yong Bakos
385906beae connection: Move wl_interface_equal to util
Move the wl_interface_equal prototype to the top of wayland-private, where
it is not buried in the middle of map, connection and closure functions.

Move the implementation out of connection and into util. This is a utility
function, not specific to connections, and has call sites within connection,
wayland-client and wayland-server.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-05-11 11:05:06 -07:00
Yong Bakos
e5b12aa827 doc: Formalize file comment in wayland-client.h, wayland-server.h
Publican was generating a subtle error during a build:
Error: no ID for constraint linkend: Server-wayland-server-core_8h.

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

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

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

References: d74a9c079b

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

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

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

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

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

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

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

Changes since v1:
 - several implementation bugs fixed

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Log a warning if this happens.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-02-11 13:48:23 -08:00
Bryce Harrington
1906a90aab configure.ac: bump to version 1.9.93 for the RC1 release 2016-02-09 13:26:21 -08:00
Sergi Granell
d33514379d cosmetic: add an space after if 2016-02-04 16:37:40 -08:00
Sergi Granell
6301639146 cosmetic: use tabs instead of spaces 2016-02-04 16:37:34 -08:00
Derek Foreman
369b6466a7 scanner: Fix oddities in copyright printing
Some copyright strings could result in broken generated header files with
unmatched */

This change:
Runs the loop long enough so the copyright[i] == 0 test can actually
happen. (if there was no \n no copyright text was printed, */ still was)

Prints the opening /* even if there was whitespace at the start of
the very first line.

Only emits a */ if a /* was printed.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-02-04 11:11:21 -08:00
Bryce Harrington
816a0ae09b configure.ac: bump to version 1.9.92 for the beta release 2016-02-02 15:30:36 -08:00
Jonas Ådahl
7b42788f21 scanner: Print filename on DTD validation error
Don't just print prefix the errors with "protocol", but the actual file
name, if wayland-scanner was passed with the filename of the protocol
file. If wayland-scanner is reading from stdin, errors will be prefixed
with "<stdin>" instead of "protocol".

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: David Fort <contact@hardening-consulting.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-02-01 17:39:08 -08:00
Derek Foreman
0d56e380f6 server: Fail to bind object when requested version is 0
0 is not a valid version number for registry bind requests, so
let's check for it in registry_bind.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-02-01 17:26:08 -08:00
Marek Chalupa
5ac34a1012 cosmetic: return NULL instead of 0
we're returning a pointer

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-02-01 17:05:16 -08:00
Jonas Ådahl
ed680954c8 protocol: Add note about per version requirements to wl_data_device_manager
Add a note to the wl_data_device_manager global interface about the
different requirements for operating the objects created from the bound
global.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Carlos Garnacho <carlosg@gnome.org>
2016-02-01 16:59:55 -08:00
Sergi Granell
ac36082813 server: Fix possible wl_display_add_socket_fd memleak
If wl_event_loop_add_fd failed, the fail path didn't free the
newly allocated struct wl_socket.
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2016-02-01 15:53:48 -08:00
Bryce Harrington
14b76a0e24 configure.ac: re-bump to version 1.9.91 for the alpha release 2016-01-19 14:54:32 -08:00
Sung-Jin Park
eb52bb8e14 server: Add an API to get the file descriptor for a client
This adds an API to get the file descriptor for a client.
The client file descriptor can be used for a wayland compositor to validate
a request from a client if there are any additional information provided from
the client's file descriptor.

For instance, this will be helpful in some linux distributions, in which SELinux
or SMACK is enabled. In those environments, each file (including socket) will have
each security contexts in its inode as xattr member variable. A wayland compositor
can validate a client request by getting the file descriptor of the client and
by checking the security contexts associated with the file descriptor.

Signed-off-by: Sung-Jin Park <input.hacker@gmail.com>
2016-01-19 14:52:54 -08:00
Bryce Harrington
7ed00c1de7 configure.ac: bump to version 1.9.91 for the alpha release 2016-01-19 14:30:33 -08:00
Derek Foreman
e9d894204b tests: Test proxy versions
Add a test that confirms that proxy versions are always 0 for display
and correct otherwise.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-01-19 13:59:34 -06:00
Jason Ekstrand
557032e36c Track protocol object versions inside wl_proxy.
This provides a standardized mechanism for tracking protocol object
versions in client code.  The wl_display object is created with version 1.
Every time an object is created from within wl_registry_bind, it gets the
bound version.  Every other time an object is created, it simply inherits
it's version from the parent object that created it.

(comments and minor reformatting added
by Derek Foreman <derekf@osg.samsung.com>)

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>

Second trivial commit squashed into this one:
Authored by Derek Foreman <derekf@osg.samsung.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
(it's literally one of code and a lot of comments)

This sets wl_display's version (for proxy version query purposes)
to 0.  Any proxy created with unversioned API (this happens when
a client compiled with old headers links against new wayland)
will inherit this 0.

This gives us a way for new libraries linked by old clients to
realize they can't know a proxy's version.

wl_display's version being unqueryable (always returning 0) is
an acceptable side effect, since it's a special object you can't
bind specific versions of anyway.

Second half:
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
2016-01-19 13:58:50 -06:00
Jonas Ådahl
c6437817dd tests: Test that one can fetch the protocol error after EPIPE
If a client is terminated due to some reason, it should always be
possible to retrieve protocol error associated with the termination.
Test that, while either using the dispatch helpers
(wl_display_dispatch(_queue)() or the prepare read API, it should be
possible to retrieve the error after EPIPE.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-01-16 16:37:37 +08:00
Jonas Ådahl
046012a6cf tests: Pass argument to client main
Change the API to pass an "void *" argument to the client main
function, allowing the caller to call the same main function with
different input.

A helper (client_create_noarg) is added for when no argument is passed,
and the existing test cases are changed to use this function instead.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-01-16 16:37:37 +08:00
Jonas Ådahl
7efe8fbd89 tests: Synchronize client termination in idle callback
We currently wait for clients in the wl_client destroy signal, which is
called before the client is destructed and the socket is closed. If test
clients rely on being closed due to the socket being closed we'd dead
lock. Avoid this by synchronizing in an idle task that is called after
the client is fully destroyed.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-01-16 16:37:36 +08:00
Jonas Ådahl
242617c316 client: Fully flush during blocking dispatch
wl_display_flush() may fail with EAGAIN which means that not all data
waiting in the buffer has been flushed. We later block until there is
data to read, which could mean that we block on input from the
compositor without having sent out all data from the client. Avoid this
by fully flushing the socket before starting to wait.

This commit also changes the array length of the struct pollfd array
from 2 to 1, as only one element was ever used.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-01-16 16:37:36 +08:00
Jonas Ådahl
689fff36ca client: Use read preparation API in wl_display_dispatch_queue()
Instead of doing things that do the equivalent of using
wl_display_prepare_read() and friends, just use the public API. The
only semantical difference is that we will now unlock and lock the mutex
more times compared to before.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-01-16 16:37:36 +08:00
Jonas Ådahl
c767f35b12 client: Don't make EPIPE fatal if triggered when flushing
If flushing hits EPIPE it should not make it a fatal error since it
would make it impossible to process the rest of the data available in
the buffer. Instead, let reading the socket make EPIPE fatal, letting
the client have the possibility to process the last messages including
any error causing the termination.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-01-16 16:37:36 +08:00
Jonas Ådahl
0b44298a15 client: Remove misplaced documentation about main loop intergration
There was documentation about how to integrate the display server file
descriptor in the documentation about wl_display_dispatch_pending().
This is not the right place to put it, and it also had incorrect usage
of the API (calling wl_display_dispatch_queue() on input on an unrelated
fd) as an example.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-01-16 16:37:36 +08:00
Jonas Ådahl
0edeeb9cd5 client: Correct documentation regarding thread safeness
The current documentation about wl_display_dispatch() states one may not
mix wl_display_dispatch(_queue)() with wl_display_prepare_read() and
friends, but this is a misconception about how
wl_display_dispatch(_queue)() works. The fact is that the dispatch
functions does the equivalent of what the preparation API does
internally, and it is safe to use together.

What is not safe is to dispatch using the wl_display_dispatch(_queue)()
functions while being prepared to read using wl_display_read_events().

This patch rewrites the documentation to correctly state when the
various API's are thread safe and how they may not be used.

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

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-01-16 16:37:36 +08:00
Carlos Garnacho
da7b248904 protocol: Add DnD actions
These 2 requests have been added:

- wl_data_source.set_actions: Notifies the compositor of the available
  actions on the data source.
- wl_data_offer.set_actions: Notifies the compositor of the available
  actions on the destination side, plus the preferred action.

Out of the data from these requests, the compositor can determine the action
both parts agree on (and let the user play a role through eg. keyboard
modifiers). The chosen option will be notified to both parties
through the following two requests:

- wl_data_source.action
- wl_data_offer.action

In addition, the destination side can peek the source side actions through
wl_data_offer.source_actions.

Compared to the XDND protocol, there's two notable changes:

- XDND lets the source suggest an action, whereas wl_data_device lets
  the destination prefer a given action. The difference is subtle here,
  it comes off as convenience because it is the drag destination which
  receives the motion events (unlike in X) and can perform action updates.

  The drag destination seems also in a better position to update the
  preferred action based on things like the data being transferred, the
  place being dropped, and whether the drag is client-local.

- That same source-side preferred action is used in XDND to convey the
  modifier-induced action to the drag destination, which would then ack
  it, or reply with another action that's accepted (or none), this makes
  the XdndPosition/XdndStatus messaging very verbose, and synchronous
  because the drag source always needs to know the latest status/action
  for every position+action sent.

  Here it's the compositor which takes care of modifiers and matching
  available/accepted actions, this allows for the signaling to happen
  only whenever the actions/modifiers change for real.

Roughly based on previous work by Giulio Camuffo <giuliocamuffo@gmail.com>

Changes since v10:
- Narrow down the situations where wl_data_source/offer.accept requests
  are supposed to happen.

Changes since v9:
- Deferred the protocol errors to .finish after some IRC chat with Jonas,
  added further errors if actions API is used on selection sources/offers.

Changes since v8:
- Defined further the expected behavior on "ask", described the protocol
  errors that may happen. Fix more spaces vs tabs issues.

Changes since v7:
- Misc changes after updating the progress notification patch.

Changes since v6:
- Further explanations on wl_data_source/offer.set_actions, including a
  description of "ask" actions. Added protocol errors for unknown action
  values.

Changes since v5:
- Applied rewording suggestions from Jonas Ådahl. Dropped slot reservation
  scheme for actions. Fixed indentation and other minor formatting issues.

Changes since v4:
- Minor rewording.

Changes since v3:
- Splitted from DnD progress notification changes.
- Further rationales in commit log.

Changes since v2:
- Renamed notify_actions to set_actions on both sides, seems more consistent
  with the rest of the protocol.
- Spelled out better which events may be triggered on the compositor side
  by the requests, the circumstances in which events are emitted, and
  what are events useful for in clients.
- Defined a minimal common ground wrt compositor-side action picking and
  keybindings.
- Acknowledge the possibility of compositor/toolkit defined actions, even
  though none are used at the moment.
Changes since v1:
- Added wl_data_offer.source_actions to let know of the actions offered
  by a data source.
- Renamed wl_data_source.finished to "drag_finished" for clarity
- Improved wording as suggested by Bryce

Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Reviewed-by: Michael Catanzaro <mcatanzaro@igalia.com>
Reviewed-by: Mike Blumenkrantz <zmike@samsung.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-01-16 16:34:52 +08:00
Carlos Garnacho
5c4272b8e9 protocol: Improve data source notification around DnD progress
Currently, there's no means for the DnD origin to know whether the
destination is actually finished with the DnD transaction, short of
finalizing it after the first transfer finishes, or leaking it forever.

But this poses other interoperation problems, drag destinations might
be requesting several mimetypes at once, might be just poking to find
out the most suitable format, might want to defer the action to a popup,
might be poking contents early before the selection was dropped...

In addition, data_source.cancelled is suitable for the situations where
the DnD operation fails (not on a drop target, no matching mimetypes,
etc..), but seems undocumented for that use (and unused in weston's DnD).

In order to improve the situation, the drag source should be notified
of all stages of DnD. In addition to documenting the "cancelled" event
for DnD purposes, The following 2 events have been added:

- wl_data_source.dnd_drop_performed: Happens when the operation has been
  physically finished (eg. the button is released), it could be the right
  place to reset the pointer cursor back and undo any other state resulting
  from the initial button press.
- wl_data_source.dnd_finished: Happens when the destination side destroys
  the wl_data_offer, at this point the source can just forget all data
  related to the DnD selection as well, plus optionally deleting the data
  on move operations.

Changes since v6:
  - Turned wl_data_offer.finish calls with 0/NULL state/mimetype an
    error, made it explicit that it will only result in
    wl_data_offer.dnd_finished being sent if successful.

Changes since v5:
  - Further rewording of wl_data_offer.finish and wl_data_offer.accept.
    Added error for untimely wl_data_offer.finish requests.

Changes since v4:
  - Applied rewording suggestions from Jonas Ådahl. Added new
    wl_data_offer.finish request to allow explicit finalization on the
    destination side.

Changes since v3:
  - Renamed dnd_performed to a more descriptive dnd_drop_performed,
    documented backwards compatible behavior on wl_data_offer.accept and
    wl_data_source.cancelled.

Changes since v2:
  - Minor rewording.

Changes since v1:
  - Renamed events to have a common "dnd" namespace. Made dnd_performed to
    happen invariably, data_device.cancelled may still happen afterwards.

Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Reviewed-by: Michael Catanzaro <mcatanzaro@igalia.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Mike Blumenkrantz <zmike@samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-01-16 16:34:52 +08:00
Derek Foreman
2b4c053924 server: Test for illegally low interface versions in wl_global_create()
Any version lower than 1 is unreasonable.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-01-14 13:12:32 -06:00
Derek Foreman
16b4cc6902 server: improve failure log message for wl_global_create()
The gratuitous %m jammed onto the end of the string prints errno
concatenated with the word "version".

I've removed the %m, and printed some additional information about the
failure.

Also, reversed the order of the expressions in the conditional to
make it match the english in the log message.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-01-14 13:12:18 -06:00
Peter Hutterer
c5356e9016 protocol: add wl_pointer.frame, axis_source, axis_stop, and axis_discrete
The frame event groups separate pointer events together. The primary use-case
for this at the moment is diagonal scrolling - a vertical/horizontal scroll
event can be grouped together to calculate the correct motion vector.
Frame events group all wl_pointer events. An example sequence of motion events
followed by a diagonal scroll followed by a button event is:
wl_pointer.motion
wl_pointer.frame
wl_pointer.motion
wl_pointer.frame
wl_pointer.axis
wl_pointer.axis
wl_pointer.frame
wl_pointer.button
wl_pointer.frame

In the future, other extensions may insert additional information about an
event into the frame. For example, an extension may add information about the
physical device that generated an event into the frame. For this reason,
enter/leave events are grouped by a frame event too.

The axis_source event determines how an axis event was generated. That enables
clients to judge when to use kinetic scrolling. Only one axis_source event is
allowed per frame and applies to all events in this frame.

The axis_stop event notifies a client about the termination of a scroll
sequence, likewise needed to calculate kinetic scrolling parameters.
Multiple axis_stop events within the same frame indicate that scrolling has
stopped in all these axis at the same time.

The axis_discrete event provides the wheel click count. Previously the axis
value was some hardcoded number (10), with the discrete steps this enables a
client to differ between line-based scrolling on a mouse wheel and smooth
scrolling with a touchpad. The axis_discrete event carries the axis
information and the discrete value and can occur at any time in the frame
provided it is ordered before the matching axis event. Specifically, this
sequence is valid:

wl_pointer.axis_source
wl_pointer.axis_discrete (vert)
wl_pointer.axis_discrete (horiz)
wl_pointer.axis (horiz)
wl_pointer.axis (vert)
wl_pointer.frame

Enter and leave event also trigger wl_pointer.frame events, where possible the
compositor should group leave and subsequent enter into the same frame. This
indicates to the client that the pointer has moved between surfaces and may
allow a client to shortcut code otherwise triggerd by the leave or enter
events.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Carlos Garnacho <carlosg@gnome.org>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-01-14 15:29:44 +08:00
Bryce Harrington
2b236af9b7 socket-test: Refactor if check into the assert
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2016-01-13 15:21:05 -08:00
Bryce Harrington
69a5a6d16c socket-test: Fix some comment typos
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2016-01-13 15:20:57 -08:00
Marek Chalupa
1b7191743e server: don't send an error to NULL display_resource
if display_resource = wl_resource_create() fails in bind_display(),
we call wl_client_post_no_memory() which is wrong, since this function
uses display_resource (which is NULL at this point).
said simply: don't send an error to resource that you've just failed to create)

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

Reported-by: Ashim <ashim.shah@samsung.com>
Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-01-13 15:11:00 -08:00
Victor Berger
693bf00083 client: Add missing arg in a wl_log invocation
Without this 'proxy' argument, the '%p' formatter prints a constant
garbage value.

Signed-off-by: Victor Berger <victor.berger@m4x.org>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
2016-01-13 14:47:32 -08:00
Jaeyoon Jung
0a37511ecc server: Calculate remaining data size after a closure is processed
When processing a closure, data in the connection can be consumed again
if the closure itself invokes extra event dispatch. In that case the
remaining data size is also altered, so the variable len should be
updated after the closure is processed.

Signed-off-by: Jaeyoon Jung <jaeyoon.jung@lge.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2016-01-12 10:45:33 -06:00
Jonas Ådahl
ee9b69cfe0 doc: Fix incorrect parameter name
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2016-01-12 12:13:12 +08:00
Jonas Ådahl
edbee66cbd doc: Fix function membership
Put the various misplaced functions in the right class; partly because
its where they belong, and partly to make intra-class \ref(erences)
happy.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2016-01-12 12:13:12 +08:00
Jonas Ådahl
2e7fb78682 Use zalloc instead of malloc + memset
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2016-01-12 12:13:12 +08:00
Jonas Ådahl
3de1783e50 scanner: Fail if 'since' is higher than the interface version
If an event or request have a "since" attribute that is larger than
the version of the interface it is in, fail with an explaining error
message.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2016-01-12 12:05:47 +08:00
Jonas Ådahl
2f666ee34f scanner: Add missing brackets
A statement was added at the same indentation level as the true branch
of the if statement, but since there were no brackets, it would be
executed independently of the result of the if condition.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2016-01-12 12:05:47 +08:00
Bryce Harrington
225830dcb8 server: Add a socket with an existing fd
This adds functionality to allow system-level control over handing out
file descriptors for sockets, to allow tighter security when running a
Wayland compositor under a Wayland session server.  Allows writing
socket activated Wayland servers.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Cc: Sung-Jin Park <sj76.park@samsung.com>
Cc: Sangjin Lee <lsj119@samsung.com>
2015-12-18 11:31:51 -08:00
Peter Hutterer
87321d0f2f protocol: specify behavior of get_pointer when capabilities change
Also applies to touch/keyboard

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2015-12-07 14:26:47 -08:00
Derek Foreman
3384f69ecf protocol: Add wl_surface.damage_buffer
wl_surface.damage uses surface local co-ordinates.

Buffer scale and buffer transforms came along, and EGL surfaces
have no understanding of them.

Theoretically, clients pass damage rectangles - in Y-inverted surface
co-ordinates) to EGLSwapBuffersWithDamage, and the EGL implementation
passed them on to wayland.  However, for this to work the EGL
implementation must be able to flip those rectangles into the space
the compositor is expecting, but it's unable to do so because it
doesn't know the height of the transformed buffer.

So, currently, EGLSwapBuffersWithDamage is unusable and EGLSwapBuffers
has to pass (0,0) - (INT32_MAX, INT32_MAX) damage to function.

wl_surface.damage_buffer allows damage to be registered on a surface
in buffer co-ordinates, avoiding this problem.

Credit where it's due, these ideas are not entirely my own:
Over a year ago the idea of changing damage co-ordinates to buffer
co-ordinates was suggested (by Jason Ekstrand), and it was at least
partially rejected and abandoned.  At the time it was also suggested
(by Pekka Paalanen) that adding a new wl_surface.damage_buffer request
was another option.

This will eventually resolve:
https://bugs.freedesktop.org/show_bug.cgi?id=78190
by making the problem irrelevant.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2015-12-03 09:19:08 -06:00
Marek Chalupa
389c84e248 server: remove redundant include
we don't use ffi in wayland-server.c

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2015-11-27 15:15:59 -06:00
Peter Hutterer
d5f22d29df protocol: fix a couple of whitespace issues
8 spaces is one tab

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-11-23 23:48:27 -08:00
Derek Foreman
a5ef9304fe protocol: Remove incorrect statement that attach must precede damage
The documentation for wl_surface.commit makes it clear that the
application of damage follows attach during the commit, so it
doesn't matter what order the app sends the requests.

Many existing apps post damage before attaching a buffer already,
and it's really quite reasonable to do so.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2015-11-20 10:25:33 -06:00
Pekka Paalanen
b644594a2c scanner: drop altmacro from dtddata.S
Stop using .altmacro in dtddata.S, because clang does not yet implement
it. Turns out that we do not actually seem to need it, and we can modify
the syntax to work without it.

Moving the double quotes from the binfile line to the .incbin line is
required to avoid the assembler error "missing string". Instead of & we
now use \() to mark the end of macro argument name.

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

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Tested-by: Víctor Jáquez <vjaquez@igalia.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-11-19 09:48:11 +02:00
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
Peter Hutterer
82a6fec962 doc: drop the default doxygen tags
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-06-18 15:43:58 +03:00
Peter Hutterer
356a48fcfb doc: move project-specific doxygen settings to the end of the doxygen file
Rather than having the settings hidden in the file somewhere move them to the
end so it's clear which settings we intentionally override.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-06-18 15:43:46 +03:00
Derek Foreman
bc3b66d5c1 build: Don't depend on libffi unless we're building libraries
When building just the scanner or docs it's not required.

This can reduce requirements for a host cross compiling wayland,
since only the scanner needs to be built natively.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-06-18 14:06:32 +03:00
Derek Foreman
0e979d82d2 build: Build a subset of libwayland_util when not building libraries
The scanner doesn't need anything but wayland-util.c/.h so we can
shrink wayland-util when not building the main libraries.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-06-18 14:06:24 +03:00
Derek Foreman
5cfdbef3d2 build: Allow disabling building of wayland libraries
When cross-compiling it may be useful to build only the wayland-scanner
natively.  This patch makes it possible to disable build of the libraries.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-06-18 14:06:16 +03:00
Derek Foreman
aeeca31696 build: Stop putting FFI_CFLAGS in AM_CFLAGS
AM_CFLAGS are the defaults passed to anything that doesn't specify its own
_CFLAGS, so instead of putting FFI_CFLAGS there, let's just add that to
anything that actually needs it.

The only thing that needs it but didn't have it specifically was
libwayland_util (for connection.c)

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-06-18 14:06:08 +03:00
Derek Foreman
e06f88cf91 build: Move AM_CFLAGS and AM_CPPFLAGS to the top of Makefile.am
AM_CFLAGS and AM_CPPFLAGS aren't positional, so putting them at a
random place in Makefile.am can be misleading.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-06-18 14:05:24 +03:00
Bryce Harrington
1faeb7ff48 xcursor: Change keithp licensed code from X11 to Expat license
The license text for this file mentions Keith Packard specifically,
however it is otherwise identical to all the other MIT X11 licensed code
in Wayland, and so can be changed to the substantially identical MIT
Expat license.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Keith Packard <keithp@keithp.com>
2015-06-12 15:51:38 -07:00
Bryce Harrington
c78a0a62c6 cursor-data.h: Change SuSE licensed code from X11 to Expat
The license text for this file mentions SuSE specifically, however it is
otherwise identical to all the other MIT X11 licensed code in Wayland,
and so can be changed to the substantially identical MIT Expat license.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Keith Packard <keithp@keithp.com>
2015-06-12 15:51:38 -07:00
Bryce Harrington
3540ea2b9f cursor: Update boilerplate from MIT X11 license to MIT Expat license
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-06-12 15:51:38 -07:00
Bryce Harrington
541b0cf24e protocol: Update boilerplate from MIT X11 license to MIT Expat license
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-06-12 15:51:38 -07:00
Bryce Harrington
68402a53dc wayland-server: Fix style on multi-line comment
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2015-06-12 15:35:13 -07:00
Bryce Harrington
3c91b0878d src: Update boilerplate from MIT X11 license to MIT Expat license
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-06-12 15:31:24 -07:00
Bryce Harrington
d21ba735ee test-runner: Add copyright boilerplate for .h, same as the .c
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-06-12 15:31:24 -07:00
Bryce Harrington
724b6e4ebe socket-test: Fix style on multi-line comment
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-06-12 15:31:24 -07:00
Bryce Harrington
773babedfc tests: Update boilerplate from MIT X11 license to MIT Expat license
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-06-12 15:31:24 -07:00
Bryce Harrington
2e6e0fc811 Contributing: Specify use of MIT Expat for new code files
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-06-12 15:31:23 -07:00
Bryce Harrington
c4bad43425 COPYING: Update to MIT Expat License rather than MIT X License
MIT has released software under several slightly different licenses,
including the old 'X11 License' or 'MIT License'.  Some code under this
license was in fact included in X.org's Xserver in the past.  However,
X.org now prefers the MIT Expat License as the standard (which,
confusingly, is also referred to as the 'MIT License').  See
http://cgit.freedesktop.org/xorg/xserver/tree/COPYING

When Wayland started, it was Kristian Høgsberg's intent to license it
compatibly with X.org.  "I wanted Wayland to be usable (license-wise)
whereever X was usable."  But, the text of the older X11 License was
taken for Wayland, rather than X11's current standard.  This patch
corrects this by swapping in the intended text.

In practical terms, the most notable change is the dropping of the
no-advertising clause.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-06-12 15:31:21 -07:00
Derek Foreman
56a5a890b5 docs: remove and ignore doc/doxygen_sqlite3.db
Some newer versions of doxygen are generating this file now, and if
we don't clean it up distcheck will fail.

Known to affect doxygen 1.8.8 from debian jessie.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jon A. Cruz <jonc@osg.samsung.com>
Tested-by: Jon A. Cruz <jonc@osg.samsung.com>
2015-06-04 17:21:25 -07:00
Bryce Harrington
baed4b0a2f configure.ac: bump version to 1.8.90
Master is open for new features again

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2015-06-03 00:12:49 -07:00
Bryce Harrington
60024af597 configure.ac: bump to version 1.8.0 for the official release 2015-06-02 16:06:02 -07:00
Giulio Camuffo
f0be757bfa scanner: don't emit the extern declarations for external types
We were emitting the extern declarations of all types used in the protocol,
even if not defined in it. This caused warnings to be produced when using
the -Wredundant-decls compiler flag when building an extension that uses
e.g. wl_surface. However we only need the extern declarations if the
protocol defines a factory for those external interfaces. That is a
bad design and can be however done by including the dependent protocol
header first.
So only emit the extern declarations for the types that the protocol
actually defines, this restoring the behavior we were using in 1.7.

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

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Tested-by: Arnaud Vrac <rawoul@gmail.com>
2015-06-01 11:47:39 +03:00
Bryce Harrington
c19d5e1867 publish-doc: Add script for publishing docs to the website
Adapted from same-named script from libinput.
2015-05-27 15:34:20 -07:00
Bryce Harrington
6ffd998a98 configure.ac: bump to version 1.7.93 for the RC2 release 2015-05-26 19:10:15 -07:00
Bryce Harrington
8e8699789c gitignore: Bulk ignore all *-test files 2015-05-26 19:01:00 -07:00
Bryce Harrington
5339e21f65 gitignore: ignore recently added headers-test 2015-05-26 18:59:25 -07:00
Giulio Camuffo
1fab2e7ba9 tests: add an headers test
This test checks that the protocol and library headers include only what
they are supposed to include. That is, that the core headers do not
include the protocol headers and that the core protocol headers do not
include the non core library headers.
The build process now generates core protocol headers, but they are only
used in the test and don't get installed.

Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-05-21 16:00:31 -07:00
Bryce Harrington
12cab2c4df configure.ac: bump to version 1.7.92 for the RC1 release 2015-05-15 17:53:29 -07:00
Michael Vetter
b409c919a2 remove trailing whitespaces
Remove trailing whitespaces because they are not needed and jumping to
the end of al ine should do just that and not jump to the whitespace.
2015-05-15 13:10:15 -07:00
Pekka Paalanen
d08c079739 scanner: simplify the getopt logic
Use the same retvals for both short and long options.

Whitespace fixes.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-05-08 14:21:55 -07:00
Bryce Harrington
8877a349e7 configure.ac: bump to version 1.7.91 for the alpha release 2015-05-06 18:59:59 -07:00
Giulio Camuffo
e799b1fa9c scanner: add a new --include-core-only option
When using this new option the generated code will include the new
core headers instead of the old ones. The default needs to remain
unchanged for backward compatibility with old code.
With this change the generated headers will now forward declare all
types and interfaces it uses; that is needed when generating headers
for a my-extension.xml with --include-core-only, since it may use
types defined in wayland.xml.
The same is done also without --include-core-only, since it is an
harmless change.
getopt_long() is used for the option handling.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-04-30 15:18:45 +03:00
Giulio Camuffo
ea73cb00bc wayland-egl: add a core header
The new core header doesn't include any other header, since it really
is not needed.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-04-30 14:30:08 +03:00
Giulio Camuffo
d74a9c079b introduce new headers wayland-client-core.h and wayland-server-core.h
wayland-client.h and wayland-server.h include the protocol headers generated
at build time. This means that a libwayland user cannot generate and use
protocol code created from a wayland.xml newer than the installed libwayland,
because it is not possible to only include the API header.

Another use case is language bindings, which would generate their own protocol
code and which only need to use the library ABI, not the generated C code.

This commit adds wayland-client-core.h and wayland-server-core.h which do not
include the protocol headers or any deprecated code.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-04-30 14:11:25 +03:00
Bryce Harrington
70d3c0fe8a tests: Typo in a comment
(Spotted by Silvan)

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2015-04-15 15:07:54 -07:00
Jonas Ådahl
0583ce741e scanner: Fail on empty enumerations
Without this patch, the scanner would generate invalid C which wouldn't
compile anyway, so lets be nice and fail earlier and point out where the
error is.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: David Fort <contact@hardening-consulting.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-04-08 17:38:10 +08:00
Bill Spitzak
313b26f415 config: use simpler regexp syntax to get dot version
I wasted a lot of time before I figured out that I needed to add those
square brackets to get this to work. Sigh...
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-04-07 15:48:25 -07:00
Marek Chalupa
c45be3d21e protocol: add better description of wl_pointer.release
Add note about what all wl_pointer.release does. Mainly that
it destroys the proxy object, so programmer must not call
wl_pointer_destroy() on the pointer any further.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-03-30 14:23:18 +03:00
Jussi Pakkanen
2d46da10d8 Add support for direct file reading and writing in wayland-scanner.
Add support for direct file reading and writing in wayland-scanner.

Signed-off-by: Jussi Pakkanen <jpakkane@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: David Fort <rdp.effort@gmail.com>
2015-03-27 15:02:38 +02:00
Bryce Harrington
439b0a3863 Spelling fixes (cosmetic)
A few typos in comments and protocol docs, no code changes.

./src/wayland-util.h:281: recieved  ==> received
./src/wayland-client.c:115: occured  ==> occurred
./src/wayland-client.c:156: occured  ==> occurred
./tests/test-compositor.c:76: parallely  ==> parallelly
./tests/test-compositor.c:474: recieve  ==> receive
./protocol/wayland.xml:1767: layed  ==> laid
./protocol/wayland.xml:2112: dependant  ==> dependent
./doc/publican/sources/Client.xml:25: recieved  ==> received

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Bill Spitzak <spitzak@gmail.com>
2015-03-19 16:56:17 +02:00
Marek Chalupa
e16ee74e47 server: give more precise error message
There are two same error messages with different cause.
Let user know what is the cause of the error.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-03-19 16:11:21 +02:00
Emmanuel Gil Peyrot
c770b84658 cursor: free the array from which images are linked 2015-03-18 16:01:19 -07:00
Bryce Harrington
be47969a38 client: Fix typo
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-03-18 16:32:20 +02:00
Derek Foreman
4908bf0d0f cursor: add wl_cursor_frame_and_duration
It's useful to know how long the current cursor frame should be displayed
so we can wait that long to change it.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-03-05 09:39:44 +02:00
Jonas Ådahl
8b2fbf8722 protocol: Change wording of subsurface placement scheduling
Change wording to be more consistent with other parts of the subsurface
protocol. Before this change, wl_subsurface.set_position explicitly
stated that the new state was to be applied on the parents
wl_surface.commit and wl_subsurface.place_above/below only said "on
the next commit of the parent surface". What "committed" means is
ambiguous considering that a wl_surface.commit actually defers the
actual commit when in synchronized mode, but the intention has always
been that placement of a subsurface should be considered part of its
content, i.e. placement state should be applied when other state
(buffer, regions). This patch makes that more clear.

Note that prior to this patch, one could correctly have interpreted
the protocol meaning that placements operations takes effect explicitly
on wl_surface.commit of the parent surface no matter whether other state
of the parent surface is applied at that point. This patch clarifies that
that is not the case.

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

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Acked-by: Jasper St. Pierre <jstpierre@mecheye.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-03-04 15:47:48 +08:00
Hardening
99d2775ae9 wayland.xml: fixed a typo 2015-02-25 12:38:26 -08:00
Bryce Harrington
f3a5ca999e configure.ac: bump version to 1.7.90
Master is open for new features again

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2015-02-17 18:34:33 -08:00
Bryce Harrington
8e9d5a1084 configure.ac: bump to version 1.7.0 for release 2015-02-13 19:17:56 -08:00
Bryce Harrington
52d971c924 configure.ac: bump to version 1.6.93 for rc2 release 2015-02-06 17:56:44 -08:00
Bill Spitzak
371a9e0aef configure.ac: Fallback to older detection code if pkg-config can't find expat
This paritally reverts commit a4afd90f9f.

On older expat versions (ie the one on Ubuntu 12.04) there is no pkg-config
file, so fall back to a test for the header and library. In addition the
source for expat does not seem to be in a git repository but in cvs instead
and it seems preferrable to not require cvs to build wayland.

The restored test has been updated to use AC_SEARCH_LIBS. This version
uses empty square brackets for the unused branches, similar to many other
if statements in configure.ac.
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Andrew Oakley <aoakley@espial.com>
2015-02-06 15:52:50 -08:00
Bryce Harrington
76fe89ed53 tests: Fix FAIL in sanity-test (*timeout*) when Yama LSM enabled
This fixes a regression in the testsuite since c3653f7f, where four of
the timeout tests fail with "Timeouts suppressed" messages.

The timeouts are being suppressed because the testsuite is erroneously
detecting that a debugger is attached.  This detection mechanism
(adopted from libinput) uses ptrace to test if there is a debugger
parent process that can be attached.  Unfortunately, this is an
unreliable test: Kernel security policies exist to restrict the scope of
ptrace to prevent processes from snooping on one another.[1] This
security policy is set as the default on Ubuntu, and potentially other
Linux distributions.[2]

The Yama documentation suggests, "For software that has defined
application-specific relationships between a debugging process and its
inferior (crash handlers, etc), prctl(PR_SET_PTRACER, pid, ...) can be
used.  An inferior can declare which other process (and its descendents)
are allowed to call PTRACE_ATTACH against it."  This prctl call has no
effect if Yama LSM is not loaded.

The child needs to be synchronized to the client to prevent a race
condition where the child might try to operate before the parent has
finished its prctl call.  This synchronization is done via pipes.

This patch can be tested by running sanity-test with
/proc/sys/kernel/yama/ptrace_scope set to 0 or 1; the test must pass for
either value.

1: http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=2d514487faf188938a4ee4fb3464eeecfbdcf8eb
2: https://wiki.ubuntu.com/SecurityTeam/Roadmap/KernelHardening#ptrace_Protection

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>

v4: Allow parent to communicate error state to child to prevent leaving
child in zombie state if parent hits an error.

v5: Check errno instead of rc for error.  Don't waitpid on ppid.
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2015-02-06 14:39:36 -08:00
Bryce Harrington
310fea467c doc: Fill in high level description for Surfaces
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Jon A. Cruz <jonc@osg.samsung.com>
2015-02-04 21:49:30 -08:00
Marek Chalupa
8094426a41 test-runner: wait for concrete pid
After running a test in fork, we were waiting for any child to terminate.
It is OK unless the child forks again. If the child calls fork, the waitid can
catch the child's child termination, stop block and run another test
while the former test is still running. This is racy i. e. when adding socket.
Since we have test compositor which uses fork, this situation can occur
pretty frequently.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2015-02-04 19:43:08 -08:00
Bryce Harrington
48bf640d16 configure.ac: re-bump version to 1.6.92 for rc1 release 2015-01-30 19:08:22 -08:00
Jon Cruz
23a57b69ff doc: Fix out-of-tree build and also distcheck
Corrects an issue that would cause out-of-tree builds to fail and also
a few items that would cause distcheck to fail.

Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-01-30 18:58:08 -08:00
Bryce Harrington
768724495e configure.ac: bump version to 1.6.92 for rc1 release 2015-01-30 14:57:53 -08:00
Bryce Harrington
ccb17a05a3 gitignore: Add the new cpp-compile-test 2015-01-29 17:25:16 -08:00
Bill Spitzak
6be2d9aaef doc: Intro text for doxygen output in it's own file
(This patch has been modified to apply atop current master)

This makes it considerably easier to edit the text and make it different
for each library.

To address previous concerns with this patch, I wrote some more complete
introductory text. This is based on my understanding of these libraries, which
may not be correct, and is pretty rudimentary for libwayland-server!

However this intro text demonstrates how to create links to the
doxygen-generated text. It looks like you cannot link to methods easily as the
link name contains a hash number, but links to objects and classes work.
Reviewed-by: Jon A. Cruz <jonc@osg.samsung.com>
Tested-by: Jon A. Cruz <jonc@osg.samsung.com>
2015-01-29 17:13:01 -08:00
Andrew Oakley
a4afd90f9f configure.ac: use pkg-config to find expat
This is now done in the same way as the libffi dependency and still
allows the library to be installed in a non-standard location (with
PKG_CONFIG_PATH).
2015-01-28 21:29:10 -08:00
Rui Matos
cd0cf5a106 doc/publican/Makefile.am: Add a missing order-only prerequisite
Otherwise a parallel make invocation could fail due to the directory
not existing.

Signed-off-by: Rui Matos <tiagomatos@gmail.com>
Reviewed-by: Jon A. Cruz <jonc@osg.samsung.com>
2015-01-28 18:44:46 -08:00
Derek Foreman
5ec8062df2 event-loop: Dispatch idle callbacks twice
To fix a shutdown crash in weston's x11 compositor I want to move the
weston X window close to an idle handler.

Since idle handlers are processed at the start of an event loop, the
handler that deals with window close will run at the start of the
next input_loop dispatch, after which the dispatcher blocks on epoll
forever (since all input events that will ever occur have been consumed).

Dispatching idle callbacks both at the start and end of event-loop
processing will prevent this permanent blocking.

Note that just moving the callback dispatch could theoretically
result in an idle callback being delayed indefinitely while waiting
for epoll_wait() to complete.

Callbacks are removed from the list when they're run, so the second
dispatch won't result in any extra calls.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-01-28 18:12:31 -08:00
Jon Cruz
7575e2ea19 doc: update diagrams for compatibility.
Change attribute separators for compatiblity with graphviz older than 2.30.

Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
2015-01-28 17:43:19 -08:00
Jon Cruz
8cf9a367c9 doc: Create hot-linked areas in documents.
Added xslt processing to give DocBook output diagram image maps/hot-linked
areas consistent with those automatically generated by Doxygen.

Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
2015-01-28 17:43:18 -08:00
Jon Cruz
b5fca036cc doc: Switch from static image files to generated diagrams.
Switches diagrams from using static PNG images to instead generate them via
simple graphviz DOT markup files.

Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
2015-01-28 17:43:16 -08:00
Marek Chalupa
f858550cf4 display-test: disable leak check in tests that use pthread
pthread is leaking and it makes our tests fail.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2015-01-28 17:17:24 +00:00
Marek Chalupa
68c11c48c0 tests: add possibility to disable leak check for single test
In tests that are using external libraries (i. e. pthread) we
can get failure because of leaks in the external library.
Until we have some better solution (if ever), let these (and only these)
tests to disable leak checks.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2015-01-28 17:17:22 +00:00
Marek Chalupa
5c70c03190 client: unref or destroy proxy when releasing queue
When we release event queue with queued events, we can leak
proxies in some cases.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2015-01-28 17:17:19 +00:00
Marek Chalupa
73cb90763c client: release display queue in wl_display_disconnect()
Don't leak events, not even on exit

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2015-01-28 17:17:16 +00:00
Marek Chalupa
2e20270280 connection-test: add tests for closure leaks
When we destroy closure, we are leaking memory sometimes.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2015-01-28 17:17:13 +00:00
Marek Chalupa
d1855797d3 tests: add tests for leak check in clients
Sanity tests for leak checks in clients of test compositor
and also check if the test-compositor itself is not leaking
anything.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2015-01-28 17:17:09 +00:00
Marek Chalupa
9ef0277571 test-compositor: extend leak checks into clients
Run leak checks also on clients of test-compositor.

Checking leaks in memory is the same as in normal TEST.

Checking file descriptor leaks is slightly more complex, as we pass an
open file descriptor in the WAYLAND_SOCKET environment variable, which
will be consumed by a client calling wl_display_connect(), but otherwise
remain unused. We manage this accounting by checking if the environment
variable has been unset by wl_display_connect() as it consumes the
socket.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>

[daniels: squashed counter-proposal patch to simplify fd leak checking,
          plus Bill's counter-counter-proposal, and reworded log.]
2015-01-28 17:17:06 +00:00
Marek Chalupa
d8e72f98f2 test-runner: move leak checking into function
1) now we can use it in the test-compositor
2) it looks better

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2015-01-28 17:15:57 +00:00
Mariusz Ceier
6197f32cad scanner: Fix header generation for server protocols
Server protocols headers should include wayland-server.h,
instead of wayland-util.h. Otherwise they're not useable
with C++ compiler unless wayland-server.h was included
earlier.

Signed-off-by: Mariusz Ceier <mceier+wayland@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2015-01-27 11:18:36 +00:00
Mariusz Ceier
e3dc9a7af6 tests: C++ compilation test
This test includes one of wayland headers, which produced
error with C++ compiler. C compiler can't be used for this test,
because it issues only a warning[1] and only when wayland headers
are not installed in system headers path (/usr/include).

[1] wayland-server-protocol.h:201:2: warning: implicit declaration of function ‘wl_resource_post_event’

[daniels: Merged in Marek's follow-up to check for a C++ compiler.]

Signed-off-by: Mariusz Ceier <mceier+wayland@gmail.com>
Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2015-01-27 11:17:42 +00:00
Bryce Harrington
9386e2be27 tests: Correct return code handling
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2015-01-26 18:11:40 -08:00
Bryce Harrington
2eeb2cbc52 tests: Fix typo "evnironment"
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
2015-01-26 18:11:11 -08:00
Bill Spitzak
284da98a3c doc: Put a dash between type/enum value and description
This was suggested by Derek Foreman, I think it looks better

Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-01-26 17:55:00 -08:00
Bill Spitzak
ed57d6d438 doc: Add macros and typedefs to the documentation
If somebody bothered to put a doxygen comment in for a macro or
typedef, make it appear in the pages. This produces documentation
for wl_container_of and wl_dispatcher_func_t from the _8h files.

Reviewed-by: "Jon A. Cruz" <jonc@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-01-26 17:54:59 -08:00
Bill Spitzak
5409187ed0 doc: there is no need to move the _8h files
The current xslt skips all the data that is in them, so it is ok
if they are included.

Reviewed-by: "Jon A. Cruz" <jonc@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-01-26 17:54:54 -08:00
Bryce Harrington
71c37eb91a cosmetic: Cleanup trailing whitespace 2015-01-26 11:30:57 -08:00
Derek Foreman
a1a6aa54aa cosmetic: Move the deprecated functions back to the end of the file
There are functions below the "Deprecated functions below" comment
that are not deprecated.

Move the deprecated functions back down, and add a comment at the
end of the file to try to keep this from happening again.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
2015-01-26 11:29:03 -08:00
Bill Spitzak
6750538455 doc: remove redundant subtitles
Put the argument lists next to the event/message title, which I
think makes it a lot easier to understand, and remove redundant
"values" title from enumerations.

Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-01-23 18:45:03 -08:00
Bill Spitzak
d90fd15ee4 doc: Add object types and links to arguments int protocol documentation
This makes it a lot easier to figure out what is going on!

Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-01-23 18:45:02 -08:00
Bill Spitzak
be8064d2d4 doc: compress the lists in the protocol docs some
Use simpara to remove the blank lines, and put the type/value and
the comment into the same line.

Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-01-23 18:45:01 -08:00
Bill Spitzak
1f39fbf8d2 doc: made functions taking wl_event_queue arg belong to wl_event_queue
The fact that these functions take both a display and queue argument is
I think historical, and they really are methods on the queue.

Also added some docs for wl_display_prepare_read_queue.

Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-01-23 18:44:57 -08:00
Bill Spitzak
d3770c0661 doc: Remove wl_map from documentation
This object is only in wayland-private.h so it's methods should not
be in the documentation.

Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-01-23 18:44:56 -08:00
Bill Spitzak
074e120cb3 doc: Remove deprecated functions from documentation
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-01-23 18:44:55 -08:00
Bill Spitzak
594ec7e689 doc: add missing \memberof to wl_display_get_protocol_error
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-01-23 18:44:54 -08:00
Jonas Ådahl
ab3ee6f6d9 server: Use existing id variable when inserting created object
We already have the id variable there and it makes it slightly easier to
read.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-01-23 18:20:41 -08:00
Jonas Ådahl
5ce947bd90 protocol: Clarify selection data offer destruction requirement
Clarify that a client receiving a wl_data_device.selection event must
destroy the data_offer of the previous wl_data_device.selection event,
if any.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2015-01-23 18:20:35 -08:00
Jonas Ådahl
434d797d27 protocol: Fix typo in wl_data_offer
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2015-01-23 18:20:29 -08:00
Bryce Harrington
b7f9925abc configure.ac: bump version to 1.6.91 for the alpha release 2015-01-17 03:39:05 -08:00
Bill Spitzak
2888e97d5d doc: make itemized lists from doxygen work
Not actually used currently but probably a good idea.

Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-12-19 16:33:34 +02:00
Bill Spitzak
0d0a62c79a doc: Document structures and unions in addition to classes
This provides targets for some of the doxygen links, and some of
them have useful memberof function lists.

Added some if/else statements to reduce validation errors.

Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-12-19 16:27:51 +02:00
Bill Spitzak
f980a60038 doc: Each class in doxygen output is a section
All the methods belonging to the class are listed with it, making
it much easier to find them.

I dumped all other functions into a section called "Functions" at
the end.

Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-12-19 16:21:36 +02:00
Bill Spitzak
4abe5edf46 doc: removed the word "interface" from the link names
Just to make it slightly shorter.

Also add a dash to the doxygen links to make them look a bit more alike.

Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-12-19 16:15:29 +02:00
Bill Spitzak
dfc64f9ffe doc: Reduce the validation errors of the docbook input
(this is different from previous version as it removes some
broken and irrelevant changes to the protocol appendix).

This removes all the validation errors except for missing link
targets. You can test this by removing the --skip-validation
from doc/publican/Makefile.am.

Main changes are to avoid nesting <para> commands. I also used
<simpara> in some places to reduce the amount of blank space.
And the reference id's are prefixed with the chapter name to
avoid collisions between libclient and libserver.

PS: it would be useful if somebody who actually knows something
about xslt would come up with a way to translate a block of text
makde of <para> commands unchanged, but add <para> around plain
text. Most of the difficulty is that doxygen's output is rather
inconsistent here.

Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-12-19 16:10:36 +02:00
Bill Spitzak
75ec915da8 fixup doc: Make it easier to add a new doxygen page
This supersedes the previous one and fixes a typo where a slash was missing.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-12-18 15:23:03 +02:00
Bill Spitzak
6e3ad249ad doc: Make it easier to add a new doxygen page
The repetitive parts of generating the server and client documentation are
merged, so it is easier to add another doxygen chapter: add a new line to
$publican_sources in publican/Makefile.am, and a list of C source files to
doxygen/Makefile.am.

Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2014-12-18 15:13:39 +02:00
Bill Spitzak
3f05c4ac4a doc: fix for parallel make
Move the *_8h.xml files to a per-chapter temporary file so two
chapters can be converted from doxygen at the same time. Tested
with make -j 9.

Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2014-12-18 15:07:22 +02:00
Bill Spitzak
c985a17988 doc: Split libwayland-client and -server into different pages
This was suggested before to make it clearer that things like wl_display
are different objects in each of them. I made these into two appendixes
because the protocol spec was already an appendix.

Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
[Bryce requested minor changes, not yet here.]

Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-12-16 17:07:25 +02:00
Bill Spitzak
0b788154da doc: fix doxygen->man command line
It was telling it to scan the doxyfile as well as the C source, and
listing some source files more than once.

Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-12-16 17:05:23 +02:00
Jon A. Cruz
163ce87cd7 doc: Minor makefile cleanup.
Split out directory creation to leverage order only prerequisites.

Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-12-16 16:52:12 +02:00
Jon A. Cruz
dec30252b0 doc: General makefile cleanup.
This is a general cleanup of the makefile in order to bring it more inline
with standard make practices. Cleanups included more use of automatic
variables, switching AM_V_GEN to AM_V_at to have one 'GEN' visible per file,
splitting copy operations to proper rules, and using order only dependencies
to properly create directories on-demand.

Changes also correct missing use of $(builddir) that has gone unnoticed as
it defaults to the current directory ('.').

Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-12-16 16:48:32 +02:00
Marek Chalupa
434fd45e4b client: update documentation about threading
Remove out-dated documentation and add few more words
about this topic.

v2. replace a paragraph by better explanation from Pekka Paalanen
    fix other notes from reviewing

v3. fix typo

v4. fix flags for poll in an example

    add wl_display_cancel_read() to another example
    (so that user sees that it should be used)

    move proper use of wl_display_prepare_read
    before the explanation why it is wrong to use
    wl_display_displach

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2014-12-09 18:05:04 +02:00
Marek Chalupa
77939736fb client: update obsolete comments
1) there is nothing like main thread since
   3c7e8bfbb4 anymore, so remove
   it from documentation and update the doc accordingly.

2) use calling 'default queue' instead of 'main queue'. In the code
   we use display->default_queue, so it'll be easier the understand.

3) update some obsolete or unprecise pieces of documentation

v2. Not only remove out-of-date comment, but fix/remove more
    things across the wayland-client.[ch]

v3. fixes (rephrasing unclear paragraphs etc.)
    according to Pakka Paalanen notes (thanks)

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2014-12-09 18:03:35 +02:00
Jon A. Cruz
480b437cd8 doc: Add config check for doxygen 1.6.0+.
Add a config time check for a new enough (1.6.0+) version of doxygen.

v2. require 1.6.0+ instead of 1.8.0+

Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-12-08 10:07:35 +02:00
Bill Spitzak
9ca542db4e doc: Remove duplicated descriptions of wayland objects
This text is a duplicate of the text in the protocol documentation, but
the converter mangled it by removing the paragraph breaks and some other
errors. Instead replace it with a list of links to the protocol docs.

Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-05 16:58:28 +02:00
Bill Spitzak
0093164f85 doc: removed redundant dependency
The .tmp file dependency depends on the index.xml file so it does not need to
be repeated.

Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-05 16:56:39 +02:00
Jon A. Cruz
962de0d0cc doc: Invoke doxygen via the defined make variable.
Invoke doxygen via the autoconf-defined make variable instead of directly.
This brings it in line with standard makefile practices.

Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-05 16:16:05 +02:00
Jon A. Cruz
8cda738a68 doc: Removed redundant xslt output elements.
Removed <xsl:output> elements that were duplicated but with attributes in
a different order. Standard tools are required to ignore the order of
attributes in an element.

Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-01 15:21:25 +02:00
Marek Chalupa
e118c11178 tests: fix memory leak
We didn't free the struct client that we got from client_connect()

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-12-01 12:34:23 +02:00
Marek Chalupa
fdb519be08 tests: split queue-test testcases
All the test-cases are in one test atm. It doesn't matter for the
outcome, but when it is split to more tests, the debugging and reading
the output is simpler.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-12-01 12:04:18 +02:00
Marek Chalupa
c3653f7f61 tests: detect if debugger is attached
Copy function from libinput/test/litest.c is_debugger_detached()
and use it in our test-runner. If debugger is attached, turn off
leak checks and timeouts automatically.

Revision of libinput: 028513a0a723e97941c39c4aeb17433198723913

v2. rebased to master

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-12-01 11:49:45 +02:00
Marek Chalupa
0e1cc7aba7 tests: use color when printing on terminal
Colorize output of the tests when prinitng on terminal.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-11-28 15:50:51 +02:00
Marek Chalupa
57050589b6 test-runner: print separator line after each test-case
Who can read the output when it is a single piece of text?

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
2014-11-28 14:04:13 +02:00
Marek Chalupa
bef2948348 tests: rename env vars for tests
Rename WAYLAND_TESTS_NO_TIMEOUTS to WAYLAND_TEST_NO_TIMEOUTS.
Further rename NO_ASSERT_LEAK_CHECK to WAYLAND_TEST_NO_LEAK_CHECK.
Now the naming is consistent not only here, in Wayland, but even with
naming of weston env varibles related to testing.

This is version 2 of the patch. The first version just renamed
NO_ASSERT_LEAK_CHECK to WAYLAND_TEST_NO_LEAK_CHECK.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Bryce Harrington <b.harrington@samsung.com>
2014-11-28 13:27:34 +02:00
Seedo Eldho Paul
93e352d058 scanner.c: Use WL_PRINTF instead of __attribute__((format(printf)))
Signed-off-by: Seedo Eldho Paul <seedoeldhopaul@gmail.com>
2014-11-28 12:37:20 +02:00
Derek Foreman
e36d0233ee doc: fixed grammar and a typo
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
2014-11-27 16:00:16 +02:00
Bill Spitzak
266b7f06be doc: Removed extra indentation from wl_list code sample
This is a minor documentation fix. I did not see any asterisks in the
output as reported by Pekka Paalanen. Using doxygen 1.7.6.1.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-11-26 13:34:26 +02:00
Bill Spitzak
dfdb087826 doc: Removed \ref when it refers to the subject the text is attached to
This does not make a difference to doxygen output but may help other
document generators not make redundant links.

Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
2014-11-25 16:38:59 +02:00
Bill Spitzak
f73f76775f doc: fixed a typo
Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
2014-11-25 16:38:11 +02:00
Bill Spitzak
5e79171cf1 v4 doc: fixed reference to non-existent function
(Fixed to remove accidental commit of another change)

After some feedback from Marek Chalupa I decided to just remove this. There
were suggestions about warning about multiple threads but it appears this
would be true for many of these functions and thus it would be misleading to
mention multiple threads only here (as it would imply that multiple threads
work for other functions which is not true, I think).

Acked-by: Marek Chalupa <mchqwerty@gmail.com>
2014-11-25 16:36:57 +02:00
Bill Spitzak
40aa80a408 doc: Added \code tags around sample code in doxygen comments
Also removed \comment and used C++ comments. There does not appear
to be any other way to put comments into code samples.

Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
2014-11-25 16:27:57 +02:00
Bill Spitzak
dd534a1fde doc: removed some unnecessary nested listing from doxygen output
This makes the lists of parameters slightly smaller and removes some
bullets from see-also and since.
2014-11-25 16:25:22 +02:00
Bill Spitzak
f2974c1115 doc: Don't print dash if doxygen brief description missing 2014-11-25 16:21:39 +02:00
Bill Spitzak
ba8ea938d2 doc: preserve links produced by Doxygen
These links are pretty useful for navigation, though sometimes excessive
(you can turn them off by putting % before the word in the comment).

I had to turn off validation because it failed on missing and duplicate
target id's, which this produces.
2014-11-25 16:14:51 +02:00
Bill Spitzak
c532b571e3 doc: Preserve spaces
Slight variation on Pekka's patch. It seems harmless to put this anywhere.
2014-11-25 16:04:42 +02:00
Bill Spitzak
d8f045ec1f doc: make rebuilds doxygen output on code changes
Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
2014-11-25 15:45:03 +02:00
Imran Zaman
11560a8d15 server: increase listen queue to 128
This will allow more than 1 simultaneous client connections to the server
without the possibility of connection refused error.

Signed-off-by: Imran Zaman <imran.zaman@gmail.com>

http://utcc.utoronto.ca/~cks/space/blog/unix/ListenBacklogMeaning
http://stackoverflow.com/questions/19221105/connect-with-unix-domain-socket-and-full-backlog
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-11-24 16:32:35 +02:00
Marek Chalupa
59f255d66e client: read_events should return -1 after an error
When a thread is sleeping, waiting until another thread read
from the display, it always returns 0. Even when an error
occured. In documentation stands:

  "return 0 on success or -1 on error.  In case of error errno will
   be set accordingly"

So this is a fix for this.

Along with the read_events, fix a test so that it now complies
with this behaviour (and we have this tested)

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-11-21 13:59:42 +02:00
Olivier Blin
059220549c gitignore: adpat to scanner and protocol path changes
Since commit 4c163b9b00, wayland-scanner
is built in top builddir instead of src, and protocol files are
generated in protocol subdir instead of src.
Protocol files generated in the new path are already properly ignored
in the toplevel gitignore file.

Signed-off-by: Olivier Blin <olivier.blin@softathome.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-11-19 16:35:49 +02:00
Marek Chalupa
4d617b83a7 tests: don't print '\0' character
print "" (which results in no output) instead of
printing '\0' (which is not visible, but is there)

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
2014-11-19 13:51:44 +02:00
Marek Chalupa
cf11e9dfbe queue-test: put back timeout
In 93e654061b we removed call to alarm() that served as timeout in this test.
Now when we have test_set_timeout() func, return the timeout back.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
2014-11-17 16:59:50 +02:00
Marek Chalupa
bbbdff88b1 tests: use test_set_timeout in display-test
replace call to alarm() with test_set_timeout()

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Acked-by: Giulio Camuffo <giuliocamuffo@gmail.com>
2014-11-17 16:58:31 +02:00
Marek Chalupa
1d2ef9ee08 tests: add timeout tests
sanity tests for timeouts.

v2:
  use test_sleep instead of sleep
  add few more test-cases

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-11-17 16:51:51 +02:00
Marek Chalupa
6ebe55060e tests: add test_usleep and test_sleep functions
The former one was already used in tests, but was private.
These functions can be shared across the tests, so make them
public.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-11-17 16:48:14 +02:00
Marek Chalupa
7bf8049c48 tests: add timeout
Add test_set_timeout() function that allows the test to
set timeout for its completition. Any other call to the function
re-sets the timeout to the new value. The timeouts can be turned off
(usefull when debugging) by setting evironment variable
WAYLAND_TESTS_NO_TIMEOUTS.

v2:
  rename NO_TIMEOUTS to WAYLAND_TESTS_NO_TIMEOUTS
  use unsigned int as argument of test_set_timeout()
  improve printing of the message about timeout

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-11-17 16:45:49 +02:00
Ryo Munakata
47c752ad82 connection: abort if a listener function is NULL
Signed-off-by: Ryo Munakata <ryomnktml@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-11-12 14:00:38 +02:00
Carlos Olmedo Escobar
9d327c5796 Remove useless semicolon.
Signed-off-by: Carlos Olmedo Escobar <carlos.olmedo.e@gmail.com>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
2014-11-12 12:48:06 +02:00
Srivardhan Hebbar
754ce18135 doc: Added API documentation for wl_display_destroy and wl_display_add_socket functions.
Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>
[Pekka Paalanen: minor re-wording.]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-11-11 13:30:02 +02:00
Bryce Harrington
94f1718c50 Don't document an absent parameter.
Quells a doxygen warning:

  src/wayland-server.c:790: warning: argument 'None' of command @param is
  not found in the argument list of wl_display::wl_display_create(void)

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2014-11-11 12:41:44 +02:00
Imran Zaman
ff769d8fae scanner, client: Added more error checks when strtol function is used
Signed-off-by: Imran Zaman <imran.zaman@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-11-10 15:25:13 +02:00
Marek Chalupa
ba6b79c577 tests: use our own XDG_RUNTIME_DIR for tests
Use $XDG_RUNTIME_DIR/wayland-tests for tests. This way we won't be
messing XDG_RUNTIME_DIR and it also fixes a bug, when socket-test
failed when another compositor was running.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-11-10 14:00:56 +02:00
Philip Withnall
2097414a7c queue-test: Add another assertion
Ensure that the round trip succeeds.

Signed-off-by: Philip Withnall <philip at tecnocode.co.uk>
Signed-off-by: Karsten Otto <ottoka at posteo.de>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-11-05 14:26:53 +02:00
Philip Withnall
a434b7ba8e wayland-server: Abort if a read from a client gives 0 length
This happens on EOF if using a poll function such as select() or
kqueue() which doesn’t distinguish EOF events.

Currently execution should never reach the point where recvmsg() returns
EOF (len == 0). Instead, epoll() will detect this and indicate EPOLLHUP,
which is handled a few lines above, closing the connection. However,
other event mechanisms may not be able to distinguish EOF from regular
readability (in the case of select()) or inconsistently across platforms
(in the case of POLLHUP). There is also the possibility of half-closed
connections (shutdown(), POLLRDHUP), though this may not be an issue
with Wayland.

This will not cause problems if the FD polls as readable but actually is
not — in that case, recvmsg() will return EAGAIN.

Signed-off-by: Philip Withnall <philip at tecnocode.co.uk>
Signed-off-by: Karsten Otto <ottoka at posteo.de>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-11-05 14:24:17 +02:00
Philip Withnall
b096693bef event-loop.c: Use correct OS abstraction function for dupfd()
Signed-off-by: Philip Withnall <philip at tecnocode.co.uk>
Signed-off-by: Karsten Otto <ottoka at posteo.de>
Reviewed-by: David Fort <contact at hardening-consulting.com>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-11-05 14:17:25 +02:00
Philip Withnall
cb00e27039 connection: Fix sendmsg() on FreeBSD
It expects ((msg_controllen == 0) == (msg_control == NULL)), and returns
EINVAL otherwise. It can't hurt to be tidy about things on other platforms
either though.

See: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=99356#c5

Signed-off-by: Philip Withnall <philip at tecnocode.co.uk>
Signed-off-by: Karsten Otto <ottoka at posteo.de>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-11-05 14:13:50 +02:00
kabeer khan
0953e126d7 Protocol : Added destructor to wl_data_device interface
[Pekka Paalanen: removed trailing whitespace, adjust bz link.]

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=81745
Signed-off-by: kabeer khan <kabeer.khan@samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-11-04 15:04:29 +02:00
Derek Foreman
322cd6dded cosmetic: convert some function returns from int to bool
[Pekka Paalanen: change is_nullable_type() return value to bool.]

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-11-04 13:01:58 +02:00
Benjamin Herr
391820b0d6 connection: Leave fd open in wl_connection_destroy
Calling close() on the same file descriptor that a previous call to
close() already closed is wrong, and racy if another thread received
that same file descriptor as a eg. new socket or actual file.

There are two situations where wl_connection_destroy() would close its
file descriptor and then another function up in the call chain would
close the same file descriptor:

  * When wl_client_create() fails after calling wl_connection_create(),
    it will call wl_connection_destroy() before returning. However, its
    caller will always close the file descriptor if wl_client_create()
    fails.

  * wl_display_disconnect() unconditionally closes the display file
    descriptor and also calls wl_connection_destroy().

So these two seem to expect wl_connection_destroy() to leave the file
descriptor open. The other caller of wl_connection_destroy(),
wl_client_destroy(), does however expect wl_connection_destroy() to
close its file descriptor, alas.

This patch changes wl_connection_destroy() to indulge this majority of
two callers by simply not closing the file descriptor. For the benefit
of wl_client_destroy(), wl_connection_destroy() then returns the
unclosed file descriptor so that wl_client_destroy() can close it
itself.

Since wl_connection_destroy() is a private function called from few
places, changing its semantics seemed like the more expedient way to
address the double-close() problem than shuffling around the logic in
wl_client_create() to somehow enable it to always avoid calling
wl_connection_destroy().

Signed-off-by: Benjamin Herr <ben@0x539.de>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-11-04 11:26:22 +02:00
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
235 changed files with 45319 additions and 10138 deletions

24
.editorconfig Normal file
View file

@ -0,0 +1,24 @@
root = true
[*]
charset = utf-8
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = tab
indent_size = 8
max_line_length = 80
[*.{xml,xsl}]
indent_style = space
indent_size = 2
tab_width = 8
[*.py]
indent_style = space
indent_size = 4
[*.yml]
indent_style = space
indent_size = 2
max_line_length = off

4
.git-blame-ignore-revs Normal file
View file

@ -0,0 +1,4 @@
# Use the following command to ignore the following commits in git blame:
# git config blame.ignoreRevsFile .git-blame-ignore-revs
77b9eb76369e27142b8be296b5f2eb1ca466272a # protocol: reindent wayland.xml

54
.gitignore vendored
View file

@ -1,58 +1,8 @@
*.deps
*.jpg
*.la
*.lo
*.o
*.pc
*.so
*.announce
*.sig
*.swp
*.3
*.7
*.log
*.trs
*.tar.xz
*~
.libs
.dirstamp
cscope.out
ctags
/aclocal.m4
/wayland-scanner.m4
/autom4te.cache
/compile
/config.guess
/config.h
/config.h.in
/config.log
/config.mk
/config.status
/config.sub
/configure
/depcomp
/install-sh
/libtool
/ltmain.sh
/missing
/stamp-h1
/test-driver
Makefile
Makefile.in
array-test
client-test
connection-test
display-test
event-loop-test
exec-fd-leak-checker
fixed-benchmark
fixed-test
list-test
map-test
message-test
os-wrappers-test
queue-test
resources-test
sanity-test
signal-test
socket-test
wayland-scanner
protocol/*.[ch]

356
.gitlab-ci.yml Normal file
View file

@ -0,0 +1,356 @@
# This file uses the freedesktop ci-templates to build Wayland and run our
# tests in CI.
#
# ci-templates uses a multi-stage build process. First, the base container
# image is built which contains the core distribution, the toolchain, and
# all our build dependencies. This container is aggressively cached; if a
# container image matching $FDO_DISTRIBUTION_TAG is found in either the
# upstream repo (wayland/weston) or the user's downstream repo, it is
# reused for the build. This gives us predictability of build and far
# quicker runtimes, however it means that any changes to the base container
# must also change $FDO_DISTRIBUTION_TAG. When changing this, please use
# the current date as well as a unique build identifier.
#
# After the container is either rebuilt (tag mismatch) or reused (tag
# previously used), the build stage executes within this container.
#
# The final stage is used to expose documentation and coverage information,
# including publishing documentation to the public site when built on the
# main branch.
#
# Apart from the 'variables', 'include', and 'stages' top-level anchors,
# everything not beginning with a dot ('.') is the name of a job which will
# be executed as part of CI, unless the rules specify that it should not be
# run.
#
# Variables prefixed with CI_ are generally provided by GitLab itself;
# variables prefixed with FDO_ and templates prefixed by .fdo are provided
# by the ci-templates.
#
# For more information on GitLab CI, including the YAML syntax, see:
# https://docs.gitlab.com/ee/ci/yaml/README.html
#
# Note that freedesktop.org uses the 'Community Edition' of GitLab, so features
# marked as 'premium' or 'ultimate' are not available to us.
#
# For more information on ci-templates, see:
# - documentation at https://freedesktop.pages.freedesktop.org/ci-templates/
# - repo at https://gitlab.freedesktop.org/freedesktop/ci-templates/
include:
- project: 'freedesktop/ci-templates'
# Here we use a fixed ref in order to isolate ourselves from ci-templates
# API changes. If you need new features from ci-templates you must bump
# this to the current SHA you require from the ci-templates repo, however
# be aware that you may need to account for API changes when doing so.
ref: 48c2c583a865bd59be21e8938df247faf460099c
file:
- '/templates/debian.yml'
- '/templates/freebsd.yml'
- '/templates/ci-fairy.yml'
variables:
FDO_UPSTREAM_REPO: wayland/wayland
FDO_REPO_SUFFIX: "$BUILD_OS/$BUILD_ARCH"
# Define the build stages. These are used for UI grouping as well as
# dependencies.
stages:
- "Merge request checks"
- "Base container"
- "Build and test"
- "Other build configurations"
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
when: never
- if: $CI_COMMIT_BRANCH
.ci-rules:
rules:
- when: on_success
# Base variables used for anything using a Debian environment
.os-debian:
variables:
BUILD_OS: debian
FDO_DISTRIBUTION_VERSION: trixie
FDO_DISTRIBUTION_PACKAGES: 'build-essential pkg-config libexpat1-dev libffi-dev libxml2-dev doxygen graphviz xmlto xsltproc docbook-xsl mdbook meson ninja-build'
# bump this tag every time you change something which requires rebuilding the
# base image
FDO_DISTRIBUTION_TAG: "2026-01-31.0"
.debian-x86_64:
extends:
- .os-debian
variables:
BUILD_ARCH: "x86-64"
.debian-aarch64:
extends:
- .os-debian
variables:
BUILD_ARCH: "aarch64"
.debian-armv7:
extends:
- .os-debian
variables:
BUILD_ARCH: "armv7"
FDO_DISTRIBUTION_PLATFORM: "linux/arm/v7"
# Does not inherit .ci-rules as we only want it to run in MR context.
check-commit:
extends:
- .fdo.ci-fairy
stage: "Merge request checks"
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: always
- when: never
script:
- ci-fairy check-commits --signed-off-by --junit-xml=results.xml
variables:
GIT_DEPTH: 100
artifacts:
reports:
junit: results.xml
# Build our base container image, which contains the core distribution, the
# toolchain, and all our build dependencies. This will be reused in the build
# stage.
x86_64-debian-container_prep:
extends:
- .ci-rules
- .debian-x86_64
- .fdo.container-build@debian
stage: "Base container"
variables:
GIT_STRATEGY: none
aarch64-debian-container_prep:
extends:
- .ci-rules
- .debian-aarch64
- .fdo.container-build@debian
tags:
- aarch64
stage: "Base container"
variables:
GIT_STRATEGY: none
armv7-debian-container_prep:
extends:
- .ci-rules
- .debian-armv7
- .fdo.container-build@debian
tags:
- aarch64
stage: "Base container"
variables:
GIT_STRATEGY: none
# Core build environment.
.build-env:
variables:
MESON_BUILD_TYPE: "-Dbuildtype=debug -Doptimization=0 -Db_sanitize=address,undefined -Ddocbook_validation=true"
# See https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/154
ASAN_OPTIONS: "detect_odr_violation=0"
before_script:
- export BUILD_ID="wayland-$CI_JOB_NAME"
- export PREFIX="${CI_PROJECT_DIR}/prefix-${BUILD_ID}"
- export BUILDDIR="${CI_PROJECT_DIR}/build-${BUILD_ID}"
- mkdir "$BUILDDIR" "$PREFIX"
# Build variants to be stacked on as required.
.build-release:
stage: "Other build configurations"
variables:
MESON_BUILD_TYPE: "-Dbuildtype=release"
# OS/architecture-specific variants
.build-env-debian-x86_64:
extends:
- .fdo.suffixed-image@debian
- .debian-x86_64
- .build-env
needs:
- job: x86_64-debian-container_prep
artifacts: false
.build-env-debian-aarch64:
extends:
- .fdo.suffixed-image@debian
- .debian-aarch64
- .build-env
variables:
# At least with the versions we have, the LSan runtime makes fork unusably
# slow on AArch64, which is bad news since the test suite decides to fork
# for every single subtest. For now, in order to get AArch64 builds and
# tests into CI, just assume that we're not going to leak any more on
# AArch64 than we would on ARMv7 or x86-64.
ASAN_OPTIONS: "detect_leaks=0,detect_odr_violation=0"
tags:
- aarch64
needs:
- job: aarch64-debian-container_prep
artifacts: false
.build-env-debian-armv7:
extends:
- .fdo.suffixed-image@debian
- .debian-armv7
- .build-env
tags:
- aarch64
needs:
- job: armv7-debian-container_prep
artifacts: false
# Full build and test.
.do-build:
extends:
- .ci-rules
stage: "Build and test"
script:
- meson setup $BUILDDIR --prefix="$PREFIX" -Dicon_directory=/usr/share/X11/icons --fatal-meson-warnings -Dwerror=true ${MESON_BUILD_TYPE}
- ninja -C $BUILDDIR -k0 -j${FDO_CI_CONCURRENT:-4}
- meson test -C $BUILDDIR --num-processes ${FDO_CI_CONCURRENT:-4}
- ninja -C $BUILDDIR install
- ninja -C $BUILDDIR clean
artifacts:
name: wayland-$CI_JOB_NAME
when: always
paths:
- build-*/meson-logs
- prefix-*
reports:
junit: build-*/meson-logs/testlog.junit.xml
# Full build and test.
.do-build-qemu:
extends:
- .ci-rules
stage: "Build and test"
script:
# Start the VM and copy our workspace to the VM
- /app/vmctl start
- scp -r $PWD "vm:"
# The `set +e is needed to ensure that we always copy the meson logs back to
# the workspace to see details about the failed tests.
- |
set +e
/app/vmctl exec "pkg info; cd $CI_PROJECT_NAME ; meson setup $BUILDDIR --prefix=$PREFIX $MESON_BUILD_TYPE $MESON_ARGS && ninja -C $BUILDDIR -j${FDO_CI_CONCURRENT:-4}"
/app/vmctl exec "meson test --print-errorlogs -C $BUILDDIR --num-processes ${FDO_CI_CONCURRENT:-4}" && touch .tests-successful
set -ex
scp -r vm:$BUILDDIR/meson-logs .
/app/vmctl exec "ninja -C $BUILDDIR install"
mkdir -p $PREFIX && scp -r vm:$PREFIX/ $PREFIX/
# Finally, shut down the VM.
- /app/vmctl stop
- test -f .tests-successful || exit 1
artifacts:
name: wayland-$CI_JOB_NAME
when: always
paths:
- meson-logs
- prefix-*
reports:
junit: meson-logs/testlog.junit.xml
# Full build and test.
x86_64-debian-build:
extends:
- .build-env-debian-x86_64
- .do-build
x86_64-release-debian-build:
extends:
- .build-env-debian-x86_64
- .do-build
- .build-release
aarch64-debian-build:
extends:
- .build-env-debian-aarch64
- .do-build
aarch64-release-debian-build:
extends:
- .build-env-debian-aarch64
- .do-build
- .build-release
armv7-debian-build:
extends:
- .build-env-debian-armv7
- .do-build
armv7-release-debian-build:
extends:
- .build-env-debian-armv7
- .do-build
- .build-release
# Base variables used for anything using a FreeBSD environment
.os-freebsd:
variables:
BUILD_OS: freebsd
FDO_DISTRIBUTION_VERSION: "14.4"
FDO_DISTRIBUTION_PACKAGES: 'libxslt meson ninja pkgconf expat libffi libepoll-shim libxml2'
# bump this tag every time you change something which requires rebuilding the
# base image
FDO_DISTRIBUTION_TAG: "2026-03-10.0"
# Don't build documentation since installing the required tools massively
# increases the VM image (and therefore container) size.
MESON_ARGS: "--fatal-meson-warnings -Dwerror=true -Ddocumentation=false"
.freebsd-x86_64:
extends:
- .os-freebsd
variables:
BUILD_ARCH: "x86_64"
x86_64-freebsd-container_prep:
extends:
- .ci-rules
- .freebsd-x86_64
- .fdo.qemu-build@freebsd@x86_64
stage: "Base container"
variables:
GIT_STRATEGY: none
.build-env-freebsd-x86_64:
variables:
# Compiling with ASan+UBSan appears to trigger an infinite loop in the
# compiler shipped with FreeBSD 13.0, so we only use UBSan here.
# Additionally, sanitizers can't be used with b_lundef on FreeBSD.
MESON_BUILD_TYPE: "-Dbuildtype=debug -Db_sanitize=undefined -Db_lundef=false"
extends:
- .fdo.suffixed-image@freebsd
- .freebsd-x86_64
- .build-env
needs:
- job: x86_64-freebsd-container_prep
artifacts: false
# Full build and test.
x86_64-freebsd-build:
extends:
- .build-env-freebsd-x86_64
- .do-build-qemu
x86_64-release-freebsd-build:
extends:
- .build-env-freebsd-x86_64
- .do-build-qemu
- .build-release

View file

@ -0,0 +1,8 @@
<!--
This repository is for the Wayland protocol description and the libwayland IPC helper
library only. Issues with Wayland during day-to-day usage are almost
certainly a bug in your compositor and **not** a bug with in this
repository.
Please remove this comment before filing your issue.
-->

3
.mailmap Normal file
View file

@ -0,0 +1,3 @@
Faith Ekstrand <faith@gfxstrand.net> <jason@jlekstrand.net>
Faith Ekstrand <faith@gfxstrand.net> <jason.ekstrand@intel.com>
Faith Ekstrand <faith@gfxstrand.net> <jason.ekstrand@collabora.com>

33
.triage-policies.yml Normal file
View file

@ -0,0 +1,33 @@
# This is a set of bugbot commands for issues and merge requests - setting any of the
# bugbot::foo labels will trigger gitlab-triage to run with this ruleset (well, the
# one we have on the main branch at the time)
#
# Note that for adding labels, the label must first created in the project.
resource_rules:
issues:
rules:
- name: "Close bugs that aren't Wayland bugs"
conditions:
labels:
- "bugbot::not-wayland"
actions:
remove_labels:
- "bugbot::not-wayland"
comment: |
Thank you for the report, but your issue does not look like it would belong here. Sorry.
This repository is for the Wayland protocol specification and the
low-level C library that deals with the protocol.
This issue here is a bug not with the protocol itself but with either
- your compositor or desktop environment's implementation of the Wayland protocol and surrounding functionality,
- the individual application that triggers this issue, or
- the kernel driver used by your hardware
Please file the issue against your compositor/desktop environment, the application
or the kernel drivers instead, whichever seems more likely to you. If you are not sure,
file an issue against the application.
status: "close"
merge_requests:
rules:
[]

344
CONTRIBUTING.md Normal file
View file

@ -0,0 +1,344 @@
Contributing to Wayland
=======================
Sending patches
---------------
Patches should be sent via
[GitLab merge requests](https://docs.gitlab.com/ce/gitlab-basics/add-merge-request.html).
Wayland is
[hosted on freedesktop.org's GitLab](https://gitlab.freedesktop.org/wayland/wayland/):
in order to submit code, you should create an account on this GitLab instance,
fork the core Wayland repository, push your changes to a branch in your new
repository, and then submit these patches for review through a merge request.
Wayland formerly accepted patches via `git-send-email`, sent to
**wayland-devel@lists.freedesktop.org**; these were
[tracked using Patchwork](https://patchwork.freedesktop.org/project/wayland/).
Some old patches continue to be sent this way, and we may accept small new
patches sent to the list, but please send all new patches through GitLab merge
requests.
Formatting and separating commits
---------------------------------
Unlike many projects using GitHub and GitLab, Wayland has a
[linear, 'recipe' style history](http://www.bitsnbites.eu/git-history-work-log-vs-recipe/).
This means that every commit should be small, digestible, stand-alone, and
functional. Rather than a purely chronological commit history like this:
connection: plug a fd leak
plug another fd leak
connection: init fds to -1
close all fds
refactor checks into a new function
don't close fds we handed out
we aim to have a clean history which only reflects the final state, broken up
into functional groupings:
connection: Refactor out closure allocation
connection: Clear fds we shouldn't close to -1
connection: Make wl_closure_destroy() close fds of undispatched closures
This ensures that the final patch series only contains the final state,
without the changes and missteps taken along the development process.
The first line of a commit message should contain a prefix indicating
what part is affected by the patch followed by one sentence that
describes the change. For examples:
protocol: Support scaled outputs and surfaces
and
doc: generate server documentation from XML too
If in doubt what prefix to use, look at other commits that change the
same file(s) as the patch being sent.
The body of the commit message should describe what the patch changes
and why, and also note any particular side effects. This shouldn't be
empty on most of the cases. It shouldn't take a lot of effort to write
a commit message for an obvious change, so an empty commit message
body is only acceptable if the questions "What?" and "Why?" are already
answered on the one-line summary.
The lines of the commit message should have at most 76 characters, to
cope with the way git log presents them.
See [notes on commit messages] for a recommended reading on writing commit
messages.
Your patches should also include a Signed-off-by line with your name and
email address. If you're not the patch's original author, you should
also gather S-o-b's by them (and/or whomever gave the patch to you.) The
significance of this is that it certifies that you created the patch,
that it was created under an appropriate open source license, or
provided to you under those terms. This lets us indicate a chain of
responsibility for the copyright status of the code.
We won't reject patches that lack S-o-b, but it is strongly recommended.
When you re-send patches, revised or not, it would be very good to document the
changes compared to the previous revision in the commit message and/or the
merge request. If you have already received Reviewed-by or Acked-by tags, you
should evaluate whether they still apply and include them in the respective
commit messages. Otherwise the tags may be lost, reviewers miss the credit they
deserve, and the patches may cause redundant review effort.
Tracking patches and following up
---------------------------------
Once submitted to GitLab, your patches will be reviewed by the Wayland
development team on GitLab. Review may be entirely positive and result in your
code landing instantly, in which case, great! You're done. However, we may ask
you to make some revisions: fixing some bugs we've noticed, working to a
slightly different design, or adding documentation and tests.
If you do get asked to revise the patches, please bear in mind the notes above.
You should use `git rebase -i` to make revisions, so that your patches follow
the clear linear split documented above. Following that split makes it easier
for reviewers to understand your work, and to verify that the code you're
submitting is correct.
A common request is to split single large patch into multiple patches. This can
happen, for example, if when adding a new feature you notice a bug elsewhere
which you need to fix to progress. Separating these changes into separate
commits will allow us to verify and land the bugfix quickly, pushing part of
your work for the good of everyone, whilst revision and discussion continues on
the larger feature part. It also allows us to direct you towards reviewers who
best understand the different areas you are working on.
When you have made any requested changes, please rebase the commits, verify
that they still individually look good, then force-push your new branch to
GitLab. This will update the merge request and notify everyone subscribed to
your merge request, so they can review it again.
There are also
[many GitLab CLI clients](https://about.gitlab.com/applications/#cli-clients),
if you prefer to avoid the web interface. It may be difficult to follow review
comments without using the web interface though, so we do recommend using this
to go through the review process, even if you use other clients to track the
list of available patches.
Coding style
------------
You should follow the style of the file you're editing. In general, we
try to follow the rules below.
**Note: this file uses spaces due to markdown rendering issues for tabs.
Code must be implemented using tabs.**
- indent with tabs, and a tab is always 8 characters wide
- opening braces are on the same line as the if statement;
- no braces in an if-body with just one statement;
- if one of the branches of an if-else condition has braces, then the
other branch should also have braces;
- there is always an empty line between variable declarations and the
code;
```c
static int
my_function(void)
{
int a = 0;
if (a)
b();
else
c();
if (a) {
b();
c();
} else {
d();
}
}
```
- lines should be less than 80 characters wide;
- when breaking lines with functions calls, the parameters are aligned
with the opening parentheses;
- when assigning a variable with the result of a function call, if the
line would be longer we break it around the equal '=' sign if it makes
sense;
```c
long_variable_name =
function_with_a_really_long_name(parameter1, parameter2,
parameter3, parameter4);
x = function_with_a_really_long_name(parameter1, parameter2,
parameter3, parameter4);
```
Conduct
=======
As a freedesktop.org project, Wayland follows the Contributor Covenant,
found at:
https://www.freedesktop.org/wiki/CodeOfConduct
Please conduct yourself in a respectful and civilised manner when
interacting with community members on mailing lists, IRC, or bug
trackers. The community represents the project as a whole, and abusive
or bullying behaviour is not tolerated by the project.
Licensing
=========
Wayland is licensed with the intention to be usable anywhere X.org is.
Originally, X.org was covered under the MIT X11 license, but changed to
the MIT Expat license. Similarly, Wayland was covered initially as MIT
X11 licensed, but changed to the MIT Expat license, following in X.org's
footsteps. Other than wording, the two licenses are substantially the
same, with the exception of a no-advertising clause in X11 not included
in Expat.
New source code files should specify the MIT Expat license in their
boilerplate, as part of the copyright statement.
Review
======
All patches, even trivial ones, require at least one positive review
(Reviewed-by). Additionally, if no Reviewed-by's have been given by
people with commit access, there needs to be at least one Acked-by from
someone with commit access. A person with commit access is expected to be
able to evaluate the patch with respect to the project scope and architecture.
The below review guidelines are intended to be interpreted in spirit, not by
the letter. There may be circumstances where some guidelines are better
ignored. We rely very much on the judgement of reviewers and commit rights
holders.
During review, the following matters should be checked:
- The commit message explains why the change is being made.
- The code fits the project's scope.
- The code license is the same MIT licence the project generally uses.
- Stable ABI or API is not broken.
- Stable ABI or API additions must be justified by actual use cases, not only
by speculation. They must also be documented, and it is strongly recommended to
include tests exercising the additions in the test suite.
- The code fits the existing software architecture, e.g. no layering
violations.
- The code is correct and does not introduce new failures for existing users,
does not add new corner-case bugs, and does not introduce new compiler
warnings.
- The patch does what it says in the commit message and changes nothing else.
- The patch is a single logical change. If the commit message addresses
multiple points, it is a hint that the commit might need splitting up.
- A bug fix should target the underlying root cause instead of hiding symptoms.
If a complete fix is not practical, partial fixes are acceptable if they come
with code comments and filed Gitlab issues for the remaining bugs.
- The bug root cause rule applies to external software components as well, e.g.
do not work around kernel driver issues in userspace.
- The test suite passes.
- The code does not depend on API or ABI which has no working free open source
implementation.
- The code is not dead or untestable. E.g. if there are no free open source
software users for it then it is effectively dead code.
- The code is written to be easy to understand, or if code cannot be clear
enough on its own there are code comments to explain it.
- The code is minimal, i.e. prefer refactor and re-use when possible unless
clarity suffers.
- The code adheres to the style guidelines.
- In a patch series, every intermediate step adheres to the above guidelines.
Commit rights
=============
Commit rights will be granted to anyone who requests them and fulfills the
below criteria:
- Submitted some (10 as a rule of thumb) non-trivial (not just simple
spelling fixes and whitespace adjustment) patches that have been merged
already.
- Are actively participating in public discussions about their work (on the
mailing list or IRC). This should not be interpreted as a requirement to
review other peoples patches but just make sure that patch submission isn't
one-way communication. Cross-review is still highly encouraged.
- Will be regularly contributing further patches. This includes regular
contributors to other parts of the open source graphics stack who only
do the occasional development in this project.
- Agrees to use their commit rights in accordance with the documented merge
criteria, tools, and processes.
To apply for commit rights, create a new issue in gitlab for the respective
project and give it the "accounts" label.
Committers are encouraged to request their commit rights get removed when they
no longer contribute to the project. Commit rights will be reinstated when they
come back to the project.
Maintainers and committers should encourage contributors to request commit
rights, especially junior contributors tend to underestimate their skills.
Stabilising for releases
========================
A release cycle ends with a stable release which also starts a new cycle and
lifts any code freezes. Gradual code freezing towards a stable release starts
with an alpha release. The release stages of a cycle are:
- **Alpha release**:
Signified by version number #.#.91.
Major features must have landed before this. Major features include
invasive code motion and refactoring, high risk changes, and new stable
library ABI.
- **Beta release**:
Signified by version number #.#.92.
Minor features must have landed before this. Minor features include all
new features that are not major, low risk changes, clean-ups, and
documentation. Stable ABI that was new in the alpha release can be removed
before a beta release if necessary.
- **Release candidates (RC)**:
Signified by version number #.#.93 and up to #.#.99.
Bug fixes that are not release critical must have landed before this.
Release critical bug fixes can still be landed after this, but they may
call for another RC.
- **Stable release**:
Signified by version number #.#.0.
Ideally no changes since the last RC.
Mind that version #.#.90 is never released. It is used during development when
no code freeze is in effect. Stable branches and point releases are not covered
by the above.
[git documentation]: http://git-scm.com/documentation
[notes on commit messages]: http://who-t.blogspot.de/2009/12/on-commit-messages.html

39
COPYING
View file

@ -3,20 +3,27 @@ Copyright © 2010-2012 Intel Corporation
Copyright © 2011 Benjamin Franzke
Copyright © 2012 Collabora, Ltd.
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that copyright
notice and this permission notice appear in supporting documentation, and
that the name of the copyright holders not be used in advertising or
publicity pertaining to distribution of the software without specific,
written prior permission. The copyright holders make no representations
about the suitability of this software for any purpose. It is provided "as
is" without express or implied warranty.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
OF THIS SOFTWARE.
The above copyright notice and this permission notice (including the next
paragraph) shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
---
The above is the version of the MIT "Expat" License used by X.org:
http://cgit.freedesktop.org/xorg/xserver/tree/COPYING

View file

@ -1,198 +0,0 @@
if BUILD_DOCS
SUBDIRS = doc
endif
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
aclocaldir = $(datadir)/aclocal
dist_aclocal_DATA = wayland-scanner.m4
dist_pkgdata_DATA = \
wayland-scanner.mk \
protocol/wayland.xml \
protocol/wayland.dtd
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA =
lib_LTLIBRARIES = libwayland-server.la libwayland-client.la
noinst_LTLIBRARIES = libwayland-util.la
include_HEADERS = \
src/wayland-util.h \
src/wayland-server.h \
src/wayland-client.h \
src/wayland-egl.h \
src/wayland-version.h
nodist_include_HEADERS = \
protocol/wayland-server-protocol.h \
protocol/wayland-client-protocol.h
libwayland_util_la_SOURCES = \
src/connection.c \
src/wayland-util.c \
src/wayland-util.h \
src/wayland-os.c \
src/wayland-os.h \
src/wayland-private.h
libwayland_server_la_CFLAGS = $(FFI_CFLAGS) $(GCC_CFLAGS) -pthread
libwayland_server_la_LIBADD = $(FFI_LIBS) libwayland-util.la -lrt -lm
libwayland_server_la_LDFLAGS = -version-info 1:0:1
libwayland_server_la_SOURCES = \
src/wayland-server.c \
src/wayland-shm.c \
src/event-loop.c
nodist_libwayland_server_la_SOURCES = \
protocol/wayland-server-protocol.h \
protocol/wayland-protocol.c
libwayland_client_la_CFLAGS = $(FFI_CFLAGS) $(GCC_CFLAGS) -pthread
libwayland_client_la_LIBADD = $(FFI_LIBS) libwayland-util.la -lrt -lm
libwayland_client_la_LDFLAGS = -version-info 3:0:3
libwayland_client_la_SOURCES = \
src/wayland-client.c
nodist_libwayland_client_la_SOURCES = \
protocol/wayland-client-protocol.h \
protocol/wayland-protocol.c
pkgconfig_DATA += src/wayland-client.pc src/wayland-server.pc
if ENABLE_SCANNER
wayland_scanner = $(top_builddir)/wayland-scanner
bin_PROGRAMS = wayland-scanner
wayland_scanner_SOURCES = src/scanner.c
wayland_scanner_LDADD = $(EXPAT_LIBS) libwayland-util.la
$(BUILT_SOURCES) : wayland-scanner
pkgconfig_DATA += src/wayland-scanner.pc
else
wayland_scanner = wayland-scanner
endif
protocol/%-protocol.c : $(top_srcdir)/protocol/%.xml
$(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(wayland_scanner) code < $< > $@
protocol/%-server-protocol.h : $(top_srcdir)/protocol/%.xml
$(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(wayland_scanner) server-header < $< > $@
protocol/%-client-protocol.h : $(top_srcdir)/protocol/%.xml
$(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(wayland_scanner) client-header < $< > $@
BUILT_SOURCES = \
$(nodist_libwayland_server_la_SOURCES) \
$(nodist_libwayland_client_la_SOURCES)
CLEANFILES = $(BUILT_SOURCES)
DISTCLEANFILES = src/wayland-version.h
EXTRA_DIST = src/wayland-version.h.in
lib_LTLIBRARIES += libwayland-cursor.la
include_HEADERS += cursor/wayland-cursor.h
libwayland_cursor_la_SOURCES = \
cursor/wayland-cursor.c \
cursor/os-compatibility.c \
cursor/os-compatibility.h \
cursor/cursor-data.h \
cursor/xcursor.c \
cursor/xcursor.h
libwayland_cursor_la_LIBADD = libwayland-client.la
pkgconfig_DATA += cursor/wayland-cursor.pc
libwayland_cursor_la_CFLAGS = \
$(GCC_CFLAGS) \
-I$(top_builddir)/src \
-I$(top_srcdir)/src \
-DICONDIR=\"$(ICONDIR)\"
TESTS = \
array-test \
client-test \
display-test \
connection-test \
event-loop-test \
fixed-test \
list-test \
map-test \
os-wrappers-test \
sanity-test \
socket-test \
queue-test \
signal-test \
resources-test \
message-test
check_PROGRAMS = \
$(TESTS) \
exec-fd-leak-checker
noinst_PROGRAMS = \
fixed-benchmark
check_LTLIBRARIES = libtest-runner.la
libtest_runner_la_SOURCES = \
tests/test-runner.c \
tests/test-runner.h \
tests/test-helpers.c \
tests/test-compositor.h \
tests/test-compositor.c
libtest_runner_la_LIBADD = \
libwayland-util.la \
libwayland-client.la \
libwayland-server.la \
-lrt -ldl $(FFI_LIBS)
array_test_SOURCES = tests/array-test.c
array_test_LDADD = libtest-runner.la
client_test_SOURCES = tests/client-test.c
client_test_LDADD = libtest-runner.la
display_test_SOURCES = tests/display-test.c
display_test_LDADD = libtest-runner.la
connection_test_SOURCES = tests/connection-test.c
connection_test_LDADD = libtest-runner.la
event_loop_test_SOURCES = tests/event-loop-test.c
event_loop_test_LDADD = libtest-runner.la
fixed_test_SOURCES = tests/fixed-test.c
fixed_test_LDADD = libtest-runner.la
list_test_SOURCES = tests/list-test.c
list_test_LDADD = libtest-runner.la
map_test_SOURCES = tests/map-test.c
map_test_LDADD = libtest-runner.la
sanity_test_SOURCES = tests/sanity-test.c
sanity_test_LDADD = libtest-runner.la
socket_test_SOURCES = tests/socket-test.c
socket_test_LDADD = libtest-runner.la
queue_test_SOURCES = tests/queue-test.c
queue_test_LDADD = libtest-runner.la
signal_test_SOURCES = tests/signal-test.c
signal_test_LDADD = libtest-runner.la
resources_test_SOURCES = tests/resources-test.c
resources_test_LDADD = libtest-runner.la
message_test_SOURCES = tests/message-test.c
message_test_LDADD = libtest-runner.la
fixed_benchmark_SOURCES = tests/fixed-benchmark.c
fixed_benchmark_LDADD = libtest-runner.la
os_wrappers_test_SOURCES = tests/os-wrappers-test.c
os_wrappers_test_LDADD = libtest-runner.la
AM_CPPFLAGS = \
-I$(top_builddir)/src \
-I$(top_srcdir)/src \
-I$(top_builddir)/protocol
AM_CFLAGS = $(GCC_CFLAGS) $(FFI_CFLAGS)
exec_fd_leak_checker_SOURCES = tests/exec-fd-leak-checker.c
exec_fd_leak_checker_LDADD = libtest-runner.la

View file

@ -1,4 +1,4 @@
What is Wayland
# Wayland
Wayland is a project to define a protocol for a compositor to talk to
its clients as well as a library implementation of the protocol. The
@ -17,19 +17,14 @@ protocol does not handle rendering, which is one of the features that
makes wayland so simple. All clients are expected to handle rendering
themselves, typically through cairo or OpenGL.
The weston compositor is a reference implementation of a wayland
compositor and the weston repository also includes a few example
clients.
Building the wayland libraries is fairly simple, aside from libffi,
they don't have many dependencies:
$ git clone git://anongit.freedesktop.org/wayland/wayland
$ git clone https://gitlab.freedesktop.org/wayland/wayland
$ cd wayland
$ ./autogen.sh --prefix=PREFIX
$ make
$ make install
$ meson build/ --prefix=PREFIX
$ ninja -C build/ install
where PREFIX is where you want to install the libraries. See
http://wayland.freedesktop.org for more complete build instructions
for wayland, weston, xwayland and various toolkits.
where PREFIX is where you want to install the libraries.
See https://wayland.freedesktop.org for documentation.

149
TODO
View file

@ -1,149 +0,0 @@
Core wayland protocol
- Maybe try to make remote wayland actually happen, to see if there
is something in the protocol/architecture that makes it harder than
it should be.
ICCCM
- mime-type guidelines for data_source (ie, both dnd and selection):
recommended types for text or images, types that a clipboard
manager must support, mime-types must be listed in preferred order
- we need a "no kb focus please" mechanism. Or should this be
implicit in a specific surface type?
EWMH
- configure should provide dx_left, dx_right, dy_top, dy_bottom, or
dx, dy, width and height.
- move to workspace, keep on top, on all workspaces, minimize etc
requests for implementing client side window menu? or just make a
"show window menu" request to let the compositor display and manage
a popup window?
- window move and resize functionality for kb and touch.
- Protocol for specifying title bar rectangle (for moving
unresponsive apps). Rectangle for close button, so we can popup
force-close dialog if application doesn't respond to ping event
when user clicks there. We could use the region mechanism here
too.
- popup placement protocol logic.
- subsurface mechanism. we need this for cases where we would use an
X subwindow for gl or video other different visual type.
EGL/gbm
- Land Robert Braggs EGL extensions: frame age, swap with damage
- Make it possible to share buffers from compositor to clients.
Tricky part here is how to indicate to EGL on the server side that
it should make an EGLImage available to a client. We'll need a
"create a wl_buffer for this EGLImage for this client" kind of
entry point.
- Protocol for arbitrating access to scanout buffers (physically
contiguous memory). When a client goes fullscreen (or ideally as
the compositor starts the animation that will make it fullscreen)
we send a "give up your scanout buffer" to the current fullscreen
client (if any) and when the client acks that we send a "try to
allocate a scanout buffer now" event to the fullscreen-to-be
client.
Misc
- glyph cache
- Needs a mechanism to pass buffers to client.
buffer = drm.create_buffer(); /* buffer with stuff in it */
cache.upload(buffer, x, y, width, height, int hash)
drm.buffer: id, name, stride etc /* event to announce cache buffer */
cache.image: hash, buffer, x, y, stride /* event to announce
* location in cache */
cache.reject: hash /* no upload for you! */
cache.retire: buffer /* cache has stopped using buffer, please
* reupload whatever you had in that buffer */
- A "please suspend" event from the compositor, to indicate to an
application that it's no longer visible/active. Or maybe discard
buffer, as in "wayland discarded your buffer, it's no longer
visible, you can stop updating it now.", reattach, as in "oh hey,
I'm about to show your buffer that I threw away, what was it
again?". for wayland system compositor vt switcing, for example,
to be able to throw away the surfaces in the session we're
switching away from. for minimized windows that we don't want live
thumb nails for. etc.
Clients and ports
- port gtk+
- draw window decorations in gtkwindow.c
- Details about pointer grabs. wayland doesn't have active grabs,
menus will behave subtly different. Under X, clicking a menu
open grabs the pointer and clicking outside the window pops down
the menu and swallows the click. without active grabs we can't
swallow the click. I'm sure there much more...
- dnd, copy-paste
- Investigate DirectFB on Wayland (or is that Wayland on DirectFB?)
- SDL port, bnf has work in progress here:
http://cgit.freedesktop.org/~bnf/sdl-wayland/
Ideas
- A wayland settings protocol to tell clients about themes (icons,
cursors, widget themes), fonts details (family, hinting
preferences) etc. Just send all settings at connect time, send
updates when a setting change. Getting a little close to gconf
here, but could be pretty simple:
interface "settings":
event int_value(string name, int value)
event string_value(string name, string value)
but maybe it's better to just require that clients get that from
somewhere else (gconf/dbus).
Crazy ideas
- AF_WAYLAND - A new socket type. Eliminate compositor context
switch by making kernel understand enough of wayland that it can
forward input events as wayland events and do page flipping in
response to surface_attach requests:
- ioctl(wayland_fd, "surface_attach to object 5 should do a kms page
flip on ctrc 2");
- what about multiple crtcs? what about frame event for other
clients?
- forward these input devices to the client
- "scancode 124 pressed or released with scan codes 18,22 and 30
held down gives control back to userspace wayland.
- what about maintaining cursor position? what about pointer
acceleration? maybe this only works in "client cursor mode",
where wayland hides the cursor and only sends relative events?
Solves the composited cursor problem. How does X show its
cursor then?
- Probably not worth it.

View file

@ -1,9 +0,0 @@
#! /bin/sh
test -n "$srcdir" || srcdir=`dirname "$0"`
test -n "$srcdir" || srcdir=.
(
cd "$srcdir" &&
autoreconf --force -v --install
) || exit
test -n "$NOCONFIGURE" || "$srcdir/configure" "$@"

View file

@ -1,143 +0,0 @@
AC_PREREQ([2.64])
m4_define([wayland_major_version], [1])
m4_define([wayland_minor_version], [5])
m4_define([wayland_micro_version], [92])
m4_define([wayland_version],
[wayland_major_version.wayland_minor_version.wayland_micro_version])
AC_INIT([wayland],
[wayland_version],
[https://bugs.freedesktop.org/enter_bug.cgi?product=Wayland&component=wayland&version=wayland_version],
[wayland],
[http://wayland.freedesktop.org/])
AC_SUBST([WAYLAND_VERSION_MAJOR], [wayland_major_version])
AC_SUBST([WAYLAND_VERSION_MINOR], [wayland_minor_version])
AC_SUBST([WAYLAND_VERSION_MICRO], [wayland_micro_version])
AC_SUBST([WAYLAND_VERSION], [wayland_version])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz subdir-objects])
AM_SILENT_RULES([yes])
# Check for programs
AC_PROG_CC
# Initialize libtool
LT_PREREQ([2.2])
LT_INIT
PKG_PROG_PKG_CONFIG()
PKG_CHECK_MODULES(FFI, [libffi])
if test "x$GCC" = "xyes"; then
GCC_CFLAGS="-Wall -Wextra -Wno-unused-parameter -g -Wstrict-prototypes -Wmissing-prototypes -fvisibility=hidden"
fi
AC_SUBST(GCC_CFLAGS)
AC_CHECK_FUNCS([accept4 mkostemp posix_fallocate])
AC_CHECK_DECL(SFD_CLOEXEC,[],
[AC_MSG_ERROR("SFD_CLOEXEC is needed to compile wayland")],
[[#include <sys/signalfd.h>]])
AC_CHECK_DECL(TFD_CLOEXEC,[],
[AC_MSG_ERROR("TFD_CLOEXEC is needed to compile wayland")],
[[#include <sys/timerfd.h>]])
AC_CHECK_DECL(CLOCK_MONOTONIC,[],
[AC_MSG_ERROR("CLOCK_MONOTONIC is needed to compile wayland")],
[[#include <time.h>]])
AC_CHECK_HEADERS([execinfo.h])
AC_ARG_ENABLE([scanner],
[AC_HELP_STRING([--disable-scanner],
[Disable compilation of wayland-scanner])],
[],
[enable_scanner=yes])
AC_ARG_ENABLE([documentation],
[AC_HELP_STRING([--disable-documentation],
[Disable building the documentation])],
[],
[enable_documentation=yes])
AM_CONDITIONAL(ENABLE_SCANNER, test "x$enable_scanner" = xyes)
AC_ARG_WITH(icondir, [ --with-icondir=<dir> Look for cursor icons here],
[ ICONDIR=$withval],
[ ICONDIR=${datadir}/icons])
AC_SUBST([ICONDIR])
EXPAT_LIB=""
AC_ARG_WITH(expat, [ --with-expat=<dir> Use expat from here],
[ expat=$withval
CPPFLAGS="$CPPFLAGS -I$withval/include"
LDFLAGS="$LDFLAGS -L$withval/lib" ] )
if test "x$enable_scanner" = "xyes"; then
AC_CHECK_HEADERS(expat.h, [AC_DEFINE(HAVE_EXPAT_H)],
[AC_MSG_ERROR([Can't find expat.h. Please install expat.])])
AC_CHECK_LIB(expat, XML_ParserCreate, [EXPAT_LIBS="-lexpat"],
[AC_MSG_ERROR([Can't find expat library. Please install expat.])])
AC_SUBST(EXPAT_LIBS)
fi
AC_PATH_PROG(XSLTPROC, xsltproc)
AM_CONDITIONAL([HAVE_XSLTPROC], [test "x$XSLTPROC" != "x"])
AC_MSG_CHECKING([for docbook manpages stylesheet])
MANPAGES_STYLESHEET=http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl
AC_PATH_PROGS_FEATURE_CHECK([XSLTPROC_TMP], [xsltproc],
AS_IF([`"$ac_path_XSLTPROC_TMP" --nonet "$MANPAGES_STYLESHEET" > /dev/null 2>&1`],
[HAVE_MANPAGES_STYLESHEET=yes]))
if test "x$HAVE_MANPAGES_STYLESHEET" = "xyes"; then
AM_CONDITIONAL([HAVE_MANPAGES_STYLESHEET], true)
AC_SUBST(MANPAGES_STYLESHEET)
AC_MSG_RESULT([yes])
else
AM_CONDITIONAL([HAVE_MANPAGES_STYLESHEET], false)
AC_MSG_RESULT([no])
fi
AM_CONDITIONAL(BUILD_DOCS, [test x$enable_documentation = xyes])
if test "x$enable_documentation" = "xyes"; then
AC_PATH_PROG(DOXYGEN, doxygen)
if test "x$DOXYGEN" = "x"; then
AC_MSG_ERROR([Documentation build requested but doxygen not found. Install doxygen or disable the documentation using --disable-documentation])
fi
AC_PATH_PROG(PUBLICAN, publican)
if test "x$PUBLICAN" != "x"; then
PUBLICAN_VERSION=[`$PUBLICAN -v | sed -e 's/version=v\?\([0-9]*\.[0-9]*\).*/\1/'`]
if test [ 1 -eq `echo "${PUBLICAN_VERSION} < 2.8" | bc` ]; then
AC_MSG_ERROR([Publican version is not supported. Install publican >= 2.8 or disable the documentation using --disable-documentation])
fi
fi
AC_CONFIG_FILES([
doc/doxygen/wayland.doxygen
])
fi
AM_CONDITIONAL([HAVE_PUBLICAN], [test "x$PUBLICAN" != "x"])
AC_CONFIG_FILES([Makefile
cursor/wayland-cursor.pc
cursor/wayland-cursor-uninstalled.pc
doc/Makefile
doc/publican/Makefile
doc/doxygen/Makefile
doc/man/Makefile
src/wayland-server-uninstalled.pc
src/wayland-client-uninstalled.pc
src/wayland-scanner-uninstalled.pc
src/wayland-server.pc
src/wayland-client.pc
src/wayland-scanner.pc
src/wayland-version.h])
AC_OUTPUT

View file

@ -1,23 +1,26 @@
/*
* Copyright © 2012 Philipp Brüschweiler
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial
* portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/*
@ -26,7 +29,6 @@
* http://fontforge.org/pcf-format.html
*/
#include <assert.h>
#include <fcntl.h>
#include <stdint.h>
#include <stdio.h>
@ -330,30 +332,38 @@ reconstruct_glyph(struct glyph *cursor, struct glyph *mask, char *name,
}
}
/* From http://cgit.freedesktop.org/xorg/lib/libXfont/tree/src/builtins/fonts.c */
/*
* Originally from
* http://cgit.freedesktop.org/xorg/lib/libXfont/tree/src/builtins/fonts.c
* Changed to the MIT "Expat" style license for Wayland..
*/
static const char cursor_licence[] =
"/*\n"
"* Copyright 1999 SuSE, Inc.\n"
"*\n"
"* Permission to use, copy, modify, distribute, and sell this software and its\n"
"* documentation for any purpose is hereby granted without fee, provided that\n"
"* the above copyright notice appear in all copies and that both that\n"
"* copyright notice and this permission notice appear in supporting\n"
"* documentation, and that the name of SuSE not be used in advertising or\n"
"* publicity pertaining to distribution of the software without specific,\n"
"* written prior permission. SuSE makes no representations about the\n"
"* suitability of this software for any purpose. It is provided \"as is\"\n"
"* without express or implied warranty.\n"
"*\n"
"* SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL\n"
"* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE\n"
"* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n"
"* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION\n"
"* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN\n"
"* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n"
"*\n"
"* Author: Keith Packard, SuSE, Inc.\n"
"*/\n";
"* Copyright 1999 SuSE, Inc.\n"
"*\n"
"* Permission is hereby granted, free of charge, to any person obtaining\n"
"* a copy of this software and associated documentation files (the\n"
"* \"Software\"), to deal in the Software without restriction, including\n"
"* without limitation the rights to use, copy, modify, merge, publish,\n"
"* distribute, sublicense, and/or sell copies of the Software, and to\n"
"* permit persons to whom the Software is furnished to do so, subject to\n"
"* the following conditions:\n"
"*\n"
"* The above copyright notice and this permission notice (including the\n"
"* next paragraph) shall be included in all copies or substantial\n"
"* portions of the Software.\n"
"*\n"
"* THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n"
"* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n"
"* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n"
"* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\n"
"* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\n"
"* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n"
"* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n"
"* SOFTWARE.\n"
"*\n"
"* Author: Keith Packard, SuSE, Inc.\n"
"*/\n";
static void
write_output_file(struct reconstructed_glyph *glyphs, int n)
@ -488,6 +498,11 @@ output_interesting_cursors()
struct reconstructed_glyph *glyphs =
malloc(n * sizeof(*glyphs));
if (!glyphs) {
printf("reconstructed_glyph malloc failed\n");
abort();
}
for (i = 0; i < n; ++i) {
struct glyph *cursor, *mask;
find_cursor_and_mask(interesting_cursors[i].source_name,

File diff suppressed because it is too large Load diff

47
cursor/meson.build Normal file
View file

@ -0,0 +1,47 @@
icondir = get_option('icon_directory')
if icondir == ''
icondir = join_paths(get_option('prefix'), get_option('datadir'), 'icons')
endif
if wayland_version[0] != '1'
# The versioning used for the shared libraries assumes that the major
# version of Wayland as a whole will increase to 2 if and only if there
# is an ABI break, at which point we should probably bump the SONAME of
# all libraries to .so.2. For more details see
# https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/177
error('We probably need to bump the SONAME of libwayland-cursor')
endif
wayland_cursor = library(
'wayland-cursor',
sources: [
'wayland-cursor.c',
'os-compatibility.c',
'xcursor.c',
],
# To avoid an unnecessary SONAME bump, wayland 1.x.y produces
# libwayland-cursor.so.0.x.y.
version: '.'.join(['0', wayland_version[1], wayland_version[2]]),
dependencies: [ wayland_client_dep ],
c_args: [ '-DICONDIR="@0@"'.format(icondir) ],
install: true,
)
install_headers('wayland-cursor.h')
pkgconfig.generate(
name: 'Wayland Cursor',
description: 'Wayland cursor helper library',
version: meson.project_version(),
libraries: wayland_cursor,
filebase: 'wayland-cursor',
)
wayland_cursor_dep = declare_dependency(
link_with: wayland_cursor,
include_directories: [ root_inc, include_directories('.') ],
)
if meson.version().version_compare('>= 0.54.0')
meson.override_dependency('wayland-cursor', wayland_cursor_dep)
endif

View file

@ -1,35 +1,50 @@
/*
* Copyright © 2012 Collabora, Ltd.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial
* portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#define _GNU_SOURCE
#include "config.h"
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <signal.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "config.h"
#ifdef HAVE_MEMFD_CREATE
#include <sys/mman.h>
#endif
/* Fallback to no flag when missing the definition */
#ifndef MFD_NOEXEC_SEAL
#define MFD_NOEXEC_SEAL 0
#endif
#include "os-compatibility.h"
#ifndef HAVE_MKOSTEMP
@ -93,53 +108,115 @@ create_tmpfile_cloexec(char *tmpname)
*
* If the C library implements posix_fallocate(), it is used to
* guarantee that disk space is available for the file at the
* given size. If disk space is insufficent, errno is set to ENOSPC.
* given size. If disk space is insufficient, errno is set to ENOSPC.
* If posix_fallocate() is not supported, program may receive
* SIGBUS on accessing mmap()'ed file contents instead.
*
* If the C library implements memfd_create(), it is used to create the
* file purely in memory, without any backing file name on the file
* system, and then sealing off the possibility of shrinking it. This
* can then be checked before accessing mmap()'ed file contents, to
* make sure SIGBUS can't happen. It also avoids requiring
* XDG_RUNTIME_DIR.
*/
int
os_create_anonymous_file(off_t size)
{
static const char template[] = "/weston-shared-XXXXXX";
static const char template[] = "/wayland-cursor-shared-XXXXXX";
const char *path;
char *name;
size_t name_size;
int fd;
int ret;
path = getenv("XDG_RUNTIME_DIR");
if (!path) {
errno = ENOENT;
return -1;
#ifdef HAVE_MEMFD_CREATE
/*
* Linux kernels older than 6.3 reject MFD_NOEXEC_SEAL with EINVAL.
* Try first *with* it, and if that fails, try again *without* it.
*/
errno = 0;
fd = memfd_create(
"wayland-cursor",
MFD_CLOEXEC | MFD_ALLOW_SEALING | MFD_NOEXEC_SEAL);
if (fd < 0 && errno == EINVAL && MFD_NOEXEC_SEAL != 0) {
fd = memfd_create(
"wayland-cursor",
MFD_CLOEXEC | MFD_ALLOW_SEALING);
}
name = malloc(strlen(path) + sizeof(template));
if (!name)
return -1;
strcpy(name, path);
strcat(name, template);
fd = create_tmpfile_cloexec(name);
free(name);
if (fd < 0)
return -1;
#ifdef HAVE_POSIX_FALLOCATE
ret = posix_fallocate(fd, 0, size);
if (ret != 0) {
close(fd);
errno = ret;
return -1;
}
#else
ret = ftruncate(fd, size);
if (ret < 0) {
close(fd);
return -1;
}
if (fd >= 0) {
/* We can add this seal before calling posix_fallocate(), as
* the file is currently zero-sized anyway.
*
* There is also no need to check for the return value, we
* couldn't do anything with it anyway.
*/
fcntl(fd, F_ADD_SEALS, F_SEAL_SHRINK | F_SEAL_SEAL);
} else
#endif
{
path = getenv("XDG_RUNTIME_DIR");
if (!path || path[0] != '/') {
errno = ENOENT;
return -1;
}
name_size = strlen(path) + sizeof(template);
name = malloc(name_size);
if (!name)
return -1;
snprintf(name, name_size, "%s%s", path, template);
fd = create_tmpfile_cloexec(name);
free(name);
if (fd < 0)
return -1;
}
if (os_resize_anonymous_file(fd, size) < 0) {
close(fd);
return -1;
}
return fd;
}
int
os_resize_anonymous_file(int fd, off_t size)
{
#ifdef HAVE_POSIX_FALLOCATE
sigset_t mask;
sigset_t old_mask;
/*
* posix_fallocate() might be interrupted, so we need to check
* for EINTR and retry in that case.
* However, in the presence of an alarm, the interrupt may trigger
* repeatedly and prevent a large posix_fallocate() to ever complete
* successfully, so we need to first block SIGALRM to prevent
* this.
*/
sigemptyset(&mask);
sigaddset(&mask, SIGALRM);
sigprocmask(SIG_BLOCK, &mask, &old_mask);
/*
* Filesystems that do not support fallocate will return EINVAL or
* EOPNOTSUPP. In this case we need to fall back to ftruncate
*/
do {
errno = posix_fallocate(fd, 0, size);
} while (errno == EINTR);
sigprocmask(SIG_SETMASK, &old_mask, NULL);
if (errno == 0)
return 0;
else if (errno != EINVAL && errno != EOPNOTSUPP)
return -1;
#endif
if (ftruncate(fd, size) < 0)
return -1;
return 0;
}

View file

@ -1,23 +1,26 @@
/*
* Copyright © 2012 Collabora, Ltd.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial
* portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef OS_COMPATIBILITY_H
@ -28,4 +31,7 @@
int
os_create_anonymous_file(off_t size);
int
os_resize_anonymous_file(int fd, off_t size);
#endif /* OS_COMPATIBILITY_H */

View file

@ -1,8 +0,0 @@
libdir=@abs_builddir@/.libs
includedir=@abs_srcdir@
Name: Wayland Cursor
Description: Wayland cursor helper library (not installed)
Version: @WAYLAND_VERSION@
Cflags: -I${includedir}
Libs: -L${libdir} -lwayland-cursor

View file

@ -1,31 +1,36 @@
/*
* Copyright © 2012 Intel Corporation
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial
* portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include "config.h"
#include "xcursor.h"
#include "wayland-cursor.h"
#include "wayland-client.h"
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <sys/mman.h>
@ -64,11 +69,16 @@ shm_pool_create(struct wl_shm *shm, int size)
goto err_close;
pool->pool = wl_shm_create_pool(shm, pool->fd, size);
if (!pool->pool)
goto err_unmap;
pool->size = size;
pool->used = 0;
return pool;
err_unmap:
munmap(pool->data, size);
err_close:
close(pool->fd);
err_free:
@ -79,22 +89,16 @@ err_free:
static int
shm_pool_resize(struct shm_pool *pool, int size)
{
if (ftruncate(pool->fd, size) < 0)
if (os_resize_anonymous_file(pool->fd, size) < 0)
return 0;
#ifdef HAVE_POSIX_FALLOCATE
errno = posix_fallocate(pool->fd, 0, size);
if (errno != 0)
return 0;
#endif
wl_shm_pool_resize(pool->pool, size);
munmap(pool->data, pool->size);
pool->data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED,
pool->fd, 0);
if (pool->data == (void *)-1)
if (pool->data == MAP_FAILED)
return 0;
pool->size = size;
@ -131,7 +135,6 @@ struct wl_cursor_theme {
struct wl_cursor **cursors;
struct wl_shm *shm;
struct shm_pool *pool;
char *name;
int size;
};
@ -154,32 +157,32 @@ struct cursor {
* the returned buffer.
*/
WL_EXPORT struct wl_buffer *
wl_cursor_image_get_buffer(struct wl_cursor_image *_img)
wl_cursor_image_get_buffer(struct wl_cursor_image *image)
{
struct cursor_image *image = (struct cursor_image *) _img;
struct wl_cursor_theme *theme = image->theme;
struct cursor_image *img = (struct cursor_image *) image;
struct wl_cursor_theme *theme = img->theme;
if (!image->buffer) {
image->buffer =
if (!img->buffer) {
img->buffer =
wl_shm_pool_create_buffer(theme->pool->pool,
image->offset,
_img->width, _img->height,
_img->width * 4,
img->offset,
image->width, image->height,
image->width * 4,
WL_SHM_FORMAT_ARGB8888);
};
return image->buffer;
return img->buffer;
}
static void
wl_cursor_image_destroy(struct wl_cursor_image *_img)
wl_cursor_image_destroy(struct wl_cursor_image *image)
{
struct cursor_image *image = (struct cursor_image *) _img;
struct cursor_image *img = (struct cursor_image *) image;
if (image->buffer)
wl_buffer_destroy(image->buffer);
if (img->buffer)
wl_buffer_destroy(img->buffer);
free(image);
free(img);
}
static void
@ -190,6 +193,7 @@ wl_cursor_destroy(struct wl_cursor *cursor)
for (i = 0; i < cursor->image_count; i++)
wl_cursor_image_destroy(cursor->images[i]);
free(cursor->images);
free(cursor->name);
free(cursor);
}
@ -253,13 +257,10 @@ err_free_cursor:
}
static void
load_default_theme(struct wl_cursor_theme *theme)
load_fallback_theme(struct wl_cursor_theme *theme)
{
uint32_t i;
free(theme->name);
theme->name = strdup("default");
theme->cursor_count = ARRAY_LENGTH(cursor_metadata);
theme->cursors = malloc(theme->cursor_count * sizeof(*theme->cursors));
@ -279,12 +280,13 @@ load_default_theme(struct wl_cursor_theme *theme)
}
static struct wl_cursor *
wl_cursor_create_from_xcursor_images(XcursorImages *images,
wl_cursor_create_from_xcursor_images(struct xcursor_images *images,
struct wl_cursor_theme *theme)
{
struct cursor *cursor;
struct cursor_image *image;
int i, size;
size_t size;
int i;
cursor = malloc(sizeof *cursor);
if (!cursor)
@ -314,7 +316,12 @@ wl_cursor_create_from_xcursor_images(XcursorImages *images,
image->image.hotspot_y = images->images[i]->yhot;
image->image.delay = images->images[i]->delay;
size = image->image.width * image->image.height * 4;
size = (size_t) image->image.width * image->image.height * 4;
if (size > INT_MAX) {
free(image);
break;
}
image->offset = shm_pool_allocate(theme->pool, size);
if (image->offset < 0) {
free(image);
@ -340,33 +347,34 @@ wl_cursor_create_from_xcursor_images(XcursorImages *images,
}
static void
load_callback(XcursorImages *images, void *data)
load_callback(struct xcursor_images *images, void *data)
{
struct wl_cursor_theme *theme = data;
struct wl_cursor *cursor;
struct wl_cursor **p;
size_t s;
if (wl_cursor_theme_get_cursor(theme, images->name)) {
XcursorImagesDestroy(images);
xcursor_images_destroy(images);
return;
}
cursor = wl_cursor_create_from_xcursor_images(images, theme);
if (cursor) {
theme->cursor_count++;
theme->cursors =
realloc(theme->cursors,
theme->cursor_count * sizeof theme->cursors[0]);
s = theme->cursor_count + 1;
p = realloc(theme->cursors, s * sizeof theme->cursors[0]);
if (theme->cursors == NULL) {
theme->cursor_count--;
if (p == NULL) {
free(cursor);
} else {
theme->cursor_count = s;
theme->cursors = p;
theme->cursors[theme->cursor_count - 1] = cursor;
}
}
XcursorImagesDestroy(images);
xcursor_images_destroy(images);
}
/** Load a cursor theme to memory shared with the compositor
@ -389,30 +397,31 @@ wl_cursor_theme_load(const char *name, int size, struct wl_shm *shm)
if (!theme)
return NULL;
if (size < 0 || (size > 0 && INT_MAX / size / 4 < size))
goto err;
if (!name)
name = "default";
theme->name = strdup(name);
if (!theme->name)
goto out_error_name;
theme->size = size;
theme->cursor_count = 0;
theme->cursors = NULL;
theme->pool = shm_pool_create(shm, size * size * 4);
if (!theme->pool)
goto out_error_pool;
goto err;
xcursor_load_theme(name, size, load_callback, theme);
if (theme->cursor_count == 0)
load_default_theme(theme);
xcursor_load_theme(NULL, size, load_callback, theme);
if (theme->cursor_count == 0)
load_fallback_theme(theme);
return theme;
out_error_pool:
free(theme->name);
out_error_name:
err:
free(theme);
return NULL;
}
@ -431,7 +440,6 @@ wl_cursor_theme_destroy(struct wl_cursor_theme *theme)
shm_pool_destroy(theme->pool);
free(theme->name);
free(theme->cursors);
free(theme);
}
@ -458,28 +466,67 @@ wl_cursor_theme_get_cursor(struct wl_cursor_theme *theme,
}
/** Find the frame for a given elapsed time in a cursor animation
* as well as the time left until next cursor change.
*
* \param cursor The cursor
* \param time Elapsed time since the beginning of the animation
* \param time Elapsed time in ms since the beginning of the animation
* \param duration pointer to uint32_t to store time left for this image or
* zero if the cursor won't change.
*
* \return The index of the image that should be displayed for the
* given time in the cursor animation.
*/
WL_EXPORT int
wl_cursor_frame(struct wl_cursor *_cursor, uint32_t time)
wl_cursor_frame_and_duration(struct wl_cursor *cursor, uint32_t time,
uint32_t *duration)
{
struct cursor *cursor = (struct cursor *) _cursor;
struct cursor *cur = (struct cursor *) cursor;
uint32_t t;
int i;
if (cursor->cursor.image_count == 1)
if (cur->cursor.image_count == 1 || cur->total_delay == 0) {
if (duration)
*duration = 0;
return 0;
}
i = 0;
t = time % cursor->total_delay;
t = time % cur->total_delay;
while (t - cursor->cursor.images[i]->delay < t)
t -= cursor->cursor.images[i++]->delay;
/* If there is a 0 delay in the image set then this
* loop breaks on it and we display that cursor until
* time % cursor->total_delay wraps again.
* Since a 0 delay is silly, and we've never actually
* seen one in a cursor file, we haven't bothered to
* "fix" this.
*/
while (t - cur->cursor.images[i]->delay < t)
t -= cur->cursor.images[i++]->delay;
if (!duration)
return i;
/* Make sure we don't accidentally tell the caller this is
* a static cursor image.
*/
if (t >= cur->cursor.images[i]->delay)
*duration = 1;
else
*duration = cur->cursor.images[i]->delay - t;
return i;
}
/** Find the frame for a given elapsed time in a cursor animation
*
* \param cursor The cursor
* \param time Elapsed time in ms since the beginning of the animation
*
* \return The index of the image that should be displayed for the
* given time in the cursor animation.
*/
WL_EXPORT int
wl_cursor_frame(struct wl_cursor *cursor, uint32_t time)
{
return wl_cursor_frame_and_duration(cursor, time, NULL);
}

View file

@ -1,23 +1,26 @@
/*
* Copyright © 2012 Intel Corporation
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial
* portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef WAYLAND_CURSOR_H
@ -30,23 +33,42 @@ extern "C" {
#endif
struct wl_cursor_theme;
struct wl_buffer;
struct wl_shm;
/** A still image part of a cursor
*
* Use `wl_cursor_image_get_buffer()` to get the corresponding `struct
* wl_buffer` to attach to your `struct wl_surface`. */
struct wl_cursor_image {
uint32_t width; /* actual width */
uint32_t height; /* actual height */
uint32_t hotspot_x; /* hot spot x (must be inside image) */
uint32_t hotspot_y; /* hot spot y (must be inside image) */
uint32_t delay; /* animation delay to next frame (ms) */
/** Actual width */
uint32_t width;
/** Actual height */
uint32_t height;
/** Hot spot x (must be inside image) */
uint32_t hotspot_x;
/** Hot spot y (must be inside image) */
uint32_t hotspot_y;
/** Animation delay to next frame (ms) */
uint32_t delay;
};
/** A cursor, as returned by `wl_cursor_theme_get_cursor()` */
struct wl_cursor {
/** How many images there are in this cursors animation */
unsigned int image_count;
/** The array of still images composing this animation */
struct wl_cursor_image **images;
/** The name of this cursor */
char *name;
};
struct wl_shm;
struct wl_cursor_theme *
wl_cursor_theme_load(const char *name, int size, struct wl_shm *shm);
@ -63,6 +85,10 @@ wl_cursor_image_get_buffer(struct wl_cursor_image *image);
int
wl_cursor_frame(struct wl_cursor *cursor, uint32_t time);
int
wl_cursor_frame_and_duration(struct wl_cursor *cursor, uint32_t time,
uint32_t *duration);
#ifdef __cplusplus
}
#endif

View file

@ -1,10 +0,0 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: Wayland Cursor
Description: Wayland cursor helper library
Version: @WAYLAND_VERSION@
Cflags: -I${includedir}
Libs: -L${libdir} -lwayland-cursor

File diff suppressed because it is too large Load diff

View file

@ -1,62 +1,58 @@
/*
* Copyright © 2002 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial
* portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef XCURSOR_H
#define XCURSOR_H
typedef int XcursorBool;
typedef unsigned int XcursorUInt;
#include <stdint.h>
typedef XcursorUInt XcursorDim;
typedef XcursorUInt XcursorPixel;
typedef struct _XcursorImage {
XcursorUInt version; /* version of the image data */
XcursorDim size; /* nominal size for matching */
XcursorDim width; /* actual width */
XcursorDim height; /* actual height */
XcursorDim xhot; /* hot spot x (must be inside image) */
XcursorDim yhot; /* hot spot y (must be inside image) */
XcursorUInt delay; /* animation delay to next frame (ms) */
XcursorPixel *pixels; /* pointer to pixels */
} XcursorImage;
struct xcursor_image {
uint32_t version; /* version of the image data */
uint32_t size; /* nominal size for matching */
uint32_t width; /* actual width */
uint32_t height; /* actual height */
uint32_t xhot; /* hot spot x (must be inside image) */
uint32_t yhot; /* hot spot y (must be inside image) */
uint32_t delay; /* animation delay to next frame (ms) */
uint32_t *pixels; /* pointer to pixels */
};
/*
* Other data structures exposed by the library API
*/
typedef struct _XcursorImages {
int nimage; /* number of images */
XcursorImage **images; /* array of XcursorImage pointers */
char *name; /* name used to load images */
} XcursorImages;
XcursorImages *
XcursorLibraryLoadImages (const char *file, const char *theme, int size);
struct xcursor_images {
int nimage; /* number of images */
struct xcursor_image **images; /* array of XcursorImage pointers */
char *name; /* name used to load images */
};
void
XcursorImagesDestroy (XcursorImages *images);
xcursor_images_destroy(struct xcursor_images *images);
void
xcursor_load_theme(const char *theme, int size,
void (*load_callback)(XcursorImages *, void *),
void *user_data);
void (*load_callback)(struct xcursor_images *, void *),
void *user_data);
#endif

View file

@ -1,83 +0,0 @@
= Contributing to Wayland =
== Sending patches ==
Patches should be sent to wayland-devel@lists.freedesktop.org, using
git send-email. See git's documentation for help [1].
The first line of a commit message should contain a prefix indicating
what part is affected by the patch followed by one sentence that
describes the change. For examples:
protocol: Support scaled outputs and surfaces
and
doc: generate server documentation from XML too
If in doubt what prefix to use, look at other commits that change the
same file(s) as the patch being sent.
The body of the commit message should describe what the patch changes
and why, and also note any particular side effects. This shouldn't be
empty on most of the cases. It shouldn't take a lot of effort to write
a commit message for an obvious change, so an empty commit message
body is only acceptable if the questions "What?" and "Why" are already
answered on the one-line summary.
The lines of the commit message should have at most 76 characters, to
cope with the way git log presents them.
See [2] for a recommend reading on writing commit messages.
== Coding style ==
You should follow the style of the file you're editing. In general, we
try to follow the rules below.
- indent with tabs, and a tab is always 8 characters wide
- opening braces are on the same line as the if statement;
- no braces in an if-body with just one statement;
- if one of the branches of an if-else codition has braces, than the
other branch should also have braces;
- there is always an empty line between variable declarations and the
code;
static int
my_function(void)
{
int a = 0;
if (a)
b();
else
c();
if (a) {
b();
c();
} else {
d();
}
}
- lines should be less than 80 characters wide;
- when breaking lines with functions calls, the parameters are aligned
with the opening parenthesis;
- when assigning a variable with the result of a function call, if the
line would be longer we break it around the equal '=' sign if it makes
sense;
long_variable_name =
function_with_a_really_long_name(parameter1, parameter2,
parameter3, parameter4);
x = function_with_a_really_long_name(parameter1, parameter2,
parameter3, parameter4);
== References ==
[1] http://git-scm.com/documentation
[2] http://who-t.blogspot.de/2009/12/on-commit-messages.html

View file

@ -1,3 +0,0 @@
SUBDIRS = doxygen publican man
EXTRA_DIST = Contributing

1
doc/book/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/book

9
doc/book/book.toml Normal file
View file

@ -0,0 +1,9 @@
[book]
title = "Wayland"
authors = ["Kristian Høgsberg"]
language = "en"
[output.html]
git-repository-url = "https://gitlab.freedesktop.org/wayland/wayland"
edit-url-template = "https://gitlab.freedesktop.org/wayland/wayland/-/edit/main/doc/book/{path}"
site-url = "/docs/book/"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,198 @@
<mxfile host="Electron" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/29.0.3 Chrome/140.0.7339.249 Electron/38.7.0 Safari/537.36" version="29.0.3" pages="6">
<diagram name="state 1" id="9R2pyHIIQvV-60tET7sh">
<mxGraphModel dx="446" dy="299" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="450" pageHeight="250" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="Vljyf9wL_jF0PBdsZ3ZJ-56" value="1" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;plain-blue;gradientColor=none;fillColor=#B5E3Fe;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="1">
<mxGeometry x="119" y="25" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="Vljyf9wL_jF0PBdsZ3ZJ-57" value="SS2" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="1">
<mxGeometry y="20" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="Vljyf9wL_jF0PBdsZ3ZJ-58" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="1">
<mxGeometry x="45" y="25" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="Vljyf9wL_jF0PBdsZ3ZJ-59" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="1">
<mxGeometry x="45" y="105" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="Vljyf9wL_jF0PBdsZ3ZJ-60" value="SS1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="1">
<mxGeometry y="100" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="Vljyf9wL_jF0PBdsZ3ZJ-61" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="1">
<mxGeometry x="45" y="185" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="Vljyf9wL_jF0PBdsZ3ZJ-62" value="T1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="1">
<mxGeometry y="180" width="40" height="40" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
<diagram id="J0DvB8TbWnCMMz7TEYbc" name="state 2">
<mxGraphModel dx="446" dy="299" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="450" pageHeight="250" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="NNa_h0o6fpdAX9mVI6Ni-1" value="" style="verticalLabelPosition=bottom;verticalAlign=top;html=1;shape=mxgraph.basic.polygon;polyCoords=[[0.45,0],[0.75,0],[1,0],[1,1],[0.62,1],[0,1],[0,1],[0,1],[0,0.2],[0,0],[0.24,0]];polyline=0;fillColor=none;dashed=1;strokeColor=#CC00CC;strokeWidth=2;perimeterSpacing=0;shadow=1;sketch=1;curveFitting=1;jiggle=2;fixDash=0;container=0;dropTarget=0;" vertex="1" parent="1">
<mxGeometry x="110" y="20" width="50" height="40" as="geometry" />
</mxCell>
<mxCell id="NNa_h0o6fpdAX9mVI6Ni-2" value="1" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;plain-blue;gradientColor=none;fillColor=#B5E3Fe;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="1">
<mxGeometry x="119" y="25" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="NNa_h0o6fpdAX9mVI6Ni-3" value="SS2" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="1">
<mxGeometry y="20" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="NNa_h0o6fpdAX9mVI6Ni-4" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="1">
<mxGeometry x="45" y="25" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="NNa_h0o6fpdAX9mVI6Ni-5" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="1">
<mxGeometry x="45" y="105" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="NNa_h0o6fpdAX9mVI6Ni-6" value="SS1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="1">
<mxGeometry y="100" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="NNa_h0o6fpdAX9mVI6Ni-7" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="1">
<mxGeometry x="45" y="185" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="NNa_h0o6fpdAX9mVI6Ni-8" value="T1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="1">
<mxGeometry y="180" width="40" height="40" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
<diagram id="ySO0QrqtFkECLiZt7iPp" name="state 3">
<mxGraphModel dx="701" dy="470" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="450" pageHeight="250" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="pI76myQ_i7gC2-BWcum8-1" value="SS2" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="1">
<mxGeometry y="20" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="pI76myQ_i7gC2-BWcum8-2" value="&lt;b&gt;1&lt;/b&gt;" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="1">
<mxGeometry x="45" y="25" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="pI76myQ_i7gC2-BWcum8-3" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="1">
<mxGeometry x="45" y="105" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="pI76myQ_i7gC2-BWcum8-4" value="SS1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="1">
<mxGeometry y="100" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="pI76myQ_i7gC2-BWcum8-5" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="1">
<mxGeometry x="45" y="185" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="pI76myQ_i7gC2-BWcum8-6" value="T1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="1">
<mxGeometry y="180" width="40" height="40" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
<diagram id="Kx24UVXuaWmlcUcIS4GM" name="state 4">
<mxGraphModel dx="446" dy="299" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="450" pageHeight="250" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="v1jzpavZj8JK8wO-OO9X-1" value="SS2" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="1">
<mxGeometry y="20" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="v1jzpavZj8JK8wO-OO9X-2" value="&lt;b&gt;1&lt;/b&gt;" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="1">
<mxGeometry x="45" y="25" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="v1jzpavZj8JK8wO-OO9X-3" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="1">
<mxGeometry x="45" y="105" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="v1jzpavZj8JK8wO-OO9X-4" value="SS1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="1">
<mxGeometry y="100" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="v1jzpavZj8JK8wO-OO9X-5" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="1">
<mxGeometry x="45" y="185" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="v1jzpavZj8JK8wO-OO9X-6" value="T1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="1">
<mxGeometry y="180" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="v1jzpavZj8JK8wO-OO9X-7" value="2" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;plain-blue;gradientColor=none;fillColor=#B5E3Fe;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="1">
<mxGeometry x="120" y="185" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="v1jzpavZj8JK8wO-OO9X-8" value="B" style="verticalLabelPosition=middle;verticalAlign=middle;html=1;strokeWidth=1;shape=mxgraph.flowchart.on-page_reference;strokeColor=#b85450;fillColor=#f8cecc;labelPosition=center;align=center;dashed=1;fontStyle=1;spacing=0;spacingBottom=2;" vertex="1" parent="1">
<mxGeometry x="120" y="180" width="14" height="14" as="geometry" />
</mxCell>
<mxCell id="v1jzpavZj8JK8wO-OO9X-9" value="" style="verticalLabelPosition=bottom;verticalAlign=top;html=1;shape=mxgraph.basic.polygon;polyCoords=[[0.45,0],[0.75,0],[1,0],[1,1],[0.62,1],[0,1],[0,1],[0,1],[0,0.2],[0,0],[0.24,0]];polyline=0;fillColor=none;dashed=1;strokeColor=#CC00CC;strokeWidth=2;perimeterSpacing=0;shadow=1;sketch=1;curveFitting=1;jiggle=2;fixDash=0;container=0;dropTarget=0;" vertex="1" parent="1">
<mxGeometry x="110" y="180" width="50" height="40" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
<diagram id="0yCGw3I3AjIYRBlyI2Mm" name="state 5">
<mxGraphModel dx="446" dy="299" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="450" pageHeight="250" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="z-ZDJLvQiKHsJtFRiBHY-1" value="" style="verticalLabelPosition=bottom;verticalAlign=top;html=1;shape=mxgraph.basic.polygon;polyCoords=[[0.45,0],[0.75,0],[1,0],[1,1],[0.62,1],[0,1],[0,1],[0,1],[0,0.2],[0,0],[0.24,0]];polyline=0;fillColor=none;dashed=1;strokeColor=#CC00CC;strokeWidth=2;perimeterSpacing=0;shadow=1;sketch=1;curveFitting=1;jiggle=2;fixDash=0;container=0;dropTarget=0;" vertex="1" parent="1">
<mxGeometry x="102" y="170" width="148" height="60" as="geometry" />
</mxCell>
<mxCell id="z-ZDJLvQiKHsJtFRiBHY-2" value="" style="verticalLabelPosition=bottom;verticalAlign=top;html=1;shape=mxgraph.basic.polygon;polyCoords=[[0.45,0],[0.75,0],[1,0],[1,1],[0.62,1],[0,1],[0,1],[0,1],[0,0.2],[0,0],[0.24,0]];polyline=0;fillColor=none;dashed=1;strokeColor=#CC00CC;strokeWidth=2;perimeterSpacing=0;shadow=1;sketch=1;curveFitting=1;jiggle=2;fixDash=0;container=0;dropTarget=0;" vertex="1" parent="1">
<mxGeometry x="110" y="180" width="50" height="40" as="geometry" />
</mxCell>
<mxCell id="z-ZDJLvQiKHsJtFRiBHY-3" value="2" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;plain-blue;gradientColor=none;fillColor=#B5E3Fe;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="1">
<mxGeometry x="120" y="185" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="z-ZDJLvQiKHsJtFRiBHY-4" value="B" style="verticalLabelPosition=middle;verticalAlign=middle;html=1;strokeWidth=1;shape=mxgraph.flowchart.on-page_reference;strokeColor=#b85450;fillColor=#f8cecc;labelPosition=center;align=center;dashed=1;fontStyle=1;spacing=0;spacingBottom=2;" vertex="1" parent="1">
<mxGeometry x="120" y="180" width="14" height="14" as="geometry" />
</mxCell>
<mxCell id="z-ZDJLvQiKHsJtFRiBHY-5" value="SS2" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="1">
<mxGeometry y="20" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="z-ZDJLvQiKHsJtFRiBHY-6" value="&lt;b&gt;1&lt;br&gt;&lt;/b&gt;" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="1">
<mxGeometry x="45" y="25" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="z-ZDJLvQiKHsJtFRiBHY-7" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="1">
<mxGeometry x="45" y="105" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="z-ZDJLvQiKHsJtFRiBHY-8" value="SS1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="1">
<mxGeometry y="100" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="z-ZDJLvQiKHsJtFRiBHY-9" value="&lt;b&gt;&lt;br&gt;&lt;/b&gt;" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="1">
<mxGeometry x="45" y="185" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="z-ZDJLvQiKHsJtFRiBHY-10" value="T1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="1">
<mxGeometry y="180" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="z-ZDJLvQiKHsJtFRiBHY-11" value="3" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;plain-blue;gradientColor=none;fillColor=#B5E3Fe;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="1">
<mxGeometry x="200" y="185" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="z-ZDJLvQiKHsJtFRiBHY-12" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;" edge="1" parent="1" source="z-ZDJLvQiKHsJtFRiBHY-11" target="z-ZDJLvQiKHsJtFRiBHY-3">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="209" y="160" as="sourcePoint" />
<mxPoint x="159" y="160" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
</root>
</mxGraphModel>
</diagram>
<diagram id="rl79urPFriLDlxviKeb4" name="state 6">
<mxGraphModel dx="446" dy="299" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="450" pageHeight="250" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="-BeM0r6oPtfcQ-rT40E6-1" value="SS2" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="1">
<mxGeometry y="20" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="-BeM0r6oPtfcQ-rT40E6-2" value="&lt;b&gt;1&lt;br&gt;&lt;/b&gt;" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="1">
<mxGeometry x="45" y="25" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="-BeM0r6oPtfcQ-rT40E6-3" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="1">
<mxGeometry x="45" y="105" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="-BeM0r6oPtfcQ-rT40E6-4" value="SS1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="1">
<mxGeometry y="100" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="-BeM0r6oPtfcQ-rT40E6-5" value="&lt;b&gt;2, 3&lt;/b&gt;" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="1">
<mxGeometry x="45" y="185" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="-BeM0r6oPtfcQ-rT40E6-6" value="T1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="1">
<mxGeometry y="180" width="40" height="40" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>

View file

@ -0,0 +1,207 @@
<mxfile host="Electron" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/29.0.3 Chrome/140.0.7339.249 Electron/38.7.0 Safari/537.36" version="29.0.3" pages="5">
<diagram name="state 1" id="W-2uyegr0hxMwi0Wm8H9">
<mxGraphModel dx="452" dy="307" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="450" pageHeight="250" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="B5W2QRrcq4c7WbW7dQDT-1" value="1" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;plain-blue;gradientColor=none;fillColor=#D5E8D4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="1">
<mxGeometry x="120" y="25" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="B5W2QRrcq4c7WbW7dQDT-2" value="SS2" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="1">
<mxGeometry y="20" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="B5W2QRrcq4c7WbW7dQDT-3" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="1">
<mxGeometry x="45" y="25" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="B5W2QRrcq4c7WbW7dQDT-4" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="1">
<mxGeometry x="45" y="105" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="B5W2QRrcq4c7WbW7dQDT-5" value="SS1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="1">
<mxGeometry y="100" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="B5W2QRrcq4c7WbW7dQDT-6" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="1">
<mxGeometry x="45" y="185" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="B5W2QRrcq4c7WbW7dQDT-7" value="T1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="1">
<mxGeometry y="180" width="40" height="40" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
<diagram id="GeoL4XoRYetvg1q4LOzn" name="state 2">
<mxGraphModel dx="452" dy="307" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="450" pageHeight="250" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="JhubsHDD-TggGAyBPSTr-1" value="1" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;plain-blue;gradientColor=none;fillColor=#D5E8D4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="1">
<mxGeometry x="120" y="25" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="JhubsHDD-TggGAyBPSTr-2" value="SS2" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="1">
<mxGeometry y="20" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="JhubsHDD-TggGAyBPSTr-3" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="1">
<mxGeometry x="45" y="25" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="JhubsHDD-TggGAyBPSTr-4" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="1">
<mxGeometry x="45" y="105" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="JhubsHDD-TggGAyBPSTr-5" value="SS1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="1">
<mxGeometry y="100" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="JhubsHDD-TggGAyBPSTr-6" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="1">
<mxGeometry x="45" y="185" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="JhubsHDD-TggGAyBPSTr-7" value="T1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="1">
<mxGeometry y="180" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="JhubsHDD-TggGAyBPSTr-8" value="2" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;plain-blue;gradientColor=none;fillColor=#D5E8D4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="1">
<mxGeometry x="120" y="105" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="JhubsHDD-TggGAyBPSTr-9" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;" edge="1" parent="1" source="JhubsHDD-TggGAyBPSTr-8" target="JhubsHDD-TggGAyBPSTr-1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="302.5" y="130" as="sourcePoint" />
<mxPoint x="252.5" y="130" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
</root>
</mxGraphModel>
</diagram>
<diagram id="svgPSnmsjaSZccQ20U9g" name="state 3">
<mxGraphModel dx="452" dy="307" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="450" pageHeight="250" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="2cyrzz5kdchdPGbAOOf7-1" value="SS2" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="1">
<mxGeometry y="20" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="2cyrzz5kdchdPGbAOOf7-2" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="1">
<mxGeometry x="45" y="25" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="2cyrzz5kdchdPGbAOOf7-3" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="1">
<mxGeometry x="45" y="105" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="2cyrzz5kdchdPGbAOOf7-4" value="SS1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="1">
<mxGeometry y="100" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="2cyrzz5kdchdPGbAOOf7-5" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="1">
<mxGeometry x="45" y="185" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="2cyrzz5kdchdPGbAOOf7-6" value="T1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="1">
<mxGeometry y="180" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="2cyrzz5kdchdPGbAOOf7-7" value="1" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;plain-blue;gradientColor=none;fillColor=#D5E8D4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="1">
<mxGeometry x="120" y="25" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="2cyrzz5kdchdPGbAOOf7-8" value="2" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;plain-blue;gradientColor=none;fillColor=#D5E8D4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="1">
<mxGeometry x="120" y="105" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="2cyrzz5kdchdPGbAOOf7-9" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;" edge="1" parent="1" source="2cyrzz5kdchdPGbAOOf7-8" target="2cyrzz5kdchdPGbAOOf7-7">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="302" y="130" as="sourcePoint" />
<mxPoint x="252" y="130" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="2cyrzz5kdchdPGbAOOf7-10" value="3" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;plain-blue;gradientColor=none;fillColor=#D5E8D4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="1">
<mxGeometry x="200" y="105" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="2cyrzz5kdchdPGbAOOf7-11" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;" edge="1" parent="1" source="2cyrzz5kdchdPGbAOOf7-10" target="2cyrzz5kdchdPGbAOOf7-8">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="199.5" y="140" as="sourcePoint" />
<mxPoint x="199.5" y="90" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
</root>
</mxGraphModel>
</diagram>
<diagram id="ddwt5pxY8eCGA5Yld8Ut" name="state 4">
<mxGraphModel dx="452" dy="307" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="450" pageHeight="250" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="XKeFNdCRafvIn0IOzWkK-1" value="" style="verticalLabelPosition=bottom;verticalAlign=top;html=1;shape=mxgraph.basic.polygon;polyCoords=[[0.45,0],[0.46,0.36],[1,0.36],[1,1],[0.62,1],[0.54,1],[0.54,0.64],[0,0.64],[0,0.2],[0,0],[0.24,0]];polyline=0;fillColor=none;dashed=1;strokeColor=#CC00CC;strokeWidth=2;perimeterSpacing=0;shadow=1;sketch=1;curveFitting=1;jiggle=2;fixDash=0;container=0;dropTarget=0;" vertex="1" parent="1">
<mxGeometry x="110" y="10" width="130" height="220" as="geometry" />
</mxCell>
<mxCell id="XKeFNdCRafvIn0IOzWkK-2" value="SS2" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="1">
<mxGeometry y="20" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="XKeFNdCRafvIn0IOzWkK-3" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="1">
<mxGeometry x="45" y="25" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="XKeFNdCRafvIn0IOzWkK-4" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="1">
<mxGeometry x="45" y="105" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="XKeFNdCRafvIn0IOzWkK-5" value="SS1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="1">
<mxGeometry y="100" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="XKeFNdCRafvIn0IOzWkK-6" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="1">
<mxGeometry x="45" y="185" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="XKeFNdCRafvIn0IOzWkK-7" value="T1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="1">
<mxGeometry y="180" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="XKeFNdCRafvIn0IOzWkK-8" value="4" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;plain-blue;gradientColor=none;fillColor=#B5E3Fe;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="1">
<mxGeometry x="200" y="185" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="XKeFNdCRafvIn0IOzWkK-9" value="1" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;plain-blue;gradientColor=none;fillColor=#D5E8D4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="1">
<mxGeometry x="120" y="25" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="XKeFNdCRafvIn0IOzWkK-10" value="2" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;plain-blue;gradientColor=none;fillColor=#D5E8D4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="1">
<mxGeometry x="120" y="105" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="XKeFNdCRafvIn0IOzWkK-11" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;" edge="1" parent="1" source="XKeFNdCRafvIn0IOzWkK-10" target="XKeFNdCRafvIn0IOzWkK-9">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="303" y="130" as="sourcePoint" />
<mxPoint x="253" y="130" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="XKeFNdCRafvIn0IOzWkK-12" value="3" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;plain-blue;gradientColor=none;fillColor=#D5E8D4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="1">
<mxGeometry x="200" y="105" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="XKeFNdCRafvIn0IOzWkK-13" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;" edge="1" parent="1" source="XKeFNdCRafvIn0IOzWkK-12" target="XKeFNdCRafvIn0IOzWkK-10">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="200.5" y="140" as="sourcePoint" />
<mxPoint x="200.5" y="90" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="XKeFNdCRafvIn0IOzWkK-14" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;" edge="1" parent="1" source="XKeFNdCRafvIn0IOzWkK-8" target="XKeFNdCRafvIn0IOzWkK-12">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="310.5" y="150" as="sourcePoint" />
<mxPoint x="260.5" y="150" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
</root>
</mxGraphModel>
</diagram>
<diagram id="yHjaI6yTqZ63goZKKFoW" name="state 5">
<mxGraphModel dx="452" dy="307" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="450" pageHeight="250" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="yybNvkjd9s6HATvzKrxT-1" value="SS2" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="1">
<mxGeometry y="20" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="yybNvkjd9s6HATvzKrxT-2" value="&lt;b&gt;1&lt;br&gt;&lt;/b&gt;" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="1">
<mxGeometry x="45" y="25" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="yybNvkjd9s6HATvzKrxT-3" value="&lt;b&gt;2, 3&lt;/b&gt;" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="1">
<mxGeometry x="45" y="105" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="yybNvkjd9s6HATvzKrxT-4" value="SS1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="1">
<mxGeometry y="100" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="yybNvkjd9s6HATvzKrxT-5" value="&lt;b&gt;4&lt;/b&gt;" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="1">
<mxGeometry x="45" y="185" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="yybNvkjd9s6HATvzKrxT-6" value="T1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="1">
<mxGeometry y="180" width="40" height="40" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>

View file

@ -0,0 +1,500 @@
<mxfile host="Electron" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/26.1.1 Chrome/132.0.6834.210 Electron/34.3.3 Safari/537.36" version="26.1.1" pages="5">
<diagram name="state 1" id="piv4MB1wSOUai22uoHMj">
<mxGraphModel dx="1149" dy="774" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="450" pageHeight="250" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="BNEKj4FSaMJSDyX3_cBq-27" value="" style="group" vertex="1" connectable="0" parent="1">
<mxGeometry x="10" y="10" width="390" height="220" as="geometry" />
</mxCell>
<mxCell id="BNEKj4FSaMJSDyX3_cBq-1" value="" style="verticalLabelPosition=bottom;verticalAlign=top;html=1;shape=mxgraph.basic.polygon;polyCoords=[[0,0],[0.75,0],[1,0],[1,1],[0.21,1],[0,1],[0,1],[0,0.73],[0.64,0.73],[0.64,0.27],[0,0.27]];polyline=0;fillColor=none;dashed=1;strokeColor=#CC00CC;strokeWidth=2;perimeterSpacing=0;shadow=1;sketch=1;curveFitting=1;jiggle=2;fixDash=0;container=0;dropTarget=0;" vertex="1" parent="BNEKj4FSaMJSDyX3_cBq-27">
<mxGeometry x="100" width="140" height="220" as="geometry" />
</mxCell>
<mxCell id="BNEKj4FSaMJSDyX3_cBq-2" value="" style="verticalLabelPosition=bottom;verticalAlign=top;html=1;shape=mxgraph.basic.polygon;polyCoords=[[0.45,0],[0.75,0],[1,0],[1,1],[0.62,1],[0,1],[0,1],[0,1],[0,0.2],[0,0],[0.24,0]];polyline=0;fillColor=none;dashed=1;strokeColor=#CC00CC;strokeWidth=2;perimeterSpacing=0;shadow=1;sketch=1;curveFitting=1;jiggle=2;fixDash=0;container=0;dropTarget=0;" vertex="1" parent="BNEKj4FSaMJSDyX3_cBq-27">
<mxGeometry x="110" y="170" width="50" height="40" as="geometry" />
</mxCell>
<mxCell id="BNEKj4FSaMJSDyX3_cBq-3" value="SS2" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="BNEKj4FSaMJSDyX3_cBq-27">
<mxGeometry y="10" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="BNEKj4FSaMJSDyX3_cBq-4" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="BNEKj4FSaMJSDyX3_cBq-27">
<mxGeometry x="45" y="15" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="BNEKj4FSaMJSDyX3_cBq-5" value="2" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="BNEKj4FSaMJSDyX3_cBq-27">
<mxGeometry x="120" y="15" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="BNEKj4FSaMJSDyX3_cBq-6" value="3" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="BNEKj4FSaMJSDyX3_cBq-27">
<mxGeometry x="200" y="15" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="BNEKj4FSaMJSDyX3_cBq-7" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="BNEKj4FSaMJSDyX3_cBq-27" source="BNEKj4FSaMJSDyX3_cBq-6" target="BNEKj4FSaMJSDyX3_cBq-5">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="190" y="70" as="sourcePoint" />
<mxPoint x="140" y="70" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="BNEKj4FSaMJSDyX3_cBq-8" value="5" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="BNEKj4FSaMJSDyX3_cBq-27">
<mxGeometry x="280" y="15" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="BNEKj4FSaMJSDyX3_cBq-9" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="BNEKj4FSaMJSDyX3_cBq-27" source="BNEKj4FSaMJSDyX3_cBq-8" target="BNEKj4FSaMJSDyX3_cBq-6">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="270" y="30" as="sourcePoint" />
<mxPoint x="240" y="40" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="BNEKj4FSaMJSDyX3_cBq-10" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="BNEKj4FSaMJSDyX3_cBq-27">
<mxGeometry x="45" y="95" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="BNEKj4FSaMJSDyX3_cBq-11" value="4" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="BNEKj4FSaMJSDyX3_cBq-27">
<mxGeometry x="200" y="95" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="BNEKj4FSaMJSDyX3_cBq-12" value="SS1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="BNEKj4FSaMJSDyX3_cBq-27">
<mxGeometry y="90" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="BNEKj4FSaMJSDyX3_cBq-13" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="BNEKj4FSaMJSDyX3_cBq-27">
<mxGeometry x="45" y="175" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="BNEKj4FSaMJSDyX3_cBq-14" value="T1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="BNEKj4FSaMJSDyX3_cBq-27">
<mxGeometry y="170" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="BNEKj4FSaMJSDyX3_cBq-15" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;" edge="1" parent="BNEKj4FSaMJSDyX3_cBq-27" source="BNEKj4FSaMJSDyX3_cBq-11" target="BNEKj4FSaMJSDyX3_cBq-6">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="290" y="40" as="sourcePoint" />
<mxPoint x="240" y="40" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="BNEKj4FSaMJSDyX3_cBq-16" value="7" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="BNEKj4FSaMJSDyX3_cBq-27">
<mxGeometry x="280" y="95" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="BNEKj4FSaMJSDyX3_cBq-17" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="BNEKj4FSaMJSDyX3_cBq-27" source="BNEKj4FSaMJSDyX3_cBq-16">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="270" y="110" as="sourcePoint" />
<mxPoint x="230" y="110" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="BNEKj4FSaMJSDyX3_cBq-18" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;" edge="1" parent="BNEKj4FSaMJSDyX3_cBq-27" source="BNEKj4FSaMJSDyX3_cBq-16" target="BNEKj4FSaMJSDyX3_cBq-8">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="225" y="105" as="sourcePoint" />
<mxPoint x="225" y="55" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="BNEKj4FSaMJSDyX3_cBq-19" value="8" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="BNEKj4FSaMJSDyX3_cBq-27">
<mxGeometry x="360" y="15" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="BNEKj4FSaMJSDyX3_cBq-20" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="BNEKj4FSaMJSDyX3_cBq-27" source="BNEKj4FSaMJSDyX3_cBq-19">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="350" y="30" as="sourcePoint" />
<mxPoint x="310" y="30" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="BNEKj4FSaMJSDyX3_cBq-21" value="6" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;plain-blue;gradientColor=none;fillColor=#B5E3Fe;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="BNEKj4FSaMJSDyX3_cBq-27">
<mxGeometry x="200" y="175" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="BNEKj4FSaMJSDyX3_cBq-22" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;" edge="1" parent="BNEKj4FSaMJSDyX3_cBq-27" source="BNEKj4FSaMJSDyX3_cBq-21">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="225" y="105" as="sourcePoint" />
<mxPoint x="215" y="125" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="BNEKj4FSaMJSDyX3_cBq-23" value="1" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;plain-blue;gradientColor=none;fillColor=#B5E3Fe;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="BNEKj4FSaMJSDyX3_cBq-27">
<mxGeometry x="120" y="175" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="BNEKj4FSaMJSDyX3_cBq-24" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;" edge="1" parent="BNEKj4FSaMJSDyX3_cBq-27" source="BNEKj4FSaMJSDyX3_cBq-21" target="BNEKj4FSaMJSDyX3_cBq-23">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="145" y="105" as="sourcePoint" />
<mxPoint x="135" y="125" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="BNEKj4FSaMJSDyX3_cBq-25" value="B" style="verticalLabelPosition=middle;verticalAlign=middle;html=1;strokeWidth=1;shape=mxgraph.flowchart.on-page_reference;strokeColor=#b85450;fillColor=#f8cecc;labelPosition=center;align=center;dashed=1;fontStyle=1;spacing=0;spacingBottom=2;" vertex="1" parent="BNEKj4FSaMJSDyX3_cBq-27">
<mxGeometry x="120" y="170" width="14" height="14" as="geometry" />
</mxCell>
<mxCell id="BNEKj4FSaMJSDyX3_cBq-26" value="B" style="verticalLabelPosition=middle;verticalAlign=middle;html=1;strokeWidth=1;shape=mxgraph.flowchart.on-page_reference;strokeColor=#b85450;fillColor=#f8cecc;labelPosition=center;align=center;dashed=1;fontStyle=1;spacing=0;spacingBottom=2;" vertex="1" parent="BNEKj4FSaMJSDyX3_cBq-27">
<mxGeometry x="200" y="90" width="14" height="14" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
<diagram id="AmVTVAnnSdh7PAwgHQ-J" name="state 2">
<mxGraphModel dx="1149" dy="774" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="450" pageHeight="250" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="-tglhTkY9j0lAeJh4ESk-26" value="" style="group" vertex="1" connectable="0" parent="1">
<mxGeometry x="10" y="10" width="390" height="220" as="geometry" />
</mxCell>
<mxCell id="-tglhTkY9j0lAeJh4ESk-1" value="" style="verticalLabelPosition=bottom;verticalAlign=top;html=1;shape=mxgraph.basic.polygon;polyCoords=[[0.45,0],[0.75,0],[1,0],[1,1],[0.62,1],[0,1],[0,1],[0,1],[0,0.2],[0,0],[0.24,0]];polyline=0;fillColor=none;dashed=1;strokeColor=#CC00CC;strokeWidth=2;perimeterSpacing=0;shadow=1;sketch=1;curveFitting=1;jiggle=2;fixDash=0;container=0;dropTarget=0;" vertex="1" parent="-tglhTkY9j0lAeJh4ESk-26">
<mxGeometry x="111" y="170" width="50" height="40" as="geometry" />
</mxCell>
<mxCell id="-tglhTkY9j0lAeJh4ESk-2" value="" style="verticalLabelPosition=bottom;verticalAlign=top;html=1;shape=mxgraph.basic.polygon;polyCoords=[[0,0],[0.75,0],[1,0],[1,1],[0.21,1],[0,1],[0,1],[0,0.73],[0.64,0.73],[0.64,0.27],[0,0.27]];polyline=0;fillColor=none;dashed=1;strokeColor=#CC00CC;strokeWidth=2;perimeterSpacing=0;shadow=1;sketch=1;curveFitting=1;jiggle=2;fixDash=0;container=0;dropTarget=0;movable=1;resizable=1;rotatable=1;deletable=1;editable=1;locked=0;connectable=1;" vertex="1" parent="-tglhTkY9j0lAeJh4ESk-26">
<mxGeometry x="101" width="140" height="220" as="geometry" />
</mxCell>
<mxCell id="-tglhTkY9j0lAeJh4ESk-3" value="SS2" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="-tglhTkY9j0lAeJh4ESk-26">
<mxGeometry y="10" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="-tglhTkY9j0lAeJh4ESk-4" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="-tglhTkY9j0lAeJh4ESk-26">
<mxGeometry x="45" y="15" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="-tglhTkY9j0lAeJh4ESk-5" value="2" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="-tglhTkY9j0lAeJh4ESk-26">
<mxGeometry x="120" y="15" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="-tglhTkY9j0lAeJh4ESk-6" value="3" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="-tglhTkY9j0lAeJh4ESk-26">
<mxGeometry x="200" y="15" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="-tglhTkY9j0lAeJh4ESk-7" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="-tglhTkY9j0lAeJh4ESk-26" source="-tglhTkY9j0lAeJh4ESk-6" target="-tglhTkY9j0lAeJh4ESk-5">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="190" y="70" as="sourcePoint" />
<mxPoint x="140" y="70" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="-tglhTkY9j0lAeJh4ESk-8" value="5" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="-tglhTkY9j0lAeJh4ESk-26">
<mxGeometry x="280" y="15" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="-tglhTkY9j0lAeJh4ESk-9" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="-tglhTkY9j0lAeJh4ESk-26" source="-tglhTkY9j0lAeJh4ESk-8" target="-tglhTkY9j0lAeJh4ESk-6">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="270" y="30" as="sourcePoint" />
<mxPoint x="240" y="40" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="-tglhTkY9j0lAeJh4ESk-10" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="-tglhTkY9j0lAeJh4ESk-26">
<mxGeometry x="45" y="95" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="-tglhTkY9j0lAeJh4ESk-11" value="4" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="-tglhTkY9j0lAeJh4ESk-26">
<mxGeometry x="200" y="95" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="-tglhTkY9j0lAeJh4ESk-12" value="SS1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="-tglhTkY9j0lAeJh4ESk-26">
<mxGeometry y="90" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="-tglhTkY9j0lAeJh4ESk-13" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="-tglhTkY9j0lAeJh4ESk-26">
<mxGeometry x="45" y="175" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="-tglhTkY9j0lAeJh4ESk-14" value="T1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="-tglhTkY9j0lAeJh4ESk-26">
<mxGeometry y="170" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="-tglhTkY9j0lAeJh4ESk-15" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;" edge="1" parent="-tglhTkY9j0lAeJh4ESk-26" source="-tglhTkY9j0lAeJh4ESk-11" target="-tglhTkY9j0lAeJh4ESk-6">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="290" y="40" as="sourcePoint" />
<mxPoint x="240" y="40" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="-tglhTkY9j0lAeJh4ESk-16" value="7" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="-tglhTkY9j0lAeJh4ESk-26">
<mxGeometry x="280" y="95" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="-tglhTkY9j0lAeJh4ESk-17" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="-tglhTkY9j0lAeJh4ESk-26" source="-tglhTkY9j0lAeJh4ESk-16">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="270" y="110" as="sourcePoint" />
<mxPoint x="230" y="110" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="-tglhTkY9j0lAeJh4ESk-18" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;" edge="1" parent="-tglhTkY9j0lAeJh4ESk-26" source="-tglhTkY9j0lAeJh4ESk-16" target="-tglhTkY9j0lAeJh4ESk-8">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="225" y="105" as="sourcePoint" />
<mxPoint x="225" y="55" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="-tglhTkY9j0lAeJh4ESk-19" value="8" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="-tglhTkY9j0lAeJh4ESk-26">
<mxGeometry x="360" y="15" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="-tglhTkY9j0lAeJh4ESk-20" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="-tglhTkY9j0lAeJh4ESk-26" source="-tglhTkY9j0lAeJh4ESk-19">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="350" y="30" as="sourcePoint" />
<mxPoint x="310" y="30" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="-tglhTkY9j0lAeJh4ESk-21" value="6" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;plain-blue;gradientColor=none;fillColor=#B5E3Fe;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="-tglhTkY9j0lAeJh4ESk-26">
<mxGeometry x="200" y="175" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="-tglhTkY9j0lAeJh4ESk-22" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;" edge="1" parent="-tglhTkY9j0lAeJh4ESk-26" source="-tglhTkY9j0lAeJh4ESk-21">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="225" y="105" as="sourcePoint" />
<mxPoint x="215" y="125" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="-tglhTkY9j0lAeJh4ESk-23" value="1" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;plain-blue;gradientColor=none;fillColor=#B5E3Fe;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="-tglhTkY9j0lAeJh4ESk-26">
<mxGeometry x="120" y="175" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="-tglhTkY9j0lAeJh4ESk-24" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;" edge="1" parent="-tglhTkY9j0lAeJh4ESk-26" source="-tglhTkY9j0lAeJh4ESk-21" target="-tglhTkY9j0lAeJh4ESk-23">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="145" y="105" as="sourcePoint" />
<mxPoint x="135" y="125" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="-tglhTkY9j0lAeJh4ESk-25" value="B" style="verticalLabelPosition=middle;verticalAlign=middle;html=1;strokeWidth=1;shape=mxgraph.flowchart.on-page_reference;strokeColor=#b85450;fillColor=#f8cecc;labelPosition=center;align=center;dashed=1;fontStyle=1;spacing=0;spacingBottom=2;" vertex="1" parent="-tglhTkY9j0lAeJh4ESk-26">
<mxGeometry x="200" y="90" width="14" height="14" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
<diagram id="TJGIR_aT1lfBzh5hI3th" name="state 3">
<mxGraphModel dx="1149" dy="774" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="450" pageHeight="250" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="kDi60eDrDWeN_IZO_Oer-23" value="" style="group" vertex="1" connectable="0" parent="1">
<mxGeometry x="10" y="20" width="390" height="200" as="geometry" />
</mxCell>
<mxCell id="kDi60eDrDWeN_IZO_Oer-1" value="" style="verticalLabelPosition=bottom;verticalAlign=top;html=1;shape=mxgraph.basic.polygon;polyCoords=[[0.45,0],[0.75,0],[1,0],[1,1],[0.62,1],[0.62,0.2],[0.62,0.2],[0.62,0.2],[0,0.2],[0,0],[0.24,0]];polyline=0;fillColor=none;dashed=1;strokeColor=#CC00CC;strokeWidth=2;perimeterSpacing=0;shadow=1;sketch=1;curveFitting=1;jiggle=2;fixDash=0;container=0;dropTarget=0;" vertex="1" parent="kDi60eDrDWeN_IZO_Oer-23">
<mxGeometry x="110" width="130" height="200" as="geometry" />
</mxCell>
<mxCell id="kDi60eDrDWeN_IZO_Oer-2" value="SS2" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="kDi60eDrDWeN_IZO_Oer-23">
<mxGeometry width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="kDi60eDrDWeN_IZO_Oer-3" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="kDi60eDrDWeN_IZO_Oer-23">
<mxGeometry x="45" y="5" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="kDi60eDrDWeN_IZO_Oer-4" value="2" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="kDi60eDrDWeN_IZO_Oer-23">
<mxGeometry x="120" y="5" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="kDi60eDrDWeN_IZO_Oer-5" value="3" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="kDi60eDrDWeN_IZO_Oer-23">
<mxGeometry x="200" y="5" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="kDi60eDrDWeN_IZO_Oer-6" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="kDi60eDrDWeN_IZO_Oer-23" source="kDi60eDrDWeN_IZO_Oer-5" target="kDi60eDrDWeN_IZO_Oer-4">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="190" y="60" as="sourcePoint" />
<mxPoint x="140" y="60" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="kDi60eDrDWeN_IZO_Oer-7" value="5" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="kDi60eDrDWeN_IZO_Oer-23">
<mxGeometry x="280" y="5" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="kDi60eDrDWeN_IZO_Oer-8" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="kDi60eDrDWeN_IZO_Oer-23" source="kDi60eDrDWeN_IZO_Oer-7" target="kDi60eDrDWeN_IZO_Oer-5">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="270" y="20" as="sourcePoint" />
<mxPoint x="240" y="30" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="kDi60eDrDWeN_IZO_Oer-9" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="kDi60eDrDWeN_IZO_Oer-23">
<mxGeometry x="45" y="85" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="kDi60eDrDWeN_IZO_Oer-10" value="4" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="kDi60eDrDWeN_IZO_Oer-23">
<mxGeometry x="200" y="85" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="kDi60eDrDWeN_IZO_Oer-11" value="SS1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="kDi60eDrDWeN_IZO_Oer-23">
<mxGeometry y="80" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="kDi60eDrDWeN_IZO_Oer-12" value="&lt;b&gt;1&lt;/b&gt;" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="kDi60eDrDWeN_IZO_Oer-23">
<mxGeometry x="45" y="165" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="kDi60eDrDWeN_IZO_Oer-13" value="T1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="kDi60eDrDWeN_IZO_Oer-23">
<mxGeometry y="160" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="kDi60eDrDWeN_IZO_Oer-14" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;" edge="1" parent="kDi60eDrDWeN_IZO_Oer-23" source="kDi60eDrDWeN_IZO_Oer-10" target="kDi60eDrDWeN_IZO_Oer-5">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="290" y="30" as="sourcePoint" />
<mxPoint x="240" y="30" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="kDi60eDrDWeN_IZO_Oer-15" value="7" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="kDi60eDrDWeN_IZO_Oer-23">
<mxGeometry x="280" y="85" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="kDi60eDrDWeN_IZO_Oer-16" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="kDi60eDrDWeN_IZO_Oer-23" source="kDi60eDrDWeN_IZO_Oer-15">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="270" y="100" as="sourcePoint" />
<mxPoint x="230" y="100" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="kDi60eDrDWeN_IZO_Oer-17" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;" edge="1" parent="kDi60eDrDWeN_IZO_Oer-23" source="kDi60eDrDWeN_IZO_Oer-15" target="kDi60eDrDWeN_IZO_Oer-7">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="225" y="95" as="sourcePoint" />
<mxPoint x="225" y="45" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="kDi60eDrDWeN_IZO_Oer-18" value="8" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="kDi60eDrDWeN_IZO_Oer-23">
<mxGeometry x="360" y="5" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="kDi60eDrDWeN_IZO_Oer-19" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="kDi60eDrDWeN_IZO_Oer-23" source="kDi60eDrDWeN_IZO_Oer-18">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="350" y="20" as="sourcePoint" />
<mxPoint x="310" y="20" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="kDi60eDrDWeN_IZO_Oer-20" value="6" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;plain-blue;gradientColor=none;fillColor=#B5E3Fe;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="kDi60eDrDWeN_IZO_Oer-23">
<mxGeometry x="200" y="165" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="kDi60eDrDWeN_IZO_Oer-21" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;" edge="1" parent="kDi60eDrDWeN_IZO_Oer-23" source="kDi60eDrDWeN_IZO_Oer-20">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="225" y="95" as="sourcePoint" />
<mxPoint x="215" y="115" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="kDi60eDrDWeN_IZO_Oer-22" value="B" style="verticalLabelPosition=middle;verticalAlign=middle;html=1;strokeWidth=1;shape=mxgraph.flowchart.on-page_reference;strokeColor=#b85450;fillColor=#f8cecc;labelPosition=center;align=center;dashed=1;fontStyle=1;spacing=0;spacingBottom=2;" vertex="1" parent="kDi60eDrDWeN_IZO_Oer-23">
<mxGeometry x="200" y="80" width="14" height="14" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
<diagram id="8tl_i4AG-ByblRdbeoAc" name="state 4">
<mxGraphModel dx="1149" dy="774" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="450" pageHeight="250" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="KFU6xLtBjxV3UyIQiZ9u-22" value="" style="group" vertex="1" connectable="0" parent="1">
<mxGeometry x="10" y="20" width="390" height="200" as="geometry" />
</mxCell>
<mxCell id="KFU6xLtBjxV3UyIQiZ9u-1" value="" style="verticalLabelPosition=bottom;verticalAlign=top;html=1;shape=mxgraph.basic.polygon;polyCoords=[[0.45,0],[0.75,0],[1,0],[1,1],[0.62,1],[0.62,0.2],[0.62,0.2],[0.62,0.2],[0,0.2],[0,0],[0.24,0]];polyline=0;fillColor=none;dashed=1;strokeColor=#CC00CC;strokeWidth=2;perimeterSpacing=0;shadow=1;sketch=1;curveFitting=1;jiggle=2;fixDash=0;container=0;dropTarget=0;" vertex="1" parent="KFU6xLtBjxV3UyIQiZ9u-22">
<mxGeometry x="110" width="130" height="200" as="geometry" />
</mxCell>
<mxCell id="KFU6xLtBjxV3UyIQiZ9u-2" value="SS2" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="KFU6xLtBjxV3UyIQiZ9u-22">
<mxGeometry width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="KFU6xLtBjxV3UyIQiZ9u-3" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="KFU6xLtBjxV3UyIQiZ9u-22">
<mxGeometry x="45" y="5" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="KFU6xLtBjxV3UyIQiZ9u-4" value="2" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="KFU6xLtBjxV3UyIQiZ9u-22">
<mxGeometry x="120" y="5" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="KFU6xLtBjxV3UyIQiZ9u-5" value="3" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="KFU6xLtBjxV3UyIQiZ9u-22">
<mxGeometry x="200" y="5" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="KFU6xLtBjxV3UyIQiZ9u-6" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="KFU6xLtBjxV3UyIQiZ9u-22" source="KFU6xLtBjxV3UyIQiZ9u-5" target="KFU6xLtBjxV3UyIQiZ9u-4">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="190" y="60" as="sourcePoint" />
<mxPoint x="140" y="60" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="KFU6xLtBjxV3UyIQiZ9u-7" value="5" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="KFU6xLtBjxV3UyIQiZ9u-22">
<mxGeometry x="280" y="5" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="KFU6xLtBjxV3UyIQiZ9u-8" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="KFU6xLtBjxV3UyIQiZ9u-22" source="KFU6xLtBjxV3UyIQiZ9u-7" target="KFU6xLtBjxV3UyIQiZ9u-5">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="270" y="20" as="sourcePoint" />
<mxPoint x="240" y="30" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="KFU6xLtBjxV3UyIQiZ9u-9" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="KFU6xLtBjxV3UyIQiZ9u-22">
<mxGeometry x="45" y="85" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="KFU6xLtBjxV3UyIQiZ9u-10" value="4" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="KFU6xLtBjxV3UyIQiZ9u-22">
<mxGeometry x="200" y="85" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="KFU6xLtBjxV3UyIQiZ9u-11" value="SS1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="KFU6xLtBjxV3UyIQiZ9u-22">
<mxGeometry y="80" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="KFU6xLtBjxV3UyIQiZ9u-12" value="&lt;b&gt;1&lt;/b&gt;" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="KFU6xLtBjxV3UyIQiZ9u-22">
<mxGeometry x="45" y="165" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="KFU6xLtBjxV3UyIQiZ9u-13" value="T1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="KFU6xLtBjxV3UyIQiZ9u-22">
<mxGeometry y="160" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="KFU6xLtBjxV3UyIQiZ9u-14" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;" edge="1" parent="KFU6xLtBjxV3UyIQiZ9u-22" source="KFU6xLtBjxV3UyIQiZ9u-10" target="KFU6xLtBjxV3UyIQiZ9u-5">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="290" y="30" as="sourcePoint" />
<mxPoint x="240" y="30" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="KFU6xLtBjxV3UyIQiZ9u-15" value="7" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="KFU6xLtBjxV3UyIQiZ9u-22">
<mxGeometry x="280" y="85" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="KFU6xLtBjxV3UyIQiZ9u-16" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="KFU6xLtBjxV3UyIQiZ9u-22" source="KFU6xLtBjxV3UyIQiZ9u-15">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="270" y="100" as="sourcePoint" />
<mxPoint x="230" y="100" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="KFU6xLtBjxV3UyIQiZ9u-17" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;" edge="1" parent="KFU6xLtBjxV3UyIQiZ9u-22" source="KFU6xLtBjxV3UyIQiZ9u-15" target="KFU6xLtBjxV3UyIQiZ9u-7">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="225" y="95" as="sourcePoint" />
<mxPoint x="225" y="45" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="KFU6xLtBjxV3UyIQiZ9u-18" value="8" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="KFU6xLtBjxV3UyIQiZ9u-22">
<mxGeometry x="360" y="5" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="KFU6xLtBjxV3UyIQiZ9u-19" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="KFU6xLtBjxV3UyIQiZ9u-22" source="KFU6xLtBjxV3UyIQiZ9u-18">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="350" y="20" as="sourcePoint" />
<mxPoint x="310" y="20" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="KFU6xLtBjxV3UyIQiZ9u-20" value="6" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;plain-blue;gradientColor=none;fillColor=#B5E3Fe;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="KFU6xLtBjxV3UyIQiZ9u-22">
<mxGeometry x="200" y="165" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="KFU6xLtBjxV3UyIQiZ9u-21" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;" edge="1" parent="KFU6xLtBjxV3UyIQiZ9u-22" source="KFU6xLtBjxV3UyIQiZ9u-20">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="225" y="95" as="sourcePoint" />
<mxPoint x="215" y="115" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
</root>
</mxGraphModel>
</diagram>
<diagram id="I_Id2mCzoGFMSwHJqH5q" name="state 5">
<mxGraphModel dx="1149" dy="774" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="450" pageHeight="250" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="YIpS9g6xBEaVuflAf0iO-12" value="" style="group" vertex="1" connectable="0" parent="1">
<mxGeometry x="10" y="20" width="231" height="200" as="geometry" />
</mxCell>
<mxCell id="YIpS9g6xBEaVuflAf0iO-1" value="SS2" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="YIpS9g6xBEaVuflAf0iO-12">
<mxGeometry width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="YIpS9g6xBEaVuflAf0iO-2" value="&lt;b&gt;2, 3&lt;br&gt;&lt;/b&gt;" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="YIpS9g6xBEaVuflAf0iO-12">
<mxGeometry x="45" y="5" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="YIpS9g6xBEaVuflAf0iO-3" value="5" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="YIpS9g6xBEaVuflAf0iO-12">
<mxGeometry x="121" y="5" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="YIpS9g6xBEaVuflAf0iO-4" value="&lt;b&gt;4&lt;/b&gt;" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="YIpS9g6xBEaVuflAf0iO-12">
<mxGeometry x="45" y="85" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="YIpS9g6xBEaVuflAf0iO-5" value="SS1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="YIpS9g6xBEaVuflAf0iO-12">
<mxGeometry y="80" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="YIpS9g6xBEaVuflAf0iO-6" value="&lt;b&gt;1, 6&lt;br&gt;&lt;/b&gt;" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="YIpS9g6xBEaVuflAf0iO-12">
<mxGeometry x="45" y="165" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="YIpS9g6xBEaVuflAf0iO-7" value="T1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="YIpS9g6xBEaVuflAf0iO-12">
<mxGeometry y="160" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="YIpS9g6xBEaVuflAf0iO-8" value="7" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="YIpS9g6xBEaVuflAf0iO-12">
<mxGeometry x="121" y="85" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="YIpS9g6xBEaVuflAf0iO-9" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;" edge="1" parent="YIpS9g6xBEaVuflAf0iO-12" source="YIpS9g6xBEaVuflAf0iO-8" target="YIpS9g6xBEaVuflAf0iO-3">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="66" y="95" as="sourcePoint" />
<mxPoint x="66" y="45" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="YIpS9g6xBEaVuflAf0iO-10" value="8" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="YIpS9g6xBEaVuflAf0iO-12">
<mxGeometry x="201" y="5" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="YIpS9g6xBEaVuflAf0iO-11" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="YIpS9g6xBEaVuflAf0iO-12" source="YIpS9g6xBEaVuflAf0iO-10">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="191" y="20" as="sourcePoint" />
<mxPoint x="151" y="20" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>

View file

@ -0,0 +1,287 @@
<mxfile host="Electron" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/26.1.1 Chrome/132.0.6834.210 Electron/34.3.3 Safari/537.36" version="26.1.1" pages="3">
<diagram id="8Eo1AGRWHWefgpNjroBf" name="state 1">
<mxGraphModel dx="1070" dy="732" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="450" pageHeight="250" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="lMObtAj2JowYBNsHivty-26" value="" style="group" vertex="1" connectable="0" parent="1">
<mxGeometry x="10" y="10" width="390" height="220" as="geometry" />
</mxCell>
<mxCell id="lMObtAj2JowYBNsHivty-1" value="" style="verticalLabelPosition=bottom;verticalAlign=top;html=1;shape=mxgraph.basic.polygon;polyCoords=[[0,0],[0.75,0],[1,0],[1,1],[0.21,1],[0,1],[0,1],[0,0.73],[0.64,0.73],[0.64,0.27],[0,0.27]];polyline=0;fillColor=none;dashed=1;strokeColor=#CC00CC;strokeWidth=2;perimeterSpacing=0;shadow=1;sketch=1;curveFitting=1;jiggle=2;fixDash=0;container=0;dropTarget=0;" vertex="1" parent="lMObtAj2JowYBNsHivty-26">
<mxGeometry x="100" width="140" height="220" as="geometry" />
</mxCell>
<mxCell id="lMObtAj2JowYBNsHivty-2" value="" style="verticalLabelPosition=bottom;verticalAlign=top;html=1;shape=mxgraph.basic.polygon;polyCoords=[[0.45,0],[0.75,0],[1,0],[1,1],[0.62,1],[0,1],[0,1],[0,1],[0,0.2],[0,0],[0.24,0]];polyline=0;fillColor=none;dashed=1;strokeColor=#CC00CC;strokeWidth=2;perimeterSpacing=0;shadow=1;sketch=1;curveFitting=1;jiggle=2;fixDash=0;container=0;dropTarget=0;" vertex="1" parent="lMObtAj2JowYBNsHivty-26">
<mxGeometry x="110" y="170" width="50" height="40" as="geometry" />
</mxCell>
<mxCell id="lMObtAj2JowYBNsHivty-3" value="SS2" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="lMObtAj2JowYBNsHivty-26">
<mxGeometry y="10" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="lMObtAj2JowYBNsHivty-4" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="lMObtAj2JowYBNsHivty-26">
<mxGeometry x="45" y="15" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="lMObtAj2JowYBNsHivty-5" value="2" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="lMObtAj2JowYBNsHivty-26">
<mxGeometry x="120" y="15" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="lMObtAj2JowYBNsHivty-6" value="3" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="lMObtAj2JowYBNsHivty-26">
<mxGeometry x="200" y="15" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="lMObtAj2JowYBNsHivty-7" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="lMObtAj2JowYBNsHivty-26" source="lMObtAj2JowYBNsHivty-6" target="lMObtAj2JowYBNsHivty-5">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="190" y="70" as="sourcePoint" />
<mxPoint x="140" y="70" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="lMObtAj2JowYBNsHivty-8" value="5" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="lMObtAj2JowYBNsHivty-26">
<mxGeometry x="280" y="15" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="lMObtAj2JowYBNsHivty-9" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="lMObtAj2JowYBNsHivty-26" source="lMObtAj2JowYBNsHivty-8" target="lMObtAj2JowYBNsHivty-6">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="270" y="30" as="sourcePoint" />
<mxPoint x="240" y="40" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="lMObtAj2JowYBNsHivty-10" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="lMObtAj2JowYBNsHivty-26">
<mxGeometry x="45" y="95" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="lMObtAj2JowYBNsHivty-11" value="4" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="lMObtAj2JowYBNsHivty-26">
<mxGeometry x="200" y="95" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="lMObtAj2JowYBNsHivty-12" value="SS1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="lMObtAj2JowYBNsHivty-26">
<mxGeometry y="90" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="lMObtAj2JowYBNsHivty-13" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="lMObtAj2JowYBNsHivty-26">
<mxGeometry x="45" y="175" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="lMObtAj2JowYBNsHivty-14" value="T1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="lMObtAj2JowYBNsHivty-26">
<mxGeometry y="170" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="lMObtAj2JowYBNsHivty-15" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;" edge="1" parent="lMObtAj2JowYBNsHivty-26" source="lMObtAj2JowYBNsHivty-11" target="lMObtAj2JowYBNsHivty-6">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="290" y="40" as="sourcePoint" />
<mxPoint x="240" y="40" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="lMObtAj2JowYBNsHivty-16" value="7" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="lMObtAj2JowYBNsHivty-26">
<mxGeometry x="280" y="95" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="lMObtAj2JowYBNsHivty-17" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="lMObtAj2JowYBNsHivty-26" source="lMObtAj2JowYBNsHivty-16">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="270" y="110" as="sourcePoint" />
<mxPoint x="230" y="110" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="lMObtAj2JowYBNsHivty-18" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;" edge="1" parent="lMObtAj2JowYBNsHivty-26" source="lMObtAj2JowYBNsHivty-16" target="lMObtAj2JowYBNsHivty-8">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="225" y="105" as="sourcePoint" />
<mxPoint x="225" y="55" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="lMObtAj2JowYBNsHivty-19" value="8" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="lMObtAj2JowYBNsHivty-26">
<mxGeometry x="360" y="15" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="lMObtAj2JowYBNsHivty-20" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="lMObtAj2JowYBNsHivty-26" source="lMObtAj2JowYBNsHivty-19">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="350" y="30" as="sourcePoint" />
<mxPoint x="310" y="30" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="lMObtAj2JowYBNsHivty-21" value="6" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;plain-blue;gradientColor=none;fillColor=#B5E3Fe;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="lMObtAj2JowYBNsHivty-26">
<mxGeometry x="200" y="175" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="lMObtAj2JowYBNsHivty-22" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;" edge="1" parent="lMObtAj2JowYBNsHivty-26" source="lMObtAj2JowYBNsHivty-21">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="225" y="105" as="sourcePoint" />
<mxPoint x="215" y="125" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="lMObtAj2JowYBNsHivty-23" value="1" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;plain-blue;gradientColor=none;fillColor=#B5E3Fe;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="lMObtAj2JowYBNsHivty-26">
<mxGeometry x="120" y="175" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="lMObtAj2JowYBNsHivty-24" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;" edge="1" parent="lMObtAj2JowYBNsHivty-26" source="lMObtAj2JowYBNsHivty-21" target="lMObtAj2JowYBNsHivty-23">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="145" y="105" as="sourcePoint" />
<mxPoint x="135" y="125" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="lMObtAj2JowYBNsHivty-25" value="B" style="verticalLabelPosition=middle;verticalAlign=middle;html=1;strokeWidth=1;shape=mxgraph.flowchart.on-page_reference;strokeColor=#b85450;fillColor=#f8cecc;labelPosition=center;align=center;dashed=1;fontStyle=1;spacing=0;spacingBottom=2;" vertex="1" parent="lMObtAj2JowYBNsHivty-26">
<mxGeometry x="120" y="170" width="14" height="14" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
<diagram id="ZB54035AOYvPo9_0UTcb" name="state 2">
<mxGraphModel dx="1070" dy="732" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="450" pageHeight="250" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="mpJY2JbuI38zzk8to14d-25" value="" style="group" vertex="1" connectable="0" parent="1">
<mxGeometry x="10" y="10" width="390" height="220" as="geometry" />
</mxCell>
<mxCell id="mpJY2JbuI38zzk8to14d-1" value="" style="verticalLabelPosition=bottom;verticalAlign=top;html=1;shape=mxgraph.basic.polygon;polyCoords=[[0,0],[0.75,0],[1,0],[1,1],[0.21,1],[0,1],[0,1],[0,0.73],[0.64,0.73],[0.64,0.27],[0,0.27]];polyline=0;fillColor=none;dashed=1;strokeColor=#CC00CC;strokeWidth=2;perimeterSpacing=0;shadow=1;sketch=1;curveFitting=1;jiggle=2;fixDash=0;container=0;dropTarget=0;" vertex="1" parent="mpJY2JbuI38zzk8to14d-25">
<mxGeometry x="101" width="140" height="220" as="geometry" />
</mxCell>
<mxCell id="mpJY2JbuI38zzk8to14d-2" value="SS2" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="mpJY2JbuI38zzk8to14d-25">
<mxGeometry y="10" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="mpJY2JbuI38zzk8to14d-3" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="mpJY2JbuI38zzk8to14d-25">
<mxGeometry x="45" y="15" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="mpJY2JbuI38zzk8to14d-4" value="2" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="mpJY2JbuI38zzk8to14d-25">
<mxGeometry x="120" y="15" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="mpJY2JbuI38zzk8to14d-5" value="3" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="mpJY2JbuI38zzk8to14d-25">
<mxGeometry x="200" y="15" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="mpJY2JbuI38zzk8to14d-6" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="mpJY2JbuI38zzk8to14d-25" source="mpJY2JbuI38zzk8to14d-5" target="mpJY2JbuI38zzk8to14d-4">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="190" y="70" as="sourcePoint" />
<mxPoint x="140" y="70" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="mpJY2JbuI38zzk8to14d-7" value="5" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="mpJY2JbuI38zzk8to14d-25">
<mxGeometry x="280" y="15" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="mpJY2JbuI38zzk8to14d-8" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="mpJY2JbuI38zzk8to14d-25" source="mpJY2JbuI38zzk8to14d-7" target="mpJY2JbuI38zzk8to14d-5">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="270" y="30" as="sourcePoint" />
<mxPoint x="240" y="40" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="mpJY2JbuI38zzk8to14d-9" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="mpJY2JbuI38zzk8to14d-25">
<mxGeometry x="45" y="95" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="mpJY2JbuI38zzk8to14d-10" value="4" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="mpJY2JbuI38zzk8to14d-25">
<mxGeometry x="200" y="95" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="mpJY2JbuI38zzk8to14d-11" value="SS1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="mpJY2JbuI38zzk8to14d-25">
<mxGeometry y="90" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="mpJY2JbuI38zzk8to14d-12" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="mpJY2JbuI38zzk8to14d-25">
<mxGeometry x="45" y="175" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="mpJY2JbuI38zzk8to14d-13" value="T1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="mpJY2JbuI38zzk8to14d-25">
<mxGeometry y="170" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="mpJY2JbuI38zzk8to14d-14" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;" edge="1" parent="mpJY2JbuI38zzk8to14d-25" source="mpJY2JbuI38zzk8to14d-10" target="mpJY2JbuI38zzk8to14d-5">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="290" y="40" as="sourcePoint" />
<mxPoint x="240" y="40" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="mpJY2JbuI38zzk8to14d-15" value="7" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="mpJY2JbuI38zzk8to14d-25">
<mxGeometry x="280" y="95" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="mpJY2JbuI38zzk8to14d-16" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="mpJY2JbuI38zzk8to14d-25" source="mpJY2JbuI38zzk8to14d-15">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="270" y="110" as="sourcePoint" />
<mxPoint x="230" y="110" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="mpJY2JbuI38zzk8to14d-17" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;" edge="1" parent="mpJY2JbuI38zzk8to14d-25" source="mpJY2JbuI38zzk8to14d-15" target="mpJY2JbuI38zzk8to14d-7">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="225" y="105" as="sourcePoint" />
<mxPoint x="225" y="55" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="mpJY2JbuI38zzk8to14d-18" value="8" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="mpJY2JbuI38zzk8to14d-25">
<mxGeometry x="360" y="15" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="mpJY2JbuI38zzk8to14d-19" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="mpJY2JbuI38zzk8to14d-25" source="mpJY2JbuI38zzk8to14d-18">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="350" y="30" as="sourcePoint" />
<mxPoint x="310" y="30" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="mpJY2JbuI38zzk8to14d-20" value="6" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;plain-blue;gradientColor=none;fillColor=#B5E3Fe;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="mpJY2JbuI38zzk8to14d-25">
<mxGeometry x="200" y="175" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="mpJY2JbuI38zzk8to14d-21" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;" edge="1" parent="mpJY2JbuI38zzk8to14d-25" source="mpJY2JbuI38zzk8to14d-20">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="225" y="105" as="sourcePoint" />
<mxPoint x="215" y="125" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="mpJY2JbuI38zzk8to14d-22" value="1" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;plain-blue;gradientColor=none;fillColor=#B5E3Fe;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="mpJY2JbuI38zzk8to14d-25">
<mxGeometry x="120" y="175" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="mpJY2JbuI38zzk8to14d-23" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;" edge="1" parent="mpJY2JbuI38zzk8to14d-25" source="mpJY2JbuI38zzk8to14d-20" target="mpJY2JbuI38zzk8to14d-22">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="145" y="105" as="sourcePoint" />
<mxPoint x="135" y="125" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="mpJY2JbuI38zzk8to14d-24" value="" style="verticalLabelPosition=bottom;verticalAlign=top;html=1;shape=mxgraph.basic.polygon;polyCoords=[[0.45,0],[0.75,0],[1,0],[1,1],[0.62,1],[0,1],[0,1],[0,1],[0,0.2],[0,0],[0.24,0]];polyline=0;fillColor=none;dashed=1;strokeColor=#CC00CC;strokeWidth=2;perimeterSpacing=0;shadow=1;sketch=1;curveFitting=1;jiggle=2;fixDash=0;container=0;dropTarget=0;" vertex="1" parent="mpJY2JbuI38zzk8to14d-25">
<mxGeometry x="111" y="170" width="50" height="40" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
<diagram name="state 3" id="pfYS2UsdWF6MnEGA_9M5">
<mxGraphModel dx="1070" dy="732" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="450" pageHeight="250" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="G2f_uyPNZEB1i5etgh__-147" value="" style="group" vertex="1" connectable="0" parent="1">
<mxGeometry x="10" y="20" width="230" height="200" as="geometry" />
</mxCell>
<mxCell id="G2f_uyPNZEB1i5etgh__-136" value="SS2" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="G2f_uyPNZEB1i5etgh__-147">
<mxGeometry width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="G2f_uyPNZEB1i5etgh__-137" value="&lt;b&gt;2, 3&lt;br&gt;&lt;/b&gt;" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="G2f_uyPNZEB1i5etgh__-147">
<mxGeometry x="45" y="5" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="G2f_uyPNZEB1i5etgh__-138" value="5" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="G2f_uyPNZEB1i5etgh__-147">
<mxGeometry x="120" y="5" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="G2f_uyPNZEB1i5etgh__-139" value="&lt;b&gt;4&lt;/b&gt;" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="G2f_uyPNZEB1i5etgh__-147">
<mxGeometry x="45" y="85" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="G2f_uyPNZEB1i5etgh__-140" value="SS1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="G2f_uyPNZEB1i5etgh__-147">
<mxGeometry y="80" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="G2f_uyPNZEB1i5etgh__-141" value="&lt;b&gt;1, 6&lt;br&gt;&lt;/b&gt;" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="G2f_uyPNZEB1i5etgh__-147">
<mxGeometry x="45" y="165" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="G2f_uyPNZEB1i5etgh__-142" value="T1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="G2f_uyPNZEB1i5etgh__-147">
<mxGeometry y="160" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="G2f_uyPNZEB1i5etgh__-143" value="7" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="G2f_uyPNZEB1i5etgh__-147">
<mxGeometry x="120" y="85" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="G2f_uyPNZEB1i5etgh__-144" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;" edge="1" parent="G2f_uyPNZEB1i5etgh__-147" source="G2f_uyPNZEB1i5etgh__-143" target="G2f_uyPNZEB1i5etgh__-138">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="65" y="95" as="sourcePoint" />
<mxPoint x="65" y="45" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="G2f_uyPNZEB1i5etgh__-145" value="8" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="G2f_uyPNZEB1i5etgh__-147">
<mxGeometry x="200" y="5" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="G2f_uyPNZEB1i5etgh__-146" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="G2f_uyPNZEB1i5etgh__-147" source="G2f_uyPNZEB1i5etgh__-145">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="190" y="20" as="sourcePoint" />
<mxPoint x="150" y="20" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>

View file

@ -0,0 +1,223 @@
<mxfile host="Electron" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/26.1.1 Chrome/132.0.6834.210 Electron/34.3.3 Safari/537.36" version="26.1.1" pages="3">
<diagram name="state 1" id="VrdkUToxpVwyLyul_Cfd">
<mxGraphModel dx="1070" dy="732" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="450" pageHeight="250" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="oHeAk4B_Z_e2L7biMZUw-16" value="" style="group" vertex="1" connectable="0" parent="1">
<mxGeometry x="10" y="10" width="230" height="220" as="geometry" />
</mxCell>
<mxCell id="oHeAk4B_Z_e2L7biMZUw-1" value="" style="verticalLabelPosition=bottom;verticalAlign=top;html=1;shape=mxgraph.basic.polygon;polyCoords=[[0.24,0],[1,0],[1,0.4],[1,1],[0.48,1],[0,1],[0,0.75],[0,0.73],[0.02,0.5],[0,0.25],[0,0]];polyline=0;fillColor=none;dashed=1;strokeColor=#CC00CC;strokeWidth=2;perimeterSpacing=0;shadow=1;sketch=1;curveFitting=1;jiggle=2;fixDash=0;container=0;dropTarget=0;" vertex="1" parent="oHeAk4B_Z_e2L7biMZUw-16">
<mxGeometry x="101" width="70" height="220" as="geometry" />
</mxCell>
<mxCell id="oHeAk4B_Z_e2L7biMZUw-2" value="SS2" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="oHeAk4B_Z_e2L7biMZUw-16">
<mxGeometry y="10" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="oHeAk4B_Z_e2L7biMZUw-3" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="oHeAk4B_Z_e2L7biMZUw-16">
<mxGeometry x="45" y="15" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="oHeAk4B_Z_e2L7biMZUw-4" value="1" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="oHeAk4B_Z_e2L7biMZUw-16">
<mxGeometry x="120" y="15" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="oHeAk4B_Z_e2L7biMZUw-5" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="oHeAk4B_Z_e2L7biMZUw-16">
<mxGeometry x="45" y="95" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="oHeAk4B_Z_e2L7biMZUw-6" value="SS1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="oHeAk4B_Z_e2L7biMZUw-16">
<mxGeometry y="90" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="oHeAk4B_Z_e2L7biMZUw-7" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="oHeAk4B_Z_e2L7biMZUw-16">
<mxGeometry x="45" y="175" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="oHeAk4B_Z_e2L7biMZUw-8" value="T1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="oHeAk4B_Z_e2L7biMZUw-16">
<mxGeometry y="170" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="oHeAk4B_Z_e2L7biMZUw-9" value="2" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="oHeAk4B_Z_e2L7biMZUw-16">
<mxGeometry x="120" y="95" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="oHeAk4B_Z_e2L7biMZUw-10" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;" edge="1" parent="oHeAk4B_Z_e2L7biMZUw-16" source="oHeAk4B_Z_e2L7biMZUw-9" target="oHeAk4B_Z_e2L7biMZUw-4">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="65" y="105" as="sourcePoint" />
<mxPoint x="65" y="55" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="oHeAk4B_Z_e2L7biMZUw-11" value="3" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="oHeAk4B_Z_e2L7biMZUw-16">
<mxGeometry x="200" y="15" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="oHeAk4B_Z_e2L7biMZUw-12" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="oHeAk4B_Z_e2L7biMZUw-16" source="oHeAk4B_Z_e2L7biMZUw-11">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="190" y="30" as="sourcePoint" />
<mxPoint x="150" y="30" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="oHeAk4B_Z_e2L7biMZUw-13" value="4" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;plain-blue;gradientColor=none;fillColor=#B5E3Fe;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="oHeAk4B_Z_e2L7biMZUw-16">
<mxGeometry x="120" y="175" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="oHeAk4B_Z_e2L7biMZUw-14" value="B" style="verticalLabelPosition=middle;verticalAlign=middle;html=1;strokeWidth=1;shape=mxgraph.flowchart.on-page_reference;strokeColor=#b85450;fillColor=#f8cecc;labelPosition=center;align=center;dashed=1;fontStyle=1;spacing=0;spacingBottom=2;" vertex="1" parent="oHeAk4B_Z_e2L7biMZUw-16">
<mxGeometry x="120" y="170" width="14" height="14" as="geometry" />
</mxCell>
<mxCell id="oHeAk4B_Z_e2L7biMZUw-15" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;" edge="1" parent="oHeAk4B_Z_e2L7biMZUw-16" source="oHeAk4B_Z_e2L7biMZUw-13" target="oHeAk4B_Z_e2L7biMZUw-9">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="199.43" y="182" as="sourcePoint" />
<mxPoint x="199.43" y="132" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
</root>
</mxGraphModel>
</diagram>
<diagram id="dumz7MtjuSRbbVgNawrV" name="state 2">
<mxGraphModel dx="1070" dy="732" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="450" pageHeight="250" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="n_ChFhbu9l9toi0L3hxX-16" value="" style="group" vertex="1" connectable="0" parent="1">
<mxGeometry x="10" y="10" width="230" height="220" as="geometry" />
</mxCell>
<mxCell id="n_ChFhbu9l9toi0L3hxX-1" value="" style="verticalLabelPosition=bottom;verticalAlign=top;html=1;shape=mxgraph.basic.polygon;polyCoords=[[0.24,0],[1,0],[1,0.4],[1,1],[0.48,1],[0,1],[0,0.75],[0,0.73],[0.02,0.5],[0,0.25],[0,0]];polyline=0;fillColor=none;dashed=1;strokeColor=#CC00CC;strokeWidth=2;perimeterSpacing=0;shadow=1;sketch=1;curveFitting=1;jiggle=2;fixDash=0;container=0;dropTarget=0;" vertex="1" parent="n_ChFhbu9l9toi0L3hxX-16">
<mxGeometry x="101" width="70" height="220" as="geometry" />
</mxCell>
<mxCell id="n_ChFhbu9l9toi0L3hxX-2" value="SS2" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="n_ChFhbu9l9toi0L3hxX-16">
<mxGeometry y="10" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="n_ChFhbu9l9toi0L3hxX-3" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="n_ChFhbu9l9toi0L3hxX-16">
<mxGeometry x="45" y="15" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="n_ChFhbu9l9toi0L3hxX-4" value="1" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="n_ChFhbu9l9toi0L3hxX-16">
<mxGeometry x="120" y="15" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="n_ChFhbu9l9toi0L3hxX-5" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="n_ChFhbu9l9toi0L3hxX-16">
<mxGeometry x="45" y="95" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="n_ChFhbu9l9toi0L3hxX-6" value="SS1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="n_ChFhbu9l9toi0L3hxX-16">
<mxGeometry y="90" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="n_ChFhbu9l9toi0L3hxX-7" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="n_ChFhbu9l9toi0L3hxX-16">
<mxGeometry x="45" y="175" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="n_ChFhbu9l9toi0L3hxX-8" value="T1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="n_ChFhbu9l9toi0L3hxX-16">
<mxGeometry y="170" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="n_ChFhbu9l9toi0L3hxX-9" value="2" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="n_ChFhbu9l9toi0L3hxX-16">
<mxGeometry x="120" y="95" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="n_ChFhbu9l9toi0L3hxX-10" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;" edge="1" parent="n_ChFhbu9l9toi0L3hxX-16" source="n_ChFhbu9l9toi0L3hxX-9" target="n_ChFhbu9l9toi0L3hxX-4">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="65" y="105" as="sourcePoint" />
<mxPoint x="65" y="55" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="n_ChFhbu9l9toi0L3hxX-11" value="3" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="n_ChFhbu9l9toi0L3hxX-16">
<mxGeometry x="200" y="15" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="n_ChFhbu9l9toi0L3hxX-12" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="n_ChFhbu9l9toi0L3hxX-16" source="n_ChFhbu9l9toi0L3hxX-11">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="190" y="30" as="sourcePoint" />
<mxPoint x="150" y="30" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="n_ChFhbu9l9toi0L3hxX-13" value="4" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;plain-blue;gradientColor=none;fillColor=#B5E3Fe;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="n_ChFhbu9l9toi0L3hxX-16">
<mxGeometry x="120" y="175" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="n_ChFhbu9l9toi0L3hxX-14" value="B" style="verticalLabelPosition=middle;verticalAlign=middle;html=1;strokeWidth=1;shape=mxgraph.flowchart.on-page_reference;strokeColor=#b85450;fillColor=#f8cecc;labelPosition=center;align=center;dashed=1;fontStyle=1;spacing=0;spacingBottom=2;" vertex="1" parent="n_ChFhbu9l9toi0L3hxX-16">
<mxGeometry x="120" y="170" width="14" height="14" as="geometry" />
</mxCell>
<mxCell id="n_ChFhbu9l9toi0L3hxX-15" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;" edge="1" parent="n_ChFhbu9l9toi0L3hxX-16" source="n_ChFhbu9l9toi0L3hxX-13" target="n_ChFhbu9l9toi0L3hxX-9">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="199.43000000000006" y="182" as="sourcePoint" />
<mxPoint x="199.43000000000006" y="132" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
</root>
</mxGraphModel>
</diagram>
<diagram id="UgwmXKjNo72Kti5tnIX_" name="state 3">
<mxGraphModel dx="1070" dy="732" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="450" pageHeight="250" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="PkcBEfq_iBlsM-m9fPOb-20" value="" style="group" vertex="1" connectable="0" parent="1">
<mxGeometry x="10" y="10" width="230" height="220" as="geometry" />
</mxCell>
<mxCell id="PkcBEfq_iBlsM-m9fPOb-2" value="" style="verticalLabelPosition=bottom;verticalAlign=top;html=1;shape=mxgraph.basic.polygon;polyCoords=[[0.24,0],[1,0],[1,0.4],[1,1],[0.48,1],[0,1],[0,0.75],[0,0.73],[0.02,0.5],[0,0.25],[0,0]];polyline=0;fillColor=none;dashed=1;strokeColor=#CC00CC;strokeWidth=2;perimeterSpacing=0;shadow=1;sketch=1;curveFitting=1;jiggle=2;fixDash=0;container=0;dropTarget=0;" vertex="1" parent="PkcBEfq_iBlsM-m9fPOb-20">
<mxGeometry x="100" width="70" height="220" as="geometry" />
</mxCell>
<mxCell id="PkcBEfq_iBlsM-m9fPOb-3" value="SS2" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="PkcBEfq_iBlsM-m9fPOb-20">
<mxGeometry y="10" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="PkcBEfq_iBlsM-m9fPOb-4" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="PkcBEfq_iBlsM-m9fPOb-20">
<mxGeometry x="45" y="15" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="PkcBEfq_iBlsM-m9fPOb-5" value="1" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="PkcBEfq_iBlsM-m9fPOb-20">
<mxGeometry x="120" y="15" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="PkcBEfq_iBlsM-m9fPOb-6" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="PkcBEfq_iBlsM-m9fPOb-20">
<mxGeometry x="45" y="95" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="PkcBEfq_iBlsM-m9fPOb-7" value="SS1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="PkcBEfq_iBlsM-m9fPOb-20">
<mxGeometry y="90" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="PkcBEfq_iBlsM-m9fPOb-8" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="PkcBEfq_iBlsM-m9fPOb-20">
<mxGeometry x="45" y="175" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="PkcBEfq_iBlsM-m9fPOb-9" value="T1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="PkcBEfq_iBlsM-m9fPOb-20">
<mxGeometry y="170" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="PkcBEfq_iBlsM-m9fPOb-10" value="2" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="PkcBEfq_iBlsM-m9fPOb-20">
<mxGeometry x="120" y="95" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="PkcBEfq_iBlsM-m9fPOb-11" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;" edge="1" parent="PkcBEfq_iBlsM-m9fPOb-20" source="PkcBEfq_iBlsM-m9fPOb-10" target="PkcBEfq_iBlsM-m9fPOb-5">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="65" y="105" as="sourcePoint" />
<mxPoint x="65" y="55" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="PkcBEfq_iBlsM-m9fPOb-12" value="3" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="PkcBEfq_iBlsM-m9fPOb-20">
<mxGeometry x="200" y="15" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="PkcBEfq_iBlsM-m9fPOb-13" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="PkcBEfq_iBlsM-m9fPOb-20" source="PkcBEfq_iBlsM-m9fPOb-12">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="190" y="30" as="sourcePoint" />
<mxPoint x="150" y="30" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="PkcBEfq_iBlsM-m9fPOb-14" value="5" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;plain-blue;gradientColor=none;fillColor=#B5E3Fe;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="PkcBEfq_iBlsM-m9fPOb-20">
<mxGeometry x="200" y="95" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="PkcBEfq_iBlsM-m9fPOb-15" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;" edge="1" parent="PkcBEfq_iBlsM-m9fPOb-20" source="PkcBEfq_iBlsM-m9fPOb-14">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="146" y="25" as="sourcePoint" />
<mxPoint x="151" y="110" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="PkcBEfq_iBlsM-m9fPOb-16" value="4" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;plain-blue;gradientColor=none;fillColor=#B5E3Fe;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="PkcBEfq_iBlsM-m9fPOb-20">
<mxGeometry x="120" y="175" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="PkcBEfq_iBlsM-m9fPOb-17" value="B" style="verticalLabelPosition=middle;verticalAlign=middle;html=1;strokeWidth=1;shape=mxgraph.flowchart.on-page_reference;strokeColor=#b85450;fillColor=#f8cecc;labelPosition=center;align=center;dashed=1;fontStyle=1;spacing=0;spacingBottom=2;" vertex="1" parent="PkcBEfq_iBlsM-m9fPOb-20">
<mxGeometry x="120" y="170" width="14" height="14" as="geometry" />
</mxCell>
<mxCell id="PkcBEfq_iBlsM-m9fPOb-18" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;" edge="1" parent="PkcBEfq_iBlsM-m9fPOb-20" source="PkcBEfq_iBlsM-m9fPOb-16">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="199.43000000000006" y="182" as="sourcePoint" />
<mxPoint x="135" y="125" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="PkcBEfq_iBlsM-m9fPOb-19" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;" edge="1" parent="PkcBEfq_iBlsM-m9fPOb-20" source="PkcBEfq_iBlsM-m9fPOb-14" target="PkcBEfq_iBlsM-m9fPOb-12">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="440" y="230" as="sourcePoint" />
<mxPoint x="311" y="230" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>

View file

@ -0,0 +1,203 @@
<mxfile host="Electron" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/26.1.1 Chrome/132.0.6834.210 Electron/34.3.3 Safari/537.36" version="26.1.1" pages="3">
<diagram name="state 1" id="w7PF-E3A9k5X4TpleA9C">
<mxGraphModel dx="1070" dy="774" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="450" pageHeight="250" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="sifWEnGrpBqlT8R1-RFs-15" value="" style="group" vertex="1" connectable="0" parent="1">
<mxGeometry x="10" y="20" width="310" height="200" as="geometry" />
</mxCell>
<mxCell id="sifWEnGrpBqlT8R1-RFs-1" value="SS2" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="sifWEnGrpBqlT8R1-RFs-15">
<mxGeometry width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="sifWEnGrpBqlT8R1-RFs-2" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="sifWEnGrpBqlT8R1-RFs-15">
<mxGeometry x="45" y="5" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="sifWEnGrpBqlT8R1-RFs-3" value="1" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="sifWEnGrpBqlT8R1-RFs-15">
<mxGeometry x="120" y="5" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="sifWEnGrpBqlT8R1-RFs-4" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="sifWEnGrpBqlT8R1-RFs-15">
<mxGeometry x="45" y="85" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="sifWEnGrpBqlT8R1-RFs-5" value="SS1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="sifWEnGrpBqlT8R1-RFs-15">
<mxGeometry y="80" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="sifWEnGrpBqlT8R1-RFs-6" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="sifWEnGrpBqlT8R1-RFs-15">
<mxGeometry x="45" y="165" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="sifWEnGrpBqlT8R1-RFs-7" value="T1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="sifWEnGrpBqlT8R1-RFs-15">
<mxGeometry y="160" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="sifWEnGrpBqlT8R1-RFs-8" value="2" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="sifWEnGrpBqlT8R1-RFs-15">
<mxGeometry x="120" y="85" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="sifWEnGrpBqlT8R1-RFs-9" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;" edge="1" parent="sifWEnGrpBqlT8R1-RFs-15" source="sifWEnGrpBqlT8R1-RFs-8" target="sifWEnGrpBqlT8R1-RFs-3">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="65" y="95" as="sourcePoint" />
<mxPoint x="65" y="45" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="sifWEnGrpBqlT8R1-RFs-10" value="3" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="sifWEnGrpBqlT8R1-RFs-15">
<mxGeometry x="200" y="5" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="sifWEnGrpBqlT8R1-RFs-11" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="sifWEnGrpBqlT8R1-RFs-15" source="sifWEnGrpBqlT8R1-RFs-10">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="190" y="20" as="sourcePoint" />
<mxPoint x="150" y="20" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="sifWEnGrpBqlT8R1-RFs-12" value="B" style="verticalLabelPosition=middle;verticalAlign=middle;html=1;strokeWidth=1;shape=mxgraph.flowchart.on-page_reference;strokeColor=#b85450;fillColor=#f8cecc;labelPosition=center;align=center;dashed=1;fontStyle=1;spacing=0;spacingBottom=2;" vertex="1" parent="sifWEnGrpBqlT8R1-RFs-15">
<mxGeometry x="120" y="80" width="14" height="14" as="geometry" />
</mxCell>
<mxCell id="sifWEnGrpBqlT8R1-RFs-13" value="4" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="sifWEnGrpBqlT8R1-RFs-15">
<mxGeometry x="280" y="5" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="sifWEnGrpBqlT8R1-RFs-14" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;" edge="1" parent="sifWEnGrpBqlT8R1-RFs-15" source="sifWEnGrpBqlT8R1-RFs-13" target="sifWEnGrpBqlT8R1-RFs-10">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="290" y="59.659999999999854" as="sourcePoint" />
<mxPoint x="240" y="59.659999999999854" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
</root>
</mxGraphModel>
</diagram>
<diagram id="8cHA4ecnVEcz090J-liN" name="state 2">
<mxGraphModel dx="1070" dy="774" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="450" pageHeight="250" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="OwjlZwffn-Y4nYBfrumN-16" value="" style="group" vertex="1" connectable="0" parent="1">
<mxGeometry x="10" y="10" width="311" height="210" as="geometry" />
</mxCell>
<mxCell id="OwjlZwffn-Y4nYBfrumN-1" value="SS2" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="OwjlZwffn-Y4nYBfrumN-16">
<mxGeometry y="10" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="OwjlZwffn-Y4nYBfrumN-2" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="OwjlZwffn-Y4nYBfrumN-16">
<mxGeometry x="45" y="15" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="OwjlZwffn-Y4nYBfrumN-3" value="1" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="OwjlZwffn-Y4nYBfrumN-16">
<mxGeometry x="120" y="15" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="OwjlZwffn-Y4nYBfrumN-4" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="OwjlZwffn-Y4nYBfrumN-16">
<mxGeometry x="45" y="95" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="OwjlZwffn-Y4nYBfrumN-5" value="SS1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="OwjlZwffn-Y4nYBfrumN-16">
<mxGeometry y="90" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="OwjlZwffn-Y4nYBfrumN-6" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="OwjlZwffn-Y4nYBfrumN-16">
<mxGeometry x="45" y="175" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="OwjlZwffn-Y4nYBfrumN-7" value="T1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="OwjlZwffn-Y4nYBfrumN-16">
<mxGeometry y="170" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="OwjlZwffn-Y4nYBfrumN-8" value="2" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#B5E3FE;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="OwjlZwffn-Y4nYBfrumN-16">
<mxGeometry x="120" y="95" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="OwjlZwffn-Y4nYBfrumN-9" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;" edge="1" parent="OwjlZwffn-Y4nYBfrumN-16" source="OwjlZwffn-Y4nYBfrumN-8" target="OwjlZwffn-Y4nYBfrumN-3">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="65" y="105" as="sourcePoint" />
<mxPoint x="65" y="55" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="OwjlZwffn-Y4nYBfrumN-10" value="3" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="OwjlZwffn-Y4nYBfrumN-16">
<mxGeometry x="200" y="15" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="OwjlZwffn-Y4nYBfrumN-11" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="OwjlZwffn-Y4nYBfrumN-16" source="OwjlZwffn-Y4nYBfrumN-10">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="190" y="30" as="sourcePoint" />
<mxPoint x="150" y="30" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="OwjlZwffn-Y4nYBfrumN-12" value="" style="verticalLabelPosition=bottom;verticalAlign=top;html=1;shape=mxgraph.basic.polygon;polyCoords=[[0.24,0],[1,0],[1,0.4],[1,1],[0.48,1],[0,1],[0,0.75],[0,0.73],[0.02,0.5],[0,0.25],[0,0]];polyline=0;fillColor=none;dashed=1;strokeColor=#CC00CC;strokeWidth=2;perimeterSpacing=0;shadow=1;sketch=1;curveFitting=1;jiggle=2;fixDash=0;container=0;dropTarget=0;" vertex="1" parent="OwjlZwffn-Y4nYBfrumN-16">
<mxGeometry x="101" width="70" height="140" as="geometry" />
</mxCell>
<mxCell id="OwjlZwffn-Y4nYBfrumN-13" value="B" style="verticalLabelPosition=middle;verticalAlign=middle;html=1;strokeWidth=1;shape=mxgraph.flowchart.on-page_reference;strokeColor=#b85450;fillColor=#f8cecc;labelPosition=center;align=center;dashed=1;fontStyle=1;spacing=0;spacingBottom=2;" vertex="1" parent="OwjlZwffn-Y4nYBfrumN-16">
<mxGeometry x="121" y="90" width="14" height="14" as="geometry" />
</mxCell>
<mxCell id="OwjlZwffn-Y4nYBfrumN-14" value="4" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="OwjlZwffn-Y4nYBfrumN-16">
<mxGeometry x="281" y="15" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="OwjlZwffn-Y4nYBfrumN-15" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;" edge="1" parent="OwjlZwffn-Y4nYBfrumN-16" source="OwjlZwffn-Y4nYBfrumN-14" target="OwjlZwffn-Y4nYBfrumN-10">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="291" y="69.65999999999985" as="sourcePoint" />
<mxPoint x="231" y="30" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
</root>
</mxGraphModel>
</diagram>
<diagram id="9Yl-pgUNl23KlRTR3j43" name="state 3">
<mxGraphModel dx="1070" dy="774" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="450" pageHeight="250" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="3Z5IVvEdUQoImQymVIXm-16" value="" style="group" vertex="1" connectable="0" parent="1">
<mxGeometry x="10" y="10" width="310" height="210" as="geometry" />
</mxCell>
<mxCell id="3Z5IVvEdUQoImQymVIXm-1" value="" style="verticalLabelPosition=bottom;verticalAlign=top;html=1;shape=mxgraph.basic.polygon;polyCoords=[[0.24,0],[1,0],[1,0.4],[1,1],[0.48,1],[0,1],[0,0.75],[0,0.73],[0.02,0.5],[0,0.25],[0,0]];polyline=0;fillColor=none;dashed=1;strokeColor=#CC00CC;strokeWidth=2;perimeterSpacing=0;shadow=1;sketch=1;curveFitting=1;jiggle=2;fixDash=0;container=0;dropTarget=0;" vertex="1" parent="3Z5IVvEdUQoImQymVIXm-16">
<mxGeometry x="101" width="70" height="140" as="geometry" />
</mxCell>
<mxCell id="3Z5IVvEdUQoImQymVIXm-2" value="SS2" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="3Z5IVvEdUQoImQymVIXm-16">
<mxGeometry y="10" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="3Z5IVvEdUQoImQymVIXm-3" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="3Z5IVvEdUQoImQymVIXm-16">
<mxGeometry x="45" y="15" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="3Z5IVvEdUQoImQymVIXm-4" value="1" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#d5e8d4;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="3Z5IVvEdUQoImQymVIXm-16">
<mxGeometry x="120" y="15" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="3Z5IVvEdUQoImQymVIXm-5" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="3Z5IVvEdUQoImQymVIXm-16">
<mxGeometry x="45" y="95" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="3Z5IVvEdUQoImQymVIXm-6" value="SS1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="3Z5IVvEdUQoImQymVIXm-16">
<mxGeometry y="90" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="3Z5IVvEdUQoImQymVIXm-7" value="" style="whiteSpace=wrap;html=1;aspect=fixed;labelBackgroundColor=none;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="3Z5IVvEdUQoImQymVIXm-16">
<mxGeometry x="45" y="175" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="3Z5IVvEdUQoImQymVIXm-8" value="T1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;fontSize=14;fontStyle=1;fontFamily=Courier New;" vertex="1" parent="3Z5IVvEdUQoImQymVIXm-16">
<mxGeometry y="170" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="3Z5IVvEdUQoImQymVIXm-9" value="2" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#B5E3FE;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="3Z5IVvEdUQoImQymVIXm-16">
<mxGeometry x="120" y="95" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="3Z5IVvEdUQoImQymVIXm-10" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;" edge="1" parent="3Z5IVvEdUQoImQymVIXm-16" source="3Z5IVvEdUQoImQymVIXm-9" target="3Z5IVvEdUQoImQymVIXm-4">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="65" y="105" as="sourcePoint" />
<mxPoint x="65" y="55" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="3Z5IVvEdUQoImQymVIXm-11" value="3" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#B5E3FE;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="3Z5IVvEdUQoImQymVIXm-16">
<mxGeometry x="200" y="15" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="3Z5IVvEdUQoImQymVIXm-12" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="3Z5IVvEdUQoImQymVIXm-16" source="3Z5IVvEdUQoImQymVIXm-11">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="190" y="30" as="sourcePoint" />
<mxPoint x="150" y="30" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="3Z5IVvEdUQoImQymVIXm-13" value="B" style="verticalLabelPosition=middle;verticalAlign=middle;html=1;strokeWidth=1;shape=mxgraph.flowchart.on-page_reference;strokeColor=#b85450;fillColor=#f8cecc;labelPosition=center;align=center;dashed=1;fontStyle=1;spacing=0;spacingBottom=2;" vertex="1" parent="3Z5IVvEdUQoImQymVIXm-16">
<mxGeometry x="120" y="90" width="14" height="14" as="geometry" />
</mxCell>
<mxCell id="3Z5IVvEdUQoImQymVIXm-14" value="4" style="verticalLabelPosition=middle;verticalAlign=middle;strokeWidth=4;shape=mxgraph.flowchart.on-page_reference;fillColor=#B5E3FE;strokeColor=#000000;labelPosition=center;align=center;html=1;fontSize=18;fontStyle=1;spacingBottom=3;" vertex="1" parent="3Z5IVvEdUQoImQymVIXm-16">
<mxGeometry x="280" y="15" width="30" height="30" as="geometry" />
</mxCell>
<mxCell id="3Z5IVvEdUQoImQymVIXm-15" value="" style="endArrow=open;html=1;rounded=0;strokeWidth=3;curved=0;endFill=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="3Z5IVvEdUQoImQymVIXm-16" source="3Z5IVvEdUQoImQymVIXm-14" target="3Z5IVvEdUQoImQymVIXm-11">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="270" y="30" as="sourcePoint" />
<mxPoint x="230" y="30" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>

View file

@ -0,0 +1,36 @@
digraph arch_wayland {
edge[
fontname="DejaVu Sans",
dir="both",
arrowtail="dot",
arrowsize=.5,
fontname="DejaVu Sans",
fontsize="18",
]
node[
color=none,
margin=0,
fontname="DejaVu Sans",
fontsize="18",
]
c1 [label=<<TABLE STYLE="rounded" BGCOLOR="#ffbc00"><TR><TD>Wayland Client</TD></TR></TABLE>>, URL="#c1"]
c2 [label=<<TABLE STYLE="rounded" BGCOLOR="#ffbc00"><TR><TD>Wayland Client</TD></TR></TABLE>>, URL="#c2"]
comp [tooltip="Wayland Compositor", label=<<TABLE STYLE="rounded" BGCOLOR="#ffbc00"><TR><TD><BR/>Wayland<BR/>Compositor<BR/><BR/></TD></TR></TABLE>>, URL="#comp"]
impl [tooltip="KMS evdev Kernel", label=<<TABLE STYLE="rounded" BGCOLOR="#ffbc00"><TR><TD>KMS</TD><TD>evdev</TD></TR><TR><TD COLSPAN="2">Kernel</TD></TR></TABLE>>, URL="#impl"]
c1 -> comp [taillabel="③", labeldistance=2.5, URL="#step_3"];
c2 -> comp;
comp -> c1 [label="②", URL="#step_2"];
comp -> c2;
comp -> impl [xlabel = "④", URL="#step_4"];
comp -> impl [style = invis, label=" "];
impl -> comp [xlabel = "①", URL="#step_1"];
c1 -> c2 [style=invis];
}

View file

@ -0,0 +1,53 @@
digraph arch_x {
edge[
fontname="DejaVu Sans",
dir="both",
arrowtail="dot",
arrowsize=.5,
fontname="DejaVu Sans",
fontsize="18",
]
node[
shape="none",
color=none,
margin=0,
fontname="DejaVu Sans",
fontsize="18",
]
{
rank=same;
c1 [label=<<TABLE STYLE="rounded" BGCOLOR="#ffbc00"><TR><TD>X Client</TD></TR></TABLE>>, URL="#c1"]
c3 [label=<<TABLE STYLE="rounded" BGCOLOR="#ffbc00"><TR><TD>X Client</TD></TR></TABLE>>, URL="#c3"]
}
c2 [label=<<TABLE STYLE="rounded" BGCOLOR="#ffbc00"><TR><TD>X Client</TD></TR></TABLE>>, URL="#c2"]
{
rank=same;
xserver [tooltip="X Server", label=<<TABLE STYLE="rounded" BGCOLOR="#ffbc00"><TR><TD><BR/>X Server<BR/><BR/></TD></TR></TABLE>>, URL="#xserver"]
comp [tooltip="Compositor", label=<<TABLE STYLE="rounded" BGCOLOR="#ffbc00"><TR><TD><BR/>Compositor<BR/><BR/></TD></TR></TABLE>>, URL="#comp"]
}
impl [tooltip="KMS evdev Kernel", label=<<TABLE STYLE="rounded" BGCOLOR="#ffbc00"><TR><TD>KMS</TD><TD>evdev</TD></TR><TR><TD COLSPAN="2">Kernel</TD></TR></TABLE>>, URL="#impl"]
c1 -> xserver [taillabel="③", labeldistance=2, URL="#step_3"];
c2 -> xserver;
c3 -> xserver;
xserver -> c1 [taillabel="②", labeldistance=2, URL="#step_2"];
xserver -> c2;
xserver -> c3;
xserver -> impl [taillabel="⑥", labeldistance=1.75, URL="#step_6"];
xserver -> impl [style=invis, label=" "];
impl -> xserver [taillabel="①", labeldistance=1.75, URL="#step_1"];
xserver -> comp [style=invis];
xserver -> comp [taillabel="④", labeldistance=1.75, labelangle=-45, URL="#step_4"];
comp -> xserver [taillabel="⑤", URL="#step_5"];
comp -> xserver [style=invis]
c1 -> c2 [style=invis];
c3 -> c2 [style=invis];
}

58
doc/book/meson.build Normal file
View file

@ -0,0 +1,58 @@
srcs = files(
'src/Protocol.md',
'src/Foreword.md',
'src/Xwayland.md',
'src/SUMMARY.md',
'src/Content_Updates.md',
'src/Color.md',
'src/Message_XML.md',
'src/Architecture.md',
'src/Introduction.md',
'src/images/content-updates/sync-to-desync-subsurf-3.png',
'src/images/content-updates/sync-subsurf-case2-2.png',
'src/images/content-updates/simple-synchronized-state-4.png',
'src/images/content-updates/sync-subsurf-case2-3.png',
'src/images/content-updates/sync-to-desync-transition-2.png',
'src/images/content-updates/simple-desynchronized-state-4.png',
'src/images/content-updates/simple-synchronized-state-3.png',
'src/images/content-updates/simple-synchronized-state-1.png',
'src/images/content-updates/sync-subsurf-case1-4.png',
'src/images/content-updates/sync-to-desync-subsurf-1.png',
'src/images/content-updates/simple-desynchronized-state-1.png',
'src/images/content-updates/simple-desynchronized-state-3.png',
'src/images/content-updates/simple-desynchronized-state-6.png',
'src/images/content-updates/sync-subsurf-case1-2.png',
'src/images/content-updates/sync-subsurf-case1-1.png',
'src/images/content-updates/simple-synchronized-state-5.png',
'src/images/content-updates/simple-synchronized-state-2.png',
'src/images/content-updates/simple-desynchronized-state-2.png',
'src/images/content-updates/content-update-legend.png',
'src/images/content-updates/sync-to-desync-subsurf-2.png',
'src/images/content-updates/sync-to-desync-transition-3.png',
'src/images/content-updates/sync-subsurf-case2-1.png',
'src/images/content-updates/sync-subsurf-case1-5.png',
'src/images/content-updates/sync-subsurf-case1-3.png',
'src/images/content-updates/simple-desynchronized-state-5.png',
'src/images/content-updates/sync-to-desync-transition-1.png',
'src/images/icon.svg',
'src/images/x-architecture.png',
'src/images/wayland.png',
'src/images/wayland-architecture.png',
'src/images/xwayland-architecture.png',
'src/Compositors.md',
)
custom_target(
'Wayland-book',
command: [
mdbook,
'build',
'-d', meson.current_build_dir() / 'book',
meson.current_source_dir(),
],
depend_files: srcs,
output: 'book',
build_by_default: true,
install: true,
install_dir: publican_install_prefix,
)

View file

@ -0,0 +1,215 @@
# Wayland Architecture
## X vs. Wayland Architecture
A good way to understand the Wayland architecture and how it is different from X
is to follow an event from the input device to the point where the change it
affects appears on screen.
This is where we are now with X:
**X architecture diagram**
![](images/x-architecture.png)
1. The kernel gets an event from an input device and sends it to X through the
evdev input driver. The kernel does all the hard work here by driving the
device and translating the different device specific event protocols to the
linux evdev input event standard.
2. The X server determines which window the event affects and sends it to the
clients that have selected for the event in question on that window. The X
server doesn't actually know how to do this right, since the window location
on screen is controlled by the compositor and may be transformed in a number
of ways that the X server doesn't understand (scaled down, rotated, wobbling,
etc).
3. The client looks at the event and decides what to do. Often the UI will have
to change in response to the event - perhaps a check box was clicked or the
pointer entered a button that must be highlighted. Thus the client sends a
rendering request back to the X server.
4. When the X server receives the rendering request, it sends it to the driver
to let it program the hardware to do the rendering. The X server also
calculates the bounding region of the rendering, and sends that to the
compositor as a damage event.
5. The damage event tells the compositor that something changed in the window
and that it has to recomposite the part of the screen where that window is
visible. The compositor is responsible for rendering the entire screen
contents based on its scenegraph and the contents of the X windows. Yet, it
has to go through the X server to render this.
6. The X server receives the rendering requests from the compositor and either
copies the compositor back buffer to the front buffer or does a pageflip. In
the general case, the X server has to do this step so it can account for
overlapping windows, which may require clipping and determine whether or not
it can page flip. However, for a compositor, which is always fullscreen, this
is another unnecessary context switch.
As suggested above, there are a few problems with this approach. The X server
doesn't have the information to decide which window should receive the event,
nor can it transform the screen coordinates to window-local coordinates. And
even though X has handed responsibility for the final painting of the screen to
the compositing manager, X still controls the front buffer and modesetting. Most
of the complexity that the X server used to handle is now available in the
kernel or self contained libraries (KMS, evdev, mesa, fontconfig, freetype,
cairo, Qt etc). In general, the X server is now just a middle man that
introduces an extra step between applications and the compositor and an extra
step between the compositor and the hardware.
In Wayland the compositor is the display server. We transfer the control of KMS
and evdev to the compositor. The Wayland protocol lets the compositor send the
input events directly to the clients and lets the client send the damage event
directly to the compositor:
**Wayland architecture diagram**
![](images/wayland-architecture.png)
1. The kernel gets an event and sends it to the compositor. This is similar to
the X case, which is great, since we get to reuse all the input drivers in
the kernel.
2. The compositor looks through its scenegraph to determine which window should
receive the event. The scenegraph corresponds to what's on screen and the
compositor understands the transformations that it may have applied to the
elements in the scenegraph. Thus, the compositor can pick the right window
and transform the screen coordinates to window-local coordinates, by applying
the inverse transformations. The types of transformation that can be applied
to a window is only restricted to what the compositor can do, as long as it
can compute the inverse transformation for the input events.
3. As in the X case, when the client receives the event, it updates the UI in
response. But in the Wayland case, the rendering happens in the client, and
the client just sends a request to the compositor to indicate the region that
was updated.
4. The compositor collects damage requests from its clients and then
recomposites the screen. The compositor can then directly issue an ioctl to
schedule a pageflip with KMS.
## Wayland Rendering
One of the details I left out in the above overview is how clients actually
render under Wayland. By removing the X server from the picture we also removed
the mechanism by which X clients typically render. But there's another mechanism
that we're already using with DRI2 under X: direct rendering. With direct
rendering, the client and the server share a video memory buffer. The client
links to a rendering library such as OpenGL that knows how to program the
hardware and renders directly into the buffer. The compositor in turn can take
the buffer and use it as a texture when it composites the desktop. After the
initial setup, the client only needs to tell the compositor which buffer to use
and when and where it has rendered new content into it.
This leaves an application with two ways to update its window contents:
1. Render the new content into a new buffer and tell the compositor to use that
instead of the old buffer. The application can allocate a new buffer every
time it needs to update the window contents or it can keep two (or more)
buffers around and cycle between them. The buffer management is entirely
under application control.
2. Render the new content into the buffer that it previously told the compositor
to to use. While it's possible to just render directly into the buffer shared
with the compositor, this might race with the compositor. What can happen is
that repainting the window contents could be interrupted by the compositor
repainting the desktop. If the application gets interrupted just after
clearing the window but before rendering the contents, the compositor will
texture from a blank buffer. The result is that the application window will
flicker between a blank window or half-rendered content. The traditional way
to avoid this is to render the new content into a back buffer and then copy
from there into the compositor surface. The back buffer can be allocated on
the fly and just big enough to hold the new content, or the application can
keep a buffer around. Again, this is under application control.
In either case, the application must tell the compositor which area of the
surface holds new contents. When the application renders directly to the shared
buffer, the compositor needs to be noticed that there is new content. But also
when exchanging buffers, the compositor doesn't assume anything changed, and
needs a request from the application before it will repaint the desktop. The
idea that even if an application passes a new buffer to the compositor, only a
small part of the buffer may be different, like a blinking cursor or a spinner.
## Accelerated GPU Buffer Exchange
Clients
[exchange](https://docs.kernel.org/userspace-api/dma-buf-alloc-exchange.html)
GPU buffers with the compositor as dma-buf file descriptors, which are universal
handles that are independent of any particular rendering API or memory
allocator. The
[linux-dmabuf-v1](https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/main/stable/linux-dmabuf/linux-dmabuf-v1.xml)
protocol is used to turn one or more dma-buf FDs into a
[wl_buffer](https://wayland.app/protocols/wayland#wl_buffer).
If the client uses the
[Vulkan](https://docs.vulkan.org/spec/latest/chapters/VK_KHR_surface/wsi.html)
or
[EGL](https://registry.khronos.org/EGL/extensions/EXT/EGL_EXT_platform_wayland.txt)
(via
[wayland-egl](https://gitlab.freedesktop.org/wayland/wayland/-/tree/main/egl))
window-system integration (WSI), this is done transparently by the WSI.
Clients can alternatively allocate and import dma-bufs themselves using the GBM
library, Vulkan, udmabuf, or dma-buf heaps.
- Using GBM, the client can allocate a gbm_bo and export one or more dma-buf FDs
from it.
- Using Vulkan, the client can create a VkDeviceMemory object and use
[VK_EXT_external_memory_dma_buf](https://docs.vulkan.org/refpages/latest/refpages/source/VK_EXT_external_memory_dma_buf.html)
and
[VK_EXT_image_drm_format_modifier](https://docs.vulkan.org/refpages/latest/refpages/source/VK_EXT_image_drm_format_modifier.html)
to export a dma-buf FD from it.
- [udmabuf](https://lwn.net/Articles/749206/) can be used to create dma-buf FDs
from linear host memory.
- [Dma-buf heaps](https://docs.kernel.org/userspace-api/dma-buf-heaps.html) can
be used by privileged applications to create dma-buf FDs on embedded devices.
Compositors use
[VK_EXT_external_memory_dma_buf](https://docs.vulkan.org/refpages/latest/refpages/source/VK_EXT_external_memory_dma_buf.html)
and
[VK_EXT_image_drm_format_modifier](https://docs.vulkan.org/refpages/latest/refpages/source/VK_EXT_image_drm_format_modifier.html)
or
[EGL_EXT_image_dma_buf_import](https://registry.khronos.org/EGL/extensions/EXT/EGL_EXT_image_dma_buf_import.txt)
and
[EGL_EXT_image_dma_buf_import_modifiers](https://registry.khronos.org/EGL/extensions/EXT/EGL_EXT_image_dma_buf_import_modifiers.txt)
to import the dma-bufs provided by the client into their own Vulkan or EGL
renderers.
Clients do not need to wait for the GPU to finish rendering before submitting
dma-bufs to the compositor. Clients can use the
[linux-drm-syncobj-v1](https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/main/staging/linux-drm-syncobj/linux-drm-syncobj-v1.xml)
protocol to exchange DRM synchronization objects with the compositor. These
objects are used to asynchronously signal ownership transfer of buffers from
clients to the compositor and vice versa. The WSIs do this transparently.
If the linux-drm-syncobj-v1 protocol is not supported by the compositor, clients
and compositors can use the
[DMA_BUF_IOCTL_EXPORT_SYNC_FILE](https://docs.kernel.org/driver-api/dma-buf.html#c.dma_buf_export_sync_file)
and
[DMA_BUF_IOCTL_IMPORT_SYNC_FILE](https://docs.kernel.org/driver-api/dma-buf.html#c.dma_buf_import_sync_file)
ioctls to access and create implicit synchronization barriers.
## Display Programming
Compositors enumerate DRM KMS devices using
[udev](https://en.wikipedia.org/wiki/Udev). Udev also notifies compositors of
KMS device and display hotplug events.
Access to DRM KMS device ioctls is privileged. Since compositors usually run as
unprivileged applications, they typically gain access to a privileged file
descriptor using the
[TakeDevice](https://www.freedesktop.org/software/systemd/man/latest/org.freedesktop.login1.html#Session%20Objects)
method provided by logind.
Using the file descriptor, compositors use KMS
[ioctls](https://docs.kernel.org/gpu/drm-kms.html) to enumerate the available
displays.
Compositors use [atomic mode
setting](https://docs.kernel.org/gpu/drm-kms.html#atomic-mode-setting) to change
the buffer shown by the display, to change the display's resolution, to enable
or disable HDR, and so on.

100
doc/book/src/Color.md Normal file
View file

@ -0,0 +1,100 @@
# Color management
## Overview
Color management in Wayland considers only displays. All pictures in Wayland are
always display-referred, meaning that the pixel values are intended as-is for
some specific display where they would produce the light emissions
([stimuli](https://cie.co.at/eilvterm/17-23-002)) the picture's author desired.
Wayland does not support displaying "raw" camera or scanner images as they are
not display-referred, nor are they even pictures without complex and subjective
processing.
Stimuli — the picture itself — are only half of the picture reproduction. The
other half is the environment where a display is viewed. A striking example is
comparing a brightly lit office to a dark movie theater, the stimuli required to
produce a good reading of the picture is greatly different. Therefore
display-referred does not include only the display but the viewing environment
as well.
Window systems have been very well capable of operating without any explicit
consideration to color management. This is because there used to be the implicit
assumption of the standard display, the sRGB display, which all computer
monitors implemented, more or less. The viewing environment was and still is
accounted by adjusting the display and/or the room to produce a workable
experience. Pictures are authored on a computer system by drawing, painting and
adjusting the picture until it looks right on the author's monitor. This
implicitly builds the standard display and environment assumption into the
picture data. Deviations from the sRGB specification were minor enough that they
often did not matter if not in a professional context like the printing
industry. Displaying video material required some more attention to the details,
because video and television standards differ enough from the sRGB display. What
really made explicit color management a hard requirement for entertainment is
the coming of wide color gamut (WCG) and high dynamic range (HDR) materials and
displays.
The color management design in Wayland follows the general Wayland design
principles: compositors tell clients what would be the optimal thing to do,
clients tell the compositors what kind of pictures they are actually producing,
and then compositors display those pictures the best they can.
## Protocol Interfaces
Color management interfaces in Wayland and divided into two protocols:
[color-management](https://gitlab.freedesktop.org/wayland/wayland-protocols/-/tree/main/staging/color-management?ref_type=heads)
and
[color-representation](https://gitlab.freedesktop.org/wayland/wayland-protocols/-/tree/main/staging/color-representation?ref_type=heads).
They are designed to work together, but they can also be used independently when
the other one is not needed.
### Color-management
Color management protocol has two main purposes. First, it puts the
responsibility of color management on the compositor. This means that clients do
not necessarily need to care about color management at all, and can display just
fine by using the traditional standard display assumption even when the actual
display is wildly different. Clients can also choose to target some other
assumed display and let the compositor handle it, or they can explicitly render
for the actual display at hand. Second, when the window system has multiple
different monitors, and a wl_surface happens to span more than one monitor, the
compositor can display the surface content correctly on all spanned monitors
simultaneously, as much as physically possible.
Color-management protocol concentrates on colorimetry: when you have a pixel
with RGB values, what stimulus do those values represent. The stimulus
definition follows the CIE 1931 two-degree observer model. Some core concepts
here are color primaries, white point, transfer function, and dynamic range. The
viewing environment is represented in an extremely simplified way as the
reference white luminance. The connection between pixel RGB values and stimulus
plus viewing environment is recorded in an _image description_ object. Clients
can create image description objects and tag `wl_surface`s with them, to
indicate what kind of surface content there will be. Clients can also ask what
image description the compositor would prefer to have on the `wl_surface`, and
that preference can change over time, e.g. when the `wl_surface` is moved from
one `wl_output` to another. Following the compositor's preference may provide
advantages in image quality and power consumption.
Image description objects can come in two flavors: parametric and ICC-based. The
above was written with parametric image descriptions in mind, and they have
first-class support for HDR. ICC-based image descriptions are wrapping an ICC
profile and have no other data. ICC profiles are the standard tool for standard
dynamic range (SDR) display color management. This means the capabilities
between the two flavors differ, and one cannot always be replaced by the other.
Compositor support for each flavor is optional.
### Color-representation
Color-representation protocol deals with (potentially sub-sampled) YCbCr-RGB
conversion, quantization range, and the inclusion of alpha in the RGB color
channels, a.k.a. pre-multiplication. There are several different specifications
on how an YCbCr-like (including ICtCp) signal, with chroma sub-sampling or not,
is created from a full-resolution RGB image. Again, a client can tag a
`wl_surface` with color-representation metadata to tell the compositor what kind
of pixel data will be displayed through the wl_surface.
The main purpose of color-representation is to correctly off-load the YCbCr-RGB
conversion to the compositor, which can then opportunistically off-load it
further to very power-efficient fixed-function circuitry in a display
controller. This can significantly reduce power consumption when watching videos
compared to using a GPU for the same, and on some embedded hardware platforms it
is a hard requirement for processing high resolution video.

View file

@ -0,0 +1,76 @@
# Types of Compositors
Compositors come in different types, depending on which role they play in the
overall architecture of the OS. For instance, a [system
compositor](#system-compositor) can be used for booting the system, handling
multiple user switching, a possible console terminal emulator and so forth. A
different compositor, a [session compositor](#session-compositor) would provide
the actual desktop environment. There are many ways for different types of
compositors to co-exist.
In this section, we introduce three types of Wayland compositors relying on
[libwayland-server](https://gitlab.freedesktop.org/wayland/wayland).
## System Compositor
A system compositor can run from early boot until shutdown. It effectively
replaces the kernel vt system, and can tie in with the systems graphical boot
setup and multiseat support.
A system compositor can host different types of session compositors, and let us
switch between multiple sessions (fast user switching, or secure/personal
desktop switching).
A linux implementation of a system compositor will typically use libudev, egl,
kms, evdev and cairo.
For fullscreen clients, the system compositor can reprogram the video scanout
address to read directly from the client provided buffer.
## Session Compositor
A session compositor is responsible for a single user session. If a system
compositor is present, the session compositor will run nested under the system
compositor. Nesting is feasible because the protocol is asynchronous; roundtrips
would be too expensive when nesting is involved. If no system compositor is
present, a session compositor can run directly on the hardware.
X applications can continue working under a session compositor by means of a
root-less X server that is activated on demand.
Possible examples for session compositors include
- gnome-shell
- moblin
- kwin
- kmscon
- rdp session
- Weston with X11 or Wayland backend is a session compositor nested in another
session compositor.
- fullscreen X session under Wayland
## Embedding Compositor
X11 lets clients embed windows from other clients, or lets clients copy pixmap
contents rendered by another client into their window. This is often used for
applets in a panel, browser plugins and similar. Wayland doesn't directly allow
this, but clients can communicate GEM buffer names out-of-band, for example,
using D-Bus, or command line arguments when the panel launches the applet.
Another option is to use a nested Wayland instance. For this, the Wayland server
will have to be a library that the host application links to. The host
application will then pass the Wayland server socket name to the embedded
application, and will need to implement the Wayland compositor interface. The
host application composites the client surfaces as part of its window, that is,
in the web page or in the panel. The benefit of nesting the Wayland server is
that it provides the requests the embedded client needs to inform the host about
buffer updates and a mechanism for forwarding input events from the host
application.
An example for this kind of setup is firefox embedding the flash player as a
kind of special-purpose compositor.

View file

@ -0,0 +1,214 @@
# Content Updates
## Overview
In the Wayland protocol, requests are asynchronous but take effect immediately
when the compositor receives them. However, some requests on surfaces are not
applied immediately but are instead double-buffered to allow atomic changes.
These double-buffered changes are committed through the wl_surface.commit
request, which creates a Content Update.
Content Updates encapsulate all double-buffered state changes and can be applied
by the compositor. The complexity arises when considering subsurfaces, which can
operate in synchronized mode. When a subsurface is synchronized, its Content
Updates must be applied atomically together with the parent surface's state.
This synchronization can extend through an entire tree of subsurfaces, where
child subsurfaces inherit the synchronized behavior from their parents.
Historically, Content Updates from synchronized subsurfaces were merged into the
pending state of the parent surface on commit. However, the introduction of
constraints—which can defer the application of Content Updates—necessitated a
more sophisticated model. This led to the implementation of per-surface queues
of Content Updates, with dependencies between Content Updates across different
queues. This queuing model maintains backwards compatibility with the earlier
approach of merging Content Updates into the parent's pending state on commit.
The core protocol defines the semantics of Content Updates using per-surface
queues, but compositors that do not need to support constraints may implement
the simpler legacy model where synchronized subsurface states are merged
directly into the parent's pending state.
## Rules
The core protocol specifies the behavior in wl_subsurface and wl_surface.commit.
The behavior can be summarized by the following rules:
1. Content Updates (CU) contain all double-buffered state of the surface and
selected state from their direct children.
2. Surfaces which are effectively synchronized create Synchronized Content
Updates (SCU), otherwise they create Desync Content Updates (DCU).
3. When a CU is created, it gets a dependency on the previous CU of the same
queues (if it exists).
4. When a CU is created, it gets a dependency on the last SCU of direct child
surfaces that are not reachable (if they exists).
5. The CUs and their dependencies form a DAG, where CUs are nodes and
dependencies are edges.
6. All DCUs starting from the front of the queues until the first SCU or the
back of the queue is reached are candidates.
7. If the maximal DAG that's reachable from a candidate (candidate DAG) does not
have any constraints, then this DAG can be applied.
8. A DAG is applied atomically by recursively applying a content update without
dependencies and removing it from the DAG.
9. Surfaces transition from effectively sync to effectively desync after their
parents.
10. When a surface transitions to effectively desync, all SCUs in its queue
which are not reachable by a DCU become DCUs.
## Examples
These examples should help to build an intuition for how content updates
actually behave. They cover the interesting edge cases, such as subsurfaces with
constraints, and transitioning from a sync subsurface to a desync one.
In all the examples below, the surface T1 refers to a toplevel surface, SS1
refers to a sub-surface which is a child of T1, and SS2 refers to a sub-surface
which is a child of SS1.
### Legend
![](images/content-updates/content-update-legend.png)
### Simple Desynchronized Case
1. SS2 is effectively desynchronized and commits. This results in the
desynchronized content update (DCU) _1_.
![](images/content-updates/simple-desynchronized-state-1.png)
2. DCU _1_ is a candidate, and the candidate DAG reachable from DCU _1_ is only DCU
_1_ itself. DCU _1_ and thus the candidate DAG does not have any constraints and
can be applied.
![](images/content-updates/simple-desynchronized-state-2.png)
3. The content updates of the candidate DAG get applied to the surface atomically.
![](images/content-updates/simple-desynchronized-state-3.png)
4. T1 commits a DCU with a _buffer-sync_ constraint. It is a candidate but its DAG
can't be applied because it contains a constraint.
![](images/content-updates/simple-desynchronized-state-4.png)
5. T1 commits another CU (DCU _3_) which is added at the end of the queue, with a
dependency to the previous CU (DCU _2_). Both DCU _2_ and DCU _3_ are
candidates, but both DAGs contain DCU _2_ with a constraint, and can't be
applied.
![](images/content-updates/simple-desynchronized-state-5.png)
6. When the constraint gets cleared, both DAGs can be applied to the surface
atomitcally (either only _2_, or _2_ and _3_).
![](images/content-updates/simple-desynchronized-state-6.png)
### Simple Synchronized Case
1. SS1 and SS2 are effectively synchronized. SS2 commits SCU _1_.
![](images/content-updates/simple-synchronized-state-1.png)
2. SS1 commits SCU _2_. The direct child surfaces SS2 has the last SCU _1_ in its
queue, which is not reachable. This creates a dependency from SCU _2_ to SCU
_1_.
![](images/content-updates/simple-synchronized-state-2.png)
3. SS1 commits SCU _3_. The direct child surfaces SS2 has the last SCU _1_ in its
queue, which is already reachable by SCU _2_. No dependency to SCU _1_ is
created. A dependency to the previous CU of the same queue (SCU _2_) is created.
![](images/content-updates/simple-synchronized-state-3.png)
4. T1 commit DCU _4_. It is a candidate, its DAG does not contain any constraint
and it can be applied.
![](images/content-updates/simple-synchronized-state-4.png)
5. The DAG gets applied to the surfaces atomically.
![](images/content-updates/simple-synchronized-state-5.png)
### Complex Synchronized Subsurface Case 1
1. Every DCU (_1_ and _6_) contain CUs with constraints in their candidate DAG
![](images/content-updates/sync-subsurf-case1-1.png)
2. Waiting until the _buffer-sync_ constrain on CU _1_ is cleared, the candidate
DAG of CU _1_ does not contain constraints and can be applied
![](images/content-updates/sync-subsurf-case1-2.png)
3. That leaves the candidate DAG of CU _6_ which still contains another CU with a
_buffer-sync_ constrain
![](images/content-updates/sync-subsurf-case1-3.png)
4. Waiting until the _buffer-sync_ constrain on CU _6_ is cleared, the candidate
DAG of _6_ does not contain CUs with constraints and can be applied.
![](images/content-updates/sync-subsurf-case1-4.png)
5. There is no DCU left and no constraint remaining. Nothing more can be applied
without a new CU.
![](images/content-updates/sync-subsurf-case1-5.png)
### Complex Synchronized Subsurface Case 2
1. Both DCUs (_1_ and _6_) have a reachable DAG containing CU _1_ with a constraint
![](images/content-updates/sync-subsurf-case2-1.png)
2. Waiting until the _buffer-sync_ constrain on _1_ is cleared, both DAGs contain
no CU with constraints and can be applied in any order
![](images/content-updates/sync-subsurf-case2-2.png)
3. That leaves the same state as in the previous case
![](images/content-updates/sync-subsurf-case2-3.png)
### Synchronized to Desynchronized Subsurface
1. There is one DCU (_4_) with its reachable DAG that cannot be applied because CU
_4_ contains a constraint
![](images/content-updates/sync-to-desync-subsurf-1.png)
2. Surface _SS1_ transitions from effectively synchronized to effectively
desynchronized. SCU _2_ is reachable by DCU _4_ so nothing changes.
![](images/content-updates/sync-to-desync-subsurf-2.png)
3. Surface _SS1_ provides a new DCU (_5_) but because the CU before (_2_) is a
Synchronized CU, it is not a candidate
![](images/content-updates/sync-to-desync-subsurf-3.png)
### Synchronized to Desynchronized Transition
1. There are four SCUs and all surfaces are effectively synchronized.
![](images/content-updates/sync-to-desync-transition-1.png)
2. Surface _SS1_ transitions to effectively desynchronized and SCU _2_ becomes a
DCU because it is not reachable from a DCU
![](images/content-updates/sync-to-desync-transition-2.png)
3. Surface _SS2_ transitions to effectively desynchronized. SCUs _3_ and _4_ become
DCUs because they are not reachable from a DCU. SCU _1_ does not change because
it is reachable by DCU _2_.
![](images/content-updates/sync-to-desync-transition-3.png)

86
doc/book/src/Foreword.md Normal file
View file

@ -0,0 +1,86 @@
<img style="display: block; margin: auto;" src="images/wayland.png">
# Preface
This document describes the Wayland architecture and Wayland model of operation.
This document is aimed primarily at Wayland developers and those looking to
program with it; it does not cover application development.
There have been many contributors to this document and since this is only the
first edition many errors are expected to be found. We appreciate corrections.
Yours, the Wayland open-source community November 2012
## Protocol Documentation
This document does not describe the semantics of individual messages sent
between compositors and clients. Consult the following documents to learn about
concrete Wayland interfaces, requests, and events.
- [wayland.xml] - The official documentation of the core protocol.
- [wayland-protocols] - Standardized Wayland extension protocols.
- [wayland.app] - A community-maintained website that renders these protocols,
and many more, as easily accessible HTML pages.
[wayland.xml]: https://gitlab.freedesktop.org/wayland/wayland/-/blob/main/protocol/wayland.xml
[wayland-protocols]: https://gitlab.freedesktop.org/wayland/wayland-protocols
[wayland.app]: https://wayland.app
## About the Book
This book is written in markdown and converted to HTML using
[mdbook](https://rust-lang.github.io/mdBook).
It supports the [CommonMark](https://commonmark.org/) dialect of markdown plus a number of
widely supported extensions:
- `~~strikethrough~~`
- ```markdown
footnotes[^note]
[^note]: text
```
- ```markdown
| Tables | Header2 |
|--------|---------|
| abc | def |
```
- ```markdown
- [x] Task lists
- [ ] Incomplete task
```
- ```markdown
definition lists
: This is the definition of a
definition list
```
- ```markdown
> [!NOTE]
> Admonitions
```
The full list of extensions is documented
[here](https://rust-lang.github.io/mdBook/format/markdown.html#extensions).
## Copyright
Copyright © 2012 Kristian Høgsberg
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next
paragraph) shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

View file

@ -0,0 +1,73 @@
# Introduction
## Motivation
Most Linux and Unix-based systems rely on the X Window System (or simply _X_) as
the low-level protocol for building bitmap graphics interfaces. On these
systems, the X stack has grown to encompass functionality arguably belonging in
client libraries, helper libraries, or the host operating system kernel. Support
for things like PCI resource management, display configuration management,
direct rendering, and memory management has been integrated into the X stack,
imposing limitations like limited support for standalone applications,
duplication in other projects (e.g. the Linux fb layer or the DirectFB project),
and high levels of complexity for systems combining multiple elements (for
example radeon memory map handling between the fb driver and X driver, or VT
switching).
Moreover, X has grown to incorporate modern features like offscreen rendering
and scene composition, but subject to the limitations of the X architecture. For
example, the X implementation of composition adds additional context switches
and makes things like input redirection difficult.
![](images/x-architecture.png)
The diagram above illustrates the central role of the X server and compositor in
operations, and the steps required to get contents on to the screen.
Over time, X developers came to understand the shortcomings of this approach and
worked to split things up. Over the past several years, a lot of functionality
has moved out of the X server and into client-side libraries or kernel drivers.
One of the first components to move out was font rendering, with freetype and
fontconfig providing an alternative to the core X fonts. Direct rendering OpenGL
as a graphics driver in a client side library went through some iterations,
ending up as DRI2, which abstracted most of the direct rendering buffer
management from client code. Then cairo came along and provided a modern 2D
rendering library independent of X, and compositing managers took over control
of the rendering of the desktop as toolkits like GTK+ and Qt moved away from
using X APIs for rendering. Recently, memory and display management have moved
to the Linux kernel, further reducing the scope of X and its driver stack. The
end result is a highly modular graphics stack.
## The compositing manager as the display server
Wayland is a new display server and compositing protocol, and Weston is the
implementation of this protocol which builds on top of all the components above.
We are trying to distill out the functionality in the X server that is still
used by the modern Linux desktop. This turns out to be not a whole lot.
Applications can allocate their own off-screen buffers and render their window
contents directly, using hardware accelerated libraries like libGL, or high
quality software implementations like those found in Cairo. In the end, whats
needed is a way to present the resulting window surface for display, and a way
to receive and arbitrate input among multiple clients. This is what Wayland
provides, by piecing together the components already in the eco-system in a
slightly different way.
X will always be relevant, in the same way Fortran compilers and VRML browsers
are, but its time that we think about moving it out of the critical path and
provide it as an optional component for legacy applications.
Overall, the philosophy of Wayland is to provide clients with a way to manage
windows and how their contents are displayed. Rendering is left to clients, and
system wide memory management interfaces are used to pass buffer handles between
clients and the compositing manager.
![](images/wayland-architecture.png)
The figure above illustrates how Wayland clients interact with a Wayland server.
Note that window management and composition are handled entirely in the server,
significantly reducing complexity while marginally improving performance through
reduced context switching. The resulting system is easier to build and extend
than a similar X system, because often changes need only be made in one place.
Or in the case of protocol extensions, two (rather than 3 or 4 in the X case
where window management and/or composition handling may also need to be
updated).

515
doc/book/src/Message_XML.md Normal file
View file

@ -0,0 +1,515 @@
# Message Definition Language
## Overview
The fundamentals of the Wayland protocol are explained in [Wayland Protocol and
Model of Operation](Protocol.md). This chapter formally defines the language
used to define Wayland protocols.
Wayland is an object-oriented protocol. Each object follows exactly one
interface. An interface is a collection of message and enumeration definitions.
A message can be either a request (sent by a client) or an event (sent by a
server). A message can have arguments. All arguments are typed.
## XML Elements
### protocol
```
protocol ::= (copyright?, description? interface+)
```
`protocol` is the root element in a Wayland protocol XML file. Code generation
tools may optionally use the protocol `name` in API symbol names. The XML file
name should be similar to the protocol name.
The description element should be used to document the intended purpose of the
protocol, give an overview, and give any development stage notices if
applicable.
The copyright element should be used to indicate the copyrights and the license
of the XML file.
**Required attributes**
`name`="`cname`"
: The name of the protocol (a.k.a protocol extension). The name must start
with one of the ASCII characters a-z, A-Z, or underscore, and the following
characters may additionally include numbers 0-9.
The name should be globally unique. Protocols to be included in
[wayland-protocols](https://gitlab.freedesktop.org/wayland/wayland-protocols)
must follow the naming rules set there. Other protocols should use a unique
prefix for the name, e.g. referring to the owning project's name.
### copyright
Parent elements: protocol
```
copyright ::= #PCDATA
```
Contains free-form, pre-formatted text for copyright and license notices.
### description
Parent elements: protocol, interface, request, event, arg, enum, entry
```
description ::= #PCDATA
```
Contains human-readable documentation for its parent element. May contain
formatted text, including paragraphs and bulleted lists.
**Optional attributes**
`summary`="`summary`"
: A short (half a line at most) description of the documented element.
When a description element is used, it is recommended to not use the
`summary` attribute of the parent element.
### interface
Parent elements: protocol
```
interface ::= (description?, (request|event|enum)+)
```
An interface element contains the requests and events that form the interface.
Enumerations can also be defined with enum elements. These all belong into the
namespace of the interface. Code generation tools may use the interface `name`
in API symbol names.
Interfaces form an ancestry tree. Aside from
[wl_display](https://wayland.app/protocols/wayland#wl_display), new protocol
objects are always created through an existing protocol object that may be
referred to as _the factory object_. This can happen in one of two ways: the
factory object's interface either defines or does not define the new object's
interface.
When the factory interface defines the new object's interface, the new object
also inherits the factory object's interface version number. This number defines
the interface version of the new object. The factory object is referred to as
_the parent object_ and the factory interface is referred to as _the parent
interface_. This forms the ancestry tree of interfaces.
When the factory interface does not define the new object's interface, both the
interface name and the version must be communicated explicitly. The foremost
example of this is
[wl_registry.bind](https://wayland.app/protocols/wayland#wl_registry:request:bind).
In this case the terms "parent" or "ancestor" are not used. Interfaces that are
advertised through
[wl_registry](https://wayland.app/protocols/wayland#wl_registry) are called
_global interfaces_, or globals for short.
If objects having the interface can cause protocol errors, the protocol error
codes must be defined within the interface with an enum element with its `name`
set to `"error"`. Protocol error codes are always specific to the interface of
the object referred to in
[wl_display.error](https://wayland.app/protocols/wayland#wl_display:event:error).
The description element should be used to describe the purpose and the general
usage of the interface.
**Required attributes**
`name`="`cname`"
: The name of the interface. The name must start with one of the ASCII
characters a-z, A-Z, or underscore, and the following characters may
additionally include numbers 0-9. The name must be unique in the
protocol, and preferably it should also be globally unique to avoid API
conflicts in language bindings of multiple protocols.
Protocols to be included in
[wayland-protocols](https://gitlab.freedesktop.org/wayland/wayland-protocols)
must follow the interface naming rules set there. Other protocols should use
a unique prefix for the name, e.g. referring to the owning project's name.
`version`="`V`"
: The interface's latest version number `V` must be an integer greater than
zero. An interface element defines all versions of the interface from 1 to
`V` inclusive. The contents of each interface version are defined in each of
the request, event, enum and entry elements using the attributes `since` and
`deprecated-since`, and in the specification text.
When an interface is extended, the version number must be incremented on all
the interfaces part of the same interface ancestry tree. The exception to
this rule are interfaces which are forever stuck to version 1, which is
usually caused by having multiple parent interfaces with independent
ancestor global interfaces. In this case, the `frozen="true"` attribute
described below should be used.
A protocol object may have any defined version of the interface. The version
of the object is determined at runtime either by inheritance from another
protocol object or explicitly.
It is possible for a protocol object to have a version higher than defined
by its interface. This may happen when the interface is stuck at version 1
as per above. It may also happen when a protocol XML file has not been
thoroughly updated as required. In such cases the object shall function as
with the highest defined interface version.
**Optional attributes**
`frozen`="`true`"
: The interface is frozen and forever stuck at version 1.
This attribute should be applied to interfaces that have multiple parent
interfaces with independent ancestor global interfaces, for example
`wl_buffer` and `wl_callback`.
### request
Parent elements: interface
```
request ::= (description?, arg*)
```
Defines a request, a message from a client to a server. Requests are always
associated with a specific protocol object.
Requests are automatically assigned opcodes in the order they appear inside the
interface element. Therefore the only backwards-compatible way to add requests
to an interface is to add them to the end. Any event elements do not interfere
with request opcode assignments.
The arg elements declare the request's arguments. There can be 0 to 20 arguments
for a request. The order of arg inside the request element defines the order of
the arguments on the wire. All declared arguments are mandatory, and extra
arguments are not allowed on the wire.
The description element should be used to document the request.
**Required attributes**
`name`="`cname`"
: The name of the request. The name must start with one of the ASCII
characters a-z, A-Z, or underscore, and the following characters may
additionally include numbers 0-9. The name must be unique within
all requests and events in the containing interface.
Code and language binding generators may use the name in the API they
create. The `name` of the containing interface provides the namespace for
requests.
**Optional attributes**
`type`="`destructor`"
: When this attribute is present, the request is a destructor: it shall
destroy the protocol object it is sent on. Protocol IPC libraries may use
this for bookkeeping protocol object lifetimes.
Libwayland-client uses this information to ignore incoming events for
destroyed protocol objects. Such events may occur due to a natural race
condition between the client destroying a protocol object and the server
sending events before processing the destroy request.
`since`="`S`"
: `S` must be an integer greater than zero. If `since` is not specified,
`since="1"` is assumed.
This request was added in interface `version` `S`. The request does not
exist if the protocol object has a bound version smaller than `S`. Attempts
to use it in such a case shall raise the protocol error
`wl_display.error.invalid_method`.
`deprecated-since`="`D`"
: `D` must be an integer greater than the value of `since`. If
`deprecated-since` is not specified, then the request is not deprecated in
any version of the containing interface.
This request was deprecated in interface `version` `D` and above, and should
not be sent on protocol objects of such version. This is informational.
Compositors must still be prepared to handle the request unless specified
otherwise.
### event
Parent elements: interface
```
event ::= (description?, arg*)
```
Defines an event, a message from a server to a client. Events are always
associated with a specific protocol object.
Events are automatically assigned opcodes in the order they appear inside the
interface element. Therefore the only backwards-compatible way to add events to
an interface is to add them to the end. Any request elements do not interfere
with event opcode assignments.
The arg elements declare the event's arguments. There can be 0 to 20 arguments
for an event. The order of arg inside the event element defines the order of the
arguments on the wire. All declared arguments are mandatory, and extra arguments
are not allowed on the wire.
The description element should be used to document the event.
**Required attributes**
`name`="`cname`"
: The name of the event. The name must start with one of the ASCII characters
a-z, A-Z, or underscore, and the following characters may additionally
include numbers 0-9. The name must be unique within all requests and events
in the containing interface.
Code and language binding generators may use the name in the API they
create. The `name` of the containing interface provides the namespace for
events.
**Optional attributes**
`type`="`destructor`"
: When this attribute is present, the event is a destructor: it shall destroy
the protocol object it is sent on. Protocol IPC libraries may use this for
bookkeeping protocol object lifetimes.
> [!WARNING]
> Destructor events are an underdeveloped feature in Wayland. They can be
> used only on client-created protocol objects, and it is the protocol
> designer's responsibility to design such a message exchange that race
> conditions cannot occur. The main problem would be a client sending a
> request at the same time as the server is sending a destructor event. The
> server will consider the protocol object to be already invalid or even
> recycled when it proceeds to process the request. This often results in
> protocol errors, but under specific conditions it might also result in
> silently incorrect behavior.
>
> Destructor events should not be used in new protocols. If a destructor
> event is necessary, the simplest way to avoid these problems is to have
> the interface not contain any requests.
`since`="`S`"
: `S` must be an integer greater than zero. If `since` is not specified,
`since="1"` is assumed.
This event was added in interface `version` `S`. The event does not exist if
the protocol object has a bound version smaller than `S`.
`deprecated-since`="`D`"
: `D` must be an integer greater than the value of `since`. If
`deprecated-since` is not specified, then the event is not deprecated in any
version of the containing interface.
This event was deprecated in interface `version` `D` and above, and should
not be sent on protocol objects of such version. This is informational.
Clients must still be prepared to receive this event unless otherwise
specified.
### arg
Parent elements: request, event
```
arg ::= description?
```
This element declares one argument for the request or the event.
**Required attributes**
`name`="`cname`"
: The name of the argument. The name must start with one of the ASCII
characters a-z, A-Z, or underscore, and the following characters may
additionally include numbers 0-9. The name must be unique within
all the arguments of the parent element.
`type`="`T`"
: The type `T` of the argument datum must be one of:
`int`
: 32-bit signed integer.
`uint`
: 32-bit unsigned integer.
`fixed`
: Signed 24.8-bit fixed-point value.
`string`
: UTF-8 encoded string value, NUL byte terminated. Interior NUL bytes are
not allowed.
`array`
: A byte array of arbitrary data.
`fd`
: A file descriptor.
The file descriptor must be open and valid on send. It is not possible
to pass a null value.
`new_id`
: Creates a new protocol object. A request or an event may have at most
one `new_id` argument.
If `interface` is specified, the new protocol object shall have the
specified interface, and the new object's (interface) version shall be
the version of the object on which the request or event is being sent.
If `interface` is not specified, the request shall implicitly have two
additional arguments: A `string` for an interface name, and a `uint` for
the new object's version. Leaving the interface unspecified is reserved
for special use,
[wl_registry.bind](https://wayland.app/protocols/wayland#wl_registry:request:bind)
for example.
> [!NOTE]
> An event argument must always specify the `new_id` `interface`.
`object`
: Reference to an existing protocol object.
The attribute `interface` should be specified. Otherwise IPC libraries
cannot enforce the interface, and checking the interface falls on user
code and specification text.
**Optional attributes**
`summary`="`summary`"
: A short (half a line at most) description. This attribute should not be used
if a description is used.
`interface`="`iface`"
: If given, `iface` must be the `name` of some interface, and `type` of this
argument must be either `"object"` or `"new_id"`. This indicates that the
existing or new object must have the interface `iface`. Use for other
argument types is forbidden.
> [!NOTE]
> If an interface from another protocol is used, then this creates a
> dependency between the protocols. If an application generates code for one
> protocol, then it must also generate code for all dependencies. Therefore
> this would not be a backwards compatible change.
`allow-null`="`true`" | "`false`"
: Whether the argument value can be null on send. Defaults to `"false"`,
meaning it is illegal to send a null value. Can be used only when `type` is
`"string"` or `"object"`.
> [!NOTE]
> Even though this attribute can be used to forbid a compositor from sending
> a null object as an event argument, an IPC library implementation may not
> protect the client from receiving a null object. This can happen with
> libwayland-client when the client has destroyed the protocol object before
> dispatching an event that referred to it in an argument.
`enum`="`enum-cname-suffix`"
: If specified, indicates that the argument value should come from the enum
named `enum-cname-suffix`. If the enumeration is a bitfield, then `type`
must be `"uint"`. Otherwise `type` must be either `"uint"` or `"int"`.
The name `enum-cname-suffix` refers to an enum in the same interface by
default. If it is necessary to refer to an enumeration from another
interface, the interface name can be given with a period:
```
`enum`="`iface`.`enum-cname-suffix`"
```
> [!NOTE]
> This attribute alone does not automatically restrict the legal values for
> this argument. If values from outside of the enumeration need to be
> forbidden, that must be specified explicitly in the documentation.
>
> A common design pattern is to have the server advertise the supported
> enumeration or bit values with events and explicitly forbid clients from
> using any other values in requests. This also requires a protocol error
> code to be specified with the error enum to be raised if a client uses an
> illegal value, see [interface](#interface).
### enum
Parent elements: protocol
```
enum ::= (description?, entry*)
```
This tag defines an enumeration of integer values. Enumerations are merely a
syntactic construct to give names to arbitrary integer constants. Each constant
is listed as an entry with its name. There are two types of enumerations:
regular enumerations and bitfields.
Regular enumerations do not use `bitfield` attribute, or they set it to
`"false"`. The set of pre-defined values that belong to a regular enumeration is
exactly the set of values listed as entry elements after the protocol object
version is taken into account. See the entry attributes `since` and
`deprecated-since`.
Bitfields set `bitfield` to `"true"`. The set of values that belong to a
bitfield enumeration are all the values that can be formed by the bitwise-or
operator from the set of values listed as entry elements like in the regular
enumeration. Usually also zero is implicitly included.
All the values in a regular enumeration must be either signed or unsigned 32-bit
integers. All the values in a bitfield enumeration must be unsigned 32-bit
integers.
**Required attributes**
`name`="`cname-suffix`"
: The name of the enumeration. The name must contain only the ASCII characters
a-z, A-Z, 0-9, or underscore. The name cannot be empty. The name must be
unique within all enumerations in the containing interface. The name is used
as the namespace for all the contained entry elements.
**Optional attributes**
`since`="`S`"
: `S` must be an integer greater than zero. If `since` is not specified,
`since="1"` is assumed.
This enumeration was added in interface `version` `S`. The enumeration does
not exist if the protocol object has a bound version smaller than `S`.
`bitfield`="`true`" | "`false`"
: Specifies if this enumeration is a bitfield. Defaults to `"false"`.
### entry
Parent elements: enum
```
entry ::= description?
```
Defines a name for an integer constant and makes it part of the set of values of
the containing enumeration.
**Required attributes**
`name`="`cname-suffix`"
: The name of a value in an enumeration. The name must contain only the ASCII
characters a-z, A-Z, 0-9, or underscore. The name cannot be empty. The name
must be unique within all entry elements in the containing enum.
`value`="`V`"
: An integer value. The value can be given in decimal, hexadecimal, or octal
representation.
**Optional attributes**
`summary`="`summary`"
: A short (half a line at most) description. This attribute should not be used
if a description is used.
`since`="`S`"
: `S` must be an integer greater than zero. If `since` is not specified,
`since="1"` is assumed.
This value was added in interface `version` `S`.
`deprecated-since`="`D`"
: `D` must be an integer greater than the value of `since`. If
`deprecated-since` is not specified, then the value is not deprecated in any
version of the containing interface.
This value was removed in interface `version` `D`. This does not make the
value automatically illegal to use, see [arg](#arg) attribute `enum`.

371
doc/book/src/Protocol.md Normal file
View file

@ -0,0 +1,371 @@
# Wayland Protocol and Model of Operation
## Basic Principles
The Wayland protocol is an asynchronous object oriented protocol. All requests
are method invocations on some object. The requests include an object ID that
uniquely identifies an object on the server. Each object implements an interface
and the requests include an opcode that identifies which method in the interface
to invoke.
The protocol is message-based. A message sent by a client to the server is
called request. A message from the server to a client is called event. A message
has a number of arguments, each of which has a certain type (see [Wire
Format](#wire-format) for a list of argument types).
Additionally, the protocol can specify `enum`s which associate names to specific
numeric enumeration values. These are primarily just descriptive in nature: at
the wire format level enums are just integers. But they also serve a secondary
purpose to enhance type safety or otherwise add context for use in language
bindings or other such code. This latter usage is only supported so long as code
written before these attributes were introduced still works after; in other
words, adding an enum should not break API, otherwise it puts backwards
compatibility at risk.
`enum`s can be defined as just a set of integers, or as bitfields. This is
specified via the `bitfield` boolean attribute in the `enum` definition. If this
attribute is true, the enum is intended to be accessed primarily using bitwise
operations, for example when arbitrarily many choices of the enum can be ORed
together; if it is false, or the attribute is omitted, then the enum arguments
are a just a sequence of numerical values.
The `enum` attribute can be used on either `uint` or `int` arguments, however if
the `enum` is defined as a `bitfield`, it can only be used on `uint` args.
The server sends back events to the client, each event is emitted from an
object. Events can be error conditions. The event includes the object ID and the
event opcode, from which the client can determine the type of event. Events are
generated both in response to requests (in which case the request and the event
constitutes a round trip) or spontaneously when the server state changes.
- State is broadcast on connect, events are sent out when state changes. Clients
must listen for these changes and cache the state. There is no need (or
mechanism) to query server state.
- The server will broadcast the presence of a number of global objects, which in
turn will broadcast their current state.
## Code Generation
The interfaces, requests and events are defined in
[protocol/wayland.xml](https://gitlab.freedesktop.org/wayland/wayland/-/blob/main/protocol/wayland.xml).
This xml is used to generate the function prototypes that can be used by clients
and compositors.
The protocol entry points are generated as inline functions which just wrap the
`wl_proxy_*` functions. The inline functions aren't part of the library ABI and
language bindings should generate their own stubs for the protocol entry points
from the xml.
## Wire Format
The protocol is sent over a UNIX domain stream socket, where the endpoint
usually is named `wayland-0` (although it can be changed via _WAYLAND_DISPLAY_
in the environment). Beginning in Wayland 1.15, implementations can optionally
support server socket endpoints located at arbitrary locations in the filesystem
by setting _WAYLAND_DISPLAY_ to the absolute path at which the server endpoint
listens. The socket may also be provided through file descriptor inheritance, in
which case _WAYLAND_SOCKET_ is set.
Every message is structured as 32-bit words; values are represented in the
host's byte-order. The message header has 2 words in it:
- The first word is the sender's object ID (32-bit).
- The second has 2 parts of 16-bit. The upper 16-bits are the message size in
bytes, starting at the header (i.e. it has a minimum value of 8).The lower is
the request/event opcode.
The payload describes the request/event arguments. Every argument is always
aligned to 32-bits. Where padding is required, the value of padding bytes is
undefined. There is no prefix that describes the type, but it is inferred
implicitly from the xml specification.
The representation of argument types are as follows:
int
uint
: The value is the 32-bit value of the signed/unsigned int.
fixed
: Signed 24.8 decimal numbers. It is a signed decimal type which offers a sign
bit, 23 bits of integer precision and 8 bits of decimal precision. This is
exposed as an opaque struct with conversion helpers to and from double and
int on the C API side.
string
: Starts with an unsigned 32-bit length (including null terminator), followed
by the UTF-8 encoded string contents, including terminating null byte, then
padding to a 32-bit boundary. A null value is represented with a length of
0. Interior null bytes are not permitted.
object
: 32-bit object ID. A null value is represented with an ID of 0.
new_id
: The 32-bit object ID. Generally, the interface used for the new object is
inferred from the xml, but in the case where it's not specified, a new_id is
preceded by a `string` specifying the interface name, and a `uint`
specifying the version.
array
: Starts with 32-bit array size in bytes, followed by the array contents
verbatim, and finally padding to a 32-bit boundary.
fd
: The file descriptor is not stored in the message buffer, but in the
ancillary data of the UNIX domain socket message (msg_control).
The protocol does not specify the exact position of the ancillary data in the
stream, except that the order of file descriptors is the same as the order of
messages and `fd` arguments within messages on the wire.
In particular, it means that any byte of the stream, even the message header,
may carry the ancillary data with file descriptors.
Clients and compositors should queue incoming data until they have whole
messages to process, as file descriptors may arrive earlier or later than the
corresponding data bytes.
## Versioning
Every interface is versioned and every protocol object implements a particular
version of its interface. For global objects, the maximum version supported by
the server is advertised with the global and the actual version of the created
protocol object is determined by the version argument passed to
wl_registry.bind(). For objects that are not globals, their version is inferred
from the object that created them.
In order to keep things sane, this has a few implications for interface
versions:
- The object creation hierarchy must be a tree. Otherwise, inferring object
versions from the parent object becomes a much more difficult to properly
track.
- When the version of an interface increases, so does the version of its parent
(recursively until you get to a global interface)
- A global interface's version number acts like a counter for all of its child
interfaces. Whenever a child interface gets modified, the global parent's
interface version number also increases (see above). The child interface then
takes on the same version number as the new version of its parent global
interface.
To illustrate the above, consider the wl_compositor interface. It has two
children, wl_surface and wl_region. As of wayland version 1.2, wl_surface and
wl_compositor are both at version 3. If something is added to the wl_region
interface, both wl_region and wl_compositor will get bumpped to version 4. If,
afterwards, wl_surface is changed, both wl_compositor and wl_surface will be at
version 5. In this way the global interface version is used as a sort of
"counter" for all of its child interfaces. This makes it very simple to know the
version of the child given the version of its parent. The child is at the
highest possible interface version that is less than or equal to its parent's
version.
It is worth noting a particular exception to the above versioning scheme. The
wl_display (and, by extension, wl_registry) interface cannot change because it
is the core protocol object and its version is never advertised nor is there a
mechanism to request a different version.
## Connect Time
There is no fixed connection setup information, the server emits multiple events
at connect time, to indicate the presence and properties of global objects:
outputs, compositor, input devices.
## Security and Authentication
- mostly about access to underlying buffers, need new drm auth mechanism (the
grant-to ioctl idea), need to check the cmd stream?
- getting the server socket depends on the compositor type, could be a system
wide name, through fd passing on the session dbus. or the client is forked by
the compositor and the fd is already opened.
## Creating Objects
Each object has a unique ID. The IDs are allocated by the entity creating the
object (either client or server). IDs allocated by the client are in the range
[1, 0xfeffffff] while IDs allocated by the server are in the range [0xff000000,
0xffffffff]. The 0 ID is reserved to represent a null or non-existent object.
For efficiency purposes, the IDs are densely packed in the sense that the ID N
will not be used until N-1 has been used. This ordering is not merely a
guideline, but a strict requirement, and there are implementations of the
protocol that rigorously enforce this rule, including the ubiquitous libwayland.
## Compositor
The compositor is a global object, advertised at connect time.
See [wl_compositor](https://wayland.app/protocols/wayland#wl_compositor) for the
protocol description.
## Surfaces
A surface manages a rectangular grid of pixels that clients create for
displaying their content to the screen. Clients don't know the global position
of their surfaces, and cannot access other clients' surfaces.
Once the client has finished writing pixels, it 'commits' the buffer; this
permits the compositor to access the buffer and read the pixels. When the
compositor is finished, it releases the buffer back to the client.
See [wl_surface](https://wayland.app/protocols/wayland#wl_surface) for the
protocol description.
## Input
A seat represents a group of input devices including mice, keyboards and
touchscreens. It has a keyboard and pointer focus. Seats are global objects.
Pointer events are delivered in surface-local coordinates.
The compositor maintains an implicit grab when a button is pressed, to ensure
that the corresponding button release event gets delivered to the same surface.
But there is no way for clients to take an explicit grab. Instead, surfaces can
be mapped as 'popup', which combines transient window semantics with a pointer
grab.
To avoid race conditions, input events that are likely to trigger further
requests (such as button presses, key events, pointer motions) carry serial
numbers, and requests such as wl_surface.set_popup require that the serial
number of the triggering event is specified. The server maintains a
monotonically increasing counter for these serial numbers.
Input events also carry timestamps with millisecond granularity. Their base is
undefined, so they can't be compared against system time (as obtained with
clock_gettime or gettimeofday). They can be compared with each other though, and
for instance be used to identify sequences of button presses as double or triple
clicks.
See [wl_seat](https://wayland.app/protocols/wayland#wl_seat) for the protocol
description.
Talk about:
- keyboard map, change events
- xkb on Wayland
- multi pointer Wayland
A surface can change the pointer image when the surface is the pointer focus of
the input device. Wayland doesn't automatically change the pointer image when a
pointer enters a surface, but expects the application to set the cursor it wants
in response to the pointer focus and motion events. The rationale is that a
client has to manage changing pointer images for UI elements within the surface
in response to motion events anyway, so we'll make that the only mechanism for
setting or changing the pointer image. If the server receives a request to set
the pointer image after the surface loses pointer focus, the request is ignored.
To the client this will look like it successfully set the pointer image.
Setting the pointer image to NULL causes the cursor to be hidden.
The compositor will revert the pointer image back to a default image when no
surface has the pointer focus for that device.
What if the pointer moves from one window which has set a special pointer image
to a surface that doesn't set an image in response to the motion event? The new
surface will be stuck with the special pointer image. We can't just revert the
pointer image on leaving a surface, since if we immediately enter a surface that
sets a different image, the image will flicker. If a client does not set a
pointer image when the pointer enters a surface, the pointer stays with the
image set by the last surface that changed it, possibly even hidden. Such a
client is likely just broken.
## Output
An output is a global object, advertised at connect time or as it comes and
goes.
See [wl_output](https://wayland.app/protocols/wayland#wl_output) for the
protocol description.
- laid out in a big (compositor) coordinate system
- basically xrandr over Wayland
- geometry needs position in compositor coordinate system
- events to advertise available modes, requests to move and change modes
## Data sharing between clients
The Wayland protocol provides clients a mechanism for sharing data that allows
the implementation of copy-paste and drag-and-drop. The client providing the
data creates a `wl_data_source` object and the clients obtaining the data will
see it as `wl_data_offer` object. This interface allows the clients to agree on
a mutually supported mime type and transfer the data via a file descriptor that
is passed through the protocol.
The next section explains the negotiation between data source and data offer
objects. [Data devices](#data-devices) explains how these objects are created
and passed to different clients using the `wl_data_device` interface that
implements copy-paste and drag-and-drop support.
See [wl_data_offer](https://wayland.app/protocols/wayland#wl_data_offer),
[wl_data_source](https://wayland.app/protocols/wayland#wl_data_source),
[wl_data_device](https://wayland.app/protocols/wayland#wl_data_device) and
[wl_data_device_manager](https://wayland.app/protocols/wayland#wl_data_device_manager)
for protocol descriptions.
MIME is defined in RFC's 2045-2049. A [registry of MIME
types](https://www.iana.org/assignments/media-types/media-types.xhtml) is
maintained by the Internet Assigned Numbers Authority (IANA).
### Data negotiation
A client providing data to other clients will create a `wl_data_source` object
and advertise the mime types for the formats it supports for that data through
the `wl_data_source.offer` request. On the receiving end, the data offer object
will generate one `wl_data_offer.offer` event for each supported mime type.
The actual data transfer happens when the receiving client sends a
`wl_data_offer.receive` request. This request takes a mime type and a file
descriptor as arguments. This request will generate a `wl_data_source.send`
event on the sending client with the same arguments, and the latter client is
expected to write its data to the given file descriptor using the chosen mime
type.
### Data devices
Data devices glue data sources and offers together. A data device is associated
with a `wl_seat` and is obtained by the clients using the
`wl_data_device_manager` factory object, which is also responsible for creating
data sources.
Clients are informed of new data offers through the `wl_data_device.data_offer`
event. After this event is generated the data offer will advertise the available
mime types. New data offers are introduced prior to their use for copy-paste or
drag-and-drop.
#### Selection
Each data device has a selection data source. Clients create a data source
object using the device manager and may set it as the current selection for a
given data device. Whenever the current selection changes, the client with
keyboard focus receives a `wl_data_device.selection` event. This event is also
generated on a client immediately before it receives keyboard focus.
The data offer is introduced with `wl_data_device.data_offer` event before the
selection event.
#### Drag and Drop
A drag-and-drop operation is started using the `wl_data_device.start_drag`
request. This requests causes a pointer grab that will generate enter, motion
and leave events on the data device. A data source is supplied as argument to
start_drag, and data offers associated with it are supplied to clients surfaces
under the pointer in the `wl_data_device.enter` event. The data offer is
introduced to the client prior to the enter event with the
`wl_data_device.data_offer` event.
Clients are expected to provide feedback to the data sending client by calling
the `wl_data_offer.accept` request with a mime type it accepts. If none of the
advertised mime types is supported by the receiving client, it should supply
NULL to the accept request. The accept request causes the sending client to
receive a `wl_data_source.target` event with the chosen mime type.
When the drag ends, the receiving client receives a `wl_data_device.drop` event
at which it is expected to transfer the data using the `wl_data_offer.receive`
request.

12
doc/book/src/SUMMARY.md Normal file
View file

@ -0,0 +1,12 @@
# Summary
[Foreword](Foreword.md)
- [Introduction](./Introduction.md)
- [Types of Compositors](./Compositors.md)
- [Wayland Architecture](./Architecture.md)
- [Wayland Protocol and Model of Operation](./Protocol.md)
- [Message Definition Language](./Message_XML.md)
- [X11 Application Support](./Xwayland.md)
- [Content Updates](./Content_Updates.md)
- [Color management](./Color.md)

120
doc/book/src/Xwayland.md Normal file
View file

@ -0,0 +1,120 @@
# X11 Application Support
## Introduction
Being able to run existing X11 applications is crucial for the adoption of
Wayland, especially on desktops, as there will always be X11 applications that
have not been or cannot be converted into Wayland applications, and throwing
them all away would be prohibitive. Therefore a Wayland compositor often needs
to support running X11 applications.
X11 and Wayland are different enough that there is no "simple" way to translate
between them. Most of X11 is uninteresting to a Wayland compositor. That,
combined with the gigantic implementation effort needed to support X11, makes it
intractable to just write X11 support directly in a Wayland compositor. The
implementation would be nothing short of a real X11 server.
Therefore, Wayland compositors should use Xwayland, the X11 server that lives in
the Xorg server source code repository and shares most of the implementation
with the Xorg server. Xwayland is a complete X11 server, just like Xorg is, but
instead of driving the displays and opening input devices, it acts as a Wayland
client. The rest of this chapter talks about how Xwayland works.
For integration and architecture reasons, while Xwayland is a Wayland client of
the Wayland compositor, the Wayland compositor is an X11 client of Xwayland.
This circular dependency requires special care from the Wayland compositor.
## Two Modes for Foreign Windows
In general, windows from a foreign window system can be presented in one of two
ways: rootless and rootful (not rootless).
In rootful mode, the foreign window system as a whole is represented as a window
(or more) of its own. You have a native window, inside which all the foreign
windows are. The advantage of this approach in Xwayland's case is that you can
run your favourite X11 window manager to manage your X11 applications. The
disadvantage is that the foreign windows do not integrate with the native
desktop. Therefore this mode is not usually used.
In rootless mode, each foreign window is a first-class resident among the native
windows. Foreign windows are not confined inside a native window but act as if
they were native windows. The advantage is that one can freely stack and mix
native and foreign windows, which is not possible in rootful mode. The
disadvantage is that this mode is harder to implement and fundamental
differences in window systems may prevent some things from working. With
rootless Xwayland, the Wayland compositor must take the role as the X11 window
manager, and one cannot use any other X11 window manager in its place.
This chapter concentrates on the rootless mode, and ignores the rootful mode.
## Architecture
A Wayland compositor usually takes care of launching Xwayland. Xwayland works in
cooperation with a Wayland compositor as follows:
**Xwayland architecture diagram**
![](images/xwayland-architecture.png)
An X11 application connects to Xwayland just like it would connect to any X
server. Xwayland processes all the X11 requests. On the other end, Xwayland is a
Wayland client that connects to the Wayland compositor.
The X11 window manager (XWM) is an integral part of the Wayland compositor. XWM
uses the usual X11 window management protocol to manage all X11 windows in
Xwayland. Most importantly, XWM acts as a bridge between Xwayland window state
and the Wayland compositor's window manager (WWM). This way WWM can manage all
windows, both native Wayland and X11 (Xwayland) windows. This is very important
for a coherent user experience.
Since Xwayland uses Wayland for input and output, it does not have any use for
the device drivers that Xorg uses. None of the xf86-video-* or xf86-input-*
modules are used. There also is no configuration file for the Xwayland server.
For optional hardware accelerated rendering, Xwayland uses GLAMOR.
A Wayland compositor usually spawns only one Xwayland instance. This is because
many X11 applications assume they can communicate with other X11 applications
through the X server, and this requires a shared X server instance. This also
means that Xwayland does not protect nor isolate X11 clients from each other,
unless the Wayland compositor specifically chooses to break the X11 client
intercommunications by spawning application specific Xwayland instances. X11
clients are naturally isolated from Wayland clients.
Xwayland compatibility compared to a native X server will probably never reach
100%. Desktop environment (DE) components, specifically X11 window managers, are
practically never supported. An X11 window manager would not know about native
Wayland windows, so it could manage only X11 windows. On the other hand, there
must be an XWM that reserves the exclusive window manager role so that the
Wayland compositor could show the X11 windows appropriately. For other DE
components, like pagers and panels, adding the necessary interfaces to support
them in WWM through XWM is often considered not worthwhile.
## X Window Manager (XWM)
From the X11 point of view, the X window manager (XWM) living inside a Wayland
compositor is just like any other window manager. The difference is mostly in
which process it resides in, and the few extra conventions in the X11 protocol
to support Wayland window management (WWM) specifically.
There are two separate asynchronous communication channels between Xwayland and
a Wayland compositor: one uses the Wayland protocol, and the other one, solely
for XWM, uses X11 protocol. This setting demands great care from the XWM
implementation to avoid (random) deadlocks with Xwayland. It is often nearly
impossible to prove that synchronous or blocking X11 calls from XWM cannot cause
a deadlock, and therefore it is strongly recommended to make all X11
communications asynchronous. All Wayland communications are already asynchronous
by design.
### Window identification
In Xwayland, an X11 window may have a corresponding wl_surface object in
Wayland. The wl_surface object is used for input and output: it is referenced by
input events and used to provide the X11 window content to the Wayland
compositor. The X11 window and the wl_surface live in different protocol
streams, and they need to be matched for XWM to do its job.
When Xwayland creates a wl_surface on Wayland, it will also send an X11
ClientMessage of type atom "WL_SURFACE_ID" to the X11 window carrying the
wl_surface Wayland object ID as the first 32-bit data element. This is how XWM
can associate a wl_surface with an X11 window. Note that the request to create a
wl_surface and the ID message may arrive in any order in the Wayland compositor.

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View file

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View file

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

View file

@ -1,2 +1,3 @@
doxygen_sqlite3.db
html/
wayland.doxygen
xml/

View file

@ -1,53 +0,0 @@
noinst_DATA = xml/client/index.xml xml/server/index.xml
dist_noinst_DATA = wayland.doxygen.in
scanned_src_files_shared = \
$(top_srcdir)/src/wayland-util.c \
$(top_srcdir)/src/wayland-util.h
scanned_src_files_client = \
$(scanned_src_files_shared) \
$(top_srcdir)/src/wayland-client.c \
$(top_srcdir)/src/wayland-client.h
scanned_src_files_server = \
$(scanned_src_files_shared) \
$(top_srcdir)/src/wayland-server.c \
$(top_srcdir)/src/wayland-server.h \
$(top_srcdir)/src/wayland-shm.c
# find all man/man3/wl_foo.3 pages
# for this to work, we need to create them before the man target (hence
# all-local below)
dist_man3_MANS = $(shell test -d man && find man/man3 -name "wl_*.3" -printf "man/man3/%P\n")
xml/client/index.xml: $(scanned_src_files_client) wayland.doxygen
$(AM_V_GEN)$(MKDIR_P) xml/client && \
(cat wayland.doxygen; \
echo "GENERATE_XML=YES"; \
echo "XML_OUTPUT=xml/client"; \
echo "INPUT= $(scanned_src_files_client)"; \
) | doxygen -
xml/server/index.xml: $(scanned_src_files_server) wayland.doxygen
$(AM_V_GEN)$(MKDIR_P) xml/server && \
(cat wayland.doxygen; \
echo "GENERATE_XML=YES"; \
echo "XML_OUTPUT=xml/server"; \
echo "INPUT= $(scanned_src_files_server)"; \
) | doxygen -
man/man3/wl_display.3: $(scanned_src_files_client) $(scanned_src_files_server)
$(AM_V_GEN)(cat wayland.doxygen; \
echo "GENERATE_MAN=YES"; \
echo "MAN_OUTPUT=man"; \
echo "JAVADOC_AUTOBRIEF=NO"; \
echo "INPUT= $^"; \
) | doxygen -
# there is no man-local
all-local: man/man3/wl_display.3
clean-local:
rm -rf xml/
rm -rf man/

105
doc/doxygen/gen-doxygen.py Executable file
View file

@ -0,0 +1,105 @@
#!/usr/bin/env python3
import argparse
import datetime
import errno
import os
import subprocess
import sys
# Custom configuration for each documentation format
doxygen_templates = {
'xml': [
'GENERATE_XML=YES\n',
'XML_OUTPUT={format}/{section}\n',
'INPUT= {files}\n',
],
'html': [
'GENERATE_HTML=YES\n',
'HTML_OUTPUT={format}/{section}\n',
'PROJECT_NAME=\"Wayland {section} API\"\n',
'INPUT= {files}\n',
],
'man': [
'GENERATE_MAN=YES\n',
'MAN_OUTPUT={format}\n',
'MAN_SUBDIR=.\n',
'JAVADOC_AUTOBRIEF=NO\n',
'INPUT= {files}\n',
],
}
def load_doxygen_file(doxyfile):
with open(doxyfile, 'r') as f:
res = f.readlines()
return res
def get_template(outformat):
for (k,v) in doxygen_templates.items():
if outformat.startswith(k):
return v
def gen_doxygen_file(data, outformat, section, files):
for l in get_template(outformat):
data.append(l.format(format=outformat, section=section, files=' '.join(files)))
return data
parser = argparse.ArgumentParser(description='Generate docs with Doxygen')
parser.add_argument('doxygen_file',
help='The doxygen file to use')
parser.add_argument('files',
help='The list of files to parse',
metavar='FILES',
nargs='+')
parser.add_argument('--builddir',
help='The build directory',
metavar='DIR',
default='.')
parser.add_argument('--section',
help='The section to build',
metavar='NAME',
default='Client')
parser.add_argument('--output-format',
help='The output format: xml, html, man',
metavar='FORMAT',
default='xml')
parser.add_argument('--stamp',
help='Stamp file to output',
metavar='STAMP_FILE',
nargs='?',
type=argparse.FileType('w'))
args = parser.parse_args()
# Merge the doxyfile with our custom templates
conf = load_doxygen_file(args.doxygen_file)
conf = gen_doxygen_file(conf, args.output_format, args.section, args.files)
# Doxygen is not clever enough to create the directories it
# needs beforehand
try:
os.makedirs(os.path.join(args.builddir, args.output_format))
except OSError as e:
if e.errno != errno.EEXIST:
raise e
# Run Doxygen with the generated doxyfile
cmd = subprocess.Popen(['doxygen', '-'], stdin=subprocess.PIPE)
cmd.stdin.write(''.join(conf).encode('utf-8'))
cmd.stdin.close()
if cmd.wait() != 0:
sys.exit(1)
# This is a bit of a hack; Doxygen will generate way more files than we
# want to install, but there's no way to know how many at configuration
# time. Since we want to install only the wl_* man pages anyway, we can
# delete the other files and let Meson install the whole man3 subdirectory
if args.output_format.startswith('man'):
manpath = os.path.join(args.builddir, args.output_format)
for filename in os.listdir(manpath):
full_path = os.path.join(manpath, filename)
if not filename.startswith('wl_'):
os.remove(full_path)
if args.stamp:
args.stamp.write(str(datetime.datetime.now()))

23
doc/doxygen/mainpage.dox Normal file
View file

@ -0,0 +1,23 @@
/**
* @mainpage
* Wayland protocol API documentation.
*
* This documentation is available for the Server- and the Client-side APIs.
*
* - <a href="../Server/index.html">Server-side API</a>
* - <a href="../Client/index.html">Client-side API</a>
* - <a href="../Cursor/index.html">Cursor helper library API</a>
*
* Further documentation about the architecture and principles of Wayland is
* available on the
* <a href="https://wayland.freedesktop.org">website</a>.
*
* @section ifaces Interfaces
* For the list of available interfaces, please see the
* <a href="modules.html">modules</a> list.
*
* @section protocols Protocols
* For the list of protocols, please see the
* <a href="pages.html">Related Pages</a>.
*
*/

105
doc/doxygen/meson.build Normal file
View file

@ -0,0 +1,105 @@
# Here be dragons
doxygen_conf = configuration_data()
doxygen_conf.set('VERSION', meson.project_version())
doxygen_conf.set('top_builddir', meson.project_build_root())
wayland_doxygen = configure_file(
input: 'wayland.doxygen.in',
output: 'wayland.doxygen',
configuration: doxygen_conf,
)
shared_files = files([
'../../src/wayland-util.h',
])
client_files = files([
'../../src/wayland-client.c',
'../../src/wayland-client.h',
'../../src/wayland-client-core.h',
])
server_files = files([
'../../src/event-loop.c',
'../../src/wayland-server.c',
'../../src/wayland-server.h',
'../../src/wayland-server-core.h',
'../../src/wayland-shm.c',
])
cursor_files = files([
'../../cursor/wayland-cursor.c',
'../../cursor/wayland-cursor.h',
])
extra_client_files = [
'mainpage.dox',
wayland_client_protocol_h,
]
extra_server_files = [
'mainpage.dox',
wayland_server_protocol_h,
]
extra_cursor_files = [
'mainpage.dox',
]
gen_doxygen = find_program('gen-doxygen.py')
subdir('xml')
formats = {
'html': {
'Client': shared_files + client_files + extra_client_files,
'Server': shared_files + server_files + extra_server_files,
'Cursor': shared_files + cursor_files + extra_cursor_files,
},
}
foreach f_name, sections: formats
foreach s_name, s_files: sections
t_name = '@0@-@1@-doc'.format(f_name, s_name)
# We do not really need an output file, but Meson
# will complain if one is not set, so we use a
# dummy 'stamp' file
stamp = join_paths(meson.current_build_dir(), '@0@.stamp'.format(t_name))
custom_target(
t_name,
command: [
gen_doxygen,
# XXX pass doxygen path as argument
'--builddir=@OUTDIR@',
'--section=@0@'.format(s_name),
'--output-format=@0@'.format(f_name),
'--stamp=@0@'.format(stamp),
wayland_doxygen,
'@INPUT@',
],
input: s_files,
output: '@0@.stamp'.format(t_name),
build_by_default: true,
)
endforeach
endforeach
man_files = shared_files + server_files + client_files + cursor_files
stamp = join_paths(meson.current_build_dir(), 'man3.stamp')
custom_target(
'man-pages-3',
command: [
gen_doxygen,
'--builddir=@OUTDIR@',
'--output-format=man3',
'--stamp=@0@'.format(stamp),
wayland_doxygen,
'@INPUT@',
],
input: man_files,
output: 'man3',
build_by_default: true,
install: true,
install_dir: join_paths(get_option('prefix'), get_option('mandir')),
)

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,17 @@
tgt = custom_target(
'xml-Client-doc',
command: [
gen_doxygen,
# XXX pass doxygen path as argument
'--builddir=@OUTDIR@',
'--section=Client',
'--output-format=xml',
wayland_doxygen,
'@INPUT@',
],
input: [ shared_files, client_files ],
output: [ 'combine.xslt', 'index.xml' ],
)
doxygen_Client_combine_xslt = tgt[0]
doxygen_Client_index_xml = tgt[1]

View file

@ -0,0 +1,17 @@
tgt = custom_target(
'xml-Server-doc',
command: [
gen_doxygen,
# XXX pass doxygen path as argument
'--builddir=@OUTDIR@',
'--section=Server',
'--output-format=xml',
wayland_doxygen,
'@INPUT@',
],
input: [ shared_files, server_files ],
output: [ 'combine.xslt', 'index.xml' ],
)
doxygen_Server_combine_xslt = tgt[0]
doxygen_Server_index_xml = tgt[1]

View file

@ -0,0 +1,2 @@
subdir('Client')
subdir('Server')

View file

@ -1,51 +0,0 @@
#
# This generates man-pages out of the Docbook XML files. Simply add your files
# to the $MANPAGES array. If aliases are created, please add them to the
# MANPAGES_ALIASES array so they get installed correctly.
#
MANPAGES = \
wl_display_connect.3
MANPAGES_ALIASES = \
wl_display_connect_to_fd.3
XML_FILES = \
${patsubst %.1,%.xml,${patsubst %.3,%.xml,${patsubst %.5,%.xml,${patsubst %.7,%.xml,$(MANPAGES)}}}}
CLEANFILES =
EXTRA_DIST = $(XML_FILES)
if HAVE_XSLTPROC
if HAVE_MANPAGES_STYLESHEET
CLEANFILES += $(MANPAGES) $(MANPAGES_ALIASES)
EXTRA_DIST += $(MANPAGES) $(MANPAGES_ALIASES)
dist_man_MANS = $(MANPAGES) $(MANPAGES_ALIASES)
XSLTPROC_FLAGS = \
--stringparam man.authors.section.enabled 0 \
--stringparam man.copyright.section.enabled 0 \
--stringparam funcsynopsis.style ansi \
--stringparam man.output.quietly 1 \
--nonet
XSLTPROC_PROCESS_MAN = \
$(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
$(XSLTPROC) -o $@ $(XSLTPROC_FLAGS) $(MANPAGES_STYLESHEET) $< && \
$(SED) -i -e 's/^\.so \(.*\)\.\(.\)$$/\.so man\2\/\1\.\2/' $(MANPAGES_ALIASES)
%.1: %.xml
$(XSLTPROC_PROCESS_MAN)
%.3: %.xml
$(XSLTPROC_PROCESS_MAN)
%.5: %.xml
$(XSLTPROC_PROCESS_MAN)
%.7: %.xml
$(XSLTPROC_PROCESS_MAN)
wl_display_connect_to_fd.3: wl_display_connect.3
endif # HAVE_MANPAGES_STYLESHEET
endif # HAVE_XSLTPROC

View file

@ -1,88 +0,0 @@
<?xml version='1.0'?> <!--*-nxml-*-->
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<!--
Written 2012 by David Herrmann <dh.herrmann@googlemail.com>
Dedicated to the Public Domain
-->
<refentry id="wl_display_connect">
<refentryinfo>
<title>wl_display_connect</title>
<productname>wayland-client</productname>
<date>September 2012</date>
<authorgroup>
<author>
<contrib>Developer</contrib>
<firstname>David</firstname>
<surname>Herrmann</surname>
<email>dh.herrmann@googlemail.com</email>
</author>
</authorgroup>
</refentryinfo>
<refmeta>
<refentrytitle>wl_display_connect</refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname>wl_display_connect</refname>
<refname>wl_display_connect_to_fd</refname>
<refpurpose>Connect to a Wayland socket</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>#include &lt;wayland-client.h&gt;</funcsynopsisinfo>
<funcprototype>
<funcdef>struct wl_display *<function>wl_display_connect</function></funcdef>
<paramdef>const char *<parameter>name</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>struct wl_display *<function>wl_display_connect_to_fd</function></funcdef>
<paramdef>int <parameter>fd</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para><function>wl_display_connect</function> connects to a Wayland socket
that was previously opened by a Wayland server. The server socket must
be placed in <envar>XDG_RUNTIME_DIR</envar> for this function to
find it. The <varname>name</varname> argument specifies the name of
the socket or <constant>NULL</constant> to use the default (which is
<constant>"wayland-0"</constant>). The environment variable
<envar>WAYLAND_DISPLAY</envar> replaces the default value. If
<envar>WAYLAND_SOCKET</envar> is set, this function behaves like
<function>wl_display_connect_to_fd</function> with the file-descriptor
number taken from the environment variable.</para>
<para><function>wl_display_connect_to_fd</function> connects to a Wayland
socket with an explicit file-descriptor. The file-descriptor is passed
as argument <varname>fd</varname>.</para>
</refsect1>
<refsect1>
<title>Return Value</title>
<para><function>wl_display_connect</function> and
<function>wl_display_connect_to_fd</function> return a new display
context object or NULL on failure. <varname>errno</varname> is set
correspondingly.</para>
</refsect1>
<refsect1>
<title>See Also</title>
<para>
<citerefentry><refentrytitle>wayland-client</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
<citerefentry><refentrytitle>wl_display_disconnect</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>wl_display_iterate</refentrytitle><manvolnum>3</manvolnum></citerefentry>
</para>
</refsect1>
</refentry>

43
doc/meson.build Normal file
View file

@ -0,0 +1,43 @@
if not get_option('libraries')
error('-Ddocumentation=true requires -Dlibraries=true')
endif
dot = find_program('dot')
doxygen = find_program('doxygen')
xsltproc = find_program('xsltproc')
xmlto = find_program('xmlto')
mdbook = find_program('mdbook')
cmd = run_command(doxygen, '--version', check: true)
message('doxygen: ' + cmd.stdout().strip())
vers = cmd.stdout().strip()
if vers.version_compare('< 1.6.0')
error('Doxygen 1.6 or later is required for building documentation, found @0@.'.format(vers))
endif
cmd = run_command(dot, '-V', check: true)
message('dot: ' + cmd.stderr().strip())
vers = cmd.stderr().split('version')[1].strip().split(' ')[0]
if vers.version_compare('< 2.26.0')
error('Dot (Graphviz) 2.26 or later is required for building documentation, found @0@.'.format(vers))
endif
manpage_xsl = 'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl'
cmd = run_command(xsltproc, '--nonet', manpage_xsl, check: false)
if cmd.returncode() != 0
error('The style sheet for man pages providing "@0@" was not found.'.format(manpage_xsl))
endif
publican_install_prefix = join_paths(
get_option('prefix'),
get_option('datadir'),
'doc',
meson.project_name(),
'Wayland', 'en-US'
)
publican_html_dir = 'html'
subdir('doxygen')
subdir('publican')
subdir('book')

View file

@ -5,7 +5,7 @@
]>
<bookinfo id="book-Wayland-Wayland">
<title>Wayland</title>
<subtitle>The Wayland display server</subtitle>
<subtitle>The Wayland Protocol</subtitle>
<productname>Documentation</productname>
<productnumber>0.1</productnumber>
<edition>1</edition>
@ -28,9 +28,9 @@
<imagedata fileref="images/wayland.png" format="PNG" />
</imageobject>
<textobject>
<phrase>
Wayland logo
</phrase>
<phrase>
Wayland logo
</phrase>
</textobject>
</inlinemediaobject>
</corpauthor>
@ -40,30 +40,30 @@
Copyright <trademark class="copyright"></trademark> &YEAR; &HOLDER;
</para>
<para>
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that copyright notice and this
permission notice appear in supporting documentation, and that
the name of the copyright holders not be used in advertising or
publicity pertaining to distribution of the software without
specific, written prior permission. The copyright holders make
no representations about the suitability of this software for
any purpose. It is provided "as is" without express or implied
warranty.
</para>
<para>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
</para>
<para>
THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE COPYRIGHT
HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
USE OR PERFORMANCE OF THIS SOFTWARE.
</para>
<para>
The above copyright notice and this permission notice (including the next
paragraph) shall be included in all copies or substantial portions of the
Software.
</para>
<para>
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
</para>
</legalnotice>

92
doc/publican/Client.xml Normal file
View file

@ -0,0 +1,92 @@
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % BOOK_ENTITIES SYSTEM "Wayland.ent">
<!ENTITY doxygen SYSTEM "ClientAPI.xml">
%BOOK_ENTITIES;
]>
<appendix id="sect-Library-Client">
<title>Client API</title>
<section><title>Introduction</title>
<para>
The open-source reference implementation of Wayland protocol is
split in two C libraries, libwayland-client and <link
linkend="sect-Library-Server">libwayland-server</link>. Their main
responsibility is to handle the Inter-process communication
(<emphasis>IPC</emphasis>) with each other, therefore guaranteeing
the protocol objects marshaling and messages synchronization.
</para>
<para>
A client uses libwayland-client to communicate with one or more
wayland servers. A <link
linkend="Client-classwl__display">wl_display</link> object is
created and manages each open connection to a server. At least one
<link linkend="Client-classwl__event__queue">wl_event_queue</link>
object is created for each wl_display, this holds events as they
are received from the server until they can be
processed. Multi-threading is supported by creating an additional
wl_event_queue for each additional thread, each object can have
its events placed in a particular queue, so potentially a
different thread could be made to handle the events for each
object created.
</para>
<para>
Though some convenience functions are provided, libwayland-client
is designed to allow the calling code to wait for events, so that
different polling mechanisms can be used. A file descriptor is
provided, when it becomes ready for reading the calling code can
ask libwayland-client to read the available events from it into
the wl_event_queue objects.
</para>
<para>
The library only provides low-level access to the wayland objects.
Each object created by the client is represented by a <link
linkend="Client-classwl__proxy">wl_proxy</link> object that this
library creates. This includes the id that is actually
communicated over the socket to the server, a void* data pointer
that is intended to point at a client's representation of the
object, and a pointer to a static <link
linkend="Client-structwl__interface">wl_interface</link> object,
which is generated from the xml and identifies the object's class
and can be used for introspection into the messages and events.
</para>
<para>
Messages are sent by calling wl_proxy_marshal. This will write a
message to the socket, by using the message id and the
wl_interface to identify the types of each argument and convert
them into stream format. Most software will call type-safe
wrappers generated from the xml description of the <link
linkend="appe-Wayland-Protocol">Wayland protocols</link>. For
instance the C header file generated from the xml defines the
following inline function to transmit the <link
linkend="protocol-spec-wl_surface-request-attach">wl_surface::attach</link>
message:
</para>
<programlisting>static inline void
wl_surface_attach(struct wl_surface *wl_surface, struct wl_buffer *buffer, int32_t x, int32_t y)
{
wl_proxy_marshal((struct wl_proxy *) wl_surface, WL_SURFACE_ATTACH, buffer, x, y);
}</programlisting>
<para>
Events (messages from the server) are handled by calling a
"dispatcher" callback the client stores in the wl_proxy for each
event. A language binding for a string-based interpreter, such as
CPython, might have a dispatcher that uses the event name from the
wl_interface to identify the function to call. The default
dispatcher uses the message id number to index an array of
functions pointers, called a wl_listener, and the wl_interface to
convert data from the stream into arguments to the function. The
C header file generated from the xml defines a per-class structure
that forces the function pointers to be of the correct type, for
instance the <link
linkend="protocol-spec-wl_surface-event-enter">wl_surface::enter</link>
event defines this pointer in the wl_surface_listener object:
</para>
<programlisting>struct wl_surface_listener {
void (*enter)(void *data, struct wl_surface *, struct wl_output *);
...
}</programlisting>
<para>
</para>
</section>
&doxygen;
</appendix>

View file

@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
<!DOCTYPE preface PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % BOOK_ENTITIES SYSTEM "Wayland.ent">
%BOOK_ENTITIES;
@ -9,8 +9,7 @@
<title>Preface</title>
<para>
This document describes the (i) Wayland architecture, (ii) Wayland model of
operation and (iii) its library API. Also, the Wayland protocol specification is shown
This document describes its library API. Also, the Wayland protocol specification is shown
in the Appendix. This document is aimed primarily at Wayland developers and
those looking to program with it; it does not cover application development.
</para>
@ -22,7 +21,7 @@
<literallayout>
Yours,
the Wayland open-source community
November 2012
the Wayland open-source community
November 2012
</literallayout>
</preface>

View file

@ -1,135 +0,0 @@
# Documentation is built with publican
# https://fedorahosted.org/publican/
# Publican takes docbook-style input files and compiles them to various
# output formats.
#
# How this build works:
# * the main target is Wayland, documentation ends up in $(builddir)/Wayland/
# * hand-written chapters are located in sources
# Publican does not take a source path, so to support out-of-tree builds
# these are copied to $(builddir)/en-US which is the actual directory
# Publican uses.
# * ProtocolSpec.xml is generated from $(top_srcdir)/protocol/wayland.xml,
# changed into docbook via XSLT and saved in $(builddir)/en-US/
# * ProtocolInterfaces.xml, same as above, uses a different XSLT
# * WaylandClientAPI.xml is generated from the doxygen output and saved in
# $(builddir)/en-US
# * WaylandServerAPI.xml is generated from the doxygen output and saved in
# $(builddir)/en-US
# * run Publican on en-US
publican_sources = \
$(srcdir)/sources/Wayland.ent \
$(srcdir)/sources/Wayland.xml \
$(srcdir)/sources/Book_Info.xml \
$(srcdir)/sources/Author_Group.xml \
$(srcdir)/sources/Foreword.xml \
$(srcdir)/sources/Preface.xml \
$(srcdir)/sources/Revision_History.xml \
$(srcdir)/sources/Introduction.xml \
$(srcdir)/sources/Architecture.xml \
$(srcdir)/sources/Protocol.xml \
$(srcdir)/sources/Library.xml \
$(srcdir)/sources/Compositors.xml \
$(srcdir)/sources/images/icon.svg \
$(srcdir)/sources/images/wayland-architecture.png \
$(srcdir)/sources/images/wayland.png \
$(srcdir)/sources/images/x-architecture.png
if HAVE_PUBLICAN
if HAVE_XSLTPROC
noinst_DATA = Wayland $(publican_targets)
pubdir = $(docdir)/Wayland/en-US
publican_targets = $(publican_sources:$(srcdir)/sources%=$(builddir)/en-US%) \
en-US/ProtocolSpec.xml en-US/ProtocolInterfaces.xml \
en-US/WaylandClientAPI.xml en-US/WaylandServerAPI.xml
# The Protocol.xml is purely generated and required before running publican
en-US/ProtocolSpec.xml: $(top_srcdir)/protocol/wayland.xml $(srcdir)/protocol-to-docbook.xsl
$(AM_V_GEN)$(MKDIR_P) en-US/images
$(AM_V_GEN)$(XSLTPROC) $(srcdir)/protocol-to-docbook.xsl \
$(top_srcdir)/protocol/wayland.xml > en-US/ProtocolSpec.xml
en-US/ProtocolInterfaces.xml: $(top_srcdir)/protocol/wayland.xml $(srcdir)/protocol-interfaces-to-docbook.xsl
$(AM_V_GEN)$(MKDIR_P) en-US/images
$(AM_V_GEN)$(XSLTPROC) $(srcdir)/protocol-interfaces-to-docbook.xsl \
$(top_srcdir)/protocol/wayland.xml > en-US/ProtocolInterfaces.xml
# * we don't want wayland-{server|client}_8h.xml to avoid duplicating output methods,
# move it out of the way first.
# * use doxygen's combine.xslt to merge the xml files into one single file
# * move wayland-<foo>_8h.xml back to its original location
en-US/%API.xml.tmp:
$(AM_V_GEN)mv $(top_builddir)/doc/doxygen/xml/$*/wayland-$*_8h.xml \
$(top_builddir)/doc/doxygen/xml/
$(AM_V_GEN)$(XSLTPROC) $(top_builddir)/doc/doxygen/xml/$*/combine.xslt \
$(top_builddir)/doc/doxygen/xml/$*/index.xml > $@
$(AM_V_GEN)mv $(top_builddir)/doc/doxygen/xml/wayland-$*_8h.xml \
$(top_builddir)/doc/doxygen/xml/$*
# WaylandClientAPI.xml:
# merge doxygen xml files into one single file, then transform the combined XML file into docbook format
en-US/WaylandClientAPI.xml: en-US/clientAPI.xml.tmp $(top_builddir)/doc/doxygen/xml/client/index.xml $(srcdir)/doxygen-to-publican.xsl
$(AM_V_GEN)$(XSLTPROC) --stringparam which Client $(srcdir)/doxygen-to-publican.xsl \
$(builddir)/en-US/clientAPI.xml.tmp > en-US/WaylandClientAPI.xml
# WaylandServerAPI.xml: see WaylandClientAPI.xml
en-US/WaylandServerAPI.xml: en-US/serverAPI.xml.tmp $(top_builddir)/doc/doxygen/xml/client/index.xml $(srcdir)/doxygen-to-publican.xsl
$(AM_V_GEN)$(XSLTPROC) --stringparam which Server $(srcdir)/doxygen-to-publican.xsl \
$(builddir)/en-US/serverAPI.xml.tmp > en-US/WaylandServerAPI.xml
# Copy the sources source files into en-US destination
# This is required for out-of-source-tree build as publican does not allow us
# to specify the location of the source code.
$(builddir)/en-US/%: $(srcdir)/sources/% en-US/ProtocolSpec.xml en-US/ProtocolInterfaces.xml en-US/WaylandClientAPI.xml $(publican_sources)
$(AM_V_GEN)cp -f $< $@
$(AM_V_GEN)chmod a+w $@
# Run publican for the builddir on the generated (or copied) source
# The output formats are generated in the Wayland sub directory. Also, we need
# to use a tmp publican.cfg cause 'publican rename' modifies the original.
Wayland: $(publican_targets)
$(AM_V_GEN)cp -f $(srcdir)/publican.cfg $(builddir)/publican-copy.cfg
$(AM_V_GEN)$(PUBLICAN) rename --name Wayland \
--version "$(WAYLAND_VERSION_MAJOR).$(WAYLAND_VERSION_MINOR)" \
--config $(builddir)/publican-copy.cfg
$(AM_V_GEN)$(PUBLICAN) build --quiet --langs en-US --pdftool fop --formats html,pdf \
--config $(builddir)/publican-copy.cfg
@touch Wayland
CLEANFILES = en-US/ProtocolSpec.xml en-US/ProtocolInterfaces.xml en-US/WaylandClientAPI.xml $(publican_targets)
clean-local:
$(AM_V_at)rm -fr $(builddir)/en-US
$(AM_V_at)rm -fr $(builddir)/Wayland
$(AM_V_at)rm -fr $(builddir)/publican-copy.cfg
install-data-local:
test -z "$(pubdir)/html/Common_Content/css" || $(mkdir_p) "$(DESTDIR)$(pubdir)/html/Common_Content/css"
test -z "$(pubdir)/html/Common_Content/images" || $(mkdir_p) "$(DESTDIR)$(pubdir)/html/Common_Content/images"
test -z "$(pubdir)/html/images" || $(mkdir_p) "$(DESTDIR)$(pubdir)/html/images"
test -z "$(pubdir)/html-pdf/Common_Content/css" || $(mkdir_p) "$(DESTDIR)$(pubdir)/html-pdf/Common_Content/css"
test -z "$(pubdir)/html-pdf/Common_Content/images" || $(mkdir_p) "$(DESTDIR)$(pubdir)/html-pdf/Common_Content/images"
test -z "$(pubdir)/html-pdf/images" || $(mkdir_p) "$(DESTDIR)$(pubdir)/html-pdf/images"
test -z "$(pubdir)/pdf" || $(mkdir_p) "$(DESTDIR)$(pubdir)/pdf"
test -z "$(pubdir)/xml/Common_Content/css" || $(mkdir_p) "$(DESTDIR)$(pubdir)/xml/Common_Content/css"
test -z "$(pubdir)/xml/Common_Content/images" || $(mkdir_p) "$(DESTDIR)$(pubdir)/xml/Common_Content/images"
test -z "$(pubdir)/xml/images" || $(mkdir_p) "$(DESTDIR)$(pubdir)/xml/images"
list=`find $(builddir)/Wayland/en-US -type f -not -path '$(builddir)/Wayland/en-US/xml_tmp*'`; \
for p in $$list; do \
echo " $(INSTALL_DATA) '$$p' '$(DESTDIR)$(docdir)/$$p'"; \
$(INSTALL_DATA) "$$p" "$(DESTDIR)$(docdir)/$$p"; \
done;
uninstall-local:
@if test -n $(DESTDIR)$(docdir); then \
if test -d $(DESTDIR)$(docdir); then \
echo " rm -fr $(DESTDIR)$(docdir)/Wayland;"; \
rm -fr $(DESTDIR)$(docdir)/Wayland; \
fi; \
fi;
endif
endif
EXTRA_DIST = $(publican_sources) publican.cfg protocol-to-docbook.xsl protocol-interfaces-to-docbook.xsl doxygen-to-publican.xsl

49
doc/publican/Server.xml Normal file
View file

@ -0,0 +1,49 @@
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % BOOK_ENTITIES SYSTEM "Wayland.ent">
<!ENTITY doxygen SYSTEM "ServerAPI.xml">
%BOOK_ENTITIES;
]>
<appendix id="sect-Library-Server">
<title>Server API</title>
<section><title>Introduction</title>
<para>
The open-source reference implementation of Wayland protocol is
split in two C libraries, <link
linkend="sect-Library-Client">libwayland-client</link> and
libwayland-server. Their main responsibility is to handle the
Inter-process communication (<emphasis>IPC</emphasis>) with each
other, therefore guaranteeing the protocol objects marshaling and
messages synchronization.
</para>
<para>
The server library is designed to work much like libwayland-client,
although it is considerably complicated due to the server needing
to support multiple versions of the protocol. It is best to learn
libwayland-client first.
</para>
<para>
Each open socket to a client is represented by a <link
linkend="Server-structwl__client">wl_client</link>. The equivalent
of the <link linkend="Client-classwl__proxy">wl_proxy</link> that
libwayland-client uses to represent an object is <link
linkend="Server-structwl__resource">wl_resource</link> for
client-created objects, and <link
linkend="Server-structwl__global">wl_global</link> for objects
created by the server.
</para>
<para>
Often a server is also a client for another Wayland server, and
thus must link with both libwayland-client and libwayland-server.
This produces some type name conflicts (such as the <link
linkend="Client-classwl__display">client wl_display</link> and
<link linkend="Server-structwl__display">server wl_display</link>,
but the duplicate-but-not-the-same types are opaque, and accessed
only inside the correct library where it came from. Naturally that
means that the program writer needs to always know if a pointer to
a wl_display is for the server or client side and use the
corresponding functions.
</para>
</section>
&doxygen;
</appendix>

12
doc/publican/Wayland.xml Normal file
View file

@ -0,0 +1,12 @@
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % BOOK_ENTITIES SYSTEM "Wayland.ent">
%BOOK_ENTITIES;
]>
<book>
<xi:include href="Book_Info.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="Foreword.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="ProtocolSpec.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="Client.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
<xi:include href="Server.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
</book>

Some files were not shown because too many files have changed in this diff Show more