summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2013-03-06 21:31:20 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2013-03-06 21:31:20 +0000
commit490de208d0be50c8dd4aca055807931e00a98e60 (patch)
tree819935a6aa7a817b06649f259ee6cab10364ac34 /desktop
parentc1628435f27d1a359c96a8727e054ef84d6e7612 (diff)
downloadnetsurf-490de208d0be50c8dd4aca055807931e00a98e60.tar.gz
netsurf-490de208d0be50c8dd4aca055807931e00a98e60.tar.bz2
Make autoscroll start at inside edge of border or scrollbar.
Diffstat (limited to 'desktop')
-rw-r--r--desktop/textarea.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/desktop/textarea.c b/desktop/textarea.c
index 54f45587f..46de70639 100644
--- a/desktop/textarea.c
+++ b/desktop/textarea.c
@@ -2375,22 +2375,28 @@ bool textarea_mouse_action(struct textarea *ta, browser_mouse_state mouse,
/* Selection track */
int scrx = 0;
int scry = 0;
+ int w, h;
bool need_redraw;
textarea_get_xy_offset(ta, x, y, &c_off);
c_start = ta->drag_start_char;
c_end = c_off;
+ w = ta->vis_width - ta->border_width -
+ ((ta->bar_y == NULL) ? 0 : SCROLLBAR_WIDTH);
+ h = ta->vis_height - ta->border_width -
+ ((ta->bar_x == NULL) ? 0 : SCROLLBAR_WIDTH);
+
/* selection auto-scroll */
- if (x < 0)
- scrx = x / 4;
- else if (x > ta->vis_width)
- scrx = (x - ta->vis_width) / 4;
-
- if (y < 0)
- scry = y / 4;
- else if (y > ta->vis_height)
- scry = (y - ta->vis_height) / 4;
+ if (x < ta->border_width)
+ scrx = (x - ta->border_width) / 4;
+ else if (x > w)
+ scrx = (x - w) / 4;
+
+ if (y < ta->border_width)
+ scry = (y - ta->border_width) / 4;
+ else if (y > h)
+ scry = (y - h) / 4;
need_redraw = textarea_scroll(ta, scrx, scry);