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 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
@PeterN PeterN force-pushed the PeterN:active-widget branch from 3ee8300 to d5abf53 Feb 14, 2019
src/window_gui.h Outdated Show resolved Hide resolved
Copy link
Member

LordAro left a comment

No issues, with the exception of the active_widget rename

PeterN added 3 commits Feb 14, 2019
…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 force-pushed the PeterN:active-widget branch from d5abf53 to ae43e96 Feb 20, 2019
@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
8 checks passed
8 checks passed
OpenTTD CI Build #20190220.24 succeeded
Details
OpenTTD CI (Linux commit-checker) Linux commit-checker succeeded
Details
OpenTTD CI (Linux linux-amd64-clang-3.8) Linux linux-amd64-clang-3.8 succeeded
Details
OpenTTD CI (Linux linux-amd64-gcc-6) Linux linux-amd64-gcc-6 succeeded
Details
OpenTTD CI (Linux linux-i386-gcc-6) Linux linux-i386-gcc-6 succeeded
Details
OpenTTD CI (MacOS) MacOS succeeded
Details
OpenTTD CI (Windows Win32) Windows Win32 succeeded
Details
OpenTTD CI (Windows Win64) Windows Win64 succeeded
Details
@PeterN PeterN deleted the PeterN:active-widget branch Feb 21, 2019
PeterN added a commit to PeterN/OpenTTD that referenced this pull request Feb 21, 2019
LordAro added a commit that referenced this pull request Feb 22, 2019
nielsmh added a commit to nielsmh/OpenTTD that referenced this pull request Mar 11, 2019
douiwby added 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
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.