Commit Graph

2639 Commits

Author SHA1 Message Date
Leonardo Hernández Hernández
baaec88e2f
linux-drm-syncobj-v1: actually use the requested version 2024-08-14 23:03:14 -06:00
Kirill Primak
4da4269d8f seat/pointer: reset pressed buttons on "grab-compatible" focus change
Fixes: 08e779bd85
2024-08-14 22:43:44 +03:00
Kirill Primak
5c98d1a04a xdg-surface: fix window geometry handling
It was completely wrong: according to the protocol, the effective
geometry is only updated on commit time if there pending state has
new state from xdg_surface.set_window_geometry or
xdg_surface.set_window_geometry has never been sent at all.

This commit adds wlr_xdg_surface.geometry which correctly matches the
effective window geometry and removes now-useless
wlr_xdg_surface_get_geometry().
2024-08-14 18:52:13 +00:00
Kirill Primak
a1298580cc compositor: add surface role map hook 2024-08-14 18:52:13 +00:00
Alexander Orzechowski
515275ee72 wlr_scene: Introduce wlr_scene_set_gamma_control_manager_v1 2024-08-14 13:18:56 -04:00
Alexander Orzechowski
23202e192c wlr_scene: Introduce wlr_scene_output_needs_frame
It seems that some scene compositors want to avoid wlr_scene_output_commit
and use the lower lever wlr_scene_output_build_state. However, build
state does not early return if a frame is not needed so compositors will
implement the check themselves. Let's add a helper function that compositors
can use to implement the check.

Technically pending_commit_damage is a private interface, so this lets
compositors not interface with private interfaces to implement the check.
2024-08-14 12:51:15 -04:00
Alexander Orzechowski
2463a4723e wlr_scene: Ensure we restack all xwayland surfaces to the bottom when scene node is disabled 2024-08-14 11:53:20 -04:00
Alexander Orzechowski
291df10fe5 wlr_scene: Extract function to get xwayland surface from node 2024-08-14 11:53:05 -04:00
Alexander Orzechowski
235c8e922a Revert "wlr_scene: Ensure scene_node_update is updating entire node."
This reverts commit 66d96d244c.
2024-08-14 11:51:44 -04:00
Kirill Primak
70c99460ca pointer-constraints: don't init/finish current/pending states
wlr_surface_synced does it automatically.

Reported-by: llyyr <llyyr.public@gmail.com>
2024-08-14 15:41:31 +00:00
Alexander Orzechowski
4f1104654f wlr_scene: Fix WLR_SCENE_DEBUG_DAMAGE_HIGHLIGHT when output is transformed 2024-08-14 11:23:30 -04:00
Alexander Orzechowski
14e1987f50 wlr_scene: Don't special case swapchain buffers
This fixes direct scanout VRR. As direct scanout buffers are not part
of the swapchain, we would mistakenly union instead of subtract the damage
meaning it will just accumulate indefinitely.

The reason for this existing in the first place is for compositors that
might want to sidestep scene and commit their own buffers to the output.
In this case, scene could theoretically acknowledge that and update the
damage. Except, this really didn't work because WLR_OUTPUT_STATE_DAMAGE
would need to be defined which is optional. This patch also properly
acknowledges commits without damage.

In the use case of a weird compositor that might want to sidestep scene,
they can just trash the damage ring themselves.

Fixes: #3871
2024-08-14 11:23:02 -04:00
Alexander Orzechowski
3e1358fec9 wlr_scene: Inline output_state_apply_damage 2024-08-14 11:23:02 -04:00
Alexander Orzechowski
147c5c37e3 wlr_scene: Immediately apply pending output commit damage
There were two problems with the old implementation:
1. wlr_scene_output_commit would bail early if a frame wasn't requested
and there was no commit damage, however commit damage could never accumulate
until rendering happens. The check was subtly wrong as a result.
2. Previously, we would fill the pending commit damage based on the
current state of the damage ring. However, during direct scanout, the
damage would accumulate which would mean we would submit damage from
previous frames even if we didn't need to.
2024-08-14 11:23:01 -04:00
Alexander Orzechowski
78dfa4f06d wlr_scene: Funnel all damage operations through scene_output_damage
We want to add logic to this function later
2024-08-14 11:21:00 -04:00
Kirill Primak
c52e01e85f xdg-popup: don't set a role resource destroy handler
wlr_xdg_surface tracks role resource destruction itself.
2024-08-14 13:32:16 +00:00
Kirill Primak
6c8eabcecd xdg-foreign: clean up
This commit removes extra wlr_xdg_toplevel_set_parent() calls,
simplifies wlr_surface->wlr_xdg_toplevel conversion logic, makes related
structures store wlr_xdg_toplevel objects directly instead of
wlr_surface objects, and improves the code style.
2024-08-14 15:56:36 +03:00
Consolatis
adf9d8b0be ext-foreign-toplevel-list: use correct interface and add missing handler
Without this patch, a client calling handle.destroy() will trigger
an assert in libwayland due to a NULL pointer for the destroy handler.

Also implement a missing .destroy handler for the manager itself
and delay destruction of the manager resource from the .stop handler
to the .destroy handler.
2024-08-12 22:31:31 +02:00
Kirill Primak
08e779bd85 seat/pointer: reset pressed buttons on focus change
This fixes two problems:
- A surface could get unexpected release events for buttons pressed
  while other surface was focused;
- Clearing focus while a button is pressed would lead to the button
  getting "stuck".

Fixes: 8730ca9661
2024-08-10 09:55:17 +03:00
Alexander Orzechowski
1133bc15ce wlr_scene: Transparently restack xwayland surfaces
Scene will now automatically restack xwayland windows. Scene
compositors should drop calls to wlr_xwayland_surface_restack()
2024-08-06 20:00:01 -04:00
Alexander Orzechowski
66d96d244c wlr_scene: Ensure scene_node_update is updating entire node.
The old logic might not update the entire scene node when a node is
disabled. It would only consider the damage last time (the damage was
based on the visible region of the node).

It's important that we update the entire node region because xwayland
stacking will depend on this.
2024-08-06 20:00:01 -04:00
Alexander Orzechowski
823a64bf7d wlr_scene: Store update box in update data
We'll use it later
2024-08-06 20:00:01 -04:00
Kirill Primak
8730ca9661 seat/pointer: handle duplicate presses/releases correctly 2024-08-06 22:53:08 +00:00
Simon Ser
738bbf01ee cursor: add support for linux-drm-syncobj-v1 2024-08-06 17:37:06 +00:00
Simon Ser
5f88635118 scene: add explicit synchronization for rendered buffers 2024-08-06 17:37:06 +00:00
Simon Ser
9e9636f675 scene: add support for linux-drm-syncobj-v1 2024-08-06 17:37:06 +00:00
Simon Ser
850dd7a792 linux-drm-syncobj-v1: add helper to signal on buffer release 2024-08-06 17:37:06 +00:00
Simon Ser
c7035da5e2 scene: add timeline point to wlr_scene_buffer_set_buffer() options 2024-08-06 17:37:06 +00:00
Simon Ser
48f0902a36 scene: add wlr_scene_buffer_set_buffer_with_options()
This is an extensible version of wlr_scene_buffer_set_buffer().
2024-08-06 17:37:06 +00:00
Simon Ser
1ad42bea99 output: add explicit sync API 2024-08-06 17:37:06 +00:00
Alexander Orzechowski
4481c6b243 wlr_scene: Force blend mode to PREMULTIPLIED if calculate visibility is disabled
We do it here so WLR_SCENE_HIGHLIGHT_TRANSPARENT_REGION doesn't break
2024-08-05 14:46:30 -04:00
Kirill Primak
de574ac098 output-power-management: send zwlr_output_power_v1.failed on output destroy
From the event description:

This event indicates that the output power management mode control is no
longer valid. This can happen for a number of reasons, including:
<...>
- The output disappeared
2024-08-01 15:24:20 +03:00
Kirill Primak
e17916d413 Rename wlr_surface_get_extends() to wlr_surface_get_extents()
Extend (verb): cause to cover a wider area; make larger.
2024-07-13 19:56:58 +00:00
Isaac Freund
5ecbd23c1d wlr_surface: fix argument order consistency
This swaps the argument order of wlr_surface_accepts_touch() and
wlr_surface_accepts_tablet_v2(), putting the wlr_surface argument first
as should be the case for functions namespaced with wlr_surface_*.
2024-07-13 19:56:58 +00:00
Simon Ser
e34cc23549 scene: only skip bottom-most black rects with fractional scaling
We were relying on the fact that we wouldn't paint anything on top
of the black background in the region of a black rect. However
when fractional scaling is used the repaint region might get
expanded to nearby pixels by scale_output_damage(). As a result
the neighbour scene nodes might leak into the skipped black rect's
region.

Avoid this by using this optimization for bottom-most black rects
only when fractional scaling is used.

References: https://github.com/swaywm/sway/issues/8233
2024-07-11 21:03:27 +02:00
Simon Ser
a35b4f059d backend/drm: add support for SIZE_HINTS property
This property allows the driver to advertise support for multiple
cursor sizes. On Intel, using a smaller buffer size reduces power
consumption.

References: https://lore.kernel.org/dri-devel/20240227193523.5601-2-ville.syrjala@linux.intel.com/
2024-07-10 22:42:44 +00:00
Simon Ser
22dab77d28 shm: add support for wl_shm version 2
References: https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/335
2024-07-07 18:16:45 +02:00
Alexander Orzechowski
ee24201e26 wlr_scene: Don't disable scene nodes at creation time 2024-07-04 14:35:52 -04:00
Alexander Orzechowski
a9375d6bac wlr_scene: Drop map/unmap listeners from layer_shell_v1
Redundant.
2024-07-04 14:10:33 -04:00
Alexander Orzechowski
48b9b7d406 wlr_scene: Drop map/unmap listeners from drag_icon
Redundant.
2024-07-04 14:09:47 -04:00
Alexander Orzechowski
24a9f88873 wlr_scene: Drop map/unmap listeners from xdg_shell
subsurface_tree will handle it. This was redundant.
2024-07-04 14:08:24 -04:00
Alexander Orzechowski
65e6579c56 wlr_scene: send preferred buffer transform 2024-06-28 13:44:35 -04:00
Simon Ser
fe429b2463 Switch to stable tablet-v2 protocol
References: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/284
2024-06-27 18:04:00 +00:00
Simon Ser
213bd88b4c linux-drm-syncobj-v1: new protocol implementation
References: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/90
2024-06-12 18:40:25 +02:00
Kirill Primak
f464213447 input-method: unmap popup surfaces on deactivate
Fixes 743da5c0ae
2024-06-11 13:13:00 +00:00
Kirill Primak
1e58e4006d xdg-popup: validate positioner on reposition request 2024-06-11 12:02:35 +03:00
Kirill Primak
e7deea44fd xdg-popup: don't emit parent's new_popup signal too early 2024-06-11 11:28:09 +03:00
Simon Ser
dc5996a8b4 seat/keyboard: drop unnecessary check in handle_keyboard_keymap()
This condition always holds true: the listener is set up for
state->keyboard.
2024-05-27 23:08:20 +00:00
Kenny Levinsen
13b9b54f3f wlr_scene: Skip direct scanout on color transform
If we need to apply a color transform to rendered content, we will not
be able to use direct scanout. Explicitly skip it to not accidentally
show frames lacking the color transform.
2024-05-24 17:24:32 +02:00
JiDe Zhang
36c0d5fe3a 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().
2024-05-23 09:32:16 +02:00