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

Diff of /emacs/src/xterm.c

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

revision 1.650.4.22 by kfstorm, Fri Feb 1 21:13:00 2002 UTC revision 1.650.4.23 by monnier, Wed Mar 13 17:11:49 2002 UTC
# Line 8521  xm_scroll_callback (widget, client_data, Line 8521  xm_scroll_callback (widget, client_data,
8521          XtVaGetValues (widget, XmNsliderSize, &slider_size, NULL);          XtVaGetValues (widget, XmNsliderSize, &slider_size, NULL);
8522          UNBLOCK_INPUT;          UNBLOCK_INPUT;
8523    
8524          /* At the max position of the scroll bar, do a line-wise          whole = XM_SB_RANGE - slider_size;
8525             movement.  Without doing anything, we would be called with          portion = min (cs->value - XM_SB_MIN, whole);
8526             the same cs->value again and again.  If we want to make          part = scroll_bar_handle;
8527             sure that we can reach the end of the buffer, we have to do          bar->dragging = make_number (cs->value);
            something.  
   
            Implementation note: setting bar->dragging always to  
            cs->value gives a smoother movement at the max position.  
            Setting it to nil when doing line-wise movement gives  
            a better slider behavior. */  
           
         if (cs->value + slider_size == XM_SB_MAX  
             || (dragging_down_p  
                 && last_scroll_bar_part == scroll_bar_down_arrow))  
           {  
             part = scroll_bar_down_arrow;  
             bar->dragging = Qnil;  
           }  
         else  
           {  
             whole = XM_SB_RANGE;  
             portion = min (cs->value - XM_SB_MIN, XM_SB_MAX - slider_size);  
             part = scroll_bar_handle;  
             bar->dragging = make_number (cs->value);  
           }  
8528        }        }
8529        break;        break;
8530                
# Line 8795  x_set_toolkit_scroll_bar_thumb (bar, por Line 8774  x_set_toolkit_scroll_bar_thumb (bar, por
8774    Widget widget = SCROLL_BAR_X_WIDGET (FRAME_X_DISPLAY (f), bar);    Widget widget = SCROLL_BAR_X_WIDGET (FRAME_X_DISPLAY (f), bar);
8775    float top, shown;    float top, shown;
8776    
8777    if (whole == 0)    BLOCK_INPUT;
8778    
8779    #ifdef USE_MOTIF
8780    
8781      /* We use an estimate of 30 chars per line rather than the real
8782         `portion' value.  This has the disadvantage that the thumb size
8783         is not very representative, but it makes our life a lot easier.
8784         Otherwise, we have to constantly adjust the thumb size, which
8785         we can't always do quickly enough: while dragging, the size of
8786         the thumb might prevent the user from dragging the thumb all the
8787         way to the end.  but Motif and some versions of Xaw3d don't allow
8788         updating the thumb size while dragging.  Also, even if we can update
8789         its size, the update will often happen too late.
8790         If you don't believe it, check out revision 1.650 of xterm.c to see
8791         what hoops we were going through and the still poor behavior we got.  */
8792      portion = XFASTINT (XWINDOW (bar->window)->height) * 30;
8793      /* When the thumb is at the bottom, position == whole.
8794         So we need to increase `whole' to make space for the thumb.  */
8795      whole += portion;
8796    
8797      if (whole <= 0)
8798      top = 0, shown = 1;      top = 0, shown = 1;
8799    else    else
8800      {      {
# Line 8803  x_set_toolkit_scroll_bar_thumb (bar, por Line 8802  x_set_toolkit_scroll_bar_thumb (bar, por
8802        shown = (float) portion / whole;        shown = (float) portion / whole;
8803      }      }
8804    
8805    BLOCK_INPUT;    if (NILP (bar->dragging))
8806        {
8807  #ifdef USE_MOTIF        int size, value;
   {  
     int size, value;  
     XmScrollBarWidget sb;  
   
     /* Slider size.  Must be in the range [1 .. MAX - MIN] where MAX  
        is the scroll bar's maximum and MIN is the scroll bar's minimum  
        value.  */  
     size = shown * XM_SB_RANGE;  
     size = min (size, XM_SB_RANGE);  
     size = max (size, 1);  
   
     /* Position.  Must be in the range [MIN .. MAX - SLIDER_SIZE].  */  
     value = top * XM_SB_RANGE;  
     value = min (value, XM_SB_MAX - size);  
     value = max (value, XM_SB_MIN);  
8808    
8809      if (NILP (bar->dragging))        /* Slider size.  Must be in the range [1 .. MAX - MIN] where MAX
8810             is the scroll bar's maximum and MIN is the scroll bar's minimum
8811             value.  */
8812          size = shown * XM_SB_RANGE;
8813          size = min (size, XM_SB_RANGE);
8814          size = max (size, 1);
8815    
8816          /* Position.  Must be in the range [MIN .. MAX - SLIDER_SIZE].  */
8817          value = top * XM_SB_RANGE;
8818          value = min (value, XM_SB_MAX - size);
8819          value = max (value, XM_SB_MIN);
8820          
8821        XmScrollBarSetValues (widget, value, size, 0, 0, False);        XmScrollBarSetValues (widget, value, size, 0, 0, False);
8822      else if (last_scroll_bar_part == scroll_bar_down_arrow)      }
       /* This has the negative side effect that the slider value is  
          not what it would be if we scrolled here using line-wise or  
          page-wise movement.  */  
       XmScrollBarSetValues (widget, value, XM_SB_RANGE - value, 0, 0, False);  
     else  
       {  
         /* If currently dragging, only update the slider size.  
            This reduces flicker effects.  */  
         int old_value, old_size, increment, page_increment;  
           
         XmScrollBarGetValues (widget, &old_value, &old_size,  
                               &increment, &page_increment);  
         XmScrollBarSetValues (widget, old_value,  
                               min (size, XM_SB_RANGE - old_value),  
                               0, 0, False);  
       }  
   }  
8823  #else /* !USE_MOTIF i.e. use Xaw */  #else /* !USE_MOTIF i.e. use Xaw */
8824    
8825      if (whole == 0)
8826        top = 0, shown = 1;
8827      else
8828        {
8829          top = (float) position / whole;
8830          shown = (float) portion / whole;
8831        }
8832    
8833    {    {
8834      float old_top, old_shown;      float old_top, old_shown;
8835      Dimension height;      Dimension height;
# Line 9867  static struct x_display_info *next_noop_ Line 9854  static struct x_display_info *next_noop_
9854    
9855     EXPECTED is nonzero if the caller knows input is available.  */     EXPECTED is nonzero if the caller knows input is available.  */
9856    
9857  int  static int
9858  XTread_socket (sd, bufp, numchars, expected)  XTread_socket (sd, bufp, numchars, expected)
9859       register int sd;       register int sd;
9860       /* register */ struct input_event *bufp;       /* register */ struct input_event *bufp;

Legend:
Removed from v.1.650.4.22  
changed lines
  Added in v.1.650.4.23

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