summaryrefslogtreecommitdiff
path: root/src/dispnew.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/dispnew.c')
-rw-r--r--src/dispnew.c167
1 files changed, 102 insertions, 65 deletions
diff --git a/src/dispnew.c b/src/dispnew.c
index e603c671363..0c313199173 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -473,6 +473,10 @@ adjust_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int x, int y
= row->glyphs[LEFT_MARGIN_AREA] + left;
row->glyphs[RIGHT_MARGIN_AREA]
= row->glyphs[TEXT_AREA] + dim.width - left - right;
+ /* Leave room for a border glyph. */
+ if (!FRAME_WINDOW_P (XFRAME (w->frame))
+ && !WINDOW_RIGHTMOST_P (w))
+ row->glyphs[RIGHT_MARGIN_AREA] -= 1;
row->glyphs[LAST_AREA]
= row->glyphs[LEFT_MARGIN_AREA] + dim.width;
}
@@ -1140,7 +1144,13 @@ prepare_desired_row (struct window *w, struct glyph_row *row, bool mode_line_p)
row->glyphs[TEXT_AREA] = row->glyphs[LEFT_MARGIN_AREA] + left;
if (w->right_margin_cols > 0
&& (right != row->glyphs[LAST_AREA] - row->glyphs[RIGHT_MARGIN_AREA]))
- row->glyphs[RIGHT_MARGIN_AREA] = row->glyphs[LAST_AREA] - right;
+ {
+ row->glyphs[RIGHT_MARGIN_AREA] = row->glyphs[LAST_AREA] - right;
+ /* Leave room for a border glyph. */
+ if (!FRAME_WINDOW_P (XFRAME (w->frame))
+ && !WINDOW_RIGHTMOST_P (w))
+ row->glyphs[RIGHT_MARGIN_AREA] -= 1;
+ }
}
}
@@ -3328,7 +3338,7 @@ update_frame_with_menu (struct frame *f, int row, int col)
}
/* Update the mouse position for a frame F. This handles both
- updating the display for mouse-face propreties and updating the
+ updating the display for mouse-face properties and updating the
help echo text.
Returns the number of events generated. */
@@ -3588,6 +3598,7 @@ update_window (struct window *w, bool force_p)
int yb;
bool changed_p = 0, mouse_face_overwritten_p = 0;
int n_updated = 0;
+ bool invisible_rows_marked = false;
#ifdef HAVE_WINDOW_SYSTEM
gui_update_window_begin (w);
@@ -3679,13 +3690,36 @@ update_window (struct window *w, bool force_p)
tempted to optimize redisplay based on lines displayed
in the first redisplay. */
if (MATRIX_ROW_BOTTOM_Y (row) >= yb)
- for (i = vpos + 1; i < w->current_matrix->nrows - 1; ++i)
- SET_MATRIX_ROW_ENABLED_P (w->current_matrix, i, false);
+ {
+ for (i = vpos + 1; i < w->current_matrix->nrows - 1; ++i)
+ SET_MATRIX_ROW_ENABLED_P (w->current_matrix, i, false);
+ invisible_rows_marked = true;
+ }
}
/* Was display preempted? */
paused_p = row < end;
+ if (!paused_p && !invisible_rows_marked)
+ {
+ /* If we didn't mark the invisible rows in the current
+ matrix as invalid above, do that now. This can happen if
+ scrolling_window updates the last visible rows of the
+ current matrix, in which case the above loop doesn't get
+ to examine the last visible row. */
+ int i;
+ for (i = 0; i < w->current_matrix->nrows - 1; ++i)
+ {
+ struct glyph_row *current_row = MATRIX_ROW (w->current_matrix, i);
+ if (current_row->enabled_p
+ && MATRIX_ROW_BOTTOM_Y (current_row) >= yb)
+ {
+ for (++i ; i < w->current_matrix->nrows - 1; ++i)
+ SET_MATRIX_ROW_ENABLED_P (w->current_matrix, i, false);
+ }
+ }
+ }
+
set_cursor:
/* Update the tab line after scrolling because a new tab
@@ -5746,32 +5780,34 @@ handle_window_change_signal (int sig)
termcap-controlled terminal, but we can't decide which.
Therefore, we resize the frames corresponding to each tty.
*/
- for (tty = tty_list; tty; tty = tty->next) {
+ for (tty = tty_list; tty; tty = tty->next)
+ {
+ if (! tty->term_initted)
+ continue;
- if (! tty->term_initted)
- continue;
+ /* Suspended tty frames have tty->input == NULL avoid trying to
+ use it. */
+ if (!tty->input)
+ continue;
- /* Suspended tty frames have tty->input == NULL avoid trying to
- use it. */
- if (!tty->input)
- continue;
+ get_tty_size (fileno (tty->input), &width, &height);
- get_tty_size (fileno (tty->input), &width, &height);
+ if (width > 5 && height > 2)
+ {
+ Lisp_Object tail, frame;
- if (width > 5 && height > 2) {
- Lisp_Object tail, frame;
+ FOR_EACH_FRAME (tail, frame)
+ {
+ struct frame *f = XFRAME (frame);
- FOR_EACH_FRAME (tail, frame)
- if (FRAME_TERMCAP_P (XFRAME (frame)) && FRAME_TTY (XFRAME (frame)) == tty)
- /* Record the new sizes, but don't reallocate the data
- structures now. Let that be done later outside of the
- signal handler. */
- change_frame_size (XFRAME (frame), width,
- height - FRAME_MENU_BAR_LINES (XFRAME (frame))
- - FRAME_TAB_BAR_LINES (XFRAME (frame)),
- 0, 1, 0, 0);
+ if (FRAME_TERMCAP_P (f) && FRAME_TTY (f) == tty)
+ /* Record the new sizes, but don't reallocate the data
+ structures now. Let that be done later outside of the
+ signal handler. */
+ change_frame_size (f, width, height, false, true, false);
+ }
+ }
}
- }
}
static void
@@ -5789,7 +5825,6 @@ deliver_window_change_signal (int sig)
void
do_pending_window_change (bool safe)
{
- /* If window change signal handler should have run before, run it now. */
if (redisplaying_p && !safe)
return;
@@ -5797,15 +5832,20 @@ do_pending_window_change (bool safe)
{
Lisp_Object tail, frame;
- delayed_size_change = 0;
+ delayed_size_change = false;
FOR_EACH_FRAME (tail, frame)
{
struct frame *f = XFRAME (frame);
- if (f->new_height != 0 || f->new_width != 0)
+ /* Negative new_width or new_height values mean no change is
+ required (a native size can never drop below zero). If
+ new_size_p is not set, this means the size change was
+ requested by adjust_frame_size but has not been honored by
+ the window manager yet. */
+ if (f->new_size_p && (f->new_height >= 0 || f->new_width >= 0))
change_frame_size (f, f->new_width, f->new_height,
- 0, 0, safe, f->new_pixelwise);
+ false, false, safe);
}
}
}
@@ -5813,47 +5853,46 @@ do_pending_window_change (bool safe)
static void
change_frame_size_1 (struct frame *f, int new_width, int new_height,
- bool pretend, bool delay, bool safe, bool pixelwise)
+ bool pretend, bool delay, bool safe)
{
- /* If we can't deal with the change now, queue it for later. */
if (delay || (redisplaying_p && !safe))
{
+ if (CONSP (frame_size_history)
+ && ((new_width != f->new_width
+ || new_height != f->new_height
+ || new_width != FRAME_PIXEL_WIDTH (f)
+ || new_height != FRAME_PIXEL_HEIGHT (f))))
+ frame_size_history_extra
+ (f, build_string ("change_frame_size_1, delayed"),
+ FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f),
+ new_width, new_height, f->new_width, f->new_height);
+
+ /* We can't deal with the change now, queue it for later. */
f->new_width = new_width;
f->new_height = new_height;
- f->new_pixelwise = pixelwise;
- delayed_size_change = 1;
+ f->new_size_p = true;
+ delayed_size_change = true;
}
else
{
- /* This size-change overrides any pending one for this frame. */
- f->new_height = 0;
- f->new_width = 0;
- f->new_pixelwise = 0;
-
- /* If an argument is zero, set it to the current value. */
- if (pixelwise)
- {
- new_width = (new_width <= 0) ? FRAME_TEXT_WIDTH (f) : new_width;
- new_height = (new_height <= 0) ? FRAME_TEXT_HEIGHT (f) : new_height;
- }
- else
- {
- new_width = (((new_width <= 0) ? FRAME_COLS (f) : new_width)
- * FRAME_COLUMN_WIDTH (f));
- new_height = (((new_height <= 0) ? FRAME_LINES (f) : new_height)
- * FRAME_LINE_HEIGHT (f));
- }
-
- /* Adjust frame size but make sure set_window_size_hook does not
- get called. */
- adjust_frame_size (f, new_width, new_height, 5, pretend,
- Qchange_frame_size);
+ /* Storing -1 in the new_width/new_height slots means that no size
+ change is pending. Native sizes are always non-negative.
+ Reset the new_size_p slot as well. */
+ f->new_height = -1;
+ f->new_width = -1;
+ f->new_size_p = false;
+ /* adjust_frame_size wants its arguments in terms of text_width
+ and text_height, so convert them here. For pathologically
+ small frames, the resulting values may be negative though. */
+ adjust_frame_size (f, FRAME_PIXEL_TO_TEXT_WIDTH (f, new_width),
+ FRAME_PIXEL_TO_TEXT_HEIGHT (f, new_height), 5,
+ pretend, Qchange_frame_size);
}
}
-/* Change text height/width of frame F. Values may be given as zero to
- indicate that no change is needed.
+/* Change native height/width of frame F to NEW_WIDTH/NEW_HEIGHT pixels.
+ Values may be given as -1 to indicate that no change is needed.
If DELAY, assume we're being called from a signal handler, and queue
the change for later - perhaps the next redisplay. Since this tries
@@ -5863,7 +5902,7 @@ change_frame_size_1 (struct frame *f, int new_width, int new_height,
change frame sizes while a redisplay is in progress. */
void
change_frame_size (struct frame *f, int new_width, int new_height,
- bool pretend, bool delay, bool safe, bool pixelwise)
+ bool pretend, bool delay, bool safe)
{
Lisp_Object tail, frame;
@@ -5873,13 +5912,12 @@ change_frame_size (struct frame *f, int new_width, int new_height,
size affects all frames. Termcap now supports multiple
ttys. */
FOR_EACH_FRAME (tail, frame)
- if (! FRAME_WINDOW_P (XFRAME (frame)))
+ if (!FRAME_WINDOW_P (XFRAME (frame)))
change_frame_size_1 (XFRAME (frame), new_width, new_height,
- pretend, delay, safe, pixelwise);
+ pretend, delay, safe);
}
else
- change_frame_size_1 (f, new_width, new_height, pretend, delay, safe,
- pixelwise);
+ change_frame_size_1 (f, new_width, new_height, pretend, delay, safe);
}
/***********************************************************************
@@ -6468,9 +6506,8 @@ init_display_interactive (void)
t->display_info.tty->top_frame = selected_frame;
change_frame_size (XFRAME (selected_frame),
FrameCols (t->display_info.tty),
- FrameRows (t->display_info.tty)
- - FRAME_MENU_BAR_LINES (f)
- - FRAME_TAB_BAR_LINES (f), 0, 0, 1, 0);
+ FrameRows (t->display_info.tty),
+ false, false, true);
/* Delete the initial terminal. */
if (--initial_terminal->reference_count == 0