if (horizontal)
{
- portion = bar->whole * ((float)cs->value / XM_SB_MAX);
- whole = bar->whole * ((float)(XM_SB_MAX - slider_size) / XM_SB_MAX);
+ double dXM_SB_MAX = XM_SB_MAX;
+ portion = bar->whole * (cs->value / dXM_SB_MAX);
+ whole = bar->whole * ((XM_SB_MAX - slider_size) / dXM_SB_MAX);
portion = min (portion, whole);
part = scroll_bar_horizontal_handle;
}
{
struct scroll_bar *bar = client_data;
float *top_addr = call_data;
- float top = *top_addr;
+ double top = *top_addr;
float shown;
int whole, portion, height, width;
enum scroll_bar_part part;
if (shown < 1)
{
- whole = bar->whole - (shown * bar->whole);
+ double dshown = shown;
+ whole = bar->whole - (dshown * bar->whole);
portion = min (top * bar->whole, whole);
}
else
whole = 10000000;
portion = shown < 1 ? top * whole : 0;
- if (shown < 1 && (eabs (top + shown - 1) < 1.0f / height))
+ if (shown < 1 && (eabs (top + shown - 1) < 1.0 / height))
/* Some derivatives of Xaw refuse to shrink the thumb when you reach
the bottom, so we force the scrolling whenever we see that we're
too close to the bottom (in x_set_toolkit_scroll_bar_thumb
{
struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window)));
Widget widget = SCROLL_BAR_X_WIDGET (FRAME_X_DISPLAY (f), bar);
- float top, shown;
+ double dwhole = whole;
+ double top, shown;
block_input ();
top = 0, shown = 1;
else
{
- top = (float) position / whole;
- shown = (float) portion / whole;
+ top = position / dwhole;
+ shown = portion / dwhole;
}
if (bar->dragging == -1)
top = 0, shown = 1;
else
{
- top = (float) position / whole;
- shown = (float) portion / whole;
+ top = position / dwhole;
+ shown = portion / dwhole;
}
{
#if ! defined (HAVE_XAW3D)
/* With Xaw, 'top' values too closer to 1.0 may
cause the thumb to disappear. Fix that. */
- top = min (top, 0.99f);
+ top = min (top, 0.99);
#endif
/* Keep two pixels available for moving the thumb down. */
- shown = max (0, min (1 - top - (2.0f / height), shown));
+ shown = max (0, min (1 - top - (2.0 / height), shown));
#if ! defined (HAVE_XAW3D)
/* Likewise with too small 'shown'. */
- shown = max (shown, 0.01f);
+ shown = max (shown, 0.01);
#endif
/* If the call to XawScrollbarSetThumb below doesn't seem to
work, check that 'NARROWPROTO' is defined in src/config.h.
If this is not so, most likely you need to fix configure. */
- if (top != old_top || shown != old_shown)
+ float ftop = top, fshown = shown;
+ if (ftop != old_top || fshown != old_shown)
{
if (bar->dragging == -1)
XawScrollbarSetThumb (widget, top, shown);
{
struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window)));
Widget widget = SCROLL_BAR_X_WIDGET (FRAME_X_DISPLAY (f), bar);
- float top, shown;
+ double dwhole = whole;
+ double top, shown;
block_input ();
#ifdef USE_MOTIF
bar->whole = whole;
- shown = (float) portion / whole;
- top = (float) position / (whole - portion);
+ shown = portion / dwhole;
+ top = position / (dwhole - portion);
{
int size = clip_to_bounds (1, shown * XM_SB_MAX, XM_SB_MAX);
int value = clip_to_bounds (0, top * (XM_SB_MAX - size), XM_SB_MAX - size);
top = 0, shown = 1;
else
{
- top = (float) position / whole;
- shown = (float) portion / whole;
+ top = position / dwhole;
+ shown = portion / dwhole;
}
{
#if ! defined (HAVE_XAW3D)
/* With Xaw, 'top' values too closer to 1.0 may
cause the thumb to disappear. Fix that. */
- top = min (top, 0.99f);
+ top = min (top, 0.99);
#endif
/* Keep two pixels available for moving the thumb down. */
- shown = max (0, min (1 - top - (2.0f / height), shown));
+ shown = max (0, min (1 - top - (2.0 / height), shown));
#if ! defined (HAVE_XAW3D)
/* Likewise with too small 'shown'. */
- shown = max (shown, 0.01f);
+ shown = max (shown, 0.01);
#endif
#endif
If this is not so, most likely you need to fix configure. */
XawScrollbarSetThumb (widget, top, shown);
#if false
- if (top != old_top || shown != old_shown)
+ float ftop = top, fshown = shown;
+ if (ftop != old_top || fshown != old_shown)
{
if (bar->dragging == -1)
XawScrollbarSetThumb (widget, top, shown);