summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp
diff options
context:
space:
mode:
authorRoger Maclean <rmaclean@qnx.com>2013-10-10 15:25:55 -0400
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-10-25 20:17:21 +0200
commitdb98b052ac671122437f181feeffb0b270318d8d (patch)
tree7f5ddb82effaaf9af91eb1a9c00aaa5f41abb541 /src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp
parent1f22c1d98162b3a7d34ceb64c543d6580333b434 (diff)
Add support for BB10 input method framework
Added input method support for the BB10 variant of Qt to the extent possible using standard Qt APIs. This adds support for text predictions and entry of languages such as Chinese. Change in interface to QQnxAbstractVirtualKeyboard was made because it is felt the new one is slightly nicer. It doesn't appear safe to assume the focus object has a particular property and in fact in my tests the code failed to work. In some cases the code uses variable and function naming at odds with normal Qt coding standards. This has been done for functions called and data provided by the BB10 input system as for those of us who need to maintain such things, it makes their meaning considerably clearer. While qqnxinputcontext_imf.cpp was used as an initial base for development one can consider the new version as largely new code. I don't believe the original version was ever complete and in any event would not compile. Change-Id: I09470801ffa237cee67da40c0b3d02ed5c77531e Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
Diffstat (limited to 'src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp')
-rw-r--r--src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp31
1 files changed, 29 insertions, 2 deletions
diff --git a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp
index c869d29c99..a5d6db0985 100644
--- a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp
+++ b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp
@@ -1,6 +1,6 @@
/***************************************************************************
**
-** Copyright (C) 2011 - 2012 Research In Motion
+** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
** Contact: http://www.qt-project.org/legal
**
** This file is part of the plugins of the Qt Toolkit.
@@ -43,6 +43,7 @@
#include "qqnxintegration.h"
#include "qqnxkeytranslator.h"
#include "qqnxscreen.h"
+#include "qqnxscreeneventfilter.h"
#include <QDebug>
#include <QGuiApplication>
@@ -84,6 +85,16 @@ QQnxScreenEventHandler::QQnxScreenEventHandler(QQnxIntegration *integration)
}
}
+void QQnxScreenEventHandler::addScreenEventFilter(QQnxScreenEventFilter *filter)
+{
+ m_eventFilters.append(filter);
+}
+
+void QQnxScreenEventHandler::removeScreenEventFilter(QQnxScreenEventFilter *filter)
+{
+ m_eventFilters.removeOne(filter);
+}
+
bool QQnxScreenEventHandler::handleEvent(screen_event_t event)
{
// get the event type
@@ -209,7 +220,23 @@ void QQnxScreenEventHandler::handleKeyboardEvent(screen_event_t event)
if (result)
qFatal("QQNX: failed to query event cap, errno=%d", errno);
- injectKeyboardEvent(flags, sym, modifiers, scan, cap);
+ int sequenceId = 0;
+#if defined(Q_OS_BLACKBERRY)
+ result = screen_get_event_property_iv(event, SCREEN_PROPERTY_SEQUENCE_ID, &sequenceId);
+ if (result)
+ qFatal("QQNX: failed to query event seqId, errno=%d", errno);
+#endif
+
+ bool inject = true;
+ Q_FOREACH (QQnxScreenEventFilter *filter, m_eventFilters) {
+ if (filter->handleKeyboardEvent(flags, sym, modifiers, scan, cap, sequenceId)) {
+ inject = false;
+ break;
+ }
+ }
+
+ if (inject)
+ injectKeyboardEvent(flags, sym, modifiers, scan, cap);
}
void QQnxScreenEventHandler::handlePointerEvent(screen_event_t event)