Commit graph

2459 commits

Author SHA1 Message Date
Kirill Primak
388af6a62b xdg-popup: validate positioner on reposition request
(cherry picked from commit 1e58e4006d)
2024-06-11 09:34:05 -04:00
Kirill Primak
9915b1c3ee xdg-popup: don't emit parent's new_popup signal too early
(cherry picked from commit e7deea44fd)
2024-06-11 09:27:38 -04:00
JiDe Zhang
d4ff45ec8d output: reset hardware_cursor on failure
The DRM backend's set_cursor function always return true if the
buffer is NULL. If using a NULL cursor's buffer on startup, the
wlr_output_cursor will be marked as a hardware cursor. If the
cursor later gains a non-NULL buffer and the DRM backend rejects
that buffer, the cursor will remain marked as a hardware cursor,
despite the backend not displaying it as such. As a result, the
cursor will not be displayed at all. Fix this by always resetting
the hardware_cursor field in output_cursor_attempt_hardware().

(cherry picked from commit 36c0d5fe3a)
2024-06-11 13:21:05 +00:00
Kirill Primak
9fa8867c16 output: disable hardware cursor when falling back to software
(cherry picked from commit 510664e79b)
2024-06-11 13:21:05 +00:00
Kirill Primak
13a2020334 output: extract hardware cursor disabling logic
(cherry picked from commit f534434be6)
2024-06-11 13:21:05 +00:00
Kirill Primak
a1b3be49c5 xdg-toplevel: allow edge_none for resizing
(cherry picked from commit 9c50cd71b6)
2024-06-11 13:21:05 +00:00
groveer
136c1b281a wlr_pointer_gestures_v1: emit destroy signal in destroy function
(cherry picked from commit 293b0aa502)
2024-06-11 13:21:05 +00:00
groveer
8c0d194539 wlr_pointer_gestures_v1: init destroy signal
(cherry picked from commit dead0ebcc8)
2024-06-11 13:21:05 +00:00
Kirill Primak
9d6b95a5a8 scene: fix double scaling of opaque region for blend mode optimization
(cherry picked from commit 8fdf9dc4f0)
2024-06-11 13:21:05 +00:00
Alexander Orzechowski
365b3d271a wlr_scene: Schedule new frame for WLR_SCENE_DEBUG_DAMAGE_HIGHLIGHT in output commit handler
We were doing it too early before and the output would disregard a
scheduled frame if called when we were first putting together the output
state

(cherry picked from commit 1dc44a1afe)
2024-04-26 13:44:29 -04:00
Isaac Freund
545a294532 scene: ensure layer surface usable area >0
Clients may, for example, commit an exclusive zone larger than the
output dimensions. Compositors must handle this gracefully, which likely
requires more work on the compositor side but returning a usable area
with negative width or height in wlr_scene_layer_surface_v1_configure()
is nonsensical.

(cherry picked from commit cb01c63a8d)
2024-04-22 10:35:28 -04:00
Kenny Levinsen
f6efdc2be1 wlr_gamma_control: Store gamma size when creating control
When a wlr_gamma_control client calls set_gamma, we allocate a LUT based
on the value returned from wlr_output_get_gamma_size at the time of the
call.

If the output is off and has no CRTC, such as if gamma changes in the
background while a display is disabled for idle reasons,
wlr_output_get_gamma_size returns 0. This leads to a zero-sized table,
which the drm backend interprets as a request to reset gamma tables to
their default.

Store the gamma size when the gamma control was created. Even if the
size changes, this is the size the client was sent and uses to create
the LUTs it sends.

(cherry picked from commit f0ce906b73)
2024-04-12 09:34:55 -04:00
Kirill Primak
0f040dfc38 viewporter: fix "has buffer" check
Previously, cases when a viewport source box was updated without attaching
a buffer weren't checked for correctness properly because the state's buffer
would be NULL. Use wlr_surface_state_has_buffer() instead.

(cherry picked from commit 072f6ed977)
2024-04-12 09:34:55 -04:00
Isaac Freund
19aaaff429 tablet_v2: destroy tablet seats on manager destroy
This fixes an invalid write in tablet_seat_destroy if the tablet manager
is destroyed before the wlr_seat.

(cherry picked from commit 5bef385ffc)
2024-04-12 09:34:55 -04:00
Simon Ser
63e2f2e28f cursor-shape-v1: handle inert tablet tool client
If the tablet tool is inert, the wlr_tablet_tool_client_v2 can be
NULL.

(cherry picked from commit 31c842e5ec)
2024-03-04 13:09:14 -05:00
Kirill Primak
c9909ac54c pointer-constraints: handle inert pointer resources correctly
(cherry picked from commit cb815e8847)
2024-02-06 21:01:37 -05:00
Kirill Primak
9a9540aa8c cursor: fix and simplify region mapping
Fixes: 4462f5dcb3
(cherry picked from commit 56cc25185d)
2024-02-01 09:44:15 -05:00
Kirill Primak
82278edf3c layer-shell: forbid set_size with values ≥INT32_MAX
(cherry picked from commit be1c48cbfb)
2024-01-24 09:27:34 -05:00
Simon Ser
7824b31195 output-layout: fix missing global for outputs with a custom mode
Before we were populating wlr_output.current_mode with a generated
fixed mode when a custom mode was committed in the DRM backend. But
that's no longer the case: now a custom mode behaves the same under
the DRM backend and other backends.

wlr_output_layout was still assuming that an output without a
current_mode was disabled. Fix that assumption.

Fixes: 5567aefb1c ("backend/drm: Don't add pollute fixed modes list with custom modes")
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3743
(cherry picked from commit 11e3c376e7)
2023-12-21 13:07:55 -05:00
pastel raschke
fc66ba68e3 input-method-v2: validate commit serial
(cherry picked from commit 3bf9000a52)
2023-12-18 10:22:00 -05:00
pastel raschke
9f1a31e7f3 input-method-v2: free current strings on commit
(cherry picked from commit 6ee5bd9eee)
2023-12-18 10:21:50 -05:00
Simon Ser
5c44678862 input-method-v2: drop unnecessary variable and cast
(cherry picked from commit 81f5607ad9)
2023-12-18 10:21:33 -05:00
Simon Ser
0e2bfd0329 cursor: fix initial cursor position for new outputs
The fresh new wlr_output_cursor is positioned at (0, 0).

Call wlr_output_cursor_move() after creating the wlr_output_cursor
to fix this.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3777
(cherry picked from commit 7ef62cc995)
2023-12-12 14:42:53 -05:00
Simon Ser
a577308276 cursor: send surface scale events
wlr_cursor is responsible for sending enter/leave events, but
doesn't send fractional-scale-v1 and wl_surface.preferred_buffer_scale
events. This is not an easy thing to do from a compositor, so let's
just do it in wlr_cursor itself.

(cherry picked from commit 78836298ef)
2023-12-04 10:53:41 -05:00
Simon Zeni
6d13d1814e types/output: emit destroy event before destroying global
(cherry picked from commit 5d639394f3)
2023-12-01 09:53:01 -05:00
Simon Ser
b05fef20ff viewporter: fix src buffer bounds check
The surface scale and transform are applied before the viewport.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3766
(cherry picked from commit 4fbe648faf)
2023-11-28 12:28:08 -05:00
Simon Ser
f070bab7db viewporter: listen to client_commit
The commit event fires too late: we're interested in checking the
values at wl_surface.commit time, not after.

(cherry picked from commit 7dcb045176)
2023-11-28 10:36:27 -05:00
Simon Ser
8f6625945e viewporter: rename state var in viewport_handle_surface_commit()
"current" is misleading, since we are using the pending state here.

(cherry picked from commit d1c88a22a3)
2023-11-28 10:36:22 -05:00
Simon Ser
fe6a432299 linux-dmabuf-v1: skip import check on split render/display SoCs
Unfortunately we have no way to get back the proper render node in
that case. This will be fixed with [1]: with that Mesa patch, the
wlr_renderer will return the proper render node and the existing
logic will work fine.

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

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3757
2023-11-20 19:54:16 +01:00
Alexander Orzechowski
515681503e screencopy: Use box size instead for shm copy
This doesn't change functionality, both the values are the same. Less
confusing to use the box size.
2023-11-20 11:33:11 -05:00
Alexander Orzechowski
7a22030071 screencopy: Move frame bounds sanity check into common code 2023-11-20 11:33:11 -05:00
Alexander Orzechowski
c8861a2865 screencopy: Define proper destination for dmabuf copy
Leaving this empty would have it filled in with the size of the source
texture, but we want the destination size.

Fixes: #3758
2023-11-20 11:33:10 -05:00
Alexander Orzechowski
303f23d7dd wlr_scene: Update outputs if subpixel status changes
This is important for buffers that are meant to render any sort of
text.
2023-11-15 18:42:12 -05:00
Alexander Orzechowski
50446fe75e wlr_scene: Update outputs when primary output is changed
Helpers care about the primary output. They need to know when it changes
even if intersection status has not changed necessarily.
2023-11-15 18:42:12 -05:00
Alexander Orzechowski
889c5ed5ff wlr_scene: Update outputs when output scale/transform changes
We want to call the outputs updated signal when an output scale or transform
changes. Otherwise helpers like the scene surface helpers will not be
notified of scale changes and not pass them to clients.
2023-11-15 18:38:12 -05:00
Alexander Orzechowski
3d3cca9164 wlr_scene: Introduce wlr_scene_subsurface_tree_set_clip 2023-11-14 17:27:08 +00:00
Alexander Orzechowski
d1ddd4ca3a wlr_scene_surface: Introduce scene_surface_set_clip 2023-11-14 17:27:08 +00:00
Alexander Orzechowski
c6d356648c set_buffer_with_surface_state: Take whole surface struct 2023-11-14 17:27:08 +00:00
Alexander Orzechowski
1c0b10b61a wlr_scene_subsurface_tree: Addon to scene
We will need this later so that we can determine the subsurface tree
that owns any given scene node.
2023-11-14 17:27:08 +00:00
Alexander Orzechowski
33b437d574 wlr_scene: Amend scene_buffer.point_accepts_input to take coordinate pointers
The pointers mean that we can mutate them. This will be useful later
so we can hide details from the compositor when we clip subsurface trees.
2023-11-14 17:27:08 +00:00
Simon Ser
319e4125ab xdg-shell: add wlr_xdg_{toplevel,popup}_try_from_wlr_surface()
Convenience helpers for compositors. Saves them the trouble of
manually checking the role (and if they forget to do so, prevents
an invalid cast).
2023-11-13 10:31:00 +01:00
Väinö Mäkelä
5de9e1a99d wlr-output-management: Send custom modes to clients
Since commit 5567aefb, fixed modes haven't been automatically generated
for custom modes, so the output management implementation needs to be
able to handle them directly. To avoid polluting the mode list, only a
single custom mode can be listed at a time and will be removed when a
fixed mode is set.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3744
2023-11-06 17:46:55 +00:00
Simon Ser
22df8d3847 cursor: log missing XCursor
Log a debug message when the XCursor theme is missing a cursor.
Eases debugging.

References: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3746
2023-10-31 13:37:00 +00:00
sunzhguy
dbf20b0ad3 wlr_cursor: update cursor when output enable and transform changed
Signed-off-by: zhoulei <zhoulei@kylinos.cn>
Signed-off-by: sunzhguy <sunzhigang1@kylinos.cn>
2023-10-31 01:29:02 -04:00
Simon Ser
1c24b1182b backend: drop wlr_backend_get_presentation_clock()
We can just assume CLOCK_MONOTONIC everywhere.

Simplifies the backend API, and fixes clock mismatches when multiple
backends are used together with different clocks.
2023-10-30 18:39:39 +01:00
Kirill Primak
5fac9b1beb xdg-toplevel: don't send maximized if tiled is requested but not supported
This is a bit too magical and may break compositors which try not to
send duplicate configure events.
2023-10-29 15:51:12 +00:00
Simon Ser
55be74ad86 util/token: rename TOKEN_STRLEN to TOKEN_SIZE
TOKEN_STRLEN is not actually the strlen() of the token. It's the
size taken by the token included the final zero byte.

Change the name to make this clearer, and remove unnecessary +1's.
2023-10-26 16:30:12 +00:00
Kirill Primak
d253d70786 xdg-shell: use wlr_surface.unmap_commit 2023-10-26 19:06:40 +03:00
Kirill Primak
d8515b3446 layer-shell: track surface init state 2023-10-26 14:57:10 +00:00
Kirill Primak
f750c7445d layer-shell: don't use wlr_surface_role.unmap hook
A layer-shell surface can be unmapped if wlr_layer_shell_v1 is
destroyed or the client has committed a NULL buffer. Let's use the
previously introduced wlr_surface.unmap_commit to handle the latter
case instead; this is more consistent with the xdg_surface
implementation logic, where using the hook is more trouble than it's
worth.

Additionally, this commit adds an unconditional surface reset on
destroy, so popups are properly cleaned up even if originally created
with an unmapped layer-shell surface as a parent. Doing so with the
role unmap hook would either result in possibly resetting the surface
twice, which is suboptimal, or having an awkward
`if (mapped) { unmap() } else { reset() }` check.
2023-10-26 14:57:10 +00:00