summaryrefslogtreecommitdiffstats
path: root/src/plugins/generic/tuiotouch
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2016-02-18 20:45:53 +0100
committerLiang Qi <liang.qi@theqtcompany.com>2016-02-18 20:50:35 +0100
commit4fe2fbcf827ae6bec976b0b8dcaa5d14bd05dc33 (patch)
treed1ba753b45b09b417a9447ebdfe2fa6fc47dba69 /src/plugins/generic/tuiotouch
parentc1da6347e8d3ba73de20ab8fb3e50ec3359b75ac (diff)
parent4889269ff0fb37130b332863e82dd7c19564116c (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
This also reverts commit 018e670a26ff5a61b949100ae080f5e654e7bee8. The change was introduced in 5.6. After the refactoring, 14960f52, in 5.7 branch and a merge, it is not needed any more. Conflicts: .qmake.conf src/corelib/io/qstandardpaths_mac.mm src/corelib/tools/qsharedpointer_impl.h tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp Change-Id: If4fdff0ebf2b9b5df9f9db93ea0022d5ee3da2a4
Diffstat (limited to 'src/plugins/generic/tuiotouch')
-rw-r--r--src/plugins/generic/tuiotouch/qtuiohandler.cpp26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/plugins/generic/tuiotouch/qtuiohandler.cpp b/src/plugins/generic/tuiotouch/qtuiohandler.cpp
index 8adf15cec4..e2c4bf9dc4 100644
--- a/src/plugins/generic/tuiotouch/qtuiohandler.cpp
+++ b/src/plugins/generic/tuiotouch/qtuiohandler.cpp
@@ -136,10 +136,6 @@ void QTuioHandler::processPackets()
if (size != datagram.size())
datagram.resize(size);
- QOscBundle bundle(datagram);
- if (!bundle.isValid())
- continue;
-
// "A typical TUIO bundle will contain an initial ALIVE message,
// followed by an arbitrary number of SET messages that can fit into the
// actual bundle capacity and a concluding FSEQ message. A minimal TUIO
@@ -147,7 +143,19 @@ void QTuioHandler::processPackets()
// messages. The FSEQ frame ID is incremented for each delivered bundle,
// while redundant bundles can be marked using the frame sequence ID
// -1."
- QList<QOscMessage> messages = bundle.messages();
+ QList<QOscMessage> messages;
+
+ QOscBundle bundle(datagram);
+ if (bundle.isValid()) {
+ messages = bundle.messages();
+ } else {
+ QOscMessage msg(datagram);
+ if (!msg.isValid()) {
+ qCWarning(lcTuioSet) << "Got invalid datagram.";
+ continue;
+ }
+ messages.push_back(msg);
+ }
foreach (const QOscMessage &message, messages) {
if (message.addressPattern() != "/tuio/2Dcur") {
@@ -320,6 +328,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;