Commit graph

7383 commits

Author SHA1 Message Date
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
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
Ronan Pigott 5d237679f5 view: send scale notification when the output is known 2024-06-29 14:53:00 +02:00
Kirill Primak cdde0165da protocols: use tablet-v2 xml from stable/ 2024-06-27 20:11:48 +02:00
bretello 8f6bc5bb36 prevent workspace_find_container from crashing with NULL workspaces 2024-06-27 10:19:53 -04:00
bretello 74cc02d60f fix crash when setting urgency on an hidden scratchpad container 2024-06-27 10:19:53 -04:00
Simon Ser fce8de0f67 tree/view: ensure content_{width,height} is positive
The size computations may result in a zero or negative size, which
are not valid wl_surface sizes.
2024-06-25 09:32:46 -04:00
Simon Ser 5f15c5e91d tree/view: set default min size to 1×1
It's not possible to have a surface with a smaller size.
2024-06-25 09:32:46 -04:00
Simon Ser cc34210769 Set color transform when calling wlr_scene_output_build_state()
We were only passing the color transform when calling
wlr_scene_output_commit(). However when modesetting or pushing a
new gamma LUT we render via wlr_scene_output_build_state(). Pass
the color transform there as well.
2024-06-10 16:32:31 +02:00
Manuel Stoeckl 40ca4150b2 sway/commands/output: Add command to set color profile
This makes it possible to render output buffers in a different color
space, by specifying an ICC profile for the output.
2024-06-07 19:01:49 +02:00
Violet Purcell 2e9139df66 Update for versioned wlroots files
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4614
2024-05-28 20:21:07 +02:00
Simon Ser d0bd591ee7 Drop server.h include from input/input-manager.h
The only reason it's included there is for a declaration of
struct sway_server, but we can just forward-declare it.

This avoids rebuilding almost all of Sway when touching server.h.
All other server.h includes are from source files, not headers.
2024-05-27 09:28:43 -04:00
Simon Ser df69367d92 input/text_input: ensure keyboard is set before sending modifiers
Clients get confused when modifier events are sent before the
keymap.
2024-05-27 09:27:45 -04:00
Simon Ser 700f4805bc server: hide xdg_output from unprivileged clients
Regular Wayland clients shouldn't care about the position or size
of outputs. Hide xdg_output from unprivileged clients to make sure
they're not doing shenanigans with this information.
2024-05-27 09:27:20 -04:00
thal a168b20299 tree/view: Do not clip to geometry if using CSD
If a floating window is using CSD, the geometry should not be used to
define the clipping region. Otherwise drop shadows and such may be
clipped excessively.
2024-05-24 00:18:44 +02:00
Simon Ser 9704152414 build: drop xwayland option
Instead of having a build-time option to enable/disable xwayland
support, just use the wlroots build config: enable xwayland in
Sway if it was enabled when building wlroots. I don't see any
use-case for disabling xwayland in Sway when enabled in wlroots:
Sway doesn't pull in any additional dependency (just pulls in
dependencies that wlroots already needs). We have a config command
to disable xwayland at runtime anyways.

This makes it so xwayland behaves the same way as other features
such as libinput backend and session support. This also reduces
the build matrix (less combinations of build options).

I think we originally introduced the xwayland option when we didn't
have a good way to figure out the wlroots build config from the
Sway build system.
2024-05-21 11:44:39 -04:00
Anna (navi) Figueiredo Gomes fd3b643d15 sway/config/output.c: fix null deref on output config
If there's no config for the output, oc is null, but some screens might
have a default rotation, causing the log call to dereference a null
pointer.

Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
2024-05-18 16:25:42 +02:00
Simon Ser 796898519b build: disable wayland-protocols subproject tests by default 2024-05-18 13:48:17 +02:00
Manuel Stoeckl dcdb72757a desktop/layer_shell: provide fractional scale on creation
Also, send a matching wl_surface.preferred_buffer_scale event.
2024-05-07 16:18:43 +02:00
Simon Ser 30f5c3a911 tree/container: ensure pixman rect is valid in container_arrange_title_bar()
Fixes "Invalid rectangle passed" errors printed by Pixman.
2024-05-07 16:15:13 +02:00
Alexander Orzechowski b463957021 sway_text_node: Allow 0 text width
special case negative numbers instead.
2024-05-07 16:14:58 +02:00
Kenny Levinsen 2686afb95c config/output: Print output state during tests
Instead of having each search function print its various test decisions,
print the full state at the end of every search. This makes it much
clearer what state a particular test includes.
2024-05-02 16:16:42 +02:00
Kenny Levinsen 4c28916d68 config/output: Search for output config fallbacks
The original sway output config implementation enabled one output at a
time, testing modes, render formats and VRR support as it went along.
While this sort of fallback is easy to do, it has the downside of not
considering the effect of neighbor outputs on the configuration
viability.

With backend-wide commits, we can now better consider the effect of
neighbor outputs, but to handle the fact that we commit all outputs at
once we need to perform a more elaborate search of viable
configurations.

Implement a recursive configuration search for when the primary
configuration failed to apply.
2024-05-02 16:16:42 +02:00
Kenny Levinsen ee5c4f38c9 config/output: Use all outputs for config merge
When storing a config, we need to find the output that is being
configured to extract its identifier. output_by_name_or_id does not
return outputs that are disabled, and using this makes it impossible to
merge configurations related to disabled outputs.

Switch to all_outputs_by_name_or_id.

Fixes: https://github.com/swaywm/sway/issues/8141
2024-05-02 08:44:04 -04:00
Kenny Levinsen 646019cad9 desktop/output: Fix check if config should be stored
We want to check if a config_head existed for the current
matched_output_config, so we should check cfg->output. sway_output is a
temporary variable from a previous wl_list_for_each, and does not
contain anything useful to us.

Fixes: https://github.com/swaywm/sway/issues/8128
2024-04-23 13:31:30 +02:00