Merge lp:~unity-team/unity/trusty-1374785 into lp:unity/7.2

Proposed by Stephen M. Webb
Status: Rejected
Rejected by: Stephen M. Webb
Proposed branch: lp:~unity-team/unity/trusty-1374785
Merge into: lp:unity/7.2
Diff against target: 58 lines (+30/-3)
2 files modified
debian/changelog (+6/-0)
unity-shared/UScreen.cpp (+24/-3)
To merge this branch: bzr merge lp:~unity-team/unity/trusty-1374785
Reviewer Review Type Date Requested Status
Unity Team Pending
Review via email: mp+244201@code.launchpad.net

This proposal supersedes a proposal from 2014-12-09.

Description of the change

Make sure GetScreenGeometry returns the correct value (fixes #1374785).

This fix is cherry-picked from trunk for SRUing into Ubuntu 14.04 LTS.

To post a comment you must log in.

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2014-08-26 13:49:00 +0000
3+++ debian/changelog 2014-12-09 18:53:08 +0000
4@@ -1,3 +1,9 @@
5+unity (7.2.3+14.04.20140826-0ubuntu2) UNRELEASED; urgency=medium
6+
7+ * Make sure GetScreenGeometry returns the correct value (lp: #1374785).
8+
9+ -- Andrea Azzarone <azzaronea@gmail.com> Tue, 09 Dec 2014 13:49:07 -0500
10+
11 unity (7.2.3+14.04.20140826-0ubuntu1) trusty; urgency=medium
12
13 [ Andrea Azzarone ]
14
15=== modified file 'unity-shared/UScreen.cpp'
16--- unity-shared/UScreen.cpp 2014-04-08 16:29:49 +0000
17+++ unity-shared/UScreen.cpp 2014-12-09 18:53:08 +0000
18@@ -80,6 +80,15 @@
19
20 int UScreen::GetMonitorAtPosition(int x, int y) const
21 {
22+ int idx = 0;
23+
24+ for (auto const& monitor : monitors_)
25+ {
26+ if (monitor.IsPointInside(x, y))
27+ return idx;
28+ ++idx;
29+ }
30+
31 return gdk_screen_get_monitor_at_point(screen_, x, y);
32 }
33
34@@ -95,9 +104,21 @@
35
36 nux::Geometry UScreen::GetScreenGeometry() const
37 {
38- int width = gdk_screen_get_width(screen_);
39- int height = gdk_screen_get_height(screen_);
40- return nux::Geometry(0, 0, width, height);
41+ if (monitors_.empty())
42+ return {};
43+
44+ auto rightmost_geo = max_element(monitors_.begin(), monitors_.end(), [](nux::Geometry const& a, nux::Geometry const& b) {
45+ return a.x + a.width < b.x + b.width;
46+ });
47+
48+ auto lower_geo = max_element(monitors_.begin(), monitors_.end(), [](nux::Geometry const& a, nux::Geometry const& b) {
49+ return a.y + a.height < b.y + b.height;
50+ });
51+
52+ auto width = rightmost_geo->x + rightmost_geo->width;
53+ auto height = lower_geo->y + lower_geo->height;
54+
55+ return {0, 0, width, height};
56 }
57
58 const std::string UScreen::GetMonitorName(int output_number = 0) const

Subscribers

People subscribed via source and target branches

to all changes:
to status/vote changes: