summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2010-01-28 02:30:59 +0000
committerpeter1138 <peter1138@openttd.org>2010-01-28 02:30:59 +0000
commit07b285c5ca3123050e55c78585ab0cbc051ce9e9 (patch)
treece00a9a1378f4da666159b8d04eeb06a90d8f069 /src
parenta3168269f9920e764669d7d63abff9ec5fe332d0 (diff)
downloadopenttd-07b285c5ca3123050e55c78585ab0cbc051ce9e9.tar.xz
(svn r18932) -Codechange: Don't constantly redraw drop drop list.
Diffstat (limited to 'src')
-rw-r--r--src/widgets/dropdown.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/widgets/dropdown.cpp b/src/widgets/dropdown.cpp
index 1056ebced..e32cf4151 100644
--- a/src/widgets/dropdown.cpp
+++ b/src/widgets/dropdown.cpp
@@ -260,9 +260,16 @@ struct DropdownWindow : Window {
virtual void OnTick()
{
- this->vscroll.UpdatePosition(this->scrolling);
- this->scrolling = 0;
- this->SetDirty();
+ if (this->scrolling != 0) {
+ int pos = this->vscroll.GetPosition();
+
+ this->vscroll.UpdatePosition(this->scrolling);
+ this->scrolling = 0;
+
+ if (pos != this->vscroll.GetPosition()) {
+ this->SetDirty();
+ }
+ }
}
virtual void OnMouseLoop()
@@ -310,8 +317,10 @@ struct DropdownWindow : Window {
if (!this->GetDropDownItem(item)) return;
}
- this->selected_index = item;
- this->SetDirty();
+ if (this->selected_index != item) {
+ this->selected_index = item;
+ this->SetDirty();
+ }
}
}
};