diff --git a/gtk/gtkprogressbar.c b/gtk/gtkprogressbar.c
index 96b3167..ad71a9f 100644
--- a/gtk/gtkprogressbar.c
+++ b/gtk/gtkprogressbar.c
@@ -437,7 +437,7 @@ gtk_progress_bar_real_update (GtkProgress *progress)
 	    {
               /* Update our activity step. */
               
-              pbar->activity_step = widget->allocation.width * pbar->pulse_fraction;
+              pbar->activity_step = MAX (1, widget->allocation.width * pbar->pulse_fraction);
               
 	      size = MAX (2, widget->allocation.width / pbar->activity_blocks);
 
@@ -467,7 +467,7 @@ gtk_progress_bar_real_update (GtkProgress *progress)
 	    {
               /* Update our activity step. */
               
-              pbar->activity_step = widget->allocation.height * pbar->pulse_fraction;
+              pbar->activity_step = MAX (1, widget->allocation.height * pbar->pulse_fraction);
               
 	      size = MAX (2, widget->allocation.height / pbar->activity_blocks);
 
@@ -493,8 +493,8 @@ gtk_progress_bar_real_update (GtkProgress *progress)
 		    }
 		}
 	    }
+	  pbar->dirty = TRUE;
 	}
-      pbar->dirty = TRUE;
       gtk_widget_queue_draw (GTK_WIDGET (progress));
     }
   else
@@ -1110,9 +1110,39 @@ gtk_progress_bar_set_fraction (GtkProgressBar *pbar,
 {
   g_return_if_fail (GTK_IS_PROGRESS_BAR (pbar));
 
+  guint space;
+  guint old_amount;
+  guint new_amount;
+  GtkWidget *widget;
+
+  widget = GTK_WIDGET (pbar);
+
   /* If we know the percentage, we don't want activity mode. */
   gtk_progress_set_activity_mode (GTK_PROGRESS (pbar), FALSE);
-  
+
+  /* Before setting the new percentage and causing a redraw, we
+   * check if the difference between the old percentage and the
+   * new one is big enough to cause a redraw in continuous mode,
+   * and set the flag dirty if needed
+   */
+  if (pbar->bar_style == GTK_PROGRESS_CONTINUOUS)
+    {
+      /* We calculate the amount value for the two percentages. If they
+       * are different, then a redraw is needed
+       */
+      if (pbar->orientation == GTK_PROGRESS_LEFT_TO_RIGHT ||
+          pbar->orientation == GTK_PROGRESS_RIGHT_TO_LEFT)
+        space = widget->allocation.width - 2 * widget->style->xthickness;
+      else
+        space = widget->allocation.height - 2 * widget->style->ythickness;
+
+      old_amount = space * gtk_progress_get_current_percentage (GTK_PROGRESS (pbar));
+      new_amount = space * fraction;
+
+      if (old_amount != new_amount)
+        pbar->dirty = TRUE;
+    }
+
   /* We use the deprecated GtkProgress interface internally.
    * Once everything's been deprecated for a good long time,
    * we can clean up all this code.
