diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2013-03-20 19:52:10 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2013-03-20 19:52:10 +0000 |
commit | 8e360ff0403523409a7c2edcea9acdf46f4b8605 (patch) | |
tree | ae636e79dd8dd5461574d9df2821316d7c971d93 /desktop | |
parent | c568a9626b13405a53ea12c49766a4f2f67db506 (diff) | |
download | netsurf-8e360ff0403523409a7c2edcea9acdf46f4b8605.tar.gz netsurf-8e360ff0403523409a7c2edcea9acdf46f4b8605.tar.bz2 |
Robust detection of scroll changes.
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/textarea.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/desktop/textarea.c b/desktop/textarea.c index 212cc5b03..d23a021ca 100644 --- a/desktop/textarea.c +++ b/desktop/textarea.c @@ -1963,11 +1963,15 @@ bool textarea_keypress(struct textarea *ta, uint32_t key) struct textarea_msg msg; char utf8[6]; unsigned int caret, length, b_off, b_len; + int h_extent = ta->h_extent; + int v_extent = ta->v_extent; int line; int byte_delta = 0; int x, y; bool redraw = false; bool readonly; + bool bar_x = ta->bar_x; + bool bar_y = ta->bar_y; /* Word separators */ static const char *sep = " .\n"; @@ -2361,16 +2365,23 @@ bool textarea_keypress(struct textarea *ta, uint32_t key) redraw &= ~textarea_set_caret_internal(ta, caret); /* TODO: redraw only the bit that changed */ - if (redraw) { - msg.ta = ta; - msg.type = TEXTAREA_MSG_REDRAW_REQUEST; - msg.data.redraw.x0 = ta->border_width; - msg.data.redraw.y0 = ta->border_width; + msg.ta = ta; + msg.type = TEXTAREA_MSG_REDRAW_REQUEST; + msg.data.redraw.x0 = ta->border_width; + msg.data.redraw.y0 = ta->border_width; + + if (bar_x != (ta->bar_x != NULL) || bar_y != (ta->bar_y != NULL) || + h_extent != ta->h_extent || v_extent != ta->v_extent) { + /* Must redraw since scrollbars have changed */ + msg.data.redraw.x1 = ta->vis_width - ta->border_width; + msg.data.redraw.y1 = ta->vis_height - ta->border_width; + ta->callback(ta->data, &msg); + + } else if (redraw) { msg.data.redraw.x1 = ta->vis_width - ta->border_width - ((ta->bar_y == NULL) ? 0 : SCROLLBAR_WIDTH); msg.data.redraw.y1 = ta->vis_height - ta->border_width - ((ta->bar_x == NULL) ? 0 : SCROLLBAR_WIDTH); - ta->callback(ta->data, &msg); } |