Merge lp:~mardy/unity-2d/geometry into lp:unity-2d

Proposed by Alberto Mardegan
Status: Superseded
Proposed branch: lp:~mardy/unity-2d/geometry
Merge into: lp:unity-2d
Prerequisite: lp:~mardy/unity-2d/launcher-bg
Diff against target: 200 lines (+16/-33)
7 files modified
libunity-2d-private/src/screeninfo.cpp (+7/-0)
libunity-2d-private/src/screeninfo.h (+3/-0)
places/app/dashdeclarativeview.cpp (+2/-17)
places/app/dashdeclarativeview.h (+0/-7)
spread/Windows.qml (+0/-5)
spread/Workspaces.qml (+3/-3)
spread/app/spreadview.cpp (+1/-1)
To merge this branch: bzr merge lp:~mardy/unity-2d/geometry
Reviewer Review Type Date Requested Status
Florian Boucault (community) Needs Fixing
Review via email: mp+80051@code.launchpad.net

This proposal has been superseded by a proposal from 2011-10-21.

Description of the change

Better handling of screen geometry

Revert change introduced in revision 752 where the semantics of ScreenInfo::availableGeometry() where changed.
Now that method will return the same as QDesktopWidget::availableGeometry() returns; instead, a new method ScreenInfo::panelsFreeGeometry() will return the available geometry minus the launcher.

Also, a the screenGeometry and availableGeometry properties were removed from the DashDeclarative class, because they were unused (and ScreenInfo provides the same information).

To post a comment you must log in.
Revision history for this message
Florian Boucault (fboucault) wrote :

If you could also remove the various instantiation of ScreenInfo and replace them with using ScreenInfo::instance() that'd be perfect.

review: Needs Fixing
Revision history for this message
Florian Boucault (fboucault) wrote :

I believe the two instances of this are:

DashDeclarativeView.m_screenInfo
SpreadView.m_screenInfo

Revision history for this message
Florian Boucault (fboucault) wrote :

Is there a bug report for the background jumping issue we could link to?

lp:~mardy/unity-2d/geometry updated
770. By Alberto Mardegan

Remove storing of ScreenInfo instance in object private data

Revision history for this message
Lohith D Shivamurthy (dyams) wrote :

Would like to suggest the following:

1) Change the name of the following methods:

     • Current name : DashDeclarativeView::fitToAvailableSpace
       New Name : DashDeclarativeView::resizeToFullscreenMode()

     • Current name : DashDeclarativeView::resizeToDesktopModeSize()
       New name : DashDeclarativeView::resizeToDesktopMode()

2) Similar to ScreenInfo, Could we also make 'LauncherClicent' a singleton? It has three instances now.

Revision history for this message
Alberto Mardegan (mardy) wrote :

Lohith, this merge request has been superseded by https://code.launchpad.net/~mardy/unity-2d/geometry/+merge/80071

Revision history for this message
Lohith D Shivamurthy (dyams) wrote :

This branch is moved to new location.
Please follow the new branch here
https://code.launchpad.net/~dyams/unity-2d/mardy-geometry/+merge/83767

Thank you

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libunity-2d-private/src/screeninfo.cpp'
2--- libunity-2d-private/src/screeninfo.cpp 2011-10-03 11:13:44 +0000
3+++ libunity-2d-private/src/screeninfo.cpp 2011-10-21 11:42:24 +0000
4@@ -71,6 +71,12 @@
5
6 QRect ScreenInfo::availableGeometry() const
7 {
8+ int screen = QX11Info::appScreen();
9+ return QApplication::desktop()->availableGeometry(screen);
10+}
11+
12+QRect ScreenInfo::panelsFreeGeometry() const
13+{
14 /* We cannot just return the system's availableGeometry(), because that
15 * doesn't consider the Launcher, if it's set to auto-hide. */
16 int screen = QX11Info::appScreen();
17@@ -105,6 +111,7 @@
18 {
19 if (screen == QX11Info::appScreen()) {
20 Q_EMIT availableGeometryChanged(availableGeometry());
21+ Q_EMIT panelsFreeGeometryChanged(panelsFreeGeometry());
22 }
23 }
24
25
26=== modified file 'libunity-2d-private/src/screeninfo.h'
27--- libunity-2d-private/src/screeninfo.h 2011-07-29 13:49:34 +0000
28+++ libunity-2d-private/src/screeninfo.h 2011-10-21 11:42:24 +0000
29@@ -21,6 +21,7 @@
30 Q_PROPERTY(unsigned int activeWindow READ activeWindow NOTIFY activeWindowChanged)
31 Q_PROPERTY(QRect geometry READ geometry NOTIFY geometryChanged)
32 Q_PROPERTY(QRect availableGeometry READ availableGeometry NOTIFY availableGeometryChanged)
33+ Q_PROPERTY(QRect panelsFreeGeometry READ panelsFreeGeometry NOTIFY panelsFreeGeometryChanged)
34 Q_PROPERTY(bool isCompositingManagerRunning READ isCompositingManagerRunning
35 NOTIFY isCompositingManagerRunningChanged)
36
37@@ -36,6 +37,7 @@
38 WorkspacesInfo *workspaces() { return &m_workspacesInfo; }
39 unsigned int activeWindow() const { return m_activeWindow; }
40 QRect availableGeometry() const;
41+ QRect panelsFreeGeometry() const;
42 QRect geometry() const;
43 bool isCompositingManagerRunning() const;
44
45@@ -43,6 +45,7 @@
46 void activeWindowChanged(unsigned int activeWindow);
47 void geometryChanged(QRect geometry);
48 void availableGeometryChanged(QRect availableGeometry);
49+ void panelsFreeGeometryChanged(QRect panelsFreeGeometry);
50 void workspacesChanged(WorkspacesInfo *workspaces);
51 void isCompositingManagerRunningChanged(bool);
52
53
54=== modified file 'places/app/dashdeclarativeview.cpp'
55--- places/app/dashdeclarativeview.cpp 2011-10-03 11:13:44 +0000
56+++ places/app/dashdeclarativeview.cpp 2011-10-21 11:42:24 +0000
57@@ -59,7 +59,6 @@
58 setTransparentBackground(QX11Info::isCompositingManagerRunning());
59
60 QDesktopWidget* desktop = QApplication::desktop();
61- connect(desktop, SIGNAL(resized(int)), SIGNAL(screenGeometryChanged()));
62 connect(desktop, SIGNAL(resized(int)), SIGNAL(updateDashModeDependingOnScreenGeometry()));
63 connect(desktop, SIGNAL(workAreaResized(int)), SLOT(onWorkAreaResized(int)));
64
65@@ -74,7 +73,6 @@
66 }
67
68 updateSize();
69- availableGeometryChanged();
70 }
71
72
73@@ -112,7 +110,7 @@
74 void
75 DashDeclarativeView::fitToAvailableSpace()
76 {
77- QRect rect = availableGeometry();
78+ QRect rect = m_screenInfo->panelsFreeGeometry();
79 move(rect.topLeft());
80 setFixedSize(rect.size());
81 }
82@@ -120,7 +118,7 @@
83 void
84 DashDeclarativeView::resizeToDesktopModeSize()
85 {
86- QRect rect = availableGeometry();
87+ QRect rect = m_screenInfo->panelsFreeGeometry();
88 int screenRight = rect.right();
89
90 rect.setWidth(qMin(DASH_DESKTOP_WIDTH, rect.width()));
91@@ -261,19 +259,6 @@
92 setActive(true);
93 }
94
95-const QRect
96-DashDeclarativeView::screenGeometry() const
97-{
98- QDesktopWidget* desktop = QApplication::desktop();
99- return desktop->screenGeometry(this);
100-}
101-
102-QRect
103-DashDeclarativeView::availableGeometry() const
104-{
105- return m_screenInfo->availableGeometry();
106-}
107-
108 void
109 DashDeclarativeView::keyPressEvent(QKeyEvent* event)
110 {
111
112=== modified file 'places/app/dashdeclarativeview.h'
113--- places/app/dashdeclarativeview.h 2011-10-03 11:13:44 +0000
114+++ places/app/dashdeclarativeview.h 2011-10-21 11:42:24 +0000
115@@ -32,8 +32,6 @@
116 Q_PROPERTY(bool expanded READ expanded WRITE setExpanded NOTIFY expandedChanged)
117 Q_PROPERTY(DashMode dashMode READ dashMode WRITE setDashMode NOTIFY dashModeChanged)
118 Q_PROPERTY(QString activeLens READ activeLens WRITE setActiveLens NOTIFY activeLensChanged)
119- Q_PROPERTY(QRect screenGeometry READ screenGeometry NOTIFY screenGeometryChanged)
120- Q_PROPERTY(QRect availableGeometry READ availableGeometry NOTIFY availableGeometryChanged)
121
122 public:
123 enum DashMode {
124@@ -46,8 +44,6 @@
125 bool active() const;
126 DashMode dashMode() const;
127 const QString& activeLens() const;
128- const QRect screenGeometry() const;
129- QRect availableGeometry() const;
130 bool expanded() const;
131
132 /* setters */
133@@ -67,9 +63,6 @@
134 void expandedChanged(bool);
135 void activeLensChanged(const QString&);
136
137- void screenGeometryChanged();
138- void availableGeometryChanged();
139-
140 protected:
141 void resizeEvent(QResizeEvent*);
142 virtual void showEvent(QShowEvent *event);
143
144=== modified file 'spread/Windows.qml'
145--- spread/Windows.qml 2011-08-09 13:33:24 +0000
146+++ spread/Windows.qml 2011-10-21 11:42:24 +0000
147@@ -32,9 +32,6 @@
148
149 The context property called control is the initiator of the entire spread process, and
150 is triggered by D-Bus calls on the C++ side.
151-
152- The ScreenInfo's property availableGeometry represents the available space on the screen (i.e.
153- screen minus launcher, panels, etc.).
154 */
155
156 GridView {
157@@ -147,8 +144,6 @@
158 name: "screen"
159 PropertyChanges {
160 target: spreadWindow
161- /* Note that we subtract the availableGeometry x and y since window.location is
162- expressed in global screen coordinates. */
163 x: window.position.x - declarativeView.globalPosition.x
164 y: window.position.y - declarativeView.globalPosition.y
165 width: window.size.width
166
167=== modified file 'spread/Workspaces.qml'
168--- spread/Workspaces.qml 2011-10-18 12:19:18 +0000
169+++ spread/Workspaces.qml 2011-10-21 11:42:24 +0000
170@@ -43,14 +43,14 @@
171 FIXME: this seems to be broken in the case of 10 workspaces and 4x4 layout.
172 it does only display a 3x3 grid for some reason.
173 */
174- property bool isLayoutHorizontal: (columns * screen.availableGeometry.width) >
175- (rows * screen.availableGeometry.height)
176+ property bool isLayoutHorizontal: (columns * screen.panelsFreeGeometry.width) >
177+ (rows * screen.panelsFreeGeometry.height)
178 property real cellScale: (isLayoutHorizontal) ? (availableWidth / columns / switcher.width) :
179 (availableHeight / rows / switcher.height)
180
181 /* Scale of a workspace when the user zooms on it (fills most of the switcher, leaving a margin to see
182 the corners of the other workspaces below it) */
183- property bool isDesktopHorizontal: screen.availableGeometry.width > screen.availableGeometry.height
184+ property bool isDesktopHorizontal: screen.panelsFreeGeometry.width > screen.panelsFreeGeometry.height
185 property real zoomedScale: (isDesktopHorizontal) ? ((width - 2*margin) / switcher.width) :
186 ((height - 2*margin) / switcher.height)
187
188
189=== modified file 'spread/app/spreadview.cpp'
190--- spread/app/spreadview.cpp 2011-10-03 11:13:44 +0000
191+++ spread/app/spreadview.cpp 2011-10-21 11:42:24 +0000
192@@ -38,7 +38,7 @@
193
194 if(screen == current_screen)
195 {
196- QRect geometry = m_screenInfo->availableGeometry();
197+ QRect geometry = m_screenInfo->panelsFreeGeometry();
198 setGeometry(geometry);
199 setFixedSize(geometry.size());
200 }

Subscribers

People subscribed via source and target branches