Refactor the handling of the navigator swipe down event
The navigator swipe down event is not mapped to a platform panel event any more. Instead the NavigatorEventHandler is exposed through the QPlatformNativeInterface. Change-Id: I6d29bba011849da5210f6f4d595e3c2e0c021449 Reviewed-by: Bernd Weimer <bweimer@blackberry.com> Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
This commit is contained in:
parent
ddbbf2b4a7
commit
0827f0bd66
@ -162,7 +162,7 @@ QQnxIntegration::QQnxIntegration(const QStringList ¶mList)
|
||||
#else
|
||||
, m_eventDispatcher(createUnixEventDispatcher())
|
||||
#endif
|
||||
, m_nativeInterface(new QQnxNativeInterface())
|
||||
, m_nativeInterface(new QQnxNativeInterface(this))
|
||||
, m_screenEventHandler(new QQnxScreenEventHandler(this))
|
||||
#if !defined(QT_NO_CLIPBOARD)
|
||||
, m_clipboard(0)
|
||||
@ -597,6 +597,11 @@ screen_context_t QQnxIntegration::screenContext()
|
||||
return ms_screenContext;
|
||||
}
|
||||
|
||||
QQnxNavigatorEventHandler *QQnxIntegration::navigatorEventHandler()
|
||||
{
|
||||
return m_navigatorEventHandler;
|
||||
}
|
||||
|
||||
screen_context_t QQnxIntegration::ms_screenContext = 0;
|
||||
|
||||
QQnxIntegration::Options QQnxIntegration::ms_options = 0;
|
||||
|
@ -141,6 +141,8 @@ public:
|
||||
static Options options();
|
||||
static screen_context_t screenContext();
|
||||
|
||||
QQnxNavigatorEventHandler *navigatorEventHandler();
|
||||
|
||||
private:
|
||||
void createDisplays();
|
||||
void destroyDisplays();
|
||||
|
@ -48,12 +48,19 @@
|
||||
#include "qqnxinputcontext_imf.h"
|
||||
#endif
|
||||
|
||||
#include "qqnxintegration.h"
|
||||
|
||||
#include <QtGui/QOpenGLContext>
|
||||
#include <QtGui/QScreen>
|
||||
#include <QtGui/QWindow>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QQnxNativeInterface::QQnxNativeInterface(QQnxIntegration *integration)
|
||||
: m_integration(integration)
|
||||
{
|
||||
}
|
||||
|
||||
void *QQnxNativeInterface::nativeResourceForWindow(const QByteArray &resource, QWindow *window)
|
||||
{
|
||||
if (resource == "windowGroup" && window && window->screen()) {
|
||||
@ -78,6 +85,16 @@ void *QQnxNativeInterface::nativeResourceForScreen(const QByteArray &resource, Q
|
||||
return 0;
|
||||
}
|
||||
|
||||
void *QQnxNativeInterface::nativeResourceForIntegration(const QByteArray &resource)
|
||||
{
|
||||
#ifdef Q_OS_BLACKBERRY
|
||||
if (resource == "navigatorEventHandler")
|
||||
return m_integration->navigatorEventHandler();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void *QQnxNativeInterface::nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context)
|
||||
{
|
||||
if (resource == "eglcontext" && context)
|
||||
|
@ -46,15 +46,22 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QQnxIntegration;
|
||||
|
||||
class QQnxNativeInterface : public QPlatformNativeInterface
|
||||
{
|
||||
public:
|
||||
QQnxNativeInterface(QQnxIntegration *integration);
|
||||
void *nativeResourceForWindow(const QByteArray &resource, QWindow *window);
|
||||
void *nativeResourceForScreen(const QByteArray &resource, QScreen *screen);
|
||||
void *nativeResourceForIntegration(const QByteArray &resource);
|
||||
|
||||
void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context);
|
||||
void setWindowProperty(QPlatformWindow *window, const QString &name, const QVariant &value);
|
||||
NativeResourceForIntegrationFunction nativeResourceFunctionForIntegration(const QByteArray &resource);
|
||||
|
||||
private:
|
||||
QQnxIntegration *m_integration;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -41,6 +41,9 @@
|
||||
|
||||
#include "qqnxnavigatoreventhandler.h"
|
||||
|
||||
#include "qqnxintegration.h"
|
||||
#include "qqnxscreen.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QGuiApplication>
|
||||
#include <qpa/qwindowsysteminterface.h>
|
||||
@ -76,15 +79,8 @@ void QQnxNavigatorEventHandler::handleOrientationChange(int angle)
|
||||
void QQnxNavigatorEventHandler::handleSwipeDown()
|
||||
{
|
||||
qNavigatorEventHandlerDebug() << Q_FUNC_INFO;
|
||||
QWindow *w = QGuiApplication::focusWindow();
|
||||
|
||||
if (w) {
|
||||
// Get the top level window that is ancestor of the focus window
|
||||
while (QWindow *parent = w->parent())
|
||||
w = parent;
|
||||
|
||||
QWindowSystemInterface::handlePlatformPanelEvent(w);
|
||||
}
|
||||
Q_EMIT swipeDown();
|
||||
}
|
||||
|
||||
void QQnxNavigatorEventHandler::handleExit()
|
||||
|
@ -65,6 +65,7 @@ Q_SIGNALS:
|
||||
void windowGroupActivated(const QByteArray &id);
|
||||
void windowGroupDeactivated(const QByteArray &id);
|
||||
void windowGroupStateChanged(const QByteArray &id, Qt::WindowState state);
|
||||
void swipeDown();
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
Loading…
Reference in New Issue
Block a user