texinfo-commits
[Top][All Lists]
Advanced

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

[5787] resize windows evenly on screen resize


From: Gavin D. Smith
Subject: [5787] resize windows evenly on screen resize
Date: Tue, 26 Aug 2014 19:10:34 +0000

Revision: 5787
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5787
Author:   gavin
Date:     2014-08-26 19:10:33 +0000 (Tue, 26 Aug 2014)
Log Message:
-----------
resize windows evenly on screen resize

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/info/window.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2014-08-26 18:56:44 UTC (rev 5786)
+++ trunk/ChangeLog     2014-08-26 19:10:33 UTC (rev 5787)
@@ -6,6 +6,9 @@
        (info_search_previous): Work correctly when the match is an exact
        number of screen-fulls away.
 
+       * info/window.c (window_new_screen_size): Try to resize windows
+       evenly.
+
 2014-08-26  Gavin Smith  <address@hidden>
 
        * info/m-x.c (info_execute_command): Free a string.  Allow arbitarily

Modified: trunk/info/window.c
===================================================================
--- trunk/info/window.c 2014-08-26 18:56:44 UTC (rev 5786)
+++ trunk/info/window.c 2014-08-26 19:10:33 UTC (rev 5787)
@@ -88,7 +88,7 @@
 void
 window_new_screen_size (int width, int height)
 {
-  register WINDOW *win;
+  register WINDOW *win, *first_win;
   int delta_height, delta_each, delta_leftover;
   int numwins;
 
@@ -113,10 +113,7 @@
   if (numwins == 0)
     return; /* There is nothing to do. */
 
-  /* Divide the change in height among the available windows.  This
-     doesn't work very well because if we are getting a resize signal
-     every time the screen resizes by 1 line, delta_height will always
-     be 1. */
+  /* Divide the change in height among the available windows. */
   delta_each = delta_height / numwins;
   delta_leftover = delta_height - (delta_each * numwins);
 
@@ -155,11 +152,22 @@
       numwins--;
     }
 
+  /* Alternate which window we start resizing at, to resize all
+     windows evenly. */
+    {
+      int first_win_num = the_screen->height % numwins;
+      int i;
+      first_win = windows;
+      for (i = 0; i < first_win_num; i++)
+        first_win = first_win->next;
+    }
+
   /* Change the height of each window in the chain by delta_each.  Change
      the height of the last window in the chain by delta_each and by the
      leftover amount of change.  Change the width of each window to be
      WIDTH. */
-  for (win = windows; win; win = win->next)
+  win = first_win;
+  do
     {
       if ((win->width != width) && ((win->flags & W_InhibitMode) == 0))
         {
@@ -180,7 +188,15 @@
           win->height += delta_leftover;
           delta_leftover = 0;
         }
+      /* Go to next window, wrapping round to the start. */
+      win = win->next;
+      if (!win)
+        win = windows;
+    }
+  while (win != first_win);
 
+  for (win = windows; win; win = win->next)
+    {
       /* If this is not the first window in the chain, set the
          first row of it by adding one to the location of the
          previous window's modeline. */




reply via email to

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