emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r113814: Avoid looping over all frame windows to fre


From: Dmitry Antipov
Subject: [Emacs-diffs] trunk r113814: Avoid looping over all frame windows to freeze and unfreeze.
Date: Mon, 12 Aug 2013 09:36:02 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 113814
revision-id: address@hidden
parent: address@hidden
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Mon 2013-08-12 13:34:00 +0400
message:
  Avoid looping over all frame windows to freeze and unfreeze.
  * window.h (struct window): Drop frozen_window_start_p.
  (freeze_window_starts): Drop prototype.
  * frame.h (struct frame): New frozen_window_starts flag.
  (FRAME_WINDOWS_FROZEN): New macro.
  * window.c (freeze_window_start, freeze_window_starts):
  Remove.
  (select_window, replace_window): Adjust users.
  * xdisp.c (resize_mini_window): Use FRAME_WINDOWS_FROZEN.
  (window_frozen_p): New function.
  (redisplay_window): Use it.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/frame.h                    frame.h-20091113204419-o5vbwnq5f7feedwu-229
  src/window.c                   window.c-20091113204419-o5vbwnq5f7feedwu-231
  src/window.h                   window.h-20091113204419-o5vbwnq5f7feedwu-271
  src/xdisp.c                    xdisp.c-20091113204419-o5vbwnq5f7feedwu-240
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-08-12 07:12:07 +0000
+++ b/src/ChangeLog     2013-08-12 09:34:00 +0000
@@ -1,3 +1,17 @@
+2013-08-12  Dmitry Antipov  <address@hidden>
+
+       Avoid looping over all frame windows to freeze and unfreeze.
+       * window.h (struct window): Drop frozen_window_start_p.
+       (freeze_window_starts): Drop prototype.
+       * frame.h (struct frame): New frozen_window_starts flag.
+       (FRAME_WINDOWS_FROZEN): New macro.
+       * window.c (freeze_window_start, freeze_window_starts):
+       Remove.
+       (select_window, replace_window): Adjust users.
+       * xdisp.c (resize_mini_window): Use FRAME_WINDOWS_FROZEN.
+       (window_frozen_p): New function.
+       (redisplay_window): Use it.
+
 2013-08-12  Paul Eggert  <address@hidden>
 
        Fix some fd issues when running subprocesses (Bug#15035).

=== modified file 'src/frame.h'
--- a/src/frame.h       2013-08-03 03:29:03 +0000
+++ b/src/frame.h       2013-08-12 09:34:00 +0000
@@ -410,6 +410,10 @@
   /* Nonzero means that the pointer is invisible. */
   unsigned pointer_invisible :1;
 
+  /* Nonzero means that all windows except mini-window and
+     selected window on this frame have frozen window starts.  */
+  unsigned frozen_window_starts : 1;
+
   /* Nonzero if we should actually display the scroll bars on this frame.  */
   enum vertical_scroll_bar_type vertical_scroll_bar_type;
 
@@ -761,6 +765,10 @@
 /* Not really implemented.  */
 #define FRAME_WANTS_MODELINE_P(f) (f)->wants_modeline
 
+/* Nonzero if all windows except selected window and mini window
+   are frozen on frame F.  */
+#define FRAME_WINDOWS_FROZEN(f) (f)->frozen_window_starts
+
 /* Nonzero if a size change has been requested for frame F
    but not yet really put into effect.  This can be true temporarily
    when an X event comes in at a bad time.  */

=== modified file 'src/window.c'
--- a/src/window.c      2013-08-11 01:30:20 +0000
+++ b/src/window.c      2013-08-12 09:34:00 +0000
@@ -69,7 +69,6 @@
 static void window_scroll (Lisp_Object, EMACS_INT, bool, int);
 static void window_scroll_pixel_based (Lisp_Object, int, bool, int);
 static void window_scroll_line_based (Lisp_Object, int, bool, int);
-static int freeze_window_start (struct window *, void *);
 static Lisp_Object window_list (void);
 static int add_window_to_list (struct window *, void *);
 static Lisp_Object next_window (Lisp_Object, Lisp_Object,
@@ -499,7 +498,6 @@
   CHECK_LIVE_WINDOW (window);
 
   w = XWINDOW (window);
-  w->frozen_window_start_p = 0;
 
   /* Make the selected window's buffer current.  */
   Fset_buffer (w->contents);
@@ -2055,7 +2053,6 @@
       wset_window_end_vpos (n, make_number (0));
       wset_window_end_pos (n, make_number (0));
       n->window_end_valid = 0;
-      n->frozen_window_start_p = 0;
     }
 
   tem = o->next;
@@ -6453,38 +6450,6 @@
   return cont;
 }
 
-
-/* Freeze or unfreeze the window start of W unless it is a
-   mini-window or the selected window.  FREEZE_P non-null means freeze
-   the window start.  */
-
-static int
-freeze_window_start (struct window *w, void *freeze_p)
-{
-  if (MINI_WINDOW_P (w)
-      || (WINDOWP (selected_window) /* Can be nil in corner cases.  */
-         && (w == XWINDOW (selected_window)
-             || (MINI_WINDOW_P (XWINDOW (selected_window))
-                 && ! NILP (Vminibuf_scroll_window)
-                 && w == XWINDOW (Vminibuf_scroll_window)))))
-    freeze_p = NULL;
-
-  w->frozen_window_start_p = freeze_p != NULL;
-  return 1;
-}
-
-
-/* Freeze or unfreeze the window starts of all leaf windows on frame
-   F, except the selected window and a mini-window.  FREEZE_P non-zero
-   means freeze the window start.  */
-
-void
-freeze_window_starts (struct frame *f, bool freeze_p)
-{
-  foreach_window (f, freeze_window_start, freeze_p ? f : 0);
-}
-
-
 /***********************************************************************
                            Initialization
  ***********************************************************************/

=== modified file 'src/window.h'
--- a/src/window.h      2013-08-07 10:32:08 +0000
+++ b/src/window.h      2013-08-12 09:34:00 +0000
@@ -316,11 +316,6 @@
        Currently only used for menu bar windows of frames.  */
     unsigned pseudo_window_p : 1;
 
-    /* 1 means the window start of this window is frozen and may not
-       be changed during redisplay.  If point is not in the window,
-       accept that.  */
-    unsigned frozen_window_start_p : 1;
-
     /* Non-zero means fringes are drawn outside display margins.
        Otherwise draw them between margin areas and text.  */
     unsigned fringes_outside_margins : 1;
@@ -888,7 +883,6 @@
 extern void resize_frame_windows (struct frame *, int, bool);
 extern void restore_window_configuration (Lisp_Object);
 extern void delete_all_child_windows (Lisp_Object);
-extern void freeze_window_starts (struct frame *, bool);
 extern void grow_mini_window (struct window *, int);
 extern void shrink_mini_window (struct window *);
 extern int window_relative_x_coord (struct window *, enum window_part, int);

=== modified file 'src/xdisp.c'
--- a/src/xdisp.c       2013-08-11 01:30:20 +0000
+++ b/src/xdisp.c       2013-08-12 09:34:00 +0000
@@ -10460,7 +10460,8 @@
          if (height > WINDOW_TOTAL_LINES (w))
            {
              int old_height = WINDOW_TOTAL_LINES (w);
-             freeze_window_starts (f, 1);
+
+             FRAME_WINDOWS_FROZEN (f) = 1;
              grow_mini_window (w, height - WINDOW_TOTAL_LINES (w));
              window_height_changed_p = WINDOW_TOTAL_LINES (w) != old_height;
            }
@@ -10468,7 +10469,8 @@
                   && (exact_p || BEGV == ZV))
            {
              int old_height = WINDOW_TOTAL_LINES (w);
-             freeze_window_starts (f, 0);
+
+             FRAME_WINDOWS_FROZEN (f) = 0;
              shrink_mini_window (w);
              window_height_changed_p = WINDOW_TOTAL_LINES (w) != old_height;
            }
@@ -10479,19 +10481,21 @@
          if (height > WINDOW_TOTAL_LINES (w))
            {
              int old_height = WINDOW_TOTAL_LINES (w);
-             freeze_window_starts (f, 1);
+
+             FRAME_WINDOWS_FROZEN (f) = 1;
              grow_mini_window (w, height - WINDOW_TOTAL_LINES (w));
              window_height_changed_p = WINDOW_TOTAL_LINES (w) != old_height;
            }
          else if (height < WINDOW_TOTAL_LINES (w))
            {
              int old_height = WINDOW_TOTAL_LINES (w);
-             freeze_window_starts (f, 0);
+
+             FRAME_WINDOWS_FROZEN (f) = 0;
              shrink_mini_window (w);
 
              if (height)
                {
-                 freeze_window_starts (f, 1);
+                 FRAME_WINDOWS_FROZEN (f) = 1;
                  grow_mini_window (w, height - WINDOW_TOTAL_LINES (w));
                }
 
@@ -10874,6 +10878,31 @@
          && (w->column_number_displayed != current_column ()));
 }
 
+/* Nonzero if window start of W is frozen and may not be changed during
+   redisplay.  */
+
+static bool
+window_frozen_p (struct window *w)
+{
+  if (FRAME_WINDOWS_FROZEN (XFRAME (WINDOW_FRAME (w))))
+    {
+      Lisp_Object window;
+
+      XSETWINDOW (window, w);
+      if (MINI_WINDOW_P (w))
+       return 0;
+      else if (EQ (window, selected_window))
+       return 0;
+      else if (MINI_WINDOW_P (XWINDOW (selected_window))
+              && EQ (window, Vminibuf_scroll_window))
+       /* This special window can't be frozen too.  */
+       return 0;
+      else
+       return 1;
+    }
+  return 0;
+}
+
 /***********************************************************************
                     Mode Lines and Frame Titles
  ***********************************************************************/
@@ -15510,7 +15539,7 @@
 
   /* Handle case where place to start displaying has been specified,
      unless the specified location is outside the accessible range.  */
-  if (w->force_start || w->frozen_window_start_p)
+  if (w->force_start || window_frozen_p (w))
     {
       /* We set this later on if we have to adjust point.  */
       int new_vpos = -1;
@@ -15555,7 +15584,7 @@
          goto need_larger_matrices;
        }
 
-      if (w->cursor.vpos < 0 && !w->frozen_window_start_p)
+      if (w->cursor.vpos < 0 && !window_frozen_p (w))
        {
          /* If point does not appear, try to move point so it does
             appear. The desired matrix has been built above, so we


reply via email to

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