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 290ed7f8fa
.
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>
This commit is contained in:
parent
55cf7c577d
commit
9fbecf11c7
@ -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
|
||||
|
||||
|
78
src/plugins/platforms/qnx/qqnxcursor.cpp
Normal file
78
src/plugins/platforms/qnx/qqnxcursor.cpp
Normal file
@ -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
|
67
src/plugins/platforms/qnx/qqnxcursor.h
Normal file
67
src/plugins/platforms/qnx/qqnxcursor.h
Normal file
@ -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
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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];
|
||||
|
Loading…
Reference in New Issue
Block a user