Commit c2d6aff added a bounds check on `height - title_bar_height`,
repurposing the local variable `height` in an attempt to DRY out the
expression.
However, because re-assignment occurs inside the loop body, its result
would leak across loop iterations, compounding its effect and leading
to the artifact reported in issue #8625, where each child except the
first in a tabbed container would acquire a visible waterline.
Introduce a second variable and reset it in each loop iteration to get
rid of the waterline.
Fixes#8625.
Replace the XWayland-only class attribute in the examples:
- The first example given should work for Wayland-native windows.
- The example 'Kill all windows with the title "Emacs"' should use
title, not class. Also, it's a substring (regex) match.
There are many different implementations of regular expressions with
incompatible syntax. For example, GNU grep alone provides three
different ones. Clarify the use of PCRE2 by sway criteria.
If far too many containers are created, they can become so small that
their size calculations come out negative, leading to crashes on
asserts.
Instead, set a lower bound for sizes and disable the container entirely
if it goes below it, giving whatever space it used to the last
container.
The splits are not recalculated, so currently the effect is that if all
containers have the same width fraction, they keep getting narrower
until at some point they all round to zero and the last container will
be given all the available space.
A better behavior would have been if the additional container did not
contribute to size and fraction calculations at all, but it's an extreme
edge-case, anything is better than crashing, and this is easier to
implement.
has_prefix() expects the prefix to be the 2nd argument, not the first.
The config parsing was broken when using `--input-device=`.
Introduced by: 0c60d1581f "Use has_prefix()
instead of strncmp() throughout"
in the origin text_input.c, we only check the sway_view and layershell,
but now we have the third shell named sessionlock, so we need to modify
both text_input.c and view.c to handle the new type of shell
When the repaint timer fires, we check if the sway_output is disabled,
and if so, skip the output commit after having reset frame_pending.
The sway_output enable flag is only updated if the output is disabled
and removed from the layout, not if the power is disabled for e.g. idle.
This can lead to situations where a commit is attempted on a disabled
output, which will lead to an attempted and failed primary swapchain
allocation.
Use the wlr_output.enabled state to check if the output is active.
Call wlr_scene_output_set_position when in global fullscreen to
correctly set output positions when repositioning outputs (using
swaymsg output or similar).
swaybar and the exec command reset signal masks, signal handlers and
NOFILE limit before exec, but swaybg was missing all that.
Reset it for swaybg as well.
The behavior of handlers registered with signal(3p) is not well-defined
for signals delivered more than once, as laid out in the man page.
We should replace our use of signal with sigaction, but for SIGCHLD
specifically we can also just skip the signals altogether by setting the
handler to SIG_IGN which causes child reaping to not be required.
Fixes: https://github.com/swaywm/sway/pull/8567
To use something like:
[con_id=__focused__] mark --add --toggle foo
The container must currently have a view. However, it is possible to
focus parent containers that do not have a view. For example, via:
focus parent
Since containers without views can be the focused (meaning the container
is marked "focused": true in the output of: swaymsg -t get_tree), it
seems reasonable that a view is not required to target a container via
__focused__.
cmd_exec_process is used whenever sway is meant to execute a child
process on behalf of the user, and had a lot of complexity.
In order to avoid having to wait on the user's process, a double-fork
was used, which in turn required us to wait on the outer process. In
order to track the child PID for launcher purposes, a pipe was used to
transmit the PID back to sway.
This resulted in sway blocking for 5-6 ms per exec on my system, which
is quite significant. The error handling was also quite lacking - the
read loop did not handle errors at all for example.
Instead, teach sway to handle SIGCHLD and do away with the double-fork.
This in turn allows us to get rid of the pipe as we can record the
child's PID directly. This reduces the time we block to just 1.5 ms on
my system. We'd be able to get down to just 150 µs if we could use
posix_spawn(3), but posix_spawn(3) cannot reset NOFILE. clone(2) or
vfork(2) would be alternatives, but that presents portability issues.
This change is replicated for swaybar, swaybg and swaynag handling,
which had similar albeit less complicated implementations.
max_width was applied to the source box, but not to the cairo surface.
The cairo surface would therefore take on arbitrarily large dimensions
according to the required dimensions to fit the text input, which if
large enough would cause failures during output rendering and leave a
black hole in the titlebar.
Calling container_update() wasn't enough: If there is no visible window
decorations (title bar, borders) container_update would basically no-op
and the scene wouldn't repaint with the update alpha. By also calling
output_configure_scene() we force a call to
wlr_scene_buffer_set_opacity() thus ensuring we update the scene.
Closes: #8580
currently, the output background command handler prematurely
returns with an error if the background file cannot be accessed.
It should only error if user did not provide fallback color.
closes#8556
Changes
- Introduce variables to avoid uneccessary writing on output members
- Log a debug message when fallback is being used over inaccessible
file
- Always parse the background color and swaynag warn if it is incorrect
- when updating output member variables, free previous values
- add cleanup label and goto it if `strdup` fails
- Move output->member initializations to before parsing fallback, Also
free and init output->background as well
Increasing the max default buffer size prevents clients from crashing
when they need more than 4096 bytes. This can happen when the GUI thread
of the application is blocked, especially when moving your mouse over it
with high mouse sensitivity.
The background color can be set individually for the different
elements of the bar. If any of the backgrounds have transparency, we have
to bail out from advertising an opaque surface.
0d6cc471e9
added an assert that all signals are clear when destroying a
wlr_scene_buffer, which is currently triggering due to sway not removing
the output_enter and output_leave listeners on the container before
calling wlr_scene_node_destroy on output_handler. Remove the listeners
before wlr_scene_node_destroy is called.
The teardown of a sway_output is split in two: begin_destroy and
output_destroy. The former clears some state such as NULL'ing the
reference to wlr_output, while the latter frees the struct and its
remaining resources.
If an output is destroyed while a repaint timer is pending, future frame
callbacks will no longer occur as the listener is torn down in
begin_destroy, but the repaint timer is not torn down and may still
fire until output_destroy is hit. As begin_destroy cleared the reference
to wlr_output, this leads to a NULL-pointer dereference.
Tear down the repaint timer in begin_destroy as there is no need for it.
Fixes: fdc4318ac6 ("desktop/output: Clear frame_pending even output is disabled")
IPC clients generally expect executed commands to have taken effect when
the command completes, while delayed modeset means that it can take
several milliseconds more before e.g. an output is enabled.
However, modesetting on every output command in the IPC call could on
systems with already slow modesetting behavior lead to an unresponsive
system for a not insignificant period of time.
To strike a balance, force modeset once all the commands of this IPC
call have executed if a modeset is pending.
Some commands require outputs to be enabled. These commands are deferred
to allow outputs to be discovered, but the delayed modeset might only
run some time later.
Force a modeset to occur before running deferred commands.
Fixes: https://github.com/swaywm/sway/issues/8433