From bd36d753337090a2878fc0ca4117e2250c5ae1b7 Mon Sep 17 00:00:00 2001 From: Aleksandar Sasha Babic Date: Fri, 5 Feb 2010 09:34:48 +0100 Subject: Fixing 'softvfp+vfpv2' compiling issue for Tb9.2 When compiling with -fpu=softvfp+vfpv2 on Tb9.2 we were getting the segmentattion fault. This seems to be due to the RVCT bug when it comes to using int->float (and reverse) castings. One extra level of indirection (function call) has to be applied. Task-number: QTBUG-4893 Reviewed-by: TrustMe --- src/gui/painting/qdrawhelper.cpp | 4 ++++ src/gui/painting/qmath_p.h | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 194dda3..660a2a8 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -2408,7 +2408,11 @@ static inline int soft_light_op(int dst, int src, int da, int sa) else if (4 * dst <= da) return (dst * sa * 255 + da * (src2 - sa) * ((((16 * dst_np - 12 * 255) * dst_np + 3 * 65025) * dst_np) / 65025) + temp) / 65025; else { +# ifdef Q_CC_RVCT // needed to avoid compiler crash in RVCT 2.2 + return (dst * sa * 255 + da * (src2 - sa) * (qIntSqrtInt(dst_np * 255) - dst_np) + temp) / 65025; +# else return (dst * sa * 255 + da * (src2 - sa) * (int(sqrt(qreal(dst_np * 255))) - dst_np) + temp) / 65025; +# endif } } diff --git a/src/gui/painting/qmath_p.h b/src/gui/painting/qmath_p.h index cd9f5ea..8a5f5ab 100644 --- a/src/gui/painting/qmath_p.h +++ b/src/gui/painting/qmath_p.h @@ -54,6 +54,7 @@ // #include +#include QT_BEGIN_NAMESPACE @@ -61,6 +62,11 @@ static const qreal Q_PI = qreal(3.14159265358979323846); // pi static const qreal Q_2PI = qreal(6.28318530717958647693); // 2*pi static const qreal Q_PI2 = qreal(1.57079632679489661923); // pi/2 +inline int qIntSqrtInt(int v) +{ + return static_cast(qSqrt(static_cast(v))); +} + QT_END_NAMESPACE #endif // QMATH_P_H -- cgit v0.12 From 79fb890a4f2a13cc0f21e92f5b2a6e10af1430b4 Mon Sep 17 00:00:00 2001 From: Samuel Nevala Date: Fri, 5 Feb 2010 09:51:00 +0200 Subject: s60 application loses normalGeometry when returning from fullscreen Problem description: normalGeomerty lost during showFullScreen 1. Reported problen was due on void QSymbianControl::PositionChanged() over write top->normaGeometry on every position change. As fix top->normalGeometry is moved to new rect:s top left only when widget windowState == 0. 2. Also made some new qwidget auto tests. Refactored s60 side setWindowState to be more readable. Minimized window state now hides window decoration. QApplication & QWidget autotest run on emulator and tested on s60 5.0 hw using attached application. http://bugreports.qt.nokia.com/browse/QTBUG-6231 Task-number:QTBUG-6231 Merge-request: 2256 Reviewed-by: Jani Hautakangas --- src/gui/kernel/qapplication_s60.cpp | 17 ++- src/gui/kernel/qwidget_s60.cpp | 108 +++++------------ tests/auto/qwidget/tst_qwidget.cpp | 224 ++++++++++++++++++++++++++++++++++++ 3 files changed, 262 insertions(+), 87 deletions(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 6e03d7c..4a137ee 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -924,8 +924,8 @@ void QSymbianControl::PositionChanged() cr.moveTopLeft(newPos); qwidget->data->crect = cr; QTLWExtra *top = qwidget->d_func()->maybeTopData(); - if (top) - top->normalGeometry = cr; + if (top && (qwidget->windowState() & (~Qt::WindowActive)) == Qt::WindowNoState) + top->normalGeometry.moveTopLeft(newPos); if (qwidget->isVisible()) { QMoveEvent e(newPos, oldPos); qt_sendSpontaneousEvent(qwidget, &e); @@ -960,15 +960,14 @@ void QSymbianControl::FocusChanged(TDrawNow /* aDrawNow */) qwidget->d_func()->setWindowIcon_sys(true); qwidget->d_func()->setWindowTitle_sys(qwidget->windowTitle()); #ifdef Q_WS_S60 - // If widget is fullscreen, hide status pane and button container - // otherwise show them. + // If widget is fullscreen/minimized, hide status pane and button container otherwise show them. CEikStatusPane* statusPane = S60->statusPane(); CEikButtonGroupContainer* buttonGroup = S60->buttonGroupContainer(); - bool isFullscreen = qwidget->windowState() & Qt::WindowFullScreen; - if (statusPane && (bool)statusPane->IsVisible() == isFullscreen) - statusPane->MakeVisible(!isFullscreen); - if (buttonGroup && (bool)buttonGroup->IsVisible() == isFullscreen) - buttonGroup->MakeVisible(!isFullscreen); + TBool visible = !(qwidget->windowState() & (Qt::WindowFullScreen | Qt::WindowMinimized)); + if (statusPane) + statusPane->MakeVisible(visible); + if (buttonGroup) + buttonGroup->MakeVisible(visible); #endif } else if (QApplication::activeWindow() == qwidget->window()) { if (CCoeEnv::Static()->AppUi()->IsDisplayingMenuOrDialog()) { diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 0ce7534..c84e1cc 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -1046,96 +1046,48 @@ void QWidget::setWindowState(Qt::WindowStates newstate) return; if (isWindow()) { -#ifdef Q_WS_S60 - // Change window decoration visibility if switching to or from fullsccreen - // In addition decoration visibility is changed when the initial has been - // WindowNoState. - // The window decoration visibility has to be changed before doing actual - // window state change since in that order the availableGeometry will return - // directly the right size and we will avoid unnecessarty redraws - if ((oldstate & Qt::WindowFullScreen) != (newstate & Qt::WindowFullScreen) || - oldstate == Qt::WindowNoState) { - CEikStatusPane* statusPane = S60->statusPane(); - CEikButtonGroupContainer* buttonGroup = S60->buttonGroupContainer(); - if (newstate & Qt::WindowFullScreen) { - if (statusPane) - statusPane->MakeVisible(false); - if (buttonGroup) - buttonGroup->MakeVisible(false); - } else { - if (statusPane) - statusPane->MakeVisible(true); - if (buttonGroup) - buttonGroup->MakeVisible(true); - } + QSymbianControl *window = static_cast(effectiveWinId()); + if (window && newstate & Qt::WindowMinimized) { + window->setFocusSafely(false); + window->MakeVisible(false); + } else if (window && oldstate & Qt::WindowMinimized) { + window->setFocusSafely(true); + window->MakeVisible(true); } + +#ifdef Q_WS_S60 + // Hide window decoration when switching to fullsccreen / minimized otherwise show decoration. + // The window decoration visibility has to be changed before doing actual window state + // change since in that order the availableGeometry will return directly the right size and + // we will avoid unnecessarty redraws + CEikStatusPane* statusPane = S60->statusPane(); + CEikButtonGroupContainer* buttonGroup = S60->buttonGroupContainer(); + TBool visible = !(newstate & (Qt::WindowFullScreen | Qt::WindowMinimized)); + if (statusPane) + statusPane->MakeVisible(visible); + if (buttonGroup) + buttonGroup->MakeVisible(visible); #endif // Q_WS_S60 createWinId(); Q_ASSERT(testAttribute(Qt::WA_WState_Created)); - QTLWExtra *top = d->topData(); - // Ensure the initial size is valid, since we store it as normalGeometry below. if (!testAttribute(Qt::WA_Resized) && !isVisible()) adjustSize(); - if ((oldstate & Qt::WindowMaximized) != (newstate & Qt::WindowMaximized)) { - if ((newstate & Qt::WindowMaximized)) { - const QRect normalGeometry = geometry(); + QTLWExtra *top = d->topData(); + const QRect normalGeometry = (top->normalGeometry.width() < 0) ? geometry() : top->normalGeometry; - const QRect r = top->normalGeometry; - setGeometry(qApp->desktop()->availableGeometry(this)); - top->normalGeometry = r; + if (newstate & Qt::WindowFullScreen) + setGeometry(qApp->desktop()->screenGeometry(this)); + else if (newstate & Qt::WindowMaximized) + setGeometry(qApp->desktop()->availableGeometry(this)); + else + setGeometry(normalGeometry); - if (top->normalGeometry.width() < 0) - top->normalGeometry = normalGeometry; - } else { - // restore original geometry - setGeometry(top->normalGeometry); - } - } - if ((oldstate & Qt::WindowFullScreen) != (newstate & Qt::WindowFullScreen)) { - if (newstate & Qt::WindowFullScreen) { - const QRect normalGeometry = geometry(); - const QRect r = top->normalGeometry; - setGeometry(qApp->desktop()->screenGeometry(this)); - - top->normalGeometry = r; - if (top->normalGeometry.width() < 0) - top->normalGeometry = normalGeometry; - } else { - if (newstate & Qt::WindowMaximized) { - const QRect r = top->normalGeometry; - setGeometry(qApp->desktop()->availableGeometry(this)); - top->normalGeometry = r; - } else { - setGeometry(top->normalGeometry); - } - } - } - if ((oldstate & Qt::WindowMinimized) != (newstate & Qt::WindowMinimized)) { - if (newstate & Qt::WindowMinimized) { - if (isVisible()) { - QSymbianControl *id = static_cast(effectiveWinId()); - if (id->IsFocused()) // Avoid unnecessary calls to FocusChanged() - id->setFocusSafely(false); - id->MakeVisible(false); - } - } else { - if (isVisible()) { - QSymbianControl *id = static_cast(effectiveWinId()); - id->MakeVisible(true); - if (!id->IsFocused()) // Avoid unnecessary calls to FocusChanged() - id->setFocusSafely(true); - } - const QRect normalGeometry = geometry(); - const QRect r = top->normalGeometry; - top->normalGeometry = r; - if (top->normalGeometry.width() < 0) - top->normalGeometry = normalGeometry; - } - } + //restore normal geometry + top->normalGeometry = normalGeometry; } data->window_state = newstate; diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index ea90ae3..88bdc72 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -391,6 +391,10 @@ private slots: #ifdef Q_OS_SYMBIAN void cbaVisibility(); + void fullScreenWindowModeTransitions(); + void maximizedWindowModeTransitions(); + void minimizedWindowModeTransitions(); + void normalWindowModeTransitions(); #endif void focusProxyAndInputMethods(); @@ -9687,6 +9691,226 @@ void tst_QWidget::cbaVisibility() CEikButtonGroupContainer* buttonGroup = CEikonEnv::Static()->AppUiFactory()->Cba(); QVERIFY(buttonGroup->IsVisible()); } + +void tst_QWidget::fullScreenWindowModeTransitions() +{ + QWidget widget; + QVBoxLayout *layout = new QVBoxLayout; + QPushButton *button = new QPushButton("test Button"); + layout->addWidget(button); + widget.setLayout(layout); + widget.show(); + + const QRect normalGeometry = widget.normalGeometry(); + const QRect fullScreenGeometry = qApp->desktop()->screenGeometry(&widget); + const QRect maximumScreenGeometry = qApp->desktop()->availableGeometry(&widget); + CEikStatusPane *statusPane = CEikonEnv::Static()->AppUiFactory()->StatusPane(); + CEikButtonGroupContainer *buttonGroup = CEikonEnv::Static()->AppUiFactory()->Cba(); + + //Enter + widget.showNormal(); + widget.showFullScreen(); + QCOMPARE(widget.geometry(), fullScreenGeometry); + QVERIFY(!buttonGroup->IsVisible()); + QVERIFY(!statusPane->IsVisible()); + + widget.showMaximized(); + widget.showFullScreen(); + QCOMPARE(widget.geometry(), fullScreenGeometry); + QVERIFY(!buttonGroup->IsVisible()); + QVERIFY(!statusPane->IsVisible()); + + widget.showMinimized(); + widget.showFullScreen(); + QCOMPARE(widget.geometry(), fullScreenGeometry); + QVERIFY(!buttonGroup->IsVisible()); + QVERIFY(!statusPane->IsVisible()); + + //Exit + widget.showFullScreen(); + widget.showNormal(); + QCOMPARE(widget.geometry(), normalGeometry); + QVERIFY(buttonGroup->IsVisible()); + QVERIFY(statusPane->IsVisible()); + + widget.showFullScreen(); + widget.showMaximized(); + QCOMPARE(widget.geometry(), maximumScreenGeometry); + QVERIFY(buttonGroup->IsVisible()); + QVERIFY(statusPane->IsVisible()); + + widget.showFullScreen(); + widget.showMinimized(); + QCOMPARE(widget.geometry(), fullScreenGeometry); + QVERIFY(!buttonGroup->IsVisible()); + QVERIFY(!statusPane->IsVisible()); +} + +void tst_QWidget::maximizedWindowModeTransitions() +{ + QWidget widget; + QVBoxLayout *layout = new QVBoxLayout; + QPushButton *button = new QPushButton("test Button"); + layout->addWidget(button); + widget.setLayout(layout); + widget.show(); + + const QRect normalGeometry = widget.normalGeometry(); + const QRect fullScreenGeometry = qApp->desktop()->screenGeometry(&widget); + const QRect maximumScreenGeometry = qApp->desktop()->availableGeometry(&widget); + CEikStatusPane *statusPane = CEikonEnv::Static()->AppUiFactory()->StatusPane(); + CEikButtonGroupContainer *buttonGroup = CEikonEnv::Static()->AppUiFactory()->Cba(); + + //Enter + widget.showNormal(); + widget.showMaximized(); + QCOMPARE(widget.geometry(), maximumScreenGeometry); + QVERIFY(buttonGroup->IsVisible()); + QVERIFY(statusPane->IsVisible()); + + widget.showFullScreen(); + widget.showMaximized(); + QCOMPARE(widget.geometry(), maximumScreenGeometry); + QVERIFY(buttonGroup->IsVisible()); + QVERIFY(statusPane->IsVisible()); + + widget.showMinimized(); + widget.showMaximized(); + QCOMPARE(widget.geometry(), maximumScreenGeometry); + QVERIFY(buttonGroup->IsVisible()); + QVERIFY(statusPane->IsVisible()); + + //Exit + widget.showMaximized(); + widget.showNormal(); + QCOMPARE(widget.geometry(), normalGeometry); + QVERIFY(buttonGroup->IsVisible()); + QVERIFY(statusPane->IsVisible()); + + widget.showMaximized(); + widget.showFullScreen(); + QCOMPARE(widget.geometry(), fullScreenGeometry); + QVERIFY(!buttonGroup->IsVisible()); + QVERIFY(!statusPane->IsVisible()); + + widget.showMaximized(); + widget.showMinimized(); + // Since showMinimized hides window decoration availableGeometry gives different value + // than with decoration visible. Altual size does not really matter since widget is invisible. + QCOMPARE(widget.geometry(), qApp->desktop()->availableGeometry(&widget)); + QVERIFY(!buttonGroup->IsVisible()); + QVERIFY(!statusPane->IsVisible()); +} + +void tst_QWidget::minimizedWindowModeTransitions() +{ + QWidget widget; + QVBoxLayout *layout = new QVBoxLayout; + QPushButton *button = new QPushButton("test Button"); + layout->addWidget(button); + widget.setLayout(layout); + widget.show(); + + const QRect normalGeometry = widget.normalGeometry(); + const QRect fullScreenGeometry = qApp->desktop()->screenGeometry(&widget); + const QRect maximumScreenGeometry = qApp->desktop()->availableGeometry(&widget); + CEikStatusPane *statusPane = CEikonEnv::Static()->AppUiFactory()->StatusPane(); + CEikButtonGroupContainer *buttonGroup = CEikonEnv::Static()->AppUiFactory()->Cba(); + + //Enter + widget.showNormal(); + widget.showMinimized(); + QCOMPARE(widget.geometry(), normalGeometry); + QVERIFY(!buttonGroup->IsVisible()); + QVERIFY(!statusPane->IsVisible()); + + widget.showFullScreen(); + widget.showMinimized(); + QCOMPARE(widget.geometry(), fullScreenGeometry); + QVERIFY(!buttonGroup->IsVisible()); + QVERIFY(!statusPane->IsVisible()); + + widget.showMaximized(); + widget.showMinimized(); + // Since showMinimized hides window decoration availableGeometry gives different value + // than with decoration visible. Altual size does not really matter since widget is invisible. + QCOMPARE(widget.geometry(), qApp->desktop()->availableGeometry(&widget)); + QVERIFY(!buttonGroup->IsVisible()); + QVERIFY(!statusPane->IsVisible()); + + //Exit + widget.showMinimized(); + widget.showNormal(); + QCOMPARE(widget.geometry(), normalGeometry); + QVERIFY(buttonGroup->IsVisible()); + QVERIFY(statusPane->IsVisible()); + + widget.showMinimized(); + widget.showFullScreen(); + QCOMPARE(widget.geometry(), fullScreenGeometry); + QVERIFY(!buttonGroup->IsVisible()); + QVERIFY(!statusPane->IsVisible()); + + widget.showMinimized(); + widget.showMaximized(); + QCOMPARE(widget.geometry(), maximumScreenGeometry); + QVERIFY(buttonGroup->IsVisible()); + QVERIFY(statusPane->IsVisible()); +} + +void tst_QWidget::normalWindowModeTransitions() +{ + QWidget widget; + QVBoxLayout *layout = new QVBoxLayout; + QPushButton *button = new QPushButton("test Button"); + layout->addWidget(button); + widget.setLayout(layout); + widget.show(); + + const QRect normalGeometry = widget.normalGeometry(); + const QRect fullScreenGeometry = qApp->desktop()->screenGeometry(&widget); + const QRect maximumScreenGeometry = qApp->desktop()->availableGeometry(&widget); + CEikStatusPane *statusPane = CEikonEnv::Static()->AppUiFactory()->StatusPane(); + CEikButtonGroupContainer *buttonGroup = CEikonEnv::Static()->AppUiFactory()->Cba(); + + //Enter + widget.showMaximized(); + widget.showNormal(); + QCOMPARE(widget.geometry(), normalGeometry); + QVERIFY(buttonGroup->IsVisible()); + QVERIFY(statusPane->IsVisible()); + + widget.showFullScreen(); + widget.showNormal(); + QCOMPARE(widget.geometry(), normalGeometry); + QVERIFY(buttonGroup->IsVisible()); + QVERIFY(statusPane->IsVisible()); + + widget.showMinimized(); + widget.showNormal(); + QCOMPARE(widget.geometry(), normalGeometry); + QVERIFY(buttonGroup->IsVisible()); + QVERIFY(statusPane->IsVisible()); + + //Exit + widget.showNormal(); + widget.showMaximized(); + QCOMPARE(widget.geometry(), maximumScreenGeometry); + QVERIFY(buttonGroup->IsVisible()); + QVERIFY(statusPane->IsVisible()); + + widget.showNormal(); + widget.showFullScreen(); + QCOMPARE(widget.geometry(), fullScreenGeometry); + QVERIFY(!buttonGroup->IsVisible()); + QVERIFY(!statusPane->IsVisible()); + + widget.showNormal(); + widget.showMinimized(); + QCOMPARE(widget.geometry(), normalGeometry); + QVERIFY(!buttonGroup->IsVisible()); + QVERIFY(!statusPane->IsVisible()); +} #endif class InputContextTester : public QInputContext -- cgit v0.12 From fd12fbcf332878ab6a5b6ef8f09804b8598faced Mon Sep 17 00:00:00 2001 From: Jani Hautakangas Date: Fri, 5 Feb 2010 12:29:08 +0200 Subject: Whitespace/tab fixes. Reviewed-by: Trust me --- src/gui/kernel/qwidget_s60.cpp | 2 +- tests/auto/qwidget/tst_qwidget.cpp | 90 +++++++++++++++++++------------------- 2 files changed, 46 insertions(+), 46 deletions(-) diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index c84e1cc..a844430 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -1083,7 +1083,7 @@ void QWidget::setWindowState(Qt::WindowStates newstate) setGeometry(qApp->desktop()->screenGeometry(this)); else if (newstate & Qt::WindowMaximized) setGeometry(qApp->desktop()->availableGeometry(this)); - else + else setGeometry(normalGeometry); //restore normal geometry diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 88bdc72..80b693c 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -9700,50 +9700,50 @@ void tst_QWidget::fullScreenWindowModeTransitions() layout->addWidget(button); widget.setLayout(layout); widget.show(); - + const QRect normalGeometry = widget.normalGeometry(); const QRect fullScreenGeometry = qApp->desktop()->screenGeometry(&widget); const QRect maximumScreenGeometry = qApp->desktop()->availableGeometry(&widget); CEikStatusPane *statusPane = CEikonEnv::Static()->AppUiFactory()->StatusPane(); CEikButtonGroupContainer *buttonGroup = CEikonEnv::Static()->AppUiFactory()->Cba(); - - //Enter + + //Enter widget.showNormal(); widget.showFullScreen(); QCOMPARE(widget.geometry(), fullScreenGeometry); QVERIFY(!buttonGroup->IsVisible()); - QVERIFY(!statusPane->IsVisible()); - + QVERIFY(!statusPane->IsVisible()); + widget.showMaximized(); widget.showFullScreen(); QCOMPARE(widget.geometry(), fullScreenGeometry); QVERIFY(!buttonGroup->IsVisible()); - QVERIFY(!statusPane->IsVisible()); - + QVERIFY(!statusPane->IsVisible()); + widget.showMinimized(); widget.showFullScreen(); QCOMPARE(widget.geometry(), fullScreenGeometry); QVERIFY(!buttonGroup->IsVisible()); - QVERIFY(!statusPane->IsVisible()); - - //Exit + QVERIFY(!statusPane->IsVisible()); + + //Exit widget.showFullScreen(); widget.showNormal(); QCOMPARE(widget.geometry(), normalGeometry); QVERIFY(buttonGroup->IsVisible()); - QVERIFY(statusPane->IsVisible()); + QVERIFY(statusPane->IsVisible()); widget.showFullScreen(); widget.showMaximized(); QCOMPARE(widget.geometry(), maximumScreenGeometry); QVERIFY(buttonGroup->IsVisible()); - QVERIFY(statusPane->IsVisible()); + QVERIFY(statusPane->IsVisible()); widget.showFullScreen(); widget.showMinimized(); QCOMPARE(widget.geometry(), fullScreenGeometry); QVERIFY(!buttonGroup->IsVisible()); - QVERIFY(!statusPane->IsVisible()); + QVERIFY(!statusPane->IsVisible()); } void tst_QWidget::maximizedWindowModeTransitions() @@ -9760,38 +9760,38 @@ void tst_QWidget::maximizedWindowModeTransitions() const QRect maximumScreenGeometry = qApp->desktop()->availableGeometry(&widget); CEikStatusPane *statusPane = CEikonEnv::Static()->AppUiFactory()->StatusPane(); CEikButtonGroupContainer *buttonGroup = CEikonEnv::Static()->AppUiFactory()->Cba(); - + //Enter widget.showNormal(); widget.showMaximized(); QCOMPARE(widget.geometry(), maximumScreenGeometry); QVERIFY(buttonGroup->IsVisible()); - QVERIFY(statusPane->IsVisible()); - + QVERIFY(statusPane->IsVisible()); + widget.showFullScreen(); widget.showMaximized(); QCOMPARE(widget.geometry(), maximumScreenGeometry); QVERIFY(buttonGroup->IsVisible()); - QVERIFY(statusPane->IsVisible()); - + QVERIFY(statusPane->IsVisible()); + widget.showMinimized(); widget.showMaximized(); QCOMPARE(widget.geometry(), maximumScreenGeometry); QVERIFY(buttonGroup->IsVisible()); - QVERIFY(statusPane->IsVisible()); - + QVERIFY(statusPane->IsVisible()); + //Exit widget.showMaximized(); widget.showNormal(); QCOMPARE(widget.geometry(), normalGeometry); QVERIFY(buttonGroup->IsVisible()); - QVERIFY(statusPane->IsVisible()); + QVERIFY(statusPane->IsVisible()); widget.showMaximized(); widget.showFullScreen(); QCOMPARE(widget.geometry(), fullScreenGeometry); QVERIFY(!buttonGroup->IsVisible()); - QVERIFY(!statusPane->IsVisible()); + QVERIFY(!statusPane->IsVisible()); widget.showMaximized(); widget.showMinimized(); @@ -9799,7 +9799,7 @@ void tst_QWidget::maximizedWindowModeTransitions() // than with decoration visible. Altual size does not really matter since widget is invisible. QCOMPARE(widget.geometry(), qApp->desktop()->availableGeometry(&widget)); QVERIFY(!buttonGroup->IsVisible()); - QVERIFY(!statusPane->IsVisible()); + QVERIFY(!statusPane->IsVisible()); } void tst_QWidget::minimizedWindowModeTransitions() @@ -9810,52 +9810,52 @@ void tst_QWidget::minimizedWindowModeTransitions() layout->addWidget(button); widget.setLayout(layout); widget.show(); - + const QRect normalGeometry = widget.normalGeometry(); const QRect fullScreenGeometry = qApp->desktop()->screenGeometry(&widget); const QRect maximumScreenGeometry = qApp->desktop()->availableGeometry(&widget); CEikStatusPane *statusPane = CEikonEnv::Static()->AppUiFactory()->StatusPane(); CEikButtonGroupContainer *buttonGroup = CEikonEnv::Static()->AppUiFactory()->Cba(); - + //Enter widget.showNormal(); widget.showMinimized(); QCOMPARE(widget.geometry(), normalGeometry); QVERIFY(!buttonGroup->IsVisible()); - QVERIFY(!statusPane->IsVisible()); - + QVERIFY(!statusPane->IsVisible()); + widget.showFullScreen(); widget.showMinimized(); QCOMPARE(widget.geometry(), fullScreenGeometry); QVERIFY(!buttonGroup->IsVisible()); - QVERIFY(!statusPane->IsVisible()); - + QVERIFY(!statusPane->IsVisible()); + widget.showMaximized(); widget.showMinimized(); // Since showMinimized hides window decoration availableGeometry gives different value // than with decoration visible. Altual size does not really matter since widget is invisible. QCOMPARE(widget.geometry(), qApp->desktop()->availableGeometry(&widget)); QVERIFY(!buttonGroup->IsVisible()); - QVERIFY(!statusPane->IsVisible()); + QVERIFY(!statusPane->IsVisible()); //Exit widget.showMinimized(); widget.showNormal(); QCOMPARE(widget.geometry(), normalGeometry); QVERIFY(buttonGroup->IsVisible()); - QVERIFY(statusPane->IsVisible()); + QVERIFY(statusPane->IsVisible()); widget.showMinimized(); widget.showFullScreen(); QCOMPARE(widget.geometry(), fullScreenGeometry); QVERIFY(!buttonGroup->IsVisible()); - QVERIFY(!statusPane->IsVisible()); + QVERIFY(!statusPane->IsVisible()); widget.showMinimized(); widget.showMaximized(); QCOMPARE(widget.geometry(), maximumScreenGeometry); QVERIFY(buttonGroup->IsVisible()); - QVERIFY(statusPane->IsVisible()); + QVERIFY(statusPane->IsVisible()); } void tst_QWidget::normalWindowModeTransitions() @@ -9866,50 +9866,50 @@ void tst_QWidget::normalWindowModeTransitions() layout->addWidget(button); widget.setLayout(layout); widget.show(); - + const QRect normalGeometry = widget.normalGeometry(); const QRect fullScreenGeometry = qApp->desktop()->screenGeometry(&widget); const QRect maximumScreenGeometry = qApp->desktop()->availableGeometry(&widget); CEikStatusPane *statusPane = CEikonEnv::Static()->AppUiFactory()->StatusPane(); CEikButtonGroupContainer *buttonGroup = CEikonEnv::Static()->AppUiFactory()->Cba(); - + //Enter widget.showMaximized(); widget.showNormal(); QCOMPARE(widget.geometry(), normalGeometry); QVERIFY(buttonGroup->IsVisible()); - QVERIFY(statusPane->IsVisible()); - + QVERIFY(statusPane->IsVisible()); + widget.showFullScreen(); widget.showNormal(); QCOMPARE(widget.geometry(), normalGeometry); QVERIFY(buttonGroup->IsVisible()); - QVERIFY(statusPane->IsVisible()); - + QVERIFY(statusPane->IsVisible()); + widget.showMinimized(); widget.showNormal(); QCOMPARE(widget.geometry(), normalGeometry); QVERIFY(buttonGroup->IsVisible()); - QVERIFY(statusPane->IsVisible()); - + QVERIFY(statusPane->IsVisible()); + //Exit widget.showNormal(); widget.showMaximized(); QCOMPARE(widget.geometry(), maximumScreenGeometry); QVERIFY(buttonGroup->IsVisible()); - QVERIFY(statusPane->IsVisible()); + QVERIFY(statusPane->IsVisible()); widget.showNormal(); widget.showFullScreen(); QCOMPARE(widget.geometry(), fullScreenGeometry); QVERIFY(!buttonGroup->IsVisible()); - QVERIFY(!statusPane->IsVisible()); - + QVERIFY(!statusPane->IsVisible()); + widget.showNormal(); widget.showMinimized(); QCOMPARE(widget.geometry(), normalGeometry); QVERIFY(!buttonGroup->IsVisible()); - QVERIFY(!statusPane->IsVisible()); + QVERIFY(!statusPane->IsVisible()); } #endif -- cgit v0.12 From 95012c3ca7ef52ea8f2a2ecb67987b8575758987 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Fri, 5 Feb 2010 14:01:17 +0200 Subject: Fix to S60 softkey pressed down image. On Symbian the icons which are passed to softkeys, i.e. to actions with softkey role, need to use pixmap alpha channel instead of mask. Otherwise S60 CBA framework fails to create 50% transparent pressed down mask for softkey icon. Task-number: QTBUG-7314 Review-By: Sami Merila --- src/gui/kernel/qaction.cpp | 4 ++++ src/gui/kernel/qsoftkeymanager_s60.cpp | 19 ++++++++----------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/gui/kernel/qaction.cpp b/src/gui/kernel/qaction.cpp index 4b7d949..8ddd051 100644 --- a/src/gui/kernel/qaction.cpp +++ b/src/gui/kernel/qaction.cpp @@ -715,6 +715,10 @@ QActionGroup *QAction::actionGroup() const it is displayed to the left of the menu text. There is no default icon. + On Symbian the icons which are passed to softkeys, i.e. to actions with + softkey role, need to have pixmap alpha channel correctly set otherwise + drawing artifacts will appear when softkey is pressed down. + If a null icon (QIcon::isNull() is passed into this function, the icon of the action is cleared. */ diff --git a/src/gui/kernel/qsoftkeymanager_s60.cpp b/src/gui/kernel/qsoftkeymanager_s60.cpp index a72d16c..af84a8f 100644 --- a/src/gui/kernel/qsoftkeymanager_s60.cpp +++ b/src/gui/kernel/qsoftkeymanager_s60.cpp @@ -237,21 +237,18 @@ bool QSoftKeyManagerPrivateS60::setSoftkeyImage(CEikButtonGroupContainer *cba, // prepareSoftkeyPixmap creates a new pixmap with requiredIconSize and blits the 'pmWihtAspectRatio' // to correct location of it QPixmap softkeyPixmap = prepareSoftkeyPixmap(pmWihtAspectRatio, position, requiredIconSize); - QBitmap softkeyMask = softkeyPixmap.mask(); - if (softkeyMask.isNull()) { - softkeyMask = QBitmap(softkeyPixmap.size()); - softkeyMask.fill(Qt::color1); - } - // Softkey mask in > SV_S60_5_1 has to be inverted - if(QSysInfo::s60Version() > QSysInfo::SV_S60_5_1) { - QImage maskImage = softkeyMask.toImage(); - maskImage.invertPixels(); - softkeyMask = QPixmap::fromImage(maskImage); + QPixmap softkeyAlpha = softkeyPixmap.alphaChannel(); + // Alpha channel in 5.1 and older devices need to be inverted + // TODO: Switch to use toSymbianCFbsBitmap with invert when available + if(QSysInfo::s60Version() <= QSysInfo::SV_S60_5_1) { + QImage alphaImage = softkeyAlpha.toImage(); + alphaImage.invertPixels(); + softkeyAlpha = QPixmap::fromImage(alphaImage); } CFbsBitmap* nBitmap = softkeyPixmap.toSymbianCFbsBitmap(); - CFbsBitmap* nMask = softkeyMask.toSymbianCFbsBitmap(); + CFbsBitmap* nMask = softkeyAlpha.toSymbianCFbsBitmap(); CEikImage* myimage = new (ELeave) CEikImage; myimage->SetPicture( nBitmap, nMask ); // nBitmap and nMask ownership transfered -- cgit v0.12 From 3fdc70e9272f1a0ddd087f0d908a64ce2d4e4302 Mon Sep 17 00:00:00 2001 From: axis Date: Fri, 5 Feb 2010 13:48:35 +0100 Subject: Fixed indentation. --- src/gui/inputmethod/qcoefepinputcontext_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/inputmethod/qcoefepinputcontext_p.h b/src/gui/inputmethod/qcoefepinputcontext_p.h index f5034fc..73c13d9 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_p.h +++ b/src/gui/inputmethod/qcoefepinputcontext_p.h @@ -127,7 +127,7 @@ public: private: void DoCommitFepInlineEditL(); MCoeFepAwareTextEditor_Extension1* Extension1(TBool& aSetToTrue); - void ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateEvent aEventType); + void ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateEvent aEventType); // From MCoeFepAwareTextEditor_Extension1 public: -- cgit v0.12 From e3237deee07ec6961b905800d29b1a80f0f63595 Mon Sep 17 00:00:00 2001 From: axis Date: Fri, 5 Feb 2010 13:49:46 +0100 Subject: Removed useless member variable and replaced with var on the stack. RevBy: Trust me --- src/gui/inputmethod/qcoefepinputcontext_p.h | 1 - src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 9 +++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gui/inputmethod/qcoefepinputcontext_p.h b/src/gui/inputmethod/qcoefepinputcontext_p.h index 73c13d9..f325fb9 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_p.h +++ b/src/gui/inputmethod/qcoefepinputcontext_p.h @@ -151,7 +151,6 @@ private: int m_inlinePosition; MFepInlineTextFormatRetriever *m_formatRetriever; MFepPointerEventHandlerDuringInlineEdit *m_pointerHandler; - int m_longPress; int m_cursorPos; QBasicTimer m_tempPreeditStringTimeout; bool m_hasTempPreeditString; diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index e5ab300..56b79f4 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -71,7 +71,6 @@ QCoeFepInputContext::QCoeFepInputContext(QObject *parent) m_inlinePosition(0), m_formatRetriever(0), m_pointerHandler(0), - m_longPress(0), m_cursorPos(0), m_hasTempPreeditString(false) { @@ -744,24 +743,26 @@ void QCoeFepInputContext::DoCommitFepInlineEditL() void QCoeFepInputContext::commitCurrentString(bool triggeredBySymbian) { + int longPress = 0; + if (m_preeditString.size() == 0) { QWidget *w = focusWidget(); if (triggeredBySymbian && w) { // We must replace the last character only if the input box has already accepted one if (w->inputMethodQuery(Qt::ImCursorPosition).toInt() != m_cursorPos) - m_longPress = 1; + longPress = 1; } return; } QList attributes; QInputMethodEvent event(QLatin1String(""), attributes); - event.setCommitString(m_preeditString, 0-m_longPress, m_longPress); + event.setCommitString(m_preeditString, 0-longPress, longPress); m_preeditString.clear(); sendEvent(event); m_hasTempPreeditString = false; - m_longPress = 0; + longPress = 0; if (!triggeredBySymbian) { CCoeFep* fep = CCoeEnv::Static()->Fep(); -- cgit v0.12 From 1e8a17edef013e70fa0d0c20a04e713c190c0bec Mon Sep 17 00:00:00 2001 From: axis Date: Fri, 5 Feb 2010 13:51:28 +0100 Subject: Fixed sendEvent call. The documentation states we should use the local sendEvent. Not sure if it makes a difference, but better to be consistent. RevBy: Trust me --- src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index 56b79f4..41481d0 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -233,7 +233,7 @@ bool QCoeFepInputContext::filterEvent(const QEvent *event) m_preeditString = keyEvent->text(); QList attributes; QInputMethodEvent imEvent(m_preeditString, attributes); - QApplication::sendEvent(focusWidget(), &imEvent); + sendEvent(imEvent); m_tempPreeditStringTimeout.start(1000, this); m_hasTempPreeditString = true; update(); -- cgit v0.12 From cafc2a861b139c33d3989c625deb76a874159fbe Mon Sep 17 00:00:00 2001 From: axis Date: Fri, 5 Feb 2010 13:53:12 +0100 Subject: Fixed a bug where text would disappear in password fields. There were two bugs: - First, we need to avoid triggering the CancelTransaction call when committing the temporary preedit text, because otherwise FEP starts sending us spurious backspace events. Since the "triggeredBySymbian" variable is no longer descriptive for that use case, I renamed it in the process and that changed the negation of the flag. Notice the absense of a change inside commitTemporaryPreeditString(). That is because we want that one to avoid the transaction cancel, and therefore wee keep the old negation. - Second, m_cursorPos needs to be kept in sync with the widget state when we send the temporary preedit string, because the input context cannot separate between types of preedit text when it hits the first block in commitCurrentString() (types being either our temporary text, or FEP's text), and we have to avoid the longPress code path. RevBy: Janne Koskinen --- src/gui/inputmethod/qcoefepinputcontext_p.h | 2 +- src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/gui/inputmethod/qcoefepinputcontext_p.h b/src/gui/inputmethod/qcoefepinputcontext_p.h index f325fb9..d5243c3 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_p.h +++ b/src/gui/inputmethod/qcoefepinputcontext_p.h @@ -96,7 +96,7 @@ protected: void timerEvent(QTimerEvent *timerEvent); private: - void commitCurrentString(bool triggeredBySymbian); + void commitCurrentString(bool cancelFepTransaction); void updateHints(bool mustUpdateInputCapabilities); void applyHints(Qt::InputMethodHints hints); void applyFormat(QList *attributes); diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index 41481d0..2b91711 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -100,7 +100,7 @@ QCoeFepInputContext::~QCoeFepInputContext() void QCoeFepInputContext::reset() { - commitCurrentString(false); + commitCurrentString(true); } void QCoeFepInputContext::ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateEvent aEventType) @@ -125,7 +125,7 @@ void QCoeFepInputContext::update() void QCoeFepInputContext::setFocusWidget(QWidget *w) { - commitCurrentString(false); + commitCurrentString(true); QInputContext::setFocusWidget(w); @@ -218,7 +218,7 @@ bool QCoeFepInputContext::filterEvent(const QEvent *event) break; case Qt::Key_Select: if (!m_preeditString.isEmpty()) { - commitCurrentString(false); + commitCurrentString(true); return true; } break; @@ -230,6 +230,7 @@ bool QCoeFepInputContext::filterEvent(const QEvent *event) && focusWidget()->inputMethodHints() & Qt::ImhHiddenText && !keyEvent->text().isEmpty()) { // Send some temporary preedit text in order to make text visible for a moment. + m_cursorPos = focusWidget()->inputMethodQuery(Qt::ImCursorPosition).toInt(); m_preeditString = keyEvent->text(); QList attributes; QInputMethodEvent imEvent(m_preeditString, attributes); @@ -292,7 +293,7 @@ void QCoeFepInputContext::mouseHandler( int x, QMouseEvent *event) Q_ASSERT(focusWidget()); if (event->type() == QEvent::MouseButtonPress && event->button() == Qt::LeftButton) { - commitCurrentString(false); + commitCurrentString(true); int pos = focusWidget()->inputMethodQuery(Qt::ImCursorPosition).toInt(); QList attributes; @@ -738,16 +739,16 @@ void QCoeFepInputContext::GetScreenCoordinatesForFepL(TPoint& aLeftSideOfBaseLin void QCoeFepInputContext::DoCommitFepInlineEditL() { - commitCurrentString(true); + commitCurrentString(false); } -void QCoeFepInputContext::commitCurrentString(bool triggeredBySymbian) +void QCoeFepInputContext::commitCurrentString(bool cancelFepTransaction) { int longPress = 0; if (m_preeditString.size() == 0) { QWidget *w = focusWidget(); - if (triggeredBySymbian && w) { + if (!cancelFepTransaction && w) { // We must replace the last character only if the input box has already accepted one if (w->inputMethodQuery(Qt::ImCursorPosition).toInt() != m_cursorPos) longPress = 1; @@ -764,7 +765,7 @@ void QCoeFepInputContext::commitCurrentString(bool triggeredBySymbian) m_hasTempPreeditString = false; longPress = 0; - if (!triggeredBySymbian) { + if (cancelFepTransaction) { CCoeFep* fep = CCoeEnv::Static()->Fep(); if (fep) fep->CancelTransaction(); -- cgit v0.12 From 3b7164b3188e9382510bef2211e82ef777faa75c Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Fri, 5 Feb 2010 21:31:10 +0100 Subject: Fixed casual crash in initializeDb (Symbian) dynamic_cast should be used carefully with rvct before version 4. We found that out after the a dynamic (down)-cast from CFont* to CFbsFont* in QtGui suddenly failed. We test for (TypeUid() == KCFbsFontUid), before doing the cast. So, a static_cast is safe in this case. Also the other two dynamic_casts in qfontdatabase_s60.cpp were changed to static_cast. http://bugreports.qt.nokia.com/browse/QTBUG-7963 Task-number: QTBUG-7963 Reviewed-by: lars modified: src/gui/text/qfontdatabase_s60.cpp --- src/gui/text/qfontdatabase_s60.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/gui/text/qfontdatabase_s60.cpp b/src/gui/text/qfontdatabase_s60.cpp index f8de08f..7e5397d 100644 --- a/src/gui/text/qfontdatabase_s60.cpp +++ b/src/gui/text/qfontdatabase_s60.cpp @@ -246,8 +246,8 @@ static void initializeDb() QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock); const int numTypeFaces = QS60Data::screenDevice()->NumTypefaces(); - const QFontDatabaseS60StoreImplementation *store = dynamic_cast(db->s60Store); - Q_ASSERT(store); + const QFontDatabaseS60StoreImplementation *store = + static_cast(db->s60Store); bool fontAdded = false; for (int i = 0; i < numTypeFaces; i++) { TTypefaceSupport typefaceSupport; @@ -258,8 +258,7 @@ static void initializeDb() continue; if (font->TypeUid() == KCFbsFontUid) { TOpenFontFaceAttrib faceAttrib; - const CFbsFont *cfbsFont = dynamic_cast(font); - Q_ASSERT(cfbsFont); + const CFbsFont *cfbsFont = static_cast(font); cfbsFont->GetFaceAttrib(faceAttrib); QtFontStyle::Key styleKey; @@ -390,8 +389,8 @@ QFontEngine *QFontDatabase::findFont(int script, const QFontPrivate *, const QFo QFontDef request = req; request.family = fontFamily; #if defined(QT_NO_FREETYPE) - const QFontDatabaseS60StoreImplementation *store = dynamic_cast(db->s60Store); - Q_ASSERT(store); + const QFontDatabaseS60StoreImplementation *store = + static_cast(db->s60Store); const QFontEngineS60Extensions *extension = store->extension(fontFamily); fe = new QFontEngineS60(request, extension); #else -- cgit v0.12