summaryrefslogtreecommitdiff
path: root/src/window.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-08-20 11:55:10 +0000
committerrubidium <rubidium@openttd.org>2010-08-20 11:55:10 +0000
commit3e3cd472226bdfe3dd73cb9707fcc2a1b5aee576 (patch)
treeb5fa2f6ad7be9bc49e4e9a0b366c6d253c098d04 /src/window.cpp
parent1231dc7b57f7c81a9db896eded5a96a7f12f4188 (diff)
downloadopenttd-3e3cd472226bdfe3dd73cb9707fcc2a1b5aee576.tar.xz
(svn r20577) -Fix [FS#4043]: scroll button flickering when pressed
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) {