emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r118315: Run `window-configuration-change-hook' only


From: Martin Rudalics
Subject: [Emacs-diffs] trunk r118315: Run `window-configuration-change-hook' only after all faces have been realized.
Date: Sat, 08 Nov 2014 11:12:22 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 118315
revision-id: address@hidden
parent: address@hidden
committer: martin rudalics <address@hidden>
branch nick: trunk
timestamp: Sat 2014-11-08 12:11:50 +0100
message:
  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'.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/faces.el                  faces.el-20091113204419-o5vbwnq5f7feedwu-562
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/frame.c                    frame.c-20091113204419-o5vbwnq5f7feedwu-243
  src/frame.h                    frame.h-20091113204419-o5vbwnq5f7feedwu-229
  src/nsfns.m                    nsfns.m-20091113204419-o5vbwnq5f7feedwu-8741
  src/w32fns.c                   w32fns.c-20091113204419-o5vbwnq5f7feedwu-945
  src/window.c                   window.c-20091113204419-o5vbwnq5f7feedwu-231
  src/xfns.c                     xfns.c-20091113204419-o5vbwnq5f7feedwu-274
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-11-07 23:33:41 +0000
+++ b/lisp/ChangeLog    2014-11-08 11:11:50 +0000
@@ -1,3 +1,8 @@
+2014-11-08  Martin Rudalics  <address@hidden>
+
+       * faces.el (face-set-after-frame-default): Enable running
+       `window-configuration-change-hook'.
+
 2014-11-07  Juri Linkov  <address@hidden>
 
        * replace.el: History for query replace pairs.

=== modified file 'lisp/faces.el'
--- a/lisp/faces.el     2014-10-09 04:23:09 +0000
+++ b/lisp/faces.el     2014-11-08 11:11:50 +0000
@@ -2092,7 +2092,8 @@
             (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."

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-11-08 08:47:45 +0000
+++ b/src/ChangeLog     2014-11-08 11:11:50 +0000
@@ -1,3 +1,23 @@
+2014-11-08  Martin Rudalics  <address@hidden>
+
+       * 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  <address@hidden>
 
        * nsterm.m (EmacsScroller.dealloc): Reinstate, removed at merge

=== modified file 'src/frame.c'
--- a/src/frame.c       2014-11-07 15:40:06 +0000
+++ b/src/frame.c       2014-11-08 11:11:50 +0000
@@ -463,7 +463,7 @@
 
 #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 @@
   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 @@
   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 @@
   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);

=== modified file 'src/frame.h'
--- a/src/frame.h       2014-11-07 10:49:22 +0000
+++ b/src/frame.h       2014-11-08 11:11:50 +0000
@@ -328,11 +328,13 @@
      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.  */
 

=== modified file 'src/nsfns.m'
--- a/src/nsfns.m       2014-11-07 10:49:22 +0000
+++ b/src/nsfns.m       2014-11-08 11:11:50 +0000
@@ -1346,8 +1346,8 @@
   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);
 

=== modified file 'src/w32fns.c'
--- a/src/w32fns.c      2014-11-07 10:49:22 +0000
+++ b/src/w32fns.c      2014-11-08 11:11:50 +0000
@@ -4703,8 +4703,8 @@
   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 @@
      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

=== modified file 'src/window.c'
--- a/src/window.c      2014-11-07 10:49:22 +0000
+++ b/src/window.c      2014-11-08 11:11:50 +0000
@@ -3337,7 +3337,9 @@
     = 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 @@
            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 @@
            ++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);

=== modified file 'src/xfns.c'
--- a/src/xfns.c        2014-11-07 10:49:22 +0000
+++ b/src/xfns.c        2014-11-08 11:11:50 +0000
@@ -3248,7 +3248,7 @@
                       "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 @@
      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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]