]> git.eshelyaron.com Git - emacs.git/commitdiff
Run `window-configuration-change-hook' only after all faces have been realized.
authorMartin Rudalics <rudalics@gmx.at>
Sat, 8 Nov 2014 11:11:50 +0000 (12:11 +0100)
committerMartin Rudalics <rudalics@gmx.at>
Sat, 8 Nov 2014 11:11:50 +0000 (12:11 +0100)
* 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'.

lisp/ChangeLog
lisp/faces.el
src/ChangeLog
src/frame.c
src/frame.h
src/nsfns.m
src/w32fns.c
src/window.c
src/xfns.c

index 52d8a5b60514eafc00ae85186aa7040d9a8fad29..dae450a277673428bf7851b936b2e8e31ae6570d 100644 (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.
index d7b330ee64ca514dd39f6fcc3ca0269bd3f7847d..1d4fc9c5570ae0172352bc25a642cbb9bd577672 100644 (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."
index 4700e314a162fcd51bd337bc075dc1f938d915db..f8ed3b36ddea391156ab25498fb2e5c2292e9a48 100644 (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
index b03e207c105ae70a40d8ca126068f3dd7a4f1c55..c68195caba2e87e3b8820072f9d8ef38bce61a99 100644 (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;
+}
+
 \f
 /* 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);
index b5d3bbb5b119e7ae7807101af5395fc2527d88f3..3fd1a6abc2088a3d660ab99ff4333ef94650619f 100644 (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.  */
 
index 16f4ba3b579f2a62c022b84caa023b9db0e44af3..c4b273c3bf5bf0df7eb65e31e684e11d313a9105 100644 (file)
@@ -1346,8 +1346,8 @@ This function is an internal primitive--use `make-frame' instead.  */)
   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);
 
index 95821df6c61bf64bfc554e3dde44fa2be48f9213..502154d4473f60e400ccb68fd4529442b752b2d1 100644 (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
index 168ef1e3b9d99ff7c6d881cfc349d07f83b07980..e4ff2b418060d048b888de59391a2edfe4fe8512 100644 (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);
index 10eb3336fad6531b9ba8e7860e617ee48b8d2b3e..3ca8f20dd72e97c43c3885bd1f71c8b03afbe28c 100644 (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