Commit graph

7406 commits

Author SHA1 Message Date
Alexander Orzechowski 9d667383b4 text_input: Properly handle map/unmap events
The last implementation would ignore these and get it could get into
a bad state where it would start crashing sway.

(cherry picked from commit 74e507962e)
2024-09-20 19:48:52 +02:00
Alexander Orzechowski bb666f2ac9 transaction: Allow no popup descriptor in popup list
Input method popups in the future will destroy the scene descriptor when
it isn't mapped and therefore shouldn't be tampered with here.

(cherry picked from commit 023f6b0a50)
2024-09-20 19:48:52 +02:00
Alexander Orzechowski af782c17bb text_input: Move popup placement to own function
(cherry picked from commit 1537c9dae5)
2024-09-20 19:48:52 +02:00
Alexander Orzechowski 5a920c48d1 text_input: Check for allocation failure
(cherry picked from commit 48069097ea)
2024-09-20 19:48:52 +02:00
Scott Dubinsky b4d550bff8 Remove unguarded double include
(cherry picked from commit 266cd4515a)
2024-09-20 19:48:38 +02:00
Emil Engberg 4cca004583 Add toggle for output adaptive_sync
(cherry picked from commit e940acd374)
2024-09-20 19:48:35 +02:00
Kenny Levinsen a8b6d02868 config/output: Stringify render format when logging it
(cherry picked from commit 9765c29be1)
2024-09-20 19:48:33 +02:00
Kenny Levinsen 12796fb0b3 config/output: Add support for 6-bit render fmt
GUD devices uses RGB565 by default for performance reasons. Allow
specifying render_bit_depth 6 to pick this format. The definition works
out if you consider the maximum number of bits per channel instead of
the average.

(cherry picked from commit 034d02f8a5)
2024-09-20 19:48:30 +02:00
Steffen Dirkwinkel 3264696469 config/output: support DRM_FORMAT_ARGB8888
Some display output hardware [1] doesn't support any of the current
formats, but works with ARGB8888. Fall back to it if available.

[1] 196145c606/drivers/gpu/drm/xlnx/zynqmp_disp.c (L313)

Signed-off-by: Steffen Dirkwinkel <s.dirkwinkel@beckhoff.com>
(cherry picked from commit f957c7e658)
2024-09-20 19:47:52 +02:00
Adam Chovanec 6835cbd046 readme: update Czech translation
(cherry picked from commit fb5eadc363)
2024-09-20 19:47:11 +02:00
llyyr 24fafa9490 sway/input/keyboard: always set active keyboard if there is none
Previously, we incorrectly only set active keyboard for non-virtual
devices. 4c3c060211 incorrectly put
unrelated code in `sway_keyboard_set_layout`.

Fixes: 4c3c060211
(cherry picked from commit c5ba7f23a5)
2024-09-20 19:47:06 +02:00
Kenny Levinsen 559f9eba33 desktop/transaction: Deactivate workspace on inactive outputs
If the output is not active, it might not have a valid geometry to
arrange for. Outputs do not gain a geometry until modeset, so if an
output is connected with a configuration present to disable it, it will
not have a geometry. If the output has a past workspace restored, this
will be attemtped arranged to fit a 0x0 rectangle, which asserts when
trying to sort out borders.

Consider the workspace activated only if the output itself is active to
get the scene nodes disabled.

(cherry picked from commit 14bff7b451)
2024-09-20 19:46:40 +02:00
Alexander Orzechowski 31ce4ea53d 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
(cherry picked from commit fc6b8d6af2)
2024-09-20 19:46:27 +02:00
Norbert Bolanowski 7246bf909c move title_format to container
(cherry picked from commit be840f730e)
2024-09-20 19:44:34 +02:00
Jon Wallace d2fceae379 use subheadings instead
(cherry picked from commit 980a4e0211)
2024-09-20 19:44:28 +02:00
Jon Wallace 401a84bf21 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.

(cherry picked from commit f2b2a81149)
2024-09-20 19:44:23 +02:00
llyyr 9cdd57a032 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.

(cherry picked from commit 77b9ddabe2)
2024-09-20 19:44:17 +02:00
Anna (navi) Figueiredo Gomes a4927e4cb2 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>
(cherry picked from commit f00f964abf)
2024-09-20 19:44:09 +02:00
Kenny Levinsen b1c2155a8e 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.

(cherry picked from commit f9c0f043e5)
2024-09-20 19:44:03 +02:00
Kenny Levinsen 234f18d357 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
(cherry picked from commit ae7c1b139a)
2024-09-20 19:43:57 +02:00
Felix Pehla d100835485 commands/output/color_profile: allows use of relative path for ICC profile
(cherry picked from commit 6576b99c24)
2024-09-20 19:43:08 +02:00
Simon Ser fb0f2add19 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.

(cherry picked from commit b44015578a)
2024-09-20 19:43:01 +02:00
Simon Ser 3fba40da50 Bind a few utilities to special keys in default config
(cherry picked from commit 9ba1beee58)
2024-09-20 19:42:58 +02:00
JingMatrix e6c3612b72 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.

(cherry picked from commit f344e9d5a5)
2024-09-20 19:42:53 +02:00
Kirill Primak 04943bc6ac tearing: fix UAF on destroy
Fixes: 9a1c411abd
(cherry picked from commit 32e5e5232d)
2024-09-20 19:42:45 +02:00
Kirill Primak fa4912b1f9 tearing: remove trailing whitespace
(cherry picked from commit 3e956b9229)
2024-09-20 19:42:41 +02:00
Ricardo Steijn 01f5c50438 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.

(cherry picked from commit 9a1c411abd)
2024-09-20 19:42:33 +02:00
Alexander Orzechowski b4ab8182b7 transaction: Reparent all container children when disabling for scratchpad
Fixes: #8205
(cherry picked from commit b881c2e84c)
2024-09-20 19:42:28 +02:00
James Knight 8b923a3623 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>
(cherry picked from commit 6e4ccb99c3)
2024-09-20 19:42:14 +02:00
Simon Ser 53ffc1119a 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
(cherry picked from commit 7e74a49142)
2024-09-20 19:41:52 +02:00
Joan Bruguera Micó 100f92a189 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
(cherry picked from commit 4d4c88f0a7)
2024-09-20 19:41:52 +02:00
Kenny Levinsen 19ca790a9f 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")
(cherry picked from commit 3f327b3db0)
2024-07-17 08:44:16 +02:00
Bill Li 6320aef295 ci: use package x11-servers/xwayland instead of x11-servers/xwayland-devel
(cherry picked from commit 50073dc579)
2024-07-17 08:44:16 +02:00
Simon Ser 1c992d847d ci: pin wlroots to v0.18.x 2024-07-13 13:07:16 +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
Kenny Levinsen 4e38f93f36 config/output: Skip VRR tests when not supported
Adaptive sync is a "soft" setting which we degrade of off when not
supported. Some outputs types do not support turning it off (Wayland,
X11), which makes for an awkward three-way test where we first enable,
disable and finally unset the setting.

wlr_output.adaptive_sync_supported tells us whether the output
definitely does not support making changes (backend without support,
connector without the feature), or whether it might work.

Use this to avoid wasting time on adaptive sync test that can never
succeed, and to avoid the Wayland/X11-backend specific unset step.
2024-07-02 19:13:58 +02:00
Simon Ser 1e0031781f desktop/output: unify page-flip codepath
Instead of having a special codepath for applying gamma LUTs, have
a single codepath for regular page-flips and gamma LUT updates.
Should make it easier to add more logic on top e.g. for tearing
page-flips.
2024-07-01 09:21:53 +02:00