Merge lp:~afrantzis/mir/client-close-event into lp:mir
- client-close-event
- Merge into development-branch
Status: | Merged |
---|---|
Approved by: | Alberto Aguirre |
Approved revision: | no longer in the source branch. |
Merged at revision: | 2108 |
Proposed branch: | lp:~afrantzis/mir/client-close-event |
Merge into: | lp:mir |
Diff against target: |
477 lines (+135/-13) 25 files modified
client-ABI-sha1sums (+1/-1) common-ABI-sha1sums (+1/-1) debian/control (+2/-2) debian/libmirserver28.install (+1/-1) include/common/mir_toolkit/event.h (+10/-1) include/server/mir/scene/null_surface_observer.h (+1/-0) include/server/mir/scene/surface.h (+2/-0) include/server/mir/scene/surface_observer.h (+1/-0) platform-ABI-sha1sums (+1/-1) server-ABI-sha1sums (+4/-4) src/client/rpc/mir_protobuf_rpc_channel.cpp (+4/-0) src/include/server/mir/scene/surface_event_source.h (+1/-0) src/server/CMakeLists.txt (+1/-1) src/server/input/cursor_controller.cpp (+4/-0) src/server/scene/basic_surface.cpp (+10/-0) src/server/scene/basic_surface.h (+3/-0) src/server/scene/legacy_surface_change_notification.cpp (+5/-0) src/server/scene/legacy_surface_change_notification.h (+1/-0) src/server/scene/null_surface_observer.cpp (+1/-0) src/server/scene/surface_event_source.cpp (+11/-0) src/server/symbols.map (+5/-1) tests/acceptance-tests/test_client_surface_events.cpp (+14/-0) tests/include/mir_test_doubles/stub_scene_surface.h (+2/-0) tests/unit-tests/scene/test_basic_surface.cpp (+19/-0) tests/unit-tests/scene/test_surface_impl.cpp (+30/-0) |
To merge this branch: | bzr merge lp:~afrantzis/mir/client-close-event |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alberto Aguirre (community) | Approve | ||
Cemil Azizoglu (community) | Approve | ||
PS Jenkins bot (community) | continuous-integration | Approve | |
Alan Griffiths | Approve | ||
Gerry Boland | functionality | Pending | |
Review via email: mp+242773@code.launchpad.net |
Commit message
Add client surface close event
Description of the change
Add client surface close event
This MP updates the server ABI. The client ABI doesn't need updating, because the MirInputEvent struct in the MirEvent union is large (~1KiB), so the addition of the MirCloseEvent doesn't affect the MirEvent size. abi-check verified that no incompatibility was introduced to mircommon/
PS Jenkins bot (ps-jenkins) wrote : | # |
Alan Griffiths (alan-griffiths) wrote : | # |
475 + EXPECT_CALL(*sink, handle_event(e))
476 + .Times(1);
I'd prefer a line break before the "E" to the one before the "."
Alexandros Frantzis (afrantzis) wrote : | # |
> 475 + EXPECT_CALL(*sink, handle_event(e))
> 476 + .Times(1);
>
> I'd prefer a line break before the "E" to the one before the "."
Fixed.
Cemil Azizoglu (cemil-azizoglu) wrote : | # |
63 + mir_event_
85 + MirCloseEvent close;
We want to be more specific about what is being closed ("close_window", or "close_surface") in case other "close" events are added in the future.
97 + void client_
110 + virtual void request_
"Client close" gives you the impression that the entire client (process) is being closed, which is not the case. Perhaps something like "client_
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2104
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Alexandros Frantzis (afrantzis) wrote : | # |
> 63 + mir_event_
> 85 + MirCloseEvent close;
>
> We want to be more specific about what is being closed ("close_window", or "close_surface") in
> case other "close" events are added in the future.
Fixed, although this naming change introduces a slight inconsistency: we could also say that other events like MirOrientationE
MirSurfaceEvent const* mir_event_
MirOrientationS
MirCloseSurface
MirOrientation mir_orientation
etc
> 97 + void client_
> 110 + virtual void request_
>
> "Client close" gives you the impression that the entire client (process) is being closed, which
> is not the case. Perhaps something like "client_
Changed.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2105
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Cemil Azizoglu (cemil-azizoglu) wrote : | # |
Looks good.
Preview Diff
1 | === modified file 'client-ABI-sha1sums' |
2 | --- client-ABI-sha1sums 2014-11-25 02:34:24 +0000 |
3 | +++ client-ABI-sha1sums 2014-11-26 11:09:30 +0000 |
4 | @@ -11,6 +11,6 @@ |
5 | 1863a7fe3a382061f2752c0236cc971e7e68f93f include/common/mir_toolkit/client_types.h |
6 | 2100c0674d9d882c1845550847357f6a5de5af66 include/common/mir_toolkit/common.h |
7 | fce4c1a9e0d037244f7e9e96ea2d8eaab4fc404c include/common/mir_toolkit/cursors.h |
8 | -bdaceadd56e41d2cb708f7c4da97acf84dfc75b7 include/common/mir_toolkit/event.h |
9 | +bccde9cdbc2f0d07e186c2950ef88d3a7d5f0d3b include/common/mir_toolkit/event.h |
10 | 4975998aa1056ed0d39dcc538127453e516ad8e9 include/common/mir_toolkit/mesa/native_display.h |
11 | 101017c17714a57db57d79b7b5e7df40a3568236 include/common/mir_toolkit/mir_native_buffer.h |
12 | |
13 | === modified file 'common-ABI-sha1sums' |
14 | --- common-ABI-sha1sums 2014-11-25 02:34:24 +0000 |
15 | +++ common-ABI-sha1sums 2014-11-26 11:09:30 +0000 |
16 | @@ -17,6 +17,6 @@ |
17 | 1863a7fe3a382061f2752c0236cc971e7e68f93f include/common/mir_toolkit/client_types.h |
18 | 2100c0674d9d882c1845550847357f6a5de5af66 include/common/mir_toolkit/common.h |
19 | fce4c1a9e0d037244f7e9e96ea2d8eaab4fc404c include/common/mir_toolkit/cursors.h |
20 | -bdaceadd56e41d2cb708f7c4da97acf84dfc75b7 include/common/mir_toolkit/event.h |
21 | +bccde9cdbc2f0d07e186c2950ef88d3a7d5f0d3b include/common/mir_toolkit/event.h |
22 | 4975998aa1056ed0d39dcc538127453e516ad8e9 include/common/mir_toolkit/mesa/native_display.h |
23 | 101017c17714a57db57d79b7b5e7df40a3568236 include/common/mir_toolkit/mir_native_buffer.h |
24 | |
25 | === modified file 'debian/control' |
26 | --- debian/control 2014-11-25 15:22:15 +0000 |
27 | +++ debian/control 2014-11-26 11:09:30 +0000 |
28 | @@ -60,7 +60,7 @@ |
29 | Contains the shared library containing the Google Protobuf definitions |
30 | required for Mir clients and servers. |
31 | |
32 | -Package: libmirserver27 |
33 | +Package: libmirserver28 |
34 | Section: libs |
35 | Architecture: i386 amd64 armhf arm64 |
36 | Multi-Arch: same |
37 | @@ -126,7 +126,7 @@ |
38 | Architecture: i386 amd64 armhf arm64 |
39 | Multi-Arch: same |
40 | Pre-Depends: ${misc:Pre-Depends} |
41 | -Depends: libmirserver27 (= ${binary:Version}), |
42 | +Depends: libmirserver28 (= ${binary:Version}), |
43 | libmirplatform-dev (= ${binary:Version}), |
44 | libmircommon-dev (= ${binary:Version}), |
45 | libglm-dev, |
46 | |
47 | === renamed file 'debian/libmirserver27.install' => 'debian/libmirserver28.install' |
48 | --- debian/libmirserver27.install 2014-11-03 02:35:50 +0000 |
49 | +++ debian/libmirserver28.install 2014-11-26 11:09:30 +0000 |
50 | @@ -1,1 +1,1 @@ |
51 | -usr/lib/*/libmirserver.so.27 |
52 | +usr/lib/*/libmirserver.so.28 |
53 | |
54 | === modified file 'include/common/mir_toolkit/event.h' |
55 | --- include/common/mir_toolkit/event.h 2014-10-29 06:21:10 +0000 |
56 | +++ include/common/mir_toolkit/event.h 2014-11-26 11:09:30 +0000 |
57 | @@ -42,7 +42,8 @@ |
58 | mir_event_type_surface, |
59 | mir_event_type_resize, |
60 | mir_event_type_prompt_session_state_change, |
61 | - mir_event_type_orientation |
62 | + mir_event_type_orientation, |
63 | + mir_event_type_close_surface |
64 | } MirEventType; |
65 | |
66 | typedef enum { |
67 | @@ -224,6 +225,13 @@ |
68 | MirOrientation direction; |
69 | } MirOrientationEvent; |
70 | |
71 | +typedef struct MirCloseSurfaceEvent |
72 | +{ |
73 | + MirEventType type; |
74 | + |
75 | + int surface_id; |
76 | +} MirCloseSurfaceEvent; |
77 | + |
78 | typedef union |
79 | { |
80 | MirEventType type; |
81 | @@ -233,6 +241,7 @@ |
82 | MirResizeEvent resize; |
83 | MirPromptSessionEvent prompt_session; |
84 | MirOrientationEvent orientation; |
85 | + MirCloseSurfaceEvent close_surface; |
86 | } MirEvent; |
87 | |
88 | #ifdef __cplusplus |
89 | |
90 | === modified file 'include/server/mir/scene/null_surface_observer.h' |
91 | --- include/server/mir/scene/null_surface_observer.h 2014-11-05 03:25:04 +0000 |
92 | +++ include/server/mir/scene/null_surface_observer.h 2014-11-26 11:09:30 +0000 |
93 | @@ -41,6 +41,7 @@ |
94 | void transformation_set_to(glm::mat4 const& t) override; |
95 | void cursor_image_set_to(graphics::CursorImage const& image) override; |
96 | void reception_mode_set_to(input::InputReceptionMode mode) override; |
97 | + void client_surface_close_requested() override; |
98 | |
99 | protected: |
100 | NullSurfaceObserver(NullSurfaceObserver const&) = delete; |
101 | |
102 | === modified file 'include/server/mir/scene/surface.h' |
103 | --- include/server/mir/scene/surface.h 2014-11-05 03:25:04 +0000 |
104 | +++ include/server/mir/scene/surface.h 2014-11-26 11:09:30 +0000 |
105 | @@ -95,6 +95,8 @@ |
106 | // TODO from the scene and is probably not cleanest interface for this. |
107 | virtual std::shared_ptr<input::InputChannel> input_channel() const override = 0; |
108 | virtual void set_reception_mode(input::InputReceptionMode mode) = 0; |
109 | + |
110 | + virtual void request_client_surface_close() = 0; |
111 | }; |
112 | } |
113 | } |
114 | |
115 | === modified file 'include/server/mir/scene/surface_observer.h' |
116 | --- include/server/mir/scene/surface_observer.h 2014-10-29 06:21:10 +0000 |
117 | +++ include/server/mir/scene/surface_observer.h 2014-11-26 11:09:30 +0000 |
118 | @@ -52,6 +52,7 @@ |
119 | virtual void transformation_set_to(glm::mat4 const& t) = 0; |
120 | virtual void reception_mode_set_to(input::InputReceptionMode mode) = 0; |
121 | virtual void cursor_image_set_to(graphics::CursorImage const& image) = 0; |
122 | + virtual void client_surface_close_requested() = 0; |
123 | |
124 | protected: |
125 | SurfaceObserver() = default; |
126 | |
127 | === modified file 'platform-ABI-sha1sums' |
128 | --- platform-ABI-sha1sums 2014-11-25 02:34:24 +0000 |
129 | +++ platform-ABI-sha1sums 2014-11-26 11:09:30 +0000 |
130 | @@ -17,7 +17,7 @@ |
131 | 1863a7fe3a382061f2752c0236cc971e7e68f93f include/common/mir_toolkit/client_types.h |
132 | 2100c0674d9d882c1845550847357f6a5de5af66 include/common/mir_toolkit/common.h |
133 | fce4c1a9e0d037244f7e9e96ea2d8eaab4fc404c include/common/mir_toolkit/cursors.h |
134 | -bdaceadd56e41d2cb708f7c4da97acf84dfc75b7 include/common/mir_toolkit/event.h |
135 | +bccde9cdbc2f0d07e186c2950ef88d3a7d5f0d3b include/common/mir_toolkit/event.h |
136 | 4975998aa1056ed0d39dcc538127453e516ad8e9 include/common/mir_toolkit/mesa/native_display.h |
137 | 101017c17714a57db57d79b7b5e7df40a3568236 include/common/mir_toolkit/mir_native_buffer.h |
138 | 871e609c0fed0d566ddbaaa8ac2d7cd5c06dd09a include/platform/mir/abnormal_exit.h |
139 | |
140 | === modified file 'server-ABI-sha1sums' |
141 | --- server-ABI-sha1sums 2014-11-25 02:34:24 +0000 |
142 | +++ server-ABI-sha1sums 2014-11-26 11:09:30 +0000 |
143 | @@ -17,7 +17,7 @@ |
144 | 1863a7fe3a382061f2752c0236cc971e7e68f93f include/common/mir_toolkit/client_types.h |
145 | 2100c0674d9d882c1845550847357f6a5de5af66 include/common/mir_toolkit/common.h |
146 | fce4c1a9e0d037244f7e9e96ea2d8eaab4fc404c include/common/mir_toolkit/cursors.h |
147 | -bdaceadd56e41d2cb708f7c4da97acf84dfc75b7 include/common/mir_toolkit/event.h |
148 | +bccde9cdbc2f0d07e186c2950ef88d3a7d5f0d3b include/common/mir_toolkit/event.h |
149 | 4975998aa1056ed0d39dcc538127453e516ad8e9 include/common/mir_toolkit/mesa/native_display.h |
150 | 101017c17714a57db57d79b7b5e7df40a3568236 include/common/mir_toolkit/mir_native_buffer.h |
151 | 871e609c0fed0d566ddbaaa8ac2d7cd5c06dd09a include/platform/mir/abnormal_exit.h |
152 | @@ -84,7 +84,7 @@ |
153 | c9de8b851fb22092a9a486d71cd998b4cb8392e1 include/server/mir/scene/coordinate_translator.h |
154 | 71d9082681aa39d652c88ad3b54665695b521d24 include/server/mir/scene/depth_id.h |
155 | cacb23805002e87fc6c4cb3e28bc77e800854cf1 include/server/mir/scene/null_session_listener.h |
156 | -2584482306208ef2c70b238b4732089551f48937 include/server/mir/scene/null_surface_observer.h |
157 | +10ec016e1268c8bd245ab03ac148ceb4361f81c2 include/server/mir/scene/null_surface_observer.h |
158 | d5273f3363b0b776427d5e3f1af99f0f2bcf3fa6 include/server/mir/scene/observer.h |
159 | 10db25fbaefcabb3b191177ed70f5972df7f05f0 include/server/mir/scene/placement_strategy.h |
160 | 74f7f66ffc3e15c428082fb961e748cb4f39dafc include/server/mir/scene/prompt_session_creation_parameters.h |
161 | @@ -99,8 +99,8 @@ |
162 | bbc9e2e2bb71634cd6f1c5c0430093e10e74fa23 include/server/mir/scene/surface_configurator.h |
163 | e5e4dd7bcaf186810043fa0f05be42d7e49b0843 include/server/mir/scene/surface_coordinator.h |
164 | dd8f054f786b9746d9e513f2656e931234b5283a include/server/mir/scene/surface_creation_parameters.h |
165 | -6b53424c5a813e80c29952284cda1c20bd2854c2 include/server/mir/scene/surface.h |
166 | -993e9f458ffc4288d304413f3fa0b1dcc95a093d include/server/mir/scene/surface_observer.h |
167 | +24d59fc6f0245769f607d93b41a8d5e6cf9949b4 include/server/mir/scene/surface.h |
168 | +587e22d751656ce2d9536afdf5659276ff9bbc46 include/server/mir/scene/surface_observer.h |
169 | 7ef3e99901168cda296d74d05a979f47bf9c3ff1 include/server/mir/server_action_queue.h |
170 | 8d83a51c278b8b71866d2178d9b6387c1f91a7d0 include/server/mir/server_configuration.h |
171 | 21b13d7b44094f4d5d3f131993bfc6770bc874eb include/server/mir/server.h |
172 | |
173 | === modified file 'src/client/rpc/mir_protobuf_rpc_channel.cpp' |
174 | --- src/client/rpc/mir_protobuf_rpc_channel.cpp 2014-10-29 06:21:10 +0000 |
175 | +++ src/client/rpc/mir_protobuf_rpc_channel.cpp 2014-11-26 11:09:30 +0000 |
176 | @@ -265,6 +265,10 @@ |
177 | surface_map->with_surface_do(e.orientation.surface_id, send_e); |
178 | break; |
179 | |
180 | + case mir_event_type_close_surface: |
181 | + surface_map->with_surface_do(e.close_surface.surface_id, send_e); |
182 | + break; |
183 | + |
184 | default: |
185 | event_sink->handle_event(e); |
186 | } |
187 | |
188 | === modified file 'src/include/server/mir/scene/surface_event_source.h' |
189 | --- src/include/server/mir/scene/surface_event_source.h 2014-10-29 06:21:10 +0000 |
190 | +++ src/include/server/mir/scene/surface_event_source.h 2014-11-26 11:09:30 +0000 |
191 | @@ -39,6 +39,7 @@ |
192 | void attrib_changed(MirSurfaceAttrib attrib, int value) override; |
193 | void resized_to(geometry::Size const& size) override; |
194 | void orientation_set_to(MirOrientation orientation) override; |
195 | + void client_surface_close_requested() override; |
196 | |
197 | private: |
198 | frontend::SurfaceId const id; |
199 | |
200 | === modified file 'src/server/CMakeLists.txt' |
201 | --- src/server/CMakeLists.txt 2014-11-25 02:07:32 +0000 |
202 | +++ src/server/CMakeLists.txt 2014-11-26 11:09:30 +0000 |
203 | @@ -95,7 +95,7 @@ |
204 | ${CMAKE_SOURCE_DIR}/include/server/mir DESTINATION "include/mirserver" |
205 | ) |
206 | |
207 | -set(MIRSERVER_ABI 27) # Be sure to increment MIR_VERSION_MINOR at the same time |
208 | +set(MIRSERVER_ABI 28) # Be sure to increment MIR_VERSION_MINOR at the same time |
209 | set(symbol_map ${CMAKE_CURRENT_SOURCE_DIR}/symbols.map) |
210 | |
211 | set_target_properties( |
212 | |
213 | === modified file 'src/server/input/cursor_controller.cpp' |
214 | --- src/server/input/cursor_controller.cpp 2014-10-29 06:21:10 +0000 |
215 | +++ src/server/input/cursor_controller.cpp 2014-11-26 11:09:30 +0000 |
216 | @@ -86,6 +86,10 @@ |
217 | { |
218 | // No need to update cursor for orientation property change alone. |
219 | } |
220 | + void client_surface_close_requested() override |
221 | + { |
222 | + // No need to update cursor for client close requests |
223 | + } |
224 | |
225 | mi::CursorController* const cursor_controller; |
226 | }; |
227 | |
228 | === modified file 'src/server/scene/basic_surface.cpp' |
229 | --- src/server/scene/basic_surface.cpp 2014-10-29 06:21:10 +0000 |
230 | +++ src/server/scene/basic_surface.cpp 2014-11-26 11:09:30 +0000 |
231 | @@ -101,6 +101,12 @@ |
232 | { observer->reception_mode_set_to(mode); }); |
233 | } |
234 | |
235 | +void ms::SurfaceObservers::client_surface_close_requested() |
236 | +{ |
237 | + for_each([](std::shared_ptr<SurfaceObserver> const& observer) |
238 | + { observer->client_surface_close_requested(); }); |
239 | +} |
240 | + |
241 | |
242 | ms::BasicSurface::BasicSurface( |
243 | std::string const& name, |
244 | @@ -548,6 +554,10 @@ |
245 | return cursor_image_; |
246 | } |
247 | |
248 | +void ms::BasicSurface::request_client_surface_close() |
249 | +{ |
250 | + observers.client_surface_close_requested(); |
251 | +} |
252 | |
253 | int ms::BasicSurface::dpi() const |
254 | { |
255 | |
256 | === modified file 'src/server/scene/basic_surface.h' |
257 | --- src/server/scene/basic_surface.h 2014-11-05 03:25:04 +0000 |
258 | +++ src/server/scene/basic_surface.h 2014-11-26 11:09:30 +0000 |
259 | @@ -72,6 +72,7 @@ |
260 | void transformation_set_to(glm::mat4 const& t) override; |
261 | void reception_mode_set_to(input::InputReceptionMode mode) override; |
262 | void cursor_image_set_to(graphics::CursorImage const& image) override; |
263 | + void client_surface_close_requested() override; |
264 | }; |
265 | |
266 | class BasicSurface : public Surface |
267 | @@ -142,6 +143,8 @@ |
268 | void set_cursor_image(std::shared_ptr<graphics::CursorImage> const& image) override; |
269 | std::shared_ptr<graphics::CursorImage> cursor_image() const override; |
270 | |
271 | + void request_client_surface_close() override; |
272 | + |
273 | void add_observer(std::shared_ptr<SurfaceObserver> const& observer) override; |
274 | void remove_observer(std::weak_ptr<SurfaceObserver> const& observer) override; |
275 | |
276 | |
277 | === modified file 'src/server/scene/legacy_surface_change_notification.cpp' |
278 | --- src/server/scene/legacy_surface_change_notification.cpp 2014-10-29 06:21:10 +0000 |
279 | +++ src/server/scene/legacy_surface_change_notification.cpp 2014-11-26 11:09:30 +0000 |
280 | @@ -80,3 +80,8 @@ |
281 | { |
282 | notify_scene_change(); |
283 | } |
284 | + |
285 | +// A client close request is not enough to trigger recomposition. |
286 | +void ms::LegacySurfaceChangeNotification::client_surface_close_requested() |
287 | +{ |
288 | +} |
289 | |
290 | === modified file 'src/server/scene/legacy_surface_change_notification.h' |
291 | --- src/server/scene/legacy_surface_change_notification.h 2014-10-29 06:21:10 +0000 |
292 | +++ src/server/scene/legacy_surface_change_notification.h 2014-11-26 11:09:30 +0000 |
293 | @@ -47,6 +47,7 @@ |
294 | void attrib_changed(MirSurfaceAttrib, int) override; |
295 | void reception_mode_set_to(input::InputReceptionMode mode) override; |
296 | void cursor_image_set_to(graphics::CursorImage const& image) override; |
297 | + void client_surface_close_requested() override; |
298 | |
299 | private: |
300 | std::function<void()> const notify_scene_change; |
301 | |
302 | === modified file 'src/server/scene/null_surface_observer.cpp' |
303 | --- src/server/scene/null_surface_observer.cpp 2014-10-29 06:21:10 +0000 |
304 | +++ src/server/scene/null_surface_observer.cpp 2014-11-26 11:09:30 +0000 |
305 | @@ -31,3 +31,4 @@ |
306 | void ms::NullSurfaceObserver::transformation_set_to(glm::mat4 const& /*t*/) {} |
307 | void ms::NullSurfaceObserver::reception_mode_set_to(input::InputReceptionMode /*mode*/) {} |
308 | void ms::NullSurfaceObserver::cursor_image_set_to(mg::CursorImage const& /*image*/) {} |
309 | +void ms::NullSurfaceObserver::client_surface_close_requested() {} |
310 | |
311 | === modified file 'src/server/scene/surface_event_source.cpp' |
312 | --- src/server/scene/surface_event_source.cpp 2014-10-29 06:21:10 +0000 |
313 | +++ src/server/scene/surface_event_source.cpp 2014-11-26 11:09:30 +0000 |
314 | @@ -74,3 +74,14 @@ |
315 | |
316 | event_sink->handle_event(e); |
317 | } |
318 | + |
319 | +void ms::SurfaceEventSource::client_surface_close_requested() |
320 | +{ |
321 | + MirEvent e; |
322 | + memset(&e, 0, sizeof e); |
323 | + |
324 | + e.type = mir_event_type_close_surface; |
325 | + e.close_surface.surface_id = id.as_value(); |
326 | + |
327 | + event_sink->handle_event(e); |
328 | +} |
329 | |
330 | === modified file 'src/server/symbols.map' |
331 | --- src/server/symbols.map 2014-11-21 12:16:36 +0000 |
332 | +++ src/server/symbols.map 2014-11-26 11:09:30 +0000 |
333 | @@ -1,4 +1,4 @@ |
334 | -MIR_SERVER_27 { |
335 | +MIR_SERVER_28 { |
336 | global: |
337 | extern "C++" { |
338 | # Symbols not yet picked up by script |
339 | @@ -258,6 +258,7 @@ |
340 | mir::scene::CoordinateTranslator::surface_to_screen*; |
341 | mir::scene::NullSurfaceObserver::alpha_set_to*; |
342 | mir::scene::NullSurfaceObserver::attrib_changed*; |
343 | + mir::scene::NullSurfaceObserver::client_surface_close_requested*; |
344 | mir::scene::NullSurfaceObserver::cursor_image_set_to*; |
345 | mir::scene::NullSurfaceObserver::frame_posted*; |
346 | mir::scene::NullSurfaceObserver::hidden_set_to*; |
347 | @@ -355,6 +356,7 @@ |
348 | mir::scene::Surface::name*; |
349 | mir::scene::SurfaceObserver::alpha_set_to*; |
350 | mir::scene::SurfaceObserver::attrib_changed*; |
351 | + mir::scene::SurfaceObserver::client_surface_close_requested*; |
352 | mir::scene::SurfaceObserver::cursor_image_set_to*; |
353 | mir::scene::SurfaceObserver::frame_posted*; |
354 | mir::scene::SurfaceObserver::hidden_set_to*; |
355 | @@ -367,6 +369,7 @@ |
356 | mir::scene::SurfaceObserver::SurfaceObserver*; |
357 | mir::scene::SurfaceObserver::transformation_set_to*; |
358 | mir::scene::Surface::remove_observer*; |
359 | + mir::scene::Surface::request_client_surface_close*; |
360 | mir::scene::Surface::resize*; |
361 | mir::scene::Surface::set_alpha*; |
362 | mir::scene::Surface::set_cursor_image*; |
363 | @@ -617,6 +620,7 @@ |
364 | non-virtual?thunk?to?mir::scene::CoordinateTranslator::?CoordinateTranslator*; |
365 | non-virtual?thunk?to?mir::scene::NullSurfaceObserver::alpha_set_to*; |
366 | non-virtual?thunk?to?mir::scene::NullSurfaceObserver::attrib_changed*; |
367 | + non-virtual?thunk?to?mir::scene::NullSurfaceObserver::client_surface_close_requested*; |
368 | non-virtual?thunk?to?mir::scene::NullSurfaceObserver::cursor_image_set_to*; |
369 | non-virtual?thunk?to?mir::scene::NullSurfaceObserver::frame_posted*; |
370 | non-virtual?thunk?to?mir::scene::NullSurfaceObserver::hidden_set_to*; |
371 | |
372 | === modified file 'tests/acceptance-tests/test_client_surface_events.cpp' |
373 | --- tests/acceptance-tests/test_client_surface_events.cpp 2014-11-21 12:16:36 +0000 |
374 | +++ tests/acceptance-tests/test_client_surface_events.cpp 2014-11-26 11:09:30 +0000 |
375 | @@ -256,3 +256,17 @@ |
376 | EXPECT_THAT(mir_surface_get_orientation(surface), Eq(direction)); |
377 | } |
378 | } |
379 | + |
380 | +TEST_F(ClientSurfaceEvents, surface_receives_close_event) |
381 | +{ |
382 | + set_event_filter(mir_event_type_close_surface); |
383 | + |
384 | + scene_surface->request_client_surface_close(); |
385 | + |
386 | + EXPECT_TRUE(wait_for_event(std::chrono::seconds(1))); |
387 | + |
388 | + std::lock_guard<decltype(last_event_mutex)> last_event_lock{last_event_mutex}; |
389 | + |
390 | + EXPECT_THAT(last_event_surface, Eq(surface)); |
391 | + EXPECT_THAT(last_event.type, Eq(mir_event_type_close_surface)); |
392 | +} |
393 | |
394 | === modified file 'tests/include/mir_test_doubles/stub_scene_surface.h' |
395 | --- tests/include/mir_test_doubles/stub_scene_surface.h 2014-10-29 06:21:10 +0000 |
396 | +++ tests/include/mir_test_doubles/stub_scene_surface.h 2014-11-26 11:09:30 +0000 |
397 | @@ -89,6 +89,8 @@ |
398 | void set_cursor_image(std::shared_ptr<graphics::CursorImage> const& /* image */) {} |
399 | std::shared_ptr<graphics::CursorImage> cursor_image() const { return {}; } |
400 | |
401 | + void request_client_surface_close() override {} |
402 | + |
403 | MirPixelFormat pixel_format() const override { return mir_pixel_format_xrgb_8888; } |
404 | |
405 | void swap_buffers(graphics::Buffer*, std::function<void(graphics::Buffer*)>) override {} |
406 | |
407 | === modified file 'tests/unit-tests/scene/test_basic_surface.cpp' |
408 | --- tests/unit-tests/scene/test_basic_surface.cpp 2014-10-29 06:21:10 +0000 |
409 | +++ tests/unit-tests/scene/test_basic_surface.cpp 2014-11-26 11:09:30 +0000 |
410 | @@ -64,6 +64,12 @@ |
411 | MOCK_METHOD1(hidden_set_to, void(bool)); |
412 | }; |
413 | |
414 | +class MockCloseObserver : public ms::NullSurfaceObserver |
415 | +{ |
416 | +public: |
417 | + MOCK_METHOD0(client_surface_close_requested, void()); |
418 | +}; |
419 | + |
420 | class StubEventSink : public mir::frontend::EventSink |
421 | { |
422 | public: |
423 | @@ -716,3 +722,16 @@ |
424 | surface.set_hidden(true); |
425 | surface.set_hidden(true); |
426 | } |
427 | + |
428 | +TEST_F(BasicSurfaceTest, notifies_of_client_close_request) |
429 | +{ |
430 | + using namespace testing; |
431 | + |
432 | + MockCloseObserver mock_surface_observer; |
433 | + |
434 | + EXPECT_CALL(mock_surface_observer, client_surface_close_requested()).Times(1); |
435 | + |
436 | + surface.add_observer(mt::fake_shared(mock_surface_observer)); |
437 | + |
438 | + surface.request_client_surface_close(); |
439 | +} |
440 | |
441 | === modified file 'tests/unit-tests/scene/test_surface_impl.cpp' |
442 | --- tests/unit-tests/scene/test_surface_impl.cpp 2014-10-29 06:21:10 +0000 |
443 | +++ tests/unit-tests/scene/test_surface_impl.cpp 2014-11-26 11:09:30 +0000 |
444 | @@ -430,3 +430,33 @@ |
445 | |
446 | EXPECT_EQ(stub_buffer_stream->stub_compositor_buffer.get(), buf_ptr); |
447 | } |
448 | + |
449 | +TEST_F(Surface, emits_client_close_events) |
450 | +{ |
451 | + using namespace testing; |
452 | + |
453 | + auto sink = std::make_shared<MockEventSink>(); |
454 | + auto const observer = std::make_shared<ms::SurfaceEventSource>(stub_id, sink); |
455 | + |
456 | + ms::BasicSurface surf( |
457 | + std::string("stub"), |
458 | + geom::Rectangle{{},{}}, |
459 | + false, |
460 | + buffer_stream, |
461 | + std::shared_ptr<mi::InputChannel>(), |
462 | + stub_input_sender, |
463 | + null_configurator, |
464 | + std::shared_ptr<mg::CursorImage>(), |
465 | + report); |
466 | + |
467 | + surf.add_observer(observer); |
468 | + |
469 | + MirEvent e; |
470 | + memset(&e, 0, sizeof e); |
471 | + e.type = mir_event_type_close_surface; |
472 | + e.close_surface.surface_id = stub_id.as_value(); |
473 | + |
474 | + EXPECT_CALL(*sink, handle_event(e)).Times(1); |
475 | + |
476 | + surf.request_client_surface_close(); |
477 | +} |
PASSED: Continuous integration, rev:2103 jenkins. qa.ubuntu. com/job/ mir-ci/ 2253/ jenkins. qa.ubuntu. com/job/ mir-android- vivid-i386- build/339 jenkins. qa.ubuntu. com/job/ mir-clang- vivid-amd64- build/339 jenkins. qa.ubuntu. com/job/ mir-mediumtests -vivid- touch/313 jenkins. qa.ubuntu. com/job/ mir-vivid- amd64-ci/ 242 jenkins. qa.ubuntu. com/job/ mir-vivid- amd64-ci/ 242/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ mir-mediumtests -builder- vivid-armhf/ 313 jenkins. qa.ubuntu. com/job/ mir-mediumtests -builder- vivid-armhf/ 313/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ mir-mediumtests -runner- mako/3562 s-jenkins. ubuntu- ci:8080/ job/touch- flash-device/ 16229
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/mir- ci/2253/ rebuild
http://