Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Meego:Tablet
libmeegotouch
BMC13246_0006-Changed-MSceneManager-remove-assu...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File BMC13246_0006-Changed-MSceneManager-remove-assumption-that-native-.patch of Package libmeegotouch
From 468b551c869d64367bbb852393e06fdfd161230e Mon Sep 17 00:00:00 2001 From: Shane Bryan <shane.bryan@linux.intel.com> Date: Tue, 8 Mar 2011 13:59:32 -0800 Subject: [PATCH] Changed: MSceneManager - remove assumption that native orientation is landscape RevBy: Daniel d'Andrada ModifiedBy: Daniel d'Andrada - using MDeviceProfile::orientationFromAngle() instead of MDeviceProfile::deviceIsLandscape() - removed MSceneManagerPrivave::orientation(), using MDeviceProfile::orientationFromAngle() instead - fixed changed made for setOrientationAngleWithoutAnimation() - fixed eventEater size - fixed orientation animation size Details: visibleSceneSize() and orientation() now return results based on both the current orientation and the devices native orientation. Changed several internal calls to visibleSceneSize() to not pass in M::Landscape explicitly, as this is no longer a valid assumption. Added "FIXME" comment where additional device native orientation may need consideration in calculateSceneWindowGeometry(). Part of fix for BMC#13264. --- src/corelib/scene/mscenemanager.cpp | 64 +++++++++++++++++++--------------- src/corelib/scene/mscenemanager_p.h | 2 - 2 files changed, 36 insertions(+), 30 deletions(-) diff --git a/src/corelib/scene/mscenemanager.cpp b/src/corelib/scene/mscenemanager.cpp index df3c0b4..0a4522a 100644 --- a/src/corelib/scene/mscenemanager.cpp +++ b/src/corelib/scene/mscenemanager.cpp @@ -142,7 +142,8 @@ void MSceneManagerPrivate::init(MScene *scene) eventEater = new MSceneEventEater(); scene->addItem(eventEater); - eventEater->setGeometry(QRectF(QPointF(0.0, 0.0), q->visibleSceneSize(M::Landscape))); + QSize eventEaterSize = q->visibleSceneSize(MDeviceProfile::instance()->orientationFromAngle(M::Angle0)); + eventEater->setGeometry(QRectF(QPointF(0.0, 0.0), eventEaterSize)); createOrientationAnimation(); initRelocator(); @@ -183,7 +184,8 @@ void MSceneManagerPrivate::createOrientationAnimation() { Q_Q(MSceneManager); - QRectF visibleSceneRect = QRectF(QPointF(0.0, 0.0), q->visibleSceneSize(M::Landscape)); + QRectF visibleSceneRect = QRectF(QPointF(0.0, 0.0), + q->visibleSceneSize(MDeviceProfile::instance()->orientationFromAngle(M::Angle0))); //TODO: get this from theme orientationAnimation = new MCrossFadedOrientationAnimation(visibleSceneRect); @@ -205,7 +207,8 @@ void MSceneManagerPrivate::initRelocator() Q_Q(MSceneManager); inputWidgetRelocator = QPointer<MInputWidgetRelocator>( - new MInputWidgetRelocator(scene, rootElement, orientation(newAngle))); + new MInputWidgetRelocator(scene, rootElement, + MDeviceProfile::instance()->orientationFromAngle(newAngle))); // Register scene window scroller. QSharedPointer<MSceneWindowScroller> sceneWindowScroller(new MSceneWindowScroller); @@ -312,13 +315,13 @@ void MSceneManagerPrivate::_q_changeGlobalOrientationAngle() Q_Q(MSceneManager); M::OrientationAngle oldAngle = angle; - M::Orientation oldOrientation = orientation(angle); + M::Orientation oldOrientation = MDeviceProfile::instance()->orientationFromAngle(angle); angle = newAngle; // Needs to be called on every angle change and before scene window geometries are changed. inputWidgetRelocator->handleRotationBegin(); - if (oldOrientation != orientation(angle)) { + if (oldOrientation != MDeviceProfile::instance()->orientationFromAngle(angle)) { emit q->orientationAboutToChange(q->orientation()); notifyWidgetsAboutOrientationChange(); @@ -585,11 +588,6 @@ void MSceneManager::ensureCursorVisible() d->inputWidgetRelocator->update(); } -M::Orientation MSceneManagerPrivate::orientation(M::OrientationAngle angle) const -{ - return (angle == M::Angle0 || angle == M::Angle180) ? M::Landscape : M::Portrait; -} - void MSceneManagerPrivate::addUnmanagedSceneWindow(MSceneWindow *sceneWindow) { Q_Q(MSceneManager); @@ -625,7 +623,7 @@ void MSceneManagerPrivate::addSceneWindow(MSceneWindow *sceneWindow) // Just add it addUnmanagedSceneWindow(sceneWindow); // This window was not receiving any events. Might not know about orientation change yet. - MOrientationChangeEvent event(orientation(angle)); + MOrientationChangeEvent event(MDeviceProfile::instance()->orientationFromAngle(angle)); scene->sendEvent(sceneWindow, &event); } else { if (sceneWindow->d_func()->sceneManager != q) { @@ -926,7 +924,7 @@ void MSceneManagerPrivate::updateStatusBarGeometryProperty() void MSceneManagerPrivate::notifyWidgetsAboutOrientationChange() { - MOrientationChangeEvent event(orientation(angle)); + MOrientationChangeEvent event(MDeviceProfile::instance()->orientationFromAngle(angle)); QList<QGraphicsItem *> sceneItems = scene->items(); for(int i = sceneItems.count() - 1; i >= 0; i--) { @@ -941,7 +939,7 @@ void MSceneManagerPrivate::notifyWidgetsAboutOrientationChange() QRectF MSceneManagerPrivate::calculateAvailableSceneRect(MSceneWindow *sceneWindow) const { Q_Q(const MSceneManager); - QSizeF sceneSize = q->visibleSceneSize(orientation(angle)); + QSizeF sceneSize = q->visibleSceneSize(MDeviceProfile::instance()->orientationFromAngle(angle)); QRectF availableSceneRect(QPointF(0,0), sceneSize); if (sceneWindow->windowType() == MSceneWindow::Sheet @@ -1007,23 +1005,22 @@ void MSceneManagerPrivate::rotateToAngle(M::OrientationAngle newAngle) void MSceneManagerPrivate::setOrientationAngleWithoutAnimation(M::OrientationAngle newAngle) { - Q_Q(MSceneManager); - this->newAngle = newAngle; _q_changeGlobalOrientationAngle(); - QSize landscapeScreenSize = q->visibleSceneSize(M::Landscape); + QSize nativeScreenSize = MDeviceProfile::instance()->resolution(); + M::Orientation nativeOrientation = MDeviceProfile::instance()->orientationFromAngle(M::Angle0); rootElement->setRotation(newAngle); - if (orientation(angle) == M::Landscape) { + if (MDeviceProfile::instance()->orientationFromAngle(newAngle) == nativeOrientation) { rootElement->setPos(0, 0); - rootElement->setTransformOriginPoint(landscapeScreenSize.width() / 2, - landscapeScreenSize.height() / 2); + rootElement->setTransformOriginPoint(nativeScreenSize.width() / 2, + nativeScreenSize.height() / 2); } else { - rootElement->setPos((landscapeScreenSize.width() - landscapeScreenSize.height()) / 2, - (landscapeScreenSize.height() - landscapeScreenSize.width()) / 2); - rootElement->setTransformOriginPoint(landscapeScreenSize.height() / 2, - landscapeScreenSize.width() / 2); + rootElement->setPos((nativeScreenSize.width() - nativeScreenSize.height()) / 2, + (nativeScreenSize.height() - nativeScreenSize.width()) / 2); + rootElement->setTransformOriginPoint(nativeScreenSize.height() / 2, + nativeScreenSize.width() / 2); } _q_emitOrientationChangeFinished(); @@ -2327,7 +2324,7 @@ M::Orientation MSceneManager::orientation() const { Q_D(const MSceneManager); - return d->orientation(d->angle); + return MDeviceProfile::instance()->orientationFromAngle(d->angle); } M::OrientationAngle MSceneManager::orientationAngle() const @@ -2341,11 +2338,22 @@ QSize MSceneManager::visibleSceneSize(M::Orientation orientation) const { QSize s; - if (orientation == M::Landscape) { - s = MDeviceProfile::instance()->resolution(); + if (MDeviceProfile::instance()->orientationFromAngle(M::Angle0) == M::Landscape) { + // native display orientation is landscape + if (orientation == M::Landscape) + s = QSize(MDeviceProfile::instance()->resolution().width(), + MDeviceProfile::instance()->resolution().height()); + else + s = QSize(MDeviceProfile::instance()->resolution().height(), + MDeviceProfile::instance()->resolution().width()); } else { - s = QSize(MDeviceProfile::instance()->resolution().height(), - MDeviceProfile::instance()->resolution().width()); + // native display orientation is portrait + if (orientation == M::Landscape) + s = QSize(MDeviceProfile::instance()->resolution().height(), + MDeviceProfile::instance()->resolution().width()); + else + s = QSize(MDeviceProfile::instance()->resolution().width(), + MDeviceProfile::instance()->resolution().height()); } return s; diff --git a/src/corelib/scene/mscenemanager_p.h b/src/corelib/scene/mscenemanager_p.h index 562c869..ff54141 100644 --- a/src/corelib/scene/mscenemanager_p.h +++ b/src/corelib/scene/mscenemanager_p.h @@ -108,8 +108,6 @@ public: void destroyLayerEffectForSceneWindow(MSceneWindow *sceneWindow); bool windowIntersectsRect(const QRectF &rect, MSceneWindow *window); - M::Orientation orientation(M::OrientationAngle angle) const; - QRectF calculateAvailableSceneRect(MSceneWindow *sceneWindow) const; QRectF calculateSceneWindowGeometry(MSceneWindow *window) const; void setSceneWindowGeometry(MSceneWindow *window);
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor