MessageReceived (BMessage *msg)
{
int32 portion, range;
+ double proportion;
if (msg->what == SCROLL_BAR_UPDATE)
{
old_value = msg->GetInt32 ("emacs:units", 0);
portion = msg->GetInt32 ("emacs:portion", 0);
range = msg->GetInt32 ("emacs:range", 0);
+ proportion = (double) portion / range;
if (!msg->GetBool ("emacs:dragging", false))
{
- this->SetRange (0, range);
+ /* Unlike on Motif, PORTION isn't included in the total
+ range of the scroll bar. */
+ this->SetRange (0, std::floor ((double) range - (range * proportion)));
this->SetValue (old_value);
- this->SetProportion ((float) portion / range);
+ this->SetProportion (proportion);
}
}
#endif
/* Minimum and maximum values used for Haiku scroll bars. */
-#define BE_SB_MAX 10000000
+#define BE_SB_MAX 12000000
struct haiku_display_info *x_display_list = NULL;
extern frame_parm_handler haiku_frame_parm_handlers[];
int position, int whole)
{
void *scroll_bar = bar->scroll_bar;
- float top, shown;
- int size, value;
+ double top, shown, size, value;
if (scroll_bar_adjust_thumb_portion_p)
{
top = 0, shown = 1;
else
{
- top = (float) position / whole;
- shown = (float) portion / whole;
+ top = (double) position / whole;
+ shown = (double) portion / whole;
}
/* Slider size. Must be in the range [1 .. MAX - MIN] where MAX
{
bar->page_size = 0;
- size = (((float) portion / whole) * BE_SB_MAX);
- value = (((float) position / whole) * BE_SB_MAX);
+ size = (((double) portion / whole) * BE_SB_MAX);
+ value = (((double) position / whole) * BE_SB_MAX);
}
- BView_scroll_bar_update (scroll_bar, size, BE_SB_MAX, value,
- bar->dragging);
+ BView_scroll_bar_update (scroll_bar, lrint (size),
+ BE_SB_MAX, lrint (value), bar->dragging);
}
static void