[Xfce4-commits] <xfce4-notifyd:master> Delay the initialization of the placement data.

Jérôme Guelfucci noreply at xfce.org
Wed Nov 17 21:54:02 CET 2010


Updating branch refs/heads/master
         to 4e12936b2e31c0e28750e10326baee9ff7ed38ba (commit)
       from e66792394d573e0c6ff2559645aaeee118ef672a (commit)

commit 4e12936b2e31c0e28750e10326baee9ff7ed38ba
Author: Jérôme Guelfucci <jeromeg at xfce.org>
Date:   Wed Nov 17 21:48:44 2010 +0100

    Delay the initialization of the placement data.
    
    We compute the workareas and create the arrays when when show the first
    notification. This fixes a bug where the workarea was not computed
    correctly because it did not take the panels into account (because
    gdk_screen_get_window_stack returns NULL during the first seconds of the
    session).
    
    It also makes startup a little faster and saves some memory
    when the daemon is not needed and just queried for its capacities.

 xfce4-notifyd/xfce-notify-daemon.c |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/xfce4-notifyd/xfce-notify-daemon.c b/xfce4-notifyd/xfce-notify-daemon.c
index c2224dc..6452cb4 100644
--- a/xfce4-notifyd/xfce-notify-daemon.c
+++ b/xfce4-notifyd/xfce-notify-daemon.c
@@ -266,14 +266,11 @@ xfce_notify_daemon_screen_changed(GdkScreen *screen,
 }
 
 static void
-xfce_notify_daemon_init(XfceNotifyDaemon *xndaemon)
+xfce_notify_daemon_init_placement_data(XfceNotifyDaemon *xndaemon)
 {
     gint nscreen = gdk_display_get_n_screens(gdk_display_get_default());
     gint i;
 
-    xndaemon->active_notifications = g_tree_new_full(xfce_direct_compare,
-                                                   NULL, NULL,
-                                                   (GDestroyNotify)gtk_widget_destroy);
     xndaemon->reserved_rectangles = g_new(GList **, nscreen);
     xndaemon->monitors_workarea = g_new(GdkRectangle *, nscreen);
 
@@ -300,7 +297,15 @@ xfce_notify_daemon_init(XfceNotifyDaemon *xndaemon)
         gdk_window_set_events(groot, gdk_window_get_events(groot) | GDK_PROPERTY_CHANGE_MASK);
         gdk_window_add_filter(groot, xfce_notify_rootwin_watch_workarea, xndaemon);
     }
+}
 
+static void
+xfce_notify_daemon_init(XfceNotifyDaemon *xndaemon)
+{
+
+    xndaemon->active_notifications = g_tree_new_full(xfce_direct_compare,
+                                                   NULL, NULL,
+                                                   (GDestroyNotify)gtk_widget_destroy);
     xndaemon->last_notification_id = 1;
 }
 
@@ -531,7 +536,12 @@ xfce_notify_daemon_window_size_allocate(GtkWidget *widget,
     GList *list;
     gboolean found = FALSE;
 
-    DBG("Size allocate called.");
+    DBG("Size allocate called for %d", xndaemon->last_notification_id);
+
+    if(xndaemon->last_notification_id == 2)
+        /* First time we place a notification, initialize the arrays needed for
+         * that (workarea, notification lists...). */
+        xfce_notify_daemon_init_placement_data(xndaemon);
 
     geom_tmp = xfce_notify_window_get_geometry(window);
     if(geom_tmp->width != 0 && geom_tmp->height != 0) {



More information about the Xfce4-commits mailing list