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
1=== modified file 'shell/app/shelldeclarativeview.cpp'
2--- shell/app/shelldeclarativeview.cpp 2012-02-09 10:51:16 +0000
3+++ shell/app/shelldeclarativeview.cpp 2012-02-09 12:32:31 +0000
4@@ -94,27 +94,32 @@
5 void
6 ShellDeclarativeView::updateShellPosition()
7 {
8+ // ShellDeclarativeView is a dock window (Qt::WA_X11NetWmWindowTypeDock) this means it does not respect struts.
9+ // We use availableGeometry to get the geometry with the struts applied and from there
10+ // we remove any strut that we might be applying ourselves
11 const QRect availableGeometry = m_screenInfo->availableGeometry();
12 QPoint posToMove = availableGeometry.topLeft();
13 if (qApp->isRightToLeft()) {
14 posToMove.setX(availableGeometry.width() - width());
15 }
16
17- StrutManager *strutManager = rootObject()->findChild<StrutManager*>();
18- if (strutManager && strutManager->enabled()) {
19- // Do not push ourselves
20- switch (strutManager->edge()) {
21- case Unity2dPanel::TopEdge:
22- posToMove.ry() -= strutManager->realHeight();
23- break;
24+ QList<StrutManager *> strutManagers = rootObject()->findChildren<StrutManager*>();
25+ Q_FOREACH(StrutManager *strutManager, strutManagers) {
26+ if (strutManager->enabled()) {
27+ // Do not push ourselves
28+ switch (strutManager->edge()) {
29+ case Unity2dPanel::TopEdge:
30+ posToMove.ry() -= strutManager->realHeight();
31+ break;
32
33- case Unity2dPanel::LeftEdge:
34- if (qApp->isLeftToRight()) {
35- posToMove.rx() -= strutManager->realWidth();
36- } else {
37- posToMove.rx() += strutManager->realWidth();
38- }
39- break;
40+ case Unity2dPanel::LeftEdge:
41+ if (qApp->isLeftToRight()) {
42+ posToMove.rx() -= strutManager->realWidth();
43+ } else {
44+ posToMove.rx() += strutManager->realWidth();
45+ }
46+ break;
47+ }
48 }
49 }
50

Subscribers

People subscribed via source and target branches