Merge lp:~mir-team/unity-system-compositor/silo0 into lp:unity-system-compositor

Proposed by Gerry Boland
Status: Work in progress
Proposed branch: lp:~mir-team/unity-system-compositor/silo0
Merge into: lp:unity-system-compositor
Diff against target: 302 lines (+184/-3)
7 files modified
debian/changelog (+25/-3)
src/CMakeLists.txt (+1/-0)
src/clone_display_configuration_policy.cpp (+46/-0)
src/clone_display_configuration_policy.h (+34/-0)
src/server.cpp (+9/-0)
src/window_manager.cpp (+56/-0)
src/window_manager.h (+13/-0)
To merge this branch: bzr merge lp:~mir-team/unity-system-compositor/silo0
Reviewer Review Type Date Requested Status
Unity System Compositor Development Team Pending
Review via email: mp+266924@code.launchpad.net

Commit message

Silo0 branch - for pocket desktop

To post a comment you must log in.
244. By Kevin DuBois

upon Display changes, use information from WindowManager system to figure out the new dimensions. Also scan through the list of surfaces differently, as surface_after() will never return nullptr.

245. By Gerry Boland

Merge usc/0.1 and update changelog

246. By Kevin DuBois

Return immeditately if there is no default surface in the window resizing code.

Unmerged revisions

246. By Kevin DuBois

Return immeditately if there is no default surface in the window resizing code.

245. By Gerry Boland

Merge usc/0.1 and update changelog

244. By Kevin DuBois

upon Display changes, use information from WindowManager system to figure out the new dimensions. Also scan through the list of surfaces differently, as surface_after() will never return nullptr.

243. By Gerry Boland

Configure non-primary display to be rotated

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 2015-07-16 21:45:22 +0000
3+++ debian/changelog 2015-08-11 13:07:12 +0000
4@@ -1,8 +1,30 @@
5-unity-system-compositor (0.0.5+15.10.20150506.2-0ubuntu1) UNRELEASED; urgency=medium
6-
7+unity-system-compositor (0.1.0+15.10.20150728.1-0ubuntu1) wily; urgency=medium
8+
9+ [ Alexandros Frantzis ]
10+ * Support different screen timeout values for notifications
11+ (LP: #1426115)
12+ * Enable and handle proximity events properly (LP: #1291455)
13+ * Don't force gcc 4.9 when building the package (LP: #1478926)
14+ * Introduce new versioning scheme
15+
16+ [ Alan Griffiths ]
17+ * Port to mir SystemCompositorWindowManager
18+
19+ [ Robert Ancell ]
20+ * Depend on the new xmir package instead of the obsolete
21+ xserver-xorg-xmir (LP: #1204505)
22+
23+ -- CI Train Bot <ci-train-bot@canonical.com> Tue, 28 Jul 2015 18:55:28 +0000
24+
25+unity-system-compositor (0.0.5+15.10.20150722-0ubuntu1) wily; urgency=medium
26+
27+ [ Kevin Gunn ]
28 * Release in step with Mir 0.14
29
30- -- Kevin Gunn <kevin.gunn@canonical.com> Thu, 16 Jul 2015 15:14:22 -0500
31+ [ CI Train Bot ]
32+ * New rebuild forced.
33+
34+ -- CI Train Bot <ci-train-bot@canonical.com> Wed, 22 Jul 2015 14:49:58 +0000
35
36 unity-system-compositor (0.0.5+15.04.20150713-0ubuntu1) vivid; urgency=medium
37
38
39=== modified file 'src/CMakeLists.txt'
40--- src/CMakeLists.txt 2015-07-15 13:48:30 +0000
41+++ src/CMakeLists.txt 2015-08-11 13:07:12 +0000
42@@ -16,6 +16,7 @@
43
44 set(USC_SRCS
45 asio_dm_connection.cpp
46+ clone_display_configuration_policy.cpp
47 dbus_connection_handle.cpp
48 dbus_event_loop.cpp
49 dbus_message_handle.cpp
50
51=== added file 'src/clone_display_configuration_policy.cpp'
52--- src/clone_display_configuration_policy.cpp 1970-01-01 00:00:00 +0000
53+++ src/clone_display_configuration_policy.cpp 2015-08-11 13:07:12 +0000
54@@ -0,0 +1,46 @@
55+/*
56+ * Copyright (C) 2015 Canonical, Ltd.
57+ *
58+ * This program is free software: you can redistribute it and/or modify it under
59+ * the terms of the GNU Lesser General Public License version 3, as published by
60+ * the Free Software Foundation.
61+ *
62+ * This program is distributed in the hope that it will be useful, but WITHOUT
63+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
64+ * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
65+ * Lesser General Public License for more details.
66+ *
67+ * You should have received a copy of the GNU Lesser General Public License
68+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
69+ */
70+
71+#include "clone_display_configuration_policy.h"
72+
73+#include <mir/graphics/display_configuration.h>
74+#include <cstdio>
75+namespace mg = mir::graphics;
76+
77+CloneDisplayConfigurationPolicy::CloneDisplayConfigurationPolicy(
78+ const std::shared_ptr<mir::graphics::DisplayConfigurationPolicy> &wrapped)
79+ : wrapped{wrapped}
80+{
81+}
82+
83+void CloneDisplayConfigurationPolicy::apply_to(mir::graphics::DisplayConfiguration& conf)
84+{
85+ wrapped->apply_to(conf);
86+
87+ conf.for_each_output(
88+ [&](mg::UserDisplayConfigurationOutput& displayConfigOutput) {
89+ if (displayConfigOutput.id.as_value() > 0) { printf("Here\n");
90+ displayConfigOutput.orientation = mir_orientation_left;
91+ }
92+ }
93+ );
94+
95+ conf.for_each_output(
96+ [&](const mg::DisplayConfigurationOutput displayConfigOutput) {
97+ printf("Output %d: Orientation %d\n", displayConfigOutput.id.as_value(), displayConfigOutput.orientation);
98+ }
99+ );
100+}
101
102=== added file 'src/clone_display_configuration_policy.h'
103--- src/clone_display_configuration_policy.h 1970-01-01 00:00:00 +0000
104+++ src/clone_display_configuration_policy.h 2015-08-11 13:07:12 +0000
105@@ -0,0 +1,34 @@
106+/*
107+ * Copyright (C) 2015 Canonical, Ltd.
108+ *
109+ * This program is free software: you can redistribute it and/or modify it under
110+ * the terms of the GNU Lesser General Public License version 3, as published by
111+ * the Free Software Foundation.
112+ *
113+ * This program is distributed in the hope that it will be useful, but WITHOUT
114+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
115+ * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
116+ * Lesser General Public License for more details.
117+ *
118+ * You should have received a copy of the GNU Lesser General Public License
119+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
120+ */
121+
122+#ifndef CLONEDISPLAYCONFIGURATIONPOLICY_H
123+#define CLONEDISPLAYCONFIGURATIONPOLICY_H
124+
125+#include <mir/graphics/display_configuration_policy.h>
126+#include <memory>
127+
128+class CloneDisplayConfigurationPolicy : public mir::graphics::DisplayConfigurationPolicy
129+{
130+public:
131+ CloneDisplayConfigurationPolicy(const std::shared_ptr<mir::graphics::DisplayConfigurationPolicy> &wrapped);
132+
133+ void apply_to(mir::graphics::DisplayConfiguration& conf) override;
134+
135+private:
136+ const std::shared_ptr<mir::graphics::DisplayConfigurationPolicy> wrapped;
137+};
138+
139+#endif // CLONEDISPLAYCONFIGURATIONPOLICY_H
140
141=== modified file 'src/server.cpp'
142--- src/server.cpp 2015-07-15 13:48:31 +0000
143+++ src/server.cpp 2015-08-11 13:07:12 +0000
144@@ -26,6 +26,7 @@
145 #include "powerd_mediator.h"
146 #include "unity_screen_service.h"
147 #include "steady_clock.h"
148+#include "clone_display_configuration_policy.h"
149
150 #include <mir/input/cursor_listener.h>
151 #include <mir/server_status_listener.h>
152@@ -40,6 +41,7 @@
153 namespace ms = mir::scene;
154 namespace mf = mir::frontend;
155 namespace mi = mir::input;
156+namespace mg = mir::graphics;
157
158 namespace
159 {
160@@ -152,6 +154,13 @@
161 the_session_switcher());
162 });
163
164+ wrap_display_configuration_policy(
165+ [](const std::shared_ptr<mg::DisplayConfigurationPolicy> &wrapped)
166+ -> std::shared_ptr<mg::DisplayConfigurationPolicy>
167+ {
168+ return std::make_shared<CloneDisplayConfigurationPolicy>(wrapped);
169+ });
170+
171 set_config_filename("unity-system-compositor.conf");
172
173 apply_settings();
174
175=== modified file 'src/window_manager.cpp'
176--- src/window_manager.cpp 2015-06-11 16:55:36 +0000
177+++ src/window_manager.cpp 2015-08-11 13:07:12 +0000
178@@ -33,6 +33,7 @@
179 #include "mir_toolkit/client_types.h"
180
181 #include <iostream>
182+#include <algorithm>
183
184 namespace mf = mir::frontend;
185 namespace ms = mir::scene;
186@@ -96,6 +97,26 @@
187 session_monitor{session_monitor}
188 {
189 }
190+
191+void usc::WindowManager::add_display(mir::geometry::Rectangle const& area)
192+{
193+ rects.push_back(area);
194+ resize_scene_to_cloned_display_intersection();
195+}
196+
197+void usc::WindowManager::remove_display(mir::geometry::Rectangle const& area)
198+{
199+ for(auto it = rects.begin(); it != rects.end();)
200+ {
201+ if (*it == area)
202+ it = rects.erase(it);
203+ else
204+ it++;
205+ }
206+
207+ resize_scene_to_cloned_display_intersection();
208+}
209+
210 void usc::WindowManager::on_session_added(std::shared_ptr<mir::scene::Session> const& session) const
211 {
212 std::cerr << "Opening session " << session->name() << std::endl;
213@@ -103,6 +124,7 @@
214 auto const usc_session = std::make_shared<UscSession>(session, *focus_controller);
215
216 session_monitor->add(usc_session, session->process_id());
217+ sessions.push_back(session);
218 }
219
220 void usc::WindowManager::on_session_removed(std::shared_ptr<mir::scene::Session> const& session) const
221@@ -110,9 +132,43 @@
222 std::cerr << "Closing session " << session->name() << std::endl;
223
224 session_monitor->remove(session);
225+
226+ sessions.erase( std::remove(begin(sessions), end(sessions), session), end(sessions));
227 }
228
229 void usc::WindowManager::on_session_ready(std::shared_ptr<mir::scene::Session> const& session) const
230 {
231 session_monitor->mark_ready(session.get());
232 }
233+
234+void usc::WindowManager::resize_scene_to_cloned_display_intersection()
235+{
236+ using namespace mir::geometry;
237+ // Determine display intersection geometry - they should already be cloned and have
238+ // orientation (i.e. both landscape)
239+
240+ if (rects.empty())
241+ return;
242+
243+ auto intersection = rects.front();
244+ for (auto const& rect : rects)
245+ intersection = intersection.intersection_with(rect);
246+
247+ std::cout << "Intersection: " << intersection << std::endl;
248+
249+ // Now resize all surfaces in scene to this value
250+ // TODO: (kdub) have Mir provide an easier route for this operation
251+ for (auto &session : sessions)
252+ {
253+ auto first = session->default_surface();
254+ if (!first) return;
255+ first->resize(intersection.size);
256+ auto next = session->surface_after(first);
257+ if (!next) return;
258+ while (next != first)
259+ {
260+ next->resize(intersection.size);
261+ next = session->surface_after(next);
262+ }
263+ }
264+}
265
266=== modified file 'src/window_manager.h'
267--- src/window_manager.h 2015-06-11 16:51:42 +0000
268+++ src/window_manager.h 2015-08-11 13:07:12 +0000
269@@ -20,8 +20,12 @@
270 #define USC_WINDOW_MANAGER_H_
271
272 #include <mir/shell/system_compositor_window_manager.h>
273+#include <mir/geometry/rectangle.h>
274+#include <mir/geometry/size.h>
275 #include "session_monitor.h"
276
277+#include <vector>
278+
279 namespace mir
280 {
281 namespace scene { class PlacementStrategy; class SessionCoordinator; }
282@@ -41,12 +45,21 @@
283 std::shared_ptr<mir::scene::SessionCoordinator> const& session_coordinator,
284 std::shared_ptr<SessionMonitor> const& session_switcher);
285
286+ void add_display(mir::geometry::Rectangle const& area) override;
287+ void remove_display(mir::geometry::Rectangle const& area) override;
288+
289 private:
290+ void resize_scene_to_cloned_display_intersection();
291 std::shared_ptr<SessionMonitor> const session_monitor;
292
293 virtual void on_session_added(std::shared_ptr<mir::scene::Session> const& session) const;
294 virtual void on_session_removed(std::shared_ptr<mir::scene::Session> const& session) const;
295 virtual void on_session_ready(std::shared_ptr<mir::scene::Session> const& session) const;
296+
297+ mutable std::vector<std::shared_ptr<mir::scene::Session>> sessions;
298+ std::vector<mir::geometry::Rectangle> rects;
299+ mir::geometry::Size surface_size;
300+ std::vector<std::shared_ptr<mir::scene::Surface>> mutable surfaces;
301 };
302 }
303

Subscribers

People subscribed via source and target branches