Merge lp:~andreas-pokorny/mir/fix-1538632 into lp:mir
- fix-1538632
- Merge into development-branch
Status: | Merged | ||||||||
---|---|---|---|---|---|---|---|---|---|
Approved by: | Daniel van Vugt | ||||||||
Approved revision: | no longer in the source branch. | ||||||||
Merged at revision: | 3288 | ||||||||
Proposed branch: | lp:~andreas-pokorny/mir/fix-1538632 | ||||||||
Merge into: | lp:mir | ||||||||
Diff against target: |
462 lines (+96/-57) 12 files modified
src/include/server/mir/input/input_region.h (+2/-0) src/server/input/default_configuration.cpp (+1/-1) src/server/input/display_input_region.cpp (+4/-27) src/server/input/display_input_region.h (+8/-8) src/server/scene/default_configuration.cpp (+2/-1) src/server/scene/mediating_display_changer.cpp (+20/-2) src/server/scene/mediating_display_changer.h (+9/-1) tests/include/mir/test/doubles/mock_input_region.h (+1/-0) tests/integration-tests/input/test_single_seat_setup.cpp (+1/-0) tests/unit-tests/input/test_default_input_device_hub.cpp (+1/-0) tests/unit-tests/input/test_display_input_region.cpp (+8/-14) tests/unit-tests/scene/test_mediating_display_changer.cpp (+39/-3) |
||||||||
To merge this branch: | bzr merge lp:~andreas-pokorny/mir/fix-1538632 | ||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Kevin DuBois (community) | Approve | ||
Alan Griffiths | Approve | ||
PS Jenkins bot (community) | continuous-integration | Approve | |
Mir CI Bot | continuous-integration | Approve | |
Alberto Aguirre (community) | Needs Fixing | ||
Review via email: mp+284186@code.launchpad.net |
Commit message
input: Copy output rectangles when configuration changes
DisplayInputRegion used to calculate a set of rectangles on every mouse event, even when the set of outputs rarely changes. This change keeps a mir::geometry:
* mir::graphics:
* mir::graphics:
Simultaneously the SystemWindowMan
* mir::graphics:
* mir::graphics:
This change makes sure that the DisplayInputRegion does not touch any locks used by the graphics platform during input event handling.
Description of the change
The dead lock is resolved by caching the geom::Rectangles and updating the Rectangles of the DisplayInputRegion through the MediatingDispla
Mir CI Bot (mir-ci-bot) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:3267
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Alan Griffiths (alan-griffiths) wrote : | # |
+ virtual void set_display_
It seems odd that InputRegion "understands" DisplayConfigur
Did you consider a design with:
virtual void set_display_
I.e. building the display rects at the call site instead? (As MediatingDispla
~~~~
PS I'd be tempted to add "auto geometry() -> Rectangles" to DisplayConfigur
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3268
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:3268
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Alberto Aguirre (albaguirre) wrote : | # |
215 + if (output.power_mode == mir_power_mode_on && -output.
-output.
Why turn it negative?
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3269
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:3269
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Kevin DuBois (kdub) wrote : | # |
looks good to me too
Daniel van Vugt (vanvugt) wrote : | # |
Alright. The only Needs Fixing was already resolved a few days ago. Top approving.
Preview Diff
1 | === modified file 'src/include/server/mir/input/input_region.h' | |||
2 | --- src/include/server/mir/input/input_region.h 2015-02-22 07:46:25 +0000 | |||
3 | +++ src/include/server/mir/input/input_region.h 2016-01-29 00:24:28 +0000 | |||
4 | @@ -24,6 +24,7 @@ | |||
5 | 24 | namespace geometry | 24 | namespace geometry |
6 | 25 | { | 25 | { |
7 | 26 | struct Rectangle; | 26 | struct Rectangle; |
8 | 27 | struct Rectangles; | ||
9 | 27 | struct Point; | 28 | struct Point; |
10 | 28 | } | 29 | } |
11 | 29 | namespace input | 30 | namespace input |
12 | @@ -50,6 +51,7 @@ | |||
13 | 50 | * @param [in,out] point the point to confine | 51 | * @param [in,out] point the point to confine |
14 | 51 | */ | 52 | */ |
15 | 52 | virtual void confine(geometry::Point& point) = 0; | 53 | virtual void confine(geometry::Point& point) = 0; |
16 | 54 | virtual void set_input_rectangles(geometry::Rectangles const& rectangles) = 0; | ||
17 | 53 | 55 | ||
18 | 54 | protected: | 56 | protected: |
19 | 55 | InputRegion() = default; | 57 | InputRegion() = default; |
20 | 56 | 58 | ||
21 | === modified file 'src/server/input/default_configuration.cpp' | |||
22 | --- src/server/input/default_configuration.cpp 2016-01-22 06:01:36 +0000 | |||
23 | +++ src/server/input/default_configuration.cpp 2016-01-29 00:24:28 +0000 | |||
24 | @@ -62,7 +62,7 @@ | |||
25 | 62 | return input_region( | 62 | return input_region( |
26 | 63 | [this]() | 63 | [this]() |
27 | 64 | { | 64 | { |
29 | 65 | return std::make_shared<mi::DisplayInputRegion>(the_display()); | 65 | return std::make_shared<mi::DisplayInputRegion>(); |
30 | 66 | }); | 66 | }); |
31 | 67 | } | 67 | } |
32 | 68 | 68 | ||
33 | 69 | 69 | ||
34 | === modified file 'src/server/input/display_input_region.cpp' | |||
35 | --- src/server/input/display_input_region.cpp 2016-01-20 23:59:18 +0000 | |||
36 | +++ src/server/input/display_input_region.cpp 2016-01-29 00:24:28 +0000 | |||
37 | @@ -17,8 +17,7 @@ | |||
38 | 17 | */ | 17 | */ |
39 | 18 | 18 | ||
40 | 19 | #include "display_input_region.h" | 19 | #include "display_input_region.h" |
43 | 20 | #include "mir/graphics/display.h" | 20 | #include "mir/graphics/display_configuration.h" |
42 | 21 | #include "mir/graphics/display_buffer.h" | ||
44 | 22 | 21 | ||
45 | 23 | #include "mir/geometry/rectangle.h" | 22 | #include "mir/geometry/rectangle.h" |
46 | 24 | #include "mir/geometry/rectangles.h" | 23 | #include "mir/geometry/rectangles.h" |
47 | @@ -27,25 +26,14 @@ | |||
48 | 27 | namespace mg = mir::graphics; | 26 | namespace mg = mir::graphics; |
49 | 28 | namespace geom = mir::geometry; | 27 | namespace geom = mir::geometry; |
50 | 29 | 28 | ||
54 | 30 | mi::DisplayInputRegion::DisplayInputRegion( | 29 | void mi::DisplayInputRegion::set_input_rectangles(geometry::Rectangles const& config) |
52 | 31 | std::shared_ptr<mg::Display> const& display) | ||
53 | 32 | : display{display} | ||
55 | 33 | { | 30 | { |
56 | 31 | std::unique_lock<std::mutex> lock(rectangle_guard); | ||
57 | 32 | rectangles = config; | ||
58 | 34 | } | 33 | } |
59 | 35 | 34 | ||
60 | 36 | geom::Rectangle mi::DisplayInputRegion::bounding_rectangle() | 35 | geom::Rectangle mi::DisplayInputRegion::bounding_rectangle() |
61 | 37 | { | 36 | { |
62 | 38 | geom::Rectangles rectangles; | ||
63 | 39 | |||
64 | 40 | display->for_each_display_sync_group([&rectangles](mg::DisplaySyncGroup& group) | ||
65 | 41 | { | ||
66 | 42 | group.for_each_display_buffer( | ||
67 | 43 | [&rectangles](mg::DisplayBuffer const& buffer) | ||
68 | 44 | { | ||
69 | 45 | rectangles.add(buffer.view_area()); | ||
70 | 46 | }); | ||
71 | 47 | }); | ||
72 | 48 | |||
73 | 49 | //TODO: This region is mainly used for scaling touchscreen coordinates, so the caller | 37 | //TODO: This region is mainly used for scaling touchscreen coordinates, so the caller |
74 | 50 | // probably wants the full list of rectangles. Additional work is needed | 38 | // probably wants the full list of rectangles. Additional work is needed |
75 | 51 | // to group a touchscreen with a display. So for now, just return the view area | 39 | // to group a touchscreen with a display. So for now, just return the view area |
76 | @@ -59,16 +47,5 @@ | |||
77 | 59 | 47 | ||
78 | 60 | void mi::DisplayInputRegion::confine(geom::Point& point) | 48 | void mi::DisplayInputRegion::confine(geom::Point& point) |
79 | 61 | { | 49 | { |
80 | 62 | geom::Rectangles rectangles; | ||
81 | 63 | |||
82 | 64 | display->for_each_display_sync_group([&rectangles](mg::DisplaySyncGroup& group) | ||
83 | 65 | { | ||
84 | 66 | group.for_each_display_buffer( | ||
85 | 67 | [&rectangles](mg::DisplayBuffer const& buffer) | ||
86 | 68 | { | ||
87 | 69 | rectangles.add(buffer.view_area()); | ||
88 | 70 | }); | ||
89 | 71 | }); | ||
90 | 72 | |||
91 | 73 | rectangles.confine(point); | 50 | rectangles.confine(point); |
92 | 74 | } | 51 | } |
93 | 75 | 52 | ||
94 | === modified file 'src/server/input/display_input_region.h' | |||
95 | --- src/server/input/display_input_region.h 2014-03-06 06:05:17 +0000 | |||
96 | +++ src/server/input/display_input_region.h 2016-01-29 00:24:28 +0000 | |||
97 | @@ -20,28 +20,28 @@ | |||
98 | 20 | #define MIR_INPUT_DISPLAY_INPUT_REGION_H_ | 20 | #define MIR_INPUT_DISPLAY_INPUT_REGION_H_ |
99 | 21 | 21 | ||
100 | 22 | #include "mir/input/input_region.h" | 22 | #include "mir/input/input_region.h" |
101 | 23 | #include "mir/geometry/rectangles.h" | ||
102 | 23 | 24 | ||
103 | 24 | #include <memory> | 25 | #include <memory> |
104 | 26 | #include <mutex> | ||
105 | 25 | 27 | ||
106 | 26 | namespace mir | 28 | namespace mir |
107 | 27 | { | 29 | { |
108 | 28 | namespace graphics | ||
109 | 29 | { | ||
110 | 30 | class Display; | ||
111 | 31 | } | ||
112 | 32 | namespace input | 30 | namespace input |
113 | 33 | { | 31 | { |
114 | 34 | 32 | ||
115 | 35 | class DisplayInputRegion : public InputRegion | 33 | class DisplayInputRegion : public InputRegion |
116 | 36 | { | 34 | { |
117 | 37 | public: | 35 | public: |
119 | 38 | DisplayInputRegion(std::shared_ptr<graphics::Display> const& display); | 36 | DisplayInputRegion() = default; |
120 | 39 | 37 | ||
123 | 40 | geometry::Rectangle bounding_rectangle(); | 38 | geometry::Rectangle bounding_rectangle() override; |
124 | 41 | void confine(geometry::Point& point); | 39 | void confine(geometry::Point& point) override; |
125 | 40 | void set_input_rectangles(geometry::Rectangles const& rectangles) override; | ||
126 | 42 | 41 | ||
127 | 43 | private: | 42 | private: |
129 | 44 | std::shared_ptr<graphics::Display> const display; | 43 | std::mutex rectangle_guard; |
130 | 44 | geometry::Rectangles rectangles; | ||
131 | 45 | }; | 45 | }; |
132 | 46 | 46 | ||
133 | 47 | } | 47 | } |
134 | 48 | 48 | ||
135 | === modified file 'src/server/scene/default_configuration.cpp' | |||
136 | --- src/server/scene/default_configuration.cpp 2016-01-20 23:59:18 +0000 | |||
137 | +++ src/server/scene/default_configuration.cpp 2016-01-29 00:24:28 +0000 | |||
138 | @@ -140,7 +140,8 @@ | |||
139 | 140 | the_session_container(), | 140 | the_session_container(), |
140 | 141 | the_session_event_handler_register(), | 141 | the_session_event_handler_register(), |
141 | 142 | the_server_action_queue(), | 142 | the_server_action_queue(), |
143 | 143 | the_display_configuration_report()); | 143 | the_display_configuration_report(), |
144 | 144 | the_input_region()); | ||
145 | 144 | }); | 145 | }); |
146 | 145 | 146 | ||
147 | 146 | } | 147 | } |
148 | 147 | 148 | ||
149 | === modified file 'src/server/scene/mediating_display_changer.cpp' | |||
150 | --- src/server/scene/mediating_display_changer.cpp 2016-01-20 23:59:18 +0000 | |||
151 | +++ src/server/scene/mediating_display_changer.cpp 2016-01-29 00:24:28 +0000 | |||
152 | @@ -23,6 +23,7 @@ | |||
153 | 23 | #include "session_event_handler_register.h" | 23 | #include "session_event_handler_register.h" |
154 | 24 | #include "mir/graphics/display.h" | 24 | #include "mir/graphics/display.h" |
155 | 25 | #include "mir/compositor/compositor.h" | 25 | #include "mir/compositor/compositor.h" |
156 | 26 | #include "mir/geometry/rectangles.h" | ||
157 | 26 | #include "mir/graphics/display_configuration_policy.h" | 27 | #include "mir/graphics/display_configuration_policy.h" |
158 | 27 | #include "mir/graphics/display_configuration.h" | 28 | #include "mir/graphics/display_configuration.h" |
159 | 28 | #include "mir/graphics/display_configuration_report.h" | 29 | #include "mir/graphics/display_configuration_report.h" |
160 | @@ -32,6 +33,7 @@ | |||
161 | 32 | namespace ms = mir::scene; | 33 | namespace ms = mir::scene; |
162 | 33 | namespace mg = mir::graphics; | 34 | namespace mg = mir::graphics; |
163 | 34 | namespace mc = mir::compositor; | 35 | namespace mc = mir::compositor; |
164 | 36 | namespace mi = mir::input; | ||
165 | 35 | 37 | ||
166 | 36 | namespace | 38 | namespace |
167 | 37 | { | 39 | { |
168 | @@ -66,7 +68,8 @@ | |||
169 | 66 | std::shared_ptr<SessionContainer> const& session_container, | 68 | std::shared_ptr<SessionContainer> const& session_container, |
170 | 67 | std::shared_ptr<SessionEventHandlerRegister> const& session_event_handler_register, | 69 | std::shared_ptr<SessionEventHandlerRegister> const& session_event_handler_register, |
171 | 68 | std::shared_ptr<ServerActionQueue> const& server_action_queue, | 70 | std::shared_ptr<ServerActionQueue> const& server_action_queue, |
173 | 69 | std::shared_ptr<mg::DisplayConfigurationReport> const& report) | 71 | std::shared_ptr<mg::DisplayConfigurationReport> const& report, |
174 | 72 | std::shared_ptr<mi::InputRegion> const& region) | ||
175 | 70 | : display{display}, | 73 | : display{display}, |
176 | 71 | compositor{compositor}, | 74 | compositor{compositor}, |
177 | 72 | display_configuration_policy{display_configuration_policy}, | 75 | display_configuration_policy{display_configuration_policy}, |
178 | @@ -75,7 +78,8 @@ | |||
179 | 75 | server_action_queue{server_action_queue}, | 78 | server_action_queue{server_action_queue}, |
180 | 76 | report{report}, | 79 | report{report}, |
181 | 77 | base_configuration_{display->configuration()}, | 80 | base_configuration_{display->configuration()}, |
183 | 78 | base_configuration_applied{true} | 81 | base_configuration_applied{true}, |
184 | 82 | region{region} | ||
185 | 79 | { | 83 | { |
186 | 80 | session_event_handler_register->register_focus_change_handler( | 84 | session_event_handler_register->register_focus_change_handler( |
187 | 81 | [this](std::shared_ptr<ms::Session> const& session) | 85 | [this](std::shared_ptr<ms::Session> const& session) |
188 | @@ -112,6 +116,7 @@ | |||
189 | 112 | }); | 116 | }); |
190 | 113 | 117 | ||
191 | 114 | report->initial_configuration(*base_configuration_); | 118 | report->initial_configuration(*base_configuration_); |
192 | 119 | update_input_rectangles(*base_configuration_); | ||
193 | 115 | } | 120 | } |
194 | 116 | 121 | ||
195 | 117 | void ms::MediatingDisplayChanger::configure( | 122 | void ms::MediatingDisplayChanger::configure( |
196 | @@ -204,6 +209,7 @@ | |||
197 | 204 | { | 209 | { |
198 | 205 | display->configure(*conf); | 210 | display->configure(*conf); |
199 | 206 | } | 211 | } |
200 | 212 | update_input_rectangles(*conf); | ||
201 | 207 | 213 | ||
202 | 208 | base_configuration_applied = false; | 214 | base_configuration_applied = false; |
203 | 209 | } | 215 | } |
204 | @@ -282,3 +288,15 @@ | |||
205 | 282 | send_config_to_all_sessions(conf); | 288 | send_config_to_all_sessions(conf); |
206 | 283 | }); | 289 | }); |
207 | 284 | } | 290 | } |
208 | 291 | |||
209 | 292 | void ms::MediatingDisplayChanger::update_input_rectangles(mg::DisplayConfiguration const& config) | ||
210 | 293 | { | ||
211 | 294 | geometry::Rectangles rectangles; | ||
212 | 295 | config.for_each_output( | ||
213 | 296 | [&rectangles](mg::DisplayConfigurationOutput const& output) | ||
214 | 297 | { | ||
215 | 298 | if (output.power_mode == mir_power_mode_on && output.current_mode_index < output.modes.size()) | ||
216 | 299 | rectangles.add(geometry::Rectangle(output.top_left, output.modes[output.current_mode_index].size)); | ||
217 | 300 | }); | ||
218 | 301 | region->set_input_rectangles(rectangles); | ||
219 | 302 | } | ||
220 | 285 | 303 | ||
221 | === modified file 'src/server/scene/mediating_display_changer.h' | |||
222 | --- src/server/scene/mediating_display_changer.h 2016-01-20 23:59:18 +0000 | |||
223 | +++ src/server/scene/mediating_display_changer.h 2016-01-29 00:24:28 +0000 | |||
224 | @@ -22,6 +22,7 @@ | |||
225 | 22 | #include "mir/frontend/display_changer.h" | 22 | #include "mir/frontend/display_changer.h" |
226 | 23 | #include "mir/display_changer.h" | 23 | #include "mir/display_changer.h" |
227 | 24 | #include "mir/shell/display_configuration_controller.h" | 24 | #include "mir/shell/display_configuration_controller.h" |
228 | 25 | #include "mir/input/input_region.h" | ||
229 | 25 | 26 | ||
230 | 26 | #include <mutex> | 27 | #include <mutex> |
231 | 27 | #include <map> | 28 | #include <map> |
232 | @@ -37,6 +38,10 @@ | |||
233 | 37 | class DisplayConfigurationReport; | 38 | class DisplayConfigurationReport; |
234 | 38 | } | 39 | } |
235 | 39 | namespace compositor { class Compositor; } | 40 | namespace compositor { class Compositor; } |
236 | 41 | namespace input | ||
237 | 42 | { | ||
238 | 43 | class InputRegion; | ||
239 | 44 | } | ||
240 | 40 | namespace scene | 45 | namespace scene |
241 | 41 | { | 46 | { |
242 | 42 | class SessionEventHandlerRegister; | 47 | class SessionEventHandlerRegister; |
243 | @@ -55,7 +60,8 @@ | |||
244 | 55 | std::shared_ptr<SessionContainer> const& session_container, | 60 | std::shared_ptr<SessionContainer> const& session_container, |
245 | 56 | std::shared_ptr<SessionEventHandlerRegister> const& session_event_handler_register, | 61 | std::shared_ptr<SessionEventHandlerRegister> const& session_event_handler_register, |
246 | 57 | std::shared_ptr<ServerActionQueue> const& server_action_queue, | 62 | std::shared_ptr<ServerActionQueue> const& server_action_queue, |
248 | 58 | std::shared_ptr<graphics::DisplayConfigurationReport> const& report); | 63 | std::shared_ptr<graphics::DisplayConfigurationReport> const& report, |
249 | 64 | std::shared_ptr<input::InputRegion> const& region); | ||
250 | 59 | 65 | ||
251 | 60 | /* From mir::frontend::DisplayChanger */ | 66 | /* From mir::frontend::DisplayChanger */ |
252 | 61 | std::shared_ptr<graphics::DisplayConfiguration> base_configuration() override; | 67 | std::shared_ptr<graphics::DisplayConfiguration> base_configuration() override; |
253 | @@ -83,6 +89,7 @@ | |||
254 | 83 | void apply_base_config(SystemStateHandling pause_resume_system); | 89 | void apply_base_config(SystemStateHandling pause_resume_system); |
255 | 84 | void send_config_to_all_sessions( | 90 | void send_config_to_all_sessions( |
256 | 85 | std::shared_ptr<graphics::DisplayConfiguration> const& conf); | 91 | std::shared_ptr<graphics::DisplayConfiguration> const& conf); |
257 | 92 | void update_input_rectangles(graphics::DisplayConfiguration const& conf); | ||
258 | 86 | 93 | ||
259 | 87 | std::shared_ptr<graphics::Display> const display; | 94 | std::shared_ptr<graphics::Display> const display; |
260 | 88 | std::shared_ptr<compositor::Compositor> const compositor; | 95 | std::shared_ptr<compositor::Compositor> const compositor; |
261 | @@ -98,6 +105,7 @@ | |||
262 | 98 | std::weak_ptr<frontend::Session> focused_session; | 105 | std::weak_ptr<frontend::Session> focused_session; |
263 | 99 | std::shared_ptr<graphics::DisplayConfiguration> base_configuration_; | 106 | std::shared_ptr<graphics::DisplayConfiguration> base_configuration_; |
264 | 100 | bool base_configuration_applied; | 107 | bool base_configuration_applied; |
265 | 108 | std::shared_ptr<input::InputRegion> const region; | ||
266 | 101 | }; | 109 | }; |
267 | 102 | 110 | ||
268 | 103 | } | 111 | } |
269 | 104 | 112 | ||
270 | === modified file 'tests/include/mir/test/doubles/mock_input_region.h' | |||
271 | --- tests/include/mir/test/doubles/mock_input_region.h 2013-07-19 14:12:57 +0000 | |||
272 | +++ tests/include/mir/test/doubles/mock_input_region.h 2016-01-29 00:24:28 +0000 | |||
273 | @@ -36,6 +36,7 @@ | |||
274 | 36 | { | 36 | { |
275 | 37 | public: | 37 | public: |
276 | 38 | MOCK_METHOD0(bounding_rectangle, geometry::Rectangle()); | 38 | MOCK_METHOD0(bounding_rectangle, geometry::Rectangle()); |
277 | 39 | MOCK_METHOD1(set_input_rectangles, void(geometry::Rectangles const&)); | ||
278 | 39 | MOCK_METHOD1(confine, void(geometry::Point&)); | 40 | MOCK_METHOD1(confine, void(geometry::Point&)); |
279 | 40 | }; | 41 | }; |
280 | 41 | 42 | ||
281 | 42 | 43 | ||
282 | === modified file 'tests/integration-tests/input/test_single_seat_setup.cpp' | |||
283 | --- tests/integration-tests/input/test_single_seat_setup.cpp 2016-01-22 04:38:07 +0000 | |||
284 | +++ tests/integration-tests/input/test_single_seat_setup.cpp 2016-01-29 00:24:28 +0000 | |||
285 | @@ -34,6 +34,7 @@ | |||
286 | 34 | #include "mir/input/device_capability.h" | 34 | #include "mir/input/device_capability.h" |
287 | 35 | #include "mir/input/pointer_configuration.h" | 35 | #include "mir/input/pointer_configuration.h" |
288 | 36 | #include "mir/input/touchpad_configuration.h" | 36 | #include "mir/input/touchpad_configuration.h" |
289 | 37 | #include "mir/geometry/rectangles.h" | ||
290 | 37 | 38 | ||
291 | 38 | #include <gmock/gmock.h> | 39 | #include <gmock/gmock.h> |
292 | 39 | #include <gtest/gtest.h> | 40 | #include <gtest/gtest.h> |
293 | 40 | 41 | ||
294 | === modified file 'tests/unit-tests/input/test_default_input_device_hub.cpp' | |||
295 | --- tests/unit-tests/input/test_default_input_device_hub.cpp 2016-01-22 06:01:36 +0000 | |||
296 | +++ tests/unit-tests/input/test_default_input_device_hub.cpp 2016-01-29 00:24:28 +0000 | |||
297 | @@ -29,6 +29,7 @@ | |||
298 | 29 | #include "mir/test/fake_shared.h" | 29 | #include "mir/test/fake_shared.h" |
299 | 30 | 30 | ||
300 | 31 | #include "mir/dispatch/action_queue.h" | 31 | #include "mir/dispatch/action_queue.h" |
301 | 32 | #include "mir/geometry/rectangles.h" | ||
302 | 32 | #include "mir/dispatch/multiplexing_dispatchable.h" | 33 | #include "mir/dispatch/multiplexing_dispatchable.h" |
303 | 33 | #include "mir/events/event_builders.h" | 34 | #include "mir/events/event_builders.h" |
304 | 34 | #include "mir/input/cursor_listener.h" | 35 | #include "mir/input/cursor_listener.h" |
305 | 35 | 36 | ||
306 | === modified file 'tests/unit-tests/input/test_display_input_region.cpp' | |||
307 | --- tests/unit-tests/input/test_display_input_region.cpp 2016-01-20 23:59:18 +0000 | |||
308 | +++ tests/unit-tests/input/test_display_input_region.cpp 2016-01-29 00:24:28 +0000 | |||
309 | @@ -18,22 +18,16 @@ | |||
310 | 18 | 18 | ||
311 | 19 | #include "src/server/input/display_input_region.h" | 19 | #include "src/server/input/display_input_region.h" |
312 | 20 | 20 | ||
313 | 21 | #include "mir/test/doubles/null_display.h" | ||
314 | 22 | #include "mir/test/doubles/stub_display.h" | ||
315 | 23 | |||
316 | 24 | #include <vector> | ||
317 | 25 | #include <tuple> | 21 | #include <tuple> |
318 | 26 | 22 | ||
319 | 27 | #include <gtest/gtest.h> | 23 | #include <gtest/gtest.h> |
320 | 28 | 24 | ||
321 | 29 | namespace mi = mir::input; | 25 | namespace mi = mir::input; |
322 | 30 | namespace mg = mir::graphics; | ||
323 | 31 | namespace mtd = mir::test::doubles; | ||
324 | 32 | namespace geom = mir::geometry; | 26 | namespace geom = mir::geometry; |
325 | 33 | 27 | ||
326 | 34 | namespace | 28 | namespace |
327 | 35 | { | 29 | { |
329 | 36 | std::vector<geom::Rectangle> const rects{ | 30 | geom::Rectangles const rects{ |
330 | 37 | geom::Rectangle{{0,0}, {800,600}}, | 31 | geom::Rectangle{{0,0}, {800,600}}, |
331 | 38 | geom::Rectangle{{0,600}, {100,100}}, | 32 | geom::Rectangle{{0,600}, {100,100}}, |
332 | 39 | geom::Rectangle{{800,0}, {100,100}} | 33 | geom::Rectangle{{800,0}, {100,100}} |
333 | @@ -43,9 +37,9 @@ | |||
334 | 43 | TEST(DisplayInputRegionTest, returns_correct_bounding_rectangle) | 37 | TEST(DisplayInputRegionTest, returns_correct_bounding_rectangle) |
335 | 44 | { | 38 | { |
336 | 45 | geom::Rectangle const expected_bounding_rect{geom::Point{0,0}, geom::Size{800,600}}; | 39 | geom::Rectangle const expected_bounding_rect{geom::Point{0,0}, geom::Size{800,600}}; |
337 | 46 | auto stub_display = std::make_shared<mtd::StubDisplay>(rects); | ||
338 | 47 | 40 | ||
340 | 48 | mi::DisplayInputRegion input_region{stub_display}; | 41 | mi::DisplayInputRegion input_region; |
341 | 42 | input_region.set_input_rectangles(rects); | ||
342 | 49 | 43 | ||
343 | 50 | auto rect = input_region.bounding_rectangle(); | 44 | auto rect = input_region.bounding_rectangle(); |
344 | 51 | EXPECT_EQ(expected_bounding_rect, rect); | 45 | EXPECT_EQ(expected_bounding_rect, rect); |
345 | @@ -53,9 +47,8 @@ | |||
346 | 53 | 47 | ||
347 | 54 | TEST(DisplayInputRegionTest, confines_point_to_closest_valid_position) | 48 | TEST(DisplayInputRegionTest, confines_point_to_closest_valid_position) |
348 | 55 | { | 49 | { |
352 | 56 | auto stub_display = std::make_shared<mtd::StubDisplay>(rects); | 50 | mi::DisplayInputRegion input_region; |
353 | 57 | 51 | input_region.set_input_rectangles(rects); | |
351 | 58 | mi::DisplayInputRegion input_region{stub_display}; | ||
354 | 59 | 52 | ||
355 | 60 | std::vector<std::tuple<geom::Point,geom::Point>> point_tuples{ | 53 | std::vector<std::tuple<geom::Point,geom::Point>> point_tuples{ |
356 | 61 | std::make_tuple(geom::Point{0,0}, geom::Point{0,0}), | 54 | std::make_tuple(geom::Point{0,0}, geom::Point{0,0}), |
357 | @@ -83,10 +76,11 @@ | |||
358 | 83 | 76 | ||
359 | 84 | TEST(DisplayInputRegionTest, returns_empty_bounding_rectangle_when_there_are_no_outputs) | 77 | TEST(DisplayInputRegionTest, returns_empty_bounding_rectangle_when_there_are_no_outputs) |
360 | 85 | { | 78 | { |
361 | 79 | geom::Rectangles const empty_rects{}; | ||
362 | 86 | geom::Rectangle const empty_rect{}; | 80 | geom::Rectangle const empty_rect{}; |
363 | 87 | auto const stub_display = std::make_shared<mtd::StubDisplay>(0); | ||
364 | 88 | 81 | ||
366 | 89 | mi::DisplayInputRegion input_region{stub_display}; | 82 | mi::DisplayInputRegion input_region; |
367 | 83 | input_region.set_input_rectangles(empty_rects); | ||
368 | 90 | 84 | ||
369 | 91 | auto const bounding_rect = input_region.bounding_rectangle(); | 85 | auto const bounding_rect = input_region.bounding_rectangle(); |
370 | 92 | EXPECT_EQ(empty_rect, bounding_rect); | 86 | EXPECT_EQ(empty_rect, bounding_rect); |
371 | 93 | 87 | ||
372 | === modified file 'tests/unit-tests/scene/test_mediating_display_changer.cpp' | |||
373 | --- tests/unit-tests/scene/test_mediating_display_changer.cpp 2016-01-20 23:59:18 +0000 | |||
374 | +++ tests/unit-tests/scene/test_mediating_display_changer.cpp 2016-01-29 00:24:28 +0000 | |||
375 | @@ -20,6 +20,7 @@ | |||
376 | 20 | #include "src/server/scene/session_container.h" | 20 | #include "src/server/scene/session_container.h" |
377 | 21 | #include "mir/graphics/display_configuration_policy.h" | 21 | #include "mir/graphics/display_configuration_policy.h" |
378 | 22 | #include "mir/graphics/display_configuration_report.h" | 22 | #include "mir/graphics/display_configuration_report.h" |
379 | 23 | #include "mir/geometry/rectangles.h" | ||
380 | 23 | #include "src/server/scene/broadcasting_session_event_sink.h" | 24 | #include "src/server/scene/broadcasting_session_event_sink.h" |
381 | 24 | #include "mir/server_action_queue.h" | 25 | #include "mir/server_action_queue.h" |
382 | 25 | 26 | ||
383 | @@ -28,6 +29,7 @@ | |||
384 | 28 | #include "mir/test/doubles/null_display_configuration.h" | 29 | #include "mir/test/doubles/null_display_configuration.h" |
385 | 29 | #include "mir/test/doubles/stub_display_configuration.h" | 30 | #include "mir/test/doubles/stub_display_configuration.h" |
386 | 30 | #include "mir/test/doubles/mock_scene_session.h" | 31 | #include "mir/test/doubles/mock_scene_session.h" |
387 | 32 | #include "mir/test/doubles/mock_input_region.h" | ||
388 | 31 | #include "mir/test/doubles/stub_session.h" | 33 | #include "mir/test/doubles/stub_session.h" |
389 | 32 | #include "mir/test/fake_shared.h" | 34 | #include "mir/test/fake_shared.h" |
390 | 33 | #include "mir/test/display_config_matchers.h" | 35 | #include "mir/test/display_config_matchers.h" |
391 | @@ -135,7 +137,8 @@ | |||
392 | 135 | mt::fake_shared(stub_session_container), | 137 | mt::fake_shared(stub_session_container), |
393 | 136 | mt::fake_shared(session_event_sink), | 138 | mt::fake_shared(session_event_sink), |
394 | 137 | mt::fake_shared(server_action_queue), | 139 | mt::fake_shared(server_action_queue), |
396 | 138 | mt::fake_shared(display_configuration_report)); | 140 | mt::fake_shared(display_configuration_report), |
397 | 141 | mt::fake_shared(mock_input_region)); | ||
398 | 139 | } | 142 | } |
399 | 140 | 143 | ||
400 | 141 | testing::NiceMock<MockDisplay> mock_display; | 144 | testing::NiceMock<MockDisplay> mock_display; |
401 | @@ -146,6 +149,7 @@ | |||
402 | 146 | mtd::StubDisplayConfig base_config; | 149 | mtd::StubDisplayConfig base_config; |
403 | 147 | StubServerActionQueue server_action_queue; | 150 | StubServerActionQueue server_action_queue; |
404 | 148 | StubDisplayConfigurationReport display_configuration_report; | 151 | StubDisplayConfigurationReport display_configuration_report; |
405 | 152 | testing::NiceMock<mtd::MockInputRegion> mock_input_region; | ||
406 | 149 | std::shared_ptr<ms::MediatingDisplayChanger> changer; | 153 | std::shared_ptr<ms::MediatingDisplayChanger> changer; |
407 | 150 | }; | 154 | }; |
408 | 151 | 155 | ||
409 | @@ -428,7 +432,8 @@ | |||
410 | 428 | mt::fake_shared(stub_session_container), | 432 | mt::fake_shared(stub_session_container), |
411 | 429 | mt::fake_shared(session_event_sink), | 433 | mt::fake_shared(session_event_sink), |
412 | 430 | mt::fake_shared(mock_server_action_queue), | 434 | mt::fake_shared(mock_server_action_queue), |
414 | 431 | mt::fake_shared(display_configuration_report)); | 435 | mt::fake_shared(display_configuration_report), |
415 | 436 | mt::fake_shared(mock_input_region)); | ||
416 | 432 | 437 | ||
417 | 433 | void const* owner{nullptr}; | 438 | void const* owner{nullptr}; |
418 | 434 | 439 | ||
419 | @@ -483,7 +488,8 @@ | |||
420 | 483 | mt::fake_shared(stub_session_container), | 488 | mt::fake_shared(stub_session_container), |
421 | 484 | mt::fake_shared(session_event_sink), | 489 | mt::fake_shared(session_event_sink), |
422 | 485 | mt::fake_shared(mock_server_action_queue), | 490 | mt::fake_shared(mock_server_action_queue), |
424 | 486 | mt::fake_shared(display_configuration_report)); | 491 | mt::fake_shared(display_configuration_report), |
425 | 492 | mt::fake_shared(mock_input_region)); | ||
426 | 487 | 493 | ||
427 | 488 | EXPECT_CALL(mock_server_action_queue, enqueue(_, _)); | 494 | EXPECT_CALL(mock_server_action_queue, enqueue(_, _)); |
428 | 489 | session_event_sink.handle_focus_change(active_session); | 495 | session_event_sink.handle_focus_change(active_session); |
429 | @@ -594,3 +600,33 @@ | |||
430 | 594 | 600 | ||
431 | 595 | changer->set_base_configuration(mt::fake_shared(conf)); | 601 | changer->set_base_configuration(mt::fake_shared(conf)); |
432 | 596 | } | 602 | } |
433 | 603 | |||
434 | 604 | TEST_F(MediatingDisplayChangerTest, input_region_receives_display_configuration_on_start) | ||
435 | 605 | { | ||
436 | 606 | using namespace testing; | ||
437 | 607 | EXPECT_CALL(mock_input_region, set_input_rectangles(_)); | ||
438 | 608 | |||
439 | 609 | ms::MediatingDisplayChanger display_changer( | ||
440 | 610 | mt::fake_shared(mock_display), | ||
441 | 611 | mt::fake_shared(mock_compositor), | ||
442 | 612 | mt::fake_shared(mock_conf_policy), | ||
443 | 613 | mt::fake_shared(stub_session_container), | ||
444 | 614 | mt::fake_shared(session_event_sink), | ||
445 | 615 | mt::fake_shared(server_action_queue), | ||
446 | 616 | mt::fake_shared(display_configuration_report), | ||
447 | 617 | mt::fake_shared(mock_input_region)); | ||
448 | 618 | } | ||
449 | 619 | |||
450 | 620 | TEST_F(MediatingDisplayChangerTest, notifies_input_region_on_new_configuration) | ||
451 | 621 | { | ||
452 | 622 | using namespace testing; | ||
453 | 623 | mtd::NullDisplayConfiguration conf; | ||
454 | 624 | mir::geometry::Rectangles expected_rectangles; | ||
455 | 625 | EXPECT_CALL(mock_input_region, set_input_rectangles(expected_rectangles)); | ||
456 | 626 | |||
457 | 627 | auto session = std::make_shared<mtd::StubSession>(); | ||
458 | 628 | |||
459 | 629 | session_event_sink.handle_focus_change(session); | ||
460 | 630 | changer->configure(session, | ||
461 | 631 | mt::fake_shared(conf)); | ||
462 | 632 | } |
PASSED: Continuous integration, rev:3267 /mir-jenkins. ubuntu. com/job/ mir-ci/ 173/ /mir-jenkins. ubuntu. com/job/ generic- update- mp/173/ console
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild: /mir-jenkins. ubuntu. com/job/ mir-ci/ 173/rebuild
https:/