From d176e39de8fcde92a92866e7b0db5904c90a1e82 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 14 Apr 2011 09:05:53 +0200 Subject: Do not use SetSurfaceTransparency() on raster. When raster graphics system is forced and the HW was capable enough, we still tried to use SetSurfaceTransparency() on the RWindow to enable semi-transparency, which is wrong as it only works for windows that have a separate surface. Reviewed-by: Jani Hautakangas --- src/gui/kernel/qapplication_s60.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index f73eb02..6e70fc2 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -1855,6 +1855,8 @@ void qt_init(QApplicationPrivate * /* priv */, int) } else { QApplicationPrivate::instance()->useTranslucentEGLSurfaces = false; } + if (QApplicationPrivate::graphics_system_name == QLatin1String("raster")) + QApplicationPrivate::instance()->useTranslucentEGLSurfaces = false; #else QApplicationPrivate::instance()->useTranslucentEGLSurfaces = false; #endif -- cgit v0.12 From a5898f33f215ff2ac333be61306a47ca162b2104 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 14 Apr 2011 09:13:42 +0200 Subject: Trigger fullscreen transition effects properly on app exit. Avkon calls BeginFullScreen() and EndFullScreen() to trigger the fullscreen system transition effects for application exit, however the calls are made too late for Qt apps because the widgets are already destroyed. Instead, the effects are triggered explicitly from Qt, before closing the widgets, or from aboutToQuit, whichever comes first. Task-number: QT-4718 Reviewed-by: Jani Hautakangas --- mkspecs/common/symbian/symbian.conf | 2 +- src/gui/kernel/qapplication.cpp | 17 ++++++++++++- src/gui/kernel/qapplication_s60.cpp | 7 +++-- src/gui/kernel/qt_s60_p.h | 51 +++++++++++++++++++++++++++++++++++++ 4 files changed, 73 insertions(+), 4 deletions(-) diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf index f955e3c..8e04099 100644 --- a/mkspecs/common/symbian/symbian.conf +++ b/mkspecs/common/symbian/symbian.conf @@ -84,7 +84,7 @@ QMAKE_LIBS_OPENGL_ES2_QT = $$QMAKE_LIBS_OPENGL_ES2 $$QMAKE_LIBS_CFBSBITMAP -lcon QMAKE_LIBS_OPENVG = $$QMAKE_LIBS_CFBSBITMAP -llibOpenVG QMAKE_LIBS_THREAD = -llibpthread QMAKE_LIBS_COMPAT = -QMAKE_LIBS_S60 = -lavkon -leikcoctl +QMAKE_LIBS_S60 = -lavkon -leikcoctl -lgfxtrans exists($${EPOCROOT}epoc32/include/platform/sgresource/sgimage.h) { QMAKE_LIBS_OPENVG += -lsgresource diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 59aec91..f906bbf 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -128,6 +128,10 @@ extern bool qt_wince_is_pocket_pc(); //qguifunctions_wince.cpp //#define ALIEN_DEBUG +#if defined(Q_OS_SYMBIAN) +#include "qt_s60_p.h" +#endif + static void initResources() { #if defined(Q_WS_WINCE) @@ -2432,6 +2436,11 @@ bool QApplication::event(QEvent *e) { Q_D(QApplication); if(e->type() == QEvent::Close) { +#if defined(Q_OS_SYMBIAN) + // In order to have proper application-exit effects on Symbian, certain + // native APIs have to be called _before_ closing/destroying the widgets. + bool effectStarted = qt_beginFullScreenEffect(); +#endif QCloseEvent *ce = static_cast(e); ce->accept(); closeAllWindows(); @@ -2445,8 +2454,14 @@ bool QApplication::event(QEvent *e) break; } } - if(ce->isAccepted()) + if (ce->isAccepted()) { return true; + } else { +#if defined(Q_OS_SYMBIAN) + if (effectStarted) + qt_abortFullScreenEffect(); +#endif + } } else if(e->type() == QEvent::LanguageChange) { #ifndef QT_NO_TRANSLATION setLayoutDirection(qt_detectRTLLanguage()?Qt::RightToLeft:Qt::LeftToRight); diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 6e70fc2..6620efd 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -1828,9 +1828,7 @@ void qt_init(QApplicationPrivate * /* priv */, int) systemFont.setFamily(systemFont.defaultFamily()); QApplicationPrivate::setSystemFont(systemFont); -#ifdef Q_SYMBIAN_TRANSITION_EFFECTS QObject::connect(qApp, SIGNAL(aboutToQuit()), qApp, SLOT(_q_aboutToQuit())); -#endif #ifdef Q_SYMBIAN_SEMITRANSPARENT_BG_SURFACE QApplicationPrivate::instance()->useTranslucentEGLSurfaces = true; @@ -1921,6 +1919,9 @@ void qt_cleanup() S60->setButtonGroupContainer(0); #endif + // Call EndFullScreen() to prevent confusing the system effect state machine. + qt_endFullScreenEffect(); + if (S60->qtOwnsS60Environment) { // Restore the S60 framework trap handler. See qt_init(). User::SetTrapHandler(S60->s60InstalledTrapHandler); @@ -2659,6 +2660,8 @@ void QApplication::restoreOverrideCursor() void QApplicationPrivate::_q_aboutToQuit() { + qt_beginFullScreenEffect(); + #ifdef Q_SYMBIAN_TRANSITION_EFFECTS // Send the shutdown tfx command S60->wsSession().SendEffectCommand(ETfxCmdAppShutDown); diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index e24405c..da44016 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -77,6 +77,8 @@ #include // CAknContextPane #include // CEikStatusPane #include // MAknFadedComponent and TAknPopupFader +#include // BeginFullScreen +#include // BeginFullScreen #endif QT_BEGIN_NAMESPACE @@ -85,6 +87,9 @@ QT_BEGIN_NAMESPACE // system events seems to start with 0x10 const TInt KInternalStatusPaneChange = 0x50000000; +// For BeginFullScreen(). +const TUint KQtAppExitFlag = 0x400; + static const int qt_symbian_max_screens = 4; //this macro exists because EColor16MAP enum value doesn't exist in Symbian OS 9.2 @@ -193,6 +198,9 @@ public: int nativeScreenWidthInPixels; int nativeScreenHeightInPixels; + + int beginFullScreenCalled : 1; + int endFullScreenCalled : 1; }; Q_AUTOTEST_EXPORT QS60Data* qGlobalS60Data(); @@ -334,6 +342,8 @@ inline QS60Data::QS60Data() #ifdef Q_OS_SYMBIAN ,s60InstalledTrapHandler(0) #endif + ,beginFullScreenCalled(0), + endFullScreenCalled(0) { } @@ -565,6 +575,47 @@ void qt_symbian_set_cursor_visible(bool visible); bool qt_symbian_is_cursor_visible(); #endif +static inline bool qt_beginFullScreenEffect() +{ +#ifdef Q_WS_S60 + // Only for post-S^3. On earlier versions the system transition effects + // may not be able to capture the non-Avkon content, leading to confusing + // looking effects, so just skip the whole thing. + if (S60->beginFullScreenCalled || QSysInfo::s60Version() <= QSysInfo::SV_S60_5_2) + return false; + S60->beginFullScreenCalled = true; + // For Avkon apps the app-exit effect is triggered from CAknAppUi::PrepareToExit(). + // That is good for Avkon apps, but in case of Qt the RWindows are destroyed earlier. + // Therefore we call BeginFullScreen() ourselves. + GfxTransEffect::BeginFullScreen(AknTransEffect::EApplicationExit, + TRect(0, 0, 0, 0), + AknTransEffect::EParameterType, + AknTransEffect::GfxTransParam(S60->uid, + AknTransEffect::TParameter::EAvkonCheck | KQtAppExitFlag)); + return true; +#endif +} + +static inline void qt_abortFullScreenEffect() +{ +#ifdef Q_WS_S60 + if (!S60->beginFullScreenCalled || QSysInfo::s60Version() <= QSysInfo::SV_S60_5_2) + return; + GfxTransEffect::AbortFullScreen(); + S60->beginFullScreenCalled = S60->endFullScreenCalled = false; +#endif +} + +static inline void qt_endFullScreenEffect() +{ +#ifdef Q_WS_S60 + if (S60->endFullScreenCalled || QSysInfo::s60Version() <= QSysInfo::SV_S60_5_2) + return; + S60->endFullScreenCalled = true; + GfxTransEffect::EndFullScreen(); +#endif +} + QT_END_NAMESPACE #endif // QT_S60_P_H -- cgit v0.12 From c156280a637abd6acb3894723a9e21ba2abc8fb8 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Thu, 14 Apr 2011 12:01:01 +0300 Subject: Splitview: opening a context menu should not re-position of focusItem When splitview is open and user long taps an text input item, a context menu is opened. This leads to some drawing operations on splitview implementation, even though these should be skipped. The focusItem might even be re-positioned into incorrect position due to the failure. As a fix, check if the focusItem is already positioned correctly and avoid doing anything when it already is. Task-number: QTBUG-18738 Reviewed-by: Guoqing Zhang --- src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index 8574f2c..b64ce0c 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -538,11 +538,11 @@ void QCoeFepInputContext::ensureFocusWidgetVisible(QWidget *widget) if (alwaysResize) { windowToMove->setUpdatesEnabled(false); - if (!moveWithinVisibleArea) + if (!moveWithinVisibleArea) { m_splitViewResizeBy = widget->height(); - - windowTop = widget->geometry().top(); - widget->resize(widget->width(), splitViewRect.height() - windowTop); + windowTop = widget->geometry().top(); + widget->resize(widget->width(), splitViewRect.height() - windowTop); + } if (gv->scene()) { const QRectF microFocusRect = gv->scene()->inputMethodQuery(Qt::ImMicroFocus).toRectF(); -- cgit v0.12 From f4dedf1a4d7e530c715f99327da175cec67d66e4 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Thu, 14 Apr 2011 13:00:29 +0300 Subject: QGraphicsView with vertical scrollbar flickers when splitview opens Do windowstate change to fullscreen inside updateEnabled(false) - updateEnabled(true) guard block to avoid flickering of screen area, when keyboard opens in splitview. In worst case, screen is drawn three times: - resize the content area to fit into splitview - change windowstate to fullscreen - ensure visibility of the focusitem by scrolling the view Now, all these happen inside one "update". Task-number: QTBUG-18737 Reviewed-by: Guoqing Zhang --- src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index b64ce0c..e4b965b 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -531,13 +531,15 @@ void QCoeFepInputContext::ensureFocusWidgetVisible(QWidget *widget) // and greatly reduces event passing in orientation switch cases, // as the statuspane size is not changing. + if (alwaysResize) + windowToMove->setUpdatesEnabled(false); + if (!(windowToMove->windowState() & Qt::WindowFullScreen)) { windowToMove->setWindowState( (windowToMove->windowState() & ~(Qt::WindowMinimized | Qt::WindowFullScreen)) | Qt::WindowFullScreen); } if (alwaysResize) { - windowToMove->setUpdatesEnabled(false); if (!moveWithinVisibleArea) { m_splitViewResizeBy = widget->height(); windowTop = widget->geometry().top(); @@ -548,11 +550,13 @@ void QCoeFepInputContext::ensureFocusWidgetVisible(QWidget *widget) const QRectF microFocusRect = gv->scene()->inputMethodQuery(Qt::ImMicroFocus).toRectF(); gv->ensureVisible(microFocusRect); } - windowToMove->setUpdatesEnabled(true); } else { translateInputWidget(); } + if (alwaysResize) + windowToMove->setUpdatesEnabled(true); + widget->setAttribute(Qt::WA_Resized, userResize); //not a user resize } -- cgit v0.12 From 8a37a69c961092aae7dd7f55f30a15b3fae1b7cc Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Thu, 14 Apr 2011 13:22:36 +0300 Subject: Splitview flag should also be updated to inputcontext Currently splitview support is defined in exported global private method. There is no guarantee that input context is created, or updated when the API is called. This is problematic, since the client need to find a correct place and time when to call the API. As a change, update existing input context when the API is called. Also, take into account the splitview flag when updating input context. This ensures that client can enforce the flag use correctly. Task-number: QTBUG-18715 Reviewed-by: Guoqing Zhang --- src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index e4b965b..c11d5e8 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -77,6 +77,15 @@ QT_BEGIN_NAMESPACE Q_GUI_EXPORT void qt_s60_setPartialScreenInputMode(bool enable) { S60->partial_keyboard = enable; + + QInputContext *ic = 0; + if (QApplication::focusWidget()) { + ic = QApplication::focusWidget()->inputContext(); + } else if (qApp && qApp->inputContext()) { + ic = qApp->inputContext(); + } + if (ic) + ic->update(); } QCoeFepInputContext::QCoeFepInputContext(QObject *parent) @@ -580,6 +589,19 @@ void QCoeFepInputContext::updateHints(bool mustUpdateInputCapabilities) QWidget *w = focusWidget(); if (w) { Qt::InputMethodHints hints = w->inputMethodHints(); + + // Since splitview support works like an input method hint, yet it is private flag, + // we need to update its state separately. + if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0) { + TInt currentFlags = m_fepState->Flags(); + if (S60->partial_keyboard) + currentFlags |= QT_EAknEditorFlagEnablePartialScreen; + else + currentFlags &= ~QT_EAknEditorFlagEnablePartialScreen; + if (currentFlags != m_fepState->Flags()) + m_fepState->SetFlags(currentFlags); + } + if (hints != m_lastImHints) { m_lastImHints = hints; applyHints(hints); -- cgit v0.12 From 9672bec709bb8ee3d35dcd889b218708e4804c55 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 15 Apr 2011 09:05:31 +0200 Subject: Make EGL surface transparency working on Symbian. When the hardware is capable enough, setting WA_TranslucentBackground will not lead to falling back to raster, but will continue using OpenVG or OpenGL based rendering. However this needs an alpha channel which was not requested previously. This patch corrects it. Task-number: QT-4729 Reviewed-by: Jani Hautakangas --- src/gui/egl/qegl_symbian.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/gui/egl/qegl_symbian.cpp b/src/gui/egl/qegl_symbian.cpp index 6533d11..fabf9d1 100644 --- a/src/gui/egl/qegl_symbian.cpp +++ b/src/gui/egl/qegl_symbian.cpp @@ -42,6 +42,7 @@ #include #include #include +#include #include "qegl_p.h" #include "qeglcontext_p.h" @@ -73,10 +74,14 @@ void QEglProperties::setPaintDeviceFormat(QPaintDevice *dev) return; int devType = dev->devType(); - if (devType == QInternal::Image) + if (devType == QInternal::Image) { setPixelFormat(static_cast(dev)->format()); - else - setPixelFormat(QImage::Format_RGB32); + } else { + QImage::Format format = QImage::Format_RGB32; + if (QApplicationPrivate::instance() && QApplicationPrivate::instance()->useTranslucentEGLSurfaces) + format = QImage::Format_ARGB32_Premultiplied; + setPixelFormat(format); + } } -- cgit v0.12 From dc65a73fa38d1f85b75e9d4ad71ebdbc1c7d85f5 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 15 Apr 2011 14:51:34 +0200 Subject: Build fix for transition effect support on S60 5.0. Task-number: QT-4718 Reviewed-by: TRUSTME --- src/gui/kernel/kernel.pri | 2 ++ src/gui/kernel/qt_s60_p.h | 10 +++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index f9c84c1..467eb9b 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -111,6 +111,8 @@ win32 { } symbian { + exists($${EPOCROOT}epoc32/include/platform/mw/akntranseffect.h): DEFINES += QT_SYMBIAN_HAVE_AKNTRANSEFFECT_H + SOURCES += \ kernel/qapplication_s60.cpp \ kernel/qeventdispatcher_s60.cpp \ diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index da44016..8aba53a 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -78,8 +78,10 @@ #include // CEikStatusPane #include // MAknFadedComponent and TAknPopupFader #include // BeginFullScreen +#ifdef QT_SYMBIAN_HAVE_AKNTRANSEFFECT_H #include // BeginFullScreen #endif +#endif QT_BEGIN_NAMESPACE @@ -577,7 +579,7 @@ bool qt_symbian_is_cursor_visible(); static inline bool qt_beginFullScreenEffect() { -#ifdef Q_WS_S60 +#if defined(Q_WS_S60) && defined(QT_SYMBIAN_HAVE_AKNTRANSEFFECT_H) // Only for post-S^3. On earlier versions the system transition effects // may not be able to capture the non-Avkon content, leading to confusing // looking effects, so just skip the whole thing. @@ -593,12 +595,14 @@ static inline bool qt_beginFullScreenEffect() AknTransEffect::GfxTransParam(S60->uid, AknTransEffect::TParameter::EAvkonCheck | KQtAppExitFlag)); return true; +#else + return false; #endif } static inline void qt_abortFullScreenEffect() { -#ifdef Q_WS_S60 +#if defined(Q_WS_S60) && defined(QT_SYMBIAN_HAVE_AKNTRANSEFFECT_H) if (!S60->beginFullScreenCalled || QSysInfo::s60Version() <= QSysInfo::SV_S60_5_2) return; GfxTransEffect::AbortFullScreen(); @@ -608,7 +612,7 @@ static inline void qt_abortFullScreenEffect() static inline void qt_endFullScreenEffect() { -#ifdef Q_WS_S60 +#if defined(Q_WS_S60) && defined(QT_SYMBIAN_HAVE_AKNTRANSEFFECT_H) if (S60->endFullScreenCalled || QSysInfo::s60Version() <= QSysInfo::SV_S60_5_2) return; S60->endFullScreenCalled = true; -- cgit v0.12