From 21d91ec14eea21f07bc58c171df000f87caf6c3d Mon Sep 17 00:00:00 2001 From: Kevin Ottens Date: Mon, 7 May 2012 12:10:04 +0200 Subject: Advertise window (de)activation to Qt event system The integration plugin now connects screens to the newly introduced signals of the navigator event handler. The relevant screen then push a corresponding event to the Qt event loop. (This is a backport from qtbase commit b6a4d69830c0d188b4f6c424808390dd8e3a90bc) Change-Id: I28c8843f2aea75bc685dcfd6e005bc628bc69202 Reviewed-by: Kevin Krammer Reviewed-by: Giuseppe D'Angelo --- .../platforms/blackberry/qbbintegration.cpp | 2 ++ src/plugins/platforms/blackberry/qbbscreen.cpp | 30 ++++++++++++++++++++++ src/plugins/platforms/blackberry/qbbscreen.h | 2 ++ 3 files changed, 34 insertions(+) diff --git a/src/plugins/platforms/blackberry/qbbintegration.cpp b/src/plugins/platforms/blackberry/qbbintegration.cpp index 28484ba..6283bb1 100644 --- a/src/plugins/platforms/blackberry/qbbintegration.cpp +++ b/src/plugins/platforms/blackberry/qbbintegration.cpp @@ -349,6 +349,8 @@ void QBBIntegration::createDisplays() screen, SLOT(windowClosed(screen_window_t))); QObject::connect(mNavigatorEventHandler, SIGNAL(rotationChanged(int)), screen, SLOT(setRotation(int))); + QObject::connect(mNavigatorEventHandler, SIGNAL(windowGroupActivated(QByteArray)), screen, SLOT(activateWindowGroup(QByteArray))); + QObject::connect(mNavigatorEventHandler, SIGNAL(windowGroupDeactivated(QByteArray)), screen, SLOT(deactivateWindowGroup(QByteArray))); } } diff --git a/src/plugins/platforms/blackberry/qbbscreen.cpp b/src/plugins/platforms/blackberry/qbbscreen.cpp index 30630f1..206e307 100644 --- a/src/plugins/platforms/blackberry/qbbscreen.cpp +++ b/src/plugins/platforms/blackberry/qbbscreen.cpp @@ -351,4 +351,34 @@ void QBBScreen::removeOverlayWindow(screen_window_t window) updateHierarchy(); } +void QBBScreen::activateWindowGroup(const QByteArray &id) +{ +#if defined(QBBSCREEN_DEBUG) + qDebug() << Q_FUNC_INFO; +#endif + + if (!rootWindow() || id != rootWindow()->groupName()) + return; + + if (!mChildren.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. + QWidget * const window = mChildren.last()->widget(); + QWindowSystemInterface::handleWindowActivated(window); + } +} + +void QBBScreen::deactivateWindowGroup(const QByteArray &id) +{ +#if defined(QBBSCREEN_DEBUG) + qDebug() << Q_FUNC_INFO; +#endif + + if (!rootWindow() || id != rootWindow()->groupName()) + return; + + QWindowSystemInterface::handleWindowActivated(0); +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/blackberry/qbbscreen.h b/src/plugins/platforms/blackberry/qbbscreen.h index e353de1..3d67b69 100644 --- a/src/plugins/platforms/blackberry/qbbscreen.h +++ b/src/plugins/platforms/blackberry/qbbscreen.h @@ -88,6 +88,8 @@ public Q_SLOTS: void setRotation(int rotation); void newWindowCreated(screen_window_t window); void windowClosed(screen_window_t window); + void activateWindowGroup(const QByteArray &id); + void deactivateWindowGroup(const QByteArray &id); private Q_SLOTS: void keyboardHeightChanged(int height); -- cgit v0.12