? autom4te-2.53.cache
? metacity-2.4.21.tar.gz
? metacity-2.5.1.tar.gz
? mychanges
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/metacity/ChangeLog,v
retrieving revision 1.697.2.3
diff -u -p -u -r1.697.2.3 ChangeLog
--- ChangeLog	23 Jul 2003 21:08:27 -0000	1.697.2.3
+++ ChangeLog	2 Aug 2003 16:04:52 -0000
@@ -1,3 +1,17 @@
+2003-08-02  Havoc Pennington  <hp@pobox.com>
+
+	* src/constraints.c:
+	make exceptions in the various onscreen constraints for
+	undecorated windows
+	(constraint_onscreen_bottom_func): this
+	didn't make any sense; there are no constraints on how much you
+	can resize off the bottom
+	(constraint_onscreen_right_func): similarly, you can go as far
+	off to the right as you want
+	(get_outermost_onscreen_positions): allow windows with min 
+	height larger than the screen to be moved off the top, and 
+	with min width larger than the screen to be moved off the left
+
 2003-07-23  Havoc Pennington  <hp@redhat.com>
 
 	* src/window.c (implement_showing): no animation if we are 
Index: src/constraints.c
===================================================================
RCS file: /cvs/gnome/metacity/src/constraints.c,v
retrieving revision 1.12
diff -u -p -u -r1.12 constraints.c
--- src/constraints.c	29 Jun 2003 22:33:28 -0000	1.12
+++ src/constraints.c	2 Aug 2003 16:04:53 -0000
@@ -24,6 +24,7 @@
 #include "window.h"
 #include "workspace.h"
 #include "place.h"
+#include "prefs.h"
 
 /* The way this code works was suggested by Owen Taylor.
  *
@@ -349,18 +350,20 @@ static void
 get_outermost_onscreen_positions (MetaWindow           *window,
                                   const ConstraintInfo *info,
                                   const MetaRectangle  *orig,
-                                  int                  delta_x,
-                                  int                  delta_y,
-                                  int                  *leftmost_x,
-                                  int                  *rightmost_x,
-                                  int                  *topmost_y,
-                                  int                  *bottommost_y)
+                                  int                   delta_x,
+                                  int                   delta_y,
+                                  int                  *leftmost_x_p,
+                                  int                  *rightmost_x_p,
+                                  int                  *topmost_y_p,
+                                  int                  *bottommost_y_p)
 {
   GList *workspaces;
   GList *tmp;
   GSList *stmp;
   MetaRectangle current;
-
+  int bottommost_y;
+  int rightmost_x;
+  
   /* 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
    * the workspaces.  Note that because the workarea has already been
@@ -375,9 +378,9 @@ get_outermost_onscreen_positions (MetaWi
   workspaces = meta_window_get_workspaces (window);
   tmp = workspaces;
 
-  if (leftmost_x)
+  if (leftmost_x_p)
     {
-      *leftmost_x = info->nw_x;
+      *leftmost_x_p = info->nw_x;
       while (tmp)
         {
           stmp = ((MetaWorkspace*) tmp->data)->left_struts;
@@ -392,7 +395,7 @@ get_outermost_onscreen_positions (MetaWi
                   ((current.y >= rect->y) &&
                    (current.y <= rect->y + rect->height)))
                 {
-                  *leftmost_x = MAX (*leftmost_x, rect->width);
+                  *leftmost_x_p = MAX (*leftmost_x_p, rect->width);
                 }
               
               stmp = stmp->next;
@@ -401,14 +404,15 @@ get_outermost_onscreen_positions (MetaWi
           tmp = tmp->next;
         }
       
-      *leftmost_x = *leftmost_x - current.width + 
+      *leftmost_x_p = *leftmost_x_p - current.width + 
         MIN (TITLEBAR_LENGTH_ONSCREEN, current.width);
     }
-  
+
+  rightmost_x = G_MAXUSHORT;
   tmp = workspaces;
-  if (rightmost_x)
+  if (rightmost_x_p || leftmost_x_p)
     {
-      *rightmost_x = info->se_x;
+      rightmost_x = info->se_x;
       while (tmp)
         {
           stmp = ((MetaWorkspace*) tmp->data)->right_struts;
@@ -423,7 +427,7 @@ get_outermost_onscreen_positions (MetaWi
                   ((current.y >= rect->y) &&
                    (current.y <= rect->y + rect->height)))
                 {
-                  *rightmost_x = MIN (*rightmost_x, rect->x);
+                  rightmost_x = MIN (rightmost_x, rect->x);
                 }
               
               stmp = stmp->next;
@@ -432,14 +436,16 @@ get_outermost_onscreen_positions (MetaWi
           tmp = tmp->next;
         }
       
-      *rightmost_x = *rightmost_x - 
-        MIN (TITLEBAR_LENGTH_ONSCREEN, current.width);
+      rightmost_x = rightmost_x - MIN (TITLEBAR_LENGTH_ONSCREEN, current.width);
     }
 
+  if (rightmost_x_p)
+    *rightmost_x_p = rightmost_x;
+  
   tmp = workspaces;
-  if (topmost_y)
+  if (topmost_y_p)
     {
-      *topmost_y = info->nw_y;
+      *topmost_y_p = info->nw_y;
       while (tmp)
         {
           stmp = ((MetaWorkspace*) tmp->data)->top_struts;
@@ -452,7 +458,7 @@ get_outermost_onscreen_positions (MetaWi
 	      if ((current.x <= rect->x + rect->width) &&
 		  (current.x + current.width >= rect->x))
                 {
-                  *topmost_y = MAX (*topmost_y, rect->height);
+                  *topmost_y_p = MAX (*topmost_y_p, rect->height);
                 }
               
               stmp = stmp->next;
@@ -461,13 +467,14 @@ get_outermost_onscreen_positions (MetaWi
           tmp = tmp->next;
         }
       
-      *topmost_y = *topmost_y + info->fgeom.top_height;
+      *topmost_y_p = *topmost_y_p + info->fgeom.top_height;
     }
 
+  bottommost_y = G_MAXUSHORT;
   tmp = workspaces;
-  if (bottommost_y)
+  if (bottommost_y_p || topmost_y_p)
     {
-      *bottommost_y = info->se_y;
+      bottommost_y = info->se_y;
       while (tmp)
         {
           stmp = ((MetaWorkspace*) tmp->data)->bottom_struts;
@@ -480,7 +487,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);
+                  bottommost_y = MIN (bottommost_y, rect->y);
                 }
               
               stmp = stmp->next;
@@ -493,9 +500,41 @@ get_outermost_onscreen_positions (MetaWi
        * screen.
        */
       if (!window->frame)
-        *bottommost_y = *bottommost_y -
+        bottommost_y = bottommost_y -
           MIN (TITLEBAR_LENGTH_ONSCREEN, current.height);
     }
+
+  if (bottommost_y_p)
+    *bottommost_y_p = bottommost_y;
+  
+  /* Hacks for stupid apps */
+  if (!meta_prefs_get_disable_workarounds ())
+    {
+      /* Allow framed windows with min size > work area to move offscreen by
+       * the amount they exceed the work area
+       */
+      if (window->frame != NULL)
+        {
+          if (topmost_y_p)
+            {
+              int min_height;
+              
+              min_height = window->frame->bottom_height + window->size_hints.min_height;
+              
+              if (min_height > (bottommost_y - *topmost_y_p))
+                *topmost_y_p = bottommost_y - min_height;
+            }
+          if (leftmost_x_p)
+            {
+              int min_width;
+
+              min_width = window->frame->right_width + window->size_hints.min_width;
+
+              if (min_width > (rightmost_x - *leftmost_x_p))
+                *leftmost_x_p = rightmost_x - min_width;
+            }
+        }
+    }
 }
 
 static void
@@ -507,6 +546,13 @@ constraint_onscreen_top_func     (MetaWi
   int min_dy;
   int topmost_y;
 
+  /* Allow undecorated windows to be expanded as much as they want
+   * off the top (no constraint)
+   */
+  if (window->frame == NULL &&
+      !meta_prefs_get_disable_workarounds ())
+    return;
+  
   get_outermost_onscreen_positions (window, info, orig, 0, *y_delta,
                                     NULL, NULL, &topmost_y, NULL);
 
@@ -522,16 +568,25 @@ constraint_onscreen_bottom_func  (MetaWi
                                   const MetaRectangle  *orig,
                                   int                  *y_delta)
 {
-  int max_dy;
-  int bottommost_y;
-
-  get_outermost_onscreen_positions (window, info, orig, 0, *y_delta,
-                                    NULL, NULL, NULL, &bottommost_y);
-
-  max_dy = bottommost_y - orig->y;
+  /* Make undecorated windows keep a pixel onscreen on top (for
+   * other windows, since the titlebar must be onscreen,
+   * constraining the bottom edge onscreen is redundant)
+   */
+  if (window->frame == NULL &&
+      !meta_prefs_get_disable_workarounds ())
+    {
+      int min_dy;
+      int topmost_y;
+      
+      get_outermost_onscreen_positions (window, info, orig, 0, *y_delta,
+                                        NULL, NULL, &topmost_y, NULL);
 
-  if (*y_delta > max_dy)
-    *y_delta = max_dy;
+      /* new - old = dy ; keep new bottom edge just on the screen */
+      min_dy = (topmost_y + 1) - (orig->y + orig->height);
+      
+      if (*y_delta < min_dy)
+        *y_delta = min_dy;
+    }
 }
 
 static void
@@ -540,16 +595,9 @@ constraint_onscreen_vcenter_func (MetaWi
                                   const MetaRectangle  *orig,
                                   int                  *y_delta)
 {
-  int max_dy;
-  int topmost_y;
-
-  get_outermost_onscreen_positions (window, info, orig, 0, *y_delta,
-                                    NULL, NULL, &topmost_y, NULL);
-
-  max_dy = orig->y - topmost_y;
-
-  if (*y_delta > max_dy)
-    *y_delta = max_dy;
+  /* Constrain as a top resize and a bottom resize */
+  constraint_onscreen_bottom_func (window, info, orig, y_delta);
+  constraint_onscreen_top_func (window, info, orig, y_delta);
 }
 
 static void
@@ -561,6 +609,13 @@ constraint_onscreen_left_func    (MetaWi
   int min_dx;
   int leftmost_x;
 
+  /* Allow undecorated windows to be expanded as much as they want
+   * off the left (no constraint)
+   */
+  if (window->frame == NULL &&
+      !meta_prefs_get_disable_workarounds ())
+    return;
+  
   get_outermost_onscreen_positions (window, info, orig, *x_delta, 0,
                                     &leftmost_x, NULL, NULL, NULL);
 
@@ -576,16 +631,25 @@ constraint_onscreen_right_func   (MetaWi
                                   const MetaRectangle  *orig,
                                   int                  *x_delta)
 {
-  int max_dx;
-  int rightmost_x;
-
-  get_outermost_onscreen_positions (window, info, orig, *x_delta, 0,
-                                    NULL, &rightmost_x, NULL, NULL);
-
-  max_dx = rightmost_x - orig->x;
+  /* Make undecorated windows keep a pixel onscreen on left (for
+   * other windows, since the titlebar must be onscreen,
+   * constraining the right edge onscreen is redundant)
+   */
+  if (window->frame == NULL &&
+      !meta_prefs_get_disable_workarounds ())
+    {
+      int min_dx;
+      int leftmost_x;
+      
+      get_outermost_onscreen_positions (window, info, orig, 0, *x_delta,
+                                        &leftmost_x, NULL, NULL, NULL);
 
-  if (*x_delta > max_dx)
-    *x_delta = max_dx;
+      /* new - old = dx ; keep new right edge just on the screen */
+      min_dx = (leftmost_x + 1) - (orig->x + orig->width);
+      
+      if (*x_delta < min_dx)
+        *x_delta = min_dx;
+    }
 }
 
 static void
@@ -594,16 +658,9 @@ constraint_onscreen_hcenter_func (MetaWi
                                   const MetaRectangle  *orig,
                                   int                  *x_delta)
 {
-  int max_dx;
-  int leftmost_x;
-  
-  get_outermost_onscreen_positions (window, info, orig, *x_delta, 0,
-                                    &leftmost_x, NULL, NULL, NULL);
-
-  max_dx = orig->x - leftmost_x;
-
-  if (*x_delta > max_dx)
-    *x_delta = max_dx;
+  /* Constrain as a left resize and a right resize */
+  constraint_onscreen_right_func (window, info, orig, x_delta);
+  constraint_onscreen_left_func (window, info, orig, x_delta);
 }
 
 static void
@@ -624,6 +681,11 @@ constraint_onscreen_move_func    (MetaWi
   min_delta = topmost_y - orig->y;
   max_delta = bottommost_y - orig->y;
 
+  /* Undecorated windows can get all but one pixel off the top */
+  if (window->frame == NULL &&
+      !meta_prefs_get_disable_workarounds ())
+    min_delta = (topmost_y - orig->height + 1) - orig->y;
+  
   /* Note that min delta (top left) has priority over
    * max delta (bottom right) to facilitate keeping
    * titlebar on the screen
@@ -636,6 +698,11 @@ constraint_onscreen_move_func    (MetaWi
   min_delta = leftmost_x - orig->x;
   max_delta = rightmost_x - orig->x;
 
+  /* Undecorated windows can get all but one pixel off the left */
+  if (window->frame == NULL &&
+      !meta_prefs_get_disable_workarounds ())
+    min_delta = (leftmost_x - orig->width + 1) - orig->x;
+  
   if (*x_delta > max_delta)
     *x_delta = max_delta;
   if (*x_delta < min_delta)
@@ -1289,7 +1356,7 @@ meta_window_constrain (MetaWindow       
        * new xinerama and update the ConstraintInfo
        */
       info.xinerama = meta_screen_get_xinerama_for_rect (window->screen,
-                                              &placed_rect);
+                                                         &placed_rect);
       meta_window_get_work_area_for_xinerama (window,
                                               info.xinerama->number,
                                               &info.work_area_xinerama);
