diff options
-rw-r--r-- | src/widget.cpp | 8 | ||||
-rw-r--r-- | src/window.cpp | 26 |
2 files changed, 16 insertions, 18 deletions
diff --git a/src/widget.cpp b/src/widget.cpp index 25abdf1c5..008a5b92a 100644 --- a/src/widget.cpp +++ b/src/widget.cpp @@ -85,8 +85,8 @@ static void ScrollbarClickPositioning(Window *w, NWidgetScrollbar *sb, int x, in if (pos <= mi + 9) { /* Pressing the upper button? */ SetBit(sb->disp_flags, NDB_SCROLLBAR_UP); - if (_scroller_click_timeout == 0) { - _scroller_click_timeout = 6; + if (_scroller_click_timeout <= 1) { + _scroller_click_timeout = 3; sb->UpdatePosition(rtl ? 1 : -1); } _left_button_clicked = false; @@ -94,8 +94,8 @@ static void ScrollbarClickPositioning(Window *w, NWidgetScrollbar *sb, int x, in /* Pressing the lower button? */ SetBit(sb->disp_flags, NDB_SCROLLBAR_DOWN); - if (_scroller_click_timeout == 0) { - _scroller_click_timeout = 6; + if (_scroller_click_timeout <= 1) { + _scroller_click_timeout = 3; sb->UpdatePosition(rtl ? -1 : 1); } _left_button_clicked = false; 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) { |