summaryrefslogtreecommitdiff
path: root/src/window.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/window.cpp')
-rw-r--r--src/window.cpp26
1 files changed, 12 insertions, 14 deletions
diff --git a/src/window.cpp b/src/window.cpp
index 09accd16e..4e2e42091 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -54,7 +54,7 @@ Point _cursorpos_drag_start;
int _scrollbar_start_pos;
int _scrollbar_size;
-byte _scroller_click_timeout;
+byte _scroller_click_timeout = 0;
bool _scrolling_viewport; ///< A viewport is being scrolled with the mouse.
bool _mouse_hovering; ///< The mouse is hovering over the same point.
@@ -1373,14 +1373,16 @@ static void DecreaseWindowCounters()
{
Window *w;
FOR_ALL_WINDOWS_FROM_FRONT(w) {
- /* Unclick scrollbar buttons if they are pressed. */
- for (uint i = 0; i < w->nested_array_size; i++) {
- NWidgetBase *nwid = w->nested_array[i];
- if (nwid != NULL && (nwid->type == NWID_HSCROLLBAR || nwid->type == NWID_VSCROLLBAR)) {
- NWidgetScrollbar *sb = static_cast<NWidgetScrollbar*>(nwid);
- if (sb->disp_flags & (ND_SCROLLBAR_UP | ND_SCROLLBAR_DOWN)) {
- sb->disp_flags &= ~(ND_SCROLLBAR_UP | ND_SCROLLBAR_DOWN);
- sb->SetDirty(w);
+ if (_scroller_click_timeout == 0) {
+ /* Unclick scrollbar buttons if they are pressed. */
+ for (uint i = 0; i < w->nested_array_size; i++) {
+ NWidgetBase *nwid = w->nested_array[i];
+ if (nwid != NULL && (nwid->type == NWID_HSCROLLBAR || nwid->type == NWID_VSCROLLBAR)) {
+ NWidgetScrollbar *sb = static_cast<NWidgetScrollbar*>(nwid);
+ if (sb->disp_flags & (ND_SCROLLBAR_UP | ND_SCROLLBAR_DOWN)) {
+ sb->disp_flags &= ~(ND_SCROLLBAR_UP | ND_SCROLLBAR_DOWN);
+ sb->SetDirty(w);
+ }
}
}
}
@@ -2500,11 +2502,7 @@ void InvalidateWindowClassesData(WindowClass cls, int data)
*/
void CallWindowTickEvent()
{
- if (_scroller_click_timeout > 3) {
- _scroller_click_timeout -= 3;
- } else {
- _scroller_click_timeout = 0;
- }
+ if (_scroller_click_timeout != 0) _scroller_click_timeout--;
Window *w;
FOR_ALL_WINDOWS_FROM_FRONT(w) {