Commit graph

2792 commits

Author SHA1 Message Date
Simon Ser
a30c102163 output: drop gamma LUT from state
This has been superseded by color transforms.
2025-06-16 09:06:10 +00:00
Simon Ser
bfcb4211f6 wlr_gamma_control_v1: use color transforms 2025-06-16 09:06:10 +00:00
Simon Ser
97f6946c8d output: add color transform to state
Color transforms are better suited than raw gamma tables, because:

- They don't need to get copied around: they are ref'counted.
- They can represent more color operations (will be useful for the
  upcoming KMS color pipeline API, and for the Wayland color
  management protocol).
2025-06-16 09:06:10 +00:00
Simon Ser
c6133f9912 scene: send surface preferred transform alongside DMA-BUF feedback
wl_surface.preferred_buffer_transform is mainly useful to make
direct scan-out more likely. It shouldn't make a difference with
GL/Vulkan rendering.
2025-06-16 07:54:00 +00:00
Simon Ser
6204fc3278 scene: use output with highest refresh rate for frame pacing
If a surface is mirrored on two outputs, we don't want to pick the
first output if the second has a higher refresh rate.

Also fixes duplicate frame/feedback events when a surface is added
to multiple scenes.
2025-06-16 07:54:00 +00:00
Simon Ser
51d051497d scene: filter frame_done primary output in surface handler
This lets the surface handler decide which output to send frame
callbacks from. The output_sample event already works this way.

Introduce wlr_scene_surface_send_frame_done() as a replacement for
wlr_scene_buffer_send_frame_done() when a compositor doesn't have
an output at hand.
2025-06-16 07:54:00 +00:00
Simon Ser
8713ac72fb scene: configure clients with the highest output scale
If a surface appears on two outputs with the same intersection
area, or even if a surface appears on an output with a small
intersection area, we want to use the highest scale.

Fixes flip-flop when a surface is added to multiple scenes.

References: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3901
2025-06-16 07:54:00 +00:00
Simon Ser
95b2771bfd scene: ignore outputs with too small intersection with nodes
If a node has a very small intersection with an output, there's no
point in trying to adapt the node's rendering to that output.
2025-06-16 07:54:00 +00:00
Simon Ser
da820070f4 ext_image_capture_source_v1: add helper to capture scene nodes 2025-06-16 07:54:00 +00:00
Simon Ser
b066fd6b5a ext_image_capture_source_v1: add support for foreign toplevels 2025-06-16 07:54:00 +00:00
Simon Ser
37992cf3b8 idle_notify_v1: drop trailing spaces 2025-06-15 12:25:36 +00:00
Kirill Primak
afe427d149 xdg-shell: add support for v7 2025-06-05 16:25:25 +00:00
Kirill Primak
af43d3b9e7 cursor-shape-v1: bump to version 2 2025-05-22 20:35:30 +03:00
Kirill Primak
aaeffe9769 cursor-shape-v1: use generated enum validator 2025-05-22 20:35:15 +03:00
Guido Günther
2d5492c737 text-input-v3: Use NULL when emitting signals
Listeners can use `wl_container_of`.

Helps: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3851

Signed-off-by: Guido Günther <agx@sigxcpu.org>
2025-05-15 13:36:58 +00:00
Guido Günther
536100488f text-input-v3: Name new text input event correctly
Helps: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3851

Signed-off-by: Guido Günther <agx@sigxcpu.org>
2025-05-15 13:36:58 +00:00
Martin Rys
62c86fb975 Add support for XKB_LED_NAME_COMPOSE and XKB_LED_NAME_KANA USB HID LEDs
Requires xkbcommon 1.8.0
2025-05-15 09:14:48 +00:00
Simon Ser
c2327248f8 output: don't send make/model
- These are legacy wl_output properties [1]
- wl_output exposes name and description, which are better defined
- It's not clear what make/model/serial are for a virtual output
- Clients shouldn't rely on these fields

[1]: 8f1795f911/protocol/wayland.xml (L2508)

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/1623
2025-05-15 09:04:33 +00:00
David Turner
c9f0dbc159 Change all timespec pointers in events to owned
Follow-up from !4803.  Make things consistent by making all `struct
timespec`s in events owned.  Reduces the need for thinking about
ownership/lifetimes.
2025-05-15 08:59:56 +00:00
Kenny Levinsen
aef4de2ced wlr-foreign-toplevel-management-v1: Simply leave and destroy code
We send the output_leave event and destroy a toplevel_output both if our
output_leave listener is called, or if the underlying wlr_output is
destroyed.

We somewhat clumsily reused the output_leave listener, which meant that
even though we had the toplevel output, we went out of our way to let
the output_leave handler find said toplevel_output again.

Simplify both pathways by adding a toplevel_output_leave function.
Should have no functional changes.
2025-05-06 00:45:09 +02:00
Isaac Freund
80f33cd350 presentation-time: make version a uint32_t
This is consistent with wlr_xdg_shell_create(), wlr_shm_create(),
wlr_layer_shell_create(), etc.
2025-04-27 20:42:57 +00:00
Isaac Freund
7dd8fdf76c tablet-v2: cleanup focused surface on tool destroy
Currently the surface_destroy listener may not get removed if
destroy_tablet_tool_v2() is called while the tool is in proximity to a
surface.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3969
Reported-by: Hooman Ise
2025-04-27 16:57:50 +00:00
tokyo4j
86976870bd wlr_keyboard_group: fix leak of wlr_keyboard_group->keys
If the underlying wlr_keyboard emits duplicated key-presses,
wlr_keyboard_group->keys might not be empty even after calling
wlr_keyboard_group_remove_keyboard() for all of the keyboards.
2025-04-25 03:23:26 +09:00
tokyo4j
bd8454d3bc Revert "wlr_keyboard: don't emit key event for duplicated keycodes"
This reverts commit 86eaa44a3a.

That commit caused a regression for IME users in many compositors:
when a input_method is activated while a key is pressed, and a virtual
keyboard is created by IME, the following key-release event via the
virtual keyboard is missed since the key in the virtual keyboard haven't
been pressed. For example, pressing and releasing Ctrl+F in Firefox with
fcitx5 running triggered repeated keys (ffffff...) in the opened input
box.
2025-04-25 03:23:21 +09:00
Kirill Primak
7bf669fb5c xdg-surface: fix geom for surfaces that don't set it explicitly
If a surface which relies on the default window geometry (e.g. wlroots'
Wayland backend output) gets resized, the geometry doesn't get updated.
This commit fixes that. Additionally, the fallback is the explicitly
set window geometry now, not the extents; this works better for
Chromium.
2025-04-19 16:42:56 +03:00
M Stoeckl
8dab5f838d color-management-v1: implement surface_feedback_v1::get_preferred_parametric 2025-04-19 08:20:37 -04:00
Kirill Primak
ed2406621a xdg-surface: don't disconnect clients for bad effective geom yet
Preferably, the geometry computation would've been done at the client
commit time, but this requires correct subsurface state management which
we don't have at the moment. The next best solution, which is computing
the geometry on server commit time, doesn't currently have a way to
prevent user commit handlers from firing, meaning that compositors might
get an invalid surface state. Additionally, Chromium and gtk-layer-shell
turned out to violate the protocol in this regard, so client
disconnection leads to really bad UX.

As such, complain via a log message instead, and ignore invalid
geometry, falling back to the bounding rectangle.
2025-04-17 15:17:31 +03:00
Kirill Primak
5fd43add1c Fix/cleanup includes a bit 2025-04-15 20:13:29 +03:00
Kenny Levinsen
4277d8cfdc scene: Fix scanout log to respect SCANOUT_SUCCESS
scene_entry_try_direct_scanout returns a tristate value, but the log
message was not updated to account for this.

Compare whether or not the state is specifically SCANOUT_SUCCESS for
logging purposes.

Fixes: c450991c4b
2025-04-14 20:36:09 +02:00
Kenny Levinsen
867960d6f4 compositor: Clean up surface current_outputs last
During surface resource cleanup, several signals will be emitted. If any
of these end up calling wlr_surface_send_enter, a new output could be
added to the current_outputs list. This would result in a leaked
surface_output and a dangling wlr_surface pointer.

Clean up current_outputs last.

References: https://github.com/swaywm/sway/issues/8650
2025-04-14 12:46:02 +02:00
Yixue Wang
d7527778bb wlr_client_buffer: add get_shm implementation 2025-04-13 20:48:59 +00:00
Kirill Primak
5dc73937ff xdg-surface: ensure that the effective geom is not empty
Fixes: 5c98d1a04a
2025-04-13 13:26:26 +03:00
Olivier Tilloy
1e7baefe96 seat/keyboard: optimize wlr_seat_set_keyboard to send the keymap only if it has changed 2025-04-11 16:56:36 +02:00
Kirill Primak
9c9bf2efee xdg-system-bell-v1: set proper global/resource user data
See https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3963.
2025-04-11 14:04:23 +00:00
David Turner
0bf0c55ad2 scene: Move single-pixel buffer things to scene_buffer
Move single-pixel buffer status cache from wlr_scene_surface to
wlr_scene_buffer, it makes more sense there and means the optimisations
will still work if wlr_scene_buffer is used without wlr_scene_surface.
2025-04-11 14:01:35 +00:00
Kenny Levinsen
c450991c4b wlr_scene: Debounce dmabuf feedback on scanout
Direct scanout can be enabled and disabled on a frame-by-frame basis,
and so we could end up sending different feedback to a surface on every
other frame. Reacting to new feedback is expensive, as the client may
need to reallocate their swapchain.

Debounce the state change a number of frames, for now set to 30, to
avoid immediate reaction to scanout (or composition) that only lasts a
few frames.

A timer could be used instead, but it did not seem worth the complexity.
What just want to know that the state has been stable across a
reasonable number of samples, and a counter seems sufficient for that.
2025-04-10 12:44:03 +00:00
David Turner
792bee9657 scene: Optimize rendering of single-pixel buffers
The single-pixel buffer protocol is used to allow wayland clients to
easily draw solid-color rectangles by presenting a 1x1-pixel buffer and
scaling it to the desired size.  This patch improves how these buffers
are then handled in the scene-tree renderer.

We already ignore opaque black rectangles at the very bottom (and
anything under them) because we assume we'll be rendering on a black
background.  This patch detects black opaque single-pixel buffers and
handles them in the same way as black opaque rectangles.  It also
renders single-pixel buffers as rectangles rather than buffers because
this is probably more efficient in the underlying renderer.

In wlr_scene_surface we cache whether the attached buffer is a
single-pixel buffer.  This is done because the
wlr_single_pixel_buffer_v1 will be destroyed after texture upload, after
which it becomes much more annoying to check if the buffer is a
single-pixel buffer.
2025-04-07 13:28:51 +01:00
David Turner
5563d23b81 single-pixel-buffer: Add try_from_buffer() function
Add wlr_single_pixel_buffer_v1_try_from_buffer() and move `struct
wlr_single_pixel_buffer_v1` to wlr_buffer.h. This allows other code to
find out if a wlr_buffer is a single-pixel buffer and, if so, find out
what color it is.
2025-04-07 13:25:42 +01:00
Kirill Primak
9c51424f8d ext-data-control: add missing listener list assertion 2025-04-06 10:13:40 +03:00
Kirill Primak
582f487b22 meson: add a missing src file 2025-04-01 11:41:56 +00:00
YaoBing Xiao
5f65b1194c ext_image_capture_source_v1: remove unused wlr_renderer include 2025-03-31 17:42:00 +08:00
Simon Ser
fa6cd856e3 color-management-v1: add setter for surface feedback 2025-03-30 16:31:44 +02:00
Simon Ser
95c85af87c color-management-v1: add support for mastering display metadata 2025-03-30 16:31:44 +02:00
Simon Ser
dcf38e3ea9 color-management-v1: add wlr_surface_get_image_description_v1_data() 2025-03-30 16:31:44 +02:00
Simon Ser
ab4ed32c06 color-management-v1: add support for parametric image desc creator 2025-03-30 16:31:37 +02:00
Simon Ser
6d4737a7f6 color-management-v1: add struct wlr_image_description_v1 2025-03-30 16:31:27 +02:00
Simon Ser
0ab3c1d060 color-management-v1: new protocol
This implements the bare minimum to expose the protocol interfaces.

References: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/14
2025-03-30 16:31:17 +02:00
Kirill Primak
9dbf5b9f6b fullscreen-shell: remove
The protocol implementation has been marked as deprecated in the
previous release.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3846
2025-03-30 01:15:09 +03:00
Simon Ser
128cd07e91 scene/surface: use source buffer to signal release timeline point
We were signaling the release timeline point when the
wlr_client_buffer was released. However, the wlr_client_buffer isn't
necessarily released at the same time as the underlying source
wlr_buffer. For instance, with wl_shm the source buffer is released
before the wlr_client_buffer, and with linux-dmabuf-v1 the source
buffer is released after the wlr_client_buffer. However, we want
to signal the release timeline point exactly at the same time we
send the wl_buffer.release event to the client.

Use surface->buffer->source instead of &surface->buffer->base to
fix this.

linux-drm-syncobj-v1 can only be used with DMA-BUFs, and
wlr_client_buffer.texture will keep the source locked, so
surface->buffer->source is guaranteed to be non-NULL and unreleased.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3940
Fixes: 9e71c88467 ("scene: unwrap wlr_client_buffer for direct scan-out")
2025-03-22 23:55:24 +00:00
liupeng
31f9d6bb97 screencopy-v1: drop output_enable listener 2025-03-10 15:33:46 +08:00