Index: constraints.c
===================================================================
RCS file: /cvs/gnome/metacity/src/constraints.c,v
retrieving revision 1.9
diff -p -u -r1.9 constraints.c
--- constraints.c	9 Jun 2003 23:49:01 -0000	1.9
+++ constraints.c	11 Jun 2003 03:14:47 -0000
@@ -21,6 +21,8 @@
 
 #include <config.h>
 #include "constraints.h"
+#include "window.h"
+#include "workspace.h"
 #include "place.h"
 
 /* The way this code works was suggested by Owen Taylor.
@@ -123,7 +125,7 @@ typedef struct
  * size of the menu control?).
  */
 
-#define TITLEBAR_LENGTH_ONSCREEN 36
+#define TITLEBAR_LENGTH_ONSCREEN 75
 
 typedef gboolean (* MetaConstraintAppliesFunc) (MetaWindow *window);
 
@@ -301,7 +303,7 @@ static const Constraint constraint_deskt
  * behavior, but not doing that for now.
  *
  * Top resize works the same as left resize. Right/bottom resize don't have a limit
- * because the constraint is designed to keep the top right corner of the
+ * because the constraint is designed to keep the top left corner of the
  * window or its titlebar on the screen, and right/bottom resize will never move that
  * area. Center resize is almost like left/top but dx has the opposite sign
  * and new_width = orig_width + 2dx.
@@ -352,26 +354,139 @@ get_outermost_onscreen_positions (MetaWi
                                   int                  *topmost_y,
                                   int                  *bottommost_y)
 {
-  if (leftmost_x)
-    *leftmost_x = info->nw_x  - orig->width +
-      MIN (TITLEBAR_LENGTH_ONSCREEN, orig->width);
+  GList *workspaces;
+  GList *tmp;
+  GSList *stmp;
+
+  /* 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
+   * computed, these strut lists should already be up to date.  No
+   * memory allocation should take place in this function for
+   * performance.
+   */
 
+  workspaces = meta_window_get_workspaces (window);
+  tmp = workspaces;
+
+  if (leftmost_x)
+    {
+      *leftmost_x = info->nw_x;
+      while (tmp)
+        {
+          stmp = ((MetaWorkspace*) tmp->data)->left_struts;
+          while (stmp)
+            {
+              MetaRectangle *rect = (MetaRectangle*) stmp->data;
+              /* the strut only matters if the title bar is
+               * overlapping the strut rect.
+               */
+              if (((orig->y - info->fgeom.top_height >= rect->y) &&
+                   (orig->y - info->fgeom.top_height <= rect->y + rect->height)) ||
+                  ((orig->y >= rect->y) &&
+                   (orig->y <= rect->y + rect->height)))
+                {
+                  *leftmost_x = MAX (*leftmost_x, rect->width);
+                }
+              
+              stmp = stmp->next;
+            }
+          
+          tmp = tmp->next;
+        }
+      
+      *leftmost_x = *leftmost_x - orig->width + MIN (TITLEBAR_LENGTH_ONSCREEN, orig->width);
+    }
+  
+  tmp = workspaces;
   if (rightmost_x)
-    *rightmost_x = info->se_x - MIN (TITLEBAR_LENGTH_ONSCREEN, orig->width);
+    {
+      *rightmost_x = info->se_x;
+      while (tmp)
+        {
+          stmp = ((MetaWorkspace*) tmp->data)->right_struts;
+          while (stmp)
+            {
+              MetaRectangle *rect = (MetaRectangle*) stmp->data;
+              /* the strut only matters if the title bar is
+               * overlapping the strut rect.
+               */
+              if (((orig->y - info->fgeom.top_height >= rect->y) &&
+                   (orig->y - info->fgeom.top_height <= rect->y + rect->height)) ||
+                  ((orig->y >= rect->y) &&
+                   (orig->y <= rect->y + rect->height)))
+                {
+                  *rightmost_x = MIN (*rightmost_x, rect->x);
+                }
+              
+              stmp = stmp->next;
+            }
+          
+          tmp = tmp->next;
+        }
+      
+      *rightmost_x = *rightmost_x - MIN (TITLEBAR_LENGTH_ONSCREEN, orig->width);
+    }
 
+  tmp = workspaces;
   if (topmost_y)
-    *topmost_y = info->nw_y + info->fgeom.top_height;
+    {
+      *topmost_y = info->nw_y;
+      while (tmp)
+        {
+          stmp = ((MetaWorkspace*) tmp->data)->top_struts;
+          while (stmp)
+            {
+              MetaRectangle *rect = (MetaRectangle*) stmp->data;
+              /* here the strut matters if the titlebar is overlapping
+               * the window horizontally
+               */
+	      if ((orig->x <= rect->x + rect->width) &&
+		  (orig->x + orig->width >= rect->x))
+                {
+                  *topmost_y = MAX (*topmost_y, rect->height);
+                }
+              
+              stmp = stmp->next;
+            }
+          
+          tmp = tmp->next;
+        }
+      
+      *topmost_y = *topmost_y + info->fgeom.top_height;
+    }
 
+  tmp = workspaces;
   if (bottommost_y)
     {
+      *bottommost_y = info->se_y;
+      while (tmp)
+        {
+          stmp = ((MetaWorkspace*) tmp->data)->bottom_struts;
+          while (stmp)
+            {
+              MetaRectangle *rect = (MetaRectangle*) stmp->data;
+              /* here the strut matters if the titlebar is overlapping
+               * the window horizontally
+               */
+	      if ((orig->x <= rect->x + rect->width) &&
+		  (orig->x + orig->width >= rect->x))
+                {
+                  *bottommost_y = MIN (*bottommost_y, rect->y);
+                }
+              
+              stmp = stmp->next;
+            }
+          
+          tmp = tmp->next;
+        }
+      
       /* If no frame, keep random TITLEBAR_LENGTH_ONSCREEN pixels on the
        * screen.
        */
-      if (window->frame)
-        *bottommost_y = info->se_y;
-      else
-        *bottommost_y = info->se_y -
-	  MIN (TITLEBAR_LENGTH_ONSCREEN, orig->height);
+      if (!window->frame)
+        *bottommost_y = *bottommost_y -
+          MIN (TITLEBAR_LENGTH_ONSCREEN, orig->height);
     }
 }
 
@@ -560,7 +675,7 @@ static const Constraint constraint_onscr
 static gboolean
 constraint_hints_applies_func (MetaWindow *window)
 {
-  return TRUE;
+  return (!window->fullscreen);
 }
 
 static void
@@ -1023,12 +1138,24 @@ update_position_limits (MetaWindow      
   int nw_x, nw_y;
   int se_x, se_y;
 
-  nw_x = info->work_area_screen.x;
-  nw_y = info->work_area_screen.y;
+  if (window->maximized)
+    {
+      nw_x = MIN (info->work_area_xinerama.x, info->work_area_screen.x);
+      nw_y = MIN (info->work_area_xinerama.y, info->work_area_screen.y);
 
-  /* find bottom-right corner of workarea */
-  se_x = info->work_area_screen.x + info->work_area_screen.width;
-  se_y = info->work_area_screen.y + info->work_area_screen.height;
+      /* find bottom-right corner of workarea */
+      se_x = MAX (info->work_area_xinerama.x + info->work_area_xinerama.width,
+		  info->work_area_screen.x + info->work_area_screen.width);
+      se_y = MAX (info->work_area_xinerama.y + info->work_area_xinerama.height,
+		  info->work_area_screen.y + info->work_area_screen.height);
+    }
+  else
+    {
+      nw_x = 0;
+      nw_y = 0;
+      se_x = window->screen->width;
+      se_y = window->screen->height;
+   }
 
   /* If we have a micro-screen or huge frames maybe nw/se got
    * swapped
@@ -1078,7 +1205,7 @@ meta_window_constrain (MetaWindow       
 
 #define OUTER_WIDTH(rect) ((rect).width + info.fgeom.left_width + info.fgeom.right_width)
 #define OUTER_HEIGHT(rect) ((rect).height + info.fgeom.top_height + info.fgeom.bottom_height)
-  
+
   meta_topic (META_DEBUG_GEOMETRY,
               "Constraining %s x_move_delta = %d y_move_delta = %d x_direction = %d y_direction = %d x_delta = %d y_delta = %d orig %d,%d %dx%d\n",
               window->desc, x_move_delta, y_move_delta,
@@ -1252,108 +1379,108 @@ meta_window_constrain (MetaWindow       
 
 #if 0
   /* Now we have to sort out the aspect ratio */
-  {
-    /*
-     *                width
-     * min_aspect <= -------- <= max_aspect
-     *                height
-     */
-    double min_aspect, max_aspect;
-    int width, height;
-
-    min_aspect = window->size_hints.min_aspect.x / (double) window->size_hints.min_aspect.y;
-    max_aspect = window->size_hints.max_aspect.x / (double) window->size_hints.max_aspect.y;
-
-    width = current.width;
-    height = current.height;
-
-    /* Use the standard cut-and-pasted-between-every-WM code: */
-    if (min_aspect * height > width)
-      {
-        int delta;
-
-        delta = FLOOR (height - width / min_aspect, window->size_hints.height_inc);
-        if (height - delta >= window->size_hints.min_height)
-          height -= delta;
-        else
-          {
-            delta = FLOOR (height * min_aspect - width, window->size_hints.width_inc);
-            if (width + delta <= window->size_hints.max_width)
-              width += delta;
-          }
-      }
-
-    if (max_aspect * height < width)
-      {
-        int delta;
-
-        delta = FLOOR (width - height * max_aspect, window->size_hints.width_inc);
-        if (width - delta >= window->size_hints.min_width)
-          width -= delta;
-        else
-          {
-            delta = FLOOR (width / max_aspect - height, window->size_hints.height_inc);
-            if (height + delta <= window->size_hints.max_height)
-              height += delta;
-          }
-      }
-
-    /* Convert into terms of the direction of resize and reapply the
-     * earlier constraints; this means aspect ratio becomes the
-     * least-important of the constraints. If we wanted aspect to be
-     * the most important, we could just not do this next bit.
-     */
-
-    if (current.width != width)
-      {
-        x_delta = width - current.width; /* positive delta to increase width */
-        switch (x_direction)
-          {
-          case META_RESIZE_LEFT_OR_TOP:
-            constrain_resize_left (window, &info, &current,
-                                   - x_delta, new);
-            break;
-          case META_RESIZE_CENTER:
-            constrain_resize_hcenter (window, &info, &current,
+  if (!window->fullscreen)
+    {
+      /*
+       *                width
+       * min_aspect <= -------- <= max_aspect
+       *                height
+       */
+      double min_aspect, max_aspect;
+      int width, height;
+      
+      min_aspect = window->size_hints.min_aspect.x / (double) window->size_hints.min_aspect.y;
+      max_aspect = window->size_hints.max_aspect.x / (double) window->size_hints.max_aspect.y;
+      
+      width = current.width;
+      height = current.height;
+
+      /* Use the standard cut-and-pasted-between-every-WM code: */
+      if (min_aspect * height > width)
+        {
+          int delta;
+          
+          delta = FLOOR (height - width / min_aspect, window->size_hints.height_inc);
+          if (height - delta >= window->size_hints.min_height)
+            height -= delta;
+          else
+            {
+              delta = FLOOR (height * min_aspect - width, window->size_hints.width_inc);
+              if (width + delta <= window->size_hints.max_width)
+                width += delta;
+            }
+        }
+      
+      if (max_aspect * height < width)
+        {
+          int delta;
+          
+          delta = FLOOR (width - height * max_aspect, window->size_hints.width_inc);
+          if (width - delta >= window->size_hints.min_width)
+            width -= delta;
+          else
+            {
+              delta = FLOOR (width / max_aspect - height, window->size_hints.height_inc);
+              if (height + delta <= window->size_hints.max_height)
+                height += delta;
+            }
+        }
+      
+      /* Convert into terms of the direction of resize and reapply the
+       * earlier constraints; this means aspect ratio becomes the
+       * least-important of the constraints. If we wanted aspect to be
+       * the most important, we could just not do this next bit.
+       */
+      
+      if (current.width != width)
+        {
+          x_delta = width - current.width; /* positive delta to increase width */
+          switch (x_direction)
+            {
+            case META_RESIZE_LEFT_OR_TOP:
+              constrain_resize_left (window, &info, &current,
+                                     - x_delta, new);
+              break;
+            case META_RESIZE_CENTER:
+              constrain_resize_hcenter (window, &info, &current,
+                                        x_delta, new);
+              break;
+            case META_RESIZE_RIGHT_OR_BOTTOM:
+              constrain_resize_right (window, &info, &current,
                                       x_delta, new);
-            break;
-          case META_RESIZE_RIGHT_OR_BOTTOM:
-            constrain_resize_right (window, &info, &current,
-                                    x_delta, new);
-            break;
-          }
-      }
-
-    if (current.height != height)
-      {
-        y_delta = height - current.height; /* positive to increase height */
-
-        switch (y_direction)
-          {
-          case META_RESIZE_LEFT_OR_TOP:
-            constrain_resize_top (window, &info, &current,
-                                  - y_delta, new);
-            break;
-          case META_RESIZE_CENTER:
-            constrain_resize_vcenter (window, &info, &current,
-                                      y_delta, new);
-            break;
-          case META_RESIZE_RIGHT_OR_BOTTOM:
-            constrain_resize_bottom (window, &info, &current,
-                                     y_delta, new);
-            break;
-          }
-      }
-
-    current = *new;
-  }
-
-
-  g_print ("3 x_delta = %d y_delta = %d pos = %d,%d size = %dx%d\n",
-           x_delta, y_delta,
-           current.x, current.y, current.width, current.height);
-#endif
+              break;
+            }
+        }
+      
+      if (current.height != height)
+        {
+          y_delta = height - current.height; /* positive to increase height */
+          
+          switch (y_direction)
+            {
+            case META_RESIZE_LEFT_OR_TOP:
+              constrain_resize_top (window, &info, &current,
+                                    - y_delta, new);
+              break;
+            case META_RESIZE_CENTER:
+              constrain_resize_vcenter (window, &info, &current,
+                                        y_delta, new);
+              break;
+            case META_RESIZE_RIGHT_OR_BOTTOM:
+              constrain_resize_bottom (window, &info, &current,
+                                       y_delta, new);
+              break;
+            }
+        }
+      
+      current = *new;
 
+      g_print ("3 x_delta = %d y_delta = %d pos = %d,%d size = %dx%d\n",
+               x_delta, y_delta,
+               current.x, current.y, current.width, current.height);
+    }
+
+#endif
   meta_topic (META_DEBUG_GEOMETRY,
               "Constrained %s new %d,%d %dx%d old %d,%d %dx%d\n",
               window->desc,
Index: display.c
===================================================================
RCS file: /cvs/gnome/metacity/src/display.c,v
retrieving revision 1.187
diff -p -u -r1.187 display.c
--- display.c	30 May 2003 20:24:00 -0000	1.187
+++ display.c	11 Jun 2003 03:14:50 -0000
@@ -77,8 +77,11 @@ static GSList *all_displays = NULL;
 
 static void   meta_spew_event           (MetaDisplay    *display,
                                          XEvent         *event);
+#ifndef USE_GDK_DISPLAY
 static void   event_queue_callback      (XEvent         *event,
                                          gpointer        data);
+#endif
+
 static gboolean event_callback          (XEvent         *event,
                                          gpointer        data);
 static Window event_get_modified_window (MetaDisplay    *display,
@@ -232,7 +235,7 @@ meta_display_open (const char *name)
     "_NET_ACTIVE_WINDOW",
     "_METACITY_RESTART_MESSAGE",    
     "_NET_WM_STRUT",
-    "_WIN_HINTS",
+    "_NET_WM_STRUT_PARTIAL",
     "_METACITY_RELOAD_THEME_MESSAGE",
     "_METACITY_SET_KEYBINDINGS_MESSAGE",
     "_NET_WM_STATE_HIDDEN",
@@ -379,7 +382,7 @@ meta_display_open (const char *name)
   display->atom_net_active_window = atoms[43];
   display->atom_metacity_restart_message = atoms[44];
   display->atom_net_wm_strut = atoms[45];
-  display->atom_win_hints = atoms[46];
+  display->atom_net_wm_strut_partial = atoms[46];
   display->atom_metacity_reload_theme_message = atoms[47];
   display->atom_metacity_set_keybindings_message = atoms[48];
   display->atom_net_wm_state_hidden = atoms[49];
@@ -899,12 +902,14 @@ meta_display_is_double_click (MetaDispla
 static gboolean dump_events = TRUE;
 
 
+#ifndef USE_GDK_DISPLAY
 static void
 event_queue_callback (XEvent         *event,
                       gpointer        data)
 {
   event_callback (event, data);
 }
+#endif
 
 static gboolean
 grab_op_is_mouse (MetaGrabOp op)
@@ -1259,6 +1264,7 @@ event_callback (XEvent   *event,
               if (window->frame)
                 {
                   window->frame->need_reapply_frame_shape = TRUE;
+		  meta_warning("from event callback\n");		  
                   meta_window_queue_move_resize (window);
                 }
             }
@@ -3200,6 +3206,7 @@ meta_display_queue_retheme_all_windows (
     {
       MetaWindow *window = tmp->data;
       
+      meta_warning("from retheme\n");
       meta_window_queue_move_resize (window);
       if (window->frame)
         {
@@ -3672,6 +3679,16 @@ meta_rectangle_intersect (MetaRectangle 
     }
 
   return return_val;
+}
+
+gboolean
+meta_rectangle_equal (const MetaRectangle *src1,
+                      const MetaRectangle *src2)
+{
+  return ((src1->x == src2->x) &&
+          (src1->y == src2->y) &&
+          (src1->width == src2->width) &&
+          (src1->height == src2->height));
 }
 
 static MetaScreen*
Index: display.h
===================================================================
RCS file: /cvs/gnome/metacity/src/display.h,v
retrieving revision 1.103
diff -p -u -r1.103 display.h
--- display.h	30 May 2003 20:24:00 -0000	1.103
+++ display.h	11 Jun 2003 03:14:50 -0000
@@ -134,7 +134,7 @@ struct _MetaDisplay
   Atom atom_net_active_window;
   Atom atom_metacity_restart_message;
   Atom atom_net_wm_strut;
-  Atom atom_win_hints;
+  Atom atom_net_wm_strut_partial;
   Atom atom_metacity_reload_theme_message;
   Atom atom_metacity_set_keybindings_message;
   Atom atom_net_wm_state_hidden;
@@ -441,6 +441,8 @@ gboolean meta_grab_op_is_resizing (MetaG
 gboolean meta_rectangle_intersect (MetaRectangle *src1,
                                    MetaRectangle *src2,
                                    MetaRectangle *dest);
+gboolean meta_rectangle_equal (const MetaRectangle *src1,
+                               const MetaRectangle *src2);
 
 void meta_display_devirtualize_modifiers (MetaDisplay        *display,
                                           MetaVirtualModifier modifiers,
Index: screen.c
===================================================================
RCS file: /cvs/gnome/metacity/src/screen.c,v
retrieving revision 1.106
diff -p -u -r1.106 screen.c
--- screen.c	16 May 2003 21:59:07 -0000	1.106
+++ screen.c	11 Jun 2003 03:14:52 -0000
@@ -1479,21 +1479,18 @@ meta_screen_get_natural_xinerama_list (M
 }
 
 gboolean
-meta_screen_window_intersects_xinerama (MetaScreen *screen,
-                                        MetaWindow *window,
-                                        int         which_xinerama)
+meta_screen_rect_intersects_xinerama (MetaScreen    *screen,
+                                      MetaRectangle *rect,
+                                      int            which_xinerama)
 {
-  MetaRectangle window_rect;
   MetaRectangle dest, screen_rect;
   
-  meta_window_get_outer_rect (window, &window_rect);
-  
   screen_rect.x = screen->xinerama_infos[which_xinerama].x_origin;
   screen_rect.y = screen->xinerama_infos[which_xinerama].y_origin;
   screen_rect.width = screen->xinerama_infos[which_xinerama].width;
   screen_rect.height = screen->xinerama_infos[which_xinerama].height;
   
-  if (meta_rectangle_intersect (&screen_rect, &window_rect, &dest))
+  if (meta_rectangle_intersect (&screen_rect, rect, &dest))
     return TRUE;
 
   return FALSE;
@@ -2123,6 +2120,10 @@ meta_screen_resize_func (MetaScreen *scr
                          MetaWindow *window,
                          void       *user_data)
 {
+  if (window->struts)
+    {
+      meta_window_update_struts (window);
+    }
   meta_window_queue_move_resize (window);
 }
 
Index: screen.h
===================================================================
RCS file: /cvs/gnome/metacity/src/screen.h,v
retrieving revision 1.49
diff -p -u -r1.49 screen.h
--- screen.h	16 May 2003 21:59:08 -0000	1.49
+++ screen.h	11 Jun 2003 03:14:53 -0000
@@ -148,9 +148,9 @@ const MetaXineramaScreenInfo* meta_scree
 const MetaXineramaScreenInfo* meta_screen_get_xinerama_for_window (MetaScreen    *screen,
                                                                    MetaWindow    *window);
 
-gboolean      meta_screen_window_intersects_xinerama (MetaScreen *screen, 
-                                                      MetaWindow *window,
-                                                      int         which_xinerama);
+gboolean      meta_screen_rect_intersects_xinerama (MetaScreen    *screen, 
+                                                    MetaRectangle *window,
+                                                    int            which_xinerama);
 
 const MetaXineramaScreenInfo* meta_screen_get_xinerama_neighbor (MetaScreen *screen,
                                                                  int         which_xinerama,
Index: window-props.c
===================================================================
RCS file: /cvs/gnome/metacity/src/window-props.c,v
retrieving revision 1.11
diff -p -u -r1.11 window-props.c
--- window-props.c	26 Apr 2003 17:40:32 -0000	1.11
+++ window-props.c	11 Jun 2003 03:14:53 -0000
@@ -958,7 +958,7 @@ meta_display_init_window_prop_hooks (Met
   hooks[i].reload_func = NULL;
   ++i;
 
-  hooks[i].property = display->atom_win_hints;
+  hooks[i].property = display->atom_net_wm_strut_partial;
   hooks[i].init_func = NULL;
   hooks[i].reload_func = NULL;
   ++i;
Index: window.c
===================================================================
RCS file: /cvs/gnome/metacity/src/window.c,v
retrieving revision 1.285
diff -p -u -r1.285 window.c
--- window.c	9 Jun 2003 23:49:01 -0000	1.285
+++ window.c	11 Jun 2003 03:14:59 -0000
@@ -54,16 +54,6 @@ typedef enum
   META_USER_MOVE_RESIZE     = 1 << 2
 } MetaMoveResizeFlags;
 
-typedef enum
-{
-  WIN_HINTS_SKIP_FOCUS      = (1<<0), /* "alt-tab" skips this win */
-  WIN_HINTS_SKIP_WINLIST    = (1<<1), /* not in win list */
-  WIN_HINTS_SKIP_TASKBAR    = (1<<2), /* not on taskbar */
-  WIN_HINTS_GROUP_TRANSIENT = (1<<3), /* ??????? */
-  WIN_HINTS_FOCUS_ON_CLICK  = (1<<4), /* app only accepts focus when clicked */
-  WIN_HINTS_DO_NOT_COVER    = (1<<5)  /* attempt to not cover this window */
-} GnomeWinHints;
-
 static int destroying_windows_disallowed = 0;
 
 
@@ -74,10 +64,8 @@ static void     update_transient_for    
 static void     update_sm_hints           (MetaWindow     *window);
 static void     update_role               (MetaWindow     *window);
 static void     update_net_wm_type        (MetaWindow     *window);
-static void     update_struts             (MetaWindow     *window);
 static void     recalc_window_type        (MetaWindow     *window);
 static void     recalc_window_features    (MetaWindow     *window);
-static void     recalc_do_not_cover_struts(MetaWindow     *window);
 static void     invalidate_work_areas     (MetaWindow     *window);
 static void     set_wm_state              (MetaWindow     *window,
                                            int             state);
@@ -88,8 +76,6 @@ static gboolean process_property_notify 
 static void     meta_window_show          (MetaWindow     *window);
 static void     meta_window_hide          (MetaWindow     *window);
 
-static GList*   meta_window_get_workspaces (MetaWindow    *window);
-
 static void     meta_window_save_rect         (MetaWindow    *window);
 
 static void meta_window_move_resize_internal (MetaWindow         *window,
@@ -489,12 +475,7 @@ meta_window_new (MetaDisplay *display,
   window->type = META_WINDOW_NORMAL;
   window->type_atom = None;
 
-  window->has_struts = FALSE;
-  window->do_not_cover = FALSE;
-  window->left_strut = 0;
-  window->right_strut = 0;
-  window->top_strut = 0;
-  window->bottom_strut = 0;
+  window->struts = NULL;
 
   window->using_net_wm_name = FALSE;
   window->using_net_wm_icon_name = FALSE;
@@ -528,8 +509,6 @@ meta_window_new (MetaDisplay *display,
   g_assert (N_INITIAL_PROPS == i);
   
   meta_window_reload_properties (window, initial_props, N_INITIAL_PROPS);
-  
-  update_struts (window);
 
   update_net_wm_state (window);
   
@@ -663,6 +642,8 @@ meta_window_new (MetaDisplay *display,
 
   /* for the various on_all_workspaces = TRUE possible above */
   meta_window_set_current_workspace_hint (window);
+  
+  meta_window_update_struts (window);
 
   /* Put our state back where it should be,
    * passing TRUE for is_configure_request, ICCCM says
@@ -919,8 +900,11 @@ meta_window_free (MetaWindow  *window)
                   window->desc);
     }
 
-  if (window->has_struts)
+  if (window->struts)
     {
+      g_free (window->struts);
+      window->struts = NULL;
+
       meta_topic (META_DEBUG_WORKAREA,
                   "Unmanaging window %s which has struts, so invalidating work areas\n",
                   window->desc);
@@ -1691,7 +1675,7 @@ meta_window_show (MetaWindow *window)
     {
       set_net_wm_state (window);
       
-      if (window->has_struts)
+      if (window->struts)
         {
           meta_topic (META_DEBUG_WORKAREA,
                       "Mapped window %s with struts, so invalidating work areas\n",
@@ -1744,7 +1728,7 @@ meta_window_hide (MetaWindow *window)
     {
       set_net_wm_state (window);
       
-      if (window->has_struts)
+      if (window->struts)
         {
           meta_topic (META_DEBUG_WORKAREA,
                       "Unmapped window %s with struts, so invalidating work areas\n",
@@ -2319,6 +2303,14 @@ meta_window_move_resize_internal (MetaWi
                          meta_y_direction_from_gravity (resize_gravity),
                          y_delta,
                          &new_rect);
+
+  if (!meta_rectangle_equal (&new_rect, &old_rect))
+    {
+      meta_topic (META_DEBUG_GEOMETRY,
+		    "Requeueing %s because of non-fixed constraint\n",
+		    window->desc);
+      meta_window_queue_move_resize (window);
+    }
   
   w = new_rect.width;
   h = new_rect.height;
@@ -2608,22 +2600,6 @@ meta_window_move_resize_internal (MetaWi
       meta_topic (META_DEBUG_GEOMETRY, "Size/position not modified\n");
     }
   
-  /* Update struts for new window size */
-  if (window->do_not_cover && (need_resize_client || need_move_client))
-    {
-      recalc_do_not_cover_struts (window);
-
-      /* Does a resize on all windows on entire current workspace,
-       * would be an infinite loop except for need_resize_client
-       * above. We rely on reaching an equilibrium state, which
-       * is somewhat fragile, though.
-       */
-
-      meta_topic (META_DEBUG_WORKAREA, "Window %s resized so invalidating its work areas\n",
-                  window->desc);
-      invalidate_work_areas (window);
-    }
-
   meta_window_refresh_resize_popup (window);
   
   /* Invariants leaving this function are:
@@ -2798,23 +2774,6 @@ meta_window_fill_vertical (MetaWindow  *
 static guint move_resize_idle = 0;
 static GSList *move_resize_pending = NULL;
 
-/* We want to put windows whose size/pos affects other
- * windows earlier in the queue, for efficiency.
- */
-static int
-move_resize_cmp (gconstpointer a, gconstpointer b)
-{
-  MetaWindow *aw = (gpointer) a;
-  MetaWindow *bw = (gpointer) b;
-
-  if (aw->do_not_cover && !bw->do_not_cover)
-    return -1; /* aw before bw */
-  else if (!aw->do_not_cover && bw->do_not_cover)
-    return 1;
-  else
-    return 0;
-}
-
 static gboolean
 idle_move_resize (gpointer data)
 {
@@ -2834,8 +2793,6 @@ idle_move_resize (gpointer data)
 
   destroying_windows_disallowed += 1;
 
-  copy = g_slist_sort (copy, move_resize_cmp);
-  
   tmp = copy;
   while (tmp != NULL)
     {
@@ -3883,46 +3840,6 @@ meta_window_client_message (MetaWindow *
 
       return TRUE;
     }
-  else if (event->xclient.message_type ==
-           display->atom_win_hints)
-    {
-      /* gnome-winhints.c seems to indicate that the hints are
-       * in l[1], though god knows why it's like that
-       */
-      gulong data[1];
-      
-      meta_verbose ("_WIN_HINTS client message, hints: %ld\n",
-                    event->xclient.data.l[1]);
-
-      if (event->xclient.data.l[1] & WIN_HINTS_DO_NOT_COVER)
-        {
-          meta_topic (META_DEBUG_WORKAREA,
-                      "Setting WIN_HINTS_DO_NOT_COVER\n");
-          
-          data[0] = WIN_HINTS_DO_NOT_COVER;
-
-          meta_error_trap_push (window->display);
-          XChangeProperty (window->display->xdisplay,
-                           window->xwindow, window->display->atom_win_hints,
-                           XA_CARDINAL, 32, PropModeReplace,
-                           (unsigned char *)data, 1);
-          meta_error_trap_pop (window->display, FALSE);
-        }
-      else
-        {
-          meta_topic (META_DEBUG_WORKAREA,
-                      "Unsetting WIN_HINTS_DO_NOT_COVER\n");
-          
-          data[0] = 0;
-
-          meta_error_trap_push (window->display);
-          XDeleteProperty (window->display->xdisplay,
-                           window->xwindow, window->display->atom_win_hints);
-          meta_error_trap_pop (window->display, FALSE);
-        }
-      
-      return TRUE;
-    }
   
   return FALSE;
 }
@@ -4207,15 +4124,11 @@ process_property_notify (MetaWindow     
                                         event->atom);
       meta_window_queue_update_icon (window);
     }
-  else if (event->atom == window->display->atom_net_wm_strut)
+  else if ((event->atom == window->display->atom_net_wm_strut) ||
+	   (event->atom == window->display->atom_net_wm_strut_partial))
     {
       meta_verbose ("Property notify on %s for _NET_WM_STRUT\n", window->desc);
-      update_struts (window);
-    }
-  else if (event->atom == window->display->atom_win_hints)
-    {
-      meta_verbose ("Property notify on %s for _WIN_HINTS\n", window->desc);
-      update_struts (window);
+      meta_window_update_struts (window);
     }
   else if (event->atom == window->display->atom_net_startup_id)
     {
@@ -4911,7 +4824,7 @@ meta_window_queue_update_icon (MetaWindo
   update_icon_pending = g_slist_prepend (update_icon_pending, window);
 }
 
-static GList*
+GList*
 meta_window_get_workspaces (MetaWindow *window)
 {
   if (window->on_all_workspaces)
@@ -4934,119 +4847,179 @@ invalidate_work_areas (MetaWindow *windo
     }
 }
 
-static void
-update_struts (MetaWindow *window)
+void
+meta_window_update_struts (MetaWindow *window)
 {
   gulong *struts = NULL;
   int nitems;
   gboolean old_has_struts;
-  gboolean old_do_not_cover;
-  int old_left;
-  int old_right;
-  int old_top;
-  int old_bottom;
+  gboolean new_has_struts;
+  MetaRectangle old_left;
+  MetaRectangle old_right;
+  MetaRectangle old_top;
+  MetaRectangle old_bottom;
+
+  MetaRectangle new_left;
+  MetaRectangle new_right;
+  MetaRectangle new_top;
+  MetaRectangle new_bottom;
   
   meta_verbose ("Updating struts for %s\n", window->desc);
   
-  old_has_struts = window->has_struts;
-  old_do_not_cover = window->do_not_cover;
-  old_left = window->left_strut;
-  old_right = window->right_strut;
-  old_top = window->top_strut;
-  old_bottom = window->bottom_strut;  
-  
-  window->has_struts = FALSE;
-  window->do_not_cover = FALSE;
-  window->left_strut = 0;
-  window->right_strut = 0;
-  window->top_strut = 0;
-  window->bottom_strut = 0;
+  if (window->struts)
+    {
+      old_has_struts = TRUE;
+      old_left = window->struts->left;
+      old_right = window->struts->right;
+      old_top = window->struts->top;
+      old_bottom = window->struts->bottom;
+    }
+  else
+    {
+      old_has_struts = FALSE;
+    }
+
+  new_has_struts = FALSE;
+  new_left.width = 0;
+  new_left.x = 0;
+  new_left.y = 0;
+  new_left.height = window->screen->height;
+
+  new_right.width = 0;
+  new_right.x = window->screen->width;
+  new_right.y = 0;
+  new_right.height = window->screen->height;
+
+  new_top.height = 0;
+  new_top.y = 0;
+  new_top.x = 0;
+  new_top.width = window->screen->width;
+
+  new_bottom.height = 0;
+  new_bottom.y = window->screen->height;
+  new_bottom.x = 0;
+  new_bottom.width = window->screen->width;
   
   if (meta_prop_get_cardinal_list (window->display,
                                    window->xwindow,
-                                   window->display->atom_net_wm_strut,
+                                   window->display->atom_net_wm_strut_partial,
                                    &struts, &nitems))
     {
-      if (nitems != 4)
+      if (nitems != 12)
         {
-          meta_verbose ("_NET_WM_STRUT on %s has %d values instead of 4\n",
+          meta_verbose ("_NET_WM_STRUT_PARTIAL on %s has %d values instead of 12\n",
                         window->desc, nitems);
-          meta_XFree (struts);
         }
-      
-      window->has_struts = TRUE;
-      window->left_strut = struts[0];
-      window->right_strut = struts[1];
-      window->top_strut = struts[2];
-      window->bottom_strut = struts[3];
-
-      meta_verbose ("_NET_WM_STRUT struts %d %d %d %d for window %s\n",
-                    window->left_strut, window->right_strut,
-                    window->top_strut, window->bottom_strut,
-                    window->desc);
-      
-      if (window->left_strut < 0)
-        window->left_strut = 0;
-      if (window->right_strut < 0)
-        window->right_strut = 0;
-      if (window->top_strut < 0)
-        window->top_strut = 0;
-      if (window->bottom_strut < 0)
-        window->bottom_strut = 0;
-      
-      meta_verbose ("Using _NET_WM_STRUT struts %d %d %d %d for window %s\n",
-                    window->left_strut, window->right_strut,
-                    window->top_strut, window->bottom_strut,
-                    window->desc);
-      
+      else
+	{
+	  new_has_struts = TRUE;
+          new_left.width = MIN ((int)struts[0], 
+                                window->screen->width/2 - 75);
+          new_right.width = MIN ((int)struts[1], 
+                                 window->screen->width/2 - 75);
+          new_top.height = MIN ((int)struts[2], 
+                                window->screen->height/2 - 75);
+          new_bottom.height = MIN ((int)struts[3], 
+                                   window->screen->height/2 - 75);
+          new_right.x = window->screen->width - 
+            new_right.width;
+          new_bottom.y = window->screen->height - 
+            new_bottom.height;
+          new_left.y = struts[4];
+          new_left.height = struts[5] - new_left.y;
+	  new_right.y = struts[6];
+	  new_right.height = struts[7] - new_right.y;
+	  new_top.x = struts[8];
+	  new_top.width = struts[9] - new_top.x;
+	  new_bottom.x = struts[10];
+	  new_bottom.width = struts[11] - new_bottom.x;
+	  
+	  meta_verbose ("_NET_WM_STRUT_PARTIAL struts %d %d %d %d for window %s\n",
+			new_left.width,
+			new_right.width,
+			new_top.height,
+			new_bottom.height,
+			window->desc);
+	  
+	}
       meta_XFree (struts);
     }
   else
     {
-      meta_verbose ("No _NET_WM_STRUT property for %s\n",
+      meta_verbose ("No _NET_WM_STRUT_PARTIAL property for %s\n",
                     window->desc);
     }
-  
-  if (!window->has_struts)
-    {
-      /* Try _WIN_HINTS */
-      gulong hints;
 
-      if (meta_prop_get_cardinal (window->display,
-                                  window->xwindow,
-                                  window->display->atom_win_hints,
-                                  &hints))
+  if (!new_has_struts)
+    {
+      if (meta_prop_get_cardinal_list (window->display,
+                                       window->xwindow,
+                                       window->display->atom_net_wm_strut,
+                                       &struts, &nitems))
         {
-          if (hints & WIN_HINTS_DO_NOT_COVER)
+          if (nitems != 4)
             {
-              window->has_struts = TRUE;
-              window->do_not_cover = TRUE;
-              recalc_do_not_cover_struts (window);
-
-              meta_verbose ("Using _WIN_HINTS struts %d %d %d %d for window %s\n",
-                            window->left_strut, window->right_strut,
-                            window->top_strut, window->bottom_strut,
-                            window->desc);              
+              meta_verbose ("_NET_WM_STRUT on %s has %d values instead of 4\n",
+                            window->desc, nitems);
             }
-          else
+	  else
             {
-              meta_verbose ("DO_NOT_COVER hint not set in _WIN_HINTS\n");
-            }
-        }
+              new_has_struts = TRUE;
+              new_left.width = MIN ((int)struts[0], 
+                                    window->screen->width/2 - 75);
+              new_right.width = MIN ((int)struts[1], 
+                                     window->screen->width/2 - 75);
+              new_top.height = MIN ((int)struts[2], 
+                                    window->screen->height/2 - 75);
+              new_bottom.height = MIN ((int)struts[3], 
+                                       window->screen->height/2 - 75);
+              new_left.x = 0;
+	      new_right.x = window->screen->width - 
+		new_right.width;
+	      new_top.y = 0;
+	      new_bottom.y = window->screen->height -
+		new_bottom.height;
+          
+	      meta_verbose ("_NET_WM_STRUT struts %d %d %d %d for window %s\n",
+			    new_left.width,
+			    new_right.width,
+			    new_top.height,
+			    new_bottom.height,
+			    window->desc);
+	      
+	    }
+	  meta_XFree (struts);
+	}
       else
         {
-          meta_verbose ("No _WIN_HINTS property on %s\n",
+          meta_verbose ("No _NET_WM_STRUT property for %s\n",
                         window->desc);
         }
     }
+ 
+  if (old_has_struts != new_has_struts ||
+      (new_has_struts && old_has_struts &&
+       (!meta_rectangle_equal(&old_left, &new_left) ||
+	!meta_rectangle_equal(&old_right, &new_right) ||
+	!meta_rectangle_equal(&old_top, &new_top) ||
+	!meta_rectangle_equal(&old_bottom, &new_bottom))))
+    {
+      if (new_has_struts)
+	{
+	  if (!window->struts)
+	    window->struts = g_new (MetaStruts, 1);
+	      
+	  window->struts->left = new_left;
+	  window->struts->right = new_right;
+	  window->struts->top = new_top;
+	  window->struts->bottom = new_bottom;
+	}
+      else
+	{
+	  g_free (window->struts);
+	  window->struts = NULL;
+	}
 
-  if (old_has_struts != window->has_struts ||
-      old_do_not_cover != window->do_not_cover ||
-      old_left != window->left_strut ||
-      old_right != window->right_strut ||
-      old_top != window->top_strut ||
-      old_bottom != window->bottom_strut)
-    {  
       meta_topic (META_DEBUG_WORKAREA,
                   "Invalidating work areas of window %s due to struts update\n",
                   window->desc);
@@ -5056,61 +5029,6 @@ update_struts (MetaWindow *window)
     {
       meta_topic (META_DEBUG_WORKAREA,
                   "Struts on %s were unchanged\n", window->desc);
-    }
-}
-
-static void
-recalc_do_not_cover_struts (MetaWindow *window)
-{
-  if (window->do_not_cover)
-    {
-      /* We only understand windows that are aligned to
-       * a screen edge
-       */
-      gboolean horizontal;
-      gboolean on_left_edge;
-      gboolean on_right_edge;
-      gboolean on_bottom_edge;
-      gboolean on_top_edge;      
-
-      window->left_strut = 0;
-      window->right_strut = 0;
-      window->top_strut = 0;
-      window->bottom_strut = 0;
-      
-      on_left_edge = window->rect.x == 0;
-      on_right_edge = (window->rect.x + window->rect.width) ==
-        window->screen->width;
-      on_top_edge = window->rect.y == 0;
-      on_bottom_edge = (window->rect.y + window->rect.height) ==
-        window->screen->height;
-      
-      /* cheesy heuristic to decide where the strut goes */
-      if (on_left_edge && on_right_edge && on_bottom_edge)
-        horizontal = TRUE;
-      else if (on_left_edge && on_right_edge && on_top_edge)
-        horizontal = TRUE;
-      else if (on_top_edge && on_bottom_edge && on_left_edge)
-        horizontal = FALSE;
-      else if (on_top_edge && on_bottom_edge && on_right_edge)
-        horizontal = FALSE;
-      else
-        horizontal = window->rect.width > window->rect.height;
-      
-      if (horizontal)
-        {
-          if (on_top_edge)
-            window->top_strut = window->rect.height;
-          else if (on_bottom_edge)
-            window->bottom_strut = window->rect.height;
-        }
-      else
-        {
-          if (on_left_edge)
-            window->left_strut = window->rect.width;
-          else if (on_right_edge)
-            window->right_strut = window->rect.width;
-        }
     }
 }
 
Index: window.h
===================================================================
RCS file: /cvs/gnome/metacity/src/window.h,v
retrieving revision 1.90
diff -p -u -r1.90 window.h
--- window.h	9 Jun 2003 23:49:02 -0000	1.90
+++ window.h	11 Jun 2003 03:14:59 -0000
@@ -32,6 +32,7 @@
 #include <gdk-pixbuf/gdk-pixbuf.h>
 
 typedef struct _MetaGroup MetaGroup;
+typedef struct _MetaStruts MetaStruts;
 
 typedef gboolean (*MetaWindowForeachFunc) (MetaWindow *window,
                                            void       *data);
@@ -49,6 +50,15 @@ typedef enum
   META_WINDOW_SPLASHSCREEN
 } MetaWindowType;
 
+struct _MetaStruts
+{
+  /* struts */
+  MetaRectangle left;
+  MetaRectangle right;
+  MetaRectangle top;
+  MetaRectangle bottom;
+};
+
 struct _MetaWindow
 {
   MetaDisplay *display;
@@ -211,10 +221,8 @@ struct _MetaWindow
    */
   guint calc_placement : 1;
 
-  /* Has nonzero struts */
-  guint has_struts : 1; 
-  /* Struts are from the _WIN_HINTS do not cover deal */
-  guint do_not_cover : 1;
+  /* Note: can be NULL */
+  MetaStruts *struts;
 
   /* Transient parent is a root window */
   guint transient_parent_is_root_window : 1;
@@ -270,12 +278,6 @@ struct _MetaWindow
   /* x/y/w/h here get filled with ConfigureRequest values */
   XSizeHints size_hints;
 
-  /* struts */
-  int left_strut;
-  int right_strut;
-  int top_strut;
-  int bottom_strut;
-  
   /* Managed by stack.c */
   MetaStackLayer layer;
   int stack_position; /* see comment in stack.h */
@@ -350,6 +352,8 @@ void        meta_window_fill_vertical   
  */
 void        meta_window_queue_move_resize  (MetaWindow  *window);
 
+void        meta_window_update_struts      (MetaWindow  *window);
+
 /* this gets root coords */
 void        meta_window_get_position       (MetaWindow  *window,
                                             int         *x,
@@ -418,6 +422,8 @@ void meta_window_set_gravity (MetaWindow
 
 void meta_window_handle_mouse_grab_op_event (MetaWindow *window,
                                              XEvent     *event);
+
+GList* meta_window_get_workspaces (MetaWindow *window);
 
 gboolean meta_window_visible_on_workspace (MetaWindow    *window,
                                            MetaWorkspace *workspace);
Index: workspace.c
===================================================================
RCS file: /cvs/gnome/metacity/src/workspace.c,v
retrieving revision 1.43
diff -p -u -r1.43 workspace.c
--- workspace.c	30 May 2003 20:24:00 -0000	1.43
+++ workspace.c	11 Jun 2003 03:15:00 -0000
@@ -48,6 +48,11 @@ meta_workspace_new (MetaScreen *screen)
   workspace->all_work_areas.y = 0;
   workspace->all_work_areas.width = 0;
   workspace->all_work_areas.height = 0;
+
+  workspace->left_struts = NULL;
+  workspace->right_struts = NULL;
+  workspace->top_struts = NULL;
+  workspace->bottom_struts = NULL;
   
   return workspace;
 }
@@ -86,6 +91,12 @@ meta_workspace_free (MetaWorkspace *work
     g_list_remove (workspace->screen->workspaces, workspace);
   
   g_free (workspace->work_areas);
+
+  g_slist_free (workspace->left_struts);
+  g_slist_free (workspace->right_struts);
+  g_slist_free (workspace->top_struts);
+  g_slist_free (workspace->bottom_struts);
+
   g_free (workspace);
 
   /* don't bother to reset names, pagers can just ignore
@@ -105,7 +116,7 @@ meta_workspace_add_window (MetaWorkspace
   meta_window_set_current_workspace_hint (window);
   
   meta_window_queue_calc_showing (window);
-  if (window->has_struts)
+  if (window->struts)
     {
       meta_topic (META_DEBUG_WORKAREA,
                   "Invalidating work area of workspace %d since we're adding window %s to it\n",
@@ -132,7 +143,7 @@ meta_workspace_remove_window (MetaWorksp
   
   meta_window_queue_calc_showing (window);
 
-  if (window->has_struts)
+  if (window->struts)
     {
       meta_topic (META_DEBUG_WORKAREA,
                   "Invalidating work area of workspace %d since we're removing window %s from it\n",
@@ -375,6 +386,15 @@ ensure_work_areas_validated (MetaWorkspa
   if (!workspace->work_areas_invalid)
     return;
       
+  g_slist_free (workspace->left_struts);
+  workspace->left_struts = NULL;
+  g_slist_free (workspace->right_struts);
+  workspace->right_struts = NULL;
+  g_slist_free (workspace->top_struts);
+  workspace->top_struts = NULL;
+  g_slist_free (workspace->bottom_struts);
+  workspace->bottom_struts = NULL;
+
   windows = meta_workspace_list_windows (workspace);
 
   g_free (workspace->work_areas);
@@ -394,33 +414,76 @@ ensure_work_areas_validated (MetaWorkspa
         {
           MetaWindow *w = tmp->data;
 
-          if (w->has_struts && 
-              (meta_screen_window_intersects_xinerama (w->screen, w, i)))
+          if (w->struts)
             {
               meta_topic (META_DEBUG_WORKAREA,
                           "Merging win %s with %d %d %d %d "
                           "with %d %d %d %d\n",
                           w->desc,
-                          w->left_strut, w->right_strut, 
-                          w->top_strut, w->bottom_strut,
+                          w->struts->left.width, w->struts->right.width, 
+                          w->struts->top.height, w->struts->bottom.height,
                           left_strut, right_strut, 
                           top_strut, bottom_strut);
 
-              left_strut = MAX (left_strut, 
-                                w->left_strut - 
-                                workspace->screen->xinerama_infos[i].x_origin);
-              all_left_strut = MAX (all_left_strut, w->left_strut);
-
-              right_strut = MAX (right_strut, w->right_strut);
-              all_right_strut = MAX (all_right_strut, w->right_strut);
-
-              top_strut = MAX (top_strut,
-                               w->top_strut - 
-                               workspace->screen->xinerama_infos[i].y_origin);
-              all_top_strut = MAX (all_top_strut, w->top_strut);
-
-              bottom_strut = MAX (bottom_strut, w->bottom_strut);
-              all_bottom_strut = MAX (all_bottom_strut, w->bottom_strut);
+              if ((i == 0) && (w->struts->left.width > 0))
+                {
+                  workspace->left_struts = g_slist_prepend (workspace->left_struts,
+                                                            &w->struts->left);
+                }
+
+              if (meta_screen_rect_intersects_xinerama (w->screen,
+                                                        &w->struts->left,
+                                                        i))
+                {
+                  left_strut = MAX (left_strut, 
+                                    w->struts->left.width - 
+                                    workspace->screen->xinerama_infos[i].x_origin);
+                  all_left_strut = MAX (all_left_strut, w->struts->left.width);
+                }
+
+              if ((i == 0) && (w->struts->right.width > 0))
+                {
+                  workspace->right_struts = g_slist_prepend (workspace->right_struts,
+							     &w->struts->right);
+                }
+
+              if (meta_screen_rect_intersects_xinerama (w->screen,
+                                                        &w->struts->right,
+                                                        i))
+                {
+                  right_strut = MAX (right_strut, w->struts->right.width);
+                  all_right_strut = MAX (all_right_strut, w->struts->right.width);
+                }
+
+              if ((i == 0) && (w->struts->top.height > 0))
+                {
+                  workspace->top_struts = g_slist_prepend (workspace->top_struts,
+                                                           &w->struts->top);
+                }
+
+              if (meta_screen_rect_intersects_xinerama (w->screen,
+                                                        &w->struts->top,
+                                                        i))
+                {
+                  top_strut = MAX (top_strut,
+                                   w->struts->top.height - 
+                                   workspace->screen->xinerama_infos[i].y_origin);
+                  all_top_strut = MAX (all_top_strut, w->struts->top.height);
+                }
+
+              if ((i == 0) && (w->struts->bottom.height > 0))
+                {
+                  workspace->bottom_struts = g_slist_prepend (workspace->bottom_struts,
+                                                              &w->struts->bottom);
+                }
+
+              if (meta_screen_rect_intersects_xinerama (w->screen,
+                                                        &w->struts->bottom,
+                                                        i))
+                {
+                  bottom_strut = MAX (bottom_strut, w->struts->bottom.height);
+                  all_bottom_strut = MAX (all_bottom_strut, w->struts->bottom.height);
+                }
             }
           
           tmp = tmp->next;
@@ -451,10 +514,6 @@ ensure_work_areas_validated (MetaWorkspa
           bottom_strut = top_strut;
         }
 
-      /* FIXME even if we take struts to apply only to xineramas
-       * that the strut-specifying window overlaps, is it right
-       * to make the struts *relative to* the xinerama?
-       */
       workspace->work_areas[i].x = 
         left_strut + workspace->screen->xinerama_infos[i].x_origin;
       workspace->work_areas[i].y = top_strut + 
@@ -467,7 +526,7 @@ ensure_work_areas_validated (MetaWorkspa
         top_strut - bottom_strut;
 
       meta_topic (META_DEBUG_WORKAREA,
-                  "Computed [unused] work area for workspace %d "
+                  "Computed work area for workspace %d "
                   "xinerama %d: %d,%d %d x %d\n",
                   meta_workspace_index (workspace),
                   i,
@@ -507,19 +566,6 @@ ensure_work_areas_validated (MetaWorkspa
     workspace->screen->width - all_left_strut - all_right_strut;
   workspace->all_work_areas.height = 
     workspace->screen->height - all_top_strut - all_bottom_strut;
-
-  /* FIXME Here we disable all the per-xinerama work done earlier,
-   * because we don't have a spec for how it should work yet.
-   * If we do rely on which windows overlap what, work areas
-   * will need to be invalidated when we change a strut-setting
-   * window's size/position in move_resize_internal
-   */
-  i = 0;
-  while (i < workspace->screen->n_xinerama_infos)
-    {
-      workspace->work_areas[i] = workspace->all_work_areas;
-      ++i;
-    }
   
   workspace->work_areas_invalid = FALSE;
 
Index: workspace.h
===================================================================
RCS file: /cvs/gnome/metacity/src/workspace.h,v
retrieving revision 1.15
diff -p -u -r1.15 workspace.h
--- workspace.h	30 May 2003 20:24:00 -0000	1.15
+++ workspace.h	11 Jun 2003 03:15:00 -0000
@@ -42,8 +42,11 @@ struct _MetaWorkspace
   GList *windows;
 
   MetaRectangle all_work_areas;
-  
   MetaRectangle *work_areas;
+  GSList *left_struts;
+  GSList *right_struts;
+  GSList *top_struts;
+  GSList *bottom_struts;
   guint work_areas_invalid : 1;
 };
 
Index: tools/metacity-window-demo.c
===================================================================
RCS file: /cvs/gnome/metacity/src/tools/metacity-window-demo.c,v
retrieving revision 1.14
diff -p -u -r1.14 metacity-window-demo.c
--- tools/metacity-window-demo.c	18 Oct 2002 06:05:09 -0000	1.14
+++ tools/metacity-window-demo.c	11 Jun 2003 03:15:01 -0000
@@ -33,19 +33,27 @@ set_gdk_window_struts (GdkWindow *window
                        int        top,
                        int        bottom)
 {
-  long vals[4];
+  long vals[12];
   
   vals[0] = left;
   vals[1] = right;
   vals[2] = top;
   vals[3] = bottom;
-  
+  vals[4] = 000;
+  vals[5] = 400;
+  vals[6] = 200;
+  vals[7] = 600;
+  vals[8] = 76;
+  vals[9] = 676;
+  vals[10] = 200;
+  vals[11] = 800;
+
   XChangeProperty (GDK_WINDOW_XDISPLAY (window),
                    GDK_WINDOW_XWINDOW (window),
                    XInternAtom (GDK_WINDOW_XDISPLAY (window),
-                                "_NET_WM_STRUT", False),
+                                "_NET_WM_STRUT_PARTIAL", False),
                    XA_CARDINAL, 32, PropModeReplace,
-                   (guchar *)vals, 4);
+                   (guchar *)vals, 12);
 }
 
 static void
@@ -441,6 +449,7 @@ border_only_cb (gpointer             cal
   gtk_widget_show_all (window);
 }
 
+#if 0
 static void
 changing_icon_cb (gpointer             callback_data,
                   guint                callback_action,
@@ -462,6 +471,7 @@ changing_icon_cb (gpointer             c
   
   gtk_widget_show_all (window);
 }
+#endif
 
 static gboolean
 focus_in_event_cb (GtkWidget *window,
@@ -473,6 +483,8 @@ focus_in_event_cb (GtkWidget *window,
   widget = GTK_WIDGET (data);
 
   gtk_label_set_text (GTK_LABEL (widget), "Has focus");
+
+  return TRUE;
 }
 
 
@@ -486,6 +498,8 @@ focus_out_event_cb (GtkWidget *window,
   widget = GTK_WIDGET (data);
 
   gtk_label_set_text (GTK_LABEL (widget), "Not focused");
+  
+  return TRUE;
 }
 
 static GtkWidget*
@@ -583,26 +597,26 @@ make_dock (int type)
   switch (type)
     {
     case DOCK_LEFT:
-      gtk_widget_set_size_request (window, DOCK_SIZE, gdk_screen_height ());
-      gtk_window_move (GTK_WINDOW (window), 0, 0);
+      gtk_widget_set_size_request (window, DOCK_SIZE, 400);
+      gtk_window_move (GTK_WINDOW (window), 0, 000);
       set_gtk_window_struts (window, DOCK_SIZE, 0, 0, 0);
       gtk_window_set_title (GTK_WINDOW (window), "LeftDock");
       break;
     case DOCK_RIGHT:      
-      gtk_widget_set_size_request (window, DOCK_SIZE, gdk_screen_height ());
-      gtk_window_move (GTK_WINDOW (window), gdk_screen_width () - DOCK_SIZE, 0);
+      gtk_widget_set_size_request (window, DOCK_SIZE, 400);
+      gtk_window_move (GTK_WINDOW (window), gdk_screen_width () - DOCK_SIZE, 200);
       set_gtk_window_struts (window, 0, DOCK_SIZE, 0, 0);
       gtk_window_set_title (GTK_WINDOW (window), "RightDock");
       break;
     case DOCK_TOP:
-      gtk_widget_set_size_request (window, gdk_screen_width (), DOCK_SIZE);
-      gtk_window_move (GTK_WINDOW (window), 0, 0);
+      gtk_widget_set_size_request (window, 600, DOCK_SIZE);
+      gtk_window_move (GTK_WINDOW (window), 76, 0);
       set_gtk_window_struts (window, 0, 0, DOCK_SIZE, 0);
       gtk_window_set_title (GTK_WINDOW (window), "TopDock");
       break;
     case DOCK_BOTTOM:
-      gtk_widget_set_size_request (window, gdk_screen_width (), DOCK_SIZE);
-      gtk_window_move (GTK_WINDOW (window), 0, gdk_screen_height () - DOCK_SIZE);
+      gtk_widget_set_size_request (window, 600, DOCK_SIZE);
+      gtk_window_move (GTK_WINDOW (window), 200, gdk_screen_height () - DOCK_SIZE);
       set_gtk_window_struts (window, 0, 0, 0, DOCK_SIZE);
       gtk_window_set_title (GTK_WINDOW (window), "BottomDock");
       break;
