Changeset - r16211:df478f9fb006
[Not reviewed]
master
0 3 0
rubidium - 14 years ago 2010-10-15 11:16:14
rubidium@openttd.org
(svn r20922) -Fix [FS#4071]: accidentally moving the mouse of the scrollbar arrows while pressing it clicks the button next to the arrow
3 files changed with 13 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/widget.cpp
Show inline comments
 
@@ -89,7 +89,7 @@ static void ScrollbarClickPositioning(Wi
 
			_scroller_click_timeout = 3;
 
			sb->UpdatePosition(rtl ? 1 : -1);
 
		}
 
		_left_button_clicked = false;
 
		w->scrolling_scrollbar = sb->index;
 
	} else if (pos >= ma - 10) {
 
		/* Pressing the lower button? */
 
		SetBit(sb->disp_flags, NDB_SCROLLBAR_DOWN);
 
@@ -98,7 +98,7 @@ static void ScrollbarClickPositioning(Wi
 
			_scroller_click_timeout = 3;
 
			sb->UpdatePosition(rtl ? -1 : 1);
 
		}
 
		_left_button_clicked = false;
 
		w->scrolling_scrollbar = sb->index;
 
	} else {
 
		Point pt = HandleScrollbarHittest(sb, mi, ma, sb->type == NWID_HSCROLLBAR);
 

	
 
@@ -1686,7 +1686,7 @@ void NWidgetScrollbar::Draw(const Window
 

	
 
	bool up_lowered = HasBit(this->disp_flags, NDB_SCROLLBAR_UP);
 
	bool down_lowered = HasBit(this->disp_flags, NDB_SCROLLBAR_DOWN);
 
	bool middle_lowered = (w->scrolling_scrollbar == this->index);
 
	bool middle_lowered = !(this->disp_flags & ND_SCROLLBAR_BTN) && w->scrolling_scrollbar == this->index;
 

	
 
	if (this->type == NWID_HSCROLLBAR) {
 
		DrawHorizontalScrollbar(r, this->colour, up_lowered, middle_lowered, down_lowered, this);
src/widget_type.h
Show inline comments
 
@@ -262,6 +262,7 @@ enum NWidgetDisplay {
 
	ND_DROPDOWN_ACTIVE = 1 << NDB_DROPDOWN_ACTIVE, ///< Bit value of the 'dropdown active' flag.
 
	ND_SCROLLBAR_UP    = 1 << NDB_SCROLLBAR_UP,    ///< Bit value of the 'scrollbar up' flag.
 
	ND_SCROLLBAR_DOWN  = 1 << NDB_SCROLLBAR_DOWN,  ///< Bit value of the 'scrollbar down' flag.
 
	ND_SCROLLBAR_BTN   = ND_SCROLLBAR_UP | ND_SCROLLBAR_DOWN, ///< Bit value of the 'scrollbar up' or 'scrollbar down' flag.
 
};
 
DECLARE_ENUM_AS_BIT_SET(NWidgetDisplay)
 

	
src/window.cpp
Show inline comments
 
@@ -1861,6 +1861,15 @@ static EventState HandleScrollbarScrolli
 
				i = _cursor.pos.y - _cursorpos_drag_start.y;
 
			}
 

	
 
			if (sb->disp_flags & ND_SCROLLBAR_BTN) {
 
				if (_scroller_click_timeout == 1) {
 
					_scroller_click_timeout = 3;
 
					sb->UpdatePosition(rtl == HasBit(sb->disp_flags, NDB_SCROLLBAR_UP) ? 1 : -1);
 
					w->SetDirty();
 
				}
 
				return ES_HANDLED;
 
			}
 

	
 
			/* Find the item we want to move to and make sure it's inside bounds. */
 
			int pos = min(max(0, i + _scrollbar_start_pos) * sb->GetCount() / _scrollbar_size, max(0, sb->GetCount() - sb->GetCapacity()));
 
			if (rtl) pos = max(0, sb->GetCount() - sb->GetCapacity() - pos);
0 comments (0 inline, 0 general)