Truncated systray icons

Jasper Huijsmans jasper at xfce.org
Mon Feb 27 21:51:15 CET 2006


Jasper Huijsmans schreef:
> Olivier Fourdan schreef:
> ...
>> I dunno, maybe you're right, but setting a size there clearly introduces 
>> a race condition between (maybe broken implementations of the) systray 
>> icon and the panel systray.
>>
>> I'm not sure how to fix that in a clean way. BTW, your patch enlarge the 
>> panel too, it doesn't bound the icon size, does it?
>>
> 
> I don't know, but is the patch below any better?
> 
> I couldn't set the size conditionally, because 
> gtk_widget_get_size_request() and gtk_widget_size_request() return -1 
> and 1, respectively. No idea how gtk does the size allocation...
> 

Hmm, I think this should have the same effect:

Index: plugins/systray/systray.c
===================================================================
--- plugins/systray/systray.c	(revision 20124)
+++ plugins/systray/systray.c	(working copy)
@@ -83,16 +83,9 @@
  {
      if (systray->tray_registered)
      {
-        int size = MIN (systray->iconbox->allocation.width,
-                        systray->iconbox->allocation.height);
-
-        gtk_widget_hide (systray->iconbox);
+        gtk_widget_show (icon);
          gtk_box_pack_start (GTK_BOX (systray->iconbox), icon,
                              FALSE, FALSE, 0);
-        gtk_widget_show (icon);
-        gtk_widget_set_size_request (icon, size, size);
-        gtk_widget_show (systray->iconbox);
-        gtk_widget_queue_draw (systray->iconbox);
      }
  }

@@ -167,24 +160,24 @@
  static gboolean
  systray_set_size (XfcePanelPlugin *plugin, int size, Systray *systray)
  {
-    GList *list, *l;
      int border = size > 26 ? 2 : 0;

      gtk_container_set_border_width (GTK_CONTAINER (systray->frame), 
border);

-    size = size - border - MAX (systray->frame->style->xthickness,
-                                systray->frame->style->ythickness);
+    size = size - border - 2 - MAX (systray->frame->style->xthickness,
+                                    systray->frame->style->ythickness);

-    list = gtk_container_get_children (GTK_CONTAINER (systray->iconbox));
-    for (l = list; l != NULL; l = l->next)
+    if (xfce_panel_plugin_get_orientation (plugin)
+            == GTK_ORIENTATION_HORIZONTAL)
      {
-        gtk_widget_set_size_request (l->data, size, size);
+        gtk_widget_set_size_request (systray->iconbox, -1, size);
      }
-    g_list_free (list);
-
-    gtk_widget_queue_draw (systray->iconbox);
-
-    return TRUE;
+    else
+    {
+        gtk_widget_set_size_request (systray->iconbox, size, -1);
+    }
+
+     return TRUE;
  }

  static void
@@ -289,7 +282,7 @@
              GTK_ORIENTATION_HORIZONTAL)
      {
          systray->iconbox =
-            xfce_hvbox_new (GTK_ORIENTATION_HORIZONTAL, TRUE, 3);
+            xfce_hvbox_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 3);

          gtk_alignment_set_padding (GTK_ALIGNMENT (systray->align),
                                     0, 0, 3, 3);
@@ -297,7 +290,7 @@
      else
      {
          systray->iconbox =
-            xfce_hvbox_new (GTK_ORIENTATION_VERTICAL, TRUE, 3);
+            xfce_hvbox_new (GTK_ORIENTATION_VERTICAL, FALSE, 3);

          gtk_alignment_set_padding (GTK_ALIGNMENT (systray->align),
                                     3, 3, 0, 0);




More information about the Xfce4-dev mailing list