Based on swaynag (https://github.com/swaywm/sway/tree/master/swaynag)
Copied at commit:
03483ff370
Contains the following modifiations:
- Some functional changes including:
- Disable exclusive-zone by default (Written-by: @Consolatis) and add
command line option -x|--exclusive-zone
- Add close timeout (Written-by: @Consolatis) and -t|--timeout option
- Use index of button (from right-to-left) for exit code
- Disable reading from config file and remove associated --type option
- Refactoring including:
- Use wlr_log() instead of the log.{c,h} functions
- Use wl_list instead of sway's list.c implementation
- In the pango wrapper functions, use glib's g_strdup_vprintf() rather
than the original stringop.c functions
- Align with labwc coding style to pass checkpatch.pl
- Re-licenced from MIT to GPL-2.0, and add Copyright notices for original
authors
v2
- Remove option -s|--dismiss-button and the default "X" button. To get
such a button, "-Z X :"
- Remove options -b and -z because there is no requirement to run
in a terminal.
- Remove *-no-terminal from options --button and --button-dismiss because
commands are now always run directly without a terminal.
v3
- Allow -B/-Z options without action-argument
- Invert button order of -B/-Z so that `labnag -m foo -Z x -Z y -Z z`
results in three buttons with "x" furthest to the left, and "z" on the
right (rather than the other way around).
- Use signalfd() to prevent race conditions on SIGTERM
v4
- Limit number of stdin lines to 200 to avoid hogging CPU
Co-Authored-by: tokyo4j
Simple utility to allow protocol and version comparison between different
running compositors. This can be used to detect missing protocols or
versions in labwc. See for example this result when running against the
current labwc master and sway 1.10 (nested, results on DRM may differ):
Protocols missing from labwc @ wayland-0
ext_transient_seat_manager_v1 1
wl_compositor 6 (has version 5)
wp_alpha_modifier_v1 1
wp_content_type_manager_v1 1
xdg_wm_base 5 (has version 3)
zwp_keyboard_shortcuts_inhibit_manager_v1 1
Protocols missing from sway @ wayland-1
wl_drm 2
zcosmic_workspace_manager_v1 1
Adapted from gdk-pixbuf, see the original at:
https://gitlab.gnome.org/GNOME/gdk-pixbuf/-/blob/master/gdk-pixbuf/io-xpm.c
rgb.txt is from X.org, see:
https://gitlab.freedesktop.org/xorg/app/rgb/-/blob/master/rgb.txt
Differences from the gdk-pixbuf version:
- GdkPixbuf replaced with struct lab_data_buffer
- Progressive and in-memory loading code removed
- Two functions that had separate BSD copyright rewritten
- Stores colors as ARGB32 earlier in the decoding process for efficiency
- Limited to 1024x1024 px and 1024 colors to prevent abuse
- Uses struct buf to build strings, in place of manual g_new/g_realloc
- Uses xzalloc/xznew_n for other memory allocations
- Uses g_strlcpy in place of banned strcpy/strncpy/strncat
- Uses standard C types (int, bool, etc.) in place of the GLib ones
- Follows labwc coding style (whitespace, braces, letter case, etc.)
- Et cetera ...
v2: add Perl fixes from @domo141
Fill with the background color first only if the background color is
opaque. This is necessary for subpixel rendering to work properly (it
does not work on top of transparency).
However, if the background color is not opaque, leave the buffer
unfilled (completely transparent) since the background is already
rendered by the scene element underneath. In this case we have to
disable subpixel rendering.
v2: use 0.999 alpha cutoff and fix CodeStyleCheck
Fixes: (the rest of) #1684
...to search for functions which have been banned from our code base,
because they're too easy to misuse, and even if used correctly,
complicate audits, cause inconsistencies and/or make static analysis
harder.
This makes the code a bit more readable IMHO (and forces us to be
consistent with event handler function names).
Adjust scripts/checkpatch.pl to not complain.
Coding style specific changes include:
- Accept pango, glib and libxml2 CamelCase variables
- Remove "need consistent spacing around '*'" warning
- Do not warn about "structs that should be const"
- Do not warn on braces {} around single statements
- Do not warn about braces {} for single statement blocks
- Do not warn about wanting { on previous line for functions
- Remove check for missing blank line after declaration
- Ignore SPLIT_STRING COMPLEX_MACRO PREFER_KERNEL_TYPES
LOGICAL_CONTINUATIONS PARENTHESIS_ALIGNMENT OPEN_ENDED_LINE
MACRO_ARG_REUSE PREFER_FALLTHROUGH ARRAY_SIZE INITIALISED_STATIC
Other changes include:
- Do not complain about missing spelling.txt
- Print filename for each file, but no summary line