[gtk+/resolution-independence: 15/24] port GtkHsv, GtkAssistant, GtkNotebook and GtkPaned to RI



commit 1113402c7b7e9b13043487e144cf396e7a917140
Author: David Zeuthen <davidz redhat com>
Date:   Wed Aug 13 15:31:20 2008 -0400

    port GtkHsv, GtkAssistant, GtkNotebook and GtkPaned to RI
    
    min/max for GtkAssistant
    
    min/max for GtkNotebook
    
    min/max for GtkPaned
    
    fixed gtkpaned.c
    
    fixed gtknotebook.c
    
    fixed gtkassistant.c
---
 gtk/gtk.symbols    |    1 +
 gtk/gtkassistant.c |   42 ++++++--------
 gtk/gtkhsv.c       |   63 +++++++++++++++------
 gtk/gtkhsv.h       |    7 ++-
 gtk/gtknotebook.c  |  155 +++++++++++++++++++++++++++-------------------------
 gtk/gtknotebook.h  |    6 +-
 gtk/gtkpaned.c     |   12 ++--
 7 files changed, 158 insertions(+), 128 deletions(-)

diff --git a/gtk/gtk.symbols b/gtk/gtk.symbols
index 5d82ebe..c85933b 100644
--- a/gtk/gtk.symbols
+++ b/gtk/gtk.symbols
@@ -1819,6 +1819,7 @@ gtk_hseparator_new
 #if IN_FILE(__GTK_HSV_C__)
 gtk_hsv_get_color
 gtk_hsv_get_metrics
+gtk_hsv_get_metrics_unit
 gtk_hsv_get_type G_GNUC_CONST
 gtk_hsv_is_adjusting
 gtk_hsv_new
diff --git a/gtk/gtkassistant.c b/gtk/gtkassistant.c
index 317e3cd..a506605 100644
--- a/gtk/gtkassistant.c
+++ b/gtk/gtkassistant.c
@@ -46,8 +46,8 @@
 
 #define GTK_ASSISTANT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GTK_TYPE_ASSISTANT, GtkAssistantPrivate))
 
-#define HEADER_SPACING 12
-#define ACTION_AREA_SPACING 12
+#define HEADER_SPACING GTK_SIZE_ONE_TWELFTH_EM(12)
+#define ACTION_AREA_SPACING GTK_SIZE_ONE_TWELFTH_EM(12)
 
 typedef struct _GtkAssistantPage GtkAssistantPage;
 
@@ -277,21 +277,17 @@ gtk_assistant_class_init (GtkAssistantClass *class)
 		  G_TYPE_NONE, 0);
 
   gtk_widget_class_install_style_property (widget_class,
-					   g_param_spec_int ("header-padding",
-							     P_("Header Padding"),
-							     P_("Number of pixels around the header."),
-							     0,
-							     G_MAXINT,
-							     6,
-							     GTK_PARAM_READABLE));
+					   gtk_param_spec_size ("header-padding",
+                                                                P_("Header Padding"),
+                                                                P_("Number of pixels around the header."),
+                                                                0, G_MAXINT, GTK_SIZE_ONE_TWELFTH_EM (6),
+                                                                GTK_PARAM_READABLE));
   gtk_widget_class_install_style_property (widget_class,
-					   g_param_spec_int ("content-padding",
-							     P_("Content Padding"),
-							     P_("Number of pixels around the content pages."),
-							     0,
-							     G_MAXINT,
-							     1,
-							     GTK_PARAM_READABLE));
+					   gtk_param_spec_size ("content-padding",
+                                                                P_("Content Padding"),
+                                                                P_("Number of pixels around the content pages."),
+                                                                0, G_MAXINT, GTK_SIZE_ONE_TWELFTH_EM (1),
+                                                                GTK_PARAM_READABLE));
 
   /**
    * GtkAssistant:page-type:
@@ -745,7 +741,7 @@ gtk_assistant_init (GtkAssistant *assistant)
   gtk_widget_show (priv->sidebar_image);
 
   /* Action area  */
-  priv->action_area  = gtk_hbox_new (FALSE, 6);
+  priv->action_area  = gtk_hbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (6));
   
   assistant->close   = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
   assistant->apply   = gtk_button_new_from_stock (GTK_STOCK_APPLY);
@@ -1105,7 +1101,7 @@ gtk_assistant_size_request (GtkWidget      *widget,
 
       if (page->header_image)
 	{
-	  w += gdk_pixbuf_get_width (page->header_image) + HEADER_SPACING;
+	  w += gdk_pixbuf_get_width (page->header_image) + gtk_widget_size_to_pixel (widget, HEADER_SPACING);
 	  h  = MAX (h, gdk_pixbuf_get_height (page->header_image));
 	}
 
@@ -1126,7 +1122,7 @@ gtk_assistant_size_request (GtkWidget      *widget,
 
   gtk_widget_size_request (priv->action_area, &child_requisition);
   width   = MAX (width, child_requisition.width);
-  height += child_requisition.height + ACTION_AREA_SPACING;
+  height += child_requisition.height + gtk_widget_size_to_pixel (widget, ACTION_AREA_SPACING);
 
   width += GTK_CONTAINER (widget)->border_width * 2 + content_padding * 2;
   height += GTK_CONTAINER (widget)->border_width * 2 + content_padding * 2;
@@ -1197,7 +1193,7 @@ gtk_assistant_size_allocate (GtkWidget      *widget,
     priv->header_image->allocation.height + 2 * header_padding + content_padding;
   child_allocation.width  = allocation->width - 2 * GTK_CONTAINER (widget)->border_width - 2 * content_padding;
   child_allocation.height = allocation->height - 2 * GTK_CONTAINER (widget)->border_width -
-    priv->header_image->allocation.height - 2 * header_padding - ACTION_AREA_SPACING - priv->action_area->allocation.height - 2 * content_padding;
+    priv->header_image->allocation.height - 2 * header_padding - gtk_widget_size_to_pixel (widget, ACTION_AREA_SPACING) - priv->action_area->allocation.height - 2 * content_padding;
 
   if (GTK_WIDGET_VISIBLE (priv->sidebar_image))
     {
@@ -1328,7 +1324,7 @@ assistant_paint_colored_box (GtkWidget *widget)
 		   border_width,
 		   border_width,
 		   widget->allocation.width - 2 * border_width,
-		   widget->allocation.height - priv->action_area->allocation.height - 2 * border_width - ACTION_AREA_SPACING);
+		   widget->allocation.height - priv->action_area->allocation.height - 2 * border_width - gtk_widget_size_to_pixel (widget, ACTION_AREA_SPACING));
   cairo_fill (cr);
 
   /* content box */
@@ -1349,7 +1345,7 @@ assistant_paint_colored_box (GtkWidget *widget)
 		   priv->header_image->allocation.height + content_padding + 2 * header_padding + border_width,
 		   content_width,
 		   widget->allocation.height - 2 * border_width - priv->action_area->allocation.height -
-		   priv->header_image->allocation.height - 2 * content_padding - 2 * header_padding - ACTION_AREA_SPACING);
+		   priv->header_image->allocation.height - 2 * content_padding - 2 * header_padding - gtk_widget_size_to_pixel (widget, ACTION_AREA_SPACING));
   cairo_fill (cr);
 
   cairo_destroy (cr);
@@ -1493,7 +1489,7 @@ gtk_assistant_new (void)
   GtkWidget *assistant;
 
   assistant = g_object_new (GTK_TYPE_ASSISTANT,
-			    "border-width", 12,
+			    "border-width", GTK_SIZE_ONE_TWELFTH_EM (12),
 			    NULL);
   return assistant;
 }
diff --git a/gtk/gtkhsv.c b/gtk/gtkhsv.c
index ed8b44f..3d93149 100644
--- a/gtk/gtkhsv.c
+++ b/gtk/gtkhsv.c
@@ -43,10 +43,10 @@
 #include "gtkalias.h"
 
 /* Default width/height */
-#define DEFAULT_SIZE 100
+#define DEFAULT_SIZE GTK_SIZE_ONE_TWELFTH_EM(100)
 
 /* Default ring width */
-#define DEFAULT_RING_WIDTH 10
+#define DEFAULT_RING_WIDTH GTK_SIZE_ONE_TWELFTH_EM(10)
 
 
 /* Dragging modes */
@@ -64,8 +64,8 @@ typedef struct {
   double v;
   
   /* Size and ring width */
-  int size;
-  int ring_width;
+  GtkSize size;
+  GtkSize ring_width;
   
   /* Window for capturing events */
   GdkWindow *window;
@@ -349,8 +349,8 @@ gtk_hsv_size_request (GtkWidget      *widget,
 			"focus-padding", &focus_pad,
 			NULL);
   
-  requisition->width = priv->size + 2 * (focus_width + focus_pad);
-  requisition->height = priv->size + 2 * (focus_width + focus_pad);
+  requisition->width = gtk_widget_size_to_pixel (widget, priv->size) + 2 * (focus_width + focus_pad);
+  requisition->height = gtk_widget_size_to_pixel (widget, priv->size) + 2 * (focus_width + focus_pad);
 }
 
 /* Size_allocate handler for the HSV color selector */
@@ -547,8 +547,8 @@ compute_triangle (GtkHSV *hsv,
 
   center_x = GTK_WIDGET (hsv)->allocation.width / 2.0;
   center_y = GTK_WIDGET (hsv)->allocation.height / 2.0;
-  outer = priv->size / 2.0;
-  inner = outer - priv->ring_width;
+  outer = gtk_widget_size_to_pixel (hsv, priv->size) / 2.0;
+  inner = outer - gtk_widget_size_to_pixel (hsv, priv->ring_width);
   angle = priv->h * 2.0 * G_PI;
 
   *hx = floor (center_x + cos (angle) * inner + 0.5);
@@ -572,11 +572,10 @@ is_in_ring (GtkHSV *hsv,
   gdouble inner, outer;
 
   priv = hsv->priv;
-
   center_x = GTK_WIDGET (hsv)->allocation.width / 2.0;
   center_y = GTK_WIDGET (hsv)->allocation.height / 2.0;
-  outer = priv->size / 2.0;
-  inner = outer - priv->ring_width;
+  outer = gtk_widget_size_to_pixel (hsv, priv->size / 2.0);
+  inner = outer - gtk_widget_size_to_pixel (hsv, priv->ring_width);
 
   dx = x - center_x;
   dy = center_y - y;
@@ -922,8 +921,8 @@ paint_ring (GtkHSV      *hsv,
   center_x = widget->allocation.width / 2.0;
   center_y = widget->allocation.height / 2.0;
 
-  outer = priv->size / 2.0;
-  inner = outer - priv->ring_width;
+  outer = gtk_widget_size_to_pixel (hsv, priv->size) / 2.0;
+  inner = outer - gtk_widget_size_to_pixel (hsv, priv->ring_width);
   
   /* Create an image initialized with the ring colors */
   
@@ -997,11 +996,11 @@ paint_ring (GtkHSV      *hsv,
   cairo_set_source_surface (cr, source, x, y);
   cairo_surface_destroy (source);
 
-  cairo_set_line_width (cr, priv->ring_width);
+  cairo_set_line_width (cr, gtk_widget_size_to_pixel (hsv, priv->ring_width));
   cairo_new_path (cr);
   cairo_arc (cr,
 	     center_x, center_y,
-	     priv->size / 2. - priv->ring_width / 2.,
+	     gtk_widget_size_to_pixel (hsv, priv->size) / 2. - gtk_widget_size_to_pixel (hsv, priv->ring_width) / 2.,
 	     0, 2 * G_PI);
   cairo_stroke (cr);
   
@@ -1459,8 +1458,8 @@ gtk_hsv_get_color (GtkHSV *hsv,
  */
 void
 gtk_hsv_set_metrics (GtkHSV *hsv,
-		     gint    size,
-		     gint    ring_width)
+		     GtkSize size,
+		     GtkSize ring_width)
 {
   HSVPrivate *priv;
   int same_size;
@@ -1468,7 +1467,7 @@ gtk_hsv_set_metrics (GtkHSV *hsv,
   g_return_if_fail (GTK_IS_HSV (hsv));
   g_return_if_fail (size > 0);
   g_return_if_fail (ring_width > 0);
-  g_return_if_fail (2 * ring_width + 1 <= size);
+  g_return_if_fail (2 * gtk_widget_size_to_pixel (hsv, ring_width) + 1 <= gtk_widget_size_to_pixel (hsv, size));
   
   priv = hsv->priv;
   
@@ -1505,6 +1504,34 @@ gtk_hsv_get_metrics (GtkHSV *hsv,
   priv = hsv->priv;
   
   if (size)
+    *size = gtk_widget_size_to_pixel (hsv, priv->size);
+  
+  if (ring_width)
+    *ring_width = gtk_widget_size_to_pixel (hsv, priv->ring_width);
+}
+
+/**
+ * gtk_hsv_get_metrics_unit:
+ * @hsv: An HSV color selector.
+ * @size: Return value for the diameter of the hue ring.
+ * @ring_width: Return value for the width of the hue ring.
+ *
+ * Like gtk_hsv_get_metrics() but preserves the unit.
+ *
+ * Since: 2.14
+ **/
+void
+gtk_hsv_get_metrics_unit (GtkHSV  *hsv,
+                          GtkSize *size,
+                          GtkSize *ring_width)
+{
+  HSVPrivate *priv;
+  
+  g_return_if_fail (GTK_IS_HSV (hsv));
+  
+  priv = hsv->priv;
+  
+  if (size)
     *size = priv->size;
   
   if (ring_width)
diff --git a/gtk/gtkhsv.h b/gtk/gtkhsv.h
index 79f5b63..eb41cfe 100644
--- a/gtk/gtkhsv.h
+++ b/gtk/gtkhsv.h
@@ -89,11 +89,14 @@ void       gtk_hsv_get_color    (GtkHSV    *hsv,
 				 gdouble   *s,
 				 gdouble   *v);
 void       gtk_hsv_set_metrics  (GtkHSV    *hsv,
-				 gint       size,
-				 gint       ring_width);
+				 GtkSize    size,
+				 GtkSize    ring_width);
 void       gtk_hsv_get_metrics  (GtkHSV    *hsv,
 				 gint      *size,
 				 gint      *ring_width);
+void       gtk_hsv_get_metrics_unit  (GtkHSV    *hsv,
+                                      GtkSize   *size,
+                                      GtkSize   *ring_width);
 gboolean   gtk_hsv_is_adjusting (GtkHSV    *hsv);
 
 /* Convert colors between the RGB and HSV color spaces */
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index 9b1c0c3..b028347 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -197,6 +197,9 @@ struct _GtkNotebookPrivate
   guint during_reorder : 1;
   guint during_detach  : 1;
   guint has_scrolled   : 1;
+
+  GtkUSize tab_hborder_unit;
+  GtkUSize tab_vborder_unit;
 };
 
 static const GtkTargetEntry notebook_targets [] = {
@@ -412,11 +415,11 @@ static void gtk_notebook_menu_detacher       (GtkWidget        *widget,
 static void gtk_notebook_set_homogeneous_tabs_internal (GtkNotebook *notebook,
 							gboolean     homogeneous);
 static void gtk_notebook_set_tab_border_internal       (GtkNotebook *notebook,
-							guint        border_width);
+							GtkUSize     border_width);
 static void gtk_notebook_set_tab_hborder_internal      (GtkNotebook *notebook,
-							guint        tab_hborder);
+							GtkUSize     tab_hborder);
 static void gtk_notebook_set_tab_vborder_internal      (GtkNotebook *notebook,
-							guint        tab_vborder);
+							GtkUSize     tab_vborder);
 
 static void gtk_notebook_update_tab_states             (GtkNotebook *notebook);
 static gboolean gtk_notebook_mnemonic_activate_switch_page (GtkWidget *child,
@@ -590,31 +593,25 @@ gtk_notebook_class_init (GtkNotebookClass *class)
  						      GTK_PARAM_READWRITE));
   g_object_class_install_property (gobject_class,
 				   PROP_TAB_BORDER,
-				   g_param_spec_uint ("tab-border",
- 						      P_("Tab Border"),
- 						      P_("Width of the border around the tab labels"),
- 						      0,
- 						      G_MAXUINT,
- 						      2,
- 						      GTK_PARAM_WRITABLE));
+				   gtk_param_spec_usize ("tab-border",
+                                                         P_("Tab Border"),
+                                                         P_("Width of the border around the tab labels"),
+                                                         0, G_MAXINT, GTK_SIZE_ONE_TWELFTH_EM (2),
+                                                         GTK_PARAM_WRITABLE));
   g_object_class_install_property (gobject_class,
 				   PROP_TAB_HBORDER,
-				   g_param_spec_uint ("tab-hborder",
- 						      P_("Horizontal Tab Border"),
- 						      P_("Width of the horizontal border of tab labels"),
- 						      0,
- 						      G_MAXUINT,
- 						      2,
- 						      GTK_PARAM_READWRITE));
+				   gtk_param_spec_usize ("tab-hborder",
+                                                         P_("Horizontal Tab Border"),
+                                                         P_("Width of the horizontal border of tab labels"),
+                                                         0, G_MAXINT, GTK_SIZE_ONE_TWELFTH_EM (2),
+                                                         GTK_PARAM_READWRITE));
   g_object_class_install_property (gobject_class,
 				   PROP_TAB_VBORDER,
-				   g_param_spec_uint ("tab-vborder",
- 						      P_("Vertical Tab Border"),
- 						      P_("Width of the vertical border of tab labels"),
- 						      0,
- 						      G_MAXUINT,
- 						      2,
- 						      GTK_PARAM_READWRITE));
+				   gtk_param_spec_usize ("tab-vborder",
+                                                         P_("Vertical Tab Border"),
+                                                         P_("Width of the vertical border of tab labels"),
+                                                         0, G_MAXINT, GTK_SIZE_ONE_TWELFTH_EM (2),
+                                                         GTK_PARAM_READWRITE));
   g_object_class_install_property (gobject_class,
 				   PROP_SHOW_TABS,
 				   g_param_spec_boolean ("show-tabs",
@@ -802,13 +799,11 @@ gtk_notebook_class_init (GtkNotebookClass *class)
  * Since: 2.10
  */  
   gtk_widget_class_install_style_property (widget_class,
-					   g_param_spec_int ("tab-overlap",
-							     P_("Tab overlap"),
-							     P_("Size of tab overlap area"),
-							     G_MININT,
-							     G_MAXINT,
-							     2,
-							     GTK_PARAM_READABLE));
+					   gtk_param_spec_size ("tab-overlap",
+                                                                P_("Tab overlap"),
+                                                                P_("Size of tab overlap area"),
+                                                                0, G_MAXINT, GTK_SIZE_ONE_TWELFTH_EM (2),
+                                                                GTK_PARAM_READABLE));
 
 /**
  * GtkNotebook:tab-curvature:
@@ -818,13 +813,11 @@ gtk_notebook_class_init (GtkNotebookClass *class)
  * Since: 2.10
  */  
   gtk_widget_class_install_style_property (widget_class,
-					   g_param_spec_int ("tab-curvature",
-							     P_("Tab curvature"),
-							     P_("Size of tab curvature"),
-							     0,
-							     G_MAXINT,
-							     1,
-							     GTK_PARAM_READABLE));
+					   gtk_param_spec_size ("tab-curvature",
+                                                                P_("Tab curvature"),
+                                                                P_("Size of tab curvature"),
+                                                                0, G_MAXINT, GTK_SIZE_ONE_TWELFTH_EM (1),
+                                                                GTK_PARAM_READABLE));
 
   /**
    * GtkNotebook:arrow-spacing:
@@ -835,13 +828,11 @@ gtk_notebook_class_init (GtkNotebookClass *class)
    * Since: 2.10
    */
   gtk_widget_class_install_style_property (widget_class,
-                                           g_param_spec_int ("arrow-spacing",
-                                                             P_("Arrow spacing"),
-                                                             P_("Scroll arrow spacing"),
-                                                             0,
-                                                             G_MAXINT,
-                                                             0,
-                                                             GTK_PARAM_READABLE));
+                                           gtk_param_spec_size ("arrow-spacing",
+                                                                _("Arrow spacing"),
+                                                                _("Scroll arrow spacing"),
+                                                                0, G_MAXINT, 0,
+                                                                GTK_PARAM_READABLE));
 
   notebook_signals[SWITCH_PAGE] =
     g_signal_new (I_("switch-page"),
@@ -1075,8 +1066,10 @@ gtk_notebook_init (GtkNotebook *notebook)
   notebook->event_window = NULL;
   notebook->menu = NULL;
 
-  notebook->tab_hborder = 2;
-  notebook->tab_vborder = 2;
+  notebook->tab_hborder = gtk_widget_size_to_pixel (notebook, GTK_SIZE_ONE_TWELFTH_EM (2));
+  notebook->tab_vborder = gtk_widget_size_to_pixel (notebook, GTK_SIZE_ONE_TWELFTH_EM (2));
+  priv->tab_hborder_unit = GTK_SIZE_ONE_TWELFTH_EM (2);
+  priv->tab_vborder_unit = GTK_SIZE_ONE_TWELFTH_EM (2);
 
   notebook->show_tabs = TRUE;
   notebook->show_border = TRUE;
@@ -1524,13 +1517,13 @@ gtk_notebook_set_property (GObject         *object,
       gtk_notebook_set_tab_pos (notebook, g_value_get_enum (value));
       break;
     case PROP_TAB_BORDER:
-      gtk_notebook_set_tab_border_internal (notebook, g_value_get_uint (value));
+      gtk_notebook_set_tab_border_internal (notebook, gtk_value_get_usize (value));
       break;
     case PROP_TAB_HBORDER:
-      gtk_notebook_set_tab_hborder_internal (notebook, g_value_get_uint (value));
+      gtk_notebook_set_tab_hborder_internal (notebook, gtk_value_get_usize (value));
       break;
     case PROP_TAB_VBORDER:
-      gtk_notebook_set_tab_vborder_internal (notebook, g_value_get_uint (value));
+      gtk_notebook_set_tab_vborder_internal (notebook, gtk_value_get_usize (value));
       break;
     case PROP_GROUP_ID:
       gtk_notebook_set_group_id (notebook, g_value_get_int (value));
@@ -1580,10 +1573,10 @@ gtk_notebook_get_property (GObject         *object,
       g_value_set_enum (value, notebook->tab_pos);
       break;
     case PROP_TAB_HBORDER:
-      g_value_set_uint (value, notebook->tab_hborder);
+      gtk_value_set_usize (value, priv->tab_hborder_unit, notebook);
       break;
     case PROP_TAB_VBORDER:
-      g_value_set_uint (value, notebook->tab_vborder);
+      gtk_value_set_usize (value, priv->tab_vborder_unit, notebook);
       break;
     case PROP_GROUP_ID:
       g_value_set_int (value, gtk_notebook_get_group_id (notebook));
@@ -1797,6 +1790,7 @@ gtk_notebook_size_request (GtkWidget      *widget,
 			   GtkRequisition *requisition)
 {
   GtkNotebook *notebook = GTK_NOTEBOOK (widget);
+  GtkNotebookPrivate *priv = GTK_NOTEBOOK_GET_PRIVATE (notebook);
   GtkNotebookPage *page;
   GList *children;
   GtkRequisition child_requisition;
@@ -1886,14 +1880,14 @@ gtk_notebook_size_request (GtkWidget      *widget,
 		    {
 		    case GTK_POS_TOP:
 		    case GTK_POS_BOTTOM:
-		      page->requisition.height += 2 * (notebook->tab_vborder +
+		      page->requisition.height += 2 * (gtk_widget_size_to_pixel (notebook, priv->tab_vborder_unit) +
 						       focus_width);
 		      tab_height = MAX (tab_height, page->requisition.height);
 		      tab_max = MAX (tab_max, page->requisition.width);
 		      break;
 		    case GTK_POS_LEFT:
 		    case GTK_POS_RIGHT:
-		      page->requisition.width += 2 * (notebook->tab_hborder +
+		      page->requisition.width += 2 * (gtk_widget_size_to_pixel (notebook, priv->tab_hborder_unit) +
 						      focus_width);
 		      tab_width = MAX (tab_width, page->requisition.width);
 		      tab_max = MAX (tab_max, page->requisition.height);
@@ -1920,7 +1914,7 @@ gtk_notebook_size_request (GtkWidget      *widget,
 		    tab_height = MAX (tab_height, scroll_arrow_hlength);
 
 		  padding = 2 * (tab_curvature + focus_width +
-				 notebook->tab_hborder) - tab_overlap;
+				 gtk_widget_size_to_pixel (notebook, priv->tab_hborder_unit)) - tab_overlap;
 		  tab_max += padding;
 		  while (children)
 		    {
@@ -1964,7 +1958,7 @@ gtk_notebook_size_request (GtkWidget      *widget,
                                      arrow_spacing + 2 * scroll_arrow_vlength);
 
 		  padding = 2 * (tab_curvature + focus_width +
-				 notebook->tab_vborder) - tab_overlap;
+				 gtk_widget_size_to_pixel (notebook, priv->tab_vborder_unit)) - tab_overlap;
 		  tab_max += padding;
 
 		  while (children)
@@ -5557,6 +5551,7 @@ gtk_notebook_page_allocate (GtkNotebook     *notebook,
 			    GtkNotebookPage *page)
 {
   GtkWidget *widget = GTK_WIDGET (notebook);
+  GtkNotebookPrivate *priv = GTK_NOTEBOOK_GET_PRIVATE (notebook);
   GtkAllocation child_allocation;
   GtkRequisition tab_requisition;
   gint xthickness;
@@ -5588,10 +5583,10 @@ gtk_notebook_page_allocate (GtkNotebook     *notebook,
     {
     case GTK_POS_TOP:
     case GTK_POS_BOTTOM:
-      padding = tab_curvature + focus_width + notebook->tab_hborder;
+      padding = tab_curvature + focus_width + gtk_widget_size_to_pixel (notebook, priv->tab_hborder_unit);
       if (page->fill)
 	{
-	  child_allocation.x = xthickness + focus_width + notebook->tab_hborder;
+	  child_allocation.x = xthickness + focus_width + gtk_widget_size_to_pixel (notebook, priv->tab_hborder_unit);
 	  child_allocation.width = MAX (1, page->allocation.width - 2 * child_allocation.x);
 	  child_allocation.x += page->allocation.x;
 	}
@@ -5603,17 +5598,17 @@ gtk_notebook_page_allocate (GtkNotebook     *notebook,
 	  child_allocation.width = tab_requisition.width;
 	}
 
-      child_allocation.y = notebook->tab_vborder + focus_width + page->allocation.y;
+      child_allocation.y = gtk_widget_size_to_pixel (notebook, priv->tab_vborder_unit) + focus_width + page->allocation.y;
 
       if (tab_pos == GTK_POS_TOP)
 	child_allocation.y += ythickness;
 
       child_allocation.height = MAX (1, (page->allocation.height - ythickness -
-					 2 * (notebook->tab_vborder + focus_width)));
+					 2 * (gtk_widget_size_to_pixel (notebook, priv->tab_vborder_unit) + focus_width)));
       break;
     case GTK_POS_LEFT:
     case GTK_POS_RIGHT:
-      padding = tab_curvature + focus_width + notebook->tab_vborder;
+      padding = tab_curvature + focus_width + gtk_widget_size_to_pixel (notebook, priv->tab_vborder_unit);
       if (page->fill)
 	{
 	  child_allocation.y = ythickness + padding;
@@ -5629,13 +5624,13 @@ gtk_notebook_page_allocate (GtkNotebook     *notebook,
 	  child_allocation.height = tab_requisition.height;
 	}
 
-      child_allocation.x = notebook->tab_hborder + focus_width + page->allocation.x;
+      child_allocation.x = gtk_widget_size_to_pixel (notebook, priv->tab_hborder_unit) + focus_width + page->allocation.x;
 
       if (tab_pos == GTK_POS_LEFT)
 	child_allocation.x += xthickness;
 
       child_allocation.width = MAX (1, (page->allocation.width - xthickness -
-					2 * (notebook->tab_hborder + focus_width)));
+					2 * (gtk_widget_size_to_pixel (notebook, priv->tab_hborder_unit) + focus_width)));
       break;
     }
 
@@ -6023,10 +6018,14 @@ gtk_notebook_set_homogeneous_tabs_internal (GtkNotebook *notebook,
 
 static void
 gtk_notebook_set_tab_border_internal (GtkNotebook *notebook,
-				      guint        border_width)
+				      GtkUSize     border_width)
 {
-  notebook->tab_hborder = border_width;
-  notebook->tab_vborder = border_width;
+  GtkNotebookPrivate *priv = GTK_NOTEBOOK_GET_PRIVATE (notebook);
+
+  notebook->tab_hborder = gtk_widget_size_to_pixel (notebook, border_width);
+  notebook->tab_vborder = gtk_widget_size_to_pixel (notebook, border_width);
+  priv->tab_hborder_unit = border_width;
+  priv->tab_vborder_unit = border_width;
 
   if (GTK_WIDGET_VISIBLE (notebook) && notebook->show_tabs)
     gtk_widget_queue_resize (GTK_WIDGET (notebook));
@@ -6039,12 +6038,15 @@ gtk_notebook_set_tab_border_internal (GtkNotebook *notebook,
 
 static void
 gtk_notebook_set_tab_hborder_internal (GtkNotebook *notebook,
-				       guint        tab_hborder)
+				       GtkUSize     tab_hborder)
 {
-  if (notebook->tab_hborder == tab_hborder)
+  GtkNotebookPrivate *priv = GTK_NOTEBOOK_GET_PRIVATE (notebook);
+
+  if (priv->tab_hborder_unit == tab_hborder)
     return;
 
-  notebook->tab_hborder = tab_hborder;
+  notebook->tab_hborder = gtk_widget_size_to_pixel (notebook, tab_hborder);
+  priv->tab_hborder_unit = tab_hborder;
 
   if (GTK_WIDGET_VISIBLE (notebook) && notebook->show_tabs)
     gtk_widget_queue_resize (GTK_WIDGET (notebook));
@@ -6054,12 +6056,15 @@ gtk_notebook_set_tab_hborder_internal (GtkNotebook *notebook,
 
 static void
 gtk_notebook_set_tab_vborder_internal (GtkNotebook *notebook,
-				       guint        tab_vborder)
+				       GtkUSize     tab_vborder)
 {
-  if (notebook->tab_vborder == tab_vborder)
+  GtkNotebookPrivate *priv = GTK_NOTEBOOK_GET_PRIVATE (notebook);
+
+  if (priv->tab_vborder_unit == tab_vborder)
     return;
 
-  notebook->tab_vborder = tab_vborder;
+  notebook->tab_vborder = gtk_widget_size_to_pixel (notebook, tab_vborder);
+  priv->tab_vborder_unit = tab_vborder;
 
   if (GTK_WIDGET_VISIBLE (notebook) && notebook->show_tabs)
     gtk_widget_queue_resize (GTK_WIDGET (notebook));
@@ -6704,7 +6709,7 @@ gtk_notebook_set_homogeneous_tabs (GtkNotebook *notebook,
  **/
 void
 gtk_notebook_set_tab_border (GtkNotebook *notebook,
-			     guint        border_width)
+			     GtkUSize     border_width)
 {
   g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
 
@@ -6720,7 +6725,7 @@ gtk_notebook_set_tab_border (GtkNotebook *notebook,
  **/
 void
 gtk_notebook_set_tab_hborder (GtkNotebook *notebook,
-			      guint        tab_hborder)
+			      GtkUSize     tab_hborder)
 {
   g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
 
@@ -6736,7 +6741,7 @@ gtk_notebook_set_tab_hborder (GtkNotebook *notebook,
  **/
 void
 gtk_notebook_set_tab_vborder (GtkNotebook *notebook,
-			      guint        tab_vborder)
+			      GtkUSize     tab_vborder)
 {
   g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
 
diff --git a/gtk/gtknotebook.h b/gtk/gtknotebook.h
index 0659cc9..4e7f670 100644
--- a/gtk/gtknotebook.h
+++ b/gtk/gtknotebook.h
@@ -219,11 +219,11 @@ GtkPositionType gtk_notebook_get_tab_pos   (GtkNotebook     *notebook);
 void     gtk_notebook_set_homogeneous_tabs (GtkNotebook     *notebook,
 					    gboolean         homogeneous);
 void     gtk_notebook_set_tab_border       (GtkNotebook     *notebook,
-					    guint            border_width);
+					    GtkUSize         border_width);
 void     gtk_notebook_set_tab_hborder      (GtkNotebook     *notebook,
-					    guint            tab_hborder);
+					    GtkUSize         tab_hborder);
 void     gtk_notebook_set_tab_vborder      (GtkNotebook     *notebook,
-					    guint            tab_vborder);
+					    GtkUSize         tab_vborder);
 #endif /* GTK_DISABLE_DEPRECATED */
 
 void     gtk_notebook_set_scrollable       (GtkNotebook     *notebook,
diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c
index 64b0429..22226fd 100644
--- a/gtk/gtkpaned.c
+++ b/gtk/gtkpaned.c
@@ -254,13 +254,11 @@ gtk_paned_class_init (GtkPanedClass *class)
 							 GTK_PARAM_READWRITE));
 
   gtk_widget_class_install_style_property (widget_class,
-					   g_param_spec_int ("handle-size",
-							     P_("Handle Size"),
-							     P_("Width of handle"),
-							     0,
-							     G_MAXINT,
-							     5,
-							     GTK_PARAM_READABLE));
+					   gtk_param_spec_size ("handle-size",
+                                                                P_("Handle Size"),
+                                                                P_("Width of handle"),
+                                                                0, G_MAXINT, GTK_SIZE_ONE_TWELFTH_EM (5),
+                                                                GTK_PARAM_READABLE));
   /**
    * GtkPaned:min-position:
    *



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]