Merge lp:~aacid/unity-2d/unity-2d-shell_updateShellPosition_fixes into lp:~unity-2d-team/unity-2d/unity-2d-shell

Proposed by Albert Astals Cid
Status: Merged
Approved by: Florian Boucault
Approved revision: 1000
Merged at revision: 1001
Proposed branch: lp:~aacid/unity-2d/unity-2d-shell_updateShellPosition_fixes
Merge into: lp:~unity-2d-team/unity-2d/unity-2d-shell
Diff against target: 49 lines (+19/-14)
1 file modified
shell/app/shelldeclarativeview.cpp (+19/-14)
To merge this branch: bzr merge lp:~aacid/unity-2d/unity-2d-shell_updateShellPosition_fixes
Reviewer Review Type Date Requested Status
Florian Boucault Pending
Review via email: mp+92259@code.launchpad.net

Description of the change

Improvements to ShellDeclarativeView::updateShellPosition

Add comment about why the function is needed
Adapt the code so that more than one StrutManager is supported

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'shell/app/shelldeclarativeview.cpp'
--- shell/app/shelldeclarativeview.cpp 2012-02-09 10:51:16 +0000
+++ shell/app/shelldeclarativeview.cpp 2012-02-09 12:32:31 +0000
@@ -94,27 +94,32 @@
94void94void
95ShellDeclarativeView::updateShellPosition()95ShellDeclarativeView::updateShellPosition()
96{96{
97 // ShellDeclarativeView is a dock window (Qt::WA_X11NetWmWindowTypeDock) this means it does not respect struts.
98 // We use availableGeometry to get the geometry with the struts applied and from there
99 // we remove any strut that we might be applying ourselves
97 const QRect availableGeometry = m_screenInfo->availableGeometry();100 const QRect availableGeometry = m_screenInfo->availableGeometry();
98 QPoint posToMove = availableGeometry.topLeft();101 QPoint posToMove = availableGeometry.topLeft();
99 if (qApp->isRightToLeft()) {102 if (qApp->isRightToLeft()) {
100 posToMove.setX(availableGeometry.width() - width());103 posToMove.setX(availableGeometry.width() - width());
101 }104 }
102105
103 StrutManager *strutManager = rootObject()->findChild<StrutManager*>();106 QList<StrutManager *> strutManagers = rootObject()->findChildren<StrutManager*>();
104 if (strutManager && strutManager->enabled()) {107 Q_FOREACH(StrutManager *strutManager, strutManagers) {
105 // Do not push ourselves108 if (strutManager->enabled()) {
106 switch (strutManager->edge()) {109 // Do not push ourselves
107 case Unity2dPanel::TopEdge:110 switch (strutManager->edge()) {
108 posToMove.ry() -= strutManager->realHeight();111 case Unity2dPanel::TopEdge:
109 break;112 posToMove.ry() -= strutManager->realHeight();
113 break;
110114
111 case Unity2dPanel::LeftEdge:115 case Unity2dPanel::LeftEdge:
112 if (qApp->isLeftToRight()) {116 if (qApp->isLeftToRight()) {
113 posToMove.rx() -= strutManager->realWidth();117 posToMove.rx() -= strutManager->realWidth();
114 } else {118 } else {
115 posToMove.rx() += strutManager->realWidth();119 posToMove.rx() += strutManager->realWidth();
116 }120 }
117 break;121 break;
122 }
118 }123 }
119 }124 }
120125

Subscribers

People subscribed via source and target branches