Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Window::scrolling_scrollbar with Window::mouse_capture_widget #7227

Merged
merged 3 commits into from Feb 21, 2019

Conversation

PeterN
Copy link
Member

@PeterN PeterN commented Feb 14, 2019

This allows us to support generic widget scrolling/dragging. Scrollbars are now handled by testing that the widget type is NWID_VSCROLLBAR or NWID_HSCROLLBAR, otherwise an OnClick() event is dispatched to the window with click_count of zero (logically no additional clicks have been made).

This is followed up by setting mouse_capture_widget when dragging a music window volume slider, see #7209 for reference.

And for completeness, click-left dragging the smallmap is improved (and matches right-click dragging behaviour) by setting mouse_capture_widget.

src/window.cpp Outdated Show resolved Hide resolved
src/window_gui.h Outdated Show resolved Hide resolved
LordAro
LordAro previously approved these changes Feb 20, 2019
Copy link
Member

@LordAro LordAro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues, with the exception of the active_widget rename

…ispatch OnClick() event if widget is not a scrollbar.

This allows any widget to support mouse capture.
This makes the slider continue to respond even when mouse cursor
is no longer over the widget.
This allows the mini-map to be dragged when the cursor has left the widget.
@PeterN PeterN changed the title Replace Window::scrolling_scrollbar with Window::active_widget Replace Window::scrolling_scrollbar with Window::mouse_capture_widget Feb 20, 2019
@PeterN
Copy link
Member Author

PeterN commented Feb 21, 2019

Variable has been renamed :-)

@LordAro LordAro merged commit 6733b71 into OpenTTD:master Feb 21, 2019
@PeterN PeterN deleted the active-widget branch February 21, 2019 08:55
PeterN added a commit to PeterN/OpenTTD that referenced this pull request Feb 21, 2019
nielsmh pushed a commit to nielsmh/OpenTTD that referenced this pull request Mar 11, 2019
douiwby pushed a commit to douiwby/OpenTTD that referenced this pull request Apr 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants