-
-
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
Touch control for pushbuttons #76
Conversation
Can you give example how this could be utilized on a non-touch device within the Mixxx GUI, please? |
This should effect touch devices only. I have no experiences how to test it without one. |
Ok, i`ll ask more precisely ;-) Thanks. |
A track-pad makes no use of this feature, because it usually has two dedicated mouse buttons. Do we need a general solution for Mac single button mice as well? I have converted the touch_shift to a ControlPushButton, so that it can be placed as an additional button in touch skins. |
The way this is implemented only widgets that descend from WWidget will get the fake touch support. Other widgets (such as the library and a few other skin widgets like the waveforms / spinnies) won't have the support (and things like the touch_shift feature won't work with them which will be quite confusing). Perhaps it could be implemented as a global event filter (see MixxxApp::eventFilter for how we do that for tooltips) though I'm not sure if all touch/mouse events go through that handler. I tend to agree with Albert -- we should use a Qt-provided solution rather than trying to build the support ourself. When we re-write with QML touch will be supported natively everywhere, right? |
Hi RJ, thank you for review. Yes, you are right, it currently effects only WWidget. But the issue is slightly different then Albert pointed out. First of all it is no option for me to wait for a QML skin, because IMHO we need a touch enabled GUI in 1.12. Mixxx 1.11 currently has the default Qt touch support. But this suffers some problems that made Mixxx useless on a touch only device. These are pointed out in https://bugs.launchpad.net/mixxx/+bug/1152572 and in a significant attached video. Two main problems of the Qt touch solution are :
My first Idea was fixing these issue at WPushButton Layer, but it turns out that if you call setAttribute(Qt::WA_AcceptTouchEvents); in one widget, the default Qt touch support is disabled for all widgets. For me, the library was out of focus when starting the patch because we have the Context menu key on keyboard. But lets clarify some things first: |
I'm not against having touch capability, I just don't want us to rush head-first into a solution that we will have to support for years to come. I'm particularly wary of touch_shift because we will have to support it in the future even if our underlying touch support changes (e.g. we switch to QML). What device are you using to test this? I also don't see touch support as a blocker for Mixxx 1.12.0 -- it's not a top-requested user feature. I think the % of users who would be able to take advantage is quite low at this point as we're mostly talking about Windows 8 laptops with touch-screens and the Microsoft Surface. BTW Mac OS X supports right-click by two-finger tap. It's a common right-click gesture for trackpads. I don't think touch_shift would be necessary for trackpads as they either have a real right-click button or they support a right-click gesture. |
Ok, we have to be sure that our solution is not a quick hack. I have a "samsung ultrabook serie 5" for testing. In Mixxx we cannot use a two finger tap. It is because the Mixxx pushbuttons behaves different to button controls in other applications. A normal Button accepts a click after releasing the mouse button on it. If you click it and move the mouse away from it the click is ignored. In Mixxx, the click command is executed as early as possible on the first push. This is the reason a two finger tab will not work. it will always execute the left click command as well, because it is nearly impossible to tab two fingers at ones. By the way: Some Mixxx buttons are to small for two of my big fingers :-) I do not expect big changes in this with QML, because as far as I now the Qt touch support will be the same in QML. Or do you know a special document that describes the different in QML touch support? Compared to DJ-Controllers the "touch_shift" control makes good points, because Mixxx uses the same button behavior and so it is natural to use the same solution for the secondary button function, a dedicated SHIFT button. What could be an alternative solution? |
Ah, yes I wasn't suggesting adding two-finger right-click support. Ideally the OS or GUI system should handle all this for us. (And OS X handles detecting the gestures and passing them to Mixxx as right-click events) |
// pushbutton so "RightClickIsPushButton" is obsolete | ||
m_rightPressed = true; | ||
emit(valueChangedRightDown(1.0f)); | ||
update(); | ||
|
||
// Do not allow right-clicks to change button state other than when |
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'm kind of bummed about the removal of RightClickIsPushButton (and generally making right-click "lesser" than a left-click). My comments on this line were saying that we were keeping the pre-1.8.0 behavior but I always wanted to get rid of that behavior and allow right-click to change the state of multi-state push buttons if the skin author chose for it to be that way.
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 have decided to remove it, because a left click toggle button was not working (well). Since we currently do not use it nor have request for a fix, it was the easiest way to remove it. Do you think it worth to spend some time and reintroduce the left toggler? If you have a valid use case for it as test scenario, I can try to fix it.
.. or should we just move the "is obsolete" warning and fix it later on demand?
Right, that was my first idea as well, so I have started to collect the right click solutions at
Unfortunately only the modifier key + tap works for our "exotic" buttons in Mixxx. With this patch, the user is able to configure the Ctrl+tap on all systems. Any other ideas? |
From http://who-t.blogspot.de/2011/12/multitouch-in-x-pointer-emulation.html
|
This are my results from digging though the Qt code: In Mixxx 1.11 we see the X11 pointer emulation on touch devices (not from Qt). Once we request a touch event by setting setAttribute(Qt::WA_AcceptTouchEvents) for a single widget, Mixxx becomes a multitouch application and the X11 pointer emulation is disabled. Conclusion: Mixxx needs its own global pointer emulation, by overwriting bool QApplication::notify(QObject *receiver, QEvent *e) |
To be much intuitive as possible, we should allow two finger tab and long tab gestures for calling the context menu library like in win 7/8 as well: |
Conflicts: src/mixxx.cpp src/mixxx.h
In Qt5 Qt does the Mouse pointer emulation of the touch event is not accepted by any widget.
So as long Mixxx uses Qt4 it needs its own Mouse Pointer emulation. |
…Window and not from QApplication
Hey Daniel -- when I'm talking about native Qt support for gestures, I'm talking about QGestureRecognizer and the associated classes. This is also a good slide deck on the topic: http://www.slideshare.net/qtbynokia/using-multitouch-and-gestures-with-qt |
With this patch I get: Stat("MixxxApplication::notify","count=55395,sum=4.76187e+06ns,average=85.9621ns,min=21ns,max=9102ns,variance=16078.9ns^2,stddev=126.802ns") Stat("MixxxMainWindow::event","count=1213,sum=105504ns,average=86.9777ns,min=26ns,max=8885ns,variance=65442.2ns^2,stddev=255.817ns") The max for notify dropped by an order of magnitude. |
@daschuer could you report what you see on your netbook? |
(Again with that patch -- mouse release events are not part of the measurement) |
Hey we are on GitHub, why do you post patches ;-) |
Ether I misread you patches, or you missed the line https://github.com/mixxxdj/mixxx/pull/76/files#diff-34f48af851ef6ea01364f1834e2b2d1fR113 |
} | ||
case QEvent::MouseButtonRelease: | ||
{ | ||
bool ret = QApplication::notify(target, event); |
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 ^ line must not be included in the performance measurement.
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.
Right -- this block ends in return ret;
on line 129 so this is not included in the timer. Note I am using Timer, not ScopedTimer. You have to manually tell it to record by calling elapsed and I do not call elapsed in this block.
Haha good question. I guess I should use a gist. Stuffing it in a pastebin was quickest in the moment. |
A fist draft: http://www.mixxx.org/wiki/doku.php/touch |
Here the result fom my i5 notebook: Stat("MixxxApplication::notifyRef","count=125750,sum=3.57041e+07ns,average=283.929ns,min=106ns,max=54543ns,variance=99238.4ns^2,stddev=315.021ns") |
Conflicts: res/developer_skins
Here the results on my Atom notebook: |
Cool, my new device is 14 time faster :-) Conclusion: the effect is somehow below the noise level of the scheduler. |
Hm, interesting. This is with no touchscreen, right? (So it should be doing essentially no work at all). The atom takes a max of >1ms :(. That feels like an eternity. |
The vast majority of delay is produced due to the timer itself. MixxxApplication::notifyRef is just the timer without any code to measure. I also think that the max value is not that significant because we measure on the GUI thread and if we get suspended by the scheduler e.g, by the PA callback, we have an offset of a full PA cycle on on the measurement. |
I think it save to merge now, because of no measurable timing regression. Thank you for review. |
Touch control for pushbuttons
TODO: update screenshots Fixes mixxxdj#76
this patch allows simultaneous control of multiple pushbuttons.
It introduces [Controls]", "touch_shift", to rate touch events as right click.
This can be mapped to a "shift" keyboard key (single touch) or to an additional skin button (multi touch)
https://bugs.launchpad.net/mixxx/+bug/1217733