/* Window creation, deletion and examination for GNU Emacs.
Does not include redisplay.
- Copyright (C) 1985-1987, 1993-1998, 2000-2014 Free Software
+ Copyright (C) 1985-1987, 1993-1998, 2000-2015 Free Software
Foundation, Inc.
This file is part of GNU Emacs.
return call5 (Qwindow_resize_root_window, window, delta, horizontal, ignore, pixelwise);
}
+/* Placeholder used by temacs -nw before window.el is loaded. */
+DEFUN ("window--sanitize-window-sizes", Fwindow__sanitize_window_sizes,
+ Swindow__sanitize_window_sizes, 2, 2, 0,
+ doc: /* */)
+ (Lisp_Object frame, Lisp_Object horizontal)
+{
+ return Qnil;
+}
Lisp_Object
sanitize_window_sizes (Lisp_Object frame, Lisp_Object horizontal)
= Fdefault_value (Qwindow_configuration_change_hook);
XSETFRAME (frame, f);
- if (NILP (Vrun_hooks) || !(f->official))
+ if (NILP (Vrun_hooks)
+ || !(f->can_x_set_window_size)
+ || !(f->can_run_window_configuration_change_hook))
return;
/* Use the right buffer. Matters when running the local hooks. */
/* Resize frame F's windows when number of lines of F is set to SIZE.
HORFLAG 1 means resize windows when number of columns of F is set to
- SIZE. PIXELWISE 1 means to interpret SIZE as pixels.
-
- This function can delete all windows but the selected one in order to
- satisfy the request. The result will be meaningful if and only if
- F's windows have meaningful sizes when you call this. */
+ SIZE. PIXELWISE 1 means to interpret SIZE as pixels. */
void
resize_frame_windows (struct frame *f, int size, bool horflag, bool pixelwise)
{
static void
window_scroll (Lisp_Object window, EMACS_INT n, bool whole, int noerror)
{
+ ptrdiff_t count = SPECPDL_INDEX ();
+
immediate_quit = 1;
n = clip_to_bounds (INT_MIN, n, INT_MAX);
wset_redisplay (XWINDOW (window));
+ if (whole && Vfast_but_imprecise_scrolling)
+ specbind (Qfontification_functions, Qnil);
+
/* If we must, use the pixel-based version which is much slower than
the line-based one but can handle varying line heights. */
if (FRAME_WINDOW_P (XFRAME (XWINDOW (window)->frame)))
else
window_scroll_line_based (window, n, whole, noerror);
+ unbind_to (count, Qnil);
+
/* Bug#15957. */
XWINDOW (window)->window_end_valid = 0;
immediate_quit = 0;
/* The function move_iterator_vertically may move over more than
the specified y-distance. If it->w is small, e.g. a
mini-buffer window, we may end up in front of the window's
- display area. This is the case when Start displaying at the
- start of the line containing PT in this case. */
+ display area. Start displaying at the start of the line
+ containing PT in this case. */
if (it.current_y <= 0)
{
init_iterator (&it, w, PT, PT_BYTE, NULL, DEFAULT_FACE_ID);
{
int px;
int dy = frame_line_height;
+ /* In the below we divide the window box height by the
+ frame's line height to make the result predictable when
+ the window box is not an integral multiple of the line
+ height. This is important to ensure we get back to the
+ same position when scrolling up, then down. */
if (whole)
- dy = max ((window_box_height (w)
- - next_screen_context_lines * dy),
+ dy = max ((window_box_height (w) / dy
+ - next_screen_context_lines) * dy,
dy);
dy *= n;
{
ptrdiff_t start_pos = IT_CHARPOS (it);
int dy = frame_line_height;
-
- dy = max ((window_box_height (w)
- - next_screen_context_lines * dy),
+ /* In the below we divide the window box height by the frame's
+ line height to make the result predictable when the window
+ box is not an integral multiple of the line height. This is
+ important to ensure we get back to the same position when
+ scrolling up, then down. */
+ dy = max ((window_box_height (w) / dy - next_screen_context_lines) * dy,
dy) * n;
/* Note that move_it_vertically always moves the iterator to the
call1 (Qrecord_window_buffer, window);
}
- /* Consider frame unofficial, temporarily. */
- f->official = false;
+ /* Disallow x_set_window_size, temporarily. */
+ f->can_x_set_window_size = false;
/* The mouse highlighting code could get screwed up
if it runs during this. */
block_input ();
++n;
}
- /* Make frame official again and apply frame size changes if
+ /* Allow x_set_window_size again and apply frame size changes if
needed. */
- f->official = true;
- adjust_frame_size (f, -1, -1, 1, 0);
+ f->can_x_set_window_size = true;
+ adjust_frame_size (f, -1, -1, 1, 0, Qnil);
adjust_frame_glyphs (f);
unblock_input ();
doc: /* Set width and type of scroll bars of window WINDOW.
WINDOW must be a live window and defaults to the selected one.
-Second parameter WIDTH specifies the pixel width for the scroll bar.
+Second parameter WIDTH specifies the pixel width for the vertical scroll
+bar. If WIDTH is nil, use the scroll-bar width of WINDOW's frame.
Third parameter VERTICAL-TYPE specifies the type of the vertical scroll
-bar: left, right, or nil. If WIDTH is nil, use the frame's scroll-bar
-width. If VERTICAL-TYPE is t, use the frame's scroll-bar type.
+bar: left, right, or nil. If VERTICAL-TYPE is t, this means use the
+frame's scroll-bar type.
-Fourth parameter HEIGHT specifies the pixel height for the scroll bar.
-Fifth parameter HORIZONTAL-TYPE specifies the type of the vertical
-scroll bar: nil, bottom, or t. If HEIGHT is nil, use the frame's
-scroll-bar height. If HORIZONTAL-TYPE is t, use the frame's scroll-bar
-type.
+Fourth parameter HEIGHT specifies the pixel height for the horizontal
+scroll bar. If HEIGHT is nil, use the scroll-bar height of WINDOW's
+frame. Fifth parameter HORIZONTAL-TYPE specifies the type of the
+horizontal scroll bar: nil, bottom, or t. If HORIZONTAL-TYPE is t, this
+means to use the frame's horizontal scroll-bar type.
Return t if scroll bars were actually changed and nil otherwise. */)
(Lisp_Object window, Lisp_Object width, Lisp_Object vertical_type,
doc: /* Get width and type of scroll bars of window WINDOW.
WINDOW must be a live window and defaults to the selected one.
-Value is a list of the form (WIDTH COLS VERTICAL-TYPE HEIGHT LINES
-HORIZONTAL-TYPE). If WIDTH or HEIGHT is nil or TYPE is t, the window is
-using the frame's corresponding value. */)
+Value is a list of the form (WIDTH COLUMNS VERTICAL-TYPE HEIGHT LINES
+HORIZONTAL-TYPE). If WIDTH or HEIGHT is nil or VERTICAL-TYPE or
+HORIZONTAL-TYPE is t, the window is using the frame's corresponding
+value. */)
(Lisp_Object window)
{
struct window *w = decode_live_window (window);
- return Fcons (make_number (WINDOW_SCROLL_BAR_AREA_WIDTH (w)),
+ return Fcons (((w->scroll_bar_width >= 0)
+ ? make_number (w->scroll_bar_width)
+ : Qnil),
list5 (make_number (WINDOW_SCROLL_BAR_COLS (w)),
w->vertical_scroll_bar_type,
- make_number (WINDOW_SCROLL_BAR_AREA_HEIGHT (w)),
+ ((w->scroll_bar_height >= 0)
+ ? make_number (w->scroll_bar_height)
+ : Qnil),
make_number (WINDOW_SCROLL_BAR_LINES (w)),
w->horizontal_scroll_bar_type));
}
doc: /* Non-nil means to use `mode-line-inactive' face in non-selected windows.
If the minibuffer is active, the `minibuffer-scroll-window' mode line
is displayed in the `mode-line' face. */);
- mode_line_in_non_selected_windows = 1;
+ mode_line_in_non_selected_windows = true;
DEFVAR_LISP ("other-window-scroll-buffer", Vother_window_scroll_buffer,
doc: /* If this is a live buffer, \\[scroll-other-window] should scroll its window. */);
DEFVAR_BOOL ("auto-window-vscroll", auto_window_vscroll_p,
doc: /* Non-nil means to automatically adjust `window-vscroll' to view tall lines. */);
- auto_window_vscroll_p = 1;
+ auto_window_vscroll_p = true;
DEFVAR_INT ("next-screen-context-lines", next_screen_context_lines,
doc: /* Number of lines of continuity when scrolling by screenfuls. */);
Note that when a frame's pixel size is not a multiple of the
frame's character size, at least one window may get resized
pixelwise even if this option is nil. */);
- window_resize_pixelwise = 0;
+ window_resize_pixelwise = false;
+
+ DEFVAR_BOOL ("fast-but-imprecise-scrolling",
+ Vfast_but_imprecise_scrolling,
+ doc: /* When non-nil, accelerate scrolling operations.
+This comes into play when scrolling rapidly over previously
+unfontified buffer regions. Only those portions of the buffer which
+are actually going to be displayed get fontified.
+
+Note that this optimization can cause the portion of the buffer
+displayed after a scrolling operation to be somewhat inaccurate. */);
+ Vfast_but_imprecise_scrolling = false;
defsubr (&Sselected_window);
defsubr (&Sminibuffer_window);
defsubr (&Sset_window_display_table);
defsubr (&Snext_window);
defsubr (&Sprevious_window);
+ defsubr (&Swindow__sanitize_window_sizes);
defsubr (&Sget_buffer_window);
defsubr (&Sdelete_other_windows_internal);
defsubr (&Sdelete_window_internal);