Mir

Merge lp:~brandontschaefer/mir/deprecate-set-event-handler into lp:mir

Proposed by Brandon Schaefer
Status: Rejected
Rejected by: Brandon Schaefer
Proposed branch: lp:~brandontschaefer/mir/deprecate-set-event-handler
Merge into: lp:mir
Prerequisite: lp:~brandontschaefer/mir/fix-spec-set-event-handle
Diff against target: 605 lines (+120/-33)
23 files modified
benchmarks/frame-uniformity/touch_measuring_client.cpp (+5/-3)
examples/camera.c (+11/-8)
examples/client_touch_validator.cpp (+4/-1)
examples/demo_client_display_config.c (+4/-1)
examples/eglapp.c (+1/-3)
examples/eglsquare.cpp (+4/-1)
examples/fingerpaint.c (+8/-5)
examples/pointer_confinement.c (+1/-1)
examples/target.c (+8/-2)
include/client/mir_toolkit/mir_surface.h (+1/-0)
src/client/mir_surface_api.cpp (+4/-0)
src/server/graphics/nested/mir_client_host_connection.cpp (+4/-1)
src/utils/vanity.c (+9/-2)
tests/acceptance-tests/test_client_input.cpp (+6/-0)
tests/acceptance-tests/test_client_library.cpp (+3/-0)
tests/acceptance-tests/test_client_surface_events.cpp (+12/-0)
tests/acceptance-tests/test_client_surface_visibility.cpp (+3/-0)
tests/acceptance-tests/test_confined_pointer.cpp (+6/-0)
tests/acceptance-tests/test_nested_input.cpp (+7/-1)
tests/acceptance-tests/test_nested_mir.cpp (+6/-0)
tests/acceptance-tests/test_surface_raise.cpp (+7/-4)
tests/acceptance-tests/test_system_compositor_window_manager.cpp (+3/-0)
tests/privileged-tests/test_input_events.cpp (+3/-0)
To merge this branch: bzr merge lp:~brandontschaefer/mir/deprecate-set-event-handler
Reviewer Review Type Date Requested Status
Alan Griffiths Abstain
Daniel van Vugt Disapprove
Mir CI Bot continuous-integration Needs Fixing
Cemil Azizoglu Pending
Review via email: mp+314275@code.launchpad.net

This proposal supersedes a proposal from 2017-01-06.

Commit message

Deprecate set_event_handler as we are using mir_surface_spec_set_event_handler now.

Description of the change

Deprecate set_event_handler as we are using mir_surface_spec_set_event_handler now.

The tests need to stay testing the old way, which will be moved over once we remove the function. All other places have moved over to the new way.

To post a comment you must log in.
Revision history for this message
Cemil Azizoglu (cemil-azizoglu) wrote : Posted in a previous version of this proposal

This should prereq the deprecation related branches. Otherwise, it's going to generate a mountain of conflicts. The functions that are being used here have all been renamed.

review: Needs Resubmitting
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote : Posted in a previous version of this proposal

FAILED: Continuous integration, rev:3907
https://mir-jenkins.ubuntu.com/job/mir-ci/2554/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/3322/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/3389
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/3381
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/3381
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/3381
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/3351/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/3351
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/3351/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/3351/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3351
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3351/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3351
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3351/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/3351/console

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/2554/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote : Posted in a previous version of this proposal

FAILED: Continuous integration, rev:3908
https://mir-jenkins.ubuntu.com/job/mir-ci/2556/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/3324/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/3391
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/3383
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/3383
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/3383
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/3353/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/3353
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/3353/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/3353/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3353
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3353/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3353
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3353/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/3353
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/3353/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/2556/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote : Posted in a previous version of this proposal

FAILED: Continuous integration, rev:3909
https://mir-jenkins.ubuntu.com/job/mir-ci/2563/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/3333/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/3400
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/3392
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/3392
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/3392
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/3362/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/3362
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/3362/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/3362
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/3362/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3362
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3362/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3362
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3362/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/3362
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/3362/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/2563/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:3909
https://mir-jenkins.ubuntu.com/job/mir-ci/2564/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/3334/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/3401
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/3393
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/3393
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/3393
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/3363
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/3363/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/3363/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/3363
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/3363/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3363/console
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3363/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3363
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3363/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/3363
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/3363/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/2564/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

As discussed last week this is backwards. Callbacks have no business being in the spec so it's 'mir_window_spec_set_event_handler' that needs to be removed.

The spec is something sent over the wire to the server. Callbacks are not sent over the wire to the server.

The spec is something that can be accepted or rejected atomically by the server. Callbacks setting can never fail because the server is not involved.

review: Disapprove
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

I'm not particularly convinced we need to deprecate mir_window_set_event_handler() it seems overly complicated to create, update, apply and release a WindowSpec in order to change the callback.

OTOH I disagree strongly with Daniel's review comment:

> As discussed last week this is backwards. Callbacks have no business being in
> the spec so it's 'mir_window_spec_set_event_handler' that needs to be removed.

I don't know about any discussion last week, but this assertion is wrong: One needs the option to specify the callback on a spec so that when creating a surface from it the callback is set initially and events are not lost between creation and setting it later.

> The spec is something sent over the wire to the server. Callbacks are not sent
> over the wire to the server.
>
> The spec is something that can be accepted or rejected atomically by the
> server. Callbacks setting can never fail because the server is not involved.

That's reading rather a lot into documentation that says far less. Vis:

 * Request changes to the specification of a surface. The server will decide
 * whether and how the request can be honoured.

The spec is a client side object that describes a window. Some client API functions might send properties from that specification to the server (if the corresponding request cannot be handled locally).

review: Abstain
Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

Seems fair, lets not deprecate!

Unmerged revisions

3909. By Brandon Schaefer

* Merge parent, fix conflicts

3908. By Brandon Schaefer

* Merge parent

3907. By Brandon Schaefer

* Deprecate mir_surface_set_event_handler

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 2017-01-07 03:43:23 +0000
3+++ benchmarks/frame-uniformity/touch_measuring_client.cpp 2017-01-07 03:43:24 +0000
4@@ -42,7 +42,7 @@
5
6 auto window = mir_window_create_sync(spec);
7 mir_window_spec_release(spec);
8-
9+
10 if (!mir_window_is_valid(window))
11 {
12 std::cerr << "Window creation failed: " << mir_window_get_error_message(window) << std::endl;
13@@ -55,14 +55,16 @@
14 void input_callback(MirSurface * /* surface */, MirEvent const* event, void* context)
15 {
16 auto results = static_cast<TouchSamples*>(context);
17-
18+
19 results->record_pointer_coordinates(std::chrono::high_resolution_clock::now(), *event);
20 }
21
22 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)
23 {
24+#pragma GCC diagnostic push
25+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
26 mir_window_set_event_handler(surface, input_callback, results.get());
27-
28+#pragma GCC diagnostic pop
29 client_ready.ready();
30
31 // May be better if end time were relative to the first input event
32
33=== modified file 'examples/camera.c'
34--- examples/camera.c 2017-01-07 03:43:23 +0000
35+++ examples/camera.c 2017-01-07 03:43:24 +0000
36@@ -397,6 +397,12 @@
37 return 0;
38 }
39
40+ State state =
41+ {
42+ PTHREAD_MUTEX_INITIALIZER,
43+ true
44+ };
45+
46 MirWindow* window = mir_eglapp_native_window();
47 if (win_width == 1) /* Fullscreen was not chosen */
48 {
49@@ -407,6 +413,7 @@
50 win_height = cam->pix.height;
51 mir_window_spec_set_width(changes, win_width);
52 mir_window_spec_set_height(changes, win_height);
53+ mir_window_spec_set_event_handler(changes, on_event, &state);
54 mir_window_apply_spec(window, changes);
55 mir_window_spec_release(changes);
56 }
57@@ -464,13 +471,6 @@
58 glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
59 glViewport(0, 0, win_width, win_height);
60
61- State state =
62- {
63- PTHREAD_MUTEX_INITIALIZER,
64- true
65- };
66- mir_window_set_event_handler(window, on_event, &state);
67-
68 bool first_frame = true;
69 while (mir_eglapp_running())
70 {
71@@ -562,7 +562,10 @@
72 mir_eglapp_swap_buffers();
73 }
74
75- mir_window_set_event_handler(window, NULL, NULL);
76+ MirWindowSpec* spec = mir_create_window_spec(mir_eglapp_native_connection());
77+ mir_window_spec_set_event_handler(spec, NULL, NULL);
78+ mir_window_apply_spec(window, spec);
79+ mir_window_spec_release(spec);
80 mir_eglapp_cleanup();
81 close_camera(cam);
82
83
84=== modified file 'examples/client_touch_validator.cpp'
85--- examples/client_touch_validator.cpp 2017-01-07 03:43:23 +0000
86+++ examples/client_touch_validator.cpp 2017-01-07 03:43:24 +0000
87@@ -168,7 +168,10 @@
88 TouchState state;
89
90 MirWindow* window = mir_eglapp_native_window();
91- mir_window_set_event_handler(window, on_event, &state);
92+ auto spec = mir_connection_create_spec_for_changes(mir_eglapp_native_connection());
93+ mir_window_spec_set_event_handler(spec, on_event, &state);
94+ mir_window_apply_spec(window, spec);
95+ mir_window_spec_release(spec);
96
97 float const opacity = mir_eglapp_background_opacity;
98 Color red = {opacity, 0.0f, 0.0f, opacity};
99
100=== modified file 'examples/demo_client_display_config.c'
101--- examples/demo_client_display_config.c 2017-01-07 03:43:23 +0000
102+++ examples/demo_client_display_config.c 2017-01-07 03:43:24 +0000
103@@ -368,7 +368,10 @@
104 mir_connection_set_display_config_change_callback(
105 connection, display_change_callback, &ctx);
106
107- mir_window_set_event_handler(window, event_callback, &ctx);
108+ MirWindowSpec* spec = mir_create_window_spec(mir_eglapp_native_connection());
109+ mir_window_spec_set_event_handler(spec, event_callback, &ctx);
110+ mir_window_apply_spec(window, spec);
111+ mir_window_spec_release(spec);
112
113 time_t start = time(NULL);
114
115
116=== modified file 'examples/eglapp.c'
117--- examples/eglapp.c 2017-01-07 03:43:23 +0000
118+++ examples/eglapp.c 2017-01-07 03:43:24 +0000
119@@ -486,13 +486,12 @@
120 if (output_id != mir_display_output_id_invalid)
121 mir_window_spec_set_fullscreen_on_output(spec, output_id);
122
123+ mir_window_spec_set_event_handler(spec, mir_eglapp_handle_event, NULL);
124 window = mir_window_create_sync(spec);
125 mir_window_spec_release(spec);
126
127 CHECK(mir_window_is_valid(window), "Can't create a window");
128
129- mir_window_set_event_handler(window, mir_eglapp_handle_event, NULL);
130-
131 spec = mir_create_window_spec(connection);
132 mir_window_spec_set_cursor_name(spec, cursor_name);
133 mir_window_apply_spec(window, spec);
134@@ -500,7 +499,6 @@
135
136 eglsurface = eglCreateWindowSurface(egldisplay, eglconfig,
137 (EGLNativeWindowType)mir_buffer_stream_get_egl_native_window(mir_window_get_buffer_stream(window)), NULL);
138-
139 CHECK(eglsurface != EGL_NO_SURFACE, "eglCreateWindowSurface failed");
140
141 eglctx = eglCreateContext(egldisplay, eglconfig, EGL_NO_CONTEXT,
142
143=== modified file 'examples/eglsquare.cpp'
144--- examples/eglsquare.cpp 2017-01-07 03:43:23 +0000
145+++ examples/eglsquare.cpp 2017-01-07 03:43:24 +0000
146@@ -109,7 +109,10 @@
147 context{connection, window, swap_interval},
148 program{context, dimensions.width, dimensions.height}
149 {
150- mir_window_set_event_handler(window, &on_event, this);
151+ auto spec = mir_connection_create_spec_for_changes(connection);
152+ mir_window_spec_set_event_handler(spec, &on_event, this);
153+ mir_window_apply_spec(window, spec);
154+ mir_window_spec_release(spec);
155 }
156
157 void on_event(MirEvent const* ev)
158
159=== modified file 'examples/fingerpaint.c'
160--- examples/fingerpaint.c 2017-01-07 03:43:23 +0000
161+++ examples/fingerpaint.c 2017-01-07 03:43:24 +0000
162@@ -465,10 +465,11 @@
163
164 mir_display_config_destroy(display_config);
165
166- MirWindowSpec *spec = mir_create_normal_window_spec(conn, width, height);
167+ MirWindowSpec* spec = mir_create_normal_window_spec(conn, width, height);
168 mir_window_spec_set_pixel_format(spec, pixel_format);
169 mir_window_spec_set_name(spec, "Mir Fingerpaint");
170 mir_window_spec_set_buffer_usage(spec, mir_buffer_usage_software);
171+ mir_window_spec_set_event_handler(spec, &on_event, &canvas);
172
173 window = mir_window_create_sync(spec);
174 mir_window_spec_release(spec);
175@@ -477,8 +478,7 @@
176 {
177 MirBufferStream* bs = mir_window_get_buffer_stream(window);
178 mir_buffer_stream_set_swapinterval(bs, swap_interval);
179- mir_window_set_event_handler(window, &on_event, &canvas);
180-
181+
182 canvas.width = width;
183 canvas.height = height;
184 canvas.stride = canvas.width * BYTES_PER_PIXEL(pixel_format);
185@@ -490,7 +490,7 @@
186 signal(SIGINT, shutdown);
187 signal(SIGTERM, shutdown);
188 signal(SIGHUP, shutdown);
189-
190+
191 clear_region(&canvas, &background);
192
193 while (running)
194@@ -509,7 +509,10 @@
195 }
196
197 /* Ensure canvas won't be used after it's freed */
198- mir_window_set_event_handler(window, NULL, NULL);
199+ MirWindowSpec* spec = mir_create_window_spec(conn);
200+ mir_window_spec_set_event_handler(spec, NULL, NULL);
201+ mir_window_apply_spec(window, spec);
202+ mir_window_spec_release(spec);
203 free(canvas.vaddr);
204 }
205 else
206
207=== modified file 'examples/pointer_confinement.c'
208--- examples/pointer_confinement.c 2017-01-07 03:43:23 +0000
209+++ examples/pointer_confinement.c 2017-01-07 03:43:24 +0000
210@@ -214,10 +214,10 @@
211 glUseProgram(prog);
212
213 MirWindow* window = mir_eglapp_native_window();
214- mir_window_set_event_handler(window, handle_event, NULL);
215
216 spec = mir_create_window_spec(mir_eglapp_native_connection());
217 mir_window_spec_set_pointer_confinement(spec, mir_pointer_confined_to_surface);
218+ mir_window_spec_set_event_handler(spec, handle_event, NULL);
219
220 mir_window_apply_spec(window, spec);
221 mir_window_spec_release(spec);
222
223=== modified file 'examples/target.c'
224--- examples/target.c 2017-01-07 03:43:23 +0000
225+++ examples/target.c 2017-01-07 03:43:24 +0000
226@@ -352,7 +352,10 @@
227 }
228
229 MirWindow* window = mir_eglapp_native_window();
230- mir_window_set_event_handler(window, on_event, &state);
231+ MirWindowSpec* spec = mir_create_window_spec(mir_eglapp_native_connection());
232+ mir_window_spec_set_event_handler(spec, on_event, &state);
233+ mir_window_apply_spec(window, spec);
234+ mir_window_spec_release(spec);
235
236 while (true)
237 {
238@@ -421,7 +424,10 @@
239 mir_eglapp_swap_buffers();
240 }
241
242- mir_window_set_event_handler(window, NULL, NULL);
243+ spec = mir_create_window_spec(mir_eglapp_native_connection());
244+ mir_window_spec_set_event_handler(spec, NULL, NULL);
245+ mir_window_apply_spec(window, spec);
246+ mir_window_spec_release(spec);
247 mir_eglapp_cleanup();
248
249 pthread_join(shutdown_handler_thread, NULL);
250
251=== modified file 'include/client/mir_toolkit/mir_surface.h'
252--- include/client/mir_toolkit/mir_surface.h 2017-01-07 03:43:23 +0000
253+++ include/client/mir_toolkit/mir_surface.h 2017-01-07 03:43:24 +0000
254@@ -613,6 +613,7 @@
255 * \param [in] callback The callback function
256 * \param [in] context Additional argument to be passed to callback
257 */
258+__attribute__ ((deprecated))
259 void mir_window_set_event_handler(MirWindow* window,
260 mir_window_event_callback callback,
261 void* context);
262
263=== modified file 'src/client/mir_surface_api.cpp'
264--- src/client/mir_surface_api.cpp 2017-01-07 03:43:23 +0000
265+++ src/client/mir_surface_api.cpp 2017-01-07 03:43:24 +0000
266@@ -944,7 +944,11 @@
267
268 void mir_surface_set_event_handler(MirSurface* surface, mir_surface_event_callback callback, void* context)
269 {
270+// Needed for now until we remove this function
271+#pragma GCC diagnostic push
272+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
273 mir_window_set_event_handler(surface, callback, context);
274+#pragma GCC diagnostic pop
275 }
276
277 bool mir_surface_is_valid(MirSurface* surface)
278
279=== modified file 'src/server/graphics/nested/mir_client_host_connection.cpp'
280--- src/server/graphics/nested/mir_client_host_connection.cpp 2017-01-07 03:43:23 +0000
281+++ src/server/graphics/nested/mir_client_host_connection.cpp 2017-01-07 03:43:24 +0000
282@@ -139,7 +139,10 @@
283
284 void set_event_handler(mir_surface_event_callback cb, void* context) override
285 {
286- mir_window_set_event_handler(mir_surface, cb, context);
287+ auto spec = mir_create_window_spec(mir_connection);
288+ mir_window_spec_set_event_handler(spec, cb, context);
289+ mir_window_apply_spec(mir_surface, spec);
290+ mir_window_spec_release(spec);
291 }
292
293 void set_cursor_image(mg::CursorImage const& image)
294
295=== modified file 'src/utils/vanity.c'
296--- src/utils/vanity.c 2017-01-07 03:43:23 +0000
297+++ src/utils/vanity.c 2017-01-07 03:43:24 +0000
298@@ -750,8 +750,12 @@
299 false,
300 false
301 };
302+
303 MirWindow* window = mir_eglapp_native_window();
304- mir_window_set_event_handler(window, on_event, &state);
305+ MirWindowSpec* spec = mir_create_window_spec(mir_eglapp_native_connection());
306+ mir_window_spec_set_event_handler(spec, on_event, &state);
307+ mir_window_apply_spec(window, spec);
308+ mir_window_spec_release(spec);
309
310 GLint tint = glGetUniformLocation(prog, "tint");
311
312@@ -890,7 +894,10 @@
313 last_swap_time = swap_time;
314 }
315
316- mir_window_set_event_handler(window, NULL, NULL);
317+ spec = mir_create_window_spec(mir_eglapp_native_connection());
318+ mir_window_spec_set_event_handler(spec, NULL, NULL);
319+ mir_window_apply_spec(window, spec);
320+ mir_window_spec_release(spec);
321 mir_eglapp_cleanup();
322
323 pthread_join(capture_thread, NULL);
324
325=== modified file 'tests/acceptance-tests/test_client_input.cpp'
326--- tests/acceptance-tests/test_client_input.cpp 2017-01-07 03:43:23 +0000
327+++ tests/acceptance-tests/test_client_input.cpp 2017-01-07 03:43:24 +0000
328@@ -103,7 +103,10 @@
329 BOOST_THROW_EXCEPTION(std::runtime_error{std::string{"Failed creating a window: "}+
330 mir_window_get_error_message(window)});
331
332+#pragma GCC diagnostic push
333+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
334 mir_window_set_event_handler(window, handle_event, this);
335+#pragma GCC diagnostic pop
336 mir_buffer_stream_swap_buffers_sync(
337 mir_window_get_buffer_stream(window));
338
339@@ -149,7 +152,10 @@
340 // Remove the event handler to avoid handling spurious events unrelated
341 // to the tests (e.g. pointer leave events when the window is destroyed),
342 // which can cause test expectations to fail.
343+#pragma GCC diagnostic push
344+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
345 mir_window_set_event_handler(window, null_event_handler, nullptr);
346+#pragma GCC diagnostic pop
347 mir_window_release_sync(window);
348 mir_connection_release(connection);
349 }
350
351=== modified file 'tests/acceptance-tests/test_client_library.cpp'
352--- tests/acceptance-tests/test_client_library.cpp 2017-01-07 03:43:23 +0000
353+++ tests/acceptance-tests/test_client_library.cpp 2017-01-07 03:43:24 +0000
354@@ -951,8 +951,11 @@
355 *
356 * Without manual dispatch, it's racy to try and test that.
357 */
358+#pragma GCC diagnostic push
359+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
360 mir_window_set_event_handler(window, &dummy_event_handler_one, nullptr);
361 mir_window_set_event_handler(window, &dummy_event_handler_two, nullptr);
362+#pragma GCC diagnostic pop
363
364 mir_window_release_sync(window);
365 mir_connection_release(connection);
366
367=== modified file 'tests/acceptance-tests/test_client_surface_events.cpp'
368--- tests/acceptance-tests/test_client_surface_events.cpp 2017-01-07 03:43:23 +0000
369+++ tests/acceptance-tests/test_client_surface_events.cpp 2017-01-07 03:43:24 +0000
370@@ -128,12 +128,15 @@
371
372 mtf::ConnectedClientWithASurface::SetUp();
373
374+#pragma GCC diagnostic push
375+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
376 mir_window_set_event_handler(window, &event_callback, this);
377
378 scene_surface = the_latest_surface();
379
380 other_surface = mtf::make_any_surface(connection);
381 mir_window_set_event_handler(other_surface, nullptr, nullptr);
382+#pragma GCC diagnostic pop
383
384 reset_last_event();
385 }
386@@ -306,7 +309,10 @@
387 {
388 set_event_filter(mir_event_type_close_surface);
389
390+#pragma GCC diagnostic push
391+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
392 mir_window_set_event_handler(window, nullptr, nullptr);
393+#pragma GCC diagnostic pop
394 scene_surface->request_client_surface_close();
395
396 EXPECT_FALSE(wait_for_event(std::chrono::seconds(1)));
397@@ -348,6 +354,8 @@
398 auto window = mtf::make_any_surface(connection);
399
400 mt::Signal focus_received;
401+#pragma GCC diagnostic push
402+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
403 mir_window_set_event_handler(
404 window,
405 [](MirSurface*, MirEvent const* event, void* ctx)
406@@ -378,6 +386,7 @@
407 }
408 },
409 &unfocus_received);
410+#pragma GCC diagnostic pop
411
412 mir_window_release_sync(window);
413
414@@ -392,6 +401,8 @@
415 auto window = mtf::make_any_surface(connection);
416
417 mt::Signal focus_received;
418+#pragma GCC diagnostic push
419+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
420 mir_window_set_event_handler(
421 window,
422 [](MirSurface*, MirEvent const* event, void* ctx)
423@@ -422,6 +433,7 @@
424 }
425 },
426 &unfocus_received);
427+#pragma GCC diagnostic pop
428
429 // Add a new window that will take focus.
430 auto focus_grabbing_surface = mtf::make_any_surface(connection);
431
432=== modified file 'tests/acceptance-tests/test_client_surface_visibility.cpp'
433--- tests/acceptance-tests/test_client_surface_visibility.cpp 2017-01-07 03:43:23 +0000
434+++ tests/acceptance-tests/test_client_surface_visibility.cpp 2017-01-07 03:43:24 +0000
435@@ -127,7 +127,10 @@
436
437 ~Surface()
438 {
439+#pragma GCC diagnostic push
440+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
441 mir_window_set_event_handler(window, null_event_callback, nullptr);
442+#pragma GCC diagnostic pop
443 mir_window_release_sync(window);
444 }
445
446
447=== modified file 'tests/acceptance-tests/test_confined_pointer.cpp'
448--- tests/acceptance-tests/test_confined_pointer.cpp 2017-01-07 03:43:23 +0000
449+++ tests/acceptance-tests/test_confined_pointer.cpp 2017-01-07 03:43:24 +0000
450@@ -89,7 +89,10 @@
451 mir_window_get_error_message(window)});
452 }
453
454+#pragma GCC diagnostic push
455+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
456 mir_window_set_event_handler(window, handle_event, this);
457+#pragma GCC diagnostic pop
458 mir_buffer_stream_swap_buffers_sync(
459 mir_window_get_buffer_stream(window));
460
461@@ -148,7 +151,10 @@
462 // Remove the event handler to avoid handling spurious events unrelated
463 // to the tests (e.g. pointer leave events when the window is destroyed),
464 // which can cause test expectations to fail.
465+#pragma GCC diagnostic push
466+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
467 mir_window_set_event_handler(window, null_event_handler, nullptr);
468+#pragma GCC diagnostic pop
469 mir_window_release_sync(window);
470 mir_connection_release(connection);
471 }
472
473=== modified file 'tests/acceptance-tests/test_nested_input.cpp'
474--- tests/acceptance-tests/test_nested_input.cpp 2017-01-07 03:43:23 +0000
475+++ tests/acceptance-tests/test_nested_input.cpp 2017-01-07 03:43:24 +0000
476@@ -133,7 +133,10 @@
477 // Ensure the nested server posts a frame
478 connection = mir_connect_sync(connect_string.c_str(), __PRETTY_FUNCTION__);
479 window = mtf::make_any_surface(connection);
480+#pragma GCC diagnostic push
481+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
482 mir_window_set_event_handler(window, handle_event, this);
483+#pragma GCC diagnostic pop
484 mir_buffer_stream_swap_buffers_sync(mir_window_get_buffer_stream(window));
485 }
486
487@@ -173,7 +176,10 @@
488 static void null_event_handler(MirSurface*, MirEvent const*, void*) {};
489 ~ExposedSurface()
490 {
491+#pragma GCC diagnostic push
492+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
493 mir_window_set_event_handler(window, null_event_handler, nullptr);
494+#pragma GCC diagnostic pop
495 mir_window_release_sync(window);
496 mir_connection_release(connection);
497 }
498@@ -182,7 +188,7 @@
499 protected:
500 ExposedSurface(ExposedSurface const&) = delete;
501 ExposedSurface& operator=(ExposedSurface const&) = delete;
502-
503+
504 private:
505 MirConnection *connection;
506 MirWindow *window;
507
508=== modified file 'tests/acceptance-tests/test_nested_mir.cpp'
509--- tests/acceptance-tests/test_nested_mir.cpp 2017-01-07 03:43:23 +0000
510+++ tests/acceptance-tests/test_nested_mir.cpp 2017-01-07 03:43:24 +0000
511@@ -420,7 +420,10 @@
512
513 void wait_until_surface_ready(MirWindow* window)
514 {
515+#pragma GCC diagnostic push
516+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
517 mir_window_set_event_handler(window, wait_for_key_a_event, this);
518+#pragma GCC diagnostic pop
519
520 auto const dummy_events_received = mt::spin_wait_for_condition_or_timeout(
521 [this]
522@@ -436,7 +439,10 @@
523
524 EXPECT_TRUE(dummy_events_received);
525
526+#pragma GCC diagnostic push
527+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
528 mir_window_set_event_handler(window, nullptr, nullptr);
529+#pragma GCC diagnostic pop
530 }
531
532 protected:
533
534=== modified file 'tests/acceptance-tests/test_surface_raise.cpp'
535--- tests/acceptance-tests/test_surface_raise.cpp 2017-01-07 03:43:23 +0000
536+++ tests/acceptance-tests/test_surface_raise.cpp 2017-01-07 03:43:24 +0000
537@@ -52,8 +52,11 @@
538 {
539 ConnectedClientHeadlessServer::SetUp();
540
541- surface1 = mtf::make_any_surface(connection);
542+ surface1 = mtf::make_any_surface(connection);
543+#pragma GCC diagnostic push
544+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
545 mir_window_set_event_handler(surface1, &cookie_capturing_callback, this);
546+#pragma GCC diagnostic pop
547 mir_buffer_stream_swap_buffers_sync(
548 mir_window_get_buffer_stream(surface1));
549
550@@ -136,7 +139,7 @@
551 raise_surfaces->ready_to_accept_events.raise();
552 }
553 else if (event_type == mir_event_type_input)
554- {
555+ {
556 auto const* iev = mir_event_get_input_event(ev);
557
558 std::lock_guard<std::mutex> lk(raise_surfaces->mutex);
559@@ -152,7 +155,7 @@
560
561 raise_surfaces->out_cookies.push_back(cookie_bytes);
562 }
563-
564+
565 raise_surfaces->event_count++;
566 }
567 }
568@@ -180,7 +183,7 @@
569 return mir_surface_get_focus(surface) == mir_surface_focused;
570 },
571 std::chrono::seconds{max_wait});
572-
573+
574 return surface_becomes_focused;
575 }
576
577
578=== modified file 'tests/acceptance-tests/test_system_compositor_window_manager.cpp'
579--- tests/acceptance-tests/test_system_compositor_window_manager.cpp 2017-01-07 03:43:23 +0000
580+++ tests/acceptance-tests/test_system_compositor_window_manager.cpp 2017-01-07 03:43:24 +0000
581@@ -81,7 +81,10 @@
582 auto const window = mir_window_create_sync(spec);
583 mir_window_spec_release(spec);
584
585+#pragma GCC diagnostic push
586+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
587 mir_window_set_event_handler(window, on_surface_event, this);
588+#pragma GCC diagnostic pop
589
590 return SurfaceHandle{window};
591 };
592
593=== modified file 'tests/privileged-tests/test_input_events.cpp'
594--- tests/privileged-tests/test_input_events.cpp 2017-01-07 03:43:23 +0000
595+++ tests/privileged-tests/test_input_events.cpp 2017-01-07 03:43:24 +0000
596@@ -214,7 +214,10 @@
597 if (!mir_window_is_valid(window))
598 throw std::runtime_error("Failed to create MirSurface");
599
600+#pragma GCC diagnostic push
601+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
602 mir_window_set_event_handler(window, handle_input, handler);
603+#pragma GCC diagnostic pop
604 mir_buffer_stream_swap_buffers_sync(
605 mir_window_get_buffer_stream(window));
606

Subscribers

People subscribed via source and target branches