Commit Graph

2942 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
John Lindgren
eb5312022a xwayland: add focus_in and grab_focus events
Allows the compositor to know when the XWayland focus changes.
2024-08-01 13:19:24 +00:00
Isaac Freund
7550e483ae docs: update comments for wlr_output API changes
The old wlr_output_{commit,test}() functions are still mentioned in
multiple places.
2024-07-15 12:30:06 +00:00
Isaac Freund
2a8a23c467 wlr_output: remove dead function 2024-07-15 12:30:06 +00: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
d3b7e040af wlr_xwayland_surface: fix prefix of two functions
Since we're breaking this API anyways, replace the ambiguous "or" in the
function name with the explicit "override redirect" to avoid confusion.
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
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
0a79bc28c7 build: require libinput v1.19
This version has been published back in 2021.
2024-07-04 22:51:07 +02:00
Kirill Primak
67b88e46b0 Fix __VA_OPT__ macro invocations 2024-06-30 09:01:15 +03:00
Simon Ser
3880ee15d7 Use standard __VA_OPT__ instead of GNU's ##__VA_ARGS__
C23 has standardized a way to write variadic macros that accept
zero arguments:
https://open-std.org/JTC1/SC22/WG14/www/docs/n3033.htm

Use that instead of the GNU extension when available.
2024-06-27 18:13:05 +00: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
Kirill Primak
f320df65e6 backend/wayland: introduce wlr_wl_output_set_app_id() 2024-06-26 19:43:20 +00:00
Kirill Primak
5201836868 backend/drm: store drm prop lists as structs
This makes modifying the property lists slightly easier.
2024-06-25 13:49:54 +00:00
Kenny Levinsen
47c578945c render/vulkan: Recycle memory maps for stage spans
Remapping buffers on every use causes a lot of unwanted pagefaults.
Reuse the mapping to significantly speed up the memcpy.
2024-06-24 15:55:10 +00:00
Kenny Levinsen
bedc890935 backend/drm: Use cached vrr support flag
We do not expect the connector support to change throughout the lifetime
of the link on this connector, so use the value we initially probed.
2024-06-21 14:18:34 +00:00
Kenny Levinsen
f10327f915 wlr_output: Add adaptive_sync_supported
This will let compositors know if changing adaptive_sync state has any
chance of working. When false, then the current state is the only
supported state, including if adaptive_sync is currently enabled as is
the case for Wayland and X11 backends.

When true, changing state might succeed, but no guarantee is made. It
just indicates that the backend does not already know it to be
impossible.
2024-06-21 14:18:34 +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
Simon Ser
d9bfb47648 render/drm_syncobj: add helpers to wait for timeline points
References: https://patchwork.freedesktop.org/patch/506761/
2024-06-12 18:39:45 +02:00
Simon Ser
ea75aa3065 render/drm_syncobj: add wlr_drm_syncobj_timeline_import() 2024-06-12 18:38:42 +02:00
Simon Ser
7fc00ef777 render/drm_syncobj: introduce wlr_drm_syncobj_timeline
wlr_drm_syncobj_timeline is a synchronization primitive based on
drm_syncobj timelines. They are heavily inspired from Vulkan
timeline semaphores [1].

[1]: https://www.khronos.org/blog/vulkan-timeline-semaphores
2024-06-12 17:45:06 +02:00
Kirill Primak
1e58e4006d xdg-popup: validate positioner on reposition request 2024-06-11 12:02:35 +03:00