diff options
author | PeterN <peter@fuzzle.org> | 2019-01-12 23:23:23 +0000 |
---|---|---|
committer | Charles Pigott <charlespigott@googlemail.com> | 2019-01-12 23:23:23 +0000 |
commit | 5ff0c24993c52546f1809e87a036d1e8f21d6e17 (patch) | |
tree | 7c1440ca7eb772f21ecd47e7f54f8226d87e03d9 /src/widgets | |
parent | 9aecbac2b4a4137abc44ff12a672916ec7482047 (diff) | |
download | openttd-5ff0c24993c52546f1809e87a036d1e8f21d6e17.tar.xz |
Fix #6780: Some windows didn't get updated from OnTick() (#7048)
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/dropdown.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/widgets/dropdown.cpp b/src/widgets/dropdown.cpp index f8ddf5569..816e981a1 100644 --- a/src/widgets/dropdown.cpp +++ b/src/widgets/dropdown.cpp @@ -14,6 +14,7 @@ #include "../string_func.h" #include "../strings_func.h" #include "../window_func.h" +#include "../guitimer_func.h" #include "dropdown_type.h" #include "dropdown_widget.h" @@ -97,6 +98,7 @@ struct DropdownWindow : Window { bool drag_mode; bool instant_close; ///< Close the window when the mouse button is raised. int scrolling; ///< If non-zero, auto-scroll the item list (one time). + GUITimer scrolling_timer; ///< Timer for auto-scroll of the item list. Point position; ///< Position of the topleft corner of the window. Scrollbar *vscroll; @@ -155,6 +157,7 @@ struct DropdownWindow : Window { this->click_delay = 0; this->drag_mode = true; this->instant_close = instant_close; + this->scrolling_timer = GUITimer(MILLISECONDS_PER_TICK); } ~DropdownWindow() @@ -254,8 +257,11 @@ struct DropdownWindow : Window { } } - virtual void OnTick() + virtual void OnRealtimeTick(uint delta_ms) { + if (!this->scrolling_timer.Elapsed(delta_ms)) return; + this->scrolling_timer.SetInterval(MILLISECONDS_PER_TICK); + if (this->scrolling != 0) { int pos = this->vscroll->GetPosition(); |