Hello community, here is the log from the commit of package xiccd for openSUSE:Factory checked in at 2020-08-17 12:02:44 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/xiccd (Old) and /work/SRC/openSUSE:Factory/.xiccd.new.3399 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "xiccd" Mon Aug 17 12:02:44 2020 rev:5 rq:826933 version:0.3.0 Changes: -------- --- /work/SRC/openSUSE:Factory/xiccd/xiccd.changes 2017-05-16 14:44:21.865796024 +0200 +++ /work/SRC/openSUSE:Factory/.xiccd.new.3399/xiccd.changes 2020-08-17 12:03:29.706631226 +0200 @@ -1,0 +2,9 @@ +Sun Aug 16 01:53:01 UTC 2020 - Dirk Mueller <[email protected]> + +- update to 0.3.0: + * Correct X property setting for multiple screens + * Race fixes + * Memory leak fixes + * Add desktop files + +------------------------------------------------------------------- Old: ---- xiccd-0.2.4.tar.gz New: ---- xiccd-0.3.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ xiccd.spec ++++++ --- /var/tmp/diff_new_pack.VTQK4O/_old 2020-08-17 12:03:31.350632142 +0200 +++ /var/tmp/diff_new_pack.VTQK4O/_new 2020-08-17 12:03:31.354632144 +0200 @@ -1,7 +1,7 @@ # # spec file for package xiccd # -# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -12,17 +12,17 @@ # 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: xiccd -Version: 0.2.4 +Version: 0.3.0 Release: 0 Summary: X11 ICC Daemon -License: GPL-3.0+ +License: GPL-3.0-or-later Group: System/X11/Utilities -Url: https://github.com/agalakhov/xiccd +URL: https://github.com/agalakhov/xiccd Source: https://github.com/agalakhov/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz BuildRequires: autoconf BuildRequires: automake @@ -49,39 +49,18 @@ %prep %setup -q -# XDG autostart. -cat > %{name}.desktop << EOF -[Desktop Entry] -Version=1.0 -Type=Application -Name=X11 ICC Daemon -GenericName=X color management daemon -GenericName[en_GB]=X colour management daemon -Comment=Applies color management profiles to your session -Comment[en_GB]=Applies colour management profiles to your session -Categories=Utility; -Exec=%{name} -Icon=preferences-system -StartupNotify=false -Terminal=false -NoDisplay=true -EOF %build autoreconf -fi %configure -make %{?_smp_mflags} V=1 +%make_build %install %make_install -rm %{buildroot}%{_datadir}/applications/%{name}.desktop -install -Dpm 0644 %{name}.desktop \ - %{buildroot}%{_sysconfdir}/xdg/autostart/%{name}.desktop - %files -%defattr(-,root,root) -%doc AUTHORS ChangeLog COPYING NEWS README +%license COPYING +%doc ChangeLog README %{_sysconfdir}/xdg/autostart/ %{_bindir}/%{name} %{_mandir}/man8/%{name}.8%{?ext_man} ++++++ xiccd-0.2.4.tar.gz -> xiccd-0.3.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xiccd-0.2.4/ChangeLog new/xiccd-0.3.0/ChangeLog --- old/xiccd-0.2.4/ChangeLog 2017-02-22 14:47:48.000000000 +0100 +++ new/xiccd-0.3.0/ChangeLog 2019-06-10 01:22:18.000000000 +0200 @@ -1,3 +1,10 @@ +xiccd 0.3.0 + + * Correct X property setting for multiple screens + * Race fixes + * Memory leak fixes + * Add desktop files + xiccd 0.2.3 * Removed obsolete DMI support diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xiccd-0.2.4/Makefile.am new/xiccd-0.3.0/Makefile.am --- old/xiccd-0.2.4/Makefile.am 2017-02-22 14:47:48.000000000 +0100 +++ new/xiccd-0.3.0/Makefile.am 2019-06-10 01:22:18.000000000 +0200 @@ -2,5 +2,5 @@ dist_man_MANS = xiccd.8 -desktopdir = $(datadir)/applications -desktop_DATA = xiccd.desktop +autostartdir = $(sysconfdir)/xdg/autostart +autostart_DATA = xiccd.desktop diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xiccd-0.2.4/configure.ac new/xiccd-0.3.0/configure.ac --- old/xiccd-0.2.4/configure.ac 2017-02-22 14:47:48.000000000 +0100 +++ new/xiccd-0.3.0/configure.ac 2019-06-10 01:22:18.000000000 +0200 @@ -1,5 +1,5 @@ AC_PREREQ([2.69]) -AC_INIT([xiccd], [0.2.4]) +AC_INIT([xiccd], [0.3.0+git]) AC_CONFIG_SRCDIR([src/xiccd.c]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xiccd-0.2.4/src/randr-conn-private.c new/xiccd-0.3.0/src/randr-conn-private.c --- old/xiccd-0.2.4/src/randr-conn-private.c 2017-02-22 14:47:48.000000000 +0100 +++ new/xiccd-0.3.0/src/randr-conn-private.c 2019-06-10 01:22:18.000000000 +0200 @@ -246,6 +246,8 @@ { guint i, j; GPtrArray *disps; + GPtrArray *added_disps = g_ptr_array_new_full (4, NULL); + GPtrArray *updated_disps = g_ptr_array_new_full (4, NULL); if (! conn->dpy) return; @@ -253,21 +255,21 @@ disps = enum_displays (conn); for (i = 0; i < disps->len; ++i) { gboolean found = FALSE; - const struct randr_display *disp = (const struct randr_display *) - g_ptr_array_index (disps, i); + struct randr_display *disp = (struct randr_display *) + g_ptr_array_index (disps, i); for (j = 0; j < conn->displays->len; ++j) { - const struct randr_display *odisp = (const struct randr_display *) - g_ptr_array_index (conn->displays, j); + struct randr_display *odisp = (struct randr_display *) + g_ptr_array_index (conn->displays, j); if (same_display (odisp, disp)) { g_ptr_array_remove_index_fast (conn->displays, j); + g_ptr_array_add (updated_disps, disp); found = TRUE; break; } } if (found) continue; - g_signal_emit (conn->object, - randr_signals[SIG_DISPLAY_ADDED], 0, disp); + g_ptr_array_add (added_disps, disp); } for (j = 0; j < conn->displays->len; ++j) { @@ -279,19 +281,42 @@ g_ptr_array_unref (conn->displays); conn->displays = disps; + + /* emitting added and changed signals after conn->displays is set */ + for (j = 0; j < added_disps->len; ++j) { + const struct randr_display *disp = (const struct randr_display *) + g_ptr_array_index (added_disps, j); + g_signal_emit (conn->object, + randr_signals[SIG_DISPLAY_ADDED], 0, disp); + } + + for (j = 0; j < updated_disps->len; ++j) { + const struct randr_display *disp = (const struct randr_display *) + g_ptr_array_index (updated_disps, j); + g_signal_emit (conn->object, + randr_signals[SIG_DISPLAY_CHANGED], 0, disp); + } + + g_ptr_array_unref (added_disps); + g_ptr_array_unref (updated_disps); } +static gboolean +randr_source_prepare (GSource *source, gint *timeout) +{ + (void) timeout; + struct randr_source *src = (struct randr_source *) source; + return (XPending (src->conn->dpy) > 0); +} static gboolean -poll_events (gint fd, GIOCondition condition, gpointer user_data) +randr_source_dispatch (GSource *source, GSourceFunc callback, gpointer user_data) { - struct randr_conn *conn = (struct randr_conn *) user_data; + struct randr_conn *conn = ((struct randr_source *) source)->conn; gboolean happened = FALSE; - (void) fd; - - if (condition != G_IO_IN) - return TRUE; + (void) callback; + (void) user_data; while (XPending (conn->dpy)) { XEvent ev; @@ -321,19 +346,55 @@ return TRUE; } +static GSourceFuncs randr_source_funcs = { + randr_source_prepare, + NULL, /* check */ + randr_source_dispatch, + NULL, /* finalize */ + NULL, /* closure_callback */ + NULL /* closure_marshal */ +}; + +static GSource * +randr_source_new (struct randr_conn *conn) +{ + GSource *retval; + struct randr_source *src; + + retval = g_source_new (&randr_source_funcs, sizeof (struct randr_source)); + g_source_set_name (retval, "RandrSource"); + + src = (struct randr_source *) retval; + src->conn = conn; + + src->poll_fd.fd = ConnectionNumber (conn->dpy); + src->poll_fd.events = G_IO_IN; + g_source_add_poll (retval, &src->poll_fd); + + return retval; +} + static inline void setup_events (struct randr_conn *conn) { int s; for (s = 0; s < ScreenCount (conn->dpy); ++s) { Window w = RootWindow (conn->dpy, s); - XRRSelectInput (conn->dpy, w, RROutputChangeNotifyMask); - } - while (XPending (conn->dpy)) { - XEvent ev; - XNextEvent (conn->dpy, &ev); - } - g_unix_fd_add (ConnectionNumber (conn->dpy), G_IO_IN, poll_events, conn); + XRRSelectInput (conn->dpy, w, + RRScreenChangeNotifyMask | + RRCrtcChangeNotifyMask | + RROutputChangeNotifyMask); + } + GSource *src = randr_source_new (conn); + g_source_attach (src, NULL); + g_source_unref (src); +} + +void +randr_conn_private_start (struct randr_conn *conn) +{ + randr_conn_private_update (conn); + setup_events (conn); } void @@ -368,8 +429,6 @@ conn->edid_atom = XInternAtom (conn->dpy, "EDID", False); conn->type_atom = XInternAtom (conn->dpy, "ConnectorType", False); - setup_events (conn); - return; out: @@ -420,6 +479,38 @@ XRRFreeGamma (gamma); } +static gboolean +is_main_icc_profile (struct randr_display_priv *disp) +{ + int main_id = -1; + int laptop_id = -1; + int primary_id = -1; + guint i; + + if (disp->pub.is_primary) + return TRUE; + + for (i = 0; i < disp->conn->displays->len; ++i) { + struct randr_display_priv *odisp = g_ptr_array_index (disp->conn->displays, i); + if (! odisp->crtc) + continue; + if (main_id == -1) + main_id = odisp->pub.id; + if (odisp->pub.is_laptop) + laptop_id = odisp->pub.id; + if (odisp->pub.is_primary) + primary_id = odisp->pub.id; + } + + if (primary_id >= 0) { + main_id = primary_id; + } else if (laptop_id >= 0) { + main_id = laptop_id; + } + + return (disp->pub.id == main_id); +} + static inline void apply_icc (struct randr_display_priv *disp, GBytes *icc_bytes) { @@ -427,15 +518,14 @@ Display *dpy = disp->conn->dpy; const gchar *oper = NULL; Atom at; - if (disp->pub.id == 0) { - at = XInternAtom (dpy, "_ICC_PROFILE", False); - } else { - gchar *atname = g_strdup_printf ("_ICC_PROFILE_%i", disp->pub.id); - at = XInternAtom (dpy, atname, False); - g_free (atname); - } + + if (! is_main_icc_profile (disp)) + return; + + at = XInternAtom (dpy, "_ICC_PROFILE", False); if (icc_bytes) { + g_debug ("setting _ICC_PROFILE for display %s", disp->pub.name); res = XChangeProperty (dpy, disp->root, at, XA_CARDINAL, 8, PropModeReplace, (unsigned char *) g_bytes_get_data (icc_bytes, NULL), g_bytes_get_size (icc_bytes)); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xiccd-0.2.4/src/randr-conn-private.h new/xiccd-0.3.0/src/randr-conn-private.h --- old/xiccd-0.2.4/src/randr-conn-private.h 2017-02-22 14:47:48.000000000 +0100 +++ new/xiccd-0.3.0/src/randr-conn-private.h 2019-06-10 01:22:18.000000000 +0200 @@ -50,9 +50,16 @@ RRCrtc crtc; }; +struct randr_source { + GSource parent; + struct randr_conn *conn; + GPollFD poll_fd; +}; + enum { SIG_DISPLAY_ADDED, SIG_DISPLAY_REMOVED, + SIG_DISPLAY_CHANGED, N_SIG }; @@ -60,6 +67,7 @@ void randr_conn_private_init (struct randr_conn *conn, const gchar *disp_name); void randr_conn_private_finalize (struct randr_conn *conn); +void randr_conn_private_start (struct randr_conn *conn); void randr_conn_private_update (struct randr_conn *conn); struct randr_display *randr_conn_private_find_display (struct randr_conn *conn, const gchar *key, guint offset); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xiccd-0.2.4/src/randr-conn.c new/xiccd-0.3.0/src/randr-conn.c --- old/xiccd-0.2.4/src/randr-conn.c 2017-02-22 14:47:48.000000000 +0100 +++ new/xiccd-0.3.0/src/randr-conn.c 2019-06-10 01:22:18.000000000 +0200 @@ -106,6 +106,12 @@ NULL, NULL, NULL, G_TYPE_NONE, 1, G_TYPE_POINTER); + randr_signals[SIG_DISPLAY_CHANGED] = g_signal_new ("display_changed", + G_TYPE_FROM_CLASS (obj_class), G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (RandrConnClass, display_changed), + NULL, NULL, NULL, + G_TYPE_NONE, 1, G_TYPE_POINTER); + g_object_class_install_property (obj_class, PROP_DISPLAY, g_param_spec_string ("display", NULL, "X Display", NULL, G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY) @@ -121,9 +127,9 @@ } void -randr_conn_update (RandrConn *conn) +randr_conn_start (RandrConn *conn) { - randr_conn_private_update (conn->priv); + randr_conn_private_start (conn->priv); } struct randr_display * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xiccd-0.2.4/src/randr-conn.h new/xiccd-0.3.0/src/randr-conn.h --- old/xiccd-0.2.4/src/randr-conn.h 2017-02-22 14:47:48.000000000 +0100 +++ new/xiccd-0.3.0/src/randr-conn.h 2019-06-10 01:22:18.000000000 +0200 @@ -65,6 +65,7 @@ GObjectClass parent; void (*display_added) (RandrConn *conn, const struct randr_display *disp); void (*display_removed) (RandrConn *conn, const struct randr_display *disp); + void (*display_changed) (RandrConn *conn, const struct randr_display *disp); } RandrConnClass; @@ -73,7 +74,7 @@ RandrConn *randr_conn_new (const gchar *display); -void randr_conn_update (RandrConn *conn); +void randr_conn_start (RandrConn *conn); struct randr_display *randr_conn_find_display (RandrConn *conn, const gchar *name); struct randr_display *randr_conn_find_display_edid (RandrConn *conn, const gchar *edid_cksum); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xiccd-0.2.4/src/xiccd.c new/xiccd-0.3.0/src/xiccd.c --- old/xiccd-0.2.4/src/xiccd.c 2017-02-22 14:47:48.000000000 +0100 +++ new/xiccd-0.3.0/src/xiccd.c 2019-06-10 01:22:18.000000000 +0200 @@ -122,7 +122,7 @@ g_critical ("unable to connect to profile: %s", err->message); g_error_free (err); } else { - CdIcc *icc = cd_profile_load_icc (profile, CD_ICC_LOAD_FLAGS_FALLBACK_MD5, + CdIcc *icc = cd_profile_load_icc (profile, CD_ICC_LOAD_FLAGS_ALL, NULL, &err); if (! icc) { g_critical ("can't get profile for display %s: %s", disp->name, @@ -132,6 +132,8 @@ g_debug ("loading profile '%s' for display %s", icc ? cd_icc_get_filename (icc) : "(none)", disp->name); randr_display_apply_icc (disp, icc); + if (icc) + g_object_unref (icc); } } else { g_debug ("unloading profile for display %s", disp->name); @@ -214,7 +216,6 @@ if (device) g_object_unref (device); - g_object_unref (profile); } @@ -403,6 +404,29 @@ g_object_unref (device); } +static void +randr_display_changed_sig (RandrConn *conn, struct randr_display *disp, Daemon *daemon) +{ + CdDevice *device = NULL; + GError *err = NULL; + + g_assert (conn == daemon->rcon); + g_assert (daemon->cli != NULL); + g_debug ("changed display: '%s'", disp->name); + + /* We do not want race conditions here */ + device = cd_client_find_device_sync (daemon->cli, disp->name, + NULL, &err); + if (! device) { + g_debug ("device %s not found so not changed: %s", disp->name, err->message); + g_error_free (err); + return; + } + + update_device (device, daemon); + + g_object_unref (device); +} static void cd_existing_devices_cb (GObject *src, GAsyncResult *res, gpointer user_data) @@ -556,6 +580,9 @@ g_signal_connect (daemon->rcon, "display-removed", G_CALLBACK (randr_display_removed_sig), daemon); + g_signal_connect (daemon->rcon, "display-changed", + G_CALLBACK (randr_display_changed_sig), daemon); + g_signal_connect (daemon->stor, "added", G_CALLBACK (cd_icc_store_file_added_sig), daemon); @@ -582,7 +609,7 @@ cd_existing_profiles_cb, daemon); - randr_conn_update (daemon->rcon); + randr_conn_start (daemon->rcon); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xiccd-0.2.4/xiccd.desktop new/xiccd-0.3.0/xiccd.desktop --- old/xiccd-0.2.4/xiccd.desktop 2017-02-22 14:47:48.000000000 +0100 +++ new/xiccd-0.3.0/xiccd.desktop 2019-06-10 01:22:18.000000000 +0200 @@ -1,10 +1,8 @@ [Desktop Entry] -Encoding=UTF-8 Name=xiccd GenericName=X color management daemon Comment=Applies color management profiles to your session Exec=xiccd Terminal=false Type=Application -Categories= -OnlyShowIn=XFCE;MATE;LXDE; +NotShowIn=GNOME;KDE;
