diff options
| author | Martin Rudalics | 2014-11-08 12:11:50 +0100 |
|---|---|---|
| committer | Martin Rudalics | 2014-11-08 12:11:50 +0100 |
| commit | c936cbbc830b194dbb1cd7ff039ea9978a7ab607 (patch) | |
| tree | 34398222a4e29fda5c2e26844b54ad7eea3d6351 | |
| parent | a05fd1fc7813611575cad6890a45b5fd7eba8e67 (diff) | |
| download | emacs-c936cbbc830b194dbb1cd7ff039ea9978a7ab607.tar.gz emacs-c936cbbc830b194dbb1cd7ff039ea9978a7ab607.zip | |
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'.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/faces.el | 3 | ||||
| -rw-r--r-- | src/ChangeLog | 20 | ||||
| -rw-r--r-- | src/frame.c | 25 | ||||
| -rw-r--r-- | src/frame.h | 12 | ||||
| -rw-r--r-- | src/nsfns.m | 4 | ||||
| -rw-r--r-- | src/w32fns.c | 6 | ||||
| -rw-r--r-- | src/window.c | 12 | ||||
| -rw-r--r-- | src/xfns.c | 4 |
9 files changed, 71 insertions, 20 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 52d8a5b6051..dae450a2776 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2014-11-08 Martin Rudalics <rudalics@gmx.at> | ||
| 2 | |||
| 3 | * faces.el (face-set-after-frame-default): Enable running | ||
| 4 | `window-configuration-change-hook'. | ||
| 5 | |||
| 1 | 2014-11-07 Juri Linkov <juri@jurta.org> | 6 | 2014-11-07 Juri Linkov <juri@jurta.org> |
| 2 | 7 | ||
| 3 | * replace.el: History for query replace pairs. | 8 | * replace.el: History for query replace pairs. |
diff --git a/lisp/faces.el b/lisp/faces.el index d7b330ee64c..1d4fc9c5570 100644 --- a/lisp/faces.el +++ b/lisp/faces.el | |||
| @@ -2092,7 +2092,8 @@ frame parameters in PARAMETERS." | |||
| 2092 | (value (cdr (assq param-name parameters)))) | 2092 | (value (cdr (assq param-name parameters)))) |
| 2093 | (if value | 2093 | (if value |
| 2094 | (set-face-attribute (nth 1 param) frame | 2094 | (set-face-attribute (nth 1 param) frame |
| 2095 | (nth 2 param) value)))))) | 2095 | (nth 2 param) value)))) |
| 2096 | (frame-can-run-window-configuration-change-hook frame t))) | ||
| 2096 | 2097 | ||
| 2097 | (defun tty-handle-reverse-video (frame parameters) | 2098 | (defun tty-handle-reverse-video (frame parameters) |
| 2098 | "Handle the reverse-video frame parameter for terminal frames." | 2099 | "Handle the reverse-video frame parameter for terminal frames." |
diff --git a/src/ChangeLog b/src/ChangeLog index 4700e314a16..f8ed3b36dde 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,23 @@ | |||
| 1 | 2014-11-08 Martin Rudalics <rudalics@gmx.at> | ||
| 2 | |||
| 3 | * frame.c (adjust_frame_size): Call x_set_window_size only if | ||
| 4 | f->can_x_set_window_size is set. | ||
| 5 | (make_frame): Initialize f->can_x_set_window_size and | ||
| 6 | f->can_run_window_configuration_change_hook. | ||
| 7 | (Fcan_run_window_configuration_change_hook): New function. | ||
| 8 | * frame.h (frame): Split `official' into `can_x_set_window_size' | ||
| 9 | and `can_run_window_configuration_change_hook'. | ||
| 10 | * nsfns.m (Fx_create_frame): Set f->can_x_set_window_size. | ||
| 11 | * w32fns.c (Fx_create_frame, x_create_tip_frame): Set | ||
| 12 | f->can_x_set_window_size. | ||
| 13 | * window.c (run_window_configuration_change_hook): Return | ||
| 14 | immediately if either f->can_x_set_window_size or | ||
| 15 | f->can_run_window_configuration_change_hook are false. | ||
| 16 | (Fset_window_configuration): Instead of f->official set | ||
| 17 | f->can_x_set_window_size. | ||
| 18 | * xfns.c (Fx_create_frame, x_create_tip_frame): Set | ||
| 19 | f->can_x_set_window_size. | ||
| 20 | |||
| 1 | 2014-11-08 Jan Djärv <jan.h.d@swipnet.se> | 21 | 2014-11-08 Jan Djärv <jan.h.d@swipnet.se> |
| 2 | 22 | ||
| 3 | * nsterm.m (EmacsScroller.dealloc): Reinstate, removed at merge | 23 | * nsterm.m (EmacsScroller.dealloc): Reinstate, removed at merge |
diff --git a/src/frame.c b/src/frame.c index b03e207c105..c68195caba2 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -463,7 +463,7 @@ adjust_frame_size (struct frame *f, int new_width, int new_height, int inhibit, | |||
| 463 | 463 | ||
| 464 | #ifdef HAVE_WINDOW_SYSTEM | 464 | #ifdef HAVE_WINDOW_SYSTEM |
| 465 | if (FRAME_WINDOW_P (f) | 465 | if (FRAME_WINDOW_P (f) |
| 466 | && f->official | 466 | && f->can_x_set_window_size |
| 467 | && ((!inhibit_horizontal | 467 | && ((!inhibit_horizontal |
| 468 | && (new_pixel_width != old_pixel_width | 468 | && (new_pixel_width != old_pixel_width |
| 469 | || inhibit == 0 || inhibit == 2)) | 469 | || inhibit == 0 || inhibit == 2)) |
| @@ -608,7 +608,8 @@ make_frame (bool mini_p) | |||
| 608 | f->wants_modeline = true; | 608 | f->wants_modeline = true; |
| 609 | f->redisplay = true; | 609 | f->redisplay = true; |
| 610 | f->garbaged = true; | 610 | f->garbaged = true; |
| 611 | f->official = false; | 611 | f->can_x_set_window_size = false; |
| 612 | f->can_run_window_configuration_change_hook = false; | ||
| 612 | f->column_width = 1; /* !FRAME_WINDOW_P value. */ | 613 | f->column_width = 1; /* !FRAME_WINDOW_P value. */ |
| 613 | f->line_height = 1; /* !FRAME_WINDOW_P value. */ | 614 | f->line_height = 1; /* !FRAME_WINDOW_P value. */ |
| 614 | #ifdef HAVE_WINDOW_SYSTEM | 615 | #ifdef HAVE_WINDOW_SYSTEM |
| @@ -2259,6 +2260,25 @@ If there is no window system support, this function does nothing. */) | |||
| 2259 | return Qnil; | 2260 | return Qnil; |
| 2260 | } | 2261 | } |
| 2261 | 2262 | ||
| 2263 | DEFUN ("frame-can-run-window-configuration-change-hook", | ||
| 2264 | Fcan_run_window_configuration_change_hook, | ||
| 2265 | Scan_run_window_configuration_change_hook, 2, 2, 0, | ||
| 2266 | doc: /* Whether `window-configuration-change-hook' is run for frame FRAME. | ||
| 2267 | FRAME nil means use the selected frame. Second argument ALLOW non-nil | ||
| 2268 | means functions on `window-configuration-change-hook' are called | ||
| 2269 | whenever the window configuration of FRAME changes. ALLOW nil means | ||
| 2270 | these functions are not called. | ||
| 2271 | |||
| 2272 | This function is currently called by `face-set-after-frame-default' only | ||
| 2273 | and should be otherwise used with utter care to avoid that running | ||
| 2274 | functions on `window-configuration-change-hook' is impeded forever. */) | ||
| 2275 | (Lisp_Object frame, Lisp_Object allow) | ||
| 2276 | { | ||
| 2277 | struct frame *f = decode_live_frame (frame); | ||
| 2278 | |||
| 2279 | f->can_run_window_configuration_change_hook = NILP (allow) ? false : true; | ||
| 2280 | } | ||
| 2281 | |||
| 2262 | 2282 | ||
| 2263 | /* Discard BUFFER from the buffer-list and buried-buffer-list of each frame. */ | 2283 | /* Discard BUFFER from the buffer-list and buried-buffer-list of each frame. */ |
| 2264 | 2284 | ||
| @@ -5083,6 +5103,7 @@ even if this option is non-nil. */); | |||
| 5083 | defsubr (&Sraise_frame); | 5103 | defsubr (&Sraise_frame); |
| 5084 | defsubr (&Slower_frame); | 5104 | defsubr (&Slower_frame); |
| 5085 | defsubr (&Sx_focus_frame); | 5105 | defsubr (&Sx_focus_frame); |
| 5106 | defsubr (&Scan_run_window_configuration_change_hook); | ||
| 5086 | defsubr (&Sredirect_frame_focus); | 5107 | defsubr (&Sredirect_frame_focus); |
| 5087 | defsubr (&Sframe_focus); | 5108 | defsubr (&Sframe_focus); |
| 5088 | defsubr (&Sframe_parameters); | 5109 | defsubr (&Sframe_parameters); |
diff --git a/src/frame.h b/src/frame.h index b5d3bbb5b11..3fd1a6abc20 100644 --- a/src/frame.h +++ b/src/frame.h | |||
| @@ -328,11 +328,13 @@ struct frame | |||
| 328 | in pixels. */ | 328 | in pixels. */ |
| 329 | bool_bf new_pixelwise : 1; | 329 | bool_bf new_pixelwise : 1; |
| 330 | 330 | ||
| 331 | /* True if frame has been added to Vframe_list and is henceforth | 331 | /* True means x_set_window_size requests can be processed for this |
| 332 | considered official. For in-official frames we neither process | 332 | frame. */ |
| 333 | x_set_window_size requests nor do we allow running | 333 | bool_bf can_x_set_window_size : 1; |
| 334 | window-configuration-change-hook when resizing windows. */ | 334 | |
| 335 | bool_bf official : 1; | 335 | /* True means run_window_configuration_change_hook can be processed |
| 336 | for this frame. */ | ||
| 337 | bool_bf can_run_window_configuration_change_hook : 1; | ||
| 336 | 338 | ||
| 337 | /* Bitfield area ends here. */ | 339 | /* Bitfield area ends here. */ |
| 338 | 340 | ||
diff --git a/src/nsfns.m b/src/nsfns.m index 16f4ba3b579..c4b273c3bf5 100644 --- a/src/nsfns.m +++ b/src/nsfns.m | |||
| @@ -1346,8 +1346,8 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 1346 | x_default_parameter (f, parms, Qfullscreen, Qnil, | 1346 | x_default_parameter (f, parms, Qfullscreen, Qnil, |
| 1347 | "fullscreen", "Fullscreen", RES_TYPE_SYMBOL); | 1347 | "fullscreen", "Fullscreen", RES_TYPE_SYMBOL); |
| 1348 | 1348 | ||
| 1349 | /* Consider frame official, now. */ | 1349 | /* Allow x_set_window_size, now. */ |
| 1350 | f->official = true; | 1350 | f->can_x_set_window_size = true; |
| 1351 | 1351 | ||
| 1352 | adjust_frame_size (f, FRAME_TEXT_WIDTH (f), FRAME_TEXT_HEIGHT (f), 0, 1, Qnil); | 1352 | adjust_frame_size (f, FRAME_TEXT_WIDTH (f), FRAME_TEXT_HEIGHT (f), 0, 1, Qnil); |
| 1353 | 1353 | ||
diff --git a/src/w32fns.c b/src/w32fns.c index 95821df6c61..502154d4473 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -4703,8 +4703,8 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 4703 | x_default_parameter (f, parameters, Qscroll_bar_height, Qnil, | 4703 | x_default_parameter (f, parameters, Qscroll_bar_height, Qnil, |
| 4704 | "scrollBarHeight", "ScrollBarHeight", RES_TYPE_NUMBER); | 4704 | "scrollBarHeight", "ScrollBarHeight", RES_TYPE_NUMBER); |
| 4705 | 4705 | ||
| 4706 | /* Consider frame official, now. */ | 4706 | /* Allow x_set_window_size, now. */ |
| 4707 | f->official = true; | 4707 | f->can_x_set_window_size = true; |
| 4708 | 4708 | ||
| 4709 | adjust_frame_size (f, FRAME_TEXT_WIDTH (f), FRAME_TEXT_HEIGHT (f), 0, 1, Qnil); | 4709 | adjust_frame_size (f, FRAME_TEXT_WIDTH (f), FRAME_TEXT_HEIGHT (f), 0, 1, Qnil); |
| 4710 | 4710 | ||
| @@ -5851,7 +5851,7 @@ x_create_tip_frame (struct w32_display_info *dpyinfo, | |||
| 5851 | below. And the frame needs to be on Vframe_list or making it | 5851 | below. And the frame needs to be on Vframe_list or making it |
| 5852 | visible won't work. */ | 5852 | visible won't work. */ |
| 5853 | Vframe_list = Fcons (frame, Vframe_list); | 5853 | Vframe_list = Fcons (frame, Vframe_list); |
| 5854 | f->official = true; | 5854 | f->can_x_set_window_size = true; |
| 5855 | 5855 | ||
| 5856 | /* Setting attributes of faces of the tooltip frame from resources | 5856 | /* Setting attributes of faces of the tooltip frame from resources |
| 5857 | and similar will increment face_change_count, which leads to the | 5857 | and similar will increment face_change_count, which leads to the |
diff --git a/src/window.c b/src/window.c index 168ef1e3b9d..e4ff2b41806 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -3337,7 +3337,9 @@ run_window_configuration_change_hook (struct frame *f) | |||
| 3337 | = Fdefault_value (Qwindow_configuration_change_hook); | 3337 | = Fdefault_value (Qwindow_configuration_change_hook); |
| 3338 | XSETFRAME (frame, f); | 3338 | XSETFRAME (frame, f); |
| 3339 | 3339 | ||
| 3340 | if (NILP (Vrun_hooks) || !(f->official)) | 3340 | if (NILP (Vrun_hooks) |
| 3341 | || !(f->can_x_set_window_size) | ||
| 3342 | || !(f->can_run_window_configuration_change_hook)) | ||
| 3341 | return; | 3343 | return; |
| 3342 | 3344 | ||
| 3343 | /* Use the right buffer. Matters when running the local hooks. */ | 3345 | /* Use the right buffer. Matters when running the local hooks. */ |
| @@ -6204,8 +6206,8 @@ the return value is nil. Otherwise the value is t. */) | |||
| 6204 | call1 (Qrecord_window_buffer, window); | 6206 | call1 (Qrecord_window_buffer, window); |
| 6205 | } | 6207 | } |
| 6206 | 6208 | ||
| 6207 | /* Consider frame unofficial, temporarily. */ | 6209 | /* Disallow x_set_window_size, temporarily. */ |
| 6208 | f->official = false; | 6210 | f->can_x_set_window_size = false; |
| 6209 | /* The mouse highlighting code could get screwed up | 6211 | /* The mouse highlighting code could get screwed up |
| 6210 | if it runs during this. */ | 6212 | if it runs during this. */ |
| 6211 | block_input (); | 6213 | block_input (); |
| @@ -6414,9 +6416,9 @@ the return value is nil. Otherwise the value is t. */) | |||
| 6414 | ++n; | 6416 | ++n; |
| 6415 | } | 6417 | } |
| 6416 | 6418 | ||
| 6417 | /* Make frame official again and apply frame size changes if | 6419 | /* Allow x_set_window_size again and apply frame size changes if |
| 6418 | needed. */ | 6420 | needed. */ |
| 6419 | f->official = true; | 6421 | f->can_x_set_window_size = true; |
| 6420 | adjust_frame_size (f, -1, -1, 1, 0, Qnil); | 6422 | adjust_frame_size (f, -1, -1, 1, 0, Qnil); |
| 6421 | 6423 | ||
| 6422 | adjust_frame_glyphs (f); | 6424 | adjust_frame_glyphs (f); |
diff --git a/src/xfns.c b/src/xfns.c index 10eb3336fad..3ca8f20dd72 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -3248,7 +3248,7 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 3248 | "alpha", "Alpha", RES_TYPE_NUMBER); | 3248 | "alpha", "Alpha", RES_TYPE_NUMBER); |
| 3249 | 3249 | ||
| 3250 | /* Consider frame official, now. */ | 3250 | /* Consider frame official, now. */ |
| 3251 | f->official = true; | 3251 | f->can_x_set_window_size = true; |
| 3252 | 3252 | ||
| 3253 | adjust_frame_size (f, FRAME_TEXT_WIDTH (f), FRAME_TEXT_HEIGHT (f), 0, 1, Qnil); | 3253 | adjust_frame_size (f, FRAME_TEXT_WIDTH (f), FRAME_TEXT_HEIGHT (f), 0, 1, Qnil); |
| 3254 | 3254 | ||
| @@ -5233,7 +5233,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo, | |||
| 5233 | below. And the frame needs to be on Vframe_list or making it | 5233 | below. And the frame needs to be on Vframe_list or making it |
| 5234 | visible won't work. */ | 5234 | visible won't work. */ |
| 5235 | Vframe_list = Fcons (frame, Vframe_list); | 5235 | Vframe_list = Fcons (frame, Vframe_list); |
| 5236 | f->official = true; | 5236 | f->can_x_set_window_size = true; |
| 5237 | 5237 | ||
| 5238 | /* Setting attributes of faces of the tooltip frame from resources | 5238 | /* Setting attributes of faces of the tooltip frame from resources |
| 5239 | and similar will increment face_change_count, which leads to the | 5239 | and similar will increment face_change_count, which leads to the |