diff options
Diffstat (limited to 'desktop/frames.c')
-rw-r--r-- | desktop/frames.c | 44 |
1 files changed, 40 insertions, 4 deletions
diff --git a/desktop/frames.c b/desktop/frames.c index cc2cabfd2..4de33cb4f 100644 --- a/desktop/frames.c +++ b/desktop/frames.c @@ -64,13 +64,49 @@ void browser_window_scroll_callback(void *client_data, html_redraw_a_box(bw->parent->current_content, bw->box); } else { struct rect rect; + struct rect copyrect; + int dest_x = 0; + int dest_y = 0; + int cur_x = scrollbar_get_offset(bw->scroll_x); + int cur_y = scrollbar_get_offset(bw->scroll_y); + + if(cur_x > bw->prev_scroll_x) { + copyrect.x0 = cur_x; + copyrect.x1 = copyrect.x0 + bw->width - (cur_x - bw->prev_scroll_x); + dest_x = bw->prev_scroll_x; + + rect.x0 = copyrect.x0; + rect.x1 = copyrect.x0 + bw->width - (cur_x - bw->prev_scroll_x); + } else { + copyrect.x0 = bw->prev_scroll_x; + copyrect.x1 = copyrect.x0 + bw->width - (bw->prev_scroll_x - cur_x); + dest_x = cur_x; + + rect.x0 = cur_x; + rect.x1 = cur_x + bw->width - (bw->prev_scroll_x - cur_x); + } - rect.x0 = scrollbar_get_offset(bw->scroll_x); - rect.y0 = scrollbar_get_offset(bw->scroll_y); - rect.x1 = rect.x0 + bw->width; - rect.y1 = rect.y0 + bw->height; + if(cur_y > bw->prev_scroll_y) { + copyrect.y0 = cur_y; + copyrect.y1 = copyrect.y0 + bw->height - (cur_y - bw->prev_scroll_y); + dest_y = bw->prev_scroll_y; + + rect.y0 = copyrect.y0; + rect.y1 = copyrect.y0 + bw->height - (cur_y - bw->prev_scroll_y); + } else { + copyrect.y0 = bw->prev_scroll_y; + copyrect.y1 = copyrect.y0 + bw->height - (bw->prev_scroll_y - cur_y); + dest_y = cur_y; + + rect.y0 = cur_y; + rect.y1 = cur_y + bw->height - (bw->prev_scroll_y - cur_y); + } + browser_window_copy_box(bw, ©rect, dest_x, dest_y); browser_window_update_box(bw, &rect); + + bw->prev_scroll_x = scrollbar_get_offset(bw->scroll_x); + bw->prev_scroll_y = scrollbar_get_offset(bw->scroll_y); } break; case SCROLLBAR_MSG_SCROLL_START: |