summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/blackberry/blackberry.pro6
-rw-r--r--src/plugins/platforms/blackberry/qbbbpseventfilter.cpp107
-rw-r--r--src/plugins/platforms/blackberry/qbbbpseventfilter.h67
-rw-r--r--src/plugins/platforms/blackberry/qbbintegration.cpp12
-rw-r--r--src/plugins/platforms/blackberry/qbbintegration.h2
5 files changed, 192 insertions, 2 deletions
diff --git a/src/plugins/platforms/blackberry/blackberry.pro b/src/plugins/platforms/blackberry/blackberry.pro
index cded59c562..2b0f0abb75 100644
--- a/src/plugins/platforms/blackberry/blackberry.pro
+++ b/src/plugins/platforms/blackberry/blackberry.pro
@@ -43,6 +43,12 @@ HEADERS = qbbbuffer.h \
qbbabstractvirtualkeyboard.h \
qbbnativeinterface.h
+blackberry {
+ SOURCES += qbbbpseventfilter.cpp
+
+ HEADERS += qbbbpseventfilter.h
+}
+
QMAKE_CXXFLAGS += -I./private
LIBS += -lpps -lscreen -lEGL -lclipboard
diff --git a/src/plugins/platforms/blackberry/qbbbpseventfilter.cpp b/src/plugins/platforms/blackberry/qbbbpseventfilter.cpp
new file mode 100644
index 0000000000..97ed89c12d
--- /dev/null
+++ b/src/plugins/platforms/blackberry/qbbbpseventfilter.cpp
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Research In Motion
+**
+** Contact: Research In Motion <blackberry-qt@qnx.com>
+** Contact: Klarälvdalens Datakonsult AB <info@kdab.com>
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//#define QBBBPSEVENTFILTER_DEBUG
+
+#include "qbbbpseventfilter.h"
+
+#include <QAbstractEventDispatcher>
+#include <QDebug>
+
+#include <bps/event.h>
+
+QT_BEGIN_NAMESPACE
+
+static QBBBpsEventFilter *sInstance;
+
+QBBBpsEventFilter::QBBBpsEventFilter(QObject *parent)
+ : QObject(parent)
+{
+ Q_ASSERT(sInstance == 0);
+
+ sInstance = this;
+}
+
+QBBBpsEventFilter::~QBBBpsEventFilter()
+{
+ Q_ASSERT(sInstance == this);
+
+ sInstance = 0;
+}
+
+void QBBBpsEventFilter::installOnEventDispatcher(QAbstractEventDispatcher *dispatcher)
+{
+#if defined(QBBBPSEVENTFILTER_DEBUG)
+ qDebug() << Q_FUNC_INFO << "dispatcher=" << dispatcher;
+#endif
+
+ QAbstractEventDispatcher::EventFilter previousEventFilter = dispatcher->setEventFilter(dispatcherEventFilter);
+
+ // the QPA plugin in created in the QApplication constructor which indirectly also creates
+ // the event dispatcher so we are the first event filter.
+ // assert on that just in case somebody adds another event filter
+ // in the QBBIntegration constructor instead of adding a new section in here
+ Q_ASSERT(previousEventFilter == 0);
+ Q_UNUSED(previousEventFilter);
+}
+
+bool QBBBpsEventFilter::dispatcherEventFilter(void *message)
+{
+#if defined(QBBBPSEVENTFILTER_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+ if (sInstance == 0)
+ return false;
+
+ bps_event_t *event = static_cast<bps_event_t *>(message);
+ return sInstance->bpsEventFilter(event);
+}
+
+bool QBBBpsEventFilter::bpsEventFilter(bps_event_t *event)
+{
+#if defined(QBBBPSEVENTFILTER_DEBUG)
+ qDebug() << Q_FUNC_INFO << "event=" << event << "domain=" << bps_event_get_domain(event);
+#else
+ Q_UNUSED(event);
+#endif
+
+ return false;
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/platforms/blackberry/qbbbpseventfilter.h b/src/plugins/platforms/blackberry/qbbbpseventfilter.h
new file mode 100644
index 0000000000..3466577324
--- /dev/null
+++ b/src/plugins/platforms/blackberry/qbbbpseventfilter.h
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Research In Motion
+**
+** Contact: Research In Motion <blackberry-qt@qnx.com>
+** Contact: Klarälvdalens Datakonsult AB <info@kdab.com>
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QBBBPSEVENTFILTER_H
+#define QBBBPSEVENTFILTER_H
+
+#include <QObject>
+
+struct bps_event_t;
+
+QT_BEGIN_NAMESPACE
+
+class QAbstractEventDispatcher;
+
+class QBBBpsEventFilter : public QObject
+{
+ Q_OBJECT
+public:
+ explicit QBBBpsEventFilter(QObject *parent = 0);
+ ~QBBBpsEventFilter();
+
+ void installOnEventDispatcher(QAbstractEventDispatcher *dispatcher);
+
+private:
+ static bool dispatcherEventFilter(void *message);
+ bool bpsEventFilter(bps_event_t *event);
+};
+
+QT_END_NAMESPACE
+
+#endif // QBBBPSEVENTFILTER_H
diff --git a/src/plugins/platforms/blackberry/qbbintegration.cpp b/src/plugins/platforms/blackberry/qbbintegration.cpp
index 32c795bbfc..ee06c31927 100644
--- a/src/plugins/platforms/blackberry/qbbintegration.cpp
+++ b/src/plugins/platforms/blackberry/qbbintegration.cpp
@@ -56,8 +56,12 @@
#include "qbbglcontext.h"
#include "qbblocalethread.h"
#include "qbbnativeinterface.h"
+#if defined(Q_OS_BLACKBERRY)
+#include "qbbbpseventfilter.h"
+#endif
-#include "qapplication.h"
+#include <QtCore/QAbstractEventDispatcher>
+#include <QtGui/QApplication>
#include <QtGui/private/qpixmap_raster_p.h>
#include <QtGui/QPlatformWindow>
#include <QtGui/QWindowSystemInterface>
@@ -80,7 +84,8 @@ QBBIntegration::QBBIntegration() :
mScreenEventHandler(new QBBScreenEventHandler()),
mPaintUsingOpenGL(getenv("QBB_USE_OPENGL") != NULL),
mVirtualKeyboard(0),
- mNativeInterface(new QBBNativeInterface(this))
+ mNativeInterface(new QBBNativeInterface(this)),
+ mBpsEventFilter(0)
{
qRegisterMetaType<screen_window_t>();
@@ -123,6 +128,8 @@ QBBIntegration::QBBIntegration() :
#if defined(Q_OS_BLACKBERRY)
bps_initialize();
+ mBpsEventFilter = new QBBBpsEventFilter;
+ mBpsEventFilter->installOnEventDispatcher(QAbstractEventDispatcher::instance());
#endif
// create/start the keyboard class.
@@ -176,6 +183,7 @@ QBBIntegration::~QBBIntegration()
QBBGLContext::shutdown();
#if defined(Q_OS_BLACKBERRY)
+ delete mBpsEventFilter;
bps_shutdown();
#endif
diff --git a/src/plugins/platforms/blackberry/qbbintegration.h b/src/plugins/platforms/blackberry/qbbintegration.h
index ac51f0f1a3..eaf3876bba 100644
--- a/src/plugins/platforms/blackberry/qbbintegration.h
+++ b/src/plugins/platforms/blackberry/qbbintegration.h
@@ -54,6 +54,7 @@ class QBBAbstractVirtualKeyboard;
class QBBScreen;
class QBBScreenEventHandler;
class QBBNativeInterface;
+class QBBBpsEventFilter;
class QBBIntegration : public QPlatformIntegration
{
@@ -98,6 +99,7 @@ private:
bool mPaintUsingOpenGL;
QBBAbstractVirtualKeyboard *mVirtualKeyboard;
QBBNativeInterface *mNativeInterface;
+ QBBBpsEventFilter *mBpsEventFilter;
};
QT_END_NAMESPACE