Commit Graph

7445 Commits

Author SHA1 Message Date
Ferdinand Bachmann
6532b0eb49 sway/main: fail if only one of --socket and --wayland-fd are given 2024-10-17 11:48:37 +02:00
Ferdinand Bachmann
934018253c sway/server: implement wayland socket handover
This commit implements the compositor side of the Wayland socket
handover protocol as described in the [KDE Wiki]. The CLI options are
chosen so that they are compatible with Kwin.

[KDE Wiki]: https://invent.kde.org/plasma/kwin/-/wikis/Restarting
2024-10-17 11:48:37 +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
Kenny Levinsen
c90cb37b2a Re-init renderer for all outputs on lost context
sway_root.outputs only include enabled outputs. We also need to re-init
the renderer for any disabled outputs, so use sway_root.all_outputs
instead.

Resolves the following heap-use-after-free accessing the render formats
when a disabled output is modeset after a GPU reset has occurred.
2024-10-02 21:09:55 -04:00
Alexander Orzechowski
9a9be01ad4 Fix alpha-modifier-v1 2024-09-29 23:01:14 +02:00
Simon Ser
a2757e5f16 release: push tags before creating GitHub release
Otherwise the GitHub release isn't attached to the Git tag.
2024-09-29 17:44:47 +02:00
Simon Ser
a0b3606f17 Add support for alpha-modifier-v1 2024-09-29 17:19:22 +02:00
Furkan Sahin
00e9a94152 swaybar: Fix 100% cpu usage if dbus dies.
Currently, swaybar does not gracefully die if it detects
that the dbus connection was lost. Although it's not recommended
to restart dbus without restarting the compositor, it can very
easily happen. In the case it does, compositor's tray should
not consume 100% cpu until it has to be force killed.

apply suggestions

just setting the bar to not running will call teardown and unref the
dbus.
2024-09-28 16:23:21 +02:00
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
cdff4f7c74 config: Batch input/output configuration on load
We batch modesets and input configuration performed during config reload
but commit for every command during the intial config load. There is no
need to perform commits during the initial config load as outputs have
not yet been created, but swaybg spawn should still be batched.

At the same time, replace direct calls to apply output configuration
with request_modeset to properly handle the modeset timer.
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
Olivia Taliesin
b6da218974 Removed destination-is-ancestor check from container_move_to_container to match i3 behaviour 2024-09-21 17:46:20 -04:00
Kenny Levinsen
861dde100a commands/gaps: Check config->reading instead
Checking if the config is not active or is reloading is just a
convoluted way of checking if the config is being read.
2024-09-21 16:16:19 +02:00
Alexander Orzechowski
e9dd218231 text_input: Inline input_popup_update into input_popup_set_focus
This seems to be the intention of input_popup_update in the first place:
handle the scenario where the focus moves.
2024-09-20 19:40:18 +02:00
Alexander Orzechowski
74e507962e 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.
2024-09-20 19:40:18 +02: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
Alexander Orzechowski
1537c9dae5 text_input: Move popup placement to own function 2024-09-20 19:40:18 +02:00
Alexander Orzechowski
48069097ea text_input: Check for allocation failure 2024-09-20 19:40:18 +02:00
Scott Dubinsky
266cd4515a Remove unguarded double include 2024-09-20 17:18:26 +02:00
Emil Engberg
e940acd374 Add toggle for output adaptive_sync 2024-09-20 15:38:27 +02:00
Kenny Levinsen
9765c29be1 config/output: Stringify render format when logging it 2024-09-20 14:08:04 +02:00
Kenny Levinsen
034d02f8a5 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.
2024-09-20 14:08:04 +02:00
Kenny Levinsen
785a459a55 ext-session-lock: Do not use commit listener to arrange
Arranging lock surfaces rely on the sway_output width and height being
updated, but these are only updated after the commit has been completed
and all commit listeners have executed. This means that the lock
surfaces will not be appropriately scaled to match a change in output
dimensions, and may reveal what is under the lock background.

Replace the implicit arrange through the output commit listener with an
explicit arrange after the output configuration is finalized.

This might have regressed by other transition away from output commit
listeners for other arrange tasks, but even then it would have
erroneously relied on signalling order.
2024-09-20 00:26:36 -04:00
Steffen Dirkwinkel
f957c7e658 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>
2024-09-13 13:09:48 +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
0496477f92 config/output: Always start with default in find_output_config
We always need to start out with the default configuration, regardless
of whether the config is reloading or not to ensure that config
decisions are stable given a specific configuration.
2024-09-10 14:13:36 -04:00
Kenny Levinsen
a0c0349934 config/output: Support multiple matches in find_output_config
Simplify find_output_config and inline the search through the output
configs instead of using list_seq_find with a comparator function. The
new implementation will merge any amount of matched configs in order,
which will be relied upon in a future commit.
2024-09-10 14:13:36 -04:00
Adam Chovanec
fb5eadc363 readme: update Czech translation 2024-09-08 16:06:26 +02:00
llyyr
c5ba7f23a5 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
2024-09-08 14:18:01 +02:00
Kenny Levinsen
f4a6b0395f tree/arrange; Skip arranging disabled outputs
Disabled outputs might not have a geometry to arrange for, so skip the
arrange to avoid messing up the workspace geometry.
2024-09-07 20:11:30 -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
4f9ce4675c tree/arrange: Remove redundant output geometry update
This is handled by apply_output_configs.
2024-09-07 20:11:30 -04:00
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