Commit graph

4863 commits

Author SHA1 Message Date
Willow Barraco
7998d8f7fa
Skip checking if criteria is matching the view when not mapped
Multiple checks in this method use view->container, but it can be NULL
at some points. Bail early to avoid crash.
2026-03-01 07:59:32 +01:00
Simon Ser
fa497964fd Add support for keypad slide switches
See the libinput docs:
https://wayland.freedesktop.org/libinput/doc/latest/api/group__device.html#gga507e97278f2eb7d2271023ef2a3d31a4aed050386a5b52b2b51d05d95bb594c30
2026-02-13 11:14:13 +01:00
André Marçais
438010938c Fix logical error in criteria matching
When evaluating a __focused__ pattern, sway's logic is to consider the
pattern match to have failed for a given view and attribute if a view is
focused and the value of attribute in question of the focused view is
not that of the view in question. Expected behaviour is that the pattern
matches if there is a focused view and that the values of the attribute
for the focused view and the other view are equal. (See #6753, which is
the case where the `workspace` attribute is matched against.). I.e., if
we write out the function `criteria_matches_view` as a logical formula,
expected behaviour is

    criteria_matches_view(criteria, view) <=>
        forall (attribute, pattern) in criteria,
        (pattern is __focused__ and
            focused view exists and view.attribute == focused.attribute)
        or
        (pattern is not __focused__ and view.attribute =~ pattern)

but it is actually (pay attention to the fourth line)

    criteria_matches_view(criteria, view) <=>
        forall (attribute, pattern) in criteria,
        (pattern is __focused__ and
            (no focused view or view.attribute == focused.attribute))
        or
        (pattern is not __focused__ and view.attribute =~ pattern).

Fix program logic to reflect (the disjunctive form of) the first formula
to be compatible with i3. (In passing, this fixes #6753.)
2026-02-12 09:53:35 +01:00
Calvin Lee
845cdb190f sway: add details to unsupported gpu nag 2026-02-03 16:07:39 +01:00
Calvin Lee
992d201512 sway: change unsupported GPU message to swaynag
This commit shows a swaynag message when an unsupported GPU is detected
which must be acknowledged by users. It also adds an environment
variable (`SWAY_UNSUPPORTED_GPU`) which may be used instead of the
`--unsupported-gpu` argument.

The `static` storage class for flag variables in main has also been
removed, as this should have no effect on the program.

Resolves: #8999
2026-02-03 14:16:11 +01:00
Furkan Sahin
b081eba05d bar_cmd_colors: fix crash on incorrect usage
should display error message instead to be consistent with other
subcommands.
2026-02-02 18:12:08 +01:00
llyyr
e3c2412565 sway: advertise color_manager_v1 version 2
Ref: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/5223
2026-01-29 00:46:03 +01:00
Ole
40aabb80c6 sway-ipc(7): Clarify that the reply shown is an example
Fix documentation of sway-ipc. The example reply for GET_BINDIG_STATE is an example and not the exact reply. 

This bug seems to come from copy/paste from the ipc command SYNC directly above.
2026-01-14 10:33:51 +01:00
Rex Fernando
3c0588a44f sway/input/cursor: fix crash on first stylus tap after reboot via null check
handle_tool_tip() previously used event->tool->data without checking
for NULL. When launching sway for the first time after a reboot, and
then tapping with a USI 2.0 stylus, the tool tip event is fired before
the tool proximity event. As event->tool is initialized during the tool
proximity handler handle_tool_proximity(), this was causing a crash.

The fix adds a NULL check before accessing the fields of
event->tool->data. In case of a NULL, a log message is emitted
indicating that the tool tip event fired before proximity. This logic is
identical to the logic in handle_tool_axis().

Fixes issue #8907
2026-01-08 18:49:51 +01:00
Simon Ser
8224d5fcf8 Disable Xwayland restacking for toplevel capture scenes
The main scene should drive Xwayland restacking.

References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/5108
2026-01-06 11:21:33 +01:00
Simon Ser
c09d0f1d4a Use goto-based error handling in view_init()
This is less surprising than checking for the failed flag in the
happy path.
2026-01-06 11:21:33 +01:00
llyyr
723b1ea3b7 sway/input/seat: chase wlroots breaking change
Ref: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/5230
2026-01-05 16:30:20 +01:00
Félix Poisot
26eb393d6d sway/commands/output: add color_profile "--device-primaries"
When a display is connected, create a color transform from its
self-reported color characteristics
2026-01-04 19:48:23 +01:00
Félix Poisot
776d445ec5 sway/commands/output: color_profile "srgb" applies the piece-wise TF
Document that "gamma22" replaced the previous default.
2026-01-04 19:48:23 +01:00
Félix Poisot
f654fe8ede sway/config: apply output CT before initial commit
Currently, config apply sets the output's image description before the
initial commit, but sets the output's color transform after the commit.

In the case of a config reload removing a color profile and enabling
HDR, both the color transform and image description will be set, which
trips an assert in wlroots
2026-01-04 19:48:23 +01:00
Simon Ser
dbe8640035 desktop/xdg_shell: skip configure in request_maximize handler if unmapped
wlr_xdg_surface_schedule_configure() requires the xdg_surface to
be initialized.

Mirror the early return from request_fullscreen.
2025-12-21 16:38:06 +01:00
llyyr
238f0d4a8b tiling_resize: fix use-after-free on view unmap during resize
Closing a tiled window (mod+shift+q) while resizing (mod+click) causes
an use-after-free in handle_unref.

Both conditions can be true in this case, which will result in
dereferencing `e` on the second check after it has already been freed by
the first `seatop_begin_default`.

Fix by combining separate checks for the main container and its
horizontal/vertical siblings into a single condition.

The second check was added in 9e272a7986
and I've checked that this fix does not regress that issue.
2025-12-19 14:05:18 +01:00
Simon Ser
fa81ce8ee6 Use helpers to get supported TFs/primaries
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/5086
2025-12-18 15:25:24 +01:00
johnpyp
897e7688bb commit dirty transactions upon window attribute changes 2025-11-22 16:35:19 +01:00
Damino
842ea06773 tree/view: check for null workspace output
Fixes #8950
2025-11-22 14:41:35 +01:00
llyyr
d735bb99a9 sway/server: advertise wlr_color_representation_manager_v1 2025-11-13 17:02:47 +01:00
llyyr
055be4ec35 sway/server: advertise gamma2.2 and bt1886 transfer functions 2025-10-28 23:34:18 +01:00
bonsaiiV
b7eb6177e1
sway/commands/layout: fix flatten parent once
Fixes: f50e307227 ("sway/commands/layout: flatten parent once")
2025-10-18 18:55:46 +02:00
llyyr
90d3270970 sway/input/cursor: send frame event when simulating pointer from tablet 2025-10-05 19:46:53 +02:00
Louis POIROT--HATTERMANN
ecfea6b8ae commands/scratchpad: don't hide scratchpad if no pending workspace
Fixes: https://github.com/swaywm/sway/issues/8909
2025-10-05 19:22:48 +02:00
llyyr
d9e615c507 sway/server: set color_manager for root scene
Chase https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/5122/
2025-09-23 23:50:15 +02:00
Simon Ser
a7d9535eb3 input/text_input: stop using listener data
These are now NULL.

Fixes: aaab7f961e ("input/text_input: chase wlroots update")
Closes: https://github.com/swaywm/sway/issues/8864
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/5107
2025-09-15 07:41:51 +02:00
Nikola Kocic
c5456be750 xdg-shell: fix reported WM capabilities
Previously it was reporting window_menu and maximize instead of fullscreen because wlr_xdg_toplevel_set_wm_capabilities expects a bitmask (WLR_XDG_TOPLEVEL_WM_CAPABILITIES_*), and XDG_TOPLEVEL_WM_CAPABILITIES_* are supposed to be used as values in wl_array, so the values are different:
XDG_TOPLEVEL_WM_CAPABILITIES_FULLSCREEN = 3
WLR_XDG_TOPLEVEL_WM_CAPABILITIES_FULLSCREEN = 4
2025-09-09 13:55:46 +02:00
Bill Li
aaab7f961e input/text_input: chase wlroots update
References:https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/5107
2025-09-08 15:54:59 +00:00
Kenny Levinsen
73c244fb48 config/output: Only error when enabling HDR
We currently emit errors about HDR support even if HDR is not being
requested, which mean errors on every regular modeset when monitors not
supporting HDR are connected.

Only emit errors when attempting to enable HDR on such device.
2025-08-22 15:49:09 +02:00
Simon Ser
b3dcde8d69 Stop generating wayland-protocols server headers
We still need to generate wlr-protocols server headers, as well as
client headers and code.

References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/5075
2025-08-14 10:09:59 +02:00
Joaquim Monteiro
0770a8d643 Add wl_fixes interface 2025-08-13 22:58:21 +02:00
Tim Hallmann
340505bb6f commands/resize: make resize consider all siblings
Fixes a compatibility issue with i3 where resizing works as described
hereafter:
> Direction can either be one of up, down, left or right. Or you can be
> less specific and use width or height, in which case i3 will take/give
> space from all the other containers.

Sway previously considered only the direct neighbours, not all siblings.

Fixes #5936
2025-08-03 20:15:39 +02:00
bonsaiiV
f50e307227
sway/commands/layout: flatten parent once
Applying layout changes to the parent of the parent, in case the parent only has a single child, stops the creation of a chain of single child containers.

Closes: https://github.com/swaywm/sway/issues/7945
2025-08-03 15:25:40 +02:00
Tomasz Buczyński
87fbcf0574 Add cursor->hidden check to handle_rebase
Fixes #6245
2025-08-03 15:01:21 +02:00
Kenny Levinsen
357d341f8f tree/node: Do not mark destroying nodes as dirty
Node destruction currently runs through the transaction system such that
a particular node is only destroyed after its use in an ongoing
transaction. If a node is dirtied after the node is marked as destroying
but before it is destroyed, the pointer added to dirty_nodes would
become a dangling pointer once the node was destroyed.

Do not dirty destroying nodes, and ensure that destroying is only set
after the last dirty.
2025-07-31 15:57:28 +02:00
Simon Ser
14fbe9242f Revert drag_lock default to disabled
I misunderstood the recommendation in the libinput release notes.
Instead of making enabled_sticky the default, leave the default
set to disabled.

Fixes: bbadf9b8b1 ("Add support for LIBINPUT_CONFIG_DRAG_LOCK_ENABLED_STICKY")
Closes: https://github.com/swaywm/sway/issues/8758
2025-07-29 09:41:19 +02:00
Fenveireth
e50b16a699 tree/view: save new wlr_scene_buffer fields
Visble flicker can occur during transactions, if these are not copied
to the 'saved' scene
2025-07-20 15:16:03 +02:00
Simon Ser
cb33701f5e Add xdg_toplevel tag to criteria 2025-07-16 10:03:09 +02:00
Simon Ser
08142c3f3a Add xdg_toplevel tag to IPC 2025-07-16 10:03:09 +02:00
Simon Ser
3826535ab0 Wire up xdg-toplevel-tag-v1 2025-07-16 10:03:09 +02:00
Simon Ser
94c819cc1f Add features.hdr to output IPC response 2025-07-09 01:25:11 +02:00
Simon Ser
6fed1f9d89 Add support for color-management-v1
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4962
2025-07-09 01:25:11 +02:00
Simon Ser
bac8c0f4d0 Add support for HDR10 output 2025-07-09 01:25:11 +02:00
Simon Ser
c7d7d56f61 ipc-json, swaymsg: indicate when adaptive sync is unsupported 2025-07-08 15:58:53 +02:00
Simon Ser
a1ac2a2e93 Drop sway_output.events.disable
In general wl_signal isn't well-suited for Sway: Sway doesn't need
any modularity, and signals make it trickier to track down exactly
what happens down the stack.

Replace Sway's output disable signal with a simple list tracking
for the only user.
2025-07-02 21:21:53 +02:00
Kenny Levinsen
56f2db062d Revert "sway/tree: Simplify sway_node teardown"
This reverts commit e28e6484e8.

This change tried to remove nodes from all points of reference to allow
immediate destruction. However, it missed things like the children lists
cloned by transaction states of parent nodes.

Adding all that extra cleanup would not be in the spirit of a PR
claiming to simplify teardown. Let's wait for someone to come up with a
cleaner approach instead.

Fixes: https://github.com/swaywm/sway/pull/8738
2025-06-28 11:26:49 +02:00
Kenny Levinsen
0cd45d4ad2 Revert "tree/container: Remove child from all lists"
This reverts commit 3d6b9a2848.
2025-06-28 11:26:49 +02:00
Kenny Levinsen
3d6b9a2848 tree/container: Remove child from all lists
When a container is detached, we need to remove it from any lists it may
be part of. We use container_get_siblings to obtain the relevant list,
find our entry and remove it.

If the container is in a later list than the one returned by
container_get_siblings, or is in multiple lists for some reason,
container_detach will fail to remove the container, leaving a dangling
pointer when the container is freed.

Instead of calling container_get_siblings, check and remove the
container from all lists.
2025-06-26 22:05:05 +02:00
Kenny Levinsen
e28e6484e8 sway/tree: Simplify sway_node teardown
A sway_node may end up being referenced in either a queued transaction,
pending transaction or as a dirty node. To manage this, the transaction
system has been responsible for destroying containers, workspaces and
outputs at the end of their last referenced transaction.

This significantly complicates the teardown flow of surfaces and
outputs. Instead, remove the node from transactions and dirty lists so
that the callsite can remove and free the node immediately.
2025-06-26 22:05:05 +02:00