Age | Commit message (Collapse) | Author |
|
Avoids parsing the configured font each time text is rendered.
|
|
When swaynag_parse_options encounters '--dismiss-button' (or its
shorthand '-s'), it sets the text of the first button in the
swaynag.buttons list, which is expected to exist and to be the dismiss
button, to the one passed by the user.
Commit 4780afb68b4ee2cdf0e4925f40cf885819f8a74a ("swaynag: statically
allocate button_close, and move declaration") moved the list
initialization to after swaynag_parse_options is called which made that
code fail.
For example, the command 'swaynag --dismiss-button Dismiss' crashes and
'swaynag --message Message --button Yes "" --dismiss-button Dismiss'
shows the wrong buttons.
Move it back to before swaynag_parse_options is called.
|
|
|
|
|
|
read_from_stdin not only read from stdin, but trimming trailing
newlines, so rename it to reflect this.
|
|
|
|
Instead, we just use `status` for all failures.
|
|
Global variables are initialized to 0.
|
|
Every swaynag has a close button, so it doesn't make sense to
allocate it dynamically. The declaration is moved later to when
it is actually needed.
|
|
They are used together, so it doesn't make sense to allocate them
separately.
|
|
|
|
Replace them with snprintf, which ensures buffer overflows won't
happen.
|
|
An address of a variable can never be NULL, so checking it doesn't make
sense; and `destroy_buffer()` can operate on already destroyed buffers
anyway.
Fixes #6780
|
|
We can just get the output name from wl_output directly, now that
wl_output version 4 exists.
|
|
sway#6504 simplified rendering code by setting scaling at cairo, but
that also changed button position records into ones without scale
multiplication, breaking button events. This fixes it by not multiplying
scale on events handling as well.
|
|
This avoids using the pango_ prefix, reserved for functions coming
from the Pango library.
|
|
Use `cairo_scale` to set the scale factor, removing redundant
multiplications by `output->scale`.
|
|
Uses --layer/-y set to overlay|top|bottom|background
|
|
|
|
For full context, read
https://gitlab.freedesktop.org/cairo/cairo/-/issues/479
TL;DR, cairo’s pc file adds `/cairo` to CFLAGS.
So namespace cairo shouldn’t be used.
|
|
This stops assuming the POSIX shell command is located in /bin.
|
|
Only wl_pointer.motion was used to update pointer position, which would
cause issues if the pointer was not moved prior to wl_pointer.button.
This also fixes touch input through wl_pointer emulation, which fires
wl_pointer.button immediately after wl_pointer.enter.
Closes: https://github.com/swaywm/sway/issues/5991
|
|
|
|
|
|
|
|
Adds a new config option for details background for swaynag
issue/#5673
|
|
|
|
|
|
In case `wl_display_roundtrip` returns an error after registering for
events, print a more user-friendly error message and exit.
Previously, if the build did not have assertions enabled, this would
likely result in a segfault. With assertions enabled, it's not user
friendly to terminate with internal implementation information.
|
|
I don't love -z / -Z, but I figure this patch is far from being
accepted for other reasons too.
|
|
fixes loop when sway closes the socket in the middle of querying outputs,
see #5138.
|
|
swaynag_destroy is called on all cleanup cases and needs the lists to be valid,
just init them early
|
|
This also adds cleanup for all seat resources
|
|
This is the first in a series of commits to refactor the color handling
in sway. This changes parse_color to return whether it was success and
no longer uses 0xFFFFFFFF as the fallback color. This also verifies that
the string actually contains a valid hexadecimal number along with
the length checks.
In the process of altering the calls to parse_color, I also took the
opportunity to heavily refactor swaybar's ipc_parse_colors function.
This allowed for several lines of duplicated code to be removed.
|
|
|
|
Note: since strtoul() has no real error return code (both 0 and
ULONG_MAX may be returned on both success and failure), set errno=0
before calling strtoul().
|
|
If the XCURSOR_THEME and/or XCURSOR_SIZE environment variables are
set, use the theme and size they define.
If they're not set, use the same defaults as before (system default
theme, size=24).
|
|
The new upstream is https://github.com/swaywm/swaybg
This commit also refactors our use of gdk-pixbuf a bit, since the only
remaining reverse dependency is swaybar tray support.
|
|
This revamps the type configs for swaynag. All sizing attributes for
swaynag are now `ssize_t` instead of `uint32_t` to allow for a default
value of `-1`, which allows for `0` to be a valid value. Additionally,
the initialization of the type configs has been changed from a simple
calloc to use a new function `swaynag_type_new`. `swaynag_type_new`
calloc's the memory, checks for an allocation failure, sets the name,
and all sizes to -1. The layering order has also been changed to
default, general config, type config, and as highest priority command
line arguments. Finally, `swaynag_type_merge` has been modified to
handle the layering and sizing changes.
|
|
This spawns swaynag as a wayland client similar to how swaybar and
swaybg are already done
|
|
Currently on master, swaynag will retrieve a pointer instance whenever
the capabilities change and WL_SEAT_CAPBILITY_POINTER is set. The
pointer instances were never being destroyed so swaynag received events
multiple times due to having several instances of the pointer.
This fixes it so if there is already a pointer instance, swaynag does
not attempt to retrieve another. Additionally, if the pointer
capability is removed, the pointer instance is destroyed.
|
|
When swaynag is run with the -l/--detailed-message option, a crash may
occur if the detailed message read from stdin is large enough. E.g.:
swaynag -m hello -l < ~/.config/sway/config
The root cause is that the read_from_stdin() function under-allocates
memory for the destination buffer which causes that buffer to be overflowed
when copying line data to it with snprintf().
The repair is to allocate one more byte for the terminating null byte.
N.B. although getline() returns the number of bytes read excluding a
terminating null byte, the line buffer is terminated with a null byte. Thus
we have a guarantee that the line buffer will be null terminated (which is
important when copying with snprintf()).
|
|
Now that swaynag uses getline (instead of the old readline), the
trailing newline characters have to be removed when reading the config
|
|
|
|
In addition to removing unused code, two minor problems are fixed:
(1) `resize set` and `resize adjust` did not error when given
too many arguments.
(2) `orientation` was incorrectly overridden to be 'U' for
scroll events in the swaybar tray `handle_click` function.
|
|
|
|
Also remove direct libm dependency where unused.
|
|
This commit mostly duplicates the wlr_log functions, although
with a sway_* prefix. (This is very similar to PR #2009.)
However, the logging function no longer needs to be replaceable,
so sway_log_init's second argument is used to set the exit
callback for sway_abort.
wlr_log_init is still invoked in sway/main.c
This commit makes it easier to remove the wlroots dependency for
the helper programs swaymsg, swaybg, swaybar, and swaynag.
|
|
|
|
|