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
=== modified file 'debian/changelog'
--- debian/changelog 2015-07-16 21:45:22 +0000
+++ debian/changelog 2015-08-11 13:07:12 +0000
@@ -1,8 +1,30 @@
1unity-system-compositor (0.0.5+15.10.20150506.2-0ubuntu1) UNRELEASED; urgency=medium1unity-system-compositor (0.1.0+15.10.20150728.1-0ubuntu1) wily; urgency=medium
22
3 [ Alexandros Frantzis ]
4 * Support different screen timeout values for notifications
5 (LP: #1426115)
6 * Enable and handle proximity events properly (LP: #1291455)
7 * Don't force gcc 4.9 when building the package (LP: #1478926)
8 * Introduce new versioning scheme
9
10 [ Alan Griffiths ]
11 * Port to mir SystemCompositorWindowManager
12
13 [ Robert Ancell ]
14 * Depend on the new xmir package instead of the obsolete
15 xserver-xorg-xmir (LP: #1204505)
16
17 -- CI Train Bot <ci-train-bot@canonical.com> Tue, 28 Jul 2015 18:55:28 +0000
18
19unity-system-compositor (0.0.5+15.10.20150722-0ubuntu1) wily; urgency=medium
20
21 [ Kevin Gunn ]
3 * Release in step with Mir 0.14 22 * Release in step with Mir 0.14
423
5 -- Kevin Gunn <kevin.gunn@canonical.com> Thu, 16 Jul 2015 15:14:22 -050024 [ CI Train Bot ]
25 * New rebuild forced.
26
27 -- CI Train Bot <ci-train-bot@canonical.com> Wed, 22 Jul 2015 14:49:58 +0000
628
7unity-system-compositor (0.0.5+15.04.20150713-0ubuntu1) vivid; urgency=medium29unity-system-compositor (0.0.5+15.04.20150713-0ubuntu1) vivid; urgency=medium
830
931
=== modified file 'src/CMakeLists.txt'
--- src/CMakeLists.txt 2015-07-15 13:48:30 +0000
+++ src/CMakeLists.txt 2015-08-11 13:07:12 +0000
@@ -16,6 +16,7 @@
1616
17set(USC_SRCS17set(USC_SRCS
18 asio_dm_connection.cpp18 asio_dm_connection.cpp
19 clone_display_configuration_policy.cpp
19 dbus_connection_handle.cpp20 dbus_connection_handle.cpp
20 dbus_event_loop.cpp21 dbus_event_loop.cpp
21 dbus_message_handle.cpp22 dbus_message_handle.cpp
2223
=== added file 'src/clone_display_configuration_policy.cpp'
--- src/clone_display_configuration_policy.cpp 1970-01-01 00:00:00 +0000
+++ src/clone_display_configuration_policy.cpp 2015-08-11 13:07:12 +0000
@@ -0,0 +1,46 @@
1/*
2 * Copyright (C) 2015 Canonical, Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it under
5 * the terms of the GNU Lesser General Public License version 3, as published by
6 * the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include "clone_display_configuration_policy.h"
18
19#include <mir/graphics/display_configuration.h>
20#include <cstdio>
21namespace mg = mir::graphics;
22
23CloneDisplayConfigurationPolicy::CloneDisplayConfigurationPolicy(
24 const std::shared_ptr<mir::graphics::DisplayConfigurationPolicy> &wrapped)
25 : wrapped{wrapped}
26{
27}
28
29void CloneDisplayConfigurationPolicy::apply_to(mir::graphics::DisplayConfiguration& conf)
30{
31 wrapped->apply_to(conf);
32
33 conf.for_each_output(
34 [&](mg::UserDisplayConfigurationOutput& displayConfigOutput) {
35 if (displayConfigOutput.id.as_value() > 0) { printf("Here\n");
36 displayConfigOutput.orientation = mir_orientation_left;
37 }
38 }
39 );
40
41 conf.for_each_output(
42 [&](const mg::DisplayConfigurationOutput displayConfigOutput) {
43 printf("Output %d: Orientation %d\n", displayConfigOutput.id.as_value(), displayConfigOutput.orientation);
44 }
45 );
46}
047
=== added file 'src/clone_display_configuration_policy.h'
--- src/clone_display_configuration_policy.h 1970-01-01 00:00:00 +0000
+++ src/clone_display_configuration_policy.h 2015-08-11 13:07:12 +0000
@@ -0,0 +1,34 @@
1/*
2 * Copyright (C) 2015 Canonical, Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it under
5 * the terms of the GNU Lesser General Public License version 3, as published by
6 * the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef CLONEDISPLAYCONFIGURATIONPOLICY_H
18#define CLONEDISPLAYCONFIGURATIONPOLICY_H
19
20#include <mir/graphics/display_configuration_policy.h>
21#include <memory>
22
23class CloneDisplayConfigurationPolicy : public mir::graphics::DisplayConfigurationPolicy
24{
25public:
26 CloneDisplayConfigurationPolicy(const std::shared_ptr<mir::graphics::DisplayConfigurationPolicy> &wrapped);
27
28 void apply_to(mir::graphics::DisplayConfiguration& conf) override;
29
30private:
31 const std::shared_ptr<mir::graphics::DisplayConfigurationPolicy> wrapped;
32};
33
34#endif // CLONEDISPLAYCONFIGURATIONPOLICY_H
035
=== modified file 'src/server.cpp'
--- src/server.cpp 2015-07-15 13:48:31 +0000
+++ src/server.cpp 2015-08-11 13:07:12 +0000
@@ -26,6 +26,7 @@
26#include "powerd_mediator.h"26#include "powerd_mediator.h"
27#include "unity_screen_service.h"27#include "unity_screen_service.h"
28#include "steady_clock.h"28#include "steady_clock.h"
29#include "clone_display_configuration_policy.h"
2930
30#include <mir/input/cursor_listener.h>31#include <mir/input/cursor_listener.h>
31#include <mir/server_status_listener.h>32#include <mir/server_status_listener.h>
@@ -40,6 +41,7 @@
40namespace ms = mir::scene;41namespace ms = mir::scene;
41namespace mf = mir::frontend;42namespace mf = mir::frontend;
42namespace mi = mir::input;43namespace mi = mir::input;
44namespace mg = mir::graphics;
4345
44namespace46namespace
45{47{
@@ -152,6 +154,13 @@
152 the_session_switcher());154 the_session_switcher());
153 });155 });
154156
157 wrap_display_configuration_policy(
158 [](const std::shared_ptr<mg::DisplayConfigurationPolicy> &wrapped)
159 -> std::shared_ptr<mg::DisplayConfigurationPolicy>
160 {
161 return std::make_shared<CloneDisplayConfigurationPolicy>(wrapped);
162 });
163
155 set_config_filename("unity-system-compositor.conf");164 set_config_filename("unity-system-compositor.conf");
156165
157 apply_settings();166 apply_settings();
158167
=== modified file 'src/window_manager.cpp'
--- src/window_manager.cpp 2015-06-11 16:55:36 +0000
+++ src/window_manager.cpp 2015-08-11 13:07:12 +0000
@@ -33,6 +33,7 @@
33#include "mir_toolkit/client_types.h"33#include "mir_toolkit/client_types.h"
3434
35#include <iostream>35#include <iostream>
36#include <algorithm>
3637
37namespace mf = mir::frontend;38namespace mf = mir::frontend;
38namespace ms = mir::scene;39namespace ms = mir::scene;
@@ -96,6 +97,26 @@
96 session_monitor{session_monitor}97 session_monitor{session_monitor}
97{98{
98}99}
100
101void usc::WindowManager::add_display(mir::geometry::Rectangle const& area)
102{
103 rects.push_back(area);
104 resize_scene_to_cloned_display_intersection();
105}
106
107void usc::WindowManager::remove_display(mir::geometry::Rectangle const& area)
108{
109 for(auto it = rects.begin(); it != rects.end();)
110 {
111 if (*it == area)
112 it = rects.erase(it);
113 else
114 it++;
115 }
116
117 resize_scene_to_cloned_display_intersection();
118}
119
99void usc::WindowManager::on_session_added(std::shared_ptr<mir::scene::Session> const& session) const120void usc::WindowManager::on_session_added(std::shared_ptr<mir::scene::Session> const& session) const
100{121{
101 std::cerr << "Opening session " << session->name() << std::endl;122 std::cerr << "Opening session " << session->name() << std::endl;
@@ -103,6 +124,7 @@
103 auto const usc_session = std::make_shared<UscSession>(session, *focus_controller);124 auto const usc_session = std::make_shared<UscSession>(session, *focus_controller);
104125
105 session_monitor->add(usc_session, session->process_id());126 session_monitor->add(usc_session, session->process_id());
127 sessions.push_back(session);
106}128}
107129
108void usc::WindowManager::on_session_removed(std::shared_ptr<mir::scene::Session> const& session) const130void usc::WindowManager::on_session_removed(std::shared_ptr<mir::scene::Session> const& session) const
@@ -110,9 +132,43 @@
110 std::cerr << "Closing session " << session->name() << std::endl;132 std::cerr << "Closing session " << session->name() << std::endl;
111133
112 session_monitor->remove(session);134 session_monitor->remove(session);
135
136 sessions.erase( std::remove(begin(sessions), end(sessions), session), end(sessions));
113}137}
114138
115void usc::WindowManager::on_session_ready(std::shared_ptr<mir::scene::Session> const& session) const139void usc::WindowManager::on_session_ready(std::shared_ptr<mir::scene::Session> const& session) const
116{140{
117 session_monitor->mark_ready(session.get());141 session_monitor->mark_ready(session.get());
118}142}
143
144void usc::WindowManager::resize_scene_to_cloned_display_intersection()
145{
146 using namespace mir::geometry;
147 // Determine display intersection geometry - they should already be cloned and have
148 // orientation (i.e. both landscape)
149
150 if (rects.empty())
151 return;
152
153 auto intersection = rects.front();
154 for (auto const& rect : rects)
155 intersection = intersection.intersection_with(rect);
156
157 std::cout << "Intersection: " << intersection << std::endl;
158
159 // Now resize all surfaces in scene to this value
160 // TODO: (kdub) have Mir provide an easier route for this operation
161 for (auto &session : sessions)
162 {
163 auto first = session->default_surface();
164 if (!first) return;
165 first->resize(intersection.size);
166 auto next = session->surface_after(first);
167 if (!next) return;
168 while (next != first)
169 {
170 next->resize(intersection.size);
171 next = session->surface_after(next);
172 }
173 }
174}
119175
=== modified file 'src/window_manager.h'
--- src/window_manager.h 2015-06-11 16:51:42 +0000
+++ src/window_manager.h 2015-08-11 13:07:12 +0000
@@ -20,8 +20,12 @@
20#define USC_WINDOW_MANAGER_H_20#define USC_WINDOW_MANAGER_H_
2121
22#include <mir/shell/system_compositor_window_manager.h>22#include <mir/shell/system_compositor_window_manager.h>
23#include <mir/geometry/rectangle.h>
24#include <mir/geometry/size.h>
23#include "session_monitor.h"25#include "session_monitor.h"
2426
27#include <vector>
28
25namespace mir29namespace mir
26{30{
27namespace scene { class PlacementStrategy; class SessionCoordinator; }31namespace scene { class PlacementStrategy; class SessionCoordinator; }
@@ -41,12 +45,21 @@
41 std::shared_ptr<mir::scene::SessionCoordinator> const& session_coordinator,45 std::shared_ptr<mir::scene::SessionCoordinator> const& session_coordinator,
42 std::shared_ptr<SessionMonitor> const& session_switcher);46 std::shared_ptr<SessionMonitor> const& session_switcher);
4347
48 void add_display(mir::geometry::Rectangle const& area) override;
49 void remove_display(mir::geometry::Rectangle const& area) override;
50
44private:51private:
52 void resize_scene_to_cloned_display_intersection();
45 std::shared_ptr<SessionMonitor> const session_monitor;53 std::shared_ptr<SessionMonitor> const session_monitor;
4654
47 virtual void on_session_added(std::shared_ptr<mir::scene::Session> const& session) const;55 virtual void on_session_added(std::shared_ptr<mir::scene::Session> const& session) const;
48 virtual void on_session_removed(std::shared_ptr<mir::scene::Session> const& session) const;56 virtual void on_session_removed(std::shared_ptr<mir::scene::Session> const& session) const;
49 virtual void on_session_ready(std::shared_ptr<mir::scene::Session> const& session) const;57 virtual void on_session_ready(std::shared_ptr<mir::scene::Session> const& session) const;
58
59 mutable std::vector<std::shared_ptr<mir::scene::Session>> sessions;
60 std::vector<mir::geometry::Rectangle> rects;
61 mir::geometry::Size surface_size;
62 std::vector<std::shared_ptr<mir::scene::Surface>> mutable surfaces;
50};63};
51}64}
5265

Subscribers

People subscribed via source and target branches