[Xfce4-commits] <xfce4-notifyd:master> Remove fade to transparent option.

Jérôme Guelfucci noreply at xfce.org
Tue Dec 21 17:00:01 CET 2010


Updating branch refs/heads/master
         to d4265988c27b3993a80e287868a0c2773fd48bf6 (commit)
       from aac0a7b316d57a7d033f50ebfb5fc3560fed1656 (commit)

commit d4265988c27b3993a80e287868a0c2773fd48bf6
Author: Jérôme Guelfucci <jeromeg at xfce.org>
Date:   Mon Dec 20 19:25:36 2010 +0100

    Remove fade to transparent option.
    
    Now we fade to transparent if we have a compositor.

 xfce4-notifyd/xfce-notify-daemon.c |   11 ----------
 xfce4-notifyd/xfce-notify-window.c |   39 ++++++++++++------------------------
 2 files changed, 13 insertions(+), 37 deletions(-)

diff --git a/xfce4-notifyd/xfce-notify-daemon.c b/xfce4-notifyd/xfce-notify-daemon.c
index f677923..999214f 100644
--- a/xfce4-notifyd/xfce-notify-daemon.c
+++ b/xfce4-notifyd/xfce-notify-daemon.c
@@ -50,7 +50,6 @@ struct _XfceNotifyDaemon
     GObject parent;
 
     gint expire_timeout;
-    gboolean fade_transparency;
     gdouble initial_opacity;
     GtkCornerType notify_location;
 
@@ -862,8 +861,6 @@ notify_notify(XfceNotifyDaemon *xndaemon,
         xfce_notify_window_set_body(window, body);
         xfce_notify_window_set_actions(window, actions);
         xfce_notify_window_set_expire_timeout(window, expire_timeout);
-        xfce_notify_window_set_fade_transparent(window,
-                                                xndaemon->fade_transparency);
         xfce_notify_window_set_opacity(window, xndaemon->initial_opacity);
 
         *OUT_id = replaces_id;
@@ -872,8 +869,6 @@ notify_notify(XfceNotifyDaemon *xndaemon,
                                                                         app_icon,
                                                                         expire_timeout,
                                                                         actions));
-        xfce_notify_window_set_fade_transparent(window,
-                                                xndaemon->fade_transparency);
         xfce_notify_window_set_opacity(window, xndaemon->initial_opacity);
 
         *OUT_id = xfce_notify_daemon_generate_id(xndaemon);
@@ -1102,9 +1097,6 @@ xfce_notify_daemon_settings_changed(XfconfChannel *channel,
                                  ? g_value_get_int(value) : -1;
         if(xndaemon->expire_timeout != -1)
             xndaemon->expire_timeout *= 1000;
-    } else if(!strcmp(property, "/fade-transparency")) {
-        xndaemon->fade_transparency = G_VALUE_TYPE(value)
-                                    ? g_value_get_boolean(value) : TRUE;
     } else if(!strcmp(property, "/initial-opacity")) {
         xndaemon->initial_opacity = G_VALUE_TYPE(value)
                                   ? g_value_get_double(value) : 0.9;
@@ -1175,9 +1167,6 @@ xfce_notify_daemon_load_config(XfceNotifyDaemon *xndaemon,
     if(xndaemon->expire_timeout != -1)
         xndaemon->expire_timeout *= 1000;
 
-    xndaemon->fade_transparency = xfconf_channel_get_bool(xndaemon->settings,
-                                                        "/fade-transparency",
-                                                        TRUE);
     xndaemon->initial_opacity = xfconf_channel_get_double(xndaemon->settings,
                                                         "/initial-opacity",
                                                         0.9);
diff --git a/xfce4-notifyd/xfce-notify-window.c b/xfce4-notifyd/xfce-notify-window.c
index a7c7289..4190c84 100644
--- a/xfce4-notifyd/xfce-notify-window.c
+++ b/xfce4-notifyd/xfce-notify-window.c
@@ -58,8 +58,7 @@ struct _XfceNotifyWindow
 
     gdouble normal_opacity;
 
-    guint32 fade_transparent:1,
-            icon_only:1,
+    guint32 icon_only:1,
             has_summary_text:1,
             has_body_text:1,
             has_actions;
@@ -200,7 +199,6 @@ xfce_notify_window_init(XfceNotifyWindow *window)
     GTK_WINDOW(window)->type = GTK_WINDOW_TOPLEVEL;
     window->expire_timeout = DEFAULT_EXPIRE_TIMEOUT;
     window->normal_opacity = DEFAULT_NORMAL_OPACITY;
-    window->fade_transparent = TRUE;
     /* The summary widget needs to be initialized before style_set is called. gtk_widget_ensure_style calls style_set */
     window->summary = gtk_label_new(NULL);
 
@@ -271,9 +269,15 @@ xfce_notify_window_start_expiration(XfceNotifyWindow *window)
 {
     if(window->expire_timeout) {
         GTimeVal ct;
+        gboolean fade_transparent;
+
         g_get_current_time(&ct);
+
+        fade_transparent =
+            gdk_screen_is_composited(gtk_window_get_screen(GTK_WINDOW (window)));
+
         window->expire_start_timestamp = ct.tv_sec * 1000 + ct.tv_usec / 1000;
-        window->expire_id = g_timeout_add(window->fade_transparent
+        window->expire_id = g_timeout_add(fade_transparent
                                           ? window->expire_timeout - FADE_TIME
                                           : window->expire_timeout,
                                           xfce_notify_window_expire_timeout,
@@ -661,10 +665,14 @@ static gboolean
 xfce_notify_window_expire_timeout(gpointer data)
 {
     XfceNotifyWindow *window = data;
+    gboolean          fade_transparent;
 
     window->expire_id = 0;
 
-    if(window->fade_transparent) {
+    fade_transparent =
+        gdk_screen_is_composited(gtk_window_get_screen(GTK_WINDOW(window)));
+
+    if(fade_transparent) {
         window->fade_id = g_timeout_add(FADE_CHANGE_TIMEOUT,
                                         xfce_notify_window_fade_timeout,
                                         window);
@@ -1203,27 +1211,6 @@ xfce_notify_window_set_actions(XfceNotifyWindow *window,
 }
 
 void
-xfce_notify_window_set_fade_transparent(XfceNotifyWindow *window,
-                                        gboolean fade_transparent)
-{
-    g_return_if_fail(XFCE_IS_NOTIFY_WINDOW(window));
-
-    if(fade_transparent == window->fade_transparent)
-        return;
-
-    window->fade_transparent = !!fade_transparent;
-
-    /* if we're already realized, we don't actually do anything here */
-}
-
-gboolean
-xfce_notify_window_get_fade_transparent(XfceNotifyWindow *window)
-{
-    g_return_val_if_fail(XFCE_IS_NOTIFY_WINDOW(window), FALSE);
-    return window->fade_transparent;
-}
-
-void
 xfce_notify_window_set_opacity(XfceNotifyWindow *window,
                                gdouble opacity)
 {



More information about the Xfce4-commits mailing list