Status: | Merged |
---|---|
Merged at revision: | 1187 |
Proposed branch: | lp:mir/0.2 |
Merge into: | lp:mir/ubuntu |
Diff against target: |
32342 lines (+14903/-5962) 432 files modified
3rd_party/android-deps/std/Thread.h (+14/-2) 3rd_party/android-input/android/frameworks/base/services/input/EventHub.h (+0/-1) 3rd_party/android-input/android/frameworks/base/services/input/InputDispatcher.cpp (+5/-9) 3rd_party/android-input/android/frameworks/base/services/input/InputDispatcher.h (+6/-17) 3rd_party/android-input/android/frameworks/base/services/input/InputListener.cpp (+12/-12) 3rd_party/android-input/android/frameworks/base/services/input/InputListener.h (+9/-8) 3rd_party/android-input/android/frameworks/base/services/input/InputReader.cpp (+4/-4) 3rd_party/android-input/android/frameworks/base/services/input/InputReader.h (+7/-7) CMakeLists.txt (+4/-3) benchmarks/android-input/input_reader_perf.cpp (+6/-7) cmake/Doxygen.cmake (+3/-1) cmake/FindAndroidProperties.cmake (+22/-0) debian/changelog (+126/-0) debian/control (+4/-2) debian/libmirserver20.install (+1/-1) debian/mir-test-tools.install (+1/-0) doc/building_source_for_android.md (+2/-2) doc/demo_shell_controls.md (+45/-0) doc/mainpage.md (+1/-0) examples/CMakeLists.txt (+5/-0) examples/demo-shell/demo_renderer.cpp (+9/-7) examples/demo-shell/demo_renderer.h (+4/-5) examples/demo-shell/window_manager.cpp (+34/-8) examples/eglapp.c (+1/-0) examples/eglcounter.cpp (+3/-5) examples/fingerpaint.c (+2/-2) examples/minimal_server.cpp (+28/-0) examples/render_overlays.cpp (+5/-8) examples/render_surfaces.cpp (+3/-79) include/client/mir_toolkit/mir_connection.h (+19/-0) include/client/mir_toolkit/mir_cursor_configuration.h (+68/-0) include/client/mir_toolkit/mir_surface.h (+20/-0) include/platform/mir/emergency_cleanup_registry.h (+45/-0) include/platform/mir/graphics/cursor.h (+6/-1) include/platform/mir/graphics/cursor_image.h (+46/-0) include/platform/mir/graphics/display.h (+3/-2) include/platform/mir/graphics/display_buffer.h (+16/-8) include/platform/mir/graphics/display_configuration.h (+1/-0) include/platform/mir/graphics/gl_primitive.h (+44/-0) include/platform/mir/graphics/gl_program.h (+20/-11) include/platform/mir/graphics/gl_program_factory.h (+2/-1) include/platform/mir/graphics/gl_texture.h (+44/-0) include/platform/mir/graphics/gl_texture_cache.h (+67/-0) include/platform/mir/graphics/platform.h (+2/-0) include/platform/mir/graphics/renderable.h (+4/-11) include/platform/mir/graphics/tessellation_helpers.h (+31/-0) include/server/mir/asio_main_loop.h (+25/-1) include/server/mir/compositor/gl_renderer.h (+9/-44) include/server/mir/compositor/recently_used_cache.h (+56/-0) include/server/mir/compositor/renderer.h (+4/-6) include/server/mir/compositor/scene.h (+17/-11) include/server/mir/default_server_configuration.h (+65/-12) include/server/mir/display_changer.h (+3/-0) include/server/mir/emergency_cleanup.h (+35/-0) include/server/mir/frontend/connection_context.h (+52/-0) include/server/mir/frontend/connection_creator.h (+14/-10) include/server/mir/frontend/connections.h (+16/-16) include/server/mir/frontend/connector.h (+8/-2) include/server/mir/frontend/message_processor.h (+1/-0) include/server/mir/frontend/protobuf_connection_creator.h (+16/-14) include/server/mir/frontend/session.h (+1/-3) include/server/mir/frontend/session_authorizer.h (+7/-5) include/server/mir/frontend/session_credentials.h (+46/-0) include/server/mir/frontend/surface.h (+2/-1) include/server/mir/frontend/template_protobuf_message_processor.h (+2/-2) include/server/mir/graphics/cursor_images.h (+53/-0) include/server/mir/input/android/default_android_input_configuration.h (+39/-14) include/server/mir/input/android/dispatcher_input_configuration.h (+0/-129) include/server/mir/input/input_configuration.h (+0/-58) include/server/mir/input/input_dispatcher.h (+58/-0) include/server/mir/input/input_manager.h (+2/-8) include/server/mir/input/surface.h (+5/-5) include/server/mir/main_loop.h (+4/-1) include/server/mir/run_mir.h (+2/-0) include/server/mir/scene/input_registrar.h (+0/-59) include/server/mir/scene/legacy_scene_change_notification.h (+65/-0) include/server/mir/scene/null_observer.h (+51/-0) include/server/mir/scene/null_surface_observer.h (+50/-0) include/server/mir/scene/observer.h (+56/-0) include/server/mir/scene/session_coordinator.h (+38/-0) include/server/mir/scene/surface.h (+14/-5) include/server/mir/scene/surface_event_source.h (+4/-4) include/server/mir/scene/surface_observer.h (+10/-7) include/server/mir/server_action_queue.h (+46/-0) include/server/mir/server_configuration.h (+4/-0) include/server/mir/shell/session_coordinator_wrapper.h (+57/-0) include/server/mir/shell/surface_coordinator_wrapper.h (+47/-0) include/server/mir/time/alarm.h (+86/-0) include/server/mir/time/timer.h (+70/-0) include/shared/mir/geometry/point.h (+3/-0) include/shared/mir/geometry/rectangle.h (+2/-0) include/shared/mir/variable_length_array.h (+64/-0) include/shared/mir_toolkit/client_types.h (+13/-0) include/shared/mir_toolkit/common.h (+1/-0) include/test/mir_test/auto_unblock_thread.h (+79/-0) include/test/mir_test/client_event_matchers.h (+147/-35) include/test/mir_test/fake_event_hub.h (+3/-0) include/test/mir_test/fake_event_hub_input_configuration.h (+10/-11) include/test/mir_test/popen.h (+59/-0) include/test/mir_test/stub_server_tool.h (+5/-3) include/test/mir_test/test_protobuf_server.h (+6/-6) include/test/mir_test/wait_object.h (+58/-0) include/test/mir_test_doubles/fake_ipc_factory.h (+66/-0) include/test/mir_test_doubles/fake_renderable.h (+1/-1) include/test/mir_test_doubles/mock_android_input_dispatcher.h (+3/-3) include/test/mir_test_doubles/mock_buffer_bundle.h (+1/-0) include/test/mir_test_doubles/mock_display.h (+1/-1) include/test/mir_test_doubles/mock_display_buffer.h (+1/-2) include/test/mir_test_doubles/mock_display_device.h (+3/-2) include/test/mir_test_doubles/mock_frontend_surface.h (+1/-1) include/test/mir_test_doubles/mock_gl.h (+1/-0) include/test/mir_test_doubles/mock_input_dispatcher.h (+45/-0) include/test/mir_test_doubles/mock_input_manager.h (+0/-2) include/test/mir_test_doubles/mock_input_registrar.h (+0/-46) include/test/mir_test_doubles/mock_input_surface.h (+7/-10) include/test/mir_test_doubles/mock_render_function.h (+0/-40) include/test/mir_test_doubles/mock_renderable.h (+2/-2) include/test/mir_test_doubles/mock_renderable_list_compositor.h (+41/-0) include/test/mir_test_doubles/mock_renderer.h (+1/-1) include/test/mir_test_doubles/mock_scene.h (+6/-5) include/test/mir_test_doubles/mock_surface.h (+1/-0) include/test/mir_test_doubles/null_display.h (+4/-1) include/test/mir_test_doubles/null_display_buffer.h (+1/-3) include/test/mir_test_doubles/null_emergency_cleanup.h (+42/-0) include/test/mir_test_doubles/null_event_filter.h (+0/-40) include/test/mir_test_doubles/null_platform.h (+1/-0) include/test/mir_test_doubles/stub_display_builder.h (+2/-3) include/test/mir_test_doubles/stub_display_device.h (+0/-61) include/test/mir_test_doubles/stub_gl_program.h (+42/-0) include/test/mir_test_doubles/stub_gl_program_factory.h (+49/-0) include/test/mir_test_doubles/stub_input_enumerator.h (+42/-0) include/test/mir_test_doubles/stub_input_registrar.h (+0/-47) include/test/mir_test_doubles/stub_input_surface.h (+61/-0) include/test/mir_test_doubles/stub_ipc_factory.h (+10/-4) include/test/mir_test_doubles/stub_renderable.h (+11/-3) include/test/mir_test_doubles/stub_renderable_list_compositor.h (+41/-0) include/test/mir_test_doubles/stub_renderer.h (+3/-3) include/test/mir_test_doubles/stub_scene.h (+51/-0) include/test/mir_test_doubles/stub_scene_surface.h (+100/-0) include/test/mir_test_doubles/stub_session_authorizer.h (+10/-10) include/test/mir_test_doubles/stub_timer.h (+70/-0) include/test/mir_test_framework/basic_client_server_fixture.h (+53/-0) include/test/mir_test_framework/command_line_server_configuration.h (+38/-0) include/test/mir_test_framework/input_testing_client_configuration.h (+2/-0) include/test/mir_test_framework/input_testing_server_configuration.h (+2/-0) include/test/mir_test_framework/stubbed_server_configuration.h (+5/-3) src/client/CMakeLists.txt (+1/-0) src/client/android/client_surface_interpreter.cpp (+3/-3) src/client/cursor_configuration.h (+31/-0) src/client/mir_connection.cpp (+34/-0) src/client/mir_connection.h (+8/-0) src/client/mir_connection_api.cpp (+18/-0) src/client/mir_cursor_api.cpp (+44/-0) src/client/mir_surface.cpp (+36/-4) src/client/mir_surface.h (+6/-1) src/client/mir_surface_api.cpp (+42/-1) src/client/rpc/mir_basic_rpc_channel.cpp (+6/-8) src/client/rpc/mir_socket_rpc_channel.cpp (+54/-62) src/client/rpc/mir_socket_rpc_channel.h (+2/-0) src/platform/graphics/CMakeLists.txt (+3/-0) src/platform/graphics/android/CMakeLists.txt (+4/-0) src/platform/graphics/android/android_display.cpp (+4/-3) src/platform/graphics/android/android_display.h (+3/-1) src/platform/graphics/android/android_platform.cpp (+3/-2) src/platform/graphics/android/android_platform.h (+1/-1) src/platform/graphics/android/device_quirks.cpp (+54/-0) src/platform/graphics/android/device_quirks.h (+68/-0) src/platform/graphics/android/display_buffer.cpp (+30/-12) src/platform/graphics/android/display_buffer.h (+6/-4) src/platform/graphics/android/display_builder.h (+2/-1) src/platform/graphics/android/display_device.h (+3/-3) src/platform/graphics/android/fb_device.cpp (+5/-7) src/platform/graphics/android/fb_device.h (+2/-2) src/platform/graphics/android/framebuffers.cpp (+4/-3) src/platform/graphics/android/framebuffers.h (+1/-1) src/platform/graphics/android/hwc_device.cpp (+7/-14) src/platform/graphics/android/hwc_device.h (+2/-2) src/platform/graphics/android/hwc_fallback_gl_renderer.cpp (+130/-0) src/platform/graphics/android/hwc_fallback_gl_renderer.h (+71/-0) src/platform/graphics/android/hwc_fb_device.cpp (+26/-7) src/platform/graphics/android/hwc_fb_device.h (+2/-2) src/platform/graphics/android/hwc_layerlist.cpp (+3/-2) src/platform/graphics/android/hwc_layers.cpp (+2/-2) src/platform/graphics/android/output_builder.cpp (+7/-2) src/platform/graphics/android/output_builder.h (+1/-0) src/platform/graphics/display_configuration.cpp (+25/-2) src/platform/graphics/gl_program.cpp (+6/-6) src/platform/graphics/gl_texture.cpp (+50/-0) src/platform/graphics/mesa/buffer_allocator.cpp (+8/-8) src/platform/graphics/mesa/buffer_allocator.h (+4/-2) src/platform/graphics/mesa/cursor.cpp (+36/-12) src/platform/graphics/mesa/cursor.h (+13/-4) src/platform/graphics/mesa/display.cpp (+13/-8) src/platform/graphics/mesa/display.h (+3/-2) src/platform/graphics/mesa/display_buffer.cpp (+4/-6) src/platform/graphics/mesa/display_buffer.h (+1/-2) src/platform/graphics/mesa/native_platform.cpp (+2/-1) src/platform/graphics/mesa/platform.cpp (+24/-7) src/platform/graphics/mesa/platform.h (+12/-1) src/platform/graphics/tessellation_helpers.cpp (+49/-0) src/server/CMakeLists.txt (+2/-1) src/server/asio_main_loop.cpp (+276/-4) src/server/compositor/CMakeLists.txt (+2/-1) src/server/compositor/buffer_bundle.h (+9/-0) src/server/compositor/buffer_queue.cpp (+407/-0) src/server/compositor/buffer_queue.h (+94/-0) src/server/compositor/buffer_stream_factory.cpp (+2/-2) src/server/compositor/default_display_buffer_compositor.cpp (+14/-28) src/server/compositor/gl_renderer.cpp (+28/-89) src/server/compositor/gl_renderer_factory.cpp (+2/-1) src/server/compositor/multi_threaded_compositor.cpp (+31/-5) src/server/compositor/multi_threaded_compositor.h (+7/-0) src/server/compositor/recently_used_cache.cpp (+70/-0) src/server/compositor/screencast_display_buffer.cpp (+2/-7) src/server/compositor/screencast_display_buffer.h (+1/-3) src/server/compositor/switching_bundle.cpp (+0/-490) src/server/compositor/switching_bundle.h (+0/-125) src/server/default_server_configuration.cpp (+59/-25) src/server/display_server.cpp (+29/-29) src/server/frontend/CMakeLists.txt (+5/-3) src/server/frontend/connection_context.cpp (+36/-0) src/server/frontend/default_configuration.cpp (+14/-97) src/server/frontend/default_ipc_factory.cpp (+112/-0) src/server/frontend/default_ipc_factory.h (+82/-0) src/server/frontend/display_server.h (+41/-0) src/server/frontend/event_sender.cpp (+9/-6) src/server/frontend/message_receiver.h (+3/-2) src/server/frontend/protobuf_connection_creator.cpp (+25/-22) src/server/frontend/protobuf_ipc_factory.h (+9/-7) src/server/frontend/protobuf_message_processor.cpp (+35/-15) src/server/frontend/protobuf_message_processor.h (+6/-4) src/server/frontend/protobuf_responder.cpp (+12/-8) src/server/frontend/protobuf_responder.h (+0/-1) src/server/frontend/published_socket_connector.cpp (+32/-25) src/server/frontend/published_socket_connector.h (+12/-9) src/server/frontend/session_credentials.cpp (+42/-0) src/server/frontend/session_mediator.cpp (+64/-8) src/server/frontend/session_mediator.h (+27/-10) src/server/frontend/socket_connection.cpp (+28/-21) src/server/frontend/socket_connection.h (+15/-12) src/server/frontend/socket_messenger.cpp (+68/-22) src/server/frontend/socket_messenger.h (+9/-5) src/server/frontend/surface.cpp (+1/-1) src/server/graphics/CMakeLists.txt (+1/-1) src/server/graphics/builtin_cursor_images.cpp (+52/-0) src/server/graphics/builtin_cursor_images.h (+51/-0) src/server/graphics/default_configuration.cpp (+37/-1) src/server/graphics/nested/nested_display.cpp (+5/-5) src/server/graphics/nested/nested_display.h (+4/-4) src/server/graphics/nested/nested_output.cpp (+7/-8) src/server/graphics/nested/nested_output.h (+3/-5) src/server/graphics/nested/nested_platform.cpp (+4/-3) src/server/graphics/nested/nested_platform.h (+4/-3) src/server/graphics/offscreen/display.cpp (+1/-1) src/server/graphics/offscreen/display.h (+1/-1) src/server/graphics/offscreen/display_buffer.cpp (+2/-3) src/server/graphics/offscreen/display_buffer.h (+1/-3) src/server/graphics/program_factory.cpp (+9/-1) src/server/graphics/program_factory.h (+2/-0) src/server/input/CMakeLists.txt (+1/-1) src/server/input/android/CMakeLists.txt (+4/-2) src/server/input/android/android_input_application_handle.cpp (+1/-1) src/server/input/android/android_input_application_handle.h (+2/-2) src/server/input/android/android_input_channel.h (+0/-2) src/server/input/android/android_input_dispatcher.cpp (+141/-0) src/server/input/android/android_input_dispatcher.h (+63/-0) src/server/input/android/android_input_manager.cpp (+4/-11) src/server/input/android/android_input_manager.h (+10/-11) src/server/input/android/android_input_registrar.cpp (+49/-15) src/server/input/android/android_input_registrar.h (+29/-12) src/server/input/android/android_input_target_enumerator.cpp (+5/-5) src/server/input/android/android_input_target_enumerator.h (+2/-2) src/server/input/android/android_input_targeter.cpp (+1/-1) src/server/input/android/android_input_targeter.h (+2/-4) src/server/input/android/android_input_window_handle.cpp (+9/-10) src/server/input/android/android_input_window_handle.h (+2/-2) src/server/input/android/common_input_thread.cpp (+44/-0) src/server/input/android/common_input_thread.h (+57/-0) src/server/input/android/default_android_input_configuration.cpp (+39/-57) src/server/input/android/dispatcher_input_configuration.cpp (+0/-155) src/server/input/android/input_channel_factory.cpp (+28/-0) src/server/input/android/input_channel_factory.h (+44/-0) src/server/input/android/input_dispatcher_manager.cpp (+0/-58) src/server/input/android/input_dispatcher_manager.h (+0/-63) src/server/input/android/input_translator.cpp (+206/-0) src/server/input/android/input_translator.h (+56/-0) src/server/input/default_configuration.cpp (+103/-39) src/server/input/nested_input_configuration.cpp (+22/-27) src/server/input/nested_input_configuration.h (+9/-14) src/server/input/nested_input_relay.cpp (+0/-121) src/server/input/nested_input_relay.h (+0/-49) src/server/input/null_input_configuration.cpp (+28/-62) src/server/input/null_input_configuration.h (+4/-6) src/server/input/null_input_dispatcher.cpp (+42/-0) src/server/input/null_input_dispatcher.h (+42/-0) src/server/input/null_input_manager.h (+42/-0) src/server/input/null_input_targeter.cpp (+13/-0) src/server/input/null_input_targeter.h (+47/-0) src/server/report/CMakeLists.txt (+1/-1) src/server/run_mir.cpp (+30/-16) src/server/scene/CMakeLists.txt (+4/-2) src/server/scene/application_session.h (+2/-0) src/server/scene/basic_surface.cpp (+184/-53) src/server/scene/basic_surface.h (+15/-12) src/server/scene/default_configuration.cpp (+47/-45) src/server/scene/legacy_scene_change_notification.cpp (+95/-0) src/server/scene/legacy_surface_change_notification.cpp (+25/-9) src/server/scene/legacy_surface_change_notification.h (+8/-3) src/server/scene/mediating_display_changer.cpp (+109/-54) src/server/scene/mediating_display_changer.h (+12/-1) src/server/scene/null_observer.cpp (+27/-0) src/server/scene/null_surface_observer.cpp (+9/-8) src/server/scene/session_manager.h (+2/-4) src/server/scene/surface_stack.cpp (+97/-90) src/server/scene/surface_stack.h (+26/-9) src/server/shell/CMakeLists.txt (+2/-0) src/server/shell/session_coordinator_wrapper.cpp (+73/-0) src/server/shell/surface_coordinator_wrapper.cpp (+46/-0) src/shared/geometry/rectangle.cpp (+10/-0) src/shared/protobuf/mir_protobuf.proto (+21/-1) tests/CMakeLists.txt (+5/-0) tests/acceptance-tests/CMakeLists.txt (+6/-0) tests/acceptance-tests/clients.cpp (+43/-0) tests/acceptance-tests/clients.h (+39/-0) tests/acceptance-tests/server_configuration_wrapping.cpp (+110/-0) tests/acceptance-tests/test_client_authorization.cpp (+65/-39) tests/acceptance-tests/test_client_cursor_api.cpp (+449/-0) tests/acceptance-tests/test_client_input.cpp (+238/-336) tests/acceptance-tests/test_client_library.cpp (+35/-0) tests/acceptance-tests/test_client_screencast.cpp (+3/-1) tests/acceptance-tests/test_custom_input_dispatcher.cpp (+184/-0) tests/acceptance-tests/test_display_configuration.cpp (+23/-2) tests/acceptance-tests/test_focus_selection.cpp (+3/-37) tests/acceptance-tests/test_large_messages.cpp (+103/-0) tests/acceptance-tests/test_protobuf.cpp (+25/-23) tests/acceptance-tests/test_server_shutdown.cpp (+136/-36) tests/acceptance-tests/test_surfaces_with_output_id.cpp (+2/-1) tests/acceptance-tests/test_trust_session_helper.cpp (+215/-0) tests/integration-tests/client/test_client_render.cpp (+13/-1) tests/integration-tests/client/test_screencast.cpp (+5/-32) tests/integration-tests/compositor/test_buffer_stream.cpp (+43/-19) tests/integration-tests/compositor/test_swapping_swappers.cpp (+4/-4) tests/integration-tests/graphics/android/test_buffer_integration.cpp (+3/-3) tests/integration-tests/graphics/android/test_display_integration.cpp (+4/-1) tests/integration-tests/graphics/android/test_internal_client.cpp (+3/-4) tests/integration-tests/graphics/mesa/test_buffer_integration.cpp (+2/-0) tests/integration-tests/input/android/test_android_cursor_listener.cpp (+21/-9) tests/integration-tests/input/android/test_android_input_manager.cpp (+56/-68) tests/integration-tests/input/test_nested_input.cpp (+26/-56) tests/integration-tests/session_management.cpp (+1/-5) tests/integration-tests/test_display_info.cpp (+1/-0) tests/integration-tests/test_display_server_main_loop_events.cpp (+61/-30) tests/integration-tests/test_error_reporting.cpp (+5/-3) tests/integration-tests/test_session.cpp (+1/-1) tests/integration-tests/test_surface_first_frame_sync.cpp (+30/-13) tests/integration-tests/test_surface_stack_with_compositor.cpp (+13/-89) tests/integration-tests/test_surfaceloop.cpp (+5/-2) tests/mir_test/CMakeLists.txt (+2/-0) tests/mir_test/popen.cpp (+65/-0) tests/mir_test/wait_object.cpp (+35/-0) tests/mir_test_doubles/fake_event_hub.cpp (+10/-0) tests/mir_test_doubles/fake_event_hub_input_configuration.cpp (+10/-9) tests/mir_test_doubles/mock_gl.cpp (+6/-0) tests/mir_test_doubles/test_protobuf_socket_server.cpp (+8/-5) tests/mir_test_framework/CMakeLists.txt (+1/-0) tests/mir_test_framework/command_line_server_configuration.cpp (+56/-0) tests/mir_test_framework/input_testing_client_configuration.cpp (+2/-2) tests/mir_test_framework/input_testing_server_options.cpp (+12/-2) tests/mir_test_framework/stubbed_server_configuration.cpp (+24/-40) tests/performance-tests/CMakeLists.txt (+26/-0) tests/performance-tests/test_glmark2-es2-mir.cpp (+83/-0) tests/unit-tests/CMakeLists.txt (+1/-0) tests/unit-tests/android_input/input_reader.cpp (+12/-24) tests/unit-tests/client/android/test_client_surface_interpreter.cpp (+12/-0) tests/unit-tests/client/test_client.cpp (+13/-0) tests/unit-tests/client/test_client_mir_surface.cpp (+14/-0) tests/unit-tests/compositor/CMakeLists.txt (+2/-1) tests/unit-tests/compositor/test_buffer_queue.cpp (+1167/-777) tests/unit-tests/compositor/test_default_display_buffer_compositor.cpp (+44/-66) tests/unit-tests/compositor/test_gl_renderer.cpp (+78/-156) tests/unit-tests/compositor/test_gl_texture_cache.cpp (+124/-0) tests/unit-tests/compositor/test_multi_threaded_compositor.cpp (+48/-30) tests/unit-tests/compositor/test_screencast_display_buffer.cpp (+2/-24) tests/unit-tests/frontend/CMakeLists.txt (+1/-1) tests/unit-tests/frontend/test_published_socket_connector.cpp (+1/-1) tests/unit-tests/frontend/test_session_mediator.cpp (+109/-13) tests/unit-tests/frontend/test_session_mediator_android.cpp (+3/-2) tests/unit-tests/frontend/test_session_mediator_mesa.cpp (+3/-2) tests/unit-tests/frontend/test_socket_connection.cpp (+86/-43) tests/unit-tests/graphics/android/CMakeLists.txt (+2/-0) tests/unit-tests/graphics/android/test_android_fb.cpp (+44/-9) tests/unit-tests/graphics/android/test_device_detection.cpp (+72/-0) tests/unit-tests/graphics/android/test_fb_device.cpp (+8/-15) tests/unit-tests/graphics/android/test_fb_simple_swapper.cpp (+33/-4) tests/unit-tests/graphics/android/test_hwc_device.cpp (+97/-134) tests/unit-tests/graphics/android/test_hwc_display.cpp (+123/-54) tests/unit-tests/graphics/android/test_hwc_fallback_gl_renderer.cpp (+315/-0) tests/unit-tests/graphics/android/test_hwc_fb_device.cpp (+11/-11) tests/unit-tests/graphics/android/test_hwc_layers.cpp (+5/-5) tests/unit-tests/graphics/android/test_output_builder.cpp (+9/-5) tests/unit-tests/graphics/mesa/test_buffer_allocator.cpp (+11/-9) tests/unit-tests/graphics/mesa/test_cursor.cpp (+105/-33) tests/unit-tests/graphics/mesa/test_display.cpp (+9/-5) tests/unit-tests/graphics/mesa/test_display_buffer.cpp (+2/-1) tests/unit-tests/graphics/mesa/test_display_configuration.cpp (+4/-1) tests/unit-tests/graphics/mesa/test_display_multi_monitor.cpp (+5/-1) tests/unit-tests/graphics/mesa/test_gbm_buffer.cpp (+3/-2) tests/unit-tests/graphics/mesa/test_linux_virtual_terminal.cpp (+10/-12) tests/unit-tests/graphics/mesa/test_platform.cpp (+2/-1) tests/unit-tests/graphics/nested/test_nested_display.cpp (+5/-4) tests/unit-tests/graphics/nested/test_nested_platform.cpp (+2/-2) tests/unit-tests/graphics/test_display.cpp (+4/-1) tests/unit-tests/graphics/test_graphics_platform.cpp (+2/-1) tests/unit-tests/input/android/CMakeLists.txt (+2/-0) tests/unit-tests/input/android/test_android_input_application_handle.cpp (+3/-3) tests/unit-tests/input/android/test_android_input_dispatcher.cpp (+257/-0) tests/unit-tests/input/android/test_android_input_manager.cpp (+7/-32) tests/unit-tests/input/android/test_android_input_registrar.cpp (+26/-39) tests/unit-tests/input/android/test_android_input_target_enumerator.cpp (+4/-23) tests/unit-tests/input/android/test_android_input_targeter.cpp (+10/-8) tests/unit-tests/input/android/test_android_input_window_handle.cpp (+5/-7) tests/unit-tests/input/android/test_input_translator.cpp (+379/-0) tests/unit-tests/scene/CMakeLists.txt (+2/-0) tests/unit-tests/scene/test_basic_surface.cpp (+72/-18) tests/unit-tests/scene/test_legacy_scene_change_notification.cpp (+128/-0) tests/unit-tests/scene/test_mediating_display_changer.cpp (+154/-23) tests/unit-tests/scene/test_surface.cpp (+14/-9) tests/unit-tests/scene/test_surface_impl.cpp (+62/-0) tests/unit-tests/scene/test_surface_stack.cpp (+215/-80) tests/unit-tests/test_asio_main_loop.cpp (+435/-28) tests/unit-tests/test_variable_length_array.cpp (+107/-0) tools/setup-partial-armhf-chroot.sh (+1/-1) |
To merge this branch: | bzr merge lp:mir/0.2 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alan Griffiths | Approve | ||
Review via email: mp+221764@code.launchpad.net |
Commit message
0.2.0 promotion of Mir from lp:mir/0.2 at r1669 minus r1581 and r1622.
Description of the change
0.2.0 promotion of Mir from lp:mir/0.2 at r1669 minus r1581 and r1622.
To post a comment you must log in.
Revision history for this message
kevin gunn (kgunn72) wrote : | # |
Revision history for this message
Alberto Aguirre (albaguirre) : | # |
Revision history for this message
Alberto Aguirre (albaguirre) wrote : | # |
Changelog needs adjustment due to reverts.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file '3rd_party/android-deps/std/Thread.h' |
2 | --- 3rd_party/android-deps/std/Thread.h 2013-05-06 22:22:39 +0000 |
3 | +++ 3rd_party/android-deps/std/Thread.h 2014-06-05 12:56:04 +0000 |
4 | @@ -32,6 +32,11 @@ |
5 | #include <pthread.h> |
6 | #endif |
7 | |
8 | +namespace mir |
9 | +{ |
10 | +void terminate_with_current_exception(); |
11 | +} |
12 | + |
13 | namespace mir_input |
14 | { |
15 | class Thread : virtual public RefBase |
16 | @@ -56,8 +61,15 @@ |
17 | |
18 | thread = std::thread([this]() -> void |
19 | { |
20 | - if (auto result = readyToRun()) status.store(result); |
21 | - else while (!exitPending() && threadLoop()); |
22 | + try |
23 | + { |
24 | + if (auto result = readyToRun()) status.store(result); |
25 | + else while (!exitPending() && threadLoop()); |
26 | + } |
27 | + catch (...) |
28 | + { |
29 | + mir::terminate_with_current_exception(); |
30 | + } |
31 | }); |
32 | |
33 | #ifdef HAVE_PTHREADS |
34 | |
35 | === modified file '3rd_party/android-input/android/frameworks/base/services/input/EventHub.h' |
36 | --- 3rd_party/android-input/android/frameworks/base/services/input/EventHub.h 2014-03-26 05:48:59 +0000 |
37 | +++ 3rd_party/android-input/android/frameworks/base/services/input/EventHub.h 2014-06-05 12:56:04 +0000 |
38 | @@ -310,7 +310,6 @@ |
39 | virtual void monitor(); |
40 | virtual void flush(); |
41 | |
42 | -protected: |
43 | virtual ~EventHub(); |
44 | |
45 | private: |
46 | |
47 | === modified file '3rd_party/android-input/android/frameworks/base/services/input/InputDispatcher.cpp' |
48 | --- 3rd_party/android-input/android/frameworks/base/services/input/InputDispatcher.cpp 2014-03-11 11:50:11 +0000 |
49 | +++ 3rd_party/android-input/android/frameworks/base/services/input/InputDispatcher.cpp 2014-06-05 12:56:04 +0000 |
50 | @@ -171,13 +171,15 @@ |
51 | |
52 | // --- InputDispatcher --- |
53 | |
54 | -InputDispatcher::InputDispatcher(const sp<InputDispatcherPolicyInterface>& policy, |
55 | - std::shared_ptr<mi::InputReport> const& input_report) : |
56 | +InputDispatcher::InputDispatcher(std::shared_ptr<InputDispatcherPolicyInterface> const& policy, |
57 | + std::shared_ptr<mi::InputReport> const& input_report, |
58 | + std::shared_ptr<InputEnumerator> const& enumerator) : |
59 | input_report(input_report), |
60 | mPolicy(policy), |
61 | mPendingEvent(NULL), mAppSwitchSawKeyDown(false), mAppSwitchDueTime(LONG_LONG_MAX), |
62 | mNextUnblockedEvent(NULL), |
63 | mDispatchEnabled(false), mDispatchFrozen(false), mInputFilterEnabled(false), |
64 | + mEnumerator(enumerator), |
65 | mInputTargetWaitCause(INPUT_TARGET_WAIT_CAUSE_NONE) { |
66 | mLooper = new Looper(false); |
67 | |
68 | @@ -186,12 +188,6 @@ |
69 | policy->getDispatcherConfiguration(&mConfig); |
70 | } |
71 | |
72 | -void InputDispatcher::setInputEnumerator(sp<InputEnumerator> const& enumerator) |
73 | -{ |
74 | - AutoMutex _l(mLock); |
75 | - mEnumerator = enumerator; |
76 | -} |
77 | - |
78 | InputDispatcher::~InputDispatcher() { |
79 | { // acquire lock |
80 | AutoMutex _l(mLock); |
81 | @@ -4284,7 +4280,7 @@ |
82 | |
83 | // --- InputDispatcherThread --- |
84 | |
85 | -InputDispatcherThread::InputDispatcherThread(const sp<InputDispatcherInterface>& dispatcher) : |
86 | +InputDispatcherThread::InputDispatcherThread(std::shared_ptr<InputDispatcherInterface> const& dispatcher) : |
87 | Thread(/*canCallJava*/ true), mDispatcher(dispatcher) { |
88 | } |
89 | |
90 | |
91 | === modified file '3rd_party/android-input/android/frameworks/base/services/input/InputDispatcher.h' |
92 | --- 3rd_party/android-input/android/frameworks/base/services/input/InputDispatcher.h 2014-03-06 06:05:17 +0000 |
93 | +++ 3rd_party/android-input/android/frameworks/base/services/input/InputDispatcher.h 2014-06-05 12:56:04 +0000 |
94 | @@ -284,13 +284,6 @@ |
95 | virtual ~InputDispatcherInterface() { } |
96 | |
97 | public: |
98 | - /* |
99 | - * Sets the enumerator of input targets. This must be called prior to enabling input dispatch. |
100 | - * |
101 | - * This method may be called by any thread. |
102 | - */ |
103 | - virtual void setInputEnumerator(sp<InputEnumerator> const& enumerator) = 0; |
104 | - |
105 | /* Dumps the state of the input dispatcher. |
106 | * |
107 | * This method may be called on any thread (usually by the input manager). */ |
108 | @@ -387,13 +380,9 @@ |
109 | * A 'LockedInterruptible' method may called a 'Locked' method, but NOT vice-versa. |
110 | */ |
111 | class InputDispatcher : public InputDispatcherInterface { |
112 | -protected: |
113 | +public: |
114 | virtual ~InputDispatcher(); |
115 | - |
116 | -public: |
117 | - explicit InputDispatcher(const sp<InputDispatcherPolicyInterface>& policy, std::shared_ptr<mir::input::InputReport> const& input_report); |
118 | - |
119 | - virtual void setInputEnumerator(sp<InputEnumerator> const& enumerator); |
120 | + explicit InputDispatcher(std::shared_ptr<InputDispatcherPolicyInterface> const& policy, std::shared_ptr<mir::input::InputReport> const& input_report, std::shared_ptr<InputEnumerator> const& enumerator); |
121 | |
122 | virtual void dump(String8& dump); |
123 | virtual void monitor(); |
124 | @@ -862,7 +851,7 @@ |
125 | DROP_REASON_STALE = 5 |
126 | }; |
127 | |
128 | - sp<InputDispatcherPolicyInterface> mPolicy; |
129 | + std::shared_ptr<InputDispatcherPolicyInterface> mPolicy; |
130 | InputDispatcherConfiguration mConfig; |
131 | |
132 | Mutex mLock; |
133 | @@ -941,7 +930,7 @@ |
134 | bool mDispatchFrozen; |
135 | bool mInputFilterEnabled; |
136 | |
137 | - sp<InputEnumerator> mEnumerator; |
138 | + std::shared_ptr<InputEnumerator> mEnumerator; |
139 | |
140 | sp<InputWindowHandle> getWindowHandleLocked(const sp<InputChannel>& inputChannel) const; |
141 | bool hasWindowHandleLocked(const sp<InputWindowHandle>& windowHandle) const; |
142 | @@ -1122,13 +1111,13 @@ |
143 | /* Enqueues and dispatches input events, endlessly. */ |
144 | class InputDispatcherThread : public Thread { |
145 | public: |
146 | - explicit InputDispatcherThread(const sp<InputDispatcherInterface>& dispatcher); |
147 | + explicit InputDispatcherThread(std::shared_ptr<InputDispatcherInterface> const& dispatcher); |
148 | ~InputDispatcherThread(); |
149 | |
150 | private: |
151 | virtual bool threadLoop(); |
152 | |
153 | - sp<InputDispatcherInterface> mDispatcher; |
154 | + std::shared_ptr<InputDispatcherInterface> mDispatcher; |
155 | }; |
156 | |
157 | } // namespace android |
158 | |
159 | === modified file '3rd_party/android-input/android/frameworks/base/services/input/InputListener.cpp' |
160 | --- 3rd_party/android-input/android/frameworks/base/services/input/InputListener.cpp 2012-11-06 18:05:11 +0000 |
161 | +++ 3rd_party/android-input/android/frameworks/base/services/input/InputListener.cpp 2014-06-05 12:56:04 +0000 |
162 | @@ -35,8 +35,8 @@ |
163 | eventTime(other.eventTime) { |
164 | } |
165 | |
166 | -void NotifyConfigurationChangedArgs::notify(const sp<InputListenerInterface>& listener) const { |
167 | - listener->notifyConfigurationChanged(this); |
168 | +void NotifyConfigurationChangedArgs::notify(InputListenerInterface& listener) const { |
169 | + listener.notifyConfigurationChanged(this); |
170 | } |
171 | |
172 | |
173 | @@ -59,8 +59,8 @@ |
174 | metaState(other.metaState), downTime(other.downTime) { |
175 | } |
176 | |
177 | -void NotifyKeyArgs::notify(const sp<InputListenerInterface>& listener) const { |
178 | - listener->notifyKey(this); |
179 | +void NotifyKeyArgs::notify(InputListenerInterface& listener) const { |
180 | + listener.notifyKey(this); |
181 | } |
182 | |
183 | |
184 | @@ -95,8 +95,8 @@ |
185 | } |
186 | } |
187 | |
188 | -void NotifyMotionArgs::notify(const sp<InputListenerInterface>& listener) const { |
189 | - listener->notifyMotion(this); |
190 | +void NotifyMotionArgs::notify(InputListenerInterface& listener) const { |
191 | + listener.notifyMotion(this); |
192 | } |
193 | |
194 | |
195 | @@ -113,8 +113,8 @@ |
196 | switchCode(other.switchCode), switchValue(other.switchValue) { |
197 | } |
198 | |
199 | -void NotifySwitchArgs::notify(const sp<InputListenerInterface>& listener) const { |
200 | - listener->notifySwitch(this); |
201 | +void NotifySwitchArgs::notify(InputListenerInterface& listener) const { |
202 | + listener.notifySwitch(this); |
203 | } |
204 | |
205 | |
206 | @@ -128,14 +128,14 @@ |
207 | eventTime(other.eventTime), deviceId(other.deviceId) { |
208 | } |
209 | |
210 | -void NotifyDeviceResetArgs::notify(const sp<InputListenerInterface>& listener) const { |
211 | - listener->notifyDeviceReset(this); |
212 | +void NotifyDeviceResetArgs::notify(InputListenerInterface& listener) const { |
213 | + listener.notifyDeviceReset(this); |
214 | } |
215 | |
216 | |
217 | // --- QueuedInputListener --- |
218 | |
219 | -QueuedInputListener::QueuedInputListener(const sp<InputListenerInterface>& innerListener) : |
220 | +QueuedInputListener::QueuedInputListener(const std::shared_ptr<InputListenerInterface>& innerListener) : |
221 | mInnerListener(innerListener) { |
222 | } |
223 | |
224 | @@ -171,7 +171,7 @@ |
225 | size_t count = mArgsQueue.size(); |
226 | for (size_t i = 0; i < count; i++) { |
227 | NotifyArgs* args = mArgsQueue[i]; |
228 | - args->notify(mInnerListener); |
229 | + args->notify(*mInnerListener); |
230 | delete args; |
231 | } |
232 | mArgsQueue.clear(); |
233 | |
234 | === modified file '3rd_party/android-input/android/frameworks/base/services/input/InputListener.h' |
235 | --- 3rd_party/android-input/android/frameworks/base/services/input/InputListener.h 2014-03-06 06:05:17 +0000 |
236 | +++ 3rd_party/android-input/android/frameworks/base/services/input/InputListener.h 2014-06-05 12:56:04 +0000 |
237 | @@ -20,6 +20,7 @@ |
238 | #include <androidfw/Input.h> |
239 | #include <std/RefBase.h> |
240 | #include <std/Vector.h> |
241 | +#include <memory> |
242 | |
243 | namespace android { |
244 | |
245 | @@ -30,7 +31,7 @@ |
246 | struct NotifyArgs { |
247 | virtual ~NotifyArgs() { } |
248 | |
249 | - virtual void notify(const sp<InputListenerInterface>& listener) const = 0; |
250 | + virtual void notify(InputListenerInterface& listener) const = 0; |
251 | }; |
252 | |
253 | |
254 | @@ -46,7 +47,7 @@ |
255 | |
256 | virtual ~NotifyConfigurationChangedArgs() { } |
257 | |
258 | - virtual void notify(const sp<InputListenerInterface>& listener) const; |
259 | + virtual void notify(InputListenerInterface& listener) const; |
260 | }; |
261 | |
262 | |
263 | @@ -73,7 +74,7 @@ |
264 | |
265 | virtual ~NotifyKeyArgs() { } |
266 | |
267 | - virtual void notify(const sp<InputListenerInterface>& listener) const; |
268 | + virtual void notify(InputListenerInterface& listener) const; |
269 | }; |
270 | |
271 | |
272 | @@ -107,7 +108,7 @@ |
273 | |
274 | virtual ~NotifyMotionArgs() { } |
275 | |
276 | - virtual void notify(const sp<InputListenerInterface>& listener) const; |
277 | + virtual void notify(InputListenerInterface& listener) const; |
278 | }; |
279 | |
280 | |
281 | @@ -127,7 +128,7 @@ |
282 | |
283 | virtual ~NotifySwitchArgs() { } |
284 | |
285 | - virtual void notify(const sp<InputListenerInterface>& listener) const; |
286 | + virtual void notify(InputListenerInterface& listener) const; |
287 | }; |
288 | |
289 | |
290 | @@ -145,7 +146,7 @@ |
291 | |
292 | virtual ~NotifyDeviceResetArgs() { } |
293 | |
294 | - virtual void notify(const sp<InputListenerInterface>& listener) const; |
295 | + virtual void notify(InputListenerInterface& listener) const; |
296 | }; |
297 | |
298 | |
299 | @@ -175,7 +176,7 @@ |
300 | virtual ~QueuedInputListener(); |
301 | |
302 | public: |
303 | - QueuedInputListener(const sp<InputListenerInterface>& innerListener); |
304 | + QueuedInputListener(const std::shared_ptr<InputListenerInterface>& innerListener); |
305 | |
306 | virtual void notifyConfigurationChanged(const NotifyConfigurationChangedArgs* args); |
307 | virtual void notifyKey(const NotifyKeyArgs* args); |
308 | @@ -186,7 +187,7 @@ |
309 | void flush(); |
310 | |
311 | private: |
312 | - sp<InputListenerInterface> mInnerListener; |
313 | + std::shared_ptr<InputListenerInterface> mInnerListener; |
314 | Vector<NotifyArgs*> mArgsQueue; |
315 | }; |
316 | |
317 | |
318 | === modified file '3rd_party/android-input/android/frameworks/base/services/input/InputReader.cpp' |
319 | --- 3rd_party/android-input/android/frameworks/base/services/input/InputReader.cpp 2014-03-06 06:05:17 +0000 |
320 | +++ 3rd_party/android-input/android/frameworks/base/services/input/InputReader.cpp 2014-06-05 12:56:04 +0000 |
321 | @@ -244,9 +244,9 @@ |
322 | |
323 | // --- InputReader --- |
324 | |
325 | -InputReader::InputReader(const sp<EventHubInterface>& eventHub, |
326 | - const sp<InputReaderPolicyInterface>& policy, |
327 | - const sp<InputListenerInterface>& listener) : |
328 | +InputReader::InputReader(std::shared_ptr<EventHubInterface> const& eventHub, |
329 | + std::shared_ptr<InputReaderPolicyInterface> const& policy, |
330 | + std::shared_ptr<InputListenerInterface> const& listener) : |
331 | mContext(this), mEventHub(eventHub), mPolicy(policy), |
332 | mGlobalMetaState(0), mGeneration(1), |
333 | mDisableVirtualKeysTimeout(LLONG_MIN), mNextTimeout(LLONG_MAX), |
334 | @@ -851,7 +851,7 @@ |
335 | |
336 | // --- InputReaderThread --- |
337 | |
338 | -InputReaderThread::InputReaderThread(const sp<InputReaderInterface>& reader) : |
339 | +InputReaderThread::InputReaderThread(std::shared_ptr<InputReaderInterface> const& reader) : |
340 | Thread(/*canCallJava*/ true), mReader(reader) { |
341 | } |
342 | |
343 | |
344 | === modified file '3rd_party/android-input/android/frameworks/base/services/input/InputReader.h' |
345 | --- 3rd_party/android-input/android/frameworks/base/services/input/InputReader.h 2014-03-06 06:05:17 +0000 |
346 | +++ 3rd_party/android-input/android/frameworks/base/services/input/InputReader.h 2014-06-05 12:56:04 +0000 |
347 | @@ -334,9 +334,9 @@ |
348 | */ |
349 | class InputReader : public InputReaderInterface { |
350 | public: |
351 | - InputReader(const sp<EventHubInterface>& eventHub, |
352 | - const sp<InputReaderPolicyInterface>& policy, |
353 | - const sp<InputListenerInterface>& listener); |
354 | + InputReader(const std::shared_ptr<EventHubInterface>& eventHub, |
355 | + const std::shared_ptr<InputReaderPolicyInterface>& policy, |
356 | + const std::shared_ptr<InputListenerInterface>& listener); |
357 | virtual ~InputReader(); |
358 | |
359 | virtual void dump(String8& dump); |
360 | @@ -393,8 +393,8 @@ |
361 | |
362 | Condition mReaderIsAliveCondition; |
363 | |
364 | - sp<EventHubInterface> mEventHub; |
365 | - sp<InputReaderPolicyInterface> mPolicy; |
366 | + std::shared_ptr<EventHubInterface> mEventHub; |
367 | + std::shared_ptr<InputReaderPolicyInterface> mPolicy; |
368 | sp<QueuedInputListener> mQueuedListener; |
369 | |
370 | InputReaderConfiguration mConfig; |
371 | @@ -449,11 +449,11 @@ |
372 | /* Reads raw events from the event hub and processes them, endlessly. */ |
373 | class InputReaderThread : public Thread { |
374 | public: |
375 | - InputReaderThread(const sp<InputReaderInterface>& reader); |
376 | + InputReaderThread(std::shared_ptr<InputReaderInterface> const& reader); |
377 | virtual ~InputReaderThread(); |
378 | |
379 | private: |
380 | - sp<InputReaderInterface> mReader; |
381 | + std::shared_ptr<InputReaderInterface> mReader; |
382 | |
383 | virtual bool threadLoop(); |
384 | }; |
385 | |
386 | === modified file 'CMakeLists.txt' |
387 | --- CMakeLists.txt 2014-04-15 08:13:37 +0000 |
388 | +++ CMakeLists.txt 2014-06-05 12:56:04 +0000 |
389 | @@ -27,8 +27,8 @@ |
390 | set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib) |
391 | |
392 | set(MIR_VERSION_MAJOR 0) |
393 | -set(MIR_VERSION_MINOR 1) |
394 | -set(MIR_VERSION_PATCH 9) |
395 | +set(MIR_VERSION_MINOR 2) # This should change at least with every MIRSERVER_ABI |
396 | +set(MIR_VERSION_PATCH 0) |
397 | |
398 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) |
399 | execute_process( |
400 | @@ -76,7 +76,7 @@ |
401 | include_directories(include/shared) |
402 | |
403 | # Check for boost |
404 | -find_package(Boost 1.48.0 COMPONENTS chrono date_time filesystem system thread program_options regex REQUIRED) |
405 | +find_package(Boost 1.48.0 COMPONENTS chrono date_time filesystem system thread program_options regex iostreams REQUIRED) |
406 | include_directories ( |
407 | ${Boost_INCLUDE_DIRS} |
408 | ) |
409 | @@ -129,6 +129,7 @@ |
410 | include_directories (${GLM_INCLUDE_DIRS}) |
411 | |
412 | if (MIR_BUILD_PLATFORM_ANDROID) |
413 | + find_package(AndroidProperties REQUIRED) |
414 | find_package(LibHardware REQUIRED) |
415 | endif() |
416 | |
417 | |
418 | === modified file 'benchmarks/android-input/input_reader_perf.cpp' |
419 | --- benchmarks/android-input/input_reader_perf.cpp 2013-10-16 13:26:25 +0000 |
420 | +++ benchmarks/android-input/input_reader_perf.cpp 2014-06-05 12:56:04 +0000 |
421 | @@ -24,6 +24,7 @@ |
422 | |
423 | #include <chrono> |
424 | #include <iostream> |
425 | +#include <memory> |
426 | |
427 | // local |
428 | #include "ntrig_input_events.h" |
429 | @@ -42,12 +43,10 @@ |
430 | InputReaderConfiguration mConfig; |
431 | Vector<InputDeviceInfo> mInputDevices; |
432 | |
433 | -protected: |
434 | +public: |
435 | + FakeInputReaderPolicy() {} |
436 | virtual ~FakeInputReaderPolicy() { } |
437 | |
438 | -public: |
439 | - FakeInputReaderPolicy() {} |
440 | - |
441 | void setDisplayInfo(int32_t displayId, int32_t width, int32_t height, int32_t orientation) { |
442 | // Set the size of both the internal and external display at the same time. |
443 | mConfig.setDisplayInfo(displayId, false /*external*/, width, height, orientation); |
444 | @@ -119,7 +118,7 @@ |
445 | const int32_t DEVICE_ID = 2; |
446 | const int32_t DISPLAY_ID = 0; |
447 | |
448 | - sp<FakeEventHub> fakeEventHub = new FakeEventHub; |
449 | + std::shared_ptr<FakeEventHub> fakeEventHub = std::make_shared<FakeEventHub>(); |
450 | fakeEventHub->addDevice(DEVICE_ID, String8("N-Trig MultiTouch"), INPUT_DEVICE_CLASS_TOUCH_MT); |
451 | fakeEventHub->addConfigurationProperty(DEVICE_ID, "touch.deviceType", "touchScreen"); |
452 | fakeEventHub->addConfigurationProperty(DEVICE_ID, "device.internal", "1"); |
453 | @@ -130,10 +129,10 @@ |
454 | fakeEventHub->addAbsoluteAxis(DEVICE_ID, ABS_MT_TOUCH_MINOR, 0, 7200, 0, 0, 37); |
455 | fakeEventHub->addAbsoluteAxis(DEVICE_ID, ABS_MT_ORIENTATION, 0, 1, 0, 0, 0); |
456 | |
457 | - sp<FakeInputReaderPolicy> fakePolicy = new FakeInputReaderPolicy; |
458 | + std::shared_ptr<FakeInputReaderPolicy> fakePolicy = std::make_shared<FakeInputReaderPolicy>(); |
459 | fakePolicy->setDisplayInfo(DISPLAY_ID, 1024, 768, DISPLAY_ORIENTATION_0); |
460 | |
461 | - sp<InputListener> listener = new InputListener; |
462 | + std::shared_ptr<InputListener> listener = std::make_shared<InputListener>(); |
463 | |
464 | int32_t total_duration = 0; |
465 | int32_t execution_number; |
466 | |
467 | === modified file 'cmake/Doxygen.cmake' |
468 | --- cmake/Doxygen.cmake 2013-10-21 17:41:35 +0000 |
469 | +++ cmake/Doxygen.cmake 2014-06-05 12:56:04 +0000 |
470 | @@ -23,5 +23,7 @@ |
471 | COMMAND ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/Doxyfile |
472 | SOURCES ${PROJECT_BINARY_DIR}/Doxyfile |
473 | DEPENDS guides) |
474 | - install(DIRECTORY ${CMAKE_BINARY_DIR}/doc/html DESTINATION ${CMAKE_INSTALL_PREFIX}/share/doc/mir-doc/) |
475 | + if (BUILD_DOXYGEN) |
476 | + install(DIRECTORY ${CMAKE_BINARY_DIR}/doc/html DESTINATION ${CMAKE_INSTALL_PREFIX}/share/doc/mir-doc/) |
477 | + endif() |
478 | endif() |
479 | |
480 | === added file 'cmake/FindAndroidProperties.cmake' |
481 | --- cmake/FindAndroidProperties.cmake 1970-01-01 00:00:00 +0000 |
482 | +++ cmake/FindAndroidProperties.cmake 2014-06-05 12:56:04 +0000 |
483 | @@ -0,0 +1,22 @@ |
484 | +# Variables defined by this module: |
485 | +# ANDROID_PROPERTIES_FOUND |
486 | +# ANDROID_PROPERTIES_LIBRARIES |
487 | +# ANDROID_PROPERTIES_INCLUDE_DIRS |
488 | + |
489 | +INCLUDE(FindPackageHandleStandardArgs) |
490 | + |
491 | +find_package( PkgConfig ) |
492 | +pkg_check_modules(ANDROID_PROPERTIES REQUIRED libandroid-properties) |
493 | + |
494 | +find_path(ANDROID_PROPERTIES_INCLUDE_DIR hybris/properties/properties.h |
495 | + HINTS ${PC_ANDROID_PROPERTIES_INCLUDEDIR} ${PC_ANDROID_PROPERTIES_INCLUDE_DIRS}) |
496 | +find_library(ANDROID_PROPERTIES_LIBRARIES |
497 | + NAMES libandroid-properties.so |
498 | + HINTS ${PC_ANDROID_PROPERTIES_LIBDIR} ${PC_ANDROID_PROPERTIES_LIBRARY_DIRS}) |
499 | + |
500 | +# handle the QUIETLY and REQUIRED arguments and set ANDROID_PROPERTIES_FOUND to TRUE |
501 | +# if all listed variables are TRUE |
502 | +find_package_handle_standard_args(ANDROID_PROPERTIES DEFAULT_MSG |
503 | + ANDROID_PROPERTIES_LIBRARIES) |
504 | + |
505 | +mark_as_advanced(ANDROID_PROPERTIES_INCLUDE_DIR ANDROID_PROPERTIES_LIBRARY ) |
506 | |
507 | === modified file 'debian/changelog' |
508 | --- debian/changelog 2014-04-30 13:26:58 +0000 |
509 | +++ debian/changelog 2014-06-05 12:56:04 +0000 |
510 | @@ -1,3 +1,129 @@ |
511 | +mir (0.2.0-0ubuntu1) UNRELEASED; urgency=medium |
512 | + |
513 | + * New upstream release 0.2.0 (https://launchpad.net/mir/+milestone/0.2.0) |
514 | + - mirclient ABI unchanged, still at 7. Clients do not need rebuilding. |
515 | + - mirserver ABI bumped to 20. Shells need rebuilding. |
516 | + . Cursor::set_image() parameters changed. |
517 | + . Display::the_cursor() renamed to Display::create_hardware_cursor() |
518 | + . Platform::create_display() requires a new parameter; gl_program_factory |
519 | + . Renderable::buffer() no longer accepts any parameter at all. Multi- |
520 | + monitor frame sync is guaranteed in other ways now. |
521 | + . Scene::generate_renderable_list() renamed to renderable_list_for(id) |
522 | + where id is an opaque compositor ID of your choosing. |
523 | + . Scene::set_change_callback() replaced by the more generic: |
524 | + add_observer() and remove_observer() functions. |
525 | + . Added default implementation for SceneObserver. |
526 | + . SessionCreator renamed to ConnectionCreator. |
527 | + . ConnectedSessions renamed to Connections. |
528 | + . ProtobufSessionCreator renamed to ProtobufConnectionCreator. |
529 | + . SessionAuthorizer: pid_t parameters replaced by SessionCredentials. |
530 | + . Massive architectural changes to Input-everything. |
531 | + . Surface no longer implements Renderable, but emits one via |
532 | + compositor_snapshot(). |
533 | + . Pass the full renderable list to Renderer::render(). |
534 | + . Graceful handling of exceptions thrown from server threads. |
535 | + . Clarify size position interfaces in the Surface classes. |
536 | + . Plumbing for trusted sessions. |
537 | + . Allow posting and managing custom main-loop actions. |
538 | + . Timer extension. |
539 | + . Identify client process when client connects to Mir not when socket |
540 | + connects. |
541 | + . Use the ServerActionQueue for display config. |
542 | + . Recomposition signal moved to the MultiThreadedCompositor. |
543 | + . Make timer service replaceable. |
544 | + . Clarify assumptions about how many buffers a client can fill without |
545 | + blocking. |
546 | + . Introduce EmergencyCleanup interface. |
547 | + - Demo shell enhancements: |
548 | + . You can now change graphics modes on the fly using Ctrl+Alt+(-/=). |
549 | + To reset to the preferred mode use Ctrl+Alt+0. |
550 | + . The above mode changing as well as existing screen rotation keys |
551 | + (Ctrl+Alt+arrows) are now per-display; only applied to the monitor |
552 | + the mouse pointer is on. |
553 | + . New shell controls documented. |
554 | + - A new testing category, performance test, was introduced. It currently |
555 | + runs glmark2-es2 and compares the result to a minimum threshold. |
556 | + - MIR_VERSION_MINOR is tied to MIRSERVER_ABI in the sense that a change |
557 | + in the former now requires dependent projects that a rebuild is |
558 | + necessary. |
559 | + - SwitchingBundle was replaced by BufferQueue. |
560 | + - Expand credentials to include uid/gid for session authorizer. |
561 | + - Bypass control is now Mesa-specific and tied to the command line options. |
562 | + So the environment variable MIR_BYPASS has changed to MIR_SERVER_BYPASS. |
563 | + - Ongoing architectural changes in the compositor/renderer logic to |
564 | + prepare for overlay support, and to reduce locking overhead. |
565 | + - Made InputDispatcher replaceable. |
566 | + - Progress made on new cursor interfaces with the end goal of client and |
567 | + toolkit control of the mouse cursor appearance. More work required. |
568 | + - Updated cross-compile docs and scripts to support the latest utopic |
569 | + devel images. |
570 | + - Replaced uses of android::sp with std::shared_ptr. |
571 | + - Client cursor API infrastructure. |
572 | + - Enabled eglSwapInternal(0). |
573 | + - Make texture caching algorithm reuseable. |
574 | + - Add a DPI surface attribute. |
575 | + - Exclude arm64 from build. |
576 | + - Bugs fixed: |
577 | + . Mir doesn't install cleanly if docs are not built. (LP: #1304271) |
578 | + . Unity-system-compositor crashed [what(): Failed to set DRM crtc]. |
579 | + (LP: #1294510) |
580 | + . [regression] unity8 fails to load libmirplatformgraphics |
581 | + (undefined symbol: _ZN3mir8graphics9GLProgramD1Ev). (LP: #1317200) |
582 | + . [regression] unity8 rendering artifacts. (LP: #1317260) |
583 | + . [regression] [BufferQueue] |
584 | + BufferQueueTest.compositor_never_owns_client_buffers occasionally |
585 | + crashes with: what(): unexpected release: buffer was not given to |
586 | + compositor. (LP: #1317801) |
587 | + . Hardcoded size for serialization buffers is neither reliable nor |
588 | + secure. (LP: #1320187) |
589 | + . [regression] [BufferQueue] mir does not composite last client given |
590 | + buffer. (LP: #1321861) |
591 | + . [regression] stale frame on seen on greeter when screen is unblanked |
592 | + and toolkit/apps are laggy/throttled. (LP: #1321886) |
593 | + . [regression] [BufferQueue] current_buffer_users vector memory usage |
594 | + grows unbounded. (LP: #1317808) |
595 | + . Intermittent test failures in |
596 | + CustomInputDispatcherFixture.custom_input_dispatcher_receives_input. |
597 | + (LP: #1318587) |
598 | + . [regression] [BufferQueue] Race condition in |
599 | + BufferQueue::compositor_acquire could underflow shared_ptr refcount and |
600 | + delete prematurely, crash. (LP: #1318632) |
601 | + . Overflow in |
602 | + mir::client::rpc::MirSocketRpcChannel::receive_file_descriptors as |
603 | + reported by address sanitizer. (LP: #1320821) |
604 | + . [regression] [input] Scroll events are now always zero: |
605 | + event.motion.pointer_coordinates[0].vscroll. (LP: #1321077) |
606 | + . CI failures in CustomInputDispatcherFixture |
607 | + .custom_input_dispatcher_gets_started_and_stopped. (LP: #1321215) |
608 | + . [regression] Mir cursor vanishes after switching VTs. (LP: #1323225) |
609 | + . Server library links against libmirserverlttng. (LP: #1323317) |
610 | + . [DRM/GBM] Killing (or crashing) Mir often leaves the screen blank and |
611 | + difficult to recover. (LP: #1189770) |
612 | + . Frame rates of GL clients are limited to 60Hz on Android, even with |
613 | + swapinterval=0. (LP: #1206400) |
614 | + . mir_surface_is_valid(NULL) crashes instead of returning false. |
615 | + (LP: #1248474) |
616 | + . [regression] tests/unit-tests/shell/test_mediating_display_changer.cpp |
617 | + is not compiled and executed. (LP: #1312832) |
618 | + . Android platform does not reset the compositionType to HWC_FRAMEBUFFER |
619 | + before prepare() on every frame. (LP: #1314399) |
620 | + . The client process is identified when the socket connects, not when the |
621 | + client connects to Mir. (LP: #1314574) |
622 | + . [regression] Clients can't acquire multiple buffers any more. |
623 | + (LP: #1315302) |
624 | + . [regression] Enabling SwitchingBundleTest |
625 | + DISABLED_synchronous_clients_only_get_two_real_buffers now crashes with |
626 | + no usable stack trace. It used to only fail. (LP: #1315312) |
627 | + . [regression] [BufferQueue] double-buffered client freezes as no buffer |
628 | + is returned on compositor_release. (LP: #1319765) |
629 | + . Uninitialized mem in OutputBuilder.hwc_version_11_success. |
630 | + (LP: #1312867) |
631 | + . [enhancement] In the tests make it possible to get a |
632 | + DefaultConfiguration initialized from the command line (LP: #1316987) |
633 | + . ci train blocked due to missing arm64 libandroid-properties-dev. |
634 | + (LP: #1323504) |
635 | + -- Daniel van Vugt <daniel.van.vugt@canonical.com> Thu, 01 May 2014 15:15:39 +0800 |
636 | + |
637 | mir (0.1.9+14.10.20140430.1-0ubuntu1) utopic; urgency=medium |
638 | |
639 | [ Daniel van Vugt ] |
640 | |
641 | === modified file 'debian/control' |
642 | --- debian/control 2014-04-15 05:32:16 +0000 |
643 | +++ debian/control 2014-06-05 12:56:04 +0000 |
644 | @@ -18,6 +18,7 @@ |
645 | libboost-thread-dev, |
646 | libboost-regex-dev, |
647 | libboost-filesystem-dev, |
648 | + libboost-iostreams-dev, |
649 | protobuf-compiler, |
650 | libdrm-dev, |
651 | libegl1-mesa-dev, |
652 | @@ -28,6 +29,7 @@ |
653 | pkg-config, |
654 | android-headers (>=4.2.2) [i386 amd64 armhf], |
655 | libhardware-dev [i386 amd64 armhf], |
656 | + libandroid-properties-dev [i386 amd64 armhf], |
657 | libgoogle-glog-dev, |
658 | liblttng-ust-dev, |
659 | libxkbcommon-dev, |
660 | @@ -70,7 +72,7 @@ |
661 | . |
662 | Contains the protocol's definition files. |
663 | |
664 | -Package: libmirserver19 |
665 | +Package: libmirserver20 |
666 | Section: libs |
667 | Architecture: i386 amd64 armhf arm64 |
668 | Multi-Arch: same |
669 | @@ -148,7 +150,7 @@ |
670 | Architecture: i386 amd64 armhf arm64 |
671 | Multi-Arch: same |
672 | Pre-Depends: ${misc:Pre-Depends} |
673 | -Depends: libmirserver19 (= ${binary:Version}), |
674 | +Depends: libmirserver20 (= ${binary:Version}), |
675 | libmirprotobuf-dev (= ${binary:Version}), |
676 | mircommon-dev (= ${binary:Version}), |
677 | libglm-dev, |
678 | |
679 | === renamed file 'debian/libmirserver19.install' => 'debian/libmirserver20.install' |
680 | --- debian/libmirserver19.install 2014-04-15 05:32:16 +0000 |
681 | +++ debian/libmirserver20.install 2014-06-05 12:56:04 +0000 |
682 | @@ -1,1 +1,1 @@ |
683 | -usr/lib/*/libmirserver.so.19 |
684 | +usr/lib/*/libmirserver.so.20 |
685 | |
686 | === modified file 'debian/mir-test-tools.install' |
687 | --- debian/mir-test-tools.install 2014-03-06 06:05:17 +0000 |
688 | +++ debian/mir-test-tools.install 2014-06-05 12:56:04 +0000 |
689 | @@ -2,5 +2,6 @@ |
690 | usr/bin/mir_unit_tests |
691 | usr/bin/mir_acceptance_tests |
692 | usr/bin/mir_integration_tests |
693 | +usr/bin/mir_performance_tests |
694 | usr/lib/*/mir/tools/libmirclientlttng.so |
695 | usr/lib/*/mir/tools/libmirserverlttng.so |
696 | |
697 | === modified file 'doc/building_source_for_android.md' |
698 | --- doc/building_source_for_android.md 2014-03-06 06:05:17 +0000 |
699 | +++ doc/building_source_for_android.md 2014-06-05 12:56:04 +0000 |
700 | @@ -53,8 +53,8 @@ |
701 | |
702 | Initial setup of a desktop machine for cross-compiling to armhf is simple: |
703 | |
704 | - $ sudo apt-get install g++-arm-linux-gnueabihf/trusty debootstrap |
705 | - $ sudo sh -c 'echo "deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports/ trusty main restricted universe multiverse" > /etc/apt/sources.list.d/armhf-xcompile.list' |
706 | + $ sudo apt-get install g++-arm-linux-gnueabihf debootstrap |
707 | + $ sudo sh -c 'echo "deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports/ utopic main restricted universe multiverse" > /etc/apt/sources.list.d/armhf-xcompile.list' |
708 | $ sudo apt-get update |
709 | |
710 | Now to test that everything is working you can try downloading a package like |
711 | |
712 | === added file 'doc/demo_shell_controls.md' |
713 | --- doc/demo_shell_controls.md 1970-01-01 00:00:00 +0000 |
714 | +++ doc/demo_shell_controls.md 2014-06-05 12:56:04 +0000 |
715 | @@ -0,0 +1,45 @@ |
716 | +Demo Shell Controls {#demo_shell_controls} |
717 | +=================== |
718 | + |
719 | +Mir's demo shell (`mir_demo_server_shell`) is a basic environment for testing |
720 | +Mir server features as well as running natively ported apps/toolkits. It is |
721 | +still primitive and requires some explaining to make proper use of, so read |
722 | +on. |
723 | + |
724 | +Running Demo Shell |
725 | +------------------ |
726 | + |
727 | +Remember to always run `mir_demo_server_shell` as root on PC (not required on |
728 | +Android), as this is required for input device support (open bug |
729 | +https://bugs.launchpad.net/mir/+bug/1286252); |
730 | + |
731 | + sudo mir_demo_server_shell |
732 | + |
733 | +And if you're not already on the VT you wish to use, that needs to be |
734 | +specified: |
735 | + |
736 | + sudo mir_demo_server_shell --vt 1 |
737 | + |
738 | +There are plenty more options available if you run: |
739 | + |
740 | + mir_demo_server_shell --help |
741 | + |
742 | +Controls |
743 | +-------- |
744 | + |
745 | +All controls have a keyboard/mouse combination and where possible also have |
746 | +touch alternatives for phones/tablets: |
747 | + |
748 | + - Quit the shell (shut down the Mir server): *Ctrl-Alt-Backspace* |
749 | + - Switch back to X: *Ctrl-Alt-F7* |
750 | + - Switch virtual terminals (VTs): *Ctrl-Alt-(F1-F12)* |
751 | + - Switch apps: *Alt-Tab* or *4-finger swipe left/right* |
752 | + - Move window: *Alt-leftmousebutton* or *3-finger drag* |
753 | + - Resize window: *Alt-middlemousebutton* or *3-finger pinch/zoom* |
754 | + - Sleep/wake all displays: *Alt-P* or *Android power button* |
755 | + - Rotate the focussed monitor: *Ctrl-Alt-(Left/Right/Up/Down)* |
756 | + - Change display mode of the focussed monitor: *Ctrl-Alt-(=/-)* |
757 | + - Reset display mode to default, on focussed monitor: *Ctrl-Alt-0* |
758 | + - Adjust window opacity/alpha: *Alt-mousewheel* |
759 | + |
760 | +Want more? Log your requests at: https://bugs.launchpad.net/mir/+filebug |
761 | |
762 | === modified file 'doc/mainpage.md' |
763 | --- doc/mainpage.md 2014-03-06 06:05:17 +0000 |
764 | +++ doc/mainpage.md 2014-06-05 12:56:04 +0000 |
765 | @@ -35,6 +35,7 @@ |
766 | - \ref using_mir_on_pc |
767 | - \ref using_mir_on_android |
768 | - \ref debug_for_xmir |
769 | + - \ref demo_shell_controls |
770 | |
771 | Getting involved |
772 | ---------------- |
773 | |
774 | === modified file 'examples/CMakeLists.txt' |
775 | --- examples/CMakeLists.txt 2014-04-15 02:41:33 +0000 |
776 | +++ examples/CMakeLists.txt 2014-06-05 12:56:04 +0000 |
777 | @@ -183,6 +183,11 @@ |
778 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} |
779 | ) |
780 | |
781 | +add_executable(mir_demo_server_minimal minimal_server.cpp) |
782 | +target_link_libraries(mir_demo_server_minimal mirserver) |
783 | +install(TARGETS mir_demo_server_minimal |
784 | + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} |
785 | +) |
786 | |
787 | add_executable(mir_demo_server_translucent |
788 | translucent_server.cpp |
789 | |
790 | === modified file 'examples/demo-shell/demo_renderer.cpp' |
791 | --- examples/demo-shell/demo_renderer.cpp 2014-04-24 08:42:12 +0000 |
792 | +++ examples/demo-shell/demo_renderer.cpp 2014-06-05 12:56:04 +0000 |
793 | @@ -18,6 +18,7 @@ |
794 | |
795 | #include "demo_renderer.h" |
796 | #include <mir/graphics/renderable.h> |
797 | +#include <mir/compositor/recently_used_cache.h> |
798 | #include <cmath> |
799 | |
800 | using namespace mir; |
801 | @@ -137,7 +138,9 @@ |
802 | DemoRenderer::DemoRenderer( |
803 | graphics::GLProgramFactory const& program_factory, |
804 | geometry::Rectangle const& display_area) |
805 | - : GLRenderer(program_factory, display_area) |
806 | + : GLRenderer(program_factory, |
807 | + std::unique_ptr<graphics::GLTextureCache>(new compositor::RecentlyUsedCache()), |
808 | + display_area) |
809 | , corner_radius(0.5f) |
810 | { |
811 | shadow_corner_tex = generate_shadow_corner_texture(0.4f); |
812 | @@ -158,16 +161,15 @@ |
813 | glClear(GL_COLOR_BUFFER_BIT); |
814 | } |
815 | |
816 | -void DemoRenderer::tessellate(std::vector<Primitive>& primitives, |
817 | - graphics::Renderable const& renderable, |
818 | - geometry::Size const& buf_size) const |
819 | +void DemoRenderer::tessellate(std::vector<graphics::GLPrimitive>& primitives, |
820 | + graphics::Renderable const& renderable) const |
821 | { |
822 | - GLRenderer::tessellate(primitives, renderable, buf_size); |
823 | + GLRenderer::tessellate(primitives, renderable); |
824 | tessellate_shadow(primitives, renderable, 80.0f); |
825 | tessellate_frame(primitives, renderable, 30.0f); |
826 | } |
827 | |
828 | -void DemoRenderer::tessellate_shadow(std::vector<Primitive>& primitives, |
829 | +void DemoRenderer::tessellate_shadow(std::vector<graphics::GLPrimitive>& primitives, |
830 | graphics::Renderable const& renderable, |
831 | float radius) const |
832 | { |
833 | @@ -262,7 +264,7 @@ |
834 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
835 | } |
836 | |
837 | -void DemoRenderer::tessellate_frame(std::vector<Primitive>& primitives, |
838 | +void DemoRenderer::tessellate_frame(std::vector<graphics::GLPrimitive>& primitives, |
839 | graphics::Renderable const& renderable, |
840 | float titlebar_height) const |
841 | { |
842 | |
843 | === modified file 'examples/demo-shell/demo_renderer.h' |
844 | --- examples/demo-shell/demo_renderer.h 2014-04-24 08:42:12 +0000 |
845 | +++ examples/demo-shell/demo_renderer.h 2014-06-05 12:56:04 +0000 |
846 | @@ -33,13 +33,12 @@ |
847 | ~DemoRenderer(); |
848 | |
849 | void begin() const override; |
850 | - void tessellate(std::vector<Primitive>& primitives, |
851 | - graphics::Renderable const& renderable, |
852 | - geometry::Size const& buf_size) const override; |
853 | - void tessellate_shadow(std::vector<Primitive>& primitives, |
854 | + void tessellate(std::vector<graphics::GLPrimitive>& primitives, |
855 | + graphics::Renderable const& renderable) const override; |
856 | + void tessellate_shadow(std::vector<graphics::GLPrimitive>& primitives, |
857 | graphics::Renderable const& renderable, |
858 | float radius) const; |
859 | - void tessellate_frame(std::vector<Primitive>& primitives, |
860 | + void tessellate_frame(std::vector<graphics::GLPrimitive>& primitives, |
861 | graphics::Renderable const& renderable, |
862 | float titlebar_height) const; |
863 | |
864 | |
865 | === modified file 'examples/demo-shell/window_manager.cpp' |
866 | --- examples/demo-shell/window_manager.cpp 2014-04-15 05:31:19 +0000 |
867 | +++ examples/demo-shell/window_manager.cpp 2014-06-05 12:56:04 +0000 |
868 | @@ -160,6 +160,8 @@ |
869 | { |
870 | MirOrientation orientation = mir_orientation_normal; |
871 | bool rotating = true; |
872 | + int mode_change = 0; |
873 | + bool preferred_mode = false; |
874 | |
875 | switch (event.key.scan_code) |
876 | { |
877 | @@ -170,14 +172,41 @@ |
878 | default: rotating = false; break; |
879 | } |
880 | |
881 | - if (rotating) |
882 | + switch (event.key.scan_code) |
883 | + { |
884 | + case KEY_MINUS: mode_change = -1; break; |
885 | + case KEY_EQUAL: mode_change = +1; break; |
886 | + case KEY_0: preferred_mode = true; break; |
887 | + default: break; |
888 | + } |
889 | + |
890 | + if (rotating || mode_change || preferred_mode) |
891 | { |
892 | compositor->stop(); |
893 | auto conf = display->configuration(); |
894 | conf->for_each_output( |
895 | [&](mg::UserDisplayConfigurationOutput& output) -> void |
896 | { |
897 | - output.orientation = orientation; |
898 | + // Only apply changes to the monitor the cursor is on |
899 | + if (!output.extents().contains(old_cursor)) |
900 | + return; |
901 | + |
902 | + if (rotating) |
903 | + output.orientation = orientation; |
904 | + |
905 | + if (preferred_mode) |
906 | + { |
907 | + output.current_mode_index = |
908 | + output.preferred_mode_index; |
909 | + } |
910 | + else if (mode_change) |
911 | + { |
912 | + size_t nmodes = output.modes.size(); |
913 | + if (nmodes) |
914 | + output.current_mode_index = |
915 | + (output.current_mode_index + nmodes + |
916 | + mode_change) % nmodes; |
917 | + } |
918 | } |
919 | ); |
920 | display->configure(*conf); |
921 | @@ -192,7 +221,7 @@ |
922 | { |
923 | geometry::Point cursor = average_pointer(event.motion); |
924 | |
925 | - // FIXME: https://bugs.launchpad.net/mir/+bug/1197108 |
926 | + // FIXME: https://bugs.launchpad.net/mir/+bug/1311699 |
927 | MirMotionAction action = static_cast<MirMotionAction>(event.motion.action & ~0xff00); |
928 | |
929 | auto const app = focus_controller->focussed_application().lock(); |
930 | @@ -235,8 +264,6 @@ |
931 | drag.dx.as_int(); |
932 | int height = old_size.height.as_int() + |
933 | drag.dy.as_int(); |
934 | - if (width <= 0) width = 1; |
935 | - if (height <= 0) height = 1; |
936 | surf->resize({width, height}); |
937 | } |
938 | else |
939 | @@ -267,8 +294,6 @@ |
940 | |
941 | int width = old_size.width.as_int() + dx; |
942 | int height = old_size.height.as_int() + dy; |
943 | - if (width <= 0) width = 1; |
944 | - if (height <= 0) height = 1; |
945 | surf->resize({width, height}); |
946 | } |
947 | |
948 | @@ -290,7 +315,6 @@ |
949 | old_pos = surf->top_left(); |
950 | old_size = surf->size(); |
951 | old_pinch_diam = pinch_diam; |
952 | - old_cursor = cursor; |
953 | } |
954 | } |
955 | |
956 | @@ -303,6 +327,8 @@ |
957 | handled = true; |
958 | } |
959 | } |
960 | + |
961 | + old_cursor = cursor; |
962 | } |
963 | return handled; |
964 | } |
965 | |
966 | === modified file 'examples/eglapp.c' |
967 | --- examples/eglapp.c 2014-03-06 06:05:17 +0000 |
968 | +++ examples/eglapp.c 2014-06-05 12:56:04 +0000 |
969 | @@ -391,6 +391,7 @@ |
970 | *width = surfaceparm.width; |
971 | *height = surfaceparm.height; |
972 | |
973 | + printf("Surface %d DPI\n", mir_surface_get_dpi(surface)); |
974 | eglSwapInterval(egldisplay, swapinterval); |
975 | |
976 | running = 1; |
977 | |
978 | === modified file 'examples/eglcounter.cpp' |
979 | --- examples/eglcounter.cpp 2014-04-15 02:41:33 +0000 |
980 | +++ examples/eglcounter.cpp 2014-06-05 12:56:04 +0000 |
981 | @@ -25,6 +25,7 @@ |
982 | #include <vector> |
983 | #include <stdexcept> |
984 | #include <iostream> |
985 | +#include <algorithm> |
986 | |
987 | static GLuint load_shader(const char *src, GLenum type) |
988 | { |
989 | @@ -73,12 +74,9 @@ |
990 | { |
991 | public: |
992 | TwoDigitCounter(GLuint prog, float thickness, unsigned int max_count) |
993 | - : count{0}, max_count{max_count}, program{prog}, |
994 | + : count{0}, max_count{std::min(max_count, 99u)}, program{prog}, |
995 | vertices{create_vertices(thickness)}, digit_drawables{create_digits()} |
996 | { |
997 | - if (max_count > 99) |
998 | - max_count = 99; |
999 | - |
1000 | vpos = glGetAttribLocation(program, "vPosition"); |
1001 | if (vpos == -1) |
1002 | throw std::runtime_error("Failed to obtain vPosition attribute"); |
1003 | @@ -191,7 +189,7 @@ |
1004 | } |
1005 | |
1006 | unsigned int count; |
1007 | - unsigned int max_count; |
1008 | + unsigned int const max_count; |
1009 | |
1010 | GLint vpos; |
1011 | GLint xoff; |
1012 | |
1013 | === modified file 'examples/fingerpaint.c' |
1014 | --- examples/fingerpaint.c 2014-03-06 06:05:17 +0000 |
1015 | +++ examples/fingerpaint.c 2014-06-05 12:56:04 +0000 |
1016 | @@ -207,7 +207,7 @@ |
1017 | static size_t max_fingers = 0; |
1018 | static float max_pressure = 1.0f; |
1019 | |
1020 | - // FIXME: https://bugs.launchpad.net/mir/+bug/1197108 |
1021 | + // FIXME: https://bugs.launchpad.net/mir/+bug/1311699 |
1022 | MirMotionAction masked_action = event->motion.action & ~0xff00; |
1023 | |
1024 | if (masked_action == mir_motion_action_up) |
1025 | @@ -286,7 +286,7 @@ |
1026 | |
1027 | int main(int argc, char *argv[]) |
1028 | { |
1029 | - static const Color background = {0x40, 0x40, 0x40, 0xff}; |
1030 | + static const Color background = {180, 180, 150, 255}; |
1031 | MirConnection *conn; |
1032 | MirSurfaceParameters parm; |
1033 | MirSurface *surf; |
1034 | |
1035 | === added file 'examples/minimal_server.cpp' |
1036 | --- examples/minimal_server.cpp 1970-01-01 00:00:00 +0000 |
1037 | +++ examples/minimal_server.cpp 2014-06-05 12:56:04 +0000 |
1038 | @@ -0,0 +1,28 @@ |
1039 | +/* |
1040 | + * Copyright © 2014 Canonical Ltd. |
1041 | + * |
1042 | + * This program is free software: you can redistribute it and/or modify |
1043 | + * it under the terms of the GNU General Public License version 3 as |
1044 | + * published by the Free Software Foundation. |
1045 | + * |
1046 | + * This program is distributed in the hope that it will be useful, |
1047 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1048 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1049 | + * GNU General Public License for more details. |
1050 | + * |
1051 | + * You should have received a copy of the GNU General Public License |
1052 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1053 | + * |
1054 | + * Authored by: Daniel van Vugt <daniel.van.vugt@canonical.com> |
1055 | + */ |
1056 | + |
1057 | +#include "mir/default_server_configuration.h" |
1058 | +#include "mir/run_mir.h" |
1059 | + |
1060 | +int main(int argc, char const* argv[]) |
1061 | +{ |
1062 | + mir::DefaultServerConfiguration config(argc, argv); |
1063 | + run_mir(config, [](mir::DisplayServer&){} ); |
1064 | + return 0; |
1065 | +} |
1066 | + |
1067 | |
1068 | === modified file 'examples/render_overlays.cpp' |
1069 | --- examples/render_overlays.cpp 2014-04-15 05:31:19 +0000 |
1070 | +++ examples/render_overlays.cpp 2014-06-05 12:56:04 +0000 |
1071 | @@ -110,7 +110,7 @@ |
1072 | return this; |
1073 | } |
1074 | |
1075 | - std::shared_ptr<mg::Buffer> buffer(void const*) const override |
1076 | + std::shared_ptr<mg::Buffer> buffer() const override |
1077 | { |
1078 | return client->last_rendered(); |
1079 | } |
1080 | @@ -173,9 +173,7 @@ |
1081 | mir::DefaultServerConfiguration conf{argc, argv}; |
1082 | |
1083 | auto platform = conf.the_graphics_platform(); |
1084 | - auto display = platform->create_display( |
1085 | - conf.the_display_configuration_policy(), |
1086 | - conf.the_gl_config()); |
1087 | + auto display = conf.the_display(); |
1088 | auto buffer_allocator = platform->create_buffer_allocator(conf.the_buffer_initializer()); |
1089 | |
1090 | mg::BufferProperties buffer_properties{ |
1091 | @@ -189,8 +187,8 @@ |
1092 | |
1093 | std::list<std::shared_ptr<mg::Renderable>> renderlist |
1094 | { |
1095 | - std::make_shared<DemoRenderable>(client1, geom::Rectangle{{0,0} , {512, 512}}), |
1096 | - std::make_shared<DemoRenderable>(client2, geom::Rectangle{{80,80} , {592,592}}) |
1097 | + std::make_shared<DemoRenderable>(client1, geom::Rectangle{{0,0} , buffer_properties.size}), |
1098 | + std::make_shared<DemoRenderable>(client2, geom::Rectangle{{80,80} , buffer_properties.size}) |
1099 | }; |
1100 | |
1101 | while (running) |
1102 | @@ -200,8 +198,7 @@ |
1103 | buffer.make_current(); |
1104 | client1->update_green_channel(); |
1105 | client2->update_green_channel(); |
1106 | - auto render_fn = [](mg::Renderable const&) {}; |
1107 | - buffer.render_and_post_update(renderlist, render_fn); |
1108 | + buffer.post_renderables_if_optimizable(renderlist); |
1109 | }); |
1110 | } |
1111 | return 0; |
1112 | |
1113 | === modified file 'examples/render_surfaces.cpp' |
1114 | --- examples/render_surfaces.cpp 2014-04-15 10:19:19 +0000 |
1115 | +++ examples/render_surfaces.cpp 2014-06-05 12:56:04 +0000 |
1116 | @@ -26,7 +26,6 @@ |
1117 | #include "mir/geometry/size.h" |
1118 | #include "mir/geometry/rectangles.h" |
1119 | #include "mir/graphics/buffer_initializer.h" |
1120 | -#include "mir/graphics/cursor.h" |
1121 | #include "mir/graphics/display.h" |
1122 | #include "mir/graphics/display_buffer.h" |
1123 | #include "mir/graphics/gl_context.h" |
1124 | @@ -89,62 +88,10 @@ |
1125 | namespace |
1126 | { |
1127 | std::atomic<bool> created{false}; |
1128 | -bool input_is_on = false; |
1129 | -std::weak_ptr<mg::Cursor> cursor; |
1130 | -static const uint32_t bg_color = 0x00000000; |
1131 | -static const uint32_t fg_color = 0xffdd4814; |
1132 | + |
1133 | static const float min_alpha = 0.3f; |
1134 | |
1135 | -void update_cursor(uint32_t bg_color, uint32_t fg_color) |
1136 | -{ |
1137 | - if (auto cursor = ::cursor.lock()) |
1138 | - { |
1139 | - static const int width = 64; |
1140 | - static const int height = 64; |
1141 | - std::vector<uint32_t> image(height * width, bg_color); |
1142 | - for (int i = 0; i != width-1; ++i) |
1143 | - { |
1144 | - if (i < 16) |
1145 | - { |
1146 | - image[0 * height + i] = fg_color; |
1147 | - image[1 * height + i] = fg_color; |
1148 | - image[i * height + 0] = fg_color; |
1149 | - image[i * height + 1] = fg_color; |
1150 | - } |
1151 | - image[i * height + i] = fg_color; |
1152 | - image[(i+1) * height + i] = fg_color; |
1153 | - image[i * height + i + 1] = fg_color; |
1154 | - } |
1155 | - cursor->set_image(image.data(), geom::Size{width, height}); |
1156 | - } |
1157 | -} |
1158 | - |
1159 | -void animate_cursor() |
1160 | -{ |
1161 | - if (!input_is_on) |
1162 | - { |
1163 | - if (auto cursor = ::cursor.lock()) |
1164 | - { |
1165 | - static int cursor_pos = 0; |
1166 | - if (++cursor_pos == 300) |
1167 | - { |
1168 | - cursor_pos = 0; |
1169 | - |
1170 | - static const uint32_t fg_colors[3] = { fg_color, 0xffffffff, 0x3f000000 }; |
1171 | - static int fg_color = 0; |
1172 | - |
1173 | - if (++fg_color == 3) fg_color = 0; |
1174 | - |
1175 | - update_cursor(bg_color, fg_colors[fg_color]); |
1176 | - } |
1177 | - |
1178 | - cursor->move_to(geom::Point{cursor_pos, cursor_pos}); |
1179 | - } |
1180 | - } |
1181 | -} |
1182 | - |
1183 | char const* const surfaces_to_render = "surfaces-to-render"; |
1184 | -char const* const display_cursor = "display-cursor"; |
1185 | |
1186 | ///\internal [StopWatch_tag] |
1187 | // tracks elapsed time - for animation. |
1188 | @@ -278,9 +225,7 @@ |
1189 | |
1190 | result->add_options() |
1191 | (surfaces_to_render, po::value<int>()->default_value(5), |
1192 | - "Number of surfaces to render") |
1193 | - (display_cursor, po::value<bool>()->default_value(false), |
1194 | - "Display test cursor. (If input is disabled it gets animated.)"); |
1195 | + "Number of surfaces to render"); |
1196 | |
1197 | return result; |
1198 | }()) |
1199 | @@ -296,7 +241,7 @@ |
1200 | void start() {} |
1201 | void stop() {} |
1202 | int client_socket_fd() const override { return 0; } |
1203 | - void remove_endpoint() const override { } |
1204 | + int client_socket_fd(std::function<void(std::shared_ptr<mf::Session> const&)> const&) const override { return 0; } |
1205 | }; |
1206 | |
1207 | return std::make_shared<NullConnector>(); |
1208 | @@ -382,7 +327,6 @@ |
1209 | bool composite() |
1210 | { |
1211 | while (!created) std::this_thread::yield(); |
1212 | - animate_cursor(); |
1213 | stop_watch.stop(); |
1214 | if (stop_watch.elapsed_seconds_since_last_restart() >= 1) |
1215 | { |
1216 | @@ -501,23 +445,6 @@ |
1217 | created = true; |
1218 | } |
1219 | |
1220 | - bool input_is_on() |
1221 | - { |
1222 | - return the_options()->get<bool>(mo::enable_input_opt); |
1223 | - } |
1224 | - |
1225 | - std::weak_ptr<mg::Cursor> the_cursor() |
1226 | - { |
1227 | - if (the_options()->get<bool>(display_cursor)) |
1228 | - { |
1229 | - return the_display()->the_cursor(); |
1230 | - } |
1231 | - else |
1232 | - { |
1233 | - return {}; |
1234 | - } |
1235 | - } |
1236 | - |
1237 | private: |
1238 | std::vector<Moveable> moveables; |
1239 | }; |
1240 | @@ -532,9 +459,6 @@ |
1241 | |
1242 | mir::run_mir(conf, [&](mir::DisplayServer&) |
1243 | { |
1244 | - cursor = conf.the_cursor(); |
1245 | - |
1246 | - input_is_on = conf.input_is_on(); |
1247 | }); |
1248 | ///\internal [main_tag] |
1249 | |
1250 | |
1251 | === modified file 'include/client/mir_toolkit/mir_connection.h' |
1252 | --- include/client/mir_toolkit/mir_connection.h 2014-03-31 14:36:08 +0000 |
1253 | +++ include/client/mir_toolkit/mir_connection.h 2014-06-05 12:56:04 +0000 |
1254 | @@ -169,6 +169,25 @@ |
1255 | MirConnection* connection, MirPixelFormat* formats, |
1256 | unsigned const int format_size, unsigned int *num_valid_formats); |
1257 | |
1258 | +/** |
1259 | + * Allocate some FDs for trusted clients to connect on |
1260 | + * |
1261 | + * Trust session helpers need to allocate connection FDs it will pass to |
1262 | + * trusted clients to use when connecting to the server. The server can |
1263 | + * then associate them with the trust session. |
1264 | + * |
1265 | + * \warning This API is tentative until the implementation of trust sessions is complete |
1266 | + * \param [in] connection The connection |
1267 | + * \param [in] no_of_fds The number of fds to allocate |
1268 | + * \param [in] callback Callback invoked when request completes |
1269 | + * \param [in,out] context User data passed to the callback function |
1270 | + * \return A handle that can be passed to mir_wait_for |
1271 | + */ |
1272 | +MirWaitHandle* mir_connection_new_fds_for_trusted_clients( |
1273 | + MirConnection* connection, |
1274 | + unsigned int no_of_fds, |
1275 | + mir_client_fd_callback callback, |
1276 | + void * context); |
1277 | |
1278 | #ifdef __cplusplus |
1279 | } |
1280 | |
1281 | === added file 'include/client/mir_toolkit/mir_cursor_configuration.h' |
1282 | --- include/client/mir_toolkit/mir_cursor_configuration.h 1970-01-01 00:00:00 +0000 |
1283 | +++ include/client/mir_toolkit/mir_cursor_configuration.h 2014-06-05 12:56:04 +0000 |
1284 | @@ -0,0 +1,68 @@ |
1285 | +/* |
1286 | + * Copyright © 2014 Canonical Ltd. |
1287 | + * |
1288 | + * This program is free software: you can redistribute it and/or modify it |
1289 | + * under the terms of the GNU Lesser General Public License version 3, |
1290 | + * as published by the Free Software Foundation. |
1291 | + * |
1292 | + * This program is distributed in the hope that it will be useful, |
1293 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1294 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1295 | + * GNU Lesser General Public License for more details. |
1296 | + * |
1297 | + * You should have received a copy of the GNU Lesser General Public License |
1298 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1299 | + * |
1300 | + */ |
1301 | + |
1302 | +#ifndef MIR_TOOLKIT_MIR_CURSOR_H_ |
1303 | +#define MIR_TOOLKIT_MIR_CURSOR_H_ |
1304 | + |
1305 | +/** |
1306 | + * Opaque structure containing cursor parameterization. Create with mir_cursor* family. |
1307 | + * Used with mir_surface_configure_cursor. |
1308 | + */ |
1309 | +typedef struct MirCursorConfiguration MirCursorConfiguration; |
1310 | + |
1311 | +#ifdef __cplusplus |
1312 | +/** |
1313 | + * \addtogroup mir_toolkit |
1314 | + * @{ |
1315 | + */ |
1316 | +extern "C" { |
1317 | +#endif |
1318 | + |
1319 | +/** |
1320 | + * A special cursor name for use with mir_cursor_configuration_from_name |
1321 | + * representing the system default cursor. |
1322 | + */ |
1323 | +extern char const *const mir_default_cursor_name; |
1324 | +/** |
1325 | + * A special cursor name for use with mir_cursor_configuration_from_name |
1326 | + * representing a disabled cursor image. |
1327 | + */ |
1328 | +extern char const *const mir_disabled_cursor_name; |
1329 | + |
1330 | +/** |
1331 | + * Release resources assosciated with cursor parameters |
1332 | + * \param [in] parameters The operand |
1333 | + */ |
1334 | +void mir_cursor_configuration_destroy(MirCursorConfiguration *parameters); |
1335 | + |
1336 | +/** |
1337 | + * Returns a new MirCursorConfiguration representing a named cursor |
1338 | + * from the system cursor theme. Currently only the symbolic values, |
1339 | + * mir_default_cursor_name and mir_disabled_cursor_name are supported |
1340 | + * as input. |
1341 | + * \param [in] name The cursor name |
1342 | + * \return A cursor parameters object which must be passed |
1343 | + * to_mir_cursor_configuration_destroy |
1344 | + */ |
1345 | +MirCursorConfiguration *mir_cursor_configuration_from_name(char const* name); |
1346 | + |
1347 | +#ifdef __cplusplus |
1348 | +} |
1349 | +/**@}*/ |
1350 | +#endif |
1351 | + |
1352 | +#endif /* MIR_TOOLKIT_MIR_CURSOR_H_ */ |
1353 | |
1354 | === modified file 'include/client/mir_toolkit/mir_surface.h' |
1355 | --- include/client/mir_toolkit/mir_surface.h 2014-03-31 14:36:08 +0000 |
1356 | +++ include/client/mir_toolkit/mir_surface.h 2014-06-05 12:56:04 +0000 |
1357 | @@ -21,6 +21,7 @@ |
1358 | #include <mir_toolkit/mir_native_buffer.h> |
1359 | #include <mir_toolkit/client_types.h> |
1360 | #include <mir_toolkit/common.h> |
1361 | +#include <mir_toolkit/mir_cursor_configuration.h> |
1362 | |
1363 | #ifdef __cplusplus |
1364 | /** |
1365 | @@ -246,6 +247,25 @@ |
1366 | */ |
1367 | int mir_surface_get_swapinterval(MirSurface* surface); |
1368 | |
1369 | +/** |
1370 | + * Query the DPI value of the surface (dots per inch). This will vary depending |
1371 | + * on the physical display configuration and where the surface is within it. |
1372 | + * \return The DPI of the surface, or zero if unknown. |
1373 | + */ |
1374 | +int mir_surface_get_dpi(MirSurface* surface); |
1375 | + |
1376 | +/** |
1377 | + * Choose the cursor state for a surface: whether a cursor is shown, |
1378 | + * and which cursor if so. |
1379 | + * \param [in] surface The surface to operate on |
1380 | + * \param [in] parameters The configuration parameters obtained |
1381 | + * from mir_cursor* family of functions. |
1382 | + * \return A wait handle that can be passed to mir_wait_for, |
1383 | + * or NULL if parameters is invalid. |
1384 | + * |
1385 | + */ |
1386 | +MirWaitHandle* mir_surface_configure_cursor(MirSurface *surface, MirCursorConfiguration const* parameters); |
1387 | + |
1388 | #ifdef __cplusplus |
1389 | } |
1390 | /**@}*/ |
1391 | |
1392 | === added file 'include/platform/mir/emergency_cleanup_registry.h' |
1393 | --- include/platform/mir/emergency_cleanup_registry.h 1970-01-01 00:00:00 +0000 |
1394 | +++ include/platform/mir/emergency_cleanup_registry.h 2014-06-05 12:56:04 +0000 |
1395 | @@ -0,0 +1,45 @@ |
1396 | +/* |
1397 | + * Copyright © 2014 Canonical Ltd. |
1398 | + * |
1399 | + * This program is free software: you can redistribute it and/or modify it |
1400 | + * under the terms of the GNU Lesser General Public License version 3, |
1401 | + * as published by the Free Software Foundation. |
1402 | + * |
1403 | + * This program is distributed in the hope that it will be useful, |
1404 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1405 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1406 | + * GNU Lesser General Public License for more details. |
1407 | + * |
1408 | + * You should have received a copy of the GNU Lesser General Public License |
1409 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1410 | + * |
1411 | + * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com> |
1412 | + */ |
1413 | + |
1414 | + |
1415 | +#ifndef MIR_EMERGENCY_CLEANUP_REGISTRY_H_ |
1416 | +#define MIR_EMERGENCY_CLEANUP_REGISTRY_H_ |
1417 | + |
1418 | +#include <functional> |
1419 | + |
1420 | +namespace mir |
1421 | +{ |
1422 | + |
1423 | +typedef std::function<void()> EmergencyCleanupHandler; |
1424 | + |
1425 | +class EmergencyCleanupRegistry |
1426 | +{ |
1427 | +public: |
1428 | + virtual ~EmergencyCleanupRegistry() = default; |
1429 | + |
1430 | + virtual void add(EmergencyCleanupHandler const& handler) = 0; |
1431 | + |
1432 | +protected: |
1433 | + EmergencyCleanupRegistry() = default; |
1434 | + EmergencyCleanupRegistry(EmergencyCleanupRegistry const&) = delete; |
1435 | + EmergencyCleanupRegistry& operator=(EmergencyCleanupRegistry const&) = delete; |
1436 | +}; |
1437 | + |
1438 | +} |
1439 | + |
1440 | +#endif /* MIR_EMERGENCY_CLEANUP_REGISTRY_H_ */ |
1441 | |
1442 | === modified file 'include/platform/mir/graphics/cursor.h' |
1443 | --- include/platform/mir/graphics/cursor.h 2013-08-28 03:41:48 +0000 |
1444 | +++ include/platform/mir/graphics/cursor.h 2014-06-05 12:56:04 +0000 |
1445 | @@ -23,14 +23,19 @@ |
1446 | #include "mir/geometry/size.h" |
1447 | #include "mir/geometry/point.h" |
1448 | |
1449 | +#include <memory> |
1450 | + |
1451 | namespace mir |
1452 | { |
1453 | namespace graphics |
1454 | { |
1455 | +class CursorImage; |
1456 | class Cursor |
1457 | { |
1458 | public: |
1459 | - virtual void set_image(void const* raw_argb, geometry::Size size) = 0; |
1460 | + virtual void show(CursorImage const& cursor_image) = 0; |
1461 | + virtual void hide() = 0; |
1462 | + |
1463 | virtual void move_to(geometry::Point position) = 0; |
1464 | |
1465 | protected: |
1466 | |
1467 | === added file 'include/platform/mir/graphics/cursor_image.h' |
1468 | --- include/platform/mir/graphics/cursor_image.h 1970-01-01 00:00:00 +0000 |
1469 | +++ include/platform/mir/graphics/cursor_image.h 2014-06-05 12:56:04 +0000 |
1470 | @@ -0,0 +1,46 @@ |
1471 | +/* |
1472 | + * Copyright © 2014 Canonical Ltd. |
1473 | + * |
1474 | + * This program is free software: you can redistribute it and/or modify it |
1475 | + * under the terms of the GNU Lesser General Public License version 3, |
1476 | + * as published by the Free Software Foundation. |
1477 | + * |
1478 | + * This program is distributed in the hope that it will be useful, |
1479 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1480 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1481 | + * GNU Lesser General Public License for more details. |
1482 | + * |
1483 | + * You should have received a copy of the GNU Lesser General Public License |
1484 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1485 | + * |
1486 | + * Authored by: Robert Carr <robert.carr@canonical.com> |
1487 | + */ |
1488 | + |
1489 | + |
1490 | +#ifndef MIR_GRAPHICS_CURSOR_IMAGE_H_ |
1491 | +#define MIR_GRAPHICS_CURSOR_IMAGE_H_ |
1492 | + |
1493 | +#include "mir/geometry/size.h" |
1494 | + |
1495 | +namespace mir |
1496 | +{ |
1497 | +namespace graphics |
1498 | +{ |
1499 | +class CursorImage |
1500 | +{ |
1501 | +public: |
1502 | + virtual ~CursorImage() = default; |
1503 | + |
1504 | + virtual void const* as_argb_8888() const = 0; |
1505 | + virtual geometry::Size size() const = 0; |
1506 | + |
1507 | +protected: |
1508 | + CursorImage() = default; |
1509 | + CursorImage(CursorImage const&) = delete; |
1510 | + CursorImage& operator=(CursorImage const&) = delete; |
1511 | +}; |
1512 | +} |
1513 | +} |
1514 | + |
1515 | + |
1516 | +#endif /* MIR_GRAPHICS_CURSOR_IMAGE_H_ */ |
1517 | |
1518 | === modified file 'include/platform/mir/graphics/display.h' |
1519 | --- include/platform/mir/graphics/display.h 2014-01-31 07:48:24 +0000 |
1520 | +++ include/platform/mir/graphics/display.h 2014-06-05 12:56:04 +0000 |
1521 | @@ -31,6 +31,7 @@ |
1522 | class DisplayBuffer; |
1523 | class DisplayConfiguration; |
1524 | class Cursor; |
1525 | +class CursorImage; |
1526 | class GLContext; |
1527 | class EventHandlerRegister; |
1528 | |
1529 | @@ -97,9 +98,9 @@ |
1530 | virtual void resume() = 0; |
1531 | |
1532 | /** |
1533 | - * Gets the hardware cursor object. |
1534 | + * Create a hardware cursor object. |
1535 | */ |
1536 | - virtual std::weak_ptr<Cursor> the_cursor() = 0; |
1537 | + virtual std::shared_ptr<Cursor> create_hardware_cursor(std::shared_ptr<CursorImage> const& initial_image) = 0; |
1538 | |
1539 | /** |
1540 | * Creates a GLContext object that shares resources with the Display's GL context. |
1541 | |
1542 | === modified file 'include/platform/mir/graphics/display_buffer.h' |
1543 | --- include/platform/mir/graphics/display_buffer.h 2014-03-26 05:48:59 +0000 |
1544 | +++ include/platform/mir/graphics/display_buffer.h 2014-06-05 12:56:04 +0000 |
1545 | @@ -24,7 +24,6 @@ |
1546 | #include <mir_toolkit/common.h> |
1547 | |
1548 | #include <memory> |
1549 | -#include <functional> |
1550 | |
1551 | namespace mir |
1552 | { |
1553 | @@ -51,13 +50,22 @@ |
1554 | /** This will trigger OpenGL rendering and post the result to the screen. */ |
1555 | virtual void post_update() = 0; |
1556 | |
1557 | - /** This will render renderlist to the screen and post the result to the screen. |
1558 | - For each renderable, the DisplayBuffer will decide if its more efficient to render |
1559 | - that Renderable via OpenGL, or via another method. If the Renderable is to be rendered |
1560 | - via OpenGL, render_fn will be invoked on that Renderable. */ |
1561 | - virtual void render_and_post_update( |
1562 | - RenderableList const& renderlist, |
1563 | - std::function<void(Renderable const&)> const& render_fn) = 0; |
1564 | + /** This will render renderlist to the screen and post the result to the |
1565 | + * screen if there is a hardware optimization that can be done. |
1566 | + * \param [in] renderlist |
1567 | + * The renderables that should appear on the screen if the hardware |
1568 | + * is capable of optmizing that list somehow. If what you want |
1569 | + * displayed on the screen cannot be represented by a RenderableList, |
1570 | + * then you should draw using OpenGL and use post_update() |
1571 | + * \returns |
1572 | + * true if the hardware can optimize the rendering of the list. |
1573 | + * When this call completes, the renderlist will have been posted |
1574 | + * to the screen. |
1575 | + * false if the hardware platform cannot optimize the list. The screen |
1576 | + * will not be updated. The caller should render the list another way, |
1577 | + * and post using post_update() |
1578 | + **/ |
1579 | + virtual bool post_renderables_if_optimizable(RenderableList const& renderlist) = 0; |
1580 | |
1581 | /** to be deprecated */ |
1582 | virtual bool can_bypass() const = 0; |
1583 | |
1584 | === modified file 'include/platform/mir/graphics/display_configuration.h' |
1585 | --- include/platform/mir/graphics/display_configuration.h 2014-03-26 05:48:59 +0000 |
1586 | +++ include/platform/mir/graphics/display_configuration.h 2014-06-05 12:56:04 +0000 |
1587 | @@ -139,6 +139,7 @@ |
1588 | MirOrientation& orientation; |
1589 | |
1590 | UserDisplayConfigurationOutput(DisplayConfigurationOutput& master); |
1591 | + geometry::Rectangle extents() const; |
1592 | }; |
1593 | |
1594 | std::ostream& operator<<(std::ostream& out, DisplayConfigurationCard const& val); |
1595 | |
1596 | === added file 'include/platform/mir/graphics/gl_primitive.h' |
1597 | --- include/platform/mir/graphics/gl_primitive.h 1970-01-01 00:00:00 +0000 |
1598 | +++ include/platform/mir/graphics/gl_primitive.h 2014-06-05 12:56:04 +0000 |
1599 | @@ -0,0 +1,44 @@ |
1600 | +/* |
1601 | + * Copyright © 2014 Canonical Ltd. |
1602 | + * |
1603 | + * This program is free software: you can redistribute it and/or modify it |
1604 | + * under the terms of the GNU Lesser General Public License version 3, |
1605 | + * as published by the Free Software Foundation. |
1606 | + * |
1607 | + * This program is distributed in the hope that it will be useful, |
1608 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1609 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1610 | + * GNU Lesser General Public License for more details. |
1611 | + * |
1612 | + * You should have received a copy of the GNU Lesser General Public License |
1613 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1614 | + * |
1615 | + * Authored by: Daniel van Vugt <daniel.van.vugt@canonical.com> |
1616 | + * Kevin DuBois <kevin.dubois@canonical.com> |
1617 | + */ |
1618 | + |
1619 | +#ifndef MIR_GRAPHICS_GL_PRIMITIVE_H_ |
1620 | +#define MIR_GRAPHICS_GL_PRIMITIVE_H_ |
1621 | + |
1622 | +#include <GLES2/gl2.h> |
1623 | +#include <vector> |
1624 | + |
1625 | +namespace mir |
1626 | +{ |
1627 | +namespace graphics |
1628 | +{ |
1629 | +struct GLVertex |
1630 | +{ |
1631 | + GLfloat position[3]; |
1632 | + GLfloat texcoord[2]; |
1633 | +}; |
1634 | + |
1635 | +struct GLPrimitive |
1636 | +{ |
1637 | + GLenum type; // GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN, GL_TRIANGLES etc |
1638 | + GLuint tex_id; // GL texture ID (or 0 to represent the surface itself) |
1639 | + std::vector<GLVertex> vertices; |
1640 | +}; |
1641 | +} |
1642 | +} |
1643 | +#endif /* MIR_GRAPHICS_GL_PRIMITIVE_H_ */ |
1644 | |
1645 | === renamed file 'include/server/mir/graphics/gl_program.h' => 'include/platform/mir/graphics/gl_program.h' |
1646 | --- include/server/mir/graphics/gl_program.h 2014-04-24 08:42:12 +0000 |
1647 | +++ include/platform/mir/graphics/gl_program.h 2014-06-05 12:56:04 +0000 |
1648 | @@ -2,15 +2,15 @@ |
1649 | * Copyright © 2013-2014 Canonical Ltd. |
1650 | * |
1651 | * This program is free software: you can redistribute it and/or modify it |
1652 | - * under the terms of the GNU General Public License version 3, |
1653 | + * under the terms of the GNU Lesser General Public License version 3, |
1654 | * as published by the Free Software Foundation. |
1655 | * |
1656 | * This program is distributed in the hope that it will be useful, |
1657 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1658 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1659 | - * GNU General Public License for more details. |
1660 | + * GNU Lesser General Public License for more details. |
1661 | * |
1662 | - * You should have received a copy of the GNU General Public License |
1663 | + * You should have received a copy of the GNU Lesser General Public License |
1664 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1665 | * |
1666 | * Authored by: Kevin DuBois <kevin.dubois@canonical.com> |
1667 | @@ -43,17 +43,26 @@ |
1668 | class GLProgram |
1669 | { |
1670 | public: |
1671 | - GLProgram( |
1672 | + virtual ~GLProgram() = default; |
1673 | + virtual operator GLuint() const = 0; |
1674 | + |
1675 | +protected: |
1676 | + GLProgram() = default; |
1677 | +private: |
1678 | + GLProgram(GLProgram const&) = delete; |
1679 | + GLProgram& operator=(GLProgram const&) = delete; |
1680 | +}; |
1681 | + |
1682 | +class SimpleGLProgram : public GLProgram |
1683 | +{ |
1684 | +public: |
1685 | + SimpleGLProgram( |
1686 | GLchar const* vertex_shader_src, |
1687 | GLchar const* fragment_shader_src); |
1688 | - ~GLProgram(); |
1689 | - |
1690 | - operator GLuint() const; |
1691 | - |
1692 | + ~SimpleGLProgram(); |
1693 | + |
1694 | + operator GLuint() const override; |
1695 | private: |
1696 | - GLProgram(GLProgram const&) = delete; |
1697 | - GLProgram& operator=(GLProgram const&) = delete; |
1698 | - |
1699 | GLShader const vertex_shader; |
1700 | GLShader const fragment_shader; |
1701 | GLuint const program; |
1702 | |
1703 | === modified file 'include/platform/mir/graphics/gl_program_factory.h' |
1704 | --- include/platform/mir/graphics/gl_program_factory.h 2014-04-22 16:45:27 +0000 |
1705 | +++ include/platform/mir/graphics/gl_program_factory.h 2014-06-05 12:56:04 +0000 |
1706 | @@ -20,6 +20,7 @@ |
1707 | #define MIR_COMPOSITOR_GL_PROGRAM_FACTORY_H_ |
1708 | |
1709 | #include "mir/graphics/gl_program.h" |
1710 | +#include "mir/graphics/gl_texture_cache.h" |
1711 | #include <memory> |
1712 | |
1713 | namespace mir |
1714 | @@ -34,7 +35,7 @@ |
1715 | |
1716 | virtual std::unique_ptr<GLProgram> |
1717 | create_gl_program(std::string const&, std::string const&) const = 0; |
1718 | - |
1719 | + virtual std::unique_ptr<GLTextureCache> create_texture_cache() const = 0; |
1720 | protected: |
1721 | GLProgramFactory() = default; |
1722 | |
1723 | |
1724 | === added file 'include/platform/mir/graphics/gl_texture.h' |
1725 | --- include/platform/mir/graphics/gl_texture.h 1970-01-01 00:00:00 +0000 |
1726 | +++ include/platform/mir/graphics/gl_texture.h 2014-06-05 12:56:04 +0000 |
1727 | @@ -0,0 +1,44 @@ |
1728 | +/* |
1729 | + * Copyright © 2014 Canonical Ltd. |
1730 | + * |
1731 | + * This program is free software: you can redistribute it and/or modify it |
1732 | + * under the terms of the GNU Lesser General Public License version 3, |
1733 | + * as published by the Free Software Foundation. |
1734 | + * |
1735 | + * This program is distributed in the hope that it will be useful, |
1736 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1737 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1738 | + * GNU Lesser General Public License for more details. |
1739 | + * |
1740 | + * You should have received a copy of the GNU Lesser General Public License |
1741 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1742 | + * |
1743 | + * Authored by: Kevin DuBois <kevin.dubois@canonical.com> |
1744 | + */ |
1745 | + |
1746 | +#ifndef MIR_GRAPHICS_GL_TEXTURE_H_ |
1747 | +#define MIR_GRAPHICS_GL_TEXTURE_H_ |
1748 | + |
1749 | +#include <GLES2/gl2.h> |
1750 | + |
1751 | +namespace mir |
1752 | +{ |
1753 | +namespace graphics |
1754 | +{ |
1755 | +class GLTexture |
1756 | +{ |
1757 | +public: |
1758 | + GLTexture(); |
1759 | + ~GLTexture(); |
1760 | + void bind() const; |
1761 | + |
1762 | +private: |
1763 | + GLTexture(GLTexture const&) = delete; |
1764 | + GLTexture& operator=(GLTexture const&) = delete; |
1765 | + GLuint generate_id() const; |
1766 | + GLuint const id; |
1767 | +}; |
1768 | +} |
1769 | +} |
1770 | + |
1771 | +#endif /* MIR_GRAPHICS_GL_TEXTURE_H_ */ |
1772 | |
1773 | === added file 'include/platform/mir/graphics/gl_texture_cache.h' |
1774 | --- include/platform/mir/graphics/gl_texture_cache.h 1970-01-01 00:00:00 +0000 |
1775 | +++ include/platform/mir/graphics/gl_texture_cache.h 2014-06-05 12:56:04 +0000 |
1776 | @@ -0,0 +1,67 @@ |
1777 | +/* |
1778 | + * Copyright © 2014 Canonical Ltd. |
1779 | + * |
1780 | + * This program is free software: you can redistribute it and/or modify it |
1781 | + * under the terms of the GNU Lesser General Public License version 3, |
1782 | + * as published by the Free Software Foundation. |
1783 | + * |
1784 | + * This program is distributed in the hope that it will be useful, |
1785 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1786 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1787 | + * GNU Lesser General Public License for more details. |
1788 | + * |
1789 | + * You should have received a copy of the GNU Lesser General Public License |
1790 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1791 | + * |
1792 | + * Authored by: Daniel van Vugt <daniel.van.vugt@canonical.com> |
1793 | + * Kevin DuBois <kevin.dubois@canonical.com> |
1794 | + */ |
1795 | + |
1796 | +#ifndef MIR_GRAPHICS_GL_TEXTURE_CACHE_H_ |
1797 | +#define MIR_GRAPHICS_GL_TEXTURE_CACHE_H_ |
1798 | + |
1799 | +#include "mir/graphics/renderable.h" |
1800 | + |
1801 | +namespace mir |
1802 | +{ |
1803 | +namespace graphics |
1804 | +{ |
1805 | +class GLTexture; |
1806 | +class GLTextureCache |
1807 | +{ |
1808 | +public: |
1809 | + virtual ~GLTextureCache() = default; |
1810 | + |
1811 | + /** |
1812 | + * Loads texture from the renderable. Must be called with a current GL |
1813 | + * context. |
1814 | + * \param [in] renderable |
1815 | + * The Renderable that needs to be used as a texture |
1816 | + * \returns |
1817 | + * The texture that represents the renderable. |
1818 | + */ |
1819 | + virtual std::shared_ptr<GLTexture> load(Renderable const&) = 0; |
1820 | + |
1821 | + /** |
1822 | + * Mark all entries in the cache as out-of-date to ensure fresh textures |
1823 | + * are loaded next time. This function _must_ be implemented in a way that |
1824 | + * does not require a GL context, as it will typically be called without |
1825 | + * one. |
1826 | + */ |
1827 | + virtual void invalidate() = 0; |
1828 | + |
1829 | + /** |
1830 | + * Free textures that were not used (loaded) since the last |
1831 | + * drop/invalidate. Must be called with a current GL context. |
1832 | + */ |
1833 | + virtual void drop_unused() = 0; |
1834 | + |
1835 | +protected: |
1836 | + GLTextureCache() = default; |
1837 | +private: |
1838 | + GLTextureCache(GLTextureCache const&) = delete; |
1839 | + GLTextureCache& operator=(GLTextureCache const&) = delete; |
1840 | +}; |
1841 | +} |
1842 | +} |
1843 | +#endif /* MIR_GRAPHICS_GL_TEXTURE_CACHE_H_ */ |
1844 | |
1845 | === modified file 'include/platform/mir/graphics/platform.h' |
1846 | --- include/platform/mir/graphics/platform.h 2014-03-27 09:52:04 +0000 |
1847 | +++ include/platform/mir/graphics/platform.h 2014-06-05 12:56:04 +0000 |
1848 | @@ -50,6 +50,7 @@ |
1849 | class DisplayConfigurationPolicy; |
1850 | class GraphicBufferAllocator; |
1851 | class GLConfig; |
1852 | +class GLProgramFactory; |
1853 | |
1854 | /** |
1855 | * \defgroup platform_enablement Mir platform enablement |
1856 | @@ -84,6 +85,7 @@ |
1857 | */ |
1858 | virtual std::shared_ptr<Display> create_display( |
1859 | std::shared_ptr<DisplayConfigurationPolicy> const& initial_conf_policy, |
1860 | + std::shared_ptr<GLProgramFactory> const& gl_program_factory, |
1861 | std::shared_ptr<GLConfig> const& gl_config) = 0; |
1862 | |
1863 | /** |
1864 | |
1865 | === modified file 'include/platform/mir/graphics/renderable.h' |
1866 | --- include/platform/mir/graphics/renderable.h 2014-04-15 05:31:19 +0000 |
1867 | +++ include/platform/mir/graphics/renderable.h 2014-06-05 12:56:04 +0000 |
1868 | @@ -33,6 +33,8 @@ |
1869 | class Renderable |
1870 | { |
1871 | public: |
1872 | + virtual ~Renderable() = default; |
1873 | + |
1874 | typedef void const* ID; // Mostly opaque, but zero is reserved as "invalid" |
1875 | |
1876 | /** |
1877 | @@ -42,17 +44,9 @@ |
1878 | virtual ID id() const = 0; |
1879 | |
1880 | /** |
1881 | - * Return the next buffer that should be composited/rendered. |
1882 | - * |
1883 | - * \param [in] user_id An arbitrary unique identifier used to distinguish |
1884 | - * separate threads/monitors/components which need |
1885 | - * to concurrently receive the same buffer. Calling |
1886 | - * with the same user_id will return a new (different) |
1887 | - * buffer to that user each time. For consistency, |
1888 | - * all callers need to determine their user_id in the |
1889 | - * same way (e.g. always use "this" pointer). |
1890 | + * Return the buffer that should be composited/rendered. |
1891 | */ |
1892 | - virtual std::shared_ptr<Buffer> buffer(void const* user_id) const = 0; |
1893 | + virtual std::shared_ptr<Buffer> buffer() const = 0; |
1894 | |
1895 | virtual bool alpha_enabled() const = 0; |
1896 | virtual geometry::Rectangle screen_position() const = 0; |
1897 | @@ -87,7 +81,6 @@ |
1898 | |
1899 | protected: |
1900 | Renderable() = default; |
1901 | - virtual ~Renderable() = default; |
1902 | Renderable(Renderable const&) = delete; |
1903 | Renderable& operator=(Renderable const&) = delete; |
1904 | }; |
1905 | |
1906 | === added file 'include/platform/mir/graphics/tessellation_helpers.h' |
1907 | --- include/platform/mir/graphics/tessellation_helpers.h 1970-01-01 00:00:00 +0000 |
1908 | +++ include/platform/mir/graphics/tessellation_helpers.h 2014-06-05 12:56:04 +0000 |
1909 | @@ -0,0 +1,31 @@ |
1910 | +/* |
1911 | + * Copyright © 2014 Canonical Ltd. |
1912 | + * |
1913 | + * This program is free software: you can redistribute it and/or modify it |
1914 | + * under the terms of the GNU Lesser General Public License version 3, |
1915 | + * as published by the Free Software Foundation. |
1916 | + * |
1917 | + * This program is distributed in the hope that it will be useful, |
1918 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1919 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1920 | + * GNU Lesser General Public License for more details. |
1921 | + * |
1922 | + * You should have received a copy of the GNU Lesser General Public License |
1923 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1924 | + * |
1925 | + * Authored by: Kevin DuBois <kevin.dubois@canonical.com> |
1926 | + */ |
1927 | + |
1928 | +#ifndef MIR_GRAPHICS_TESSELLATION_HELPERS_H_ |
1929 | +#define MIR_GRAPHICS_TESSELLATION_HELPERS_H_ |
1930 | +#include "mir/graphics/gl_primitive.h" |
1931 | + |
1932 | +namespace mir |
1933 | +{ |
1934 | +namespace graphics |
1935 | +{ |
1936 | +class Renderable; |
1937 | +GLPrimitive tessellate_renderable_into_rectangle(Renderable const& renderable); |
1938 | +} |
1939 | +} |
1940 | +#endif /* MIR_GRAPHICS_TESSELLATION_HELPERS_H_ */ |
1941 | |
1942 | === modified file 'include/server/mir/asio_main_loop.h' |
1943 | --- include/server/mir/asio_main_loop.h 2013-06-28 15:16:39 +0000 |
1944 | +++ include/server/mir/asio_main_loop.h 2014-06-05 12:56:04 +0000 |
1945 | @@ -24,14 +24,23 @@ |
1946 | #include <boost/asio.hpp> |
1947 | #include <memory> |
1948 | #include <vector> |
1949 | +#include <mutex> |
1950 | +#include <utility> |
1951 | +#include <deque> |
1952 | +#include <set> |
1953 | |
1954 | namespace mir |
1955 | { |
1956 | |
1957 | +namespace time |
1958 | +{ |
1959 | +class Clock; |
1960 | +} |
1961 | + |
1962 | class AsioMainLoop : public MainLoop |
1963 | { |
1964 | public: |
1965 | - AsioMainLoop(); |
1966 | + explicit AsioMainLoop(std::shared_ptr<time::Clock> const& clock); |
1967 | ~AsioMainLoop() noexcept(true); |
1968 | |
1969 | void run(); |
1970 | @@ -45,13 +54,28 @@ |
1971 | std::initializer_list<int> fd, |
1972 | std::function<void(int)> const& handler); |
1973 | |
1974 | + std::unique_ptr<time::Alarm> notify_in(std::chrono::milliseconds delay, |
1975 | + std::function<void()> callback) override; |
1976 | + std::unique_ptr<time::Alarm> notify_at(mir::time::Timestamp time_point, |
1977 | + std::function<void()> callback) override; |
1978 | + void enqueue(void const* owner, ServerAction const& action); |
1979 | + void pause_processing_for(void const* owner); |
1980 | + void resume_processing_for(void const* owner); |
1981 | + |
1982 | private: |
1983 | class SignalHandler; |
1984 | class FDHandler; |
1985 | + bool should_process(void const*); |
1986 | + void process_server_actions(); |
1987 | |
1988 | boost::asio::io_service io; |
1989 | + boost::asio::io_service::work work; |
1990 | std::vector<std::unique_ptr<SignalHandler>> signal_handlers; |
1991 | std::vector<std::unique_ptr<FDHandler>> fd_handlers; |
1992 | + std::mutex server_actions_mutex; |
1993 | + std::deque<std::pair<void const*,ServerAction>> server_actions; |
1994 | + std::set<void const*> do_not_process; |
1995 | + std::shared_ptr<time::Clock> const clock; |
1996 | }; |
1997 | |
1998 | } |
1999 | |
2000 | === modified file 'include/server/mir/compositor/gl_renderer.h' |
2001 | --- include/server/mir/compositor/gl_renderer.h 2014-04-24 08:42:12 +0000 |
2002 | +++ include/server/mir/compositor/gl_renderer.h 2014-06-05 12:56:04 +0000 |
2003 | @@ -24,7 +24,9 @@ |
2004 | #include <mir/geometry/rectangle.h> |
2005 | #include <mir/graphics/buffer_id.h> |
2006 | #include <mir/graphics/renderable.h> |
2007 | +#include <mir/graphics/gl_primitive.h> |
2008 | #include <mir/graphics/gl_program_factory.h> |
2009 | +#include <mir/graphics/gl_texture_cache.h> |
2010 | #include <GLES2/gl2.h> |
2011 | #include <unordered_map> |
2012 | #include <unordered_set> |
2013 | @@ -40,32 +42,19 @@ |
2014 | public: |
2015 | GLRenderer( |
2016 | graphics::GLProgramFactory const& program_factory, |
2017 | + std::unique_ptr<graphics::GLTextureCache> && texture_cache, |
2018 | geometry::Rectangle const& display_area); |
2019 | - virtual ~GLRenderer() noexcept; |
2020 | |
2021 | // These are called with a valid GL context: |
2022 | void set_viewport(geometry::Rectangle const& rect) override; |
2023 | void set_rotation(float degrees) override; |
2024 | void begin() const override; |
2025 | - void render(graphics::Renderable const& renderable) const override; |
2026 | + void render(graphics::RenderableList const&) const override; |
2027 | void end() const override; |
2028 | |
2029 | // This is called _without_ a GL context: |
2030 | void suspend() override; |
2031 | |
2032 | - struct Vertex |
2033 | - { |
2034 | - GLfloat position[3]; |
2035 | - GLfloat texcoord[2]; |
2036 | - }; |
2037 | - |
2038 | - struct Primitive |
2039 | - { |
2040 | - GLenum type; // GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN, GL_TRIANGLES etc |
2041 | - GLuint tex_id; // GL texture ID (or 0 to represent the surface itself) |
2042 | - std::vector<Vertex> vertices; |
2043 | - }; |
2044 | - |
2045 | /** |
2046 | * tessellate defines the list of triangles that will be used to render |
2047 | * the surface. By default it just returns 4 vertices for a rectangle. |
2048 | @@ -75,11 +64,6 @@ |
2049 | * \param [in,out] primitives The list of rendering primitives to be |
2050 | * grown and/or modified. |
2051 | * \param [in] renderable The renderable surface being tessellated. |
2052 | - * \param [in] buf_size The dimensions of the buffer being rendered, |
2053 | - * which can be particularly useful in |
2054 | - * calculating texcoords for a surface being |
2055 | - * actively resized (as the buf_size doesn't |
2056 | - * yet match renderable.size()). |
2057 | * |
2058 | * \note The cohesion of this function to GLRenderer is quite loose and it |
2059 | * does not strictly need to reside here. |
2060 | @@ -87,21 +71,13 @@ |
2061 | * the only OpenGL-specific class in the display server, and |
2062 | * tessellation is very much OpenGL-specific. |
2063 | */ |
2064 | - virtual void tessellate(std::vector<Primitive>& primitives, |
2065 | - graphics::Renderable const& renderable, |
2066 | - geometry::Size const& buf_size) const; |
2067 | - |
2068 | - /** |
2069 | - * Load the texture for a surface any which way you like. The default |
2070 | - * implementation does so with efficient GPU-side caching built in. |
2071 | - * |
2072 | - * \returns The OpenGL texture name for the surface. |
2073 | - */ |
2074 | - virtual GLuint load_texture(graphics::Renderable const& renderable, |
2075 | - graphics::Buffer& buffer) const; |
2076 | - |
2077 | + virtual void tessellate(std::vector<graphics::GLPrimitive>& primitives, |
2078 | + graphics::Renderable const& renderable) const; |
2079 | + |
2080 | + virtual void render(graphics::Renderable const& renderable) const; |
2081 | private: |
2082 | std::unique_ptr<graphics::GLProgram> program; |
2083 | + std::unique_ptr<graphics::GLTextureCache> mutable texture_cache; |
2084 | GLuint position_attr_loc; |
2085 | GLuint texcoord_attr_loc; |
2086 | GLuint centre_uniform_loc; |
2087 | @@ -111,17 +87,6 @@ |
2088 | float rotation; |
2089 | |
2090 | geometry::Rectangle viewport; |
2091 | - |
2092 | - struct Texture |
2093 | - { |
2094 | - GLuint id = 0; |
2095 | - graphics::BufferID origin; |
2096 | - bool used; |
2097 | - }; |
2098 | - mutable std::unordered_map<graphics::Renderable::ID, Texture> textures; |
2099 | - mutable std::unordered_set<std::shared_ptr<graphics::Buffer>> saved_resources; |
2100 | - mutable bool skipped = false; |
2101 | - |
2102 | }; |
2103 | |
2104 | } |
2105 | |
2106 | === added file 'include/server/mir/compositor/recently_used_cache.h' |
2107 | --- include/server/mir/compositor/recently_used_cache.h 1970-01-01 00:00:00 +0000 |
2108 | +++ include/server/mir/compositor/recently_used_cache.h 2014-06-05 12:56:04 +0000 |
2109 | @@ -0,0 +1,56 @@ |
2110 | +/* |
2111 | + * Copyright © 2013-2014 Canonical Ltd. |
2112 | + * |
2113 | + * This program is free software: you can redistribute it and/or modify it |
2114 | + * under the terms of the GNU General Public License version 3, |
2115 | + * as published by the Free Software Foundation. |
2116 | + * |
2117 | + * This program is distributed in the hope that it will be useful, |
2118 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2119 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2120 | + * GNU General Public License for more details. |
2121 | + * |
2122 | + * You should have received a copy of the GNU General Public License |
2123 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2124 | + * |
2125 | + * Authored by: Daniel van Vugt <daniel.van.vugt@canonical.com> |
2126 | + * Kevin DuBois <kevin.dubois@canonical.com> |
2127 | + */ |
2128 | + |
2129 | +#ifndef MIR_COMPOSITOR_RECENTLY_USED_CACHE_H_ |
2130 | +#define MIR_COMPOSITOR_RECENTLY_USED_CACHE_H_ |
2131 | + |
2132 | +#include "mir/graphics/gl_texture_cache.h" |
2133 | +#include "mir/graphics/gl_texture.h" |
2134 | +#include "mir/graphics/buffer_id.h" |
2135 | +#include <unordered_map> |
2136 | + |
2137 | +namespace mir |
2138 | +{ |
2139 | +namespace compositor |
2140 | +{ |
2141 | +class RecentlyUsedCache : public graphics::GLTextureCache |
2142 | +{ |
2143 | +public: |
2144 | + std::shared_ptr<graphics::GLTexture> load(graphics::Renderable const& renderable) override; |
2145 | + void invalidate() override; |
2146 | + void drop_unused() override; |
2147 | + |
2148 | +private: |
2149 | + struct Entry |
2150 | + { |
2151 | + Entry() |
2152 | + : texture(std::make_shared<graphics::GLTexture>()) |
2153 | + {} |
2154 | + std::shared_ptr<graphics::GLTexture> texture; |
2155 | + graphics::BufferID last_bound_buffer; |
2156 | + bool used{true}; |
2157 | + std::shared_ptr<graphics::Buffer> resource; |
2158 | + }; |
2159 | + |
2160 | + std::unordered_map<graphics::Renderable::ID, Entry> textures; |
2161 | +}; |
2162 | +} |
2163 | +} |
2164 | + |
2165 | +#endif /* MIR_COMPOSITOR_RECENTLY_USED_CACHE_H_ */ |
2166 | |
2167 | === modified file 'include/server/mir/compositor/renderer.h' |
2168 | --- include/server/mir/compositor/renderer.h 2014-04-09 14:46:52 +0000 |
2169 | +++ include/server/mir/compositor/renderer.h 2014-06-05 12:56:04 +0000 |
2170 | @@ -20,14 +20,12 @@ |
2171 | #define MIR_COMPOSITOR_RENDERER_H_ |
2172 | |
2173 | #include "mir/geometry/rectangle.h" |
2174 | +#include "mir/graphics/renderable.h" |
2175 | |
2176 | namespace mir |
2177 | { |
2178 | -namespace graphics |
2179 | -{ |
2180 | -class Buffer; |
2181 | -class Renderable; |
2182 | -} |
2183 | +namespace graphics { class Buffer; } |
2184 | + |
2185 | namespace compositor |
2186 | { |
2187 | |
2188 | @@ -39,7 +37,7 @@ |
2189 | virtual void set_viewport(geometry::Rectangle const& rect) = 0; |
2190 | virtual void set_rotation(float degrees) = 0; |
2191 | virtual void begin() const = 0; |
2192 | - virtual void render(graphics::Renderable const& renderable) const = 0; |
2193 | + virtual void render(graphics::RenderableList const&) const = 0; |
2194 | virtual void end() const = 0; |
2195 | |
2196 | virtual void suspend() = 0; // called when begin/render/end skipped |
2197 | |
2198 | === modified file 'include/server/mir/compositor/scene.h' |
2199 | --- include/server/mir/compositor/scene.h 2014-04-15 05:31:19 +0000 |
2200 | +++ include/server/mir/compositor/scene.h 2014-06-05 12:56:04 +0000 |
2201 | @@ -27,6 +27,11 @@ |
2202 | |
2203 | namespace mir |
2204 | { |
2205 | +namespace scene |
2206 | +{ |
2207 | +class Observer; |
2208 | +} |
2209 | + |
2210 | namespace compositor |
2211 | { |
2212 | |
2213 | @@ -37,19 +42,20 @@ |
2214 | |
2215 | /** |
2216 | * Generate a valid list of renderables based on the current state of the Scene. |
2217 | - * \returns a list of mg::Renderables. The list is in stacking order from back to front. |
2218 | + * \param [in] id An arbitrary unique identifier used to distinguish |
2219 | + * separate compositors which need to receive a list |
2220 | + * for rendering. Calling with the same id will return |
2221 | + * a new (different) list to that user each time. For |
2222 | + * consistency, all callers need to determine their id |
2223 | + * in the same way (e.g. always use "this" pointer). |
2224 | + * \returns a list of mg::Renderables for the compositor id. The list is in |
2225 | + * stacking order from back to front. |
2226 | */ |
2227 | - virtual graphics::RenderableList generate_renderable_list() const = 0; |
2228 | + typedef void const* CompositorID; |
2229 | + virtual graphics::RenderableList renderable_list_for(CompositorID id) const = 0; |
2230 | |
2231 | - /** |
2232 | - * Sets a callback to be called whenever the state of the |
2233 | - * Scene changes. |
2234 | - * |
2235 | - * The supplied callback should not directly or indirectly (e.g., |
2236 | - * by changing a property of a surface) change the state of |
2237 | - * the Scene, otherwise a deadlock may occur. |
2238 | - */ |
2239 | - virtual void set_change_callback(std::function<void()> const& f) = 0; |
2240 | + virtual void add_observer(std::shared_ptr<scene::Observer> const& observer) = 0; |
2241 | + virtual void remove_observer(std::weak_ptr<scene::Observer> const& observer) = 0; |
2242 | |
2243 | protected: |
2244 | Scene() = default; |
2245 | |
2246 | === modified file 'include/server/mir/default_server_configuration.h' |
2247 | --- include/server/mir/default_server_configuration.h 2014-04-24 08:42:12 +0000 |
2248 | +++ include/server/mir/default_server_configuration.h 2014-06-05 12:56:04 +0000 |
2249 | @@ -24,8 +24,18 @@ |
2250 | #include <memory> |
2251 | #include <string> |
2252 | |
2253 | +namespace android |
2254 | +{ |
2255 | +class InputDispatcherInterface; |
2256 | +class InputDispatcherPolicyInterface; |
2257 | +} |
2258 | + |
2259 | +namespace droidinput = android; |
2260 | + |
2261 | namespace mir |
2262 | { |
2263 | +class ServerActionQueue; |
2264 | + |
2265 | namespace compositor |
2266 | { |
2267 | class Renderer; |
2268 | @@ -43,7 +53,7 @@ |
2269 | class Connector; |
2270 | class ConnectorReport; |
2271 | class ProtobufIpcFactory; |
2272 | -class SessionCreator; |
2273 | +class ConnectionCreator; |
2274 | class SessionMediatorReport; |
2275 | class MessageProcessorReport; |
2276 | class SessionAuthorizer; |
2277 | @@ -75,13 +85,12 @@ |
2278 | class SessionEventSink; |
2279 | class SessionEventHandlerRegister; |
2280 | class SessionListener; |
2281 | -class SessionManager; |
2282 | +class SessionCoordinator; |
2283 | class SnapshotStrategy; |
2284 | class SurfaceCoordinator; |
2285 | class SurfaceConfigurator; |
2286 | class SurfaceStackModel; |
2287 | class SurfaceStack; |
2288 | -class InputRegistrar; |
2289 | class SceneReport; |
2290 | } |
2291 | namespace graphics |
2292 | @@ -91,6 +100,9 @@ |
2293 | class BufferInitializer; |
2294 | class DisplayReport; |
2295 | class GraphicBufferAllocator; |
2296 | +class Cursor; |
2297 | +class CursorImage; |
2298 | +class CursorImages; |
2299 | class GLConfig; |
2300 | class GLProgramFactory; |
2301 | namespace nested { class HostConnection; } |
2302 | @@ -98,6 +110,7 @@ |
2303 | namespace input |
2304 | { |
2305 | class InputReport; |
2306 | +class InputTargets; |
2307 | class InputManager; |
2308 | class CompositeEventFilter; |
2309 | class InputChannelFactory; |
2310 | @@ -106,6 +119,11 @@ |
2311 | class InputRegion; |
2312 | class NestedInputRelay; |
2313 | class EventHandler; |
2314 | +namespace android |
2315 | +{ |
2316 | +class InputRegistrar; |
2317 | +class InputThread; |
2318 | +} |
2319 | } |
2320 | |
2321 | namespace logging |
2322 | @@ -142,6 +160,8 @@ |
2323 | virtual std::shared_ptr<DisplayChanger> the_display_changer(); |
2324 | virtual std::shared_ptr<graphics::Platform> the_graphics_platform(); |
2325 | virtual std::shared_ptr<input::InputConfiguration> the_input_configuration(); |
2326 | + virtual std::shared_ptr<input::InputDispatcher> the_input_dispatcher(); |
2327 | + virtual std::shared_ptr<EmergencyCleanup> the_emergency_cleanup(); |
2328 | /** @} */ |
2329 | |
2330 | /** @name graphics configuration - customization |
2331 | @@ -151,7 +171,6 @@ |
2332 | virtual std::shared_ptr<compositor::RendererFactory> the_renderer_factory(); |
2333 | virtual std::shared_ptr<graphics::DisplayConfigurationPolicy> the_display_configuration_policy(); |
2334 | virtual std::shared_ptr<graphics::nested::HostConnection> the_host_connection(); |
2335 | - virtual std::shared_ptr<input::EventFilter> the_nested_event_filter(); |
2336 | virtual std::shared_ptr<graphics::GLConfig> the_gl_config(); |
2337 | /** @} */ |
2338 | |
2339 | @@ -159,6 +178,10 @@ |
2340 | * dependencies of graphics on the rest of the Mir |
2341 | * @{ */ |
2342 | virtual std::shared_ptr<graphics::DisplayReport> the_display_report(); |
2343 | + virtual std::shared_ptr<graphics::Cursor> the_cursor(); |
2344 | + virtual std::shared_ptr<graphics::CursorImage> the_default_cursor_image(); |
2345 | + virtual std::shared_ptr<graphics::CursorImages> the_cursor_images(); |
2346 | + |
2347 | /** @} */ |
2348 | |
2349 | /** @name compositor configuration - customization |
2350 | @@ -181,6 +204,8 @@ |
2351 | virtual std::shared_ptr<frontend::SessionMediatorReport> the_session_mediator_report(); |
2352 | virtual std::shared_ptr<frontend::MessageProcessorReport> the_message_processor_report(); |
2353 | virtual std::shared_ptr<frontend::SessionAuthorizer> the_session_authorizer(); |
2354 | + // TODO clients should customize the_session_coordinator() instead of the_frontend_shell(); |
2355 | + // TODO once the_session_coordinator() has landed and clients updated this should become non-virtual |
2356 | virtual std::shared_ptr<frontend::Shell> the_frontend_shell(); |
2357 | virtual std::shared_ptr<frontend::EventSink> the_global_event_sink(); |
2358 | virtual std::shared_ptr<frontend::DisplayChanger> the_frontend_display_changer(); |
2359 | @@ -188,11 +213,13 @@ |
2360 | /** @name frontend configuration - internal dependencies |
2361 | * internal dependencies of frontend |
2362 | * @{ */ |
2363 | - virtual std::shared_ptr<frontend::SessionCreator> the_session_creator(); |
2364 | + virtual std::shared_ptr<frontend::ConnectionCreator> the_connection_creator(); |
2365 | virtual std::shared_ptr<frontend::ConnectorReport> the_connector_report(); |
2366 | /** @} */ |
2367 | /** @} */ |
2368 | |
2369 | + // TODO clients should customize the_session_coordinator() instead of the_focus_controller(); |
2370 | + // TODO once the_session_coordinator() has landed and clients updated this should become non-virtual |
2371 | virtual std::shared_ptr<shell::FocusController> the_focus_controller(); |
2372 | |
2373 | /** @name shell configuration - customization |
2374 | @@ -224,6 +251,7 @@ |
2375 | * @{ */ |
2376 | virtual std::shared_ptr<scene::BufferStreamFactory> the_buffer_stream_factory(); |
2377 | virtual std::shared_ptr<scene::SceneReport> the_scene_report(); |
2378 | + virtual std::shared_ptr<scene::SessionCoordinator> the_session_coordinator(); |
2379 | /** @} */ |
2380 | |
2381 | |
2382 | @@ -231,8 +259,8 @@ |
2383 | * @{ */ |
2384 | virtual std::shared_ptr<input::InputReport> the_input_report(); |
2385 | virtual std::shared_ptr<input::CompositeEventFilter> the_composite_event_filter(); |
2386 | - virtual std::shared_ptr<scene::InputRegistrar> the_input_registrar(); |
2387 | virtual std::shared_ptr<shell::InputTargeter> the_input_targeter(); |
2388 | + virtual std::shared_ptr<input::InputTargets> the_input_targets(); |
2389 | virtual std::shared_ptr<input::CursorListener> the_cursor_listener(); |
2390 | virtual std::shared_ptr<input::InputRegion> the_input_region(); |
2391 | /** @} */ |
2392 | @@ -244,6 +272,7 @@ |
2393 | /** @} */ |
2394 | |
2395 | virtual std::shared_ptr<time::Clock> the_clock(); |
2396 | + virtual std::shared_ptr<ServerActionQueue> the_server_action_queue(); |
2397 | |
2398 | protected: |
2399 | std::shared_ptr<options::Option> the_options() const; |
2400 | @@ -255,6 +284,29 @@ |
2401 | std::shared_ptr<frontend::Shell> const& shell, |
2402 | std::shared_ptr<graphics::GraphicBufferAllocator> const& allocator); |
2403 | |
2404 | + /** @name input dispatcher related configuration |
2405 | + * @{ */ |
2406 | + virtual std::shared_ptr<input::android::InputRegistrar> the_input_registrar(); |
2407 | + virtual std::shared_ptr<droidinput::InputDispatcherInterface> the_android_input_dispatcher(); |
2408 | + virtual std::shared_ptr<input::android::InputThread> the_dispatcher_thread(); |
2409 | + virtual std::shared_ptr<droidinput::InputDispatcherPolicyInterface> the_dispatcher_policy(); |
2410 | + virtual bool is_key_repeat_enabled() const; |
2411 | + /** @} */ |
2412 | + |
2413 | + /** @Convenience wrapper functions |
2414 | + * @{ */ |
2415 | + virtual std::shared_ptr<scene::SurfaceCoordinator> wrap_surface_coordinator( |
2416 | + std::shared_ptr<scene::SurfaceCoordinator> const& wrapped); |
2417 | + |
2418 | + virtual std::shared_ptr<scene::SessionCoordinator> wrap_session_coordinator( |
2419 | + std::shared_ptr<scene::SessionCoordinator> const& wrapped); |
2420 | +/** @} */ |
2421 | + |
2422 | + CachedPtr<input::android::InputRegistrar> input_registrar; |
2423 | + CachedPtr<input::android::InputThread> dispatcher_thread; |
2424 | + CachedPtr<droidinput::InputDispatcherInterface> android_input_dispatcher; |
2425 | + CachedPtr<droidinput::InputDispatcherPolicyInterface> android_dispatcher_policy; |
2426 | + |
2427 | CachedPtr<frontend::Connector> connector; |
2428 | |
2429 | CachedPtr<input::InputConfiguration> input_configuration; |
2430 | @@ -262,14 +314,17 @@ |
2431 | CachedPtr<input::InputReport> input_report; |
2432 | CachedPtr<input::CompositeEventFilter> composite_event_filter; |
2433 | CachedPtr<input::InputManager> input_manager; |
2434 | + CachedPtr<input::InputDispatcher> input_dispatcher; |
2435 | CachedPtr<input::InputRegion> input_region; |
2436 | - CachedPtr<scene::InputRegistrar> input_registrar; |
2437 | CachedPtr<shell::InputTargeter> input_targeter; |
2438 | CachedPtr<input::CursorListener> cursor_listener; |
2439 | CachedPtr<graphics::Platform> graphics_platform; |
2440 | CachedPtr<graphics::BufferInitializer> buffer_initializer; |
2441 | CachedPtr<graphics::GraphicBufferAllocator> buffer_allocator; |
2442 | CachedPtr<graphics::Display> display; |
2443 | + CachedPtr<graphics::Cursor> cursor; |
2444 | + CachedPtr<graphics::CursorImage> default_cursor_image; |
2445 | + CachedPtr<graphics::CursorImages> cursor_images; |
2446 | |
2447 | CachedPtr<frontend::ConnectorReport> connector_report; |
2448 | CachedPtr<frontend::ProtobufIpcFactory> ipc_factory; |
2449 | @@ -277,7 +332,7 @@ |
2450 | CachedPtr<frontend::MessageProcessorReport> message_processor_report; |
2451 | CachedPtr<frontend::SessionAuthorizer> session_authorizer; |
2452 | CachedPtr<frontend::EventSink> global_event_sink; |
2453 | - CachedPtr<frontend::SessionCreator> session_creator; |
2454 | + CachedPtr<frontend::ConnectionCreator> connection_creator; |
2455 | CachedPtr<frontend::Screencast> screencast; |
2456 | CachedPtr<compositor::RendererFactory> renderer_factory; |
2457 | CachedPtr<compositor::BufferStreamFactory> buffer_stream_factory; |
2458 | @@ -307,6 +362,8 @@ |
2459 | CachedPtr<scene::MediatingDisplayChanger> mediating_display_changer; |
2460 | CachedPtr<graphics::GLProgramFactory> gl_program_factory; |
2461 | CachedPtr<graphics::GLConfig> gl_config; |
2462 | + CachedPtr<scene::SessionCoordinator> session_coordinator; |
2463 | + CachedPtr<EmergencyCleanup> emergency_cleanup; |
2464 | |
2465 | private: |
2466 | std::shared_ptr<options::Configuration> const configuration_options; |
2467 | @@ -317,12 +374,8 @@ |
2468 | // The following caches and factory functions are internal to the |
2469 | // default implementations of corresponding the Mir components |
2470 | CachedPtr<scene::BroadcastingSessionEventSink> broadcasting_session_event_sink; |
2471 | - CachedPtr<input::NestedInputRelay> nested_input_relay; |
2472 | - CachedPtr<scene::SessionManager> session_manager; |
2473 | |
2474 | std::shared_ptr<scene::BroadcastingSessionEventSink> the_broadcasting_session_event_sink(); |
2475 | - std::shared_ptr<input::NestedInputRelay> the_nested_input_relay(); |
2476 | - std::shared_ptr<scene::SessionManager> the_session_manager(); |
2477 | |
2478 | auto report_factory(char const* report_opt) -> std::unique_ptr<report::ReportFactory>; |
2479 | }; |
2480 | |
2481 | === modified file 'include/server/mir/display_changer.h' |
2482 | --- include/server/mir/display_changer.h 2013-08-13 13:54:24 +0000 |
2483 | +++ include/server/mir/display_changer.h 2014-06-05 12:56:04 +0000 |
2484 | @@ -39,6 +39,9 @@ |
2485 | std::shared_ptr<graphics::DisplayConfiguration> const& conf, |
2486 | SystemStateHandling pause_resume_system) = 0; |
2487 | |
2488 | + virtual void pause_display_config_processing() = 0; |
2489 | + virtual void resume_display_config_processing() = 0; |
2490 | + |
2491 | protected: |
2492 | DisplayChanger() = default; |
2493 | DisplayChanger(DisplayChanger const&) = delete; |
2494 | |
2495 | === added file 'include/server/mir/emergency_cleanup.h' |
2496 | --- include/server/mir/emergency_cleanup.h 1970-01-01 00:00:00 +0000 |
2497 | +++ include/server/mir/emergency_cleanup.h 2014-06-05 12:56:04 +0000 |
2498 | @@ -0,0 +1,35 @@ |
2499 | +/* |
2500 | + * Copyright © 2014 Canonical Ltd. |
2501 | + * |
2502 | + * This program is free software: you can redistribute it and/or modify it |
2503 | + * under the terms of the GNU General Public License version 3, |
2504 | + * as published by the Free Software Foundation. |
2505 | + * |
2506 | + * This program is distributed in the hope that it will be useful, |
2507 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2508 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2509 | + * GNU General Public License for more details. |
2510 | + * |
2511 | + * You should have received a copy of the GNU General Public License |
2512 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2513 | + * |
2514 | + * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com> |
2515 | + */ |
2516 | + |
2517 | +#ifndef MIR_EMERGENCY_CLEANUP_H_ |
2518 | +#define MIR_EMERGENCY_CLEANUP_H_ |
2519 | + |
2520 | +#include "mir/emergency_cleanup_registry.h" |
2521 | + |
2522 | +namespace mir |
2523 | +{ |
2524 | + |
2525 | +class EmergencyCleanup : public EmergencyCleanupRegistry |
2526 | +{ |
2527 | +public: |
2528 | + virtual void operator()() const = 0; |
2529 | +}; |
2530 | + |
2531 | +} |
2532 | + |
2533 | +#endif /* MIR_EMERGENCY_CLEANUP_H_ */ |
2534 | |
2535 | === added file 'include/server/mir/frontend/connection_context.h' |
2536 | --- include/server/mir/frontend/connection_context.h 1970-01-01 00:00:00 +0000 |
2537 | +++ include/server/mir/frontend/connection_context.h 2014-06-05 12:56:04 +0000 |
2538 | @@ -0,0 +1,52 @@ |
2539 | +/* |
2540 | + * Copyright © 2014 Canonical Ltd. |
2541 | + * |
2542 | + * This program is free software: you can redistribute it and/or modify it |
2543 | + * under the terms of the GNU General Public License version 3, |
2544 | + * as published by the Free Software Foundation. |
2545 | + * |
2546 | + * This program is distributed in the hope that it will be useful, |
2547 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2548 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2549 | + * GNU General Public License for more details. |
2550 | + * |
2551 | + * You should have received a copy of the GNU General Public License |
2552 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2553 | + * |
2554 | + * Authored by: Alan Griffiths <alan@octopull.co.uk> |
2555 | + */ |
2556 | + |
2557 | +#ifndef MIR_FRONTEND_CONNECTION_CONTEXT_H_ |
2558 | +#define MIR_FRONTEND_CONNECTION_CONTEXT_H_ |
2559 | + |
2560 | +#include <functional> |
2561 | +#include <memory> |
2562 | + |
2563 | +namespace mir |
2564 | +{ |
2565 | +namespace frontend |
2566 | +{ |
2567 | +class Connector; |
2568 | +class Session; |
2569 | + |
2570 | +class ConnectionContext |
2571 | +{ |
2572 | +public: |
2573 | + ConnectionContext(Connector const* connector) : |
2574 | + ConnectionContext([](std::shared_ptr<Session> const&){}, connector) {} |
2575 | + ConnectionContext( |
2576 | + std::function<void(std::shared_ptr<Session> const& session)> const connect_handler, |
2577 | + Connector const* connector); |
2578 | + |
2579 | + int fd_for_new_client(std::function<void(std::shared_ptr<Session> const& session)> const& connect_handler) const; |
2580 | + |
2581 | + void handle_client_connect(std::shared_ptr<Session> const& session) const { connect_handler(session); } |
2582 | + |
2583 | +private: |
2584 | + std::function<void(std::shared_ptr<Session> const& session)> const connect_handler; |
2585 | + Connector const* const connector; |
2586 | +}; |
2587 | +} |
2588 | +} |
2589 | + |
2590 | +#endif /* MIR_FRONTEND_CONNECTION_CONTEXT_H_ */ |
2591 | |
2592 | === renamed file 'include/server/mir/frontend/session_creator.h' => 'include/server/mir/frontend/connection_creator.h' |
2593 | --- include/server/mir/frontend/session_creator.h 2013-09-24 09:41:04 +0000 |
2594 | +++ include/server/mir/frontend/connection_creator.h 2014-06-05 12:56:04 +0000 |
2595 | @@ -1,5 +1,5 @@ |
2596 | /* |
2597 | - * Copyright © 2013 Canonical Ltd. |
2598 | + * Copyright © 2013-2014 Canonical Ltd. |
2599 | * |
2600 | * This program is free software: you can redistribute it and/or modify it |
2601 | * under the terms of the GNU General Public License version 3, |
2602 | @@ -16,8 +16,8 @@ |
2603 | * Authored by: Alan Griffiths <alan@octopull.co.uk> |
2604 | */ |
2605 | |
2606 | -#ifndef MIR_FRONTEND_SESSION_CREATOR_H_ |
2607 | -#define MIR_FRONTEND_SESSION_CREATOR_H_ |
2608 | +#ifndef MIR_FRONTEND_CONNECTION_CREATOR_H_ |
2609 | +#define MIR_FRONTEND_CONNECTION_CREATOR_H_ |
2610 | |
2611 | #include <boost/asio.hpp> |
2612 | |
2613 | @@ -27,18 +27,22 @@ |
2614 | { |
2615 | namespace frontend |
2616 | { |
2617 | -class SessionCreator |
2618 | +class ConnectionContext; |
2619 | + |
2620 | +class ConnectionCreator |
2621 | { |
2622 | public: |
2623 | - virtual void create_session_for(std::shared_ptr<boost::asio::local::stream_protocol::socket> const& socket) = 0; |
2624 | + virtual void create_connection_for( |
2625 | + std::shared_ptr<boost::asio::local::stream_protocol::socket> const& socket, |
2626 | + ConnectionContext const& connection_context) = 0; |
2627 | |
2628 | protected: |
2629 | - SessionCreator() = default; |
2630 | - virtual ~SessionCreator() noexcept = default; |
2631 | - SessionCreator(SessionCreator const&) = delete; |
2632 | - SessionCreator& operator=(SessionCreator const&) = delete; |
2633 | + ConnectionCreator() = default; |
2634 | + virtual ~ConnectionCreator() noexcept = default; |
2635 | + ConnectionCreator(ConnectionCreator const&) = delete; |
2636 | + ConnectionCreator& operator=(ConnectionCreator const&) = delete; |
2637 | }; |
2638 | } |
2639 | } |
2640 | |
2641 | -#endif /* MIR_FRONTEND_SESSION_CREATOR_H_ */ |
2642 | +#endif /* MIR_FRONTEND_CONNECTION_CREATOR_H_ */ |
2643 | |
2644 | === renamed file 'include/server/mir/frontend/connected_sessions.h' => 'include/server/mir/frontend/connections.h' |
2645 | --- include/server/mir/frontend/connected_sessions.h 2014-03-06 06:05:17 +0000 |
2646 | +++ include/server/mir/frontend/connections.h 2014-06-05 12:56:04 +0000 |
2647 | @@ -1,5 +1,5 @@ |
2648 | /* |
2649 | - * Copyright © 2012 Canonical Ltd. |
2650 | + * Copyright © 2012-2014 Canonical Ltd. |
2651 | * |
2652 | * This program is free software: you can redistribute it and/or modify it |
2653 | * under the terms of the GNU General Public License version 3, |
2654 | @@ -16,8 +16,8 @@ |
2655 | * Authored by: Alan Griffiths <alan@octopull.co.uk> |
2656 | */ |
2657 | |
2658 | -#ifndef MIR_FRONTEND_CONNECTED_SESSIONS_H_ |
2659 | -#define MIR_FRONTEND_CONNECTED_SESSIONS_H_ |
2660 | +#ifndef MIR_FRONTEND_CONNECTIONS_H_ |
2661 | +#define MIR_FRONTEND_CONNECTIONS_H_ |
2662 | |
2663 | #include <memory> |
2664 | #include <mutex> |
2665 | @@ -29,47 +29,47 @@ |
2666 | { |
2667 | namespace detail |
2668 | { |
2669 | -template<class Session> |
2670 | -class ConnectedSessions |
2671 | +template<class Connection> |
2672 | +class Connections |
2673 | { |
2674 | public: |
2675 | - ConnectedSessions() {} |
2676 | - ~ConnectedSessions() { clear(); } |
2677 | + Connections() {} |
2678 | + ~Connections() { clear(); } |
2679 | |
2680 | - void add(std::shared_ptr<Session> const& session) |
2681 | + void add(std::shared_ptr<Connection> const& connection) |
2682 | { |
2683 | std::unique_lock<std::mutex> lock(mutex); |
2684 | - shell_list[session->id()] = session; |
2685 | + connections[connection->id()] = connection; |
2686 | } |
2687 | |
2688 | void remove(int id) |
2689 | { |
2690 | std::unique_lock<std::mutex> lock(mutex); |
2691 | - shell_list.erase(id); |
2692 | + connections.erase(id); |
2693 | } |
2694 | |
2695 | bool includes(int id) const |
2696 | { |
2697 | std::unique_lock<std::mutex> lock(mutex); |
2698 | - return shell_list.find(id) != shell_list.end(); |
2699 | + return connections.find(id) != connections.end(); |
2700 | } |
2701 | |
2702 | void clear() |
2703 | { |
2704 | std::unique_lock<std::mutex> lock(mutex); |
2705 | - shell_list.clear(); |
2706 | + connections.clear(); |
2707 | } |
2708 | |
2709 | |
2710 | private: |
2711 | - ConnectedSessions(ConnectedSessions const&) = delete; |
2712 | - ConnectedSessions& operator =(ConnectedSessions const&) = delete; |
2713 | + Connections(Connections const&) = delete; |
2714 | + Connections& operator =(Connections const&) = delete; |
2715 | |
2716 | std::mutex mutex; |
2717 | - std::map<int, std::shared_ptr<Session>> shell_list; |
2718 | + std::map<int, std::shared_ptr<Connection>> connections; |
2719 | }; |
2720 | } |
2721 | } |
2722 | } |
2723 | |
2724 | -#endif // MIR_FRONTEND_CONNECTED_SESSIONS_H_ |
2725 | +#endif // MIR_FRONTEND_CONNECTIONS_H_ |
2726 | |
2727 | === modified file 'include/server/mir/frontend/connector.h' |
2728 | --- include/server/mir/frontend/connector.h 2013-10-15 08:53:10 +0000 |
2729 | +++ include/server/mir/frontend/connector.h 2014-06-05 12:56:04 +0000 |
2730 | @@ -1,5 +1,5 @@ |
2731 | /* |
2732 | - * Copyright © 2012 Canonical Ltd. |
2733 | + * Copyright © 2012-2014 Canonical Ltd. |
2734 | * |
2735 | * This program is free software: you can redistribute it and/or modify it |
2736 | * under the terms of the GNU General Public License version 3, |
2737 | @@ -19,10 +19,15 @@ |
2738 | #ifndef MIR_FRONTEND_CONNECTOR_H_ |
2739 | #define MIR_FRONTEND_CONNECTOR_H_ |
2740 | |
2741 | +#include <functional> |
2742 | +#include <memory> |
2743 | + |
2744 | namespace mir |
2745 | { |
2746 | namespace frontend |
2747 | { |
2748 | +class Session; |
2749 | + |
2750 | /// Handle client process connections |
2751 | class Connector |
2752 | { |
2753 | @@ -31,7 +36,8 @@ |
2754 | virtual void stop() = 0; |
2755 | |
2756 | virtual int client_socket_fd() const = 0; |
2757 | - virtual void remove_endpoint() const = 0; |
2758 | + |
2759 | + virtual int client_socket_fd(std::function<void(std::shared_ptr<Session> const& session)> const& connect_handler) const = 0; |
2760 | |
2761 | protected: |
2762 | Connector() = default; |
2763 | |
2764 | === modified file 'include/server/mir/frontend/message_processor.h' |
2765 | --- include/server/mir/frontend/message_processor.h 2014-03-06 06:05:17 +0000 |
2766 | +++ include/server/mir/frontend/message_processor.h 2014-06-05 12:56:04 +0000 |
2767 | @@ -51,6 +51,7 @@ |
2768 | { |
2769 | public: |
2770 | virtual bool dispatch(Invocation const& invocation) = 0; |
2771 | + virtual void client_pid(int pid) = 0; |
2772 | |
2773 | protected: |
2774 | MessageProcessor() = default; |
2775 | |
2776 | === renamed file 'include/server/mir/frontend/protobuf_session_creator.h' => 'include/server/mir/frontend/protobuf_connection_creator.h' |
2777 | --- include/server/mir/frontend/protobuf_session_creator.h 2014-03-06 06:05:17 +0000 |
2778 | +++ include/server/mir/frontend/protobuf_connection_creator.h 2014-06-05 12:56:04 +0000 |
2779 | @@ -1,5 +1,5 @@ |
2780 | /* |
2781 | - * Copyright © 2013 Canonical Ltd. |
2782 | + * Copyright © 2013-2014 Canonical Ltd. |
2783 | * |
2784 | * This program is free software: you can redistribute it and/or modify it |
2785 | * under the terms of the GNU General Public License version 3, |
2786 | @@ -16,17 +16,16 @@ |
2787 | * Authored by: Alan Griffiths <alan@octopull.co.uk> |
2788 | */ |
2789 | |
2790 | -#ifndef MIR_FRONTEND_PROTOBUF_SESSION_CREATOR_H_ |
2791 | -#define MIR_FRONTEND_PROTOBUF_SESSION_CREATOR_H_ |
2792 | +#ifndef MIR_FRONTEND_PROTOBUF_CONNECTION_CREATOR_H_ |
2793 | +#define MIR_FRONTEND_PROTOBUF_CONNECTION_CREATOR_H_ |
2794 | |
2795 | -#include "mir/frontend/session_creator.h" |
2796 | -#include "mir/frontend/connected_sessions.h" |
2797 | +#include "mir/frontend/connection_creator.h" |
2798 | +#include "mir/frontend/connections.h" |
2799 | |
2800 | #include <atomic> |
2801 | |
2802 | namespace mir |
2803 | { |
2804 | -namespace protobuf { class DisplayServer; } |
2805 | namespace frontend |
2806 | { |
2807 | class MessageProcessorReport; |
2808 | @@ -35,25 +34,28 @@ |
2809 | |
2810 | namespace detail |
2811 | { |
2812 | -struct SocketSession; |
2813 | +class DisplayServer; |
2814 | +class SocketConnection; |
2815 | class MessageProcessor; |
2816 | class ProtobufMessageSender; |
2817 | } |
2818 | |
2819 | -class ProtobufSessionCreator : public SessionCreator |
2820 | +class ProtobufConnectionCreator : public ConnectionCreator |
2821 | { |
2822 | public: |
2823 | - ProtobufSessionCreator( |
2824 | + ProtobufConnectionCreator( |
2825 | std::shared_ptr<ProtobufIpcFactory> const& ipc_factory, |
2826 | std::shared_ptr<SessionAuthorizer> const& session_authorizer, |
2827 | std::shared_ptr<MessageProcessorReport> const& report); |
2828 | - ~ProtobufSessionCreator() noexcept; |
2829 | + ~ProtobufConnectionCreator() noexcept; |
2830 | |
2831 | - void create_session_for(std::shared_ptr<boost::asio::local::stream_protocol::socket> const& socket); |
2832 | + void create_connection_for( |
2833 | + std::shared_ptr<boost::asio::local::stream_protocol::socket> const& socket, |
2834 | + ConnectionContext const& connection_context) override; |
2835 | |
2836 | virtual std::shared_ptr<detail::MessageProcessor> create_processor( |
2837 | std::shared_ptr<detail::ProtobufMessageSender> const& sender, |
2838 | - std::shared_ptr<protobuf::DisplayServer> const& display_server, |
2839 | + std::shared_ptr<detail::DisplayServer> const& display_server, |
2840 | std::shared_ptr<MessageProcessorReport> const& report) const; |
2841 | |
2842 | private: |
2843 | @@ -63,9 +65,9 @@ |
2844 | std::shared_ptr<SessionAuthorizer> const session_authorizer; |
2845 | std::shared_ptr<MessageProcessorReport> const report; |
2846 | std::atomic<int> next_session_id; |
2847 | - std::shared_ptr<detail::ConnectedSessions<detail::SocketSession>> const connected_sessions; |
2848 | + std::shared_ptr<detail::Connections<detail::SocketConnection>> const connections; |
2849 | }; |
2850 | } |
2851 | } |
2852 | |
2853 | -#endif /* MIR_FRONTEND_PROTOBUF_SESSION_CREATOR_H_ */ |
2854 | +#endif /* MIR_FRONTEND_PROTOBUF_CONNECTION_CREATOR_H_ */ |
2855 | |
2856 | === modified file 'include/server/mir/frontend/session.h' |
2857 | --- include/server/mir/frontend/session.h 2014-04-15 05:31:19 +0000 |
2858 | +++ include/server/mir/frontend/session.h 2014-06-05 12:56:04 +0000 |
2859 | @@ -22,8 +22,6 @@ |
2860 | #include "mir_toolkit/common.h" |
2861 | #include "mir/frontend/surface_id.h" |
2862 | |
2863 | -#include <mutex> |
2864 | -#include <atomic> |
2865 | #include <memory> |
2866 | #include <string> |
2867 | |
2868 | @@ -46,7 +44,7 @@ |
2869 | class Session |
2870 | { |
2871 | public: |
2872 | - virtual ~Session() {} |
2873 | + virtual ~Session() = default; |
2874 | |
2875 | virtual SurfaceId create_surface(scene::SurfaceCreationParameters const& params) = 0; |
2876 | virtual void destroy_surface(SurfaceId surface) = 0; |
2877 | |
2878 | === modified file 'include/server/mir/frontend/session_authorizer.h' |
2879 | --- include/server/mir/frontend/session_authorizer.h 2014-03-26 05:48:59 +0000 |
2880 | +++ include/server/mir/frontend/session_authorizer.h 2014-06-05 12:56:04 +0000 |
2881 | @@ -1,5 +1,5 @@ |
2882 | /* |
2883 | - * Copyright © 2013 Canonical Ltd. |
2884 | + * Copyright © 2013-2014 Canonical Ltd. |
2885 | * |
2886 | * This program is free software: you can redistribute it and/or modify it |
2887 | * under the terms of the GNU General Public License version 3, |
2888 | @@ -19,21 +19,23 @@ |
2889 | #ifndef MIR_FRONTEND_SESSION_AUTHORIZER_H_ |
2890 | #define MIR_FRONTEND_SESSION_AUTHORIZER_H_ |
2891 | |
2892 | -#include <sys/types.h> |
2893 | + |
2894 | |
2895 | namespace mir |
2896 | { |
2897 | namespace frontend |
2898 | { |
2899 | |
2900 | +class SessionCredentials; |
2901 | + |
2902 | class SessionAuthorizer |
2903 | { |
2904 | public: |
2905 | virtual ~SessionAuthorizer() = default; |
2906 | |
2907 | - virtual bool connection_is_allowed(pid_t pid) = 0; |
2908 | - virtual bool configure_display_is_allowed(pid_t pid) = 0; |
2909 | - virtual bool screencast_is_allowed(pid_t pid) = 0; |
2910 | + virtual bool connection_is_allowed(SessionCredentials const& creds) = 0; |
2911 | + virtual bool configure_display_is_allowed(SessionCredentials const& creds) = 0; |
2912 | + virtual bool screencast_is_allowed(SessionCredentials const& creds) = 0; |
2913 | |
2914 | protected: |
2915 | SessionAuthorizer() = default; |
2916 | |
2917 | === added file 'include/server/mir/frontend/session_credentials.h' |
2918 | --- include/server/mir/frontend/session_credentials.h 1970-01-01 00:00:00 +0000 |
2919 | +++ include/server/mir/frontend/session_credentials.h 2014-06-05 12:56:04 +0000 |
2920 | @@ -0,0 +1,46 @@ |
2921 | +/* |
2922 | + * Copyright © 2014 Canonical Ltd. |
2923 | + * |
2924 | + * This program is free software: you can redistribute it and/or modify it |
2925 | + * under the terms of the GNU General Public License version 3, |
2926 | + * as published by the Free Software Foundation. |
2927 | + * |
2928 | + * This program is distributed in the hope that it will be useful, |
2929 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2930 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2931 | + * GNU General Public License for more details. |
2932 | + * |
2933 | + * You should have received a copy of the GNU General Public License |
2934 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2935 | + * |
2936 | + */ |
2937 | + |
2938 | +#ifndef MIR_FRONTEND_SESSION_CREDENTIALS_ID_H_ |
2939 | +#define MIR_FRONTEND_SESSION_CREDENTIALS_ID_H_ |
2940 | + |
2941 | +#include <sys/types.h> |
2942 | + |
2943 | +namespace mir |
2944 | +{ |
2945 | +namespace frontend |
2946 | +{ |
2947 | +class SessionCredentials |
2948 | +{ |
2949 | +public: |
2950 | + SessionCredentials(pid_t pid, uid_t uid, gid_t gid); |
2951 | + |
2952 | + pid_t pid() const; |
2953 | + uid_t uid() const; |
2954 | + gid_t gid() const; |
2955 | + |
2956 | +private: |
2957 | + SessionCredentials() = delete; |
2958 | + |
2959 | + pid_t the_pid; |
2960 | + uid_t the_uid; |
2961 | + gid_t the_gid; |
2962 | +}; |
2963 | +} |
2964 | +} |
2965 | + |
2966 | +#endif |
2967 | |
2968 | === modified file 'include/server/mir/frontend/surface.h' |
2969 | --- include/server/mir/frontend/surface.h 2014-04-15 05:31:19 +0000 |
2970 | +++ include/server/mir/frontend/surface.h 2014-06-05 12:56:04 +0000 |
2971 | @@ -51,7 +51,8 @@ |
2972 | |
2973 | virtual ~Surface() {} |
2974 | |
2975 | - virtual geometry::Size size() const = 0; |
2976 | + /// Size of the client area of the surface (excluding any decorations) |
2977 | + virtual geometry::Size client_size() const = 0; |
2978 | virtual MirPixelFormat pixel_format() const = 0; |
2979 | |
2980 | virtual void swap_buffers(graphics::Buffer* old_buffer, std::function<void(graphics::Buffer* new_buffer)> complete) = 0; |
2981 | |
2982 | === modified file 'include/server/mir/frontend/template_protobuf_message_processor.h' |
2983 | --- include/server/mir/frontend/template_protobuf_message_processor.h 2014-03-06 06:05:17 +0000 |
2984 | +++ include/server/mir/frontend/template_protobuf_message_processor.h 2014-06-05 12:56:04 +0000 |
2985 | @@ -43,11 +43,11 @@ |
2986 | |
2987 | // Boiler plate for unpacking a parameter message, invoking a server function, and |
2988 | // sending the result message. Assumes the existence of Self::send_response(). |
2989 | -template<class Self, class Server, class ParameterMessage, class ResultMessage> |
2990 | +template<class Self, class Server, class ServerX, class ParameterMessage, class ResultMessage> |
2991 | void invoke( |
2992 | Self* self, |
2993 | Server* server, |
2994 | - void (Server::*function)( |
2995 | + void (ServerX::*function)( |
2996 | ::google::protobuf::RpcController* controller, |
2997 | const ParameterMessage* request, |
2998 | ResultMessage* response, |
2999 | |
3000 | === added file 'include/server/mir/graphics/cursor_images.h' |
3001 | --- include/server/mir/graphics/cursor_images.h 1970-01-01 00:00:00 +0000 |
3002 | +++ include/server/mir/graphics/cursor_images.h 2014-06-05 12:56:04 +0000 |
3003 | @@ -0,0 +1,53 @@ |
3004 | +/* |
3005 | + * Copyright © 2014 Canonical Ltd. |
3006 | + * |
3007 | + * This program is free software: you can redistribute it and/or modify it |
3008 | + * under the terms of the GNU General Public License version 3, |
3009 | + * as published by the Free Software Foundation. |
3010 | + * |
3011 | + * This program is distributed in the hope that it will be useful, |
3012 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3013 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3014 | + * GNU General Public License for more details. |
3015 | + * |
3016 | + * You should have received a copy of the GNU General Public License |
3017 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3018 | + * |
3019 | + * Authored by: Robert Carr <robert.carr@canonical.com> |
3020 | + */ |
3021 | + |
3022 | + |
3023 | +#ifndef MIR_GRAPHICS_CURSOR_LOADER_H_ |
3024 | +#define MIR_GRAPHICS_CURSOR_LOADER_H_ |
3025 | + |
3026 | +#include "mir/geometry/size.h" |
3027 | + |
3028 | +#include <memory> |
3029 | +#include <string> |
3030 | + |
3031 | +namespace mir |
3032 | +{ |
3033 | +namespace graphics |
3034 | +{ |
3035 | +class CursorImage; |
3036 | + |
3037 | +/// CursorImages is used to lookup cursor images. |
3038 | +class CursorImages |
3039 | +{ |
3040 | +public: |
3041 | + virtual ~CursorImages() = default; |
3042 | + |
3043 | + /// Looks up the image for a named cursor. Cursor names |
3044 | + /// follow the XCursor naming conventions. |
3045 | + virtual std::shared_ptr<CursorImage> image(std::string const& cursor_name, |
3046 | + geometry::Size const& size) = 0; |
3047 | + |
3048 | +protected: |
3049 | + CursorImages() = default; |
3050 | + CursorImages(CursorImages const&) = delete; |
3051 | + CursorImages& operator=(CursorImages const&) = delete; |
3052 | +}; |
3053 | +} |
3054 | +} |
3055 | + |
3056 | +#endif /* MIR_GRAPHICS_CURSOR_LOADER_H_ */ |
3057 | |
3058 | === modified file 'include/server/mir/input/android/default_android_input_configuration.h' |
3059 | --- include/server/mir/input/android/default_android_input_configuration.h 2013-09-10 16:42:04 +0000 |
3060 | +++ include/server/mir/input/android/default_android_input_configuration.h 2014-06-05 12:56:04 +0000 |
3061 | @@ -1,5 +1,5 @@ |
3062 | /* |
3063 | - * Copyright © 2013 Canonical Ltd. |
3064 | + * Copyright © 2013-2014 Canonical Ltd. |
3065 | * |
3066 | * This program is free software: you can redistribute it and/or modify it |
3067 | * under the terms of the GNU General Public License version 3, |
3068 | @@ -14,47 +14,72 @@ |
3069 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3070 | * |
3071 | * Authored by: Robert Carr <robert.carr@canonical.com> |
3072 | + * Andreas Pokorny <andreas.pokorny@canonical.com> |
3073 | */ |
3074 | |
3075 | #ifndef MIR_INPUT_ANDROID_DEFAULT_ANDROID_INPUT_CONFIGURATION_H_ |
3076 | #define MIR_INPUT_ANDROID_DEFAULT_ANDROID_INPUT_CONFIGURATION_H_ |
3077 | |
3078 | -#include "mir/input/android/dispatcher_input_configuration.h" |
3079 | +#include "mir/input/input_configuration.h" |
3080 | + |
3081 | +#include "mir/cached_ptr.h" |
3082 | + |
3083 | +namespace android |
3084 | +{ |
3085 | +class InputReaderInterface; |
3086 | +class InputReaderPolicyInterface; |
3087 | +class InputListenerInterface; |
3088 | +class EventHubInterface; |
3089 | +} |
3090 | + |
3091 | +namespace droidinput = android; |
3092 | |
3093 | namespace mir |
3094 | { |
3095 | namespace input |
3096 | { |
3097 | +class InputRegion; |
3098 | +class CursorListener; |
3099 | +class InputReport; |
3100 | +class InputDispatcher; |
3101 | + |
3102 | namespace android |
3103 | { |
3104 | -class DefaultInputConfiguration : public DispatcherInputConfiguration |
3105 | +class InputThread; |
3106 | + |
3107 | +class DefaultInputConfiguration : public mir::input::InputConfiguration |
3108 | { |
3109 | public: |
3110 | - DefaultInputConfiguration(std::shared_ptr<EventFilter> const& event_filter, |
3111 | + DefaultInputConfiguration(std::shared_ptr<input::InputDispatcher> const& dispatcher, |
3112 | std::shared_ptr<input::InputRegion> const& input_region, |
3113 | std::shared_ptr<CursorListener> const& cursor_listener, |
3114 | std::shared_ptr<input::InputReport> const& input_report); |
3115 | virtual ~DefaultInputConfiguration(); |
3116 | |
3117 | - std::shared_ptr<input::InputManager> the_input_manager(); |
3118 | + std::shared_ptr<input::InputChannelFactory> the_input_channel_factory() override; |
3119 | + std::shared_ptr<input::InputManager> the_input_manager() override; |
3120 | |
3121 | protected: |
3122 | - virtual droidinput::sp<droidinput::EventHubInterface> the_event_hub(); |
3123 | - virtual droidinput::sp<droidinput::InputReaderInterface> the_reader(); |
3124 | + virtual std::shared_ptr<droidinput::EventHubInterface> the_event_hub(); |
3125 | + virtual std::shared_ptr<droidinput::InputReaderInterface> the_reader(); |
3126 | + virtual std::shared_ptr<droidinput::InputListenerInterface> the_input_translator(); |
3127 | |
3128 | virtual std::shared_ptr<InputThread> the_reader_thread(); |
3129 | |
3130 | - virtual droidinput::sp<droidinput::InputReaderPolicyInterface> the_reader_policy(); |
3131 | + virtual std::shared_ptr<droidinput::InputReaderPolicyInterface> the_reader_policy(); |
3132 | |
3133 | private: |
3134 | - droidinput::sp<droidinput::InputDispatcherInterface> the_dispatcher() override; |
3135 | - |
3136 | + CachedPtr<input::InputManager> input_manager; |
3137 | CachedPtr<InputThread> reader_thread; |
3138 | |
3139 | - CachedAndroidPtr<droidinput::EventHubInterface> event_hub; |
3140 | - CachedAndroidPtr<droidinput::InputReaderPolicyInterface> reader_policy; |
3141 | - CachedAndroidPtr<droidinput::InputReaderInterface> reader; |
3142 | - CachedAndroidPtr<droidinput::InputDispatcherInterface> dispatcher; |
3143 | + CachedPtr<droidinput::EventHubInterface> event_hub; |
3144 | + CachedPtr<droidinput::InputReaderPolicyInterface> reader_policy; |
3145 | + CachedPtr<droidinput::InputReaderInterface> reader; |
3146 | + |
3147 | + std::shared_ptr<input::InputDispatcher> const input_dispatcher; |
3148 | + std::shared_ptr<input::InputRegion> const input_region; |
3149 | + std::shared_ptr<CursorListener> const cursor_listener; |
3150 | + std::shared_ptr<input::InputReport> const input_report; |
3151 | }; |
3152 | } |
3153 | } |
3154 | |
3155 | === removed file 'include/server/mir/input/android/dispatcher_input_configuration.h' |
3156 | --- include/server/mir/input/android/dispatcher_input_configuration.h 2014-03-06 06:05:17 +0000 |
3157 | +++ include/server/mir/input/android/dispatcher_input_configuration.h 1970-01-01 00:00:00 +0000 |
3158 | @@ -1,129 +0,0 @@ |
3159 | -/* |
3160 | - * Copyright © 2013 Canonical Ltd. |
3161 | - * |
3162 | - * This program is free software: you can redistribute it and/or modify it |
3163 | - * under the terms of the GNU General Public License version 3, |
3164 | - * as published by the Free Software Foundation. |
3165 | - * |
3166 | - * This program is distributed in the hope that it will be useful, |
3167 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3168 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3169 | - * GNU General Public License for more details. |
3170 | - * |
3171 | - * You should have received a copy of the GNU General Public License |
3172 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3173 | - * |
3174 | - * Authored by: Alan Griffiths <alan@octopull.co.uk> |
3175 | - */ |
3176 | - |
3177 | - |
3178 | -#ifndef MIR_INPUT_ANDROID_DISPATCHER_INPUT_CONFIGURATION_H_ |
3179 | -#define MIR_INPUT_ANDROID_DISPATCHER_INPUT_CONFIGURATION_H_ |
3180 | - |
3181 | -#include "mir/input/input_configuration.h" |
3182 | - |
3183 | -#include "mir/cached_ptr.h" |
3184 | - |
3185 | -#include <utils/RefBase.h> |
3186 | -#include <utils/StrongPointer.h> |
3187 | - |
3188 | -#include <functional> |
3189 | - |
3190 | -namespace droidinput = android; |
3191 | - |
3192 | -namespace android |
3193 | -{ |
3194 | -class InputReaderInterface; |
3195 | -class InputReaderPolicyInterface; |
3196 | -class InputDispatcherPolicyInterface; |
3197 | -class InputDispatcherInterface; |
3198 | -class EventHubInterface; |
3199 | -} |
3200 | - |
3201 | -namespace mir |
3202 | -{ |
3203 | -namespace shell |
3204 | -{ |
3205 | -class InputTargeter; |
3206 | -} |
3207 | -namespace input |
3208 | -{ |
3209 | -class EventFilter; |
3210 | -class CursorListener; |
3211 | -class InputReport; |
3212 | -class InputRegion; |
3213 | - |
3214 | -namespace android |
3215 | -{ |
3216 | -class InputRegistrar; |
3217 | -class WindowHandleRepository; |
3218 | -class InputThread; |
3219 | - |
3220 | -template <typename Type> |
3221 | -class CachedAndroidPtr |
3222 | -{ |
3223 | - droidinput::wp<Type> cache; |
3224 | - |
3225 | - CachedAndroidPtr(CachedAndroidPtr const&) = delete; |
3226 | - CachedAndroidPtr& operator=(CachedAndroidPtr const&) = delete; |
3227 | - |
3228 | -public: |
3229 | - CachedAndroidPtr() = default; |
3230 | - |
3231 | - droidinput::sp<Type> operator()(std::function<droidinput::sp<Type>()> make) |
3232 | - { |
3233 | - auto result = cache.promote(); |
3234 | - if (!result.get()) |
3235 | - { |
3236 | - cache = result = make(); |
3237 | - } |
3238 | - return result; |
3239 | - } |
3240 | -}; |
3241 | - |
3242 | -class DispatcherInputConfiguration : public input::InputConfiguration |
3243 | -{ |
3244 | -public: |
3245 | - DispatcherInputConfiguration(std::shared_ptr<EventFilter> const& event_filter, |
3246 | - std::shared_ptr<input::InputRegion> const& input_region, |
3247 | - std::shared_ptr<CursorListener> const& cursor_listener, |
3248 | - std::shared_ptr<input::InputReport> const& input_report); |
3249 | - virtual ~DispatcherInputConfiguration(); |
3250 | - |
3251 | - std::shared_ptr<scene::InputRegistrar> the_input_registrar(); |
3252 | - std::shared_ptr<shell::InputTargeter> the_input_targeter(); |
3253 | - std::shared_ptr<input::InputManager> the_input_manager(); |
3254 | - |
3255 | - void set_input_targets(std::shared_ptr<input::InputTargets> const& targets); |
3256 | - |
3257 | - virtual bool is_key_repeat_enabled(); |
3258 | - |
3259 | -protected: |
3260 | - virtual droidinput::sp<droidinput::InputDispatcherInterface> the_dispatcher() = 0; |
3261 | - |
3262 | - virtual std::shared_ptr<InputThread> the_dispatcher_thread(); |
3263 | - |
3264 | - virtual droidinput::sp<droidinput::InputDispatcherPolicyInterface> the_dispatcher_policy(); |
3265 | - |
3266 | - std::shared_ptr<WindowHandleRepository> the_window_handle_repository(); |
3267 | - |
3268 | - std::shared_ptr<EventFilter> const event_filter; |
3269 | - std::shared_ptr<input::InputRegion> const input_region; |
3270 | - std::shared_ptr<CursorListener> const cursor_listener; |
3271 | - std::shared_ptr<input::InputReport> const input_report; |
3272 | - |
3273 | - CachedPtr<input::InputManager> input_manager; |
3274 | - |
3275 | -private: |
3276 | - CachedPtr<InputThread> dispatcher_thread; |
3277 | - CachedPtr<InputRegistrar> input_registrar; |
3278 | - |
3279 | - CachedPtr<shell::InputTargeter> input_targeter; |
3280 | - |
3281 | - CachedAndroidPtr<droidinput::InputDispatcherPolicyInterface> dispatcher_policy; |
3282 | -}; |
3283 | -} |
3284 | -} |
3285 | -} // namespace mir |
3286 | - |
3287 | -#endif /* MIR_INPUT_ANDROID_DISPATCHER_INPUT_CONFIGURATION_H_ */ |
3288 | |
3289 | === added file 'include/server/mir/input/input_configuration.h' |
3290 | --- include/server/mir/input/input_configuration.h 1970-01-01 00:00:00 +0000 |
3291 | +++ include/server/mir/input/input_configuration.h 2014-06-05 12:56:04 +0000 |
3292 | @@ -0,0 +1,48 @@ |
3293 | +/* |
3294 | + * Copyright © 2014 Canonical Ltd. |
3295 | + * |
3296 | + * This program is free software: you can redistribute it and/or modify it |
3297 | + * under the terms of the GNU General Public License version 3, |
3298 | + * as published by the Free Software Foundation. |
3299 | + * |
3300 | + * This program is distributed in the hope that it will be useful, |
3301 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3302 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3303 | + * GNU General Public License for more details. |
3304 | + * |
3305 | + * You should have received a copy of the GNU General Public License |
3306 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3307 | + * |
3308 | + * Authored by: Andreas Pokorny <andreas.pokorny@canonical.com> |
3309 | + */ |
3310 | + |
3311 | +#ifndef MIR_INPUT_INPUT_CONFIGURATION_H_ |
3312 | +#define MIR_INPUT_INPUT_CONFIGURATION_H_ |
3313 | + |
3314 | +#include <memory> |
3315 | + |
3316 | +namespace mir |
3317 | +{ |
3318 | +namespace input |
3319 | +{ |
3320 | +class InputManager; |
3321 | +class InputChannelFactory; |
3322 | + |
3323 | +class InputConfiguration |
3324 | +{ |
3325 | +public: |
3326 | + virtual ~InputConfiguration() = default; |
3327 | + |
3328 | + virtual std::shared_ptr<InputChannelFactory> the_input_channel_factory() = 0; |
3329 | + virtual std::shared_ptr<InputManager> the_input_manager() = 0; |
3330 | + |
3331 | +protected: |
3332 | + InputConfiguration() = default; |
3333 | + InputConfiguration(InputConfiguration const&) = delete; |
3334 | + InputConfiguration& operator=(InputConfiguration const&) = delete; |
3335 | +}; |
3336 | + |
3337 | +} |
3338 | +} |
3339 | + |
3340 | +#endif |
3341 | |
3342 | === removed file 'include/server/mir/input/input_configuration.h' |
3343 | --- include/server/mir/input/input_configuration.h 2014-03-06 06:05:17 +0000 |
3344 | +++ include/server/mir/input/input_configuration.h 1970-01-01 00:00:00 +0000 |
3345 | @@ -1,58 +0,0 @@ |
3346 | -/* |
3347 | - * Copyright © 2013 Canonical Ltd. |
3348 | - * |
3349 | - * This program is free software: you can redistribute it and/or modify it |
3350 | - * under the terms of the GNU General Public License version 3, |
3351 | - * as published by the Free Software Foundation. |
3352 | - * |
3353 | - * This program is distributed in the hope that it will be useful, |
3354 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3355 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3356 | - * GNU General Public License for more details. |
3357 | - * |
3358 | - * You should have received a copy of the GNU General Public License |
3359 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3360 | - * |
3361 | - * Authored by: Robert Carr <robert.carr@canonical.com> |
3362 | - */ |
3363 | - |
3364 | -#ifndef MIR_INPUT_INPUT_CONFIGURATION_H_ |
3365 | -#define MIR_INPUT_INPUT_CONFIGURATION_H_ |
3366 | - |
3367 | -#include <memory> |
3368 | - |
3369 | -namespace mir |
3370 | -{ |
3371 | -namespace scene |
3372 | -{ |
3373 | -class InputRegistrar; |
3374 | -} |
3375 | -namespace shell |
3376 | -{ |
3377 | -class InputTargeter; |
3378 | -} |
3379 | -namespace input |
3380 | -{ |
3381 | -class InputTargets; |
3382 | -class InputManager; |
3383 | - |
3384 | -class InputConfiguration |
3385 | -{ |
3386 | -public: |
3387 | - virtual ~InputConfiguration() {} |
3388 | - |
3389 | - virtual std::shared_ptr<scene::InputRegistrar> the_input_registrar() = 0; |
3390 | - virtual std::shared_ptr<shell::InputTargeter> the_input_targeter() = 0; |
3391 | - virtual std::shared_ptr<input::InputManager> the_input_manager() = 0; |
3392 | - |
3393 | - virtual void set_input_targets(std::shared_ptr<input::InputTargets> const& targets) = 0; |
3394 | - |
3395 | -protected: |
3396 | - InputConfiguration() = default; |
3397 | - InputConfiguration(InputConfiguration const&) = delete; |
3398 | - InputConfiguration& operator=(InputConfiguration const&) = delete; |
3399 | -}; |
3400 | -} |
3401 | -} // namespace mir |
3402 | - |
3403 | -#endif // MIR_INPUT_INPUT_CONFIGURATION_H_ |
3404 | |
3405 | === added file 'include/server/mir/input/input_dispatcher.h' |
3406 | --- include/server/mir/input/input_dispatcher.h 1970-01-01 00:00:00 +0000 |
3407 | +++ include/server/mir/input/input_dispatcher.h 2014-06-05 12:56:04 +0000 |
3408 | @@ -0,0 +1,58 @@ |
3409 | +/* |
3410 | + * Copyright © 2014 Canonical Ltd. |
3411 | + * |
3412 | + * This program is free software: you can redistribute it and/or modify it |
3413 | + * under the terms of the GNU General Public License version 3, |
3414 | + * as published by the Free Software Foundation. |
3415 | + * |
3416 | + * This program is distributed in the hope that it will be useful, |
3417 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3418 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3419 | + * GNU General Public License for more details. |
3420 | + * |
3421 | + * You should have received a copy of the GNU General Public License |
3422 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3423 | + * |
3424 | + * Authored by: Andreas Pokorny <andreas.pokorny@canonical.com> |
3425 | + */ |
3426 | + |
3427 | +#ifndef MIR_INPUT_INPUT_DISPATCHER_H |
3428 | +#define MIR_INPUT_INPUT_DISPATCHER_H |
3429 | + |
3430 | +#include "mir_toolkit/event.h" |
3431 | + |
3432 | +namespace mir |
3433 | +{ |
3434 | +namespace input |
3435 | +{ |
3436 | + |
3437 | +/*! |
3438 | + * \brief The InputDispatchers role is to decide what should happen with user input events. |
3439 | + * |
3440 | + * It will receive MirEvents with either MirMotionEvent or MirKeyEvent inside. The InputDispatcher |
3441 | + * implementation shall either handle the input without informing any clients or pick a client |
3442 | + * surface and send the event to it. |
3443 | + */ |
3444 | +class InputDispatcher |
3445 | +{ |
3446 | +public: |
3447 | + /*! |
3448 | + * \brief Called when the device configuration changed. |
3449 | + */ |
3450 | + virtual void configuration_changed(nsecs_t when) = 0; |
3451 | + /*! |
3452 | + * \brief Called when the device \a device_id was added removed or was reset |
3453 | + */ |
3454 | + virtual void device_reset(int32_t device_id, nsecs_t when) = 0; |
3455 | + virtual void dispatch(MirEvent const& event) = 0; |
3456 | + virtual void start() = 0; |
3457 | + virtual void stop() = 0; |
3458 | + |
3459 | + virtual ~InputDispatcher() = default; |
3460 | +}; |
3461 | + |
3462 | +} |
3463 | +} |
3464 | + |
3465 | +#endif |
3466 | + |
3467 | |
3468 | === modified file 'include/server/mir/input/input_manager.h' |
3469 | --- include/server/mir/input/input_manager.h 2013-08-28 03:41:48 +0000 |
3470 | +++ include/server/mir/input/input_manager.h 2014-06-05 12:56:04 +0000 |
3471 | @@ -15,29 +15,23 @@ |
3472 | * |
3473 | * Authored by: Robert Carr <robert.carr@canonical.com> |
3474 | * Daniel d'Andradra <daniel.dandrada@canonical.com> |
3475 | + * Andreas Pokorny <andreas.pokorny@canonical.com> |
3476 | */ |
3477 | |
3478 | #ifndef MIR_INPUT_INPUT_MANAGER_H_ |
3479 | #define MIR_INPUT_INPUT_MANAGER_H_ |
3480 | |
3481 | -#include "mir/input/input_channel_factory.h" |
3482 | - |
3483 | -#include <memory> |
3484 | - |
3485 | namespace mir |
3486 | { |
3487 | namespace input |
3488 | { |
3489 | -class InputChannel; |
3490 | |
3491 | -class InputManager : public InputChannelFactory |
3492 | +class InputManager |
3493 | { |
3494 | public: |
3495 | virtual void start() = 0; |
3496 | virtual void stop() = 0; |
3497 | |
3498 | - virtual std::shared_ptr<InputChannel> make_input_channel() = 0; |
3499 | - |
3500 | protected: |
3501 | InputManager() {}; |
3502 | virtual ~InputManager() {} |
3503 | |
3504 | === modified file 'include/server/mir/input/surface.h' |
3505 | --- include/server/mir/input/surface.h 2014-04-24 08:42:12 +0000 |
3506 | +++ include/server/mir/input/surface.h 2014-06-05 12:56:04 +0000 |
3507 | @@ -19,8 +19,9 @@ |
3508 | #ifndef MIR_INPUT_SURFACE_H_ |
3509 | #define MIR_INPUT_SURFACE_H_ |
3510 | |
3511 | -#include "mir/geometry/size.h" |
3512 | #include "mir/geometry/point.h" |
3513 | +#include "mir/geometry/rectangle.h" |
3514 | +#include "mir/input/input_reception_mode.h" |
3515 | |
3516 | #include <string> |
3517 | #include <memory> |
3518 | @@ -35,11 +36,10 @@ |
3519 | { |
3520 | public: |
3521 | virtual std::string name() const = 0; |
3522 | - virtual geometry::Point top_left() const = 0; |
3523 | - virtual geometry::Size size() const = 0; |
3524 | - virtual bool contains(geometry::Point const& point) const = 0; |
3525 | - |
3526 | + virtual geometry::Rectangle input_bounds() const = 0; |
3527 | + virtual bool input_area_contains(geometry::Point const& point) const = 0; |
3528 | virtual std::shared_ptr<input::InputChannel> input_channel() const = 0; |
3529 | + virtual InputReceptionMode reception_mode() const = 0; |
3530 | |
3531 | protected: |
3532 | Surface() = default; |
3533 | |
3534 | === modified file 'include/server/mir/main_loop.h' |
3535 | --- include/server/mir/main_loop.h 2013-08-28 03:41:48 +0000 |
3536 | +++ include/server/mir/main_loop.h 2014-06-05 12:56:04 +0000 |
3537 | @@ -20,11 +20,14 @@ |
3538 | #define MIR_MAIN_LOOP_H_ |
3539 | |
3540 | #include "mir/graphics/event_handler_register.h" |
3541 | +#include "mir/time/timer.h" |
3542 | +#include "mir/server_action_queue.h" |
3543 | |
3544 | namespace mir |
3545 | { |
3546 | |
3547 | -class MainLoop : public graphics::EventHandlerRegister |
3548 | +class MainLoop : public graphics::EventHandlerRegister, public time::Timer, |
3549 | + public ServerActionQueue |
3550 | { |
3551 | public: |
3552 | virtual void run() = 0; |
3553 | |
3554 | === modified file 'include/server/mir/run_mir.h' |
3555 | --- include/server/mir/run_mir.h 2013-04-25 16:52:27 +0000 |
3556 | +++ include/server/mir/run_mir.h 2014-06-05 12:56:04 +0000 |
3557 | @@ -39,6 +39,8 @@ |
3558 | std::function<void(DisplayServer&)> init); |
3559 | |
3560 | void report_exception(std::ostream& out); |
3561 | + |
3562 | +void terminate_with_current_exception(); |
3563 | } |
3564 | |
3565 | |
3566 | |
3567 | === removed file 'include/server/mir/scene/input_registrar.h' |
3568 | --- include/server/mir/scene/input_registrar.h 2014-03-06 06:05:17 +0000 |
3569 | +++ include/server/mir/scene/input_registrar.h 1970-01-01 00:00:00 +0000 |
3570 | @@ -1,59 +0,0 @@ |
3571 | -/* |
3572 | - * Copyright © 2013 Canonical Ltd. |
3573 | - * |
3574 | - * This program is free software: you can redistribute it and/or modify it |
3575 | - * under the terms of the GNU General Public License version 3, |
3576 | - * as published by the Free Software Foundation. |
3577 | - * |
3578 | - * This program is distributed in the hope that it will be useful, |
3579 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3580 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3581 | - * GNU General Public License for more details. |
3582 | - * |
3583 | - * You should have received a copy of the GNU General Public License |
3584 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3585 | - * |
3586 | - * Authored by: Robert Carr <robert.carr@canonical.com> |
3587 | - */ |
3588 | - |
3589 | -#ifndef MIR_SCENE_INPUT_REGISTRAR_H_ |
3590 | -#define MIR_SCENE_INPUT_REGISTRAR_H_ |
3591 | - |
3592 | -#include "mir/input/input_reception_mode.h" |
3593 | - |
3594 | -#include <memory> |
3595 | - |
3596 | -namespace mir |
3597 | -{ |
3598 | -namespace input |
3599 | -{ |
3600 | -class SessionTarget; |
3601 | -class InputChannel; |
3602 | -class Surface; |
3603 | -} |
3604 | - |
3605 | -namespace scene |
3606 | -{ |
3607 | - |
3608 | -/// An interface used to register input targets and take care of input assosciation (i.e. |
3609 | -/// create input channels). |
3610 | -class InputRegistrar |
3611 | -{ |
3612 | -public: |
3613 | - virtual ~InputRegistrar() = default; |
3614 | - |
3615 | - virtual void input_channel_opened(std::shared_ptr<input::InputChannel> const& opened_channel, |
3616 | - std::shared_ptr<input::Surface> const& info, |
3617 | - input::InputReceptionMode input_mode) = 0; |
3618 | - virtual void input_channel_closed(std::shared_ptr<input::InputChannel> const& closed_channel) = 0; |
3619 | - |
3620 | -protected: |
3621 | - InputRegistrar() = default; |
3622 | - InputRegistrar(InputRegistrar const&) = delete; |
3623 | - InputRegistrar& operator=(InputRegistrar const&) = delete; |
3624 | -}; |
3625 | - |
3626 | -} |
3627 | -} // namespace mir |
3628 | - |
3629 | -#endif // MIR_SCENE_INPUT_REGISTRAR_H_ |
3630 | |
3631 | === added file 'include/server/mir/scene/legacy_scene_change_notification.h' |
3632 | --- include/server/mir/scene/legacy_scene_change_notification.h 1970-01-01 00:00:00 +0000 |
3633 | +++ include/server/mir/scene/legacy_scene_change_notification.h 2014-06-05 12:56:04 +0000 |
3634 | @@ -0,0 +1,65 @@ |
3635 | +/* |
3636 | + * Copyright © 2014 Canonical Ltd. |
3637 | + * |
3638 | + * This program is free software: you can redistribute it and/or modify it |
3639 | + * under the terms of the GNU General Public License version 3, |
3640 | + * as published by the Free Software Foundation. |
3641 | + * |
3642 | + * This program is distributed in the hope that it will be useful, |
3643 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3644 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3645 | + * GNU General Public License for more details. |
3646 | + * |
3647 | + * You should have received a copy of the GNU General Public License |
3648 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3649 | + * |
3650 | + * Authored by: Robert Carr <robert.carr@canonical.com> |
3651 | + */ |
3652 | + |
3653 | +#ifndef MIR_SCENE_SIMPLE_OBSERVER_H_ |
3654 | +#define MIR_SCENE_SIMPLE_OBSERVER_H_ |
3655 | + |
3656 | +#include "mir/scene/observer.h" |
3657 | + |
3658 | +#include <functional> |
3659 | +#include <map> |
3660 | +#include <mutex> |
3661 | + |
3662 | +namespace mir |
3663 | +{ |
3664 | +namespace scene |
3665 | +{ |
3666 | +class SurfaceObserver; |
3667 | + |
3668 | +// A simple implementation of surface observer which forwards all changes to a provided callback. |
3669 | +// Also installs surface observers on each added surface which in turn forward each change to |
3670 | +// said callback. |
3671 | +class LegacySceneChangeNotification : public Observer |
3672 | +{ |
3673 | +public: |
3674 | + LegacySceneChangeNotification( |
3675 | + std::function<void()> const& scene_notify_change, |
3676 | + std::function<void(int)> const& buffer_notify_change); |
3677 | + ~LegacySceneChangeNotification(); |
3678 | + |
3679 | + void surface_added(Surface* surface) override; |
3680 | + void surface_removed(Surface* surface) override; |
3681 | + void surfaces_reordered() override; |
3682 | + |
3683 | + void surface_exists(Surface* surface) override; |
3684 | + void end_observation() override; |
3685 | + |
3686 | +private: |
3687 | + std::function<void()> const scene_notify_change; |
3688 | + std::function<void(int)> const buffer_notify_change; |
3689 | + |
3690 | + std::mutex surface_observers_guard; |
3691 | + std::map<Surface*, std::weak_ptr<SurfaceObserver>> surface_observers; |
3692 | + |
3693 | + void add_surface_observer(Surface* surface); |
3694 | +}; |
3695 | + |
3696 | +} |
3697 | +} // namespace mir |
3698 | + |
3699 | +#endif // MIR_SCENE_SIMPLE_OBSERVER_H_ |
3700 | |
3701 | === added file 'include/server/mir/scene/null_observer.h' |
3702 | --- include/server/mir/scene/null_observer.h 1970-01-01 00:00:00 +0000 |
3703 | +++ include/server/mir/scene/null_observer.h 2014-06-05 12:56:04 +0000 |
3704 | @@ -0,0 +1,51 @@ |
3705 | +/* |
3706 | + * Copyright © 2014 Canonical Ltd. |
3707 | + * |
3708 | + * This program is free software: you can redistribute it and/or modify it |
3709 | + * under the terms of the GNU General Public License version 3, |
3710 | + * as published by the Free Software Foundation. |
3711 | + * |
3712 | + * This program is distributed in the hope that it will be useful, |
3713 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3714 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3715 | + * GNU General Public License for more details. |
3716 | + * |
3717 | + * You should have received a copy of the GNU General Public License |
3718 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3719 | + * |
3720 | + * Authored by: Robert Carr <robert.carr@canonical.com> |
3721 | + */ |
3722 | + |
3723 | +#ifndef MIR_SCENE_NULL_OBSERVER_H_ |
3724 | +#define MIR_SCENE_NULL_OBSERVER_H_ |
3725 | + |
3726 | +#include "mir/scene/observer.h" |
3727 | + |
3728 | +namespace mir |
3729 | +{ |
3730 | +namespace scene |
3731 | +{ |
3732 | +class NullObserver : public Observer |
3733 | +{ |
3734 | +public: |
3735 | + NullObserver() = default; |
3736 | + virtual ~NullObserver() = default; |
3737 | + |
3738 | + void surface_added(Surface* surface); |
3739 | + void surface_removed(Surface* surface); |
3740 | + void surfaces_reordered(); |
3741 | + |
3742 | + // Called at observer registration to notify of already existing surfaces. |
3743 | + void surface_exists(Surface* surface); |
3744 | + // Called when observer is unregistered, for example, to provide a place to |
3745 | + // unregister SurfaceObservers which may have been added in surface_added/exists |
3746 | + void end_observation(); |
3747 | + |
3748 | +protected: |
3749 | + NullObserver(NullObserver const&) = delete; |
3750 | + NullObserver& operator=(NullObserver const&) = delete; |
3751 | +}; |
3752 | +} |
3753 | +} // namespace mir |
3754 | + |
3755 | +#endif // MIR_SCENE_NULL_OBSERVER_H_ |
3756 | |
3757 | === added file 'include/server/mir/scene/null_surface_observer.h' |
3758 | --- include/server/mir/scene/null_surface_observer.h 1970-01-01 00:00:00 +0000 |
3759 | +++ include/server/mir/scene/null_surface_observer.h 2014-06-05 12:56:04 +0000 |
3760 | @@ -0,0 +1,50 @@ |
3761 | +/* |
3762 | + * Copyright © 2014 Canonical Ltd. |
3763 | + * |
3764 | + * This program is free software: you can redistribute it and/or modify it |
3765 | + * under the terms of the GNU General Public License version 3, |
3766 | + * as published by the Free Software Foundation. |
3767 | + * |
3768 | + * This program is distributed in the hope that it will be useful, |
3769 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3770 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3771 | + * GNU General Public License for more details. |
3772 | + * |
3773 | + * You should have received a copy of the GNU General Public License |
3774 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3775 | + * |
3776 | + * Authored by: Robert Carr <robert.carr@canonical.com> |
3777 | + */ |
3778 | + |
3779 | +#ifndef MIR_SCENE_NULL_SURFACE_OBSERVER_H_ |
3780 | +#define MIR_SCENE_NULL_SURFACE_OBSERVER_H_ |
3781 | + |
3782 | +#include "mir/scene/surface_observer.h" |
3783 | + |
3784 | +namespace mir |
3785 | +{ |
3786 | +namespace scene |
3787 | +{ |
3788 | +class NullSurfaceObserver : public SurfaceObserver |
3789 | +{ |
3790 | +public: |
3791 | + NullSurfaceObserver() = default; |
3792 | + virtual ~NullSurfaceObserver() = default; |
3793 | + |
3794 | + void attrib_changed(MirSurfaceAttrib attrib, int value); |
3795 | + void resized_to(geometry::Size const& size); |
3796 | + void moved_to(geometry::Point const& top_left); |
3797 | + void hidden_set_to(bool hide); |
3798 | + void frame_posted(int frames_available); |
3799 | + void alpha_set_to(float alpha); |
3800 | + void transformation_set_to(glm::mat4 const& t); |
3801 | + void reception_mode_set_to(input::InputReceptionMode mode); |
3802 | + |
3803 | +protected: |
3804 | + NullSurfaceObserver(NullSurfaceObserver const&) = delete; |
3805 | + NullSurfaceObserver& operator=(NullSurfaceObserver const&) = delete; |
3806 | +}; |
3807 | +} |
3808 | +} |
3809 | + |
3810 | +#endif // MIR_SCENE_NULL_SURFACE_OBSERVER_H_ |
3811 | |
3812 | === added file 'include/server/mir/scene/observer.h' |
3813 | --- include/server/mir/scene/observer.h 1970-01-01 00:00:00 +0000 |
3814 | +++ include/server/mir/scene/observer.h 2014-06-05 12:56:04 +0000 |
3815 | @@ -0,0 +1,56 @@ |
3816 | +/* |
3817 | + * Copyright © 2014 Canonical Ltd. |
3818 | + * |
3819 | + * This program is free software: you can redistribute it and/or modify it |
3820 | + * under the terms of the GNU General Public License version 3, |
3821 | + * as published by the Free Software Foundation. |
3822 | + * |
3823 | + * This program is distributed in the hope that it will be useful, |
3824 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3825 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3826 | + * GNU General Public License for more details. |
3827 | + * |
3828 | + * You should have received a copy of the GNU General Public License |
3829 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3830 | + * |
3831 | + * Authored by: Robert Carr <robert.carr@canonical.com> |
3832 | + */ |
3833 | + |
3834 | +#ifndef MIR_SCENE_OBSERVER_H_ |
3835 | +#define MIR_SCENE_OBSERVER_H_ |
3836 | + |
3837 | +#include <memory> |
3838 | + |
3839 | +namespace mir |
3840 | +{ |
3841 | +namespace scene |
3842 | +{ |
3843 | +class Surface; |
3844 | + |
3845 | +/// An observer for top level notifications of scene changes. In order |
3846 | +/// to receive more granular change notifications a user may install |
3847 | +/// mir::scene::SurfaceObserver in surface_added. |
3848 | +class Observer |
3849 | +{ |
3850 | +public: |
3851 | + virtual void surface_added(Surface* surface) = 0; |
3852 | + virtual void surface_removed(Surface* surface) = 0; |
3853 | + virtual void surfaces_reordered() = 0; |
3854 | + |
3855 | + // Called at observer registration to notify of already existing surfaces. |
3856 | + virtual void surface_exists(Surface* surface) = 0; |
3857 | + // Called when observer is unregistered, for example, to provide a place to |
3858 | + // unregister SurfaceObservers which may have been added in surface_added/exists |
3859 | + virtual void end_observation() = 0; |
3860 | + |
3861 | +protected: |
3862 | + Observer() = default; |
3863 | + virtual ~Observer() = default; |
3864 | + Observer(Observer const&) = delete; |
3865 | + Observer& operator=(Observer const&) = delete; |
3866 | +}; |
3867 | + |
3868 | +} |
3869 | +} // namespace mir |
3870 | + |
3871 | +#endif // MIR_SCENE_OBSERVER_H_ |
3872 | |
3873 | === added file 'include/server/mir/scene/session_coordinator.h' |
3874 | --- include/server/mir/scene/session_coordinator.h 1970-01-01 00:00:00 +0000 |
3875 | +++ include/server/mir/scene/session_coordinator.h 2014-06-05 12:56:04 +0000 |
3876 | @@ -0,0 +1,38 @@ |
3877 | +/* |
3878 | + * Copyright © 2014 Canonical Ltd. |
3879 | + * |
3880 | + * This program is free software: you can redistribute it and/or modify it |
3881 | + * under the terms of the GNU General Public License version 3, |
3882 | + * as published by the Free Software Foundation. |
3883 | + * |
3884 | + * This program is distributed in the hope that it will be useful, |
3885 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3886 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3887 | + * GNU General Public License for more details. |
3888 | + * |
3889 | + * You should have received a copy of the GNU General Public License |
3890 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3891 | + * |
3892 | + * Authored By: Alan Griffiths <alan@octopull.co.uk> |
3893 | + */ |
3894 | + |
3895 | +#ifndef MIR_SCENE_SESSION_COORDINATOR_H_ |
3896 | +#define MIR_SCENE_SESSION_COORDINATOR_H_ |
3897 | + |
3898 | + |
3899 | +#include "mir/frontend/shell.h" |
3900 | +#include "mir/shell/focus_controller.h" |
3901 | + |
3902 | +namespace mir |
3903 | +{ |
3904 | +namespace scene |
3905 | +{ |
3906 | + |
3907 | +class SessionCoordinator : public frontend::Shell, public shell::FocusController |
3908 | +{ |
3909 | +}; |
3910 | + |
3911 | +} |
3912 | +} |
3913 | + |
3914 | +#endif /* MIR_SCENE_SESSION_COORDINATOR_H_ */ |
3915 | |
3916 | === modified file 'include/server/mir/scene/surface.h' |
3917 | --- include/server/mir/scene/surface.h 2014-04-24 08:42:12 +0000 |
3918 | +++ include/server/mir/scene/surface.h 2014-06-05 12:56:04 +0000 |
3919 | @@ -37,19 +37,27 @@ |
3920 | class SurfaceObserver; |
3921 | |
3922 | class Surface : |
3923 | - public graphics::Renderable, |
3924 | public input::Surface, |
3925 | public frontend::Surface, |
3926 | public SurfaceBufferAccess |
3927 | { |
3928 | public: |
3929 | // resolve ambiguous member function names |
3930 | + |
3931 | std::string name() const override = 0; |
3932 | - geometry::Size size() const override = 0; |
3933 | - geometry::Point top_left() const override = 0; |
3934 | - float alpha() const override = 0; |
3935 | + geometry::Size client_size() const override = 0; |
3936 | + geometry::Rectangle input_bounds() const override = 0; |
3937 | |
3938 | // member functions that don't exist in base classes |
3939 | + |
3940 | + /// Top-left corner (of the window frame if present) |
3941 | + virtual geometry::Point top_left() const = 0; |
3942 | + /// Size of the surface including window frame (if any) |
3943 | + virtual geometry::Size size() const = 0; |
3944 | + |
3945 | + virtual std::unique_ptr<graphics::Renderable> compositor_snapshot(void const* compositor_id) const = 0; |
3946 | + |
3947 | + virtual float alpha() const = 0; //only used in examples/ |
3948 | virtual MirSurfaceType type() const = 0; |
3949 | virtual MirSurfaceState state() const = 0; |
3950 | virtual void hide() = 0; |
3951 | @@ -64,11 +72,12 @@ |
3952 | virtual void force_requests_to_complete() = 0; |
3953 | |
3954 | virtual void add_observer(std::shared_ptr<SurfaceObserver> const& observer) = 0; |
3955 | - virtual void remove_observer(std::shared_ptr<SurfaceObserver> const& observer) = 0; |
3956 | + virtual void remove_observer(std::weak_ptr<SurfaceObserver> const& observer) = 0; |
3957 | |
3958 | // TODO input_channel() relates to adding and removing the surface |
3959 | // TODO from the scene and is probably not cleanest interface for this. |
3960 | virtual std::shared_ptr<input::InputChannel> input_channel() const = 0; |
3961 | + virtual void set_reception_mode(input::InputReceptionMode mode) = 0; |
3962 | }; |
3963 | } |
3964 | } |
3965 | |
3966 | === modified file 'include/server/mir/scene/surface_event_source.h' |
3967 | --- include/server/mir/scene/surface_event_source.h 2014-04-15 05:31:19 +0000 |
3968 | +++ include/server/mir/scene/surface_event_source.h 2014-06-05 12:56:04 +0000 |
3969 | @@ -19,7 +19,7 @@ |
3970 | #ifndef MIR_SCENE_SURFACE_EVENT_SOURCE_H_ |
3971 | #define MIR_SCENE_SURFACE_EVENT_SOURCE_H_ |
3972 | |
3973 | -#include "mir/scene/surface_observer.h" |
3974 | +#include "mir/scene/null_surface_observer.h" |
3975 | #include "mir/frontend/surface_id.h" |
3976 | #include "mir/frontend/event_sink.h" |
3977 | |
3978 | @@ -29,15 +29,15 @@ |
3979 | { |
3980 | namespace scene |
3981 | { |
3982 | -class SurfaceEventSource : public SurfaceObserver |
3983 | +class SurfaceEventSource : public NullSurfaceObserver |
3984 | { |
3985 | public: |
3986 | SurfaceEventSource( |
3987 | frontend::SurfaceId id, |
3988 | std::shared_ptr<frontend::EventSink> const& event_sink); |
3989 | |
3990 | - void attrib_changed(MirSurfaceAttrib attrib, int value); |
3991 | - void resized_to(geometry::Size const& size); |
3992 | + void attrib_changed(MirSurfaceAttrib attrib, int value) override; |
3993 | + void resized_to(geometry::Size const& size) override; |
3994 | |
3995 | private: |
3996 | frontend::SurfaceId const id; |
3997 | |
3998 | === modified file 'include/server/mir/scene/surface_observer.h' |
3999 | --- include/server/mir/scene/surface_observer.h 2014-04-15 05:31:19 +0000 |
4000 | +++ include/server/mir/scene/surface_observer.h 2014-06-05 12:56:04 +0000 |
4001 | @@ -21,6 +21,8 @@ |
4002 | |
4003 | #include "mir_toolkit/common.h" |
4004 | |
4005 | +#include "mir/input/input_reception_mode.h" |
4006 | + |
4007 | #include <glm/glm.hpp> |
4008 | |
4009 | namespace mir |
4010 | @@ -36,13 +38,14 @@ |
4011 | class SurfaceObserver |
4012 | { |
4013 | public: |
4014 | - virtual void attrib_changed(MirSurfaceAttrib attrib, int value); |
4015 | - virtual void resized_to(geometry::Size const& size); |
4016 | - virtual void moved_to(geometry::Point const& top_left); |
4017 | - virtual void hidden_set_to(bool hide); |
4018 | - virtual void frame_posted(); |
4019 | - virtual void alpha_set_to(float alpha); |
4020 | - virtual void transformation_set_to(glm::mat4 const& t); |
4021 | + virtual void attrib_changed(MirSurfaceAttrib attrib, int value) = 0; |
4022 | + virtual void resized_to(geometry::Size const& size) = 0; |
4023 | + virtual void moved_to(geometry::Point const& top_left) = 0; |
4024 | + virtual void hidden_set_to(bool hide) = 0; |
4025 | + virtual void frame_posted(int frames_available) = 0; |
4026 | + virtual void alpha_set_to(float alpha) = 0; |
4027 | + virtual void transformation_set_to(glm::mat4 const& t) = 0; |
4028 | + virtual void reception_mode_set_to(input::InputReceptionMode mode) = 0; |
4029 | |
4030 | protected: |
4031 | SurfaceObserver() = default; |
4032 | |
4033 | === added file 'include/server/mir/server_action_queue.h' |
4034 | --- include/server/mir/server_action_queue.h 1970-01-01 00:00:00 +0000 |
4035 | +++ include/server/mir/server_action_queue.h 2014-06-05 12:56:04 +0000 |
4036 | @@ -0,0 +1,46 @@ |
4037 | +/* |
4038 | + * Copyright © 2014 Canonical Ltd. |
4039 | + * |
4040 | + * This program is free software: you can redistribute it and/or modify it |
4041 | + * under the terms of the GNU General Public License version 3, |
4042 | + * as published by the Free Software Foundation. |
4043 | + * |
4044 | + * This program is distributed in the hope that it will be useful, |
4045 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4046 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4047 | + * GNU General Public License for more details. |
4048 | + * |
4049 | + * You should have received a copy of the GNU General Public License |
4050 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
4051 | + * |
4052 | + * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com> |
4053 | + */ |
4054 | + |
4055 | +#ifndef MIR_SERVER_ACTION_QUEUE_H_ |
4056 | +#define MIR_SERVER_ACTION_QUEUE_H_ |
4057 | + |
4058 | +#include <functional> |
4059 | + |
4060 | +namespace mir |
4061 | +{ |
4062 | + |
4063 | +typedef std::function<void()> ServerAction; |
4064 | + |
4065 | +class ServerActionQueue |
4066 | +{ |
4067 | +public: |
4068 | + virtual ~ServerActionQueue() = default; |
4069 | + |
4070 | + virtual void enqueue(void const* owner, ServerAction const& action) = 0; |
4071 | + virtual void pause_processing_for(void const* owner) = 0; |
4072 | + virtual void resume_processing_for(void const* owner) = 0; |
4073 | + |
4074 | +protected: |
4075 | + ServerActionQueue() = default; |
4076 | + ServerActionQueue(ServerActionQueue const&) = delete; |
4077 | + ServerActionQueue& operator=(ServerActionQueue const&) = delete; |
4078 | +}; |
4079 | + |
4080 | +} |
4081 | + |
4082 | +#endif /* MIR_SERVER_ACTION_QUEUE_H_ */ |
4083 | |
4084 | === modified file 'include/server/mir/server_configuration.h' |
4085 | --- include/server/mir/server_configuration.h 2013-10-16 07:34:22 +0000 |
4086 | +++ include/server/mir/server_configuration.h 2014-06-05 12:56:04 +0000 |
4087 | @@ -44,6 +44,7 @@ |
4088 | namespace input |
4089 | { |
4090 | class InputManager; |
4091 | +class InputDispatcher; |
4092 | class EventFilter; |
4093 | class InputConfiguration; |
4094 | } |
4095 | @@ -51,6 +52,7 @@ |
4096 | class MainLoop; |
4097 | class ServerStatusListener; |
4098 | class DisplayChanger; |
4099 | +class EmergencyCleanup; |
4100 | |
4101 | class ServerConfiguration |
4102 | { |
4103 | @@ -61,11 +63,13 @@ |
4104 | virtual std::shared_ptr<graphics::Display> the_display() = 0; |
4105 | virtual std::shared_ptr<compositor::Compositor> the_compositor() = 0; |
4106 | virtual std::shared_ptr<input::InputManager> the_input_manager() = 0; |
4107 | + virtual std::shared_ptr<input::InputDispatcher> the_input_dispatcher() = 0; |
4108 | virtual std::shared_ptr<MainLoop> the_main_loop() = 0; |
4109 | virtual std::shared_ptr<ServerStatusListener> the_server_status_listener() = 0; |
4110 | virtual std::shared_ptr<DisplayChanger> the_display_changer() = 0; |
4111 | virtual std::shared_ptr<graphics::Platform> the_graphics_platform() = 0; |
4112 | virtual std::shared_ptr<input::InputConfiguration> the_input_configuration() = 0; |
4113 | + virtual std::shared_ptr<EmergencyCleanup> the_emergency_cleanup() = 0; |
4114 | |
4115 | protected: |
4116 | ServerConfiguration() = default; |
4117 | |
4118 | === added file 'include/server/mir/shell/session_coordinator_wrapper.h' |
4119 | --- include/server/mir/shell/session_coordinator_wrapper.h 1970-01-01 00:00:00 +0000 |
4120 | +++ include/server/mir/shell/session_coordinator_wrapper.h 2014-06-05 12:56:04 +0000 |
4121 | @@ -0,0 +1,57 @@ |
4122 | +/* |
4123 | + * Copyright © 2014 Canonical Ltd. |
4124 | + * |
4125 | + * This program is free software: you can redistribute it and/or modify it |
4126 | + * under the terms of the GNU General Public License version 3, |
4127 | + * as published by the Free Software Foundation. |
4128 | + * |
4129 | + * This program is distributed in the hope that it will be useful, |
4130 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4131 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4132 | + * GNU General Public License for more details. |
4133 | + * |
4134 | + * You should have received a copy of the GNU General Public License |
4135 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
4136 | + * |
4137 | + * Authored By: Alan Griffiths <alan@octopull.co.uk> |
4138 | + */ |
4139 | + |
4140 | +#ifndef MIR_SHELL_SESSION_COORDINATOR_WRAPPER_H_ |
4141 | +#define MIR_SHELL_SESSION_COORDINATOR_WRAPPER_H_ |
4142 | + |
4143 | + |
4144 | +#include "mir/scene/session_coordinator.h" |
4145 | + |
4146 | +namespace mir |
4147 | +{ |
4148 | +namespace shell |
4149 | +{ |
4150 | +class SessionCoordinatorWrapper : public scene::SessionCoordinator |
4151 | +{ |
4152 | +public: |
4153 | + SessionCoordinatorWrapper(std::shared_ptr<scene::SessionCoordinator> const& wrapped); |
4154 | + |
4155 | + virtual std::shared_ptr<frontend::Session> open_session( |
4156 | + pid_t client_pid, |
4157 | + std::string const& name, |
4158 | + std::shared_ptr<frontend::EventSink> const& sink) override; |
4159 | + |
4160 | + virtual void close_session(std::shared_ptr<frontend::Session> const& session) override; |
4161 | + |
4162 | + frontend::SurfaceId create_surface_for( |
4163 | + std::shared_ptr<frontend::Session> const& session, |
4164 | + scene::SurfaceCreationParameters const& params) override; |
4165 | + |
4166 | + void focus_next() override; |
4167 | + std::weak_ptr<scene::Session> focussed_application() const; |
4168 | + void set_focus_to(std::shared_ptr<scene::Session> const& focus) override; |
4169 | + |
4170 | + void handle_surface_created(std::shared_ptr<frontend::Session> const& session) override; |
4171 | + |
4172 | +protected: |
4173 | + std::shared_ptr<scene::SessionCoordinator> const wrapped; |
4174 | +}; |
4175 | +} |
4176 | +} |
4177 | + |
4178 | +#endif /* MIR_SHELL_SESSION_COORDINATOR_WRAPPER_H_ */ |
4179 | |
4180 | === added file 'include/server/mir/shell/surface_coordinator_wrapper.h' |
4181 | --- include/server/mir/shell/surface_coordinator_wrapper.h 1970-01-01 00:00:00 +0000 |
4182 | +++ include/server/mir/shell/surface_coordinator_wrapper.h 2014-06-05 12:56:04 +0000 |
4183 | @@ -0,0 +1,47 @@ |
4184 | +/* |
4185 | + * Copyright © 2014 Canonical Ltd. |
4186 | + * |
4187 | + * This program is free software: you can redistribute it and/or modify it |
4188 | + * under the terms of the GNU General Public License version 3, |
4189 | + * as published by the Free Software Foundation. |
4190 | + * |
4191 | + * This program is distributed in the hope that it will be useful, |
4192 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4193 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4194 | + * GNU General Public License for more details. |
4195 | + * |
4196 | + * You should have received a copy of the GNU General Public License |
4197 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
4198 | + * |
4199 | + * Authored By: Alan Griffiths <alan@octopull.co.uk> |
4200 | + */ |
4201 | + |
4202 | +#ifndef MIR_SHELL_SURFACE_COORDINATOR_WRAPPER_H_ |
4203 | +#define MIR_SHELL_SURFACE_COORDINATOR_WRAPPER_H_ |
4204 | + |
4205 | +#include "mir/scene/surface_coordinator.h" |
4206 | + |
4207 | +namespace mir |
4208 | +{ |
4209 | +namespace shell |
4210 | +{ |
4211 | +class SurfaceCoordinatorWrapper : public scene::SurfaceCoordinator |
4212 | +{ |
4213 | +public: |
4214 | + explicit SurfaceCoordinatorWrapper(std::shared_ptr<scene::SurfaceCoordinator> const& wrapped); |
4215 | + |
4216 | + std::shared_ptr<scene::Surface> add_surface( |
4217 | + scene::SurfaceCreationParameters const& params, |
4218 | + scene::Session* session) override; |
4219 | + |
4220 | + void raise(std::weak_ptr<scene::Surface> const& surface) override; |
4221 | + |
4222 | + void remove_surface(std::weak_ptr<scene::Surface> const& surface) override; |
4223 | + |
4224 | +protected: |
4225 | + std::shared_ptr<SurfaceCoordinator> const wrapped; |
4226 | +}; |
4227 | +} |
4228 | +} |
4229 | + |
4230 | +#endif /* MIR_SHELL_SURFACE_COORDINATOR_WRAPPER_H_ */ |
4231 | |
4232 | === added file 'include/server/mir/time/alarm.h' |
4233 | --- include/server/mir/time/alarm.h 1970-01-01 00:00:00 +0000 |
4234 | +++ include/server/mir/time/alarm.h 2014-06-05 12:56:04 +0000 |
4235 | @@ -0,0 +1,86 @@ |
4236 | +/* |
4237 | + * Copyright © 2014 Canonical Ltd. |
4238 | + * |
4239 | + * This program is free software: you can redistribute it and/or modify it |
4240 | + * under the terms of the GNU General Public License version 3, |
4241 | + * as published by the Free Software Foundation. |
4242 | + * |
4243 | + * This program is distributed in the hope that it will be useful, |
4244 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4245 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4246 | + * GNU General Public License for more details. |
4247 | + * |
4248 | + * You should have received a copy of the GNU General Public License |
4249 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
4250 | + * |
4251 | + * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com> |
4252 | + */ |
4253 | + |
4254 | +#ifndef MIR_TIME_ALARM_H_ |
4255 | +#define MIR_TIME_ALARM_H_ |
4256 | + |
4257 | +#include "mir/time/clock.h" |
4258 | + |
4259 | +namespace mir |
4260 | +{ |
4261 | +namespace time |
4262 | +{ |
4263 | + |
4264 | +/** |
4265 | + * A one-shot, resettable handle to trigger a callback at a later time |
4266 | + * \note All members of Alarm are threadsafe |
4267 | + */ |
4268 | +class Alarm |
4269 | +{ |
4270 | +public: |
4271 | + enum State |
4272 | + { |
4273 | + pending, /**< Will trigger the callback at some point in the future */ |
4274 | + cancelled, /**< The callback has been cancelled before being triggered */ |
4275 | + triggered /**< The callback has been called */ |
4276 | + }; |
4277 | + |
4278 | + |
4279 | + Alarm() = default; |
4280 | + /** |
4281 | + * \note Destruction of the Alarm guarantees that the callback will not subsequently be called |
4282 | + */ |
4283 | + virtual ~Alarm() = default; |
4284 | + |
4285 | + /** |
4286 | + * Cancels a pending alarm |
4287 | + * |
4288 | + * \note Has no effect if the Alarm is in the Triggered state. |
4289 | + * \note cancel() is idempotent |
4290 | + * |
4291 | + * \return True iff the state of the Alarm is now Cancelled |
4292 | + */ |
4293 | + virtual bool cancel() = 0; |
4294 | + virtual State state() const = 0; |
4295 | + |
4296 | + /** |
4297 | + * Reschedule the alarm |
4298 | + * \param delay Delay, in milliseconds, before the Alarm will be triggered |
4299 | + * \return True if this reschedule supercedes a previous not-yet-triggered timeout |
4300 | + * |
4301 | + * \note This cancels any previous timeout set. |
4302 | + */ |
4303 | + virtual bool reschedule_in(std::chrono::milliseconds delay) = 0; |
4304 | + |
4305 | + /** |
4306 | + * Reschedule the alarm |
4307 | + * \param timeout Time point when the alarm should be triggered |
4308 | + * \return True if this reschedule supercedes a previous not-yet-triggered timeout |
4309 | + * |
4310 | + * \note This cancels any previous timeout set. |
4311 | + */ |
4312 | + virtual bool reschedule_for(Timestamp timeout) = 0; |
4313 | + |
4314 | + Alarm(Alarm const&) = delete; |
4315 | + Alarm& operator=(Alarm const&) = delete; |
4316 | +}; |
4317 | + |
4318 | +} |
4319 | +} |
4320 | +#endif |
4321 | + |
4322 | |
4323 | === added file 'include/server/mir/time/timer.h' |
4324 | --- include/server/mir/time/timer.h 1970-01-01 00:00:00 +0000 |
4325 | +++ include/server/mir/time/timer.h 2014-06-05 12:56:04 +0000 |
4326 | @@ -0,0 +1,70 @@ |
4327 | +/* |
4328 | + * Copyright © 2014 Canonical Ltd. |
4329 | + * |
4330 | + * This program is free software: you can redistribute it and/or modify it |
4331 | + * under the terms of the GNU General Public License version 3, |
4332 | + * as published by the Free Software Foundation. |
4333 | + * |
4334 | + * This program is distributed in the hope that it will be useful, |
4335 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4336 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4337 | + * GNU General Public License for more details. |
4338 | + * |
4339 | + * You should have received a copy of the GNU General Public License |
4340 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
4341 | + * |
4342 | + * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com> |
4343 | + */ |
4344 | + |
4345 | + |
4346 | +#ifndef MIR_TIME_TIMER_H_ |
4347 | +#define MIR_TIME_TIMER_H_ |
4348 | + |
4349 | +#include "mir/time/alarm.h" |
4350 | + |
4351 | +#include <chrono> |
4352 | +#include <functional> |
4353 | +#include <memory> |
4354 | + |
4355 | +namespace mir |
4356 | +{ |
4357 | +namespace time |
4358 | +{ |
4359 | + |
4360 | +class Alarm; |
4361 | + |
4362 | +class Timer |
4363 | +{ |
4364 | +public: |
4365 | + Timer() = default; |
4366 | + virtual ~Timer() = default; |
4367 | + /** |
4368 | + * \brief Create an Alarm that calls the callback after the specified delay |
4369 | + * |
4370 | + * \param delay Time from now, in milliseconds, that the callback will fire |
4371 | + * \param callback Function to call when the Alarm signals |
4372 | + * |
4373 | + * \return A handle to an Alarm that will fire after delay ms. |
4374 | + */ |
4375 | + virtual std::unique_ptr<Alarm> notify_in(std::chrono::milliseconds delay, |
4376 | + std::function<void()> callback) = 0; |
4377 | + /** |
4378 | + * \brief Create an Alarm that calls the callback at the specified time |
4379 | + * |
4380 | + * \param time_point Time point when the alarm should be triggered |
4381 | + * \param callback Function to call when the Alarm signals |
4382 | + * |
4383 | + * \return A handle to an Alarm that will fire after delay ms. |
4384 | + */ |
4385 | + virtual std::unique_ptr<Alarm> notify_at(Timestamp time_point, |
4386 | + std::function<void()> callback) = 0; |
4387 | + |
4388 | + |
4389 | + Timer(Timer const&) = delete; |
4390 | + Timer& operator=(Timer const&) = delete; |
4391 | +}; |
4392 | + |
4393 | +} |
4394 | +} |
4395 | + |
4396 | +#endif // MIR_TIME_TIMER_H_ |
4397 | |
4398 | === modified file 'include/shared/mir/geometry/point.h' |
4399 | --- include/shared/mir/geometry/point.h 2014-03-06 06:05:17 +0000 |
4400 | +++ include/shared/mir/geometry/point.h 2014-06-05 12:56:04 +0000 |
4401 | @@ -50,6 +50,9 @@ |
4402 | return lhs.x != rhs.x || lhs.y != rhs.y; |
4403 | } |
4404 | |
4405 | +inline Point operator+(Point lhs, DeltaX rhs) { return{lhs.x + rhs, lhs.y}; } |
4406 | +inline Point operator+(Point lhs, DeltaY rhs) { return{lhs.x, lhs.y + rhs}; } |
4407 | + |
4408 | std::ostream& operator<<(std::ostream& out, Point const& value); |
4409 | } |
4410 | } |
4411 | |
4412 | === modified file 'include/shared/mir/geometry/rectangle.h' |
4413 | --- include/shared/mir/geometry/rectangle.h 2014-03-06 06:05:17 +0000 |
4414 | +++ include/shared/mir/geometry/rectangle.h 2014-06-05 12:56:04 +0000 |
4415 | @@ -42,6 +42,8 @@ |
4416 | * area, that is, the rectangle is represented as [top_left,bottom_right). |
4417 | */ |
4418 | Point bottom_right() const; |
4419 | + Point top_right() const; |
4420 | + Point bottom_left() const; |
4421 | bool contains(Point const& p) const; |
4422 | |
4423 | /** |
4424 | |
4425 | === added file 'include/shared/mir/variable_length_array.h' |
4426 | --- include/shared/mir/variable_length_array.h 1970-01-01 00:00:00 +0000 |
4427 | +++ include/shared/mir/variable_length_array.h 2014-06-05 12:56:04 +0000 |
4428 | @@ -0,0 +1,64 @@ |
4429 | +/* |
4430 | + * Copyright © 2014 Canonical Ltd. |
4431 | + * |
4432 | + * This program is free software: you can redistribute it and/or modify |
4433 | + * it under the terms of the GNU Lesser General Public License version 3 as |
4434 | + * published by the Free Software Foundation. |
4435 | + * |
4436 | + * This program is distributed in the hope that it will be useful, |
4437 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4438 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4439 | + * GNU Lesser General Public License for more details. |
4440 | + * |
4441 | + * You should have received a copy of the GNU Lesser General Public License |
4442 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
4443 | + * |
4444 | + * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com> |
4445 | + */ |
4446 | + |
4447 | +#ifndef MIR_VARIABLE_LENGTH_ARRAY_H_ |
4448 | +#define MIR_VARIABLE_LENGTH_ARRAY_H_ |
4449 | + |
4450 | +#include <sys/types.h> |
4451 | +#include <memory> |
4452 | + |
4453 | +namespace mir |
4454 | +{ |
4455 | + |
4456 | +template <size_t BuiltInBufferSize> |
4457 | +class VariableLengthArray |
4458 | +{ |
4459 | +public: |
4460 | + explicit VariableLengthArray(size_t size) : size_{size} |
4461 | + { |
4462 | + /* Don't call resize if the initial values of member variables are valid */ |
4463 | + if (size > BuiltInBufferSize) resize(size); |
4464 | + } |
4465 | + |
4466 | + void resize(size_t size) |
4467 | + { |
4468 | + if (size > BuiltInBufferSize) |
4469 | + effective_buffer = BufferUPtr{new unsigned char[size], heap_deleter}; |
4470 | + else |
4471 | + effective_buffer = BufferUPtr{builtin_buffer, null_deleter}; |
4472 | + |
4473 | + size_ = size; |
4474 | + } |
4475 | + |
4476 | + unsigned char* data() const { return effective_buffer.get(); } |
4477 | + size_t size() const { return size_; } |
4478 | + |
4479 | +private: |
4480 | + typedef std::unique_ptr<unsigned char,void (*)(unsigned char*)> BufferUPtr; |
4481 | + |
4482 | + static void null_deleter(unsigned char*) {} |
4483 | + static void heap_deleter(unsigned char* b) { delete[] b; } |
4484 | + |
4485 | + unsigned char builtin_buffer[BuiltInBufferSize]; |
4486 | + BufferUPtr effective_buffer{builtin_buffer, null_deleter}; |
4487 | + size_t size_; |
4488 | +}; |
4489 | + |
4490 | +} |
4491 | + |
4492 | +#endif /* MIR_VARIABLE_LENGTH_ARRAY_H_ */ |
4493 | |
4494 | === modified file 'include/shared/mir_toolkit/client_types.h' |
4495 | --- include/shared/mir_toolkit/client_types.h 2014-03-11 16:19:27 +0000 |
4496 | +++ include/shared/mir_toolkit/client_types.h 2014-06-05 12:56:04 +0000 |
4497 | @@ -104,6 +104,19 @@ |
4498 | MirConnection* connection, void* context); |
4499 | |
4500 | /** |
4501 | + * Callback called when a request for client file descriptors completes |
4502 | + * \param [in] connection The connection associated with the display change |
4503 | + * \param [in] count The number of FDs allocated |
4504 | + * \param [in] fds Array of FDs |
4505 | + * \param [in,out] context The context provided by client |
4506 | + * |
4507 | + * \note Copy the FDs as the array will be invalidated after callback completes |
4508 | + */ |
4509 | + |
4510 | +typedef void (*mir_client_fd_callback)( |
4511 | + MirConnection* connection, size_t count, int const* fds, void* context); |
4512 | + |
4513 | +/** |
4514 | * MirBufferUsage specifies how a surface can and will be used. A "hardware" |
4515 | * surface can be used for OpenGL accelerated rendering. A "software" surface |
4516 | * is one that can be addressed in main memory and blitted to directly. |
4517 | |
4518 | === modified file 'include/shared/mir_toolkit/common.h' |
4519 | --- include/shared/mir_toolkit/common.h 2014-03-06 06:05:17 +0000 |
4520 | +++ include/shared/mir_toolkit/common.h 2014-06-05 12:56:04 +0000 |
4521 | @@ -37,6 +37,7 @@ |
4522 | mir_surface_attrib_state, |
4523 | mir_surface_attrib_swapinterval, |
4524 | mir_surface_attrib_focus, |
4525 | + mir_surface_attrib_dpi, |
4526 | mir_surface_attribs |
4527 | } MirSurfaceAttrib; |
4528 | |
4529 | |
4530 | === added file 'include/test/mir_test/auto_unblock_thread.h' |
4531 | --- include/test/mir_test/auto_unblock_thread.h 1970-01-01 00:00:00 +0000 |
4532 | +++ include/test/mir_test/auto_unblock_thread.h 2014-06-05 12:56:04 +0000 |
4533 | @@ -0,0 +1,79 @@ |
4534 | +/* |
4535 | + * Copyright © 2014 Canonical Ltd. |
4536 | + * |
4537 | + * This program is free software: you can redistribute it and/or modify |
4538 | + * it under the terms of the GNU General Public License version 3 as |
4539 | + * published by the Free Software Foundation. |
4540 | + * |
4541 | + * This program is distributed in the hope that it will be useful, |
4542 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4543 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4544 | + * GNU General Public License for more details. |
4545 | + * |
4546 | + * You should have received a copy of the GNU General Public License |
4547 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
4548 | + * |
4549 | + * Authored by: Alberto Aguirre <alberto.aguirre@canonical.com> |
4550 | + */ |
4551 | + |
4552 | +/** AutoUnblockThread is a helper thread class that can gracefully shutdown |
4553 | + * at destruction time. This is helpul for tests that botch create |
4554 | + * threads and use ASSERT macros for example (or any other condition that |
4555 | + * makes the test exit early). Using naked std::thread would call std::terminate |
4556 | + * under such conditions. |
4557 | + */ |
4558 | + |
4559 | +#ifndef MIR_TEST_AUTO_UNBLOCK_THREAD_H_ |
4560 | +#define MIR_TEST_AUTO_UNBLOCK_THREAD_H_ |
4561 | + |
4562 | +#include <thread> |
4563 | +#include <functional> |
4564 | + |
4565 | +namespace mir |
4566 | +{ |
4567 | +namespace test |
4568 | +{ |
4569 | + |
4570 | +class AutoUnblockThread |
4571 | +{ |
4572 | +public: |
4573 | + template<typename Callable, typename... Args> |
4574 | + explicit AutoUnblockThread(std::function<void(void)> const& unblock, |
4575 | + Callable&& f, |
4576 | + Args&&... args) |
4577 | + : unblock{unblock}, thread{f, args...} |
4578 | + {} |
4579 | + |
4580 | + ~AutoUnblockThread() |
4581 | + { |
4582 | + stop(); |
4583 | + } |
4584 | + |
4585 | + void stop() |
4586 | + { |
4587 | + unblock(); |
4588 | + if (thread.joinable()) |
4589 | + thread.join(); |
4590 | + } |
4591 | + |
4592 | +private: |
4593 | + std::function<void(void)> unblock; |
4594 | + std::thread thread; |
4595 | +}; |
4596 | + |
4597 | +/** AutoJoinThread is a convenience AutoUnblockThread when there is |
4598 | + * no need for unblocking anything to join the thread. |
4599 | + */ |
4600 | +class AutoJoinThread : public AutoUnblockThread |
4601 | +{ |
4602 | +public: |
4603 | + template<typename Callable, typename... Args> |
4604 | + explicit AutoJoinThread(Callable&& f, |
4605 | + Args&&... args) |
4606 | + : AutoUnblockThread{[]{}, f, args...} |
4607 | + {} |
4608 | +}; |
4609 | + |
4610 | +} |
4611 | +} |
4612 | +#endif |
4613 | |
4614 | === modified file 'include/test/mir_test/client_event_matchers.h' |
4615 | --- include/test/mir_test/client_event_matchers.h 2013-11-07 17:12:37 +0000 |
4616 | +++ include/test/mir_test/client_event_matchers.h 2014-06-05 12:56:04 +0000 |
4617 | @@ -1,5 +1,5 @@ |
4618 | /* |
4619 | - * Copyright © 2013 Canonical Ltd. |
4620 | + * Copyright © 2013-2014 Canonical Ltd. |
4621 | * |
4622 | * This program is free software: you can redistribute it and/or modify it |
4623 | * under the terms of the GNU General Public License version 3, |
4624 | @@ -14,8 +14,12 @@ |
4625 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
4626 | * |
4627 | * Authored by: Robert Carr <robert.carr@canonical.com> |
4628 | + * Andreas Pokorny <andreas.pokorny@canonical.com> |
4629 | */ |
4630 | |
4631 | +#ifndef MIR_TEST_CLIENT_EVENT_MATCHERS_H_ |
4632 | +#define MIR_TEST_CLIENT_EVENT_MATCHERS_H_ |
4633 | + |
4634 | #include "mir_toolkit/event.h" |
4635 | |
4636 | #include <xkbcommon/xkbcommon.h> |
4637 | @@ -27,37 +31,143 @@ |
4638 | { |
4639 | namespace test |
4640 | { |
4641 | +/*! |
4642 | + * Pointer and reference adaptors for MirEvent inside gmock matchers. |
4643 | + * \{ |
4644 | + */ |
4645 | +inline MirEvent const& to_ref(MirEvent const* event) |
4646 | +{ |
4647 | + return *event; |
4648 | +} |
4649 | + |
4650 | +inline MirEvent const& to_ref(MirEvent const& event) |
4651 | +{ |
4652 | + return event; |
4653 | +} |
4654 | +/** |
4655 | + * \} |
4656 | + */ |
4657 | |
4658 | MATCHER(KeyDownEvent, "") |
4659 | { |
4660 | - if (arg->type != mir_event_type_key) |
4661 | + if (to_ref(arg).type != mir_event_type_key) |
4662 | return false; |
4663 | - if (arg->key.action != mir_key_action_down) // Key down |
4664 | + if (to_ref(arg).key.action != mir_key_action_down) // Key down |
4665 | return false; |
4666 | |
4667 | return true; |
4668 | } |
4669 | +MATCHER(KeyUpEvent, "") |
4670 | +{ |
4671 | + if (to_ref(arg).type != mir_event_type_key) |
4672 | + return false; |
4673 | + |
4674 | + return to_ref(arg).key.action == mir_key_action_up; |
4675 | +} |
4676 | + |
4677 | +MATCHER_P(KeyWithFlag, flag, "") |
4678 | +{ |
4679 | + if (to_ref(arg).type != mir_event_type_key) |
4680 | + return false; |
4681 | + |
4682 | + return to_ref(arg).key.flags == flag; |
4683 | +} |
4684 | + |
4685 | +MATCHER_P(KeyWithModifiers, modifiers, "") |
4686 | +{ |
4687 | + if (to_ref(arg).type != mir_event_type_key) |
4688 | + return false; |
4689 | + |
4690 | + return to_ref(arg).key.modifiers == modifiers; |
4691 | +} |
4692 | + |
4693 | MATCHER_P(KeyOfSymbol, keysym, "") |
4694 | { |
4695 | - if (static_cast<xkb_keysym_t>(arg->key.key_code) == (uint)keysym) |
4696 | + if (static_cast<xkb_keysym_t>(to_ref(arg).key.key_code) == static_cast<uint32_t>(keysym)) |
4697 | return true; |
4698 | return false; |
4699 | } |
4700 | |
4701 | +MATCHER_P(MirKeyEventMatches, event, "") |
4702 | +{ |
4703 | + MirEvent const& expected = to_ref(event); |
4704 | + MirEvent const& actual = to_ref(arg); |
4705 | + return expected.type == actual.type && |
4706 | + expected.key.device_id == actual.key.device_id && |
4707 | + expected.key.source_id == actual.key.source_id && |
4708 | + expected.key.action == actual.key.action && |
4709 | + expected.key.flags == actual.key.flags && |
4710 | + expected.key.modifiers == actual.key.modifiers && |
4711 | + expected.key.key_code == actual.key.key_code && |
4712 | + expected.key.scan_code == actual.key.scan_code && |
4713 | + expected.key.repeat_count == actual.key.repeat_count && |
4714 | + expected.key.down_time == actual.key.down_time && |
4715 | + expected.key.event_time == actual.key.event_time && |
4716 | + expected.key.is_system_key == actual.key.is_system_key; |
4717 | +} |
4718 | + |
4719 | +MATCHER_P(MirMotionEventMatches, event, "") |
4720 | +{ |
4721 | + MirEvent const& expected = to_ref(event); |
4722 | + MirEvent const& actual = to_ref(arg); |
4723 | + bool scalar_members_match = |
4724 | + expected.type == actual.type && |
4725 | + expected.motion.device_id == actual.motion.device_id && |
4726 | + expected.motion.source_id == actual.motion.source_id && |
4727 | + expected.motion.action == actual.motion.action && |
4728 | + expected.motion.flags == actual.motion.flags && |
4729 | + expected.motion.modifiers == actual.motion.modifiers && |
4730 | + expected.motion.edge_flags == actual.motion.edge_flags && |
4731 | + expected.motion.button_state == actual.motion.button_state && |
4732 | + expected.motion.x_offset == actual.motion.x_offset && |
4733 | + expected.motion.y_offset == actual.motion.y_offset && |
4734 | + expected.motion.x_precision == actual.motion.x_precision && |
4735 | + expected.motion.y_precision == actual.motion.y_precision && |
4736 | + expected.motion.event_time == actual.motion.event_time && |
4737 | + expected.motion.down_time == actual.motion.down_time && |
4738 | + expected.motion.pointer_count == actual.motion.pointer_count; |
4739 | + |
4740 | + if (!scalar_members_match) |
4741 | + return false; |
4742 | + |
4743 | + for (size_t i = 0; i != actual.motion.pointer_count; ++i) |
4744 | + { |
4745 | + auto const& expected_coord = expected.motion.pointer_coordinates[i]; |
4746 | + auto const& actual_coord = actual.motion.pointer_coordinates[i]; |
4747 | + bool same_coord = |
4748 | + expected_coord.id == actual_coord.id && |
4749 | + expected_coord.x == actual_coord.x && |
4750 | + expected_coord.y == actual_coord.y && |
4751 | + expected_coord.raw_x == actual_coord.raw_x && |
4752 | + expected_coord.raw_y == actual_coord.raw_y && |
4753 | + expected_coord.touch_major == actual_coord.touch_major && |
4754 | + expected_coord.touch_minor == actual_coord.touch_minor && |
4755 | + expected_coord.size == actual_coord.size && |
4756 | + expected_coord.pressure == actual_coord.pressure && |
4757 | + expected_coord.orientation == actual_coord.orientation && |
4758 | + expected_coord.vscroll == actual_coord.vscroll && |
4759 | + expected_coord.hscroll == actual_coord.hscroll && |
4760 | + expected_coord.tool_type == actual_coord.tool_type; |
4761 | + if (!same_coord) |
4762 | + return false; |
4763 | + } |
4764 | + return true; |
4765 | +} |
4766 | + |
4767 | MATCHER(HoverEnterEvent, "") |
4768 | { |
4769 | - if (arg->type != mir_event_type_motion) |
4770 | + if (to_ref(arg).type != mir_event_type_motion) |
4771 | return false; |
4772 | - if (arg->motion.action != mir_motion_action_hover_enter) |
4773 | + if (to_ref(arg).motion.action != mir_motion_action_hover_enter) |
4774 | return false; |
4775 | |
4776 | return true; |
4777 | } |
4778 | MATCHER(HoverExitEvent, "") |
4779 | { |
4780 | - if (arg->type != mir_event_type_motion) |
4781 | + if (to_ref(arg).type != mir_event_type_motion) |
4782 | return false; |
4783 | - if (arg->motion.action != mir_motion_action_hover_exit) |
4784 | + if (to_ref(arg).motion.action != mir_motion_action_hover_exit) |
4785 | return false; |
4786 | |
4787 | return true; |
4788 | @@ -65,55 +175,57 @@ |
4789 | |
4790 | MATCHER_P2(ButtonDownEvent, x, y, "") |
4791 | { |
4792 | - if (arg->type != mir_event_type_motion) |
4793 | - return false; |
4794 | - if (arg->motion.action != mir_motion_action_down) |
4795 | - return false; |
4796 | - if (arg->motion.button_state == 0) |
4797 | - return false; |
4798 | - if (arg->motion.pointer_coordinates[0].x != x) |
4799 | - return false; |
4800 | - if (arg->motion.pointer_coordinates[0].y != y) |
4801 | + if (to_ref(arg).type != mir_event_type_motion) |
4802 | + return false; |
4803 | + if (to_ref(arg).motion.action != mir_motion_action_down) |
4804 | + return false; |
4805 | + if (to_ref(arg).motion.button_state == 0) |
4806 | + return false; |
4807 | + if (to_ref(arg).motion.pointer_coordinates[0].x != x) |
4808 | + return false; |
4809 | + if (to_ref(arg).motion.pointer_coordinates[0].y != y) |
4810 | return false; |
4811 | return true; |
4812 | } |
4813 | |
4814 | MATCHER_P2(ButtonUpEvent, x, y, "") |
4815 | { |
4816 | - if (arg->type != mir_event_type_motion) |
4817 | - return false; |
4818 | - if (arg->motion.action != mir_motion_action_up) |
4819 | - return false; |
4820 | - if (arg->motion.pointer_coordinates[0].x != x) |
4821 | - return false; |
4822 | - if (arg->motion.pointer_coordinates[0].y != y) |
4823 | + if (to_ref(arg).type != mir_event_type_motion) |
4824 | + return false; |
4825 | + if (to_ref(arg).motion.action != mir_motion_action_up) |
4826 | + return false; |
4827 | + if (to_ref(arg).motion.pointer_coordinates[0].x != x) |
4828 | + return false; |
4829 | + if (to_ref(arg).motion.pointer_coordinates[0].y != y) |
4830 | return false; |
4831 | return true; |
4832 | } |
4833 | |
4834 | MATCHER_P2(MotionEventWithPosition, x, y, "") |
4835 | { |
4836 | - if (arg->type != mir_event_type_motion) |
4837 | - return false; |
4838 | - if (arg->motion.action != mir_motion_action_move && |
4839 | - arg->motion.action != mir_motion_action_hover_move) |
4840 | - return false; |
4841 | - if (arg->motion.pointer_coordinates[0].x != x) |
4842 | - return false; |
4843 | - if (arg->motion.pointer_coordinates[0].y != y) |
4844 | + if (to_ref(arg).type != mir_event_type_motion) |
4845 | + return false; |
4846 | + if (to_ref(arg).motion.action != mir_motion_action_move && |
4847 | + to_ref(arg).motion.action != mir_motion_action_hover_move) |
4848 | + return false; |
4849 | + if (to_ref(arg).motion.pointer_coordinates[0].x != x) |
4850 | + return false; |
4851 | + if (to_ref(arg).motion.pointer_coordinates[0].y != y) |
4852 | return false; |
4853 | return true; |
4854 | } |
4855 | |
4856 | MATCHER(MovementEvent, "") |
4857 | { |
4858 | - if (arg->type != mir_event_type_motion) |
4859 | + if (to_ref(arg).type != mir_event_type_motion) |
4860 | return false; |
4861 | - if (arg->motion.action != mir_motion_action_move && |
4862 | - arg->motion.action != mir_motion_action_hover_move) |
4863 | + if (to_ref(arg).motion.action != mir_motion_action_move && |
4864 | + to_ref(arg).motion.action != mir_motion_action_hover_move) |
4865 | return false; |
4866 | return true; |
4867 | } |
4868 | |
4869 | } |
4870 | } |
4871 | + |
4872 | +#endif |
4873 | |
4874 | === modified file 'include/test/mir_test/fake_event_hub.h' |
4875 | --- include/test/mir_test/fake_event_hub.h 2013-10-01 17:29:49 +0000 |
4876 | +++ include/test/mir_test/fake_event_hub.h 2014-06-05 12:56:04 +0000 |
4877 | @@ -142,6 +142,8 @@ |
4878 | FakeDevice* getDevice(int32_t deviceId); |
4879 | size_t eventsQueueSize() const; |
4880 | |
4881 | + void throw_exception_in_next_get_events(); |
4882 | + |
4883 | // list of RawEvents available for consumption via getEvents |
4884 | std::mutex guard; |
4885 | std::list<droidinput::RawEvent> events_available; |
4886 | @@ -155,6 +157,7 @@ |
4887 | |
4888 | private: |
4889 | const KeyInfo* getKey(const FakeDevice* device, int32_t scanCode, int32_t usageCode) const; |
4890 | + bool throw_in_get_events = false; |
4891 | |
4892 | }; |
4893 | } |
4894 | |
4895 | === modified file 'include/test/mir_test/fake_event_hub_input_configuration.h' |
4896 | --- include/test/mir_test/fake_event_hub_input_configuration.h 2014-03-06 06:05:17 +0000 |
4897 | +++ include/test/mir_test/fake_event_hub_input_configuration.h 2014-06-05 12:56:04 +0000 |
4898 | @@ -13,7 +13,7 @@ |
4899 | * You should have received a copy of the GNU General Public License |
4900 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
4901 | * |
4902 | - * Author: Robert Carr <robert.carr@canonical.com> |
4903 | + * Authored by: Robert Carr <robert.carr@canonical.com> |
4904 | */ |
4905 | |
4906 | #ifndef MIR_TEST_DOUBLES_FAKE_EVENT_HUB_INPUT_CONFIGURATION_H_ |
4907 | @@ -21,7 +21,7 @@ |
4908 | |
4909 | #include "mir/input/android/default_android_input_configuration.h" |
4910 | |
4911 | -#include <utils/StrongPointer.h> |
4912 | +#include <memory> |
4913 | |
4914 | namespace droidinput = android; |
4915 | |
4916 | @@ -51,24 +51,23 @@ |
4917 | class FakeEventHubInputConfiguration : public input::android::DefaultInputConfiguration |
4918 | { |
4919 | public: |
4920 | - FakeEventHubInputConfiguration(std::shared_ptr<input::EventFilter> const& event_filter, |
4921 | - std::shared_ptr<input::InputRegion> const& input_region, |
4922 | - std::shared_ptr<input::CursorListener> const& cursor_listener, |
4923 | - std::shared_ptr<input::InputReport> const& input_report); |
4924 | + FakeEventHubInputConfiguration( |
4925 | + std::shared_ptr<input::InputDispatcher> const& input_dispatcher, |
4926 | + std::shared_ptr<input::InputRegion> const& input_region, |
4927 | + std::shared_ptr<input::CursorListener> const& cursor_listener, |
4928 | + std::shared_ptr<input::InputReport> const& input_report); |
4929 | + |
4930 | virtual ~FakeEventHubInputConfiguration(); |
4931 | |
4932 | - droidinput::sp<droidinput::EventHubInterface> the_event_hub(); |
4933 | + std::shared_ptr<droidinput::EventHubInterface> the_event_hub(); |
4934 | input::android::FakeEventHub* the_fake_event_hub(); |
4935 | |
4936 | - bool is_key_repeat_enabled() override { return false; } |
4937 | - |
4938 | - |
4939 | protected: |
4940 | FakeEventHubInputConfiguration(FakeEventHubInputConfiguration const&) = delete; |
4941 | FakeEventHubInputConfiguration& operator=(FakeEventHubInputConfiguration const&) = delete; |
4942 | |
4943 | private: |
4944 | - droidinput::sp<input::android::FakeEventHub> event_hub; |
4945 | + std::shared_ptr<input::android::FakeEventHub> event_hub; |
4946 | }; |
4947 | |
4948 | } |
4949 | |
4950 | === added file 'include/test/mir_test/popen.h' |
4951 | --- include/test/mir_test/popen.h 1970-01-01 00:00:00 +0000 |
4952 | +++ include/test/mir_test/popen.h 2014-06-05 12:56:04 +0000 |
4953 | @@ -0,0 +1,59 @@ |
4954 | +/* |
4955 | + * Copyright © 2014 Canonical Ltd. |
4956 | + * |
4957 | + * This program is free software: you can redistribute it and/or modify it |
4958 | + * under the terms of the GNU General Public License version 3, |
4959 | + * as published by the Free Software Foundation. |
4960 | + * |
4961 | + * This program is distributed in the hope that it will be useful, |
4962 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4963 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4964 | + * GNU General Public License for more details. |
4965 | + * |
4966 | + * You should have received a copy of the GNU General Public License |
4967 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
4968 | + * |
4969 | + * Authored by: Alberto Aguirre <alberto.aguirre@canonical.com> |
4970 | + */ |
4971 | + |
4972 | + |
4973 | +#ifndef MIR_TEST_POPEN_H_ |
4974 | +#define MIR_TEST_POPEN_H_ |
4975 | + |
4976 | +#include <cstdio> |
4977 | +#include <memory> |
4978 | +#include <string> |
4979 | +#include <streambuf> |
4980 | +#include <istream> |
4981 | + |
4982 | +namespace mir |
4983 | +{ |
4984 | +namespace test |
4985 | +{ |
4986 | +/** |
4987 | + * Popen - A popen c++ wrapper |
4988 | + */ |
4989 | +class Popen |
4990 | +{ |
4991 | +public: |
4992 | + Popen(std::string const& cmd); |
4993 | + |
4994 | + /** |
4995 | + * Read a line from the output of the executed command |
4996 | + * returns false if there is nothing more to read |
4997 | + */ |
4998 | + bool get_line(std::string& line); |
4999 | + |
5000 | +private: |
The diff has been truncated for viewing.
Did you test your feature/code change/bug fix ? what device(s) ?
demo clients on laptops, n4, n10, n7
Did you break mir server API or ABI and have the relevant bumps to .so and debian docs been made ?
break to server abi, libmirserver bump to libmirserver20
Did you break mir client API or ABI and have you followed up with the known clients & announced on mir-devel mailing list ?
no break on client API