Author: nick Date: 2007-11-19 09:47:19 +0000 (Mon, 19 Nov 2007) New Revision: 26377
Modified: xfce4-panel/trunk/plugins/systray/xfce-tray-widget.c Log: * Fix typo that cuts of icons. * Fix overflow icons. Modified: xfce4-panel/trunk/plugins/systray/xfce-tray-widget.c =================================================================== --- xfce4-panel/trunk/plugins/systray/xfce-tray-widget.c 2007-11-19 05:10:46 UTC (rev 26376) +++ xfce4-panel/trunk/plugins/systray/xfce-tray-widget.c 2007-11-19 09:47:19 UTC (rev 26377) @@ -93,6 +93,9 @@ /* hidden childeren counter */ gint n_hidden_childeren; + /* last allocated child size, used to prevent icon overflow */ + gint last_alloc_child_size; + /* whether hidden icons are visible */ guint show_hidden : 1; @@ -182,6 +185,7 @@ tray->n_hidden_childeren = 0; tray->arrow_type = GTK_ARROW_LEFT; tray->show_hidden = FALSE; + tray->last_alloc_child_size = 0; /* create hash table */ tray->names = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); @@ -226,7 +230,7 @@ XfceTrayWidget *tray = XFCE_TRAY_WIDGET (widget); GSList *li; XfceTrayWidgetChild *child_info; - gint child_size = 128; + gint child_size = 0; gint n_columns; GtkRequisition child_requisition; gint n_visible_childeren = 0; @@ -267,10 +271,11 @@ tray->n_hidden_childeren++; } + /* only allocate size for not hidden icons */ if (child_info->hidden == FALSE || tray->show_hidden == TRUE) { - /* update the child size (smallest icon) */ - child_size = MIN (child_size, MAX (child_requisition.width, child_requisition.height)); + /* update the child size (tray is homogeneous, so pick the largest icon) */ + child_size = MAX (child_size, MAX (child_requisition.width, child_requisition.height)); /* increase number of visible childeren */ n_visible_childeren++; @@ -283,6 +288,9 @@ if (n_visible_childeren > (n_columns * tray->rows)) n_columns++; + /* make sure the maximum child size does not overflow the tray */ + child_size = MIN (child_size, tray->last_alloc_child_size); + /* set the width and height needed for the icons */ if (n_visible_childeren > 0) { @@ -349,6 +357,9 @@ child_size -= XFCE_TRAY_WIDGET_SPACING * (tray->rows - 1); child_size /= tray->rows; + /* set last allocated child size */ + tray->last_alloc_child_size = child_size; + /* position arrow button */ if (tray->n_hidden_childeren > 0) { _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org http://foo-projects.org/mailman/listinfo/xfce4-commits