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

workaround qt 5.12 bug for simulated rightbutton mouse events #10869

Merged
merged 3 commits into from Sep 12, 2022

Conversation

m0dB
Copy link
Contributor

@m0dB m0dB commented Sep 5, 2022

Qt 5.12.3 has a bug which results in missing mouse button release events for simulated right clicks (ctrl+left click). Details of the exact bug can be found here: https://mixxx.zulipchat.com/#narrow/stream/109171-development ; see comments about the call to QApplicationPrivate::pickMouseReceiver from QWidgetWindow and the call to QWindowSystemInterface::handleMouseEvent from qnsview_mouse.mm

Fixing this with a patched Qt 5.12.3 would be desirable, but this workaround allows continuing with the existing build-env for 2.3, by correcting the event when it is handled by MixxxApplication::notify(...), effectively having the same result.

@@ -117,6 +122,13 @@ bool MixxxApplication::notify(QObject* target, QEvent* event) {
mouseEvent->setButton(Qt::RightButton);
m_rightPressedButtons++;
}
if (mouseEvent->button() == Qt::RightButton && mouseEvent->buttons() == Qt::LeftButton) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Workarounds for specific Qt releases should be enclosed in #ifef guards and restricted to only the Qt versions that are actually affected.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

got it. it also also platform specific, so i will guard that too.

Copy link
Contributor

Choose a reason for hiding this comment

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

If you search the code you will find some common patterns involving QT_VERSION_CHECK etc.

@m0dB
Copy link
Contributor Author

m0dB commented Sep 8, 2022

@uklotzde i have added the guards as requested.

@daschuer daschuer merged commit 2bebe3c into mixxxdj:2.3 Sep 12, 2022
@m0dB m0dB deleted the simulated_rightbutton_fix branch September 12, 2022 11:38
@foss-
Copy link
Contributor

foss- commented Sep 12, 2022

Verified fix in 2.4-alpha-1305-g2908636ecc (main), thank you @m0dB.
Closes #10831

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug changelog This PR should be included in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants