First Edition.
[bpt/emacs.git] / src / window.c
index 88c8c81..c196937 100644 (file)
@@ -22,13 +22,13 @@ Boston, MA 02111-1307, USA.  */
 #include <config.h>
 #include "lisp.h"
 #include "buffer.h"
+#include "keyboard.h"
 #include "frame.h"
 #include "window.h"
 #include "commands.h"
 #include "indent.h"
 #include "termchar.h"
 #include "disptab.h"
-#include "keyboard.h"
 #include "dispextern.h"
 #include "blockinput.h"
 #include "intervals.h"
@@ -514,7 +514,9 @@ coordinates_in_window (w, x, y)
           && *y < top_y + CURRENT_HEADER_LINE_HEIGHT (w))
     /* On the top line.  */
     return 4;
-  else if (*x < left_x || *x >= right_x)
+  /* Need to say "*x > right_x" rather than >=, since on character
+     terminals, the vertical line's x coordinate is right_x.  */
+  else if (*x < left_x || *x > right_x)
     {
       /* Other lines than the mode line don't include flags areas and
         scroll bars on the left.  */
@@ -524,9 +526,10 @@ coordinates_in_window (w, x, y)
       *y -= top_y;
       return *x < left_x ? 5 : 6;
     }
+  /* Here, too, "*x > right_x" is because of character terminals.  */
   else if (!w->pseudo_window_p
           && !WINDOW_RIGHTMOST_P (w)
-          && *x >= right_x - CANON_X_UNIT (f))
+          && *x > right_x - CANON_X_UNIT (f))
     /* On the border on the right side of the window?  Assume that
        this area begins at RIGHT_X minus a canonical char width.  */
     return 3;
@@ -1710,19 +1713,19 @@ window_loop (type, obj, mini, frames)
 
          case GET_LARGEST_WINDOW:
            {
-             struct window *b;
-             
              /* Ignore dedicated windows and minibuffers.  */
-             if (MINI_WINDOW_P (w)
-                 || !NILP (w->dedicated)
-                 || NILP (best_window))
+             if (MINI_WINDOW_P (w) || !NILP (w->dedicated))
                break;
              
-             b = XWINDOW (best_window);
-             if (NILP (best_window)
-                 || (XFASTINT (w->height) * XFASTINT (w->width)
-                     > (XFASTINT (b->height) * XFASTINT (b->width))))
+             if (NILP (best_window))
                best_window = window;
+             else
+               {
+                 struct window *b = XWINDOW (best_window);
+                 if (XFASTINT (w->height) * XFASTINT (w->width)
+                     > XFASTINT (b->height) * XFASTINT (b->width))
+                   best_window = window;
+               }
            }
            break;
 
@@ -1770,6 +1773,9 @@ window_loop (type, obj, mini, frames)
                && NILP (XBUFFER (w->buffer)->name))
              abort ();
            break;
+
+         case WINDOW_LOOP_UNUSED:
+           break;
          }
     }
 
@@ -3476,6 +3482,8 @@ shrink_window_lowest_first (w, height)
       Lisp_Object last_child;
       int delta = old_height - height;
       int last_top;
+
+      last_child = Qnil;
       
       /* Find the last child.  We are taking space from lowest windows
         first, so we iterate over children from the last child
@@ -5170,7 +5178,7 @@ freeze_window_starts (f, freeze_p)
      struct frame *f;
      int freeze_p;
 {
-  foreach_window (f, freeze_window_start, (void *) freeze_p);
+  foreach_window (f, freeze_window_start, (void *) (freeze_p ? f : 0));
 }
 
 \f