Commit Graph

7287 Commits

Author SHA1 Message Date
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
zhoulei
2c64f36e88 xwayland/xwm: listen shell destroy signal
Otherwise we got invaild write in wl_list_remove.

Fixes: e209fe2d0 ("Fix memory leak in xwayland.c")

Signed-off-by: zhoulei <zhoulei@kylinos.cn>
2024-08-13 11:33:04 +08:00
Simon Ser
e6dbe4580e render/gles2: check for DRM_CAP_SYNCOBJ_TIMELINE
Before advertising support for timelines, check for
DRM_CAP_SYNCOBJ_TIMELINE. Without this, the user cannot
create/import drm_syncobj timelines.

References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4715#note_2523517
2024-08-12 22:37:34 +00: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
project-repo
e209fe2d05 Fix memory leak in xwayland.c 2024-08-12 14:06:10 +00:00
project-repo
3cae2a2c01 Fix memory leak in drm.c 2024-08-12 14:06:10 +00:00
John Lindgren
6214144735 xwayland: add wlr_xwayland_surface_has_window_type()
The infrastructure to read _NET_WM_WINDOW_TYPE already exists in wlroots
(it's used for example in wlr_xwayland_or_surface_wants_focus()). But
the window type isn't easily accessible to the compositor because the
atoms to compare against are private to xwm.c.

labwc has recently gone to a fair amount of effort (including opening a
whole new xcb connection) just to get the needed window type atoms:
a04b394e59

It seems much cleaner to add the remaining few (3) atoms to wlroots and
implement a shared function which can be used by any wlroots compositor.

v2: naming updates
2024-08-10 16:10:34 +00:00
Alistair Buxton
71cc47b859 Fix Meson version required for C23 support
Attempting to build with Meson 1.3.2 (current version in Ubuntu 24.04 LTS) gives the following error:

    meson.build:1:0: ERROR: Unknown C std ['c23'].

This is because C23 support was not added until Meson 1.4.0.

See:

https://github.com/mesonbuild/meson/blob/1.3.2/mesonbuild/compilers/c.py#L59
https://github.com/mesonbuild/meson/blob/1.4.0/mesonbuild/compilers/c.py#L49
2024-08-10 15:54:23 +00: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
Consolatis
0a388a14f1 xwm: supply wlr_xwayland pointer to user_event_handler callback
Previously it was supplying a pointer to private struct wlr_xwm
which was useless for compositors. The wlr_xwayland pointer in
contrast does have a generic data field and thus can be used by
compositors to attach their own pointer.

Additionally change the return value from int to bool.
2024-08-08 17:00:08 +00:00
Consolatis
20997df416 xwm: add request_close signal
This is especially useful if the compositor wants to support X11
panels to control windows. Without the signal a compositor does
have to hook into the user_event_handler callback but that would
not change the _NET_SUPPORTED root window property.
2024-08-08 15:49:11 +00:00
Simon Ser
df4a1d94e2 scene: fix typo in wlr_scene_surface_create() docs 2024-08-08 09:16:46 +02:00
Simon Ser
1c7e1bcc28 scene: use numbers instead of stars for doc refs
I find these slightly more readable (because the whole comment has
a stars column on the left side).
2024-08-08 09:14:48 +02:00
Alexander Orzechowski
14446216f4 wlr_scene: Improve wlr_scene_surface_create documentation 2024-08-07 16:47:27 -04: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
Alexander Orzechowski
4b4ca11f6f util/box: Introduce wlr_box_contains_box 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
775817e278 render: add WLR_RENDER_NO_EXPLICIT_SYNC env var
This can be handy to figure out if a bug is due to explicit sync.
2024-08-06 17:37:06 +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
edb867bc05 render/drm_syncobj: add wlr_drm_syncobj_timeline_export() 2024-08-06 17:37:06 +00:00
Simon Ser
5552de65f8 render/drm_syncobj: add wlr_drm_syncobj_timeline_transfer() 2024-08-06 17:37:06 +00:00
Simon Ser
3067e45c2e backend/drm: add support for explicit sync APIs 2024-08-06 17:37:06 +00:00
Simon Ser
1ad42bea99 output: add explicit sync API 2024-08-06 17:37:06 +00:00
Simon Ser
d2374b3e4e render/gles2: implement explicit sync API 2024-08-06 17:37:06 +00:00
Simon Ser
19ffbfe356 render/egl: add support for explicit sync extensions 2024-08-06 17:37:06 +00:00
Simon Ser
a1635fdb76 render: 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
6261bd9684 .mailmap: add myself 2024-08-05 19:32:24 +03:00
Philipp Kaeser
d400b4587a wlr_scene: Add 'struct' to comment in wlr_scene_create() to permit auto-linkify. 2024-08-04 11:57:27 +02:00
Philipp Kaeser
42df9414fb wlr_scene: Add documentation to wlr_scene_create about how to destroy the allocated resources. 2024-08-04 09:49:58 +00:00
Kirill Primak
7e13dfdd4d xwayland: remove stray empty line 2024-08-02 17:52:19 +03:00
Consolatis
ceb4fcedca xwm: expose individual axis for _set_maximized()
This allows compositors to support both axis individually.
To keep existing behavior, compositors can supply the same
maximized state for both axis.
2024-08-02 14:46:37 +00:00
John Lindgren
f9199bb6d4 xwayland: set focus to XCB_POINTER_ROOT rather than XCB_NONE
Fixes an issue with keyboard grabs not working when no XWayland windows
are focused.
2024-08-01 13:19:24 +00:00
John Lindgren
5083efe18b xwayland: add wlr_xwayland_surface_offer_focus()
In labwc, we have had trouble with XWayland windows using the Globally
Active input model (see wlr_xwayland_icccm_input_model()). Under
traditional X11, these windows do not expect to be given focus directly
by the window manager; rather, the WM sends them a WM_TAKE_FOCUS message
prompting the client to take focus voluntarily.

Currently, these clients are difficult to support with wlroots, because
wlr_xwayland_surface_activate() assumes the client window will always
accept the keyboard focus after being sent WM_TAKE_FOCUS. Some Globally
Active client windows (e.g. panels/toolbars) don't want to be focused.
It's useless at best to focus them, and might even make them misbehave.
Others do need keyboard focus to be functional -- and there doesn't seem
to be any reliable way to know this in advance.

Adding wlr_xwayland_surface_offer_focus() allows the compositor to send
WM_TAKE_FOCUS to a client window supporting it and then see whether the
client accepts or ignores the offer. If it accepts, the surface will emit
the focus_in signal notifying the compositor that it has received focus.

This is entirely opt-in. A compositor that doesn't want to use the new
function can continue to call wlr_xwayland_surface_activate() directly
just as before.
2024-08-01 13:19:24 +00:00