diff options
author | Jani Hautakangas <ext-jani.hautakangas@nokia.com> | 2010-08-06 07:09:16 (GMT) |
---|---|---|
committer | Jani Hautakangas <ext-jani.hautakangas@nokia.com> | 2010-08-06 07:52:11 (GMT) |
commit | 339270016bd8805b081f0b4ff550906a6bcfec5b (patch) | |
tree | aba55a15ddeaad46445b013c1aa76e6b6038a9de | |
parent | f732113f45a918fcb39ed073f82bcf0de5b455b2 (diff) | |
download | Qt-339270016bd8805b081f0b4ff550906a6bcfec5b.zip Qt-339270016bd8805b081f0b4ff550906a6bcfec5b.tar.gz Qt-339270016bd8805b081f0b4ff550906a6bcfec5b.tar.bz2 |
Register window types for Symbian system effects
Set the purpose of the window (dialog/popup/child window etc...).
Notify WServ when modal window is shown/hidden
Notify WServ when temporary surface deallocation happens.
Notify WServ when the application is going to shutdown.
Task-number: QT-2027
Reviewed-by: Jason Barron
-rw-r--r-- | src/gui/kernel/qapplication.h | 3 | ||||
-rw-r--r-- | src/gui/kernel/qapplication_p.h | 1 | ||||
-rw-r--r-- | src/gui/kernel/qapplication_s60.cpp | 58 |
3 files changed, 61 insertions, 1 deletions
diff --git a/src/gui/kernel/qapplication.h b/src/gui/kernel/qapplication.h index 799d4c2..0242582 100644 --- a/src/gui/kernel/qapplication.h +++ b/src/gui/kernel/qapplication.h @@ -412,6 +412,9 @@ private: #if defined(QT_RX71_MULTITOUCH) Q_PRIVATE_SLOT(d_func(), void _q_readRX71MultiTouchEvents()) #endif +#if defined(Q_OS_SYMBIAN) + Q_PRIVATE_SLOT(d_func(), void _q_aboutToQuit()) +#endif }; QT_END_NAMESPACE diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 53205b5..8dc16e0 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -519,6 +519,7 @@ public: int symbianHandleCommand(const QSymbianEvent *symbianEvent); int symbianResourceChange(const QSymbianEvent *symbianEvent); + void _q_aboutToQuit(); #endif #if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) || defined(Q_WS_MAC) void sendSyntheticEnterLeave(QWidget *widget); diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 1f6a4ae..52f0db6 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -87,6 +87,10 @@ #include <hal.h> #include <hal_data.h> +#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS +#include <graphics/wstfxconst.h> +#endif + QT_BEGIN_NAMESPACE // Goom Events through Window Server @@ -372,7 +376,7 @@ void QSymbianControl::ConstructL(bool isWindowOwning, bool desktop) { if (!desktop) { - if (isWindowOwning or !qwidget->parentWidget()) + if (isWindowOwning || !qwidget->parentWidget()) CreateWindowL(S60->windowGroup()); else /** @@ -395,6 +399,34 @@ void QSymbianControl::ConstructL(bool isWindowOwning, bool desktop) DrawableWindow()->SetPointerGrab(ETrue); } + +#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS + if (OwnsWindow()) { + TTfxWindowPurpose windowPurpose(ETfxPurposeNone); + switch (qwidget->windowType()) { + case Qt::Dialog: + windowPurpose = ETfxPurposeDialogWindow; + break; + case Qt::Popup: + windowPurpose = ETfxPurposePopupWindow; + break; + case Qt::Tool: + windowPurpose = ETfxPurposeToolWindow; + break; + case Qt::ToolTip: + windowPurpose = ETfxPurposeToolTipWindow; + break; + case Qt::SplashScreen: + windowPurpose = ETfxPurposeSplashScreenWindow; + break; + default: + windowPurpose = (isWindowOwning || !qwidget->parentWidget()) + ? ETfxPurposeWindow : ETfxPurposeChildWindow; + break; + } + Window().SetPurpose(windowPurpose); + } +#endif } QSymbianControl::~QSymbianControl() @@ -1483,6 +1515,10 @@ void qt_init(QApplicationPrivate * /* priv */, int) systemFont.setFamily(systemFont.defaultFamily()); QApplicationPrivate::setSystemFont(systemFont); +#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS + QObject::connect(qApp, SIGNAL(aboutToQuit()), qApp, SLOT(_q_aboutToQuit())); +#endif + /* ### Commented out for now as parameter handling not needed in SOS(yet). Code below will break testlib with -o flag int argc = priv->argc; @@ -1572,6 +1608,9 @@ bool QApplicationPrivate::modalState() void QApplicationPrivate::enterModal_sys(QWidget *widget) { +#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS + S60->wsSession().SendEffectCommand(ETfxCmdAppModalModeEnter); +#endif if (widget) { static_cast<QSymbianControl *>(widget->effectiveWinId())->FadeBehindPopup(ETrue); // Modal partial screen dialogs (like queries) capture pointer events. @@ -1587,6 +1626,9 @@ void QApplicationPrivate::enterModal_sys(QWidget *widget) void QApplicationPrivate::leaveModal_sys(QWidget *widget) { +#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS + S60->wsSession().SendEffectCommand(ETfxCmdAppModalModeExit); +#endif if (widget) { static_cast<QSymbianControl *>(widget->effectiveWinId())->FadeBehindPopup(EFalse); // ### FixMe: Add specialized behaviour for fullscreen modal dialogs @@ -1883,6 +1925,9 @@ int QApplicationPrivate::symbianProcessWsEvent(const QSymbianEvent *symbianEvent break; QRefCountedWidgetBackingStore &backingStore = window->d_func()->maybeTopData()->backingStore; if (visChangedEvent->iFlags & TWsVisibilityChangedEvent::ENotVisible) { +#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS + S60->wsSession().SendEffectCommand(ETfxCmdDeallocateLayer); +#endif // Decrement backing store reference count backingStore.deref(); // In order to ensure that any resources used by the window surface @@ -1893,6 +1938,9 @@ int QApplicationPrivate::symbianProcessWsEvent(const QSymbianEvent *symbianEvent // Increment backing store reference count backingStore.ref(); } else { +#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS + S60->wsSession().SendEffectCommand(ETfxCmdRestoreLayer); +#endif // Create backing store with an initial reference count of 1 backingStore.create(window); backingStore.ref(); @@ -2268,6 +2316,14 @@ void QApplication::restoreOverrideCursor() #endif // QT_NO_CURSOR +void QApplicationPrivate::_q_aboutToQuit() +{ +#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS + // Send the shutdown tfx command + S60->wsSession().SendEffectCommand(ETfxCmdAppShutDown); +#endif +} + QS60ThreadLocalData::QS60ThreadLocalData() { CCoeEnv *env = CCoeEnv::Static(); |