From 09df1ded0bc52700b19b19edf17f7dff5a16a2d9 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Thu, 1 Oct 2009 14:29:39 +0300 Subject: Worked around S60 3.1 bug in CCoeControl::PositionRelativeToScreen CCoeControl::PositionRelativeToScreen sometimes freezes the device in S60 3.1 based devices. Exact cause is unknown, but it might be OOM situation given that some cases where this is an issue, changing to a simpler theme makes the freeze go away. Task-number: QTBUG-4565 Reviewed-by: Sami Merila Reviewed-by: Espen Riskedal --- src/gui/styles/qs60style_s60.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index 131d8bc..cde48d8 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -635,8 +635,18 @@ bool QS60StylePrivate::isToolBarBackground() QPoint qt_s60_fill_background_offset(const QWidget *targetWidget) { CCoeControl *control = targetWidget->effectiveWinId(); - TPoint globalPos = control ? control->PositionRelativeToScreen() : TPoint(0,0); - return QPoint(globalPos.iX, globalPos.iY); + TPoint pos(0,0); + if (control) { + // FIXME properly: S60 3.1 has a bug that CCoeControl::PositionRelativeToScreen sometimes + // freezes the device, possibly in cases where we run out of memory. + // We use CCoeControl::Position instead in S60 3.1, which returns same values + // in most cases. + if (QSysInfo::s60Version() == QSysInfo::SV_S60_3_1) + pos = control->Position(); + else + pos = control->PositionRelativeToScreen(); + } + return QPoint(pos.iX, pos.iY); } QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsLX( @@ -1137,11 +1147,11 @@ QPixmap QS60StylePrivate::part(QS60StyleEnums::SkinParts part, const QSize &size, SkinElementFlags flags) { QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock); - + QPixmap result = (flags & SF_ColorSkinned)? QS60StyleModeSpecifics::colorSkinnedGraphics(part, size, flags) : QS60StyleModeSpecifics::skinnedGraphics(part, size, flags); - + lock.relock(); if (flags & SF_StateDisabled && !QS60StyleModeSpecifics::disabledPartGraphic(part)) { -- cgit v0.12