From 2ee75416169ba9cda8a021b119c4c217599d03b9 Mon Sep 17 00:00:00 2001 From: Ariel Molina Date: Wed, 10 Feb 2016 12:47:29 -0600 Subject: [PATCH] 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 --- src/plugins/generic/tuiotouch/qtuiohandler.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/plugins/generic/tuiotouch/qtuiohandler.cpp b/src/plugins/generic/tuiotouch/qtuiohandler.cpp index 7ed268c2d4..4b4d08441f 100644 --- a/src/plugins/generic/tuiotouch/qtuiohandler.cpp +++ b/src/plugins/generic/tuiotouch/qtuiohandler.cpp @@ -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;