[Xfce4-commits] [apps/xfce4-notifyd] 01/01: Add a hidden option 'do-fadeout' (Bug #11341)

noreply at xfce.org noreply at xfce.org
Sun Aug 7 12:29:29 CEST 2016


This is an automated email from the git hooks/post-receive script.

ochosi pushed a commit to branch master
in repository apps/xfce4-notifyd.

commit 0addd8092ca37033bff2e560b5cb6453ca339d7d
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Sun Aug 7 12:29:19 2016 +0200

    Add a hidden option 'do-fadeout' (Bug #11341)
---
 xfce4-notifyd/xfce-notify-daemon.c | 10 ++++++++++
 xfce4-notifyd/xfce-notify-window.c | 15 +++++++++++++--
 2 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/xfce4-notifyd/xfce-notify-daemon.c b/xfce4-notifyd/xfce-notify-daemon.c
index 73ed931..62b036a 100644
--- a/xfce4-notifyd/xfce-notify-daemon.c
+++ b/xfce4-notifyd/xfce-notify-daemon.c
@@ -57,6 +57,7 @@ struct _XfceNotifyDaemon
     guint bus_name_id;
     gdouble initial_opacity;
     GtkCornerType notify_location;
+    gboolean do_fadeout;
 
     GtkCssProvider *css_provider;
     gboolean is_default_theme;
@@ -1182,6 +1183,8 @@ static gboolean notify_notify (XfceNotifyGBus *skeleton,
 
     xfce_notify_window_set_icon_only(window, x_canonical);
 
+    xfce_notify_window_set_do_fadeout(window, xndaemon->do_fadeout);
+
     if(value_hint_set)
         xfce_notify_window_set_gauge_value(window, value_hint);
     else
@@ -1387,6 +1390,10 @@ xfce_notify_daemon_settings_changed(XfconfChannel *channel,
         xndaemon->notify_location = G_VALUE_TYPE(value)
                                   ? g_value_get_uint(value)
                                   : GTK_CORNER_TOP_RIGHT;
+    } else if(!strcmp(property, "/do-fadeout")) {
+        xndaemon->do_fadeout = G_VALUE_TYPE(value)
+                               ? g_value_get_boolean(value)
+                               : TRUE;
     }
 }
 
@@ -1418,6 +1425,9 @@ xfce_notify_daemon_load_config (XfceNotifyDaemon *xndaemon,
                                                       "/notify-location",
                                                       GTK_CORNER_TOP_RIGHT);
 
+    xndaemon->do_fadeout = xfconf_channel_get_bool(xndaemon->settings,
+                                                "/do-fadeout", TRUE);
+
     g_signal_connect(G_OBJECT(xndaemon->settings), "property-changed",
                      G_CALLBACK(xfce_notify_daemon_settings_changed),
                      xndaemon);
diff --git a/xfce4-notifyd/xfce-notify-window.c b/xfce4-notifyd/xfce-notify-window.c
index fdf3f2f..3b72ddd 100644
--- a/xfce4-notifyd/xfce-notify-window.c
+++ b/xfce4-notifyd/xfce-notify-window.c
@@ -36,6 +36,7 @@
 
 #define DEFAULT_EXPIRE_TIMEOUT 10000
 #define DEFAULT_NORMAL_OPACITY 0.85
+#define DEFAULT_DO_FADEOUT        TRUE
 #define FADE_TIME              800
 #define FADE_CHANGE_TIMEOUT    50
 #define DEFAULT_RADIUS         10
@@ -75,6 +76,7 @@ struct _XfceNotifyWindow
     guint fade_id;
     guint op_change_steps;
     gdouble op_change_delta;
+    gboolean do_fadeout;
 };
 
 typedef struct
@@ -176,6 +178,7 @@ xfce_notify_window_init(XfceNotifyWindow *window)
 
     window->expire_timeout = DEFAULT_EXPIRE_TIMEOUT;
     window->normal_opacity = DEFAULT_NORMAL_OPACITY;
+    window->do_fadeout = DEFAULT_DO_FADEOUT;
 
     gtk_widget_set_name (GTK_WIDGET(window), "XfceNotifyWindow");
     gtk_window_set_keep_above(GTK_WINDOW(window), TRUE);
@@ -491,7 +494,6 @@ static gboolean xfce_notify_window_draw (GtkWidget *widget,
      * if this is a pixel or two off here and there */
     gtk_widget_input_shape_combine_region(widget, region);
 
-    cairo_surface_destroy (surface);
     cairo_region_destroy (region);
 
     GTK_WIDGET_CLASS (xfce_notify_window_parent_class)->draw (widget, cr);
@@ -569,7 +571,7 @@ xfce_notify_window_expire_timeout(gpointer data)
     fade_transparent =
         gdk_screen_is_composited(gtk_window_get_screen(GTK_WINDOW(window)));
 
-    if(fade_transparent) {
+    if(fade_transparent && window->do_fadeout) {
         window->fade_id = g_timeout_add(FADE_CHANGE_TIMEOUT,
                                         xfce_notify_window_fade_timeout,
                                         window);
@@ -1082,6 +1084,15 @@ xfce_notify_window_unset_gauge_value(XfceNotifyWindow *window)
 }
 
 void
+xfce_notify_window_set_do_fadeout(XfceNotifyWindow *window,
+                               gboolean do_fadeout)
+{
+    g_return_if_fail(XFCE_IS_NOTIFY_WINDOW(window));
+
+    window->do_fadeout = do_fadeout;
+}
+
+void
 xfce_notify_window_closed(XfceNotifyWindow *window,
                           XfceNotifyCloseReason reason)
 {

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list