Commit Graph

1672 Commits

Author SHA1 Message Date
Derek Foreman 11ba13d717 clients: Fix cursors when compositor gives wl_seat before wl_compositor
We have no guarantee that we can create a surface for the pointer at the
instant we receive a seat that will (probably eventually) need one.

Hold off until we receive an enter event before creating this - at that
point we know with certainty that wl_compositor is available, since we've
used it to create the surface that was entered.

Fixes #659

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-09-12 11:53:41 -05:00
Marius Vlad 32791eae1f simple-egl: Update buffer_size dimensions when starting as maximized
With commit 62ab6891db, 'clients/simple-egl: Handle buffer
scale and transform' we changed the way we resized the client, by
encapsulating the resize in update_buffer_geometry() function.

we didn't correct that when creating the EGL window, which might be
problematic if you attempt to start the window with different a
different state, like maximized.

Fixes 62ab6891db

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-08-22 18:22:57 +03:00
Erik Kurzinger 8f1ca8204a clients/simple-egl: call eglSwapInterval after eglMakeCurrent
If weston-simple-egl is run with the "-b" flag, it will attempt to set
the swap interval to 0 during create_surface. However, at that point, it
will not have made its EGLContext current yet, causing the
eglSwapInterval call to have no effect. To fix this, wait until the
EGLContext has been made current in init_gl before updating the swap
interval.

Signed-off-by: Erik Kurzinger <ekurzinger@nvidia.com>
2022-08-12 08:22:26 -07:00
Derek Foreman 646cc1b389 clients: Set the hotspot with attach if we already have a valid cursor
We want atomic hotspot updates - this can't happen with
wl_pointer_set_cursor. So if we have a surface that already has a cursor
role, just update the hotspot when attaching new content.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-08-10 13:05:09 -05:00
Derek Foreman ebbe30df3c Revert "clients/window: atomically update pointer cursor"
This reverts commit 992ee045f1.

Recreating the surface for every cursor change causes flickering
cursors on some compositors, and is not the best way to achieve
atomic cursor updates

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-08-10 13:05:07 -05:00
Derek Foreman 8b0125d601 Revert "clients/window: Fix animated cursors"
This reverts commit f079f43658.

This only partially fixed a problem introduced in
992ee045f1

I'm reverting that commit in favor of a different fix, so this
broken fix needs to go first.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-08-10 13:04:27 -05:00
Marius Vlad 6744a6278e clients/window: Bump xdg-shell version to latest
It seems we've missed an update from 3 to 4 (bounds events). With it,
this updates to version 5 which sends the capabilities event. Stubs, as
we're not using them.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-07-26 16:17:43 +03:00
Pekka Paalanen c95feefbc0 clients/simple-touch: use xzalloc() for buffer
This file relied on shared/xalloc.h to include <libweston/zalloc.h>.
That would be a problem if xalloc.h stopped doing that.

Just use xzalloc().

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-07-20 12:45:04 +03:00
Pekka Paalanen 9229a45116 shared: rewrite fail_on_null() as abort_oom_if_null()
Recently I learnt that fprintf() is not async-signal-safe. Maybe it also
attempts to allocate memory sometimes. Hence, using it when we
presumably are out of memory is wishful thinking.

Therefore replace that with async-signal-safe code. If you have to check
pointers from traditional signal handlers, now you could do that too!

While doing this, we also lose the string formatting for line number. I
would argue that printing file and line number is not that useful, if
the system really is out of memory. If not out of memory, a core dump
would give us much more detailed information about what went wrong.

clients/window.c had some calls to fail_on_null() and these are simply
replaced. They were used for checking that creating new wl_proxy by
issuing a protocol request worked, and IIRC that only fails on
out-of-memory, so the same rationale applies here.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-07-20 12:44:12 +03:00
Daniel Stone 965d90cbaa desktop-shell: Use custom_env to launch panel clients
Rather than open-coding our own implementation of parsing a string to
construct an envp and an argp, just use custom_env's implementation.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-07-19 14:12:37 +00:00
Michel Dänzer 77fb2f56af clients/presentation-shm: Bind to xdg_wm_base version 1
It was binding to any advertised version, but it can't actually work
with version 4 (because it doesn't handle the new configure_bounds
event).

Other sample clients in the tree are hard-coding version 1, so do the
same here.

Fixes: 6d9fda7156 ("clients/presentation-shm: use xdg_shell instead of wl_shell")
Signed-off-by: Michel Dänzer <mdaenzer@redhat.com>
2022-06-30 15:16:46 +02:00
Daniel Stone c55a14206d cairo-util: Clean up more Cairo detritus; almost all of it
Pango, Cairo, and fontconfig, all want to leave thread-global data
hanging around in order to maintain a cache. Try to clean up as much of
it as we possibly can on exit, apart from the Pango language string
which appears to be unfreeable, so has been added to LSan suppressions.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-06-29 14:33:21 +01:00
Daniel Stone d43931080e weston-terminal: Don't leak Cairo fonts
The docs say they're ours to unref.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-06-29 14:33:21 +01:00
Daniel Stone fc4fb9fb92 weston-terminal: Make exit path a little more obvious
Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-06-29 14:33:21 +01:00
Daniel Stone f9e54ab2f8 weston-terminal: Fix some egregious memory leaks
Some of the Pango bits still leak, but this takes care of a lot of the
worst.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-06-29 14:33:21 +01:00
Daniel Stone 6bfbfb2e10 toytoolkit: Delete remnants of EGL support
This code was all dead, since neither cairo-glesv2 nor the sample nested
compositor ever made it to the Meson build.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-06-29 14:33:21 +01:00
Marius Vlad cc69dc447e clients/window: Defer closing of window
Instead of closing the window directly by calling close_handler() use a
deferred task to do that instead.

That way we avoid a potential invalid access on a link which was
previously removed, due to the fact both window_destroy() and
touch_handle_up() traverse the same list.

This is an alternative to 841.

Fixes: #607.

Suggested-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Reported-by: He Yong <hyyoxhk@163.com>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-06-22 15:29:05 +03:00
Robert Mader f7541d9e42 clients/simple-egl: Fix angle reset on benchmark interval
Commit 62ab6891db intended to change the angle calculation
so that the a time delta since the first frame would be used
instead of the absolute time. That was done in order to ensure
the angle would always start with the same value, allowing users
to differentiate left and right, which again is needed when
testing flipped transforms.

However, the `benchmark_time` variable is unsuitable for that
purpose as it gets reset on each benchmark interval, abruptly
changing the angle.

Thus introduce a dedicated variable.

Fixes 62ab6891db

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2022-06-14 13:11:59 +02:00
Robert Mader 62ab6891db clients/simple-egl: Handle buffer scale and transform
Buffer scale is common enough in the modern desktop space to
expect average GL clients to handle it. Thus lets include it into
our main example client.

While on it, also handle buffer transforms. It's essentially free
for GL clients in terms of computing power but may increase the
chance that Wayland compositors are able to hit scanout fast paths.
Thus having an example client for it is likely valueabel for client
and compositor developers.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2022-05-31 12:08:06 +00:00
Robert Mader 0b2369bb4a clients/simple-egl: Rename geometry to buffer_size
To reflect more clearly that we use it for `wl_buffer` coordinates.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2022-05-31 12:08:06 +00:00
Robert Mader 009625c297 clients/simple-egl: Rename buffer_size to buffer_bpp
`buffer_size` usually refers to `wl_buffer` size in the Wayland world.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2022-05-31 12:08:06 +00:00
Robert Mader 4090f0eb6f clients/simple-egl: Use INT32_MAX for opaque region
Setting the opaque region correctly is common source of error for
clients that simply want to express that a whole surface is opaque.
This is especially true once buffer_scale and buffer_transform come
into play, as unlike for damage, where buffer_damage is the
encouraged and user friendly way today, opaque regions are always
in logical coordinates.

As faulty opaque regions don't have a visual impact in these cases
but only increase resource consumption, these errors often remain
for long times. See
1e2bc68171
for one of many examples.

Give an easy example how to set the opaque region in a conformant
and reliable way.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2022-05-31 12:08:06 +00:00
Robert Mader 572ad2d8a9 clients/simple-dmabuf-*: Use gbm_bo_create_with_modifiers2
It is used in Mesa. Lets switch to it as well in order to provide
good examples and encourage proper API usage.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2022-05-23 13:25:34 +00:00
Robert Mader 46a6b5b448 clients/simple-dmabuf-feedback: Support multi-tranche feedbacks
Compositors may choose to send multiple scanout or non-scanout
tranches. So instead of assuming that the first respective tranche
contains the format/modifier we're looking for, check all tranches.

While on it, make sure that in case a compositor sends scanout
tranches on the initial feedback, `pick_format_from_scanout_tranche()`
does not unintentionally pick `INITIAL_BUFFER_FORMAT`.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2022-05-23 13:21:38 +00:00
Daniel Stone a55bd6798e clients: Delete gears
It doesn't and can't build, because it depends on cairo-gl. We already
have simple-egl which shows how to use EGL/GLESv2 on Wayland.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-05-23 13:45:57 +01:00
Robert Mader 34f7e01c2b clients/simple-dmabuf-feedback: use time instead of redraws
Weston uses a timeout of 2 seconds before it sends scanout
tranches to clients in order to not trigger excessive buffer
reallocations in clients.
`simple-dmabuf-feedback` in turn counts redraws (200) before
exiting. That doesn't work on e.g. 144Hz screens, thus use a
timer here as well.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2022-05-12 11:53:04 +00:00
Erik Faye-Lund fed2ee51f2 simple-egl: clean up unused callback
Unused since 45ee1f9ef7, which itself
removes code that was unused since
1e65840b61.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
2022-05-10 08:03:27 +00:00
Simon Ser 6122765203 clients/simple-dmabuf-feedback: prettify output
- Use more consistent style, e.g. the tree structure uses
  the same indentation level throughout
- Swap format name and code for consistency with modifiers
- Use constants for ASCII art (taken from drm_info)

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-05-02 19:36:07 +02:00
Marius Vlad 054aaa5a8b simple-egl: Move set_fullscreen/set_maximized before initial commit
Rather than setting the fullscreen/maximized before initial
wl_surface.commit, make it part of the initial window state.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Suggested-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-04-29 12:42:46 +03:00
Marius Vlad 0277046a1d simple-egl: Defer EGL surface/window creation
Rather than creating the wl_egl_window at the same time as wl_surface,
do it after we get the first configure event.

With it, we also defer eglMakeCurrent() as according to the spec, the
first time a OpenGL or OpenGL ES context is made current, the viewport
and scissor dimensions are set to the size of the draw surface.

This is particulary important when attempting to start simple-egl either
as fullscreen or as maximized, as not doing so will either incorrectly
commit a buffer with the original dimensions, and later on to resize to
the correct dimensions (which is the case for fullscreen), or it will
terminate the wayland connection abruptly due to xdg-shell protocol
violation, with a mismatch for the client's geometry (the case for
maximized).

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Suggested-by: Daniel Stone <daniel.stone@collabora.com>
2022-04-29 12:34:51 +03:00
Marius Vlad c15699b7f8 simple-egl: Remove uneeded check
display->wm_base is checked right after handling registry object, and
with it the globals, so there's no to perform and additional check for
xwm_base.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-04-29 12:34:36 +03:00
Marius Vlad 01ef3746a2 simple-egl: Add start as maximized
Just like start as fullscreen, let us add a start as maximized as well.
It tests out the maximized state and with clients geometry checks.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-04-29 12:34:36 +03:00
Simon Ser 778c0683c0 clients/simple-dmabuf-feedback: use presentation-time
Print a message when presentation switches to/from zero-copy mode.
This makes it easier to understand whether the compositor DMA-BUF
feedback was effective.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-04-27 14:21:55 +02:00
Leandro Ribeiro 7724c5ea38 clients/simple-dmabuf-feedback: do not use buffer before compositor's response
This fixes an issue when running simple-dmabuf-feedback:
"wl_display@1: error 1: invalid arguments for wl_surface@3.attach".

As we are not using create_immed request from zwp_linux_dmabuf_v1, we
can't start to use a dma-buf buffer before we process compositor's event
telling us that the creation succeeded.

This was causing problems in the following scenario:

1. buffer is marked to be recreated (because of dma-buf feedback);
2. in buffer_release() event, we destroy the buffer and recreate it;
3. after we recreate it, roundtrip is not called, as we don't want to
   block during the drawing loop;
4. buffer status is not being properly tracked, so we are trying to
   use a buffer before receiving the event from the compositor telling
   us that the creation succeeded.

To fix this, this patch improves buffer status tracking. Now we only
pick a buffer in the drawing loop when it is available. Also, if we have
no buffers available we perform a roundtrip and try again, as we may
have recreated all of them but still didn't have the chance to process
compositor's events telling us that creation succeeded.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2022-04-27 11:52:00 +00:00
Robert Mader 2669853562 clients/simple-dmabuf-feedback: Add fallback print method for unknown formats
Using `pixel_format_get_info()` can result in formats being
reported as `UNKNOWN` when used on compositors other than Weston.

As `weston-simple-dmabuf-feedback` somewhat succeeds `wayland-info`
as tool for `zwp_linux_dmabuf_v1` debugging from version 4 on, copy
the approach from the later for these cases.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2022-03-11 13:56:17 +01:00
nerdopolis 8e2c67c317 clients/desktop-shell: Add a displayname= option for launchers
Signed-off-by: n3rdopolis <bluescreen_avenger@verizon.net>
2022-02-24 00:38:55 +02:00
Robert Mader 3e6ef529f8 clients/simple-dmabuf-*: Increase buffer limit to four
In certain situations these clients crash a lot due to the low
buffer limit. Four buffers is also what EGL allows without blocking
and what is arguably the upper limit of what a compositor should
demand.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2022-02-17 12:26:41 +01:00
Simon Ser 7e70f9016a clients: drop weston-info
Users should rely on wayland-info from wayland-utils [1] instead.
We've been printing a deprecation since 85382d394a ("clients:
deprecate weston-info"), so users should be aware already.

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

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-02-03 16:19:27 +00:00
Simon Ser dfab60c6ee clients/simple-dmabuf-feedback: fix bound global versions
It's invalid for a client to pass the compositor's supported version
directly to wl_registry_bind. For instance, under wlroots the client
will bind to wl_output version 4 and crash because it doesn't handle
the new "name" event.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-01-26 14:42:08 +00:00
Marius Vlad 3151220a9b clients/simple-*: Add appids for other clients
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-01-21 18:39:23 +00:00
Marius Vlad b3544c26ad clients/window: Add functions to set/retrieve app_id
Adds appid for all clients using the toolkit, flower, fullscreen, image,
resizor, scaler, smoke, stacking, subsurfaces, terminal,
touch-calibrator, transformed, etc.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-01-21 18:39:23 +00:00
Derek Foreman f079f43658 clients/window: Fix animated cursors
Since commit 992ee045f1 we create a new surface when we update the cursor
image. This broke animated cursors by discarding any existing frame
callback used for timing, and moving the setup for frame callbacks to
after the commit on the pointer surface.

To fix this we need another surface commit for the frame callbacks, but
this alone is not enough to fix the regression, as a lingering kludge
intended to fix problems when reusing the pointer surface is no longer
working as intended.

Since we no longer re-use the same surface, we can delete the old surface
on pointer exit, along with any callbacks set on it. Then a frame callback
will be recreated naturally. This lets us remove the now broken kludge
from the past and restore animated cursor functionality.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-01-20 10:23:59 +00:00
Marius Vlad 3c5e6c536f clients/meson:build: Conditionally build dmabuf-feedback client
As mesa includes gbm_bo_get_fd_for_plane() from 21.1.0 version onwards,
build the dma-buf feedback client only after that. This should provide
some sanity for package maintainers, as this would need pulling a
rather newer mesa version to build it (which might not be available).

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-01-12 13:39:04 +00:00
Marius Vlad 9b82be0792 simple-egl: Don't set-up alpha for opaque/fullscreen
When setting the window as opaque or fullscreen (which creates an opaque
region) make it so we don't have any alpha pixels set.
This was mistakenly dropped from a previous patch series update to
simple-egl.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-01-12 13:35:31 +02:00
Marius Vlad 6eabd93d59 clients/simple-damage,simple-shm: Use calloc instead of malloc
This avoids some unwarranted errors about conditional jumps or
invalid access from ASan as malloc doesn't set the memory to zero.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-12-09 18:06:03 +02:00
Leandro Ribeiro a272604c00 clients/simple-dmabuf-feedback: pretty print format/modifier pairs
As [1] has already landed, use it to pretty print format/modifier pairs
of each dma-buf feedback tranche.

[1] https://gitlab.freedesktop.org/mesa/drm/-/merge_requests/108

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2021-12-07 11:55:40 -03:00
Daniel Stone 78ba71191a simple-egl: Avoid 30bpc configs
[XA]RGB8888 is almost universally the thing people want to use.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2021-11-27 09:57:46 +00:00
Leandro Ribeiro 18d9ad98b1 clients: add client to test the dma-buf feedback implementation
Simple client to test the dma-buf feedback implementation. This does not
replace the need to implement a dma-buf feedback test that can be run in
the CI. But as we still don't know exactly how to do this, this client
can be helpful to run tests manually.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2021-11-25 11:16:54 -03:00
Manuel Stoeckl b4e70a49ef simple-egl: only force config buffer size for 16bpp
Constraining the buffer size of an EGLConfig to 32 means that
the sum of red, green, blue, and alpha channels must equal 32.
This constraint prevented weston-simple-egl from picking an
RGBX pixel format when an opaque surface was asked for, since
the typical RGBX pixel formats have buffer sizes of 30, 24,
and 16.

Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
2021-11-25 11:54:46 +02:00
Alyssa Ross 7c12182576 clients: don't use deprecated fontconfig aliases
The "sans" and "mono" aliases for "sans-serif" and "monospace" are
deprecated[1].  Let's standardize on the non-deprecated versions, which were
already in use in some places.

[1]: be453bd159/fonts.conf.in (L33-67)

Signed-off-by: Alyssa Ross <hi@alyssa.is>
2021-11-18 10:57:16 +02:00
Alyssa Ross 6e2eb8fa94 terminal: use /bin/sh as the default shell
When trying to get Weston to run on a new system I was building up bit
by bit, I encountered a problem: when I started weston-terminal, it
would close a split second later.  This turned out to be because
weston-terminal defaults to trying to spawn /bin/bash, which my
busybox-based system didn't have.

I can configure the terminal to use a shell I do have, of course, but I
think /bin/sh is a much friendlier default, because it's more likely to
exist (POSIX requires it), and will save people just trying to get
started with Weston from the confusing experience I had.  I think it's
better overall that somebody who specifically wants /bin/bash has to
configure that (if they even have to — depending on how they're running
Weston, $SHELL might already be /bin/bash) than somebody who just wants
to see the terminal working debug why it won't launch at all.

I realise there might be a (small) backward compatibility concern here
as well, but I hope I've made the case for a friendlier default.

Signed-off-by: Alyssa Ross <hi@alyssa.is>
2021-11-18 10:44:20 +02:00
Emmanuel Gil Peyrot 152405b8f9 simple-touch: Exit on xdg_toplevel::close
This makes it possible to close this client without using a terminal,
especially useful on a phone.

Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
2021-10-15 16:52:08 +00:00
Emmanuel Gil Peyrot b596342e37 simple-touch: Remove unused include
Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
2021-10-15 16:52:08 +00:00
Emmanuel Gil Peyrot b94219adeb simple-touch: Use true/false instead of 1/0 for bool type
Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
2021-10-15 16:52:08 +00:00
Takuro Ashie 5ff978a52b weston-keyboard: Enable to set as overlay panel
input-method-v1 protocol provides two surface type for the input
panel, `toplevel` and `overlay`. But there is no example for the later
one. This change enables to set weston-keyboard as overlay panel by the
environment variable `WESTON_KEYBOARD_SURFACE_TYPE=overlay` to
demonstrate this feature. In Addition, add weston.ini option
`overlay-keyboard` to set it.

Signed-off-by: Takuro Ashie <ashie@clear-code.com>
2021-10-14 21:17:07 +09:00
Marius Vlad eb53d7c156 multi-resource: Convert to xdg-shell
Convert remaining wl_shell client to xdg-shell.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-10-14 09:28:04 +00:00
Marius Vlad 539c5a6c95 simple-touch: Convert to xdg-shell
wl_shell is officially deprecated so remove support for it and
instead add support for xdg-shell.  With it, we've further:

- moved out the buffer handling into its own a distinct structure in
  case we might want to do multi-buffer rendering
- perform a redraw after we have receiving the initial configure event,
  as to draw to working area where to user can use it for receving touch
  events

Additionally we are setting an appid in case one might want to use it in
tandem with kiosk-shell as to be able to place it on a
distinct/different output.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-10-14 09:28:04 +00:00
Marius Vlad 4a0f94cefa simple-egl: Bail out if xdg-shell was not found
We only support xdg-shell in simple-egl, so make it obvious.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-10-14 09:28:04 +00:00
Nicholas Niro a11bc63ddd clients/desktop-shell: Add 24H support to the clock format. 2021-07-31 15:53:56 +00:00
Emmanuel Gil Peyrot eff793ab46 Fix indentation all through the project
Fixes a “regression” from 04918f3b0b, but
also other missed pieces.
2021-07-31 15:28:20 +00:00
Marius Vlad 568d04ff11 weston-debug: Handle destruction of stream description
Memleak found by ASAN:

Direct leak of 258 byte(s) in 8 object(s) allocated from:
    #0 0x7f3eedb6e817 in __interceptor_strdup (/usr/lib/x86_64-linux-gnu/libasan.so.6+0x57817)
    #1 0x55821ce5e6a5 in stream_alloc ../clients/weston-debug.c:94
    #2 0x55821ce5e974 in stream_find ../clients/weston-debug.c:128
    #3 0x55821ce5eb15 in debug_advertise ../clients/weston-debug.c:157
    #4 0x7f3eed7b4d1c  (/usr/lib/x86_64-linux-gnu/libffi.so.7+0x6d1c)

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-06-01 13:55:33 +03:00
Pekka Paalanen 497d03edbf clients/keyboard: free input_panel_surface
Fixes ASan leak:

Direct leak of 80 byte(s) in 1 object(s) allocated from:
    #0 0x7fe7791f4518 in calloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9518)
    #1 0x7fe779100892 in zalloc ../../git/wayland/src/wayland-private.h:232
    #2 0x7fe779100892 in proxy_create ../../git/wayland/src/wayland-client.c:422
    #3 0x7fe779100ede in create_outgoing_proxy ../../git/wayland/src/wayland-client.c:651
    #4 0x7fe779100ede in wl_proxy_marshal_array_constructor_versioned ../../git/wayland/src/wayland-client.c:736
    #5 0x7fe779101226 in wl_proxy_marshal_constructor ../../git/wayland/src/wayland-client.c:834
    #6 0x56428c9bc578 in zwp_input_panel_v1_get_input_panel_surface protocol/input-method-unstable-v1-client-protocol.h:678
    #7 0x56428c9c0bbb in set_toplevel ../../git/weston/clients/keyboard.c:965
    #8 0x56428c9c0c8d in display_output_handler ../../git/weston/clients/keyboard.c:980
    #9 0x56428c9ddead in display_handle_mode ../../git/weston/clients/window.c:5700
    #10 0x7fe7786668ed in ffi_call_unix64 (/lib/x86_64-linux-gnu/libffi.so.6+0x68ed)
    #11 0x7fe7786662be in ffi_call (/lib/x86_64-linux-gnu/libffi.so.6+0x62be)
    #12 0x7fe779103fac in wl_closure_invoke ../../git/wayland/src/connection.c:1018
    #13 0x7fe779100a48 in dispatch_event ../../git/wayland/src/wayland-client.c:1452
    #14 0x7fe779101e43 in dispatch_queue ../../git/wayland/src/wayland-client.c:1598
    #15 0x7fe779101e43 in wl_display_dispatch_queue_pending ../../git/wayland/src/wayland-client.c:1840
    #16 0x56428c9e031c in handle_display_data ../../git/weston/clients/window.c:6211
    #17 0x56428c9e2147 in display_run ../../git/weston/clients/window.c:6553
    #18 0x56428c9c1559 in main ../../git/weston/clients/keyboard.c:1053
    #19 0x7fe77885e09a in __libc_start_main ../csu/libc-start.c:308
    #20 0x56428c9bc029 in _start (/home/pq/build/weston-meson/clients/weston-keyboard+0x19029)

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-31 12:35:01 +03:00
Pekka Paalanen 2af436bb9c clients/window: clean up xkb compose data
This fixes ASan report:
	SUMMARY: AddressSanitizer: 151360 byte(s) leaked in 451 allocation(s).

The leaks can be observed if you let weston-desktop-shell start fully
before shutting down Weston. Many simple test suite tests are too fast
to hit this, or do not even use desktop-shell.

This clean-up code is copied from keyboard_handle_keymap().

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-31 12:35:01 +03:00
Lujin Wang 928d3a0059 clients: Free output->make/model in output_destroy
== 8 bytes in 1 blocks are definitely lost in loss record 4 of 71
==    at 0x48450F8: malloc (vg_replace_malloc.c:309)
==    by 0x500213F: strdup (strdup.c:42)
==    by 0x40A57F: display_handle_geometry (in weston-desktop-shell)
==    by 0x4864D27: ffi_call_SYSV (in libffi.so.6.0.4)
==    by 0x4865697: ffi_call (in libffi.so.6.0.4)
==    by 0x4880E07: wl_closure_invoke (connection.c:935)
==    by 0x487DD73: dispatch_event.isra.5 (wayland-client.c:1310)
==    by 0x487EF87: dispatch_queue (wayland-client.c:1456)
==    by 0x487EF87: wl_display_dispatch_queue_pending (wayland-client.c:1698)
==    by 0x4104E3: handle_display_data (in weston-desktop-shell)
==    by 0x40FE8F: display_run (in weston-desktop-shell)
==    by 0x405AB3: main (in weston-desktop-shell)

Signed-off-by: Lujin Wang <luwang@nvidia.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-31 12:35:01 +03:00
Pekka Paalanen c8c53bafd3 clients/window: destroy remaining globals
Destroy the remaining globals on exit. Fixes a bunch of leaks reported
by ASan.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-31 12:35:01 +03:00
Pekka Paalanen 1e08a81c43 clients/window: move code into global_destroy()
Another patch will want to call global_destroy() too.

Pure refactoring, no functional change.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-31 12:35:01 +03:00
Pekka Paalanen d9b949d8b9 keyboard: free stuff on exit
This fixes a bunch of leaks when trying to run a Weston test with
desktop-shell, which spawns weston-keyboard.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-31 12:35:01 +03:00
Pekka Paalanen 1f3e9045ad clients/window: fix leaks on start-up failure
Trying to run viewporter-test with ASan leak checking,
weston-desktop-shell helper client reports many leaks, because the
compositor quits before the client can start. Hence the
wl_display_roundtrip() fails.

Clean up by calling display_destroy() when wl_display_roundtrip() fails.
It's late enough that all kinds of things may have been allocated, so a
special local tear-down path is not feasible.

To make that work, display_destroy() must handle many things that might
be NULL which normally aren't. Also display_create() needs to initialize
lists early enough so that cleaning them up works.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-31 12:35:01 +03:00
Simon Ser 992ee045f1 clients/window: atomically update pointer cursor
Currently, Weston clients update the pointer cursor by first issuing
a wl_surface.commit request to update the buffer, then a
wl_pointer.set_cursor request to update the hotspot. This causes an
issue because buffer and hotspot aren't updated atomically: in-between
the two requests, the buffer is new but the hotspot is old.

To fix this issue, create a new surface each time the cursor is
updated.

Signed-off-by: Simon Ser <contact@emersion.fr>
2021-05-30 15:07:04 +00:00
Simon Ser 0ccad4b24f clients/simple-dmabuf-egl: don't add INVALID to modifier list
While this is harmless because gbm_bo_create_with_modifiers will just
fail, it's easy to misunderstand that gbm_bo_create_with_modifiers
accepts MOD_INVALID. Let's just keep modifiers_count to zero instead
and stop even trying to call that function with invalid input.

Stop using modifiers_count to decide whether the compositor supports a
format. Instead use a separate format_supported flag.

Signed-off-by: Simon Ser <contact@emersion.fr>
References: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7601#note_778845
2021-05-17 11:59:58 +00:00
Christian Rauch 5c303cc116 destroy shm, pointer, keyboard, touch and seat on exit 2021-05-15 18:57:59 +01:00
Simon Ser 8df8532ee5 clients/simple-dmabuf-egl: add format option
This allows to specify a custom DRM format. For instance, to test
XBGR2101010:

    weston-simple-dmabuf-egl -f 0x30334258

Signed-off-by: Simon Ser <contact@emersion.fr>
2021-03-22 16:02:47 +00:00
Pekka Paalanen 4b301fe7f2 Add weston-drm-fourcc.h
This header is for sharing fallback definitions for drm_fourcc.h. A new
test in tests/yuv-buffer-test.c is going to be needing XYUV8888 format,
and more new formats will be expected with HDR supports.

Share these fallback definitions in one place instead of copying them
all over.

All users of drm_fourcc.h are converted to include weston-drm-fourcc.h
instead for consistency: have the same definitions available everywhere.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-02-25 14:35:03 +02:00
Pekka Paalanen b9ca801324 drop MOD_INVALID, MOD_LINEAR definitions
MOD_INVALID came with libdrm 2.4.83 and MOD_LINEAR came with libdrm
2.4.82. libweston unconditionally depends on libdrm >= 2.4.95, so the
fallback is not necessary.

Since linux-dmabuf.h itself has no use for these and also forgets to
include drm_fourcc.h, .c files including drm_fourcc.h after this header
would trigger compiler warnings.

linux-dmabuf.c does need these, so add the proper include.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-02-25 14:35:03 +02:00
Veeresh Kadasani ed4a0e9275 desktop-shell:change expiration of minute and sec
Fixes: #400

the clock on upper right corner of screen for
desktop shell is behind one minute when compared
to output of date command, so change initial expiration
it_value for minute and sec to remove the delay.

Signed-off-by: Veeresh Kadasani <veeresh.kadasani@huawei.com>
2021-01-21 16:04:34 +05:30
Anurup M c640cb600d desktop-shell: Add missing weston_config_destroy() for desktop.config
desktop.config sections could be freed after it's use. This will avoid
memory leak.

Signed-off-by: Anurup M <anurup.mokkil@gmail.com>
2020-12-08 09:15:20 +00:00
Leandro Ribeiro bc56729ffe screenshooter: rename some functions to avoid conflicts
We have two functions with the name weston_screenshooter_shoot():

    1. screenshot protocol function that the screenshooter
    client uses to request screenshots to the compositor

    2. libweston function used by the compositor to take
    screenshots as requested by the screenshooter client

Until now we had no problem with that, but in the next commits
we are going to use the screenshot protocol in the test suite,
which is also user of libweston. So rename screenshot protocol
function to weston_screenshooter_take_shot() to avoid the conflict.

For consistency, also rename screenshooter_shoot() to
screenshooter_take_shot() in compositor/weston-screenshooter.c

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2020-10-27 12:19:39 +00:00
Tanmay Shah 8ef3ce5c67 clients: Fix shell background image setting.
If weston.ini is not setting background-image path,
then desktop-shell sets ${DATDIR}/weston/pattern.png
as background. However in this case  width and height
is set to 1 during background config and is being
scaled to avoid allocation of buffer.

This behavior is not right. Along with background-image
path, we should also check if background-color is set.
If background color is set, then only scale 1x1 buffer.

This would allow to set pattern.png as default wallpaper
of weston correctly, if background-color is also not set
in weston.ini file.

Fixes: 3623e46dc5
Signed-off-by: Tanmay Shah <tanmay@codeaurora.org>
2020-10-19 07:23:43 +00:00
Olivier Fourdan 85382d394a clients: deprecate weston-info
weston-info is now deprecated in favor of wayland-info which is part of
wayland-utils.

Add a note to weston-info to inform users that weston-info is deprecated
and will be removed soon.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2020-08-14 10:31:49 +00:00
Peter Hutterer a2086bba66 libweston: replace 0 with the enum value for the xkb init flags
No functional changes, this is cosmetics only.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-05-14 11:49:54 +10:00
Pekka Paalanen 8060d826b7 Redefine output rotations
It was discovered in issue #99 that the implementations of the 90 and 270
degree rotations were actually the inverse of what the Wayland specification
spelled out. This patch fixes the libweston implementation to follow the
specification.

As a result, the behaviour of the the weston.ini transform key also changes. To
force all users to re-think their configuration, the transform key values are
also changed. Since Weston and libweston change their behaviour, the handling
of clients' buffer transform changes too.

All the functions had their 90/270 cases simply swapped, probably due to
confusion of whether WL_OUTPUT_TRANSFORM_* refers to rotating the monitor or
the content.

Hint: a key to understanding weston_matrix_rotate_xy(m, c, s) is that the
rotation matrix is formed as

  c -s
  s  c

that is, it's column-major. This fooled me at first.

Fixing window.c fixes weston-terminal and weston-transformed.

In simple-damage, window_get_transformed_ball() is fixed to follow the proper
transform definitions, but the fix to the viewport path in redraw() is purely
mechanical.  The viewport path looks broken to me in the presence of any
transform, but it is not this patch's job to fix it.

Screen-share fix just repeats the general code fix pattern, I did not even try
to understand that bit.

https://gitlab.freedesktop.org/wayland/weston/issues/99

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2020-02-27 11:08:48 +00:00
Pekka Paalanen 8555877c6c clients: transformed does not recognize -d
It has no such command line option.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2020-02-27 11:08:48 +00:00
Simon Ser 598d3a15b7
clients/window: fail earlier when frame_create fails
This adds a new NULL check to fail earlier when frame_create fails. This can
happen because PNG files couldn't be loaded from the data directory.

Signed-off-by: Simon Ser <contact@emersion.fr>
2020-02-10 15:49:20 +01:00
Marius Vlad dd718b0788 clients/simple-dmabuf-v4l: Dmabuf-contiguous for vivid module
For certain cases when using vivid module, some display-controllers
require to allocate the dmabuf in a contiguous fashion so explain that
to the user when adding details about vivid module.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2020-01-29 14:39:04 +00:00
Marius Vlad ab2c72b05c clients/simple-dmabuf-v4l: Add 'weston-direct-display' protocol
Makes use of weston-direct-display protocol to pass the dmabuf
straight to the display-controller if such a path is possible.

Removes the Y_INVERT flag in case that was passed, and notifies
the user about it, as the weston implementation would force going
through the renderer when passing the Y_INVERT flag, but in the same
time direct-display avoids any GPU import so having them both in the
same time would result into weston refusing the create a buffer.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2020-01-29 14:39:04 +00:00
Marius Vlad b6d1509d63 clients/simple-dmabuf-v4l: Add Y_INVERT option flag
Allow clients to pass Y_INVERT, not only when v4l reports it so.
Document it briefly and add a note about this Y_INVERT flag is passed
if the camera sensors is detected as being y-flipped.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2020-01-29 14:39:04 +00:00
Marius Vlad 3345452c1b clients/simple-dmabuf-v4l: Convert to use getopt_long
Makes adding further flags/options/args much easier.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Suggested-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2020-01-29 14:39:04 +00:00
Marius Vlad baa1ef22e8 clients/dmabuf-v4l: Pass FLAGS_Y_INVERT to linux-dmabuf if v4l2 reports so
Zero-initialize the display as to correctly pass the options if it was
supplied (@emersion).

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2020-01-29 14:39:04 +00:00
Marius Vlad 4960955e0f client/dmabuf-v4l: Use zwp_linux_dmabuf version 3
We're missing format checks and still using first version of
zwp_linux_dmabuf protocol. Use the latest release and check that the
advertised formats/modifier accepts the user-supplied requested DRM
format.

Accept the format only if the modifier is LINEAR (@emersion).

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2020-01-29 14:39:04 +00:00
Guillaume Champagne 1cb09480e2 window: fix missing prototypes warning
Declare touch_handle_shape and touch_handle_orientation as static
functions as they are local to window.c.

Signed-off-by: Guillaume Champagne <champagne.guillaume.c@gmail.com>
2020-01-29 09:49:41 +00:00
Michael Forney ba3b384b93 clients/presentation-shm: Add missing dependency on xdg-shell protocol
Signed-off-by: Michael Forney <mforney@mforney.org>
2019-12-18 18:51:55 +00:00
Marius Vlad dee14a0a9e clients/simple-dmabuf-egl: Add some notes when using direct-display
protocol

As dmabuf uses a different coordinate (top-left) system than OpenGL
(bottom-left) using both direct-display with the Y_INVERT dmabuf attrib
flag would result in the image being inverted (direct-display will
remove the Y_INVERT flag, which caused the image to be displayed
correctly). Notifies users that direct-display is in use.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Suggested-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-12-11 19:40:24 +00:00
Leandro Ribeiro f0cd00a855 clients/window: drop support for rgb565
Remove member preferred_format from struct window and hardcode
ARGB32 pixel format for clients/window.

The member preferred_format was first added to allow hinting
of a preference for RGB565 when creating a window. But it is
not being used for a long time now. So it's safe to remove it
from the code, dropping support for RGB565 in clients/window.

Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
2019-12-11 19:28:30 +00:00
Simon Ser abdb0a29f2
clients: remove leftover from simple-dmabuf-drm
This header is not used anymore.

Signed-off-by: Simon Ser <contact@emersion.fr>
Fixes: 0a4f6e7d6d ("clients: drop simple-dmabuf-drm")
Reported-by: Marius Vlad <marius.vlad@collabora.com>
2019-12-02 10:44:27 +01:00
Daniel Stone dd8219b3fb option-parser: Make bools boolean
When option-parser is confronted with a boolean option, have it write a
bool rather than treating the value as a pointer to an int32.

(lib)weston already heavily uses bool types internally, so this has the
nice side effect of eliminating quite a few local variables which only
existed as integer shadows of internal boolean variables.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2019-11-28 19:24:13 +00:00
Daniel Stone 51d995ad82 config-parser: Make get_bool be bool
Wayland innovated a lot of cool things, but non-binary boolean values is
the great advances of our time.

Make config_parser_get_bool() work on boolean values, and switch all its
users.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2019-11-28 19:24:13 +00:00
Simon Ser 0a4f6e7d6d
clients: drop simple-dmabuf-drm
This client contains driver-specific code to allocate buffers. However clients
shouldn't contain driver-specific code and should rely on e.g. mesa to allocate
buffers via standard interfaces.

Additionally, because the build system always tries to enable all features, some
experimental drivers and drivers that aren't included in amd64 distribution
packages were required. Users would need to manually disable some drivers.
Releasers would need to install libdrm from source (because the release process
forbids adding custom build flags). Dropping simple-dmabuf-drm simplifies both
building and releasing.

The functionality previously tested via simple-dmabuf-drm can now be tested with
simple-dmabuf-egl.

Signed-off-by: Simon Ser <contact@emersion.fr>
2019-11-28 15:20:13 +01:00
Harish Krupo 3623e46dc5 desktop-shell: Set 1x1 buffers for solid-color backgrounds
When we are going to set a solid color for the background, use
a 1x1 buffer and set the viewport to the full size. This avoids
un-necessary allocation of buffer memory.

Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
2019-11-25 21:54:40 +00:00
Harish Krupo 7bcbab1f2f clients/window: Add viewport destination support
Add support for setting the widget's destination wp viewport.
Setting it in the widget instead of being set directly by the client
ensure that the widget can be identified in widget_find_widget.

v2: Return -1 on error (Pekka)
    Scale allocated x and y when viewport is set (Pekka)
    Allow user to set -1 for viewport width and height (Pekka)

v3: Use NULL instead of 0 (Daniel)
    return 0 if width and height are -1 (Daniel)

Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
2019-11-25 21:54:40 +00:00
Marius Vlad 7e0f20311f clients/fullscreen: Refuse to resize the surface size when fullscreen'ed
This would be causing a protocol error in which the buffer size needs to
match the one provided in the configure event.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-11-25 20:40:24 +00:00
Veeresh Kadasani bdfc11cd1b simple-dmabuf-egl: make application generic
Don't exit if EGL_KHR_no_config_context extension
is not supported

Signed-off-by: Veeresh Kadasani <external.vkadasani@jp.adit-jv.com>
2019-11-25 20:16:45 +00:00
Jeffy Chen 9774917049 clients: Add more sanity checks to catch destroyed window
Add a sanity check to touch_handle_down() and data_device_enter() as
what we did for pointer and keyboard.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
2019-11-21 16:54:38 +00:00
Jeffy Chen 179458ad23 clients: Drop corresponding touch points when destroying windows
This is to avoid memory leaking of these touch points.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
2019-11-21 16:54:38 +00:00
Marius Vlad 21627136b2 clients/simple-dmabuf-drm: Make use of direct-display
Uses weston-direct-display extension.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-11-21 14:28:58 +02:00
Marius Vlad 4ee832d361 clients/simple-dmabuf-egl: Make use of direct-display
Uses weston-direct-display extension.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-11-21 14:28:53 +02:00
Drew DeVault a1eeaf48c6 simple-dmabuf-egl: update to xdg-shell stable 2019-11-12 11:35:56 -05:00
Sebastian Wick ac1b92dfea clients/window: bump wl_seat version to 7
Since version 7 clients must use MAP_PRIVATE to map the keymap fd.

Signed-off-by: Sebastian Wick <sebastian@sebastianwick.net>
2019-11-04 15:10:05 +01:00
Sebastian Wick 5b64fbd965 clients/window: bump wl_seat version to 6
Hook up listeners for touch shape and touch orientation.

Signed-off-by: Sebastian Wick <sebastian@sebastianwick.net>
2019-11-04 15:10:04 +01:00
Stefan Agner 88c8f69a2f clients: avoid build error without gl-renderer
Make sure gl-renderer is enabled when building the EGL and EGL
dmabuf clients. This avoids missing declaration warnings and
linking errors such as:
  ../clients/simple-dmabuf-egl.c:1142: undefined reference to `weston_check_egl_extension
  ...
  ../clients/simple-egl.c:206: undefined reference to `weston_check_egl_extension'

Signed-off-by: Stefan Agner <stefan@agner.ch>
2019-10-24 09:09:33 +00:00
Pekka Paalanen 4f5e360180 build: simplify include_directories
Define common_inc which includes both public_inc and the project root directory.
The project root directory will allow access to config.h and all the shared/
headers.

Replacing all custom '.', '..', '../..', '../shared' etc. include paths with
common_inc reduces clutter in the target definitions and enforces the common
 #include directive style, as e.g. including shared/ headers without the
subdirectory name no longer works.

Unfortunately this does not prevent one from using private libweston headers
with the usual include pattern for public headers.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-04 17:14:22 +03:00
Pekka Paalanen c232f8d934 Unify the include style of shared/ headers
When all shared/ headers are included in the same way, we can drop unnecessary
include seach paths from the compiler.

This include style was chosen because it is prevalent in the code base. Doing
anything different would have been a bigger patch.

This also means that we need to keep the project root directory in the include
search path, which means that one could accidentally include private headers
with

	#include "libweston/dbus.h"

or even

	#include <libweston/dbus.h>

IMO such problem is smaller than the churn caused by any of the alternatives,
and we should be able to catch those in review. We might even be able to catch
those with grep in CI if necessary.

The "bad" include style was found with:
$ for h in shared/*.h; do git grep -F $(basename $h); done | grep -vF '"shared/'

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-04 16:04:48 +03:00
Pekka Paalanen b6c7a3020c build: use dependency for matrix.c
matrix.c needs to be built differently for a test program vs. everything else,
so it cannot be in a helper lib. Instead, make a dependency object for it for
easy use which always gets all the paths correct automatically.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-04 15:55:55 +03:00
Adam Jackson 95efe82982 simple-dmabuf-egl: Allow QueryDmaBufModifiers to report no modifiers
Some drivers expose the extension so they can expose
eglQueryDmaBufFormatsEXT, but don't support any modifiers. Treat this the
same as if the extension wasn't present.
2019-10-01 10:24:57 +00:00
Pekka Paalanen 1ca4ed2015 clients: fix len-string formatting
All these have the printf format string wrong. "%*s" sets the field width but
does not limit the string to len bytes. You need to set precision instead to
limit to len bytes: "%.*s".

Found by grepping, after wondering why my WIP prints printed garbage at the
end.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-09-23 17:27:09 +03:00
Manuel Stoeckl 5f592c7855 weston-terminal: Ignore SIGPIPE
This ensures that the default signal action doesn't kill weston-terminal
when the terminal tries to paste into a pipe whose read end has already
been shut down. (For example, a pipe from a misconfigured program or from
one which crashes/exits before the terminal calls write().)

Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
2019-08-23 11:53:13 +00:00
Manuel Stoeckl 324d846567 clients/simple-egl: Exit when display has an error
Check return values for wl_display_dispatch_* functions, so that
the program stops running when the compositor that it is connected
to crashes.

Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
2019-08-12 18:43:30 +00:00
Ankit Nautiyal 8b40deaaaa clients: Add content-protection client app
This patch adds a client app which can be used to show the
implementation of weston content-protection protocol. The app can
request for Type-0 and Type-1 content or request for disabling
content-protection to the content-protection server.
It listens for the content-protection status change event from the
server and accordingly display the required content.

The content Type-0, Type-1 and unprotected contents are prepared
using cairo surface, with different color and text to distinguish
between the contents.

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
2019-07-05 14:13:30 +05:30
random human 6d9fda7156
clients/presentation-shm: use xdg_shell instead of wl_shell
wl_shell is deprecated, and using xdg_shell allows the client to run on
compositors which do not implement the old protocol. Functionality
should be identical.

Signed-off-by: Astatos Aner <random.bored.human@gmail.com>
2019-06-27 17:44:19 +00:00
- c505af8820 desktop-shell: Click top left and align clock
Pads launchers with the empty space that used to be around them. Moving
pointer to 0,0 and clicking launches the preferred app. First launcher
has more padding at its start to look nice.

Moves the clock to the right edge with same padding. Keeps one of the
two values for text extents that the code was already retrieving but
never read. Horizontal panel position centers the clock.

Sets text in the panel, meaning tooltips and the clock, to consistent 14
units of the default system font at 85% of the max brightness, so it's
less tiring on eyes.
2019-06-26 21:00:43 +00:00
Marius Vlad 48392643ec clients: Fix/resolved doxygen warnings
Missing/wrong parameters and '[out]' issues.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-06-25 14:05:54 +00:00
Antonio Borneo 3957863667 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 Weston 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 Weston code
by using directly the string returned by strerror(errno).
While there, fix some minor indentation issue.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2019-05-02 22:10:30 +02:00
Antonio Borneo 4071225cdc clients: close unused keymap fd
In the simple examples in which keymap is not handled, the open
descriptor has to be properly closed.

After each suspend/resume sequence the keymap is send again to
every client. On client weston-simple-egl the leak causes a
segfault when no more file descriptors can be opened.

Close the file descriptor and lazily copy/paste the comment
already available in simple-dmabuf-v4l.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2019-04-29 18:11:45 +02:00
Sebastian Wick 1bdf363295 weston-terminal: Fix weston-terminal crash on mutter
Set up handlers for wl_data_source v3 events

Signed-off-by: Sebastian Wick <sebastian@sebastianwick.net>
2019-04-20 10:57:06 +00:00
Harish Krupo 43152a3a8f Fix: clients/window: Premature finish request when copy-pasting
As per the wl_data_offer::finish documentation, the request is only
valid for drag n drop operations and signifies that a dnd is completed.
Send finish request only when we have a dnd operation active.

Signed-off-by: Harish Krupo <harishkrupo@gmail.com>
2019-04-19 22:06:44 +05:30
Harish Krupo ee4c7a24dd window.c: Don't assume registry advertisement order
The toytoolkit assumes that wl_seats are advertised after
wl_data_device_manager and creates a data_device during wl_seat
registry binding. This patch removes this assumption by creating
data_devices for all the wl_seats created up until then.

Fixes: https://gitlab.freedesktop.org/wayland/weston/issues/201

Signed-off-by: Harish Krupo <harishkrupo@gmail.com>
2019-04-19 16:24:26 +00:00
Pekka Paalanen 4e952328ca build: turn vertex-clipping.c into a dependency
Making this into a dependency object not only carries the .c files with it, but
it also brings the include directories as well, which means the users can
simply use the object without guessing the paths.

This should help with moving GL-renderer into a new subdirectory.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-04-18 12:50:55 +03:00
Pekka Paalanen ecbdcfd373 Rename zalloc.h to libweston/zalloc.h
It is a public installed header used by libweston.h.

See "Rename compositor.h to libweston/libweston.h" for rationale.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-04-18 12:31:46 +03:00
Pekka Paalanen 91b1010de9 Rename config-parser.h to libweston/config-parser.h
It is a public installed header used by libweston.h.

See "Rename compositor.h to libweston/libweston.h" for rationale.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-04-18 12:31:46 +03:00
Pekka Paalanen 96dc449259 Rename matrix.h to libweston/matrix.h
matrix.h is a public installed header and even used by libweston.h.

See "Rename compositor.h to libweston/libweston.h" for rationale.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-04-18 12:31:46 +03:00
Luca Weiss 923a1e9688 Fix incorrect include
In file included from ../clients/multi-resource.c:38:                                                                                       
/usr/include/sys/poll.h:1:2: warning: #warning redirecting incorrect #include <sys/poll.h> to <poll.h> [-Wcpp]                               
 #warning redirecting incorrect #include <sys/poll.h> to <poll.h>                                                                            
  ^~~~~~~
2019-04-14 10:38:25 +00:00
Kamal Pandey 53d7c243ba FIX: weston: clients: typo in simple-dmabuf-egl.c
Fix variable EGL_NO_IMAGE to EGL_NO_IMAGE_KHR in
clients/simple-dmabuf-egl.c

Signed-off-by: Kamal Pandey <pandeykamal13526@gmail.com>
2019-04-04 19:45:45 +05:30
Alexandros Frantzis ff98a9080f clients/simple-dmabuf-egl: Properly check for error in gbm_bo_get_handle_for_plane
gbm_bo_get_handle_for_plane returns handle.s32 == -1 on error, at least
for the Mesa dri implementation.

Reported-by: Marius Vlad <marius.vlad@collabora.com>
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2019-03-28 09:51:28 +00:00
Pekka Paalanen cbffca980b meson: link editor with gobject-2.0
editor.c calls g_clear_object(), so it should link to gobject directly instead
of relying on pangocairo pulling it in in its pkg-config.

Fixes: https://gitlab.freedesktop.org/wayland/weston/issues/211

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-03-28 09:43:23 +00:00
Alexandros Frantzis 10a7339611 clients/simple-dmabuf-egl: Create the EGL display using the GBM platform
Since we are managing and rendering to buffers on our own with GBM,
create the EGL display using the GBM platform with the DRM render node,
instead of using the Wayland EGL platform.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2019-03-05 13:04:39 +02:00
Emmanuel Gil Peyrot 426c24673f Fix typos all around (thanks codespell!) 2019-02-20 16:47:35 +01:00
ant8me f99fac22ab clients: use xdg_shell stable instead of v6
Now that Weston supports the stable revision, use it. Better to excercise the
current rather than outdated protocol.

Pekka:
- split the patch, rewrote commit message
- rename xdg_shell_ping to xdg_wm_base_ping
- rename xdg_shell_listener to wm_base_listener
- rename shell to wm_base
- fix continued line alignment
- drop unrelated change of adding parentheses around bit-wise and

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-02-15 11:18:38 +00:00
Michael Teyfel d6371b5a6a window client: remove ivi-application support
Signed-off-by: Michael Teyfel <mteyfel@de.adit-jv.com>
2019-02-06 17:45:09 +00:00
Michael Teyfel a232b7e22c simple-shm: remove ivi-application support
Signed-off-by: Michael Teyfel <mteyfel@de.adit-jv.com>
2019-02-06 17:45:09 +00:00
Michael Teyfel 111d3d8fb4 simple-egl: remove ivi-application support
Signed-off-by: Michael Teyfel <mteyfel@de.adit-jv.com>
2019-02-06 17:45:09 +00:00
Alexandros Frantzis 7261edfe36 clients: Add a mandelbrot set shader to simple-dmabuf-egl
Support drawing a mandelbrot set in the fragment shader, rendering it
with separate draw calls, one for each cell in a virtual 4x4 grid. This
more complex and heavy drawing will potentially help us to visually
discover any present or future explicit synchronization issues.

The mandelbrot set rendering is enabled with the -m/--mandelbrot
command-line switch.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2019-02-06 12:21:56 +00:00
Alexandros Frantzis a95bb6f7e5 clients: Support explicit synchronization in simple-dmabuf-egl
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>

Changes in v7:
  - Merge acquire fence and release fence code blocks in redraw().
  - Use 1 << n to define option bitflags.
  - Remove redundant statement involving OPT_IMPLICIT_SYNC.

Changes in v6:
  - Add option for window size.
  - Add option for enabling/disabling explicit sync.

Changes in v5:
  - Meson support.
2019-02-06 12:21:56 +00:00
emersion ac71ee5d6a clients: sanitize XCURSOR_SIZE
Fixes https://gitlab.freedesktop.org/wayland/weston/issues/164
2019-01-31 09:04:22 +00:00
Dima Ryazanov 13bdf25270 clients: A better fix for a crash when unlocking or unconfining a pointer
This is a rewrite of the fix in:
https://lists.freedesktop.org/archives/wayland-devel/2018-May/038140.html

It addresses Pekka's concerns about window getting destroyed before the
unlock/unconfine event is triggered.

Signed-off-by: Dima Ryazanov <dima@gmail.com>
2019-01-31 00:20:36 +00:00
Dima Ryazanov 44dd7f2738 clients: Delete an unused variable
Signed-off-by: Dima Ryazanov <dima@gmail.com>
2019-01-31 00:20:36 +00:00
Dima Ryazanov 336ce67da7 Revert "Fix a crash when unlocking or unconfining a pointer"
This reverts commit e0dc5d47cb.

Signed-off-by: Dima Ryazanov <dima@gmail.com>
2019-01-31 00:20:36 +00:00
Pekka Paalanen fb61e45de2 meson: friendly error for simple-dmabuf-drm
This is probably the most annoying ones. Some distributions do not even package
a libdrm_${driver} if the driver's hardware does not occur on the CPU
architecture, e.g. Debian x86_64 does not have libdrm_etnaviv.

Helps people to disable those.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-01-17 14:39:27 +00:00
Alexandros Frantzis 9985c534b8 clients/simple-dmabuf-egl: Render a moving square
Render a moving square instead of just clearing the buffer, to help
uncover rendering issues (e.g. modifier-related issues) which may not be
visible with a simple glClear.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2019-01-17 14:04:05 +02:00
Alexandros Frantzis e9700f62af clients/simple-dmabuf-egl: Support dmabuf format modifiers
Take into account format modifiers advertised by the compositor and the
EGL implementation and supported by the buffer creation mechanism, to
select the optimal buffer modifier.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2019-01-17 14:04:05 +02:00
Pekka Paalanen 4b29ffddaa meson: contain and check simple-dmabuf-egl deps
Check the egl, glesv2 and gbm dependencies locally instead of relying on
the dep_* variables from the top level meson.build or
libweston/meson.build (dep_gbm).

This should make these dependencies now explicitly checked when the app
is built, rather than relying on other components doing the checks. If
the drm-backend was disabled, this would have probably hit an error
using the undeclared variable dep_gbm.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
2018-12-31 15:16:53 +02:00
Pekka Paalanen 182d3771dd meson: fix pangocairo being optional
Cannot use dependency() directly in the structure, because it will
execute regardless of the option. Instead, let's store the dependency
name in the structure and use the same logic as with simple_clients to
conditionally look for the dependencies.

As a bonus, this brings friendly error messages to demo-clients
dependencies.

subsurfaces' dependencies are also converted to maintain consistency
with simple_clients.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
2018-12-31 11:16:16 +02:00