Skip to content

Enhance add support for more than 3 mouse buttons#3229

Merged
SlySven merged 3 commits intoMudlet:developmentfrom
SlySven:Enhance_addSupportForMoreThan3MouseButtons
Dec 1, 2019
Merged

Enhance add support for more than 3 mouse buttons#3229
SlySven merged 3 commits intoMudlet:developmentfrom
SlySven:Enhance_addSupportForMoreThan3MouseButtons

Conversation

@SlySven
Copy link
Copy Markdown
Member

@SlySven SlySven commented Nov 10, 2019

This applies to the main console window for a profile and now reports all mouse button presses and releases in the sysWindowMousePressEvent and sysWindowMouseReleaseEvent instead of only the first three (left, right, middle).

The code for the same things in Labels was checked and I found that we were generally okay there already except that we were fabricating native Qt mouse events for the mapper where it overlaid a label but we were using an older (Qt4 compatible) event that only handled one mouse wheel at a time and we were assuming it was for a vertical mouse wheel. As the owner of a mouse with two wheels that assumption is misplaced so I have rejigged (bool) TLabel::forwardEventToMapper(QEvent*) so that it can pass horizontal and vertical mouse wheel events in the future.

This will hopefully help to address #3220 .

Signed-off-by: Stephen Lyons slysven@virginmedia.com

This applies to the main console window for a profile and now reports all
mouse button presses and releases in the `sysWindowMousePressEvent` and
`sysWindowMouseReleaseEvent` instead of only the first three (left, right,
middle).

The code for the same things in Labels was checked and I found that we
were generally okay there already except that we were fabricating native
Qt mouse events for the mapper where it overlaid a label but we were using
an older (Qt4 compatible) event that only handled one mouse wheel at a time
and we were assuming it was for a vertical mouse wheel. As the owner of a
mouse with two wheels that assumption is misplaced so I have rejigged
`(bool) TLabel::forwardEventToMapper(QEvent*)` so that it can pass
horizontal and vertical mouse wheel events in the future.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
These include:
* some "else after return" anti-pattern instances that CLazy
will moan about.
* a missing pair of `{`...`}` around a single line of `else` code.
* some missing `[[fallthrough]]` in the `case` labels in a couple of
`switch`es.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
@SlySven SlySven requested a review from a team as a code owner November 10, 2019 05:47
@SlySven SlySven requested review from a team November 10, 2019 05:47
@add-deployment-links
Copy link
Copy Markdown

add-deployment-links bot commented Nov 10, 2019

Hey there! Thanks for helping Mudlet improve. 🌟

Test versions

You can directly test the changes here:

No need to install anything - just unzip and run.
Let us know if it works well, and if it doesn't, please give details.

@SlySven SlySven changed the title Enhance add support for more than3 mouse buttons Enhance add support for more than 3 mouse buttons Nov 10, 2019
@SlySven
Copy link
Copy Markdown
Member Author

SlySven commented Nov 16, 2019

Found out the CI failure was because the newer QWheelEvent constructor I had switched to using was only introduced in Qt 5.12 - but that was not documented https://bugreports.qt.io/browse/QTBUG-80088 😠 So, I will have to reintroduce the older flawed (only handles one mouse wheel direction) constructor for older Qt versions.

@vadi2
Copy link
Copy Markdown
Member

vadi2 commented Nov 17, 2019

Ahh damnit!

…Qt lib

The new constructor I used in the previous commit was only introduced in
Qt 5.12.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
Copy link
Copy Markdown
Member

@vadi2 vadi2 left a comment

Choose a reason for hiding this comment

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

Works excellent! Reported 0 for those buttons before, now reports a button number.

@vadi2 vadi2 assigned SlySven and unassigned vadi2 Nov 29, 2019
@SlySven
Copy link
Copy Markdown
Member Author

SlySven commented Nov 30, 2019

One oddity I found in testing is that you do not get right button (button number 2) release events, but that is not a fault in this PR I believe; perhaps it is down to the way that that event is handled to produce the context menu. Might need further investigation as a separate issue...

@SlySven SlySven merged commit b71694a into Mudlet:development Dec 1, 2019
@SlySven SlySven deleted the Enhance_addSupportForMoreThan3MouseButtons branch December 1, 2019 02:42
@SlySven SlySven restored the Enhance_addSupportForMoreThan3MouseButtons branch June 22, 2020 17:58
@SlySven SlySven deleted the Enhance_addSupportForMoreThan3MouseButtons branch June 22, 2020 18:49
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.

2 participants