Commit Graph

2478 Commits

Author SHA1 Message Date
Simon Ser cfa7696d7b backend/wayland: handle wl_registry.global_remove for wl_seat
Destroy the struct wlr_wl_seat when the global is removed.
2023-02-02 18:24:38 +00:00
Simon Ser 2b5eb0733e backend/wayland: make destroy_wl_seats() handle a single seat
Instead of destroying all seats, destroy a single one. We only need
to destroy all seats at one call-site (backend_destroy), but we'll
need to destroy a single seat elsewhere in the next commit.
2023-02-02 18:24:38 +00:00
Simon Ser eb3e8f08a8 subcompositor: convert to try_from
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/884
2023-02-01 20:14:39 +01:00
Simon Ser c5f7f8ab98 ext-session-lock-v1: convert to try_from
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/884
2023-02-01 20:14:12 +01:00
Simon Ser f9bd416d41 layer-shell-v1: convert to try_from
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/884
2023-02-01 20:13:53 +01:00
Simon Ser 49cb85ad72 input-method-v2: convert to try_from
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/884
2023-02-01 20:13:30 +01:00
Simon Ser 711a1a3ed4 xdg-shell: convert to try_from
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/884
2023-02-01 20:12:49 +01:00
Kirill Primak fbf5982e38 xwayland/xwm: introduce wlr_xwayland_surface_try_from_wlr_surface()
This new function replaces wlr_surface_is_xwayland_surface() and
wlr_xwayland_surface_from_wlr_surface().
2023-02-01 16:13:21 +00:00
Simon Ser 3668c9d86c examples, tinywl: use "default" cursor instead of "left_ptr"
"left_ptr" is the X11 name, "default" is the cursor spec name.
2023-02-01 15:00:42 +01:00
Consolatis 4097eb20f3 xcursors: Alias existing cursor defaults to cursor-spec cursor names
wlr_xcursor_get_resize_name() returns cursor-spec [1] based names
but the default cursor icons shipped in include/xcursor/cursor_data.h
use traditional X cursor names instead.

Compositors that use wlr_xcursor_get_resize_name() to resolve an edge
to a cursor icon name may thus be unable to render appropriate cursor
icons for users that don't have a cursor-spec compliant cursor theme
installed on their system or have it installed in an unusual place.

This patch adds cursor-spec cursor icon name aliases.

[1] https://www.freedesktop.org/wiki/Specifications/cursor-spec/
2023-02-01 14:14:41 +01:00
Simon Ser 0f24d27e0b xdg-shell: rename wlr_xdg_popup.committed to sent_initial_configure
We made a similar change to wlr_xdg_toplevel.
2023-01-31 16:27:05 +01:00
Simon Ser df0c926a7a xdg-shell: rename wlr_xdg_toplevel.added to sent_initial_configure
This is more descriptive, and avoids the confusion with
wlr_xdg_surface.added.
2023-01-31 16:20:33 +01:00
Simon Ser d36dd96e8d backend/drm: set "max bpc" property based on pixel format
Since 1d581656c7 ("backend/drm: set "max bpc" to the max") we
set the "max bpc" property to the maximum value. The kernel driver
is supposed to clamp this value depending on hardware capabilities.

All kernel drivers lower the value depending on the GPU capabilities.
However, none of the drivers lower the value depending on the DP-MST
link capabilities. Thus, enabling a 4k@60Hz mode can fail on some
DP-MST setups due to the "max bpc" property.

Additionally, it's not a good idea to unconditionally set "max bpc"
to the max. A high bpc consumes more lanes and more clock speed,
which means higher power consumption and the busy lanes cannot be
used for something else (e.g. other data transfers on a USB-C cable).

For now, let's tie the "max bpc" to the pixel format of the buffer.
Introduce a heuristic to make "high bit-depth buffer" a synonym of
"I want the best quality".

This is not perfect: a "max bpc" higher than 8 might be desirable
for pixel formats with a color depth of 8 bits, for instance when
the color management KMS properties are used. But we don't really
support that yet, so let's leave this for later.

Closes: https://github.com/swaywm/sway/issues/7367
2023-01-31 09:32:11 +00:00
Simon Ser 0e54b861e9 seat/keyboard: constify wlr_seat_keyboard_notify_enter() 2023-01-26 15:06:45 +00:00
Simon Ser 695d28c250 seat/keyboard: constify wlr_seat_keyboard_notify_modifiers() 2023-01-26 15:06:45 +00:00
Simon Ser e44834595d seat/keyboard: constify args in wlr_seat_keyboard_enter() 2023-01-26 15:06:45 +00:00
Simon Ser 12e04d8f83 seat/keyboard: constify wlr_seat_keyboard_send_modifiers() 2023-01-26 15:06:45 +00:00
Alexander Orzechowski 5007e713b4 wlr_scene: Send intersecting list of scene outputs for outputs_update signal 2023-01-21 16:23:30 -05:00
Kirill Primak 843b874f22 output-layout: improve closest point for no outputs case
Without outputs, all points are equally invalid anyway, but for e.g.
cursor warping it makes more sense to preserve the original position.
2023-01-21 12:48:43 +00:00
Simon Ser e93ecc669c tablet-tool: revert bitfield in enum wlr_tablet_tool_tip_state
This was changed to a bitfield by mistake.

References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3484#note_1697926
2023-01-03 20:15:55 +00:00
Isaac Freund 869af1cfbb
session-lock: send more protocol errors
The invalid_destroy and invalid_unlock protocol errors aren't currently
sent by wlroots and instead left up to the compositor. However, we can
handle these as well without much additional complexity.

This also adds a missing wl_resource_destroy() call if the lock is inert
in lock_handle_unlock_and_destroy().
2022-12-23 16:56:42 +01:00
Simon Ser 7081687843 keyboard: improve documentation 2022-12-15 19:49:45 +00:00
Simon Ser 8b8921d57b backend/drm: remove wlr_drm_crtc.legacy_crtc
We only need it for one thing: gamma size. Moreover, some bits in
the drmModeCrtc will become out-of-date, for instance the current
mode, so let's avoid caching the whole struct and only keep what
we know won't change.
2022-12-15 19:31:06 +01:00
xiliuya 7f6d646e0a keyboard: only update LEDs when changed 2022-12-14 17:51:06 +01:00
Simon Ser 99fb2fefc3 backend/drm: rename wlr_drm_backend.outputs to connectors
This list contains wlr_drm_connector entries, and there is no
guarantee that the wlr_output fields are initialized.
2022-12-13 19:15:09 +00:00
Simon Ser f361efe965 backend/drm: add drm_connector_status_str()
Helper to stringify a connector status.
2022-12-13 16:50:27 +00:00
Kirill Primak 8f58c060fd util/region: forbid "shrinking" a region with wlr_region_expand()
The logic isn't correct.
2022-12-09 16:46:36 +00:00
Simon Ser 037b21647b backend/drm: store pending FB in state
Instead of having a pending_fb field on the struct wlr_drm_plane,
move it to struct wlr_drm_connector_state. That way, there's no
risk having a stale pending FB around: the state doesn't survive
across tests and commits.

The cursor is a special case because it's disconnected from the
atomic state: the wlr_backend_impl.set_cursor hook sets the cursor
for the next commit. Move the field to
wlr_drm_connector.cursor_pending_fb.
2022-12-07 17:45:59 +01:00
Simon Ser ae61cd6bfb backend/drm: use separate field to store pending cursor FB
We'll move the pending primary FB into the connector state in the
next commit, dropping wlr_drm_plane.pending_fb in the process.
Introduce a dedicated field for the cursor, which has to be managed
in a special way due to our set_cursor API.
2022-12-07 17:44:51 +01:00
Simon Ser 86fc2199f8 build: unify naming for HAVE_* defines
We sometimes used HAS_, sometimes polluted the LIBINPUT_ namespace,
etc.
2022-12-06 22:39:45 +00:00
Simon Ser a4a40618ad backend/libinput: use internal_config
Removes project arguments.
2022-12-06 22:39:45 +00:00
Simon Ser 4da9b32a15 xwayland: use internal_config
Avoids the need to have a separate config.h, and removes C compiler
arguments.
2022-12-06 22:39:45 +00:00
Simon Ser 6c897756b6 build: use a configuration file for internal features
This avoids re-building the whole project when switching one
Meson option. This shrinks down the compiler invocation command
line, making it more readable and making it easier to inspect
which flags are passed in (the generated file can be opened).
Additionally this is more consistent with our external feature
handling, which uses <wlr/config.h> already.
2022-12-06 22:39:45 +00:00
Simon Ser afe1ae4479 backend/x11: ensure buffers are released on shutdown 2022-12-06 20:22:55 +01:00
Simon Ser d72b4409ce util/env: make env_parse_switch() return a size_t
This function is guaranteed to never return a negative value.

This is important because we use arr[env_parse_switch(...)] in a
few places.
2022-12-06 16:14:18 +01:00
Simon Ser dc09585d14 util/env: add docs
I always forget what env_parse_switch() does on error.
2022-12-06 16:14:16 +01:00
Simon Ser 8456ac6fa9 render/vulkan: wait for DMA-BUF fences
The Vulkan spec doesn't guarantee that the driver will wait for
implicitly synchronized client buffers before texturing from them.
radv happens to perform the wait, but anv doesn't.

Fix this by extracting implicit fences from DMA-BUFs, importing
them into Vulkan as a VkSemaphore objects, and make the render pass
wait on these VkSemaphores.
2022-12-06 14:54:09 +00:00
Simon Ser 30219cf76b render/dmabuf: add dmabuf_export_sync_file() 2022-12-06 14:54:09 +00:00
Ronan Pigott f8e70af318 wlr_xdg_activation_v1: add new_token event 2022-12-06 05:45:37 +00:00
Kirill Primak 097ea84cda output-layout: improve API
- wlr_output_layout_add{,_auto}() now return a bool indicating whether
  the function has succeeded.
- wlr_output_layout_move() is removed.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/1083
2022-12-05 18:21:04 +00:00
Kirill Primak 27ea18cc33 output-layout: remove wlr_output_layout_output_state
wlroots uses "// private state" comments to denote structure fields
which shouldn't be accessed by compositors, so let's drop
wlr_output_layout_output_state and inline its fields into
wlr_output_layout_output; this also simplifies layout output creation.
2022-12-05 18:21:04 +00:00
Kirill Primak 604df8b327 output-layout: fix function decl indentation 2022-12-05 18:21:04 +00:00
Simon Ser 532f3d3c20 xwayland/xwm: replace role with addon
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3545
2022-12-05 18:48:15 +01:00
Simon Ser 512deebd82 compositor: add wlr_surface.events.precommit 2022-12-05 10:51:46 +01:00
Simon Ser c4727240af compositor: document wlr_surface_{enter,leave,send_frame_done} 2022-12-03 16:52:32 +00:00
Alexander Orzechowski ec846adb54 wlr_drm: Add missing wlr_buffer import 2022-12-03 07:57:40 -05:00
Simon Ser 337ef33edc render/vulkan: make shm/dmabuf split clearer in wlr_vk_format_props
struct wlr_vk_format_props contains a mix of properties for shm
and dmabuf, and it's not immediately clear which fields are for
which kind of buffer. Use a nested struct to group the fields.
2022-12-02 15:18:59 +00:00
Simon Ser db9d277614 render/vulkan: make vulkan_format_props_find_modifier() return value const 2022-12-02 15:18:59 +00:00
Simon Ser f36a5915da wl-drm: don't store wlr_renderer
Query the formats at init time, then forget about the renderer.
This will allow wl_drm to be created with a list of formats instead
of a renderer, and will behave better after a GPU reset.
2022-12-02 14:27:07 +00:00
Simon Ser c9b378d21a render/drm-format-set: add wlr_drm_format_set_copy() 2022-12-02 14:27:07 +00:00