summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Roquetto <rafael.roquetto.qnx@kdab.com>2012-12-11 16:10:01 -0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-02-28 17:31:12 +0100
commit9fbecf11c7c5f7c059d6ba84c3da1458eaee608d (patch)
treef102e3bfbd21f89b084559ed01a601b29aa65bed
parent55cf7c577da015bd6d48a034902477b83cf73be7 (diff)
QNX: QQnxCursor implementation.
Implementation of QQnxCursor, a QPlatformCursor subclass. Due to the lack of a proper cursor API from the underlying OS, this class only caches the current cursor position to make sure that the QCursor class works properly. This is a backport of 290ed7f8fafd67197f773454223410bbe57fc4d3. At the time there weren't any known bugs regarding this, so it was committed to "dev" branch as a feature. Now we needed it in "stable", otherwise menus don't work correctly, due to QCursor::pos() being bogus. Change-Id: I5a4217c92a0aaed0b22b45ca3c4e0fad882e810f Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
-rw-r--r--src/plugins/platforms/qnx/qnx.pro7
-rw-r--r--src/plugins/platforms/qnx/qqnxcursor.cpp78
-rw-r--r--src/plugins/platforms/qnx/qqnxcursor.h67
-rw-r--r--src/plugins/platforms/qnx/qqnxscreen.cpp11
-rw-r--r--src/plugins/platforms/qnx/qqnxscreen.h4
-rw-r--r--src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp2
6 files changed, 166 insertions, 3 deletions
diff --git a/src/plugins/platforms/qnx/qnx.pro b/src/plugins/platforms/qnx/qnx.pro
index 8367513fc5..203cdebda9 100644
--- a/src/plugins/platforms/qnx/qnx.pro
+++ b/src/plugins/platforms/qnx/qnx.pro
@@ -39,6 +39,7 @@ CONFIG(blackberry) {
#DEFINES += QQNXSCREEN_DEBUG
#DEFINES += QQNXVIRTUALKEYBOARD_DEBUG
#DEFINES += QQNXWINDOW_DEBUG
+#DEFINES += QQNXCURSOR_DEBUG
SOURCES = main.cpp \
@@ -54,7 +55,8 @@ SOURCES = main.cpp \
qqnxnavigatoreventhandler.cpp \
qqnxabstractnavigator.cpp \
qqnxabstractvirtualkeyboard.cpp \
- qqnxservices.cpp
+ qqnxservices.cpp \
+ qqnxcursor.cpp
HEADERS = main.h \
qqnxbuffer.h \
@@ -70,7 +72,8 @@ HEADERS = main.h \
qqnxnavigatoreventhandler.h \
qqnxabstractnavigator.h \
qqnxabstractvirtualkeyboard.h \
- qqnxservices.h
+ qqnxservices.h \
+ qqnxcursor.h
LIBS += -lscreen
diff --git a/src/plugins/platforms/qnx/qqnxcursor.cpp b/src/plugins/platforms/qnx/qqnxcursor.cpp
new file mode 100644
index 0000000000..4fdff666d7
--- /dev/null
+++ b/src/plugins/platforms/qnx/qqnxcursor.cpp
@@ -0,0 +1,78 @@
+/***************************************************************************
+**
+** Copyright (C) 2011 - 2012 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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, Digia gives you certain additional
+** rights. These rights are described in the Digia 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$
+**
+****************************************************************************/
+
+#include "qqnxcursor.h"
+
+#include <QtCore/QDebug>
+
+#ifdef QQNXCURSOR_DEBUG
+#define qCursorDebug qDebug
+#else
+#define qCursorDebug QT_NO_QDEBUG_MACRO
+#endif
+
+QT_BEGIN_NAMESPACE
+
+QQnxCursor::QQnxCursor()
+{
+}
+
+#ifndef QT_NO_CURSOR
+void QQnxCursor::changeCursor(QCursor *windowCursor, QWindow *window)
+{
+ Q_UNUSED(windowCursor);
+ Q_UNUSED(window);
+}
+#endif
+
+void QQnxCursor::setPos(const QPoint &pos)
+{
+ qCursorDebug() << "QQnxCursor::setPos -" << pos;
+ m_pos = pos;
+}
+
+QPoint QQnxCursor::pos() const
+{
+ qCursorDebug() << "QQnxCursor::pos -" << m_pos;
+ return m_pos;
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/platforms/qnx/qqnxcursor.h b/src/plugins/platforms/qnx/qqnxcursor.h
new file mode 100644
index 0000000000..5d6a8b2c30
--- /dev/null
+++ b/src/plugins/platforms/qnx/qqnxcursor.h
@@ -0,0 +1,67 @@
+/***************************************************************************
+**
+** Copyright (C) 2011 - 2012 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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, Digia gives you certain additional
+** rights. These rights are described in the Digia 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 QQNXCURSOR_H
+#define QQNXCURSOR_H
+
+#include <qpa/qplatformcursor.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQnxCursor : public QPlatformCursor
+{
+public:
+ QQnxCursor();
+
+#ifndef QT_NO_CURSOR
+ void changeCursor(QCursor *windowCursor, QWindow *window);
+#endif
+ void setPos(const QPoint &pos);
+
+ QPoint pos() const;
+
+private:
+ QPoint m_pos;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQNXCURSOR_H
diff --git a/src/plugins/platforms/qnx/qqnxscreen.cpp b/src/plugins/platforms/qnx/qqnxscreen.cpp
index 1e58f047ab..fc8b3bb167 100644
--- a/src/plugins/platforms/qnx/qqnxscreen.cpp
+++ b/src/plugins/platforms/qnx/qqnxscreen.cpp
@@ -41,6 +41,7 @@
#include "qqnxscreen.h"
#include "qqnxwindow.h"
+#include "qqnxcursor.h"
#include <QtCore/QThread>
#include <QtCore/QDebug>
@@ -110,7 +111,8 @@ QQnxScreen::QQnxScreen(screen_context_t screenContext, screen_display_t display,
m_posted(false),
m_keyboardHeight(0),
m_nativeOrientation(Qt::PrimaryOrientation),
- m_platformContext(0)
+ m_platformContext(0),
+ m_cursor(new QQnxCursor())
{
qScreenDebug() << Q_FUNC_INFO;
// Cache initial orientation of this display
@@ -149,6 +151,8 @@ QQnxScreen::QQnxScreen(screen_context_t screenContext, screen_display_t display,
QQnxScreen::~QQnxScreen()
{
qScreenDebug() << Q_FUNC_INFO;
+
+ delete m_cursor;
}
static int defaultDepth()
@@ -492,6 +496,11 @@ void QQnxScreen::onWindowPost(QQnxWindow *window)
}
}
+QPlatformCursor * QQnxScreen::cursor() const
+{
+ return m_cursor;
+}
+
void QQnxScreen::keyboardHeightChanged(int height)
{
if (height == m_keyboardHeight)
diff --git a/src/plugins/platforms/qnx/qqnxscreen.h b/src/plugins/platforms/qnx/qqnxscreen.h
index 2851c13c52..39cd4159d1 100644
--- a/src/plugins/platforms/qnx/qqnxscreen.h
+++ b/src/plugins/platforms/qnx/qqnxscreen.h
@@ -95,6 +95,8 @@ public:
QSharedPointer<QQnxRootWindow> rootWindow() const;
+ QPlatformCursor *cursor() const;
+
public Q_SLOTS:
void setRotation(int rotation);
void newWindowCreated(void *window);
@@ -130,6 +132,8 @@ private:
QList<QQnxWindow *> m_childWindows;
QList<screen_window_t> m_overlays;
+
+ QPlatformCursor *m_cursor;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp
index 4412bb34bd..2d3c7608bf 100644
--- a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp
+++ b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp
@@ -347,6 +347,8 @@ void QQnxScreenEventHandler::handleTouchEvent(screen_event_t event, int qnxType)
qFatal("QQNX: failed to query event position, errno=%d", errno);
}
+ QCursor::setPos(pos[0], pos[1]);
+
// get window coordinates of touch
errno = 0;
int windowPos[2];