Mir

Merge lp:~vanvugt/mir/no-delegate into lp:mir

Proposed by Daniel van Vugt
Status: Merged
Approved by: Daniel van Vugt
Approved revision: no longer in the source branch.
Merged at revision: 2442
Proposed branch: lp:~vanvugt/mir/no-delegate
Merge into: lp:mir
Diff against target: 368 lines (+48/-53)
20 files modified
benchmarks/frame-uniformity/touch_measuring_client.cpp (+1/-2)
debian/changelog (+2/-0)
examples/demo_client_display_config.c (+1/-2)
examples/eglapp.c (+1/-6)
examples/eglsquare.cpp (+1/-2)
examples/fingerpaint.c (+2/-3)
include/client/mir_toolkit/client_types.h (+0/-11)
include/client/mir_toolkit/mir_surface.h (+4/-2)
src/client/mir_surface_api.cpp (+21/-2)
src/client/symbols.map (+2/-1)
src/server/graphics/nested/host_connection.h (+2/-1)
src/server/graphics/nested/mir_client_host_connection.cpp (+2/-2)
src/server/graphics/nested/nested_output.cpp (+1/-2)
tests/acceptance-tests/test_client_focus_notification.cpp (+1/-6)
tests/acceptance-tests/test_client_input.cpp (+1/-2)
tests/acceptance-tests/test_client_surface_events.cpp (+2/-3)
tests/acceptance-tests/test_client_surface_visibility.cpp (+1/-2)
tests/acceptance-tests/throwback/test_client_input.cpp (+1/-2)
tests/include/mir_test_doubles/stub_host_connection.h (+1/-1)
tests/unit-tests/graphics/nested/test_nested_display_buffer.cpp (+1/-1)
To merge this branch: bzr merge lp:~vanvugt/mir/no-delegate
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Kevin DuBois (community) Approve
Alan Griffiths Approve
Review via email: mp+254541@code.launchpad.net

Commit message

Deprecate MirEventDelegate. This makes the client API slightly more pleasant to use.

Binary ABI compatibility with the old form is also retained.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

Nice

review: Approve
Revision history for this message
Kevin DuBois (kdub) wrote :

lgtm

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'benchmarks/frame-uniformity/touch_measuring_client.cpp'
2--- benchmarks/frame-uniformity/touch_measuring_client.cpp 2015-03-30 03:20:27 +0000
3+++ benchmarks/frame-uniformity/touch_measuring_client.cpp 2015-03-31 02:56:11 +0000
4@@ -64,8 +64,7 @@
5
6 void collect_input_and_frame_timing(MirSurface *surface, mt::Barrier& client_ready, std::chrono::high_resolution_clock::duration duration, std::shared_ptr<TouchSamples> const& results)
7 {
8- MirEventDelegate event_handler = { input_callback, results.get() };
9- mir_surface_set_event_handler(surface, &event_handler);
10+ mir_surface_set_event_handler(surface, input_callback, results.get());
11
12 client_ready.ready();
13
14
15=== modified file 'debian/changelog'
16--- debian/changelog 2015-03-30 03:20:27 +0000
17+++ debian/changelog 2015-03-31 02:56:11 +0000
18@@ -22,6 +22,8 @@
19 . Added support and example code for rendering window title strings.
20 . Added proof-of-concept support for Snappy packaging for Ubuntu Core.
21 . Drop support for C++11. Now C++14 is required to build Mir.
22+ . Deprecated MirEventDelegate. Now you just pass the two fields as
23+ parameters directly to mir_surface_set_event_handler().
24 . TODO: mention more enhancements
25 - ABI summary: Servers need rebuilding, but clients do not;
26 . Mirclient ABI unchanged at 8
27
28=== modified file 'examples/demo_client_display_config.c'
29--- examples/demo_client_display_config.c 2015-03-30 03:20:27 +0000
30+++ examples/demo_client_display_config.c 2015-03-31 02:56:11 +0000
31@@ -368,8 +368,7 @@
32 mir_connection_set_display_config_change_callback(
33 connection, display_change_callback, &ctx);
34
35- struct MirEventDelegate ed = {event_callback, &ctx};
36- mir_surface_set_event_handler(surface, &ed);
37+ mir_surface_set_event_handler(surface, event_callback, &ctx);
38
39 time_t start = time(NULL);
40
41
42=== modified file 'examples/eglapp.c'
43--- examples/eglapp.c 2015-03-30 10:43:51 +0000
44+++ examples/eglapp.c 2015-03-31 02:56:11 +0000
45@@ -189,11 +189,6 @@
46 EGL_CONTEXT_CLIENT_VERSION, 2,
47 EGL_NONE
48 };
49- MirEventDelegate delegate =
50- {
51- mir_eglapp_handle_event,
52- NULL
53- };
54 EGLConfig eglconfig;
55 EGLint neglconfigs;
56 EGLContext eglctx;
57@@ -407,7 +402,7 @@
58
59 CHECK(mir_surface_is_valid(surface), "Can't create a surface");
60
61- mir_surface_set_event_handler(surface, &delegate);
62+ mir_surface_set_event_handler(surface, mir_eglapp_handle_event, NULL);
63
64 MirCursorConfiguration *conf = mir_cursor_configuration_from_name(cursor_name);
65 mir_surface_configure_cursor(surface, conf);
66
67=== modified file 'examples/eglsquare.cpp'
68--- examples/eglsquare.cpp 2015-03-30 03:20:27 +0000
69+++ examples/eglsquare.cpp 2015-03-31 02:56:11 +0000
70@@ -362,8 +362,7 @@
71 mir_surface_spec_set_name(spec.get(), __PRETTY_FUNCTION__);
72 mir_surface_spec_set_buffer_usage(spec.get(), mir_buffer_usage_hardware);
73 auto surface = mir_surface_create_sync(spec.get());
74- MirEventDelegate delegate = {&on_event, this};
75- mir_surface_set_event_handler(surface, &delegate);
76+ mir_surface_set_event_handler(surface, &on_event, this);
77 return surface;
78 }
79 static void on_event(MirSurface*, const MirEvent *event, void *context)
80
81=== modified file 'examples/fingerpaint.c'
82--- examples/fingerpaint.c 2015-03-30 03:20:27 +0000
83+++ examples/fingerpaint.c 2015-03-31 02:56:11 +0000
84@@ -348,7 +348,6 @@
85 MirConnection *conn;
86 MirSurface *surf;
87 MirGraphicsRegion canvas;
88- MirEventDelegate delegate = {&on_event, &canvas};
89 unsigned int f;
90 int swap_interval = 0;
91
92@@ -452,7 +451,7 @@
93 {
94 mir_surface_set_title(surf, "Mir Fingerpaint");
95 mir_surface_set_swapinterval(surf, swap_interval);
96- mir_surface_set_event_handler(surf, &delegate);
97+ mir_surface_set_event_handler(surf, &on_event, &canvas);
98
99 canvas.width = width;
100 canvas.height = height;
101@@ -475,7 +474,7 @@
102 }
103
104 /* Ensure canvas won't be used after it's freed */
105- mir_surface_set_event_handler(surf, NULL);
106+ mir_surface_set_event_handler(surf, NULL, NULL);
107 free(canvas.vaddr);
108 }
109 else
110
111=== modified file 'include/client/mir_toolkit/client_types.h'
112--- include/client/mir_toolkit/client_types.h 2015-03-30 03:20:27 +0000
113+++ include/client/mir_toolkit/client_types.h 2015-03-31 02:56:11 +0000
114@@ -278,17 +278,6 @@
115 MirDisplayCard *cards;
116 } MirDisplayConfiguration;
117
118-/**
119- * MirEventDelegate may be used to specify (at surface creation time)
120- * callbacks for handling of events.
121- */
122-typedef mir_surface_event_callback mir_event_delegate_callback;
123-typedef struct MirEventDelegate
124-{
125- mir_event_delegate_callback callback;
126- void *context;
127-} MirEventDelegate;
128-
129 typedef struct MirRectangle
130 {
131 int left;
132
133=== modified file 'include/client/mir_toolkit/mir_surface.h'
134--- include/client/mir_toolkit/mir_surface.h 2015-03-30 03:20:27 +0000
135+++ include/client/mir_toolkit/mir_surface.h 2015-03-31 02:56:11 +0000
136@@ -319,10 +319,12 @@
137 * called back in different threads, for the same surface,
138 * simultaneously.
139 * \param [in] surface The surface
140- * \param [in] event_handler The event handler to call
141+ * \param [in] callback The callback function
142+ * \param [in] context Additional argument to be passed to callback
143 */
144 void mir_surface_set_event_handler(MirSurface *surface,
145- MirEventDelegate const *event_handler);
146+ mir_surface_event_callback callback,
147+ void* context);
148
149 /**
150 * Retrieve the primary MirBufferStream associated with a surface (to advance buffers,
151
152=== modified file 'src/client/mir_surface_api.cpp'
153--- src/client/mir_surface_api.cpp 2015-03-30 03:20:27 +0000
154+++ src/client/mir_surface_api.cpp 2015-03-31 02:56:11 +0000
155@@ -225,14 +225,33 @@
156 return surface;
157 }
158
159-void mir_surface_set_event_handler(MirSurface* surface,
160- MirEventDelegate const* delegate)
161+__asm__(".symver new_mir_surface_set_event_handler,mir_surface_set_event_handler@@MIR_CLIENT_8.4");
162+extern "C"
163+void new_mir_surface_set_event_handler(MirSurface* surface,
164+ mir_surface_event_callback callback,
165+ void* context)
166+{
167+ surface->set_event_handler(callback, context);
168+}
169+
170+// Deprecated but ABI backward compatible --->
171+typedef struct MirEventDelegate
172+{
173+ mir_surface_event_callback callback;
174+ void *context;
175+} MirEventDelegate;
176+
177+__asm__(".symver old_mir_surface_set_event_handler,mir_surface_set_event_handler@MIR_CLIENT_8");
178+extern "C"
179+void old_mir_surface_set_event_handler(MirSurface* surface,
180+ MirEventDelegate const* delegate)
181 {
182 if (delegate)
183 surface->set_event_handler(delegate->callback, delegate->context);
184 else
185 surface->set_event_handler(nullptr, nullptr);
186 }
187+// <--- Deprecated
188
189 MirEGLNativeWindowType mir_surface_get_egl_native_window(MirSurface* surface)
190 {
191
192=== modified file 'src/client/symbols.map'
193--- src/client/symbols.map 2015-03-30 03:20:27 +0000
194+++ src/client/symbols.map 2015-03-31 02:56:11 +0000
195@@ -103,7 +103,7 @@
196 mir_surface_spec_set_preferred_orientation;
197 } MIR_CLIENT_8.1;
198
199-MIR_CLIENT_8.3 {
200+MIR_CLIENT_8.3 { # New in Mir 0.11
201 global:
202 mir_connection_create_spec_for_dialog;
203 mir_connection_create_spec_for_menu;
204@@ -113,6 +113,7 @@
205
206 MIR_CLIENT_8.4 { # New in Mir 0.13
207 global:
208+ mir_surface_set_event_handler;
209 mir_surface_set_title;
210 mir_default_cursor_name;
211 mir_disabled_cursor_name;
212
213=== modified file 'src/server/graphics/nested/host_connection.h'
214--- src/server/graphics/nested/host_connection.h 2015-02-02 12:18:18 +0000
215+++ src/server/graphics/nested/host_connection.h 2015-03-31 02:56:11 +0000
216@@ -43,7 +43,8 @@
217 virtual ~HostSurface() = default;
218
219 virtual EGLNativeWindowType egl_native_window() = 0;
220- virtual void set_event_handler(MirEventDelegate const* handler) = 0;
221+ virtual void set_event_handler(mir_surface_event_callback cb,
222+ void* context) = 0;
223
224 protected:
225 HostSurface() = default;
226
227=== modified file 'src/server/graphics/nested/mir_client_host_connection.cpp'
228--- src/server/graphics/nested/mir_client_host_connection.cpp 2015-03-30 03:20:27 +0000
229+++ src/server/graphics/nested/mir_client_host_connection.cpp 2015-03-31 02:56:11 +0000
230@@ -76,9 +76,9 @@
231 mir_buffer_stream_get_egl_native_window(mir_surface_get_buffer_stream(mir_surface)));
232 }
233
234- void set_event_handler(MirEventDelegate const* handler) override
235+ void set_event_handler(mir_surface_event_callback cb, void* context) override
236 {
237- mir_surface_set_event_handler(mir_surface, handler);
238+ mir_surface_set_event_handler(mir_surface, cb, context);
239 }
240
241 private:
242
243=== modified file 'src/server/graphics/nested/nested_output.cpp'
244--- src/server/graphics/nested/nested_output.cpp 2015-03-30 03:20:27 +0000
245+++ src/server/graphics/nested/nested_output.cpp 2015-03-31 02:56:11 +0000
246@@ -45,8 +45,7 @@
247 dispatcher{dispatcher},
248 egl_surface{egl_display, host_surface->egl_native_window(), egl_config}
249 {
250- MirEventDelegate ed = {event_thunk, this};
251- host_surface->set_event_handler(&ed);
252+ host_surface->set_event_handler(event_thunk, this);
253 }
254
255 geom::Rectangle mgn::detail::NestedOutput::view_area() const
256
257=== modified file 'tests/acceptance-tests/test_client_focus_notification.cpp'
258--- tests/acceptance-tests/test_client_focus_notification.cpp 2015-03-30 10:43:51 +0000
259+++ tests/acceptance-tests/test_client_focus_notification.cpp 2015-03-31 02:56:11 +0000
260@@ -84,12 +84,7 @@
261 // We need to set the event delegate from the surface_created
262 // callback so we can block the reading of new events
263 // until we are ready
264- MirEventDelegate const event_delegate =
265- {
266- handle_event,
267- self
268- };
269- mir_surface_set_event_handler(surface_, &event_delegate);
270+ mir_surface_set_event_handler(surface_, handle_event, self);
271 }
272 };
273 }
274
275=== modified file 'tests/acceptance-tests/test_client_input.cpp'
276--- tests/acceptance-tests/test_client_input.cpp 2015-03-12 14:12:15 +0000
277+++ tests/acceptance-tests/test_client_input.cpp 2015-03-31 02:56:11 +0000
278@@ -56,8 +56,7 @@
279 {
280 ConnectedClientWithASurface::SetUp();
281
282- MirEventDelegate const event_delegate { handle_input, this };
283- mir_surface_set_event_handler(surface, &event_delegate);
284+ mir_surface_set_event_handler(surface, handle_input, this);
285 mir_buffer_stream_swap_buffers_sync(
286 mir_surface_get_buffer_stream(surface));
287
288
289=== modified file 'tests/acceptance-tests/test_client_surface_events.cpp'
290--- tests/acceptance-tests/test_client_surface_events.cpp 2015-03-30 20:13:06 +0000
291+++ tests/acceptance-tests/test_client_surface_events.cpp 2015-03-31 02:56:11 +0000
292@@ -71,7 +71,6 @@
293 std::condition_variable last_event_cv;
294 MirEvent last_event{};
295 MirSurface* last_event_surface = nullptr;
296- MirEventDelegate delegate{&event_callback, this};
297
298 std::shared_ptr<ms::Surface> scene_surface;
299
300@@ -128,12 +127,12 @@
301
302 mtf::ConnectedClientWithASurface::SetUp();
303
304- mir_surface_set_event_handler(surface, &delegate);
305+ mir_surface_set_event_handler(surface, &event_callback, this);
306
307 scene_surface = the_latest_surface();
308
309 other_surface = mtf::make_any_surface(connection);
310- mir_surface_set_event_handler(other_surface, nullptr);
311+ mir_surface_set_event_handler(other_surface, nullptr, nullptr);
312
313 reset_last_event();
314 }
315
316=== modified file 'tests/acceptance-tests/test_client_surface_visibility.cpp'
317--- tests/acceptance-tests/test_client_surface_visibility.cpp 2015-03-30 20:13:06 +0000
318+++ tests/acceptance-tests/test_client_surface_visibility.cpp 2015-03-31 02:56:11 +0000
319@@ -114,8 +114,7 @@
320
321 mtf::ConnectedClientWithASurface::SetUp();
322
323- MirEventDelegate delegate{&event_callback, &mock_visibility_callback};
324- mir_surface_set_event_handler(surface, &delegate);
325+ mir_surface_set_event_handler(surface, &event_callback, &mock_visibility_callback);
326
327 // Swap enough buffers to ensure compositor threads are into run loop
328 for (auto i = 0; i != 11; ++i)
329
330=== modified file 'tests/acceptance-tests/throwback/test_client_input.cpp'
331--- tests/acceptance-tests/throwback/test_client_input.cpp 2015-03-30 03:20:27 +0000
332+++ tests/acceptance-tests/throwback/test_client_input.cpp 2015-03-31 02:56:11 +0000
333@@ -91,8 +91,7 @@
334 surface = mir_surface_create_sync(spec);
335 mir_surface_spec_release(spec);
336
337- MirEventDelegate const event_delegate { handle_input, this };
338- mir_surface_set_event_handler(surface, &event_delegate);
339+ mir_surface_set_event_handler(surface, handle_input, this);
340 mir_buffer_stream_swap_buffers_sync(
341 mir_surface_get_buffer_stream(surface));
342
343
344=== modified file 'tests/include/mir_test_doubles/stub_host_connection.h'
345--- tests/include/mir_test_doubles/stub_host_connection.h 2015-03-30 03:20:27 +0000
346+++ tests/include/mir_test_doubles/stub_host_connection.h 2015-03-31 02:56:11 +0000
347@@ -55,7 +55,7 @@
348 {
349 public:
350 EGLNativeWindowType egl_native_window() override { return {}; }
351- void set_event_handler(MirEventDelegate const*) override {}
352+ void set_event_handler(mir_surface_event_callback, void*) override {}
353 };
354
355 return std::make_shared<NullHostSurface>();
356
357=== modified file 'tests/unit-tests/graphics/nested/test_nested_display_buffer.cpp'
358--- tests/unit-tests/graphics/nested/test_nested_display_buffer.cpp 2015-03-30 03:20:27 +0000
359+++ tests/unit-tests/graphics/nested/test_nested_display_buffer.cpp 2015-03-31 02:56:11 +0000
360@@ -38,7 +38,7 @@
361 {
362 public:
363 EGLNativeWindowType egl_native_window() override { return {}; }
364- void set_event_handler(MirEventDelegate const*) override {}
365+ void set_event_handler(mir_surface_event_callback, void*) override {}
366 };
367
368 struct NestedDisplayBufferTest : testing::Test

Subscribers

People subscribed via source and target branches