commit notify-osd for openSUSE:Factory
Hello community, here is the log from the commit of package notify-osd for openSUSE:Factory checked in at 2015-11-26 17:04:04 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/notify-osd (Old) and /work/SRC/openSUSE:Factory/.notify-osd.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "notify-osd" Changes: -------- --- /work/SRC/openSUSE:Factory/notify-osd/notify-osd.changes 2015-11-02 12:55:29.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.notify-osd.new/notify-osd.changes 2015-11-26 17:04:06.000000000 +0100 @@ -1,0 +2,9 @@ +Mon Nov 23 20:34:07 UTC 2015 - sor.alexei@meowr.ru + +- Update to 0.9.35~bzr20151118 (changes since 0.9.35~bzr20151014): + * Listen to xsettings dpi changes (lp#1303796). + * Refactor bubble_set_icon(). + * Ignore body for synchronous notifications. +- Update and rebase notify-osd-leolik.patch. + +------------------------------------------------------------------- Old: ---- notify-osd_0.9.35+15.10.20151014.orig.tar.gz New: ---- notify-osd_0.9.35+16.04.20151118.orig.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ notify-osd.spec ++++++ --- /var/tmp/diff_new_pack.YAuXB4/_old 2015-11-26 17:04:07.000000000 +0100 +++ /var/tmp/diff_new_pack.YAuXB4/_new 2015-11-26 17:04:07.000000000 +0100 @@ -16,9 +16,9 @@ # -%define _version 0.9.35+15.10.20151014 +%define _version 0.9.35+16.04.20151118 Name: notify-osd -Version: 0.9.35~bzr20151014 +Version: 0.9.35~bzr20151118 Release: 0 Summary: Streamlined Notification Daemon License: GPL-3.0+ ++++++ notify-osd-leolik.patch ++++++ --- /var/tmp/diff_new_pack.YAuXB4/_old 2015-11-26 17:04:07.000000000 +0100 +++ /var/tmp/diff_new_pack.YAuXB4/_new 2015-11-26 17:04:07.000000000 +0100 @@ -1,7 +1,7 @@ diff -ruN src_old/bubble.c src/bubble.c --- src_old/bubble.c +++ src/bubble.c -@@ -133,25 +133,25 @@ +@@ -127,25 +127,25 @@ // FIXME: this is in class Defaults already, but not yet hooked up so for the // moment we use the macros here, these values reflect the visual-guideline // for jaunty notifications @@ -41,7 +41,7 @@ #define INDICATOR_UNLIT_R 1.0f #define INDICATOR_UNLIT_G 1.0f -@@ -172,6 +172,10 @@ +@@ -166,6 +166,10 @@ #define BUBBLE_CONTENT_BLUR_RADIUS 4 #define TEXT_DROP_SHADOW_SIZE 2 @@ -52,16 +52,21 @@ //-- private functions --------------------------------------------------------- static guint g_bubble_signals[LAST_SIGNAL] = { 0 }; -@@ -758,17 +762,32 @@ +@@ -752,17 +756,32 @@ 2.0f * EM2PIXELS (get_shadow_size (self), d)); cairo_fill (cr); cairo_set_operator (cr, CAIRO_OPERATOR_OVER); +- cairo_set_source_rgba (cr, +- color.red, +- color.green, +- color.blue, +- BUBBLE_BG_COLOR_A); + if (BUBBLE_AS_DESKTOP_BG) { - cairo_set_source_rgba (cr, - color.red, - color.green, - color.blue, - BUBBLE_BG_COLOR_A); ++ cairo_set_source_rgba (cr, ++ color.red, ++ color.green, ++ color.blue, ++ BUBBLE_BG_COLOR_A); + } else { + cairo_set_source_rgba (cr, + BUBBLE_BG_COLOR_R, @@ -71,11 +76,15 @@ + } } else +- cairo_set_source_rgb (cr, +- color.red, +- color.green, +- color.blue); + if (BUBBLE_AS_DESKTOP_BG) { - cairo_set_source_rgb (cr, - color.red, - color.green, - color.blue); ++ cairo_set_source_rgb (cr, ++ color.red, ++ color.green, ++ color.blue); + } else { + cairo_set_source_rgb (cr, + BUBBLE_BG_COLOR_R, @@ -85,29 +94,38 @@ draw_round_rect ( cr, -@@ -1667,6 +1686,8 @@ +@@ -1660,15 +1679,23 @@ + // sanity check if (!window) return; - +- +- // set an 1x1 input-region to allow click-through +- region = cairo_region_create_rectangle (&rect); +- if (cairo_region_status (region) == CAIRO_STATUS_SUCCESS) ++ + if (!BUBBLE_CLOSE_ON_CLICK) + { - // set an 1x1 input-region to allow click-through - region = cairo_region_create_rectangle (&rect); - if (cairo_region_status (region) == CAIRO_STATUS_SUCCESS) -@@ -1675,6 +1696,12 @@ - gtk_widget_input_shape_combine_region (window, region); - } - cairo_region_destroy (region); ++ // set an 1x1 input-region to allow click-through ++ region = cairo_region_create_rectangle (&rect); ++ if (cairo_region_status (region) == CAIRO_STATUS_SUCCESS) ++ { ++ gtk_widget_input_shape_combine_region (window, NULL); ++ gtk_widget_input_shape_combine_region (window, region); ++ } ++ cairo_region_destroy (region); + } + else -+ { + { +- gtk_widget_input_shape_combine_region (window, NULL); +- gtk_widget_input_shape_combine_region (window, region); + GdkWindow *window_ = gtk_widget_get_window (window); + gdk_window_set_events (window_, gdk_window_get_events (window_) | GDK_BUTTON_PRESS); -+ } + } +- cairo_region_destroy (region); } static void -@@ -1761,7 +1788,7 @@ +@@ -1755,7 +1782,7 @@ cairo_paint (cr); cairo_set_operator (cr, CAIRO_OPERATOR_OVER); @@ -116,7 +134,7 @@ { // render drop-shadow and bubble-background _render_background (bubble, cr, 1.0f, 0.0f); -@@ -1792,6 +1819,30 @@ +@@ -1786,6 +1813,31 @@ } static gboolean @@ -124,8 +142,9 @@ + GdkEventButton* event, + Bubble* bubble) +{ -+ BubblePrivate* priv; -+ priv = bubble->priv; ++ BubblePrivate* priv; ++ ++ priv = bubble->priv; + + if (priv->mouse_over && event->button == 1) + { @@ -147,7 +166,7 @@ redraw_handler (Bubble* bubble) { GtkWindow* window; -@@ -1815,7 +1866,7 @@ +@@ -1809,7 +1861,7 @@ if (priv->alpha == NULL) { @@ -156,7 +175,7 @@ { gtk_widget_set_opacity (priv->widget, WINDOW_MIN_OPACITY + -@@ -1984,7 +2035,7 @@ +@@ -1913,7 +1965,7 @@ // mark mouse-pointer having left bubble and proximity-area // after inital show-up of bubble @@ -165,7 +184,7 @@ priv->prevent_fade = FALSE; } -@@ -2280,6 +2331,14 @@ +@@ -2205,6 +2257,14 @@ G_CALLBACK (bubble_draw), this); @@ -180,7 +199,7 @@ // "clear" input-mask, set title/icon/attributes gtk_widget_set_app_paintable (window, TRUE); gtk_window_set_title (GTK_WINDOW (window), "notify-osd"); -@@ -2762,7 +2821,7 @@ +@@ -2681,7 +2741,7 @@ priv = self->priv; @@ -189,7 +208,7 @@ return FALSE; return priv->mouse_over; -@@ -2866,7 +2925,7 @@ +@@ -2785,7 +2845,7 @@ // check if mouse-pointer is over bubble (and proximity-area) initially pointer_update (self); @@ -198,7 +217,7 @@ priv->prevent_fade = TRUE; else priv->prevent_fade = FALSE; -@@ -3429,6 +3488,8 @@ +@@ -3348,6 +3408,8 @@ gint old_bubble_height = 0; gint new_bubble_width = 0; gint new_bubble_height = 0; @@ -207,7 +226,7 @@ Defaults* d; BubblePrivate* priv; -@@ -3623,6 +3684,13 @@ +@@ -3542,6 +3604,13 @@ _refresh_body (self); update_shape (self); @@ -250,10 +269,11 @@ -#define DEFAULT_MARGIN_SIZE 1.0f -#define DEFAULT_ICON_SIZE 3.0f -#define DEFAULT_GAUGE_SIZE 0.625f +-#define DEFAULT_GAUGE_OUTLINE_WIDTH 0.125f +float DEFAULT_MARGIN_SIZE = 1.0f; +float DEFAULT_ICON_SIZE = 3.0f; +float DEFAULT_GAUGE_SIZE = 0.625f; - #define DEFAULT_GAUGE_OUTLINE_WIDTH 0.125f ++#define DEFAULT_GAUGE_OUTLINE_WIDTH 0.125f #define DEFAULT_TEXT_FONT_FACE "Sans" #define DEFAULT_TEXT_TITLE_COLOR "#ffffff" -#define DEFAULT_TEXT_TITLE_WEIGHT TEXT_WEIGHT_BOLD @@ -291,7 +311,7 @@ gravity = DEFAULT_GRAVITY; // update stored DPI-value -@@ -474,7 +475,7 @@ +@@ -479,7 +480,7 @@ self); // use fixed slot-allocation for async. and sync. bubbles @@ -300,7 +320,7 @@ } static void -@@ -1335,7 +1336,7 @@ +@@ -1340,7 +1341,7 @@ "gravity", "Positional hint for placing bubbles", 0, @@ -309,7 +329,7 @@ DEFAULT_GRAVITY, G_PARAM_CONSTRUCT | G_PARAM_READWRITE | -@@ -1373,6 +1374,17 @@ +@@ -1378,6 +1379,17 @@ return self->desktop_height; } @@ -615,7 +635,7 @@ /* fwd declaration */ void close_handler (GObject* n, Stack* stack); -@@ -647,6 +648,15 @@ +@@ -653,6 +654,15 @@ if (body) bubble_set_message_body (bubble, body); @@ -631,7 +651,7 @@ if (new_bubble && bubble_is_append_allowed(bubble)) { app_bubble = find_bubble_for_append(self, bubble); -@@ -958,8 +968,7 @@ +@@ -964,8 +974,7 @@ case SLOT_ALLOCATION_FIXED: *y += EM2PIXELS (defaults_get_icon_size (d), d) + 2 * EM2PIXELS (defaults_get_margin_size (d), d) + @@ -641,7 +661,7 @@ break; case SLOT_ALLOCATION_DYNAMIC: -@@ -975,6 +984,161 @@ +@@ -981,6 +990,161 @@ } break; @@ -692,7 +712,7 @@ + + } + break; -+ ++ + case GRAVITY_SOUTH_EAST: + d = self->defaults; + ++++++ notify-osd_0.9.35+15.10.20151014.orig.tar.gz -> notify-osd_0.9.35+16.04.20151118.orig.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/notify-osd-0.9.35+15.10.20151014/src/bubble.c new/notify-osd-0.9.35+16.04.20151118/src/bubble.c --- old/notify-osd-0.9.35+15.10.20151014/src/bubble.c 2015-10-14 11:50:06.000000000 +0200 +++ new/notify-osd-0.9.35+16.04.20151118/src/bubble.c 2015-11-18 17:39:00.000000000 +0100 @@ -94,7 +94,7 @@ // used to prevent unneeded updates of the tile-cache, for append-, // update or replace-cases, needs to move into class Notification - GString* old_icon_filename; + gchar * old_icon_filename; }; G_DEFINE_TYPE_WITH_PRIVATE (Bubble, bubble, G_TYPE_OBJECT); @@ -124,12 +124,6 @@ gdouble value; }; -#define TEMPORARY_ICON_PREFIX_WORKAROUND 1 -#ifdef TEMPORARY_ICON_PREFIX_WORKAROUND -#warning "--== Using the icon-name-substitution! This is a temp. workaround not going to be maintained for long! ==--" -#define NOTIFY_OSD_ICON_PREFIX "notification" -#endif - // FIXME: this is in class Defaults already, but not yet hooked up so for the // moment we use the macros here, these values reflect the visual-guideline // for jaunty notifications @@ -1832,71 +1826,6 @@ } static -GdkPixbuf* -load_icon (Bubble* self, - const gchar* filename, - gint icon_size) -{ - GdkPixbuf* buffer = NULL; - GdkPixbuf* pixbuf = NULL; - GtkIconTheme* theme = NULL; - GError* error = NULL; - gint scale; - - /* sanity check */ - g_return_val_if_fail (filename, NULL); - - /* Images referenced must always be local files. */ - if (!strncmp (filename, "file://", 7)) - filename += 7; - - scale = gtk_widget_get_scale_factor (self->priv->widget); - - if (filename[0] == '/') - { - /* load image into pixbuf */ - pixbuf = gdk_pixbuf_new_from_file_at_scale (filename, - scale * icon_size, - scale * icon_size, - TRUE, - NULL); - } else { - /* TODO: rewrite, check for SVG support, raise apport - ** notification for low-res icons */ - theme = gtk_icon_theme_get_default (); - buffer = gtk_icon_theme_load_icon_for_scale (theme, - filename, - icon_size, - scale, - GTK_ICON_LOOKUP_FORCE_SVG | - GTK_ICON_LOOKUP_GENERIC_FALLBACK | - GTK_ICON_LOOKUP_FORCE_SIZE, - &error); - if (error) - { - g_print ("loading icon '%s' caused error: '%s'", - filename, - error->message); - g_error_free (error); - error = NULL; - pixbuf = NULL; - } - else - { - /* copy and unref buffer so on an icon-theme change old - ** icons are not kept in memory due to dangling - ** references, this also makes sure we do not need to - ** connect to GtkWidget::style-set signal for the - ** GdkPixbuf we get from gtk_icon_theme_load_icon() */ - pixbuf = gdk_pixbuf_copy (buffer); - g_object_unref (buffer); - } - } - - return pixbuf; -} - -static gboolean pointer_update (Bubble* bubble) { @@ -2109,11 +2038,7 @@ priv->tile_indicator = NULL; } - if (priv->old_icon_filename) - { - g_string_free ((gpointer) priv->old_icon_filename, TRUE); - priv->old_icon_filename = NULL; - } + g_clear_pointer (&priv->old_icon_filename, g_free); // chain up to the parent class G_OBJECT_CLASS (bubble_parent_class)->dispose (gobject); @@ -2321,7 +2246,6 @@ this->priv->tile_body = NULL; this->priv->tile_indicator = NULL; this->priv->prevent_fade = FALSE; - this->priv->old_icon_filename = g_string_new (""); update_input_shape (window); @@ -2432,89 +2356,84 @@ } void -bubble_set_icon_from_path (Bubble* self, - const gchar* filepath) +bubble_set_icon (Bubble* self, + const gchar* name) { - Defaults* d; - BubblePrivate* priv; + BubblePrivate *priv; + gint scale; + gint icon_size; - if (!self || !IS_BUBBLE (self) || !g_strcmp0 (filepath, "")) - return; + g_return_if_fail (self != NULL); + g_return_if_fail (name != NULL); priv = self->priv; + scale = gtk_widget_get_scale_factor (priv->widget); + icon_size = EM2PIXELS (defaults_get_icon_size (self->defaults), self->defaults); // check if an app tries to set the same file as icon again, this check // avoids superfluous regeneration of the tile/blur-cache for the icon, // thus it improves performance in update- and append-cases - if (!g_strcmp0 (priv->old_icon_filename->str, filepath)) + if (!g_strcmp0 (priv->old_icon_filename, name)) return; - // store the new icon-basename - g_string_assign (priv->old_icon_filename, filepath); + g_clear_object (&priv->icon_pixbuf); + g_clear_pointer (&priv->old_icon_filename, g_free); - if (priv->icon_pixbuf) + if (g_str_has_prefix (name, "file://")) { - g_object_unref (priv->icon_pixbuf); - priv->icon_pixbuf = NULL; - } - - d = self->defaults; - priv->icon_pixbuf = load_icon (self, - filepath, - EM2PIXELS (defaults_get_icon_size (d), d)); - - _refresh_icon (self); -} + gchar *filename; + GError *error = NULL; -void -bubble_set_icon (Bubble* self, - const gchar* filename) -{ - Defaults* d; - BubblePrivate* priv; -#ifdef TEMPORARY_ICON_PREFIX_WORKAROUND - gchar* notify_osd_iconname; -#endif + filename = g_filename_from_uri (name, NULL, &error); + if (filename == NULL) + { + g_printerr ("%s is not a valid file uri: %s", name, error->message); + g_error_free (error); + return; + } - if (!self || !IS_BUBBLE (self) || !g_strcmp0 (filename, "")) - return; + priv->icon_pixbuf = gdk_pixbuf_new_from_file_at_scale (filename, scale * icon_size, scale * icon_size, TRUE, NULL); - priv = self->priv; + g_free (filename); + } + else + { + GError *error = NULL; + GdkPixbuf *buffer; + GtkIconTheme *theme; + GtkIconLookupFlags flags; + gchar *fallback_name; - //basename = g_path_get_basename (filename); + theme = gtk_icon_theme_get_default (); + flags = GTK_ICON_LOOKUP_FORCE_SVG | GTK_ICON_LOOKUP_GENERIC_FALLBACK | GTK_ICON_LOOKUP_FORCE_SIZE; - // check if an app tries to set the same file as icon again, this check - // avoids superfluous regeneration of the tile/blur-cache for the icon, - // thus it improves performance in update- and append-cases - if (!g_strcmp0 (priv->old_icon_filename->str, filename)) - return; + fallback_name = g_strconcat ("notification-", name, NULL); + buffer = gtk_icon_theme_load_icon_for_scale (theme, fallback_name, icon_size, scale, flags, &error); + g_free (fallback_name); + + if (buffer == NULL && g_error_matches (error, GTK_ICON_THEME_ERROR, GTK_ICON_THEME_NOT_FOUND)) { + g_clear_error (&error); + buffer = gtk_icon_theme_load_icon_for_scale (theme, name, icon_size, scale, flags, &error); + } - // store the new icon-basename - g_string_assign (priv->old_icon_filename, filename); + if (buffer == NULL) + { + g_print ("Unable to load icon '%s': %s", name, error->message); + g_error_free (error); + return; + } - if (priv->icon_pixbuf) - { - g_object_unref (priv->icon_pixbuf); - priv->icon_pixbuf = NULL; + /* copy and unref buffer so on an icon-theme change old + ** icons are not kept in memory due to dangling + ** references, this also makes sure we do not need to + ** connect to GtkWidget::style-set signal for the + ** GdkPixbuf we get from gtk_icon_theme_load_icon() */ + priv->icon_pixbuf = gdk_pixbuf_copy (buffer); + g_object_unref (buffer); } - d = self->defaults; - -#ifdef TEMPORARY_ICON_PREFIX_WORKAROUND - notify_osd_iconname = g_strdup_printf (NOTIFY_OSD_ICON_PREFIX "-%s", - filename); - priv->icon_pixbuf = load_icon (self, - notify_osd_iconname, - EM2PIXELS (defaults_get_icon_size (d), - d)); - g_free (notify_osd_iconname); -#endif - - // fallback to non-notify-osd name - if (!priv->icon_pixbuf) - priv->icon_pixbuf = load_icon (self, - filename, - EM2PIXELS (defaults_get_icon_size (d), d)); + // store the new icon-basename + priv->old_icon_filename = g_strdup (name); _refresh_icon (self); } @@ -2591,7 +2510,7 @@ priv = self->priv; // "reset" the stored the icon-filename, fixes LP: #451086 - g_string_assign (priv->old_icon_filename, "\0"); + g_clear_pointer (&priv->old_icon_filename, g_free); if (priv->icon_pixbuf) { @@ -3715,7 +3634,6 @@ /* icon + indicator layout-case, e.g. volume */ if ((priv->icon_pixbuf != NULL) && (priv->title->len != 0) && - (priv->message_body->len == 0) && (priv->value >= -1)) { priv->layout = LAYOUT_ICON_INDICATOR; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/notify-osd-0.9.35+15.10.20151014/src/bubble.h new/notify-osd-0.9.35+16.04.20151118/src/bubble.h --- old/notify-osd-0.9.35+15.10.20151014/src/bubble.h 2015-10-14 11:49:59.000000000 +0200 +++ new/notify-osd-0.9.35+16.04.20151118/src/bubble.h 2015-11-18 17:38:55.000000000 +0100 @@ -109,12 +109,8 @@ bubble_get_message_body (Bubble* self); void -bubble_set_icon_from_path (Bubble* self, - const gchar* filepath); - -void bubble_set_icon (Bubble* self, - const gchar* filename); + const gchar* name); void bubble_set_icon_from_pixbuf (Bubble* self, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/notify-osd-0.9.35+15.10.20151014/src/defaults.c new/notify-osd-0.9.35+16.04.20151118/src/defaults.c --- old/notify-osd-0.9.35+15.10.20151014/src/defaults.c 2015-10-14 11:49:59.000000000 +0200 +++ new/notify-osd-0.9.35+16.04.20151118/src/defaults.c 2015-11-18 17:38:55.000000000 +0100 @@ -468,6 +468,11 @@ G_CALLBACK (_font_changed), self); + g_signal_connect (gtk_settings_get_default (), + "notify::gtk-xft-dpi", + G_CALLBACK (_font_changed), + self); + g_signal_connect (self->nosd_settings, "changed", G_CALLBACK (_gravity_changed), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/notify-osd-0.9.35+15.10.20151014/src/stack.c new/notify-osd-0.9.35+16.04.20151118/src/stack.c --- old/notify-osd-0.9.35+15.10.20151014/src/stack.c 2015-10-14 11:49:59.000000000 +0200 +++ new/notify-osd-0.9.35+16.04.20151118/src/stack.c 2015-11-18 17:38:55.000000000 +0100 @@ -269,15 +269,21 @@ bubble_refresh (bubble); } +static Bubble *sync_bubble = NULL; + static void value_changed_handler (Defaults* defaults, Stack* stack) { if (stack->list != NULL) g_list_foreach (stack->list, _trigger_bubble_redraw, NULL); -} -static Bubble *sync_bubble = NULL; + if (sync_bubble != NULL) + { + bubble_recalc_size (sync_bubble); + bubble_refresh (sync_bubble); + } +} #include "display.c" @@ -730,7 +736,7 @@ { g_debug("Using image_path hint\n"); if ((data && G_VALUE_HOLDS_STRING (data))) - bubble_set_icon_from_path (bubble, g_value_get_string(data)); + bubble_set_icon (bubble, g_value_get_string(data)); else g_warning ("image_path hint is not a string\n"); }
participants (1)
-
root@hilbert.suse.de