From b37be47f162a614ddfb0a777331d7c402930aec5 Mon Sep 17 00:00:00 2001 From: frosch Date: Thu, 12 Aug 2010 09:14:34 +0000 Subject: (svn r20460) -Codechange: Remove WF_SCROLL window flags and store the state directly in the scrollbar widget instead. --- src/window.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/window.cpp') diff --git a/src/window.cpp b/src/window.cpp index 09134b270..5539dae04 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -1380,9 +1380,15 @@ static void DecreaseWindowCounters() Window *w; FOR_ALL_WINDOWS_FROM_FRONT(w) { /* Unclick scrollbar buttons if they are pressed. */ - if (w->flags4 & (WF_SCROLL_DOWN | WF_SCROLL_UP)) { - w->flags4 &= ~(WF_SCROLL_DOWN | WF_SCROLL_UP); - w->SetDirty(); + for (uint i = 0; i < w->nested_array_size; i++) { + NWidgetBase *nwid = w->nested_array[i]; + if (nwid != NULL && (nwid->type == WWT_HSCROLLBAR || nwid->type == WWT_SCROLLBAR || nwid->type == WWT_SCROLL2BAR)) { + NWidgetScrollbar *sb = static_cast(nwid); + if (sb->disp_flags & (ND_SCROLLBAR_UP | ND_SCROLLBAR_DOWN)) { + sb->disp_flags &= ~(ND_SCROLLBAR_UP | ND_SCROLLBAR_DOWN); + sb->SetDirty(w); + } + } } w->OnMouseLoop(); } @@ -1831,14 +1837,12 @@ static EventState HandleScrollbarScrolling() } int i; - Scrollbar *sb = w->GetScrollbar(w->scrolling_scrollbar); + NWidgetScrollbar *sb = w->GetWidget(w->scrolling_scrollbar); bool rtl = false; - if (w->flags4 & WF_HSCROLL) { + if (sb->type == WWT_HSCROLLBAR) { i = _cursor.pos.x - _cursorpos_drag_start.x; rtl = _dynlang.text_dir == TD_RTL; - } else if (w->flags4 & WF_SCROLL2) { - i = _cursor.pos.y - _cursorpos_drag_start.y; } else { i = _cursor.pos.y - _cursorpos_drag_start.y; } -- cgit v1.2.3-54-g00ecf