/[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.712 by gerd, Mon Mar 11 18:49:27 2002 UTC revision 1.713 by monnier, Wed Mar 13 17:04:49 2002 UTC
# Line 8553  xm_scroll_callback (widget, client_data, Line 8553  xm_scroll_callback (widget, client_data,
8553          XtVaGetValues (widget, XmNsliderSize, &slider_size, NULL);          XtVaGetValues (widget, XmNsliderSize, &slider_size, NULL);
8554          UNBLOCK_INPUT;          UNBLOCK_INPUT;
8555    
8556          /* At the max position of the scroll bar, do a line-wise          whole = XM_SB_RANGE - slider_size;
8557             movement.  Without doing anything, we would be called with          portion = min (cs->value - XM_SB_MIN, whole);
8558             the same cs->value again and again.  If we want to make          part = scroll_bar_handle;
8559             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);  
           }  
8560        }        }
8561        break;        break;
8562                
# Line 8880  x_set_toolkit_scroll_bar_thumb (bar, por Line 8859  x_set_toolkit_scroll_bar_thumb (bar, por
8859    Widget widget = SCROLL_BAR_X_WIDGET (FRAME_X_DISPLAY (f), bar);    Widget widget = SCROLL_BAR_X_WIDGET (FRAME_X_DISPLAY (f), bar);
8860    float top, shown;    float top, shown;
8861    
8862    if (whole == 0)    BLOCK_INPUT;
8863    
8864    #ifdef USE_MOTIF
8865    
8866      /* We use an estimate of 30 chars per line rather than the real
8867         `portion' value.  This has the disadvantage that the thumb size
8868         is not very representative, but it makes our life a lot easier.
8869         Otherwise, we have to constantly adjust the thumb size, which
8870         we can't always do quickly enough: while dragging, the size of
8871         the thumb might prevent the user from dragging the thumb all the
8872         way to the end.  but Motif and some versions of Xaw3d don't allow
8873         updating the thumb size while dragging.  Also, even if we can update
8874         its size, the update will often happen too late.
8875         If you don't believe it, check out revision 1.650 of xterm.c to see
8876         what hoops we were going through and the still poor behavior we got.  */
8877      portion = XFASTINT (XWINDOW (bar->window)->height) * 30;
8878      /* When the thumb is at the bottom, position == whole.
8879         So we need to increase `whole' to make space for the thumb.  */
8880      whole += portion;
8881    
8882      if (whole <= 0)
8883      top = 0, shown = 1;      top = 0, shown = 1;
8884    else    else
8885      {      {
# Line 8888  x_set_toolkit_scroll_bar_thumb (bar, por Line 8887  x_set_toolkit_scroll_bar_thumb (bar, por
8887        shown = (float) portion / whole;        shown = (float) portion / whole;
8888      }      }
8889    
8890    BLOCK_INPUT;    if (NILP (bar->dragging))
8891        {
8892  #ifdef USE_MOTIF        int size, value;
   {  
     int size, value;  
   
     /* 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);  
8893    
8894      if (NILP (bar->dragging))        /* Slider size.  Must be in the range [1 .. MAX - MIN] where MAX
8895             is the scroll bar's maximum and MIN is the scroll bar's minimum
8896             value.  */
8897          size = shown * XM_SB_RANGE;
8898          size = min (size, XM_SB_RANGE);
8899          size = max (size, 1);
8900    
8901          /* Position.  Must be in the range [MIN .. MAX - SLIDER_SIZE].  */
8902          value = top * XM_SB_RANGE;
8903          value = min (value, XM_SB_MAX - size);
8904          value = max (value, XM_SB_MIN);
8905          
8906        XmScrollBarSetValues (widget, value, size, 0, 0, False);        XmScrollBarSetValues (widget, value, size, 0, 0, False);
8907      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);  
       }  
   }  
8908  #else /* !USE_MOTIF i.e. use Xaw */  #else /* !USE_MOTIF i.e. use Xaw */
8909    
8910      if (whole == 0)
8911        top = 0, shown = 1;
8912      else
8913        {
8914          top = (float) position / whole;
8915          shown = (float) portion / whole;
8916        }
8917    
8918    {    {
8919      float old_top, old_shown;      float old_top, old_shown;
8920      Dimension height;      Dimension height;
# Line 9953  static struct x_display_info *next_noop_ Line 9941  static struct x_display_info *next_noop_
9941    
9942     EXPECTED is nonzero if the caller knows input is available.  */     EXPECTED is nonzero if the caller knows input is available.  */
9943    
9944  int  static int
9945  XTread_socket (sd, bufp, numchars, expected)  XTread_socket (sd, bufp, numchars, expected)
9946       register int sd;       register int sd;
9947       /* register */ struct input_event *bufp;       /* register */ struct input_event *bufp;

Legend:
Removed from v.1.712  
changed lines
  Added in v.1.713

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