--- src/display.c	2006-12-15 14:20:14.000000000 +0000
+++ src/display.c	2006-12-15 14:48:51.000000000 +0000
@@ -19,6 +19,10 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  * 02111-1307, USA.
+ *
+ * Martin Kirby, 2006-12-15
+ * Send a synthetic configure notify event for Configure requests on
+ * withdrawn windows that have no effect.
  */
 
 #include <config.h>
@@ -1995,24 +1999,76 @@
        */
       if (window == NULL)
         {
-          unsigned int xwcm;
-          XWindowChanges xwc;
-          
-          xwcm = event->xconfigurerequest.value_mask &
-            (CWX | CWY | CWWidth | CWHeight | CWBorderWidth);
-
-          xwc.x = event->xconfigurerequest.x;
-          xwc.y = event->xconfigurerequest.y;
-          xwc.width = event->xconfigurerequest.width;
-          xwc.height = event->xconfigurerequest.height;
-          xwc.border_width = event->xconfigurerequest.border_width;
-
-          meta_verbose ("Configuring withdrawn window to %d,%d %dx%d border %d (some values may not be in mask)\n",
-                        xwc.x, xwc.y, xwc.width, xwc.height, xwc.border_width);
+          /* Martin Kirby, 2006-12-15
+           * 
+           * There is a problem with Xt because the current position in the server
+           * may not be known to Xt and it can expect a configure notify event
+           * even though there is no actual change.
+           */
+          int result;
+          XWindowAttributes attr;
           meta_error_trap_push (display);
-          XConfigureWindow (display->xdisplay, event->xconfigurerequest.window,
-                            xwcm, &xwc);
+          result = XGetWindowAttributes (display->xdisplay, 
+                                         event->xconfigurerequest.window, 
+                                         &attr);
           meta_error_trap_pop (display, FALSE);
+          if (result)
+            {
+              gboolean changed = 
+                  ((event->xconfigurerequest.value_mask & CWX) && (attr.x != event->xconfigurerequest.x)) ||
+                  ((event->xconfigurerequest.value_mask & CWY) && (attr.y != event->xconfigurerequest.y)) ||
+                  ((event->xconfigurerequest.value_mask & CWWidth) && (attr.width != event->xconfigurerequest.width)) ||
+                  ((event->xconfigurerequest.value_mask & CWHeight) && (attr.height != event->xconfigurerequest.height)) ||
+                  ((event->xconfigurerequest.value_mask & CWBorderWidth) && (attr.border_width != event->xconfigurerequest.border_width));
+              if (changed)
+                {
+                  unsigned int xwcm;
+                  XWindowChanges xwc;
+
+                  xwcm = event->xconfigurerequest.value_mask &
+                    (CWX | CWY | CWWidth | CWHeight | CWBorderWidth);
+
+                  xwc.x = event->xconfigurerequest.x;
+                  xwc.y = event->xconfigurerequest.y;
+                  xwc.width = event->xconfigurerequest.width;
+                  xwc.height = event->xconfigurerequest.height;
+                  xwc.border_width = event->xconfigurerequest.border_width;
+
+                  meta_verbose ("Configuring withdrawn window to %d,%d %dx%d border %d (some values may not be in mask)\n",
+                                xwc.x, xwc.y, xwc.width, xwc.height, xwc.border_width);
+                  meta_error_trap_push (display);
+                  XConfigureWindow (display->xdisplay, event->xconfigurerequest.window,
+                                    xwcm, &xwc);
+                  meta_error_trap_pop (display, FALSE);
+                }
+              else
+                {
+                  XConfigureEvent notify_event;
+                  
+	          notify_event.type = ConfigureNotify;
+	          notify_event.display = display;
+	          notify_event.event = event->xconfigurerequest.window;
+	          notify_event.window = event->xconfigurerequest.window;
+	          notify_event.x = event->xconfigurerequest.x;
+	          notify_event.y = event->xconfigurerequest.y;
+	          notify_event.width = event->xconfigurerequest.width;
+	          notify_event.height = event->xconfigurerequest.height;
+	          notify_event.border_width = event->xconfigurerequest.border_width;
+	          notify_event.above = None;
+	          notify_event.override_redirect = False;
+                  
+                  meta_topic (META_DEBUG_GEOMETRY,
+                              "Sending synthetic configure notify for withdrawn window to %d,%d %dx%d border %d\n",
+                              (int)notify_event.x, (int)notify_event.y,
+                              (int)notify_event.width, (int)notify_event.height,
+                              (int)notify_event.border_width);
+
+                  meta_error_trap_push (display);
+	          XSendEvent (display->xdisplay, event->xconfigurerequest.window, False,
+	              StructureNotifyMask, (XEvent *)&notify_event);
+                  meta_error_trap_pop (display, FALSE);
+                }
+            }
         }
       else
         {
--- src/window.c	2006-12-15 15:02:53.000000000 +0000
+++ src/window.c	2006-12-15 15:22:07.000000000 +0000
@@ -19,6 +19,10 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  * 02111-1307, USA.
+ *
+ * Martin Kirby, 2006-12-15
+ * Send a synthetic configure notify event for Configure requests where
+ * just the frame is resized.
  */
 
 #include <config.h>
@@ -2682,9 +2686,14 @@
   /* If this is a configure request and we change nothing, then we
    * must send configure notify.
    */
+  
+  /* Martin Kirby, the original code didn't send an event if the 
+   * client was neither moved nor resized but the frame was resized
+   * or moved and resized. 
+   */
   if  (is_configure_request &&
-       !(need_move_client || need_move_frame ||
-         need_resize_client || need_resize_frame ||
+       !(need_move_client || /* need_move_frame || */
+         need_resize_client  || /* need_resize_frame || */
          window->border_width != 0))
     need_configure_notify = TRUE;
 
