Compare commits

...

37 Commits
main ... 11.0

Author SHA1 Message Date
Marius Vlad
742ad74bc0 build: bump to version 11.0.3 for the point release
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-08-02 18:48:58 +03:00
Marius Vlad
263702cf7d backend-drm/meson.build: Require at least mesa 21.1.1
We seem to be using at least mesa 21.1.1 since Weston 10, but we never
explicitly asked for it.

Fixes: #790

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
(cherry picked from commit 0713ea7ee6216e45ebdb67cef63bcef7961d1d4e)
2023-08-02 15:53:38 +03:00
Liu, Kai1
38eb0a96e0 xwm: WM_TRANSIENT_FOR should not point to override-redirect window
The override-redirect window will not be assigned a shell_surface
object. If it is used as a parent window, it will cause a crash
when calling the set_parent function.

The EWMH specification does not describe the behavior of an
override-redirect window as a parent window, so we should ignore
this case.

Signed-off-by: Liu, Kai1 <kai1.liu@intel.com>
(cherry picked from commit b468687dd2663240d1613bf4a917f049ef09af46)
2023-08-02 14:57:55 +03:00
Michael Tretter
a5d52075a0 backend-drm: schedule connector disable for detached head
Currently, if a head is detached, the entire state of the device is invalidated
to make sure that the connector is disabled on the next atomic commit. Side
effect of the invalid state is that all planes are disabled on the next commit.
This includes planes that are used with a different head that is not part of the
next atomic commit. Disabling the planes of unrelated outputs causes a blanking
of these outputs until output is repainted and the plane is reenabled.

Store the detached heads in a list on the output and disable the connectors for
all heads in this list in the next atomic commit.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
(cherry picked from commit bcacd9ec5a924317416eabb65a6cd6767d5bfb94)
2023-07-13 11:02:22 +08:00
Marius Vlad
78852bd350 build: bump to version 11.0.2 for the point release
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-05-17 12:19:47 +03:00
Sergio Gómez
a627a4be50 libweston/input: Fix assert for valid confine region
We need only check that the region is not empty. If either the input region or
the constraint region have degenerate extents, the intersection from the
previous instruction will set confine_region->data to pixman_region_empty_data.

Fixes: b6423e59

Signed-off-by: Sergio Gómez <sergio.g.delreal@gmail.com>
(cherry picked from commit 1ed88f60c0125988cf1d952f0dabf568bfd82a13)
2023-05-16 10:55:15 +03:00
Sergio Gómez
072c56723c libweston: Add assert for valid confine region in maybe_warp_confined_pointer()
Signed-off-by: Sergio Gómez <sergio.g.delreal@gmail.com>
(cherry picked from commit b6423e59d9116d140e33e925d6dd9bf8324188a7)
2023-05-16 10:54:29 +03:00
Sergio Gómez
21e46364c0 libweston: Add view unmap listener to pointer constraints
Since the logic of pointer constraints assumes a valid view throughout, add a
signal to disable constraints when its current view is unmapped by Weston.

The assumption that a previously unmapped view is valid already leads to the
constraints code crashing. This can happen when attaching a NULL buffer to the
surface and commiting, which effectively unmaps the view with the side effect of
clearing the surface's input region, which is then assumed valid inside
maybe_warp_confined_pointer().

Fixes: #721

Signed-off-by: Sergio Gómez <sergio.g.delreal@gmail.com>
(cherry picked from commit e3079393c400e3dc6498234d1d092f3072fa8b44)
2023-05-16 10:54:29 +03:00
Sergio Gómez
0bd68d9ad6 libweston/input: Remove redundant surface destroy listener in constraints
Currently, the surface destroy listener in pointer constraints is redundant,
since surface destruction already handles pointer constraints destruction (see
libweston/compositor.c:weston_surface_unref()).

Signed-off-by: Sergio Gómez <sergio.g.delreal@gmail.com>
(cherry picked from commit 64da736d37a7df8b3bd6fd43746ac513bae72748)
2023-05-16 10:54:29 +03:00
Michael Olbrich
ff13a90eea desktop-shell: avoid crashes when a surface disappears during resize
The desktop_surface object is destroyed first so it can happen that the shsurf
still exists but desktop_surface is already NULL. So expand the check to make
sure the desktop_surface is still available in the resize callbacks.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
(cherry picked from commit 06365e602bd7599760a9a1414d12d6c26ca9c445)
2023-05-16 10:52:31 +03:00
Michael Olbrich
5ad870f505 libweston: clear parent_view when the parent view is destroyed
When a view is destroyed then the views of subsurfaces remain until the view
list is rebuilt for the next repaint.
During that time view->parent_view contains an invalid pointer and weston will
crash when it tries to access the view.

This happens for a surface with subsurfaces with views on two different outputs
with the ivi-shell:

When the surface is destroyed then the destroy handler of the ivi-shell
(shell_handle_surface_destroy()) may be called first. It will (indirectly)
destroy the view of the main surface with weston_view_destroy().
Next the surface destroy handler of the subsurfaces
(subsurface_handle_parent_destroy() is called. It will unmap the first view of
the subsurface. Here weston_surface_assign_output() is called which tries to
find the output of the second view and accesses the now invalid
view->parent_view in the process.

There are probably other ways to trigger similar crashes.

To avoid this, clear view->parent_view when the parent view is destroyed.

Fixes 0669d4de4f22 ("libweston: Skip views without a layer assignment in
      output_mask calculations")

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
(cherry picked from commit 39796f88e6ed4a33a42c74b743e999294b3e4651)
2023-05-16 10:51:40 +03:00
Alexandros Frantzis
2d66d01cf5 xwayland: Handle shell hint for client to choose dimensions
A config event with width == 0 or height == 0 from the shell is a hint
to the client to choose its own dimensions. Since X11 clients don't
support such hints we make a best guess by trying to use the last saved
dimensions or, as a fallback, the current dimensions.

This hint is mainly used by libweston/desktop shells when transitioning
to a normal state from maximized, fullscreen or after a resize [1].
Without support for this hint the aforementioned transition causes
xwayland surfaces to be configured to a 1x1 size.

To be able to use the last saved dimensions with xwayland surface, the
shell needs to first set the maximized/fullscreen state and only then
set the new size, which is currently the case for desktop-shell.
Otherwise, if the new size is set first, then the last saved dimensions
will be set to the fullscreen/maximized values and won't be useful when
restoring to a normal window size.

[1] Recently we've introduced ba82af938a87ff088b4aacff3b8ac1b6bb461be2
"desktop-shell: do not forget to reset pending config size after
resizes". As we were not handling the 0x0 size hint, resizing X
applications started to fail. This patch fixes that.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Co-authored-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
(cherry picked from commit 2acd2c74891cd0548c1ff410ccfe81952bed27b3)
2023-05-16 10:50:40 +03:00
Leandro Ribeiro
d5a3ec5e58 desktop-shell: do not forget to reset pending config size after resizes
During interactive resizes, we progressively change the size of the
client surface and send config events with these sizes to the client.
After that, the toplevel->pending.size keeps the size of the last config
event that we've sent, i.e. the surface size after the resize is over.

Later, if the client spontaneously resize (by attaching a buffer with a
different size or setting the viewport destination, for instance), their
surface size will change, but toplevel->pending.size continues being
that old size from after the resize. If something happens and Weston
decides to send a config event, clients may re-allocate to that old
size, resulting in a sudden resize.

This does not happen when a client goes from fullscreen/maximized to
windowed mode because in such cases we are resetting
toplevel->pending.size to zero. So in the next config event that clients
receive they are allowed to attach buffers with the size that they
prefer.

So do the same after a resize: set the pending config size to zero.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
(cherry picked from commit ba82af938a87ff088b4aacff3b8ac1b6bb461be2)
2023-05-16 10:50:28 +03:00
Marius Vlad
df70b81ed7 backend-drm: Do not overwrite plane's index when creating virtual plane
Starting with commit 4cde507be6a116 "backend-drm: fix plane sorting" the
plane list will have a descending order of the planes rather than ascending.

This reversed order had the side-effect of exposing the fact that we
don't set-up a plane index when creating the drm_plane using the DRM
virtual API. Without settting a plane index for that drm_plane we
effectively overwrite the plane index which has the 0 (zero) entry.

This wasn't an issue before commit 4cde507be6a116 "backend-drm: fix
plane sorting" as it seems we never picked up that plane index as
being a suitable one due to the fact that those were assigned to primary
planes, but after that commit, the cursor plane will be one getting
the 0 (zero) plane index.

Finally, this would trip over because we attempt to place a (cursor)
view on a primary plane (where it would've normally be a cursor
plane) and we end up with no framebuffer ref.

This is fixed trivially by assigning a plane index, different than the
ones already created by create_spirtes().

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
(cherry picked from commit 27ce9dadd8865b266f72f848b784d61aeaf8b228)
2023-05-16 10:49:17 +03:00
Marius Vlad
7047926834 pipewire-plugin: Check virtual outputs/remoting instance
Similarly to remoting plug-in in commit "Check virtual outputs/remoting
instance" this avoids touching the pipewire instance, and with it, the
pipewire output.

Includes a note to point up what should be done about by
checking out https://gitlab.freedesktop.org/wayland/weston/-/issues/591.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
(cherry picked from commit 6617deebec5586c4d8c61097b7e51dd53c4e4624)
2023-05-16 10:44:25 +03:00
Marius Vlad
0849a9b3c8 pipewire: Destroy the pipewire outputs at shutdown
Seems like we are missing destroying the pipewire outputs on the shutdown
path; this follow-ups with remoting plug-in as well.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
(cherry picked from commit 278fe4d7d47c7828d42047f4c910f1d815d32b80)
2023-05-16 10:44:25 +03:00
Marius Vlad
597437a096 pipewire: Fix memleak upon compositor shutdown
This happens when shutting the compositor, and follows-up with the
remoting plug-in.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
(cherry picked from commit aa78da24659a97b82bcf1e28b985ea4f9fce4499)
2023-05-16 10:44:25 +03:00
Marius Vlad
eaa777b914 pipewire: Follow-up with remoting pluging when releasing the head
Similarily to what the remoting plug-in does, explicitly call
weston_release_head() before removing the output list entry.

We do that to avoid lookup_pipewire_output() returning NULL and still
find out the pipewire_output.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
(cherry picked from commit 5db6d19e6bb4c72085104fcae9abf2f632d5f45a)
2023-05-16 10:44:25 +03:00
Marius Vlad
17f5a44f3b remoting-plugin: Check virtual outputs/remoting instance
With commit aab722bb, "backend-drm: prepare virtual output API for
heterogeneous outputs", we now call the virtual destroy function,
but when shutting the compositor we no longer have a remoting instance
available.

When searching out for a remoting output verify if the remoting instance is
still available before attempting to search for a remoting output.

Addresses the following crash at shutdown:

0x00007fd430a1d347 in lookup_remoted_output (output=0x557163d5dad0) at ../remoting/remoting-plugin.c:515
0x00007fd430a1d746 in remoting_output_destroy (output=0x557163d5dad0) at ../remoting/remoting-plugin.c:635
0x00007fd439e11ab9 in drm_virtual_output_destroy (base=0x557163d5dad0) at ../libweston/backend-drm/drm-virtual.c:265
0x00007fd43a8635d0 in weston_compositor_shutdown (ec=0x557163239530) at ../libweston/compositor.c:8271
0x00007fd439e029d4 in drm_destroy (backend=0x557163240ae0) at ../libweston/backend-drm/drm.c:2713
0x00007fd43a863e07 in weston_compositor_destroy (compositor=0x557163239530) at ../libweston/compositor.c:8626

Includes a note to point up what should be done about by
checking out https://gitlab.freedesktop.org/wayland/weston/-/issues/591.

Fixes aab722bb "backend-drm: prepare virtual output API for
heterogeneous outputs"

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
(cherry picked from commit ca52c79c51088ca4c724b34e54c3bb97a9a51c67)
2023-05-16 10:44:25 +03:00
Marius Vlad
0ba5b694d3 remoting-plugin: Release and detach the head
This re-orders the disable/destroy shutdown sequence such that
lookup_remoted_output(), in remoting_output_disable(), would find a
remoting output.

Otherwise, without this, lookup_remoted_output() wouldn't find a
remoting output available when shutting down the compositor, ultimately
leading to a crash.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
(cherry picked from commit c3270e887bc07bb9c7d0e58e25d25e3a65145d2e)
2023-05-16 10:44:25 +03:00
Marius Vlad
783b144f2e build: bump to version 11.0.1 for the point release
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-12-14 09:09:30 +02:00
Derek Foreman
995fb60fde xwm: Propagate selection ownership immediately
If we don't xcb_flush() when we set the selection owner, we end up with
a ridiculous corner case where we can run use a command line X client
like 'xclip -i -selection clipboard' to crash weston.

Start weston, ensure Xwayland is running (set a selection with xclip), set
the clipboard from a wayland client, then set the clipboard with xclip
again.

Since xclip doesn't do anything xwm notices except set the clipboard, it
won't provoke a flush on our selection ownership change. xclip will take
ownership, then we call xcb_convert_selection(), and THEN we flush, sending
out our pending ownership change and the xcb_convert_selection() request.

The ownership change takes place first, we attempt to get our own selection
and weston explodes in a mess.

Stop this from happening with a flush when changing selection ownership.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
(cherry picked from commit 11bcad116f5cc1eb76c2de83d8c39af0cdb71a81)
2022-12-12 13:18:46 +02:00
Derek Foreman
f5fafa05fc xwm: Don't crash when setting selection with no seat
It's possible to set the clipboard with no seat present - one way is to
use the RDP backend and then run 'xclip -i -selection clipboard' locally
without making an RDP connection.

Check if seat is NULL to prevent this from crashing.

Fixes #698

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
(cherry picked from commit bb993df236766178df95579217171bce5b166031)
2022-12-12 13:18:37 +02:00
Marius Vlad
ac05950098 ivi-shell: Move out weston_desktop_shell at the end
To avoid the following UAF:

Invalid read of size 8
   at 0x4AE5EFF: weston_desktop_get_display (libweston-desktop.c:110)
   by 0x4AEB2C9: weston_desktop_xdg_surface_schedule_configure (xdg-shell.c:1160)
   by 0x4AEA77A: weston_desktop_xdg_toplevel_set_size (xdg-shell.c:711)
   by 0x4AE839D: weston_desktop_surface_set_size (surface.c:504)
   by 0x63F7D43: ivi_layout_surface_set_size (ivi-layout.c:1599)
   by 0x63F949F: transition_move_resize_view_destroy (ivi-layout-transition.c:311)
   by 0x63F9397: layout_transition_destroy (ivi-layout-transition.c:259)
   by 0x63F8E0B: ivi_layout_remove_all_surface_transitions (ivi-layout-transition.c:121)
   by 0x63F4BC1: ivi_layout_surface_destroy (ivi-layout.c:258)
   by 0x63F38AF: layout_surface_cleanup (ivi-shell.c:162)
   by 0x63F3D2D: shell_destroy (ivi-shell.c:359)
   by 0x4AF059A: weston_signal_emit_mutable (signal.c:62)
 Address 0x174202d0 is 0 bytes inside a block of size 152 free'd
   at 0x484617B: free (vg_replace_malloc.c:872)
   by 0x4AE5EDC: weston_desktop_destroy (libweston-desktop.c:97)
   by 0x63F3CF2: shell_destroy (ivi-shell.c:355)
   by 0x4AF059A: weston_signal_emit_mutable (signal.c:62)
   by 0x4ACBC2C: weston_compositor_destroy (compositor.c:8629)
   by 0x4864A4B: wet_main (main.c:3908)
   by 0x10915D: main (executable.c:33)

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
(cherry picked from commit eb755cd81aad6f958629475a0429272aef3147b0)
2022-11-21 13:55:20 +02:00
Marius Vlad
097ed47292 hmi-controller: Add missing removal of destroy listener
Shutting down the compositor gives us:

Invalid write of size 8
   at 0x4B1AEDB: wl_list_remove (wayland-util.c:56)
   by 0x4AF05BF: weston_signal_emit_mutable (signal.c:66)
   by 0x4ACBC2C: weston_compositor_destroy (compositor.c:8629)
   by 0x4864A4B: wet_main (main.c:3908)
   by 0x10915D: main (executable.c:33)
 Address 0x17435f20 is 224 bytes inside a block of size 384 free'd
   at 0x484617B: free (vg_replace_malloc.c:872)
   by 0x17718C7E: hmi_controller_destroy (hmi-controller.c:761)
   by 0x4AF059A: weston_signal_emit_mutable (signal.c:62)
   by 0x4ACBC2C: weston_compositor_destroy (compositor.c:8629)
   by 0x4864A4B: wet_main (main.c:3908)
   by 0x10915D: main (executable.c:33)

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
(cherry picked from commit cfbf2b0ab2ac7c50d8a1ea7645be3a9f3927825b)
2022-11-21 13:55:20 +02:00
Alexandros Frantzis
ad7c5162bc kiosk-shell: Don't use a modifier for surface activation bindings
The mouse button and touch bindings to activate a surface shouldn't
use the binding modifier.

Fixes: https://gitlab.freedesktop.org/wayland/weston/-/issues/679

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
(cherry picked from commit 723709aa073fb740c3443fae8e370306d0738675)
2022-11-21 13:55:20 +02:00
Michael Tretter
e7cf894fa2 ivi-shell: fix cleanup of desktop surfaces
The ivi-shell keeps track of its surfaces by adding them to the ivi_surface_list
to be able to remove them on shutdown. It also creates an ivi_layout_surface for
a desktop surface, but does not keep track of these surfaces.

During compositor shutdown, libweston prints the following message:

	BUG: finalizing a layer with views still on it.

Fix it by adding the created ivi_layout_surface to the ivi_surface_list to
remove the surfaces from the layer during shutdown.

Furthermore, remove the ivi_layout_surface from the desktop surface and free it
when the desktop surface is destroyed.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
(cherry picked from commit 266e2e1d4866ef7c39cff0b77f1e404d0dc96b55)

Resolved small conflict which arose due to commit cbf476f208fbdcefe.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-11-21 13:55:20 +02:00
Michael Tretter
72a6929467 ivi-shell: fix free in get_layers_under_surface
If a controller requests the layers under a surface that has no views attached,
Weston crashes since it tries to free the array that would be used to return the
found layers, but has not been allocated before.

Free the ppArray only if it was allocated in ivi_layout_get_layers_under_surface
before and no layers were found.

While at it, make it obvious that checking the length is an integer comparison
by comparing it to 0.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
(cherry picked from commit c56e69bc850540f243ebb87c5bcc38713ef1862a)
2022-11-21 13:55:20 +02:00
Alexandros Frantzis
7a8392d2fe kiosk-shell: Update view transform after activation.
The activation of a view implies, among other things, a change in the
associated view layer which is initially unset. In order for this change
to be reflected in the corresponding surface's output mask, and hence
allow surface damage to trigger output repaints, we need to update the
view transform.

Fixes #674

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
(cherry picked from commit 341d09d232d652c0001441cce55beb874fb3ba36)
2022-11-21 13:55:20 +02:00
Paul Kocialkowski
7678ec9209 screenshooter: Add SHM buffer destroy listener to avoid invalid memcpy
This adds a destroy listener on the SHM buffer provided by our client.
It will unregister the frame notify listener in case our buffer is
destroyed before the frame signal is emitted and thus avoid a memcpy
to invalid memory.

Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
(cherry picked from commit 0afd3428dc899c426d37650192f828541f70e390)
2022-11-21 13:55:20 +02:00
Derek Foreman
5517953ed0 xwm: Check size hints in weston_wm_window_is_positioned()
Currently we can't tell the difference between a window intentionally
created at 0,0 and a window that we can place anywhere.

Check the size hints to see if the flags indicating the placement
is intentional are present.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
(cherry picked from commit 1cb46994e3808e8000300ed9ae9dcaa0b76bff28)
2022-11-21 13:55:20 +02:00
Marius Vlad
00a78294b1 compositor/shared: Suppress write(2) warnings
Fixes the following warnings when building with _FORTIFY_SOURCE
and optimizations enabled:

../shared/xalloc.h:49:9: error: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
   49 |         write(STDERR_FILENO, oommsg, strlen(oommsg));
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

or
../compositor/main.c:427:25: error: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
  427 |                         write(STDERR_FILENO, fail_seteuid,
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  428 |                               strlen(fail_seteuid));
      |                               ~~~~~~~~~~~~~~~~~~~~~
../compositor/main.c:434:25: error: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
  434 |                         write(STDERR_FILENO, fail_cloexec,
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  435 |                               strlen(fail_cloexec));
      |                               ~~~~~~~~~~~~~~~~~~~~~
../compositor/main.c:442:25: error: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
  442 |                         write(STDERR_FILENO, fail_exec, strlen(fail_exec));
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
(cherry picked from commit 8c4cdd782e17aa587bfccb6746998571ddc90dd7)
2022-11-21 13:55:20 +02:00
Marius Vlad
715eb67cd8 backend-rdp/rdpclip: Avoid printing negative index
As clipboard_find_supported_format_by_mime_type() can return -1 if it
can't find out an index avoid trying to print outside of the array.

Fixes the following warnings triggered when enabling FORTIFY_SOURCE
combined with optimizations (-O)

../libweston/backend-rdp/rdpclip.c:1114:17: error: array subscript -1 is below array bounds of ‘uint32_t[5]’ {aka ‘unsigned int[5]’} [-Werror=array-bounds]
 1114 |                 weston_log("RDP %s (%p:%s) specified format \"%s\" index:%d formatId:%d is not supported by client\n",
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1115 |                            __func__, source, clipboard_data_source_state_to_string(source),
      |                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1116 |                            mime_type, index, source->client_format_id_table[index]);
      |                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../libweston/backend-rdp/rdpclip.c:131:18: note: while referencing ‘client_format_id_table’
  131 |         uint32_t client_format_id_table[RDP_NUM_CLIPBOARD_FORMATS];

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
(cherry picked from commit 9455ad7c7c07fdb8218330f449c97be73f695742)
2022-11-21 13:55:20 +02:00
Marius Vlad
0da83cc1d8 doc/sphinx: Make doxygen warn as error depend on meson werror flag
As seen previous times, with newer doxygen version we seem to be
generating warnings and with it to stop generating documentation
entirely as we have enabled warning as error in the doxygen
configuration file.

By default meson werror build option is not enabled, so users can still
generate documentation when building regularly, and when we'll update to
the same doxygen version we should be able to catch those errors up if
any of them will pile up in between.

Suggested-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
(cherry picked from commit 402d9a81c9a42b0dcfc457c80382c36f5cecc6e6)
2022-11-21 13:55:20 +02:00
vanfanel
24ee61445c Don't change the max_bpc connector prop if mode=current.
As things are, even when mode=current is specified on the .ini file,
a full modeset is needed (and done), which causes a very noticeable
screen blinking. That is because setting the max_bpc on a connector
needs full modesetting.
The idea here is that if mode=current on the .ini, no modesetting
should be done, so the current max_bpc is programmed into the
connector.
But if a custom max-bpc=... is specified, that will be used instead,
even if mode=current on the .ini

Fixes: https://gitlab.freedesktop.org/wayland/weston/-/issues/660

Signed-off-by: vanfanel <redwindwanderer@gmail.com>
(cherry picked from commit 3240ccc69d1488003c1cfc36d23750145d4f13f7)
2022-11-21 13:55:20 +02:00
Michael Olbrich
870db9703c backend-wayland: always propagate touch frame event
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
(cherry picked from commit 631b60b38bf03a41515c4cdc9294f5b21ca719a5)
2022-11-21 13:55:20 +02:00
Michael Olbrich
cf1ca2c300 input: send touch frame event after up event
Currently the frame event gets lost: The touch focus is removed in the 'up'
event. So the focus is gone when the frame event arrives so it is never sent to
the clients.

To avoid this, keep the touch focus until the frame is handled.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
(cherry picked from commit 5448580111b5ff992ce2603cb6e99b9f54db7ad8)

This has undergone a change to avoid an ABI break, so rather than
hooking up a pending_touch boolean in weston_touch, keep a local list of
weston_touch_devices and have a pending_touch with each device to check
upon.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-11-21 13:54:48 +02:00
28 changed files with 333 additions and 96 deletions

View File

@ -385,6 +385,7 @@ weston_client_launch(struct weston_compositor *compositor,
sigset_t allsigs;
pid_t pid;
bool ret;
size_t written __attribute__((unused));
weston_log("launching '%s'\n", path);
str_printf(&fail_exec, "Error: Couldn't launch client '%s'\n", path);
@ -424,22 +425,23 @@ weston_client_launch(struct weston_compositor *compositor,
/* Launch clients as the user. Do not launch clients with wrong euid. */
if (seteuid(getuid()) == -1) {
write(STDERR_FILENO, fail_seteuid,
strlen(fail_seteuid));
written = write(STDERR_FILENO, fail_seteuid,
strlen(fail_seteuid));
_exit(EXIT_FAILURE);
}
ret = fdstr_clear_cloexec_fd1(&wayland_socket);
if (!ret) {
write(STDERR_FILENO, fail_cloexec,
strlen(fail_cloexec));
written = write(STDERR_FILENO, fail_cloexec,
strlen(fail_cloexec));
_exit(EXIT_FAILURE);
}
execve(argp[0], argp, envp);
if (fail_exec)
write(STDERR_FILENO, fail_exec, strlen(fail_exec));
written = write(STDERR_FILENO, fail_exec,
strlen(fail_exec));
_exit(EXIT_FAILURE);
default:
@ -2051,7 +2053,8 @@ drm_backend_output_configure(struct weston_output *output,
enum weston_drm_backend_output_mode mode =
WESTON_DRM_BACKEND_OUTPUT_PREFERRED;
uint32_t transform = WL_OUTPUT_TRANSFORM_NORMAL;
uint32_t max_bpc;
uint32_t max_bpc = 0;
bool max_bpc_specified = false;
char *s;
char *modeline = NULL;
char *gbm_format = NULL;
@ -2063,16 +2066,19 @@ drm_backend_output_configure(struct weston_output *output,
return -1;
}
weston_config_section_get_uint(section, "max-bpc", &max_bpc, 16);
api->set_max_bpc(output, max_bpc);
weston_config_section_get_string(section, "mode", &s, "preferred");
if (weston_config_section_get_uint(section, "max-bpc", &max_bpc, 16) == 0)
max_bpc_specified = true;
if (strcmp(s, "off") == 0) {
assert(0 && "off was supposed to be pruned");
return -1;
} else if (wet->drm_use_current_mode || strcmp(s, "current") == 0) {
mode = WESTON_DRM_BACKEND_OUTPUT_CURRENT;
/* If mode=current and no max-bpc was specfied on the .ini file,
use current max_bpc so full modeset is not done. */
if (!max_bpc_specified)
max_bpc = 0;
} else if (strcmp(s, "preferred") != 0) {
modeline = s;
s = NULL;
@ -2086,6 +2092,8 @@ drm_backend_output_configure(struct weston_output *output,
}
free(modeline);
api->set_max_bpc(output, max_bpc);
if (count_remaining_heads(output, NULL) == 1) {
struct weston_head *head = weston_output_get_first_head(output);
transform = weston_head_get_transform(head);

View File

@ -110,6 +110,7 @@ spawn_xserver(void *user_data, const char *display, int abstract_fd, int unix_fd
char *const *envp;
char *const *argp;
bool ret;
size_t written __attribute__ ((unused));
if (os_socketpair_cloexec(AF_UNIX, SOCK_STREAM, 0, wayland_socket.fds) < 0) {
weston_log("wl connection socketpair failed\n");
@ -174,8 +175,8 @@ spawn_xserver(void *user_data, const char *display, int abstract_fd, int unix_fd
/* execve does not return on success, so it failed */
if (exec_failure_msg) {
write(STDERR_FILENO, exec_failure_msg,
strlen(exec_failure_msg));
written = write(STDERR_FILENO, exec_failure_msg,
strlen(exec_failure_msg));
}
_exit(EXIT_FAILURE);

View File

@ -1153,7 +1153,7 @@ resize_grab_motion(struct weston_pointer_grab *grab,
weston_pointer_move(pointer, event);
if (!shsurf)
if (!shsurf || !shsurf->desktop_surface)
return;
weston_view_from_global_fixed(shsurf->view,
@ -1204,11 +1204,12 @@ resize_grab_button(struct weston_pointer_grab *grab,
if (pointer->button_count == 0 &&
state == WL_POINTER_BUTTON_STATE_RELEASED) {
if (resize->base.shsurf != NULL) {
if (resize->base.shsurf && resize->base.shsurf->desktop_surface) {
struct weston_desktop_surface *desktop_surface =
resize->base.shsurf->desktop_surface;
weston_desktop_surface_set_resizing(desktop_surface,
false);
weston_desktop_surface_set_size(desktop_surface, 0, 0);
}
shell_grab_end(&resize->base);
@ -1221,10 +1222,11 @@ resize_grab_cancel(struct weston_pointer_grab *grab)
{
struct weston_resize_grab *resize = (struct weston_resize_grab *) grab;
if (resize->base.shsurf != NULL) {
if (resize->base.shsurf && resize->base.shsurf->desktop_surface) {
struct weston_desktop_surface *desktop_surface =
resize->base.shsurf->desktop_surface;
weston_desktop_surface_set_resizing(desktop_surface, false);
weston_desktop_surface_set_size(desktop_surface, 0, 0);
}
shell_grab_end(&resize->base);

View File

@ -759,7 +759,7 @@ WARN_NO_PARAMDOC = NO
# a warning is encountered.
# The default value is: NO.
WARN_AS_ERROR = YES
WARN_AS_ERROR = @MESON_WERROR@
# The WARN_FORMAT tag determines the format of the warning messages that doxygen
# can produce. The string should contain the $file, $line, and $text tags, which

View File

@ -39,6 +39,7 @@ sphinx_conf = configure_file(
doxy_conf_data = configuration_data()
doxy_conf_data.set('SRC_ROOT', meson.source_root())
doxy_conf_data.set('OUTPUT_DIR', doxygen_database)
doxy_conf_data.set('MESON_WERROR', get_option('werror') == true ? 'YES' : 'NO')
doxygen_conf_weston = configure_file(
input: 'doxygen.ini.in',
output: 'doxygen.ini',

View File

@ -84,7 +84,8 @@ struct weston_drm_output_api {
* The property is used for working around faulty sink hardware like
* monitors or media converters that mishandle the kernel driver
* chosen bits-per-channel on the physical link. When having trouble,
* try a lower value like 8.
* try a lower value like 8. A value of 0 means that the current max
* bpc will be reprogrammed.
*
* The value actually used in KMS is silently clamped to the range the
* KMS driver claims to support. The default value is 16.

View File

@ -1452,6 +1452,7 @@ struct weston_view {
struct weston_surface *surface;
struct wl_list surface_link;
struct wl_signal destroy_signal;
struct wl_signal unmap_signal;
/* struct weston_paint_node::view_link */
struct wl_list paint_node_list;
@ -1605,7 +1606,7 @@ struct weston_pointer_constraint {
bool hint_is_pending;
struct wl_listener pointer_destroy_listener;
struct wl_listener surface_destroy_listener;
struct wl_listener view_unmap_listener;
struct wl_listener surface_commit_listener;
struct wl_listener surface_activate_listener;
};

View File

@ -738,6 +738,8 @@ hmi_controller_destroy(struct wl_listener *listener, void *data)
struct hmi_controller *hmi_ctrl =
container_of(listener, struct hmi_controller, destroy_listener);
wl_list_remove(&hmi_ctrl->destroy_listener.link);
wl_list_for_each_safe(link, next,
&hmi_ctrl->workspace_fade.layer_list, link) {
wl_list_remove(&link->link);

View File

@ -1192,15 +1192,14 @@ ivi_layout_get_layers_under_surface(struct ivi_layout_surface *ivisurf,
else
length--;
}
if (length == 0) {
free(*ppArray);
*ppArray = NULL;
}
}
*pLength = length;
if (!length) {
free(*ppArray);
*ppArray = NULL;
}
return IVI_SUCCEEDED;
}

View File

@ -346,7 +346,6 @@ shell_destroy(struct wl_listener *listener, void *data)
wl_list_remove(&shell->destroy_listener.link);
wl_list_remove(&shell->wake_listener.link);
weston_desktop_destroy(shell->desktop);
wl_list_for_each_safe(ivisurf, next, &shell->ivi_surface_list, link) {
if (ivisurf->layout_surface != NULL)
@ -357,6 +356,7 @@ shell_destroy(struct wl_listener *listener, void *data)
ivi_layout_fini();
weston_desktop_destroy(shell->desktop);
free(shell);
}
@ -507,6 +507,8 @@ desktop_surface_added(struct weston_desktop_surface *surface,
ivisurf->layout_surface = layout_surface;
ivisurf->surface = weston_surf;
wl_list_insert(&shell->ivi_surface_list, &ivisurf->link);
weston_desktop_surface_set_user_data(surface, ivisurf);
}
@ -519,8 +521,14 @@ desktop_surface_removed(struct weston_desktop_surface *surface,
assert(ivisurf != NULL);
weston_desktop_surface_set_user_data(surface, NULL);
if (ivisurf->layout_surface)
layout_surface_cleanup(ivisurf);
wl_list_remove(&ivisurf->link);
free(ivisurf);
}
static void

View File

@ -413,6 +413,7 @@ kiosk_shell_surface_activate(struct kiosk_shell_surface *shsurf,
weston_layer_entry_insert(&shsurf->shell->normal_layer.view_list,
&shsurf->view->layer_link);
weston_view_geometry_dirty(shsurf->view);
weston_view_update_transform(shsurf->view);
weston_surface_damage(shsurf->view->surface);
}
@ -1068,13 +1069,13 @@ kiosk_shell_add_bindings(struct kiosk_shell *shell)
mod = weston_shell_get_binding_modifier(shell->config, MODIFIER_SUPER);
weston_compositor_add_button_binding(shell->compositor, BTN_LEFT, mod,
weston_compositor_add_button_binding(shell->compositor, BTN_LEFT, 0,
kiosk_shell_click_to_activate_binding,
shell);
weston_compositor_add_button_binding(shell->compositor, BTN_RIGHT, mod,
weston_compositor_add_button_binding(shell->compositor, BTN_RIGHT, 0,
kiosk_shell_click_to_activate_binding,
shell);
weston_compositor_add_touch_binding(shell->compositor, mod,
weston_compositor_add_touch_binding(shell->compositor, 0,
kiosk_shell_touch_to_activate_binding,
shell);

View File

@ -517,7 +517,11 @@ struct drm_head {
struct backlight *backlight;
drmModeModeInfo inherited_mode; /**< Original mode on the connector */
uint32_t inherited_max_bpc; /**< Original max_bpc on the connector */
uint32_t inherited_crtc_id; /**< Original CRTC assignment */
/* drm_output::disable_head */
struct wl_list disable_head_link;
};
struct drm_crtc {
@ -540,6 +544,9 @@ struct drm_output {
struct drm_device *device;
struct drm_crtc *crtc;
/* drm_head::disable_head_link */
struct wl_list disable_head;
bool page_flip_pending;
bool atomic_complete_pending;
bool destroy_pending;

View File

@ -81,6 +81,20 @@ drm_virtual_crtc_destroy(struct drm_crtc *crtc)
free(crtc);
}
static uint32_t
get_drm_plane_index_maximum(struct drm_device *device)
{
uint32_t max = 0;
struct drm_plane *p;
wl_list_for_each(p, &device->plane_list, link) {
if (p->plane_idx > max)
max = p->plane_idx;
}
return max;
}
/**
* Create a drm_plane for virtual output
*
@ -125,6 +139,7 @@ drm_virtual_plane_create(struct drm_device *device, struct drm_output *output)
goto err;
weston_plane_init(&plane->base, b->compositor, 0, 0);
plane->plane_idx = get_drm_plane_index_maximum(device) + 1;
wl_list_insert(&device->plane_list, &plane->link);
return plane;

View File

@ -1299,10 +1299,14 @@ drm_output_attach_head(struct weston_output *output_base,
{
struct drm_backend *b = to_drm_backend(output_base->compositor);
struct drm_device *device = b->drm;
struct drm_head *head = to_drm_head(head_base);
if (wl_list_length(&output_base->head_list) >= MAX_CLONED_CONNECTORS)
return -1;
wl_list_remove(&head->disable_head_link);
wl_list_init(&head->disable_head_link);
if (!output_base->enabled)
return 0;
@ -1326,18 +1330,14 @@ static void
drm_output_detach_head(struct weston_output *output_base,
struct weston_head *head_base)
{
struct drm_backend *b = to_drm_backend(output_base->compositor);
struct drm_device *device = b->drm;
struct drm_output *output = to_drm_output(output_base);
struct drm_head *head = to_drm_head(head_base);
if (!output_base->enabled)
return;
/* Need to go through modeset to drop connectors that should no longer
* be driven. */
/* XXX: Ideally we'd do this per-output, not globally. */
device->state_invalid = true;
weston_output_schedule_repaint(output_base);
/* Drop connectors that should no longer be driven on next repaint. */
wl_list_insert(&output->disable_head, &head->disable_head_link);
}
int
@ -1388,6 +1388,12 @@ drm_head_read_current_setup(struct drm_head *head, struct drm_device *device)
drmModeFreeCrtc(crtc);
}
/* Get the current max_bpc that's currently configured to
* this connector. */
head->inherited_max_bpc = drm_property_get_value(
&head->connector.props[WDRM_CONNECTOR_MAX_BPC],
head->connector.props_drm, 0);
return 0;
}
@ -2243,6 +2249,8 @@ drm_head_create(struct drm_device *device, drmModeConnector *conn,
head->base.backend_id = drm_head_destroy;
wl_list_init(&head->disable_head_link);
ret = drm_head_update_info(head, conn);
if (ret < 0)
goto err_update;
@ -2316,6 +2324,8 @@ drm_output_create(struct weston_compositor *compositor, const char *name)
output->device = device;
output->crtc = NULL;
wl_list_init(&output->disable_head);
output->max_bpc = 16;
output->gbm_format = DRM_FORMAT_INVALID;
#ifdef BUILD_DRM_GBM

View File

@ -912,20 +912,29 @@ drm_connector_set_max_bpc(struct drm_connector *connector,
drmModeAtomicReq *req)
{
const struct drm_property_info *info;
struct drm_head *head;
struct drm_backend *backend = output->device->backend;
uint64_t max_bpc;
uint64_t a, b;
if (!drm_connector_has_prop(connector, WDRM_CONNECTOR_MAX_BPC))
return 0;
info = &connector->props[WDRM_CONNECTOR_MAX_BPC];
assert(info->flags & DRM_MODE_PROP_RANGE);
assert(info->num_range_values == 2);
a = info->range_values[0];
b = info->range_values[1];
assert(a <= b);
if (output->max_bpc == 0) {
/* A value of 0 means that the current max_bpc must be programmed. */
head = drm_head_find_by_connector(backend, connector->connector_id);
max_bpc = head->inherited_max_bpc;
} else {
info = &connector->props[WDRM_CONNECTOR_MAX_BPC];
assert(info->flags & DRM_MODE_PROP_RANGE);
assert(info->num_range_values == 2);
a = info->range_values[0];
b = info->range_values[1];
assert(a <= b);
max_bpc = MAX(a, MIN(output->max_bpc, b));
}
max_bpc = MAX(a, MIN(output->max_bpc, b));
return connector_add_prop(req, connector,
WDRM_CONNECTOR_MAX_BPC, max_bpc);
}
@ -942,6 +951,7 @@ drm_output_apply_state_atomic(struct drm_output_state *state,
struct drm_plane_state *plane_state;
struct drm_mode *current_mode = to_drm_mode(output->base.current_mode);
struct drm_head *head;
struct drm_head *tmp;
int ret = 0;
drm_debug(b, "\t\t[atomic] %s output %lu (%s) state\n",
@ -978,6 +988,14 @@ drm_output_apply_state_atomic(struct drm_output_state *state,
wl_list_for_each(head, &output->base.head_list, base.output_link)
ret |= connector_add_prop(req, &head->connector,
WDRM_CONNECTOR_CRTC_ID, 0);
wl_list_for_each_safe(head, tmp, &output->disable_head,
disable_head_link) {
ret |= connector_add_prop(req, &head->connector,
WDRM_CONNECTOR_CRTC_ID, 0);
wl_list_remove(&head->disable_head_link);
wl_list_init(&head->disable_head_link);
}
}
wl_list_for_each(head, &output->base.head_list, base.output_link) {

View File

@ -44,7 +44,7 @@ deps_drm = [
]
if get_option('renderer-gl')
dep_gbm = dependency('gbm', required: false)
dep_gbm = dependency('gbm', required: false, version: '>= 21.1.1')
if not dep_gbm.found()
error('drm-backend with GL renderer requires gbm which was not found. Or, you can use \'-Drenderer-gl=false\'.')
endif

View File

@ -1111,9 +1111,9 @@ clipboard_data_source_send(struct weston_data_source *base,
}
} else {
source->state = RDP_CLIPBOARD_SOURCE_FAILED;
weston_log("RDP %s (%p:%s) specified format \"%s\" index:%d formatId:%d is not supported by client\n",
weston_log("RDP %s (%p:%s) specified format \"%s\" index:%d is not supported by client\n",
__func__, source, clipboard_data_source_state_to_string(source),
mime_type, index, source->client_format_id_table[index]);
mime_type, index);
goto error_return_close_fd;
}

View File

@ -2162,10 +2162,6 @@ input_handle_touch_up(void *data, struct wl_touch *wl_touch,
timespec_from_msec(&ts, time);
input->touch_points--;
if (input->touch_points == 0) {
input->touch_focus = NULL;
input->touch_active = false;
}
if (!output)
return;
@ -2228,6 +2224,11 @@ input_handle_touch_frame(void *data, struct wl_touch *wl_touch)
return;
notify_touch_frame(input->touch_device);
if (input->touch_points == 0) {
input->touch_focus = NULL;
input->touch_active = false;
}
}
static void

View File

@ -396,6 +396,7 @@ weston_view_create(struct weston_surface *surface)
wl_list_insert(&surface->views, &view->surface_link);
wl_signal_init(&view->destroy_signal);
wl_signal_init(&view->unmap_signal);
wl_list_init(&view->link);
wl_list_init(&view->layer_link.link);
wl_list_init(&view->paint_node_list);
@ -1827,6 +1828,7 @@ transform_parent_handle_parent_destroy(struct wl_listener *listener,
geometry.parent_destroy_listener);
weston_view_set_transform_parent(view, NULL);
view->parent_view = NULL;
}
WL_EXPORT void
@ -2247,22 +2249,22 @@ weston_view_unmap(struct weston_view *view)
view->output_mask = 0;
weston_surface_assign_output(view->surface);
if (weston_surface_is_mapped(view->surface))
return;
if (!weston_surface_is_mapped(view->surface)) {
wl_list_for_each(seat, &view->surface->compositor->seat_list, link) {
struct weston_touch *touch = weston_seat_get_touch(seat);
struct weston_pointer *pointer = weston_seat_get_pointer(seat);
struct weston_keyboard *keyboard =
weston_seat_get_keyboard(seat);
wl_list_for_each(seat, &view->surface->compositor->seat_list, link) {
struct weston_touch *touch = weston_seat_get_touch(seat);
struct weston_pointer *pointer = weston_seat_get_pointer(seat);
struct weston_keyboard *keyboard =
weston_seat_get_keyboard(seat);
if (keyboard && keyboard->focus == view->surface)
weston_keyboard_set_focus(keyboard, NULL);
if (pointer && pointer->focus == view)
weston_pointer_clear_focus(pointer);
if (touch && touch->focus == view)
weston_touch_set_focus(touch, NULL);
if (keyboard && keyboard->focus == view->surface)
weston_keyboard_set_focus(keyboard, NULL);
if (pointer && pointer->focus == view)
weston_pointer_clear_focus(pointer);
if (touch && touch->focus == view)
weston_touch_set_focus(touch, NULL);
}
}
weston_signal_emit_mutable(&view->unmap_signal, view);
}
WL_EXPORT void

View File

@ -75,6 +75,15 @@ struct border {
enum motion_direction blocking_dir;
};
struct pending_touch {
struct weston_touch_device *touch_device;
bool pending_focus_touch_reset;
struct wl_list touch_link;
};
static struct wl_list pending_touch_list;
static void
maybe_warp_confined_pointer(struct weston_pointer_constraint *constraint);
@ -143,6 +152,7 @@ weston_touch_create_touch_device(struct weston_touch *touch,
const struct weston_touch_device_ops *ops)
{
struct weston_touch_device *device;
struct pending_touch *pt;
assert(syspath);
if (ops) {
@ -164,20 +174,55 @@ weston_touch_create_touch_device(struct weston_touch *touch,
return NULL;
}
pt = zalloc(sizeof(*pt));
if (!pt) {
free(device);
return NULL;
}
device->backend_data = backend_data;
device->ops = ops;
pt->touch_device = device;
pt->pending_focus_touch_reset = false;
device->aggregate = touch;
wl_list_insert(touch->device_list.prev, &device->link);
wl_list_insert(&pending_touch_list, &pt->touch_link);
return device;
}
static struct pending_touch *
weston_touch_get_pending(struct weston_touch_device *dev)
{
struct pending_touch *pt_iter = NULL;
struct pending_touch *pt = NULL;
wl_list_for_each(pt_iter, &pending_touch_list, touch_link) {
if (pt_iter->touch_device == dev) {
pt = pt_iter;
break;
}
}
return pt;
}
/** Destroy the touch device. */
WL_EXPORT void
weston_touch_device_destroy(struct weston_touch_device *device)
{
struct pending_touch *pt = NULL;
wl_list_remove(&device->link);
pt = weston_touch_get_pending(device);
assert(pt);
wl_list_remove(&pt->touch_link);
free(pt);
wl_signal_emit(&device->destroy_signal, device);
free(device->syspath);
free(device);
@ -2388,6 +2433,7 @@ process_touch_normal(struct weston_touch_device *device,
struct weston_touch_grab *grab = device->aggregate->grab;
struct weston_compositor *ec = device->aggregate->seat->compositor;
struct weston_view *ev;
struct pending_touch *pt = NULL;
wl_fixed_t sx, sy;
wl_fixed_t x = wl_fixed_from_double(double_x);
wl_fixed_t y = wl_fixed_from_double(double_y);
@ -2438,8 +2484,9 @@ process_touch_normal(struct weston_touch_device *device,
break;
case WL_TOUCH_UP:
grab->interface->up(grab, time, touch_id);
if (touch->num_tp == 0)
weston_touch_set_focus(touch, NULL);
pt = weston_touch_get_pending(device);
assert(pt);
pt->pending_focus_touch_reset = true;
break;
}
}
@ -2628,12 +2675,22 @@ WL_EXPORT void
notify_touch_frame(struct weston_touch_device *device)
{
struct weston_touch_grab *grab;
struct pending_touch *pt;
switch (weston_touch_device_get_mode(device)) {
case WESTON_TOUCH_MODE_NORMAL:
case WESTON_TOUCH_MODE_PREP_CALIB:
grab = device->aggregate->grab;
grab->interface->frame(grab);
pt = weston_touch_get_pending(device);
assert(pt);
if (pt->pending_focus_touch_reset) {
if (grab->touch->num_tp == 0)
weston_touch_set_focus(grab->touch, NULL);
pt->pending_focus_touch_reset = false;
}
break;
case WESTON_TOUCH_MODE_CALIB:
case WESTON_TOUCH_MODE_PREP_NORMAL:
@ -3656,8 +3713,8 @@ enable_pointer_constraint(struct weston_pointer_constraint *constraint,
constraint->view = view;
pointer_constraint_notify_activated(constraint);
weston_pointer_start_grab(constraint->pointer, &constraint->grab);
wl_list_remove(&constraint->surface_destroy_listener.link);
wl_list_init(&constraint->surface_destroy_listener.link);
wl_signal_add(&constraint->view->unmap_signal,
&constraint->view_unmap_listener);
}
static bool
@ -3672,6 +3729,8 @@ weston_pointer_constraint_disable(struct weston_pointer_constraint *constraint)
constraint->view = NULL;
pointer_constraint_notify_deactivated(constraint);
weston_pointer_end_grab(constraint->grab.pointer);
wl_list_remove(&constraint->view_unmap_listener.link);
wl_list_init(&constraint->view_unmap_listener.link);
}
void
@ -3681,7 +3740,6 @@ weston_pointer_constraint_destroy(struct weston_pointer_constraint *constraint)
weston_pointer_constraint_disable(constraint);
wl_list_remove(&constraint->pointer_destroy_listener.link);
wl_list_remove(&constraint->surface_destroy_listener.link);
wl_list_remove(&constraint->surface_commit_listener.link);
wl_list_remove(&constraint->surface_activate_listener.link);
@ -3878,13 +3936,13 @@ pointer_constraint_pointer_destroyed(struct wl_listener *listener, void *data)
}
static void
pointer_constraint_surface_destroyed(struct wl_listener *listener, void *data)
pointer_constraint_view_unmapped(struct wl_listener *listener, void *data)
{
struct weston_pointer_constraint *constraint =
container_of(listener, struct weston_pointer_constraint,
surface_destroy_listener);
struct weston_pointer_constraint *constraint =
container_of(listener, struct weston_pointer_constraint,
view_unmap_listener);
weston_pointer_constraint_destroy(constraint);
disable_pointer_constraint(constraint);
}
static void
@ -3948,8 +4006,8 @@ weston_pointer_constraint_create(struct weston_surface *surface,
constraint->surface_activate_listener.notify =
pointer_constraint_surface_activate;
constraint->surface_destroy_listener.notify =
pointer_constraint_surface_destroyed;
constraint->view_unmap_listener.notify =
pointer_constraint_view_unmapped;
constraint->surface_commit_listener.notify =
pointer_constraint_surface_committed;
constraint->pointer_destroy_listener.notify =
@ -3959,8 +4017,6 @@ weston_pointer_constraint_create(struct weston_surface *surface,
&constraint->surface_activate_listener);
wl_signal_add(&pointer->destroy_signal,
&constraint->pointer_destroy_listener);
wl_signal_add(&surface->destroy_signal,
&constraint->surface_destroy_listener);
wl_signal_add(&surface->commit_signal,
&constraint->surface_commit_listener);
@ -4730,6 +4786,7 @@ maybe_warp_confined_pointer(struct weston_pointer_constraint *constraint)
pixman_region32_intersect(&confine_region,
&constraint->view->surface->input,
&constraint->region);
assert(pixman_region32_not_empty(&confine_region));
region_to_outline(&confine_region, &borders);
pixman_region32_fini(&confine_region);
@ -5059,6 +5116,8 @@ bind_input_timestamps_manager(struct wl_client *client, void *data,
int
weston_input_init(struct weston_compositor *compositor)
{
wl_list_init(&pending_touch_list);
if (!wl_global_create(compositor->wl_display,
&zwp_relative_pointer_manager_v1_interface, 1,
compositor, bind_relative_pointer_manager))

View File

@ -45,7 +45,8 @@
#include "wcap/wcap-decode.h"
struct screenshooter_frame_listener {
struct wl_listener listener;
struct wl_listener frame_listener;
struct wl_listener buffer_destroy_listener;
struct weston_buffer *buffer;
struct weston_output *output;
weston_screenshooter_done_func_t done;
@ -120,7 +121,8 @@ screenshooter_frame_notify(struct wl_listener *listener, void *data)
{
struct screenshooter_frame_listener *l =
container_of(listener,
struct screenshooter_frame_listener, listener);
struct screenshooter_frame_listener,
frame_listener);
struct weston_output *output = l->output;
struct weston_compositor *compositor = output->compositor;
const pixman_format_code_t pixman_format =
@ -130,6 +132,8 @@ screenshooter_frame_notify(struct wl_listener *listener, void *data)
weston_output_disable_planes_decr(output);
wl_list_remove(&listener->link);
wl_list_remove(&l->buffer_destroy_listener.link);
stride = l->buffer->width * (PIXMAN_FORMAT_BPP(pixman_format) / 8);
pixels = malloc(stride * l->buffer->height);
@ -177,6 +181,22 @@ screenshooter_frame_notify(struct wl_listener *listener, void *data)
free(l);
}
static void
buffer_destroy_handle(struct wl_listener *listener, void *data)
{
struct screenshooter_frame_listener *l =
container_of(listener,
struct screenshooter_frame_listener,
buffer_destroy_listener);
weston_output_disable_planes_decr(l->output);
wl_list_remove(&listener->link);
wl_list_remove(&l->frame_listener.link);
l->done(l->data, WESTON_SCREENSHOOTER_BAD_BUFFER);
free(l);
}
WL_EXPORT int
weston_screenshooter_shoot(struct weston_output *output,
struct weston_buffer *buffer,
@ -205,8 +225,13 @@ weston_screenshooter_shoot(struct weston_output *output,
l->output = output;
l->done = done;
l->data = data;
l->listener.notify = screenshooter_frame_notify;
wl_signal_add(&output->frame_signal, &l->listener);
l->frame_listener.notify = screenshooter_frame_notify;
wl_signal_add(&output->frame_signal, &l->frame_listener);
l->buffer_destroy_listener.notify = buffer_destroy_handle;
wl_signal_add(&buffer->destroy_signal, &l->buffer_destroy_listener);
weston_output_disable_planes_incr(output);
weston_output_schedule_repaint(output);

View File

@ -172,7 +172,7 @@ silenty clamped to the hardware driver supported range. This artificially
limits the driver chosen link bits-per-channel which may be useful for working
around sink hardware (e.g. monitor) limitations. The default is 16 which is
practically unlimited. If you need to work around hardware issues, try a lower
value like 8.
value like 8. A value of 0 means that the current max bpc will be reprogrammed.
.SS Section remote-output
.TP

View File

@ -1,6 +1,6 @@
project('weston',
'c',
version: '11.0.0',
version: '11.0.3',
default_options: [
'warning_level=3',
'c_std=gnu99',

View File

@ -149,6 +149,16 @@ lookup_pipewire_output(struct weston_output *base_output)
struct weston_pipewire *pipewire = weston_pipewire_get(c);
struct pipewire_output *output;
/* XXX: This could happen on the compositor shutdown path with our
* destroy listener being removed, and pipewire_output_destroy() being
* called as a virtual destructor.
*
* See https://gitlab.freedesktop.org/wayland/weston/-/issues/591 for
* an alternative to the shutdown sequence.
*/
if (!pipewire)
return NULL;
wl_list_for_each(output, &pipewire->output_list, link) {
if (output->output == base_output)
return output;
@ -310,6 +320,11 @@ pipewire_output_destroy(struct weston_output *base_output)
struct pipewire_output *output = lookup_pipewire_output(base_output);
struct weston_mode *mode, *next;
if (!output)
return;
weston_head_release(output->head);
wl_list_for_each_safe(mode, next, &base_output->mode_list, link) {
wl_list_remove(&mode->link);
free(mode);
@ -318,7 +333,6 @@ pipewire_output_destroy(struct weston_output *base_output)
pw_stream_destroy(output->stream);
wl_list_remove(&output->link);
weston_head_release(output->head);
free(output->head);
free(output);
}
@ -630,13 +644,19 @@ weston_pipewire_destroy(struct wl_listener *l, void *data)
{
struct weston_pipewire *pipewire =
wl_container_of(l, pipewire, destroy_listener);
struct pipewire_output *p_output, *p_output_next;
weston_log_scope_destroy(pipewire->debug);
pipewire->debug = NULL;
wl_list_for_each_safe(p_output, p_output_next, &pipewire->output_list, link)
pipewire_output_destroy(p_output->output);
wl_event_source_remove(pipewire->loop_source);
pw_loop_leave(pipewire->loop);
pw_loop_destroy(pipewire->loop);
free(pipewire);
}
static struct weston_pipewire *

View File

@ -512,6 +512,16 @@ lookup_remoted_output(struct weston_output *output)
struct weston_remoting *remoting = weston_remoting_get(c);
struct remoted_output *remoted_output;
/* XXX: This could happen on the compositor shutdown path with our
* destroy listener being removed, and remoting_output_destroy() being
* called as a virtual destructor.
*
* See https://gitlab.freedesktop.org/wayland/weston/-/issues/591 for
* an alternative to the shutdown sequence.
*/
if (!remoting)
return NULL;
wl_list_for_each(remoted_output, &remoting->output_list, link) {
if (remoted_output->output == output)
return remoted_output;
@ -636,6 +646,11 @@ remoting_output_destroy(struct weston_output *output)
struct remoted_output *remoted_output = lookup_remoted_output(output);
struct weston_mode *mode, *next;
if (!remoted_output)
return;
weston_head_release(remoted_output->head);
wl_list_for_each_safe(mode, next, &output->mode_list, link) {
wl_list_remove(&mode->link);
free(mode);
@ -650,7 +665,6 @@ remoting_output_destroy(struct weston_output *output)
free(remoted_output->gst_pipeline);
wl_list_remove(&remoted_output->link);
weston_head_release(remoted_output->head);
free(remoted_output->head);
free(remoted_output);
}

View File

@ -40,13 +40,14 @@ static inline void *
abort_oom_if_null(void *p)
{
static const char oommsg[] = ": out of memory\n";
size_t written __attribute__((unused));
if (p)
return p;
write(STDERR_FILENO, program_invocation_short_name,
strlen(program_invocation_short_name));
write(STDERR_FILENO, oommsg, strlen(oommsg));
written = write(STDERR_FILENO, program_invocation_short_name,
strlen(program_invocation_short_name));
written = write(STDERR_FILENO, oommsg, strlen(oommsg));
abort();
}

View File

@ -199,6 +199,9 @@ weston_wm_get_selection_targets(struct weston_wm *wm)
char *logstr;
size_t logsize;
if (!seat)
return;
cookie = xcb_get_property(wm->conn,
1, /* delete */
wm->selection_window,
@ -631,6 +634,9 @@ weston_wm_handle_xfixes_selection_notify(struct weston_wm *wm,
xfixes_selection_notify->owner);
if (xfixes_selection_notify->owner == XCB_WINDOW_NONE) {
if (!seat)
return 1;
if (wm->selection_owner != wm->selection_window) {
/* A real X client selection went away, not our
* proxy selection. Clear the wayland selection. */
@ -714,6 +720,8 @@ weston_wm_set_selection(struct wl_listener *listener, void *data)
wm->selection_window,
wm->atom.clipboard,
XCB_TIME_CURRENT_TIME);
xcb_flush(wm->conn);
}
void

View File

@ -2795,6 +2795,8 @@ send_configure(struct weston_surface *surface, int32_t width, int32_t height)
struct theme *t;
int new_width, new_height;
int vborder, hborder;
bool use_saved_dimensions = false;
bool use_current_dimensions = false;
if (!window || !window->wm)
return;
@ -2809,20 +2811,46 @@ send_configure(struct weston_surface *surface, int32_t width, int32_t height)
vborder = 0;
}
if (width > hborder)
new_width = width - hborder;
else
new_width = 1;
/* A config event with width == 0 or height == 0 is a hint to the client
* to choose its own dimensions. Since X11 clients don't support such
* hints we make a best guess here by trying to use the last saved
* dimensions or, as a fallback, the current dimensions. */
if (width == 0 || height == 0) {
use_saved_dimensions = window->saved_width > 0 &&
window->saved_height > 0;
use_current_dimensions = !use_saved_dimensions &&
window->width > 0 &&
window->height > 0;
}
if (height > vborder)
new_height = height - vborder;
else
new_height = 1;
/* The saved or current dimensions are the plain window content
* dimensions without the borders, so we can use them directly for
* new_width and new_height below. */
if (use_current_dimensions) {
new_width = window->width;
new_height = window->height;
} else if (use_saved_dimensions) {
new_width = window->saved_width;
new_height = window->saved_height;
} else {
new_width = (width > hborder) ? (width - hborder) : 1;
new_height = (height > vborder) ? (height - vborder) : 1;
}
if (window->width != new_width || window->height != new_height) {
window->width = new_width;
window->height = new_height;
/* Save the toplevel size so that we can pick up a reasonable
* value when the compositor tell us to choose a size. We are
* already saving the size before going fullscreen/maximized,
* but this covers the case in which our size is changed but we
* continue on a normal state. */
if (!weston_wm_window_is_maximized(window) && !window->fullscreen) {
window->saved_width = new_width;
window->saved_height = new_height;
}
if (window->frame) {
if (weston_wm_window_is_maximized(window))
frame_set_flag(window->frame, FRAME_FLAG_MAXIMIZED);
@ -2937,6 +2965,9 @@ weston_wm_window_is_positioned(struct weston_wm_window *window)
weston_log("XWM warning: win %d did not see map request\n",
window->id);
if (window->size_hints.flags & (USPosition | PPosition))
return true;
return window->map_request_x != 0 || window->map_request_y != 0;
}
@ -3017,7 +3048,9 @@ xserver_map_shell_surface(struct weston_wm_window *window,
} else if (window->override_redirect) {
xwayland_interface->set_xwayland(window->shsurf,
window->x, window->y);
} else if (window->transient_for && window->transient_for->surface) {
} else if (window->transient_for &&
!window->transient_for->override_redirect &&
window->transient_for->surface) {
parent = window->transient_for;
if (weston_wm_window_type_inactive(window)) {
xwayland_interface->set_transient(window->shsurf,