Commit Graph

2703 Commits

Author SHA1 Message Date
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
John Lindgren af165acb42 xwayland: add wlr_xwayland_set_workareas()
This function allows compositors to set the _NET_WORKAREA property on
the root window. XWayland clients use _NET_WORKAREA to determine how
much of the screen is not covered by panels/docks. The property is used
for example by Qt to determine areas of the screen that popup menus
should not overlap (see QScreen::availableVirtualGeometry).
2023-10-26 15:05:08 -04:00
Simon Ser 2410710a0f util/token: add docs 2023-10-26 16:30: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 4d2e310122 compositor: add wlr_surface.unmap_commit
This flag can be used to figure out whether a particular commit has
unmapped the surface. Private state for now in case we find a better
way to track this.
2023-10-26 14:57:10 +00:00
eri bfc42e0f62
linux_dmabuf_v1: convert to try_from
References: wlroots/wlroots#884
2023-10-19 18:19:42 +02:00
eri c46d3da976
drm: convert to try_from
References: wlroots/wlroots#884
2023-10-19 18:19:38 +02:00
eri 8ccbe45143
buffer: convert to try_from
References: wlroots/wlroots#884
2023-10-19 18:19:27 +02:00
John Lindgren 6114dd6a83 xwayland: stop translating _NET_WM_STRUT_PARTIAL coordinates
Translating the right/bottom coordinates from offsets to absolute
coordinates in wlroots (rather than in the compositor) was supposed to
be more reliable, since wlroots had access to the X11 screen size.

It ended up being less reliable, because the screen size values
(xwm->screen->width_in_pixels/height_in_pixels) are not updated when the
output layout changes.

So let's remove the translation from wlroots, and let the compositor
figure it out. From what I can understand of the current XWayland code,
the X11 screen size should generally match the overall wlr_output_layout
bounding box, which the compositor has access to.
2023-10-14 21:27:34 -04:00
Simon Ser e519635cc2 xwayland: add wlr_xwayland_create_with_server()
Allows compositors to set up the server (and shell) on their own.
2023-10-10 17:05:04 +02:00
Simon Ser bdcf997a89 xwayland/server: add ready flag
Allows one to check whether the server is currently ready.
2023-10-10 17:05:04 +02:00
Simon Ser ccb153f024 security-context-v1: add commit event 2023-10-10 10:34:01 +02:00
Simon Ser c58deb7a7d security-context-v1: new protocol implementation
Co-authored-by: Puck Meerburg <puck@puckipedia.com>
References: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/68
2023-10-10 10:34:01 +02:00
Kirill Primak 078540e086 xdg-shell: fix wlr_xdg_popup_destroy() docs 2023-10-09 19:29:28 +00:00
Kenny Levinsen 2cf78f4c5b output: allow_artifacts -> allow_reconfiguration
The name "allow_artifacts" and associated description is very vague, and
theoretically allow for tearing behavior. Clarify that we only intend to
mean artifacts related to output configuration (e.g., modesets).

References: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3740
2023-10-09 08:31:35 +00:00
Alexander Orzechowski e1e911d425 scene_output_layout: Don't destroy output when output layout is destroyed
There were a couple of problems with this:
1. The behavior is unexpected. Typically objects in wlroots won't
also destroy objects that they depend on. For instance, wlr_scene_output
will not destroy the wlr_output when it's destroyed. It shouldn't be any
different for scene layouts.
2. This fixes a crash where because wlr_output_layout and wlr_scene_output
are both addons to wlr_output, we might get into a situation where
wl_list_for_each_safe might malfunction. See [1]

This means that the compositor needs to manually destroy the output
when they destroy the layout, hence ~breaking. Compositors can just
call `wlr_scene_output_destroy()` if they want to destroy both at the
same time.

[1] https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4358#note_2106260

This reverts commit 1a731596c5.

Co-authored-by: Kirill Primak <vyivel@eclair.cafe>
2023-10-07 13:31:20 -04:00
Alexander Orzechowski 5fb0007e02 output_event_commit: Remove committed and buffer
The newly introduced state struct can be used to retrieve this.
2023-10-06 10:06:01 +00:00
Alexander Orzechowski 03e240a7f2 wlr_output: Add applied state to commit event 2023-10-06 10:06:01 +00:00
Kirill Primak 86c30b8715 seat: remove wlr_seat_validate_grab_serial()
It makes little sense to have a catch-all grab vaildation function,
considering that e.g. tablet tool implicit grabs are possible as well.
Besides, the function has always returned true anyway.
2023-10-06 08:51:47 +00:00
JiDe Zhang ca19014af0 xwayland: fix double free wlr_xwayland_shell_v1 2023-10-06 10:04:11 +02:00
Simon Ser e58c7bb792 render/drm_format_set: use published kernel doc URL
The kernel patch has been merged, so this is available in the
official docs now.
2023-10-05 21:29:25 +00:00
Manuel Stoeckl e0adaaffb6 render/vulkan: constrain blend to output subpass to redrawn region
This commit only applies to the render pass API.
2023-10-05 11:45:32 +00:00
Manuel Stoeckl d180f4d9b3 util: add struct to track union of rectangles
The new struct rect_union is designed to make it easier to
efficiently accumulate a list of rectangles, and then operate
on an exact cover of their union.

Using rect_union, the times needed to added t rectangles, and then
compute their exact cover will be O(t), and something between Ω(t) and
O(t^2), depending on the rectangle arrangement. If one tries to do
the same by storing a pixman_region32_t and updating it with
pixman_region32_union_rect(), then total time needed would be between
Ω(t^2) and O(t^3), depending on the input. Without changing the public
API (data structure + rectangle ordering rules) for pixman_region32_t,
it is impossible to improve its worst case time.
2023-10-05 11:45:32 +00:00
Simon Zeni a289f812d6 drop KDE idle protocol support 2023-10-04 12:19:30 -04:00
Simon Ser ddfec31b4c xdg-shell: document wlr_xdg_surface's initialized & initial_commit 2023-10-04 14:50:48 +00:00
Kirill Primak a09d649439 docs: replace the less commonly used "::" with "." 2023-10-02 22:10:16 +03:00
Kirill Primak 0fdbdc36c0 xdg-surface: fix init state flow
Fixes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3677
2023-10-02 18:37:09 +00:00
Rose Hudson 83af3202f9 output: defer fake present events until after commit
Since headless and wayland-without-presentation-feedback were firing
present inside their commit impls, present was getting fired before
commit, which is cursed. Defer this with an idle timer so that commit
handlers can run before present handlers.
2023-10-02 12:34:06 +00:00
vaxerski c2aa7fd965 backend/drm: Add async page flip support to legacy
Atomic doesn't support such flags yet.
2023-09-28 16:53:08 +00:00
vaxerski 5dec1c8bcb staging/tearing-control: Add protocol support 2023-09-28 16:53:08 +00:00
John Lindgren 1a731596c5 wlr_scene: clarify wlr_scene_output ownership semantics
wlr_scene_output_layout_add_output() was made public by f5917f0247
("scene_output_layout: make output adding explicit") but the ownership
semantics are not obvious and should be clarified.
2023-09-22 21:18:16 -04:00
Alexander Orzechowski 5299d973d5 render/pass: Introduce wlr_render_rect_options_get_box 2023-09-21 02:25:34 -04:00
Simon Ser 65bbbbbf0c render/vulkan: de-duplicate VkImageUsageFlags
The flags passed to vkCreateImage() must match the flags used when
querying formats. Make this clearer by using the same variable.
2023-09-09 23:32:28 +00:00
Kirill Primak 4565b07484 Unify signal data docs
`// struct <name>` appears roughly 4 times as often as
`// struct <name> *`. Switch to the former variant everywhere.
2023-08-23 19:43:26 +00:00
Manuel Stoeckl a94168b5fe render: ensure wlr_render_rect_options->box is nonempty
This optimization also fixes an validation error with the Vulkan
renderer by ensuring vkCmdClearAttachments does not receive empty
regions.
2023-08-23 18:28:58 +00:00
Simon Ser e5fc8cd4c7 output: trigger frame/present events on all commits on enabled output
Up until now, frame/present events were only triggered when the
user submitted a buffer. Change the wlr_output API so that these
events are triggered when any commit is applied on an enabled
output.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3708
2023-08-23 15:42:22 +00:00
Rose Hudson f5917f0247 scene_output_layout: make output adding explicit
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3709
2023-08-22 11:53:28 +02:00
Rose Hudson 91f813ffb7 output_layout: return wlr_output_layout_output when adding output
This will be used for the scene-graph integration.
2023-08-22 11:53:25 +02:00
Simon Ser 72787db98a compositor: drop wlr_surface_destroy_role_object()
This function is now unnecessary.
2023-08-21 18:56:09 +02:00
Kirill Primak bd5c4f4a4a xdg-shell: rework roles 2023-08-21 16:30:29 +00:00
Kirill Primak f0cc712af1 xdg-shell: don't return anything from create_xdg_surface() 2023-08-21 16:30:29 +00:00
Simon Ser 9b8cd1f5d6 buffer: make wlr_client_buffer functions private
We want to eventually remove this. Let's make sure compositors
don't start using either of these functions.
2023-08-21 15:45:10 +00:00
Leonardo Hernández Hernández bdc34401ba
xdg-decoration: store an xdg_toplevel instead of xdg_surface
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3685
2023-08-19 11:10:36 -06:00
Simon Ser 22b6581a18 backend/wayland: wait for xdg_surface.configure explicitly
We were assuming a roundtrip was enough to get an
xdg_surface.configure event. That's not the case, the protocol
spec doesn't make such a guarantee.
2023-08-16 22:09:01 +02:00
Simon Ser d3d3e19ffd render: split render pass API into separate header
Keeps the main wlr_renderer.h a tad more tidy.
2023-08-16 19:20:12 +02:00
Alexander Orzechowski 568b1943b9 wlr_output: Nuke wlr_output_update_enabled 2023-08-16 18:37:55 +02:00
Alexander Orzechowski f1ba70ffa6 wlr_output: Make wlr_output_update_{custom,}_mode private
Backends should be using wlr_output_send_request_state to request
modesets to the compositor. This will be inlined and removed next commit.
2023-08-16 18:37:55 +02:00
Alexander Orzechowski 6cda3e251c output: Add initialization state to wlr_output_init 2023-08-16 11:46:27 -04:00