Merge lp:~robertcarr/mir/surface-configuration-interface--for-shell into lp:~mir-team/mir/trunk
- surface-configuration-interface--for-shell
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Robert Carr |
Approved revision: | no longer in the source branch. |
Merged at revision: | 940 |
Proposed branch: | lp:~robertcarr/mir/surface-configuration-interface--for-shell |
Merge into: | lp:~mir-team/mir/trunk |
Diff against target: |
870 lines (+393/-47) 17 files modified
include/server/mir/default_server_configuration.h (+14/-10) include/server/mir/shell/surface.h (+3/-1) include/server/mir/shell/surface_configurator.h (+54/-0) include/server/mir/shell/surface_source.h (+4/-2) include/test/mir_test_doubles/mock_surface.h (+3/-1) include/test/mir_test_doubles/mock_surface_configurator.h (+43/-0) include/test/mir_test_doubles/null_surface_configurator.h (+48/-0) src/server/default_server_configuration.cpp (+21/-1) src/server/shell/application_session.cpp (+3/-3) src/server/shell/surface.cpp (+6/-0) src/server/shell/surface_source.cpp (+6/-3) tests/acceptance-tests/CMakeLists.txt (+1/-0) tests/acceptance-tests/test_shell_control_of_surface_configuration.cpp (+139/-0) tests/integration-tests/graphics/android/test_internal_client.cpp (+2/-1) tests/unit-tests/shell/test_application_session.cpp (+2/-1) tests/unit-tests/shell/test_session_manager.cpp (+3/-2) tests/unit-tests/shell/test_surface.cpp (+41/-22) |
To merge this branch: | bzr merge lp:~robertcarr/mir/surface-configuration-interface--for-shell |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
Kevin DuBois (community) | Approve | ||
Alan Griffiths | Needs Information | ||
Review via email: mp+177055@code.launchpad.net |
Commit message
Add an interface by which the shell may be notified of and interfere with surface configuration requests.
Description of the change
Add an interface by which the shell may be notified of and interfere with surface configuration requests.
Robert Carr (robertcarr) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:880
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Robert Carr (robertcarr) wrote : | # |
Merged trunk. The SessionManager-
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:881
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Kevin DuBois (kdub) wrote : | # |
suggestion:
305 + surface_
306 + return surf->configure
skimming the requests like this seems a bit strange, I'd expect more of an Adaptor pattern that adapts the requests coming in. (and perhaps ms::Surface implements SurfaceConfigur
Alan Griffiths (alan-griffiths) wrote : | # |
149 + virtual ~SurfaceConfigu
Don't introduce new interfaces with throwing destructors.
~~~~
151 + virtual void configure_
152 + int &requested_value) = 0;
I don't find this interface intuitive:
o Why are we sharing ownership? (wouldn't ...Surface& surface... be better?)
o is requested_value an oddly named out parameter or an in/out parameter? (Why not use a return value for the out value?)
// returns value actually set
int set_attribute(
~~~~
238 + struct DefaultSurfaceC
239 + {
240 + void configure_
241 + {
242 + }
Surely a better default is to set the attrib to the value requested?
Robert Carr (robertcarr) wrote : | # |
Reworked the interface
void configure_
int select_
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:882
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Robert Carr (robertcarr) wrote : | # |
To support the OSK we will have to allow client initiated hide/show, this means thinking of a way for the shell to respond to and implement the minimised/restored state transitions. In light of this I have updated SurfaceConfigurator to include a second callback (attribute_set), providing a place for the shell to insert mechanism for these transitions (as opposed to the select_
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:883
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Alan Griffiths (alan-griffiths) wrote : | # |
253 + void attribute_
254 + {
255 + }
This confuses me. Are attributes never stored anywhere? (Clearly, not on the *const* surface supplied.)
~~~~
317 + auto applied_value = surf->configure
318 + surface_
319 + surface_
320 + return applied_value;
s/*surf.
Robert Carr (robertcarr) wrote : | # |
Removed superfulous.get()
The attributes are still stored on the surface, rather the two methods of this interface are intended to have different roles
select_
attribute_set: A place to implement mechanism in response to client state change. I.e. this surface has now changed state to minimized, go ahead and hide it and update some shell objects or whatever you want to do.
It seems this isn't really clear from the interface though. So I will brainstorm on ways to make it more self documenting. Any ideas?
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:884
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Alan Griffiths (alan-griffiths) wrote : | # |
> The attributes are still stored on the surface, rather the two methods of this
> interface are intended to have different roles
>
> select_
> request, i.e. client X wants to go fullscreen is that allowed.
> attribute_set: A place to implement mechanism in response to client state
> change. I.e. this surface has now changed state to minimized, go ahead and
> hide it and update some shell objects or whatever you want to do.
>
> It seems this isn't really clear from the interface though. So I will
> brainstorm on ways to make it more self documenting. Any ideas?
I'm not sure if this is "merely" a naming issue - or if the SurfaceConfigurator has multiple roles (which makes it hard to describe).
In either case however:
316 - return surf->configure
317 + auto applied_value = surf->configure
318 + surface_
319 + surface_
320 + return applied_value;
Is hardly clear. Is it really useful for both surface_
I'd be much happier if it read:
return surface_
Even if SurfaceConfigur
Robert Carr (robertcarr) wrote : | # |
I could modify things to the Surface takes the SurfaceConfigurator directly and this becomes internal to Surface::configure rather than using the session. Conflicts with death-to-
Robert Carr (robertcarr) wrote : | # |
I've modified this to not involve the session at all (now handled at the surface level), introduced a new unit test, and reworked some of the test doubles. I think, luckily, I've come up with a way to address the concerns on death-to-
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:888
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:889
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:890
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:891
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Alan Griffiths (alan-griffiths) wrote : | # |
> I've modified this to not involve the session at all (now handled at the
> surface level), introduced a new unit test, and reworked some of the test
> doubles. I think, luckily, I've come up with a way to address the concerns on
> death-to-
That does seem a bit simpler, but I still feel that the SurfaceConfigurator has multiple roles (which makes it hard to describe).
"Needs discussion"
Robert Carr (robertcarr) wrote : | # |
I'd like to reduce SurfaceConfigurator to a single method, but it's as the step intermediate to select_
What if SurfaceConfigurator is reduced to a single interface: (small example of a configurator which forces everything to fullscreen state)
SurfaceConfigur
{
if (attrib == mir_surface_
value = mir_surface_
state.
apply_
}
}
Robert Carr (robertcarr) wrote : | # |
To be clear apply_surface_
Robert Carr (robertcarr) wrote : | # |
We need to have a discussion on this as we are blocking the OSK.
Alan, is your concern that SurfaceConfigurator has multiple roles? I think that the attribute setting needs to follow a: filter->apply sort of pattern. It seem's then that there are two options:
1. Split in to two interfaces, i.e. SurfaceConfigur
2. Merge in to single method using some sort of object to encapsulate the apply step.
Any ideas?
Robert Carr (robertcarr) wrote : | # |
To clarify more on why the interface has two methods, i.e. a select, and apply step. I'm uncomfortable with the following flow:
msh::Surface:
{
<SNIP>
value = select_
if (attribute == state)
state = value
<...SNIP>
}
Imagine the case, where a surface is switching state from mir_surface_
Robert Carr (robertcarr) wrote : | # |
I came up with another way to reduce the interface to one method.
First, we protect the state/type members of msh::Surface with a mutex (needs to happen anyway!).
Then we ensure the mutex is held while calling to SurfaceConfigurator
// Returns the configured value
int msh::SurfaceCon
is enough as a single mutex. However, it seems reasonable that the SurfaceConfigurator might want to act like:
if (set_attribute == state)
if (surface->type() == one_thing)
// do_one_thing
else
// do_another
surface->type() is a deadlock though so this would require a recursive mutex.
Robert Carr (robertcarr) wrote : | # |
s/is enough as a single mutex/is enough as a single function/
Robert Carr (robertcarr) wrote : | # |
Another verbose but perhaps more self documenting alternative:
SurfaceAttribut
{
int select_
}
SurfaceAttribut
{
void apply_attribute
}
Presumably as they are passed together, they are wrapped in a composite type:
SurfaceConfigurator
{
SurfaceAttribut
SurfaceAttribut
}
Kevin DuBois (kdub) wrote : | # |
> I came up with another way to reduce the interface to one method.
>
> First, we protect the state/type members of msh::Surface with a mutex (needs
> to happen anyway!).
>
> Then we ensure the mutex is held while calling to SurfaceConfigurator
>
this isn't present in this MP, but I'm not a fan of holding a mutex as a part of the interface requirements
Kevin DuBois (kdub) wrote : | # |
I think this is OK as it is... although I do think its one of those MP's where what we have to get done (redirecting client requests to the shell to approve) speaks to some funny code structure or data models in msh::. Like, where does the shell keep all the information it owns about the surface stack? Seems like the shell will want to inject tentacles all over like this to extract and modify state, when if we restructured a few things so the appropriate data flowed into the shell and owned it, we wouldn't have to coordinate injecting shell permission objects all over. (my 2c)
Seems like there is some time pressure here, and I do not object to the code as it is so I feel ok +1'ing
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:892
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'include/server/mir/default_server_configuration.h' |
2 | --- include/server/mir/default_server_configuration.h 2013-08-06 10:39:53 +0000 |
3 | +++ include/server/mir/default_server_configuration.h 2013-08-07 20:06:30 +0000 |
4 | @@ -65,6 +65,7 @@ |
5 | class PixelBuffer; |
6 | class SnapshotStrategy; |
7 | class DisplayLayout; |
8 | +class SurfaceConfigurator; |
9 | class DisplayChanger; |
10 | } |
11 | namespace time |
12 | @@ -161,16 +162,18 @@ |
13 | /** @name shell configuration - customization |
14 | * configurable interfaces for modifying shell |
15 | * @{ */ |
16 | - virtual std::shared_ptr<shell::SurfaceFactory> the_shell_surface_factory(); |
17 | - virtual std::shared_ptr<shell::SessionContainer> the_shell_session_container(); |
18 | - virtual std::shared_ptr<shell::FocusSetter> the_shell_focus_setter(); |
19 | - virtual std::shared_ptr<shell::FocusSequence> the_shell_focus_sequence(); |
20 | - virtual std::shared_ptr<shell::PlacementStrategy> the_shell_placement_strategy(); |
21 | - virtual std::shared_ptr<shell::SessionListener> the_shell_session_listener(); |
22 | - virtual std::shared_ptr<shell::PixelBuffer> the_shell_pixel_buffer(); |
23 | - virtual std::shared_ptr<shell::SnapshotStrategy> the_shell_snapshot_strategy(); |
24 | - virtual std::shared_ptr<shell::DisplayLayout> the_shell_display_layout(); |
25 | - virtual std::shared_ptr<shell::DisplayChanger> the_shell_display_changer(); |
26 | + virtual std::shared_ptr<shell::SurfaceFactory> the_shell_surface_factory(); |
27 | + virtual std::shared_ptr<shell::SessionContainer> the_shell_session_container(); |
28 | + virtual std::shared_ptr<shell::FocusSetter> the_shell_focus_setter(); |
29 | + virtual std::shared_ptr<shell::FocusSequence> the_shell_focus_sequence(); |
30 | + virtual std::shared_ptr<shell::PlacementStrategy> the_shell_placement_strategy(); |
31 | + virtual std::shared_ptr<shell::SessionListener> the_shell_session_listener(); |
32 | + virtual std::shared_ptr<shell::PixelBuffer> the_shell_pixel_buffer(); |
33 | + virtual std::shared_ptr<shell::SnapshotStrategy> the_shell_snapshot_strategy(); |
34 | + virtual std::shared_ptr<shell::DisplayLayout> the_shell_display_layout(); |
35 | + virtual std::shared_ptr<shell::DisplayChanger> the_shell_display_changer(); |
36 | + virtual std::shared_ptr<shell::SurfaceConfigurator> the_shell_surface_configurator(); |
37 | + |
38 | /** @} */ |
39 | |
40 | /** @name shell configuration - dependencies |
41 | @@ -260,6 +263,7 @@ |
42 | CachedPtr<shell::PixelBuffer> shell_pixel_buffer; |
43 | CachedPtr<shell::SnapshotStrategy> shell_snapshot_strategy; |
44 | CachedPtr<shell::DisplayLayout> shell_display_layout; |
45 | + CachedPtr<shell::SurfaceConfigurator> shell_surface_configurator; |
46 | CachedPtr<shell::DisplayChanger> shell_display_changer; |
47 | CachedPtr<compositor::DisplayBufferCompositorFactory> display_buffer_compositor_factory; |
48 | CachedPtr<compositor::OverlayRenderer> overlay_renderer; |
49 | |
50 | === modified file 'include/server/mir/shell/surface.h' |
51 | --- include/server/mir/shell/surface.h 2013-07-31 22:53:11 +0000 |
52 | +++ include/server/mir/shell/surface.h 2013-08-07 20:06:30 +0000 |
53 | @@ -39,8 +39,8 @@ |
54 | { |
55 | class InputTargeter; |
56 | class SurfaceBuilder; |
57 | +class SurfaceConfigurator; |
58 | class SurfaceController; |
59 | - |
60 | struct SurfaceCreationParameters; |
61 | |
62 | class Surface : public frontend::Surface, public shell::SurfaceBufferAccess |
63 | @@ -48,6 +48,7 @@ |
64 | public: |
65 | Surface( |
66 | std::shared_ptr<SurfaceBuilder> const& builder, |
67 | + std::shared_ptr<SurfaceConfigurator> const& configurator, |
68 | SurfaceCreationParameters const& params, |
69 | frontend::SurfaceId id, |
70 | std::shared_ptr<frontend::EventSink> const& event_sink); |
71 | @@ -93,6 +94,7 @@ |
72 | void notify_change(MirSurfaceAttrib attrib, int value); |
73 | |
74 | std::shared_ptr<SurfaceBuilder> const builder; |
75 | + std::shared_ptr<SurfaceConfigurator> const configurator; |
76 | std::weak_ptr<mir::surfaces::Surface> const surface; |
77 | |
78 | frontend::SurfaceId const id; |
79 | |
80 | === added file 'include/server/mir/shell/surface_configurator.h' |
81 | --- include/server/mir/shell/surface_configurator.h 1970-01-01 00:00:00 +0000 |
82 | +++ include/server/mir/shell/surface_configurator.h 2013-08-07 20:06:30 +0000 |
83 | @@ -0,0 +1,54 @@ |
84 | +/* |
85 | + * Copyright © 2013 Canonical Ltd. |
86 | + * |
87 | + * This program is free software: you can redistribute it and/or modify it |
88 | + * under the terms of the GNU General Public License version 3, |
89 | + * as published by the Free Software Foundation. |
90 | + * |
91 | + * This program is distributed in the hope that it will be useful, |
92 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
93 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
94 | + * GNU General Public License for more details. |
95 | + * |
96 | + * You should have received a copy of the GNU General Public License |
97 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
98 | + * |
99 | + * Authored by: Robert Carr <robert.carr@canonical.com> |
100 | + */ |
101 | + |
102 | +#ifndef MIR_SHELL_SURFACE_CONFIGURATOR_H_ |
103 | +#define MIR_SHELL_SURFACE_CONFIGURATOR_H_ |
104 | + |
105 | +#include "mir_toolkit/common.h" |
106 | + |
107 | +#include <memory> |
108 | + |
109 | +namespace mir |
110 | +{ |
111 | + |
112 | +namespace shell |
113 | +{ |
114 | +class Surface; |
115 | + |
116 | +class SurfaceConfigurator |
117 | +{ |
118 | +public: |
119 | + virtual ~SurfaceConfigurator() = default; |
120 | + |
121 | + /// Returns the selected value. |
122 | + virtual int select_attribute_value(Surface const& surface, MirSurfaceAttrib attrib, |
123 | + int requested_value) = 0; |
124 | + |
125 | + virtual void attribute_set(Surface const& surface, MirSurfaceAttrib attrib, |
126 | + int new_value) = 0; |
127 | + |
128 | +protected: |
129 | + SurfaceConfigurator() = default; |
130 | + SurfaceConfigurator(SurfaceConfigurator const&) = delete; |
131 | + SurfaceConfigurator& operator=(SurfaceConfigurator const&) = delete; |
132 | +}; |
133 | + |
134 | +} |
135 | +} // namespace mir |
136 | + |
137 | +#endif // MIR_SHELL_SURFACE_CONFIGURATOR_H_ |
138 | |
139 | === modified file 'include/server/mir/shell/surface_source.h' |
140 | --- include/server/mir/shell/surface_source.h 2013-08-01 06:55:26 +0000 |
141 | +++ include/server/mir/shell/surface_source.h 2013-08-07 20:06:30 +0000 |
142 | @@ -29,12 +29,13 @@ |
143 | namespace shell |
144 | { |
145 | class SurfaceBuilder; |
146 | -class SurfaceController; |
147 | +class SurfaceConfigurator; |
148 | |
149 | class SurfaceSource : public SurfaceFactory |
150 | { |
151 | public: |
152 | - SurfaceSource(std::shared_ptr<SurfaceBuilder> const& surface_builder); |
153 | + SurfaceSource(std::shared_ptr<SurfaceBuilder> const& surface_builder, |
154 | + std::shared_ptr<SurfaceConfigurator> const& surface_configurator); |
155 | virtual ~SurfaceSource() {} |
156 | |
157 | std::shared_ptr<Surface> create_surface( |
158 | @@ -48,6 +49,7 @@ |
159 | |
160 | private: |
161 | std::shared_ptr<SurfaceBuilder> const surface_builder; |
162 | + std::shared_ptr<SurfaceConfigurator> const surface_configurator; |
163 | }; |
164 | |
165 | } |
166 | |
167 | === modified file 'include/test/mir_test_doubles/mock_surface.h' |
168 | --- include/test/mir_test_doubles/mock_surface.h 2013-07-31 22:53:11 +0000 |
169 | +++ include/test/mir_test_doubles/mock_surface.h 2013-08-07 20:06:30 +0000 |
170 | @@ -23,6 +23,7 @@ |
171 | |
172 | #include "mir/shell/surface_creation_parameters.h" |
173 | #include "null_event_sink.h" |
174 | +#include "null_surface_configurator.h" |
175 | |
176 | #include <gmock/gmock.h> |
177 | |
178 | @@ -38,7 +39,8 @@ |
179 | struct MockSurface : public shell::Surface |
180 | { |
181 | MockSurface(std::shared_ptr<shell::SurfaceBuilder> const& builder) : |
182 | - shell::Surface(builder, shell::a_surface(), frontend::SurfaceId{}, std::make_shared<NullEventSink>()) |
183 | + shell::Surface(builder, std::make_shared<NullSurfaceConfigurator>(), shell::a_surface(), |
184 | + frontend::SurfaceId{}, std::make_shared<NullEventSink>()) |
185 | { |
186 | } |
187 | |
188 | |
189 | === added file 'include/test/mir_test_doubles/mock_surface_configurator.h' |
190 | --- include/test/mir_test_doubles/mock_surface_configurator.h 1970-01-01 00:00:00 +0000 |
191 | +++ include/test/mir_test_doubles/mock_surface_configurator.h 2013-08-07 20:06:30 +0000 |
192 | @@ -0,0 +1,43 @@ |
193 | +/* |
194 | + * Copyright © 2013 Canonical Ltd. |
195 | + * |
196 | + * This program is free software: you can redistribute it and/or modify it |
197 | + * under the terms of the GNU General Public License version 3, |
198 | + * as published by the Free Software Foundation. |
199 | + * |
200 | + * This program is distributed in the hope that it will be useful, |
201 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
202 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
203 | + * GNU General Public License for more details. |
204 | + * |
205 | + * You should have received a copy of the GNU General Public License |
206 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
207 | + * |
208 | + * Authored by: Robert Carr <robert.carr@canonical.com> |
209 | + */ |
210 | + |
211 | +#ifndef MIR_TEST_DOUBLES_MOCK_SURFACE_CONFIGURATOR_H_ |
212 | +#define MIR_TEST_DOUBLES_MOCK_SURFACE_CONFIGURATOR_H_ |
213 | + |
214 | +#include "mir/shell/surface_configurator.h" |
215 | + |
216 | +#include <gmock/gmock.h> |
217 | + |
218 | +namespace mir |
219 | +{ |
220 | +namespace test |
221 | +{ |
222 | +namespace doubles |
223 | +{ |
224 | + |
225 | +struct MockSurfaceConfigurator : public shell::SurfaceConfigurator |
226 | +{ |
227 | + MOCK_METHOD3(select_attribute_value, int(shell::Surface const&, MirSurfaceAttrib, int)); |
228 | + MOCK_METHOD3(attribute_set, void(shell::Surface const&, MirSurfaceAttrib, int)); |
229 | +}; |
230 | + |
231 | +} |
232 | +} |
233 | +} |
234 | + |
235 | +#endif /* MIR_TEST_DOUBLES_MOCK_SURFACE_CONFIGURATOR_H_ */ |
236 | |
237 | === added file 'include/test/mir_test_doubles/null_surface_configurator.h' |
238 | --- include/test/mir_test_doubles/null_surface_configurator.h 1970-01-01 00:00:00 +0000 |
239 | +++ include/test/mir_test_doubles/null_surface_configurator.h 2013-08-07 20:06:30 +0000 |
240 | @@ -0,0 +1,48 @@ |
241 | +/* |
242 | + * Copyright © 2013 Canonical Ltd. |
243 | + * |
244 | + * This program is free software: you can redistribute it and/or modify it |
245 | + * under the terms of the GNU General Public License version 3, |
246 | + * as published by the Free Software Foundation. |
247 | + * |
248 | + * This program is distributed in the hope that it will be useful, |
249 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
250 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
251 | + * GNU General Public License for more details. |
252 | + * |
253 | + * You should have received a copy of the GNU General Public License |
254 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
255 | + * |
256 | + * Authored by: Robert Carr <robert.carr@canonical.com> |
257 | + */ |
258 | + |
259 | +#ifndef MIR_TEST_DOUBLES_NULL_SURFACE_CONFIGURATOR_H_ |
260 | +#define MIR_TEST_DOUBLES_NULL_SURFACE_CONFIGURATOR_H_ |
261 | + |
262 | +#include "mir/shell/surface_configurator.h" |
263 | + |
264 | +namespace mir |
265 | +{ |
266 | +namespace test |
267 | +{ |
268 | +namespace doubles |
269 | +{ |
270 | + |
271 | +struct NullSurfaceConfigurator : public shell::SurfaceConfigurator |
272 | +{ |
273 | + int select_attribute_value(shell::Surface const&, |
274 | + MirSurfaceAttrib, int requested_value) |
275 | + { |
276 | + return requested_value; |
277 | + } |
278 | + void attribute_set(shell::Surface const&, |
279 | + MirSurfaceAttrib, int) |
280 | + { |
281 | + } |
282 | +}; |
283 | + |
284 | +} |
285 | +} |
286 | +} |
287 | + |
288 | +#endif /* MIR_TEST_DOUBLES_NULL_SURFACE_CONFIGURATOR_H_ */ |
289 | |
290 | === modified file 'src/server/default_server_configuration.cpp' |
291 | --- src/server/default_server_configuration.cpp 2013-08-06 10:39:53 +0000 |
292 | +++ src/server/default_server_configuration.cpp 2013-08-07 20:06:30 +0000 |
293 | @@ -44,6 +44,7 @@ |
294 | #include "mir/shell/organising_surface_factory.h" |
295 | #include "mir/shell/threaded_snapshot_strategy.h" |
296 | #include "mir/shell/graphics_display_layout.h" |
297 | +#include "mir/shell/surface_configurator.h" |
298 | #include "mir/graphics/cursor.h" |
299 | #include "mir/shell/null_session_listener.h" |
300 | #include "mir/graphics/display.h" |
301 | @@ -607,6 +608,25 @@ |
302 | }); |
303 | } |
304 | |
305 | +std::shared_ptr<msh::SurfaceConfigurator> mir::DefaultServerConfiguration::the_shell_surface_configurator() |
306 | +{ |
307 | + struct DefaultSurfaceConfigurator : public msh::SurfaceConfigurator |
308 | + { |
309 | + int select_attribute_value(msh::Surface const&, MirSurfaceAttrib, int requested_value) |
310 | + { |
311 | + return requested_value; |
312 | + } |
313 | + void attribute_set(msh::Surface const&, MirSurfaceAttrib, int) |
314 | + { |
315 | + } |
316 | + }; |
317 | + return shell_surface_configurator( |
318 | + [this]() |
319 | + { |
320 | + return std::make_shared<DefaultSurfaceConfigurator>(); |
321 | + }); |
322 | +} |
323 | + |
324 | std::shared_ptr<ms::SurfaceStackModel> |
325 | mir::DefaultServerConfiguration::the_surface_stack_model() |
326 | { |
327 | @@ -642,7 +662,7 @@ |
328 | [this]() |
329 | { |
330 | auto surface_source = std::make_shared<msh::SurfaceSource>( |
331 | - the_surface_builder()); |
332 | + the_surface_builder(), the_shell_surface_configurator()); |
333 | |
334 | return std::make_shared<msh::OrganisingSurfaceFactory>( |
335 | surface_source, |
336 | |
337 | === modified file 'src/server/shell/application_session.cpp' |
338 | --- src/server/shell/application_session.cpp 2013-07-31 22:53:11 +0000 |
339 | +++ src/server/shell/application_session.cpp 2013-08-07 20:06:30 +0000 |
340 | @@ -152,10 +152,10 @@ |
341 | |
342 | int msh::ApplicationSession::configure_surface(mf::SurfaceId id, |
343 | MirSurfaceAttrib attrib, |
344 | - int value) |
345 | + int requested_value) |
346 | { |
347 | std::unique_lock<std::mutex> lock(surfaces_mutex); |
348 | - std::shared_ptr<mf::Surface> surf(checked_find(id)->second); |
349 | + std::shared_ptr<msh::Surface> surf(checked_find(id)->second); |
350 | |
351 | - return surf->configure(attrib, value); |
352 | + return surf->configure(attrib, requested_value); |
353 | } |
354 | |
355 | === modified file 'src/server/shell/surface.cpp' |
356 | --- src/server/shell/surface.cpp 2013-07-31 22:53:11 +0000 |
357 | +++ src/server/shell/surface.cpp 2013-08-07 20:06:30 +0000 |
358 | @@ -18,6 +18,7 @@ |
359 | |
360 | #include "mir/shell/surface.h" |
361 | #include "mir/shell/surface_builder.h" |
362 | +#include "mir/shell/surface_configurator.h" |
363 | #include "mir/shell/surface_controller.h" |
364 | #include "mir/shell/input_targeter.h" |
365 | #include "mir/input/input_channel.h" |
366 | @@ -40,10 +41,12 @@ |
367 | |
368 | msh::Surface::Surface( |
369 | std::shared_ptr<SurfaceBuilder> const& builder, |
370 | + std::shared_ptr<SurfaceConfigurator> const& configurator, |
371 | shell::SurfaceCreationParameters const& params, |
372 | frontend::SurfaceId id, |
373 | std::shared_ptr<mf::EventSink> const& event_sink) |
374 | : builder(builder), |
375 | + configurator(configurator), |
376 | surface(builder->create_surface(params)), |
377 | id(id), |
378 | event_sink(event_sink), |
379 | @@ -223,6 +226,7 @@ |
380 | * TODO: In future, query the shell implementation for the subset of |
381 | * attributes/types it implements. |
382 | */ |
383 | + value = configurator->select_attribute_value(*this, attrib, value); |
384 | switch (attrib) |
385 | { |
386 | case mir_surface_attrib_type: |
387 | @@ -248,6 +252,8 @@ |
388 | break; |
389 | } |
390 | |
391 | + configurator->attribute_set(*this, attrib, result); |
392 | + |
393 | return result; |
394 | } |
395 | |
396 | |
397 | === modified file 'src/server/shell/surface_source.cpp' |
398 | --- src/server/shell/surface_source.cpp 2013-08-01 06:55:26 +0000 |
399 | +++ src/server/shell/surface_source.cpp 2013-08-07 20:06:30 +0000 |
400 | @@ -30,10 +30,13 @@ |
401 | namespace mf = mir::frontend; |
402 | |
403 | |
404 | -msh::SurfaceSource::SurfaceSource(std::shared_ptr<SurfaceBuilder> const& surface_builder) |
405 | - : surface_builder(surface_builder) |
406 | +msh::SurfaceSource::SurfaceSource(std::shared_ptr<SurfaceBuilder> const& surface_builder, |
407 | + std::shared_ptr<SurfaceConfigurator> const& surface_configurator) |
408 | + : surface_builder(surface_builder), |
409 | + surface_configurator(surface_configurator) |
410 | { |
411 | assert(surface_builder); |
412 | + assert(surface_configurator); |
413 | } |
414 | |
415 | std::shared_ptr<msh::Surface> msh::SurfaceSource::create_surface( |
416 | @@ -41,6 +44,6 @@ |
417 | frontend::SurfaceId id, |
418 | std::shared_ptr<mf::EventSink> const& sender) |
419 | { |
420 | - return std::make_shared<Surface>(surface_builder, params, id, sender); |
421 | + return std::make_shared<Surface>(surface_builder, surface_configurator, params, id, sender); |
422 | } |
423 | |
424 | |
425 | === modified file 'tests/acceptance-tests/CMakeLists.txt' |
426 | --- tests/acceptance-tests/CMakeLists.txt 2013-08-06 07:20:02 +0000 |
427 | +++ tests/acceptance-tests/CMakeLists.txt 2013-08-07 20:06:30 +0000 |
428 | @@ -11,6 +11,7 @@ |
429 | test_focus_selection.cpp |
430 | test_server_shutdown.cpp |
431 | test_client_authorization.cpp |
432 | + test_shell_control_of_surface_configuration.cpp |
433 | test_nested_mir.cpp |
434 | ) |
435 | |
436 | |
437 | === added file 'tests/acceptance-tests/test_shell_control_of_surface_configuration.cpp' |
438 | --- tests/acceptance-tests/test_shell_control_of_surface_configuration.cpp 1970-01-01 00:00:00 +0000 |
439 | +++ tests/acceptance-tests/test_shell_control_of_surface_configuration.cpp 2013-08-07 20:06:30 +0000 |
440 | @@ -0,0 +1,139 @@ |
441 | +/* |
442 | + * Copyright © 2013 Canonical Ltd. |
443 | + * |
444 | + * This program is free software: you can redistribute it and/or modify |
445 | + * it under the terms of the GNU General Public License version 3 as |
446 | + * published by the Free Software Foundation. |
447 | + * |
448 | + * This program is distributed in the hope that it will be useful, |
449 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
450 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
451 | + * GNU General Public License for more details. |
452 | + * |
453 | + * You should have received a copy of the GNU General Public License |
454 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
455 | + * |
456 | + * Authored by: Robert Carr <robert.carr@canonical.com> |
457 | + */ |
458 | + |
459 | +#include "mir/shell/surface_configurator.h" |
460 | +#include "mir/shell/surface.h" |
461 | + |
462 | +#include "mir_test/fake_shared.h" |
463 | +#include "mir_test_doubles/mock_surface_configurator.h" |
464 | +#include "mir_test_framework/display_server_test_fixture.h" |
465 | + |
466 | +#include "mir_toolkit/mir_client_library.h" |
467 | + |
468 | +#include <gtest/gtest.h> |
469 | +#include <gmock/gmock.h> |
470 | + |
471 | +namespace msh = mir::shell; |
472 | + |
473 | +namespace mt = mir::test; |
474 | +namespace mtd = mt::doubles; |
475 | +namespace mtf = mir_test_framework; |
476 | + |
477 | +namespace |
478 | +{ |
479 | + char const* const mir_test_socket = mtf::test_socket_file().c_str(); |
480 | +} |
481 | + |
482 | +namespace |
483 | +{ |
484 | + |
485 | +struct SurfaceCreatingClient : public mtf::TestingClientConfiguration |
486 | +{ |
487 | + void exec() override |
488 | + { |
489 | + connection = mir_connect_sync(mir_test_socket, __PRETTY_FUNCTION__); |
490 | + ASSERT_TRUE(connection != NULL); |
491 | + EXPECT_TRUE(mir_connection_is_valid(connection)); |
492 | + EXPECT_STREQ(mir_connection_get_error_message(connection), ""); |
493 | + |
494 | + MirSurfaceParameters const request_params = |
495 | + { |
496 | + __PRETTY_FUNCTION__, |
497 | + 640, 480, |
498 | + mir_pixel_format_abgr_8888, |
499 | + mir_buffer_usage_hardware |
500 | + }; |
501 | + |
502 | + surface = mir_connection_create_surface_sync(connection, |
503 | + &request_params); |
504 | + } |
505 | + |
506 | + MirConnection* connection; |
507 | + MirSurface* surface; |
508 | +}; |
509 | + |
510 | +} |
511 | + |
512 | +TEST_F(BespokeDisplayServerTestFixture, the_shell_surface_configurator_is_notified_of_attribute_changes) |
513 | +{ |
514 | + struct ServerConfiguration : TestingServerConfiguration |
515 | + { |
516 | + std::shared_ptr<msh::SurfaceConfigurator> the_shell_surface_configurator() override |
517 | + { |
518 | + return mt::fake_shared(mock_configurator); |
519 | + } |
520 | + |
521 | + void exec() override |
522 | + { |
523 | + using namespace ::testing; |
524 | + |
525 | + ON_CALL(mock_configurator, select_attribute_value(_, _, _)).WillByDefault(Return(mir_surface_type_freestyle)); |
526 | + EXPECT_CALL(mock_configurator, select_attribute_value(_, mir_surface_attrib_type, Eq(mir_surface_type_freestyle))).Times(1); |
527 | + EXPECT_CALL(mock_configurator, attribute_set(_, mir_surface_attrib_type, Eq(mir_surface_type_freestyle))).Times(1); |
528 | + } |
529 | + |
530 | + mtd::MockSurfaceConfigurator mock_configurator; |
531 | + } server_config; |
532 | + launch_server_process(server_config); |
533 | + |
534 | + struct ClientConfiguration : SurfaceCreatingClient |
535 | + { |
536 | + void exec() override |
537 | + { |
538 | + SurfaceCreatingClient::exec(); |
539 | + mir_wait_for(mir_surface_set_type(surface, |
540 | + mir_surface_type_freestyle)); |
541 | + EXPECT_EQ(mir_surface_type_freestyle, |
542 | + mir_surface_get_type(surface)); |
543 | + } |
544 | + } client_config; |
545 | + launch_client_process(client_config); |
546 | +} |
547 | + |
548 | +TEST_F(BespokeDisplayServerTestFixture, the_shell_surface_configurator_may_interfere_with_attribute_changes) |
549 | +{ |
550 | + struct ServerConfiguration : TestingServerConfiguration |
551 | + { |
552 | + std::shared_ptr<msh::SurfaceConfigurator> the_shell_surface_configurator() override |
553 | + { |
554 | + return mt::fake_shared(mock_configurator); |
555 | + } |
556 | + void exec() override |
557 | + { |
558 | + using namespace ::testing; |
559 | + EXPECT_CALL(mock_configurator, select_attribute_value(_, mir_surface_attrib_type, Eq(mir_surface_type_freestyle))).Times(1) |
560 | + .WillOnce(Return(mir_surface_type_normal)); |
561 | + EXPECT_CALL(mock_configurator, attribute_set(_, mir_surface_attrib_type, Eq(mir_surface_type_normal))).Times(1); |
562 | + } |
563 | + mtd::MockSurfaceConfigurator mock_configurator; |
564 | + } server_config; |
565 | + launch_server_process(server_config); |
566 | + |
567 | + struct ClientConfiguration : SurfaceCreatingClient |
568 | + { |
569 | + void exec() override |
570 | + { |
571 | + SurfaceCreatingClient::exec(); |
572 | + mir_wait_for(mir_surface_set_type(surface, |
573 | + mir_surface_type_freestyle)); |
574 | + EXPECT_EQ(mir_surface_type_normal, |
575 | + mir_surface_get_type(surface)); |
576 | + } |
577 | + } client_config; |
578 | + launch_client_process(client_config); |
579 | +} |
580 | |
581 | === modified file 'tests/integration-tests/graphics/android/test_internal_client.cpp' |
582 | --- tests/integration-tests/graphics/android/test_internal_client.cpp 2013-08-02 03:13:38 +0000 |
583 | +++ tests/integration-tests/graphics/android/test_internal_client.cpp 2013-08-07 20:06:30 +0000 |
584 | @@ -39,6 +39,7 @@ |
585 | #include "mir/options/program_option.h" |
586 | |
587 | #include "mir_test_doubles/stub_input_registrar.h" |
588 | +#include "mir_test_doubles/null_surface_configurator.h" |
589 | |
590 | #include <EGL/egl.h> |
591 | #include <gtest/gtest.h> |
592 | @@ -110,7 +111,7 @@ |
593 | auto surface_allocator = std::make_shared<ms::SurfaceAllocator>(buffer_stream_factory, stub_input_factory); |
594 | auto ss = std::make_shared<ms::SurfaceStack>(surface_allocator, stub_input_registrar); |
595 | auto surface_controller = std::make_shared<ms::SurfaceController>(ss); |
596 | - auto surface_source = std::make_shared<msh::SurfaceSource>(surface_controller); |
597 | + auto surface_source = std::make_shared<msh::SurfaceSource>(surface_controller, std::make_shared<mtd::NullSurfaceConfigurator>()); |
598 | auto mir_surface = std::make_shared<ForwardingInternalSurface>( |
599 | surface_source->create_surface(params, id, std::shared_ptr<mf::EventSink>())); |
600 | |
601 | |
602 | === modified file 'tests/unit-tests/shell/test_application_session.cpp' |
603 | --- tests/unit-tests/shell/test_application_session.cpp 2013-07-31 22:53:11 +0000 |
604 | +++ tests/unit-tests/shell/test_application_session.cpp 2013-08-07 20:06:30 +0000 |
605 | @@ -72,7 +72,8 @@ |
606 | |
607 | msh::ApplicationSession session(mt::fake_shared(surface_factory), "Foo", |
608 | std::make_shared<mtd::NullSnapshotStrategy>(), |
609 | - mt::fake_shared(listener), mt::fake_shared(sender)); |
610 | + mt::fake_shared(listener), |
611 | + mt::fake_shared(sender)); |
612 | |
613 | msh::SurfaceCreationParameters params; |
614 | auto surf = session.create_surface(params); |
615 | |
616 | === modified file 'tests/unit-tests/shell/test_session_manager.cpp' |
617 | --- tests/unit-tests/shell/test_session_manager.cpp 2013-07-31 22:53:11 +0000 |
618 | +++ tests/unit-tests/shell/test_session_manager.cpp 2013-08-07 20:06:30 +0000 |
619 | @@ -35,6 +35,7 @@ |
620 | #include "mir_test_doubles/stub_surface_builder.h" |
621 | #include "mir_test_doubles/stub_surface_controller.h" |
622 | #include "mir_test_doubles/null_snapshot_strategy.h" |
623 | +#include "mir_test_doubles/null_surface_configurator.h" |
624 | |
625 | #include <gmock/gmock.h> |
626 | #include <gtest/gtest.h> |
627 | @@ -113,7 +114,7 @@ |
628 | |
629 | ON_CALL(surface_factory, create_surface(_, _, _)).WillByDefault( |
630 | Return(std::make_shared<msh::Surface>( |
631 | - mt::fake_shared(surface_builder), |
632 | + mt::fake_shared(surface_builder), std::make_shared<mtd::NullSurfaceConfigurator>(), |
633 | msh::a_surface(),mf::SurfaceId{}, std::shared_ptr<mf::EventSink>()))); |
634 | |
635 | |
636 | @@ -148,7 +149,7 @@ |
637 | using namespace ::testing; |
638 | ON_CALL(surface_factory, create_surface(_, _, _)).WillByDefault( |
639 | Return(std::make_shared<msh::Surface>( |
640 | - mt::fake_shared(surface_builder), |
641 | + mt::fake_shared(surface_builder), std::make_shared<mtd::NullSurfaceConfigurator>(), |
642 | msh::a_surface(),mf::SurfaceId{}, std::shared_ptr<mf::EventSink>()))); |
643 | |
644 | // Once for session creation and once for surface creation |
645 | |
646 | === modified file 'tests/unit-tests/shell/test_surface.cpp' |
647 | --- tests/unit-tests/shell/test_surface.cpp 2013-07-31 22:53:11 +0000 |
648 | +++ tests/unit-tests/shell/test_surface.cpp 2013-08-07 20:06:30 +0000 |
649 | @@ -32,6 +32,8 @@ |
650 | #include "mir_test_doubles/stub_input_targeter.h" |
651 | #include "mir_test_doubles/null_event_sink.h" |
652 | #include "mir_test_doubles/mock_surface_state.h" |
653 | +#include "mir_test_doubles/null_surface_configurator.h" |
654 | +#include "mir_test_doubles/mock_surface_configurator.h" |
655 | #include "mir_test/fake_shared.h" |
656 | |
657 | #include <stdexcept> |
658 | @@ -143,7 +145,7 @@ |
659 | EXPECT_CALL(surface_builder, destroy_surface(_)).Times(1); |
660 | |
661 | msh::Surface test( |
662 | - mt::fake_shared(surface_builder), |
663 | + mt::fake_shared(surface_builder), std::make_shared<mtd::NullSurfaceConfigurator>(), |
664 | params, stub_id, stub_sender); |
665 | } |
666 | |
667 | @@ -161,7 +163,7 @@ |
668 | |
669 | EXPECT_THROW({ |
670 | msh::Surface test( |
671 | - mt::fake_shared(surface_builder), |
672 | + mt::fake_shared(surface_builder), std::make_shared<mtd::NullSurfaceConfigurator>(), |
673 | params, stub_id, stub_sender); |
674 | }, std::runtime_error); |
675 | } |
676 | @@ -176,7 +178,7 @@ |
677 | EXPECT_CALL(surface_builder, destroy_surface(_)).Times(0); |
678 | |
679 | msh::Surface test( |
680 | - mt::fake_shared(surface_builder), |
681 | + mt::fake_shared(surface_builder), std::make_shared<mtd::NullSurfaceConfigurator>(), |
682 | msh::a_surface(), stub_id, stub_sender); |
683 | |
684 | Mock::VerifyAndClearExpectations(&test); |
685 | @@ -192,7 +194,7 @@ |
686 | TEST_F(ShellSurface, size_throw_behavior) |
687 | { |
688 | msh::Surface test( |
689 | - mt::fake_shared(surface_builder), |
690 | + mt::fake_shared(surface_builder), std::make_shared<mtd::NullSurfaceConfigurator>(), |
691 | msh::a_surface(), stub_id, stub_sender); |
692 | |
693 | EXPECT_NO_THROW({ |
694 | @@ -209,7 +211,7 @@ |
695 | TEST_F(ShellSurface, top_left_throw_behavior) |
696 | { |
697 | msh::Surface test( |
698 | - mt::fake_shared(surface_builder), |
699 | + mt::fake_shared(surface_builder), std::make_shared<mtd::NullSurfaceConfigurator>(), |
700 | msh::a_surface(), stub_id, stub_sender); |
701 | |
702 | EXPECT_NO_THROW({ |
703 | @@ -226,7 +228,7 @@ |
704 | TEST_F(ShellSurface, name_throw_behavior) |
705 | { |
706 | msh::Surface test( |
707 | - mt::fake_shared(surface_builder), |
708 | + mt::fake_shared(surface_builder), std::make_shared<mtd::NullSurfaceConfigurator>(), |
709 | msh::a_surface(), stub_id, stub_sender); |
710 | |
711 | EXPECT_NO_THROW({ |
712 | @@ -243,7 +245,7 @@ |
713 | TEST_F(ShellSurface, pixel_format_throw_behavior) |
714 | { |
715 | msh::Surface test( |
716 | - mt::fake_shared(surface_builder), |
717 | + mt::fake_shared(surface_builder), std::make_shared<mtd::NullSurfaceConfigurator>(), |
718 | msh::a_surface(), stub_id, stub_sender); |
719 | |
720 | EXPECT_NO_THROW({ |
721 | @@ -260,7 +262,7 @@ |
722 | TEST_F(ShellSurface, hide_throw_behavior) |
723 | { |
724 | msh::Surface test( |
725 | - mt::fake_shared(surface_builder), |
726 | + mt::fake_shared(surface_builder), std::make_shared<mtd::NullSurfaceConfigurator>(), |
727 | msh::a_surface(), stub_id, stub_sender); |
728 | |
729 | EXPECT_NO_THROW({ |
730 | @@ -277,7 +279,7 @@ |
731 | TEST_F(ShellSurface, show_throw_behavior) |
732 | { |
733 | msh::Surface test( |
734 | - mt::fake_shared(surface_builder), |
735 | + mt::fake_shared(surface_builder), std::make_shared<mtd::NullSurfaceConfigurator>(), |
736 | msh::a_surface(), stub_id, stub_sender); |
737 | |
738 | EXPECT_NO_THROW({ |
739 | @@ -294,7 +296,7 @@ |
740 | TEST_F(ShellSurface, destroy_throw_behavior) |
741 | { |
742 | msh::Surface test( |
743 | - mt::fake_shared(surface_builder), |
744 | + mt::fake_shared(surface_builder), std::make_shared<mtd::NullSurfaceConfigurator>(), |
745 | msh::a_surface(), stub_id, stub_sender); |
746 | |
747 | EXPECT_NO_THROW({ |
748 | @@ -311,7 +313,7 @@ |
749 | TEST_F(ShellSurface, force_request_to_complete_throw_behavior) |
750 | { |
751 | msh::Surface test( |
752 | - mt::fake_shared(surface_builder), |
753 | + mt::fake_shared(surface_builder), std::make_shared<mtd::NullSurfaceConfigurator>(), |
754 | msh::a_surface(), stub_id, stub_sender); |
755 | |
756 | EXPECT_NO_THROW({ |
757 | @@ -328,7 +330,7 @@ |
758 | TEST_F(ShellSurface, advance_client_buffer_throw_behavior) |
759 | { |
760 | msh::Surface test( |
761 | - mt::fake_shared(surface_builder), |
762 | + mt::fake_shared(surface_builder), std::make_shared<mtd::NullSurfaceConfigurator>(), |
763 | msh::a_surface(), stub_id, stub_sender); |
764 | |
765 | EXPECT_NO_THROW({ |
766 | @@ -345,7 +347,7 @@ |
767 | TEST_F(ShellSurface, input_fds_throw_behavior) |
768 | { |
769 | msh::Surface test( |
770 | - mt::fake_shared(surface_builder), |
771 | + mt::fake_shared(surface_builder), std::make_shared<mtd::NullSurfaceConfigurator>(), |
772 | msh::a_surface(), stub_id, stub_sender); |
773 | |
774 | surface_builder.reset_surface(); |
775 | @@ -360,7 +362,7 @@ |
776 | using namespace testing; |
777 | |
778 | msh::Surface surf( |
779 | - mt::fake_shared(surface_builder), |
780 | + mt::fake_shared(surface_builder), std::make_shared<mtd::NullSurfaceConfigurator>(), |
781 | msh::a_surface(), stub_id, stub_sender); |
782 | |
783 | EXPECT_THROW({ |
784 | @@ -373,8 +375,8 @@ |
785 | using namespace testing; |
786 | |
787 | msh::Surface surf( |
788 | - mt::fake_shared(surface_builder), |
789 | - msh::a_surface(), stub_id, stub_sender); |
790 | + mt::fake_shared(surface_builder), std::make_shared<mtd::NullSurfaceConfigurator>(), |
791 | + msh::a_surface(), stub_id, stub_sender); |
792 | |
793 | EXPECT_EQ(mir_surface_type_normal, surf.type()); |
794 | |
795 | @@ -407,7 +409,7 @@ |
796 | using namespace testing; |
797 | |
798 | msh::Surface surf( |
799 | - mt::fake_shared(surface_builder), |
800 | + mt::fake_shared(surface_builder), std::make_shared<mtd::NullSurfaceConfigurator>(), |
801 | msh::a_surface(), stub_id, stub_sender); |
802 | |
803 | EXPECT_EQ(mir_surface_state_restored, surf.state()); |
804 | @@ -436,12 +438,29 @@ |
805 | EXPECT_EQ(mir_surface_state_fullscreen, surf.state()); |
806 | } |
807 | |
808 | +TEST_F(ShellSurface, configurator_selects_attribute_values) |
809 | +{ |
810 | + using namespace testing; |
811 | + |
812 | + mtd::MockSurfaceConfigurator configurator; |
813 | + |
814 | + EXPECT_CALL(configurator, select_attribute_value(_, mir_surface_attrib_state, mir_surface_state_restored)).Times(1) |
815 | + .WillOnce(Return(mir_surface_state_minimized)); |
816 | + EXPECT_CALL(configurator, attribute_set(_, mir_surface_attrib_state, mir_surface_state_minimized)).Times(1); |
817 | + |
818 | + msh::Surface surf( |
819 | + mt::fake_shared(surface_builder), mt::fake_shared(configurator), |
820 | + msh::a_surface(), stub_id, stub_sender); |
821 | + |
822 | + EXPECT_EQ(mir_surface_state_minimized, surf.configure(mir_surface_attrib_state, mir_surface_state_restored)); |
823 | +} |
824 | + |
825 | TEST_F(ShellSurface, take_input_focus) |
826 | { |
827 | using namespace ::testing; |
828 | |
829 | msh::Surface test( |
830 | - mt::fake_shared(surface_builder), |
831 | + mt::fake_shared(surface_builder), std::make_shared<mtd::NullSurfaceConfigurator>(), |
832 | msh::a_surface(), stub_id, stub_sender); |
833 | |
834 | mtd::MockInputTargeter targeter; |
835 | @@ -455,7 +474,7 @@ |
836 | using namespace ::testing; |
837 | |
838 | msh::Surface test( |
839 | - mt::fake_shared(surface_builder), |
840 | + mt::fake_shared(surface_builder), std::make_shared<mtd::NullSurfaceConfigurator>(), |
841 | msh::a_surface(), stub_id, stub_sender); |
842 | surface_builder.reset_surface(); |
843 | |
844 | @@ -471,7 +490,7 @@ |
845 | using namespace ::testing; |
846 | |
847 | msh::Surface test( |
848 | - mt::fake_shared(surface_builder), |
849 | + mt::fake_shared(surface_builder), std::make_shared<mtd::NullSurfaceConfigurator>(), |
850 | msh::a_surface(), stub_id, stub_sender); |
851 | |
852 | EXPECT_NO_THROW({ |
853 | @@ -488,7 +507,7 @@ |
854 | TEST_F(ShellSurface, with_most_recent_buffer_do_uses_compositor_buffer) |
855 | { |
856 | msh::Surface test( |
857 | - mt::fake_shared(surface_builder), |
858 | + mt::fake_shared(surface_builder), std::make_shared<mtd::NullSurfaceConfigurator>(), |
859 | msh::a_surface(), stub_id, stub_sender); |
860 | |
861 | mg::Buffer* buf_ptr{nullptr}; |
862 | @@ -509,7 +528,7 @@ |
863 | |
864 | mtd::MockSurfaceController surface_controller; |
865 | msh::Surface test( |
866 | - mt::fake_shared(surface_builder), |
867 | + mt::fake_shared(surface_builder), std::make_shared<mtd::NullSurfaceConfigurator>(), |
868 | msh::a_surface(), stub_id, stub_sender); |
869 | |
870 | EXPECT_CALL(surface_controller, raise(_)).Times(1); |
This...already has 8 conflicts with trunk :(