Optionally force delivery of TUIO pseudo touch events

TUIO is not a standard "device" as the first application takes
exclusive ownership, this patch makes it deliver the events to the root
window when the app is not focused, allowing for interactive
application development on simulators running on the same desktop.
To force delivery set the environment variable
QT_TUIOTOUCH_DELIVER_WITHOUT_FOCUS to 1

Change-Id: I157f59982a1b2025ef8efdf709fe40c78339c1b4
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
This commit is contained in:
Ariel Molina 2016-02-10 12:47:29 -06:00 committed by Ariel Molina R
parent 3fa7035b53
commit 2ee7541616

View File

@ -321,6 +321,14 @@ void QTuioHandler::process2DCurFseq(const QOscMessage &message)
Q_UNUSED(message); // TODO: do we need to do anything with the frame id?
QWindow *win = QGuiApplication::focusWindow();
// With TUIO the first application takes exclusive ownership of the "device"
// we cannot attach more than one application to the same port anyway.
// Forcing delivery makes it easy to use simulators in the same machine
// and forget about headaches about unfocused TUIO windows.
static bool forceDelivery = qEnvironmentVariableIsSet("QT_TUIOTOUCH_DELIVER_WITHOUT_FOCUS");
if (!win && QGuiApplication::topLevelWindows().length() > 0 && forceDelivery)
win = QGuiApplication::topLevelWindows().at(0);
if (!win)
return;