Commit Graph

23 Commits

Author SHA1 Message Date
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
Manuel Stoeckl 5e73acb431 swaynag: call swaynag_destroy on clean exit
And fix the fallout of the swaynag_destroy having evolved without
being tested:
* wl_display_disconnect was called too early
* `button_close` and `swaynag.details.button_details` needed to be
  heap allocated, since they are added to swaynag.buttons, and all
  entries of swaynag.buttons are freed in swaynag_destroy
* To keep things simpler, disconnect the lifetime of the 'Toggle details'
  button text config setting from the button itself.
2023-01-16 10:47:42 -05:00
Simon Ser bd7466e1b7 swaynag: drop swaynag_type.font
It's too easy to have this go out of sync with font_description.
2022-12-22 17:42:33 +01:00
Greg Depoire--Ferrer 956b689d6a swaynag: move close_button up to fix SIGSEGV
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 4780afb68b ("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.
2022-06-05 19:05:26 +02:00
Nihal Jere 78758ef369 swaynag: remove redundant status variables in main
Instead, we just use `status` for all failures.
2022-03-15 11:40:32 +01:00
Nihal Jere 20729a6a5e swaynag: remove unnecessary zero of swaynag struct
Global variables are initialized to 0.
2022-03-15 11:40:32 +01:00
Nihal Jere 4780afb68b swaynag: statically allocate button_close, and move declaration
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.
2022-03-15 11:40:32 +01:00
Nihal Jere 0babfce4b5 swaynag: allocate button_details with details
They are used together, so it doesn't make sense to allocate them
separately.
2022-03-15 11:40:32 +01:00
Nihal Jere 061ffc30ea swaynag: die on all allocation failures 2022-02-28 11:24:13 -05:00
Antonin Décimo bbf7b92fe4 Fix incorrect format specifiers 2020-07-30 22:02:42 -04:00
Dominique Martinet 484f7677b0 swaynag: fix segfault on exit when arguments are not correct
swaynag_destroy is called on all cleanup cases and needs the lists to be valid,
just init them early
2020-03-29 11:17:32 +02:00
Brian Ashworth 9099adbbe6 swaynag: revamp type configs
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.
2019-04-20 09:14:41 -06:00
M Stoeckl 1211a81aad Replace wlr_log with sway_log
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.
2019-01-21 12:59:42 +01:00
emersion 3a310f92ab
Replace _XOPEN_SOURCE with _POSIX_C_SOURCE
And make sure we don't define both in the same source file.
2018-11-25 17:19:43 +01:00
Drew DeVault 7252c7f715 swaynag: s/Toggle Details/Toggle details/ 2018-10-07 14:37:53 -04:00
Brian Ashworth f0d21c46dd Fix bad-free in swaynag 2018-08-20 15:06:12 -04:00
Marien Zwart 4df8858873 Add missing stdlib.h includes to swaynag 2018-08-03 19:24:44 +10:00
Brian Ashworth 0ef3988438 swaynag: fix hidpi 2018-08-01 22:47:54 -04:00
Brian Ashworth e01acb6097 swaynag: allow more config options 2018-08-01 22:47:54 -04:00
Brian Ashworth a6145914c6 swaynag: refactor {sway_,}nagbar to swaynag 2018-08-01 22:47:54 -04:00
Brian Ashworth 6124d0f9a2 swaynag: split config into own file and fix optind 2018-08-01 22:47:54 -04:00
Brian Ashworth 8463a2896a swaynag: implement config file support 2018-08-01 22:47:54 -04:00
Brian Ashworth a4f7bf23b2 Address first round review for swaynag 2018-08-01 22:47:54 -04:00
Renamed from swaynagbar/main.c (Browse further)