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:
Sean Harmer 2012-03-09 17:21:22 +00:00 committed by Qt by Nokia
parent 61692bfefe
commit 9a81e37107
33 changed files with 933 additions and 933 deletions

View File

@ -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

View File

@ -13,5 +13,5 @@ mac {
win32: SUBDIRS += windows win32: SUBDIRS += windows
qnx-*-qcc { qnx-*-qcc {
SUBDIRS += blackberry SUBDIRS += qnx
} }

View File

@ -40,33 +40,33 @@
****************************************************************************/ ****************************************************************************/
#include <QtGui/QPlatformIntegrationPlugin> #include <QtGui/QPlatformIntegrationPlugin>
#include "qbbintegration.h" #include "qqnxintegration.h"
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QBBIntegrationPlugin : public QPlatformIntegrationPlugin class QQnxIntegrationPlugin : public QPlatformIntegrationPlugin
{ {
public: public:
QStringList keys() const; QStringList keys() const;
QPlatformIntegration *create(const QString&, const QStringList&); QPlatformIntegration *create(const QString&, const QStringList&);
}; };
QStringList QBBIntegrationPlugin::keys() const QStringList QQnxIntegrationPlugin::keys() const
{ {
QStringList list; QStringList list;
list << QLatin1String("blackberry"); list << QLatin1String("qnx");
return list; return list;
} }
QPlatformIntegration *QBBIntegrationPlugin::create(const QString& system, const QStringList& paramList) QPlatformIntegration *QQnxIntegrationPlugin::create(const QString& system, const QStringList& paramList)
{ {
Q_UNUSED(paramList); Q_UNUSED(paramList);
if (system.toLower() == QLatin1String("blackberry")) if (system.toLower() == QLatin1String("qnx"))
return new QBBIntegration; return new QQnxIntegration;
return 0; return 0;
} }
Q_EXPORT_PLUGIN2(blackberry, QBBIntegrationPlugin) Q_EXPORT_PLUGIN2(qnx, QQnxIntegrationPlugin)
QT_END_NAMESPACE QT_END_NAMESPACE

View 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

View File

@ -39,7 +39,7 @@
** **
****************************************************************************/ ****************************************************************************/
#include "qbbbuffer.h" #include "qqnxbuffer.h"
#include <QtCore/QDebug> #include <QtCore/QDebug>
@ -48,19 +48,19 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
QBBBuffer::QBBBuffer() QQnxBuffer::QQnxBuffer()
: m_buffer(0) : m_buffer(0)
{ {
#if defined(QBBBUFFER_DEBUG) #if defined(QQNXBUFFER_DEBUG)
qDebug() << "QBBBuffer::QBBBuffer - empty"; qDebug() << "QQnxBuffer::QQnxBuffer - empty";
#endif #endif
} }
QBBBuffer::QBBBuffer(screen_buffer_t buffer) QQnxBuffer::QQnxBuffer(screen_buffer_t buffer)
: m_buffer(buffer) : m_buffer(buffer)
{ {
#if defined(QBBBUFFER_DEBUG) #if defined(QQNXBUFFER_DEBUG)
qDebug() << "QBBBuffer::QBBBuffer - normal"; qDebug() << "QQnxBuffer::QQnxBuffer - normal";
#endif #endif
// Get size of buffer // Get size of buffer
@ -68,7 +68,7 @@ QBBBuffer::QBBBuffer(screen_buffer_t buffer)
int size[2]; int size[2];
int result = screen_get_buffer_property_iv(buffer, SCREEN_PROPERTY_BUFFER_SIZE, size); int result = screen_get_buffer_property_iv(buffer, SCREEN_PROPERTY_BUFFER_SIZE, size);
if (result != 0) { 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 // Get stride of buffer
@ -76,7 +76,7 @@ QBBBuffer::QBBBuffer(screen_buffer_t buffer)
int stride; int stride;
result = screen_get_buffer_property_iv(buffer, SCREEN_PROPERTY_STRIDE, &stride); result = screen_get_buffer_property_iv(buffer, SCREEN_PROPERTY_STRIDE, &stride);
if (result != 0) { 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 // Get access to buffer's data
@ -84,10 +84,10 @@ QBBBuffer::QBBBuffer(screen_buffer_t buffer)
uchar *dataPtr = 0; uchar *dataPtr = 0;
result = screen_get_buffer_property_pv(buffer, SCREEN_PROPERTY_POINTER, (void **)&dataPtr); result = screen_get_buffer_property_pv(buffer, SCREEN_PROPERTY_POINTER, (void **)&dataPtr);
if (result != 0) { 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) { 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 // Get format of buffer
@ -95,7 +95,7 @@ QBBBuffer::QBBBuffer(screen_buffer_t buffer)
int screenFormat; int screenFormat;
result = screen_get_buffer_property_iv(buffer, SCREEN_PROPERTY_FORMAT, &screenFormat); result = screen_get_buffer_property_iv(buffer, SCREEN_PROPERTY_FORMAT, &screenFormat);
if (result != 0) { 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 // Convert screen format to QImage format
@ -120,45 +120,45 @@ QBBBuffer::QBBBuffer(screen_buffer_t buffer)
imageFormat = QImage::Format_ARGB32_Premultiplied; imageFormat = QImage::Format_ARGB32_Premultiplied;
break; break;
default: default:
qFatal("QBB: unsupported buffer format, format=%d", screenFormat); qFatal("QQNX: unsupported buffer format, format=%d", screenFormat);
} }
// wrap buffer in an image // wrap buffer in an image
m_image = QImage(dataPtr, size[0], size[1], stride, imageFormat); 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_buffer(other.m_buffer),
m_image(other.m_image) m_image(other.m_image)
{ {
#if defined(QBBBUFFER_DEBUG) #if defined(QQNXBUFFER_DEBUG)
qDebug() << "QBBBuffer::QBBBuffer - copy"; qDebug() << "QQnxBuffer::QQnxBuffer - copy";
#endif #endif
} }
QBBBuffer::~QBBBuffer() QQnxBuffer::~QQnxBuffer()
{ {
#if defined(QBBBUFFER_DEBUG) #if defined(QQNXBUFFER_DEBUG)
qDebug() << "QBBBuffer::~QBBBuffer"; qDebug() << "QQnxBuffer::~QQnxBuffer";
#endif #endif
} }
void QBBBuffer::invalidateInCache() void QQnxBuffer::invalidateInCache()
{ {
#if defined(QBBBUFFER_DEBUG) #if defined(QQNXBUFFER_DEBUG)
qDebug() << "QBBBuffer::invalidateInCache"; qDebug() << "QQnxBuffer::invalidateInCache";
#endif #endif
// Verify native buffer exists // Verify native buffer exists
if (m_buffer == 0) { 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 // Evict buffer's data from cache
errno = 0; errno = 0;
int result = msync(m_image.bits(), m_image.height() * m_image.bytesPerLine(), MS_INVALIDATE | MS_CACHE_ONLY); int result = msync(m_image.bits(), m_image.height() * m_image.bytesPerLine(), MS_INVALIDATE | MS_CACHE_ONLY);
if (result != 0) { if (result != 0) {
qFatal("QBB: failed to invalidate cache, errno=%d", errno); qFatal("QQNX: failed to invalidate cache, errno=%d", errno);
} }
} }

View File

@ -39,8 +39,8 @@
** **
****************************************************************************/ ****************************************************************************/
#ifndef QBBBUFFER_H #ifndef QQNXBUFFER_H
#define QBBBUFFER_H #define QQNXBUFFER_H
#include <QtGui/QImage> #include <QtGui/QImage>
@ -48,13 +48,13 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QBBBuffer class QQnxBuffer
{ {
public: public:
QBBBuffer(); QQnxBuffer();
QBBBuffer(screen_buffer_t buffer); QQnxBuffer(screen_buffer_t buffer);
QBBBuffer(const QBBBuffer &other); QQnxBuffer(const QQnxBuffer &other);
virtual ~QBBBuffer(); virtual ~QQnxBuffer();
screen_buffer_t nativeBuffer() const { return m_buffer; } screen_buffer_t nativeBuffer() const { return m_buffer; }
const QImage *image() const { return (m_buffer != NULL) ? &m_image : NULL; } const QImage *image() const { return (m_buffer != NULL) ? &m_image : NULL; }
@ -71,4 +71,4 @@ private:
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QBBBUFFER_H #endif // QQNXBUFFER_H

View File

@ -41,7 +41,7 @@
#ifndef QT_NO_CLIPBOARD #ifndef QT_NO_CLIPBOARD
#include "qbbclipboard.h" #include "qqnxclipboard.h"
#include <QtGui/QColor> #include <QtGui/QColor>
@ -73,11 +73,11 @@ static QByteArray readClipboardBuff(const char *type)
return QByteArray(); return QByteArray();
} }
class QBBClipboard::MimeData : public QMimeData class QQnxClipboard::MimeData : public QMimeData
{ {
Q_OBJECT Q_OBJECT
public: public:
MimeData(QBBClipboard *clipboard) MimeData(QQnxClipboard *clipboard)
: QMimeData(), : QMimeData(),
m_clipboard(clipboard), m_clipboard(clipboard),
m_userMimeData(0) m_userMimeData(0)
@ -97,7 +97,7 @@ public:
void addFormatToCheck(const QString &format) { void addFormatToCheck(const QString &format) {
m_formatsToCheck << format; m_formatsToCheck << format;
#if defined(QBBCLIPBOARD_DEBUG) #if defined(QQNXCLIPBOARD_DEBUG)
qDebug() << Q_FUNC_INFO << "formats=" << m_formatsToCheck; qDebug() << Q_FUNC_INFO << "formats=" << m_formatsToCheck;
#endif #endif
} }
@ -105,7 +105,7 @@ public:
bool hasFormat(const QString &mimetype) const bool hasFormat(const QString &mimetype) const
{ {
const bool result = is_clipboard_format_present(mimetype.toUtf8().constData()) == 0; 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; qDebug() << Q_FUNC_INFO << "mimetype=" << mimetype << "result=" << result;
#endif #endif
return result; return result;
@ -120,7 +120,7 @@ public:
result << format; result << format;
} }
#if defined(QBBCLIPBOARD_DEBUG) #if defined(QQNXCLIPBOARD_DEBUG)
qDebug() << Q_FUNC_INFO << "result=" << result; qDebug() << Q_FUNC_INFO << "result=" << result;
#endif #endif
return result; return result;
@ -146,7 +146,7 @@ public:
protected: protected:
QVariant retrieveData(const QString &mimetype, QVariant::Type preferredType) const 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; qDebug() << Q_FUNC_INFO << "mimetype=" << mimetype << "preferredType=" << preferredType;
#endif #endif
if (is_clipboard_format_present(mimetype.toUtf8().constData()) != 0) if (is_clipboard_format_present(mimetype.toUtf8().constData()) != 0)
@ -160,7 +160,7 @@ private Q_SLOTS:
void releaseOwnership() void releaseOwnership()
{ {
if (m_userMimeData) { if (m_userMimeData) {
#if defined(QBBCLIPBOARD_DEBUG) #if defined(QQNXCLIPBOARD_DEBUG)
qDebug() << Q_FUNC_INFO << "user data formats=" << m_userMimeData->formats() << "system formats=" << formats(); qDebug() << Q_FUNC_INFO << "user data formats=" << m_userMimeData->formats() << "system formats=" << formats();
#endif #endif
delete m_userMimeData; delete m_userMimeData;
@ -170,23 +170,23 @@ private Q_SLOTS:
} }
private: private:
QBBClipboard * const m_clipboard; QQnxClipboard * const m_clipboard;
QSet<QString> m_formatsToCheck; QSet<QString> m_formatsToCheck;
QMimeData *m_userMimeData; QMimeData *m_userMimeData;
}; };
QBBClipboard::QBBClipboard() QQnxClipboard::QQnxClipboard()
: m_mimeData(new MimeData(this)) : m_mimeData(new MimeData(this))
{ {
} }
QBBClipboard::~QBBClipboard() QQnxClipboard::~QQnxClipboard()
{ {
delete m_mimeData; delete m_mimeData;
} }
void QBBClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) void QQnxClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode)
{ {
if (mode != QClipboard::Clipboard) if (mode != QClipboard::Clipboard)
return; return;
@ -203,7 +203,7 @@ void QBBClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode)
return; return;
const QStringList formats = data->formats(); const QStringList formats = data->formats();
#if defined(QBBCLIPBOARD_DEBUG) #if defined(QQNXCLIPBOARD_DEBUG)
qDebug() << Q_FUNC_INFO << "formats=" << formats; qDebug() << Q_FUNC_INFO << "formats=" << formats;
#endif #endif
@ -214,8 +214,8 @@ void QBBClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode)
continue; continue;
int ret = set_clipboard_data(format.toUtf8().data(), buf.size(), buf.data()); int ret = set_clipboard_data(format.toUtf8().data(), buf.size(), buf.data());
#if defined(QBBCLIPBOARD_DEBUG) #if defined(QQNXCLIPBOARD_DEBUG)
qDebug() << "QBB: set " << format << "to clipboard, size=" << buf.size() << ";ret=" << ret; qDebug() << "QQNX: set " << format << "to clipboard, size=" << buf.size() << ";ret=" << ret;
#endif #endif
if (ret) if (ret)
m_mimeData->addFormatToCheck(format); m_mimeData->addFormatToCheck(format);
@ -224,7 +224,7 @@ void QBBClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode)
emitChanged(QClipboard::Clipboard); emitChanged(QClipboard::Clipboard);
} }
QMimeData *QBBClipboard::mimeData(QClipboard::Mode mode) QMimeData *QQnxClipboard::mimeData(QClipboard::Mode mode)
{ {
if (mode != QClipboard::Clipboard) if (mode != QClipboard::Clipboard)
return 0; return 0;
@ -239,6 +239,6 @@ QMimeData *QBBClipboard::mimeData(QClipboard::Mode mode)
QT_END_NAMESPACE QT_END_NAMESPACE
#include "qbbclipboard.moc" #include "qqnxclipboard.moc"
#endif //QT_NO_CLIPBOARD #endif //QT_NO_CLIPBOARD

View File

@ -39,19 +39,19 @@
** **
****************************************************************************/ ****************************************************************************/
#ifndef QBBCLIPBOARD_H #ifndef QQNXCLIPBOARD_H
#define QBBCLIPBOARD_H #define QQNXCLIPBOARD_H
#ifndef QT_NO_CLIPBOARD #ifndef QT_NO_CLIPBOARD
#include <QtGui/QPlatformClipboard> #include <QtGui/QPlatformClipboard>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QBBClipboard : public QPlatformClipboard class QQnxClipboard : public QPlatformClipboard
{ {
public: public:
QBBClipboard(); QQnxClipboard();
virtual ~QBBClipboard(); virtual ~QQnxClipboard();
virtual QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard); virtual QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard);
virtual void setMimeData(QMimeData *data, QClipboard::Mode mode = QClipboard::Clipboard); virtual void setMimeData(QMimeData *data, QClipboard::Mode mode = QClipboard::Clipboard);
@ -63,4 +63,4 @@ private:
QT_END_NAMESPACE QT_END_NAMESPACE
#endif //QT_NO_CLIPBOARD #endif //QT_NO_CLIPBOARD
#endif //QBBCLIPBOARD_H #endif //QQNXCLIPBOARD_H

View File

@ -39,14 +39,14 @@
** **
****************************************************************************/ ****************************************************************************/
#include "qbbeventthread.h" #include "qqnxeventthread.h"
#include "qbbintegration.h" #include "qqnxintegration.h"
#include "qbbkeytranslator.h" #include "qqnxkeytranslator.h"
#if defined(QBB_IMF) #if defined(QQNX_IMF)
#include "qbbinputcontext_imf.h" #include "qqnxinputcontext_imf.h"
#else #else
#include "qbbinputcontext_noimf.h" #include "qqnxinputcontext_noimf.h"
#endif #endif
#include <QtGui/QWindow> #include <QtGui/QWindow>
@ -61,7 +61,7 @@
#include <cctype> #include <cctype>
QBBEventThread::QBBEventThread(screen_context_t context, QPlatformScreen& screen) QQnxEventThread::QQnxEventThread(screen_context_t context, QPlatformScreen& screen)
: QThread(), : QThread(),
m_screenContext(context), m_screenContext(context),
m_platformScreen(screen), m_platformScreen(screen),
@ -89,13 +89,13 @@ QBBEventThread::QBBEventThread(screen_context_t context, QPlatformScreen& screen
} }
} }
QBBEventThread::~QBBEventThread() QQnxEventThread::~QQnxEventThread()
{ {
// block until thread terminates // block until thread terminates
shutdown(); shutdown();
} }
void QBBEventThread::run() void QQnxEventThread::run()
{ {
screen_event_t event; screen_event_t event;
@ -103,11 +103,11 @@ void QBBEventThread::run()
errno = 0; errno = 0;
int result = screen_create_event(&event); int result = screen_create_event(&event);
if (result) { if (result) {
qFatal("QBB: failed to create event, errno=%d", errno); qFatal("QQNX: failed to create event, errno=%d", errno);
} }
#if defined(QBBEVENTTHREAD_DEBUG) #if defined(QQNXEVENTTHREAD_DEBUG)
qDebug() << "QBB: event loop started"; qDebug() << "QQNX: event loop started";
#endif #endif
// loop indefinitely // loop indefinitely
@ -117,22 +117,22 @@ void QBBEventThread::run()
errno = 0; errno = 0;
result = screen_get_event(m_screenContext, event, -1); result = screen_get_event(m_screenContext, event, -1);
if (result) { if (result) {
qFatal("QBB: failed to get event, errno=%d", errno); qFatal("QQNX: failed to get event, errno=%d", errno);
} }
// process received event // process received event
dispatchEvent(event); dispatchEvent(event);
} }
#if defined(QBBEVENTTHREAD_DEBUG) #if defined(QQNXEVENTTHREAD_DEBUG)
qDebug() << "QBB: event loop stopped"; qDebug() << "QQNX: event loop stopped";
#endif #endif
// cleanup // cleanup
screen_destroy_event(event); screen_destroy_event(event);
} }
void QBBEventThread::shutdown() void QQnxEventThread::shutdown()
{ {
screen_event_t event; screen_event_t event;
@ -140,7 +140,7 @@ void QBBEventThread::shutdown()
errno = 0; errno = 0;
int result = screen_create_event(&event); int result = screen_create_event(&event);
if (result) { 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 // set the event type as user
@ -148,7 +148,7 @@ void QBBEventThread::shutdown()
int type = SCREEN_EVENT_USER; int type = SCREEN_EVENT_USER;
result = screen_set_event_property_iv(event, SCREEN_PROPERTY_TYPE, &type); result = screen_set_event_property_iv(event, SCREEN_PROPERTY_TYPE, &type);
if (result) { 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 // NOTE: ignore SCREEN_PROPERTY_USER_DATA; treat all user events as shutdown events
@ -157,32 +157,32 @@ void QBBEventThread::shutdown()
errno = 0; errno = 0;
result = screen_send_event(m_screenContext, event, getpid()); result = screen_send_event(m_screenContext, event, getpid());
if (result) { if (result) {
qFatal("QBB: failed to set event type, errno=%d", errno); qFatal("QQNX: failed to set event type, errno=%d", errno);
} }
// cleanup // cleanup
screen_destroy_event(event); screen_destroy_event(event);
#if defined(QBBEVENTTHREAD_DEBUG) #if defined(QQNXEVENTTHREAD_DEBUG)
qDebug() << "QBB: event loop shutdown begin"; qDebug() << "QQNX: event loop shutdown begin";
#endif #endif
// block until thread terminates // block until thread terminates
wait(); wait();
#if defined(QBBEVENTTHREAD_DEBUG) #if defined(QQNXEVENTTHREAD_DEBUG)
qDebug() << "QBB: event loop shutdown end"; qDebug() << "QQNX: event loop shutdown end";
#endif #endif
} }
void QBBEventThread::dispatchEvent(screen_event_t event) void QQnxEventThread::dispatchEvent(screen_event_t event)
{ {
// get the event type // get the event type
errno = 0; errno = 0;
int qnxType; int qnxType;
int result = screen_get_event_property_iv(event, SCREEN_PROPERTY_TYPE, &qnxType); int result = screen_get_event_property_iv(event, SCREEN_PROPERTY_TYPE, &qnxType);
if (result) { if (result) {
qFatal("QBB: failed to query event type, errno=%d", errno); qFatal("QQNX: failed to query event type, errno=%d", errno);
} }
switch (qnxType) { switch (qnxType) {
@ -206,29 +206,29 @@ void QBBEventThread::dispatchEvent(screen_event_t event)
case SCREEN_EVENT_USER: case SCREEN_EVENT_USER:
// treat all user events as shutdown requests // treat all user events as shutdown requests
#if defined(QBBEVENTTHREAD_DEBUG) #if defined(QQNXEVENTTHREAD_DEBUG)
qDebug() << "QBB: QNX user event"; qDebug() << "QQNX: QNX user event";
#endif #endif
m_quit = true; m_quit = true;
break; break;
default: default:
// event ignored // event ignored
#if defined(QBBEVENTTHREAD_DEBUG) #if defined(QQNXEVENTTHREAD_DEBUG)
qDebug() << "QBB: QNX unknown event"; qDebug() << "QQNX: QNX unknown event";
#endif #endif
break; break;
} }
} }
void QBBEventThread::handleKeyboardEvent(screen_event_t event) void QQnxEventThread::handleKeyboardEvent(screen_event_t event)
{ {
// get flags of key event // get flags of key event
errno = 0; errno = 0;
int flags; int flags;
int result = screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_FLAGS, &flags); int result = screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_FLAGS, &flags);
if (result) { 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 // get key code
@ -236,31 +236,31 @@ void QBBEventThread::handleKeyboardEvent(screen_event_t event)
int sym; int sym;
result = screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_SYM, &sym); result = screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_SYM, &sym);
if (result) { if (result) {
qFatal("QBB: failed to query event sym, errno=%d", errno); qFatal("QQNX: failed to query event sym, errno=%d", errno);
} }
int modifiers; int modifiers;
result = screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_MODIFIERS, &modifiers); result = screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_MODIFIERS, &modifiers);
if (result) { if (result) {
qFatal("QBB: failed to query event modifiers, errno=%d", errno); qFatal("QQNX: failed to query event modifiers, errno=%d", errno);
} }
int scan; int scan;
result = screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_SCAN, &scan); result = screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_SCAN, &scan);
if (result) { if (result) {
qFatal("QBB: failed to query event modifiers, errno=%d", errno); qFatal("QQNX: failed to query event modifiers, errno=%d", errno);
} }
int cap; int cap;
result = screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_CAP, &cap); result = screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_CAP, &cap);
if (result) { 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); 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); 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); QWindowSystemInterface::handleKeyEvent(QGuiApplication::focusWindow(), type, key, qtMod, keyStr);
#if defined(QBBEVENTTHREAD_DEBUG) #if defined(QQNXEVENTTHREAD_DEBUG)
qDebug() << "QBB: Qt key t=" << type << ", k=" << key << ", s=" << keyStr; qDebug() << "QQNX: Qt key t=" << type << ", k=" << key << ", s=" << keyStr;
#endif #endif
} }
} }
void QBBEventThread::handlePointerEvent(screen_event_t event) void QQnxEventThread::handlePointerEvent(screen_event_t event)
{ {
errno = 0; errno = 0;
@ -315,7 +315,7 @@ void QBBEventThread::handlePointerEvent(screen_event_t event)
void *handle; void *handle;
int result = screen_get_event_property_pv(event, SCREEN_PROPERTY_WINDOW, &handle); int result = screen_get_event_property_pv(event, SCREEN_PROPERTY_WINDOW, &handle);
if (result) { 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); qnxWindow = static_cast<screen_window_t>(handle);
@ -323,48 +323,48 @@ void QBBEventThread::handlePointerEvent(screen_event_t event)
int buttonState = 0; int buttonState = 0;
result = screen_get_event_property_iv(event, SCREEN_PROPERTY_BUTTONS, &buttonState); result = screen_get_event_property_iv(event, SCREEN_PROPERTY_BUTTONS, &buttonState);
if (result) { 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 // Query the window position
int windowPos[2]; int windowPos[2];
result = screen_get_event_property_iv(event, SCREEN_PROPERTY_SOURCE_POSITION, windowPos); result = screen_get_event_property_iv(event, SCREEN_PROPERTY_SOURCE_POSITION, windowPos);
if (result) { 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 // Query the screen position
int pos[2]; int pos[2];
result = screen_get_event_property_iv(event, SCREEN_PROPERTY_POSITION, pos); result = screen_get_event_property_iv(event, SCREEN_PROPERTY_POSITION, pos);
if (result) { 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 // Query the wheel delta
int wheelDelta = 0; int wheelDelta = 0;
result = screen_get_event_property_iv(event, SCREEN_PROPERTY_MOUSE_WHEEL, &wheelDelta); result = screen_get_event_property_iv(event, SCREEN_PROPERTY_MOUSE_WHEEL, &wheelDelta);
if (result) { 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 // Map window handle to top-level QWindow
QWindow *w = QBBIntegration::window(qnxWindow); QWindow *w = QQnxIntegration::window(qnxWindow);
// Generate enter and leave events as needed. // Generate enter and leave events as needed.
if (qnxWindow != m_lastMouseWindow) { if (qnxWindow != m_lastMouseWindow) {
QWindow *wOld = QBBIntegration::window(m_lastMouseWindow); QWindow *wOld = QQnxIntegration::window(m_lastMouseWindow);
if (wOld) { if (wOld) {
QWindowSystemInterface::handleLeaveEvent(wOld); QWindowSystemInterface::handleLeaveEvent(wOld);
#if defined(QBBEVENTTHREAD_DEBUG) #if defined(QQNXEVENTTHREAD_DEBUG)
qDebug() << "QBB: Qt leave, w=" << wOld; qDebug() << "QQNX: Qt leave, w=" << wOld;
#endif #endif
} }
if (w) { if (w) {
QWindowSystemInterface::handleEnterEvent(w); QWindowSystemInterface::handleEnterEvent(w);
#if defined(QBBEVENTTHREAD_DEBUG) #if defined(QQNXEVENTTHREAD_DEBUG)
qDebug() << "QBB: Qt enter, w=" << w; qDebug() << "QQNX: Qt enter, w=" << w;
#endif #endif
} }
} }
@ -407,8 +407,8 @@ void QBBEventThread::handlePointerEvent(screen_event_t event)
m_lastLocalMousePoint != localPoint || m_lastLocalMousePoint != localPoint ||
m_lastButtonState != buttons) { m_lastButtonState != buttons) {
QWindowSystemInterface::handleMouseEvent(w, localPoint, globalPoint, buttons); QWindowSystemInterface::handleMouseEvent(w, localPoint, globalPoint, buttons);
#if defined(QBBEVENTTHREAD_DEBUG) #if defined(QQNXEVENTTHREAD_DEBUG)
qDebug() << "QBB: Qt mouse, w=" << w << ", (" << localPoint.x() << "," << localPoint.y() << "), b=" << static_cast<int>(buttons); qDebug() << "QQNX: Qt mouse, w=" << w << ", (" << localPoint.x() << "," << localPoint.y() << "), b=" << static_cast<int>(buttons);
#endif #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 // Screen only supports a single wheel, so we will assume Vertical orientation for
// now since that is pretty much standard. // now since that is pretty much standard.
QWindowSystemInterface::handleWheelEvent(w, localPoint, globalPoint, wheelDelta, Qt::Vertical); QWindowSystemInterface::handleWheelEvent(w, localPoint, globalPoint, wheelDelta, Qt::Vertical);
#if defined(QBBEVENTTHREAD_DEBUG) #if defined(QQNXEVENTTHREAD_DEBUG)
qDebug() << "QBB: Qt wheel, w=" << w << ", (" << localPoint.x() << "," << localPoint.y() << "), d=" << static_cast<int>(wheelDelta); qDebug() << "QQNX: Qt wheel, w=" << w << ", (" << localPoint.x() << "," << localPoint.y() << "), d=" << static_cast<int>(wheelDelta);
#endif #endif
} }
} }
@ -427,14 +427,14 @@ void QBBEventThread::handlePointerEvent(screen_event_t event)
m_lastButtonState = buttons; 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 // get display coordinates of touch
errno = 0; errno = 0;
int pos[2]; int pos[2];
int result = screen_get_event_property_iv(event, SCREEN_PROPERTY_POSITION, pos); int result = screen_get_event_property_iv(event, SCREEN_PROPERTY_POSITION, pos);
if (result) { 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 // get window coordinates of touch
@ -442,7 +442,7 @@ void QBBEventThread::handleTouchEvent(screen_event_t event, int qnxType)
int windowPos[2]; int windowPos[2];
result = screen_get_event_property_iv(event, SCREEN_PROPERTY_SOURCE_POSITION, windowPos); result = screen_get_event_property_iv(event, SCREEN_PROPERTY_SOURCE_POSITION, windowPos);
if (result) { 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 // determine which finger touched
@ -450,7 +450,7 @@ void QBBEventThread::handleTouchEvent(screen_event_t event, int qnxType)
int touchId; int touchId;
result = screen_get_event_property_iv(event, SCREEN_PROPERTY_TOUCH_ID, &touchId); result = screen_get_event_property_iv(event, SCREEN_PROPERTY_TOUCH_ID, &touchId);
if (result) { 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 // determine which window was touched
@ -458,7 +458,7 @@ void QBBEventThread::handleTouchEvent(screen_event_t event, int qnxType)
void *handle; void *handle;
result = screen_get_event_property_pv(event, SCREEN_PROPERTY_WINDOW, &handle); result = screen_get_event_property_pv(event, SCREEN_PROPERTY_WINDOW, &handle);
if (result) { 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); 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) { if (touchId < MaximumTouchPoints) {
// Map window handle to top-level QWindow // Map window handle to top-level QWindow
QWindow *w = QBBIntegration::window(qnxWindow); QWindow *w = QQnxIntegration::window(qnxWindow);
// Generate enter and leave events as needed. // Generate enter and leave events as needed.
if (qnxWindow != m_lastMouseWindow) { if (qnxWindow != m_lastMouseWindow) {
QWindow *wOld = QBBIntegration::window(m_lastMouseWindow); QWindow *wOld = QQnxIntegration::window(m_lastMouseWindow);
if (wOld) { if (wOld) {
QWindowSystemInterface::handleLeaveEvent(wOld); QWindowSystemInterface::handleLeaveEvent(wOld);
#if defined(QBBEVENTTHREAD_DEBUG) #if defined(QQNXEVENTTHREAD_DEBUG)
qDebug() << "QBB: Qt leave, w=" << wOld; qDebug() << "QQNX: Qt leave, w=" << wOld;
#endif #endif
} }
if (w) { if (w) {
QWindowSystemInterface::handleEnterEvent(w); QWindowSystemInterface::handleEnterEvent(w);
#if defined(QBBEVENTTHREAD_DEBUG) #if defined(QQNXEVENTTHREAD_DEBUG)
qDebug() << "QBB: Qt enter, w=" << w; qDebug() << "QQNX: Qt enter, w=" << w;
#endif #endif
} }
} }
@ -501,8 +501,8 @@ void QBBEventThread::handleTouchEvent(screen_event_t event, int qnxType)
// inject event into Qt // inject event into Qt
QWindowSystemInterface::handleMouseEvent(w, localPoint, globalPoint, buttons); QWindowSystemInterface::handleMouseEvent(w, localPoint, globalPoint, buttons);
#if defined(QBBEVENTTHREAD_DEBUG) #if defined(QQNXEVENTTHREAD_DEBUG)
qDebug() << "QBB: Qt mouse, w=" << w << ", (" << localPoint.x() << "," << localPoint.y() << "), b=" << buttons; qDebug() << "QQNX: Qt mouse, w=" << w << ", (" << localPoint.x() << "," << localPoint.y() << "), b=" << buttons;
#endif #endif
} }
@ -546,25 +546,25 @@ void QBBEventThread::handleTouchEvent(screen_event_t event, int qnxType)
// inject event into Qt // inject event into Qt
QWindowSystemInterface::handleTouchEvent(w, m_touchDevice, pointList); QWindowSystemInterface::handleTouchEvent(w, m_touchDevice, pointList);
#if defined(QBBEVENTTHREAD_DEBUG) #if defined(QQNXEVENTTHREAD_DEBUG)
qDebug() << "QBB: Qt touch, w=" << w << ", p=(" << pos[0] << "," << pos[1] << "), t=" << type; qDebug() << "QQNX: Qt touch, w=" << w << ", p=(" << pos[0] << "," << pos[1] << "), t=" << type;
#endif #endif
} }
} }
} }
void QBBEventThread::handleCloseEvent(screen_event_t event) void QQnxEventThread::handleCloseEvent(screen_event_t event)
{ {
// Query the window that was closed // Query the window that was closed
void *handle; void *handle;
int result = screen_get_event_property_pv(event, SCREEN_PROPERTY_WINDOW, &handle); int result = screen_get_event_property_pv(event, SCREEN_PROPERTY_WINDOW, &handle);
if (result != 0) { 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); screen_window_t qnxWindow = static_cast<screen_window_t>(handle);
// Map window handle to top-level QWindow // Map window handle to top-level QWindow
QWindow *w = QBBIntegration::window(qnxWindow); QWindow *w = QQnxIntegration::window(qnxWindow);
if (w != 0) { if (w != 0) {
QWindowSystemInterface::handleCloseEvent(w); QWindowSystemInterface::handleCloseEvent(w);
} }

View File

@ -39,8 +39,8 @@
** **
****************************************************************************/ ****************************************************************************/
#ifndef QBBEVENTTHREAD_H #ifndef QQNXEVENTTHREAD_H
#define QBBEVENTTHREAD_H #define QQNXEVENTTHREAD_H
#include <QtCore/QThread> #include <QtCore/QThread>
@ -51,11 +51,11 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QBBEventThread : public QThread class QQnxEventThread : public QThread
{ {
public: public:
QBBEventThread(screen_context_t context, QPlatformScreen& screen); QQnxEventThread(screen_context_t context, QPlatformScreen& screen);
virtual ~QBBEventThread(); virtual ~QQnxEventThread();
static void injectKeyboardEvent(int flags, int sym, int mod, int scan, int cap); static void injectKeyboardEvent(int flags, int sym, int mod, int scan, int cap);
@ -87,4 +87,4 @@ private:
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QBBEVENTTHREAD_H #endif // QQNXEVENTTHREAD_H

View File

@ -39,10 +39,10 @@
** **
****************************************************************************/ ****************************************************************************/
#include "qbbglbackingstore.h" #include "qqnxglbackingstore.h"
#include "qbbglcontext.h" #include "qqnxglcontext.h"
#include "qbbwindow.h" #include "qqnxwindow.h"
#include "qbbscreen.h" #include "qqnxscreen.h"
#include <QtGui/qwindow.h> #include <QtGui/qwindow.h>
@ -55,12 +55,12 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
QBBGLPaintDevice::QBBGLPaintDevice(QWindow *window) QQnxGLPaintDevice::QQnxGLPaintDevice(QWindow *window)
: QGLPaintDevice(), : QGLPaintDevice(),
m_window(0), m_window(0),
m_glContext(0) m_glContext(0)
{ {
m_window = static_cast<QBBWindow*>(window->handle()); m_window = static_cast<QQnxWindow*>(window->handle());
// Extract the QPlatformOpenGLContext from the window // Extract the QPlatformOpenGLContext from the window
QPlatformOpenGLContext *platformOpenGLContext = m_window->platformOpenGLContext(); QPlatformOpenGLContext *platformOpenGLContext = m_window->platformOpenGLContext();
@ -69,81 +69,81 @@ QBBGLPaintDevice::QBBGLPaintDevice(QWindow *window)
m_glContext = QGLContext::fromOpenGLContext(platformOpenGLContext->context()); m_glContext = QGLContext::fromOpenGLContext(platformOpenGLContext->context());
} }
QBBGLPaintDevice::~QBBGLPaintDevice() QQnxGLPaintDevice::~QQnxGLPaintDevice()
{ {
// Cleanup GL context // Cleanup GL context
delete m_glContext; delete m_glContext;
} }
QPaintEngine *QBBGLPaintDevice::paintEngine() const QPaintEngine *QQnxGLPaintDevice::paintEngine() const
{ {
// Select a paint engine based on configued OpenGL version // Select a paint engine based on configued OpenGL version
return qt_qgl_paint_engine(); return qt_qgl_paint_engine();
} }
QSize QBBGLPaintDevice::size() const QSize QQnxGLPaintDevice::size() const
{ {
// Get size of EGL surface // Get size of EGL surface
return m_window->geometry().size(); return m_window->geometry().size();
} }
QBBGLBackingStore::QBBGLBackingStore(QWindow *window) QQnxGLBackingStore::QQnxGLBackingStore(QWindow *window)
: QPlatformBackingStore(window), : QPlatformBackingStore(window),
m_openGLContext(0), m_openGLContext(0),
m_paintDevice(0), m_paintDevice(0),
m_requestedSize(), m_requestedSize(),
m_size() m_size()
{ {
#if defined(QBBGLBACKINGSTORE_DEBUG) #if defined(QQNXGLBACKINGSTORE_DEBUG)
qDebug() << "QBBGLBackingStore::QBBGLBackingStore - w=" << window; qDebug() << "QQnxGLBackingStore::QQnxGLBackingStore - w=" << window;
#endif #endif
// Create an OpenGL paint device which in turn creates a QGLContext for us // 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(); m_openGLContext = m_paintDevice->context()->contextHandle();
} }
QBBGLBackingStore::~QBBGLBackingStore() QQnxGLBackingStore::~QQnxGLBackingStore()
{ {
#if defined(QBBGLBACKINGSTORE_DEBUG) #if defined(QQNXGLBACKINGSTORE_DEBUG)
qDebug() << "QBBGLBackingStore::~QBBGLBackingStore - w=" << window(); qDebug() << "QQnxGLBackingStore::~QQnxGLBackingStore - w=" << window();
#endif #endif
// cleanup OpenGL paint device // cleanup OpenGL paint device
delete m_paintDevice; delete m_paintDevice;
} }
void QBBGLBackingStore::flush(QWindow *window, const QRegion &region, const QPoint &offset) void QQnxGLBackingStore::flush(QWindow *window, const QRegion &region, const QPoint &offset)
{ {
Q_UNUSED(region); Q_UNUSED(region);
Q_UNUSED(offset); Q_UNUSED(offset);
#if defined(QBBGLBACKINGSTORE_DEBUG) #if defined(QQNXGLBACKINGSTORE_DEBUG)
qDebug() << "QBBGLBackingStore::flush - w=" << window; qDebug() << "QQnxGLBackingStore::flush - w=" << window;
#endif #endif
// update the display with newly rendered content // update the display with newly rendered content
m_openGLContext->swapBuffers(window); 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); Q_UNUSED(staticContents);
#if defined(QBBGLBACKINGSTORE_DEBUG) #if defined(QQNXGLBACKINGSTORE_DEBUG)
qDebug() << "QBBGLBackingStore::resize - w=" << window() << ", s=" << size; qDebug() << "QQnxGLBackingStore::resize - w=" << window() << ", s=" << size;
#endif #endif
// NOTE: defer resizing window buffers until next paint as // NOTE: defer resizing window buffers until next paint as
// resize() can be called multiple times before a paint occurs // resize() can be called multiple times before a paint occurs
m_requestedSize = size; m_requestedSize = size;
} }
void QBBGLBackingStore::beginPaint(const QRegion &region) void QQnxGLBackingStore::beginPaint(const QRegion &region)
{ {
Q_UNUSED(region); Q_UNUSED(region);
#if defined(QBBGLBACKINGSTORE_DEBUG) #if defined(QQNXGLBACKINGSTORE_DEBUG)
qDebug() << "QBBGLBackingStore::beginPaint - w=" << window(); qDebug() << "QQnxGLBackingStore::beginPaint - w=" << window();
#endif #endif
// resize EGL surface if window surface resized // resize EGL surface if window surface resized
@ -152,19 +152,19 @@ void QBBGLBackingStore::beginPaint(const QRegion &region)
} }
} }
void QBBGLBackingStore::endPaint(const QRegion &region) void QQnxGLBackingStore::endPaint(const QRegion &region)
{ {
Q_UNUSED(region); Q_UNUSED(region);
#if defined(QBBGLBACKINGSTORE_DEBUG) #if defined(QQNXGLBACKINGSTORE_DEBUG)
qDebug() << "QBBGLBackingStore::endPaint - w=" << window(); qDebug() << "QQnxGLBackingStore::endPaint - w=" << window();
#endif #endif
} }
void QBBGLBackingStore::resizeSurface(const QSize &size) void QQnxGLBackingStore::resizeSurface(const QSize &size)
{ {
// need to destroy surface so make sure its not current // need to destroy surface so make sure its not current
bool restoreCurrent = false; bool restoreCurrent = false;
QBBGLContext *platformContext = static_cast<QBBGLContext *>(m_openGLContext->handle()); QQnxGLContext *platformContext = static_cast<QQnxGLContext *>(m_openGLContext->handle());
if (platformContext->isCurrent()) { if (platformContext->isCurrent()) {
m_openGLContext->doneCurrent(); m_openGLContext->doneCurrent();
restoreCurrent = true; restoreCurrent = true;
@ -174,7 +174,7 @@ void QBBGLBackingStore::resizeSurface(const QSize &size)
platformContext->destroySurface(); platformContext->destroySurface();
// resize window's buffers // 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 // re-create EGL surface with new size
m_size = size; m_size = size;

View File

@ -39,8 +39,8 @@
** **
****************************************************************************/ ****************************************************************************/
#ifndef QBBGLBACKINGSTORE_H #ifndef QQNXGLBACKINGSTORE_H
#define QBBGLBACKINGSTORE_H #define QQNXGLBACKINGSTORE_H
#include <QtGui/qplatformbackingstore_qpa.h> #include <QtGui/qplatformbackingstore_qpa.h>
#include <QtOpenGL/private/qglpaintdevice_p.h> #include <QtOpenGL/private/qglpaintdevice_p.h>
@ -50,30 +50,30 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QGLContext; class QGLContext;
class QBBGLContext; class QQnxGLContext;
class QBBScreen; class QQnxScreen;
class QBBWindow; class QQnxWindow;
class QBBGLPaintDevice : public QGLPaintDevice class QQnxGLPaintDevice : public QGLPaintDevice
{ {
public: public:
QBBGLPaintDevice(QWindow *window); QQnxGLPaintDevice(QWindow *window);
virtual ~QBBGLPaintDevice(); virtual ~QQnxGLPaintDevice();
virtual QPaintEngine *paintEngine() const; virtual QPaintEngine *paintEngine() const;
virtual QSize size() const; virtual QSize size() const;
virtual QGLContext *context() const { return m_glContext; } virtual QGLContext *context() const { return m_glContext; }
private: private:
QBBWindow *m_window; QQnxWindow *m_window;
QGLContext *m_glContext; QGLContext *m_glContext;
}; };
class QBBGLBackingStore : public QPlatformBackingStore class QQnxGLBackingStore : public QPlatformBackingStore
{ {
public: public:
QBBGLBackingStore(QWindow *window); QQnxGLBackingStore(QWindow *window);
virtual ~QBBGLBackingStore(); virtual ~QQnxGLBackingStore();
virtual QPaintDevice *paintDevice() { return m_paintDevice; } virtual QPaintDevice *paintDevice() { return m_paintDevice; }
virtual void flush(QWindow *window, const QRegion &region, const QPoint &offset); virtual void flush(QWindow *window, const QRegion &region, const QPoint &offset);
@ -85,11 +85,11 @@ public:
private: private:
QOpenGLContext *m_openGLContext; QOpenGLContext *m_openGLContext;
QBBGLPaintDevice *m_paintDevice; QQnxGLPaintDevice *m_paintDevice;
QSize m_requestedSize; QSize m_requestedSize;
QSize m_size; QSize m_size;
}; };
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QBBGLBACKINGSTORE_H #endif // QQNXGLBACKINGSTORE_H

View File

@ -39,10 +39,10 @@
** **
****************************************************************************/ ****************************************************************************/
#include "qbbglcontext.h" #include "qqnxglcontext.h"
#include "qbbrootwindow.h" #include "qqnxrootwindow.h"
#include "qbbscreen.h" #include "qqnxscreen.h"
#include "qbbwindow.h" #include "qqnxwindow.h"
#include "private/qeglconvenience_p.h" #include "private/qeglconvenience_p.h"
@ -51,7 +51,7 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
EGLDisplay QBBGLContext::ms_eglDisplay = EGL_NO_DISPLAY; EGLDisplay QQnxGLContext::ms_eglDisplay = EGL_NO_DISPLAY;
static EGLenum checkEGLError(const char *msg) static EGLenum checkEGLError(const char *msg)
{ {
@ -78,12 +78,12 @@ static EGLenum checkEGLError(const char *msg)
return error; return error;
} }
QBBGLContext::QBBGLContext(QOpenGLContext *glContext) QQnxGLContext::QQnxGLContext(QOpenGLContext *glContext)
: QPlatformOpenGLContext(), : QPlatformOpenGLContext(),
m_glContext(glContext), m_glContext(glContext),
m_eglSurface(EGL_NO_SURFACE) m_eglSurface(EGL_NO_SURFACE)
{ {
#if defined(QBBGLCONTEXT_DEBUG) #if defined(QQNXGLCONTEXT_DEBUG)
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
#endif #endif
QSurfaceFormat format = m_glContext->format(); QSurfaceFormat format = m_glContext->format();
@ -91,7 +91,7 @@ QBBGLContext::QBBGLContext(QOpenGLContext *glContext)
// Set current rendering API // Set current rendering API
EGLBoolean eglResult = eglBindAPI(EGL_OPENGL_ES_API); EGLBoolean eglResult = eglBindAPI(EGL_OPENGL_ES_API);
if (eglResult != EGL_TRUE) { 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 // Get colour channel sizes from window format
@ -103,7 +103,7 @@ QBBGLContext::QBBGLContext(QOpenGLContext *glContext)
// Check if all channels are don't care // Check if all channels are don't care
if (alphaSize == -1 && redSize == -1 && greenSize == -1 && blueSize == -1) { if (alphaSize == -1 && redSize == -1 && greenSize == -1 && blueSize == -1) {
// Set colour channels based on depth of window's screen // 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(); int depth = screen->depth();
if (depth == 32) { if (depth == 32) {
// SCREEN_FORMAT_RGBA8888 // SCREEN_FORMAT_RGBA8888
@ -145,22 +145,22 @@ QBBGLContext::QBBGLContext(QOpenGLContext *glContext)
// Select EGL config based on requested window format // Select EGL config based on requested window format
m_eglConfig = q_configFromGLFormat(ms_eglDisplay, format); m_eglConfig = q_configFromGLFormat(ms_eglDisplay, format);
if (m_eglConfig == 0) { 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()); m_eglContext = eglCreateContext(ms_eglDisplay, m_eglConfig, EGL_NO_CONTEXT, contextAttrs());
if (m_eglContext == EGL_NO_CONTEXT) { if (m_eglContext == EGL_NO_CONTEXT) {
checkEGLError("eglCreateContext"); 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 // Query/cache window format of selected EGL config
m_windowFormat = q_glFormatFromConfig(ms_eglDisplay, m_eglConfig); m_windowFormat = q_glFormatFromConfig(ms_eglDisplay, m_eglConfig);
} }
QBBGLContext::~QBBGLContext() QQnxGLContext::~QQnxGLContext()
{ {
#if defined(QBBGLCONTEXT_DEBUG) #if defined(QQNXGLCONTEXT_DEBUG)
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
#endif #endif
@ -173,43 +173,43 @@ QBBGLContext::~QBBGLContext()
destroySurface(); destroySurface();
} }
void QBBGLContext::initialize() void QQnxGLContext::initialize()
{ {
#if defined(QBBGLCONTEXT_DEBUG) #if defined(QQNXGLCONTEXT_DEBUG)
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
#endif #endif
// Initialize connection to EGL // Initialize connection to EGL
ms_eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY); ms_eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
if (ms_eglDisplay == EGL_NO_DISPLAY) { if (ms_eglDisplay == EGL_NO_DISPLAY) {
checkEGLError("eglGetDisplay"); checkEGLError("eglGetDisplay");
qFatal("QBB: failed to obtain EGL display"); qFatal("QQNXQBBWindow: failed to obtain EGL display");
} }
EGLBoolean eglResult = eglInitialize(ms_eglDisplay, 0, 0); EGLBoolean eglResult = eglInitialize(ms_eglDisplay, 0, 0);
if (eglResult != EGL_TRUE) { if (eglResult != EGL_TRUE) {
checkEGLError("eglInitialize"); 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; qDebug() << Q_FUNC_INFO;
#endif #endif
// Close connection to EGL // Close connection to EGL
eglTerminate(ms_eglDisplay); 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; qDebug() << Q_FUNC_INFO;
#endif #endif
// Set current rendering API // Set current rendering API
EGLBoolean eglResult = eglBindAPI(EGL_OPENGL_ES_API); EGLBoolean eglResult = eglBindAPI(EGL_OPENGL_ES_API);
if (eglResult != EGL_TRUE) { 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) 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); eglResult = eglMakeCurrent(ms_eglDisplay, m_eglSurface, m_eglSurface, m_eglContext);
if (eglResult != EGL_TRUE) { if (eglResult != EGL_TRUE) {
checkEGLError("eglMakeCurrent"); 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); return (eglResult == EGL_TRUE);
} }
void QBBGLContext::doneCurrent() void QQnxGLContext::doneCurrent()
{ {
#if defined(QBBGLCONTEXT_DEBUG) #if defined(QQNXGLCONTEXT_DEBUG)
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
#endif #endif
// set current rendering API // set current rendering API
EGLBoolean eglResult = eglBindAPI(EGL_OPENGL_ES_API); EGLBoolean eglResult = eglBindAPI(EGL_OPENGL_ES_API);
if (eglResult != EGL_TRUE) { 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 // clear curent EGL context and unbind EGL surface
eglResult = eglMakeCurrent(ms_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); eglResult = eglMakeCurrent(ms_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
if (eglResult != EGL_TRUE) { 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); Q_UNUSED(surface);
#if defined(QBBGLCONTEXT_DEBUG) #if defined(QQNXGLCONTEXT_DEBUG)
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
#endif #endif
// Set current rendering API // Set current rendering API
EGLBoolean eglResult = eglBindAPI(EGL_OPENGL_ES_API); EGLBoolean eglResult = eglBindAPI(EGL_OPENGL_ES_API);
if (eglResult != EGL_TRUE) { 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 // Post EGL surface to window
eglResult = eglSwapBuffers(ms_eglDisplay, m_eglSurface); eglResult = eglSwapBuffers(ms_eglDisplay, m_eglSurface);
if (eglResult != EGL_TRUE) { 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; qDebug() << Q_FUNC_INFO;
#endif #endif
// Set current rendering API // Set current rendering API
EGLBoolean eglResult = eglBindAPI(EGL_OPENGL_ES_API); EGLBoolean eglResult = eglBindAPI(EGL_OPENGL_ES_API);
if (eglResult != EGL_TRUE) { 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 // Lookup EGL extension function pointer
return static_cast<QFunctionPointer>(eglGetProcAddress(procName.constData())); 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; qDebug() << Q_FUNC_INFO;
#endif #endif
@ -292,23 +292,23 @@ EGLint *QBBGLContext::contextAttrs()
#endif #endif
} }
bool QBBGLContext::isCurrent() const bool QQnxGLContext::isCurrent() const
{ {
#if defined(QBBGLCONTEXT_DEBUG) #if defined(QQNXGLCONTEXT_DEBUG)
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
#endif #endif
return (eglGetCurrentContext() == m_eglContext); 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; qDebug() << Q_FUNC_INFO;
#endif #endif
// Get a pointer to the corresponding platform window // Get a pointer to the corresponding platform window
QBBWindow *platformWindow = dynamic_cast<QBBWindow*>(surface); QQnxWindow *platformWindow = dynamic_cast<QQnxWindow*>(surface);
if (!platformWindow) { 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 // 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); m_eglSurface = eglCreateWindowSurface(ms_eglDisplay, m_eglConfig, (EGLNativeWindowType) handle, eglSurfaceAttrs);
if (m_eglSurface == EGL_NO_SURFACE) { if (m_eglSurface == EGL_NO_SURFACE) {
checkEGLError("eglCreateWindowSurface"); 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; qDebug() << Q_FUNC_INFO;
#endif #endif
@ -348,7 +348,7 @@ void QBBGLContext::destroySurface()
if (m_eglSurface != EGL_NO_SURFACE) { if (m_eglSurface != EGL_NO_SURFACE) {
EGLBoolean eglResult = eglDestroySurface(ms_eglDisplay, m_eglSurface); EGLBoolean eglResult = eglDestroySurface(ms_eglDisplay, m_eglSurface);
if (eglResult != EGL_TRUE) { if (eglResult != EGL_TRUE) {
qFatal("QBB: failed to destroy EGL surface, err=%d", eglGetError()); qFatal("QQNX: failed to destroy EGL surface, err=%d", eglGetError());
} }
} }
} }

View File

@ -39,8 +39,8 @@
** **
****************************************************************************/ ****************************************************************************/
#ifndef QBBGLCONTEXT_H #ifndef QQNXGLCONTEXT_H
#define QBBGLCONTEXT_H #define QQNXGLCONTEXT_H
#include <QtGui/QPlatformOpenGLContext> #include <QtGui/QPlatformOpenGLContext>
#include <QtGui/QSurfaceFormat> #include <QtGui/QSurfaceFormat>
@ -50,13 +50,13 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QBBWindow; class QQnxWindow;
class QBBGLContext : public QPlatformOpenGLContext class QQnxGLContext : public QPlatformOpenGLContext
{ {
public: public:
QBBGLContext(QOpenGLContext *glContext); QQnxGLContext(QOpenGLContext *glContext);
virtual ~QBBGLContext(); virtual ~QQnxGLContext();
static void initialize(); static void initialize();
static void shutdown(); static void shutdown();
@ -90,4 +90,4 @@ private:
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QBBGLCONTEXT_H #endif // QQNXGLCONTEXT_H

View File

@ -39,9 +39,9 @@
** **
****************************************************************************/ ****************************************************************************/
#include "qbbinputcontext_imf.h" #include "qqnxinputcontext_imf.h"
#include "qbbeventthread.h" #include "qqnxeventthread.h"
#include "qbbvirtualkeyboard.h" #include "qqnxvirtualkeyboard.h"
#include <QtWidgets/QAbstractSpinBox> #include <QtWidgets/QAbstractSpinBox>
#include <QtWidgets/QAction> #include <QtWidgets/QAction>
@ -175,7 +175,7 @@ int ImfEvent::sUserEventType = QEvent::registerEventType();
static int32_t imfBeginBatchEdit(input_session_t *ic) static int32_t imfBeginBatchEdit(input_session_t *ic)
{ {
#if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG) #if defined(QQNXINPUTCONTEXT_IMF_EVENT_DEBUG)
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
#endif #endif
@ -194,7 +194,7 @@ static int32_t imfBeginBatchEdit(input_session_t *ic)
static int32_t imfClearMetaKeyStates(input_session_t *ic, int32_t states) 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; qDebug() << Q_FUNC_INFO;
#endif #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) 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; qDebug() << Q_FUNC_INFO;
#endif #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) 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; qDebug() << Q_FUNC_INFO;
#endif #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) static int32_t imfEndBatchEdit(input_session_t *ic)
{ {
#if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG) #if defined(QQNXINPUTCONTEXT_IMF_EVENT_DEBUG)
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
#endif #endif
@ -279,7 +279,7 @@ static int32_t imfEndBatchEdit(input_session_t *ic)
static int32_t imfFinishComposingText(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; qDebug() << Q_FUNC_INFO;
#endif #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) 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; qDebug() << Q_FUNC_INFO;
#endif #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) static int32_t imfGetCursorPosition(input_session_t *ic)
{ {
#if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG) #if defined(QQNXINPUTCONTEXT_IMF_EVENT_DEBUG)
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
#endif #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) 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; qDebug() << Q_FUNC_INFO;
#endif #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) 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; qDebug() << Q_FUNC_INFO;
#endif #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) 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; qDebug() << Q_FUNC_INFO;
#endif #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) 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; qDebug() << Q_FUNC_INFO;
#endif #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) 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; qDebug() << Q_FUNC_INFO;
#endif #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) 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; qDebug() << Q_FUNC_INFO;
#endif #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) 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; qDebug() << Q_FUNC_INFO;
#endif #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) 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; qDebug() << Q_FUNC_INFO;
#endif #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) 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; qDebug() << Q_FUNC_INFO;
#endif #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) 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; qDebug() << Q_FUNC_INFO;
#endif #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) 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; qDebug() << Q_FUNC_INFO;
#endif #endif
@ -595,7 +595,7 @@ initEvent(event_t *pEvent, const input_session_t *pSession, EventType eventType,
spannable_string_t *toSpannableString(const QString &text) spannable_string_t *toSpannableString(const QString &text)
{ {
#if defined(QBBINPUTCONTEXT_DEBUG) #if defined(QQNXINPUTCONTEXT_DEBUG)
qDebug() << Q_FUNC_INFO << text; qDebug() << Q_FUNC_INFO << text;
#endif #endif
@ -674,14 +674,14 @@ static bool imfAvailable()
return s_imfReady; return s_imfReady;
} }
QBBInputContext::QBBInputContext(): QQnxInputContext::QQnxInputContext():
QPlatformInputContext(), QPlatformInputContext(),
m_lastCaretPos(0), m_lastCaretPos(0),
m_isComposing(false), m_isComposing(false),
m_inputPanelVisible(false), m_inputPanelVisible(false),
m_inputPanelLocale(QLocale::c()) m_inputPanelLocale(QLocale::c())
{ {
#if defined(QBBINPUTCONTEXT_DEBUG) #if defined(QQNXINPUTCONTEXT_DEBUG)
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
#endif #endif
@ -697,7 +697,7 @@ QBBInputContext::QBBInputContext():
// p_vkb_init_selection_service(); // 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(visibilityChanged(bool)), this, SLOT(keyboardVisibilityChanged(bool)));
connect(&keyboard, SIGNAL(localeChanged(QLocale)), this, SLOT(keyboardLocaleChanged(QLocale))); connect(&keyboard, SIGNAL(localeChanged(QLocale)), this, SLOT(keyboardLocaleChanged(QLocale)));
keyboardVisibilityChanged(keyboard.isVisible()); 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; qDebug() << Q_FUNC_INFO;
#endif #endif
@ -724,12 +724,12 @@ QBBInputContext::~QBBInputContext()
#define getarg(type, name) type name = imfEvent->mArgs[qs(#name)].value<type>() #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*>()) #define getparg(type, name) type name = (type)(imfEvent->mArgs[qs(#name)].value<void*>())
bool QBBInputContext::isValid() const bool QQnxInputContext::isValid() const
{ {
return imfAvailable(); return imfAvailable();
} }
bool QBBInputContext::eventFilter(QObject *obj, QEvent *event) bool QQnxInputContext::eventFilter(QObject *obj, QEvent *event)
{ {
if (event->type() == ImfEvent::sUserEventType) { if (event->type() == ImfEvent::sUserEventType) {
// Forward the event to our real handler. // 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; qDebug() << Q_FUNC_INFO << event;
#endif #endif
switch (event->type()) { 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; qDebug() << Q_FUNC_INFO;
#endif #endif
endComposition(); 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; qDebug() << Q_FUNC_INFO;
#endif #endif
reset(); reset();
@ -913,9 +913,9 @@ void QBBInputContext::update(Qt::InputMethodQueries queries)
QPlatformInputContext::update(queries); QPlatformInputContext::update(queries);
} }
void QBBInputContext::closeSession() void QQnxInputContext::closeSession()
{ {
#if defined(QBBINPUTCONTEXT_DEBUG) #if defined(QQNXINPUTCONTEXT_DEBUG)
qDebug() << Q_FUNC_INFO qDebug() << Q_FUNC_INFO
#endif #endif
if (!imfAvailable()) 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 qDebug() << Q_FUNC_INFO
#endif #endif
if (!imfAvailable()) if (!imfAvailable())
@ -939,12 +939,12 @@ void QBBInputContext::openSession()
sInputSession = p_ictrl_open_session(&ic_funcs); sInputSession = p_ictrl_open_session(&ic_funcs);
} }
bool QBBInputContext::hasSession() bool QQnxInputContext::hasSession()
{ {
return sInputSession != 0; return sInputSession != 0;
} }
bool QBBInputContext::hasSelectedText() bool QQnxInputContext::hasSelectedText()
{ {
QInputPanel *panel = qApp->inputPanel(); QInputPanel *panel = qApp->inputPanel();
QObject *input = panel->inputItem(); QObject *input = panel->inputItem();
@ -957,11 +957,11 @@ bool QBBInputContext::hasSelectedText()
return !query.value(Qt::ImCurrentSelection).toString().isEmpty(); return !query.value(Qt::ImCurrentSelection).toString().isEmpty();
} }
bool QBBInputContext::dispatchRequestSoftwareInputPanel() bool QQnxInputContext::dispatchRequestSoftwareInputPanel()
{ {
QBBVirtualKeyboard::instance().showKeyboard(); QQnxVirtualKeyboard::instance().showKeyboard();
#if defined(QBBINPUTCONTEXT_DEBUG) #if defined(QQNXINPUTCONTEXT_DEBUG)
qDebug() << "QBB: requesting virtual keyboard"; qDebug() << "QQNX: requesting virtual keyboard";
#endif #endif
QInputPanel *panel = qApp->inputPanel(); QInputPanel *panel = qApp->inputPanel();
QObject *input = panel->inputItem(); QObject *input = panel->inputItem();
@ -984,11 +984,11 @@ bool QBBInputContext::dispatchRequestSoftwareInputPanel()
return true; return true;
} }
bool QBBInputContext::dispatchCloseSoftwareInputPanel() bool QQnxInputContext::dispatchCloseSoftwareInputPanel()
{ {
QBBVirtualKeyboard::instance().hideKeyboard(); QQnxVirtualKeyboard::instance().hideKeyboard();
#if defined(QBBINPUTCONTEXT_DEBUG) #if defined(QQNXINPUTCONTEXT_DEBUG)
qDebug() << "QBB: hiding virtual keyboard"; qDebug() << "QQNX: hiding virtual keyboard";
#endif #endif
// This also means we are stopping composition, but we should already have done that. // This also means we are stopping composition, but we should already have done that.
@ -998,9 +998,9 @@ bool QBBInputContext::dispatchCloseSoftwareInputPanel()
/** /**
* IMF Event Dispatchers. * 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; qDebug() << Q_FUNC_INFO;
#endif #endif
@ -1031,7 +1031,7 @@ bool QBBInputContext::dispatchFocusEvent(FocusEventId id, int hints)
return true; 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()) if (!imfAvailable())
return false; return false;
@ -1110,7 +1110,7 @@ bool QBBInputContext::handleKeyboardEvent(int flags, int sym, int mod, int scan,
navigation_event_t navEvent; navigation_event_t navEvent;
initEvent(&navEvent.event, sInputSession, EVENT_NAVIGATION, key); initEvent(&navEvent.event, sInputSession, EVENT_NAVIGATION, key);
navEvent.magnitude = 1; navEvent.magnitude = 1;
#if defined(QBBINPUTCONTEXT_DEBUG) #if defined(QQNXINPUTCONTEXT_DEBUG)
qDebug() << Q_FUNC_INFO << "dispatch navigation event " << key; qDebug() << Q_FUNC_INFO << "dispatch navigation event " << key;
#endif #endif
p_ictrl_dispatch_event(&navEvent.event); 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; keyEvent.meta_key_state = 0;
p_ictrl_dispatch_event(&keyEvent.event); p_ictrl_dispatch_event(&keyEvent.event);
#if defined(QBBINPUTCONTEXT_DEBUG) #if defined(QQNXINPUTCONTEXT_DEBUG)
qDebug() << Q_FUNC_INFO << "dispatch key event " << key; qDebug() << Q_FUNC_INFO << "dispatch key event " << key;
#endif #endif
} }
@ -1133,7 +1133,7 @@ bool QBBInputContext::handleKeyboardEvent(int flags, int sym, int mod, int scan,
return true; return true;
} }
void QBBInputContext::endComposition() void QQnxInputContext::endComposition()
{ {
if (!m_isComposing) if (!m_isComposing)
return; return;
@ -1156,7 +1156,7 @@ void QBBInputContext::endComposition()
p_ictrl_dispatch_event(&actionEvent.event); p_ictrl_dispatch_event(&actionEvent.event);
} }
void QBBInputContext::setComposingText(QString const& composingText) void QQnxInputContext::setComposingText(QString const& composingText)
{ {
m_composingText = composingText; m_composingText = composingText;
m_isComposing = true; m_isComposing = true;
@ -1176,12 +1176,12 @@ void QBBInputContext::setComposingText(QString const& composingText)
QCoreApplication::sendEvent(input, &event); QCoreApplication::sendEvent(input, &event);
} }
int32_t QBBInputContext::processEvent(event_t *event) int32_t QQnxInputContext::processEvent(event_t *event)
{ {
int32_t result = -1; int32_t result = -1;
switch (event->event_type) { switch (event->event_type) {
case EVENT_SPELL_CHECK: { case EVENT_SPELL_CHECK: {
#if defined(QBBINPUTCONTEXT_DEBUG) #if defined(QQNXINPUTCONTEXT_DEBUG)
qDebug() << Q_FUNC_INFO << "EVENT_SPELL_CHECK"; qDebug() << Q_FUNC_INFO << "EVENT_SPELL_CHECK";
#endif #endif
result = 0; result = 0;
@ -1189,7 +1189,7 @@ int32_t QBBInputContext::processEvent(event_t *event)
} }
case EVENT_NAVIGATION: { case EVENT_NAVIGATION: {
#if defined(QBBINPUTCONTEXT_DEBUG) #if defined(QQNXINPUTCONTEXT_DEBUG)
qDebug() << Q_FUNC_INFO << "EVENT_NAVIGATION"; qDebug() << Q_FUNC_INFO << "EVENT_NAVIGATION";
#endif #endif
@ -1198,20 +1198,20 @@ int32_t QBBInputContext::processEvent(event_t *event)
event->event_id == NAVIGATE_LEFT ? KEYCODE_LEFT : event->event_id == NAVIGATE_LEFT ? KEYCODE_LEFT :
event->event_id == NAVIGATE_RIGHT ? KEYCODE_RIGHT : 0; event->event_id == NAVIGATE_RIGHT ? KEYCODE_RIGHT : 0;
QBBEventThread::injectKeyboardEvent(KEY_DOWN | KEY_CAP_VALID, key, 0, 0, 0); QQnxEventThread::injectKeyboardEvent(KEY_DOWN | KEY_CAP_VALID, key, 0, 0, 0);
QBBEventThread::injectKeyboardEvent(KEY_CAP_VALID, key, 0, 0, 0); QQnxEventThread::injectKeyboardEvent(KEY_CAP_VALID, key, 0, 0, 0);
result = 0; result = 0;
break; break;
} }
case EVENT_KEY: { case EVENT_KEY: {
#if defined(QBBINPUTCONTEXT_DEBUG) #if defined(QQNXINPUTCONTEXT_DEBUG)
qDebug() << Q_FUNC_INFO << "EVENT_KEY"; qDebug() << Q_FUNC_INFO << "EVENT_KEY";
#endif #endif
key_event_t *kevent = static_cast<key_event_t *>(event); 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); QQnxEventThread::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_SYM_VALID | KEY_CAP_VALID, kevent->key_code, 0, 0, kevent->key_code);
result = 0; result = 0;
break; break;
@ -1239,9 +1239,9 @@ int32_t QBBInputContext::processEvent(event_t *event)
* IMF Event Handlers * 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; qDebug() << Q_FUNC_INFO;
#endif #endif
@ -1252,10 +1252,10 @@ int32_t QBBInputContext::onBeginBatchEdit(input_session_t *ic)
return 0; 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); Q_UNUSED(states);
#if defined(QBBINPUTCONTEXT_DEBUG) #if defined(QQNXINPUTCONTEXT_DEBUG)
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
#endif #endif
@ -1267,7 +1267,7 @@ int32_t QBBInputContext::onClearMetaKeyStates(input_session_t *ic, int32_t state
return 0; 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. Q_UNUSED(new_cursor_position); // TODO: How can we set the cursor position it's not part of the API.
if (!isSessionOkay(ic)) 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); QString commitString = QString::fromWCharArray(text->str, text->length);
#if defined(QBBINPUTCONTEXT_DEBUG) #if defined(QQNXINPUTCONTEXT_DEBUG)
qDebug() << Q_FUNC_INFO << "Committing [" << commitString << "]"; qDebug() << Q_FUNC_INFO << "Committing [" << commitString << "]";
#endif #endif
@ -1294,9 +1294,9 @@ int32_t QBBInputContext::onCommitText(input_session_t *ic, spannable_string_t *t
return 0; 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; qDebug() << Q_FUNC_INFO << "L:" << left_length << " R:" << right_length;
#endif #endif
@ -1309,8 +1309,8 @@ int32_t QBBInputContext::onDeleteSurroundingText(input_session_t *ic, int32_t le
return 0; return 0;
if (hasSelectedText()) { if (hasSelectedText()) {
QBBEventThread::injectKeyboardEvent(KEY_DOWN | KEY_CAP_VALID, KEYCODE_DELETE, 0, 0, 0); QQnxEventThread::injectKeyboardEvent(KEY_DOWN | KEY_CAP_VALID, KEYCODE_DELETE, 0, 0, 0);
QBBEventThread::injectKeyboardEvent(KEY_CAP_VALID, KEYCODE_DELETE, 0, 0, 0); QQnxEventThread::injectKeyboardEvent(KEY_CAP_VALID, KEYCODE_DELETE, 0, 0, 0);
reset(); reset();
return 0; return 0;
} }
@ -1326,9 +1326,9 @@ int32_t QBBInputContext::onDeleteSurroundingText(input_session_t *ic, int32_t le
return 0; 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; qDebug() << Q_FUNC_INFO;
#endif #endif
@ -1338,9 +1338,9 @@ int32_t QBBInputContext::onEndBatchEdit(input_session_t *ic)
return 0; 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; qDebug() << Q_FUNC_INFO;
#endif #endif
@ -1364,10 +1364,10 @@ int32_t QBBInputContext::onFinishComposingText(input_session_t *ic)
return 0; 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); Q_UNUSED(req_modes);
#if defined(QBBINPUTCONTEXT_DEBUG) #if defined(QQNXINPUTCONTEXT_DEBUG)
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
#endif #endif
@ -1380,9 +1380,9 @@ int32_t QBBInputContext::onGetCursorCapsMode(input_session_t *ic, int32_t req_mo
return 0; 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; qDebug() << Q_FUNC_INFO;
#endif #endif
@ -1401,11 +1401,11 @@ int32_t QBBInputContext::onGetCursorPosition(input_session_t *ic)
return m_lastCaretPos; 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(flags);
Q_UNUSED(request); Q_UNUSED(request);
#if defined(QBBINPUTCONTEXT_DEBUG) #if defined(QQNXINPUTCONTEXT_DEBUG)
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
#endif #endif
@ -1422,10 +1422,10 @@ extracted_text_t *QBBInputContext::onGetExtractedText(input_session_t *ic, extra
return et; 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); Q_UNUSED(flags);
#if defined(QBBINPUTCONTEXT_DEBUG) #if defined(QQNXINPUTCONTEXT_DEBUG)
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
#endif #endif
@ -1444,10 +1444,10 @@ spannable_string_t *QBBInputContext::onGetSelectedText(input_session_t *ic, int3
return toSpannableString(text); 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); Q_UNUSED(flags);
#if defined(QBBINPUTCONTEXT_DEBUG) #if defined(QQNXINPUTCONTEXT_DEBUG)
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
#endif #endif
@ -1467,10 +1467,10 @@ spannable_string_t *QBBInputContext::onGetTextAfterCursor(input_session_t *ic, i
return toSpannableString(text.mid(m_lastCaretPos+1, n)); 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); Q_UNUSED(flags);
#if defined(QBBINPUTCONTEXT_DEBUG) #if defined(QQNXINPUTCONTEXT_DEBUG)
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
#endif #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); Q_UNUSED(editor_action);
#if defined(QBBINPUTCONTEXT_DEBUG) #if defined(QQNXINPUTCONTEXT_DEBUG)
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
#endif #endif
@ -1510,10 +1510,10 @@ int32_t QBBInputContext::onPerformEditorAction(input_session_t *ic, int32_t edit
return 0; 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); Q_UNUSED(enabled);
#if defined(QBBINPUTCONTEXT_DEBUG) #if defined(QQNXINPUTCONTEXT_DEBUG)
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
#endif #endif
@ -1526,9 +1526,9 @@ int32_t QBBInputContext::onReportFullscreenMode(input_session_t *ic, int32_t ena
return 0; 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; qDebug() << Q_FUNC_INFO;
#endif #endif
@ -1538,9 +1538,9 @@ int32_t QBBInputContext::onSendEvent(input_session_t *ic, event_t *event)
return processEvent(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; qDebug() << Q_FUNC_INFO;
#endif #endif
@ -1550,9 +1550,9 @@ int32_t QBBInputContext::onSendAsyncEvent(input_session_t *ic, event_t *event)
return processEvent(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; qDebug() << Q_FUNC_INFO;
#endif #endif
@ -1584,10 +1584,10 @@ int32_t QBBInputContext::onSetComposingRegion(input_session_t *ic, int32_t start
return 0; 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); Q_UNUSED(new_cursor_position);
#if defined(QBBINPUTCONTEXT_DEBUG) #if defined(QQNXINPUTCONTEXT_DEBUG)
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
#endif #endif
@ -1607,11 +1607,11 @@ int32_t QBBInputContext::onSetComposingText(input_session_t *ic, spannable_strin
return 0; 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(start);
Q_UNUSED(end); Q_UNUSED(end);
#if defined(QBBINPUTCONTEXT_DEBUG) #if defined(QQNXINPUTCONTEXT_DEBUG)
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
#endif #endif
@ -1624,35 +1624,35 @@ int32_t QBBInputContext::onSetSelection(input_session_t *ic, int32_t start, int3
return 0; return 0;
} }
void QBBInputContext::showInputPanel() void QQnxInputContext::showInputPanel()
{ {
#if defined(QBBINPUTCONTEXT_DEBUG) #if defined(QQNXINPUTCONTEXT_DEBUG)
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
#endif #endif
dispatchRequestSoftwareInputPanel(); dispatchRequestSoftwareInputPanel();
} }
void QBBInputContext::hideInputPanel() void QQnxInputContext::hideInputPanel()
{ {
#if defined(QBBINPUTCONTEXT_DEBUG) #if defined(QQNXINPUTCONTEXT_DEBUG)
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
#endif #endif
dispatchCloseSoftwareInputPanel(); dispatchCloseSoftwareInputPanel();
} }
bool QBBInputContext::isInputPanelVisible() const bool QQnxInputContext::isInputPanelVisible() const
{ {
return m_inputPanelVisible; return m_inputPanelVisible;
} }
QLocale QBBInputContext::locale() const QLocale QQnxInputContext::locale() const
{ {
return m_inputPanelLocale; 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; qDebug() << Q_FUNC_INFO << "visible=" << visible;
#endif #endif
if (m_inputPanelVisible != visible) { 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; qDebug() << Q_FUNC_INFO << "locale=" << locale;
#endif #endif
if (m_inputPanelLocale != locale) { if (m_inputPanelLocale != locale) {
@ -1672,12 +1672,12 @@ void QBBInputContext::keyboardLocaleChanged(const QLocale &locale)
} }
} }
void QBBInputContext::inputItemChanged() void QQnxInputContext::inputItemChanged()
{ {
QInputMethod *inputMethod = qApp->inputMethod(); QInputMethod *inputMethod = qApp->inputMethod();
QObject *inputItem = inputMethod->inputItem(); QObject *inputItem = inputMethod->inputItem();
#if defined(QBBINPUTCONTEXT_DEBUG) #if defined(QQNXINPUTCONTEXT_DEBUG)
qDebug() << Q_FUNC_INFO << "input item=" << inputItem; qDebug() << Q_FUNC_INFO << "input item=" << inputItem;
#endif #endif
@ -1686,9 +1686,9 @@ void QBBInputContext::inputItemChanged()
hideInputPanel(); hideInputPanel();
} else { } else {
if (qobject_cast<QAbstractSpinBox*>(inputItem)) { if (qobject_cast<QAbstractSpinBox*>(inputItem)) {
QBBVirtualKeyboard::instance().setKeyboardMode(QBBVirtualKeyboard::NumPunc); QQnxVirtualKeyboard::instance().setKeyboardMode(QQnxVirtualKeyboard::NumPunc);
} else { } else {
QBBVirtualKeyboard::instance().setKeyboardMode(QBBVirtualKeyboard::Default); QQnxVirtualKeyboard::instance().setKeyboardMode(QQnxVirtualKeyboard::Default);
} }
if (!m_inputPanelVisible) if (!m_inputPanelVisible)
showInputPanel(); showInputPanel();

View File

@ -39,8 +39,8 @@
** **
****************************************************************************/ ****************************************************************************/
#ifndef QBBINPUTCONTEXT_H #ifndef QQNXINPUTCONTEXT_H
#define QBBINPUTCONTEXT_H #define QQNXINPUTCONTEXT_H
#include <QtGui/QPlatformInputContext> #include <QtGui/QPlatformInputContext>
@ -53,12 +53,12 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QBBInputContext : public QPlatformInputContext class QQnxInputContext : public QPlatformInputContext
{ {
Q_OBJECT Q_OBJECT
public: public:
QBBInputContext(); QQnxInputContext();
~QBBInputContext(); ~QQnxInputContext();
virtual bool isValid() const; virtual bool isValid() const;
@ -129,4 +129,4 @@ Q_DECLARE_METATYPE(extracted_text_t*)
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QBBINPUTCONTEXT_H #endif // QQNXINPUTCONTEXT_H

View File

@ -39,19 +39,19 @@
** **
****************************************************************************/ ****************************************************************************/
#include "qbbinputcontext_noimf.h" #include "qqnxinputcontext_noimf.h"
#include "qbbvirtualkeyboard.h" #include "qqnxvirtualkeyboard.h"
#include <QtCore/QDebug> #include <QtCore/QDebug>
#include <QtGui/QGuiApplication> #include <QtGui/QGuiApplication>
#include <QtWidgets/QAbstractSpinBox> #include <QtWidgets/QAbstractSpinBox>
QBBInputContext::QBBInputContext() : QQnxInputContext::QQnxInputContext() :
QPlatformInputContext(), QPlatformInputContext(),
m_inputPanelVisible(false), m_inputPanelVisible(false),
m_inputPanelLocale(QLocale::c()) m_inputPanelLocale(QLocale::c())
{ {
QBBVirtualKeyboard &keyboard = QBBVirtualKeyboard::instance(); QQnxVirtualKeyboard &keyboard = QQnxVirtualKeyboard::instance();
connect(&keyboard, SIGNAL(visibilityChanged(bool)), this, SLOT(keyboardVisibilityChanged(bool))); connect(&keyboard, SIGNAL(visibilityChanged(bool)), this, SLOT(keyboardVisibilityChanged(bool)));
connect(&keyboard, SIGNAL(localeChanged(QLocale)), this, SLOT(keyboardLocaleChanged(QLocale))); connect(&keyboard, SIGNAL(localeChanged(QLocale)), this, SLOT(keyboardLocaleChanged(QLocale)));
keyboardVisibilityChanged(keyboard.isVisible()); keyboardVisibilityChanged(keyboard.isVisible());
@ -61,42 +61,42 @@ QBBInputContext::QBBInputContext() :
connect(inputMethod, SIGNAL(inputItemChanged()), this, SLOT(inputItemChanged())); connect(inputMethod, SIGNAL(inputItemChanged()), this, SLOT(inputItemChanged()));
} }
QBBInputContext::~QBBInputContext() QQnxInputContext::~QQnxInputContext()
{ {
} }
bool QBBInputContext::isValid() const bool QQnxInputContext::isValid() const
{ {
return true; return true;
} }
bool QBBInputContext::hasPhysicalKeyboard() bool QQnxInputContext::hasPhysicalKeyboard()
{ {
// TODO: This should query the system to check if a USB keyboard is connected. // TODO: This should query the system to check if a USB keyboard is connected.
return false; return false;
} }
void QBBInputContext::reset() void QQnxInputContext::reset()
{ {
} }
bool QBBInputContext::filterEvent( const QEvent *event ) bool QQnxInputContext::filterEvent( const QEvent *event )
{ {
if (hasPhysicalKeyboard()) if (hasPhysicalKeyboard())
return false; return false;
if (event->type() == QEvent::CloseSoftwareInputPanel) { if (event->type() == QEvent::CloseSoftwareInputPanel) {
QBBVirtualKeyboard::instance().hideKeyboard(); QQnxVirtualKeyboard::instance().hideKeyboard();
#if defined(QBBINPUTCONTEXT_DEBUG) #if defined(QQNXINPUTCONTEXT_DEBUG)
qDebug() << "QBB: hiding virtual keyboard"; qDebug() << "QQNX: hiding virtual keyboard";
#endif #endif
return false; return false;
} }
if (event->type() == QEvent::RequestSoftwareInputPanel) { if (event->type() == QEvent::RequestSoftwareInputPanel) {
QBBVirtualKeyboard::instance().showKeyboard(); QQnxVirtualKeyboard::instance().showKeyboard();
#if defined(QBBINPUTCONTEXT_DEBUG) #if defined(QQNXINPUTCONTEXT_DEBUG)
qDebug() << "QBB: requesting virtual keyboard"; qDebug() << "QQNX: requesting virtual keyboard";
#endif #endif
return false; 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(flags);
Q_UNUSED(sym); Q_UNUSED(sym);
@ -115,35 +115,35 @@ bool QBBInputContext::handleKeyboardEvent(int flags, int sym, int mod, int scan,
return false; return false;
} }
void QBBInputContext::showInputPanel() void QQnxInputContext::showInputPanel()
{ {
#if defined(QBBINPUTCONTEXT_DEBUG) #if defined(QQNXINPUTCONTEXT_DEBUG)
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
#endif #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; qDebug() << Q_FUNC_INFO;
#endif #endif
QBBVirtualKeyboard::instance().hideKeyboard(); QQnxVirtualKeyboard::instance().hideKeyboard();
} }
bool QBBInputContext::isInputPanelVisible() const bool QQnxInputContext::isInputPanelVisible() const
{ {
return m_inputPanelVisible; return m_inputPanelVisible;
} }
QLocale QBBInputContext::locale() const QLocale QQnxInputContext::locale() const
{ {
return m_inputPanelLocale; 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; qDebug() << Q_FUNC_INFO << "visible=" << visible;
#endif #endif
if (m_inputPanelVisible != visible) { 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; qDebug() << Q_FUNC_INFO << "locale=" << locale;
#endif #endif
if (m_inputPanelLocale != locale) { if (m_inputPanelLocale != locale) {
@ -163,12 +163,12 @@ void QBBInputContext::keyboardLocaleChanged(const QLocale &locale)
} }
} }
void QBBInputContext::inputItemChanged() void QQnxInputContext::inputItemChanged()
{ {
QInputMethod *inputMethod = qApp->inputMethod(); QInputMethod *inputMethod = qApp->inputMethod();
QObject *inputItem = inputMethod->inputItem(); QObject *inputItem = inputMethod->inputItem();
#if defined(QBBINPUTCONTEXT_DEBUG) #if defined(QQNXINPUTCONTEXT_DEBUG)
qDebug() << Q_FUNC_INFO << "input item=" << inputItem; qDebug() << Q_FUNC_INFO << "input item=" << inputItem;
#endif #endif
@ -177,9 +177,9 @@ void QBBInputContext::inputItemChanged()
hideInputPanel(); hideInputPanel();
} else { } else {
if (qobject_cast<QAbstractSpinBox*>(inputItem)) { if (qobject_cast<QAbstractSpinBox*>(inputItem)) {
QBBVirtualKeyboard::instance().setKeyboardMode(QBBVirtualKeyboard::NumPunc); QQnxVirtualKeyboard::instance().setKeyboardMode(QQnxVirtualKeyboard::NumPunc);
} else { } else {
QBBVirtualKeyboard::instance().setKeyboardMode(QBBVirtualKeyboard::Default); QQnxVirtualKeyboard::instance().setKeyboardMode(QQnxVirtualKeyboard::Default);
} }
if (!m_inputPanelVisible) if (!m_inputPanelVisible)
showInputPanel(); showInputPanel();

View File

@ -39,8 +39,8 @@
** **
****************************************************************************/ ****************************************************************************/
#ifndef QBBINPUTCONTEXT_H #ifndef QQNXINPUTCONTEXT_H
#define QBBINPUTCONTEXT_H #define QQNXINPUTCONTEXT_H
#include <QtCore/QLocale> #include <QtCore/QLocale>
#include <QtGui/QPlatformInputContext> #include <QtGui/QPlatformInputContext>
@ -48,12 +48,12 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QBBInputContext : public QPlatformInputContext class QQnxInputContext : public QPlatformInputContext
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit QBBInputContext(); explicit QQnxInputContext();
~QBBInputContext(); ~QQnxInputContext();
virtual bool isValid() const; virtual bool isValid() const;
@ -81,4 +81,4 @@ private:
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QBBINPUTCONTEXT_H #endif // QQNXINPUTCONTEXT_H

View File

@ -39,22 +39,22 @@
** **
****************************************************************************/ ****************************************************************************/
#include "qbbintegration.h" #include "qqnxintegration.h"
#include "qbbeventthread.h" #include "qqnxeventthread.h"
#include "qbbglbackingstore.h" #include "qqnxglbackingstore.h"
#include "qbbglcontext.h" #include "qqnxglcontext.h"
#include "qbbnavigatorthread.h" #include "qqnxnavigatorthread.h"
#include "qbbrasterbackingstore.h" #include "qqnxrasterbackingstore.h"
#include "qbbscreen.h" #include "qqnxscreen.h"
#include "qbbwindow.h" #include "qqnxwindow.h"
#include "qbbvirtualkeyboard.h" #include "qqnxvirtualkeyboard.h"
#include "qbbclipboard.h" #include "qqnxclipboard.h"
#include "qbbglcontext.h" #include "qqnxglcontext.h"
#if defined(QBB_IMF) #if defined(QQnx_IMF)
#include "qbbinputcontext_imf.h" #include "qqnxinputcontext_imf.h"
#else #else
#include "qbbinputcontext_noimf.h" #include "qqnxinputcontext_noimf.h"
#endif #endif
#include "private/qgenericunixfontdatabase_p.h" #include "private/qgenericunixfontdatabase_p.h"
@ -71,10 +71,10 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
QBBWindowMapper QBBIntegration::ms_windowMapper; QQnxWindowMapper QQnxIntegration::ms_windowMapper;
QMutex QBBIntegration::ms_windowMapperMutex; QMutex QQnxIntegration::ms_windowMapperMutex;
QBBIntegration::QBBIntegration() QQnxIntegration::QQnxIntegration()
: QPlatformIntegration() : QPlatformIntegration()
, m_eventThread(0) , m_eventThread(0)
, m_navigatorThread(0) , m_navigatorThread(0)
@ -86,47 +86,47 @@ QBBIntegration::QBBIntegration()
, m_clipboard(0) , m_clipboard(0)
#endif #endif
{ {
#if defined(QBBINTEGRATION_DEBUG) #if defined(QQNXINTEGRATION_DEBUG)
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
#endif #endif
// Open connection to QNX composition manager // Open connection to QNX composition manager
errno = 0; errno = 0;
int result = screen_create_context(&m_screenContext, SCREEN_APPLICATION_CONTEXT); int result = screen_create_context(&m_screenContext, SCREEN_APPLICATION_CONTEXT);
if (result != 0) { 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) // Create displays for all possible screens (which may not be attached)
QBBScreen::createDisplays(m_screenContext); QQnxScreen::createDisplays(m_screenContext);
Q_FOREACH (QPlatformScreen *screen, QBBScreen::screens()) { Q_FOREACH (QPlatformScreen *screen, QQnxScreen::screens()) {
screenAdded(screen); screenAdded(screen);
} }
// Initialize global OpenGL resources // Initialize global OpenGL resources
QBBGLContext::initialize(); QQnxGLContext::initialize();
// Create/start event thread // Create/start event thread
m_eventThread = new QBBEventThread(m_screenContext, *QBBScreen::primaryDisplay()); m_eventThread = new QQnxEventThread(m_screenContext, *QQnxScreen::primaryDisplay());
m_eventThread->start(); m_eventThread->start();
// Create/start navigator thread // Create/start navigator thread
m_navigatorThread = new QBBNavigatorThread(*QBBScreen::primaryDisplay()); m_navigatorThread = new QQnxNavigatorThread(*QQnxScreen::primaryDisplay());
m_navigatorThread->start(); m_navigatorThread->start();
// Create/start the keyboard class. // Create/start the keyboard class.
QBBVirtualKeyboard::instance(); QQnxVirtualKeyboard::instance();
// Set up the input context // Set up the input context
m_inputContext = new QBBInputContext; m_inputContext = new QQnxInputContext;
} }
QBBIntegration::~QBBIntegration() QQnxIntegration::~QQnxIntegration()
{ {
#if defined(QBBINTEGRATION_DEBUG) #if defined(QQNXINTEGRATION_DEBUG)
qDebug() << "QBB: platform plugin shutdown begin"; qDebug() << "QQnx: platform plugin shutdown begin";
#endif #endif
// Destroy the keyboard class. // Destroy the keyboard class.
QBBVirtualKeyboard::destroy(); QQnxVirtualKeyboard::destroy();
#ifndef QT_NO_CLIPBOARD #ifndef QT_NO_CLIPBOARD
// Delete the clipboard // Delete the clipboard
@ -140,22 +140,22 @@ QBBIntegration::~QBBIntegration()
delete m_navigatorThread; delete m_navigatorThread;
// Destroy all displays // Destroy all displays
QBBScreen::destroyDisplays(); QQnxScreen::destroyDisplays();
// Close connection to QNX composition manager // Close connection to QNX composition manager
screen_destroy_context(m_screenContext); screen_destroy_context(m_screenContext);
// Cleanup global OpenGL resources // Cleanup global OpenGL resources
QBBGLContext::shutdown(); QQnxGLContext::shutdown();
#if defined(QBBINTEGRATION_DEBUG) #if defined(QQNXINTEGRATION_DEBUG)
qDebug() << "QBB: platform plugin shutdown end"; qDebug() << "QQnx: platform plugin shutdown end";
#endif #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; qDebug() << Q_FUNC_INFO;
#endif #endif
switch (cap) { 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; qDebug() << Q_FUNC_INFO;
#endif #endif
// New windows are created on the primary display. // 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; qDebug() << Q_FUNC_INFO;
#endif #endif
if (paintUsingOpenGL()) if (paintUsingOpenGL())
return new QBBGLBackingStore(window); return new QQnxGLBackingStore(window);
else 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; qDebug() << Q_FUNC_INFO;
#endif #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; qDebug() << Q_FUNC_INFO;
#endif #endif
return m_inputContext; return m_inputContext;
} }
void QBBIntegration::moveToScreen(QWindow *window, int screen) void QQnxIntegration::moveToScreen(QWindow *window, int screen)
{ {
#if defined(QBBINTEGRATION_DEBUG) #if defined(QQNXINTEGRATION_DEBUG)
qDebug() << "QBBIntegration::moveToScreen - w=" << window << ", s=" << screen; qDebug() << "QQnxIntegration::moveToScreen - w=" << window << ", s=" << screen;
#endif #endif
// get platform window used by widget // 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 // 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 // move the platform window to the platform screen
platformWindow->setScreen(platformScreen); 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; qDebug() << Q_FUNC_INFO;
#endif #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; qDebug() << Q_FUNC_INFO;
#endif #endif
return m_eventDispatcher; return m_eventDispatcher;
} }
#ifndef QT_NO_CLIPBOARD #ifndef QT_NO_CLIPBOARD
QPlatformClipboard *QBBIntegration::clipboard() const QPlatformClipboard *QQnxIntegration::clipboard() const
{ {
#if defined(QBBINTEGRATION_DEBUG) #if defined(QQNXINTEGRATION_DEBUG)
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
#endif #endif
if (!m_clipboard) { if (!m_clipboard) {
m_clipboard = new QBBClipboard; m_clipboard = new QQnxClipboard;
} }
return m_clipboard; return m_clipboard;
} }
#endif #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; qDebug() << Q_FUNC_INFO;
#endif #endif
if (hint == ShowIsFullScreen) if (hint == ShowIsFullScreen)
@ -260,9 +260,9 @@ QVariant QBBIntegration::styleHint(QPlatformIntegration::StyleHint hint) const
return QPlatformIntegration::styleHint(hint); 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; qDebug() << Q_FUNC_INFO;
#endif #endif
QMutexLocker locker(&ms_windowMapperMutex); QMutexLocker locker(&ms_windowMapperMutex);
@ -270,9 +270,9 @@ QWindow *QBBIntegration::window(screen_window_t qnxWindow)
return ms_windowMapper.value(qnxWindow, 0); 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; qDebug() << Q_FUNC_INFO;
#endif #endif
QMutexLocker locker(&ms_windowMapperMutex); QMutexLocker locker(&ms_windowMapperMutex);
@ -280,9 +280,9 @@ void QBBIntegration::addWindow(screen_window_t qnxWindow, QWindow *window)
ms_windowMapper.insert(qnxWindow, 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; qDebug() << Q_FUNC_INFO;
#endif #endif
QMutexLocker locker(&ms_windowMapperMutex); QMutexLocker locker(&ms_windowMapperMutex);

View File

@ -39,8 +39,8 @@
** **
****************************************************************************/ ****************************************************************************/
#ifndef QBBINTEGRATION_H #ifndef QQNXINTEGRATION_H
#define QBBINTEGRATION_H #define QQNXINTEGRATION_H
#include <QtGui/qplatformintegration_qpa.h> #include <QtGui/qplatformintegration_qpa.h>
@ -50,23 +50,23 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QBBEventThread; class QQnxEventThread;
class QBBInputContext; class QQnxInputContext;
class QBBNavigatorThread; class QQnxNavigatorThread;
class QBBWindow; class QQnxWindow;
#ifndef QT_NO_CLIPBOARD #ifndef QT_NO_CLIPBOARD
class QBBClipboard; class QQnxClipboard;
#endif #endif
template<class K, class V> class QHash; 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: public:
QBBIntegration(); QQnxIntegration();
virtual ~QBBIntegration(); virtual ~QQnxIntegration();
virtual bool hasCapability(QPlatformIntegration::Capability cap) const; virtual bool hasCapability(QPlatformIntegration::Capability cap) const;
@ -98,22 +98,22 @@ private:
static void removeWindow(screen_window_t qnxWindow); static void removeWindow(screen_window_t qnxWindow);
screen_context_t m_screenContext; screen_context_t m_screenContext;
QBBEventThread *m_eventThread; QQnxEventThread *m_eventThread;
QBBNavigatorThread *m_navigatorThread; QQnxNavigatorThread *m_navigatorThread;
QBBInputContext *m_inputContext; QQnxInputContext *m_inputContext;
QPlatformFontDatabase *m_fontDatabase; QPlatformFontDatabase *m_fontDatabase;
bool m_paintUsingOpenGL; bool m_paintUsingOpenGL;
QAbstractEventDispatcher *m_eventDispatcher; QAbstractEventDispatcher *m_eventDispatcher;
#ifndef QT_NO_CLIPBOARD #ifndef QT_NO_CLIPBOARD
mutable QBBClipboard* m_clipboard; mutable QQnxClipboard* m_clipboard;
#endif #endif
static QBBWindowMapper ms_windowMapper; static QQnxWindowMapper ms_windowMapper;
static QMutex ms_windowMapperMutex; static QMutex ms_windowMapperMutex;
friend class QBBWindow; friend class QQnxWindow;
}; };
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QBBINTEGRATION_H #endif // QQNXINTEGRATION_H

View File

@ -39,12 +39,12 @@
** **
****************************************************************************/ ****************************************************************************/
#ifndef QBBKEYTRANSLATOR_H #ifndef QQNXKEYTRANSLATOR_H
#define QBBKEYTRANSLATOR_H #define QQNXKEYTRANSLATOR_H
#include <sys/keycodes.h> #include <sys/keycodes.h>
#if defined(QBBEVENTTHREAD_DEBUG) #if defined(QQNXEVENTTHREAD_DEBUG)
#include <QtCore/QDebug> #include <QtCore/QDebug>
#endif #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. // See keycodes.h for more, but these are all the basics. And printables are already included.
default: default:
#if defined(QBBEVENTTHREAD_DEBUG) #if defined(QQNXEVENTTHREAD_DEBUG)
qDebug() << "QBB: unknown key for translation:" << key; qDebug() << "QQNX: unknown key for translation:" << key;
#endif #endif
break; break;
} }
@ -266,4 +266,4 @@ bool isKeypadKey( int key )
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QBBKEYTRANSLATOR_H #endif // QQNXKEYTRANSLATOR_H

View File

@ -39,8 +39,8 @@
** **
****************************************************************************/ ****************************************************************************/
#include "qbbnavigatorthread.h" #include "qqnxnavigatorthread.h"
#include "qbbscreen.h" #include "qqnxscreen.h"
#include <QtGui/QGuiApplication> #include <QtGui/QGuiApplication>
#include <QtGui/QWindow> #include <QtGui/QWindow>
@ -61,14 +61,14 @@
static const char *navigatorControlPath = "/pps/services/navigator/control"; static const char *navigatorControlPath = "/pps/services/navigator/control";
static const int ppsBufferSize = 4096; static const int ppsBufferSize = 4096;
QBBNavigatorThread::QBBNavigatorThread(QBBScreen& primaryScreen) QQnxNavigatorThread::QQnxNavigatorThread(QQnxScreen& primaryScreen)
: m_primaryScreen(primaryScreen), : m_primaryScreen(primaryScreen),
m_fd(-1), m_fd(-1),
m_readNotifier(0) m_readNotifier(0)
{ {
} }
QBBNavigatorThread::~QBBNavigatorThread() QQnxNavigatorThread::~QQnxNavigatorThread()
{ {
// block until thread terminates // block until thread terminates
shutdown(); shutdown();
@ -76,17 +76,17 @@ QBBNavigatorThread::~QBBNavigatorThread()
delete m_readNotifier; delete m_readNotifier;
} }
void QBBNavigatorThread::run() void QQnxNavigatorThread::run()
{ {
#if defined(QBBNAVIGATORTHREAD_DEBUG) #if defined(QQNXNAVIGATORTHREAD_DEBUG)
qDebug() << "QBB: navigator thread started"; qDebug() << "QQNX: navigator thread started";
#endif #endif
// open connection to navigator // open connection to navigator
errno = 0; errno = 0;
m_fd = open(navigatorControlPath, O_RDWR); m_fd = open(navigatorControlPath, O_RDWR);
if (m_fd == -1) { 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; return;
} }
@ -99,15 +99,15 @@ void QBBNavigatorThread::run()
// close connection to navigator // close connection to navigator
close(m_fd); close(m_fd);
#if defined(QBBNAVIGATORTHREAD_DEBUG) #if defined(QQNXNAVIGATORTHREAD_DEBUG)
qDebug() << "QBB: navigator thread stopped"; qDebug() << "QQNX: navigator thread stopped";
#endif #endif
} }
void QBBNavigatorThread::shutdown() void QQnxNavigatorThread::shutdown()
{ {
#if defined(QBBNAVIGATORTHREAD_DEBUG) #if defined(QQNXNAVIGATORTHREAD_DEBUG)
qDebug() << "QBB: navigator thread shutdown begin"; qDebug() << "QQNX: navigator thread shutdown begin";
#endif #endif
// signal thread to terminate // signal thread to terminate
@ -116,14 +116,14 @@ void QBBNavigatorThread::shutdown()
// block until thread terminates // block until thread terminates
wait(); wait();
#if defined(QBBNAVIGATORTHREAD_DEBUG) #if defined(QQNXNAVIGATORTHREAD_DEBUG)
qDebug() << "QBB: navigator thread shutdown end"; qDebug() << "QQNX: navigator thread shutdown end";
#endif #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; qDebug() << "PPS: data=" << ppsData;
#endif #endif
@ -132,7 +132,7 @@ void QBBNavigatorThread::parsePPS(const QByteArray &ppsData, QByteArray &msg, QB
// validate pps object // validate pps object
if (lines.size() == 0 || lines.at(0) != "@control") { 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 // parse pps object attributes and extract values
@ -141,7 +141,7 @@ void QBBNavigatorThread::parsePPS(const QByteArray &ppsData, QByteArray &msg, QB
// tokenize current attribute // tokenize current attribute
const QByteArray &attr = lines.at(i); const QByteArray &attr = lines.at(i);
#if defined(QBBNAVIGATORTHREAD_DEBUG) #if defined(QQNXNAVIGATORTHREAD_DEBUG)
qDebug() << "PPS: attr=" << attr; qDebug() << "PPS: attr=" << attr;
#endif #endif
@ -160,7 +160,7 @@ void QBBNavigatorThread::parsePPS(const QByteArray &ppsData, QByteArray &msg, QB
QByteArray key = attr.left(firstColon); QByteArray key = attr.left(firstColon);
QByteArray value = attr.mid(secondColon + 1); QByteArray value = attr.mid(secondColon + 1);
#if defined(QBBNAVIGATORTHREAD_DEBUG) #if defined(QQNXNAVIGATORTHREAD_DEBUG)
qDebug() << "PPS: key=" << key; qDebug() << "PPS: key=" << key;
qDebug() << "PPS: val=" << value; qDebug() << "PPS: val=" << value;
#endif #endif
@ -173,12 +173,12 @@ void QBBNavigatorThread::parsePPS(const QByteArray &ppsData, QByteArray &msg, QB
} else if (key == "id") { } else if (key == "id") {
id = value; id = value;
} else { } 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 // construct pps message
QByteArray ppsData = "res::"; QByteArray ppsData = "res::";
@ -191,7 +191,7 @@ void QBBNavigatorThread::replyPPS(const QByteArray &res, const QByteArray &id, c
} }
ppsData += "\n"; ppsData += "\n";
#if defined(QBBNAVIGATORTHREAD_DEBUG) #if defined(QQNXNAVIGATORTHREAD_DEBUG)
qDebug() << "PPS reply=" << ppsData; qDebug() << "PPS reply=" << ppsData;
#endif #endif
@ -199,13 +199,13 @@ void QBBNavigatorThread::replyPPS(const QByteArray &res, const QByteArray &id, c
errno = 0; errno = 0;
int bytes = write(m_fd, ppsData.constData(), ppsData.size()); int bytes = write(m_fd, ppsData.constData(), ppsData.size());
if (bytes == -1) { 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; qDebug() << "PPS: msg=" << msg << ", dat=" << dat << ", id=" << id;
#endif #endif
@ -213,7 +213,7 @@ void QBBNavigatorThread::handleMessage(const QByteArray &msg, const QByteArray &
if (msg == "orientationCheck") { if (msg == "orientationCheck") {
// reply to navigator that (any) orientation is acceptable // reply to navigator that (any) orientation is acceptable
#if defined(QBBNAVIGATORTHREAD_DEBUG) #if defined(QQNXNAVIGATORTHREAD_DEBUG)
qDebug() << "PPS: orientation check, o=" << dat; qDebug() << "PPS: orientation check, o=" << dat;
#endif #endif
replyPPS(msg, id, "true"); replyPPS(msg, id, "true");
@ -221,7 +221,7 @@ void QBBNavigatorThread::handleMessage(const QByteArray &msg, const QByteArray &
} else if (msg == "orientation") { } else if (msg == "orientation") {
// update screen geometry and reply to navigator that we're ready // update screen geometry and reply to navigator that we're ready
#if defined(QBBNAVIGATORTHREAD_DEBUG) #if defined(QQNXNAVIGATORTHREAD_DEBUG)
qDebug() << "PPS: orientation, o=" << dat; qDebug() << "PPS: orientation, o=" << dat;
#endif #endif
m_primaryScreen.setRotation( dat.toInt() ); m_primaryScreen.setRotation( dat.toInt() );
@ -231,7 +231,7 @@ void QBBNavigatorThread::handleMessage(const QByteArray &msg, const QByteArray &
} else if (msg == "SWIPE_DOWN") { } else if (msg == "SWIPE_DOWN") {
// simulate menu key press // simulate menu key press
#if defined(QBBNAVIGATORTHREAD_DEBUG) #if defined(QQNXNAVIGATORTHREAD_DEBUG)
qDebug() << "PPS: menu"; qDebug() << "PPS: menu";
#endif #endif
QWindow *w = QGuiApplication::focusWindow(); QWindow *w = QGuiApplication::focusWindow();
@ -241,17 +241,17 @@ void QBBNavigatorThread::handleMessage(const QByteArray &msg, const QByteArray &
} else if (msg == "exit") { } else if (msg == "exit") {
// shutdown everything // shutdown everything
#if defined(QBBNAVIGATORTHREAD_DEBUG) #if defined(QQNXNAVIGATORTHREAD_DEBUG)
qDebug() << "PPS: exit"; qDebug() << "PPS: exit";
#endif #endif
QCoreApplication::quit(); QCoreApplication::quit();
} }
} }
void QBBNavigatorThread::readData() void QQnxNavigatorThread::readData()
{ {
#if defined(QBBNAVIGATORTHREAD_DEBUG) #if defined(QQNXNAVIGATORTHREAD_DEBUG)
qDebug() << "QBB: reading navigator data"; qDebug() << "QQNX: reading navigator data";
#endif #endif
// allocate buffer for pps data // allocate buffer for pps data
char buffer[ppsBufferSize]; char buffer[ppsBufferSize];
@ -260,7 +260,7 @@ void QBBNavigatorThread::readData()
errno = 0; errno = 0;
int bytes = qt_safe_read(m_fd, buffer, ppsBufferSize - 1); int bytes = qt_safe_read(m_fd, buffer, ppsBufferSize - 1);
if (bytes == -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 // check if pps data was received

View File

@ -39,22 +39,22 @@
** **
****************************************************************************/ ****************************************************************************/
#ifndef QBBNAVIGATORTHREAD_H #ifndef QQNXNAVIGATORTHREAD_H
#define QBBNAVIGATORTHREAD_H #define QQNXNAVIGATORTHREAD_H
#include <QThread> #include <QThread>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QBBScreen; class QQnxScreen;
class QSocketNotifier; class QSocketNotifier;
class QBBNavigatorThread : public QThread class QQnxNavigatorThread : public QThread
{ {
Q_OBJECT Q_OBJECT
public: public:
QBBNavigatorThread(QBBScreen &primaryScreen); QQnxNavigatorThread(QQnxScreen &primaryScreen);
virtual ~QBBNavigatorThread(); virtual ~QQnxNavigatorThread();
protected: protected:
virtual void run(); virtual void run();
@ -68,11 +68,11 @@ private:
void replyPPS(const QByteArray &res, const QByteArray &id, const QByteArray &dat); void replyPPS(const QByteArray &res, const QByteArray &id, const QByteArray &dat);
void handleMessage(const QByteArray &msg, const QByteArray &dat, const QByteArray &id); void handleMessage(const QByteArray &msg, const QByteArray &dat, const QByteArray &id);
QBBScreen &m_primaryScreen; QQnxScreen &m_primaryScreen;
int m_fd; int m_fd;
QSocketNotifier *m_readNotifier; QSocketNotifier *m_readNotifier;
}; };
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QBBNAVIGATORTHREAD_H #endif // QQNXNAVIGATORTHREAD_H

View File

@ -39,8 +39,8 @@
** **
****************************************************************************/ ****************************************************************************/
#include "qbbrasterbackingstore.h" #include "qqnxrasterbackingstore.h"
#include "qbbwindow.h" #include "qqnxwindow.h"
#include <QtCore/QDebug> #include <QtCore/QDebug>
@ -48,36 +48,36 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
QBBRasterBackingStore::QBBRasterBackingStore(QWindow *window) QQnxRasterBackingStore::QQnxRasterBackingStore(QWindow *window)
: QPlatformBackingStore(window) : QPlatformBackingStore(window)
{ {
#if defined(QBBRASTERBACKINGSTORE_DEBUG) #if defined(QQNXRASTERBACKINGSTORE_DEBUG)
qDebug() << "QBBRasterBackingStore::QBBRasterBackingStore - w=" << window; qDebug() << "QQnxRasterBackingStore::QQnxRasterBackingStore - w=" << window;
#endif #endif
// save platform window associated with widget // 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) #if defined(QQnxRasterBackingStore_DEBUG)
qDebug() << "QBBRasterBackingStore::~QBBRasterBackingStore - w=" << window(); qDebug() << "QQnxRasterBackingStore::~QQnxRasterBackingStore - w=" << window();
#endif #endif
} }
QPaintDevice *QBBRasterBackingStore::paintDevice() QPaintDevice *QQnxRasterBackingStore::paintDevice()
{ {
return m_platformWindow->renderBuffer().image(); return m_platformWindow->renderBuffer().image();
} }
void QBBRasterBackingStore::flush(QWindow *window, const QRegion &region, const QPoint &offset) void QQnxRasterBackingStore::flush(QWindow *window, const QRegion &region, const QPoint &offset)
{ {
Q_UNUSED(window); Q_UNUSED(window);
Q_UNUSED(offset); Q_UNUSED(offset);
#if defined(QBBRASTERBACKINGSTORE_DEBUG) #if defined(QQNXRASTERBACKINGSTORE_DEBUG)
qDebug() << "QBBRasterBackingStore::flush - w=" << this->window(); qDebug() << "QQnxRasterBackingStore::flush - w=" << this->window();
#endif #endif
// visit all pending scroll operations // visit all pending scroll operations
@ -96,22 +96,22 @@ void QBBRasterBackingStore::flush(QWindow *window, const QRegion &region, const
m_platformWindow->post(region); 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(size);
Q_UNUSED(staticContents); Q_UNUSED(staticContents);
#if defined(QBBRASTERBACKINGSTORE_DEBUG) #if defined(QQNXRASTERBACKINGSTORE_DEBUG)
qDebug() << "QBBRasterBackingStore::resize - w=" << window() << ", s=" << size; qDebug() << "QQnxRasterBackingStore::resize - w=" << window() << ", s=" << size;
#endif #endif
// NOTE: defer resizing window buffers until next paint as // NOTE: defer resizing window buffers until next paint as
// resize() can be called multiple times before a paint occurs // 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) #if defined(QQNXRASTERBACKINGSTORE_DEBUG)
qDebug() << "QBBRasterBackingStore::scroll - w=" << window(); qDebug() << "QQnxRasterBackingStore::scroll - w=" << window();
#endif #endif
// calculate entire region affected by scroll operation (src + dst) // 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)) { } else if (op.totalArea.intersects(totalArea)) {
// current scroll overlaps previous scroll but is // current scroll overlaps previous scroll but is
// not equal in area - just paint everything // 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; return false;
} }
} }
@ -140,12 +140,12 @@ bool QBBRasterBackingStore::scroll(const QRegion &area, int dx, int dy)
return true; return true;
} }
void QBBRasterBackingStore::beginPaint(const QRegion &region) void QQnxRasterBackingStore::beginPaint(const QRegion &region)
{ {
Q_UNUSED(region); Q_UNUSED(region);
#if defined(QBBRASTERBACKINGSTORE_DEBUG) #if defined(QQNXRASTERBACKINGSTORE_DEBUG)
qDebug() << "QBBRasterBackingStore::beginPaint - w=" << window(); qDebug() << "QQnxRasterBackingStore::beginPaint - w=" << window();
#endif #endif
// resize window buffers if surface resized // resize window buffers if surface resized
@ -155,11 +155,11 @@ void QBBRasterBackingStore::beginPaint(const QRegion &region)
} }
} }
void QBBRasterBackingStore::endPaint(const QRegion &region) void QQnxRasterBackingStore::endPaint(const QRegion &region)
{ {
Q_UNUSED(region); Q_UNUSED(region);
#if defined(QBBRasterBackingStore_DEBUG) #if defined(QQnxRasterBackingStore_DEBUG)
qDebug() << "QBBRasterBackingStore::endPaint - w=" << window(); qDebug() << "QQnxRasterBackingStore::endPaint - w=" << window();
#endif #endif
} }

View File

@ -39,8 +39,8 @@
** **
****************************************************************************/ ****************************************************************************/
#ifndef QBBRASTERWINDOWSURFACE_H #ifndef QQNXRASTERWINDOWSURFACE_H
#define QBBRASTERWINDOWSURFACE_H #define QQNXRASTERWINDOWSURFACE_H
#include <QtGui/qplatformbackingstore_qpa.h> #include <QtGui/qplatformbackingstore_qpa.h>
@ -48,13 +48,13 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QBBWindow; class QQnxWindow;
class QBBRasterBackingStore : public QPlatformBackingStore class QQnxRasterBackingStore : public QPlatformBackingStore
{ {
public: public:
QBBRasterBackingStore(QWindow *window); QQnxRasterBackingStore(QWindow *window);
virtual ~QBBRasterBackingStore(); virtual ~QQnxRasterBackingStore();
virtual QPaintDevice *paintDevice(); virtual QPaintDevice *paintDevice();
virtual void flush(QWindow *window, const QRegion &region, const QPoint &offset); virtual void flush(QWindow *window, const QRegion &region, const QPoint &offset);
@ -72,10 +72,10 @@ private:
int dy; int dy;
}; };
QBBWindow *m_platformWindow; QQnxWindow *m_platformWindow;
QList<ScrollOp> m_scrollOpList; QList<ScrollOp> m_scrollOpList;
}; };
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QBBRASTERWINDOWSURFACE_H #endif // QQNXRASTERWINDOWSURFACE_H

View File

@ -39,13 +39,13 @@
** **
****************************************************************************/ ****************************************************************************/
#include "qbbrootwindow.h" #include "qqnxrootwindow.h"
#include "qbbscreen.h" #include "qqnxscreen.h"
#include <QtCore/QUuid> #include <QtCore/QUuid>
#if defined(QBBROOTWINDOW_DEBUG) #if defined(QQNXROOTWINDOW_DEBUG)
#include <QtCore/QDebug> #include <QtCore/QDebug>
#endif #endif
@ -54,12 +54,12 @@
static const int MAGIC_ZORDER_FOR_NO_NAV = 10; static const int MAGIC_ZORDER_FOR_NO_NAV = 10;
QBBRootWindow::QBBRootWindow(QBBScreen *screen) QQnxRootWindow::QQnxRootWindow(QQnxScreen *screen)
: m_screen(screen), : m_screen(screen),
m_window(0), m_window(0),
m_windowGroupName() m_windowGroupName()
{ {
#if defined(QBBROOTWINDOW_DEBUG) #if defined(QQNXROOTWINDOW_DEBUG)
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
#endif #endif
// Create one top-level QNX window to act as a container for child windows // 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 result = screen_create_window(&m_window, m_screen->nativeContext());
int val[2]; int val[2];
if (result != 0) { 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 // Move window to proper display
@ -76,7 +76,7 @@ QBBRootWindow::QBBRootWindow(QBBScreen *screen)
screen_display_t display = m_screen->nativeDisplay(); screen_display_t display = m_screen->nativeDisplay();
result = screen_set_window_property_pv(m_window, SCREEN_PROPERTY_DISPLAY, (void **)&display); result = screen_set_window_property_pv(m_window, SCREEN_PROPERTY_DISPLAY, (void **)&display);
if (result != 0) { 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 // 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; val[0] = MAGIC_ZORDER_FOR_NO_NAV;
result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_ZORDER, val); result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_ZORDER, val);
if (result != 0) { 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; val[0] = SCREEN_USAGE_NATIVE;
result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_USAGE, val); result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_USAGE, val);
if (result != 0) { 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; errno = 0;
val[0] = m_screen->nativeFormat(); val[0] = m_screen->nativeFormat();
result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_FORMAT, val); result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_FORMAT, val);
if (result != 0) { 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; errno = 0;
@ -110,13 +110,13 @@ QBBRootWindow::QBBRootWindow(QBBScreen *screen)
val[1] = 1; val[1] = 1;
result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_BUFFER_SIZE, val); result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_BUFFER_SIZE, val);
if (result != 0) { 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; errno = 0;
result = screen_create_window_buffers(m_window, 1); result = screen_create_window_buffers(m_window, 1);
if (result != 0) { 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 // Window is always the size of the display
@ -126,7 +126,7 @@ QBBRootWindow::QBBRootWindow(QBBScreen *screen)
val[1] = geometry.height(); val[1] = geometry.height();
result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SIZE, val); result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SIZE, val);
if (result != 0) { 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 // Fill the window with solid black
@ -134,7 +134,7 @@ QBBRootWindow::QBBRootWindow(QBBScreen *screen)
val[0] = 0; val[0] = 0;
result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_COLOR, val); result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_COLOR, val);
if (result != 0) { 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 // Make the window opaque
@ -142,7 +142,7 @@ QBBRootWindow::QBBRootWindow(QBBScreen *screen)
val[0] = SCREEN_TRANSPARENCY_NONE; val[0] = SCREEN_TRANSPARENCY_NONE;
result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_TRANSPARENCY, val); result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_TRANSPARENCY, val);
if (result != 0) { 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 // Set the swap interval to 1
@ -150,7 +150,7 @@ QBBRootWindow::QBBRootWindow(QBBScreen *screen)
val[0] = 1; val[0] = 1;
result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SWAP_INTERVAL, val); result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SWAP_INTERVAL, val);
if (result != 0) { 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 // 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(); val[1] = geometry.height();
result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SOURCE_SIZE, val); result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SOURCE_SIZE, val);
if (result != 0) { 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; errno = 0;
@ -167,83 +167,83 @@ QBBRootWindow::QBBRootWindow(QBBScreen *screen)
val[1] = 0; val[1] = 0;
result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SOURCE_POSITION, val); result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SOURCE_POSITION, val);
if (result != 0) { 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(); createWindowGroup();
post(); post();
} }
QBBRootWindow::~QBBRootWindow() QQnxRootWindow::~QQnxRootWindow()
{ {
// Cleanup top-level QNX window // Cleanup top-level QNX window
screen_destroy_window(m_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; qDebug() << Q_FUNC_INFO;
#endif #endif
errno = 0; errno = 0;
screen_buffer_t buffer; screen_buffer_t buffer;
int result = screen_get_window_property_pv(m_window, SCREEN_PROPERTY_RENDER_BUFFERS, (void **)&buffer); int result = screen_get_window_property_pv(m_window, SCREEN_PROPERTY_RENDER_BUFFERS, (void **)&buffer);
if (result != 0) { 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; errno = 0;
int dirtyRect[] = {0, 0, 1, 1}; int dirtyRect[] = {0, 0, 1, 1};
result = screen_post_window(m_window, buffer, 1, dirtyRect, 0); result = screen_post_window(m_window, buffer, 1, dirtyRect, 0);
if (result != 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; qDebug() << Q_FUNC_INFO;
#endif #endif
// Force immediate display update // Force immediate display update
errno = 0; errno = 0;
int result = screen_flush_context(m_screen->nativeContext(), 0); int result = screen_flush_context(m_screen->nativeContext(), 0);
if (result != 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; qDebug() << Q_FUNC_INFO << "angle =" << rotation;
#endif #endif
errno = 0; errno = 0;
int result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_ROTATION, &rotation); int result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_ROTATION, &rotation);
if (result != 0) { 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; errno = 0;
int val[] = {size.width(), size.height()}; int val[] = {size.width(), size.height()};
int result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SIZE, val); int result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SIZE, val);
if (result != 0) { 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; errno = 0;
result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SOURCE_SIZE, val); result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SOURCE_SIZE, val);
if (result != 0) { 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 // NOTE: display will update when child windows relayout and repaint
} }
void QBBRootWindow::createWindowGroup() void QQnxRootWindow::createWindowGroup()
{ {
// Generate a random window group name // Generate a random window group name
m_windowGroupName = QUuid::createUuid().toString().toAscii(); m_windowGroupName = QUuid::createUuid().toString().toAscii();
@ -252,6 +252,6 @@ void QBBRootWindow::createWindowGroup()
errno = 0; errno = 0;
int result = screen_create_window_group(m_window, m_windowGroupName.constData()); int result = screen_create_window_group(m_window, m_windowGroupName.constData());
if (result != 0) { 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);
} }
} }

View File

@ -39,8 +39,8 @@
** **
****************************************************************************/ ****************************************************************************/
#ifndef QBBROOTWINDOW_H #ifndef QQNXROOTWINDOW_H
#define QBBROOTWINDOW_H #define QQNXROOTWINDOW_H
#include <QtCore/QByteArray> #include <QtCore/QByteArray>
#include <QtCore/QRect> #include <QtCore/QRect>
@ -49,13 +49,13 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QBBScreen; class QQnxScreen;
class QBBRootWindow class QQnxRootWindow
{ {
public: public:
QBBRootWindow(QBBScreen *screen); QQnxRootWindow(QQnxScreen *screen);
~QBBRootWindow(); ~QQnxRootWindow();
screen_window_t nativeHandle() const { return m_window; } screen_window_t nativeHandle() const { return m_window; }
@ -71,11 +71,11 @@ public:
private: private:
void createWindowGroup(); void createWindowGroup();
QBBScreen *m_screen; QQnxScreen *m_screen;
screen_window_t m_window; screen_window_t m_window;
QByteArray m_windowGroupName; QByteArray m_windowGroupName;
}; };
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QBBROOTWINDOW_H #endif // QQNXROOTWINDOW_H

View File

@ -39,9 +39,9 @@
** **
****************************************************************************/ ****************************************************************************/
#include "qbbscreen.h" #include "qqnxscreen.h"
#include "qbbvirtualkeyboard.h" #include "qqnxvirtualkeyboard.h"
#include "qbbwindow.h" #include "qqnxwindow.h"
#include <QtCore/QDebug> #include <QtCore/QDebug>
#include <QtCore/QUuid> #include <QtCore/QUuid>
@ -50,10 +50,10 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
QList<QPlatformScreen *> QBBScreen::ms_screens; QList<QPlatformScreen *> QQnxScreen::ms_screens;
QList<QBBWindow*> QBBScreen::ms_childWindows; 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_screenContext(screenContext),
m_display(display), m_display(display),
m_rootWindow(), m_rootWindow(),
@ -61,7 +61,7 @@ QBBScreen::QBBScreen(screen_context_t screenContext, screen_display_t display, b
m_posted(false), m_posted(false),
m_platformContext(0) m_platformContext(0)
{ {
#if defined(QBBSCREEN_DEBUG) #if defined(QQNXSCREEN_DEBUG)
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
#endif #endif
// Cache initial orientation of this display // Cache initial orientation of this display
@ -69,7 +69,7 @@ QBBScreen::QBBScreen(screen_context_t screenContext, screen_display_t display, b
errno = 0; errno = 0;
int result = screen_get_display_property_iv(m_display, SCREEN_PROPERTY_ROTATION, &m_initialRotation); int result = screen_get_display_property_iv(m_display, SCREEN_PROPERTY_ROTATION, &m_initialRotation);
if (result != 0) { 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; m_currentRotation = m_initialRotation;
@ -79,7 +79,7 @@ QBBScreen::QBBScreen(screen_context_t screenContext, screen_display_t display, b
int val[2]; int val[2];
result = screen_get_display_property_iv(m_display, SCREEN_PROPERTY_SIZE, val); result = screen_get_display_property_iv(m_display, SCREEN_PROPERTY_SIZE, val);
if (result != 0) { 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]); 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; errno = 0;
result = screen_get_display_property_iv(m_display, SCREEN_PROPERTY_PHYSICAL_SIZE, val); result = screen_get_display_property_iv(m_display, SCREEN_PROPERTY_PHYSICAL_SIZE, val);
if (result != 0) { 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 // 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. // We only create the root window if we are the primary display.
if (primaryScreen) 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; qDebug() << Q_FUNC_INFO;
#endif #endif
} }
/* static */ /* 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; qDebug() << Q_FUNC_INFO;
#endif #endif
// Query number of displays // Query number of displays
@ -125,7 +125,7 @@ void QBBScreen::createDisplays(screen_context_t context)
int displayCount; int displayCount;
int result = screen_get_context_property_iv(context, SCREEN_PROPERTY_DISPLAY_COUNT, &displayCount); int result = screen_get_context_property_iv(context, SCREEN_PROPERTY_DISPLAY_COUNT, &displayCount);
if (result != 0) { 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 // 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); 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); result = screen_get_context_property_pv(context, SCREEN_PROPERTY_DISPLAYS, (void **)displays);
if (result != 0) { 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++) { for (int i=0; i<displayCount; i++) {
#if defined(QBBSCREEN_DEBUG) #if defined(QQNXSCREEN_DEBUG)
qDebug() << "QBBScreen::Creating screen for display " << i; qDebug() << "QQnxScreen::Creating screen for display " << i;
#endif #endif
QBBScreen *screen = new QBBScreen(context, displays[i], i==0); QQnxScreen *screen = new QQnxScreen(context, displays[i], i==0);
ms_screens.append(screen); ms_screens.append(screen);
} }
} }
/* static */ /* static */
void QBBScreen::destroyDisplays() void QQnxScreen::destroyDisplays()
{ {
#if defined(QBBSCREEN_DEBUG) #if defined(QQNXSCREEN_DEBUG)
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
#endif #endif
qDeleteAll(ms_screens); qDeleteAll(ms_screens);
@ -159,16 +159,16 @@ void QBBScreen::destroyDisplays()
} }
/* static */ /* static */
int QBBScreen::defaultDepth() int QQnxScreen::defaultDepth()
{ {
#if defined(QBBSCREEN_DEBUG) #if defined(QQNXSCREEN_DEBUG)
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
#endif #endif
static int defaultDepth = 0; static int defaultDepth = 0;
if (defaultDepth == 0) { if (defaultDepth == 0) {
// check if display depth was specified in environment variable; // check if display depth was specified in environment variable;
// use default value if no valid value found // 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) { if (defaultDepth != 16 && defaultDepth != 32) {
defaultDepth = 32; defaultDepth = 32;
} }
@ -176,13 +176,13 @@ int QBBScreen::defaultDepth()
return defaultDepth; return defaultDepth;
} }
QRect QBBScreen::availableGeometry() const QRect QQnxScreen::availableGeometry() const
{ {
#if defined(QBBSCREEN_DEBUG) #if defined(QQNXSCREEN_DEBUG)
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
#endif #endif
// available geometry = total geometry - keyboard // available geometry = total geometry - keyboard
int keyboardHeight = QBBVirtualKeyboard::instance().height(); int keyboardHeight = QQnxVirtualKeyboard::instance().height();
return QRect(m_currentGeometry.x(), m_currentGeometry.y(), return QRect(m_currentGeometry.x(), m_currentGeometry.y(),
m_currentGeometry.width(), m_currentGeometry.height() - keyboardHeight); m_currentGeometry.width(), m_currentGeometry.height() - keyboardHeight);
} }
@ -195,9 +195,9 @@ static bool isOrthogonal(int angle1, int angle2)
return ((angle1 - angle2) % 180) != 0; 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; qDebug() << Q_FUNC_INFO << "orientation =" << rotation;
#endif #endif
// Check if rotation changed // 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 // Resize root window if we've rotated 90 or 270 from previous orientation
if (isOrthogonal(m_currentRotation, rotation)) { if (isOrthogonal(m_currentRotation, rotation)) {
#if defined(QBBSCREEN_DEBUG) #if defined(QQNXSCREEN_DEBUG)
qDebug() << Q_FUNC_INFO << "resize, size =" << m_currentGeometry.size(); qDebug() << Q_FUNC_INFO << "resize, size =" << m_currentGeometry.size();
#endif #endif
if (m_rootWindow) 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; qDebug() << Q_FUNC_INFO << "window =" << window;
#endif #endif
@ -244,48 +244,48 @@ void QBBScreen::addWindow(QBBWindow *window)
return; return;
ms_childWindows.push_back(window); 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; qDebug() << Q_FUNC_INFO << "window =" << window;
#endif #endif
ms_childWindows.removeAll(window); 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; qDebug() << Q_FUNC_INFO << "window =" << window;
#endif #endif
removeWindow(window); removeWindow(window);
ms_childWindows.push_back(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; qDebug() << Q_FUNC_INFO << "window =" << window;
#endif #endif
removeWindow(window); removeWindow(window);
ms_childWindows.push_front(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; qDebug() << Q_FUNC_INFO;
#endif #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 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++) for (it = ms_childWindows.begin(); it != ms_childWindows.end(); it++)
@ -296,9 +296,9 @@ void QBBScreen::updateHierarchy()
screen_flush_context( primaryDisplay()->m_screenContext, 0 ); 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; qDebug() << Q_FUNC_INFO;
#endif #endif
Q_UNUSED(window) Q_UNUSED(window)

View File

@ -44,7 +44,7 @@
#include <QtGui/QPlatformScreen> #include <QtGui/QPlatformScreen>
#include "qbbrootwindow.h" #include "qqnxrootwindow.h"
#include <QtCore/QByteArray> #include <QtCore/QByteArray>
#include <QtCore/QScopedPointer> #include <QtCore/QScopedPointer>
@ -53,15 +53,15 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QBBWindow; class QQnxWindow;
class QBBScreen : public QPlatformScreen class QQnxScreen : public QPlatformScreen
{ {
public: public:
static QList<QPlatformScreen *> screens() { return ms_screens; } static QList<QPlatformScreen *> screens() { return ms_screens; }
static void createDisplays(screen_context_t context); static void createDisplays(screen_context_t context);
static void destroyDisplays(); 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(); static int defaultDepth();
virtual QRect geometry() const { return m_currentGeometry; } virtual QRect geometry() const { return m_currentGeometry; }
@ -81,25 +81,25 @@ public:
const char *windowGroupName() const { return m_rootWindow->groupName().constData(); } const char *windowGroupName() const { return m_rootWindow->groupName().constData(); }
/* Window hierarchy management */ /* Window hierarchy management */
static void addWindow(QBBWindow *child); static void addWindow(QQnxWindow *child);
static void removeWindow(QBBWindow *child); static void removeWindow(QQnxWindow *child);
static void raiseWindow(QBBWindow *window); static void raiseWindow(QQnxWindow *window);
static void lowerWindow(QBBWindow *window); static void lowerWindow(QQnxWindow *window);
static void updateHierarchy(); 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: private:
QBBScreen(screen_context_t context, screen_display_t display, bool primaryScreen); QQnxScreen(screen_context_t context, screen_display_t display, bool primaryScreen);
virtual ~QBBScreen(); virtual ~QQnxScreen();
static bool orthogonal(int rotation1, int rotation2); static bool orthogonal(int rotation1, int rotation2);
screen_context_t m_screenContext; screen_context_t m_screenContext;
screen_display_t m_display; screen_display_t m_display;
QSharedPointer<QBBRootWindow> m_rootWindow; QSharedPointer<QQnxRootWindow> m_rootWindow;
bool m_primaryScreen; bool m_primaryScreen;
bool m_posted; bool m_posted;
bool m_usingOpenGL; bool m_usingOpenGL;
@ -113,7 +113,7 @@ private:
QPlatformOpenGLContext *m_platformContext; QPlatformOpenGLContext *m_platformContext;
static QList<QPlatformScreen *> ms_screens; static QList<QPlatformScreen *> ms_screens;
static QList<QBBWindow *> ms_childWindows; static QList<QQnxWindow *> ms_childWindows;
}; };
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -39,8 +39,8 @@
** **
****************************************************************************/ ****************************************************************************/
#include "qbbvirtualkeyboard.h" #include "qqnxvirtualkeyboard.h"
#include "qbbscreen.h" #include "qqnxscreen.h"
#include <QtGui/QPlatformScreen> #include <QtGui/QPlatformScreen>
#include <QtGui/QPlatformWindow> #include <QtGui/QPlatformWindow>
@ -57,15 +57,15 @@
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h> #include <unistd.h>
const char *QBBVirtualKeyboard::ms_PPSPath = "/pps/services/input/control?wait"; const char *QQnxVirtualKeyboard::ms_PPSPath = "/pps/services/input/control?wait";
const size_t QBBVirtualKeyboard::ms_bufferSize = 2048; 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. // Huge hack for keyboard shadow (see QNX PR 88400). Should be removed ASAP.
#define KEYBOARD_SHADOW_HEIGHT 8 #define KEYBOARD_SHADOW_HEIGHT 8
QBBVirtualKeyboard::QBBVirtualKeyboard() : QQnxVirtualKeyboard::QQnxVirtualKeyboard() :
m_encoder(NULL), m_encoder(NULL),
m_decoder(NULL), m_decoder(NULL),
m_buffer(NULL), m_buffer(NULL),
@ -78,16 +78,16 @@ QBBVirtualKeyboard::QBBVirtualKeyboard() :
connect(); connect();
} }
QBBVirtualKeyboard::~QBBVirtualKeyboard() QQnxVirtualKeyboard::~QQnxVirtualKeyboard()
{ {
close(); close();
} }
/* static */ /* static */
QBBVirtualKeyboard& QBBVirtualKeyboard::instance() QQnxVirtualKeyboard& QQnxVirtualKeyboard::instance()
{ {
if (!s_instance) { if (!s_instance) {
s_instance = new QBBVirtualKeyboard(); s_instance = new QQnxVirtualKeyboard();
s_instance->start(); s_instance->start();
} }
@ -95,7 +95,7 @@ QBBVirtualKeyboard& QBBVirtualKeyboard::instance()
} }
/* static */ /* static */
void QBBVirtualKeyboard::destroy() void QQnxVirtualKeyboard::destroy()
{ {
if (s_instance) { if (s_instance) {
delete s_instance; delete s_instance;
@ -103,7 +103,7 @@ void QBBVirtualKeyboard::destroy()
} }
} }
void QBBVirtualKeyboard::close() void QQnxVirtualKeyboard::close()
{ {
if (m_fd) { if (m_fd) {
// any reads will fail after we close the fd, which is basically what we want. // 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; m_buffer = NULL;
} }
bool QBBVirtualKeyboard::connect() bool QQnxVirtualKeyboard::connect()
{ {
close(); close();
@ -150,7 +150,7 @@ bool QBBVirtualKeyboard::connect()
m_fd = ::open(ms_PPSPath, O_RDWR); m_fd = ::open(ms_PPSPath, O_RDWR);
if (m_fd == -1) 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); ms_PPSPath, strerror(errno), errno);
close(); close();
return false; return false;
@ -158,7 +158,7 @@ bool QBBVirtualKeyboard::connect()
m_buffer = new char[ms_bufferSize]; m_buffer = new char[ms_bufferSize];
if (!m_buffer) { 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; return false;
} }
@ -170,7 +170,7 @@ bool QBBVirtualKeyboard::connect()
return true; return true;
} }
bool QBBVirtualKeyboard::queryPPSInfo() bool QQnxVirtualKeyboard::queryPPSInfo()
{ {
// Request info, requires id to regenerate res message. // Request info, requires id to regenerate res message.
pps_encoder_add_string(m_encoder, "msg", "info"); pps_encoder_add_string(m_encoder, "msg", "info");
@ -186,44 +186,44 @@ bool QBBVirtualKeyboard::queryPPSInfo()
return true; return true;
} }
void QBBVirtualKeyboard::notifyClientActiveStateChange(bool active) void QQnxVirtualKeyboard::notifyClientActiveStateChange(bool active)
{ {
if (!active) if (!active)
hideKeyboard(); hideKeyboard();
} }
void QBBVirtualKeyboard::run() void QQnxVirtualKeyboard::run()
{ {
ppsDataReady(); ppsDataReady();
} }
void QBBVirtualKeyboard::ppsDataReady() void QQnxVirtualKeyboard::ppsDataReady()
{ {
while (1) { while (1) {
ssize_t nread = read(m_fd, m_buffer, ms_bufferSize - 1); ssize_t nread = read(m_fd, m_buffer, ms_bufferSize - 1);
#ifdef QBBVIRTUALKEYBOARD_DEBUG #ifdef QQNXVIRTUALKEYBOARD_DEBUG
qDebug() << "QBB: keyboardMessage size: " << nread; qDebug() << "QQNX: keyboardMessage size: " << nread;
#endif #endif
if (nread < 0) if (nread < 0)
break; break;
// nread is the real space necessary, not the amount read. // nread is the real space necessary, not the amount read.
if (static_cast<size_t>(nread) > ms_bufferSize - 1) { 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; break;
} }
m_buffer[nread] = 0; m_buffer[nread] = 0;
pps_decoder_parse_pps_str(m_decoder, m_buffer); pps_decoder_parse_pps_str(m_decoder, m_buffer);
pps_decoder_push(m_decoder, NULL); pps_decoder_push(m_decoder, NULL);
#ifdef QBBVIRTUALKEYBOARD_DEBUG #ifdef QQNXVIRTUALKEYBOARD_DEBUG
pps_decoder_dump_tree(m_decoder, stderr); pps_decoder_dump_tree(m_decoder, stderr);
#endif #endif
const char *value; const char *value;
if (pps_decoder_get_string(m_decoder, "error", &value) == PPS_DECODER_OK) { 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; continue;
} }
@ -244,48 +244,48 @@ void QBBVirtualKeyboard::ppsDataReady()
handleKeyboardInfoMessage(); handleKeyboardInfoMessage();
else if (strcmp(value, "connect") == 0) { } else if (strcmp(value, "connect") == 0) { }
else 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) { } else if (pps_decoder_get_string(m_decoder, "res", &value) == PPS_DECODER_OK) {
if (strcmp(value, "info") == 0) if (strcmp(value, "info") == 0)
handleKeyboardInfoMessage(); handleKeyboardInfoMessage();
else else
qCritical("QBBVirtualKeyboard: Unexpected keyboard PPS res value: %s", value ? value : "[null]"); qCritical("QQnxVirtualKeyboard: Unexpected keyboard PPS res value: %s", value ? value : "[null]");
} else } else
qCritical("QBBVirtualKeyboard: Unexpected keyboard PPS message type"); qCritical("QQnxVirtualKeyboard: Unexpected keyboard PPS message type");
} }
#ifdef QBBVIRTUALKEYBOARD_DEBUG #ifdef QQNXVIRTUALKEYBOARD_DEBUG
qDebug() << "QBB: exiting keyboard thread"; qDebug() << "QQNX: exiting keyboard thread";
#endif #endif
if (m_decoder) if (m_decoder)
pps_decoder_cleanup(m_decoder); pps_decoder_cleanup(m_decoder);
} }
void QBBVirtualKeyboard::handleKeyboardInfoMessage() void QQnxVirtualKeyboard::handleKeyboardInfoMessage()
{ {
int newHeight = 0; int newHeight = 0;
const char *value; const char *value;
if (pps_decoder_push(m_decoder, "dat") != PPS_DECODER_OK) { 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; return;
} }
if (pps_decoder_get_int(m_decoder, "size", &newHeight) != PPS_DECODER_OK) { 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; return;
} }
if (pps_decoder_push(m_decoder, "locale") != PPS_DECODER_OK) { 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; return;
} }
if (pps_decoder_get_string(m_decoder, "languageId", &value) != PPS_DECODER_OK) { 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; return;
} }
const QString languageId = QString::fromLatin1(value); const QString languageId = QString::fromLatin1(value);
if (pps_decoder_get_string(m_decoder, "countryId", &value) != PPS_DECODER_OK) { 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; return;
} }
const QString countryId = QString::fromLatin1(value); const QString countryId = QString::fromLatin1(value);
@ -304,16 +304,16 @@ void QBBVirtualKeyboard::handleKeyboardInfoMessage()
emit localeChanged(locale); emit localeChanged(locale);
} }
#ifdef QBBVIRTUALKEYBOARD_DEBUG #ifdef QQNXVIRTUALKEYBOARD_DEBUG
qDebug() << "QBB: handleKeyboardInfoMessage size=" << m_height << "locale=" << m_locale; qDebug() << "QQNX: handleKeyboardInfoMessage size=" << m_height << "locale=" << m_locale;
#endif #endif
} }
void QBBVirtualKeyboard::handleKeyboardStateChangeMessage(bool visible) void QQnxVirtualKeyboard::handleKeyboardStateChangeMessage(bool visible)
{ {
#ifdef QBBVIRTUALKEYBOARD_DEBUG #ifdef QQNXVIRTUALKEYBOARD_DEBUG
qDebug() << "QBB: handleKeyboardStateChangeMessage " << visible; qDebug() << "QQNX: handleKeyboardStateChangeMessage " << visible;
#endif #endif
updateAvailableScreenGeometry(); updateAvailableScreenGeometry();
@ -323,23 +323,23 @@ void QBBVirtualKeyboard::handleKeyboardStateChangeMessage(bool visible)
hideKeyboard(); hideKeyboard();
} }
void QBBVirtualKeyboard::updateAvailableScreenGeometry() void QQnxVirtualKeyboard::updateAvailableScreenGeometry()
{ {
#ifdef QBBVIRTUALKEYBOARD_DEBUG #ifdef QQNXVIRTUALKEYBOARD_DEBUG
qDebug() << "QBB: updateAvailableScreenGeometry: keyboard visible=" << m_visible << ", keyboard height=" << m_height; qDebug() << "QQNX: updateAvailableScreenGeometry: keyboard visible=" << m_visible << ", keyboard height=" << m_height;
#endif #endif
// TODO: What screen index should be used? I assume primaryScreen here because it works, and // 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 // we do it for handleScreenGeometryChange elsewhere but since we have support
// for more than one screen, that's not going to always work. // 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()); QWindowSystemInterface::handleScreenAvailableGeometryChange(platformScreen->screen(), platformScreen->availableGeometry());
} }
bool QBBVirtualKeyboard::showKeyboard() bool QQnxVirtualKeyboard::showKeyboard()
{ {
#ifdef QBBVIRTUALKEYBOARD_DEBUG #ifdef QQNXVIRTUALKEYBOARD_DEBUG
qDebug() << "QBB: showKeyboard()"; qDebug() << "QQNX: showKeyboard()";
#endif #endif
// Try to connect. // Try to connect.
@ -367,10 +367,10 @@ bool QBBVirtualKeyboard::showKeyboard()
return true; return true;
} }
bool QBBVirtualKeyboard::hideKeyboard() bool QQnxVirtualKeyboard::hideKeyboard()
{ {
#ifdef QBBVIRTUALKEYBOARD_DEBUG #ifdef QQNXVIRTUALKEYBOARD_DEBUG
qDebug() << "QBB: hideKeyboard()"; qDebug() << "QQNX: hideKeyboard()";
#endif #endif
if (m_fd == -1 && !connect()) if (m_fd == -1 && !connect())
@ -399,12 +399,12 @@ bool QBBVirtualKeyboard::hideKeyboard()
return true; return true;
} }
void QBBVirtualKeyboard::setKeyboardMode(KeyboardMode mode) void QQnxVirtualKeyboard::setKeyboardMode(KeyboardMode mode)
{ {
m_keyboardMode = mode; m_keyboardMode = mode;
} }
void QBBVirtualKeyboard::applyKeyboardModeOptions() void QQnxVirtualKeyboard::applyKeyboardModeOptions()
{ {
// Try to connect. // Try to connect.
if (m_fd == -1 && !connect()) if (m_fd == -1 && !connect())
@ -451,49 +451,49 @@ void QBBVirtualKeyboard::applyKeyboardModeOptions()
pps_encoder_reset(m_encoder); 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, "enter", "enter.default");
pps_encoder_add_string(m_encoder, "type", "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, "enter", "enter.default");
pps_encoder_add_string(m_encoder, "type", "url"); 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, "enter", "enter.default");
pps_encoder_add_string(m_encoder, "type", "email"); 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, "enter", "enter.default");
pps_encoder_add_string(m_encoder, "type", "web"); 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, "enter", "enter.default");
pps_encoder_add_string(m_encoder, "type", "numPunc"); 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, "enter", "enter.default");
pps_encoder_add_string(m_encoder, "type", "phone"); 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, "enter", "enter.default");
pps_encoder_add_string(m_encoder, "type", "pin"); 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, "enter", "enter.default");
pps_encoder_add_string(m_encoder, "type", "symbol"); pps_encoder_add_string(m_encoder, "type", "symbol");

View File

@ -55,7 +55,7 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
/* Shamelessly copied from the browser - this should be rewritten once we have a proper PPS wrapper class */ /* 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 Q_OBJECT
public: public:
@ -72,7 +72,7 @@ public:
// //
enum KeyboardMode { Default, Url, Email, Web, NumPunc, Symbol, Phone, Pin }; enum KeyboardMode { Default, Url, Email, Web, NumPunc, Symbol, Phone, Pin };
static QBBVirtualKeyboard& instance(); static QQnxVirtualKeyboard& instance();
static void destroy(); static void destroy();
bool showKeyboard(); bool showKeyboard();
@ -88,8 +88,8 @@ Q_SIGNALS:
void visibilityChanged(bool visible); void visibilityChanged(bool visible);
private: private:
QBBVirtualKeyboard(); QQnxVirtualKeyboard();
virtual ~QBBVirtualKeyboard(); virtual ~QQnxVirtualKeyboard();
// Will be called internally if needed. // Will be called internally if needed.
bool connect(); bool connect();

View File

@ -39,10 +39,10 @@
** **
****************************************************************************/ ****************************************************************************/
#include "qbbwindow.h" #include "qqnxwindow.h"
#include "qbbglcontext.h" #include "qqnxglcontext.h"
#include "qbbintegration.h" #include "qqnxintegration.h"
#include "qbbscreen.h" #include "qqnxscreen.h"
#include <QtGui/QWindow> #include <QtGui/QWindow>
#include <QtGui/QWindowSystemInterface> #include <QtGui/QWindowSystemInterface>
@ -53,7 +53,7 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
QBBWindow::QBBWindow(QWindow *window, screen_context_t context) QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context)
: QPlatformWindow(window), : QPlatformWindow(window),
m_screenContext(context), m_screenContext(context),
m_window(0), m_window(0),
@ -64,7 +64,7 @@ QBBWindow::QBBWindow(QWindow *window, screen_context_t context)
m_parentWindow(0), m_parentWindow(0),
m_visible(true) m_visible(true)
{ {
#if defined(QBBWINDOW_DEBUG) #if defined(QQNXWINDOW_DEBUG)
qDebug() << Q_FUNC_INFO << "window =" << window << ", size =" << window->size(); qDebug() << Q_FUNC_INFO << "window =" << window << ", size =" << window->size();
#endif #endif
int result; int result;
@ -73,7 +73,7 @@ QBBWindow::QBBWindow(QWindow *window, screen_context_t context)
errno = 0; errno = 0;
result = screen_create_window_type(&m_window, m_screenContext, SCREEN_CHILD_WINDOW); result = screen_create_window_type(&m_window, m_screenContext, SCREEN_CHILD_WINDOW);
if (result != 0) { 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 // 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; val = SCREEN_USAGE_OPENGL_ES2;
break; break;
default: default:
qFatal("QBBWindow: unsupported window API"); qFatal("QQnxWindow: unsupported window API");
break; break;
} }
errno = 0; errno = 0;
result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_USAGE, &val); result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_USAGE, &val);
if (result != 0) { 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 // 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; val = SCREEN_PRE_MULTIPLIED_ALPHA;
result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_ALPHA_MODE, &val); result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_ALPHA_MODE, &val);
if (result != 0) { 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 // Make the window opaque
@ -110,7 +110,7 @@ QBBWindow::QBBWindow(QWindow *window, screen_context_t context)
val = SCREEN_TRANSPARENCY_NONE; val = SCREEN_TRANSPARENCY_NONE;
result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_TRANSPARENCY, &val); result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_TRANSPARENCY, &val);
if (result != 0) { 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 // Set the window swap interval
@ -118,43 +118,43 @@ QBBWindow::QBBWindow(QWindow *window, screen_context_t context)
val = 1; val = 1;
result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SWAP_INTERVAL, &val); result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SWAP_INTERVAL, &val);
if (result != 0) { 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). // 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 // Add the window to the root of the hierarchy
QBBScreen::addWindow(this); QQnxScreen::addWindow(this);
// Add window to plugin's window mapper // 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(); qDebug() << Q_FUNC_INFO << "window =" << window();
#endif #endif
// Remove from plugin's window mapper // Remove from plugin's window mapper
QBBIntegration::removeWindow(m_window); QQnxIntegration::removeWindow(m_window);
// Remove from parent's Hierarchy. // Remove from parent's Hierarchy.
removeFromParent(); removeFromParent();
QBBScreen::updateHierarchy(); QQnxScreen::updateHierarchy();
// We shouldn't allow this case unless QT allows it. Does it? Or should we send the // 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? // handleCloseEvent on all children when this window is deleted?
if (m_childWindows.size() > 0) if (m_childWindows.size() > 0)
qFatal("QBBWindow: window destroyed before children!"); qFatal("QQnxWindow: window destroyed before children!");
// Cleanup QNX window and its buffers // Cleanup QNX window and its buffers
screen_destroy_window(m_window); 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() << ")"; qDebug() << Q_FUNC_INFO << "window =" << window() << ", (" << rect.x() << "," << rect.y() << "," << rect.width() << "," << rect.height() << ")";
#endif #endif
@ -170,7 +170,7 @@ void QBBWindow::setGeometry(const QRect &rect)
val[1] = rect.y(); val[1] = rect.y();
int result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_POSITION, val); int result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_POSITION, val);
if (result != 0) { 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; errno = 0;
@ -178,14 +178,14 @@ void QBBWindow::setGeometry(const QRect &rect)
val[1] = rect.height(); val[1] = rect.height();
result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SIZE, val); result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SIZE, val);
if (result != 0) { 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 // Set viewport size equal to window size
errno = 0; errno = 0;
result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SOURCE_SIZE, val); result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SOURCE_SIZE, val);
if (result != 0) { 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. // Now move all children.
@ -194,16 +194,16 @@ void QBBWindow::setGeometry(const QRect &rect)
offset = rect.topLeft(); offset = rect.topLeft();
offset -= oldGeometry.topLeft(); offset -= oldGeometry.topLeft();
QList<QBBWindow*>::iterator it; QList<QQnxWindow*>::iterator it;
for (it = m_childWindows.begin(); it != m_childWindows.end(); it++) { for (it = m_childWindows.begin(); it != m_childWindows.end(); it++) {
(*it)->offset(offset); (*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(); qDebug() << Q_FUNC_INFO << "window =" << window();
#endif #endif
// Move self and then children. // Move self and then children.
@ -220,24 +220,24 @@ void QBBWindow::offset(const QPoint &offset)
val[1] = newGeometry.y(); val[1] = newGeometry.y();
int result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_POSITION, val); int result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_POSITION, val);
if (result != 0) { 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++) { for (it = m_childWindows.begin(); it != m_childWindows.end(); it++) {
(*it)->offset(offset); (*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; qDebug() << Q_FUNC_INFO << "window =" << window() << "visible =" << visible;
#endif #endif
m_visible = visible; m_visible = visible;
QBBWindow *root = this; QQnxWindow *root = this;
while (root->m_parentWindow) while (root->m_parentWindow)
root = root->m_parentWindow; root = root->m_parentWindow;
@ -246,9 +246,9 @@ void QBBWindow::setVisible(bool visible)
window()->requestActivateWindow(); 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(); qDebug() << Q_FUNC_INFO << "parentVisible =" << parentVisible << "window =" << window();
#endif #endif
// Set window visibility // Set window visibility
@ -256,18 +256,18 @@ void QBBWindow::updateVisibility(bool parentVisible)
int val = (m_visible && parentVisible) ? 1 : 0; int val = (m_visible && parentVisible) ? 1 : 0;
int result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_VISIBLE, &val); int result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_VISIBLE, &val);
if (result != 0) { 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++) { for (it = m_childWindows.begin(); it != m_childWindows.end(); it++) {
(*it)->updateVisibility(m_visible && parentVisible); (*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; qDebug() << Q_FUNC_INFO << "window =" << window() << "opacity =" << level;
#endif #endif
// Set window global alpha // Set window global alpha
@ -275,16 +275,16 @@ void QBBWindow::setOpacity(qreal level)
int val = (int)(level * 255); int val = (int)(level * 255);
int result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_GLOBAL_ALPHA, &val); int result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_GLOBAL_ALPHA, &val);
if (result != 0) { 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 // TODO: How to handle children of this window? If we change all the visibilities, then
// the transparency will look wrong... // 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; qDebug() << Q_FUNC_INFO << "window =" << window() << "size =" << size;
#endif #endif
// Set window buffer size // Set window buffer size
@ -292,7 +292,7 @@ void QBBWindow::setBufferSize(const QSize &size)
int val[2] = { size.width(), size.height() }; int val[2] = { size.width(), size.height() };
int result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_BUFFER_SIZE, val); int result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_BUFFER_SIZE, val);
if (result != 0) { 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 // Create window buffers if they do not exist
@ -308,13 +308,13 @@ void QBBWindow::setBufferSize(const QSize &size)
errno = 0; errno = 0;
result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_FORMAT, val); result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_FORMAT, val);
if (result != 0) { 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; errno = 0;
result = screen_create_window_buffers(m_window, MAX_BUFFER_COUNT); result = screen_create_window_buffers(m_window, MAX_BUFFER_COUNT);
if (result != 0) { 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(); m_scrolled = QRegion();
} }
QBBBuffer &QBBWindow::renderBuffer() QQnxBuffer &QQnxWindow::renderBuffer()
{ {
#if defined(QBBWINDOW_DEBUG) #if defined(QQNXWINDOW_DEBUG)
qDebug() << Q_FUNC_INFO << "window =" << window(); qDebug() << Q_FUNC_INFO << "window =" << window();
#endif #endif
// Check if render buffer is invalid // Check if render buffer is invalid
@ -339,12 +339,12 @@ QBBBuffer &QBBWindow::renderBuffer()
screen_buffer_t buffers[MAX_BUFFER_COUNT]; screen_buffer_t buffers[MAX_BUFFER_COUNT];
int result = screen_get_window_property_pv(m_window, SCREEN_PROPERTY_RENDER_BUFFERS, (void **)buffers); int result = screen_get_window_property_pv(m_window, SCREEN_PROPERTY_RENDER_BUFFERS, (void **)buffers);
if (result != 0) { 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 // Wrap each buffer
for (int i = 0; i < MAX_BUFFER_COUNT; ++i) { 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 // Use the first available render buffer
@ -355,23 +355,23 @@ QBBBuffer &QBBWindow::renderBuffer()
return m_buffers[m_currentBufferIndex]; return m_buffers[m_currentBufferIndex];
} }
void QBBWindow::scroll(const QRegion &region, int dx, int dy, bool flush) void QQnxWindow::scroll(const QRegion &region, int dx, int dy, bool flush)
{ {
#if defined(QBBWINDOW_DEBUG) #if defined(QQNXWINDOW_DEBUG)
qDebug() << Q_FUNC_INFO << "window =" << window(); qDebug() << Q_FUNC_INFO << "window =" << window();
#endif #endif
copyBack(region, dx, dy, flush); copyBack(region, dx, dy, flush);
m_scrolled += region; m_scrolled += region;
} }
void QBBWindow::post(const QRegion &dirty) void QQnxWindow::post(const QRegion &dirty)
{ {
// Check if render buffer exists and something was rendered // Check if render buffer exists and something was rendered
if (m_currentBufferIndex != -1 && !dirty.isEmpty()) { if (m_currentBufferIndex != -1 && !dirty.isEmpty()) {
#if defined(QBBWINDOW_DEBUG) #if defined(QQNXWINDOW_DEBUG)
qDebug() << "QBBWindow::post - window =" << window(); qDebug() << "QQnxWindow::post - window =" << window();
#endif #endif
QBBBuffer &currentBuffer = m_buffers[m_currentBufferIndex]; QQnxBuffer &currentBuffer = m_buffers[m_currentBufferIndex];
// Copy unmodified region from old render buffer to new render buffer; // Copy unmodified region from old render buffer to new render buffer;
// required to allow partial updates // required to allow partial updates
@ -387,7 +387,7 @@ void QBBWindow::post(const QRegion &dirty)
errno = 0; errno = 0;
int result = screen_post_window(m_window, currentBuffer.nativeBuffer(), 1, dirtyRect, 0); int result = screen_post_window(m_window, currentBuffer.nativeBuffer(), 1, dirtyRect, 0);
if (result != 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 // 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; qDebug() << Q_FUNC_INFO << "window =" << window() << "platformScreen =" << platformScreen;
#endif #endif
@ -423,17 +423,17 @@ void QBBWindow::setScreen(QBBScreen *platformScreen)
screen_display_t display = platformScreen->nativeDisplay(); screen_display_t display = platformScreen->nativeDisplay();
int result = screen_set_window_property_pv(m_window, SCREEN_PROPERTY_DISPLAY, (void **)&display); int result = screen_set_window_property_pv(m_window, SCREEN_PROPERTY_DISPLAY, (void **)&display);
if (result != 0) { 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 // Add window to display's window group
errno = 0; errno = 0;
result = screen_join_window_group(m_window, platformScreen->windowGroupName()); result = screen_join_window_group(m_window, platformScreen->windowGroupName());
if (result != 0) { 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++) { for (it = m_childWindows.begin(); it != m_childWindows.end(); it++) {
// Only subwindows and tooltips need necessarily be moved to another display with the window. // Only subwindows and tooltips need necessarily be moved to another display with the window.
if ((window()->windowType() & Qt::WindowType_Mask) == Qt::SubWindow || if ((window()->windowType() & Qt::WindowType_Mask) == Qt::SubWindow ||
@ -441,12 +441,12 @@ void QBBWindow::setScreen(QBBScreen *platformScreen)
(*it)->setScreen(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(); qDebug() << Q_FUNC_INFO << "window =" << window();
#endif #endif
// Remove from old Hierarchy position // Remove from old Hierarchy position
@ -454,22 +454,22 @@ void QBBWindow::removeFromParent()
if (m_parentWindow->m_childWindows.removeAll(this)) if (m_parentWindow->m_childWindows.removeAll(this))
m_parentWindow = 0; m_parentWindow = 0;
else 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 { } 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; qDebug() << Q_FUNC_INFO << "window =" << this->window() << "platformWindow =" << window;
#endif #endif
// Cast away the const, we need to modify the hierarchy. // Cast away the const, we need to modify the hierarchy.
QBBWindow *newParent = 0; QQnxWindow *newParent = 0;
if (window) if (window)
newParent = static_cast<QBBWindow*>((QPlatformWindow *)window); newParent = static_cast<QQnxWindow*>((QPlatformWindow *)window);
if (newParent == m_parentWindow) if (newParent == m_parentWindow)
return; return;
@ -484,49 +484,49 @@ void QBBWindow::setParent(const QPlatformWindow *window)
m_parentWindow->m_childWindows.push_back(this); m_parentWindow->m_childWindows.push_back(this);
} else { } 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(); qDebug() << Q_FUNC_INFO << "window =" << window();
#endif #endif
QBBWindow *oldParent = m_parentWindow; QQnxWindow *oldParent = m_parentWindow;
if (oldParent) { if (oldParent) {
removeFromParent(); removeFromParent();
oldParent->m_childWindows.push_back(this); oldParent->m_childWindows.push_back(this);
} else { } 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(); qDebug() << Q_FUNC_INFO << "window =" << window();
#endif #endif
QBBWindow *oldParent = m_parentWindow; QQnxWindow *oldParent = m_parentWindow;
if (oldParent) { if (oldParent) {
removeFromParent(); removeFromParent();
oldParent->m_childWindows.push_front(this); oldParent->m_childWindows.push_front(this);
} else { } 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(); qDebug() << Q_FUNC_INFO << "window =" << window();
#endif #endif
@ -536,9 +536,9 @@ void QBBWindow::requestActivateWindow()
gainedFocus(); gainedFocus();
} }
void QBBWindow::gainedFocus() void QQnxWindow::gainedFocus()
{ {
#if defined(QBBWINDOW_DEBUG) #if defined(QQNXWINDOW_DEBUG)
qDebug() << Q_FUNC_INFO << "window =" << window(); qDebug() << Q_FUNC_INFO << "window =" << window();
#endif #endif
@ -546,31 +546,31 @@ void QBBWindow::gainedFocus()
QWindowSystemInterface::handleWindowActivated(window()); QWindowSystemInterface::handleWindowActivated(window());
} }
void QBBWindow::setPlatformOpenGLContext(QBBGLContext *platformOpenGLContext) void QQnxWindow::setPlatformOpenGLContext(QQnxGLContext *platformOpenGLContext)
{ {
// This function does not take ownership of the platform gl context. // This function does not take ownership of the platform gl context.
// It is owned by the frontend QOpenGLContext // It is owned by the frontend QOpenGLContext
m_platformOpenGLContext = platformOpenGLContext; m_platformOpenGLContext = platformOpenGLContext;
} }
void QBBWindow::updateZorder(int &topZorder) void QQnxWindow::updateZorder(int &topZorder)
{ {
errno = 0; errno = 0;
int result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_ZORDER, &topZorder); int result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_ZORDER, &topZorder);
topZorder++; topZorder++;
if (result != 0) 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++) for (it = m_childWindows.begin(); it != m_childWindows.end(); it++)
(*it)->updateZorder(topZorder); (*it)->updateZorder(topZorder);
} }
void QBBWindow::copyBack(const QRegion &region, int dx, int dy, bool flush) void QQnxWindow::copyBack(const QRegion &region, int dx, int dy, bool flush)
{ {
#if defined(QBBWINDOW_DEBUG) #if defined(QQNXWINDOW_DEBUG)
qDebug() << Q_FUNC_INFO << "window =" << window(); qDebug() << Q_FUNC_INFO << "window =" << window();
#endif #endif
int result; int result;
@ -585,8 +585,8 @@ void QBBWindow::copyBack(const QRegion &region, int dx, int dy, bool flush)
return; return;
} }
QBBBuffer &currentBuffer = m_buffers[m_currentBufferIndex]; QQnxBuffer &currentBuffer = m_buffers[m_currentBufferIndex];
QBBBuffer &previousBuffer = m_buffers[m_previousBufferIndex]; QQnxBuffer &previousBuffer = m_buffers[m_previousBufferIndex];
// Break down region into non-overlapping rectangles // Break down region into non-overlapping rectangles
QVector<QRect> rects = region.rects(); QVector<QRect> rects = region.rects();
@ -612,7 +612,7 @@ void QBBWindow::copyBack(const QRegion &region, int dx, int dy, bool flush)
errno = 0; errno = 0;
result = screen_blit(m_screenContext, currentBuffer.nativeBuffer(), previousBuffer.nativeBuffer(), attribs); result = screen_blit(m_screenContext, currentBuffer.nativeBuffer(), previousBuffer.nativeBuffer(), attribs);
if (result != 0) { 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 &region, int dx, int dy, bool flush)
errno = 0; errno = 0;
result = screen_flush_blits(m_screenContext, SCREEN_WAIT_IDLE); result = screen_flush_blits(m_screenContext, SCREEN_WAIT_IDLE);
if (result != 0) { 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 // Buffer was modified outside the CPU
@ -630,25 +630,25 @@ void QBBWindow::copyBack(const QRegion &region, 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; qDebug() << Q_FUNC_INFO;
#endif #endif
// Extract size of colour channels from window format // Extract size of colour channels from window format
int redSize = format.redBufferSize(); int redSize = format.redBufferSize();
if (redSize == -1) { if (redSize == -1) {
qFatal("QBBWindow: red size not defined"); qFatal("QQnxWindow: red size not defined");
} }
int greenSize = format.greenBufferSize(); int greenSize = format.greenBufferSize();
if (greenSize == -1) { if (greenSize == -1) {
qFatal("QBBWindow: green size not defined"); qFatal("QQnxWindow: green size not defined");
} }
int blueSize = format.blueBufferSize(); int blueSize = format.blueBufferSize();
if (blueSize == -1) { if (blueSize == -1) {
qFatal("QBBWindow: blue size not defined"); qFatal("QQnxWindow: blue size not defined");
} }
// select matching native format // select matching native format
@ -657,7 +657,7 @@ int QBBWindow::platformWindowFormatToNativeFormat(const QSurfaceFormat &format)
} else if (redSize == 8 && greenSize == 8 && blueSize == 8) { } else if (redSize == 8 && greenSize == 8 && blueSize == 8) {
return SCREEN_FORMAT_RGBA8888; return SCREEN_FORMAT_RGBA8888;
} else { } else {
qFatal("QBBWindow: unsupported pixel format"); qFatal("QQnxWindow: unsupported pixel format");
return 0; return 0;
} }
} }

View File

@ -39,12 +39,12 @@
** **
****************************************************************************/ ****************************************************************************/
#ifndef QBBWINDOW_H #ifndef QQNXWINDOW_H
#define QBBWINDOW_H #define QQNXWINDOW_H
#include <QtGui/QPlatformWindow> #include <QtGui/QPlatformWindow>
#include "qbbbuffer.h" #include "qqnxbuffer.h"
#include <QtGui/QImage> #include <QtGui/QImage>
@ -57,18 +57,18 @@ QT_BEGIN_NAMESPACE
// all surfaces double buffered // all surfaces double buffered
#define MAX_BUFFER_COUNT 2 #define MAX_BUFFER_COUNT 2
class QBBGLContext; class QQnxGLContext;
class QBBScreen; class QQnxScreen;
class QPlatformGLContext; class QPlatformGLContext;
class QSurfaceFormat; class QSurfaceFormat;
class QBBWindow : public QPlatformWindow class QQnxWindow : public QPlatformWindow
{ {
friend class QBBScreen; friend class QQnxScreen;
public: public:
QBBWindow(QWindow *window, screen_context_t context); QQnxWindow(QWindow *window, screen_context_t context);
virtual ~QBBWindow(); virtual ~QQnxWindow();
virtual void setGeometry(const QRect &rect); virtual void setGeometry(const QRect &rect);
virtual void setVisible(bool visible); virtual void setVisible(bool visible);
@ -81,11 +81,11 @@ public:
QSize bufferSize() const { return m_bufferSize; } QSize bufferSize() const { return m_bufferSize; }
bool hasBuffers() const { return !m_bufferSize.isEmpty(); } bool hasBuffers() const { return !m_bufferSize.isEmpty(); }
QBBBuffer &renderBuffer(); QQnxBuffer &renderBuffer();
void scroll(const QRegion &region, int dx, int dy, bool flush=false); void scroll(const QRegion &region, int dx, int dy, bool flush=false);
void post(const QRegion &dirty); void post(const QRegion &dirty);
void setScreen(QBBScreen *platformScreen); void setScreen(QQnxScreen *platformScreen);
virtual void setParent(const QPlatformWindow *window); virtual void setParent(const QPlatformWindow *window);
virtual void raise(); virtual void raise();
@ -94,11 +94,11 @@ public:
void gainedFocus(); void gainedFocus();
QBBScreen *screen() const { return m_screen; } QQnxScreen *screen() const { return m_screen; }
const QList<QBBWindow*>& children() const { return m_childWindows; } const QList<QQnxWindow*>& children() const { return m_childWindows; }
void setPlatformOpenGLContext(QBBGLContext *platformOpenGLContext); void setPlatformOpenGLContext(QQnxGLContext *platformOpenGLContext);
QBBGLContext *platformOpenGLContext() const { return m_platformOpenGLContext; } QQnxGLContext *platformOpenGLContext() const { return m_platformOpenGLContext; }
private: private:
void removeFromParent(); void removeFromParent();
@ -115,19 +115,19 @@ private:
screen_context_t m_screenContext; screen_context_t m_screenContext;
screen_window_t m_window; screen_window_t m_window;
QSize m_bufferSize; QSize m_bufferSize;
QBBBuffer m_buffers[MAX_BUFFER_COUNT]; QQnxBuffer m_buffers[MAX_BUFFER_COUNT];
int m_currentBufferIndex; int m_currentBufferIndex;
int m_previousBufferIndex; int m_previousBufferIndex;
QRegion m_previousDirty; QRegion m_previousDirty;
QRegion m_scrolled; QRegion m_scrolled;
QBBGLContext *m_platformOpenGLContext; QQnxGLContext *m_platformOpenGLContext;
QBBScreen *m_screen; QQnxScreen *m_screen;
QList<QBBWindow*> m_childWindows; QList<QQnxWindow*> m_childWindows;
QBBWindow *m_parentWindow; QQnxWindow *m_parentWindow;
bool m_visible; bool m_visible;
}; };
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QBBWINDOW_H #endif // QQNXWINDOW_H