diff --git a/app/display/gimpdisplayshell-scale.c b/app/display/gimpdisplayshell-scale.c
index d8d5976..d554d84 100644
--- a/app/display/gimpdisplayshell-scale.c
+++ b/app/display/gimpdisplayshell-scale.c
@@ -377,6 +377,126 @@ gimp_display_shell_get_screen_resolution (GimpDisplayShell *shell,
   if (yres) *yres = y;
 }
 
+static gboolean
+gimp_display_shell_to_resize_window (GimpImageWindow  *window,
+                                   GimpDisplayShell   *shell,
+                                   gboolean           grow_only) 
+{
+  GimpDisplayShell       *active_shell;
+  GimpImage              *image;
+  GtkWidget              *widget;
+  GtkAllocation           allocation;
+  GdkScreen              *screen;
+  GdkRectangle            rect;
+  gint                    monitor;
+  gint                    disp_width, disp_height;
+  gint                    width, height;
+  gint                    max_auto_width, max_auto_height;
+  gint                    border_width, border_height;
+  gboolean                resize = FALSE;
+
+  if (!GIMP_IS_IMAGE_WINDOW (window))
+    return FALSE;
+
+  if (! gtk_widget_get_realized (GTK_WIDGET (window)))
+    return FALSE;
+
+  /* FIXME this so needs cleanup and shell/window separation */
+
+  active_shell = gimp_image_window_get_active_shell (window);
+
+  if (!active_shell)
+    return FALSE;
+  if (shell != active_shell) 
+    return FALSE;
+
+  image = gimp_display_get_image (active_shell->display);
+
+  widget = GTK_WIDGET (window);
+  screen = gtk_widget_get_screen (widget);
+
+  gtk_widget_get_allocation (widget, &allocation);
+
+  monitor = gdk_screen_get_monitor_at_window (screen,
+                                              gtk_widget_get_window (widget));
+  gdk_screen_get_monitor_geometry (screen, monitor, &rect);
+
+  width  = SCALEX (active_shell, gimp_image_get_width  (image));
+  height = SCALEY (active_shell, gimp_image_get_height (image));
+
+  disp_width  = active_shell->disp_width;
+  disp_height = active_shell->disp_height;
+
+
+  /* As long as the disp_width/disp_height is larger than 1 we
+   * can reliably depend on it to calculate the
+   * border_width/border_height because that means there is enough
+   * room in the top-level for the canvas as well as the rulers and
+   * scrollbars. If it is 1 or smaller it is likely that the rulers
+   * and scrollbars are overlapping each other and thus we cannot use
+   * the normal approach to border size, so special case that.
+   */
+  if (disp_width > 1 || !active_shell->vsb)
+    {
+      border_width = allocation.width - disp_width;
+    }
+  else
+    {
+      GtkAllocation vsb_allocation;
+
+      gtk_widget_get_allocation (active_shell->vsb, &vsb_allocation);
+
+      border_width = allocation.width - disp_width + vsb_allocation.width;
+    }
+
+  if (disp_height > 1 || !active_shell->hsb)
+    {
+      border_height = allocation.height - disp_height;
+    }
+  else
+    {
+      GtkAllocation hsb_allocation;
+
+      gtk_widget_get_allocation (active_shell->hsb, &hsb_allocation);
+
+      border_height = allocation.height - disp_height + hsb_allocation.height;
+    }
+
+
+  max_auto_width  = (rect.width  - border_width)  * 0.75;
+  max_auto_height = (rect.height - border_height) * 0.75;
+
+  /* If one of the display dimensions has changed and one of the
+   * dimensions fits inside the screen
+   */
+  if (((width  + border_width)  < rect.width ||
+       (height + border_height) < rect.height) &&
+      (width  != disp_width ||
+       height != disp_height))
+    {
+      width  = ((width  + border_width)  < rect.width)  ? width  : max_auto_width;
+      height = ((height + border_height) < rect.height) ? height : max_auto_height;
+
+      resize = TRUE;
+    }
+
+  /*  If the projected dimension is greater than current, but less than
+   *  3/4 of the screen size, expand automagically
+   */
+  else if ((width  > disp_width ||
+            height > disp_height) &&
+           (disp_width  < max_auto_width ||
+            disp_height < max_auto_height))
+    {
+      width  = MIN (max_auto_width,  width);
+      height = MIN (max_auto_height, height);
+
+      resize = TRUE;
+    }
+  
+  return resize;
+}
+
 /**
  * gimp_display_shell_scale:
  * @shell:     the #GimpDisplayShell
@@ -413,10 +533,11 @@ gimp_display_shell_scale (GimpDisplayShell *shell,
 
   if (! SCALE_EQUALS (real_new_scale, current_scale))
     {
-      if (shell->display->config->resize_windows_on_zoom)
+      GimpImageWindow *window = gimp_display_shell_get_window (shell);
+      
+      if (shell->display->config->resize_windows_on_zoom 
+          && gimp_display_shell_to_resize_window (window, shell, FALSE))
         {
-          GimpImageWindow *window = gimp_display_shell_get_window (shell);
-
           /* If the window is resized on zoom, simply do the zoom and
            * get things rolling
            */
