Commit Graph

874 Commits

Author SHA1 Message Date
Kenny Levinsen
63345977e2 desktop/output: Clear modeset timer on output manager apply
If a modeset timer exists at the time we apply an output manager config,
clear it to avoid a useless double commit.
2024-09-21 17:50:24 -04:00
Kenny Levinsen
b73f54a966 desktop/output: Expose request_modeset
We remove the struct sway_server argument for consistency with the rest
of our internal APIs which rely on the global server instance.
2024-09-21 17:50:24 -04:00
Alexander Orzechowski
023f6b0a50 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.
2024-09-20 19:40:18 +02:00
Kenny Levinsen
d7a76d381b config/output: Rename to apply_stored_output_configs 2024-09-10 14:13:36 -04:00
Kenny Levinsen
29b3f00e6f config/output: Accept a list of output_configs to use
Instead of using a single finalized output config per output, accept a
regular list of output configs like the one ultimately stored for
configuration purposes. This allows the output management code to test
an augmented configuration while still using the same output config
logic, without having to mutate the stored configuration.

This in turn allows us to make a few APIs private. A bug note about an
existing issue with derade to off is added as well.
2024-09-10 14:13:36 -04:00
Kenny Levinsen
14bff7b451 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.
2024-09-07 20:11:30 -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
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
Alexander Orzechowski
7288f77bbe output: Chase wlroots!4803 2024-08-21 18:16:32 +03: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
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
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
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
Bill Li
fc2796aee8 Chase wlroots!2434
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/2434
2024-07-14 23:19:19 +02: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
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
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
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
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
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
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
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
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
Kenny Levinsen
3b419020a3 desktop/output: Use apply_output_configs for output mgmt 2024-03-28 10:45:20 +01:00
Kenny Levinsen
98be797356 Use apply_all_output_configs to light up outputs
This allows us to test and if necessary degrade the entire backend
configuration to light everything up.
2024-03-28 10:45:20 +01:00
Alexander Orzechowski
2e951163c5 Force bilinear scaling when scaling down 2024-03-09 11:47:42 +01:00
Simon Ser
3ef5abd405 xdg-shell: send WM capabilities 2024-03-08 09:52:14 +03:00
Simon Ser
4e6d7612ff xdg-shell: implement popup repositioning 2024-03-08 09:52:14 +03:00
Simon Ser
fc640d5f6c Define _POSIX_C_SOURCE globally
See discussion in https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4555
2024-02-23 17:43:19 +03:00
Access
7c11c463a3
text_input: Implement input-method popups
Co-authored-by: tadeokondrak <me@tadeo.ca>
2024-02-20 10:53:20 +01:00
Aleksei Bavshin
d19810eba8 xdg-activation: distinguish activation and urgency requests
Check if the app that requested a token has provided a valid input
serial and a focused surface. Downgrade activation request to urgency
otherwise.

This is mostly in line with what other Wayland compositors decided to
do, and offers a better security than the original logic.
2024-02-17 00:54:30 -07:00
Ronan Pigott
f6d22f8e68 launcher: track the seat in the launcher ctx
This is a more suitable place to track the requesting seat, since we are
able to respond appropriately to destroy notifications.
2024-02-17 00:54:30 -07:00
Simon Ser
541e6e260c Drop unnecessary includes from sway/server.h 2024-02-15 15:56:36 +01:00
Alexander Orzechowski
09c360d503 layer_shell: Handle popups through popup descriptor
We tried to synchronize layer shell popups with the parent layer shell
on commits, but this is subtly wrong because we would only update
the position for one layer shell that was committed, but not any other
layer that might be affected. By moving handling to the scene descriptor
we can iterate all popups and ensure they are synchronized.
2024-02-12 19:19:22 +03:00
Alexander Orzechowski
1846944f04 xdg_shell: Extract struct for popup descriptor 2024-02-12 19:19:22 +03:00
Alexander Orzechowski
1dc661af17 layer_shell: Arrange popups even if exclusive zone doesn't change 2024-02-12 19:19:22 +03:00
Merlin Lex
1b5515400d ext-foreign-toplevel-list: Implement protocol
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4543
2024-02-12 15:36:44 +01:00
Alexander Orzechowski
e8c421e917 layer_shell: Fix typo of return instead of continue
Otherwise we would skip arranging the rest of the surfaces if one of them
isn't initialized.
2024-01-21 22:01:35 +01:00
Daniel De Graaf
2c2625acd3 Fix SIGSEGV on output destroy
```
Program terminated with signal SIGSEGV, Segmentation fault.
144                             struct wlr_layer_surface_v1 *layer_surface = surface->layer_surface;
[Current thread is 1 (Thread 0x7f1f7c5b3ac0 (LWP 2473))]
(gdb) bt
```

Add a NULL check in `find_mapped_layer_by_client` like the one in `arrange_surface`.
2024-01-21 17:32:00 +03:00