8521 |
XtVaGetValues (widget, XmNsliderSize, &slider_size, NULL); |
XtVaGetValues (widget, XmNsliderSize, &slider_size, NULL); |
8522 |
UNBLOCK_INPUT; |
UNBLOCK_INPUT; |
8523 |
|
|
8524 |
whole = XM_SB_RANGE - slider_size; |
/* At the max position of the scroll bar, do a line-wise |
8525 |
portion = min (cs->value - XM_SB_MIN, whole); |
movement. Without doing anything, we would be called with |
8526 |
part = scroll_bar_handle; |
the same cs->value again and again. If we want to make |
8527 |
bar->dragging = make_number (cs->value); |
sure that we can reach the end of the buffer, we have to do |
8528 |
|
something. |
8529 |
|
|
8530 |
|
Implementation note: setting bar->dragging always to |
8531 |
|
cs->value gives a smoother movement at the max position. |
8532 |
|
Setting it to nil when doing line-wise movement gives |
8533 |
|
a better slider behavior. */ |
8534 |
|
|
8535 |
|
if (cs->value + slider_size == XM_SB_MAX |
8536 |
|
|| (dragging_down_p |
8537 |
|
&& last_scroll_bar_part == scroll_bar_down_arrow)) |
8538 |
|
{ |
8539 |
|
part = scroll_bar_down_arrow; |
8540 |
|
bar->dragging = Qnil; |
8541 |
|
} |
8542 |
|
else |
8543 |
|
{ |
8544 |
|
whole = XM_SB_RANGE; |
8545 |
|
portion = min (cs->value - XM_SB_MIN, XM_SB_MAX - slider_size); |
8546 |
|
part = scroll_bar_handle; |
8547 |
|
bar->dragging = make_number (cs->value); |
8548 |
|
} |
8549 |
} |
} |
8550 |
break; |
break; |
8551 |
|
|
8795 |
Widget widget = SCROLL_BAR_X_WIDGET (FRAME_X_DISPLAY (f), bar); |
Widget widget = SCROLL_BAR_X_WIDGET (FRAME_X_DISPLAY (f), bar); |
8796 |
float top, shown; |
float top, shown; |
8797 |
|
|
8798 |
BLOCK_INPUT; |
if (whole == 0) |
|
|
|
|
#ifdef USE_MOTIF |
|
|
|
|
|
/* We use an estimate of 30 chars per line rather than the real |
|
|
`portion' value. This has the disadvantage that the thumb size |
|
|
is not very representative, but it makes our life a lot easier. |
|
|
Otherwise, we have to constantly adjust the thumb size, which |
|
|
we can't always do quickly enough: while dragging, the size of |
|
|
the thumb might prevent the user from dragging the thumb all the |
|
|
way to the end. but Motif and some versions of Xaw3d don't allow |
|
|
updating the thumb size while dragging. Also, even if we can update |
|
|
its size, the update will often happen too late. |
|
|
If you don't believe it, check out revision 1.650 of xterm.c to see |
|
|
what hoops we were going through and the still poor behavior we got. */ |
|
|
portion = XFASTINT (XWINDOW (bar->window)->height) * 30; |
|
|
/* When the thumb is at the bottom, position == whole. |
|
|
So we need to increase `whole' to make space for the thumb. */ |
|
|
whole += portion; |
|
|
|
|
|
if (whole <= 0) |
|
8799 |
top = 0, shown = 1; |
top = 0, shown = 1; |
8800 |
else |
else |
8801 |
{ |
{ |
8803 |
shown = (float) portion / whole; |
shown = (float) portion / whole; |
8804 |
} |
} |
8805 |
|
|
8806 |
if (NILP (bar->dragging)) |
BLOCK_INPUT; |
8807 |
{ |
|
8808 |
int size, value; |
#ifdef USE_MOTIF |
8809 |
|
{ |
8810 |
|
int size, value; |
8811 |
|
XmScrollBarWidget sb; |
8812 |
|
|
8813 |
/* Slider size. Must be in the range [1 .. MAX - MIN] where MAX |
/* Slider size. Must be in the range [1 .. MAX - MIN] where MAX |
8814 |
is the scroll bar's maximum and MIN is the scroll bar's minimum |
is the scroll bar's maximum and MIN is the scroll bar's minimum |
8815 |
value. */ |
value. */ |
8816 |
size = shown * XM_SB_RANGE; |
size = shown * XM_SB_RANGE; |
8817 |
size = min (size, XM_SB_RANGE); |
size = min (size, XM_SB_RANGE); |
8819 |
|
|
8820 |
/* Position. Must be in the range [MIN .. MAX - SLIDER_SIZE]. */ |
/* Position. Must be in the range [MIN .. MAX - SLIDER_SIZE]. */ |
8821 |
value = top * XM_SB_RANGE; |
value = top * XM_SB_RANGE; |
8822 |
value = min (value, XM_SB_MAX - size); |
value = min (value, XM_SB_MAX - size); |
8823 |
value = max (value, XM_SB_MIN); |
value = max (value, XM_SB_MIN); |
8824 |
|
|
8825 |
|
if (NILP (bar->dragging)) |
8826 |
XmScrollBarSetValues (widget, value, size, 0, 0, False); |
XmScrollBarSetValues (widget, value, size, 0, 0, False); |
8827 |
} |
else if (last_scroll_bar_part == scroll_bar_down_arrow) |
8828 |
|
/* This has the negative side effect that the slider value is |
8829 |
|
not what it would be if we scrolled here using line-wise or |
8830 |
|
page-wise movement. */ |
8831 |
|
XmScrollBarSetValues (widget, value, XM_SB_RANGE - value, 0, 0, False); |
8832 |
|
else |
8833 |
|
{ |
8834 |
|
/* If currently dragging, only update the slider size. |
8835 |
|
This reduces flicker effects. */ |
8836 |
|
int old_value, old_size, increment, page_increment; |
8837 |
|
|
8838 |
|
XmScrollBarGetValues (widget, &old_value, &old_size, |
8839 |
|
&increment, &page_increment); |
8840 |
|
XmScrollBarSetValues (widget, old_value, |
8841 |
|
min (size, XM_SB_RANGE - old_value), |
8842 |
|
0, 0, False); |
8843 |
|
} |
8844 |
|
} |
8845 |
#else /* !USE_MOTIF i.e. use Xaw */ |
#else /* !USE_MOTIF i.e. use Xaw */ |
|
|
|
|
if (whole == 0) |
|
|
top = 0, shown = 1; |
|
|
else |
|
|
{ |
|
|
top = (float) position / whole; |
|
|
shown = (float) portion / whole; |
|
|
} |
|
|
|
|
8846 |
{ |
{ |
8847 |
float old_top, old_shown; |
float old_top, old_shown; |
8848 |
Dimension height; |
Dimension height; |
9867 |
|
|
9868 |
EXPECTED is nonzero if the caller knows input is available. */ |
EXPECTED is nonzero if the caller knows input is available. */ |
9869 |
|
|
9870 |
static int |
int |
9871 |
XTread_socket (sd, bufp, numchars, expected) |
XTread_socket (sd, bufp, numchars, expected) |
9872 |
register int sd; |
register int sd; |
9873 |
/* register */ struct input_event *bufp; |
/* register */ struct input_event *bufp; |