Mir

Merge lp:~mir-team/mir/PD-demo into lp:mir/ubuntu

Proposed by Cemil Azizoglu
Status: Superseded
Proposed branch: lp:~mir-team/mir/PD-demo
Merge into: lp:mir/ubuntu
Diff against target: 31258 lines (+13164/-5474)
547 files modified
3rd_party/CMakeLists.txt (+0/-8)
3rd_party/android-input/CMakeLists.txt (+1/-1)
3rd_party/android-input/android/CMakeLists.txt (+1/-1)
3rd_party/android-input/android/frameworks/base/services/input/EventHub.h (+1/-1)
3rd_party/android-input/android/frameworks/base/services/input/InputTransport.cpp (+1/-5)
3rd_party/android-input/android/frameworks/native/libs/utils/Timers.cpp (+4/-30)
3rd_party/xcursor/CMakeLists.txt (+0/-11)
CMakeLists.txt (+3/-5)
benchmarks/frame-uniformity/touch_producing_server.cpp (+0/-1)
benchmarks/frame-uniformity/vsync_simulating_graphics_platform.cpp (+14/-14)
benchmarks/frame-uniformity/vsync_simulating_graphics_platform.h (+5/-4)
cmake/PrePush.cmake (+0/-122)
debian/changelog (+6/-0)
debian/control (+11/-10)
debian/libmirserver36.install (+1/-1)
debian/mir-client-platform-mesa-dev.install (+0/-1)
debian/mir-platform-graphics-android7.install (+1/-1)
debian/mir-platform-graphics-mesa-kms7.install (+1/-1)
debian/mir-platform-graphics-mesa-x7.install (+1/-1)
debian/mir-platform-input-evdev4.install (+1/-1)
debian/mir-test-tools.install (+1/-1)
doc/building_source_for_arm.md (+20/-2)
examples/CMakeLists.txt (+30/-0)
examples/client_helpers.cpp (+76/-8)
examples/client_helpers.h (+29/-3)
examples/cursor-theme-dump.cpp (+127/-0)
examples/fingerpaint.c (+26/-5)
examples/multi_stream.cpp (+283/-0)
examples/render_surfaces.cpp (+1/-1)
examples/server_example.cpp (+2/-0)
examples/server_example_basic_window_manager.h (+49/-0)
examples/server_example_canonical_surface_info.cpp (+404/-0)
examples/server_example_canonical_surface_info.h (+91/-0)
examples/server_example_canonical_window_manager.cpp (+12/-322)
examples/server_example_canonical_window_manager.h (+5/-50)
examples/server_example_cursor_images.cpp (+57/-0)
examples/server_example_cursor_images.h (+33/-0)
examples/server_example_tiling_window_manager.cpp (+10/-10)
examples/server_example_tiling_window_manager.h (+9/-14)
examples/server_example_window_management.cpp (+8/-3)
examples/xcursor_loader.cpp (+12/-6)
examples/xcursor_loader.h (+5/-2)
include/client/mir/events/event_builders.h (+6/-1)
include/client/mir_toolkit/events/input/keyboard_event.h (+9/-0)
include/client/mir_toolkit/events/input/pointer_event.h (+9/-0)
include/client/mir_toolkit/events/input/touch_event.h (+10/-0)
include/client/mir_toolkit/events/surface_output_event.h (+9/-0)
include/client/mir_toolkit/mir_buffer_stream.h (+4/-2)
include/client/mir_toolkit/mir_input_device.h (+56/-0)
include/client/mir_toolkit/mir_surface.h (+8/-0)
include/common/mir/assert_module_entry_point.h (+34/-0)
include/common/mir/optional_value.h (+15/-2)
include/cookie/mir/cookie_factory.h (+1/-1)
include/platform/mir/graphics/display.h (+0/-1)
include/platform/mir/graphics/display_configuration.h (+5/-1)
include/platform/mir/graphics/egl_extensions.h (+9/-0)
include/platform/mir/graphics/egl_sync_fence.h (+82/-0)
include/platform/mir/graphics/platform.h (+9/-9)
include/platform/mir/input/event_builder.h (+3/-5)
include/platform/mir/input/input_device.h (+11/-0)
include/platform/mir/input/input_sink.h (+0/-5)
include/platform/mir/input/platform.h (+2/-2)
include/platform/mir/input/pointer_settings.h (+58/-0)
include/platform/mir/input/touchpad_settings.h (+46/-0)
include/renderers/gl/mir/renderer/gl/texture_source.h (+2/-0)
include/server/mir/frontend/session_mediator_report.h (+2/-0)
include/server/mir/input/device.h (+9/-2)
include/server/mir/input/pointer_configuration.h (+71/-0)
include/server/mir/input/touchpad_configuration.h (+82/-0)
include/server/mir/scene/depth_id.h (+0/-34)
include/server/mir/scene/session.h (+1/-0)
include/server/mir/scene/surface_coordinator.h (+0/-2)
include/server/mir/scene/surface_creation_parameters.h (+0/-4)
include/server/mir/server.h (+6/-6)
include/server/mir/shell/abstract_shell.h (+9/-0)
include/server/mir/shell/display_configuration_controller.h (+1/-1)
include/server/mir/shell/display_layout.h (+4/-2)
include/server/mir/shell/shell.h (+6/-0)
include/server/mir/shell/shell_report.h (+89/-0)
include/server/mir/shell/shell_wrapper.h (+5/-0)
include/server/mir/shell/surface_specification.h (+2/-2)
include/server/mir/shell/system_compositor_window_manager.h (+15/-1)
include/server/mir/shell/window_manager.h (+5/-0)
include/test/mir/test/doubles/mock_display_configuration.h (+57/-0)
include/test/mir/test/doubles/mock_egl.h (+4/-0)
include/test/mir/test/doubles/mock_window_manager.h (+2/-0)
include/test/mir/test/doubles/null_display_configuration.h (+4/-0)
include/test/mir/test/doubles/null_platform.h (+6/-5)
include/test/mir/test/doubles/stub_display_configuration.h (+16/-2)
include/test/mir/test/doubles/stub_session.h (+92/-0)
include/test/mir/test/doubles/stub_surface.h (+77/-0)
include/test/mir/test/event_matchers.h (+11/-3)
include/test/mir/test/wait_condition.h (+8/-3)
include/test/mir_test_framework/async_server_runner.h (+1/-3)
include/test/mir_test_framework/connected_client_with_a_surface.h (+3/-0)
include/test/mir_test_framework/declarative_placement_window_manage_policy.h (+0/-4)
include/test/mir_test_framework/executable_path.h (+1/-0)
include/test/mir_test_framework/placement_applying_shell.h (+1/-5)
playground/demo-shell/default_window_manager.cpp (+10/-2)
playground/demo-shell/default_window_manager.h (+5/-0)
playground/demo-shell/demo_renderer.cpp (+0/-4)
playground/demo-shell/demo_shell.cpp (+1/-5)
src/CMakeLists.txt (+1/-0)
src/client/CMakeLists.txt (+1/-0)
src/client/buffer_stream.cpp (+34/-12)
src/client/buffer_stream.h (+4/-2)
src/client/buffer_vault.h (+1/-1)
src/client/default_client_buffer_stream_factory.cpp (+14/-4)
src/client/default_client_buffer_stream_factory.h (+1/-1)
src/client/event.cpp (+6/-0)
src/client/events/event_builders.cpp (+36/-1)
src/client/input/android/android_input_receiver.cpp (+22/-23)
src/client/input/android/android_input_receiver.h (+2/-3)
src/client/input/input_event.cpp (+34/-0)
src/client/mir_surface.cpp (+19/-0)
src/client/mir_surface.h (+2/-0)
src/client/mir_surface_api.cpp (+15/-0)
src/client/mirclient.pc.in (+1/-1)
src/client/rpc/CMakeLists.txt (+2/-0)
src/client/rpc/mir_display_server.cpp (+7/-0)
src/client/rpc/mir_display_server.h (+4/-0)
src/client/symbols.map (+20/-0)
src/common/dispatch/threaded_dispatcher.cpp (+2/-0)
src/common/graphics/android/CMakeLists.txt (+1/-0)
src/common/graphics/android/android_native_buffer.cpp (+15/-1)
src/common/logging/input_timestamp.cpp (+6/-12)
src/cookie/CMakeLists.txt (+1/-1)
src/cookie/cookie_factory.cpp (+1/-3)
src/cookie/mircookie.pc.in (+0/-1)
src/gl/recently_used_cache.cpp (+10/-6)
src/include/common/mir/events/event_private.h (+1/-0)
src/include/common/mir/graphics/android/android_native_buffer.h (+6/-0)
src/include/common/mir/graphics/android/native_buffer.h (+3/-0)
src/include/common/mir/protobuf/display_server.h (+4/-0)
src/include/platform/mir/emergency_cleanup_registry.h (+4/-1)
src/include/platform/mir/options/configuration.h (+1/-0)
src/include/server/mir/default_server_configuration.h (+10/-14)
src/include/server/mir/frontend/client_buffers.h (+2/-0)
src/include/server/mir/frontend/display_changer.h (+3/-1)
src/include/server/mir/frontend/security_check_failed.h (+34/-0)
src/include/server/mir/frontend/shell.h (+5/-0)
src/include/server/mir/frontend/template_protobuf_message_processor.h (+5/-0)
src/include/server/mir/input/input_probe.h (+48/-0)
src/include/server/mir/shell/basic_window_manager.h (+49/-0)
src/include/server/mir/shell/canonical_window_manager.h (+4/-0)
src/platform/graphics/CMakeLists.txt (+1/-0)
src/platform/graphics/egl_extensions.cpp (+19/-10)
src/platform/graphics/egl_sync_fence.cpp (+93/-0)
src/platform/graphics/platform_probe.cpp (+5/-1)
src/platform/options/default_configuration.cpp (+3/-0)
src/platform/symbols.map (+15/-0)
src/platforms/CMakeLists.txt (+13/-6)
src/platforms/android/client/CMakeLists.txt (+3/-1)
src/platforms/android/client/client_platform_factory.cpp (+3/-0)
src/platforms/android/client/gralloc_registrar.cpp (+3/-1)
src/platforms/android/server/CMakeLists.txt (+4/-1)
src/platforms/android/server/android_alloc_adaptor.cpp (+12/-5)
src/platforms/android/server/android_alloc_adaptor.h (+6/-2)
src/platforms/android/server/android_buffer_allocator.cpp (+27/-16)
src/platforms/android/server/android_graphic_buffer_allocator.h (+5/-1)
src/platforms/android/server/buffer.cpp (+7/-4)
src/platforms/android/server/buffer.h (+1/-0)
src/platforms/android/server/cmdstream_sync_factory.h (+48/-0)
src/platforms/android/server/device_quirks.cpp (+9/-9)
src/platforms/android/server/device_quirks.h (+2/-2)
src/platforms/android/server/display.cpp (+1/-1)
src/platforms/android/server/display_buffer.cpp (+3/-0)
src/platforms/android/server/display_component_factory.h (+2/-0)
src/platforms/android/server/display_configuration.cpp (+6/-1)
src/platforms/android/server/display_configuration.h (+1/-0)
src/platforms/android/server/display_device.h (+2/-0)
src/platforms/android/server/display_name.h (+11/-1)
src/platforms/android/server/egl_sync_factory.cpp (+34/-0)
src/platforms/android/server/fb_device.cpp (+6/-3)
src/platforms/android/server/fb_device.h (+1/-0)
src/platforms/android/server/hal_component_factory.cpp (+15/-0)
src/platforms/android/server/hal_component_factory.h (+3/-1)
src/platforms/android/server/hwc_blanking_control.cpp (+1/-1)
src/platforms/android/server/hwc_device.cpp (+11/-6)
src/platforms/android/server/hwc_device.h (+1/-0)
src/platforms/android/server/hwc_fb_device.cpp (+5/-0)
src/platforms/android/server/hwc_fb_device.h (+1/-0)
src/platforms/android/server/ipc_operations.cpp (+1/-0)
src/platforms/android/server/platform.cpp (+52/-34)
src/platforms/android/server/platform.h (+9/-5)
src/platforms/android/server/real_hwc_wrapper.cpp (+12/-12)
src/platforms/android/server/symbols.map.in (+1/-1)
src/platforms/common/client/mir/CMakeLists.txt (+1/-1)
src/platforms/evdev/CMakeLists.txt (+2/-3)
src/platforms/evdev/button_utils.cpp (+44/-0)
src/platforms/evdev/button_utils.h (+36/-0)
src/platforms/evdev/evdev_device_detection.cpp (+13/-12)
src/platforms/evdev/libinput_device.cpp (+127/-45)
src/platforms/evdev/libinput_device.h (+6/-1)
src/platforms/evdev/libinput_device_ptr.cpp (+8/-3)
src/platforms/evdev/libinput_device_ptr.h (+10/-2)
src/platforms/evdev/libinput_ptr.cpp (+13/-1)
src/platforms/evdev/platform.cpp (+2/-1)
src/platforms/evdev/platform_factory.cpp (+6/-1)
src/platforms/input_platform_symbols.map.in (+1/-1)
src/platforms/mesa/CMakeLists.txt (+1/-10)
src/platforms/mesa/client/CMakeLists.txt (+1/-1)
src/platforms/mesa/client/client_platform.cpp (+0/-16)
src/platforms/mesa/client/client_platform_factory.cpp (+14/-0)
src/platforms/mesa/mir-client-platform-mesa-dev.pc.in (+0/-7)
src/platforms/mesa/server/common/gbm_buffer.cpp (+4/-0)
src/platforms/mesa/server/common/gbm_buffer.h (+1/-0)
src/platforms/mesa/server/common/shm_buffer.cpp (+4/-0)
src/platforms/mesa/server/common/shm_buffer.h (+1/-0)
src/platforms/mesa/server/kms/CMakeLists.txt (+5/-1)
src/platforms/mesa/server/kms/display.cpp (+23/-18)
src/platforms/mesa/server/kms/display.h (+17/-4)
src/platforms/mesa/server/kms/display_buffer.cpp (+10/-7)
src/platforms/mesa/server/kms/display_buffer.h (+7/-3)
src/platforms/mesa/server/kms/guest_platform.cpp (+11/-19)
src/platforms/mesa/server/kms/guest_platform.h (+4/-5)
src/platforms/mesa/server/kms/platform.cpp (+29/-198)
src/platforms/mesa/server/kms/platform.h (+5/-6)
src/platforms/mesa/server/kms/platform_symbols.cpp (+208/-0)
src/platforms/mesa/server/kms/real_kms_display_configuration.cpp (+5/-0)
src/platforms/mesa/server/kms/real_kms_display_configuration.h (+1/-0)
src/platforms/mesa/server/kms/symbols.map.in (+1/-1)
src/platforms/mesa/server/x11/CMakeLists.txt (+12/-5)
src/platforms/mesa/server/x11/X11_resources.cpp (+3/-2)
src/platforms/mesa/server/x11/graphics/CMakeLists.txt (+6/-1)
src/platforms/mesa/server/x11/graphics/display.cpp (+1/-1)
src/platforms/mesa/server/x11/graphics/display_configuration.cpp (+12/-0)
src/platforms/mesa/server/x11/graphics/display_configuration.h (+2/-0)
src/platforms/mesa/server/x11/graphics/graphics.cpp (+12/-5)
src/platforms/mesa/server/x11/graphics/guest_platform.cpp (+5/-5)
src/platforms/mesa/server/x11/graphics/guest_platform.h (+4/-4)
src/platforms/mesa/server/x11/graphics/platform.cpp (+6/-6)
src/platforms/mesa/server/x11/graphics/platform.h (+3/-3)
src/platforms/mesa/server/x11/input/CMakeLists.txt (+6/-1)
src/platforms/mesa/server/x11/input/input.cpp (+15/-3)
src/platforms/mesa/server/x11/input/input_device.cpp (+32/-1)
src/platforms/mesa/server/x11/input/input_device.h (+8/-0)
src/platforms/mesa/server/x11/input/input_platform.cpp (+66/-69)
src/platforms/mesa/server/x11/symbols.map.in (+2/-2)
src/protobuf/mir_protobuf.proto (+10/-0)
src/protobuf/symbols.map (+40/-0)
src/renderers/gl/renderer.cpp (+48/-11)
src/server/CMakeLists.txt (+1/-2)
src/server/compositor/buffer_map.cpp (+38/-5)
src/server/compositor/buffer_map.h (+15/-4)
src/server/compositor/buffer_stream_factory.cpp (+18/-6)
src/server/compositor/dropping_schedule.cpp (+5/-2)
src/server/compositor/dropping_schedule.h (+1/-1)
src/server/compositor/multi_monitor_arbiter.cpp (+23/-7)
src/server/compositor/multi_monitor_arbiter.h (+2/-0)
src/server/compositor/queueing_schedule.cpp (+2/-2)
src/server/compositor/queueing_schedule.h (+1/-1)
src/server/compositor/schedule.h (+1/-1)
src/server/compositor/stream.cpp (+42/-4)
src/server/compositor/stream.h (+17/-1)
src/server/default_emergency_cleanup.cpp (+11/-2)
src/server/default_emergency_cleanup.h (+2/-1)
src/server/frontend/CMakeLists.txt (+1/-0)
src/server/frontend/default_configuration.cpp (+3/-1)
src/server/frontend/default_ipc_factory.cpp (+7/-3)
src/server/frontend/default_ipc_factory.h (+7/-1)
src/server/frontend/protobuf_message_processor.cpp (+9/-0)
src/server/frontend/security_check_failed.cpp (+24/-0)
src/server/frontend/session_mediator.cpp (+80/-29)
src/server/frontend/session_mediator.h (+19/-1)
src/server/frontend/shell_wrapper.cpp (+8/-0)
src/server/frontend/shell_wrapper.h (+5/-0)
src/server/frontend/socket_connection.cpp (+3/-1)
src/server/frontend/unauthorized_display_changer.cpp (+7/-2)
src/server/frontend/unauthorized_display_changer.h (+2/-1)
src/server/graphics/default_configuration.cpp (+2/-6)
src/server/graphics/nested/display.cpp (+76/-52)
src/server/graphics/nested/display.h (+2/-0)
src/server/graphics/nested/nested_display_configuration.cpp (+29/-0)
src/server/graphics/nested/nested_display_configuration.h (+3/-1)
src/server/graphics/offscreen/display_configuration.cpp (+4/-0)
src/server/graphics/offscreen/display_configuration.h (+1/-0)
src/server/input/CMakeLists.txt (+11/-12)
src/server/input/android/input_translator.cpp (+19/-6)
src/server/input/android/input_translator.h (+7/-1)
src/server/input/black_arrow.c (+0/-480)
src/server/input/builtin_cursor_images.cpp (+21/-13)
src/server/input/builtin_cursor_images.h (+0/-10)
src/server/input/default-theme.h (+1131/-0)
src/server/input/default_configuration.cpp (+24/-60)
src/server/input/default_device.cpp (+82/-3)
src/server/input/default_device.h (+22/-4)
src/server/input/default_event_builder.cpp (+28/-16)
src/server/input/default_event_builder.h (+13/-9)
src/server/input/default_input_device_hub.cpp (+40/-67)
src/server/input/default_input_device_hub.h (+21/-12)
src/server/input/input_modifier_utils.cpp (+4/-18)
src/server/input/input_modifier_utils.h (+2/-6)
src/server/input/input_probe.cpp (+104/-0)
src/server/input/key_repeat_dispatcher.cpp (+5/-1)
src/server/input/key_repeat_dispatcher.h (+7/-1)
src/server/input/seat.cpp (+174/-0)
src/server/input/seat.h (+80/-0)
src/server/input/surface_input_dispatcher.cpp (+4/-2)
src/server/input/validator.cpp (+2/-1)
src/server/report/default_server_configuration.cpp (+10/-0)
src/server/report/logging/CMakeLists.txt (+4/-1)
src/server/report/logging/logging_report_factory.cpp (+5/-0)
src/server/report/logging/session_mediator_report.cpp (+5/-0)
src/server/report/logging/session_mediator_report.h (+2/-0)
src/server/report/logging/shell_report.cpp (+127/-0)
src/server/report/logging/shell_report.h (+84/-0)
src/server/report/logging_report_factory.h (+1/-0)
src/server/report/lttng/lttng_report_factory.cpp (+4/-1)
src/server/report/lttng/session_mediator_report.cpp (+1/-0)
src/server/report/lttng/session_mediator_report.h (+1/-0)
src/server/report/lttng/session_mediator_report_tp.h (+1/-0)
src/server/report/lttng_report_factory.h (+1/-0)
src/server/report/null/CMakeLists.txt (+3/-1)
src/server/report/null/null_report_factory.cpp (+6/-0)
src/server/report/null/session_mediator_report.cpp (+4/-0)
src/server/report/null/session_mediator_report.h (+2/-0)
src/server/report/null/shell_report.cpp (+90/-0)
src/server/report/null/shell_report.h (+79/-0)
src/server/report/null_report_factory.h (+1/-0)
src/server/report/report_factory.h (+2/-0)
src/server/scene/application_session.cpp (+28/-2)
src/server/scene/application_session.h (+1/-0)
src/server/scene/basic_surface.cpp (+1/-1)
src/server/scene/mediating_display_changer.cpp (+24/-38)
src/server/scene/mediating_display_changer.h (+3/-3)
src/server/scene/output_properties_cache.cpp (+3/-2)
src/server/scene/output_properties_cache.h (+2/-4)
src/server/scene/surface_controller.cpp (+1/-2)
src/server/scene/surface_controller.h (+0/-1)
src/server/scene/surface_creation_parameters.cpp (+1/-10)
src/server/scene/surface_event_source.cpp (+3/-1)
src/server/scene/surface_stack.cpp (+62/-92)
src/server/scene/surface_stack.h (+1/-4)
src/server/scene/surface_stack_model.h (+0/-2)
src/server/server.cpp (+2/-17)
src/server/shell/CMakeLists.txt (+3/-0)
src/server/shell/abstract_shell.cpp (+56/-16)
src/server/shell/canonical_window_manager.cpp (+9/-0)
src/server/shell/default_configuration.cpp (+1/-0)
src/server/shell/frontend_shell.cpp (+10/-0)
src/server/shell/frontend_shell.h (+5/-0)
src/server/shell/graphics_display_layout.cpp (+2/-6)
src/server/shell/graphics_display_layout.h (+4/-4)
src/server/shell/shell_wrapper.cpp (+8/-0)
src/server/shell/surface_specification.cpp (+49/-0)
src/server/shell/system_compositor_window_manager.cpp (+52/-2)
src/server/symbols.map (+110/-56)
tests/acceptance-tests/CMakeLists.txt (+2/-1)
tests/acceptance-tests/test_buffer_stream_arrangement.cpp (+47/-15)
tests/acceptance-tests/test_client_cookie.cpp (+186/-0)
tests/acceptance-tests/test_client_input.cpp (+1/-5)
tests/acceptance-tests/test_client_surface_events.cpp (+7/-3)
tests/acceptance-tests/test_debug_api.cpp (+1/-0)
tests/acceptance-tests/test_display_configuration.cpp (+4/-4)
tests/acceptance-tests/test_latency.cpp (+34/-1)
tests/acceptance-tests/test_nested_mir.cpp (+94/-82)
tests/acceptance-tests/test_session_mediator_report.cpp (+1/-0)
tests/acceptance-tests/test_surface_raise.cpp (+210/-0)
tests/acceptance-tests/test_system_compositor_window_manager.cpp (+1/-1)
tests/acceptance-tests/throwback/test_client_cursor_api.cpp (+1/-2)
tests/include/mir/test/doubles/mock_android_native_buffer.h (+2/-0)
tests/include/mir/test/doubles/mock_buffer.h (+1/-0)
tests/include/mir/test/doubles/mock_buffer_bundle.h (+3/-1)
tests/include/mir/test/doubles/mock_buffer_stream.h (+2/-0)
tests/include/mir/test/doubles/mock_display_changer.h (+12/-3)
tests/include/mir/test/doubles/mock_display_device.h (+3/-0)
tests/include/mir/test/doubles/mock_drm.h (+5/-0)
tests/include/mir/test/doubles/mock_gl.h (+1/-0)
tests/include/mir/test/doubles/mock_gl_buffer.h (+1/-0)
tests/include/mir/test/doubles/mock_option.h (+45/-0)
tests/include/mir/test/doubles/mock_scene_session.h (+1/-0)
tests/include/mir/test/doubles/mock_shell.h (+2/-0)
tests/include/mir/test/doubles/mock_surface_coordinator.h (+2/-2)
tests/include/mir/test/doubles/mock_x11.h (+6/-4)
tests/include/mir/test/doubles/null_display_changer.h (+10/-3)
tests/include/mir/test/doubles/null_emergency_cleanup.h (+1/-0)
tests/include/mir/test/doubles/platform_factory.h (+0/-46)
tests/include/mir/test/doubles/stub_android_native_buffer.h (+3/-0)
tests/include/mir/test/doubles/stub_cmdstream_sync_factory.h (+41/-0)
tests/include/mir/test/doubles/stub_display_builder.h (+6/-1)
tests/include/mir/test/doubles/stub_display_server.h (+4/-0)
tests/include/mir/test/doubles/stub_gl_buffer.h (+1/-0)
tests/include/mir/test/doubles/stub_scene_session.h (+4/-0)
tests/include/mir/test/gmock_fixes.h (+23/-0)
tests/integration-tests/CMakeLists.txt (+2/-4)
tests/integration-tests/graphics/android/test_android_hardware_sanity.cpp (+4/-0)
tests/integration-tests/graphics/mesa/CMakeLists.txt (+75/-71)
tests/integration-tests/graphics/mesa/test_buffer_integration.cpp (+4/-2)
tests/integration-tests/session_management.cpp (+4/-6)
tests/integration-tests/test_buffer_scheduling.cpp (+429/-187)
tests/integration-tests/test_client_screencast.cpp (+1/-1)
tests/integration-tests/test_display_info.cpp (+2/-2)
tests/integration-tests/test_exchange_buffer.cpp (+28/-33)
tests/integration-tests/test_large_messages.cpp (+1/-1)
tests/integration-tests/test_surface_stack_with_compositor.cpp (+7/-7)
tests/integration-tests/test_surfaceloop.cpp (+4/-4)
tests/mir_test/display_config_matchers.cpp (+12/-0)
tests/mir_test_doubles/CMakeLists.txt (+0/-1)
tests/mir_test_doubles/mock_drm.cpp (+23/-0)
tests/mir_test_doubles/mock_egl.cpp (+27/-0)
tests/mir_test_doubles/mock_gl.cpp (+7/-0)
tests/mir_test_doubles/mock_x11.cpp (+5/-1)
tests/mir_test_doubles/platform_factory.cpp (+0/-73)
tests/mir_test_framework/CMakeLists.txt (+6/-1)
tests/mir_test_framework/async_server_runner.cpp (+5/-4)
tests/mir_test_framework/connected_client_with_a_surface.cpp (+1/-1)
tests/mir_test_framework/declarative_placement_window_manage_policy.cpp (+1/-7)
tests/mir_test_framework/executable_path.cpp (+10/-0)
tests/mir_test_framework/fake_input_device_impl.cpp (+52/-33)
tests/mir_test_framework/fake_input_device_impl.h (+7/-1)
tests/mir_test_framework/fake_input_server_configuration.cpp (+0/-1)
tests/mir_test_framework/headless_in_process_server.cpp (+2/-0)
tests/mir_test_framework/input_testing_server_options.cpp (+0/-1)
tests/mir_test_framework/placement_applying_shell.cpp (+5/-10)
tests/mir_test_framework/platform_graphics_dummy.cpp (+3/-0)
tests/mir_test_framework/stub_input.cpp (+7/-2)
tests/mir_test_framework/stub_input_platform.cpp (+1/-1)
tests/mir_test_framework/stub_session.cpp (+140/-0)
tests/mir_test_framework/stub_surface.cpp (+206/-0)
tests/mir_test_framework/stubbed_graphics_platform.cpp (+72/-18)
tests/mir_test_framework/stubbed_graphics_platform.h (+5/-5)
tests/mir_test_framework/symbols-server.map.in (+1/-1)
tests/mir_test_framework/udev_recordings/laptop-keyboard-hello.evemu (+5/-81)
tests/mir_test_framework/udev_recordings/laptop-mouse-click.evemu (+136/-0)
tests/mir_test_framework/udev_recordings/laptop-mouse-motion.evemu (+153/-0)
tests/mir_test_framework/udev_recordings/laptop-mouse.ioctl (+22/-0)
tests/mir_test_framework/udev_recordings/laptop-mouse.umockdev (+128/-0)
tests/performance-tests/test_glmark2-es2-mir.cpp (+0/-9)
tests/umock-acceptance-tests/CMakeLists.txt (+1/-0)
tests/umock-acceptance-tests/test_libinput.cpp (+8/-14)
tests/unit-tests/CMakeLists.txt (+16/-35)
tests/unit-tests/client/android/CMakeLists.txt (+0/-1)
tests/unit-tests/client/input/test_android_input_receiver.cpp (+4/-46)
tests/unit-tests/client/mesa/CMakeLists.txt (+0/-1)
tests/unit-tests/client/test_client_buffer_stream.cpp (+64/-20)
tests/unit-tests/client/test_client_platform.cpp (+1/-1)
tests/unit-tests/client/test_probing_client_platform_factory.cpp (+1/-1)
tests/unit-tests/compositor/test_client_buffers.cpp (+53/-0)
tests/unit-tests/compositor/test_dropping_schedule.cpp (+4/-2)
tests/unit-tests/compositor/test_multi_monitor_arbiter.cpp (+36/-2)
tests/unit-tests/compositor/test_queueing_schedule.cpp (+5/-5)
tests/unit-tests/compositor/test_stream.cpp (+119/-1)
tests/unit-tests/dispatch/test_threaded_dispatcher.cpp (+1/-1)
tests/unit-tests/frontend/test_session_mediator.cpp (+156/-53)
tests/unit-tests/frontend/test_unauthorized_display_changer.cpp (+2/-2)
tests/unit-tests/gl/test_gl_texture_cache.cpp (+3/-1)
tests/unit-tests/gl/test_program_factory.cpp (+1/-1)
tests/unit-tests/graphics/CMakeLists.txt (+1/-2)
tests/unit-tests/graphics/android/CMakeLists.txt (+2/-0)
tests/unit-tests/graphics/android/test_android_alloc_adaptor.cpp (+2/-1)
tests/unit-tests/graphics/android/test_android_buffer_allocator.cpp (+6/-2)
tests/unit-tests/graphics/android/test_buffer_tex_bind.cpp (+14/-1)
tests/unit-tests/graphics/android/test_device_detection.cpp (+9/-9)
tests/unit-tests/graphics/android/test_display.cpp (+26/-18)
tests/unit-tests/graphics/android/test_display_buffer.cpp (+15/-0)
tests/unit-tests/graphics/android/test_display_generic.cpp (+75/-0)
tests/unit-tests/graphics/android/test_display_hotplug.cpp (+5/-0)
tests/unit-tests/graphics/android/test_fb_device.cpp (+8/-0)
tests/unit-tests/graphics/android/test_graphics_platform.cpp (+65/-0)
tests/unit-tests/graphics/android/test_hwc_device.cpp (+9/-8)
tests/unit-tests/graphics/android/test_hwc_fb_device.cpp (+6/-0)
tests/unit-tests/graphics/android/test_native_buffer.cpp (+50/-7)
tests/unit-tests/graphics/android/test_platform.cpp (+20/-4)
tests/unit-tests/graphics/mesa/CMakeLists.txt (+2/-2)
tests/unit-tests/graphics/mesa/kms/CMakeLists.txt (+23/-6)
tests/unit-tests/graphics/mesa/kms/test_buffer_allocator.cpp (+10/-4)
tests/unit-tests/graphics/mesa/kms/test_cursor.cpp (+60/-31)
tests/unit-tests/graphics/mesa/kms/test_display.cpp (+28/-11)
tests/unit-tests/graphics/mesa/kms/test_display_buffer.cpp (+69/-29)
tests/unit-tests/graphics/mesa/kms/test_display_configuration.cpp (+8/-2)
tests/unit-tests/graphics/mesa/kms/test_display_generic.cpp (+82/-0)
tests/unit-tests/graphics/mesa/kms/test_display_multi_monitor.cpp (+13/-4)
tests/unit-tests/graphics/mesa/kms/test_gbm_buffer.cpp (+9/-3)
tests/unit-tests/graphics/mesa/kms/test_graphics_platform.cpp (+86/-0)
tests/unit-tests/graphics/mesa/kms/test_platform.cpp (+23/-15)
tests/unit-tests/graphics/mesa/x11/CMakeLists.txt (+23/-4)
tests/unit-tests/graphics/mesa/x11/test_display_generic.cpp (+122/-0)
tests/unit-tests/graphics/mesa/x11/test_graphics_platform.cpp (+89/-0)
tests/unit-tests/graphics/mesa/x11/test_platform.cpp (+8/-4)
tests/unit-tests/graphics/nested/test_nested_display_configuration.cpp (+35/-0)
tests/unit-tests/graphics/test_default_display_configuration_policy.cpp (+31/-61)
tests/unit-tests/graphics/test_display.cpp (+0/-265)
tests/unit-tests/graphics/test_display.h (+185/-0)
tests/unit-tests/graphics/test_egl_extensions.cpp (+40/-10)
tests/unit-tests/graphics/test_egl_sync_fence.cpp (+151/-0)
tests/unit-tests/graphics/test_graphics_platform.cpp (+0/-139)
tests/unit-tests/graphics/test_graphics_platform.h (+64/-0)
tests/unit-tests/graphics/test_overlapping_output_grouping.cpp (+5/-0)
tests/unit-tests/graphics/test_platform_prober.cpp (+13/-4)
tests/unit-tests/input/CMakeLists.txt (+8/-3)
tests/unit-tests/input/android/test_android_input_lexicon.cpp (+6/-0)
tests/unit-tests/input/android/test_input_translator.cpp (+4/-1)
tests/unit-tests/input/evdev/test_evdev_device_detection.cpp (+2/-2)
tests/unit-tests/input/evdev/test_libinput_device.cpp (+504/-262)
tests/unit-tests/input/test_default_device.cpp (+135/-0)
tests/unit-tests/input/test_default_input_device_hub.cpp (+261/-50)
tests/unit-tests/input/test_event_builders.cpp (+12/-1)
tests/unit-tests/input/test_input_platform_probing.cpp (+161/-0)
tests/unit-tests/input/test_key_repeat_dispatcher.cpp (+3/-1)
tests/unit-tests/input/test_x11_module.cpp (+81/-0)
tests/unit-tests/input/test_x11_platform.cpp (+37/-1)
tests/unit-tests/input/test_xcursor_loader.cpp (+3/-2)
tests/unit-tests/renderers/gl/test_gl_renderer.cpp (+47/-0)
tests/unit-tests/scene/test_abstract_shell.cpp (+89/-5)
tests/unit-tests/scene/test_application_session.cpp (+14/-6)
tests/unit-tests/scene/test_basic_surface.cpp (+30/-0)
tests/unit-tests/scene/test_mediating_display_changer.cpp (+52/-8)
tests/unit-tests/scene/test_session_manager.cpp (+1/-1)
tests/unit-tests/scene/test_surface_controller.cpp (+3/-4)
tests/unit-tests/scene/test_surface_stack.cpp (+58/-83)
tests/unit-tests/test_mir_cookie.cpp (+1/-14)
tools/CMakeLists.txt (+0/-1)
tools/setup-partial-armhf-chroot.sh (+1/-6)
tools/valgrind_suppressions_generic (+18/-0)
tools/vera++/CMakeLists.txt (+0/-17)
tools/vera++/LICENSE_1_0.txt (+0/-23)
tools/vera++/profiles/mir_vera_profile (+0/-23)
tools/vera++/scripts/rules/DUMP.tcl (+0/-13)
tools/vera++/scripts/rules/F001.tcl (+0/-18)
tools/vera++/scripts/rules/F002.tcl (+0/-56)
tools/vera++/scripts/rules/L001.tcl (+0/-20)
tools/vera++/scripts/rules/L002.tcl (+0/-14)
tools/vera++/scripts/rules/L003.tcl (+0/-17)
tools/vera++/scripts/rules/L004.tcl (+0/-14)
tools/vera++/scripts/rules/L005.tcl (+0/-22)
tools/vera++/scripts/rules/L006.tcl (+0/-11)
tools/vera++/scripts/rules/MIR001.tcl (+0/-46)
tools/vera++/scripts/rules/T001.tcl (+0/-13)
tools/vera++/scripts/rules/T002.tcl (+0/-99)
tools/vera++/scripts/rules/T003.tcl (+0/-47)
tools/vera++/scripts/rules/T004.tcl (+0/-51)
tools/vera++/scripts/rules/T005.tcl (+0/-19)
tools/vera++/scripts/rules/T006.tcl (+0/-19)
tools/vera++/scripts/rules/T007.tcl (+0/-22)
tools/vera++/scripts/rules/T008.tcl (+0/-18)
tools/vera++/scripts/rules/T009.tcl (+0/-26)
tools/vera++/scripts/rules/T010.tcl (+0/-11)
tools/vera++/scripts/rules/T011.tcl (+0/-51)
tools/vera++/scripts/rules/T012.tcl (+0/-12)
tools/vera++/scripts/rules/T013.tcl (+0/-16)
tools/vera++/scripts/rules/T014.tcl (+0/-16)
tools/vera++/scripts/rules/T015.tcl (+0/-49)
tools/vera++/scripts/rules/T016.tcl (+0/-17)
tools/vera++/scripts/rules/T017.tcl (+0/-23)
tools/vera++/scripts/rules/T018.tcl (+0/-23)
tools/vera++/scripts/rules/T019.tcl (+0/-32)
To merge this branch: bzr merge lp:~mir-team/mir/PD-demo
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Cemil Azizoglu (community) Disapprove
Review via email: mp+278638@code.launchpad.net

Commit message

PD demo

Description of the change

PD demo.

The source branch lp:~mir-team/mir/PD-demo contains :

lp:mir @3126
lp:~mir-team/mir/ubuntu (to resolve conflicts)
lp:~alan-griffiths/mir/fix-1516670 @3118
lp:~kdub/mir/egl-sync-fences @3134

Carefully merge new revisions of the latter two branches, as necessary, as they are still going through reviews and may get updated.

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

DO NOT LAND.

Silo for PD demo.

review: Disapprove
lp:~mir-team/mir/PD-demo updated
3126. By Andreas Pokorny

Add automatic searching and probing for input platforms

With this specifying the input platform via --platform-input-lib is no longer necessary, unless the stub input platform that supports attaching fake devices is required. Fixes: https://bugs.launchpad.net/bugs/1517133.

Approved by PS Jenkins bot, Cemil Azizoglu, Chris Halse Rogers.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~mir-team/mir/PD-demo updated
3127. By Cemil Azizoglu

merge ubuntu back

3128. By Cemil Azizoglu

delete mir-client-platform-mes-dev.pc.in

3129. By Cemil Azizoglu

Merge lp:~alan-griffiths/mir/fix-1516670 @3118

3130. By Cemil Azizoglu

Merge lp:~kdub/mir/egl-sync-fences @3134

3131. By Cemil Azizoglu

Fix/disable failing tests.

3132. By Cemil Azizoglu

Add missing symbol

3133. By Cemil Azizoglu

Disable failing test

3134. By Cemil Azizoglu

Install mir-platform-input-evdev4 package with drivers

3135. By Cemil Azizoglu

Fix esoteric arch builds

3136. By Cemil Azizoglu

fix-1521795

Unmerged revisions

3136. By Cemil Azizoglu

fix-1521795

3135. By Cemil Azizoglu

Fix esoteric arch builds

3134. By Cemil Azizoglu

Install mir-platform-input-evdev4 package with drivers

3133. By Cemil Azizoglu

Disable failing test

3132. By Cemil Azizoglu

Add missing symbol

3131. By Cemil Azizoglu

Fix/disable failing tests.

3130. By Cemil Azizoglu

Merge lp:~kdub/mir/egl-sync-fences @3134

3129. By Cemil Azizoglu

Merge lp:~alan-griffiths/mir/fix-1516670 @3118

3128. By Cemil Azizoglu

delete mir-client-platform-mes-dev.pc.in

3127. By Cemil Azizoglu

merge ubuntu back

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-06-17 05:20:42 +0000
3+++ 3rd_party/CMakeLists.txt 2015-11-25 21:33:30 +0000
4@@ -21,11 +21,3 @@
5 MIR_ANDROID_INPUT_COMPILE_FLAGS
6 ${MIR_ANDROID_INPUT_COMPILE_FLAGS}
7 PARENT_SCOPE)
8-
9-add_subdirectory(xcursor)
10-list(
11- APPEND MIR_XCURSOR_INCLUDE_DIRECTORIES
12- ${CMAKE_CURRENT_SOURCE_DIR}/xcursor/
13-)
14-
15-set(MIR_XCURSOR_INCLUDE_DIRECTORIES ${MIR_XCURSOR_INCLUDE_DIRECTORIES} PARENT_SCOPE)
16
17=== modified file '3rd_party/android-input/CMakeLists.txt'
18--- 3rd_party/android-input/CMakeLists.txt 2015-02-22 07:46:25 +0000
19+++ 3rd_party/android-input/CMakeLists.txt 2015-11-25 21:33:30 +0000
20@@ -24,6 +24,6 @@
21 ${CMAKE_CURRENT_SOURCE_DIR}/android/hardware/libhardware_legacy/include
22 ${CMAKE_CURRENT_SOURCE_DIR}/android/system/core/include
23 ${CMAKE_CURRENT_SOURCE_DIR}/android/system/extras/ext4_utils
24- ${CMAKE_CURRENT_SOURCE_DIR}/android/external/kernel-headers/original
25+ ${CMAKE_CURRENT_SOURCE_DIR}/android/external/kernel-headers
26 )
27 set(MIR_ANDROID_INCLUDE_DIRECTORIES ${MIR_ANDROID_INCLUDE_DIRECTORIES} PARENT_SCOPE)
28
29=== modified file '3rd_party/android-input/android/CMakeLists.txt'
30--- 3rd_party/android-input/android/CMakeLists.txt 2015-08-19 02:03:51 +0000
31+++ 3rd_party/android-input/android/CMakeLists.txt 2015-11-25 21:33:30 +0000
32@@ -1,5 +1,5 @@
33 include_directories(
34- external/kernel-headers/original
35+ external/kernel-headers
36 frameworks/base/include
37 frameworks/native/include
38 hardware/libhardware_legacy/include
39
40=== modified file '3rd_party/android-input/android/frameworks/base/services/input/EventHub.h'
41--- 3rd_party/android-input/android/frameworks/base/services/input/EventHub.h 2015-06-17 05:20:42 +0000
42+++ 3rd_party/android-input/android/frameworks/base/services/input/EventHub.h 2015-11-25 21:33:30 +0000
43@@ -34,7 +34,7 @@
44
45 #include "mir/fd.h"
46
47-#include <linux/input.h>
48+#include <original/linux/input.h>
49 #include <sys/epoll.h>
50
51 #include <memory>
52
53=== modified file '3rd_party/android-input/android/frameworks/base/services/input/InputTransport.cpp'
54--- 3rd_party/android-input/android/frameworks/base/services/input/InputTransport.cpp 2015-08-17 18:33:38 +0000
55+++ 3rd_party/android-input/android/frameworks/base/services/input/InputTransport.cpp 2015-11-25 21:33:30 +0000
56@@ -43,11 +43,7 @@
57
58 // Latency added during resampling. A few milliseconds doesn't hurt much but
59 // reduces the impact of mispredicted touch positions.
60-//static constexpr const std::chrono::nanoseconds RESAMPLE_LATENCY = std::chrono::nanoseconds(5 * NANOS_PER_MS);
61-
62-// Mir modification: No artificial latency please. This seems to provide
63-// visibly and measurably lower input latency, with no noticeable down side...
64-static constexpr const std::chrono::nanoseconds RESAMPLE_LATENCY(0);
65+static constexpr const std::chrono::nanoseconds RESAMPLE_LATENCY = std::chrono::nanoseconds(5 * NANOS_PER_MS);
66
67 // Minimum time difference between consecutive samples before attempting to resample.
68 static constexpr const std::chrono::nanoseconds RESAMPLE_MIN_DELTA = std::chrono::nanoseconds(2 * NANOS_PER_MS);
69
70=== modified file '3rd_party/android-input/android/frameworks/native/libs/utils/Timers.cpp'
71--- 3rd_party/android-input/android/frameworks/native/libs/utils/Timers.cpp 2015-08-18 01:35:15 +0000
72+++ 3rd_party/android-input/android/frameworks/native/libs/utils/Timers.cpp 2015-11-25 21:33:30 +0000
73@@ -20,38 +20,12 @@
74 #include <utils/Timers.h>
75 #include <std/Log.h>
76
77-#include <stdlib.h>
78-#include <stdio.h>
79-#include <unistd.h>
80-#include <sys/time.h>
81-#include <time.h>
82-#include <errno.h>
83 #include <limits.h>
84-
85-#ifdef HAVE_WIN32_THREADS
86-#include <windows.h>
87-#endif
88-
89-std::chrono::nanoseconds systemTime(int clock)
90+#include <chrono>
91+
92+std::chrono::nanoseconds systemTime(int /*clock => always MONOTONIC*/)
93 {
94-#if defined(HAVE_POSIX_CLOCKS)
95- static const clockid_t clocks[] = {
96- CLOCK_REALTIME,
97- CLOCK_MONOTONIC,
98- CLOCK_PROCESS_CPUTIME_ID,
99- CLOCK_THREAD_CPUTIME_ID
100- };
101- struct timespec t;
102- t.tv_sec = t.tv_nsec = 0;
103- clock_gettime(clocks[clock], &t);
104- return std::chrono::nanoseconds(t.tv_sec)*1000000000LL + t.tv_nsec;
105-#else
106- // we don't support the clocks here.
107- struct timeval t;
108- t.tv_sec = t.tv_usec = 0;
109- gettimeofday(&t, NULL);
110- return std::chrono::nanoseconds(t.tv_sec)*1000000000LL + std::chrono::nanoseconds(t.tv_usec)*1000LL;
111-#endif
112+ return {std::chrono::steady_clock::now().time_since_epoch()};
113 }
114
115 int toMillisecondTimeoutDelay(std::chrono::nanoseconds referenceTime, std::chrono::nanoseconds timeoutTime)
116
117=== removed directory '3rd_party/xcursor'
118=== removed file '3rd_party/xcursor/CMakeLists.txt'
119--- 3rd_party/xcursor/CMakeLists.txt 2015-06-17 05:20:42 +0000
120+++ 3rd_party/xcursor/CMakeLists.txt 1970-01-01 00:00:00 +0000
121@@ -1,11 +0,0 @@
122-set(
123- XCURSOR_SOURCES
124-
125- xcursor.c
126-)
127-
128-add_library(
129- xcursorloader-static STATIC
130-
131- ${XCURSOR_SOURCES}
132-)
133
134=== modified file 'CMakeLists.txt'
135--- CMakeLists.txt 2015-10-27 05:18:41 +0000
136+++ CMakeLists.txt 2015-11-25 21:33:30 +0000
137@@ -27,8 +27,8 @@
138 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
139
140 set(MIR_VERSION_MAJOR 0)
141-set(MIR_VERSION_MINOR 17)
142-set(MIR_VERSION_PATCH 1)
143+set(MIR_VERSION_MINOR 18)
144+set(MIR_VERSION_PATCH 0)
145
146 add_definitions(-DMIR_VERSION_MAJOR=${MIR_VERSION_MAJOR})
147 add_definitions(-DMIR_VERSION_MINOR=${MIR_VERSION_MINOR})
148@@ -49,7 +49,6 @@
149 endif()
150 include (cmake/EnableCoverageReport.cmake)
151 include (cmake/MirCommon.cmake)
152-include (cmake/PrePush.cmake)
153 include (GNUInstallDirs)
154
155 set(build_types "None;Debug;Release;RelWithDebInfo;MinSizeRel;Coverage;AddressSanitizer;ThreadSanitizer")
156@@ -122,6 +121,7 @@
157 enable_testing()
158
159 include_directories(include/common)
160+include_directories(include/cookie)
161
162 # Check for boost
163 find_package(Boost 1.48.0 COMPONENTS date_time system program_options filesystem REQUIRED)
164@@ -196,7 +196,6 @@
165
166 set(MIR_ANDROID_INCLUDE_DIRECTORIES) # to be filled by android-input
167 set(MIR_ANDROID_INPUT_COMPILE_FLAGS) # to be filled by android-input
168-set(MIR_XCURSOR_INCLUDE_DIRECTORIES)
169 set(MIR_3RD_PARTY_INCLUDE_DIRECTORIES)
170 add_subdirectory(3rd_party/)
171
172@@ -212,7 +211,6 @@
173 option(MIR_ENABLE_TESTS "Build tests" ON)
174
175 add_subdirectory(benchmarks/)
176-add_subdirectory(tools/)
177 add_subdirectory(examples/)
178 add_subdirectory(playground/)
179 add_subdirectory(guides/)
180
181=== modified file 'benchmarks/frame-uniformity/touch_producing_server.cpp'
182--- benchmarks/frame-uniformity/touch_producing_server.cpp 2015-10-05 02:18:18 +0000
183+++ benchmarks/frame-uniformity/touch_producing_server.cpp 2015-11-25 21:33:30 +0000
184@@ -26,7 +26,6 @@
185 #include <functional>
186
187 namespace mi = mir::input;
188-namespace mia = mi::android;
189 namespace mg = mir::graphics;
190 namespace mis = mi::synthesis;
191 namespace geom = mir::geometry;
192
193=== modified file 'benchmarks/frame-uniformity/vsync_simulating_graphics_platform.cpp'
194--- benchmarks/frame-uniformity/vsync_simulating_graphics_platform.cpp 2015-10-07 02:34:05 +0000
195+++ benchmarks/frame-uniformity/vsync_simulating_graphics_platform.cpp 2015-11-25 21:33:30 +0000
196@@ -92,23 +92,23 @@
197 }
198
199 VsyncSimulatingPlatform::VsyncSimulatingPlatform(geom::Size const& output_size, int vsync_rate_in_hz)
200- : display(std::make_shared<StubDisplay>(output_size, vsync_rate_in_hz))
201-{
202-}
203-
204-std::shared_ptr<mg::GraphicBufferAllocator> VsyncSimulatingPlatform::create_buffer_allocator()
205-{
206- return std::make_shared<mtd::StubBufferAllocator>();
207-}
208-
209-std::shared_ptr<mg::Display> VsyncSimulatingPlatform::create_display(
210+ : output_size(output_size), vsync_rate_in_hz(vsync_rate_in_hz)
211+{
212+}
213+
214+mir::UniqueModulePtr<mg::GraphicBufferAllocator> VsyncSimulatingPlatform::create_buffer_allocator()
215+{
216+ return mir::make_module_ptr<mtd::StubBufferAllocator>();
217+}
218+
219+mir::UniqueModulePtr<mg::Display> VsyncSimulatingPlatform::create_display(
220 std::shared_ptr<mg::DisplayConfigurationPolicy> const&,
221 std::shared_ptr<mg::GLConfig> const&)
222 {
223- return display;
224+ return mir::make_module_ptr<StubDisplay>(output_size, vsync_rate_in_hz);
225 }
226-
227-std::shared_ptr<mg::PlatformIpcOperations> VsyncSimulatingPlatform::make_ipc_operations() const
228+
229+mir::UniqueModulePtr<mg::PlatformIpcOperations> VsyncSimulatingPlatform::make_ipc_operations() const
230 {
231- return std::make_shared<mtd::NullPlatformIpcOperations>();
232+ return mir::make_module_ptr<mtd::NullPlatformIpcOperations>();
233 }
234
235=== modified file 'benchmarks/frame-uniformity/vsync_simulating_graphics_platform.h'
236--- benchmarks/frame-uniformity/vsync_simulating_graphics_platform.h 2015-10-07 02:34:05 +0000
237+++ benchmarks/frame-uniformity/vsync_simulating_graphics_platform.h 2015-11-25 21:33:30 +0000
238@@ -30,16 +30,17 @@
239 VsyncSimulatingPlatform(mir::geometry::Size const& output_size, int vsync_rate_in_hz);
240 ~VsyncSimulatingPlatform() = default;
241
242- std::shared_ptr<mir::graphics::GraphicBufferAllocator> create_buffer_allocator();
243+ mir::UniqueModulePtr<mir::graphics::GraphicBufferAllocator> create_buffer_allocator();
244
245- std::shared_ptr<mir::graphics::Display> create_display(
246+ mir::UniqueModulePtr<mir::graphics::Display> create_display(
247 std::shared_ptr<mir::graphics::DisplayConfigurationPolicy> const& initial_conf_policy,
248 std::shared_ptr<mir::graphics::GLConfig> const& gl_config);
249
250- std::shared_ptr<mir::graphics::PlatformIpcOperations> make_ipc_operations() const;
251+ mir::UniqueModulePtr<mir::graphics::PlatformIpcOperations> make_ipc_operations() const;
252
253 private:
254- std::shared_ptr<mir::graphics::Display> display;
255+ mir::geometry::Size const output_size;
256+ int const vsync_rate_in_hz;
257 };
258
259 #endif // VSYNC_SIMULATING_GRAPHICS_PLATFORM_H_
260
261=== removed file 'cmake/PrePush.cmake'
262--- cmake/PrePush.cmake 2015-02-22 07:46:25 +0000
263+++ cmake/PrePush.cmake 1970-01-01 00:00:00 +0000
264@@ -1,122 +0,0 @@
265-#######################################################################
266-# A convenience target that carries out the following steps:
267-# - Apply astyle to all source files of interest.
268-# - Build & test in a chroot, comparable setup to CI/Autolanding
269-# and ppa builders. Will fail if new files have not been added.
270-# - Build & test for android.
271-#
272-# NOTE: This target is very sensitive to the availability of all
273-# all required dependencies. For that, we prefer to fail the
274-# target if deps are missing to make the problem very visible.
275-#
276-# TODO:
277-# - Wire up the style-check target once we have reached a state
278-# where trunk actually passes the style check.
279-#######################################################################
280-add_custom_target(
281- pre-push
282-
283- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
284-)
285-
286-#######################################################################
287-# Add target for running astyle with the correct options #
288-#######################################################################
289-find_program(ASTYLE_EXECUTABLE astyle)
290-
291-if(NOT ASTYLE_EXECUTABLE)
292- message(STATUS "Could NOT find astyle, pre-push is going to FAIL")
293-endif()
294-
295-set(
296- ASTYLE_OPTIONS
297- ${ASTYLE_OPTIONS}
298- --indent-switches
299- --pad-header
300- --unpad-paren
301- --align-pointer=type
302-)
303-
304-add_custom_target(
305- astyle
306-
307- find ${CMAKE_SOURCE_DIR}/examples -name *.h | xargs ${ASTYLE_EXECUTABLE} ${ASTYLE_OPTIONS}
308- COMMAND find ${CMAKE_SOURCE_DIR}/include -name *.h | xargs ${ASTYLE_EXECUTABLE}
309- COMMAND find ${CMAKE_SOURCE_DIR}/src -name *.h | xargs ${ASTYLE_EXECUTABLE} ${${ASTYLE_EXECUTABLE}_OPTIONS}
310- COMMAND find ${CMAKE_SOURCE_DIR}/tests -name *.h | xargs ${ASTYLE_EXECUTABLE} ${${ASTYLE_EXECUTABLE}_OPTIONS}
311- COMMAND find ${CMAKE_SOURCE_DIR}/tools -name *.h | xargs ${ASTYLE_EXECUTABLE} ${${ASTYLE_EXECUTABLE}_OPTIONS}
312-
313- COMMAND find ${CMAKE_SOURCE_DIR}/examples -name *.cpp | xargs ${ASTYLE_EXECUTABLE} ${${ASTYLE_EXECUTABLE}_OPTIONS}
314- COMMAND find ${CMAKE_SOURCE_DIR}/include -name *.cpp | xargs ${ASTYLE_EXECUTABLE} ${${ASTYLE_EXECUTABLE}_OPTIONS}
315- COMMAND find ${CMAKE_SOURCE_DIR}/src -name *.cpp | xargs ${ASTYLE_EXECUTABLE} ${${ASTYLE_EXECUTABLE}_OPTIONS}
316- COMMAND find ${CMAKE_SOURCE_DIR}/tests -name *.cpp | xargs ${ASTYLE_EXECUTABLE} ${${ASTYLE_EXECUTABLE}_OPTIONS}
317- COMMAND find ${CMAKE_SOURCE_DIR}/tools -name *.cpp | xargs ${ASTYLE_EXECUTABLE} ${${ASTYLE_EXECUTABLE}_OPTIONS}
318-
319- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} VERBATIM
320-)
321-
322-#######################################################################
323-# Add target for creating a source tarball with bzr export #
324-#######################################################################
325-add_custom_target(
326- pre-push-source-tarball
327-
328- COMMAND rm -rf pre-push-build-area
329- COMMAND mkdir pre-push-build-area
330- COMMAND bzr export --root mir-pre-push pre-push-build-area/mir_${MIR_VERSION}.orig.tar.bz2 ${CMAKE_SOURCE_DIR}
331- WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
332- COMMENT "Preparing source tarball for pre-push build & test"
333-)
334-
335-#######################################################################
336-# Add target for extracting source tarball for pdebuild #
337-#######################################################################
338-add_custom_target(
339- extract-pre-push-tarball
340- COMMAND tar -xf mir_${MIR_VERSION}.orig.tar.bz2
341- WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/pre-push-build-area VERBATIM
342-)
343-
344-#######################################################################
345-# Builds & tests the last committed revision of the current branch #
346-#######################################################################
347-find_program(PDEBUILD_EXECUTABLE pdebuild)
348-if(NOT PDEBUILD_EXECUTABLE)
349- message(STATUS "pdebuild NOT found, pre-push is going to FAIL")
350-endif()
351-
352-add_custom_target(
353- pdebuild
354- COMMAND ${PDEBUILD_EXECUTABLE}
355- WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/pre-push-build-area/mir-pre-push
356- COMMENT "Building & testing in chroot'd environment"
357- VERBATIM
358-)
359-
360-#######################################################################
361-# Builds & tests the last committed revision of the current branch #
362-# for Android #
363-#######################################################################
364-if(NOT DEFINED ENV{MIR_ANDROID_NDK_DIR})
365- message(STATUS "Env. variable MIR_ANDROID_NDK_DIR not set, pre-push is going to FAIL")
366-endif()
367-if(NOT DEFINED ENV{MIR_ANDROID_SDK_DIR})
368- message(STATUS "Env. variable MIR_ANDROID_SDK_DIR not set, pre-push is going to FAIL")
369-endif()
370-
371-add_custom_target(
372- android-build
373-
374- COMMAND ./cross-compile.sh android-build
375- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
376- COMMENT "Building & testing for android"
377-)
378-
379-#######################################################################
380-# pdebuild: make tarball -> extract to build area -> pdebuild #
381-# android-build: invoke cross-compile script #
382-#######################################################################
383-add_dependencies(extract-pre-push-tarball pre-push-source-tarball)
384-add_dependencies(pdebuild extract-pre-push-tarball)
385-
386-add_dependencies(pre-push pdebuild android-build)
387
388=== modified file 'debian/changelog'
389--- debian/changelog 2015-11-05 21:54:17 +0000
390+++ debian/changelog 2015-11-25 21:33:30 +0000
391@@ -1,3 +1,9 @@
392+mir (0.18.0-0ubuntu1) UNRELEASED; urgency=medium
393+
394+ * New upstream release 0.18.0 (https://launchpad.net/mir/+milestone/0.18.0)
395+
396+ -- Alexandros Frantzis <alexandros.frantzis@canonical.com> Tue, 17 Nov 2015 13:14:36 +0200
397+
398 mir (0.17.1+16.04.20151105.1-0ubuntu1) xenial; urgency=medium
399
400 [ Alberto Aguirre ]
401
402=== modified file 'debian/control'
403--- debian/control 2015-11-04 23:33:08 +0000
404+++ debian/control 2015-11-25 21:33:30 +0000
405@@ -67,7 +67,7 @@
406
407 #TODO: Packaging infrastructure for better dependency generation,
408 # ala pkg-xorg's xviddriver:Provides and ABI detection.
409-Package: libmirserver35
410+Package: libmirserver36
411 Section: libs
412 Architecture: linux-any
413 Multi-Arch: same
414@@ -133,7 +133,7 @@
415 Architecture: linux-any
416 Multi-Arch: same
417 Pre-Depends: ${misc:Pre-Depends}
418-Depends: libmirserver35 (= ${binary:Version}),
419+Depends: libmirserver36 (= ${binary:Version}),
420 libmirplatform-dev (= ${binary:Version}),
421 libmircommon-dev (= ${binary:Version}),
422 libglm-dev,
423@@ -180,6 +180,7 @@
424 Pre-Depends: ${misc:Pre-Depends}
425 Depends: libmirclient9 (= ${binary:Version}),
426 libmircommon-dev (= ${binary:Version}),
427+ libmircookie-dev (= ${binary:Version}),
428 libprotobuf-dev (>= 2.4.1),
429 ${misc:Depends},
430 Description: Display server for Ubuntu - development headers
431@@ -289,7 +290,7 @@
432 Contains the shared libraries required for the Mir server and client.
433
434 # Longer-term these drivers should move out-of-tree
435-Package: mir-platform-graphics-mesa-x6
436+Package: mir-platform-graphics-mesa-x7
437 Section: libs
438 Architecture: linux-any
439 Multi-Arch: same
440@@ -303,7 +304,7 @@
441 Contains the shared libraries required for the Mir server to interact with
442 the X11 platform using the Mesa drivers.
443
444-Package: mir-platform-graphics-mesa-kms6
445+Package: mir-platform-graphics-mesa-kms7
446 Section: libs
447 Architecture: linux-any
448 Multi-Arch: same
449@@ -317,7 +318,7 @@
450 Contains the shared libraries required for the Mir server to interact with
451 the hardware platform using the Mesa drivers.
452
453-Package: mir-platform-graphics-android6
454+Package: mir-platform-graphics-android7
455 Section: libs
456 Architecture: i386 amd64 armhf
457 Multi-Arch: same
458@@ -331,7 +332,7 @@
459 Contains the shared libraries required for the Mir server to interact with
460 the hardware platform using the Android drivers.
461
462-Package: mir-platform-input-evdev3
463+Package: mir-platform-input-evdev4
464 Section: libs
465 Architecture: linux-any
466 Multi-Arch: same
467@@ -393,8 +394,8 @@
468 Multi-Arch: same
469 Pre-Depends: ${misc:Pre-Depends}
470 Depends: ${misc:Depends},
471- mir-platform-graphics-mesa-kms6,
472- mir-platform-graphics-mesa-x6,
473+ mir-platform-graphics-mesa-kms7,
474+ mir-platform-graphics-mesa-x7,
475 mir-client-platform-mesa3,
476 Description: Display server for Ubuntu - desktop driver metapackage
477 Mir is a display server running on linux systems, with a focus on efficiency,
478@@ -409,7 +410,7 @@
479 Multi-Arch: same
480 Pre-Depends: ${misc:Pre-Depends}
481 Depends: ${misc:Depends},
482- mir-platform-graphics-android6,
483+ mir-platform-graphics-android7,
484 mir-client-platform-android3,
485 Description: Display server for Ubuntu - android driver metapackage
486 Mir is a display server running on linux systems, with a focus on efficiency,
487@@ -424,7 +425,7 @@
488 Multi-Arch: same
489 Pre-Depends: ${misc:Pre-Depends}
490 Depends: ${misc:Depends},
491- ${shlibs:Depends}
492+ ${shlibs:Depends},
493 Description: Produce and verify spoof-resistant timestamps - runtime library
494 libmircookie provides a simple mechanism for a group of cooperating processes
495 to hand out and verify difficult-to-forge timestamps to untrusted 3rd parties.
496
497=== renamed file 'debian/libmirserver35.install' => 'debian/libmirserver36.install'
498--- debian/libmirserver35.install 2015-09-18 14:44:59 +0000
499+++ debian/libmirserver36.install 2015-11-25 21:33:30 +0000
500@@ -1,1 +1,1 @@
501-usr/lib/*/libmirserver.so.35
502+usr/lib/*/libmirserver.so.36
503
504=== modified file 'debian/mir-client-platform-mesa-dev.install'
505--- debian/mir-client-platform-mesa-dev.install 2015-10-23 06:34:41 +0000
506+++ debian/mir-client-platform-mesa-dev.install 2015-11-25 21:33:30 +0000
507@@ -1,3 +1,2 @@
508 usr/include/mirplatform/mir_toolkit/mesa
509-usr/lib/*/pkgconfig/mir-client-platform-mesa-dev.pc
510 usr/lib/*/pkgconfig/mir-client-platform-mesa.pc
511
512=== renamed file 'debian/mir-platform-graphics-android6.install' => 'debian/mir-platform-graphics-android7.install'
513--- debian/mir-platform-graphics-android6.install 2015-09-29 13:41:51 +0000
514+++ debian/mir-platform-graphics-android7.install 2015-11-25 21:33:30 +0000
515@@ -1,1 +1,1 @@
516-usr/lib/*/mir/server-platform/graphics-android.so.6
517+usr/lib/*/mir/server-platform/graphics-android.so.7
518
519=== renamed file 'debian/mir-platform-graphics-mesa-kms6.install' => 'debian/mir-platform-graphics-mesa-kms7.install'
520--- debian/mir-platform-graphics-mesa-kms6.install 2015-09-29 13:41:51 +0000
521+++ debian/mir-platform-graphics-mesa-kms7.install 2015-11-25 21:33:30 +0000
522@@ -1,1 +1,1 @@
523-usr/lib/*/mir/server-platform/graphics-mesa-kms.so.6
524+usr/lib/*/mir/server-platform/graphics-mesa-kms.so.7
525
526=== renamed file 'debian/mir-platform-graphics-mesa-x6.install' => 'debian/mir-platform-graphics-mesa-x7.install'
527--- debian/mir-platform-graphics-mesa-x6.install 2015-09-21 14:18:54 +0000
528+++ debian/mir-platform-graphics-mesa-x7.install 2015-11-25 21:33:30 +0000
529@@ -1,1 +1,1 @@
530-usr/lib/*/mir/server-platform/server-mesa-x11.so.6
531+usr/lib/*/mir/server-platform/server-mesa-x11.so.7
532
533=== renamed file 'debian/mir-platform-input-evdev3.install' => 'debian/mir-platform-input-evdev4.install'
534--- debian/mir-platform-input-evdev3.install 2015-09-23 18:55:58 +0000
535+++ debian/mir-platform-input-evdev4.install 2015-11-25 21:33:30 +0000
536@@ -1,1 +1,1 @@
537-usr/lib/*/mir/server-platform/input-evdev.so.3
538+usr/lib/*/mir/server-platform/input-evdev.so.4
539
540=== modified file 'debian/mir-test-tools.install'
541--- debian/mir-test-tools.install 2015-10-06 02:30:52 +0000
542+++ debian/mir-test-tools.install 2015-11-25 21:33:30 +0000
543@@ -1,5 +1,5 @@
544 usr/bin/mir_stress
545-usr/bin/mir_unit_tests
546+usr/bin/mir_unit_tests*
547 usr/bin/mir_acceptance_tests
548 usr/bin/mir_umock_acceptance_tests
549 usr/bin/mir_integration_tests*
550
551=== modified file 'doc/building_source_for_arm.md'
552--- doc/building_source_for_arm.md 2015-06-18 02:46:16 +0000
553+++ doc/building_source_for_arm.md 2015-11-25 21:33:30 +0000
554@@ -23,13 +23,31 @@
555 --------------------------------------------
556
557 Using a current Ubuntu (15.04 or later) installation it's very simple to build
558-binaries for armhf devices. Just follow these steps:
559+binaries for armhf (32-bit) devices. Just follow these steps:
560
561- $ sudo apt-get install g++-arm-linux-gnueabihf debootstrap
562+ $ sudo apt-get install g++-arm-linux-gnueabihf multistrap
563 $ cd mir_source_dir
564 $ ./cross-compile-chroot.sh
565 $ ls -l build-android-arm/* # binaries to copy to your device as you wish
566
567+If you wish to target arm64 (AArch64) then you can use:
568+
569+ $ sudo apt-get install g++-aarch64-linux-gnu multistrap
570+ $ cd mir_source_dir
571+ $ ./cross-compile-chroot.sh -a arm64
572+ $ ls -l build-arm64-*/bin
573+
574+Note: If your target device is running an Ubuntu version other than vivid
575+then you will also need to specify the target distribution for correct
576+library linkage. For example:
577+
578+ $ ./cross-compile-chroot.sh -a arm64 -d wily
579+
580+More architectures like PowerPC are also supported. To see the full list of
581+options, just run:
582+
583+ $ ./cross-compile-chroot.sh -h
584+
585 To speed up the process for future runs of cross-compile-chroot.sh, some files
586 are saved in ~/.cache/. To flush the cache and download new armhf packages
587 just add the -u option to cross-compile-chroot.sh.
588
589=== modified file 'examples/CMakeLists.txt'
590--- examples/CMakeLists.txt 2015-09-15 17:13:45 +0000
591+++ examples/CMakeLists.txt 2015-11-25 21:33:30 +0000
592@@ -18,18 +18,29 @@
593 )
594
595 add_library(exampleserverconfig STATIC
596+ server_example_basic_window_manager.h
597 server_example_canonical_window_manager.cpp
598 server_example_display_configuration_policy.cpp
599 server_example_input_event_filter.cpp
600 server_example_log_options.cpp
601 server_example_input_filter.cpp
602 server_example_host_lifecycle_event.cpp
603+ server_example_canonical_surface_info.cpp
604+ server_example_canonical_surface_info.h
605 server_example_tiling_window_manager.cpp
606 server_example_window_management.cpp
607 server_example_custom_compositor.cpp
608 server_example_adorning_compositor.cpp
609+ server_example_cursor_images.cpp
610+ server_example_cursor_images.h
611+ xcursor_loader.cpp
612+ xcursor_loader.h
613+ xcursor.c
614+ xcursor.h
615 )
616
617+SET_SOURCE_FILES_PROPERTIES(xcursor.c PROPERTIES COMPILE_FLAGS -D_GNU_SOURCE)
618+
619 target_link_libraries(eglapp
620 mirclient
621 ${EGL_LIBRARIES}
622@@ -245,3 +256,22 @@
623 )
624 endif ()
625 endif ()
626+
627+add_executable(mir_cursor_theme_dump
628+ cursor-theme-dump.cpp
629+)
630+
631+target_link_libraries(mir_cursor_theme_dump
632+ exampleserverconfig
633+ mirserver
634+)
635+
636+mir_add_wrapped_executable(mir_demo_client_multistream
637+ multi_stream.cpp
638+)
639+
640+target_link_libraries(mir_demo_client_multistream
641+ mirclient
642+ eglapp
643+ ${Boost_LIBRARIES}
644+)
645
646=== modified file 'examples/client_helpers.cpp'
647--- examples/client_helpers.cpp 2015-07-23 02:39:20 +0000
648+++ examples/client_helpers.cpp 2015-11-25 21:33:30 +0000
649@@ -27,12 +27,18 @@
650
651 namespace me = mir::examples;
652
653+me::Connection::Connection(char const* socket_file, char const* name)
654+ : connection{mir_connect_sync(socket_file, name)}
655+{
656+ if (!mir_connection_is_valid(connection))
657+ throw std::runtime_error(
658+ std::string("could not connect to server: ") +
659+ mir_connection_get_error_message(connection));
660+}
661+
662 me::Connection::Connection(char const* socket_file) :
663- connection(mir_connect_sync(socket_file, __PRETTY_FUNCTION__))
664+ Connection(socket_file, __PRETTY_FUNCTION__)
665 {
666- if (!mir_connection_is_valid(connection))
667- throw std::runtime_error(std::string("could not connect to server: ") +
668- mir_connection_get_error_message(connection));
669 }
670
671 me::Connection::~Connection()
672@@ -45,8 +51,65 @@
673 return connection;
674 }
675
676-me::NormalSurface::NormalSurface(me::Connection& connection, unsigned int width, unsigned int height, bool prefers_alpha) :
677- surface{create_surface(connection, width, height, prefers_alpha), surface_deleter}
678+me::BufferStream::BufferStream(
679+ Connection& connection,
680+ unsigned int width,
681+ unsigned int height,
682+ bool prefer_alpha,
683+ bool hardware)
684+ : stream{create_stream(connection, width, height, prefer_alpha, hardware),
685+ &mir_buffer_stream_release_sync}
686+{
687+ if (!mir_buffer_stream_is_valid(stream.get()))
688+ {
689+ // TODO: Huh. There's no mir_buffer_stream_get_error?
690+ throw std::runtime_error("Could not create buffer stream.");
691+ }
692+}
693+
694+me::BufferStream::operator MirBufferStream*() const
695+{
696+ return stream.get();
697+}
698+
699+MirBufferStream* me::BufferStream::create_stream(
700+ MirConnection *connection,
701+ unsigned int width,
702+ unsigned int height,
703+ bool prefer_alpha,
704+ bool hardware)
705+{
706+ MirPixelFormat selected_format;
707+ unsigned int valid_formats{0};
708+ MirPixelFormat pixel_formats[mir_pixel_formats];
709+ mir_connection_get_available_surface_formats(connection, pixel_formats, mir_pixel_formats, &valid_formats);
710+ if (valid_formats == 0)
711+ throw std::runtime_error("no pixel formats for buffer stream");
712+ selected_format = pixel_formats[0];
713+ //select an 8 bit opaque format if we can
714+ if (!prefer_alpha)
715+ {
716+ for(auto i = 0u; i < valid_formats; i++)
717+ {
718+ if (pixel_formats[i] == mir_pixel_format_xbgr_8888 ||
719+ pixel_formats[i] == mir_pixel_format_xrgb_8888)
720+ {
721+ selected_format = pixel_formats[i];
722+ break;
723+ }
724+ }
725+ }
726+
727+ return mir_connection_create_buffer_stream_sync(
728+ connection,
729+ width,
730+ height,
731+ selected_format,
732+ hardware ? mir_buffer_usage_hardware : mir_buffer_usage_software);
733+}
734+
735+me::NormalSurface::NormalSurface(me::Connection& connection, unsigned int width, unsigned int height, bool prefers_alpha, bool hardware) :
736+ surface{create_surface(connection, width, height, prefers_alpha, hardware), surface_deleter}
737 {
738 }
739
740@@ -55,7 +118,12 @@
741 return surface.get();
742 }
743
744-MirSurface* me::NormalSurface::create_surface(MirConnection* connection, unsigned int width, unsigned int height, bool prefers_alpha)
745+MirSurface* me::NormalSurface::create_surface(
746+ MirConnection* connection,
747+ unsigned int width,
748+ unsigned int height,
749+ bool prefers_alpha,
750+ bool hardware)
751 {
752 MirPixelFormat selected_format;
753 unsigned int valid_formats{0};
754@@ -85,7 +153,7 @@
755 };
756
757 mir_surface_spec_set_name(spec.get(), __PRETTY_FUNCTION__);
758- mir_surface_spec_set_buffer_usage(spec.get(), mir_buffer_usage_hardware);
759+ mir_surface_spec_set_buffer_usage(spec.get(), hardware ? mir_buffer_usage_hardware : mir_buffer_usage_software);
760 auto surface = mir_surface_create_sync(spec.get());
761 return surface;
762 }
763
764=== modified file 'examples/client_helpers.h'
765--- examples/client_helpers.h 2015-07-23 02:39:20 +0000
766+++ examples/client_helpers.h 2015-11-25 21:33:30 +0000
767@@ -32,6 +32,7 @@
768 {
769 public:
770 Connection(char const* socket_file);
771+ Connection(char const* socket_file, const char* name);
772 ~Connection();
773 operator MirConnection*();
774 Connection(Connection const&) = delete;
775@@ -40,14 +41,39 @@
776 MirConnection* connection;
777 };
778
779+class BufferStream
780+{
781+public:
782+ BufferStream(
783+ Connection& connection,
784+ unsigned int width,
785+ unsigned int height,
786+ bool prefer_alpha = false,
787+ bool hardware = true);
788+
789+ operator MirBufferStream*() const;
790+private:
791+ MirBufferStream* create_stream(
792+ MirConnection* connection,
793+ unsigned int width,
794+ unsigned int height,
795+ bool prefer_alpha,
796+ bool hardware);
797+
798+ std::unique_ptr<MirBufferStream, decltype(&mir_buffer_stream_release_sync)> const stream;
799+
800+ BufferStream(BufferStream const&) = delete;
801+ BufferStream& operator=(BufferStream const&) = delete;
802+};
803+
804 class NormalSurface
805 {
806 public:
807- NormalSurface(Connection& connection, unsigned int width, unsigned int height, bool prefers_alpha = false);
808-
809+ NormalSurface(Connection& connection, unsigned int width, unsigned int height, bool prefers_alpha = false, bool hardware = true);
810+
811 operator MirSurface*() const;
812 private:
813- MirSurface* create_surface(MirConnection* connection, unsigned int width, unsigned int height, bool prefers_alpha);
814+ MirSurface* create_surface(MirConnection* connection, unsigned int width, unsigned int height, bool prefers_alpha, bool hardware);
815 std::function<void(MirSurface*)> const surface_deleter{
816 [](MirSurface* surface) { mir_surface_release_sync(surface); }
817 };
818
819=== added file 'examples/cursor-theme-dump.cpp'
820--- examples/cursor-theme-dump.cpp 1970-01-01 00:00:00 +0000
821+++ examples/cursor-theme-dump.cpp 2015-11-25 21:33:30 +0000
822@@ -0,0 +1,127 @@
823+/*
824+ * Copyright © 2015 Canonical Ltd.
825+ *
826+ * This program is free software: you can redistribute it and/or modify it
827+ * under the terms of the GNU General Public License version 3,
828+ * as published by the Free Software Foundation.
829+ *
830+ * This program is distributed in the hope that it will be useful,
831+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
832+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
833+ * GNU General Public License for more details.
834+ *
835+ * You should have received a copy of the GNU General Public License
836+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
837+ *
838+ * Authored by: Alan Griffiths <alan@octopull.co.uk>
839+ */
840+
841+#include "xcursor_loader.h"
842+
843+#include "mir/graphics/cursor_image.h"
844+#include <mir_toolkit/cursors.h>
845+
846+#include <fstream>
847+
848+using namespace mir::examples;
849+using namespace mir::geometry;
850+
851+namespace
852+{
853+auto const cursor_names = {
854+ mir_arrow_cursor_name,
855+ mir_busy_cursor_name,
856+ mir_caret_cursor_name,
857+ mir_default_cursor_name,
858+ mir_pointing_hand_cursor_name,
859+ mir_open_hand_cursor_name,
860+ mir_closed_hand_cursor_name,
861+ mir_horizontal_resize_cursor_name,
862+ mir_vertical_resize_cursor_name,
863+ mir_diagonal_resize_bottom_to_top_cursor_name,
864+ mir_diagonal_resize_top_to_bottom_cursor_name,
865+ mir_omnidirectional_resize_cursor_name,
866+ mir_vsplit_resize_cursor_name,
867+ mir_hsplit_resize_cursor_name,
868+ mir_crosshair_cursor_name };
869+}
870+
871+
872+int main(int argc, char const* argv[])
873+try
874+{
875+ if (argc != 2)
876+ {
877+ puts("Usage mir_cursor_theme_dump <cursor theme>\n");
878+ exit(-1);
879+ }
880+
881+ auto const theme = argv[1];
882+ std::ofstream output(std::string{theme} + "-theme.h");
883+
884+ output << "#include <initializer_list>\n"
885+ "\n"
886+ "namespace\n"
887+ "{\n"
888+ "struct CursorData\n"
889+ "{\n"
890+ " CursorData(char const* name, unsigned int hotspot_x, unsigned int hotspot_y, char const* pixel_data) :\n"
891+ " name(name), hotspot_x(hotspot_x), hotspot_y(hotspot_y), pixel_data(reinterpret_cast<unsigned char const*>(pixel_data)) {}\n"
892+ "\n"
893+ " unsigned int const width{" << mir::input::default_cursor_size.width.as_int() << "};\n"
894+ " unsigned int const height{" << mir::input::default_cursor_size.height.as_int() << "};\n"
895+ " char const* const name;\n"
896+ " unsigned int const hotspot_x;\n"
897+ " unsigned int const hotspot_y;\n"
898+ " unsigned char const* const pixel_data;\n"
899+ "};\n"
900+ "auto const cursor_data = {\n";
901+
902+ auto const buffer_size = 4*mir::input::default_cursor_size.height.as_int()*mir::input::default_cursor_size.height.as_int();
903+
904+ auto const xcursor_loader = std::make_shared<XCursorLoader>(theme);
905+
906+ for (auto cursor : cursor_names)
907+ {
908+ if (auto const image = xcursor_loader->image(cursor, mir::input::default_cursor_size))
909+ {
910+ printf("Have image for %s:%s\n", theme, cursor);
911+
912+ auto const hotspot = image->hotspot();
913+ auto const argb_8888 = static_cast<uint8_t const*>(image->as_argb_8888());
914+
915+ output << "CursorData{\"" << cursor << "\", " << hotspot.dx.as_int() << ", " << hotspot.dy.as_int() << ",\n";
916+
917+ int chars = 0;
918+
919+ output << std::oct << " \"";
920+
921+ for (auto pbyte = argb_8888; pbyte != argb_8888 + buffer_size; ++pbyte)
922+ {
923+ auto step = (*pbyte < 010) ? 2 : (*pbyte < 0100) ? 3 : 4;
924+
925+ if ((chars += step) > 80)
926+ {
927+ output << "\"\n \"";
928+ chars = step;
929+ }
930+
931+ output << '\\' << static_cast<unsigned>(*pbyte);
932+ }
933+
934+ output << "\"\n";
935+
936+ output << "},\n";
937+ }
938+ else
939+ {
940+ printf("** WARNING ** No image for %s:%s\n", theme, cursor);
941+ }
942+ }
943+ output << "};\n";
944+ output << "}\n";
945+}
946+catch (std::exception const& error)
947+{
948+ printf("** ERROR **: %s", error.what());
949+}
950\ No newline at end of file
951
952=== modified file 'examples/fingerpaint.c'
953--- examples/fingerpaint.c 2015-08-25 02:27:09 +0000
954+++ examples/fingerpaint.c 2015-11-25 21:33:30 +0000
955@@ -42,6 +42,7 @@
956 static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
957 static pthread_cond_t change = PTHREAD_COND_INITIALIZER;
958 static bool changed = true;
959+static int force_radius = 0;
960
961 static void shutdown(int signum)
962 {
963@@ -263,11 +264,16 @@
964 {
965 x = mir_touch_event_axis_value(tev, p, mir_touch_axis_x);
966 y = mir_touch_event_axis_value(tev, p, mir_touch_axis_y);
967- float size = mir_touch_event_axis_value(tev, p,
968- mir_touch_axis_size);
969+ float m = mir_touch_event_axis_value(tev, p,
970+ mir_touch_axis_touch_major);
971+ float n = mir_touch_event_axis_value(tev, p,
972+ mir_touch_axis_touch_minor);
973+ radius = (m + n) / 4; /* Half the average */
974+ // mir_touch_axis_touch_major can be 0
975+ if (radius < 5)
976+ radius = 5;
977 pressure = mir_touch_event_axis_value(tev, p,
978 mir_touch_axis_pressure);
979- radius = size * 50.0f + 1.0f;
980 }
981 else if (pev != NULL)
982 {
983@@ -277,6 +283,9 @@
984 radius = 5;
985 }
986
987+ if (force_radius)
988+ radius = force_radius;
989+
990 size_t c = (base_color + p) %
991 (sizeof(color)/sizeof(color[0]));
992 Color tone = color[c];
993@@ -365,7 +374,18 @@
994 switch (arg[1])
995 {
996 case 'm':
997- mir_socket = argv[++i];
998+ ++i;
999+ if (i < argc)
1000+ mir_socket = argv[i];
1001+ else
1002+ help = 1;
1003+ break;
1004+ case 'r':
1005+ ++i;
1006+ if (i < argc)
1007+ force_radius = atoi(argv[i]);
1008+ else
1009+ help = 1;
1010 break;
1011 case 'w':
1012 swap_interval = 1;
1013@@ -385,7 +405,8 @@
1014 {
1015 printf("Usage: %s [<options>]\n"
1016 " -h Show this help text\n"
1017- " -m socket Mir server socket\n"
1018+ " -m <socket path> Mir server socket\n"
1019+ " -r <radius> Force paint brush radius\n"
1020 " -w Wait for vblank (don't drop frames)\n"
1021 " -- Ignore further arguments\n"
1022 , argv[0]);
1023
1024=== added file 'examples/multi_stream.cpp'
1025--- examples/multi_stream.cpp 1970-01-01 00:00:00 +0000
1026+++ examples/multi_stream.cpp 2015-11-25 21:33:30 +0000
1027@@ -0,0 +1,283 @@
1028+/*
1029+ * Copyright © 2015 Canonical Ltd.
1030+ *
1031+ * This program is free software: you can redistribute it and/or modify
1032+ * it under the terms of the GNU General Public License version 3 as
1033+ * published by the Free Software Foundation.
1034+ *
1035+ * This program is distributed in the hope that it will be useful,
1036+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1037+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1038+ * GNU General Public License for more details.
1039+ *
1040+ * You should have received a copy of the GNU General Public License
1041+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1042+ *
1043+ * Author: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
1044+ */
1045+
1046+#include <boost/program_options.hpp>
1047+#include <iostream>
1048+#include <thread>
1049+#include <signal.h>
1050+#include <sys/signalfd.h>
1051+#include <poll.h>
1052+
1053+#include "mir_toolkit/mir_client_library.h"
1054+
1055+#include "client_helpers.h"
1056+
1057+namespace po = boost::program_options;
1058+
1059+namespace me = mir::examples;
1060+
1061+class Pixel
1062+{
1063+public:
1064+ Pixel(void* addr, MirPixelFormat format)
1065+ : addr{addr},
1066+ format{format}
1067+ {
1068+ }
1069+
1070+ void write(int r, int g, int b, int a)
1071+ {
1072+ switch (format)
1073+ {
1074+ case mir_pixel_format_abgr_8888:
1075+ *((uint32_t*) addr) =
1076+ (uint32_t) a << 24 |
1077+ (uint32_t) b << 16 |
1078+ (uint32_t) g << 8 |
1079+ (uint32_t) r;
1080+ break;
1081+ case mir_pixel_format_xbgr_8888:
1082+ *((uint32_t*) addr) =
1083+ /* Not filling in the X byte is correct but buggy (LP: #1423462) */
1084+ (uint32_t) b << 16 |
1085+ (uint32_t) g << 8 |
1086+ (uint32_t) r;
1087+ break;
1088+ case mir_pixel_format_argb_8888:
1089+ *((uint32_t*) addr) =
1090+ (uint32_t) a << 24 |
1091+ (uint32_t) r << 16 |
1092+ (uint32_t) g << 8 |
1093+ (uint32_t) b;
1094+ break;
1095+ case mir_pixel_format_xrgb_8888:
1096+ *((uint32_t*) addr) =
1097+ /* Not filling in the X byte is correct but buggy (LP: #1423462) */
1098+ (uint32_t) r << 16 |
1099+ (uint32_t) g << 8 |
1100+ (uint32_t) b;
1101+ break;
1102+ case mir_pixel_format_rgb_888:
1103+ *((uint8_t*) addr) = r;
1104+ *((uint8_t*) addr + 1) = g;
1105+ *((uint8_t*) addr + 2) = b;
1106+ break;
1107+ case mir_pixel_format_bgr_888:
1108+ *((uint8_t*) addr) = b;
1109+ *((uint8_t*) addr + 1) = g;
1110+ *((uint8_t*) addr + 2) = r;
1111+ break;
1112+ default:
1113+ throw std::runtime_error{"Pixel format unsupported by Pixel::write!"};
1114+ }
1115+ }
1116+
1117+public:
1118+ void* const addr;
1119+ MirPixelFormat const format;
1120+};
1121+
1122+class pixel_iterator : std::iterator<std::random_access_iterator_tag, Pixel>
1123+{
1124+public:
1125+ pixel_iterator(MirGraphicsRegion const& region, int x, int y)
1126+ : x{x},
1127+ y{y},
1128+ buffer(region)
1129+ {
1130+ }
1131+
1132+ pixel_iterator(MirGraphicsRegion const& region)
1133+ : pixel_iterator(region, 0, 0)
1134+ {
1135+ }
1136+
1137+
1138+ pixel_iterator& operator++()
1139+ {
1140+ x++;
1141+ if (x == buffer.width)
1142+ {
1143+ x = 0;
1144+ y++;
1145+ }
1146+ return *this;
1147+ }
1148+ pixel_iterator operator++(int)
1149+ {
1150+ auto old = *this;
1151+ ++(*this);
1152+ return old;
1153+ }
1154+
1155+ Pixel operator*() const
1156+ {
1157+ return Pixel{
1158+ buffer.vaddr + (x * MIR_BYTES_PER_PIXEL(buffer.pixel_format)) + (y * buffer.stride), buffer.pixel_format};
1159+ }
1160+
1161+ bool operator==(pixel_iterator const& rhs)
1162+ {
1163+ return rhs.buffer.vaddr == buffer.vaddr &&
1164+ rhs.x == x &&
1165+ rhs.y == y;
1166+ }
1167+
1168+ bool operator!=(pixel_iterator const& rhs)
1169+ {
1170+ return !(*this == rhs);
1171+ }
1172+
1173+private:
1174+ int x, y;
1175+ MirGraphicsRegion const buffer;
1176+};
1177+
1178+pixel_iterator begin(MirGraphicsRegion const& region)
1179+{
1180+ return pixel_iterator(region);
1181+}
1182+
1183+pixel_iterator end(MirGraphicsRegion const& region)
1184+{
1185+ return pixel_iterator{region, 0, region.height};
1186+}
1187+
1188+void fill_stream_with(MirBufferStream* stream, int r, int g, int b, int a)
1189+{
1190+ MirGraphicsRegion buffer;
1191+ mir_buffer_stream_get_graphics_region(stream, &buffer);
1192+
1193+ for (auto pixel : buffer)
1194+ {
1195+ pixel.write(r, g, b, a);
1196+ }
1197+}
1198+
1199+void bounce_position(int& position, int& delta, int min, int max)
1200+{
1201+ if (position <= min || position >= max)
1202+ {
1203+ delta = -delta;
1204+ }
1205+ position += delta;
1206+}
1207+
1208+int main(int argc, char* argv[])
1209+{
1210+ po::options_description desc("Mir multi-bufferstream example:");
1211+ desc.add_options()
1212+ ("help", "this help message")
1213+ ("socket", po::value<std::string>(), "Server socket to connect to");
1214+
1215+ po::variables_map options;
1216+ po::store(po::parse_command_line(argc, argv, desc), options);
1217+ po::notify(options);
1218+
1219+ if (options.count("help"))
1220+ {
1221+ std::cout << desc << std::endl;
1222+ return 0;
1223+ }
1224+
1225+ char const* socket = nullptr;
1226+ if (options.count("socket"))
1227+ {
1228+ socket = options["socket"].as<std::string>().c_str();
1229+ }
1230+
1231+ me::Connection connection{socket, "Multiple MirBufferStream example"};
1232+
1233+ me::NormalSurface surface{connection, 200, 200, true, false};
1234+ MirBufferStream* surface_stream = mir_surface_get_buffer_stream(surface);
1235+ me::BufferStream top{connection, 100, 100, true, false};
1236+ me::BufferStream bottom{connection, 50, 50, true, false};
1237+
1238+ fill_stream_with(surface_stream, 255, 0, 0, 128);
1239+ mir_buffer_stream_swap_buffers_sync(surface_stream);
1240+ fill_stream_with(top, 0, 255, 0, 128);
1241+ mir_buffer_stream_swap_buffers_sync(top);
1242+ fill_stream_with(bottom, 0, 0, 255, 128);
1243+ mir_buffer_stream_swap_buffers_sync(bottom);
1244+
1245+ std::array<MirBufferStreamInfo, 3> arrangement;
1246+
1247+ arrangement[0].displacement_x = 0;
1248+ arrangement[0].displacement_y = 0;
1249+ arrangement[0].stream = surface_stream;
1250+
1251+ arrangement[1].displacement_x = 50;
1252+ arrangement[1].displacement_y = 50;
1253+ arrangement[1].stream = bottom;
1254+
1255+ arrangement[2].displacement_x = -40;
1256+ arrangement[2].displacement_y = -10;
1257+ arrangement[2].stream = top;
1258+
1259+ int top_dx{1}, top_dy{2};
1260+ int bottom_dx{2}, bottom_dy{-1};
1261+
1262+ auto spec = mir_connection_create_spec_for_changes(connection);
1263+
1264+ int baseColour = 255, dbase = 1;
1265+ int topColour = 255, dtop = 1;
1266+ int bottomColour = 255, dbottom = 1;
1267+
1268+ sigset_t halt_signals;
1269+ sigemptyset(&halt_signals);
1270+ sigaddset(&halt_signals, SIGTERM);
1271+ sigaddset(&halt_signals, SIGQUIT);
1272+ sigaddset(&halt_signals, SIGINT);
1273+
1274+ sigprocmask(SIG_BLOCK, &halt_signals, nullptr);
1275+ int const signal_watch{signalfd(-1, &halt_signals, SFD_CLOEXEC)};
1276+
1277+ pollfd signal_poll{
1278+ signal_watch,
1279+ POLLIN | POLLERR,
1280+ 0
1281+ };
1282+
1283+ while (poll(&signal_poll, 1, 0) <= 0)
1284+ {
1285+ bounce_position(arrangement[1].displacement_x, bottom_dx, -100, 300);
1286+ bounce_position(arrangement[1].displacement_y, bottom_dy, -100, 300);
1287+ bounce_position(arrangement[2].displacement_x, top_dx, -100, 300);
1288+ bounce_position(arrangement[2].displacement_y, top_dy, -100, 300);
1289+
1290+ mir_surface_spec_set_streams(spec, arrangement.data(), arrangement.size());
1291+ mir_surface_apply_spec(surface, spec);
1292+
1293+ bounce_position(baseColour, dbase, 128, 255);
1294+ bounce_position(topColour, dtop, 200, 255);
1295+ bounce_position(bottomColour, dbottom, 100, 255);
1296+
1297+ fill_stream_with(surface_stream, baseColour, 0, 0, 128);
1298+ fill_stream_with(bottom, 0, 0, bottomColour, 128);
1299+ fill_stream_with(top, 0, topColour, 0, 128);
1300+
1301+ mir_buffer_stream_swap_buffers_sync(surface_stream);
1302+ mir_buffer_stream_swap_buffers_sync(bottom);
1303+ mir_buffer_stream_swap_buffers_sync(top);
1304+ }
1305+ mir_surface_spec_release(spec);
1306+ close(signal_watch);
1307+
1308+ std::cout << "Quitting; have a nice day." << std::endl;
1309+ return 0;
1310+}
1311
1312=== modified file 'examples/render_surfaces.cpp'
1313--- examples/render_surfaces.cpp 2015-07-22 02:54:31 +0000
1314+++ examples/render_surfaces.cpp 2015-11-25 21:33:30 +0000
1315@@ -373,7 +373,7 @@
1316 auto const stream = buffer_stream_factory->create_buffer_stream(
1317 mf::BufferStreamId{}, std::make_shared<NullBufferSink>(), properties);
1318 auto const surface = surface_factory->create_surface(stream, params);
1319- surface_coordinator->add_surface(surface, params.depth, params.input_mode, nullptr);
1320+ surface_coordinator->add_surface(surface, params.input_mode, nullptr);
1321
1322 {
1323 mg::Buffer* buffer{nullptr};
1324
1325=== modified file 'examples/server_example.cpp'
1326--- examples/server_example.cpp 2015-08-12 06:37:54 +0000
1327+++ examples/server_example.cpp 2015-11-25 21:33:30 +0000
1328@@ -24,6 +24,7 @@
1329 #include "server_example_window_management.h"
1330 #include "server_example_custom_compositor.h"
1331 #include "server_example_test_client.h"
1332+#include "server_example_cursor_images.h"
1333
1334 #include "mir/server.h"
1335 #include "mir/main_loop.h"
1336@@ -93,6 +94,7 @@
1337 me::add_custom_compositor_option_to(server);
1338 add_launcher_option_to(server);
1339 add_timeout_option_to(server);
1340+ me::add_x_cursor_images(server);
1341
1342 me::ClientContext context;
1343 me::add_test_client_option_to(server, context);
1344
1345=== modified file 'examples/server_example_basic_window_manager.h'
1346--- examples/server_example_basic_window_manager.h 2015-10-02 01:56:04 +0000
1347+++ examples/server_example_basic_window_manager.h 2015-11-25 21:33:30 +0000
1348@@ -194,18 +194,21 @@
1349 bool handle_keyboard_event(MirKeyboardEvent const* event) override
1350 {
1351 std::lock_guard<decltype(mutex)> lock(mutex);
1352+ update_event_timestamp(event);
1353 return policy.handle_keyboard_event(event);
1354 }
1355
1356 bool handle_touch_event(MirTouchEvent const* event) override
1357 {
1358 std::lock_guard<decltype(mutex)> lock(mutex);
1359+ update_event_timestamp(event);
1360 return policy.handle_touch_event(event);
1361 }
1362
1363 bool handle_pointer_event(MirPointerEvent const* event) override
1364 {
1365 std::lock_guard<decltype(mutex)> lock(mutex);
1366+ update_event_timestamp(event);
1367
1368 cursor = {
1369 mir_pointer_event_axis_value(event, mir_pointer_axis_x),
1370@@ -214,6 +217,16 @@
1371 return policy.handle_pointer_event(event);
1372 }
1373
1374+ void handle_raise_surface(
1375+ std::shared_ptr<scene::Session> const& session,
1376+ std::shared_ptr<scene::Surface> const& surface,
1377+ uint64_t timestamp) override
1378+ {
1379+ std::lock_guard<decltype(mutex)> lock(mutex);
1380+ if (timestamp >= last_input_event_timestamp)
1381+ policy.handle_raise_surface(session, surface);
1382+ }
1383+
1384 int set_surface_attribute(
1385 std::shared_ptr<scene::Session> const& /*session*/,
1386 std::shared_ptr<scene::Surface> const& surface,
1387@@ -344,6 +357,42 @@
1388 typename SurfaceTo<SurfaceInfo>::type surface_info;
1389 geometry::Rectangles displays;
1390 geometry::Point cursor;
1391+ uint64_t last_input_event_timestamp{0};
1392+
1393+private:
1394+ void update_event_timestamp(MirKeyboardEvent const* kev)
1395+ {
1396+ auto iev = mir_keyboard_event_input_event(kev);
1397+ last_input_event_timestamp = mir_input_event_get_event_time(iev);
1398+ }
1399+
1400+ void update_event_timestamp(MirPointerEvent const* pev)
1401+ {
1402+ auto iev = mir_pointer_event_input_event(pev);
1403+ auto pointer_action = mir_pointer_event_action(pev);
1404+
1405+ if (pointer_action == mir_pointer_action_button_up ||
1406+ pointer_action == mir_pointer_action_button_down)
1407+ {
1408+ last_input_event_timestamp = mir_input_event_get_event_time(iev);
1409+ }
1410+ }
1411+
1412+ void update_event_timestamp(MirTouchEvent const* tev)
1413+ {
1414+ auto iev = mir_touch_event_input_event(tev);
1415+ auto touch_count = mir_touch_event_point_count(tev);
1416+ for (unsigned i = 0; i < touch_count; i++)
1417+ {
1418+ auto touch_action = mir_touch_event_action(tev, i);
1419+ if (touch_action == mir_touch_action_up ||
1420+ touch_action == mir_touch_action_down)
1421+ {
1422+ last_input_event_timestamp = mir_input_event_get_event_time(iev);
1423+ break;
1424+ }
1425+ }
1426+ }
1427 };
1428 }
1429 }
1430
1431=== added file 'examples/server_example_canonical_surface_info.cpp'
1432--- examples/server_example_canonical_surface_info.cpp 1970-01-01 00:00:00 +0000
1433+++ examples/server_example_canonical_surface_info.cpp 2015-11-25 21:33:30 +0000
1434@@ -0,0 +1,404 @@
1435+/*
1436+ * Copyright © 2015 Canonical Ltd.
1437+ *
1438+ * This program is free software: you can redistribute it and/or modify it
1439+ * under the terms of the GNU General Public License version 3,
1440+ * as published by the Free Software Foundation.
1441+ *
1442+ * This program is distributed in the hope that it will be useful,
1443+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1444+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1445+ * GNU General Public License for more details.
1446+ *
1447+ * You should have received a copy of the GNU General Public License
1448+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1449+ *
1450+ * Authored by: Alan Griffiths <alan@octopull.co.uk>
1451+ */
1452+
1453+#include "server_example_canonical_surface_info.h"
1454+
1455+#include "mir/scene/surface.h"
1456+#include "mir/scene/surface_creation_parameters.h"
1457+
1458+#include "mir/graphics/buffer.h"
1459+
1460+#include <atomic>
1461+
1462+namespace me = mir::examples;
1463+namespace ms = mir::scene;
1464+namespace mg = mir::graphics;
1465+using namespace mir::geometry;
1466+
1467+me::CanonicalSurfaceInfoCopy::CanonicalSurfaceInfoCopy(
1468+ std::shared_ptr<scene::Session> const& session,
1469+ std::shared_ptr<scene::Surface> const& surface,
1470+ scene::SurfaceCreationParameters const& params) :
1471+ type{surface->type()},
1472+ state{surface->state()},
1473+ restore_rect{surface->top_left(), surface->size()},
1474+ session{session},
1475+ parent{params.parent},
1476+ min_width{params.min_width.is_set() ? params.min_width.value() : Width{}},
1477+ min_height{params.min_height.is_set() ? params.min_height.value() : Height{}},
1478+ max_width{params.max_width.is_set() ? params.max_width.value() : Width{std::numeric_limits<int>::max()}},
1479+ max_height{params.max_height.is_set() ? params.max_height.value() : Height{std::numeric_limits<int>::max()}},
1480+ width_inc{params.width_inc},
1481+ height_inc{params.height_inc},
1482+ min_aspect{params.min_aspect},
1483+ max_aspect{params.max_aspect}
1484+{
1485+}
1486+
1487+bool me::CanonicalSurfaceInfoCopy::can_be_active() const
1488+{
1489+ switch (type)
1490+ {
1491+ case mir_surface_type_normal: /**< AKA "regular" */
1492+ case mir_surface_type_utility: /**< AKA "floating" */
1493+ case mir_surface_type_dialog:
1494+ case mir_surface_type_satellite: /**< AKA "toolbox"/"toolbar" */
1495+ case mir_surface_type_freestyle:
1496+ case mir_surface_type_menu:
1497+ case mir_surface_type_inputmethod: /**< AKA "OSK" or handwriting etc. */
1498+ return true;
1499+
1500+ case mir_surface_type_gloss:
1501+ case mir_surface_type_tip: /**< AKA "tooltip" */
1502+ default:
1503+ // Cannot have input focus
1504+ return false;
1505+ }
1506+}
1507+
1508+bool me::CanonicalSurfaceInfoCopy::must_have_parent() const
1509+{
1510+ switch (type)
1511+ {
1512+ case mir_surface_type_overlay:;
1513+ case mir_surface_type_inputmethod:
1514+ case mir_surface_type_satellite:
1515+ case mir_surface_type_tip:
1516+ return true;
1517+
1518+ default:
1519+ return false;
1520+ }
1521+}
1522+
1523+bool me::CanonicalSurfaceInfoCopy::can_morph_to(MirSurfaceType new_type) const
1524+{
1525+ switch (new_type)
1526+ {
1527+ case mir_surface_type_normal:
1528+ case mir_surface_type_utility:
1529+ case mir_surface_type_satellite:
1530+ switch (type)
1531+ {
1532+ case mir_surface_type_normal:
1533+ case mir_surface_type_utility:
1534+ case mir_surface_type_dialog:
1535+ case mir_surface_type_satellite:
1536+ return true;
1537+
1538+ default:
1539+ break;
1540+ }
1541+ break;
1542+
1543+ case mir_surface_type_dialog:
1544+ switch (type)
1545+ {
1546+ case mir_surface_type_normal:
1547+ case mir_surface_type_utility:
1548+ case mir_surface_type_dialog:
1549+ case mir_surface_type_popover:
1550+ case mir_surface_type_satellite:
1551+ return true;
1552+
1553+ default:
1554+ break;
1555+ }
1556+ break;
1557+
1558+ default:
1559+ break;
1560+ }
1561+
1562+ return false;
1563+}
1564+
1565+bool me::CanonicalSurfaceInfoCopy::must_not_have_parent() const
1566+{
1567+ switch (type)
1568+ {
1569+ case mir_surface_type_normal:
1570+ case mir_surface_type_utility:
1571+ return true;
1572+
1573+ default:
1574+ return false;
1575+ }
1576+}
1577+
1578+bool me::CanonicalSurfaceInfoCopy::is_visible() const
1579+{
1580+ switch (state)
1581+ {
1582+ case mir_surface_state_hidden:
1583+ case mir_surface_state_minimized:
1584+ return false;
1585+ default:
1586+ break;
1587+ }
1588+ return true;
1589+}
1590+
1591+struct mir::examples::CanonicalSurfaceInfoCopy::StreamPainter
1592+{
1593+ virtual void paint(int) = 0;
1594+ virtual ~StreamPainter() = default;
1595+ StreamPainter() = default;
1596+ StreamPainter(StreamPainter const&) = delete;
1597+ StreamPainter& operator=(StreamPainter const&) = delete;
1598+};
1599+
1600+struct mir::examples::CanonicalSurfaceInfoCopy::SwappingPainter
1601+ : mir::examples::CanonicalSurfaceInfoCopy::StreamPainter
1602+{
1603+ SwappingPainter(std::shared_ptr<frontend::BufferStream> const& buffer_stream) :
1604+ buffer_stream{buffer_stream}, buffer{nullptr}
1605+ {
1606+ swap_buffers();
1607+ }
1608+
1609+ void swap_buffers()
1610+ {
1611+ auto const callback = [this](mir::graphics::Buffer* new_buffer)
1612+ {
1613+ buffer.store(new_buffer);
1614+ };
1615+
1616+ buffer_stream->swap_buffers(buffer, callback);
1617+ }
1618+
1619+ void paint(int intensity) override
1620+ {
1621+ if (auto const buf = buffer.load())
1622+ {
1623+ auto const format = buffer_stream->pixel_format();
1624+ auto const sz = buf->size().height.as_int() *
1625+ buf->size().width.as_int() * MIR_BYTES_PER_PIXEL(format);
1626+ std::vector<unsigned char> pixels(sz, intensity);
1627+ buf->write(pixels.data(), sz);
1628+ swap_buffers();
1629+ }
1630+ }
1631+
1632+ std::shared_ptr<frontend::BufferStream> const buffer_stream;
1633+ std::atomic<graphics::Buffer*> buffer;
1634+};
1635+
1636+struct mir::examples::CanonicalSurfaceInfoCopy::AllocatingPainter
1637+ : mir::examples::CanonicalSurfaceInfoCopy::StreamPainter
1638+{
1639+ AllocatingPainter(std::shared_ptr<frontend::BufferStream> const& buffer_stream, Size size) :
1640+ buffer_stream(buffer_stream),
1641+ properties({
1642+ size,
1643+ buffer_stream->pixel_format(),
1644+ mg::BufferUsage::software
1645+ }),
1646+ front_buffer(buffer_stream->allocate_buffer(properties)),
1647+ back_buffer(buffer_stream->allocate_buffer(properties))
1648+ {
1649+ }
1650+
1651+ void paint(int intensity) override
1652+ {
1653+ buffer_stream->with_buffer(back_buffer,
1654+ [this, intensity](graphics::Buffer& buffer)
1655+ {
1656+ auto const format = buffer.pixel_format();
1657+ auto const sz = buffer.size().height.as_int() *
1658+ buffer.size().width.as_int() * MIR_BYTES_PER_PIXEL(format);
1659+ std::vector<unsigned char> pixels(sz, intensity);
1660+ buffer.write(pixels.data(), sz);
1661+ buffer_stream->swap_buffers(&buffer, [](mg::Buffer*){});
1662+ });
1663+ std::swap(front_buffer, back_buffer);
1664+ }
1665+
1666+ ~AllocatingPainter()
1667+ {
1668+ buffer_stream->remove_buffer(front_buffer);
1669+ buffer_stream->remove_buffer(back_buffer);
1670+ }
1671+
1672+ std::shared_ptr<frontend::BufferStream> const buffer_stream;
1673+ mg::BufferProperties properties;
1674+ mg::BufferID front_buffer;
1675+ mg::BufferID back_buffer;
1676+};
1677+
1678+void mir::examples::CanonicalSurfaceInfoCopy::init_titlebar(std::shared_ptr<scene::Surface> const& surface)
1679+{
1680+ auto stream = surface->primary_buffer_stream();
1681+ try
1682+ {
1683+ stream_painter = std::make_shared<AllocatingPainter>(stream, surface->size());
1684+ }
1685+ catch (...)
1686+ {
1687+ stream_painter = std::make_shared<SwappingPainter>(stream);
1688+ }
1689+}
1690+
1691+void mir::examples::CanonicalSurfaceInfoCopy::paint_titlebar(int intensity)
1692+{
1693+ stream_painter->paint(intensity);
1694+}
1695+
1696+void me::CanonicalSurfaceInfoCopy::constrain_resize(
1697+ std::shared_ptr<ms::Surface> const& surface,
1698+ Point& requested_pos,
1699+ Size& requested_size,
1700+ bool const left_resize,
1701+ bool const top_resize,
1702+ Rectangle const& /*bounds*/) const
1703+{
1704+ Point new_pos = requested_pos;
1705+ Size new_size = requested_size;
1706+
1707+ if (min_aspect.is_set())
1708+ {
1709+ auto const ar = min_aspect.value();
1710+
1711+ auto const error = new_size.height.as_int()*long(ar.width) - new_size.width.as_int()*long(ar.height);
1712+
1713+ if (error > 0)
1714+ {
1715+ // Add (denominator-1) to numerator to ensure rounding up
1716+ auto const width_correction = (error+(ar.height-1))/ar.height;
1717+ auto const height_correction = (error+(ar.width-1))/ar.width;
1718+
1719+ if (width_correction < height_correction)
1720+ {
1721+ new_size.width = new_size.width + DeltaX(width_correction);
1722+ }
1723+ else
1724+ {
1725+ new_size.height = new_size.height - DeltaY(height_correction);
1726+ }
1727+ }
1728+ }
1729+
1730+ if (max_aspect.is_set())
1731+ {
1732+ auto const ar = max_aspect.value();
1733+
1734+ auto const error = new_size.width.as_int()*long(ar.height) - new_size.height.as_int()*long(ar.width);
1735+
1736+ if (error > 0)
1737+ {
1738+ // Add (denominator-1) to numerator to ensure rounding up
1739+ auto const height_correction = (error+(ar.width-1))/ar.width;
1740+ auto const width_correction = (error+(ar.height-1))/ar.height;
1741+
1742+ if (width_correction < height_correction)
1743+ {
1744+ new_size.width = new_size.width - DeltaX(width_correction);
1745+ }
1746+ else
1747+ {
1748+ new_size.height = new_size.height + DeltaY(height_correction);
1749+ }
1750+ }
1751+ }
1752+
1753+ if (min_width > new_size.width)
1754+ new_size.width = min_width;
1755+
1756+ if (min_height > new_size.height)
1757+ new_size.height = min_height;
1758+
1759+ if (max_width < new_size.width)
1760+ new_size.width = max_width;
1761+
1762+ if (max_height < new_size.height)
1763+ new_size.height = max_height;
1764+
1765+ if (width_inc.is_set())
1766+ {
1767+ auto const width = new_size.width.as_int() - min_width.as_int();
1768+ auto inc = width_inc.value().as_int();
1769+ if (width % inc)
1770+ new_size.width = min_width + DeltaX{inc*(((2L*width + inc)/2)/inc)};
1771+ }
1772+
1773+ if (height_inc.is_set())
1774+ {
1775+ auto const height = new_size.height.as_int() - min_height.as_int();
1776+ auto inc = height_inc.value().as_int();
1777+ if (height % inc)
1778+ new_size.height = min_height + DeltaY{inc*(((2L*height + inc)/2)/inc)};
1779+ }
1780+
1781+ if (left_resize)
1782+ new_pos.x += new_size.width - requested_size.width;
1783+
1784+ if (top_resize)
1785+ new_pos.y += new_size.height - requested_size.height;
1786+
1787+ // placeholder - constrain onscreen
1788+
1789+ switch (state)
1790+ {
1791+ case mir_surface_state_restored:
1792+ break;
1793+
1794+ // "A vertically maximised surface is anchored to the top and bottom of
1795+ // the available workspace and can have any width."
1796+ case mir_surface_state_vertmaximized:
1797+ new_pos.y = surface->top_left().y;
1798+ new_size.height = surface->size().height;
1799+ break;
1800+
1801+ // "A horizontally maximised surface is anchored to the left and right of
1802+ // the available workspace and can have any height"
1803+ case mir_surface_state_horizmaximized:
1804+ new_pos.x = surface->top_left().x;
1805+ new_size.width = surface->size().width;
1806+ break;
1807+
1808+ // "A maximised surface is anchored to the top, bottom, left and right of the
1809+ // available workspace. For example, if the launcher is always-visible then
1810+ // the left-edge of the surface is anchored to the right-edge of the launcher."
1811+ case mir_surface_state_maximized:
1812+ default:
1813+ new_pos.x = surface->top_left().x;
1814+ new_pos.y = surface->top_left().y;
1815+ new_size.width = surface->size().width;
1816+ new_size.height = surface->size().height;
1817+ break;
1818+ }
1819+
1820+ requested_pos = new_pos;
1821+ requested_size = new_size;
1822+}
1823+
1824+bool me::CanonicalSurfaceInfoCopy::needs_titlebar(MirSurfaceType type)
1825+{
1826+ switch (type)
1827+ {
1828+ case mir_surface_type_freestyle:
1829+ case mir_surface_type_menu:
1830+ case mir_surface_type_inputmethod:
1831+ case mir_surface_type_gloss:
1832+ case mir_surface_type_tip:
1833+ // No decorations for these surface types
1834+ return false;
1835+ default:
1836+ return true;
1837+ }
1838+}
1839
1840=== added file 'examples/server_example_canonical_surface_info.h'
1841--- examples/server_example_canonical_surface_info.h 1970-01-01 00:00:00 +0000
1842+++ examples/server_example_canonical_surface_info.h 2015-11-25 21:33:30 +0000
1843@@ -0,0 +1,91 @@
1844+/*
1845+ * Copyright © 2015 Canonical Ltd.
1846+ *
1847+ * This program is free software: you can redistribute it and/or modify it
1848+ * under the terms of the GNU General Public License version 3,
1849+ * as published by the Free Software Foundation.
1850+ *
1851+ * This program is distributed in the hope that it will be useful,
1852+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1853+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1854+ * GNU General Public License for more details.
1855+ *
1856+ * You should have received a copy of the GNU General Public License
1857+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1858+ *
1859+ * Authored by: Alan Griffiths <alan@octopull.co.uk>
1860+ */
1861+
1862+#ifndef MIR_SERVER_EXAMPLE_CANONICAL_SURFACE_INFO_H
1863+#define MIR_SERVER_EXAMPLE_CANONICAL_SURFACE_INFO_H
1864+
1865+#include "mir/geometry/rectangles.h"
1866+#include "mir/optional_value.h"
1867+#include "mir/shell/surface_specification.h"
1868+
1869+namespace mir
1870+{
1871+namespace scene { class Session; class Surface; class SurfaceCreationParameters; }
1872+namespace examples
1873+{
1874+struct CanonicalSurfaceInfoCopy
1875+{
1876+ CanonicalSurfaceInfoCopy(
1877+ std::shared_ptr <scene::Session> const& session,
1878+ std::shared_ptr <scene::Surface> const& surface,
1879+ scene::SurfaceCreationParameters const& params);
1880+
1881+ bool can_be_active() const;
1882+
1883+ bool can_morph_to(MirSurfaceType new_type) const;
1884+
1885+ bool must_have_parent() const;
1886+
1887+ bool must_not_have_parent() const;
1888+
1889+ bool is_visible() const;
1890+
1891+ static bool needs_titlebar(MirSurfaceType type);
1892+
1893+ void constrain_resize(
1894+ std::shared_ptr <scene::Surface> const& surface,
1895+ geometry::Point& requested_pos,
1896+ geometry::Size& requested_size,
1897+ const bool left_resize,
1898+ const bool top_resize,
1899+ geometry::Rectangle const& bounds) const;
1900+
1901+ MirSurfaceType type;
1902+ MirSurfaceState state;
1903+ geometry::Rectangle restore_rect;
1904+ std::weak_ptr <scene::Session> session;
1905+ std::weak_ptr <scene::Surface> parent;
1906+ std::vector <std::weak_ptr<scene::Surface>> children;
1907+ std::shared_ptr <scene::Surface> titlebar;
1908+ frontend::SurfaceId titlebar_id;
1909+ bool is_titlebar = false;
1910+ geometry::Width min_width;
1911+ geometry::Height min_height;
1912+ geometry::Width max_width;
1913+ geometry::Height max_height;
1914+ mir::optional_value<geometry::DeltaX> width_inc;
1915+ mir::optional_value<geometry::DeltaY> height_inc;
1916+ mir::optional_value<shell::SurfaceAspectRatio> min_aspect;
1917+ mir::optional_value<shell::SurfaceAspectRatio> max_aspect;
1918+
1919+ void init_titlebar(std::shared_ptr <scene::Surface> const& surface);
1920+
1921+ void paint_titlebar(int intensity);
1922+
1923+private:
1924+
1925+ struct StreamPainter;
1926+ struct AllocatingPainter;
1927+ struct SwappingPainter;
1928+
1929+ std::shared_ptr <StreamPainter> stream_painter;
1930+};
1931+}
1932+}
1933+
1934+#endif //MIR_SERVER_EXAMPLE_CANONICAL_SURFACE_INFO_H
1935
1936=== modified file 'examples/server_example_canonical_window_manager.cpp'
1937--- examples/server_example_canonical_window_manager.cpp 2015-10-02 01:56:04 +0000
1938+++ examples/server_example_canonical_window_manager.cpp 2015-11-25 21:33:30 +0000
1939@@ -18,13 +18,8 @@
1940
1941 #include "server_example_canonical_window_manager.h"
1942
1943-#include "mir/scene/surface.h"
1944 #include "mir/shell/surface_ready_observer.h"
1945 #include "mir/shell/display_layout.h"
1946-#include "mir/shell/surface_specification.h"
1947-#include "mir/geometry/displacement.h"
1948-
1949-#include "mir/graphics/buffer.h"
1950
1951 #include <linux/input.h>
1952 #include <csignal>
1953@@ -52,148 +47,7 @@
1954 window_position.y - DeltaY(title_bar_height)
1955 };
1956 }
1957-
1958-bool needs_titlebar(MirSurfaceType type)
1959-{
1960- switch (type)
1961- {
1962- case mir_surface_type_freestyle:
1963- case mir_surface_type_menu:
1964- case mir_surface_type_inputmethod:
1965- case mir_surface_type_gloss:
1966- case mir_surface_type_tip:
1967- // No decorations for these surface types
1968- return false;
1969- default:
1970- return true;
1971- }
1972-}
1973-}
1974-
1975-me::CanonicalSurfaceInfoCopy::CanonicalSurfaceInfoCopy(
1976- std::shared_ptr<scene::Session> const& session,
1977- std::shared_ptr<scene::Surface> const& surface,
1978- scene::SurfaceCreationParameters const& params) :
1979- type{surface->type()},
1980- state{surface->state()},
1981- restore_rect{surface->top_left(), surface->size()},
1982- session{session},
1983- parent{params.parent},
1984- min_width{params.min_width.is_set() ? params.min_width.value() : Width{}},
1985- min_height{params.min_height.is_set() ? params.min_height.value() : Height{}},
1986- max_width{params.max_width.is_set() ? params.max_width.value() : Width{std::numeric_limits<int>::max()}},
1987- max_height{params.max_height.is_set() ? params.max_height.value() : Height{std::numeric_limits<int>::max()}},
1988- width_inc{params.width_inc},
1989- height_inc{params.height_inc},
1990- min_aspect{params.min_aspect},
1991- max_aspect{params.max_aspect}
1992-{
1993-}
1994-
1995-bool me::CanonicalSurfaceInfoCopy::can_be_active() const
1996-{
1997- switch (type)
1998- {
1999- case mir_surface_type_normal: /**< AKA "regular" */
2000- case mir_surface_type_utility: /**< AKA "floating" */
2001- case mir_surface_type_dialog:
2002- case mir_surface_type_satellite: /**< AKA "toolbox"/"toolbar" */
2003- case mir_surface_type_freestyle:
2004- case mir_surface_type_menu:
2005- case mir_surface_type_inputmethod: /**< AKA "OSK" or handwriting etc. */
2006- return true;
2007-
2008- case mir_surface_type_gloss:
2009- case mir_surface_type_tip: /**< AKA "tooltip" */
2010- default:
2011- // Cannot have input focus
2012- return false;
2013- }
2014-}
2015-
2016-bool me::CanonicalSurfaceInfoCopy::must_have_parent() const
2017-{
2018- switch (type)
2019- {
2020- case mir_surface_type_overlay:;
2021- case mir_surface_type_inputmethod:
2022- case mir_surface_type_satellite:
2023- case mir_surface_type_tip:
2024- return true;
2025-
2026- default:
2027- return false;
2028- }
2029-}
2030-
2031-bool me::CanonicalSurfaceInfoCopy::can_morph_to(MirSurfaceType new_type) const
2032-{
2033- switch (new_type)
2034- {
2035- case mir_surface_type_normal:
2036- case mir_surface_type_utility:
2037- case mir_surface_type_satellite:
2038- switch (type)
2039- {
2040- case mir_surface_type_normal:
2041- case mir_surface_type_utility:
2042- case mir_surface_type_dialog:
2043- case mir_surface_type_satellite:
2044- return true;
2045-
2046- default:
2047- break;
2048- }
2049- break;
2050-
2051- case mir_surface_type_dialog:
2052- switch (type)
2053- {
2054- case mir_surface_type_normal:
2055- case mir_surface_type_utility:
2056- case mir_surface_type_dialog:
2057- case mir_surface_type_popover:
2058- case mir_surface_type_satellite:
2059- return true;
2060-
2061- default:
2062- break;
2063- }
2064- break;
2065-
2066- default:
2067- break;
2068- }
2069-
2070- return false;
2071-}
2072-
2073-bool me::CanonicalSurfaceInfoCopy::must_not_have_parent() const
2074-{
2075- switch (type)
2076- {
2077- case mir_surface_type_normal:
2078- case mir_surface_type_utility:
2079- return true;
2080-
2081- default:
2082- return false;
2083- }
2084-}
2085-
2086-bool me::CanonicalSurfaceInfoCopy::is_visible() const
2087-{
2088- switch (state)
2089- {
2090- case mir_surface_state_hidden:
2091- case mir_surface_state_minimized:
2092- return false;
2093- default:
2094- break;
2095- }
2096- return true;
2097-}
2098-
2099+}
2100
2101 me::CanonicalWindowManagerPolicyCopy::CanonicalWindowManagerPolicyCopy(
2102 Tools* const tools,
2103@@ -234,7 +88,7 @@
2104 {
2105 auto parameters = request_parameters;
2106 auto surf_type = parameters.type.is_set() ? parameters.type.value() : mir_surface_type_normal;
2107- bool const needs_titlebar = ::needs_titlebar(surf_type);
2108+ bool const needs_titlebar = CanonicalSurfaceInfoCopy::needs_titlebar(surf_type);
2109
2110 if (needs_titlebar)
2111 parameters.size.height = parameters.size.height + DeltaY{title_bar_height};
2112@@ -374,57 +228,13 @@
2113 return parameters;
2114 }
2115
2116-//TODO: provide an easier way for the server to write to a surface!
2117-//TODO: this is painful to use mg::Buffer::write()
2118-struct mir::examples::CanonicalSurfaceInfoCopy::PaintingImpl
2119-{
2120- PaintingImpl(std::shared_ptr<frontend::BufferStream> const& buffer_stream) :
2121- buffer_stream{buffer_stream}, buffer{nullptr}
2122- {
2123- swap_buffers();
2124- }
2125-
2126- void swap_buffers()
2127- {
2128- auto const callback = [this](mir::graphics::Buffer* new_buffer)
2129- {
2130- buffer.store(new_buffer);
2131- };
2132-
2133- buffer_stream->swap_buffers(buffer, callback);
2134- }
2135-
2136- std::shared_ptr<frontend::BufferStream> const buffer_stream;
2137- std::atomic<graphics::Buffer*> buffer;
2138-};
2139-
2140-void mir::examples::CanonicalSurfaceInfoCopy::init_titlebar(std::shared_ptr<scene::Surface> const& surface)
2141-{
2142- painting_impl = std::make_shared<PaintingImpl>(surface->primary_buffer_stream());
2143-}
2144-
2145-void mir::examples::CanonicalSurfaceInfoCopy::paint_titlebar(int intensity)
2146-{
2147- if (auto const buf = painting_impl->buffer.load())
2148- {
2149- auto const format = painting_impl->buffer_stream->pixel_format();
2150- auto const sz = buf->size().height.as_int() *
2151- buf->size().width.as_int() * MIR_BYTES_PER_PIXEL(format);
2152-
2153- std::vector<unsigned char> pixels(sz, intensity);
2154- buf->write(pixels.data(), sz);
2155-
2156- painting_impl->swap_buffers();
2157- }
2158-}
2159-
2160 void me::CanonicalWindowManagerPolicyCopy::generate_decorations_for(
2161 std::shared_ptr<scene::Session> const& session,
2162 std::shared_ptr<scene::Surface> const& surface,
2163 CanonicalSurfaceInfoMap& surface_map,
2164 std::function<frontend::SurfaceId(std::shared_ptr<scene::Session> const& session, scene::SurfaceCreationParameters const& params)> const& build)
2165 {
2166- if (!needs_titlebar(surface->type()))
2167+ if (!CanonicalSurfaceInfoCopy::needs_titlebar(surface->type()))
2168 return;
2169
2170 auto format = mir_pixel_format_xrgb_8888;
2171@@ -595,10 +405,11 @@
2172 }
2173 }
2174
2175+ session->destroy_surface(surface);
2176 if (info.titlebar)
2177 {
2178+ session->destroy_surface(info.titlebar_id);
2179 tools->forget(info.titlebar);
2180- session->destroy_surface(info.titlebar_id);
2181 }
2182
2183 if (!--tools->info_for(session).surfaces && session == tools->focused_session())
2184@@ -717,6 +528,13 @@
2185 old_cursor = cursor;
2186 }
2187
2188+void me::CanonicalWindowManagerPolicyCopy::handle_raise_surface(
2189+ std::shared_ptr<ms::Session> const& /*session*/,
2190+ std::shared_ptr<ms::Surface> const& surface)
2191+{
2192+ select_active_surface(surface);
2193+}
2194+
2195 bool me::CanonicalWindowManagerPolicyCopy::handle_keyboard_event(MirKeyboardEvent const* event)
2196 {
2197 auto const action = mir_keyboard_event_action(event);
2198@@ -1001,134 +819,6 @@
2199 return true;
2200 }
2201
2202-void me::CanonicalSurfaceInfoCopy::constrain_resize(
2203- std::shared_ptr<ms::Surface> const& surface,
2204- Point& requested_pos,
2205- Size& requested_size,
2206- bool const left_resize,
2207- bool const top_resize,
2208- Rectangle const& /*bounds*/) const
2209-{
2210- Point new_pos = requested_pos;
2211- Size new_size = requested_size;
2212-
2213- if (min_aspect.is_set())
2214- {
2215- auto const ar = min_aspect.value();
2216-
2217- auto const error = new_size.height.as_int()*long(ar.width) - new_size.width.as_int()*long(ar.height);
2218-
2219- if (error > 0)
2220- {
2221- // Add (denominator-1) to numerator to ensure rounding up
2222- auto const width_correction = (error+(ar.height-1))/ar.height;
2223- auto const height_correction = (error+(ar.width-1))/ar.width;
2224-
2225- if (width_correction < height_correction)
2226- {
2227- new_size.width = new_size.width + DeltaX(width_correction);
2228- }
2229- else
2230- {
2231- new_size.height = new_size.height - DeltaY(height_correction);
2232- }
2233- }
2234- }
2235-
2236- if (max_aspect.is_set())
2237- {
2238- auto const ar = max_aspect.value();
2239-
2240- auto const error = new_size.width.as_int()*long(ar.height) - new_size.height.as_int()*long(ar.width);
2241-
2242- if (error > 0)
2243- {
2244- // Add (denominator-1) to numerator to ensure rounding up
2245- auto const height_correction = (error+(ar.width-1))/ar.width;
2246- auto const width_correction = (error+(ar.height-1))/ar.height;
2247-
2248- if (width_correction < height_correction)
2249- {
2250- new_size.width = new_size.width - DeltaX(width_correction);
2251- }
2252- else
2253- {
2254- new_size.height = new_size.height + DeltaY(height_correction);
2255- }
2256- }
2257- }
2258-
2259- if (min_width > new_size.width)
2260- new_size.width = min_width;
2261-
2262- if (min_height > new_size.height)
2263- new_size.height = min_height;
2264-
2265- if (max_width < new_size.width)
2266- new_size.width = max_width;
2267-
2268- if (max_height < new_size.height)
2269- new_size.height = max_height;
2270-
2271- if (width_inc.is_set())
2272- {
2273- auto const width = new_size.width.as_int() - min_width.as_int();
2274- auto inc = width_inc.value().as_int();
2275- if (width % inc)
2276- new_size.width = min_width + DeltaX{inc*(((2L*width + inc)/2)/inc)};
2277- }
2278-
2279- if (height_inc.is_set())
2280- {
2281- auto const height = new_size.height.as_int() - min_height.as_int();
2282- auto inc = height_inc.value().as_int();
2283- if (height % inc)
2284- new_size.height = min_height + DeltaY{inc*(((2L*height + inc)/2)/inc)};
2285- }
2286-
2287- if (left_resize)
2288- new_pos.x += new_size.width - requested_size.width;
2289-
2290- if (top_resize)
2291- new_pos.y += new_size.height - requested_size.height;
2292-
2293- // placeholder - constrain onscreen
2294-
2295- switch (state)
2296- {
2297- case mir_surface_state_restored:
2298- break;
2299-
2300- // "A vertically maximised surface is anchored to the top and bottom of
2301- // the available workspace and can have any width."
2302- case mir_surface_state_vertmaximized:
2303- new_pos.y = surface->top_left().y;
2304- new_size.height = surface->size().height;
2305- break;
2306-
2307- // "A horizontally maximised surface is anchored to the left and right of
2308- // the available workspace and can have any height"
2309- case mir_surface_state_horizmaximized:
2310- new_pos.x = surface->top_left().x;
2311- new_size.width = surface->size().width;
2312- break;
2313-
2314- // "A maximised surface is anchored to the top, bottom, left and right of the
2315- // available workspace. For example, if the launcher is always-visible then
2316- // the left-edge of the surface is anchored to the right-edge of the launcher."
2317- case mir_surface_state_maximized:
2318- default:
2319- new_pos.x = surface->top_left().x;
2320- new_pos.y = surface->top_left().y;
2321- new_size.width = surface->size().width;
2322- new_size.height = surface->size().height;
2323- break;
2324- }
2325-
2326- requested_pos = new_pos;
2327- requested_size = new_size;
2328-}
2329-
2330 void me::CanonicalWindowManagerPolicyCopy::apply_resize(
2331 std::shared_ptr<ms::Surface> const& surface,
2332 std::shared_ptr<ms::Surface> const& titlebar,
2333
2334=== modified file 'examples/server_example_canonical_window_manager.h'
2335--- examples/server_example_canonical_window_manager.h 2015-10-02 01:56:04 +0000
2336+++ examples/server_example_canonical_window_manager.h 2015-11-25 21:33:30 +0000
2337@@ -20,6 +20,7 @@
2338 #define MIR_EXAMPLE_CANONICAL_WINDOW_MANAGER_H_
2339
2340 #include "server_example_basic_window_manager.h"
2341+#include "server_example_canonical_surface_info.h"
2342
2343 #include "mir/geometry/displacement.h"
2344
2345@@ -38,56 +39,6 @@
2346 int surfaces{0};
2347 };
2348
2349-struct CanonicalSurfaceInfoCopy
2350-{
2351- CanonicalSurfaceInfoCopy(
2352- std::shared_ptr<scene::Session> const& session,
2353- std::shared_ptr<scene::Surface> const& surface,
2354- scene::SurfaceCreationParameters const& params);
2355-
2356- bool can_be_active() const;
2357-
2358- bool can_morph_to(MirSurfaceType new_type) const;
2359- bool must_have_parent() const;
2360- bool must_not_have_parent() const;
2361- bool is_visible() const;
2362-
2363- void constrain_resize(
2364- std::shared_ptr<scene::Surface> const& surface,
2365- geometry::Point& requested_pos,
2366- geometry::Size& requested_size,
2367- const bool left_resize,
2368- const bool top_resize,
2369- geometry::Rectangle const& bounds) const;
2370-
2371- MirSurfaceType type;
2372- MirSurfaceState state;
2373- geometry::Rectangle restore_rect;
2374- std::weak_ptr<scene::Session> session;
2375- std::weak_ptr<scene::Surface> parent;
2376- std::vector<std::weak_ptr<scene::Surface>> children;
2377- std::shared_ptr<scene::Surface> titlebar;
2378- frontend::SurfaceId titlebar_id;
2379- bool is_titlebar = false;
2380- geometry::Width min_width;
2381- geometry::Height min_height;
2382- geometry::Width max_width;
2383- geometry::Height max_height;
2384- mir::optional_value<geometry::DeltaX> width_inc;
2385- mir::optional_value<geometry::DeltaY> height_inc;
2386- mir::optional_value<shell::SurfaceAspectRatio> min_aspect;
2387- mir::optional_value<shell::SurfaceAspectRatio> max_aspect;
2388-
2389- void init_titlebar(std::shared_ptr<scene::Surface> const& surface);
2390- void paint_titlebar(int intensity);
2391-
2392-private:
2393-
2394- struct PaintingImpl;
2395-
2396- std::shared_ptr<PaintingImpl> painting_impl;
2397-};
2398-
2399 // standard window management algorithm:
2400 // o Switch apps: tap or click on the corresponding tile
2401 // o Move window: Alt-leftmousebutton drag
2402@@ -139,6 +90,10 @@
2403
2404 bool handle_pointer_event(MirPointerEvent const* event);
2405
2406+ void handle_raise_surface(
2407+ std::shared_ptr<scene::Session> const& session,
2408+ std::shared_ptr<scene::Surface> const& surface);
2409+
2410 void generate_decorations_for(
2411 std::shared_ptr<scene::Session> const& session,
2412 std::shared_ptr<scene::Surface> const& surface,
2413
2414=== added file 'examples/server_example_cursor_images.cpp'
2415--- examples/server_example_cursor_images.cpp 1970-01-01 00:00:00 +0000
2416+++ examples/server_example_cursor_images.cpp 2015-11-25 21:33:30 +0000
2417@@ -0,0 +1,57 @@
2418+/*
2419+ * Copyright © 2015 Canonical Ltd.
2420+ *
2421+ * This program is free software: you can redistribute it and/or modify it
2422+ * under the terms of the GNU General Public License version 3,
2423+ * as published by the Free Software Foundation.
2424+ *
2425+ * This program is distributed in the hope that it will be useful,
2426+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2427+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2428+ * GNU General Public License for more details.
2429+ *
2430+ * You should have received a copy of the GNU General Public License
2431+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2432+ *
2433+ * Authored by: Alan Griffiths <alan@octopull.co.uk>
2434+ */
2435+
2436+#include "server_example_cursor_images.h"
2437+#include "xcursor_loader.h"
2438+
2439+#include "mir/server.h"
2440+#include "mir/options/option.h"
2441+
2442+#include <mir_toolkit/cursors.h>
2443+
2444+namespace mi = mir::input;
2445+
2446+namespace
2447+{
2448+char const* const xcursor_theme = "x-cursor-theme";
2449+char const* const xcursor_description = "X Cursor theme to load [default, DMZ-White, DMZ-Black, ...]";
2450+
2451+bool has_default_cursor(mi::CursorImages& images)
2452+{
2453+ if (images.image(mir_default_cursor_name, mi::default_cursor_size))
2454+ return true;
2455+ return false;
2456+}
2457+}
2458+
2459+void mir::examples::add_x_cursor_images(Server& server)
2460+{
2461+ server.add_configuration_option(xcursor_theme, xcursor_description, "default");
2462+
2463+ server.override_the_cursor_images([&]
2464+ {
2465+ auto const theme = server.get_options()->get<std::string>(xcursor_theme);
2466+
2467+ std::shared_ptr<mi::CursorImages> const xcursor_loader{std::make_shared<XCursorLoader>(theme)};
2468+
2469+ if (has_default_cursor(*xcursor_loader))
2470+ return xcursor_loader;
2471+ else
2472+ return std::shared_ptr<mi::CursorImages>{};
2473+ });
2474+}
2475
2476=== added file 'examples/server_example_cursor_images.h'
2477--- examples/server_example_cursor_images.h 1970-01-01 00:00:00 +0000
2478+++ examples/server_example_cursor_images.h 2015-11-25 21:33:30 +0000
2479@@ -0,0 +1,33 @@
2480+/*
2481+ * Copyright © 2015 Canonical Ltd.
2482+ *
2483+ * This program is free software: you can redistribute it and/or modify it
2484+ * under the terms of the GNU General Public License version 3,
2485+ * as published by the Free Software Foundation.
2486+ *
2487+ * This program is distributed in the hope that it will be useful,
2488+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2489+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2490+ * GNU General Public License for more details.
2491+ *
2492+ * You should have received a copy of the GNU General Public License
2493+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2494+ *
2495+ * Authored by: Alan Griffiths <alan@octopull.co.uk>
2496+ */
2497+
2498+#ifndef MIR_EXAMPLE_CURSOR_IMAGES_H
2499+#define MIR_EXAMPLE_CURSOR_IMAGES_H
2500+
2501+namespace mir
2502+{
2503+class Server;
2504+
2505+namespace examples
2506+{
2507+void add_x_cursor_images(Server& server);
2508+}
2509+} // namespace mir
2510+
2511+
2512+#endif //MIR_EXAMPLE_CURSOR_IMAGES_H
2513
2514=== modified file 'examples/server_example_tiling_window_manager.cpp'
2515--- examples/server_example_tiling_window_manager.cpp 2015-10-02 01:56:04 +0000
2516+++ examples/server_example_tiling_window_manager.cpp 2015-11-25 21:33:30 +0000
2517@@ -34,16 +34,6 @@
2518 ///\example server_example_tiling_window_manager.cpp
2519 /// Demonstrate implementing a simple tiling algorithm
2520
2521-me::TilingSurfaceInfo::TilingSurfaceInfo(
2522- std::shared_ptr<scene::Session> const& session,
2523- std::shared_ptr<scene::Surface> const& surface,
2524- scene::SurfaceCreationParameters const& /*params*/) :
2525- session{session},
2526- state{mir_surface_state_restored},
2527- restore_rect{surface->top_left(), surface->size()}
2528-{
2529-}
2530-
2531 me::TilingWindowManagerPolicy::TilingWindowManagerPolicy(Tools* const tools) :
2532 tools{tools}
2533 {
2534@@ -150,6 +140,8 @@
2535 }
2536 }
2537
2538+ session->destroy_surface(surface);
2539+
2540 if (surfaces.empty() && session == tools->focused_session())
2541 {
2542 tools->focus_next_session();
2543@@ -246,6 +238,14 @@
2544 old_cursor = cursor;
2545 }
2546
2547+void me::TilingWindowManagerPolicy::handle_raise_surface(
2548+ std::shared_ptr<ms::Session> const& session,
2549+ std::shared_ptr<ms::Surface> const& surface)
2550+{
2551+ tools->set_focus_to(session, surface);
2552+ tools->raise({surface});
2553+}
2554+
2555 bool me::TilingWindowManagerPolicy::handle_keyboard_event(MirKeyboardEvent const* event)
2556 {
2557 auto const action = mir_keyboard_event_action(event);
2558
2559=== modified file 'examples/server_example_tiling_window_manager.h'
2560--- examples/server_example_tiling_window_manager.h 2015-10-02 01:56:04 +0000
2561+++ examples/server_example_tiling_window_manager.h 2015-11-25 21:33:30 +0000
2562@@ -20,6 +20,7 @@
2563 #define MIR_EXAMPLE_TILING_WINDOW_MANAGER_H_
2564
2565 #include "server_example_basic_window_manager.h"
2566+#include "server_example_canonical_surface_info.h"
2567
2568 ///\example server_example_tiling_window_manager.h
2569 /// Demonstrate implementing a simple tiling algorithm
2570@@ -34,18 +35,6 @@
2571 std::vector<std::weak_ptr<scene::Surface>> surfaces;
2572 };
2573
2574-struct TilingSurfaceInfo
2575-{
2576- TilingSurfaceInfo(
2577- std::shared_ptr<scene::Session> const& session,
2578- std::shared_ptr<scene::Surface> const& surface,
2579- scene::SurfaceCreationParameters const& params);
2580-
2581- std::weak_ptr<scene::Session> session;
2582- MirSurfaceState state;
2583- geometry::Rectangle restore_rect;
2584-};
2585-
2586 // simple tiling algorithm:
2587 // o Switch apps: tap or click on the corresponding tile
2588 // o Move window: Alt-leftmousebutton drag
2589@@ -57,9 +46,9 @@
2590 class TilingWindowManagerPolicy
2591 {
2592 public:
2593- using Tools = BasicWindowManagerToolsCopy<TilingSessionInfo, TilingSurfaceInfo>;
2594+ using Tools = BasicWindowManagerToolsCopy<TilingSessionInfo, CanonicalSurfaceInfoCopy>;
2595 using TilingSessionInfoMap = typename SessionTo<TilingSessionInfo>::type;
2596- using TilingSurfaceInfoMap = typename SurfaceTo<TilingSurfaceInfo>::type;
2597+ using TilingSurfaceInfoMap = typename SurfaceTo<CanonicalSurfaceInfoCopy>::type;
2598
2599 explicit TilingWindowManagerPolicy(Tools* const tools);
2600
2601@@ -95,6 +84,10 @@
2602
2603 bool handle_pointer_event(MirPointerEvent const* event);
2604
2605+ void handle_raise_surface(
2606+ std::shared_ptr<scene::Session> const& session,
2607+ std::shared_ptr<scene::Surface> const& surface);
2608+
2609 void generate_decorations_for(
2610 std::shared_ptr<scene::Session> const& session, std::shared_ptr<scene::Surface> const& surface,
2611 TilingSurfaceInfoMap& surface_info,
2612@@ -130,6 +123,8 @@
2613
2614 geometry::Point old_cursor{};
2615 };
2616+
2617+using TilingWindowManager = BasicWindowManagerCopy<TilingWindowManagerPolicy, TilingSessionInfo, CanonicalSurfaceInfoCopy>;
2618 }
2619 }
2620
2621
2622=== modified file 'examples/server_example_window_management.cpp'
2623--- examples/server_example_window_management.cpp 2015-10-02 01:56:04 +0000
2624+++ examples/server_example_window_management.cpp 2015-11-25 21:33:30 +0000
2625@@ -20,7 +20,6 @@
2626
2627 #include "server_example_tiling_window_manager.h"
2628 #include "server_example_canonical_window_manager.h"
2629-#include "server_example_basic_window_manager.h"
2630
2631 #include "mir/abnormal_exit.h"
2632 #include "mir/server.h"
2633@@ -102,7 +101,8 @@
2634 {
2635 }
2636
2637- void handle_delete_surface(std::shared_ptr<ms::Session> const& /*session*/, std::weak_ptr<ms::Surface> const& /*surface*/) {}
2638+ void handle_delete_surface(std::shared_ptr<ms::Session> const& session, std::weak_ptr<ms::Surface> const& surface)
2639+ { session->destroy_surface(surface); }
2640
2641 int handle_set_state(std::shared_ptr<ms::Surface> const& /*surface*/, MirSurfaceState value)
2642 { return value; }
2643@@ -113,6 +113,12 @@
2644
2645 bool handle_pointer_event(MirPointerEvent const* /*event*/) { return false; }
2646
2647+ void handle_raise_surface(
2648+ std::shared_ptr<ms::Session> const& /*session*/,
2649+ std::shared_ptr<ms::Surface> const& /*surface*/)
2650+ {
2651+ }
2652+
2653 void generate_decorations_for(
2654 std::shared_ptr<ms::Session> const&,
2655 std::shared_ptr<ms::Surface> const&,
2656@@ -126,7 +132,6 @@
2657
2658 }
2659
2660-using TilingWindowManager = me::BasicWindowManagerCopy<me::TilingWindowManagerPolicy, me::TilingSessionInfo, me::TilingSurfaceInfo>;
2661 using FullscreenWindowManager = me::BasicWindowManagerCopy<FullscreenWindowManagerPolicy, NullSessionInfo, NullSurfaceInfo>;
2662 using CanonicalWindowManager = me::BasicWindowManagerCopy<me::CanonicalWindowManagerPolicyCopy, me::CanonicalSessionInfoCopy, me::CanonicalSurfaceInfoCopy>;
2663
2664
2665=== renamed file '3rd_party/xcursor/xcursor.c' => 'examples/xcursor.c'
2666=== renamed file '3rd_party/xcursor/xcursor.h' => 'examples/xcursor.h'
2667=== renamed file 'src/server/input/xcursor_loader.cpp' => 'examples/xcursor_loader.cpp'
2668--- src/server/input/xcursor_loader.cpp 2015-07-27 21:23:24 +0000
2669+++ examples/xcursor_loader.cpp 2015-11-25 21:33:30 +0000
2670@@ -32,9 +32,10 @@
2671 // we refer to them via their _ prefixed version, i.e. _XcursorImage
2672 extern "C"
2673 {
2674-#include <xcursor.h>
2675+#include "xcursor.h"
2676 }
2677
2678+namespace me = mir::examples;
2679 namespace mg = mir::graphics;
2680 namespace mi = mir::input;
2681 namespace geom = mir::geometry;
2682@@ -148,13 +149,18 @@
2683 }
2684 }
2685
2686-mi::XCursorLoader::XCursorLoader()
2687+me::XCursorLoader::XCursorLoader()
2688 {
2689 load_cursor_theme("default");
2690 }
2691
2692+me::XCursorLoader::XCursorLoader(std::string const& theme)
2693+{
2694+ load_cursor_theme(theme);
2695+}
2696+
2697 // Each XcursorImages represents images for the different sizes of a given symbolic cursor.
2698-void mi::XCursorLoader::load_appropriately_sized_image(_XcursorImages *images)
2699+void me::XCursorLoader::load_appropriately_sized_image(_XcursorImages *images)
2700 {
2701 // We would rather take this lock in load_cursor_theme but the Xcursor lib style
2702 // makes it difficult to use our standard 'pass the lg around to _locked members' pattern
2703@@ -184,7 +190,7 @@
2704 loaded_images[std::string(images->name)] = std::make_shared<XCursorImage>(image_of_correct_size, saved_xcursor_library_resource);
2705 }
2706
2707-void mi::XCursorLoader::load_cursor_theme(std::string const& theme_name)
2708+void me::XCursorLoader::load_cursor_theme(std::string const& theme_name)
2709 {
2710 // Cursors are named by their square dimension...called the nominal size in XCursor terminology, so we just look up by width.
2711 // Later we verify the actual size.
2712@@ -192,12 +198,12 @@
2713 [](XcursorImages* images, void *this_ptr) -> void
2714 {
2715 // Can't use lambda capture as this lambda is thunked to a C function ptr
2716- auto p = static_cast<mi::XCursorLoader*>(this_ptr);
2717+ auto p = static_cast<me::XCursorLoader*>(this_ptr);
2718 p->load_appropriately_sized_image(images);
2719 }, this);
2720 }
2721
2722-std::shared_ptr<mg::CursorImage> mi::XCursorLoader::image(
2723+std::shared_ptr<mg::CursorImage> me::XCursorLoader::image(
2724 std::string const& cursor_name,
2725 geom::Size const& size)
2726 {
2727
2728=== renamed file 'src/server/input/xcursor_loader.h' => 'examples/xcursor_loader.h'
2729--- src/server/input/xcursor_loader.h 2014-06-19 23:40:22 +0000
2730+++ examples/xcursor_loader.h 2015-11-25 21:33:30 +0000
2731@@ -41,12 +41,15 @@
2732 class CursorImage;
2733 }
2734
2735-namespace input
2736+namespace examples
2737 {
2738-class XCursorLoader : public CursorImages
2739+class XCursorLoader : public input::CursorImages
2740 {
2741 public:
2742 XCursorLoader();
2743+
2744+ explicit XCursorLoader(std::string const& theme);
2745+
2746 virtual ~XCursorLoader() = default;
2747
2748 std::shared_ptr<graphics::CursorImage> image(std::string const& cursor_name,
2749
2750=== modified file 'include/client/mir/events/event_builders.h'
2751--- include/client/mir/events/event_builders.h 2015-10-02 04:27:33 +0000
2752+++ include/client/mir/events/event_builders.h 2015-11-25 21:33:30 +0000
2753@@ -22,6 +22,7 @@
2754 #include "mir_toolkit/event.h"
2755
2756 #include "mir/geometry/size.h"
2757+#include "mir/geometry/point.h"
2758 #include "mir/frontend/surface_id.h"
2759
2760 #include <memory>
2761@@ -51,13 +52,17 @@
2762 frontend::SurfaceId const& surface_id,
2763 int dpi,
2764 float scale,
2765- MirFormFactor form_factor);
2766+ MirFormFactor form_factor,
2767+ uint32_t id);
2768
2769 // Key event
2770 EventUPtr make_event(MirInputDeviceId device_id, std::chrono::nanoseconds timestamp,
2771 uint64_t mac, MirKeyboardAction action, xkb_keysym_t key_code,
2772 int scan_code, MirInputEventModifiers modifiers);
2773
2774+void set_modifier(MirEvent& event, MirInputEventModifiers modifiers);
2775+void set_cursor_position(MirEvent& event, mir::geometry::Point const& pos);
2776+
2777 // Deprecated version without mac
2778 EventUPtr make_event(MirInputDeviceId device_id, std::chrono::nanoseconds timestamp,
2779 MirKeyboardAction action, xkb_keysym_t key_code,
2780
2781=== modified file 'include/client/mir_toolkit/events/input/keyboard_event.h'
2782--- include/client/mir_toolkit/events/input/keyboard_event.h 2015-06-25 11:26:34 +0000
2783+++ include/client/mir_toolkit/events/input/keyboard_event.h 2015-11-25 21:33:30 +0000
2784@@ -20,6 +20,7 @@
2785 #define MIR_TOOLKIT_KEYBOARD_EVENT_H_
2786
2787 #include <xkbcommon/xkbcommon.h>
2788+#include <mir_toolkit/cookie.h>
2789
2790 #ifdef __cplusplus
2791 /**
2792@@ -98,6 +99,14 @@
2793 */
2794 MirInputEvent const* mir_keyboard_event_input_event(MirKeyboardEvent const* event);
2795
2796+/**
2797+ * Retrieves the timestamp cookie of a keyboard event.
2798+ *
2799+ * \param [in] event The keyboard event
2800+ * \return A MirCookie
2801+ */
2802+MirCookie mir_keyboard_event_get_cookie(MirKeyboardEvent const* event);
2803+
2804 #ifdef __cplusplus
2805 }
2806 /**@}*/
2807
2808=== modified file 'include/client/mir_toolkit/events/input/pointer_event.h'
2809--- include/client/mir_toolkit/events/input/pointer_event.h 2015-07-23 02:39:20 +0000
2810+++ include/client/mir_toolkit/events/input/pointer_event.h 2015-11-25 21:33:30 +0000
2811@@ -20,6 +20,7 @@
2812 #define MIR_TOOLKIT_POINTER_EVENT_H_
2813
2814 #include <stdbool.h>
2815+#include <mir_toolkit/cookie.h>
2816
2817 #ifdef __cplusplus
2818 /**
2819@@ -135,6 +136,14 @@
2820 */
2821 MirInputEvent const* mir_pointer_event_input_event(MirPointerEvent const* event);
2822
2823+/**
2824+ * Retrieves the timestamp cookie of a pointer event.
2825+ *
2826+ * \param [in] event The pointer event
2827+ * \return A MirCookie
2828+ */
2829+MirCookie mir_pointer_event_get_cookie(MirPointerEvent const* event);
2830+
2831 #ifdef __cplusplus
2832 }
2833 /**@}*/
2834
2835=== modified file 'include/client/mir_toolkit/events/input/touch_event.h'
2836--- include/client/mir_toolkit/events/input/touch_event.h 2015-06-25 11:26:34 +0000
2837+++ include/client/mir_toolkit/events/input/touch_event.h 2015-11-25 21:33:30 +0000
2838@@ -19,6 +19,8 @@
2839 #ifndef MIR_TOOLKIT_TOUCH_EVENT_H_
2840 #define MIR_TOOLKIT_TOUCH_EVENT_H_
2841
2842+#include <mir_toolkit/cookie.h>
2843+
2844 #ifdef __cplusplus
2845 /**
2846 * \addtogroup mir_toolkit
2847@@ -149,6 +151,14 @@
2848 */
2849 MirInputEvent const* mir_touch_event_input_event(MirTouchEvent const* event);
2850
2851+/**
2852+ * Retrieves the timestamp cookie of a touch event.
2853+ *
2854+ * \param [in] event The touch event
2855+ * \return A MirCookie
2856+ */
2857+MirCookie mir_touch_event_get_cookie(MirTouchEvent const* event);
2858+
2859 #ifdef __cplusplus
2860 }
2861 /**@}*/
2862
2863=== modified file 'include/client/mir_toolkit/events/surface_output_event.h'
2864--- include/client/mir_toolkit/events/surface_output_event.h 2015-10-02 04:27:33 +0000
2865+++ include/client/mir_toolkit/events/surface_output_event.h 2015-11-25 21:33:30 +0000
2866@@ -53,6 +53,15 @@
2867 */
2868 float mir_surface_output_event_get_scale(MirSurfaceOutputEvent const* ev);
2869
2870+/**
2871+ * Retrieve the ID of the output this surface is on from a MirSurfaceOutputEvent
2872+ *
2873+ * \param [in] ev The event
2874+ * \return The ID of the output the surface is currently considered to be on.
2875+ * (From MirDisplayOutput::output_id)
2876+ */
2877+uint32_t mir_surface_output_event_get_output_id(MirSurfaceOutputEvent const *ev);
2878+
2879 #ifdef __cplusplus
2880 }
2881 /**@}*/
2882
2883=== modified file 'include/client/mir_toolkit/mir_buffer_stream.h'
2884--- include/client/mir_toolkit/mir_buffer_stream.h 2015-09-15 18:56:59 +0000
2885+++ include/client/mir_toolkit/mir_buffer_stream.h 2015-11-25 21:33:30 +0000
2886@@ -152,8 +152,10 @@
2887 void mir_buffer_stream_swap_buffers_sync(MirBufferStream *buffer_stream);
2888
2889 /**
2890- * Retrieve a buffer stream's graphics region, e.g. map the graphics buffer to main
2891- * memory.
2892+ * Retrieve a buffer stream's graphics region
2893+ * \warning Depending on platform, this can map the graphics buffer each
2894+ * time its called. The region remains mapped until
2895+ * mir_buffer_stream_swap_buffers().
2896 * \pre The buffer stream is valid
2897 * \param [in] buffer stream The buffer stream
2898 * \param [out] graphics_region Structure to be populated
2899
2900=== added file 'include/client/mir_toolkit/mir_input_device.h'
2901--- include/client/mir_toolkit/mir_input_device.h 1970-01-01 00:00:00 +0000
2902+++ include/client/mir_toolkit/mir_input_device.h 2015-11-25 21:33:30 +0000
2903@@ -0,0 +1,56 @@
2904+/*
2905+ * Copyright © 2015 Canonical Ltd.
2906+ *
2907+ * This program is free software: you can redistribute it and/or modify it
2908+ * under the terms of the GNU Lesser General Public License version 3,
2909+ * as published by the Free Software Foundation.
2910+ *
2911+ * This program is distributed in the hope that it will be useful,
2912+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2913+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2914+ * GNU Lesser General Public License for more details.
2915+ *
2916+ * You should have received a copy of the GNU Lesser General Public License
2917+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2918+ *
2919+ */
2920+
2921+#ifndef MIR_TOOLKIT_MIR_INPUT_DEVICE_H_
2922+#define MIR_TOOLKIT_MIR_INPUT_DEVICE_H_
2923+
2924+/**
2925+ * \addtogroup mir_toolkit
2926+ * @{
2927+ */
2928+#ifdef __cplusplus
2929+extern "C" {
2930+#endif
2931+
2932+typedef enum MirPointerHandedness
2933+{
2934+ mir_pointer_handedness_right = 0,
2935+ mir_pointer_handedness_left = 1
2936+} MirPointerHandedness;
2937+
2938+typedef enum MirTouchpadClickMode
2939+{
2940+ mir_touchpad_click_mode_none = 0,
2941+ mir_touchpad_click_mode_area_to_click = 1 << 0,
2942+ mir_touchpad_click_mode_finger_count = 1 << 1
2943+} MirTouchpadClickMode;
2944+typedef unsigned int MirTouchpadClickModes;
2945+
2946+typedef enum MirTouchpadScrollMode
2947+{
2948+ mir_touchpad_scroll_mode_none = 0,
2949+ mir_touchpad_scroll_mode_two_finger_scroll = 1 << 0,
2950+ mir_touchpad_scroll_mode_edge_scroll = 1 << 1,
2951+ mir_touchpad_scroll_mode_button_down_scroll = 1 << 2
2952+} MirTouchpadScrollMode;
2953+typedef unsigned int MirTouchpadScrollModes;
2954+
2955+#ifdef __cplusplus
2956+}
2957+#endif
2958+
2959+#endif
2960
2961=== modified file 'include/client/mir_toolkit/mir_surface.h'
2962--- include/client/mir_toolkit/mir_surface.h 2015-09-09 03:13:35 +0000
2963+++ include/client/mir_toolkit/mir_surface.h 2015-11-25 21:33:30 +0000
2964@@ -21,6 +21,7 @@
2965 #include <mir_toolkit/mir_native_buffer.h>
2966 #include <mir_toolkit/client_types.h>
2967 #include <mir_toolkit/common.h>
2968+#include <mir_toolkit/cookie.h>
2969 #include <mir_toolkit/mir_cursor_configuration.h>
2970
2971 #include <stdbool.h>
2972@@ -668,6 +669,13 @@
2973 MirWaitHandle* mir_surface_set_preferred_orientation(MirSurface *surface, MirOrientationMode orientation);
2974
2975 /**
2976+ * Attempts to raise the surface based on a keyboard/touch/pointer cookie.
2977+ * \param [in] surface The surface to operate on
2978+ * \param [in] cookie The MirCookie from the event that you want to raise the window from.
2979+ */
2980+void mir_surface_raise_with_cookie(MirSurface* surface, MirCookie const cookie);
2981+
2982+/**
2983 * Get the preferred orientation modes of a surface.
2984 * \param [in] surface The surface to query
2985 * \return The preferred orientation modes
2986
2987=== added file 'include/common/mir/assert_module_entry_point.h'
2988--- include/common/mir/assert_module_entry_point.h 1970-01-01 00:00:00 +0000
2989+++ include/common/mir/assert_module_entry_point.h 2015-11-25 21:33:30 +0000
2990@@ -0,0 +1,34 @@
2991+/*
2992+ * Copyright © 2015 Canonical Ltd.
2993+ *
2994+ * This program is free software: you can redistribute it and/or modify it
2995+ * under the terms of the GNU Lesser General Public License version 3,
2996+ * as published by the Free Software Foundation.
2997+ *
2998+ * This program is distributed in the hope that it will be useful,
2999+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3000+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3001+ * GNU Lesser General Public License for more details.
3002+ *
3003+ * You should have received a copy of the GNU Lesser General Public License
3004+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3005+ *
3006+ * Authored by: Andreas Pokorny <andreas.pokorny@canonical.com>
3007+ */
3008+
3009+#ifndef MIR_ASSERT_MODULE_ENTRY_POINT_H_
3010+#define MIR_ASSERT_MODULE_ENTRY_POINT_H_
3011+
3012+#include <type_traits>
3013+
3014+namespace mir
3015+{
3016+template<typename ReferenceTypename, typename EntryPoint>
3017+void assert_entry_point_signature(EntryPoint)
3018+{
3019+ static_assert(std::is_same<EntryPoint, ReferenceTypename>::value,
3020+ "Signature of platform entry point does not match.");
3021+}
3022+}
3023+
3024+#endif
3025
3026=== modified file 'include/common/mir/optional_value.h'
3027--- include/common/mir/optional_value.h 2015-06-18 02:46:16 +0000
3028+++ include/common/mir/optional_value.h 2015-11-25 21:33:30 +0000
3029@@ -20,6 +20,7 @@
3030 #define MIR_OPTIONAL_VALUE_H_
3031
3032 #include "mir/fatal.h"
3033+#include <utility>
3034
3035 namespace mir
3036 {
3037@@ -40,14 +41,26 @@
3038 bool is_set() const { return is_set_; }
3039 T value() const
3040 {
3041+ die_if_unset();
3042+ return value_;
3043+ }
3044+
3045+ T&& consume()
3046+ {
3047+ die_if_unset();
3048+ is_set_ = false;
3049+ return std::move(value_);
3050+ }
3051+
3052+private:
3053+ void die_if_unset() const
3054+ {
3055 if (!is_set())
3056 {
3057 (*fatal_error)("Accessing value of unset optional");
3058 }
3059- return value_;
3060 }
3061
3062-private:
3063 T value_;
3064 bool is_set_{false};
3065 };
3066
3067=== modified file 'include/cookie/mir/cookie_factory.h'
3068--- include/cookie/mir/cookie_factory.h 2015-09-23 02:56:56 +0000
3069+++ include/cookie/mir/cookie_factory.h 2015-11-25 21:33:30 +0000
3070@@ -21,8 +21,8 @@
3071
3072 #include "mir_toolkit/cookie.h"
3073
3074+#include <memory>
3075 #include <vector>
3076-#include <memory>
3077
3078 namespace mir
3079 {
3080
3081=== modified file 'include/platform/mir/graphics/display.h'
3082--- include/platform/mir/graphics/display.h 2015-06-24 08:48:36 +0000
3083+++ include/platform/mir/graphics/display.h 2015-11-25 21:33:30 +0000
3084@@ -152,7 +152,6 @@
3085 */
3086 virtual std::unique_ptr<GLContext> create_gl_context() = 0;
3087
3088-protected:
3089 Display() = default;
3090 virtual ~Display() {/* TODO: make nothrow */}
3091 private:
3092
3093=== modified file 'include/platform/mir/graphics/display_configuration.h'
3094--- include/platform/mir/graphics/display_configuration.h 2015-11-04 21:00:26 +0000
3095+++ include/platform/mir/graphics/display_configuration.h 2015-11-25 21:33:30 +0000
3096@@ -27,6 +27,7 @@
3097
3098 #include <functional>
3099 #include <vector>
3100+#include <memory>
3101
3102 namespace mir
3103 {
3104@@ -166,13 +167,16 @@
3105 class DisplayConfiguration
3106 {
3107 public:
3108- virtual ~DisplayConfiguration() {}
3109+ virtual ~DisplayConfiguration() = default;
3110
3111 /** Executes a function object for each card in the configuration. */
3112 virtual void for_each_card(std::function<void(DisplayConfigurationCard const&)> f) const = 0;
3113 /** Executes a function object for each output in the configuration. */
3114 virtual void for_each_output(std::function<void(DisplayConfigurationOutput const&)> f) const = 0;
3115 virtual void for_each_output(std::function<void(UserDisplayConfigurationOutput&)> f) = 0;
3116+
3117+ virtual std::unique_ptr<DisplayConfiguration> clone() const = 0;
3118+
3119 virtual bool valid() const;
3120
3121 protected:
3122
3123=== renamed file 'src/include/platform/mir/graphics/egl_extensions.h' => 'include/platform/mir/graphics/egl_extensions.h'
3124--- src/include/platform/mir/graphics/egl_extensions.h 2015-02-22 07:46:25 +0000
3125+++ include/platform/mir/graphics/egl_extensions.h 2015-11-25 21:33:30 +0000
3126@@ -37,6 +37,15 @@
3127 PFNEGLDESTROYIMAGEKHRPROC const eglDestroyImageKHR;
3128 PFNGLEGLIMAGETARGETTEXTURE2DOESPROC const glEGLImageTargetTexture2DOES;
3129 };
3130+
3131+struct EGLSyncExtensions
3132+{
3133+ EGLSyncExtensions();
3134+ PFNEGLCREATESYNCKHRPROC const eglCreateSyncKHR;
3135+ PFNEGLDESTROYIMAGEKHRPROC const eglDestroySyncKHR;
3136+ PFNEGLCLIENTWAITSYNCKHRPROC const eglClientWaitSyncKHR;
3137+};
3138+
3139 }
3140 }
3141
3142
3143=== added file 'include/platform/mir/graphics/egl_sync_fence.h'
3144--- include/platform/mir/graphics/egl_sync_fence.h 1970-01-01 00:00:00 +0000
3145+++ include/platform/mir/graphics/egl_sync_fence.h 2015-11-25 21:33:30 +0000
3146@@ -0,0 +1,82 @@
3147+/*
3148+ * Copyright © 2015 Canonical Ltd.
3149+ *
3150+ * This program is free software: you can redistribute it and/or modify it
3151+ * under the terms of the GNU Lesser General Public License version 3,
3152+ * as published by the Free Software Foundation.
3153+ *
3154+ * This program is distributed in the hope that it will be useful,
3155+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3156+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3157+ * GNU Lesser General Public License for more details.
3158+ *
3159+ * You should have received a copy of the GNU Lesser General Public License
3160+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3161+ *
3162+ * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
3163+ */
3164+
3165+#ifndef MIR_GRAPHICS_EGL_SYNC_FENCE_H_
3166+#define MIR_GRAPHICS_EGL_SYNC_FENCE_H_
3167+
3168+#include "egl_extensions.h"
3169+#include <memory>
3170+#include <chrono>
3171+#include <mutex>
3172+
3173+namespace mir
3174+{
3175+namespace graphics
3176+{
3177+class CommandStreamSync
3178+{
3179+public:
3180+ //insert a sync object into the GL command stream of the current context.
3181+ // \warning the calling thread should have a current egl context and display
3182+ virtual void raise() = 0;
3183+ // remove fence without waiting.
3184+ virtual void reset() = 0;
3185+ //wait for fence.
3186+ // \ param [in] ns The amount of time to wait for the fence to become signalled
3187+ // \ returns true if the fence was signalled, false if timeout
3188+ virtual bool wait_for(std::chrono::nanoseconds ns) = 0;
3189+
3190+ virtual ~CommandStreamSync() = default;
3191+ CommandStreamSync() = default;
3192+ CommandStreamSync(CommandStreamSync const&) = delete;
3193+ CommandStreamSync& operator=(CommandStreamSync const&) = delete;
3194+};
3195+
3196+class NullCommandSync : public CommandStreamSync
3197+{
3198+ void raise() override;
3199+ void reset() override;
3200+ bool wait_for(std::chrono::nanoseconds ns) override;
3201+};
3202+
3203+class EGLSyncFence : public CommandStreamSync
3204+{
3205+public:
3206+ EGLSyncFence(std::shared_ptr<EGLSyncExtensions> const&);
3207+ ~EGLSyncFence();
3208+
3209+ void raise() override;
3210+ void reset() override;
3211+ bool wait_for(std::chrono::nanoseconds ns) override;
3212+private:
3213+ void reset(std::unique_lock<std::mutex> const&);
3214+ bool wait_for(std::unique_lock<std::mutex> const&, std::chrono::nanoseconds ns);
3215+
3216+ std::shared_ptr<EGLSyncExtensions> const egl;
3217+ std::chrono::nanoseconds const default_timeout{
3218+ std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::milliseconds(1))};
3219+
3220+ std::mutex mutex;
3221+ EGLDisplay fence_display;
3222+ EGLSyncKHR sync_point;
3223+};
3224+
3225+}
3226+}
3227+
3228+#endif /* MIR_GRAPHICS_EGL_SYNC_FENCE_H_ */
3229
3230=== modified file 'include/platform/mir/graphics/platform.h'
3231--- include/platform/mir/graphics/platform.h 2015-10-07 02:34:05 +0000
3232+++ include/platform/mir/graphics/platform.h 2015-11-25 21:33:30 +0000
3233@@ -22,9 +22,9 @@
3234
3235 #include <boost/program_options/options_description.hpp>
3236 #include <EGL/egl.h>
3237-#include <memory>
3238
3239 #include "mir/module_properties.h"
3240+#include "mir/module_deleter.h"
3241
3242 namespace mir
3243 {
3244@@ -75,12 +75,12 @@
3245 /**
3246 * Creates the buffer allocator subsystem.
3247 */
3248- virtual std::shared_ptr<GraphicBufferAllocator> create_buffer_allocator() = 0;
3249-
3250+ virtual UniqueModulePtr<GraphicBufferAllocator> create_buffer_allocator() = 0;
3251+
3252 /**
3253 * Creates the display subsystem.
3254 */
3255- virtual std::shared_ptr<Display> create_display(
3256+ virtual UniqueModulePtr<Display> create_display(
3257 std::shared_ptr<DisplayConfigurationPolicy> const& initial_conf_policy,
3258 std::shared_ptr<GLConfig> const& gl_config) = 0;
3259
3260@@ -88,7 +88,7 @@
3261 * Creates an object capable of doing platform specific processing of buffers
3262 * before they are sent or after they are recieved accross IPC
3263 */
3264- virtual std::shared_ptr<PlatformIpcOperations> make_ipc_operations() const = 0;
3265+ virtual UniqueModulePtr<PlatformIpcOperations> make_ipc_operations() const = 0;
3266
3267 virtual EGLNativeDisplayType egl_native_display() const = 0;
3268 };
3269@@ -114,12 +114,12 @@
3270 */
3271 };
3272
3273-typedef std::shared_ptr<mir::graphics::Platform>(*CreateHostPlatform)(
3274+typedef mir::UniqueModulePtr<mir::graphics::Platform>(*CreateHostPlatform)(
3275 std::shared_ptr<mir::options::Option> const& options,
3276 std::shared_ptr<mir::EmergencyCleanupRegistry> const& emergency_cleanup_registry,
3277 std::shared_ptr<mir::graphics::DisplayReport> const& report);
3278
3279-typedef std::shared_ptr<mir::graphics::Platform>(*CreateGuestPlatform)(
3280+typedef mir::UniqueModulePtr<mir::graphics::Platform>(*CreateGuestPlatform)(
3281 std::shared_ptr<mir::graphics::DisplayReport> const& report,
3282 std::shared_ptr<mir::graphics::NestedContext> const& nested_context);
3283
3284@@ -148,7 +148,7 @@
3285 *
3286 * \ingroup platform_enablement
3287 */
3288-std::shared_ptr<mir::graphics::Platform> create_host_platform(
3289+mir::UniqueModulePtr<mir::graphics::Platform> create_host_platform(
3290 std::shared_ptr<mir::options::Option> const& options,
3291 std::shared_ptr<mir::EmergencyCleanupRegistry> const& emergency_cleanup_registry,
3292 std::shared_ptr<mir::graphics::DisplayReport> const& report);
3293@@ -164,7 +164,7 @@
3294 *
3295 * \ingroup platform_enablement
3296 */
3297-std::shared_ptr<mir::graphics::Platform> create_guest_platform(
3298+mir::UniqueModulePtr<mir::graphics::Platform> create_guest_platform(
3299 std::shared_ptr<mir::graphics::DisplayReport> const& report,
3300 std::shared_ptr<mir::graphics::NestedContext> const& nested_context);
3301
3302
3303=== modified file 'include/platform/mir/input/event_builder.h'
3304--- include/platform/mir/input/event_builder.h 2015-08-24 23:25:00 +0000
3305+++ include/platform/mir/input/event_builder.h 2015-11-25 21:33:30 +0000
3306@@ -38,16 +38,14 @@
3307 virtual ~EventBuilder() = default;
3308 using Timestamp = std::chrono::nanoseconds;
3309
3310- virtual EventUPtr key_event(Timestamp timestamp, MirKeyboardAction action, xkb_keysym_t key_code, int scan_code,
3311- MirInputEventModifiers modifiers) = 0;
3312+ virtual EventUPtr key_event(Timestamp timestamp, MirKeyboardAction action, xkb_keysym_t key_code, int scan_code) = 0;
3313
3314- virtual EventUPtr touch_event(Timestamp timestamp, MirInputEventModifiers modifiers) = 0;
3315+ virtual EventUPtr touch_event(Timestamp timestamp) = 0;
3316 virtual void add_touch(MirEvent& event, MirTouchId touch_id, MirTouchAction action, MirTouchTooltype tooltype,
3317 float x_axis_value, float y_axis_value, float pressure_value, float touch_major_value,
3318 float touch_minor_value, float size_value) = 0;
3319
3320- virtual EventUPtr pointer_event(Timestamp timestamp, MirInputEventModifiers modifiers, MirPointerAction action,
3321- MirPointerButtons buttons_pressed, float x_axis_value, float y_axis_value,
3322+ virtual EventUPtr pointer_event(Timestamp timestamp, MirPointerAction action, MirPointerButtons buttons_pressed,
3323 float hscroll_value, float vscroll_value, float relative_x_value,
3324 float relative_y_value) = 0;
3325
3326
3327=== modified file 'include/platform/mir/input/input_device.h'
3328--- include/platform/mir/input/input_device.h 2015-09-01 07:41:29 +0000
3329+++ include/platform/mir/input/input_device.h 2015-11-25 21:33:30 +0000
3330@@ -20,6 +20,9 @@
3331 #ifndef MIR_INPUT_INPUT_DEVICE_H_
3332 #define MIR_INPUT_INPUT_DEVICE_H_
3333
3334+#include "mir/module_deleter.h"
3335+#include "mir/optional_value.h"
3336+
3337 #include <memory>
3338
3339 namespace mir
3340@@ -34,6 +37,9 @@
3341 class InputDeviceInfo;
3342 class EventBuilder;
3343
3344+class PointerSettings;
3345+class TouchpadSettings;
3346+
3347 /**
3348 * Represents an input device.
3349 */
3350@@ -54,6 +60,11 @@
3351
3352 virtual InputDeviceInfo get_device_info() = 0;
3353
3354+ virtual optional_value<PointerSettings> get_pointer_settings() const = 0;
3355+ virtual void apply_settings(PointerSettings const&) = 0;
3356+
3357+ virtual optional_value<TouchpadSettings> get_touchpad_settings() const = 0;
3358+ virtual void apply_settings(TouchpadSettings const&) = 0;
3359 protected:
3360 InputDevice(InputDevice const&) = delete;
3361 InputDevice& operator=(InputDevice const&) = delete;
3362
3363=== modified file 'include/platform/mir/input/input_sink.h'
3364--- include/platform/mir/input/input_sink.h 2015-06-17 05:20:42 +0000
3365+++ include/platform/mir/input/input_sink.h 2015-11-25 21:33:30 +0000
3366@@ -34,11 +34,6 @@
3367 InputSink() = default;
3368 virtual ~InputSink() = default;
3369 virtual void handle_input(MirEvent& event) = 0;
3370- /**
3371- * Confine position of a pointer
3372- */
3373- virtual void confine_pointer(mir::geometry::Point& position) = 0;
3374-
3375 /**!
3376 * Obtain the bounding rectangle of the destination area for this input sink
3377 */
3378
3379=== modified file 'include/platform/mir/input/platform.h'
3380--- include/platform/mir/input/platform.h 2015-07-23 02:39:20 +0000
3381+++ include/platform/mir/input/platform.h 2015-11-25 21:33:30 +0000
3382@@ -91,7 +91,7 @@
3383 };
3384
3385 typedef mir::UniqueModulePtr<Platform>(*CreatePlatform)(
3386- std::shared_ptr<options::Option> const& options,
3387+ options::Option const& options,
3388 std::shared_ptr<EmergencyCleanupRegistry> const& emergency_cleanup_registry,
3389 std::shared_ptr<InputDeviceRegistry> const& input_device_registry,
3390 std::shared_ptr<InputReport> const& report);
3391@@ -123,7 +123,7 @@
3392 * \ingroup platform_enablement
3393 */
3394 mir::UniqueModulePtr<mir::input::Platform> create_input_platform(
3395- std::shared_ptr<mir::options::Option> const& options,
3396+ mir::options::Option const& options,
3397 std::shared_ptr<mir::EmergencyCleanupRegistry> const& emergency_cleanup_registry,
3398 std::shared_ptr<mir::input::InputDeviceRegistry> const& input_device_registry,
3399 std::shared_ptr<mir::input::InputReport> const& report);
3400
3401=== added file 'include/platform/mir/input/pointer_settings.h'
3402--- include/platform/mir/input/pointer_settings.h 1970-01-01 00:00:00 +0000
3403+++ include/platform/mir/input/pointer_settings.h 2015-11-25 21:33:30 +0000
3404@@ -0,0 +1,58 @@
3405+/*
3406+ * Copyright © 2015 Canonical Ltd.
3407+ *
3408+ * This program is free software: you can redistribute it and/or modify it
3409+ * under the terms of the GNU Lesser General Public License version 3,
3410+ * as published by the Free Software Foundation.
3411+ *
3412+ * This program is distributed in the hope that it will be useful,
3413+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3414+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3415+ * GNU Lesser General Public License for more details.
3416+ *
3417+ * You should have received a copy of the GNU Lesser General Public License
3418+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3419+ *
3420+ * Authored by:
3421+ * Andreas Pokorny <andreas.pokorny@canonical.com>
3422+ */
3423+
3424+#ifndef MIR_INPUT_POINTER_SETTINGS_H_
3425+#define MIR_INPUT_POINTER_SETTINGS_H_
3426+
3427+#include "mir_toolkit/client_types.h"
3428+#include "mir_toolkit/mir_input_device.h"
3429+
3430+namespace mir
3431+{
3432+namespace input
3433+{
3434+
3435+struct PointerSettings
3436+{
3437+ PointerSettings() {}
3438+ /**
3439+ * Configure left and right handed mode by selecting a primary button
3440+ */
3441+ MirPointerHandedness handedness{mir_pointer_handedness_right};
3442+ /**
3443+ * Bias cursor acceleration.
3444+ * - [-1, 0): reduced acceleration
3445+ * - 0: default acceleration
3446+ * - (0, 1]: increased acceleration
3447+ */
3448+ double cursor_acceleration_bias{0.0};
3449+ /**
3450+ * Scale horizontal scrolling linearly
3451+ */
3452+ double horizontal_scroll_scale{1.0};
3453+ /**
3454+ * Scale vertical scrolling linearly
3455+ */
3456+ double vertical_scroll_scale{1.0};
3457+};
3458+
3459+}
3460+}
3461+
3462+#endif
3463
3464=== added file 'include/platform/mir/input/touchpad_settings.h'
3465--- include/platform/mir/input/touchpad_settings.h 1970-01-01 00:00:00 +0000
3466+++ include/platform/mir/input/touchpad_settings.h 2015-11-25 21:33:30 +0000
3467@@ -0,0 +1,46 @@
3468+/*
3469+ * Copyright © 2015 Canonical Ltd.
3470+ *
3471+ * This program is free software: you can redistribute it and/or modify it
3472+ * under the terms of the GNU Lesser General Public License version 3,
3473+ * as published by the Free Software Foundation.
3474+ *
3475+ * This program is distributed in the hope that it will be useful,
3476+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3477+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3478+ * GNU Lesser General Public License for more details.
3479+ *
3480+ * You should have received a copy of the GNU Lesser General Public License
3481+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3482+ *
3483+ * Authored by:
3484+ * Andreas Pokorny <andreas.pokorny@canonical.com>
3485+ */
3486+
3487+#ifndef MIR_INPUT_TOUCH_PAD_SETTINGS_H_
3488+#define MIR_INPUT_TOUCH_PAD_SETTINGS_H_
3489+
3490+#include "mir_toolkit/mir_input_device.h"
3491+
3492+namespace mir
3493+{
3494+namespace input
3495+{
3496+int const no_scroll_button = 0;
3497+
3498+struct TouchpadSettings
3499+{
3500+ TouchpadSettings() {}
3501+ MirTouchpadClickModes click_mode{mir_touchpad_click_mode_finger_count};
3502+ MirTouchpadScrollModes scroll_mode{mir_touchpad_scroll_mode_two_finger_scroll};
3503+ int button_down_scroll_button{no_scroll_button};
3504+ bool tap_to_click{true};
3505+ bool disable_while_typing{false};
3506+ bool disable_with_mouse{false};
3507+ bool middle_mouse_button_emulation{true};
3508+};
3509+
3510+}
3511+}
3512+
3513+#endif
3514
3515=== modified file 'include/renderers/gl/mir/renderer/gl/texture_source.h'
3516--- include/renderers/gl/mir/renderer/gl/texture_source.h 2015-09-15 17:13:45 +0000
3517+++ include/renderers/gl/mir/renderer/gl/texture_source.h 2015-11-25 21:33:30 +0000
3518@@ -32,6 +32,8 @@
3519 virtual ~TextureSource() = default;
3520
3521 virtual void gl_bind_to_texture() = 0;
3522+ //must be called if using this buffer after initial texture upload
3523+ virtual void used_as_texture() = 0;
3524
3525 protected:
3526 TextureSource() = default;
3527
3528=== modified file 'include/server/mir/frontend/session_mediator_report.h'
3529--- include/server/mir/frontend/session_mediator_report.h 2015-09-18 14:44:59 +0000
3530+++ include/server/mir/frontend/session_mediator_report.h 2015-11-25 21:33:30 +0000
3531@@ -58,6 +58,8 @@
3532
3533 virtual void session_configure_display_called(std::string const& app_name) = 0;
3534
3535+ virtual void session_set_base_display_configuration_called(std::string const& app_name) = 0;
3536+
3537 virtual void session_start_prompt_session_called(std::string const& app_name, pid_t application_process) = 0;
3538
3539 virtual void session_stop_prompt_session_called(std::string const& app_name) = 0;
3540
3541=== modified file 'include/server/mir/input/device.h'
3542--- include/server/mir/input/device.h 2015-10-01 09:52:28 +0000
3543+++ include/server/mir/input/device.h 2015-11-25 21:33:30 +0000
3544@@ -22,6 +22,7 @@
3545
3546 #include "mir/input/device_capability.h"
3547 #include "mir_toolkit/event.h"
3548+#include "mir/optional_value.h"
3549
3550 #include <memory>
3551
3552@@ -30,8 +31,8 @@
3553 namespace input
3554 {
3555
3556-class PointerSettings;
3557-class TouchPadSettings;
3558+class PointerConfiguration;
3559+class TouchpadConfiguration;
3560
3561 class Device
3562 {
3563@@ -43,6 +44,12 @@
3564 virtual std::string name() const = 0;
3565 virtual std::string unique_id() const = 0;
3566
3567+ virtual mir::optional_value<PointerConfiguration> pointer_configuration() const = 0;
3568+ virtual void apply_pointer_configuration(PointerConfiguration const&) = 0;
3569+
3570+ virtual mir::optional_value<TouchpadConfiguration> touchpad_configuration() const = 0;
3571+ virtual void apply_touchpad_configuration(TouchpadConfiguration const&) = 0;
3572+
3573 private:
3574 Device(Device const&) = delete;
3575 Device& operator=(Device const&) = delete;
3576
3577=== added file 'include/server/mir/input/pointer_configuration.h'
3578--- include/server/mir/input/pointer_configuration.h 1970-01-01 00:00:00 +0000
3579+++ include/server/mir/input/pointer_configuration.h 2015-11-25 21:33:30 +0000
3580@@ -0,0 +1,71 @@
3581+/*
3582+ * Copyright © 2015 Canonical Ltd.
3583+ *
3584+ * This program is free software: you can redistribute it and/or modify it
3585+ * under the terms of the GNU General Public License version 3,
3586+ * as published by the Free Software Foundation.
3587+ *
3588+ * This program is distributed in the hope that it will be useful,
3589+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3590+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3591+ * GNU General Public License for more details.
3592+ *
3593+ * You should have received a copy of the GNU General Public License
3594+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3595+ *
3596+ * Authored by:
3597+ * Andreas Pokorny <andreas.pokorny@canonical.com>
3598+ */
3599+
3600+#ifndef MIR_INPUT_POINTER_CONFIGURATION_H_
3601+#define MIR_INPUT_POINTER_CONFIGURATION_H_
3602+
3603+#include "mir_toolkit/common.h"
3604+#include "mir_toolkit/client_types.h"
3605+#include "mir_toolkit/mir_input_device.h"
3606+
3607+namespace mir
3608+{
3609+namespace input
3610+{
3611+
3612+struct PointerConfiguration
3613+{
3614+ PointerConfiguration() {}
3615+
3616+ PointerConfiguration(MirPointerHandedness handedness, double acceleration_bias, double horizontal_scroll_scale,
3617+ double vertical_scroll_scale)
3618+ : handedness{handedness}, cursor_acceleration_bias{acceleration_bias},
3619+ horizontal_scroll_scale{horizontal_scroll_scale}, vertical_scroll_scale{vertical_scroll_scale}
3620+ {
3621+ }
3622+
3623+ /*!
3624+ * Configure which button shall be used as primary button. That way the input device is configured to be either
3625+ * right or left handed.
3626+ */
3627+ MirPointerHandedness handedness{mir_pointer_handedness_right};
3628+
3629+ /*!
3630+ * Configures the intensity of the cursor acceleration. Values within the range of [-1, 1] are allowed.
3631+ * - 0: default acceleration
3632+ * - [-1, 0): reduced acceleration
3633+ * - (0, 1]: increased acceleration
3634+ */
3635+ double cursor_acceleration_bias{0.0};
3636+
3637+ /*!
3638+ * Configures a signed scale of the horizontal scrolling. Use negative values to configure 'natural scrolling'
3639+ */
3640+ double horizontal_scroll_scale{1.0};
3641+
3642+ /*!
3643+ * Configures a signed scale of the vertical scrolling. Use negative values to configure 'natural scrolling'
3644+ */
3645+ double vertical_scroll_scale{1.0};
3646+};
3647+
3648+}
3649+}
3650+
3651+#endif
3652
3653=== added file 'include/server/mir/input/touchpad_configuration.h'
3654--- include/server/mir/input/touchpad_configuration.h 1970-01-01 00:00:00 +0000
3655+++ include/server/mir/input/touchpad_configuration.h 2015-11-25 21:33:30 +0000
3656@@ -0,0 +1,82 @@
3657+/*
3658+ * Copyright © 2015 Canonical Ltd.
3659+ *
3660+ * This program is free software: you can redistribute it and/or modify it
3661+ * under the terms of the GNU General Public License version 3,
3662+ * as published by the Free Software Foundation.
3663+ *
3664+ * This program is distributed in the hope that it will be useful,
3665+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3666+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3667+ * GNU General Public License for more details.
3668+ *
3669+ * You should have received a copy of the GNU General Public License
3670+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3671+ *
3672+ * Authored by:
3673+ * Andreas Pokorny <andreas.pokorny@canonical.com>
3674+ */
3675+
3676+#ifndef MIR_INPUT_TOUCH_PAD_CONFIGURATION_H_
3677+#define MIR_INPUT_TOUCH_PAD_CONFIGURATION_H_
3678+
3679+#include "mir_toolkit/common.h"
3680+#include "mir_toolkit/mir_input_device.h"
3681+
3682+namespace mir
3683+{
3684+namespace input
3685+{
3686+
3687+struct TouchpadConfiguration
3688+{
3689+ TouchpadConfiguration() {}
3690+ TouchpadConfiguration(MirTouchpadClickModes click_mode,
3691+ MirTouchpadScrollModes scroll_mode,
3692+ int button_down_scroll_button,
3693+ bool tap_to_click,
3694+ bool disable_while_typing,
3695+ bool disable_with_mouse,
3696+ bool middle_mouse_button_emulation)
3697+ : click_mode{click_mode}, scroll_mode{scroll_mode}, button_down_scroll_button{button_down_scroll_button},
3698+ tap_to_click{tap_to_click}, middle_mouse_button_emulation{middle_mouse_button_emulation},
3699+ disable_with_mouse{disable_with_mouse}, disable_while_typing{disable_while_typing}
3700+ {
3701+ }
3702+
3703+ /*!
3704+ * The click mode defines when the touchpad generates software emulated button events.
3705+ */
3706+ MirTouchpadClickModes click_mode{mir_touchpad_click_mode_finger_count};
3707+/*!
3708+ * The scroll mode defines when the touchpad generates scroll events instead of pointer motion events.
3709+ */
3710+ MirTouchpadScrollModes scroll_mode{mir_touchpad_scroll_mode_two_finger_scroll};
3711+
3712+ /*!
3713+ * Configures the button used for the on-button-down scroll mode
3714+ */
3715+ int button_down_scroll_button{0};
3716+
3717+ /*!
3718+ * When tap to click is enabled the system will interpret short finger touch down/up sequences as button clicks.
3719+ */
3720+ bool tap_to_click{true};
3721+ /*!
3722+ * Emulates a middle mouse button press when the left and right buttons on a touchpad are pressed.
3723+ */
3724+ bool middle_mouse_button_emulation{true};
3725+ /*!
3726+ * When disable-with-mouse is enabled the touchpad will stop to emit user input events when another pointing device is plugged in.
3727+ */
3728+ bool disable_with_mouse{false};
3729+ /*!
3730+ * When disable-with-mouse is enabled the touchpad will stop to emit user input events when the user starts to use a keyboard and a short period after.
3731+ */
3732+ bool disable_while_typing{false};
3733+};
3734+
3735+}
3736+}
3737+
3738+#endif
3739
3740=== removed file 'include/server/mir/scene/depth_id.h'
3741--- include/server/mir/scene/depth_id.h 2015-02-22 07:46:25 +0000
3742+++ include/server/mir/scene/depth_id.h 1970-01-01 00:00:00 +0000
3743@@ -1,34 +0,0 @@
3744-/*
3745- * Copyright © 2013 Canonical Ltd.
3746- *
3747- * This program is free software: you can redistribute it and/or modify it
3748- * under the terms of the GNU General Public License version 3,
3749- * as published by the Free Software Foundation.
3750- *
3751- * This program is distributed in the hope that it will be useful,
3752- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3753- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3754- * GNU General Public License for more details.
3755- *
3756- * You should have received a copy of the GNU General Public License
3757- * along with this program. If not, see <http://www.gnu.org/licenses/>.
3758- *
3759- * Authored By: Robert Carr <racarr@canonical.com>
3760- */
3761-
3762-#ifndef MIR_SCENE_DEPTH_ID_H_
3763-#define MIR_SCENE_DEPTH_ID_H_
3764-
3765-#include "mir/int_wrapper.h"
3766-
3767-namespace mir
3768-{
3769-namespace scene
3770-{
3771-namespace detail { struct DepthIdIdTag; }
3772-
3773-typedef IntWrapper<detail::DepthIdIdTag> DepthId;
3774-}
3775-} // namespace mir
3776-
3777-#endif // MIR_SCENE_DEPTH_ID_H_
3778
3779=== modified file 'include/server/mir/scene/session.h'
3780--- include/server/mir/scene/session.h 2015-10-02 01:56:04 +0000
3781+++ include/server/mir/scene/session.h 2015-11-25 21:33:30 +0000
3782@@ -66,6 +66,7 @@
3783 virtual frontend::BufferStreamId create_buffer_stream(graphics::BufferProperties const& props) = 0;
3784 virtual void destroy_buffer_stream(frontend::BufferStreamId stream) = 0;
3785 virtual void configure_streams(Surface& surface, std::vector<shell::StreamSpecification> const& config) = 0;
3786+ virtual void destroy_surface(std::weak_ptr<Surface> const& surface) = 0;
3787 };
3788 }
3789 }
3790
3791=== modified file 'include/server/mir/scene/surface_coordinator.h'
3792--- include/server/mir/scene/surface_coordinator.h 2015-06-17 05:20:42 +0000
3793+++ include/server/mir/scene/surface_coordinator.h 2015-11-25 21:33:30 +0000
3794@@ -20,7 +20,6 @@
3795 #ifndef MIR_SCENE_SURFACE_COORDINATOR_H_
3796 #define MIR_SCENE_SURFACE_COORDINATOR_H_
3797
3798-#include "mir/scene/depth_id.h"
3799 #include <memory>
3800 #include <set>
3801
3802@@ -42,7 +41,6 @@
3803
3804 virtual void add_surface(
3805 std::shared_ptr<Surface> const&,
3806- scene::DepthId depth,
3807 input::InputReceptionMode const& new_mode,
3808 Session* session) = 0;
3809
3810
3811=== modified file 'include/server/mir/scene/surface_creation_parameters.h'
3812--- include/server/mir/scene/surface_creation_parameters.h 2015-07-23 02:39:20 +0000
3813+++ include/server/mir/scene/surface_creation_parameters.h 2015-11-25 21:33:30 +0000
3814@@ -24,7 +24,6 @@
3815 #include "mir/geometry/size.h"
3816 #include "mir/graphics/buffer_properties.h"
3817 #include "mir/graphics/display_configuration.h"
3818-#include "mir/scene/depth_id.h"
3819 #include "mir/frontend/surface_id.h"
3820 #include "mir/input/input_reception_mode.h"
3821 #include "mir/optional_value.h"
3822@@ -55,8 +54,6 @@
3823
3824 SurfaceCreationParameters& of_pixel_format(MirPixelFormat new_pixel_format);
3825
3826- SurfaceCreationParameters& of_depth(scene::DepthId const& new_depth);
3827-
3828 SurfaceCreationParameters& with_input_mode(input::InputReceptionMode const& new_mode);
3829
3830 SurfaceCreationParameters& with_output_id(graphics::DisplayConfigurationOutputId const& output_id);
3831@@ -80,7 +77,6 @@
3832 geometry::Point top_left;
3833 graphics::BufferUsage buffer_usage;
3834 MirPixelFormat pixel_format;
3835- scene::DepthId depth;
3836 input::InputReceptionMode input_mode;
3837 graphics::DisplayConfigurationOutputId output_id;
3838
3839
3840=== modified file 'include/server/mir/server.h'
3841--- include/server/mir/server.h 2015-10-07 15:32:10 +0000
3842+++ include/server/mir/server.h 2015-11-25 21:33:30 +0000
3843@@ -37,6 +37,7 @@
3844 namespace cookie
3845 {
3846 using Secret = std::vector<uint8_t>;
3847+class CookieFactory;
3848 }
3849 namespace shell
3850 {
3851@@ -84,12 +85,11 @@
3852 /// This must remain valid while apply_settings() and run() are called.
3853 void set_command_line(int argc, char const* argv[]);
3854
3855- /// creates the CookieFactory from the given secret
3856- /// This secret is used to generate timestamps that can be attested to by
3857- /// libmircookie. Any process this secret is shared with can verify Mir-generated
3858- /// cookies, or produce their own.
3859- /// \note If not explicitly set, a random secret will be chosen.
3860- void override_the_cookie_factory(mir::cookie::Secret const& secret);
3861+ /// Sets an override functor for creating the cookie factory.
3862+ /// A secret can be saved and any process this secret is shared
3863+ /// with can verify Mir-generated cookies, or produce their own.
3864+ void override_the_cookie_factory(
3865+ std::function<std::shared_ptr<cookie::CookieFactory>()> const& cookie_factory_builder);
3866
3867 /// Applies any configuration options, hooks, or custom implementations.
3868 /// Must be called before calling run() or accessing any mir subsystems.
3869
3870=== modified file 'include/server/mir/shell/abstract_shell.h'
3871--- include/server/mir/shell/abstract_shell.h 2015-10-02 01:56:04 +0000
3872+++ include/server/mir/shell/abstract_shell.h 2015-11-25 21:33:30 +0000
3873@@ -28,6 +28,7 @@
3874 {
3875 namespace shell
3876 {
3877+class ShellReport;
3878 class WindowManager;
3879
3880 /// Minimal Shell implementation with none of the necessary window management logic
3881@@ -39,6 +40,7 @@
3882 std::shared_ptr<scene::SurfaceCoordinator> const& surface_coordinator,
3883 std::shared_ptr<scene::SessionCoordinator> const& session_coordinator,
3884 std::shared_ptr<scene::PromptSessionManager> const& prompt_session_manager,
3885+ std::shared_ptr<ShellReport> const& report,
3886 WindowManagerBuilder const& wm_builder);
3887
3888 ~AbstractShell() noexcept;
3889@@ -69,6 +71,11 @@
3890 std::shared_ptr<scene::Surface> const& surface,
3891 MirSurfaceAttrib attrib) override;
3892
3893+ void raise_surface_with_timestamp(
3894+ std::shared_ptr<scene::Session> const& session,
3895+ std::shared_ptr<scene::Surface> const& surface,
3896+ uint64_t timestamp) override;
3897+
3898 std::shared_ptr<scene::PromptSession> start_prompt_session_for(
3899 std::shared_ptr<scene::Session> const& session,
3900 scene::PromptSessionCreationParameters const& params) override;
3901@@ -117,6 +124,8 @@
3902 std::shared_ptr<WindowManager> const window_manager;
3903
3904 private:
3905+ std::shared_ptr<ShellReport> const report;
3906+
3907 std::mutex mutable focus_mutex;
3908 std::weak_ptr<scene::Surface> focus_surface;
3909 std::weak_ptr<scene::Session> focus_session;
3910
3911=== modified file 'include/server/mir/shell/display_configuration_controller.h'
3912--- include/server/mir/shell/display_configuration_controller.h 2015-10-01 01:27:17 +0000
3913+++ include/server/mir/shell/display_configuration_controller.h 2015-11-25 21:33:30 +0000
3914@@ -50,7 +50,7 @@
3915 * \return A std::future<> that becomes ready once the configuration
3916 * has been applied.
3917 */
3918- virtual std::future<void> set_default_display_configuration(
3919+ virtual std::future<void> set_base_configuration(
3920 std::shared_ptr<graphics::DisplayConfiguration> const& conf) = 0;
3921 };
3922 }
3923
3924=== modified file 'include/server/mir/shell/display_layout.h'
3925--- include/server/mir/shell/display_layout.h 2013-08-28 03:41:48 +0000
3926+++ include/server/mir/shell/display_layout.h 2015-11-25 21:33:30 +0000
3927@@ -53,12 +53,14 @@
3928 virtual void size_to_output(geometry::Rectangle& rect) = 0;
3929
3930 /**
3931- * Places a rectangle in an particular output.
3932+ * Places a rectangle in an particular output if the display is known,
3933+ * otherwise does nothing.
3934 *
3935 * @param [in] id the id of the output to place the rectangle in
3936 * @param [in,out] rect the rectangle to place
3937+ * @return true iff the display id is recognised
3938 */
3939- virtual void place_in_output(graphics::DisplayConfigurationOutputId id,
3940+ virtual bool place_in_output(graphics::DisplayConfigurationOutputId id,
3941 geometry::Rectangle& rect) = 0;
3942
3943 protected:
3944
3945=== modified file 'include/server/mir/shell/shell.h'
3946--- include/server/mir/shell/shell.h 2015-10-02 01:56:04 +0000
3947+++ include/server/mir/shell/shell.h 2015-11-25 21:33:30 +0000
3948@@ -94,6 +94,12 @@
3949 virtual int get_surface_attribute(
3950 std::shared_ptr<scene::Surface> const& surface,
3951 MirSurfaceAttrib attrib) = 0;
3952+
3953+ virtual void raise_surface_with_timestamp(
3954+ std::shared_ptr<scene::Session> const& session,
3955+ std::shared_ptr<scene::Surface> const& surface,
3956+ uint64_t timestamp) = 0;
3957+
3958 /** @} */
3959 };
3960 }
3961
3962=== added file 'include/server/mir/shell/shell_report.h'
3963--- include/server/mir/shell/shell_report.h 1970-01-01 00:00:00 +0000
3964+++ include/server/mir/shell/shell_report.h 2015-11-25 21:33:30 +0000
3965@@ -0,0 +1,89 @@
3966+/*
3967+ * Copyright © 2015 Canonical Ltd.
3968+ *
3969+ * This program is free software: you can redistribute it and/or modify it
3970+ * under the terms of the GNU General Public License version 3,
3971+ * as published by the Free Software Foundation.
3972+ *
3973+ * This program is distributed in the hope that it will be useful,
3974+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3975+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3976+ * GNU General Public License for more details.
3977+ *
3978+ * You should have received a copy of the GNU General Public License
3979+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3980+ *
3981+ * Authored by: Alan Griffiths <alan@octopull.co.uk>
3982+ */
3983+
3984+#ifndef MIR_SHELL_SHELL_REPORT_H
3985+#define MIR_SHELL_SHELL_REPORT_H
3986+
3987+#include "mir/frontend/surface_id.h"
3988+#include "mir_toolkit/common.h"
3989+
3990+#include <memory>
3991+#include <set>
3992+
3993+namespace mir
3994+{
3995+namespace geometry { struct Rectangle; }
3996+namespace scene { class PromptSession; class Session; class Surface; struct SurfaceCreationParameters; }
3997+
3998+namespace shell
3999+{
4000+struct SurfaceSpecification;
4001+using SurfaceSet = std::set<std::weak_ptr<scene::Surface>, std::owner_less<std::weak_ptr<scene::Surface>>>;
4002+
4003+class ShellReport
4004+{
4005+public:
4006+
4007+ virtual void opened_session(scene::Session const& session) = 0;
4008+
4009+ virtual void closing_session(scene::Session const& session) = 0;
4010+
4011+ virtual void created_surface(
4012+ scene::Session const& session, frontend::SurfaceId surface_id) = 0;
4013+
4014+ virtual void update_surface(
4015+ scene::Session const& session, scene::Surface const& surface,
4016+ SurfaceSpecification const& modifications) = 0;
4017+
4018+ virtual void update_surface(
4019+ scene::Session const& session, scene::Surface const& surface,
4020+ MirSurfaceAttrib attrib, int value) = 0;
4021+
4022+ virtual void destroying_surface(
4023+ scene::Session const& session, frontend::SurfaceId surface) = 0;
4024+
4025+ virtual void started_prompt_session(
4026+ scene::PromptSession const& prompt_session,
4027+ scene::Session const& session) = 0;
4028+
4029+ virtual void added_prompt_provider(
4030+ scene::PromptSession const& prompt_session,
4031+ scene::Session const& session) = 0;
4032+
4033+ virtual void stopping_prompt_session(
4034+ scene::PromptSession const& prompt_session) = 0;
4035+
4036+ virtual void adding_display(geometry::Rectangle const& area) = 0;
4037+
4038+ virtual void removing_display(geometry::Rectangle const& area) = 0;
4039+
4040+ virtual void input_focus_set_to(
4041+ scene::Session const* focus_session,
4042+ scene::Surface const* focus_surface) = 0;
4043+
4044+ virtual void surfaces_raised(SurfaceSet const& surfaces) = 0;
4045+
4046+ ShellReport() = default;
4047+ virtual ~ShellReport() = default;
4048+ ShellReport(ShellReport const&) = delete;
4049+ ShellReport& operator=(ShellReport const&) = delete;
4050+};
4051+}
4052+}
4053+
4054+#endif //MIR_SHELL_SHELL_REPORT_H
4055
4056=== modified file 'include/server/mir/shell/shell_wrapper.h'
4057--- include/server/mir/shell/shell_wrapper.h 2015-10-02 01:56:04 +0000
4058+++ include/server/mir/shell/shell_wrapper.h 2015-11-25 21:33:30 +0000
4059@@ -80,6 +80,11 @@
4060 std::shared_ptr<scene::Surface> const& surface,
4061 MirSurfaceAttrib attrib) override;
4062
4063+ void raise_surface_with_timestamp(
4064+ std::shared_ptr<scene::Session> const& session,
4065+ std::shared_ptr<scene::Surface> const& surface,
4066+ uint64_t timestamp) override;
4067+
4068 void add_display(geometry::Rectangle const& area) override;
4069 void remove_display(geometry::Rectangle const& area) override;
4070
4071
4072=== modified file 'include/server/mir/shell/surface_specification.h'
4073--- include/server/mir/shell/surface_specification.h 2015-07-23 02:39:20 +0000
4074+++ include/server/mir/shell/surface_specification.h 2015-11-25 21:33:30 +0000
4075@@ -27,7 +27,6 @@
4076 #include "mir/geometry/displacement.h"
4077 #include "mir/graphics/buffer_properties.h"
4078 #include "mir/graphics/display_configuration.h"
4079-#include "mir/scene/depth_id.h"
4080
4081 #include <string>
4082 #include <memory>
4083@@ -49,6 +48,8 @@
4084 /// Specification of surface properties requested by client
4085 struct SurfaceSpecification
4086 {
4087+ bool is_empty() const;
4088+
4089 optional_value<geometry::Width> width;
4090 optional_value<geometry::Height> height;
4091 optional_value<MirPixelFormat> pixel_format;
4092@@ -76,7 +77,6 @@
4093
4094 // TODO scene::SurfaceCreationParameters overlaps this content but has additional fields:
4095 // geometry::Point top_left;
4096- // scene::DepthId depth;
4097 // input::InputReceptionMode input_mode;
4098 //
4099 // it also has size instead of width + height
4100
4101=== modified file 'include/server/mir/shell/system_compositor_window_manager.h'
4102--- include/server/mir/shell/system_compositor_window_manager.h 2015-06-11 11:41:33 +0000
4103+++ include/server/mir/shell/system_compositor_window_manager.h 2015-11-25 21:33:30 +0000
4104@@ -20,10 +20,14 @@
4105 #define MIR_SHELL_SYSTEM_COMPOSITOR_WINDOW_MANAGER_H_
4106
4107 #include "mir/shell/window_manager.h"
4108+#include "mir/graphics/display_configuration.h"
4109+
4110+#include <map>
4111+#include <mutex>
4112
4113 namespace mir
4114 {
4115-namespace scene { class PlacementStrategy; class SessionCoordinator; }
4116+namespace scene { class SessionCoordinator; }
4117 namespace shell
4118 {
4119 class FocusController;
4120@@ -86,11 +90,21 @@
4121
4122 bool handle_pointer_event(MirPointerEvent const* event) override;
4123
4124+ void handle_raise_surface(
4125+ std::shared_ptr<scene::Session> const& session,
4126+ std::shared_ptr<scene::Surface> const& surface,
4127+ uint64_t timestamp) override;
4128+
4129 int set_surface_attribute(
4130 std::shared_ptr<scene::Session> const& session,
4131 std::shared_ptr<scene::Surface> const& surface,
4132 MirSurfaceAttrib attrib,
4133 int value) override;
4134+
4135+ using OutputMap = std::map<std::weak_ptr<scene::Surface>, graphics::DisplayConfigurationOutputId, std::owner_less<std::weak_ptr<scene::Surface>>>;
4136+
4137+ std::mutex mutable mutex;
4138+ OutputMap output_map;
4139 };
4140 }
4141 }
4142
4143=== modified file 'include/server/mir/shell/window_manager.h'
4144--- include/server/mir/shell/window_manager.h 2015-10-02 01:56:04 +0000
4145+++ include/server/mir/shell/window_manager.h 2015-11-25 21:33:30 +0000
4146@@ -71,6 +71,11 @@
4147 MirSurfaceAttrib attrib,
4148 int value) = 0;
4149
4150+ virtual void handle_raise_surface(
4151+ std::shared_ptr<scene::Session> const& session,
4152+ std::shared_ptr<scene::Surface> const& surface,
4153+ uint64_t timestamp) = 0;
4154+
4155 virtual ~WindowManager() = default;
4156 WindowManager() = default;
4157 WindowManager(WindowManager const&) = delete;
4158
4159=== added file 'include/test/mir/test/doubles/mock_display_configuration.h'
4160--- include/test/mir/test/doubles/mock_display_configuration.h 1970-01-01 00:00:00 +0000
4161+++ include/test/mir/test/doubles/mock_display_configuration.h 2015-11-25 21:33:30 +0000
4162@@ -0,0 +1,57 @@
4163+/*
4164+ * Copyright © 2015 Canonical Ltd.
4165+ *
4166+ * This program is free software: you can redistribute it and/or modify it
4167+ * under the terms of the GNU General Public License version 3,
4168+ * as published by the Free Software Foundation.
4169+ *
4170+ * This program is distributed in the hope that it will be useful,
4171+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
4172+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4173+ * GNU General Public License for more details.
4174+ *
4175+ * You should have received a copy of the GNU General Public License
4176+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
4177+ *
4178+ * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
4179+ */
4180+
4181+#ifndef MIR_TEST_DOUBLES_MOCK_DISPLAY_CONFIGURATION_H_
4182+#define MIR_TEST_DOUBLES_MOCK_DISPLAY_CONFIGURATION_H_
4183+
4184+#include "mir/graphics/display_configuration.h"
4185+
4186+namespace mir
4187+{
4188+namespace test
4189+{
4190+namespace doubles
4191+{
4192+
4193+struct MockDisplayConfiguration : public graphics::DisplayConfiguration
4194+{
4195+ MOCK_CONST_METHOD1(
4196+ for_each_card,
4197+ void(std::function<void(mg::DisplayConfigurationCard const&)>));
4198+
4199+ MOCK_CONST_METHOD1(
4200+ for_each_output,
4201+ void(std::function<void(mg::DisplayConfigurationOutput const&)>));
4202+
4203+ MOCK_METHOD1(
4204+ for_each_output,
4205+ void(std::function<void(mg::UserDisplayConfigurationOutput&)>));
4206+
4207+ MOCK_CONST_METHOD0(valid, bool());
4208+
4209+ std::unique_ptr<mg::DisplayConfiguration> clone() const
4210+ {
4211+ throw std::runtime_error("MockDisplayConfiguration::clone is not implemented");
4212+ }
4213+};
4214+
4215+}
4216+}
4217+}
4218+
4219+#endif
4220
4221=== modified file 'include/test/mir/test/doubles/mock_egl.h'
4222--- include/test/mir/test/doubles/mock_egl.h 2015-06-22 03:04:56 +0000
4223+++ include/test/mir/test/doubles/mock_egl.h 2015-11-25 21:33:30 +0000
4224@@ -146,6 +146,10 @@
4225 MOCK_METHOD2(eglDestroyImageKHR,EGLBoolean(EGLDisplay, EGLImageKHR));
4226 MOCK_METHOD2(glEGLImageTargetTexture2DOES, void(GLenum, GLeglImageOES));
4227
4228+ MOCK_METHOD3(eglCreateSyncKHR, EGLSyncKHR(EGLDisplay, EGLenum, EGLint const*));
4229+ MOCK_METHOD2(eglDestroySyncKHR, EGLBoolean(EGLDisplay, EGLSyncKHR));
4230+ MOCK_METHOD4(eglClientWaitSyncKHR, EGLint(EGLDisplay, EGLSyncKHR, EGLint, EGLTimeKHR));
4231+
4232 EGLDisplay fake_egl_display;
4233 EGLConfig* fake_configs;
4234 EGLint fake_configs_num;
4235
4236=== modified file 'include/test/mir/test/doubles/mock_window_manager.h'
4237--- include/test/mir/test/doubles/mock_window_manager.h 2015-06-22 03:04:56 +0000
4238+++ include/test/mir/test/doubles/mock_window_manager.h 2015-11-25 21:33:30 +0000
4239@@ -57,6 +57,8 @@
4240 MOCK_METHOD1(handle_touch_event, bool(MirTouchEvent const*));
4241 MOCK_METHOD1(handle_pointer_event, bool(MirPointerEvent const*));
4242
4243+ MOCK_METHOD3(handle_raise_surface, void(std::shared_ptr<scene::Session> const&, std::shared_ptr<scene::Surface> const&, uint64_t));
4244+
4245 MOCK_METHOD4(set_surface_attribute,
4246 int(std::shared_ptr<scene::Session> const& session,
4247 std::shared_ptr<scene::Surface> const& surface,
4248
4249=== modified file 'include/test/mir/test/doubles/null_display_configuration.h'
4250--- include/test/mir/test/doubles/null_display_configuration.h 2015-06-22 03:04:56 +0000
4251+++ include/test/mir/test/doubles/null_display_configuration.h 2015-11-25 21:33:30 +0000
4252@@ -38,6 +38,10 @@
4253 void for_each_output(std::function<void(graphics::UserDisplayConfigurationOutput&)>) override
4254 {
4255 }
4256+ std::unique_ptr<graphics::DisplayConfiguration> clone() const override
4257+ {
4258+ return std::make_unique<NullDisplayConfiguration>();
4259+ }
4260 };
4261 }
4262 }
4263
4264=== modified file 'include/test/mir/test/doubles/null_platform.h'
4265--- include/test/mir/test/doubles/null_platform.h 2015-10-07 02:34:05 +0000
4266+++ include/test/mir/test/doubles/null_platform.h 2015-11-25 21:33:30 +0000
4267@@ -21,6 +21,7 @@
4268
4269 #include "mir/graphics/platform.h"
4270 #include "mir/graphics/platform_ipc_package.h"
4271+#include "mir/graphics/graphic_buffer_allocator.h"
4272 #include "mir/test/doubles/null_display.h"
4273 #include "mir/test/doubles/null_platform_ipc_operations.h"
4274
4275@@ -33,16 +34,16 @@
4276 class NullPlatform : public graphics::Platform
4277 {
4278 public:
4279- std::shared_ptr<graphics::GraphicBufferAllocator> create_buffer_allocator() override
4280+ mir::UniqueModulePtr<graphics::GraphicBufferAllocator> create_buffer_allocator() override
4281 {
4282 return nullptr;
4283 }
4284
4285- std::shared_ptr<graphics::Display> create_display(
4286+ mir::UniqueModulePtr<graphics::Display> create_display(
4287 std::shared_ptr<graphics::DisplayConfigurationPolicy> const&,
4288 std::shared_ptr<graphics::GLConfig> const&) override
4289 {
4290- return std::make_shared<NullDisplay>();
4291+ return mir::make_module_ptr<NullDisplay>();
4292 }
4293
4294 std::shared_ptr<graphics::PlatformIPCPackage> connection_ipc_package()
4295@@ -50,9 +51,9 @@
4296 return std::make_shared<graphics::PlatformIPCPackage>();
4297 }
4298
4299- std::shared_ptr<graphics::PlatformIpcOperations> make_ipc_operations() const override
4300+ mir::UniqueModulePtr<graphics::PlatformIpcOperations> make_ipc_operations() const override
4301 {
4302- return std::make_shared<NullPlatformIpcOperations>();
4303+ return mir::make_module_ptr<NullPlatformIpcOperations>();
4304 }
4305
4306 EGLNativeDisplayType egl_native_display() const override
4307
4308=== modified file 'include/test/mir/test/doubles/stub_display_configuration.h'
4309--- include/test/mir/test/doubles/stub_display_configuration.h 2015-10-07 15:32:10 +0000
4310+++ include/test/mir/test/doubles/stub_display_configuration.h 2015-11-25 21:33:30 +0000
4311@@ -24,6 +24,7 @@
4312 #include "mir_toolkit/common.h"
4313
4314 #include <vector>
4315+#include <limits>
4316
4317 namespace mir
4318 {
4319@@ -36,7 +37,7 @@
4320 {
4321 StubDisplayConfigurationOutput(
4322 geometry::Size px_size, geometry::Size mm_size, MirPixelFormat format, double vrefresh, bool connected) :
4323- StubDisplayConfigurationOutput(graphics::DisplayConfigurationOutputId{0}, px_size, mm_size, format, vrefresh, connected)
4324+ StubDisplayConfigurationOutput(graphics::DisplayConfigurationOutputId{1}, px_size, mm_size, format, vrefresh, connected)
4325 {
4326 }
4327
4328@@ -108,7 +109,7 @@
4329 outputs[i].connected = connected_used[i].first;
4330 outputs[i].used = connected_used[i].second;
4331 outputs[i].current_format = mir_pixel_format_abgr_8888;
4332- outputs[i].id = graphics::DisplayConfigurationOutputId{static_cast<int>(i)};
4333+ outputs[i].id = graphics::DisplayConfigurationOutputId{static_cast<int>(i+1)};
4334 }
4335 }
4336
4337@@ -227,6 +228,14 @@
4338 }
4339 }
4340
4341+ StubDisplayConfig(
4342+ std::vector<graphics::DisplayConfigurationCard> const& cards,
4343+ std::vector<graphics::DisplayConfigurationOutput> const& outputs)
4344+ : cards(cards),
4345+ outputs(outputs)
4346+ {
4347+ }
4348+
4349 void for_each_card(std::function<void(graphics::DisplayConfigurationCard const&)> f) const override
4350 {
4351 for (auto const& card : cards)
4352@@ -250,6 +259,11 @@
4353 }
4354 }
4355
4356+ std::unique_ptr<graphics::DisplayConfiguration> clone() const override
4357+ {
4358+ return std::make_unique<StubDisplayConfig>(*this);
4359+ }
4360+
4361 std::vector<graphics::DisplayConfigurationCard> cards;
4362 std::vector<graphics::DisplayConfigurationOutput> outputs;
4363 };
4364
4365=== added file 'include/test/mir/test/doubles/stub_session.h'
4366--- include/test/mir/test/doubles/stub_session.h 1970-01-01 00:00:00 +0000
4367+++ include/test/mir/test/doubles/stub_session.h 2015-11-25 21:33:30 +0000
4368@@ -0,0 +1,92 @@
4369+/*
4370+ * Copyright © 2015 Canonical Ltd.
4371+ *
4372+ * This program is free software: you can redistribute it and/or modify it
4373+ * under the terms of the GNU General Public License version 3,
4374+ * as published by the Free Software Foundation.
4375+ *
4376+ * This program is distributed in the hope that it will be useful,
4377+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
4378+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4379+ * GNU General Public License for more details.
4380+ *
4381+ * You should have received a copy of the GNU General Public License
4382+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
4383+ *
4384+ * Authored By: Alan Griffiths <alan@octopull.co.uk>
4385+ */
4386+
4387+#ifndef MIR_TEST_DOUBLES_STUB_SESSION_H
4388+#define MIR_TEST_DOUBLES_STUB_SESSION_H
4389+
4390+#include <mir/scene/session.h>
4391+
4392+namespace mir
4393+{
4394+namespace test
4395+{
4396+namespace doubles
4397+{
4398+
4399+struct StubSession : scene::Session
4400+{
4401+ std::shared_ptr<frontend::Surface> get_surface(
4402+ frontend::SurfaceId surface) const override;
4403+
4404+ std::string name() const override;
4405+
4406+ void force_requests_to_complete() override;
4407+
4408+ pid_t process_id() const override;
4409+
4410+ void take_snapshot(scene::SnapshotCallback const& snapshot_taken) override;
4411+
4412+ std::shared_ptr<scene::Surface> default_surface() const override;
4413+
4414+ void set_lifecycle_state(MirLifecycleState state) override;
4415+
4416+ void send_display_config(graphics::DisplayConfiguration const&) override;
4417+
4418+ void hide() override;
4419+
4420+ void show() override;
4421+
4422+ void start_prompt_session() override;
4423+
4424+ void stop_prompt_session() override;
4425+
4426+ void suspend_prompt_session() override;
4427+
4428+ void resume_prompt_session() override;
4429+
4430+ frontend::SurfaceId create_surface(
4431+ scene::SurfaceCreationParameters const& params,
4432+ std::shared_ptr<frontend::EventSink> const& sink) override;
4433+
4434+ void destroy_surface(frontend::SurfaceId surface) override;
4435+
4436+ std::shared_ptr<scene::Surface> surface(
4437+ frontend::SurfaceId surface) const override;
4438+
4439+ std::shared_ptr<scene::Surface> surface_after(
4440+ std::shared_ptr<scene::Surface> const&) const override;
4441+
4442+ std::shared_ptr<frontend::BufferStream> get_buffer_stream(
4443+ frontend::BufferStreamId stream) const override;
4444+
4445+ frontend::BufferStreamId create_buffer_stream(
4446+ graphics::BufferProperties const& props) override;
4447+
4448+ void destroy_buffer_stream(frontend::BufferStreamId stream) override;
4449+
4450+ void configure_streams(
4451+ scene::Surface& surface,
4452+ std::vector<shell::StreamSpecification> const& config) override;
4453+
4454+ void destroy_surface(std::weak_ptr<scene::Surface> const& surface) override;
4455+};
4456+}
4457+}
4458+}
4459+
4460+#endif //MIR_TEST_DOUBLES_STUB_SESSION_H
4461
4462=== added file 'include/test/mir/test/doubles/stub_surface.h'
4463--- include/test/mir/test/doubles/stub_surface.h 1970-01-01 00:00:00 +0000
4464+++ include/test/mir/test/doubles/stub_surface.h 2015-11-25 21:33:30 +0000
4465@@ -0,0 +1,77 @@
4466+/*
4467+ * Copyright © 2015 Canonical Ltd.
4468+ *
4469+ * This program is free software: you can redistribute it and/or modify it
4470+ * under the terms of the GNU General Public License version 3,
4471+ * as published by the Free Software Foundation.
4472+ *
4473+ * This program is distributed in the hope that it will be useful,
4474+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
4475+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4476+ * GNU General Public License for more details.
4477+ *
4478+ * You should have received a copy of the GNU General Public License
4479+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
4480+ *
4481+ * Authored By: Alan Griffiths <alan@octopull.co.uk>
4482+ */
4483+
4484+#ifndef MIR_TEST_DOUBLES_STUB_SURFACE_H
4485+#define MIR_TEST_DOUBLES_STUB_SURFACE_H
4486+
4487+#include <mir/scene/surface.h>
4488+
4489+namespace mir
4490+{
4491+namespace test
4492+{
4493+namespace doubles
4494+{
4495+// scene::Surface is a horribly wide interface to expose from Mir
4496+struct StubSurface : scene::Surface
4497+{
4498+ std::string name() const override;
4499+ void move_to(geometry::Point const& top_left) override;
4500+ float alpha() const override;
4501+ geometry::Size size() const override;
4502+ geometry::Size client_size() const override;
4503+ std::shared_ptr<frontend::BufferStream> primary_buffer_stream() const override;
4504+ void set_streams(std::list<scene::StreamInfo> const& streams) override;
4505+ bool supports_input() const override;
4506+ int client_input_fd() const override;
4507+ std::shared_ptr<input::InputChannel> input_channel() const override;
4508+ input::InputReceptionMode reception_mode() const override;
4509+ void set_reception_mode(input::InputReceptionMode mode) override;
4510+ void set_input_region(std::vector<geometry::Rectangle> const& input_rectangles) override;
4511+ void resize(geometry::Size const& size) override;
4512+ geometry::Point top_left() const override;
4513+ geometry::Rectangle input_bounds() const override;
4514+ bool input_area_contains(geometry::Point const& point) const override;
4515+ void consume(MirEvent const& event) override;
4516+ void set_alpha(float alpha) override;
4517+ void set_orientation(MirOrientation orientation) override;
4518+ void set_transformation(glm::mat4 const&) override;
4519+ bool visible() const override;
4520+ graphics::RenderableList generate_renderables(compositor::CompositorID id) const override;
4521+ int buffers_ready_for_compositor(void const* compositor_id) const override;
4522+ MirSurfaceType type() const override;
4523+ MirSurfaceState state() const override;
4524+ int configure(MirSurfaceAttrib attrib, int value) override;
4525+ int query(MirSurfaceAttrib attrib) const override;
4526+ void hide() override;
4527+ void show() override;
4528+ void set_cursor_image(std::shared_ptr<graphics::CursorImage> const& image) override;
4529+ std::shared_ptr<graphics::CursorImage> cursor_image() const override;
4530+ void set_cursor_stream(std::shared_ptr<frontend::BufferStream> const& stream, geometry::Displacement const& hotspot) override;
4531+ void request_client_surface_close() override;
4532+ std::shared_ptr<Surface> parent() const override;
4533+ void add_observer(std::shared_ptr<scene::SurfaceObserver> const& observer) override;
4534+ void remove_observer(std::weak_ptr<scene::SurfaceObserver> const& observer) override;
4535+ void set_keymap(xkb_rule_names const& rules) override;
4536+ void rename(std::string const& title) override;
4537+};
4538+}
4539+}
4540+}
4541+
4542+#endif //MIR_TEST_DOUBLES_STUB_SURFACE_H
4543
4544=== modified file 'include/test/mir/test/event_matchers.h'
4545--- include/test/mir/test/event_matchers.h 2015-09-18 08:31:26 +0000
4546+++ include/test/mir/test/event_matchers.h 2015-11-25 21:33:30 +0000
4547@@ -229,7 +229,7 @@
4548 }
4549
4550 inline bool button_event_matches(MirPointerEvent const* pev, float x, float y, MirPointerAction action, MirPointerButtons button_state,
4551- bool check_action = true, bool check_buttons = true)
4552+ bool check_action = true, bool check_buttons = true, bool check_axes = true)
4553 {
4554 if (pev == nullptr)
4555 return false;
4556@@ -237,9 +237,9 @@
4557 return false;
4558 if (check_buttons && mir_pointer_event_buttons(pev) != button_state)
4559 return false;
4560- if (mir_pointer_event_axis_value(pev, mir_pointer_axis_x) != x)
4561+ if (check_axes && mir_pointer_event_axis_value(pev, mir_pointer_axis_x) != x)
4562 return false;
4563- if (mir_pointer_event_axis_value(pev, mir_pointer_axis_y) != y)
4564+ if (check_axes && mir_pointer_event_axis_value(pev, mir_pointer_axis_y) != y)
4565 return false;
4566 return true;
4567 }
4568@@ -353,6 +353,14 @@
4569 return true;
4570 }
4571
4572+MATCHER_P(PointerEventWithModifiers, modifiers, "")
4573+{
4574+ auto pev = maybe_pointer_event(to_address(arg));
4575+ if (pev && mir_pointer_event_modifiers(pev) == modifiers)
4576+ return true;
4577+ return false;
4578+}
4579+
4580 MATCHER_P2(PointerEventWithDiff, dx, dy, "")
4581 {
4582 auto pev = maybe_pointer_event(to_address(arg));
4583
4584=== modified file 'include/test/mir/test/wait_condition.h'
4585--- include/test/mir/test/wait_condition.h 2015-06-22 03:04:56 +0000
4586+++ include/test/mir/test/wait_condition.h 2015-11-25 21:33:30 +0000
4587@@ -33,11 +33,16 @@
4588 {
4589 WaitCondition() : woken_(false) {}
4590
4591+ void wait_for_at_most_seconds(std::chrono::seconds const& seconds)
4592+ {
4593+ std::unique_lock<std::mutex> ul(guard);
4594+ condition.wait_for(ul, seconds,
4595+ [this] { return woken_; });
4596+ }
4597+
4598 void wait_for_at_most_seconds(int seconds)
4599 {
4600- std::unique_lock<std::mutex> ul(guard);
4601- condition.wait_for(ul, std::chrono::seconds(seconds),
4602- [this] { return woken_; });
4603+ wait_for_at_most_seconds(std::chrono::seconds(seconds));
4604 }
4605
4606 void wake_up_everyone()
4607
4608=== modified file 'include/test/mir_test_framework/async_server_runner.h'
4609--- include/test/mir_test_framework/async_server_runner.h 2015-07-27 07:24:50 +0000
4610+++ include/test/mir_test_framework/async_server_runner.h 2015-11-25 21:33:30 +0000
4611@@ -52,7 +52,7 @@
4612 auto new_connection() -> std::string;
4613
4614 /// \return a connection string for a client to connect to the server
4615- auto connection(mir::Fd fd) -> std::string;
4616+ auto connection(int fd) -> std::string;
4617
4618 mir::Server server;
4619
4620@@ -60,8 +60,6 @@
4621 std::list<TemporaryEnvironmentValue> env;
4622 mir::test::AutoJoinThread server_thread;
4623
4624- std::list<mir::Fd> connections;
4625-
4626 std::mutex mutex;
4627 std::condition_variable started;
4628 bool server_running{false};
4629
4630=== modified file 'include/test/mir_test_framework/connected_client_with_a_surface.h'
4631--- include/test/mir_test_framework/connected_client_with_a_surface.h 2015-06-22 03:04:56 +0000
4632+++ include/test/mir_test_framework/connected_client_with_a_surface.h 2015-11-25 21:33:30 +0000
4633@@ -20,6 +20,7 @@
4634 #define MIR_TEST_FRAMEWORK_CONNECTED_CLIENT_WITH_A_SURFACE_H_
4635
4636 #include "mir_test_framework/connected_client_headless_server.h"
4637+#include "mir/geometry/size.h"
4638
4639 namespace mir_test_framework
4640 {
4641@@ -30,6 +31,8 @@
4642 void SetUp() override;
4643
4644 void TearDown() override;
4645+
4646+ mir::geometry::Size const surface_size {640, 480};
4647 };
4648 }
4649
4650
4651=== modified file 'include/test/mir_test_framework/declarative_placement_window_manage_policy.h'
4652--- include/test/mir_test_framework/declarative_placement_window_manage_policy.h 2015-06-25 13:55:28 +0000
4653+++ include/test/mir_test_framework/declarative_placement_window_manage_policy.h 2015-11-25 21:33:30 +0000
4654@@ -21,7 +21,6 @@
4655
4656 #include "mir/shell/canonical_window_manager.h"
4657 #include "mir/geometry/rectangle.h"
4658-#include "mir/scene/depth_id.h"
4659
4660 #include <memory>
4661 #include <map>
4662@@ -30,7 +29,6 @@
4663 namespace mir_test_framework
4664 {
4665 typedef std::map<std::string, mir::geometry::Rectangle> SurfaceGeometries;
4666-typedef std::map<std::string, mir::scene::DepthId> SurfaceDepths;
4667
4668 /// DeclarativePlacementWindowManagerPolicy is a test utility server component for specifying
4669 /// a static list of surface geometries and relative depths. Used, for example,
4670@@ -42,7 +40,6 @@
4671 DeclarativePlacementWindowManagerPolicy(
4672 Tools* const tools,
4673 SurfaceGeometries const& positions_by_name,
4674- SurfaceDepths const& depths_by_name,
4675 std::shared_ptr<mir::shell::DisplayLayout> const& display_layout);
4676
4677 auto handle_place_new_surface(
4678@@ -52,7 +49,6 @@
4679
4680 private:
4681 SurfaceGeometries const& surface_geometries_by_name;
4682- SurfaceDepths const& surface_depths_by_name;
4683 };
4684
4685 }
4686
4687=== modified file 'include/test/mir_test_framework/executable_path.h'
4688--- include/test/mir_test_framework/executable_path.h 2015-10-06 02:30:52 +0000
4689+++ include/test/mir_test_framework/executable_path.h 2015-11-25 21:33:30 +0000
4690@@ -26,6 +26,7 @@
4691 std::string executable_path();
4692
4693 std::string library_path();
4694+std::string server_platform_path();
4695 std::string udev_recordings_path();
4696 std::string server_platform(std::string const& name);
4697 std::string server_input_platform(std::string const& name);
4698
4699=== modified file 'include/test/mir_test_framework/placement_applying_shell.h'
4700--- include/test/mir_test_framework/placement_applying_shell.h 2015-10-02 01:56:04 +0000
4701+++ include/test/mir_test_framework/placement_applying_shell.h 2015-11-25 21:33:30 +0000
4702@@ -21,7 +21,6 @@
4703
4704 #include "mir/shell/shell_wrapper.h"
4705 #include "mir/geometry/rectangle.h"
4706-#include "mir/scene/depth_id.h"
4707
4708 #include "mir/scene/session.h"
4709 #include "mir/scene/surface.h"
4710@@ -35,15 +34,13 @@
4711 {
4712 using ClientInputRegions = std::map<std::string, std::vector<mir::geometry::Rectangle>>;
4713 using ClientPositions = std::map<std::string, mir::geometry::Rectangle>;
4714-using ClientDepths = std::map<std::string, mir::scene::DepthId>;
4715
4716 struct PlacementApplyingShell : mir::shell::ShellWrapper
4717 {
4718 PlacementApplyingShell(
4719 std::shared_ptr<mir::shell::Shell> wrapped_coordinator,
4720 ClientInputRegions const& client_input_regions,
4721- ClientPositions const& client_positions,
4722- ClientDepths const& client_depths);
4723+ ClientPositions const& client_positions);
4724
4725 mir::frontend::SurfaceId create_surface(
4726 std::shared_ptr<mir::scene::Session> const& session,
4727@@ -52,7 +49,6 @@
4728 private:
4729 ClientInputRegions const& client_input_regions;
4730 ClientPositions const& client_positions;
4731- ClientDepths const& client_depths;
4732 };
4733
4734 }
4735
4736=== modified file 'playground/demo-shell/default_window_manager.cpp'
4737--- playground/demo-shell/default_window_manager.cpp 2015-07-23 02:39:20 +0000
4738+++ playground/demo-shell/default_window_manager.cpp 2015-11-25 21:33:30 +0000
4739@@ -104,9 +104,10 @@
4740 }
4741
4742 void me::DefaultWindowManager::remove_surface(
4743- std::shared_ptr<scene::Session> const& /*session*/,
4744- std::weak_ptr<scene::Surface> const& /*surface*/)
4745+ std::shared_ptr<scene::Session> const& session,
4746+ std::weak_ptr<scene::Surface> const& surface)
4747 {
4748+ session->destroy_surface(surface);
4749 }
4750
4751 void me::DefaultWindowManager::add_display(geometry::Rectangle const& /*area*/)
4752@@ -117,6 +118,13 @@
4753 {
4754 }
4755
4756+void me::DefaultWindowManager::handle_raise_surface(
4757+ std::shared_ptr<scene::Session> const& /*session*/,
4758+ std::shared_ptr<scene::Surface> const& /*surface*/,
4759+ uint64_t /*timestamp*/)
4760+{
4761+}
4762+
4763 bool me::DefaultWindowManager::handle_keyboard_event(MirKeyboardEvent const* /*event*/)
4764 {
4765 return false;
4766
4767=== modified file 'playground/demo-shell/default_window_manager.h'
4768--- playground/demo-shell/default_window_manager.h 2015-06-24 03:00:56 +0000
4769+++ playground/demo-shell/default_window_manager.h 2015-11-25 21:33:30 +0000
4770@@ -64,6 +64,11 @@
4771
4772 bool handle_pointer_event(MirPointerEvent const* event) override;
4773
4774+ void handle_raise_surface(
4775+ std::shared_ptr<scene::Session> const& session,
4776+ std::shared_ptr<scene::Surface> const& surface,
4777+ uint64_t timestamp) override;
4778+
4779 int set_surface_attribute(
4780 std::shared_ptr<scene::Session> const& session,
4781 std::shared_ptr<scene::Surface> const& surface,
4782
4783=== modified file 'playground/demo-shell/demo_renderer.cpp'
4784--- playground/demo-shell/demo_renderer.cpp 2015-10-06 02:30:52 +0000
4785+++ playground/demo-shell/demo_renderer.cpp 2015-11-25 21:33:30 +0000
4786@@ -311,10 +311,6 @@
4787 tl_shadow.vertices[1] = {{leftr, top, 0.0f}, {1.0f, 0.0f}};
4788 tl_shadow.vertices[2] = {{leftr, topr, 0.0f}, {1.0f, 1.0f}};
4789 tl_shadow.vertices[3] = {{left, topr, 0.0f}, {0.0f, 1.0f}};
4790-
4791- // Shadows always need blending...
4792- glEnable(GL_BLEND);
4793- glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
4794 }
4795
4796 void DemoRenderer::tessellate_frame(std::vector<gl::Primitive>& primitives,
4797
4798=== modified file 'playground/demo-shell/demo_shell.cpp'
4799--- playground/demo-shell/demo_shell.cpp 2015-06-24 03:00:56 +0000
4800+++ playground/demo-shell/demo_shell.cpp 2015-11-25 21:33:30 +0000
4801@@ -48,10 +48,6 @@
4802 {
4803 namespace examples
4804 {
4805-using CanonicalWindowManager = msh::BasicWindowManager<msh::CanonicalWindowManagerPolicy, msh::CanonicalSessionInfo, msh::CanonicalSurfaceInfo>;
4806-using TilingWindowManager = me::BasicWindowManagerCopy<me::TilingWindowManagerPolicy, me::TilingSessionInfo, me::TilingSurfaceInfo>;
4807-
4808-
4809 class DisplayBufferCompositorFactory : public mc::DisplayBufferCompositorFactory
4810 {
4811 public:
4812@@ -120,7 +116,7 @@
4813 }
4814 else if (selection == wm_canonical)
4815 {
4816- return std::make_shared<CanonicalWindowManager>(
4817+ return std::make_shared<msh::CanonicalWindowManager>(
4818 focus_controller,
4819 the_shell_display_layout());
4820 }
4821
4822=== modified file 'src/CMakeLists.txt'
4823--- src/CMakeLists.txt 2015-10-06 02:30:52 +0000
4824+++ src/CMakeLists.txt 2015-11-25 21:33:30 +0000
4825@@ -50,6 +50,7 @@
4826 # We need the ABI versions in the tests
4827 set(MIR_SERVER_GRAPHICS_PLATFORM_ABI ${MIR_SERVER_GRAPHICS_PLATFORM_ABI} PARENT_SCOPE)
4828 set(MIR_SERVER_INPUT_PLATFORM_ABI ${MIR_SERVER_INPUT_PLATFORM_ABI} PARENT_SCOPE)
4829+set(MIR_SERVER_GRAPHICS_PLATFORM_VERSION ${MIR_SERVER_GRAPHICS_PLATFORM_VERSION} PARENT_SCOPE)
4830 set(MIR_CLIENT_PLATFORM_ABI ${MIR_CLIENT_PLATFORM_ABI} PARENT_SCOPE)
4831 set(MIR_INPUT_PLATFORM_VERSION_SCRIPT ${MIR_INPUT_PLATFORM_VERSION_SCRIPT} PARENT_SCOPE)
4832 set(MIR_CLIENT_PLATFORM_VERSION ${MIR_CLIENT_PLATFORM_VERSION} PARENT_SCOPE)
4833
4834=== modified file 'src/client/CMakeLists.txt'
4835--- src/client/CMakeLists.txt 2015-10-02 04:27:35 +0000
4836+++ src/client/CMakeLists.txt 2015-11-25 21:33:30 +0000
4837@@ -18,6 +18,7 @@
4838 include_directories(
4839 ${PROTOBUF_INCLUDE_DIRS}
4840 ${CMAKE_CURRENT_BINARY_DIR}
4841+ ${PROJECT_SOURCE_DIR}/include/cookie
4842 ${PROJECT_SOURCE_DIR}/include/client
4843 ${PROJECT_SOURCE_DIR}/src/include/client
4844 ${DRM_INCLUDE_DIRS}
4845
4846=== modified file 'src/client/buffer_stream.cpp'
4847--- src/client/buffer_stream.cpp 2015-09-24 15:42:21 +0000
4848+++ src/client/buffer_stream.cpp 2015-11-25 21:33:30 +0000
4849@@ -282,25 +282,39 @@
4850 void deposit(mp::Buffer const& buffer, geom::Size, MirPixelFormat) override
4851 {
4852 vault.wire_transfer_inbound(buffer);
4853+
4854+ std::lock_guard<std::mutex> lk(mutex);
4855 current_buffer_id_ = buffer.buffer_id();
4856 }
4857
4858+ void advance_current_buffer(std::unique_lock<std::mutex>& lk)
4859+ {
4860+ lk.unlock();
4861+ auto buffer = vault.withdraw().get();
4862+ lk.lock();
4863+ current_buffer_ = buffer;
4864+ }
4865+
4866 std::shared_ptr<mir::client::ClientBuffer> current_buffer() override
4867 {
4868+ std::unique_lock<std::mutex> lk(mutex);
4869 if (!current_buffer_)
4870- current_buffer_ = vault.withdraw().get();
4871+ advance_current_buffer(lk);
4872 return current_buffer_;
4873 }
4874
4875 uint32_t current_buffer_id() override
4876 {
4877+ std::lock_guard<std::mutex> lk(mutex);
4878 return current_buffer_id_;
4879 }
4880
4881 MirWaitHandle* submit(std::function<void()> const& done, geom::Size, MirPixelFormat, int) override
4882 {
4883+ std::unique_lock<std::mutex> lk(mutex);
4884 if (!current_buffer_)
4885- current_buffer_ = vault.withdraw().get();
4886+ advance_current_buffer(lk);
4887+ lk.unlock();
4888
4889 vault.deposit(current_buffer_);
4890
4891@@ -308,7 +322,8 @@
4892 vault.wire_transfer_outbound(current_buffer_);
4893 next_buffer_wait_handle.result_received();
4894
4895- current_buffer_ = vault.withdraw().get();
4896+ lk.lock();
4897+ advance_current_buffer(lk);
4898 done();
4899 return &next_buffer_wait_handle;
4900 }
4901@@ -327,6 +342,7 @@
4902 }
4903
4904 mcl::BufferVault vault;
4905+ std::mutex mutex;
4906 std::shared_ptr<mcl::ClientBuffer> current_buffer_;
4907 int current_buffer_id_;
4908 MirWaitHandle next_buffer_wait_handle;
4909@@ -341,7 +357,8 @@
4910 mp::BufferStream const& protobuf_bs,
4911 std::shared_ptr<mcl::PerfReport> const& perf_report,
4912 std::string const& surface_name,
4913- geom::Size ideal_size)
4914+ geom::Size ideal_size,
4915+ size_t nbuffers)
4916 : connection(connection),
4917 display_server(server),
4918 mode(mode),
4919@@ -351,7 +368,8 @@
4920 scale_(1.0f),
4921 perf_report(perf_report),
4922 protobuf_void{mcl::make_protobuf_object<mir::protobuf::Void>()},
4923- ideal_buffer_size(ideal_size)
4924+ ideal_buffer_size(ideal_size),
4925+ nbuffers(nbuffers)
4926 {
4927 created(nullptr, nullptr);
4928 perf_report->name_surface(surface_name.c_str());
4929@@ -363,6 +381,7 @@
4930 std::shared_ptr<mcl::ClientPlatform> const& client_platform,
4931 mp::BufferStreamParameters const& parameters,
4932 std::shared_ptr<mcl::PerfReport> const& perf_report,
4933+ size_t nbuffers,
4934 mir_buffer_stream_callback callback,
4935 void *context)
4936 : connection(connection),
4937@@ -373,7 +392,8 @@
4938 swap_interval_(1),
4939 perf_report(perf_report),
4940 protobuf_void{mcl::make_protobuf_object<mir::protobuf::Void>()},
4941- ideal_buffer_size(parameters.width(), parameters.height())
4942+ ideal_buffer_size(parameters.width(), parameters.height()),
4943+ nbuffers(nbuffers)
4944 {
4945 perf_report->name_surface(std::to_string(reinterpret_cast<long int>(this)).c_str());
4946
4947@@ -409,11 +429,10 @@
4948 }
4949 else
4950 {
4951- int initial_nbuffers = 3u;
4952 buffer_depository = std::make_unique<NewBufferSemantics>(
4953 client_platform->create_buffer_factory(),
4954 std::make_shared<Requests>(display_server, protobuf_bs->id().value()),
4955- ideal_buffer_size, mir_pixel_format_abgr_8888, 0, initial_nbuffers);
4956+ ideal_buffer_size, static_cast<MirPixelFormat>(protobuf_bs->pixel_format()), 0, nbuffers);
4957 }
4958
4959
4960@@ -437,7 +456,7 @@
4961 process_buffer(buffer, lock);
4962 }
4963
4964-void mcl::BufferStream::process_buffer(protobuf::Buffer const& buffer, std::unique_lock<std::mutex> const&)
4965+void mcl::BufferStream::process_buffer(protobuf::Buffer const& buffer, std::unique_lock<std::mutex>& lk)
4966 {
4967 if (buffer.has_width() && buffer.has_height())
4968 {
4969@@ -452,7 +471,8 @@
4970 try
4971 {
4972 auto pixel_format = static_cast<MirPixelFormat>(protobuf_bs->pixel_format());
4973- buffer_depository->deposit(buffer, cached_buffer_size, pixel_format);
4974+ lk.unlock();
4975+ buffer_depository->deposit(buffer, geom::Size{buffer.width(), buffer.height()}, pixel_format);
4976 perf_report->begin_frame(buffer.buffer_id());
4977 }
4978 catch (const std::runtime_error& err)
4979@@ -497,7 +517,6 @@
4980
4981 std::shared_ptr<mcl::ClientBuffer> mcl::BufferStream::get_current_buffer()
4982 {
4983- std::unique_lock<decltype(mutex)> lock(mutex);
4984 return buffer_depository->current_buffer();
4985 }
4986
4987@@ -509,14 +528,17 @@
4988
4989 void mcl::BufferStream::release_cpu_region()
4990 {
4991+ std::unique_lock<decltype(mutex)> lock(mutex);
4992 secured_region.reset();
4993 }
4994
4995 std::shared_ptr<mcl::MemoryRegion> mcl::BufferStream::secure_for_cpu_write()
4996 {
4997+ auto buffer = buffer_depository->current_buffer();
4998 std::unique_lock<decltype(mutex)> lock(mutex);
4999
5000- secured_region = buffer_depository->current_buffer()->secure_for_cpu_write();
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: