Codechange: Don't update window contents if scrollbar position has not moved.

(cherry picked from commit 52b16237ad)
This commit is contained in:
Peter Nelson
2021-05-07 12:36:08 +01:00
committed by Jonathan G Rennison
parent ad554d913f
commit 065ae3964a
3 changed files with 23 additions and 15 deletions

View File

@@ -862,8 +862,7 @@ static void DispatchMouseWheelEvent(Window *w, NWidgetCore *nwid, int wheel)
if (nwid->type == NWID_VSCROLLBAR) {
NWidgetScrollbar *sb = static_cast<NWidgetScrollbar *>(nwid);
if (sb->GetCount() > sb->GetCapacity()) {
sb->UpdatePosition(wheel);
w->SetDirty();
if (sb->UpdatePosition(wheel)) w->SetDirty();
}
return;
}
@@ -871,8 +870,7 @@ static void DispatchMouseWheelEvent(Window *w, NWidgetCore *nwid, int wheel)
/* Scroll the widget attached to the scrollbar. */
Scrollbar *sb = (nwid->scrollbar_index >= 0 ? w->GetScrollbar(nwid->scrollbar_index) : nullptr);
if (sb != nullptr && sb->GetCount() > sb->GetCapacity()) {
sb->UpdatePosition(wheel);
w->SetDirty();
if (sb->UpdatePosition(wheel)) w->SetDirty();
}
}
@@ -2445,8 +2443,7 @@ static void HandleScrollbarScrolling(Window *w)
if (sb->disp_flags & ND_SCROLLBAR_BTN) {
if (_scroller_click_timeout == 1) {
_scroller_click_timeout = 3;
sb->UpdatePosition(rtl == HasBit(sb->disp_flags, NDB_SCROLLBAR_UP) ? 1 : -1);
w->SetDirty();
if (sb->UpdatePosition(rtl == HasBit(sb->disp_flags, NDB_SCROLLBAR_UP) ? 1 : -1)) w->SetDirty();
}
return;
}