Run `window-configuration-change-hook' only after all faces have been realized.

* frame.c (adjust_frame_size): Call x_set_window_size only if
f->can_x_set_window_size is set.
(make_frame): Initialize f->can_x_set_window_size and
f->can_run_window_configuration_change_hook.
(Fcan_run_window_configuration_change_hook): New function.
* frame.h (frame): Split `official' into `can_x_set_window_size'
and `can_run_window_configuration_change_hook'.
* nsfns.m (Fx_create_frame): Set f->can_x_set_window_size.
* w32fns.c (Fx_create_frame, x_create_tip_frame): Set
f->can_x_set_window_size.
* window.c (run_window_configuration_change_hook): Return
immediately if either f->can_x_set_window_size or
f->can_run_window_configuration_change_hook are false.
(Fset_window_configuration): Instead of f->official set
f->can_x_set_window_size.
* xfns.c (Fx_create_frame, x_create_tip_frame): Set
f->can_x_set_window_size.
* faces.el (face-set-after-frame-default): Enable running
`window-configuration-change-hook'.
This commit is contained in:
Martin Rudalics 2014-11-08 12:11:50 +01:00
parent a05fd1fc78
commit c936cbbc83
9 changed files with 71 additions and 20 deletions

View file

@ -1,3 +1,8 @@
2014-11-08 Martin Rudalics <rudalics@gmx.at>
* faces.el (face-set-after-frame-default): Enable running
`window-configuration-change-hook'.
2014-11-07 Juri Linkov <juri@jurta.org>
* replace.el: History for query replace pairs.

View file

@ -2092,7 +2092,8 @@ frame parameters in PARAMETERS."
(value (cdr (assq param-name parameters))))
(if value
(set-face-attribute (nth 1 param) frame
(nth 2 param) value))))))
(nth 2 param) value))))
(frame-can-run-window-configuration-change-hook frame t)))
(defun tty-handle-reverse-video (frame parameters)
"Handle the reverse-video frame parameter for terminal frames."

View file

@ -1,3 +1,23 @@
2014-11-08 Martin Rudalics <rudalics@gmx.at>
* frame.c (adjust_frame_size): Call x_set_window_size only if
f->can_x_set_window_size is set.
(make_frame): Initialize f->can_x_set_window_size and
f->can_run_window_configuration_change_hook.
(Fcan_run_window_configuration_change_hook): New function.
* frame.h (frame): Split `official' into `can_x_set_window_size'
and `can_run_window_configuration_change_hook'.
* nsfns.m (Fx_create_frame): Set f->can_x_set_window_size.
* w32fns.c (Fx_create_frame, x_create_tip_frame): Set
f->can_x_set_window_size.
* window.c (run_window_configuration_change_hook): Return
immediately if either f->can_x_set_window_size or
f->can_run_window_configuration_change_hook are false.
(Fset_window_configuration): Instead of f->official set
f->can_x_set_window_size.
* xfns.c (Fx_create_frame, x_create_tip_frame): Set
f->can_x_set_window_size.
2014-11-08 Jan Djärv <jan.h.d@swipnet.se>
* nsterm.m (EmacsScroller.dealloc): Reinstate, removed at merge

View file

@ -463,7 +463,7 @@ adjust_frame_size (struct frame *f, int new_width, int new_height, int inhibit,
#ifdef HAVE_WINDOW_SYSTEM
if (FRAME_WINDOW_P (f)
&& f->official
&& f->can_x_set_window_size
&& ((!inhibit_horizontal
&& (new_pixel_width != old_pixel_width
|| inhibit == 0 || inhibit == 2))
@ -608,7 +608,8 @@ make_frame (bool mini_p)
f->wants_modeline = true;
f->redisplay = true;
f->garbaged = true;
f->official = false;
f->can_x_set_window_size = false;
f->can_run_window_configuration_change_hook = false;
f->column_width = 1; /* !FRAME_WINDOW_P value. */
f->line_height = 1; /* !FRAME_WINDOW_P value. */
#ifdef HAVE_WINDOW_SYSTEM
@ -2259,6 +2260,25 @@ If there is no window system support, this function does nothing. */)
return Qnil;
}
DEFUN ("frame-can-run-window-configuration-change-hook",
Fcan_run_window_configuration_change_hook,
Scan_run_window_configuration_change_hook, 2, 2, 0,
doc: /* Whether `window-configuration-change-hook' is run for frame FRAME.
FRAME nil means use the selected frame. Second argument ALLOW non-nil
means functions on `window-configuration-change-hook' are called
whenever the window configuration of FRAME changes. ALLOW nil means
these functions are not called.
This function is currently called by `face-set-after-frame-default' only
and should be otherwise used with utter care to avoid that running
functions on `window-configuration-change-hook' is impeded forever. */)
(Lisp_Object frame, Lisp_Object allow)
{
struct frame *f = decode_live_frame (frame);
f->can_run_window_configuration_change_hook = NILP (allow) ? false : true;
}
/* Discard BUFFER from the buffer-list and buried-buffer-list of each frame. */
@ -5083,6 +5103,7 @@ even if this option is non-nil. */);
defsubr (&Sraise_frame);
defsubr (&Slower_frame);
defsubr (&Sx_focus_frame);
defsubr (&Scan_run_window_configuration_change_hook);
defsubr (&Sredirect_frame_focus);
defsubr (&Sframe_focus);
defsubr (&Sframe_parameters);

View file

@ -328,11 +328,13 @@ struct frame
in pixels. */
bool_bf new_pixelwise : 1;
/* True if frame has been added to Vframe_list and is henceforth
considered official. For in-official frames we neither process
x_set_window_size requests nor do we allow running
window-configuration-change-hook when resizing windows. */
bool_bf official : 1;
/* True means x_set_window_size requests can be processed for this
frame. */
bool_bf can_x_set_window_size : 1;
/* True means run_window_configuration_change_hook can be processed
for this frame. */
bool_bf can_run_window_configuration_change_hook : 1;
/* Bitfield area ends here. */

View file

@ -1346,8 +1346,8 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
x_default_parameter (f, parms, Qfullscreen, Qnil,
"fullscreen", "Fullscreen", RES_TYPE_SYMBOL);
/* Consider frame official, now. */
f->official = true;
/* Allow x_set_window_size, now. */
f->can_x_set_window_size = true;
adjust_frame_size (f, FRAME_TEXT_WIDTH (f), FRAME_TEXT_HEIGHT (f), 0, 1, Qnil);

View file

@ -4703,8 +4703,8 @@ This function is an internal primitive--use `make-frame' instead. */)
x_default_parameter (f, parameters, Qscroll_bar_height, Qnil,
"scrollBarHeight", "ScrollBarHeight", RES_TYPE_NUMBER);
/* Consider frame official, now. */
f->official = true;
/* Allow x_set_window_size, now. */
f->can_x_set_window_size = true;
adjust_frame_size (f, FRAME_TEXT_WIDTH (f), FRAME_TEXT_HEIGHT (f), 0, 1, Qnil);
@ -5851,7 +5851,7 @@ x_create_tip_frame (struct w32_display_info *dpyinfo,
below. And the frame needs to be on Vframe_list or making it
visible won't work. */
Vframe_list = Fcons (frame, Vframe_list);
f->official = true;
f->can_x_set_window_size = true;
/* Setting attributes of faces of the tooltip frame from resources
and similar will increment face_change_count, which leads to the

View file

@ -3337,7 +3337,9 @@ run_window_configuration_change_hook (struct frame *f)
= 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. */
@ -6204,8 +6206,8 @@ the return value is nil. Otherwise the value is t. */)
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 ();
@ -6414,9 +6416,9 @@ the return value is nil. Otherwise the value is t. */)
++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;
f->can_x_set_window_size = true;
adjust_frame_size (f, -1, -1, 1, 0, Qnil);
adjust_frame_glyphs (f);

View file

@ -3248,7 +3248,7 @@ This function is an internal primitive--use `make-frame' instead. */)
"alpha", "Alpha", RES_TYPE_NUMBER);
/* Consider frame official, now. */
f->official = true;
f->can_x_set_window_size = true;
adjust_frame_size (f, FRAME_TEXT_WIDTH (f), FRAME_TEXT_HEIGHT (f), 0, 1, Qnil);
@ -5233,7 +5233,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
below. And the frame needs to be on Vframe_list or making it
visible won't work. */
Vframe_list = Fcons (frame, Vframe_list);
f->official = true;
f->can_x_set_window_size = true;
/* Setting attributes of faces of the tooltip frame from resources
and similar will increment face_change_count, which leads to the