-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Fix touch control #3165
Fix touch control #3165
Conversation
…ccording to "touch_shift"
I attempted to test this on a Raspberry Pi with a touchscreen, however as it is based on 2.2 it will not compile due to #2504 not being present. |
@ehendrikd you can pull these changes into 2.3, e. g.:
|
unfortunately that conflicts. I have prepared touchfix24 on top of master for testing: git pull https://github.com/daschuer/mixxx.git touchfix24 |
Thank you, however I am perhaps a bit confused, the |
ups... |
I can confirm https://github.com/daschuer/mixxx/tree/touchfix24 compiles and fixes the touchscreen issues on Raspberry Pis. |
I also tested the PR on top of master (so I could use CMake because I don't have scons set up) and it also fixes the same issue I mentioned on my touchscreen laptop (running f32 on wayland). The library is also usable again, though obviously gestures for scrolling and so forth don't work. Also knobs are still unusable on a touchscreen which is a different issue, but other than that, touch works again. |
Thank you for confirm. Which gesture is used for scrolling? Did you map the "touch_shift" control to access the second feature of the buttons? |
There is a QScroller class that enables kinetic scrolling. Maybe we should introduce this. By the way, here I can already scroll with two fingers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not able to test this, just some comments about the ugly code that lacks an explanation.
src/widget/wwidget.cpp
Outdated
@@ -38,7 +38,7 @@ WWidget::~WWidget() { | |||
} | |||
|
|||
bool WWidget::touchIsRightButton() { | |||
return (m_pTouchShift->get() != 0.0); | |||
return (m_pTouchShift->toBool()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant parantheses
src/mixxxapplication.cpp
Outdated
bool MixxxApplication::touchIsRightButton() { | ||
if (!m_pTouchShift) { | ||
m_pTouchShift = new ControlProxy( | ||
"[Controls]", "touch_shift", this); | ||
} | ||
return (m_pTouchShift->get() != 0.0); | ||
return (m_pTouchShift->toBool()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant parantheses
src/mixxxapplication.cpp
Outdated
QMouseEventEditable* mouseEvent = static_cast<QMouseEventEditable*>(event); | ||
if (mouseEvent->source() == Qt::MouseEventSynthesizedByQt && | ||
mouseEvent->button() == Qt::LeftButton && | ||
m_rightPessedButtons > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VERIFY_OR_DEBUG_ASSERT(m_rightPessedButtons > 0) and early break otherwise?
Using a debug assert for increasing the counter but not for decreasing it would be inconsequent. Both parts of the code should be symmetrical.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
m_rightPessedButtons is zero when there is no right button pressed. This is an expected case.
The assertion in the other path verifies the assumption that QT synthesizes only one click at a time. I will add a comment.
src/mixxxapplication.cpp
Outdated
mouseEvent->button() == Qt::LeftButton && | ||
touchIsRightButton()) { | ||
mouseEvent->setButton(Qt::RightButton); | ||
m_rightPessedButtons++; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VERIFY_OR_DEBUG_ASSERT(m_rightPessedButtons < 2) and early break otherwise?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solved, see above.
src/mixxxapplication.cpp
Outdated
class QMouseEventEditable : public QMouseEvent { | ||
public: | ||
// Inherit constructors from base class | ||
using QMouseEvent::QMouseEvent; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class must never be constructed.
I converted this to draft since there are unresolved review comments. |
Done. |
There is a merge conflict now. |
Merge conflicts again. |
This is merge able again. |
src/mixxxapplication.cpp
Outdated
m_fakeMouseWidget(NULL), | ||
m_activeTouchButton(Qt::NoButton), | ||
m_pTouchShift(NULL) { | ||
m_rightPessedButtons(0), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
m_rightPessedButtons(0), | |
m_rightPressedButtons(0), |
@@ -219,7 +219,6 @@ void MixxxMainWindow::initialize(QApplication* pApp, const CmdlineArgs& args) { | |||
pConfig->getValue(ConfigKey("[Controls]", "Tooltips"), | |||
static_cast<int>(mixxx::TooltipsPreference::TOOLTIPS_ON))); | |||
|
|||
setAttribute(Qt::WA_AcceptTouchEvents); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am concerned this hack may prevent us from implementing custom touch gestures. However, we currently have a major bug to fix so we can defer that issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any widget can enable touch events individually.
This tells Qt that the MixxxMainWindow itself has a event handler that accept touch events.
This hack was required in early Qt versions to detect that no child widget has consumed the touch and we could resend it as mouse click. Now Qt calculated this forehead, which disables the mouse click synthesizer.
This fixes touch input for the library but there is still the critical bug that no onscreen keyboard is shown when searching the library. |
Co-authored-by: Be <be.0@gmx.com>
Done. |
CI failures are unrelated. |
Looks good to me. Waiting for CI. |
There is a merge conflict with CHANGELOG now. |
I don't know what's going on with the CI failures on the 2.2 branch but it doesn't seem to be related to the changes in this PR. |
That is actually the fifth time this PR is in conflict due to CHANGELOG |
Done. |
This fixes the broken touch control, reported here:
https://bugs.launchpad.net/mixxx/+bug/1895431
We rely here on our own touch solution for skin buttons. The rest uses the synthesized Qt events.
This was tested with Ubuntu Bionic