Index: src/constraints.c
===================================================================
RCS file: /cvs/gnome/metacity/src/constraints.c,v
retrieving revision 1.13
diff -p -u -r1.13 constraints.c
--- src/constraints.c	28 Jul 2003 02:09:19 -0000	1.13
+++ src/constraints.c	30 Jul 2003 06:12:15 -0000
@@ -114,6 +114,7 @@
 typedef struct
 {
   MetaWindow *window;
+  MetaRectangle proposed_rect;
   MetaFrameGeometry fgeom;
   const MetaXineramaScreenInfo *xinerama;
   MetaRectangle work_area_xinerama;
@@ -360,6 +361,7 @@ get_outermost_onscreen_positions (MetaWi
   GList *tmp;
   GSList *stmp;
   MetaRectangle current;
+  int bottom = 0xffff;
 
   /* to handle struts, we get the list of workspaces for the window
    * and traverse all the struts in each of the cached strut lists for
@@ -465,9 +467,9 @@ get_outermost_onscreen_positions (MetaWi
     }
 
   tmp = workspaces;
-  if (bottommost_y)
+  if (bottommost_y || topmost_y)
     {
-      *bottommost_y = info->se_y;
+      bottom = info->se_y;
       while (tmp)
         {
           stmp = ((MetaWorkspace*) tmp->data)->bottom_struts;
@@ -480,7 +482,7 @@ get_outermost_onscreen_positions (MetaWi
 	      if ((current.x <= rect->x + rect->width) &&
 		  (current.x + current.width >= rect->x))
                 {
-                  *bottommost_y = MIN (*bottommost_y, rect->y);
+                  bottom = MIN (bottom, rect->y);
                 }
               
               stmp = stmp->next;
@@ -493,9 +495,49 @@ get_outermost_onscreen_positions (MetaWi
        * screen.
        */
       if (!window->frame)
-        *bottommost_y = *bottommost_y -
+        bottom = bottom -
           MIN (TITLEBAR_LENGTH_ONSCREEN, current.height);
     }
+
+  if (bottommost_y)
+    {
+      *bottommost_y = bottom;
+    }
+
+  /* if the window has a minimum size too big for the "effective" work
+   * area let it "cheat" a little by allowing a user to move it up so
+   * that you can see the bottom of the window.
+   */
+  if (topmost_y)
+    {
+      int minheight;
+      
+      if (window->has_resize_func &&
+          !window->mwm_has_resize_func)
+        {
+          /* broken applications that set an mwm hint but not
+           * WM_NORMAL_HINTS resize hint
+           */
+          minheight = info->proposed_rect.height;
+        }
+      else
+        {
+          /* this is the "normal" case of, e.g. a dialog that's
+           * just too big for the work area
+           */
+          minheight = window->size_hints.min_height;
+        }
+
+      if (window->frame)
+        {
+          minheight += window->frame->bottom_height;
+        }
+      
+      if (minheight > (bottom - *topmost_y))
+        {
+          *topmost_y = bottom - minheight;
+        }
+    }
 }
 
 static void
@@ -1261,6 +1303,11 @@ meta_window_constrain (MetaWindow       
   info.window = window;
   info.xinerama = meta_screen_get_xinerama_for_window (window->screen,
                                                        window);
+  info.proposed_rect = *orig;
+  info.proposed_rect.x += x_move_delta;
+  info.proposed_rect.y += y_move_delta;
+  info.proposed_rect.width += x_delta;
+  info.proposed_rect.height += y_delta;
 
   /* Init info->nw_x etc. */
   update_position_limits (window, &info);
