Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package lemonbar for openSUSE:Factory checked in at 2024-08-26 22:10:59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/lemonbar (Old) and /work/SRC/openSUSE:Factory/.lemonbar.new.2698 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "lemonbar" Mon Aug 26 22:10:59 2024 rev:4 rq:1196045 version:1.5 Changes: -------- --- /work/SRC/openSUSE:Factory/lemonbar/lemonbar.changes 2021-04-22 18:06:21.706734120 +0200 +++ /work/SRC/openSUSE:Factory/.lemonbar.new.2698/lemonbar.changes 2024-08-26 22:13:54.419228965 +0200 @@ -1,0 +2,12 @@ +Mon Aug 19 12:17:10 UTC 2024 - Frantisek Simorda <[email protected]> + +- Update to 1.5: + * Use the specified underline color when resetting the color palette. + * Set the WM_CLASS atom for all the lemonbar windows. + * Call pledge() at startup when running on OpenBSD. + * Fix a silly bug where the last monitor in the list was ignored. + * Fix another silly bug that affected systems with mirrored outputs (Thanks @insom). + * Code cleanup. + + +------------------------------------------------------------------- Old: ---- bar-1.4.tar.gz New: ---- bar-1.5.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ lemonbar.spec ++++++ --- /var/tmp/diff_new_pack.LQWIvA/_old 2024-08-26 22:13:54.835246337 +0200 +++ /var/tmp/diff_new_pack.LQWIvA/_new 2024-08-26 22:13:54.839246503 +0200 @@ -1,7 +1,7 @@ # # spec file for package lemonbar # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2024 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -12,12 +12,12 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # Name: lemonbar -Version: 1.4 +Version: 1.5 Release: 0 Summary: An X11 bar License: MIT ++++++ bar-1.4.tar.gz -> bar-1.5.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bar-1.4/.github/workflows/check.yml new/bar-1.5/.github/workflows/check.yml --- old/bar-1.4/.github/workflows/check.yml 2020-11-20 09:32:06.000000000 +0100 +++ new/bar-1.5/.github/workflows/check.yml 2024-04-30 09:50:08.000000000 +0200 @@ -14,7 +14,9 @@ steps: - uses: actions/checkout@v2 - name: Download dependencies - run: sudo apt-get install -y libx11-xcb-dev libxcb-randr0-dev libxcb-xinerama0-dev + run: | + sudo apt update -y + sudo apt install -y libx11-xcb-dev libxcb-randr0-dev libxcb-xinerama0-dev - name: Build run: CFLAGS='-DWITH_XINERAMA=1' make - name: Check diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bar-1.4/Makefile new/bar-1.5/Makefile --- old/bar-1.4/Makefile 2020-11-20 09:32:06.000000000 +0100 +++ new/bar-1.5/Makefile 2024-04-30 09:50:08.000000000 +0200 @@ -13,7 +13,7 @@ -Wsign-conversion -Wconversion -Wimplicit-function-declaration EXEC = lemonbar -SRCS = lemonbar.c +SRCS = lemonbar.c utils.c OBJS = ${SRCS:.c=.o} PREFIX?=/usr diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bar-1.4/lemonbar.c new/bar-1.5/lemonbar.c --- old/bar-1.4/lemonbar.c 2020-11-20 09:32:06.000000000 +0100 +++ new/bar-1.5/lemonbar.c 2024-04-30 09:50:08.000000000 +0200 @@ -1,5 +1,4 @@ // vim:sw=4:ts=4:et: -#define _POSIX_C_SOURCE 200809L #include <stdbool.h> #include <stdio.h> #include <stdlib.h> @@ -17,12 +16,12 @@ #include <xcb/xinerama.h> #endif #include <xcb/randr.h> +#include "utils.h" // Here be dragons #define max(a,b) ((a) > (b) ? (a) : (b)) #define min(a,b) ((a) < (b) ? (a) : (b)) -#define indexof(c,s) (strchr((s),(c))-(s)) typedef struct font_t { xcb_font_t ptr; @@ -116,34 +115,6 @@ } void -fill_gradient (xcb_drawable_t d, int x, int y, int width, int height, rgba_t start, rgba_t stop) -{ - float i; - const int K = 25; // The number of steps - - for (i = 0.; i < 1.; i += (1. / K)) { - // Perform the linear interpolation magic - unsigned int rr = i * stop.r + (1. - i) * start.r; - unsigned int gg = i * stop.g + (1. - i) * start.g; - unsigned int bb = i * stop.b + (1. - i) * start.b; - - // The alpha is ignored here - rgba_t step = { - .r = rr, - .g = gg, - .b = bb, - .a = 255, - }; - - xcb_change_gc(c, gc[GC_DRAW], XCB_GC_FOREGROUND, (const uint32_t []){ step.v }); - xcb_poly_fill_rectangle(c, d, gc[GC_DRAW], 1, - (const xcb_rectangle_t []){ { x, i * bh, width, bh / K + 1 } }); - } - - xcb_change_gc(c, gc[GC_DRAW], XCB_GC_FOREGROUND, (const uint32_t []){ fgc.v }); -} - -void fill_rect (xcb_drawable_t d, xcb_gcontext_t _gc, int x, int y, int width, int height) { xcb_poly_fill_rectangle(c, d, _gc, 1, (const xcb_rectangle_t []){ { x, y, width, height } }); @@ -334,17 +305,20 @@ void set_attribute (const char modifier, const char attribute) { - int pos = indexof(attribute, "ou"); + uint32_t mask; - if (pos < 0) { - fprintf(stderr, "Invalid attribute \"%c\" found\n", attribute); - return; + switch (attribute) { + case 'o': mask = ATTR_OVERL; break; + case 'u': mask = ATTR_UNDERL; break; + default: + fprintf(stderr, "Invalid attribute \"%c\" found\n", attribute); + return; } switch (modifier) { - case '+': attrs |= (1<<pos); break; - case '-': attrs &=~(1<<pos); break; - case '!': attrs ^= (1<<pos); break; + case '+': attrs |= mask; break; + case '-': attrs &= ~mask; break; + case '!': attrs ^= mask; break; } } @@ -422,11 +396,8 @@ } if (area_stack.index + 1 > area_stack.alloc) { - area_stack.ptr = realloc(area_stack.ptr, sizeof(area_t) * (area_stack.index + 1)); - if (!area_stack.ptr) { - fprintf(stderr, "Failed to allocate new input areas\n"); - exit(EXIT_FAILURE); - } + area_stack.ptr = xreallocarray(area_stack.ptr, area_stack.index + 1, + sizeof(area_t)); area_stack.alloc += 1; } a = &area_stack.ptr[area_stack.index++]; @@ -521,7 +492,7 @@ // Reset the default color set bgc = dbgc; fgc = dfgc; - ugc = fgc; + ugc = dugc; update_gc(); // Reset the default attributes attrs = 0; @@ -628,12 +599,14 @@ case 'n': { // Named monitor. const size_t name_len = block_end - (p + 1); cur_mon = monhead; - while (cur_mon->next) { + while (cur_mon) { if (cur_mon->name && - !strncmp(cur_mon->name, p + 1, name_len)) + !strncmp(cur_mon->name, p + 1, name_len) && + cur_mon->name[name_len] == '\0') break; cur_mon = cur_mon->next; } + if (!cur_mon) cur_mon = orig_mon; p += 1 + name_len; } break; case '0' ... '9': // Numbered monitor. @@ -767,11 +740,7 @@ return; } - font_t *ret = calloc(1, sizeof(font_t)); - if (!ret) { - fprintf(stderr, "Failed to allocate new font descriptor\n"); - exit(EXIT_FAILURE); - } + font_t *ret = xcalloc(1, sizeof(font_t)); queryreq = xcb_query_font(c, font); font_info = xcb_query_font_reply(c, queryreq, NULL); @@ -784,15 +753,16 @@ ret->char_min = font_info->min_byte1 << 8 | font_info->min_char_or_byte2; // Copy over the width lut as it's part of font_info - int lut_size = sizeof(xcb_charinfo_t) * xcb_query_font_char_infos_length(font_info); + size_t lut_size = sizeof(xcb_charinfo_t) * + xcb_query_font_char_infos_length(font_info); if (lut_size) { - ret->width_lut = malloc(lut_size); + ret->width_lut = xmalloc(lut_size); memcpy(ret->width_lut, xcb_query_font_char_infos(font_info), lut_size); } free(font_info); - font_list = realloc(font_list, sizeof(font_t) * (font_count + 1)); + font_list = xreallocarray(font_list, font_count + 1, sizeof(font_t)); if (!font_list) { fprintf(stderr, "Failed to allocate %d font descriptors", font_count + 1); exit(EXIT_FAILURE); @@ -862,6 +832,7 @@ xcb_change_property(c, XCB_PROP_MODE_REPLACE, mon->window, atom_list[NET_WM_STRUT_PARTIAL], XCB_ATOM_CARDINAL, 32, 12, strut); xcb_change_property(c, XCB_PROP_MODE_REPLACE, mon->window, atom_list[NET_WM_STRUT], XCB_ATOM_CARDINAL, 32, 4, strut); xcb_change_property(c, XCB_PROP_MODE_REPLACE, mon->window, XCB_ATOM_WM_NAME, XCB_ATOM_STRING, 8, 3, "bar"); + xcb_change_property(c, XCB_PROP_MODE_REPLACE, mon->window, XCB_ATOM_WM_CLASS, XCB_ATOM_STRING, 8, 12, "lemonbar\0Bar"); } } @@ -870,16 +841,12 @@ { monitor_t *ret; - ret = calloc(1, sizeof(monitor_t)); - if (!ret) { - fprintf(stderr, "Failed to allocate new monitor\n"); - exit(EXIT_FAILURE); - } - + ret = xcalloc(1, sizeof(monitor_t)); ret->name = name; ret->x = x; ret->y = (topbar ? by : height - bh - by) + y; ret->width = width; + ret->height = height; ret->next = ret->prev = NULL; ret->window = xcb_generate_id(c); @@ -970,7 +937,7 @@ mons[i].y, min(width, mons[i].width - left), mons[i].height, - mons[i].name? strdup(mons[i].name) : NULL); + mons[i].name? xstrdup(mons[i].name) : NULL); if (!mon) break; @@ -1017,11 +984,7 @@ // Every entry starts with a size of 0, making it invalid until we fill in // the data retrieved from the Xserver. - monitor_t *mons = calloc(max(num, num_outputs), sizeof(monitor_t)); - if (!mons) { - fprintf(stderr, "failed to allocate the monitor array\n"); - return; - } + monitor_t *mons = xcalloc(max(num, num_outputs), sizeof(monitor_t)); // Get all outputs for (i = 0; i < num; i++) { @@ -1068,11 +1031,7 @@ } if (is_valid) { - char *alloc_name = calloc(name_len + 1, 1); - if (!alloc_name) { - fprintf(stderr, "failed to allocate output name\n"); - exit(EXIT_FAILURE); - } + char *alloc_name = xcalloc(name_len + 1, 1); memcpy(alloc_name, name_ptr, name_len); // There's no need to handle rotated screens here (see #69) @@ -1095,7 +1054,7 @@ for (j = 0; j < num; j++) { // Does I contain J ? - if (i != j && mons[j].width && !mons[j].name) { + if (i != j && mons[j].width) { if (mons[j].x >= mons[i].x && mons[j].x + mons[j].width <= mons[i].x + mons[i].width && mons[j].y >= mons[i].y && mons[j].y + mons[j].height <= mons[i].y + mons[i].height) { mons[j].width = 0; @@ -1239,12 +1198,8 @@ { if (!str || !*str) return; - output_names = realloc(output_names, sizeof(void *) * (num_outputs + 1)); - if (!output_names) { - fprintf(stderr, "failed to allocate output name\n"); - exit(EXIT_FAILURE); - } - output_names[num_outputs++] = strdup(str); + output_names = xreallocarray(output_names, num_outputs + 1, sizeof(char*)); + output_names[num_outputs++] = xstrdup(str); } void @@ -1471,7 +1426,7 @@ case 'g': (void)parse_geometry_string(optarg, geom_v); break; case 'o': (void)parse_output_string(optarg); break; case 'p': permanent = true; break; - case 'n': wm_name = strdup(optarg); break; + case 'n': wm_name = xstrdup(optarg); break; case 'b': topbar = false; break; case 'd': dock = true; break; case 'f': font_load(optarg); break; @@ -1485,11 +1440,7 @@ // Initialize the stack holding the clickable areas area_stack.index = 0; area_stack.alloc = 10; - area_stack.ptr = calloc(10, sizeof(area_t)); - if (!area_stack.ptr) { - fprintf(stderr, "Failed to allocate enough input areas\n"); - return EXIT_FAILURE; - } + area_stack.ptr = xcalloc(10, sizeof(area_t)); // Copy the geometry values in place bw = geom_v[0]; @@ -1504,6 +1455,12 @@ // Get the fd to Xserver pollin[1].fd = xcb_get_file_descriptor(c); +#ifdef __OpenBSD__ + if (pledge("stdio rpath", NULL) < 0) { + err(EXIT_FAILURE, "pledge failed"); + } +#endif + for (;;) { bool redraw = false; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bar-1.4/utils.c new/bar-1.5/utils.c --- old/bar-1.4/utils.c 1970-01-01 01:00:00.000000000 +0100 +++ new/bar-1.5/utils.c 2024-04-30 09:50:08.000000000 +0200 @@ -0,0 +1,55 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +static void +oom_error(const char *func) +{ + fprintf(stderr, "fatal error in %s: out of memory\n", func); + // Prefer abort() over exit(1) for better debuggability. + abort(); +} + +char* +xstrdup(const char *s) +{ + char *p = strdup(s); + if (p == NULL) oom_error(__func__); + return p; +} + +void* +xmalloc(size_t size) +{ + void *p = malloc(size); + if (p == NULL) oom_error(__func__); + return p; +} + +void* +xcalloc(size_t nmemb, size_t size) +{ + void *p = calloc(nmemb, size); + if (p == NULL) oom_error(__func__); + return p; +} + +void* +xrealloc(void *ptr, size_t size) +{ + void *p = realloc(ptr, size); + if (p == NULL) oom_error(__func__); + return p; +} + +void* +xreallocarray(void *ptr, size_t nmemb, size_t size) +{ + size_t alloc_size; + void *p; + if (__builtin_mul_overflow(nmemb, size, &alloc_size)) + oom_error(__func__); + p = realloc(ptr, alloc_size); + if (p == NULL) oom_error(__func__); + return p; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bar-1.4/utils.h new/bar-1.5/utils.h --- old/bar-1.4/utils.h 1970-01-01 01:00:00.000000000 +0100 +++ new/bar-1.5/utils.h 2024-04-30 09:50:08.000000000 +0200 @@ -0,0 +1,10 @@ +#ifndef UTILS_H_ +#define UTILS_H_ + +char* xstrdup(const char *s); +void* xmalloc(size_t size); +void* xcalloc(size_t nmemb, size_t size); +void* xrealloc(void *ptr, size_t size); +void* xreallocarray(void *ptr, size_t nmemb, size_t size); + +#endif
