Index: gtkentry.c
===================================================================
--- gtkentry.c	(revision 22335)
+++ gtkentry.c	(working copy)
@@ -1198,6 +1198,20 @@ gtk_entry_class_init (GtkEntryClass *cla
                                                                  P_("Whether activatable icons should prelight when hovered"),
                                                                  TRUE,
                                                                  GTK_PARAM_READABLE));
+
+  /**
+   * GtkEntry::progress-border:
+   *
+   * The border around the progress bar in the entry.
+   *
+   * Since: 2.16
+   */
+  gtk_widget_class_install_style_property (widget_class,
+					   g_param_spec_boxed ("progress-border",
+                                                               P_("Progress Border"),
+                                                               P_("Border around the progress bar"),
+                                                               GTK_TYPE_BORDER,
+                                                               GTK_PARAM_READABLE));
   
   /**
    * GtkEntry::populate-popup:
@@ -3150,47 +3164,92 @@ gtk_entry_draw_frame (GtkWidget    *widg
 }
 
 static void
+gtk_entry_get_progress_border (GtkWidget *widget,
+                               GtkBorder *progress_border)
+{
+  GtkBorder *tmp_border;
+
+  gtk_widget_style_get (widget, "progress-border", &tmp_border, NULL);
+  if (tmp_border)
+    {
+      *progress_border = *tmp_border;
+      gtk_border_free (tmp_border);
+    }
+  else
+    {
+      progress_border->left = widget->style->xthickness;
+      progress_border->right = widget->style->xthickness;
+      progress_border->top = widget->style->ythickness;
+      progress_border->bottom = widget->style->ythickness;
+    }
+}
+
+static void
 gtk_entry_draw_progress (GtkWidget      *widget,
                          GdkEventExpose *event)
 {
   GtkEntryPrivate *private = GTK_ENTRY_GET_PRIVATE (widget);
   GtkEntry *entry = GTK_ENTRY (widget);
+  GtkBorder progress_border;
+  gint x, y, width, height;
+
+  gtk_entry_get_progress_border (widget, &progress_border);
+
+  x = progress_border.left;
+  y = progress_border.top;
+
+  if (event->window != widget->window)
+    {
+      gint pos_x, pos_y;
+
+      gdk_window_get_position (event->window, &pos_x, &pos_y);
+
+      x -= pos_x;
+      y -= pos_y;
+    }
+
+  gdk_drawable_get_size (widget->window, &width, &height);
+
+  width -= progress_border.left + progress_border.right;
+  height -= progress_border.top + progress_border.bottom;
+
+  if (GTK_WIDGET_HAS_FOCUS (widget) && !private->interior_focus)
+    {
+      x += private->focus_width;
+      y += private->focus_width;
+      width -= 2 * private->focus_width;
+      height -= 2 * private->focus_width;
+    }
 
   if (private->progress_pulse_mode)
     {
       gdouble value = private->progress_pulse_current;
-      gint    area_width, area_height;
-
-      gdk_drawable_get_size (entry->text_area, &area_width, &area_height);
 
-      gtk_paint_box (widget->style, entry->text_area,
+      gtk_paint_box (widget->style, event->window,
                      GTK_STATE_SELECTED, GTK_SHADOW_OUT,
                      &event->area, widget, "entry-progress",
-                     value * area_width, 0,
-                     private->progress_pulse_fraction * area_width, area_height);
+                     x + lrint (value * width), y,
+                     lrint (private->progress_pulse_fraction * width), height);
     }
   else if (private->progress_fraction > 0)
     {
       gdouble value = private->progress_fraction;
-      gint    area_width, area_height;
-
-      gdk_drawable_get_size (entry->text_area, &area_width, &area_height);
 
       if (gtk_widget_get_direction (GTK_WIDGET (entry)) == GTK_TEXT_DIR_RTL)
         {
-          gtk_paint_box (widget->style, entry->text_area,
+          gtk_paint_box (widget->style, event->window,
                          GTK_STATE_SELECTED, GTK_SHADOW_OUT,
                          &event->area, widget, "entry-progress",
-                         area_width - value * area_width, 0,
-                         value * area_width, area_height);
+                         x + lrint (width - value * width), y,
+                         lrint (value * width), height);
         }
       else
         {
-          gtk_paint_box (widget->style, entry->text_area,
+          gtk_paint_box (widget->style, event->window,
                          GTK_STATE_SELECTED, GTK_SHADOW_OUT,
                          &event->area, widget, "entry-progress",
-                         0, 0,
-                         value * area_width, area_height);
+                         x, y,
+                         lrint (value * width), height);
         }
     }
 }
@@ -3214,6 +3273,8 @@ gtk_entry_expose (GtkWidget      *widget
   if (widget->window == event->window)
     {
       gtk_entry_draw_frame (widget, &event->area);
+
+      gtk_entry_draw_progress (widget, event);
     }
   else if (entry->text_area == event->window)
     {
@@ -3251,12 +3312,12 @@ gtk_entry_expose (GtkWidget      *widget
               gint width, height;
 
               gdk_drawable_get_size (icon_info->window, &width, &height);
-
               gtk_paint_flat_box (widget->style, icon_info->window,
                                   GTK_WIDGET_STATE (widget), GTK_SHADOW_NONE,
                                   NULL, widget, "entry_bg",
                                   0, 0, width, height);
 
+              gtk_entry_draw_progress (widget, event);
               draw_icon (widget, i);
 
               break;
@@ -9451,7 +9512,7 @@ gtk_entry_set_progress_fraction (GtkEntr
   private->progress_pulse_current = 0.0;
 
   if (fabs (fraction - old_fraction) > 0.0001)
-    gtk_entry_queue_draw (entry);
+    gtk_widget_queue_draw (entry);
 
   if (fraction != old_fraction)
     g_object_notify (G_OBJECT (entry), "progress-fraction");
@@ -9506,7 +9567,7 @@ gtk_entry_set_progress_pulse_step (GtkEn
     {
       private->progress_pulse_fraction = fraction;
 
-      gtk_entry_queue_draw (entry);
+      gtk_widget_queue_draw (entry);
 
       g_object_notify (G_OBJECT (entry), "progress-pulse-step");
     }
@@ -9587,7 +9648,7 @@ gtk_entry_progress_pulse (GtkEntry *entr
       private->progress_pulse_current = 0.0;
     }
 
-  gtk_entry_queue_draw (entry);
+  gtk_widget_queue_draw (entry);
 }
 
 /* Caps Lock warning for password entries */
