Commit graph

2732 commits

Author SHA1 Message Date
Simon Ser
83c5b15194 Remove all calls to pixman_region32_not_empty()
Replace them with pixman_region32_empty(), which avoids using a
double-negative when checking if a region is empty. Also use that
new function when checking for non-empty regions so that only one
variant of the Pixman API is used.
2025-01-29 23:37:06 +01:00
Simon Ser
639ca05d35 matrix: move to util/
wlr_matrix is not a standalone type like other headers in types/,
it's more of an internal utility. Move it to the appropriate place.
2025-01-27 17:48:18 +01:00
Alexander Orzechowski
82223e451a render/drm_syncobj: Add a callback when ready
The old approach of using a signal is fundamentally broken for a common
usecase: When the waiter is ready, it's common to immediately finish and
free any resources associated with it.
Because of the semantics of wl_signal_emit_mutable() this is UB.
wl_signal_emit_mutable() always excepts that the waiter hasn't been freed
until the signal has finished being emitted.

Instead of over engineering the solution, let's just add a callback required
by wlr_drm_syncobj_timeline_waiter_init(). In this callback, the implementation
is free to finish() or free() any resource it likes.
2025-01-26 18:02:05 -05:00
Simon Ser
211eb9d60e matrix: drop rotation
It's unused.
2025-01-26 17:56:04 +01:00
Simon Ser
7d1f535e49 matrix: drop wlr_matrix_transpose()
It's unused.
2025-01-26 17:52:39 +01:00
Simon Ser
9b55737cf5 Make wlr_matrix private API
36cc698bc5 ("matrix: deprecate") has deprecated wlr_matrix more
than one year ago. It's now time to drop it from our public API.
2025-01-26 17:46:50 +01:00
Guido Günther
1ee3ed4310 buffer: Make wlr_buffer_is_opaque public
It's useful for compositors.
2025-01-25 23:42:49 +01:00
Kirill Primak
b25f98d583 pointer-constraints: use wlr_surface_synced.commit hook
This fixes a problem where an outdated surface input region was used to
compute the effective confinement region.

Additionally, this commit fixes a bug in pointer_constraint_create()
which caused the initial region to not be applied immediately.

This is a breaking change: set_region is now emitted before the role
commit hook is called, and it's not emitted if the region hasn't
actually changed.
2025-01-17 16:30:34 +00:00
Kirill Primak
c3224d4160 compositor: add wlr_surface_synced commit hook 2025-01-17 16:30:34 +00:00
Kirill Primak
e3596abc9a pointer-constraints: fix deactivating oneshot constraint on destroy 2025-01-17 16:03:36 +00:00
Kirill Primak
8f56f7ca43 Assert (almost all) signals have no attached listeners on destroy 2025-01-15 19:53:11 +03:00
Kirill Primak
b03b05d2b3 xdg-dialog: add missing wm destroy signal 2025-01-15 19:51:05 +03:00
Kirill Primak
bcf8e467db xdg-toplevel-icon-v1: add implementation 2025-01-14 18:46:43 +00:00
Simon Ser
061aa1bd15 ext-image-copy-capture-v1: implement PAINT_CURSORS flag
This is unreliable because this is first come, first served: the
first capture stream decides whether or not cursors will be
included. Moreover, if the output lacks hw cursor support, cursors
will always be included. But it's the best we're going to get with
automatic wlr_output sources (and has bug parity with
wlr-screencopy-unstable-v1).
2025-01-14 16:42:12 +01:00
Simon Ser
6bb8bb1cb7 ext-image-capture-source-v1: add start/stop hooks
This allows the source to change its behavior when actively
captured.
2025-01-14 16:42:12 +01:00
Simon Ser
248e837cb3 ext-image-capture-source-v1: add output cursor source 2025-01-14 16:42:12 +01:00
Simon Ser
c0881bdc01 output: require commit after hardware cursor update
Up until now only the DRM backend required an output commit after
updating the cursor. Unify this for all backends, because:

- Screen capture can now catch cursor updates listening for output
  commits
- In the future we want to make the cursor a regular wlr_output_layer,
  which would need an output commit to be updated anyways
2025-01-14 16:42:12 +01:00
Simon Ser
08e14deeca ext-image-capture-source-v1: add output source 2025-01-14 16:42:12 +01:00
Simon Ser
855b3fd607 ext-image-capture-source-v1: add wlr_ext_image_capture_source_v1_set_constraints_from_swapchain() 2025-01-14 16:35:52 +01:00
Simon Ser
c24efad6df ext-image-copy-capture-v1: add wlr_ext_image_copy_capture_frame_v1_copy_buffer() 2025-01-14 16:35:52 +01:00
Simon Ser
4e4155ccbe ext-image-copy-capture-v1: new protocol implementation
Co-authored-by: Andri Yngvason <andri@yngvason.is>
2025-01-14 16:35:50 +01:00
Simon Ser
6712e774d4 ext-image-capture-source-v1: add source pointer cursors 2025-01-14 16:34:11 +01:00
Simon Ser
dadcbf65e6 ext-image-capture-source-v1: add base interface 2025-01-14 16:34:11 +01:00
llyyr
62ecec6d53 wlr_drag: cleanup icon_destroy listener when destroying icon 2025-01-11 20:20:10 +05:30
Kirill Primak
d5d650f9f6 output: introduce wlr_output_finish() 2025-01-08 16:06:12 +00:00
Kirill Primak
7963ba6a0d buffer: introduce wlr_buffer_finish() 2025-01-08 16:06:12 +00:00
Simon Ser
b908d865b1 backend: replace get_buffer_caps hook with a struct field
Do the same as wlr_renderer: the supported buffer capabilities are
static for the lifetime of the backend.
2024-12-25 18:40:05 +00:00
Kirill Primak
1c604207c6 seat: don't generate serial 0
0 is reserved to mean "no event has been sent to the client".
2024-12-22 21:33:11 +00:00
Kirill Primak
90530d43fe xdg-dialog-v1: add implementation 2024-12-22 20:46:19 +00:00
Consolatis
c6de47d415 wlr-foreign-toplevel: version guard fullscreen state 2024-12-21 01:20:53 +03:00
Consolatis
bd3724aa26 wlr-foreign-toplevel: convert to stack backed states array 2024-12-21 01:20:53 +03:00
Consolatis
648c64b7e4 wlr-foreign-toplevel: slight refactor 2024-12-21 01:19:17 +03:00
Simon Ser
776f2c4e4d output: adjust warning when hardware cursors are unsupported
We'd print "cursor texture size exceeds hardware limitations" when
some hardware doesn't support cursors at all. Change the message
to better indicate the cause.
2024-12-20 10:39:42 +00:00
M Stoeckl
b97106ddcb wlr_cursor: use default shape if requested shape missing 2024-12-16 15:34:45 +00:00
Simon Ser
71943b3b1e data-device: reset focused surface when destroyed
The surface may be destroyed before the struct wlr_seat_client.

Spotted by Consolatis.
2024-12-11 07:15:02 +00:00
tokyo4j
e21899037a wlr_keyboard: don't emit key event for duplicated keycodes
This fixes the memory leak in wlr_keyboard_group.keys. The leak happened
because wlr_keyboard.keycodes never contains duplicated keycodes while
wlr_keyboard_group.keys can, so calling wlr_keyboard_finish() for all
the wlr_keyboards in wlr_keyboard_group doesn't always free all the keys
in wlr_keyboard_group.keys.
2024-11-28 16:24:57 +00:00
Kirill Primak
c0d4d7217b Add missing destroy events on automatically destroyed objects 2024-11-26 17:49:22 +00:00
Simon Ser
b2c3c371fc scene: assert on bad wlr_scene_buffer params
We assert in wlr_renderer if these are invalid. Assert earlier to
make debugging easier.
2024-11-22 18:49:50 +00:00
Alexander Orzechowski
0d6cc471e9 scene: Assert all signals are clear when destroying 2024-11-22 09:55:51 -05:00
Kirill Primak
0b720ae5ea seat: drop last_event 2024-11-12 08:28:50 +00:00
Simon Ser
2c3053370c output-management-v1: only create custom mode object for enabled heads
We were always creating a custom mode object when the output didn't
have a fixed mode. This is important to handle two cases:

- Virtual outputs with no concept of fixed modes.
- DRM outputs with a list of fixed modes but with a custom mode set.

However, in the case where an output didn't have a fixed mode and
was disabled, we were also creating the custom mode object. Clients
would then see a "ghost" mode: a mode object with no properties at
all.

Fix this by only creating the custom mode object if the output is
enabled.

Fixes: 5de9e1a99d ("wlr-output-management: Send custom modes to clients")
Closes: https://github.com/swaywm/sway/issues/8420
2024-11-11 19:18:32 +00:00
Kenny Levinsen
c3acef0dc0 scene: Only unwrap client buffer when underlying buffer is held
Client buffers backed by wl_shm is aggressively released, in which case
we are not allowed to access it. Locking an already released buffer and
later unlocking it will also re-trigger release, confusing clients.

As a quick workaround, guard the unwrap by checking if the buffer is
locked, which will be the case for non-wl_shm buffers.
2024-11-10 00:22:17 +01:00
Simon Ser
4ec1defb3e all: use public <wlr/render/allocator.h>
We don't need to use the private header in these files.
2024-11-07 18:48:20 +01:00
Simon Ser
9e71c88467 scene: unwrap wlr_client_buffer for direct scan-out
Passing the wlr_client_buffer directly has a downsides because a
fresh wlr_buffer pointer is passed each output commit instead of
cycling through existing wlr_buffer objects:

- The FDs are re-imported each time in the backend.
- Any import failure is logged every output commit [1].
- The Wayland backend cannot handle import failures without
  roundtripping each output commit [2].

Instead, extract the source buffer from the wlr_client_buffer and
pass that to the backend.

[1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4836
[2]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4841
2024-11-07 14:17:35 +00:00
xurui
3f314bc183 output-power-management-v1: use enum_is_valid functions
Signed-off-by: xurui <xurui@kylinos.cn>
2024-11-07 10:20:03 +00:00
xurui
38fc4f2976 wlr_output_management_v1: use enum_is_valid functions
Signed-off-by: xurui <xurui@kylinos.cn>
2024-11-07 10:20:03 +00:00
xurui
81fa6c4b96 wlr_linux_dmabuf_v1: use enum_is_valid functions
Signed-off-by: xurui <xurui@kylinos.cn>
2024-11-07 10:20:03 +00:00
xurui
cda6fdffac layer-shell-v1: use enum_is_valid functions
Signed-off-by: xurui <xurui@kylinos.cn>
2024-11-07 10:20:03 +00:00
Kenny Levinsen
d6b47c3ab0 wlr_keyboard_group: Use get_current_time_msec 2024-11-07 10:22:10 +01:00
Kenny Levinsen
8bb6935374 tablet-v2: Event time should be milliseconds
The event time used for zwp_tablet_pad_group_v2_send_mode_switch was
tv_nsec / 1000, which is microseconds resetting every whole second.

Use get_current_time_msec to get milliseconds including whole seconds.
2024-11-07 10:09:36 +01:00