BlackBerry: handle window state navigator events

Change-Id: I925b1c53c5e251111469501056ee162a23e36faf
Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
This commit is contained in:
Rafael Roquetto 2013-02-25 19:45:02 -03:00 committed by The Qt Project
parent ab59a7ef09
commit 439002cdde
6 changed files with 67 additions and 7 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -551,6 +551,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;
@ -558,13 +573,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)
@ -586,4 +600,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

View File

@ -101,6 +101,7 @@ 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);
@ -114,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;