mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-11-25 07:49:38 +03:00
Avoid redrawing the whole screen when scrolling by zero pixels.
This commit is contained in:
parent
59ba5dd43c
commit
d9d7dcb758
@ -119,7 +119,6 @@ widget_scroll_y(struct gui_window *gw, int y, bool abs)
|
||||
} else {
|
||||
bwidget->pany += y;
|
||||
}
|
||||
bwidget->pan_required = true;
|
||||
|
||||
content_height = content_get_height(gw->bw->current_content) * scale;
|
||||
|
||||
@ -133,6 +132,11 @@ widget_scroll_y(struct gui_window *gw, int y, bool abs)
|
||||
if ((bwidget->scrolly + bwidget->pany) > (content_height - height))
|
||||
bwidget->pany = (content_height - height) - bwidget->scrolly;
|
||||
|
||||
if (bwidget->pany == 0)
|
||||
return;
|
||||
|
||||
bwidget->pan_required = true;
|
||||
|
||||
fbtk_request_redraw(gw->browser);
|
||||
|
||||
fbtk_set_scroll_position(gw->vscroll, bwidget->scrolly + bwidget->pany);
|
||||
@ -152,13 +156,11 @@ widget_scroll_x(struct gui_window *gw, int x, bool abs)
|
||||
} else {
|
||||
bwidget->panx += x;
|
||||
}
|
||||
bwidget->pan_required = true;
|
||||
|
||||
content_width = content_get_width(gw->bw->current_content) * scale;
|
||||
|
||||
width = fbtk_get_width(gw->browser);
|
||||
|
||||
|
||||
/* dont pan off the left */
|
||||
if ((bwidget->scrollx + bwidget->panx) < 0)
|
||||
bwidget->panx = - bwidget->scrollx;
|
||||
@ -167,6 +169,11 @@ widget_scroll_x(struct gui_window *gw, int x, bool abs)
|
||||
if ((bwidget->scrollx + bwidget->panx) > (content_width - width))
|
||||
bwidget->panx = (content_width - width) - bwidget->scrollx;
|
||||
|
||||
if (bwidget->panx == 0)
|
||||
return;
|
||||
|
||||
bwidget->pan_required = true;
|
||||
|
||||
fbtk_request_redraw(gw->browser);
|
||||
|
||||
fbtk_set_scroll_position(gw->hscroll, bwidget->scrollx + bwidget->panx);
|
||||
|
Loading…
Reference in New Issue
Block a user