Commit graph

7565 commits

Author SHA1 Message Date
Attila Fidan
6c27c2cdf2 text_input: Don't relay IM state from unfocused windows
Otherwise, applications can enable their text input and affect IM state
while a different application is focused.
2025-06-14 09:19:17 +02:00
Attila Fidan
1ab573bf54 text_input: Ignore enable requests from unfocused windows
Unfocused windows shouldn't be allowed to activate the IM.

This fixes an issue with swaymsg invocations that contain several
commands which result in multiple swift focus changes. An application
briefly gets text input focus, sends an enable request, then sway
processes it and activates the IM only after the commands are all
finished and focus is on something else which did not send an enable
request.
2025-06-14 09:19:17 +02:00
Simon Ser
0a740a24d9 build: bump version to 1.12-dev 2025-06-09 16:27:18 +02:00
Callum Andrew
3d401d9390 config.in: bind XF86Audio* keycodes to playerctl 2025-06-09 15:56:41 +02:00
Simon Ser
6816b51c86 Remove trailing spaces 2025-06-05 18:15:56 +02:00
YaoBing Xiao
9fb9e9f7d5 server: fix socket path memory leak
The socket path allocated with strdup() in server_init() was
not being freed in server_fini().
Remove const qualifier and add proper cleanup.
2025-06-05 09:59:46 +02:00
Konstantin Pospelov
7e7994dbb2 swaybar: deduplicate mode and workspace rendering code
The render_workspace_button and render_binding_mode_indicator functions are
almost the same. This commit extracts the common rendering code into a new
render_box function.
2025-05-25 14:48:14 +02:00
Simon Ser
63689bfb83 Log message on for_window command error 2025-05-25 13:59:34 +02:00
Bonsaiiv
45267bb576 Improve example of input section in default config
Previous example included a specific device name. This can be confusing
for beginners, as the default did not work on most devices.
2025-05-24 16:29:03 +02:00
Kenny Levinsen
534491d3aa tree/workspace: Remove exclude arg from get_highest_available
workspace_output_get_highest_available took an output to exclude as
argument, meant to avoid accidentally reselecting an output we are
evacuating workspaces from.

Outputs are now removed from the list before we evacuate, making
exclusion unnecessary. Remove the argument.
2025-05-22 17:12:51 +02:00
Kenny Levinsen
005924f260 output: Minimize interaction with output after destroy
When an output is destroyed, we go through the process of disabling it.
This includes evacuating all content away from the output, which can
lead to various modifications to the scene. With the scene_output still
present, this can lead to things like output_enter events being emitted
for the output currently being destroyed.

Ensure that the scene output is destroyed first and that the output is
immediately considered disabled.

References: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3974
2025-05-22 17:12:51 +02:00
alex-huff
88c7b4a7eb transaction: fix floating fullscreen containers
8fecf3a introduced a regression where fullscreening a child of a
floating container would result in a black screen. This is because the
order of 'arrange_fullscreen' and 'arrange_worksplace_floating' was
swapped causing the fullscreen container's scene to get reparented after
it was parented in the fullscreen layer.

Fixes #8729
2025-05-21 21:38:27 -04:00
alex-huff
1b47277962 layer-shell: reclaim space from unmapped layer surfaces
wlroots resets 'initialized' when a layer surface is unmapped and sway
doesn't rearrange the layer surfaces in response to a commit of a
surface where 'initialized' is false. This results in space not getting
reclaimed from a recently unmapped layer surface until some other action
causes 'arrange_layers' to get called. This commit makes sure all layer
surfaces get rearranged when a layer surface is unmapped.
2025-05-21 20:33:27 -04:00
Simon Ser
5cfcd1c7c2 input: fix udev_device leak
libinput_device_get_udev_device() returns a ref'ed handle:
https://wayland.freedesktop.org/libinput/doc/latest/api/group__device.html#gac13c64ba19fc19094cff0e5354a2a7ce

Similar to this wlroots MR:
https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/5074
2025-05-20 17:54:44 +02:00
alex-huff
8fecf3aa8c transaction: reparent scenes of containers behind fullscreen containers
Currently we do a good job of reparenting the scenes of a container when
it moves into a disabled workspace. We need to do this since normally
the scenes are reparented in the 'arrange_{children,container}'
functions but these don't get called for disabled workspaces. However,
the 'arrange_{children,container}' functions also don't get called when
there is a fullscreen container hiding them.

This commit makes sure to call 'disable_workspace' on workspaces with a
fullscreen container so that when a container is moved into the
workspace its scenes will be properly reparented. Also, when there is a
fullscreen global container 'disable_workspace' is called for all
workspaces since the scenes of a previously fullscreen global container
may still be parented in the 'fullscreen_global' layer.
Fixes #8705 #8659 #8432
2025-05-19 18:46:09 -04:00
alex-huff
fb6d61b58f transaction: fix size of child container decorations in stacking layouts
Before this commit stacking containers with more than one child sized
the active container's decorations as if there was only one titlebar.
Commit a25645a introduced the local variable 'net_height' but
incorrectly calculated it for stacking containers. Fixes #8686.
2025-05-19 12:29:09 +02:00
odyxz
810142dcc4 raise scratchpad container 2025-05-18 23:52:08 +02:00
alex-huff
a4072486de transaction: ensure border scene is enabled for floating containers
When a container that was previously an inactive child of a tabbed or
stacking layout becomes floating it's border scene-tree remains
disabled. This results in only the titlebar being rendered for the
container. This commit ensures the border scene-tree is enabled when
arranging floating containers.
Fixes #8721
2025-05-18 17:00:39 +02:00
Bill Li
652019d6da input/text_input: chase wlroots update
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/5032

Fix #8718
2025-05-15 16:31:34 +02:00
GreyXor
3fbff5b4bb build: bump wlroots version 2025-05-15 11:53:32 +02:00
alex-huff
8d3a52aa30 move: fix broken titlebar when moving child to new workspace
Before this commit, when moving a non-leaf child of a tabbed or stacking
container to a new workspace, the child would be detached from the
parent container and the grandchildren would be sent to the new
workspace but the child itself wouldn't be destroyed causing the
titlebar to still be rendered as part of the parent container.
Fixes #8648.
2025-05-08 19:20:35 +02:00
Furkan Sahin
6021f4d83f input/seatop_down: Update decorations for touchscreen inputs
fixes #8675
2025-05-06 11:22:41 +02:00
alex-huff
4ab411cab0 transaction: Ensure all tabs are visible in tabbed mode
Before this commit when a child of a tabbed or stacking container was
taken out of fullscreen and a different sibling was focused in the same
transaction, the titlebar of the previously fullscreen container would
remain hidden. This commit makes sure that scene tree for decorations is
enabled for all containers within a tabbed or stacking container when it
is arranged.
2025-05-04 18:55:57 -04:00
Kenny Levinsen
f9945d81fb config/output: Fix missing output config supersedes
color_transform and allow_tearing was not handled by
supersede_output_config which could lead to configuration being
incorrectly applied.
2025-05-01 13:08:36 +02:00
Kenny Levinsen
8ac1f72c9e config/output: Use INT_MAX as x/y unset value
We oftne use -1 to indicate unset values. In case of output (x, y), we
would consider the fields set if they are not both -1. This means that
(0, -1) and (-1, 0) are valid coordinates, but (-1, -1) is not.

We support negative output positioning, so we cannot use -1 to mean
unset. Zero is also not an option as that would disallow reverting a set
position back to (0, 0).

INT_MAX is an unreasonable output position, so use it to indicate unset
values, and only use the value when both are set.
2025-05-01 00:00:50 +02:00
Pavel 'LEdoian' Turinsky
6cac61b6b9 Fix includes with relative paths
The function `load_include_configs` already changes the directory to the
one containing the parent config. Therefore, `load_include_config`
trying to assemble the "full" path leads to repetition of path segments,
making the `realpath` call fail with ENOENT.

Just calling `realpath` on the path itself from the directory with the
parent configuration is sufficient, so there is no point in passing
`parent_dir` to `load_include_config`.
2025-04-28 23:34:23 +02:00
Simon Ser
6894b498a8 build: bump version to 1.11-rc2 2025-04-27 22:52:48 +02:00
Furkan Sahin
5b8874e3f4 sway/commands: Handle incorrect resize unit
problem: an invalid usage of the command resize set will cause sway to crash because it doesn't check for an invalid height.
solution: validate height along with width.
2025-04-27 22:04:25 +02:00
Simon Ser
38a42f97d4 Replace signal() with sigaction()
The man page for signal(3) reads:

> new applications should use sigaction() rather than signal()
2025-04-27 18:42:12 +02:00
Simon Ser
0e19d85d37 Use pthread_atfork() to restore signals and NOFILE limit
This ensures these functions are always called (even when a library
such as wlroots or libc perform the fork) and removes the need to
manually call them.
2025-04-21 15:17:36 +02:00
Simon Ser
86ff19fade build: bump version to 1.11-rc1 2025-04-20 13:31:10 +02:00
Simon Ser
1d4632f97f Drop wl_drm again
In [1] we re-introduced a debug flag to enable wl_drm. Time has
passed and Xwayland + VA-API + amdvlk now all support
linux-dmabuf-v1.

[1]: https://github.com/swaywm/sway/pull/7916
2025-04-20 13:28:36 +02:00
Simon Ser
0153bc92ab server: move sway_terminate() definition to header 2025-04-17 23:31:55 +02:00
Simon Ser
d3e1c13e1f swaymsg, swaynag: drop sway_terminate() definitions
These are unused.
2025-04-17 23:31:55 +02:00
llyyr
8a8c78deac layer_shell: destroy layer_surface on assigned output destruction
According to the spec, the closed event should be sent when the surface
is no longer shown, because the output may have been destroyed or the
user may have asked for it to be removed. In such cases, the clients
should destroy the resource.

This fixes mako not being able to show notifications if the assigned
output was destroyed while a notificataion was still visible

Fixes: 188811f808 ("scene_graph: Port layer_shell")
2025-04-17 20:50:43 +02:00
Filip Vujičić
7733bf9963 Remove duplicate arrange_container 2025-04-17 19:05:36 +02:00
Simon Ser
3f0b3f8f9b Fix crash on shutdown when Xwayland is disabled 2025-04-14 10:21:18 +02:00
Loukas Agorgianitis
4943534929 server: fix shutdown crash when running on x11 backend
Signed-off-by: Loukas Agorgianitis <loukas@agorgianitis.com>
2025-04-14 09:30:49 +02:00
Ferdinand Bachmann
240a69ad63 server: recreate renderer in idle callback to avoid UAF
Destroying the wlr_renderer in a callback to its own renderer_lost event
is unsafe due to wl_signal_emit*() still accessing it after it was
destroyed.

Delegate recreation of renderer to an idle callback and ensure that only
one such idle callback is scheduled at a time by storing the returned
event source.
2025-04-13 23:40:56 +02:00
Ferdinand Bachmann
ab2e1f5817 tree/container: remove event listeners on destroy
Change begin_destroy to remove event listeners before the final destroy,
since otherwise event listeners would be removed twice, which crashes.

This fixes a crash in wlroots listener checks. See #8509.
2025-04-13 23:40:56 +02:00
Ferdinand Bachmann
53126cdceb input/text_input: remove event listeners on destroy
sway_input_method_relay can be destroyed from two sources, either the
seat is destroyed or the manager protocol objects are destroyed due
compositor exit.

This fixes a crash in wlroots listener checks. See #8509.
2025-04-13 23:40:56 +02:00
Ferdinand Bachmann
92c82e6952 desktop/idle_inhibit: remove event listeners on destroy
This fixes a crash in wlroots listener checks. See #8509.
2025-04-13 23:40:56 +02:00
Ferdinand Bachmann
e51ecf71aa input/input-manager: remove event listeners on fini
This fixes a crash in wlroots listener checks. See #8509.
2025-04-13 23:40:56 +02:00
Ferdinand Bachmann
0a9b0b83eb server: remove event listeners on fini
This fixes a crash in wlroots listener checks. See #8509.
2025-04-13 23:40:56 +02:00
Kenny Levinsen
583862e6d1 idle_inhibit: Check if layer surface output is enabled
While we we cannot easily check for true visibility of layer surfaces as
easily as for views, we can check at least check that the output
associated with the surface is enabled.
2025-04-13 16:24:02 +02:00
Kenny Levinsen
cc482228a4 idle_inhibit: Assume view is invisible by default
We have historically considered surfaces without a view visible. This
made sense in case of layer surfaces which do not have a view, but it
also allows unmapped surfaces to act as global inhibitors irrespective
of the current view state, which is not the intention fo the protocol.

As we now explicitly handle layer surfaces, assume that views are only
visible if they can be found and their visibility checked.
2025-04-13 16:24:02 +02:00
Kenny Levinsen
541183b322 idle_inhibit: Explicitly handle layer surfaces
Layer surfaces do not have a view, and while they can be occluded they
are always visible on their associated output - assuming it is enabled.
2025-04-13 16:24:02 +02:00
Kenny Levinsen
5e6a6ea340 idle_inhibit: Ignore inhibitors when locked
When a session is locked, no views are visible and there is no way to
interact with the user session. This means that all inhibitors based on
visibility - with the exception being inhibitors on the session lock
surfaces themselves - become inert, allowing the session to go idle.

The only inhibitor type on normal views that one could argue should
remain active is INHIBIT_IDLE_OPEN, but for now we disable all view
inhibitors regardless of type.
2025-04-13 16:24:02 +02:00
Daniel De Graaf
8f089f0229 Use wl_event_loop_add_signal for exit signals
This avoids calling non-async-signal-safe functions from within a signal
handler.
2025-04-12 23:10:39 +02:00
Furkan Sahin
cb246cb9c2 ipc: standardize pretty print with raw print
`swaymsg -t get_inputs --raw` calls it a pointer but `--pretty` calls it
a Mouse. Previous commit 6737b90cb that set this to pointer probably
forgo to update the pretty one.

closes #8584
2025-04-09 01:10:03 +02:00