Merge lp:~kdub/unity-system-compositor/unblock-silo0 into lp:~mir-team/unity-system-compositor/toggle-cursor2

Proposed by Kevin DuBois
Status: Rejected
Rejected by: Alberto Aguirre
Proposed branch: lp:~kdub/unity-system-compositor/unblock-silo0
Merge into: lp:~mir-team/unity-system-compositor/toggle-cursor2
Diff against target: 127 lines (+30/-21)
3 files modified
src/server.cpp (+0/-1)
src/window_manager.cpp (+25/-19)
src/window_manager.h (+5/-1)
To merge this branch: bzr merge lp:~kdub/unity-system-compositor/unblock-silo0
Reviewer Review Type Date Requested Status
Mir development team Pending
Review via email: mp+266935@code.launchpad.net

Commit message

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.

Description of the change

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.

To post a comment you must log in.

Unmerged revisions

226. By Kevin DuBois

configure the display differently on screen changes

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/server.cpp'
2--- src/server.cpp 2015-07-31 14:11:27 +0000
3+++ src/server.cpp 2015-08-04 17:53:42 +0000
4@@ -138,7 +138,6 @@
5 {
6 return std::make_shared<WindowManager>(
7 focus_controller,
8- the_display(),
9 the_shell_display_layout(),
10 the_session_coordinator(),
11 the_session_switcher());
12
13=== modified file 'src/window_manager.cpp'
14--- src/window_manager.cpp 2015-07-31 14:11:27 +0000
15+++ src/window_manager.cpp 2015-08-04 17:53:42 +0000
16@@ -86,7 +86,6 @@
17
18 usc::WindowManager::WindowManager(
19 mir::shell::FocusController* focus_controller,
20- std::shared_ptr<mir::graphics::Display> const& display,
21 std::shared_ptr<mir::shell::DisplayLayout> const& display_layout,
22 std::shared_ptr<ms::SessionCoordinator> const& session_coordinator,
23 std::shared_ptr<SessionMonitor> const& session_monitor) :
24@@ -95,7 +94,6 @@
25 display_layout,
26 session_coordinator},
27 session_monitor{session_monitor},
28- display{display},
29 display_layout{display_layout}
30 {
31 }
32@@ -126,11 +124,20 @@
33
34 void usc::WindowManager::add_display(mir::geometry::Rectangle const& area)
35 {
36+ rects.push_back(area);
37 resize_scene_to_cloned_display_intersection();
38 }
39
40 void usc::WindowManager::remove_display(mir::geometry::Rectangle const& area)
41 {
42+ for(auto it = rects.begin(); it != rects.end();)
43+ {
44+ if (*it == area)
45+ it = rects.erase(it);
46+ else
47+ it++;
48+ }
49+
50 resize_scene_to_cloned_display_intersection();
51 }
52
53@@ -140,26 +147,25 @@
54 // Determine display intersection geometry - they should already be cloned and have
55 // orientation (i.e. both landscape)
56
57- Size intersection{999999, 999999};
58- auto displayConfig = display->configuration();
59- displayConfig->for_each_output(
60- [&](mg::DisplayConfigurationOutput const& displayConfigOutput){
61- if (!displayConfigOutput.connected || !displayConfigOutput.used)
62- return;
63-
64- Size size = displayConfigOutput.extents().size;
65- if (size.width < intersection.width)
66- intersection.width = size.width;
67- if (size.height < intersection.height)
68- intersection.height = size.height;
69- });
70-
71- std::cout << "Intersection" << intersection.width << intersection.height << std::endl;
72+ if (rects.empty())
73+ return;
74+
75+ auto intersection = rects.front();
76+ for (auto const& rect : rects)
77+ intersection = intersection.intersection_with(rect);
78+
79+ std::cout << "Intersection: " << intersection << std::endl;
80
81 // Now resize all surfaces in scene to this value
82 for (auto &session : sessions)
83- for (auto s = session->default_surface(); s; s = session->surface_after(s))
84+ {
85+ auto first = session->default_surface();
86+ first->resize(intersection.size);
87+ auto next = session->surface_after(first);
88+ while (next != first)
89 {
90- s->resize(intersection);
91+ next->resize(intersection.size);
92+ next = session->surface_after(next);
93 }
94+ }
95 }
96
97=== modified file 'src/window_manager.h'
98--- src/window_manager.h 2015-07-31 14:11:27 +0000
99+++ src/window_manager.h 2015-08-04 17:53:42 +0000
100@@ -20,8 +20,10 @@
101 #define USC_WINDOW_MANAGER_H_
102
103 #include <mir/shell/system_compositor_window_manager.h>
104+#include "mir/geometry/rectangle.h"
105 #include "session_monitor.h"
106 #include <vector>
107+#include <set>
108
109 namespace mir
110 {
111@@ -39,7 +41,6 @@
112 public:
113 explicit WindowManager(
114 mir::shell::FocusController* focus_controller,
115- std::shared_ptr<mir::graphics::Display> const& display,
116 std::shared_ptr<mir::shell::DisplayLayout> const& display_layout,
117 std::shared_ptr<mir::scene::SessionCoordinator> const& session_coordinator,
118 std::shared_ptr<SessionMonitor> const& session_monitor);
119@@ -57,6 +58,9 @@
120 virtual void on_session_added(std::shared_ptr<mir::scene::Session> const& session) const;
121 virtual void on_session_removed(std::shared_ptr<mir::scene::Session> const& session) const;
122 virtual void on_session_ready(std::shared_ptr<mir::scene::Session> const& session) const;
123+ std::vector<mir::geometry::Rectangle> rects;
124+ mir::geometry::Size surface_size;
125+ std::vector<std::shared_ptr<mir::scene::Surface>> mutable surfaces;
126 };
127 }
128

Subscribers

People subscribed via source and target branches