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
=== modified file 'benchmarks/frame-uniformity/touch_measuring_client.cpp'
--- benchmarks/frame-uniformity/touch_measuring_client.cpp 2015-03-30 03:20:27 +0000
+++ benchmarks/frame-uniformity/touch_measuring_client.cpp 2015-03-31 02:56:11 +0000
@@ -64,8 +64,7 @@
6464
65void collect_input_and_frame_timing(MirSurface *surface, mt::Barrier& client_ready, std::chrono::high_resolution_clock::duration duration, std::shared_ptr<TouchSamples> const& results)65void collect_input_and_frame_timing(MirSurface *surface, mt::Barrier& client_ready, std::chrono::high_resolution_clock::duration duration, std::shared_ptr<TouchSamples> const& results)
66{66{
67 MirEventDelegate event_handler = { input_callback, results.get() };67 mir_surface_set_event_handler(surface, input_callback, results.get());
68 mir_surface_set_event_handler(surface, &event_handler);
69 68
70 client_ready.ready();69 client_ready.ready();
7170
7271
=== modified file 'debian/changelog'
--- debian/changelog 2015-03-30 03:20:27 +0000
+++ debian/changelog 2015-03-31 02:56:11 +0000
@@ -22,6 +22,8 @@
22 . Added support and example code for rendering window title strings.22 . Added support and example code for rendering window title strings.
23 . Added proof-of-concept support for Snappy packaging for Ubuntu Core.23 . Added proof-of-concept support for Snappy packaging for Ubuntu Core.
24 . Drop support for C++11. Now C++14 is required to build Mir.24 . Drop support for C++11. Now C++14 is required to build Mir.
25 . Deprecated MirEventDelegate. Now you just pass the two fields as
26 parameters directly to mir_surface_set_event_handler().
25 . TODO: mention more enhancements27 . TODO: mention more enhancements
26 - ABI summary: Servers need rebuilding, but clients do not;28 - ABI summary: Servers need rebuilding, but clients do not;
27 . Mirclient ABI unchanged at 829 . Mirclient ABI unchanged at 8
2830
=== modified file 'examples/demo_client_display_config.c'
--- examples/demo_client_display_config.c 2015-03-30 03:20:27 +0000
+++ examples/demo_client_display_config.c 2015-03-31 02:56:11 +0000
@@ -368,8 +368,7 @@
368 mir_connection_set_display_config_change_callback(368 mir_connection_set_display_config_change_callback(
369 connection, display_change_callback, &ctx);369 connection, display_change_callback, &ctx);
370370
371 struct MirEventDelegate ed = {event_callback, &ctx};371 mir_surface_set_event_handler(surface, event_callback, &ctx);
372 mir_surface_set_event_handler(surface, &ed);
373372
374 time_t start = time(NULL);373 time_t start = time(NULL);
375374
376375
=== modified file 'examples/eglapp.c'
--- examples/eglapp.c 2015-03-30 10:43:51 +0000
+++ examples/eglapp.c 2015-03-31 02:56:11 +0000
@@ -189,11 +189,6 @@
189 EGL_CONTEXT_CLIENT_VERSION, 2,189 EGL_CONTEXT_CLIENT_VERSION, 2,
190 EGL_NONE190 EGL_NONE
191 };191 };
192 MirEventDelegate delegate =
193 {
194 mir_eglapp_handle_event,
195 NULL
196 };
197 EGLConfig eglconfig;192 EGLConfig eglconfig;
198 EGLint neglconfigs;193 EGLint neglconfigs;
199 EGLContext eglctx;194 EGLContext eglctx;
@@ -407,7 +402,7 @@
407402
408 CHECK(mir_surface_is_valid(surface), "Can't create a surface");403 CHECK(mir_surface_is_valid(surface), "Can't create a surface");
409404
410 mir_surface_set_event_handler(surface, &delegate);405 mir_surface_set_event_handler(surface, mir_eglapp_handle_event, NULL);
411 406
412 MirCursorConfiguration *conf = mir_cursor_configuration_from_name(cursor_name);407 MirCursorConfiguration *conf = mir_cursor_configuration_from_name(cursor_name);
413 mir_surface_configure_cursor(surface, conf);408 mir_surface_configure_cursor(surface, conf);
414409
=== modified file 'examples/eglsquare.cpp'
--- examples/eglsquare.cpp 2015-03-30 03:20:27 +0000
+++ examples/eglsquare.cpp 2015-03-31 02:56:11 +0000
@@ -362,8 +362,7 @@
362 mir_surface_spec_set_name(spec.get(), __PRETTY_FUNCTION__);362 mir_surface_spec_set_name(spec.get(), __PRETTY_FUNCTION__);
363 mir_surface_spec_set_buffer_usage(spec.get(), mir_buffer_usage_hardware);363 mir_surface_spec_set_buffer_usage(spec.get(), mir_buffer_usage_hardware);
364 auto surface = mir_surface_create_sync(spec.get());364 auto surface = mir_surface_create_sync(spec.get());
365 MirEventDelegate delegate = {&on_event, this};365 mir_surface_set_event_handler(surface, &on_event, this);
366 mir_surface_set_event_handler(surface, &delegate);
367 return surface;366 return surface;
368 }367 }
369 static void on_event(MirSurface*, const MirEvent *event, void *context)368 static void on_event(MirSurface*, const MirEvent *event, void *context)
370369
=== modified file 'examples/fingerpaint.c'
--- examples/fingerpaint.c 2015-03-30 03:20:27 +0000
+++ examples/fingerpaint.c 2015-03-31 02:56:11 +0000
@@ -348,7 +348,6 @@
348 MirConnection *conn;348 MirConnection *conn;
349 MirSurface *surf;349 MirSurface *surf;
350 MirGraphicsRegion canvas;350 MirGraphicsRegion canvas;
351 MirEventDelegate delegate = {&on_event, &canvas};
352 unsigned int f;351 unsigned int f;
353 int swap_interval = 0;352 int swap_interval = 0;
354353
@@ -452,7 +451,7 @@
452 {451 {
453 mir_surface_set_title(surf, "Mir Fingerpaint");452 mir_surface_set_title(surf, "Mir Fingerpaint");
454 mir_surface_set_swapinterval(surf, swap_interval);453 mir_surface_set_swapinterval(surf, swap_interval);
455 mir_surface_set_event_handler(surf, &delegate);454 mir_surface_set_event_handler(surf, &on_event, &canvas);
456 455
457 canvas.width = width;456 canvas.width = width;
458 canvas.height = height;457 canvas.height = height;
@@ -475,7 +474,7 @@
475 }474 }
476475
477 /* Ensure canvas won't be used after it's freed */476 /* Ensure canvas won't be used after it's freed */
478 mir_surface_set_event_handler(surf, NULL);477 mir_surface_set_event_handler(surf, NULL, NULL);
479 free(canvas.vaddr);478 free(canvas.vaddr);
480 }479 }
481 else480 else
482481
=== modified file 'include/client/mir_toolkit/client_types.h'
--- include/client/mir_toolkit/client_types.h 2015-03-30 03:20:27 +0000
+++ include/client/mir_toolkit/client_types.h 2015-03-31 02:56:11 +0000
@@ -278,17 +278,6 @@
278 MirDisplayCard *cards;278 MirDisplayCard *cards;
279} MirDisplayConfiguration;279} MirDisplayConfiguration;
280280
281/**
282 * MirEventDelegate may be used to specify (at surface creation time)
283 * callbacks for handling of events.
284 */
285typedef mir_surface_event_callback mir_event_delegate_callback;
286typedef struct MirEventDelegate
287{
288 mir_event_delegate_callback callback;
289 void *context;
290} MirEventDelegate;
291
292typedef struct MirRectangle281typedef struct MirRectangle
293{282{
294 int left;283 int left;
295284
=== modified file 'include/client/mir_toolkit/mir_surface.h'
--- include/client/mir_toolkit/mir_surface.h 2015-03-30 03:20:27 +0000
+++ include/client/mir_toolkit/mir_surface.h 2015-03-31 02:56:11 +0000
@@ -319,10 +319,12 @@
319 * called back in different threads, for the same surface,319 * called back in different threads, for the same surface,
320 * simultaneously.320 * simultaneously.
321 * \param [in] surface The surface321 * \param [in] surface The surface
322 * \param [in] event_handler The event handler to call322 * \param [in] callback The callback function
323 * \param [in] context Additional argument to be passed to callback
323 */324 */
324void mir_surface_set_event_handler(MirSurface *surface,325void mir_surface_set_event_handler(MirSurface *surface,
325 MirEventDelegate const *event_handler);326 mir_surface_event_callback callback,
327 void* context);
326328
327/**329/**
328 * Retrieve the primary MirBufferStream associated with a surface (to advance buffers,330 * Retrieve the primary MirBufferStream associated with a surface (to advance buffers,
329331
=== modified file 'src/client/mir_surface_api.cpp'
--- src/client/mir_surface_api.cpp 2015-03-30 03:20:27 +0000
+++ src/client/mir_surface_api.cpp 2015-03-31 02:56:11 +0000
@@ -225,14 +225,33 @@
225 return surface;225 return surface;
226}226}
227227
228void mir_surface_set_event_handler(MirSurface* surface,228__asm__(".symver new_mir_surface_set_event_handler,mir_surface_set_event_handler@@MIR_CLIENT_8.4");
229 MirEventDelegate const* delegate)229extern "C"
230void new_mir_surface_set_event_handler(MirSurface* surface,
231 mir_surface_event_callback callback,
232 void* context)
233{
234 surface->set_event_handler(callback, context);
235}
236
237// Deprecated but ABI backward compatible --->
238typedef struct MirEventDelegate
239{
240 mir_surface_event_callback callback;
241 void *context;
242} MirEventDelegate;
243
244__asm__(".symver old_mir_surface_set_event_handler,mir_surface_set_event_handler@MIR_CLIENT_8");
245extern "C"
246void old_mir_surface_set_event_handler(MirSurface* surface,
247 MirEventDelegate const* delegate)
230{248{
231 if (delegate)249 if (delegate)
232 surface->set_event_handler(delegate->callback, delegate->context);250 surface->set_event_handler(delegate->callback, delegate->context);
233 else251 else
234 surface->set_event_handler(nullptr, nullptr);252 surface->set_event_handler(nullptr, nullptr);
235}253}
254// <--- Deprecated
236255
237MirEGLNativeWindowType mir_surface_get_egl_native_window(MirSurface* surface)256MirEGLNativeWindowType mir_surface_get_egl_native_window(MirSurface* surface)
238{257{
239258
=== modified file 'src/client/symbols.map'
--- src/client/symbols.map 2015-03-30 03:20:27 +0000
+++ src/client/symbols.map 2015-03-31 02:56:11 +0000
@@ -103,7 +103,7 @@
103 mir_surface_spec_set_preferred_orientation;103 mir_surface_spec_set_preferred_orientation;
104} MIR_CLIENT_8.1;104} MIR_CLIENT_8.1;
105105
106MIR_CLIENT_8.3 {106MIR_CLIENT_8.3 { # New in Mir 0.11
107 global:107 global:
108 mir_connection_create_spec_for_dialog;108 mir_connection_create_spec_for_dialog;
109 mir_connection_create_spec_for_menu;109 mir_connection_create_spec_for_menu;
@@ -113,6 +113,7 @@
113113
114MIR_CLIENT_8.4 { # New in Mir 0.13114MIR_CLIENT_8.4 { # New in Mir 0.13
115 global:115 global:
116 mir_surface_set_event_handler;
116 mir_surface_set_title;117 mir_surface_set_title;
117 mir_default_cursor_name;118 mir_default_cursor_name;
118 mir_disabled_cursor_name;119 mir_disabled_cursor_name;
119120
=== modified file 'src/server/graphics/nested/host_connection.h'
--- src/server/graphics/nested/host_connection.h 2015-02-02 12:18:18 +0000
+++ src/server/graphics/nested/host_connection.h 2015-03-31 02:56:11 +0000
@@ -43,7 +43,8 @@
43 virtual ~HostSurface() = default;43 virtual ~HostSurface() = default;
4444
45 virtual EGLNativeWindowType egl_native_window() = 0;45 virtual EGLNativeWindowType egl_native_window() = 0;
46 virtual void set_event_handler(MirEventDelegate const* handler) = 0;46 virtual void set_event_handler(mir_surface_event_callback cb,
47 void* context) = 0;
4748
48protected:49protected:
49 HostSurface() = default;50 HostSurface() = default;
5051
=== modified file 'src/server/graphics/nested/mir_client_host_connection.cpp'
--- src/server/graphics/nested/mir_client_host_connection.cpp 2015-03-30 03:20:27 +0000
+++ src/server/graphics/nested/mir_client_host_connection.cpp 2015-03-31 02:56:11 +0000
@@ -76,9 +76,9 @@
76 mir_buffer_stream_get_egl_native_window(mir_surface_get_buffer_stream(mir_surface)));76 mir_buffer_stream_get_egl_native_window(mir_surface_get_buffer_stream(mir_surface)));
77 }77 }
7878
79 void set_event_handler(MirEventDelegate const* handler) override79 void set_event_handler(mir_surface_event_callback cb, void* context) override
80 {80 {
81 mir_surface_set_event_handler(mir_surface, handler);81 mir_surface_set_event_handler(mir_surface, cb, context);
82 }82 }
8383
84private:84private:
8585
=== modified file 'src/server/graphics/nested/nested_output.cpp'
--- src/server/graphics/nested/nested_output.cpp 2015-03-30 03:20:27 +0000
+++ src/server/graphics/nested/nested_output.cpp 2015-03-31 02:56:11 +0000
@@ -45,8 +45,7 @@
45 dispatcher{dispatcher},45 dispatcher{dispatcher},
46 egl_surface{egl_display, host_surface->egl_native_window(), egl_config}46 egl_surface{egl_display, host_surface->egl_native_window(), egl_config}
47{47{
48 MirEventDelegate ed = {event_thunk, this};48 host_surface->set_event_handler(event_thunk, this);
49 host_surface->set_event_handler(&ed);
50}49}
5150
52geom::Rectangle mgn::detail::NestedOutput::view_area() const51geom::Rectangle mgn::detail::NestedOutput::view_area() const
5352
=== modified file 'tests/acceptance-tests/test_client_focus_notification.cpp'
--- tests/acceptance-tests/test_client_focus_notification.cpp 2015-03-30 10:43:51 +0000
+++ tests/acceptance-tests/test_client_focus_notification.cpp 2015-03-31 02:56:11 +0000
@@ -84,12 +84,7 @@
84 // We need to set the event delegate from the surface_created84 // We need to set the event delegate from the surface_created
85 // callback so we can block the reading of new events85 // callback so we can block the reading of new events
86 // until we are ready86 // until we are ready
87 MirEventDelegate const event_delegate =87 mir_surface_set_event_handler(surface_, handle_event, self);
88 {
89 handle_event,
90 self
91 };
92 mir_surface_set_event_handler(surface_, &event_delegate);
93 }88 }
94};89};
95}90}
9691
=== modified file 'tests/acceptance-tests/test_client_input.cpp'
--- tests/acceptance-tests/test_client_input.cpp 2015-03-12 14:12:15 +0000
+++ tests/acceptance-tests/test_client_input.cpp 2015-03-31 02:56:11 +0000
@@ -56,8 +56,7 @@
56 {56 {
57 ConnectedClientWithASurface::SetUp();57 ConnectedClientWithASurface::SetUp();
5858
59 MirEventDelegate const event_delegate { handle_input, this };59 mir_surface_set_event_handler(surface, handle_input, this);
60 mir_surface_set_event_handler(surface, &event_delegate);
61 mir_buffer_stream_swap_buffers_sync(60 mir_buffer_stream_swap_buffers_sync(
62 mir_surface_get_buffer_stream(surface));61 mir_surface_get_buffer_stream(surface));
6362
6463
=== modified file 'tests/acceptance-tests/test_client_surface_events.cpp'
--- tests/acceptance-tests/test_client_surface_events.cpp 2015-03-30 20:13:06 +0000
+++ tests/acceptance-tests/test_client_surface_events.cpp 2015-03-31 02:56:11 +0000
@@ -71,7 +71,6 @@
71 std::condition_variable last_event_cv;71 std::condition_variable last_event_cv;
72 MirEvent last_event{};72 MirEvent last_event{};
73 MirSurface* last_event_surface = nullptr;73 MirSurface* last_event_surface = nullptr;
74 MirEventDelegate delegate{&event_callback, this};
7574
76 std::shared_ptr<ms::Surface> scene_surface;75 std::shared_ptr<ms::Surface> scene_surface;
7776
@@ -128,12 +127,12 @@
128127
129 mtf::ConnectedClientWithASurface::SetUp();128 mtf::ConnectedClientWithASurface::SetUp();
130129
131 mir_surface_set_event_handler(surface, &delegate);130 mir_surface_set_event_handler(surface, &event_callback, this);
132131
133 scene_surface = the_latest_surface();132 scene_surface = the_latest_surface();
134133
135 other_surface = mtf::make_any_surface(connection);134 other_surface = mtf::make_any_surface(connection);
136 mir_surface_set_event_handler(other_surface, nullptr);135 mir_surface_set_event_handler(other_surface, nullptr, nullptr);
137136
138 reset_last_event();137 reset_last_event();
139 }138 }
140139
=== modified file 'tests/acceptance-tests/test_client_surface_visibility.cpp'
--- tests/acceptance-tests/test_client_surface_visibility.cpp 2015-03-30 20:13:06 +0000
+++ tests/acceptance-tests/test_client_surface_visibility.cpp 2015-03-31 02:56:11 +0000
@@ -114,8 +114,7 @@
114114
115 mtf::ConnectedClientWithASurface::SetUp();115 mtf::ConnectedClientWithASurface::SetUp();
116116
117 MirEventDelegate delegate{&event_callback, &mock_visibility_callback};117 mir_surface_set_event_handler(surface, &event_callback, &mock_visibility_callback);
118 mir_surface_set_event_handler(surface, &delegate);
119118
120 // Swap enough buffers to ensure compositor threads are into run loop119 // Swap enough buffers to ensure compositor threads are into run loop
121 for (auto i = 0; i != 11; ++i)120 for (auto i = 0; i != 11; ++i)
122121
=== modified file 'tests/acceptance-tests/throwback/test_client_input.cpp'
--- tests/acceptance-tests/throwback/test_client_input.cpp 2015-03-30 03:20:27 +0000
+++ tests/acceptance-tests/throwback/test_client_input.cpp 2015-03-31 02:56:11 +0000
@@ -91,8 +91,7 @@
91 surface = mir_surface_create_sync(spec);91 surface = mir_surface_create_sync(spec);
92 mir_surface_spec_release(spec);92 mir_surface_spec_release(spec);
9393
94 MirEventDelegate const event_delegate { handle_input, this };94 mir_surface_set_event_handler(surface, handle_input, this);
95 mir_surface_set_event_handler(surface, &event_delegate);
96 mir_buffer_stream_swap_buffers_sync(95 mir_buffer_stream_swap_buffers_sync(
97 mir_surface_get_buffer_stream(surface));96 mir_surface_get_buffer_stream(surface));
9897
9998
=== modified file 'tests/include/mir_test_doubles/stub_host_connection.h'
--- tests/include/mir_test_doubles/stub_host_connection.h 2015-03-30 03:20:27 +0000
+++ tests/include/mir_test_doubles/stub_host_connection.h 2015-03-31 02:56:11 +0000
@@ -55,7 +55,7 @@
55 {55 {
56 public:56 public:
57 EGLNativeWindowType egl_native_window() override { return {}; }57 EGLNativeWindowType egl_native_window() override { return {}; }
58 void set_event_handler(MirEventDelegate const*) override {}58 void set_event_handler(mir_surface_event_callback, void*) override {}
59 };59 };
6060
61 return std::make_shared<NullHostSurface>();61 return std::make_shared<NullHostSurface>();
6262
=== modified file 'tests/unit-tests/graphics/nested/test_nested_display_buffer.cpp'
--- tests/unit-tests/graphics/nested/test_nested_display_buffer.cpp 2015-03-30 03:20:27 +0000
+++ tests/unit-tests/graphics/nested/test_nested_display_buffer.cpp 2015-03-31 02:56:11 +0000
@@ -38,7 +38,7 @@
38{38{
39public:39public:
40 EGLNativeWindowType egl_native_window() override { return {}; }40 EGLNativeWindowType egl_native_window() override { return {}; }
41 void set_event_handler(MirEventDelegate const*) override {}41 void set_event_handler(mir_surface_event_callback, void*) override {}
42};42};
4343
44struct NestedDisplayBufferTest : testing::Test44struct NestedDisplayBufferTest : testing::Test

Subscribers

People subscribed via source and target branches