/* Updating of data structures for redisplay.
-Copyright (C) 1985-1988, 1993-1995, 1997-2013 Free Software Foundation,
+Copyright (C) 1985-1988, 1993-1995, 1997-2014 Free Software Foundation,
Inc.
This file is part of GNU Emacs.
static void mirror_line_dance (struct window *, int, int, int *, char *);
static bool update_window_tree (struct window *, bool);
static bool update_window (struct window *, bool);
-static bool update_frame_1 (struct frame *, bool, bool);
+static bool update_frame_1 (struct frame *, bool, bool, bool);
static bool scrolling (struct frame *);
static void set_window_cursor_after_update (struct window *);
static void adjust_frame_glyphs_for_window_redisplay (struct frame *);
w->window_end_valid = 0;
while (i < matrix->nrows)
- matrix->rows[i++].enabled_p = 0;
+ matrix->rows[i++].enabled_p = false;
}
else
{
for (i = 0; i < matrix->nrows; ++i)
- matrix->rows[i].enabled_p = 0;
+ matrix->rows[i].enabled_p = false;
}
}
else if (matrix == w->desired_matrix)
had better be the case when we adjust matrices between
redisplays. */
for (i = 0; i < matrix->nrows; ++i)
- matrix->rows[i].enabled_p = 0;
+ matrix->rows[i].enabled_p = false;
}
}
eassert (end >= 0 && end <= matrix->nrows);
for (; start < end; ++start)
- matrix->rows[start].enabled_p = 0;
+ matrix->rows[start].enabled_p = false;
}
if (row->y + row->height > max_y)
row->visible_height -= row->y + row->height - max_y;
- row->enabled_p = 1;
+ row->enabled_p = true;
}
bool rp = row->reversed_p;
clear_glyph_row (row);
- row->enabled_p = 1;
+ row->enabled_p = true;
row->reversed_p = rp;
}
}
w->left_col = 0;
w->pixel_top = 0;
w->top_line = 0;
- w->pixel_width = FRAME_PIXEL_WIDTH (f);
+ w->pixel_width = (FRAME_PIXEL_WIDTH (f)
+ - 2 * FRAME_INTERNAL_BORDER_WIDTH (f));
w->total_cols = FRAME_TOTAL_COLS (f);
w->pixel_height = FRAME_MENU_BAR_HEIGHT (f);
w->total_lines = FRAME_MENU_BAR_LINES (f);
/* Only when a desired row has been displayed, we want
the corresponding frame row to be updated. */
- frame_row->enabled_p = 1;
+ frame_row->enabled_p = true;
/* Maybe insert a vertical border between horizontally adjacent
windows. */
assign_row (current_row, desired_row);
/* Enable current_row to mark it as valid. */
- current_row->enabled_p = 1;
+ current_row->enabled_p = true;
current_row->mouse_face_p = mouse_face_p;
/* If we are called on frame matrices, perform analogous operations
assign_row (current_row, desired_row);
else
swap_glyph_pointers (desired_row, current_row);
- current_row->enabled_p = 1;
+ current_row->enabled_p = true;
/* Set the Y coordinate of the mode/header line's row.
It is needed in draw_row_with_mouse_face to find the
/* RETAINED_P is zero for empty lines. */
if (!retained_p[copy_from[i]])
- new_rows[i].enabled_p = 0;
+ new_rows[i].enabled_p = false;
}
/* Do the same for window matrices, if MATRIX is a frame matrix. */
/* If frame line is empty, window line is empty, too. */
if (!retained_p[copy_from[i]])
- m->rows[window_to].enabled_p = 0;
+ m->rows[window_to].enabled_p = false;
}
else if (to_inside_window_p)
{
/* If frame line is empty, window line is empty, too. */
if (!retained_p[copy_from[i]])
- m->rows[window_to].enabled_p = 0;
+ m->rows[window_to].enabled_p = false;
}
sync_p = 1;
}
/* Update the display */
update_begin (f);
- paused_p = update_frame_1 (f, force_p, inhibit_hairy_id_p);
+ paused_p = update_frame_1 (f, force_p, inhibit_hairy_id_p, 1);
update_end (f);
if (FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f))
glyphs. This is like the second part of update_frame, but it
doesn't call build_frame_matrix, because we already have the
desired matrix prepared, and don't want it to be overwritten by the
- text of the normal display. */
+ text of the normal display.
+
+ ROW and COL, if non-negative, are the row and column of the TTY
+ frame where to position the cursor after the frame update is
+ complete. Negative values mean ask update_frame_1 to position the
+ cursor "normally", i.e. at point in the selected window. */
void
-update_frame_with_menu (struct frame *f)
+update_frame_with_menu (struct frame *f, int row, int col)
{
struct window *root_window = XWINDOW (f->root_window);
- bool paused_p;
+ bool paused_p, cursor_at_point_p;
eassert (FRAME_TERMCAP_P (f));
/* Update the display. */
update_begin (f);
+ cursor_at_point_p = !(row >= 0 && col >= 0);
/* Force update_frame_1 not to stop due to pending input, and not
try scrolling. */
- paused_p = update_frame_1 (f, 1, 1);
+ paused_p = update_frame_1 (f, 1, 1, cursor_at_point_p);
+ /* ROW and COL tell us where in the menu to position the cursor, so
+ that screen readers know the active region on the screen. */
+ if (!cursor_at_point_p)
+ cursor_to (f, row, col);
update_end (f);
if (FRAME_TTY (f)->termscript)
check_window_matrix_pointers (root_window);
#endif
add_frame_display_history (f, paused_p);
-#else
- IF_LINT ((void) paused_p);
#endif
/* Reset flags indicating that a window should be updated. */
set_window_update_flags (root_window, false);
+ display_completed = !paused_p;
}
\f
in the first redisplay. */
if (MATRIX_ROW_BOTTOM_Y (row) >= yb)
for (i = vpos + 1; i < w->current_matrix->nrows - 1; ++i)
- MATRIX_ROW (w->current_matrix, i)->enabled_p = 0;
+ SET_MATRIX_ROW_ENABLED_P (w->current_matrix, i, false);
}
/* Was display preempted? */
&& row_equal_p (c, d, 1))
{
assign_row (c, d);
- d->enabled_p = 0;
+ d->enabled_p = false;
}
else
break;
}
/* Give up if some rows in the desired matrix are not enabled. */
- if (!MATRIX_ROW (desired_matrix, i)->enabled_p)
+ if (! MATRIX_ROW_ENABLED_P (desired_matrix, i))
return -1;
first_old = first_new = i;
{
int bottom;
- if (!MATRIX_ROW (desired_matrix, i)->enabled_p)
+ if (! MATRIX_ROW_ENABLED_P (desired_matrix, i))
return 0;
bottom = MATRIX_ROW_BOTTOM_Y (MATRIX_ROW (desired_matrix, i));
if (bottom <= yb)
j = last_old;
while (i - 1 > first_new
&& j - 1 > first_old
- && MATRIX_ROW (current_matrix, j - 1)->enabled_p
+ && MATRIX_ROW_ENABLED_P (current_matrix, j - 1)
&& (MATRIX_ROW (current_matrix, j - 1)->y
== MATRIX_ROW (desired_matrix, i - 1)->y)
&& !MATRIX_ROW (desired_matrix, i - 1)->redraw_fringe_bitmaps_p
for (i = first_old; i < last_old; ++i)
{
- if (MATRIX_ROW (current_matrix, i)->enabled_p)
+ if (MATRIX_ROW_ENABLED_P (current_matrix, i))
{
entry = add_row_entry (MATRIX_ROW (current_matrix, i));
old_lines[i] = entry;
preceding for-loop, we no longer have such an overlap,
and thus the assigned row should always be enabled. */
eassert (to->enabled_p);
- from->enabled_p = 0;
+ from->enabled_p = false;
to->overlapped_p = to_overlapped_p;
}
}
/* Update the desired frame matrix of frame F.
FORCE_P means that the update should not be stopped by pending input.
- INHIBIT_HAIRY_ID_P means that scrolling should not be tried.
+ INHIBIT_ID_P means that scrolling by insert/delete should not be tried.
+ SET_CURSOR_P false means do not set cursor at point in selected window.
Value is true if update was stopped due to pending input. */
static bool
-update_frame_1 (struct frame *f, bool force_p, bool inhibit_id_p)
+update_frame_1 (struct frame *f, bool force_p, bool inhibit_id_p,
+ bool set_cursor_p)
{
/* Frame matrices to work on. */
struct glyph_matrix *current_matrix = f->current_matrix;
pause_p = 0 < i && i < FRAME_LINES (f) - 1;
/* Now just clean up termcap drivers and set cursor, etc. */
- if (!pause_p)
+ if (!pause_p && set_cursor_p)
{
if ((cursor_in_echo_area
/* If we are showing a message instead of the mini-buffer,
olen--;
}
- current_row->enabled_p = 1;
+ current_row->enabled_p = true;
current_row->used[TEXT_AREA] = desired_row->used[TEXT_AREA];
/* If desired line is empty, just clear the line. */
bool pretend, bool delay, bool safe, bool pixelwise)
{
int new_text_width, new_text_height, new_root_width;
- int old_root_width = (FRAME_PIXEL_WIDTH (f)
- - 2 * FRAME_INTERNAL_BORDER_WIDTH (f));
+ int old_root_width = WINDOW_PIXEL_WIDTH (XWINDOW (FRAME_ROOT_WINDOW (f)));
int new_cols, new_lines;
ptrdiff_t count = SPECPDL_INDEX ();
{
new_text_width = (new_width == 0) ? FRAME_TEXT_WIDTH (f) : new_width;
new_text_height = (new_height == 0) ? FRAME_TEXT_HEIGHT (f) : new_height;
+ /* Consider rounding here: Currently, the root window can be
+ larger than the frame in terms of columns/lines. */
new_cols = new_text_width / FRAME_COLUMN_WIDTH (f);
new_lines = new_text_height / FRAME_LINE_HEIGHT (f);
}
fringe columns. Do this after rounding - see discussion of
bug#9723. */
new_root_width = (new_text_width
- /* PXM: Use the configured scrollbar width !?? */
+ FRAME_SCROLL_BAR_AREA_WIDTH (f)
+ FRAME_TOTAL_FRINGE_WIDTH (f));
/* If we're not changing the frame size, quit now. */
example, fullscreen and remove/add scroll bar. */
if (new_text_height == FRAME_TEXT_HEIGHT (f)
&& new_text_width == FRAME_TEXT_WIDTH (f)
- && new_root_width == old_root_width)
+ && new_root_width == old_root_width
+ && (FRAME_PIXEL_HEIGHT (f) ==
+ FRAME_TEXT_TO_PIXEL_HEIGHT (f, new_text_height))
+ && (FRAME_PIXEL_WIDTH (f) ==
+ FRAME_TEXT_TO_PIXEL_WIDTH (f, new_text_width)))
return;
block_input ();
/* MSDOS frames cannot PRETEND, as they change frame size by
manipulating video hardware. */
if ((FRAME_TERMCAP_P (f) && !pretend) || FRAME_MSDOS_P (f))
- FrameRows (FRAME_TTY (f)) = new_height;
+ FrameRows (FRAME_TTY (f)) = new_lines;
}
if (new_text_width != FRAME_TEXT_WIDTH (f)