diff options
| author | Martin Rudalics | 2019-01-11 10:02:47 +0100 |
|---|---|---|
| committer | Martin Rudalics | 2019-01-11 10:02:47 +0100 |
| commit | e567ac149518967f992b1286d90d94df6bb589b7 (patch) | |
| tree | 32464d12a2b3fcc7ecf7e4cd5d6fc2d4ef7c729b /src/frame.c | |
| parent | 470082de55f7b1c1cde8aabbb5b8de55b4b08f83 (diff) | |
| download | emacs-e567ac149518967f992b1286d90d94df6bb589b7.tar.gz emacs-e567ac149518967f992b1286d90d94df6bb589b7.zip | |
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/frame.c')
| -rw-r--r-- | src/frame.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/frame.c b/src/frame.c index ca6704a44c0..6d93abd09bf 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -55,9 +55,11 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 55 | #endif | 55 | #endif |
| 56 | 56 | ||
| 57 | /* The currently selected frame. */ | 57 | /* The currently selected frame. */ |
| 58 | |||
| 59 | Lisp_Object selected_frame; | 58 | Lisp_Object selected_frame; |
| 60 | 59 | ||
| 60 | /* The selected frame the last time window change functions were run. */ | ||
| 61 | Lisp_Object old_selected_frame; | ||
| 62 | |||
| 61 | /* A frame which is not just a mini-buffer, or NULL if there are no such | 63 | /* A frame which is not just a mini-buffer, or NULL if there are no such |
| 62 | frames. This is usually the most recent such frame that was selected. */ | 64 | frames. This is usually the most recent such frame that was selected. */ |
| 63 | 65 | ||
| @@ -855,7 +857,8 @@ make_frame (bool mini_p) | |||
| 855 | f->ns_transparent_titlebar = false; | 857 | f->ns_transparent_titlebar = false; |
| 856 | #endif | 858 | #endif |
| 857 | #endif | 859 | #endif |
| 858 | 860 | /* This one should never be zero. */ | |
| 861 | f->change_stamp = 1; | ||
| 859 | root_window = make_window (); | 862 | root_window = make_window (); |
| 860 | rw = XWINDOW (root_window); | 863 | rw = XWINDOW (root_window); |
| 861 | if (mini_p) | 864 | if (mini_p) |
| @@ -1451,7 +1454,8 @@ This function returns FRAME, or nil if FRAME has been deleted. */) | |||
| 1451 | return do_switch_frame (frame, 1, 0, norecord); | 1454 | return do_switch_frame (frame, 1, 0, norecord); |
| 1452 | } | 1455 | } |
| 1453 | 1456 | ||
| 1454 | DEFUN ("handle-switch-frame", Fhandle_switch_frame, Shandle_switch_frame, 1, 1, "^e", | 1457 | DEFUN ("handle-switch-frame", Fhandle_switch_frame, |
| 1458 | Shandle_switch_frame, 1, 1, "^e", | ||
| 1455 | doc: /* Handle a switch-frame event EVENT. | 1459 | doc: /* Handle a switch-frame event EVENT. |
| 1456 | Switch-frame events are usually bound to this function. | 1460 | Switch-frame events are usually bound to this function. |
| 1457 | A switch-frame event is an event Emacs sends itself to | 1461 | A switch-frame event is an event Emacs sends itself to |
| @@ -1471,6 +1475,18 @@ DEFUN ("selected-frame", Fselected_frame, Sselected_frame, 0, 0, 0, | |||
| 1471 | { | 1475 | { |
| 1472 | return selected_frame; | 1476 | return selected_frame; |
| 1473 | } | 1477 | } |
| 1478 | |||
| 1479 | DEFUN ("old-selected-frame", Fold_selected_frame, | ||
| 1480 | Sold_selected_frame, 0, 0, 0, | ||
| 1481 | doc: /* Return the old selected FRAME. | ||
| 1482 | FRAME must be a live frame and defaults to the selected one. | ||
| 1483 | |||
| 1484 | The return value is the frame selected the last time window change | ||
| 1485 | functions were run. */) | ||
| 1486 | (void) | ||
| 1487 | { | ||
| 1488 | return old_selected_frame; | ||
| 1489 | } | ||
| 1474 | 1490 | ||
| 1475 | DEFUN ("frame-list", Fframe_list, Sframe_list, | 1491 | DEFUN ("frame-list", Fframe_list, Sframe_list, |
| 1476 | 0, 0, 0, | 1492 | 0, 0, 0, |
| @@ -6098,9 +6114,10 @@ iconify the top level frame instead. */); | |||
| 6098 | defsubr (&Swindow_system); | 6114 | defsubr (&Swindow_system); |
| 6099 | defsubr (&Sframe_windows_min_size); | 6115 | defsubr (&Sframe_windows_min_size); |
| 6100 | defsubr (&Smake_terminal_frame); | 6116 | defsubr (&Smake_terminal_frame); |
| 6101 | defsubr (&Shandle_switch_frame); | ||
| 6102 | defsubr (&Sselect_frame); | 6117 | defsubr (&Sselect_frame); |
| 6118 | defsubr (&Shandle_switch_frame); | ||
| 6103 | defsubr (&Sselected_frame); | 6119 | defsubr (&Sselected_frame); |
| 6120 | defsubr (&Sold_selected_frame); | ||
| 6104 | defsubr (&Sframe_list); | 6121 | defsubr (&Sframe_list); |
| 6105 | defsubr (&Sframe_parent); | 6122 | defsubr (&Sframe_parent); |
| 6106 | defsubr (&Sframe_ancestor_p); | 6123 | defsubr (&Sframe_ancestor_p); |