diff options
Diffstat (limited to 'src/plugins/platforms/qnx')
30 files changed, 323 insertions, 55 deletions
diff --git a/src/plugins/platforms/qnx/qnx.pro b/src/plugins/platforms/qnx/qnx.pro index 8367513fc5..203cdebda9 100644 --- a/src/plugins/platforms/qnx/qnx.pro +++ b/src/plugins/platforms/qnx/qnx.pro @@ -39,6 +39,7 @@ CONFIG(blackberry) { #DEFINES += QQNXSCREEN_DEBUG #DEFINES += QQNXVIRTUALKEYBOARD_DEBUG #DEFINES += QQNXWINDOW_DEBUG +#DEFINES += QQNXCURSOR_DEBUG SOURCES = main.cpp \ @@ -54,7 +55,8 @@ SOURCES = main.cpp \ qqnxnavigatoreventhandler.cpp \ qqnxabstractnavigator.cpp \ qqnxabstractvirtualkeyboard.cpp \ - qqnxservices.cpp + qqnxservices.cpp \ + qqnxcursor.cpp HEADERS = main.h \ qqnxbuffer.h \ @@ -70,7 +72,8 @@ HEADERS = main.h \ qqnxnavigatoreventhandler.h \ qqnxabstractnavigator.h \ qqnxabstractvirtualkeyboard.h \ - qqnxservices.h + qqnxservices.h \ + qqnxcursor.h LIBS += -lscreen diff --git a/src/plugins/platforms/qnx/qqnxabstractnavigator.cpp b/src/plugins/platforms/qnx/qqnxabstractnavigator.cpp index 08da98d690..5a94bff14e 100644 --- a/src/plugins/platforms/qnx/qqnxabstractnavigator.cpp +++ b/src/plugins/platforms/qnx/qqnxabstractnavigator.cpp @@ -44,7 +44,7 @@ #include <QDebug> #include <QUrl> -#ifdef QQNXNAVIGATOR_DEBUG +#if defined(QQNXNAVIGATOR_DEBUG) #define qNavigatorDebug qDebug #else #define qNavigatorDebug QT_NO_QDEBUG_MACRO diff --git a/src/plugins/platforms/qnx/qqnxbpseventfilter.cpp b/src/plugins/platforms/qnx/qqnxbpseventfilter.cpp index 2d19537896..d94d3c092a 100644 --- a/src/plugins/platforms/qnx/qqnxbpseventfilter.cpp +++ b/src/plugins/platforms/qnx/qqnxbpseventfilter.cpp @@ -53,7 +53,7 @@ #include <bps/navigator.h> #include <bps/screen.h> -#ifdef QQNXBPSEVENTFILTER_DEBUG +#if defined(QQNXBPSEVENTFILTER_DEBUG) #define qBpsEventFilterDebug qDebug #else #define qBpsEventFilterDebug QT_NO_QDEBUG_MACRO @@ -87,7 +87,7 @@ void QQnxBpsEventFilter::installOnEventDispatcher(QAbstractEventDispatcher *disp { qBpsEventFilterDebug() << Q_FUNC_INFO << "dispatcher=" << dispatcher; - if (navigator_request_events(0) != BPS_SUCCESS) + if (navigator_request_events(NAVIGATOR_EXTENDED_DATA) != BPS_SUCCESS) qWarning("QQNX: failed to register for navigator events"); dispatcher->installNativeEventFilter(this); @@ -210,6 +210,26 @@ bool QQnxBpsEventFilter::handleNavigatorEvent(bps_event_t *event) m_navigatorEventHandler->handleExit(); break; + case NAVIGATOR_WINDOW_STATE: { + qBpsEventFilterDebug() << Q_FUNC_INFO << "WINDOW STATE event"; + const navigator_window_state_t state = navigator_event_get_window_state(event); + const QByteArray id(navigator_event_get_groupid(event)); + + switch (state) { + case NAVIGATOR_WINDOW_FULLSCREEN: + m_navigatorEventHandler->handleWindowGroupStateChanged(id, Qt::WindowFullScreen); + break; + case NAVIGATOR_WINDOW_THUMBNAIL: + m_navigatorEventHandler->handleWindowGroupStateChanged(id, Qt::WindowMinimized); + break; + case NAVIGATOR_WINDOW_INVISIBLE: + m_navigatorEventHandler->handleWindowGroupDeactivated(id); + break; + } + + break; + } + case NAVIGATOR_WINDOW_ACTIVE: { qBpsEventFilterDebug() << Q_FUNC_INFO << "WINDOW ACTIVE event"; const QByteArray id(navigator_event_get_groupid(event)); diff --git a/src/plugins/platforms/qnx/qqnxbuffer.cpp b/src/plugins/platforms/qnx/qqnxbuffer.cpp index 9007af7f70..c5e99a2001 100644 --- a/src/plugins/platforms/qnx/qqnxbuffer.cpp +++ b/src/plugins/platforms/qnx/qqnxbuffer.cpp @@ -46,7 +46,7 @@ #include <errno.h> #include <sys/mman.h> -#ifdef QQNXBUFFER_DEBUG +#if defined(QQNXBUFFER_DEBUG) #define qBufferDebug qDebug #else #define qBufferDebug QT_NO_QDEBUG_MACRO diff --git a/src/plugins/platforms/qnx/qqnxbuttoneventnotifier.cpp b/src/plugins/platforms/qnx/qqnxbuttoneventnotifier.cpp index 152b732556..2f531efd8b 100644 --- a/src/plugins/platforms/qnx/qqnxbuttoneventnotifier.cpp +++ b/src/plugins/platforms/qnx/qqnxbuttoneventnotifier.cpp @@ -49,7 +49,7 @@ #include <QtCore/QSocketNotifier> #include <QtCore/private/qcore_unix_p.h> -#ifdef QQNXBUTTON_DEBUG +#if defined(QQNXBUTTON_DEBUG) #define qButtonDebug qDebug #else #define qButtonDebug QT_NO_QDEBUG_MACRO diff --git a/src/plugins/platforms/qnx/qqnxclipboard.cpp b/src/plugins/platforms/qnx/qqnxclipboard.cpp index 8286febd35..dfd1345eed 100644 --- a/src/plugins/platforms/qnx/qqnxclipboard.cpp +++ b/src/plugins/platforms/qnx/qqnxclipboard.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#ifndef QT_NO_CLIPBOARD +#if !defined(QT_NO_CLIPBOARD) #include "qqnxclipboard.h" @@ -53,7 +53,7 @@ #include <clipboard/clipboard.h> #include <errno.h> -#ifdef QQNXCLIPBOARD_DEBUG +#if defined(QQNXCLIPBOARD_DEBUG) #define qClipboardDebug qDebug #else #define qClipboardDebug QT_NO_QDEBUG_MACRO diff --git a/src/plugins/platforms/qnx/qqnxclipboard.h b/src/plugins/platforms/qnx/qqnxclipboard.h index 0b75393efd..561b57299e 100644 --- a/src/plugins/platforms/qnx/qqnxclipboard.h +++ b/src/plugins/platforms/qnx/qqnxclipboard.h @@ -42,7 +42,9 @@ #ifndef QQNXCLIPBOARD_H #define QQNXCLIPBOARD_H -#ifndef QT_NO_CLIPBOARD +#include <QtCore/qglobal.h> + +#if !defined(QT_NO_CLIPBOARD) #include <qpa/qplatformclipboard.h> QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/qnx/qqnxcursor.cpp b/src/plugins/platforms/qnx/qqnxcursor.cpp new file mode 100644 index 0000000000..3cf857bb27 --- /dev/null +++ b/src/plugins/platforms/qnx/qqnxcursor.cpp @@ -0,0 +1,78 @@ +/*************************************************************************** +** +** Copyright (C) 2011 - 2012 Research In Motion +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qqnxcursor.h" + +#include <QtCore/QDebug> + +#if defined(QQNXCURSOR_DEBUG) +#define qCursorDebug qDebug +#else +#define qCursorDebug QT_NO_QDEBUG_MACRO +#endif + +QT_BEGIN_NAMESPACE + +QQnxCursor::QQnxCursor() +{ +} + +#if !defined(QT_NO_CURSOR) +void QQnxCursor::changeCursor(QCursor *windowCursor, QWindow *window) +{ + Q_UNUSED(windowCursor); + Q_UNUSED(window); +} +#endif + +void QQnxCursor::setPos(const QPoint &pos) +{ + qCursorDebug() << "QQnxCursor::setPos -" << pos; + m_pos = pos; +} + +QPoint QQnxCursor::pos() const +{ + qCursorDebug() << "QQnxCursor::pos -" << m_pos; + return m_pos; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/qnx/qqnxcursor.h b/src/plugins/platforms/qnx/qqnxcursor.h new file mode 100644 index 0000000000..b62c299040 --- /dev/null +++ b/src/plugins/platforms/qnx/qqnxcursor.h @@ -0,0 +1,67 @@ +/*************************************************************************** +** +** Copyright (C) 2011 - 2012 Research In Motion +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QQNXCURSOR_H +#define QQNXCURSOR_H + +#include <qpa/qplatformcursor.h> + +QT_BEGIN_NAMESPACE + +class QQnxCursor : public QPlatformCursor +{ +public: + QQnxCursor(); + +#if !defined(QT_NO_CURSOR) + void changeCursor(QCursor *windowCursor, QWindow *window); +#endif + void setPos(const QPoint &pos); + + QPoint pos() const; + +private: + QPoint m_pos; +}; + +QT_END_NAMESPACE + +#endif // QQNXCURSOR_H diff --git a/src/plugins/platforms/qnx/qqnxfiledialoghelper.cpp b/src/plugins/platforms/qnx/qqnxfiledialoghelper.cpp index 79d7c7d9ca..0325a33268 100644 --- a/src/plugins/platforms/qnx/qqnxfiledialoghelper.cpp +++ b/src/plugins/platforms/qnx/qqnxfiledialoghelper.cpp @@ -51,7 +51,7 @@ #include <QTimer> #include <QWindow> -#ifdef QQNXFILEDIALOGHELPER_DEBUG +#if defined(QQNXFILEDIALOGHELPER_DEBUG) #define qFileDialogHelperDebug qDebug #else #define qFileDialogHelperDebug QT_NO_QDEBUG_MACRO diff --git a/src/plugins/platforms/qnx/qqnxglcontext.cpp b/src/plugins/platforms/qnx/qqnxglcontext.cpp index 1c2ec23fa9..f77bb73614 100644 --- a/src/plugins/platforms/qnx/qqnxglcontext.cpp +++ b/src/plugins/platforms/qnx/qqnxglcontext.cpp @@ -50,7 +50,7 @@ #include <QtGui/QOpenGLContext> #include <QtGui/QScreen> -#ifdef QQNXGLCONTEXT_DEBUG +#if defined(QQNXGLCONTEXT_DEBUG) #define qGLContextDebug qDebug #else #define qGLContextDebug QT_NO_QDEBUG_MACRO diff --git a/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp b/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp index 0d8f430c73..97a361158e 100644 --- a/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp +++ b/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp @@ -61,13 +61,13 @@ #include <process.h> #include <sys/keycodes.h> -#ifdef QQNXINPUTCONTEXT_IMF_EVENT_DEBUG +#if defined(QQNXINPUTCONTEXT_IMF_EVENT_DEBUG) #define qInputContextIMFEventDebug qDebug #else #define qInputContextIMFEventDebug QT_NO_QDEBUG_MACRO #endif -#ifdef QQNXINPUTCONTEXT_DEBUG +#if defined(QQNXINPUTCONTEXT_DEBUG) #define qInputContextDebug qDebug #else #define qInputContextDebug QT_NO_QDEBUG_MACRO diff --git a/src/plugins/platforms/qnx/qqnxinputcontext_noimf.cpp b/src/plugins/platforms/qnx/qqnxinputcontext_noimf.cpp index 71b925357a..f444d34b5e 100644 --- a/src/plugins/platforms/qnx/qqnxinputcontext_noimf.cpp +++ b/src/plugins/platforms/qnx/qqnxinputcontext_noimf.cpp @@ -47,7 +47,7 @@ #include <QtCore/QDebug> #include <QtGui/QGuiApplication> -#ifdef QQNXINPUTCONTEXT_DEBUG +#if defined(QQNXINPUTCONTEXT_DEBUG) #define qInputContextDebug qDebug #else #define qInputContextDebug QT_NO_QDEBUG_MACRO diff --git a/src/plugins/platforms/qnx/qqnxintegration.cpp b/src/plugins/platforms/qnx/qqnxintegration.cpp index f3cfdab9c6..5ea4fef698 100644 --- a/src/plugins/platforms/qnx/qqnxintegration.cpp +++ b/src/plugins/platforms/qnx/qqnxintegration.cpp @@ -96,7 +96,7 @@ #include <errno.h> -#ifdef QQNXINTEGRATION_DEBUG +#if defined(QQNXINTEGRATION_DEBUG) #define qIntegrationDebug qDebug #else #define qIntegrationDebug QT_NO_QDEBUG_MACRO @@ -495,6 +495,8 @@ void QQnxIntegration::createDisplay(screen_display_t display, bool isPrimary) QObject::connect(m_navigatorEventHandler, SIGNAL(rotationChanged(int)), screen, SLOT(setRotation(int))); QObject::connect(m_navigatorEventHandler, SIGNAL(windowGroupActivated(QByteArray)), screen, SLOT(activateWindowGroup(QByteArray))); QObject::connect(m_navigatorEventHandler, SIGNAL(windowGroupDeactivated(QByteArray)), screen, SLOT(deactivateWindowGroup(QByteArray))); + QObject::connect(m_navigatorEventHandler, SIGNAL(windowGroupStateChanged(QByteArray,Qt::WindowState)), + screen, SLOT(windowGroupStateChanged(QByteArray,Qt::WindowState))); } void QQnxIntegration::removeDisplay(QQnxScreen *screen) diff --git a/src/plugins/platforms/qnx/qqnxnavigatoreventhandler.cpp b/src/plugins/platforms/qnx/qqnxnavigatoreventhandler.cpp index 19fa9c5a9f..30dbb330d7 100644 --- a/src/plugins/platforms/qnx/qqnxnavigatoreventhandler.cpp +++ b/src/plugins/platforms/qnx/qqnxnavigatoreventhandler.cpp @@ -45,7 +45,7 @@ #include <QGuiApplication> #include <qpa/qwindowsysteminterface.h> -#ifdef QQNXNAVIGATOREVENTHANDLER_DEBUG +#if defined(QQNXNAVIGATOREVENTHANDLER_DEBUG) #define qNavigatorEventHandlerDebug qDebug #else #define qNavigatorEventHandlerDebug QT_NO_QDEBUG_MACRO @@ -106,4 +106,10 @@ void QQnxNavigatorEventHandler::handleWindowGroupDeactivated(const QByteArray &i Q_EMIT windowGroupDeactivated(id); } +void QQnxNavigatorEventHandler::handleWindowGroupStateChanged(const QByteArray &id, Qt::WindowState state) +{ + qNavigatorEventHandlerDebug() << Q_FUNC_INFO << id; + Q_EMIT windowGroupStateChanged(id, state); +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/qnx/qqnxnavigatoreventhandler.h b/src/plugins/platforms/qnx/qqnxnavigatoreventhandler.h index 2068163473..cce3921a27 100644 --- a/src/plugins/platforms/qnx/qqnxnavigatoreventhandler.h +++ b/src/plugins/platforms/qnx/qqnxnavigatoreventhandler.h @@ -58,11 +58,13 @@ public: void handleExit(); void handleWindowGroupActivated(const QByteArray &id); void handleWindowGroupDeactivated(const QByteArray &id); + void handleWindowGroupStateChanged(const QByteArray &id, Qt::WindowState state); Q_SIGNALS: void rotationChanged(int angle); void windowGroupActivated(const QByteArray &id); void windowGroupDeactivated(const QByteArray &id); + void windowGroupStateChanged(const QByteArray &id, Qt::WindowState state); }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/qnx/qqnxnavigatoreventnotifier.cpp b/src/plugins/platforms/qnx/qqnxnavigatoreventnotifier.cpp index 9fa8294815..640944fb45 100644 --- a/src/plugins/platforms/qnx/qqnxnavigatoreventnotifier.cpp +++ b/src/plugins/platforms/qnx/qqnxnavigatoreventnotifier.cpp @@ -55,7 +55,7 @@ #include <sys/types.h> #include <sys/stat.h> -#ifdef QQNXNAVIGATOREVENTNOTIFIER_DEBUG +#if defined(QQNXNAVIGATOREVENTNOTIFIER_DEBUG) #define qNavigatorEventNotifierDebug qDebug #else #define qNavigatorEventNotifierDebug QT_NO_QDEBUG_MACRO diff --git a/src/plugins/platforms/qnx/qqnxnavigatorpps.cpp b/src/plugins/platforms/qnx/qqnxnavigatorpps.cpp index 92a94e0a39..1656ab029b 100644 --- a/src/plugins/platforms/qnx/qqnxnavigatorpps.cpp +++ b/src/plugins/platforms/qnx/qqnxnavigatorpps.cpp @@ -44,7 +44,7 @@ #include <QDebug> #include <private/qcore_unix_p.h> -#ifdef QQNXNAVIGATOR_DEBUG +#if defined(QQNXNAVIGATOR_DEBUG) #define qNavigatorDebug qDebug #else #define qNavigatorDebug QT_NO_QDEBUG_MACRO diff --git a/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp b/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp index 47a72f173b..7204e5bce9 100644 --- a/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp +++ b/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp @@ -46,7 +46,7 @@ #include <errno.h> -#ifdef QQNXRASTERBACKINGSTORE_DEBUG +#if defined(QQNXRASTERBACKINGSTORE_DEBUG) #define qRasterBackingStoreDebug qDebug #else #define qRasterBackingStoreDebug QT_NO_QDEBUG_MACRO diff --git a/src/plugins/platforms/qnx/qqnxrootwindow.cpp b/src/plugins/platforms/qnx/qqnxrootwindow.cpp index b01d468647..198801a832 100644 --- a/src/plugins/platforms/qnx/qqnxrootwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxrootwindow.cpp @@ -46,7 +46,7 @@ #include <QtCore/QUuid> #include <QtCore/QDebug> -#ifdef QQNXROOTWINDOW_DEBUG +#if defined(QQNXROOTWINDOW_DEBUG) #define qRootWindowDebug qDebug #else #define qRootWindowDebug QT_NO_QDEBUG_MACRO diff --git a/src/plugins/platforms/qnx/qqnxscreen.cpp b/src/plugins/platforms/qnx/qqnxscreen.cpp index 1e58f047ab..7614abdc6a 100644 --- a/src/plugins/platforms/qnx/qqnxscreen.cpp +++ b/src/plugins/platforms/qnx/qqnxscreen.cpp @@ -41,6 +41,7 @@ #include "qqnxscreen.h" #include "qqnxwindow.h" +#include "qqnxcursor.h" #include <QtCore/QThread> #include <QtCore/QDebug> @@ -48,7 +49,7 @@ #include <errno.h> -#ifdef QQNXSCREEN_DEBUG +#if defined(QQNXSCREEN_DEBUG) #define qScreenDebug qDebug #else #define qScreenDebug QT_NO_QDEBUG_MACRO @@ -110,7 +111,8 @@ QQnxScreen::QQnxScreen(screen_context_t screenContext, screen_display_t display, m_posted(false), m_keyboardHeight(0), m_nativeOrientation(Qt::PrimaryOrientation), - m_platformContext(0) + m_platformContext(0), + m_cursor(new QQnxCursor()) { qScreenDebug() << Q_FUNC_INFO; // Cache initial orientation of this display @@ -149,6 +151,10 @@ QQnxScreen::QQnxScreen(screen_context_t screenContext, screen_display_t display, QQnxScreen::~QQnxScreen() { qScreenDebug() << Q_FUNC_INFO; + Q_FOREACH (QQnxWindow *childWindow, m_childWindows) + childWindow->setScreen(0); + + delete m_cursor; } static int defaultDepth() @@ -492,6 +498,11 @@ void QQnxScreen::onWindowPost(QQnxWindow *window) } } +QPlatformCursor * QQnxScreen::cursor() const +{ + return m_cursor; +} + void QQnxScreen::keyboardHeightChanged(int height) { if (height == m_keyboardHeight) @@ -542,6 +553,21 @@ void QQnxScreen::windowClosed(void *window) removeOverlayWindow(windowHandle); } +void QQnxScreen::windowGroupStateChanged(const QByteArray &id, Qt::WindowState state) +{ + qScreenDebug() << Q_FUNC_INFO; + + if (!rootWindow() || id != rootWindow()->groupName()) + return; + + QWindow * const window = topMostChildWindow(); + + if (!window) + return; + + QWindowSystemInterface::handleWindowStateChanged(window, state); +} + void QQnxScreen::activateWindowGroup(const QByteArray &id) { qScreenDebug() << Q_FUNC_INFO; @@ -549,13 +575,12 @@ void QQnxScreen::activateWindowGroup(const QByteArray &id) if (!rootWindow() || id != rootWindow()->groupName()) return; - if (!m_childWindows.isEmpty()) { - // We're picking up the last window of the list here - // because this list is ordered by stacking order. - // Last window is effectively the one on top. - QWindow * const window = m_childWindows.last()->window(); - QWindowSystemInterface::handleWindowActivated(window); - } + QWindow * const window = topMostChildWindow(); + + if (!window) + return; + + QWindowSystemInterface::handleWindowActivated(window); } void QQnxScreen::deactivateWindowGroup(const QByteArray &id) @@ -577,4 +602,17 @@ QSharedPointer<QQnxRootWindow> QQnxScreen::rootWindow() const return m_rootWindow; } +QWindow * QQnxScreen::topMostChildWindow() const +{ + if (!m_childWindows.isEmpty()) { + + // We're picking up the last window of the list here + // because this list is ordered by stacking order. + // Last window is effectively the one on top. + return m_childWindows.last()->window(); + } + + return 0; +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/qnx/qqnxscreen.h b/src/plugins/platforms/qnx/qqnxscreen.h index 2851c13c52..41dc675599 100644 --- a/src/plugins/platforms/qnx/qqnxscreen.h +++ b/src/plugins/platforms/qnx/qqnxscreen.h @@ -95,10 +95,13 @@ public: QSharedPointer<QQnxRootWindow> rootWindow() const; + QPlatformCursor *cursor() const; + public Q_SLOTS: void setRotation(int rotation); void newWindowCreated(void *window); void windowClosed(void *window); + void windowGroupStateChanged(const QByteArray &id, Qt::WindowState state); void activateWindowGroup(const QByteArray &id); void deactivateWindowGroup(const QByteArray &id); @@ -112,6 +115,8 @@ private: void addOverlayWindow(screen_window_t window); void removeOverlayWindow(screen_window_t window); + QWindow *topMostChildWindow() const; + screen_context_t m_screenContext; screen_display_t m_display; mutable QSharedPointer<QQnxRootWindow> m_rootWindow; @@ -130,6 +135,8 @@ private: QList<QQnxWindow *> m_childWindows; QList<screen_window_t> m_overlays; + + QPlatformCursor *m_cursor; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp index 4412bb34bd..57cfdc5eb6 100644 --- a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp +++ b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp @@ -50,7 +50,7 @@ #include <errno.h> #include <sys/keycodes.h> -#ifdef QQNXSCREENEVENT_DEBUG +#if defined(QQNXSCREENEVENT_DEBUG) #define qScreenEventDebug qDebug #else #define qScreenEventDebug QT_NO_QDEBUG_MACRO @@ -347,6 +347,8 @@ void QQnxScreenEventHandler::handleTouchEvent(screen_event_t event, int qnxType) qFatal("QQNX: failed to query event position, errno=%d", errno); } + QCursor::setPos(pos[0], pos[1]); + // get window coordinates of touch errno = 0; int windowPos[2]; diff --git a/src/plugins/platforms/qnx/qqnxscreeneventthread.cpp b/src/plugins/platforms/qnx/qqnxscreeneventthread.cpp index 8f262a7083..f3f660bc03 100644 --- a/src/plugins/platforms/qnx/qqnxscreeneventthread.cpp +++ b/src/plugins/platforms/qnx/qqnxscreeneventthread.cpp @@ -49,7 +49,7 @@ #include <cctype> -#ifdef QQNXSCREENEVENTTHREAD_DEBUG +#if defined(QQNXSCREENEVENTTHREAD_DEBUG) #define qScreenEventThreadDebug qDebug #else #define qScreenEventThreadDebug QT_NO_QDEBUG_MACRO diff --git a/src/plugins/platforms/qnx/qqnxtheme.cpp b/src/plugins/platforms/qnx/qqnxtheme.cpp index e8e9e39388..733b7223b6 100644 --- a/src/plugins/platforms/qnx/qqnxtheme.cpp +++ b/src/plugins/platforms/qnx/qqnxtheme.cpp @@ -80,10 +80,10 @@ QPlatformDialogHelper *QQnxTheme::createPlatformDialogHelper(DialogType type) co case QPlatformTheme::FileDialog: return new QQnxFileDialogHelper(m_integration); #endif -#ifndef QT_NO_COLORDIALOG +#if !defined(QT_NO_COLORDIALOG) case QPlatformTheme::ColorDialog: #endif -#ifndef QT_NO_FONTDIALOG +#if !defined(QT_NO_FONTDIALOG) case QPlatformTheme::FontDialog: #endif default: diff --git a/src/plugins/platforms/qnx/qqnxvirtualkeyboardbps.cpp b/src/plugins/platforms/qnx/qqnxvirtualkeyboardbps.cpp index 3d2f49aa6c..11eb4a5082 100644 --- a/src/plugins/platforms/qnx/qqnxvirtualkeyboardbps.cpp +++ b/src/plugins/platforms/qnx/qqnxvirtualkeyboardbps.cpp @@ -47,7 +47,7 @@ #include <bps/locale.h> #include <bps/virtualkeyboard.h> -#ifdef QQNXVIRTUALKEYBOARD_DEBUG +#if defined(QQNXVIRTUALKEYBOARD_DEBUG) #define qVirtualKeyboardDebug qDebug #else #define qVirtualKeyboardDebug QT_NO_QDEBUG_MACRO diff --git a/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp b/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp index ab912927bb..e810b47c22 100644 --- a/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp +++ b/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp @@ -56,7 +56,7 @@ #include <sys/types.h> #include <unistd.h> -#ifdef QQNXVIRTUALKEYBOARD_DEBUG +#if defined(QQNXVIRTUALKEYBOARD_DEBUG) #define qVirtualKeyboardDebug qDebug #else #define qVirtualKeyboardDebug QT_NO_QDEBUG_MACRO diff --git a/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.h b/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.h index eb41b2efd0..6048868b08 100644 --- a/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.h +++ b/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef VIRTUALKEYBOARDPPS_H_ -#define VIRTUALKEYBOARDPPS_H_ +#ifndef VIRTUALKEYBOARDPPS_H +#define VIRTUALKEYBOARDPPS_H #include "qqnxabstractvirtualkeyboard.h" @@ -97,4 +97,4 @@ private: static const size_t ms_bufferSize; }; -#endif /* VIRTUALKEYBOARDPPS_H_ */ +#endif // VIRTUALKEYBOARDPPS_H diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp index ab9c94772b..f1bebee9b2 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxwindow.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include "qqnxwindow.h" -#ifndef QT_NO_OPENGL +#if !defined(QT_NO_OPENGL) #include "qqnxglcontext.h" #endif #include "qqnxintegration.h" @@ -53,7 +53,12 @@ #include <errno.h> -#ifdef QQNXWINDOW_DEBUG +#if defined(Q_OS_BLACKBERRY) +#include <sys/pps.h> +#include <bps/navigator.h> +#endif + +#if defined(QQNXWINDOW_DEBUG) #define qWindowDebug qDebug #else #define qWindowDebug QT_NO_QDEBUG_MACRO @@ -67,7 +72,7 @@ QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context) m_window(0), m_currentBufferIndex(-1), m_previousBufferIndex(-1), -#ifndef QT_NO_OPENGL +#if !defined(QT_NO_OPENGL) m_platformOpenGLContext(0), #endif m_screen(0), @@ -156,7 +161,8 @@ QQnxWindow::~QQnxWindow() // Remove from parent's Hierarchy. removeFromParent(); - m_screen->updateHierarchy(); + if (m_screen) + m_screen->updateHierarchy(); // Cleanup QNX window and its buffers screen_destroy_window(m_window); @@ -272,9 +278,9 @@ void QQnxWindow::setVisible(bool visible) window()->requestActivate(); if (window()->isTopLevel()) { - if (visible) { - QWindowSystemInterface::handleExposeEvent(window(), window()->geometry()); - } else { + QWindowSystemInterface::handleExposeEvent(window(), window()->geometry()); + + if (!visible) { // Flush the context, otherwise it won't disappear immediately screen_flush_context(m_screenContext, 0); } @@ -347,7 +353,7 @@ void QQnxWindow::setBufferSize(const QSize &size) // Create window buffers if they do not exist if (m_bufferSize.isEmpty()) { -#ifndef QT_NO_OPENGL +#if !defined(QT_NO_OPENGL) // Get pixel format from EGL config if using OpenGL; // otherwise inherit pixel format of window's screen if (m_platformOpenGLContext != 0) { @@ -497,6 +503,11 @@ void QQnxWindow::setScreen(QQnxScreen *platformScreen) { qWindowDebug() << Q_FUNC_INFO << "window =" << window() << "platformScreen =" << platformScreen; + if (platformScreen == 0) { // The screen has been destroyed + m_screen = 0; + return; + } + if (m_screen == platformScreen) return; @@ -539,7 +550,7 @@ void QQnxWindow::removeFromParent() m_parentWindow = 0; else qFatal("QQnxWindow: Window Hierarchy broken; window has parent, but parent hasn't got child."); - } else { + } else if (m_screen) { m_screen->removeWindow(this); } } @@ -618,12 +629,20 @@ void QQnxWindow::setWindowState(Qt::WindowState state) switch (state) { - // WindowMinimized is not supported - navigator does not have an API to minimize a window // WindowActive is not an accepted parameter according to the docs - case Qt::WindowMinimized: case Qt::WindowActive: return; + case Qt::WindowMinimized: + minimize(); + + if (m_unmaximizedGeometry.isValid()) + setGeometry(m_unmaximizedGeometry); + else + setGeometry(m_screen->geometry()); + + break; + case Qt::WindowMaximized: case Qt::WindowFullScreen: m_unmaximizedGeometry = geometry(); @@ -647,7 +666,7 @@ void QQnxWindow::gainedFocus() QWindowSystemInterface::handleWindowActivated(window()); } -#ifndef QT_NO_OPENGL +#if !defined(QT_NO_OPENGL) void QQnxWindow::setPlatformOpenGLContext(QQnxGLContext *platformOpenGLContext) { // This function does not take ownership of the platform gl context. @@ -683,6 +702,27 @@ void QQnxWindow::blitFrom(QQnxWindow *sourceWindow, const QPoint &sourceOffset, blitHelper(sourceBuffer, targetBuffer, sourceOffset, QPoint(0, 0), targetRegion, true); } +void QQnxWindow::minimize() +{ +#if defined(Q_OS_BLACKBERRY) && !defined(Q_OS_BLACKBERRY_TABLET) + qWindowDebug() << Q_FUNC_INFO; + + pps_encoder_t encoder; + + pps_encoder_initialize(&encoder, false); + pps_encoder_add_string(&encoder, "msg", "minimizeWindow"); + + if (navigator_raw_write(pps_encoder_buffer(&encoder), + pps_encoder_length(&encoder)) != BPS_SUCCESS) { + qWindowDebug() << Q_FUNC_INFO << "navigator_raw_write failed:" << strerror(errno); + } + + pps_encoder_cleanup(&encoder); +#else + qWarning("Qt::WindowMinimized is not supported by this OS version"); +#endif +} + void QQnxWindow::updateZorder(int &topZorder) { errno = 0; diff --git a/src/plugins/platforms/qnx/qqnxwindow.h b/src/plugins/platforms/qnx/qqnxwindow.h index 90226bb9a4..4a327fd54b 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.h +++ b/src/plugins/platforms/qnx/qqnxwindow.h @@ -49,7 +49,7 @@ #include <QtGui/QImage> #include <QtCore/QMutex> -#ifndef QT_NO_OPENGL +#if !defined(QT_NO_OPENGL) #include <EGL/egl.h> #endif @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE // all surfaces double buffered #define MAX_BUFFER_COUNT 2 -#ifndef QT_NO_OPENGL +#if !defined(QT_NO_OPENGL) class QQnxGLContext; #endif class QQnxScreen; @@ -108,7 +108,7 @@ public: QQnxScreen *screen() const { return m_screen; } const QList<QQnxWindow*>& children() const { return m_childWindows; } -#ifndef QT_NO_OPENGL +#if !defined(QT_NO_OPENGL) void setPlatformOpenGLContext(QQnxGLContext *platformOpenGLContext); QQnxGLContext *platformOpenGLContext() const { return m_platformOpenGLContext; } #endif @@ -116,6 +116,7 @@ public: QQnxWindow *findWindow(screen_window_t windowHandle); void blitFrom(QQnxWindow *sourceWindow, const QPoint &sourceOffset, const QRegion &targetRegion); + void minimize(); private: QRect setGeometryHelper(const QRect &rect); @@ -143,7 +144,7 @@ private: QRegion m_previousDirty; QRegion m_scrolled; -#ifndef QT_NO_OPENGL +#if !defined(QT_NO_OPENGL) QQnxGLContext *m_platformOpenGLContext; #endif QQnxScreen *m_screen; |