summaryrefslogtreecommitdiff
path: root/src/window.h
diff options
context:
space:
mode:
authorMartin Rudalics <rudalics@gmx.at>2016-02-23 12:08:55 +0100
committerMartin Rudalics <rudalics@gmx.at>2016-02-23 12:08:55 +0100
commit8e7712c7afc47a8a861a9f4d6a10be1f78a2dac6 (patch)
tree46b7a58fae8aa09fc316cec8231697f84282a319 /src/window.h
parentef52e66efd78aac4c4e5bd5e11870e5ba3b37a1e (diff)
downloademacs-8e7712c7afc47a8a861a9f4d6a10be1f78a2dac6.tar.gz
emacs-8e7712c7afc47a8a861a9f4d6a10be1f78a2dac6.tar.bz2
emacs-8e7712c7afc47a8a861a9f4d6a10be1f78a2dac6.zip
Fix `window-configuration-change-hook' and `window-size-change-functions'
(1) Run `window-configuration-change-hook' if and only if at least one window was deleted or created or shows another buffer since last redisplay. (2) Run `window-size-change-functions' if and only if at least one window changed its size since last redisplay (in a few cases `window-size-change-functions' will also run when no window changed its size). (3) Provide two functions `window-pixel-height-before-size-change' and `window-pixel-width-before-size-change' that allow to easily detect which window changed size. * src/frame.h (struct frame): New boolean member window_configuration_changed. (FRAME_WINDOW_SIZES_CHANGED): Remove macro. (FRAME_WINDOW_CONFIGURATION_CHANGED): New macro. * src/frame.c (adjust_frame_size): Don't run `window-configuration-change-hook'. * src/window.h (struct window): New fields pixel_width_before_size_change and pixel_height_before_size_change. (WINDOW_INTERNAL_P): New macro. * src/window.c (Fwindow_pixel_width_before_size_change) (Fwindow_pixel_height_before_size_change): New functions. (Fdelete_other_windows_internal, Fwindow_resize_apply) (resize_frame_windows, Fsplit_window_internal) (Fdelete_window_internal, grow_mini_window) (shrink_mini_window, Fresize_mini_window_internal): Don't call FRAME_WINDOW_SIZES_CHANGED. (window_size_changed, window_set_before_size_change_sizes) (run_window_size_change_functions): New functions. (make_window): Initialize pixel_width_before_size_change and pixel_height_before_size_change. (Fdelete_window_internal): Don't call run_window_configuration_change_hook. (struct saved_window): Add pixel_height_before_size_change and pixel_width_before_size_change. (Fset_window_configuration): Try to identify window configuration changes correctly so run_window_configuration_change_hook and run_window_size_change_functions run only if configuration and size really changed. (save_window_save): Set the pixel_height_before_size_change and pixel_width_before_size_change fields. (Vwindow_size_change_functions): Move here definiton from xdisp.c. * src/xdisp.c (prepare_menu_bars, redisplay_internal): Call run_window_size_change_functions. (Vwindow_size_change_functions): Move definition to window.c. * src/xfns.c (x_set_menu_bar_lines): Don't call run_window_configuration_change_hook. * doc/lispref/windows.texi (Window Sizes): Document new functions `window-pixel-height-before-size-change' and `window-pixel-width-before-size-change'. (Window Configurations): Mention that this may trigger execution of `window-size-change-functions' although no window changed size. (Window Hooks): Update descriptions of `window-size-change-functions' and `window-configuration-change-hook'.
Diffstat (limited to 'src/window.h')
-rw-r--r--src/window.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/window.h b/src/window.h
index c29207d6356..a4d4dfe3ff4 100644
--- a/src/window.h
+++ b/src/window.h
@@ -214,6 +214,11 @@ 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 size of the window. */
int total_cols;
int total_lines;
@@ -499,15 +504,17 @@ wset_next_buffers (struct window *w, Lisp_Object val)
#define WINDOW_LEAF_P(W) \
(BUFFERP ((W)->contents))
-/* True if W is a member of horizontal combination. */
+/* Non-nil if W is internal. */
+#define WINDOW_INTERNAL_P(W) \
+ (WINDOWP ((W)->contents))
+/* True if W is a member of horizontal combination. */
#define WINDOW_HORIZONTAL_COMBINATION_P(W) \
- (WINDOWP ((W)->contents) && (W)->horizontal)
+ (WINDOW_INTERNAL_P (W) && (W)->horizontal)
/* True if W is a member of vertical combination. */
-
#define WINDOW_VERTICAL_COMBINATION_P(W) \
- (WINDOWP ((W)->contents) && !(W)->horizontal)
+ (WINDOW_INTERNAL_P (W) && !(W)->horizontal)
/* WINDOW's XFRAME. */
#define WINDOW_XFRAME(W) (XFRAME (WINDOW_FRAME ((W))))
@@ -1014,6 +1021,7 @@ extern void shrink_mini_window (struct window *, bool);
extern int window_relative_x_coord (struct window *, enum window_part, int);
void run_window_configuration_change_hook (struct frame *f);
+void run_window_size_change_functions (Lisp_Object);
/* 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. */