diff src/scrollbar.c @ 70:131b0175ea99 r20-0b30

Import from CVS: tag r20-0b30
author cvs
date Mon, 13 Aug 2007 09:02:59 +0200
parents 441bb1e64a06
children 6a378aca36af
line wrap: on
line diff
--- a/src/scrollbar.c	Mon Aug 13 09:00:04 2007 +0200
+++ b/src/scrollbar.c	Mon Aug 13 09:02:59 2007 +0200
@@ -405,7 +405,7 @@
   struct device *d = XDEVICE (f->device);
   struct buffer *b = XBUFFER (w->buffer);
   Bufpos start_pos, end_pos, sb_pos;
-  int scrollbar_width  = window_scrollbar_width  (w);
+  int scrollbar_width = window_scrollbar_width (w);
   int scrollbar_height = window_scrollbar_height (w);
 
   int new_line_increment = -1, new_page_increment = -1;
@@ -451,38 +451,37 @@
   new_line_increment = 1;
   new_page_increment = 1;
 
-  /* We used to check for inhibit_scrollbar_slider_size_change here,
-     but that seems bogus.  */
-  {
-    int x_offset, y_offset;
+  if (!DEVMETH_OR_GIVEN (d, inhibit_scrollbar_thumb_size_change, (), 0))
+    {
+      int x_offset, y_offset;
 
-    /* Scrollbars are always the farthest from the text area. */
-    if (vertical)
-      {
-	x_offset = (f->scrollbar_on_left
-		    ? WINDOW_LEFT (w)
-		    : WINDOW_RIGHT (w) - scrollbar_width);
-	y_offset = WINDOW_TEXT_TOP (w) + f->scrollbar_y_offset;
-      }
-    else
-      {
-	x_offset = WINDOW_TEXT_LEFT (w);
-	y_offset = f->scrollbar_y_offset +
-	  (f->scrollbar_on_top
-	   ? WINDOW_TOP (w)
-	   : WINDOW_TEXT_BOTTOM (w) + window_bottom_toolbar_height (w));
-      }
+      /* Scrollbars are always the farthest from the text area. */
+      if (vertical)
+	{
+	  x_offset = (f->scrollbar_on_left
+		      ? WINDOW_LEFT (w)
+		      : WINDOW_RIGHT (w) - scrollbar_width);
+	  y_offset = WINDOW_TEXT_TOP (w) + f->scrollbar_y_offset;
+	}
+      else
+	{
+	  x_offset = WINDOW_TEXT_LEFT (w);
+	  y_offset = f->scrollbar_y_offset +
+	    (f->scrollbar_on_top
+	     ? WINDOW_TOP (w)
+	     : WINDOW_TEXT_BOTTOM (w) + window_bottom_toolbar_height (w));
+	}
 
-    new_x = x_offset;
-    new_y = y_offset;
-  }
+      new_x = x_offset;
+      new_y = y_offset;
+    }
 
   /* A disabled scrollbar has its slider sized to the entire height of
      the scrollbar.  Currently the minibuffer scrollbar is
      disabled. */
   if (!MINI_WINDOW_P (w) && vertical)
     {
-      if (!DEVMETH_OR_GIVEN (d, inhibit_scrollbar_slider_size_change, (), 0))
+      if (!DEVMETH_OR_GIVEN (d, inhibit_scrollbar_thumb_size_change, (), 0))
 	{
 	  new_minimum = BUF_BEGV (b);
 	  new_maximum = max (BUF_ZV (b), new_minimum + 1);
@@ -515,7 +514,7 @@
       new_slider_size = wcw;
       new_slider_position = min (w->hscroll, max_slide);
     }
-  else /* MINI_WINDOW_P (w) */
+  else
     {
       new_minimum = 1;
       new_maximum = 2;
@@ -721,8 +720,7 @@
      with their standard behaviors.  It is not possible to hide the
      differences down in lwlib because knowledge of XEmacs buffer and
      cursor motion routines is necessary. */
-#if defined (LWLIB_SCROLLBARS_MOTIF) || defined (LWLIB_SCROLLBARS_LUCID) || \
-    defined (LWLIB_SCROLLBARS_ATHENA3D)
+#if defined (LWLIB_SCROLLBARS_MOTIF) || defined (LWLIB_SCROLLBARS_LUCID)
   window_scroll (window, Qnil, -1, ERROR_ME_NOT);
 #else /* Athena */
   {
@@ -762,8 +760,7 @@
      with their standard behaviors.  It is not possible to hide the
      differences down in lwlib because knowledge of XEmacs buffer and
      cursor motion routines is necessary. */
-#if defined (LWLIB_SCROLLBARS_MOTIF) || defined (LWLIB_SCROLLBARS_LUCID) || \
-    defined (LWLIB_SCROLLBARS_ATHENA3D)
+#if defined (LWLIB_SCROLLBARS_MOTIF) || defined (LWLIB_SCROLLBARS_LUCID)
   window_scroll (window, Qnil, 1, ERROR_ME_NOT);
 #else /* Athena */
   {
@@ -778,15 +775,16 @@
 }
 
 DEFUN ("scrollbar-to-top", Fscrollbar_to_top, 1, 1, 0, /*
-Function called when the user invokes the \"to-top\" scrollbar action.
-The way this is done can vary from scrollbar to scrollbar, but
-C-button1 on the up-arrow is very common. One argument, the
-scrollbar's window.  You can advise this function to change the
+Function called when the user gives the \"to-top\" scrollbar action.
+(The way this is done can vary from scrollbar to scrollbar.). One argument,
+the scrollbar's window.  You can advise this function to change the
 scrollbar behavior.
 */
        (window))
 {
-  Lisp_Object orig_pt = Fwindow_point (window);
+  Lisp_Object orig_pt;
+
+  orig_pt = Fwindow_point (window);
   Fset_window_point (window, Fpoint_min (Fwindow_buffer (window)));
   Frecenter (Qzero, window);
   scrollbar_reset_cursor (window, orig_pt);
@@ -795,24 +793,25 @@
 }
 
 DEFUN ("scrollbar-to-bottom", Fscrollbar_to_bottom, 1, 1, 0, /*
-Function called when the user invokes the \"to-bottom\" scrollbar action.
-The way this is done can vary from scrollbar to scrollbar, but
-C-button1 on the down-arrow is very common. One argument, the
-scrollbar's window.  You can advise this function to change the
+Function called when the user gives the \"to-bottom\" scrollbar action.
+(The way this is done can vary from scrollbar to scrollbar.). One argument,
+the scrollbar's window.  You can advise this function to change the
 scrollbar behavior.
 */
        (window))
 {
-  Lisp_Object orig_pt = Fwindow_point (window);
+  Lisp_Object orig_pt;
+
+  orig_pt = Fwindow_point (window);
   Fset_window_point (window, Fpoint_max (Fwindow_buffer (window)));
-  Frecenter (make_int (-3), window);
+  Frecenter (Qzero, window);
   scrollbar_reset_cursor (window, orig_pt);
   zmacs_region_stays = 1;
   return Qnil;
 }
 
 DEFUN ("scrollbar-vertical-drag", Fscrollbar_vertical_drag, 1, 1, 0, /*
-Function called when the user drags the vertical scrollbar slider.
+Function called when the user drags the vertical scrollbar thumb.
 One argument, a cons containing the scrollbar's window and a value
 between point-min and point-max.  You can advise this function to
 change the scrollbar behavior.
@@ -848,9 +847,7 @@
 
   w = XWINDOW (window);
   wcw = window_char_width (w, 0) - 1;
-  /* ### We should be able to scroll further right as long as there is
-     a visible truncation glyph.  This calculation for max is bogus.  */
-  max_len = w->max_line_len + 2;
+  max_len = w->max_line_len + 1;
 
   if (EQ (value, Qmax) || (XINT (value) > (max_len - wcw)))
     hscroll = max_len - wcw;