From 6a74106d36059d27ad7150e0ad2c56d0ead80990 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Fri, 19 Sep 2014 12:32:52 +0100 Subject: Make code more readable. --- desktop/scrollbar.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'desktop') diff --git a/desktop/scrollbar.c b/desktop/scrollbar.c index dadb82801..3d21aae02 100644 --- a/desktop/scrollbar.c +++ b/desktop/scrollbar.c @@ -524,9 +524,11 @@ void scrollbar_set_extents(struct scrollbar *s, int length, s->full_size = s->visible_size; /* Update scroll offset (scaled in proportion with change in excess) */ - s->offset = (cur_excess < 1) ? 0 : - ((s->full_size - s->visible_size) * s->offset / - cur_excess); + if (cur_excess <= 0) { + s->offset = 0; + } else { + s->offset = (full_size - visible_size) * s->offset / cur_excess; + } well_length = s->length - 2 * SCROLLBAR_WIDTH; -- cgit v1.2.3