Commit Graph

5334 Commits

Author SHA1 Message Date
Simon Ser cfba4c6344 editorconfig: set max_line_length
See [1]. CONTRIBUTING.md says:

> Try to keep your lines under 80 columns, but you can go up to 100 if it
> improves readability.

[1]: https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties#max_line_length
2022-01-20 15:09:15 +01:00
Simon Ser d8d30463ac render/vulkan: log physical device driver name
This can be useful to figure out why a required feature is missing,
e.g. as in [1].

We check VK_EXT_physical_device_drm availability after printing
the driver name.

[1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3358
2022-01-19 13:08:46 +01:00
Alexander Orzechowski c22ea3eb99 scene_graph: Simplify computation for offset of new surfaces.
This became possible after the usage of wlr_surface_send_frame_done.
2022-01-19 04:46:30 -05:00
Alexander Orzechowski 1bc6f7f243 scene_graph: remove unused outputs list 2022-01-19 04:42:01 -05:00
Alexander Orzechowski 8656c77248 scene_graph: use wlr_scene_output_send_frame_done 2022-01-19 04:38:19 -05:00
Isaac Freund 1bd0ea3a80
foreign-toplevel: send enter if needed on output bind
Currently the output enter event is never sent if the client has not
yet bound the output, which happens every time the compositor creates a
new output.

To fix this, listen for the output bind event and inform clients as
if needed.
2022-01-17 19:11:08 +01:00
Tadeo Kondrak 5091118bed input_method_v2: improve mapping detection
Detect NULL commits before the surface is actually committed, allowing
the surface to be properly damaged on unmap.
2022-01-16 09:08:39 -07:00
Isaac Freund 89dc9a4496 tinywl: fix check whether client is focused or not
Currently this check is too strict and denies the move/resize request
if a subsurface of the client has pointer focus.
2022-01-14 20:17:22 +00:00
Kirill Primak 50827ed7f5 surface: improve role precommit hook
Now the role precommit hook is called before the commit, not on
wl_surface.commit request, and takes a state which is to be applied.
2022-01-13 15:15:54 +03:00
Kirill Primak 617eb4fb93 surface: deprecate wlr_surface.h 2022-01-13 10:06:41 +00:00
Kirill Primak e94e16ba5d surface: move decl to wlr_{sub,}compositor.h 2022-01-13 10:06:41 +00:00
Kirill Primak 36b5d5888c surface: move impl to types/wlr_{sub,}compositor.c 2022-01-13 10:06:41 +00:00
Kirill Primak 4ec683ad1c surface: introduce events.client_commit
wlr_surface.events.client_commit is fired when wl_surface.commit
request is received.
2022-01-13 10:06:41 +00:00
Kirill Primak b6f43ab2e1 subcompositor: split out from compositor 2022-01-13 10:06:41 +00:00
Simon Ser 6cdf843a8c readme: drop mention of the Sway project
wlroots has historically been started as a Sway project, but these
days many wlroots contributors are working on other compositors.
wlroots now also has its own namespace on gitlab.freedesktop.org.

Let's remove the mention about Sway in the README, to make it clearer
that Sway isn't treated in a special manner when it comes to wlroots
development.
2022-01-09 12:01:58 +01:00
Kirill Primak 83ab5055fd scene/subsurface_tree: fix handling subsurface destruction
This commit renames map/unmap listeners to clarify that they handle
subsurface events, and ensures the node is always destroyed before
the subsurface.

Without this patch, wl_list_remove() would operate on listener links in
already freed memory. glibc is usually lenient to bugs like this, but
musl isn't.
2022-01-08 16:09:27 +00:00
Thomas Hebb 59b9518f07 render/gles2: don't constrain shm formats to ones that support reading
commit 44e8451cd9 ("render/gles2: hide shm formats without GL
support") added the is_gles2_pixel_format_supported() function to
render/gles2/pixel_format.c, whose stated purpose is to "check whether
the renderer has the needed GL extensions to read a given pixel format."
It then used that function to filter the pixel formats returned by
get_gles2_shm_formats().

The result of this change is that RGB formats are no longer reported for
GL drivers that don't implement EXT_read_format_bgra, even when those
formats are supported for rendering (which they have to be for
wlr_gles2_renderer_create() to succeed). This is a pretty clear
regression, since wlr_renderer_init_wl_shm() fails when either of
WL_SHM_FORMAT_ARGB8888 or WL_SHM_FORMAT_XRGB8888 are missing.

To fix the regression, change is_gles2_pixel_format_supported() to
accept all pixel formats that support rendering, regardless of whether
we can read them or not, and move the check for EXT_read_format_bgra
back into gles2_read_pixels(). (There's already a check for this
extension in gles2_preferred_read_format(), so we're not breaking any
abstraction that wasn't already broken.)

Tested on the NVIDIA 495.46 proprietary driver, which doesn't support
EXT_read_format_bgra.

Fixes: 44e8451cd9 ("render/gles2: hide shm formats without GL support")
2022-01-05 15:48:29 -08:00
nyorain 9988eb3378 vulkan: Fix imported image layout 2021-12-26 13:21:54 +01:00
Simon Ser 812951f5bc scene: schedule an output frame on wl_surface.frame
Some clients (e.g. mpv, Firefox) request a new wl_surface.frame
callback without damaging their surface. When this happens,
schedule a new output frame.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3350
2021-12-23 17:00:28 +01:00
Isaac Freund 823476e76e
wlr_texture: remove wlr_texture_from_wl_drm() from header
This function was already removed in e5b5592a but it was forgotten to
remove it from the header.
2021-12-20 20:41:44 +00:00
Simon Ser ec28457508 backend: error out in autocreate without libinput support
The libinput backend is now optional. However, this means that a
user building wlroots without the correct libinput dependencies
will end up with a compositor which doesn't respond to input events.

wlr_backend_autocreate is supposed to return a sensible setup, so in
this case let's just error out and explain what happened. Users can
suppress the check by setting WLR_LIBINPUT_NO_DEVICES=1 (already used
to suppress the zero input device case inside the libinput backend).

Compositors which really want to create a bare DRM backend can easily
create it manually instead of using wlr_backend_autocreate.
2021-12-20 13:56:09 +00:00
Simon Ser b5a019d575 build: simplify Meson subproject fallbacks
All of these projects use meson.override_dependency() so we can
stop referencing their internal variable name to grab the
depndencies we need.
2021-12-19 18:12:16 +00:00
Simon Ser 93e050c602 Remove wlr_box.h redirection
Compositors should've all been updated to use the new header by now.
2021-12-17 15:38:03 +01:00
Simon Ser 562b24b9fc build: bump soversion
According to [1] this should be done at each release with breaking ABI
changes.

[1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/wikis/Core-contributor-guide#releasing-a-new-version

Fixes: 7360810f2e ("build: bump to version 0.16.0")
2021-12-17 12:53:18 +01:00
Isaac Freund 92d137c78a layer-shell: fix type of margins
These currently use uint32_t while they are an int32_t in the protocol.
2021-12-17 10:57:21 +00:00
Simon Ser 7360810f2e build: bump to version 0.16.0 2021-12-17 11:54:06 +01:00
Simon Ser 9f41627aa1 backend/wayland: add basic linux-dmabuf feedback support
This patch makes it so we bind to zwp_linux_dmabuf_v1 version 4 and
we use it to grab the main device. v4 sends supported formats via a
table so we need to handle this as well.

v4 allows wlroots to remove the requirement for Mesa's internal
wl_drm interface.
2021-12-15 14:34:08 +00:00
Stacy Harper 8e566f716c layer-shell: don't set committed flag if the property didn't change
This fixes configure loop in Sway when clients re-send same properties
on every configure event.

Original issue: https://todo.sr.ht/~mil/sxmo-tickets/413
2021-12-15 16:24:33 +03:00
Isaac Freund 07ccc6e0b3
scene: add wlr_scene_set_presentation()
This helper automates sending presentation feedback to clients based on
the primary output of scene surfaces.
2021-12-14 21:34:02 +01:00
Simon Ser c0b120a30c build: add subproject fallback for libdrm 2021-12-14 14:33:00 +01:00
Simon Ser bedfec94bb backend/drm: use drmCloseBufferHandle
This has been added in [1] and allows us to close buffer handles
without manually calling drmIoctl.

[1]: https://gitlab.freedesktop.org/mesa/drm/-/merge_requests/192
2021-12-14 14:33:00 +01:00
Simon Ser a15c327718 backend/drm: use drmModeFormatModifierBlobIterNext
This avoids open-coding our own logic. The resulting code is more
readable.

References: https://gitlab.freedesktop.org/mesa/drm/-/merge_requests/146
2021-12-14 13:21:09 +00:00
Simon Ser 4377b55292 util/global: remove wl_display arg from wlr_global_destroy_safe
Since [1], we can get the wl_display directly from the wl_global.

[1]: 2b22160fb6
2021-12-14 13:13:50 +00:00
Guido Günther 4c59f7d46a xdg-activation: Allow to submit tokens
Allows the compositor to submit tokens to the pool of
currently active tokens. This can be useful when the
launcher doesn't use or support xdg-activation-v1 by
itself - e.g. when it is X11 based or use gtk_shell1.
2021-12-14 12:01:46 +01:00
David Rosca 31914928d2
seat: Only resend keyboard/pointer enter to focused clients
Otherwise it will send enter events to clients that already
have keyboard/pointer focus.
Notably Qt applications warns about this.
2021-12-14 08:23:53 +01:00
Isaac Freund 1c3e0816f3
scene: fix wlr_scene_send_frame_done() API
This doesn't work if scene outputs are not used as the primary output of
scene surfaces will always be NULL.

Therefore, take a wlr_scene_output instead of separate wlr_scene and
wlr_output arguments and rename the function to
wlr_scene_output_send_frame_done().

The actual behavior of the function is unchanged.
2021-12-13 17:26:22 +01:00
Isaac Freund ad01cdf0b2 tinywl: use wlr_scene_send_frame_done() 2021-12-13 15:21:05 +00:00
Isaac Freund fecde72be3 scene: add wlr_scene_send_frame_done() 2021-12-13 15:21:05 +00:00
Isaac Freund fb1f613510 scene: add primary output to wlr_scene_surface
This allows compositors to avoid sending multiple frame done events
to a surface that is rendered on multiple outputs at once. This may
also be used in the same way for presentation feedback.
2021-12-13 15:21:05 +00:00
Isaac Freund 0215dffba5 scene: send surface enter/leave output events
Co-authored-by: Simon Ser <contact@emersion.fr>
2021-12-13 15:21:05 +00:00
Chris Chamberlain d8ca494558 backend/drm: add wlr_drm_backend_monitor
This helper is responsible for listening for new DRM devices and
create new child DRM backends as necessary.
2021-12-13 14:55:16 +01:00
Chris Chamberlain f6d3efbf4b backend: fix return value of attempt_drm_backend
The multi backend was returned instead of the primary DRM backend.
2021-12-13 14:53:41 +01:00
Simon Ser e3fefda023 output: add support for protocol interface version 4
Two new events are added: name and description. The name is
immutable. The description can be updated on-the-fly.
2021-12-13 12:06:16 +00:00
Kirill Primak 0fcc842291 subsurface: don't add to parent list immediately 2021-12-09 18:26:56 +00:00
Kirill Primak 7964bdae76 surface: fix non-buffer damage handling
This commit fixes the way the damage that doesn't come directly from the
client is handled.
2021-12-09 18:26:56 +00:00
Kirill Primak df7d280343 subsurface: apply position change at the right moment
Subsurface position is considered to be a part of the parent surface's
state, therefore it should be modified when the parent is committed.
2021-12-09 18:26:56 +00:00
Kirill Primak f463ca669a subsurface: simplify and fix parent commit handling 2021-12-09 18:26:56 +00:00
Simon Ser 818fc4a87b Fix incorrect %zd formatting directives
%zd is for ssize_t. For size_t we should use %zu.
2021-12-09 16:42:04 +01:00
Simon Ser 36a2b19485 output: introduce wlr_output_set_name
wlroots picks names for all outputs, but it might be desirable for
compositor to override it.

For instance, Sway will use a headless output as a fallback in
case no outputs are connected. Sway wants to clearly label the
fallback output as such and label "real" headless outputs starting
from HEADLESS-1.
2021-12-09 15:46:46 +01:00
Simon Ser 1fbd13ec79 examples: remove unnecessary partial_dependency() call
The definition of the "drm" dep already calls it.
2021-12-07 16:20:54 +01:00