Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package swaybg for openSUSE:Factory checked in at 2024-04-30 17:26:38 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/swaybg (Old) and /work/SRC/openSUSE:Factory/.swaybg.new.1880 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "swaybg" Tue Apr 30 17:26:38 2024 rev:6 rq:1170661 version:1.2.1 Changes: -------- --- /work/SRC/openSUSE:Factory/swaybg/swaybg.changes 2023-01-17 17:35:50.505363815 +0100 +++ /work/SRC/openSUSE:Factory/.swaybg.new.1880/swaybg.changes 2024-04-30 17:27:41.770904957 +0200 @@ -1,0 +2,12 @@ +Mon Apr 29 06:24:33 UTC 2024 - Michael Vetter <[email protected]> + +- Update to 1.2.1: + * Unify color validation and parsing functions + * Document option arguments in command line usage + * Correct for image orientation when loading image + * wayland-protocols min. version to 1.26 + * main.c: fix build against gcc-14 (-Walloc-size) + * build: find native wayland-scanner program + * build: drop intermediate protocols library + +------------------------------------------------------------------- Old: ---- swaybg-1.2.0.tar.gz New: ---- swaybg-1.2.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ swaybg.spec ++++++ --- /var/tmp/diff_new_pack.UZs7t1/_old 2024-04-30 17:27:42.194920375 +0200 +++ /var/tmp/diff_new_pack.UZs7t1/_new 2024-04-30 17:27:42.194920375 +0200 @@ -1,7 +1,7 @@ # # spec file for package swaybg # -# Copyright (c) 2023 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 @@ -17,7 +17,7 @@ Name: swaybg -Version: 1.2.0 +Version: 1.2.1 Release: 0 Summary: Wallpaper tool for Wayland compositors License: MIT @@ -32,7 +32,7 @@ BuildRequires: pkgconfig(cairo) BuildRequires: pkgconfig(gdk-pixbuf-2.0) BuildRequires: pkgconfig(wayland-client) -BuildRequires: pkgconfig(wayland-protocols) +BuildRequires: pkgconfig(wayland-protocols) >= 1.26 BuildRequires: pkgconfig(wayland-server) BuildRequires: pkgconfig(xkbcommon) ++++++ swaybg-1.2.0.tar.gz -> swaybg-1.2.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/swaybg-1.2.0/background-image.c new/swaybg-1.2.1/background-image.c --- old/swaybg-1.2.0/background-image.c 2022-12-04 17:40:47.000000000 +0100 +++ new/swaybg-1.2.1/background-image.c 2024-04-28 10:09:42.000000000 +0200 @@ -31,8 +31,12 @@ err->message); return NULL; } - image = gdk_cairo_image_surface_create_from_pixbuf(pixbuf); + // Correct for embedded image orientation; typical images are not + // rotated and will be handled efficiently + GdkPixbuf *oriented = gdk_pixbuf_apply_embedded_orientation(pixbuf); g_object_unref(pixbuf); + image = gdk_cairo_image_surface_create_from_pixbuf(oriented); + g_object_unref(oriented); #else image = cairo_image_surface_create_from_png(path); #endif // HAVE_GDK_PIXBUF diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/swaybg-1.2.0/main.c new/swaybg-1.2.1/main.c --- old/swaybg-1.2.0/main.c 2022-12-04 17:40:47.000000000 +0100 +++ new/swaybg-1.2.1/main.c 2024-04-28 10:09:42.000000000 +0200 @@ -16,22 +16,29 @@ #include "viewporter-client-protocol.h" #include "single-pixel-buffer-v1-client-protocol.h" -static uint32_t parse_color(const char *color) { +/* + * If `color` is a hexadecimal string of the form 'rrggbb' or '#rrggbb', + * `*result` will be set to the uint32_t version of the color. Otherwise, + * return false and leave `*result` unmodified. + */ +static bool parse_color(const char *color, uint32_t *result) { if (color[0] == '#') { ++color; } int len = strlen(color); - if (len != 6 && len != 8) { - swaybg_log(LOG_DEBUG, "Invalid color %s, defaulting to 0xFFFFFFFF", - color); - return 0xFFFFFFFF; - } - uint32_t res = (uint32_t)strtoul(color, NULL, 16); - if (strlen(color) == 6) { - res = (res << 8) | 0xFF; + if (len != 6) { + return false; + } + for (int i = 0; i < len; ++i) { + if (!isxdigit(color[i])) { + return false; + } } - return res; + + uint32_t val = (uint32_t)strtoul(color, NULL, 16); + *result = (val << 8) | 0xFF; + return true; } struct swaybg_state { @@ -84,24 +91,6 @@ struct wl_list link; }; -bool is_valid_color(const char *color) { - int len = strlen(color); - if (len != 7 || color[0] != '#') { - swaybg_log(LOG_ERROR, "%s is not a valid color for swaybg. " - "Color should be specified as #rrggbb (no alpha).", color); - return false; - } - - int i; - for (i = 1; i < len; ++i) { - if (!isxdigit(color[i])) { - return false; - } - } - - return true; -} - static void render_frame(struct swaybg_output *output, cairo_surface_t *surface) { int buffer_width = output->width * output->scale, buffer_height = output->height * output->scale; @@ -445,17 +434,17 @@ const char *usage = "Usage: swaybg <options...>\n" "\n" - " -c, --color Set the background color.\n" + " -c, --color RRGGBB Set the background color.\n" " -h, --help Show help message and quit.\n" - " -i, --image Set the image to display.\n" - " -m, --mode Set the mode to use for the image.\n" - " -o, --output Set the output to operate on or * for all.\n" + " -i, --image <path> Set the image to display.\n" + " -m, --mode <mode> Set the mode to use for the image.\n" + " -o, --output <name> Set the output to operate on or * for all.\n" " -v, --version Show the version number and quit.\n" "\n" "Background Modes:\n" " stretch, fit, fill, center, tile, or solid_color\n"; - struct swaybg_output_config *config = calloc(sizeof(struct swaybg_output_config), 1); + struct swaybg_output_config *config = calloc(1, sizeof(struct swaybg_output_config)); config->output = strdup("*"); config->mode = BACKGROUND_MODE_INVALID; wl_list_init(&config->link); // init for safe removal @@ -469,11 +458,11 @@ } switch (c) { case 'c': // color - if (!is_valid_color(optarg)) { - swaybg_log(LOG_ERROR, "Invalid color: %s", optarg); + if (!parse_color(optarg, &config->color)) { + swaybg_log(LOG_ERROR, "%s is not a valid color for swaybg. " + "Color should be specified as rrggbb or #rrggbb (no alpha).", optarg); continue; } - config->color = parse_color(optarg); break; case 'i': // image config->image_path = optarg; @@ -489,7 +478,7 @@ // Empty config or merged on top of an existing one destroy_swaybg_output_config(config); } - config = calloc(sizeof(struct swaybg_output_config), 1); + config = calloc(1, sizeof(struct swaybg_output_config)); config->output = strdup(optarg); config->mode = BACKGROUND_MODE_INVALID; wl_list_init(&config->link); // init for safe removal diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/swaybg-1.2.0/meson.build new/swaybg-1.2.1/meson.build --- old/swaybg-1.2.0/meson.build 2022-12-04 17:40:47.000000000 +0100 +++ new/swaybg-1.2.1/meson.build 2024-04-28 10:09:42.000000000 +0200 @@ -1,7 +1,7 @@ project( 'swaybg', 'c', - version: '1.2.0', + version: '1.2.1', license: 'MIT', meson_version: '>=0.59.0', default_options: [ @@ -26,12 +26,11 @@ add_project_arguments('-D_C11_SOURCE', language: 'c') endif - cc = meson.get_compiler('c') rt = cc.find_library('rt') wayland_client = dependency('wayland-client') -wayland_protos = dependency('wayland-protocols', version: '>=1.14') +wayland_protos = dependency('wayland-protocols', version: '>=1.26') wayland_scanner = dependency('wayland-scanner', version: '>=1.14.91', native: true) cairo = dependency('cairo') gdk_pixbuf = dependency('gdk-pixbuf-2.0', required: get_option('gdk-pixbuf')) @@ -55,7 +54,7 @@ wl_protocol_dir = wayland_protos.get_variable('pkgdatadir') -wayland_scanner_prog = find_program(wayland_scanner.get_variable('wayland_scanner')) +wayland_scanner_prog = find_program(wayland_scanner.get_variable('wayland_scanner'), native: true) wayland_scanner_code = generator( wayland_scanner_prog, @@ -69,8 +68,7 @@ arguments: ['client-header', '@INPUT@', '@OUTPUT@'], ) -client_protos_src = [] -client_protos_headers = [] +protos_src = [] client_protocols = [ wl_protocol_dir / 'stable/xdg-shell/xdg-shell.xml', @@ -80,43 +78,27 @@ ] foreach filename : client_protocols - client_protos_src += wayland_scanner_code.process(filename) - client_protos_headers += wayland_scanner_client.process(filename) + protos_src += wayland_scanner_code.process(filename) + protos_src += wayland_scanner_client.process(filename) endforeach -lib_client_protos = static_library( - 'client_protos', - client_protos_src + client_protos_headers, - dependencies: [wayland_client] -) # for the include directory - -client_protos = declare_dependency( - link_with: lib_client_protos, - sources: client_protos_headers, -) - -dependencies = [ - cairo, - client_protos, - rt, - gdk_pixbuf, - wayland_client, -] - -sources = [ - 'background-image.c', - 'cairo.c', - 'log.c', - 'main.c', - 'pool-buffer.c', -] - -swaybg_inc = include_directories('include') - -executable('swaybg', - sources, - include_directories: [swaybg_inc], - dependencies: dependencies, +executable( + 'swaybg', + [ + 'background-image.c', + 'cairo.c', + 'log.c', + 'main.c', + 'pool-buffer.c', + protos_src, + ], + include_directories: 'include', + dependencies: [ + cairo, + rt, + gdk_pixbuf, + wayland_client, + ], install: true ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/swaybg-1.2.0/swaybg.1.scd new/swaybg-1.2.1/swaybg.1.scd --- old/swaybg-1.2.0/swaybg.1.scd 2022-12-04 17:40:47.000000000 +0100 +++ new/swaybg-1.2.1/swaybg.1.scd 2024-04-28 10:09:42.000000000 +0200 @@ -16,7 +16,7 @@ # OPTIONS -*-c, --color* <#rrggbb> +*-c, --color* <[#]rrggbb> Set the background color. *-h, --help*
