Index: metacity/src/display.c
===================================================================
RCS file: /cvs/gnome/metacity/src/display.c,v
retrieving revision 1.163
diff -u -p -r1.163 display.c
--- metacity/src/display.c	22 Nov 2002 06:00:18 -0000	1.163
+++ metacity/src/display.c	25 Nov 2002 14:21:22 -0000
@@ -860,8 +860,8 @@ grab_op_is_mouse (MetaGrabOp op)
     }
 }
 
-static gboolean
-grab_op_is_keyboard (MetaGrabOp op)
+gboolean
+meta_display_grab_op_is_keyboard (MetaGrabOp op)
 {
   switch (op)
     {
@@ -1097,7 +1097,7 @@ event_callback (XEvent   *event,
            grab_op_is_mouse (display->grab_op) &&
            display->grab_button != (int) event->xbutton.button && 
            display->grab_window == window) ||
-          grab_op_is_keyboard (display->grab_op))
+          meta_display_grab_op_is_keyboard (display->grab_op))
         {
           meta_verbose ("Ending grab op %d on window %s due to button press\n",
                         display->grab_op,
@@ -2445,7 +2445,7 @@ meta_display_begin_grab_op (MetaDisplay 
       return FALSE;
     }
 
-  if (grab_op_is_keyboard (op))
+  if (meta_display_grab_op_is_keyboard (op))
     {
       if (window)
         display->grab_have_keyboard =
@@ -2494,6 +2494,8 @@ meta_display_begin_grab_op (MetaDisplay 
   g_assert (display->grab_window != NULL || display->grab_screen != NULL);
   g_assert (display->grab_op != META_GRAB_OP_NONE);
 
+  window->display->grab_wireframe_pos = display->grab_current_window_pos;
+
   /* Do this last, after everything is set up. */
   switch (op)
     {
@@ -2546,7 +2548,45 @@ meta_display_end_grab_op (MetaDisplay *d
        */
       display->ungrab_should_not_cause_focus_window = display->grab_xwindow;
     }
-  
+  if (meta_prefs_get_wireframe_move_resize ())
+    {
+      switch (display->grab_op)
+	{
+	case META_GRAB_OP_KEYBOARD_MOVING:
+	case META_GRAB_OP_MOVING:
+	  meta_window_end_wireframe_move_resize (display->grab_window, FALSE, 
+						 display->grab_wireframe_pos.x,
+						 display->grab_wireframe_pos.y,
+						 0,0);
+	  break;
+	case META_GRAB_OP_RESIZING_SE:
+	case META_GRAB_OP_RESIZING_S:
+	case META_GRAB_OP_RESIZING_SW:
+	case META_GRAB_OP_RESIZING_N:
+	case META_GRAB_OP_RESIZING_NE:
+	case META_GRAB_OP_RESIZING_NW:
+	case META_GRAB_OP_RESIZING_W:
+	case META_GRAB_OP_RESIZING_E:
+	case META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN:
+	case META_GRAB_OP_KEYBOARD_RESIZING_S:
+	case META_GRAB_OP_KEYBOARD_RESIZING_N:
+	case META_GRAB_OP_KEYBOARD_RESIZING_W:
+	case META_GRAB_OP_KEYBOARD_RESIZING_E:
+	case META_GRAB_OP_KEYBOARD_RESIZING_SE:
+	case META_GRAB_OP_KEYBOARD_RESIZING_NE:
+	case META_GRAB_OP_KEYBOARD_RESIZING_SW:
+	case META_GRAB_OP_KEYBOARD_RESIZING_NW:
+	  meta_window_end_wireframe_move_resize (display->grab_window, TRUE, 
+						 display->grab_wireframe_pos.x,
+						 display->grab_wireframe_pos.y,
+						 display->grab_wireframe_pos.width,
+						 display->grab_wireframe_pos.height);
+	  break;
+
+	default:
+	  break;
+	}
+    }
   if (display->grab_have_pointer)
     {
       meta_topic (META_DEBUG_WINDOW_OPS,
Index: metacity/src/display.h
===================================================================
RCS file: /cvs/gnome/metacity/src/display.h,v
retrieving revision 1.90
diff -u -p -r1.90 display.h
--- metacity/src/display.h	3 Nov 2002 23:42:21 -0000	1.90
+++ metacity/src/display.h	25 Nov 2002 14:21:22 -0000
@@ -233,6 +233,7 @@ struct _MetaDisplay
   MetaRectangle grab_current_window_pos;
   MetaResizePopup *grab_resize_popup;
   GTimeVal    grab_last_moveresize_time;
+  MetaRectangle grab_wireframe_pos;
   
 
   /* Keybindings stuff */
@@ -400,5 +401,7 @@ gboolean meta_rectangle_intersect (MetaR
 void meta_display_devirtualize_modifiers (MetaDisplay        *display,
                                           MetaVirtualModifier modifiers,
                                           unsigned int       *mask);
+
+gboolean meta_display_grab_op_is_keyboard (MetaGrabOp op);
 
 #endif
Index: metacity/src/keybindings.c
===================================================================
RCS file: /cvs/gnome/metacity/src/keybindings.c,v
retrieving revision 1.72
diff -u -p -r1.72 keybindings.c
--- metacity/src/keybindings.c	6 Nov 2002 16:00:56 -0000	1.72
+++ metacity/src/keybindings.c	25 Nov 2002 14:21:22 -0000
@@ -1481,7 +1481,13 @@ process_keyboard_move_grab (MetaDisplay 
   if (is_modifier (display, event->xkey.keycode))
     return TRUE;
 
-  meta_window_get_position (window, &x, &y);
+  if (meta_prefs_get_wireframe_move_resize ())
+    {
+      x = display->grab_wireframe_pos.x;
+      y = display->grab_wireframe_pos.y;
+    }
+  else
+    meta_window_get_position (window, &x, &y);
 
   smart_snap = (event->xkey.state & ShiftMask) != 0;
 
@@ -1558,12 +1564,100 @@ process_keyboard_move_grab (MetaDisplay 
 
   if (handled)
     {
-      meta_window_move (window, TRUE, x, y);
-      meta_window_warp_pointer (window, display->grab_op);
+      if (meta_prefs_get_wireframe_move_resize ())
+	{
+	  window->display->grab_wireframe_pos.x = x;
+	  window->display->grab_wireframe_pos.y = y;
+
+	  XWarpPointer (display->xdisplay,
+			None,
+			window->screen->xroot,
+			0, 0, 0, 0, 
+			display->grab_wireframe_pos.x + display->grab_wireframe_pos.width / 2, 
+			display->grab_wireframe_pos.y + display->grab_wireframe_pos.height / 2);
+	}
+      else
+	{
+	  meta_window_move (window, TRUE, x, y);
+	  meta_window_warp_pointer (window, display->grab_op);
+	}
     }
 
   return handled;
 }
+static gboolean warp_pointer_on_root (MetaWindow *window)
+{
+  int x,y;
+
+  /* position wrt to the wireframe */
+  
+  switch (window->display->grab_op)
+    {
+      case META_GRAB_OP_KEYBOARD_MOVING:
+      case META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN:
+        x = window->display->grab_wireframe_pos.width / 2;
+        y = window->display->grab_wireframe_pos.height / 2;
+        break;
+
+      case META_GRAB_OP_KEYBOARD_RESIZING_S:
+        x = window->display->grab_wireframe_pos.width / 2;
+        y = window->display->grab_wireframe_pos.height;
+        break;
+
+      case META_GRAB_OP_KEYBOARD_RESIZING_N:
+        x = window->display->grab_wireframe_pos.width / 2;
+        y = 0;
+        break;
+
+      case META_GRAB_OP_KEYBOARD_RESIZING_W:
+        x = 0;
+        y = window->display->grab_wireframe_pos.height / 2;
+        break;
+
+      case META_GRAB_OP_KEYBOARD_RESIZING_E:
+        x = window->display->grab_wireframe_pos.width;
+        y = window->display->grab_wireframe_pos.height / 2;
+        break;
+
+      case META_GRAB_OP_KEYBOARD_RESIZING_SE:
+        x = window->display->grab_wireframe_pos.width;
+        y = window->display->grab_wireframe_pos.height;
+        break;
+
+      case META_GRAB_OP_KEYBOARD_RESIZING_NE:
+        x = window->display->grab_wireframe_pos.width;
+        y = 0;
+        break;
+
+      case META_GRAB_OP_KEYBOARD_RESIZING_SW:
+        x = 0;
+        y = window->display->grab_wireframe_pos.height;
+        break;
+
+      case META_GRAB_OP_KEYBOARD_RESIZING_NW:
+        x = 0;
+        y = 0;
+        break;
+
+      default:
+        return FALSE;
+    }
+  /* position wrt to root */
+
+  x += window->display->grab_wireframe_pos.x;
+  y += window->display->grab_wireframe_pos.y;
+
+  XWarpPointer (window->display->xdisplay,
+		None,
+		window->screen->xroot,
+		0, 0, 0, 0,
+		x, y);
+
+  window->display->grab_current_root_x = x;
+  window->display->grab_current_root_y = y;
+
+  return TRUE;
+}
 
 static gboolean
 process_keyboard_resize_grab (MetaDisplay *display,
@@ -1714,11 +1808,22 @@ process_keyboard_resize_grab (MetaDispla
       return TRUE; 
     } 
 
-  meta_window_get_position (window, &orig_x, &orig_y);
+  if (meta_prefs_get_wireframe_move_resize ())
+    {
+      orig_x = window->display->grab_wireframe_pos.x;
+      orig_y = window->display->grab_wireframe_pos.y;
+      width = window->display->grab_wireframe_pos.width;
+      height = window->display->grab_wireframe_pos.height;
+    }
+  else
+    {
+      meta_window_get_position (window, &orig_x, &orig_y);
+      width = window->rect.width;
+      height = window->rect.height;
+    }
+  
   x = orig_x;
   y = orig_y;
-  width = window->rect.width;
-  height = window->rect.height;
 
   gravity = meta_resize_gravity_from_grab_op (display->grab_op);
   
@@ -1938,11 +2043,27 @@ process_keyboard_resize_grab (MetaDispla
     height = 1;
   if (width < 1)
     width = 1;
-  
+
   if (handled)
     {
-      meta_window_move_resize (window, TRUE, x, y, width, height);
-      meta_window_update_resize_grab_op (window, FALSE);
+      if (meta_prefs_get_wireframe_move_resize ())
+	{
+	  if (x >= window->display->grab_initial_window_pos.x + 
+	      window->display->grab_initial_window_pos.width)
+	    return handled;
+	  if (y >= window->display->grab_initial_window_pos.y + 
+	      window->display->grab_initial_window_pos.height)
+	    return handled;
+	  
+	  meta_window_draw_wireframe (window, x, y, width, height, FALSE);
+	  warp_pointer_on_root (window);
+	  meta_window_refresh_resize_popup (window);
+	}
+      else
+	{
+	  meta_window_move_resize (window, TRUE, x, y, width, height);
+	  meta_window_update_resize_grab_op (window, FALSE);
+	}
     }
 
   return handled;
Index: metacity/src/metacity.schemas.in
===================================================================
RCS file: /cvs/gnome/metacity/src/metacity.schemas.in,v
retrieving revision 1.18
diff -u -p -r1.18 metacity.schemas.in
--- metacity/src/metacity.schemas.in	3 Nov 2002 19:06:39 -0000	1.18
+++ metacity/src/metacity.schemas.in	25 Nov 2002 14:21:22 -0000
@@ -1629,6 +1629,20 @@ you set
 
       </locale>
     </schema>
+    
+    <schema>
+      <key>/schemas/apps/metacity/sun_extensions/wireframe_move_resize</key>
+      <applyto>/apps/metacity/sun_extensions/wireframe_move_resize</applyto>      
+      <owner>metacity</owner>
+      <type>bool</type>
+      <default>false</default>
+      <locale name="C">
+         <short>Enable wireframe move/resize</short>
+         <long>If enabled display the wireframe shape of the window
+	       instead of the content of the window when moving and
+	       resizing the window</long>
+      </locale>
+    </schema>
 
 
   </schemalist>  
Index: metacity/src/prefs.c
===================================================================
RCS file: /cvs/gnome/metacity/src/prefs.c,v
retrieving revision 1.31
diff -u -p -r1.31 prefs.c
--- metacity/src/prefs.c	20 Nov 2002 04:54:01 -0000	1.31
+++ metacity/src/prefs.c	25 Nov 2002 14:21:22 -0000
@@ -38,6 +38,7 @@
 #define KEY_ACTION_DOUBLE_CLICK_TITLEBAR "/apps/metacity/general/action_double_click_titlebar"
 #define KEY_AUTO_RAISE "/apps/metacity/general/auto_raise"
 #define KEY_AUTO_RAISE_DELAY "/apps/metacity/general/auto_raise_delay"
+#define KEY_WIREFRAME_MOVE_RESIZE "/apps/metacity/sun_extensions/wireframe_move_resize"
 #define KEY_THEME "/apps/metacity/general/theme"
 #define KEY_USE_SYSTEM_FONT  "/apps/metacity/general/titlebar_uses_system_font"
 #define KEY_TITLEBAR_FONT "/apps/metacity/general/titlebar_font"
@@ -68,6 +69,7 @@ static gboolean application_based = FALS
 static gboolean disable_workarounds = FALSE;
 static gboolean auto_raise = FALSE;
 static gboolean auto_raise_delay = 500;
+static gboolean wireframe_move_resize = TRUE;
 static MetaButtonLayout button_layout = {
   {
     META_BUTTON_FUNCTION_MENU,
@@ -109,6 +111,7 @@ static gboolean update_binding          
                                            const char  *value);
 static gboolean update_command            (const char  *name,
                                            const char  *value);
+static gboolean update_wireframe_move_resize     (gboolean     value);
 static void     init_commands             (void);
 static gboolean update_workspace_name     (const char  *name,
                                            const char  *value);
@@ -341,6 +344,11 @@ meta_prefs_init (void)
   update_button_layout (str_val);
   g_free (str_val);
   
+  bool_val = gconf_client_get_bool (default_client, KEY_WIREFRAME_MOVE_RESIZE,
+				    &err);
+  cleanup_error (&err);
+  update_wireframe_move_resize (bool_val);
+
   /* Load keybindings prefs */
   init_bindings ();
 
@@ -651,6 +659,22 @@ change_notify (GConfClient    *client,
 
       if (update_button_layout (str))
         queue_changed (META_PREF_BUTTON_LAYOUT);
+    } 
+  else if (strcmp (key, KEY_WIREFRAME_MOVE_RESIZE) == 0)
+    {
+      gboolean b;
+
+      if (value && value->type != GCONF_VALUE_BOOL)
+        {
+          meta_warning (_("GConf key \"%s\" is set to an invalid type\n"),
+                        KEY_WIREFRAME_MOVE_RESIZE);
+          goto out;
+        }
+
+      b = value ? gconf_value_get_bool (value) : wireframe_move_resize;
+
+      if (update_wireframe_move_resize (b))
+        queue_changed (META_PREF_WIREFRAME_MOVE_RESIZE);
     }
   else
     {
@@ -1090,6 +1114,16 @@ update_auto_raise_delay (int value)
   return old != auto_raise_delay;
 }
 
+static gboolean 
+update_wireframe_move_resize (gboolean value)
+{
+  gboolean old = wireframe_move_resize;
+  
+  wireframe_move_resize = value;
+
+  return old != wireframe_move_resize;
+}
+
 const char*
 meta_preference_to_string (MetaPreference pref)
 {
@@ -1708,6 +1742,12 @@ int
 meta_prefs_get_auto_raise_delay ()
 {
   return auto_raise_delay;
+}
+
+gboolean 
+meta_prefs_get_wireframe_move_resize ()
+{
+  return wireframe_move_resize;
 }
 
 MetaKeyBindingAction
Index: metacity/src/prefs.h
===================================================================
RCS file: /cvs/gnome/metacity/src/prefs.h,v
retrieving revision 1.24
diff -u -p -r1.24 prefs.h
--- metacity/src/prefs.h	3 Nov 2002 19:06:39 -0000	1.24
+++ metacity/src/prefs.h	25 Nov 2002 14:21:22 -0000
@@ -42,6 +42,7 @@ typedef enum
   META_PREF_DISABLE_WORKAROUNDS,
   META_PREF_COMMANDS,
   META_PREF_BUTTON_LAYOUT,
+  META_PREF_WIREFRAME_MOVE_RESIZE,
   META_PREF_WORKSPACE_NAMES
 } MetaPreference;
 
@@ -66,6 +67,7 @@ gboolean                    meta_prefs_g
 gboolean                    meta_prefs_get_disable_workarounds (void);
 gboolean                    meta_prefs_get_auto_raise         (void);
 int                         meta_prefs_get_auto_raise_delay   (void);
+gboolean                    meta_prefs_get_wireframe_move_resize (void);
 
 const char*                 meta_prefs_get_command            (int i);
 
Index: metacity/src/screen.c
===================================================================
RCS file: /cvs/gnome/metacity/src/screen.c,v
retrieving revision 1.92
diff -u -p -r1.92 screen.c
--- metacity/src/screen.c	21 Nov 2002 04:48:53 -0000	1.92
+++ metacity/src/screen.c	25 Nov 2002 14:21:22 -0000
@@ -537,6 +537,8 @@ meta_screen_new (MetaDisplay *display,
   screen->starting_corner = META_SCREEN_TOPLEFT;
 
   screen->showing_desktop = FALSE;
+
+  screen->xor_gc = NULL;
   
   screen->xinerama_infos = NULL;
   screen->n_xinerama_infos = 0;
Index: metacity/src/screen.h
===================================================================
RCS file: /cvs/gnome/metacity/src/screen.h,v
retrieving revision 1.40
diff -u -p -r1.40 screen.h
--- metacity/src/screen.h	25 Oct 2002 23:35:50 -0000	1.40
+++ metacity/src/screen.h	25 Nov 2002 14:21:22 -0000
@@ -98,6 +98,8 @@ struct _MetaScreen
   guint showing_desktop : 1;
   
   int closing;
+
+  GC xor_gc;
 };
 
 MetaScreen*   meta_screen_new                 (MetaDisplay                *display,
Index: metacity/src/window.c
===================================================================
RCS file: /cvs/gnome/metacity/src/window.c,v
retrieving revision 1.245
diff -u -p -r1.245 window.c
--- metacity/src/window.c	22 Nov 2002 06:00:18 -0000	1.245
+++ metacity/src/window.c	25 Nov 2002 14:21:22 -0000
@@ -6045,7 +6045,12 @@ update_move (MetaWindow  *window,
       ABS (dx) < MOVE_THRESHOLD && ABS (dy) < MOVE_THRESHOLD)
     return;
   
-  meta_window_move (window, TRUE, new_x, new_y);
+  if (!meta_prefs_get_wireframe_move_resize ())
+    meta_window_move (window, TRUE, new_x, new_y);
+  else
+    meta_window_draw_wireframe (window, new_x, new_y,
+			  window->rect.width, 
+			  window->rect.height, FALSE);
 }
 
 static void
@@ -6053,33 +6058,36 @@ update_resize (MetaWindow *window,
                int x, int y)
 {
   int dx, dy;
-  int new_w, new_h;
   int gravity;
-  
+  int new_x, new_y, new_w, new_h;
+	  
   dx = x - window->display->grab_current_root_x;
   dy = y - window->display->grab_current_root_y;
 
+  new_x = window->display->grab_current_window_pos.x;
+  new_y = window->display->grab_current_window_pos.y;
   new_w = window->display->grab_current_window_pos.width;
   new_h = window->display->grab_current_window_pos.height;
 
+  if (meta_prefs_get_wireframe_move_resize ())
+    {
+      if (meta_display_grab_op_is_keyboard (window->display->grab_op))
+	return;
+    }
+
   switch (window->display->grab_op)
     {
     case META_GRAB_OP_RESIZING_SE:
     case META_GRAB_OP_RESIZING_NE:
     case META_GRAB_OP_RESIZING_E:
-    case META_GRAB_OP_KEYBOARD_RESIZING_SE:
-    case META_GRAB_OP_KEYBOARD_RESIZING_NE:
-    case META_GRAB_OP_KEYBOARD_RESIZING_E:
       new_w += dx;
       break;
 
     case META_GRAB_OP_RESIZING_NW:
     case META_GRAB_OP_RESIZING_SW:
     case META_GRAB_OP_RESIZING_W:
-    case META_GRAB_OP_KEYBOARD_RESIZING_NW:
-    case META_GRAB_OP_KEYBOARD_RESIZING_SW:
-    case META_GRAB_OP_KEYBOARD_RESIZING_W:
       new_w -= dx;
+      new_x += dx;
       break;
       
     default:
@@ -6091,19 +6099,14 @@ update_resize (MetaWindow *window,
     case META_GRAB_OP_RESIZING_SE:
     case META_GRAB_OP_RESIZING_S:
     case META_GRAB_OP_RESIZING_SW:
-    case META_GRAB_OP_KEYBOARD_RESIZING_SE:
-    case META_GRAB_OP_KEYBOARD_RESIZING_S:
-    case META_GRAB_OP_KEYBOARD_RESIZING_SW:
       new_h += dy;
       break;
       
     case META_GRAB_OP_RESIZING_N:
     case META_GRAB_OP_RESIZING_NE:
     case META_GRAB_OP_RESIZING_NW:
-    case META_GRAB_OP_KEYBOARD_RESIZING_N:
-    case META_GRAB_OP_KEYBOARD_RESIZING_NE:
-    case META_GRAB_OP_KEYBOARD_RESIZING_NW:
       new_h -= dy;
+      new_y += dy;
       break;
     default:
       break;
@@ -6121,7 +6124,18 @@ update_resize (MetaWindow *window,
   gravity = meta_resize_gravity_from_grab_op (window->display->grab_op);
   g_assert (gravity >= 0);
 
-  meta_window_resize_with_gravity (window, TRUE, new_w, new_h, gravity);
+  if (meta_prefs_get_wireframe_move_resize ())
+    {
+      if ((new_x + new_w <= new_x) || (new_y + new_h <= new_y))
+	  return;
+
+      meta_window_draw_wireframe (window, new_x, new_y, new_w, new_h, FALSE);
+      meta_window_refresh_resize_popup (window);
+    }
+  else
+    meta_window_resize_with_gravity (window, 
+				     TRUE, 
+				     new_w, new_h, gravity);
 }
 
 void
@@ -6373,7 +6387,7 @@ meta_window_refresh_resize_popup (MetaWi
   if (window->display->grab_resize_popup != NULL)
     {
       int gravity;
-      int x, y;
+      int x, y, width, height;
       MetaFrameGeometry fgeom;
 
       if (window->frame)
@@ -6389,23 +6403,36 @@ meta_window_refresh_resize_popup (MetaWi
       gravity = meta_resize_gravity_from_grab_op (window->display->grab_op);
       g_assert (gravity >= 0);
 
-      meta_window_get_position (window, &x, &y);
+      if (meta_prefs_get_wireframe_move_resize ())
+	{
+	  x = window->display->grab_wireframe_pos.x;
+	  y = window->display->grab_wireframe_pos.y;
+	  width = window->display->grab_wireframe_pos.width;
+	  height = window->display->grab_wireframe_pos.height;
+	}
+      else
+	{
+	  meta_window_get_position (window, &x, &y);
+	  width = window->rect.width;
+	  height = window->rect.height;
+	}
       
       meta_ui_resize_popup_set (window->display->grab_resize_popup,
-                                gravity,
-                                x, y,
-                                window->rect.width,
-                                window->rect.height,
-                                window->size_hints.base_width,
-                                window->size_hints.base_height,
-                                window->size_hints.min_width,
-                                window->size_hints.min_height,
-                                window->size_hints.width_inc,
-                                window->size_hints.height_inc,
-                                fgeom.left_width,
-                                fgeom.right_width,
-                                fgeom.top_height,
-                                fgeom.bottom_height);
+				gravity,
+				x,
+				y,
+				width,
+				height,
+				window->size_hints.base_width,
+				window->size_hints.base_height,
+				window->size_hints.min_width,
+				window->size_hints.min_height,
+				window->size_hints.width_inc,
+				window->size_hints.height_inc,
+				fgeom.left_width,
+				fgeom.right_width,
+				fgeom.top_height,
+				fgeom.bottom_height);
 
       meta_ui_resize_popup_set_showing (window->display->grab_resize_popup,
                                         TRUE);
@@ -6616,3 +6643,82 @@ meta_window_update_layer (MetaWindow *wi
     meta_stack_update_layer (window->screen->stack, window);
   meta_stack_thaw (window->screen->stack);
 }
+
+void meta_window_draw_wireframe (MetaWindow *window,
+			   int x, int y, int width, int height,
+			   gboolean final_draw)
+{
+  static gboolean remove_previous = FALSE;
+  static int old_x;
+  static int old_y;
+  static int old_width;
+  static int old_height;
+
+  if (!window->screen->xor_gc)
+    { /* create xor GC */
+      XGCValues gcv;
+      unsigned long mask;
+      
+      mask = GCFunction | GCLineWidth | GCSubwindowMode; 
+      gcv.function = GXinvert;
+      gcv.line_width = 2;
+      gcv.subwindow_mode = IncludeInferiors;
+      gcv.plane_mask = BlackPixelOfScreen (window->screen->xscreen) ^ WhitePixelOfScreen (window->screen->xscreen) | GCPlaneMask;
+      
+      window->screen->xor_gc = XCreateGC (window->display->xdisplay, 
+					  window->screen->xroot,
+					  mask, &gcv);
+    }
+
+  if (remove_previous)
+      XDrawRectangle (window->display->xdisplay,
+		      window->screen->xroot,
+		      window->screen->xor_gc, old_x, old_y, 
+		      old_width, old_height);
+  else
+    remove_previous = TRUE;
+      
+  if (!final_draw)
+    {
+      window->display->grab_wireframe_pos.x = x;
+      window->display->grab_wireframe_pos.y = y;
+      window->display->grab_wireframe_pos.width = width;
+      window->display->grab_wireframe_pos.height = height;
+
+      x -= window->frame->child_x;
+      y -= window->frame->child_y;
+      width += window->frame->right_width + window->frame->child_x;
+      height += window->frame->bottom_height + window->frame->child_y;
+      
+      old_x = x; old_y = y; old_width = width; old_height = height;
+
+      XDrawRectangle (window->display->xdisplay,
+		      window->screen->xroot,
+		      window->screen->xor_gc, x, y, width, height);
+    }
+  else
+    remove_previous = FALSE;
+}
+
+void 
+meta_window_end_wireframe_move_resize (MetaWindow *window,
+				       gboolean    resize,
+				       int	   x,
+				       int	   y,
+				       int	   width,
+				       int	   height)
+{
+  meta_window_draw_wireframe (window, 0,0,0,0, TRUE);
+
+  if (resize)
+    meta_window_move_resize (window, FALSE, x, y, width, height);
+  else
+    meta_window_move (window, FALSE, x, y);
+  
+  window->display->grab_wireframe_pos.x = 0;
+  window->display->grab_wireframe_pos.y = 0;
+  window->display->grab_wireframe_pos.width = 0;
+  window->display->grab_wireframe_pos.height = 0;
+}
+    
+					
Index: metacity/src/window.h
===================================================================
RCS file: /cvs/gnome/metacity/src/window.h,v
retrieving revision 1.77
diff -u -p -r1.77 window.h
--- metacity/src/window.h	4 Nov 2002 00:19:08 -0000	1.77
+++ metacity/src/window.h	25 Nov 2002 14:21:22 -0000
@@ -437,4 +437,14 @@ void meta_window_update_layer (MetaWindo
 gboolean meta_window_get_icon_geometry (MetaWindow    *window,
                                         MetaRectangle *rect);
 
+void meta_window_draw_wireframe	  (MetaWindow *window,
+				   int x, int y, int width, int height,
+				   gboolean final_draw);
+void meta_window_end_wireframe_move_resize (MetaWindow *window,
+					    gboolean    resize,
+					    int	   x,
+					    int	   y,
+					    int	   width,
+					    int	   height);
+
 #endif
