xfns.c (x_window): Fixed indentation
authorJan Djärv <jan.h.d@swipnet.se>
Sat, 28 Feb 2004 16:22:06 +0000 (16:22 +0000)
committerJan Djärv <jan.h.d@swipnet.se>
Sat, 28 Feb 2004 16:22:06 +0000 (16:22 +0000)
* xterm.c (x_calc_absolute_position): Call x_real_positions
  to get WM window sizes and use those to calculate position.
  (x_set_offset): Removed code commented out.

src/ChangeLog
src/xfns.c
src/xterm.c

index 8b5944a..946c92f 100644 (file)
@@ -1,3 +1,11 @@
+2004-02-28  Jan Dj\e,Ad\e(Brv  <jan.h.d@swipnet.se>
+
+       * xfns.c (x_window): Fixed indentation.
+
+       * xterm.c (x_calc_absolute_position): Call x_real_positions
+       to get WM window sizes and use those to calculate position.
+       (x_set_offset): Removed code commented out.
+
 2004-02-28  Miles Bader  <miles@gnu.org>
 
        * keyboard.c (adjust_point_for_property): #ifdef-out dodgy xassert.
index f5e3c0c..a3e885b 100644 (file)
@@ -2837,7 +2837,7 @@ x_window (f)
 
 #ifdef HAVE_X_I18N
   FRAME_XIC (f) = NULL;
-if (use_xim)
+  if (use_xim)
   {
     BLOCK_INPUT;
     create_frame_xic (f);
index 0f1faea..9e34d98 100644 (file)
@@ -8137,65 +8137,24 @@ x_calc_absolute_position (f)
   Window child;
   int win_x = 0, win_y = 0;
   int flags = f->size_hint_flags;
-  int this_window;
 
   /* We have nothing to do if the current position
      is already for the top-left corner.  */
   if (! ((flags & XNegative) || (flags & YNegative)))
     return;
 
-  this_window = FRAME_OUTER_WINDOW (f);
-
-  /* Find the position of the outside upper-left corner of
+  /* Find the offsets of the outside upper-left corner of
      the inner window, with respect to the outer window.
      But do this only if we will need the results.  */
   if (f->output_data.x->parent_desc != FRAME_X_DISPLAY_INFO (f)->root_window)
-    {
-      int count;
-
-      BLOCK_INPUT;
-      count = x_catch_errors (FRAME_X_DISPLAY (f));
-      while (1)
-       {
-         x_clear_errors (FRAME_X_DISPLAY (f));
-         XTranslateCoordinates (FRAME_X_DISPLAY (f),
-
-                                /* From-window, to-window.  */
-                                this_window,
-                                f->output_data.x->parent_desc,
-
-                                /* From-position, to-position.  */
-                                0, 0, &win_x, &win_y,
-
-                                /* Child of win.  */
-                                &child);
-         if (x_had_errors_p (FRAME_X_DISPLAY (f)))
-           {
-             Window newroot, newparent = 0xdeadbeef;
-             Window *newchildren;
-             unsigned int nchildren;
-
-             if (! XQueryTree (FRAME_X_DISPLAY (f), this_window, &newroot,
-                               &newparent, &newchildren, &nchildren))
-               break;
-
-             XFree ((char *) newchildren);
-
-             f->output_data.x->parent_desc = newparent;
-           }
-         else
-           break;
-       }
-
-      x_uncatch_errors (FRAME_X_DISPLAY (f), count);
-      UNBLOCK_INPUT;
-    }
+    /* This is to get *_pixels_outer_diff.  */
+    x_real_positions (f, &win_x, &win_y);
 
   /* Treat negative positions as relative to the leftmost bottommost
      position that fits on the screen.  */
   if (flags & XNegative)
     f->left_pos = (FRAME_X_DISPLAY_INFO (f)->width
-                  - 2 * f->border_width - win_x
+                   - 2 * FRAME_X_OUTPUT (f)->x_pixels_outer_diff
                   - FRAME_PIXEL_WIDTH (f)
                   + f->left_pos);
 
@@ -8220,8 +8179,12 @@ x_calc_absolute_position (f)
 
   if (flags & YNegative)
     f->top_pos = (FRAME_X_DISPLAY_INFO (f)->height
-                 - 2 * f->border_width
-                 - win_y
+                  - FRAME_X_OUTPUT (f)->y_pixels_outer_diff
+
+                  /* Assume the window manager decorations are the same size on
+                     three sides, i.e. left, right and bottom.  This is to
+                     compensate for the bottom part.  */
+                  - FRAME_X_OUTPUT (f)->x_pixels_outer_diff
                  - height
                  + f->top_pos);
   }
@@ -8265,17 +8228,6 @@ x_set_offset (f, xoff, yoff, change_gravity)
   modified_left = f->left_pos;
   modified_top = f->top_pos;
 
-#if 0 /* Running on psilocin (Debian), and displaying on the NCD X-terminal,
-        this seems to be unnecessary and incorrect.  rms, 4/17/97.  */
-  /* It is a mystery why we need to add the border_width here
-     when the frame is already visible, but experiment says we do.  */
-  if (change_gravity != 0)
-    {
-      modified_left += f->border_width;
-      modified_top += f->border_width;
-    }
-#endif
-
   if (FRAME_X_DISPLAY_INFO (f)->wm_type == X_WMTYPE_A)
     {
       /* Some WMs (twm, wmaker at least) has an offset that is smaller