From e558d0d619ef4e867475cf1ae86b73fb067b2ac6 Mon Sep 17 00:00:00 2001 From: tokyo4j Date: Wed, 1 Oct 2025 15:22:54 +0900 Subject: [PATCH 1/5] labnag: rename options for color --- clients/labnag.c | 64 +++++++++++++++++++++-------------------- docs/labnag.1.scd | 26 ++++++++--------- docs/labwc-config.5.scd | 12 ++++---- src/config/rcxml.c | 12 ++++---- 4 files changed, 58 insertions(+), 56 deletions(-) diff --git a/clients/labnag.c b/clients/labnag.c index bea25dd1..23e0be1f 100644 --- a/clients/labnag.c +++ b/clients/labnag.c @@ -45,7 +45,7 @@ struct conf { uint32_t details_background; uint32_t background; uint32_t text; - uint32_t border; + uint32_t button_border; uint32_t border_bottom; /* Sizing */ @@ -429,7 +429,7 @@ render_button(cairo_t *cairo, struct nag *nag, struct button *button, int *x) button->width = text_width + padding * 2; button->height = text_height + padding * 2; - cairo_set_source_u32(cairo, nag->conf->border); + cairo_set_source_u32(cairo, nag->conf->button_border); cairo_rectangle(cairo, button->x - border, button->y - border, button->width + border * 2, button->height + border * 2); cairo_fill(cairo); @@ -1255,7 +1255,7 @@ conf_init(struct conf *conf) conf->background = 0x323232FF; conf->text = 0xFFFFFFFF; conf->button_text = 0xFFFFFFFF; - conf->border = 0x222222FF; + conf->button_border = 0x222222FF; conf->border_bottom = 0x444444FF; conf->bar_border_thickness = 2; conf->message_padding = 8; @@ -1270,7 +1270,7 @@ conf_init(struct conf *conf) conf->background = 0x900000FF; conf->text = 0xFFFFFFFF; conf->button_text = 0xFFFFFFFF; - conf->border = 0xD92424FF; + conf->button_border = 0xD92424FF; conf->border_bottom = 0x470909FF; } @@ -1342,9 +1342,9 @@ nag_parse_options(int argc, char **argv, struct nag *nag, { enum type_options { TO_COLOR_BACKGROUND = 256, - TO_COLOR_BORDER, + TO_COLOR_BUTTON_BORDER, TO_COLOR_BORDER_BOTTOM, - TO_COLOR_BUTTON, + TO_COLOR_BUTTON_BG, TO_COLOR_DETAILS, TO_COLOR_TEXT, TO_COLOR_BUTTON_TEXT, @@ -1373,16 +1373,16 @@ nag_parse_options(int argc, char **argv, struct nag *nag, {"timeout", required_argument, NULL, 't'}, {"version", no_argument, NULL, 'v'}, - {"background", required_argument, NULL, TO_COLOR_BACKGROUND}, - {"border", required_argument, NULL, TO_COLOR_BORDER}, - {"border-bottom", required_argument, NULL, TO_COLOR_BORDER_BOTTOM}, - {"button-background", required_argument, NULL, TO_COLOR_BUTTON}, - {"text", required_argument, NULL, TO_COLOR_TEXT}, - {"button-text", required_argument, NULL, TO_COLOR_BUTTON_TEXT}, + {"background-color", required_argument, NULL, TO_COLOR_BACKGROUND}, + {"button-border-color", required_argument, NULL, TO_COLOR_BUTTON_BORDER}, + {"border-bottom-color", required_argument, NULL, TO_COLOR_BORDER_BOTTOM}, + {"button-background-color", required_argument, NULL, TO_COLOR_BUTTON_BG}, + {"text-color", required_argument, NULL, TO_COLOR_TEXT}, + {"button-text-color", required_argument, NULL, TO_COLOR_BUTTON_TEXT}, {"border-bottom-size", required_argument, NULL, TO_THICK_BAR_BORDER}, {"message-padding", required_argument, NULL, TO_PADDING_MESSAGE}, {"details-border-size", required_argument, NULL, TO_THICK_DET_BORDER}, - {"details-background", required_argument, NULL, TO_COLOR_DETAILS}, + {"details-background-color", required_argument, NULL, TO_COLOR_DETAILS}, {"button-border-size", required_argument, NULL, TO_THICK_BTN_BORDER}, {"button-gap", required_argument, NULL, TO_GAP_BTN}, {"button-dismiss-gap", required_argument, NULL, TO_GAP_BTN_DISMISS}, @@ -1413,21 +1413,23 @@ nag_parse_options(int argc, char **argv, struct nag *nag, " -v, --version Show the version number and quit.\n" "\n" "The following appearance options can also be given:\n" - " --background RRGGBB[AA] Background color.\n" - " --border RRGGBB[AA] Border color.\n" - " --border-bottom RRGGBB[AA] Bottom border color.\n" - " --button-background RRGGBB[AA] Button background color.\n" - " --text RRGGBB[AA] Text color.\n" - " --button-text RRGGBB[AA] Button text color.\n" - " --border-bottom-size size Thickness of the bar border.\n" - " --message-padding padding Padding for the message.\n" - " --details-border-size size Thickness for the details border.\n" - " --details-background RRGGBB[AA] Details background color.\n" - " --button-border-size size Thickness for the button border.\n" - " --button-gap gap Size of the gap between buttons\n" - " --button-dismiss-gap gap Size of the gap for dismiss button.\n" - " --button-margin-right margin Margin from dismiss button to edge.\n" - " --button-padding padding Padding for the button text.\n"; + " --background-color RRGGBB[AA] Background color.\n" + " --button-border-color RRGGBB[AA] Button border color.\n" + " --border-bottom-color RRGGBB[AA] Bottom border color.\n" + " --button-background-color RRGGBB[AA]\n" + " Button background color.\n" + " --text-color RRGGBB[AA] Text color.\n" + " --button-text-color RRGGBB[AA] Button text color.\n" + " --border-bottom-size size Thickness of the bar border.\n" + " --message-padding padding Padding for the message.\n" + " --details-border-size size Thickness for the details border.\n" + " --details-background-color RRGGBB[AA]\n" + " Details background color.\n" + " --button-border-size size Thickness for the button border.\n" + " --button-gap gap Size of the gap between buttons\n" + " --button-dismiss-gap gap Size of the gap for dismiss button.\n" + " --button-margin-right margin Margin from dismiss button to edge.\n" + " --button-padding padding Padding for the button text.\n"; optind = 1; while (1) { @@ -1522,8 +1524,8 @@ nag_parse_options(int argc, char **argv, struct nag *nag, fprintf(stderr, "Invalid background color: %s\n", optarg); } break; - case TO_COLOR_BORDER: /* Border color */ - if (!parse_color(optarg, &conf->border)) { + case TO_COLOR_BUTTON_BORDER: /* Border color */ + if (!parse_color(optarg, &conf->button_border)) { fprintf(stderr, "Invalid border color: %s\n", optarg); } break; @@ -1532,7 +1534,7 @@ nag_parse_options(int argc, char **argv, struct nag *nag, fprintf(stderr, "Invalid border bottom color: %s\n", optarg); } break; - case TO_COLOR_BUTTON: /* Button background color */ + case TO_COLOR_BUTTON_BG: /* Button background color */ if (!parse_color(optarg, &conf->button_background)) { fprintf(stderr, "Invalid button background color: %s\n", optarg); } diff --git a/docs/labnag.1.scd b/docs/labnag.1.scd index 8ff5fe18..c8aa4d09 100644 --- a/docs/labnag.1.scd +++ b/docs/labnag.1.scd @@ -62,22 +62,22 @@ _labnag_ [options...] # APPEARANCE OPTIONS -*--background* +*--background-color* Set the color of the background. -*--border* - Set the color of the border. +*--button-border-color* + Set the color of the button border. -*--border-bottom* +*--border-bottom-color* Set the color of the bottom border. -*--button-background* +*--button-background-color* Set the color for the background for buttons. -*--text* +*--text-color* Set the text color. -*--button-text* +*--button-text-color* Set the button text color. *--border-bottom-size* @@ -86,7 +86,7 @@ _labnag_ [options...] *--message-padding* Set the padding for the message. -*--details-background* +*--details-background-color* Set the color for the background for details. *--details-border-size* @@ -126,11 +126,11 @@ labnag \\ -Z "Hibernate" "systemctl hibernate"\\ -Z " Suspend " "systemctl suspend"\\ -Z " Cancel "\\ - --background 00ffff\\ - --button-background 00ffff\\ - --border 00ccccaa\\ - --text 000000\\ - --button-text 000000\\ + --background-color 00ffff\\ + --button-background-color 00ffff\\ + --button-border-color 00ccccaa\\ + --text-color 000000\\ + --button-text-color 000000\\ --button-gap 8\\ --button-margin-right 0\\ --button-padding 5\\ diff --git a/docs/labwc-config.5.scd b/docs/labwc-config.5.scd index 52cd9638..d389c4cf 100644 --- a/docs/labwc-config.5.scd +++ b/docs/labwc-config.5.scd @@ -283,12 +283,12 @@ this is for compatibility with Openbox. --message '%m' \\ --button-dismiss '%n' \\ --button-dismiss '%y' \\ - --background '%b' \\ - --text '%t' \\ - --border '%t' \\ - --border-bottom '%t' \\ - --button-background '%b' \\ - --button-text '%t' \\ + --background-color '%b' \\ + --text-color '%t' \\ + --button-border-color '%t' \\ + --border-bottom-color '%t' \\ + --button-background-color '%b' \\ + --button-text-color '%t' \\ --border-bottom-size 1 \\ --button-border-size 3 \\ --timeout 0 diff --git a/src/config/rcxml.c b/src/config/rcxml.c index 9bf38941..1353b3c2 100644 --- a/src/config/rcxml.c +++ b/src/config/rcxml.c @@ -1634,12 +1634,12 @@ post_processing(void) "--message '%m' " "--button-dismiss '%n' " "--button-dismiss '%y' " - "--background '%b' " - "--text '%t' " - "--border '%t' " - "--border-bottom '%t' " - "--button-background '%b' " - "--button-text '%t' " + "--background-color '%b' " + "--text-color '%t' " + "--button-border-color '%t' " + "--border-bottom-color '%t' " + "--button-background-color '%b' " + "--button-text-color '%t' " "--border-bottom-size 1 " "--button-border-size 3 " "--timeout 0"); From 389cef9c3b8a97e099c09ad62bea06299fb3020a Mon Sep 17 00:00:00 2001 From: Johan Malm Date: Wed, 1 Oct 2025 20:47:33 +0100 Subject: [PATCH 2/5] include/common/box.h: fix declaration/definition arg name difference --- include/common/box.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/common/box.h b/include/common/box.h index 3d900a0e..45c0fc4d 100644 --- a/include/common/box.h +++ b/include/common/box.h @@ -18,7 +18,7 @@ void box_union(struct wlr_box *box_dest, struct wlr_box *box_a, * The returned x & y coordinates are the centered content position * relative to the top-left corner of the bounding box. */ -struct wlr_box box_fit_within(int width, int height, struct wlr_box *bounding_box); +struct wlr_box box_fit_within(int width, int height, struct wlr_box *bound); struct wlr_fbox box_to_fbox(struct wlr_box *box); From 4c1e66f6c8d9fd19684e0d5d899526f8c4c7525f Mon Sep 17 00:00:00 2001 From: Johan Malm Date: Wed, 1 Oct 2025 20:48:15 +0100 Subject: [PATCH 3/5] include/common/buf.h: fix declaration/definition arg name difference --- include/common/buf.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/common/buf.h b/include/common/buf.h index 857b6c48..24158630 100644 --- a/include/common/buf.h +++ b/include/common/buf.h @@ -71,9 +71,9 @@ void buf_add(struct buf *s, const char *data); /** * buf_add_char - add single char to C string buffer * @s: buffer - * @data: char to be added + * @ch: char to be added */ -void buf_add_char(struct buf *s, char data); +void buf_add_char(struct buf *s, char ch); /** * buf_clear - clear the buffer, internal allocations are preserved From 0d0d1075ccb6c714a0c829354558bad839510e6a Mon Sep 17 00:00:00 2001 From: Johan Malm Date: Wed, 1 Oct 2025 20:48:45 +0100 Subject: [PATCH 4/5] include/common/scene-helpers: fix declaration/definition arg name difference --- include/common/scene-helpers.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/common/scene-helpers.h b/include/common/scene-helpers.h index 021d3b16..453052fb 100644 --- a/include/common/scene-helpers.h +++ b/include/common/scene-helpers.h @@ -20,6 +20,6 @@ struct wlr_scene_node *lab_wlr_scene_get_prev_node(struct wlr_scene_node *node); /* A variant of wlr_scene_output_commit() that respects wlr_output->pending */ bool lab_wlr_scene_output_commit(struct wlr_scene_output *scene_output, - struct wlr_output_state *output_state); + struct wlr_output_state *state); #endif /* LABWC_SCENE_HELPERS_H */ From bed0be8a88aa5c8a05618c97ab8385aa260ad591 Mon Sep 17 00:00:00 2001 From: Johan Malm Date: Wed, 1 Oct 2025 20:50:31 +0100 Subject: [PATCH 5/5] src/common/graphic-helpers.c: fix declaration/definition arg name difference --- src/common/graphic-helpers.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/common/graphic-helpers.c b/src/common/graphic-helpers.c index bc0adbc4..4371c9e5 100644 --- a/src/common/graphic-helpers.c +++ b/src/common/graphic-helpers.c @@ -27,34 +27,34 @@ draw_cairo_border(cairo_t *cairo, struct wlr_fbox fbox, double line_width) /* Sets the cairo color. Splits the single color channels */ void -set_cairo_color(cairo_t *cairo, const float *c) +set_cairo_color(cairo_t *cairo, const float *color) { /* * We are dealing with pre-multiplied colors * but cairo expects unmultiplied colors here */ - float alpha = c[3]; + float alpha = color[3]; if (alpha == 0.0f) { cairo_set_source_rgba(cairo, 0, 0, 0, 0); return; } - cairo_set_source_rgba(cairo, c[0] / alpha, c[1] / alpha, - c[2] / alpha, alpha); + cairo_set_source_rgba(cairo, color[0] / alpha, color[1] / alpha, + color[2] / alpha, alpha); } cairo_pattern_t * -color_to_pattern(const float *c) +color_to_pattern(const float *color) { - float alpha = c[3]; + float alpha = color[3]; if (alpha == 0.0f) { return cairo_pattern_create_rgba(0, 0, 0, 0); } - return cairo_pattern_create_rgba( - c[0] / alpha, c[1] / alpha, c[2] / alpha, alpha); + return cairo_pattern_create_rgba(color[0] / alpha, color[1] / alpha, + color[2] / alpha, alpha); } /*