summaryrefslogtreecommitdiff
path: root/src/window.h
diff options
context:
space:
mode:
authorMartin Rudalics <rudalics@gmx.at>2019-01-11 10:02:47 +0100
committerMartin Rudalics <rudalics@gmx.at>2019-01-11 10:02:47 +0100
commite567ac149518967f992b1286d90d94df6bb589b7 (patch)
tree32464d12a2b3fcc7ecf7e4cd5d6fc2d4ef7c729b /src/window.h
parent470082de55f7b1c1cde8aabbb5b8de55b4b08f83 (diff)
downloademacs-e567ac149518967f992b1286d90d94df6bb589b7.tar.gz
Run window change functions during redisplay
* doc/lispref/windows.texi (Window Sizes): Move (and rename) descriptions of 'window-pixel-height-before-size-change' and 'window-pixel-width-before-size-change' to Window Hooks section. (Window Configurations): Remove warning against use of 'save-window-excursion' in 'window-size-change-functions'. (Window Hooks): Rewrite section according to redesign of window change functions. * lisp/erc/erc-track.el (erc-window-configuration-change) (erc-modified-channels-update): Call latter directly from 'window-configuration-change-hook' instead via 'post-command-hook'. * lisp/frame.el (frame-size-changed-p): Change nomenclature in let bindings. * lisp/net/rcirc.el (rcirc-window-configuration-change) (rcirc-window-configuration-change-1): Call latter directly from 'window-configuration-change-hook' instead via 'post-command-hook'. * lisp/window.el (window-pixel-width-before-size-change) (window-pixel-height-before-size-change): Defalias. (window--resize-mini-window, window-resize) (adjust-window-trailing-edge, delete-window) (delete-other-windows, balance-windows): Don't run 'window-configuration-change-hook' any more from here. (split-window): Don't run 'window-configuration-change-hook' from here. 'run-window-scroll-functions' from here. (window--adjust-process-windows): Run from 'window-configuration-change-hook' only. * src/frame.c (old_selected_frame): New Lisp variable. (make_frame): Initialize frame's change_stamp slot. (Fold_selected_frame): New function. * src/frame.h (struct frame): New slots old_selected_window, window_change, change_stamp and number_of_windows. (fset_old_selected_window): New inlined function. (FRAME_WINDOW_CHANGE, FRAME_OLD_SELECTED_WINDOW): New macros. * src/window.c (old_selected_window): New Lisp variable. (wset_old_buffer): New inlined function. (Fframe_old_selected_window, Fold_selected_window) (Fwindow_old_buffer): New functions. (Fwindow_old_pixel_width, Fwindow_old_pixel_height): Rename from Fwindow_pixel_width_before_size_change and Fwindow_pixel_height_before_size_change. Update doc-strings. (Fwindow_old_body_pixel_width, Fwindow_old_body_pixel_height): New functions. (Fdelete_other_windows_internal): Set frame's window_change slot instead of running 'window-configuration-change-hook'. (Frun_window_configuration_change_hook): In doc-string tell that this function is no more needed. (Frun_window_scroll_functions): Amend doc-string. Run with window's buffer current. (window_sub_list, window_change_record_windows) (window_change_record_frame, window_change_record) (run_window_change_functions_1, run_window_change_functions): New functions. (set_window_buffer): Set frame's window_change slot instead of running 'window-configuration-change-hook'. (make_window): Don't initialize pixel_width_before_size_change and pixel_height_before_size_change slots. (window_resize_apply, Fdelete_window_internal): Set frame's window_change slot. (Fsplit_window_internal): Set frame's window_change slot. Don't run 'window-scroll-functions' from here. * src/window.h (struct window): New slots old_buffer, change_stamp, old_pixel_width (renamed from pixel_width_before_size_change), old_pixel_height (renamed from pixel_height_before_size_change), old_body_pixel_width and old_body_pixel_height. * src/xdisp.c (init_iterator): Set frame's window_change slot when the body height or width changes. (prepare_menu_bars): Don't run_window_size_change_functions. (redisplay_internal): Don't run_window_size_change_functions, run_window_change_functions instead.
Diffstat (limited to 'src/window.h')
-rw-r--r--src/window.h27
1 files changed, 22 insertions, 5 deletions
diff --git a/src/window.h b/src/window.h
index ee6ec3bb19a..9c4aea85ea6 100644
--- a/src/window.h
+++ b/src/window.h
@@ -142,6 +142,11 @@ struct window
as well. */
Lisp_Object contents;
+ /* The old buffer of this window, set to this window's buffer by
+ run_window_change_functions every time it sees this window.
+ Unused for internal windows. */
+ Lisp_Object old_buffer;
+
/* A marker pointing to where in the text to start displaying.
BIDI Note: This is the _logical-order_ start, i.e. the smallest
buffer position visible in the window, not necessarily the
@@ -229,6 +234,14 @@ struct window
/* Unique number of window assigned when it was created. */
EMACS_INT sequence_number;
+ /* The change stamp of this window. Set to 0 when the window is
+ created, it is set to its frame's change stamp every time
+ run_window_change_functions is run on that frame with this
+ window live. It is left alone when the window exists only
+ within a window configuration. Not useful for internal
+ windows. */
+ int change_stamp;
+
/* The upper left corner pixel coordinates of this window, as
integers relative to upper left corner of frame = 0, 0. */
int pixel_left;
@@ -243,10 +256,13 @@ struct window
int pixel_width;
int pixel_height;
- /* The pixel sizes of the window at the last time
- `window-size-change-functions' was run. */
- int pixel_width_before_size_change;
- int pixel_height_before_size_change;
+ /* The pixel and pixel body sizes of the window at the last time
+ run_window_change_functions was run with this window live. Not
+ useful for internal windows. */
+ int old_pixel_width;
+ int old_pixel_height;
+ int old_body_pixel_width;
+ int old_body_pixel_height;
/* The size of the window. */
int total_cols;
@@ -1023,6 +1039,7 @@ wset_next_buffers (struct window *w, Lisp_Object val)
This value is always the same as FRAME_SELECTED_WINDOW (selected_frame). */
extern Lisp_Object selected_window;
+extern Lisp_Object old_selected_window;
/* This is a time stamp for window selection, so we can find the least
recently used window. Its only users are Fselect_window,
@@ -1051,7 +1068,7 @@ extern void grow_mini_window (struct window *, int, bool);
extern void shrink_mini_window (struct window *, bool);
extern int window_relative_x_coord (struct window *, enum window_part, int);
-void run_window_size_change_functions (Lisp_Object);
+void run_window_change_functions (void);
/* Make WINDOW display BUFFER. RUN_HOOKS_P means it's allowed
to run hooks. See make_frame for a case where it's not allowed. */