Commit graph

7488 commits

Author SHA1 Message Date
Jacob McNamee 0b08dce08c swaymsg: pretty-print sandbox properties 2025-01-13 08:54:23 +01:00
Jacob McNamee f177d05441 tree/container: support sandbox properties in title format 2025-01-13 08:54:23 +01:00
Puck Meerburg 3ab1f0ca3d criteria: add sandbox properties 2025-01-13 08:54:23 +01:00
Puck Meerburg 60f06fc4f1 ipc-json: add sandbox properties to view JSON 2025-01-13 08:54:23 +01:00
Jacob McNamee cff16d32f9 tree/view: add getters for sandbox properties 2025-01-13 08:54:23 +01:00
Jim e3f0ba4cd9 Increase max default buffer size to 1 MiB
Increasing the max default buffer size prevents clients from crashing
when they need more than 4096 bytes. This can happen when the GUI thread
of the application is blocked, especially when moving your mouse over it
with high mouse sensitivity.
2025-01-12 22:38:04 +01:00
llyyr 3629a832e5 layer_shell: cleanup new_popup listener when destroying node 2025-01-11 10:32:08 -05:00
Simon Ser a6c0441ee0 config/output: don't hardcode DMA-BUF in search_render_format()
We could be running with a backend which doesn't support DMA-BUFs,
e.g. inside a parent Wayland compositor without GPU acceleration.
2025-01-08 11:57:45 +01:00
mtvare6 c7c0a5a1b3 config/output: skip format checks if all are supported
Fixes #8496
2025-01-08 08:25:39 +01:00
Simon Ser a1838c5522 Fix has_prefix() comparisons with 0
has_prefix() returns a bool, unlike strncmp() which returns an int.

Fixes: 0c60d1581f ("Use has_prefix() instead of strncmp() throughout")
Closes: https://github.com/swaywm/sway/issues/8527
2025-01-07 18:56:02 +01:00
Simon Ser 0c60d1581f Use has_prefix() instead of strncmp() throughout
This is safer than hardcoded string lengths.
2025-01-07 16:35:31 +01:00
Simon Ser c55dff95bc stringop: move over has_prefix() 2025-01-07 16:35:31 +01:00
Hong Xu 801bc76ce3 Explain that the title bar always shows 2024-12-21 11:37:50 +01:00
Alexander Orzechowski f293418d9d swaybar: Handle opaque region properly
The background color can be set individually for the different
elements of the bar. If any of the backgrounds have transparency, we have
to bail out from advertising an opaque surface.
2024-12-08 18:28:25 +01:00
Baltazár Radics 4eb86fce07 input/libinput: fix parsing input drag_lock command
Regression introduced by by b160fac9f7a
2024-12-08 16:15:48 +01:00
György Kurucz 1d783794b5 input/libinput: fix builtin device detection logic
Fixes: #8468
2024-11-23 11:17:17 +01:00
Violet Purcell 4faf0f9098 tree/container: remove output_{enter,leave} listeners in destroy
0d6cc471e9
added an assert that all signals are clear when destroying a
wlr_scene_buffer, which is currently triggering due to sway not removing
the output_enter and output_leave listeners on the container before
calling wlr_scene_node_destroy on output_handler. Remove the listeners
before wlr_scene_node_destroy is called.
2024-11-23 13:10:06 +03:00
Simon Ser bbadf9b8b1 Add support for LIBINPUT_CONFIG_DRAG_LOCK_ENABLED_STICKY
Use it as the default, as recommended by the libinput release
notes:
https://lists.freedesktop.org/archives/wayland-devel/2024-November/043860.html
2024-11-23 13:06:49 +03:00
Simon Ser e2409aa496 ipc-json: handle LIBINPUT_CONFIG_DRAG_LOCK_ENABLED_STICKY
New entry introduced in libinput 1.27.0.
2024-11-23 13:06:49 +03:00
Kenny Levinsen 5312376077 desktop/output: Clear repaint timer earlier in destroy
The teardown of a sway_output is split in two: begin_destroy and
output_destroy. The former clears some state such as NULL'ing the
reference to wlr_output, while the latter frees the struct and its
remaining resources.

If an output is destroyed while a repaint timer is pending, future frame
callbacks will no longer occur as the listener is torn down in
begin_destroy, but the repaint timer is not torn down and may still
fire until output_destroy is hit. As begin_destroy cleared the reference
to wlr_output, this leads to a NULL-pointer dereference.

Tear down the repaint timer in begin_destroy as there is no need for it.

Fixes: fdc4318ac6 ("desktop/output: Clear frame_pending even output is disabled")
2024-11-17 16:03:35 -05:00
mtvare6 fec3da7d58 commands/include: handle many files in single line
i3 supports including multiple files in a single line, whereas sway
limits to single file per line.
2024-11-17 19:18:51 +01:00
Kenny Levinsen a2c73c9b8b ipc-server: Force modeset if needed after executing commands
IPC clients generally expect executed commands to have taken effect when
the command completes, while delayed modeset means that it can take
several milliseconds more before e.g. an output is enabled.

However, modesetting on every output command in the IPC call could on
systems with already slow modesetting behavior lead to an unresponsive
system for a not insignificant period of time.

To strike a balance, force modeset once all the commands of this IPC
call have executed if a modeset is pending.
2024-11-17 19:11:58 +01:00
Kenny Levinsen 6111297d91 config: Force modeset before running deferred configs
Some commands require outputs to be enabled. These commands are deferred
to allow outputs to be discovered, but the delayed modeset might only
run some time later.

Force a modeset to occur before running deferred commands.

Fixes: https://github.com/swaywm/sway/issues/8433
2024-11-17 19:11:58 +01:00
Solt Budavári 96db66abf0
Fix orthographic mistakes in Hungarian README
Fix a few mistakes so the text conforms to
Hungarian orthography. The following rules were
applied (the whole linked page is in Hungarian):

- <https://www.helyesiras.mta.hu/helyesiras/default/akh12#110>
- <https://www.helyesiras.mta.hu/helyesiras/default/akh12#112>
- <https://www.helyesiras.mta.hu/helyesiras/default/akh12#113>
- <https://www.helyesiras.mta.hu/helyesiras/default/akh12#215>
- <https://www.helyesiras.mta.hu/helyesiras/default/akh12#244>
2024-11-16 14:47:50 +01:00
Kenny Levinsen fdc4318ac6 desktop/output: Clear frame_pending even output is disabled
frame_pending should always be cleared once the repaint callback is
fired to ensure that future frame scheduling is not accidentally held
back.
2024-11-11 14:36:33 +01:00
Kenny Levinsen 463c4c9369 desktop/output: Clean up output state if build_state fails
wlr_scene_output_build_state can fail for various reasons. Ensure that
the pending output state is cleaned up in that case.
2024-11-11 14:36:33 +01:00
Joan Bruguera Micó f23d100747 swaybar: Emit property changes for SNI watcher
Emit property change signals for the IsStatusNotifierHostRegistered and
RegisteredStatusNotifierItems properties in StatusNotifierWatcher,
so code relying on the PropertiesChanged signal, instead of signals
such as StatusNotifierHostRegistered, can work properly.

A library that is affected by this is the libappindicator-gtk3* library
and it can cause tray icons to be missing after starting swaybar due to
a race condition, as follows:
* An application using libappindicator-gtk3 starts, e.g. nm-applet.
* Some time later, swaybar starts.
* swaybar creates the StatusNotifierWatcher.
* libappindicator-gtk3 observes the new watcher, but it sees that
  IsStatusNotifierHostRegistered=false, so it falls back to the
  Freedesktop System tray protocol.
* swaybar creates the StatusNotifierHost.
  At this point, libappindicator-gtk3 should "un-fallback" back to SNI.
  However, since swaybar does not emit the PropertiesChange signal on
  IsStatusNotifierHostRegistered, libappindicator-gtk3 doesn't get
  notified, and stays in fallback state forever.
* As a result, nm-applet will not show in the swaybar tray.

This race can be made reliable by inserting a 1-second long sleep here:
03483ff370/swaybar/tray/tray.c (L57)

(*) Note that the libappindicator-gtk3 library has been mostly replaced
    by libayatana-appindicator, which is not affected by this.
    The affected version is still used by Arch Linux, source code at:
    https://bazaar.launchpad.net/~indicator-applet-developers/libappindicator/trunk/files/298
2024-11-10 20:42:02 +01:00
Manuel Stoeckl 03483ff370 swaynag: fix null dereference on scale change
If cursor-shape-v1 is available, the old wl_cursor_theme path should
not be used.
2024-11-09 02:33:48 +01:00
mtvare6 62fd8c4d01 desktop/transaction: clamp vertical border length to 0
Fixes #8120
2024-11-07 22:41:14 -05:00
Kenny Levinsen 78fa4e9856 config/output: Update output position in two passes
The modeset logic iterates over all outputs at the end, sets their new
position in the layout and takes a copy of its geometry that is later
referenced by layout and scene management code.

If one output is auto configured, then a later output that is manually
configured can lead to the first output being moved without the stored
geometry being updated.

Split this into two passes: The first pass finalizes the output config
and makes updates to the layout, while the second pass updates the copy
of the geometry and arranges things as a result of it.
2024-11-06 01:28:55 +01:00
Alexander Orzechowski 4cfcb3643b container: Properly constrain title bar padding
Important for centered titles
2024-11-04 19:02:16 +01:00
Simon Ser d417a8fcd0 release.sh: read meson-rewrite output from stdout
Since version 1.6, Meson now uses stdout:
3f4957c713
2024-10-31 10:31:38 +01:00
Kenny Levinsen f38719f575 desktop/output: Add missing output config allocation checks 2024-10-30 19:56:07 -04:00
Kenny Levinsen 1e53007bc3 desktop/output: Store output config on request_state
An output backend might request any change to an output state at any
time, although currently only this is currently only used for changing
window size on the wayland and x11 backend.

Applying the configuration directly means that the current output state
becomes inconsistent with the configured state, which can cause the new
state to be reverted later if apply_stored_output_configs is called.

Before 4f9ce4675c. the output geometry would be updated by
arrange_outputs, but this is only done by the modeset logic now,
resulting in the stored geometry never being updated on wayland backend
window resize. This was not discovered as the stored geometry is not
used particularly often.

Solve both by storing a new output configuration and relying on the
modeset logic to apply a new state.

Fixes: 4f9ce4675c ("tree/arrange: Remove redundant output geometry update")
2024-10-30 19:56:07 -04:00
AsciiWolf e7c972b04a Remove language bars from remaining non-English README files 2024-10-28 14:06:01 +01:00
llyyr 839434abc0 sway/server: bind to presentation-time-v2
Depends on: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4858
2024-10-27 19:20:20 -04:00
Kirill Primak 015e357fce desktop/output: chase wlroots private fields update
This will be replaced with a proper solution later.
2024-10-25 17:42:35 +02:00
Kenny Levinsen a63027245a config/output: Remove remaining logs from queue_output_config
The job of queue_output_config is now just to fill out a
wlr_output_state according to the output configuration, but it still has
a lot of logging from before we had wlr_output_state or the new modeset
logic, when queue_output_state instead touched the implicit pending
state of wlr_output.

Whatever debug logs it had would already be covered by the output state
debug logs or the command debug logs, so let's just remove it.
2024-10-20 12:22:12 +02:00
Kenny Levinsen 17ecb9eb1d config/output: Remove initial values in find_output_config
Starting by setting some special initial output config values settings
was something sway used to do when the config was initially being
processed. This was later changed to always happen, as there shouldn't
be differences in how output config is calculated during config load and
after.

Most of these values are redundant, as they are either the zero value or
a value that would be selected if the unset (-1) value was found.

For output transforms, the automatic panel orientation code would only
trigger if the final output config has an unset transform, which the
initial values set in find_output_config made impossible.

Remove these initial values and instead use a fresh output config as is.
2024-10-20 12:22:12 +02:00
Kenny Levinsen af0d4a048a config/output: Always set all output fields on finalize 2024-10-20 12:22:12 +02:00
Kenny Levinsen 7e0c0dda42 config/output: Always set output states from config
queue_output_config had some remaining logic that would avoid setting
output states if they already appeared to be in effect. That is not what
most of the states did nor what is currently expected, so clean that up.
2024-10-20 12:22:12 +02:00
Kenny Levinsen 7d93652105 config/output: Improve modeset state logging
Include scale and subpixel in the output state log, and log the output
state on first commit attempt instead of just during fallback search.
2024-10-20 12:22:12 +02:00
Simon Ser 35d8adefc4 input/seatop_default: refactor move/resize button logic
Make it so config->floating_mod_inverse only applies when pressing
mod, not when clicking on titlebars.

Centralize logic into shared variables.
2024-10-20 00:26:09 -04:00
Alexander Orzechowski 8363699f14 layer_shell: Restore sway 1.9 ordering 2024-10-18 14:10:28 +02:00
Alexander Orzechowski ce6b2db0f2 layer_shell: Arrange exclusive zone clients first
This makes layer_shell more stable against the order of clients.
2024-10-18 14:10:28 +02:00
Jan Palus db76fefd0c trigger container update after disabling urgent in timer
switching workspace directly to urgent window creates timer which delays
reset of urgent state so user is able to notice it. make sure state
change is reflected visually as well (border change) by triggering
container update

Fixes: #8377
2024-10-16 13:57:32 -04:00
Simon Ser dd063a0ef7 input/keyboard: add support for pointer keys
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4775
2024-10-14 21:27:07 +02:00
Simon Ser 17e2e52c6d server: check backend support for timelines
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4848
2024-10-11 13:26:54 -04:00
Furkan Sahin 7f1cd0b73b
input/mouse: bugfix button2 being interpreted as trying to move the container
Man sway(5) specifies that when tiling_drag is enable, the floating_mod
can be used to drag tiling, as well as floating containers. However the
current code indiscriminately assumes any button press to be intended
for moving the container, consequently causing an unintended call to
`seatop_move_tilting:handle_button` rather than
`seatop_default:handle_button` to pass
`state=WL_POINTER_BUTTON_STATE_RELEASED` to `get_active_mouse_binding`

My idea was to make 'Handle moving a tiling container' follow the same
path as 'Handle moving a floating container' because the initial call to
handle moving a floating correctly exits that branch and ends up passing
the RELEASED state to `get_active_mouse_binding`.

Fixes #8334
2024-10-08 18:09:57 +02:00
ShootingStarDragons f855b0898b fix: sway crashes if switch to another workspace with surface when IME popup is shown
in pr https://github.com/swaywm/sway/pull/8196, when im_popup_surface is unmapped, author set the popup->relative to NULL, butt popup is still in popup groups, where assert the relative is not NULL, this cause the panic

Take the suggestion of Nefsen402, remove the line where set relative to
NULL, and add NULL check in scene_descriptor_destory
2024-10-07 23:07:25 -04:00