Commit graph

7458 commits

Author SHA1 Message Date
Alexander Orzechowski fc6b8d6af2 container: Skip % char if it doesn't match a view property
The else condition was missed here and we would never skip the % char
if it didn't end up matching with any property. Since we fail to skip
we would re-evaluate the % in an infinite loop never achieving any
forward-progress.

Fixes: https://github.com/swaywm/sway/issues/8333
2024-09-07 01:19:31 +02:00
Kenny Levinsen 4fe054c6db tree/output: Avoid duplicate input mapping configure 2024-09-05 18:19:16 -04:00
Kenny Levinsen cfb292cca7 desktop/output: Avoid duplicate output manager update 2024-09-05 18:19:16 -04:00
Kenny Levinsen af28ac04a4 (desktop|tree)/output: Do not use layout listener to arrange
Output layout changes originate from the centralized modeset
infrastructure and request_state which already takes care of arranging
and updating outputs as needed.
2024-09-04 13:49:35 -04:00
Kenny Levinsen 6045ad9a02 tree/output: Rely on modeset arranging root
output_enable/output_disable are only called from modeset, and from
output destroy which requests modeset. As such, they can rely on the
modeset handling arrange.
2024-09-04 13:49:35 -04:00
Kenny Levinsen b83e5aaa54 desktop/output: Do not use commit listener to arrange
The reasoning for using a commit handler is to ensure that all paths for
output changes are correctly handled. With the centralized modeset
infrastructure in place, we can move the logic there. This allows us to
be smarter and avoid extraneous arranges, output manager updates and
transaction commits.

The side-effect is a minor duplication for the special-case
request_state, but the shared path will be relied upon further in future
commits to justify this duplication.
2024-09-04 13:49:35 -04:00
Norbert Bolanowski be840f730e move title_format to container 2024-09-02 16:49:05 -04:00
Jon Wallace 980a4e0211 use subheadings instead 2024-08-28 10:59:56 +02:00
Jon Wallace f2b2a81149 Use heading markdown to demarcate sections of commands
Its a little tought to notice that the COMMANDS section is actually 3 sections. Use markdown to make this easier to see for the user.
2024-08-28 10:59:56 +02:00
llyyr 77b9ddabe2 sway/tree/container: don't trunc coords in floating_fix_coordinates
This can cause issues such as the window not being shown at the exact
same coordinates when the old and new wlr_box aren't the same
dimensions and the container is being moved back-and-forth between them.

For example, in the case where a floating window gets moved
from one output to another but the outputs aren't the same resolution.
For e.g. have two displays that aren't the same resolution then:

1. Open a floating window and set it to pos 0,0 on output 2
2. Send it to scratchpad then `scratchpad show` on output 1
3. `scratchpad show` on output 2 again

Observe that the window isn't at 0,0 on output 2 anymore.
2024-08-22 23:43:22 +02:00
Anna (navi) Figueiredo Gomes f00f964abf sway/commands/move.c: arrange new workspace
When moving a container to a new workspace, the workspace's dimension
are left unset. Usually this doesn't matter, but when moving a floating
container to a new workspace on a different output, this leads to the
position of the container being calculated with 0, so the container ends
up halfway offscreen on the leftmost topmost monitor.

Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
2024-08-22 23:41:33 +02:00
Alexander Orzechowski 7288f77bbe output: Chase wlroots!4803 2024-08-21 18:16:32 +03:00
Kenny Levinsen f9c0f043e5 config/output: Skip search if config has a mode
When doing an output configuration search, the intent is to only look
for modes if the output's configuration does not contain a specific
mode. This was done by testing if config_has_auto_mode returned false.

config_has_auto_mode had its return values backwards, leading to other
modes being tested if the output configuration had specified modes or
modelines, leading to unwanted modes being selected.

Invert the function to config_has_manual_mode to give it a clearer name,
and fix the return values in the process.
2024-08-19 12:03:48 -04:00
Kenny Levinsen ae7c1b139a config/output: Do not set adaptive_sync if not supported
After 4e38f93f36 ("config/output: Skip VRR tests when not supported"),
the configuration search no longer touches VRR state for outputs that
are known to not support it. This also means that it will not remove VRR
if already set, which could cause output configuration to fail.

Ensure that VRR state is never set for outputs that do not support it by
adding the same test for support to queue_output_config.

Fixes: 4e38f93f36 ("config/output: Skip VRR tests when not supported")
Fixes: https://github.com/swaywm/sway/issues/8296
2024-08-18 15:18:11 +02:00
Kirill Primak c30c451907 xdg-shell: chase xdg_surface geometry updates 2024-08-14 15:04:00 -04:00
Alexander Orzechowski c3279944fb output: Use wlr_scene_set_gamma_control_manager_v1 2024-08-14 20:45:04 +03:00
Alexander Orzechowski 5a3621460f output: Use wlr_scene_output_needs_frame 2024-08-14 20:45:04 +03:00
Felix Pehla 6576b99c24 commands/output/color_profile: allows use of relative path for ICC profile 2024-08-14 11:03:53 +02:00
Simon Ser b44015578a Switch default config to wmenu-run
This removes the last dependency bit on dmenu. No need for
"swaymsg exec" anymore: wmenu-run handles the xdg-activation
shenanigans.
2024-08-11 19:47:39 +02:00
Simon Ser 9ba1beee58 Bind a few utilities to special keys in default config 2024-08-11 16:42:20 +02:00
JingMatrix f344e9d5a5 Add null-safety check for virtual keyboard keymaps
Note that in the `sway_keyboard_configure` function of sway/input/keyboard.c,
we have skipped the `sway_keyboard_set_layout` function for virtual
keyboards, which then have null keymaps.
Hence, a null-safety check is needed at runtime.
2024-08-09 22:03:41 +02:00
Alexander Orzechowski 951a22c244 xwayland: Let scene restack 2024-08-07 23:58:13 +03:00
Kirill Primak 32e5e5232d tearing: fix UAF on destroy
Fixes: 9a1c411abd
2024-08-07 14:33:03 +02:00
Kirill Primak 3e956b9229 tearing: remove trailing whitespace 2024-08-07 14:33:03 +02:00
Simon Ser 05e895c463 Add support for linux-drm-syncobj-v1
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4262
2024-08-06 20:18:59 +02:00
Ricardo Steijn 9a1c411abd
Add support for tearing-control-v1
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3871

Adds option to allow tearing per output, as well as an option to force
enable or disable tearing for a specific application using a window
rule. Only works with fullscreen applications.
2024-08-05 02:13:49 +02:00
Alexander Orzechowski b881c2e84c transaction: Reparent all container children when disabling for scratchpad
Fixes: #8205
2024-08-04 18:08:28 +02:00
James Knight 6e4ccb99c3 build: avoid git repository discovery when determining version
When attempting to use Git to populate commit/branch information in a
version string, it is possible through repository discovery that it
uses Git information not relevant to project. For example, if
repository content is extract into an interim build location when using
an embedded build framework (e.g. Buildroot), the project will not have
its Git repository to refer to. When it cannot find its repository, it
will look into its parent folders and may find the Git repository of
another project and use its branch/commit information.

This commit provides an explicit path to the project's Git repository
when consider commit/branch information. This will prevent any
repository discovery from occurring.

Signed-off-by: James Knight <james.d.knight@live.com>
2024-08-03 18:35:55 +02:00
Kirill Primak 9bb45a4037 xwayland: chase wlr_xwayland_surface_set_maximized() change
See
https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4670.
2024-08-02 16:57:01 +02:00
Simon Ser 7e74a49142 desktop/xwayland: don't restack when marking window as inactive
daaec72ac0 ("desktop/xwayland: restack surface upon activation")
has updated Sway for wlroots commit bfc69decdd04 ("xwm: do not
restack surfaces on activation"). However, it unconditionally
restacks the window above all other windows even if marking the
window as inactive.

Closes: https://github.com/swaywm/sway/issues/7974
2024-07-29 14:19:42 -04:00
Joan Bruguera Micó 4d4c88f0a7 layer-shell: Restore interactive layer focus code
Commit 188811f808 ("scene_graph: Port layer_shell") accidentally
removed code in `arrange_layers` to handle focus on layer shell
surfaces with keyboard interactivity.

Due to this, layer shell surfaces requesting exclusive keyboard
interactivity may not get automatically focused, and layer shell
surfaces giving up exclusive keyboard interactivity can remain focused.

Add the previous code back to fix the problem.

Note the non-rename change included in b4d7e84d38 ("desktop: Rename
layers to shell_layers") is not included as it also seems accidental.

Fixes: #7936
2024-07-22 17:03:26 -04:00
Kenny Levinsen 3f327b3db0 desktop/output: Stop repaint loop when not needed
1e0031781f refactored repaint to accumulate all changes in a single
wlr_output_state and commit them at the end of the repaint loop,
replacing a call to wlr_scene_output_commit. wlr_scene_output_commit
contains an early bail-out when no frame has been requested and no
damage has accumulated, which was not replicated as part of this
refactor, causing the repaint loop to never pause.

Replicate the logic to stop the repaint loop as needed.

Fixes: 1e0031781f ("desktop/output: unify page-flip codepath")
2024-07-14 18:24:13 -04:00
Simon Ser a3a9ec1211 build: use fs.relative_to() instead of hand-rolled logic
Meson has introduced a relative_to() function [1] in its fs module
since version 1.3.

[1]: https://mesonbuild.com/Fs-module.html#relative_to
2024-07-14 18:03:43 -04:00
Bill Li 50073dc579 ci: use package x11-servers/xwayland instead of x11-servers/xwayland-devel 2024-07-14 23:19:19 +02:00
Bill Li fc2796aee8 Chase wlroots!2434
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/2434
2024-07-14 23:19:19 +02:00
Bill Li 274a5fcb73 build: Bump wlroots version 2024-07-13 13:03:23 +02:00
Kenny Levinsen 8c5b23e592 common/pango: Disable glyph position rounding
Pango rounds glyph position and widths to nearest integer, which leads
to font dimensions jumping around when rendering with a scale, causing
text geometry to jump around when changing scale. This is disturbing
when text buffers change scale, and also mean that the text geometry
calculations in sway_text_node are incorrect.

Disable this rounding to make the geometry stable.
2024-07-10 18:49:42 -04:00
Ronan Pigott 28fd73589d xdg-activation: launcher tokens are activation requests
If the launched client decides to pass it's token along as an activation
request, allow that. This will make the behavior match tokens provided by
an external launcher client.
2024-07-06 16:12:27 +02:00
Tarcísio Eduardo Moreira Crocomo 3d00552035 build: bump libinput version required 2024-07-04 23:03:38 +02:00
Tarcísio Eduardo Moreira Crocomo 5be5a50051 Implement clickfinger_button_map support. 2024-07-04 22:47:46 +02:00
Simon Ser 818ea17389 sway_text_node: avoid unnecessary redraws
When a floating container has a titlebar, render_backing_buffer()
ends up being called each time the container is moved. Add some
more checks for no-op changes in sway_text_node_set_max_width()
and sway_text_node_set_background(). This makes the move smoother.
2024-07-03 18:30:08 -04:00
Simon Ser d8c4a2d5fe tree/container: drop decl for container_update_textures_recursive()
This function doesn't exist anymore.
2024-07-03 17:50:32 -04:00
llyyr fdcfe00781 xdg_shell: don't send configure events to uninitialized surfaces
the surface isn't initialized yet when we first handle it in
`handle_xdg_shell_toplevel`, move setting WM capabilities to
handle_commit instead.

Fixes warnings from wlroots about a configure being scheduled for
uninitialized surface
2024-07-03 23:38:38 +02:00
novenary 5233a0bd2e ipc: properly check for titlebars
This fixes incorrect values for rect.y when using
`hide_edge_borders --i3`.
2024-07-03 11:00:30 -04:00
novenary a0a078f75e transaction: fix missing top border with hide_lone_tab
Regressed by scene graph.
2024-07-03 10:10:30 -04:00
Kenny Levinsen b04f4136bc desktop/output: Debounce modesets
Output changes often happen in rapid succession. Instead of doing the
modesets one by one, set a 10 millisecond debounce timer.
2024-07-03 10:06:22 -04:00
llyyr e32bdaa7be input/keyboard: don't set layout for virtual keyboard device
This prevents us from recompiling keymap every time a virtual device is
created by clients like fcitx5
2024-07-03 08:41:46 +02:00
llyyr 4c3c060211 input/keyboard: refactor into sway_keyboard_set_layout 2024-07-03 08:41:46 +02:00
llyyr 0386b2afcb input/seat: don't send redundant leave/enter on device creation
Fixes: #8143 #8173
Upstream issue: https://github.com/fcitx/fcitx5/issues/1044
2024-07-03 08:41:46 +02:00
llyyr dfbcd1fbaa input/keyboard: don't send key release if we don't have focused surface
"The compositor must not send this event if the wl_keyboard did not
have an active surface immediately before this event. The compositor
must not send this event if state is pressed (resp. released) and the
key was already logically down (resp. was not logically down)
immediately before this event."

From https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/382
2024-07-02 15:13:29 -04:00