Index: tasklist.c
===================================================================
--- tasklist.c	(révision 1359)
+++ tasklist.c	(copie de travail)
@@ -90,7 +90,7 @@ typedef struct _WnckTaskClass   WnckTask
 #define DEFAULT_WIDTH 1
 #define DEFAULT_HEIGHT 48
 
-#define MAX_WIDTH_CHARS 250
+#define TASKLIST_TEXT_MAX_WIDTH 25 /* maximum width in characters */
 
 #define N_SCREEN_CONNECTIONS 5
 
@@ -1213,6 +1213,30 @@ wnck_task_get_highest_scored (GList     
   return g_list_remove (ungrouped_class_groups, best_task);
 }
 
+static int
+wnck_tasklist_get_button_size (GtkWidget *widget)
+{
+  PangoContext *context;
+  PangoFontMetrics *metrics;
+  gint char_width;
+  gint text_width;
+  gint width;
+
+  gtk_widget_ensure_style (widget);
+
+  context = gtk_widget_get_pango_context (widget);
+  metrics = pango_context_get_metrics (context, widget->style->font_desc,
+                                       pango_context_get_language (context));
+  char_width = pango_font_metrics_get_approximate_char_width (metrics);
+  pango_font_metrics_unref (metrics);
+  text_width = PANGO_PIXELS (TASKLIST_TEXT_MAX_WIDTH * char_width);
+
+  /* See the padding used by gtk_box_pack_start() */
+  width = text_width + DEFAULT_MINI_ICON_WIDTH + 2 * 4 + 2 * 4;
+
+  return width;
+}
+
 static void
 wnck_tasklist_size_request  (GtkWidget      *widget,
                              GtkRequisition *requisition)
@@ -1285,16 +1309,11 @@ wnck_tasklist_size_request  (GtkWidget  
       l = l->next;
     }
   
-  tasklist->priv->max_button_width = max_width;
+  tasklist->priv->max_button_width = wnck_tasklist_get_button_size (widget);
   tasklist->priv->max_button_height = max_height;
 
-  requisition->width = tasklist->priv->minimum_width;
-  requisition->height = tasklist->priv->minimum_height;
-  
-  fake_allocation.width = MAX (requisition->width,
-                               GTK_WIDGET (tasklist)->allocation.width);
-  fake_allocation.height = MAX (requisition->height,
-                                GTK_WIDGET (tasklist)->allocation.height);
+  fake_allocation.width = GTK_WIDGET (tasklist)->allocation.width;
+  fake_allocation.height = GTK_WIDGET (tasklist)->allocation.height;
 
   array = g_array_new (FALSE, FALSE, sizeof (int));
 
@@ -1389,6 +1408,9 @@ wnck_tasklist_size_request  (GtkWidget  
   tasklist->priv->size_hints_len = array->len;
     
   tasklist->priv->size_hints = (int *)g_array_free (array, FALSE);
+
+  requisition->width = tasklist->priv->size_hints[0];
+  requisition->height = fake_allocation.height;
 }
 
 /**
@@ -3638,7 +3660,6 @@ wnck_task_create_widgets (WnckTask *task
   gtk_misc_set_alignment (GTK_MISC (task->label), 0.0, 0.5);
   gtk_label_set_ellipsize (GTK_LABEL (task->label),
                           PANGO_ELLIPSIZE_END);
-  gtk_label_set_max_width_chars (GTK_LABEL (task->label), MAX_WIDTH_CHARS);
 
   if (wnck_task_get_needs_attention (task))
     {
@@ -3649,7 +3670,7 @@ wnck_task_create_widgets (WnckTask *task
   gtk_widget_show (task->label);
 
   gtk_box_pack_start (GTK_BOX (hbox), task->image, FALSE, FALSE, 4);
-  gtk_box_pack_start (GTK_BOX (hbox), task->label, TRUE, TRUE, 2);
+  gtk_box_pack_start (GTK_BOX (hbox), task->label, TRUE, TRUE, 4);
 
   gtk_container_add (GTK_CONTAINER (task->button), hbox);
   gtk_widget_show (hbox);
Index: test-tasklist.c
===================================================================
--- test-tasklist.c	(révision 1356)
+++ test-tasklist.c	(copie de travail)
@@ -1,5 +1,7 @@
 /* vim: set sw=2 et: */
 
+//TODO handle size hints
+
 #include <libwnck/libwnck.h>
 #include <gtk/gtk.h>
 
