Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package xdg-desktop-portal-wlr for 
openSUSE:Factory checked in at 2021-02-15 23:20:14
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/xdg-desktop-portal-wlr (Old)
 and      /work/SRC/openSUSE:Factory/.xdg-desktop-portal-wlr.new.28504 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "xdg-desktop-portal-wlr"

Mon Feb 15 23:20:14 2021 rev:2 rq:872363 version:0.2.0

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/xdg-desktop-portal-wlr/xdg-desktop-portal-wlr.changes
    2020-07-15 15:04:53.883402901 +0200
+++ 
/work/SRC/openSUSE:Factory/.xdg-desktop-portal-wlr.new.28504/xdg-desktop-portal-wlr.changes
 2021-02-15 23:21:56.799901802 +0100
@@ -1,0 +2,28 @@
+Mon Feb 15 10:59:47 UTC 2021 - Michael Vetter <[email protected]>
+
+- Update to 0.2.0:
+  * Add Wayfire to portal UseIn list, as it is also supported
+  * Add river to portal UseIn list
+  * build: introduce sd-bus-provider option
+  * build: add basu as sd-bus provider
+  * screencast: prefix macros to avoid conflict with system definitions
+  * Revert "Remove unnecessary check from wlr_screencast.c" (#54)
+  * core: fix error handling in main
+  * core/main: Add static qualifier to internal func
+  * core/main: Use EXIT_FAILURE / EXIT_SUCCESS
+  * core/main: Clean up option handling
+  * systemd: ensure service is stopped on exit of graphical session
+  * Fix freeze on skipped frame
+  * Remove extraneous whitespace
+  * Add --replace flag
+  * Destroy wlr_buffer only on quit or error in wlr_screencast.c
+  * Only recreate simple_frame on change in wlr_screencast.c
+  * munmap simple_frame.data only if needed in wlr_screencast.c
+  * Fix log messages in wlr_screencast.c
+  * Refresh buffer on change in wlr_screencast.c
+  * Change refresh logic and add tests in wlr_screencast.c
+  * Add functions to clean simple_buffer.{data,buffer} in wlr_screencast.c
+  * Remove unecessary checks in wlr_screencast.c
+  * Update to wlr-screencopy-unstable-v1 version 3
+
+-------------------------------------------------------------------

Old:
----
  xdg-desktop-portal-wlr-0.1.0.tar.gz
  xdg-desktop-portal-wlr-0.1.0.tar.gz.sig

New:
----
  xdg-desktop-portal-wlr-0.2.0.tar.gz
  xdg-desktop-portal-wlr-0.2.0.tar.gz.sig

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

Other differences:
------------------
++++++ xdg-desktop-portal-wlr.spec ++++++
--- /var/tmp/diff_new_pack.dSMhki/_old  2021-02-15 23:21:57.431902746 +0100
+++ /var/tmp/diff_new_pack.dSMhki/_new  2021-02-15 23:21:57.435902752 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package xdg-desktop-portal-wlr
 #
-# Copyright (c) 2020 SUSE LLC
+# Copyright (c) 2021 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:           xdg-desktop-portal-wlr
-Version:        0.1.0
+Version:        0.2.0
 Release:        0
 Summary:        An xdg-desktop-portal backend for wlroots
 License:        MIT
@@ -27,13 +27,13 @@
 Source1:        
%{url}/releases/download/v%{version}/xdg-desktop-portal-wlr-%{version}.tar.gz.sig
 BuildRequires:  meson
 BuildRequires:  pkgconfig
-BuildRequires:  pkgconfig(libpipewire-0.3)
+BuildRequires:  pkgconfig(libpipewire-0.3) >= 0.3.2
 BuildRequires:  pkgconfig(libsystemd)
 BuildRequires:  pkgconfig(systemd)
 BuildRequires:  pkgconfig(wayland-client)
-BuildRequires:  pkgconfig(wayland-protocols)
+BuildRequires:  pkgconfig(wayland-protocols) >= 1.14
 # Screencasting won't work without pipewire, but it's not a hard dependency.
-Recommends:     pipewire
+Recommends:     pipewire >= 0.3.2
 Requires:       xdg-desktop-portal
 
 %description
@@ -47,7 +47,7 @@
 %setup -q
 
 %build
-%meson
+%meson -Dsd-bus-provider=libsystemd
 %meson_build
 
 %install

++++++ xdg-desktop-portal-wlr-0.1.0.tar.gz -> 
xdg-desktop-portal-wlr-0.2.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/xdg-desktop-portal-wlr-0.1.0/.builds/freebsd.yml 
new/xdg-desktop-portal-wlr-0.2.0/.builds/freebsd.yml
--- old/xdg-desktop-portal-wlr-0.1.0/.builds/freebsd.yml        1970-01-01 
01:00:00.000000000 +0100
+++ new/xdg-desktop-portal-wlr-0.2.0/.builds/freebsd.yml        2021-02-15 
10:22:29.000000000 +0100
@@ -0,0 +1,17 @@
+image: freebsd/latest
+packages:
+  - basu
+  - meson
+  - pipewire
+  - pkgconf
+  - wayland
+  - wayland-protocols
+sources:
+  - https://github.com/emersion/xdg-desktop-portal-wlr
+tasks:
+  - setup: |
+      cd xdg-desktop-portal-wlr
+      meson build/
+  - build: |
+      cd xdg-desktop-portal-wlr
+      ninja -C build/
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/xdg-desktop-portal-wlr-0.1.0/CONTRIBUTING.md 
new/xdg-desktop-portal-wlr-0.2.0/CONTRIBUTING.md
--- old/xdg-desktop-portal-wlr-0.1.0/CONTRIBUTING.md    2020-05-05 
16:18:37.000000000 +0200
+++ new/xdg-desktop-portal-wlr-0.2.0/CONTRIBUTING.md    2021-02-15 
10:22:29.000000000 +0100
@@ -17,3 +17,12 @@
 [portal-test]: https://github.com/matthiasclasen/portal-test
 [trigger-screen-shot.py]: https://gitlab.gnome.org/snippets/814
 [xdp-screen-cast.py]: https://gitlab.gnome.org/snippets/19
+
+## Alternate *.portal Location
+
+xdg-desktop-portal will read the XDG_DESKTOP_PORTAL_DIR environment variable 
for an
+alternate path for *.portal files. This can be useful when testing changes to 
that
+portal file, or for testing xdpw without installing it. This feature is 
undocumented
+and shouldn't be relied on, but may be helpful in some circumstances.
+
+https://github.com/flatpak/xdg-desktop-portal/blob/e7f78640e35debb68fef891fc233c449006d9724/src/portal-impl.c#L124
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/xdg-desktop-portal-wlr-0.1.0/README.md 
new/xdg-desktop-portal-wlr-0.2.0/README.md
--- old/xdg-desktop-portal-wlr-0.1.0/README.md  2020-05-05 16:18:37.000000000 
+0200
+++ new/xdg-desktop-portal-wlr-0.2.0/README.md  2021-02-15 10:22:29.000000000 
+0100
@@ -21,9 +21,8 @@
 
 ### Distro Packages
 
-#### Arch Linux (AUR)
+[![Packaging 
status](https://repology.org/badge/vertical-allrepos/xdg-desktop-portal-wlr.svg)](https://repology.org/project/xdg-desktop-portal-wlr/versions)
 
-xdg-desktop-portal-wlr-git
 
 ## Running
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/xdg-desktop-portal-wlr-0.1.0/contrib/systemd/xdg-desktop-portal-wlr.service.in
 
new/xdg-desktop-portal-wlr-0.2.0/contrib/systemd/xdg-desktop-portal-wlr.service.in
--- 
old/xdg-desktop-portal-wlr-0.1.0/contrib/systemd/xdg-desktop-portal-wlr.service.in
  2020-05-05 16:18:37.000000000 +0200
+++ 
new/xdg-desktop-portal-wlr-0.2.0/contrib/systemd/xdg-desktop-portal-wlr.service.in
  2021-02-15 10:22:29.000000000 +0100
@@ -1,5 +1,7 @@
 [Unit]
 Description=Portal service (wlroots implementation)
+PartOf=graphical-session.target
+After=graphical-session.target
 
 [Service]
 Type=dbus
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/xdg-desktop-portal-wlr-0.1.0/include/pipewire_screencast.h 
new/xdg-desktop-portal-wlr-0.2.0/include/pipewire_screencast.h
--- old/xdg-desktop-portal-wlr-0.1.0/include/pipewire_screencast.h      
2020-05-05 16:18:37.000000000 +0200
+++ new/xdg-desktop-portal-wlr-0.2.0/include/pipewire_screencast.h      
2021-02-15 10:22:29.000000000 +0100
@@ -3,8 +3,8 @@
 
 #include "screencast_common.h"
 
-#define BUFFERS 1
-#define ALIGN 16
+#define XDPW_PWR_BUFFERS 1
+#define XDPW_PWR_ALIGN 16
 
 void xdpw_pwr_stream_init(struct xdpw_screencast_instance *cast);
 int xdpw_pwr_core_connect(struct xdpw_state *state);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/xdg-desktop-portal-wlr-0.1.0/include/wlr_screencast.h 
new/xdg-desktop-portal-wlr-0.2.0/include/wlr_screencast.h
--- old/xdg-desktop-portal-wlr-0.1.0/include/wlr_screencast.h   2020-05-05 
16:18:37.000000000 +0200
+++ new/xdg-desktop-portal-wlr-0.2.0/include/wlr_screencast.h   2021-02-15 
10:22:29.000000000 +0100
@@ -3,7 +3,14 @@
 
 #include "screencast_common.h"
 
-#define SC_MANAGER_VERSION 2
+#define WL_OUTPUT_VERSION 1
+
+#define SC_MANAGER_VERSION 3
+#define SC_MANAGER_VERSION_MIN 2
+
+#define WL_SHM_VERSION 1
+
+#define XDG_OUTPUT_MANAGER_VERSION 3
 
 struct xdpw_state;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/xdg-desktop-portal-wlr-0.1.0/include/xdpw.h 
new/xdg-desktop-portal-wlr-0.2.0/include/xdpw.h
--- old/xdg-desktop-portal-wlr-0.1.0/include/xdpw.h     2020-05-05 
16:18:37.000000000 +0200
+++ new/xdg-desktop-portal-wlr-0.2.0/include/xdpw.h     2021-02-15 
10:22:29.000000000 +0100
@@ -2,10 +2,12 @@
 #define XDPW_H
 
 #include <wayland-client.h>
-#ifdef HAVE_SYSTEMD
+#ifdef HAVE_LIBSYSTEMD
 #include <systemd/sd-bus.h>
-#elif HAVE_ELOGIND
+#elif HAVE_LIBELOGIND
 #include <elogind/sd-bus.h>
+#elif HAVE_BASU
+#include <basu/sd-bus.h>
 #endif
 
 #include "screencast_common.h"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/xdg-desktop-portal-wlr-0.1.0/meson.build 
new/xdg-desktop-portal-wlr-0.2.0/meson.build
--- old/xdg-desktop-portal-wlr-0.1.0/meson.build        2020-05-05 
16:18:37.000000000 +0200
+++ new/xdg-desktop-portal-wlr-0.2.0/meson.build        2021-02-15 
10:22:29.000000000 +0100
@@ -1,14 +1,10 @@
 project(
-       'xdg-desktop-portal-wlr',
-       'c',
-       version: '0.1.0',
-       license: 'MIT',
-       meson_version: '>=0.47.0',
-       default_options: [
-               'c_std=c11',
-               'warning_level=2',
-               'werror=true',
-       ],
+  'xdg-desktop-portal-wlr',
+  'c',
+version : '0.2.0',
+license : 'MIT',
+meson_version : '>=0.50.0',
+default_options : ['c_std=c11', 'warning_level=2', 'werror=true']
 )
 
 cc = meson.get_compiler('c')
@@ -23,17 +19,34 @@
 inc = include_directories('include')
 
 rt = cc.find_library('rt')
-pipewire = dependency('libpipewire-0.3', version: '>= 0.2.9')
+pipewire = dependency('libpipewire-0.3', version: '>= 0.3.2')
 wayland_client = dependency('wayland-client')
 wayland_protos = dependency('wayland-protocols', version: '>=1.14')
 
-logind = dependency('libsystemd', required: false)
-if logind.found()
-       add_project_arguments('-DHAVE_SYSTEMD=1', language: 'c')
+if get_option('sd-bus-provider') == 'auto'
+       assert(get_option('auto_features').auto(), 'sd-bus-provider must not be 
set to auto since auto_features != auto')
+       sdbus = dependency('libsystemd',
+               required: false,
+               not_found_message: 'libsystemd not found, trying libelogind',
+       )
+       if not sdbus.found()
+               sdbus = dependency('libelogind',
+                       required: false,
+                       not_found_message: 'libelogind not found, trying basu',
+               )
+       endif
+       if not sdbus.found()
+               sdbus = dependency('basu',
+                       required: false,
+               )
+       endif
+       if not sdbus.found()
+               error('Neither libsystemd, nor libelogind, nor basu was found')
+       endif
 else
-       logind = dependency('libelogind')
-       add_project_arguments('-DHAVE_ELOGIND=1', language: 'c')
+       sdbus = dependency(get_option('sd-bus-provider'))
 endif
+add_project_arguments('-DHAVE_' + sdbus.name().to_upper() + '=1', language: 
'c')
 
 subdir('protocols')
 
@@ -53,7 +66,7 @@
        dependencies: [
                wayland_client,
                wlr_protos,
-               logind,
+               sdbus,
                pipewire,
                rt,
        ],
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/xdg-desktop-portal-wlr-0.1.0/meson_options.txt 
new/xdg-desktop-portal-wlr-0.2.0/meson_options.txt
--- old/xdg-desktop-portal-wlr-0.1.0/meson_options.txt  2020-05-05 
16:18:37.000000000 +0200
+++ new/xdg-desktop-portal-wlr-0.2.0/meson_options.txt  2021-02-15 
10:22:29.000000000 +0100
@@ -1 +1,2 @@
+option('sd-bus-provider', type: 'combo', choices: ['auto', 'libsystemd', 
'libelogind', 'basu'], value: 'auto', description: 'Provider of the sd-bus 
library')
 option('systemd', type: 'feature', value: 'auto', description: 'Install 
systemd user service unit')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/xdg-desktop-portal-wlr-0.1.0/protocols/wlr-screencopy-unstable-v1.xml 
new/xdg-desktop-portal-wlr-0.2.0/protocols/wlr-screencopy-unstable-v1.xml
--- old/xdg-desktop-portal-wlr-0.1.0/protocols/wlr-screencopy-unstable-v1.xml   
2020-05-05 16:18:37.000000000 +0200
+++ new/xdg-desktop-portal-wlr-0.2.0/protocols/wlr-screencopy-unstable-v1.xml   
2021-02-15 10:22:29.000000000 +0100
@@ -38,7 +38,7 @@
                interface version number is reset.
        </description>
 
-       <interface name="zwlr_screencopy_manager_v1" version="2">
+       <interface name="zwlr_screencopy_manager_v1" version="3">
                <description summary="manager to inform clients and begin 
capturing">
                        This object is a manager which offers requests to start 
capturing from a
                        source.
@@ -80,13 +80,18 @@
                </request>
        </interface>
 
-       <interface name="zwlr_screencopy_frame_v1" version="2">
+       <interface name="zwlr_screencopy_frame_v1" version="3">
                <description summary="a frame ready for copy">
                        This object represents a single frame.
 
-                       When created, a "buffer" event will be sent. The client 
will then be able
-                       to send a "copy" request. If the capture is successful, 
the compositor
-                       will send a "flags" followed by a "ready" event.
+                       When created, a series of buffer events will be sent, 
each representing a
+                       supported buffer type. The "buffer_done" event is sent 
afterwards to
+                       indicate that all supported buffer types have been 
enumerated. The client
+                       will then be able to send a "copy" request. If the 
capture is successful,
+                       the compositor will send a "flags" followed by a 
"ready" event.
+
+                       For objects version 2 or lower, wl_shm buffers are 
always supported, ie.
+                       the "buffer" event is guaranteed to be sent.
 
                        If the capture failed, the "failed" event is sent. This 
can happen anytime
                        before the "ready" event.
@@ -96,14 +101,12 @@
                </description>
 
                <event name="buffer">
-                       <description summary="buffer information">
-                               Provides information about the frame's buffer. 
This event is sent once
-                               as soon as the frame is created.
-
-                               The client should then create a buffer with the 
provided attributes, and
-                               send a "copy" request.
+                       <description summary="wl_shm buffer information">
+                               Provides information about wl_shm buffer 
parameters that need to be
+                               used for this frame. This event is sent once 
after the frame is created
+                               if wl_shm buffers are supported.
                        </description>
-                       <arg name="format" type="uint" summary="buffer format"/>
+                       <arg name="format" type="uint" enum="wl_shm.format" 
summary="buffer format"/>
                        <arg name="width" type="uint" summary="buffer width"/>
                        <arg name="height" type="uint" summary="buffer height"/>
                        <arg name="stride" type="uint" summary="buffer stride"/>
@@ -112,8 +115,9 @@
                <request name="copy">
                        <description summary="copy the frame">
                                Copy the frame to the supplied buffer. The 
buffer must have a the
-                               correct size, see 
zwlr_screencopy_frame_v1.buffer. The buffer needs to
-                               have a supported format.
+                               correct size, see 
zwlr_screencopy_frame_v1.buffer and
+                               zwlr_screencopy_frame_v1.linux_dmabuf. The 
buffer needs to have a
+                               supported format.
 
                                If the frame is successfully copied, a "flags" 
and a "ready" events are
                                sent. Otherwise, a "failed" event is sent.
@@ -203,5 +207,26 @@
                        <arg name="width" type="uint" summary="current width"/>
                        <arg name="height" type="uint" summary="current 
height"/>
                </event>
+
+               <!-- Version 3 additions -->
+               <event name="linux_dmabuf" since="3">
+                       <description summary="linux-dmabuf buffer information">
+                               Provides information about linux-dmabuf buffer 
parameters that need to
+                               be used for this frame. This event is sent once 
after the frame is
+                               created if linux-dmabuf buffers are supported.
+                       </description>
+                       <arg name="format" type="uint" summary="fourcc pixel 
format"/>
+                       <arg name="width" type="uint" summary="buffer width"/>
+                       <arg name="height" type="uint" summary="buffer height"/>
+               </event>
+
+               <event name="buffer_done" since="3">
+                       <description summary="all buffer types reported">
+                               This event is sent once after all buffer events 
have been sent.
+
+                               The client should proceed to create a buffer of 
one of the supported
+                               types, and send a "copy" request.
+                       </description>
+               </event>
        </interface>
 </protocol>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/xdg-desktop-portal-wlr-0.1.0/src/core/main.c 
new/xdg-desktop-portal-wlr-0.2.0/src/core/main.c
--- old/xdg-desktop-portal-wlr-0.1.0/src/core/main.c    2020-05-05 
16:18:37.000000000 +0200
+++ new/xdg-desktop-portal-wlr-0.2.0/src/core/main.c    2021-02-15 
10:22:29.000000000 +0100
@@ -16,7 +16,7 @@
 
 static const char service_name[] = "org.freedesktop.impl.portal.desktop.wlr";
 
-int xdpw_usage(FILE* stream, int rc) {
+static int xdpw_usage(FILE* stream, int rc) {
        static const char* usage =
                "Usage: xdg-desktop-portal-wlr [options]\n"
                "\n"
@@ -24,21 +24,30 @@
                "                                     QUIET, ERROR, WARN, INFO, 
DEBUG, TRACE\n"
                "    -o, --output=<name>              Select output to 
capture.\n"
                "                                     metadata (performs no 
conversion).\n"
-               "    -h,--help                        Get help (this text).\n"
+               "    -r, --replace                    Replace a running 
instance.\n"
+               "    -h, --help                       Get help (this text).\n"
                "\n";
 
        fprintf(stream, "%s", usage);
        return rc;
 }
 
+static int handle_name_lost(sd_bus_message *m, void *userdata, sd_bus_error 
*ret_error) {
+       logprint(INFO, "dbus: lost name, closing connection");
+       sd_bus_close(sd_bus_message_get_bus(m));
+       return 1;
+}
+
 int main(int argc, char *argv[]) {
        const char* output_name = NULL;
        enum LOGLEVEL loglevel = ERROR;
+       bool replace = false;
 
-       static const char* shortopts = "l:o:p:h";
+       static const char* shortopts = "l:o:rh";
        static const struct option longopts[] = {
                { "loglevel", required_argument, NULL, 'l' },
                { "output", required_argument, NULL, 'o' },
+               { "replace", no_argument, NULL, 'r' },
                { "help", no_argument, NULL, 'h' },
                { NULL, 0, NULL, 0 }
        };
@@ -55,10 +64,13 @@
                case 'o':
                        output_name = optarg;
                        break;
+               case 'r':
+                       replace = true;
+                       break;
                case 'h':
-                       return xdpw_usage(stdout, 0);
+                       return xdpw_usage(stdout, EXIT_SUCCESS);
                default:
-                       return xdpw_usage(stderr, 1);
+                       return xdpw_usage(stderr, EXIT_FAILURE);
                }
        }
 
@@ -70,14 +82,15 @@
        ret = sd_bus_open_user(&bus);
        if (ret < 0) {
                logprint(ERROR, "dbus: failed to connect to user bus: %s", 
strerror(-ret));
-               goto error;
+               return EXIT_FAILURE;
        }
        logprint(DEBUG, "dbus: connected");
 
        struct wl_display *wl_display = wl_display_connect(NULL);
        if (!wl_display) {
                logprint(ERROR, "wayland: failed to connect to display");
-               goto error;
+               sd_bus_unref(bus);
+               return EXIT_FAILURE;
        }
        logprint(DEBUG, "wlroots: wl_display connected");
 
@@ -85,7 +98,9 @@
        struct pw_loop *pw_loop = pw_loop_new(NULL);
        if (!pw_loop) {
                logprint(ERROR, "pipewire: failed to create loop");
-               goto error;
+               wl_display_disconnect(wl_display);
+               sd_bus_unref(bus);
+               return EXIT_FAILURE;
        }
        logprint(DEBUG, "pipewire: pw_loop created");
 
@@ -107,12 +122,41 @@
                goto error;
        }
 
-       ret = sd_bus_request_name(bus, service_name, 0);
+       uint64_t flags = SD_BUS_NAME_ALLOW_REPLACEMENT;
+       if (replace) {
+               flags |= SD_BUS_NAME_REPLACE_EXISTING;
+       }
+
+       ret = sd_bus_request_name(bus, service_name, flags);
        if (ret < 0) {
                logprint(ERROR, "dbus: failed to acquire service name: %s", 
strerror(-ret));
                goto error;
        }
 
+       const char *unique_name;
+       ret = sd_bus_get_unique_name(bus, &unique_name);
+       if (ret < 0) {
+               logprint(ERROR, "dbus: failed to get unique bus name: %s", 
strerror(-ret));
+               goto error;
+       }
+
+       static char match[1024];
+       snprintf(match, sizeof(match), "sender='org.freedesktop.DBus',"
+               "type='signal',"
+               "interface='org.freedesktop.DBus',"
+               "member='NameOwnerChanged',"
+               "path='/org/freedesktop/DBus',"
+               "arg0='%s',"
+               "arg1='%s'",
+               service_name, unique_name);
+
+       sd_bus_slot *slot;
+       ret = sd_bus_add_match(bus, &slot, match, handle_name_lost, NULL);
+       if (ret < 0) {
+               logprint(ERROR, "dbus: failed to add NameOwnerChanged signal 
match: %s", strerror(-ret));
+               goto error;
+       }
+
        struct pollfd pollfds[] = {
                [EVENT_LOOP_DBUS] = {
                        .fd = sd_bus_get_fd(state.bus),
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/xdg-desktop-portal-wlr-0.1.0/src/screencast/pipewire_screencast.c 
new/xdg-desktop-portal-wlr-0.2.0/src/screencast/pipewire_screencast.c
--- old/xdg-desktop-portal-wlr-0.1.0/src/screencast/pipewire_screencast.c       
2020-05-05 16:18:37.000000000 +0200
+++ new/xdg-desktop-portal-wlr-0.2.0/src/screencast/pipewire_screencast.c       
2021-02-15 10:22:29.000000000 +0100
@@ -38,14 +38,14 @@
 
        if ((pw_buf = pw_stream_dequeue_buffer(cast->stream)) == NULL) {
                logprint(WARN, "pipewire: out of buffers");
-               return;
+               goto out;
        }
 
        spa_buf = pw_buf->buffer;
        d = spa_buf->datas;
        if ((d[0].data) == NULL) {
                logprint(TRACE, "pipewire: data pointer undefined");
-               return;
+               goto out;
        }
        if ((h = spa_buffer_find_meta_data(spa_buf, SPA_META_Header, 
sizeof(*h)))) {
                h->pts = -1;
@@ -76,6 +76,7 @@
 
        pw_stream_queue_buffer(cast->stream, pw_buf);
 
+out:
        xdpw_wlr_frame_free(cast);
 }
 
@@ -115,11 +116,11 @@
 
        params[0] = spa_pod_builder_add_object(&b,
                SPA_TYPE_OBJECT_ParamBuffers, SPA_PARAM_Buffers,
-               SPA_PARAM_BUFFERS_buffers, SPA_POD_CHOICE_RANGE_Int(BUFFERS, 1, 
32),
+               SPA_PARAM_BUFFERS_buffers, 
SPA_POD_CHOICE_RANGE_Int(XDPW_PWR_BUFFERS, 1, 32),
                SPA_PARAM_BUFFERS_blocks,  SPA_POD_Int(1),
                SPA_PARAM_BUFFERS_size,    SPA_POD_Int(cast->simple_frame.size),
                SPA_PARAM_BUFFERS_stride,  
SPA_POD_Int(cast->simple_frame.stride),
-               SPA_PARAM_BUFFERS_align,   SPA_POD_Int(ALIGN));
+               SPA_PARAM_BUFFERS_align,   SPA_POD_Int(XDPW_PWR_ALIGN));
 
        params[1] = spa_pod_builder_add_object(&b,
                SPA_TYPE_OBJECT_ParamMeta, SPA_PARAM_Meta,
@@ -196,7 +197,6 @@
                (PW_STREAM_FLAG_DRIVER |
                        PW_STREAM_FLAG_MAP_BUFFERS),
                &param, 1);
-
 }
 
 int xdpw_pwr_core_connect(struct xdpw_state *state) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/xdg-desktop-portal-wlr-0.1.0/src/screencast/screencast.c 
new/xdg-desktop-portal-wlr-0.2.0/src/screencast/screencast.c
--- old/xdg-desktop-portal-wlr-0.1.0/src/screencast/screencast.c        
2020-05-05 16:18:37.000000000 +0200
+++ new/xdg-desktop-portal-wlr-0.2.0/src/screencast/screencast.c        
2021-02-15 10:22:29.000000000 +0100
@@ -245,10 +245,10 @@
                } else if (strcmp(key, "cursor_mode") == 0) {
                        uint32_t cursor_mode;
                        sd_bus_message_read(msg, "v", "u", &cursor_mode);
-                       if (cursor_mode & (1<<HIDDEN)) {
+                       if (cursor_mode & HIDDEN) {
                                cursor_embedded = false;
                        }
-                       if (cursor_mode & (1<<METADATA)) {
+                       if (cursor_mode & METADATA) {
                                logprint(ERROR, "dbus: unsupported cursor mode 
requested, cancelling");
                                goto error;
                        }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/xdg-desktop-portal-wlr-0.1.0/src/screencast/wlr_screencast.c 
new/xdg-desktop-portal-wlr-0.2.0/src/screencast/wlr_screencast.c
--- old/xdg-desktop-portal-wlr-0.1.0/src/screencast/wlr_screencast.c    
2020-05-05 16:18:37.000000000 +0200
+++ new/xdg-desktop-portal-wlr-0.2.0/src/screencast/wlr_screencast.c    
2021-02-15 10:22:29.000000000 +0100
@@ -19,14 +19,28 @@
 #include "xdpw.h"
 #include "logger.h"
 
+static void wlr_frame_buffer_destroy(struct xdpw_screencast_instance *cast) {
+       // Even though this check may be deemed unnecessary,
+       // this has been found to cause SEGFAULTs, like this one:
+       // https://github.com/emersion/xdg-desktop-portal-wlr/issues/50
+       if (cast->simple_frame.data != NULL) {
+               munmap(cast->simple_frame.data, cast->simple_frame.size);
+               cast->simple_frame.data = NULL;
+       }
+
+       if (cast->simple_frame.buffer != NULL) {
+               wl_buffer_destroy(cast->simple_frame.buffer);
+               cast->simple_frame.buffer = NULL;
+       }
+}
+
 void xdpw_wlr_frame_free(struct xdpw_screencast_instance *cast) {
        zwlr_screencopy_frame_v1_destroy(cast->wlr_frame);
        cast->wlr_frame = NULL;
-       munmap(cast->simple_frame.data, cast->simple_frame.size);
-       cast->simple_frame.data = NULL;
-       // TODO: reuse this buffer unless we quit or error out
-       wl_buffer_destroy(cast->simple_frame.buffer);
-       cast->simple_frame.buffer = NULL;
+       if (cast->quit || cast->err) {
+               wlr_frame_buffer_destroy(cast);
+               logprint(TRACE, "xdpw: simple_frame buffer destroyed");
+       }
        logprint(TRACE, "wlroots: frame destroyed");
 
        if (cast->quit || cast->err) {
@@ -97,27 +111,62 @@
        return buffer;
 }
 
-static void wlr_frame_buffer(void *data, struct zwlr_screencopy_frame_v1 
*frame,
+static void wlr_frame_buffer_chparam(struct xdpw_screencast_instance *cast,
                uint32_t format, uint32_t width, uint32_t height, uint32_t 
stride) {
-       struct xdpw_screencast_instance *cast = data;
-
-       logprint(TRACE, "wlroots: buffer event handler");
-       cast->wlr_frame = frame;
+       logprint(DEBUG, "wlroots: reset buffer");
        cast->simple_frame.width = width;
        cast->simple_frame.height = height;
        cast->simple_frame.stride = stride;
        cast->simple_frame.size = stride * height;
        cast->simple_frame.format = format;
-       cast->simple_frame.buffer = create_shm_buffer(cast, format, width, 
height,
-               stride, &cast->simple_frame.data);
+       wlr_frame_buffer_destroy(cast);
+}
+
+static void wlr_frame_linux_dmabuf(void *data,
+               struct zwlr_screencopy_frame_v1 *frame,
+               uint32_t format, uint32_t width, uint32_t height) {
+       logprint(TRACE, "wlroots: linux_dmabuf event handler");
+}
+
+static void wlr_frame_buffer_done(void *data,
+               struct zwlr_screencopy_frame_v1 *frame) {
+       struct xdpw_screencast_instance *cast = data;
+
+       logprint(TRACE, "wlroots: buffer_done event handler");
+       zwlr_screencopy_frame_v1_copy_with_damage(frame, 
cast->simple_frame.buffer);
+       logprint(TRACE, "wlroots: frame copied");
+}
+
+static void wlr_frame_buffer(void *data, struct zwlr_screencopy_frame_v1 
*frame,
+               uint32_t format, uint32_t width, uint32_t height, uint32_t 
stride) {
+       struct xdpw_screencast_instance *cast = data;
+
+       logprint(TRACE, "wlroots: buffer event handler");
+       cast->wlr_frame = frame;
+       if (cast->simple_frame.width != width ||
+                       cast->simple_frame.height != height ||
+                       cast->simple_frame.stride != stride ||
+                       cast->simple_frame.format != format) {
+               logprint(TRACE, "wlroots: buffer properties changed");
+               wlr_frame_buffer_chparam(cast, format, width, height, stride);
+       }
+
+       if (cast->simple_frame.buffer == NULL) {
+               logprint(DEBUG, "wlroots: create shm buffer");
+               cast->simple_frame.buffer = create_shm_buffer(cast, format, 
width, height,
+                       stride, &cast->simple_frame.data);
+       } else {
+               logprint(TRACE,"wlroots: shm buffer exists");
+       }
 
        if (cast->simple_frame.buffer == NULL) {
                logprint(ERROR, "wlroots: failed to create buffer");
                abort();
        }
 
-       zwlr_screencopy_frame_v1_copy_with_damage(frame, 
cast->simple_frame.buffer);
-       logprint(TRACE, "wlroots: frame copied");
+       if 
(zwlr_screencopy_manager_v1_get_version(cast->ctx->screencopy_manager) < 3) {
+               wlr_frame_buffer_done(cast,frame);
+       }
 }
 
 static void wlr_frame_flags(void *data, struct zwlr_screencopy_frame_v1 *frame,
@@ -139,7 +188,7 @@
 
        if (!cast->quit && !cast->err && cast->pwr_stream_state) {
                pw_loop_signal_event(cast->ctx->state->pw_loop, cast->event);
-               return ;
+               return;
        }
 
        xdpw_wlr_frame_free(cast);
@@ -169,6 +218,8 @@
 
 static const struct zwlr_screencopy_frame_v1_listener wlr_frame_listener = {
        .buffer = wlr_frame_buffer,
+       .buffer_done = wlr_frame_buffer_done,
+       .linux_dmabuf = wlr_frame_linux_dmabuf,
        .flags = wlr_frame_flags,
        .ready = wlr_frame_ready,
        .failed = wlr_frame_failed,
@@ -176,7 +227,6 @@
 };
 
 void xdpw_wlr_register_cb(struct xdpw_screencast_instance *cast) {
-
        cast->frame_callback = zwlr_screencopy_manager_v1_capture_output(
                cast->ctx->screencopy_manager, cast->with_cursor, 
cast->target_output->output);
 
@@ -291,28 +341,39 @@
                uint32_t id, const char *interface, uint32_t ver) {
        struct xdpw_screencast_context *ctx = data;
 
+       logprint(DEBUG, "wlroots: interface to register %s  (Version: 
%u)",interface, ver);
        if (!strcmp(interface, wl_output_interface.name)) {
                struct xdpw_wlr_output *output = malloc(sizeof(*output));
 
                output->id = id;
-               output->output = wl_registry_bind(reg, id, 
&wl_output_interface, 1);
+               logprint(DEBUG, "wlroots: |-- registered to interface %s 
(Version %u)", interface, WL_OUTPUT_VERSION);
+               output->output = wl_registry_bind(reg, id, 
&wl_output_interface, WL_OUTPUT_VERSION);
 
                wl_output_add_listener(output->output, &wlr_output_listener, 
output);
                wl_list_insert(&ctx->output_list, &output->link);
        }
 
        if (!strcmp(interface, zwlr_screencopy_manager_v1_interface.name)) {
+               uint32_t version = ver;
+               if (SC_MANAGER_VERSION < ver) {
+                       version = SC_MANAGER_VERSION;
+               } else if (ver < SC_MANAGER_VERSION_MIN) {
+                       version = SC_MANAGER_VERSION_MIN;
+               }
+               logprint(DEBUG, "wlroots: |-- registered to interface %s 
(Version %u)", interface, version);
                ctx->screencopy_manager = wl_registry_bind(
-                       reg, id, &zwlr_screencopy_manager_v1_interface, 
SC_MANAGER_VERSION);
+                       reg, id, &zwlr_screencopy_manager_v1_interface, 
version);
        }
 
        if (strcmp(interface, wl_shm_interface.name) == 0) {
-               ctx->shm = wl_registry_bind(reg, id, &wl_shm_interface, 1);
+               logprint(DEBUG, "wlroots: |-- registered to interface %s 
(Version %u)", interface, WL_SHM_VERSION);
+               ctx->shm = wl_registry_bind(reg, id, &wl_shm_interface, 
WL_SHM_VERSION);
        }
 
        if (strcmp(interface, zxdg_output_manager_v1_interface.name) == 0) {
+               logprint(DEBUG, "wlroots: |-- registered to interface %s 
(Version %u)", interface, XDG_OUTPUT_MANAGER_VERSION);
                ctx->xdg_output_manager =
-                       wl_registry_bind(reg, id, 
&zxdg_output_manager_v1_interface, 3);
+                       wl_registry_bind(reg, id, 
&zxdg_output_manager_v1_interface, XDG_OUTPUT_MANAGER_VERSION);
        }
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/xdg-desktop-portal-wlr-0.1.0/wlr.portal 
new/xdg-desktop-portal-wlr-0.2.0/wlr.portal
--- old/xdg-desktop-portal-wlr-0.1.0/wlr.portal 2020-05-05 16:18:37.000000000 
+0200
+++ new/xdg-desktop-portal-wlr-0.2.0/wlr.portal 2021-02-15 10:22:29.000000000 
+0100
@@ -1,4 +1,4 @@
 [portal]
 DBusName=org.freedesktop.impl.portal.desktop.wlr
 
Interfaces=org.freedesktop.impl.portal.Screenshot;org.freedesktop.impl.portal.ScreenCast;
-UseIn=sway
+UseIn=sway;Wayfire;river

Reply via email to