Bug#288764: Support for ownly showing iconified windows

Anthony DeRobertis Anthony DeRobertis <asd@suespammers.org>, 288764@bugs.debian.org
Wed, 05 Jan 2005 10:01:26 -0500


Package: libwnck
Severity: wishlist

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Waaaay back in gnome1.x there was an option to only show iconified
windows. It was very nice. Below is the beginnings of a patch to re-add
that support. Please don't apply this patch yet; it's got serious issues
like not being configurable.


diff -rdbU3 libwnck/tasklist.c libwnck.new/tasklist.c
- --- ../libwnck-changes/libwnck/tasklist.c	2005-01-04 22:22:56.000000000 -0500
+++ libwnck/tasklist.c	2005-01-05 09:39:44.000000000 -0500
@@ -1032,6 +1032,20 @@
   return tasklist->priv->size_hints;
 }
   
+
+/*
+ * Determine if a window's tasklist button widget should be visible or not.
+*/
+static gboolean
+wnck_tasklist_show_widget (WnckTasklist *tasklist, WnckWindow *win)
+{
+  if ((wnck_window_get_state (win) ^ WNCK_WINDOW_STATE_HIDDEN) & WNCK_WINDOW_STATE_HIDDEN)
+    return FALSE;
+  if ((wnck_window_get_state (win) & WNCK_WINDOW_STATE_SHADED))
+    return FALSE;
+  return TRUE;
+}
+  
 static void
 wnck_tasklist_size_allocate (GtkWidget      *widget,
                              GtkAllocation  *allocation)
@@ -1047,6 +1061,7 @@
   int n_rows;
   int n_cols;
   int n_grouped_buttons;
+  int n_hidden_buttons;
   int i;
   gboolean score_set;
   GList *ungrouped_class_groups;
@@ -1113,17 +1128,39 @@
 					   &n_cols, &n_rows);
     }
 
- -  /* Add all ungrouped windows to visible_tasks, and hide their class groups */
+  /* Add all ungrouped windows to visible_tasks unless they are iconified, and hide their class groups */
   l = ungrouped_class_groups;
+  n_hidden_buttons = 0;
   while (l != NULL)
     {
+      GList *m;
       class_group_task = WNCK_TASK (l->data);
       
- -      visible_tasks = g_list_concat (visible_tasks, g_list_copy (class_group_task->windows));
+      /*visible_tasks = g_list_concat (visible_tasks, g_list_copy (class_group_task->windows));*/
+      for (m = class_group_task->windows; m != NULL; m = m->next)
+        {
+	  WnckTask *task = WNCK_TASK(m->data);
+	  if (wnck_tasklist_show_widget(tasklist, task->window))
+	    {
+	      visible_tasks = g_list_prepend(visible_tasks, task);
+	    }
+	  else
+	    {
+	      ++n_hidden_buttons;
+	      gtk_widget_set_child_visible (GTK_WIDGET (task->button), FALSE);
+	    }
+        }
+      
       gtk_widget_set_child_visible (GTK_WIDGET (class_group_task->button), FALSE);
       l = l->next;
     }
 
+    button_width = wnck_tasklist_layout (allocation,
+					 tasklist->priv->max_button_width,
+					 tasklist->priv->max_button_height,
+					 n_startup_sequences + n_windows - n_grouped_buttons - n_hidden_buttons,
+					 &n_cols, &n_rows);
+
   /* Add all startup sequences */
   visible_tasks = g_list_concat (visible_tasks, g_list_copy (tasklist->priv->startup_sequences));
 

- -- System Information:
Debian Release: 3.1
  APT prefers testing
  APT policy: (500, 'testing'), (130, 'unstable'), (120, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.8-bohr
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFB3AFG+z+IwlXqWf4RAnqkAJ9Wn0S14hNQDDFxSS1trcpDnaJ6TACgkNH1
bRhj9xSzxOx2aiHoDxdNI2M=
=2n01
-----END PGP SIGNATURE-----