Commit graph

7498 commits

Author SHA1 Message Date
Rémi Bernon
6c78225160 xwayland: Activate no_focus_window when a Wayland window is activated
None active window might be interpreted from an X point of view as a
transient focus state, and is used by multiple X window managers when
a temporary focus change is in progress, or simply when grabbing the
keyboard.

From Wine side, we translate any active window change to the Win32
application, and handling None active window as an actual window
deactivation and focus loss creates spurious events and an undesired
feedback loop, as apps might react to it.

We still want to be able to detect actual focus loss under an XWayland
session, and having XWayland window manager focus an actual X window
instead will make the distinction possible.
2025-06-12 08:56:09 +00:00
Rémi Bernon
83a5bdf5d5 xwayland: Create a dummy no_focus_window to use for non-X window focus 2025-06-12 08:56:09 +00:00
Kirill Primak
afe427d149 xdg-shell: add support for v7 2025-06-05 16:25:25 +00:00
DreamMaoMao
a08acfcee0 render/pass: Ensure the precision is consistent during comparison 2025-05-29 21:50:21 +08:00
Kirill Primak
af43d3b9e7 cursor-shape-v1: bump to version 2 2025-05-22 20:35:30 +03:00
Kirill Primak
aaeffe9769 cursor-shape-v1: use generated enum validator 2025-05-22 20:35:15 +03:00
David Turner
fae4c5097d xwayland: Remove has_utf8_title field 2025-05-22 15:10:26 +00:00
tokyo4j
170f7e0706 backend/libinput: don't leak udev_device 2025-05-20 01:15:19 +09:00
Guido Günther
2d5492c737 text-input-v3: Use NULL when emitting signals
Listeners can use `wl_container_of`.

Helps: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3851

Signed-off-by: Guido Günther <agx@sigxcpu.org>
2025-05-15 13:36:58 +00:00
Guido Günther
536100488f text-input-v3: Name new text input event correctly
Helps: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3851

Signed-off-by: Guido Günther <agx@sigxcpu.org>
2025-05-15 13:36:58 +00:00
Martin Rys
62c86fb975 Add support for XKB_LED_NAME_COMPOSE and XKB_LED_NAME_KANA USB HID LEDs
Requires xkbcommon 1.8.0
2025-05-15 09:14:48 +00:00
Simon Ser
c2327248f8 output: don't send make/model
- These are legacy wl_output properties [1]
- wl_output exposes name and description, which are better defined
- It's not clear what make/model/serial are for a virtual output
- Clients shouldn't rely on these fields

[1]: 8f1795f911/protocol/wayland.xml (L2508)

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/1623
2025-05-15 09:04:33 +00:00
David Turner
c9f0dbc159 Change all timespec pointers in events to owned
Follow-up from !4803.  Make things consistent by making all `struct
timespec`s in events owned.  Reduces the need for thinking about
ownership/lifetimes.
2025-05-15 08:59:56 +00:00
Simon Ser
f04ef79f61 build: bump version to 0.20.0-dev 2025-05-15 10:54:23 +02:00
Simon Ser
13a62a23a2 build: bump version to 0.19.0 2025-05-15 10:47:57 +02:00
Simon Ser
af34aaad53 xwayland: handle unset _NET_WM_NAME
The spec says [1]:

> If set, the Window Manager should use this in preference to WM_NAME.

However we overwrite WM_NAME with NULL when _NET_WM_NAME is unset.
Fix this by storing both WM_NAME and _NET_WM_NAME, so that we
handle properly all combinations of events (e.g. a client setting
both and later clearing one).

[1]: https://specifications.freedesktop.org/wm-spec/1.3/ar01s05.html#id-1.6.2
2025-05-15 10:23:01 +02:00
David Turner
2420bfef0b backend/drm: Fix segfault in libliftoff startup
With labwc and WLR_DRM_FORCE_LIBLIFTOFF=1, a segfault is seen on startup
because we call output_state_get_buffer_src_box() when there is no
buffer set in the output state.  Fix this by getting the src/dst box
from state->primary_viewport instead.
2025-05-08 10:13:57 +00:00
YaoBing Xiao
70add22e74 render/pixman: null check on newly created image 2025-05-07 21:33:22 +08:00
YaoBing Xiao
f36f856cdb render/drm_syncobj: fix return type mismatch 2025-05-06 17:48:54 +08:00
Kenny Levinsen
aef4de2ced wlr-foreign-toplevel-management-v1: Simply leave and destroy code
We send the output_leave event and destroy a toplevel_output both if our
output_leave listener is called, or if the underlying wlr_output is
destroyed.

We somewhat clumsily reused the output_leave listener, which meant that
even though we had the toplevel output, we went out of our way to let
the output_leave handler find said toplevel_output again.

Simplify both pathways by adding a toplevel_output_leave function.
Should have no functional changes.
2025-05-06 00:45:09 +02:00
Simon Ser
e57dd9c5ef render/vulkan: check binary semaphore in vulkan_sync_render_buffer()
Ensure the binary semaphore is available when we need it.
2025-05-05 22:17:11 +02:00
Simon Ser
d4e4c9f64b render/vulkan: create binary semaphore when signal timeline is supplied
We were only creating the binary semaphore when implicit sync
interop was available. We also use the binary semaphore when
explicit sync is enabled.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3973
2025-05-05 22:17:04 +02:00
YaoBing Xiao
22db307e4c backend/drm: assign plane_id from function parameter instead of drm_plane 2025-04-30 17:10:45 +08:00
Simon Ser
156d47c866 build: bump version to 0.19.0-rc3 2025-04-27 22:48:44 +02:00
Isaac Freund
80f33cd350 presentation-time: make version a uint32_t
This is consistent with wlr_xdg_shell_create(), wlr_shm_create(),
wlr_layer_shell_create(), etc.
2025-04-27 20:42:57 +00:00
Isaac Freund
7dd8fdf76c tablet-v2: cleanup focused surface on tool destroy
Currently the surface_destroy listener may not get removed if
destroy_tablet_tool_v2() is called while the tool is in proximity to a
surface.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3969
Reported-by: Hooman Ise
2025-04-27 16:57:50 +00:00
YaoBing Xiao
648aee65ad backend/drm: rename conn_name to conn_type_name for clarity 2025-04-27 15:33:36 +00:00
tokyo4j
86976870bd wlr_keyboard_group: fix leak of wlr_keyboard_group->keys
If the underlying wlr_keyboard emits duplicated key-presses,
wlr_keyboard_group->keys might not be empty even after calling
wlr_keyboard_group_remove_keyboard() for all of the keyboards.
2025-04-25 03:23:26 +09:00
tokyo4j
bd8454d3bc Revert "wlr_keyboard: don't emit key event for duplicated keycodes"
This reverts commit 86eaa44a3a.

That commit caused a regression for IME users in many compositors:
when a input_method is activated while a key is pressed, and a virtual
keyboard is created by IME, the following key-release event via the
virtual keyboard is missed since the key in the virtual keyboard haven't
been pressed. For example, pressing and releasing Ctrl+F in Firefox with
fcitx5 running triggered repeated keys (ffffff...) in the opened input
box.
2025-04-25 03:23:21 +09:00
Isaac Freund
e9450a9947
xdg-activation: make wl_global public
This is currently inconsistent with everything else in wlroots.
2025-04-24 13:20:11 +02:00
Simon Ser
78aaaaf7b6 Revert "xwayland: Reset signal mask and handlers before exec"
This reverts commit 954dba3968.

Motivations:

- This only resets some state, but other global state such as other
  signal handlers, process limits (e.g. NOFILE) or system-specific
  settings are left as-is. The chunk of state which does get reset
  is opinionated.
- Compositors have other ways to do this, e.g. with pthread_atfork()
  or with empty signal handler callbacks.
2025-04-20 21:12:33 +02:00
Simon Ser
b9d3ee9a2c build: bump version to 0.19.0-rc2 2025-04-20 13:21:10 +02:00
Kirill Primak
7bf669fb5c xdg-surface: fix geom for surfaces that don't set it explicitly
If a surface which relies on the default window geometry (e.g. wlroots'
Wayland backend output) gets resized, the geometry doesn't get updated.
This commit fixes that. Additionally, the fallback is the explicitly
set window geometry now, not the extents; this works better for
Chromium.
2025-04-19 16:42:56 +03:00
M Stoeckl
8dab5f838d color-management-v1: implement surface_feedback_v1::get_preferred_parametric 2025-04-19 08:20:37 -04:00
YaoBing Xiao
3ad4374a54 backend/drm: add DRM object and property IDs to error 2025-04-18 17:36:05 +08:00
Kirill Primak
ed2406621a xdg-surface: don't disconnect clients for bad effective geom yet
Preferably, the geometry computation would've been done at the client
commit time, but this requires correct subsurface state management which
we don't have at the moment. The next best solution, which is computing
the geometry on server commit time, doesn't currently have a way to
prevent user commit handlers from firing, meaning that compositors might
get an invalid surface state. Additionally, Chromium and gtk-layer-shell
turned out to violate the protocol in this regard, so client
disconnection leads to really bad UX.

As such, complain via a log message instead, and ignore invalid
geometry, falling back to the bounding rectangle.
2025-04-17 15:17:31 +03:00
Philipp Kaeser
f8c639f19a output_layout: Fixes docstring for wlr_output_layout_add[_auto]. 2025-04-16 19:57:33 +02:00
Kirill Primak
5fd43add1c Fix/cleanup includes a bit 2025-04-15 20:13:29 +03:00
Kenny Levinsen
4277d8cfdc scene: Fix scanout log to respect SCANOUT_SUCCESS
scene_entry_try_direct_scanout returns a tristate value, but the log
message was not updated to account for this.

Compare whether or not the state is specifically SCANOUT_SUCCESS for
logging purposes.

Fixes: c450991c4b
2025-04-14 20:36:09 +02:00
Kenny Levinsen
867960d6f4 compositor: Clean up surface current_outputs last
During surface resource cleanup, several signals will be emitted. If any
of these end up calling wlr_surface_send_enter, a new output could be
added to the current_outputs list. This would result in a leaked
surface_output and a dangling wlr_surface pointer.

Clean up current_outputs last.

References: https://github.com/swaywm/sway/issues/8650
2025-04-14 12:46:02 +02:00
Yixue Wang
d7527778bb wlr_client_buffer: add get_shm implementation 2025-04-13 20:48:59 +00:00
Kirill Primak
5dc73937ff xdg-surface: ensure that the effective geom is not empty
Fixes: 5c98d1a04a
2025-04-13 13:26:26 +03:00
Simon Ser
7161bcfabc build: bump version to 0.19.0-rc1 2025-04-12 22:50:55 +02:00
Olivier Tilloy
1e7baefe96 seat/keyboard: optimize wlr_seat_set_keyboard to send the keymap only if it has changed 2025-04-11 16:56:36 +02:00
Kirill Primak
9c9bf2efee xdg-system-bell-v1: set proper global/resource user data
See https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3963.
2025-04-11 14:04:23 +00:00
David Turner
0bf0c55ad2 scene: Move single-pixel buffer things to scene_buffer
Move single-pixel buffer status cache from wlr_scene_surface to
wlr_scene_buffer, it makes more sense there and means the optimisations
will still work if wlr_scene_buffer is used without wlr_scene_surface.
2025-04-11 14:01:35 +00:00
Kenny Levinsen
c450991c4b wlr_scene: Debounce dmabuf feedback on scanout
Direct scanout can be enabled and disabled on a frame-by-frame basis,
and so we could end up sending different feedback to a surface on every
other frame. Reacting to new feedback is expensive, as the client may
need to reallocate their swapchain.

Debounce the state change a number of frames, for now set to 30, to
avoid immediate reaction to scanout (or composition) that only lasts a
few frames.

A timer could be used instead, but it did not seem worth the complexity.
What just want to know that the state has been stable across a
reasonable number of samples, and a counter seems sufficient for that.
2025-04-10 12:44:03 +00:00
David Turner
792bee9657 scene: Optimize rendering of single-pixel buffers
The single-pixel buffer protocol is used to allow wayland clients to
easily draw solid-color rectangles by presenting a 1x1-pixel buffer and
scaling it to the desired size.  This patch improves how these buffers
are then handled in the scene-tree renderer.

We already ignore opaque black rectangles at the very bottom (and
anything under them) because we assume we'll be rendering on a black
background.  This patch detects black opaque single-pixel buffers and
handles them in the same way as black opaque rectangles.  It also
renders single-pixel buffers as rectangles rather than buffers because
this is probably more efficient in the underlying renderer.

In wlr_scene_surface we cache whether the attached buffer is a
single-pixel buffer.  This is done because the
wlr_single_pixel_buffer_v1 will be destroyed after texture upload, after
which it becomes much more annoying to check if the buffer is a
single-pixel buffer.
2025-04-07 13:28:51 +01:00
David Turner
5563d23b81 single-pixel-buffer: Add try_from_buffer() function
Add wlr_single_pixel_buffer_v1_try_from_buffer() and move `struct
wlr_single_pixel_buffer_v1` to wlr_buffer.h. This allows other code to
find out if a wlr_buffer is a single-pixel buffer and, if so, find out
what color it is.
2025-04-07 13:25:42 +01:00
Simon Ser
709fc8fd8e ext-data-control-v1: fix types in wl_list/wl_signal comments
These refer to the wlr protocol types.
2025-04-06 10:09:54 +00:00