Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package swaybg for openSUSE:Factory checked 
in at 2023-01-17 17:35:39
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/swaybg (Old)
 and      /work/SRC/openSUSE:Factory/.swaybg.new.32243 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "swaybg"

Tue Jan 17 17:35:39 2023 rev:5 rq:1058860 version:1.2.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/swaybg/swaybg.changes    2022-03-11 
11:36:26.890280085 +0100
+++ /work/SRC/openSUSE:Factory/.swaybg.new.32243/swaybg.changes 2023-01-17 
17:35:50.505363815 +0100
@@ -1,0 +2,13 @@
+Tue Jan 17 08:47:13 UTC 2023 - Dirk Müller <[email protected]>
+
+- update to 1.2.0:
+  * man: fix background color input format
+  * Use shm_open instead of mkstemp for anon files
+  * Check wl_display_roundtrip return value
+  * readme: drop mention of xdg-shell requirement
+  * build: stop using join_paths
+  * build: stop using sh for scdoc
+  * Replace xdg_output with wl_output v4
+  * Optimize solid color with single-pixel-buffer-v1
+
+-------------------------------------------------------------------

Old:
----
  swaybg-1.1.1.tar.gz

New:
----
  swaybg-1.2.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ swaybg.spec ++++++
--- /var/tmp/diff_new_pack.qNguZb/_old  2023-01-17 17:35:51.053366905 +0100
+++ /var/tmp/diff_new_pack.qNguZb/_new  2023-01-17 17:35:51.057366927 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package swaybg
 #
-# Copyright (c) 2022 SUSE LLC
+# Copyright (c) 2023 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.1.1
+Version:        1.2.0
 Release:        0
 Summary:        Wallpaper tool for Wayland compositors
 License:        MIT

++++++ swaybg-1.1.1.tar.gz -> swaybg-1.2.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/swaybg-1.1.1/README.md new/swaybg-1.2.0/README.md
--- old/swaybg-1.1.1/README.md  2022-03-10 10:23:40.000000000 +0100
+++ new/swaybg-1.2.0/README.md  2022-12-04 17:40:47.000000000 +0100
@@ -1,11 +1,8 @@
 # swaybg
 
-swaybg is a wallpaper utility for Wayland compositors. It is compatible with 
any
-Wayland compositor which implements the following Wayland protocols:
-
-- wlr-layer-shell
-- xdg-output
-- xdg-shell
+swaybg is a wallpaper utility for Wayland compositors. It is compatible with
+any Wayland compositor which implements the wlr-layer-shell protocol and
+`wl_output` version 4.
 
 See the man page, `swaybg(1)`, for instructions on using swaybg.
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/swaybg-1.1.1/main.c new/swaybg-1.2.0/main.c
--- old/swaybg-1.1.1/main.c     2022-03-10 10:23:40.000000000 +0100
+++ new/swaybg-1.2.0/main.c     2022-12-04 17:40:47.000000000 +0100
@@ -13,7 +13,8 @@
 #include "log.h"
 #include "pool-buffer.h"
 #include "wlr-layer-shell-unstable-v1-client-protocol.h"
-#include "xdg-output-unstable-v1-client-protocol.h"
+#include "viewporter-client-protocol.h"
+#include "single-pixel-buffer-v1-client-protocol.h"
 
 static uint32_t parse_color(const char *color) {
        if (color[0] == '#') {
@@ -38,7 +39,8 @@
        struct wl_compositor *compositor;
        struct wl_shm *shm;
        struct zwlr_layer_shell_v1 *layer_shell;
-       struct zxdg_output_manager_v1 *xdg_output_manager;
+       struct wp_viewporter *viewporter;
+       struct wp_single_pixel_buffer_manager_v1 *single_pixel_buffer_manager;
        struct wl_list configs;  // struct swaybg_output_config::link
        struct wl_list outputs;  // struct swaybg_output::link
        struct wl_list images;   // struct swaybg_image::link
@@ -63,7 +65,6 @@
 struct swaybg_output {
        uint32_t wl_name;
        struct wl_output *wl_output;
-       struct zxdg_output_v1 *xdg_output;
        char *name;
        char *identifier;
 
@@ -117,6 +118,35 @@
                }
                return;
        }
+
+       if (output->config->mode == BACKGROUND_MODE_SOLID_COLOR &&
+                       output->state->viewporter &&
+                       output->state->single_pixel_buffer_manager) {
+               uint8_t r8 = (output->config->color >> 24) & 0xFF;
+               uint8_t g8 = (output->config->color >> 16) & 0xFF;
+               uint8_t b8 = (output->config->color >> 8) & 0xFF;
+               uint8_t a8 = (output->config->color >> 0) & 0xFF;
+               uint32_t f = 0xFFFFFFFF / 0xFF; // division result is an integer
+               uint32_t r32 = r8 * f;
+               uint32_t g32 = g8 * f;
+               uint32_t b32 = b8 * f;
+               uint32_t a32 = a8 * f;
+               struct wl_buffer *buffer = 
wp_single_pixel_buffer_manager_v1_create_u32_rgba_buffer(
+                       output->state->single_pixel_buffer_manager, r32, g32, 
b32, a32);
+               wl_surface_attach(output->surface, buffer, 0, 0);
+               wl_surface_damage_buffer(output->surface, 0, 0, INT32_MAX, 
INT32_MAX);
+
+               struct wp_viewport *viewport = wp_viewporter_get_viewport(
+                       output->state->viewporter, output->surface);
+               wp_viewport_set_destination(viewport, output->width, 
output->height);
+
+               wl_surface_commit(output->surface);
+
+               wp_viewport_destroy(viewport);
+               wl_buffer_destroy(buffer);
+               return;
+       }
+
        struct pool_buffer buffer;
        if (!create_buffer(&buffer, output->state->shm,
                        buffer_width, buffer_height, WL_SHM_FORMAT_ARGB8888)) {
@@ -184,7 +214,6 @@
        if (output->surface != NULL) {
                wl_surface_destroy(output->surface);
        }
-       zxdg_output_v1_destroy(output->xdg_output);
        wl_output_destroy(output->wl_output);
        free(output->name);
        free(output->identifier);
@@ -226,8 +255,45 @@
        // Who cares
 }
 
-static void output_done(void *data, struct wl_output *output) {
-       // Who cares
+static void create_layer_surface(struct swaybg_output *output) {
+       output->surface = 
wl_compositor_create_surface(output->state->compositor);
+       assert(output->surface);
+
+       // Empty input region
+       struct wl_region *input_region =
+               wl_compositor_create_region(output->state->compositor);
+       assert(input_region);
+       wl_surface_set_input_region(output->surface, input_region);
+       wl_region_destroy(input_region);
+
+       output->layer_surface = zwlr_layer_shell_v1_get_layer_surface(
+                       output->state->layer_shell, output->surface, 
output->wl_output,
+                       ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND, "wallpaper");
+       assert(output->layer_surface);
+
+       zwlr_layer_surface_v1_set_size(output->layer_surface, 0, 0);
+       zwlr_layer_surface_v1_set_anchor(output->layer_surface,
+                       ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP |
+                       ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT |
+                       ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM |
+                       ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT);
+       zwlr_layer_surface_v1_set_exclusive_zone(output->layer_surface, -1);
+       zwlr_layer_surface_v1_add_listener(output->layer_surface,
+                       &layer_surface_listener, output);
+       wl_surface_commit(output->surface);
+}
+
+static void output_done(void *data, struct wl_output *wl_output) {
+       struct swaybg_output *output = data;
+       if (!output->config) {
+               swaybg_log(LOG_DEBUG, "Could not find config for output %s 
(%s)",
+                               output->name, output->identifier);
+               destroy_swaybg_output(output);
+       } else if (!output->layer_surface) {
+               swaybg_log(LOG_DEBUG, "Found config %s for output %s (%s)",
+                               output->config->output, output->name, 
output->identifier);
+               create_layer_surface(output);
+       }
 }
 
 static void output_scale(void *data, struct wl_output *wl_output,
@@ -239,23 +305,6 @@
        }
 }
 
-static const struct wl_output_listener output_listener = {
-       .geometry = output_geometry,
-       .mode = output_mode,
-       .done = output_done,
-       .scale = output_scale,
-};
-
-static void xdg_output_handle_logical_position(void *data,
-               struct zxdg_output_v1 *xdg_output, int32_t x, int32_t y) {
-       // Who cares
-}
-
-static void xdg_output_handle_logical_size(void *data,
-               struct zxdg_output_v1 *xdg_output, int32_t width, int32_t 
height) {
-       // Who cares
-}
-
 static void find_config(struct swaybg_output *output, const char *name) {
        struct swaybg_output_config *config = NULL;
        wl_list_for_each(config, &output->state->configs, link) {
@@ -268,8 +317,8 @@
        }
 }
 
-static void xdg_output_handle_name(void *data,
-               struct zxdg_output_v1 *xdg_output, const char *name) {
+static void output_name(void *data, struct wl_output *wl_output,
+               const char *name) {
        struct swaybg_output *output = data;
        output->name = strdup(name);
 
@@ -280,8 +329,8 @@
        }
 }
 
-static void xdg_output_handle_description(void *data,
-               struct zxdg_output_v1 *xdg_output, const char *description) {
+static void output_description(void *data, struct wl_output *wl_output,
+               const char *description) {
        struct swaybg_output *output = data;
 
        // wlroots currently sets the description to `make model serial (name)`
@@ -301,54 +350,13 @@
        }
 }
 
-static void create_layer_surface(struct swaybg_output *output) {
-       output->surface = 
wl_compositor_create_surface(output->state->compositor);
-       assert(output->surface);
-
-       // Empty input region
-       struct wl_region *input_region =
-               wl_compositor_create_region(output->state->compositor);
-       assert(input_region);
-       wl_surface_set_input_region(output->surface, input_region);
-       wl_region_destroy(input_region);
-
-       output->layer_surface = zwlr_layer_shell_v1_get_layer_surface(
-                       output->state->layer_shell, output->surface, 
output->wl_output,
-                       ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND, "wallpaper");
-       assert(output->layer_surface);
-
-       zwlr_layer_surface_v1_set_size(output->layer_surface, 0, 0);
-       zwlr_layer_surface_v1_set_anchor(output->layer_surface,
-                       ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP |
-                       ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT |
-                       ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM |
-                       ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT);
-       zwlr_layer_surface_v1_set_exclusive_zone(output->layer_surface, -1);
-       zwlr_layer_surface_v1_add_listener(output->layer_surface,
-                       &layer_surface_listener, output);
-       wl_surface_commit(output->surface);
-}
-
-static void xdg_output_handle_done(void *data,
-               struct zxdg_output_v1 *xdg_output) {
-       struct swaybg_output *output = data;
-       if (!output->config) {
-               swaybg_log(LOG_DEBUG, "Could not find config for output %s 
(%s)",
-                               output->name, output->identifier);
-               destroy_swaybg_output(output);
-       } else if (!output->layer_surface) {
-               swaybg_log(LOG_DEBUG, "Found config %s for output %s (%s)",
-                               output->config->output, output->name, 
output->identifier);
-               create_layer_surface(output);
-       }
-}
-
-static const struct zxdg_output_v1_listener xdg_output_listener = {
-       .logical_position = xdg_output_handle_logical_position,
-       .logical_size = xdg_output_handle_logical_size,
-       .name = xdg_output_handle_name,
-       .description = xdg_output_handle_description,
-       .done = xdg_output_handle_done,
+static const struct wl_output_listener output_listener = {
+       .geometry = output_geometry,
+       .mode = output_mode,
+       .done = output_done,
+       .scale = output_scale,
+       .name = output_name,
+       .description = output_description,
 };
 
 static void handle_global(void *data, struct wl_registry *registry,
@@ -364,22 +372,19 @@
                output->state = state;
                output->wl_name = name;
                output->wl_output =
-                       wl_registry_bind(registry, name, &wl_output_interface, 
3);
+                       wl_registry_bind(registry, name, &wl_output_interface, 
4);
                wl_output_add_listener(output->wl_output, &output_listener, 
output);
                wl_list_insert(&state->outputs, &output->link);
-
-               if (state->run_display) {
-                       output->xdg_output = 
zxdg_output_manager_v1_get_xdg_output(
-                               state->xdg_output_manager, output->wl_output);
-                       zxdg_output_v1_add_listener(output->xdg_output,
-                               &xdg_output_listener, output);
-               }
        } else if (strcmp(interface, zwlr_layer_shell_v1_interface.name) == 0) {
                state->layer_shell =
                        wl_registry_bind(registry, name, 
&zwlr_layer_shell_v1_interface, 1);
-       } else if (strcmp(interface, zxdg_output_manager_v1_interface.name) == 
0) {
-               state->xdg_output_manager = wl_registry_bind(registry, name,
-                       &zxdg_output_manager_v1_interface, 2);
+       } else if (strcmp(interface, wp_viewporter_interface.name) == 0) {
+               state->viewporter = wl_registry_bind(registry, name,
+                       &wp_viewporter_interface, 1);
+       } else if (strcmp(interface,
+                       wp_single_pixel_buffer_manager_v1_interface.name) == 0) 
{
+               state->single_pixel_buffer_manager = wl_registry_bind(registry, 
name,
+                       &wp_single_pixel_buffer_manager_v1_interface, 1);
        }
 }
 
@@ -573,24 +578,20 @@
 
        struct wl_registry *registry = wl_display_get_registry(state.display);
        wl_registry_add_listener(registry, &registry_listener, &state);
-       wl_display_roundtrip(state.display);
+       if (wl_display_roundtrip(state.display) < 0) {
+               swaybg_log(LOG_ERROR, "wl_display_roundtrip failed");
+               return 1;
+       }
        if (state.compositor == NULL || state.shm == NULL ||
-                       state.layer_shell == NULL || state.xdg_output_manager 
== NULL) {
+                       state.layer_shell == NULL) {
                swaybg_log(LOG_ERROR, "Missing a required Wayland interface");
                return 1;
        }
 
-       struct swaybg_output *output;
-       wl_list_for_each(output, &state.outputs, link) {
-               output->xdg_output = zxdg_output_manager_v1_get_xdg_output(
-                       state.xdg_output_manager, output->wl_output);
-               zxdg_output_v1_add_listener(output->xdg_output,
-                       &xdg_output_listener, output);
-       }
-
        state.run_display = true;
        while (wl_display_dispatch(state.display) != -1 && state.run_display) {
                // Send acks, and determine which images need to be loaded
+               struct swaybg_output *output;
                wl_list_for_each(output, &state.outputs, link) {
                        if (output->needs_ack) {
                                output->needs_ack = false;
@@ -641,7 +642,7 @@
                }
        }
 
-       struct swaybg_output *tmp_output;
+       struct swaybg_output *output, *tmp_output;
        wl_list_for_each_safe(output, tmp_output, &state.outputs, link) {
                destroy_swaybg_output(output);
        }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/swaybg-1.1.1/meson.build new/swaybg-1.2.0/meson.build
--- old/swaybg-1.1.1/meson.build        2022-03-10 10:23:40.000000000 +0100
+++ new/swaybg-1.2.0/meson.build        2022-12-04 17:40:47.000000000 +0100
@@ -1,9 +1,9 @@
 project(
        'swaybg',
        'c',
-       version: '1.1.1',
+       version: '1.2.0',
        license: 'MIT',
-       meson_version: '>=0.48.0',
+       meson_version: '>=0.59.0',
        default_options: [
                'c_std=c11',
                'warning_level=2',
@@ -26,6 +26,10 @@
        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_scanner = dependency('wayland-scanner', version: '>=1.14.91', native: 
true)
@@ -49,9 +53,9 @@
        '-DHAVE_GDK_PIXBUF=@0@'.format(gdk_pixbuf.found().to_int()),
 ], language: 'c')
 
-wl_protocol_dir = wayland_protos.get_pkgconfig_variable('pkgdatadir')
+wl_protocol_dir = wayland_protos.get_variable('pkgdatadir')
 
-wayland_scanner_prog = 
find_program(wayland_scanner.get_pkgconfig_variable('wayland_scanner'))
+wayland_scanner_prog = 
find_program(wayland_scanner.get_variable('wayland_scanner'))
 
 wayland_scanner_code = generator(
        wayland_scanner_prog,
@@ -69,15 +73,15 @@
 client_protos_headers = []
 
 client_protocols = [
-       [wl_protocol_dir, 'stable/xdg-shell/xdg-shell.xml'],
-       [wl_protocol_dir, 'unstable/xdg-output/xdg-output-unstable-v1.xml'],
-       ['wlr-layer-shell-unstable-v1.xml'],
+       wl_protocol_dir / 'stable/xdg-shell/xdg-shell.xml',
+       wl_protocol_dir / 'stable/viewporter/viewporter.xml',
+       wl_protocol_dir / 
'staging/single-pixel-buffer/single-pixel-buffer-v1.xml',
+       'wlr-layer-shell-unstable-v1.xml',
 ]
 
-foreach p : client_protocols
-       xml = join_paths(p)
-       client_protos_src += wayland_scanner_code.process(xml)
-       client_protos_headers += wayland_scanner_client.process(xml)
+foreach filename : client_protocols
+       client_protos_src += wayland_scanner_code.process(filename)
+       client_protos_headers += wayland_scanner_client.process(filename)
 endforeach
 
 lib_client_protos = static_library(
@@ -94,6 +98,7 @@
 dependencies = [
        cairo,
        client_protos,
+       rt,
        gdk_pixbuf,
        wayland_client,
 ]
@@ -116,7 +121,6 @@
 )
 
 if scdoc.found()
-       sh = find_program('sh')
        mandir = get_option('mandir')
        man_files = [
                'swaybg.1.scd',
@@ -130,9 +134,9 @@
                        output,
                        input: filename,
                        output: output,
-                       command: [
-                               sh, '-c', '@0@ < @INPUT@ > 
@1@'.format(scdoc.path(), output)
-                       ],
+                       command: scdoc,
+                       feed: true,
+                       capture: true,
                        install: true,
                        install_dir: '@0@/man@1@'.format(mandir, section)
                )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/swaybg-1.1.1/pool-buffer.c 
new/swaybg-1.2.0/pool-buffer.c
--- old/swaybg-1.1.1/pool-buffer.c      2022-03-10 10:23:40.000000000 +0100
+++ new/swaybg-1.2.0/pool-buffer.c      2022-12-04 17:40:47.000000000 +0100
@@ -1,60 +1,40 @@
 #define _POSIX_C_SOURCE 200809
 #include <assert.h>
 #include <cairo.h>
+#include <errno.h>
 #include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/mman.h>
+#include <time.h>
 #include <unistd.h>
 #include <wayland-client.h>
 #include "pool-buffer.h"
 
-static bool set_cloexec(int fd) {
-       long flags = fcntl(fd, F_GETFD);
-       if (flags == -1) {
-               return false;
-       }
-
-       if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) == -1) {
-               return false;
-       }
-
-       return true;
-}
-
-static int create_pool_file(size_t size, char **name) {
-       static const char template[] = "sway-client-XXXXXX";
-       const char *path = getenv("XDG_RUNTIME_DIR");
-       if (path == NULL) {
-               fprintf(stderr, "XDG_RUNTIME_DIR is not set\n");
-               return -1;
-       }
-
-       size_t name_size = strlen(template) + 1 + strlen(path) + 1;
-       *name = malloc(name_size);
-       if (*name == NULL) {
-               fprintf(stderr, "allocation failed\n");
-               return -1;
-       }
-       snprintf(*name, name_size, "%s/%s", path, template);
-
-       int fd = mkstemp(*name);
-       if (fd < 0) {
-               return -1;
-       }
+static int anonymous_shm_open(void) {
+       int retries = 100;
 
-       if (!set_cloexec(fd)) {
-               close(fd);
-               return -1;
-       }
+       do {
+               // try a probably-unique name
+               struct timespec ts;
+               clock_gettime(CLOCK_MONOTONIC, &ts);
+               pid_t pid = getpid();
+               char name[50];
+               snprintf(name, sizeof(name), "/swaybg-%x-%x",
+                       (unsigned int)pid, (unsigned int)ts.tv_nsec);
+
+               // shm_open guarantees that O_CLOEXEC is set
+               int fd = shm_open(name, O_RDWR | O_CREAT | O_EXCL, 0600);
+               if (fd >= 0) {
+                       shm_unlink(name);
+                       return fd;
+               }
 
-       if (ftruncate(fd, size) < 0) {
-               close(fd);
-               return -1;
-       }
+               --retries;
+       } while (retries > 0 && errno == EEXIST);
 
-       return fd;
+       return -1;
 }
 
 bool create_buffer(struct pool_buffer *buf, struct wl_shm *shm,
@@ -62,18 +42,20 @@
        uint32_t stride = width * 4;
        size_t size = stride * height;
 
-       char *name;
-       int fd = create_pool_file(size, &name);
+       int fd = anonymous_shm_open();
        assert(fd != -1);
+
+       if (ftruncate(fd, size) < 0) {
+               close(fd);
+               return false;
+       }
+
        void *data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 
0);
        struct wl_shm_pool *pool = wl_shm_create_pool(shm, fd, size);
        buf->buffer = wl_shm_pool_create_buffer(pool, 0,
                        width, height, stride, format);
        wl_shm_pool_destroy(pool);
        close(fd);
-       unlink(name);
-       free(name);
-       fd = -1;
 
        buf->size = size;
        buf->data = data;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/swaybg-1.1.1/swaybg.1.scd 
new/swaybg-1.2.0/swaybg.1.scd
--- old/swaybg-1.1.1/swaybg.1.scd       2022-03-10 10:23:40.000000000 +0100
+++ new/swaybg-1.2.0/swaybg.1.scd       2022-12-04 17:40:47.000000000 +0100
@@ -16,7 +16,7 @@
 
 # OPTIONS
 
-*-c, --color* <rrggbb[aa]>
+*-c, --color* <#rrggbb>
        Set the background color.
 
 *-h, --help*

Reply via email to