Index: window.c
===================================================================
--- window.c	(révision 1289)
+++ window.c	(copie de travail)
@@ -97,6 +97,11 @@ struct _WnckWindowPrivate
   int width;
   int height;
 
+  int left_frame;
+  int right_frame;
+  int top_frame;
+  int bottom_frame;
+
   char *startup_id;
 
   char *res_class;
@@ -145,6 +150,7 @@ struct _WnckWindowPrivate
   guint need_update_startup_id : 1;
   guint need_update_wmclass : 1;
   guint need_update_wmhints : 1;
+  guint need_update_frame_extents : 1;
 
   guint need_emit_name_changed : 1;
   guint need_emit_icon_changed : 1;
@@ -185,6 +191,7 @@ static void update_wintype   (WnckWindow
 static void update_transient_for (WnckWindow *window);
 static void update_startup_id (WnckWindow *window);
 static void update_wmclass    (WnckWindow *window);
+static void update_frame_extents (WnckWindow *window);
 static void unqueue_update   (WnckWindow *window);
 static void queue_update     (WnckWindow *window);
 static void force_update_now (WnckWindow *window);
@@ -480,6 +487,7 @@ _wnck_window_create (Window      xwindow
   window->priv->need_update_startup_id = TRUE;
   window->priv->need_update_wmclass = TRUE;
   window->priv->need_update_wmhints = TRUE;
+  window->priv->need_update_frame_extents = TRUE;
   window->priv->need_emit_name_changed = FALSE;
   window->priv->need_emit_icon_changed = FALSE;
   force_update_now (window);
@@ -1946,6 +1954,44 @@ wnck_window_get_state (WnckWindow *windo
 }
 
 /**
+ * wnck_window_get_client_window_geometry:
+ * @window: a #WnckWindow.
+ * @xp: return location for X coordinate in pixels of @window.
+ * @yp: return location for Y coordinate in pixels of @window.
+ * @widthp: return location for width in pixels of @window.
+ * @heightp: return location for height in pixels of @window.
+ *
+ * Gets the size and position of @window, as last received
+ * in a ConfigureNotify event (i.e. this call does not round-trip
+ * to the server, just gets the last size we were notified of).
+ * The X and Y coordinates are relative to the root window.
+ *
+ * The window manager usually adds a frame around windows. If
+ * you need to know the size of @window with the frame, use
+ * wnck_window_get_geometry().
+ *
+ * Since: 2.20
+ **/
+void
+wnck_window_get_client_window_geometry (WnckWindow *window,
+                                        int        *xp,
+					int        *yp,
+					int        *widthp,
+					int        *heightp)
+{
+  g_return_if_fail (WNCK_IS_WINDOW (window));
+
+  if (xp)
+    *xp = window->priv->x;
+  if (yp)
+    *yp = window->priv->y;
+  if (widthp)
+    *widthp = window->priv->width;
+  if (heightp)
+    *heightp = window->priv->height;
+}
+
+/**
  * wnck_window_get_geometry:
  * @window: a #WnckWindow.
  * @xp: return location for X coordinate in pixels of @window.
@@ -1957,6 +2003,10 @@ wnck_window_get_state (WnckWindow *windo
  * in a ConfigureNotify event (i.e. this call does not round-trip
  * to the server, just gets the last size we were notified of).
  * The X and Y coordinates are relative to the root window.
+ *
+ * The returned values take into account the frame that is added
+ * by the window manager around windows. If you need to know the
+ * actual size of @window, use wnck_window_get_client_window_geometry().
  **/
 void
 wnck_window_get_geometry (WnckWindow *window,
@@ -1968,13 +2018,13 @@ wnck_window_get_geometry (WnckWindow *wi
   g_return_if_fail (WNCK_IS_WINDOW (window));
 
   if (xp)
-    *xp = window->priv->x;
+    *xp = window->priv->x - window->priv->left_frame;
   if (yp)
-    *yp = window->priv->y;
+    *yp = window->priv->y - window->priv->top_frame;
   if (widthp)
-    *widthp = window->priv->width;
+    *widthp = window->priv->width + window->priv->left_frame + window->priv->right_frame;
   if (heightp)
-    *heightp = window->priv->height;
+    *heightp = window->priv->height + window->priv->top_frame + window->priv->bottom_frame;
 }
 
 /**
@@ -1989,6 +2039,13 @@ wnck_window_get_geometry (WnckWindow *wi
  *
  * Sets the size and position of @window. The X and Y coordinates should be
  * relative to the root window.
+ *
+ * Note that the new size and position apply to @window with its frame drawn
+ * by the window manager. Therefore, using wnck_window_set_geometry() with
+ * the values returned by wnck_window_get_geometry() should be a no-op, while
+ * using wnck_window_set_geometry() with the values returned by
+ * wnck_window_get_client_window_geometry() should reduce the size of @window
+ * and move it.
  **/
 void
 wnck_window_set_geometry (WnckWindow               *window,
@@ -2128,8 +2185,8 @@ wnck_window_is_in_viewport (WnckWindow  
 
   window_rect.x = window->priv->x + viewport_rect.x;
   window_rect.y = window->priv->y + viewport_rect.y;
-  window_rect.width = window->priv->width;
-  window_rect.height = window->priv->height;
+  window_rect.width = window->priv->width + window->priv->left_frame + window->priv->right_frame;
+  window_rect.height = window->priv->height + window->priv->top_frame + window->priv->bottom_frame;
 
   return gdk_rectangle_intersect (&viewport_rect, &window_rect, &window_rect);
 }
@@ -2249,6 +2306,12 @@ _wnck_window_process_property_notify (Wn
       window->priv->need_update_wmhints = TRUE;
       queue_update (window);
     }
+  else if (xevent->xproperty.atom ==
+           _wnck_atom_get ("_NET_FRAME_EXTENTS"))
+    {
+      window->priv->need_update_frame_extents = TRUE;
+      queue_update (window);
+    }
 }
 
 void
@@ -2461,17 +2524,7 @@ update_icon_name (WnckWindow *window)
 
   window->priv->need_update_icon_name = FALSE;
 
-  if (new_name == NULL)
-    new_name = _wnck_get_utf8_property (window->priv->xwindow,
-                                        _wnck_atom_get ("_NET_WM_VISIBLE_ICON_NAME"));
-
-  if (new_name == NULL)
-    new_name = _wnck_get_utf8_property (window->priv->xwindow,
-                                        _wnck_atom_get ("_NET_WM_ICON_NAME"));
-
-  if (new_name == NULL)
-    new_name = _wnck_get_text_property (window->priv->xwindow,
-                                        XA_WM_ICON_NAME);
+  new_name = _wnck_get_icon_name (window->priv->xwindow);
 
   if (!nullstr_equal (window->priv->icon_name, new_name))
     window->priv->need_emit_name_changed = TRUE;
@@ -2771,6 +2824,34 @@ update_wmhints (WnckWindow *window)
 }
 
 static void
+update_frame_extents (WnckWindow *window)
+{
+  int left, right, top, bottom;
+
+  if (!window->priv->need_update_frame_extents)
+    return;
+
+  window->priv->need_update_frame_extents = FALSE;
+
+  if (!_wnck_get_frame_extents (window->priv->xwindow,
+                                &left, &right, &top, &bottom))
+    return;
+
+  if (left   != window->priv->left_frame ||
+      right  != window->priv->right_frame ||
+      top    != window->priv->top_frame ||
+      bottom != window->priv->bottom_frame)
+    {
+      window->priv->left_frame   = left;
+      window->priv->right_frame  = right;
+      window->priv->top_frame    = top;
+      window->priv->bottom_frame = bottom;
+
+      emit_geometry_changed (window);
+    }
+}
+
+static void
 force_update_now (WnckWindow *window)
 {
   WnckWindowState old_state;
@@ -2805,6 +2886,7 @@ force_update_now (WnckWindow *window)
                               */
   update_workspace (window); /* emits signals */
   update_actions (window);
+  update_frame_extents (window); /* emits signals */
 
   get_icons (window);
   
Index: window.h
===================================================================
--- window.h	(révision 1289)
+++ window.h	(copie de travail)
@@ -371,6 +371,11 @@ void wnck_window_set_icon_geometry      
 WnckWindowActions wnck_window_get_actions (WnckWindow *window);
 WnckWindowState   wnck_window_get_state   (WnckWindow *window);
 
+void wnck_window_get_client_window_geometry (WnckWindow *window,
+                                             int        *xp,
+                                             int        *yp,
+                                             int        *widthp,
+                                             int        *heightp);
 void wnck_window_get_geometry (WnckWindow *window,
                                int        *xp,
                                int        *yp,
Index: xutils.c
===================================================================
--- xutils.c	(révision 1290)
+++ xutils.c	(copie de travail)
@@ -1141,6 +1141,25 @@ _wnck_get_name (Window xwindow)
   return name;
 }
 
+char*
+_wnck_get_icon_name (Window xwindow)
+{
+  char *name;
+  
+  name = _wnck_get_utf8_property (xwindow,
+                                  _wnck_atom_get ("_NET_WM_VISIBLE_ICON_NAME"));
+
+  if (name == NULL)
+    name = _wnck_get_utf8_property (xwindow,
+                                    _wnck_atom_get ("_NET_WM_ICON_NAME"));
+
+  if (name == NULL)
+    name = _wnck_get_text_property (xwindow,
+                                    XA_WM_ICON_NAME);
+
+  return name;
+}
+
 static char*
 latin1_to_utf8 (const char *latin1)
 {
@@ -1212,6 +1231,41 @@ _wnck_get_wmclass (Window xwindow,
     }
 }
 
+gboolean
+_wnck_get_frame_extents (Window  xwindow,
+                         int    *left_frame,
+                         int    *right_frame,
+                         int    *top_frame,
+                         int    *bottom_frame)
+{
+  gulong   *p_size;
+  int       n_size;
+  gboolean  retval;
+
+  retval = FALSE;
+  p_size = NULL;
+  n_size = 0;
+
+  _wnck_get_cardinal_list (xwindow,
+                           _wnck_atom_get ("_NET_FRAME_EXTENTS"),
+                           &p_size, &n_size);
+
+  if (p_size != NULL && n_size == 4)
+    {
+      *left_frame   = p_size[0];
+      *right_frame  = p_size[1];
+      *top_frame    = p_size[2];
+      *bottom_frame = p_size[3];
+
+      retval = TRUE;
+    }
+
+  if (p_size != NULL)
+    g_free (p_size);
+
+  return retval;
+}
+
 void
 _wnck_select_input (Window xwindow,
                     int    mask)
Index: xutils.h
===================================================================
--- xutils.h	(révision 1290)
+++ xutils.h	(copie de travail)
@@ -113,10 +113,16 @@ void _wnck_change_viewport (Screen *scre
 char*  _wnck_get_session_id     (Window xwindow);
 int    _wnck_get_pid            (Window xwindow);
 char*  _wnck_get_name           (Window xwindow);
+char*  _wnck_get_icon_name      (Window xwindow);
 char*  _wnck_get_res_class_utf8 (Window xwindow);
 void   _wnck_get_wmclass        (Window xwindow,
                                  char **res_class,
                                  char **res_name);
+gboolean _wnck_get_frame_extents  (Window  xwindow,
+                                   int    *left_frame,
+                                   int    *right_frame,
+                                   int    *top_frame,
+                                   int    *bottom_frame);
 
 void   _wnck_select_input     (Window xwindow,
                                int    mask);
