summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2011-03-31 13:54:58 (GMT)
committerOlivier Goffart <olivier.goffart@nokia.com>2011-03-31 13:54:58 (GMT)
commit37feac98c573a099502fddfb5703c2359711b4c4 (patch)
tree33d74f9650065de4564bc0d749ca50bd65b13a2c /src/gui/kernel
parent7b18baf23b1e8c663872b2b25b1323798b1d09df (diff)
parentb764d3e6cb114988394e7500236ba087a3385a50 (diff)
downloadQt-37feac98c573a099502fddfb5703c2359711b4c4.zip
Qt-37feac98c573a099502fddfb5703c2359711b4c4.tar.gz
Qt-37feac98c573a099502fddfb5703c2359711b4c4.tar.bz2
Merge remote-tracking branch 'origin/4.7' into qt-master-from-4.7
Conflicts: doc/src/declarative/example-slideswitch.qdoc doc/src/development/qmake-manual.qdoc doc/src/snippets/code/doc_src_qmake-manual.pro doc/src/snippets/code/doc_src_qtscript.qdoc src/corelib/animation/qabstractanimation.cpp src/s60installs/bwins/QtOpenGLu.def src/s60installs/eabi/QtOpenGLu.def src/s60installs/eabi/QtOpenVGu.def tests/auto/qdir/qdir.pro tests/auto/qsslsocket/tst_qsslsocket.cpp tools/qdoc3/doc/qdoc-manual.qdocconf
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qapplication_s60.cpp68
-rw-r--r--src/gui/kernel/qsoftkeymanager_s60.cpp8
-rw-r--r--src/gui/kernel/qt_s60_p.h25
-rw-r--r--src/gui/kernel/qwidget.cpp4
-rw-r--r--src/gui/kernel/qwidget_p.h1
-rw-r--r--src/gui/kernel/qwidget_s60.cpp52
6 files changed, 137 insertions, 21 deletions
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index 3d642d0..769b136 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -1271,15 +1271,36 @@ 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/minimized, hide status pane and button container otherwise show them.
- QWidget *const window = qwidget->window();
- if (!window->parentWidget()) { // Only top level native windows have control over cba/status pane
- const bool decorationsVisible = !(window->windowState() & (Qt::WindowFullScreen | Qt::WindowMinimized));
- const bool statusPaneVisibility = decorationsVisible;
- const bool isFullscreen = window->windowState() & Qt::WindowFullScreen;
- const bool cbaVisibilityHint = window->windowFlags() & Qt::WindowSoftkeysVisibleHint;
- const bool buttonGroupVisibility = (decorationsVisible || (isFullscreen && cbaVisibilityHint));
- S60->setStatusPaneAndButtonGroupVisibility(statusPaneVisibility, buttonGroupVisibility);
+ if (qwidget->isWindow()) {
+ QWidget *const window = qwidget->window();
+ QWidget *parentWindow = window->parentWidget();
+ if (parentWindow) {
+ while (parentWindow->parentWidget())
+ parentWindow = parentWindow->parentWidget();
+ } else {
+ parentWindow = window;
+ }
+
+ const bool parentDecorationsVisible = !(parentWindow->windowState() & (Qt::WindowFullScreen | Qt::WindowMinimized));
+ const bool parentIsFullscreen = parentWindow->windowState() & Qt::WindowFullScreen;
+ const bool parentCbaVisibilityHint = parentWindow->windowFlags() & Qt::WindowSoftkeysVisibleHint;
+ bool buttonGroupVisibility = (parentDecorationsVisible || (parentIsFullscreen && parentCbaVisibilityHint));
+
+ // For non-toplevel normal and maximized windows, show cba if window has softkey
+ // actions even if topmost parent is not showing cba. Do the same for fullscreen
+ // windows that request it.
+ if (!buttonGroupVisibility
+ && window->parentWidget()
+ && !(window->windowState() & Qt::WindowMinimized)
+ && ((window->windowFlags() & Qt::WindowSoftkeysVisibleHint) || !(window->windowState() & Qt::WindowFullScreen))) {
+ for (int i = 0; i < window->actions().size(); ++i) {
+ if (window->actions().at(i)->softKeyRole() != QAction::NoSoftKey) {
+ buttonGroupVisibility = true;
+ break;
+ }
+ }
+ }
+ S60->setStatusPaneAndButtonGroupVisibility(parentDecorationsVisible, buttonGroupVisibility);
}
#endif
} else if (QApplication::activeWindow() == qwidget->window()) {
@@ -1455,6 +1476,35 @@ bool QSymbianControl::isControlActive()
return IsActivated() ? true : false;
}
+void QSymbianControl::ensureFixNativeOrientation()
+{
+#if defined(Q_SYMBIAN_SUPPORTS_FIXNATIVEORIENTATION)
+ // Call FixNativeOrientation() for fullscreen QDeclarativeViews that
+ // have a locked orientation matching the native orientation of the device.
+ // This avoids unnecessary window rotation on wserv level.
+ if (!qwidget->isWindow() || qwidget->windowType() == Qt::Desktop
+ || !qwidget->inherits("QDeclarativeView")
+ || S60->screenNumberForWidget(qwidget) > 0)
+ return;
+ const bool isFullScreen = qwidget->windowState().testFlag(Qt::WindowFullScreen);
+ const bool isFixed = qwidget->d_func()->fixNativeOrientationCalled;
+ const bool matchesNative = qwidget->testAttribute(
+ S60->nativeOrientationIsPortrait ? Qt::WA_LockPortraitOrientation
+ : Qt::WA_LockLandscapeOrientation);
+ if (isFullScreen && matchesNative) {
+ if (!isFixed) {
+ Window().FixNativeOrientation();
+ qwidget->d_func()->fixNativeOrientationCalled = true;
+ }
+ } else if (isFixed) {
+ qwidget->d_func()->fixNativeOrientationCalled = false;
+ qwidget->hide();
+ qwidget->d_func()->create_sys(0, false, true);
+ qwidget->show();
+ }
+#endif
+}
+
/*!
\typedef QApplication::QS60MainApplicationFactory
\since 4.6
diff --git a/src/gui/kernel/qsoftkeymanager_s60.cpp b/src/gui/kernel/qsoftkeymanager_s60.cpp
index 3496297..09e2b5f 100644
--- a/src/gui/kernel/qsoftkeymanager_s60.cpp
+++ b/src/gui/kernel/qsoftkeymanager_s60.cpp
@@ -113,12 +113,20 @@ void QSoftKeyManagerPrivateS60::ensureCbaVisibilityAndResponsiviness(CEikButtonG
void QSoftKeyManagerPrivateS60::clearSoftkeys(CEikButtonGroupContainer &cba)
{
+#ifdef SYMBIAN_VERSION_SYMBIAN3
+ QT_TRAP_THROWING(
+ //EAknSoftkeyEmpty is used, because using -1 adds softkeys without actions on Symbian3
+ cba.SetCommandL(0, EAknSoftkeyEmpty, KNullDesC);
+ cba.SetCommandL(2, EAknSoftkeyEmpty, KNullDesC);
+ );
+#else
QT_TRAP_THROWING(
//Using -1 instead of EAknSoftkeyEmpty to avoid flickering.
cba.SetCommandL(0, -1, KNullDesC);
// TODO: Should we clear also middle SK?
cba.SetCommandL(2, -1, KNullDesC);
);
+#endif
realSoftKeyActions.clear();
}
diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h
index 3bb27c3..102c0ca 100644
--- a/src/gui/kernel/qt_s60_p.h
+++ b/src/gui/kernel/qt_s60_p.h
@@ -189,6 +189,8 @@ public:
int screenHeightInPixelsForScreen[qt_symbian_max_screens];
int screenWidthInTwipsForScreen[qt_symbian_max_screens];
int screenHeightInTwipsForScreen[qt_symbian_max_screens];
+
+ bool nativeOrientationIsPortrait;
};
Q_AUTOTEST_EXPORT QS60Data* qGlobalS60Data();
@@ -233,6 +235,8 @@ public:
bool isControlActive();
+ void ensureFixNativeOrientation();
+
#ifdef Q_WS_S60
void FadeBehindPopup(bool fade){ popupFader.FadeBehindPopup( this, this, fade); }
void HandleStatusPaneSizeChange();
@@ -327,9 +331,11 @@ inline QS60Data::QS60Data()
inline void QS60Data::updateScreenSize()
{
+ CWsScreenDevice *dev = S60->screenDevice();
+ int screenModeCount = dev->NumScreenModes();
+ int mode = dev->CurrentScreenMode();
TPixelsTwipsAndRotation params;
- int mode = S60->screenDevice()->CurrentScreenMode();
- S60->screenDevice()->GetScreenModeSizeAndRotation(mode, params);
+ dev->GetScreenModeSizeAndRotation(mode, params);
S60->screenWidthInPixels = params.iPixelSize.iWidth;
S60->screenHeightInPixels = params.iPixelSize.iHeight;
S60->screenWidthInTwips = params.iTwipsSize.iWidth;
@@ -352,6 +358,21 @@ inline void QS60Data::updateScreenSize()
S60->screenWidthInTwipsForScreen[i] = params.iTwipsSize.iWidth;
S60->screenHeightInTwipsForScreen[i] = params.iTwipsSize.iHeight;
}
+
+ // Look for a screen mode with rotation 0
+ // in order to decide what the native orientation is.
+ int nativeScreenWidthInPixels = 0;
+ int nativeScreenHeightInPixels = 0;
+ for (mode = 0; mode < screenModeCount; ++mode) {
+ TPixelsAndRotation sizeAndRotation;
+ dev->GetScreenModeSizeAndRotation(mode, sizeAndRotation);
+ if (sizeAndRotation.iRotation == CFbsBitGc::EGraphicsOrientationNormal) {
+ nativeScreenWidthInPixels = sizeAndRotation.iPixelSize.iWidth;
+ nativeScreenHeightInPixels = sizeAndRotation.iPixelSize.iHeight;
+ break;
+ }
+ }
+ S60->nativeOrientationIsPortrait = nativeScreenWidthInPixels <= nativeScreenHeightInPixels;
}
inline RWsSession& QS60Data::wsSession()
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 4b7349b..3cc3e65 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -312,6 +312,7 @@ QWidgetPrivate::QWidgetPrivate(int version)
, qd_hd(0)
#elif defined(Q_OS_SYMBIAN)
, symbianScreenNumber(0)
+ , fixNativeOrientationCalled(false)
#endif
{
if (!qApp) {
@@ -10970,6 +10971,9 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
}
QT_TRAP_THROWING(appUi->SetOrientationL(s60orientation));
S60->orientationSet = true;
+ QSymbianControl *window = static_cast<QSymbianControl *>(internalWinId());
+ if (window)
+ window->ensureFixNativeOrientation();
#endif
break;
}
diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h
index e5a2c35..919f8bc 100644
--- a/src/gui/kernel/qwidget_p.h
+++ b/src/gui/kernel/qwidget_p.h
@@ -908,6 +908,7 @@ public:
static QWidget *mouseGrabber;
static QWidget *keyboardGrabber;
int symbianScreenNumber; // only valid for desktop widget and top-levels
+ bool fixNativeOrientationCalled;
void s60UpdateIsOpaque();
void reparentChildren();
void registerTouchWindow();
diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp
index b031936..d4eadaa 100644
--- a/src/gui/kernel/qwidget_s60.cpp
+++ b/src/gui/kernel/qwidget_s60.cpp
@@ -278,6 +278,8 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove)
q->internalWinId()->SetRect(TRect(TPoint(x, y), TSize(w, h)));
topData()->normalGeometry = data.crect;
}
+ QSymbianControl *window = static_cast<QSymbianControl *>(q->internalWinId());
+ window->ensureFixNativeOrientation();
} else {
data.crect.setRect(x, y, w, h);
@@ -1208,17 +1210,41 @@ void QWidget::setWindowState(Qt::WindowStates newstate)
}
#ifdef Q_WS_S60
- bool decorationsVisible(false);
- if (!parentWidget()) { // Only top level native windows have control over cba/status pane
- // Hide window decoration when switching to fullscreen / 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 unnecessary redraws
- decorationsVisible = !(newstate & (Qt::WindowFullScreen | Qt::WindowMinimized));
- const bool statusPaneVisibility = decorationsVisible;
- const bool buttonGroupVisibility = (decorationsVisible || (isFullscreen && cbaRequested));
- S60->setStatusPaneAndButtonGroupVisibility(statusPaneVisibility, buttonGroupVisibility);
+ // Hide window decoration when switching to fullscreen / 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 unnecessary redraws
+ Qt::WindowStates comparisonState = newstate;
+ QWidget *parentWindow = parentWidget();
+ if (parentWindow) {
+ while (parentWindow->parentWidget())
+ parentWindow = parentWindow->parentWidget();
+ comparisonState = parentWindow->windowState();
+ } else {
+ parentWindow = this;
+ }
+
+ const bool decorationsVisible = !(comparisonState & (Qt::WindowFullScreen | Qt::WindowMinimized));
+ const bool parentIsFullscreen = comparisonState & Qt::WindowFullScreen;
+ const bool parentCbaVisibilityHint = parentWindow->windowFlags() & Qt::WindowSoftkeysVisibleHint;
+ bool buttonGroupVisibility = (decorationsVisible || (parentIsFullscreen && parentCbaVisibilityHint));
+
+ // For non-toplevel normal and maximized windows, show cba if window has softkey
+ // actions even if topmost parent is not showing cba. Do the same for fullscreen
+ // windows that request it.
+ if (!buttonGroupVisibility
+ && parentWidget()
+ && !(newstate & Qt::WindowMinimized)
+ && ((windowFlags() & Qt::WindowSoftkeysVisibleHint) || !(newstate & Qt::WindowFullScreen))) {
+ for (int i = 0; i < actions().size(); ++i) {
+ if (actions().at(i)->softKeyRole() != QAction::NoSoftKey) {
+ buttonGroupVisibility = true;
+ break;
+ }
+ }
}
+ S60->setStatusPaneAndButtonGroupVisibility(decorationsVisible, buttonGroupVisibility);
+
#endif // Q_WS_S60
// Ensure the initial size is valid, since we store it as normalGeometry below.
@@ -1277,6 +1303,12 @@ void QWidget::setWindowState(Qt::WindowStates newstate)
if (newstate & Qt::WindowActive)
activateWindow();
+ if (isWindow()) {
+ // Now that the new state is set, fix the display memory layout, if needed.
+ QSymbianControl *window = static_cast<QSymbianControl *>(effectiveWinId());
+ window->ensureFixNativeOrientation();
+ }
+
QWindowStateChangeEvent e(oldstate);
QApplication::sendEvent(this, &e);
}