Mir

Merge lp:~andreas-pokorny/mir/reworked-external-output-centering-integration-branch into lp:mir

Proposed by Andreas Pokorny on 2015-02-28
Status: Work in progress
Proposed branch: lp:~andreas-pokorny/mir/reworked-external-output-centering-integration-branch
Merge into: lp:mir
Diff against target: 62199 lines (+12134/-27251)
820 files modified
3rd_party/CMakeLists.txt (+13/-1)
3rd_party/android-deps/std/Thread.h (+1/-4)
3rd_party/android-input/android/CMakeLists.txt (+4/-4)
3rd_party/android-input/android/frameworks/base/services/input/EventHub.cpp (+8/-41)
3rd_party/android-input/android/frameworks/base/services/input/EventHub.h (+12/-20)
3rd_party/android-input/android/frameworks/base/services/input/InputDispatcher.cpp (+1/-11)
3rd_party/android-input/android/frameworks/base/services/input/InputDispatcher.h (+0/-2)
3rd_party/android-input/android/frameworks/base/services/input/InputReader.cpp (+22/-6)
3rd_party/android-input/android/frameworks/base/services/input/MirLog.cpp (+3/-5)
3rd_party/android-input/android/frameworks/base/services/input/PointerController.cpp (+5/-0)
3rd_party/android-input/android/frameworks/base/services/input/PointerController.h (+4/-0)
3rd_party/android-input/android/frameworks/base/services/input/VelocityControl.cpp (+1/-1)
3rd_party/android-input/android/frameworks/base/services/input/VelocityTracker.cpp (+29/-34)
3rd_party/xcursor/CMakeLists.txt (+1/-1)
CMakeLists.txt (+11/-18)
benchmarks/android-input/CMakeLists.txt (+2/-2)
benchmarks/benchmark_multiplexing_dispatchable.cpp (+1/-0)
benchmarks/frame-uniformity/CMakeLists.txt (+9/-5)
benchmarks/frame-uniformity/main.cpp (+7/-8)
benchmarks/frame-uniformity/touch_measuring_client.cpp (+13/-9)
benchmarks/frame-uniformity/touch_measuring_client.h (+5/-0)
benchmarks/frame-uniformity/touch_producing_server.cpp (+2/-2)
benchmarks/frame-uniformity/touch_samples.cpp (+15/-18)
benchmarks/frame-uniformity/vsync_simulating_graphics_platform.cpp (+19/-22)
cmake/ABICheck.cmake (+2/-12)
cmake/FindGtestGmock.cmake (+0/-2)
cmake/MirCommon.cmake (+118/-89)
cmake/src/mir/CMakeLists.txt (+10/-0)
cmake/src/mir/mir_discover_gtest_tests.cpp (+405/-0)
debian/changelog (+11/-166)
debian/control (+14/-13)
debian/libmirclient-debug-extension1.install (+1/-1)
debian/libmirclient-dev.install (+0/-3)
debian/libmircommon3.install (+1/-1)
debian/libmirserver30.install (+1/-1)
debian/mir-demos.install (+1/-2)
debian/mir-platform-graphics-android1.install (+1/-1)
debian/mir-platform-graphics-mesa1.install (+1/-1)
debian/mir-test-tools.install (+0/-2)
debian/rules (+8/-2)
doc/component_reports.md (+13/-17)
doc/demo_shell_controls.md (+0/-1)
doc/footer.html.in (+1/-1)
doc/mainpage.md (+2/-8)
examples/CMakeLists.txt (+7/-57)
examples/animated_cursor_demo_client.c (+0/-90)
examples/demo_client_display_config.c (+6/-5)
examples/eglapp.c (+13/-18)
examples/eglsquare.cpp (+0/-417)
examples/fingerpaint.c (+55/-60)
examples/mir_demo_server_loader.cpp (+0/-46)
examples/multiwin.c (+5/-12)
examples/progressbar.c (+6/-12)
examples/render_overlays.cpp (+6/-10)
examples/render_surfaces.cpp (+16/-25)
examples/render_to_fb.cpp (+10/-14)
examples/server_example.cpp (+5/-9)
examples/server_example_adorning_compositor.cpp (+0/-163)
examples/server_example_adorning_compositor.h (+0/-82)
examples/server_example_basic_window_manager.h (+42/-149)
examples/server_example_canonical_window_manager.cpp (+0/-948)
examples/server_example_canonical_window_manager.h (+0/-157)
examples/server_example_custom_compositor.cpp (+0/-103)
examples/server_example_custom_compositor.h (+0/-33)
examples/server_example_fullscreen_placement_strategy.cpp (+63/-0)
examples/server_example_fullscreen_placement_strategy.h (+57/-0)
examples/server_example_generic_shell.cpp (+125/-0)
examples/server_example_generic_shell.h (+73/-0)
examples/server_example_input_event_filter.cpp (+4/-4)
examples/server_example_input_filter.cpp (+16/-14)
examples/server_example_shell.cpp (+153/-0)
examples/server_example_shell.h (+66/-0)
examples/server_example_test_client.cpp (+5/-6)
examples/server_example_tiling_window_manager.cpp (+56/-103)
examples/server_example_tiling_window_manager.h (+9/-20)
examples/server_example_window_management.cpp (+82/-114)
examples/server_example_window_manager.h (+15/-27)
examples/target.c (+0/-342)
examples/tooltip.c (+5/-18)
include/client/mir/event_printer.h (+0/-54)
include/client/mir_toolkit/events/input_configuration_event.h (+0/-78)
include/client/mir_toolkit/events/keymap_event.h (+0/-48)
include/client/mir_toolkit/mir_buffer_stream.h (+9/-89)
include/client/mir_toolkit/mir_client_library.h (+0/-1)
include/client/mir_toolkit/mir_client_library_drm.h (+2/-4)
include/client/mir_toolkit/mir_cursor_configuration.h (+0/-14)
include/client/mir_toolkit/mir_surface.h (+4/-122)
include/common/mir/dispatch/action_queue.h (+0/-53)
include/common/mir/dispatch/multiplexing_dispatchable.h (+2/-0)
include/common/mir/dispatch/simple_dispatch_thread.h (+0/-2)
include/common/mir/events/event_builders.h (+10/-11)
include/common/mir/flags.h (+0/-161)
include/common/mir/frontend/buffer_stream_id.h (+0/-33)
include/common/mir/geometry/dimensions.h (+17/-29)
include/common/mir/geometry/displacement.h (+0/-5)
include/common/mir/geometry/overrides.h (+92/-0)
include/common/mir/geometry/point.h (+0/-9)
include/common/mir/input/input_platform.h (+8/-13)
include/common/mir/input/input_receiver_thread.h (+48/-0)
include/common/mir/module_deleter.h (+0/-105)
include/common/mir/optional_value.h (+1/-4)
include/common/mir_toolkit/client_types.h (+20/-3)
include/common/mir_toolkit/common.h (+2/-0)
include/common/mir_toolkit/cursors.h (+0/-6)
include/common/mir_toolkit/events/event.h (+10/-27)
include/common/mir_toolkit/events/event_deprecated.h (+79/-38)
include/common/mir_toolkit/events/input/input_event.h (+12/-12)
include/common/mir_toolkit/events/input/key_input_event.h (+14/-23)
include/common/mir_toolkit/events/input/pointer_input_event.h (+27/-27)
include/common/mir_toolkit/events/input/touch_input_event.h (+27/-27)
include/platform/mir/graphics/buffer.h (+3/-8)
include/platform/mir/graphics/cursor.h (+2/-0)
include/platform/mir/graphics/display.h (+2/-33)
include/platform/mir/graphics/display_buffer.h (+28/-0)
include/platform/mir/graphics/platform.h (+14/-17)
include/platform/mir/graphics/renderable.h (+3/-2)
include/platform/mir/input/device_capability.h (+0/-51)
include/platform/mir/input/input_device.h (+0/-65)
include/platform/mir/input/input_device_info.h (+0/-42)
include/platform/mir/input/input_device_registry.h (+0/-48)
include/platform/mir/input/input_sink.h (+0/-54)
include/platform/mir/input/platform.h (+0/-143)
include/server/mir/compositor/display_listener.h (+0/-43)
include/server/mir/frontend/buffer_stream.h (+0/-66)
include/server/mir/frontend/session.h (+0/-7)
include/server/mir/frontend/surface.h (+2/-8)
include/server/mir/input/input_device_hub.h (+0/-47)
include/server/mir/input/input_device_observer.h (+0/-49)
include/server/mir/input/input_dispatcher.h (+8/-0)
include/server/mir/input/input_manager.h (+0/-4)
include/server/mir/input/input_region.h (+7/-0)
include/server/mir/lockable_callback.h (+0/-40)
include/server/mir/main_loop.h (+3/-3)
include/server/mir/scene/null_surface_observer.h (+0/-2)
include/server/mir/scene/session.h (+0/-6)
include/server/mir/scene/surface.h (+4/-4)
include/server/mir/scene/surface_configurator.h (+54/-0)
include/server/mir/scene/surface_coordinator.h (+2/-15)
include/server/mir/scene/surface_creation_parameters.h (+0/-10)
include/server/mir/scene/surface_observer.h (+0/-3)
include/server/mir/server.h (+13/-14)
include/server/mir/shell/abstract_shell.h (+20/-33)
include/server/mir/shell/focus_controller.h (+4/-18)
include/server/mir/shell/input_targeter.h (+3/-3)
include/server/mir/shell/shell.h (+4/-12)
include/server/mir/shell/shell_wrapper.h (+7/-20)
include/server/mir/shell/surface_ready_observer.h (+0/-58)
include/server/mir/shell/surface_specification.h (+0/-74)
include/server/mir/shell/window_manager_builder.h (+0/-37)
include/server/mir/time/timer.h (+39/-14)
playground/demo-shell/CMakeLists.txt (+0/-3)
playground/demo-shell/demo_compositor.cpp (+18/-11)
playground/demo-shell/demo_renderer.cpp (+14/-53)
playground/demo-shell/demo_renderer.h (+5/-11)
playground/demo-shell/demo_shell.cpp (+32/-43)
playground/demo-shell/typo/CMakeLists.txt (+0/-25)
playground/demo-shell/typo/typo_freetype_renderer.cpp (+0/-125)
playground/demo-shell/typo/typo_freetype_renderer.h (+0/-44)
playground/demo-shell/typo/typo_glcache.cpp (+0/-98)
playground/demo-shell/typo/typo_glcache.h (+0/-56)
playground/demo-shell/typo/typo_renderer.cpp (+0/-58)
playground/demo-shell/typo/typo_renderer.h (+0/-47)
playground/demo-shell/typo/typo_stub_renderer.cpp (+0/-47)
playground/demo-shell/typo/typo_stub_renderer.h (+0/-34)
playground/demo-shell/window_manager.cpp (+320/-407)
playground/demo-shell/window_manager.h (+0/-3)
playground/server_configuration.cpp (+7/-19)
playground/server_configuration.h (+0/-5)
src/client/CMakeLists.txt (+22/-33)
src/client/buffer_stream.cpp (+1/-90)
src/client/buffer_stream.h (+0/-20)
src/client/client_buffer_depository.cpp (+3/-14)
src/client/client_buffer_depository.h (+2/-2)
src/client/client_buffer_stream.h (+1/-12)
src/client/client_buffer_stream_factory.h (+0/-8)
src/client/cursor_configuration.h (+0/-12)
src/client/default_client_buffer_stream_factory.cpp (+0/-12)
src/client/default_client_buffer_stream_factory.h (+0/-4)
src/client/default_connection_configuration.cpp (+19/-0)
src/client/event_printer.cpp (+0/-348)
src/client/input/android/event_conversion_helpers.cpp (+0/-102)
src/client/logging/input_receiver_report.cpp (+82/-2)
src/client/logging/rpc_report.cpp (+17/-0)
src/client/logging/rpc_report.h (+3/-0)
src/client/lttng/CMakeLists.txt (+4/-5)
src/client/lttng/input_receiver_report.cpp (+15/-15)
src/client/lttng/perf_report.cpp (+0/-40)
src/client/lttng/perf_report.h (+0/-43)
src/client/lttng/perf_report_tp.h (+0/-51)
src/client/lttng/rpc_report.cpp (+9/-0)
src/client/lttng/rpc_report.h (+3/-0)
src/client/lttng/tracepoints.c (+0/-1)
src/client/mir_buffer_stream_api.cpp (+10/-91)
src/client/mir_connection.cpp (+10/-1)
src/client/mir_connection.h (+1/-1)
src/client/mir_cursor_api.cpp (+16/-40)
src/client/mir_surface.cpp (+30/-162)
src/client/mir_surface.h (+9/-33)
src/client/mir_surface_api.cpp (+15/-133)
src/client/perf_report.h (+1/-5)
src/client/rpc/CMakeLists.txt (+1/-1)
src/client/rpc/mir_protobuf_rpc_channel.cpp (+4/-11)
src/client/rpc/null_rpc_report.cpp (+9/-0)
src/client/rpc/null_rpc_report.h (+3/-0)
src/client/rpc/rpc_report.h (+3/-0)
src/client/rpc/stream_socket_transport.cpp (+37/-23)
src/client/rpc/stream_socket_transport.h (+4/-15)
src/client/rpc/stream_transport.h (+0/-7)
src/client/symbols-debug.map (+8/-0)
src/client/symbols.map (+25/-206)
src/common/CMakeLists.txt (+11/-1)
src/common/dispatch/CMakeLists.txt (+0/-2)
src/common/dispatch/action_queue.cpp (+0/-98)
src/common/dispatch/simple_dispatch_thread.cpp (+22/-69)
src/common/event.cpp (+1/-42)
src/common/events/CMakeLists.txt (+2/-2)
src/common/events/event_builders.cpp (+104/-65)
src/common/geometry/ostream.cpp (+1/-0)
src/common/geometry/rectangle.cpp (+2/-2)
src/common/geometry/rectangles.cpp (+3/-1)
src/common/graphics/android/CMakeLists.txt (+1/-1)
src/common/graphics/android/mir_native_window.cpp (+11/-6)
src/common/input/CMakeLists.txt (+16/-10)
src/common/input/android/CMakeLists.txt (+1/-1)
src/common/input/android/android_input_lexicon.cpp (+20/-7)
src/common/input/android/android_input_platform.cpp (+6/-8)
src/common/input/android/android_input_platform.h (+8/-13)
src/common/input/android/android_input_receiver.cpp (+77/-148)
src/common/input/android/android_input_receiver.h (+16/-24)
src/common/input/android/android_input_receiver_thread.cpp (+70/-0)
src/common/input/android/android_input_receiver_thread.h (+71/-0)
src/common/input/input_event.cpp (+141/-79)
src/common/input/udev_wrapper.cpp (+2/-2)
src/common/input/xkb_mapper.cpp (+11/-20)
src/common/logging/input_timestamp.cpp (+2/-0)
src/common/logging/logger.cpp (+2/-2)
src/common/logging/shared_library_prober_report.cpp (+4/-5)
src/common/sharedlibrary/CMakeLists.txt (+1/-5)
src/common/sharedlibrary/module_deleter.cpp (+0/-56)
src/common/sharedlibrary/shared_library.cpp (+1/-1)
src/common/symbols.map (+157/-60)
src/common/thread/CMakeLists.txt (+1/-2)
src/common/thread/signal_blocker.cpp (+0/-48)
src/include/client/mir/client_platform_factory.h (+5/-4)
src/include/client/mir/egl_native_surface.h (+0/-1)
src/include/common/mir/graphics/android/android_driver_interpreter.h (+0/-1)
src/include/common/mir/input/android/event_conversion_helpers.h (+0/-45)
src/include/common/mir/input/xkb_mapper.h (+3/-6)
src/include/common/mir/logging/input_timestamp.h (+5/-1)
src/include/common/mir/signal_blocker.h (+0/-39)
src/include/platform/mir/graphics/display_report.h (+0/-2)
src/include/platform/mir/graphics/egl_error.h (+0/-40)
src/include/platform/mir/options/configuration.h (+0/-2)
src/include/server/mir/basic_callback.h (+0/-44)
src/include/server/mir/compositor/buffer_stream.h (+7/-3)
src/include/server/mir/compositor/compositor_report.h (+4/-7)
src/include/server/mir/compositor/decoration.h (+0/-38)
src/include/server/mir/compositor/destination_alpha.h (+36/-0)
src/include/server/mir/compositor/frame_dropping_policy_factory.h (+5/-5)
src/include/server/mir/compositor/gl_renderer.h (+11/-5)
src/include/server/mir/compositor/renderer_factory.h (+3/-1)
src/include/server/mir/compositor/scene_element.h (+5/-5)
src/include/server/mir/default_server_configuration.h (+5/-20)
src/include/server/mir/display_changer.h (+1/-0)
src/include/server/mir/frontend/shell.h (+2/-3)
src/include/server/mir/glib_main_loop.h (+15/-5)
src/include/server/mir/glib_main_loop_sources.h (+3/-3)
src/include/server/mir/input/input_report.h (+4/-7)
src/include/server/mir/lockable_callback_wrapper.h (+0/-51)
src/include/server/mir/scene/buffer_stream_factory.h (+0/-2)
src/include/server/mir/scene/surface_event_source.h (+0/-1)
src/include/server/mir/scene/surface_factory.h (+1/-4)
src/include/server/mir/scene/surface_observers.h (+0/-54)
src/include/server/mir/shell/basic_window_manager.h (+0/-337)
src/include/server/mir/shell/canonical_window_manager.h (+0/-151)
src/include/server/mir/shell/default_window_manager.h (+0/-81)
src/platform/CMakeLists.txt (+4/-6)
src/platform/graphics/CMakeLists.txt (+0/-1)
src/platform/graphics/egl_error.cpp (+0/-72)
src/platform/graphics/egl_resources.cpp (+2/-3)
src/platform/graphics/platform_probe.cpp (+11/-12)
src/platform/options/default_configuration.cpp (+20/-6)
src/platform/symbols.map (+1/-21)
src/platform/udev/CMakeLists.txt (+0/-6)
src/platforms/CMakeLists.txt (+1/-5)
src/platforms/android/client/CMakeLists.txt (+2/-2)
src/platforms/android/client/client_platform_factory.cpp (+2/-2)
src/platforms/android/client/egl_native_surface_interpreter.cpp (+0/-7)
src/platforms/android/client/egl_native_surface_interpreter.h (+5/-6)
src/platforms/android/client/gralloc_registrar.cpp (+1/-1)
src/platforms/android/server/CMakeLists.txt (+2/-3)
src/platforms/android/server/android_buffer_allocator.cpp (+0/-19)
src/platforms/android/server/android_graphic_buffer_allocator.h (+3/-6)
src/platforms/android/server/buffer.cpp (+7/-33)
src/platforms/android/server/buffer.h (+0/-1)
src/platforms/android/server/configurable_display_buffer.h (+2/-3)
src/platforms/android/server/display.cpp (+58/-59)
src/platforms/android/server/display.h (+5/-5)
src/platforms/android/server/display_buffer.cpp (+24/-15)
src/platforms/android/server/display_buffer.h (+5/-4)
src/platforms/android/server/display_component_factory.h (+2/-2)
src/platforms/android/server/display_configuration.cpp (+104/-15)
src/platforms/android/server/display_configuration.h (+3/-2)
src/platforms/android/server/display_device.h (+9/-10)
src/platforms/android/server/display_group.cpp (+0/-81)
src/platforms/android/server/display_group.h (+0/-62)
src/platforms/android/server/fb_device.cpp (+25/-31)
src/platforms/android/server/fb_device.h (+9/-5)
src/platforms/android/server/framebuffer_bundle.h (+2/-0)
src/platforms/android/server/framebuffers.cpp (+13/-1)
src/platforms/android/server/framebuffers.h (+9/-8)
src/platforms/android/server/gl_context.cpp (+10/-6)
src/platforms/android/server/hal_component_factory.cpp (+13/-15)
src/platforms/android/server/hal_component_factory.h (+1/-4)
src/platforms/android/server/hwc_blanking_control.cpp (+28/-151)
src/platforms/android/server/hwc_configuration.h (+15/-24)
src/platforms/android/server/hwc_device.cpp (+97/-34)
src/platforms/android/server/hwc_device.h (+28/-1)
src/platforms/android/server/hwc_fb_device.cpp (+13/-10)
src/platforms/android/server/hwc_fb_device.h (+7/-1)
src/platforms/android/server/hwc_loggers.cpp (+5/-52)
src/platforms/android/server/hwc_loggers.h (+0/-2)
src/platforms/android/server/hwc_report.h (+0/-5)
src/platforms/android/server/hwc_wrapper.h (+0/-5)
src/platforms/android/server/platform.cpp (+2/-2)
src/platforms/android/server/platform.h (+2/-0)
src/platforms/android/server/power_mode.h (+0/-43)
src/platforms/android/server/real_hwc_wrapper.cpp (+0/-36)
src/platforms/android/server/real_hwc_wrapper.h (+0/-4)
src/platforms/android/server/resource_factory.cpp (+0/-1)
src/platforms/android/server/server_render_window.cpp (+1/-7)
src/platforms/android/server/server_render_window.h (+5/-7)
src/platforms/android/server/symbols.map (+1/-1)
src/platforms/common/server/symbols.map (+9/-0)
src/platforms/mesa/client/CMakeLists.txt (+1/-1)
src/platforms/mesa/client/client_platform.cpp (+0/-15)
src/platforms/mesa/client/client_platform_factory.cpp (+2/-2)
src/platforms/mesa/include/mir_toolkit/mesa/native_display.h (+2/-0)
src/platforms/mesa/server/CMakeLists.txt (+1/-1)
src/platforms/mesa/server/buffer_allocator.cpp (+2/-33)
src/platforms/mesa/server/buffer_allocator.h (+0/-2)
src/platforms/mesa/server/cursor.cpp (+15/-2)
src/platforms/mesa/server/cursor.h (+3/-0)
src/platforms/mesa/server/display.cpp (+3/-3)
src/platforms/mesa/server/display.h (+2/-2)
src/platforms/mesa/server/display_buffer.cpp (+88/-62)
src/platforms/mesa/server/display_buffer.h (+8/-13)
src/platforms/mesa/server/display_helpers.cpp (+7/-9)
src/platforms/mesa/server/gbm_buffer.cpp (+0/-5)
src/platforms/mesa/server/gbm_buffer.h (+0/-1)
src/platforms/mesa/server/guest_platform.cpp (+1/-0)
src/platforms/mesa/server/kms_page_flipper.cpp (+11/-19)
src/platforms/mesa/server/kms_page_flipper.h (+2/-5)
src/platforms/mesa/server/platform.cpp (+2/-17)
src/platforms/mesa/server/real_kms_output.cpp (+1/-0)
src/platforms/mesa/server/shm_buffer.cpp (+0/-5)
src/platforms/mesa/server/shm_buffer.h (+0/-1)
src/platforms/mesa/server/symbols.map (+1/-1)
src/protobuf/CMakeLists.txt (+1/-3)
src/protobuf/mir_protobuf.proto (+10/-64)
src/server/CMakeLists.txt (+4/-11)
src/server/basic_callback.cpp (+0/-37)
src/server/compositor/buffer_queue.cpp (+30/-53)
src/server/compositor/buffer_queue.h (+1/-2)
src/server/compositor/buffer_stream_factory.cpp (+6/-17)
src/server/compositor/buffer_stream_factory.h (+3/-6)
src/server/compositor/buffer_stream_surfaces.cpp (+15/-51)
src/server/compositor/buffer_stream_surfaces.h (+5/-16)
src/server/compositor/default_configuration.cpp (+2/-6)
src/server/compositor/default_display_buffer_compositor.cpp (+4/-4)
src/server/compositor/default_display_buffer_compositor_factory.cpp (+4/-1)
src/server/compositor/default_display_buffer_compositor_factory.h (+2/-0)
src/server/compositor/gl_program_family.cpp (+0/-5)
src/server/compositor/gl_renderer.cpp (+26/-14)
src/server/compositor/gl_renderer_factory.cpp (+8/-2)
src/server/compositor/gl_renderer_factory.h (+2/-1)
src/server/compositor/multi_threaded_compositor.cpp (+41/-84)
src/server/compositor/multi_threaded_compositor.h (+5/-10)
src/server/compositor/recently_used_cache.cpp (+1/-0)
src/server/compositor/screencast_display_buffer.cpp (+9/-0)
src/server/compositor/screencast_display_buffer.h (+3/-0)
src/server/compositor/temporary_buffers.cpp (+0/-5)
src/server/compositor/temporary_buffers.h (+0/-1)
src/server/compositor/timeout_frame_dropping_policy_factory.cpp (+21/-13)
src/server/compositor/timeout_frame_dropping_policy_factory.h (+9/-8)
src/server/default_server_configuration.cpp (+20/-0)
src/server/display_server.cpp (+25/-20)
src/server/frontend/CMakeLists.txt (+1/-1)
src/server/frontend/event_sender.cpp (+2/-1)
src/server/frontend/protobuf_buffer_packer.h (+1/-7)
src/server/frontend/protobuf_message_processor.cpp (+0/-18)
src/server/frontend/protobuf_message_processor.h (+0/-1)
src/server/frontend/session_mediator.cpp (+229/-349)
src/server/frontend/session_mediator.h (+7/-29)
src/server/frontend/shell_wrapper.cpp (+6/-5)
src/server/frontend/shell_wrapper.h (+2/-2)
src/server/frontend/socket_messenger.cpp (+1/-0)
src/server/frontend/surface_tracker.cpp (+12/-16)
src/server/frontend/surface_tracker.h (+23/-21)
src/server/glib_main_loop.cpp (+52/-26)
src/server/glib_main_loop_sources.cpp (+25/-28)
src/server/graphics/default_configuration.cpp (+21/-32)
src/server/graphics/nested/CMakeLists.txt (+7/-3)
src/server/graphics/nested/cursor.cpp (+0/-52)
src/server/graphics/nested/cursor.h (+0/-51)
src/server/graphics/nested/host_connection.h (+18/-9)
src/server/graphics/nested/host_surface.h (+0/-51)
src/server/graphics/nested/mir_client_host_connection.cpp (+9/-94)
src/server/graphics/nested/mir_client_host_connection.h (+1/-11)
src/server/graphics/nested/nested_display.cpp (+35/-54)
src/server/graphics/nested/nested_display.h (+14/-30)
src/server/graphics/nested/nested_output.cpp (+31/-34)
src/server/graphics/nested/nested_output.h (+9/-16)
src/server/graphics/offscreen/display.cpp (+8/-25)
src/server/graphics/offscreen/display.h (+2/-12)
src/server/graphics/offscreen/display_buffer.cpp (+9/-0)
src/server/graphics/offscreen/display_buffer.h (+2/-0)
src/server/graphics/software_cursor.cpp (+143/-2)
src/server/graphics/software_cursor.h (+12/-0)
src/server/graphics/surfaceless_egl_context.cpp (+4/-4)
src/server/input/CMakeLists.txt (+0/-2)
src/server/input/android/CMakeLists.txt (+1/-1)
src/server/input/android/android_input_dispatcher.cpp (+24/-34)
src/server/input/android/android_input_dispatcher.h (+2/-0)
src/server/input/android/android_input_manager.cpp (+57/-0)
src/server/input/android/android_input_manager.h (+65/-0)
src/server/input/android/android_input_reader_policy.cpp (+16/-2)
src/server/input/android/android_input_targeter.cpp (+3/-5)
src/server/input/android/android_input_targeter.h (+2/-2)
src/server/input/android/android_pointer_controller.cpp (+26/-0)
src/server/input/android/android_pointer_controller.h (+2/-0)
src/server/input/android/event_filter_dispatcher_policy.cpp (+2/-1)
src/server/input/android/event_filter_dispatcher_policy.h (+3/-4)
src/server/input/android/input_reader_dispatchable.cpp (+0/-54)
src/server/input/android/input_reader_dispatchable.h (+0/-56)
src/server/input/android/input_sender.cpp (+19/-21)
src/server/input/android/input_translator.cpp (+43/-36)
src/server/input/cursor_controller.cpp (+2/-2)
src/server/input/default_configuration.cpp (+42/-129)
src/server/input/default_input_device_hub.cpp (+0/-300)
src/server/input/default_input_device_hub.h (+0/-114)
src/server/input/default_input_manager.cpp (+0/-144)
src/server/input/default_input_manager.h (+0/-79)
src/server/input/display_input_region.cpp (+72/-27)
src/server/input/display_input_region.h (+15/-3)
src/server/input/null_input_dispatcher.cpp (+10/-0)
src/server/input/null_input_dispatcher.h (+2/-0)
src/server/input/null_input_manager.h (+0/-3)
src/server/input/null_input_targeter.cpp (+2/-2)
src/server/input/null_input_targeter.h (+2/-2)
src/server/input/touchspot_controller.cpp (+1/-2)
src/server/input/vt_filter.cpp (+5/-4)
src/server/lockable_callback_wrapper.cpp (+0/-54)
src/server/report/logging/compositor_report.cpp (+0/-4)
src/server/report/logging/compositor_report.h (+0/-1)
src/server/report/logging/display_report.cpp (+1/-26)
src/server/report/logging/display_report.h (+13/-24)
src/server/report/logging/input_report.cpp (+2/-102)
src/server/report/logging/input_report.h (+7/-9)
src/server/report/logging/logging_report_factory.cpp (+1/-1)
src/server/report/lttng/compositor_report.cpp (+1/-11)
src/server/report/lttng/compositor_report.h (+4/-5)
src/server/report/lttng/compositor_report_tp.h (+0/-10)
src/server/report/lttng/display_report.cpp (+6/-2)
src/server/report/lttng/display_report.h (+11/-10)
src/server/report/lttng/display_report_tp.h (+0/-9)
src/server/report/lttng/input_report.cpp (+0/-10)
src/server/report/lttng/input_report.h (+0/-2)
src/server/report/lttng/input_report_tp.h (+0/-20)
src/server/report/lttng/message_processor_report.cpp (+2/-0)
src/server/report/null/compositor_report.cpp (+0/-4)
src/server/report/null/compositor_report.h (+0/-1)
src/server/report/null/display_report.cpp (+0/-1)
src/server/report/null/display_report.h (+0/-1)
src/server/report/null/input_report.cpp (+0/-6)
src/server/report/null/input_report.h (+6/-9)
src/server/run_mir.cpp (+1/-3)
src/server/scene/application_session.cpp (+25/-109)
src/server/scene/application_session.h (+2/-16)
src/server/scene/basic_surface.cpp (+61/-168)
src/server/scene/basic_surface.h (+30/-16)
src/server/scene/default_configuration.cpp (+1/-4)
src/server/scene/default_coordinate_translator.cpp (+1/-2)
src/server/scene/default_session_container.cpp (+2/-0)
src/server/scene/legacy_scene_change_notification.cpp (+2/-1)
src/server/scene/legacy_surface_change_notification.cpp (+0/-10)
src/server/scene/legacy_surface_change_notification.h (+0/-2)
src/server/scene/mediating_display_changer.cpp (+17/-0)
src/server/scene/mediating_display_changer.h (+5/-0)
src/server/scene/null_surface_observer.cpp (+0/-2)
src/server/scene/prompt_session_container.cpp (+4/-1)
src/server/scene/session_manager.cpp (+6/-10)
src/server/scene/session_manager.h (+1/-6)
src/server/scene/surface_allocator.cpp (+7/-3)
src/server/scene/surface_allocator.h (+9/-9)
src/server/scene/surface_controller.cpp (+5/-16)
src/server/scene/surface_controller.h (+3/-8)
src/server/scene/surface_event_source.cpp (+0/-5)
src/server/scene/surface_stack.cpp (+10/-72)
src/server/scene/surface_stack.h (+0/-4)
src/server/scene/surface_stack_model.h (+1/-10)
src/server/scene/threaded_snapshot_strategy.cpp (+7/-4)
src/server/server.cpp (+8/-20)
src/server/shell/CMakeLists.txt (+1/-3)
src/server/shell/abstract_shell.cpp (+73/-128)
src/server/shell/canonical_window_manager.cpp (+0/-791)
src/server/shell/default_configuration.cpp (+4/-17)
src/server/shell/default_shell.cpp (+96/-0)
src/server/shell/default_shell.h (+73/-0)
src/server/shell/default_window_manager.cpp (+0/-125)
src/server/shell/frontend_shell.cpp (+8/-17)
src/server/shell/frontend_shell.h (+2/-2)
src/server/shell/graphics_display_layout.cpp (+16/-16)
src/server/shell/shell_wrapper.cpp (+18/-52)
src/server/shell/surface_ready_observer.cpp (+0/-45)
src/server/symbols.map (+255/-113)
src/utils/out.c (+1/-1)
src/utils/ping.c (+1/-1)
src/utils/screencast.cpp (+74/-186)
src/wrapper.c (+0/-3)
tests/CMakeLists.txt (+0/-5)
tests/acceptance-tests/CMakeLists.txt (+16/-17)
tests/acceptance-tests/server_configuration_wrapping.cpp (+3/-3)
tests/acceptance-tests/server_signal_handling.cpp (+3/-4)
tests/acceptance-tests/test_client_focus_notification.cpp (+24/-18)
tests/acceptance-tests/test_client_input.cpp (+0/-574)
tests/acceptance-tests/test_client_library.cpp (+152/-232)
tests/acceptance-tests/test_client_library_errors.cpp (+1/-5)
tests/acceptance-tests/test_client_surface_events.cpp (+44/-32)
tests/acceptance-tests/test_client_surface_visibility.cpp (+22/-18)
tests/acceptance-tests/test_client_surfaces.cpp (+0/-32)
tests/acceptance-tests/test_custom_input_dispatcher.cpp (+0/-98)
tests/acceptance-tests/test_custom_window_management.cpp (+0/-274)
tests/acceptance-tests/test_debug_api.cpp (+11/-23)
tests/acceptance-tests/test_display_configuration.cpp (+10/-14)
tests/acceptance-tests/test_input_device_hub.cpp (+0/-84)
tests/acceptance-tests/test_latency.cpp (+0/-204)
tests/acceptance-tests/test_nested_input.cpp (+0/-157)
tests/acceptance-tests/test_nested_mir.cpp (+130/-41)
tests/acceptance-tests/test_render_override.cpp (+0/-132)
tests/acceptance-tests/test_server_disconnect.cpp (+3/-6)
tests/acceptance-tests/test_server_shutdown.cpp (+6/-7)
tests/acceptance-tests/test_server_without_active_outputs.cpp (+1/-1)
tests/acceptance-tests/test_surface_modifications.cpp (+0/-507)
tests/acceptance-tests/test_surface_placement.cpp (+0/-370)
tests/acceptance-tests/test_surfaces_with_output_id.cpp (+1/-0)
tests/acceptance-tests/test_unresponsive_client.cpp (+2/-2)
tests/acceptance-tests/throwback/CMakeLists.txt (+3/-1)
tests/acceptance-tests/throwback/clients.cpp (+0/-1)
tests/acceptance-tests/throwback/test_client_cursor_api.cpp (+12/-115)
tests/acceptance-tests/throwback/test_client_input.cpp (+626/-0)
tests/acceptance-tests/throwback/test_custom_input_dispatcher.cpp (+101/-32)
tests/acceptance-tests/throwback/test_focus_selection.cpp (+11/-2)
tests/acceptance-tests/throwback/test_shell_control_of_surface_configuration.cpp (+109/-86)
tests/acceptance-tests/throwback/test_touchspot_visualization.cpp (+64/-44)
tests/include/mir_test/auto_unblock_thread.h (+14/-33)
tests/include/mir_test/cross_process_action.h (+4/-3)
tests/include/mir_test/event_matchers.h (+59/-135)
tests/include/mir_test/fake_event_hub.h (+2/-6)
tests/include/mir_test/signal.h (+3/-3)
tests/include/mir_test_doubles/mock_android_alloc_device.h (+15/-32)
tests/include/mir_test_doubles/mock_buffer.h (+0/-1)
tests/include/mir_test_doubles/mock_buffer_bundle.h (+4/-5)
tests/include/mir_test_doubles/mock_buffer_stream.h (+2/-18)
tests/include/mir_test_doubles/mock_client_buffer_factory.h (+0/-3)
tests/include/mir_test_doubles/mock_client_buffer_stream.h (+0/-5)
tests/include/mir_test_doubles/mock_client_buffer_stream_factory.h (+0/-6)
tests/include/mir_test_doubles/mock_compositor_report.h (+0/-2)
tests/include/mir_test_doubles/mock_display.h (+1/-1)
tests/include/mir_test_doubles/mock_display_buffer.h (+2/-0)
tests/include/mir_test_doubles/mock_display_device.h (+7/-1)
tests/include/mir_test_doubles/mock_display_report.h (+2/-1)
tests/include/mir_test_doubles/mock_egl.h (+1/-8)
tests/include/mir_test_doubles/mock_egl_native_surface.h (+0/-1)
tests/include/mir_test_doubles/mock_event_filter.h (+2/-0)
tests/include/mir_test_doubles/mock_event_hub.h (+0/-69)
tests/include/mir_test_doubles/mock_frame_dropping_policy_factory.h (+13/-9)
tests/include/mir_test_doubles/mock_framebuffer_bundle.h (+8/-2)
tests/include/mir_test_doubles/mock_frontend_surface.h (+5/-9)
tests/include/mir_test_doubles/mock_gbm.h (+0/-1)
tests/include/mir_test_doubles/mock_hwc_composer_device_1.h (+1/-1)
tests/include/mir_test_doubles/mock_hwc_device_wrapper.h (+0/-5)
tests/include/mir_test_doubles/mock_hwc_report.h (+0/-1)
tests/include/mir_test_doubles/mock_input_dispatcher.h (+2/-0)
tests/include/mir_test_doubles/mock_input_manager.h (+0/-1)
tests/include/mir_test_doubles/mock_input_platform.h (+0/-43)
tests/include/mir_test_doubles/mock_input_reader.h (+0/-58)
tests/include/mir_test_doubles/mock_input_region.h (+3/-0)
tests/include/mir_test_doubles/mock_input_targeter.h (+2/-2)
tests/include/mir_test_doubles/mock_lockable_callback.h (+0/-47)
tests/include/mir_test_doubles/mock_main_loop.h (+11/-1)
tests/include/mir_test_doubles/mock_rpc_report.h (+4/-0)
tests/include/mir_test_doubles/mock_scene_session.h (+0/-6)
tests/include/mir_test_doubles/mock_shell.h (+4/-4)
tests/include/mir_test_doubles/mock_surface.h (+2/-5)
tests/include/mir_test_doubles/mock_surface_configurator.h (+43/-0)
tests/include/mir_test_doubles/mock_surface_coordinator.h (+3/-4)
tests/include/mir_test_doubles/mock_timer.h (+9/-3)
tests/include/mir_test_doubles/mock_window_manager.h (+0/-77)
tests/include/mir_test_doubles/nested_mock_egl.h (+0/-44)
tests/include/mir_test_doubles/null_display.h (+4/-5)
tests/include/mir_test_doubles/null_display_buffer.h (+2/-0)
tests/include/mir_test_doubles/null_display_sync_group.h (+0/-81)
tests/include/mir_test_doubles/null_surface_configurator.h (+48/-0)
tests/include/mir_test_doubles/stub_buffer.h (+2/-13)
tests/include/mir_test_doubles/stub_buffer_stream.h (+21/-16)
tests/include/mir_test_doubles/stub_buffer_stream_factory.h (+0/-42)
tests/include/mir_test_doubles/stub_client_buffer.h (+1/-1)
tests/include/mir_test_doubles/stub_client_buffer_stream_factory.h (+2/-10)
tests/include/mir_test_doubles/stub_cursor.h (+0/-43)
tests/include/mir_test_doubles/stub_cursor_listener.h (+0/-40)
tests/include/mir_test_doubles/stub_display.h (+12/-26)
tests/include/mir_test_doubles/stub_display_builder.h (+34/-21)
tests/include/mir_test_doubles/stub_display_changer.h (+52/-0)
tests/include/mir_test_doubles/stub_display_configuration.h (+1/-33)
tests/include/mir_test_doubles/stub_driver_interpreter.h (+4/-12)
tests/include/mir_test_doubles/stub_frame_dropping_policy_factory.h (+3/-1)
tests/include/mir_test_doubles/stub_host_connection.h (+2/-12)
tests/include/mir_test_doubles/stub_input_targeter.h (+2/-2)
tests/include/mir_test_doubles/stub_scene_element.h (+3/-4)
tests/include/mir_test_doubles/stub_scene_session.h (+0/-17)
tests/include/mir_test_doubles/stub_scene_surface.h (+9/-8)
tests/include/mir_test_doubles/stub_session.h (+0/-12)
tests/include/mir_test_doubles/stub_shell.h (+3/-0)
tests/include/mir_test_doubles/stub_surface_factory.h (+0/-48)
tests/include/mir_test_doubles/stub_timer.h (+22/-8)
tests/include/mir_test_doubles/triggered_main_loop.h (+1/-1)
tests/include/mir_test_framework/async_server_runner.h (+1/-2)
tests/include/mir_test_framework/cross_process_sync.h (+4/-7)
tests/include/mir_test_framework/fake_event_hub_server_configuration.h (+0/-3)
tests/include/mir_test_framework/fake_input_device.h (+0/-55)
tests/include/mir_test_framework/headless_nested_server_runner.h (+0/-33)
tests/include/mir_test_framework/headless_test.h (+1/-2)
tests/include/mir_test_framework/input_testing_server_configuration.h (+22/-0)
tests/include/mir_test_framework/interprocess_client_server_test.h (+2/-2)
tests/include/mir_test_framework/placement_applying_shell.h (+0/-59)
tests/include/mir_test_framework/stub_server_platform_factory.h (+1/-10)
tests/include/mir_test_framework/testing_server_configuration.h (+2/-2)
tests/integration-tests/CMakeLists.txt (+11/-11)
tests/integration-tests/compositor/test_buffer_stream.cpp (+4/-3)
tests/integration-tests/frontend/test_session_mediator_report.cpp (+1/-1)
tests/integration-tests/graphics/android/test_client_render.cpp (+20/-21)
tests/integration-tests/graphics/android/test_display_integration.cpp (+23/-27)
tests/integration-tests/graphics/mesa/test_buffer_integration.cpp (+1/-1)
tests/integration-tests/input/CMakeLists.txt (+5/-1)
tests/integration-tests/input/android/CMakeLists.txt (+10/-0)
tests/integration-tests/input/android/test_android_cursor_listener.cpp (+29/-22)
tests/integration-tests/input/android/test_android_input_manager.cpp (+333/-0)
tests/integration-tests/input/test_nested_input.cpp (+84/-0)
tests/integration-tests/session_management.cpp (+21/-0)
tests/integration-tests/surface_composition.cpp (+1/-1)
tests/integration-tests/test_default_shell.cpp (+110/-38)
tests/integration-tests/test_display_info.cpp (+4/-5)
tests/integration-tests/test_display_server_main_loop_events.cpp (+184/-123)
tests/integration-tests/test_drm_auth_magic.cpp (+0/-2)
tests/integration-tests/test_error_reporting.cpp (+10/-7)
tests/integration-tests/test_exchange_buffer.cpp (+38/-30)
tests/integration-tests/test_server_shutdown.cpp (+22/-5)
tests/integration-tests/test_session.cpp (+69/-11)
tests/integration-tests/test_stale_frames.cpp (+11/-3)
tests/integration-tests/test_surface_first_frame_sync.cpp (+23/-30)
tests/integration-tests/test_surface_stack_with_compositor.cpp (+36/-47)
tests/integration-tests/test_surfaceloop.cpp (+14/-16)
tests/integration-tests/test_swapinterval.cpp (+26/-34)
tests/integration-tests/test_test_framework.cpp (+24/-47)
tests/mir-stress/src/client.cpp (+11/-9)
tests/mir_test/CMakeLists.txt (+5/-4)
tests/mir_test/event_matchers.cpp (+0/-35)
tests/mir_test/signal.cpp (+7/-7)
tests/mir_test_doubles/CMakeLists.txt (+7/-8)
tests/mir_test_doubles/fake_event_hub.cpp (+17/-42)
tests/mir_test_doubles/mock_egl.cpp (+2/-25)
tests/mir_test_doubles/mock_frame_dropping_policy_factory.cpp (+14/-14)
tests/mir_test_doubles/mock_gbm.cpp (+0/-5)
tests/mir_test_doubles/mock_timer.cpp (+40/-19)
tests/mir_test_doubles/nested_mock_egl.cpp (+0/-66)
tests/mir_test_doubles/platform_factory.cpp (+1/-1)
tests/mir_test_doubles/test_protobuf_client.cpp (+2/-1)
tests/mir_test_doubles/triggered_main_loop.cpp (+4/-3)
tests/mir_test_framework/CMakeLists.txt (+22/-42)
tests/mir_test_framework/async_server_runner.cpp (+5/-5)
tests/mir_test_framework/connected_client_with_a_surface.cpp (+9/-6)
tests/mir_test_framework/cross_process_sync.cpp (+12/-12)
tests/mir_test_framework/fake_event_hub_server_configuration.cpp (+1/-13)
tests/mir_test_framework/fake_input_device_impl.cpp (+0/-304)
tests/mir_test_framework/fake_input_device_impl.h (+0/-87)
tests/mir_test_framework/headless_nested_server_runner.cpp (+0/-28)
tests/mir_test_framework/headless_test.cpp (+0/-1)
tests/mir_test_framework/input_testing_server_options.cpp (+17/-0)
tests/mir_test_framework/interprocess_client_server_test.cpp (+1/-3)
tests/mir_test_framework/placement_applying_shell.cpp (+0/-59)
tests/mir_test_framework/stub_client_platform_factory.cpp (+2/-2)
tests/mir_test_framework/stub_input.cpp (+0/-66)
tests/mir_test_framework/stub_input_platform.cpp (+0/-91)
tests/mir_test_framework/stub_input_platform.h (+0/-62)
tests/mir_test_framework/stub_server_platform_factory.cpp (+7/-24)
tests/mir_test_framework/stubbed_graphics_platform.cpp (+0/-5)
tests/mir_test_framework/stubbed_server_configuration.cpp (+13/-3)
tests/mir_test_framework/symbols-server.map (+1/-1)
tests/mir_test_framework/symbols-stub-input.map (+0/-7)
tests/mir_test_framework/testing_server_options.cpp (+2/-3)
tests/performance-tests/CMakeLists.txt (+2/-3)
tests/privileged-tests/CMakeLists.txt (+0/-27)
tests/privileged-tests/README (+0/-2)
tests/privileged-tests/test_input_events.cpp (+0/-290)
tests/unit-tests/CMakeLists.txt (+12/-26)
tests/unit-tests/android_input/input_reader.cpp (+14/-1)
tests/unit-tests/android_input/test_eventhub.cpp (+5/-56)
tests/unit-tests/client/android/test_android_native_window.cpp (+0/-9)
tests/unit-tests/client/android/test_egl_native_surface_interpreter.cpp (+0/-21)
tests/unit-tests/client/input/CMakeLists.txt (+1/-0)
tests/unit-tests/client/input/test_android_input_receiver.cpp (+110/-152)
tests/unit-tests/client/input/test_android_input_receiver_thread.cpp (+162/-0)
tests/unit-tests/client/input/test_xkb_mapper.cpp (+39/-21)
tests/unit-tests/client/mesa/test_client_platform.cpp (+1/-1)
tests/unit-tests/client/test_client_buffer_depository.cpp (+15/-67)
tests/unit-tests/client/test_client_buffer_stream.cpp (+3/-0)
tests/unit-tests/client/test_client_mir_surface.cpp (+45/-68)
tests/unit-tests/client/test_event_distributor.cpp (+2/-2)
tests/unit-tests/client/test_mir_connection.cpp (+12/-2)
tests/unit-tests/client/test_mir_screencast.cpp (+3/-0)
tests/unit-tests/client/test_protobuf_rpc_channel.cpp (+0/-1)
tests/unit-tests/client/test_stream_transport.cpp (+26/-144)
tests/unit-tests/compositor/CMakeLists.txt (+0/-1)
tests/unit-tests/compositor/test_buffer_queue.cpp (+9/-0)
tests/unit-tests/compositor/test_buffer_stream.cpp (+2/-46)
tests/unit-tests/compositor/test_default_display_buffer_compositor.cpp (+25/-19)
tests/unit-tests/compositor/test_gl_program_family.cpp (+0/-49)
tests/unit-tests/compositor/test_gl_renderer.cpp (+38/-12)
tests/unit-tests/compositor/test_multi_threaded_compositor.cpp (+50/-126)
tests/unit-tests/compositor/test_screencast_display_buffer.cpp (+10/-1)
tests/unit-tests/compositor/test_timeout_frame_dropping_policy.cpp (+71/-54)
tests/unit-tests/dispatch/CMakeLists.txt (+0/-1)
tests/unit-tests/dispatch/test_action_queue.cpp (+0/-81)
tests/unit-tests/dispatch/test_simple_dispatch_thread.cpp (+33/-139)
tests/unit-tests/examples/test_demo_compositor.cpp (+7/-2)
tests/unit-tests/examples/test_demo_renderer.cpp (+3/-3)
tests/unit-tests/frontend/stress_protobuf_communicator.cpp (+1/-1)
tests/unit-tests/frontend/test_client_buffer_tracker.cpp (+85/-85)
tests/unit-tests/frontend/test_event_sender.cpp (+1/-1)
tests/unit-tests/frontend/test_protobuf_message_processor.cpp (+0/-2)
tests/unit-tests/frontend/test_published_socket_connector.cpp (+2/-1)
tests/unit-tests/frontend/test_session_mediator.cpp (+53/-102)
tests/unit-tests/graphics/CMakeLists.txt (+0/-1)
tests/unit-tests/graphics/android/CMakeLists.txt (+0/-1)
tests/unit-tests/graphics/android/test_android_buffer_allocator.cpp (+0/-55)
tests/unit-tests/graphics/android/test_buffer.cpp (+16/-120)
tests/unit-tests/graphics/android/test_display.cpp (+75/-90)
tests/unit-tests/graphics/android/test_display_buffer.cpp (+43/-16)
tests/unit-tests/graphics/android/test_display_group.cpp (+0/-84)
tests/unit-tests/graphics/android/test_display_hotplug.cpp (+8/-9)
tests/unit-tests/graphics/android/test_fb_device.cpp (+16/-7)
tests/unit-tests/graphics/android/test_fb_simple_swapper.cpp (+7/-5)
tests/unit-tests/graphics/android/test_hwc_configuration.cpp (+41/-99)
tests/unit-tests/graphics/android/test_hwc_device.cpp (+46/-51)
tests/unit-tests/graphics/android/test_hwc_fb_device.cpp (+2/-3)
tests/unit-tests/graphics/android/test_hwc_layerlist.cpp (+1/-1)
tests/unit-tests/graphics/android/test_hwc_logger.cpp (+18/-36)
tests/unit-tests/graphics/android/test_output_builder.cpp (+0/-35)
tests/unit-tests/graphics/android/test_platform.cpp (+1/-1)
tests/unit-tests/graphics/android/test_server_interpreter.cpp (+66/-20)
tests/unit-tests/graphics/mesa/test_buffer_allocator.cpp (+0/-66)
tests/unit-tests/graphics/mesa/test_display.cpp (+16/-19)
tests/unit-tests/graphics/mesa/test_display_buffer.cpp (+20/-30)
tests/unit-tests/graphics/mesa/test_display_multi_monitor.cpp (+6/-4)
tests/unit-tests/graphics/mesa/test_kms_page_flipper.cpp (+1/-20)
tests/unit-tests/graphics/nested/CMakeLists.txt (+1/-1)
tests/unit-tests/graphics/nested/test_nested_cursor.cpp (+0/-88)
tests/unit-tests/graphics/nested/test_nested_display.cpp (+5/-27)
tests/unit-tests/graphics/nested/test_nested_display_buffer.cpp (+81/-0)
tests/unit-tests/graphics/offscreen/test_offscreen_display.cpp (+9/-9)
tests/unit-tests/graphics/test_display.cpp (+2/-6)
tests/unit-tests/graphics/test_egl_error.cpp (+0/-115)
tests/unit-tests/graphics/test_program_factory.cpp (+1/-0)
tests/unit-tests/graphics/test_software_cursor.cpp (+13/-0)
tests/unit-tests/input/CMakeLists.txt (+0/-2)
tests/unit-tests/input/android/CMakeLists.txt (+1/-3)
tests/unit-tests/input/android/test_android_input_application_handle.cpp (+2/-1)
tests/unit-tests/input/android/test_android_input_dispatcher.cpp (+31/-16)
tests/unit-tests/input/android/test_android_input_lexicon.cpp (+36/-9)
tests/unit-tests/input/android/test_android_input_manager.cpp (+124/-3)
tests/unit-tests/input/android/test_android_input_sender.cpp (+4/-4)
tests/unit-tests/input/android/test_android_input_targeter.cpp (+9/-10)
tests/unit-tests/input/android/test_android_input_window_handle.cpp (+2/-1)
tests/unit-tests/input/android/test_android_pointer_controller.cpp (+3/-1)
tests/unit-tests/input/android/test_event_filter_input_dispatcher_policy.cpp (+2/-8)
tests/unit-tests/input/android/test_input_dispatcher.cpp (+0/-125)
tests/unit-tests/input/android/test_input_reader_dispatchable.cpp (+0/-51)
tests/unit-tests/input/android/test_input_translator.cpp (+61/-30)
tests/unit-tests/input/test_cursor_controller.cpp (+15/-9)
tests/unit-tests/input/test_default_input_device_hub.cpp (+0/-382)
tests/unit-tests/input/test_default_input_manager.cpp (+0/-152)
tests/unit-tests/input/test_display_input_region.cpp (+14/-11)
tests/unit-tests/input/test_event_builders.cpp (+40/-92)
tests/unit-tests/input/test_event_filter_chain.cpp (+4/-3)
tests/unit-tests/input/test_input_event.cpp (+82/-69)
tests/unit-tests/input/test_xcursor_loader.cpp (+0/-1)
tests/unit-tests/library_example.cpp (+0/-37)
tests/unit-tests/library_example.h (+0/-38)
tests/unit-tests/logging/test_display_report.cpp (+11/-27)
tests/unit-tests/scene/CMakeLists.txt (+1/-1)
tests/unit-tests/scene/test_abstract_shell.cpp (+0/-447)
tests/unit-tests/scene/test_application_session.cpp (+48/-218)
tests/unit-tests/scene/test_basic_surface.cpp (+45/-36)
tests/unit-tests/scene/test_default_shell.cpp (+14/-22)
tests/unit-tests/scene/test_legacy_scene_change_notification.cpp (+0/-17)
tests/unit-tests/scene/test_session_manager.cpp (+5/-14)
tests/unit-tests/scene/test_surface.cpp (+84/-6)
tests/unit-tests/scene/test_surface_controller.cpp (+10/-10)
tests/unit-tests/scene/test_surface_impl.cpp (+30/-4)
tests/unit-tests/scene/test_surface_stack.cpp (+3/-168)
tests/unit-tests/shell/CMakeLists.txt (+0/-1)
tests/unit-tests/shell/test_graphics_display_layout.cpp (+0/-1)
tests/unit-tests/test_flags.cpp (+0/-93)
tests/unit-tests/test_glib_main_loop.cpp (+64/-91)
tests/unit-tests/test_lockable_callback.cpp (+0/-69)
tests/unit-tests/test_module_deleter.cpp (+0/-46)
tools/discover_gtests.sh (+0/-71)
tools/run_ctests.sh (+0/-59)
tools/update_package_abis.sh (+0/-256)
To merge this branch: bzr merge lp:~andreas-pokorny/mir/reworked-external-output-centering-integration-branch
Reviewer Review Type Date Requested Status
Mir development team 2015-02-28 Pending
Review via email: mp+251357@code.launchpad.net

Commit Message

just for silo-009

Description of the Change

reworked centering

To post a comment you must log in.
2332. By Andreas Pokorny on 2015-03-01

merge changes to lp:mir but leaving out all abi affecting changes

2333. By Andreas Pokorny on 2015-03-01

tweaking cursor size

2334. By Andreas Pokorny on 2015-03-01

synchronizing changelog

2335. By Andreas Pokorny on 2015-03-02

offset touch position with the display position

2336. By Andreas Pokorny on 2015-03-02

make test cases run

2337. By Andreas Pokorny on 2015-03-02

some debug output for usc

2338. By Andreas Pokorny on 2015-03-02

merged lp:mir

2339. By Andreas Pokorny on 2015-03-02

use top_left to offset touch coordinates

2340. By Andreas Pokorny on 2015-03-02

update to current lp:mir

2341. By Andreas Pokorny on 2015-03-09

updated to current lp:mir without integrating the changes

2342. By Andreas Pokorny on 2015-04-23

* integrate changes of for 0.12.1

2343. By Andreas Pokorny on 2015-04-23

merge lp:mir by essentially omitting most of the changes

2344. By Andreas Pokorny on 2015-04-23

fix changelog

2345. By Andreas Pokorny on 2015-04-23

update to current lp:mir

2346. By Andreas Pokorny on 2015-04-23

platform version 7 is expected

2347. By Andreas Pokorny on 2015-04-23

revert back to older server platform abi version

2348. By Andreas Pokorny on 2015-04-23

fix test case

2349. By Andreas Pokorny on 2015-05-12

rebasing ontop of lp:mir

2350. By Andreas Pokorny on 2015-05-18

rebase on lp:mir

2351. By Andreas Pokorny on 2015-05-20

rebase lp:mir

Unmerged revisions

2351. By Andreas Pokorny on 2015-05-20

rebase lp:mir

2350. By Andreas Pokorny on 2015-05-18

rebase on lp:mir

2349. By Andreas Pokorny on 2015-05-12

rebasing ontop of lp:mir

2348. By Andreas Pokorny on 2015-04-23

fix test case

2347. By Andreas Pokorny on 2015-04-23

revert back to older server platform abi version

2346. By Andreas Pokorny on 2015-04-23

platform version 7 is expected

2345. By Andreas Pokorny on 2015-04-23

update to current lp:mir

2344. By Andreas Pokorny on 2015-04-23

fix changelog

2343. By Andreas Pokorny on 2015-04-23

merge lp:mir by essentially omitting most of the changes

2342. By Andreas Pokorny on 2015-04-23

* integrate changes of for 0.12.1

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '3rd_party/CMakeLists.txt'
2--- 3rd_party/CMakeLists.txt 2015-05-07 09:06:20 +0000
3+++ 3rd_party/CMakeLists.txt 2015-05-20 14:01:27 +0000
4@@ -7,12 +7,17 @@
5 ${CMAKE_CURRENT_SOURCE_DIR}/android-deps
6 )
7
8+add_library(
9+ 3rd_party
10+
11+ ${MIR_3RD_PARTY_SOURCES}
12+)
13+
14 set(MIR_3RD_PARTY_INCLUDE_DIRECTORIES ${MIR_3RD_PARTY_INCLUDE_DIRECTORIES} PARENT_SCOPE)
15 set(MIR_INPUT_ANDROID_COMPILE_FLAGS ${MIR_INPUT_ANDROID_COMPILE_FLAGS}
16 PARENT_SCOPE)
17
18 include_directories(${PROJECT_SOURCE_DIR}/src/include/common)
19-include_directories(${PROJECT_SOURCE_DIR}/src/include/platform)
20 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/android-deps)
21 add_subdirectory(android-input)
22
23@@ -29,3 +34,10 @@
24 )
25
26 set(MIR_XCURSOR_INCLUDE_DIRECTORIES ${MIR_XCURSOR_INCLUDE_DIRECTORIES} PARENT_SCOPE)
27+
28+target_link_libraries(
29+ 3rd_party
30+
31+ android-input
32+ xcursorloader
33+)
34
35=== modified file '3rd_party/android-deps/std/Thread.h'
36--- 3rd_party/android-deps/std/Thread.h 2015-03-31 02:35:42 +0000
37+++ 3rd_party/android-deps/std/Thread.h 2015-05-20 14:01:27 +0000
38@@ -61,10 +61,7 @@
39 status.store(NO_ERROR);
40 exit_pending.store(false);
41
42- // Avoid data races by doing a move capture instead of copy capture,
43- // since libstdc++ is using a copy-on-write implementation of std::string
44- // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=21334#c45
45- thread = std::thread([name_str = std::move(name_str),this]
46+ thread = std::thread([name_str,this]() -> void
47 {
48 mir::set_thread_name(name_str);
49 try
50
51=== modified file '3rd_party/android-input/android/CMakeLists.txt'
52--- 3rd_party/android-input/android/CMakeLists.txt 2015-05-07 09:06:20 +0000
53+++ 3rd_party/android-input/android/CMakeLists.txt 2015-05-20 14:01:27 +0000
54@@ -26,7 +26,7 @@
55
56
57 add_library(
58- android-input-static STATIC
59+ android-input STATIC
60 # The stuff that we want
61 frameworks/base/services/input/EventHub.cpp
62 frameworks/base/services/input/InputApplication.cpp
63@@ -58,19 +58,19 @@
64 #we don't have binder or skia available on hybris/linux platforms
65 if(MIR_USE_BIONIC)
66 target_link_libraries(
67- android-input-static
68+ android-input
69 binder
70 skia)
71 endif()
72
73 target_link_libraries(
74- android-input-static
75+ android-input
76
77 ${Boost_LIBRARIES}
78 )
79
80 set_target_properties(
81- android-input-static
82+ android-input
83 PROPERTIES
84 COMPILE_FLAGS ${ANDROID_INPUT_COMPILE_FLAGS}
85 )
86
87=== modified file '3rd_party/android-input/android/frameworks/base/services/input/EventHub.cpp'
88--- 3rd_party/android-input/android/frameworks/base/services/input/EventHub.cpp 2015-05-07 09:06:20 +0000
89+++ 3rd_party/android-input/android/frameworks/base/services/input/EventHub.cpp 2015-05-20 14:01:27 +0000
90@@ -52,7 +52,6 @@
91 #include <sys/inotify.h>
92 #include <sys/epoll.h>
93 #include <sys/ioctl.h>
94-#include <sys/timerfd.h>
95 // <mir changes>
96 // Needed to build on android platform (PATH_MAX)
97 #ifdef HAVE_ANDROID_OS
98@@ -209,7 +208,6 @@
99
100 const uint32_t EventHub::EPOLL_ID_UDEV;
101 const uint32_t EventHub::EPOLL_ID_WAKE;
102-const uint32_t EventHub::EPOLL_ID_TIMER;
103 const int EventHub::EPOLL_SIZE_HINT;
104 const int EventHub::EPOLL_MAX_EVENTS;
105
106@@ -220,13 +218,11 @@
107 mOpeningDevices(0), mClosingDevices(0),
108 mNeedToSendFinishedDeviceScan(false),
109 mNeedToReopenDevices(false), mNeedToScanDevices(true),
110- mEpollFd{epoll_create(EPOLL_SIZE_HINT)},
111- mTimerFd{timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK|TFD_CLOEXEC)},
112 mPendingEventCount(0), mPendingEventIndex(0), mPendingUdevEvent(false) {
113 acquire_wake_lock(PARTIAL_WAKE_LOCK, WAKE_LOCK_ID);
114
115+ mEpollFd = epoll_create(EPOLL_SIZE_HINT);
116 LOG_ALWAYS_FATAL_IF(mEpollFd < 0, "Could not create epoll instance. errno=%d", errno);
117- LOG_ALWAYS_FATAL_IF(mTimerFd < 0, "Could not create timerfd. errno=%d", errno);
118
119 device_listener->filter_by_subsystem("input");
120 device_listener->enable();
121@@ -258,11 +254,6 @@
122 result = epoll_ctl(mEpollFd, EPOLL_CTL_ADD, mWakeReadPipeFd, &eventItem);
123 LOG_ALWAYS_FATAL_IF(result != 0, "Could not add wake read pipe to epoll instance. errno=%d",
124 errno);
125-
126- eventItem.data.u32 = EPOLL_ID_TIMER;
127- result = epoll_ctl(mEpollFd, EPOLL_CTL_ADD, mTimerFd, &eventItem);
128- LOG_ALWAYS_FATAL_IF(result != 0, "Could not add timer fd to epoll instance. errno=%d",
129- errno);
130 }
131
132 EventHub::~EventHub(void) {
133@@ -274,6 +265,7 @@
134 delete device;
135 }
136
137+ ::close(mEpollFd);
138 ::close(mWakeReadPipeFd);
139 ::close(mWakeWritePipeFd);
140
141@@ -662,7 +654,7 @@
142 return NULL;
143 }
144
145-size_t EventHub::getEvents(RawEvent* buffer, size_t bufferSize) {
146+size_t EventHub::getEvents(int timeoutMillis, RawEvent* buffer, size_t bufferSize) {
147 ALOG_ASSERT(bufferSize >= 1);
148
149 AutoMutex _l(mLock);
150@@ -763,19 +755,6 @@
151 continue;
152 }
153
154- if (eventItem.data.u32 == EPOLL_ID_TIMER) {
155- if (eventItem.events & EPOLLIN) {
156- ALOGV("awoken after wakeIn()");
157- awoken = true;
158- uint64_t timeout_count;
159- read(mTimerFd, &timeout_count, sizeof timeout_count);
160- } else {
161- ALOGW("Received unexpected epoll event 0x%08x for wake read pipe.",
162- eventItem.events);
163- }
164- continue;
165- }
166-
167 ssize_t deviceIndex = mDevices.indexOfKey(eventItem.data.u32);
168 if (deviceIndex < 0) {
169 ALOGW("Received unexpected epoll event 0x%08x for unknown device id %d.",
170@@ -884,13 +863,15 @@
171 // when this happens, the EventHub holds onto its own user wake lock while the client
172 // is processing events. Thus the system can only sleep if there are no events
173 // pending or currently being processed.
174+ //
175+ // The timeout is advisory only. If the device is asleep, it will not wake just to
176+ // service the timeout.
177 mPendingEventIndex = 0;
178
179 mLock.unlock(); // release lock before poll, must be before release_wake_lock
180 release_wake_lock(WAKE_LOCK_ID);
181
182- // non blocking call to epoll_wait - blocking happens in dispatch threads
183- int pollResult = epoll_wait(mEpollFd, mPendingEventItems, EPOLL_MAX_EVENTS, 0);
184+ int pollResult = epoll_wait(mEpollFd, mPendingEventItems, EPOLL_MAX_EVENTS, timeoutMillis);
185
186 acquire_wake_lock(PARTIAL_WAKE_LOCK, WAKE_LOCK_ID);
187 mLock.lock(); // reacquire lock after poll, must be after acquire_wake_lock
188@@ -921,15 +902,6 @@
189 return event - buffer;
190 }
191
192-void EventHub::wakeIn(int32_t timeoutMillis) {
193- itimerspec delay;
194- std::memset(&delay, 0, sizeof delay);
195-
196- delay.it_value.tv_sec = timeoutMillis / 1000;
197- delay.it_value.tv_nsec = (timeoutMillis % 1000) * 1000000LL;
198- timerfd_settime(mTimerFd, 0, &delay, nullptr);
199-}
200-
201 void EventHub::wake() {
202 ALOGV("wake() called");
203
204@@ -1365,7 +1337,7 @@
205 }
206
207 bool EventHub::hasKeycodeLocked(Device* device, int keycode) const {
208- if (!device->keyMap.haveKeyLayout()) {
209+ if (!device->keyMap.haveKeyLayout() || !device->keyBitmask) {
210 return false;
211 }
212
213@@ -1528,9 +1500,4 @@
214 return false;
215 }
216
217-mir::Fd EventHub::fd()
218-{
219- return mEpollFd;
220-}
221-
222 }; // namespace android
223
224=== modified file '3rd_party/android-input/android/frameworks/base/services/input/EventHub.h'
225--- 3rd_party/android-input/android/frameworks/base/services/input/EventHub.h 2015-05-07 09:06:20 +0000
226+++ 3rd_party/android-input/android/frameworks/base/services/input/EventHub.h 2015-05-20 14:01:27 +0000
227@@ -32,8 +32,6 @@
228 #include <std/Vector.h>
229 #include <std/KeyedVector.h>
230
231-#include "mir/fd.h"
232-
233 #include <linux/input.h>
234 #include <sys/epoll.h>
235
236@@ -196,15 +194,18 @@
237 virtual void setExcludedDevices(const Vector<String8>& devices) = 0;
238
239 /*
240- * Tests for available events and returns them.
241+ * Wait for events to become available and returns them.
242 * After returning, the EventHub holds onto a wake lock until the next call to getEvent.
243 * This ensures that the device will not go to sleep while the event is being processed.
244 * If the device needs to remain awake longer than that, then the caller is responsible
245 * for taking care of it (say, by poking the power manager user activity timer).
246 *
247- * Returns the number of events obtained.
248+ * The timeout is advisory only. If the device is asleep, it will not wake just to
249+ * service the timeout.
250+ *
251+ * Returns the number of events obtained, or 0 if the timeout expired.
252 */
253- virtual size_t getEvents(RawEvent* buffer, size_t bufferSize) = 0;
254+ virtual size_t getEvents(int timeoutMillis, RawEvent* buffer, size_t bufferSize) = 0;
255
256 /*
257 * Query current input state.
258@@ -241,9 +242,6 @@
259 /* Wakes up getEvents() if it is blocked on a read. */
260 virtual void wake() = 0;
261
262- /* Ensures that fd() readable after given timeout */
263- virtual void wakeIn(int32_t timeout) = 0;
264-
265 /* Dump EventHub state to a string. */
266 virtual void dump(String8& dump) = 0;
267
268@@ -252,9 +250,6 @@
269
270 /* Flush all pending events not yet read from the input devices */
271 virtual void flush() = 0;
272-
273- /* Epoll fd used by EventHub */
274- virtual mir::Fd fd() = 0;
275 };
276
277 class EventHub : public EventHubInterface
278@@ -291,7 +286,7 @@
279 virtual bool markSupportedKeyCodes(int32_t deviceId, size_t numCodes,
280 const int32_t* keyCodes, uint8_t* outFlags) const;
281
282- virtual size_t getEvents(RawEvent* buffer, size_t bufferSize);
283+ virtual size_t getEvents(int timeoutMillis, RawEvent* buffer, size_t bufferSize);
284
285 virtual bool hasScanCode(int32_t deviceId, int32_t scanCode) const;
286 virtual bool hasLed(int32_t deviceId, int32_t led) const;
287@@ -309,19 +304,13 @@
288 virtual void requestReopenDevices();
289
290 virtual void wake();
291- virtual void wakeIn(int32_t timeout);
292
293 virtual void dump(String8& dump);
294 virtual void monitor();
295 virtual void flush();
296- virtual mir::Fd fd();
297
298 virtual ~EventHub();
299
300- // Ids used for epoll notifications not associated with devices.
301- static const uint32_t EPOLL_ID_UDEV = 0x80000001;
302- static const uint32_t EPOLL_ID_WAKE = 0x80000002;
303- static const uint32_t EPOLL_ID_TIMER = 0x80000003;
304 private:
305 std::shared_ptr<mir::input::InputReport> const input_report;
306
307@@ -416,12 +405,15 @@
308 bool mNeedToScanDevices;
309 Vector<String8> mExcludedDevices;
310
311- mir::Fd mEpollFd;
312- mir::Fd mTimerFd;
313+ int mEpollFd;
314 std::unique_ptr<mir::udev::Monitor> const device_listener;
315 int mWakeReadPipeFd;
316 int mWakeWritePipeFd;
317
318+ // Ids used for epoll notifications not associated with devices.
319+ static const uint32_t EPOLL_ID_UDEV = 0x80000001;
320+ static const uint32_t EPOLL_ID_WAKE = 0x80000002;
321+
322 // Epoll FD list size hint.
323 static const int EPOLL_SIZE_HINT = 8;
324
325
326=== modified file '3rd_party/android-input/android/frameworks/base/services/input/InputDispatcher.cpp'
327--- 3rd_party/android-input/android/frameworks/base/services/input/InputDispatcher.cpp 2015-05-07 09:06:20 +0000
328+++ 3rd_party/android-input/android/frameworks/base/services/input/InputDispatcher.cpp 2015-05-20 14:01:27 +0000
329@@ -43,8 +43,6 @@
330 // Log debug messages about hover events.
331 #define DEBUG_HOVER 0
332
333-#define ENABLE_APP_SWITCH_OPTIMIZATION 0
334-
335 #include "InputDispatcher.h"
336
337 #include "mir/input/input_report.h"
338@@ -375,7 +373,6 @@
339
340 switch (entry->type) {
341 case EventEntry::TYPE_KEY: {
342-#if ENABLE_APP_SWITCH_OPTIMIZATION == 1
343 // Optimize app switch latency.
344 // If the application takes too long to catch up then we drop all events preceding
345 // the app switch key.
346@@ -394,7 +391,6 @@
347 }
348 }
349 }
350-#endif
351 break;
352 }
353
354@@ -667,7 +663,7 @@
355 && (entry->policyFlags & POLICY_FLAG_TRUSTED)
356 && (!(entry->policyFlags & POLICY_FLAG_DISABLE_KEY_REPEAT))) {
357 if (mKeyRepeatState.lastKeyEntry
358- && mKeyRepeatState.lastKeyEntry->is_same_key(entry)) {
359+ && mKeyRepeatState.lastKeyEntry->keyCode == entry->keyCode) {
360 // We have seen two identical key downs in a row which indicates that the device
361 // driver is automatically generating key repeats itself. We take note of the
362 // repeat here, but we disable our own next key repeat timer since it is clear that
363@@ -3743,12 +3739,6 @@
364 interceptKeyWakeupTime = std::chrono::nanoseconds(0);
365 }
366
367-bool InputDispatcher::KeyEntry::is_same_key(KeyEntry* other) const {
368- if (keyCode != 0)
369- return keyCode == other->keyCode;
370- else
371- return scanCode == other->scanCode;
372-}
373
374 // --- InputDispatcher::MotionEntry ---
375
376
377=== modified file '3rd_party/android-input/android/frameworks/base/services/input/InputDispatcher.h'
378--- 3rd_party/android-input/android/frameworks/base/services/input/InputDispatcher.h 2015-05-07 09:06:20 +0000
379+++ 3rd_party/android-input/android/frameworks/base/services/input/InputDispatcher.h 2015-05-20 14:01:27 +0000
380@@ -516,8 +516,6 @@
381 virtual void appendDescription(String8& msg) const;
382 void recycle();
383
384- bool is_same_key(KeyEntry* other) const;
385-
386 protected:
387 virtual ~KeyEntry();
388 };
389
390=== modified file '3rd_party/android-input/android/frameworks/base/services/input/InputReader.cpp'
391--- 3rd_party/android-input/android/frameworks/base/services/input/InputReader.cpp 2015-05-07 09:06:20 +0000
392+++ 3rd_party/android-input/android/frameworks/base/services/input/InputReader.cpp 2015-05-20 14:01:27 +0000
393@@ -269,23 +269,27 @@
394
395 void InputReader::loopOnce() {
396 int32_t oldGeneration;
397+ int32_t timeoutMillis;
398 bool inputDevicesChanged = false;
399 Vector<InputDeviceInfo> inputDevices;
400 { // acquire lock
401 AutoMutex _l(mLock);
402
403 oldGeneration = mGeneration;
404+ timeoutMillis = -1;
405
406 uint32_t changes = mConfigurationChangesToRefresh;
407 if (changes) {
408- if (0 == (changes & InputReaderConfiguration::CHANGE_MUST_REOPEN))
409- mEventHub->wake();
410 mConfigurationChangesToRefresh = 0;
411+ timeoutMillis = 0;
412 refreshConfigurationLocked(changes);
413+ } else if (mNextTimeout != std::chrono::nanoseconds(LLONG_MAX)) {
414+ std::chrono::nanoseconds now = systemTime(SYSTEM_TIME_MONOTONIC);
415+ timeoutMillis = toMillisecondTimeoutDelay(now, mNextTimeout);
416 }
417 } // release lock
418
419- size_t count = mEventHub->getEvents(mEventBuffer, EVENT_BUFFER_SIZE);
420+ size_t count = mEventHub->getEvents(timeoutMillis, mEventBuffer, EVENT_BUFFER_SIZE);
421
422 { // acquire lock
423 AutoMutex _l(mLock);
424@@ -570,8 +574,7 @@
425 void InputReader::requestTimeoutAtTimeLocked(std::chrono::nanoseconds when) {
426 if (when < mNextTimeout) {
427 mNextTimeout = when;
428- std::chrono::nanoseconds now = systemTime(SYSTEM_TIME_MONOTONIC);
429- mEventHub->wakeIn(toMillisecondTimeoutDelay(now, mNextTimeout));
430+ mEventHub->wake();
431 }
432 }
433
434@@ -3934,6 +3937,15 @@
435 void TouchInputMapper::cookPointerData() {
436 uint32_t currentPointerCount = mCurrentRawPointerData.pointerCount;
437
438+ // hack
439+ auto pointer = mPointerController;
440+
441+ float display_x = 0, display_y = 0;
442+ if (pointer == nullptr)
443+ pointer = getPolicy()->obtainPointerController(getDeviceId());
444+
445+ if (pointer != nullptr)
446+ pointer->getDisplayPosition(display_x, display_y);
447 mCurrentCookedPointerData.clear();
448 mCurrentCookedPointerData.pointerCount = currentPointerCount;
449 mCurrentCookedPointerData.hoveringIds = mCurrentRawPointerData.hoveringIds;
450@@ -4079,8 +4091,8 @@
451 }
452
453 // X and Y
454+ float x, y;
455 // Adjust coords for surface orientation.
456- float x, y;
457 switch (mSurfaceOrientation) {
458 case DISPLAY_ORIENTATION_90:
459 x = float(in.y - mRawPointerAxes.y.minValue) * mYScale;
460@@ -4108,6 +4120,10 @@
461 break;
462 }
463
464+ // offset to input region
465+ x -= display_x;
466+ y -= display_y;
467+
468 // Write output coords.
469 PointerCoords& out = mCurrentCookedPointerData.pointerCoords[i];
470 out.clear();
471
472=== modified file '3rd_party/android-input/android/frameworks/base/services/input/MirLog.cpp'
473--- 3rd_party/android-input/android/frameworks/base/services/input/MirLog.cpp 2015-03-31 02:35:42 +0000
474+++ 3rd_party/android-input/android/frameworks/base/services/input/MirLog.cpp 2015-05-20 14:01:27 +0000
475@@ -42,8 +42,6 @@
476 #include <cstdlib>
477 #include <cstring>
478
479-#include <atomic>
480-
481 #define kMaxTagLen 16 /* from the long-dead utils/Log.cpp */
482 #define kTagSetSize 16 /* arbitrary */
483
484@@ -51,14 +49,14 @@
485 {
486 struct LogState {
487 /* global minimum priority */
488- std::atomic<int> globalMinPriority{ANDROID_LOG_UNKNOWN};
489+ int globalMinPriority;
490
491 /* tags and priorities */
492 struct {
493 char tag[kMaxTagLen];
494- std::atomic<int> minPriority;
495+ int minPriority;
496 } tagSet[kTagSetSize];
497- } gLogState = {};
498+ } gLogState = { .globalMinPriority = ANDROID_LOG_UNKNOWN };
499 }
500
501 /*
502
503=== modified file '3rd_party/android-input/android/frameworks/base/services/input/PointerController.cpp'
504--- 3rd_party/android-input/android/frameworks/base/services/input/PointerController.cpp 2014-03-06 06:05:17 +0000
505+++ 3rd_party/android-input/android/frameworks/base/services/input/PointerController.cpp 2015-05-20 14:01:27 +0000
506@@ -273,4 +273,9 @@
507 // TODO: Implement
508 }
509
510+void PointerController::getDisplayPosition(float &x, float &y) const {
511+ x = 0;
512+ y = 0;
513+}
514+
515 } // namespace android
516
517=== modified file '3rd_party/android-input/android/frameworks/base/services/input/PointerController.h'
518--- 3rd_party/android-input/android/frameworks/base/services/input/PointerController.h 2014-03-06 06:05:17 +0000
519+++ 3rd_party/android-input/android/frameworks/base/services/input/PointerController.h 2015-05-20 14:01:27 +0000
520@@ -68,6 +68,9 @@
521 /* Gets the absolute location of the pointer. */
522 virtual void getPosition(float* outX, float* outY) const = 0;
523
524+ // hack
525+ virtual void getDisplayPosition(float &x, float& y) const = 0;
526+
527 enum Transition {
528 // Fade/unfade immediately.
529 TRANSITION_IMMEDIATE,
530@@ -142,6 +145,7 @@
531
532 void setDisplaySize(int32_t width, int32_t height);
533 void setDisplayOrientation(int32_t orientation);
534+ void getDisplayPosition(float &x, float& y) const override;
535
536 private:
537 mutable Mutex mLock;
538
539=== modified file '3rd_party/android-input/android/frameworks/base/services/input/VelocityControl.cpp'
540--- 3rd_party/android-input/android/frameworks/base/services/input/VelocityControl.cpp 2015-03-31 02:35:42 +0000
541+++ 3rd_party/android-input/android/frameworks/base/services/input/VelocityControl.cpp 2015-05-20 14:01:27 +0000
542@@ -70,7 +70,7 @@
543
544 float vx, vy;
545 float scale = mParameters.scale;
546- if (mVelocityTracker.getVelocity(0, &vx, &vy)) {
547+ if (mVelocityTracker.getVelocity(1, &vx, &vy)) {
548 float speed = hypotf(vx, vy) * scale;
549 if (speed >= mParameters.highThreshold) {
550 // Apply full acceleration above the high speed threshold.
551
552=== modified file '3rd_party/android-input/android/frameworks/base/services/input/VelocityTracker.cpp'
553--- 3rd_party/android-input/android/frameworks/base/services/input/VelocityTracker.cpp 2015-03-31 02:35:42 +0000
554+++ 3rd_party/android-input/android/frameworks/base/services/input/VelocityTracker.cpp 2015-05-20 14:01:27 +0000
555@@ -65,36 +65,31 @@
556
557 #if DEBUG_STRATEGY || DEBUG_VELOCITY
558 static String8 vectorToString(const float* a, uint32_t m) {
559- String8 str;
560- str.append("[");
561+ std::stringstream str;
562+ str << '[';
563 while (m--) {
564- str.appendFormat(" %f", *(a++));
565- if (m) {
566- str.append(",");
567- }
568+ str << *a++;
569+ if (m)
570+ str << ',';
571 }
572- str.append(" ]");
573- return str;
574+ str << ']';
575+ return str.str();
576 }
577
578 static String8 matrixToString(const float* a, uint32_t m, uint32_t n, bool rowMajor) {
579- String8 str;
580- str.append("[");
581+ std::stringstream str;
582+ str << '[';
583 for (size_t i = 0; i < m; i++) {
584- if (i) {
585- str.append(",");
586- }
587- str.append(" [");
588+ if (i) str << ',';
589+ str << " [";
590 for (size_t j = 0; j < n; j++) {
591- if (j) {
592- str.append(",");
593- }
594- str.appendFormat(" %f", a[rowMajor ? i * n + j : j * m + i]);
595+ if (j) str << ',';
596+ str << ' ' << a[rowMajor ? i * n + j : j * m + i];
597 }
598- str.append(" ]");
599+ str << " ]";
600 }
601- str.append(" ]");
602- return str;
603+ str << " ]";
604+ return str.str();
605 }
606 #endif
607
608@@ -249,11 +244,11 @@
609 "estimator (degree=%d, xCoeff=%s, yCoeff=%s, confidence=%f)",
610 id, positions[index].x, positions[index].y,
611 int(estimator.degree),
612- vectorToString(estimator.xCoeff, estimator.degree + 1).string(),
613- vectorToString(estimator.yCoeff, estimator.degree + 1).string(),
614+ vectorToString(estimator.xCoeff, estimator.degree + 1).c_str(),
615+ vectorToString(estimator.yCoeff, estimator.degree + 1).c_str(),
616 estimator.confidence);
617 ++index;
618- }
619+ });
620 #endif
621 }
622
623@@ -436,8 +431,8 @@
624 const float* w, uint32_t m, uint32_t n, float* outB, float* outDet) {
625 #if DEBUG_STRATEGY
626 ALOGD("solveLeastSquares: m=%d, n=%d, x=%s, y=%s, w=%s", int(m), int(n),
627- vectorToString(x, m).string(), vectorToString(y, m).string(),
628- vectorToString(w, m).string());
629+ vectorToString(x, m).c_str(), vectorToString(y, m).c_str(),
630+ vectorToString(w, m).c_str());
631 #endif
632
633 // Expand the X vector to a matrix A, pre-multiplied by the weights.
634@@ -449,7 +444,7 @@
635 }
636 }
637 #if DEBUG_STRATEGY
638- ALOGD(" - a=%s", matrixToString(&a[0][0], m, n, false /*rowMajor*/).string());
639+ ALOGD(" - a=%s", matrixToString(&a[0][0], m, n, false /*rowMajor*/).c_str());
640 #endif
641
642 // Apply the Gram-Schmidt process to A to obtain its QR decomposition.
643@@ -484,8 +479,8 @@
644 }
645 }
646 #if DEBUG_STRATEGY
647- ALOGD(" - q=%s", matrixToString(&q[0][0], m, n, false /*rowMajor*/).string());
648- ALOGD(" - r=%s", matrixToString(&r[0][0], n, n, true /*rowMajor*/).string());
649+ ALOGD(" - q=%s", matrixToString(&q[0][0], m, n, false /*rowMajor*/).c_str());
650+ ALOGD(" - r=%s", matrixToString(&r[0][0], n, n, true /*rowMajor*/).c_str());
651
652 // calculate QR, if we factored A correctly then QR should equal A
653 float qr[n][m];
654@@ -497,7 +492,7 @@
655 }
656 }
657 }
658- ALOGD(" - qr=%s", matrixToString(&qr[0][0], m, n, false /*rowMajor*/).string());
659+ ALOGD(" - qr=%s", matrixToString(&qr[0][0], m, n, false /*rowMajor*/).c_str());
660 #endif
661
662 // Solve R B = Qt W Y to find B. This is easy because R is upper triangular.
663@@ -514,7 +509,7 @@
664 outB[i] /= r[i][i];
665 }
666 #if DEBUG_STRATEGY
667- ALOGD(" - b=%s", vectorToString(outB, n).string());
668+ ALOGD(" - b=%s", vectorToString(outB, n).c_str());
669 #endif
670
671 // Calculate the coefficient of determination as 1 - (SSerr / SStot) where
672@@ -598,10 +593,10 @@
673 outEstimator->degree = degree;
674 outEstimator->confidence = xdet * ydet;
675 #if DEBUG_STRATEGY
676- ALOGD("estimate: degree=%d, xCoeff=%s, yCoeff=%s, confidence=%f",
677+ ALOGD("estimate : degree=%d, xCoeff=%s, yCoeff=%s, confidence=%f",
678 int(outEstimator->degree),
679- vectorToString(outEstimator->xCoeff, n).string(),
680- vectorToString(outEstimator->yCoeff, n).string(),
681+ vectorToString(outEstimator->xCoeff, n).c_str(),
682+ vectorToString(outEstimator->yCoeff, n).c_str(),
683 outEstimator->confidence);
684 #endif
685 return true;
686
687=== modified file '3rd_party/xcursor/CMakeLists.txt'
688--- 3rd_party/xcursor/CMakeLists.txt 2015-05-07 09:06:20 +0000
689+++ 3rd_party/xcursor/CMakeLists.txt 2015-05-20 14:01:27 +0000
690@@ -5,7 +5,7 @@
691 )
692
693 add_library(
694- xcursorloader-static STATIC
695+ xcursorloader STATIC
696
697 ${XCURSOR_SOURCES}
698 )
699
700=== modified file 'CMakeLists.txt'
701--- CMakeLists.txt 2015-05-19 04:37:02 +0000
702+++ CMakeLists.txt 2015-05-20 14:01:27 +0000
703@@ -23,12 +23,12 @@
704
705 cmake_policy(SET CMP0015 NEW)
706
707-set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
708-set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
709+set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
710+set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
711
712 set(MIR_VERSION_MAJOR 0)
713-set(MIR_VERSION_MINOR 14) # This should change at least with every MIRSERVER_ABI
714-set(MIR_VERSION_PATCH 0)
715+set(MIR_VERSION_MINOR 12) # This should change at least with every MIRSERVER_ABI
716+set(MIR_VERSION_PATCH 1)
717
718 add_definitions(-DMIR_VERSION_MAJOR=${MIR_VERSION_MAJOR})
719 add_definitions(-DMIR_VERSION_MINOR=${MIR_VERSION_MINOR})
720@@ -215,20 +215,17 @@
721
722 if (MIR_ENABLE_TESTS)
723 find_package(GtestGmock REQUIRED)
724- pkg_check_modules(LIBEVDEV REQUIRED libevdev)
725 include_directories(${GMOCK_INCLUDE_DIR} ${GTEST_INCLUDE_DIR})
726 add_subdirectory(tests/)
727
728 # There's no nice way to format this. Thanks CMake.
729- mir_add_test(NAME LGPL-required
730- COMMAND /bin/sh -c "! grep -rl 'GNU General' ${PROJECT_SOURCE_DIR}/src/client ${PROJECT_SOURCE_DIR}/include/client ${PROJECT_SOURCE_DIR}/src/common ${PROJECT_SOURCE_DIR}/include/common ${PROJECT_SOURCE_DIR}/src/include/common ${PROJECT_SOURCE_DIR}/src/platform ${PROJECT_SOURCE_DIR}/include/platform ${PROJECT_SOURCE_DIR}/src/include/platform"
731- )
732- mir_add_test(NAME GPL-required
733- COMMAND /bin/sh -c "! grep -rl 'GNU Lesser' ${PROJECT_SOURCE_DIR}/src/server ${PROJECT_SOURCE_DIR}/include/server ${PROJECT_SOURCE_DIR}/src/include/server ${PROJECT_SOURCE_DIR}/tests ${PROJECT_SOURCE_DIR}/examples"
734- )
735-
736- mir_add_test(NAME package-abis
737- COMMAND /bin/sh -c "cd ${PROJECT_SOURCE_DIR} && tools/update_package_abis.sh --check --verbose")
738+ add_test(LGPL-required
739+ /bin/sh -c "! grep -rl 'GNU General' ${PROJECT_SOURCE_DIR}/src/client ${PROJECT_SOURCE_DIR}/include/client ${PROJECT_SOURCE_DIR}/src/common ${PROJECT_SOURCE_DIR}/include/common ${PROJECT_SOURCE_DIR}/src/include/common ${PROJECT_SOURCE_DIR}/src/platform ${PROJECT_SOURCE_DIR}/include/platform ${PROJECT_SOURCE_DIR}/src/include/platform"
740+ )
741+ add_test(GPL-required
742+ /bin/sh -c "! grep -rl 'GNU Lesser' ${PROJECT_SOURCE_DIR}/src/server ${PROJECT_SOURCE_DIR}/include/server ${PROJECT_SOURCE_DIR}/src/include/server ${PROJECT_SOURCE_DIR}/tests ${PROJECT_SOURCE_DIR}/examples"
743+ )
744+
745 endif ()
746
747 enable_coverage_report(mirserver)
748@@ -236,7 +233,3 @@
749 include (cmake/ABICheck.cmake)
750
751 add_subdirectory(snappy)
752-
753-add_custom_target(ptest
754- COMMAND "${CMAKE_SOURCE_DIR}/tools/run_ctests.sh" "--cost-file" "${CMAKE_BINARY_DIR}/ptest_ctest_cost_data.txt" "sh ${CMAKE_BINARY_DIR}/discover_all_tests.sh" "--" "$$ARGS"
755- )
756
757=== modified file 'benchmarks/android-input/CMakeLists.txt'
758--- benchmarks/android-input/CMakeLists.txt 2015-05-07 09:06:20 +0000
759+++ benchmarks/android-input/CMakeLists.txt 2015-05-20 14:01:27 +0000
760@@ -14,8 +14,8 @@
761 target_link_libraries(
762 input-reader-perf
763
764- android-input-static
765- mir-test-doubles-static
766+ android-input
767+ mir-test-doubles
768 mirserver
769 )
770
771
772=== modified file 'benchmarks/benchmark_multiplexing_dispatchable.cpp'
773--- benchmarks/benchmark_multiplexing_dispatchable.cpp 2015-05-07 09:06:20 +0000
774+++ benchmarks/benchmark_multiplexing_dispatchable.cpp 2015-05-20 14:01:27 +0000
775@@ -20,6 +20,7 @@
776 #include "mir/dispatch/simple_dispatch_thread.h"
777
778 #include <iostream>
779+#include <atomic>
780 #include <vector>
781 #include <memory>
782 #include <chrono>
783
784=== modified file 'benchmarks/frame-uniformity/CMakeLists.txt'
785--- benchmarks/frame-uniformity/CMakeLists.txt 2015-05-07 09:06:20 +0000
786+++ benchmarks/frame-uniformity/CMakeLists.txt 2015-05-20 14:01:27 +0000
787@@ -23,13 +23,17 @@
788 target_link_libraries(frame_uniformity_test_client
789 mirserver
790 mirclient
791+
792+ mir-test
793+ mir-test-framework
794+ mir-test-doubles
795+ mir-test-doubles-platform
796+
797+ # Why does this have to come after mir-test-framework here but not in tests/acceptance-tests/
798+ # /CMakeLists.txt? ~racarr
799 mirplatform
800-
801- mir-test-static
802- mir-test-framework-static
803- mir-test-doubles-static
804- mir-test-doubles-platform-static
805
806+ 3rd_party
807 ${PROTOBUF_LIBRARIES}
808 ${Boost_LIBRARIES}
809 ${GTEST_BOTH_LIBRARIES}
810
811=== modified file 'benchmarks/frame-uniformity/main.cpp'
812--- benchmarks/frame-uniformity/main.cpp 2015-03-31 02:35:42 +0000
813+++ benchmarks/frame-uniformity/main.cpp 2015-05-20 14:01:27 +0000
814@@ -18,7 +18,6 @@
815
816 #include "frame_uniformity_test.h"
817 #include "mir_test_framework/executable_path.h"
818-#include "mir/geometry/displacement.h"
819
820 #include <assert.h>
821 #include <cmath>
822@@ -47,7 +46,9 @@
823
824 double alpha = elapsed_interval / total_interval;
825
826- return touch_start + alpha*(touch_end-touch_start);
827+ auto ix = touch_start.x.as_int() + (touch_end.x.as_int()-touch_start.x.as_int())*alpha;
828+ auto iy = touch_start.y.as_int() + (touch_end.y.as_int()-touch_start.y.as_int())*alpha;
829+ return {ix, iy};
830 }
831
832 double pixel_lag_for_sample_at_time(geom::Point touch_start_point, geom::Point touch_end_point,
833@@ -57,12 +58,10 @@
834 {
835 auto expected_point = interpolated_touch_at_time(touch_start_point, touch_end_point, touch_start_time,
836 touch_end_time, sample.frame_time);
837-
838- geom::Displacement const displacement{
839- sample.x - expected_point.x.as_int(),
840- sample.y - expected_point.y.as_int()};
841-
842- return std::sqrt(displacement.length_squared());
843+ auto dx = sample.x - expected_point.x.as_int();
844+ auto dy = sample.y - expected_point.y.as_int();
845+ auto distance = std::sqrt(dx*dx+dy*dy);
846+ return distance;
847 }
848
849 double compute_average_frame_offset(std::vector<TouchSamples::Sample> const& results,
850
851=== modified file 'benchmarks/frame-uniformity/touch_measuring_client.cpp'
852--- benchmarks/frame-uniformity/touch_measuring_client.cpp 2015-05-07 09:06:20 +0000
853+++ benchmarks/frame-uniformity/touch_measuring_client.cpp 2015-05-20 14:01:27 +0000
854@@ -22,7 +22,12 @@
855
856 #include "mir_toolkit/mir_client_library.h"
857
858+#include <chrono>
859+#include <memory>
860+#include <vector>
861+
862 #include <iostream>
863+#include <assert.h>
864
865 namespace mt = mir::test;
866
867@@ -34,15 +39,13 @@
868 MirPixelFormat pixel_format;
869 unsigned int valid_formats;
870 mir_connection_get_available_surface_formats(connection, &pixel_format, 1, &valid_formats);
871-
872- auto const spec = mir_connection_create_spec_for_normal_surface(
873- connection, 1024, 1024, pixel_format);
874- mir_surface_spec_set_name(spec, "frame-uniformity-test");
875- mir_surface_spec_set_buffer_usage(spec, mir_buffer_usage_hardware);
876-
877- auto surface = mir_surface_create_sync(spec);
878- mir_surface_spec_release(spec);
879+ MirSurfaceParameters const surface_params = { "frame-uniformity-test",
880+ 1024, 1024, /* TODO: Ensure fullscreen? */
881+ pixel_format,
882+ mir_buffer_usage_hardware,
883+ mir_display_output_id_invalid};
884
885+ auto surface = mir_connection_create_surface_sync(connection, &surface_params);
886 if (!mir_surface_is_valid(surface))
887 {
888 std::cerr << "Surface creation failed: " << mir_surface_get_error_message(surface) << std::endl;
889@@ -61,7 +64,8 @@
890
891 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)
892 {
893- mir_surface_set_event_handler(surface, input_callback, results.get());
894+ MirEventDelegate event_handler = { input_callback, results.get() };
895+ mir_surface_set_event_handler(surface, &event_handler);
896
897 client_ready.ready();
898
899
900=== modified file 'benchmarks/frame-uniformity/touch_measuring_client.h'
901--- benchmarks/frame-uniformity/touch_measuring_client.h 2015-05-07 09:06:20 +0000
902+++ benchmarks/frame-uniformity/touch_measuring_client.h 2015-05-20 14:01:27 +0000
903@@ -23,8 +23,13 @@
904
905 #include "mir_test/barrier.h"
906
907+#include "mir_toolkit/mir_client_library.h"
908+
909 #include <chrono>
910 #include <memory>
911+#include <vector>
912+#include <string>
913+#include <mutex>
914
915 class TouchMeasuringClient
916 {
917
918=== modified file 'benchmarks/frame-uniformity/touch_producing_server.cpp'
919--- benchmarks/frame-uniformity/touch_producing_server.cpp 2015-03-31 02:35:42 +0000
920+++ benchmarks/frame-uniformity/touch_producing_server.cpp 2015-05-20 14:01:27 +0000
921@@ -21,7 +21,6 @@
922
923 #include "mir_test/event_factory.h"
924 #include "mir_test/fake_event_hub.h"
925-#include "mir/geometry/displacement.h"
926
927 #include <functional>
928
929@@ -102,7 +101,8 @@
930 touch_end_time = now;
931
932 double alpha = (now.time_since_epoch().count()-start.time_since_epoch().count()) / static_cast<double>(end.time_since_epoch().count()-start.time_since_epoch().count());
933- auto point = touch_start + alpha*(touch_end-touch_start);
934+ auto point = geom::Point{touch_start.x.as_int()+(touch_end.x.as_int()-touch_start.x.as_int())*alpha,
935+ touch_start.y.as_int()+(touch_end.y.as_int()-touch_start.y.as_int())*alpha};
936 synthesize_event_at(point);
937 }
938 }
939
940=== modified file 'benchmarks/frame-uniformity/touch_samples.cpp'
941--- benchmarks/frame-uniformity/touch_samples.cpp 2015-04-09 08:57:24 +0000
942+++ benchmarks/frame-uniformity/touch_samples.cpp 2015-05-20 14:01:27 +0000
943@@ -16,6 +16,8 @@
944 * Authored by: Robert Carr <robert.carr@canonical.com>
945 */
946
947+#define MIR_INCLUDE_DEPRECATED_EVENT_HEADER
948+
949 #include "touch_samples.h"
950
951 void TouchSamples::record_frame_time(std::chrono::high_resolution_clock::time_point time)
952@@ -34,26 +36,21 @@
953 {
954 std::unique_lock<std::mutex> lg(guard);
955
956- if (mir_event_get_type(&event) != mir_event_type_input)
957- return;
958- auto iev = mir_event_get_input_event(&event);
959- if (mir_input_event_get_type(iev) != mir_input_event_type_touch)
960- return;
961- auto tev = mir_input_event_get_touch_event(iev);
962-
963+ if (event.type != mir_event_type_motion)
964+ return;
965+
966+ auto const& mev = event.motion;
967+ if (mev.action != mir_motion_action_down &&
968+ mev.action != mir_motion_action_up &&
969+ mev.action != mir_motion_action_move)
970+ {
971+ return;
972+ }
973 // We could support multitouch, etc...
974- size_t touch_index = 0;
975- auto action = mir_touch_event_action(tev, touch_index);
976- if (action != mir_touch_action_down &&
977- action != mir_touch_action_up &&
978- action != mir_touch_action_change)
979- {
980- return;
981- }
982- auto x = mir_touch_event_axis_value(tev, 0, mir_touch_axis_x);
983- auto y = mir_touch_event_axis_value(tev, 0, mir_touch_axis_y);
984+ auto const& coordinates = mev.pointer_coordinates[0];
985+
986 // TODO: Record both event time and reception time
987- samples_being_prepared.push_back(Sample{x, y, reception_time, {}});
988+ samples_being_prepared.push_back(Sample{coordinates.x, coordinates.y, reception_time, {}});
989 }
990
991 std::vector<TouchSamples::Sample> TouchSamples::get()
992
993=== modified file 'benchmarks/frame-uniformity/vsync_simulating_graphics_platform.cpp'
994--- benchmarks/frame-uniformity/vsync_simulating_graphics_platform.cpp 2015-03-31 02:35:42 +0000
995+++ benchmarks/frame-uniformity/vsync_simulating_graphics_platform.cpp 2015-05-20 14:01:27 +0000
996@@ -36,21 +36,20 @@
997 namespace
998 {
999
1000-struct StubDisplaySyncGroup : mg::DisplaySyncGroup
1001+struct StubDisplayBuffer : mtd::StubDisplayBuffer
1002 {
1003- StubDisplaySyncGroup(geom::Size output_size, int vsync_rate_in_hz) :
1004- vsync_rate_in_hz(vsync_rate_in_hz),
1005- last_sync(std::chrono::high_resolution_clock::now()),
1006- buffer({{0, 0}, output_size})
1007- {
1008- }
1009-
1010- void for_each_display_buffer(std::function<void(mg::DisplayBuffer&)> const& exec) override
1011- {
1012- exec(buffer);
1013- }
1014-
1015- void post() override
1016+ StubDisplayBuffer(geom::Size output_size, int vsync_rate_in_hz)
1017+ : mtd::StubDisplayBuffer({{0, 0}, output_size}),
1018+ vsync_rate_in_hz(vsync_rate_in_hz),
1019+ last_sync(std::chrono::high_resolution_clock::now())
1020+ {
1021+ }
1022+
1023+ void gl_swap_buffers() override
1024+ {
1025+ }
1026+
1027+ void flip() override
1028 {
1029 auto now = std::chrono::high_resolution_clock::now();
1030 auto next_sync = last_sync + std::chrono::seconds(1) / vsync_rate_in_hz;
1031@@ -64,24 +63,22 @@
1032 double const vsync_rate_in_hz;
1033
1034 std::chrono::high_resolution_clock::time_point last_sync;
1035-
1036- mtd::StubDisplayBuffer buffer;
1037 };
1038
1039 struct StubDisplay : public mtd::StubDisplay
1040 {
1041- StubDisplay(geom::Size output_size, int vsync_rate_in_hz) :
1042- mtd::StubDisplay({{{0,0}, output_size}}),
1043- group(output_size, vsync_rate_in_hz)
1044+ StubDisplay(geom::Size output_size, int vsync_rate_in_hz)
1045+ : mtd::StubDisplay({{{0,0}, output_size}}),
1046+ buffer(output_size, vsync_rate_in_hz)
1047 {
1048 }
1049
1050- void for_each_display_sync_group(std::function<void(mg::DisplaySyncGroup&)> const& exec) override
1051+ void for_each_display_buffer(std::function<void(mg::DisplayBuffer&)> const& exec) override
1052 {
1053- exec(group);
1054+ exec(buffer);
1055 }
1056
1057- StubDisplaySyncGroup group;
1058+ StubDisplayBuffer buffer;
1059 };
1060
1061 }
1062
1063=== modified file 'cmake/ABICheck.cmake'
1064--- cmake/ABICheck.cmake 2015-05-07 09:06:20 +0000
1065+++ cmake/ABICheck.cmake 2015-05-20 14:01:27 +0000
1066@@ -80,14 +80,10 @@
1067 make_lib_descriptor(server)
1068 make_lib_descriptor(common INCLUDE_PRIVATE EXCLUDE_HEADERS ${mircommon-exclude-headers})
1069 make_lib_descriptor(platform INCLUDE_PRIVATE EXCLUDE_HEADERS ${mirplatform-exclude-headers})
1070-if(MIR_BUILD_PLATFORM_MESA)
1071 make_lib_descriptor(clientplatformmesa LIBRARY_HEADER ${CMAKE_SOURCE_DIR}/src/include/client/mir/client_platform_factory.h)
1072+make_lib_descriptor(clientplatformandroid LIBRARY_HEADER ${CMAKE_SOURCE_DIR}/src/include/client/mir/client_platform_factory.h)
1073 make_lib_descriptor(platformgraphicsmesa LIBRARY_HEADER ${CMAKE_SOURCE_DIR}/include/platform/mir/graphics/platform.h)
1074-endif()
1075-if(MIR_BUILD_PLATFORM_ANDROID)
1076-make_lib_descriptor(clientplatformandroid LIBRARY_HEADER ${CMAKE_SOURCE_DIR}/src/include/client/mir/client_platform_factory.h)
1077 make_lib_descriptor(platformgraphicsandroid LIBRARY_HEADER ${CMAKE_SOURCE_DIR}/include/platform/mir/graphics/platform.h)
1078-endif()
1079
1080 add_custom_target(abi-release-dump
1081 COMMAND /bin/sh -c '${CMAKE_SOURCE_DIR}/tools/generate-abi-base-dump.sh ${CMAKE_SOURCE_DIR}'
1082@@ -124,13 +120,7 @@
1083 )
1084 endmacro(_define_abi_check_for)
1085
1086-set(the_libs mirserver mirclient mircommon mirplatform)
1087-if(MIR_BUILD_PLATFORM_MESA)
1088- set(the_libs ${the_libs} mirclientplatformmesa mirplatformgraphicsmesa)
1089-endif()
1090-if(MIR_BUILD_PLATFORM_ANDROID)
1091- set(the_libs ${the_libs} mirclientplatformandroid mirplatformgraphicsandroid)
1092-endif()
1093+set(the_libs mirserver mirclient mircommon mirplatform mirclientplatformmesa mirclientplatformandroid mirplatformgraphicsmesa mirplatformgraphicsandroid)
1094
1095 foreach(libname ${the_libs})
1096 _define_abi_dump_for(${libname})
1097
1098=== modified file 'cmake/FindGtestGmock.cmake'
1099--- cmake/FindGtestGmock.cmake 2015-03-31 02:35:42 +0000
1100+++ cmake/FindGtestGmock.cmake 2015-05-20 14:01:27 +0000
1101@@ -26,8 +26,6 @@
1102 endif()
1103
1104 set(GTEST_CMAKE_ARGS "-DCMAKE_CXX_FLAGS=${GTEST_CXX_FLAGS}")
1105-list(APPEND GTEST_CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER})
1106-list(APPEND GTEST_CMAKE_ARGS -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER})
1107 if (${CMAKE_CROSSCOMPILING})
1108 list(APPEND GTEST_CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_MODULE_PATH}/LinuxCrossCompile.cmake)
1109 endif()
1110
1111=== modified file 'cmake/MirCommon.cmake'
1112--- cmake/MirCommon.cmake 2015-05-07 09:06:20 +0000
1113+++ cmake/MirCommon.cmake 2015-05-20 14:01:27 +0000
1114@@ -1,9 +1,14 @@
1115 cmake_minimum_required (VERSION 2.6)
1116 # Create target to discover tests
1117-include (CMakeParseArguments)
1118
1119 include(CMakeDependentOption)
1120-file(REMOVE ${CMAKE_BINARY_DIR}/discover_all_tests.sh)
1121+
1122+CMAKE_DEPENDENT_OPTION(
1123+ DISABLE_GTEST_TEST_DISCOVERY
1124+ "If set to ON, disables fancy test autodiscovery and switches back to classic add_test behavior"
1125+ OFF
1126+ "NOT CMAKE_CROSSCOMPILING"
1127+ ON)
1128
1129 option(
1130 ENABLE_MEMCHECK_OPTION
1131@@ -23,82 +28,128 @@
1132 valgrind)
1133
1134 if(VALGRIND_EXECUTABLE)
1135- set(VALGRIND_CMD "${VALGRIND_EXECUTABLE}" "--error-exitcode=1" "--trace-children=yes" "--leak-check=full" "--show-leak-kinds=definite" "--errors-for-leak-kinds=definite")
1136- set(VALGRIND_CMD ${VALGRIND_CMD} "--suppressions=${CMAKE_SOURCE_DIR}/tools/valgrind_suppressions_generic")
1137- set(VALGRIND_CMD ${VALGRIND_CMD} "--suppressions=${CMAKE_SOURCE_DIR}/tools/valgrind_suppressions_glibc_2.21")
1138+ set(VALGRIND_ARGS "--error-exitcode=1" "--trace-children=yes" "--leak-check=full" "--show-leak-kinds=definite" "--errors-for-leak-kinds=definite")
1139+ set(VALGRIND_ARGS ${VALGRIND_ARGS} "--suppressions=${CMAKE_SOURCE_DIR}/tools/valgrind_suppressions_generic")
1140+ set(VALGRIND_ARGS ${VALGRIND_ARGS} "--suppressions=${CMAKE_SOURCE_DIR}/tools/valgrind_suppressions_glibc_2.21")
1141+ set(DISCOVER_FLAGS "--enable-memcheck")
1142+ set(DISCOVER_FLAGS ${DISCOVER_FLAGS} "--suppressions=${CMAKE_SOURCE_DIR}/tools/valgrind_suppressions_generic")
1143+ set(DISCOVER_FLAGS ${DISCOVER_FLAGS} "--suppressions=${CMAKE_SOURCE_DIR}/tools/valgrind_suppressions_glibc_2.21")
1144 if (TARGET_ARCH STREQUAL "arm-linux-gnueabihf")
1145- set(VALGRIND_CMD ${VALGRIND_CMD} "--suppressions=${CMAKE_SOURCE_DIR}/tools/valgrind_suppressions_armhf")
1146+ set(VALGRIND_ARGS ${VALGRIND_ARGS} "--suppressions=${CMAKE_SOURCE_DIR}/tools/valgrind_suppressions_armhf")
1147+ set(DISCOVER_FLAGS ${DISCOVER_FLAGS} "--suppressions=${CMAKE_SOURCE_DIR}/tools/valgrind_suppressions_armhf")
1148 endif()
1149 else(VALGRIND_EXECUTABLE)
1150 message("Not enabling memcheck as valgrind is missing on your system")
1151 endif(VALGRIND_EXECUTABLE)
1152 endif(ENABLE_MEMCHECK_OPTION)
1153
1154-function (list_to_string LIST_VAR PREFIX STR_VAR)
1155- foreach (value ${LIST_VAR})
1156- set(tmp_str "${tmp_str} ${PREFIX} ${value}")
1157- endforeach()
1158- set(${STR_VAR} "${tmp_str}" PARENT_SCOPE)
1159-endfunction()
1160-
1161 function (mir_discover_tests EXECUTABLE)
1162- # Set vars
1163- set(test_cmd_no_memcheck "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${EXECUTABLE}")
1164- set(test_cmd "${test_cmd_no_memcheck}")
1165- set(test_env ${ARGN})
1166- set(test_name ${EXECUTABLE})
1167- set(test_no_memcheck_filter)
1168- set(test_exclusion_filter)
1169-
1170- if(ENABLE_MEMCHECK_OPTION)
1171- set(test_cmd ${VALGRIND_CMD} ${test_cmd_no_memcheck})
1172- set(test_no_memcheck_filter "*DeathTest.*")
1173- endif()
1174-
1175- if(cmake_build_type_lower MATCHES "threadsanitizer")
1176- find_program(LLVM_SYMBOLIZER llvm-symbolizer-3.6)
1177- if (LLVM_SYMBOLIZER)
1178- set(TSAN_EXTRA_OPTIONS "external_symbolizer_path=${LLVM_SYMBOLIZER}")
1179- endif()
1180- # Space after ${TSAN_EXTRA_OPTIONS} works around bug in TSAN env. variable parsing
1181- list(APPEND test_env "TSAN_OPTIONS=\"suppressions=${CMAKE_SOURCE_DIR}/tools/tsan-suppressions second_deadlock_stack=1 halt_on_error=1 history_size=7 ${TSAN_EXTRA_OPTIONS} \"")
1182- # TSan does not support multi-threaded fork
1183- # TSan may open fds so "surface_creation_does_not_leak_fds" will not work as written
1184- # TSan deadlocks when running StreamTransportTest/0.SendsFullMessagesWhenInterrupted - disable it until understood
1185- set(test_exclusion_filter "UnresponsiveClient.does_not_hang_server:DemoInProcessServerWithStubClientPlatform.surface_creation_does_not_leak_fds:StreamTransportTest/0.SendsFullMessagesWhenInterrupted")
1186- endif()
1187-
1188- # Final commands
1189- set(test_cmd "${test_cmd}" "--gtest_filter=-${test_no_memcheck_filter}:${test_exclusion_filter}")
1190- set(test_cmd_no_memcheck "${test_cmd_no_memcheck}" "--gtest_filter=${test_no_memcheck_filter}:-${test_exclusion_filter}")
1191-
1192- # Normal
1193- add_test(${test_name} ${test_cmd})
1194- set_property(TEST ${test_name} PROPERTY ENVIRONMENT ${test_env})
1195- if (test_no_memcheck_filter)
1196- add_test(${test_name}_no_memcheck ${test_cmd_no_memcheck})
1197- set_property(TEST ${test_name}_no_memcheck PROPERTY ENVIRONMENT ${test_env})
1198- endif()
1199-
1200- # ptest
1201- list_to_string("${test_env}" "--env" discover_env)
1202- list_to_string("${test_cmd}" "" discover_cmd)
1203- list_to_string("${test_cmd_no_memcheck}" "" discover_cmd_no_memcheck)
1204-
1205- file(APPEND ${CMAKE_BINARY_DIR}/discover_all_tests.sh
1206- "sh ${CMAKE_SOURCE_DIR}/tools/discover_gtests.sh ${discover_env} -- ${discover_cmd}\n")
1207- if (test_no_memcheck_filter)
1208- file(APPEND ${CMAKE_BINARY_DIR}/discover_all_tests.sh
1209- "sh ${CMAKE_SOURCE_DIR}/tools/discover_gtests.sh ${discover_env} -- ${discover_cmd_no_memcheck}\n")
1210+ if(DISABLE_GTEST_TEST_DISCOVERY)
1211+ execute_process(
1212+ COMMAND uname -r
1213+ OUTPUT_VARIABLE KERNEL_VERSION_FULL
1214+ OUTPUT_STRIP_TRAILING_WHITESPACE
1215+ )
1216+ string(REGEX MATCH "^[0-9]+[.][0-9]+" KERNEL_VERSION ${KERNEL_VERSION_FULL})
1217+ message(STATUS "Kernel version detected: " ${KERNEL_VERSION})
1218+ # Some tests expect kernel version 3.11 and up
1219+ if (${KERNEL_VERSION} VERSION_LESS "3.11")
1220+ add_test(${EXECUTABLE} ${VALGRIND_EXECUTABLE} ${VALGRIND_ARGS} ${EXECUTABLE_OUTPUT_PATH}/${EXECUTABLE}
1221+ "--gtest_filter=-*DeathTest.*:AnonymousShmFile.*:MesaBufferAllocatorTest.software_buffers_dont_bypass:MesaBufferAllocatorTest.creates_software_rendering_buffer")
1222+ else()
1223+ add_test(${EXECUTABLE} ${VALGRIND_EXECUTABLE} ${VALGRIND_ARGS} ${EXECUTABLE_OUTPUT_PATH}/${EXECUTABLE}
1224+ "--gtest_filter=-*DeathTest.*")
1225+ endif()
1226+
1227+ add_test(${EXECUTABLE}_death_tests ${EXECUTABLE_OUTPUT_PATH}/${EXECUTABLE} "--gtest_filter=*DeathTest.*")
1228+ if (${ARGC} GREATER 1)
1229+ set_property(TEST ${EXECUTABLE} PROPERTY ENVIRONMENT ${ARGN})
1230+ set_property(TEST ${EXECUTABLE}_death_tests PROPERTY ENVIRONMENT ${ARGN})
1231+ endif()
1232+ else()
1233+ set(CHECK_TEST_DISCOVERY_TARGET_NAME "check_discover_tests_in_${EXECUTABLE}")
1234+ set(TEST_DISCOVERY_TARGET_NAME "discover_tests_in_${EXECUTABLE}")
1235+ message(STATUS "Defining targets: ${CHECK_TEST_DISCOVERY_TARGET_NAME} and ${TEST_DISCOVERY_TARGET_NAME}")
1236+
1237+ # These targets are always considered out-of-date, and are always run (at least for normal builds, except for make test/install).
1238+ add_custom_target(
1239+ ${CHECK_TEST_DISCOVERY_TARGET_NAME} ALL
1240+ ${EXECUTABLE_OUTPUT_PATH}/${EXECUTABLE} --gtest_list_tests > /dev/null
1241+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
1242+ COMMENT "Check that discovering Tests in ${EXECUTABLE} works")
1243+
1244+ if (MIR_BUILD_PLATFORM_ANDROID)
1245+ add_dependencies(${CHECK_TEST_DISCOVERY_TARGET_NAME} mirplatformgraphicsandroid)
1246+ endif()
1247+
1248+ if (MIR_BUILD_PLATFORM_MESA)
1249+ add_dependencies(${CHECK_TEST_DISCOVERY_TARGET_NAME} mirplatformgraphicsmesa)
1250+ endif()
1251+
1252+ if (${ARGC} GREATER 1)
1253+ foreach (env ${ARGN})
1254+ list(APPEND EXTRA_ENV_FLAGS "--add-environment" "${env}")
1255+ endforeach()
1256+ endif()
1257+
1258+ if(cmake_build_type_lower MATCHES "threadsanitizer")
1259+ find_program(LLVM_SYMBOLIZER llvm-symbolizer-3.6)
1260+ if (LLVM_SYMBOLIZER)
1261+ set(TSAN_EXTRA_OPTIONS "external_symbolizer_path=${LLVM_SYMBOLIZER}")
1262+ endif()
1263+ list(APPEND EXTRA_ENV_FLAGS "--add-environment" "TSAN_OPTIONS=suppressions=${CMAKE_SOURCE_DIR}/tools/tsan-suppressions second_deadlock_stack=1 halt_on_error=1 history_size=7 ${TSAN_EXTRA_OPTIONS}")
1264+ # TSan does not support multi-threaded fork
1265+ # TSan may open fds so "surface_creation_does_not_leak_fds" will not work as written
1266+ # TSan deadlocks when running StreamTransportTest/0.SendsFullMessagesWhenInterrupted - disable it until understood
1267+ set(EXCLUDED_TESTS "UnresponsiveClient.does_not_hang_server:DemoInProcessServerWithStubClientPlatform.surface_creation_does_not_leak_fds:StreamTransportTest/0.SendsFullMessagesWhenInterrupted")
1268+ endif()
1269+
1270+ add_custom_target(
1271+ ${TEST_DISCOVERY_TARGET_NAME} ALL
1272+ ${EXECUTABLE_OUTPUT_PATH}/${EXECUTABLE} --gtest_list_tests | ${CMAKE_BINARY_DIR}/mir_gtest/mir_discover_gtest_tests --executable=${EXECUTABLE_OUTPUT_PATH}/${EXECUTABLE} --exclusions=${EXCLUDED_TESTS} ${DISCOVER_FLAGS}
1273+ ${EXTRA_ENV_FLAGS}
1274+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
1275+ COMMENT "Discovering Tests in ${EXECUTABLE}" VERBATIM)
1276+
1277+ add_dependencies(
1278+ ${CHECK_TEST_DISCOVERY_TARGET_NAME}
1279+ ${EXECUTABLE})
1280+
1281+ add_dependencies(
1282+ ${TEST_DISCOVERY_TARGET_NAME}
1283+
1284+ ${CHECK_TEST_DISCOVERY_TARGET_NAME}
1285+ ${EXECUTABLE}
1286+ mir_discover_gtest_tests)
1287+
1288 endif()
1289 endfunction ()
1290
1291 function (mir_add_memcheck_test)
1292 if (ENABLE_MEMCHECK_OPTION)
1293- add_custom_target(memcheck_test ALL)
1294- mir_add_test(NAME "memcheck-test"
1295- COMMAND ${CMAKE_BINARY_DIR}/mir_gtest/fail_on_success.sh ${VALGRIND_CMD} ${CMAKE_BINARY_DIR}/mir_gtest/mir_test_memory_error)
1296- add_dependencies(memcheck_test mir_test_memory_error)
1297+ if(DISABLE_GTEST_TEST_DISCOVERY)
1298+ add_custom_target(
1299+ memcheck_test ALL
1300+ )
1301+ ADD_TEST("memcheck-test" ${CMAKE_BINARY_DIR}/mir_gtest/fail_on_success.sh ${VALGRIND_EXECUTABLE} ${VALGRIND_ARGS} ${CMAKE_BINARY_DIR}/mir_gtest/mir_test_memory_error)
1302+ add_dependencies(
1303+ memcheck_test
1304+
1305+ mir_test_memory_error
1306+ )
1307+ else()
1308+ add_custom_target(
1309+ memcheck_test ALL
1310+ ${CMAKE_BINARY_DIR}/mir_gtest/mir_discover_gtest_tests --executable=${CMAKE_BINARY_DIR}/mir_gtest/mir_test_memory_error --memcheck-test ${DISCOVER_FLAGS}
1311+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
1312+ COMMENT "Adding memcheck test" VERBATIM)
1313+
1314+ add_dependencies(
1315+ memcheck_test
1316+
1317+ mir_discover_gtest_tests
1318+ mir_test_memory_error)
1319+ endif()
1320 endif()
1321 endfunction()
1322
1323@@ -139,7 +190,7 @@
1324 if ("${modifier}" STREQUAL "NOINSTALL")
1325 list(REMOVE_AT ARGN 0)
1326 else()
1327- install(PROGRAMS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${REAL_EXECUTABLE}
1328+ install(PROGRAMS ${CMAKE_BINARY_DIR}/bin/${REAL_EXECUTABLE}
1329 DESTINATION ${CMAKE_INSTALL_BINDIR}
1330 RENAME ${TARGET}
1331 )
1332@@ -152,29 +203,7 @@
1333 )
1334
1335 add_custom_target(${TARGET}-wrapped
1336- ln -fs wrapper ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TARGET}
1337+ ln -fs wrapper ${CMAKE_BINARY_DIR}/bin/${TARGET}
1338 )
1339 add_dependencies(${TARGET} ${TARGET}-wrapped)
1340 endfunction()
1341-
1342-function (mir_add_test)
1343- # Add test normally
1344- add_test(${ARGN})
1345-
1346- # Add to to discovery for parallel test running
1347- set(one_value_args "NAME" WORKING_DIRECTORY)
1348- set(multi_value_args "COMMAND")
1349- cmake_parse_arguments(MAT "" "${one_value_args}" "${multi_value_args}" ${ARGN})
1350-
1351- foreach (cmd ${MAT_COMMAND})
1352- set(cmdstr "${cmdstr} \\\"${cmd}\\\"")
1353- endforeach()
1354-
1355- file(APPEND ${CMAKE_BINARY_DIR}/discover_all_tests.sh
1356- "echo \"add_test(${MAT_NAME} ${cmdstr})\"\n")
1357-
1358- if (MAT_WORKING_DIRECTORY)
1359- file(APPEND ${CMAKE_BINARY_DIR}/discover_all_tests.sh
1360- "echo \"set_tests_properties(${MAT_NAME} PROPERTIES WORKING_DIRECTORY \\\"${MAT_WORKING_DIRECTORY}\\\")\"\n")
1361- endif()
1362-endfunction()
1363
1364=== modified file 'cmake/src/mir/CMakeLists.txt'
1365--- cmake/src/mir/CMakeLists.txt 2015-05-07 09:06:20 +0000
1366+++ cmake/src/mir/CMakeLists.txt 2015-05-20 14:01:27 +0000
1367@@ -1,4 +1,14 @@
1368 add_executable(
1369+ mir_discover_gtest_tests
1370+ EXCLUDE_FROM_ALL
1371+ ${CMAKE_CURRENT_SOURCE_DIR}/mir_discover_gtest_tests.cpp)
1372+
1373+set_target_properties(
1374+ mir_discover_gtest_tests PROPERTIES
1375+ RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/mir_gtest
1376+)
1377+
1378+add_executable(
1379 mir_test_memory_error
1380 EXCLUDE_FROM_ALL
1381 ${CMAKE_CURRENT_SOURCE_DIR}/mir_test_memory_error.cpp)
1382
1383=== added file 'cmake/src/mir/mir_discover_gtest_tests.cpp'
1384--- cmake/src/mir/mir_discover_gtest_tests.cpp 1970-01-01 00:00:00 +0000
1385+++ cmake/src/mir/mir_discover_gtest_tests.cpp 2015-05-20 14:01:27 +0000
1386@@ -0,0 +1,405 @@
1387+#include <algorithm>
1388+#include <cassert>
1389+#include <cstring>
1390+#include <map>
1391+#include <set>
1392+#include <string>
1393+#include <istream>
1394+#include <ostream>
1395+#include <fstream>
1396+#include <sstream>
1397+#include <iterator>
1398+#include <iostream>
1399+#include <vector>
1400+#include <libgen.h>
1401+
1402+#include <getopt.h>
1403+#include <sys/ioctl.h>
1404+#include <unistd.h>
1405+#ifndef _GNU_SOURCE
1406+// Needed for O_TMPFILE
1407+#define _GNU_SOURCE
1408+#endif
1409+#include <fcntl.h>
1410+
1411+using namespace std;
1412+
1413+namespace
1414+{
1415+enum DescriptorType
1416+{
1417+ test_case,
1418+ test_suite
1419+};
1420+
1421+DescriptorType check_line_for_test_case_or_suite(const string& line)
1422+{
1423+ if (line.find(" ") == 0)
1424+ return test_case;
1425+
1426+ return test_suite;
1427+}
1428+
1429+int get_output_width()
1430+{
1431+ const int fd_out{fileno(stdout)};
1432+ const int max_width{65535};
1433+
1434+ int width{max_width};
1435+
1436+ if (isatty(fd_out))
1437+ {
1438+ struct winsize w;
1439+ if (ioctl(fd_out, TIOCGWINSZ, &w) != -1)
1440+ width = w.ws_col;
1441+ }
1442+
1443+ return width;
1444+}
1445+
1446+string ordinary_cmd_line_pattern()
1447+{
1448+ static const char* pattern = "ADD_TEST(\"%s.%s\" \"%s\" \"--gtest_filter=%s:-%s\")\n";
1449+ return pattern;
1450+}
1451+
1452+vector<string> valgrind_cmd_patterns(vector<string> const& suppressions)
1453+{
1454+ vector<string> patterns{
1455+ "valgrind",
1456+ "--error-exitcode=1",
1457+ "--trace-children=yes"
1458+ };
1459+
1460+ for (auto const& sup : suppressions)
1461+ patterns.push_back(std::string("--suppressions=") + sup);
1462+
1463+ vector<string> gtest_patterns{
1464+ "%s",
1465+ "--gtest_death_test_use_fork",
1466+ "--gtest_filter=%s:-%s"
1467+ };
1468+
1469+ patterns.insert(patterns.end(), gtest_patterns.begin(), gtest_patterns.end());
1470+
1471+ return patterns;
1472+}
1473+
1474+string memcheck_cmd_line_pattern(vector<string> const& suppressions)
1475+{
1476+ stringstream ss;
1477+
1478+ ss << "ADD_TEST(\"memcheck(%s.%s)\"";
1479+ for (auto& s : valgrind_cmd_patterns(suppressions))
1480+ ss << " \"" << s << "\"";
1481+ ss << ")" << endl;
1482+
1483+ return ss.str();
1484+}
1485+
1486+std::string elide_string_left(const std::string& in, std::size_t max_size)
1487+{
1488+ assert(max_size >= 3);
1489+
1490+ if (in.size() <= max_size)
1491+ return in;
1492+
1493+ std::string result(in.begin() + (in.size() - max_size), in.end());
1494+
1495+ *(result.begin()) = '.';
1496+ *(result.begin()+1) = '.';
1497+ *(result.begin()+2) = '.';
1498+
1499+ return result;
1500+}
1501+
1502+struct Configuration
1503+{
1504+ Configuration() : executable(NULL),
1505+ enable_memcheck(false),
1506+ memcheck_test(false)
1507+ {
1508+ }
1509+
1510+ std::string exclusions_for(string const& test)
1511+ {
1512+ if (test.size() < 2)
1513+ return {};
1514+
1515+ // assuming test name is Foo.*
1516+ std::string test_name{test.substr(0, test.size() - 2)};
1517+ if (exclusions.find(test_name) != std::string::npos)
1518+ return exclusions;
1519+
1520+ return {};
1521+ }
1522+
1523+ const char* executable;
1524+ bool enable_memcheck;
1525+ bool memcheck_test;
1526+ std::vector<std::pair<std::string, std::string>> extra_environment;
1527+ std::vector<std::string> suppressions;
1528+ std::string exclusions;
1529+};
1530+
1531+bool parse_configuration_from_cmd_line(int argc, char** argv, Configuration& config)
1532+{
1533+ static struct option long_options[] = {
1534+ {"executable", required_argument, 0, 0},
1535+ {"enable-memcheck", no_argument, 0, 0},
1536+ {"memcheck-test", no_argument, 0, 0},
1537+ {"add-environment", required_argument, 0, 0},
1538+ {"suppressions", required_argument, 0, 0},
1539+ {"exclusions", required_argument, 0, 0},
1540+ {0, 0, 0, 0}
1541+ };
1542+
1543+ while(1)
1544+ {
1545+ int option_index = -1;
1546+ const char *optname = "";
1547+ int c = getopt_long(
1548+ argc,
1549+ argv,
1550+ "e:m",
1551+ long_options,
1552+ &option_index);
1553+
1554+ /* Detect the end of the options. */
1555+ if (c == -1)
1556+ break;
1557+
1558+ /* Detect an error in the passed options */
1559+ if (c == ':' || c == '?')
1560+ return false;
1561+
1562+ /* Check if we got a long option and get its name */
1563+ if (option_index != -1)
1564+ optname = long_options[option_index].name;
1565+
1566+ /* Handle options */
1567+ if (c == 'e' || !strcmp(optname, "executable"))
1568+ config.executable = optarg;
1569+ else if (c == 'm' || !strcmp(optname, "enable-memcheck"))
1570+ config.enable_memcheck = true;
1571+ else if (!strcmp(optname, "memcheck-test"))
1572+ config.memcheck_test = true;
1573+ else if (!strcmp(optname, "add-environment"))
1574+ {
1575+ char const* equal_pos = strchr(optarg, '=');
1576+ if (!equal_pos)
1577+ return false;
1578+ config.extra_environment.push_back(std::make_pair(std::string(optarg, equal_pos - optarg), std::string(equal_pos + 1)));
1579+ }
1580+ else if (!strcmp(optname, "suppressions"))
1581+ {
1582+ config.suppressions.push_back(std::string(optarg));
1583+ }
1584+ else if (!strcmp(optname, "exclusions"))
1585+ {
1586+ config.exclusions = optarg;
1587+ }
1588+
1589+ }
1590+
1591+ return true;
1592+}
1593+
1594+string prepareMemcheckTestLine(string const& exe, vector<string> const& suppressions, std::string const& exclusions)
1595+{
1596+ stringstream ss;
1597+
1598+ ss << "ADD_TEST(\"memcheck-test\" \"sh\" \"-c\" \"";
1599+ for (auto& s : valgrind_cmd_patterns(suppressions))
1600+ ss << s << " ";
1601+ ss << "; if [ $? != 0 ]; then exit 0; else exit 1; fi\")";
1602+
1603+ char cmd_line[1024] = "";
1604+ snprintf(cmd_line,
1605+ sizeof(cmd_line),
1606+ ss.str().c_str(),
1607+ exe.c_str(),
1608+ "*",
1609+ exclusions.c_str()
1610+ );
1611+
1612+ return cmd_line;
1613+}
1614+
1615+void emitMemcheckTest(string const& exe, vector<string> const& suppressions, std::string const& exclusions)
1616+{
1617+ ifstream CTestTestfile("CTestTestfile.cmake", ifstream::in);
1618+ bool need_memcheck_test = true;
1619+ string line;
1620+
1621+ string memcheckTestLine = prepareMemcheckTestLine(exe, suppressions, exclusions);
1622+
1623+ if (CTestTestfile.is_open())
1624+ {
1625+ while (CTestTestfile.good())
1626+ {
1627+ getline(CTestTestfile, line);
1628+
1629+ if (line == memcheckTestLine)
1630+ need_memcheck_test = false;
1631+ }
1632+
1633+ CTestTestfile.close();
1634+ }
1635+
1636+ if (need_memcheck_test)
1637+ {
1638+ ofstream CTestTestfileW ("CTestTestfile.cmake", ofstream::app | ofstream::out);
1639+
1640+ if (CTestTestfileW.is_open())
1641+ {
1642+ CTestTestfileW << memcheckTestLine << endl;
1643+ CTestTestfileW.close();
1644+ }
1645+ }
1646+}
1647+
1648+bool is_death_test(string const& test)
1649+{
1650+ // precondition: test will match Foo.*
1651+ // assumption: death tests will match FooDeathTest.*
1652+ bool death_test = false;
1653+ if (test.size() > strlen("DeathTest.*"))
1654+ death_test = test.substr(test.size() - strlen("DeathTest.*"),
1655+ strlen("DeathTest")) == "DeathTest";
1656+
1657+ return death_test;
1658+}
1659+
1660+}
1661+
1662+int main (int argc, char **argv)
1663+{
1664+ int output_width = get_output_width();
1665+
1666+ cin >> noskipws;
1667+
1668+ Configuration config;
1669+ if (!parse_configuration_from_cmd_line(argc, argv, config) || config.executable == NULL)
1670+ {
1671+ cout << "Usage: PATH_TO_TEST_BINARY --gtest_list_tests | " << basename(argv[0])
1672+ << " --executable PATH_TO_TEST_BINARY [--enable-memcheck]" << std::endl
1673+ << " or " << std::endl << basename(argv[0])
1674+ << " --executable PATH_TO_MEMCHECK_BINARY --memcheck-test" << std::endl;
1675+ return 1;
1676+ }
1677+
1678+ if (config.memcheck_test)
1679+ {
1680+ emitMemcheckTest(config.executable, config.suppressions, config.exclusions);
1681+ return 0;
1682+ }
1683+
1684+ set<string> tests;
1685+ string line;
1686+ string current_test;
1687+
1688+ while (getline (cin, line))
1689+ {
1690+ switch(check_line_for_test_case_or_suite(line))
1691+ {
1692+ case test_case:
1693+ tests.insert(current_test + "*");
1694+ break;
1695+ case test_suite:
1696+ auto suite_end = line.find(' ');
1697+ if (suite_end != std::string::npos)
1698+ {
1699+ line = line.substr(0, suite_end);
1700+ }
1701+ current_test = line;
1702+ break;
1703+ }
1704+ }
1705+
1706+ ofstream testfilecmake;
1707+ char* executable_copy = strdup(config.executable);
1708+ string test_suite(basename(executable_copy));
1709+ free(executable_copy);
1710+
1711+ testfilecmake.open(string(test_suite + "_test.cmake").c_str(), ios::out | ios::trunc);
1712+ if (testfilecmake.is_open())
1713+ {
1714+ for (auto& env_pair : config.extra_environment)
1715+ {
1716+ testfilecmake << "SET( ENV{"<<env_pair.first<<"} \""<<env_pair.second<<"\" )"<<std::endl;
1717+ }
1718+
1719+ int ret = open("/dev/shm", O_TMPFILE | O_RDWR | O_EXCL, S_IRWXU);
1720+ bool kernel_supports_O_TMPFILE = (ret != -1);
1721+ if (kernel_supports_O_TMPFILE) close(ret);
1722+
1723+ for (auto test = tests.begin(); test != tests.end(); ++ test)
1724+ {
1725+ static char cmd_line[1024] = "";
1726+
1727+
1728+ if (!kernel_supports_O_TMPFILE)
1729+ {
1730+ // Don't run AnonymousShmFile.* tests on older kernels
1731+ if (*test == "AnonymousShmFile.*")
1732+ continue;
1733+ if (*test == "MesaBufferAllocatorTest.*")
1734+ config.exclusions.append("MesaBufferAllocatorTest.software_buffers_dont_bypass:MesaBufferAllocatorTest.creates_software_rendering_buffer");
1735+ }
1736+
1737+ snprintf(
1738+ cmd_line,
1739+ sizeof(cmd_line),
1740+ (config.enable_memcheck && !is_death_test(*test)) ?
1741+ memcheck_cmd_line_pattern(config.suppressions).c_str() :
1742+ ordinary_cmd_line_pattern().c_str(),
1743+ test_suite.c_str(),
1744+ elide_string_left(*test, output_width/2).c_str(),
1745+ config.executable,
1746+ test->c_str(),
1747+ config.exclusions_for(*test).c_str());
1748+
1749+ if (testfilecmake.good())
1750+ {
1751+ testfilecmake << cmd_line;
1752+ }
1753+ }
1754+
1755+ testfilecmake.close();
1756+ }
1757+
1758+ ifstream CTestTestfile("CTestTestfile.cmake", ifstream::in);
1759+ bool need_include = true;
1760+ line.clear();
1761+
1762+ string includeLine = string ("INCLUDE (") +
1763+ test_suite +
1764+ string ("_test.cmake)");
1765+
1766+ if (CTestTestfile.is_open())
1767+ {
1768+ while (CTestTestfile.good())
1769+ {
1770+ getline(CTestTestfile, line);
1771+
1772+ if (line == includeLine)
1773+ need_include = false;
1774+ }
1775+
1776+ CTestTestfile.close();
1777+ }
1778+
1779+ if (need_include)
1780+ {
1781+ ofstream CTestTestfileW ("CTestTestfile.cmake", ofstream::app | ofstream::out);
1782+
1783+ if (CTestTestfileW.is_open())
1784+ {
1785+ CTestTestfileW << includeLine << endl;
1786+ CTestTestfileW.close();
1787+ }
1788+ }
1789+
1790+ return 0;
1791+}
1792
1793=== modified file 'debian/changelog'
1794--- debian/changelog 2015-05-19 14:51:07 +0000
1795+++ debian/changelog 2015-05-20 14:01:27 +0000
1796@@ -1,170 +1,15 @@
1797-mir (0.13.0+15.04.20150512-0ubuntu1) vivid; urgency=medium
1798+mir (0.12.1-0ubuntu2) UNRELEASED; urgency=medium
1799
1800- [ Alan Griffiths ]
1801- * New upstream release 0.13.0 (https://launchpad.net/mir/+milestone/0.13.0)
1802- - Very large release as the previous 0.12 series contained only minimal
1803- bug fixes...
1804+ * demo changes on top of 0.12.1
1805 - Enhancements:
1806- . New demo clients for input testing: mir_demo_client_eglsquare and
1807- mir_demo_client_target.
1808- . Demo clients: mir_demo_client_tooltip, mir_demo_client_animated_cursor
1809- . mir_demo_client_fingerpaint now processes input asynchronously to
1810- drawing for a more fluid experience.
1811- . New, default window manager in mir_demo_server
1812- . mir_demo_server option (--arw-file) to make socket filename globally rw
1813- . mir_demo_server demonstrates use of config file
1814- . Added support to mir_proving_server for rendering window title strings
1815- . Demo servers (mir_proving_server, mir_demo_server): Introduce support
1816- for Alt+` switching of windows in multi-window clients.
1817- . Added client API support for constructing input method surfaces.
1818- . Introduce "buffer streams" properly. This is a generalization of the
1819- most basic functionality of a surface.
1820- . Log useful OpenGL information on server start-up.
1821- . Add support for HWC 1.4
1822- . Add display and fencing information to the layers in the HWC report
1823- . Add a report_vsync method to display report
1824- . Support for second display when running on "android" driver stack
1825- . Server buffering strategy is configurable by --nbuffers=N
1826- (or environment MIR_SERVER_NBUFFERS=N)
1827- . Explicit support for configuring window management in libmirserver.
1828- . Remove surface configurator & placement strategy configuration points
1829- . Added experimental environment variable MIR_CLIENT_INPUT_RATE=Hz for
1830- tweaking the input resampling rate a client experiences (0 = off).
1831- Also raised the default input rate from 55Hz to 59Hz for visibly
1832- smoother touch scrolling.
1833- . Added keymap setting support for surfaces.
1834- . Improved automated testing of latency.
1835- . Replaced and rewrote automated ABI checking.
1836- . New client APIs for basic window management; setting window titles,
1837- self-resizing, size constraints and changing type.
1838- . Introduced dynamically loadable input platforms.
1839- . Work towards libinput integration
1840- . Added proof-of-concept support for Snappy packaging for Ubuntu Core.
1841- . Drop support for C++11. Now C++14 is required to build Mir.
1842- . Deprecated MirEventDelegate. Now you just pass the two fields as
1843- parameters directly to mir_surface_set_event_handler().
1844- . Legacy functions for creating surfaces marked deprecated
1845- . Minor redesign of the new input event API introduced in 0.10/11,
1846- so that identifiers are shorter and less convoluted.
1847- . Drop libmirclient dependency on client-platform drivers
1848- . Drop libmirserver dependency on client-platform drivers
1849- . Use the ABI version in platform library names and packages
1850- . Rework to reduce "abstraction leaks" in the graphics platform
1851- . Add thread sanitizer build option
1852- . Update KVM Instructions
1853- . Update CMAKE to use CMAKE_*_OUTPUT_DIRECTORY
1854- - ABI summary: Servers need rebuilding, but clients do not;
1855- . Mirclient ABI unchanged at 8
1856- . Mircommon ABI bumped to 4
1857- . Mirplatform ABI bumped to 7
1858- . Mirserver ABI bumped to 31
1859- - Bug fixes:
1860- . vivid fails to build Mir as of 2015-03-22: error: #warning "_BSD_SOURCE
1861- and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Werror=cpp]
1862- (LP: #1435127)
1863- . [regression] Mir servers freeze on startup (mouse and keyboard not
1864- responsive) (LP: #1444061)
1865- . [enhancement] Add support for video/HDMI output on Android
1866- (LP: #1296538)
1867- . [enhancement] Set custom cursors (LP: #1380463)
1868- . [regression] mali, powervr locks up with around the introduction or
1869- removal of a third overlay (LP: #1413211)
1870- . [regression] Client functions residing in libmircommon (LP: #1415321)
1871- . USC - mouse cursor on AMD graphics is drawing incorrectly (LP: #1417581)
1872- . [testsfail] SurfaceSwapBuffers.does_not_block_when_surface_is_not_composited
1873- fails in CI (LP: #1418002)
1874- . Compositing is triggered continously and needlessly when there are
1875- occluded surfaces with available buffers (LP: #1418081)
1876- . mir_demo_server doesn't emit hover_exit events (LP: #1418569)
1877- . SessionMediator locks mutexes in one thread and unlocks them in another
1878- (LP: #1427976)
1879- . ProtobufResponder::send_response_result race (LP: #1428402)
1880- . Some protobuf Closure objects can access dead objects (LP: #1433330)
1881- . valgrind on armhf fails with with many errors (LP: #1435186)
1882- . [regression] QtMir and USC can't build with lp:mir -
1883- fatal error: mir/events/event_builders.h (LP: #1436212)
1884- . [regression] mir_acceptance_tests.TestClientInput is hanging
1885- (LP: #1436644)
1886- . [regression] libmirclient crashes when calling
1887- mir_surface_set_event_handler() twice [InputTransport.cpp:110:
1888- android::InputChannel::InputChannel(const String8&, int): Assertion
1889- `false && "\"result != 0\""' failed.] (LP: #1438160)
1890- . [regression] Surfaces can't overlap screen edges any more (LP: #1438660)
1891- . losing touches in arale when home button is pressed (LP: #1439285)
1892- . [krillin] mirscreencast only creates a still picture, not a playable
1893- movie (LP: #1439549)
1894- . [regression] Unity8 doesn't detect input sent from USC with latest mir
1895- development code (LP: #1439719)
1896- . Intermittent CI failures in tests expecting created surfaces to have
1897- specific size (LP: #1440088)
1898- . [regression] [testsfail] failure in CI on
1899- SimpleDispatchThreadTest.keeps_dispatching_after_signal_interruption
1900- (LP: #1441620)
1901- . [android] Screencasting causes other clients to stop rendering
1902- (LP: #1441759)
1903- . Intermittent CI failures in
1904- MultiThreadedCompositor.does_not_block_in_start_when_compositor_thread_fails
1905- (LP: #1442020)
1906- . Flickering showing stale buffers on Krillin (LP: #1444047)
1907- . Acceptance tests link with static versions of client library and server
1908- components (LP: #1445473)
1909- . [regression] mir_acceptance_tests:
1910- TestClientCursorAPI.cursor_passed_through_nested_server is crashing most
1911- of the time (LP: #1447430)
1912- . [regression] Clients log verbose info on startup:
1913- "Loader: Loading module: ..." (LP: #1414883)
1914- . [enhancement] Missing client function for surface resizing
1915- (LP: #1420573)
1916- . [regression] [multimonitor] Clients (sometimes) run at double frame rate
1917- if overlapping two monitors. (LP: #1420678)
1918- . [enhancement] Need a client API to specify resize limitations
1919- (LP: #1421591)
1920- . [enhancement] Add surface morph client API (LP: #1422522)
1921- . The process for updating packaging for ABI changes is cumbersome and
1922- error-prone (LP: #1427207)
1923- . [regression] mir_acceptance_tests.NestedServer failure in clang CI
1924- (LP: #1430000)
1925- . DisplayConfigurationOutput.physical_size_mm is undefined/zero
1926- (LP: #1430315)
1927- . Dragging objects in a nested server or a client stutters slightly
1928- (LP: #1436192)
1929- . [regression] mir_proving_server: Super+N/Super+C does nothing now
1930- (LP: #1437166)
1931- . [regression] "Playground" event filters get registered twice
1932- (LP: #1437174)
1933- . [regression] <WARNING> Platform Probing: Failed to probe module.
1934- (LP: #1438536)
1935- . [regression] Move/resizing in mir_proving_server freezes if the cursor
1936- is outside the window (LP: #1438621)
1937- . [testsfail] CI failure in ClientLibraryErrorsDeathTest.
1938- creating_surface_synchronosly_on_malconstructed_connection_is_fatal
1939- (LP: #1438702)
1940- . Exceptions thrown due to EGL failures don't include EGL error codes
1941- (LP: #1444938)
1942- . Can't switch between sibling windows of multi-window apps (LP: #1445538)
1943- . [regression] specifying -DMIR_PLATFORM to one platform causes cmake
1944- failure (LP: #1447729)
1945- . mir_demo_server(_minimal): Can't move surfaces to overlap screen edges
1946- (LP: #1447882)
1947- . [regression] mir_demo_standalone_render_surfaces fails to start on
1948- krillin (LP: #1449198)
1949- . [regression] MIR_CLIENT_PERF_REPORT=log now shows "0" for the surface
1950- name (LP: #1415305)
1951- . Nested display leaks its EGLContext (LP: #1418910)
1952- . SimpleDispatchThreadTest.doesnt_call_dispatch_after_first_false_return
1953- fails when run repeatedly (LP: #1440005)
1954- . Surfaces are not properly released in CustomWindowManagement.
1955- state_change_requests_are_associated_with_correct_surface
1956- (LP: #1445418)
1957- . android reports that the gpu can only support 1 simultaneous output
1958- (LP: #1446304)
1959- . Support dynamic mouse cursor icons (LP: #1447839)
1960-
1961- -- CI Train Bot <ci-train-bot@canonical.com> Tue, 12 May 2015 13:12:55 +0000
1962-
1963-mir (0.12.1+15.04.20150324-0ubuntu1) vivid; urgency=medium
1964-
1965- [ Alexandros Frantzis ]
1966+ . usage of external display in mirror mode
1967+ . output centering on external display
1968+ . orientation override for user input
1969+
1970+ -- Andreas Pokorny <andreas.pokorny@canonical.com> Sun, 01 Mar 2015 15:09:13 +0100
1971+
1972+mir (0.12.1-0ubuntu1) UNRELEASED; urgency=medium
1973+
1974 * New upstream release 0.12.1 (https://launchpad.net/mir/+milestone/0.12.1)
1975 - Bug fixes:
1976 . [regression] mali, powervr locks up with around the introduction or
1977@@ -183,7 +28,7 @@
1978 [-Werror=cpp] (LP: #1435127)
1979 . valgrind on armhf fails with with many errors (LP: #1435186)
1980
1981- -- CI Train Bot <ci-train-bot@canonical.com> Tue, 24 Mar 2015 16:09:54 +0000
1982+ -- Alexandros Frantzis <alexandros.frantzis@canonical.com> Tue, 24 Mar 2015 11:07:41 +0200
1983
1984 mir (0.12.0+15.04.20150228-0ubuntu1) vivid; urgency=medium
1985
1986
1987=== modified file 'debian/control'
1988--- debian/control 2015-05-19 04:37:02 +0000
1989+++ debian/control 2015-05-20 14:01:27 +0000
1990@@ -10,6 +10,10 @@
1991 doxygen,
1992 xsltproc,
1993 graphviz,
1994+# We rely on C++11 features, and to prevent from ABI breaks
1995+# in libstdc++ causing us issues, we explicitly select a G++
1996+# version.
1997+ g++-4.9,
1998 libboost-dev,
1999 libboost-date-time-dev,
2000 libboost-program-options-dev,
2001@@ -32,13 +36,9 @@
2002 libumockdev-dev (>= 0.6),
2003 umockdev (>= 0.8.7),
2004 libudev-dev,
2005- libgtest-dev,
2006 google-mock (>= 1.6.0+svn437),
2007 valgrind [!arm64],
2008 libglib2.0-dev,
2009- libfreetype6-dev,
2010- abi-compliance-checker,
2011- libevdev-dev,
2012 Standards-Version: 3.9.4
2013 Homepage: https://launchpad.net/mir
2014 # If you aren't a member of ~mir-team but need to upload packaging changes,
2015@@ -61,13 +61,14 @@
2016
2017 #TODO: Packaging infrastructure for better dependency generation,
2018 # ala pkg-xorg's xviddriver:Provides and ABI detection.
2019-Package: libmirserver32
2020+Package: libmirserver30
2021 Section: libs
2022 Architecture: i386 amd64 armhf arm64
2023 Multi-Arch: same
2024 Pre-Depends: ${misc:Pre-Depends}
2025 Depends: ${misc:Depends},
2026 ${shlibs:Depends},
2027+ mir-platform-graphics-mesa1 | mir-platform-graphics-android1,
2028 Description: Display server for Ubuntu - server library
2029 Mir is a display server running on linux systems, with a focus on efficiency,
2030 robust operation and a well-defined driver model.
2031@@ -93,7 +94,7 @@
2032 Architecture: i386 amd64 armhf arm64
2033 Multi-Arch: same
2034 Pre-Depends: ${misc:Pre-Depends}
2035-Depends: libmircommon4 (= ${binary:Version}),
2036+Depends: libmircommon3 (= ${binary:Version}),
2037 libprotobuf-dev (>= 2.4.1),
2038 libxkbcommon-dev,
2039 ${misc:Depends},
2040@@ -127,7 +128,7 @@
2041 Architecture: i386 amd64 armhf arm64
2042 Multi-Arch: same
2043 Pre-Depends: ${misc:Pre-Depends}
2044-Depends: libmirserver32 (= ${binary:Version}),
2045+Depends: libmirserver30 (= ${binary:Version}),
2046 libmirplatform-dev (= ${binary:Version}),
2047 libmircommon-dev (= ${binary:Version}),
2048 libglm-dev,
2049@@ -145,6 +146,7 @@
2050 Pre-Depends: ${misc:Pre-Depends}
2051 Depends: ${misc:Depends},
2052 ${shlibs:Depends},
2053+ mir-client-platform-mesa2 | mir-client-platform-android2,
2054 Description: Display server for Ubuntu - client library
2055 Mir is a display server running on linux systems, with a focus on efficiency,
2056 robust operation and a well-defined driver model.
2057@@ -216,7 +218,6 @@
2058 Architecture: i386 amd64 armhf arm64
2059 Depends: ${misc:Depends},
2060 ${shlibs:Depends},
2061-Recommends: fonts-liberation
2062 Description: Display server for Ubuntu - demonstration programs
2063 Mir is a display server running on linux systems, with a focus on efficiency,
2064 robust operation and a well-defined driver model.
2065@@ -253,7 +254,7 @@
2066 .
2067 Contains a tool for stress testing the Mir display server
2068
2069-Package: libmircommon4
2070+Package: libmircommon3
2071 Section: libs
2072 Architecture: i386 amd64 armhf arm64
2073 Multi-Arch: same
2074@@ -267,7 +268,7 @@
2075 Contains the shared libraries required for the Mir server and client.
2076
2077 # Longer-term these drivers should move out-of-tree
2078-Package: mir-platform-graphics-mesa2
2079+Package: mir-platform-graphics-mesa1
2080 Section: libs
2081 Architecture: i386 amd64 armhf arm64
2082 Multi-Arch: same
2083@@ -281,7 +282,7 @@
2084 Contains the shared libraries required for the Mir server to interact with
2085 the hardware platform using the Mesa drivers.
2086
2087-Package: mir-platform-graphics-android2
2088+Package: mir-platform-graphics-android1
2089 Section: libs
2090 Architecture: i386 amd64 armhf
2091 Multi-Arch: same
2092@@ -343,7 +344,7 @@
2093 Multi-Arch: same
2094 Pre-Depends: ${misc:Pre-Depends}
2095 Depends: ${misc:Depends},
2096- mir-platform-graphics-mesa2,
2097+ mir-platform-graphics-mesa1,
2098 mir-client-platform-mesa2,
2099 Description: Display server for Ubuntu - desktop driver metapackage
2100 Mir is a display server running on linux systems, with a focus on efficiency,
2101@@ -358,7 +359,7 @@
2102 Multi-Arch: same
2103 Pre-Depends: ${misc:Pre-Depends}
2104 Depends: ${misc:Depends},
2105- mir-platform-graphics-android2,
2106+ mir-platform-graphics-android1,
2107 mir-client-platform-android2,
2108 Description: Display server for Ubuntu - android driver metapackage
2109 Mir is a display server running on linux systems, with a focus on efficiency,
2110
2111=== modified file 'debian/libmirclient-debug-extension1.install'
2112--- debian/libmirclient-debug-extension1.install 2015-03-31 02:35:42 +0000
2113+++ debian/libmirclient-debug-extension1.install 2015-05-20 14:01:27 +0000
2114@@ -1,1 +1,1 @@
2115-usr/lib/*/libmirclient-debug-extension.so.1
2116+usr/lib/*/libmirclient-debug-extension.so.*
2117
2118=== modified file 'debian/libmirclient-dev.install'
2119--- debian/libmirclient-dev.install 2015-05-07 09:06:20 +0000
2120+++ debian/libmirclient-dev.install 2015-05-20 14:01:27 +0000
2121@@ -1,6 +1,3 @@
2122 usr/include/mirclient/mir_toolkit/*.h
2123-usr/include/mirclient/mir/events/*.h
2124-usr/include/mirclient/mir/event_printer.h
2125-usr/include/mirclient/mir_toolkit/events
2126 usr/lib/*/pkgconfig/mirclient.pc
2127 usr/lib/*/libmirclient.so
2128
2129=== renamed file 'debian/libmircommon4.install' => 'debian/libmircommon3.install'
2130--- debian/libmircommon4.install 2015-03-31 02:35:42 +0000
2131+++ debian/libmircommon3.install 2015-05-20 14:01:27 +0000
2132@@ -1,1 +1,1 @@
2133-usr/lib/*/libmircommon.so.4
2134+usr/lib/*/libmircommon.so.3
2135
2136=== renamed file 'debian/libmirserver32.install' => 'debian/libmirserver30.install'
2137--- debian/libmirserver32.install 2015-05-12 06:58:52 +0000
2138+++ debian/libmirserver30.install 2015-05-20 14:01:27 +0000
2139@@ -1,1 +1,1 @@
2140-usr/lib/*/libmirserver.so.32
2141+usr/lib/*/libmirserver.so.30
2142
2143=== modified file 'debian/mir-demos.install'
2144--- debian/mir-demos.install 2015-05-15 11:44:45 +0000
2145+++ debian/mir-demos.install 2015-05-20 14:01:27 +0000
2146@@ -1,3 +1,2 @@
2147 usr/bin/mir_demo_*
2148-usr/bin/mir_proving_*
2149-usr/lib/*/libmir_demo_*
2150+usr/bin/mir_proving_*
2151\ No newline at end of file
2152
2153=== renamed file 'debian/mir-platform-graphics-android2.install' => 'debian/mir-platform-graphics-android1.install'
2154--- debian/mir-platform-graphics-android2.install 2015-05-07 09:06:20 +0000
2155+++ debian/mir-platform-graphics-android1.install 2015-05-20 14:01:27 +0000
2156@@ -1,1 +1,1 @@
2157-usr/lib/*/mir/server-platform/graphics-android.so.2
2158+usr/lib/*/mir/server-platform/graphics-android.so.1
2159
2160=== renamed file 'debian/mir-platform-graphics-mesa2.install' => 'debian/mir-platform-graphics-mesa1.install'
2161--- debian/mir-platform-graphics-mesa2.install 2015-05-07 09:06:20 +0000
2162+++ debian/mir-platform-graphics-mesa1.install 2015-05-20 14:01:27 +0000
2163@@ -1,1 +1,1 @@
2164-usr/lib/*/mir/server-platform/graphics-mesa.so.2
2165+usr/lib/*/mir/server-platform/graphics-mesa.so.1
2166
2167=== modified file 'debian/mir-test-tools.install'
2168--- debian/mir-test-tools.install 2015-05-19 04:37:02 +0000
2169+++ debian/mir-test-tools.install 2015-05-20 14:01:27 +0000
2170@@ -3,9 +3,7 @@
2171 usr/bin/mir_acceptance_tests
2172 usr/bin/mir_integration_tests
2173 usr/bin/mir_performance_tests
2174-usr/bin/mir_privileged_tests
2175 usr/lib/*/mir/tools/libmirclientlttng.so
2176 usr/lib/*/mir/tools/libmirserverlttng.so
2177 usr/lib/*/mir/server-platform/graphics-dummy.so
2178-usr/lib/*/mir/server-platform/input-stub.so
2179 usr/lib/*/mir/client-platform/dummy.so
2180
2181=== modified file 'debian/rules'
2182--- debian/rules 2015-05-12 06:58:52 +0000
2183+++ debian/rules 2015-05-20 14:01:27 +0000
2184@@ -6,11 +6,17 @@
2185
2186 export DPKG_GENSYMBOLS_CHECK_LEVEL = 4
2187
2188+include /usr/share/dpkg/default.mk
2189+
2190+# Explicitly selecting a G{CC,++}-version here to avoid accidental
2191+# ABI breaks introduced by toolchain updates.
2192+export CC=$(DEB_HOST_GNU_TYPE)-gcc-4.9
2193+export CXX=$(DEB_HOST_GNU_TYPE)-g++-4.9
2194+
2195 %:
2196 dh $@ --parallel --fail-missing
2197
2198-# Enable verbose debugging output from the testsuite
2199-export MIR_SERVER_LOGGING = on
2200+#overrding dh_auto_test to get rid of --parallel during testing
2201 override_dh_auto_test:
2202 GTEST_OUTPUT=xml:./ dh_auto_test --max-parallel=1 -- ARGS="-V"
2203
2204
2205=== modified file 'doc/component_reports.md'
2206--- doc/component_reports.md 2015-03-31 02:35:42 +0000
2207+++ doc/component_reports.md 2015-05-20 14:01:27 +0000
2208@@ -16,17 +16,15 @@
2209 are prefixed with `MIR_SERVER_` and contain underscores ('_') instead of dashes
2210 ('-'). The available component reports and handlers for the server are:
2211
2212-Report | Handlers
2213----------------------------- | --------
2214-connector-report | log,lttng
2215-compositor-report | log,lttng
2216-display-report | log,lttng
2217-input-report | log,lttng
2218-legacy-input-report | log
2219-msg-processor-report | log,lttng
2220-session-mediator-report | log,lttng
2221-scene-report | log,lttng
2222-shared-library-prober-report | log,lttng
2223+Report | Handlers
2224+----------------------- | --------
2225+connector-report | log,lttng
2226+display-report | log,lttng
2227+input-report | log,lttng
2228+legacy-input-report | log
2229+msg-processor-report | log,lttng
2230+session-mediator-report | log,lttng
2231+scene-report | log,lttng
2232
2233 For example, to enable the LTTng input report, one could either use the
2234 `--input-report=lttng` command-line option to the server, or set the
2235@@ -39,12 +37,10 @@
2236 environment variables are prefixed with `MIR_CLIENT_` and contain only
2237 underscores. The available reports and handlers for the client are:
2238
2239-Report | Handlers
2240---------------------- | --------
2241-rpc-report | log,lttng
2242-input-receiver-report | log,lttng
2243-shared-library-prober-report | log,lttng
2244-perf-report | log,lttng
2245+Report | Handlers
2246+------------------- | --------
2247+rpc-report | log,lttng
2248+input-receiver | log,lttng
2249
2250 For example, to enable the logging RPC report, one should set the
2251 `MIR_CLIENT_RPC_REPORT=log` environment variable.
2252
2253=== modified file 'doc/demo_shell_controls.md'
2254--- doc/demo_shell_controls.md 2015-05-07 09:06:20 +0000
2255+++ doc/demo_shell_controls.md 2015-05-20 14:01:27 +0000
2256@@ -34,7 +34,6 @@
2257 - Switch back to X: *Ctrl-Alt-F7*
2258 - Switch virtual terminals (VTs): *Ctrl-Alt-(F1-F12)*
2259 - Switch apps: *Alt-Tab* or *4-finger swipe left/right*
2260- - Switch windows of the current app: *Alt-grave*
2261 - Ask an app to close: *Alt-F4* (it may refuse or not understand)
2262 - Move window: *Alt-leftmousebutton* or *3-finger drag*
2263 - Resize window: *Alt-middlemousebutton* or *3-finger pinch/zoom*
2264
2265=== modified file 'doc/footer.html.in'
2266--- doc/footer.html.in 2015-05-07 09:06:20 +0000
2267+++ doc/footer.html.in 2015-05-20 14:01:27 +0000
2268@@ -1,5 +1,5 @@
2269 <hr>
2270-<p align="center">Copyright &copy; 2012-2015 Canonical Ltd. <br />
2271+<p align="center">Copyright &copy; 2012,2013 Canonical Ltd. <br />
2272 Generated on @DATE_TODAY@</p>
2273 </body>
2274 </html>
2275
2276=== modified file 'doc/mainpage.md'
2277--- doc/mainpage.md 2015-05-07 09:06:20 +0000
2278+++ doc/mainpage.md 2015-05-20 14:01:27 +0000
2279@@ -93,16 +93,10 @@
2280 "server_example_input_filter.cpp: print input events to stdout"
2281 - \subpage server_example_log_options.cpp
2282 "server_example_log_options.cpp: replace Mir logger with glog"
2283- - \subpage server_example_basic_window_manager.h
2284- "server_example_basic_window_manager.h: How to wire up a window manager"
2285+ - \subpage server_example_window_manager.cpp
2286+ "server_example_window_manager.cpp: How to wire up a window manager"
2287 - \subpage server_example_window_management.cpp
2288 "server_example_window_management.cpp: simple window management examples"
2289- - \subpage server_example_canonical_window_manager.cpp
2290- "server_example_canonical_window_manager.cpp: canonical window management policy"
2291- - \subpage server_example_tiling_window_manager.cpp
2292- "server_example_tiling_window_manager.cpp: an alternative window management policy"
2293- - \subpage server_example_custom_compositor.cpp
2294- "server_example_custom_compositor.cpp: demonstrate writing an alternative GL rendering code"
2295
2296 Working on Mir code
2297 -------------------
2298
2299=== modified file 'examples/CMakeLists.txt'
2300--- examples/CMakeLists.txt 2015-05-18 21:30:28 +0000
2301+++ examples/CMakeLists.txt 2015-05-20 14:01:27 +0000
2302@@ -16,29 +16,22 @@
2303 )
2304
2305 add_library(exampleserverconfig STATIC
2306- server_example_canonical_window_manager.cpp
2307+ server_example_generic_shell.cpp
2308 server_example_display_configuration_policy.cpp
2309 server_example_input_event_filter.cpp
2310 server_example_log_options.cpp
2311 server_example_input_filter.cpp
2312+ server_example_fullscreen_placement_strategy.cpp
2313 server_example_host_lifecycle_event.cpp
2314 server_example_tiling_window_manager.cpp
2315 server_example_window_management.cpp
2316- server_example_custom_compositor.cpp
2317- server_example_adorning_compositor.cpp
2318+ server_example_shell.cpp
2319 )
2320
2321 target_link_libraries(eglapp
2322 mirclient
2323 ${EGL_LIBRARIES}
2324 ${GLESv2_LIBRARIES}
2325- )
2326-
2327-mir_add_wrapped_executable(mir_demo_client_animated_cursor
2328- animated_cursor_demo_client.c
2329-)
2330-target_link_libraries(mir_demo_client_animated_cursor
2331- eglapp
2332 )
2333 mir_add_wrapped_executable(mir_demo_client_eglflash
2334 eglflash.c
2335@@ -52,12 +45,6 @@
2336 target_link_libraries(mir_demo_client_egltriangle
2337 eglapp
2338 )
2339-mir_add_wrapped_executable(mir_demo_client_target
2340- target.c
2341-)
2342-target_link_libraries(mir_demo_client_target
2343- eglapp
2344-)
2345 mir_add_wrapped_executable(mir_demo_client_eglcounter
2346 eglcounter.cpp
2347 )
2348@@ -117,9 +104,6 @@
2349 mir_add_wrapped_executable(mir_demo_client_display_config demo_client_display_config.c)
2350 target_link_libraries(mir_demo_client_display_config eglapp)
2351
2352-mir_add_wrapped_executable(mir_demo_client_eglsquare eglsquare.cpp)
2353-target_link_libraries(mir_demo_client_eglsquare eglapp)
2354-
2355 mir_add_wrapped_executable(mir_demo_client_flicker
2356 flicker.c
2357 )
2358@@ -185,32 +169,6 @@
2359 ${Boost_LIBRARIES}
2360 )
2361
2362-add_library(mir_demo_server_loadable MODULE
2363- server_example.cpp
2364- glog_logger.cpp
2365- server_example_test_client.cpp
2366-)
2367-
2368-target_link_libraries(mir_demo_server_loadable
2369- mirserver
2370- exampleserverconfig
2371- ${GLog_LIBRARY}
2372- ${GFlags_LIBRARY}
2373- ${Boost_LIBRARIES}
2374-)
2375-
2376-install(TARGETS mir_demo_server_loadable
2377- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
2378-)
2379-
2380-mir_add_wrapped_executable(mir_demo_server_loader
2381- mir_demo_server_loader.cpp
2382-)
2383-
2384-target_link_libraries(mir_demo_server_loader
2385- dl
2386-)
2387-
2388 mir_add_wrapped_executable(mir_demo_server_minimal server_minimal.cpp)
2389 target_link_libraries(mir_demo_server_minimal mirserver)
2390
2391@@ -223,27 +181,19 @@
2392 mircommon
2393 )
2394
2395-if (MIR_ENABLE_TESTS)
2396+# FIXME: Bug not fixed yet.
2397+if (MIR_ENABLE_TESTS AND MIR_TEST_CLIENT_ABI)
2398 # Regression tests for LP: #1415321
2399
2400 # To see reasons for failure: ctest -V -R Clients-only-use-client-symbols
2401- mir_add_test(NAME Clients-only-use-client-symbols
2402+ add_test(NAME Clients-only-use-client-symbols
2403 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin
2404 COMMAND /bin/sh -c "!(nm -u .mir_demo_client_* mir_demo_client* | grep -v @@MIR_CLIENT | grep 'U mir_')"
2405 )
2406
2407-# We use a slightly weaker version of the test with clang as that generates spurious NEEDED
2408-if (NOT "${CMAKE_CXX_COMPILER}" MATCHES "clang")
2409 # To see reasons for failure: ctest -V -R Clients-only-use-client-ABI
2410- mir_add_test(NAME Clients-only-use-client-ABI
2411+ add_test(NAME Clients-only-use-client-ABI
2412 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin
2413 COMMAND /bin/sh -c "!(objdump -p .mir_demo_client_* mir_demo_client* | grep NEEDED | grep libmir | grep -v libmirclient)"
2414 )
2415-else()
2416- # To see reasons for failure: ctest -V -R Clients-only-use-client-ABI
2417- mir_add_test(NAME Clients-only-use-client-ABI
2418- WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin
2419- COMMAND /bin/sh -c "!(nm -u .mir_demo_client_* mir_demo_client* | grep -v @@MIR_CLIENT | grep @@MIR_)"
2420- )
2421-endif ()
2422 endif ()
2423
2424=== removed file 'examples/animated_cursor_demo_client.c'
2425--- examples/animated_cursor_demo_client.c 2015-02-25 22:10:35 +0000
2426+++ examples/animated_cursor_demo_client.c 1970-01-01 00:00:00 +0000
2427@@ -1,90 +0,0 @@
2428-/*
2429- * Copyright © 2015 Canonical LTD
2430- *
2431- * This program is free software: you can redistribute it and/or modify
2432- * it under the terms of the GNU General Public License version 3 as
2433- * published by the Free Software Foundation.
2434- *
2435- * This program is distributed in the hope that it will be useful,
2436- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2437- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2438- * GNU General Public License for more details.
2439- *
2440- * You should have received a copy of the GNU General Public License
2441- * along with this program. If not, see <http://www.gnu.org/licenses/>.
2442- *
2443- * Author: Robert Carr <robert.carr@canonical.com>
2444- */
2445-
2446-#define _GNU_SOURCE // for nanosleep
2447-
2448-#include "eglapp.h"
2449-
2450-#include "mir_toolkit/mir_client_library.h"
2451-
2452-#include <stdio.h>
2453-#include <stdlib.h>
2454-#include <string.h>
2455-#include <unistd.h>
2456-#include <sys/time.h>
2457-#include <sys/types.h>
2458-#include <time.h>
2459-#include <GLES2/gl2.h>
2460-
2461-void animate_cursor(MirBufferStream *stream)
2462-{
2463- static double alpha = 0.0;
2464- char fill_color = 0xff * alpha;
2465-
2466- MirGraphicsRegion region;
2467- mir_buffer_stream_get_graphics_region(stream, &region);
2468-
2469- memset(region.vaddr, fill_color, region.stride*region.height);
2470-
2471- mir_buffer_stream_swap_buffers_sync(stream);
2472- alpha += 0.01;
2473- if (alpha >= 1.0)
2474- alpha = 0.0;
2475-
2476-}
2477-
2478-MirBufferStream* make_cursor_stream(MirConnection *connection, MirSurface *surface)
2479-{
2480- MirBufferStream* stream = mir_connection_create_buffer_stream_sync(connection,
2481- 24, 24, mir_pixel_format_argb_8888, mir_buffer_usage_software);
2482-
2483- MirCursorConfiguration* conf = mir_cursor_configuration_from_buffer_stream(stream, 0, 0);
2484- mir_wait_for(mir_surface_configure_cursor(surface, conf));
2485- mir_cursor_configuration_destroy(conf);
2486-
2487- return stream;
2488-}
2489-
2490-int main(int argc, char *argv[])
2491-{
2492- unsigned int width = 128, height = 128;
2493-
2494- if (!mir_eglapp_init(argc, argv, &width, &height))
2495- return 1;
2496-
2497- glClearColor(0.5, 0.5, 0.5, mir_eglapp_background_opacity);
2498- glClear(GL_COLOR_BUFFER_BIT);
2499- mir_eglapp_swap_buffers();
2500-
2501- MirBufferStream* stream = make_cursor_stream(mir_eglapp_native_connection(),
2502- mir_eglapp_native_surface());
2503-
2504- struct timespec onehundred_millis = {
2505- 0, 100*1000000
2506- };
2507-
2508- while (mir_eglapp_running())
2509- {
2510- nanosleep(&onehundred_millis, &onehundred_millis);
2511- animate_cursor(stream);
2512- }
2513-
2514- mir_eglapp_shutdown();
2515-
2516- return 0;
2517-}
2518
2519=== modified file 'examples/demo_client_display_config.c'
2520--- examples/demo_client_display_config.c 2015-03-31 02:35:42 +0000
2521+++ examples/demo_client_display_config.c 2015-05-20 14:01:27 +0000
2522@@ -295,11 +295,11 @@
2523 ctx->reconfigure = 1;
2524 }
2525
2526-static void handle_keyboard_event(struct ClientContext *ctx, MirKeyboardEvent const* event)
2527+static void handle_key_input_event(struct ClientContext *ctx, MirKeyInputEvent const* event)
2528 {
2529- if (mir_keyboard_event_action(event) != mir_keyboard_action_up)
2530+ if (mir_key_input_event_get_action(event) != mir_key_input_event_action_up)
2531 return;
2532- xkb_keysym_t key_code = mir_keyboard_event_key_code(event);
2533+ xkb_keysym_t key_code = mir_key_input_event_get_key_code(event);
2534
2535 if (key_code >= XKB_KEY_1 &&
2536 key_code <= XKB_KEY_9)
2537@@ -340,7 +340,7 @@
2538 if (mir_input_event_get_type(input_event) != mir_input_event_type_key)
2539 return;
2540
2541- handle_keyboard_event(ctx, mir_input_event_get_keyboard_event(input_event));
2542+ handle_key_input_event(ctx, mir_input_event_get_key_input_event(input_event));
2543 }
2544
2545 int main(int argc, char *argv[])
2546@@ -368,7 +368,8 @@
2547 mir_connection_set_display_config_change_callback(
2548 connection, display_change_callback, &ctx);
2549
2550- mir_surface_set_event_handler(surface, event_callback, &ctx);
2551+ struct MirEventDelegate ed = {event_callback, &ctx};
2552+ mir_surface_set_event_handler(surface, &ed);
2553
2554 time_t start = time(NULL);
2555
2556
2557=== modified file 'examples/eglapp.c'
2558--- examples/eglapp.c 2015-04-09 08:57:24 +0000
2559+++ examples/eglapp.c 2015-05-20 14:01:27 +0000
2560@@ -16,6 +16,8 @@
2561 * Author: Daniel van Vugt <daniel.van.vugt@canonical.com>
2562 */
2563
2564+#define MIR_INCLUDE_DEPRECATED_EVENT_HEADER
2565+
2566 #include "eglapp.h"
2567 #include "mir_toolkit/mir_client_library.h"
2568 #include <stdio.h>
2569@@ -94,10 +96,10 @@
2570 {
2571 if (mir_input_event_get_type(event) != mir_input_event_type_key)
2572 return;
2573- MirKeyboardEvent const* kev = mir_input_event_get_keyboard_event(event);
2574- if (mir_keyboard_event_action(kev) != mir_keyboard_action_up)
2575+ MirKeyInputEvent const* kev = mir_input_event_get_key_input_event(event);
2576+ if (mir_key_input_event_get_action(kev) != mir_key_input_event_action_up)
2577 return;
2578- if (mir_keyboard_event_key_code(kev) != XKB_KEY_q)
2579+ if (mir_key_input_event_get_key_code(kev) != XKB_KEY_q)
2580 return;
2581
2582 running = 0;
2583@@ -142,12 +144,7 @@
2584 * support for event queuing (directing them to another thread) or
2585 * full single-threaded callbacks. (LP: #1194384).
2586 */
2587- {
2588- MirResizeEvent const* resize = mir_event_get_resize_event(ev);
2589- printf("Resized to %dx%d\n",
2590- mir_resize_event_get_width(resize),
2591- mir_resize_event_get_height(resize));
2592- }
2593+ printf("Resized to %dx%d\n", ev->resize.width, ev->resize.height);
2594 break;
2595 case mir_event_type_close_surface:
2596 printf("Received close event from server.\n");
2597@@ -189,6 +186,11 @@
2598 EGL_CONTEXT_CLIENT_VERSION, 2,
2599 EGL_NONE
2600 };
2601+ MirEventDelegate delegate =
2602+ {
2603+ mir_eglapp_handle_event,
2604+ NULL
2605+ };
2606 EGLConfig eglconfig;
2607 EGLint neglconfigs;
2608 EGLContext eglctx;
2609@@ -386,14 +388,7 @@
2610
2611 CHECK(spec != NULL, "Can't create a surface spec");
2612
2613- char const* name = argv[0];
2614- for (char const* p = name; *p; p++)
2615- {
2616- if (*p == '/')
2617- name = p + 1;
2618- }
2619- mir_surface_spec_set_name(spec, name);
2620-
2621+ mir_surface_spec_set_name(spec, "eglappsurface");
2622 if (output_id != mir_display_output_id_invalid)
2623 mir_surface_spec_set_fullscreen_on_output(spec, output_id);
2624
2625@@ -402,7 +397,7 @@
2626
2627 CHECK(mir_surface_is_valid(surface), "Can't create a surface");
2628
2629- mir_surface_set_event_handler(surface, mir_eglapp_handle_event, NULL);
2630+ mir_surface_set_event_handler(surface, &delegate);
2631
2632 MirCursorConfiguration *conf = mir_cursor_configuration_from_name(cursor_name);
2633 mir_surface_configure_cursor(surface, conf);
2634
2635=== removed file 'examples/eglsquare.cpp'
2636--- examples/eglsquare.cpp 2015-05-07 09:06:20 +0000
2637+++ examples/eglsquare.cpp 1970-01-01 00:00:00 +0000
2638@@ -1,417 +0,0 @@
2639-/*
2640- * Copyright © 2015 Canonical Ltd.
2641- *
2642- * This program is free software: you can redistribute it and/or modify
2643- * it under the terms of the GNU General Public License version 3 as
2644- * published by the Free Software Foundation.
2645- *
2646- * This program is distributed in the hope that it will be useful,
2647- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2648- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2649- * GNU General Public License for more details.
2650- *
2651- * You should have received a copy of the GNU General Public License
2652- * along with this program. If not, see <http://www.gnu.org/licenses/>.
2653- *
2654- * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
2655- */
2656-
2657-#include "mir_toolkit/mir_client_library.h"
2658-#include <EGL/egl.h>
2659-#include <GLES2/gl2.h>
2660-#include <thread>
2661-#include <memory>
2662-#include <chrono>
2663-#include <iostream>
2664-#include <cstring>
2665-#include <unistd.h>
2666-#include <signal.h>
2667-
2668-namespace
2669-{
2670-class Connection
2671-{
2672-public:
2673- Connection(char const* socket_file) :
2674- connection(mir_connect_sync(socket_file, __PRETTY_FUNCTION__))
2675- {
2676- if (!mir_connection_is_valid(connection))
2677- throw std::runtime_error(std::string("could not connect to server: ") +
2678- mir_connection_get_error_message(connection));
2679- }
2680- ~Connection()
2681- {
2682- mir_connection_release(connection);
2683- }
2684- operator MirConnection*() { return connection; }
2685- Connection(Connection const&) = delete;
2686- Connection& operator=(Connection const&) = delete;
2687-private:
2688- MirConnection* connection;
2689-};
2690-
2691-class Context
2692-{
2693-public:
2694- Context(Connection& connection, MirSurface* surface, int swap_interval) :
2695- native_display(reinterpret_cast<EGLNativeDisplayType>(
2696- mir_connection_get_egl_native_display(connection))),
2697- native_window(reinterpret_cast<EGLNativeWindowType>(
2698- mir_buffer_stream_get_egl_native_window(mir_surface_get_buffer_stream(surface)))),
2699- display(native_display),
2700- config(chooseconfig(display.disp)),
2701- surface(display.disp, config, native_window),
2702- context(display.disp, config)
2703- {
2704- make_current();
2705- eglSwapInterval(display.disp, swap_interval);
2706- }
2707- void make_current()
2708- {
2709- if (eglMakeCurrent(display.disp, surface.surface, surface.surface, context.context) == EGL_FALSE)
2710- throw(std::runtime_error("could not makecurrent"));
2711- }
2712- void release_current()
2713- {
2714- if (eglMakeCurrent(display.disp, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT) == EGL_FALSE)
2715- throw(std::runtime_error("could not makecurrent"));
2716- }
2717- void swapbuffers()
2718- {
2719- if (eglSwapBuffers(display.disp, surface.surface) == EGL_FALSE)
2720- throw(std::runtime_error("could not swapbuffers"));
2721- }
2722- Context(Context const&) = delete;
2723- Context& operator=(Context const&) = delete;
2724-private:
2725- EGLConfig chooseconfig(EGLDisplay disp)
2726- {
2727- int n{0};
2728- EGLConfig egl_config;
2729- EGLint attribs[] = {
2730- EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
2731- EGL_RED_SIZE, 8,
2732- EGL_GREEN_SIZE, 8,
2733- EGL_BLUE_SIZE, 8,
2734- EGL_ALPHA_SIZE, 8,
2735- EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
2736- EGL_NONE };
2737- if (eglChooseConfig(disp, attribs, &egl_config, 1, &n) != EGL_TRUE || n != 1)
2738- throw std::runtime_error("could not find egl config");
2739- return egl_config;
2740- }
2741- EGLNativeDisplayType native_display;
2742- EGLNativeWindowType native_window;
2743- struct Display
2744- {
2745- Display(EGLNativeDisplayType native) :
2746- disp(eglGetDisplay(native))
2747- {
2748- int major{0}, minor{0};
2749- if (disp == EGL_NO_DISPLAY)
2750- throw std::runtime_error("no egl display");
2751- if (eglInitialize(disp, &major, &minor) != EGL_TRUE || major != 1 || minor != 4)
2752- throw std::runtime_error("could not init egl");
2753- }
2754- ~Display()
2755- {
2756- eglTerminate(disp);
2757- }
2758- EGLDisplay disp;
2759- } display;
2760- EGLConfig config;
2761- struct Surface
2762- {
2763- Surface(EGLDisplay display, EGLConfig config, EGLNativeWindowType native_window) :
2764- disp(display),
2765- surface(eglCreateWindowSurface(disp, config, native_window, NULL))
2766- {
2767- if (surface == EGL_NO_SURFACE)
2768- throw std::runtime_error("could not create egl surface");
2769- }
2770- ~Surface() {
2771- if (eglGetCurrentSurface(EGL_DRAW) == surface)
2772- eglMakeCurrent(disp, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
2773- eglDestroySurface(disp, surface);
2774- }
2775- EGLDisplay disp;
2776- EGLSurface surface;
2777- } surface;
2778- struct EglContext
2779- {
2780- EglContext(EGLDisplay disp, EGLConfig config) :
2781- disp(disp),
2782- context(eglCreateContext(disp, config, EGL_NO_CONTEXT, context_attribs))
2783- {
2784- if (context == EGL_NO_CONTEXT)
2785- throw std::runtime_error("could not create egl context");
2786- }
2787- ~EglContext()
2788- {
2789- eglDestroyContext(disp, context);
2790- }
2791- EGLint context_attribs[3] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE };
2792- EGLDisplay disp;
2793- EGLContext context;
2794- } context;
2795-};
2796-
2797-class RenderProgram
2798-{
2799-public:
2800- RenderProgram(Context& context, unsigned int width, unsigned int height) :
2801- vertex(&vtex_shader_src, GL_VERTEX_SHADER),
2802- fragment(&frag_shader_src, GL_FRAGMENT_SHADER),
2803- program(vertex, fragment)
2804- {
2805- float square_side = 400.0f;
2806- float scale[2] {square_side/width, square_side/height};
2807- glUseProgram(program.program);
2808- vPositionAttr = glGetAttribLocation(program.program, "vPosition");
2809- glVertexAttribPointer(vPositionAttr, 4, GL_FLOAT, GL_FALSE, 0, vertex_data);
2810- posUniform = glGetUniformLocation(program.program, "pos");
2811- glClearColor(0.1, 0.1, 0.4, 1.0); //light blue
2812- glClear(GL_COLOR_BUFFER_BIT);
2813- auto scaleUniform = glGetUniformLocation(program.program, "scale");
2814- glUniform2fv(scaleUniform, 1, scale);
2815-
2816- context.swapbuffers();
2817- context.release_current();
2818- }
2819-
2820- void draw(float x, float y)
2821- {
2822- float pos[2] = {x, y};
2823- glUseProgram(program.program);
2824- glClear( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT );
2825- glUniform2fv(posUniform, 1, pos);
2826- glEnableVertexAttribArray(vPositionAttr);
2827- glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
2828- glDisableVertexAttribArray(vPositionAttr);
2829- }
2830-
2831- RenderProgram(RenderProgram const&) = delete;
2832- RenderProgram& operator=(RenderProgram const&) = delete;
2833-private:
2834- GLchar const*const frag_shader_src =
2835- {
2836- "precision mediump float;"
2837- "void main() {"
2838- " gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0);"
2839- "}"
2840- };
2841- GLchar const*const vtex_shader_src =
2842- {
2843- "attribute vec4 vPosition;"
2844- "uniform vec2 pos;"
2845- "uniform vec2 scale;"
2846- "void main() {"
2847- " gl_Position = vec4(vPosition.xy * scale + pos, 0.0, 1.0);"
2848- "}"
2849- };
2850- struct Shader
2851- {
2852- Shader(GLchar const* const* src, GLuint type) :
2853- shader(glCreateShader(type))
2854- {
2855- glShaderSource(shader, 1, src, 0);
2856- glCompileShader(shader);
2857- }
2858- ~Shader()
2859- {
2860- glDeleteShader(shader);
2861- }
2862- GLuint shader;
2863- } vertex, fragment;
2864- struct Program
2865- {
2866- Program(Shader& vertex, Shader& fragment) :
2867- program(glCreateProgram())
2868- {
2869- glAttachShader(program, vertex.shader);
2870- glAttachShader(program, fragment.shader);
2871- glLinkProgram(program);
2872- }
2873- ~Program()
2874- {
2875- glDeleteProgram(program);
2876- }
2877- GLuint program;
2878- } program;
2879- GLfloat vertex_data[16]
2880- {
2881- -1.0, -1.0f, 0.0f, 1.0f,
2882- -1.0f, 1.0f, 0.0f, 1.0f,
2883- 1.0f, -1.0f, 0.0f, 1.0f,
2884- 1.0f, 1.0f, 0.0f, 1.0f,
2885- };
2886- GLuint vPositionAttr;
2887- GLuint posUniform;
2888-};
2889-
2890-class Surface
2891-{
2892-public:
2893- Surface(Connection& connection, int swap_interval) :
2894- dimensions(active_output_dimensions(connection)),
2895- surface{create_surface(connection, dimensions), surface_deleter},
2896- context{connection, surface.get(), swap_interval},
2897- program{context, dimensions.width, dimensions.height}
2898- {
2899- }
2900-
2901- void on_event(MirEvent const* ev)
2902- {
2903- if (mir_event_get_type(ev) != mir_event_type_input)
2904- return;
2905- float x{0.0f};
2906- float y{0.0f};
2907- auto ievent = mir_event_get_input_event(ev);
2908- if (mir_input_event_get_type(ievent) == mir_input_event_type_touch)
2909- {
2910- auto tev = mir_input_event_get_touch_event(ievent);
2911- x = mir_touch_event_axis_value(tev, 0, mir_touch_axis_x);
2912- y = mir_touch_event_axis_value(tev, 0, mir_touch_axis_y);
2913- }
2914- else if (mir_input_event_get_type(ievent) == mir_input_event_type_pointer)
2915- {
2916- auto pev = mir_input_event_get_pointer_event(ievent);
2917- x = mir_pointer_event_axis_value(pev, mir_pointer_axis_x);
2918- y = mir_pointer_event_axis_value(pev, mir_pointer_axis_y);
2919- }
2920- else
2921- {
2922- return;
2923- }
2924- context.make_current();
2925- program.draw(
2926- x/static_cast<float>(dimensions.width)*2.0 - 1.0,
2927- y/static_cast<float>(dimensions.height)*-2.0 + 1.0);
2928- context.swapbuffers();
2929- }
2930-
2931- Surface(Surface const&) = delete;
2932- Surface& operator=(Surface const&) = delete;
2933-private:
2934- struct OutputDimensions
2935- {
2936- unsigned int const width;
2937- unsigned int const height;
2938- } const dimensions;
2939-
2940-
2941- std::function<void(MirSurface*)> const surface_deleter{
2942- [](MirSurface* surface)
2943- {
2944- mir_surface_release_sync(surface);
2945- }
2946- };
2947- std::unique_ptr<MirSurface, decltype(surface_deleter)> surface;
2948- Context context;
2949- RenderProgram program;
2950-
2951- OutputDimensions active_output_dimensions(MirConnection* connection)
2952- {
2953- unsigned int width{0};
2954- unsigned int height{0};
2955- auto display_config = mir_connection_create_display_config(connection);
2956- for (auto i = 0u; i < display_config->num_outputs; i++)
2957- {
2958- MirDisplayOutput const* out = display_config->outputs + i;
2959- if (out->used &&
2960- out->connected &&
2961- out->num_modes &&
2962- out->current_mode < out->num_modes)
2963- {
2964- width = out->modes[out->current_mode].horizontal_resolution;
2965- height = out->modes[out->current_mode].vertical_resolution;
2966- break;
2967- }
2968- }
2969- mir_display_config_destroy(display_config);
2970- if (width == 0 || height == 0)
2971- throw std::logic_error("could not determine display size");
2972- return {width, height};
2973- }
2974-
2975- MirSurface* create_surface(MirConnection* connection, OutputDimensions const& dim)
2976- {
2977- MirPixelFormat selected_format;
2978- unsigned int valid_formats{0};
2979- MirPixelFormat pixel_formats[mir_pixel_formats];
2980- mir_connection_get_available_surface_formats(connection, pixel_formats, mir_pixel_formats, &valid_formats);
2981- if (valid_formats == 0)
2982- throw std::runtime_error("no pixel formats for surface");
2983- selected_format = pixel_formats[0];
2984- //select an 8 bit opaque format if we can
2985- for(auto i = 0u; i < valid_formats; i++)
2986- {
2987- if (pixel_formats[i] == mir_pixel_format_xbgr_8888 ||
2988- pixel_formats[i] == mir_pixel_format_xrgb_8888)
2989- {
2990- selected_format = pixel_formats[i];
2991- break;
2992- }
2993- }
2994-
2995- auto deleter = [](MirSurfaceSpec *spec) { mir_surface_spec_release(spec); };
2996- std::unique_ptr<MirSurfaceSpec, decltype(deleter)> spec{
2997- mir_connection_create_spec_for_normal_surface(connection, dim.width, dim.height, selected_format),
2998- deleter
2999- };
3000-
3001- mir_surface_spec_set_name(spec.get(), __PRETTY_FUNCTION__);
3002- mir_surface_spec_set_buffer_usage(spec.get(), mir_buffer_usage_hardware);
3003- auto surface = mir_surface_create_sync(spec.get());
3004- mir_surface_set_event_handler(surface, &on_event, this);
3005- return surface;
3006- }
3007- static void on_event(MirSurface*, const MirEvent *event, void *context)
3008- {
3009- auto surface = reinterpret_cast<Surface*>(context);
3010- if (surface) surface->on_event(event);
3011- }
3012-};
3013-
3014-}
3015-
3016-int main(int argc, char *argv[])
3017-try
3018-{
3019- using namespace std::literals::chrono_literals;
3020-
3021- auto arg = 0;
3022- char const* socket_file = nullptr;
3023- int swap_interval = 1;
3024- while ((arg = getopt (argc, argv, "nm:")) != -1)
3025- {
3026- switch (arg)
3027- {
3028- case 'm':
3029- socket_file = optarg;
3030- break;
3031- case 'n':
3032- swap_interval = 0;
3033- break;
3034- default:
3035- throw std::invalid_argument("invalid command line argument");
3036- }
3037- }
3038-
3039- Connection connection(socket_file);
3040- Surface surface(connection, swap_interval);
3041-
3042- sigset_t sigset;
3043- siginfo_t siginfo;
3044- sigemptyset(&sigset);
3045- sigaddset(&sigset, SIGTERM);
3046- sigaddset(&sigset, SIGINT);
3047- sigprocmask(SIG_BLOCK, &sigset, nullptr);
3048- sigwaitinfo(&sigset, &siginfo);
3049- return 0;
3050-}
3051-catch(std::exception& e)
3052-{
3053- std::cerr << "error : " << e.what() << std::endl;
3054- return 1;
3055-}
3056
3057=== modified file 'examples/fingerpaint.c'
3058--- examples/fingerpaint.c 2015-05-07 09:06:20 +0000
3059+++ examples/fingerpaint.c 2015-05-20 14:01:27 +0000
3060@@ -16,8 +16,6 @@
3061 * Author: Daniel van Vugt <daniel.van.vugt@canonical.com>
3062 */
3063
3064-#define _POSIX_C_SOURCE 200112L // for setenv() from stdlib.h
3065-
3066 #include "mir_toolkit/mir_client_library.h"
3067 #include "mir_toolkit/events/input/input_event.h"
3068
3069@@ -27,7 +25,6 @@
3070 #include <stdlib.h>
3071 #include <unistd.h> /* sleep() */
3072 #include <string.h>
3073-#include <pthread.h>
3074
3075 #define BYTES_PER_PIXEL(f) ((f) == mir_pixel_format_bgr_888 ? 3 : 4)
3076 #define MIN(a, b) ((a) <= (b) ? (a) : (b))
3077@@ -37,19 +34,13 @@
3078 uint8_t r, g, b, a;
3079 } Color;
3080
3081-static volatile bool running = true;
3082-
3083-static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
3084-static pthread_cond_t change = PTHREAD_COND_INITIALIZER;
3085-static bool changed = true;
3086+static volatile sig_atomic_t running = 1;
3087
3088 static void shutdown(int signum)
3089 {
3090 if (running)
3091 {
3092- running = false;
3093- changed = true;
3094- pthread_cond_signal(&change);
3095+ running = 0;
3096 printf("Signal %d received. Good night.\n", signum);
3097 }
3098 }
3099@@ -183,9 +174,20 @@
3100 }
3101 }
3102
3103+static void redraw(MirSurface *surface, const MirGraphicsRegion *canvas)
3104+{
3105+ MirGraphicsRegion backbuffer;
3106+ MirBufferStream *bs = mir_surface_get_buffer_stream(surface);
3107+
3108+ mir_buffer_stream_get_graphics_region(
3109+ bs, &backbuffer);
3110+ copy_region(&backbuffer, canvas);
3111+ mir_buffer_stream_swap_buffers_sync(
3112+ bs);
3113+}
3114+
3115 static void on_event(MirSurface *surface, const MirEvent *event, void *context)
3116 {
3117- (void)surface;
3118 MirGraphicsRegion *canvas = (MirGraphicsRegion*)context;
3119
3120 static const Color color[] =
3121@@ -206,8 +208,6 @@
3122
3123 MirEventType event_type = mir_event_get_type(event);
3124
3125- pthread_mutex_lock(&mutex);
3126-
3127 if (event_type == mir_event_type_input)
3128 {
3129 static size_t base_color = 0;
3130@@ -215,8 +215,8 @@
3131 static float max_pressure = 1.0f;
3132
3133 MirInputEvent const* input_event = mir_event_get_input_event(event);
3134- MirTouchEvent const* tev = NULL;
3135- MirPointerEvent const* pev = NULL;
3136+ MirTouchInputEvent const* tev = NULL;
3137+ MirPointerInputEvent const* pev = NULL;
3138 unsigned touch_count = 0;
3139 bool ended = false;
3140 MirInputEventType type = mir_input_event_get_type(input_event);
3141@@ -224,17 +224,18 @@
3142 switch (type)
3143 {
3144 case mir_input_event_type_touch:
3145- tev = mir_input_event_get_touch_event(input_event);
3146- touch_count = mir_touch_event_point_count(tev);
3147+ tev = mir_input_event_get_touch_input_event(input_event);
3148+ touch_count = mir_touch_input_event_get_touch_count(tev);
3149 ended = touch_count == 1 &&
3150- (mir_touch_event_action(tev, 0) == mir_touch_action_up);
3151+ (mir_touch_input_event_get_touch_action(tev, 0) ==
3152+ mir_touch_input_event_action_up);
3153 break;
3154 case mir_input_event_type_pointer:
3155- pev = mir_input_event_get_pointer_event(input_event);
3156- ended = mir_pointer_event_action(pev) ==
3157- mir_pointer_action_button_up;
3158- touch_count = mir_pointer_event_button_state(pev,
3159- mir_pointer_button_primary) ? 1 : 0;
3160+ pev = mir_input_event_get_pointer_input_event(input_event);
3161+ ended = mir_pointer_input_event_get_action(pev) ==
3162+ mir_pointer_input_event_action_button_up;
3163+ touch_count = mir_pointer_input_event_get_button_state(pev,
3164+ mir_pointer_input_button_primary) ? 1 : 0;
3165 default:
3166 break;
3167 }
3168@@ -261,18 +262,22 @@
3169
3170 if (tev != NULL)
3171 {
3172- x = mir_touch_event_axis_value(tev, p, mir_touch_axis_x);
3173- y = mir_touch_event_axis_value(tev, p, mir_touch_axis_y);
3174- float size = mir_touch_event_axis_value(tev, p,
3175- mir_touch_axis_size);
3176- pressure = mir_touch_event_axis_value(tev, p,
3177- mir_touch_axis_pressure);
3178+ x = mir_touch_input_event_get_touch_axis_value(tev, p,
3179+ mir_touch_input_axis_x);
3180+ y = mir_touch_input_event_get_touch_axis_value(tev, p,
3181+ mir_touch_input_axis_y);
3182+ float size = mir_touch_input_event_get_touch_axis_value(
3183+ tev, p, mir_touch_input_axis_size);
3184+ pressure = mir_touch_input_event_get_touch_axis_value(tev,
3185+ p, mir_touch_input_axis_pressure);
3186 radius = size * 50.0f + 1.0f;
3187 }
3188 else if (pev != NULL)
3189 {
3190- x = mir_pointer_event_axis_value(pev, mir_pointer_axis_x);
3191- y = mir_pointer_event_axis_value(pev, mir_pointer_axis_y);
3192+ x = mir_pointer_input_event_get_axis_value(pev,
3193+ mir_pointer_input_axis_x);
3194+ y = mir_pointer_input_event_get_axis_value(pev,
3195+ mir_pointer_input_axis_y);
3196 pressure = 0.5f;
3197 radius = 5;
3198 }
3199@@ -289,7 +294,7 @@
3200 draw_box(canvas, x - radius, y - radius, 2*radius, &tone);
3201 }
3202
3203- changed = true;
3204+ redraw(surface, canvas);
3205 }
3206 }
3207 else if (event_type == mir_event_type_close_surface)
3208@@ -302,17 +307,21 @@
3209 else if (closing > 1)
3210 {
3211 printf("Oh I forgot you can't save your work. Quitting now...\n");
3212- running = false;
3213- changed = true;
3214+ running = 0;
3215 }
3216 }
3217 else if (event_type == mir_event_type_resize)
3218 {
3219- changed = true;
3220+ /* FIXME: https://bugs.launchpad.net/mir/+bug/1194384
3221+ * mir_event_type_resize will arrive in a different thread to that of
3222+ * mir_event_type_motion, so we cannot safely redraw from this thread.
3223+ * Either the callbacks will need to become thread-safe, or we'd have
3224+ * to employ some non-trivial event queuing and inter-thread signals,
3225+ * which I think is beyond the scope of this example code.
3226+ *
3227+ * redraw(surface, canvas);
3228+ */
3229 }
3230-
3231- pthread_cond_signal(&change);
3232- pthread_mutex_unlock(&mutex);
3233 }
3234
3235 static const MirDisplayOutput *find_active_output(
3236@@ -344,6 +353,7 @@
3237 MirConnection *conn;
3238 MirSurface *surf;
3239 MirGraphicsRegion canvas;
3240+ MirEventDelegate delegate = {&on_event, &canvas};
3241 unsigned int f;
3242 int swap_interval = 0;
3243
3244@@ -390,14 +400,10 @@
3245 }
3246 }
3247
3248- // We do our own resampling now. We can keep up with raw input...
3249- // TODO: Replace setenv with a proper Mir function (LP: #1439590)
3250- setenv("MIR_CLIENT_INPUT_RATE", "0", 0);
3251-
3252 conn = mir_connect_sync(mir_socket, argv[0]);
3253 if (!mir_connection_is_valid(conn))
3254 {
3255- fprintf(stderr, "Could not connect to a display server: %s\n", mir_connection_get_error_message(conn));
3256+ fprintf(stderr, "Could not connect to a display server.\n");
3257 return 1;
3258 }
3259
3260@@ -441,7 +447,7 @@
3261 mir_display_config_destroy(display_config);
3262
3263 MirSurfaceSpec *spec = mir_connection_create_spec_for_normal_surface(conn, width, height, pixel_format);
3264- mir_surface_spec_set_name(spec, "Mir Fingerpaint");
3265+ mir_surface_spec_set_name(spec, "Paint Canvas");
3266 mir_surface_spec_set_buffer_usage(spec, mir_buffer_usage_software);
3267
3268 surf = mir_surface_create_sync(spec);
3269@@ -450,7 +456,7 @@
3270 if (surf != NULL)
3271 {
3272 mir_surface_set_swapinterval(surf, swap_interval);
3273- mir_surface_set_event_handler(surf, &on_event, &canvas);
3274+ mir_surface_set_event_handler(surf, &delegate);
3275
3276 canvas.width = width;
3277 canvas.height = height;
3278@@ -465,26 +471,15 @@
3279 signal(SIGHUP, shutdown);
3280
3281 clear_region(&canvas, &background);
3282+ redraw(surf, &canvas);
3283
3284- MirBufferStream *bs = mir_surface_get_buffer_stream(surf);
3285-
3286 while (running)
3287 {
3288- MirGraphicsRegion backbuffer;
3289- mir_buffer_stream_get_graphics_region(bs, &backbuffer);
3290-
3291- pthread_mutex_lock(&mutex);
3292- while (!changed)
3293- pthread_cond_wait(&change, &mutex);
3294- changed = false;
3295- copy_region(&backbuffer, &canvas);
3296- pthread_mutex_unlock(&mutex);
3297-
3298- mir_buffer_stream_swap_buffers_sync(bs);
3299+ sleep(1); /* Is there a better way yet? */
3300 }
3301
3302 /* Ensure canvas won't be used after it's freed */
3303- mir_surface_set_event_handler(surf, NULL, NULL);
3304+ mir_surface_set_event_handler(surf, NULL);
3305 free(canvas.vaddr);
3306 }
3307 else
3308
3309=== removed file 'examples/mir_demo_server_loader.cpp'
3310--- examples/mir_demo_server_loader.cpp 2015-05-15 11:46:49 +0000
3311+++ examples/mir_demo_server_loader.cpp 1970-01-01 00:00:00 +0000
3312@@ -1,46 +0,0 @@
3313-/*
3314- * Copyright © 2015 Canonical Ltd.
3315- *
3316- * This program is free software: you can redistribute it and/or modify
3317- * it under the terms of the GNU General Public License version 3 as
3318- * published by the Free Software Foundation.
3319- *
3320- * This program is distributed in the hope that it will be useful,
3321- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3322- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3323- * GNU General Public License for more details.
3324- *
3325- * You should have received a copy of the GNU General Public License
3326- * along with this program. If not, see <http://www.gnu.org/licenses/>.
3327- *
3328- * Authored by: Alan Griffiths <alan@octopull.co.uk>
3329- */
3330-
3331-#include <dlfcn.h>
3332-#include <stdexcept>
3333-#include <iostream>
3334-
3335-namespace
3336-{
3337-const char* const library = "libmir_demo_server_loadable.so";
3338-const char* const entry = "main";
3339-}
3340-
3341-int main(int argc, char const* argv[])
3342-try
3343-{
3344- auto const so = dlopen(library, RTLD_NOW|RTLD_LOCAL);
3345- if (!so) throw std::runtime_error(dlerror());
3346-
3347- int (*loaded_main)(int, char const*[]){nullptr};
3348-
3349- (void*&)loaded_main = dlsym(so, entry);
3350- if (!loaded_main) throw std::runtime_error(dlerror());
3351-
3352- return loaded_main(argc, argv);
3353-
3354-}
3355-catch(std::exception const& x)
3356-{
3357- std::cerr << "Error:" << x.what() << std::endl;
3358-}
3359
3360=== modified file 'examples/multiwin.c'
3361--- examples/multiwin.c 2015-05-07 09:06:20 +0000
3362+++ examples/multiwin.c 2015-05-20 14:01:27 +0000
3363@@ -21,7 +21,6 @@
3364 #include <signal.h>
3365 #include <stdint.h>
3366 #include <getopt.h>
3367-#include <stdlib.h>
3368
3369 typedef struct
3370 {
3371@@ -134,18 +133,13 @@
3372 MirConnection *conn;
3373 Window win[3];
3374 unsigned int f;
3375- int alpha = 0x50;
3376
3377 int arg;
3378 opterr = 0;
3379- while ((arg = getopt (argc, argv, "hm:a:")) != -1)
3380+ while ((arg = getopt (argc, argv, "hm:")) != -1)
3381 {
3382 switch (arg)
3383 {
3384- case 'a':
3385- alpha = atoi(optarg);
3386- break;
3387-
3388 case 'm':
3389 socket_file = optarg;
3390 break;
3391@@ -156,7 +150,6 @@
3392 puts(argv[0]);
3393 puts("Usage:");
3394 puts(" -m <Mir server socket>");
3395- puts(" -a Alpha for surfaces");
3396 puts(" -h: this help text");
3397 return -1;
3398 }
3399@@ -165,7 +158,7 @@
3400 conn = mir_connect_sync(socket_file, argv[0]);
3401 if (!mir_connection_is_valid(conn))
3402 {
3403- fprintf(stderr, "Could not connect to a display server: %s\n", mir_connection_get_error_message(conn));
3404+ fprintf(stderr, "Could not connect to a display server.\n");
3405 return 1;
3406 }
3407
3408@@ -207,7 +200,7 @@
3409 win[0].fill.r = 0xff;
3410 win[0].fill.g = 0x00;
3411 win[0].fill.b = 0x00;
3412- win[0].fill.a = alpha;
3413+ win[0].fill.a = 0x50;
3414 premultiply_alpha(&win[0].fill);
3415
3416 mir_surface_spec_set_name(spec, "green");
3417@@ -217,7 +210,7 @@
3418 win[1].fill.r = 0x00;
3419 win[1].fill.g = 0xff;
3420 win[1].fill.b = 0x00;
3421- win[1].fill.a = alpha;
3422+ win[1].fill.a = 0x50;
3423 premultiply_alpha(&win[1].fill);
3424
3425 mir_surface_spec_set_name(spec, "blue");
3426@@ -227,7 +220,7 @@
3427 win[2].fill.r = 0x00;
3428 win[2].fill.g = 0x00;
3429 win[2].fill.b = 0xff;
3430- win[2].fill.a = alpha;
3431+ win[2].fill.a = 0x50;
3432 premultiply_alpha(&win[2].fill);
3433
3434 mir_surface_spec_release(spec);
3435
3436=== modified file 'examples/progressbar.c'
3437--- examples/progressbar.c 2015-05-07 09:06:20 +0000
3438+++ examples/progressbar.c 2015-05-20 14:01:27 +0000
3439@@ -201,7 +201,7 @@
3440 unsigned int const pf_size = 32;
3441 MirPixelFormat formats[pf_size];
3442 unsigned int valid_formats;
3443- int hz = 20;
3444+ int sleep_usec = 50000;
3445
3446 if (argc > 1)
3447 {
3448@@ -209,13 +209,13 @@
3449
3450 if (sscanf(argv[1], "%d", &rate) == 1 && rate > 0)
3451 {
3452- hz = rate;
3453+ sleep_usec = 1000000 / rate;
3454 }
3455 else
3456 {
3457 fprintf(stderr, "Usage: %s [repeat rate in Hz]\n"
3458 "Default repeat rate is %d\n",
3459- argv[0], hz);
3460+ argv[0], 1000000 / sleep_usec);
3461
3462 return 1;
3463 }
3464@@ -224,7 +224,7 @@
3465 conn = mir_connect_sync(NULL, argv[0]);
3466 if (!mir_connection_is_valid(conn))
3467 {
3468- fprintf(stderr, "Could not connect to a display server: %s\n", mir_connection_get_error_message(conn));
3469+ fprintf(stderr, "Could not connect to a display server.\n");
3470 return 1;
3471 }
3472
3473@@ -259,13 +259,7 @@
3474 return 1;
3475 }
3476
3477- {
3478- char name[128];
3479- snprintf(name, sizeof(name)-1, "Progress Bars (%dHz)", hz);
3480- name[sizeof(name)-1] = '\0';
3481- mir_surface_spec_set_name(spec, name);
3482- }
3483-
3484+ mir_surface_spec_set_name(spec, "Progress Bars");
3485 mir_surface_spec_set_buffer_usage(spec, mir_buffer_usage_software);
3486
3487 surf = mir_surface_create_sync(spec);
3488@@ -305,7 +299,7 @@
3489 draw_box(&canvas, x, y, box_width, foreground);
3490
3491 redraw(surf, &canvas);
3492- usleep(1000000 / hz);
3493+ usleep(sleep_usec);
3494 }
3495
3496 free(canvas.vaddr);
3497
3498=== modified file 'examples/render_overlays.cpp'
3499--- examples/render_overlays.cpp 2015-03-31 02:35:42 +0000
3500+++ examples/render_overlays.cpp 2015-05-20 14:01:27 +0000
3501@@ -194,7 +194,7 @@
3502 auto client2 = std::make_shared<DemoOverlayClient>(
3503 *buffer_allocator, buffer_properties, 0xFFFFFF00);
3504
3505- mg::RenderableList renderlist
3506+ std::list<std::shared_ptr<mg::Renderable>> renderlist
3507 {
3508 std::make_shared<DemoRenderable>(client1, geom::Rectangle{{0,0} , buffer_properties.size}),
3509 std::make_shared<DemoRenderable>(client2, geom::Rectangle{{80,80} , buffer_properties.size})
3510@@ -202,16 +202,12 @@
3511
3512 while (running)
3513 {
3514- client1->update_green_channel();
3515- client2->update_green_channel();
3516- display->for_each_display_sync_group([&](mg::DisplaySyncGroup& group)
3517+ display->for_each_display_buffer([&](mg::DisplayBuffer& buffer)
3518 {
3519- group.for_each_display_buffer([&](mg::DisplayBuffer& buffer)
3520- {
3521- buffer.make_current();
3522- buffer.post_renderables_if_optimizable(renderlist);
3523- });
3524- group.post();
3525+ buffer.make_current();
3526+ client1->update_green_channel();
3527+ client2->update_green_channel();
3528+ buffer.post_renderables_if_optimizable(renderlist);
3529 });
3530 }
3531 }
3532
3533=== modified file 'examples/render_surfaces.cpp'
3534--- examples/render_surfaces.cpp 2015-05-18 21:30:28 +0000
3535+++ examples/render_surfaces.cpp 2015-05-20 14:01:27 +0000
3536@@ -30,8 +30,6 @@
3537 #include "mir/options/option.h"
3538 #include "mir/scene/surface.h"
3539 #include "mir/scene/surface_coordinator.h"
3540-#include "mir/scene/buffer_stream_factory.h"
3541-#include "mir/scene/surface_factory.h"
3542 #include "mir/server.h"
3543 #include "mir/report_exception.h"
3544
3545@@ -141,10 +139,10 @@
3546 Moveable(std::shared_ptr<ms::Surface> const& s, const geom::Size& display_size,
3547 float dx, float dy, const glm::vec3& rotation_axis, float alpha_offset)
3548 : surface(s), display_size(display_size),
3549- x{s->top_left().x.as_float()},
3550- y{s->top_left().y.as_float()},
3551- w{s->size().width.as_float()},
3552- h{s->size().height.as_float()},
3553+ x{static_cast<float>(s->top_left().x.as_uint32_t())},
3554+ y{static_cast<float>(s->top_left().y.as_uint32_t())},
3555+ w{static_cast<float>(s->size().width.as_uint32_t())},
3556+ h{static_cast<float>(s->size().height.as_uint32_t())},
3557 dx{dx},
3558 dy{dy},
3559 rotation_axis(rotation_axis),
3560@@ -251,6 +249,7 @@
3561 stop_watch.restart();
3562 }
3563
3564+ glClearColor(0.0, 1.0, 0.0, 1.0);
3565 db_compositor->composite(std::move(scene_sequence));
3566
3567 for (auto& m : moveables)
3568@@ -333,19 +332,14 @@
3569 std::cout << "Rendering " << moveables.size() << " surfaces" << std::endl;
3570
3571 auto const display = the_display();
3572- auto const buffer_stream_factory = the_buffer_stream_factory();
3573- auto const surface_factory = the_surface_factory();
3574 auto const surface_coordinator = the_surface_coordinator();
3575 auto const gl_context = the_display()->create_gl_context();
3576
3577 /* TODO: Get proper configuration */
3578 geom::Rectangles view_area;
3579- display->for_each_display_sync_group([&](mg::DisplaySyncGroup& group)
3580+ display->for_each_display_buffer([&view_area](mg::DisplayBuffer const& db)
3581 {
3582- group.for_each_display_buffer([&](mg::DisplayBuffer& db)
3583- {
3584- view_area.add(db.view_area());
3585- });
3586+ view_area.add(db.view_area());
3587 });
3588 geom::Size const display_size{view_area.bounding_rectangle().size};
3589 uint32_t const surface_side{300};
3590@@ -359,19 +353,16 @@
3591 int i = 0;
3592 for (auto& m : moveables)
3593 {
3594- auto params = ms::a_surface()
3595- .of_size(surface_size)
3596- .of_pixel_format(surface_pf)
3597- .of_buffer_usage(mg::BufferUsage::hardware);
3598- mg::BufferProperties properties{params.size, params.pixel_format, params.buffer_usage};
3599- auto const stream = buffer_stream_factory->create_buffer_stream(properties);
3600- auto const surface = surface_factory->create_surface(stream, params);
3601- surface_coordinator->add_surface(surface, params.depth, params.input_mode, nullptr);
3602+ auto const s = surface_coordinator->add_surface(
3603+ ms::a_surface().of_size(surface_size)
3604+ .of_pixel_format(surface_pf)
3605+ .of_buffer_usage(mg::BufferUsage::hardware),
3606+ nullptr);
3607
3608 {
3609 mg::Buffer* buffer{nullptr};
3610 auto const complete = [&](mg::Buffer* new_buf){ buffer = new_buf; };
3611- surface->primary_buffer_stream()->swap_buffers(buffer, complete); // Fetch buffer for rendering
3612+ s->swap_buffers(buffer, complete); // Fetch buffer for rendering
3613 {
3614 gl_context->make_current();
3615
3616@@ -384,7 +375,7 @@
3617
3618 gl_context->release_current();
3619 }
3620- surface->primary_buffer_stream()->swap_buffers(buffer, complete); // Post rendered buffer
3621+ s->swap_buffers(buffer, complete); // Post rendered buffer
3622 }
3623
3624 /*
3625@@ -394,8 +385,8 @@
3626 uint32_t const x = w * (0.5 + 0.25 * cos(i * angular_step)) - surface_side / 2.0;
3627 uint32_t const y = h * (0.5 + 0.25 * sin(i * angular_step)) - surface_side / 2.0;
3628
3629- surface->move_to({x, y});
3630- m = Moveable(surface, display_size,
3631+ s->move_to({x, y});
3632+ m = Moveable(s, display_size,
3633 cos(0.1f + i * M_PI / 6.0f) * w / 3.0f,
3634 sin(0.1f + i * M_PI / 6.0f) * h / 3.0f,
3635 glm::vec3{(i % 3 == 0) * 1.0f, (i % 3 == 1) * 1.0f, (i % 3 == 2) * 1.0f},
3636
3637=== modified file 'examples/render_to_fb.cpp'
3638--- examples/render_to_fb.cpp 2015-03-31 02:35:42 +0000
3639+++ examples/render_to_fb.cpp 2015-05-20 14:01:27 +0000
3640@@ -53,26 +53,22 @@
3641
3642 mir::draw::glAnimationBasic gl_animation;
3643
3644- display->for_each_display_sync_group([&](mg::DisplaySyncGroup& group)
3645+ display->for_each_display_buffer([&](mg::DisplayBuffer& buffer)
3646 {
3647- group.for_each_display_buffer([&](mg::DisplayBuffer& buffer)
3648- {
3649- buffer.make_current();
3650- gl_animation.init_gl();
3651- });
3652+ buffer.make_current();
3653+ gl_animation.init_gl();
3654 });
3655
3656 while (running)
3657 {
3658- display->for_each_display_sync_group([&](mg::DisplaySyncGroup& group)
3659+ display->for_each_display_buffer([&](mg::DisplayBuffer& buffer)
3660 {
3661- group.for_each_display_buffer([&](mg::DisplayBuffer& buffer)
3662- {
3663- buffer.make_current();
3664- gl_animation.render_gl();
3665- buffer.gl_swap_buffers();
3666- });
3667- group.post();
3668+ buffer.make_current();
3669+
3670+ gl_animation.render_gl();
3671+
3672+ buffer.gl_swap_buffers();
3673+ buffer.flip();
3674 });
3675
3676 gl_animation.step();
3677
3678=== modified file 'examples/server_example.cpp'
3679--- examples/server_example.cpp 2015-05-07 09:06:20 +0000
3680+++ examples/server_example.cpp 2015-05-20 14:01:27 +0000
3681@@ -1,5 +1,5 @@
3682 /*
3683- * Copyright © 2012-2015 Canonical Ltd.
3684+ * Copyright © 2012-2014 Canonical Ltd.
3685 *
3686 * This program is free software: you can redistribute it and/or modify
3687 * it under the terms of the GNU General Public License version 3 as
3688@@ -22,7 +22,6 @@
3689 #include "server_example_display_configuration_policy.h"
3690 #include "server_example_host_lifecycle_event_listener.h"
3691 #include "server_example_window_management.h"
3692-#include "server_example_custom_compositor.h"
3693 #include "server_example_test_client.h"
3694
3695 #include "mir/server.h"
3696@@ -65,13 +64,14 @@
3697
3698 server.add_configuration_option(timeout_opt, timeout_descr, mir::OptionType::integer);
3699
3700- server.add_init_callback([&server]
3701+ server.add_init_callback([&]
3702 {
3703 const auto options = server.get_options();
3704 if (options->is_set(timeout_opt))
3705 {
3706- static auto const exit_action = server.the_main_loop()->create_alarm([&server] { server.stop(); });
3707- exit_action->reschedule_in(std::chrono::seconds(options->get<int>(timeout_opt)));
3708+ static auto const exit_action = server.the_main_loop()->notify_in(
3709+ std::chrono::seconds(options->get<int>(timeout_opt)),
3710+ [&] { server.stop(); });
3711 }
3712 });
3713 }
3714@@ -82,15 +82,11 @@
3715 {
3716 mir::Server server;
3717
3718- // Use config options file in e.g. ~/.config/mir/mir_demo_server.config
3719- server.set_config_filename("mir/mir_demo_server.config");
3720-
3721 // Add example options for display layout, logging, launching clients and timeout
3722 me::add_display_configuration_options_to(server);
3723 me::add_log_host_lifecycle_option_to(server);
3724 me::add_glog_options_to(server);
3725 me::add_window_manager_option_to(server);
3726- me::add_custom_compositor_option_to(server);
3727 add_launcher_option_to(server);
3728 add_timeout_option_to(server);
3729
3730
3731=== removed file 'examples/server_example_adorning_compositor.cpp'
3732--- examples/server_example_adorning_compositor.cpp 2015-04-07 13:19:22 +0000
3733+++ examples/server_example_adorning_compositor.cpp 1970-01-01 00:00:00 +0000
3734@@ -1,163 +0,0 @@
3735-/*
3736- * Copyright © 2015 Canonical Ltd.
3737- *
3738- * This program is free software: you can redistribute it and/or modify it
3739- * under the terms of the GNU General Public License version 3,
3740- * as published by the Free Software Foundation.
3741- *
3742- * This program is distributed in the hope that it will be useful,
3743- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3744- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3745- * GNU General Public License for more details.
3746- *
3747- * You should have received a copy of the GNU General Public License
3748- * along with this program. If not, see <http://www.gnu.org/licenses/>.
3749- *
3750- * Authored By: Kevin DuBois <kevin.dubois@canonical.com>
3751- */
3752-
3753-#include "server_example_adorning_compositor.h"
3754-#include "mir/graphics/display_buffer.h"
3755-#include "mir/graphics/buffer.h"
3756-#include "mir/compositor/scene_element.h"
3757-#include <GLES2/gl2.h>
3758-
3759-namespace me = mir::examples;
3760-namespace mg = mir::graphics;
3761-namespace mc = mir::compositor;
3762-
3763-bool make_current(mg::DisplayBuffer& db)
3764-{
3765- db.make_current();
3766- return true;
3767-}
3768-
3769-me::AdorningDisplayBufferCompositor::Shader::Shader(GLchar const* const* src, GLuint type) :
3770- shader(glCreateShader(type))
3771-{
3772- glShaderSource(shader, 1, src, 0);
3773- glCompileShader(shader);
3774-}
3775-
3776-me::AdorningDisplayBufferCompositor::Shader::~Shader()
3777-{
3778- glDeleteShader(shader);
3779-}
3780-
3781-me::AdorningDisplayBufferCompositor::Program::Program(Shader& vertex, Shader& fragment) :
3782- program(glCreateProgram())
3783-{
3784- glAttachShader(program, vertex.shader);
3785- glAttachShader(program, fragment.shader);
3786- glLinkProgram(program);
3787-}
3788-
3789-me::AdorningDisplayBufferCompositor::Program::~Program()
3790-{
3791- glDeleteProgram(program);
3792-}
3793-
3794-me::AdorningDisplayBufferCompositor::AdorningDisplayBufferCompositor(
3795- mg::DisplayBuffer& display_buffer,
3796- std::tuple<float, float, float> const& background_rgb) :
3797- db{display_buffer},
3798- vert_shader_src{
3799- "attribute vec4 vPosition;"
3800- "uniform vec2 pos;"
3801- "uniform vec2 scale;"
3802- "attribute vec2 uvCoord;"
3803- "varying vec2 texcoord;"
3804- "void main() {"
3805- " gl_Position = vec4(vPosition.xy * scale + pos, 0.0, 1.0);"
3806- " texcoord = uvCoord.xy;"
3807- "}"
3808- },
3809- frag_shader_src{
3810- "precision mediump float;"
3811- "varying vec2 texcoord;"
3812- "uniform sampler2D tex;"
3813- "uniform float alpha;"
3814- "void main() {"
3815- " gl_FragColor = texture2D(tex, texcoord) * alpha;"
3816- "}"
3817- },
3818- current(make_current(db)),
3819- vertex(&vert_shader_src, GL_VERTEX_SHADER),
3820- fragment(&frag_shader_src, GL_FRAGMENT_SHADER),
3821- program(vertex, fragment)
3822-{
3823- glUseProgram(program.program);
3824- vPositionAttr = glGetAttribLocation(program.program, "vPosition");
3825- glVertexAttribPointer(vPositionAttr, 4, GL_FLOAT, GL_FALSE, 0, vertex_data);
3826- uvCoord = glGetAttribLocation(program.program, "uvCoord");
3827- glVertexAttribPointer(uvCoord, 2, GL_FLOAT, GL_FALSE, 0, uv_data);
3828- posUniform = glGetUniformLocation(program.program, "pos");
3829- glClearColor(std::get<0>(background_rgb), std::get<1>(background_rgb), std::get<2>(background_rgb), 1.0);
3830- scaleUniform = glGetUniformLocation(program.program, "scale");
3831- alphaUniform = glGetUniformLocation(program.program, "alpha");
3832-
3833- glGenTextures(1, &texture);
3834- glBindTexture(GL_TEXTURE_2D, texture);
3835- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
3836- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
3837- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
3838- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
3839- glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
3840-}
3841-
3842-void me::AdorningDisplayBufferCompositor::composite(compositor::SceneElementSequence&& scene_sequence)
3843-{
3844- //note: If what should be drawn is expressible as a SceneElementSequence,
3845- // mg::DisplayBuffer::post_renderables_if_optimizable() should be used,
3846- // to give the the display hardware a chance at an optimized render of
3847- // the scene. In this example though, we want some custom elements, so
3848- // we'll always use GLES.
3849- db.make_current();
3850-
3851- auto display_width = db.view_area().size.width.as_float();
3852- auto display_height = db.view_area().size.height.as_float();
3853-
3854- glUseProgram(program.program);
3855- glClear( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT );
3856-
3857- for(auto& element : scene_sequence)
3858- {
3859- //courteously inform the client that its rendered
3860- //if something is not to be rendered, mc::SceneElementSequence::occluded() should be called
3861- element->rendered();
3862-
3863- auto const renderable = element->renderable();
3864- float width = renderable->screen_position().size.width.as_float();
3865- float height = renderable->screen_position().size.height.as_float();
3866- float x = renderable->screen_position().top_left.x.as_float() - db.view_area().top_left.x.as_float();
3867- float y = renderable->screen_position().top_left.y.as_float() - db.view_area().top_left.y.as_float();
3868- float scale[2] {
3869- width/display_width * 2,
3870- height/display_height * -2};
3871- float position[2] {
3872- (x / display_width * 2.0f) - 1.0f,
3873- 1.0f - (y / display_height * 2.0f)
3874- };
3875- float const plane_alpha = renderable->alpha();
3876- if (renderable->shaped() || plane_alpha < 1.0)
3877- glEnable(GL_BLEND);
3878- else
3879- glDisable(GL_BLEND);
3880-
3881- glUniform2fv(posUniform, 1, position);
3882- glUniform2fv(scaleUniform, 1, scale);
3883- glUniform1fv(alphaUniform, 1, &plane_alpha);
3884-
3885- glActiveTexture(GL_TEXTURE0);
3886- glBindTexture(GL_TEXTURE_2D, texture);
3887- renderable->buffer()->gl_bind_to_texture();
3888-
3889- glEnableVertexAttribArray(vPositionAttr);
3890- glEnableVertexAttribArray(uvCoord);
3891- glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
3892- glDisableVertexAttribArray(uvCoord);
3893- glDisableVertexAttribArray(vPositionAttr);
3894- }
3895-
3896- db.gl_swap_buffers();
3897-}
3898
3899=== removed file 'examples/server_example_adorning_compositor.h'
3900--- examples/server_example_adorning_compositor.h 2015-04-07 12:43:16 +0000
3901+++ examples/server_example_adorning_compositor.h 1970-01-01 00:00:00 +0000
3902@@ -1,82 +0,0 @@
3903-/*
3904- * Copyright © 2015 Canonical Ltd.
3905- *
3906- * This program is free software: you can redistribute it and/or modify it
3907- * under the terms of the GNU General Public License version 3,
3908- * as published by the Free Software Foundation.
3909- *
3910- * This program is distributed in the hope that it will be useful,
3911- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3912- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3913- * GNU General Public License for more details.
3914- *
3915- * You should have received a copy of the GNU General Public License
3916- * along with this program. If not, see <http://www.gnu.org/licenses/>.
3917- *
3918- * Authored By: Kevin DuBois <kevin.dubois@canonical.com>
3919- */
3920-
3921-#ifndef MIR_EXAMPLES_ADORNING_COMPOSITOR_H_
3922-#define MIR_EXAMPLES_ADORNING_COMPOSITOR_H_
3923-#include "mir/compositor/display_buffer_compositor.h"
3924-#include <GLES2/gl2.h>
3925-#include <tuple>
3926-
3927-namespace mir
3928-{
3929-namespace graphics
3930-{
3931-class DisplayBuffer;
3932-}
3933-namespace examples
3934-{
3935-class AdorningDisplayBufferCompositor : public compositor::DisplayBufferCompositor
3936-{
3937-public:
3938- AdorningDisplayBufferCompositor(graphics::DisplayBuffer&, std::tuple<float, float, float> const& background_rgb);
3939- void composite(compositor::SceneElementSequence&& scene_sequence) override;
3940-private:
3941- graphics::DisplayBuffer& db;
3942- GLchar const*const vert_shader_src;
3943- GLchar const*const frag_shader_src;
3944- bool current;
3945- struct Shader
3946- {
3947- Shader(GLchar const* const* src, GLuint type);
3948- ~Shader();
3949- GLuint shader;
3950- } vertex, fragment;
3951- struct Program
3952- {
3953- Program(Shader& vertex, Shader& fragment);
3954- ~Program();
3955- GLuint program;
3956- } program;
3957-
3958- GLfloat vertex_data[16]
3959- {
3960- 0.0f, 0.0f, 0.0f, 1.0f,
3961- 0.0f, 1.0f, 0.0f, 1.0f,
3962- 1.0f, 0.0f, 0.0f, 1.0f,
3963- 1.0f, 1.0f, 0.0f, 1.0f,
3964- };
3965- GLfloat uv_data[8]
3966- {
3967- 0.0f, 0.0f,
3968- 0.0f, 1.0f,
3969- 1.0f, 0.0f,
3970- 1.0f, 1.0f,
3971-
3972- };
3973-
3974- GLuint vPositionAttr;
3975- GLuint uvCoord;
3976- GLuint scaleUniform;
3977- GLuint posUniform;
3978- GLuint alphaUniform;
3979- GLuint texture;
3980-};
3981-}
3982-}
3983-
3984-#endif /* MIR_EXAMPLES_ADORNING_COMPOSITOR_H_ */
3985
3986=== modified file 'examples/server_example_basic_window_manager.h'
3987--- examples/server_example_basic_window_manager.h 2015-05-07 09:06:20 +0000
3988+++ examples/server_example_basic_window_manager.h 2015-05-20 14:01:27 +0000
3989@@ -19,12 +19,11 @@
3990 #ifndef MIR_EXAMPLE_BASIC_WINDOW_MANAGER_H_
3991 #define MIR_EXAMPLE_BASIC_WINDOW_MANAGER_H_
3992
3993+#include "server_example_generic_shell.h"
3994+
3995 #include "mir/geometry/rectangles.h"
3996 #include "mir/scene/session.h"
3997-#include "mir/scene/surface.h"
3998 #include "mir/scene/surface_creation_parameters.h"
3999-#include "mir/shell/abstract_shell.h"
4000-#include "mir/shell/window_manager.h"
4001
4002 #include <map>
4003 #include <mutex>
4004@@ -36,8 +35,6 @@
4005 {
4006 namespace examples
4007 {
4008-using shell::SurfaceSet;
4009-
4010 template<typename Info>
4011 struct SurfaceTo
4012 {
4013@@ -53,9 +50,8 @@
4014 /// The interface through which the policy instructs the controller.
4015 /// These functions assume that the BasicWindowManager data structures can be accessed freely.
4016 /// I.e. should only be invoked by the policy handle_... methods (where any necessary locks are held).
4017-// TODO extract commonality with FocusController (once that's separated from shell::FocusController)
4018 template<typename SessionInfo, typename SurfaceInfo>
4019-class BasicWindowManagerToolsCopy
4020+class BasicWindowManagerTools
4021 {
4022 public:
4023 virtual auto find_session(std::function<bool(SessionInfo const& info)> const& predicate)
4024@@ -65,26 +61,16 @@
4025
4026 virtual auto info_for(std::weak_ptr<scene::Surface> const& surface) const -> SurfaceInfo& = 0;
4027
4028- virtual std::shared_ptr<scene::Session> focused_session() const = 0;
4029-
4030- virtual std::shared_ptr<scene::Surface> focused_surface() const = 0;
4031-
4032- virtual void focus_next_session() = 0;
4033-
4034- virtual void set_focus_to(
4035- std::shared_ptr<scene::Session> const& focus,
4036- std::shared_ptr<scene::Surface> const& surface) = 0;
4037-
4038- virtual auto surface_at(geometry::Point cursor) const -> std::shared_ptr<scene::Surface> = 0;
4039-
4040- virtual void raise(SurfaceSet const& surfaces) = 0;
4041-
4042- virtual auto active_display() -> geometry::Rectangle const = 0;
4043-
4044- virtual ~BasicWindowManagerToolsCopy() = default;
4045- BasicWindowManagerToolsCopy() = default;
4046- BasicWindowManagerToolsCopy(BasicWindowManagerToolsCopy const&) = delete;
4047- BasicWindowManagerToolsCopy& operator=(BasicWindowManagerToolsCopy const&) = delete;
4048+ virtual std::weak_ptr<scene::Session> focussed_application() const = 0;
4049+
4050+ virtual void focus_next() = 0;
4051+
4052+ virtual void set_focus_to(std::shared_ptr<scene::Session> const& focus) = 0;
4053+
4054+ virtual ~BasicWindowManagerTools() = default;
4055+ BasicWindowManagerTools() = default;
4056+ BasicWindowManagerTools(BasicWindowManagerTools const&) = delete;
4057+ BasicWindowManagerTools& operator=(BasicWindowManagerTools const&) = delete;
4058 };
4059
4060 /// A policy based window manager.
4061@@ -100,20 +86,20 @@
4062 /// - void handle_new_surface(std::shared_ptr<ms::Session> const& session, std::shared_ptr<ms::Surface> const& surface);
4063 /// - void handle_delete_surface(std::shared_ptr<ms::Session> const& /*session*/, std::weak_ptr<ms::Surface> const& /*surface*/);
4064 /// - int handle_set_state(std::shared_ptr<ms::Surface> const& surface, MirSurfaceState value);
4065-/// - bool handle_keyboard_event(MirKeyboardEvent const* event);
4066-/// - bool handle_touch_event(MirTouchEvent const* event);
4067-/// - bool handle_pointer_event(MirPointerEvent const* event);
4068+/// - bool handle_key_event(MirKeyInputEvent const* event);
4069+/// - bool handle_touch_event(MirTouchInputEvent const* event);
4070+/// - bool handle_pointer_event(MirPointerInputEvent const* event);
4071 ///
4072 /// \tparam SessionInfo must be default constructable.
4073 ///
4074-/// \tparam SurfaceInfo must be constructable from (std::shared_ptr<ms::Session>, std::shared_ptr<ms::Surface>, ms::SurfaceCreationParameters const& params)
4075+/// \tparam SurfaceInfo must be constructable from (std::shared_ptr<ms::Session>, std::shared_ptr<ms::Surface>)
4076 template<typename WindowManagementPolicy, typename SessionInfo, typename SurfaceInfo>
4077-class BasicWindowManagerCopy : public shell::WindowManager,
4078- private BasicWindowManagerToolsCopy<SessionInfo, SurfaceInfo>
4079+class BasicWindowManager : public WindowManager,
4080+ private BasicWindowManagerTools<SessionInfo, SurfaceInfo>
4081 {
4082 public:
4083 template <typename... PolicyArgs>
4084- BasicWindowManagerCopy(
4085+ BasicWindowManager(
4086 shell::FocusController* focus_controller,
4087 PolicyArgs&&... policy_args) :
4088 focus_controller(focus_controller),
4089@@ -145,24 +131,14 @@
4090 scene::SurfaceCreationParameters const placed_params = policy.handle_place_new_surface(session, params);
4091 auto const result = build(session, placed_params);
4092 auto const surface = session->surface(result);
4093- surface_info.emplace(surface, SurfaceInfo{session, surface, placed_params});
4094 policy.handle_new_surface(session, surface);
4095- policy.generate_decorations_for(session, surface, surface_info);
4096+ surface_info.emplace(surface, SurfaceInfo{session, surface});
4097 return result;
4098 }
4099
4100- void modify_surface(
4101- std::shared_ptr<scene::Session> const& session,
4102- std::shared_ptr<scene::Surface> const& surface,
4103- shell::SurfaceSpecification const& modifications) override
4104- {
4105- std::lock_guard<decltype(mutex)> lock(mutex);
4106- policy.handle_modify_surface(session, surface, modifications);
4107- }
4108-
4109 void remove_surface(
4110- std::shared_ptr<scene::Session> const& session,
4111- std::weak_ptr<scene::Surface> const& surface) override
4112+ std::weak_ptr<scene::Surface> const& surface,
4113+ std::shared_ptr<scene::Session> const& session) override
4114 {
4115 std::lock_guard<decltype(mutex)> lock(mutex);
4116 policy.handle_delete_surface(session, surface);
4117@@ -184,46 +160,28 @@
4118 policy.handle_displays_updated(session_info, displays);
4119 }
4120
4121- bool handle_keyboard_event(MirKeyboardEvent const* event) override
4122+ bool handle_key_event(MirKeyInputEvent const* event) override
4123 {
4124 std::lock_guard<decltype(mutex)> lock(mutex);
4125- return policy.handle_keyboard_event(event);
4126+ return policy.handle_key_event(event);
4127 }
4128
4129- bool handle_touch_event(MirTouchEvent const* event) override
4130+ bool handle_touch_event(MirTouchInputEvent const* event) override
4131 {
4132 std::lock_guard<decltype(mutex)> lock(mutex);
4133 return policy.handle_touch_event(event);
4134 }
4135
4136- bool handle_pointer_event(MirPointerEvent const* event) override
4137+ bool handle_pointer_event(MirPointerInputEvent const* event) override
4138 {
4139 std::lock_guard<decltype(mutex)> lock(mutex);
4140-
4141- cursor = {
4142- mir_pointer_event_axis_value(event, mir_pointer_axis_x),
4143- mir_pointer_event_axis_value(event, mir_pointer_axis_y)};
4144-
4145 return policy.handle_pointer_event(event);
4146 }
4147
4148- int set_surface_attribute(
4149- std::shared_ptr<scene::Session> const& /*session*/,
4150- std::shared_ptr<scene::Surface> const& surface,
4151- MirSurfaceAttrib attrib,
4152- int value) override
4153+ int handle_set_state(std::shared_ptr<scene::Surface> const& surface, MirSurfaceState value) override
4154 {
4155 std::lock_guard<decltype(mutex)> lock(mutex);
4156- switch (attrib)
4157- {
4158- case mir_surface_attrib_state:
4159- {
4160- auto const state = policy.handle_set_state(surface, MirSurfaceState(value));
4161- return surface->configure(attrib, state);
4162- }
4163- default:
4164- return surface->configure(attrib, value);
4165- }
4166+ return policy.handle_set_state(surface, value);
4167 }
4168
4169 auto find_session(std::function<bool(SessionInfo const& info)> const& predicate)
4170@@ -250,83 +208,19 @@
4171 return const_cast<SurfaceInfo&>(surface_info.at(surface));
4172 }
4173
4174- std::shared_ptr<scene::Session> focused_session() const override
4175- {
4176- return focus_controller->focused_session();
4177- }
4178-
4179- std::shared_ptr<scene::Surface> focused_surface() const override
4180- {
4181- return focus_controller->focused_surface();
4182- }
4183-
4184- void focus_next_session() override
4185- {
4186- focus_controller->focus_next_session();
4187- }
4188-
4189- void set_focus_to(
4190- std::shared_ptr<scene::Session> const& focus,
4191- std::shared_ptr<scene::Surface> const& surface) override
4192- {
4193- focus_controller->set_focus_to(focus, surface);
4194- }
4195-
4196- auto surface_at(geometry::Point cursor) const -> std::shared_ptr<scene::Surface> override
4197- {
4198- return focus_controller->surface_at(cursor);
4199- }
4200-
4201- void raise(SurfaceSet const& surfaces) override
4202- {
4203- focus_controller->raise(surfaces);
4204- }
4205-
4206- auto active_display() -> geometry::Rectangle const override
4207- {
4208- geometry::Rectangle result;
4209-
4210- // 1. If a window has input focus, whichever display contains the largest
4211- // proportion of the area of that window.
4212- if (auto const surface = focused_surface())
4213- {
4214- auto const surface_rect = surface->input_bounds();
4215- int max_overlap_area = -1;
4216-
4217- for (auto const& display : displays)
4218- {
4219- auto const intersection = surface_rect.intersection_with(display).size;
4220- if (intersection.width.as_int()*intersection.height.as_int() > max_overlap_area)
4221- {
4222- max_overlap_area = intersection.width.as_int()*intersection.height.as_int();
4223- result = display;
4224- }
4225- }
4226- return result;
4227- }
4228-
4229- // 2. Otherwise, if any window previously had input focus, for the window that had
4230- // it most recently, the display that contained the largest proportion of the
4231- // area of that window at the moment it closed, as long as that display is still
4232- // available.
4233-
4234- // 3. Otherwise, the display that contains the pointer, if there is one.
4235- for (auto const& display : displays)
4236- {
4237- if (display.contains(cursor))
4238- {
4239- // Ignore the (unspecified) possiblity of overlapping displays
4240- return display;
4241- }
4242- }
4243-
4244- // 4. Otherwise, the primary display, if there is one (for example, the laptop display).
4245-
4246- // 5. Otherwise, the first display.
4247- if (displays.size())
4248- result = *displays.begin();
4249-
4250- return result;
4251+ std::weak_ptr<scene::Session> focussed_application() const override
4252+ {
4253+ return focus_controller->focussed_application();
4254+ }
4255+
4256+ void focus_next() override
4257+ {
4258+ focus_controller->focus_next();
4259+ }
4260+
4261+ void set_focus_to(std::shared_ptr<scene::Session> const& focus) override
4262+ {
4263+ focus_controller->set_focus_to(focus);
4264 }
4265
4266 shell::FocusController* const focus_controller;
4267@@ -336,7 +230,6 @@
4268 typename SessionTo<SessionInfo>::type session_info;
4269 typename SurfaceTo<SurfaceInfo>::type surface_info;
4270 geometry::Rectangles displays;
4271- geometry::Point cursor;
4272 };
4273 }
4274 }
4275
4276=== removed file 'examples/server_example_canonical_window_manager.cpp'
4277--- examples/server_example_canonical_window_manager.cpp 2015-05-19 21:42:19 +0000
4278+++ examples/server_example_canonical_window_manager.cpp 1970-01-01 00:00:00 +0000
4279@@ -1,948 +0,0 @@
4280-/*
4281- * Copyright © 2015 Canonical Ltd.
4282- *
4283- * This program is free software: you can redistribute it and/or modify it
4284- * under the terms of the GNU General Public License version 3,
4285- * as published by the Free Software Foundation.
4286- *
4287- * This program is distributed in the hope that it will be useful,
4288- * but WITHOUT ANY WARRANTY; without even the implied warranty of
4289- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4290- * GNU General Public License for more details.
4291- *
4292- * You should have received a copy of the GNU General Public License
4293- * along with this program. If not, see <http://www.gnu.org/licenses/>.
4294- *
4295- * Authored By: Alan Griffiths <alan@octopull.co.uk>
4296- */
4297-
4298-#include "server_example_canonical_window_manager.h"
4299-
4300-#include "mir/scene/surface.h"
4301-#include "mir/scene/null_surface_observer.h"
4302-#include "mir/shell/display_layout.h"
4303-#include "mir/shell/surface_specification.h"
4304-#include "mir/shell/surface_ready_observer.h"
4305-#include "mir/geometry/displacement.h"
4306-
4307-#include "mir/graphics/buffer.h"
4308-
4309-#include <linux/input.h>
4310-#include <csignal>
4311-#include <mutex>
4312-#include <condition_variable>
4313-#include <algorithm>
4314-
4315-namespace me = mir::examples;
4316-namespace ms = mir::scene;
4317-using namespace mir::geometry;
4318-
4319-///\example server_example_canonical_window_manager.cpp
4320-// Based on "Mir and Unity: Surfaces, input, and displays (v0.3)"
4321-
4322-namespace
4323-{
4324-int const title_bar_height = 10;
4325-Size titlebar_size_for_window(Size window_size)
4326-{
4327- return {window_size.width, Height{title_bar_height}};
4328-}
4329-
4330-Point titlebar_position_for_window(Point window_position)
4331-{
4332- return {
4333- window_position.x,
4334- window_position.y - DeltaY(title_bar_height)
4335- };
4336-}
4337-}
4338-
4339-me::CanonicalSurfaceInfoCopy::CanonicalSurfaceInfoCopy(
4340- std::shared_ptr<scene::Session> const& session,
4341- std::shared_ptr<scene::Surface> const& surface,
4342- scene::SurfaceCreationParameters const& params) :
4343- state{mir_surface_state_restored},
4344- restore_rect{surface->top_left(), surface->size()},
4345- session{session},
4346- parent{params.parent},
4347- min_width{params.min_width},
4348- min_height{params.min_height},
4349- max_width{params.max_width},
4350- max_height{params.max_height},
4351- width_inc{params.width_inc},
4352- height_inc{params.height_inc},
4353- min_aspect{params.min_aspect},
4354- max_aspect{params.max_aspect}
4355-{
4356-}
4357-
4358-me::CanonicalWindowManagerPolicyCopy::CanonicalWindowManagerPolicyCopy(
4359- Tools* const tools,
4360- std::shared_ptr<shell::DisplayLayout> const& display_layout) :
4361- tools{tools},
4362- display_layout{display_layout}
4363-{
4364-}
4365-
4366-void me::CanonicalWindowManagerPolicyCopy::click(Point cursor)
4367-{
4368- if (auto const surface = tools->surface_at(cursor))
4369- select_active_surface(surface);
4370-
4371- old_cursor = cursor;
4372-}
4373-
4374-void me::CanonicalWindowManagerPolicyCopy::handle_session_info_updated(CanonicalSessionInfoMap& /*session_info*/, Rectangles const& /*displays*/)
4375-{
4376-}
4377-
4378-void me::CanonicalWindowManagerPolicyCopy::handle_displays_updated(CanonicalSessionInfoMap& /*session_info*/, Rectangles const& displays)
4379-{
4380- display_area = displays.bounding_rectangle();
4381-}
4382-
4383-void me::CanonicalWindowManagerPolicyCopy::resize(Point cursor)
4384-{
4385- select_active_surface(tools->surface_at(old_cursor));
4386- resize(active_surface(), cursor, old_cursor, display_area);
4387- old_cursor = cursor;
4388-}
4389-
4390-auto me::CanonicalWindowManagerPolicyCopy::handle_place_new_surface(
4391- std::shared_ptr<ms::Session> const& session,
4392- ms::SurfaceCreationParameters const& request_parameters)
4393--> ms::SurfaceCreationParameters
4394-{
4395- auto parameters = request_parameters;
4396- parameters.size.height = parameters.size.height + DeltaY{title_bar_height};
4397-
4398- auto const active_display = tools->active_display();
4399-
4400- auto const width = parameters.size.width.as_int();
4401- auto const height = parameters.size.height.as_int();
4402-
4403- bool positioned = false;
4404-
4405- auto const parent = parameters.parent.lock();
4406-
4407- if (parameters.output_id != mir::graphics::DisplayConfigurationOutputId{0})
4408- {
4409- Rectangle rect{parameters.top_left, parameters.size};
4410- display_layout->place_in_output(parameters.output_id, rect);
4411- parameters.top_left = rect.top_left;
4412- parameters.size = rect.size;
4413- parameters.state = mir_surface_state_fullscreen;
4414- positioned = true;
4415- }
4416- else if (!parent) // No parent => client can't suggest positioning
4417- {
4418- if (auto const default_surface = session->default_surface())
4419- {
4420- static Displacement const offset{title_bar_height, title_bar_height};
4421-
4422- parameters.top_left = default_surface->top_left() + offset;
4423-
4424- geometry::Rectangle display_for_app{default_surface->top_left(), default_surface->size()};
4425-
4426- display_layout->size_to_output(display_for_app);
4427-
4428- positioned = display_for_app.overlaps(Rectangle{parameters.top_left, parameters.size});
4429- }
4430- }
4431-
4432- if (parent && parameters.aux_rect.is_set() && parameters.edge_attachment.is_set())
4433- {
4434- auto const edge_attachment = parameters.edge_attachment.value();
4435- auto const aux_rect = parameters.aux_rect.value();
4436- auto const parent_top_left = parent->top_left();
4437- auto const top_left = aux_rect.top_left -Point{} + parent_top_left;
4438- auto const top_right= aux_rect.top_right() -Point{} + parent_top_left;
4439- auto const bot_left = aux_rect.bottom_left()-Point{} + parent_top_left;
4440-
4441- if (edge_attachment && mir_edge_attachment_vertical)
4442- {
4443- if (active_display.contains(top_right + Displacement{width, height}))
4444- {
4445- parameters.top_left = top_right;
4446- positioned = true;
4447- }
4448- else if (active_display.contains(top_left + Displacement{-width, height}))
4449- {
4450- parameters.top_left = top_left + Displacement{-width, 0};
4451- positioned = true;
4452- }
4453- }
4454-
4455- if (edge_attachment && mir_edge_attachment_horizontal)
4456- {
4457- if (active_display.contains(bot_left + Displacement{width, height}))
4458- {
4459- parameters.top_left = bot_left;
4460- positioned = true;
4461- }
4462- else if (active_display.contains(top_left + Displacement{width, -height}))
4463- {
4464- parameters.top_left = top_left + Displacement{0, -height};
4465- positioned = true;
4466- }
4467- }
4468- }
4469-
4470- if (!positioned)
4471- {
4472- auto centred = active_display.top_left + 0.5*(
4473- as_displacement(active_display.size) - as_displacement(parameters.size));
4474-
4475- parameters.top_left = centred - DeltaY{(active_display.size.height.as_int()-height)/6};
4476-
4477- if (parameters.top_left.y < display_area.top_left.y)
4478- parameters.top_left.y = display_area.top_left.y;
4479- }
4480-
4481- parameters.top_left.y = parameters.top_left.y + DeltaY{title_bar_height};
4482- parameters.size.height = parameters.size.height - DeltaY{title_bar_height};
4483- return parameters;
4484-}
4485-
4486-//TODO: provide an easier way for the server to write to a surface!
4487-//TODO: this is painful to use mg::Buffer::write()
4488-namespace
4489-{
4490-void swap_buffers(
4491- std::shared_ptr<ms::Surface> const& surface,
4492- mir::graphics::Buffer*& surface_buffer)
4493-{
4494- std::mutex mut;
4495- std::condition_variable cv;
4496-
4497- auto const callback = [&](mir::graphics::Buffer* buffer)
4498- {
4499- std::unique_lock<decltype(mut)> lk(mut);
4500- surface_buffer = buffer;
4501- cv.notify_one();
4502- };
4503-
4504- auto const old_buffer = surface_buffer;
4505-
4506- surface->primary_buffer_stream()->swap_buffers(surface_buffer, callback);
4507-
4508- std::unique_lock<decltype(mut)> lk(mut);
4509- cv.wait(lk, [&]{return old_buffer != surface_buffer;});
4510-}
4511-
4512-void paint_titlebar(
4513- std::shared_ptr<ms::Surface> const& titlebar,
4514- mir::examples::CanonicalSurfaceInfoCopy& titlebar_info,
4515- int intensity)
4516-{
4517- auto stream = titlebar->primary_buffer_stream();
4518- auto const format = stream->pixel_format();
4519-
4520- if (!titlebar_info.buffer)
4521- swap_buffers(titlebar, titlebar_info.buffer);
4522-
4523- auto const sz = titlebar_info.buffer->size().height.as_int() *
4524- titlebar_info.buffer->size().width.as_int() * MIR_BYTES_PER_PIXEL(format);
4525-
4526- std::vector<unsigned char> pixels(sz, intensity);
4527- titlebar_info.buffer->write(pixels.data(), sz);
4528-
4529- swap_buffers(titlebar, titlebar_info.buffer);
4530-}
4531-}
4532-
4533-void me::CanonicalWindowManagerPolicyCopy::generate_decorations_for(
4534- std::shared_ptr<scene::Session> const& session,
4535- std::shared_ptr<scene::Surface> const& surface,
4536- CanonicalSurfaceInfoMap& surface_map)
4537-{
4538- auto format = mir_pixel_format_xrgb_8888;
4539- ms::SurfaceCreationParameters params;
4540- params.of_size(titlebar_size_for_window(surface->size()))
4541- .of_name("decoration")
4542- .of_pixel_format(format)
4543- .of_buffer_usage(mir::graphics::BufferUsage::software)
4544- .of_position(titlebar_position_for_window(surface->top_left()))
4545- .of_type(mir_surface_type_gloss);
4546- auto id = session->create_surface(params);
4547- auto titlebar = session->surface(id);
4548- titlebar->set_alpha(0.9);
4549-
4550- auto& surface_info = tools->info_for(surface);
4551- surface_info.titlebar = titlebar;
4552- surface_info.children.push_back(titlebar);
4553-
4554- CanonicalSurfaceInfoCopy titlebar_info{session, titlebar, ms::SurfaceCreationParameters{}};
4555- titlebar_info.is_titlebar = true;
4556- titlebar_info.parent = surface;
4557-
4558- paint_titlebar(titlebar, titlebar_info, 0x3F);
4559-
4560- surface_map.emplace(titlebar, std::move(titlebar_info));
4561-}
4562-
4563-void me::CanonicalWindowManagerPolicyCopy::handle_new_surface(std::shared_ptr<ms::Session> const& session, std::shared_ptr<ms::Surface> const& surface)
4564-{
4565- if (auto const parent = surface->parent())
4566- {
4567- tools->info_for(parent).children.push_back(surface);
4568- }
4569-
4570- tools->info_for(session).surfaces++;
4571-
4572- switch (surface->type())
4573- {
4574- case mir_surface_type_normal: /**< AKA "regular" */
4575- case mir_surface_type_utility: /**< AKA "floating" */
4576- case mir_surface_type_dialog:
4577- case mir_surface_type_satellite: /**< AKA "toolbox"/"toolbar" */
4578- case mir_surface_type_freestyle:
4579- case mir_surface_type_menu:
4580- case mir_surface_type_inputmethod: /**< AKA "OSK" or handwriting etc. */
4581- // TODO There's currently no way to insert surfaces into an active (or inactive)
4582- // TODO window tree while keeping the order stable or consistent with spec.
4583- // TODO Nor is there a way to update the "default surface" when appropriate!!
4584- surface->add_observer(std::make_shared<shell::SurfaceReadyObserver>(
4585- [this](std::shared_ptr<scene::Session> const& /*session*/,
4586- std::shared_ptr<scene::Surface> const& surface)
4587- {
4588- select_active_surface(surface);
4589- },
4590- session,
4591- surface));
4592- break;
4593-
4594- case mir_surface_type_gloss:
4595- case mir_surface_type_tip: /**< AKA "tooltip" */
4596- default:
4597- // Cannot have input focus
4598- break;
4599- }
4600-}
4601-
4602-void me::CanonicalWindowManagerPolicyCopy::handle_modify_surface(
4603- std::shared_ptr<scene::Session> const& /*session*/,
4604- std::shared_ptr<scene::Surface> const& surface,
4605- shell::SurfaceSpecification const& modifications)
4606-{
4607- auto& surface_info = tools->info_for(surface);
4608-
4609- #define COPY_IF_SET(field)\
4610- if (modifications.field.is_set())\
4611- surface_info.field = modifications.field
4612-
4613- COPY_IF_SET(min_width);
4614- COPY_IF_SET(min_height);
4615- COPY_IF_SET(max_width);
4616- COPY_IF_SET(max_height);
4617- COPY_IF_SET(min_width);
4618- COPY_IF_SET(width_inc);
4619- COPY_IF_SET(height_inc);
4620- COPY_IF_SET(min_aspect);
4621- COPY_IF_SET(max_aspect);
4622-
4623- #undef COPY_IF_SET
4624-
4625- if (modifications.name.is_set())
4626- surface->rename(modifications.name.value());
4627-
4628- if (modifications.width.is_set() || modifications.height.is_set())
4629- {
4630- auto new_size = surface->size();
4631-
4632- if (modifications.width.is_set())
4633- new_size.width = modifications.width.value();
4634-
4635- if (modifications.height.is_set())
4636- new_size.height = modifications.height.value();
4637-
4638- constrained_resize(
4639- surface,
4640- surface->top_left(),
4641- new_size,
4642- false,
4643- false,
4644- display_area);
4645- }
4646-}
4647-
4648-void me::CanonicalWindowManagerPolicyCopy::handle_delete_surface(std::shared_ptr<ms::Session> const& session, std::weak_ptr<ms::Surface> const& surface)
4649-{
4650- if (auto const parent = tools->info_for(surface).parent.lock())
4651- {
4652- auto& siblings = tools->info_for(parent).children;
4653-
4654- for (auto i = begin(siblings); i != end(siblings); ++i)
4655- {
4656- if (surface.lock() == i->lock())
4657- {
4658- siblings.erase(i);
4659- break;
4660- }
4661- }
4662- }
4663-
4664- if (!--tools->info_for(session).surfaces && session == tools->focused_session())
4665- {
4666- active_surface_.reset();
4667- tools->focus_next_session();
4668- select_active_surface(tools->focused_surface());
4669- }
4670-}
4671-
4672-int me::CanonicalWindowManagerPolicyCopy::handle_set_state(std::shared_ptr<ms::Surface> const& surface, MirSurfaceState value)
4673-{
4674- auto& info = tools->info_for(surface);
4675-
4676- switch (value)
4677- {
4678- case mir_surface_state_restored:
4679- case mir_surface_state_maximized:
4680- case mir_surface_state_vertmaximized:
4681- case mir_surface_state_horizmaximized:
4682- case mir_surface_state_fullscreen:
4683- break;
4684-
4685- default:
4686- return info.state;
4687- }
4688-
4689- if (info.state == mir_surface_state_restored)
4690- {
4691- info.restore_rect = {surface->top_left(), surface->size()};
4692- }
4693-
4694- if (info.state == value)
4695- {
4696- return info.state;
4697- }
4698-
4699- auto const old_pos = surface->top_left();
4700- Displacement movement;
4701-
4702- switch (value)
4703- {
4704- case mir_surface_state_restored:
4705- movement = info.restore_rect.top_left - old_pos;
4706- surface->resize(info.restore_rect.size);
4707- info.titlebar->resize(titlebar_size_for_window(info.restore_rect.size));
4708- info.titlebar->show();
4709- break;
4710-
4711- case mir_surface_state_maximized:
4712- movement = display_area.top_left - old_pos;
4713- surface->resize(display_area.size);
4714- info.titlebar->hide();
4715- break;
4716-
4717- case mir_surface_state_horizmaximized:
4718- movement = Point{display_area.top_left.x, info.restore_rect.top_left.y} - old_pos;
4719- surface->resize({display_area.size.width, info.restore_rect.size.height});
4720- info.titlebar->resize(titlebar_size_for_window({display_area.size.width, info.restore_rect.size.height}));
4721- info.titlebar->show();
4722- break;
4723-
4724- case mir_surface_state_vertmaximized:
4725- movement = Point{info.restore_rect.top_left.x, display_area.top_left.y} - old_pos;
4726- surface->resize({info.restore_rect.size.width, display_area.size.height});
4727- info.titlebar->hide();
4728- break;
4729-
4730- case mir_surface_state_fullscreen:
4731- {
4732- Rectangle rect{old_pos, surface->size()};
4733- display_layout->size_to_output(rect);
4734- movement = rect.top_left - old_pos;
4735- surface->resize(rect.size);
4736- }
4737-
4738- default:
4739- break;
4740- }
4741-
4742- // TODO It is rather simplistic to move a tree WRT the top_left of the root
4743- // TODO when resizing. But for more sophistication we would need to encode
4744- // TODO some sensible layout rules.
4745- move_tree(surface, movement);
4746-
4747- return info.state = value;
4748-}
4749-
4750-void me::CanonicalWindowManagerPolicyCopy::drag(Point cursor)
4751-{
4752- select_active_surface(tools->surface_at(old_cursor));
4753- drag(active_surface(), cursor, old_cursor, display_area);
4754- old_cursor = cursor;
4755-}
4756-
4757-bool me::CanonicalWindowManagerPolicyCopy::handle_keyboard_event(MirKeyboardEvent const* event)
4758-{
4759- auto const action = mir_keyboard_event_action(event);
4760- auto const scan_code = mir_keyboard_event_scan_code(event);
4761- auto const modifiers = mir_keyboard_event_modifiers(event) & modifier_mask;
4762-
4763- if (action == mir_keyboard_action_down && scan_code == KEY_F11)
4764- {
4765- switch (modifiers)
4766- {
4767- case mir_input_event_modifier_alt:
4768- toggle(mir_surface_state_maximized);
4769- return true;
4770-
4771- case mir_input_event_modifier_shift:
4772- toggle(mir_surface_state_vertmaximized);
4773- return true;
4774-
4775- case mir_input_event_modifier_ctrl:
4776- toggle(mir_surface_state_horizmaximized);
4777- return true;
4778-
4779- default:
4780- break;
4781- }
4782- }
4783- else if (action == mir_keyboard_action_down && scan_code == KEY_F4)
4784- {
4785- if (auto const session = tools->focused_session())
4786- {
4787- switch (modifiers)
4788- {
4789- case mir_input_event_modifier_alt:
4790- kill(session->process_id(), SIGTERM);
4791- return true;
4792-
4793- case mir_input_event_modifier_ctrl:
4794- if (auto const surf = session->default_surface())
4795- {
4796- surf->request_client_surface_close();
4797- return true;
4798- }
4799-
4800- default:
4801- break;
4802- }
4803- }
4804- }
4805- else if (action == mir_keyboard_action_down &&
4806- modifiers == mir_input_event_modifier_alt &&
4807- scan_code == KEY_TAB)
4808- {
4809- tools->focus_next_session();
4810- if (auto const surface = tools->focused_surface())
4811- select_active_surface(surface);
4812-
4813- return true;
4814- }
4815- else if (action == mir_keyboard_action_down &&
4816- modifiers == mir_input_event_modifier_alt &&
4817- scan_code == KEY_GRAVE)
4818- {
4819- if (auto const prev = tools->focused_surface())
4820- {
4821- if (auto const app = tools->focused_session())
4822- select_active_surface(app->surface_after(prev));
4823- }
4824-
4825- return true;
4826- }
4827-
4828- return false;
4829-}
4830-
4831-bool me::CanonicalWindowManagerPolicyCopy::handle_touch_event(MirTouchEvent const* event)
4832-{
4833- auto const count = mir_touch_event_point_count(event);
4834-
4835- long total_x = 0;
4836- long total_y = 0;
4837-
4838- for (auto i = 0U; i != count; ++i)
4839- {
4840- total_x += mir_touch_event_axis_value(event, i, mir_touch_axis_x);
4841- total_y += mir_touch_event_axis_value(event, i, mir_touch_axis_y);
4842- }
4843-
4844- Point const cursor{total_x/count, total_y/count};
4845-
4846- bool is_drag = true;
4847- for (auto i = 0U; i != count; ++i)
4848- {
4849- switch (mir_touch_event_action(event, i))
4850- {
4851- case mir_touch_action_up:
4852- return false;
4853-
4854- case mir_touch_action_down:
4855- is_drag = false;
4856-
4857- case mir_touch_action_change:
4858- continue;
4859- }
4860- }
4861-
4862- if (is_drag && count == 3)
4863- {
4864- drag(cursor);
4865- return true;
4866- }
4867- else
4868- {
4869- click(cursor);
4870- return false;
4871- }
4872-}
4873-
4874-bool me::CanonicalWindowManagerPolicyCopy::handle_pointer_event(MirPointerEvent const* event)
4875-{
4876- auto const action = mir_pointer_event_action(event);
4877- auto const modifiers = mir_pointer_event_modifiers(event) & modifier_mask;
4878- Point const cursor{
4879- mir_pointer_event_axis_value(event, mir_pointer_axis_x),
4880- mir_pointer_event_axis_value(event, mir_pointer_axis_y)};
4881-
4882- if (action == mir_pointer_action_button_down)
4883- {
4884- click(cursor);
4885- return false;
4886- }
4887- else if (action == mir_pointer_action_motion &&
4888- modifiers == mir_input_event_modifier_alt)
4889- {
4890- if (mir_pointer_event_button_state(event, mir_pointer_button_primary))
4891- {
4892- drag(cursor);
4893- return true;
4894- }
4895-
4896- if (mir_pointer_event_button_state(event, mir_pointer_button_tertiary))
4897- {
4898- resize(cursor);
4899- return true;
4900- }
4901- }
4902- else if (action == mir_pointer_action_motion && !modifiers)
4903- {
4904- if (mir_pointer_event_button_state(event, mir_pointer_button_primary))
4905- {
4906- if (auto const possible_titlebar = tools->surface_at(old_cursor))
4907- {
4908- if (tools->info_for(possible_titlebar).is_titlebar)
4909- {
4910- drag(cursor);
4911- return true;
4912- }
4913- }
4914- }
4915- }
4916-
4917- return false;
4918-}
4919-
4920-void me::CanonicalWindowManagerPolicyCopy::toggle(MirSurfaceState state)
4921-{
4922- if (auto const surface = active_surface())
4923- {
4924- auto& info = tools->info_for(surface);
4925-
4926- if (info.state == state)
4927- state = mir_surface_state_restored;
4928-
4929- auto const value = handle_set_state(surface, MirSurfaceState(state));
4930- surface->configure(mir_surface_attrib_state, value);
4931- }
4932-}
4933-
4934-void me::CanonicalWindowManagerPolicyCopy::select_active_surface(std::shared_ptr<ms::Surface> const& surface)
4935-{
4936- if (surface == active_surface_.lock())
4937- return;
4938-
4939- if (!surface)
4940- {
4941- if (auto const active_surface = active_surface_.lock())
4942- {
4943- if (auto const titlebar = tools->info_for(active_surface).titlebar)
4944- {
4945- paint_titlebar(titlebar, tools->info_for(titlebar), 0x3F);
4946- }
4947- }
4948-
4949- if (active_surface_.lock())
4950- tools->set_focus_to({}, {});
4951-
4952- active_surface_.reset();
4953- return;
4954- }
4955-
4956- auto const& info_for = tools->info_for(surface);
4957-
4958- switch (surface->type())
4959- {
4960- case mir_surface_type_normal: /**< AKA "regular" */
4961- case mir_surface_type_utility: /**< AKA "floating" */
4962- case mir_surface_type_dialog:
4963- case mir_surface_type_satellite: /**< AKA "toolbox"/"toolbar" */
4964- case mir_surface_type_freestyle:
4965- case mir_surface_type_menu:
4966- case mir_surface_type_inputmethod: /**< AKA "OSK" or handwriting etc. */
4967- if (auto const active_surface = active_surface_.lock())
4968- {
4969- if (auto const titlebar = tools->info_for(active_surface).titlebar)
4970- {
4971- paint_titlebar(titlebar, tools->info_for(titlebar), 0x3F);
4972- }
4973- }
4974- if (auto const titlebar = tools->info_for(surface).titlebar)
4975- {
4976- paint_titlebar(titlebar, tools->info_for(titlebar), 0xFF);
4977- }
4978- tools->set_focus_to(info_for.session.lock(), surface);
4979- raise_tree(surface);
4980- active_surface_ = surface;
4981- break;
4982-
4983- case mir_surface_type_gloss:
4984- case mir_surface_type_tip: /**< AKA "tooltip" */
4985- default:
4986- // Cannot have input focus - try the parent
4987- if (auto const parent = info_for.parent.lock())
4988- select_active_surface(parent);
4989- break;
4990- }
4991-}
4992-
4993-auto me::CanonicalWindowManagerPolicyCopy::active_surface() const
4994--> std::shared_ptr<ms::Surface>
4995-{
4996- if (auto const surface = active_surface_.lock())
4997- return surface;
4998-
4999- if (auto const session = tools->focused_session())
5000- {
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches