diff -Nru mir-0.27.0+17.10.20170629/debian/changelog mir-0.27.0+17.10.20170630/debian/changelog --- mir-0.27.0+17.10.20170629/debian/changelog 2017-06-30 12:02:15.000000000 +0000 +++ mir-0.27.0+17.10.20170630/debian/changelog 2017-06-30 12:02:15.000000000 +0000 @@ -1,4 +1,4 @@ -mir (0.27.0+17.10.20170629-0ubuntu1) artful; urgency=medium +mir (0.27.0+17.10.20170630-0ubuntu1) artful; urgency=medium [ Daniel van Vugt ] * New upstream release 0.27.0 (https://launchpad.net/mir/+milestone/0.27.0) @@ -146,7 +146,7 @@ . Correct eglsquare example: Don't paint from the window event handler. (LP: #1695221) - -- Alan Griffiths Thu, 29 Jun 2017 08:17:15 +0000 + -- Alan Griffiths Fri, 30 Jun 2017 12:00:38 +0000 mir (0.26.3+17.10.20170526.3-0ubuntu1) artful; urgency=medium diff -Nru mir-0.27.0+17.10.20170629/examples/eglapp.c mir-0.27.0+17.10.20170630/examples/eglapp.c --- mir-0.27.0+17.10.20170629/examples/eglapp.c 2017-06-29 08:16:30.000000000 +0000 +++ mir-0.27.0+17.10.20170630/examples/eglapp.c 2017-06-30 12:00:12.000000000 +0000 @@ -161,7 +161,6 @@ void mir_eglapp_handle_event(MirWindow* window, MirEvent const* ev, void* unused) { - (void) window; (void) unused; switch (mir_event_get_type(ev)) @@ -201,13 +200,13 @@ printf("Resized to %dx%d\n", new_width, new_height); if (surface) - { - mir_render_surface_set_size(surface, new_width, new_height); - MirWindowSpec* spec = mir_create_window_spec(connection); - mir_window_spec_add_render_surface(spec, surface, new_width, new_height, 0, 0); - mir_window_apply_spec(window, spec); - mir_window_spec_release(spec); - } + { + mir_render_surface_set_size(surface, new_width, new_height); + MirWindowSpec* spec = mir_create_window_spec(connection); + mir_window_spec_add_render_surface(spec, surface, new_width, new_height, 0, 0); + mir_window_apply_spec(window, spec); + mir_window_spec_release(spec); + } } static void show_help(struct mir_eglapp_arg const* const* arg_lists) @@ -462,6 +461,8 @@ name = p + 1; } mir_window_spec_set_name(spec, name); + mir_window_spec_set_event_handler(spec, mir_eglapp_handle_event, NULL); + mir_window_spec_set_cursor_name(spec, cursor_name); if (output_id != mir_display_output_id_invalid) mir_window_spec_set_fullscreen_on_output(spec, output_id); @@ -471,13 +472,6 @@ CHECK(mir_window_is_valid(window), "Can't create a window"); - mir_window_set_event_handler(window, mir_eglapp_handle_event, NULL); - - spec = mir_create_window_spec(connection); - mir_window_spec_set_cursor_name(spec, cursor_name); - mir_window_apply_spec(window, spec); - mir_window_spec_release(spec); - eglsurface = eglCreateWindowSurface(egldisplay, eglconfig, (EGLNativeWindowType)surface, @@ -498,14 +492,9 @@ { /* * Mir reserves the right to ignore our initial window dimensions and - * resize to whatever it likes. Usually that resize callback has - * occurred by now (see r4150), but libmirclient does not provide a - * solid guarantee of it. Luckily, we don't care... by querying EGL - * buffer dimensions we can get the correct answer without being - * victim to the callback race that's going on in the background... - * If the server has given us dimensions other than what we requested - * then EGL will already know about it, possibly before the initial - * resize event (!). + * resize to whatever it likes. In that case, a resize callback to + * mir_eglapp_handle_event() has occurred by now and we have resized + * the eglsurface. */ *width = buf_width; *height = buf_height; diff -Nru mir-0.27.0+17.10.20170629/src/client/mir_connection.cpp mir-0.27.0+17.10.20170630/src/client/mir_connection.cpp --- mir-0.27.0+17.10.20170629/src/client/mir_connection.cpp 2017-06-29 08:16:30.000000000 +0000 +++ mir-0.27.0+17.10.20170630/src/client/mir_connection.cpp 2017-06-30 12:00:12.000000000 +0000 @@ -276,21 +276,6 @@ MIR_LOG_UNCAUGHT_EXCEPTION(ex); } -void send_resize_event_if_needed(MirWindow *window, MirWindowSpec const& spec, mir::protobuf::Surface const& surface_proto) -{ - if (spec.width.is_set() && spec.height.is_set() && spec.event_handler.is_set()) - { - mir::geometry::Size requested_size{spec.width.value(), spec.height.value()}; - mir::geometry::Size actual_size{surface_proto.width(), surface_proto.height()}; - auto event_handler = spec.event_handler.value(); - if (requested_size != actual_size) - { - auto event = mev::make_event(mf::SurfaceId{surface_proto.id().value()}, actual_size); - event_handler.callback(window, event.get(), event_handler.context); - } - } -} - std::mutex connection_guard; MirConnection* valid_connections{nullptr}; } @@ -485,9 +470,22 @@ } callback(surf.get(), context); - request->wh->result_received(); - send_resize_event_if_needed(surf.get(), spec, *surface_proto); + if (spec.width.is_set() && spec.height.is_set() && spec.event_handler.is_set()) + { + mir::geometry::Size requested_size{spec.width.value(), spec.height.value()}; + mir::geometry::Size actual_size{(*surface_proto).width(), (*surface_proto).height()}; + auto event_handler = spec.event_handler.value(); + if (requested_size != actual_size) + { + auto event = mir::events::make_event(mir::frontend::SurfaceId{(*surface_proto).id().value()}, actual_size); + lock.unlock(); + event_handler.callback(surf.get(), event.get(), event_handler.context); + lock.lock(); + } + } + + request->wh->result_received(); surface_requests.erase(request_it); } diff -Nru mir-0.27.0+17.10.20170629/src/include/common/mir/protobuf/protocol_version.h mir-0.27.0+17.10.20170630/src/include/common/mir/protobuf/protocol_version.h --- mir-0.27.0+17.10.20170629/src/include/common/mir/protobuf/protocol_version.h 2017-06-29 08:15:44.000000000 +0000 +++ mir-0.27.0+17.10.20170630/src/include/common/mir/protobuf/protocol_version.h 2017-06-30 12:00:12.000000000 +0000 @@ -27,12 +27,12 @@ { inline constexpr int current_protocol_version() { - return MIR_VERSION_NUMBER(0,4,0); + return MIR_VERSION_NUMBER(0,5,0); } inline constexpr int oldest_compatible_protocol_version() { - return MIR_VERSION_NUMBER(0,4,0); + return MIR_VERSION_NUMBER(0,5,0); } inline constexpr int next_incompatible_protocol_version()