Rename blackberry QPA plugin to QNX
Changing the naming scheme from Blackberry to QNX in line with pattern of using platform names. Change-Id: I048a6a18010bc932311d63c8dde19ccab97894c8 Reviewed-by: Robin Burchell <robin+qt@viroteck.net> Reviewed-by: Nicolas Arnaud-Cormos <nicolas@kdab.com>
This commit is contained in:
parent
61692bfefe
commit
9a81e37107
@ -1,71 +0,0 @@
|
||||
TARGET = blackberry
|
||||
include(../../qpluginbase.pri)
|
||||
|
||||
QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms
|
||||
QT += opengl opengl-private platformsupport platformsupport-private widgets-private
|
||||
|
||||
# Uncomment this to build with support for IMF once it becomes available in the BBNDK
|
||||
#CONFIG += qbb_imf
|
||||
|
||||
# Uncomment these to enable debugging output for various aspects of the plugin
|
||||
#DEFINES += QBBBUFFER_DEBUG
|
||||
#DEFINES += QBBCLIPBOARD_DEBUG
|
||||
#DEFINES += QBBEVENTTHREAD_DEBUG
|
||||
#DEFINES += QBBGLBACKINGSTORE_DEBUG
|
||||
#DEFINES += QBBGLCONTEXT_DEBUG
|
||||
#DEFINES += QBBINPUTCONTEXT_DEBUG
|
||||
#DEFINES += QBBINPUTCONTEXT_IMF_EVENT_DEBUG
|
||||
#DEFINES += QBBINTEGRATION_DEBUG
|
||||
#DEFINES += QBBNAVIGATORTHREAD_DEBUG
|
||||
#DEFINES += QBBRASTERBACKINGSTORE_DEBUG
|
||||
#DEFINES += QBBROOTWINDOW_DEBUG
|
||||
#DEFINES += QBBSCREEN_DEBUG
|
||||
#DEFINES += QBBVIRTUALKEYBOARD_DEBUG
|
||||
#DEFINES += QBBWINDOW_DEBUG
|
||||
|
||||
SOURCES = main.cpp \
|
||||
qbbbuffer.cpp \
|
||||
qbbeventthread.cpp \
|
||||
qbbglcontext.cpp \
|
||||
qbbglbackingstore.cpp \
|
||||
qbbintegration.cpp \
|
||||
qbbnavigatorthread.cpp \
|
||||
qbbscreen.cpp \
|
||||
qbbwindow.cpp \
|
||||
qbbrasterbackingstore.cpp \
|
||||
qbbvirtualkeyboard.cpp \
|
||||
qbbclipboard.cpp \
|
||||
qbbrootwindow.cpp
|
||||
|
||||
HEADERS = qbbbuffer.h \
|
||||
qbbeventthread.h \
|
||||
qbbkeytranslator.h \
|
||||
qbbintegration.h \
|
||||
qbbnavigatorthread.h \
|
||||
qbbglcontext.h \
|
||||
qbbglbackingstore.h \
|
||||
qbbscreen.h \
|
||||
qbbwindow.h \
|
||||
qbbrasterbackingstore.h \
|
||||
qbbvirtualkeyboard.h \
|
||||
qbbclipboard.h \
|
||||
qbbrootwindow.h
|
||||
|
||||
CONFIG(qbb_imf) {
|
||||
DEFINES += QBB_IMF
|
||||
HEADERS += qbbinputcontext_imf.h
|
||||
SOURCES += qbbinputcontext_imf.cpp
|
||||
} else {
|
||||
HEADERS += qbbinputcontext_noimf.h
|
||||
SOURCES += qbbinputcontext_noimf.cpp
|
||||
}
|
||||
|
||||
QMAKE_CXXFLAGS += -I./private
|
||||
|
||||
LIBS += -lpps -lscreen -lEGL -lclipboard
|
||||
|
||||
include (../../../platformsupport/eglconvenience/eglconvenience.pri)
|
||||
include (../../../platformsupport/fontdatabases/fontdatabases.pri)
|
||||
|
||||
target.path += $$[QT_INSTALL_PLUGINS]/platforms
|
||||
INSTALLS += target
|
@ -13,5 +13,5 @@ mac {
|
||||
win32: SUBDIRS += windows
|
||||
|
||||
qnx-*-qcc {
|
||||
SUBDIRS += blackberry
|
||||
SUBDIRS += qnx
|
||||
}
|
||||
|
@ -40,33 +40,33 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <QtGui/QPlatformIntegrationPlugin>
|
||||
#include "qbbintegration.h"
|
||||
#include "qqnxintegration.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QBBIntegrationPlugin : public QPlatformIntegrationPlugin
|
||||
class QQnxIntegrationPlugin : public QPlatformIntegrationPlugin
|
||||
{
|
||||
public:
|
||||
QStringList keys() const;
|
||||
QPlatformIntegration *create(const QString&, const QStringList&);
|
||||
};
|
||||
|
||||
QStringList QBBIntegrationPlugin::keys() const
|
||||
QStringList QQnxIntegrationPlugin::keys() const
|
||||
{
|
||||
QStringList list;
|
||||
list << QLatin1String("blackberry");
|
||||
list << QLatin1String("qnx");
|
||||
return list;
|
||||
}
|
||||
|
||||
QPlatformIntegration *QBBIntegrationPlugin::create(const QString& system, const QStringList& paramList)
|
||||
QPlatformIntegration *QQnxIntegrationPlugin::create(const QString& system, const QStringList& paramList)
|
||||
{
|
||||
Q_UNUSED(paramList);
|
||||
if (system.toLower() == QLatin1String("blackberry"))
|
||||
return new QBBIntegration;
|
||||
if (system.toLower() == QLatin1String("qnx"))
|
||||
return new QQnxIntegration;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Q_EXPORT_PLUGIN2(blackberry, QBBIntegrationPlugin)
|
||||
Q_EXPORT_PLUGIN2(qnx, QQnxIntegrationPlugin)
|
||||
|
||||
QT_END_NAMESPACE
|
71
src/plugins/platforms/qnx/qnx.pro
Normal file
71
src/plugins/platforms/qnx/qnx.pro
Normal file
@ -0,0 +1,71 @@
|
||||
TARGET = qnx
|
||||
include(../../qpluginbase.pri)
|
||||
|
||||
QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms
|
||||
QT += opengl opengl-private platformsupport platformsupport-private widgets-private
|
||||
|
||||
# Uncomment this to build with support for IMF once it becomes available in the BBNDK
|
||||
#CONFIG += qqnx_imf
|
||||
|
||||
# Uncomment these to enable debugging output for various aspects of the plugin
|
||||
#DEFINES += QQNXBUFFER_DEBUG
|
||||
#DEFINES += QQNXCLIPBOARD_DEBUG
|
||||
#DEFINES += QQNXEVENTTHREAD_DEBUG
|
||||
#DEFINES += QQNXGLBACKINGSTORE_DEBUG
|
||||
#DEFINES += QQNXGLCONTEXT_DEBUG
|
||||
#DEFINES += QQNXINPUTCONTEXT_DEBUG
|
||||
#DEFINES += QQNXINPUTCONTEXT_IMF_EVENT_DEBUG
|
||||
#DEFINES += QQNXINTEGRATION_DEBUG
|
||||
#DEFINES += QQNXNAVIGATORTHREAD_DEBUG
|
||||
#DEFINES += QQNXRASTERBACKINGSTORE_DEBUG
|
||||
#DEFINES += QQNXROOTWINDOW_DEBUG
|
||||
#DEFINES += QQNXSCREEN_DEBUG
|
||||
#DEFINES += QQNXVIRTUALKEYBOARD_DEBUG
|
||||
#DEFINES += QQNXWINDOW_DEBUG
|
||||
|
||||
SOURCES = main.cpp \
|
||||
qqnxbuffer.cpp \
|
||||
qqnxeventthread.cpp \
|
||||
qqnxglcontext.cpp \
|
||||
qqnxglbackingstore.cpp \
|
||||
qqnxintegration.cpp \
|
||||
qqnxnavigatorthread.cpp \
|
||||
qqnxscreen.cpp \
|
||||
qqnxwindow.cpp \
|
||||
qqnxrasterbackingstore.cpp \
|
||||
qqnxvirtualkeyboard.cpp \
|
||||
qqnxclipboard.cpp \
|
||||
qqnxrootwindow.cpp
|
||||
|
||||
HEADERS = qqnxbuffer.h \
|
||||
qqnxeventthread.h \
|
||||
qqnxkeytranslator.h \
|
||||
qqnxintegration.h \
|
||||
qqnxnavigatorthread.h \
|
||||
qqnxglcontext.h \
|
||||
qqnxglbackingstore.h \
|
||||
qqnxscreen.h \
|
||||
qqnxwindow.h \
|
||||
qqnxrasterbackingstore.h \
|
||||
qqnxvirtualkeyboard.h \
|
||||
qqnxclipboard.h \
|
||||
qqnxrootwindow.h
|
||||
|
||||
CONFIG(qqnx_imf) {
|
||||
DEFINES += QQNX_IMF
|
||||
HEADERS += qqnxinputcontext_imf.h
|
||||
SOURCES += qqnxinputcontext_imf.cpp
|
||||
} else {
|
||||
HEADERS += qqnxinputcontext_noimf.h
|
||||
SOURCES += qqnxinputcontext_noimf.cpp
|
||||
}
|
||||
|
||||
QMAKE_CXXFLAGS += -I./private
|
||||
|
||||
LIBS += -lpps -lscreen -lEGL -lclipboard
|
||||
|
||||
include (../../../platformsupport/eglconvenience/eglconvenience.pri)
|
||||
include (../../../platformsupport/fontdatabases/fontdatabases.pri)
|
||||
|
||||
target.path += $$[QT_INSTALL_PLUGINS]/platforms
|
||||
INSTALLS += target
|
@ -39,7 +39,7 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qbbbuffer.h"
|
||||
#include "qqnxbuffer.h"
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
@ -48,19 +48,19 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QBBBuffer::QBBBuffer()
|
||||
QQnxBuffer::QQnxBuffer()
|
||||
: m_buffer(0)
|
||||
{
|
||||
#if defined(QBBBUFFER_DEBUG)
|
||||
qDebug() << "QBBBuffer::QBBBuffer - empty";
|
||||
#if defined(QQNXBUFFER_DEBUG)
|
||||
qDebug() << "QQnxBuffer::QQnxBuffer - empty";
|
||||
#endif
|
||||
}
|
||||
|
||||
QBBBuffer::QBBBuffer(screen_buffer_t buffer)
|
||||
QQnxBuffer::QQnxBuffer(screen_buffer_t buffer)
|
||||
: m_buffer(buffer)
|
||||
{
|
||||
#if defined(QBBBUFFER_DEBUG)
|
||||
qDebug() << "QBBBuffer::QBBBuffer - normal";
|
||||
#if defined(QQNXBUFFER_DEBUG)
|
||||
qDebug() << "QQnxBuffer::QQnxBuffer - normal";
|
||||
#endif
|
||||
|
||||
// Get size of buffer
|
||||
@ -68,7 +68,7 @@ QBBBuffer::QBBBuffer(screen_buffer_t buffer)
|
||||
int size[2];
|
||||
int result = screen_get_buffer_property_iv(buffer, SCREEN_PROPERTY_BUFFER_SIZE, size);
|
||||
if (result != 0) {
|
||||
qFatal("QBB: failed to query buffer size, errno=%d", errno);
|
||||
qFatal("QQNX: failed to query buffer size, errno=%d", errno);
|
||||
}
|
||||
|
||||
// Get stride of buffer
|
||||
@ -76,7 +76,7 @@ QBBBuffer::QBBBuffer(screen_buffer_t buffer)
|
||||
int stride;
|
||||
result = screen_get_buffer_property_iv(buffer, SCREEN_PROPERTY_STRIDE, &stride);
|
||||
if (result != 0) {
|
||||
qFatal("QBB: failed to query buffer stride, errno=%d", errno);
|
||||
qFatal("QQNX: failed to query buffer stride, errno=%d", errno);
|
||||
}
|
||||
|
||||
// Get access to buffer's data
|
||||
@ -84,10 +84,10 @@ QBBBuffer::QBBBuffer(screen_buffer_t buffer)
|
||||
uchar *dataPtr = 0;
|
||||
result = screen_get_buffer_property_pv(buffer, SCREEN_PROPERTY_POINTER, (void **)&dataPtr);
|
||||
if (result != 0) {
|
||||
qFatal("QBB: failed to query buffer pointer, errno=%d", errno);
|
||||
qFatal("QQNX: failed to query buffer pointer, errno=%d", errno);
|
||||
}
|
||||
if (dataPtr == NULL) {
|
||||
qFatal("QBB: buffer pointer is NULL, errno=%d", errno);
|
||||
qFatal("QQNX: buffer pointer is NULL, errno=%d", errno);
|
||||
}
|
||||
|
||||
// Get format of buffer
|
||||
@ -95,7 +95,7 @@ QBBBuffer::QBBBuffer(screen_buffer_t buffer)
|
||||
int screenFormat;
|
||||
result = screen_get_buffer_property_iv(buffer, SCREEN_PROPERTY_FORMAT, &screenFormat);
|
||||
if (result != 0) {
|
||||
qFatal("QBB: failed to query buffer format, errno=%d", errno);
|
||||
qFatal("QQNX: failed to query buffer format, errno=%d", errno);
|
||||
}
|
||||
|
||||
// Convert screen format to QImage format
|
||||
@ -120,45 +120,45 @@ QBBBuffer::QBBBuffer(screen_buffer_t buffer)
|
||||
imageFormat = QImage::Format_ARGB32_Premultiplied;
|
||||
break;
|
||||
default:
|
||||
qFatal("QBB: unsupported buffer format, format=%d", screenFormat);
|
||||
qFatal("QQNX: unsupported buffer format, format=%d", screenFormat);
|
||||
}
|
||||
|
||||
// wrap buffer in an image
|
||||
m_image = QImage(dataPtr, size[0], size[1], stride, imageFormat);
|
||||
}
|
||||
|
||||
QBBBuffer::QBBBuffer(const QBBBuffer &other)
|
||||
QQnxBuffer::QQnxBuffer(const QQnxBuffer &other)
|
||||
: m_buffer(other.m_buffer),
|
||||
m_image(other.m_image)
|
||||
{
|
||||
#if defined(QBBBUFFER_DEBUG)
|
||||
qDebug() << "QBBBuffer::QBBBuffer - copy";
|
||||
#if defined(QQNXBUFFER_DEBUG)
|
||||
qDebug() << "QQnxBuffer::QQnxBuffer - copy";
|
||||
#endif
|
||||
}
|
||||
|
||||
QBBBuffer::~QBBBuffer()
|
||||
QQnxBuffer::~QQnxBuffer()
|
||||
{
|
||||
#if defined(QBBBUFFER_DEBUG)
|
||||
qDebug() << "QBBBuffer::~QBBBuffer";
|
||||
#if defined(QQNXBUFFER_DEBUG)
|
||||
qDebug() << "QQnxBuffer::~QQnxBuffer";
|
||||
#endif
|
||||
}
|
||||
|
||||
void QBBBuffer::invalidateInCache()
|
||||
void QQnxBuffer::invalidateInCache()
|
||||
{
|
||||
#if defined(QBBBUFFER_DEBUG)
|
||||
qDebug() << "QBBBuffer::invalidateInCache";
|
||||
#if defined(QQNXBUFFER_DEBUG)
|
||||
qDebug() << "QQnxBuffer::invalidateInCache";
|
||||
#endif
|
||||
|
||||
// Verify native buffer exists
|
||||
if (m_buffer == 0) {
|
||||
qFatal("QBB: can't invalidate cache for null buffer");
|
||||
qFatal("QQNX: can't invalidate cache for null buffer");
|
||||
}
|
||||
|
||||
// Evict buffer's data from cache
|
||||
errno = 0;
|
||||
int result = msync(m_image.bits(), m_image.height() * m_image.bytesPerLine(), MS_INVALIDATE | MS_CACHE_ONLY);
|
||||
if (result != 0) {
|
||||
qFatal("QBB: failed to invalidate cache, errno=%d", errno);
|
||||
qFatal("QQNX: failed to invalidate cache, errno=%d", errno);
|
||||
}
|
||||
}
|
||||
|
@ -39,8 +39,8 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QBBBUFFER_H
|
||||
#define QBBBUFFER_H
|
||||
#ifndef QQNXBUFFER_H
|
||||
#define QQNXBUFFER_H
|
||||
|
||||
#include <QtGui/QImage>
|
||||
|
||||
@ -48,13 +48,13 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QBBBuffer
|
||||
class QQnxBuffer
|
||||
{
|
||||
public:
|
||||
QBBBuffer();
|
||||
QBBBuffer(screen_buffer_t buffer);
|
||||
QBBBuffer(const QBBBuffer &other);
|
||||
virtual ~QBBBuffer();
|
||||
QQnxBuffer();
|
||||
QQnxBuffer(screen_buffer_t buffer);
|
||||
QQnxBuffer(const QQnxBuffer &other);
|
||||
virtual ~QQnxBuffer();
|
||||
|
||||
screen_buffer_t nativeBuffer() const { return m_buffer; }
|
||||
const QImage *image() const { return (m_buffer != NULL) ? &m_image : NULL; }
|
||||
@ -71,4 +71,4 @@ private:
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QBBBUFFER_H
|
||||
#endif // QQNXBUFFER_H
|
@ -41,7 +41,7 @@
|
||||
|
||||
#ifndef QT_NO_CLIPBOARD
|
||||
|
||||
#include "qbbclipboard.h"
|
||||
#include "qqnxclipboard.h"
|
||||
|
||||
#include <QtGui/QColor>
|
||||
|
||||
@ -73,11 +73,11 @@ static QByteArray readClipboardBuff(const char *type)
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
class QBBClipboard::MimeData : public QMimeData
|
||||
class QQnxClipboard::MimeData : public QMimeData
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MimeData(QBBClipboard *clipboard)
|
||||
MimeData(QQnxClipboard *clipboard)
|
||||
: QMimeData(),
|
||||
m_clipboard(clipboard),
|
||||
m_userMimeData(0)
|
||||
@ -97,7 +97,7 @@ public:
|
||||
void addFormatToCheck(const QString &format) {
|
||||
m_formatsToCheck << format;
|
||||
|
||||
#if defined(QBBCLIPBOARD_DEBUG)
|
||||
#if defined(QQNXCLIPBOARD_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO << "formats=" << m_formatsToCheck;
|
||||
#endif
|
||||
}
|
||||
@ -105,7 +105,7 @@ public:
|
||||
bool hasFormat(const QString &mimetype) const
|
||||
{
|
||||
const bool result = is_clipboard_format_present(mimetype.toUtf8().constData()) == 0;
|
||||
#if defined(QBBCLIPBOARD_DEBUG)
|
||||
#if defined(QQNXCLIPBOARD_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO << "mimetype=" << mimetype << "result=" << result;
|
||||
#endif
|
||||
return result;
|
||||
@ -120,7 +120,7 @@ public:
|
||||
result << format;
|
||||
}
|
||||
|
||||
#if defined(QBBCLIPBOARD_DEBUG)
|
||||
#if defined(QQNXCLIPBOARD_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO << "result=" << result;
|
||||
#endif
|
||||
return result;
|
||||
@ -146,7 +146,7 @@ public:
|
||||
protected:
|
||||
QVariant retrieveData(const QString &mimetype, QVariant::Type preferredType) const
|
||||
{
|
||||
#if defined(QBBCLIPBOARD_DEBUG)
|
||||
#if defined(QQNXCLIPBOARD_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO << "mimetype=" << mimetype << "preferredType=" << preferredType;
|
||||
#endif
|
||||
if (is_clipboard_format_present(mimetype.toUtf8().constData()) != 0)
|
||||
@ -160,7 +160,7 @@ private Q_SLOTS:
|
||||
void releaseOwnership()
|
||||
{
|
||||
if (m_userMimeData) {
|
||||
#if defined(QBBCLIPBOARD_DEBUG)
|
||||
#if defined(QQNXCLIPBOARD_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO << "user data formats=" << m_userMimeData->formats() << "system formats=" << formats();
|
||||
#endif
|
||||
delete m_userMimeData;
|
||||
@ -170,23 +170,23 @@ private Q_SLOTS:
|
||||
}
|
||||
|
||||
private:
|
||||
QBBClipboard * const m_clipboard;
|
||||
QQnxClipboard * const m_clipboard;
|
||||
|
||||
QSet<QString> m_formatsToCheck;
|
||||
QMimeData *m_userMimeData;
|
||||
};
|
||||
|
||||
QBBClipboard::QBBClipboard()
|
||||
QQnxClipboard::QQnxClipboard()
|
||||
: m_mimeData(new MimeData(this))
|
||||
{
|
||||
}
|
||||
|
||||
QBBClipboard::~QBBClipboard()
|
||||
QQnxClipboard::~QQnxClipboard()
|
||||
{
|
||||
delete m_mimeData;
|
||||
}
|
||||
|
||||
void QBBClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode)
|
||||
void QQnxClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode)
|
||||
{
|
||||
if (mode != QClipboard::Clipboard)
|
||||
return;
|
||||
@ -203,7 +203,7 @@ void QBBClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode)
|
||||
return;
|
||||
|
||||
const QStringList formats = data->formats();
|
||||
#if defined(QBBCLIPBOARD_DEBUG)
|
||||
#if defined(QQNXCLIPBOARD_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO << "formats=" << formats;
|
||||
#endif
|
||||
|
||||
@ -214,8 +214,8 @@ void QBBClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode)
|
||||
continue;
|
||||
|
||||
int ret = set_clipboard_data(format.toUtf8().data(), buf.size(), buf.data());
|
||||
#if defined(QBBCLIPBOARD_DEBUG)
|
||||
qDebug() << "QBB: set " << format << "to clipboard, size=" << buf.size() << ";ret=" << ret;
|
||||
#if defined(QQNXCLIPBOARD_DEBUG)
|
||||
qDebug() << "QQNX: set " << format << "to clipboard, size=" << buf.size() << ";ret=" << ret;
|
||||
#endif
|
||||
if (ret)
|
||||
m_mimeData->addFormatToCheck(format);
|
||||
@ -224,7 +224,7 @@ void QBBClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode)
|
||||
emitChanged(QClipboard::Clipboard);
|
||||
}
|
||||
|
||||
QMimeData *QBBClipboard::mimeData(QClipboard::Mode mode)
|
||||
QMimeData *QQnxClipboard::mimeData(QClipboard::Mode mode)
|
||||
{
|
||||
if (mode != QClipboard::Clipboard)
|
||||
return 0;
|
||||
@ -239,6 +239,6 @@ QMimeData *QBBClipboard::mimeData(QClipboard::Mode mode)
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#include "qbbclipboard.moc"
|
||||
#include "qqnxclipboard.moc"
|
||||
|
||||
#endif //QT_NO_CLIPBOARD
|
@ -39,19 +39,19 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QBBCLIPBOARD_H
|
||||
#define QBBCLIPBOARD_H
|
||||
#ifndef QQNXCLIPBOARD_H
|
||||
#define QQNXCLIPBOARD_H
|
||||
|
||||
#ifndef QT_NO_CLIPBOARD
|
||||
#include <QtGui/QPlatformClipboard>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QBBClipboard : public QPlatformClipboard
|
||||
class QQnxClipboard : public QPlatformClipboard
|
||||
{
|
||||
public:
|
||||
QBBClipboard();
|
||||
virtual ~QBBClipboard();
|
||||
QQnxClipboard();
|
||||
virtual ~QQnxClipboard();
|
||||
virtual QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard);
|
||||
virtual void setMimeData(QMimeData *data, QClipboard::Mode mode = QClipboard::Clipboard);
|
||||
|
||||
@ -63,4 +63,4 @@ private:
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif //QT_NO_CLIPBOARD
|
||||
#endif //QBBCLIPBOARD_H
|
||||
#endif //QQNXCLIPBOARD_H
|
@ -39,14 +39,14 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qbbeventthread.h"
|
||||
#include "qbbintegration.h"
|
||||
#include "qbbkeytranslator.h"
|
||||
#include "qqnxeventthread.h"
|
||||
#include "qqnxintegration.h"
|
||||
#include "qqnxkeytranslator.h"
|
||||
|
||||
#if defined(QBB_IMF)
|
||||
#include "qbbinputcontext_imf.h"
|
||||
#if defined(QQNX_IMF)
|
||||
#include "qqnxinputcontext_imf.h"
|
||||
#else
|
||||
#include "qbbinputcontext_noimf.h"
|
||||
#include "qqnxinputcontext_noimf.h"
|
||||
#endif
|
||||
|
||||
#include <QtGui/QWindow>
|
||||
@ -61,7 +61,7 @@
|
||||
|
||||
#include <cctype>
|
||||
|
||||
QBBEventThread::QBBEventThread(screen_context_t context, QPlatformScreen& screen)
|
||||
QQnxEventThread::QQnxEventThread(screen_context_t context, QPlatformScreen& screen)
|
||||
: QThread(),
|
||||
m_screenContext(context),
|
||||
m_platformScreen(screen),
|
||||
@ -89,13 +89,13 @@ QBBEventThread::QBBEventThread(screen_context_t context, QPlatformScreen& screen
|
||||
}
|
||||
}
|
||||
|
||||
QBBEventThread::~QBBEventThread()
|
||||
QQnxEventThread::~QQnxEventThread()
|
||||
{
|
||||
// block until thread terminates
|
||||
shutdown();
|
||||
}
|
||||
|
||||
void QBBEventThread::run()
|
||||
void QQnxEventThread::run()
|
||||
{
|
||||
screen_event_t event;
|
||||
|
||||
@ -103,11 +103,11 @@ void QBBEventThread::run()
|
||||
errno = 0;
|
||||
int result = screen_create_event(&event);
|
||||
if (result) {
|
||||
qFatal("QBB: failed to create event, errno=%d", errno);
|
||||
qFatal("QQNX: failed to create event, errno=%d", errno);
|
||||
}
|
||||
|
||||
#if defined(QBBEVENTTHREAD_DEBUG)
|
||||
qDebug() << "QBB: event loop started";
|
||||
#if defined(QQNXEVENTTHREAD_DEBUG)
|
||||
qDebug() << "QQNX: event loop started";
|
||||
#endif
|
||||
|
||||
// loop indefinitely
|
||||
@ -117,22 +117,22 @@ void QBBEventThread::run()
|
||||
errno = 0;
|
||||
result = screen_get_event(m_screenContext, event, -1);
|
||||
if (result) {
|
||||
qFatal("QBB: failed to get event, errno=%d", errno);
|
||||
qFatal("QQNX: failed to get event, errno=%d", errno);
|
||||
}
|
||||
|
||||
// process received event
|
||||
dispatchEvent(event);
|
||||
}
|
||||
|
||||
#if defined(QBBEVENTTHREAD_DEBUG)
|
||||
qDebug() << "QBB: event loop stopped";
|
||||
#if defined(QQNXEVENTTHREAD_DEBUG)
|
||||
qDebug() << "QQNX: event loop stopped";
|
||||
#endif
|
||||
|
||||
// cleanup
|
||||
screen_destroy_event(event);
|
||||
}
|
||||
|
||||
void QBBEventThread::shutdown()
|
||||
void QQnxEventThread::shutdown()
|
||||
{
|
||||
screen_event_t event;
|
||||
|
||||
@ -140,7 +140,7 @@ void QBBEventThread::shutdown()
|
||||
errno = 0;
|
||||
int result = screen_create_event(&event);
|
||||
if (result) {
|
||||
qFatal("QBB: failed to create event, errno=%d", errno);
|
||||
qFatal("QQNX: failed to create event, errno=%d", errno);
|
||||
}
|
||||
|
||||
// set the event type as user
|
||||
@ -148,7 +148,7 @@ void QBBEventThread::shutdown()
|
||||
int type = SCREEN_EVENT_USER;
|
||||
result = screen_set_event_property_iv(event, SCREEN_PROPERTY_TYPE, &type);
|
||||
if (result) {
|
||||
qFatal("QBB: failed to set event type, errno=%d", errno);
|
||||
qFatal("QQNX: failed to set event type, errno=%d", errno);
|
||||
}
|
||||
|
||||
// NOTE: ignore SCREEN_PROPERTY_USER_DATA; treat all user events as shutdown events
|
||||
@ -157,32 +157,32 @@ void QBBEventThread::shutdown()
|
||||
errno = 0;
|
||||
result = screen_send_event(m_screenContext, event, getpid());
|
||||
if (result) {
|
||||
qFatal("QBB: failed to set event type, errno=%d", errno);
|
||||
qFatal("QQNX: failed to set event type, errno=%d", errno);
|
||||
}
|
||||
|
||||
// cleanup
|
||||
screen_destroy_event(event);
|
||||
|
||||
#if defined(QBBEVENTTHREAD_DEBUG)
|
||||
qDebug() << "QBB: event loop shutdown begin";
|
||||
#if defined(QQNXEVENTTHREAD_DEBUG)
|
||||
qDebug() << "QQNX: event loop shutdown begin";
|
||||
#endif
|
||||
|
||||
// block until thread terminates
|
||||
wait();
|
||||
|
||||
#if defined(QBBEVENTTHREAD_DEBUG)
|
||||
qDebug() << "QBB: event loop shutdown end";
|
||||
#if defined(QQNXEVENTTHREAD_DEBUG)
|
||||
qDebug() << "QQNX: event loop shutdown end";
|
||||
#endif
|
||||
}
|
||||
|
||||
void QBBEventThread::dispatchEvent(screen_event_t event)
|
||||
void QQnxEventThread::dispatchEvent(screen_event_t event)
|
||||
{
|
||||
// get the event type
|
||||
errno = 0;
|
||||
int qnxType;
|
||||
int result = screen_get_event_property_iv(event, SCREEN_PROPERTY_TYPE, &qnxType);
|
||||
if (result) {
|
||||
qFatal("QBB: failed to query event type, errno=%d", errno);
|
||||
qFatal("QQNX: failed to query event type, errno=%d", errno);
|
||||
}
|
||||
|
||||
switch (qnxType) {
|
||||
@ -206,29 +206,29 @@ void QBBEventThread::dispatchEvent(screen_event_t event)
|
||||
|
||||
case SCREEN_EVENT_USER:
|
||||
// treat all user events as shutdown requests
|
||||
#if defined(QBBEVENTTHREAD_DEBUG)
|
||||
qDebug() << "QBB: QNX user event";
|
||||
#if defined(QQNXEVENTTHREAD_DEBUG)
|
||||
qDebug() << "QQNX: QNX user event";
|
||||
#endif
|
||||
m_quit = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
// event ignored
|
||||
#if defined(QBBEVENTTHREAD_DEBUG)
|
||||
qDebug() << "QBB: QNX unknown event";
|
||||
#if defined(QQNXEVENTTHREAD_DEBUG)
|
||||
qDebug() << "QQNX: QNX unknown event";
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void QBBEventThread::handleKeyboardEvent(screen_event_t event)
|
||||
void QQnxEventThread::handleKeyboardEvent(screen_event_t event)
|
||||
{
|
||||
// get flags of key event
|
||||
errno = 0;
|
||||
int flags;
|
||||
int result = screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_FLAGS, &flags);
|
||||
if (result) {
|
||||
qFatal("QBB: failed to query event flags, errno=%d", errno);
|
||||
qFatal("QQNX: failed to query event flags, errno=%d", errno);
|
||||
}
|
||||
|
||||
// get key code
|
||||
@ -236,31 +236,31 @@ void QBBEventThread::handleKeyboardEvent(screen_event_t event)
|
||||
int sym;
|
||||
result = screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_SYM, &sym);
|
||||
if (result) {
|
||||
qFatal("QBB: failed to query event sym, errno=%d", errno);
|
||||
qFatal("QQNX: failed to query event sym, errno=%d", errno);
|
||||
}
|
||||
|
||||
int modifiers;
|
||||
result = screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_MODIFIERS, &modifiers);
|
||||
if (result) {
|
||||
qFatal("QBB: failed to query event modifiers, errno=%d", errno);
|
||||
qFatal("QQNX: failed to query event modifiers, errno=%d", errno);
|
||||
}
|
||||
|
||||
int scan;
|
||||
result = screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_SCAN, &scan);
|
||||
if (result) {
|
||||
qFatal("QBB: failed to query event modifiers, errno=%d", errno);
|
||||
qFatal("QQNX: failed to query event modifiers, errno=%d", errno);
|
||||
}
|
||||
|
||||
int cap;
|
||||
result = screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_CAP, &cap);
|
||||
if (result) {
|
||||
qFatal("QBB: failed to query event cap, errno=%d", errno);
|
||||
qFatal("QQNX: failed to query event cap, errno=%d", errno);
|
||||
}
|
||||
|
||||
injectKeyboardEvent(flags, sym, modifiers, scan, cap);
|
||||
}
|
||||
|
||||
void QBBEventThread::injectKeyboardEvent(int flags, int sym, int modifiers, int scan, int cap)
|
||||
void QQnxEventThread::injectKeyboardEvent(int flags, int sym, int modifiers, int scan, int cap)
|
||||
{
|
||||
Q_UNUSED(scan);
|
||||
|
||||
@ -300,13 +300,13 @@ void QBBEventThread::injectKeyboardEvent(int flags, int sym, int modifiers, int
|
||||
}
|
||||
|
||||
QWindowSystemInterface::handleKeyEvent(QGuiApplication::focusWindow(), type, key, qtMod, keyStr);
|
||||
#if defined(QBBEVENTTHREAD_DEBUG)
|
||||
qDebug() << "QBB: Qt key t=" << type << ", k=" << key << ", s=" << keyStr;
|
||||
#if defined(QQNXEVENTTHREAD_DEBUG)
|
||||
qDebug() << "QQNX: Qt key t=" << type << ", k=" << key << ", s=" << keyStr;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void QBBEventThread::handlePointerEvent(screen_event_t event)
|
||||
void QQnxEventThread::handlePointerEvent(screen_event_t event)
|
||||
{
|
||||
errno = 0;
|
||||
|
||||
@ -315,7 +315,7 @@ void QBBEventThread::handlePointerEvent(screen_event_t event)
|
||||
void *handle;
|
||||
int result = screen_get_event_property_pv(event, SCREEN_PROPERTY_WINDOW, &handle);
|
||||
if (result) {
|
||||
qFatal("QBB: failed to query event window, errno=%d", errno);
|
||||
qFatal("QQNX: failed to query event window, errno=%d", errno);
|
||||
}
|
||||
qnxWindow = static_cast<screen_window_t>(handle);
|
||||
|
||||
@ -323,48 +323,48 @@ void QBBEventThread::handlePointerEvent(screen_event_t event)
|
||||
int buttonState = 0;
|
||||
result = screen_get_event_property_iv(event, SCREEN_PROPERTY_BUTTONS, &buttonState);
|
||||
if (result) {
|
||||
qFatal("QBB: failed to query event button state, errno=%d", errno);
|
||||
qFatal("QQNX: failed to query event button state, errno=%d", errno);
|
||||
}
|
||||
|
||||
// Query the window position
|
||||
int windowPos[2];
|
||||
result = screen_get_event_property_iv(event, SCREEN_PROPERTY_SOURCE_POSITION, windowPos);
|
||||
if (result) {
|
||||
qFatal("QBB: failed to query event window position, errno=%d", errno);
|
||||
qFatal("QQNX: failed to query event window position, errno=%d", errno);
|
||||
}
|
||||
|
||||
// Query the screen position
|
||||
int pos[2];
|
||||
result = screen_get_event_property_iv(event, SCREEN_PROPERTY_POSITION, pos);
|
||||
if (result) {
|
||||
qFatal("QBB: failed to query event position, errno=%d", errno);
|
||||
qFatal("QQNX: failed to query event position, errno=%d", errno);
|
||||
}
|
||||
|
||||
// Query the wheel delta
|
||||
int wheelDelta = 0;
|
||||
result = screen_get_event_property_iv(event, SCREEN_PROPERTY_MOUSE_WHEEL, &wheelDelta);
|
||||
if (result) {
|
||||
qFatal("QBB: failed to query event wheel delta, errno=%d", errno);
|
||||
qFatal("QQNX: failed to query event wheel delta, errno=%d", errno);
|
||||
}
|
||||
|
||||
// Map window handle to top-level QWindow
|
||||
QWindow *w = QBBIntegration::window(qnxWindow);
|
||||
QWindow *w = QQnxIntegration::window(qnxWindow);
|
||||
|
||||
// Generate enter and leave events as needed.
|
||||
if (qnxWindow != m_lastMouseWindow) {
|
||||
QWindow *wOld = QBBIntegration::window(m_lastMouseWindow);
|
||||
QWindow *wOld = QQnxIntegration::window(m_lastMouseWindow);
|
||||
|
||||
if (wOld) {
|
||||
QWindowSystemInterface::handleLeaveEvent(wOld);
|
||||
#if defined(QBBEVENTTHREAD_DEBUG)
|
||||
qDebug() << "QBB: Qt leave, w=" << wOld;
|
||||
#if defined(QQNXEVENTTHREAD_DEBUG)
|
||||
qDebug() << "QQNX: Qt leave, w=" << wOld;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (w) {
|
||||
QWindowSystemInterface::handleEnterEvent(w);
|
||||
#if defined(QBBEVENTTHREAD_DEBUG)
|
||||
qDebug() << "QBB: Qt enter, w=" << w;
|
||||
#if defined(QQNXEVENTTHREAD_DEBUG)
|
||||
qDebug() << "QQNX: Qt enter, w=" << w;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -407,8 +407,8 @@ void QBBEventThread::handlePointerEvent(screen_event_t event)
|
||||
m_lastLocalMousePoint != localPoint ||
|
||||
m_lastButtonState != buttons) {
|
||||
QWindowSystemInterface::handleMouseEvent(w, localPoint, globalPoint, buttons);
|
||||
#if defined(QBBEVENTTHREAD_DEBUG)
|
||||
qDebug() << "QBB: Qt mouse, w=" << w << ", (" << localPoint.x() << "," << localPoint.y() << "), b=" << static_cast<int>(buttons);
|
||||
#if defined(QQNXEVENTTHREAD_DEBUG)
|
||||
qDebug() << "QQNX: Qt mouse, w=" << w << ", (" << localPoint.x() << "," << localPoint.y() << "), b=" << static_cast<int>(buttons);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -416,8 +416,8 @@ void QBBEventThread::handlePointerEvent(screen_event_t event)
|
||||
// Screen only supports a single wheel, so we will assume Vertical orientation for
|
||||
// now since that is pretty much standard.
|
||||
QWindowSystemInterface::handleWheelEvent(w, localPoint, globalPoint, wheelDelta, Qt::Vertical);
|
||||
#if defined(QBBEVENTTHREAD_DEBUG)
|
||||
qDebug() << "QBB: Qt wheel, w=" << w << ", (" << localPoint.x() << "," << localPoint.y() << "), d=" << static_cast<int>(wheelDelta);
|
||||
#if defined(QQNXEVENTTHREAD_DEBUG)
|
||||
qDebug() << "QQNX: Qt wheel, w=" << w << ", (" << localPoint.x() << "," << localPoint.y() << "), d=" << static_cast<int>(wheelDelta);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -427,14 +427,14 @@ void QBBEventThread::handlePointerEvent(screen_event_t event)
|
||||
m_lastButtonState = buttons;
|
||||
}
|
||||
|
||||
void QBBEventThread::handleTouchEvent(screen_event_t event, int qnxType)
|
||||
void QQnxEventThread::handleTouchEvent(screen_event_t event, int qnxType)
|
||||
{
|
||||
// get display coordinates of touch
|
||||
errno = 0;
|
||||
int pos[2];
|
||||
int result = screen_get_event_property_iv(event, SCREEN_PROPERTY_POSITION, pos);
|
||||
if (result) {
|
||||
qFatal("QBB: failed to query event position, errno=%d", errno);
|
||||
qFatal("QQNX: failed to query event position, errno=%d", errno);
|
||||
}
|
||||
|
||||
// get window coordinates of touch
|
||||
@ -442,7 +442,7 @@ void QBBEventThread::handleTouchEvent(screen_event_t event, int qnxType)
|
||||
int windowPos[2];
|
||||
result = screen_get_event_property_iv(event, SCREEN_PROPERTY_SOURCE_POSITION, windowPos);
|
||||
if (result) {
|
||||
qFatal("QBB: failed to query event window position, errno=%d", errno);
|
||||
qFatal("QQNX: failed to query event window position, errno=%d", errno);
|
||||
}
|
||||
|
||||
// determine which finger touched
|
||||
@ -450,7 +450,7 @@ void QBBEventThread::handleTouchEvent(screen_event_t event, int qnxType)
|
||||
int touchId;
|
||||
result = screen_get_event_property_iv(event, SCREEN_PROPERTY_TOUCH_ID, &touchId);
|
||||
if (result) {
|
||||
qFatal("QBB: failed to query event touch id, errno=%d", errno);
|
||||
qFatal("QQNX: failed to query event touch id, errno=%d", errno);
|
||||
}
|
||||
|
||||
// determine which window was touched
|
||||
@ -458,7 +458,7 @@ void QBBEventThread::handleTouchEvent(screen_event_t event, int qnxType)
|
||||
void *handle;
|
||||
result = screen_get_event_property_pv(event, SCREEN_PROPERTY_WINDOW, &handle);
|
||||
if (result) {
|
||||
qFatal("QBB: failed to query event window, errno=%d", errno);
|
||||
qFatal("QQNX: failed to query event window, errno=%d", errno);
|
||||
}
|
||||
screen_window_t qnxWindow = static_cast<screen_window_t>(handle);
|
||||
|
||||
@ -466,23 +466,23 @@ void QBBEventThread::handleTouchEvent(screen_event_t event, int qnxType)
|
||||
if (touchId < MaximumTouchPoints) {
|
||||
|
||||
// Map window handle to top-level QWindow
|
||||
QWindow *w = QBBIntegration::window(qnxWindow);
|
||||
QWindow *w = QQnxIntegration::window(qnxWindow);
|
||||
|
||||
// Generate enter and leave events as needed.
|
||||
if (qnxWindow != m_lastMouseWindow) {
|
||||
QWindow *wOld = QBBIntegration::window(m_lastMouseWindow);
|
||||
QWindow *wOld = QQnxIntegration::window(m_lastMouseWindow);
|
||||
|
||||
if (wOld) {
|
||||
QWindowSystemInterface::handleLeaveEvent(wOld);
|
||||
#if defined(QBBEVENTTHREAD_DEBUG)
|
||||
qDebug() << "QBB: Qt leave, w=" << wOld;
|
||||
#if defined(QQNXEVENTTHREAD_DEBUG)
|
||||
qDebug() << "QQNX: Qt leave, w=" << wOld;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (w) {
|
||||
QWindowSystemInterface::handleEnterEvent(w);
|
||||
#if defined(QBBEVENTTHREAD_DEBUG)
|
||||
qDebug() << "QBB: Qt enter, w=" << w;
|
||||
#if defined(QQNXEVENTTHREAD_DEBUG)
|
||||
qDebug() << "QQNX: Qt enter, w=" << w;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -501,8 +501,8 @@ void QBBEventThread::handleTouchEvent(screen_event_t event, int qnxType)
|
||||
|
||||
// inject event into Qt
|
||||
QWindowSystemInterface::handleMouseEvent(w, localPoint, globalPoint, buttons);
|
||||
#if defined(QBBEVENTTHREAD_DEBUG)
|
||||
qDebug() << "QBB: Qt mouse, w=" << w << ", (" << localPoint.x() << "," << localPoint.y() << "), b=" << buttons;
|
||||
#if defined(QQNXEVENTTHREAD_DEBUG)
|
||||
qDebug() << "QQNX: Qt mouse, w=" << w << ", (" << localPoint.x() << "," << localPoint.y() << "), b=" << buttons;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -546,25 +546,25 @@ void QBBEventThread::handleTouchEvent(screen_event_t event, int qnxType)
|
||||
|
||||
// inject event into Qt
|
||||
QWindowSystemInterface::handleTouchEvent(w, m_touchDevice, pointList);
|
||||
#if defined(QBBEVENTTHREAD_DEBUG)
|
||||
qDebug() << "QBB: Qt touch, w=" << w << ", p=(" << pos[0] << "," << pos[1] << "), t=" << type;
|
||||
#if defined(QQNXEVENTTHREAD_DEBUG)
|
||||
qDebug() << "QQNX: Qt touch, w=" << w << ", p=(" << pos[0] << "," << pos[1] << "), t=" << type;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QBBEventThread::handleCloseEvent(screen_event_t event)
|
||||
void QQnxEventThread::handleCloseEvent(screen_event_t event)
|
||||
{
|
||||
// Query the window that was closed
|
||||
void *handle;
|
||||
int result = screen_get_event_property_pv(event, SCREEN_PROPERTY_WINDOW, &handle);
|
||||
if (result != 0) {
|
||||
qFatal("QBB: failed to query event window, errno=%d", errno);
|
||||
qFatal("QQNX: failed to query event window, errno=%d", errno);
|
||||
}
|
||||
screen_window_t qnxWindow = static_cast<screen_window_t>(handle);
|
||||
|
||||
// Map window handle to top-level QWindow
|
||||
QWindow *w = QBBIntegration::window(qnxWindow);
|
||||
QWindow *w = QQnxIntegration::window(qnxWindow);
|
||||
if (w != 0) {
|
||||
QWindowSystemInterface::handleCloseEvent(w);
|
||||
}
|
@ -39,8 +39,8 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QBBEVENTTHREAD_H
|
||||
#define QBBEVENTTHREAD_H
|
||||
#ifndef QQNXEVENTTHREAD_H
|
||||
#define QQNXEVENTTHREAD_H
|
||||
|
||||
#include <QtCore/QThread>
|
||||
|
||||
@ -51,11 +51,11 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QBBEventThread : public QThread
|
||||
class QQnxEventThread : public QThread
|
||||
{
|
||||
public:
|
||||
QBBEventThread(screen_context_t context, QPlatformScreen& screen);
|
||||
virtual ~QBBEventThread();
|
||||
QQnxEventThread(screen_context_t context, QPlatformScreen& screen);
|
||||
virtual ~QQnxEventThread();
|
||||
|
||||
static void injectKeyboardEvent(int flags, int sym, int mod, int scan, int cap);
|
||||
|
||||
@ -87,4 +87,4 @@ private:
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QBBEVENTTHREAD_H
|
||||
#endif // QQNXEVENTTHREAD_H
|
@ -39,10 +39,10 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qbbglbackingstore.h"
|
||||
#include "qbbglcontext.h"
|
||||
#include "qbbwindow.h"
|
||||
#include "qbbscreen.h"
|
||||
#include "qqnxglbackingstore.h"
|
||||
#include "qqnxglcontext.h"
|
||||
#include "qqnxwindow.h"
|
||||
#include "qqnxscreen.h"
|
||||
|
||||
#include <QtGui/qwindow.h>
|
||||
|
||||
@ -55,12 +55,12 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QBBGLPaintDevice::QBBGLPaintDevice(QWindow *window)
|
||||
QQnxGLPaintDevice::QQnxGLPaintDevice(QWindow *window)
|
||||
: QGLPaintDevice(),
|
||||
m_window(0),
|
||||
m_glContext(0)
|
||||
{
|
||||
m_window = static_cast<QBBWindow*>(window->handle());
|
||||
m_window = static_cast<QQnxWindow*>(window->handle());
|
||||
|
||||
// Extract the QPlatformOpenGLContext from the window
|
||||
QPlatformOpenGLContext *platformOpenGLContext = m_window->platformOpenGLContext();
|
||||
@ -69,81 +69,81 @@ QBBGLPaintDevice::QBBGLPaintDevice(QWindow *window)
|
||||
m_glContext = QGLContext::fromOpenGLContext(platformOpenGLContext->context());
|
||||
}
|
||||
|
||||
QBBGLPaintDevice::~QBBGLPaintDevice()
|
||||
QQnxGLPaintDevice::~QQnxGLPaintDevice()
|
||||
{
|
||||
// Cleanup GL context
|
||||
delete m_glContext;
|
||||
}
|
||||
|
||||
QPaintEngine *QBBGLPaintDevice::paintEngine() const
|
||||
QPaintEngine *QQnxGLPaintDevice::paintEngine() const
|
||||
{
|
||||
// Select a paint engine based on configued OpenGL version
|
||||
return qt_qgl_paint_engine();
|
||||
}
|
||||
|
||||
QSize QBBGLPaintDevice::size() const
|
||||
QSize QQnxGLPaintDevice::size() const
|
||||
{
|
||||
// Get size of EGL surface
|
||||
return m_window->geometry().size();
|
||||
}
|
||||
|
||||
|
||||
QBBGLBackingStore::QBBGLBackingStore(QWindow *window)
|
||||
QQnxGLBackingStore::QQnxGLBackingStore(QWindow *window)
|
||||
: QPlatformBackingStore(window),
|
||||
m_openGLContext(0),
|
||||
m_paintDevice(0),
|
||||
m_requestedSize(),
|
||||
m_size()
|
||||
{
|
||||
#if defined(QBBGLBACKINGSTORE_DEBUG)
|
||||
qDebug() << "QBBGLBackingStore::QBBGLBackingStore - w=" << window;
|
||||
#if defined(QQNXGLBACKINGSTORE_DEBUG)
|
||||
qDebug() << "QQnxGLBackingStore::QQnxGLBackingStore - w=" << window;
|
||||
#endif
|
||||
|
||||
// Create an OpenGL paint device which in turn creates a QGLContext for us
|
||||
m_paintDevice = new QBBGLPaintDevice(window);
|
||||
m_paintDevice = new QQnxGLPaintDevice(window);
|
||||
m_openGLContext = m_paintDevice->context()->contextHandle();
|
||||
}
|
||||
|
||||
QBBGLBackingStore::~QBBGLBackingStore()
|
||||
QQnxGLBackingStore::~QQnxGLBackingStore()
|
||||
{
|
||||
#if defined(QBBGLBACKINGSTORE_DEBUG)
|
||||
qDebug() << "QBBGLBackingStore::~QBBGLBackingStore - w=" << window();
|
||||
#if defined(QQNXGLBACKINGSTORE_DEBUG)
|
||||
qDebug() << "QQnxGLBackingStore::~QQnxGLBackingStore - w=" << window();
|
||||
#endif
|
||||
|
||||
// cleanup OpenGL paint device
|
||||
delete m_paintDevice;
|
||||
}
|
||||
|
||||
void QBBGLBackingStore::flush(QWindow *window, const QRegion ®ion, const QPoint &offset)
|
||||
void QQnxGLBackingStore::flush(QWindow *window, const QRegion ®ion, const QPoint &offset)
|
||||
{
|
||||
Q_UNUSED(region);
|
||||
Q_UNUSED(offset);
|
||||
|
||||
#if defined(QBBGLBACKINGSTORE_DEBUG)
|
||||
qDebug() << "QBBGLBackingStore::flush - w=" << window;
|
||||
#if defined(QQNXGLBACKINGSTORE_DEBUG)
|
||||
qDebug() << "QQnxGLBackingStore::flush - w=" << window;
|
||||
#endif
|
||||
|
||||
// update the display with newly rendered content
|
||||
m_openGLContext->swapBuffers(window);
|
||||
}
|
||||
|
||||
void QBBGLBackingStore::resize(const QSize &size, const QRegion &staticContents)
|
||||
void QQnxGLBackingStore::resize(const QSize &size, const QRegion &staticContents)
|
||||
{
|
||||
Q_UNUSED(staticContents);
|
||||
#if defined(QBBGLBACKINGSTORE_DEBUG)
|
||||
qDebug() << "QBBGLBackingStore::resize - w=" << window() << ", s=" << size;
|
||||
#if defined(QQNXGLBACKINGSTORE_DEBUG)
|
||||
qDebug() << "QQnxGLBackingStore::resize - w=" << window() << ", s=" << size;
|
||||
#endif
|
||||
// NOTE: defer resizing window buffers until next paint as
|
||||
// resize() can be called multiple times before a paint occurs
|
||||
m_requestedSize = size;
|
||||
}
|
||||
|
||||
void QBBGLBackingStore::beginPaint(const QRegion ®ion)
|
||||
void QQnxGLBackingStore::beginPaint(const QRegion ®ion)
|
||||
{
|
||||
Q_UNUSED(region);
|
||||
|
||||
#if defined(QBBGLBACKINGSTORE_DEBUG)
|
||||
qDebug() << "QBBGLBackingStore::beginPaint - w=" << window();
|
||||
#if defined(QQNXGLBACKINGSTORE_DEBUG)
|
||||
qDebug() << "QQnxGLBackingStore::beginPaint - w=" << window();
|
||||
#endif
|
||||
|
||||
// resize EGL surface if window surface resized
|
||||
@ -152,19 +152,19 @@ void QBBGLBackingStore::beginPaint(const QRegion ®ion)
|
||||
}
|
||||
}
|
||||
|
||||
void QBBGLBackingStore::endPaint(const QRegion ®ion)
|
||||
void QQnxGLBackingStore::endPaint(const QRegion ®ion)
|
||||
{
|
||||
Q_UNUSED(region);
|
||||
#if defined(QBBGLBACKINGSTORE_DEBUG)
|
||||
qDebug() << "QBBGLBackingStore::endPaint - w=" << window();
|
||||
#if defined(QQNXGLBACKINGSTORE_DEBUG)
|
||||
qDebug() << "QQnxGLBackingStore::endPaint - w=" << window();
|
||||
#endif
|
||||
}
|
||||
|
||||
void QBBGLBackingStore::resizeSurface(const QSize &size)
|
||||
void QQnxGLBackingStore::resizeSurface(const QSize &size)
|
||||
{
|
||||
// need to destroy surface so make sure its not current
|
||||
bool restoreCurrent = false;
|
||||
QBBGLContext *platformContext = static_cast<QBBGLContext *>(m_openGLContext->handle());
|
||||
QQnxGLContext *platformContext = static_cast<QQnxGLContext *>(m_openGLContext->handle());
|
||||
if (platformContext->isCurrent()) {
|
||||
m_openGLContext->doneCurrent();
|
||||
restoreCurrent = true;
|
||||
@ -174,7 +174,7 @@ void QBBGLBackingStore::resizeSurface(const QSize &size)
|
||||
platformContext->destroySurface();
|
||||
|
||||
// resize window's buffers
|
||||
static_cast<QBBWindow*>(window()->handle())->setBufferSize(size);
|
||||
static_cast<QQnxWindow*>(window()->handle())->setBufferSize(size);
|
||||
|
||||
// re-create EGL surface with new size
|
||||
m_size = size;
|
@ -39,8 +39,8 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QBBGLBACKINGSTORE_H
|
||||
#define QBBGLBACKINGSTORE_H
|
||||
#ifndef QQNXGLBACKINGSTORE_H
|
||||
#define QQNXGLBACKINGSTORE_H
|
||||
|
||||
#include <QtGui/qplatformbackingstore_qpa.h>
|
||||
#include <QtOpenGL/private/qglpaintdevice_p.h>
|
||||
@ -50,30 +50,30 @@
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QGLContext;
|
||||
class QBBGLContext;
|
||||
class QBBScreen;
|
||||
class QBBWindow;
|
||||
class QQnxGLContext;
|
||||
class QQnxScreen;
|
||||
class QQnxWindow;
|
||||
|
||||
class QBBGLPaintDevice : public QGLPaintDevice
|
||||
class QQnxGLPaintDevice : public QGLPaintDevice
|
||||
{
|
||||
public:
|
||||
QBBGLPaintDevice(QWindow *window);
|
||||
virtual ~QBBGLPaintDevice();
|
||||
QQnxGLPaintDevice(QWindow *window);
|
||||
virtual ~QQnxGLPaintDevice();
|
||||
|
||||
virtual QPaintEngine *paintEngine() const;
|
||||
virtual QSize size() const;
|
||||
virtual QGLContext *context() const { return m_glContext; }
|
||||
|
||||
private:
|
||||
QBBWindow *m_window;
|
||||
QQnxWindow *m_window;
|
||||
QGLContext *m_glContext;
|
||||
};
|
||||
|
||||
class QBBGLBackingStore : public QPlatformBackingStore
|
||||
class QQnxGLBackingStore : public QPlatformBackingStore
|
||||
{
|
||||
public:
|
||||
QBBGLBackingStore(QWindow *window);
|
||||
virtual ~QBBGLBackingStore();
|
||||
QQnxGLBackingStore(QWindow *window);
|
||||
virtual ~QQnxGLBackingStore();
|
||||
|
||||
virtual QPaintDevice *paintDevice() { return m_paintDevice; }
|
||||
virtual void flush(QWindow *window, const QRegion ®ion, const QPoint &offset);
|
||||
@ -85,11 +85,11 @@ public:
|
||||
|
||||
private:
|
||||
QOpenGLContext *m_openGLContext;
|
||||
QBBGLPaintDevice *m_paintDevice;
|
||||
QQnxGLPaintDevice *m_paintDevice;
|
||||
QSize m_requestedSize;
|
||||
QSize m_size;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QBBGLBACKINGSTORE_H
|
||||
#endif // QQNXGLBACKINGSTORE_H
|
@ -39,10 +39,10 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qbbglcontext.h"
|
||||
#include "qbbrootwindow.h"
|
||||
#include "qbbscreen.h"
|
||||
#include "qbbwindow.h"
|
||||
#include "qqnxglcontext.h"
|
||||
#include "qqnxrootwindow.h"
|
||||
#include "qqnxscreen.h"
|
||||
#include "qqnxwindow.h"
|
||||
|
||||
#include "private/qeglconvenience_p.h"
|
||||
|
||||
@ -51,7 +51,7 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
EGLDisplay QBBGLContext::ms_eglDisplay = EGL_NO_DISPLAY;
|
||||
EGLDisplay QQnxGLContext::ms_eglDisplay = EGL_NO_DISPLAY;
|
||||
|
||||
static EGLenum checkEGLError(const char *msg)
|
||||
{
|
||||
@ -78,12 +78,12 @@ static EGLenum checkEGLError(const char *msg)
|
||||
return error;
|
||||
}
|
||||
|
||||
QBBGLContext::QBBGLContext(QOpenGLContext *glContext)
|
||||
QQnxGLContext::QQnxGLContext(QOpenGLContext *glContext)
|
||||
: QPlatformOpenGLContext(),
|
||||
m_glContext(glContext),
|
||||
m_eglSurface(EGL_NO_SURFACE)
|
||||
{
|
||||
#if defined(QBBGLCONTEXT_DEBUG)
|
||||
#if defined(QQNXGLCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
QSurfaceFormat format = m_glContext->format();
|
||||
@ -91,7 +91,7 @@ QBBGLContext::QBBGLContext(QOpenGLContext *glContext)
|
||||
// Set current rendering API
|
||||
EGLBoolean eglResult = eglBindAPI(EGL_OPENGL_ES_API);
|
||||
if (eglResult != EGL_TRUE) {
|
||||
qFatal("QBB: failed to set EGL API, err=%d", eglGetError());
|
||||
qFatal("QQNX: failed to set EGL API, err=%d", eglGetError());
|
||||
}
|
||||
|
||||
// Get colour channel sizes from window format
|
||||
@ -103,7 +103,7 @@ QBBGLContext::QBBGLContext(QOpenGLContext *glContext)
|
||||
// Check if all channels are don't care
|
||||
if (alphaSize == -1 && redSize == -1 && greenSize == -1 && blueSize == -1) {
|
||||
// Set colour channels based on depth of window's screen
|
||||
QBBScreen *screen = static_cast<QBBScreen*>(QBBScreen::screens().first());
|
||||
QQnxScreen *screen = static_cast<QQnxScreen*>(QQnxScreen::screens().first());
|
||||
int depth = screen->depth();
|
||||
if (depth == 32) {
|
||||
// SCREEN_FORMAT_RGBA8888
|
||||
@ -145,22 +145,22 @@ QBBGLContext::QBBGLContext(QOpenGLContext *glContext)
|
||||
// Select EGL config based on requested window format
|
||||
m_eglConfig = q_configFromGLFormat(ms_eglDisplay, format);
|
||||
if (m_eglConfig == 0) {
|
||||
qFatal("QBB: failed to find EGL config");
|
||||
qFatal("QQNXQBBWindow: failed to find EGL config");
|
||||
}
|
||||
|
||||
m_eglContext = eglCreateContext(ms_eglDisplay, m_eglConfig, EGL_NO_CONTEXT, contextAttrs());
|
||||
if (m_eglContext == EGL_NO_CONTEXT) {
|
||||
checkEGLError("eglCreateContext");
|
||||
qFatal("QBB: failed to create EGL context, err=%d", eglGetError());
|
||||
qFatal("QQNXQBBWindow: failed to create EGL context, err=%d", eglGetError());
|
||||
}
|
||||
|
||||
// Query/cache window format of selected EGL config
|
||||
m_windowFormat = q_glFormatFromConfig(ms_eglDisplay, m_eglConfig);
|
||||
}
|
||||
|
||||
QBBGLContext::~QBBGLContext()
|
||||
QQnxGLContext::~QQnxGLContext()
|
||||
{
|
||||
#if defined(QBBGLCONTEXT_DEBUG)
|
||||
#if defined(QQNXGLCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
|
||||
@ -173,43 +173,43 @@ QBBGLContext::~QBBGLContext()
|
||||
destroySurface();
|
||||
}
|
||||
|
||||
void QBBGLContext::initialize()
|
||||
void QQnxGLContext::initialize()
|
||||
{
|
||||
#if defined(QBBGLCONTEXT_DEBUG)
|
||||
#if defined(QQNXGLCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
// Initialize connection to EGL
|
||||
ms_eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
||||
if (ms_eglDisplay == EGL_NO_DISPLAY) {
|
||||
checkEGLError("eglGetDisplay");
|
||||
qFatal("QBB: failed to obtain EGL display");
|
||||
qFatal("QQNXQBBWindow: failed to obtain EGL display");
|
||||
}
|
||||
|
||||
EGLBoolean eglResult = eglInitialize(ms_eglDisplay, 0, 0);
|
||||
if (eglResult != EGL_TRUE) {
|
||||
checkEGLError("eglInitialize");
|
||||
qFatal("QBB: failed to initialize EGL display, err=%d", eglGetError());
|
||||
qFatal("QQNXQBBWindow: failed to initialize EGL display, err=%d", eglGetError());
|
||||
}
|
||||
}
|
||||
|
||||
void QBBGLContext::shutdown()
|
||||
void QQnxGLContext::shutdown()
|
||||
{
|
||||
#if defined(QBBGLCONTEXT_DEBUG)
|
||||
#if defined(QQNXGLCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
// Close connection to EGL
|
||||
eglTerminate(ms_eglDisplay);
|
||||
}
|
||||
|
||||
bool QBBGLContext::makeCurrent(QPlatformSurface *surface)
|
||||
bool QQnxGLContext::makeCurrent(QPlatformSurface *surface)
|
||||
{
|
||||
#if defined(QBBGLCONTEXT_DEBUG)
|
||||
#if defined(QQNXGLCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
// Set current rendering API
|
||||
EGLBoolean eglResult = eglBindAPI(EGL_OPENGL_ES_API);
|
||||
if (eglResult != EGL_TRUE) {
|
||||
qFatal("QBB: failed to set EGL API, err=%d", eglGetError());
|
||||
qFatal("QQNXQBBWindow: failed to set EGL API, err=%d", eglGetError());
|
||||
}
|
||||
|
||||
if (m_eglSurface == EGL_NO_SURFACE)
|
||||
@ -218,68 +218,68 @@ bool QBBGLContext::makeCurrent(QPlatformSurface *surface)
|
||||
eglResult = eglMakeCurrent(ms_eglDisplay, m_eglSurface, m_eglSurface, m_eglContext);
|
||||
if (eglResult != EGL_TRUE) {
|
||||
checkEGLError("eglMakeCurrent");
|
||||
qFatal("QBB: failed to set current EGL context, err=%d", eglGetError());
|
||||
qFatal("QQNX: failed to set current EGL context, err=%d", eglGetError());
|
||||
}
|
||||
return (eglResult == EGL_TRUE);
|
||||
}
|
||||
|
||||
void QBBGLContext::doneCurrent()
|
||||
void QQnxGLContext::doneCurrent()
|
||||
{
|
||||
#if defined(QBBGLCONTEXT_DEBUG)
|
||||
#if defined(QQNXGLCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
// set current rendering API
|
||||
EGLBoolean eglResult = eglBindAPI(EGL_OPENGL_ES_API);
|
||||
if (eglResult != EGL_TRUE) {
|
||||
qFatal("QBB: failed to set EGL API, err=%d", eglGetError());
|
||||
qFatal("QQNX: failed to set EGL API, err=%d", eglGetError());
|
||||
}
|
||||
|
||||
// clear curent EGL context and unbind EGL surface
|
||||
eglResult = eglMakeCurrent(ms_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
if (eglResult != EGL_TRUE) {
|
||||
qFatal("QBB: failed to clear current EGL context, err=%d", eglGetError());
|
||||
qFatal("QQNX: failed to clear current EGL context, err=%d", eglGetError());
|
||||
}
|
||||
}
|
||||
|
||||
void QBBGLContext::swapBuffers(QPlatformSurface *surface)
|
||||
void QQnxGLContext::swapBuffers(QPlatformSurface *surface)
|
||||
{
|
||||
Q_UNUSED(surface);
|
||||
#if defined(QBBGLCONTEXT_DEBUG)
|
||||
#if defined(QQNXGLCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
|
||||
// Set current rendering API
|
||||
EGLBoolean eglResult = eglBindAPI(EGL_OPENGL_ES_API);
|
||||
if (eglResult != EGL_TRUE) {
|
||||
qFatal("QBB: failed to set EGL API, err=%d", eglGetError());
|
||||
qFatal("QQNX: failed to set EGL API, err=%d", eglGetError());
|
||||
}
|
||||
|
||||
// Post EGL surface to window
|
||||
eglResult = eglSwapBuffers(ms_eglDisplay, m_eglSurface);
|
||||
if (eglResult != EGL_TRUE) {
|
||||
qFatal("QBB: failed to swap EGL buffers, err=%d", eglGetError());
|
||||
qFatal("QQNX: failed to swap EGL buffers, err=%d", eglGetError());
|
||||
}
|
||||
}
|
||||
|
||||
QFunctionPointer QBBGLContext::getProcAddress(const QByteArray &procName)
|
||||
QFunctionPointer QQnxGLContext::getProcAddress(const QByteArray &procName)
|
||||
{
|
||||
#if defined(QBBGLCONTEXT_DEBUG)
|
||||
#if defined(QQNXGLCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
|
||||
// Set current rendering API
|
||||
EGLBoolean eglResult = eglBindAPI(EGL_OPENGL_ES_API);
|
||||
if (eglResult != EGL_TRUE) {
|
||||
qFatal("QBB: failed to set EGL API, err=%d", eglGetError());
|
||||
qFatal("QQNX: failed to set EGL API, err=%d", eglGetError());
|
||||
}
|
||||
|
||||
// Lookup EGL extension function pointer
|
||||
return static_cast<QFunctionPointer>(eglGetProcAddress(procName.constData()));
|
||||
}
|
||||
|
||||
EGLint *QBBGLContext::contextAttrs()
|
||||
EGLint *QQnxGLContext::contextAttrs()
|
||||
{
|
||||
#if defined(QBBGLCONTEXT_DEBUG)
|
||||
#if defined(QQNXGLCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
|
||||
@ -292,23 +292,23 @@ EGLint *QBBGLContext::contextAttrs()
|
||||
#endif
|
||||
}
|
||||
|
||||
bool QBBGLContext::isCurrent() const
|
||||
bool QQnxGLContext::isCurrent() const
|
||||
{
|
||||
#if defined(QBBGLCONTEXT_DEBUG)
|
||||
#if defined(QQNXGLCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
return (eglGetCurrentContext() == m_eglContext);
|
||||
}
|
||||
|
||||
void QBBGLContext::createSurface(QPlatformSurface *surface)
|
||||
void QQnxGLContext::createSurface(QPlatformSurface *surface)
|
||||
{
|
||||
#if defined(QBBGLCONTEXT_DEBUG)
|
||||
#if defined(QQNXGLCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
// Get a pointer to the corresponding platform window
|
||||
QBBWindow *platformWindow = dynamic_cast<QBBWindow*>(surface);
|
||||
QQnxWindow *platformWindow = dynamic_cast<QQnxWindow*>(surface);
|
||||
if (!platformWindow) {
|
||||
qFatal("QBB: unable to create EGLSurface without a QBBWindow");
|
||||
qFatal("QQNX: unable to create EGLSurface without a QQnxWindow");
|
||||
}
|
||||
|
||||
// If the platform window does not yet have any buffers, we create
|
||||
@ -334,13 +334,13 @@ void QBBGLContext::createSurface(QPlatformSurface *surface)
|
||||
m_eglSurface = eglCreateWindowSurface(ms_eglDisplay, m_eglConfig, (EGLNativeWindowType) handle, eglSurfaceAttrs);
|
||||
if (m_eglSurface == EGL_NO_SURFACE) {
|
||||
checkEGLError("eglCreateWindowSurface");
|
||||
qFatal("QBB: failed to create EGL surface, err=%d", eglGetError());
|
||||
qFatal("QQNX: failed to create EGL surface, err=%d", eglGetError());
|
||||
}
|
||||
}
|
||||
|
||||
void QBBGLContext::destroySurface()
|
||||
void QQnxGLContext::destroySurface()
|
||||
{
|
||||
#if defined(QBBGLCONTEXT_DEBUG)
|
||||
#if defined(QQNXGLCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
|
||||
@ -348,7 +348,7 @@ void QBBGLContext::destroySurface()
|
||||
if (m_eglSurface != EGL_NO_SURFACE) {
|
||||
EGLBoolean eglResult = eglDestroySurface(ms_eglDisplay, m_eglSurface);
|
||||
if (eglResult != EGL_TRUE) {
|
||||
qFatal("QBB: failed to destroy EGL surface, err=%d", eglGetError());
|
||||
qFatal("QQNX: failed to destroy EGL surface, err=%d", eglGetError());
|
||||
}
|
||||
}
|
||||
}
|
@ -39,8 +39,8 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QBBGLCONTEXT_H
|
||||
#define QBBGLCONTEXT_H
|
||||
#ifndef QQNXGLCONTEXT_H
|
||||
#define QQNXGLCONTEXT_H
|
||||
|
||||
#include <QtGui/QPlatformOpenGLContext>
|
||||
#include <QtGui/QSurfaceFormat>
|
||||
@ -50,13 +50,13 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QBBWindow;
|
||||
class QQnxWindow;
|
||||
|
||||
class QBBGLContext : public QPlatformOpenGLContext
|
||||
class QQnxGLContext : public QPlatformOpenGLContext
|
||||
{
|
||||
public:
|
||||
QBBGLContext(QOpenGLContext *glContext);
|
||||
virtual ~QBBGLContext();
|
||||
QQnxGLContext(QOpenGLContext *glContext);
|
||||
virtual ~QQnxGLContext();
|
||||
|
||||
static void initialize();
|
||||
static void shutdown();
|
||||
@ -90,4 +90,4 @@ private:
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QBBGLCONTEXT_H
|
||||
#endif // QQNXGLCONTEXT_H
|
@ -39,9 +39,9 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qbbinputcontext_imf.h"
|
||||
#include "qbbeventthread.h"
|
||||
#include "qbbvirtualkeyboard.h"
|
||||
#include "qqnxinputcontext_imf.h"
|
||||
#include "qqnxeventthread.h"
|
||||
#include "qqnxvirtualkeyboard.h"
|
||||
|
||||
#include <QtWidgets/QAbstractSpinBox>
|
||||
#include <QtWidgets/QAction>
|
||||
@ -175,7 +175,7 @@ int ImfEvent::sUserEventType = QEvent::registerEventType();
|
||||
|
||||
static int32_t imfBeginBatchEdit(input_session_t *ic)
|
||||
{
|
||||
#if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_IMF_EVENT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
|
||||
@ -194,7 +194,7 @@ static int32_t imfBeginBatchEdit(input_session_t *ic)
|
||||
|
||||
static int32_t imfClearMetaKeyStates(input_session_t *ic, int32_t states)
|
||||
{
|
||||
#if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_IMF_EVENT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
|
||||
@ -215,7 +215,7 @@ static int32_t imfClearMetaKeyStates(input_session_t *ic, int32_t states)
|
||||
|
||||
static int32_t imfCommitText(input_session_t *ic, spannable_string_t *text, int32_t new_cursor_position)
|
||||
{
|
||||
#if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_IMF_EVENT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
|
||||
@ -237,7 +237,7 @@ static int32_t imfCommitText(input_session_t *ic, spannable_string_t *text, int3
|
||||
|
||||
static int32_t imfDeleteSurroundingText(input_session_t *ic, int32_t left_length, int32_t right_length)
|
||||
{
|
||||
#if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_IMF_EVENT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
|
||||
@ -259,7 +259,7 @@ static int32_t imfDeleteSurroundingText(input_session_t *ic, int32_t left_length
|
||||
|
||||
static int32_t imfEndBatchEdit(input_session_t *ic)
|
||||
{
|
||||
#if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_IMF_EVENT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
|
||||
@ -279,7 +279,7 @@ static int32_t imfEndBatchEdit(input_session_t *ic)
|
||||
|
||||
static int32_t imfFinishComposingText(input_session_t *ic)
|
||||
{
|
||||
#if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_IMF_EVENT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
|
||||
@ -299,7 +299,7 @@ static int32_t imfFinishComposingText(input_session_t *ic)
|
||||
|
||||
static int32_t imfGetCursorCapsMode(input_session_t *ic, int32_t req_modes)
|
||||
{
|
||||
#if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_IMF_EVENT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
|
||||
@ -318,7 +318,7 @@ static int32_t imfGetCursorCapsMode(input_session_t *ic, int32_t req_modes)
|
||||
|
||||
static int32_t imfGetCursorPosition(input_session_t *ic)
|
||||
{
|
||||
#if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_IMF_EVENT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
|
||||
@ -338,7 +338,7 @@ static int32_t imfGetCursorPosition(input_session_t *ic)
|
||||
|
||||
static extracted_text_t *imfGetExtractedText(input_session_t *ic, extracted_text_request_t *request, int32_t flags)
|
||||
{
|
||||
#if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_IMF_EVENT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
|
||||
@ -361,7 +361,7 @@ static extracted_text_t *imfGetExtractedText(input_session_t *ic, extracted_text
|
||||
|
||||
static spannable_string_t *imfGetSelectedText(input_session_t *ic, int32_t flags)
|
||||
{
|
||||
#if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_IMF_EVENT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
|
||||
@ -380,7 +380,7 @@ static spannable_string_t *imfGetSelectedText(input_session_t *ic, int32_t flags
|
||||
|
||||
static spannable_string_t *imfGetTextAfterCursor(input_session_t *ic, int32_t n, int32_t flags)
|
||||
{
|
||||
#if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_IMF_EVENT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
|
||||
@ -400,7 +400,7 @@ static spannable_string_t *imfGetTextAfterCursor(input_session_t *ic, int32_t n,
|
||||
|
||||
static spannable_string_t *imfGetTextBeforeCursor(input_session_t *ic, int32_t n, int32_t flags)
|
||||
{
|
||||
#if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_IMF_EVENT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
|
||||
@ -420,7 +420,7 @@ static spannable_string_t *imfGetTextBeforeCursor(input_session_t *ic, int32_t n
|
||||
|
||||
static int32_t imfPerformEditorAction(input_session_t *ic, int32_t editor_action)
|
||||
{
|
||||
#if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_IMF_EVENT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
|
||||
@ -440,7 +440,7 @@ static int32_t imfPerformEditorAction(input_session_t *ic, int32_t editor_action
|
||||
|
||||
static int32_t imfReportFullscreenMode(input_session_t *ic, int32_t enabled)
|
||||
{
|
||||
#if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_IMF_EVENT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
|
||||
@ -460,7 +460,7 @@ static int32_t imfReportFullscreenMode(input_session_t *ic, int32_t enabled)
|
||||
|
||||
static int32_t imfSendEvent(input_session_t *ic, event_t *event)
|
||||
{
|
||||
#if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_IMF_EVENT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
|
||||
@ -477,7 +477,7 @@ static int32_t imfSendEvent(input_session_t *ic, event_t *event)
|
||||
|
||||
static int32_t imfSendAsyncEvent(input_session_t *ic, event_t *event)
|
||||
{
|
||||
#if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_IMF_EVENT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
|
||||
@ -494,7 +494,7 @@ static int32_t imfSendAsyncEvent(input_session_t *ic, event_t *event)
|
||||
|
||||
static int32_t imfSetComposingRegion(input_session_t *ic, int32_t start, int32_t end)
|
||||
{
|
||||
#if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_IMF_EVENT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
|
||||
@ -515,7 +515,7 @@ static int32_t imfSetComposingRegion(input_session_t *ic, int32_t start, int32_t
|
||||
|
||||
static int32_t imfSetComposingText(input_session_t *ic, spannable_string_t *text, int32_t new_cursor_position)
|
||||
{
|
||||
#if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_IMF_EVENT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
|
||||
@ -536,7 +536,7 @@ static int32_t imfSetComposingText(input_session_t *ic, spannable_string_t *text
|
||||
|
||||
static int32_t imfSetSelection(input_session_t *ic, int32_t start, int32_t end)
|
||||
{
|
||||
#if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_IMF_EVENT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
|
||||
@ -595,7 +595,7 @@ initEvent(event_t *pEvent, const input_session_t *pSession, EventType eventType,
|
||||
|
||||
spannable_string_t *toSpannableString(const QString &text)
|
||||
{
|
||||
#if defined(QBBINPUTCONTEXT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO << text;
|
||||
#endif
|
||||
|
||||
@ -674,14 +674,14 @@ static bool imfAvailable()
|
||||
return s_imfReady;
|
||||
}
|
||||
|
||||
QBBInputContext::QBBInputContext():
|
||||
QQnxInputContext::QQnxInputContext():
|
||||
QPlatformInputContext(),
|
||||
m_lastCaretPos(0),
|
||||
m_isComposing(false),
|
||||
m_inputPanelVisible(false),
|
||||
m_inputPanelLocale(QLocale::c())
|
||||
{
|
||||
#if defined(QBBINPUTCONTEXT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
|
||||
@ -697,7 +697,7 @@ QBBInputContext::QBBInputContext():
|
||||
|
||||
// p_vkb_init_selection_service();
|
||||
|
||||
QBBVirtualKeyboard &keyboard = QBBVirtualKeyboard::instance();
|
||||
QQnxVirtualKeyboard &keyboard = QQnxVirtualKeyboard::instance();
|
||||
connect(&keyboard, SIGNAL(visibilityChanged(bool)), this, SLOT(keyboardVisibilityChanged(bool)));
|
||||
connect(&keyboard, SIGNAL(localeChanged(QLocale)), this, SLOT(keyboardLocaleChanged(QLocale)));
|
||||
keyboardVisibilityChanged(keyboard.isVisible());
|
||||
@ -708,9 +708,9 @@ QBBInputContext::QBBInputContext():
|
||||
|
||||
}
|
||||
|
||||
QBBInputContext::~QBBInputContext()
|
||||
QQnxInputContext::~QQnxInputContext()
|
||||
{
|
||||
#if defined(QBBINPUTCONTEXT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
|
||||
@ -724,12 +724,12 @@ QBBInputContext::~QBBInputContext()
|
||||
#define getarg(type, name) type name = imfEvent->mArgs[qs(#name)].value<type>()
|
||||
#define getparg(type, name) type name = (type)(imfEvent->mArgs[qs(#name)].value<void*>())
|
||||
|
||||
bool QBBInputContext::isValid() const
|
||||
bool QQnxInputContext::isValid() const
|
||||
{
|
||||
return imfAvailable();
|
||||
}
|
||||
|
||||
bool QBBInputContext::eventFilter(QObject *obj, QEvent *event)
|
||||
bool QQnxInputContext::eventFilter(QObject *obj, QEvent *event)
|
||||
{
|
||||
if (event->type() == ImfEvent::sUserEventType) {
|
||||
// Forward the event to our real handler.
|
||||
@ -878,9 +878,9 @@ bool QBBInputContext::eventFilter(QObject *obj, QEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
bool QBBInputContext::filterEvent( const QEvent *event )
|
||||
bool QQnxInputContext::filterEvent( const QEvent *event )
|
||||
{
|
||||
#if defined(QBBINPUTCONTEXT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO << event;
|
||||
#endif
|
||||
switch (event->type()) {
|
||||
@ -895,17 +895,17 @@ bool QBBInputContext::filterEvent( const QEvent *event )
|
||||
}
|
||||
}
|
||||
|
||||
void QBBInputContext::reset()
|
||||
void QQnxInputContext::reset()
|
||||
{
|
||||
#if defined(QBBINPUTCONTEXT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
endComposition();
|
||||
}
|
||||
|
||||
void QBBInputContext::update(Qt::InputMethodQueries queries)
|
||||
void QQnxInputContext::update(Qt::InputMethodQueries queries)
|
||||
{
|
||||
#if defined(QBBINPUTCONTEXT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
reset();
|
||||
@ -913,9 +913,9 @@ void QBBInputContext::update(Qt::InputMethodQueries queries)
|
||||
QPlatformInputContext::update(queries);
|
||||
}
|
||||
|
||||
void QBBInputContext::closeSession()
|
||||
void QQnxInputContext::closeSession()
|
||||
{
|
||||
#if defined(QBBINPUTCONTEXT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO
|
||||
#endif
|
||||
if (!imfAvailable())
|
||||
@ -927,9 +927,9 @@ void QBBInputContext::closeSession()
|
||||
}
|
||||
}
|
||||
|
||||
void QBBInputContext::openSession()
|
||||
void QQnxInputContext::openSession()
|
||||
{
|
||||
#if defined(QBBINPUTCONTEXT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO
|
||||
#endif
|
||||
if (!imfAvailable())
|
||||
@ -939,12 +939,12 @@ void QBBInputContext::openSession()
|
||||
sInputSession = p_ictrl_open_session(&ic_funcs);
|
||||
}
|
||||
|
||||
bool QBBInputContext::hasSession()
|
||||
bool QQnxInputContext::hasSession()
|
||||
{
|
||||
return sInputSession != 0;
|
||||
}
|
||||
|
||||
bool QBBInputContext::hasSelectedText()
|
||||
bool QQnxInputContext::hasSelectedText()
|
||||
{
|
||||
QInputPanel *panel = qApp->inputPanel();
|
||||
QObject *input = panel->inputItem();
|
||||
@ -957,11 +957,11 @@ bool QBBInputContext::hasSelectedText()
|
||||
return !query.value(Qt::ImCurrentSelection).toString().isEmpty();
|
||||
}
|
||||
|
||||
bool QBBInputContext::dispatchRequestSoftwareInputPanel()
|
||||
bool QQnxInputContext::dispatchRequestSoftwareInputPanel()
|
||||
{
|
||||
QBBVirtualKeyboard::instance().showKeyboard();
|
||||
#if defined(QBBINPUTCONTEXT_DEBUG)
|
||||
qDebug() << "QBB: requesting virtual keyboard";
|
||||
QQnxVirtualKeyboard::instance().showKeyboard();
|
||||
#if defined(QQNXINPUTCONTEXT_DEBUG)
|
||||
qDebug() << "QQNX: requesting virtual keyboard";
|
||||
#endif
|
||||
QInputPanel *panel = qApp->inputPanel();
|
||||
QObject *input = panel->inputItem();
|
||||
@ -984,11 +984,11 @@ bool QBBInputContext::dispatchRequestSoftwareInputPanel()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool QBBInputContext::dispatchCloseSoftwareInputPanel()
|
||||
bool QQnxInputContext::dispatchCloseSoftwareInputPanel()
|
||||
{
|
||||
QBBVirtualKeyboard::instance().hideKeyboard();
|
||||
#if defined(QBBINPUTCONTEXT_DEBUG)
|
||||
qDebug() << "QBB: hiding virtual keyboard";
|
||||
QQnxVirtualKeyboard::instance().hideKeyboard();
|
||||
#if defined(QQNXINPUTCONTEXT_DEBUG)
|
||||
qDebug() << "QQNX: hiding virtual keyboard";
|
||||
#endif
|
||||
|
||||
// This also means we are stopping composition, but we should already have done that.
|
||||
@ -998,9 +998,9 @@ bool QBBInputContext::dispatchCloseSoftwareInputPanel()
|
||||
/**
|
||||
* IMF Event Dispatchers.
|
||||
*/
|
||||
bool QBBInputContext::dispatchFocusEvent(FocusEventId id, int hints)
|
||||
bool QQnxInputContext::dispatchFocusEvent(FocusEventId id, int hints)
|
||||
{
|
||||
#if defined(QBBINPUTCONTEXT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
|
||||
@ -1031,7 +1031,7 @@ bool QBBInputContext::dispatchFocusEvent(FocusEventId id, int hints)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool QBBInputContext::handleKeyboardEvent(int flags, int sym, int mod, int scan, int cap)
|
||||
bool QQnxInputContext::handleKeyboardEvent(int flags, int sym, int mod, int scan, int cap)
|
||||
{
|
||||
if (!imfAvailable())
|
||||
return false;
|
||||
@ -1110,7 +1110,7 @@ bool QBBInputContext::handleKeyboardEvent(int flags, int sym, int mod, int scan,
|
||||
navigation_event_t navEvent;
|
||||
initEvent(&navEvent.event, sInputSession, EVENT_NAVIGATION, key);
|
||||
navEvent.magnitude = 1;
|
||||
#if defined(QBBINPUTCONTEXT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO << "dispatch navigation event " << key;
|
||||
#endif
|
||||
p_ictrl_dispatch_event(&navEvent.event);
|
||||
@ -1124,7 +1124,7 @@ bool QBBInputContext::handleKeyboardEvent(int flags, int sym, int mod, int scan,
|
||||
keyEvent.meta_key_state = 0;
|
||||
|
||||
p_ictrl_dispatch_event(&keyEvent.event);
|
||||
#if defined(QBBINPUTCONTEXT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO << "dispatch key event " << key;
|
||||
#endif
|
||||
}
|
||||
@ -1133,7 +1133,7 @@ bool QBBInputContext::handleKeyboardEvent(int flags, int sym, int mod, int scan,
|
||||
return true;
|
||||
}
|
||||
|
||||
void QBBInputContext::endComposition()
|
||||
void QQnxInputContext::endComposition()
|
||||
{
|
||||
if (!m_isComposing)
|
||||
return;
|
||||
@ -1156,7 +1156,7 @@ void QBBInputContext::endComposition()
|
||||
p_ictrl_dispatch_event(&actionEvent.event);
|
||||
}
|
||||
|
||||
void QBBInputContext::setComposingText(QString const& composingText)
|
||||
void QQnxInputContext::setComposingText(QString const& composingText)
|
||||
{
|
||||
m_composingText = composingText;
|
||||
m_isComposing = true;
|
||||
@ -1176,12 +1176,12 @@ void QBBInputContext::setComposingText(QString const& composingText)
|
||||
QCoreApplication::sendEvent(input, &event);
|
||||
}
|
||||
|
||||
int32_t QBBInputContext::processEvent(event_t *event)
|
||||
int32_t QQnxInputContext::processEvent(event_t *event)
|
||||
{
|
||||
int32_t result = -1;
|
||||
switch (event->event_type) {
|
||||
case EVENT_SPELL_CHECK: {
|
||||
#if defined(QBBINPUTCONTEXT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO << "EVENT_SPELL_CHECK";
|
||||
#endif
|
||||
result = 0;
|
||||
@ -1189,7 +1189,7 @@ int32_t QBBInputContext::processEvent(event_t *event)
|
||||
}
|
||||
|
||||
case EVENT_NAVIGATION: {
|
||||
#if defined(QBBINPUTCONTEXT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO << "EVENT_NAVIGATION";
|
||||
#endif
|
||||
|
||||
@ -1198,20 +1198,20 @@ int32_t QBBInputContext::processEvent(event_t *event)
|
||||
event->event_id == NAVIGATE_LEFT ? KEYCODE_LEFT :
|
||||
event->event_id == NAVIGATE_RIGHT ? KEYCODE_RIGHT : 0;
|
||||
|
||||
QBBEventThread::injectKeyboardEvent(KEY_DOWN | KEY_CAP_VALID, key, 0, 0, 0);
|
||||
QBBEventThread::injectKeyboardEvent(KEY_CAP_VALID, key, 0, 0, 0);
|
||||
QQnxEventThread::injectKeyboardEvent(KEY_DOWN | KEY_CAP_VALID, key, 0, 0, 0);
|
||||
QQnxEventThread::injectKeyboardEvent(KEY_CAP_VALID, key, 0, 0, 0);
|
||||
result = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
case EVENT_KEY: {
|
||||
#if defined(QBBINPUTCONTEXT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO << "EVENT_KEY";
|
||||
#endif
|
||||
key_event_t *kevent = static_cast<key_event_t *>(event);
|
||||
|
||||
QBBEventThread::injectKeyboardEvent(KEY_DOWN | KEY_SYM_VALID | KEY_CAP_VALID, kevent->key_code, 0, 0, kevent->key_code);
|
||||
QBBEventThread::injectKeyboardEvent(KEY_SYM_VALID | KEY_CAP_VALID, kevent->key_code, 0, 0, kevent->key_code);
|
||||
QQnxEventThread::injectKeyboardEvent(KEY_DOWN | KEY_SYM_VALID | KEY_CAP_VALID, kevent->key_code, 0, 0, kevent->key_code);
|
||||
QQnxEventThread::injectKeyboardEvent(KEY_SYM_VALID | KEY_CAP_VALID, kevent->key_code, 0, 0, kevent->key_code);
|
||||
|
||||
result = 0;
|
||||
break;
|
||||
@ -1239,9 +1239,9 @@ int32_t QBBInputContext::processEvent(event_t *event)
|
||||
* IMF Event Handlers
|
||||
*/
|
||||
|
||||
int32_t QBBInputContext::onBeginBatchEdit(input_session_t *ic)
|
||||
int32_t QQnxInputContext::onBeginBatchEdit(input_session_t *ic)
|
||||
{
|
||||
#if defined(QBBINPUTCONTEXT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
|
||||
@ -1252,10 +1252,10 @@ int32_t QBBInputContext::onBeginBatchEdit(input_session_t *ic)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t QBBInputContext::onClearMetaKeyStates(input_session_t *ic, int32_t states)
|
||||
int32_t QQnxInputContext::onClearMetaKeyStates(input_session_t *ic, int32_t states)
|
||||
{
|
||||
Q_UNUSED(states);
|
||||
#if defined(QBBINPUTCONTEXT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
|
||||
@ -1267,7 +1267,7 @@ int32_t QBBInputContext::onClearMetaKeyStates(input_session_t *ic, int32_t state
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t QBBInputContext::onCommitText(input_session_t *ic, spannable_string_t *text, int32_t new_cursor_position)
|
||||
int32_t QQnxInputContext::onCommitText(input_session_t *ic, spannable_string_t *text, int32_t new_cursor_position)
|
||||
{
|
||||
Q_UNUSED(new_cursor_position); // TODO: How can we set the cursor position it's not part of the API.
|
||||
if (!isSessionOkay(ic))
|
||||
@ -1280,7 +1280,7 @@ int32_t QBBInputContext::onCommitText(input_session_t *ic, spannable_string_t *t
|
||||
|
||||
QString commitString = QString::fromWCharArray(text->str, text->length);
|
||||
|
||||
#if defined(QBBINPUTCONTEXT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO << "Committing [" << commitString << "]";
|
||||
#endif
|
||||
|
||||
@ -1294,9 +1294,9 @@ int32_t QBBInputContext::onCommitText(input_session_t *ic, spannable_string_t *t
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t QBBInputContext::onDeleteSurroundingText(input_session_t *ic, int32_t left_length, int32_t right_length)
|
||||
int32_t QQnxInputContext::onDeleteSurroundingText(input_session_t *ic, int32_t left_length, int32_t right_length)
|
||||
{
|
||||
#if defined(QBBINPUTCONTEXT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO << "L:" << left_length << " R:" << right_length;
|
||||
#endif
|
||||
|
||||
@ -1309,8 +1309,8 @@ int32_t QBBInputContext::onDeleteSurroundingText(input_session_t *ic, int32_t le
|
||||
return 0;
|
||||
|
||||
if (hasSelectedText()) {
|
||||
QBBEventThread::injectKeyboardEvent(KEY_DOWN | KEY_CAP_VALID, KEYCODE_DELETE, 0, 0, 0);
|
||||
QBBEventThread::injectKeyboardEvent(KEY_CAP_VALID, KEYCODE_DELETE, 0, 0, 0);
|
||||
QQnxEventThread::injectKeyboardEvent(KEY_DOWN | KEY_CAP_VALID, KEYCODE_DELETE, 0, 0, 0);
|
||||
QQnxEventThread::injectKeyboardEvent(KEY_CAP_VALID, KEYCODE_DELETE, 0, 0, 0);
|
||||
reset();
|
||||
return 0;
|
||||
}
|
||||
@ -1326,9 +1326,9 @@ int32_t QBBInputContext::onDeleteSurroundingText(input_session_t *ic, int32_t le
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t QBBInputContext::onEndBatchEdit(input_session_t *ic)
|
||||
int32_t QQnxInputContext::onEndBatchEdit(input_session_t *ic)
|
||||
{
|
||||
#if defined(QBBINPUTCONTEXT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
|
||||
@ -1338,9 +1338,9 @@ int32_t QBBInputContext::onEndBatchEdit(input_session_t *ic)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t QBBInputContext::onFinishComposingText(input_session_t *ic)
|
||||
int32_t QQnxInputContext::onFinishComposingText(input_session_t *ic)
|
||||
{
|
||||
#if defined(QBBINPUTCONTEXT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
|
||||
@ -1364,10 +1364,10 @@ int32_t QBBInputContext::onFinishComposingText(input_session_t *ic)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t QBBInputContext::onGetCursorCapsMode(input_session_t *ic, int32_t req_modes)
|
||||
int32_t QQnxInputContext::onGetCursorCapsMode(input_session_t *ic, int32_t req_modes)
|
||||
{
|
||||
Q_UNUSED(req_modes);
|
||||
#if defined(QBBINPUTCONTEXT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
|
||||
@ -1380,9 +1380,9 @@ int32_t QBBInputContext::onGetCursorCapsMode(input_session_t *ic, int32_t req_mo
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t QBBInputContext::onGetCursorPosition(input_session_t *ic)
|
||||
int32_t QQnxInputContext::onGetCursorPosition(input_session_t *ic)
|
||||
{
|
||||
#if defined(QBBINPUTCONTEXT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
|
||||
@ -1401,11 +1401,11 @@ int32_t QBBInputContext::onGetCursorPosition(input_session_t *ic)
|
||||
return m_lastCaretPos;
|
||||
}
|
||||
|
||||
extracted_text_t *QBBInputContext::onGetExtractedText(input_session_t *ic, extracted_text_request_t *request, int32_t flags)
|
||||
extracted_text_t *QQnxInputContext::onGetExtractedText(input_session_t *ic, extracted_text_request_t *request, int32_t flags)
|
||||
{
|
||||
Q_UNUSED(flags);
|
||||
Q_UNUSED(request);
|
||||
#if defined(QBBINPUTCONTEXT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
|
||||
@ -1422,10 +1422,10 @@ extracted_text_t *QBBInputContext::onGetExtractedText(input_session_t *ic, extra
|
||||
return et;
|
||||
}
|
||||
|
||||
spannable_string_t *QBBInputContext::onGetSelectedText(input_session_t *ic, int32_t flags)
|
||||
spannable_string_t *QQnxInputContext::onGetSelectedText(input_session_t *ic, int32_t flags)
|
||||
{
|
||||
Q_UNUSED(flags);
|
||||
#if defined(QBBINPUTCONTEXT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
|
||||
@ -1444,10 +1444,10 @@ spannable_string_t *QBBInputContext::onGetSelectedText(input_session_t *ic, int3
|
||||
return toSpannableString(text);
|
||||
}
|
||||
|
||||
spannable_string_t *QBBInputContext::onGetTextAfterCursor(input_session_t *ic, int32_t n, int32_t flags)
|
||||
spannable_string_t *QQnxInputContext::onGetTextAfterCursor(input_session_t *ic, int32_t n, int32_t flags)
|
||||
{
|
||||
Q_UNUSED(flags);
|
||||
#if defined(QBBINPUTCONTEXT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
|
||||
@ -1467,10 +1467,10 @@ spannable_string_t *QBBInputContext::onGetTextAfterCursor(input_session_t *ic, i
|
||||
return toSpannableString(text.mid(m_lastCaretPos+1, n));
|
||||
}
|
||||
|
||||
spannable_string_t *QBBInputContext::onGetTextBeforeCursor(input_session_t *ic, int32_t n, int32_t flags)
|
||||
spannable_string_t *QQnxInputContext::onGetTextBeforeCursor(input_session_t *ic, int32_t n, int32_t flags)
|
||||
{
|
||||
Q_UNUSED(flags);
|
||||
#if defined(QBBINPUTCONTEXT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
|
||||
@ -1494,10 +1494,10 @@ spannable_string_t *QBBInputContext::onGetTextBeforeCursor(input_session_t *ic,
|
||||
}
|
||||
}
|
||||
|
||||
int32_t QBBInputContext::onPerformEditorAction(input_session_t *ic, int32_t editor_action)
|
||||
int32_t QQnxInputContext::onPerformEditorAction(input_session_t *ic, int32_t editor_action)
|
||||
{
|
||||
Q_UNUSED(editor_action);
|
||||
#if defined(QBBINPUTCONTEXT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
|
||||
@ -1510,10 +1510,10 @@ int32_t QBBInputContext::onPerformEditorAction(input_session_t *ic, int32_t edit
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t QBBInputContext::onReportFullscreenMode(input_session_t *ic, int32_t enabled)
|
||||
int32_t QQnxInputContext::onReportFullscreenMode(input_session_t *ic, int32_t enabled)
|
||||
{
|
||||
Q_UNUSED(enabled);
|
||||
#if defined(QBBINPUTCONTEXT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
|
||||
@ -1526,9 +1526,9 @@ int32_t QBBInputContext::onReportFullscreenMode(input_session_t *ic, int32_t ena
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t QBBInputContext::onSendEvent(input_session_t *ic, event_t *event)
|
||||
int32_t QQnxInputContext::onSendEvent(input_session_t *ic, event_t *event)
|
||||
{
|
||||
#if defined(QBBINPUTCONTEXT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
|
||||
@ -1538,9 +1538,9 @@ int32_t QBBInputContext::onSendEvent(input_session_t *ic, event_t *event)
|
||||
return processEvent(event);
|
||||
}
|
||||
|
||||
int32_t QBBInputContext::onSendAsyncEvent(input_session_t *ic, event_t *event)
|
||||
int32_t QQnxInputContext::onSendAsyncEvent(input_session_t *ic, event_t *event)
|
||||
{
|
||||
#if defined(QBBINPUTCONTEXT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
|
||||
@ -1550,9 +1550,9 @@ int32_t QBBInputContext::onSendAsyncEvent(input_session_t *ic, event_t *event)
|
||||
return processEvent(event);
|
||||
}
|
||||
|
||||
int32_t QBBInputContext::onSetComposingRegion(input_session_t *ic, int32_t start, int32_t end)
|
||||
int32_t QQnxInputContext::onSetComposingRegion(input_session_t *ic, int32_t start, int32_t end)
|
||||
{
|
||||
#if defined(QBBINPUTCONTEXT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
|
||||
@ -1584,10 +1584,10 @@ int32_t QBBInputContext::onSetComposingRegion(input_session_t *ic, int32_t start
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t QBBInputContext::onSetComposingText(input_session_t *ic, spannable_string_t *text, int32_t new_cursor_position)
|
||||
int32_t QQnxInputContext::onSetComposingText(input_session_t *ic, spannable_string_t *text, int32_t new_cursor_position)
|
||||
{
|
||||
Q_UNUSED(new_cursor_position);
|
||||
#if defined(QBBINPUTCONTEXT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
|
||||
@ -1607,11 +1607,11 @@ int32_t QBBInputContext::onSetComposingText(input_session_t *ic, spannable_strin
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t QBBInputContext::onSetSelection(input_session_t *ic, int32_t start, int32_t end)
|
||||
int32_t QQnxInputContext::onSetSelection(input_session_t *ic, int32_t start, int32_t end)
|
||||
{
|
||||
Q_UNUSED(start);
|
||||
Q_UNUSED(end);
|
||||
#if defined(QBBINPUTCONTEXT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
|
||||
@ -1624,35 +1624,35 @@ int32_t QBBInputContext::onSetSelection(input_session_t *ic, int32_t start, int3
|
||||
return 0;
|
||||
}
|
||||
|
||||
void QBBInputContext::showInputPanel()
|
||||
void QQnxInputContext::showInputPanel()
|
||||
{
|
||||
#if defined(QBBINPUTCONTEXT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
dispatchRequestSoftwareInputPanel();
|
||||
}
|
||||
|
||||
void QBBInputContext::hideInputPanel()
|
||||
void QQnxInputContext::hideInputPanel()
|
||||
{
|
||||
#if defined(QBBINPUTCONTEXT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
dispatchCloseSoftwareInputPanel();
|
||||
}
|
||||
|
||||
bool QBBInputContext::isInputPanelVisible() const
|
||||
bool QQnxInputContext::isInputPanelVisible() const
|
||||
{
|
||||
return m_inputPanelVisible;
|
||||
}
|
||||
|
||||
QLocale QBBInputContext::locale() const
|
||||
QLocale QQnxInputContext::locale() const
|
||||
{
|
||||
return m_inputPanelLocale;
|
||||
}
|
||||
|
||||
void QBBInputContext::keyboardVisibilityChanged(bool visible)
|
||||
void QQnxInputContext::keyboardVisibilityChanged(bool visible)
|
||||
{
|
||||
#if defined(QBBINPUTCONTEXT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO << "visible=" << visible;
|
||||
#endif
|
||||
if (m_inputPanelVisible != visible) {
|
||||
@ -1661,9 +1661,9 @@ void QBBInputContext::keyboardVisibilityChanged(bool visible)
|
||||
}
|
||||
}
|
||||
|
||||
void QBBInputContext::keyboardLocaleChanged(const QLocale &locale)
|
||||
void QQnxInputContext::keyboardLocaleChanged(const QLocale &locale)
|
||||
{
|
||||
#if defined(QBBINPUTCONTEXT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO << "locale=" << locale;
|
||||
#endif
|
||||
if (m_inputPanelLocale != locale) {
|
||||
@ -1672,12 +1672,12 @@ void QBBInputContext::keyboardLocaleChanged(const QLocale &locale)
|
||||
}
|
||||
}
|
||||
|
||||
void QBBInputContext::inputItemChanged()
|
||||
void QQnxInputContext::inputItemChanged()
|
||||
{
|
||||
QInputMethod *inputMethod = qApp->inputMethod();
|
||||
QObject *inputItem = inputMethod->inputItem();
|
||||
|
||||
#if defined(QBBINPUTCONTEXT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO << "input item=" << inputItem;
|
||||
#endif
|
||||
|
||||
@ -1686,9 +1686,9 @@ void QBBInputContext::inputItemChanged()
|
||||
hideInputPanel();
|
||||
} else {
|
||||
if (qobject_cast<QAbstractSpinBox*>(inputItem)) {
|
||||
QBBVirtualKeyboard::instance().setKeyboardMode(QBBVirtualKeyboard::NumPunc);
|
||||
QQnxVirtualKeyboard::instance().setKeyboardMode(QQnxVirtualKeyboard::NumPunc);
|
||||
} else {
|
||||
QBBVirtualKeyboard::instance().setKeyboardMode(QBBVirtualKeyboard::Default);
|
||||
QQnxVirtualKeyboard::instance().setKeyboardMode(QQnxVirtualKeyboard::Default);
|
||||
}
|
||||
if (!m_inputPanelVisible)
|
||||
showInputPanel();
|
@ -39,8 +39,8 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QBBINPUTCONTEXT_H
|
||||
#define QBBINPUTCONTEXT_H
|
||||
#ifndef QQNXINPUTCONTEXT_H
|
||||
#define QQNXINPUTCONTEXT_H
|
||||
|
||||
#include <QtGui/QPlatformInputContext>
|
||||
|
||||
@ -53,12 +53,12 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QBBInputContext : public QPlatformInputContext
|
||||
class QQnxInputContext : public QPlatformInputContext
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QBBInputContext();
|
||||
~QBBInputContext();
|
||||
QQnxInputContext();
|
||||
~QQnxInputContext();
|
||||
|
||||
virtual bool isValid() const;
|
||||
|
||||
@ -129,4 +129,4 @@ Q_DECLARE_METATYPE(extracted_text_t*)
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QBBINPUTCONTEXT_H
|
||||
#endif // QQNXINPUTCONTEXT_H
|
@ -39,19 +39,19 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qbbinputcontext_noimf.h"
|
||||
#include "qbbvirtualkeyboard.h"
|
||||
#include "qqnxinputcontext_noimf.h"
|
||||
#include "qqnxvirtualkeyboard.h"
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtGui/QGuiApplication>
|
||||
#include <QtWidgets/QAbstractSpinBox>
|
||||
|
||||
QBBInputContext::QBBInputContext() :
|
||||
QQnxInputContext::QQnxInputContext() :
|
||||
QPlatformInputContext(),
|
||||
m_inputPanelVisible(false),
|
||||
m_inputPanelLocale(QLocale::c())
|
||||
{
|
||||
QBBVirtualKeyboard &keyboard = QBBVirtualKeyboard::instance();
|
||||
QQnxVirtualKeyboard &keyboard = QQnxVirtualKeyboard::instance();
|
||||
connect(&keyboard, SIGNAL(visibilityChanged(bool)), this, SLOT(keyboardVisibilityChanged(bool)));
|
||||
connect(&keyboard, SIGNAL(localeChanged(QLocale)), this, SLOT(keyboardLocaleChanged(QLocale)));
|
||||
keyboardVisibilityChanged(keyboard.isVisible());
|
||||
@ -61,42 +61,42 @@ QBBInputContext::QBBInputContext() :
|
||||
connect(inputMethod, SIGNAL(inputItemChanged()), this, SLOT(inputItemChanged()));
|
||||
}
|
||||
|
||||
QBBInputContext::~QBBInputContext()
|
||||
QQnxInputContext::~QQnxInputContext()
|
||||
{
|
||||
}
|
||||
|
||||
bool QBBInputContext::isValid() const
|
||||
bool QQnxInputContext::isValid() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool QBBInputContext::hasPhysicalKeyboard()
|
||||
bool QQnxInputContext::hasPhysicalKeyboard()
|
||||
{
|
||||
// TODO: This should query the system to check if a USB keyboard is connected.
|
||||
return false;
|
||||
}
|
||||
|
||||
void QBBInputContext::reset()
|
||||
void QQnxInputContext::reset()
|
||||
{
|
||||
}
|
||||
|
||||
bool QBBInputContext::filterEvent( const QEvent *event )
|
||||
bool QQnxInputContext::filterEvent( const QEvent *event )
|
||||
{
|
||||
if (hasPhysicalKeyboard())
|
||||
return false;
|
||||
|
||||
if (event->type() == QEvent::CloseSoftwareInputPanel) {
|
||||
QBBVirtualKeyboard::instance().hideKeyboard();
|
||||
#if defined(QBBINPUTCONTEXT_DEBUG)
|
||||
qDebug() << "QBB: hiding virtual keyboard";
|
||||
QQnxVirtualKeyboard::instance().hideKeyboard();
|
||||
#if defined(QQNXINPUTCONTEXT_DEBUG)
|
||||
qDebug() << "QQNX: hiding virtual keyboard";
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
if (event->type() == QEvent::RequestSoftwareInputPanel) {
|
||||
QBBVirtualKeyboard::instance().showKeyboard();
|
||||
#if defined(QBBINPUTCONTEXT_DEBUG)
|
||||
qDebug() << "QBB: requesting virtual keyboard";
|
||||
QQnxVirtualKeyboard::instance().showKeyboard();
|
||||
#if defined(QQNXINPUTCONTEXT_DEBUG)
|
||||
qDebug() << "QQNX: requesting virtual keyboard";
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
@ -105,7 +105,7 @@ bool QBBInputContext::filterEvent( const QEvent *event )
|
||||
|
||||
}
|
||||
|
||||
bool QBBInputContext::handleKeyboardEvent(int flags, int sym, int mod, int scan, int cap)
|
||||
bool QQnxInputContext::handleKeyboardEvent(int flags, int sym, int mod, int scan, int cap)
|
||||
{
|
||||
Q_UNUSED(flags);
|
||||
Q_UNUSED(sym);
|
||||
@ -115,35 +115,35 @@ bool QBBInputContext::handleKeyboardEvent(int flags, int sym, int mod, int scan,
|
||||
return false;
|
||||
}
|
||||
|
||||
void QBBInputContext::showInputPanel()
|
||||
void QQnxInputContext::showInputPanel()
|
||||
{
|
||||
#if defined(QBBINPUTCONTEXT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
QBBVirtualKeyboard::instance().showKeyboard();
|
||||
QQnxVirtualKeyboard::instance().showKeyboard();
|
||||
}
|
||||
|
||||
void QBBInputContext::hideInputPanel()
|
||||
void QQnxInputContext::hideInputPanel()
|
||||
{
|
||||
#if defined(QBBINPUTCONTEXT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
QBBVirtualKeyboard::instance().hideKeyboard();
|
||||
QQnxVirtualKeyboard::instance().hideKeyboard();
|
||||
}
|
||||
|
||||
bool QBBInputContext::isInputPanelVisible() const
|
||||
bool QQnxInputContext::isInputPanelVisible() const
|
||||
{
|
||||
return m_inputPanelVisible;
|
||||
}
|
||||
|
||||
QLocale QBBInputContext::locale() const
|
||||
QLocale QQnxInputContext::locale() const
|
||||
{
|
||||
return m_inputPanelLocale;
|
||||
}
|
||||
|
||||
void QBBInputContext::keyboardVisibilityChanged(bool visible)
|
||||
void QQnxInputContext::keyboardVisibilityChanged(bool visible)
|
||||
{
|
||||
#if defined(QBBINPUTCONTEXT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO << "visible=" << visible;
|
||||
#endif
|
||||
if (m_inputPanelVisible != visible) {
|
||||
@ -152,9 +152,9 @@ void QBBInputContext::keyboardVisibilityChanged(bool visible)
|
||||
}
|
||||
}
|
||||
|
||||
void QBBInputContext::keyboardLocaleChanged(const QLocale &locale)
|
||||
void QQnxInputContext::keyboardLocaleChanged(const QLocale &locale)
|
||||
{
|
||||
#if defined(QBBINPUTCONTEXT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO << "locale=" << locale;
|
||||
#endif
|
||||
if (m_inputPanelLocale != locale) {
|
||||
@ -163,12 +163,12 @@ void QBBInputContext::keyboardLocaleChanged(const QLocale &locale)
|
||||
}
|
||||
}
|
||||
|
||||
void QBBInputContext::inputItemChanged()
|
||||
void QQnxInputContext::inputItemChanged()
|
||||
{
|
||||
QInputMethod *inputMethod = qApp->inputMethod();
|
||||
QObject *inputItem = inputMethod->inputItem();
|
||||
|
||||
#if defined(QBBINPUTCONTEXT_DEBUG)
|
||||
#if defined(QQNXINPUTCONTEXT_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO << "input item=" << inputItem;
|
||||
#endif
|
||||
|
||||
@ -177,9 +177,9 @@ void QBBInputContext::inputItemChanged()
|
||||
hideInputPanel();
|
||||
} else {
|
||||
if (qobject_cast<QAbstractSpinBox*>(inputItem)) {
|
||||
QBBVirtualKeyboard::instance().setKeyboardMode(QBBVirtualKeyboard::NumPunc);
|
||||
QQnxVirtualKeyboard::instance().setKeyboardMode(QQnxVirtualKeyboard::NumPunc);
|
||||
} else {
|
||||
QBBVirtualKeyboard::instance().setKeyboardMode(QBBVirtualKeyboard::Default);
|
||||
QQnxVirtualKeyboard::instance().setKeyboardMode(QQnxVirtualKeyboard::Default);
|
||||
}
|
||||
if (!m_inputPanelVisible)
|
||||
showInputPanel();
|
@ -39,8 +39,8 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QBBINPUTCONTEXT_H
|
||||
#define QBBINPUTCONTEXT_H
|
||||
#ifndef QQNXINPUTCONTEXT_H
|
||||
#define QQNXINPUTCONTEXT_H
|
||||
|
||||
#include <QtCore/QLocale>
|
||||
#include <QtGui/QPlatformInputContext>
|
||||
@ -48,12 +48,12 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QBBInputContext : public QPlatformInputContext
|
||||
class QQnxInputContext : public QPlatformInputContext
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit QBBInputContext();
|
||||
~QBBInputContext();
|
||||
explicit QQnxInputContext();
|
||||
~QQnxInputContext();
|
||||
|
||||
virtual bool isValid() const;
|
||||
|
||||
@ -81,4 +81,4 @@ private:
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QBBINPUTCONTEXT_H
|
||||
#endif // QQNXINPUTCONTEXT_H
|
@ -39,22 +39,22 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qbbintegration.h"
|
||||
#include "qbbeventthread.h"
|
||||
#include "qbbglbackingstore.h"
|
||||
#include "qbbglcontext.h"
|
||||
#include "qbbnavigatorthread.h"
|
||||
#include "qbbrasterbackingstore.h"
|
||||
#include "qbbscreen.h"
|
||||
#include "qbbwindow.h"
|
||||
#include "qbbvirtualkeyboard.h"
|
||||
#include "qbbclipboard.h"
|
||||
#include "qbbglcontext.h"
|
||||
#include "qqnxintegration.h"
|
||||
#include "qqnxeventthread.h"
|
||||
#include "qqnxglbackingstore.h"
|
||||
#include "qqnxglcontext.h"
|
||||
#include "qqnxnavigatorthread.h"
|
||||
#include "qqnxrasterbackingstore.h"
|
||||
#include "qqnxscreen.h"
|
||||
#include "qqnxwindow.h"
|
||||
#include "qqnxvirtualkeyboard.h"
|
||||
#include "qqnxclipboard.h"
|
||||
#include "qqnxglcontext.h"
|
||||
|
||||
#if defined(QBB_IMF)
|
||||
#include "qbbinputcontext_imf.h"
|
||||
#if defined(QQnx_IMF)
|
||||
#include "qqnxinputcontext_imf.h"
|
||||
#else
|
||||
#include "qbbinputcontext_noimf.h"
|
||||
#include "qqnxinputcontext_noimf.h"
|
||||
#endif
|
||||
|
||||
#include "private/qgenericunixfontdatabase_p.h"
|
||||
@ -71,10 +71,10 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QBBWindowMapper QBBIntegration::ms_windowMapper;
|
||||
QMutex QBBIntegration::ms_windowMapperMutex;
|
||||
QQnxWindowMapper QQnxIntegration::ms_windowMapper;
|
||||
QMutex QQnxIntegration::ms_windowMapperMutex;
|
||||
|
||||
QBBIntegration::QBBIntegration()
|
||||
QQnxIntegration::QQnxIntegration()
|
||||
: QPlatformIntegration()
|
||||
, m_eventThread(0)
|
||||
, m_navigatorThread(0)
|
||||
@ -86,47 +86,47 @@ QBBIntegration::QBBIntegration()
|
||||
, m_clipboard(0)
|
||||
#endif
|
||||
{
|
||||
#if defined(QBBINTEGRATION_DEBUG)
|
||||
#if defined(QQNXINTEGRATION_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
// Open connection to QNX composition manager
|
||||
errno = 0;
|
||||
int result = screen_create_context(&m_screenContext, SCREEN_APPLICATION_CONTEXT);
|
||||
if (result != 0) {
|
||||
qFatal("QBB: failed to connect to composition manager, errno=%d", errno);
|
||||
qFatal("QQnx: failed to connect to composition manager, errno=%d", errno);
|
||||
}
|
||||
|
||||
// Create displays for all possible screens (which may not be attached)
|
||||
QBBScreen::createDisplays(m_screenContext);
|
||||
Q_FOREACH (QPlatformScreen *screen, QBBScreen::screens()) {
|
||||
QQnxScreen::createDisplays(m_screenContext);
|
||||
Q_FOREACH (QPlatformScreen *screen, QQnxScreen::screens()) {
|
||||
screenAdded(screen);
|
||||
}
|
||||
|
||||
// Initialize global OpenGL resources
|
||||
QBBGLContext::initialize();
|
||||
QQnxGLContext::initialize();
|
||||
|
||||
// Create/start event thread
|
||||
m_eventThread = new QBBEventThread(m_screenContext, *QBBScreen::primaryDisplay());
|
||||
m_eventThread = new QQnxEventThread(m_screenContext, *QQnxScreen::primaryDisplay());
|
||||
m_eventThread->start();
|
||||
|
||||
// Create/start navigator thread
|
||||
m_navigatorThread = new QBBNavigatorThread(*QBBScreen::primaryDisplay());
|
||||
m_navigatorThread = new QQnxNavigatorThread(*QQnxScreen::primaryDisplay());
|
||||
m_navigatorThread->start();
|
||||
|
||||
// Create/start the keyboard class.
|
||||
QBBVirtualKeyboard::instance();
|
||||
QQnxVirtualKeyboard::instance();
|
||||
|
||||
// Set up the input context
|
||||
m_inputContext = new QBBInputContext;
|
||||
m_inputContext = new QQnxInputContext;
|
||||
}
|
||||
|
||||
QBBIntegration::~QBBIntegration()
|
||||
QQnxIntegration::~QQnxIntegration()
|
||||
{
|
||||
#if defined(QBBINTEGRATION_DEBUG)
|
||||
qDebug() << "QBB: platform plugin shutdown begin";
|
||||
#if defined(QQNXINTEGRATION_DEBUG)
|
||||
qDebug() << "QQnx: platform plugin shutdown begin";
|
||||
#endif
|
||||
// Destroy the keyboard class.
|
||||
QBBVirtualKeyboard::destroy();
|
||||
QQnxVirtualKeyboard::destroy();
|
||||
|
||||
#ifndef QT_NO_CLIPBOARD
|
||||
// Delete the clipboard
|
||||
@ -140,22 +140,22 @@ QBBIntegration::~QBBIntegration()
|
||||
delete m_navigatorThread;
|
||||
|
||||
// Destroy all displays
|
||||
QBBScreen::destroyDisplays();
|
||||
QQnxScreen::destroyDisplays();
|
||||
|
||||
// Close connection to QNX composition manager
|
||||
screen_destroy_context(m_screenContext);
|
||||
|
||||
// Cleanup global OpenGL resources
|
||||
QBBGLContext::shutdown();
|
||||
QQnxGLContext::shutdown();
|
||||
|
||||
#if defined(QBBINTEGRATION_DEBUG)
|
||||
qDebug() << "QBB: platform plugin shutdown end";
|
||||
#if defined(QQNXINTEGRATION_DEBUG)
|
||||
qDebug() << "QQnx: platform plugin shutdown end";
|
||||
#endif
|
||||
}
|
||||
|
||||
bool QBBIntegration::hasCapability(QPlatformIntegration::Capability cap) const
|
||||
bool QQnxIntegration::hasCapability(QPlatformIntegration::Capability cap) const
|
||||
{
|
||||
#if defined(QBBINTEGRATION_DEBUG)
|
||||
#if defined(QQNXINTEGRATION_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
switch (cap) {
|
||||
@ -168,90 +168,90 @@ bool QBBIntegration::hasCapability(QPlatformIntegration::Capability cap) const
|
||||
}
|
||||
}
|
||||
|
||||
QPlatformWindow *QBBIntegration::createPlatformWindow(QWindow *window) const
|
||||
QPlatformWindow *QQnxIntegration::createPlatformWindow(QWindow *window) const
|
||||
{
|
||||
#if defined(QBBINTEGRATION_DEBUG)
|
||||
#if defined(QQNXINTEGRATION_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
// New windows are created on the primary display.
|
||||
return new QBBWindow(window, m_screenContext);
|
||||
return new QQnxWindow(window, m_screenContext);
|
||||
}
|
||||
|
||||
QPlatformBackingStore *QBBIntegration::createPlatformBackingStore(QWindow *window) const
|
||||
QPlatformBackingStore *QQnxIntegration::createPlatformBackingStore(QWindow *window) const
|
||||
{
|
||||
#if defined(QBBINTEGRATION_DEBUG)
|
||||
#if defined(QQNXINTEGRATION_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
if (paintUsingOpenGL())
|
||||
return new QBBGLBackingStore(window);
|
||||
return new QQnxGLBackingStore(window);
|
||||
else
|
||||
return new QBBRasterBackingStore(window);
|
||||
return new QQnxRasterBackingStore(window);
|
||||
}
|
||||
|
||||
QPlatformOpenGLContext *QBBIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const
|
||||
QPlatformOpenGLContext *QQnxIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const
|
||||
{
|
||||
#if defined(QBBINTEGRATION_DEBUG)
|
||||
#if defined(QQNXINTEGRATION_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
return new QBBGLContext(context);
|
||||
return new QQnxGLContext(context);
|
||||
}
|
||||
|
||||
QPlatformInputContext *QBBIntegration::inputContext() const
|
||||
QPlatformInputContext *QQnxIntegration::inputContext() const
|
||||
{
|
||||
#if defined(QBBINTEGRATION_DEBUG)
|
||||
#if defined(QQNXINTEGRATION_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
return m_inputContext;
|
||||
}
|
||||
|
||||
void QBBIntegration::moveToScreen(QWindow *window, int screen)
|
||||
void QQnxIntegration::moveToScreen(QWindow *window, int screen)
|
||||
{
|
||||
#if defined(QBBINTEGRATION_DEBUG)
|
||||
qDebug() << "QBBIntegration::moveToScreen - w=" << window << ", s=" << screen;
|
||||
#if defined(QQNXINTEGRATION_DEBUG)
|
||||
qDebug() << "QQnxIntegration::moveToScreen - w=" << window << ", s=" << screen;
|
||||
#endif
|
||||
|
||||
// get platform window used by widget
|
||||
QBBWindow *platformWindow = static_cast<QBBWindow *>(window->handle());
|
||||
QQnxWindow *platformWindow = static_cast<QQnxWindow *>(window->handle());
|
||||
|
||||
// lookup platform screen by index
|
||||
QBBScreen *platformScreen = static_cast<QBBScreen*>(QBBScreen::screens().at(screen));
|
||||
QQnxScreen *platformScreen = static_cast<QQnxScreen*>(QQnxScreen::screens().at(screen));
|
||||
|
||||
// move the platform window to the platform screen
|
||||
platformWindow->setScreen(platformScreen);
|
||||
}
|
||||
|
||||
QList<QPlatformScreen *> QBBIntegration::screens() const
|
||||
QList<QPlatformScreen *> QQnxIntegration::screens() const
|
||||
{
|
||||
#if defined(QBBINTEGRATION_DEBUG)
|
||||
#if defined(QQNXINTEGRATION_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
return QBBScreen::screens();
|
||||
return QQnxScreen::screens();
|
||||
}
|
||||
|
||||
QAbstractEventDispatcher *QBBIntegration::guiThreadEventDispatcher() const
|
||||
QAbstractEventDispatcher *QQnxIntegration::guiThreadEventDispatcher() const
|
||||
{
|
||||
#if defined(QBBINTEGRATION_DEBUG)
|
||||
#if defined(QQNXINTEGRATION_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
return m_eventDispatcher;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_CLIPBOARD
|
||||
QPlatformClipboard *QBBIntegration::clipboard() const
|
||||
QPlatformClipboard *QQnxIntegration::clipboard() const
|
||||
{
|
||||
#if defined(QBBINTEGRATION_DEBUG)
|
||||
#if defined(QQNXINTEGRATION_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
if (!m_clipboard) {
|
||||
m_clipboard = new QBBClipboard;
|
||||
m_clipboard = new QQnxClipboard;
|
||||
}
|
||||
return m_clipboard;
|
||||
}
|
||||
#endif
|
||||
|
||||
QVariant QBBIntegration::styleHint(QPlatformIntegration::StyleHint hint) const
|
||||
QVariant QQnxIntegration::styleHint(QPlatformIntegration::StyleHint hint) const
|
||||
{
|
||||
#if defined(QBBINTEGRATION_DEBUG)
|
||||
#if defined(QQNXINTEGRATION_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
if (hint == ShowIsFullScreen)
|
||||
@ -260,9 +260,9 @@ QVariant QBBIntegration::styleHint(QPlatformIntegration::StyleHint hint) const
|
||||
return QPlatformIntegration::styleHint(hint);
|
||||
}
|
||||
|
||||
QWindow *QBBIntegration::window(screen_window_t qnxWindow)
|
||||
QWindow *QQnxIntegration::window(screen_window_t qnxWindow)
|
||||
{
|
||||
#if defined(QBBINTEGRATION_DEBUG)
|
||||
#if defined(QQNXINTEGRATION_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
QMutexLocker locker(&ms_windowMapperMutex);
|
||||
@ -270,9 +270,9 @@ QWindow *QBBIntegration::window(screen_window_t qnxWindow)
|
||||
return ms_windowMapper.value(qnxWindow, 0);
|
||||
}
|
||||
|
||||
void QBBIntegration::addWindow(screen_window_t qnxWindow, QWindow *window)
|
||||
void QQnxIntegration::addWindow(screen_window_t qnxWindow, QWindow *window)
|
||||
{
|
||||
#if defined(QBBINTEGRATION_DEBUG)
|
||||
#if defined(QQNXINTEGRATION_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
QMutexLocker locker(&ms_windowMapperMutex);
|
||||
@ -280,9 +280,9 @@ void QBBIntegration::addWindow(screen_window_t qnxWindow, QWindow *window)
|
||||
ms_windowMapper.insert(qnxWindow, window);
|
||||
}
|
||||
|
||||
void QBBIntegration::removeWindow(screen_window_t qnxWindow)
|
||||
void QQnxIntegration::removeWindow(screen_window_t qnxWindow)
|
||||
{
|
||||
#if defined(QBBINTEGRATION_DEBUG)
|
||||
#if defined(QQNXINTEGRATION_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
QMutexLocker locker(&ms_windowMapperMutex);
|
@ -39,8 +39,8 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QBBINTEGRATION_H
|
||||
#define QBBINTEGRATION_H
|
||||
#ifndef QQNXINTEGRATION_H
|
||||
#define QQNXINTEGRATION_H
|
||||
|
||||
#include <QtGui/qplatformintegration_qpa.h>
|
||||
|
||||
@ -50,23 +50,23 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QBBEventThread;
|
||||
class QBBInputContext;
|
||||
class QBBNavigatorThread;
|
||||
class QBBWindow;
|
||||
class QQnxEventThread;
|
||||
class QQnxInputContext;
|
||||
class QQnxNavigatorThread;
|
||||
class QQnxWindow;
|
||||
|
||||
#ifndef QT_NO_CLIPBOARD
|
||||
class QBBClipboard;
|
||||
class QQnxClipboard;
|
||||
#endif
|
||||
|
||||
template<class K, class V> class QHash;
|
||||
typedef QHash<screen_window_t, QWindow *> QBBWindowMapper;
|
||||
typedef QHash<screen_window_t, QWindow *> QQnxWindowMapper;
|
||||
|
||||
class QBBIntegration : public QPlatformIntegration
|
||||
class QQnxIntegration : public QPlatformIntegration
|
||||
{
|
||||
public:
|
||||
QBBIntegration();
|
||||
virtual ~QBBIntegration();
|
||||
QQnxIntegration();
|
||||
virtual ~QQnxIntegration();
|
||||
|
||||
virtual bool hasCapability(QPlatformIntegration::Capability cap) const;
|
||||
|
||||
@ -98,22 +98,22 @@ private:
|
||||
static void removeWindow(screen_window_t qnxWindow);
|
||||
|
||||
screen_context_t m_screenContext;
|
||||
QBBEventThread *m_eventThread;
|
||||
QBBNavigatorThread *m_navigatorThread;
|
||||
QBBInputContext *m_inputContext;
|
||||
QQnxEventThread *m_eventThread;
|
||||
QQnxNavigatorThread *m_navigatorThread;
|
||||
QQnxInputContext *m_inputContext;
|
||||
QPlatformFontDatabase *m_fontDatabase;
|
||||
bool m_paintUsingOpenGL;
|
||||
QAbstractEventDispatcher *m_eventDispatcher;
|
||||
#ifndef QT_NO_CLIPBOARD
|
||||
mutable QBBClipboard* m_clipboard;
|
||||
mutable QQnxClipboard* m_clipboard;
|
||||
#endif
|
||||
|
||||
static QBBWindowMapper ms_windowMapper;
|
||||
static QQnxWindowMapper ms_windowMapper;
|
||||
static QMutex ms_windowMapperMutex;
|
||||
|
||||
friend class QBBWindow;
|
||||
friend class QQnxWindow;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QBBINTEGRATION_H
|
||||
#endif // QQNXINTEGRATION_H
|
@ -39,12 +39,12 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QBBKEYTRANSLATOR_H
|
||||
#define QBBKEYTRANSLATOR_H
|
||||
#ifndef QQNXKEYTRANSLATOR_H
|
||||
#define QQNXKEYTRANSLATOR_H
|
||||
|
||||
#include <sys/keycodes.h>
|
||||
|
||||
#if defined(QBBEVENTTHREAD_DEBUG)
|
||||
#if defined(QQNXEVENTTHREAD_DEBUG)
|
||||
#include <QtCore/QDebug>
|
||||
#endif
|
||||
|
||||
@ -227,8 +227,8 @@ Qt::Key keyTranslator( int key )
|
||||
// See keycodes.h for more, but these are all the basics. And printables are already included.
|
||||
|
||||
default:
|
||||
#if defined(QBBEVENTTHREAD_DEBUG)
|
||||
qDebug() << "QBB: unknown key for translation:" << key;
|
||||
#if defined(QQNXEVENTTHREAD_DEBUG)
|
||||
qDebug() << "QQNX: unknown key for translation:" << key;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
@ -266,4 +266,4 @@ bool isKeypadKey( int key )
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QBBKEYTRANSLATOR_H
|
||||
#endif // QQNXKEYTRANSLATOR_H
|
@ -39,8 +39,8 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qbbnavigatorthread.h"
|
||||
#include "qbbscreen.h"
|
||||
#include "qqnxnavigatorthread.h"
|
||||
#include "qqnxscreen.h"
|
||||
|
||||
#include <QtGui/QGuiApplication>
|
||||
#include <QtGui/QWindow>
|
||||
@ -61,14 +61,14 @@
|
||||
static const char *navigatorControlPath = "/pps/services/navigator/control";
|
||||
static const int ppsBufferSize = 4096;
|
||||
|
||||
QBBNavigatorThread::QBBNavigatorThread(QBBScreen& primaryScreen)
|
||||
QQnxNavigatorThread::QQnxNavigatorThread(QQnxScreen& primaryScreen)
|
||||
: m_primaryScreen(primaryScreen),
|
||||
m_fd(-1),
|
||||
m_readNotifier(0)
|
||||
{
|
||||
}
|
||||
|
||||
QBBNavigatorThread::~QBBNavigatorThread()
|
||||
QQnxNavigatorThread::~QQnxNavigatorThread()
|
||||
{
|
||||
// block until thread terminates
|
||||
shutdown();
|
||||
@ -76,17 +76,17 @@ QBBNavigatorThread::~QBBNavigatorThread()
|
||||
delete m_readNotifier;
|
||||
}
|
||||
|
||||
void QBBNavigatorThread::run()
|
||||
void QQnxNavigatorThread::run()
|
||||
{
|
||||
#if defined(QBBNAVIGATORTHREAD_DEBUG)
|
||||
qDebug() << "QBB: navigator thread started";
|
||||
#if defined(QQNXNAVIGATORTHREAD_DEBUG)
|
||||
qDebug() << "QQNX: navigator thread started";
|
||||
#endif
|
||||
|
||||
// open connection to navigator
|
||||
errno = 0;
|
||||
m_fd = open(navigatorControlPath, O_RDWR);
|
||||
if (m_fd == -1) {
|
||||
qWarning("QBB: failed to open navigator pps, errno=%d", errno);
|
||||
qWarning("QQNX: failed to open navigator pps, errno=%d", errno);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -99,15 +99,15 @@ void QBBNavigatorThread::run()
|
||||
// close connection to navigator
|
||||
close(m_fd);
|
||||
|
||||
#if defined(QBBNAVIGATORTHREAD_DEBUG)
|
||||
qDebug() << "QBB: navigator thread stopped";
|
||||
#if defined(QQNXNAVIGATORTHREAD_DEBUG)
|
||||
qDebug() << "QQNX: navigator thread stopped";
|
||||
#endif
|
||||
}
|
||||
|
||||
void QBBNavigatorThread::shutdown()
|
||||
void QQnxNavigatorThread::shutdown()
|
||||
{
|
||||
#if defined(QBBNAVIGATORTHREAD_DEBUG)
|
||||
qDebug() << "QBB: navigator thread shutdown begin";
|
||||
#if defined(QQNXNAVIGATORTHREAD_DEBUG)
|
||||
qDebug() << "QQNX: navigator thread shutdown begin";
|
||||
#endif
|
||||
|
||||
// signal thread to terminate
|
||||
@ -116,14 +116,14 @@ void QBBNavigatorThread::shutdown()
|
||||
// block until thread terminates
|
||||
wait();
|
||||
|
||||
#if defined(QBBNAVIGATORTHREAD_DEBUG)
|
||||
qDebug() << "QBB: navigator thread shutdown end";
|
||||
#if defined(QQNXNAVIGATORTHREAD_DEBUG)
|
||||
qDebug() << "QQNX: navigator thread shutdown end";
|
||||
#endif
|
||||
}
|
||||
|
||||
void QBBNavigatorThread::parsePPS(const QByteArray &ppsData, QByteArray &msg, QByteArray &dat, QByteArray &id)
|
||||
void QQnxNavigatorThread::parsePPS(const QByteArray &ppsData, QByteArray &msg, QByteArray &dat, QByteArray &id)
|
||||
{
|
||||
#if defined(QBBNAVIGATORTHREAD_DEBUG)
|
||||
#if defined(QQNXNAVIGATORTHREAD_DEBUG)
|
||||
qDebug() << "PPS: data=" << ppsData;
|
||||
#endif
|
||||
|
||||
@ -132,7 +132,7 @@ void QBBNavigatorThread::parsePPS(const QByteArray &ppsData, QByteArray &msg, QB
|
||||
|
||||
// validate pps object
|
||||
if (lines.size() == 0 || lines.at(0) != "@control") {
|
||||
qFatal("QBB: unrecognized pps object, data=%s", ppsData.constData());
|
||||
qFatal("QQNX: unrecognized pps object, data=%s", ppsData.constData());
|
||||
}
|
||||
|
||||
// parse pps object attributes and extract values
|
||||
@ -141,7 +141,7 @@ void QBBNavigatorThread::parsePPS(const QByteArray &ppsData, QByteArray &msg, QB
|
||||
// tokenize current attribute
|
||||
const QByteArray &attr = lines.at(i);
|
||||
|
||||
#if defined(QBBNAVIGATORTHREAD_DEBUG)
|
||||
#if defined(QQNXNAVIGATORTHREAD_DEBUG)
|
||||
qDebug() << "PPS: attr=" << attr;
|
||||
#endif
|
||||
|
||||
@ -160,7 +160,7 @@ void QBBNavigatorThread::parsePPS(const QByteArray &ppsData, QByteArray &msg, QB
|
||||
QByteArray key = attr.left(firstColon);
|
||||
QByteArray value = attr.mid(secondColon + 1);
|
||||
|
||||
#if defined(QBBNAVIGATORTHREAD_DEBUG)
|
||||
#if defined(QQNXNAVIGATORTHREAD_DEBUG)
|
||||
qDebug() << "PPS: key=" << key;
|
||||
qDebug() << "PPS: val=" << value;
|
||||
#endif
|
||||
@ -173,12 +173,12 @@ void QBBNavigatorThread::parsePPS(const QByteArray &ppsData, QByteArray &msg, QB
|
||||
} else if (key == "id") {
|
||||
id = value;
|
||||
} else {
|
||||
qFatal("QBB: unrecognized pps attribute, attr=%s", key.constData());
|
||||
qFatal("QQNX: unrecognized pps attribute, attr=%s", key.constData());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QBBNavigatorThread::replyPPS(const QByteArray &res, const QByteArray &id, const QByteArray &dat)
|
||||
void QQnxNavigatorThread::replyPPS(const QByteArray &res, const QByteArray &id, const QByteArray &dat)
|
||||
{
|
||||
// construct pps message
|
||||
QByteArray ppsData = "res::";
|
||||
@ -191,7 +191,7 @@ void QBBNavigatorThread::replyPPS(const QByteArray &res, const QByteArray &id, c
|
||||
}
|
||||
ppsData += "\n";
|
||||
|
||||
#if defined(QBBNAVIGATORTHREAD_DEBUG)
|
||||
#if defined(QQNXNAVIGATORTHREAD_DEBUG)
|
||||
qDebug() << "PPS reply=" << ppsData;
|
||||
#endif
|
||||
|
||||
@ -199,13 +199,13 @@ void QBBNavigatorThread::replyPPS(const QByteArray &res, const QByteArray &id, c
|
||||
errno = 0;
|
||||
int bytes = write(m_fd, ppsData.constData(), ppsData.size());
|
||||
if (bytes == -1) {
|
||||
qFatal("QBB: failed to write navigator pps, errno=%d", errno);
|
||||
qFatal("QQNX: failed to write navigator pps, errno=%d", errno);
|
||||
}
|
||||
}
|
||||
|
||||
void QBBNavigatorThread::handleMessage(const QByteArray &msg, const QByteArray &dat, const QByteArray &id)
|
||||
void QQnxNavigatorThread::handleMessage(const QByteArray &msg, const QByteArray &dat, const QByteArray &id)
|
||||
{
|
||||
#if defined(QBBNAVIGATORTHREAD_DEBUG)
|
||||
#if defined(QQNXNAVIGATORTHREAD_DEBUG)
|
||||
qDebug() << "PPS: msg=" << msg << ", dat=" << dat << ", id=" << id;
|
||||
#endif
|
||||
|
||||
@ -213,7 +213,7 @@ void QBBNavigatorThread::handleMessage(const QByteArray &msg, const QByteArray &
|
||||
if (msg == "orientationCheck") {
|
||||
|
||||
// reply to navigator that (any) orientation is acceptable
|
||||
#if defined(QBBNAVIGATORTHREAD_DEBUG)
|
||||
#if defined(QQNXNAVIGATORTHREAD_DEBUG)
|
||||
qDebug() << "PPS: orientation check, o=" << dat;
|
||||
#endif
|
||||
replyPPS(msg, id, "true");
|
||||
@ -221,7 +221,7 @@ void QBBNavigatorThread::handleMessage(const QByteArray &msg, const QByteArray &
|
||||
} else if (msg == "orientation") {
|
||||
|
||||
// update screen geometry and reply to navigator that we're ready
|
||||
#if defined(QBBNAVIGATORTHREAD_DEBUG)
|
||||
#if defined(QQNXNAVIGATORTHREAD_DEBUG)
|
||||
qDebug() << "PPS: orientation, o=" << dat;
|
||||
#endif
|
||||
m_primaryScreen.setRotation( dat.toInt() );
|
||||
@ -231,7 +231,7 @@ void QBBNavigatorThread::handleMessage(const QByteArray &msg, const QByteArray &
|
||||
} else if (msg == "SWIPE_DOWN") {
|
||||
|
||||
// simulate menu key press
|
||||
#if defined(QBBNAVIGATORTHREAD_DEBUG)
|
||||
#if defined(QQNXNAVIGATORTHREAD_DEBUG)
|
||||
qDebug() << "PPS: menu";
|
||||
#endif
|
||||
QWindow *w = QGuiApplication::focusWindow();
|
||||
@ -241,17 +241,17 @@ void QBBNavigatorThread::handleMessage(const QByteArray &msg, const QByteArray &
|
||||
} else if (msg == "exit") {
|
||||
|
||||
// shutdown everything
|
||||
#if defined(QBBNAVIGATORTHREAD_DEBUG)
|
||||
#if defined(QQNXNAVIGATORTHREAD_DEBUG)
|
||||
qDebug() << "PPS: exit";
|
||||
#endif
|
||||
QCoreApplication::quit();
|
||||
}
|
||||
}
|
||||
|
||||
void QBBNavigatorThread::readData()
|
||||
void QQnxNavigatorThread::readData()
|
||||
{
|
||||
#if defined(QBBNAVIGATORTHREAD_DEBUG)
|
||||
qDebug() << "QBB: reading navigator data";
|
||||
#if defined(QQNXNAVIGATORTHREAD_DEBUG)
|
||||
qDebug() << "QQNX: reading navigator data";
|
||||
#endif
|
||||
// allocate buffer for pps data
|
||||
char buffer[ppsBufferSize];
|
||||
@ -260,7 +260,7 @@ void QBBNavigatorThread::readData()
|
||||
errno = 0;
|
||||
int bytes = qt_safe_read(m_fd, buffer, ppsBufferSize - 1);
|
||||
if (bytes == -1) {
|
||||
qFatal("QBB: failed to read navigator pps, errno=%d", errno);
|
||||
qFatal("QQNX: failed to read navigator pps, errno=%d", errno);
|
||||
}
|
||||
|
||||
// check if pps data was received
|
@ -39,22 +39,22 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QBBNAVIGATORTHREAD_H
|
||||
#define QBBNAVIGATORTHREAD_H
|
||||
#ifndef QQNXNAVIGATORTHREAD_H
|
||||
#define QQNXNAVIGATORTHREAD_H
|
||||
|
||||
#include <QThread>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QBBScreen;
|
||||
class QQnxScreen;
|
||||
class QSocketNotifier;
|
||||
|
||||
class QBBNavigatorThread : public QThread
|
||||
class QQnxNavigatorThread : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QBBNavigatorThread(QBBScreen &primaryScreen);
|
||||
virtual ~QBBNavigatorThread();
|
||||
QQnxNavigatorThread(QQnxScreen &primaryScreen);
|
||||
virtual ~QQnxNavigatorThread();
|
||||
|
||||
protected:
|
||||
virtual void run();
|
||||
@ -68,11 +68,11 @@ private:
|
||||
void replyPPS(const QByteArray &res, const QByteArray &id, const QByteArray &dat);
|
||||
void handleMessage(const QByteArray &msg, const QByteArray &dat, const QByteArray &id);
|
||||
|
||||
QBBScreen &m_primaryScreen;
|
||||
QQnxScreen &m_primaryScreen;
|
||||
int m_fd;
|
||||
QSocketNotifier *m_readNotifier;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QBBNAVIGATORTHREAD_H
|
||||
#endif // QQNXNAVIGATORTHREAD_H
|
@ -39,8 +39,8 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qbbrasterbackingstore.h"
|
||||
#include "qbbwindow.h"
|
||||
#include "qqnxrasterbackingstore.h"
|
||||
#include "qqnxwindow.h"
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
@ -48,36 +48,36 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QBBRasterBackingStore::QBBRasterBackingStore(QWindow *window)
|
||||
QQnxRasterBackingStore::QQnxRasterBackingStore(QWindow *window)
|
||||
: QPlatformBackingStore(window)
|
||||
{
|
||||
#if defined(QBBRASTERBACKINGSTORE_DEBUG)
|
||||
qDebug() << "QBBRasterBackingStore::QBBRasterBackingStore - w=" << window;
|
||||
#if defined(QQNXRASTERBACKINGSTORE_DEBUG)
|
||||
qDebug() << "QQnxRasterBackingStore::QQnxRasterBackingStore - w=" << window;
|
||||
#endif
|
||||
|
||||
// save platform window associated with widget
|
||||
m_platformWindow = static_cast<QBBWindow*>(window->handle());
|
||||
m_platformWindow = static_cast<QQnxWindow*>(window->handle());
|
||||
}
|
||||
|
||||
QBBRasterBackingStore::~QBBRasterBackingStore()
|
||||
QQnxRasterBackingStore::~QQnxRasterBackingStore()
|
||||
{
|
||||
#if defined(QBBRasterBackingStore_DEBUG)
|
||||
qDebug() << "QBBRasterBackingStore::~QBBRasterBackingStore - w=" << window();
|
||||
#if defined(QQnxRasterBackingStore_DEBUG)
|
||||
qDebug() << "QQnxRasterBackingStore::~QQnxRasterBackingStore - w=" << window();
|
||||
#endif
|
||||
}
|
||||
|
||||
QPaintDevice *QBBRasterBackingStore::paintDevice()
|
||||
QPaintDevice *QQnxRasterBackingStore::paintDevice()
|
||||
{
|
||||
return m_platformWindow->renderBuffer().image();
|
||||
}
|
||||
|
||||
void QBBRasterBackingStore::flush(QWindow *window, const QRegion ®ion, const QPoint &offset)
|
||||
void QQnxRasterBackingStore::flush(QWindow *window, const QRegion ®ion, const QPoint &offset)
|
||||
{
|
||||
Q_UNUSED(window);
|
||||
Q_UNUSED(offset);
|
||||
|
||||
#if defined(QBBRASTERBACKINGSTORE_DEBUG)
|
||||
qDebug() << "QBBRasterBackingStore::flush - w=" << this->window();
|
||||
#if defined(QQNXRASTERBACKINGSTORE_DEBUG)
|
||||
qDebug() << "QQnxRasterBackingStore::flush - w=" << this->window();
|
||||
#endif
|
||||
|
||||
// visit all pending scroll operations
|
||||
@ -96,22 +96,22 @@ void QBBRasterBackingStore::flush(QWindow *window, const QRegion ®ion, const
|
||||
m_platformWindow->post(region);
|
||||
}
|
||||
|
||||
void QBBRasterBackingStore::resize(const QSize &size, const QRegion &staticContents)
|
||||
void QQnxRasterBackingStore::resize(const QSize &size, const QRegion &staticContents)
|
||||
{
|
||||
Q_UNUSED(size);
|
||||
Q_UNUSED(staticContents);
|
||||
#if defined(QBBRASTERBACKINGSTORE_DEBUG)
|
||||
qDebug() << "QBBRasterBackingStore::resize - w=" << window() << ", s=" << size;
|
||||
#if defined(QQNXRASTERBACKINGSTORE_DEBUG)
|
||||
qDebug() << "QQnxRasterBackingStore::resize - w=" << window() << ", s=" << size;
|
||||
#endif
|
||||
|
||||
// NOTE: defer resizing window buffers until next paint as
|
||||
// resize() can be called multiple times before a paint occurs
|
||||
}
|
||||
|
||||
bool QBBRasterBackingStore::scroll(const QRegion &area, int dx, int dy)
|
||||
bool QQnxRasterBackingStore::scroll(const QRegion &area, int dx, int dy)
|
||||
{
|
||||
#if defined(QBBRASTERBACKINGSTORE_DEBUG)
|
||||
qDebug() << "QBBRasterBackingStore::scroll - w=" << window();
|
||||
#if defined(QQNXRASTERBACKINGSTORE_DEBUG)
|
||||
qDebug() << "QQnxRasterBackingStore::scroll - w=" << window();
|
||||
#endif
|
||||
|
||||
// calculate entire region affected by scroll operation (src + dst)
|
||||
@ -130,7 +130,7 @@ bool QBBRasterBackingStore::scroll(const QRegion &area, int dx, int dy)
|
||||
} else if (op.totalArea.intersects(totalArea)) {
|
||||
// current scroll overlaps previous scroll but is
|
||||
// not equal in area - just paint everything
|
||||
qWarning("QBB: pending scroll operations overlap but not equal");
|
||||
qWarning("QQNX: pending scroll operations overlap but not equal");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -140,12 +140,12 @@ bool QBBRasterBackingStore::scroll(const QRegion &area, int dx, int dy)
|
||||
return true;
|
||||
}
|
||||
|
||||
void QBBRasterBackingStore::beginPaint(const QRegion ®ion)
|
||||
void QQnxRasterBackingStore::beginPaint(const QRegion ®ion)
|
||||
{
|
||||
Q_UNUSED(region);
|
||||
|
||||
#if defined(QBBRASTERBACKINGSTORE_DEBUG)
|
||||
qDebug() << "QBBRasterBackingStore::beginPaint - w=" << window();
|
||||
#if defined(QQNXRASTERBACKINGSTORE_DEBUG)
|
||||
qDebug() << "QQnxRasterBackingStore::beginPaint - w=" << window();
|
||||
#endif
|
||||
|
||||
// resize window buffers if surface resized
|
||||
@ -155,11 +155,11 @@ void QBBRasterBackingStore::beginPaint(const QRegion ®ion)
|
||||
}
|
||||
}
|
||||
|
||||
void QBBRasterBackingStore::endPaint(const QRegion ®ion)
|
||||
void QQnxRasterBackingStore::endPaint(const QRegion ®ion)
|
||||
{
|
||||
Q_UNUSED(region);
|
||||
#if defined(QBBRasterBackingStore_DEBUG)
|
||||
qDebug() << "QBBRasterBackingStore::endPaint - w=" << window();
|
||||
#if defined(QQnxRasterBackingStore_DEBUG)
|
||||
qDebug() << "QQnxRasterBackingStore::endPaint - w=" << window();
|
||||
#endif
|
||||
}
|
||||
|
@ -39,8 +39,8 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QBBRASTERWINDOWSURFACE_H
|
||||
#define QBBRASTERWINDOWSURFACE_H
|
||||
#ifndef QQNXRASTERWINDOWSURFACE_H
|
||||
#define QQNXRASTERWINDOWSURFACE_H
|
||||
|
||||
#include <QtGui/qplatformbackingstore_qpa.h>
|
||||
|
||||
@ -48,13 +48,13 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QBBWindow;
|
||||
class QQnxWindow;
|
||||
|
||||
class QBBRasterBackingStore : public QPlatformBackingStore
|
||||
class QQnxRasterBackingStore : public QPlatformBackingStore
|
||||
{
|
||||
public:
|
||||
QBBRasterBackingStore(QWindow *window);
|
||||
virtual ~QBBRasterBackingStore();
|
||||
QQnxRasterBackingStore(QWindow *window);
|
||||
virtual ~QQnxRasterBackingStore();
|
||||
|
||||
virtual QPaintDevice *paintDevice();
|
||||
virtual void flush(QWindow *window, const QRegion ®ion, const QPoint &offset);
|
||||
@ -72,10 +72,10 @@ private:
|
||||
int dy;
|
||||
};
|
||||
|
||||
QBBWindow *m_platformWindow;
|
||||
QQnxWindow *m_platformWindow;
|
||||
QList<ScrollOp> m_scrollOpList;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QBBRASTERWINDOWSURFACE_H
|
||||
#endif // QQNXRASTERWINDOWSURFACE_H
|
@ -39,13 +39,13 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qbbrootwindow.h"
|
||||
#include "qqnxrootwindow.h"
|
||||
|
||||
#include "qbbscreen.h"
|
||||
#include "qqnxscreen.h"
|
||||
|
||||
#include <QtCore/QUuid>
|
||||
|
||||
#if defined(QBBROOTWINDOW_DEBUG)
|
||||
#if defined(QQNXROOTWINDOW_DEBUG)
|
||||
#include <QtCore/QDebug>
|
||||
#endif
|
||||
|
||||
@ -54,12 +54,12 @@
|
||||
|
||||
static const int MAGIC_ZORDER_FOR_NO_NAV = 10;
|
||||
|
||||
QBBRootWindow::QBBRootWindow(QBBScreen *screen)
|
||||
QQnxRootWindow::QQnxRootWindow(QQnxScreen *screen)
|
||||
: m_screen(screen),
|
||||
m_window(0),
|
||||
m_windowGroupName()
|
||||
{
|
||||
#if defined(QBBROOTWINDOW_DEBUG)
|
||||
#if defined(QQNXROOTWINDOW_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
// Create one top-level QNX window to act as a container for child windows
|
||||
@ -68,7 +68,7 @@ QBBRootWindow::QBBRootWindow(QBBScreen *screen)
|
||||
int result = screen_create_window(&m_window, m_screen->nativeContext());
|
||||
int val[2];
|
||||
if (result != 0) {
|
||||
qFatal("QBBRootWindow: failed to create window, errno=%d", errno);
|
||||
qFatal("QQnxRootWindow: failed to create window, errno=%d", errno);
|
||||
}
|
||||
|
||||
// Move window to proper display
|
||||
@ -76,7 +76,7 @@ QBBRootWindow::QBBRootWindow(QBBScreen *screen)
|
||||
screen_display_t display = m_screen->nativeDisplay();
|
||||
result = screen_set_window_property_pv(m_window, SCREEN_PROPERTY_DISPLAY, (void **)&display);
|
||||
if (result != 0) {
|
||||
qFatal("QBBRootWindow: failed to set window display, errno=%d", errno);
|
||||
qFatal("QQnxRootWindow: failed to set window display, errno=%d", errno);
|
||||
}
|
||||
|
||||
// Make sure window is above navigator but below keyboard if running as root
|
||||
@ -86,7 +86,7 @@ QBBRootWindow::QBBRootWindow(QBBScreen *screen)
|
||||
val[0] = MAGIC_ZORDER_FOR_NO_NAV;
|
||||
result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_ZORDER, val);
|
||||
if (result != 0) {
|
||||
qFatal("QBBRootWindow: failed to set window z-order, errno=%d", errno);
|
||||
qFatal("QQnxRootWindow: failed to set window z-order, errno=%d", errno);
|
||||
}
|
||||
}
|
||||
|
||||
@ -95,14 +95,14 @@ QBBRootWindow::QBBRootWindow(QBBScreen *screen)
|
||||
val[0] = SCREEN_USAGE_NATIVE;
|
||||
result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_USAGE, val);
|
||||
if (result != 0) {
|
||||
qFatal("QBBRootWindow: failed to set window buffer usage, errno=%d", errno);
|
||||
qFatal("QQnxRootWindow: failed to set window buffer usage, errno=%d", errno);
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
val[0] = m_screen->nativeFormat();
|
||||
result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_FORMAT, val);
|
||||
if (result != 0) {
|
||||
qFatal("QBBRootWindow: failed to set window pixel format, errno=%d", errno);
|
||||
qFatal("QQnxRootWindow: failed to set window pixel format, errno=%d", errno);
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
@ -110,13 +110,13 @@ QBBRootWindow::QBBRootWindow(QBBScreen *screen)
|
||||
val[1] = 1;
|
||||
result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_BUFFER_SIZE, val);
|
||||
if (result != 0) {
|
||||
qFatal("QBBRootWindow: failed to set window buffer size, errno=%d", errno);
|
||||
qFatal("QQnxRootWindow: failed to set window buffer size, errno=%d", errno);
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
result = screen_create_window_buffers(m_window, 1);
|
||||
if (result != 0) {
|
||||
qFatal("QBB: failed to create window buffer, errno=%d", errno);
|
||||
qFatal("QQNX: failed to create window buffer, errno=%d", errno);
|
||||
}
|
||||
|
||||
// Window is always the size of the display
|
||||
@ -126,7 +126,7 @@ QBBRootWindow::QBBRootWindow(QBBScreen *screen)
|
||||
val[1] = geometry.height();
|
||||
result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SIZE, val);
|
||||
if (result != 0) {
|
||||
qFatal("QBBRootWindow: failed to set window size, errno=%d", errno);
|
||||
qFatal("QQnxRootWindow: failed to set window size, errno=%d", errno);
|
||||
}
|
||||
|
||||
// Fill the window with solid black
|
||||
@ -134,7 +134,7 @@ QBBRootWindow::QBBRootWindow(QBBScreen *screen)
|
||||
val[0] = 0;
|
||||
result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_COLOR, val);
|
||||
if (result != 0) {
|
||||
qFatal("QBBRootWindow: failed to set window colour, errno=%d", errno);
|
||||
qFatal("QQnxRootWindow: failed to set window colour, errno=%d", errno);
|
||||
}
|
||||
|
||||
// Make the window opaque
|
||||
@ -142,7 +142,7 @@ QBBRootWindow::QBBRootWindow(QBBScreen *screen)
|
||||
val[0] = SCREEN_TRANSPARENCY_NONE;
|
||||
result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_TRANSPARENCY, val);
|
||||
if (result != 0) {
|
||||
qFatal("QBBRootWindow: failed to set window transparency, errno=%d", errno);
|
||||
qFatal("QQnxRootWindow: failed to set window transparency, errno=%d", errno);
|
||||
}
|
||||
|
||||
// Set the swap interval to 1
|
||||
@ -150,7 +150,7 @@ QBBRootWindow::QBBRootWindow(QBBScreen *screen)
|
||||
val[0] = 1;
|
||||
result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SWAP_INTERVAL, val);
|
||||
if (result != 0) {
|
||||
qFatal("QBBRootWindow: failed to set window swap interval, errno=%d", errno);
|
||||
qFatal("QQnxRootWindow: failed to set window swap interval, errno=%d", errno);
|
||||
}
|
||||
|
||||
// Set viewport size equal to window size but move outside buffer so the fill colour is used exclusively
|
||||
@ -159,7 +159,7 @@ QBBRootWindow::QBBRootWindow(QBBScreen *screen)
|
||||
val[1] = geometry.height();
|
||||
result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SOURCE_SIZE, val);
|
||||
if (result != 0) {
|
||||
qFatal("QBBRootWindow: failed to set window source size, errno=%d", errno);
|
||||
qFatal("QQnxRootWindow: failed to set window source size, errno=%d", errno);
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
@ -167,83 +167,83 @@ QBBRootWindow::QBBRootWindow(QBBScreen *screen)
|
||||
val[1] = 0;
|
||||
result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SOURCE_POSITION, val);
|
||||
if (result != 0) {
|
||||
qFatal("QBBRootWindow: failed to set window source position, errno=%d", errno);
|
||||
qFatal("QQnxRootWindow: failed to set window source position, errno=%d", errno);
|
||||
}
|
||||
|
||||
createWindowGroup();
|
||||
post();
|
||||
}
|
||||
|
||||
QBBRootWindow::~QBBRootWindow()
|
||||
QQnxRootWindow::~QQnxRootWindow()
|
||||
{
|
||||
// Cleanup top-level QNX window
|
||||
screen_destroy_window(m_window);
|
||||
}
|
||||
|
||||
void QBBRootWindow::post() const
|
||||
void QQnxRootWindow::post() const
|
||||
{
|
||||
#if defined(QBBROOTWINDOW_DEBUG)
|
||||
#if defined(QQNXROOTWINDOW_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
errno = 0;
|
||||
screen_buffer_t buffer;
|
||||
int result = screen_get_window_property_pv(m_window, SCREEN_PROPERTY_RENDER_BUFFERS, (void **)&buffer);
|
||||
if (result != 0) {
|
||||
qFatal("QBBRootWindow: failed to query window buffer, errno=%d", errno);
|
||||
qFatal("QQnxRootWindow: failed to query window buffer, errno=%d", errno);
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
int dirtyRect[] = {0, 0, 1, 1};
|
||||
result = screen_post_window(m_window, buffer, 1, dirtyRect, 0);
|
||||
if (result != 0) {
|
||||
qFatal("QBB: failed to post window buffer, errno=%d", errno);
|
||||
qFatal("QQNX: failed to post window buffer, errno=%d", errno);
|
||||
}
|
||||
}
|
||||
|
||||
void QBBRootWindow::flush() const
|
||||
void QQnxRootWindow::flush() const
|
||||
{
|
||||
#if defined(QBBROOTWINDOW_DEBUG)
|
||||
#if defined(QQNXROOTWINDOW_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
// Force immediate display update
|
||||
errno = 0;
|
||||
int result = screen_flush_context(m_screen->nativeContext(), 0);
|
||||
if (result != 0) {
|
||||
qFatal("QBBRootWindow: failed to flush context, errno=%d", errno);
|
||||
qFatal("QQnxRootWindow: failed to flush context, errno=%d", errno);
|
||||
}
|
||||
}
|
||||
|
||||
void QBBRootWindow::setRotation(int rotation)
|
||||
void QQnxRootWindow::setRotation(int rotation)
|
||||
{
|
||||
#if defined(QBBROOTWINDOW_DEBUG)
|
||||
#if defined(QQNXROOTWINDOW_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO << "angle =" << rotation;
|
||||
#endif
|
||||
errno = 0;
|
||||
int result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_ROTATION, &rotation);
|
||||
if (result != 0) {
|
||||
qFatal("QBBRootWindow: failed to set window rotation, errno=%d", errno);
|
||||
qFatal("QQnxRootWindow: failed to set window rotation, errno=%d", errno);
|
||||
}
|
||||
}
|
||||
|
||||
void QBBRootWindow::resize(const QSize &size)
|
||||
void QQnxRootWindow::resize(const QSize &size)
|
||||
{
|
||||
errno = 0;
|
||||
int val[] = {size.width(), size.height()};
|
||||
int result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SIZE, val);
|
||||
if (result != 0) {
|
||||
qFatal("QBBRootWindow: failed to set window size, errno=%d", errno);
|
||||
qFatal("QQnxRootWindow: failed to set window size, errno=%d", errno);
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SOURCE_SIZE, val);
|
||||
if (result != 0) {
|
||||
qFatal("QBBRootWindow: failed to set window source size, errno=%d", errno);
|
||||
qFatal("QQnxRootWindow: failed to set window source size, errno=%d", errno);
|
||||
}
|
||||
|
||||
// NOTE: display will update when child windows relayout and repaint
|
||||
}
|
||||
|
||||
void QBBRootWindow::createWindowGroup()
|
||||
void QQnxRootWindow::createWindowGroup()
|
||||
{
|
||||
// Generate a random window group name
|
||||
m_windowGroupName = QUuid::createUuid().toString().toAscii();
|
||||
@ -252,6 +252,6 @@ void QBBRootWindow::createWindowGroup()
|
||||
errno = 0;
|
||||
int result = screen_create_window_group(m_window, m_windowGroupName.constData());
|
||||
if (result != 0) {
|
||||
qFatal("QBBRootWindow: failed to create app window group, errno=%d", errno);
|
||||
qFatal("QQnxRootWindow: failed to create app window group, errno=%d", errno);
|
||||
}
|
||||
}
|
@ -39,8 +39,8 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QBBROOTWINDOW_H
|
||||
#define QBBROOTWINDOW_H
|
||||
#ifndef QQNXROOTWINDOW_H
|
||||
#define QQNXROOTWINDOW_H
|
||||
|
||||
#include <QtCore/QByteArray>
|
||||
#include <QtCore/QRect>
|
||||
@ -49,13 +49,13 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QBBScreen;
|
||||
class QQnxScreen;
|
||||
|
||||
class QBBRootWindow
|
||||
class QQnxRootWindow
|
||||
{
|
||||
public:
|
||||
QBBRootWindow(QBBScreen *screen);
|
||||
~QBBRootWindow();
|
||||
QQnxRootWindow(QQnxScreen *screen);
|
||||
~QQnxRootWindow();
|
||||
|
||||
screen_window_t nativeHandle() const { return m_window; }
|
||||
|
||||
@ -71,11 +71,11 @@ public:
|
||||
private:
|
||||
void createWindowGroup();
|
||||
|
||||
QBBScreen *m_screen;
|
||||
QQnxScreen *m_screen;
|
||||
screen_window_t m_window;
|
||||
QByteArray m_windowGroupName;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QBBROOTWINDOW_H
|
||||
#endif // QQNXROOTWINDOW_H
|
@ -39,9 +39,9 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qbbscreen.h"
|
||||
#include "qbbvirtualkeyboard.h"
|
||||
#include "qbbwindow.h"
|
||||
#include "qqnxscreen.h"
|
||||
#include "qqnxvirtualkeyboard.h"
|
||||
#include "qqnxwindow.h"
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QUuid>
|
||||
@ -50,10 +50,10 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QList<QPlatformScreen *> QBBScreen::ms_screens;
|
||||
QList<QBBWindow*> QBBScreen::ms_childWindows;
|
||||
QList<QPlatformScreen *> QQnxScreen::ms_screens;
|
||||
QList<QQnxWindow*> QQnxScreen::ms_childWindows;
|
||||
|
||||
QBBScreen::QBBScreen(screen_context_t screenContext, screen_display_t display, bool primaryScreen)
|
||||
QQnxScreen::QQnxScreen(screen_context_t screenContext, screen_display_t display, bool primaryScreen)
|
||||
: m_screenContext(screenContext),
|
||||
m_display(display),
|
||||
m_rootWindow(),
|
||||
@ -61,7 +61,7 @@ QBBScreen::QBBScreen(screen_context_t screenContext, screen_display_t display, b
|
||||
m_posted(false),
|
||||
m_platformContext(0)
|
||||
{
|
||||
#if defined(QBBSCREEN_DEBUG)
|
||||
#if defined(QQNXSCREEN_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
// Cache initial orientation of this display
|
||||
@ -69,7 +69,7 @@ QBBScreen::QBBScreen(screen_context_t screenContext, screen_display_t display, b
|
||||
errno = 0;
|
||||
int result = screen_get_display_property_iv(m_display, SCREEN_PROPERTY_ROTATION, &m_initialRotation);
|
||||
if (result != 0) {
|
||||
qFatal("QBBScreen: failed to query display rotation, errno=%d", errno);
|
||||
qFatal("QQnxScreen: failed to query display rotation, errno=%d", errno);
|
||||
}
|
||||
m_currentRotation = m_initialRotation;
|
||||
|
||||
@ -79,7 +79,7 @@ QBBScreen::QBBScreen(screen_context_t screenContext, screen_display_t display, b
|
||||
int val[2];
|
||||
result = screen_get_display_property_iv(m_display, SCREEN_PROPERTY_SIZE, val);
|
||||
if (result != 0) {
|
||||
qFatal("QBBScreen: failed to query display size, errno=%d", errno);
|
||||
qFatal("QQnxScreen: failed to query display size, errno=%d", errno);
|
||||
}
|
||||
|
||||
m_currentGeometry = m_initialGeometry = QRect(0, 0, val[0], val[1]);
|
||||
@ -88,7 +88,7 @@ QBBScreen::QBBScreen(screen_context_t screenContext, screen_display_t display, b
|
||||
errno = 0;
|
||||
result = screen_get_display_property_iv(m_display, SCREEN_PROPERTY_PHYSICAL_SIZE, val);
|
||||
if (result != 0) {
|
||||
qFatal("QBBScreen: failed to query display physical size, errno=%d", errno);
|
||||
qFatal("QQnxScreen: failed to query display physical size, errno=%d", errno);
|
||||
}
|
||||
|
||||
// Peg the DPI to 96 (for now) so fonts are a reasonable size. We'll want to match
|
||||
@ -104,20 +104,20 @@ QBBScreen::QBBScreen(screen_context_t screenContext, screen_display_t display, b
|
||||
|
||||
// We only create the root window if we are the primary display.
|
||||
if (primaryScreen)
|
||||
m_rootWindow = QSharedPointer<QBBRootWindow>(new QBBRootWindow(this));
|
||||
m_rootWindow = QSharedPointer<QQnxRootWindow>(new QQnxRootWindow(this));
|
||||
}
|
||||
|
||||
QBBScreen::~QBBScreen()
|
||||
QQnxScreen::~QQnxScreen()
|
||||
{
|
||||
#if defined(QBBSCREEN_DEBUG)
|
||||
#if defined(QQNXSCREEN_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* static */
|
||||
void QBBScreen::createDisplays(screen_context_t context)
|
||||
void QQnxScreen::createDisplays(screen_context_t context)
|
||||
{
|
||||
#if defined(QBBSCREEN_DEBUG)
|
||||
#if defined(QQNXSCREEN_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
// Query number of displays
|
||||
@ -125,7 +125,7 @@ void QBBScreen::createDisplays(screen_context_t context)
|
||||
int displayCount;
|
||||
int result = screen_get_context_property_iv(context, SCREEN_PROPERTY_DISPLAY_COUNT, &displayCount);
|
||||
if (result != 0) {
|
||||
qFatal("QBBScreen: failed to query display count, errno=%d", errno);
|
||||
qFatal("QQnxScreen: failed to query display count, errno=%d", errno);
|
||||
}
|
||||
|
||||
// Get all displays
|
||||
@ -133,22 +133,22 @@ void QBBScreen::createDisplays(screen_context_t context)
|
||||
screen_display_t *displays = (screen_display_t *)alloca(sizeof(screen_display_t) * displayCount);
|
||||
result = screen_get_context_property_pv(context, SCREEN_PROPERTY_DISPLAYS, (void **)displays);
|
||||
if (result != 0) {
|
||||
qFatal("QBBScreen: failed to query displays, errno=%d", errno);
|
||||
qFatal("QQnxScreen: failed to query displays, errno=%d", errno);
|
||||
}
|
||||
|
||||
for (int i=0; i<displayCount; i++) {
|
||||
#if defined(QBBSCREEN_DEBUG)
|
||||
qDebug() << "QBBScreen::Creating screen for display " << i;
|
||||
#if defined(QQNXSCREEN_DEBUG)
|
||||
qDebug() << "QQnxScreen::Creating screen for display " << i;
|
||||
#endif
|
||||
QBBScreen *screen = new QBBScreen(context, displays[i], i==0);
|
||||
QQnxScreen *screen = new QQnxScreen(context, displays[i], i==0);
|
||||
ms_screens.append(screen);
|
||||
}
|
||||
}
|
||||
|
||||
/* static */
|
||||
void QBBScreen::destroyDisplays()
|
||||
void QQnxScreen::destroyDisplays()
|
||||
{
|
||||
#if defined(QBBSCREEN_DEBUG)
|
||||
#if defined(QQNXSCREEN_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
qDeleteAll(ms_screens);
|
||||
@ -159,16 +159,16 @@ void QBBScreen::destroyDisplays()
|
||||
}
|
||||
|
||||
/* static */
|
||||
int QBBScreen::defaultDepth()
|
||||
int QQnxScreen::defaultDepth()
|
||||
{
|
||||
#if defined(QBBSCREEN_DEBUG)
|
||||
#if defined(QQNXSCREEN_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
static int defaultDepth = 0;
|
||||
if (defaultDepth == 0) {
|
||||
// check if display depth was specified in environment variable;
|
||||
// use default value if no valid value found
|
||||
defaultDepth = qgetenv("QBB_DISPLAY_DEPTH").toInt();
|
||||
defaultDepth = qgetenv("QQNX_DISPLAY_DEPTH").toInt();
|
||||
if (defaultDepth != 16 && defaultDepth != 32) {
|
||||
defaultDepth = 32;
|
||||
}
|
||||
@ -176,13 +176,13 @@ int QBBScreen::defaultDepth()
|
||||
return defaultDepth;
|
||||
}
|
||||
|
||||
QRect QBBScreen::availableGeometry() const
|
||||
QRect QQnxScreen::availableGeometry() const
|
||||
{
|
||||
#if defined(QBBSCREEN_DEBUG)
|
||||
#if defined(QQNXSCREEN_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
// available geometry = total geometry - keyboard
|
||||
int keyboardHeight = QBBVirtualKeyboard::instance().height();
|
||||
int keyboardHeight = QQnxVirtualKeyboard::instance().height();
|
||||
return QRect(m_currentGeometry.x(), m_currentGeometry.y(),
|
||||
m_currentGeometry.width(), m_currentGeometry.height() - keyboardHeight);
|
||||
}
|
||||
@ -195,9 +195,9 @@ static bool isOrthogonal(int angle1, int angle2)
|
||||
return ((angle1 - angle2) % 180) != 0;
|
||||
}
|
||||
|
||||
void QBBScreen::setRotation(int rotation)
|
||||
void QQnxScreen::setRotation(int rotation)
|
||||
{
|
||||
#if defined(QBBSCREEN_DEBUG)
|
||||
#if defined(QQNXSCREEN_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO << "orientation =" << rotation;
|
||||
#endif
|
||||
// Check if rotation changed
|
||||
@ -217,7 +217,7 @@ void QBBScreen::setRotation(int rotation)
|
||||
|
||||
// Resize root window if we've rotated 90 or 270 from previous orientation
|
||||
if (isOrthogonal(m_currentRotation, rotation)) {
|
||||
#if defined(QBBSCREEN_DEBUG)
|
||||
#if defined(QQNXSCREEN_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO << "resize, size =" << m_currentGeometry.size();
|
||||
#endif
|
||||
if (m_rootWindow)
|
||||
@ -234,9 +234,9 @@ void QBBScreen::setRotation(int rotation)
|
||||
}
|
||||
}
|
||||
|
||||
void QBBScreen::addWindow(QBBWindow *window)
|
||||
void QQnxScreen::addWindow(QQnxWindow *window)
|
||||
{
|
||||
#if defined(QBBSCREEN_DEBUG)
|
||||
#if defined(QQNXSCREEN_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO << "window =" << window;
|
||||
#endif
|
||||
|
||||
@ -244,48 +244,48 @@ void QBBScreen::addWindow(QBBWindow *window)
|
||||
return;
|
||||
|
||||
ms_childWindows.push_back(window);
|
||||
QBBScreen::updateHierarchy();
|
||||
QQnxScreen::updateHierarchy();
|
||||
}
|
||||
|
||||
void QBBScreen::removeWindow(QBBWindow *window)
|
||||
void QQnxScreen::removeWindow(QQnxWindow *window)
|
||||
{
|
||||
#if defined(QBBSCREEN_DEBUG)
|
||||
#if defined(QQNXSCREEN_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO << "window =" << window;
|
||||
#endif
|
||||
|
||||
ms_childWindows.removeAll(window);
|
||||
QBBScreen::updateHierarchy();
|
||||
QQnxScreen::updateHierarchy();
|
||||
}
|
||||
|
||||
void QBBScreen::raiseWindow(QBBWindow *window)
|
||||
void QQnxScreen::raiseWindow(QQnxWindow *window)
|
||||
{
|
||||
#if defined(QBBSCREEN_DEBUG)
|
||||
#if defined(QQNXSCREEN_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO << "window =" << window;
|
||||
#endif
|
||||
|
||||
removeWindow(window);
|
||||
ms_childWindows.push_back(window);
|
||||
QBBScreen::updateHierarchy();
|
||||
QQnxScreen::updateHierarchy();
|
||||
}
|
||||
|
||||
void QBBScreen::lowerWindow(QBBWindow *window)
|
||||
void QQnxScreen::lowerWindow(QQnxWindow *window)
|
||||
{
|
||||
#if defined(QBBSCREEN_DEBUG)
|
||||
#if defined(QQNXSCREEN_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO << "window =" << window;
|
||||
#endif
|
||||
|
||||
removeWindow(window);
|
||||
ms_childWindows.push_front(window);
|
||||
QBBScreen::updateHierarchy();
|
||||
QQnxScreen::updateHierarchy();
|
||||
}
|
||||
|
||||
void QBBScreen::updateHierarchy()
|
||||
void QQnxScreen::updateHierarchy()
|
||||
{
|
||||
#if defined(QBBSCREEN_DEBUG)
|
||||
#if defined(QQNXSCREEN_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
|
||||
QList<QBBWindow*>::iterator it;
|
||||
QList<QQnxWindow*>::iterator it;
|
||||
int topZorder = 1; // root window is z-order 0, all "top" level windows are "above" it
|
||||
|
||||
for (it = ms_childWindows.begin(); it != ms_childWindows.end(); it++)
|
||||
@ -296,9 +296,9 @@ void QBBScreen::updateHierarchy()
|
||||
screen_flush_context( primaryDisplay()->m_screenContext, 0 );
|
||||
}
|
||||
|
||||
void QBBScreen::onWindowPost(QBBWindow *window)
|
||||
void QQnxScreen::onWindowPost(QQnxWindow *window)
|
||||
{
|
||||
#if defined(QBBSCREEN_DEBUG)
|
||||
#if defined(QQNXSCREEN_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
Q_UNUSED(window)
|
@ -44,7 +44,7 @@
|
||||
|
||||
#include <QtGui/QPlatformScreen>
|
||||
|
||||
#include "qbbrootwindow.h"
|
||||
#include "qqnxrootwindow.h"
|
||||
|
||||
#include <QtCore/QByteArray>
|
||||
#include <QtCore/QScopedPointer>
|
||||
@ -53,15 +53,15 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QBBWindow;
|
||||
class QQnxWindow;
|
||||
|
||||
class QBBScreen : public QPlatformScreen
|
||||
class QQnxScreen : public QPlatformScreen
|
||||
{
|
||||
public:
|
||||
static QList<QPlatformScreen *> screens() { return ms_screens; }
|
||||
static void createDisplays(screen_context_t context);
|
||||
static void destroyDisplays();
|
||||
static QBBScreen *primaryDisplay() { return static_cast<QBBScreen*>(ms_screens.at(0)); }
|
||||
static QQnxScreen *primaryDisplay() { return static_cast<QQnxScreen*>(ms_screens.at(0)); }
|
||||
static int defaultDepth();
|
||||
|
||||
virtual QRect geometry() const { return m_currentGeometry; }
|
||||
@ -81,25 +81,25 @@ public:
|
||||
const char *windowGroupName() const { return m_rootWindow->groupName().constData(); }
|
||||
|
||||
/* Window hierarchy management */
|
||||
static void addWindow(QBBWindow *child);
|
||||
static void removeWindow(QBBWindow *child);
|
||||
static void raiseWindow(QBBWindow *window);
|
||||
static void lowerWindow(QBBWindow *window);
|
||||
static void addWindow(QQnxWindow *child);
|
||||
static void removeWindow(QQnxWindow *child);
|
||||
static void raiseWindow(QQnxWindow *window);
|
||||
static void lowerWindow(QQnxWindow *window);
|
||||
static void updateHierarchy();
|
||||
|
||||
void onWindowPost(QBBWindow *window);
|
||||
void onWindowPost(QQnxWindow *window);
|
||||
|
||||
QSharedPointer<QBBRootWindow> rootWindow() const { return m_rootWindow; }
|
||||
QSharedPointer<QQnxRootWindow> rootWindow() const { return m_rootWindow; }
|
||||
|
||||
private:
|
||||
QBBScreen(screen_context_t context, screen_display_t display, bool primaryScreen);
|
||||
virtual ~QBBScreen();
|
||||
QQnxScreen(screen_context_t context, screen_display_t display, bool primaryScreen);
|
||||
virtual ~QQnxScreen();
|
||||
|
||||
static bool orthogonal(int rotation1, int rotation2);
|
||||
|
||||
screen_context_t m_screenContext;
|
||||
screen_display_t m_display;
|
||||
QSharedPointer<QBBRootWindow> m_rootWindow;
|
||||
QSharedPointer<QQnxRootWindow> m_rootWindow;
|
||||
bool m_primaryScreen;
|
||||
bool m_posted;
|
||||
bool m_usingOpenGL;
|
||||
@ -113,7 +113,7 @@ private:
|
||||
QPlatformOpenGLContext *m_platformContext;
|
||||
|
||||
static QList<QPlatformScreen *> ms_screens;
|
||||
static QList<QBBWindow *> ms_childWindows;
|
||||
static QList<QQnxWindow *> ms_childWindows;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
@ -39,8 +39,8 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qbbvirtualkeyboard.h"
|
||||
#include "qbbscreen.h"
|
||||
#include "qqnxvirtualkeyboard.h"
|
||||
#include "qqnxscreen.h"
|
||||
|
||||
#include <QtGui/QPlatformScreen>
|
||||
#include <QtGui/QPlatformWindow>
|
||||
@ -57,15 +57,15 @@
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
const char *QBBVirtualKeyboard::ms_PPSPath = "/pps/services/input/control?wait";
|
||||
const size_t QBBVirtualKeyboard::ms_bufferSize = 2048;
|
||||
const char *QQnxVirtualKeyboard::ms_PPSPath = "/pps/services/input/control?wait";
|
||||
const size_t QQnxVirtualKeyboard::ms_bufferSize = 2048;
|
||||
|
||||
static QBBVirtualKeyboard *s_instance = 0;
|
||||
static QQnxVirtualKeyboard *s_instance = 0;
|
||||
|
||||
// Huge hack for keyboard shadow (see QNX PR 88400). Should be removed ASAP.
|
||||
#define KEYBOARD_SHADOW_HEIGHT 8
|
||||
|
||||
QBBVirtualKeyboard::QBBVirtualKeyboard() :
|
||||
QQnxVirtualKeyboard::QQnxVirtualKeyboard() :
|
||||
m_encoder(NULL),
|
||||
m_decoder(NULL),
|
||||
m_buffer(NULL),
|
||||
@ -78,16 +78,16 @@ QBBVirtualKeyboard::QBBVirtualKeyboard() :
|
||||
connect();
|
||||
}
|
||||
|
||||
QBBVirtualKeyboard::~QBBVirtualKeyboard()
|
||||
QQnxVirtualKeyboard::~QQnxVirtualKeyboard()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
/* static */
|
||||
QBBVirtualKeyboard& QBBVirtualKeyboard::instance()
|
||||
QQnxVirtualKeyboard& QQnxVirtualKeyboard::instance()
|
||||
{
|
||||
if (!s_instance) {
|
||||
s_instance = new QBBVirtualKeyboard();
|
||||
s_instance = new QQnxVirtualKeyboard();
|
||||
s_instance->start();
|
||||
}
|
||||
|
||||
@ -95,7 +95,7 @@ QBBVirtualKeyboard& QBBVirtualKeyboard::instance()
|
||||
}
|
||||
|
||||
/* static */
|
||||
void QBBVirtualKeyboard::destroy()
|
||||
void QQnxVirtualKeyboard::destroy()
|
||||
{
|
||||
if (s_instance) {
|
||||
delete s_instance;
|
||||
@ -103,7 +103,7 @@ void QBBVirtualKeyboard::destroy()
|
||||
}
|
||||
}
|
||||
|
||||
void QBBVirtualKeyboard::close()
|
||||
void QQnxVirtualKeyboard::close()
|
||||
{
|
||||
if (m_fd) {
|
||||
// any reads will fail after we close the fd, which is basically what we want.
|
||||
@ -136,7 +136,7 @@ void QBBVirtualKeyboard::close()
|
||||
m_buffer = NULL;
|
||||
}
|
||||
|
||||
bool QBBVirtualKeyboard::connect()
|
||||
bool QQnxVirtualKeyboard::connect()
|
||||
{
|
||||
close();
|
||||
|
||||
@ -150,7 +150,7 @@ bool QBBVirtualKeyboard::connect()
|
||||
m_fd = ::open(ms_PPSPath, O_RDWR);
|
||||
if (m_fd == -1)
|
||||
{
|
||||
qCritical("QBBVirtualKeyboard: Unable to open \"%s\" for keyboard: %s (%d).",
|
||||
qCritical("QQnxVirtualKeyboard: Unable to open \"%s\" for keyboard: %s (%d).",
|
||||
ms_PPSPath, strerror(errno), errno);
|
||||
close();
|
||||
return false;
|
||||
@ -158,7 +158,7 @@ bool QBBVirtualKeyboard::connect()
|
||||
|
||||
m_buffer = new char[ms_bufferSize];
|
||||
if (!m_buffer) {
|
||||
qCritical("QBBVirtualKeyboard: Unable to allocate buffer of %d bytes. Size is unavailable.", ms_bufferSize);
|
||||
qCritical("QQnxVirtualKeyboard: Unable to allocate buffer of %d bytes. Size is unavailable.", ms_bufferSize);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -170,7 +170,7 @@ bool QBBVirtualKeyboard::connect()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool QBBVirtualKeyboard::queryPPSInfo()
|
||||
bool QQnxVirtualKeyboard::queryPPSInfo()
|
||||
{
|
||||
// Request info, requires id to regenerate res message.
|
||||
pps_encoder_add_string(m_encoder, "msg", "info");
|
||||
@ -186,44 +186,44 @@ bool QBBVirtualKeyboard::queryPPSInfo()
|
||||
return true;
|
||||
}
|
||||
|
||||
void QBBVirtualKeyboard::notifyClientActiveStateChange(bool active)
|
||||
void QQnxVirtualKeyboard::notifyClientActiveStateChange(bool active)
|
||||
{
|
||||
if (!active)
|
||||
hideKeyboard();
|
||||
}
|
||||
|
||||
void QBBVirtualKeyboard::run()
|
||||
void QQnxVirtualKeyboard::run()
|
||||
{
|
||||
ppsDataReady();
|
||||
}
|
||||
|
||||
void QBBVirtualKeyboard::ppsDataReady()
|
||||
void QQnxVirtualKeyboard::ppsDataReady()
|
||||
{
|
||||
while (1) {
|
||||
ssize_t nread = read(m_fd, m_buffer, ms_bufferSize - 1);
|
||||
|
||||
#ifdef QBBVIRTUALKEYBOARD_DEBUG
|
||||
qDebug() << "QBB: keyboardMessage size: " << nread;
|
||||
#ifdef QQNXVIRTUALKEYBOARD_DEBUG
|
||||
qDebug() << "QQNX: keyboardMessage size: " << nread;
|
||||
#endif
|
||||
if (nread < 0)
|
||||
break;
|
||||
|
||||
// nread is the real space necessary, not the amount read.
|
||||
if (static_cast<size_t>(nread) > ms_bufferSize - 1) {
|
||||
qCritical("QBBVirtualKeyboard: Keyboard buffer size too short; need %u.", nread + 1);
|
||||
qCritical("QQnxVirtualKeyboard: Keyboard buffer size too short; need %u.", nread + 1);
|
||||
break;
|
||||
}
|
||||
|
||||
m_buffer[nread] = 0;
|
||||
pps_decoder_parse_pps_str(m_decoder, m_buffer);
|
||||
pps_decoder_push(m_decoder, NULL);
|
||||
#ifdef QBBVIRTUALKEYBOARD_DEBUG
|
||||
#ifdef QQNXVIRTUALKEYBOARD_DEBUG
|
||||
pps_decoder_dump_tree(m_decoder, stderr);
|
||||
#endif
|
||||
|
||||
const char *value;
|
||||
if (pps_decoder_get_string(m_decoder, "error", &value) == PPS_DECODER_OK) {
|
||||
qCritical("QBBVirtualKeyboard: Keyboard PPS decoder error: %s", value ? value : "[null]");
|
||||
qCritical("QQnxVirtualKeyboard: Keyboard PPS decoder error: %s", value ? value : "[null]");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -244,48 +244,48 @@ void QBBVirtualKeyboard::ppsDataReady()
|
||||
handleKeyboardInfoMessage();
|
||||
else if (strcmp(value, "connect") == 0) { }
|
||||
else
|
||||
qCritical("QBBVirtualKeyboard: Unexpected keyboard PPS msg value: %s", value ? value : "[null]");
|
||||
qCritical("QQnxVirtualKeyboard: Unexpected keyboard PPS msg value: %s", value ? value : "[null]");
|
||||
} else if (pps_decoder_get_string(m_decoder, "res", &value) == PPS_DECODER_OK) {
|
||||
if (strcmp(value, "info") == 0)
|
||||
handleKeyboardInfoMessage();
|
||||
else
|
||||
qCritical("QBBVirtualKeyboard: Unexpected keyboard PPS res value: %s", value ? value : "[null]");
|
||||
qCritical("QQnxVirtualKeyboard: Unexpected keyboard PPS res value: %s", value ? value : "[null]");
|
||||
} else
|
||||
qCritical("QBBVirtualKeyboard: Unexpected keyboard PPS message type");
|
||||
qCritical("QQnxVirtualKeyboard: Unexpected keyboard PPS message type");
|
||||
}
|
||||
|
||||
#ifdef QBBVIRTUALKEYBOARD_DEBUG
|
||||
qDebug() << "QBB: exiting keyboard thread";
|
||||
#ifdef QQNXVIRTUALKEYBOARD_DEBUG
|
||||
qDebug() << "QQNX: exiting keyboard thread";
|
||||
#endif
|
||||
|
||||
if (m_decoder)
|
||||
pps_decoder_cleanup(m_decoder);
|
||||
}
|
||||
|
||||
void QBBVirtualKeyboard::handleKeyboardInfoMessage()
|
||||
void QQnxVirtualKeyboard::handleKeyboardInfoMessage()
|
||||
{
|
||||
int newHeight = 0;
|
||||
const char *value;
|
||||
|
||||
if (pps_decoder_push(m_decoder, "dat") != PPS_DECODER_OK) {
|
||||
qCritical("QBBVirtualKeyboard: Keyboard PPS dat object not found");
|
||||
qCritical("QQnxVirtualKeyboard: Keyboard PPS dat object not found");
|
||||
return;
|
||||
}
|
||||
if (pps_decoder_get_int(m_decoder, "size", &newHeight) != PPS_DECODER_OK) {
|
||||
qCritical("QBBVirtualKeyboard: Keyboard PPS size field not found");
|
||||
qCritical("QQnxVirtualKeyboard: Keyboard PPS size field not found");
|
||||
return;
|
||||
}
|
||||
if (pps_decoder_push(m_decoder, "locale") != PPS_DECODER_OK) {
|
||||
qCritical("QBBVirtualKeyboard: Keyboard PPS locale object not found");
|
||||
qCritical("QQnxVirtualKeyboard: Keyboard PPS locale object not found");
|
||||
return;
|
||||
}
|
||||
if (pps_decoder_get_string(m_decoder, "languageId", &value) != PPS_DECODER_OK) {
|
||||
qCritical("QBBVirtualKeyboard: Keyboard PPS languageId field not found");
|
||||
qCritical("QQnxVirtualKeyboard: Keyboard PPS languageId field not found");
|
||||
return;
|
||||
}
|
||||
const QString languageId = QString::fromLatin1(value);
|
||||
if (pps_decoder_get_string(m_decoder, "countryId", &value) != PPS_DECODER_OK) {
|
||||
qCritical("QBBVirtualKeyboard: Keyboard PPS size countryId not found");
|
||||
qCritical("QQnxVirtualKeyboard: Keyboard PPS size countryId not found");
|
||||
return;
|
||||
}
|
||||
const QString countryId = QString::fromLatin1(value);
|
||||
@ -304,16 +304,16 @@ void QBBVirtualKeyboard::handleKeyboardInfoMessage()
|
||||
emit localeChanged(locale);
|
||||
}
|
||||
|
||||
#ifdef QBBVIRTUALKEYBOARD_DEBUG
|
||||
qDebug() << "QBB: handleKeyboardInfoMessage size=" << m_height << "locale=" << m_locale;
|
||||
#ifdef QQNXVIRTUALKEYBOARD_DEBUG
|
||||
qDebug() << "QQNX: handleKeyboardInfoMessage size=" << m_height << "locale=" << m_locale;
|
||||
#endif
|
||||
}
|
||||
|
||||
void QBBVirtualKeyboard::handleKeyboardStateChangeMessage(bool visible)
|
||||
void QQnxVirtualKeyboard::handleKeyboardStateChangeMessage(bool visible)
|
||||
{
|
||||
|
||||
#ifdef QBBVIRTUALKEYBOARD_DEBUG
|
||||
qDebug() << "QBB: handleKeyboardStateChangeMessage " << visible;
|
||||
#ifdef QQNXVIRTUALKEYBOARD_DEBUG
|
||||
qDebug() << "QQNX: handleKeyboardStateChangeMessage " << visible;
|
||||
#endif
|
||||
updateAvailableScreenGeometry();
|
||||
|
||||
@ -323,23 +323,23 @@ void QBBVirtualKeyboard::handleKeyboardStateChangeMessage(bool visible)
|
||||
hideKeyboard();
|
||||
}
|
||||
|
||||
void QBBVirtualKeyboard::updateAvailableScreenGeometry()
|
||||
void QQnxVirtualKeyboard::updateAvailableScreenGeometry()
|
||||
{
|
||||
#ifdef QBBVIRTUALKEYBOARD_DEBUG
|
||||
qDebug() << "QBB: updateAvailableScreenGeometry: keyboard visible=" << m_visible << ", keyboard height=" << m_height;
|
||||
#ifdef QQNXVIRTUALKEYBOARD_DEBUG
|
||||
qDebug() << "QQNX: updateAvailableScreenGeometry: keyboard visible=" << m_visible << ", keyboard height=" << m_height;
|
||||
#endif
|
||||
|
||||
// TODO: What screen index should be used? I assume primaryScreen here because it works, and
|
||||
// we do it for handleScreenGeometryChange elsewhere but since we have support
|
||||
// for more than one screen, that's not going to always work.
|
||||
QBBScreen *platformScreen = QBBScreen::primaryDisplay();
|
||||
QQnxScreen *platformScreen = QQnxScreen::primaryDisplay();
|
||||
QWindowSystemInterface::handleScreenAvailableGeometryChange(platformScreen->screen(), platformScreen->availableGeometry());
|
||||
}
|
||||
|
||||
bool QBBVirtualKeyboard::showKeyboard()
|
||||
bool QQnxVirtualKeyboard::showKeyboard()
|
||||
{
|
||||
#ifdef QBBVIRTUALKEYBOARD_DEBUG
|
||||
qDebug() << "QBB: showKeyboard()";
|
||||
#ifdef QQNXVIRTUALKEYBOARD_DEBUG
|
||||
qDebug() << "QQNX: showKeyboard()";
|
||||
#endif
|
||||
|
||||
// Try to connect.
|
||||
@ -367,10 +367,10 @@ bool QBBVirtualKeyboard::showKeyboard()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool QBBVirtualKeyboard::hideKeyboard()
|
||||
bool QQnxVirtualKeyboard::hideKeyboard()
|
||||
{
|
||||
#ifdef QBBVIRTUALKEYBOARD_DEBUG
|
||||
qDebug() << "QBB: hideKeyboard()";
|
||||
#ifdef QQNXVIRTUALKEYBOARD_DEBUG
|
||||
qDebug() << "QQNX: hideKeyboard()";
|
||||
#endif
|
||||
|
||||
if (m_fd == -1 && !connect())
|
||||
@ -399,12 +399,12 @@ bool QBBVirtualKeyboard::hideKeyboard()
|
||||
return true;
|
||||
}
|
||||
|
||||
void QBBVirtualKeyboard::setKeyboardMode(KeyboardMode mode)
|
||||
void QQnxVirtualKeyboard::setKeyboardMode(KeyboardMode mode)
|
||||
{
|
||||
m_keyboardMode = mode;
|
||||
}
|
||||
|
||||
void QBBVirtualKeyboard::applyKeyboardModeOptions()
|
||||
void QQnxVirtualKeyboard::applyKeyboardModeOptions()
|
||||
{
|
||||
// Try to connect.
|
||||
if (m_fd == -1 && !connect())
|
||||
@ -451,49 +451,49 @@ void QBBVirtualKeyboard::applyKeyboardModeOptions()
|
||||
pps_encoder_reset(m_encoder);
|
||||
}
|
||||
|
||||
void QBBVirtualKeyboard::addDefaultModeOptions()
|
||||
void QQnxVirtualKeyboard::addDefaultModeOptions()
|
||||
{
|
||||
pps_encoder_add_string(m_encoder, "enter", "enter.default");
|
||||
pps_encoder_add_string(m_encoder, "type", "default");
|
||||
}
|
||||
|
||||
void QBBVirtualKeyboard::addUrlModeOptions()
|
||||
void QQnxVirtualKeyboard::addUrlModeOptions()
|
||||
{
|
||||
pps_encoder_add_string(m_encoder, "enter", "enter.default");
|
||||
pps_encoder_add_string(m_encoder, "type", "url");
|
||||
}
|
||||
|
||||
void QBBVirtualKeyboard::addEmailModeOptions()
|
||||
void QQnxVirtualKeyboard::addEmailModeOptions()
|
||||
{
|
||||
pps_encoder_add_string(m_encoder, "enter", "enter.default");
|
||||
pps_encoder_add_string(m_encoder, "type", "email");
|
||||
}
|
||||
|
||||
void QBBVirtualKeyboard::addWebModeOptions()
|
||||
void QQnxVirtualKeyboard::addWebModeOptions()
|
||||
{
|
||||
pps_encoder_add_string(m_encoder, "enter", "enter.default");
|
||||
pps_encoder_add_string(m_encoder, "type", "web");
|
||||
}
|
||||
|
||||
void QBBVirtualKeyboard::addNumPuncModeOptions()
|
||||
void QQnxVirtualKeyboard::addNumPuncModeOptions()
|
||||
{
|
||||
pps_encoder_add_string(m_encoder, "enter", "enter.default");
|
||||
pps_encoder_add_string(m_encoder, "type", "numPunc");
|
||||
}
|
||||
|
||||
void QBBVirtualKeyboard::addPhoneModeOptions()
|
||||
void QQnxVirtualKeyboard::addPhoneModeOptions()
|
||||
{
|
||||
pps_encoder_add_string(m_encoder, "enter", "enter.default");
|
||||
pps_encoder_add_string(m_encoder, "type", "phone");
|
||||
}
|
||||
|
||||
void QBBVirtualKeyboard::addPinModeOptions()
|
||||
void QQnxVirtualKeyboard::addPinModeOptions()
|
||||
{
|
||||
pps_encoder_add_string(m_encoder, "enter", "enter.default");
|
||||
pps_encoder_add_string(m_encoder, "type", "pin");
|
||||
}
|
||||
|
||||
void QBBVirtualKeyboard::addSymbolModeOptions()
|
||||
void QQnxVirtualKeyboard::addSymbolModeOptions()
|
||||
{
|
||||
pps_encoder_add_string(m_encoder, "enter", "enter.default");
|
||||
pps_encoder_add_string(m_encoder, "type", "symbol");
|
@ -55,7 +55,7 @@
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
/* Shamelessly copied from the browser - this should be rewritten once we have a proper PPS wrapper class */
|
||||
class QBBVirtualKeyboard : public QThread
|
||||
class QQnxVirtualKeyboard : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@ -72,7 +72,7 @@ public:
|
||||
//
|
||||
enum KeyboardMode { Default, Url, Email, Web, NumPunc, Symbol, Phone, Pin };
|
||||
|
||||
static QBBVirtualKeyboard& instance();
|
||||
static QQnxVirtualKeyboard& instance();
|
||||
static void destroy();
|
||||
|
||||
bool showKeyboard();
|
||||
@ -88,8 +88,8 @@ Q_SIGNALS:
|
||||
void visibilityChanged(bool visible);
|
||||
|
||||
private:
|
||||
QBBVirtualKeyboard();
|
||||
virtual ~QBBVirtualKeyboard();
|
||||
QQnxVirtualKeyboard();
|
||||
virtual ~QQnxVirtualKeyboard();
|
||||
|
||||
// Will be called internally if needed.
|
||||
bool connect();
|
@ -39,10 +39,10 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qbbwindow.h"
|
||||
#include "qbbglcontext.h"
|
||||
#include "qbbintegration.h"
|
||||
#include "qbbscreen.h"
|
||||
#include "qqnxwindow.h"
|
||||
#include "qqnxglcontext.h"
|
||||
#include "qqnxintegration.h"
|
||||
#include "qqnxscreen.h"
|
||||
|
||||
#include <QtGui/QWindow>
|
||||
#include <QtGui/QWindowSystemInterface>
|
||||
@ -53,7 +53,7 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QBBWindow::QBBWindow(QWindow *window, screen_context_t context)
|
||||
QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context)
|
||||
: QPlatformWindow(window),
|
||||
m_screenContext(context),
|
||||
m_window(0),
|
||||
@ -64,7 +64,7 @@ QBBWindow::QBBWindow(QWindow *window, screen_context_t context)
|
||||
m_parentWindow(0),
|
||||
m_visible(true)
|
||||
{
|
||||
#if defined(QBBWINDOW_DEBUG)
|
||||
#if defined(QQNXWINDOW_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO << "window =" << window << ", size =" << window->size();
|
||||
#endif
|
||||
int result;
|
||||
@ -73,7 +73,7 @@ QBBWindow::QBBWindow(QWindow *window, screen_context_t context)
|
||||
errno = 0;
|
||||
result = screen_create_window_type(&m_window, m_screenContext, SCREEN_CHILD_WINDOW);
|
||||
if (result != 0) {
|
||||
qFatal("QBBWindow: failed to create window, errno=%d", errno);
|
||||
qFatal("QQnxWindow: failed to create window, errno=%d", errno);
|
||||
}
|
||||
|
||||
// Set window buffer usage based on rendering API
|
||||
@ -87,14 +87,14 @@ QBBWindow::QBBWindow(QWindow *window, screen_context_t context)
|
||||
val = SCREEN_USAGE_OPENGL_ES2;
|
||||
break;
|
||||
default:
|
||||
qFatal("QBBWindow: unsupported window API");
|
||||
qFatal("QQnxWindow: unsupported window API");
|
||||
break;
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_USAGE, &val);
|
||||
if (result != 0) {
|
||||
qFatal("QBBWindow: failed to set window buffer usage, errno=%d", errno);
|
||||
qFatal("QQnxWindow: failed to set window buffer usage, errno=%d", errno);
|
||||
}
|
||||
|
||||
// Alpha channel is always pre-multiplied if present
|
||||
@ -102,7 +102,7 @@ QBBWindow::QBBWindow(QWindow *window, screen_context_t context)
|
||||
val = SCREEN_PRE_MULTIPLIED_ALPHA;
|
||||
result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_ALPHA_MODE, &val);
|
||||
if (result != 0) {
|
||||
qFatal("QBBWindow: failed to set window alpha mode, errno=%d", errno);
|
||||
qFatal("QQnxWindow: failed to set window alpha mode, errno=%d", errno);
|
||||
}
|
||||
|
||||
// Make the window opaque
|
||||
@ -110,7 +110,7 @@ QBBWindow::QBBWindow(QWindow *window, screen_context_t context)
|
||||
val = SCREEN_TRANSPARENCY_NONE;
|
||||
result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_TRANSPARENCY, &val);
|
||||
if (result != 0) {
|
||||
qFatal("QBBWindow: failed to set window transparency, errno=%d", errno);
|
||||
qFatal("QQnxWindow: failed to set window transparency, errno=%d", errno);
|
||||
}
|
||||
|
||||
// Set the window swap interval
|
||||
@ -118,43 +118,43 @@ QBBWindow::QBBWindow(QWindow *window, screen_context_t context)
|
||||
val = 1;
|
||||
result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SWAP_INTERVAL, &val);
|
||||
if (result != 0) {
|
||||
qFatal("QBBWindow: failed to set window swap interval, errno=%d", errno);
|
||||
qFatal("QQnxWindow: failed to set window swap interval, errno=%d", errno);
|
||||
}
|
||||
|
||||
// Assign the window to the primary display (this is the default specified by screen).
|
||||
setScreen(QBBScreen::primaryDisplay());
|
||||
setScreen(QQnxScreen::primaryDisplay());
|
||||
|
||||
// Add the window to the root of the hierarchy
|
||||
QBBScreen::addWindow(this);
|
||||
QQnxScreen::addWindow(this);
|
||||
|
||||
// Add window to plugin's window mapper
|
||||
QBBIntegration::addWindow(m_window, window);
|
||||
QQnxIntegration::addWindow(m_window, window);
|
||||
}
|
||||
|
||||
QBBWindow::~QBBWindow()
|
||||
QQnxWindow::~QQnxWindow()
|
||||
{
|
||||
#if defined(QBBWINDOW_DEBUG)
|
||||
#if defined(QQNXWINDOW_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO << "window =" << window();
|
||||
#endif
|
||||
// Remove from plugin's window mapper
|
||||
QBBIntegration::removeWindow(m_window);
|
||||
QQnxIntegration::removeWindow(m_window);
|
||||
|
||||
// Remove from parent's Hierarchy.
|
||||
removeFromParent();
|
||||
QBBScreen::updateHierarchy();
|
||||
QQnxScreen::updateHierarchy();
|
||||
|
||||
// We shouldn't allow this case unless QT allows it. Does it? Or should we send the
|
||||
// handleCloseEvent on all children when this window is deleted?
|
||||
if (m_childWindows.size() > 0)
|
||||
qFatal("QBBWindow: window destroyed before children!");
|
||||
qFatal("QQnxWindow: window destroyed before children!");
|
||||
|
||||
// Cleanup QNX window and its buffers
|
||||
screen_destroy_window(m_window);
|
||||
}
|
||||
|
||||
void QBBWindow::setGeometry(const QRect &rect)
|
||||
void QQnxWindow::setGeometry(const QRect &rect)
|
||||
{
|
||||
#if defined(QBBWINDOW_DEBUG)
|
||||
#if defined(QQNXWINDOW_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO << "window =" << window() << ", (" << rect.x() << "," << rect.y() << "," << rect.width() << "," << rect.height() << ")";
|
||||
#endif
|
||||
|
||||
@ -170,7 +170,7 @@ void QBBWindow::setGeometry(const QRect &rect)
|
||||
val[1] = rect.y();
|
||||
int result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_POSITION, val);
|
||||
if (result != 0) {
|
||||
qFatal("QBBWindow: failed to set window position, errno=%d", errno);
|
||||
qFatal("QQnxWindow: failed to set window position, errno=%d", errno);
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
@ -178,14 +178,14 @@ void QBBWindow::setGeometry(const QRect &rect)
|
||||
val[1] = rect.height();
|
||||
result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SIZE, val);
|
||||
if (result != 0) {
|
||||
qFatal("QBBWindow: failed to set window size, errno=%d", errno);
|
||||
qFatal("QQnxWindow: failed to set window size, errno=%d", errno);
|
||||
}
|
||||
|
||||
// Set viewport size equal to window size
|
||||
errno = 0;
|
||||
result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SOURCE_SIZE, val);
|
||||
if (result != 0) {
|
||||
qFatal("QBBWindow: failed to set window source size, errno=%d", errno);
|
||||
qFatal("QQnxWindow: failed to set window source size, errno=%d", errno);
|
||||
}
|
||||
|
||||
// Now move all children.
|
||||
@ -194,16 +194,16 @@ void QBBWindow::setGeometry(const QRect &rect)
|
||||
offset = rect.topLeft();
|
||||
offset -= oldGeometry.topLeft();
|
||||
|
||||
QList<QBBWindow*>::iterator it;
|
||||
QList<QQnxWindow*>::iterator it;
|
||||
for (it = m_childWindows.begin(); it != m_childWindows.end(); it++) {
|
||||
(*it)->offset(offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QBBWindow::offset(const QPoint &offset)
|
||||
void QQnxWindow::offset(const QPoint &offset)
|
||||
{
|
||||
#if defined(QBBWINDOW_DEBUG)
|
||||
#if defined(QQNXWINDOW_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO << "window =" << window();
|
||||
#endif
|
||||
// Move self and then children.
|
||||
@ -220,24 +220,24 @@ void QBBWindow::offset(const QPoint &offset)
|
||||
val[1] = newGeometry.y();
|
||||
int result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_POSITION, val);
|
||||
if (result != 0) {
|
||||
qFatal("QBBWindow: failed to set window position, errno=%d", errno);
|
||||
qFatal("QQnxWindow: failed to set window position, errno=%d", errno);
|
||||
}
|
||||
|
||||
QList<QBBWindow*>::iterator it;
|
||||
QList<QQnxWindow*>::iterator it;
|
||||
for (it = m_childWindows.begin(); it != m_childWindows.end(); it++) {
|
||||
(*it)->offset(offset);
|
||||
}
|
||||
}
|
||||
|
||||
void QBBWindow::setVisible(bool visible)
|
||||
void QQnxWindow::setVisible(bool visible)
|
||||
{
|
||||
#if defined(QBBWINDOW_DEBUG)
|
||||
#if defined(QQNXWINDOW_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO << "window =" << window() << "visible =" << visible;
|
||||
#endif
|
||||
|
||||
m_visible = visible;
|
||||
|
||||
QBBWindow *root = this;
|
||||
QQnxWindow *root = this;
|
||||
while (root->m_parentWindow)
|
||||
root = root->m_parentWindow;
|
||||
|
||||
@ -246,9 +246,9 @@ void QBBWindow::setVisible(bool visible)
|
||||
window()->requestActivateWindow();
|
||||
}
|
||||
|
||||
void QBBWindow::updateVisibility(bool parentVisible)
|
||||
void QQnxWindow::updateVisibility(bool parentVisible)
|
||||
{
|
||||
#if defined(QBBWINDOW_DEBUG)
|
||||
#if defined(QQNXWINDOW_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO << "parentVisible =" << parentVisible << "window =" << window();
|
||||
#endif
|
||||
// Set window visibility
|
||||
@ -256,18 +256,18 @@ void QBBWindow::updateVisibility(bool parentVisible)
|
||||
int val = (m_visible && parentVisible) ? 1 : 0;
|
||||
int result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_VISIBLE, &val);
|
||||
if (result != 0) {
|
||||
qFatal("QBBWindow: failed to set window visibility, errno=%d", errno);
|
||||
qFatal("QQnxWindow: failed to set window visibility, errno=%d", errno);
|
||||
}
|
||||
|
||||
QList<QBBWindow *>::iterator it;
|
||||
QList<QQnxWindow *>::iterator it;
|
||||
for (it = m_childWindows.begin(); it != m_childWindows.end(); it++) {
|
||||
(*it)->updateVisibility(m_visible && parentVisible);
|
||||
}
|
||||
}
|
||||
|
||||
void QBBWindow::setOpacity(qreal level)
|
||||
void QQnxWindow::setOpacity(qreal level)
|
||||
{
|
||||
#if defined(QBBWINDOW_DEBUG)
|
||||
#if defined(QQNXWINDOW_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO << "window =" << window() << "opacity =" << level;
|
||||
#endif
|
||||
// Set window global alpha
|
||||
@ -275,16 +275,16 @@ void QBBWindow::setOpacity(qreal level)
|
||||
int val = (int)(level * 255);
|
||||
int result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_GLOBAL_ALPHA, &val);
|
||||
if (result != 0) {
|
||||
qFatal("QBBWindow: failed to set window global alpha, errno=%d", errno);
|
||||
qFatal("QQnxWindow: failed to set window global alpha, errno=%d", errno);
|
||||
}
|
||||
|
||||
// TODO: How to handle children of this window? If we change all the visibilities, then
|
||||
// the transparency will look wrong...
|
||||
}
|
||||
|
||||
void QBBWindow::setBufferSize(const QSize &size)
|
||||
void QQnxWindow::setBufferSize(const QSize &size)
|
||||
{
|
||||
#if defined(QBBWINDOW_DEBUG)
|
||||
#if defined(QQNXWINDOW_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO << "window =" << window() << "size =" << size;
|
||||
#endif
|
||||
// Set window buffer size
|
||||
@ -292,7 +292,7 @@ void QBBWindow::setBufferSize(const QSize &size)
|
||||
int val[2] = { size.width(), size.height() };
|
||||
int result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_BUFFER_SIZE, val);
|
||||
if (result != 0) {
|
||||
qFatal("QBBWindow: failed to set window buffer size, errno=%d", errno);
|
||||
qFatal("QQnxWindow: failed to set window buffer size, errno=%d", errno);
|
||||
}
|
||||
|
||||
// Create window buffers if they do not exist
|
||||
@ -308,13 +308,13 @@ void QBBWindow::setBufferSize(const QSize &size)
|
||||
errno = 0;
|
||||
result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_FORMAT, val);
|
||||
if (result != 0) {
|
||||
qFatal("QBBWindow: failed to set window pixel format, errno=%d", errno);
|
||||
qFatal("QQnxWindow: failed to set window pixel format, errno=%d", errno);
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
result = screen_create_window_buffers(m_window, MAX_BUFFER_COUNT);
|
||||
if (result != 0) {
|
||||
qFatal("QBBWindow: failed to create window buffers, errno=%d", errno);
|
||||
qFatal("QQnxWindow: failed to create window buffers, errno=%d", errno);
|
||||
}
|
||||
}
|
||||
|
||||
@ -327,9 +327,9 @@ void QBBWindow::setBufferSize(const QSize &size)
|
||||
m_scrolled = QRegion();
|
||||
}
|
||||
|
||||
QBBBuffer &QBBWindow::renderBuffer()
|
||||
QQnxBuffer &QQnxWindow::renderBuffer()
|
||||
{
|
||||
#if defined(QBBWINDOW_DEBUG)
|
||||
#if defined(QQNXWINDOW_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO << "window =" << window();
|
||||
#endif
|
||||
// Check if render buffer is invalid
|
||||
@ -339,12 +339,12 @@ QBBBuffer &QBBWindow::renderBuffer()
|
||||
screen_buffer_t buffers[MAX_BUFFER_COUNT];
|
||||
int result = screen_get_window_property_pv(m_window, SCREEN_PROPERTY_RENDER_BUFFERS, (void **)buffers);
|
||||
if (result != 0) {
|
||||
qFatal("QBBWindow: failed to query window buffers, errno=%d", errno);
|
||||
qFatal("QQnxWindow: failed to query window buffers, errno=%d", errno);
|
||||
}
|
||||
|
||||
// Wrap each buffer
|
||||
for (int i = 0; i < MAX_BUFFER_COUNT; ++i) {
|
||||
m_buffers[i] = QBBBuffer(buffers[i]);
|
||||
m_buffers[i] = QQnxBuffer(buffers[i]);
|
||||
}
|
||||
|
||||
// Use the first available render buffer
|
||||
@ -355,23 +355,23 @@ QBBBuffer &QBBWindow::renderBuffer()
|
||||
return m_buffers[m_currentBufferIndex];
|
||||
}
|
||||
|
||||
void QBBWindow::scroll(const QRegion ®ion, int dx, int dy, bool flush)
|
||||
void QQnxWindow::scroll(const QRegion ®ion, int dx, int dy, bool flush)
|
||||
{
|
||||
#if defined(QBBWINDOW_DEBUG)
|
||||
#if defined(QQNXWINDOW_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO << "window =" << window();
|
||||
#endif
|
||||
copyBack(region, dx, dy, flush);
|
||||
m_scrolled += region;
|
||||
}
|
||||
|
||||
void QBBWindow::post(const QRegion &dirty)
|
||||
void QQnxWindow::post(const QRegion &dirty)
|
||||
{
|
||||
// Check if render buffer exists and something was rendered
|
||||
if (m_currentBufferIndex != -1 && !dirty.isEmpty()) {
|
||||
#if defined(QBBWINDOW_DEBUG)
|
||||
qDebug() << "QBBWindow::post - window =" << window();
|
||||
#if defined(QQNXWINDOW_DEBUG)
|
||||
qDebug() << "QQnxWindow::post - window =" << window();
|
||||
#endif
|
||||
QBBBuffer ¤tBuffer = m_buffers[m_currentBufferIndex];
|
||||
QQnxBuffer ¤tBuffer = m_buffers[m_currentBufferIndex];
|
||||
|
||||
// Copy unmodified region from old render buffer to new render buffer;
|
||||
// required to allow partial updates
|
||||
@ -387,7 +387,7 @@ void QBBWindow::post(const QRegion &dirty)
|
||||
errno = 0;
|
||||
int result = screen_post_window(m_window, currentBuffer.nativeBuffer(), 1, dirtyRect, 0);
|
||||
if (result != 0) {
|
||||
qFatal("QBBWindow: failed to post window buffer, errno=%d", errno);
|
||||
qFatal("QQnxWindow: failed to post window buffer, errno=%d", errno);
|
||||
}
|
||||
|
||||
// Advance to next nender buffer
|
||||
@ -407,9 +407,9 @@ void QBBWindow::post(const QRegion &dirty)
|
||||
}
|
||||
}
|
||||
|
||||
void QBBWindow::setScreen(QBBScreen *platformScreen)
|
||||
void QQnxWindow::setScreen(QQnxScreen *platformScreen)
|
||||
{
|
||||
#if defined(QBBWINDOW_DEBUG)
|
||||
#if defined(QQNXWINDOW_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO << "window =" << window() << "platformScreen =" << platformScreen;
|
||||
#endif
|
||||
|
||||
@ -423,17 +423,17 @@ void QBBWindow::setScreen(QBBScreen *platformScreen)
|
||||
screen_display_t display = platformScreen->nativeDisplay();
|
||||
int result = screen_set_window_property_pv(m_window, SCREEN_PROPERTY_DISPLAY, (void **)&display);
|
||||
if (result != 0) {
|
||||
qFatal("QBBWindow: failed to set window display, errno=%d", errno);
|
||||
qFatal("QQnxWindow: failed to set window display, errno=%d", errno);
|
||||
}
|
||||
|
||||
// Add window to display's window group
|
||||
errno = 0;
|
||||
result = screen_join_window_group(m_window, platformScreen->windowGroupName());
|
||||
if (result != 0) {
|
||||
qFatal("QBBWindow: failed to join window group, errno=%d", errno);
|
||||
qFatal("QQnxWindow: failed to join window group, errno=%d", errno);
|
||||
}
|
||||
|
||||
QList<QBBWindow*>::iterator it;
|
||||
QList<QQnxWindow*>::iterator it;
|
||||
for (it = m_childWindows.begin(); it != m_childWindows.end(); it++) {
|
||||
// Only subwindows and tooltips need necessarily be moved to another display with the window.
|
||||
if ((window()->windowType() & Qt::WindowType_Mask) == Qt::SubWindow ||
|
||||
@ -441,12 +441,12 @@ void QBBWindow::setScreen(QBBScreen *platformScreen)
|
||||
(*it)->setScreen(platformScreen);
|
||||
}
|
||||
|
||||
QBBScreen::updateHierarchy();
|
||||
QQnxScreen::updateHierarchy();
|
||||
}
|
||||
|
||||
void QBBWindow::removeFromParent()
|
||||
void QQnxWindow::removeFromParent()
|
||||
{
|
||||
#if defined(QBBWINDOW_DEBUG)
|
||||
#if defined(QQNXWINDOW_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO << "window =" << window();
|
||||
#endif
|
||||
// Remove from old Hierarchy position
|
||||
@ -454,22 +454,22 @@ void QBBWindow::removeFromParent()
|
||||
if (m_parentWindow->m_childWindows.removeAll(this))
|
||||
m_parentWindow = 0;
|
||||
else
|
||||
qFatal("QBBWindow: Window Hierarchy broken; window has parent, but parent hasn't got child.");
|
||||
qFatal("QQnxWindow: Window Hierarchy broken; window has parent, but parent hasn't got child.");
|
||||
} else {
|
||||
QBBScreen::removeWindow(this);
|
||||
QQnxScreen::removeWindow(this);
|
||||
}
|
||||
}
|
||||
|
||||
void QBBWindow::setParent(const QPlatformWindow *window)
|
||||
void QQnxWindow::setParent(const QPlatformWindow *window)
|
||||
{
|
||||
#if defined(QBBWINDOW_DEBUG)
|
||||
#if defined(QQNXWINDOW_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO << "window =" << this->window() << "platformWindow =" << window;
|
||||
#endif
|
||||
// Cast away the const, we need to modify the hierarchy.
|
||||
QBBWindow *newParent = 0;
|
||||
QQnxWindow *newParent = 0;
|
||||
|
||||
if (window)
|
||||
newParent = static_cast<QBBWindow*>((QPlatformWindow *)window);
|
||||
newParent = static_cast<QQnxWindow*>((QPlatformWindow *)window);
|
||||
|
||||
if (newParent == m_parentWindow)
|
||||
return;
|
||||
@ -484,49 +484,49 @@ void QBBWindow::setParent(const QPlatformWindow *window)
|
||||
|
||||
m_parentWindow->m_childWindows.push_back(this);
|
||||
} else {
|
||||
QBBScreen::addWindow(this);
|
||||
QQnxScreen::addWindow(this);
|
||||
}
|
||||
|
||||
QBBScreen::updateHierarchy();
|
||||
QQnxScreen::updateHierarchy();
|
||||
}
|
||||
|
||||
void QBBWindow::raise()
|
||||
void QQnxWindow::raise()
|
||||
{
|
||||
#if defined(QBBWINDOW_DEBUG)
|
||||
#if defined(QQNXWINDOW_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO << "window =" << window();
|
||||
#endif
|
||||
|
||||
QBBWindow *oldParent = m_parentWindow;
|
||||
QQnxWindow *oldParent = m_parentWindow;
|
||||
if (oldParent) {
|
||||
removeFromParent();
|
||||
oldParent->m_childWindows.push_back(this);
|
||||
} else {
|
||||
QBBScreen::raiseWindow(this);
|
||||
QQnxScreen::raiseWindow(this);
|
||||
}
|
||||
|
||||
QBBScreen::updateHierarchy();
|
||||
QQnxScreen::updateHierarchy();
|
||||
}
|
||||
|
||||
void QBBWindow::lower()
|
||||
void QQnxWindow::lower()
|
||||
{
|
||||
#if defined(QBBWINDOW_DEBUG)
|
||||
#if defined(QQNXWINDOW_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO << "window =" << window();
|
||||
#endif
|
||||
|
||||
QBBWindow *oldParent = m_parentWindow;
|
||||
QQnxWindow *oldParent = m_parentWindow;
|
||||
if (oldParent) {
|
||||
removeFromParent();
|
||||
oldParent->m_childWindows.push_front(this);
|
||||
} else {
|
||||
QBBScreen::lowerWindow(this);
|
||||
QQnxScreen::lowerWindow(this);
|
||||
}
|
||||
|
||||
QBBScreen::updateHierarchy();
|
||||
QQnxScreen::updateHierarchy();
|
||||
}
|
||||
|
||||
void QBBWindow::requestActivateWindow()
|
||||
void QQnxWindow::requestActivateWindow()
|
||||
{
|
||||
#if defined(QBBWINDOW_DEBUG)
|
||||
#if defined(QQNXWINDOW_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO << "window =" << window();
|
||||
#endif
|
||||
|
||||
@ -536,9 +536,9 @@ void QBBWindow::requestActivateWindow()
|
||||
gainedFocus();
|
||||
}
|
||||
|
||||
void QBBWindow::gainedFocus()
|
||||
void QQnxWindow::gainedFocus()
|
||||
{
|
||||
#if defined(QBBWINDOW_DEBUG)
|
||||
#if defined(QQNXWINDOW_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO << "window =" << window();
|
||||
#endif
|
||||
|
||||
@ -546,31 +546,31 @@ void QBBWindow::gainedFocus()
|
||||
QWindowSystemInterface::handleWindowActivated(window());
|
||||
}
|
||||
|
||||
void QBBWindow::setPlatformOpenGLContext(QBBGLContext *platformOpenGLContext)
|
||||
void QQnxWindow::setPlatformOpenGLContext(QQnxGLContext *platformOpenGLContext)
|
||||
{
|
||||
// This function does not take ownership of the platform gl context.
|
||||
// It is owned by the frontend QOpenGLContext
|
||||
m_platformOpenGLContext = platformOpenGLContext;
|
||||
}
|
||||
|
||||
void QBBWindow::updateZorder(int &topZorder)
|
||||
void QQnxWindow::updateZorder(int &topZorder)
|
||||
{
|
||||
errno = 0;
|
||||
int result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_ZORDER, &topZorder);
|
||||
topZorder++;
|
||||
|
||||
if (result != 0)
|
||||
qFatal("QBBWindow: failed to set window z-order=%d, errno=%d, mWindow=%p", topZorder, errno, m_window);
|
||||
qFatal("QQnxWindow: failed to set window z-order=%d, errno=%d, mWindow=%p", topZorder, errno, m_window);
|
||||
|
||||
QList<QBBWindow*>::const_iterator it;
|
||||
QList<QQnxWindow*>::const_iterator it;
|
||||
|
||||
for (it = m_childWindows.begin(); it != m_childWindows.end(); it++)
|
||||
(*it)->updateZorder(topZorder);
|
||||
}
|
||||
|
||||
void QBBWindow::copyBack(const QRegion ®ion, int dx, int dy, bool flush)
|
||||
void QQnxWindow::copyBack(const QRegion ®ion, int dx, int dy, bool flush)
|
||||
{
|
||||
#if defined(QBBWINDOW_DEBUG)
|
||||
#if defined(QQNXWINDOW_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO << "window =" << window();
|
||||
#endif
|
||||
int result;
|
||||
@ -585,8 +585,8 @@ void QBBWindow::copyBack(const QRegion ®ion, int dx, int dy, bool flush)
|
||||
return;
|
||||
}
|
||||
|
||||
QBBBuffer ¤tBuffer = m_buffers[m_currentBufferIndex];
|
||||
QBBBuffer &previousBuffer = m_buffers[m_previousBufferIndex];
|
||||
QQnxBuffer ¤tBuffer = m_buffers[m_currentBufferIndex];
|
||||
QQnxBuffer &previousBuffer = m_buffers[m_previousBufferIndex];
|
||||
|
||||
// Break down region into non-overlapping rectangles
|
||||
QVector<QRect> rects = region.rects();
|
||||
@ -612,7 +612,7 @@ void QBBWindow::copyBack(const QRegion ®ion, int dx, int dy, bool flush)
|
||||
errno = 0;
|
||||
result = screen_blit(m_screenContext, currentBuffer.nativeBuffer(), previousBuffer.nativeBuffer(), attribs);
|
||||
if (result != 0) {
|
||||
qFatal("QBBWindow: failed to blit buffers, errno=%d", errno);
|
||||
qFatal("QQnxWindow: failed to blit buffers, errno=%d", errno);
|
||||
}
|
||||
}
|
||||
|
||||
@ -622,7 +622,7 @@ void QBBWindow::copyBack(const QRegion ®ion, int dx, int dy, bool flush)
|
||||
errno = 0;
|
||||
result = screen_flush_blits(m_screenContext, SCREEN_WAIT_IDLE);
|
||||
if (result != 0) {
|
||||
qFatal("QBBWindow: failed to flush blits, errno=%d", errno);
|
||||
qFatal("QQnxWindow: failed to flush blits, errno=%d", errno);
|
||||
}
|
||||
|
||||
// Buffer was modified outside the CPU
|
||||
@ -630,25 +630,25 @@ void QBBWindow::copyBack(const QRegion ®ion, int dx, int dy, bool flush)
|
||||
}
|
||||
}
|
||||
|
||||
int QBBWindow::platformWindowFormatToNativeFormat(const QSurfaceFormat &format)
|
||||
int QQnxWindow::platformWindowFormatToNativeFormat(const QSurfaceFormat &format)
|
||||
{
|
||||
#if defined(QBBWINDOW_DEBUG)
|
||||
#if defined(QQNXWINDOW_DEBUG)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
#endif
|
||||
// Extract size of colour channels from window format
|
||||
int redSize = format.redBufferSize();
|
||||
if (redSize == -1) {
|
||||
qFatal("QBBWindow: red size not defined");
|
||||
qFatal("QQnxWindow: red size not defined");
|
||||
}
|
||||
|
||||
int greenSize = format.greenBufferSize();
|
||||
if (greenSize == -1) {
|
||||
qFatal("QBBWindow: green size not defined");
|
||||
qFatal("QQnxWindow: green size not defined");
|
||||
}
|
||||
|
||||
int blueSize = format.blueBufferSize();
|
||||
if (blueSize == -1) {
|
||||
qFatal("QBBWindow: blue size not defined");
|
||||
qFatal("QQnxWindow: blue size not defined");
|
||||
}
|
||||
|
||||
// select matching native format
|
||||
@ -657,7 +657,7 @@ int QBBWindow::platformWindowFormatToNativeFormat(const QSurfaceFormat &format)
|
||||
} else if (redSize == 8 && greenSize == 8 && blueSize == 8) {
|
||||
return SCREEN_FORMAT_RGBA8888;
|
||||
} else {
|
||||
qFatal("QBBWindow: unsupported pixel format");
|
||||
qFatal("QQnxWindow: unsupported pixel format");
|
||||
return 0;
|
||||
}
|
||||
}
|
@ -39,12 +39,12 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QBBWINDOW_H
|
||||
#define QBBWINDOW_H
|
||||
#ifndef QQNXWINDOW_H
|
||||
#define QQNXWINDOW_H
|
||||
|
||||
#include <QtGui/QPlatformWindow>
|
||||
|
||||
#include "qbbbuffer.h"
|
||||
#include "qqnxbuffer.h"
|
||||
|
||||
#include <QtGui/QImage>
|
||||
|
||||
@ -57,18 +57,18 @@ QT_BEGIN_NAMESPACE
|
||||
// all surfaces double buffered
|
||||
#define MAX_BUFFER_COUNT 2
|
||||
|
||||
class QBBGLContext;
|
||||
class QBBScreen;
|
||||
class QQnxGLContext;
|
||||
class QQnxScreen;
|
||||
|
||||
class QPlatformGLContext;
|
||||
class QSurfaceFormat;
|
||||
|
||||
class QBBWindow : public QPlatformWindow
|
||||
class QQnxWindow : public QPlatformWindow
|
||||
{
|
||||
friend class QBBScreen;
|
||||
friend class QQnxScreen;
|
||||
public:
|
||||
QBBWindow(QWindow *window, screen_context_t context);
|
||||
virtual ~QBBWindow();
|
||||
QQnxWindow(QWindow *window, screen_context_t context);
|
||||
virtual ~QQnxWindow();
|
||||
|
||||
virtual void setGeometry(const QRect &rect);
|
||||
virtual void setVisible(bool visible);
|
||||
@ -81,11 +81,11 @@ public:
|
||||
QSize bufferSize() const { return m_bufferSize; }
|
||||
bool hasBuffers() const { return !m_bufferSize.isEmpty(); }
|
||||
|
||||
QBBBuffer &renderBuffer();
|
||||
QQnxBuffer &renderBuffer();
|
||||
void scroll(const QRegion ®ion, int dx, int dy, bool flush=false);
|
||||
void post(const QRegion &dirty);
|
||||
|
||||
void setScreen(QBBScreen *platformScreen);
|
||||
void setScreen(QQnxScreen *platformScreen);
|
||||
|
||||
virtual void setParent(const QPlatformWindow *window);
|
||||
virtual void raise();
|
||||
@ -94,11 +94,11 @@ public:
|
||||
|
||||
void gainedFocus();
|
||||
|
||||
QBBScreen *screen() const { return m_screen; }
|
||||
const QList<QBBWindow*>& children() const { return m_childWindows; }
|
||||
QQnxScreen *screen() const { return m_screen; }
|
||||
const QList<QQnxWindow*>& children() const { return m_childWindows; }
|
||||
|
||||
void setPlatformOpenGLContext(QBBGLContext *platformOpenGLContext);
|
||||
QBBGLContext *platformOpenGLContext() const { return m_platformOpenGLContext; }
|
||||
void setPlatformOpenGLContext(QQnxGLContext *platformOpenGLContext);
|
||||
QQnxGLContext *platformOpenGLContext() const { return m_platformOpenGLContext; }
|
||||
|
||||
private:
|
||||
void removeFromParent();
|
||||
@ -115,19 +115,19 @@ private:
|
||||
screen_context_t m_screenContext;
|
||||
screen_window_t m_window;
|
||||
QSize m_bufferSize;
|
||||
QBBBuffer m_buffers[MAX_BUFFER_COUNT];
|
||||
QQnxBuffer m_buffers[MAX_BUFFER_COUNT];
|
||||
int m_currentBufferIndex;
|
||||
int m_previousBufferIndex;
|
||||
QRegion m_previousDirty;
|
||||
QRegion m_scrolled;
|
||||
|
||||
QBBGLContext *m_platformOpenGLContext;
|
||||
QBBScreen *m_screen;
|
||||
QList<QBBWindow*> m_childWindows;
|
||||
QBBWindow *m_parentWindow;
|
||||
QQnxGLContext *m_platformOpenGLContext;
|
||||
QQnxScreen *m_screen;
|
||||
QList<QQnxWindow*> m_childWindows;
|
||||
QQnxWindow *m_parentWindow;
|
||||
bool m_visible;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QBBWINDOW_H
|
||||
#endif // QQNXWINDOW_H
|
Loading…
Reference in New Issue
Block a user