/[emacs]/emacs/src/window.c
ViewVC logotype

Diff of /emacs/src/window.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.434 by rms, Wed Jan 1 17:00:34 2003 UTC revision 1.435 by lektu, Tue Feb 4 14:03:17 2003 UTC
# Line 451  window so that the location of point bec Line 451  window so that the location of point bec
451    
452    CHECK_NUMBER (ncol);    CHECK_NUMBER (ncol);
453    hscroll = max (0, XINT (ncol));    hscroll = max (0, XINT (ncol));
454      
455    /* Prevent redisplay shortcuts when changing the hscroll.  */    /* Prevent redisplay shortcuts when changing the hscroll.  */
456    if (XINT (w->hscroll) != hscroll)    if (XINT (w->hscroll) != hscroll)
457      XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1;      XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1;
458      
459    w->hscroll = make_number (hscroll);    w->hscroll = make_number (hscroll);
460    return ncol;    return ncol;
461  }  }
# Line 543  coordinates_in_window (w, x, y) Line 543  coordinates_in_window (w, x, y)
543    
544    if (*x < x0 || *x >= x1)    if (*x < x0 || *x >= x1)
545      return ON_NOTHING;      return ON_NOTHING;
546      
547    /* In what's below, we subtract 1 when computing right_x because we    /* In what's below, we subtract 1 when computing right_x because we
548       want the rightmost pixel, which is given by left_pixel+width-1.  */       want the rightmost pixel, which is given by left_pixel+width-1.  */
549    if (w->pseudo_window_p)    if (w->pseudo_window_p)
# Line 578  coordinates_in_window (w, x, y) Line 578  coordinates_in_window (w, x, y)
578           as the vertical border.    If scroll bars on the left,           as the vertical border.    If scroll bars on the left,
579           return the right window.  */           return the right window.  */
580        part = ON_MODE_LINE;        part = ON_MODE_LINE;
581          
582        if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f))        if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f))
583          {          {
584            if (abs (*x - x0) < grabbable_width)            if (abs (*x - x0) < grabbable_width)
# Line 592  coordinates_in_window (w, x, y) Line 592  coordinates_in_window (w, x, y)
592             && *y >= top_y)             && *y >= top_y)
593      {      {
594        part = ON_HEADER_LINE;        part = ON_HEADER_LINE;
595          
596        if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f))        if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f))
597          {          {
598            if (abs (*x - x0) < grabbable_width)            if (abs (*x - x0) < grabbable_width)
# Line 626  coordinates_in_window (w, x, y) Line 626  coordinates_in_window (w, x, y)
626          {          {
627            /* Other lines than the mode line don't include fringes and            /* Other lines than the mode line don't include fringes and
628               scroll bars on the left.  */               scroll bars on the left.  */
629          
630            /* Convert X and Y to window-relative pixel coordinates.  */            /* Convert X and Y to window-relative pixel coordinates.  */
631            *x -= left_x;            *x -= left_x;
632            *y -= top_y;            *y -= top_y;
# Line 659  coordinates_in_window (w, x, y) Line 659  coordinates_in_window (w, x, y)
659          {          {
660            /* Other lines than the mode line don't include fringes and            /* Other lines than the mode line don't include fringes and
661               scroll bars on the left.  */               scroll bars on the left.  */
662          
663            /* Convert X and Y to window-relative pixel coordinates.  */            /* Convert X and Y to window-relative pixel coordinates.  */
664            *x -= left_x;            *x -= left_x;
665            *y -= top_y;            *y -= top_y;
# Line 744  If they are in the windows's left or rig Line 744  If they are in the windows's left or rig
744      case ON_TEXT:      case ON_TEXT:
745        /* X and Y are now window relative pixel coordinates.  Convert        /* X and Y are now window relative pixel coordinates.  Convert
746           them to canonical char units before returning them.  */           them to canonical char units before returning them.  */
747        return Fcons (CANON_X_FROM_PIXEL_X (f, x),        return Fcons (CANON_X_FROM_PIXEL_X (f, x),
748                      CANON_Y_FROM_PIXEL_Y (f, y));                      CANON_Y_FROM_PIXEL_Y (f, y));
749    
750      case ON_MODE_LINE:      case ON_MODE_LINE:
# Line 758  If they are in the windows's left or rig Line 758  If they are in the windows's left or rig
758    
759      case ON_LEFT_FRINGE:      case ON_LEFT_FRINGE:
760        return Qleft_fringe;        return Qleft_fringe;
761          
762      case ON_RIGHT_FRINGE:      case ON_RIGHT_FRINGE:
763        return Qright_fringe;        return Qright_fringe;
764    
765      case ON_LEFT_MARGIN:      case ON_LEFT_MARGIN:
766        return Qleft_margin;        return Qleft_margin;
767          
768      case ON_RIGHT_MARGIN:      case ON_RIGHT_MARGIN:
769        return Qright_margin;        return Qright_margin;
770    
# Line 805  check_window_containing (w, user_data) Line 805  check_window_containing (w, user_data)
805        XSETWINDOW (*cw->window, w);        XSETWINDOW (*cw->window, w);
806        continue_p = 0;        continue_p = 0;
807      }      }
808      
809    return continue_p;    return continue_p;
810  }  }
811    
# Line 839  window_from_coordinates (f, x, y, part, Line 839  window_from_coordinates (f, x, y, part,
839    window = Qnil;    window = Qnil;
840    cw.window = &window, cw.x = &x, cw.y = &y; cw.part = part;    cw.window = &window, cw.x = &x, cw.y = &y; cw.part = part;
841    foreach_window (f, check_window_containing, &cw);    foreach_window (f, check_window_containing, &cw);
842      
843    /* If not found above, see if it's in the tool bar window, if a tool    /* If not found above, see if it's in the tool bar window, if a tool
844       bar exists.  */       bar exists.  */
845    if (NILP (window)    if (NILP (window)
# Line 876  column 0.  */) Line 876  column 0.  */)
876    CHECK_NUMBER_OR_FLOAT (x);    CHECK_NUMBER_OR_FLOAT (x);
877    CHECK_NUMBER_OR_FLOAT (y);    CHECK_NUMBER_OR_FLOAT (y);
878    
879    return window_from_coordinates (f,    return window_from_coordinates (f,
880                                    PIXEL_X_FROM_CANON_X (f, x),                                    PIXEL_X_FROM_CANON_X (f, x),
881                                    PIXEL_Y_FROM_CANON_Y (f, y),                                    PIXEL_Y_FROM_CANON_Y (f, y),
882                                    &part, 0);                                    &part, 0);
# Line 976  if it isn't already recorded.  */) Line 976  if it isn't already recorded.  */)
976            old_buffer = current_buffer;            old_buffer = current_buffer;
977            set_buffer_internal (b);            set_buffer_internal (b);
978          }          }
979          
980        start_display (&it, w, startp);        start_display (&it, w, startp);
981        move_it_vertically (&it, window_box_height (w));        move_it_vertically (&it, window_box_height (w));
982        if (it.current_y < it.last_visible_y)        if (it.current_y < it.last_visible_y)
983          move_it_past_eol (&it);          move_it_past_eol (&it);
984        value = make_number (IT_CHARPOS (it));        value = make_number (IT_CHARPOS (it));
985          
986        if (old_buffer)        if (old_buffer)
987          set_buffer_internal (old_buffer);          set_buffer_internal (old_buffer);
988      }      }
# Line 1010  DEFUN ("set-window-point", Fset_window_p Line 1010  DEFUN ("set-window-point", Fset_window_p
1010       the new value of point.  */       the new value of point.  */
1011    if (!EQ (window, selected_window))    if (!EQ (window, selected_window))
1012      ++windows_or_buffers_changed;      ++windows_or_buffers_changed;
1013      
1014    return pos;    return pos;
1015  }  }
1016    
# Line 1093  window_display_table (w) Line 1093  window_display_table (w)
1093    else if (BUFFERP (w->buffer))    else if (BUFFERP (w->buffer))
1094      {      {
1095        struct buffer *b = XBUFFER (w->buffer);        struct buffer *b = XBUFFER (w->buffer);
1096          
1097        if (DISP_TABLE_P (b->display_table))        if (DISP_TABLE_P (b->display_table))
1098          dp = XCHAR_TABLE (b->display_table);          dp = XCHAR_TABLE (b->display_table);
1099        else if (DISP_TABLE_P (Vstandard_display_table))        else if (DISP_TABLE_P (Vstandard_display_table))
# Line 1159  unshow_buffer (w) Line 1159  unshow_buffer (w)
1159                           clip_to_bounds (BUF_BEGV_BYTE (b),                           clip_to_bounds (BUF_BEGV_BYTE (b),
1160                                           marker_byte_position (w->pointm),                                           marker_byte_position (w->pointm),
1161                                           BUF_ZV_BYTE (b)));                                           BUF_ZV_BYTE (b)));
1162      
1163    if (WINDOWP (b->last_selected_window)    if (WINDOWP (b->last_selected_window)
1164        && w == XWINDOW (b->last_selected_window))        && w == XWINDOW (b->last_selected_window))
1165      b->last_selected_window = Qnil;      b->last_selected_window = Qnil;
# Line 1441  window_list () Line 1441  window_list ()
1441            Vwindow_list = Fnconc (2, args);            Vwindow_list = Fnconc (2, args);
1442          }          }
1443      }      }
1444      
1445    return Vwindow_list;    return Vwindow_list;
1446  }  }
1447    
# Line 1518  decode_next_window_args (window, minibuf Line 1518  decode_next_window_args (window, minibuf
1518      *window = selected_window;      *window = selected_window;
1519    else    else
1520      CHECK_LIVE_WINDOW (*window);      CHECK_LIVE_WINDOW (*window);
1521      
1522    /* MINIBUF nil may or may not include minibuffers.  Decide if it    /* MINIBUF nil may or may not include minibuffers.  Decide if it
1523       does.  */       does.  */
1524    if (NILP (*minibuf))    if (NILP (*minibuf))
1525      *minibuf = minibuf_level ? minibuf_window : Qlambda;      *minibuf = minibuf_level ? minibuf_window : Qlambda;
1526    else if (!EQ (*minibuf, Qt))    else if (!EQ (*minibuf, Qt))
1527      *minibuf = Qlambda;      *minibuf = Qlambda;
1528      
1529    /* Now *MINIBUF can be t => count all minibuffer windows, `lambda'    /* Now *MINIBUF can be t => count all minibuffer windows, `lambda'
1530       => count none of them, or a specific minibuffer window (the       => count none of them, or a specific minibuffer window (the
1531       active one) to count.  */       active one) to count.  */
# Line 1543  decode_next_window_args (window, minibuf Line 1543  decode_next_window_args (window, minibuf
1543      ;      ;
1544    else if (!EQ (*all_frames, Qt))    else if (!EQ (*all_frames, Qt))
1545      *all_frames = Qnil;      *all_frames = Qnil;
1546      
1547    /* Now *ALL_FRAMES is t meaning search all frames, nil meaning    /* Now *ALL_FRAMES is t meaning search all frames, nil meaning
1548       search just current frame, `visible' meaning search just visible       search just current frame, `visible' meaning search just visible
1549       frames, 0 meaning search visible and iconified frames, or a       frames, 0 meaning search visible and iconified frames, or a
# Line 1563  next_window (window, minibuf, all_frames Line 1563  next_window (window, minibuf, all_frames
1563       int next_p;       int next_p;
1564  {  {
1565    decode_next_window_args (&window, &minibuf, &all_frames);    decode_next_window_args (&window, &minibuf, &all_frames);
1566      
1567    /* If ALL_FRAMES is a frame, and WINDOW isn't on that frame, just    /* If ALL_FRAMES is a frame, and WINDOW isn't on that frame, just
1568       return the first window on the frame.  */       return the first window on the frame.  */
1569    if (FRAMEP (all_frames)    if (FRAMEP (all_frames)
1570        && !EQ (all_frames, XWINDOW (window)->frame))        && !EQ (all_frames, XWINDOW (window)->frame))
1571      return Fframe_first_window (all_frames);      return Fframe_first_window (all_frames);
1572      
1573    if (next_p)    if (next_p)
1574      {      {
1575        Lisp_Object list;        Lisp_Object list;
1576          
1577        /* Find WINDOW in the list of all windows.  */        /* Find WINDOW in the list of all windows.  */
1578        list = Fmemq (window, window_list ());        list = Fmemq (window, window_list ());
1579    
# Line 1597  next_window (window, minibuf, all_frames Line 1597  next_window (window, minibuf, all_frames
1597    else    else
1598      {      {
1599        Lisp_Object candidate, list;        Lisp_Object candidate, list;
1600          
1601        /* Scan through the list of windows for candidates.  If there are        /* Scan through the list of windows for candidates.  If there are
1602           candidate windows in front of WINDOW, the last one of these           candidate windows in front of WINDOW, the last one of these
1603           is the one we want.  If there are candidates following WINDOW           is the one we want.  If there are candidates following WINDOW
# Line 1703  argument ALL_FRAMES is non-nil, cycle th Line 1703  argument ALL_FRAMES is non-nil, cycle th
1703    
1704    CHECK_NUMBER (arg);    CHECK_NUMBER (arg);
1705    window = selected_window;    window = selected_window;
1706      
1707    for (i = XINT (arg); i > 0; --i)    for (i = XINT (arg); i > 0; --i)
1708      window = Fnext_window (window, Qnil, all_frames);      window = Fnext_window (window, Qnil, all_frames);
1709    for (; i < 0; ++i)    for (; i < 0; ++i)
# Line 1748  window_list_1 (window, minibuf, all_fram Line 1748  window_list_1 (window, minibuf, all_fram
1748    
1749    decode_next_window_args (&window, &minibuf, &all_frames);    decode_next_window_args (&window, &minibuf, &all_frames);
1750    list = Qnil;    list = Qnil;
1751      
1752    for (tail = window_list (); CONSP (tail); tail = XCDR (tail))    for (tail = window_list (); CONSP (tail); tail = XCDR (tail))
1753      if (candidate_window_p (XCAR (tail), window, minibuf, all_frames))      if (candidate_window_p (XCAR (tail), window, minibuf, all_frames))
1754        list = Fcons (XCAR (tail), list);        list = Fcons (XCAR (tail), list);
1755      
1756    return Fnreverse (list);    return Fnreverse (list);
1757  }  }
1758    
# Line 1787  window_loop (type, obj, mini, frames) Line 1787  window_loop (type, obj, mini, frames)
1787    Lisp_Object window, windows, best_window, frame_arg;    Lisp_Object window, windows, best_window, frame_arg;
1788    struct frame *f;    struct frame *f;
1789    struct gcpro gcpro1;    struct gcpro gcpro1;
1790      
1791    /* If we're only looping through windows on a particular frame,    /* If we're only looping through windows on a particular frame,
1792       frame points to that frame.  If we're looping through windows       frame points to that frame.  If we're looping through windows
1793       on all frames, frame is 0.  */       on all frames, frame is 0.  */
# Line 1797  window_loop (type, obj, mini, frames) Line 1797  window_loop (type, obj, mini, frames)
1797      f = SELECTED_FRAME ();      f = SELECTED_FRAME ();
1798    else    else
1799      f = NULL;      f = NULL;
1800      
1801    if (f)    if (f)
1802      frame_arg = Qlambda;      frame_arg = Qlambda;
1803    else if (XFASTINT (frames) == 0)    else if (XFASTINT (frames) == 0)
# Line 1826  window_loop (type, obj, mini, frames) Line 1826  window_loop (type, obj, mini, frames)
1826    for (; CONSP (windows); windows = CDR (windows))    for (; CONSP (windows); windows = CDR (windows))
1827      {      {
1828        struct window *w;        struct window *w;
1829          
1830        window = XCAR (windows);        window = XCAR (windows);
1831        w = XWINDOW (window);        w = XWINDOW (window);
1832          
1833        /* Note that we do not pay attention here to whether the frame        /* Note that we do not pay attention here to whether the frame
1834           is visible, since Fwindow_list skips non-visible frames if           is visible, since Fwindow_list skips non-visible frames if
1835           that is desired, under the control of frame_arg.  */           that is desired, under the control of frame_arg.  */
# Line 1891  window_loop (type, obj, mini, frames) Line 1891  window_loop (type, obj, mini, frames)
1891                             && EQ (XWINDOW (XCAR (windows))->frame,                             && EQ (XWINDOW (XCAR (windows))->frame,
1892                                    XWINDOW (XCAR (XCDR (windows)))->frame))                                    XWINDOW (XCAR (XCDR (windows)))->frame))
1893                        windows = XCDR (windows);                        windows = XCDR (windows);
1894                        
1895                      /* Now we can safely delete the frame.  */                      /* Now we can safely delete the frame.  */
1896                      Fdelete_frame (w->frame, Qnil);                      Fdelete_frame (w->frame, Qnil);
1897                    }                    }
# Line 1916  window_loop (type, obj, mini, frames) Line 1916  window_loop (type, obj, mini, frames)
1916                /* Ignore dedicated windows and minibuffers.  */                /* Ignore dedicated windows and minibuffers.  */
1917                if (MINI_WINDOW_P (w) || EQ (w->dedicated, Qt))                if (MINI_WINDOW_P (w) || EQ (w->dedicated, Qt))
1918                  break;                  break;
1919                  
1920                if (NILP (best_window))                if (NILP (best_window))
1921                  best_window = window;                  best_window = window;
1922                else                else
# Line 1934  window_loop (type, obj, mini, frames) Line 1934  window_loop (type, obj, mini, frames)
1934                {                {
1935                  Lisp_Object buffer;                  Lisp_Object buffer;
1936                  struct frame *f = XFRAME (w->frame);                  struct frame *f = XFRAME (w->frame);
1937                    
1938                  /* Find another buffer to show in this window.  */                  /* Find another buffer to show in this window.  */
1939                  buffer = Fother_buffer (obj, Qnil, w->frame);                  buffer = Fother_buffer (obj, Qnil, w->frame);
1940                    
1941                  /* If this window is dedicated, and in a frame of its own,                  /* If this window is dedicated, and in a frame of its own,
1942                     kill the frame.  */                     kill the frame.  */
1943                  if (EQ (window, FRAME_ROOT_WINDOW (f))                  if (EQ (window, FRAME_ROOT_WINDOW (f))
# Line 1950  window_loop (type, obj, mini, frames) Line 1950  window_loop (type, obj, mini, frames)
1950                             && EQ (XWINDOW (XCAR (windows))->frame,                             && EQ (XWINDOW (XCAR (windows))->frame,
1951                                    XWINDOW (XCAR (XCDR (windows)))->frame))                                    XWINDOW (XCAR (XCDR (windows)))->frame))
1952                        windows = XCDR (windows);                        windows = XCDR (windows);
1953                        
1954                      /* Now we can safely delete the frame.  */                      /* Now we can safely delete the frame.  */
1955                      Fdelete_frame (w->frame, Qnil);                      Fdelete_frame (w->frame, Qnil);
1956                    }                    }
# Line 2136  If FRAME is a frame, search only that fr Line 2136  If FRAME is a frame, search only that fr
2136        CHECK_BUFFER (buffer);        CHECK_BUFFER (buffer);
2137        window_loop (DELETE_BUFFER_WINDOWS, buffer, 0, frame);        window_loop (DELETE_BUFFER_WINDOWS, buffer, 0, frame);
2138      }      }
2139      
2140    return Qnil;    return Qnil;
2141  }  }
2142    
# Line 2212  check_frame_size (frame, rows, cols) Line 2212  check_frame_size (frame, rows, cols)
2212      = ((FRAME_MINIBUF_ONLY_P (frame) || ! FRAME_HAS_MINIBUF_P (frame))      = ((FRAME_MINIBUF_ONLY_P (frame) || ! FRAME_HAS_MINIBUF_P (frame))
2213         ? MIN_SAFE_WINDOW_HEIGHT         ? MIN_SAFE_WINDOW_HEIGHT
2214         : 2 * MIN_SAFE_WINDOW_HEIGHT);         : 2 * MIN_SAFE_WINDOW_HEIGHT);
2215      
2216    if (FRAME_TOP_MARGIN (frame) > 0)    if (FRAME_TOP_MARGIN (frame) > 0)
2217      min_height += FRAME_TOP_MARGIN (frame);      min_height += FRAME_TOP_MARGIN (frame);
2218    
# Line 2236  window_fixed_size_p (w, width_p, check_s Line 2236  window_fixed_size_p (w, width_p, check_s
2236  {  {
2237    int fixed_p;    int fixed_p;
2238    struct window *c;    struct window *c;
2239      
2240    if (!NILP (w->hchild))    if (!NILP (w->hchild))
2241      {      {
2242        c = XWINDOW (w->hchild);        c = XWINDOW (w->hchild);
2243          
2244        if (width_p)        if (width_p)
2245          {          {
2246            /* A horiz. combination is fixed-width if all of if its            /* A horiz. combination is fixed-width if all of if its
# Line 2261  window_fixed_size_p (w, width_p, check_s Line 2261  window_fixed_size_p (w, width_p, check_s
2261    else if (!NILP (w->vchild))    else if (!NILP (w->vchild))
2262      {      {
2263        c = XWINDOW (w->vchild);        c = XWINDOW (w->vchild);
2264          
2265        if (width_p)        if (width_p)
2266          {          {
2267            /* A vert. combination is fixed-width if one of if its            /* A vert. combination is fixed-width if one of if its
# Line 2287  window_fixed_size_p (w, width_p, check_s Line 2287  window_fixed_size_p (w, width_p, check_s
2287          {          {
2288            struct buffer *old = current_buffer;            struct buffer *old = current_buffer;
2289            Lisp_Object val;            Lisp_Object val;
2290          
2291            current_buffer = XBUFFER (w->buffer);            current_buffer = XBUFFER (w->buffer);
2292            val = find_symbol_value (Qwindow_size_fixed);            val = find_symbol_value (Qwindow_size_fixed);
2293            current_buffer = old;            current_buffer = old;
# Line 2296  window_fixed_size_p (w, width_p, check_s Line 2296  window_fixed_size_p (w, width_p, check_s
2296            if (!EQ (val, Qunbound))            if (!EQ (val, Qunbound))
2297              {              {
2298                fixed_p = !NILP (val);                fixed_p = !NILP (val);
2299                  
2300                if (fixed_p                if (fixed_p
2301                    && ((EQ (val, Qheight) && width_p)                    && ((EQ (val, Qheight) && width_p)
2302                        || (EQ (val, Qwidth) && !width_p)))                        || (EQ (val, Qwidth) && !width_p)))
# Line 2309  window_fixed_size_p (w, width_p, check_s Line 2309  window_fixed_size_p (w, width_p, check_s
2309        if (!fixed_p && check_siblings_p && WINDOWP (w->parent))        if (!fixed_p && check_siblings_p && WINDOWP (w->parent))
2310          {          {
2311            Lisp_Object child;            Lisp_Object child;
2312              
2313            for (child = w->prev; !NILP (child); child = XWINDOW (child)->prev)            for (child = w->prev; !NILP (child); child = XWINDOW (child)->prev)
2314              if (!window_fixed_size_p (XWINDOW (child), width_p, 0))              if (!window_fixed_size_p (XWINDOW (child), width_p, 0))
2315                break;                break;
# Line 2328  window_fixed_size_p (w, width_p, check_s Line 2328  window_fixed_size_p (w, width_p, check_s
2328    
2329    return fixed_p;    return fixed_p;
2330  }  }
2331      
2332    
2333  /* Return the minimum size of window W, not taking fixed-width windows  /* Return the minimum size of window W, not taking fixed-width windows
2334     into account.  WIDTH_P non-zero means return the minimum width,     into account.  WIDTH_P non-zero means return the minimum width,
# Line 2342  window_min_size_1 (w, width_p) Line 2342  window_min_size_1 (w, width_p)
2342  {  {
2343    struct window *c;    struct window *c;
2344    int size;    int size;
2345      
2346    if (!NILP (w->hchild))    if (!NILP (w->hchild))
2347      {      {
2348        c = XWINDOW (w->hchild);        c = XWINDOW (w->hchild);
2349        size = 0;        size = 0;
2350          
2351        if (width_p)        if (width_p)
2352          {          {
2353            /* The min width of a horizontal combination is            /* The min width of a horizontal combination is
# Line 2374  window_min_size_1 (w, width_p) Line 2374  window_min_size_1 (w, width_p)
2374      {      {
2375        c = XWINDOW (w->vchild);        c = XWINDOW (w->vchild);
2376        size = 0;        size = 0;
2377          
2378        if (width_p)        if (width_p)
2379          {          {
2380            /* The min width of a vertical combination is            /* The min width of a vertical combination is
# Line 2433  window_min_size (w, width_p, ignore_fixe Line 2433  window_min_size (w, width_p, ignore_fixe
2433      fixed_p = 0;      fixed_p = 0;
2434    else    else
2435      fixed_p = window_fixed_size_p (w, width_p, 1);      fixed_p = window_fixed_size_p (w, width_p, 1);
2436      
2437    if (fixed)    if (fixed)
2438      *fixed = fixed_p;      *fixed = fixed_p;
2439      
2440    if (fixed_p)    if (fixed_p)
2441      size = width_p ? XFASTINT (w->width) : XFASTINT (w->height);      size = width_p ? XFASTINT (w->width) : XFASTINT (w->height);
2442    else    else
2443      size = window_min_size_1 (w, width_p);      size = window_min_size_1 (w, width_p);
2444          
2445    return size;    return size;
2446  }  }
2447    
# Line 2470  size_window (window, size, width_p, node Line 2470  size_window (window, size, width_p, node
2470    
2471    check_min_window_sizes ();    check_min_window_sizes ();
2472    size = max (0, size);    size = max (0, size);
2473      
2474    /* If the window has been "too small" at one point,    /* If the window has been "too small" at one point,
2475       don't delete it for being "too small" in the future.       don't delete it for being "too small" in the future.
2476       Preserve it as long as that is at all possible.  */       Preserve it as long as that is at all possible.  */
# Line 2495  size_window (window, size, width_p, node Line 2495  size_window (window, size, width_p, node
2495          min_size = width_p ? MIN_SAFE_WINDOW_WIDTH : MIN_SAFE_WINDOW_HEIGHT;          min_size = width_p ? MIN_SAFE_WINDOW_WIDTH : MIN_SAFE_WINDOW_HEIGHT;
2496        else        else
2497          min_size = width_p ? window_min_width : window_min_height;          min_size = width_p ? window_min_width : window_min_height;
2498          
2499        if (size < min_size)        if (size < min_size)
2500          {          {
2501            delete_window (window);            delete_window (window);
# Line 2547  size_window (window, size, width_p, node Line 2547  size_window (window, size, width_p, node
2547        for (child = *forward; !NILP (child); child = c->next, ++nchildren)        for (child = *forward; !NILP (child); child = c->next, ++nchildren)
2548          {          {
2549            int child_size;            int child_size;
2550              
2551            c = XWINDOW (child);            c = XWINDOW (child);
2552            child_size = width_p ? XINT (c->width) : XINT (c->height);            child_size = width_p ? XINT (c->width) : XINT (c->height);
2553            total += child_size;            total += child_size;
2554              
2555            if (window_fixed_size_p (c, width_p, 0))            if (window_fixed_size_p (c, width_p, 0))
2556              {              {
2557                fixed_size += child_size;                fixed_size += child_size;
# Line 2576  size_window (window, size, width_p, node Line 2576  size_window (window, size, width_p, node
2576        for (child = *forward; !NILP (child); child = c->next)        for (child = *forward; !NILP (child); child = c->next)
2577          {          {
2578            int new_size, old_size;            int new_size, old_size;
2579              
2580            c = XWINDOW (child);            c = XWINDOW (child);
2581            old_size = width_p ? XFASTINT (c->width) : XFASTINT (c->height);            old_size = width_p ? XFASTINT (c->width) : XFASTINT (c->height);
2582            new_size = old_size;            new_size = old_size;
# Line 2594  size_window (window, size, width_p, node Line 2594  size_window (window, size, width_p, node
2594                new_size = old_size + each + extra;                new_size = old_size + each + extra;
2595                extra = 0;                extra = 0;
2596              }              }
2597              
2598            /* Set new height.  Note that size_window also propagates            /* Set new height.  Note that size_window also propagates
2599               edge positions to children, so it's not a no-op if we               edge positions to children, so it's not a no-op if we
2600               didn't change the child's size.  */               didn't change the child's size.  */
# Line 2607  size_window (window, size, width_p, node Line 2607  size_window (window, size, width_p, node
2607    
2608        /* We should have covered the parent exactly with child windows.  */        /* We should have covered the parent exactly with child windows.  */
2609        xassert (size == last_pos - first_pos);        xassert (size == last_pos - first_pos);
2610          
2611        /* Now delete any children that became too small.  */        /* Now delete any children that became too small.  */
2612        if (!nodelete_p)        if (!nodelete_p)
2613          for (child = *forward; !NILP (child); child = c->next)          for (child = *forward; !NILP (child); child = c->next)
# Line 2779  selects the buffer of the selected windo Line 2779  selects the buffer of the selected windo
2779    
2780  /* Note that selected_window can be nil  /* Note that selected_window can be nil
2781     when this is called from Fset_window_configuration.  */     when this is called from Fset_window_configuration.  */
2782    
2783  static Lisp_Object  static Lisp_Object
2784  select_window_1 (window, recordflag)  select_window_1 (window, recordflag)
2785       register Lisp_Object window;       register Lisp_Object window;
# Line 2862  display_buffer_1 (window) Line 2862  display_buffer_1 (window)
2862  {  {
2863    Lisp_Object frame = XWINDOW (window)->frame;    Lisp_Object frame = XWINDOW (window)->frame;
2864    FRAME_PTR f = XFRAME (frame);    FRAME_PTR f = XFRAME (frame);
2865      
2866    FRAME_SAMPLE_VISIBILITY (f);    FRAME_SAMPLE_VISIBILITY (f);
2867      
2868    if (!EQ (frame, selected_frame))    if (!EQ (frame, selected_frame))
2869      {      {
2870        if (FRAME_ICONIFIED_P (f))        if (FRAME_ICONIFIED_P (f))
# Line 2872  display_buffer_1 (window) Line 2872  display_buffer_1 (window)
2872        else if (FRAME_VISIBLE_P (f))        else if (FRAME_VISIBLE_P (f))
2873          Fraise_frame (frame);          Fraise_frame (frame);
2874      }      }
2875      
2876    return window;    return window;
2877  }  }
2878    
# Line 2908  See `special-display-buffer-names', and Line 2908  See `special-display-buffer-names', and
2908          return XCDR (car);          return XCDR (car);
2909      }      }
2910    return Qnil;    return Qnil;
2911  }    }
2912    
2913  DEFUN ("same-window-p", Fsame_window_p, Ssame_window_p, 1, 1, 0,  DEFUN ("same-window-p", Fsame_window_p, Ssame_window_p, 1, 1, 0,
2914         doc: /* Returns non-nil if a new buffer named BUFFER-NAME would use the same window.         doc: /* Returns non-nil if a new buffer named BUFFER-NAME would use the same window.
# Line 3011  displayed.  */) Line 3011  displayed.  */)
3011      XSETFASTINT (tem, 0);      XSETFASTINT (tem, 0);
3012    else    else
3013      XSETFRAME (tem, last_nonminibuf_frame);      XSETFRAME (tem, last_nonminibuf_frame);
3014      
3015    window = Fget_buffer_window (buffer, tem);    window = Fget_buffer_window (buffer, tem);
3016    if (!NILP (window)    if (!NILP (window)
3017        && (NILP (not_this_window) || !EQ (window, selected_window)))        && (NILP (not_this_window) || !EQ (window, selected_window)))
# Line 3418  window_width (window) Line 3418  window_width (window)
3418    return XFASTINT (p->width);    return XFASTINT (p->width);
3419  }  }
3420    
3421            
3422  #define CURBEG(w) \  #define CURBEG(w) \
3423    *(widthflag ? &(XWINDOW (w)->left) : &(XWINDOW (w)->top))    *(widthflag ? &(XWINDOW (w)->left) : &(XWINDOW (w)->top))
3424    
# Line 3461  enlarge_window (window, delta, widthflag Line 3461  enlarge_window (window, delta, widthflag
3461      {      {
3462        p = XWINDOW (window);        p = XWINDOW (window);
3463        parent = p->parent;        parent = p->parent;
3464          
3465        if (NILP (parent))        if (NILP (parent))
3466          {          {
3467            if (widthflag)            if (widthflag)
3468              error ("No other window to side of this one");              error ("No other window to side of this one");
3469            break;            break;
3470          }          }
3471          
3472        if (widthflag        if (widthflag
3473            ? !NILP (XWINDOW (parent)->hchild)            ? !NILP (XWINDOW (parent)->hchild)
3474            : !NILP (XWINDOW (parent)->vchild))            : !NILP (XWINDOW (parent)->vchild))
3475          break;          break;
3476          
3477        window = parent;        window = parent;
3478      }      }
3479    
# Line 3563  enlarge_window (window, delta, widthflag Line 3563  enlarge_window (window, delta, widthflag
3563                  {                  {
3564                    if (this_one > delta)                    if (this_one > delta)
3565                      this_one = delta;                      this_one = delta;
3566                      
3567                    (*setsizefun) (next, (*sizefun) (next) - this_one, 0);                    (*setsizefun) (next, (*sizefun) (next) - this_one, 0);
3568                    (*setsizefun) (window, XINT (*sizep) + this_one, 0);                    (*setsizefun) (window, XINT (*sizep) + this_one, 0);
3569    
3570                    delta -= this_one;                    delta -= this_one;
3571                  }                  }
3572                  
3573                next = XWINDOW (next)->next;                next = XWINDOW (next)->next;
3574              }              }
3575              
3576            if (delta == 0)            if (delta == 0)
3577              break;              break;
3578              
3579            if (!preserve_before && ! NILP (prev))            if (!preserve_before && ! NILP (prev))
3580              {              {
3581                int this_one = ((*sizefun) (prev)                int this_one = ((*sizefun) (prev)
# Line 3585  enlarge_window (window, delta, widthflag Line 3585  enlarge_window (window, delta, widthflag
3585                  {                  {
3586                    if (this_one > delta)                    if (this_one > delta)
3587                      this_one = delta;                      this_one = delta;
3588                      
3589                    first_affected = prev;                    first_affected = prev;
3590                      
3591                    (*setsizefun) (prev, (*sizefun) (prev) - this_one, 0);                    (*setsizefun) (prev, (*sizefun) (prev) - this_one, 0);
3592                    (*setsizefun) (window, XINT (*sizep) + this_one, 0);                    (*setsizefun) (window, XINT (*sizep) + this_one, 0);
3593    
3594                    delta -= this_one;                    delta -= this_one;
3595                  }                  }
3596                  
3597                prev = XWINDOW (prev)->prev;                prev = XWINDOW (prev)->prev;
3598              }              }
3599          }          }
# Line 3657  enlarge_window (window, delta, widthflag Line 3657  enlarge_window (window, delta, widthflag
3657    
3658               The function size_window will compute the new height h'               The function size_window will compute the new height h'
3659               of the window from delta1 as:               of the window from delta1 as:
3660                
3661               e = delta1/n               e = delta1/n
3662               x = delta1 - delta1/n * n for the 1st resizable child               x = delta1 - delta1/n * n for the 1st resizable child
3663               h' = h + e + x               h' = h + e + x
# Line 3665  enlarge_window (window, delta, widthflag Line 3665  enlarge_window (window, delta, widthflag
3665               where n is the number of children that can be resized.               where n is the number of children that can be resized.
3666               We can ignore x by choosing a delta1 that is a multiple of               We can ignore x by choosing a delta1 that is a multiple of
3667               n.  We want the height of this window to come out as               n.  We want the height of this window to come out as
3668                
3669               h' = h + delta               h' = h + delta
3670    
3671               So, delta1 must be               So, delta1 must be
3672                
3673               h + e = h + delta               h + e = h + delta
3674               delta1/n = delta               delta1/n = delta
3675               delta1 = n * delta.               delta1 = n * delta.
# Line 3731  enum save_restore_action Line 3731  enum save_restore_action
3731      RESTORE_ORIG_SIZES      RESTORE_ORIG_SIZES
3732  };  };
3733    
3734  static int save_restore_orig_size P_ ((struct window *,  static int save_restore_orig_size P_ ((struct window *,
3735                                         enum save_restore_action));                                         enum save_restore_action));
3736    
3737  /* Shrink windows rooted in window W to HEIGHT.  Take the space needed  /* Shrink windows rooted in window W to HEIGHT.  Take the space needed
# Line 3773  shrink_window_lowest_first (w, height) Line 3773  shrink_window_lowest_first (w, height)
3773        int last_top;        int last_top;
3774    
3775        last_child = Qnil;        last_child = Qnil;
3776          
3777        /* Find the last child.  We are taking space from lowest windows        /* Find the last child.  We are taking space from lowest windows
3778           first, so we iterate over children from the last child           first, so we iterate over children from the last child
3779           backwards.  */           backwards.  */
# Line 3784  shrink_window_lowest_first (w, height) Line 3784  shrink_window_lowest_first (w, height)
3784        for (child = last_child; delta && !NILP (child); child = c->prev)        for (child = last_child; delta && !NILP (child); child = c->prev)
3785          {          {
3786            int this_one;            int this_one;
3787              
3788            c = XWINDOW (child);            c = XWINDOW (child);
3789            this_one = XFASTINT (c->height) - MIN_SAFE_WINDOW_HEIGHT;            this_one = XFASTINT (c->height) - MIN_SAFE_WINDOW_HEIGHT;
3790    
# Line 3814  shrink_window_lowest_first (w, height) Line 3814  shrink_window_lowest_first (w, height)
3814     If ACTION is CHECK_ORIG_SIZES, check if orig_top and orig_height     If ACTION is CHECK_ORIG_SIZES, check if orig_top and orig_height
3815     members are valid for all windows in the window tree.  Value is     members are valid for all windows in the window tree.  Value is
3816     non-zero if they are valid.     non-zero if they are valid.
3817      
3818     If ACTION is SAVE_ORIG_SIZES, save members top and height in     If ACTION is SAVE_ORIG_SIZES, save members top and height in
3819     orig_top and orig_height for all windows in the tree.     orig_top and orig_height for all windows in the tree.
3820    
# Line 3840  save_restore_orig_size (w, action) Line 3840  save_restore_orig_size (w, action)
3840            if (!save_restore_orig_size (XWINDOW (w->vchild), action))            if (!save_restore_orig_size (XWINDOW (w->vchild), action))
3841              success_p = 0;              success_p = 0;
3842          }          }
3843          
3844        switch (action)        switch (action)
3845          {          {
3846          case CHECK_ORIG_SIZES:          case CHECK_ORIG_SIZES:
# Line 3885  grow_mini_window (w, delta) Line 3885  grow_mini_window (w, delta)
3885  {  {
3886    struct frame *f = XFRAME (w->frame);    struct frame *f = XFRAME (w->frame);
3887    struct window *root;    struct window *root;
3888      
3889    xassert (MINI_WINDOW_P (w));    xassert (MINI_WINDOW_P (w));
3890    xassert (delta >= 0);    xassert (delta >= 0);
3891              
3892    /* Check values of window_min_width and window_min_height for    /* Check values of window_min_width and window_min_height for
3893       validity.  */       validity.  */
3894    check_min_window_sizes ();    check_min_window_sizes ();
# Line 3904  grow_mini_window (w, delta) Line 3904  grow_mini_window (w, delta)
3904             min_height.  */             min_height.  */
3905          delta = max (0, XFASTINT (root->height) - min_height);          delta = max (0, XFASTINT (root->height) - min_height);
3906      }      }
3907        
3908    if (delta)    if (delta)
3909      {      {
3910        /* Save original window sizes and positions, if not already done.  */        /* Save original window sizes and positions, if not already done.  */
# Line 3919  grow_mini_window (w, delta) Line 3919  grow_mini_window (w, delta)
3919        w->height = make_number (XFASTINT (w->height) + delta);        w->height = make_number (XFASTINT (w->height) + delta);
3920        XSETFASTINT (w->last_modified, 0);        XSETFASTINT (w->last_modified, 0);
3921        XSETFASTINT (w->last_overlay_modified, 0);        XSETFASTINT (w->last_overlay_modified, 0);
3922          
3923        adjust_glyphs (f);        adjust_glyphs (f);
3924      }      }
3925  }  }
# Line 4085  window_scroll_pixel_based (window, n, wh Line 4085  window_scroll_pixel_based (window, n, wh
4085    int vscrolled = 0;    int vscrolled = 0;
4086    
4087    SET_TEXT_POS_FROM_MARKER (start, w->start);    SET_TEXT_POS_FROM_MARKER (start, w->start);
4088      
4089    /* If PT is not visible in WINDOW, move back one half of    /* If PT is not visible in WINDOW, move back one half of
4090       the screen.  Allow PT to be partially visible, otherwise       the screen.  Allow PT to be partially visible, otherwise
4091       something like (scroll-down 1) with PT in the line before       something like (scroll-down 1) with PT in the line before
# Line 4099  window_scroll_pixel_based (window, n, wh Line 4099  window_scroll_pixel_based (window, n, wh
4099        init_iterator (&it, w, PT, PT_BYTE, NULL, DEFAULT_FACE_ID);        init_iterator (&it, w, PT, PT_BYTE, NULL, DEFAULT_FACE_ID);
4100        it.current_y = it.last_visible_y;        it.current_y = it.last_visible_y;
4101        move_it_vertically (&it, - window_box_height (w) / 2);        move_it_vertically (&it, - window_box_height (w) / 2);
4102          
4103        /* The function move_iterator_vertically may move over more than        /* The function move_iterator_vertically may move over more than
4104           the specified y-distance.  If it->w is small, e.g. a           the specified y-distance.  If it->w is small, e.g. a
4105           mini-buffer window, we may end up in front of the window's           mini-buffer window, we may end up in front of the window's
# Line 4207  window_scroll_pixel_based (window, n, wh Line 4207  window_scroll_pixel_based (window, n, wh
4207           window-scroll-functions.  */           window-scroll-functions.  */
4208        w->force_start = Qt;        w->force_start = Qt;
4209      }      }
4210      
4211    it.current_y = it.vpos = 0;    it.current_y = it.vpos = 0;
4212      
4213    /* Preserve the screen position if we must.  */    /* Preserve the screen position if we must.  */
4214    if (preserve_y >= 0)    if (preserve_y >= 0)
4215      {      {
# Line 4250  window_scroll_pixel_based (window, n, wh Line 4250  window_scroll_pixel_based (window, n, wh
4250            /* Save our position, in case it's correct.  */            /* Save our position, in case it's correct.  */
4251            charpos = IT_CHARPOS (it);            charpos = IT_CHARPOS (it);
4252            bytepos = IT_BYTEPOS (it);            bytepos = IT_BYTEPOS (it);
4253          
4254            /* See if point is on a partially visible line at the end.  */            /* See if point is on a partially visible line at the end.  */
4255            move_it_by_lines (&it, 1, 1);            move_it_by_lines (&it, 1, 1);
4256            if (it.current_y > it.last_visible_y)            if (it.current_y > it.last_visible_y)
# Line 4584  by this function.  */) Line 4584  by this function.  */)
4584    Lisp_Object result;    Lisp_Object result;
4585    int hscroll;    int hscroll;
4586    struct window *w = XWINDOW (selected_window);    struct window *w = XWINDOW (selected_window);
4587      
4588    if (NILP (arg))    if (NILP (arg))
4589      XSETFASTINT (arg, window_internal_width (w) - 2);      XSETFASTINT (arg, window_internal_width (w) - 2);
4590    else    else
# Line 4614  by this function.  */) Line 4614  by this function.  */)
4614    Lisp_Object result;    Lisp_Object result;
4615    int hscroll;    int hscroll;
4616    struct window *w = XWINDOW (selected_window);    struct window *w = XWINDOW (selected_window);
4617      
4618    if (NILP (arg))    if (NILP (arg))
4619      XSETFASTINT (arg, window_internal_width (w) - 2);      XSETFASTINT (arg, window_internal_width (w) - 2);
4620    else    else
# Line 4622  by this function.  */) Line 4622  by this function.  */)
4622    
4623    hscroll = XINT (w->hscroll) - XINT (arg);    hscroll = XINT (w->hscroll) - XINT (arg);
4624    result = Fset_window_hscroll (selected_window, make_number (hscroll));    result = Fset_window_hscroll (selected_window, make_number (hscroll));
4625      
4626    if (interactive_p (0))    if (interactive_p (0))
4627      w->min_hscroll = w->hscroll;      w->min_hscroll = w->hscroll;
4628    
# Line 4754  and redisplay normally--don't erase and Line 4754  and redisplay normally--don't erase and
4754          {          {
4755            struct it it;            struct it it;
4756            struct text_pos pt;            struct text_pos pt;
4757              
4758            SET_TEXT_POS (pt, PT, PT_BYTE);            SET_TEXT_POS (pt, PT, PT_BYTE);
4759            start_display (&it, w, pt);            start_display (&it, w, pt);
4760            move_it_vertically (&it, - window_box_height (w) / 2);            move_it_vertically (&it, - window_box_height (w) / 2);
# Line 4766  and redisplay normally--don't erase and Line 4766  and redisplay normally--don't erase and
4766            struct it it;            struct it it;
4767            struct text_pos pt;            struct text_pos pt;
4768            int y0, y1, h, nlines;            int y0, y1, h, nlines;
4769              
4770            SET_TEXT_POS (pt, PT, PT_BYTE);            SET_TEXT_POS (pt, PT, PT_BYTE);
4771            start_display (&it, w, pt);            start_display (&it, w, pt);
4772            y0 = it.current_y;            y0 = it.current_y;
# Line 4783  and redisplay normally--don't erase and Line 4783  and redisplay normally--don't erase and
4783               the end of the buffer, count in some empty lines.  */               the end of the buffer, count in some empty lines.  */
4784            if (it.vpos < nlines)            if (it.vpos < nlines)
4785              y1 += (nlines - it.vpos) * CANON_Y_UNIT (it.f);              y1 += (nlines - it.vpos) * CANON_Y_UNIT (it.f);
4786              
4787            h = window_box_height (w) - (y1 - y0);            h = window_box_height (w) - (y1 - y0);
4788    
4789            start_display (&it, w, pt);            start_display (&it, w, pt);
# Line 4808  and redisplay normally--don't erase and Line 4808  and redisplay normally--don't erase and
4808          arg = make_number (ht / 2);          arg = make_number (ht / 2);
4809        else if (XINT (arg) < 0)        else if (XINT (arg) < 0)
4810          arg = make_number (XINT (arg) + ht);          arg = make_number (XINT (arg) + ht);
4811          
4812        pos = *vmotion (PT, - XINT (arg), w);        pos = *vmotion (PT, - XINT (arg), w);
4813        charpos = pos.bufpos;        charpos = pos.bufpos;
4814        bytepos = pos.bytepos;        bytepos = pos.bytepos;
# Line 4817  and redisplay normally--don't erase and Line 4817  and redisplay normally--don't erase and
4817    /* Set the new window start.  */    /* Set the new window start.  */
4818    set_marker_both (w->start, w->buffer, charpos, bytepos);    set_marker_both (w->start, w->buffer, charpos, bytepos);
4819    w->window_end_valid = Qnil;    w->window_end_valid = Qnil;
4820      
4821    w->optional_new_start = Qt;    w->optional_new_start = Qt;
4822    
4823    if (bytepos == BEGV_BYTE || FETCH_BYTE (bytepos - 1) == '\n')    if (bytepos == BEGV_BYTE || FETCH_BYTE (bytepos - 1) == '\n')
4824      w->start_at_line_beg = Qt;      w->start_at_line_beg = Qt;
4825    else    else
4826      w->start_at_line_beg = Qnil;      w->start_at_line_beg = Qnil;
4827      
4828    set_buffer_internal (obuf);    set_buffer_internal (obuf);
4829    return Qnil;    return Qnil;
4830  }  }
# Line 5000  the return value is nil.  Otherwise the Line 5000  the return value is nil.  Otherwise the
5000    
5001    frame = XWINDOW (SAVED_WINDOW_N (saved_windows, 0)->window)->frame;    frame = XWINDOW (SAVED_WINDOW_N (saved_windows, 0)->window)->frame;
5002    f = XFRAME (frame);    f = XFRAME (frame);
5003      
5004    /* If f is a dead frame, don't bother rebuilding its window tree.    /* If f is a dead frame, don't bother rebuilding its window tree.
5005       However, there is other stuff we should still try to do below.  */       However, there is other stuff we should still try to do below.  */
5006    if (FRAME_LIVE_P (f))    if (FRAME_LIVE_P (f))
# Line 5057  the return value is nil.  Otherwise the Line 5057  the return value is nil.  Otherwise the
5057        FRAME_WINDOW_SIZES_CHANGED (f) = 1;        FRAME_WINDOW_SIZES_CHANGED (f) = 1;
5058    
5059        /* Problem: Freeing all matrices and later allocating them again        /* Problem: Freeing all matrices and later allocating them again
5060           is a serious redisplay flickering problem.  What we would           is a serious redisplay flickering problem.  What we would
5061           really like to do is to free only those matrices not reused           really like to do is to free only those matrices not reused
5062           below.   */           below.   */
5063        root_window = XWINDOW (FRAME_ROOT_WINDOW (f));        root_window = XWINDOW (FRAME_ROOT_WINDOW (f));
# Line 5192  the return value is nil.  Otherwise the Line 5192  the return value is nil.  Otherwise the
5192          set_marker_restricted (XWINDOW (data->current_window)->pointm,          set_marker_restricted (XWINDOW (data->current_window)->pointm,
5193                                 make_number (old_point),                                 make_number (old_point),
5194                                 XWINDOW (data->current_window)->buffer);                                 XWINDOW (data->current_window)->buffer);
5195                      
5196        Fselect_window (data->current_window);        Fselect_window (data->current_window);
5197        XBUFFER (XWINDOW (selected_window)->buffer)->last_selected_window        XBUFFER (XWINDOW (selected_window)->buffer)->last_selected_window
5198          = selected_window;          = selected_window;
# Line 5231  the return value is nil.  Otherwise the Line 5231  the return value is nil.  Otherwise the
5231            if (NILP (leaf_windows[i]->buffer))            if (NILP (leaf_windows[i]->buffer))
5232              {              {
5233                /* Assert it's not reused as a combination.  */                /* Assert it's not reused as a combination.  */
5234                xassert (NILP (leaf_windows[i]->hchild)                xassert (NILP (leaf_windows[i]->hchild)
5235                         && NILP (leaf_windows[i]->vchild));                         && NILP (leaf_windows[i]->vchild));
5236                free_window_matrices (leaf_windows[i]);                free_window_matrices (leaf_windows[i]);
5237              }              }
5238            else if (EQ (leaf_windows[i]->buffer, new_current_buffer))            else if (EQ (leaf_windows[i]->buffer, new_current_buffer))
5239              ++n;              ++n;
5240          }          }
5241          
5242        adjust_glyphs (f);        adjust_glyphs (f);
5243    
5244        UNBLOCK_INPUT;        UNBLOCK_INPUT;
# Line 5314  count_windows (window) Line 5314  count_windows (window)
5314  }  }
5315    
5316    
5317  /* Fill vector FLAT with leaf windows under W, starting at index I.    /* Fill vector FLAT with leaf windows under W, starting at index I.
5318     Value is last index + 1.  */     Value is last index + 1.  */
5319    
5320  static int  static int
# Line 5329  get_leaf_windows (w, flat, i) Line 5329  get_leaf_windows (w, flat, i)
5329          i = get_leaf_windows (XWINDOW (w->hchild), flat, i);          i = get_leaf_windows (XWINDOW (w->hchild), flat, i);
5330        else if (!NILP (w->vchild))        else if (!NILP (w->vchild))
5331          i = get_leaf_windows (XWINDOW (w->vchild), flat, i);          i = get_leaf_windows (XWINDOW (w->vchild), flat, i);
5332        else        else
5333          flat[i++] = w;          flat[i++] = w;
5334    
5335        w = NILP (w->next) ? 0 : XWINDOW (w->next);        w = NILP (w->next) ? 0 : XWINDOW (w->next);
# Line 5541  A nil width parameter means no margin. Line 5541  A nil width parameter means no margin.
5541       XSETFASTINT (left, 0);       XSETFASTINT (left, 0);
5542    if (INTEGERP (left) && XFASTINT (left) == 0)    if (INTEGERP (left) && XFASTINT (left) == 0)
5543      left = Qnil;      left = Qnil;
5544      
5545    if ((INTEGERP (right) && XINT (right) < 0)    if ((INTEGERP (right) && XINT (right) < 0)
5546        || (FLOATP (right) && XFLOAT_DATA (right) <= 0))        || (FLOATP (right) && XFLOAT_DATA (right) <= 0))
5547      XSETFASTINT (right, 0);      XSETFASTINT (right, 0);
# Line 5587  Value is a multiple of the canonical cha Line 5587  Value is a multiple of the canonical cha
5587    Lisp_Object result;    Lisp_Object result;
5588    struct frame *f;    struct frame *f;
5589    struct window *w;    struct window *w;
5590      
5591    if (NILP (window))    if (NILP (window))
5592      window = selected_window;      window = selected_window;
5593    else    else
5594      CHECK_WINDOW (window);      CHECK_WINDOW (window);
5595    w = XWINDOW (window);    w = XWINDOW (window);
5596    f = XFRAME (w->frame);    f = XFRAME (w->frame);
5597      
5598    if (FRAME_WINDOW_P (f))    if (FRAME_WINDOW_P (f))
5599      result = CANON_Y_FROM_PIXEL_Y (f, -w->vscroll);      result = CANON_Y_FROM_PIXEL_Y (f, -w->vscroll);
5600    else    else
# Line 5613  multiple of the canonical character heig Line 5613  multiple of the canonical character heig
5613  {  {
5614    struct window *w;    struct window *w;
5615    struct frame *f;    struct frame *f;
5616      
5617    if (NILP (window))    if (NILP (window))
5618      window = selected_window;      window = selected_window;
5619    else    else
5620      CHECK_WINDOW (window);      CHECK_WINDOW (window);
5621    CHECK_NUMBER_OR_FLOAT (vscroll);    CHECK_NUMBER_OR_FLOAT (vscroll);
5622      
5623    w = XWINDOW (window);    w = XWINDOW (window);
5624    f = XFRAME (w->frame);    f = XFRAME (w->frame);
5625    
5626    if (FRAME_WINDOW_P (f))    if (FRAME_WINDOW_P (f))
5627      {      {
5628        int old_dy = w->vscroll;        int old_dy = w->vscroll;
5629          
5630        w->vscroll = - CANON_Y_UNIT (f) * XFLOATINT (vscroll);        w->vscroll = - CANON_Y_UNIT (f) * XFLOATINT (vscroll);
5631        w->vscroll = min (w->vscroll, 0);        w->vscroll = min (w->vscroll, 0);
5632    
# Line 5634  multiple of the canonical character heig Line 5634  multiple of the canonical character heig
5634           area becomes larger than before.  */           area becomes larger than before.  */
5635        if (w->vscroll < 0 && w->vscroll < old_dy)        if (w->vscroll < 0 && w->vscroll < old_dy)
5636          adjust_glyphs (f);          adjust_glyphs (f);
5637          
5638        /* Prevent redisplay shortcuts.  */        /* Prevent redisplay shortcuts.  */
5639        XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1;        XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1;
5640      }      }
5641      
5642    return Fwindow_vscroll (window);    return Fwindow_vscroll (window);
5643  }  }
5644          
5645    
5646  /* Call FN for all leaf windows on frame F.  FN is called with the  /* Call FN for all leaf windows on frame F.  FN is called with the
5647     first argument being a pointer to the leaf window, and with     first argument being a pointer to the leaf window, and with
# Line 5669  foreach_window_1 (w, fn, user_data) Line 5669  foreach_window_1 (w, fn, user_data)
5669       void *user_data;       void *user_data;
5670  {  {
5671    int cont;    int cont;
5672      
5673    for (cont = 1; w && cont;)    for (cont = 1; w && cont;)
5674      {      {
5675        if (!NILP (w->hchild))        if (!NILP (w->hchild))
5676          cont = foreach_window_1 (XWINDOW (w->hchild), fn, user_data);          cont = foreach_window_1 (XWINDOW (w->hchild), fn, user_data);
5677        else if (!NILP (w->vchild))        else if (!NILP (w->vchild))
5678          cont = foreach_window_1 (XWINDOW (w->vchild), fn, user_data);          cont = foreach_window_1 (XWINDOW (w->vchild), fn, user_data);
5679        else        else
5680          cont = fn (w, user_data);          cont = fn (w, user_data);
5681          
5682        w = NILP (w->next) ? 0 : XWINDOW (w->next);        w = NILP (w->next) ? 0 : XWINDOW (w->next);
5683      }      }
5684    
# Line 5701  freeze_window_start (w, freeze_p) Line 5701  freeze_window_start (w, freeze_p)
5701            && ! NILP (Vminibuf_scroll_window)            && ! NILP (Vminibuf_scroll_window)
5702            && w == XWINDOW (Vminibuf_scroll_window)))            && w == XWINDOW (Vminibuf_scroll_window)))
5703      freeze_p = NULL;      freeze_p = NULL;
5704      
5705    w->frozen_window_start_p = freeze_p != NULL;    w->frozen_window_start_p = freeze_p != NULL;
5706    return 1;    return 1;
5707  }  }
# Line 5740  compare_window_configurations (c1, c2, i Line 5740  compare_window_configurations (c1, c2, i
5740      wrong_type_argument (Qwindow_configuration_p, c1);      wrong_type_argument (Qwindow_configuration_p, c1);
5741    if (!WINDOW_CONFIGURATIONP (c2))    if (!WINDOW_CONFIGURATIONP (c2))
5742      wrong_type_argument (Qwindow_configuration_p, c2);      wrong_type_argument (Qwindow_configuration_p, c2);
5743      
5744    d1 = (struct save_window_data *) XVECTOR (c1);    d1 = (struct save_window_data *) XVECTOR (c1);
5745    d2 = (struct save_window_data *) XVECTOR (c2);    d2 = (struct save_window_data *) XVECTOR (c2);
5746    sw1 = XVECTOR (d1->saved_windows);    sw1 = XVECTOR (d1->saved_windows);
# Line 5871  syms_of_window () Line 5871  syms_of_window ()
5871  {  {
5872    Qwindow_size_fixed = intern ("window-size-fixed");    Qwindow_size_fixed = intern ("window-size-fixed");
5873    staticpro (&Qwindow_size_fixed);    staticpro (&Qwindow_size_fixed);
5874      
5875    staticpro (&Qwindow_configuration_change_hook);    staticpro (&Qwindow_configuration_change_hook);
5876    Qwindow_configuration_change_hook    Qwindow_configuration_change_hook
5877      = intern ("window-configuration-change-hook");      = intern ("window-configuration-change-hook");

Legend:
Removed from v.1.434  
changed lines
  Added in v.1.435

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26