emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r114037: Redesign redisplay interface to drop global


From: Dmitry Antipov
Subject: [Emacs-diffs] trunk r114037: Redesign redisplay interface to drop global output_cursor.
Date: Wed, 28 Aug 2013 05:46:56 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 114037
revision-id: address@hidden
parent: address@hidden
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Wed 2013-08-28 09:45:38 +0400
message:
  Redesign redisplay interface to drop global output_cursor.
  * dispextern.h (struct redisplay_interface): Remove cursor_to member.
  (toplevel): Remove declaration of output_cursor.
  (set_output_cursor, x_cursor_to): Remove prototype.
  * window.h (struct window): New member output_cursor.
  (output_cursor_to): New function to replace RIF member.
  * dispnew.c (redraw_overlapped_rows, update_marginal_area)
  (update_text_area, set_window_cursor_after_update): Use it.
  * xdisp.c (output_cursor, set_output_cursor, x_cursor_to): Remove.
  (x_write_glyphs, x_insert_glyphs, x_clear_end_of_line):
  * nsterm.m (ns_update_window_begin, ns_update_window_end):
  * w32term.c (x_update_window_begin, x_update_window_end):
  * xterm.c (x_update_window_begin, x_update_window_end):
  Adjust to use per-window output cursor.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/dispextern.h               
dispextern.h-20091113204419-o5vbwnq5f7feedwu-218
  src/dispnew.c                  dispnew.c-20091113204419-o5vbwnq5f7feedwu-258
  src/nsterm.m                   nsterm.m-20091113204419-o5vbwnq5f7feedwu-8747
  src/w32term.c                  w32term.c-20091113204419-o5vbwnq5f7feedwu-950
  src/window.h                   window.h-20091113204419-o5vbwnq5f7feedwu-271
  src/xdisp.c                    xdisp.c-20091113204419-o5vbwnq5f7feedwu-240
  src/xterm.c                    xterm.c-20091113204419-o5vbwnq5f7feedwu-244
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-08-27 19:36:28 +0000
+++ b/src/ChangeLog     2013-08-28 05:45:38 +0000
@@ -1,3 +1,20 @@
+2013-08-28  Dmitry Antipov  <address@hidden>
+
+       Redesign redisplay interface to drop global output_cursor.
+       * dispextern.h (struct redisplay_interface): Remove cursor_to member.
+       (toplevel): Remove declaration of output_cursor.
+       (set_output_cursor, x_cursor_to): Remove prototype.
+       * window.h (struct window): New member output_cursor.
+       (output_cursor_to): New function to replace RIF member.
+       * dispnew.c (redraw_overlapped_rows, update_marginal_area)
+       (update_text_area, set_window_cursor_after_update): Use it.
+       * xdisp.c (output_cursor, set_output_cursor, x_cursor_to): Remove.
+       (x_write_glyphs, x_insert_glyphs, x_clear_end_of_line):
+       * nsterm.m (ns_update_window_begin, ns_update_window_end):
+       * w32term.c (x_update_window_begin, x_update_window_end):
+       * xterm.c (x_update_window_begin, x_update_window_end):
+       Adjust to use per-window output cursor.
+
 2013-08-27  Paul Eggert  <address@hidden>
 
        Simplify SELECT_TYPE-related code.

=== modified file 'src/dispextern.h'
--- a/src/dispextern.h  2013-08-27 18:47:55 +0000
+++ b/src/dispextern.h  2013-08-28 05:45:38 +0000
@@ -2790,11 +2790,6 @@
   void (*update_window_end_hook) (struct window *w, bool cursor_on_p,
                                   bool mouse_face_overwritten_p);
 
-  /* Move cursor to row/column position VPOS/HPOS, pixel coordinates
-     Y/X. HPOS/VPOS are window-relative row and column numbers and X/Y
-     are window-relative pixel positions.  */
-  void (*cursor_to) (struct window *w, int vpos, int hpos, int y, int x);
-
   /* Flush the display of frame F.  For X, this is XFlush.  */
   void (*flush_display) (struct frame *f);
 
@@ -3232,9 +3227,6 @@
                             struct glyph *, enum glyph_row_area, int);
 extern void x_clear_end_of_line (struct window *, struct glyph_row *,
                                 enum glyph_row_area, int);
-
-extern struct cursor_pos output_cursor;
-
 extern void x_fix_overlapping_area (struct window *, struct glyph_row *,
                                     enum glyph_row_area, int);
 extern void draw_phys_cursor_glyph (struct window *,
@@ -3244,10 +3236,6 @@
                                       struct glyph *, int *, int *, int *);
 extern void erase_phys_cursor (struct window *);
 extern void display_and_set_cursor (struct window *, bool, int, int, int, int);
-
-extern void set_output_cursor (struct cursor_pos *);
-extern void x_cursor_to (struct window *, int, int, int, int);
-
 extern void x_update_cursor (struct frame *, bool);
 extern void x_clear_cursor (struct window *);
 extern void x_draw_vertical_border (struct window *w);

=== modified file 'src/dispnew.c'
--- a/src/dispnew.c     2013-08-27 18:47:55 +0000
+++ b/src/dispnew.c     2013-08-28 05:45:38 +0000
@@ -3223,8 +3223,8 @@
 
          for (area = LEFT_MARGIN_AREA; area < LAST_AREA; ++area)
            {
-             FRAME_RIF (f)->cursor_to (w, i, 0, row->y,
-                                        area == TEXT_AREA ? row->x : 0);
+             output_cursor_to (w, i, 0, row->y,
+                               area == TEXT_AREA ? row->x : 0);
              if (row->used[area])
                FRAME_RIF (f)->write_glyphs (w, row, row->glyphs[area],
                                              area, row->used[area]);
@@ -3481,7 +3481,7 @@
       /* End the update of window W.  Don't set the cursor if we
          paused updating the display because in this case,
          set_window_cursor_after_update hasn't been called, and
-         output_cursor doesn't contain the cursor location.  */
+         W->output_cursor doesn't contain the cursor location.  */
       rif->update_window_end_hook (w, !paused_p, mouse_face_overwritten_p);
     }
   else
@@ -3511,7 +3511,7 @@
   /* Set cursor to start of glyphs, write them, and clear to the end
      of the area.  I don't think that something more sophisticated is
      necessary here, since marginal areas will not be the default.  */
-  rif->cursor_to (w, vpos, 0, desired_row->y, 0);
+  output_cursor_to (w, vpos, 0, desired_row->y, 0);
   if (desired_row->used[area])
     rif->write_glyphs (w, updated_row, desired_row->glyphs[area],
                       area, desired_row->used[area]);
@@ -3549,7 +3549,7 @@
          && !(current_row->mode_line_p && vpos > 0))
       || current_row->x != desired_row->x)
     {
-      rif->cursor_to (w, vpos, 0, desired_row->y, desired_row->x);
+      output_cursor_to (w, vpos, 0, desired_row->y, desired_row->x);
 
       if (desired_row->used[TEXT_AREA])
        rif->write_glyphs (w, updated_row, desired_row->glyphs[TEXT_AREA],
@@ -3692,7 +3692,7 @@
                  break;
                }
 
-             rif->cursor_to (w, vpos, start_hpos, desired_row->y, start_x);
+             output_cursor_to (w, vpos, start_hpos, desired_row->y, start_x);
              rif->write_glyphs (w, updated_row, start,
                                 TEXT_AREA, i - start_hpos);
              changed_p = 1;
@@ -3702,7 +3702,7 @@
       /* Write the rest.  */
       if (i < desired_row->used[TEXT_AREA])
        {
-         rif->cursor_to (w, vpos, i, desired_row->y, x);
+         output_cursor_to (w, vpos, i, desired_row->y, x);
          rif->write_glyphs (w, updated_row, desired_glyph,
                             TEXT_AREA, desired_row->used[TEXT_AREA] - i);
          changed_p = 1;
@@ -3724,8 +3724,8 @@
        {
          /* If old row extends to the end of the text area, clear.  */
          if (i >= desired_row->used[TEXT_AREA])
-           rif->cursor_to (w, vpos, i, desired_row->y,
-                           desired_row->pixel_width);
+           output_cursor_to (w, vpos, i, desired_row->y,
+                             desired_row->pixel_width);
          rif->clear_end_of_line (w, updated_row, TEXT_AREA, -1);
          changed_p = 1;
        }
@@ -3736,8 +3736,8 @@
          int xlim;
 
          if (i >= desired_row->used[TEXT_AREA])
-           rif->cursor_to (w, vpos, i, desired_row->y,
-                           desired_row->pixel_width);
+           output_cursor_to (w, vpos, i, desired_row->y,
+                             desired_row->pixel_width);
 
          /* If cursor is displayed at the end of the line, make sure
             it's cleared.  Nowadays we don't have a phys_cursor_glyph
@@ -3836,7 +3836,6 @@
 set_window_cursor_after_update (struct window *w)
 {
   struct frame *f = XFRAME (w->frame);
-  struct redisplay_interface *rif = FRAME_RIF (f);
   int cx, cy, vpos, hpos;
 
   /* Not intended for frame matrix updates.  */
@@ -3908,7 +3907,7 @@
      Horizontal position is -1 when cursor is on the left fringe.   */
   hpos = clip_to_bounds (-1, hpos, w->current_matrix->matrix_w - 1);
   vpos = clip_to_bounds (0, vpos, w->current_matrix->nrows - 1);
-  rif->cursor_to (w, vpos, hpos, cy, cx);
+  output_cursor_to (w, vpos, hpos, cy, cx);
 }
 
 

=== modified file 'src/nsterm.m'
--- a/src/nsterm.m      2013-08-27 19:36:28 +0000
+++ b/src/nsterm.m      2013-08-28 05:45:38 +0000
@@ -720,7 +720,7 @@
   Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
 
   NSTRACE (ns_update_window_begin);
-  set_output_cursor (&w->cursor);
+  w->output_cursor = w->cursor;
 
   block_input ();
 
@@ -756,8 +756,8 @@
 
       if (cursor_on_p)
        display_and_set_cursor (w, 1,
-                                output_cursor.hpos, output_cursor.vpos,
-                               output_cursor.x, output_cursor.y);
+                               w->output_cursor.hpos, w->output_cursor.vpos,
+                               w->output_cursor.x, w->output_cursor.y);
 
       if (draw_window_fringes (w, 1))
        x_draw_vertical_border (w);
@@ -1989,9 +1989,6 @@
 
   mark_window_cursors_off (XWINDOW (FRAME_ROOT_WINDOW (f)));
 
-  output_cursor.hpos = output_cursor.vpos = 0;
-  output_cursor.x = -1;
-
   r = [view bounds];
 
   block_input ();
@@ -3978,7 +3975,6 @@
   ns_after_update_window_line,
   ns_update_window_begin,
   ns_update_window_end,
-  x_cursor_to,
   ns_flush,
   0, /* flush_display_optional */
   x_clear_window_mouse_face,

=== modified file 'src/w32term.c'
--- a/src/w32term.c     2013-08-27 03:52:21 +0000
+++ b/src/w32term.c     2013-08-28 05:45:38 +0000
@@ -576,8 +576,7 @@
 }
 
 
-/* Start update of window W.  Set output_cursor to the cursor
-   position of W.  */
+/* Start update of window W.  */
 
 static void
 x_update_window_begin (struct window *w)
@@ -591,7 +590,7 @@
       SendMessage (w32_system_caret_hwnd, WM_EMACS_HIDE_CARET, 0, 0);
     }
 
-  set_output_cursor (&w->cursor);
+  w->output_cursor = w->cursor;
 
   block_input ();
 
@@ -683,9 +682,9 @@
       block_input ();
 
       if (cursor_on_p)
-       display_and_set_cursor (w, 1, output_cursor.hpos,
-                               output_cursor.vpos,
-                               output_cursor.x, output_cursor.y);
+       display_and_set_cursor (w, 1,
+                               w->output_cursor.hpos, w->output_cursor.vpos,
+                               w->output_cursor.x, w->output_cursor.y);
 
       if (draw_window_fringes (w, 1))
        x_draw_vertical_border (w);
@@ -2651,11 +2650,7 @@
   /* Clearing the frame will erase any cursor, so mark them all as no
      longer visible.  */
   mark_window_cursors_off (XWINDOW (FRAME_ROOT_WINDOW (f)));
-  output_cursor.hpos = output_cursor.vpos = 0;
-  output_cursor.x = -1;
 
-  /* We don't set the output cursor here because there will always
-     follow an explicit cursor_to.  */
   block_input ();
 
   w32_clear_window (f);
@@ -6321,7 +6316,6 @@
   x_after_update_window_line,
   x_update_window_begin,
   x_update_window_end,
-  x_cursor_to,
   x_flush,
   0,  /* flush_display_optional */
   x_clear_window_mouse_face,

=== modified file 'src/window.h'
--- a/src/window.h      2013-08-26 09:33:37 +0000
+++ b/src/window.h      2013-08-28 05:45:38 +0000
@@ -236,6 +236,9 @@
     /* Where the cursor actually is.  */
     struct cursor_pos phys_cursor;
 
+    /* Internally used for redisplay purposes.  */
+    struct cursor_pos output_cursor;
+
     /* Vertical cursor position as of last update that completed
        without pause.  This is the position of last_point.  */
     int last_cursor_vpos;
@@ -956,6 +959,22 @@
 extern void syms_of_window (void);
 extern void keys_of_window (void);
 
+/* Move cursor to row/column position VPOS/HPOS, pixel coordinates
+   Y/X. HPOS/VPOS are window-relative row and column numbers and X/Y
+   are window-relative pixel positions.  This is always done during
+   window update, so the position is the future output cursor position
+   for currently updated window W.  */
+
+WINDOW_INLINE void
+output_cursor_to (struct window *w, int vpos, int hpos, int y, int x)
+{
+  eassert (w);
+  w->output_cursor.hpos = hpos;
+  w->output_cursor.vpos = vpos;
+  w->output_cursor.x = x;
+  w->output_cursor.y = y;
+}
+
 INLINE_HEADER_END
 
 #endif /* not WINDOW_H_INCLUDED */

=== modified file 'src/xdisp.c'
--- a/src/xdisp.c       2013-08-27 18:47:55 +0000
+++ b/src/xdisp.c       2013-08-28 05:45:38 +0000
@@ -11445,62 +11445,6 @@
   return hooks_run;
 }
 
-
-
-/***********************************************************************
-                           Output Cursor
- ***********************************************************************/
-
-#ifdef HAVE_WINDOW_SYSTEM
-
-/* EXPORT:
-   Nominal cursor position -- where to draw output.
-   HPOS and VPOS are window relative glyph matrix coordinates.
-   X and Y are window relative pixel coordinates.  */
-
-struct cursor_pos output_cursor;
-
-
-/* EXPORT:
-   Set the global variable output_cursor to CURSOR.  All cursor
-   positions are relative to currently updated window.  */
-
-void
-set_output_cursor (struct cursor_pos *cursor)
-{
-  output_cursor.hpos = cursor->hpos;
-  output_cursor.vpos = cursor->vpos;
-  output_cursor.x = cursor->x;
-  output_cursor.y = cursor->y;
-}
-
-
-/* EXPORT for RIF:
-   Set a nominal cursor position.
-
-   HPOS and VPOS are column/row positions in a window glyph matrix.
-   X and Y are window text area relative pixel positions.
-
-   This is always done during window update, so the position is the
-   future output cursor position for currently updated window W.
-   NOTE: W is used only to check whether this function is called
-   in a consistent manner via the redisplay interface.  */
-
-void
-x_cursor_to (struct window *w, int vpos, int hpos, int y, int x)
-{
-  eassert (w);
-
-  /* Set the output cursor.  */
-  output_cursor.hpos = hpos;
-  output_cursor.vpos = vpos;
-  output_cursor.x = x;
-  output_cursor.y = y;
-}
-
-#endif /* HAVE_WINDOW_SYSTEM */
-
-
 /***********************************************************************
                               Tool-bars
  ***********************************************************************/
@@ -25790,7 +25734,7 @@
   /* Write glyphs.  */
 
   hpos = start - updated_row->glyphs[updated_area];
-  x = draw_glyphs (w, output_cursor.x,
+  x = draw_glyphs (w, w->output_cursor.x,
                   updated_row, updated_area,
                   hpos, hpos + len,
                   DRAW_NORMAL_TEXT, 0);
@@ -25798,7 +25742,7 @@
   /* Invalidate old phys cursor if the glyph at its hpos is redrawn.  */
   if (updated_area == TEXT_AREA
       && w->phys_cursor_on_p
-      && w->phys_cursor.vpos == output_cursor.vpos
+      && w->phys_cursor.vpos == w->output_cursor.vpos
       && chpos >= hpos
       && chpos < hpos + len)
     w->phys_cursor_on_p = 0;
@@ -25806,8 +25750,8 @@
   unblock_input ();
 
   /* Advance the output cursor.  */
-  output_cursor.hpos += len;
-  output_cursor.x = x;
+  w->output_cursor.hpos += len;
+  w->output_cursor.x = x;
 }
 
 
@@ -25840,25 +25784,25 @@
 
   /* Get the width of the region to shift right.  */
   shifted_region_width = (window_box_width (w, updated_area)
-                         - output_cursor.x
+                         - w->output_cursor.x
                          - shift_by_width);
 
   /* Shift right.  */
-  frame_x = window_box_left (w, updated_area) + output_cursor.x;
-  frame_y = WINDOW_TO_FRAME_PIXEL_Y (w, output_cursor.y);
+  frame_x = window_box_left (w, updated_area) + w->output_cursor.x;
+  frame_y = WINDOW_TO_FRAME_PIXEL_Y (w, w->output_cursor.y);
 
   FRAME_RIF (f)->shift_glyphs_for_insert (f, frame_x, frame_y, 
shifted_region_width,
                                           line_height, shift_by_width);
 
   /* Write the glyphs.  */
   hpos = start - row->glyphs[updated_area];
-  draw_glyphs (w, output_cursor.x, row, updated_area,
+  draw_glyphs (w, w->output_cursor.x, row, updated_area,
               hpos, hpos + len,
               DRAW_NORMAL_TEXT, 0);
 
   /* Advance the output cursor.  */
-  output_cursor.hpos += len;
-  output_cursor.x += shift_by_width;
+  w->output_cursor.hpos += len;
+  w->output_cursor.x += shift_by_width;
   unblock_input ();
 }
 
@@ -25897,16 +25841,16 @@
   else
     to_x = min (to_x, max_x);
 
-  to_y = min (max_y, output_cursor.y + updated_row->height);
+  to_y = min (max_y, w->output_cursor.y + updated_row->height);
 
   /* Notice if the cursor will be cleared by this operation.  */
   if (!updated_row->full_width_p)
     notice_overwritten_cursor (w, updated_area,
-                              output_cursor.x, -1,
+                              w->output_cursor.x, -1,
                               updated_row->y,
                               MATRIX_ROW_BOTTOM_Y (updated_row));
 
-  from_x = output_cursor.x;
+  from_x = w->output_cursor.x;
 
   /* Translate to frame coordinates.  */
   if (updated_row->full_width_p)
@@ -25922,7 +25866,7 @@
     }
 
   min_y = WINDOW_HEADER_LINE_HEIGHT (w);
-  from_y = WINDOW_TO_FRAME_PIXEL_Y (w, max (min_y, output_cursor.y));
+  from_y = WINDOW_TO_FRAME_PIXEL_Y (w, max (min_y, w->output_cursor.y));
   to_y = WINDOW_TO_FRAME_PIXEL_Y (w, to_y);
 
   /* Prevent inadvertently clearing to end of the X window.  */

=== modified file 'src/xterm.c'
--- a/src/xterm.c       2013-08-27 19:36:28 +0000
+++ b/src/xterm.c       2013-08-28 05:45:38 +0000
@@ -551,8 +551,7 @@
 }
 
 
-/* Start update of window W.  Set output_cursor to the cursor
-   position of W.  */
+/* Start update of window W.  */
 
 static void
 x_update_window_begin (struct window *w)
@@ -560,7 +559,7 @@
   struct frame *f = XFRAME (WINDOW_FRAME (w));
   Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
 
-  set_output_cursor (&w->cursor);
+  w->output_cursor = w->cursor;
 
   block_input ();
 
@@ -618,9 +617,9 @@
       block_input ();
 
       if (cursor_on_p)
-       display_and_set_cursor (w, 1, output_cursor.hpos,
-                               output_cursor.vpos,
-                               output_cursor.x, output_cursor.y);
+       display_and_set_cursor (w, 1,
+                               w->output_cursor.hpos, w->output_cursor.vpos,
+                               w->output_cursor.x, w->output_cursor.y);
 
       if (draw_window_fringes (w, 1))
        x_draw_vertical_border (w);
@@ -2983,11 +2982,7 @@
   /* Clearing the frame will erase any cursor, so mark them all as no
      longer visible.  */
   mark_window_cursors_off (XWINDOW (FRAME_ROOT_WINDOW (f)));
-  output_cursor.hpos = output_cursor.vpos = 0;
-  output_cursor.x = -1;
 
-  /* We don't set the output cursor here because there will always
-     follow an explicit cursor_to.  */
   block_input ();
 
   XClearWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f));
@@ -10448,7 +10443,6 @@
     x_after_update_window_line,
     x_update_window_begin,
     x_update_window_end,
-    x_cursor_to,
     x_flush,
 #ifdef XFlush
     x_flush,


reply via email to

[Prev in Thread] Current Thread [Next in Thread]