/* Display generation from window structure and buffer text.
- Copyright (C) 1985,86,87,88,93,94,95,97,98,99, 2000, 2001, 2002, 2003
+ Copyright (C) 1985,86,87,88,93,94,95,97,98,99,2000,01,02,03,04
Free Software Foundation, Inc.
This file is part of GNU Emacs.
#endif
#ifdef MAC_OS
#include "macterm.h"
+
+Cursor No_Cursor;
#endif
#ifndef FRAME_X_OUTPUT
/* Cursor shapes */
Lisp_Object Qbar, Qhbar, Qbox, Qhollow;
+/* Pointer shapes */
+Lisp_Object Qarrow, Qhand, Qtext;
+
Lisp_Object Qrisky_local_variable;
/* Holds the list (error). */
/* Names of text properties relevant for redisplay. */
-Lisp_Object Qdisplay, Qrelative_width, Qalign_to;
+Lisp_Object Qdisplay;
extern Lisp_Object Qface, Qinvisible, Qwidth;
/* Symbols used in text property values. */
+Lisp_Object Vdisplay_pixels_per_inch;
Lisp_Object Qspace, QCalign_to, QCrelative_width, QCrelative_height;
Lisp_Object Qleft_margin, Qright_margin, Qspace_width, Qraise;
-Lisp_Object Qmargin;
+Lisp_Object Qcenter;
+Lisp_Object Qmargin, Qpointer;
extern Lisp_Object Qheight;
extern Lisp_Object QCwidth, QCheight, QCascent;
+extern Lisp_Object Qscroll_bar;
/* Non-nil means highlight trailing whitespace. */
Lisp_Object Vshow_trailing_whitespace;
+#ifdef HAVE_WINDOW_SYSTEM
+extern Lisp_Object Voverflow_newline_into_fringe;
+
+/* Test if overflow newline into fringe. Called with iterator IT
+ at or past right window margin, and with IT->current_x set. */
+
+#define IT_OVERFLOW_NEWLINE_INTO_FRINGE(it) \
+ (!NILP (Voverflow_newline_into_fringe) \
+ && FRAME_WINDOW_P (it->f) \
+ && WINDOW_RIGHT_FRINGE_WIDTH (it->w) > 0 \
+ && it->current_x == it->last_visible_x)
+
+#endif /* HAVE_WINDOW_SYSTEM */
+
+/* Non-nil means show the text cursor in void text areas
+ i.e. in blank areas after eol and eob. This used to be
+ the default in 21.3. */
+
+Lisp_Object Vvoid_text_area_pointer;
+
/* Name of the face used to highlight trailing whitespace. */
Lisp_Object Qtrailing_whitespace;
Lisp_Object Qimage;
+/* The image map types. */
+Lisp_Object QCmap, QCpointer;
+Lisp_Object Qrect, Qcircle, Qpoly;
+
/* Non-zero means print newline to stdout before next mini-buffer
message. */
Lisp_Object Vglobal_mode_string;
+
+/* List of variables (symbols) which hold markers for overlay arrows.
+ The symbols on this list are examined during redisplay to determine
+ where to display overlay arrows. */
+
+Lisp_Object Voverlay_arrow_variable_list;
+
/* Marker for where to display an arrow on top of the buffer text. */
Lisp_Object Voverlay_arrow_position;
Lisp_Object Voverlay_arrow_string;
-/* Values of those variables at last redisplay. However, if
- Voverlay_arrow_position is a marker, last_arrow_position is its
+/* Values of those variables at last redisplay are stored as
+ properties on `overlay-arrow-position' symbol. However, if
+ Voverlay_arrow_position is a marker, last-arrow-position is its
numerical position. */
-static Lisp_Object last_arrow_position, last_arrow_string;
+Lisp_Object Qlast_arrow_position, Qlast_arrow_string;
+
+/* Alternative overlay-arrow-string and overlay-arrow-bitmap
+ properties on a symbol in overlay-arrow-variable-list. */
+
+Lisp_Object Qoverlay_arrow_string, Qoverlay_arrow_bitmap;
/* Like mode-line-format, but for the title bar on a visible frame. */
/* Recenter the window whenever point gets within this many lines of
the top or bottom of the window. This value is translated into a
- pixel value by multiplying it with CANON_Y_UNIT, which means that
- there is really a fixed pixel height scroll margin. */
+ pixel value by multiplying it with FRAME_LINE_HEIGHT, which means
+ that there is really a fixed pixel height scroll margin. */
EMACS_INT scroll_margin;
static int next_element_from_ellipsis P_ ((struct it *));
static void pint2str P_ ((char *, int, int));
+static void pint2hrstr P_ ((char *, int, int));
static struct text_pos run_window_scroll_functions P_ ((Lisp_Object,
struct text_pos));
static void reconsider_clip_changes P_ ((struct window *, struct buffer *));
static int compute_window_start_on_continuation_line P_ ((struct window *));
static Lisp_Object safe_eval_handler P_ ((Lisp_Object));
static void insert_left_trunc_glyphs P_ ((struct it *));
-static struct glyph_row *get_overlay_arrow_glyph_row P_ ((struct window *));
+static struct glyph_row *get_overlay_arrow_glyph_row P_ ((struct window *,
+ Lisp_Object));
static void extend_face_to_end_of_line P_ ((struct it *));
static int append_space P_ ((struct it *, int));
-static int make_cursor_line_fully_visible P_ ((struct window *));
+static int make_cursor_line_fully_visible P_ ((struct window *, int));
static int try_scrolling P_ ((Lisp_Object, int, EMACS_INT, EMACS_INT, int, int));
static int try_cursor_movement P_ ((Lisp_Object, struct text_pos, int *));
static int trailing_whitespace_p P_ ((int));
static void push_it P_ ((struct it *));
static void pop_it P_ ((struct it *));
static void sync_frame_with_window_matrix_rows P_ ((struct window *));
+static void select_frame_for_redisplay P_ ((Lisp_Object));
static void redisplay_internal P_ ((int));
static int echo_area_display P_ ((int));
static void redisplay_windows P_ ((Lisp_Object));
window_text_bottom_y (w)
struct window *w;
{
- struct frame *f = XFRAME (w->frame);
- int height = XFASTINT (w->height) * CANON_Y_UNIT (f);
+ int height = WINDOW_TOTAL_HEIGHT (w);
if (WINDOW_WANTS_MODELINE_P (w))
height -= CURRENT_MODE_LINE_HEIGHT (w);
return height;
}
-
/* Return the pixel width of display area AREA of window W. AREA < 0
means return the total width of W, not including fringes to
the left and right of the window. */
struct window *w;
int area;
{
- struct frame *f = XFRAME (w->frame);
- int width = XFASTINT (w->width);
+ int cols = XFASTINT (w->total_cols);
+ int pixels = 0;
if (!w->pseudo_window_p)
{
- width -= FRAME_SCROLL_BAR_WIDTH (f) + FRAME_FRINGE_COLS (f);
+ cols -= WINDOW_SCROLL_BAR_COLS (w);
if (area == TEXT_AREA)
{
- if (INTEGERP (w->left_margin_width))
- width -= XFASTINT (w->left_margin_width);
- if (INTEGERP (w->right_margin_width))
- width -= XFASTINT (w->right_margin_width);
+ if (INTEGERP (w->left_margin_cols))
+ cols -= XFASTINT (w->left_margin_cols);
+ if (INTEGERP (w->right_margin_cols))
+ cols -= XFASTINT (w->right_margin_cols);
+ pixels = -WINDOW_TOTAL_FRINGE_WIDTH (w);
}
else if (area == LEFT_MARGIN_AREA)
- width = (INTEGERP (w->left_margin_width)
- ? XFASTINT (w->left_margin_width) : 0);
+ {
+ cols = (INTEGERP (w->left_margin_cols)
+ ? XFASTINT (w->left_margin_cols) : 0);
+ pixels = 0;
+ }
else if (area == RIGHT_MARGIN_AREA)
- width = (INTEGERP (w->right_margin_width)
- ? XFASTINT (w->right_margin_width) : 0);
+ {
+ cols = (INTEGERP (w->right_margin_cols)
+ ? XFASTINT (w->right_margin_cols) : 0);
+ pixels = 0;
+ }
}
- return width * CANON_X_UNIT (f);
+ return cols * WINDOW_FRAME_COLUMN_WIDTH (w) + pixels;
}
struct window *w;
{
struct frame *f = XFRAME (w->frame);
- int height = XFASTINT (w->height) * CANON_Y_UNIT (f);
+ int height = WINDOW_TOTAL_HEIGHT (w);
xassert (height >= 0);
return max (0, height);
}
+/* Return the window-relative coordinate of the left edge of display
+ area AREA of window W. AREA < 0 means return the left edge of the
+ whole window, to the right of the left fringe of W. */
+
+INLINE int
+window_box_left_offset (w, area)
+ struct window *w;
+ int area;
+{
+ int x;
+
+ if (w->pseudo_window_p)
+ return 0;
+
+ x = WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH (w);
+
+ if (area == TEXT_AREA)
+ x += (WINDOW_LEFT_FRINGE_WIDTH (w)
+ + window_box_width (w, LEFT_MARGIN_AREA));
+ else if (area == RIGHT_MARGIN_AREA)
+ x += (WINDOW_LEFT_FRINGE_WIDTH (w)
+ + window_box_width (w, LEFT_MARGIN_AREA)
+ + window_box_width (w, TEXT_AREA)
+ + (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
+ ? 0
+ : WINDOW_RIGHT_FRINGE_WIDTH (w)));
+ else if (area == LEFT_MARGIN_AREA
+ && WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w))
+ x += WINDOW_LEFT_FRINGE_WIDTH (w);
+
+ return x;
+}
+
+
+/* Return the window-relative coordinate of the right edge of display
+ area AREA of window W. AREA < 0 means return the left edge of the
+ whole window, to the left of the right fringe of W. */
+
+INLINE int
+window_box_right_offset (w, area)
+ struct window *w;
+ int area;
+{
+ return window_box_left_offset (w, area) + window_box_width (w, area);
+}
/* Return the frame-relative coordinate of the left edge of display
area AREA of window W. AREA < 0 means return the left edge of the
int area;
{
struct frame *f = XFRAME (w->frame);
- int x = FRAME_INTERNAL_BORDER_WIDTH_SAFE (f);
+ int x;
- if (!w->pseudo_window_p)
- {
- x += (WINDOW_LEFT_MARGIN (w) * CANON_X_UNIT (f)
- + FRAME_LEFT_FRINGE_WIDTH (f));
+ if (w->pseudo_window_p)
+ return FRAME_INTERNAL_BORDER_WIDTH (f);
- if (area == TEXT_AREA)
- x += window_box_width (w, LEFT_MARGIN_AREA);
- else if (area == RIGHT_MARGIN_AREA)
- x += (window_box_width (w, LEFT_MARGIN_AREA)
- + window_box_width (w, TEXT_AREA));
- }
+ x = (WINDOW_LEFT_EDGE_X (w)
+ + window_box_left_offset (w, area));
return x;
}
return window_box_left (w, area) + window_box_width (w, area);
}
-
/* Get the bounding box of the display area AREA of window W, without
mode lines, in frame-relative coordinates. AREA < 0 means the
whole window, not including the left and right fringes of
int area;
int *box_x, *box_y, *box_width, *box_height;
{
- struct frame *f = XFRAME (w->frame);
-
- *box_width = window_box_width (w, area);
- *box_height = window_box_height (w);
- *box_x = window_box_left (w, area);
- *box_y = (FRAME_INTERNAL_BORDER_WIDTH_SAFE (f)
- + XFASTINT (w->top) * CANON_Y_UNIT (f));
- if (WINDOW_WANTS_HEADER_LINE_P (w))
- *box_y += CURRENT_HEADER_LINE_HEIGHT (w);
+ if (box_width)
+ *box_width = window_box_width (w, area);
+ if (box_height)
+ *box_height = window_box_height (w);
+ if (box_x)
+ *box_x = window_box_left (w, area);
+ if (box_y)
+ {
+ *box_y = WINDOW_TOP_EDGE_Y (w);
+ if (WINDOW_WANTS_HEADER_LINE_P (w))
+ *box_y += CURRENT_HEADER_LINE_HEIGHT (w);
+ }
}
{
int top_y = it.current_y;
int bottom_y = line_bottom_y (&it);
- int window_top_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w);
+ int window_top_y = WINDOW_HEADER_LINE_HEIGHT (w);
if (top_y < window_top_y)
visible_p = bottom_y > window_top_y;
#ifdef HAVE_WINDOW_SYSTEM
if (FRAME_WINDOW_P (f))
{
- /* Arrange for the division in PIXEL_TO_CHAR_COL etc. to round down
+ /* Arrange for the division in FRAME_PIXEL_X_TO_COL etc. to round down
even for negative values. */
if (pix_x < 0)
- pix_x -= FONT_WIDTH (FRAME_FONT (f)) - 1;
+ pix_x -= FRAME_COLUMN_WIDTH (f) - 1;
if (pix_y < 0)
- pix_y -= FRAME_X_OUTPUT(f)->line_height - 1;
+ pix_y -= FRAME_LINE_HEIGHT (f) - 1;
- pix_x = PIXEL_TO_CHAR_COL (f, pix_x);
- pix_y = PIXEL_TO_CHAR_ROW (f, pix_y);
+ pix_x = FRAME_PIXEL_X_TO_COL (f, pix_x);
+ pix_y = FRAME_PIXEL_Y_TO_LINE (f, pix_y);
if (bounds)
STORE_NATIVE_RECT (*bounds,
- CHAR_TO_PIXEL_COL (f, pix_x),
- CHAR_TO_PIXEL_ROW (f, pix_y),
- FONT_WIDTH (FRAME_FONT (f)) - 1,
- FRAME_X_OUTPUT (f)->line_height - 1);
+ FRAME_COL_TO_PIXEL_X (f, pix_x),
+ FRAME_LINE_TO_PIXEL_Y (f, pix_y),
+ FRAME_COLUMN_WIDTH (f) - 1,
+ FRAME_LINE_HEIGHT (f) - 1);
if (!noclip)
{
if (pix_x < 0)
pix_x = 0;
- else if (pix_x > FRAME_WINDOW_WIDTH (f))
- pix_x = FRAME_WINDOW_WIDTH (f);
+ else if (pix_x > FRAME_TOTAL_COLS (f))
+ pix_x = FRAME_TOTAL_COLS (f);
if (pix_y < 0)
pix_y = 0;
- else if (pix_y > f->height)
- pix_y = f->height;
+ else if (pix_y > FRAME_LINES (f))
+ pix_y = FRAME_LINES (f);
}
}
#endif
++glyph;
}
+ /* If first glyph is partially visible, its first visible position is still 0. */
+ if (hpos < 0)
+ hpos = 0;
+
success_p = 1;
}
else
date. */
static struct glyph *
-x_y_to_hpos_vpos (w, x, y, hpos, vpos, area, buffer_only_p)
+x_y_to_hpos_vpos (w, x, y, hpos, vpos, dx, dy, area)
struct window *w;
int x, y;
- int *hpos, *vpos, *area;
- int buffer_only_p;
+ int *hpos, *vpos, *dx, *dy, *area;
{
struct glyph *glyph, *end;
struct glyph_row *row = NULL;
- int x0, i, left_area_width;
+ int x0, i;
/* Find row containing Y. Give up if some row is not enabled. */
for (i = 0; i < w->current_matrix->nrows; ++i)
}
else
{
- left_area_width = window_box_width (w, LEFT_MARGIN_AREA);
- if (x < left_area_width)
+ if (x < window_box_left_offset (w, TEXT_AREA))
{
*area = LEFT_MARGIN_AREA;
- x0 = 0;
+ x0 = window_box_left_offset (w, LEFT_MARGIN_AREA);
}
- else if (x < left_area_width + window_box_width (w, TEXT_AREA))
+ else if (x < window_box_right_offset (w, TEXT_AREA))
{
*area = TEXT_AREA;
- x0 = row->x + left_area_width;
+ x0 = window_box_left_offset (w, TEXT_AREA) + min (row->x, 0);
}
else
{
*area = RIGHT_MARGIN_AREA;
- x0 = left_area_width + window_box_width (w, TEXT_AREA);
+ x0 = window_box_left_offset (w, RIGHT_MARGIN_AREA);
}
}
/* Find glyph containing X. */
glyph = row->glyphs[*area];
end = glyph + row->used[*area];
- while (glyph < end)
+ x -= x0;
+ while (glyph < end && x >= glyph->pixel_width)
{
- if (x < x0 + glyph->pixel_width)
- {
- if (w->pseudo_window_p)
- break;
- else if (!buffer_only_p || BUFFERP (glyph->object))
- break;
- }
-
- x0 += glyph->pixel_width;
+ x -= glyph->pixel_width;
++glyph;
}
if (glyph == end)
return NULL;
+ if (dx)
+ {
+ *dx = x;
+ *dy = y - (row->y + row->ascent - glyph->ascent);
+ }
+
*hpos = glyph - row->glyphs[*area];
return glyph;
}
/* A pseudo-window is always full-width, and starts at the
left edge of the frame, plus a frame border. */
struct frame *f = XFRAME (w->frame);
- *x -= FRAME_INTERNAL_BORDER_WIDTH_SAFE (f);
+ *x -= FRAME_INTERNAL_BORDER_WIDTH (f);
*y = FRAME_TO_WINDOW_PIXEL_Y (w, *y);
}
else
{
- *x = FRAME_TO_WINDOW_PIXEL_X (w, *x);
+ *x -= WINDOW_LEFT_EDGE_X (w);
*y = FRAME_TO_WINDOW_PIXEL_Y (w, *y);
}
}
if (s->row->full_width_p)
{
- /* Draw full-width. X coordinates are relative to S->w->left. */
- int canon_x = CANON_X_UNIT (s->f);
-
- r.x = WINDOW_LEFT_MARGIN (s->w) * canon_x;
- r.width = XFASTINT (s->w->width) * canon_x;
-
- if (FRAME_HAS_VERTICAL_SCROLL_BARS (s->f))
- {
- int width = FRAME_SCROLL_BAR_WIDTH (s->f) * canon_x;
- if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (s->f))
- r.x -= width;
- }
-
- r.x += FRAME_INTERNAL_BORDER_WIDTH (s->f);
+ /* Draw full-width. X coordinates are relative to S->w->left_col. */
+ r.x = WINDOW_LEFT_EDGE_X (s->w);
+ r.width = WINDOW_TOTAL_WIDTH (s->w);
/* Unless displaying a mode or menu bar line, which are always
fully visible, clip to the visible part of the row. */
else
{
/* This is a text line that may be partially visible. */
- r.x = WINDOW_AREA_TO_FRAME_PIXEL_X (s->w, s->area, 0);
+ r.x = window_box_left (s->w, s->area);
r.width = window_box_width (s->w, s->area);
r.height = s->row->visible_height;
}
intentionally draws over other lines. */
if (s->for_overlaps_p)
{
- r.y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (s->w);
+ r.y = WINDOW_HEADER_LINE_HEIGHT (s->w);
r.height = window_text_bottom_y (s->w) - r.y;
}
else
partially visible lines at the top of a window. */
if (!s->row->full_width_p
&& MATRIX_ROW_PARTIALLY_VISIBLE_AT_TOP_P (s->w, s->row))
- r.y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (s->w);
+ r.y = WINDOW_HEADER_LINE_HEIGHT (s->w);
else
r.y = max (0, s->row->y);
r.y = WINDOW_TO_FRAME_PIXEL_Y (s->w, r.y);
-#ifdef HAVE_NTGUI
- /* ++KFS: From W32 port, but it looks ok for all platforms to me. */
/* If drawing the cursor, don't let glyph draw outside its
advertised boundaries. Cleartype does this under some circumstances. */
if (s->hl == DRAW_CURSOR)
{
+ struct glyph *glyph = s->first_glyph;
+ int height;
+
if (s->x > r.x)
{
r.width -= s->x - r.x;
r.x = s->x;
}
- r.width = min (r.width, s->first_glyph->pixel_width);
+ r.width = min (r.width, glyph->pixel_width);
+
+ /* Don't draw cursor glyph taller than our actual glyph. */
+ height = max (FRAME_LINE_HEIGHT (s->f), glyph->ascent + glyph->descent);
+ if (height < r.height)
+ {
+ int max_y = r.y + r.height;
+ r.y = min (max_y, s->ybase + glyph->descent - height);
+ r.height = min (max_y - r.y, height);
+ }
}
-#endif
#ifdef CONVERT_FROM_XRECT
CONVERT_FROM_XRECT (r, *nr);
xassert (STRINGP (it->string));
xassert (IT_STRING_CHARPOS (*it) >= 0);
}
- else if (it->method == next_element_from_buffer)
+ else
{
- /* Check that character and byte positions agree. */
- xassert (IT_CHARPOS (*it) == BYTE_TO_CHAR (IT_BYTEPOS (*it)));
+ xassert (IT_STRING_CHARPOS (*it) < 0);
+ if (it->method == next_element_from_buffer)
+ {
+ /* Check that character and byte positions agree. */
+ xassert (IT_CHARPOS (*it) == BYTE_TO_CHAR (IT_BYTEPOS (*it)));
+ }
}
if (it->dpvec)
it->current.overlay_string_index = -1;
it->current.dpvec_index = -1;
it->base_face_id = base_face_id;
+ it->string = Qnil;
+ IT_STRING_CHARPOS (*it) = IT_STRING_BYTEPOS (*it) = -1;
/* The window in which we iterate over current_buffer: */
XSETWINDOW (it->window, w);
attribute changes of named faces, recompute them. When running
in batch mode, the face cache of Vterminal_frame is null. If
we happen to get called, make a dummy face cache. */
- if (
-#ifndef WINDOWSNT
- noninteractive &&
-#endif
- FRAME_FACE_CACHE (it->f) == NULL)
+ if (noninteractive && FRAME_FACE_CACHE (it->f) == NULL)
init_frame_faces (it->f);
if (FRAME_FACE_CACHE (it->f)->used == 0)
recompute_basic_faces (it->f);
{
/* Mode lines, menu bar in terminal frames. */
it->first_visible_x = 0;
- it->last_visible_x = XFASTINT (w->width) * CANON_X_UNIT (it->f);
+ it->last_visible_x = WINDOW_TOTAL_WIDTH (w);
}
else
{
it->first_visible_x
- = XFASTINT (it->w->hscroll) * CANON_X_UNIT (it->f);
+ = XFASTINT (it->w->hscroll) * FRAME_COLUMN_WIDTH (it->f);
it->last_visible_x = (it->first_visible_x
+ window_box_width (w, TEXT_AREA));
}
it->header_line_p = WINDOW_WANTS_HEADER_LINE_P (w);
- it->current_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w) + w->vscroll;
+ it->current_y = WINDOW_HEADER_LINE_HEIGHT (w) + w->vscroll;
}
/* Leave room for a border glyph. */
else
IT_BYTEPOS (*it) = bytepos;
+ it->start = it->current;
+
/* Compute faces etc. */
reseat (it, it->current.pos, 1);
}
row = w->desired_matrix->rows + first_vpos;
init_iterator (it, w, CHARPOS (pos), BYTEPOS (pos), row, DEFAULT_FACE_ID);
+ it->first_vpos = first_vpos;
if (!it->truncate_lines_p)
{
struct glyph_row *row;
{
init_from_display_pos (it, w, &row->start);
+ it->start = row->start;
it->continuation_lines_width = row->continuation_lines_width;
CHECK_IT (it);
}
&& !EQ (XCAR (prop), Qraise)
/* Marginal area specifications. */
&& !(CONSP (XCAR (prop)) && EQ (XCAR (XCAR (prop)), Qmargin))
+ && !EQ (XCAR (prop), Qleft_fringe)
+ && !EQ (XCAR (prop), Qright_fringe)
&& !NILP (XCAR (prop)))
{
for (; CONSP (prop); prop = XCDR (prop))
text properties change there. */
it->stop_charpos = position->charpos;
+ if (CONSP (prop)
+ && (EQ (XCAR (prop), Qleft_fringe)
+ || EQ (XCAR (prop), Qright_fringe))
+ && CONSP (XCDR (prop)))
+ {
+ unsigned face_id = DEFAULT_FACE_ID;
+
+ /* Save current settings of IT so that we can restore them
+ when we are finished with the glyph property value. */
+
+ /* `(left-fringe BITMAP FACE)'. */
+ if (FRAME_TERMCAP_P (it->f) || FRAME_MSDOS_P (it->f))
+ return 0;
+
+#ifdef HAVE_WINDOW_SYSTEM
+ value = XCAR (XCDR (prop));
+ if (!NUMBERP (value)
+ || !valid_fringe_bitmap_id_p (XINT (value)))
+ return 0;
+
+ if (CONSP (XCDR (XCDR (prop))))
+ {
+ Lisp_Object face_name = XCAR (XCDR (XCDR (prop)));
+
+ face_id = lookup_named_face (it->f, face_name, 'A');
+ if (face_id < 0)
+ return 0;
+ }
+
+ push_it (it);
+
+ it->area = TEXT_AREA;
+ it->what = IT_IMAGE;
+ it->image_id = -1; /* no image */
+ it->position = start_pos;
+ it->object = NILP (object) ? it->w->buffer : object;
+ it->method = next_element_from_image;
+ it->face_id = face_id;
+
+ /* Say that we haven't consumed the characters with
+ `display' property yet. The call to pop_it in
+ set_iterator_to_next will clean this up. */
+ *position = start_pos;
+
+ if (EQ (XCAR (prop), Qleft_fringe))
+ {
+ it->left_user_fringe_bitmap = XINT (value);
+ it->left_user_fringe_face_id = face_id;
+ }
+ else
+ {
+ it->right_user_fringe_bitmap = XINT (value);
+ it->right_user_fringe_face_id = face_id;
+ }
+#endif /* HAVE_WINDOW_SYSTEM */
+ return 1;
+ }
+
location = Qunbound;
if (CONSP (prop) && CONSP (XCAR (prop)))
{
value = prop;
}
+ valid_p = (STRINGP (value)
#ifdef HAVE_WINDOW_SYSTEM
- if (FRAME_TERMCAP_P (it->f))
- valid_p = STRINGP (value);
- else
- valid_p = (STRINGP (value)
- || (CONSP (value) && EQ (XCAR (value), Qspace))
- || valid_image_p (value));
-#else /* not HAVE_WINDOW_SYSTEM */
- valid_p = STRINGP (value);
+ || (!FRAME_TERMCAP_P (it->f) && valid_image_p (value))
#endif /* not HAVE_WINDOW_SYSTEM */
+ || (CONSP (value) && EQ (XCAR (value), Qspace)));
if ((EQ (location, Qleft_margin)
|| EQ (location, Qright_margin)
return 0;
}
- return CONSP (prop) && EQ (XCAR (prop), Qimage);
+ return (CONSP (prop)
+ && (EQ (XCAR (prop), Qimage)
+ || EQ (XCAR (prop), Qspace)));
}
int charpos;
{
extern Lisp_Object Qafter_string, Qbefore_string, Qwindow, Qpriority;
- Lisp_Object ov, overlay, window, str, invisible;
+ Lisp_Object overlay, window, str, invisible;
+ struct Lisp_Overlay *ov;
int start, end;
int size = 20;
int n = 0, i, j, invis_p;
while (0)
/* Process overlay before the overlay center. */
- for (ov = current_buffer->overlays_before; CONSP (ov); ov = XCDR (ov))
+ for (ov = current_buffer->overlays_before; ov; ov = ov->next)
{
- overlay = XCAR (ov);
+ XSETMISC (overlay, ov);
xassert (OVERLAYP (overlay));
start = OVERLAY_POSITION (OVERLAY_START (overlay));
end = OVERLAY_POSITION (OVERLAY_END (overlay));
}
/* Process overlays after the overlay center. */
- for (ov = current_buffer->overlays_after; CONSP (ov); ov = XCDR (ov))
+ for (ov = current_buffer->overlays_after; ov; ov = ov->next)
{
- overlay = XCAR (ov);
+ XSETMISC (overlay, ov);
xassert (OVERLAYP (overlay));
start = OVERLAY_POSITION (OVERLAY_START (overlay));
end = OVERLAY_POSITION (OVERLAY_END (overlay));
IT_STRING_BYTEPOS (*it) = -1;
it->string = Qnil;
it->method = next_element_from_buffer;
+ /* RMS: I added this to fix a bug in move_it_vertically_backward
+ where it->area continued to relate to the starting point
+ for the backward motion. Bug report from
+ Nick Roberts <nick@nick.uklinux.net> on 19 May 2003.
+ However, I am not sure whether reseat still does the right thing
+ in general after this change. */
+ it->area = TEXT_AREA;
it->multibyte_p = !NILP (current_buffer->enable_multibyte_characters);
it->sp = 0;
it->face_before_selective_p = 0;
saved_glyph_row = it->glyph_row;
it->glyph_row = NULL;
+#define BUFFER_POS_REACHED_P() \
+ ((op & MOVE_TO_POS) != 0 \
+ && BUFFERP (it->object) \
+ && IT_CHARPOS (*it) >= to_charpos)
+
while (1)
{
int x, i, ascent = 0, descent = 0;
/* Stop when ZV or TO_CHARPOS reached. */
if (!get_next_display_element (it)
- || ((op & MOVE_TO_POS) != 0
- && BUFFERP (it->object)
- && IT_CHARPOS (*it) >= to_charpos))
+ || BUFFER_POS_REACHED_P ())
{
result = MOVE_POS_MATCH_OR_ZV;
break;
++it->hpos;
it->current_x = new_x;
if (i == it->nglyphs - 1)
- set_iterator_to_next (it, 1);
+ {
+ set_iterator_to_next (it, 1);
+#ifdef HAVE_WINDOW_SYSTEM
+ if (IT_OVERFLOW_NEWLINE_INTO_FRINGE (it))
+ {
+ if (!get_next_display_element (it)
+ || BUFFER_POS_REACHED_P ())
+ {
+ result = MOVE_POS_MATCH_OR_ZV;
+ break;
+ }
+ if (ITERATOR_AT_END_OF_LINE_P (it))
+ {
+ result = MOVE_NEWLINE_OR_CR;
+ break;
+ }
+ }
+#endif /* HAVE_WINDOW_SYSTEM */
+ }
}
else
{
if (it->truncate_lines_p
&& it->current_x >= it->last_visible_x)
{
+#ifdef HAVE_WINDOW_SYSTEM
+ if (IT_OVERFLOW_NEWLINE_INTO_FRINGE (it))
+ {
+ if (!get_next_display_element (it)
+ || BUFFER_POS_REACHED_P ())
+ {
+ result = MOVE_POS_MATCH_OR_ZV;
+ break;
+ }
+ if (ITERATOR_AT_END_OF_LINE_P (it))
+ {
+ result = MOVE_NEWLINE_OR_CR;
+ break;
+ }
+ }
+#endif /* HAVE_WINDOW_SYSTEM */
result = MOVE_LINE_TRUNCATED;
break;
}
}
+#undef BUFFER_POS_REACHED_P
+
/* Restore the iterator settings altered at the beginning of this
function. */
it->glyph_row = saved_glyph_row;
xassert (dy >= 0);
/* Estimate how many newlines we must move back. */
- nlines = max (1, dy / CANON_Y_UNIT (it->f));
+ nlines = max (1, dy / FRAME_LINE_HEIGHT (it->f));
/* Set the iterator's position that many lines back. */
while (nlines-- && IT_CHARPOS (*it) > BEGV)
move_it_to (&it2, start_pos, -1, -1, -1, MOVE_TO_POS);
xassert (IT_CHARPOS (*it) >= BEGV);
+ /* H is the actual vertical distance from the position in *IT
+ and the starting position. */
h = it2.current_y - it->current_y;
+ /* NLINES is the distance in number of lines. */
nlines = it2.vpos - it->vpos;
- /* Correct IT's y and vpos position. */
+ /* Correct IT's y and vpos position
+ so that they are relative to the starting point. */
it->vpos -= nlines;
it->current_y -= h;
move_it_by_lines (it, nlines, 1);
xassert (IT_CHARPOS (*it) <= start_pos);
}
- else if (nlines)
+ else
{
- /* The y-position we try to reach. Note that h has been
- subtracted in front of the if-statement. */
+ /* The y-position we try to reach, relative to *IT.
+ Note that H has been subtracted in front of the if-statement. */
int target_y = it->current_y + h - dy;
int y0 = it3.current_y;
int y1 = line_bottom_y (&it3);
XMARKER (oldpoint)->bytepos);
UNGCPRO;
- unchain_marker (oldpoint);
- unchain_marker (oldbegv);
- unchain_marker (oldzv);
+ unchain_marker (XMARKER (oldpoint));
+ unchain_marker (XMARKER (oldbegv));
+ unchain_marker (XMARKER (oldzv));
tem = Fget_buffer_window (Fcurrent_buffer (), Qt);
set_buffer_internal (oldbuf);
{
struct it it;
struct window *root = XWINDOW (FRAME_ROOT_WINDOW (f));
- int total_height = XFASTINT (root->height) + XFASTINT (w->height);
+ int total_height = WINDOW_TOTAL_LINES (root) + WINDOW_TOTAL_LINES (w);
int height, max_height;
- int unit = CANON_Y_UNIT (f);
+ int unit = FRAME_LINE_HEIGHT (f);
struct text_pos start;
struct buffer *old_current_buffer = NULL;
/* Compute the max. number of lines specified by the user. */
if (FLOATP (Vmax_mini_window_height))
- max_height = XFLOATINT (Vmax_mini_window_height) * FRAME_HEIGHT (f);
+ max_height = XFLOATINT (Vmax_mini_window_height) * FRAME_LINES (f);
else if (INTEGERP (Vmax_mini_window_height))
max_height = XINT (Vmax_mini_window_height);
else
{
/* Let it grow only, until we display an empty message, in which
case the window shrinks again. */
- if (height > XFASTINT (w->height))
+ if (height > WINDOW_TOTAL_LINES (w))
{
- int old_height = XFASTINT (w->height);
+ int old_height = WINDOW_TOTAL_LINES (w);
freeze_window_starts (f, 1);
- grow_mini_window (w, height - XFASTINT (w->height));
- window_height_changed_p = XFASTINT (w->height) != old_height;
+ grow_mini_window (w, height - WINDOW_TOTAL_LINES (w));
+ window_height_changed_p = WINDOW_TOTAL_LINES (w) != old_height;
}
- else if (height < XFASTINT (w->height)
+ else if (height < WINDOW_TOTAL_LINES (w)
&& (exact_p || BEGV == ZV))
{
- int old_height = XFASTINT (w->height);
+ int old_height = WINDOW_TOTAL_LINES (w);
freeze_window_starts (f, 0);
shrink_mini_window (w);
- window_height_changed_p = XFASTINT (w->height) != old_height;
+ window_height_changed_p = WINDOW_TOTAL_LINES (w) != old_height;
}
}
else
{
/* Always resize to exact size needed. */
- if (height > XFASTINT (w->height))
+ if (height > WINDOW_TOTAL_LINES (w))
{
- int old_height = XFASTINT (w->height);
+ int old_height = WINDOW_TOTAL_LINES (w);
freeze_window_starts (f, 1);
- grow_mini_window (w, height - XFASTINT (w->height));
- window_height_changed_p = XFASTINT (w->height) != old_height;
+ grow_mini_window (w, height - WINDOW_TOTAL_LINES (w));
+ window_height_changed_p = WINDOW_TOTAL_LINES (w) != old_height;
}
- else if (height < XFASTINT (w->height))
+ else if (height < WINDOW_TOTAL_LINES (w))
{
- int old_height = XFASTINT (w->height);
+ int old_height = WINDOW_TOTAL_LINES (w);
freeze_window_starts (f, 0);
shrink_mini_window (w);
if (height)
{
freeze_window_starts (f, 1);
- grow_mini_window (w, height - XFASTINT (w->height));
+ grow_mini_window (w, height - WINDOW_TOTAL_LINES (w));
}
- window_height_changed_p = XFASTINT (w->height) != old_height;
+ window_height_changed_p = WINDOW_TOTAL_LINES (w) != old_height;
}
}
if (FRAME_VISIBLE_P (f) && FRAME_GARBAGED_P (f))
{
if (f->resized_p)
- Fredraw_frame (frame);
+ {
+ Fredraw_frame (frame);
+ f->force_flush_display_p = 1;
+ }
clear_current_matrices (f);
changed_count++;
f->garbaged = 0;
int save_match_data;
{
#ifdef USE_GTK
- int do_update = FRAME_EXTERNAL_TOOL_BAR(f);
+ int do_update = FRAME_EXTERNAL_TOOL_BAR (f);
#else
int do_update = WINDOWP (f->tool_bar_window)
- && XFASTINT (XWINDOW (f->tool_bar_window)->height) > 0;
+ && WINDOW_TOTAL_LINES (XWINDOW (f->tool_bar_window)) > 0;
#endif
if (do_update)
windows_or_buffers_changed anyway. */
if (windows_or_buffers_changed
|| !NILP (w->update_mode_line)
+ || update_mode_lines
|| ((BUF_SAVE_MODIFF (XBUFFER (w->buffer))
< BUF_MODIFF (XBUFFER (w->buffer)))
!= !NILP (w->last_had_star))
{
struct buffer *prev = current_buffer;
int count = SPECPDL_INDEX ();
+ Lisp_Object old_tool_bar;
+ struct gcpro gcpro1;
/* Set current_buffer to the buffer of the selected
window of the frame, so that we get the right local
specbind (Qoverriding_local_map, Qnil);
}
+ old_tool_bar = f->tool_bar_items;
+ GCPRO1 (old_tool_bar);
+
/* Build desired tool-bar items from keymaps. */
+ BLOCK_INPUT;
f->tool_bar_items
= tool_bar_items (f->tool_bar_items, &f->n_tool_bar_items);
+ UNBLOCK_INPUT;
- /* Redisplay the tool-bar in case we changed it. */
- w->update_mode_line = Qt;
+ /* Redisplay the tool-bar if we changed it. */
+ if (! NILP (Fequal (old_tool_bar, f->tool_bar_items)))
+ w->update_mode_line = Qt;
+
+ UNGCPRO;
unbind_to (count, Qnil);
set_buffer_internal_1 (prev);
int enabled_p = !NILP (PROP (TOOL_BAR_ITEM_ENABLED_P));
int selected_p = !NILP (PROP (TOOL_BAR_ITEM_SELECTED_P));
int hmargin, vmargin, relief, idx, end;
- extern Lisp_Object QCrelief, QCmargin, QCconversion, Qimage;
+ extern Lisp_Object QCrelief, QCmargin, QCconversion;
/* If image is a vector, choose the image according to the
button state. */
F->desired_tool_bar_string in the tool-bar window of frame F. */
init_iterator (&it, w, -1, -1, w->desired_matrix->rows, TOOL_BAR_FACE_ID);
it.first_visible_x = 0;
- it.last_visible_x = FRAME_WINDOW_WIDTH (f) * CANON_X_UNIT (f);
+ it.last_visible_x = FRAME_TOTAL_COLS (f) * FRAME_COLUMN_WIDTH (f);
reseat_to_string (&it, NULL, f->desired_tool_bar_string, 0, 0, 0, -1);
while (!ITERATOR_AT_END_P (&it))
display_tool_bar_line (&it);
}
- return (it.current_y + CANON_Y_UNIT (f) - 1) / CANON_Y_UNIT (f);
+ return (it.current_y + FRAME_LINE_HEIGHT (f) - 1) / FRAME_LINE_HEIGHT (f);
}
if (WINDOWP (f->tool_bar_window)
|| (w = XWINDOW (f->tool_bar_window),
- XFASTINT (w->height) > 0))
+ WINDOW_TOTAL_LINES (w) > 0))
{
update_tool_bar (f, 1);
if (f->n_tool_bar_items)
int change_height_p = 0;
#ifdef USE_GTK
- if (FRAME_EXTERNAL_TOOL_BAR(f))
+ if (FRAME_EXTERNAL_TOOL_BAR (f))
update_frame_tool_bar (f);
return 0;
#endif
can turn off tool-bars by specifying tool-bar-lines zero. */
if (!WINDOWP (f->tool_bar_window)
|| (w = XWINDOW (f->tool_bar_window),
- XFASTINT (w->height) == 0))
+ WINDOW_TOTAL_LINES (w) == 0))
return 0;
/* Set up an iterator for the tool-bar window. */
init_iterator (&it, w, -1, -1, w->desired_matrix->rows, TOOL_BAR_FACE_ID);
it.first_visible_x = 0;
- it.last_visible_x = FRAME_WINDOW_WIDTH (f) * CANON_X_UNIT (f);
+ it.last_visible_x = FRAME_TOTAL_COLS (f) * FRAME_COLUMN_WIDTH (f);
row = it.glyph_row;
/* Build a string that represents the contents of the tool-bar. */
/* If there are blank lines at the end, except for a partially
visible blank line at the end that is smaller than
- CANON_Y_UNIT, change the tool-bar's height. */
+ FRAME_LINE_HEIGHT, change the tool-bar's height. */
row = it.glyph_row - 1;
if (!row->displays_text_p
- && row->height >= CANON_Y_UNIT (f))
+ && row->height >= FRAME_LINE_HEIGHT (f))
change_height_p = 1;
/* If row displays tool-bar items, but is partially visible,
frame parameter. */
if (change_height_p
&& (nlines = tool_bar_lines_needed (f),
- nlines != XFASTINT (w->height)))
+ nlines != WINDOW_TOTAL_LINES (w)))
{
extern Lisp_Object Qtool_bar_lines;
Lisp_Object frame;
- int old_height = XFASTINT (w->height);
+ int old_height = WINDOW_TOTAL_LINES (w);
XSETFRAME (frame, f);
clear_glyph_matrix (w->desired_matrix);
Fcons (Fcons (Qtool_bar_lines,
make_number (nlines)),
Qnil));
- if (XFASTINT (w->height) != old_height)
+ if (WINDOW_TOTAL_LINES (w) != old_height)
fonts_changed_p = 1;
}
}
int area;
/* Find the glyph under X/Y. */
- *glyph = x_y_to_hpos_vpos (w, x, y, hpos, vpos, &area, 0);
+ *glyph = x_y_to_hpos_vpos (w, x, y, hpos, vpos, 0, 0, &area);
if (*glyph == NULL)
return -1;
{
Lisp_Object key, frame;
struct input_event event;
+ EVENT_INIT (event);
/* Show item in released state. */
show_mouse_face (dpyinfo, DRAW_IMAGE_RAISED);
if (!NILP (enabled_p))
{
/* Compute the x-position of the glyph. In front and past the
- image is a space. We include this is the highlighted area. */
+ image is a space. We include this in the highlighted area. */
row = MATRIX_ROW (w->current_matrix, vpos);
for (i = x = 0; i < hpos; ++i)
x += row->glyphs[TEXT_AREA][i].pixel_width;
\f
-/***********************************************************************
- Fringes
- ***********************************************************************/
-
-#ifdef HAVE_WINDOW_SYSTEM
-
-/* An arrow like this: `<-'. */
-static unsigned char left_bits[] = {
- 0x18, 0x0c, 0x06, 0x3f, 0x3f, 0x06, 0x0c, 0x18};
-
-/* Right truncation arrow bitmap `->'. */
-static unsigned char right_bits[] = {
- 0x18, 0x30, 0x60, 0xfc, 0xfc, 0x60, 0x30, 0x18};
-
-/* Marker for continued lines. */
-static unsigned char continued_bits[] = {
- 0x3c, 0x7c, 0xc0, 0xe4, 0xfc, 0x7c, 0x3c, 0x7c};
-
-/* Marker for continuation lines. */
-static unsigned char continuation_bits[] = {
- 0x3c, 0x3e, 0x03, 0x27, 0x3f, 0x3e, 0x3c, 0x3e};
-
-/* Overlay arrow bitmap. A triangular arrow. */
-static unsigned char ov_bits[] = {
- 0x03, 0x0f, 0x1f, 0x3f, 0x3f, 0x1f, 0x0f, 0x03};
-
-/* Bitmap drawn to indicate lines not displaying text if
- `indicate-empty-lines' is non-nil. */
-static unsigned char zv_bits[] = {
- 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00,
- 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00,
- 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00,
- 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00,
- 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00,
- 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00,
- 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00,
- 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00};
-
-struct fringe_bitmap fringe_bitmaps[MAX_FRINGE_BITMAPS] =
-{
- { 0, 0, 0, NULL /* NO_FRINGE_BITMAP */ },
- { 8, sizeof (left_bits), 0, left_bits },
- { 8, sizeof (right_bits), 0, right_bits },
- { 8, sizeof (continued_bits), 0, continued_bits },
- { 8, sizeof (continuation_bits), 0, continuation_bits },
- { 8, sizeof (ov_bits), 0, ov_bits },
- { 8, sizeof (zv_bits), 3, zv_bits }
-};
-
-
-/* Draw the bitmap WHICH in one of the left or right fringes of
- window W. ROW is the glyph row for which to display the bitmap; it
- determines the vertical position at which the bitmap has to be
- drawn. */
-
-static void
-draw_fringe_bitmap (w, row, which, left_p)
- struct window *w;
- struct glyph_row *row;
- enum fringe_bitmap_type which;
- int left_p;
-{
- struct frame *f = XFRAME (WINDOW_FRAME (w));
- struct draw_fringe_bitmap_params p;
-
- /* Convert row to frame coordinates. */
- p.y = WINDOW_TO_FRAME_PIXEL_Y (w, row->y);
-
- p.which = which;
- p.wd = fringe_bitmaps[which].width;
-
- p.h = fringe_bitmaps[which].height;
- p.dh = (fringe_bitmaps[which].period
- ? (p.y % fringe_bitmaps[which].period)
- : 0);
- p.h -= p.dh;
- /* Clip bitmap if too high. */
- if (p.h > row->height)
- p.h = row->height;
-
- p.face = FACE_FROM_ID (f, FRINGE_FACE_ID);
- PREPARE_FACE_FOR_DISPLAY (f, p.face);
-
- /* Clear left fringe if no bitmap to draw or if bitmap doesn't fill
- the fringe. */
- p.bx = -1;
- if (left_p)
- {
- if (p.wd > FRAME_X_LEFT_FRINGE_WIDTH (f))
- p.wd = FRAME_X_LEFT_FRINGE_WIDTH (f);
- p.x = (WINDOW_TO_FRAME_PIXEL_X (w, 0)
- - p.wd
- - (FRAME_X_LEFT_FRINGE_WIDTH (f) - p.wd) / 2);
- if (p.wd < FRAME_X_LEFT_FRINGE_WIDTH (f) || row->height > p.h)
- {
- /* If W has a vertical border to its left, don't draw over it. */
- int border = ((XFASTINT (w->left) > 0
- && !FRAME_HAS_VERTICAL_SCROLL_BARS (f))
- ? 1 : 0);
- p.bx = (window_box_left (w, -1)
- - FRAME_X_LEFT_FRINGE_WIDTH (f)
- + border);
- p.nx = (FRAME_X_LEFT_FRINGE_WIDTH (f) - border);
- }
- }
- else
- {
- if (p.wd > FRAME_X_RIGHT_FRINGE_WIDTH (f))
- p.wd = FRAME_X_RIGHT_FRINGE_WIDTH (f);
- p.x = (window_box_right (w, -1)
- + (FRAME_X_RIGHT_FRINGE_WIDTH (f) - p.wd) / 2);
- /* Clear right fringe if no bitmap to draw of if bitmap doesn't fill
- the fringe. */
- if (p.wd < FRAME_X_RIGHT_FRINGE_WIDTH (f) || row->height > p.h)
- {
- p.bx = window_box_right (w, -1);
- p.nx = FRAME_X_RIGHT_FRINGE_WIDTH (f);
- }
- }
-
- if (p.bx >= 0)
- {
- int header_line_height = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w);
-
- p.by = WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height, row->y));
- p.ny = row->visible_height;
- }
-
- /* Adjust y to the offset in the row to start drawing the bitmap. */
- p.y += (row->height - p.h) / 2;
-
- rif->draw_fringe_bitmap (w, row, &p);
-}
-
-/* Draw fringe bitmaps for glyph row ROW on window W. Call this
- function with input blocked. */
-
-void
-draw_row_fringe_bitmaps (w, row)
- struct window *w;
- struct glyph_row *row;
-{
- struct frame *f = XFRAME (w->frame);
- enum fringe_bitmap_type bitmap;
-
- xassert (interrupt_input_blocked);
-
- /* If row is completely invisible, because of vscrolling, we
- don't have to draw anything. */
- if (row->visible_height <= 0)
- return;
-
- if (FRAME_X_LEFT_FRINGE_WIDTH (f) != 0)
- {
- /* Decide which bitmap to draw in the left fringe. */
- if (row->overlay_arrow_p)
- bitmap = OVERLAY_ARROW_BITMAP;
- else if (row->truncated_on_left_p)
- bitmap = LEFT_TRUNCATION_BITMAP;
- else if (MATRIX_ROW_CONTINUATION_LINE_P (row))
- bitmap = CONTINUATION_LINE_BITMAP;
- else if (row->indicate_empty_line_p)
- bitmap = ZV_LINE_BITMAP;
- else
- bitmap = NO_FRINGE_BITMAP;
-
- draw_fringe_bitmap (w, row, bitmap, 1);
- }
-
- if (FRAME_X_RIGHT_FRINGE_WIDTH (f) != 0)
- {
- /* Decide which bitmap to draw in the right fringe. */
- if (row->truncated_on_right_p)
- bitmap = RIGHT_TRUNCATION_BITMAP;
- else if (row->continued_p)
- bitmap = CONTINUED_LINE_BITMAP;
- else if (row->indicate_empty_line_p && FRAME_X_LEFT_FRINGE_WIDTH (f) == 0)
- bitmap = ZV_LINE_BITMAP;
- else
- bitmap = NO_FRINGE_BITMAP;
-
- draw_fringe_bitmap (w, row, bitmap, 0);
- }
-}
-
-
-/* Compute actual fringe widths */
-
-void
-compute_fringe_widths (f, redraw)
- struct frame *f;
- int redraw;
-{
- int o_left = FRAME_X_LEFT_FRINGE_WIDTH (f);
- int o_right = FRAME_X_RIGHT_FRINGE_WIDTH (f);
- int o_cols = FRAME_X_FRINGE_COLS (f);
-
- Lisp_Object left_fringe = Fassq (Qleft_fringe, f->param_alist);
- Lisp_Object right_fringe = Fassq (Qright_fringe, f->param_alist);
- int left_fringe_width, right_fringe_width;
-
- if (!NILP (left_fringe))
- left_fringe = Fcdr (left_fringe);
- if (!NILP (right_fringe))
- right_fringe = Fcdr (right_fringe);
-
- left_fringe_width = ((NILP (left_fringe) || !INTEGERP (left_fringe)) ? 8 :
- XINT (left_fringe));
- right_fringe_width = ((NILP (right_fringe) || !INTEGERP (right_fringe)) ? 8 :
- XINT (right_fringe));
-
- if (left_fringe_width || right_fringe_width)
- {
- int left_wid = left_fringe_width >= 0 ? left_fringe_width : -left_fringe_width;
- int right_wid = right_fringe_width >= 0 ? right_fringe_width : -right_fringe_width;
- int conf_wid = left_wid + right_wid;
- int font_wid = FONT_WIDTH (FRAME_FONT (f));
- int cols = (left_wid + right_wid + font_wid-1) / font_wid;
- int real_wid = cols * font_wid;
- if (left_wid && right_wid)
- {
- if (left_fringe_width < 0)
- {
- /* Left fringe width is fixed, adjust right fringe if necessary */
- FRAME_X_LEFT_FRINGE_WIDTH (f) = left_wid;
- FRAME_X_RIGHT_FRINGE_WIDTH (f) = real_wid - left_wid;
- }
- else if (right_fringe_width < 0)
- {
- /* Right fringe width is fixed, adjust left fringe if necessary */
- FRAME_X_LEFT_FRINGE_WIDTH (f) = real_wid - right_wid;
- FRAME_X_RIGHT_FRINGE_WIDTH (f) = right_wid;
- }
- else
- {
- /* Adjust both fringes with an equal amount.
- Note that we are doing integer arithmetic here, so don't
- lose a pixel if the total width is an odd number. */
- int fill = real_wid - conf_wid;
- FRAME_X_LEFT_FRINGE_WIDTH (f) = left_wid + fill/2;
- FRAME_X_RIGHT_FRINGE_WIDTH (f) = right_wid + fill - fill/2;
- }
- }
- else if (left_fringe_width)
- {
- FRAME_X_LEFT_FRINGE_WIDTH (f) = real_wid;
- FRAME_X_RIGHT_FRINGE_WIDTH (f) = 0;
- }
- else
- {
- FRAME_X_LEFT_FRINGE_WIDTH (f) = 0;
- FRAME_X_RIGHT_FRINGE_WIDTH (f) = real_wid;
- }
- FRAME_X_FRINGE_COLS (f) = cols;
- FRAME_X_FRINGE_WIDTH (f) = real_wid;
- }
- else
- {
- FRAME_X_LEFT_FRINGE_WIDTH (f) = 0;
- FRAME_X_RIGHT_FRINGE_WIDTH (f) = 0;
- FRAME_X_FRINGE_COLS (f) = 0;
- FRAME_X_FRINGE_WIDTH (f) = 0;
- }
-
- if (redraw && FRAME_VISIBLE_P (f))
- if (o_left != FRAME_X_LEFT_FRINGE_WIDTH (f) ||
- o_right != FRAME_X_RIGHT_FRINGE_WIDTH (f) ||
- o_cols != FRAME_X_FRINGE_COLS (f))
- redraw_frame (f);
-}
-
-#endif /* HAVE_WINDOW_SYSTEM */
-
-
-\f
/************************************************************************
Horizontal scrolling
************************************************************************/
hscrolled_p |= hscroll_window_tree (w->vchild);
else if (w->cursor.vpos >= 0)
{
- int h_margin, text_area_x, text_area_y;
- int text_area_width, text_area_height;
+ int h_margin;
+ int text_area_width;
struct glyph_row *current_cursor_row
= MATRIX_ROW (w->current_matrix, w->cursor.vpos);
struct glyph_row *desired_cursor_row
? desired_cursor_row
: current_cursor_row);
- window_box (w, TEXT_AREA, &text_area_x, &text_area_y,
- &text_area_width, &text_area_height);
+ text_area_width = window_box_width (w, TEXT_AREA);
/* Scroll when cursor is inside this scroll margin. */
- h_margin = hscroll_margin * CANON_X_UNIT (XFRAME (w->frame));
+ h_margin = hscroll_margin * WINDOW_FRAME_COLUMN_WIDTH (w);
if ((XFASTINT (w->hscroll)
&& w->cursor.x <= h_margin)
/* Position cursor in window. */
if (!hscroll_relative_p && hscroll_step_abs == 0)
- hscroll = max (0, it.current_x - text_area_width / 2)
- / CANON_X_UNIT (it.f);
+ hscroll = max (0, (it.current_x
+ - (ITERATOR_AT_END_OF_LINE_P (&it)
+ ? (text_area_width - 4 * FRAME_COLUMN_WIDTH (it.f))
+ : (text_area_width / 2))))
+ / FRAME_COLUMN_WIDTH (it.f);
else if (w->cursor.x >= text_area_width - h_margin)
{
if (hscroll_relative_p)
- h_margin;
else
wanted_x = text_area_width
- - hscroll_step_abs * CANON_X_UNIT (it.f)
+ - hscroll_step_abs * FRAME_COLUMN_WIDTH (it.f)
- h_margin;
hscroll
- = max (0, it.current_x - wanted_x) / CANON_X_UNIT (it.f);
+ = max (0, it.current_x - wanted_x) / FRAME_COLUMN_WIDTH (it.f);
}
else
{
wanted_x = text_area_width * hscroll_step_rel
+ h_margin;
else
- wanted_x = hscroll_step_abs * CANON_X_UNIT (it.f)
+ wanted_x = hscroll_step_abs * FRAME_COLUMN_WIDTH (it.f)
+ h_margin;
hscroll
- = max (0, it.current_x - wanted_x) / CANON_X_UNIT (it.f);
+ = max (0, it.current_x - wanted_x) / FRAME_COLUMN_WIDTH (it.f);
}
hscroll = max (hscroll, XFASTINT (w->min_hscroll));
}
-/* Return 1 if point moved out of or into a composition. Otherwise
- return 0. PREV_BUF and PREV_PT are the last point buffer and
- position. BUF and PT are the current point buffer and position. */
-
-int
-check_point_in_composition (prev_buf, prev_pt, buf, pt)
- struct buffer *prev_buf, *buf;
- int prev_pt, pt;
+static Lisp_Object
+overlay_arrow_string_or_property (var, pbitmap)
+ Lisp_Object var;
+ int *pbitmap;
{
- int start, end;
- Lisp_Object prop;
- Lisp_Object buffer;
+ Lisp_Object pstr = Fget (var, Qoverlay_arrow_string);
+ Lisp_Object bitmap;
- XSETBUFFER (buffer, buf);
- /* Check a composition at the last point if point moved within the
- same buffer. */
- if (prev_buf == buf)
+ if (pbitmap)
{
- if (prev_pt == pt)
- /* Point didn't move. */
- return 0;
-
- if (prev_pt > BUF_BEGV (buf) && prev_pt < BUF_ZV (buf)
- && find_composition (prev_pt, -1, &start, &end, &prop, buffer)
- && COMPOSITION_VALID_P (start, end, prop)
- && start < prev_pt && end > prev_pt)
- /* The last point was within the composition. Return 1 iff
- point moved out of the composition. */
- return (pt <= start || pt >= end);
+ *pbitmap = 0;
+ if (bitmap = Fget (var, Qoverlay_arrow_bitmap), INTEGERP (bitmap))
+ *pbitmap = XINT (bitmap);
}
- /* Check a composition at the current point. */
- return (pt > BUF_BEGV (buf) && pt < BUF_ZV (buf)
+ if (!NILP (pstr))
+ return pstr;
+ return Voverlay_arrow_string;
+}
+
+/* Return 1 if there are any overlay-arrows in current_buffer. */
+static int
+overlay_arrow_in_current_buffer_p ()
+{
+ Lisp_Object vlist;
+
+ for (vlist = Voverlay_arrow_variable_list;
+ CONSP (vlist);
+ vlist = XCDR (vlist))
+ {
+ Lisp_Object var = XCAR (vlist);
+ Lisp_Object val;
+
+ if (!SYMBOLP (var))
+ continue;
+ val = find_symbol_value (var);
+ if (MARKERP (val)
+ && current_buffer == XMARKER (val)->buffer)
+ return 1;
+ }
+ return 0;
+}
+
+
+/* Return 1 if any overlay_arrows have moved or overlay-arrow-string
+ has changed. */
+
+static int
+overlay_arrows_changed_p ()
+{
+ Lisp_Object vlist;
+
+ for (vlist = Voverlay_arrow_variable_list;
+ CONSP (vlist);
+ vlist = XCDR (vlist))
+ {
+ Lisp_Object var = XCAR (vlist);
+ Lisp_Object val, pstr;
+
+ if (!SYMBOLP (var))
+ continue;
+ val = find_symbol_value (var);
+ if (!MARKERP (val))
+ continue;
+ if (! EQ (COERCE_MARKER (val),
+ Fget (var, Qlast_arrow_position))
+ || ! (pstr = overlay_arrow_string_or_property (var, 0),
+ EQ (pstr, Fget (var, Qlast_arrow_string))))
+ return 1;
+ }
+ return 0;
+}
+
+/* Mark overlay arrows to be updated on next redisplay. */
+
+static void
+update_overlay_arrows (up_to_date)
+ int up_to_date;
+{
+ Lisp_Object vlist;
+
+ for (vlist = Voverlay_arrow_variable_list;
+ CONSP (vlist);
+ vlist = XCDR (vlist))
+ {
+ Lisp_Object var = XCAR (vlist);
+
+ if (!SYMBOLP (var))
+ continue;
+
+ if (up_to_date)
+ {
+ Lisp_Object val = find_symbol_value (var);
+ Fput (var, Qlast_arrow_position,
+ COERCE_MARKER (val));
+ Fput (var, Qlast_arrow_string,
+ overlay_arrow_string_or_property (var, 0));
+ }
+ else if (up_to_date < 0
+ || !NILP (Fget (var, Qlast_arrow_position)))
+ {
+ Fput (var, Qlast_arrow_position, Qt);
+ Fput (var, Qlast_arrow_string, Qt);
+ }
+ }
+}
+
+
+/* Return overlay arrow string at row, or nil. */
+
+static Lisp_Object
+overlay_arrow_at_row (f, row, pbitmap)
+ struct frame *f;
+ struct glyph_row *row;
+ int *pbitmap;
+{
+ Lisp_Object vlist;
+
+ for (vlist = Voverlay_arrow_variable_list;
+ CONSP (vlist);
+ vlist = XCDR (vlist))
+ {
+ Lisp_Object var = XCAR (vlist);
+ Lisp_Object val;
+
+ if (!SYMBOLP (var))
+ continue;
+
+ val = find_symbol_value (var);
+
+ if (MARKERP (val)
+ && current_buffer == XMARKER (val)->buffer
+ && (MATRIX_ROW_START_CHARPOS (row) == marker_position (val)))
+ {
+ val = overlay_arrow_string_or_property (var, pbitmap);
+ if (FRAME_WINDOW_P (f))
+ return Qt;
+ else if (STRINGP (val))
+ return val;
+ break;
+ }
+ }
+
+ *pbitmap = 0;
+ return Qnil;
+}
+
+/* Return 1 if point moved out of or into a composition. Otherwise
+ return 0. PREV_BUF and PREV_PT are the last point buffer and
+ position. BUF and PT are the current point buffer and position. */
+
+int
+check_point_in_composition (prev_buf, prev_pt, buf, pt)
+ struct buffer *prev_buf, *buf;
+ int prev_pt, pt;
+{
+ int start, end;
+ Lisp_Object prop;
+ Lisp_Object buffer;
+
+ XSETBUFFER (buffer, buf);
+ /* Check a composition at the last point if point moved within the
+ same buffer. */
+ if (prev_buf == buf)
+ {
+ if (prev_pt == pt)
+ /* Point didn't move. */
+ return 0;
+
+ if (prev_pt > BUF_BEGV (buf) && prev_pt < BUF_ZV (buf)
+ && find_composition (prev_pt, -1, &start, &end, &prop, buffer)
+ && COMPOSITION_VALID_P (start, end, prop)
+ && start < prev_pt && end > prev_pt)
+ /* The last point was within the composition. Return 1 iff
+ point moved out of the composition. */
+ return (pt <= start || pt >= end);
+ }
+
+ /* Check a composition at the current point. */
+ return (pt > BUF_BEGV (buf) && pt < BUF_ZV (buf)
&& find_composition (pt, -1, &start, &end, &prop, buffer)
&& COMPOSITION_VALID_P (start, end, prop)
&& start < pt && end > pt);
}
}
\f
+
+/* Select FRAME to forward the values of frame-local variables into C
+ variables so that the redisplay routines can access those values
+ directly. */
+
+static void
+select_frame_for_redisplay (frame)
+ Lisp_Object frame;
+{
+ Lisp_Object tail, sym, val;
+ Lisp_Object old = selected_frame;
+
+ selected_frame = frame;
+
+ for (tail = XFRAME (frame)->param_alist; CONSP (tail); tail = XCDR (tail))
+ if (CONSP (XCAR (tail))
+ && (sym = XCAR (XCAR (tail)),
+ SYMBOLP (sym))
+ && (sym = indirect_variable (sym),
+ val = SYMBOL_VALUE (sym),
+ (BUFFER_LOCAL_VALUEP (val)
+ || SOME_BUFFER_LOCAL_VALUEP (val)))
+ && XBUFFER_LOCAL_VALUE (val)->check_frame)
+ Fsymbol_value (sym);
+
+ for (tail = XFRAME (old)->param_alist; CONSP (tail); tail = XCDR (tail))
+ if (CONSP (XCAR (tail))
+ && (sym = XCAR (XCAR (tail)),
+ SYMBOLP (sym))
+ && (sym = indirect_variable (sym),
+ val = SYMBOL_VALUE (sym),
+ (BUFFER_LOCAL_VALUEP (val)
+ || SOME_BUFFER_LOCAL_VALUEP (val)))
+ && XBUFFER_LOCAL_VALUE (val)->check_frame)
+ Fsymbol_value (sym);
+}
+
+
#define STOP_POLLING \
do { if (! polling_stopped_here) stop_polling (); \
polling_stopped_here = 1; } while (0)
/* Record a function that resets redisplaying_p to its old value
when we leave this function. */
count = SPECPDL_INDEX ();
- record_unwind_protect (unwind_redisplay, make_number (redisplaying_p));
+ record_unwind_protect (unwind_redisplay,
+ Fcons (make_number (redisplaying_p), selected_frame));
++redisplaying_p;
specbind (Qinhibit_free_realized_faces, Qnil);
/* If specs for an arrow have changed, do thorough redisplay
to ensure we remove any arrow that should no longer exist. */
- if (! EQ (COERCE_MARKER (Voverlay_arrow_position), last_arrow_position)
- || ! EQ (Voverlay_arrow_string, last_arrow_string))
+ if (overlay_arrows_changed_p ())
consider_all_windows_p = windows_or_buffers_changed = 1;
/* Normally the message* functions will have already displayed and
#if GLYPH_DEBUG
*w->desired_matrix->method = 0;
debug_method_add (w, "optimization 1");
+#endif
+#ifdef HAVE_WINDOW_SYSTEM
+ update_window_fringes (w, 0);
#endif
goto update;
}
/* Make sure the cursor was last displayed
in this window. Otherwise we have to reposition it. */
&& 0 <= w->cursor.vpos
- && XINT (w->height) > w->cursor.vpos)
+ && WINDOW_TOTAL_LINES (w) > w->cursor.vpos)
{
if (!must_finish)
{
if (FRAME_WINDOW_P (f) || f == sf)
{
+ if (! EQ (frame, selected_frame))
+ /* Select the frame, for the sake of frame-local
+ variables. */
+ select_frame_for_redisplay (frame);
+
#ifdef HAVE_WINDOW_SYSTEM
if (clear_face_cache_count % 50 == 0
&& FRAME_WINDOW_P (f))
/* Update the display. */
set_window_update_flags (XWINDOW (f->root_window), 1);
pause |= update_frame (f, 0, 0);
+#if 0 /* Exiting the loop can leave the wrong value for buffer_shared. */
if (pause)
break;
+#endif
if (n == size)
{
}
}
- /* Do the mark_window_display_accurate after all windows have
- been redisplayed because this call resets flags in buffers
- which are needed for proper redisplay. */
- for (i = 0; i < n; ++i)
+ if (!pause)
{
- struct frame *f = updated[i];
- mark_window_display_accurate (f->root_window, 1);
- if (frame_up_to_date_hook)
- frame_up_to_date_hook (f);
+ /* Do the mark_window_display_accurate after all windows have
+ been redisplayed because this call resets flags in buffers
+ which are needed for proper redisplay. */
+ for (i = 0; i < n; ++i)
+ {
+ struct frame *f = updated[i];
+ mark_window_display_accurate (f->root_window, 1);
+ if (frame_up_to_date_hook)
+ frame_up_to_date_hook (f);
+ }
}
}
else if (FRAME_VISIBLE_P (sf) && !FRAME_OBSCURED_P (sf))
CHARPOS (this_line_start_pos) = 0;
/* Let the overlay arrow be updated the next time. */
- if (!NILP (last_arrow_position))
- {
- last_arrow_position = Qt;
- last_arrow_string = Qt;
- }
+ update_overlay_arrows (0);
/* If we pause after scrolling, some rows in the current
matrices of some windows are not valid. */
consider_all_windows_p is set. */
mark_window_display_accurate_1 (w, 1);
- last_arrow_position = COERCE_MARKER (Voverlay_arrow_position);
- last_arrow_string = Voverlay_arrow_string;
+ /* Say overlay arrows are up to date. */
+ update_overlay_arrows (1);
if (frame_up_to_date_hook != 0)
frame_up_to_date_hook (sf);
/* Function registered with record_unwind_protect in
redisplay_internal. Reset redisplaying_p to the value it had
before redisplay_internal was called, and clear
- prevent_freeing_realized_faces_p. */
+ prevent_freeing_realized_faces_p. It also selects the previously
+ selected frame. */
static Lisp_Object
-unwind_redisplay (old_redisplaying_p)
- Lisp_Object old_redisplaying_p;
+unwind_redisplay (val)
+ Lisp_Object val;
{
+ Lisp_Object old_redisplaying_p, old_frame;
+
+ old_redisplaying_p = XCAR (val);
redisplaying_p = XFASTINT (old_redisplaying_p);
+ old_frame = XCDR (val);
+ if (! EQ (old_frame, selected_frame))
+ select_frame_for_redisplay (old_frame);
return Qnil;
}
w->window_end_valid = w->buffer;
#if 0 /* This is incorrect with variable-height lines. */
xassert (XINT (w->window_end_vpos)
- < (XINT (w->height)
+ < (WINDOW_TOTAL_LINES (w)
- (WINDOW_WANTS_MODELINE_P (w) ? 1 : 0)));
#endif
w->update_mode_line = Qnil;
if (accurate_p)
{
- last_arrow_position = COERCE_MARKER (Voverlay_arrow_position);
- last_arrow_string = Voverlay_arrow_string;
+ update_overlay_arrows (1);
}
else
{
/* Force a thorough redisplay the next time by setting
last_arrow_position and last_arrow_string to t, which is
unequal to any useful value of Voverlay_arrow_... */
- last_arrow_position = Qt;
- last_arrow_string = Qt;
+ update_overlay_arrows (-1);
}
}
A value of 1 means there is nothing to be done.
(Either the line is fully visible, or it cannot be made so,
or we cannot tell.)
+
+ If FORCE_P is non-zero, return 0 even if partial visible cursor row
+ is higher than window.
+
A value of 0 means the caller should do scrolling
as if point had gone off the screen. */
static int
-make_cursor_line_fully_visible (w)
+make_cursor_line_fully_visible (w, force_p)
struct window *w;
+ int force_p;
{
struct glyph_matrix *matrix;
struct glyph_row *row;
if (!MATRIX_ROW_PARTIALLY_VISIBLE_P (row))
return 1;
+ if (force_p)
+ return 0;
+
/* If the row the cursor is in is taller than the window's height,
it's not clear what to do, so do nothing. */
window_height = window_box_height (w);
int amount_to_scroll = 0;
Lisp_Object aggressive;
int height;
- int end_scroll_margin;
+ int extra_scroll_margin_lines = last_line_misfit ? 1 : 0;
#if GLYPH_DEBUG
debug_method_add (w, "try_scrolling");
within this distance from the top or bottom of the window. */
if (scroll_margin > 0)
{
- this_scroll_margin = min (scroll_margin, XINT (w->height) / 4);
- this_scroll_margin *= CANON_Y_UNIT (f);
+ this_scroll_margin = min (scroll_margin, WINDOW_TOTAL_LINES (w) / 4);
+ this_scroll_margin *= FRAME_LINE_HEIGHT (f);
}
else
this_scroll_margin = 0;
+ /* Force scroll_conservatively to have a reasonable value so it doesn't
+ cause an overflow while computing how much to scroll. */
+ if (scroll_conservatively)
+ scroll_conservatively = min (scroll_conservatively,
+ MOST_POSITIVE_FIXNUM / FRAME_LINE_HEIGHT (f));
+
/* Compute how much we should try to scroll maximally to bring point
into view. */
if (scroll_step || scroll_conservatively || temp_scroll_step)
scroll_max = 10;
else
scroll_max = 0;
- scroll_max *= CANON_Y_UNIT (f);
+ scroll_max *= FRAME_LINE_HEIGHT (f);
/* Decide whether we have to scroll down. Start at the window end
and move this_scroll_margin up to find the position of the scroll
CHARPOS (scroll_margin_pos) = XINT (window_end);
BYTEPOS (scroll_margin_pos) = CHAR_TO_BYTE (CHARPOS (scroll_margin_pos));
- end_scroll_margin = this_scroll_margin + !!last_line_misfit;
- if (end_scroll_margin)
+ if (this_scroll_margin || extra_scroll_margin_lines)
{
start_display (&it, w, scroll_margin_pos);
- move_it_vertically (&it, - end_scroll_margin);
+ if (this_scroll_margin)
+ move_it_vertically (&it, - this_scroll_margin);
+ if (extra_scroll_margin_lines)
+ move_it_by_lines (&it, - extra_scroll_margin_lines, 0);
scroll_margin_pos = it.current.pos;
}
/* Set AMOUNT_TO_SCROLL to at least one line,
and at most scroll_conservatively lines. */
amount_to_scroll
- = min (max (dy, CANON_Y_UNIT (f)),
- CANON_Y_UNIT (f) * scroll_conservatively);
+ = min (max (dy, FRAME_LINE_HEIGHT (f)),
+ FRAME_LINE_HEIGHT (f) * scroll_conservatively);
else if (scroll_step || temp_scroll_step)
amount_to_scroll = scroll_max;
else
{
aggressive = current_buffer->scroll_up_aggressively;
- height = (WINDOW_DISPLAY_HEIGHT_NO_MODE_LINE (w)
- - WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w));
+ height = WINDOW_BOX_TEXT_HEIGHT (w);
if (NUMBERP (aggressive))
amount_to_scroll = XFLOATINT (aggressive) * height;
}
if (scroll_conservatively)
amount_to_scroll =
- max (dy, CANON_Y_UNIT (f) * max (scroll_step, temp_scroll_step));
+ max (dy, FRAME_LINE_HEIGHT (f) * max (scroll_step, temp_scroll_step));
else if (scroll_step || temp_scroll_step)
amount_to_scroll = scroll_max;
else
{
aggressive = current_buffer->scroll_down_aggressively;
- height = (WINDOW_DISPLAY_HEIGHT_NO_MODE_LINE (w)
- - WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w));
+ height = WINDOW_BOX_TEXT_HEIGHT (w);
if (NUMBERP (aggressive))
amount_to_scroll = XFLOATINT (aggressive) * height;
}
/* If cursor ends up on a partially visible line,
treat that as being off the bottom of the screen. */
- if (! make_cursor_line_fully_visible (w))
+ if (! make_cursor_line_fully_visible (w, extra_scroll_margin_lines <= 1))
{
clear_glyph_matrix (w->desired_matrix);
- last_line_misfit = 1;
+ ++extra_scroll_margin_lines;
goto too_near_end;
}
rc = SCROLLING_SUCCESS;
/* If the line start is "too far" away from the window start,
say it takes too much time to compute a new window start. */
if (CHARPOS (start_pos) - IT_CHARPOS (it)
- < XFASTINT (w->height) * XFASTINT (w->width))
+ < WINDOW_TOTAL_LINES (w) * WINDOW_TOTAL_COLS (w))
{
int min_distance, distance;
&& INTEGERP (w->window_end_vpos)
&& XFASTINT (w->window_end_vpos) < w->current_matrix->nrows
&& (FRAME_WINDOW_P (f)
- || !MARKERP (Voverlay_arrow_position)
- || current_buffer != XMARKER (Voverlay_arrow_position)->buffer))
+ || !overlay_arrow_in_current_buffer_p ()))
{
int this_scroll_margin;
struct glyph_row *row = NULL;
/* Scroll if point within this distance from the top or bottom
of the window. This is a pixel value. */
this_scroll_margin = max (0, scroll_margin);
- this_scroll_margin = min (this_scroll_margin, XFASTINT (w->height) / 4);
- this_scroll_margin *= CANON_Y_UNIT (f);
+ this_scroll_margin = min (this_scroll_margin, WINDOW_TOTAL_LINES (w) / 4);
+ this_scroll_margin *= FRAME_LINE_HEIGHT (f);
/* Start with the row the cursor was displayed during the last
not paused redisplay. Give up if that row is not valid. */
else
{
set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0);
- if (!make_cursor_line_fully_visible (w))
+ if (!make_cursor_line_fully_visible (w, 0))
rc = CURSOR_MOVEMENT_MUST_SCROLL;
else
rc = CURSOR_MOVEMENT_SUCCESS;
return rc;
}
+void
+set_vertical_scroll_bar (w)
+ struct window *w;
+{
+ int start, end, whole;
+
+ /* Calculate the start and end positions for the current window.
+ At some point, it would be nice to choose between scrollbars
+ which reflect the whole buffer size, with special markers
+ indicating narrowing, and scrollbars which reflect only the
+ visible region.
+
+ Note that mini-buffers sometimes aren't displaying any text. */
+ if (!MINI_WINDOW_P (w)
+ || (w == XWINDOW (minibuf_window)
+ && NILP (echo_area_buffer[0])))
+ {
+ struct buffer *buf = XBUFFER (w->buffer);
+ whole = BUF_ZV (buf) - BUF_BEGV (buf);
+ start = marker_position (w->start) - BUF_BEGV (buf);
+ /* I don't think this is guaranteed to be right. For the
+ moment, we'll pretend it is. */
+ end = BUF_Z (buf) - XFASTINT (w->window_end_pos) - BUF_BEGV (buf);
+
+ if (end < start)
+ end = start;
+ if (whole < (end - start))
+ whole = end - start;
+ }
+ else
+ start = end = whole = 0;
+
+ /* Indicate what this scroll bar ought to be displaying now. */
+ set_vertical_scroll_bar_hook (w, end - start, whole, start);
+}
+
/* Redisplay leaf window WINDOW. JUST_THIS_ONE_P non-zero means only
selected_window is redisplayed.
struct it it;
/* Record it now because it's overwritten. */
int current_matrix_up_to_date_p = 0;
+ int used_current_matrix_p = 0;
/* This is less strict than current_matrix_up_to_date_p.
It indictes that the buffer contents and narrowing are unchanged. */
int buffer_unchanged_p = 0;
}
else if ((w != XWINDOW (minibuf_window)
|| minibuf_level == 0)
+ /* When buffer is nonempty, redisplay window normally. */
+ && BUF_Z (XBUFFER (w->buffer)) == BUF_BEG (XBUFFER (w->buffer))
/* Quail displays non-mini buffers in minibuffer window.
In that case, redisplay the window normally. */
&& !NILP (Fmemq (w->buffer, Vminibuffer_list)))
MOVE_TO_POS | MOVE_TO_X | MOVE_TO_Y);
if (IT_CHARPOS (it) == PT)
w->force_start = Qt;
+ /* IT may overshoot PT if text at PT is invisible. */
+ else if (IT_CHARPOS (it) > PT && CHARPOS (startp) <= PT)
+ w->force_start = Qt;
+
+
}
/* Handle case where place to start displaying has been specified,
new_vpos = window_box_height (w) / 2;
}
- if (!make_cursor_line_fully_visible (w))
+ if (!make_cursor_line_fully_visible (w, 0))
{
/* Point does appear, but on a line partly visible at end of window.
Move it back to a fully-visible line. */
switch (rc)
{
case CURSOR_MOVEMENT_SUCCESS:
+ used_current_matrix_p = 1;
goto done;
#if 0 /* try_cursor_movement never returns this value. */
buffer. */
|| !NILP (Vwindow_scroll_functions)
|| MINI_WINDOW_P (w)
- || !try_window_reusing_current_matrix (w))
+ || !(used_current_matrix_p =
+ try_window_reusing_current_matrix (w)))
{
IF_DEBUG (debug_method_add (w, "1"));
try_window (window, startp);
/* Forget any recorded base line for line number display. */
w->base_line_number = Qnil;
- if (!make_cursor_line_fully_visible (w))
+ if (!make_cursor_line_fully_visible (w, 1))
{
clear_glyph_matrix (w->desired_matrix);
last_line_misfit = 1;
|| !NILP (Vwindow_scroll_functions)
|| !just_this_one_p
|| MINI_WINDOW_P (w)
- || !try_window_reusing_current_matrix (w))
+ || !(used_current_matrix_p =
+ try_window_reusing_current_matrix (w)))
try_window (window, startp);
/* If new fonts have been loaded (due to fontsets), give up. We
set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0);
}
- if (!make_cursor_line_fully_visible (w))
+ if (!make_cursor_line_fully_visible (w, centering_position > 0))
{
/* If vscroll is enabled, disable it and try again. */
if (w->vscroll)
/* If centering point failed to make the whole line visible,
put point at the top instead. That has to make the whole line
visible, if it can be done. */
+ clear_glyph_matrix (w->desired_matrix);
centering_position = 0;
goto point_at_top;
}
#endif
}
+#ifdef HAVE_WINDOW_SYSTEM
+ if (update_window_fringes (w, 0)
+ && !just_this_one_p
+ && (used_current_matrix_p || overlay_arrow_seen)
+ && !w->pseudo_window_p)
+ {
+ update_begin (f);
+ BLOCK_INPUT;
+ draw_window_fringes (w);
+ UNBLOCK_INPUT;
+ update_end (f);
+ }
+#endif /* HAVE_WINDOW_SYSTEM */
+
/* We go to this label, with fonts_changed_p nonzero,
if it is necessary to try again using larger glyph matrices.
We have to redeem the scroll bar even in this case,
;
finish_scroll_bars:
- if (FRAME_HAS_VERTICAL_SCROLL_BARS (f))
+ if (WINDOW_HAS_VERTICAL_SCROLL_BAR (w))
{
- int start, end, whole;
-
- /* Calculate the start and end positions for the current window.
- At some point, it would be nice to choose between scrollbars
- which reflect the whole buffer size, with special markers
- indicating narrowing, and scrollbars which reflect only the
- visible region.
-
- Note that mini-buffers sometimes aren't displaying any text. */
- if (!MINI_WINDOW_P (w)
- || (w == XWINDOW (minibuf_window)
- && NILP (echo_area_buffer[0])))
- {
- whole = ZV - BEGV;
- start = marker_position (w->start) - BEGV;
- /* I don't think this is guaranteed to be right. For the
- moment, we'll pretend it is. */
- end = (Z - XFASTINT (w->window_end_pos)) - BEGV;
-
- if (end < start)
- end = start;
- if (whole < (end - start))
- whole = end - start;
- }
- else
- start = end = whole = 0;
-
- /* Indicate what this scroll bar ought to be displaying now. */
- set_vertical_scroll_bar_hook (w, end - start, whole, start);
+ /* Set the thumb's position and size. */
+ set_vertical_scroll_bar (w);
/* Note that we actually used the scroll bar attached to this
window, so it shouldn't be deleted at the end of redisplay. */
}
else
{
- w->window_end_bytepos = 0;
- w->window_end_pos = w->window_end_vpos = make_number (0);
+ w->window_end_bytepos = Z_BYTE - ZV_BYTE;
+ w->window_end_pos = make_number (Z - ZV);
+ w->window_end_vpos = make_number (0);
}
/* But that is not valid info until redisplay finishes. */
(start_row + i)->enabled_p = 0;
/* Re-compute Y positions. */
- min_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w);
+ min_y = WINDOW_HEADER_LINE_HEIGHT (w);
max_y = it.last_visible_y;
for (row = start_row + nrows_scrolled;
row < bottom_row;
row->visible_height -= min_y - row->y;
if (row->y + row->height > max_y)
row->visible_height -= row->y + row->height - max_y;
+ row->redraw_fringe_bitmaps_p = 1;
it.current_y += row->height;
else
{
/* This window must be completely empty. */
- w->window_end_bytepos = 0;
- w->window_end_pos = w->window_end_vpos = make_number (0);
+ w->window_end_bytepos = Z_BYTE - ZV_BYTE;
+ w->window_end_pos = make_number (Z - ZV);
+ w->window_end_vpos = make_number (0);
}
w->window_end_valid = Qnil;
it.vpos = (MATRIX_ROW_VPOS (first_row_to_display, w->current_matrix)
- nrows_scrolled);
it.current_y = (first_row_to_display->y - first_reusable_row->y
- + WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w));
+ + WINDOW_HEADER_LINE_HEIGHT (w));
/* Display lines beginning with first_row_to_display in the
desired matrix. Set last_text_row to the last row displayed
/* Scroll the display. */
run.current_y = first_reusable_row->y;
- run.desired_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w);
+ run.desired_y = WINDOW_HEADER_LINE_HEIGHT (w);
run.height = it.last_visible_y - run.current_y;
dy = run.current_y - run.desired_y;
if (run.height)
{
- struct frame *f = XFRAME (WINDOW_FRAME (w));
update_begin (f);
rif->update_window_begin_hook (w);
rif->clear_window_mouse_face (w);
/* Adjust Y positions of reused rows. */
bottom_row = MATRIX_BOTTOM_TEXT_ROW (w->current_matrix, w);
- min_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w);
+ min_y = WINDOW_HEADER_LINE_HEIGHT (w);
max_y = it.last_visible_y;
for (row = first_reusable_row; row < first_row_to_display; ++row)
{
row->visible_height -= min_y - row->y;
if (row->y + row->height > max_y)
row->visible_height -= row->y + row->height - max_y;
+ row->redraw_fringe_bitmaps_p = 1;
}
/* Scroll the current matrix. */
row is not unchanged because it may be no longer
continued. */
&& !(MATRIX_ROW_END_CHARPOS (row) == first_changed_pos
- && row->continued_p))
+ && (row->continued_p
+ || row->exact_window_width_line_p)))
row_found = row;
/* Stop if last visible row. */
marginal areas (see build_frame_matrix). */
window_row = w->current_matrix->rows;
window_row_end = window_row + w->current_matrix->nrows;
- frame_row = f->current_matrix->rows + XFASTINT (w->top);
+ frame_row = f->current_matrix->rows + WINDOW_TOP_EDGE_LINE (w);
while (window_row < window_row_end)
{
struct glyph *start = window_row->glyphs[LEFT_MARGIN_AREA];
GIVE_UP (10);
/* Can use this if overlay arrow position and or string have changed. */
- if (!EQ (last_arrow_position, COERCE_MARKER (Voverlay_arrow_position))
- || !EQ (last_arrow_string, Voverlay_arrow_string))
+ if (overlay_arrows_changed_p ())
GIVE_UP (12);
the window end again, since its offset from Z hasn't changed. */
r0 = MATRIX_FIRST_TEXT_ROW (current_matrix);
if (CHARPOS (start) == MATRIX_ROW_START_CHARPOS (r0) + delta
- && BYTEPOS (start) == MATRIX_ROW_START_BYTEPOS (r0) + delta_bytes)
+ && BYTEPOS (start) == MATRIX_ROW_START_BYTEPOS (r0) + delta_bytes
+ /* PT must not be in a partially visible line. */
+ && !(PT >= MATRIX_ROW_START_CHARPOS (row) + delta
+ && MATRIX_ROW_BOTTOM_Y (row) > window_text_bottom_y (w)))
{
/* Adjust positions in the glyph matrix. */
if (delta || delta_bytes)
as is, without changing glyph positions since no text has
been added/removed in front of the window end. */
r0 = MATRIX_FIRST_TEXT_ROW (current_matrix);
- if (TEXT_POS_EQUAL_P (start, r0->start.pos))
+ if (TEXT_POS_EQUAL_P (start, r0->start.pos)
+ /* PT must not be in a partially visible line. */
+ && !(PT >= MATRIX_ROW_START_CHARPOS (row)
+ && MATRIX_ROW_BOTTOM_Y (row) > window_text_bottom_y (w)))
{
/* We have to compute the window end anew since text
can have been added/removed after it. */
else
{
/* There are no reusable lines at the start of the window.
- Start displaying in the first line. */
+ Start displaying in the first text line. */
start_display (&it, w, start);
+ it.vpos = it.first_vpos;
start_pos = it.current.pos;
}
int this_scroll_margin, cursor_height;
this_scroll_margin = max (0, scroll_margin);
- this_scroll_margin = min (this_scroll_margin,
- XFASTINT (w->height) / 4);
- this_scroll_margin *= CANON_Y_UNIT (it.f);
+ this_scroll_margin = min (this_scroll_margin, WINDOW_TOTAL_LINES (w) / 4);
+ this_scroll_margin *= FRAME_LINE_HEIGHT (it.f);
cursor_height = MATRIX_ROW (w->desired_matrix, w->cursor.vpos)->height;
if ((w->cursor.y < this_scroll_margin
lines to scroll by; dvpos < 0 means scroll up. */
int first_unchanged_at_end_vpos
= MATRIX_ROW_VPOS (first_unchanged_at_end_row, w->current_matrix);
- int from = XFASTINT (w->top) + first_unchanged_at_end_vpos;
- int end = (XFASTINT (w->top)
+ int from = WINDOW_TOP_EDGE_LINE (w) + first_unchanged_at_end_vpos;
+ int end = (WINDOW_TOP_EDGE_LINE (w)
+ (WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0)
+ window_internal_height (w));
arrow. Only used for non-window-redisplay windows. */
static struct glyph_row *
-get_overlay_arrow_glyph_row (w)
+get_overlay_arrow_glyph_row (w, overlay_arrow_string)
struct window *w;
+ Lisp_Object overlay_arrow_string;
{
struct frame *f = XFRAME (WINDOW_FRAME (w));
struct buffer *buffer = XBUFFER (w->buffer);
struct buffer *old = current_buffer;
- const unsigned char *arrow_string = SDATA (Voverlay_arrow_string);
- int arrow_len = SCHARS (Voverlay_arrow_string);
+ const unsigned char *arrow_string = SDATA (overlay_arrow_string);
+ int arrow_len = SCHARS (overlay_arrow_string);
const unsigned char *arrow_end = arrow_string + arrow_len;
const unsigned char *p;
struct it it;
/* Get its face. */
ilisp = make_number (p - arrow_string);
- face = Fget_text_property (ilisp, Qface, Voverlay_arrow_string);
+ face = Fget_text_property (ilisp, Qface, overlay_arrow_string);
it.face_id = compute_char_face (f, it.c, face);
/* Compute its width, get its glyphs. */
if (row->height == 0)
{
if (it->max_ascent + it->max_descent == 0)
- it->max_descent = it->max_phys_descent = CANON_Y_UNIT (it->f);
+ it->max_descent = it->max_phys_descent = FRAME_LINE_HEIGHT (it->f);
row->ascent = it->max_ascent;
row->height = it->max_ascent + it->max_descent;
row->phys_ascent = it->max_phys_ascent;
/* Compute how much of the line is visible. */
row->visible_height = row->height;
- min_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (it->w);
- max_y = WINDOW_DISPLAY_HEIGHT_NO_MODE_LINE (it->w);
+ min_y = WINDOW_HEADER_LINE_HEIGHT (it->w);
+ max_y = WINDOW_BOX_HEIGHT_NO_MODE_LINE (it->w);
if (row->y < min_y)
row->visible_height -= min_y - row->y;
struct it *it;
{
struct glyph_row *row = it->glyph_row;
+ int overlay_arrow_bitmap;
+ Lisp_Object overlay_arrow_string;
/* We always start displaying at hpos zero even if hscrolled. */
xassert (it->hpos == 0 && it->current_x == 0);
prepare_desired_row (row);
row->y = it->current_y;
- row->start = it->current;
+ row->start = it->start;
row->continuation_lines_width = it->continuation_lines_width;
row->displays_text_p = 1;
row->starts_in_middle_of_char_p = it->starts_in_middle_of_char_p;
display the cursor there under X. Set the charpos of the
first glyph of blank lines not corresponding to any text
to -1. */
+#ifdef HAVE_WINDOW_SYSTEM
+ if (IT_OVERFLOW_NEWLINE_INTO_FRINGE (it))
+ row->exact_window_width_line_p = 1;
+ else
+#endif /* HAVE_WINDOW_SYSTEM */
if ((append_space (it, 1) && row->used[TEXT_AREA] == 1)
|| row->used[TEXT_AREA] == 0)
{
it->continuation_lines_width += new_x;
++it->hpos;
if (i == nglyphs - 1)
- set_iterator_to_next (it, 1);
+ {
+ set_iterator_to_next (it, 1);
+#ifdef HAVE_WINDOW_SYSTEM
+ if (IT_OVERFLOW_NEWLINE_INTO_FRINGE (it))
+ {
+ if (!get_next_display_element (it))
+ {
+ row->exact_window_width_line_p = 1;
+ it->continuation_lines_width = 0;
+ row->continued_p = 0;
+ row->ends_at_zv_p = 1;
+ }
+ else if (ITERATOR_AT_END_OF_LINE_P (it))
+ {
+ row->continued_p = 0;
+ row->exact_window_width_line_p = 1;
+ }
+ }
+#endif /* HAVE_WINDOW_SYSTEM */
+ }
}
else if (CHAR_GLYPH_PADDING_P (*glyph)
&& !FRAME_WINDOW_P (it->f))
it->max_phys_ascent + it->max_phys_descent);
/* End of this display line if row is continued. */
- if (row->continued_p)
+ if (row->continued_p || row->ends_at_zv_p)
break;
}
+ at_end_of_line:
/* Is this a line end? If yes, we're also done, after making
sure that a non-default face is extended up to the right
margin of the window. */
row->ends_in_newline_from_string_p = STRINGP (it->object);
+#ifdef HAVE_WINDOW_SYSTEM
/* Add a space at the end of the line that is used to
display the cursor there. */
- append_space (it, 0);
+ if (!IT_OVERFLOW_NEWLINE_INTO_FRINGE (it))
+ append_space (it, 0);
+#endif /* HAVE_WINDOW_SYSTEM */
/* Extend the face to the end of the line. */
extend_face_to_end_of_line (it);
produce_special_glyphs (it, IT_TRUNCATION);
}
}
+#ifdef HAVE_WINDOW_SYSTEM
+ else
+ {
+ /* Don't truncate if we can overflow newline into fringe. */
+ if (IT_OVERFLOW_NEWLINE_INTO_FRINGE (it))
+ {
+ if (!get_next_display_element (it))
+ {
+#ifdef HAVE_WINDOW_SYSTEM
+ it->continuation_lines_width = 0;
+ row->ends_at_zv_p = 1;
+ row->exact_window_width_line_p = 1;
+ break;
+#endif /* HAVE_WINDOW_SYSTEM */
+ }
+ if (ITERATOR_AT_END_OF_LINE_P (it))
+ {
+ row->exact_window_width_line_p = 1;
+ goto at_end_of_line;
+ }
+ }
+ }
+#endif /* HAVE_WINDOW_SYSTEM */
row->truncated_on_right_p = 1;
it->continuation_lines_width = 0;
mark this glyph row as the one containing the overlay arrow.
This is clearly a mess with variable size fonts. It would be
better to let it be displayed like cursors under X. */
- if (MARKERP (Voverlay_arrow_position)
- && current_buffer == XMARKER (Voverlay_arrow_position)->buffer
- && (MATRIX_ROW_START_CHARPOS (row)
- == marker_position (Voverlay_arrow_position))
- && STRINGP (Voverlay_arrow_string)
- && ! overlay_arrow_seen)
+ if (! overlay_arrow_seen
+ && (overlay_arrow_string
+ = overlay_arrow_at_row (it->f, row, &overlay_arrow_bitmap),
+ !NILP (overlay_arrow_string)))
{
/* Overlay arrow in window redisplay is a fringe bitmap. */
if (!FRAME_WINDOW_P (it->f))
{
- struct glyph_row *arrow_row = get_overlay_arrow_glyph_row (it->w);
+ struct glyph_row *arrow_row
+ = get_overlay_arrow_glyph_row (it->w, overlay_arrow_string);
struct glyph *glyph = arrow_row->glyphs[TEXT_AREA];
struct glyph *arrow_end = glyph + arrow_row->used[TEXT_AREA];
struct glyph *p = row->glyphs[TEXT_AREA];
}
overlay_arrow_seen = 1;
+ it->w->overlay_arrow_bitmap = overlay_arrow_bitmap;
row->overlay_arrow_p = 1;
}
/* Remember the position at which this line ends. */
row->end = it->current;
+ /* Save fringe bitmaps in this row. */
+ row->left_user_fringe_bitmap = it->left_user_fringe_bitmap;
+ row->left_user_fringe_face_id = it->left_user_fringe_face_id;
+ row->right_user_fringe_bitmap = it->right_user_fringe_bitmap;
+ row->right_user_fringe_face_id = it->right_user_fringe_face_id;
+
+ it->left_user_fringe_bitmap = 0;
+ it->left_user_fringe_face_id = 0;
+ it->right_user_fringe_bitmap = 0;
+ it->right_user_fringe_face_id = 0;
+
/* Maybe set the cursor. */
if (it->w->cursor.vpos < 0
&& PT >= MATRIX_ROW_START_CHARPOS (row)
it->current_y += row->height;
++it->vpos;
++it->glyph_row;
+ it->start = it->current;
return row->displays_text_p;
}
xassert (!FRAME_WINDOW_P (f));
init_iterator (&it, w, -1, -1, f->desired_matrix->rows, MENU_FACE_ID);
it.first_visible_x = 0;
- it.last_visible_x = FRAME_WINDOW_WIDTH (f) * CANON_X_UNIT (f);
+ it.last_visible_x = FRAME_TOTAL_COLS (f) * FRAME_COLUMN_WIDTH (f);
#else /* not USE_X_TOOLKIT */
if (FRAME_WINDOW_P (f))
{
init_iterator (&it, menu_w, -1, -1, menu_w->desired_matrix->rows,
MENU_FACE_ID);
it.first_visible_x = 0;
- it.last_visible_x = FRAME_WINDOW_WIDTH (f) * CANON_X_UNIT (f);
+ it.last_visible_x = FRAME_TOTAL_COLS (f) * FRAME_COLUMN_WIDTH (f);
}
else
{
init_iterator (&it, w, -1, -1, f->desired_matrix->rows,
MENU_FACE_ID);
it.first_visible_x = 0;
- it.last_visible_x = FRAME_WIDTH (f);
+ it.last_visible_x = FRAME_COLS (f);
}
#endif /* not USE_X_TOOLKIT */
init_iterator (&it, w, -1, -1, NULL, face_id);
prepare_desired_row (it.glyph_row);
+ it.glyph_row->mode_line_p = 1;
+
if (! mode_line_inverse_video)
/* Force the mode-line to be displayed in the default face. */
it.base_face_id = it.face_id = DEFAULT_FACE_ID;
compute_line_metrics (&it);
it.glyph_row->full_width_p = 1;
- it.glyph_row->mode_line_p = 1;
it.glyph_row->continued_p = 0;
it.glyph_row->truncated_on_left_p = 0;
it.glyph_row->truncated_on_right_p = 0;
int literal = 0;
tail_recurse:
- if (depth > 10)
- goto invalid;
+ if (depth > 100)
+ elt = build_string ("*too-deep*");
depth++;
default:
invalid:
- if (frame_title_ptr)
- n += store_frame_title ("*invalid*", 0, precision - n);
- else if (!NILP (mode_line_string_list))
- n += store_mode_line_string ("*invalid*", Qnil, 0, 0, precision - n, Qnil);
- else
- n += display_string ("*invalid*", Qnil, Qnil, 0, 0, it, 0,
- precision - n, 0, 0);
- return n;
+ elt = build_string ("*invalid*");
+ goto tail_recurse;
}
/* Pad to FIELD_WIDTH. */
}
}
+/* Write a null-terminated, right justified decimal and "human
+ readable" representation of the nonnegative integer D to BUF using
+ a minimal field width WIDTH. D should be smaller than 999.5e24. */
+
+static const char power_letter[] =
+ {
+ 0, /* not used */
+ 'k', /* kilo */
+ 'M', /* mega */
+ 'G', /* giga */
+ 'T', /* tera */
+ 'P', /* peta */
+ 'E', /* exa */
+ 'Z', /* zetta */
+ 'Y' /* yotta */
+ };
+
+static void
+pint2hrstr (buf, width, d)
+ char *buf;
+ int width;
+ int d;
+{
+ /* We aim to represent the nonnegative integer D as
+ QUOTIENT.TENTHS * 10 ^ (3 * EXPONENT). */
+ int quotient = d;
+ int remainder = 0;
+ /* -1 means: do not use TENTHS. */
+ int tenths = -1;
+ int exponent = 0;
+
+ /* Length of QUOTIENT.TENTHS as a string. */
+ int length;
+
+ char * psuffix;
+ char * p;
+
+ if (1000 <= quotient)
+ {
+ /* Scale to the appropriate EXPONENT. */
+ do
+ {
+ remainder = quotient % 1000;
+ quotient /= 1000;
+ exponent++;
+ }
+ while (1000 <= quotient);
+
+ /* Round to nearest and decide whether to use TENTHS or not. */
+ if (quotient <= 9)
+ {
+ tenths = remainder / 100;
+ if (50 <= remainder % 100)
+ if (tenths < 9)
+ tenths++;
+ else
+ {
+ quotient++;
+ if (quotient == 10)
+ tenths = -1;
+ else
+ tenths = 0;
+ }
+ }
+ else
+ if (500 <= remainder)
+ if (quotient < 999)
+ quotient++;
+ else
+ {
+ quotient = 1;
+ exponent++;
+ tenths = 0;
+ }
+ }
+
+ /* Calculate the LENGTH of QUOTIENT.TENTHS as a string. */
+ if (tenths == -1 && quotient <= 99)
+ if (quotient <= 9)
+ length = 1;
+ else
+ length = 2;
+ else
+ length = 3;
+ p = psuffix = buf + max (width, length);
+
+ /* Print EXPONENT. */
+ if (exponent)
+ *psuffix++ = power_letter[exponent];
+ *psuffix = '\0';
+
+ /* Print TENTHS. */
+ if (tenths >= 0)
+ {
+ *--p = '0' + tenths;
+ *--p = '.';
+ }
+
+ /* Print QUOTIENT. */
+ do
+ {
+ int digit = quotient % 10;
+ *--p = '0' + digit;
+ }
+ while ((quotient /= 10) != 0);
+
+ /* Print leading spaces. */
+ while (buf < p)
+ *--p = ' ';
+}
+
/* Set a mnemonic character for coding_system (Lisp symbol) in BUF.
If EOL_FLAG is 1, set also a mnemonic character for end-of-line
type of CODING_SYSTEM. Return updated pointer into BUF. */
obj = b->filename;
break;
+ case 'i':
+ {
+ int size = ZV - BEGV;
+ pint2str (decode_mode_spec_buf, field_width, size);
+ return decode_mode_spec_buf;
+ }
+
+ case 'I':
+ {
+ int size = ZV - BEGV;
+ pint2hrstr (decode_mode_spec_buf, field_width, size);
+ return decode_mode_spec_buf;
+ }
+
case 'l':
{
int startpos = XMARKER (w->start)->charpos;
int startpos_byte = marker_byte_position (w->start);
int line, linepos, linepos_byte, topline;
int nlines, junk;
- int height = XFASTINT (w->height);
+ int height = WINDOW_TOTAL_LINES (w);
/* If we decided that this buffer isn't suitable for line numbers,
don't forget that too fast. */
return 0;
}
-\f
-/***********************************************************************
- Glyph Display
- ***********************************************************************/
+/* Calculate a width or height in pixels from a specification using
+ the following elements:
-#ifdef HAVE_WINDOW_SYSTEM
+ SPEC ::=
+ NUM - a (fractional) multiple of the default font width/height
+ (NUM) - specifies exactly NUM pixels
+ UNIT - a fixed number of pixels, see below.
+ ELEMENT - size of a display element in pixels, see below.
+ (NUM . SPEC) - equals NUM * SPEC
+ (+ SPEC SPEC ...) - add pixel values
+ (- SPEC SPEC ...) - subtract pixel values
+ (- SPEC) - negate pixel value
-#if GLYPH_DEBUG
+ NUM ::=
+ INT or FLOAT - a number constant
+ SYMBOL - use symbol's (buffer local) variable binding.
-void
-dump_glyph_string (s)
- struct glyph_string *s;
-{
- fprintf (stderr, "glyph string\n");
- fprintf (stderr, " x, y, w, h = %d, %d, %d, %d\n",
- s->x, s->y, s->width, s->height);
- fprintf (stderr, " ybase = %d\n", s->ybase);
- fprintf (stderr, " hl = %d\n", s->hl);
- fprintf (stderr, " left overhang = %d, right = %d\n",
- s->left_overhang, s->right_overhang);
- fprintf (stderr, " nchars = %d\n", s->nchars);
- fprintf (stderr, " extends to end of line = %d\n",
- s->extends_to_end_of_line_p);
- fprintf (stderr, " font height = %d\n", FONT_HEIGHT (s->font));
- fprintf (stderr, " bg width = %d\n", s->background_width);
-}
+ UNIT ::=
+ in - pixels per inch *)
+ mm - pixels per 1/1000 meter *)
+ cm - pixels per 1/100 meter *)
+ width - width of current font in pixels.
+ height - height of current font in pixels.
-#endif /* GLYPH_DEBUG */
+ *) using the ratio(s) defined in display-pixels-per-inch.
+
+ ELEMENT ::=
+
+ left-fringe - left fringe width in pixels
+ right-fringe - right fringe width in pixels
+
+ left-margin - left margin width in pixels
+ right-margin - right margin width in pixels
+
+ scroll-bar - scroll-bar area width in pixels
+
+ Examples:
+
+ Pixels corresponding to 5 inches:
+ (5 . in)
+
+ Total width of non-text areas on left side of window (if scroll-bar is on left):
+ '(space :width (+ left-fringe left-margin scroll-bar))
+
+ Align to first text column (in header line):
+ '(space :align-to 0)
+
+ Align to middle of text area minus half the width of variable `my-image'
+ containing a loaded image:
+ '(space :align-to (0.5 . (- text my-image)))
+
+ Width of left margin minus width of 1 character in the default font:
+ '(space :width (- left-margin 1))
+
+ Width of left margin minus width of 2 characters in the current font:
+ '(space :width (- left-margin (2 . width)))
+
+ Center 1 character over left-margin (in header line):
+ '(space :align-to (+ left-margin (0.5 . left-margin) -0.5))
+
+ Different ways to express width of left fringe plus left margin minus one pixel:
+ '(space :width (- (+ left-fringe left-margin) (1)))
+ '(space :width (+ left-fringe left-margin (- (1))))
+ '(space :width (+ left-fringe left-margin (-1)))
+
+*/
+
+#define NUMVAL(X) \
+ ((INTEGERP (X) || FLOATP (X)) \
+ ? XFLOATINT (X) \
+ : - 1)
+
+int
+calc_pixel_width_or_height (res, it, prop, font, width_p, align_to)
+ double *res;
+ struct it *it;
+ Lisp_Object prop;
+ void *font;
+ int width_p, *align_to;
+{
+ double pixels;
+
+#define OK_PIXELS(val) ((*res = (double)(val)), 1)
+#define OK_ALIGN_TO(val) ((*align_to = (int)(val)), 1)
+
+ if (NILP (prop))
+ return OK_PIXELS (0);
+
+ if (SYMBOLP (prop))
+ {
+ if (SCHARS (SYMBOL_NAME (prop)) == 2)
+ {
+ char *unit = SDATA (SYMBOL_NAME (prop));
+
+ if (unit[0] == 'i' && unit[1] == 'n')
+ pixels = 1.0;
+ else if (unit[0] == 'm' && unit[1] == 'm')
+ pixels = 25.4;
+ else if (unit[0] == 'c' && unit[1] == 'm')
+ pixels = 2.54;
+ else
+ pixels = 0;
+ if (pixels > 0)
+ {
+ double ppi;
+ if ((ppi = NUMVAL (Vdisplay_pixels_per_inch), ppi > 0)
+ || (CONSP (Vdisplay_pixels_per_inch)
+ && (ppi = (width_p
+ ? NUMVAL (XCAR (Vdisplay_pixels_per_inch))
+ : NUMVAL (XCDR (Vdisplay_pixels_per_inch))),
+ ppi > 0)))
+ return OK_PIXELS (ppi / pixels);
+
+ return 0;
+ }
+ }
+
+#ifdef HAVE_WINDOW_SYSTEM
+ if (EQ (prop, Qheight))
+ return OK_PIXELS (font ? FONT_HEIGHT ((XFontStruct *)font) : FRAME_LINE_HEIGHT (it->f));
+ if (EQ (prop, Qwidth))
+ return OK_PIXELS (font ? FONT_WIDTH ((XFontStruct *)font) : FRAME_COLUMN_WIDTH (it->f));
+#else
+ if (EQ (prop, Qheight) || EQ (prop, Qwidth))
+ return OK_PIXELS (1);
+#endif
+
+ if (EQ (prop, Qtext))
+ return OK_PIXELS (width_p
+ ? window_box_width (it->w, TEXT_AREA)
+ : WINDOW_BOX_HEIGHT_NO_MODE_LINE (it->w));
+
+ if (align_to && *align_to < 0)
+ {
+ *res = 0;
+ if (EQ (prop, Qleft))
+ return OK_ALIGN_TO (window_box_left_offset (it->w, TEXT_AREA));
+ if (EQ (prop, Qright))
+ return OK_ALIGN_TO (window_box_right_offset (it->w, TEXT_AREA));
+ if (EQ (prop, Qcenter))
+ return OK_ALIGN_TO (window_box_left_offset (it->w, TEXT_AREA)
+ + window_box_width (it->w, TEXT_AREA) / 2);
+ if (EQ (prop, Qleft_fringe))
+ return OK_ALIGN_TO (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (it->w)
+ ? WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH (it->w)
+ : window_box_right_offset (it->w, LEFT_MARGIN_AREA));
+ if (EQ (prop, Qright_fringe))
+ return OK_ALIGN_TO (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (it->w)
+ ? window_box_right_offset (it->w, RIGHT_MARGIN_AREA)
+ : window_box_right_offset (it->w, TEXT_AREA));
+ if (EQ (prop, Qleft_margin))
+ return OK_ALIGN_TO (window_box_left_offset (it->w, LEFT_MARGIN_AREA));
+ if (EQ (prop, Qright_margin))
+ return OK_ALIGN_TO (window_box_left_offset (it->w, RIGHT_MARGIN_AREA));
+ if (EQ (prop, Qscroll_bar))
+ return OK_ALIGN_TO (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (it->w)
+ ? 0
+ : (window_box_right_offset (it->w, RIGHT_MARGIN_AREA)
+ + (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (it->w)
+ ? WINDOW_RIGHT_FRINGE_WIDTH (it->w)
+ : 0)));
+ }
+ else
+ {
+ if (EQ (prop, Qleft_fringe))
+ return OK_PIXELS (WINDOW_LEFT_FRINGE_WIDTH (it->w));
+ if (EQ (prop, Qright_fringe))
+ return OK_PIXELS (WINDOW_RIGHT_FRINGE_WIDTH (it->w));
+ if (EQ (prop, Qleft_margin))
+ return OK_PIXELS (WINDOW_LEFT_MARGIN_WIDTH (it->w));
+ if (EQ (prop, Qright_margin))
+ return OK_PIXELS (WINDOW_RIGHT_MARGIN_WIDTH (it->w));
+ if (EQ (prop, Qscroll_bar))
+ return OK_PIXELS (WINDOW_SCROLL_BAR_AREA_WIDTH (it->w));
+ }
+
+ prop = Fbuffer_local_value (prop, it->w->buffer);
+ }
+
+ if (INTEGERP (prop) || FLOATP (prop))
+ {
+ int base_unit = (width_p
+ ? FRAME_COLUMN_WIDTH (it->f)
+ : FRAME_LINE_HEIGHT (it->f));
+ return OK_PIXELS (XFLOATINT (prop) * base_unit);
+ }
+
+ if (CONSP (prop))
+ {
+ Lisp_Object car = XCAR (prop);
+ Lisp_Object cdr = XCDR (prop);
+
+ if (SYMBOLP (car))
+ {
+#ifdef HAVE_WINDOW_SYSTEM
+ if (valid_image_p (prop))
+ {
+ int id = lookup_image (it->f, prop);
+ struct image *img = IMAGE_FROM_ID (it->f, id);
+
+ return OK_PIXELS (width_p ? img->width : img->height);
+ }
+#endif
+ if (EQ (car, Qplus) || EQ (car, Qminus))
+ {
+ int first = 1;
+ double px;
+
+ pixels = 0;
+ while (CONSP (cdr))
+ {
+ if (!calc_pixel_width_or_height (&px, it, XCAR (cdr),
+ font, width_p, align_to))
+ return 0;
+ if (first)
+ pixels = (EQ (car, Qplus) ? px : -px), first = 0;
+ else
+ pixels += px;
+ cdr = XCDR (cdr);
+ }
+ if (EQ (car, Qminus))
+ pixels = -pixels;
+ return OK_PIXELS (pixels);
+ }
+
+ car = Fbuffer_local_value (car, it->w->buffer);
+ }
+
+ if (INTEGERP (car) || FLOATP (car))
+ {
+ double fact;
+ pixels = XFLOATINT (car);
+ if (NILP (cdr))
+ return OK_PIXELS (pixels);
+ if (calc_pixel_width_or_height (&fact, it, cdr,
+ font, width_p, align_to))
+ return OK_PIXELS (pixels * fact);
+ return 0;
+ }
+
+ return 0;
+ }
+
+ return 0;
+}
+
+\f
+/***********************************************************************
+ Glyph Display
+ ***********************************************************************/
+
+#ifdef HAVE_WINDOW_SYSTEM
+
+#if GLYPH_DEBUG
+
+void
+dump_glyph_string (s)
+ struct glyph_string *s;
+{
+ fprintf (stderr, "glyph string\n");
+ fprintf (stderr, " x, y, w, h = %d, %d, %d, %d\n",
+ s->x, s->y, s->width, s->height);
+ fprintf (stderr, " ybase = %d\n", s->ybase);
+ fprintf (stderr, " hl = %d\n", s->hl);
+ fprintf (stderr, " left overhang = %d, right = %d\n",
+ s->left_overhang, s->right_overhang);
+ fprintf (stderr, " nchars = %d\n", s->nchars);
+ fprintf (stderr, " extends to end of line = %d\n",
+ s->extends_to_end_of_line_p);
+ fprintf (stderr, " font height = %d\n", FONT_HEIGHT (s->font));
+ fprintf (stderr, " bg width = %d\n", s->background_width);
+}
+
+#endif /* GLYPH_DEBUG */
/* Initialize glyph string S. CHAR2B is a suitably allocated vector
of XChar2b structures for S; it can't be allocated in
{
/* X is relative to the left edge of W, without scroll bars
or fringes. */
- int window_left_x = WINDOW_LEFT_MARGIN (w) * CANON_X_UNIT (f);
-
- x += window_left_x;
- area_width = XFASTINT (w->width) * CANON_X_UNIT (f);
- last_x = window_left_x + area_width;
-
- if (FRAME_HAS_VERTICAL_SCROLL_BARS (f))
- {
- int width = FRAME_SCROLL_BAR_WIDTH (f) * CANON_X_UNIT (f);
- if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f))
- last_x += width;
- else
- x -= width;
- }
-
- x += FRAME_INTERNAL_BORDER_WIDTH (f);
- /* ++KFS: W32 and MAC versions had -= in next line (bug??) */
- last_x += FRAME_INTERNAL_BORDER_WIDTH (f);
+ x += WINDOW_LEFT_EDGE_X (w);
+ last_x = WINDOW_LEFT_EDGE_X (w) + WINDOW_TOTAL_WIDTH (w);
}
else
{
- x = WINDOW_AREA_TO_FRAME_PIXEL_X (w, area, x);
+ int area_left = window_box_left (w, area);
+ x += area_left;
area_width = window_box_width (w, area);
- last_x = WINDOW_AREA_TO_FRAME_PIXEL_X (w, area, area_width);
+ last_x = area_left + area_width;
}
/* Build a doubly-linked list of glyph_string structures between
int x0 = head ? head->x : x;
int x1 = tail ? tail->x + tail->background_width : x;
- x0 = FRAME_TO_WINDOW_PIXEL_X (w, x0);
- x1 = FRAME_TO_WINDOW_PIXEL_X (w, x1);
-
- /* ++KFS: W32 and MAC versions had following test here:
- if (!row->full_width_p && XFASTINT (w->left_margin_width) != 0)
- */
+ int text_left = window_box_left (w, TEXT_AREA);
+ x0 -= text_left;
+ x1 -= text_left;
- if (XFASTINT (w->left_margin_width) != 0)
- {
- int left_area_width = window_box_width (w, LEFT_MARGIN_AREA);
- x0 -= left_area_width;
- x1 -= left_area_width;
- }
-
- notice_overwritten_cursor (w, area, x0, x1,
+ notice_overwritten_cursor (w, TEXT_AREA, x0, x1,
row->y, MATRIX_ROW_BOTTOM_Y (row));
}
/* Value is the x-position up to which drawn, relative to AREA of W.
This doesn't include parts drawn because of overhangs. */
- x_reached = FRAME_TO_WINDOW_PIXEL_X (w, x_reached);
- if (!row->full_width_p)
- {
- /* ++KFS: W32 and MAC versions only had this test here:
- if (area > LEFT_MARGIN_AREA)
- */
-
- if (area > LEFT_MARGIN_AREA && XFASTINT (w->left_margin_width) != 0)
- x_reached -= window_box_width (w, LEFT_MARGIN_AREA);
- if (area > TEXT_AREA)
- x_reached -= window_box_width (w, TEXT_AREA);
- }
+ if (row->full_width_p)
+ x_reached = FRAME_TO_WINDOW_PIXEL_X (w, x_reached);
+ else
+ x_reached -= window_box_left (w, area);
RELEASE_HDC (hdc, f);
glyph->charpos = CHARPOS (it->position);
glyph->object = it->object;
glyph->pixel_width = it->pixel_width;
+ glyph->ascent = it->ascent;
+ glyph->descent = it->descent;
glyph->voffset = it->voffset;
glyph->type = CHAR_GLYPH;
glyph->multibyte_p = it->multibyte_p;
glyph->charpos = CHARPOS (it->position);
glyph->object = it->object;
glyph->pixel_width = it->pixel_width;
+ glyph->ascent = it->ascent;
+ glyph->descent = it->descent;
glyph->voffset = it->voffset;
glyph->type = COMPOSITE_GLYPH;
glyph->multibyte_p = it->multibyte_p;
{
struct image *img;
struct face *face;
+ int face_ascent, glyph_ascent;
xassert (it->what == IT_IMAGE);
face = FACE_FROM_ID (it->f, it->face_id);
+ xassert (face);
+ /* Make sure X resources of the face is loaded. */
+ PREPARE_FACE_FOR_DISPLAY (it->f, face);
+
+ if (it->image_id < 0)
+ {
+ /* Fringe bitmap. */
+ it->ascent = it->phys_ascent = 0;
+ it->descent = it->phys_descent = 0;
+ it->pixel_width = 0;
+ it->nglyphs = 0;
+ return;
+ }
+
img = IMAGE_FROM_ID (it->f, it->image_id);
xassert (img);
-
- /* Make sure X resources of the face and image are loaded. */
- PREPARE_FACE_FOR_DISPLAY (it->f, face);
+ /* Make sure X resources of the image is loaded. */
prepare_image_for_display (it->f, img);
- it->ascent = it->phys_ascent = image_ascent (img, face);
+ it->ascent = it->phys_ascent = glyph_ascent = image_ascent (img, face);
it->descent = it->phys_descent = img->height + 2 * img->vmargin - it->ascent;
it->pixel_width = img->width + 2 * img->hmargin;
+ /* It's quite possible for images to have an ascent greater than
+ their height, so don't get confused in that case. */
+ if (it->descent < 0)
+ it->descent = 0;
+
+ /* If this glyph is alone on the last line, adjust it.ascent to minimum row ascent. */
+ face_ascent = face->font ? FONT_BASE (face->font) : FRAME_BASELINE_OFFSET (it->f);
+ if (face_ascent > it->ascent)
+ it->ascent = it->phys_ascent = face_ascent;
+
it->nglyphs = 1;
if (face->box != FACE_NO_BOX)
glyph->charpos = CHARPOS (it->position);
glyph->object = it->object;
glyph->pixel_width = it->pixel_width;
+ glyph->ascent = glyph_ascent;
+ glyph->descent = it->descent;
glyph->voffset = it->voffset;
glyph->type = IMAGE_GLYPH;
glyph->multibyte_p = it->multibyte_p;
/* Append a stretch glyph to IT->glyph_row. OBJECT is the source
of the glyph, WIDTH and HEIGHT are the width and height of the
- stretch. ASCENT is the percentage/100 of HEIGHT to use for the
- ascent of the glyph (0 <= ASCENT <= 1). */
+ stretch. ASCENT is the ascent of the glyph (0 <= ASCENT <= HEIGHT). */
static void
append_stretch_glyph (it, object, width, height, ascent)
struct it *it;
Lisp_Object object;
int width, height;
- double ascent;
+ int ascent;
{
struct glyph *glyph;
enum glyph_row_area area = it->area;
- xassert (ascent >= 0 && ascent <= 1);
+ xassert (ascent >= 0 && ascent <= height);
glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area];
if (glyph < it->glyph_row->glyphs[area + 1])
glyph->charpos = CHARPOS (it->position);
glyph->object = object;
glyph->pixel_width = width;
+ glyph->ascent = ascent;
+ glyph->descent = height - ascent;
glyph->voffset = it->voffset;
glyph->type = STRETCH_GLYPH;
glyph->multibyte_p = it->multibyte_p;
glyph->padding_p = 0;
glyph->glyph_not_available_p = 0;
glyph->face_id = it->face_id;
- glyph->u.stretch.ascent = height * ascent;
+ glyph->u.stretch.ascent = ascent;
glyph->u.stretch.height = height;
glyph->font_type = FONT_TYPE_UNKNOWN;
++it->glyph_row->used[area];
of the stretch should be used for the ascent of the stretch.
ASCENT must be in the range 0 <= ASCENT <= 100. */
-#define NUMVAL(X) \
- ((INTEGERP (X) || FLOATP (X)) \
- ? XFLOATINT (X) \
- : - 1)
-
-
static void
produce_stretch_glyph (it)
struct it *it;
{
- /* (space :width WIDTH :height HEIGHT. */
+ /* (space :width WIDTH :height HEIGHT ...) */
Lisp_Object prop, plist;
- int width = 0, height = 0;
- double ascent = 0;
+ int width = 0, height = 0, align_to = -1;
+ int zero_width_ok_p = 0, zero_height_ok_p = 0;
+ int ascent = 0;
+ double tem;
struct face *face = FACE_FROM_ID (it->f, it->face_id);
XFontStruct *font = face->font ? face->font : FRAME_FONT (it->f);
plist = XCDR (it->object);
/* Compute the width of the stretch. */
- if (prop = Fplist_get (plist, QCwidth),
- NUMVAL (prop) > 0)
- /* Absolute width `:width WIDTH' specified and valid. */
- width = NUMVAL (prop) * CANON_X_UNIT (it->f);
+ if ((prop = Fplist_get (plist, QCwidth), !NILP (prop))
+ && calc_pixel_width_or_height (&tem, it, prop, font, 1, 0))
+ {
+ /* Absolute width `:width WIDTH' specified and valid. */
+ zero_width_ok_p = 1;
+ width = (int)tem;
+ }
else if (prop = Fplist_get (plist, QCrelative_width),
NUMVAL (prop) > 0)
{
x_produce_glyphs (&it2);
width = NUMVAL (prop) * it2.pixel_width;
}
- else if (prop = Fplist_get (plist, QCalign_to),
- NUMVAL (prop) > 0)
- width = NUMVAL (prop) * CANON_X_UNIT (it->f) - it->current_x;
+ else if ((prop = Fplist_get (plist, QCalign_to), !NILP (prop))
+ && calc_pixel_width_or_height (&tem, it, prop, font, 1, &align_to))
+ {
+ if (it->glyph_row == NULL || !it->glyph_row->mode_line_p)
+ align_to = (align_to < 0
+ ? 0
+ : align_to - window_box_left_offset (it->w, TEXT_AREA));
+ else if (align_to < 0)
+ align_to = window_box_left_offset (it->w, TEXT_AREA);
+ width = max (0, (int)tem + align_to - it->current_x);
+ zero_width_ok_p = 1;
+ }
else
/* Nothing specified -> width defaults to canonical char width. */
- width = CANON_X_UNIT (it->f);
+ width = FRAME_COLUMN_WIDTH (it->f);
+
+ if (width <= 0 && (width < 0 || !zero_width_ok_p))
+ width = 1;
/* Compute height. */
- if (prop = Fplist_get (plist, QCheight),
- NUMVAL (prop) > 0)
- height = NUMVAL (prop) * CANON_Y_UNIT (it->f);
+ if ((prop = Fplist_get (plist, QCheight), !NILP (prop))
+ && calc_pixel_width_or_height (&tem, it, prop, font, 0, 0))
+ {
+ height = (int)tem;
+ zero_height_ok_p = 1;
+ }
else if (prop = Fplist_get (plist, QCrelative_height),
NUMVAL (prop) > 0)
height = FONT_HEIGHT (font) * NUMVAL (prop);
else
height = FONT_HEIGHT (font);
+ if (height <= 0 && (height < 0 || !zero_height_ok_p))
+ height = 1;
+
/* Compute percentage of height used for ascent. If
`:ascent ASCENT' is present and valid, use that. Otherwise,
derive the ascent from the font in use. */
if (prop = Fplist_get (plist, QCascent),
NUMVAL (prop) > 0 && NUMVAL (prop) <= 100)
- ascent = NUMVAL (prop) / 100.0;
+ ascent = height * NUMVAL (prop) / 100.0;
+ else if (!NILP (prop)
+ && calc_pixel_width_or_height (&tem, it, prop, font, 0, 0))
+ ascent = min (max (0, (int)tem), height);
else
- ascent = (double) FONT_BASE (font) / FONT_HEIGHT (font);
-
- if (width <= 0)
- width = 1;
- if (height <= 0)
- height = 1;
+ ascent = (height * FONT_BASE (font)) / FONT_HEIGHT (font);
- if (it->glyph_row)
+ if (width > 0 && height > 0 && it->glyph_row)
{
Lisp_Object object = it->stack[it->sp - 1].string;
if (!STRINGP (object))
}
it->pixel_width = width;
- it->ascent = it->phys_ascent = height * ascent;
+ it->ascent = it->phys_ascent = ascent;
it->descent = it->phys_descent = height - it->ascent;
- it->nglyphs = 1;
+ it->nglyphs = width > 0 && height > 0 ? 1 : 0;
- if (face->box != FACE_NO_BOX)
+ if (width > 0 && height > 0 && face->box != FACE_NO_BOX)
{
if (face->box_line_width > 0)
{
{
/* Translate a space with a `space-width' property
into a stretch glyph. */
- double ascent = (double) FONT_BASE (font)
- / FONT_HEIGHT (font);
+ int ascent = (((it->ascent + it->descent) * FONT_BASE (font))
+ / FONT_HEIGHT (font));
append_stretch_glyph (it, it->object, it->pixel_width,
it->ascent + it->descent, ascent);
}
}
else if (it->char_to_display == '\t')
{
- int tab_width = it->tab_width * CANON_X_UNIT (it->f);
+ int tab_width = it->tab_width * FRAME_COLUMN_WIDTH (it->f);
int x = it->current_x + it->continuation_lines_width;
int next_tab_x = ((1 + x + tab_width - 1) / tab_width) * tab_width;
/* If the distance from the current position to the next tab
stop is less than a canonical character width, use the
tab stop after that. */
- if (next_tab_x - x < CANON_X_UNIT (it->f))
+ if (next_tab_x - x < FRAME_COLUMN_WIDTH (it->f))
next_tab_x += tab_width;
it->pixel_width = next_tab_x - x;
if (it->glyph_row)
{
- double ascent = (double) it->ascent / (it->ascent + it->descent);
append_stretch_glyph (it, it->object, it->pixel_width,
- it->ascent + it->descent, ascent);
+ it->ascent + it->descent, it->ascent);
}
}
else
int charset = CHAR_CHARSET (it->char_to_display);
it->glyph_not_available_p = 1;
- it->pixel_width = (FONT_WIDTH (FRAME_FONT (it->f))
+ it->pixel_width = (FRAME_COLUMN_WIDTH (it->f)
* CHARSET_WIDTH (charset));
it->phys_ascent = FONT_BASE (font) + boff;
it->phys_descent = FONT_DESCENT (font) - boff;
hpos, hpos + len,
DRAW_NORMAL_TEXT, 0);
-#ifndef HAVE_CARBON
- /* ++KFS: Why not on MAC ? */
-
/* Invalidate old phys cursor if the glyph at its hpos is redrawn. */
if (updated_area == TEXT_AREA
&& updated_window->phys_cursor_on_p
&& updated_window->phys_cursor.hpos >= hpos
&& updated_window->phys_cursor.hpos < hpos + len)
updated_window->phys_cursor_on_p = 0;
-#endif
UNBLOCK_INPUT;
frame_x = window_box_left (w, updated_area) + output_cursor.x;
frame_y = WINDOW_TO_FRAME_PIXEL_Y (w, output_cursor.y);
- rif->shift_glyphs_for_insert (f, frame_x, frame_y, line_height,
- shifted_region_width, shift_by_width);
+ rif->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];
f = XFRAME (w->frame);
if (updated_row->full_width_p)
- {
- max_x = XFASTINT (w->width) * CANON_X_UNIT (f);
- if (FRAME_HAS_VERTICAL_SCROLL_BARS (f)
- && !w->pseudo_window_p)
- max_x += FRAME_SCROLL_BAR_WIDTH (f) * CANON_X_UNIT (f);
- }
+ max_x = WINDOW_TOTAL_WIDTH (w);
else
max_x = window_box_width (w, updated_area);
max_y = window_text_bottom_y (w);
}
else
{
- from_x = WINDOW_AREA_TO_FRAME_PIXEL_X (w, updated_area, from_x);
- to_x = WINDOW_AREA_TO_FRAME_PIXEL_X (w, updated_area, to_x);
+ int area_left = window_box_left (w, updated_area);
+ from_x += area_left;
+ to_x += area_left;
}
- min_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w);
+ min_y = WINDOW_HEADER_LINE_HEIGHT (w);
from_y = WINDOW_TO_FRAME_PIXEL_Y (w, max (min_y, output_cursor.y));
to_y = WINDOW_TO_FRAME_PIXEL_Y (w, to_y);
ARG. If type is BAR_CURSOR, return in *WIDTH the specified width
of the bar cursor. */
-enum text_cursor_kinds
+static enum text_cursor_kinds
get_specified_cursor_type (arg, width)
Lisp_Object arg;
int *width;
setting of cursor-type. If explicitly marked off, draw no cursor.
In all other cases, we want a hollow box cursor. */
-enum text_cursor_kinds
-get_window_cursor_type (w, width, active_cursor)
+static enum text_cursor_kinds
+get_window_cursor_type (w, glyph, width, active_cursor)
struct window *w;
+ struct glyph *glyph;
int *width;
int *active_cursor;
{
/* Use normal cursor if not blinked off. */
if (!w->cursor_off_p)
- return cursor_type;
+ {
+ if (glyph != NULL && glyph->type == IMAGE_GLYPH) {
+ if (cursor_type == FILLED_BOX_CURSOR)
+ cursor_type = HOLLOW_BOX_CURSOR;
+ }
+ return cursor_type;
+ }
/* Cursor is blinked off, so determine how to "toggle" it. */
return FRAME_BLINK_OFF_CURSOR (f);
}
+#if 0
+ /* Some people liked having a permanently visible blinking cursor,
+ while others had very strong opinions against it. So it was
+ decided to remove it. KFS 2003-09-03 */
+
/* Finally perform built-in cursor blinking:
filled box <-> hollow box
wide [h]bar <-> narrow [h]bar
*width = 1;
return cursor_type;
}
+#endif
return NO_CURSOR;
}
enum glyph_row_area area;
int x0, y0, x1, y1;
{
-#ifdef HAVE_CARBON
- /* ++KFS: Why is there a special version of this for the mac ? */
- if (area == TEXT_AREA
- && w->phys_cursor_on_p
- && y0 <= w->phys_cursor.y
- && y1 >= w->phys_cursor.y + w->phys_cursor_height
- && x0 <= w->phys_cursor.x
- && (x1 < 0 || x1 > w->phys_cursor.x))
- w->phys_cursor_on_p = 0;
-#else
- if (area == TEXT_AREA && w->phys_cursor_on_p)
- {
- int cx0 = w->phys_cursor.x;
- int cx1 = cx0 + w->phys_cursor_width;
- int cy0 = w->phys_cursor.y;
- int cy1 = cy0 + w->phys_cursor_height;
+ int cx0, cx1, cy0, cy1;
+ struct glyph_row *row;
- if (x0 <= cx0 && (x1 < 0 || x1 >= cx1))
- {
- /* The cursor image will be completely removed from the
- screen if the output area intersects the cursor area in
- y-direction. When we draw in [y0 y1[, and some part of
- the cursor is at y < y0, that part must have been drawn
- before. When scrolling, the cursor is erased before
- actually scrolling, so we don't come here. When not
- scrolling, the rows above the old cursor row must have
- changed, and in this case these rows must have written
- over the cursor image.
+ if (!w->phys_cursor_on_p)
+ return;
+ if (area != TEXT_AREA)
+ return;
- Likewise if part of the cursor is below y1, with the
- exception of the cursor being in the first blank row at
- the buffer and window end because update_text_area
- doesn't draw that row. (Except when it does, but
- that's handled in update_text_area.) */
+ row = w->current_matrix->rows + w->phys_cursor.vpos;
+ if (!row->displays_text_p)
+ return;
- if (((y0 >= cy0 && y0 < cy1) || (y1 > cy0 && y1 < cy1))
- && w->current_matrix->rows[w->phys_cursor.vpos].displays_text_p)
- w->phys_cursor_on_p = 0;
- }
+ if (row->cursor_in_fringe_p)
+ {
+ row->cursor_in_fringe_p = 0;
+ draw_fringe_bitmap (w, row, 0);
+ w->phys_cursor_on_p = 0;
+ return;
}
-#endif
+
+ cx0 = w->phys_cursor.x;
+ cx1 = cx0 + w->phys_cursor_width;
+ if (x0 > cx0 || (x1 >= 0 && x1 < cx1))
+ return;
+
+ /* The cursor image will be completely removed from the
+ screen if the output area intersects the cursor area in
+ y-direction. When we draw in [y0 y1[, and some part of
+ the cursor is at y < y0, that part must have been drawn
+ before. When scrolling, the cursor is erased before
+ actually scrolling, so we don't come here. When not
+ scrolling, the rows above the old cursor row must have
+ changed, and in this case these rows must have written
+ over the cursor image.
+
+ Likewise if part of the cursor is below y1, with the
+ exception of the cursor being in the first blank row at
+ the buffer and window end because update_text_area
+ doesn't draw that row. (Except when it does, but
+ that's handled in update_text_area.) */
+
+ cy0 = w->phys_cursor.y;
+ cy1 = cy0 + w->phys_cursor_height;
+ if ((y0 < cy0 || y0 >= cy1) && (y1 <= cy0 || y1 >= cy1))
+ return;
+
+ w->phys_cursor_on_p = 0;
}
#endif /* HAVE_WINDOW_SYSTEM */
BLOCK_INPUT;
- if (area == LEFT_MARGIN_AREA)
- x = 0;
- else if (area == TEXT_AREA)
- x = row->x + window_box_width (w, LEFT_MARGIN_AREA);
- else
- x = (window_box_width (w, LEFT_MARGIN_AREA)
- + window_box_width (w, TEXT_AREA));
-
+ x = 0;
for (i = 0; i < row->used[area];)
{
if (row->glyphs[area][i].overlaps_vertically_p)
hl, 0);
w->phys_cursor_on_p = on_p;
-#ifndef HAVE_CARBON
- /* ++KFS: MAC version did not adjust phys_cursor_width (bug?) */
if (hl == DRAW_CURSOR)
w->phys_cursor_width = x1 - w->phys_cursor.x;
- else
-#endif
/* When we erase the cursor, and ROW is overlapped by other
rows, make sure that these overlapping parts of other rows
are redrawn. */
- if (hl == DRAW_NORMAL_TEXT && row->overlapped_p)
+ else if (hl == DRAW_NORMAL_TEXT && row->overlapped_p)
{
if (row > w->current_matrix->rows
&& MATRIX_ROW_OVERLAPS_SUCC_P (row - 1))
if (cursor_row->visible_height <= 0)
goto mark_cursor_off;
+ /* If cursor is in the fringe, erase by drawing actual bitmap there. */
+ if (cursor_row->cursor_in_fringe_p)
+ {
+ cursor_row->cursor_in_fringe_p = 0;
+ draw_fringe_bitmap (w, cursor_row, 0);
+ goto mark_cursor_off;
+ }
+
/* This can happen when the new row is shorter than the old one.
In this case, either draw_glyphs or clear_end_of_line
should have cleared the cursor. Note that we wouldn't be
if (w->phys_cursor_type == HOLLOW_BOX_CURSOR)
{
int x, y;
- int header_line_height = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w);
+ int header_line_height = WINDOW_HEADER_LINE_HEIGHT (w);
cursor_glyph = get_phys_cursor_glyph (w);
if (cursor_glyph == NULL)
int new_cursor_type;
int new_cursor_width;
int active_cursor;
- struct glyph_matrix *current_glyphs;
struct glyph_row *glyph_row;
struct glyph *glyph;
if (!on && !w->phys_cursor_on_p)
return;
- current_glyphs = w->current_matrix;
- glyph_row = MATRIX_ROW (current_glyphs, vpos);
- glyph = glyph_row->glyphs[TEXT_AREA] + hpos;
-
+ glyph_row = MATRIX_ROW (w->current_matrix, vpos);
/* If cursor row is not enabled, we don't really know where to
display the cursor. */
if (!glyph_row->enabled_p)
return;
}
+ glyph = NULL;
+ if (!glyph_row->exact_window_width_line_p
+ || hpos < glyph_row->used[TEXT_AREA])
+ glyph = glyph_row->glyphs[TEXT_AREA] + hpos;
+
xassert (interrupt_input_blocked);
/* Set new_cursor_type to the cursor we want to be displayed. */
- new_cursor_type = get_window_cursor_type (w, &new_cursor_width, &active_cursor);
+ new_cursor_type = get_window_cursor_type (w, glyph,
+ &new_cursor_width, &active_cursor);
/* If cursor is currently being shown and we don't want it to be or
it is in the wrong place, or the cursor type is not what we want,
{
int cleared = 0;
- if (!NILP (dpyinfo->mouse_face_window))
+ if (!dpyinfo->mouse_face_hidden && !NILP (dpyinfo->mouse_face_window))
{
show_mouse_face (dpyinfo, DRAW_NORMAL_TEXT);
cleared = 1;
of last line in W. In the row containing CHARPOS, stop before glyphs
having STOP as object. */
-#if 0 /* This is a version of fast_find_position that's more correct
+#if 1 /* This is a version of fast_find_position that's more correct
in the presence of hscrolling, for example. I didn't install
it right away because the problem fixed is minor, it failed
in 20.x as well, and I think it's too risky to install
{
struct glyph_row *row, *first;
struct glyph *glyph, *end;
- int i, past_end = 0;
+ int past_end = 0;
first = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
row = row_containing_pos (w, charpos, first, NULL, 0);
if (charpos < MATRIX_ROW_START_CHARPOS (first))
{
*x = *y = *hpos = *vpos = 0;
- return 0;
+ return 1;
}
else
{
}
*hpos = glyph - row->glyphs[TEXT_AREA];
- return past_end;
+ return !past_end;
}
-#else /* not 0 */
+#else /* not 1 */
static int
fast_find_position (w, pos, hpos, vpos, x, y, stop)
return 0;
}
-#endif /* not 0 */
+#endif /* not 1 */
/* Find the position of the glyph for position POS in OBJECT in
}
-#ifdef HAVE_CARBON
-
-/* ++KFS: Why does MAC have its own version here? Looks like OLD CODE!! */
+/* See if position X, Y is within a hot-spot of an image. */
-/* Take proper action when mouse has moved to the mode or header line of
- window W, x-position X. MODE_LINE_P non-zero means mouse is on the
- mode line. X is relative to the start of the text display area of
- W, so the width of fringes and scroll bars must be subtracted
- to get a position relative to the start of the mode line. */
-
-static void
-note_mode_line_highlight (w, x, mode_line_p)
- struct window *w;
- int x, mode_line_p;
+static int
+on_hot_spot_p (hot_spot, x, y)
+ Lisp_Object hot_spot;
+ int x, y;
{
- struct frame *f = XFRAME (w->frame);
- struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (f);
- Cursor *cursor = dpyinfo->vertical_scroll_bar_cursor;
- struct glyph_row *row;
-
- if (mode_line_p)
- row = MATRIX_MODE_LINE_ROW (w->current_matrix);
- else
- row = MATRIX_HEADER_LINE_ROW (w->current_matrix);
+ if (!CONSP (hot_spot))
+ return 0;
- if (row->enabled_p)
+ if (EQ (XCAR (hot_spot), Qrect))
{
- struct glyph *glyph, *end;
- Lisp_Object help, map;
- int x0;
-
- /* Find the glyph under X. */
- glyph = row->glyphs[TEXT_AREA];
- end = glyph + row->used[TEXT_AREA];
- x0 = - (FRAME_LEFT_SCROLL_BAR_WIDTH (f) * CANON_X_UNIT (f)
- + FRAME_X_LEFT_FRINGE_WIDTH (f));
-
- while (glyph < end
- && x >= x0 + glyph->pixel_width)
+ /* CDR is (Top-Left . Bottom-Right) = ((x0 . y0) . (x1 . y1)) */
+ Lisp_Object rect = XCDR (hot_spot);
+ Lisp_Object tem;
+ if (!CONSP (rect))
+ return 0;
+ if (!CONSP (XCAR (rect)))
+ return 0;
+ if (!CONSP (XCDR (rect)))
+ return 0;
+ if (!(tem = XCAR (XCAR (rect)), INTEGERP (tem) && x >= XINT (tem)))
+ return 0;
+ if (!(tem = XCDR (XCAR (rect)), INTEGERP (tem) && y >= XINT (tem)))
+ return 0;
+ if (!(tem = XCAR (XCDR (rect)), INTEGERP (tem) && x <= XINT (tem)))
+ return 0;
+ if (!(tem = XCDR (XCDR (rect)), INTEGERP (tem) && y <= XINT (tem)))
+ return 0;
+ return 1;
+ }
+ else if (EQ (XCAR (hot_spot), Qcircle))
+ {
+ /* CDR is (Center . Radius) = ((x0 . y0) . r) */
+ Lisp_Object circ = XCDR (hot_spot);
+ Lisp_Object lr, lx0, ly0;
+ if (CONSP (circ)
+ && CONSP (XCAR (circ))
+ && (lr = XCDR (circ), INTEGERP (lr) || FLOATP (lr))
+ && (lx0 = XCAR (XCAR (circ)), INTEGERP (lx0))
+ && (ly0 = XCDR (XCAR (circ)), INTEGERP (ly0)))
{
- x0 += glyph->pixel_width;
- ++glyph;
+ double r = XFLOATINT (lr);
+ double dx = XINT (lx0) - x;
+ double dy = XINT (ly0) - y;
+ return (dx * dx + dy * dy <= r * r);
}
-
- if (glyph < end
- && STRINGP (glyph->object)
- && STRING_INTERVALS (glyph->object)
- && glyph->charpos >= 0
- && glyph->charpos < SCHARS (glyph->object))
- {
- /* If we're on a string with `help-echo' text property,
- arrange for the help to be displayed. This is done by
- setting the global variable help_echo_string to the help
- string. */
- help = Fget_text_property (make_number (glyph->charpos),
- Qhelp_echo, glyph->object);
- if (!NILP (help))
- {
- help_echo_string = help;
- XSETWINDOW (help_echo_window, w);
- help_echo_object = glyph->object;
- help_echo_pos = glyph->charpos;
- }
-
- /* Change the mouse pointer according to what is under X/Y. */
- map = Fget_text_property (make_number (glyph->charpos),
- Qlocal_map, glyph->object);
- if (KEYMAPP (map))
- cursor = f->output_data.mac->nontext_cursor;
- else
+ }
+ else if (EQ (XCAR (hot_spot), Qpoly))
+ {
+ /* CDR is [x0 y0 x1 y1 x2 y2 ...x(n-1) y(n-1)] */
+ if (VECTORP (XCDR (hot_spot)))
+ {
+ struct Lisp_Vector *v = XVECTOR (XCDR (hot_spot));
+ Lisp_Object *poly = v->contents;
+ int n = v->size;
+ int i;
+ int inside = 0;
+ Lisp_Object lx, ly;
+ int x0, y0;
+
+ /* Need an even number of coordinates, and at least 3 edges. */
+ if (n < 6 || n & 1)
+ return 0;
+
+ /* Count edge segments intersecting line from (X,Y) to (X,infinity).
+ If count is odd, we are inside polygon. Pixels on edges
+ may or may not be included depending on actual geometry of the
+ polygon. */
+ if ((lx = poly[n-2], !INTEGERP (lx))
+ || (ly = poly[n-1], !INTEGERP (lx)))
+ return 0;
+ x0 = XINT (lx), y0 = XINT (ly);
+ for (i = 0; i < n; i += 2)
{
- map = Fget_text_property (make_number (glyph->charpos),
- Qkeymap, glyph->object);
- if (KEYMAPP (map))
- cursor = f->output_data.mac->nontext_cursor;
+ int x1 = x0, y1 = y0;
+ if ((lx = poly[i], !INTEGERP (lx))
+ || (ly = poly[i+1], !INTEGERP (ly)))
+ return 0;
+ x0 = XINT (lx), y0 = XINT (ly);
+
+ /* Does this segment cross the X line? */
+ if (x0 >= x)
+ {
+ if (x1 >= x)
+ continue;
+ }
+ else if (x1 < x)
+ continue;
+ if (y > y0 && y > y1)
+ continue;
+ if (y < y0 + ((y1 - y0) * (x - x0)) / (x1 - x0))
+ inside = !inside;
}
+ return inside;
}
}
+ else
+ return 0;
+}
- rif->define_frame_cursor (f, cursor);
+Lisp_Object
+find_hot_spot (map, x, y)
+ Lisp_Object map;
+ int x, y;
+{
+ while (CONSP (map))
+ {
+ if (CONSP (XCAR (map))
+ && on_hot_spot_p (XCAR (XCAR (map)), x, y))
+ return XCAR (map);
+ map = XCDR (map);
+ }
+
+ return Qnil;
}
+DEFUN ("lookup-image-map", Flookup_image_map, Slookup_image_map,
+ 3, 3, 0,
+ doc: /* Lookup in image map MAP coordinates X and Y.
+An image map is an alist where each element has the format (AREA ID PLIST).
+An AREA is specified as either a rectangle, a circle, or a polygon:
+A rectangle is a cons (rect . ((x0 . y0) . (x1 . y1))) specifying the
+pixel coordinates of the upper left and bottom right corners.
+A circle is a cons (circle . ((x0 . y0) . r)) specifying the center
+and the radius of the circle; r may be a float or integer.
+A polygon is a cons (poly . [x0 y0 x1 y1 ...]) where each pair in the
+vector describes one corner in the polygon.
+Returns the alist element for the first matching AREA in MAP. */)
+ (map, x, y)
+ Lisp_Object map;
+ Lisp_Object x, y;
+{
+ int ix, iy;
+ if (NILP (map))
+ return Qnil;
+
+ CHECK_NUMBER (x);
+ CHECK_NUMBER (y);
+
+ return find_hot_spot (map, XINT (x), XINT (y));
+}
+
+
+/* Display frame CURSOR, optionally using shape defined by POINTER. */
+static void
+define_frame_cursor1 (f, cursor, pointer)
+ struct frame *f;
+ Cursor cursor;
+ Lisp_Object pointer;
+{
+ if (!NILP (pointer))
+ {
+ if (EQ (pointer, Qarrow))
+ cursor = FRAME_X_OUTPUT (f)->nontext_cursor;
+ else if (EQ (pointer, Qhand))
+ cursor = FRAME_X_OUTPUT (f)->hand_cursor;
+ else if (EQ (pointer, Qtext))
+ cursor = FRAME_X_OUTPUT (f)->text_cursor;
+ else if (EQ (pointer, intern ("hdrag")))
+ cursor = FRAME_X_OUTPUT (f)->horizontal_drag_cursor;
+#ifdef HAVE_X_WINDOWS
+ else if (EQ (pointer, intern ("vdrag")))
+ cursor = FRAME_X_DISPLAY_INFO (f)->vertical_scroll_bar_cursor;
+#endif
+ else if (EQ (pointer, intern ("hourglass")))
+ cursor = FRAME_X_OUTPUT (f)->hourglass_cursor;
+ else if (EQ (pointer, Qmodeline))
+ cursor = FRAME_X_OUTPUT (f)->modeline_cursor;
+ else
+ cursor = FRAME_X_OUTPUT (f)->nontext_cursor;
+ }
+
+#ifndef HAVE_CARBON
+ if (cursor != No_Cursor)
#else
+ if (bcmp (&cursor, &No_Cursor, sizeof (Cursor)))
+#endif
+ rif->define_frame_cursor (f, cursor);
+}
/* Take proper action when mouse has moved to the mode or header line
or marginal area AREA of window W, x-position X and y-position Y.
{
struct frame *f = XFRAME (w->frame);
Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
- Cursor cursor = dpyinfo->vertical_scroll_bar_cursor;
- int charpos;
- Lisp_Object string, help, map, pos;
+ Cursor cursor = FRAME_X_OUTPUT (f)->nontext_cursor;
+ Lisp_Object pointer = Qnil;
+ int charpos, dx, dy, width, height;
+ Lisp_Object string, object = Qnil;
+ Lisp_Object pos, help, image;
if (area == ON_MODE_LINE || area == ON_HEADER_LINE)
- string = mode_line_string (w, x, y, area, &charpos);
+ string = mode_line_string (w, area, &x, &y, &charpos,
+ &object, &dx, &dy, &width, &height);
else
- string = marginal_area_string (w, x, y, area, &charpos);
+ {
+ x -= WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH (w);
+ string = marginal_area_string (w, area, &x, &y, &charpos,
+ &object, &dx, &dy, &width, &height);
+ }
+
+ help = Qnil;
+
+ if (IMAGEP (object))
+ {
+ Lisp_Object image_map, hotspot;
+ if ((image_map = Fplist_get (XCDR (object), QCmap),
+ !NILP (image_map))
+ && (hotspot = find_hot_spot (image_map, dx, dy),
+ CONSP (hotspot))
+ && (hotspot = XCDR (hotspot), CONSP (hotspot)))
+ {
+ Lisp_Object area_id, plist;
+
+ area_id = XCAR (hotspot);
+ /* Could check AREA_ID to see if we enter/leave this hot-spot.
+ If so, we could look for mouse-enter, mouse-leave
+ properties in PLIST (and do something...). */
+ if ((plist = XCDR (hotspot), CONSP (plist)))
+ {
+ pointer = Fplist_get (plist, Qpointer);
+ if (NILP (pointer))
+ pointer = Qhand;
+ help = Fplist_get (plist, Qhelp_echo);
+ if (!NILP (help))
+ {
+ help_echo_string = help;
+ /* Is this correct? ++kfs */
+ XSETWINDOW (help_echo_window, w);
+ help_echo_object = w->buffer;
+ help_echo_pos = charpos;
+ }
+ }
+ if (NILP (pointer))
+ pointer = Fplist_get (XCDR (object), QCpointer);
+ }
+ }
if (STRINGP (string))
{
pos = make_number (charpos);
-
/* If we're on a string with `help-echo' text property, arrange
for the help to be displayed. This is done by setting the
global variable help_echo_string to the help string. */
help_echo_pos = charpos;
}
+ if (NILP (pointer))
+ pointer = Fget_text_property (pos, Qpointer, string);
+
/* Change the mouse pointer according to what is under X/Y. */
- map = Fget_text_property (pos, Qlocal_map, string);
- if (!KEYMAPP (map))
- map = Fget_text_property (pos, Qkeymap, string);
- if (KEYMAPP (map))
- cursor = FRAME_X_OUTPUT (f)->nontext_cursor;
+ if (NILP (pointer) && ((area == ON_MODE_LINE) || (area == ON_HEADER_LINE)))
+ {
+ Lisp_Object map;
+ map = Fget_text_property (pos, Qlocal_map, string);
+ if (!KEYMAPP (map))
+ map = Fget_text_property (pos, Qkeymap, string);
+ if (!KEYMAPP (map))
+ cursor = dpyinfo->vertical_scroll_bar_cursor;
+ }
}
- rif->define_frame_cursor (f, cursor);
+ define_frame_cursor1 (f, cursor, pointer);
}
-#endif /* !HAVE_CARBON */
-
/* EXPORT:
Take proper action when the mouse has moved to position X, Y on
Lisp_Object window;
struct window *w;
Cursor cursor = No_Cursor;
+ Lisp_Object pointer = Qnil; /* Takes precedence over cursor! */
struct buffer *b;
/* When a menu is active, don't highlight because this looks odd. */
}
/* Which window is that in? */
- window = window_from_coordinates (f, x, y, &part, 1);
+ window = window_from_coordinates (f, x, y, &part, 0, 0, 1);
/* If we were displaying active text in another window, clear that. */
if (! EQ (window, dpyinfo->mouse_face_window))
return;
/* Reset help_echo_string. It will get recomputed below. */
- /* ++KFS: X version didn't do this, but it looks harmless. */
help_echo_string = Qnil;
/* Convert to window-relative pixel coordinates. */
return;
}
-#ifdef HAVE_CARBON
- /* ++KFS: Why does MAC have its own version here? Looks like OLD CODE!! */
-
- /* Mouse is on the mode or header line? */
- if (part == ON_MODE_LINE || part == ON_HEADER_LINE)
- {
- note_mode_line_highlight (w, x, part == ON_MODE_LINE);
- return;
- }
-#else
/* Mouse is on the mode, header line or margin? */
if (part == ON_MODE_LINE || part == ON_HEADER_LINE
|| part == ON_LEFT_MARGIN || part == ON_RIGHT_MARGIN)
note_mode_line_or_margin_highlight (w, x, y, part);
return;
}
-#endif
if (part == ON_VERTICAL_BORDER)
cursor = FRAME_X_OUTPUT (f)->horizontal_drag_cursor;
+ else if (part == ON_LEFT_FRINGE || part == ON_RIGHT_FRINGE)
+ cursor = FRAME_X_OUTPUT (f)->nontext_cursor;
else
cursor = FRAME_X_OUTPUT (f)->text_cursor;
&& XFASTINT (w->last_modified) == BUF_MODIFF (b)
&& XFASTINT (w->last_overlay_modified) == BUF_OVERLAY_MODIFF (b))
{
- int hpos, vpos, pos, i, area;
+ int hpos, vpos, pos, i, dx, dy, area;
struct glyph *glyph;
Lisp_Object object;
Lisp_Object mouse_face = Qnil, overlay = Qnil, position;
int obegv, ozv, same_region;
/* Find the glyph under X/Y. */
- glyph = x_y_to_hpos_vpos (w, x, y, &hpos, &vpos, &area, 0);
+ glyph = x_y_to_hpos_vpos (w, x, y, &hpos, &vpos, &dx, &dy, &area);
+
+ /* Look for :pointer property on image. */
+ if (glyph != NULL && glyph->type == IMAGE_GLYPH)
+ {
+ struct image *img = IMAGE_FROM_ID (f, glyph->u.img_id);
+ if (img != NULL && IMAGEP (img->spec))
+ {
+ Lisp_Object image_map, hotspot;
+ if ((image_map = Fplist_get (XCDR (img->spec), QCmap),
+ !NILP (image_map))
+ && (hotspot = find_hot_spot (image_map, dx, dy),
+ CONSP (hotspot))
+ && (hotspot = XCDR (hotspot), CONSP (hotspot)))
+ {
+ Lisp_Object area_id, plist;
+
+ area_id = XCAR (hotspot);
+ /* Could check AREA_ID to see if we enter/leave this hot-spot.
+ If so, we could look for mouse-enter, mouse-leave
+ properties in PLIST (and do something...). */
+ if ((plist = XCDR (hotspot), CONSP (plist)))
+ {
+ pointer = Fplist_get (plist, Qpointer);
+ if (NILP (pointer))
+ pointer = Qhand;
+ help_echo_string = Fplist_get (plist, Qhelp_echo);
+ if (!NILP (help_echo_string))
+ {
+ help_echo_window = window;
+ help_echo_object = glyph->object;
+ help_echo_pos = glyph->charpos;
+ }
+ }
+ }
+ if (NILP (pointer))
+ pointer = Fplist_get (XCDR (img->spec), QCpointer);
+ }
+ }
/* Clear mouse face if X/Y not over text. */
if (glyph == NULL
|| area != TEXT_AREA
|| !MATRIX_ROW (w->current_matrix, vpos)->displays_text_p)
{
-#if defined (HAVE_NTGUI)
- /* ++KFS: Why is this necessary on W32 ? */
- clear_mouse_face (dpyinfo);
- cursor = FRAME_X_OUTPUT (f)->nontext_cursor;
-#else
if (clear_mouse_face (dpyinfo))
cursor = No_Cursor;
-#endif
+ if (NILP (pointer))
+ {
+ if (area != TEXT_AREA)
+ cursor = FRAME_X_OUTPUT (f)->nontext_cursor;
+ else
+ pointer = Vvoid_text_area_pointer;
+ }
goto set_cursor;
}
check_help_echo:
/* Look for a `help-echo' property. */
- {
+ if (NILP (help_echo_string)) {
Lisp_Object help, overlay;
/* Check overlays first. */
}
}
+ /* Look for a `pointer' property. */
+ if (NILP (pointer))
+ {
+ /* Check overlays first. */
+ for (i = noverlays - 1; i >= 0 && NILP (pointer); --i)
+ pointer = Foverlay_get (overlay_vec[i], Qpointer);
+
+ if (NILP (pointer))
+ {
+ Lisp_Object object = glyph->object;
+ int charpos = glyph->charpos;
+
+ /* Try text properties. */
+ if (STRINGP (object)
+ && charpos >= 0
+ && charpos < SCHARS (object))
+ {
+ pointer = Fget_text_property (make_number (charpos),
+ Qpointer, object);
+ if (NILP (pointer))
+ {
+ /* If the string itself doesn't specify a pointer,
+ see if the buffer text ``under'' it does. */
+ struct glyph_row *r
+ = MATRIX_ROW (w->current_matrix, vpos);
+ int start = MATRIX_ROW_START_CHARPOS (r);
+ int pos = string_buffer_position (w, object, start);
+ if (pos > 0)
+ pointer = Fget_char_property (make_number (pos),
+ Qpointer, w->buffer);
+ }
+ }
+ else if (BUFFERP (object)
+ && charpos >= BEGV
+ && charpos < ZV)
+ pointer = Fget_text_property (make_number (charpos),
+ Qpointer, object);
+ }
+ }
+
BEGV = obegv;
ZV = ozv;
current_buffer = obuf;
set_cursor:
- if (cursor != No_Cursor)
- rif->define_frame_cursor (f, cursor);
+ define_frame_cursor1 (f, cursor, pointer);
}
/* Set START_X to the window-relative start position for drawing glyphs of
AREA. The first glyph of the text area can be partially visible.
The first glyphs of other areas cannot. */
- if (area == LEFT_MARGIN_AREA)
- start_x = 0;
- else if (area == TEXT_AREA)
- start_x = row->x + window_box_width (w, LEFT_MARGIN_AREA);
- else
- start_x = (window_box_width (w, LEFT_MARGIN_AREA)
- + window_box_width (w, TEXT_AREA));
+ start_x = window_box_left_offset (w, area);
x = start_x;
+ if (area == TEXT_AREA)
+ x += row->x;
/* Find the first glyph that must be redrawn. */
while (first < end
cursor_glyph = get_phys_cursor_glyph (w);
if (cursor_glyph)
{
- cr.x = w->phys_cursor.x;
+ /* r is relative to W's box, but w->phys_cursor.x is relative
+ to left edge of W's TEXT area. Adjust it. */
+ cr.x = window_box_left_offset (w, TEXT_AREA) + w->phys_cursor.x;
cr.y = w->phys_cursor.y;
cr.width = cursor_glyph->pixel_width;
cr.height = w->phys_cursor_height;
- /* ++KFS: W32 version used W32-specific IntersectRect here, but
+ /* ++KFS: W32 version used W32-specific IntersectRect here, but
I assume the effect is the same -- and this is portable. */
return x_intersect_rectangles (&cr, r, &result);
}
x_draw_vertical_border (w)
struct window *w;
{
- struct frame *f = XFRAME (WINDOW_FRAME (w));
+ /* We could do better, if we knew what type of scroll-bar the adjacent
+ windows (on either side) have... But we don't :-(
+ However, I think this works ok. ++KFS 2003-04-25 */
/* Redraw borders between horizontally adjacent windows. Don't
do it for frames with vertical scroll bars because either the
right scroll bar of a window, or the left scroll bar of its
neighbor will suffice as a border. */
if (!WINDOW_RIGHTMOST_P (w)
- && !FRAME_HAS_VERTICAL_SCROLL_BARS (f))
+ && !WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w))
{
int x0, x1, y0, y1;
window_box_edges (w, -1, &x0, &y0, &x1, &y1);
- x1 += FRAME_X_RIGHT_FRINGE_WIDTH (f);
y1 -= 1;
rif->draw_vertical_window_border (w, x1, y0, y1);
}
+ else if (!WINDOW_LEFTMOST_P (w)
+ && !WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w))
+ {
+ int x0, x1, y0, y1;
+
+ window_box_edges (w, -1, &x0, &y0, &x1, &y1);
+ y1 -= 1;
+
+ rif->draw_vertical_window_border (w, x0, y0, y1);
+ }
}
}
/* Frame-relative pixel rectangle of W. */
- wr.x = XFASTINT (w->left) * CANON_X_UNIT (f);
- wr.y = XFASTINT (w->top) * CANON_Y_UNIT (f);
- wr.width = XFASTINT (w->width) * CANON_X_UNIT (f);
- wr.height = XFASTINT (w->height) * CANON_Y_UNIT (f);
+ wr.x = WINDOW_LEFT_EDGE_X (w);
+ wr.y = WINDOW_TOP_EDGE_Y (w);
+ wr.width = WINDOW_TOTAL_WIDTH (w);
+ wr.height = WINDOW_TOTAL_HEIGHT (w);
if (x_intersect_rectangles (fr, &wr, &r))
{
r.x, r.y, r.width, r.height));
/* Convert to window coordinates. */
- r.x = FRAME_TO_WINDOW_PIXEL_X (w, r.x);
- r.y = FRAME_TO_WINDOW_PIXEL_Y (w, r.y);
+ r.x -= WINDOW_LEFT_EDGE_X (w);
+ r.y -= WINDOW_TOP_EDGE_Y (w);
/* Turn off the cursor. */
if (!w->pseudo_window_p
if (w == 0 || h == 0)
{
r.x = r.y = 0;
- r.width = CANON_X_UNIT (f) * f->width;
- r.height = CANON_Y_UNIT (f) * f->height;
+ r.width = FRAME_COLUMN_WIDTH (f) * FRAME_COLS (f);
+ r.height = FRAME_LINE_HEIGHT (f) * FRAME_LINES (f);
}
else
{
#endif
#ifdef HAVE_WINDOW_SYSTEM
defsubr (&Stool_bar_lines_needed);
+ defsubr (&Slookup_image_map);
#endif
defsubr (&Sformat_mode_line);
staticpro (&Qspace);
Qmargin = intern ("margin");
staticpro (&Qmargin);
+ Qpointer = intern ("pointer");
+ staticpro (&Qpointer);
Qleft_margin = intern ("left-margin");
staticpro (&Qleft_margin);
Qright_margin = intern ("right-margin");
staticpro (&Qright_margin);
- Qalign_to = intern ("align-to");
- staticpro (&Qalign_to);
+ Qcenter = intern ("center");
+ staticpro (&Qcenter);
QCalign_to = intern (":align-to");
staticpro (&QCalign_to);
- Qrelative_width = intern ("relative-width");
- staticpro (&Qrelative_width);
QCrelative_width = intern (":relative-width");
staticpro (&QCrelative_width);
QCrelative_height = intern (":relative-height");
staticpro (&Qtrailing_whitespace);
Qimage = intern ("image");
staticpro (&Qimage);
+ QCmap = intern (":map");
+ staticpro (&QCmap);
+ QCpointer = intern (":pointer");
+ staticpro (&QCpointer);
+ Qrect = intern ("rect");
+ staticpro (&Qrect);
+ Qcircle = intern ("circle");
+ staticpro (&Qcircle);
+ Qpoly = intern ("poly");
+ staticpro (&Qpoly);
Qmessage_truncate_lines = intern ("message-truncate-lines");
staticpro (&Qmessage_truncate_lines);
Qcursor_in_non_selected_windows = intern ("cursor-in-non-selected-windows");
staticpro (&Qbox);
Qhollow = intern ("hollow");
staticpro (&Qhollow);
+ Qhand = intern ("hand");
+ staticpro (&Qhand);
+ Qarrow = intern ("arrow");
+ staticpro (&Qarrow);
+ Qtext = intern ("text");
+ staticpro (&Qtext);
Qrisky_local_variable = intern ("risky-local-variable");
staticpro (&Qrisky_local_variable);
Qinhibit_free_realized_faces = intern ("inhibit-free-realized-faces");
staticpro (&Qinhibit_free_realized_faces);
- list_of_error = Fcons (intern ("error"), Qnil);
+ list_of_error = Fcons (Fcons (intern ("error"),
+ Fcons (intern ("void-variable"), Qnil)),
+ Qnil);
staticpro (&list_of_error);
- last_arrow_position = Qnil;
- last_arrow_string = Qnil;
- staticpro (&last_arrow_position);
- staticpro (&last_arrow_string);
+ Qlast_arrow_position = intern ("last-arrow-position");
+ staticpro (&Qlast_arrow_position);
+ Qlast_arrow_string = intern ("last-arrow-string");
+ staticpro (&Qlast_arrow_string);
+
+ Qoverlay_arrow_string = intern ("overlay-arrow-string");
+ staticpro (&Qoverlay_arrow_string);
+ Qoverlay_arrow_bitmap = intern ("overlay-arrow-bitmap");
+ staticpro (&Qoverlay_arrow_bitmap);
echo_buffer[0] = echo_buffer[1] = Qnil;
staticpro (&echo_buffer[0]);
#endif
DEFVAR_LISP ("show-trailing-whitespace", &Vshow_trailing_whitespace,
- doc: /* Non-nil means highlight trailing whitespace.
+ doc: /* *Non-nil means highlight trailing whitespace.
The face used for trailing whitespace is `trailing-whitespace'. */);
Vshow_trailing_whitespace = Qnil;
+ DEFVAR_LISP ("void-text-area-pointer", &Vvoid_text_area_pointer,
+ doc: /* *The pointer shape to show in void text areas.
+Nil means to show the text pointer. Other options are `arrow', `text',
+`hand', `vdrag', `hdrag', `modeline', and `hourglass'. */);
+ Vvoid_text_area_pointer = Qarrow;
+
DEFVAR_LISP ("inhibit-redisplay", &Vinhibit_redisplay,
doc: /* Non-nil means don't actually do any redisplay.
This is used for internal purposes. */);
Voverlay_arrow_position = Qnil;
DEFVAR_LISP ("overlay-arrow-string", &Voverlay_arrow_string,
- doc: /* String to display as an arrow. See also `overlay-arrow-position'. */);
+ doc: /* String to display as an arrow in non-window frames.
+See also `overlay-arrow-position'. */);
Voverlay_arrow_string = Qnil;
+ DEFVAR_LISP ("overlay-arrow-variable-list", &Voverlay_arrow_variable_list,
+ doc: /* List of variables (symbols) which hold markers for overlay arrows.
+The symbols on this list are examined during redisplay to determine
+where to display overlay arrows. */);
+ Voverlay_arrow_variable_list
+ = Fcons (intern ("overlay-arrow-position"), Qnil);
+
DEFVAR_INT ("scroll-step", &scroll_step,
doc: /* *The number of lines to try scrolling a window by when point moves out.
If that fails to bring point back on frame, point is centered instead.
of the top or bottom of the window. */);
scroll_margin = 0;
+ DEFVAR_LISP ("display-pixels-per-inch", &Vdisplay_pixels_per_inch,
+ doc: /* Pixels per inch on current display.
+Value is a number or a cons (WIDTH-DPI . HEIGHT-DPI). */);
+ Vdisplay_pixels_per_inch = make_float (72.0);
+
#if GLYPH_DEBUG
DEFVAR_INT ("debug-end-pos", &debug_end_pos, doc: /* Don't ask. */);
#endif
This variable has the same structure as `mode-line-format' (which see),
and is used only on frames for which no explicit name has been set
\(see `modify-frame-parameters'). */);
+
DEFVAR_LISP ("icon-title-format", &Vicon_title_format,
doc: /* Template for displaying the title bar of an iconified frame.
\(Assuming the window manager supports this feature.)
struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (root_window)));
int i;
- XWINDOW (root_window)->top = make_number (FRAME_TOP_MARGIN (f));
+ XWINDOW (root_window)->top_line = make_number (FRAME_TOP_MARGIN (f));
set_window_height (root_window,
- FRAME_HEIGHT (f) - 1 - FRAME_TOP_MARGIN (f),
+ FRAME_LINES (f) - 1 - FRAME_TOP_MARGIN (f),
0);
- mini_w->top = make_number (FRAME_HEIGHT (f) - 1);
+ mini_w->top_line = make_number (FRAME_LINES (f) - 1);
set_window_height (minibuf_window, 1, 0);
- XWINDOW (root_window)->width = make_number (FRAME_WIDTH (f));
- mini_w->width = make_number (FRAME_WIDTH (f));
+ XWINDOW (root_window)->total_cols = make_number (FRAME_COLS (f));
+ mini_w->total_cols = make_number (FRAME_COLS (f));
scratch_glyph_row.glyphs[TEXT_AREA] = scratch_glyphs;
scratch_glyph_row.glyphs[TEXT_AREA + 1]
}
+/* arch-tag: eacc864d-bb6a-4b74-894a-1a4399a1358b
+ (do not change this comment) */