Commit graph

7712 commits

Author SHA1 Message Date
Steve Williams
8b7bf2b384 Merge branch 'fix_layout_color_assert' into 'master'
fix color_range assertion when wlr_color_representation_v1 is used

See merge request wlroots/wlroots!5242
2026-01-20 08:45:34 +00:00
xurui
91c08d5a53 xwayland/selection/dnd: fix parameter type
Signed-off-by: xurui <xurui@kylinos.cn>
2026-01-20 16:39:08 +08:00
Jens Peters
3eb07b1fdb backend/libinput: expose libinput_tablet_tool
Exposing libinput_tablet_tool from libinput allows compositors
to set tool specific configuration options like pressure range
and eraser button behavior.

See 'libinput_tablet_tool_*()' functions which require a
'libinput_tablet_tool' handle:
https://wayland.freedesktop.org/libinput/doc/1.30.0/api/group__config.html
(libinput 1.30.0, latest at the time of writing).
2026-01-19 20:45:39 +01:00
Stephane Fontaine
9fcbe33533 fix color_range assertion when wlr_color_representation_v1 is used 2026-01-19 21:11:29 +04:00
Stephane Fontaine
b7312b4f95 xwm: don't leak msg in case of realloc failure 2026-01-18 17:42:25 +04:00
Isaac Freund
f735439543
xwayland: add set_size_hints signal
Currently there is no way for the compositor to be notified when an
Xwayland client sets/modifies its size hints.
2026-01-15 11:49:49 +01:00
Robin Ebert
ba76d37b0b
wlr_ext_image_copy_capture_v1: Fix segmentation fault when using cursor session
Fixes: 3b9f599cbe
2026-01-12 12:40:34 +01:00
Alexander Orzechowski
1f0fb95e3b wlr_scene: Add documentation to scene_node_update() 2026-01-08 13:03:46 -05:00
Alexander Orzechowski
ed7b633669 wlr_scene: Only do disable cleanup when explicit damage is given
We don't want to iterate the subtree for trivial update scenarios. We only
care when a scene is reparented or disabled in which both cases provides
us with explicit damage
2026-01-08 13:03:46 -05:00
Alexander Orzechowski
ef19f52ca9 wlr_scene: Update outputs when node is disabled 2026-01-08 13:03:46 -05:00
Alexander Orzechowski
56eb27ab0b wlr_scene: Don't recurse when disabling scene node if a child is already disabled
If a child is disabled, that means the node already went through the
rigamarole of cleaning up its state. Don't do it again.
2026-01-08 13:03:46 -05:00
Alexander Orzechowski
edc12e81d9 wlr_scene: Make restack_xwayland_surface_below generic
more stuff will be put here
2026-01-08 13:03:46 -05:00
Peter Kaplan
49576469ec image_capture_source: wlr_output_try_from_ext_image_capture_source_v1() 2026-01-07 09:18:25 +01:00
Peter Kaplan
3b9f599cbe wlr_ext_image_copy_capture_v1: new_session event
And a destroy event in wlr_ext_image_copy_capture_session_v1.
2026-01-07 09:18:25 +01:00
Simon Ser
368dcfb9f6 ext_image_capture_source_v1: wait for capture client before sending frame event
We were sending an output frame event as soon as we were done
rendering. As a result, the output would render in a busy loop when
a client was using the capture output for frame pacing purposes.

Instead, use the request_frame hook introduced in the previous
commit to throttle output frame events.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/4036
2026-01-05 15:03:18 -05:00
Simon Ser
f93865ed1f ext_image_copy_capture_v1: replace schedule_frame with request_frame
schedule_frame is only called when the client has submitted damage
and a new frame should be rendered immediately. schedule_frame is
not called when the capture client is waiting for the next frame
but hasn't submitted damage.

Sources implementing a rendering loop based on the capture rate
need to know when a capture client is ready to accept a new frame.
Such sources want to trigger a redraw if and only if (1) they are
dirty (their contents have changed) and (2) the capture client is
ready to accept a new frame.

Replace schedule_frame with request_frame, triggered each time a
client sends a capture request. A flag indicates whether the capture
client has submitted damage.
2026-01-05 15:03:18 -05:00
llyyr
6ae54dca23 xwayland: lock new buffer instead of the old one
Fixes: 84d603acc0
2026-01-05 20:53:34 +05:30
Simon Ser
84d603acc0 xwayland: take wlr_buffer in wlr_xwayland_set_cursor() 2026-01-05 10:10:32 -05:00
Simon Ser
53d75a41c7 cursor: use wlr_xcursor_image_get_buffer() 2026-01-05 10:10:32 -05:00
Simon Ser
d7f7b68f49 xcursor: introduce wlr_xcursor_image_get_buffer()
This makes it so callers no longer need to juggle with raw pixel
pointers anymore, and only need a single wlr_buffer-based codepath.

Additionally, cursors can be unloaded without risking use-after-free.
2026-01-05 10:10:32 -05:00
Simon Ser
98733c91b4 xcursor: add shared helper to create a wlr_xcursor_image
This logic was duplicated in two spots.
2026-01-05 10:10:32 -05:00
Simon Ser
89c9ef6692 render/gles2: skip glslang check when shaders are unchanged
Currently, the glslang check is run every time ninja is invoked,
even with an up-to-date build directory when GLSL shaders haven't
been modified. This is due to glslang not creating any output
file: the _check file never exists so ninja keeps trying to
generate it by running the command.

Unfortunately Meson doesn't support running commands with no
outputs [1]. Create an empty output file to fix this by setting
`capture: true`.

This doesn't work out-of-the-box, because glslang prints messages
to stdout, and provides no way to change this [2]. As a result,
shader errors are not surfaced back to the user - they end up in
the _check file. Workaround this with a thin wrapper which
redirects stdout to stderr when invoking glslang.

[1]: https://github.com/mesonbuild/meson/issues/11506
[2]: https://github.com/KhronosGroup/glslang/pull/4138
2026-01-05 09:59:58 -05:00
Simon Ser
2c64b30a67 scene: add knob to turn off Xwayland surface restacking
This is useful in these cases:

- The same surface is added to two different scene-graphs. wlroots
  can't figure out on its own which scene-graph should drive the
  Xwayland stacking.
- A compositor uses multiple Xwayland servers (e.g. one per app).
  wlroots will try to restack surfaces from different Xwayland
  instances and this will not go well.
2026-01-04 16:02:52 +00:00
Simon Ser
b094f8aeb3 scene/surface: don't cache frame pacing output
Storing the frame pacing output in a per-scene and per-surface
struct doesn't play well with multiple scenes. outputs_update is
only triggered for outputs the scene knows about, but operates on
all outputs the surface has entered regardless of the scene. Thus
leaving an output on one scene will not refresh the frame pacing
output on other scenes, and these other scenes will operate with
a stale frame pacing output. The surface will not receive any more
wl_surface.frame done events.

This also avoids keeping a dangling pointer around when the frame
pacing output is destroyed but the output isn't added in the scene.

References: https://github.com/swaywm/sway/issues/8885
2026-01-04 14:40:18 +01:00
Simon Ser
2699b68b34 ext_image_capture_source_v1/scene: fix stop for parallel captures
The stop handler disables the output. However, the same source can
be captured multiple times in parallel. In that case, stop might
be called while another capture session is still ongoing.

Only disable the output if the last session is stopped.
2026-01-04 00:34:39 +00:00
Simon Ser
caed9d78d7 render: drop <linux/dma-buf.h> compat defines
It's been 3 years, so these defines are widespread enough by now.
2026-01-04 00:30:34 +00:00
Simon Ser
3f9a164484 scene: keep last preferred configuration when leaving last output
Before this patch, when a surface became occluded on all outputs,
we'd reconfigure it with a base configuration (scale set to 1,
transform set to NORMAL, image description set to gamma 2.2/sRGB).
As a result, when quickly hiding a toplevel and showing it again,
the client would render to switch to the base configuration, then
render again to switch to the output configuration.

Avoi this needless back-and-forth by retaining the last sent
preferred configuration when a surface leaves all outputs.
2026-01-04 00:24:47 +00:00
Simon Ser
ca8b49d858 render/vulkan: add new 16- and 32-bits-per-component pixel formats
Compatibility table based on pixfmtdb.
2026-01-03 17:47:19 +00:00
Simon Ser
1723f851d2 render/gles2: add BGR161616F and BGR161616 2026-01-03 17:47:19 +00:00
Simon Ser
d512c00791 render: add new 16- and 32-bits-per-component pixel formats
These new formats have been introduced in libdrm 2.4.129:
31e68ea81c
2026-01-03 17:47:19 +00:00
Simon Ser
53cdceb371 scene: constify pixman_region32_t
Makes it easier to figure out which functions build regions, and
which functions consume them.
2025-12-28 22:56:55 +01:00
Simon Ser
8611aa8440 scene: don't assign outputs to invisible nodes
If a node has no visible areas, leave active_outputs empty.

Fixes: 95b2771bfd ("scene: ignore outputs with too small intersection with nodes")
2025-12-28 22:30:25 +01:00
sunzhguy
9119b8aa85 session: simplify libudev unref handling
Signed-off-by: sunzhguy <sunzhigang1@kylinos.cn>
2025-12-22 10:55:08 +08:00
John Lindgren
16cb509a6e render/allocator: add missing wlr_buffer_finish() in destroy impls
Fixes use-after-free on exit of labwc running nested:

==50906== Invalid write of size 8
==50906==    at 0x4A85403: wl_list_remove (wayland-util.c:57)
==50906==    by 0x40BBAF9: destroy_wl_buffer (output.c:146)
==50906==    by 0x40B9B4F: backend_destroy (backend.c:488)
==50906==    by 0x409E96F: wlr_backend_destroy (backend.c:68)
==50906==    by 0x40B78A6: multi_backend_destroy (backend.c:62)
==50906==    by 0x409E96F: wlr_backend_destroy (backend.c:68)
==50906==    by 0x4043DA0: server_finish (server.c:788)
==50906==    by 0x403AA85: main (main.c:277)
==50906==  Address 0xb4435e8 is 40 bytes inside a block of size 136 free'd
==50906==    at 0x4A3E8EF: free (vg_replace_malloc.c:989)
==50906==    by 0x409C954: buffer_destroy (shm.c:28)
==50906==    by 0x40E96F4: buffer_consider_destroy (buffer.c:42)
==50906==    by 0x40E9754: wlr_buffer_drop (buffer.c:52)
==50906==    by 0x41498DA: slot_reset (swapchain.c:44)
==50906==    by 0x4149933: wlr_swapchain_destroy (swapchain.c:53)
==50906==    by 0x40CB1FA: wlr_output_finish (output.c:410)
==50906==    by 0x40BE00B: output_destroy (output.c:957)
==50906==    by 0x40CB2FC: wlr_output_destroy (output.c:436)
==50906==    by 0x40B9AFC: backend_destroy (backend.c:481)
==50906==    by 0x409E96F: wlr_backend_destroy (backend.c:68)
==50906==    by 0x40B78A6: multi_backend_destroy (backend.c:62)
==50906==  Block was alloc'd at
==50906==    at 0x4A42C13: calloc (vg_replace_malloc.c:1675)
==50906==    by 0x409CA84: allocator_create_buffer (shm.c:68)
==50906==    by 0x409C7BA: wlr_allocator_create_buffer (allocator.c:186)
==50906==    by 0x4149B80: wlr_swapchain_acquire (swapchain.c:102)
==50906==    by 0x40C90DA: render_cursor_buffer (cursor.c:246)
==50906==    by 0x40C93DC: output_cursor_attempt_hardware (cursor.c:303)
==50906==    by 0x40C9A61: output_cursor_set_texture (cursor.c:420)
==50906==    by 0x40C9738: wlr_output_cursor_set_buffer (cursor.c:352)
==50906==    by 0x40F13A0: output_cursor_set_xcursor_image (wlr_cursor.c:507)
==50906==    by 0x40F1B28: cursor_output_cursor_update (wlr_cursor.c:630)
==50906==    by 0x40F1C2A: cursor_update_outputs (wlr_cursor.c:657)
==50906==    by 0x40F1CF9: wlr_cursor_set_xcursor (wlr_cursor.c:674)

Fixes: 7963ba6a0d
("buffer: introduce wlr_buffer_finish()")
2025-12-20 15:02:08 -05:00
liupeng
0ad8395ae6 backend/session: respond to event hangup or error
Signed-off-by: liupeng <liupeng01@kylinos.cn>
2025-12-19 10:38:26 +00:00
Félix Poisot
450d90a55d render/color: assert that wlr_color_transform_pipeline contains no NULLs
Consumers of transform pipelines are not expected to handle no-op
stages
2025-12-18 14:58:28 +00:00
Félix Poisot
32d5fc1d11 render/color: introduce color_transform_compose
It flattens color transform pipelines, and facilitates building
pipelines of variable content
2025-12-18 14:58:28 +00:00
Simon Ser
3d8c471aef color_management_v1: add BT.1886 to TF-from-renderer helper
BT.1886 support has been added to wlroots after this helper got
written.
2025-12-18 09:54:27 -05:00
Simon Ser
c0b93a9e7c render/pixman: add support for ABGR16161616
PIXMAN_a16b16g16r16 has been added in Pixman in this commit:
c0d38585f1
2025-12-18 09:48:02 -05:00
Simon Ser
322291cdcf tinywl: fix duplicate object files passed to linker
On BSD make, $> is an alias for $^. On both GNU and BSD make, $^
is supported. Specifying both resulted in duplicate object files
passed to the linker:

    ld: error: duplicate symbol: main
    >>> defined at tinywl.c:887
    >>>            tinywl.o:(main)
    >>> defined at tinywl.c:887
    >>>            tinywl.o:(.text+0x0)
    cc: error: linker command failed with exit code 1 (use -v to see invocation)

Only use $^ and remove $>.
2025-12-18 15:22:33 +01:00
Simon Ser
9b4d9eabb1 color_management_v1: add helpers to get supported TFs/primaries
This avoids hardcoding lists of TFs/primaries in compositors.

I've considered adding wlr_color_manager_v1_create_with_renderer()
instead, but I'm worried that some aspects of the options struct
don't really depend on the renderer, but on the compositor. Such
things are features and render intents.

I've considered returning a const array, but this would tie our
hands if we want to make the renderer advertise the set of
TFs/primaries it supports, instead of having a single flag gating
all of them.
2025-12-15 11:07:26 -05:00
tokyo4j
ba931024a5 Add wlr_version_get_{major,minor,micro}()
Can be used to detect wlroots version at runtime rather than
compile-time.
2025-12-13 11:06:28 +00:00
Ilia Bozhinov
0e9c6ddefa seat: add wlr_seat_touch_notify_clear_focus
This is needed for cases where the touch operation goes over a region
where no surfaces are present. In this case, we'd want to notify the
touch grabs (for example DnD grabs) that no focus is currently focused.
2025-12-11 21:10:59 +00:00
Ilia Bozhinov
03b465f324 drag: destroy data source on touch_up
This is in case we drop the drag with no focus, we want to destroy the
drag to tell the client the drag was cancelled.
2025-12-11 21:10:59 +00:00
llyyr
bf9452433c render/vulkan: normalize luminance range in bt.1886 formula
BT.1886 is different from other EOTFs in that the spec says that offset
b must be in electrical domain, so use the assumed display environment
from the specification as Lmin and Lmax then normalize bt.1886 to
produce optical luminance L in [0, 1]. See discussion at
https://gitlab.freedesktop.org/pq/color-and-hdr/-/merge_requests/63#note_3090016
2025-12-11 21:04:41 +00:00
Félix Poisot
a962d58727 render/color: make wlr_color_primaries_from_named public 2025-12-05 19:14:49 +00:00
llyyr
c45b3b1f5f color_representation_v1: don't leak supported_* on display destroy 2025-12-04 15:27:22 +05:30
Dale Turner
47486545b1 Add "const" to eliminate "error: initialization discards ‘const’ qualifier from pointer target type" 2025-12-03 20:02:29 -04:00
tokyo4j
abf80b529e wlr-foreign-toplevel: avoid wl_resource_find_for_client()
If the client application is composed of multiple components and they
bind the manager global separately, choosing a single toplevel resource
with wl_resource_find_for_client() may result in a component only seeing
unknown toplevel handles from another component.

Maybe we should track which toplevel handle resource originate from
which manager resource so that a component never sees toplevel handles
resources from another component, but it's too annoying to implement.
2025-11-25 18:54:20 +00:00
Félix Poisot
811765ffa0 output: don't rebuild cursor color transform for each update 2025-11-24 23:26:14 +00:00