[packages/libwnck2] apply tasklist_orientation.patch from debian

glen glen at pld-linux.org
Sun Feb 17 01:18:45 CET 2013


commit 6851e41a5d6f8479d58eb258c5fd5958b12902e8
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Sun Feb 17 02:18:03 2013 +0200

    apply tasklist_orientation.patch from debian
    
    needed for mate-panel to use libwnck

 libwnck2.spec              |   6 +-
 tasklist_orientation.patch | 281 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 285 insertions(+), 2 deletions(-)
---
diff --git a/libwnck2.spec b/libwnck2.spec
index 769a2dc..c91a972 100644
--- a/libwnck2.spec
+++ b/libwnck2.spec
@@ -1,16 +1,17 @@
 #
 # Conditional build:
 %bcond_without	apidocs		# disable gtk-doc
-#
+
 Summary:	General Window Manager interfacing for GNOME utilities
 Summary(pl.UTF-8):	Interfejs General Window Manager dla narzędzi GNOME
 Name:		libwnck2
 Version:	2.30.7
-Release:	1
+Release:	2
 License:	LGPL v2+
 Group:		X11/Libraries
 Source0:	http://ftp.gnome.org/pub/GNOME/sources/libwnck/2.30/libwnck-%{version}.tar.xz
 # Source0-md5:	3d20f26105a2fd878899d6ecdbe9a082
+Patch0:		tasklist_orientation.patch
 BuildRequires:	autoconf >= 2.62
 BuildRequires:	automake >= 1:1.9
 BuildRequires:	docbook-dtd412-xml
@@ -97,6 +98,7 @@ Dokumentacja API libwnck.
 
 %prep
 %setup -q -n libwnck-%{version}
+%patch0 -p1
 
 %build
 %{__gtkdocize}
diff --git a/tasklist_orientation.patch b/tasklist_orientation.patch
new file mode 100644
index 0000000..786135a
--- /dev/null
+++ b/tasklist_orientation.patch
@@ -0,0 +1,281 @@
+Debian #524117
+GNOME #513347 and #86382
+
+Index: libwnck-2.30.3/libwnck/tasklist.c
+===================================================================
+--- libwnck-2.30.3.orig/libwnck/tasklist.c	2010-08-16 19:49:35.885871012 +0200
++++ libwnck-2.30.3/libwnck/tasklist.c	2010-08-17 00:06:53.550368075 +0200
+@@ -234,6 +234,8 @@ struct _WnckTasklistPrivate
+   GdkPixmap *background;
+ 
+   guint drag_start_time;
++
++  GtkOrientation orientation;  
+ };
+ 
+ static GType wnck_task_get_type (void);
+@@ -316,6 +318,7 @@ static int      wnck_tasklist_layout
+ 					     int             max_width,
+ 					     int             max_height,
+ 					     int             n_buttons,
++                                             GtkOrientation  orientation,
+ 					     int            *n_cols_out,
+ 					     int            *n_rows_out);
+ 
+@@ -976,6 +979,20 @@ wnck_tasklist_set_button_relief (WnckTas
+ }
+ 
+ /**
++ * wnck_tasklist_set_orientation:
++ * @tasklist: a #WnckTasklist.
++ * @orient: a GtkOrientation.
++ *
++ * Set the orientation of the @taskluist.  The main use of this function is
++ * proper integration of #WnckTasklist in vertical panels.
++ */
++ 
++void wnck_tasklist_set_orientation(WnckTasklist *tasklist, GtkOrientation orient)
++{
++    tasklist->priv->orientation = orient;
++}
++
++/**
+  * wnck_tasklist_set_switch_workspace_on_unminimize:
+  * @tasklist: a #WnckTasklist.
+  * @switch_workspace_on_unminimize: whether to activate the #WnckWorkspace a
+@@ -1147,29 +1164,38 @@ wnck_tasklist_layout (GtkAllocation *all
+ 		      int            max_width,
+ 		      int            max_height,
+ 		      int            n_buttons,
++                      GtkOrientation orientation,
+ 		      int           *n_cols_out,
+ 		      int           *n_rows_out)
+ {
+   int n_cols, n_rows;
+ 
+-  /* How many rows fit in the allocation */
+-  n_rows = allocation->height / max_height;
+-
+-  /* Don't have more rows than buttons */
+-  n_rows = MIN (n_rows, n_buttons);
+-
+-  /* At least one row */
+-  n_rows = MAX (n_rows, 1);
+-  
+-  /* We want to use as many rows as possible to limit the width */
+-  n_cols = (n_buttons + n_rows - 1) / n_rows;
+-
+-  /* At least one column */
+-  n_cols = MAX (n_cols, 1);
++  if (orientation == GTK_ORIENTATION_HORIZONTAL) {
++      /* How many rows fit in the allocation */
++      n_rows = allocation->height / max_height;
++      
++      /* Don't have more rows than buttons */
++      n_rows = MIN (n_rows, n_buttons);
++      
++      /* At least one row */
++      n_rows = MAX (n_rows, 1);
++      
++      /* We want to use as many rows as possible to limit the width */
++      n_cols = (n_buttons + n_rows - 1) / n_rows;
++      
++      /* At least one column */
++      n_cols = MAX (n_cols, 1);
++      
++  } else {
++      n_cols = allocation->width / max_width;
++      n_cols = MIN(n_cols, n_buttons);
++      n_cols = MAX(n_cols, 1);
+ 
++      n_rows = (n_buttons + n_cols - 1) / n_cols;
++      n_rows = MAX(n_rows, 1);
++  }
+   *n_cols_out = n_cols;
+   *n_rows_out = n_rows;
+-  
+   return allocation->width / n_cols;
+ }
+ 
+@@ -1367,19 +1393,31 @@ wnck_tasklist_size_request  (GtkWidget
+ 			tasklist->priv->max_button_width,
+ 			tasklist->priv->max_button_height,
+ 			n_windows + n_startup_sequences,
++                        tasklist->priv->orientation,
+ 			&n_cols, &n_rows);
+ 
+   last_n_cols = G_MAXINT;
+   lowest_range = G_MAXINT;
+   if (tasklist->priv->grouping != WNCK_TASKLIST_ALWAYS_GROUP)
+     {
+-      val = n_cols * tasklist->priv->max_button_width;
+-      g_array_insert_val (array, array->len, val);
+-      val = n_cols * grouping_limit;
+-      g_array_insert_val (array, array->len, val);
+-
+-      last_n_cols = n_cols;
+-      lowest_range = val;
++        if (tasklist->priv->orientation == GTK_ORIENTATION_HORIZONTAL) {
++            val = n_cols * tasklist->priv->max_button_width;
++            g_array_insert_val (array, array->len, val);
++            val = n_cols * grouping_limit;
++            g_array_insert_val (array, array->len, val);
++            
++            last_n_cols = n_cols;
++            lowest_range = val;
++        } else {
++            val = n_rows * tasklist->priv->max_button_height;
++            g_array_insert_val (array, array->len, val);
++            val = n_rows * grouping_limit;
++            g_array_insert_val (array, array->len, val);
++            
++            last_n_cols = n_rows;
++            lowest_range = val;
++            
++        }
+     }
+ 
+   while (ungrouped_class_groups != NULL &&
+@@ -1399,29 +1437,56 @@ wnck_tasklist_size_request  (GtkWidget
+ 			    tasklist->priv->max_button_width,
+ 			    tasklist->priv->max_button_height,
+ 			    n_startup_sequences + n_windows - n_grouped_buttons,
++                            tasklist->priv->orientation,
+ 			    &n_cols, &n_rows);
+-      if (n_cols != last_n_cols &&
+-	  (tasklist->priv->grouping == WNCK_TASKLIST_AUTO_GROUP ||
+-	   ungrouped_class_groups == NULL))
+-	{
+-	  val = n_cols * tasklist->priv->max_button_width;
+-	  if (val >= lowest_range)
+-	    { /* Overlaps old range */
+-              g_assert (array->len > 0);
+-	      lowest_range = n_cols * grouping_limit;
+-              g_array_index(array, int, array->len-1) = lowest_range;
+-	    }
+-	  else
+-	    {
+-	      /* Full new range */
+-	      g_array_insert_val (array, array->len, val);
+-	      val = n_cols * grouping_limit;
+-	      g_array_insert_val (array, array->len, val);
+-	      lowest_range = val;
+-	    }
+-
+-	  last_n_cols = n_cols;
+-	}
++      if (tasklist->priv->orientation == GTK_ORIENTATION_HORIZONTAL) {
++          if (n_cols != last_n_cols &&
++              (tasklist->priv->grouping == WNCK_TASKLIST_AUTO_GROUP ||
++               ungrouped_class_groups == NULL))
++          {
++              val = n_cols * tasklist->priv->max_button_width;
++              if (val >= lowest_range)
++              { /* Overlaps old range */
++                  g_assert (array->len > 0);
++                  lowest_range = n_cols * grouping_limit;
++                  g_array_index(array, int, array->len-1) = lowest_range;
++              }
++              else
++              {
++                  /* Full new range */
++                  g_array_insert_val (array, array->len, val);
++                  val = n_cols * grouping_limit;
++                  g_array_insert_val (array, array->len, val);
++                  lowest_range = val;
++              }
++              
++              last_n_cols = n_cols;
++          }
++      } else {
++          if (n_rows != last_n_cols &&
++              (tasklist->priv->grouping == WNCK_TASKLIST_AUTO_GROUP ||
++               ungrouped_class_groups == NULL))
++          {
++              val = n_rows * tasklist->priv->max_button_height;;
++              if (val >= lowest_range)
++              { /* Overlaps old range */
++                  g_assert (array->len > 0);
++                  lowest_range = n_rows * grouping_limit;
++                  g_array_index(array, int, array->len-1) = lowest_range;
++              }
++              else
++              {
++                  /* Full new range */
++                  g_array_insert_val (array, array->len, val);
++                  val = n_rows * grouping_limit;
++                  g_array_insert_val (array, array->len, val);
++                  lowest_range = val;
++              }
++              
++              last_n_cols = n_rows;
++          }
++      }
++      
+     }
+ 
+   g_list_free (ungrouped_class_groups);
+@@ -1443,8 +1508,13 @@ wnck_tasklist_size_request  (GtkWidget
+     
+   tasklist->priv->size_hints = (int *)g_array_free (array, FALSE);
+ 
+-  requisition->width = tasklist->priv->size_hints[0];
+-  requisition->height = fake_allocation.height;
++  if (tasklist->priv->orientation == GTK_ORIENTATION_VERTICAL) {
++      requisition->width  = n_cols * tasklist->priv->max_button_width;
++      requisition->height = n_rows * tasklist->priv->max_button_height;
++  } else {
++      requisition->width = tasklist->priv->size_hints[0];
++      requisition->height = fake_allocation.height;
++  }
+ }
+ 
+ /**
+@@ -1540,6 +1610,7 @@ wnck_tasklist_size_allocate (GtkWidget
+ 				       tasklist->priv->max_button_width,
+ 				       tasklist->priv->max_button_height,
+ 				       n_startup_sequences + n_windows,
++                                       tasklist->priv->orientation,
+ 				       &n_cols, &n_rows);
+   while (ungrouped_class_groups != NULL &&
+ 	 ((tasklist->priv->grouping == WNCK_TASKLIST_ALWAYS_GROUP) ||
+@@ -1589,6 +1660,7 @@ wnck_tasklist_size_allocate (GtkWidget
+ 					   tasklist->priv->max_button_width,
+ 					   tasklist->priv->max_button_height,
+ 					   n_startup_sequences + n_windows - n_grouped_buttons,
++                                           tasklist->priv->orientation,
+ 					   &n_cols, &n_rows);
+     }
+ 
+@@ -2143,6 +2215,7 @@ wnck_tasklist_new (WnckScreen *screen)
+   WnckTasklist *tasklist;
+ 
+   tasklist = g_object_new (WNCK_TYPE_TASKLIST, NULL);
++  tasklist->priv->orientation = GTK_ORIENTATION_HORIZONTAL;
+ 
+   return GTK_WIDGET (tasklist);
+ }
+@@ -4275,7 +4348,6 @@ wnck_task_new_from_window (WnckTasklist
+   WnckTask *task;
+ 
+   task = g_object_new (WNCK_TYPE_TASK, NULL);
+-
+   task->type = WNCK_TASK_WINDOW;
+   task->window = g_object_ref (window);
+   task->class_group = g_object_ref (wnck_window_get_class_group (window));
+Index: libwnck-2.30.3/libwnck/tasklist.h
+===================================================================
+--- libwnck-2.30.3.orig/libwnck/tasklist.h	2010-08-16 19:49:35.841870516 +0200
++++ libwnck-2.30.3/libwnck/tasklist.h	2010-08-17 00:07:59.713865796 +0200
+@@ -99,6 +99,11 @@ void wnck_tasklist_set_include_all_works
+ 					       gboolean      include_all_workspaces);
+ void wnck_tasklist_set_button_relief (WnckTasklist *tasklist,
+                                       GtkReliefStyle relief);
++#ifdef WNCK_I_KNOW_THIS_IS_NOT_UPSTREAM
++void wnck_tasklist_set_orientation(WnckTasklist *tasklist,
++                                   GtkOrientation orient);
++#endif
++
+ #ifndef WNCK_DISABLE_DEPRECATED
+ void wnck_tasklist_set_minimum_width (WnckTasklist *tasklist, gint size);
+ gint wnck_tasklist_get_minimum_width (WnckTasklist *tasklist);
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/libwnck2.git/commitdiff/6851e41a5d6f8479d58eb258c5fd5958b12902e8



More information about the pld-cvs-commit mailing list