(coordinates_in_window): Take frame's internal border width
[bpt/emacs.git] / src / window.c
index dc01b2f..be6bf81 100644 (file)
@@ -36,6 +36,9 @@ Boston, MA 02111-1307, USA.  */
 #ifdef HAVE_X_WINDOWS
 #include "xterm.h"
 #endif /* HAVE_X_WINDOWS */
 #ifdef HAVE_X_WINDOWS
 #include "xterm.h"
 #endif /* HAVE_X_WINDOWS */
+#ifdef WINDOWSNT
+#include "w32term.h"
+#endif
 
 #ifndef max
 #define max(a, b) ((a) < (b) ? (b) : (a))
 
 #ifndef max
 #define max(a, b) ((a) < (b) ? (b) : (a))
@@ -461,9 +464,11 @@ coordinates_in_window (w, x, y)
     }
   else
     {
     }
   else
     {
-      left_x = WINDOW_DISPLAY_LEFT_EDGE_PIXEL_X (w);
+      left_x = (WINDOW_DISPLAY_LEFT_EDGE_PIXEL_X (w)
+               - FRAME_INTERNAL_BORDER_WIDTH (f));
       right_x = WINDOW_DISPLAY_RIGHT_EDGE_PIXEL_X (w);
       right_x = WINDOW_DISPLAY_RIGHT_EDGE_PIXEL_X (w);
-      top_y = WINDOW_DISPLAY_TOP_EDGE_PIXEL_Y (w);
+      top_y = (WINDOW_DISPLAY_TOP_EDGE_PIXEL_Y (w)
+              - FRAME_INTERNAL_BORDER_WIDTH (f));
       bottom_y = WINDOW_DISPLAY_BOTTOM_EDGE_PIXEL_Y (w);
     }
 
       bottom_y = WINDOW_DISPLAY_BOTTOM_EDGE_PIXEL_Y (w);
     }
 
@@ -1053,9 +1058,11 @@ delete_window (window)
       unchain_marker (p->start);
     }
 
       unchain_marker (p->start);
     }
 
-  /* Free window glyph matrices.
-     It is sure that they are allocated again when ADJUST_GLYPHS
-     is called. */
+  /* Free window glyph matrices.  It is sure that they are allocated
+     again when ADJUST_GLYPHS is called.  Block input so that expose
+     events and other events that access glyph matrices are not
+     processed while we are changing them.  */
+  BLOCK_INPUT;
   free_window_matrices (XWINDOW (FRAME_ROOT_WINDOW (frame)));
 
   tem = p->next;
   free_window_matrices (XWINDOW (FRAME_ROOT_WINDOW (frame)));
 
   tem = p->next;
@@ -1114,6 +1121,7 @@ delete_window (window)
 
   /* Adjust glyph matrices. */
   adjust_glyphs (frame);
 
   /* Adjust glyph matrices. */
   adjust_glyphs (frame);
+  UNBLOCK_INPUT;
 }
 \f
 
 }
 \f
 
@@ -2433,6 +2441,7 @@ BUFFER can be a buffer or buffer name.")
   register Lisp_Object tem;
   register struct window *w = decode_window (window);
 
   register Lisp_Object tem;
   register struct window *w = decode_window (window);
 
+  XSETWINDOW (window, w);
   buffer = Fget_buffer (buffer);
   CHECK_BUFFER (buffer, 1);
 
   buffer = Fget_buffer (buffer);
   CHECK_BUFFER (buffer, 1);
 
@@ -4153,6 +4162,11 @@ redraws with point in the center of the current window.")
   if (NILP (arg))
     {
       extern int frame_garbaged;
   if (NILP (arg))
     {
       extern int frame_garbaged;
+      int i;
+
+      /* Invalidate pixel data calculated for all compositions.  */
+      for (i = 0; i < n_compositions; i++)
+       composition_table[i]->font = NULL;
 
       Fredraw_frame (w->frame);
       SET_FRAME_GARBAGED (XFRAME (WINDOW_FRAME (w)));
 
       Fredraw_frame (w->frame);
       SET_FRAME_GARBAGED (XFRAME (WINDOW_FRAME (w)));
@@ -4809,7 +4823,6 @@ DEFUN ("save-window-excursion", Fsave_window_excursion, Ssave_window_excursion,
 Restore which buffer appears in which window, where display starts,\n\
 and the value of point and mark for each window.\n\
 Also restore which buffer is current.\n\
 Restore which buffer appears in which window, where display starts,\n\
 and the value of point and mark for each window.\n\
 Also restore which buffer is current.\n\
-But do not preserve point in the current buffer.\n\
 Does not restore the value of point in current buffer.")
   (args)
      Lisp_Object args;
 Does not restore the value of point in current buffer.")
   (args)
      Lisp_Object args;
@@ -4829,9 +4842,9 @@ Does not restore the value of point in current buffer.")
  ***********************************************************************/
 
 DEFUN ("set-window-margins", Fset_window_margins, Sset_window_margins,
  ***********************************************************************/
 
 DEFUN ("set-window-margins", Fset_window_margins, Sset_window_margins,
-       2, 3, "",
+       2, 3, 0,
   "Set width of marginal areas of window WINDOW.\n\
   "Set width of marginal areas of window WINDOW.\n\
-If window is nil or omitted, set margins of the currently selected window.\n\
+If window is nil, set margins of the currently selected window.\n\
 First parameter LEFT-WIDTH specifies the number of character\n\
 cells to reserve for the left marginal area.  Second parameter\n\
 RIGHT-WIDTH does the same for the right marginal area.\n\
 First parameter LEFT-WIDTH specifies the number of character\n\
 cells to reserve for the left marginal area.  Second parameter\n\
 RIGHT-WIDTH does the same for the right marginal area.\n\