aboutsummaryrefslogtreecommitdiffstats
path: root/src/window.c
diff options
context:
space:
mode:
authorKaroly Lorentey2004-04-23 14:44:11 +0000
committerKaroly Lorentey2004-04-23 14:44:11 +0000
commitced7ed5611e2a6e60a5ac7a97e165545843d0fa9 (patch)
tree85194b67c680d1a37af652a4b614a7e1fcd336ba /src/window.c
parent6ad9aaa961f1ac376bdaa1a5516d0481e6c7fafa (diff)
parentf24814e0e9806db8d01c16b8d8592d6e9b9ee481 (diff)
downloademacs-ced7ed5611e2a6e60a5ac7a97e165545843d0fa9.tar.gz
emacs-ced7ed5611e2a6e60a5ac7a97e165545843d0fa9.zip
Merged in changes from CVS trunk.
Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-230 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-231 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-232 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-233 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-234 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-235 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-236 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-237 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-238 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-239 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-240 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-152
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c95
1 files changed, 44 insertions, 51 deletions
diff --git a/src/window.c b/src/window.c
index b6546eee698..221d8bbbaf2 100644
--- a/src/window.c
+++ b/src/window.c
@@ -324,7 +324,11 @@ DEFUN ("pos-visible-in-window-p", Fpos_visible_in_window_p,
324Return nil if that position is scrolled vertically out of view. 324Return nil if that position is scrolled vertically out of view.
325If a character is only partially visible, nil is returned, unless the 325If a character is only partially visible, nil is returned, unless the
326optional argument PARTIALLY is non-nil. 326optional argument PARTIALLY is non-nil.
327POS defaults to point in WINDOW; WINDOW defaults to the selected window. */) 327POS defaults to point in WINDOW; WINDOW defaults to the selected window.
328
329If POS is visible, return t if PARTIALLY is nil; if PARTIALLY is non-nil,
330return value is a list (X Y PARTIAL) where X and Y are the pixel relative
331coordinate */)
328 (pos, window, partially) 332 (pos, window, partially)
329 Lisp_Object pos, window, partially; 333 Lisp_Object pos, window, partially;
330{ 334{
@@ -332,8 +336,9 @@ POS defaults to point in WINDOW; WINDOW defaults to the selected window. */)
332 register int posint; 336 register int posint;
333 register struct buffer *buf; 337 register struct buffer *buf;
334 struct text_pos top; 338 struct text_pos top;
335 Lisp_Object in_window; 339 Lisp_Object in_window = Qnil;
336 int fully_p; 340 int fully_p = 1;
341 int x, y;
337 342
338 w = decode_window (window); 343 w = decode_window (window);
339 buf = XBUFFER (w->buffer); 344 buf = XBUFFER (w->buffer);
@@ -349,38 +354,20 @@ POS defaults to point in WINDOW; WINDOW defaults to the selected window. */)
349 else 354 else
350 posint = XMARKER (w->pointm)->charpos; 355 posint = XMARKER (w->pointm)->charpos;
351 356
352 /* If position is above window start, it's not visible. */ 357 /* If position is above window start or outside buffer boundaries,
353 if (posint < CHARPOS (top)) 358 or if window start is out of range, position is not visible. */
354 in_window = Qnil; 359 if (posint >= CHARPOS (top)
355 else if (XFASTINT (w->last_modified) >= BUF_MODIFF (buf) 360 && posint <= BUF_ZV (buf)
356 && XFASTINT (w->last_overlay_modified) >= BUF_OVERLAY_MODIFF (buf) 361 && CHARPOS (top) >= BUF_BEGV (buf)
357 && posint < BUF_Z (buf) - XFASTINT (w->window_end_pos)) 362 && CHARPOS (top) <= BUF_ZV (buf)
358 { 363 && pos_visible_p (w, posint, &fully_p, &x, &y, NILP (partially))
359 /* If frame is up-to-date, and POSINT is < window end pos, use 364 && (!NILP (partially) || fully_p))
360 that info. This doesn't work for POSINT == end pos, because 365 in_window = Qt;
361 the window end pos is actually the position _after_ the last 366
362 char in the window. */ 367 if (!NILP (in_window) && !NILP (partially))
363 if (NILP (partially)) 368 in_window = Fcons (make_number (x),
364 { 369 Fcons (make_number (y),
365 pos_visible_p (w, posint, &fully_p, NILP (partially)); 370 Fcons (fully_p ? Qt : Qnil, Qnil)));
366 in_window = fully_p ? Qt : Qnil;
367 }
368 else
369 in_window = Qt;
370 }
371 else if (posint > BUF_ZV (buf))
372 in_window = Qnil;
373 else if (CHARPOS (top) < BUF_BEGV (buf) || CHARPOS (top) > BUF_ZV (buf))
374 /* If window start is out of range, do something reasonable. */
375 in_window = Qnil;
376 else
377 {
378 if (pos_visible_p (w, posint, &fully_p, NILP (partially)))
379 in_window = !NILP (partially) || fully_p ? Qt : Qnil;
380 else
381 in_window = Qnil;
382 }
383
384 return in_window; 371 return in_window;
385} 372}
386 373
@@ -3462,7 +3449,7 @@ DEFUN ("force-window-update", Fforce_window_update, Sforce_window_update,
3462 0, 1, 0, 3449 0, 1, 0,
3463 doc: /* Force redisplay of all windows. 3450 doc: /* Force redisplay of all windows.
3464If optional arg OBJECT is a window, force redisplay of that window only. 3451If optional arg OBJECT is a window, force redisplay of that window only.
3465If OBJECT is a buffer or buffer name, force redisplay of all windows 3452If OBJECT is a buffer or buffer name, force redisplay of all windows
3466displaying that buffer. */) 3453displaying that buffer. */)
3467 (object) 3454 (object)
3468 Lisp_Object object; 3455 Lisp_Object object;
@@ -3484,7 +3471,7 @@ displaying that buffer. */)
3484 ++update_mode_lines; 3471 ++update_mode_lines;
3485 return Qt; 3472 return Qt;
3486 } 3473 }
3487 3474
3488 if (STRINGP (object)) 3475 if (STRINGP (object))
3489 object = Fget_buffer (object); 3476 object = Fget_buffer (object);
3490 if (BUFFERP (object) && !NILP (XBUFFER (object)->name)) 3477 if (BUFFERP (object) && !NILP (XBUFFER (object)->name))
@@ -3549,7 +3536,7 @@ temp_output_buffer_show (buf)
3549 Lisp_Object prev_window, prev_buffer; 3536 Lisp_Object prev_window, prev_buffer;
3550 prev_window = selected_window; 3537 prev_window = selected_window;
3551 XSETBUFFER (prev_buffer, old); 3538 XSETBUFFER (prev_buffer, old);
3552 3539
3553 /* Select the window that was chosen, for running the hook. 3540 /* Select the window that was chosen, for running the hook.
3554 Note: Both Fselect_window and select_window_norecord may 3541 Note: Both Fselect_window and select_window_norecord may
3555 set-buffer to the buffer displayed in the window, 3542 set-buffer to the buffer displayed in the window,
@@ -6069,7 +6056,7 @@ If TYPE is t, use the frame's scroll-bar type. */)
6069 vertical_type = Qnil; 6056 vertical_type = Qnil;
6070 6057
6071 if (!(EQ (vertical_type, Qnil) 6058 if (!(EQ (vertical_type, Qnil)
6072 || EQ (vertical_type, Qleft) 6059 || EQ (vertical_type, Qleft)
6073 || EQ (vertical_type, Qright) 6060 || EQ (vertical_type, Qright)
6074 || EQ (vertical_type, Qt))) 6061 || EQ (vertical_type, Qt)))
6075 error ("Invalid type of vertical scroll bar"); 6062 error ("Invalid type of vertical scroll bar");
@@ -6118,12 +6105,13 @@ value. */)
6118 Smooth scrolling 6105 Smooth scrolling
6119 ***********************************************************************/ 6106 ***********************************************************************/
6120 6107
6121DEFUN ("window-vscroll", Fwindow_vscroll, Swindow_vscroll, 0, 1, 0, 6108DEFUN ("window-vscroll", Fwindow_vscroll, Swindow_vscroll, 0, 2, 0,
6122 doc: /* Return the amount by which WINDOW is scrolled vertically. 6109 doc: /* Return the amount by which WINDOW is scrolled vertically.
6123Use the selected window if WINDOW is nil or omitted. 6110Use the selected window if WINDOW is nil or omitted.
6124Value is a multiple of the canonical character height of WINDOW. */) 6111Normally, value is a multiple of the canonical character height of WINDOW;
6125 (window) 6112optional second arg PIXELS_P means value is measured in pixels. */)
6126 Lisp_Object window; 6113 (window, pixels_p)
6114 Lisp_Object window, pixels_p;
6127{ 6115{
6128 Lisp_Object result; 6116 Lisp_Object result;
6129 struct frame *f; 6117 struct frame *f;
@@ -6137,7 +6125,9 @@ Value is a multiple of the canonical character height of WINDOW. */)
6137 f = XFRAME (w->frame); 6125 f = XFRAME (w->frame);
6138 6126
6139 if (FRAME_WINDOW_P (f)) 6127 if (FRAME_WINDOW_P (f))
6140 result = FRAME_CANON_Y_FROM_PIXEL_Y (f, -w->vscroll); 6128 result = (NILP (pixels_p)
6129 ? FRAME_CANON_Y_FROM_PIXEL_Y (f, -w->vscroll)
6130 : make_number (-w->vscroll));
6141 else 6131 else
6142 result = make_number (0); 6132 result = make_number (0);
6143 return result; 6133 return result;
@@ -6145,12 +6135,13 @@ Value is a multiple of the canonical character height of WINDOW. */)
6145 6135
6146 6136
6147DEFUN ("set-window-vscroll", Fset_window_vscroll, Sset_window_vscroll, 6137DEFUN ("set-window-vscroll", Fset_window_vscroll, Sset_window_vscroll,
6148 2, 2, 0, 6138 2, 3, 0,
6149 doc: /* Set amount by which WINDOW should be scrolled vertically to VSCROLL. 6139 doc: /* Set amount by which WINDOW should be scrolled vertically to VSCROLL.
6150WINDOW nil means use the selected window. VSCROLL is a non-negative 6140WINDOW nil means use the selected window. Normally, VSCROLL is a
6151multiple of the canonical character height of WINDOW. */) 6141non-negative multiple of the canonical character height of WINDOW;
6152 (window, vscroll) 6142optional third arg PIXELS_P non-nil means that VSCROLL is in pixels. */)
6153 Lisp_Object window, vscroll; 6143 (window, vscroll, pixels_p)
6144 Lisp_Object window, vscroll, pixels_p;
6154{ 6145{
6155 struct window *w; 6146 struct window *w;
6156 struct frame *f; 6147 struct frame *f;
@@ -6168,7 +6159,9 @@ multiple of the canonical character height of WINDOW. */)
6168 { 6159 {
6169 int old_dy = w->vscroll; 6160 int old_dy = w->vscroll;
6170 6161
6171 w->vscroll = - FRAME_LINE_HEIGHT (f) * XFLOATINT (vscroll); 6162 w->vscroll = - (NILP (pixels_p)
6163 ? FRAME_LINE_HEIGHT (f) * XFLOATINT (vscroll)
6164 : XFLOATINT (vscroll));
6172 w->vscroll = min (w->vscroll, 0); 6165 w->vscroll = min (w->vscroll, 0);
6173 6166
6174 /* Adjust glyph matrix of the frame if the virtual display 6167 /* Adjust glyph matrix of the frame if the virtual display
@@ -6180,7 +6173,7 @@ multiple of the canonical character height of WINDOW. */)
6180 XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; 6173 XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1;
6181 } 6174 }
6182 6175
6183 return Fwindow_vscroll (window); 6176 return Fwindow_vscroll (window, pixels_p);
6184} 6177}
6185 6178
6186 6179