Binary files gtk+_backup/examples/alignment_padding/alignment_padding and gtk+/examples/alignment_padding/alignment_padding differ
diff -up -N --recursive gtk+_backup/examples/alignment_padding/alignment_padding.c gtk+/examples/alignment_padding/alignment_padding.c
--- gtk+_backup/examples/alignment_padding/alignment_padding.c	1970-01-01 01:00:00.000000000 +0100
+++ gtk+/examples/alignment_padding/alignment_padding.c	2003-04-08 22:22:58.000000000 +0200
@@ -0,0 +1,128 @@
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <gtk/gtk.h>
+
+GtkWidget *alignment = 0;
+GtkWidget *entry_padding_top = 0;
+GtkWidget *entry_padding_bottom = 0;
+GtkWidget *entry_padding_left = 0;
+GtkWidget *entry_padding_right = 0;
+    
+void callback_entry_changed( GtkWidget *widget,
+                     GtkWidget *entry)
+{
+  GtkPositionType pos = GTK_POS_TOP;
+  const gchar *entry_text = 0;
+  guint entry_number = 0;
+
+  /* Get the position that has changed:
+   * This is quite hacky - we should really use a pointer to a
+   * custom struct in the callback's data parameter.
+   */
+  if (entry == entry_padding_top)
+    pos = GTK_POS_TOP;
+  else if (entry == entry_padding_bottom)
+    pos = GTK_POS_BOTTOM;
+  else if (entry == entry_padding_left)
+    pos = GTK_POS_LEFT;
+  else if (entry == entry_padding_right)
+    pos = GTK_POS_RIGHT;
+
+  /* Get the new value: */
+  entry_text = gtk_entry_get_text (GTK_ENTRY (entry));
+  entry_number = atoi (entry_text);
+
+  /* Set the appropriate aligment padding: */
+  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), pos, entry_number);
+}
+
+int main( int   argc,
+          char *argv[] )
+{
+
+    GtkWidget *window = 0;
+
+    /* The arrangement of the child widgets looks horrible - a real app would use libglade. */
+    GtkWidget *vbox = 0;
+    GtkWidget *table_padding = 0;
+
+    GtkWidget *frame = 0;
+    GtkWidget *entry_inner = 0;
+
+    gtk_init (&argc, &argv);
+
+    /* create a new window */
+    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+    gtk_widget_set_size_request (GTK_WIDGET (window), 200, 300);
+    gtk_window_set_title (GTK_WINDOW (window), "GTK+ Alignment Padding example");
+    g_signal_connect (G_OBJECT (window), "destroy",
+                      G_CALLBACK (gtk_main_quit), NULL);
+    g_signal_connect_swapped (G_OBJECT (window), "delete_event",
+                              G_CALLBACK (gtk_widget_destroy), 
+                              G_OBJECT (window));
+
+    vbox = gtk_vbox_new (FALSE, 0);
+    gtk_container_add (GTK_CONTAINER (window), vbox);
+    gtk_widget_show (vbox);
+
+    /* Add a table, with 4 labels and entries: */
+    table_padding = GTK_WIDGET( gtk_table_new (2, 4, TRUE) );
+    /* The frame (below) will expand, but not the table of entries: */
+    gtk_box_pack_start (GTK_BOX (vbox), table_padding, FALSE, FALSE, 0);
+
+    /* Fill the table: */
+    entry_padding_top = gtk_entry_new ();
+    entry_padding_bottom = gtk_entry_new ();
+    entry_padding_left = gtk_entry_new ();
+    entry_padding_right = gtk_entry_new ();
+
+    gtk_table_attach_defaults (GTK_TABLE (table_padding), gtk_label_new ("Top"), 0, 1, 0, 1);
+    gtk_table_attach_defaults (GTK_TABLE (table_padding), entry_padding_top, 1, 2, 0, 1);
+
+    gtk_table_attach_defaults (GTK_TABLE (table_padding), gtk_label_new ("Bottom"), 0, 1, 1, 2);
+    gtk_table_attach_defaults (GTK_TABLE (table_padding), entry_padding_bottom, 1, 2, 1, 2);
+
+    gtk_table_attach_defaults (GTK_TABLE (table_padding), gtk_label_new ("Left"), 0, 1, 2, 3); 
+    gtk_table_attach_defaults (GTK_TABLE (table_padding), entry_padding_left, 1, 2, 2, 3);
+
+    gtk_table_attach_defaults (GTK_TABLE (table_padding), gtk_label_new ("Right"), 0, 1, 3, 4);
+    gtk_table_attach_defaults (GTK_TABLE (table_padding), entry_padding_right, 1, 2, 3, 4);
+    gtk_widget_show_all (table_padding);
+
+    /* Connect signals for the entries: */
+    g_signal_connect (G_OBJECT (entry_padding_top), "changed",
+      G_CALLBACK (callback_entry_changed),
+      (gpointer) entry_padding_top);
+    g_signal_connect (G_OBJECT (entry_padding_bottom), "changed",
+      G_CALLBACK (callback_entry_changed),
+      (gpointer) entry_padding_bottom);
+    g_signal_connect (G_OBJECT (entry_padding_left), "changed",
+      G_CALLBACK (callback_entry_changed),
+      (gpointer) entry_padding_left);
+    g_signal_connect (G_OBJECT (entry_padding_right), "changed",
+      G_CALLBACK (callback_entry_changed),
+      (gpointer) entry_padding_right);
+
+    /* Add a frame below the table of entries, to show the aligment's padding: */
+    frame = gtk_frame_new ("Frame");
+    gtk_box_pack_start_defaults (GTK_BOX (vbox), frame);
+
+    /* Put an alignment inside the frame
+     * and put an entry inside the frame to show the padding:
+     */
+    alignment = gtk_alignment_new (0.5, 0.5, 1.0, 1.0);
+    gtk_container_add (GTK_CONTAINER (frame), alignment);
+    
+    entry_inner = gtk_text_view_new ();
+    gtk_container_add (GTK_CONTAINER (alignment), entry_inner);
+
+    gtk_widget_show_all (frame);
+
+    
+    gtk_widget_show (window);
+
+    gtk_main();
+
+    return 0;
+}
Binary files gtk+_backup/examples/entry/entry and gtk+/examples/entry/entry differ
Binary files gtk+_backup/examples/pixmap/pixmap and gtk+/examples/pixmap/pixmap differ
diff -up -N --recursive gtk+_backup/gtk/gtkalignment.c gtk+/gtk/gtkalignment.c
--- gtk+_backup/gtk/gtkalignment.c	2003-04-04 21:17:52.000000000 +0200
+++ gtk+/gtk/gtkalignment.c	2003-04-08 22:41:22.000000000 +0200
@@ -34,6 +34,12 @@ enum {
   PROP_YALIGN,
   PROP_XSCALE,
   PROP_YSCALE,
+
+  /* The Padding could almost be in a separate widget, but it's loosely related to alignment. */
+  PROP_PADDING_TOP,
+  PROP_PADDING_BOTTOM,
+  PROP_PADDING_LEFT,
+  PROP_PADDING_RIGHT,
   
   PROP_LAST
 };
@@ -133,6 +139,49 @@ gtk_alignment_class_init (GtkAlignmentCl
                                                       1.0,
                                                       1.0,
                                                       G_PARAM_READABLE | G_PARAM_WRITABLE));
+
+
+  /* Padding properties: */
+  g_object_class_install_property (gobject_class,
+                                   PROP_PADDING_TOP,
+                                   g_param_spec_uint("padding_top",
+                                                      _("Top padding"),
+                                                      _("The padding to insert at the top of the widget."),
+                                                      0,
+                                                      G_MAXINT,
+                                                      0,
+                                                      G_PARAM_READABLE | G_PARAM_WRITABLE));
+
+  g_object_class_install_property (gobject_class,
+                                   PROP_PADDING_BOTTOM,
+                                   g_param_spec_uint("padding_bottom",
+                                                      _("Bottom padding"),
+                                                      _("The padding to insert at the bottom of the widget."),
+                                                      0,
+                                                      G_MAXINT,
+                                                      0,
+                                                      G_PARAM_READABLE | G_PARAM_WRITABLE));
+
+  g_object_class_install_property (gobject_class,
+                                   PROP_PADDING_LEFT,
+                                   g_param_spec_uint("padding_left",
+                                                      _("Left padding"),
+                                                      _("The padding to insert at the left of the widget."),
+                                                      0,
+                                                      G_MAXINT,
+                                                      0,
+                                                      G_PARAM_READABLE | G_PARAM_WRITABLE));
+
+  g_object_class_install_property (gobject_class,
+                                   PROP_PADDING_RIGHT,
+                                   g_param_spec_uint("padding_right",
+                                                      _("Right padding"),
+                                                      _("The padding to insert at the right of the widget."),
+                                                      0,
+                                                      G_MAXINT,
+                                                      0,
+                                                      G_PARAM_READABLE | G_PARAM_WRITABLE));
+  
 }
 
 static void
@@ -145,6 +194,12 @@ gtk_alignment_init (GtkAlignment *alignm
   alignment->yalign = 0.5;
   alignment->xscale = 1.0;
   alignment->yscale = 1.0;
+
+  /* Intialize padding with default values: */
+  alignment->padding_top = 0;
+  alignment->padding_bottom = 0;
+  alignment->padding_left = 0;
+  alignment->padding_right = 0;
 }
 
 GtkWidget*
@@ -205,6 +260,21 @@ gtk_alignment_set_property (GObject     
 			 alignment->xscale,
 			 g_value_get_float (value));
       break;
+      
+    /* Padding. Call gtk_alignment_set_padding() with the appropriate GTK_POS_* value: */
+    case PROP_PADDING_TOP:
+      gtk_alignment_set_padding (alignment, GTK_POS_TOP, g_value_get_uint (value));
+      break;
+    case PROP_PADDING_BOTTOM:
+      gtk_alignment_set_padding (alignment, GTK_POS_BOTTOM, g_value_get_uint (value));
+      break;
+    case PROP_PADDING_LEFT:
+      gtk_alignment_set_padding (alignment, GTK_POS_LEFT, g_value_get_uint (value));
+      break;
+    case PROP_PADDING_RIGHT:
+      gtk_alignment_set_padding (alignment, GTK_POS_RIGHT, g_value_get_uint (value));
+      break;
+    
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -235,6 +305,21 @@ gtk_alignment_get_property (GObject     
     case PROP_YSCALE:
       g_value_set_float(value, alignment->yscale);
       break;
+
+    /* Padding. Call gtk_alignment_get_padding() with the appropriate GTK_POS_* value: */
+    case PROP_PADDING_TOP:
+      g_value_set_uint (value, gtk_alignment_get_padding (alignment, GTK_POS_TOP));
+      break;
+    case PROP_PADDING_BOTTOM:
+      g_value_set_uint (value, gtk_alignment_get_padding (alignment, GTK_POS_BOTTOM));
+      break;
+    case PROP_PADDING_LEFT:
+      g_value_set_uint (value, gtk_alignment_get_padding (alignment, GTK_POS_LEFT));
+      break;
+    case PROP_PADDING_RIGHT:
+      g_value_set_uint (value, gtk_alignment_get_padding (alignment, GTK_POS_RIGHT));
+      break;
+      
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -311,6 +396,10 @@ gtk_alignment_size_request (GtkWidget   
 
       requisition->width += child_requisition.width;
       requisition->height += child_requisition.height;
+
+      /* Request extra space for the padding: */
+      requisition->width += (alignment->padding_left + alignment->padding_right);
+      requisition->height += (alignment->padding_top + alignment->padding_bottom);
     }
 }
 
@@ -324,6 +413,10 @@ gtk_alignment_size_allocate (GtkWidget  
   GtkRequisition child_requisition;
   gint width, height;
   gint x, y;
+  guint padding_horizontal, padding_vertical;
+
+  padding_horizontal = 0;
+  padding_vertical = 0;
 
   widget->allocation = *allocation;
   alignment = GTK_ALIGNMENT (widget);
@@ -332,12 +425,18 @@ gtk_alignment_size_allocate (GtkWidget  
   if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
     {
       gtk_widget_get_child_requisition (bin->child, &child_requisition);
-      
+
+      /* TODO: Rename x and y to border_x and border_y? murrayc */
       x = GTK_CONTAINER (alignment)->border_width;
       y = GTK_CONTAINER (alignment)->border_width;
-      width = MAX (allocation->width - 2 * x, 0);
-      height = MAX (allocation->height - 2 * y, 0);
-      
+
+      padding_horizontal = alignment->padding_left + alignment->padding_right;
+      padding_vertical = alignment->padding_top + alignment->padding_bottom;
+
+      /* 2*x because there are 2 borders - 1 on each side: */
+      width = MAX (allocation->width - padding_horizontal - 2 * x, 0);
+      height = MAX (allocation->height - padding_vertical - 2 * y, 0);
+    
       if (width > child_requisition.width)
 	child_allocation.width = (child_requisition.width *
 				  (1.0 - alignment->xscale) +
@@ -352,9 +451,72 @@ gtk_alignment_size_allocate (GtkWidget  
       else
 	child_allocation.height = height;
 
-      child_allocation.x = alignment->xalign * (width - child_allocation.width) + allocation->x + x;
-      child_allocation.y = alignment->yalign * (height - child_allocation.height) + allocation->y + y;
+      child_allocation.x = alignment->xalign * (width - child_allocation.width) + allocation->x + x + alignment->padding_left;
+      child_allocation.y = alignment->yalign * (height - child_allocation.height) + allocation->y + y + alignment->padding_top;;
 
       gtk_widget_size_allocate (bin->child, &child_allocation);
     }
 }
+
+void
+gtk_alignment_set_padding (GtkAlignment    *alignment,
+			   GtkPositionType  pad_pos,
+			   guint            padding)
+{
+  g_return_if_fail (GTK_IS_ALIGNMENT (alignment));
+
+  g_object_freeze_notify (G_OBJECT (alignment));
+
+  /* Set the appropriate struct field, depending on the padding position: */
+  switch (pad_pos)
+  {
+  case GTK_POS_TOP:
+    alignment->padding_top = padding;
+    break;
+  case GTK_POS_BOTTOM:
+    alignment->padding_bottom = padding;
+    break;
+  case GTK_POS_LEFT:
+    alignment->padding_left = padding;
+    break;
+  case GTK_POS_RIGHT:
+    alignment->padding_right = padding;
+    break;
+  }
+
+  g_object_thaw_notify (G_OBJECT (alignment));
+
+  /* Make sure that the widget and children are redrawn with the new setting: */
+  if (GTK_BIN (alignment)->child)
+    gtk_widget_queue_resize (GTK_BIN (alignment)->child);
+
+  gtk_widget_queue_draw (GTK_WIDGET (alignment));
+}
+
+guint
+gtk_alignment_get_padding (GtkAlignment    *alignment,
+			   GtkPositionType  pad_pos)
+{
+  g_return_val_if_fail (GTK_IS_ALIGNMENT (alignment), 0);
+
+  /* Get the appropriate struct field, depending on the padding position: */
+  switch (pad_pos)
+  {
+  case GTK_POS_TOP:
+    return alignment->padding_top;
+    break;
+  case GTK_POS_BOTTOM:
+    return alignment->padding_bottom;
+    break;
+  case GTK_POS_LEFT:
+    return alignment->padding_left;
+    break;
+  case GTK_POS_RIGHT:
+    return alignment->padding_right;
+    break;
+  default:
+    g_warning("Unexpected GtkPositionType.");
+    return 0;
+    break;
+ }
+}
diff -up -N --recursive gtk+_backup/gtk/gtkalignment.h gtk+/gtk/gtkalignment.h
--- gtk+_backup/gtk/gtkalignment.h	2003-04-04 21:17:52.000000000 +0200
+++ gtk+/gtk/gtkalignment.h	2003-04-08 20:58:36.000000000 +0200
@@ -56,6 +56,13 @@ struct _GtkAlignment
   gfloat yalign;
   gfloat xscale;
   gfloat yscale;
+
+  /* <private> */
+  /* TODO: Use the new private data system */
+  guint padding_top;
+  guint padding_bottom;
+  guint padding_left;
+  guint padding_right;
 };
 
 struct _GtkAlignmentClass
@@ -75,6 +82,18 @@ void       gtk_alignment_set        (Gtk
 				     gfloat             xscale,
 				     gfloat             yscale);
 
+void       gtk_alignment_set_padding (GtkAlignment      *alignment,
+				      GtkPositionType    pad_pos,
+				      guint              padding);
+
+guint       gtk_alignment_get_padding (GtkAlignment      *alignment,
+				      GtkPositionType    pad_pos);
+
+
+
+
+
+
 
 #ifdef __cplusplus
 }
