[Xfce4-commits] <xfce4-panel:master> Add debugging info to systray.

Nick Schermer noreply at xfce.org
Tue Jan 4 22:10:06 CET 2011


Updating branch refs/heads/master
         to 1d17c4d20ae31426787621746008dce9179ea6f6 (commit)
       from b6d6a0d34144906a8f77d7596eba28efb12bea43 (commit)

commit 1d17c4d20ae31426787621746008dce9179ea6f6
Author: Nick Schermer <nick at xfce.org>
Date:   Tue Jan 4 21:58:12 2011 +0100

    Add debugging info to systray.

 common/panel-debug.c              |    1 +
 common/panel-debug.h              |    3 ++-
 plugins/systray/systray-box.c     |   30 ++++++++++++++++++++++++++++--
 plugins/systray/systray-manager.c |    5 +++++
 plugins/systray/systray-manager.h |    2 --
 plugins/systray/systray-socket.c  |    9 +++++++++
 plugins/systray/systray.c         |    7 +++++++
 7 files changed, 52 insertions(+), 5 deletions(-)

diff --git a/common/panel-debug.c b/common/panel-debug.c
index e13bbb0..f626ddc 100644
--- a/common/panel-debug.c
+++ b/common/panel-debug.c
@@ -47,6 +47,7 @@ static const GDebugKey panel_debug_keys[] =
   { "tasklist", PANEL_DEBUG_TASKLIST },
   { "base-window", PANEL_DEBUG_BASE_WINDOW },
   { "applicationsmenu", PANEL_DEBUG_APPLICATIONSMENU },
+  { "systray", PANEL_DEBUG_SYSTRAY },
   { "gdb", PANEL_DEBUG_GDB },
   { "valgrind", PANEL_DEBUG_VALGRIND }
 };
diff --git a/common/panel-debug.h b/common/panel-debug.h
index 1d1507f..1c56f61 100644
--- a/common/panel-debug.h
+++ b/common/panel-debug.h
@@ -35,7 +35,8 @@ typedef enum
   PANEL_DEBUG_BASE_WINDOW      = 1 << 9,
   PANEL_DEBUG_APPLICATIONSMENU = 1 << 10,
   PANEL_DEBUG_GDB              = 1 << 11, /* run plugin in gdb */
-  PANEL_DEBUG_VALGRIND         = 1 << 12  /* run plugin in valgrind */
+  PANEL_DEBUG_VALGRIND         = 1 << 12, /* run plugin in valgrind */
+  PANEL_DEBUG_SYSTRAY          = 1 << 13
 }
 PanelDebugFlag;
 
diff --git a/plugins/systray/systray-box.c b/plugins/systray/systray-box.c
index 1de3a30..bf0ebd7 100644
--- a/plugins/systray/systray-box.c
+++ b/plugins/systray/systray-box.c
@@ -31,7 +31,7 @@
 #include <gtk/gtk.h>
 #include <libxfce4panel/libxfce4panel.h>
 #include <common/panel-private.h>
-#include <common/panel-xfconf.h>
+#include <common/panel-debug.h>
 
 #include "systray-box.h"
 #include "systray-socket.h"
@@ -321,6 +321,10 @@ systray_box_size_request (GtkWidget      *widget,
         }
     }
 
+  panel_debug_filtered (PANEL_DEBUG_SYSTRAY,
+      "requested cells=%g, rows=%d, row_size=%d, children=%d",
+      cells, rows, row_size, box->n_visible_children);
+
   if (cells > 0.00)
     {
       cols = cells / (gdouble) rows;
@@ -356,6 +360,10 @@ systray_box_size_request (GtkWidget      *widget,
   /* emit property if changed */
   if (box->n_hidden_childeren != n_hidden_childeren)
     {
+      panel_debug_filtered (PANEL_DEBUG_SYSTRAY,
+          "hidden children changed (%d -> %d)",
+          n_hidden_childeren, box->n_hidden_childeren);
+
       box->n_hidden_childeren = n_hidden_childeren;
       g_object_notify (G_OBJECT (box), "has-hidden");
     }
@@ -391,9 +399,13 @@ systray_box_size_allocate (GtkWidget     *widget,
 
   border = GTK_CONTAINER (widget)->border_width;
 
-  alloc_size = box->horizontal ? widget->allocation.height : widget->allocation.width;
+  alloc_size = box->horizontal ? allocation->height : allocation->width;
   systray_box_size_get_max_child_size (box, alloc_size, &rows, &row_size, &offset);
 
+  panel_debug_filtered (PANEL_DEBUG_SYSTRAY, "allocate rows=%d, row_size=%d, w=%d, h=%d, horiz=%s",
+                        rows, row_size, allocation->width, allocation->height,
+                        PANEL_DEBUG_BOOL (box->horizontal));
+
   /* get allocation bounds */
   x_start = allocation->x + border;
   x_end = allocation->x + allocation->width - border;
@@ -505,6 +517,11 @@ systray_box_size_allocate (GtkWidget     *widget,
                       /* we overflow the number of rows, restart
                        * allocation with 1px smaller icons */
                       row_size--;
+
+                      panel_debug_filtered (PANEL_DEBUG_SYSTRAY,
+                          "y overflow (%d > %d), restart with row_size=%d",
+                          y, y_end, row_size);
+
                       goto restart_allocation;
                     }
                 }
@@ -518,6 +535,11 @@ systray_box_size_allocate (GtkWidget     *widget,
                       /* we overflow the number of rows, restart
                        * allocation with 1px smaller icons */
                       row_size--;
+
+                      panel_debug_filtered (PANEL_DEBUG_SYSTRAY,
+                          "x overflow (%d > %d), restart with row_size=%d",
+                          x, x_end, row_size);
+
                       goto restart_allocation;
                     }
                 }
@@ -532,6 +554,10 @@ systray_box_size_allocate (GtkWidget     *widget,
             y += row_size * ratio + SPACING;
         }
 
+      panel_debug_filtered (PANEL_DEBUG_SYSTRAY, "allocated %s at (%d,%d;%d,%d)",
+          systray_socket_get_name (XFCE_SYSTRAY_SOCKET (child)),
+          child_alloc.x, child_alloc.y, child_alloc.width, child_alloc.height);
+
       gtk_widget_size_allocate (child, &child_alloc);
     }
 }
diff --git a/plugins/systray/systray-manager.c b/plugins/systray/systray-manager.c
index 7b41741..6a18f9e 100644
--- a/plugins/systray/systray-manager.c
+++ b/plugins/systray/systray-manager.c
@@ -36,6 +36,7 @@
 #include <gtk/gtk.h>
 
 #include <common/panel-private.h>
+#include <common/panel-debug.h>
 
 #include <libxfce4panel/libxfce4panel.h>
 #include <libxfce4util/libxfce4util.h>
@@ -387,6 +388,8 @@ systray_manager_register (SystrayManager  *manager,
       gdk_display_add_client_message_filter (display,
           gdk_atom_intern ("_NET_SYSTEM_TRAY_MESSAGE_DATA", FALSE),
           systray_manager_handle_client_message_message_data, manager);
+
+      panel_debug (PANEL_DEBUG_SYSTRAY, "registered manager on screen %d", screen_number);
     }
   else
     {
@@ -468,6 +471,8 @@ systray_manager_unregister (SystrayManager *manager)
   manager->invisible = NULL;
   gtk_widget_destroy (invisible);
   g_object_unref (G_OBJECT (invisible));
+
+  panel_debug (PANEL_DEBUG_SYSTRAY, "unregistered manager");
 }
 
 
diff --git a/plugins/systray/systray-manager.h b/plugins/systray/systray-manager.h
index f9c0e0c..5a5a9d3 100644
--- a/plugins/systray/systray-manager.h
+++ b/plugins/systray/systray-manager.h
@@ -67,7 +67,5 @@ void            systray_manager_unregister           (SystrayManager      *manag
 void            systray_manager_set_orientation      (SystrayManager      *manager,
                                                       GtkOrientation       orientation);
 
-gchar          *systray_manager_get_application_name (GtkWidget            *socket) G_GNUC_MALLOC;
-
 
 #endif /* !__SYSTRAY_MANAGER_H__ */
diff --git a/plugins/systray/systray-socket.c b/plugins/systray/systray-socket.c
index d473270..70496b3 100644
--- a/plugins/systray/systray-socket.c
+++ b/plugins/systray/systray-socket.c
@@ -35,7 +35,10 @@
 #include <gtk/gtk.h>
 
 #include <libxfce4panel/libxfce4panel.h>
+
 #include <common/panel-private.h>
+#include <common/panel-debug.h>
+
 #include "systray-socket.h"
 
 
@@ -152,6 +155,12 @@ systray_socket_realize (GtkWidget *widget)
       socket->parent_relative_bg || socket->is_composited);
 
   gtk_widget_set_double_buffered (widget, socket->parent_relative_bg);
+
+  panel_debug_filtered (PANEL_DEBUG_SYSTRAY,
+      "socket %s (composited=%s, relative-bg=%s",
+      systray_socket_get_name (socket),
+      PANEL_DEBUG_BOOL (socket->is_composited),
+      PANEL_DEBUG_BOOL (socket->parent_relative_bg));
 }
 
 
diff --git a/plugins/systray/systray.c b/plugins/systray/systray.c
index cf90f5e..cc346e0 100644
--- a/plugins/systray/systray.c
+++ b/plugins/systray/systray.c
@@ -26,6 +26,7 @@
 #include <common/panel-private.h>
 #include <common/panel-xfconf.h>
 #include <common/panel-utils.h>
+#include <common/panel-debug.h>
 #include <exo/exo.h>
 
 #include "systray.h"
@@ -809,6 +810,9 @@ systray_plugin_icon_added (SystrayManager *manager,
   systray_plugin_names_update_icon (icon, plugin);
   gtk_container_add (GTK_CONTAINER (plugin->box), icon);
   gtk_widget_show (icon);
+
+  panel_debug_filtered (PANEL_DEBUG_SYSTRAY, "added %s icon",
+      systray_socket_get_name (XFCE_SYSTRAY_SOCKET (icon)));
 }
 
 
@@ -825,6 +829,9 @@ systray_plugin_icon_removed (SystrayManager *manager,
 
   /* remove the icon from the box */
   gtk_container_remove (GTK_CONTAINER (plugin->box), icon);
+
+  panel_debug_filtered (PANEL_DEBUG_SYSTRAY, "removed %s icon",
+      systray_socket_get_name (XFCE_SYSTRAY_SOCKET (icon)));
 }
 
 



More information about the Xfce4-commits mailing list