Merge lp:~kdub/mir/hwc-alpha-support into lp:mir/ubuntu
- hwc-alpha-support
- Merge into ubuntu
Proposed by
Kevin DuBois
Status: | Superseded | ||||
---|---|---|---|---|---|
Proposed branch: | lp:~kdub/mir/hwc-alpha-support | ||||
Merge into: | lp:mir/ubuntu | ||||
Diff against target: |
22375 lines (+9938/-3616) (has conflicts) 338 files modified
3rd_party/android-deps/std/Thread.h (+5/-2) CMakeLists.txt (+1/-1) debian/control (+3/-3) debian/libmirserver21.install (+1/-1) examples/CMakeLists.txt (+6/-2) examples/buffer_render_target.cpp (+1/-1) examples/demo-inprocess-surface-client/inprocess_egl_client.cpp (+1/-1) examples/demo-shell/demo_renderer.cpp (+28/-13) examples/demo-shell/demo_renderer.h (+2/-1) examples/demo-shell/demo_shell.cpp (+3/-2) examples/demo-shell/window_manager.cpp (+7/-0) examples/eglcounter.cpp (+3/-2) examples/eglflash.c (+21/-11) examples/egltriangle.c (+3/-2) examples/prompt_session.c (+231/-0) examples/render_surfaces.cpp (+1/-2) include/client/mir_toolkit/mir_connection.h (+0/-20) include/client/mir_toolkit/mir_prompt_session.h (+87/-0) include/platform/mir/graphics/buffer.h (+2/-1) include/platform/mir/graphics/buffer_id.h (+1/-1) include/platform/mir/graphics/display_buffer.h (+6/-4) include/platform/mir/graphics/platform.h (+11/-2) include/server/mir/asio_main_loop.h (+2/-0) include/server/mir/compositor/buffer_stream.h (+3/-1) include/server/mir/compositor/destination_alpha.h (+36/-0) include/server/mir/compositor/display_buffer_compositor.h (+1/-3) include/server/mir/compositor/frame_dropping_policy.h (+69/-0) include/server/mir/compositor/frame_dropping_policy_factory.h (+57/-0) include/server/mir/compositor/gl_renderer.h (+8/-2) include/server/mir/compositor/renderer_factory.h (+3/-1) include/server/mir/default_server_configuration.h (+9/-0) include/server/mir/frontend/prompt_session.h (+48/-0) include/server/mir/frontend/session_mediator_report.h (+11/-1) include/server/mir/frontend/shell.h (+10/-0) include/server/mir/frontend/surface.h (+4/-10) include/server/mir/graphics/cursor_images.h (+2/-0) include/server/mir/scene/null_prompt_session_listener.h (+40/-0) include/server/mir/scene/null_surface_observer.h (+1/-0) include/server/mir/scene/prompt_session.h (+37/-0) include/server/mir/scene/prompt_session_creation_parameters.h (+36/-0) include/server/mir/scene/prompt_session_listener.h (+52/-0) include/server/mir/scene/prompt_session_manager.h (+110/-0) include/server/mir/scene/session.h (+3/-0) include/server/mir/scene/surface.h (+4/-0) include/server/mir/scene/surface_observer.h (+5/-0) include/server/mir/shell/session_coordinator_wrapper.h (+14/-0) include/server/mir/time/timer.h (+8/-1) include/shared/mir/thread_name.h (+29/-0) include/shared/mir_toolkit/client_types.h (+28/-2) include/shared/mir_toolkit/common.h (+6/-0) include/shared/mir_toolkit/event.h (+10/-1) include/test/mir_test/barrier.h (+61/-0) include/test/mir_test/current_thread_name.h (+34/-0) include/test/mir_test/fake_clock.h (+72/-0) include/test/mir_test/signal.h (+63/-0) include/test/mir_test/test_protobuf_client.h (+17/-0) include/test/mir_test_doubles/fake_ipc_factory.h (+10/-8) include/test/mir_test_doubles/fake_renderable.h (+31/-6) include/test/mir_test_doubles/mock_buffer.h (+1/-1) include/test/mir_test_doubles/mock_buffer_stream.h (+2/-1) include/test/mir_test_doubles/mock_display_buffer.h (+2/-4) include/test/mir_test_doubles/mock_display_device.h (+2/-3) include/test/mir_test_doubles/mock_frame_dropping_policy_factory.h (+83/-0) include/test/mir_test_doubles/mock_frontend_surface.h (+2/-0) include/test/mir_test_doubles/mock_prompt_session_listener.h (+48/-0) include/test/mir_test_doubles/mock_scene_session.h (+3/-0) include/test/mir_test_doubles/mock_shell.h (+12/-0) include/test/mir_test_doubles/mock_surface.h (+1/-0) include/test/mir_test_doubles/mock_swapping_gl_context.h (+1/-0) include/test/mir_test_doubles/mock_timer.h (+52/-0) include/test/mir_test_doubles/mock_virtual_terminal.h (+48/-0) include/test/mir_test_doubles/null_client_event_sink.h (+42/-0) include/test/mir_test_doubles/null_display_buffer.h (+1/-1) include/test/mir_test_doubles/null_display_buffer_compositor_factory.h (+1/-1) include/test/mir_test_doubles/null_pixel_buffer.h (+43/-0) include/test/mir_test_doubles/null_prompt_session.h (+37/-0) include/test/mir_test_doubles/null_prompt_session_manager.h (+82/-0) include/test/mir_test_doubles/null_virtual_terminal.h (+4/-2) include/test/mir_test_doubles/platform_factory.h (+46/-0) include/test/mir_test_doubles/stub_buffer.h (+17/-12) include/test/mir_test_doubles/stub_buffer_stream.h (+8/-1) include/test/mir_test_doubles/stub_display_builder.h (+1/-1) include/test/mir_test_doubles/stub_frame_dropping_policy_factory.h (+58/-0) include/test/mir_test_doubles/stub_renderable.h (+65/-6) include/test/mir_test_doubles/stub_scene_session.h (+14/-1) include/test/mir_test_doubles/stub_scene_surface.h (+4/-0) include/test/mir_test_doubles/stub_shell.h (+19/-0) include/test/mir_test_doubles/stub_swapping_gl_context.h (+5/-0) include/test/mir_test_framework/in_process_server.h (+7/-16) include/test/mir_test_framework/input_testing_client_configuration.h (+4/-4) include/test/mir_test_framework/server_runner.h (+60/-0) src/client/CMakeLists.txt (+4/-1) src/client/connection_configuration.h (+4/-0) src/client/connection_surface_map.h (+1/-0) src/client/default_connection_configuration.cpp (+20/-1) src/client/default_connection_configuration.h (+4/-0) src/client/event_distributor.h (+37/-0) src/client/event_handler_register.h (+47/-0) src/client/event_sink.h (+44/-0) src/client/logging/input_receiver_report.cpp (+1/-0) src/client/mir_connection.cpp (+13/-36) src/client/mir_connection.h (+5/-8) src/client/mir_connection_api.cpp (+0/-18) src/client/mir_event_distributor.cpp (+56/-0) src/client/mir_event_distributor.h (+43/-0) src/client/mir_prompt_session.cpp (+203/-0) src/client/mir_prompt_session.h (+94/-0) src/client/mir_prompt_session_api.cpp (+118/-0) src/client/mir_screencast.cpp (+3/-0) src/client/mir_surface.cpp (+18/-3) src/client/mir_surface.h (+1/-0) src/client/mir_wait_handle.cpp (+8/-16) src/client/rpc/make_rpc_channel.h (+3/-1) src/client/rpc/make_socket_rpc_channel.cpp (+4/-3) src/client/rpc/mir_socket_rpc_channel.cpp (+26/-7) src/client/rpc/mir_socket_rpc_channel.h (+6/-2) src/client/surface_map.cpp (+19/-4) src/platform/graphics/android/CMakeLists.txt (+1/-1) src/platform/graphics/android/android_display.cpp (+1/-2) src/platform/graphics/android/android_display.h (+1/-1) src/platform/graphics/android/android_platform.cpp (+33/-8) src/platform/graphics/android/buffer.cpp (+1/-1) src/platform/graphics/android/buffer.h (+1/-1) src/platform/graphics/android/display_buffer.cpp (+12/-41) src/platform/graphics/android/display_buffer.h (+7/-6) src/platform/graphics/android/display_device.h (+5/-3) src/platform/graphics/android/fb_device.cpp (+10/-16) src/platform/graphics/android/fb_device.h (+2/-3) src/platform/graphics/android/gl_context.cpp (+83/-45) src/platform/graphics/android/gl_context.h (+45/-28) src/platform/graphics/android/hwc_device.cpp (+46/-15) src/platform/graphics/android/hwc_device.h (+7/-4) src/platform/graphics/android/hwc_fallback_gl_renderer.cpp (+7/-2) src/platform/graphics/android/hwc_fb_device.cpp (+14/-56) src/platform/graphics/android/hwc_fb_device.h (+2/-6) src/platform/graphics/android/hwc_layers.cpp (+12/-1) src/platform/graphics/android/hwc_logger.h (+2/-0) src/platform/graphics/android/hwc_loggers.cpp (+30/-1) src/platform/graphics/android/hwc_loggers.h (+18/-7) src/platform/graphics/android/output_builder.cpp (+11/-4) src/platform/graphics/android/output_builder.h (+4/-1) src/platform/graphics/android/overlay_optimization.h (+37/-0) src/platform/graphics/android/resource_factory.cpp (+4/-31) src/platform/graphics/android/resource_factory.h (+3/-2) src/platform/graphics/android/swapping_gl_context.h (+47/-0) src/platform/graphics/mesa/CMakeLists.txt (+1/-0) src/platform/graphics/mesa/buffer_allocator.cpp (+1/-1) src/platform/graphics/mesa/buffer_texture_binder.h (+1/-1) src/platform/graphics/mesa/bypass.cpp (+6/-7) src/platform/graphics/mesa/bypass.h (+9/-11) src/platform/graphics/mesa/display.cpp (+5/-5) src/platform/graphics/mesa/display_buffer.cpp (+25/-9) src/platform/graphics/mesa/display_buffer.h (+4/-3) src/platform/graphics/mesa/gbm_buffer.cpp (+2/-2) src/platform/graphics/mesa/gbm_buffer.h (+1/-1) src/platform/graphics/mesa/linux_virtual_terminal.cpp (+23/-17) src/platform/graphics/mesa/linux_virtual_terminal.h (+3/-2) src/platform/graphics/mesa/platform.cpp (+26/-7) src/platform/graphics/mesa/platform.h (+3/-1) src/platform/graphics/mesa/shm_buffer.cpp (+1/-1) src/platform/graphics/mesa/shm_buffer.h (+1/-1) src/platform/graphics/mesa/virtual_terminal.h (+1/-0) src/server/CMakeLists.txt (+2/-1) src/server/asio_main_loop.cpp (+20/-6) src/server/compositor/CMakeLists.txt (+1/-1) src/server/compositor/buffer_queue.cpp (+54/-3) src/server/compositor/buffer_queue.h (+6/-1) src/server/compositor/buffer_stream_factory.cpp (+6/-4) src/server/compositor/buffer_stream_factory.h (+4/-4) src/server/compositor/buffer_stream_surfaces.cpp (+7/-6) src/server/compositor/buffer_stream_surfaces.h (+2/-1) src/server/compositor/default_configuration.cpp (+15/-1) src/server/compositor/default_display_buffer_compositor.cpp (+8/-37) src/server/compositor/default_display_buffer_compositor.h (+1/-3) src/server/compositor/default_display_buffer_compositor_factory.cpp (+4/-1) src/server/compositor/gl_renderer.cpp (+27/-4) src/server/compositor/gl_renderer_factory.cpp (+5/-2) src/server/compositor/gl_renderer_factory.h (+2/-1) src/server/compositor/multi_threaded_compositor.cpp (+74/-152) src/server/compositor/multi_threaded_compositor.h (+1/-1) src/server/compositor/recently_used_cache.cpp (+1/-1) src/server/compositor/screencast_display_buffer.cpp (+6/-6) src/server/compositor/screencast_display_buffer.h (+2/-2) src/server/compositor/temporary_buffers.cpp (+2/-2) src/server/compositor/temporary_buffers.h (+1/-1) src/server/compositor/timeout_frame_dropping_policy_factory.cpp (+92/-0) src/server/compositor/timeout_frame_dropping_policy_factory.h (+56/-0) src/server/default_server_configuration.cpp (+11/-0) src/server/frontend/default_configuration.cpp (+2/-1) src/server/frontend/default_ipc_factory.cpp (+9/-5) src/server/frontend/default_ipc_factory.h (+8/-4) src/server/frontend/protobuf_message_processor.cpp (+15/-3) src/server/frontend/published_socket_connector.cpp (+2/-0) src/server/frontend/session_mediator.cpp (+121/-11) src/server/frontend/session_mediator.h (+28/-9) src/server/graphics/default_configuration.cpp (+2/-1) src/server/graphics/nested/nested_output.cpp (+7/-6) src/server/graphics/nested/nested_output.h (+2/-1) src/server/graphics/offscreen/display_buffer.cpp (+5/-5) src/server/graphics/offscreen/display_buffer.h (+1/-1) src/server/input/android/android_input_window_handle.cpp (+1/-0) src/server/input/android/default_android_input_configuration.cpp (+1/-1) src/server/input/default_configuration.cpp (+1/-1) src/server/report/logging/session_mediator_report.cpp (+20/-0) src/server/report/logging/session_mediator_report.h (+8/-0) src/server/report/lttng/session_mediator_report.cpp (+12/-0) src/server/report/lttng/session_mediator_report.h (+4/-0) src/server/report/lttng/session_mediator_report_tp.h (+22/-0) src/server/report/null/session_mediator_report.cpp (+16/-0) src/server/report/null/session_mediator_report.h (+8/-0) src/server/scene/CMakeLists.txt (+2/-0) src/server/scene/application_session.cpp (+21/-0) src/server/scene/application_session.h (+3/-0) src/server/scene/basic_surface.cpp (+44/-13) src/server/scene/basic_surface.h (+6/-0) src/server/scene/default_configuration.cpp (+16/-1) src/server/scene/gl_pixel_buffer.cpp (+1/-1) src/server/scene/legacy_surface_change_notification.cpp (+6/-0) src/server/scene/legacy_surface_change_notification.h (+1/-0) src/server/scene/null_surface_observer.cpp (+2/-0) src/server/scene/prompt_session_container.cpp (+189/-0) src/server/scene/prompt_session_container.h (+158/-0) src/server/scene/prompt_session_manager_impl.cpp (+228/-0) src/server/scene/prompt_session_manager_impl.h (+96/-0) src/server/scene/session_manager.cpp (+47/-3) src/server/scene/session_manager.h (+14/-2) src/server/scene/surface_allocator.cpp (+3/-0) src/server/scene/surface_allocator.h (+6/-0) src/server/scene/threaded_snapshot_strategy.cpp (+2/-0) src/server/shell/session_coordinator_wrapper.cpp (+28/-2) src/shared/CMakeLists.txt (+1/-0) src/shared/protobuf/mir_protobuf.proto (+15/-4) src/shared/threadname/CMakeLists.txt (+23/-0) src/shared/threadname/thread_name.cpp (+32/-0) tests/acceptance-tests/CMakeLists.txt (+3/-2) tests/acceptance-tests/test_client_cursor_api.cpp (+76/-2) tests/acceptance-tests/test_client_input.cpp (+32/-36) tests/acceptance-tests/test_client_library.cpp (+752/-0) tests/acceptance-tests/test_client_library_drm.cpp (+16/-33) tests/acceptance-tests/test_client_library_old.cpp (+14/-1054) tests/acceptance-tests/test_client_surface_swap_buffers.cpp (+8/-13) tests/acceptance-tests/test_client_surfaces.cpp (+108/-226) tests/acceptance-tests/test_nested_mir.cpp (+4/-0) tests/acceptance-tests/test_prompt_session_client_api.cpp (+421/-0) tests/acceptance-tests/test_server_shutdown.cpp (+2/-2) tests/acceptance-tests/test_trust_session_helper.cpp (+0/-215) tests/integration-tests/compositor/test_buffer_stream.cpp (+49/-16) tests/integration-tests/compositor/test_swapping_swappers.cpp (+3/-1) tests/integration-tests/frontend/test_application_mediator_report.cpp (+182/-0) tests/integration-tests/graphics/android/test_buffer_integration.cpp (+4/-1) tests/integration-tests/graphics/android/test_display_integration.cpp (+4/-2) tests/integration-tests/graphics/android/test_internal_client.cpp (+3/-2) tests/integration-tests/graphics/mesa/test_buffer_integration.cpp (+12/-4) tests/integration-tests/test_session.cpp (+4/-10) tests/integration-tests/test_session_manager.cpp (+3/-1) tests/integration-tests/test_surface_first_frame_sync.cpp (+2/-1) tests/integration-tests/test_surface_stack_with_compositor.cpp (+17/-35) tests/integration-tests/test_swapinterval.cpp (+9/-2) tests/mir_test/CMakeLists.txt (+3/-0) tests/mir_test/current_thread_name.cpp (+34/-0) tests/mir_test/fake_clock.cpp (+53/-0) tests/mir_test/signal.cpp (+46/-0) tests/mir_test_doubles/CMakeLists.txt (+3/-0) tests/mir_test_doubles/mock_frame_dropping_policy_factory.cpp (+70/-0) tests/mir_test_doubles/mock_timer.cpp (+149/-0) tests/mir_test_doubles/platform_factory.cpp (+60/-0) tests/mir_test_doubles/test_protobuf_client.cpp (+27/-1) tests/mir_test_framework/CMakeLists.txt (+1/-1) tests/mir_test_framework/input_testing_client_configuration.cpp (+6/-10) tests/mir_test_framework/server_runner.cpp (+13/-19) tests/mir_test_framework/stubbed_server_configuration.cpp (+1/-1) tests/performance-tests/test_glmark2-es2-mir.cpp (+4/-4) tests/unit-tests/CMakeLists.txt (+1/-0) tests/unit-tests/client/CMakeLists.txt (+2/-0) tests/unit-tests/client/test_client_mir_surface.cpp (+95/-78) tests/unit-tests/client/test_event_distributor.cpp (+152/-0) tests/unit-tests/client/test_mir_prompt_session.cpp (+233/-0) tests/unit-tests/client/test_wait_handle.cpp (+17/-3) tests/unit-tests/compositor/CMakeLists.txt (+1/-1) tests/unit-tests/compositor/test_buffer_queue.cpp (+142/-49) tests/unit-tests/compositor/test_buffer_stream.cpp (+4/-2) tests/unit-tests/compositor/test_compositing_screencast.cpp (+3/-3) tests/unit-tests/compositor/test_default_display_buffer_compositor.cpp (+40/-195) tests/unit-tests/compositor/test_gl_renderer.cpp (+39/-6) tests/unit-tests/compositor/test_gl_texture_cache.cpp (+4/-4) tests/unit-tests/compositor/test_multi_threaded_compositor.cpp (+71/-84) tests/unit-tests/compositor/test_occlusion.cpp (+5/-5) tests/unit-tests/compositor/test_screencast_display_buffer.cpp (+11/-1) tests/unit-tests/compositor/test_temporary_buffers.cpp (+3/-3) tests/unit-tests/compositor/test_timeout_frame_dropping_policy.cpp (+186/-0) tests/unit-tests/frontend/CMakeLists.txt (+1/-0) tests/unit-tests/frontend/stress_protobuf_communicator.cpp (+4/-1) tests/unit-tests/frontend/test_basic_connector.cpp (+57/-0) tests/unit-tests/frontend/test_session_mediator.cpp (+9/-8) tests/unit-tests/frontend/test_session_mediator_android.cpp (+1/-2) tests/unit-tests/frontend/test_session_mediator_mesa.cpp (+1/-2) tests/unit-tests/graphics/android/hwc_struct_helpers.cpp (+1/-0) tests/unit-tests/graphics/android/hwc_struct_helpers.h (+1/-0) tests/unit-tests/graphics/android/test_buffer_tex_bind.cpp (+33/-33) tests/unit-tests/graphics/android/test_fb_device.cpp (+10/-12) tests/unit-tests/graphics/android/test_hwc_device.cpp (+118/-97) tests/unit-tests/graphics/android/test_hwc_display.cpp (+49/-106) tests/unit-tests/graphics/android/test_hwc_fallback_gl_renderer.cpp (+24/-7) tests/unit-tests/graphics/android/test_hwc_fb_device.cpp (+12/-26) tests/unit-tests/graphics/android/test_hwc_layers.cpp (+3/-1) tests/unit-tests/graphics/android/test_hwc_logger.cpp (+17/-1) tests/unit-tests/graphics/android/test_hwc_wrapper.cpp (+1/-0) tests/unit-tests/graphics/android/test_output_builder.cpp (+10/-7) tests/unit-tests/graphics/android/test_resource_factory.cpp (+10/-5) tests/unit-tests/graphics/mesa/CMakeLists.txt (+1/-0) tests/unit-tests/graphics/mesa/test_buffer_allocator.cpp (+2/-7) tests/unit-tests/graphics/mesa/test_bypass.cpp (+41/-41) tests/unit-tests/graphics/mesa/test_display.cpp (+10/-18) tests/unit-tests/graphics/mesa/test_display_buffer.cpp (+85/-51) tests/unit-tests/graphics/mesa/test_display_configuration.cpp (+3/-8) tests/unit-tests/graphics/mesa/test_display_multi_monitor.cpp (+4/-10) tests/unit-tests/graphics/mesa/test_gbm_buffer.cpp (+8/-14) tests/unit-tests/graphics/mesa/test_linux_virtual_terminal.cpp (+36/-3) tests/unit-tests/graphics/mesa/test_platform.cpp (+79/-8) tests/unit-tests/graphics/mesa/test_shm_buffer.cpp (+1/-1) tests/unit-tests/graphics/nested/CMakeLists.txt (+1/-0) tests/unit-tests/graphics/nested/test_nested_display_buffer.cpp (+82/-0) tests/unit-tests/graphics/test_display.cpp (+3/-15) tests/unit-tests/graphics/test_graphics_platform.cpp (+2/-13) tests/unit-tests/graphics/test_program_factory.cpp (+6/-5) tests/unit-tests/scene/CMakeLists.txt (+2/-0) tests/unit-tests/scene/test_application_session.cpp (+45/-0) tests/unit-tests/scene/test_basic_surface.cpp (+25/-9) tests/unit-tests/scene/test_gl_pixel_buffer.cpp (+2/-2) tests/unit-tests/scene/test_prompt_session_container.cpp (+273/-0) tests/unit-tests/scene/test_prompt_session_manager.cpp (+272/-0) tests/unit-tests/scene/test_session_manager.cpp (+14/-5) tests/unit-tests/scene/test_surface.cpp (+24/-6) tests/unit-tests/scene/test_surface_impl.cpp (+15/-2) tests/unit-tests/scene/test_surface_stack.cpp (+7/-0) tests/unit-tests/scene/test_threaded_snapshot_strategy.cpp (+41/-6) tests/unit-tests/test_asio_main_loop.cpp (+62/-23) tests/unit-tests/test_thread_name.cpp (+100/-0) Text conflict in examples/demo-shell/demo_renderer.cpp Text conflict in src/server/compositor/gl_renderer.cpp Text conflict in tests/unit-tests/compositor/test_gl_renderer.cpp |
||||
To merge this branch: | bzr merge lp:~kdub/mir/hwc-alpha-support | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mir development team | Pending | ||
Review via email: mp+223614@code.launchpad.net |
Commit message
android: support alpha blending overlays together in HWC. bumps android-headers version requirement from 4.2.2 to 4.4.2. also change to premultiplied blending in hwc by default, as thats more in line with the rest of the system.
Description of the change
android: support alpha blending overlays together in HWC. bumps android-headers version requirement from 4.2.2 to 4.4.2. also change to premultiplied blending in hwc by default, as thats more in line with the rest of the system.
To post a comment you must log in.
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 2014-05-22 11:31:21 +0000 | |||
3 | +++ 3rd_party/android-deps/std/Thread.h 2014-06-18 17:25:24 +0000 | |||
4 | @@ -35,6 +35,7 @@ | |||
5 | 35 | namespace mir | 35 | namespace mir |
6 | 36 | { | 36 | { |
7 | 37 | void terminate_with_current_exception(); | 37 | void terminate_with_current_exception(); |
8 | 38 | void set_thread_name(std::string const&); | ||
9 | 38 | } | 39 | } |
10 | 39 | 40 | ||
11 | 40 | namespace mir_input | 41 | namespace mir_input |
12 | @@ -54,13 +55,15 @@ | |||
13 | 54 | int32_t priority = PRIORITY_DEFAULT, | 55 | int32_t priority = PRIORITY_DEFAULT, |
14 | 55 | size_t stack = 0) | 56 | size_t stack = 0) |
15 | 56 | { | 57 | { |
17 | 57 | (void)name; (void)priority; (void)stack; | 58 | (void)priority; (void)stack; |
18 | 59 | std::string const name_str{name}; | ||
19 | 58 | 60 | ||
20 | 59 | status.store(NO_ERROR); | 61 | status.store(NO_ERROR); |
21 | 60 | exit_pending.store(false); | 62 | exit_pending.store(false); |
22 | 61 | 63 | ||
24 | 62 | thread = std::thread([this]() -> void | 64 | thread = std::thread([name_str,this]() -> void |
25 | 63 | { | 65 | { |
26 | 66 | mir::set_thread_name(name_str); | ||
27 | 64 | try | 67 | try |
28 | 65 | { | 68 | { |
29 | 66 | if (auto result = readyToRun()) status.store(result); | 69 | if (auto result = readyToRun()) status.store(result); |
30 | 67 | 70 | ||
31 | === modified file 'CMakeLists.txt' | |||
32 | --- CMakeLists.txt 2014-06-05 12:55:18 +0000 | |||
33 | +++ CMakeLists.txt 2014-06-18 17:25:24 +0000 | |||
34 | @@ -27,7 +27,7 @@ | |||
35 | 27 | set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib) | 27 | set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib) |
36 | 28 | 28 | ||
37 | 29 | set(MIR_VERSION_MAJOR 0) | 29 | set(MIR_VERSION_MAJOR 0) |
39 | 30 | set(MIR_VERSION_MINOR 2) # This should change at least with every MIRSERVER_ABI | 30 | set(MIR_VERSION_MINOR 3) # This should change at least with every MIRSERVER_ABI |
40 | 31 | set(MIR_VERSION_PATCH 0) | 31 | set(MIR_VERSION_PATCH 0) |
41 | 32 | 32 | ||
42 | 33 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) | 33 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) |
43 | 34 | 34 | ||
44 | === modified file 'debian/control' | |||
45 | --- debian/control 2014-05-28 07:43:51 +0000 | |||
46 | +++ debian/control 2014-06-18 17:25:24 +0000 | |||
47 | @@ -27,7 +27,7 @@ | |||
48 | 27 | libglm-dev, | 27 | libglm-dev, |
49 | 28 | libprotobuf-dev, | 28 | libprotobuf-dev, |
50 | 29 | pkg-config, | 29 | pkg-config, |
52 | 30 | android-headers (>=4.2.2) [i386 amd64 armhf], | 30 | android-headers (>=4.4.2) [i386 amd64 armhf], |
53 | 31 | libhardware-dev [i386 amd64 armhf], | 31 | libhardware-dev [i386 amd64 armhf], |
54 | 32 | libandroid-properties-dev [i386 amd64 armhf], | 32 | libandroid-properties-dev [i386 amd64 armhf], |
55 | 33 | libgoogle-glog-dev, | 33 | libgoogle-glog-dev, |
56 | @@ -72,7 +72,7 @@ | |||
57 | 72 | . | 72 | . |
58 | 73 | Contains the protocol's definition files. | 73 | Contains the protocol's definition files. |
59 | 74 | 74 | ||
61 | 75 | Package: libmirserver20 | 75 | Package: libmirserver21 |
62 | 76 | Section: libs | 76 | Section: libs |
63 | 77 | Architecture: i386 amd64 armhf arm64 | 77 | Architecture: i386 amd64 armhf arm64 |
64 | 78 | Multi-Arch: same | 78 | Multi-Arch: same |
65 | @@ -150,7 +150,7 @@ | |||
66 | 150 | Architecture: i386 amd64 armhf arm64 | 150 | Architecture: i386 amd64 armhf arm64 |
67 | 151 | Multi-Arch: same | 151 | Multi-Arch: same |
68 | 152 | Pre-Depends: ${misc:Pre-Depends} | 152 | Pre-Depends: ${misc:Pre-Depends} |
70 | 153 | Depends: libmirserver20 (= ${binary:Version}), | 153 | Depends: libmirserver21 (= ${binary:Version}), |
71 | 154 | libmirprotobuf-dev (= ${binary:Version}), | 154 | libmirprotobuf-dev (= ${binary:Version}), |
72 | 155 | mircommon-dev (= ${binary:Version}), | 155 | mircommon-dev (= ${binary:Version}), |
73 | 156 | libglm-dev, | 156 | libglm-dev, |
74 | 157 | 157 | ||
75 | === renamed file 'debian/libmirserver20.install' => 'debian/libmirserver21.install' | |||
76 | --- debian/libmirserver20.install 2014-05-07 02:56:33 +0000 | |||
77 | +++ debian/libmirserver21.install 2014-06-18 17:25:24 +0000 | |||
78 | @@ -1,1 +1,1 @@ | |||
80 | 1 | usr/lib/*/libmirserver.so.20 | 1 | usr/lib/*/libmirserver.so.21 |
81 | 2 | 2 | ||
82 | === modified file 'examples/CMakeLists.txt' | |||
83 | --- examples/CMakeLists.txt 2014-05-28 07:43:51 +0000 | |||
84 | +++ examples/CMakeLists.txt 2014-06-18 17:25:24 +0000 | |||
85 | @@ -92,6 +92,9 @@ | |||
86 | 92 | 92 | ||
87 | 93 | ) | 93 | ) |
88 | 94 | 94 | ||
89 | 95 | add_executable(mir_demo_client_prompt_session prompt_session.c) | ||
90 | 96 | target_link_libraries(mir_demo_client_prompt_session mirclient) | ||
91 | 97 | |||
92 | 95 | add_library(mirdraw STATIC graphics_utils.cpp) | 98 | add_library(mirdraw STATIC graphics_utils.cpp) |
93 | 96 | target_link_libraries(mirdraw ${GLESv2_LIBRARIES}) | 99 | target_link_libraries(mirdraw ${GLESv2_LIBRARIES}) |
94 | 97 | 100 | ||
95 | @@ -143,7 +146,7 @@ | |||
96 | 143 | server_configuration.cpp | 146 | server_configuration.cpp |
97 | 144 | ) | 147 | ) |
98 | 145 | 148 | ||
100 | 146 | target_link_libraries(mir_demo_standalone_input_filter | 149 | target_link_libraries(mir_demo_standalone_input_filter |
101 | 147 | mirserver | 150 | mirserver |
102 | 148 | ) | 151 | ) |
103 | 149 | 152 | ||
104 | @@ -158,8 +161,9 @@ | |||
105 | 158 | mir_demo_client_multiwin | 161 | mir_demo_client_multiwin |
106 | 159 | mir_demo_client_display_config | 162 | mir_demo_client_display_config |
107 | 160 | mir_demo_client_progressbar | 163 | mir_demo_client_progressbar |
108 | 164 | mir_demo_client_prompt_session | ||
109 | 161 | mir_demo_standalone_input_filter | 165 | mir_demo_standalone_input_filter |
111 | 162 | mir_demo_standalone_render_to_fb | 166 | mir_demo_standalone_render_to_fb |
112 | 163 | mir_demo_standalone_render_surfaces | 167 | mir_demo_standalone_render_surfaces |
113 | 164 | ) | 168 | ) |
114 | 165 | 169 | ||
115 | 166 | 170 | ||
116 | === modified file 'examples/buffer_render_target.cpp' | |||
117 | --- examples/buffer_render_target.cpp 2014-03-06 06:05:17 +0000 | |||
118 | +++ examples/buffer_render_target.cpp 2014-06-18 17:25:24 +0000 | |||
119 | @@ -77,7 +77,7 @@ | |||
120 | 77 | /* Set up color buffer... */ | 77 | /* Set up color buffer... */ |
121 | 78 | glGenTextures(1, &color_tex); | 78 | glGenTextures(1, &color_tex); |
122 | 79 | glBindTexture(GL_TEXTURE_2D, color_tex); | 79 | glBindTexture(GL_TEXTURE_2D, color_tex); |
124 | 80 | buffer.bind_to_texture(); | 80 | buffer.gl_bind_to_texture(); |
125 | 81 | glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, | 81 | glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, |
126 | 82 | GL_TEXTURE_2D, color_tex, 0); | 82 | GL_TEXTURE_2D, color_tex, 0); |
127 | 83 | 83 | ||
128 | 84 | 84 | ||
129 | === modified file 'examples/demo-inprocess-surface-client/inprocess_egl_client.cpp' | |||
130 | --- examples/demo-inprocess-surface-client/inprocess_egl_client.cpp 2014-04-15 05:31:19 +0000 | |||
131 | +++ examples/demo-inprocess-surface-client/inprocess_egl_client.cpp 2014-06-18 17:25:24 +0000 | |||
132 | @@ -102,7 +102,7 @@ | |||
133 | 102 | 102 | ||
134 | 103 | auto input_platform = mircv::InputPlatform::create(); | 103 | auto input_platform = mircv::InputPlatform::create(); |
135 | 104 | input_thread = input_platform->create_input_thread( | 104 | input_thread = input_platform->create_input_thread( |
137 | 105 | surface->client_input_fd(), | 105 | surface->client_input_fd(), |
138 | 106 | std::bind(std::mem_fn(&me::InprocessEGLClient::handle_event), this, std::placeholders::_1)); | 106 | std::bind(std::mem_fn(&me::InprocessEGLClient::handle_event), this, std::placeholders::_1)); |
139 | 107 | input_thread->start(); | 107 | input_thread->start(); |
140 | 108 | 108 | ||
141 | 109 | 109 | ||
142 | === modified file 'examples/demo-shell/demo_renderer.cpp' | |||
143 | --- examples/demo-shell/demo_renderer.cpp 2014-06-03 17:20:17 +0000 | |||
144 | +++ examples/demo-shell/demo_renderer.cpp 2014-06-18 17:25:24 +0000 | |||
145 | @@ -18,6 +18,7 @@ | |||
146 | 18 | 18 | ||
147 | 19 | #include "demo_renderer.h" | 19 | #include "demo_renderer.h" |
148 | 20 | #include <mir/graphics/renderable.h> | 20 | #include <mir/graphics/renderable.h> |
149 | 21 | #include <mir/compositor/destination_alpha.h> | ||
150 | 21 | #include <mir/compositor/recently_used_cache.h> | 22 | #include <mir/compositor/recently_used_cache.h> |
151 | 22 | #include <cmath> | 23 | #include <cmath> |
152 | 23 | 24 | ||
153 | @@ -93,15 +94,6 @@ | |||
154 | 93 | { | 94 | { |
155 | 94 | Color col = color; | 95 | Color col = color; |
156 | 95 | 96 | ||
157 | 96 | // Cut out the corner in a circular shape. | ||
158 | 97 | if (x < cx && y < cy) | ||
159 | 98 | { | ||
160 | 99 | int dx = cx - x; | ||
161 | 100 | int dy = cy - y; | ||
162 | 101 | if (dx * dx + dy * dy >= radius_sqr) | ||
163 | 102 | col.a = 0; | ||
164 | 103 | } | ||
165 | 104 | |||
166 | 105 | // Set gradient | 97 | // Set gradient |
167 | 106 | if (y < cy) | 98 | if (y < cy) |
168 | 107 | { | 99 | { |
169 | @@ -113,6 +105,15 @@ | |||
170 | 113 | col.b += (highlight - col.b) * brighten; | 105 | col.b += (highlight - col.b) * brighten; |
171 | 114 | } | 106 | } |
172 | 115 | 107 | ||
173 | 108 | // Cut out the corner in a circular shape. | ||
174 | 109 | if (x < cx && y < cy) | ||
175 | 110 | { | ||
176 | 111 | int dx = cx - x; | ||
177 | 112 | int dy = cy - y; | ||
178 | 113 | if (dx * dx + dy * dy >= radius_sqr) | ||
179 | 114 | col = {0, 0, 0, 0}; | ||
180 | 115 | } | ||
181 | 116 | |||
182 | 116 | image[y * width + x] = col; | 117 | image[y * width + x] = col; |
183 | 117 | } | 118 | } |
184 | 118 | } | 119 | } |
185 | @@ -137,10 +138,12 @@ | |||
186 | 137 | 138 | ||
187 | 138 | DemoRenderer::DemoRenderer( | 139 | DemoRenderer::DemoRenderer( |
188 | 139 | graphics::GLProgramFactory const& program_factory, | 140 | graphics::GLProgramFactory const& program_factory, |
190 | 140 | geometry::Rectangle const& display_area) | 141 | geometry::Rectangle const& display_area, |
191 | 142 | compositor::DestinationAlpha dest_alpha) | ||
192 | 141 | : GLRenderer(program_factory, | 143 | : GLRenderer(program_factory, |
193 | 142 | std::unique_ptr<graphics::GLTextureCache>(new compositor::RecentlyUsedCache()), | 144 | std::unique_ptr<graphics::GLTextureCache>(new compositor::RecentlyUsedCache()), |
195 | 143 | display_area) | 145 | display_area, |
196 | 146 | dest_alpha) | ||
197 | 144 | , corner_radius(0.5f) | 147 | , corner_radius(0.5f) |
198 | 145 | { | 148 | { |
199 | 146 | shadow_corner_tex = generate_shadow_corner_texture(0.4f); | 149 | shadow_corner_tex = generate_shadow_corner_texture(0.4f); |
200 | @@ -157,8 +160,20 @@ | |||
201 | 157 | 160 | ||
202 | 158 | void DemoRenderer::begin() const | 161 | void DemoRenderer::begin() const |
203 | 159 | { | 162 | { |
205 | 160 | glClearColor(0.2f, 0.2f, 0.2f, 1.0f); | 163 | bool const opaque = destination_alpha() == compositor::DestinationAlpha::opaque; |
206 | 164 | if (opaque) | ||
207 | 165 | glClearColor(0.2f, 0.2f, 0.2f, 1.0f); | ||
208 | 166 | else | ||
209 | 167 | glClearColor(0.0f, 0.0f, 0.0f, 0.0f); | ||
210 | 168 | |||
211 | 169 | glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); | ||
212 | 161 | glClear(GL_COLOR_BUFFER_BIT); | 170 | glClear(GL_COLOR_BUFFER_BIT); |
213 | 171 | <<<<<<< TREE | ||
214 | 172 | ======= | ||
215 | 173 | |||
216 | 174 | if (opaque) | ||
217 | 175 | glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE); | ||
218 | 176 | >>>>>>> MERGE-SOURCE | ||
219 | 162 | } | 177 | } |
220 | 163 | 178 | ||
221 | 164 | void DemoRenderer::tessellate(std::vector<graphics::GLPrimitive>& primitives, | 179 | void DemoRenderer::tessellate(std::vector<graphics::GLPrimitive>& primitives, |
222 | @@ -261,7 +276,7 @@ | |||
223 | 261 | 276 | ||
224 | 262 | // Shadows always need blending... | 277 | // Shadows always need blending... |
225 | 263 | glEnable(GL_BLEND); | 278 | glEnable(GL_BLEND); |
227 | 264 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | 279 | glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
228 | 265 | } | 280 | } |
229 | 266 | 281 | ||
230 | 267 | void DemoRenderer::tessellate_frame(std::vector<graphics::GLPrimitive>& primitives, | 282 | void DemoRenderer::tessellate_frame(std::vector<graphics::GLPrimitive>& primitives, |
231 | 268 | 283 | ||
232 | === modified file 'examples/demo-shell/demo_renderer.h' | |||
233 | --- examples/demo-shell/demo_renderer.h 2014-05-19 02:55:29 +0000 | |||
234 | +++ examples/demo-shell/demo_renderer.h 2014-06-18 17:25:24 +0000 | |||
235 | @@ -29,7 +29,8 @@ | |||
236 | 29 | class DemoRenderer : public compositor::GLRenderer | 29 | class DemoRenderer : public compositor::GLRenderer |
237 | 30 | { | 30 | { |
238 | 31 | public: | 31 | public: |
240 | 32 | DemoRenderer(graphics::GLProgramFactory const& factory, geometry::Rectangle const& display_area); | 32 | DemoRenderer(graphics::GLProgramFactory const& factory, geometry::Rectangle const& display_area, |
241 | 33 | compositor::DestinationAlpha dest_alpha); | ||
242 | 33 | ~DemoRenderer(); | 34 | ~DemoRenderer(); |
243 | 34 | 35 | ||
244 | 35 | void begin() const override; | 36 | void begin() const override; |
245 | 36 | 37 | ||
246 | === modified file 'examples/demo-shell/demo_shell.cpp' | |||
247 | --- examples/demo-shell/demo_shell.cpp 2014-04-24 08:42:12 +0000 | |||
248 | +++ examples/demo-shell/demo_shell.cpp 2014-06-18 17:25:24 +0000 | |||
249 | @@ -53,9 +53,10 @@ | |||
250 | 53 | } | 53 | } |
251 | 54 | 54 | ||
252 | 55 | std::unique_ptr<compositor::Renderer> create_renderer_for( | 55 | std::unique_ptr<compositor::Renderer> create_renderer_for( |
254 | 56 | geometry::Rectangle const& rect) override | 56 | geometry::Rectangle const& rect, |
255 | 57 | mir::compositor::DestinationAlpha dest_alpha) override | ||
256 | 57 | { | 58 | { |
258 | 58 | return std::unique_ptr<compositor::Renderer>(new DemoRenderer(*gl_program_factory, rect)); | 59 | return std::unique_ptr<compositor::Renderer>(new DemoRenderer(*gl_program_factory, rect, dest_alpha)); |
259 | 59 | } | 60 | } |
260 | 60 | private: | 61 | private: |
261 | 61 | std::shared_ptr<graphics::GLProgramFactory> const gl_program_factory; | 62 | std::shared_ptr<graphics::GLProgramFactory> const gl_program_factory; |
262 | 62 | 63 | ||
263 | === modified file 'examples/demo-shell/window_manager.cpp' | |||
264 | --- examples/demo-shell/window_manager.cpp 2014-05-22 11:31:21 +0000 | |||
265 | +++ examples/demo-shell/window_manager.cpp 2014-06-18 17:25:24 +0000 | |||
266 | @@ -156,6 +156,13 @@ | |||
267 | 156 | return true; | 156 | return true; |
268 | 157 | } | 157 | } |
269 | 158 | else if ((event.key.modifiers & mir_key_modifier_alt) && | 158 | else if ((event.key.modifiers & mir_key_modifier_alt) && |
270 | 159 | (event.key.modifiers & mir_key_modifier_ctrl) && | ||
271 | 160 | (event.key.scan_code == KEY_ESC)) | ||
272 | 161 | { | ||
273 | 162 | std::abort(); | ||
274 | 163 | return true; | ||
275 | 164 | } | ||
276 | 165 | else if ((event.key.modifiers & mir_key_modifier_alt) && | ||
277 | 159 | (event.key.modifiers & mir_key_modifier_ctrl)) | 166 | (event.key.modifiers & mir_key_modifier_ctrl)) |
278 | 160 | { | 167 | { |
279 | 161 | MirOrientation orientation = mir_orientation_normal; | 168 | MirOrientation orientation = mir_orientation_normal; |
280 | 162 | 169 | ||
281 | === modified file 'examples/eglcounter.cpp' | |||
282 | --- examples/eglcounter.cpp 2014-05-07 02:56:33 +0000 | |||
283 | +++ examples/eglcounter.cpp 2014-06-18 17:25:24 +0000 | |||
284 | @@ -201,7 +201,7 @@ | |||
285 | 201 | }; | 201 | }; |
286 | 202 | 202 | ||
287 | 203 | /* Colours from http://design.ubuntu.com/brand/colour-palette */ | 203 | /* Colours from http://design.ubuntu.com/brand/colour-palette */ |
289 | 204 | #define MID_AUBERGINE 0.368627451f, 0.152941176f, 0.31372549f | 204 | #define MID_AUBERGINE(x) x*0.368627451f, x*0.152941176f, x*0.31372549f |
290 | 205 | #define ORANGE 0.866666667f, 0.282352941f, 0.141414141f | 205 | #define ORANGE 0.866666667f, 0.282352941f, 0.141414141f |
291 | 206 | 206 | ||
292 | 207 | int main(int argc, char *argv[]) | 207 | int main(int argc, char *argv[]) |
293 | @@ -254,7 +254,8 @@ | |||
294 | 254 | return 2; | 254 | return 2; |
295 | 255 | } | 255 | } |
296 | 256 | 256 | ||
298 | 257 | glClearColor(MID_AUBERGINE, mir_eglapp_background_opacity); | 257 | float const opacity = mir_eglapp_background_opacity; |
299 | 258 | glClearColor(MID_AUBERGINE(opacity), opacity); | ||
300 | 258 | glViewport(0, 0, width, height); | 259 | glViewport(0, 0, width, height); |
301 | 259 | 260 | ||
302 | 260 | glUseProgram(prog); | 261 | glUseProgram(prog); |
303 | 261 | 262 | ||
304 | === modified file 'examples/eglflash.c' | |||
305 | --- examples/eglflash.c 2013-10-07 09:21:27 +0000 | |||
306 | +++ examples/eglflash.c 2014-06-18 17:25:24 +0000 | |||
307 | @@ -23,6 +23,11 @@ | |||
308 | 23 | #include <unistd.h> | 23 | #include <unistd.h> |
309 | 24 | #include <GLES2/gl2.h> | 24 | #include <GLES2/gl2.h> |
310 | 25 | 25 | ||
311 | 26 | typedef struct Color | ||
312 | 27 | { | ||
313 | 28 | GLfloat r, g, b, a; | ||
314 | 29 | } Color; | ||
315 | 30 | |||
316 | 26 | int main(int argc, char *argv[]) | 31 | int main(int argc, char *argv[]) |
317 | 27 | { | 32 | { |
318 | 28 | unsigned int width = 0, height = 0; | 33 | unsigned int width = 0, height = 0; |
319 | @@ -30,20 +35,25 @@ | |||
320 | 30 | if (!mir_eglapp_init(argc, argv, &width, &height)) | 35 | if (!mir_eglapp_init(argc, argv, &width, &height)) |
321 | 31 | return 1; | 36 | return 1; |
322 | 32 | 37 | ||
323 | 38 | float const opacity = mir_eglapp_background_opacity; | ||
324 | 39 | Color red = {opacity, 0.0f, 0.0f, opacity}; | ||
325 | 40 | Color green = {0.0f, opacity, 0.0f, opacity}; | ||
326 | 41 | Color blue = {0.0f, 0.0f, opacity, opacity}; | ||
327 | 42 | |||
328 | 33 | /* This is probably the simplest GL you can do */ | 43 | /* This is probably the simplest GL you can do */ |
329 | 34 | while (mir_eglapp_running()) | 44 | while (mir_eglapp_running()) |
330 | 35 | { | 45 | { |
342 | 36 | glClearColor(1.0f, 0.0f, 0.0f, mir_eglapp_background_opacity); | 46 | glClearColor(red.r, red.g, red.b, red.a); |
343 | 37 | glClear(GL_COLOR_BUFFER_BIT); | 47 | glClear(GL_COLOR_BUFFER_BIT); |
344 | 38 | mir_eglapp_swap_buffers(); | 48 | mir_eglapp_swap_buffers(); |
345 | 39 | sleep(1); | 49 | sleep(1); |
346 | 40 | 50 | ||
347 | 41 | glClearColor(0.0f, 1.0f, 0.0f, mir_eglapp_background_opacity); | 51 | glClearColor(green.r, green.g, green.b, green.a); |
348 | 42 | glClear(GL_COLOR_BUFFER_BIT); | 52 | glClear(GL_COLOR_BUFFER_BIT); |
349 | 43 | mir_eglapp_swap_buffers(); | 53 | mir_eglapp_swap_buffers(); |
350 | 44 | sleep(1); | 54 | sleep(1); |
351 | 45 | 55 | ||
352 | 46 | glClearColor(0.0f, 0.0f, 1.0f, mir_eglapp_background_opacity); | 56 | glClearColor(blue.r, blue.g, blue.b, blue.a); |
353 | 47 | glClear(GL_COLOR_BUFFER_BIT); | 57 | glClear(GL_COLOR_BUFFER_BIT); |
354 | 48 | mir_eglapp_swap_buffers(); | 58 | mir_eglapp_swap_buffers(); |
355 | 49 | sleep(1); | 59 | sleep(1); |
356 | 50 | 60 | ||
357 | === modified file 'examples/egltriangle.c' | |||
358 | --- examples/egltriangle.c 2013-10-07 09:21:27 +0000 | |||
359 | +++ examples/egltriangle.c 2014-06-18 17:25:24 +0000 | |||
360 | @@ -44,7 +44,7 @@ | |||
361 | 44 | } | 44 | } |
362 | 45 | 45 | ||
363 | 46 | /* Colours from http://design.ubuntu.com/brand/colour-palette */ | 46 | /* Colours from http://design.ubuntu.com/brand/colour-palette */ |
365 | 47 | #define MID_AUBERGINE 0.368627451f, 0.152941176f, 0.31372549f | 47 | #define MID_AUBERGINE(x) x*0.368627451f, x*0.152941176f, x*0.31372549f |
366 | 48 | #define ORANGE 0.866666667f, 0.282352941f, 0.141414141f | 48 | #define ORANGE 0.866666667f, 0.282352941f, 0.141414141f |
367 | 49 | 49 | ||
368 | 50 | int main(int argc, char *argv[]) | 50 | int main(int argc, char *argv[]) |
369 | @@ -105,7 +105,8 @@ | |||
370 | 105 | return 2; | 105 | return 2; |
371 | 106 | } | 106 | } |
372 | 107 | 107 | ||
374 | 108 | glClearColor(MID_AUBERGINE, mir_eglapp_background_opacity); | 108 | float const opacity = mir_eglapp_background_opacity; |
375 | 109 | glClearColor(MID_AUBERGINE(opacity), opacity); | ||
376 | 109 | glViewport(0, 0, width, height); | 110 | glViewport(0, 0, width, height); |
377 | 110 | 111 | ||
378 | 111 | glUseProgram(prog); | 112 | glUseProgram(prog); |
379 | 112 | 113 | ||
380 | === added file 'examples/prompt_session.c' | |||
381 | --- examples/prompt_session.c 1970-01-01 00:00:00 +0000 | |||
382 | +++ examples/prompt_session.c 2014-06-18 17:25:24 +0000 | |||
383 | @@ -0,0 +1,231 @@ | |||
384 | 1 | /* | ||
385 | 2 | * Copyright © 2014 Canonical Ltd. | ||
386 | 3 | * | ||
387 | 4 | * This program is free software: you can redistribute it and/or modify | ||
388 | 5 | * it under the terms of the GNU General Public License version 3 as | ||
389 | 6 | * published by the Free Software Foundation. | ||
390 | 7 | * | ||
391 | 8 | * This program is distributed in the hope that it will be useful, | ||
392 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
393 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
394 | 11 | * GNU General Public License for more details. | ||
395 | 12 | * | ||
396 | 13 | * You should have received a copy of the GNU General Public License | ||
397 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
398 | 15 | * | ||
399 | 16 | * Authored by: Nick Dedekind <nick.dedekind <nick.dedekind@canonical.com> | ||
400 | 17 | */ | ||
401 | 18 | |||
402 | 19 | #define _POSIX_SOURCE | ||
403 | 20 | |||
404 | 21 | #include "mir_toolkit/mir_client_library.h" | ||
405 | 22 | #include "mir_toolkit/mir_prompt_session.h" | ||
406 | 23 | |||
407 | 24 | #undef NDEBUG | ||
408 | 25 | #include <assert.h> | ||
409 | 26 | #include <string.h> | ||
410 | 27 | #include <stdio.h> | ||
411 | 28 | #include <stdlib.h> | ||
412 | 29 | #include <getopt.h> | ||
413 | 30 | #include <unistd.h> | ||
414 | 31 | #include <errno.h> | ||
415 | 32 | #include <sys/wait.h> | ||
416 | 33 | #include <sys/types.h> | ||
417 | 34 | #include <signal.h> | ||
418 | 35 | |||
419 | 36 | ///\page prompt_session.c prompt_session.c: A mir client which starts a prompt session and prompt client app. | ||
420 | 37 | /// mir_demo_client_prompt_session shows the use of mir prompt session API. | ||
421 | 38 | /// This program opens a mir connection and creates a prompt session. | ||
422 | 39 | ///\section helper helper() | ||
423 | 40 | /// Opens a mir connection and creates a prompt session | ||
424 | 41 | /// before closing the prompt session and connection. | ||
425 | 42 | ///\section prompt_session_app prompt_session_app() | ||
426 | 43 | /// Opens a mir connection and creates a surface | ||
427 | 44 | /// before releasing the surface and closing the connection. | ||
428 | 45 | ///\example prompt_session.c A mir client demonstrating prompt sessions. | ||
429 | 46 | ///\section MirDemoState MirDemoState | ||
430 | 47 | /// The handles needs to be accessible both to callbacks and to the control function. | ||
431 | 48 | ///\snippet prompt_session.c MirDemoState_tag | ||
432 | 49 | ///\section Callbacks Callbacks | ||
433 | 50 | ///\snippet prompt_session.c Callback_tag | ||
434 | 51 | /// This program creates two processes, both opening a mir connection, one starting | ||
435 | 52 | /// a prompt session with the other process. | ||
436 | 53 | |||
437 | 54 | ///\internal [MirDemoState_tag] | ||
438 | 55 | // Utility structure for the state of a single session. | ||
439 | 56 | typedef struct MirDemoState | ||
440 | 57 | { | ||
441 | 58 | MirConnection *connection; | ||
442 | 59 | MirSurface *surface; | ||
443 | 60 | MirPromptSession *prompt_session; | ||
444 | 61 | pid_t child_pid; | ||
445 | 62 | MirPromptSessionState state; | ||
446 | 63 | |||
447 | 64 | int* client_fds; | ||
448 | 65 | unsigned int client_fd_count; | ||
449 | 66 | } MirDemoState; | ||
450 | 67 | ///\internal [MirDemoState_tag] | ||
451 | 68 | |||
452 | 69 | |||
453 | 70 | ///\internal [Callback_tag] | ||
454 | 71 | // Callback to update MirDemoState on prompt_session_event | ||
455 | 72 | static void prompt_session_event_callback(MirPromptSession* prompt_session, | ||
456 | 73 | MirPromptSessionState state, | ||
457 | 74 | void* context) | ||
458 | 75 | { | ||
459 | 76 | (void)prompt_session; | ||
460 | 77 | MirDemoState* demo_state = (MirDemoState*)context; | ||
461 | 78 | demo_state->state = state; | ||
462 | 79 | |||
463 | 80 | printf("helper: Prompt Session state updated to %d\n", state); | ||
464 | 81 | if (state == mir_prompt_session_state_stopped) | ||
465 | 82 | { | ||
466 | 83 | kill(demo_state->child_pid, SIGINT); | ||
467 | 84 | } | ||
468 | 85 | } | ||
469 | 86 | |||
470 | 87 | static void client_fd_callback(MirPromptSession* prompt_session, size_t count, int const* fds, void* context) | ||
471 | 88 | { | ||
472 | 89 | (void)prompt_session; | ||
473 | 90 | ((MirDemoState*)context)->client_fds = malloc(sizeof(int)*count); | ||
474 | 91 | unsigned int i = 0; | ||
475 | 92 | for (; i < count; i++) | ||
476 | 93 | { | ||
477 | 94 | ((MirDemoState*)context)->client_fds[i] = fds[i]; | ||
478 | 95 | } | ||
479 | 96 | ((MirDemoState*)context)->client_fd_count = count; | ||
480 | 97 | } | ||
481 | 98 | ///\internal [Callback_tag] | ||
482 | 99 | |||
483 | 100 | void start_session(const char* server, const char* name, MirDemoState* mcd) | ||
484 | 101 | { | ||
485 | 102 | // Call mir_connect synchronously | ||
486 | 103 | mcd->connection = mir_connect_sync(server, name); | ||
487 | 104 | |||
488 | 105 | // We expect a connection handle; | ||
489 | 106 | // we expect it to be valid; and, | ||
490 | 107 | // we don't expect an error description | ||
491 | 108 | assert(mcd->connection != NULL); | ||
492 | 109 | assert(mir_connection_is_valid(mcd->connection)); | ||
493 | 110 | assert(strcmp(mir_connection_get_error_message(mcd->connection), "") == 0); | ||
494 | 111 | printf("%s: Connected\n", name); | ||
495 | 112 | |||
496 | 113 | // We can query information about the platform we're running on | ||
497 | 114 | { | ||
498 | 115 | MirPlatformPackage platform_package; | ||
499 | 116 | platform_package.data_items = -1; | ||
500 | 117 | platform_package.fd_items = -1; | ||
501 | 118 | |||
502 | 119 | mir_connection_get_platform(mcd->connection, &platform_package); | ||
503 | 120 | assert(0 <= platform_package.data_items); | ||
504 | 121 | assert(0 <= platform_package.fd_items); | ||
505 | 122 | } | ||
506 | 123 | } | ||
507 | 124 | |||
508 | 125 | void stop_session(MirDemoState* mcd, const char* name) | ||
509 | 126 | { | ||
510 | 127 | if (mcd->surface) | ||
511 | 128 | { | ||
512 | 129 | // We should release our surface | ||
513 | 130 | mir_surface_release_sync(mcd->surface); | ||
514 | 131 | mcd->surface = 0; | ||
515 | 132 | printf("%s: Surface released\n", name); | ||
516 | 133 | } | ||
517 | 134 | |||
518 | 135 | // We should release our connection | ||
519 | 136 | mir_connection_release(mcd->connection); | ||
520 | 137 | printf("%s: Connection released\n", name); | ||
521 | 138 | } | ||
522 | 139 | |||
523 | 140 | void helper(const char* server) | ||
524 | 141 | { | ||
525 | 142 | MirDemoState mcd; | ||
526 | 143 | mcd.connection = 0; | ||
527 | 144 | mcd.surface = 0; | ||
528 | 145 | mcd.prompt_session = 0; | ||
529 | 146 | mcd.state = mir_prompt_session_state_stopped; | ||
530 | 147 | mcd.client_fd_count = 0; | ||
531 | 148 | start_session(server, "helper", &mcd); | ||
532 | 149 | |||
533 | 150 | // We create a prompt session | ||
534 | 151 | mcd.prompt_session = mir_connection_create_prompt_session_sync(mcd.connection, getpid(), prompt_session_event_callback, &mcd); | ||
535 | 152 | assert(mcd.prompt_session != NULL); | ||
536 | 153 | |||
537 | 154 | assert(mcd.state == mir_prompt_session_state_started); | ||
538 | 155 | puts("helper: Started prompt session"); | ||
539 | 156 | |||
540 | 157 | mir_wait_for(mir_prompt_session_new_fds_for_prompt_providers(mcd.prompt_session, 1, client_fd_callback, &mcd)); | ||
541 | 158 | assert(mcd.client_fd_count == 1); | ||
542 | 159 | puts("helper: Added waiting FD"); | ||
543 | 160 | |||
544 | 161 | printf("helper: Starting child application 'mir_demo_client_basic' with fd://%d\n", mcd.client_fds[0]); | ||
545 | 162 | mcd.child_pid = fork(); | ||
546 | 163 | |||
547 | 164 | if (mcd.child_pid == 0) | ||
548 | 165 | { | ||
549 | 166 | char buffer[128] = {0}; | ||
550 | 167 | sprintf(buffer, "fd://%d", mcd.client_fds[0]); | ||
551 | 168 | |||
552 | 169 | char* args[4]; | ||
553 | 170 | args[0] = "mir_demo_client_basic"; | ||
554 | 171 | args[1] = "-m"; | ||
555 | 172 | args[2] = &buffer[0]; | ||
556 | 173 | args[3] = NULL; | ||
557 | 174 | |||
558 | 175 | errno = 0; | ||
559 | 176 | execvp("mir_demo_client_basic", args); | ||
560 | 177 | return; | ||
561 | 178 | } | ||
562 | 179 | |||
563 | 180 | int status; | ||
564 | 181 | printf("helper: Waiting on child application: %d\n", mcd.child_pid); | ||
565 | 182 | waitpid(mcd.child_pid, &status, 0); | ||
566 | 183 | |||
567 | 184 | if (mcd.state == mir_prompt_session_state_started) | ||
568 | 185 | { | ||
569 | 186 | mir_prompt_session_release_sync(mcd.prompt_session); | ||
570 | 187 | mcd.prompt_session = NULL; | ||
571 | 188 | puts("helper: Stopped prompt session"); | ||
572 | 189 | } | ||
573 | 190 | else | ||
574 | 191 | { | ||
575 | 192 | puts("helper: Prompt session stopped by server"); | ||
576 | 193 | } | ||
577 | 194 | puts("helper: Done"); | ||
578 | 195 | |||
579 | 196 | stop_session(&mcd, "helper"); | ||
580 | 197 | } | ||
581 | 198 | |||
582 | 199 | // The main() function deals with parsing arguments and defaults | ||
583 | 200 | int main(int argc, char* argv[]) | ||
584 | 201 | { | ||
585 | 202 | // Some variables for holding command line options | ||
586 | 203 | char const *server = NULL; | ||
587 | 204 | |||
588 | 205 | // Parse the command line | ||
589 | 206 | { | ||
590 | 207 | int arg; | ||
591 | 208 | opterr = 0; | ||
592 | 209 | while ((arg = getopt (argc, argv, "c:hm:")) != -1) | ||
593 | 210 | { | ||
594 | 211 | switch (arg) | ||
595 | 212 | { | ||
596 | 213 | case 'm': | ||
597 | 214 | server = optarg; | ||
598 | 215 | break; | ||
599 | 216 | |||
600 | 217 | case '?': | ||
601 | 218 | case 'h': | ||
602 | 219 | default: | ||
603 | 220 | puts(argv[0]); | ||
604 | 221 | puts("Usage:"); | ||
605 | 222 | puts(" -m <Mir server socket>"); | ||
606 | 223 | puts(" -h: this help text"); | ||
607 | 224 | return -1; | ||
608 | 225 | } | ||
609 | 226 | } | ||
610 | 227 | } | ||
611 | 228 | |||
612 | 229 | helper(server); | ||
613 | 230 | return 0; | ||
614 | 231 | } | ||
615 | 0 | 232 | ||
616 | === modified file 'examples/render_surfaces.cpp' | |||
617 | --- examples/render_surfaces.cpp 2014-05-28 07:56:16 +0000 | |||
618 | +++ examples/render_surfaces.cpp 2014-06-18 17:25:24 +0000 | |||
619 | @@ -324,7 +324,7 @@ | |||
620 | 324 | { | 324 | { |
621 | 325 | } | 325 | } |
622 | 326 | 326 | ||
624 | 327 | bool composite() | 327 | void composite() |
625 | 328 | { | 328 | { |
626 | 329 | while (!created) std::this_thread::yield(); | 329 | while (!created) std::this_thread::yield(); |
627 | 330 | stop_watch.stop(); | 330 | stop_watch.stop(); |
628 | @@ -342,7 +342,6 @@ | |||
629 | 342 | m.step(); | 342 | m.step(); |
630 | 343 | 343 | ||
631 | 344 | frames++; | 344 | frames++; |
632 | 345 | return false; | ||
633 | 346 | } | 345 | } |
634 | 347 | 346 | ||
635 | 348 | private: | 347 | private: |
636 | 349 | 348 | ||
637 | === modified file 'include/client/mir_toolkit/mir_connection.h' | |||
638 | --- include/client/mir_toolkit/mir_connection.h 2014-05-22 11:31:21 +0000 | |||
639 | +++ include/client/mir_toolkit/mir_connection.h 2014-06-18 17:25:24 +0000 | |||
640 | @@ -169,26 +169,6 @@ | |||
641 | 169 | MirConnection* connection, MirPixelFormat* formats, | 169 | MirConnection* connection, MirPixelFormat* formats, |
642 | 170 | unsigned const int format_size, unsigned int *num_valid_formats); | 170 | unsigned const int format_size, unsigned int *num_valid_formats); |
643 | 171 | 171 | ||
644 | 172 | /** | ||
645 | 173 | * Allocate some FDs for trusted clients to connect on | ||
646 | 174 | * | ||
647 | 175 | * Trust session helpers need to allocate connection FDs it will pass to | ||
648 | 176 | * trusted clients to use when connecting to the server. The server can | ||
649 | 177 | * then associate them with the trust session. | ||
650 | 178 | * | ||
651 | 179 | * \warning This API is tentative until the implementation of trust sessions is complete | ||
652 | 180 | * \param [in] connection The connection | ||
653 | 181 | * \param [in] no_of_fds The number of fds to allocate | ||
654 | 182 | * \param [in] callback Callback invoked when request completes | ||
655 | 183 | * \param [in,out] context User data passed to the callback function | ||
656 | 184 | * \return A handle that can be passed to mir_wait_for | ||
657 | 185 | */ | ||
658 | 186 | MirWaitHandle* mir_connection_new_fds_for_trusted_clients( | ||
659 | 187 | MirConnection* connection, | ||
660 | 188 | unsigned int no_of_fds, | ||
661 | 189 | mir_client_fd_callback callback, | ||
662 | 190 | void * context); | ||
663 | 191 | |||
664 | 192 | #ifdef __cplusplus | 172 | #ifdef __cplusplus |
665 | 193 | } | 173 | } |
666 | 194 | /**@}*/ | 174 | /**@}*/ |
667 | 195 | 175 | ||
668 | === added file 'include/client/mir_toolkit/mir_prompt_session.h' | |||
669 | --- include/client/mir_toolkit/mir_prompt_session.h 1970-01-01 00:00:00 +0000 | |||
670 | +++ include/client/mir_toolkit/mir_prompt_session.h 2014-06-18 17:25:24 +0000 | |||
671 | @@ -0,0 +1,87 @@ | |||
672 | 1 | /* | ||
673 | 2 | * Copyright © 2014 Canonical Ltd. | ||
674 | 3 | * | ||
675 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
676 | 5 | * under the terms of the GNU Lesser General Public License version 3, | ||
677 | 6 | * as published by the Free Software Foundation. | ||
678 | 7 | * | ||
679 | 8 | * This program is distributed in the hope that it will be useful, | ||
680 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
681 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
682 | 11 | * GNU Lesser General Public License for more details. | ||
683 | 12 | * | ||
684 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
685 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
686 | 15 | */ | ||
687 | 16 | |||
688 | 17 | #ifndef MIR_TOOLKIT_MIR_PROMPT_SESSION_H_ | ||
689 | 18 | #define MIR_TOOLKIT_MIR_PROMPT_SESSION_H_ | ||
690 | 19 | |||
691 | 20 | #include "mir_toolkit/mir_client_library.h" | ||
692 | 21 | |||
693 | 22 | #include <sys/types.h> | ||
694 | 23 | |||
695 | 24 | #ifdef __cplusplus | ||
696 | 25 | /** | ||
697 | 26 | * \addtogroup mir_toolkit | ||
698 | 27 | * @{ | ||
699 | 28 | */ | ||
700 | 29 | extern "C" { | ||
701 | 30 | #endif | ||
702 | 31 | |||
703 | 32 | /** | ||
704 | 33 | * Create and start a new prompt session | ||
705 | 34 | * \param [in] connection The connection | ||
706 | 35 | * \param [in] application_pid The process id of the initiating application | ||
707 | 36 | * \param [in] state_change_callback The function to be called when a prompt session state change occurs | ||
708 | 37 | * \param [in,out] context User data passed to the callback functions | ||
709 | 38 | * \return A handle that can be passed to mir_wait_for | ||
710 | 39 | */ | ||
711 | 40 | MirPromptSession *mir_connection_create_prompt_session_sync( | ||
712 | 41 | MirConnection* connection, | ||
713 | 42 | pid_t application_pid, | ||
714 | 43 | mir_prompt_session_state_change_callback state_change_callback, | ||
715 | 44 | void *context); | ||
716 | 45 | |||
717 | 46 | /** | ||
718 | 47 | * Add a prompt provider process id to the prompt session | ||
719 | 48 | * \param [in] prompt_session The prompt session | ||
720 | 49 | * \param [in] provider_pid The process id of the prompt provider to add | ||
721 | 50 | * \return True if the process id was added, false otherwise | ||
722 | 51 | */ | ||
723 | 52 | MirBool mir_prompt_session_add_prompt_provider_sync( | ||
724 | 53 | MirPromptSession *prompt_session, | ||
725 | 54 | pid_t provider_pid); | ||
726 | 55 | |||
727 | 56 | /** | ||
728 | 57 | * Allocate some FDs for prompt providers to connect on | ||
729 | 58 | * | ||
730 | 59 | * Prompt helpers need to allocate connection FDs it will pass to | ||
731 | 60 | * prompt providers to use when connecting to the server. The server can | ||
732 | 61 | * then associate them with the prompt session. | ||
733 | 62 | * | ||
734 | 63 | * \warning This API is tentative until the implementation of prompt sessions is complete | ||
735 | 64 | * \param [in] prompt_session The prompt session | ||
736 | 65 | * \param [in] no_of_fds The number of fds to allocate | ||
737 | 66 | * \param [in] callback Callback invoked when request completes | ||
738 | 67 | * \param [in,out] context User data passed to the callback function | ||
739 | 68 | * \return A handle that can be passed to mir_wait_for | ||
740 | 69 | */ | ||
741 | 70 | MirWaitHandle* mir_prompt_session_new_fds_for_prompt_providers( | ||
742 | 71 | MirPromptSession *prompt_session, | ||
743 | 72 | unsigned int no_of_fds, | ||
744 | 73 | mir_client_fd_callback callback, | ||
745 | 74 | void * context); | ||
746 | 75 | |||
747 | 76 | /** | ||
748 | 77 | * Stop and release the specified prompt session | ||
749 | 78 | * \param [in] prompt_session The prompt session | ||
750 | 79 | */ | ||
751 | 80 | void mir_prompt_session_release_sync(MirPromptSession *prompt_session); | ||
752 | 81 | |||
753 | 82 | #ifdef __cplusplus | ||
754 | 83 | } | ||
755 | 84 | /**@}*/ | ||
756 | 85 | #endif | ||
757 | 86 | |||
758 | 87 | #endif /* MIR_TOOLKIT_MIR_PROMPT_SESSION_H_ */ | ||
759 | 0 | 88 | ||
760 | === modified file 'include/platform/mir/graphics/buffer.h' | |||
761 | --- include/platform/mir/graphics/buffer.h 2014-03-06 06:05:17 +0000 | |||
762 | +++ include/platform/mir/graphics/buffer.h 2014-06-18 17:25:24 +0000 | |||
763 | @@ -41,7 +41,8 @@ | |||
764 | 41 | virtual geometry::Size size() const = 0; | 41 | virtual geometry::Size size() const = 0; |
765 | 42 | virtual geometry::Stride stride() const = 0; | 42 | virtual geometry::Stride stride() const = 0; |
766 | 43 | virtual MirPixelFormat pixel_format() const = 0; | 43 | virtual MirPixelFormat pixel_format() const = 0; |
768 | 44 | virtual void bind_to_texture() = 0; | 44 | virtual void gl_bind_to_texture() = 0; |
769 | 45 | /* TODO: remove this function, as it is specific to the mesa platform */ | ||
770 | 45 | virtual bool can_bypass() const = 0; | 46 | virtual bool can_bypass() const = 0; |
771 | 46 | 47 | ||
772 | 47 | protected: | 48 | protected: |
773 | 48 | 49 | ||
774 | === modified file 'include/platform/mir/graphics/buffer_id.h' | |||
775 | --- include/platform/mir/graphics/buffer_id.h 2014-05-22 09:56:17 +0000 | |||
776 | +++ include/platform/mir/graphics/buffer_id.h 2014-06-18 17:25:24 +0000 | |||
777 | @@ -27,7 +27,7 @@ | |||
778 | 27 | class BufferID | 27 | class BufferID |
779 | 28 | { | 28 | { |
780 | 29 | public: | 29 | public: |
782 | 30 | BufferID() : value(id_invalid){} | 30 | BufferID() noexcept: value(id_invalid){} |
783 | 31 | explicit BufferID(uint32_t val) : value(val) {} | 31 | explicit BufferID(uint32_t val) : value(val) {} |
784 | 32 | bool is_valid() const { return (id_invalid != value); } | 32 | bool is_valid() const { return (id_invalid != value); } |
785 | 33 | uint32_t as_uint32_t() const { return value; }; | 33 | uint32_t as_uint32_t() const { return value; }; |
786 | 34 | 34 | ||
787 | === modified file 'include/platform/mir/graphics/display_buffer.h' | |||
788 | --- include/platform/mir/graphics/display_buffer.h 2014-05-22 09:56:17 +0000 | |||
789 | +++ include/platform/mir/graphics/display_buffer.h 2014-06-18 17:25:24 +0000 | |||
790 | @@ -67,10 +67,6 @@ | |||
791 | 67 | **/ | 67 | **/ |
792 | 68 | virtual bool post_renderables_if_optimizable(RenderableList const& renderlist) = 0; | 68 | virtual bool post_renderables_if_optimizable(RenderableList const& renderlist) = 0; |
793 | 69 | 69 | ||
794 | 70 | /** to be deprecated */ | ||
795 | 71 | virtual bool can_bypass() const = 0; | ||
796 | 72 | virtual void post_update(std::shared_ptr<Buffer> /* bypass_buf */) {} | ||
797 | 73 | |||
798 | 74 | /** Returns the orientation of the display buffer relative to how the | 70 | /** Returns the orientation of the display buffer relative to how the |
799 | 75 | * user should see it (the orientation of the output). | 71 | * user should see it (the orientation of the output). |
800 | 76 | * This tells us how much (if any) rotation the renderer needs to do. | 72 | * This tells us how much (if any) rotation the renderer needs to do. |
801 | @@ -81,6 +77,12 @@ | |||
802 | 81 | */ | 77 | */ |
803 | 82 | virtual MirOrientation orientation() const = 0; | 78 | virtual MirOrientation orientation() const = 0; |
804 | 83 | 79 | ||
805 | 80 | /** Returns true if the display buffer has an alpha channel and the alpha | ||
806 | 81 | * channel will be read from at some point - in which case the renderer | ||
807 | 82 | * must produce valid alpha channel content | ||
808 | 83 | */ | ||
809 | 84 | virtual bool uses_alpha() const = 0; | ||
810 | 85 | |||
811 | 84 | protected: | 86 | protected: |
812 | 85 | DisplayBuffer() = default; | 87 | DisplayBuffer() = default; |
813 | 86 | DisplayBuffer(DisplayBuffer const& c) = delete; | 88 | DisplayBuffer(DisplayBuffer const& c) = delete; |
814 | 87 | 89 | ||
815 | === modified file 'include/platform/mir/graphics/platform.h' | |||
816 | --- include/platform/mir/graphics/platform.h 2014-05-07 02:56:33 +0000 | |||
817 | +++ include/platform/mir/graphics/platform.h 2014-06-18 17:25:24 +0000 | |||
818 | @@ -27,6 +27,8 @@ | |||
819 | 27 | 27 | ||
820 | 28 | namespace mir | 28 | namespace mir |
821 | 29 | { | 29 | { |
822 | 30 | class EmergencyCleanupRegistry; | ||
823 | 31 | |||
824 | 30 | namespace frontend | 32 | namespace frontend |
825 | 31 | { | 33 | { |
826 | 32 | class Surface; | 34 | class Surface; |
827 | @@ -116,14 +118,21 @@ | |||
828 | 116 | * Function prototype used to return a new graphics platform. | 118 | * Function prototype used to return a new graphics platform. |
829 | 117 | * | 119 | * |
830 | 118 | * \param [in] options options to use for this platform | 120 | * \param [in] options options to use for this platform |
831 | 121 | * \param [in] emergency_cleanup_registry object to register emergency shutdown handlers with | ||
832 | 119 | * \param [in] report the object to use to report interesting events from the display subsystem | 122 | * \param [in] report the object to use to report interesting events from the display subsystem |
833 | 120 | * | 123 | * |
834 | 121 | * This factory function needs to be implemented by each platform. | 124 | * This factory function needs to be implemented by each platform. |
835 | 122 | * | 125 | * |
836 | 123 | * \ingroup platform_enablement | 126 | * \ingroup platform_enablement |
837 | 124 | */ | 127 | */ |
840 | 125 | extern "C" typedef std::shared_ptr<Platform>(*CreatePlatform)(std::shared_ptr<options::Option> const& options, std::shared_ptr<DisplayReport> const& report); | 128 | extern "C" typedef std::shared_ptr<Platform>(*CreatePlatform)( |
841 | 126 | extern "C" std::shared_ptr<Platform> create_platform (std::shared_ptr<options::Option> const& options, std::shared_ptr<DisplayReport> const& report); | 129 | std::shared_ptr<options::Option> const& options, |
842 | 130 | std::shared_ptr<EmergencyCleanupRegistry> const& emergency_cleanup_registry, | ||
843 | 131 | std::shared_ptr<DisplayReport> const& report); | ||
844 | 132 | extern "C" std::shared_ptr<Platform> create_platform( | ||
845 | 133 | std::shared_ptr<options::Option> const& options, | ||
846 | 134 | std::shared_ptr<EmergencyCleanupRegistry> const& emergency_cleanup_registry, | ||
847 | 135 | std::shared_ptr<DisplayReport> const& report); | ||
848 | 127 | extern "C" typedef void(*AddPlatformOptions)( | 136 | extern "C" typedef void(*AddPlatformOptions)( |
849 | 128 | boost::program_options::options_description& config); | 137 | boost::program_options::options_description& config); |
850 | 129 | extern "C" void add_platform_options( | 138 | extern "C" void add_platform_options( |
851 | 130 | 139 | ||
852 | === modified file 'include/server/mir/asio_main_loop.h' | |||
853 | --- include/server/mir/asio_main_loop.h 2014-05-28 07:43:51 +0000 | |||
854 | +++ include/server/mir/asio_main_loop.h 2014-06-18 17:25:24 +0000 | |||
855 | @@ -58,6 +58,8 @@ | |||
856 | 58 | std::function<void()> callback) override; | 58 | std::function<void()> callback) override; |
857 | 59 | std::unique_ptr<time::Alarm> notify_at(mir::time::Timestamp time_point, | 59 | std::unique_ptr<time::Alarm> notify_at(mir::time::Timestamp time_point, |
858 | 60 | std::function<void()> callback) override; | 60 | std::function<void()> callback) override; |
859 | 61 | std::unique_ptr<time::Alarm> create_alarm(std::function<void()> callback) override; | ||
860 | 62 | |||
861 | 61 | void enqueue(void const* owner, ServerAction const& action); | 63 | void enqueue(void const* owner, ServerAction const& action); |
862 | 62 | void pause_processing_for(void const* owner); | 64 | void pause_processing_for(void const* owner); |
863 | 63 | void resume_processing_for(void const* owner); | 65 | void resume_processing_for(void const* owner); |
864 | 64 | 66 | ||
865 | === modified file 'include/server/mir/compositor/buffer_stream.h' | |||
866 | --- include/server/mir/compositor/buffer_stream.h 2014-03-26 05:48:59 +0000 | |||
867 | +++ include/server/mir/compositor/buffer_stream.h 2014-06-18 17:25:24 +0000 | |||
868 | @@ -41,7 +41,9 @@ | |||
869 | 41 | public: | 41 | public: |
870 | 42 | virtual ~BufferStream() = default; | 42 | virtual ~BufferStream() = default; |
871 | 43 | 43 | ||
873 | 44 | virtual void swap_client_buffers(graphics::Buffer* old_buffer, std::function<void(graphics::Buffer* new_buffer)> complete) = 0; | 44 | virtual void acquire_client_buffer( |
874 | 45 | std::function<void(graphics::Buffer* buffer)> complete) = 0; | ||
875 | 46 | virtual void release_client_buffer(graphics::Buffer* buf) = 0; | ||
876 | 45 | virtual std::shared_ptr<graphics::Buffer> | 47 | virtual std::shared_ptr<graphics::Buffer> |
877 | 46 | lock_compositor_buffer(void const* user_id) = 0; | 48 | lock_compositor_buffer(void const* user_id) = 0; |
878 | 47 | virtual std::shared_ptr<graphics::Buffer> lock_snapshot_buffer() = 0; | 49 | virtual std::shared_ptr<graphics::Buffer> lock_snapshot_buffer() = 0; |
879 | 48 | 50 | ||
880 | === added file 'include/server/mir/compositor/destination_alpha.h' | |||
881 | --- include/server/mir/compositor/destination_alpha.h 1970-01-01 00:00:00 +0000 | |||
882 | +++ include/server/mir/compositor/destination_alpha.h 2014-06-18 17:25:24 +0000 | |||
883 | @@ -0,0 +1,36 @@ | |||
884 | 1 | /* | ||
885 | 2 | * Copyright © 2014 Canonical Ltd. | ||
886 | 3 | * | ||
887 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
888 | 5 | * under the terms of the GNU General Public License version 3, | ||
889 | 6 | * as published by the Free Software Foundation. | ||
890 | 7 | * | ||
891 | 8 | * This program is distributed in the hope that it will be useful, | ||
892 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
893 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
894 | 11 | * GNU General Public License for more details. | ||
895 | 12 | * | ||
896 | 13 | * You should have received a copy of the GNU General Public License | ||
897 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
898 | 15 | * | ||
899 | 16 | * Authored by: Alberto Aguirre <alberto.aguirre@canonical.com> | ||
900 | 17 | */ | ||
901 | 18 | |||
902 | 19 | #ifndef MIR_COMPOSITOR_DESTINATION_ALPHA_H_ | ||
903 | 20 | #define MIR_COMPOSITOR_DESTINATION_ALPHA_H_ | ||
904 | 21 | |||
905 | 22 | namespace mir | ||
906 | 23 | { | ||
907 | 24 | namespace compositor | ||
908 | 25 | { | ||
909 | 26 | |||
910 | 27 | enum class DestinationAlpha | ||
911 | 28 | { | ||
912 | 29 | generate_from_source, | ||
913 | 30 | opaque | ||
914 | 31 | }; | ||
915 | 32 | |||
916 | 33 | } | ||
917 | 34 | } | ||
918 | 35 | |||
919 | 36 | #endif | ||
920 | 0 | 37 | ||
921 | === modified file 'include/server/mir/compositor/display_buffer_compositor.h' | |||
922 | --- include/server/mir/compositor/display_buffer_compositor.h 2014-03-05 07:31:06 +0000 | |||
923 | +++ include/server/mir/compositor/display_buffer_compositor.h 2014-06-18 17:25:24 +0000 | |||
924 | @@ -30,9 +30,7 @@ | |||
925 | 30 | public: | 30 | public: |
926 | 31 | virtual ~DisplayBufferCompositor() = default; | 31 | virtual ~DisplayBufferCompositor() = default; |
927 | 32 | 32 | ||
931 | 33 | /// Returns true if there is additional work to do. E.g. a composited surface | 33 | virtual void composite() = 0; |
929 | 34 | /// has additional buffers ready to composite or during animation | ||
930 | 35 | virtual bool composite() = 0; | ||
932 | 36 | 34 | ||
933 | 37 | protected: | 35 | protected: |
934 | 38 | DisplayBufferCompositor() = default; | 36 | DisplayBufferCompositor() = default; |
935 | 39 | 37 | ||
936 | === added file 'include/server/mir/compositor/frame_dropping_policy.h' | |||
937 | --- include/server/mir/compositor/frame_dropping_policy.h 1970-01-01 00:00:00 +0000 | |||
938 | +++ include/server/mir/compositor/frame_dropping_policy.h 2014-06-18 17:25:24 +0000 | |||
939 | @@ -0,0 +1,69 @@ | |||
940 | 1 | /* | ||
941 | 2 | * Copyright © 2014 Canonical Ltd. | ||
942 | 3 | * | ||
943 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
944 | 5 | * under the terms of the GNU General Public License version 3, | ||
945 | 6 | * as published by the Free Software Foundation. | ||
946 | 7 | * | ||
947 | 8 | * This program is distributed in the hope that it will be useful, | ||
948 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
949 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
950 | 11 | * GNU General Public License for more details. | ||
951 | 12 | * | ||
952 | 13 | * You should have received a copy of the GNU General Public License | ||
953 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
954 | 15 | * | ||
955 | 16 | * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com> | ||
956 | 17 | */ | ||
957 | 18 | |||
958 | 19 | #ifndef MIR_COMPOSITOR_FRAME_DROPPING_POLICY_H_ | ||
959 | 20 | #define MIR_COMPOSITOR_FRAME_DROPPING_POLICY_H_ | ||
960 | 21 | |||
961 | 22 | #include <functional> | ||
962 | 23 | |||
963 | 24 | namespace mir | ||
964 | 25 | { | ||
965 | 26 | namespace compositor | ||
966 | 27 | { | ||
967 | 28 | /** | ||
968 | 29 | * \brief Policy to determine when to drop a frame from a client | ||
969 | 30 | * | ||
970 | 31 | * The FrameDroppingPolicy objects are constructed from a | ||
971 | 32 | * \ref FrameDroppingPolicyFactory | ||
972 | 33 | * | ||
973 | 34 | * The frame dropping mechanism is provided as the | ||
974 | 35 | * \a drop_frames argument of \ref FrameDroppingPolicyFactory::create_policy | ||
975 | 36 | * | ||
976 | 37 | * The policy may decide to drop a frame any time that there is an outstanding | ||
977 | 38 | * swap - namely, when there have been more calls to \ref swap_now_blocking | ||
978 | 39 | * than to \ref swap_unblocked | ||
979 | 40 | */ | ||
980 | 41 | class FrameDroppingPolicy | ||
981 | 42 | { | ||
982 | 43 | public: | ||
983 | 44 | virtual ~FrameDroppingPolicy() = default; | ||
984 | 45 | |||
985 | 46 | FrameDroppingPolicy(FrameDroppingPolicy const&) = delete; | ||
986 | 47 | FrameDroppingPolicy& operator=(FrameDroppingPolicy const&) = delete; | ||
987 | 48 | |||
988 | 49 | /** | ||
989 | 50 | * \brief Notify that a swap is now blocking | ||
990 | 51 | */ | ||
991 | 52 | virtual void swap_now_blocking() = 0; | ||
992 | 53 | /** | ||
993 | 54 | * \brief Notify that previous swap is no longer blocking | ||
994 | 55 | */ | ||
995 | 56 | virtual void swap_unblocked() = 0; | ||
996 | 57 | |||
997 | 58 | protected: | ||
998 | 59 | /** | ||
999 | 60 | * \note FrameDroppingPolicies should not be constructed directly; | ||
1000 | 61 | * use a \ref FrameDroppingPolicyFactory | ||
1001 | 62 | */ | ||
1002 | 63 | FrameDroppingPolicy() = default; | ||
1003 | 64 | }; | ||
1004 | 65 | |||
1005 | 66 | } | ||
1006 | 67 | } | ||
1007 | 68 | |||
1008 | 69 | #endif // MIR_COMPOSITOR_FRAME_DROPPING_POLICY_H_ | ||
1009 | 0 | 70 | ||
1010 | === added file 'include/server/mir/compositor/frame_dropping_policy_factory.h' | |||
1011 | --- include/server/mir/compositor/frame_dropping_policy_factory.h 1970-01-01 00:00:00 +0000 | |||
1012 | +++ include/server/mir/compositor/frame_dropping_policy_factory.h 2014-06-18 17:25:24 +0000 | |||
1013 | @@ -0,0 +1,57 @@ | |||
1014 | 1 | /* | ||
1015 | 2 | * Copyright © 2014 Canonical Ltd. | ||
1016 | 3 | * | ||
1017 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
1018 | 5 | * under the terms of the GNU General Public License version 3, | ||
1019 | 6 | * as published by the Free Software Foundation. | ||
1020 | 7 | * | ||
1021 | 8 | * This program is distributed in the hope that it will be useful, | ||
1022 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1023 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1024 | 11 | * GNU General Public License for more details. | ||
1025 | 12 | * | ||
1026 | 13 | * You should have received a copy of the GNU General Public License | ||
1027 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1028 | 15 | * | ||
1029 | 16 | * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com> | ||
1030 | 17 | */ | ||
1031 | 18 | |||
1032 | 19 | #ifndef MIR_COMPOSITOR_FRAME_DROPPING_POLICY_FACTORY_H_ | ||
1033 | 20 | #define MIR_COMPOSITOR_FRAME_DROPPING_POLICY_FACTORY_H_ | ||
1034 | 21 | |||
1035 | 22 | #include <memory> | ||
1036 | 23 | |||
1037 | 24 | namespace mir | ||
1038 | 25 | { | ||
1039 | 26 | namespace compositor | ||
1040 | 27 | { | ||
1041 | 28 | class FrameDroppingPolicy; | ||
1042 | 29 | |||
1043 | 30 | /** | ||
1044 | 31 | * \brief Creator of FrameDroppingPolicies | ||
1045 | 32 | * | ||
1046 | 33 | * The FrameDroppingPolicyFactory is how you go from a means of dropping frames - | ||
1047 | 34 | * the \a drop_frames parameter of \ref create_policy - | ||
1048 | 35 | * to a \ref FrameDroppingPolicy | ||
1049 | 36 | */ | ||
1050 | 37 | class FrameDroppingPolicyFactory | ||
1051 | 38 | { | ||
1052 | 39 | public: | ||
1053 | 40 | FrameDroppingPolicyFactory() = default; | ||
1054 | 41 | virtual ~FrameDroppingPolicyFactory() = default; | ||
1055 | 42 | |||
1056 | 43 | FrameDroppingPolicyFactory(FrameDroppingPolicyFactory const&) = delete; | ||
1057 | 44 | FrameDroppingPolicyFactory& operator=(FrameDroppingPolicyFactory const&) = delete; | ||
1058 | 45 | |||
1059 | 46 | /** | ||
1060 | 47 | * \brief Create a FrameDroppingPolicy that will call \a drop_frame when it decides to drop a frame | ||
1061 | 48 | * \param drop_frame Function to call when a frame needs to be dropped | ||
1062 | 49 | * \return The policy object. | ||
1063 | 50 | */ | ||
1064 | 51 | virtual std::unique_ptr<FrameDroppingPolicy> create_policy(std::function<void(void)> drop_frame) const = 0; | ||
1065 | 52 | }; | ||
1066 | 53 | |||
1067 | 54 | } | ||
1068 | 55 | } | ||
1069 | 56 | |||
1070 | 57 | #endif // MIR_COMPOSITOR_FRAME_DROPPING_POLICY_FACTORY_H_ | ||
1071 | 0 | 58 | ||
1072 | === modified file 'include/server/mir/compositor/gl_renderer.h' | |||
1073 | --- include/server/mir/compositor/gl_renderer.h 2014-05-28 07:43:51 +0000 | |||
1074 | +++ include/server/mir/compositor/gl_renderer.h 2014-06-18 17:25:24 +0000 | |||
1075 | @@ -37,13 +37,16 @@ | |||
1076 | 37 | namespace compositor | 37 | namespace compositor |
1077 | 38 | { | 38 | { |
1078 | 39 | 39 | ||
1079 | 40 | enum class DestinationAlpha; | ||
1080 | 41 | |||
1081 | 40 | class GLRenderer : public Renderer | 42 | class GLRenderer : public Renderer |
1082 | 41 | { | 43 | { |
1083 | 42 | public: | 44 | public: |
1084 | 43 | GLRenderer( | 45 | GLRenderer( |
1085 | 44 | graphics::GLProgramFactory const& program_factory, | 46 | graphics::GLProgramFactory const& program_factory, |
1086 | 45 | std::unique_ptr<graphics::GLTextureCache> && texture_cache, | 47 | std::unique_ptr<graphics::GLTextureCache> && texture_cache, |
1088 | 46 | geometry::Rectangle const& display_area); | 48 | geometry::Rectangle const& display_area, |
1089 | 49 | DestinationAlpha dest_alpha); | ||
1090 | 47 | 50 | ||
1091 | 48 | // These are called with a valid GL context: | 51 | // These are called with a valid GL context: |
1092 | 49 | void set_viewport(geometry::Rectangle const& rect) override; | 52 | void set_viewport(geometry::Rectangle const& rect) override; |
1093 | @@ -75,6 +78,9 @@ | |||
1094 | 75 | graphics::Renderable const& renderable) const; | 78 | graphics::Renderable const& renderable) const; |
1095 | 76 | 79 | ||
1096 | 77 | virtual void render(graphics::Renderable const& renderable) const; | 80 | virtual void render(graphics::Renderable const& renderable) const; |
1097 | 81 | |||
1098 | 82 | DestinationAlpha destination_alpha() const; | ||
1099 | 83 | |||
1100 | 78 | private: | 84 | private: |
1101 | 79 | std::unique_ptr<graphics::GLProgram> program; | 85 | std::unique_ptr<graphics::GLProgram> program; |
1102 | 80 | std::unique_ptr<graphics::GLTextureCache> mutable texture_cache; | 86 | std::unique_ptr<graphics::GLTextureCache> mutable texture_cache; |
1103 | @@ -85,7 +91,7 @@ | |||
1104 | 85 | GLuint transform_uniform_loc; | 91 | GLuint transform_uniform_loc; |
1105 | 86 | GLuint alpha_uniform_loc; | 92 | GLuint alpha_uniform_loc; |
1106 | 87 | float rotation; | 93 | float rotation; |
1108 | 88 | 94 | DestinationAlpha const dest_alpha; | |
1109 | 89 | geometry::Rectangle viewport; | 95 | geometry::Rectangle viewport; |
1110 | 90 | }; | 96 | }; |
1111 | 91 | 97 | ||
1112 | 92 | 98 | ||
1113 | === modified file 'include/server/mir/compositor/renderer_factory.h' | |||
1114 | --- include/server/mir/compositor/renderer_factory.h 2014-03-06 06:05:17 +0000 | |||
1115 | +++ include/server/mir/compositor/renderer_factory.h 2014-06-18 17:25:24 +0000 | |||
1116 | @@ -31,13 +31,15 @@ | |||
1117 | 31 | { | 31 | { |
1118 | 32 | 32 | ||
1119 | 33 | class Renderer; | 33 | class Renderer; |
1120 | 34 | enum class DestinationAlpha; | ||
1121 | 34 | 35 | ||
1122 | 35 | class RendererFactory | 36 | class RendererFactory |
1123 | 36 | { | 37 | { |
1124 | 37 | public: | 38 | public: |
1125 | 38 | virtual ~RendererFactory() = default; | 39 | virtual ~RendererFactory() = default; |
1126 | 39 | 40 | ||
1128 | 40 | virtual std::unique_ptr<Renderer> create_renderer_for(geometry::Rectangle const& rect) = 0; | 41 | virtual std::unique_ptr<Renderer> create_renderer_for(geometry::Rectangle const& rect, |
1129 | 42 | DestinationAlpha dest_alpha) = 0; | ||
1130 | 41 | 43 | ||
1131 | 42 | protected: | 44 | protected: |
1132 | 43 | RendererFactory() = default; | 45 | RendererFactory() = default; |
1133 | 44 | 46 | ||
1134 | === modified file 'include/server/mir/default_server_configuration.h' | |||
1135 | --- include/server/mir/default_server_configuration.h 2014-05-28 07:56:16 +0000 | |||
1136 | +++ include/server/mir/default_server_configuration.h 2014-06-18 17:25:24 +0000 | |||
1137 | @@ -46,6 +46,7 @@ | |||
1138 | 46 | class Compositor; | 46 | class Compositor; |
1139 | 47 | class RendererFactory; | 47 | class RendererFactory; |
1140 | 48 | class CompositorReport; | 48 | class CompositorReport; |
1141 | 49 | class FrameDroppingPolicyFactory; | ||
1142 | 49 | } | 50 | } |
1143 | 50 | namespace frontend | 51 | namespace frontend |
1144 | 51 | { | 52 | { |
1145 | @@ -92,6 +93,8 @@ | |||
1146 | 92 | class SurfaceStackModel; | 93 | class SurfaceStackModel; |
1147 | 93 | class SurfaceStack; | 94 | class SurfaceStack; |
1148 | 94 | class SceneReport; | 95 | class SceneReport; |
1149 | 96 | class PromptSessionListener; | ||
1150 | 97 | class PromptSessionManager; | ||
1151 | 95 | } | 98 | } |
1152 | 96 | namespace graphics | 99 | namespace graphics |
1153 | 97 | { | 100 | { |
1154 | @@ -196,6 +199,7 @@ | |||
1155 | 196 | * @{ */ | 199 | * @{ */ |
1156 | 197 | virtual std::shared_ptr<graphics::GraphicBufferAllocator> the_buffer_allocator(); | 200 | virtual std::shared_ptr<graphics::GraphicBufferAllocator> the_buffer_allocator(); |
1157 | 198 | virtual std::shared_ptr<compositor::Scene> the_scene(); | 201 | virtual std::shared_ptr<compositor::Scene> the_scene(); |
1158 | 202 | virtual std::shared_ptr<compositor::FrameDroppingPolicyFactory> the_frame_dropping_policy_factory(); | ||
1159 | 199 | /** @} */ | 203 | /** @} */ |
1160 | 200 | 204 | ||
1161 | 201 | /** @name frontend configuration - dependencies | 205 | /** @name frontend configuration - dependencies |
1162 | @@ -229,6 +233,8 @@ | |||
1163 | 229 | virtual std::shared_ptr<scene::PlacementStrategy> the_placement_strategy(); | 233 | virtual std::shared_ptr<scene::PlacementStrategy> the_placement_strategy(); |
1164 | 230 | virtual std::shared_ptr<scene::SessionListener> the_session_listener(); | 234 | virtual std::shared_ptr<scene::SessionListener> the_session_listener(); |
1165 | 231 | virtual std::shared_ptr<shell::DisplayLayout> the_shell_display_layout(); | 235 | virtual std::shared_ptr<shell::DisplayLayout> the_shell_display_layout(); |
1166 | 236 | virtual std::shared_ptr<scene::PromptSessionListener> the_prompt_session_listener(); | ||
1167 | 237 | virtual std::shared_ptr<scene::PromptSessionManager> the_prompt_session_manager(); | ||
1168 | 232 | /** @} */ | 238 | /** @} */ |
1169 | 233 | 239 | ||
1170 | 234 | /** @name internal scene configuration | 240 | /** @name internal scene configuration |
1171 | @@ -336,6 +342,7 @@ | |||
1172 | 336 | CachedPtr<frontend::Screencast> screencast; | 342 | CachedPtr<frontend::Screencast> screencast; |
1173 | 337 | CachedPtr<compositor::RendererFactory> renderer_factory; | 343 | CachedPtr<compositor::RendererFactory> renderer_factory; |
1174 | 338 | CachedPtr<compositor::BufferStreamFactory> buffer_stream_factory; | 344 | CachedPtr<compositor::BufferStreamFactory> buffer_stream_factory; |
1175 | 345 | CachedPtr<compositor::FrameDroppingPolicyFactory> frame_dropping_policy_factory; | ||
1176 | 339 | CachedPtr<scene::SurfaceStack> surface_stack; | 346 | CachedPtr<scene::SurfaceStack> surface_stack; |
1177 | 340 | CachedPtr<scene::SceneReport> scene_report; | 347 | CachedPtr<scene::SceneReport> scene_report; |
1178 | 341 | 348 | ||
1179 | @@ -362,6 +369,8 @@ | |||
1180 | 362 | CachedPtr<scene::MediatingDisplayChanger> mediating_display_changer; | 369 | CachedPtr<scene::MediatingDisplayChanger> mediating_display_changer; |
1181 | 363 | CachedPtr<graphics::GLProgramFactory> gl_program_factory; | 370 | CachedPtr<graphics::GLProgramFactory> gl_program_factory; |
1182 | 364 | CachedPtr<graphics::GLConfig> gl_config; | 371 | CachedPtr<graphics::GLConfig> gl_config; |
1183 | 372 | CachedPtr<scene::PromptSessionListener> prompt_session_listener; | ||
1184 | 373 | CachedPtr<scene::PromptSessionManager> prompt_session_manager; | ||
1185 | 365 | CachedPtr<scene::SessionCoordinator> session_coordinator; | 374 | CachedPtr<scene::SessionCoordinator> session_coordinator; |
1186 | 366 | CachedPtr<EmergencyCleanup> emergency_cleanup; | 375 | CachedPtr<EmergencyCleanup> emergency_cleanup; |
1187 | 367 | 376 | ||
1188 | 368 | 377 | ||
1189 | === added file 'include/server/mir/frontend/prompt_session.h' | |||
1190 | --- include/server/mir/frontend/prompt_session.h 1970-01-01 00:00:00 +0000 | |||
1191 | +++ include/server/mir/frontend/prompt_session.h 2014-06-18 17:25:24 +0000 | |||
1192 | @@ -0,0 +1,48 @@ | |||
1193 | 1 | /* | ||
1194 | 2 | * Copyright © 2014 Canonical Ltd. | ||
1195 | 3 | * | ||
1196 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
1197 | 5 | * under the terms of the GNU General Public License version 3, | ||
1198 | 6 | * as published by the Free Software Foundation. | ||
1199 | 7 | * | ||
1200 | 8 | * This program is distributed in the hope that it will be useful, | ||
1201 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1202 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1203 | 11 | * GNU General Public License for more details. | ||
1204 | 12 | * | ||
1205 | 13 | * You should have received a copy of the GNU General Public License | ||
1206 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1207 | 15 | * | ||
1208 | 16 | * Authored By: Nick Dedekind <nick.dedekind@canonical.com> | ||
1209 | 17 | */ | ||
1210 | 18 | |||
1211 | 19 | #ifndef MIR_FRONTEND_PROMPT_SESSION_H_ | ||
1212 | 20 | #define MIR_FRONTEND_PROMPT_SESSION_H_ | ||
1213 | 21 | |||
1214 | 22 | #include "mir_toolkit/common.h" | ||
1215 | 23 | |||
1216 | 24 | #include <sys/types.h> | ||
1217 | 25 | #include <vector> | ||
1218 | 26 | #include <string> | ||
1219 | 27 | #include <memory> | ||
1220 | 28 | |||
1221 | 29 | namespace mir | ||
1222 | 30 | { | ||
1223 | 31 | |||
1224 | 32 | namespace frontend | ||
1225 | 33 | { | ||
1226 | 34 | class PromptSession | ||
1227 | 35 | { | ||
1228 | 36 | public: | ||
1229 | 37 | virtual ~PromptSession() = default; | ||
1230 | 38 | |||
1231 | 39 | protected: | ||
1232 | 40 | PromptSession() = default; | ||
1233 | 41 | PromptSession(const PromptSession&) = delete; | ||
1234 | 42 | PromptSession& operator=(const PromptSession&) = delete; | ||
1235 | 43 | }; | ||
1236 | 44 | |||
1237 | 45 | } | ||
1238 | 46 | } | ||
1239 | 47 | |||
1240 | 48 | #endif // MIR_FRONTEND_PROMPT_SESSION_H_ | ||
1241 | 0 | 49 | ||
1242 | === modified file 'include/server/mir/frontend/session_mediator_report.h' | |||
1243 | --- include/server/mir/frontend/session_mediator_report.h 2014-03-06 06:05:17 +0000 | |||
1244 | +++ include/server/mir/frontend/session_mediator_report.h 2014-06-18 17:25:24 +0000 | |||
1245 | @@ -1,5 +1,5 @@ | |||
1246 | 1 | /* | 1 | /* |
1248 | 2 | * Copyright © 2012 Canonical Ltd. | 2 | * Copyright © 2012-2014 Canonical Ltd. |
1249 | 3 | * | 3 | * |
1250 | 4 | * This program is free software: you can redistribute it and/or modify it | 4 | * This program is free software: you can redistribute it and/or modify it |
1251 | 5 | * under the terms of the GNU General Public License version 3, | 5 | * under the terms of the GNU General Public License version 3, |
1252 | @@ -22,6 +22,8 @@ | |||
1253 | 22 | 22 | ||
1254 | 23 | #include <string> | 23 | #include <string> |
1255 | 24 | 24 | ||
1256 | 25 | #include <sys/types.h> | ||
1257 | 26 | |||
1258 | 25 | namespace mir | 27 | namespace mir |
1259 | 26 | { | 28 | { |
1260 | 27 | namespace frontend | 29 | namespace frontend |
1261 | @@ -46,8 +48,16 @@ | |||
1262 | 46 | 48 | ||
1263 | 47 | virtual void session_configure_surface_called(std::string const& app_name) = 0; | 49 | virtual void session_configure_surface_called(std::string const& app_name) = 0; |
1264 | 48 | 50 | ||
1265 | 51 | virtual void session_configure_surface_cursor_called(std::string const& app_name) = 0; | ||
1266 | 52 | |||
1267 | 49 | virtual void session_configure_display_called(std::string const& app_name) = 0; | 53 | virtual void session_configure_display_called(std::string const& app_name) = 0; |
1268 | 50 | 54 | ||
1269 | 55 | virtual void session_start_prompt_session_called(std::string const& app_name, pid_t application_process) = 0; | ||
1270 | 56 | |||
1271 | 57 | virtual void session_add_prompt_provider_called(std::string const& app_name, pid_t provider_process) = 0; | ||
1272 | 58 | |||
1273 | 59 | virtual void session_stop_prompt_session_called(std::string const& app_name) = 0; | ||
1274 | 60 | |||
1275 | 51 | virtual void session_error( | 61 | virtual void session_error( |
1276 | 52 | std::string const& app_name, | 62 | std::string const& app_name, |
1277 | 53 | char const* method, | 63 | char const* method, |
1278 | 54 | 64 | ||
1279 | === modified file 'include/server/mir/frontend/shell.h' | |||
1280 | --- include/server/mir/frontend/shell.h 2014-04-15 05:31:19 +0000 | |||
1281 | +++ include/server/mir/frontend/shell.h 2014-06-18 17:25:24 +0000 | |||
1282 | @@ -30,11 +30,13 @@ | |||
1283 | 30 | namespace scene | 30 | namespace scene |
1284 | 31 | { | 31 | { |
1285 | 32 | struct SurfaceCreationParameters; | 32 | struct SurfaceCreationParameters; |
1286 | 33 | struct PromptSessionCreationParameters; | ||
1287 | 33 | } | 34 | } |
1288 | 34 | namespace frontend | 35 | namespace frontend |
1289 | 35 | { | 36 | { |
1290 | 36 | class EventSink; | 37 | class EventSink; |
1291 | 37 | class Session; | 38 | class Session; |
1292 | 39 | class PromptSession; | ||
1293 | 38 | 40 | ||
1294 | 39 | class Shell | 41 | class Shell |
1295 | 40 | { | 42 | { |
1296 | @@ -54,6 +56,14 @@ | |||
1297 | 54 | 56 | ||
1298 | 55 | virtual void handle_surface_created(std::shared_ptr<Session> const& session) = 0; | 57 | virtual void handle_surface_created(std::shared_ptr<Session> const& session) = 0; |
1299 | 56 | 58 | ||
1300 | 59 | virtual std::shared_ptr<PromptSession> start_prompt_session_for(std::shared_ptr<Session> const& session, | ||
1301 | 60 | scene::PromptSessionCreationParameters const& params) = 0; | ||
1302 | 61 | virtual void add_prompt_provider_process_for(std::shared_ptr<PromptSession> const& prompt_session, | ||
1303 | 62 | pid_t process_id) = 0; | ||
1304 | 63 | virtual void add_prompt_provider_for(std::shared_ptr<PromptSession> const& prompt_session, | ||
1305 | 64 | std::shared_ptr<Session> const& session) = 0; | ||
1306 | 65 | virtual void stop_prompt_session(std::shared_ptr<PromptSession> const& prompt_session) = 0; | ||
1307 | 66 | |||
1308 | 57 | protected: | 67 | protected: |
1309 | 58 | Shell() = default; | 68 | Shell() = default; |
1310 | 59 | Shell(const Shell&) = delete; | 69 | Shell(const Shell&) = delete; |
1311 | 60 | 70 | ||
1312 | === modified file 'include/server/mir/frontend/surface.h' | |||
1313 | --- include/server/mir/frontend/surface.h 2014-05-22 11:31:21 +0000 | |||
1314 | +++ include/server/mir/frontend/surface.h 2014-06-18 17:25:24 +0000 | |||
1315 | @@ -20,12 +20,9 @@ | |||
1316 | 20 | #ifndef MIR_FRONTEND_SURFACE_H_ | 20 | #ifndef MIR_FRONTEND_SURFACE_H_ |
1317 | 21 | #define MIR_FRONTEND_SURFACE_H_ | 21 | #define MIR_FRONTEND_SURFACE_H_ |
1318 | 22 | 22 | ||
1319 | 23 | #include "mir/geometry/point.h" | ||
1320 | 24 | #include "mir/geometry/size.h" | 23 | #include "mir/geometry/size.h" |
1321 | 25 | #include "mir_toolkit/common.h" | 24 | #include "mir_toolkit/common.h" |
1322 | 26 | 25 | ||
1323 | 27 | #include <glm/glm.hpp> | ||
1324 | 28 | |||
1325 | 29 | #include <memory> | 26 | #include <memory> |
1326 | 30 | 27 | ||
1327 | 31 | namespace mir | 28 | namespace mir |
1328 | @@ -34,22 +31,17 @@ | |||
1329 | 34 | { | 31 | { |
1330 | 35 | class Buffer; | 32 | class Buffer; |
1331 | 36 | class InternalSurface; | 33 | class InternalSurface; |
1336 | 37 | } | 34 | class CursorImage; |
1333 | 38 | namespace input | ||
1334 | 39 | { | ||
1335 | 40 | class InputChannel; | ||
1337 | 41 | } | 35 | } |
1338 | 42 | 36 | ||
1339 | 43 | namespace frontend | 37 | namespace frontend |
1340 | 44 | { | 38 | { |
1341 | 45 | |||
1342 | 46 | class ClientBufferTracker; | 39 | class ClientBufferTracker; |
1343 | 47 | 40 | ||
1344 | 48 | class Surface | 41 | class Surface |
1345 | 49 | { | 42 | { |
1346 | 50 | public: | 43 | public: |
1349 | 51 | 44 | virtual ~Surface() = default; | |
1348 | 52 | virtual ~Surface() {} | ||
1350 | 53 | 45 | ||
1351 | 54 | /// Size of the client area of the surface (excluding any decorations) | 46 | /// Size of the client area of the surface (excluding any decorations) |
1352 | 55 | virtual geometry::Size client_size() const = 0; | 47 | virtual geometry::Size client_size() const = 0; |
1353 | @@ -62,6 +54,8 @@ | |||
1354 | 62 | 54 | ||
1355 | 63 | virtual int configure(MirSurfaceAttrib attrib, int value) = 0; | 55 | virtual int configure(MirSurfaceAttrib attrib, int value) = 0; |
1356 | 64 | 56 | ||
1357 | 57 | virtual void set_cursor_image(std::shared_ptr<graphics::CursorImage> const& image) = 0; | ||
1358 | 58 | |||
1359 | 65 | /** | 59 | /** |
1360 | 66 | * swap_buffers_blocking() is a convenience wrapper around swap_buffers() | 60 | * swap_buffers_blocking() is a convenience wrapper around swap_buffers() |
1361 | 67 | * it forces the current thread to block until complete() is called. | 61 | * it forces the current thread to block until complete() is called. |
1362 | 68 | 62 | ||
1363 | === modified file 'include/server/mir/graphics/cursor_images.h' | |||
1364 | --- include/server/mir/graphics/cursor_images.h 2014-04-28 23:15:05 +0000 | |||
1365 | +++ include/server/mir/graphics/cursor_images.h 2014-06-18 17:25:24 +0000 | |||
1366 | @@ -31,6 +31,8 @@ | |||
1367 | 31 | { | 31 | { |
1368 | 32 | class CursorImage; | 32 | class CursorImage; |
1369 | 33 | 33 | ||
1370 | 34 | geometry::Size const default_cursor_size{geometry::Width{64}, geometry::Height{64}}; | ||
1371 | 35 | |||
1372 | 34 | /// CursorImages is used to lookup cursor images. | 36 | /// CursorImages is used to lookup cursor images. |
1373 | 35 | class CursorImages | 37 | class CursorImages |
1374 | 36 | { | 38 | { |
1375 | 37 | 39 | ||
1376 | === added file 'include/server/mir/scene/null_prompt_session_listener.h' | |||
1377 | --- include/server/mir/scene/null_prompt_session_listener.h 1970-01-01 00:00:00 +0000 | |||
1378 | +++ include/server/mir/scene/null_prompt_session_listener.h 2014-06-18 17:25:24 +0000 | |||
1379 | @@ -0,0 +1,40 @@ | |||
1380 | 1 | /* | ||
1381 | 2 | * Copyright © 2014 Canonical Ltd. | ||
1382 | 3 | * | ||
1383 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
1384 | 5 | * under the terms of the GNU General Public License version 3, | ||
1385 | 6 | * as published by the Free Software Foundation. | ||
1386 | 7 | * | ||
1387 | 8 | * This program is distributed in the hope that it will be useful, | ||
1388 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1389 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1390 | 11 | * GNU General Public License for more details. | ||
1391 | 12 | * | ||
1392 | 13 | * You should have received a copy of the GNU General Public License | ||
1393 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1394 | 15 | * | ||
1395 | 16 | * Authored By: Nick Dedekind <nick.dedekind@canonical.com> | ||
1396 | 17 | */ | ||
1397 | 18 | |||
1398 | 19 | #ifndef MIR_SCENE_NULL_PROMPT_SESSION_LISTENER_H_ | ||
1399 | 20 | #define MIR_SCENE_NULL_PROMPT_SESSION_LISTENER_H_ | ||
1400 | 21 | |||
1401 | 22 | #include "mir/scene/prompt_session_listener.h" | ||
1402 | 23 | |||
1403 | 24 | namespace mir | ||
1404 | 25 | { | ||
1405 | 26 | namespace scene | ||
1406 | 27 | { | ||
1407 | 28 | class NullPromptSessionListener : public PromptSessionListener | ||
1408 | 29 | { | ||
1409 | 30 | public: | ||
1410 | 31 | void starting(std::shared_ptr<PromptSession> const&) override {} | ||
1411 | 32 | void stopping(std::shared_ptr<PromptSession> const&) override {} | ||
1412 | 33 | |||
1413 | 34 | void prompt_provider_added(PromptSession const&, std::shared_ptr<Session> const&) override {} | ||
1414 | 35 | void prompt_provider_removed(PromptSession const&, std::shared_ptr<Session> const&) override {} | ||
1415 | 36 | }; | ||
1416 | 37 | } | ||
1417 | 38 | } | ||
1418 | 39 | |||
1419 | 40 | #endif // MIR_SHELL_NULL_PROMPT_SESSION_LISTENER_H_ | ||
1420 | 0 | 41 | ||
1421 | === modified file 'include/server/mir/scene/null_surface_observer.h' | |||
1422 | --- include/server/mir/scene/null_surface_observer.h 2014-05-22 22:44:19 +0000 | |||
1423 | +++ include/server/mir/scene/null_surface_observer.h 2014-06-18 17:25:24 +0000 | |||
1424 | @@ -38,6 +38,7 @@ | |||
1425 | 38 | void frame_posted(int frames_available); | 38 | void frame_posted(int frames_available); |
1426 | 39 | void alpha_set_to(float alpha); | 39 | void alpha_set_to(float alpha); |
1427 | 40 | void transformation_set_to(glm::mat4 const& t); | 40 | void transformation_set_to(glm::mat4 const& t); |
1428 | 41 | void cursor_image_set_to(graphics::CursorImage const& image); | ||
1429 | 41 | void reception_mode_set_to(input::InputReceptionMode mode); | 42 | void reception_mode_set_to(input::InputReceptionMode mode); |
1430 | 42 | 43 | ||
1431 | 43 | protected: | 44 | protected: |
1432 | 44 | 45 | ||
1433 | === added file 'include/server/mir/scene/prompt_session.h' | |||
1434 | --- include/server/mir/scene/prompt_session.h 1970-01-01 00:00:00 +0000 | |||
1435 | +++ include/server/mir/scene/prompt_session.h 2014-06-18 17:25:24 +0000 | |||
1436 | @@ -0,0 +1,37 @@ | |||
1437 | 1 | /* | ||
1438 | 2 | * Copyright © 2014 Canonical Ltd. | ||
1439 | 3 | * | ||
1440 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
1441 | 5 | * under the terms of the GNU General Public License version 3, | ||
1442 | 6 | * as published by the Free Software Foundation. | ||
1443 | 7 | * | ||
1444 | 8 | * This program is distributed in the hope that it will be useful, | ||
1445 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1446 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1447 | 11 | * GNU General Public License for more details. | ||
1448 | 12 | * | ||
1449 | 13 | * You should have received a copy of the GNU General Public License | ||
1450 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1451 | 15 | * | ||
1452 | 16 | * Authored By: Nick Dedekind <nick.dedekind@canonical.com> | ||
1453 | 17 | */ | ||
1454 | 18 | |||
1455 | 19 | #ifndef MIR_SCENE_PROMPT_SESSION_H_ | ||
1456 | 20 | #define MIR_SCENE_PROMPT_SESSION_H_ | ||
1457 | 21 | |||
1458 | 22 | #include "mir/frontend/prompt_session.h" | ||
1459 | 23 | |||
1460 | 24 | namespace mir | ||
1461 | 25 | { | ||
1462 | 26 | namespace scene | ||
1463 | 27 | { | ||
1464 | 28 | class Session; | ||
1465 | 29 | |||
1466 | 30 | class PromptSession : public frontend::PromptSession | ||
1467 | 31 | { | ||
1468 | 32 | }; | ||
1469 | 33 | |||
1470 | 34 | } | ||
1471 | 35 | } | ||
1472 | 36 | |||
1473 | 37 | #endif // MIR_SHELL_PROMPT_SESSION_H_ | ||
1474 | 0 | 38 | ||
1475 | === added file 'include/server/mir/scene/prompt_session_creation_parameters.h' | |||
1476 | --- include/server/mir/scene/prompt_session_creation_parameters.h 1970-01-01 00:00:00 +0000 | |||
1477 | +++ include/server/mir/scene/prompt_session_creation_parameters.h 2014-06-18 17:25:24 +0000 | |||
1478 | @@ -0,0 +1,36 @@ | |||
1479 | 1 | /* | ||
1480 | 2 | * Copyright © 2014 Canonical Ltd. | ||
1481 | 3 | * | ||
1482 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
1483 | 5 | * under the terms of the GNU General Public License version 3, | ||
1484 | 6 | * as published by the Free Software Foundation. | ||
1485 | 7 | * | ||
1486 | 8 | * This program is distributed in the hope that it will be useful, | ||
1487 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1488 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1489 | 11 | * GNU General Public License for more details. | ||
1490 | 12 | * | ||
1491 | 13 | * You should have received a copy of the GNU General Public License | ||
1492 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1493 | 15 | * | ||
1494 | 16 | * Authored By: Nick Dedekind <nick.dedekind@canonical.com> | ||
1495 | 17 | */ | ||
1496 | 18 | |||
1497 | 19 | #ifndef MIR_SCENE_PROMPT_SESSION_CREATION_PARAMETERS_H_ | ||
1498 | 20 | #define MIR_SCENE_PROMPT_SESSION_CREATION_PARAMETERS_H_ | ||
1499 | 21 | |||
1500 | 22 | #include <sys/types.h> | ||
1501 | 23 | |||
1502 | 24 | namespace mir | ||
1503 | 25 | { | ||
1504 | 26 | namespace scene | ||
1505 | 27 | { | ||
1506 | 28 | |||
1507 | 29 | struct PromptSessionCreationParameters | ||
1508 | 30 | { | ||
1509 | 31 | pid_t application_pid = 0; | ||
1510 | 32 | }; | ||
1511 | 33 | } | ||
1512 | 34 | } | ||
1513 | 35 | |||
1514 | 36 | #endif /* MIR_SCENE_PROMPT_SESSION_CREATION_PARAMETERS_H_ */ | ||
1515 | 0 | 37 | ||
1516 | === added file 'include/server/mir/scene/prompt_session_listener.h' | |||
1517 | --- include/server/mir/scene/prompt_session_listener.h 1970-01-01 00:00:00 +0000 | |||
1518 | +++ include/server/mir/scene/prompt_session_listener.h 2014-06-18 17:25:24 +0000 | |||
1519 | @@ -0,0 +1,52 @@ | |||
1520 | 1 | /* | ||
1521 | 2 | * Copyright © 2014 Canonical Ltd. | ||
1522 | 3 | * | ||
1523 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
1524 | 5 | * under the terms of the GNU General Public License version 3, | ||
1525 | 6 | * as published by the Free Software Foundation. | ||
1526 | 7 | * | ||
1527 | 8 | * This program is distributed in the hope that it will be useful, | ||
1528 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1529 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1530 | 11 | * GNU General Public License for more details. | ||
1531 | 12 | * | ||
1532 | 13 | * You should have received a copy of the GNU General Public License | ||
1533 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1534 | 15 | * | ||
1535 | 16 | * Authored By: Nick Dedekind <nick.dedekind@canonical.com> | ||
1536 | 17 | */ | ||
1537 | 18 | |||
1538 | 19 | #ifndef MIR_SCENE_PROMPT_SESSION_LISTENER_H_ | ||
1539 | 20 | #define MIR_SCENE_PROMPT_SESSION_LISTENER_H_ | ||
1540 | 21 | |||
1541 | 22 | #include <memory> | ||
1542 | 23 | |||
1543 | 24 | namespace mir | ||
1544 | 25 | { | ||
1545 | 26 | namespace scene | ||
1546 | 27 | { | ||
1547 | 28 | class Session; | ||
1548 | 29 | class PromptSession; | ||
1549 | 30 | |||
1550 | 31 | class PromptSessionListener | ||
1551 | 32 | { | ||
1552 | 33 | public: | ||
1553 | 34 | virtual void starting(std::shared_ptr<PromptSession> const& prompt_session) = 0; | ||
1554 | 35 | virtual void stopping(std::shared_ptr<PromptSession> const& prompt_session) = 0; | ||
1555 | 36 | |||
1556 | 37 | virtual void prompt_provider_added(PromptSession const& prompt_session, std::shared_ptr<Session> const& prompt_provider) = 0; | ||
1557 | 38 | virtual void prompt_provider_removed(PromptSession const& prompt_session, std::shared_ptr<Session> const& prompt_provider) = 0; | ||
1558 | 39 | |||
1559 | 40 | protected: | ||
1560 | 41 | PromptSessionListener() = default; | ||
1561 | 42 | virtual ~PromptSessionListener() = default; | ||
1562 | 43 | |||
1563 | 44 | PromptSessionListener(const PromptSessionListener&) = delete; | ||
1564 | 45 | PromptSessionListener& operator=(const PromptSessionListener&) = delete; | ||
1565 | 46 | }; | ||
1566 | 47 | |||
1567 | 48 | } | ||
1568 | 49 | } | ||
1569 | 50 | |||
1570 | 51 | |||
1571 | 52 | #endif // MIR_SCENE_PROMPT_SESSION_LISTENER_H_ | ||
1572 | 0 | 53 | ||
1573 | === added file 'include/server/mir/scene/prompt_session_manager.h' | |||
1574 | --- include/server/mir/scene/prompt_session_manager.h 1970-01-01 00:00:00 +0000 | |||
1575 | +++ include/server/mir/scene/prompt_session_manager.h 2014-06-18 17:25:24 +0000 | |||
1576 | @@ -0,0 +1,110 @@ | |||
1577 | 1 | /* | ||
1578 | 2 | * Copyright © 2014 Canonical Ltd. | ||
1579 | 3 | * | ||
1580 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
1581 | 5 | * under the terms of the GNU General Public License version 3, | ||
1582 | 6 | * as published by the Free Software Foundation. | ||
1583 | 7 | * | ||
1584 | 8 | * This program is distributed in the hope that it will be useful, | ||
1585 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1586 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1587 | 11 | * GNU General Public License for more details. | ||
1588 | 12 | * | ||
1589 | 13 | * You should have received a copy of the GNU General Public License | ||
1590 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1591 | 15 | * | ||
1592 | 16 | * Authored By: Nick Dedekind <nick.dedekind@canonical.com> | ||
1593 | 17 | */ | ||
1594 | 18 | |||
1595 | 19 | #ifndef MIR_SCENE_PROMPT_SESSION_MANAGER_H_ | ||
1596 | 20 | #define MIR_SCENE_PROMPT_SESSION_MANAGER_H_ | ||
1597 | 21 | |||
1598 | 22 | #include <sys/types.h> | ||
1599 | 23 | #include <memory> | ||
1600 | 24 | #include <functional> | ||
1601 | 25 | |||
1602 | 26 | namespace mir | ||
1603 | 27 | { | ||
1604 | 28 | namespace scene | ||
1605 | 29 | { | ||
1606 | 30 | class Session; | ||
1607 | 31 | class PromptSession; | ||
1608 | 32 | struct PromptSessionCreationParameters; | ||
1609 | 33 | |||
1610 | 34 | class PromptSessionManager | ||
1611 | 35 | { | ||
1612 | 36 | public: | ||
1613 | 37 | virtual ~PromptSessionManager() = default; | ||
1614 | 38 | |||
1615 | 39 | /** | ||
1616 | 40 | * Start a new prompt session | ||
1617 | 41 | * \param [in] session The prompt helper session | ||
1618 | 42 | * \param [in] params The creation parameters for constructing the prompt session | ||
1619 | 43 | */ | ||
1620 | 44 | virtual std::shared_ptr<PromptSession> start_prompt_session_for(std::shared_ptr<Session> const& session, | ||
1621 | 45 | PromptSessionCreationParameters const& params) const = 0; | ||
1622 | 46 | |||
1623 | 47 | /** | ||
1624 | 48 | * Stop a started prompt session | ||
1625 | 49 | * \param [in] prompt_session The prompt session | ||
1626 | 50 | */ | ||
1627 | 51 | virtual void stop_prompt_session(std::shared_ptr<PromptSession> const& prompt_session) const = 0; | ||
1628 | 52 | |||
1629 | 53 | /** | ||
1630 | 54 | * Add a prompt provider to an existing prompt session | ||
1631 | 55 | * \param [in] prompt_session The prompt session | ||
1632 | 56 | * \param [in] prompt_provider The prompt provider to add to the prompt session | ||
1633 | 57 | */ | ||
1634 | 58 | virtual void add_prompt_provider(std::shared_ptr<PromptSession> const& prompt_session, | ||
1635 | 59 | std::shared_ptr<Session> const& prompt_provider) const = 0; | ||
1636 | 60 | |||
1637 | 61 | /** | ||
1638 | 62 | * Add a process id to wait for to the prompt session | ||
1639 | 63 | * \param [in] prompt_session The prompt session | ||
1640 | 64 | * \param [in] process_id The process id to wait for | ||
1641 | 65 | */ | ||
1642 | 66 | virtual void add_prompt_provider_by_pid(std::shared_ptr<PromptSession> const& prompt_session, | ||
1643 | 67 | pid_t process_id) const = 0; | ||
1644 | 68 | |||
1645 | 69 | /** | ||
1646 | 70 | * Add a session that may have been expected by a prompt session. | ||
1647 | 71 | * \param [in] session The new session that was being expected | ||
1648 | 72 | */ | ||
1649 | 73 | virtual void add_expected_session(std::shared_ptr<Session> const& new_session) const = 0; | ||
1650 | 74 | |||
1651 | 75 | /** | ||
1652 | 76 | * Remove a session from all associated prompt sessions | ||
1653 | 77 | * \param [in] session The new session that is to be removed | ||
1654 | 78 | */ | ||
1655 | 79 | virtual void remove_session(std::shared_ptr<Session> const& session) const = 0; | ||
1656 | 80 | |||
1657 | 81 | /** | ||
1658 | 82 | * Retrieve the application session for a prompt session | ||
1659 | 83 | * \param [in] prompt_session The prompt session | ||
1660 | 84 | */ | ||
1661 | 85 | virtual std::shared_ptr<Session> application_for(std::shared_ptr<PromptSession> const& prompt_session) const = 0; | ||
1662 | 86 | |||
1663 | 87 | /** | ||
1664 | 88 | * Retrieve the helper session for a prompt session | ||
1665 | 89 | * \param [in] prompt_session The prompt session | ||
1666 | 90 | */ | ||
1667 | 91 | virtual std::shared_ptr<Session> helper_for(std::shared_ptr<PromptSession> const& prompt_session) const = 0; | ||
1668 | 92 | |||
1669 | 93 | /** | ||
1670 | 94 | * Iterate over all the prompt providers associated with a prompt session | ||
1671 | 95 | * \param [in] prompt_session The prompt session | ||
1672 | 96 | * \param [in] f The callback function to call for each provider | ||
1673 | 97 | */ | ||
1674 | 98 | virtual void for_each_provider_in(std::shared_ptr<PromptSession> const& prompt_session, | ||
1675 | 99 | std::function<void(std::shared_ptr<Session> const& prompt_provider)> const& f) const = 0; | ||
1676 | 100 | |||
1677 | 101 | protected: | ||
1678 | 102 | PromptSessionManager() = default; | ||
1679 | 103 | PromptSessionManager(const PromptSessionManager&) = delete; | ||
1680 | 104 | PromptSessionManager& operator=(const PromptSessionManager&) = delete; | ||
1681 | 105 | }; | ||
1682 | 106 | |||
1683 | 107 | } | ||
1684 | 108 | } | ||
1685 | 109 | |||
1686 | 110 | #endif // MIR_SCENE_PROMPT_SESSION_MANAGER_H_ | ||
1687 | 0 | 111 | ||
1688 | === modified file 'include/server/mir/scene/session.h' | |||
1689 | --- include/server/mir/scene/session.h 2014-04-15 05:31:19 +0000 | |||
1690 | +++ include/server/mir/scene/session.h 2014-06-18 17:25:24 +0000 | |||
1691 | @@ -40,6 +40,9 @@ | |||
1692 | 40 | virtual std::shared_ptr<Surface> default_surface() const = 0; | 40 | virtual std::shared_ptr<Surface> default_surface() const = 0; |
1693 | 41 | virtual void set_lifecycle_state(MirLifecycleState state) = 0; | 41 | virtual void set_lifecycle_state(MirLifecycleState state) = 0; |
1694 | 42 | virtual void send_display_config(graphics::DisplayConfiguration const&) = 0; | 42 | virtual void send_display_config(graphics::DisplayConfiguration const&) = 0; |
1695 | 43 | |||
1696 | 44 | virtual void start_prompt_session() = 0; | ||
1697 | 45 | virtual void stop_prompt_session() = 0; | ||
1698 | 43 | }; | 46 | }; |
1699 | 44 | } | 47 | } |
1700 | 45 | } | 48 | } |
1701 | 46 | 49 | ||
1702 | === modified file 'include/server/mir/scene/surface.h' | |||
1703 | --- include/server/mir/scene/surface.h 2014-05-22 11:31:21 +0000 | |||
1704 | +++ include/server/mir/scene/surface.h 2014-06-18 17:25:24 +0000 | |||
1705 | @@ -31,6 +31,7 @@ | |||
1706 | 31 | namespace input { class InputChannel; } | 31 | namespace input { class InputChannel; } |
1707 | 32 | namespace shell { class InputTargeter; } | 32 | namespace shell { class InputTargeter; } |
1708 | 33 | namespace geometry { class Rectangle; } | 33 | namespace geometry { class Rectangle; } |
1709 | 34 | namespace graphics { class CursorImage; } | ||
1710 | 34 | 35 | ||
1711 | 35 | namespace scene | 36 | namespace scene |
1712 | 36 | { | 37 | { |
1713 | @@ -70,6 +71,9 @@ | |||
1714 | 70 | virtual void set_transformation(glm::mat4 const& t) = 0; | 71 | virtual void set_transformation(glm::mat4 const& t) = 0; |
1715 | 71 | virtual void set_alpha(float alpha) = 0; | 72 | virtual void set_alpha(float alpha) = 0; |
1716 | 72 | virtual void force_requests_to_complete() = 0; | 73 | virtual void force_requests_to_complete() = 0; |
1717 | 74 | |||
1718 | 75 | virtual void set_cursor_image(std::shared_ptr<graphics::CursorImage> const& image) = 0; | ||
1719 | 76 | virtual std::shared_ptr<graphics::CursorImage> cursor_image() = 0; | ||
1720 | 73 | 77 | ||
1721 | 74 | virtual void add_observer(std::shared_ptr<SurfaceObserver> const& observer) = 0; | 78 | virtual void add_observer(std::shared_ptr<SurfaceObserver> const& observer) = 0; |
1722 | 75 | virtual void remove_observer(std::weak_ptr<SurfaceObserver> const& observer) = 0; | 79 | virtual void remove_observer(std::weak_ptr<SurfaceObserver> const& observer) = 0; |
1723 | 76 | 80 | ||
1724 | === modified file 'include/server/mir/scene/surface_observer.h' | |||
1725 | --- include/server/mir/scene/surface_observer.h 2014-05-22 22:44:19 +0000 | |||
1726 | +++ include/server/mir/scene/surface_observer.h 2014-06-18 17:25:24 +0000 | |||
1727 | @@ -32,6 +32,10 @@ | |||
1728 | 32 | struct Size; | 32 | struct Size; |
1729 | 33 | struct Point; | 33 | struct Point; |
1730 | 34 | } | 34 | } |
1731 | 35 | namespace graphics | ||
1732 | 36 | { | ||
1733 | 37 | class CursorImage; | ||
1734 | 38 | } | ||
1735 | 35 | 39 | ||
1736 | 36 | namespace scene | 40 | namespace scene |
1737 | 37 | { | 41 | { |
1738 | @@ -46,6 +50,7 @@ | |||
1739 | 46 | virtual void alpha_set_to(float alpha) = 0; | 50 | virtual void alpha_set_to(float alpha) = 0; |
1740 | 47 | virtual void transformation_set_to(glm::mat4 const& t) = 0; | 51 | virtual void transformation_set_to(glm::mat4 const& t) = 0; |
1741 | 48 | virtual void reception_mode_set_to(input::InputReceptionMode mode) = 0; | 52 | virtual void reception_mode_set_to(input::InputReceptionMode mode) = 0; |
1742 | 53 | virtual void cursor_image_set_to(graphics::CursorImage const& image) = 0; | ||
1743 | 49 | 54 | ||
1744 | 50 | protected: | 55 | protected: |
1745 | 51 | SurfaceObserver() = default; | 56 | SurfaceObserver() = default; |
1746 | 52 | 57 | ||
1747 | === modified file 'include/server/mir/shell/session_coordinator_wrapper.h' | |||
1748 | --- include/server/mir/shell/session_coordinator_wrapper.h 2014-05-23 12:59:00 +0000 | |||
1749 | +++ include/server/mir/shell/session_coordinator_wrapper.h 2014-06-18 17:25:24 +0000 | |||
1750 | @@ -48,6 +48,20 @@ | |||
1751 | 48 | 48 | ||
1752 | 49 | void handle_surface_created(std::shared_ptr<frontend::Session> const& session) override; | 49 | void handle_surface_created(std::shared_ptr<frontend::Session> const& session) override; |
1753 | 50 | 50 | ||
1754 | 51 | std::shared_ptr<frontend::PromptSession> start_prompt_session_for( | ||
1755 | 52 | std::shared_ptr<frontend::Session> const& session, | ||
1756 | 53 | scene::PromptSessionCreationParameters const& params) override; | ||
1757 | 54 | |||
1758 | 55 | void add_prompt_provider_process_for( | ||
1759 | 56 | std::shared_ptr<frontend::PromptSession> const& prompt_session, | ||
1760 | 57 | pid_t process_id) override; | ||
1761 | 58 | |||
1762 | 59 | void add_prompt_provider_for( | ||
1763 | 60 | std::shared_ptr<frontend::PromptSession> const& prompt_session, | ||
1764 | 61 | std::shared_ptr<frontend::Session> const& session) override; | ||
1765 | 62 | |||
1766 | 63 | void stop_prompt_session(std::shared_ptr<frontend::PromptSession> const& prompt_session) override; | ||
1767 | 64 | |||
1768 | 51 | protected: | 65 | protected: |
1769 | 52 | std::shared_ptr<scene::SessionCoordinator> const wrapped; | 66 | std::shared_ptr<scene::SessionCoordinator> const wrapped; |
1770 | 53 | }; | 67 | }; |
1771 | 54 | 68 | ||
1772 | === modified file 'include/server/mir/time/timer.h' | |||
1773 | --- include/server/mir/time/timer.h 2014-05-22 09:56:17 +0000 | |||
1774 | +++ include/server/mir/time/timer.h 2014-06-18 17:25:24 +0000 | |||
1775 | @@ -58,7 +58,14 @@ | |||
1776 | 58 | */ | 58 | */ |
1777 | 59 | virtual std::unique_ptr<Alarm> notify_at(Timestamp time_point, | 59 | virtual std::unique_ptr<Alarm> notify_at(Timestamp time_point, |
1778 | 60 | std::function<void()> callback) = 0; | 60 | std::function<void()> callback) = 0; |
1780 | 61 | 61 | /** | |
1781 | 62 | * \brief Create an Alarm that will not fire until scheduled | ||
1782 | 63 | * | ||
1783 | 64 | * \param callback Function to call when the Alarm signals | ||
1784 | 65 | * | ||
1785 | 66 | * \return A handle to an Alarm that can later be scheduled | ||
1786 | 67 | */ | ||
1787 | 68 | virtual std::unique_ptr<Alarm> create_alarm(std::function<void()> callback) = 0; | ||
1788 | 62 | 69 | ||
1789 | 63 | Timer(Timer const&) = delete; | 70 | Timer(Timer const&) = delete; |
1790 | 64 | Timer& operator=(Timer const&) = delete; | 71 | Timer& operator=(Timer const&) = delete; |
1791 | 65 | 72 | ||
1792 | === added file 'include/shared/mir/thread_name.h' | |||
1793 | --- include/shared/mir/thread_name.h 1970-01-01 00:00:00 +0000 | |||
1794 | +++ include/shared/mir/thread_name.h 2014-06-18 17:25:24 +0000 | |||
1795 | @@ -0,0 +1,29 @@ | |||
1796 | 1 | /* | ||
1797 | 2 | * Copyright © 2014 Canonical Ltd. | ||
1798 | 3 | * | ||
1799 | 4 | * This program is free software: you can redistribute it and/or modify | ||
1800 | 5 | * it under the terms of the GNU Lesser General Public License version 3 as | ||
1801 | 6 | * published by the Free Software Foundation. | ||
1802 | 7 | * | ||
1803 | 8 | * This program is distributed in the hope that it will be useful, | ||
1804 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1805 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1806 | 11 | * GNU Lesser General Public License for more details. | ||
1807 | 12 | * | ||
1808 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
1809 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1810 | 15 | * | ||
1811 | 16 | * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com> | ||
1812 | 17 | */ | ||
1813 | 18 | |||
1814 | 19 | #ifndef MIR_THREAD_NAME_H_ | ||
1815 | 20 | #define MIR_THREAD_NAME_H_ | ||
1816 | 21 | |||
1817 | 22 | #include <string> | ||
1818 | 23 | |||
1819 | 24 | namespace mir | ||
1820 | 25 | { | ||
1821 | 26 | void set_thread_name(std::string const& name); | ||
1822 | 27 | } | ||
1823 | 28 | |||
1824 | 29 | #endif /* MIR_THREAD_NAME_H_ */ | ||
1825 | 0 | 30 | ||
1826 | === modified file 'include/shared/mir_toolkit/client_types.h' | |||
1827 | --- include/shared/mir_toolkit/client_types.h 2014-05-22 11:31:21 +0000 | |||
1828 | +++ include/shared/mir_toolkit/client_types.h 2014-06-18 17:25:24 +0000 | |||
1829 | @@ -46,6 +46,7 @@ | |||
1830 | 46 | typedef struct MirConnection MirConnection; | 46 | typedef struct MirConnection MirConnection; |
1831 | 47 | typedef struct MirSurface MirSurface; | 47 | typedef struct MirSurface MirSurface; |
1832 | 48 | typedef struct MirScreencast MirScreencast; | 48 | typedef struct MirScreencast MirScreencast; |
1833 | 49 | typedef struct MirPromptSession MirPromptSession; | ||
1834 | 49 | 50 | ||
1835 | 50 | /** | 51 | /** |
1836 | 51 | * Returned by asynchronous functions. Must not be free'd by | 52 | * Returned by asynchronous functions. Must not be free'd by |
1837 | @@ -105,7 +106,7 @@ | |||
1838 | 105 | 106 | ||
1839 | 106 | /** | 107 | /** |
1840 | 107 | * Callback called when a request for client file descriptors completes | 108 | * Callback called when a request for client file descriptors completes |
1842 | 108 | * \param [in] connection The connection associated with the display change | 109 | * \param [in] prompt_session The prompt session |
1843 | 109 | * \param [in] count The number of FDs allocated | 110 | * \param [in] count The number of FDs allocated |
1844 | 110 | * \param [in] fds Array of FDs | 111 | * \param [in] fds Array of FDs |
1845 | 111 | * \param [in,out] context The context provided by client | 112 | * \param [in,out] context The context provided by client |
1846 | @@ -114,7 +115,7 @@ | |||
1847 | 114 | */ | 115 | */ |
1848 | 115 | 116 | ||
1849 | 116 | typedef void (*mir_client_fd_callback)( | 117 | typedef void (*mir_client_fd_callback)( |
1851 | 117 | MirConnection* connection, size_t count, int const* fds, void* context); | 118 | MirPromptSession *prompt_session, size_t count, int const* fds, void* context); |
1852 | 118 | 119 | ||
1853 | 119 | /** | 120 | /** |
1854 | 120 | * MirBufferUsage specifies how a surface can and will be used. A "hardware" | 121 | * MirBufferUsage specifies how a surface can and will be used. A "hardware" |
1855 | @@ -319,6 +320,31 @@ | |||
1856 | 319 | */ | 320 | */ |
1857 | 320 | typedef void (*mir_screencast_callback)(MirScreencast *screencast, void *client_context); | 321 | typedef void (*mir_screencast_callback)(MirScreencast *screencast, void *client_context); |
1858 | 321 | 322 | ||
1859 | 323 | /** | ||
1860 | 324 | * Callback member of MirPromptSession for handling of prompt sessions. | ||
1861 | 325 | * \param [in] prompt_provider The prompt session associated with the callback | ||
1862 | 326 | * \param [in,out] context The context provided by the client | ||
1863 | 327 | */ | ||
1864 | 328 | typedef void (*mir_prompt_session_callback)(MirPromptSession* prompt_provider, void* context); | ||
1865 | 329 | |||
1866 | 330 | /** | ||
1867 | 331 | * Callback member of MirPromptSession for adding prompt providers | ||
1868 | 332 | * \param [in] prompt_provider The prompt session associated with the callback | ||
1869 | 333 | * \param [in] added True if the session was added, false otherwise | ||
1870 | 334 | * \param [in,out] context The context provided by the client | ||
1871 | 335 | */ | ||
1872 | 336 | typedef void (*mir_prompt_session_add_prompt_provider_callback)( | ||
1873 | 337 | MirPromptSession* prompt_provider, MirBool added, void* context); | ||
1874 | 338 | |||
1875 | 339 | /** | ||
1876 | 340 | * Callback member of MirPromptSession for handling of prompt sessions events. | ||
1877 | 341 | * \param [in] prompt_provider The prompt session associated with the callback | ||
1878 | 342 | * \param [in] state The state of the prompt session | ||
1879 | 343 | * \param [in,out] context The context provided by the client | ||
1880 | 344 | */ | ||
1881 | 345 | typedef void (*mir_prompt_session_state_change_callback)( | ||
1882 | 346 | MirPromptSession* prompt_provider, MirPromptSessionState state, void* context); | ||
1883 | 347 | |||
1884 | 322 | #ifdef __cplusplus | 348 | #ifdef __cplusplus |
1885 | 323 | } | 349 | } |
1886 | 324 | /**@}*/ | 350 | /**@}*/ |
1887 | 325 | 351 | ||
1888 | === modified file 'include/shared/mir_toolkit/common.h' | |||
1889 | --- include/shared/mir_toolkit/common.h 2014-05-05 09:02:17 +0000 | |||
1890 | +++ include/shared/mir_toolkit/common.h 2014-06-18 17:25:24 +0000 | |||
1891 | @@ -88,6 +88,12 @@ | |||
1892 | 88 | mir_power_mode_off /* Powered down. */ | 88 | mir_power_mode_off /* Powered down. */ |
1893 | 89 | } MirPowerMode; | 89 | } MirPowerMode; |
1894 | 90 | 90 | ||
1895 | 91 | typedef enum MirPromptSessionState | ||
1896 | 92 | { | ||
1897 | 93 | mir_prompt_session_state_stopped = 0, | ||
1898 | 94 | mir_prompt_session_state_started | ||
1899 | 95 | } MirPromptSessionState; | ||
1900 | 96 | |||
1901 | 91 | /** | 97 | /** |
1902 | 92 | * The order of components in a format enum matches the | 98 | * The order of components in a format enum matches the |
1903 | 93 | * order of the components as they would be written in an | 99 | * order of the components as they would be written in an |
1904 | 94 | 100 | ||
1905 | === modified file 'include/shared/mir_toolkit/event.h' | |||
1906 | --- include/shared/mir_toolkit/event.h 2014-03-06 06:05:17 +0000 | |||
1907 | +++ include/shared/mir_toolkit/event.h 2014-06-18 17:25:24 +0000 | |||
1908 | @@ -40,7 +40,8 @@ | |||
1909 | 40 | mir_event_type_key, | 40 | mir_event_type_key, |
1910 | 41 | mir_event_type_motion, | 41 | mir_event_type_motion, |
1911 | 42 | mir_event_type_surface, | 42 | mir_event_type_surface, |
1913 | 43 | mir_event_type_resize | 43 | mir_event_type_resize, |
1914 | 44 | mir_event_type_prompt_session_state_change | ||
1915 | 44 | } MirEventType; | 45 | } MirEventType; |
1916 | 45 | 46 | ||
1917 | 46 | typedef enum { | 47 | typedef enum { |
1918 | @@ -204,6 +205,13 @@ | |||
1919 | 204 | int height; | 205 | int height; |
1920 | 205 | } MirResizeEvent; | 206 | } MirResizeEvent; |
1921 | 206 | 207 | ||
1922 | 208 | typedef struct | ||
1923 | 209 | { | ||
1924 | 210 | MirEventType type; | ||
1925 | 211 | |||
1926 | 212 | MirPromptSessionState new_state; | ||
1927 | 213 | } MirPromptSessionEvent; | ||
1928 | 214 | |||
1929 | 207 | typedef union | 215 | typedef union |
1930 | 208 | { | 216 | { |
1931 | 209 | MirEventType type; | 217 | MirEventType type; |
1932 | @@ -211,6 +219,7 @@ | |||
1933 | 211 | MirMotionEvent motion; | 219 | MirMotionEvent motion; |
1934 | 212 | MirSurfaceEvent surface; | 220 | MirSurfaceEvent surface; |
1935 | 213 | MirResizeEvent resize; | 221 | MirResizeEvent resize; |
1936 | 222 | MirPromptSessionEvent prompt_session; | ||
1937 | 214 | } MirEvent; | 223 | } MirEvent; |
1938 | 215 | 224 | ||
1939 | 216 | #ifdef __cplusplus | 225 | #ifdef __cplusplus |
1940 | 217 | 226 | ||
1941 | === added file 'include/test/mir_test/barrier.h' | |||
1942 | --- include/test/mir_test/barrier.h 1970-01-01 00:00:00 +0000 | |||
1943 | +++ include/test/mir_test/barrier.h 2014-06-18 17:25:24 +0000 | |||
1944 | @@ -0,0 +1,61 @@ | |||
1945 | 1 | /* | ||
1946 | 2 | * Copyright © 2014 Canonical Ltd. | ||
1947 | 3 | * | ||
1948 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
1949 | 5 | * under the terms of the GNU General Public License version 3, | ||
1950 | 6 | * as published by the Free Software Foundation. | ||
1951 | 7 | * | ||
1952 | 8 | * This program is distributed in the hope that it will be useful, | ||
1953 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1954 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1955 | 11 | * GNU General Public License for more details. | ||
1956 | 12 | * | ||
1957 | 13 | * You should have received a copy of the GNU General Public License | ||
1958 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1959 | 15 | * | ||
1960 | 16 | * Authored By: Alan Griffiths <alan@octopull.co.uk> | ||
1961 | 17 | */ | ||
1962 | 18 | |||
1963 | 19 | #ifndef MIR_TEST_BARRIER_H_ | ||
1964 | 20 | #define MIR_TEST_BARRIER_H_ | ||
1965 | 21 | |||
1966 | 22 | #include <mutex> | ||
1967 | 23 | #include <condition_variable> | ||
1968 | 24 | |||
1969 | 25 | namespace mir | ||
1970 | 26 | { | ||
1971 | 27 | namespace test | ||
1972 | 28 | { | ||
1973 | 29 | class Barrier | ||
1974 | 30 | { | ||
1975 | 31 | public: | ||
1976 | 32 | explicit Barrier(unsigned wait_threads) : wait_threads{wait_threads} {} | ||
1977 | 33 | |||
1978 | 34 | void reset(unsigned threads) | ||
1979 | 35 | { | ||
1980 | 36 | std::unique_lock<decltype(mutex)> lock(mutex); | ||
1981 | 37 | wait_threads = threads; | ||
1982 | 38 | } | ||
1983 | 39 | |||
1984 | 40 | void ready() | ||
1985 | 41 | { | ||
1986 | 42 | std::unique_lock<decltype(mutex)> lock(mutex); | ||
1987 | 43 | --wait_threads; | ||
1988 | 44 | cv.notify_all(); | ||
1989 | 45 | if (!cv.wait_for(lock, std::chrono::minutes(1), [&]{ return wait_threads == 0; })) | ||
1990 | 46 | throw std::runtime_error("Timeout"); | ||
1991 | 47 | } | ||
1992 | 48 | |||
1993 | 49 | private: | ||
1994 | 50 | Barrier(Barrier const&) = default; | ||
1995 | 51 | Barrier& operator=(Barrier const&) = default; | ||
1996 | 52 | unsigned wait_threads; | ||
1997 | 53 | std::mutex mutex; | ||
1998 | 54 | std::condition_variable cv; | ||
1999 | 55 | }; | ||
2000 | 56 | } | ||
2001 | 57 | } | ||
2002 | 58 | |||
2003 | 59 | |||
2004 | 60 | |||
2005 | 61 | #endif /* MIR_TEST_BARRIER_H_ */ | ||
2006 | 0 | 62 | ||
2007 | === added file 'include/test/mir_test/current_thread_name.h' | |||
2008 | --- include/test/mir_test/current_thread_name.h 1970-01-01 00:00:00 +0000 | |||
2009 | +++ include/test/mir_test/current_thread_name.h 2014-06-18 17:25:24 +0000 | |||
2010 | @@ -0,0 +1,34 @@ | |||
2011 | 1 | /* | ||
2012 | 2 | * Copyright © 2014 Canonical Ltd. | ||
2013 | 3 | * | ||
2014 | 4 | * This program is free software: you can redistribute it and/or modify | ||
2015 | 5 | * it under the terms of the GNU General Public License version 3 as | ||
2016 | 6 | * published by the Free Software Foundation. | ||
2017 | 7 | * | ||
2018 | 8 | * This program is distributed in the hope that it will be useful, | ||
2019 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2020 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2021 | 11 | * GNU General Public License for more details. | ||
2022 | 12 | * | ||
2023 | 13 | * You should have received a copy of the GNU General Public License | ||
2024 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2025 | 15 | * | ||
2026 | 16 | * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com> | ||
2027 | 17 | */ | ||
2028 | 18 | |||
2029 | 19 | #ifndef MIR_TEST_CURRENT_THREAD_NAME_H_ | ||
2030 | 20 | #define MIR_TEST_CURRENT_THREAD_NAME_H_ | ||
2031 | 21 | |||
2032 | 22 | #include <string> | ||
2033 | 23 | |||
2034 | 24 | namespace mir | ||
2035 | 25 | { | ||
2036 | 26 | namespace test | ||
2037 | 27 | { | ||
2038 | 28 | |||
2039 | 29 | std::string current_thread_name(); | ||
2040 | 30 | |||
2041 | 31 | } | ||
2042 | 32 | } | ||
2043 | 33 | |||
2044 | 34 | #endif | ||
2045 | 0 | 35 | ||
2046 | === added file 'include/test/mir_test/fake_clock.h' | |||
2047 | --- include/test/mir_test/fake_clock.h 1970-01-01 00:00:00 +0000 | |||
2048 | +++ include/test/mir_test/fake_clock.h 2014-06-18 17:25:24 +0000 | |||
2049 | @@ -0,0 +1,72 @@ | |||
2050 | 1 | /* | ||
2051 | 2 | * Copyright © 2014 Canonical Ltd. | ||
2052 | 3 | * | ||
2053 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
2054 | 5 | * under the terms of the GNU General Public License version 3, | ||
2055 | 6 | * as published by the Free Software Foundation. | ||
2056 | 7 | * | ||
2057 | 8 | * This program is distributed in the hope that it will be useful, | ||
2058 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2059 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2060 | 11 | * GNU General Public License for more details. | ||
2061 | 12 | * | ||
2062 | 13 | * You should have received a copy of the GNU General Public License | ||
2063 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2064 | 15 | * | ||
2065 | 16 | * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com> | ||
2066 | 17 | */ | ||
2067 | 18 | |||
2068 | 19 | #ifndef MIR_TEST_FAKE_CLOCK_H_ | ||
2069 | 20 | #define MIR_TEST_FAKE_CLOCK_H_ | ||
2070 | 21 | |||
2071 | 22 | #include <chrono> | ||
2072 | 23 | #include <functional> | ||
2073 | 24 | #include <list> | ||
2074 | 25 | |||
2075 | 26 | namespace mir | ||
2076 | 27 | { | ||
2077 | 28 | namespace test | ||
2078 | 29 | { | ||
2079 | 30 | /** | ||
2080 | 31 | * @brief An invasive time source for Mocks/Stubs/Fakes that depend on timing | ||
2081 | 32 | */ | ||
2082 | 33 | class FakeClock | ||
2083 | 34 | { | ||
2084 | 35 | public: | ||
2085 | 36 | typedef std::chrono::nanoseconds duration; | ||
2086 | 37 | typedef duration::rep rep; | ||
2087 | 38 | typedef duration::period period; | ||
2088 | 39 | typedef std::chrono::time_point<FakeClock, duration> time_point; | ||
2089 | 40 | |||
2090 | 41 | static constexpr bool is_steady = false; | ||
2091 | 42 | time_point now() const; | ||
2092 | 43 | |||
2093 | 44 | FakeClock(); | ||
2094 | 45 | /** | ||
2095 | 46 | * \brief Advance the fake clock | ||
2096 | 47 | * \note Advancing by a negative duration will move the clock backwards | ||
2097 | 48 | */ | ||
2098 | 49 | template<typename rep, typename period> | ||
2099 | 50 | void advance_time(std::chrono::duration<rep, period> by) | ||
2100 | 51 | { | ||
2101 | 52 | advance_time_ns(std::chrono::duration_cast<std::chrono::nanoseconds>(by)); | ||
2102 | 53 | } | ||
2103 | 54 | |||
2104 | 55 | /** | ||
2105 | 56 | * \brief Register an event callback when the time is changed | ||
2106 | 57 | * \param cb Function to call when the time is changed. | ||
2107 | 58 | * This function is called with the new time. | ||
2108 | 59 | * If the function returns false, it will no longer be called | ||
2109 | 60 | * on subsequent time changes. | ||
2110 | 61 | */ | ||
2111 | 62 | void register_time_change_callback(std::function<bool(time_point)> cb); | ||
2112 | 63 | private: | ||
2113 | 64 | void advance_time_ns(std::chrono::nanoseconds by); | ||
2114 | 65 | std::chrono::nanoseconds current_time; | ||
2115 | 66 | std::list<std::function<bool(time_point)>> callbacks; | ||
2116 | 67 | }; | ||
2117 | 68 | |||
2118 | 69 | } | ||
2119 | 70 | } | ||
2120 | 71 | |||
2121 | 72 | #endif // MIR_TEST_FAKE_CLOCK_H_ | ||
2122 | 0 | 73 | ||
2123 | === added file 'include/test/mir_test/signal.h' | |||
2124 | --- include/test/mir_test/signal.h 1970-01-01 00:00:00 +0000 | |||
2125 | +++ include/test/mir_test/signal.h 2014-06-18 17:25:24 +0000 | |||
2126 | @@ -0,0 +1,63 @@ | |||
2127 | 1 | /* | ||
2128 | 2 | * Copyright © 2014 Canonical Ltd. | ||
2129 | 3 | * | ||
2130 | 4 | * This program is free software: you can redistribute it and/or modify | ||
2131 | 5 | * it under the terms of the GNU General Public License version 3 as | ||
2132 | 6 | * published by the Free Software Foundation. | ||
2133 | 7 | * | ||
2134 | 8 | * This program is distributed in the hope that it will be useful, | ||
2135 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2136 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2137 | 11 | * GNU General Public License for more details. | ||
2138 | 12 | * | ||
2139 | 13 | * You should have received a copy of the GNU General Public License | ||
2140 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2141 | 15 | * | ||
2142 | 16 | * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com> | ||
2143 | 17 | */ | ||
2144 | 18 | |||
2145 | 19 | #ifndef MIR_TEST_SIGNAL_H_ | ||
2146 | 20 | #define MIR_TEST_SIGNAL_H_ | ||
2147 | 21 | |||
2148 | 22 | #include <condition_variable> | ||
2149 | 23 | #include <chrono> | ||
2150 | 24 | #include <mutex> | ||
2151 | 25 | |||
2152 | 26 | namespace mir | ||
2153 | 27 | { | ||
2154 | 28 | namespace test | ||
2155 | 29 | { | ||
2156 | 30 | /** | ||
2157 | 31 | * @brief A threadsafe, waitable signal | ||
2158 | 32 | */ | ||
2159 | 33 | class Signal | ||
2160 | 34 | { | ||
2161 | 35 | public: | ||
2162 | 36 | Signal(); | ||
2163 | 37 | |||
2164 | 38 | void raise(); | ||
2165 | 39 | bool raised(); | ||
2166 | 40 | |||
2167 | 41 | void wait(); | ||
2168 | 42 | template<typename rep, typename period> | ||
2169 | 43 | bool wait_for(std::chrono::duration<rep, period> delay) | ||
2170 | 44 | { | ||
2171 | 45 | std::unique_lock<decltype(mutex)> lock(mutex); | ||
2172 | 46 | return cv.wait_for(lock, delay, [this]() { return signalled; }); | ||
2173 | 47 | } | ||
2174 | 48 | template<class Clock, class Duration> | ||
2175 | 49 | bool wait_until(std::chrono::time_point<Clock, Duration> const& time) | ||
2176 | 50 | { | ||
2177 | 51 | std::unique_lock<decltype(mutex)> lock(mutex); | ||
2178 | 52 | return cv.wait_until(lock, time, [this]() { return signalled; }); | ||
2179 | 53 | } | ||
2180 | 54 | |||
2181 | 55 | private: | ||
2182 | 56 | std::mutex mutex; | ||
2183 | 57 | std::condition_variable cv; | ||
2184 | 58 | bool signalled; | ||
2185 | 59 | }; | ||
2186 | 60 | } | ||
2187 | 61 | } | ||
2188 | 62 | |||
2189 | 63 | #endif // MIR_TEST_SIGNAL_H_ | ||
2190 | 0 | 64 | ||
2191 | === modified file 'include/test/mir_test/test_protobuf_client.h' | |||
2192 | --- include/test/mir_test/test_protobuf_client.h 2013-08-28 03:41:48 +0000 | |||
2193 | +++ include/test/mir_test/test_protobuf_client.h 2014-06-18 17:25:24 +0000 | |||
2194 | @@ -21,6 +21,7 @@ | |||
2195 | 21 | #define MIR_TEST_TEST_CLIENT_H_ | 21 | #define MIR_TEST_TEST_CLIENT_H_ |
2196 | 22 | 22 | ||
2197 | 23 | #include "mir_protobuf.pb.h" | 23 | #include "mir_protobuf.pb.h" |
2198 | 24 | #include "wait_condition.h" | ||
2199 | 24 | 25 | ||
2200 | 25 | #include <gmock/gmock.h> | 26 | #include <gmock/gmock.h> |
2201 | 26 | 27 | ||
2202 | @@ -49,6 +50,9 @@ | |||
2203 | 49 | mir::protobuf::Connection connection; | 50 | mir::protobuf::Connection connection; |
2204 | 50 | mir::protobuf::DisplayConfiguration disp_config; | 51 | mir::protobuf::DisplayConfiguration disp_config; |
2205 | 51 | mir::protobuf::DisplayConfiguration disp_config_response; | 52 | mir::protobuf::DisplayConfiguration disp_config_response; |
2206 | 53 | mir::protobuf::PromptSessionParameters prompt_session_parameters; | ||
2207 | 54 | mir::protobuf::PromptProvider prompt_provider; | ||
2208 | 55 | mir::protobuf::Void prompt_session; | ||
2209 | 52 | 56 | ||
2210 | 53 | MOCK_METHOD0(connect_done, void()); | 57 | MOCK_METHOD0(connect_done, void()); |
2211 | 54 | MOCK_METHOD0(create_surface_done, void()); | 58 | MOCK_METHOD0(create_surface_done, void()); |
2212 | @@ -57,6 +61,9 @@ | |||
2213 | 57 | MOCK_METHOD0(disconnect_done, void()); | 61 | MOCK_METHOD0(disconnect_done, void()); |
2214 | 58 | MOCK_METHOD0(drm_auth_magic_done, void()); | 62 | MOCK_METHOD0(drm_auth_magic_done, void()); |
2215 | 59 | MOCK_METHOD0(display_configure_done, void()); | 63 | MOCK_METHOD0(display_configure_done, void()); |
2216 | 64 | MOCK_METHOD0(prompt_session_start_done, void()); | ||
2217 | 65 | MOCK_METHOD0(prompt_session_add_prompt_provider_done, void()); | ||
2218 | 66 | MOCK_METHOD0(prompt_session_stop_done, void()); | ||
2219 | 60 | 67 | ||
2220 | 61 | void on_connect_done(); | 68 | void on_connect_done(); |
2221 | 62 | 69 | ||
2222 | @@ -94,6 +101,12 @@ | |||
2223 | 94 | 101 | ||
2224 | 95 | void wait_for_configure_display_done(); | 102 | void wait_for_configure_display_done(); |
2225 | 96 | 103 | ||
2226 | 104 | void wait_for_prompt_session_start_done(); | ||
2227 | 105 | |||
2228 | 106 | void wait_for_prompt_session_add_prompt_provider_done(); | ||
2229 | 107 | |||
2230 | 108 | void wait_for_prompt_session_stop_done(); | ||
2231 | 109 | |||
2232 | 97 | const int maxwait; | 110 | const int maxwait; |
2233 | 98 | std::atomic<bool> connect_done_called; | 111 | std::atomic<bool> connect_done_called; |
2234 | 99 | std::atomic<bool> create_surface_called; | 112 | std::atomic<bool> create_surface_called; |
2235 | @@ -104,6 +117,10 @@ | |||
2236 | 104 | std::atomic<bool> configure_display_done_called; | 117 | std::atomic<bool> configure_display_done_called; |
2237 | 105 | std::atomic<bool> tfd_done_called; | 118 | std::atomic<bool> tfd_done_called; |
2238 | 106 | 119 | ||
2239 | 120 | WaitCondition wc_prompt_session_start; | ||
2240 | 121 | WaitCondition wc_prompt_session_add; | ||
2241 | 122 | WaitCondition wc_prompt_session_stop; | ||
2242 | 123 | |||
2243 | 107 | std::atomic<int> connect_done_count; | 124 | std::atomic<int> connect_done_count; |
2244 | 108 | std::atomic<int> create_surface_done_count; | 125 | std::atomic<int> create_surface_done_count; |
2245 | 109 | std::atomic<int> disconnect_done_count; | 126 | std::atomic<int> disconnect_done_count; |
2246 | 110 | 127 | ||
2247 | === modified file 'include/test/mir_test_doubles/fake_ipc_factory.h' | |||
2248 | --- include/test/mir_test_doubles/fake_ipc_factory.h 2014-05-13 10:03:15 +0000 | |||
2249 | +++ include/test/mir_test_doubles/fake_ipc_factory.h 2014-06-18 17:25:24 +0000 | |||
2250 | @@ -40,24 +40,26 @@ | |||
2251 | 40 | std::shared_ptr<frontend::DisplayChanger> const& changer, | 40 | std::shared_ptr<frontend::DisplayChanger> const& changer, |
2252 | 41 | std::shared_ptr<graphics::GraphicBufferAllocator> const& buffer_allocator, | 41 | std::shared_ptr<graphics::GraphicBufferAllocator> const& buffer_allocator, |
2253 | 42 | std::shared_ptr<frontend::SessionMediatorReport> const& sm_report, | 42 | std::shared_ptr<frontend::SessionMediatorReport> const& sm_report, |
2257 | 43 | const std::shared_ptr<frontend::EventSink>& sink, | 43 | std::shared_ptr<frontend::EventSink> const& sink, |
2258 | 44 | const std::shared_ptr<frontend::Screencast>& effective_screencast, | 44 | std::shared_ptr<frontend::Screencast> const& effective_screencast, |
2259 | 45 | const frontend::ConnectionContext& connection_context) | 45 | frontend::ConnectionContext const& connection_context, |
2260 | 46 | std::shared_ptr<graphics::CursorImages> const& cursor_images) | ||
2261 | 46 | { | 47 | { |
2262 | 47 | return frontend::DefaultIpcFactory::make_mediator( | 48 | return frontend::DefaultIpcFactory::make_mediator( |
2263 | 48 | shell, graphics_platform, changer, buffer_allocator, | 49 | shell, graphics_platform, changer, buffer_allocator, |
2265 | 49 | sm_report, sink, effective_screencast, connection_context); | 50 | sm_report, sink, effective_screencast, connection_context, cursor_images); |
2266 | 50 | } | 51 | } |
2267 | 51 | 52 | ||
2269 | 52 | MOCK_METHOD8(make_mediator, std::shared_ptr<frontend::detail::DisplayServer>( | 53 | MOCK_METHOD9(make_mediator, std::shared_ptr<frontend::detail::DisplayServer>( |
2270 | 53 | std::shared_ptr<frontend::Shell> const& shell, | 54 | std::shared_ptr<frontend::Shell> const& shell, |
2271 | 54 | std::shared_ptr<graphics::Platform> const& graphics_platform, | 55 | std::shared_ptr<graphics::Platform> const& graphics_platform, |
2272 | 55 | std::shared_ptr<frontend::DisplayChanger> const& changer, | 56 | std::shared_ptr<frontend::DisplayChanger> const& changer, |
2273 | 56 | std::shared_ptr<graphics::GraphicBufferAllocator> const& buffer_allocator, | 57 | std::shared_ptr<graphics::GraphicBufferAllocator> const& buffer_allocator, |
2274 | 57 | std::shared_ptr<frontend::SessionMediatorReport> const& sm_report, | 58 | std::shared_ptr<frontend::SessionMediatorReport> const& sm_report, |
2278 | 58 | const std::shared_ptr<frontend::EventSink>& sink, | 59 | std::shared_ptr<frontend::EventSink> const& sink, |
2279 | 59 | const std::shared_ptr<frontend::Screencast>& effective_screencast, | 60 | std::shared_ptr<frontend::Screencast> const& effective_screencast, |
2280 | 60 | const frontend::ConnectionContext& connection_context)); | 61 | frontend::ConnectionContext const& connection_context, |
2281 | 62 | std::shared_ptr<graphics::CursorImages> const& cursor_images)); | ||
2282 | 61 | }; | 63 | }; |
2283 | 62 | } | 64 | } |
2284 | 63 | } | 65 | } |
2285 | 64 | 66 | ||
2286 | === modified file 'include/test/mir_test_doubles/fake_renderable.h' | |||
2287 | --- include/test/mir_test_doubles/fake_renderable.h 2014-05-07 02:56:33 +0000 | |||
2288 | +++ include/test/mir_test_doubles/fake_renderable.h 2014-06-18 17:25:24 +0000 | |||
2289 | @@ -19,6 +19,7 @@ | |||
2290 | 19 | #ifndef MIR_TEST_DOUBLES_FAKE_RENDERABLE_H_ | 19 | #ifndef MIR_TEST_DOUBLES_FAKE_RENDERABLE_H_ |
2291 | 20 | #define MIR_TEST_DOUBLES_FAKE_RENDERABLE_H_ | 20 | #define MIR_TEST_DOUBLES_FAKE_RENDERABLE_H_ |
2292 | 21 | 21 | ||
2293 | 22 | #include "stub_buffer.h" | ||
2294 | 22 | #include "mir/graphics/renderable.h" | 23 | #include "mir/graphics/renderable.h" |
2295 | 23 | #define GLM_FORCE_RADIANS | 24 | #define GLM_FORCE_RADIANS |
2296 | 24 | #include <glm/gtc/matrix_transform.hpp> | 25 | #include <glm/gtc/matrix_transform.hpp> |
2297 | @@ -34,12 +35,36 @@ | |||
2298 | 34 | class FakeRenderable : public graphics::Renderable | 35 | class FakeRenderable : public graphics::Renderable |
2299 | 35 | { | 36 | { |
2300 | 36 | public: | 37 | public: |
2307 | 37 | FakeRenderable(int x, int y, int width, int height, | 38 | FakeRenderable(int x, int y, int width, int height) |
2308 | 38 | float opacity=1.0f, | 39 | : FakeRenderable{geometry::Rectangle{{x,y},{width,height}}} |
2309 | 39 | bool rectangular=true, | 40 | { |
2310 | 40 | bool visible=true, | 41 | } |
2311 | 41 | bool posted=true) | 42 | FakeRenderable(geometry::Rectangle display_area) |
2312 | 42 | : rect{{x, y}, {width, height}}, | 43 | : FakeRenderable{display_area, 1.0f, true, true, true} |
2313 | 44 | { | ||
2314 | 45 | } | ||
2315 | 46 | |||
2316 | 47 | FakeRenderable(geometry::Rectangle display_area, | ||
2317 | 48 | float opacity) | ||
2318 | 49 | : FakeRenderable{display_area, opacity, true, true, true} | ||
2319 | 50 | { | ||
2320 | 51 | } | ||
2321 | 52 | |||
2322 | 53 | FakeRenderable(geometry::Rectangle display_area, | ||
2323 | 54 | float opacity, | ||
2324 | 55 | bool rectangular, | ||
2325 | 56 | bool visible) | ||
2326 | 57 | : FakeRenderable{display_area, opacity, rectangular, visible, true} | ||
2327 | 58 | { | ||
2328 | 59 | } | ||
2329 | 60 | |||
2330 | 61 | FakeRenderable(geometry::Rectangle display_area, | ||
2331 | 62 | float opacity, | ||
2332 | 63 | bool rectangular, | ||
2333 | 64 | bool visible, | ||
2334 | 65 | bool posted) | ||
2335 | 66 | : buf{std::make_shared<StubBuffer>()}, | ||
2336 | 67 | rect(display_area), | ||
2337 | 43 | opacity(opacity), | 68 | opacity(opacity), |
2338 | 44 | rectangular(rectangular), | 69 | rectangular(rectangular), |
2339 | 45 | visible_(visible), | 70 | visible_(visible), |
2340 | 46 | 71 | ||
2341 | === modified file 'include/test/mir_test_doubles/mock_buffer.h' | |||
2342 | --- include/test/mir_test_doubles/mock_buffer.h 2014-03-06 06:05:17 +0000 | |||
2343 | +++ include/test/mir_test_doubles/mock_buffer.h 2014-06-18 17:25:24 +0000 | |||
2344 | @@ -63,7 +63,7 @@ | |||
2345 | 63 | MOCK_CONST_METHOD0(pixel_format, MirPixelFormat()); | 63 | MOCK_CONST_METHOD0(pixel_format, MirPixelFormat()); |
2346 | 64 | MOCK_CONST_METHOD0(native_buffer_handle, std::shared_ptr<graphics::NativeBuffer>()); | 64 | MOCK_CONST_METHOD0(native_buffer_handle, std::shared_ptr<graphics::NativeBuffer>()); |
2347 | 65 | 65 | ||
2349 | 66 | MOCK_METHOD0(bind_to_texture, void()); | 66 | MOCK_METHOD0(gl_bind_to_texture, void()); |
2350 | 67 | MOCK_CONST_METHOD0(id, graphics::BufferID()); | 67 | MOCK_CONST_METHOD0(id, graphics::BufferID()); |
2351 | 68 | 68 | ||
2352 | 69 | MOCK_CONST_METHOD0(can_bypass, bool()); | 69 | MOCK_CONST_METHOD0(can_bypass, bool()); |
2353 | 70 | 70 | ||
2354 | === modified file 'include/test/mir_test_doubles/mock_buffer_stream.h' | |||
2355 | --- include/test/mir_test_doubles/mock_buffer_stream.h 2014-04-14 19:35:21 +0000 | |||
2356 | +++ include/test/mir_test_doubles/mock_buffer_stream.h 2014-06-18 17:25:24 +0000 | |||
2357 | @@ -44,7 +44,8 @@ | |||
2358 | 44 | ON_CALL(*this, buffers_ready_for_compositor()) | 44 | ON_CALL(*this, buffers_ready_for_compositor()) |
2359 | 45 | .WillByDefault(testing::Invoke(this, &MockBufferStream::buffers_ready)); | 45 | .WillByDefault(testing::Invoke(this, &MockBufferStream::buffers_ready)); |
2360 | 46 | } | 46 | } |
2362 | 47 | MOCK_METHOD2(swap_client_buffers, void(graphics::Buffer*, std::function<void(graphics::Buffer*)> completee)); | 47 | MOCK_METHOD1(acquire_client_buffer, void(std::function<void(graphics::Buffer* buffer)>)); |
2363 | 48 | MOCK_METHOD1(release_client_buffer, void(graphics::Buffer*)); | ||
2364 | 48 | MOCK_METHOD1(lock_compositor_buffer, | 49 | MOCK_METHOD1(lock_compositor_buffer, |
2365 | 49 | std::shared_ptr<graphics::Buffer>(void const*)); | 50 | std::shared_ptr<graphics::Buffer>(void const*)); |
2366 | 50 | MOCK_METHOD0(lock_snapshot_buffer, std::shared_ptr<graphics::Buffer>()); | 51 | MOCK_METHOD0(lock_snapshot_buffer, std::shared_ptr<graphics::Buffer>()); |
2367 | 51 | 52 | ||
2368 | === modified file 'include/test/mir_test_doubles/mock_display_buffer.h' | |||
2369 | --- include/test/mir_test_doubles/mock_display_buffer.h 2014-05-22 09:56:17 +0000 | |||
2370 | +++ include/test/mir_test_doubles/mock_display_buffer.h 2014-06-18 17:25:24 +0000 | |||
2371 | @@ -36,8 +36,6 @@ | |||
2372 | 36 | MockDisplayBuffer() | 36 | MockDisplayBuffer() |
2373 | 37 | { | 37 | { |
2374 | 38 | using namespace testing; | 38 | using namespace testing; |
2375 | 39 | ON_CALL(*this, can_bypass()) | ||
2376 | 40 | .WillByDefault(Return(false)); | ||
2377 | 41 | ON_CALL(*this, view_area()) | 39 | ON_CALL(*this, view_area()) |
2378 | 42 | .WillByDefault(Return(geometry::Rectangle{{0,0},{0,0}})); | 40 | .WillByDefault(Return(geometry::Rectangle{{0,0},{0,0}})); |
2379 | 43 | } | 41 | } |
2380 | @@ -45,9 +43,9 @@ | |||
2381 | 45 | MOCK_METHOD0(make_current, void()); | 43 | MOCK_METHOD0(make_current, void()); |
2382 | 46 | MOCK_METHOD0(release_current, void()); | 44 | MOCK_METHOD0(release_current, void()); |
2383 | 47 | MOCK_METHOD0(post_update, void()); | 45 | MOCK_METHOD0(post_update, void()); |
2386 | 48 | MOCK_CONST_METHOD0(can_bypass, bool()); | 46 | MOCK_METHOD1(post_renderables_if_optimizable, bool(graphics::RenderableList const&)); |
2385 | 49 | MOCK_METHOD1(post_renderables_if_optimizable, bool(graphics::RenderableList const&)); | ||
2387 | 50 | MOCK_CONST_METHOD0(orientation, MirOrientation()); | 47 | MOCK_CONST_METHOD0(orientation, MirOrientation()); |
2388 | 48 | MOCK_CONST_METHOD0(uses_alpha, bool()); | ||
2389 | 51 | }; | 49 | }; |
2390 | 52 | 50 | ||
2391 | 53 | } | 51 | } |
2392 | 54 | 52 | ||
2393 | === modified file 'include/test/mir_test_doubles/mock_display_device.h' | |||
2394 | --- include/test/mir_test_doubles/mock_display_device.h 2014-05-20 20:01:43 +0000 | |||
2395 | +++ include/test/mir_test_doubles/mock_display_device.h 2014-06-18 17:25:24 +0000 | |||
2396 | @@ -36,12 +36,11 @@ | |||
2397 | 36 | public: | 36 | public: |
2398 | 37 | ~MockDisplayDevice() noexcept {} | 37 | ~MockDisplayDevice() noexcept {} |
2399 | 38 | MOCK_METHOD1(mode, void(MirPowerMode)); | 38 | MOCK_METHOD1(mode, void(MirPowerMode)); |
2402 | 39 | MOCK_METHOD1(render_gl, void(graphics::android::SwappingGLContext const&)); | 39 | MOCK_METHOD1(post_gl, void(graphics::android::SwappingGLContext const&)); |
2403 | 40 | MOCK_METHOD3(prepare_overlays, void( | 40 | MOCK_METHOD3(post_overlays, bool( |
2404 | 41 | graphics::android::SwappingGLContext const&, | 41 | graphics::android::SwappingGLContext const&, |
2405 | 42 | graphics::RenderableList const&, | 42 | graphics::RenderableList const&, |
2406 | 43 | graphics::android::RenderableListCompositor const&)); | 43 | graphics::android::RenderableListCompositor const&)); |
2407 | 44 | MOCK_METHOD1(post, void(graphics::Buffer const&)); | ||
2408 | 45 | MOCK_CONST_METHOD1(apply_orientation, bool(MirOrientation)); | 44 | MOCK_CONST_METHOD1(apply_orientation, bool(MirOrientation)); |
2409 | 46 | }; | 45 | }; |
2410 | 47 | } | 46 | } |
2411 | 48 | 47 | ||
2412 | === added file 'include/test/mir_test_doubles/mock_frame_dropping_policy_factory.h' | |||
2413 | --- include/test/mir_test_doubles/mock_frame_dropping_policy_factory.h 1970-01-01 00:00:00 +0000 | |||
2414 | +++ include/test/mir_test_doubles/mock_frame_dropping_policy_factory.h 2014-06-18 17:25:24 +0000 | |||
2415 | @@ -0,0 +1,83 @@ | |||
2416 | 1 | /* | ||
2417 | 2 | * Copyright © 2014 Canonical Ltd. | ||
2418 | 3 | * | ||
2419 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
2420 | 5 | * under the terms of the GNU General Public License version 3, | ||
2421 | 6 | * as published by the Free Software Foundation. | ||
2422 | 7 | * | ||
2423 | 8 | * This program is distributed in the hope that it will be useful, | ||
2424 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2425 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2426 | 11 | * GNU General Public License for more details. | ||
2427 | 12 | * | ||
2428 | 13 | * You should have received a copy of the GNU General Public License | ||
2429 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2430 | 15 | * | ||
2431 | 16 | * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com> | ||
2432 | 17 | */ | ||
2433 | 18 | |||
2434 | 19 | |||
2435 | 20 | #ifndef MIR_TEST_DOUBLES_MOCK_FRAME_DROPPING_POLICY_FACTORY_H_ | ||
2436 | 21 | #define MIR_TEST_DOUBLES_MOCK_FRAME_DROPPING_POLICY_FACTORY_H_ | ||
2437 | 22 | |||
2438 | 23 | #include "mir/compositor/frame_dropping_policy_factory.h" | ||
2439 | 24 | #include "mir/compositor/frame_dropping_policy.h" | ||
2440 | 25 | |||
2441 | 26 | #include <unordered_set> | ||
2442 | 27 | #include <functional> | ||
2443 | 28 | |||
2444 | 29 | #include <gmock/gmock.h> | ||
2445 | 30 | |||
2446 | 31 | namespace mc = mir::compositor; | ||
2447 | 32 | |||
2448 | 33 | namespace mir | ||
2449 | 34 | { | ||
2450 | 35 | namespace test | ||
2451 | 36 | { | ||
2452 | 37 | namespace doubles | ||
2453 | 38 | { | ||
2454 | 39 | |||
2455 | 40 | class MockFrameDroppingPolicyFactory; | ||
2456 | 41 | |||
2457 | 42 | class MockFrameDroppingPolicy : public mc::FrameDroppingPolicy | ||
2458 | 43 | { | ||
2459 | 44 | public: | ||
2460 | 45 | MockFrameDroppingPolicy(std::function<void(void)> callback, | ||
2461 | 46 | MockFrameDroppingPolicyFactory const* parent); | ||
2462 | 47 | ~MockFrameDroppingPolicy(); | ||
2463 | 48 | |||
2464 | 49 | MOCK_METHOD0(swap_now_blocking, void(void)); | ||
2465 | 50 | MOCK_METHOD0(swap_unblocked, void(void)); | ||
2466 | 51 | |||
2467 | 52 | void trigger(); | ||
2468 | 53 | |||
2469 | 54 | private: | ||
2470 | 55 | friend class MockFrameDroppingPolicyFactory; | ||
2471 | 56 | void parent_destroyed(); | ||
2472 | 57 | |||
2473 | 58 | std::function<void(void)> callback; | ||
2474 | 59 | MockFrameDroppingPolicyFactory const* parent; | ||
2475 | 60 | }; | ||
2476 | 61 | |||
2477 | 62 | class MockFrameDroppingPolicyFactory : public mc::FrameDroppingPolicyFactory | ||
2478 | 63 | { | ||
2479 | 64 | public: | ||
2480 | 65 | std::unique_ptr<mc::FrameDroppingPolicy> create_policy(std::function<void(void)> drop_frame) const override; | ||
2481 | 66 | |||
2482 | 67 | ~MockFrameDroppingPolicyFactory(); | ||
2483 | 68 | |||
2484 | 69 | void trigger_policies() const; | ||
2485 | 70 | |||
2486 | 71 | private: | ||
2487 | 72 | friend class MockFrameDroppingPolicy; | ||
2488 | 73 | |||
2489 | 74 | void policy_destroyed(MockFrameDroppingPolicy* policy) const; | ||
2490 | 75 | mutable std::unordered_set<MockFrameDroppingPolicy*> policies; | ||
2491 | 76 | }; | ||
2492 | 77 | |||
2493 | 78 | } | ||
2494 | 79 | } | ||
2495 | 80 | } | ||
2496 | 81 | |||
2497 | 82 | |||
2498 | 83 | #endif // MIR_TEST_DOUBLES_MOCK_FRAME_DROPPING_POLICY_FACTORY_H_ | ||
2499 | 0 | 84 | ||
2500 | === modified file 'include/test/mir_test_doubles/mock_frontend_surface.h' | |||
2501 | --- include/test/mir_test_doubles/mock_frontend_surface.h 2014-05-22 11:31:21 +0000 | |||
2502 | +++ include/test/mir_test_doubles/mock_frontend_surface.h 2014-06-18 17:25:24 +0000 | |||
2503 | @@ -46,6 +46,8 @@ | |||
2504 | 46 | 46 | ||
2505 | 47 | MOCK_CONST_METHOD0(supports_input, bool()); | 47 | MOCK_CONST_METHOD0(supports_input, bool()); |
2506 | 48 | MOCK_CONST_METHOD0(client_input_fd, int()); | 48 | MOCK_CONST_METHOD0(client_input_fd, int()); |
2507 | 49 | |||
2508 | 50 | MOCK_METHOD1(set_cursor_image, void(std::shared_ptr<graphics::CursorImage> const&)); | ||
2509 | 49 | 51 | ||
2510 | 50 | MOCK_METHOD2(configure, int(MirSurfaceAttrib, int)); | 52 | MOCK_METHOD2(configure, int(MirSurfaceAttrib, int)); |
2511 | 51 | }; | 53 | }; |
2512 | 52 | 54 | ||
2513 | === added file 'include/test/mir_test_doubles/mock_prompt_session_listener.h' | |||
2514 | --- include/test/mir_test_doubles/mock_prompt_session_listener.h 1970-01-01 00:00:00 +0000 | |||
2515 | +++ include/test/mir_test_doubles/mock_prompt_session_listener.h 2014-06-18 17:25:24 +0000 | |||
2516 | @@ -0,0 +1,48 @@ | |||
2517 | 1 | /* | ||
2518 | 2 | * Copyright © 2014 Canonical Ltd. | ||
2519 | 3 | * | ||
2520 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
2521 | 5 | * under the terms of the GNU General Public License version 3, | ||
2522 | 6 | * as published by the Free Software Foundation. | ||
2523 | 7 | * | ||
2524 | 8 | * This program is distributed in the hope that it will be useful, | ||
2525 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2526 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2527 | 11 | * GNU General Public License for more details. | ||
2528 | 12 | * | ||
2529 | 13 | * You should have received a copy of the GNU General Public License | ||
2530 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2531 | 15 | * | ||
2532 | 16 | * Authored By: Nick Dedekind <nick.dedekind@canonical.com> | ||
2533 | 17 | */ | ||
2534 | 18 | |||
2535 | 19 | #ifndef MIR_TEST_DOUBLES_MOCK_PROMPT_SESSION_LISTENER_H_ | ||
2536 | 20 | #define MIR_TEST_DOUBLES_MOCK_PROMPT_SESSION_LISTENER_H_ | ||
2537 | 21 | |||
2538 | 22 | #include "mir/scene/prompt_session_listener.h" | ||
2539 | 23 | |||
2540 | 24 | #include <gmock/gmock.h> | ||
2541 | 25 | |||
2542 | 26 | namespace mir | ||
2543 | 27 | { | ||
2544 | 28 | namespace test | ||
2545 | 29 | { | ||
2546 | 30 | namespace doubles | ||
2547 | 31 | { | ||
2548 | 32 | |||
2549 | 33 | struct MockPromptSessionListener : public scene::PromptSessionListener | ||
2550 | 34 | { | ||
2551 | 35 | virtual ~MockPromptSessionListener() noexcept(true) {} | ||
2552 | 36 | |||
2553 | 37 | MOCK_METHOD1(starting, void(std::shared_ptr<scene::PromptSession> const&)); | ||
2554 | 38 | MOCK_METHOD1(stopping, void(std::shared_ptr<scene::PromptSession> const&)); | ||
2555 | 39 | |||
2556 | 40 | MOCK_METHOD2(prompt_provider_added, void(scene::PromptSession const&, std::shared_ptr<scene::Session> const&)); | ||
2557 | 41 | MOCK_METHOD2(prompt_provider_removed, void(scene::PromptSession const&, std::shared_ptr<scene::Session> const&)); | ||
2558 | 42 | }; | ||
2559 | 43 | |||
2560 | 44 | } | ||
2561 | 45 | } | ||
2562 | 46 | } // namespace mir | ||
2563 | 47 | |||
2564 | 48 | #endif // MIR_TEST_DOUBLES_MOCK_PROMPT_SESSION_LISTENER_H_ | ||
2565 | 0 | 49 | ||
2566 | === modified file 'include/test/mir_test_doubles/mock_scene_session.h' | |||
2567 | --- include/test/mir_test_doubles/mock_scene_session.h 2014-05-22 11:31:21 +0000 | |||
2568 | +++ include/test/mir_test_doubles/mock_scene_session.h 2014-06-18 17:25:24 +0000 | |||
2569 | @@ -52,6 +52,9 @@ | |||
2570 | 52 | MOCK_METHOD3(configure_surface, int(frontend::SurfaceId, MirSurfaceAttrib, int)); | 52 | MOCK_METHOD3(configure_surface, int(frontend::SurfaceId, MirSurfaceAttrib, int)); |
2571 | 53 | 53 | ||
2572 | 54 | MOCK_METHOD1(set_lifecycle_state, void(MirLifecycleState state)); | 54 | MOCK_METHOD1(set_lifecycle_state, void(MirLifecycleState state)); |
2573 | 55 | |||
2574 | 56 | MOCK_METHOD0(start_prompt_session, void()); | ||
2575 | 57 | MOCK_METHOD0(stop_prompt_session, void()); | ||
2576 | 55 | }; | 58 | }; |
2577 | 56 | 59 | ||
2578 | 57 | } | 60 | } |
2579 | 58 | 61 | ||
2580 | === modified file 'include/test/mir_test_doubles/mock_shell.h' | |||
2581 | --- include/test/mir_test_doubles/mock_shell.h 2014-04-15 05:31:19 +0000 | |||
2582 | +++ include/test/mir_test_doubles/mock_shell.h 2014-06-18 17:25:24 +0000 | |||
2583 | @@ -22,6 +22,7 @@ | |||
2584 | 22 | #include "mir/scene/surface_creation_parameters.h" | 22 | #include "mir/scene/surface_creation_parameters.h" |
2585 | 23 | #include "mir/frontend/shell.h" | 23 | #include "mir/frontend/shell.h" |
2586 | 24 | #include "mir/frontend/surface_id.h" | 24 | #include "mir/frontend/surface_id.h" |
2587 | 25 | #include "mir/scene/prompt_session_creation_parameters.h" | ||
2588 | 25 | 26 | ||
2589 | 26 | #include <gmock/gmock.h> | 27 | #include <gmock/gmock.h> |
2590 | 27 | 28 | ||
2591 | @@ -43,6 +44,17 @@ | |||
2592 | 43 | 44 | ||
2593 | 44 | MOCK_METHOD2(create_surface_for, frontend::SurfaceId(std::shared_ptr<frontend::Session> const&, scene::SurfaceCreationParameters const&)); | 45 | MOCK_METHOD2(create_surface_for, frontend::SurfaceId(std::shared_ptr<frontend::Session> const&, scene::SurfaceCreationParameters const&)); |
2594 | 45 | MOCK_METHOD1(handle_surface_created, void(std::shared_ptr<frontend::Session> const&)); | 46 | MOCK_METHOD1(handle_surface_created, void(std::shared_ptr<frontend::Session> const&)); |
2595 | 47 | |||
2596 | 48 | MOCK_METHOD2(start_prompt_session_for, std::shared_ptr<frontend::PromptSession>( | ||
2597 | 49 | std::shared_ptr<frontend::Session> const&, | ||
2598 | 50 | scene::PromptSessionCreationParameters const&)); | ||
2599 | 51 | MOCK_METHOD2(add_prompt_provider_process_for, void( | ||
2600 | 52 | std::shared_ptr<frontend::PromptSession> const&, | ||
2601 | 53 | pid_t)); | ||
2602 | 54 | MOCK_METHOD2(add_prompt_provider_for, void( | ||
2603 | 55 | std::shared_ptr<frontend::PromptSession> const&, | ||
2604 | 56 | std::shared_ptr<frontend::Session> const&)); | ||
2605 | 57 | MOCK_METHOD1(stop_prompt_session, void(std::shared_ptr<frontend::PromptSession> const&)); | ||
2606 | 46 | }; | 58 | }; |
2607 | 47 | 59 | ||
2608 | 48 | } | 60 | } |
2609 | 49 | 61 | ||
2610 | === modified file 'include/test/mir_test_doubles/mock_surface.h' | |||
2611 | --- include/test/mir_test_doubles/mock_surface.h 2014-05-07 02:56:33 +0000 | |||
2612 | +++ include/test/mir_test_doubles/mock_surface.h 2014-06-18 17:25:24 +0000 | |||
2613 | @@ -41,6 +41,7 @@ | |||
2614 | 41 | {}, | 41 | {}, |
2615 | 42 | {}, | 42 | {}, |
2616 | 43 | {}, | 43 | {}, |
2617 | 44 | {}, | ||
2618 | 44 | mir::report::null_scene_report()) | 45 | mir::report::null_scene_report()) |
2619 | 45 | { | 46 | { |
2620 | 46 | } | 47 | } |
2621 | 47 | 48 | ||
2622 | === modified file 'include/test/mir_test_doubles/mock_swapping_gl_context.h' | |||
2623 | --- include/test/mir_test_doubles/mock_swapping_gl_context.h 2014-02-21 16:51:45 +0000 | |||
2624 | +++ include/test/mir_test_doubles/mock_swapping_gl_context.h 2014-06-18 17:25:24 +0000 | |||
2625 | @@ -31,6 +31,7 @@ | |||
2626 | 31 | struct MockSwappingGLContext : public graphics::android::SwappingGLContext | 31 | struct MockSwappingGLContext : public graphics::android::SwappingGLContext |
2627 | 32 | { | 32 | { |
2628 | 33 | MOCK_CONST_METHOD0(swap_buffers, void()); | 33 | MOCK_CONST_METHOD0(swap_buffers, void()); |
2629 | 34 | MOCK_CONST_METHOD0(last_rendered_buffer, std::shared_ptr<graphics::Buffer>()); | ||
2630 | 34 | }; | 35 | }; |
2631 | 35 | 36 | ||
2632 | 36 | } | 37 | } |
2633 | 37 | 38 | ||
2634 | === added file 'include/test/mir_test_doubles/mock_timer.h' | |||
2635 | --- include/test/mir_test_doubles/mock_timer.h 1970-01-01 00:00:00 +0000 | |||
2636 | +++ include/test/mir_test_doubles/mock_timer.h 2014-06-18 17:25:24 +0000 | |||
2637 | @@ -0,0 +1,52 @@ | |||
2638 | 1 | /* | ||
2639 | 2 | * Copyright © 2014 Canonical Ltd. | ||
2640 | 3 | * | ||
2641 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
2642 | 5 | * under the terms of the GNU General Public License version 3, | ||
2643 | 6 | * as published by the Free Software Foundation. | ||
2644 | 7 | * | ||
2645 | 8 | * This program is distributed in the hope that it will be useful, | ||
2646 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2647 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2648 | 11 | * GNU General Public License for more details. | ||
2649 | 12 | * | ||
2650 | 13 | * You should have received a copy of the GNU General Public License | ||
2651 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2652 | 15 | * | ||
2653 | 16 | * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com> | ||
2654 | 17 | */ | ||
2655 | 18 | |||
2656 | 19 | #ifndef MIR_TEST_DOUBLES_MOCK_TIMER_H_ | ||
2657 | 20 | #define MIR_TEST_DOUBLES_MOCK_TIMER_H_ | ||
2658 | 21 | |||
2659 | 22 | #include "mir/time/timer.h" | ||
2660 | 23 | #include "mir_test/fake_clock.h" | ||
2661 | 24 | #include <memory> | ||
2662 | 25 | |||
2663 | 26 | namespace mir | ||
2664 | 27 | { | ||
2665 | 28 | namespace test | ||
2666 | 29 | { | ||
2667 | 30 | namespace doubles | ||
2668 | 31 | { | ||
2669 | 32 | |||
2670 | 33 | class FakeTimer : public mir::time::Timer | ||
2671 | 34 | { | ||
2672 | 35 | public: | ||
2673 | 36 | FakeTimer(std::shared_ptr<FakeClock> const& clock); | ||
2674 | 37 | |||
2675 | 38 | std::unique_ptr<time::Alarm> notify_in(std::chrono::milliseconds delay, | ||
2676 | 39 | std::function<void(void)> callback) override; | ||
2677 | 40 | std::unique_ptr<time::Alarm> notify_at(time::Timestamp time_point, | ||
2678 | 41 | std::function<void(void)> callback) override; | ||
2679 | 42 | std::unique_ptr<time::Alarm> create_alarm(std::function<void ()> callback) override; | ||
2680 | 43 | |||
2681 | 44 | private: | ||
2682 | 45 | std::shared_ptr<FakeClock> const clock; | ||
2683 | 46 | }; | ||
2684 | 47 | |||
2685 | 48 | } | ||
2686 | 49 | } | ||
2687 | 50 | } | ||
2688 | 51 | |||
2689 | 52 | #endif // MIR_TEST_DOUBLES_MOCK_TIMER_H_ | ||
2690 | 0 | 53 | ||
2691 | === added file 'include/test/mir_test_doubles/mock_virtual_terminal.h' | |||
2692 | --- include/test/mir_test_doubles/mock_virtual_terminal.h 1970-01-01 00:00:00 +0000 | |||
2693 | +++ include/test/mir_test_doubles/mock_virtual_terminal.h 2014-06-18 17:25:24 +0000 | |||
2694 | @@ -0,0 +1,48 @@ | |||
2695 | 1 | /* | ||
2696 | 2 | * Copyright © 2014 Canonical Ltd. | ||
2697 | 3 | * | ||
2698 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
2699 | 5 | * under the terms of the GNU General Public License version 3, | ||
2700 | 6 | * as published by the Free Software Foundation. | ||
2701 | 7 | * | ||
2702 | 8 | * This program is distributed in the hope that it will be useful, | ||
2703 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2704 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2705 | 11 | * GNU General Public License for more details. | ||
2706 | 12 | * | ||
2707 | 13 | * You should have received a copy of the GNU General Public License | ||
2708 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2709 | 15 | * | ||
2710 | 16 | * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com> | ||
2711 | 17 | */ | ||
2712 | 18 | |||
2713 | 19 | #ifndef MIR_TEST_DOUBLES_MOCK_VIRTUAL_TERMINAL_H_ | ||
2714 | 20 | #define MIR_TEST_DOUBLES_MOCK_VIRTUAL_TERMINAL_H_ | ||
2715 | 21 | |||
2716 | 22 | #include "src/platform/graphics/mesa/virtual_terminal.h" | ||
2717 | 23 | |||
2718 | 24 | #include <gmock/gmock.h> | ||
2719 | 25 | |||
2720 | 26 | namespace mir | ||
2721 | 27 | { | ||
2722 | 28 | namespace test | ||
2723 | 29 | { | ||
2724 | 30 | namespace doubles | ||
2725 | 31 | { | ||
2726 | 32 | |||
2727 | 33 | class MockVirtualTerminal : public graphics::mesa::VirtualTerminal | ||
2728 | 34 | { | ||
2729 | 35 | public: | ||
2730 | 36 | MOCK_METHOD0(set_graphics_mode, void()); | ||
2731 | 37 | MOCK_METHOD3(register_switch_handlers, | ||
2732 | 38 | void(graphics::EventHandlerRegister&, | ||
2733 | 39 | std::function<bool()> const&, | ||
2734 | 40 | std::function<bool()> const&)); | ||
2735 | 41 | MOCK_METHOD0(restore, void()); | ||
2736 | 42 | }; | ||
2737 | 43 | |||
2738 | 44 | } | ||
2739 | 45 | } | ||
2740 | 46 | } | ||
2741 | 47 | |||
2742 | 48 | #endif | ||
2743 | 0 | 49 | ||
2744 | === added file 'include/test/mir_test_doubles/null_client_event_sink.h' | |||
2745 | --- include/test/mir_test_doubles/null_client_event_sink.h 1970-01-01 00:00:00 +0000 | |||
2746 | +++ include/test/mir_test_doubles/null_client_event_sink.h 2014-06-18 17:25:24 +0000 | |||
2747 | @@ -0,0 +1,42 @@ | |||
2748 | 1 | /* | ||
2749 | 2 | * Copyright © 2012 Canonical Ltd. | ||
2750 | 3 | * | ||
2751 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
2752 | 5 | * under the terms of the GNU General Public License version 3, | ||
2753 | 6 | * as published by the Free Software Foundation. | ||
2754 | 7 | * | ||
2755 | 8 | * This program is distributed in the hope that it will be useful, | ||
2756 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2757 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2758 | 11 | * GNU General Public License for more details. | ||
2759 | 12 | * | ||
2760 | 13 | * You should have received a copy of the GNU General Public License | ||
2761 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2762 | 15 | * | ||
2763 | 16 | * Authored by: Nick Dedekink <nick.dedekind@canonical.com> | ||
2764 | 17 | */ | ||
2765 | 18 | |||
2766 | 19 | #ifndef MIR_TEST_DOUBLES_NULL_CLIENT_EVENT_SINK_H_ | ||
2767 | 20 | #define MIR_TEST_DOUBLES_NULL_CLIENT_EVENT_SINK_H_ | ||
2768 | 21 | |||
2769 | 22 | #include "src/client/event_sink.h" | ||
2770 | 23 | |||
2771 | 24 | #include <gmock/gmock.h> | ||
2772 | 25 | |||
2773 | 26 | namespace mir | ||
2774 | 27 | { | ||
2775 | 28 | namespace test | ||
2776 | 29 | { | ||
2777 | 30 | namespace doubles | ||
2778 | 31 | { | ||
2779 | 32 | class NullClientEventSink : public client::EventSink | ||
2780 | 33 | { | ||
2781 | 34 | public: | ||
2782 | 35 | void handle_event(MirEvent const&) override {} | ||
2783 | 36 | }; | ||
2784 | 37 | |||
2785 | 38 | } | ||
2786 | 39 | } | ||
2787 | 40 | } | ||
2788 | 41 | |||
2789 | 42 | #endif /* MIR_TEST_DOUBLES_NULL_CLIENT_EVENT_SINK_H_ */ | ||
2790 | 0 | 43 | ||
2791 | === modified file 'include/test/mir_test_doubles/null_display_buffer.h' | |||
2792 | --- include/test/mir_test_doubles/null_display_buffer.h 2014-05-22 09:56:17 +0000 | |||
2793 | +++ include/test/mir_test_doubles/null_display_buffer.h 2014-06-18 17:25:24 +0000 | |||
2794 | @@ -35,9 +35,9 @@ | |||
2795 | 35 | void make_current() {} | 35 | void make_current() {} |
2796 | 36 | void release_current() {} | 36 | void release_current() {} |
2797 | 37 | void post_update() {} | 37 | void post_update() {} |
2798 | 38 | bool can_bypass() const override { return false; } | ||
2799 | 39 | bool post_renderables_if_optimizable(graphics::RenderableList const&) { return false; } | 38 | bool post_renderables_if_optimizable(graphics::RenderableList const&) { return false; } |
2800 | 40 | MirOrientation orientation() const override { return mir_orientation_normal; } | 39 | MirOrientation orientation() const override { return mir_orientation_normal; } |
2801 | 40 | bool uses_alpha() const override { return false; } | ||
2802 | 41 | }; | 41 | }; |
2803 | 42 | 42 | ||
2804 | 43 | } | 43 | } |
2805 | 44 | 44 | ||
2806 | === modified file 'include/test/mir_test_doubles/null_display_buffer_compositor_factory.h' | |||
2807 | --- include/test/mir_test_doubles/null_display_buffer_compositor_factory.h 2014-04-08 13:12:47 +0000 | |||
2808 | +++ include/test/mir_test_doubles/null_display_buffer_compositor_factory.h 2014-06-18 17:25:24 +0000 | |||
2809 | @@ -37,7 +37,7 @@ | |||
2810 | 37 | { | 37 | { |
2811 | 38 | struct NullDisplayBufferCompositor : compositor::DisplayBufferCompositor | 38 | struct NullDisplayBufferCompositor : compositor::DisplayBufferCompositor |
2812 | 39 | { | 39 | { |
2814 | 40 | bool composite() { return false; } | 40 | void composite() {} |
2815 | 41 | }; | 41 | }; |
2816 | 42 | 42 | ||
2817 | 43 | auto raw = new NullDisplayBufferCompositor{}; | 43 | auto raw = new NullDisplayBufferCompositor{}; |
2818 | 44 | 44 | ||
2819 | === added file 'include/test/mir_test_doubles/null_pixel_buffer.h' | |||
2820 | --- include/test/mir_test_doubles/null_pixel_buffer.h 1970-01-01 00:00:00 +0000 | |||
2821 | +++ include/test/mir_test_doubles/null_pixel_buffer.h 2014-06-18 17:25:24 +0000 | |||
2822 | @@ -0,0 +1,43 @@ | |||
2823 | 1 | /* | ||
2824 | 2 | * Copyright © 2014 Canonical Ltd. | ||
2825 | 3 | * | ||
2826 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
2827 | 5 | * under the terms of the GNU General Public License version 3, | ||
2828 | 6 | * as published by the Free Software Foundation. | ||
2829 | 7 | * | ||
2830 | 8 | * This program is distributed in the hope that it will be useful, | ||
2831 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2832 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2833 | 11 | * GNU General Public License for more details. | ||
2834 | 12 | * | ||
2835 | 13 | * You should have received a copy of the GNU General Public License | ||
2836 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2837 | 15 | * | ||
2838 | 16 | * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com> | ||
2839 | 17 | */ | ||
2840 | 18 | |||
2841 | 19 | #ifndef MIR_TEST_DOUBLES_NULL_PIXEL_BUFFER_H_ | ||
2842 | 20 | #define MIR_TEST_DOUBLES_NULL_PIXEL_BUFFER_H_ | ||
2843 | 21 | |||
2844 | 22 | #include "src/server/scene/pixel_buffer.h" | ||
2845 | 23 | |||
2846 | 24 | namespace mir | ||
2847 | 25 | { | ||
2848 | 26 | namespace test | ||
2849 | 27 | { | ||
2850 | 28 | namespace doubles | ||
2851 | 29 | { | ||
2852 | 30 | |||
2853 | 31 | struct NullPixelBuffer : public scene::PixelBuffer | ||
2854 | 32 | { | ||
2855 | 33 | void fill_from(graphics::Buffer&) {} | ||
2856 | 34 | void const* as_argb_8888() { return nullptr; } | ||
2857 | 35 | geometry::Size size() const { return {}; } | ||
2858 | 36 | geometry::Stride stride() const { return {}; } | ||
2859 | 37 | }; | ||
2860 | 38 | |||
2861 | 39 | } | ||
2862 | 40 | } | ||
2863 | 41 | } | ||
2864 | 42 | |||
2865 | 43 | #endif /* MIR_TEST_DOUBLES_NULL_PIXEL_BUFFER_H_ */ | ||
2866 | 0 | 44 | ||
2867 | === added file 'include/test/mir_test_doubles/null_prompt_session.h' | |||
2868 | --- include/test/mir_test_doubles/null_prompt_session.h 1970-01-01 00:00:00 +0000 | |||
2869 | +++ include/test/mir_test_doubles/null_prompt_session.h 2014-06-18 17:25:24 +0000 | |||
2870 | @@ -0,0 +1,37 @@ | |||
2871 | 1 | /* | ||
2872 | 2 | * Copyright © 2013-2014 Canonical Ltd. | ||
2873 | 3 | * | ||
2874 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
2875 | 5 | * under the terms of the GNU General Public License version 3, | ||
2876 | 6 | * as published by the Free Software Foundation. | ||
2877 | 7 | * | ||
2878 | 8 | * This program is distributed in the hope that it will be useful, | ||
2879 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2880 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2881 | 11 | * GNU General Public License for more details. | ||
2882 | 12 | * | ||
2883 | 13 | * You should have received a copy of the GNU General Public License | ||
2884 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2885 | 15 | * | ||
2886 | 16 | * Authored by: Nick Dedekind <nick.dedekind@gmail.com> | ||
2887 | 17 | */ | ||
2888 | 18 | |||
2889 | 19 | #ifndef MIR_TEST_DOUBLES_NULL_PROMPT_SESSION_H_ | ||
2890 | 20 | #define MIR_TEST_DOUBLES_NULL_PROMPT_SESSION_H_ | ||
2891 | 21 | |||
2892 | 22 | #include "mir/scene/prompt_session.h" | ||
2893 | 23 | |||
2894 | 24 | namespace mir | ||
2895 | 25 | { | ||
2896 | 26 | namespace test | ||
2897 | 27 | { | ||
2898 | 28 | namespace doubles | ||
2899 | 29 | { | ||
2900 | 30 | class NullPromptSession : public scene::PromptSession | ||
2901 | 31 | { | ||
2902 | 32 | }; | ||
2903 | 33 | } | ||
2904 | 34 | } | ||
2905 | 35 | } | ||
2906 | 36 | |||
2907 | 37 | #endif /* MIR_TEST_DOUBLES_NULL_PROMPT_SESSION_H_ */ | ||
2908 | 0 | 38 | ||
2909 | === added file 'include/test/mir_test_doubles/null_prompt_session_manager.h' | |||
2910 | --- include/test/mir_test_doubles/null_prompt_session_manager.h 1970-01-01 00:00:00 +0000 | |||
2911 | +++ include/test/mir_test_doubles/null_prompt_session_manager.h 2014-06-18 17:25:24 +0000 | |||
2912 | @@ -0,0 +1,82 @@ | |||
2913 | 1 | /* | ||
2914 | 2 | * Copyright © 2014 Canonical Ltd. | ||
2915 | 3 | * | ||
2916 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
2917 | 5 | * under the terms of the GNU General Public License version 3, | ||
2918 | 6 | * as published by the Free Software Foundation. | ||
2919 | 7 | * | ||
2920 | 8 | * This program is distributed in the hope that it will be useful, | ||
2921 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2922 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2923 | 11 | * GNU General Public License for more details. | ||
2924 | 12 | * | ||
2925 | 13 | * You should have received a copy of the GNU General Public License | ||
2926 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2927 | 15 | * | ||
2928 | 16 | * Authored By: Nick Dedekind <nick.dedekind@canonical.com> | ||
2929 | 17 | */ | ||
2930 | 18 | |||
2931 | 19 | #ifndef MIR_SCENE_NULL_PROMPT_SESSION_MANAGER_H_ | ||
2932 | 20 | #define MIR_SCENE_NULL_PROMPT_SESSION_MANAGER_H_ | ||
2933 | 21 | |||
2934 | 22 | #include "mir/scene/prompt_session_manager.h" | ||
2935 | 23 | |||
2936 | 24 | namespace mir | ||
2937 | 25 | { | ||
2938 | 26 | namespace test | ||
2939 | 27 | { | ||
2940 | 28 | namespace doubles | ||
2941 | 29 | { | ||
2942 | 30 | |||
2943 | 31 | class NullPromptSessionManager: public scene::PromptSessionManager | ||
2944 | 32 | { | ||
2945 | 33 | public: | ||
2946 | 34 | std::shared_ptr<scene::PromptSession> start_prompt_session_for(std::shared_ptr<scene::Session> const&, | ||
2947 | 35 | scene::PromptSessionCreationParameters const&) const | ||
2948 | 36 | { | ||
2949 | 37 | return std::shared_ptr<scene::PromptSession>(); | ||
2950 | 38 | } | ||
2951 | 39 | |||
2952 | 40 | void stop_prompt_session(std::shared_ptr<scene::PromptSession> const&) const | ||
2953 | 41 | { | ||
2954 | 42 | } | ||
2955 | 43 | |||
2956 | 44 | void add_prompt_provider(std::shared_ptr<scene::PromptSession> const&, | ||
2957 | 45 | std::shared_ptr<scene::Session> const&) const | ||
2958 | 46 | { | ||
2959 | 47 | } | ||
2960 | 48 | |||
2961 | 49 | void add_prompt_provider_by_pid(std::shared_ptr<scene::PromptSession> const&, | ||
2962 | 50 | pid_t) const | ||
2963 | 51 | { | ||
2964 | 52 | } | ||
2965 | 53 | |||
2966 | 54 | void add_expected_session(std::shared_ptr<scene::Session> const&) const | ||
2967 | 55 | { | ||
2968 | 56 | } | ||
2969 | 57 | |||
2970 | 58 | void remove_session(std::shared_ptr<scene::Session> const&) const | ||
2971 | 59 | { | ||
2972 | 60 | } | ||
2973 | 61 | |||
2974 | 62 | std::shared_ptr<scene::Session> application_for(std::shared_ptr<scene::PromptSession> const&) const | ||
2975 | 63 | { | ||
2976 | 64 | return std::shared_ptr<scene::Session>(); | ||
2977 | 65 | } | ||
2978 | 66 | |||
2979 | 67 | std::shared_ptr<scene::Session> helper_for(std::shared_ptr<scene::PromptSession> const&) const | ||
2980 | 68 | { | ||
2981 | 69 | return std::shared_ptr<scene::Session>(); | ||
2982 | 70 | } | ||
2983 | 71 | |||
2984 | 72 | void for_each_provider_in(std::shared_ptr<scene::PromptSession> const&, | ||
2985 | 73 | std::function<void(std::shared_ptr<scene::Session> const&)> const&) const | ||
2986 | 74 | { | ||
2987 | 75 | } | ||
2988 | 76 | }; | ||
2989 | 77 | |||
2990 | 78 | } | ||
2991 | 79 | } | ||
2992 | 80 | } | ||
2993 | 81 | |||
2994 | 82 | #endif // MIR_SCENE_NULL_PROMPT_SESSION_MANAGER_H_ | ||
2995 | 0 | 83 | ||
2996 | === modified file 'include/test/mir_test_doubles/null_virtual_terminal.h' | |||
2997 | --- include/test/mir_test_doubles/null_virtual_terminal.h 2014-03-06 06:05:17 +0000 | |||
2998 | +++ include/test/mir_test_doubles/null_virtual_terminal.h 2014-06-18 17:25:24 +0000 | |||
2999 | @@ -31,13 +31,15 @@ | |||
3000 | 31 | class NullVirtualTerminal : public graphics::mesa::VirtualTerminal | 31 | class NullVirtualTerminal : public graphics::mesa::VirtualTerminal |
3001 | 32 | { | 32 | { |
3002 | 33 | public: | 33 | public: |
3004 | 34 | void set_graphics_mode() {} | 34 | void set_graphics_mode() override {} |
3005 | 35 | 35 | ||
3006 | 36 | void register_switch_handlers(graphics::EventHandlerRegister&, | 36 | void register_switch_handlers(graphics::EventHandlerRegister&, |
3007 | 37 | std::function<bool()> const&, | 37 | std::function<bool()> const&, |
3009 | 38 | std::function<bool()> const&) | 38 | std::function<bool()> const&) override |
3010 | 39 | { | 39 | { |
3011 | 40 | } | 40 | } |
3012 | 41 | |||
3013 | 42 | void restore() override {} | ||
3014 | 41 | }; | 43 | }; |
3015 | 42 | 44 | ||
3016 | 43 | } | 45 | } |
3017 | 44 | 46 | ||
3018 | === added file 'include/test/mir_test_doubles/platform_factory.h' | |||
3019 | --- include/test/mir_test_doubles/platform_factory.h 1970-01-01 00:00:00 +0000 | |||
3020 | +++ include/test/mir_test_doubles/platform_factory.h 2014-06-18 17:25:24 +0000 | |||
3021 | @@ -0,0 +1,46 @@ | |||
3022 | 1 | /* | ||
3023 | 2 | * Copyright © 2014 Canonical Ltd. | ||
3024 | 3 | * | ||
3025 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
3026 | 5 | * under the terms of the GNU General Public License version 3, | ||
3027 | 6 | * as published by the Free Software Foundation. | ||
3028 | 7 | * | ||
3029 | 8 | * This program is distributed in the hope that it will be useful, | ||
3030 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
3031 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
3032 | 11 | * GNU General Public License for more details. | ||
3033 | 12 | * | ||
3034 | 13 | * You should have received a copy of the GNU General Public License | ||
3035 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
3036 | 15 | * | ||
3037 | 16 | * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com> | ||
3038 | 17 | */ | ||
3039 | 18 | |||
3040 | 19 | #ifndef MIR_TEST_DOUBLES_PLATFORM_FACTORY_H_ | ||
3041 | 20 | #define MIR_TEST_DOUBLES_PLATFORM_FACTORY_H_ | ||
3042 | 21 | |||
3043 | 22 | #include <memory> | ||
3044 | 23 | |||
3045 | 24 | namespace mir | ||
3046 | 25 | { | ||
3047 | 26 | namespace graphics | ||
3048 | 27 | { | ||
3049 | 28 | class Platform; | ||
3050 | 29 | namespace mesa { class Platform; } | ||
3051 | 30 | } | ||
3052 | 31 | namespace test | ||
3053 | 32 | { | ||
3054 | 33 | namespace doubles | ||
3055 | 34 | { | ||
3056 | 35 | |||
3057 | 36 | std::shared_ptr<graphics::Platform> create_platform_with_null_dependencies(); | ||
3058 | 37 | |||
3059 | 38 | #ifndef ANDROID | ||
3060 | 39 | std::shared_ptr<graphics::mesa::Platform> create_mesa_platform_with_null_dependencies(); | ||
3061 | 40 | #endif | ||
3062 | 41 | |||
3063 | 42 | } | ||
3064 | 43 | } | ||
3065 | 44 | } | ||
3066 | 45 | |||
3067 | 46 | #endif /* MIR_TEST_DOUBLES_PLATFORM_FACTORY_H_ */ | ||
3068 | 0 | 47 | ||
3069 | === modified file 'include/test/mir_test_doubles/stub_buffer.h' | |||
3070 | --- include/test/mir_test_doubles/stub_buffer.h 2014-03-26 05:48:59 +0000 | |||
3071 | +++ include/test/mir_test_doubles/stub_buffer.h 2014-06-18 17:25:24 +0000 | |||
3072 | @@ -21,6 +21,9 @@ | |||
3073 | 21 | 21 | ||
3074 | 22 | #ifdef ANDROID | 22 | #ifdef ANDROID |
3075 | 23 | #include "mock_android_native_buffer.h" | 23 | #include "mock_android_native_buffer.h" |
3076 | 24 | #else | ||
3077 | 25 | #include "src/platform/graphics/mesa/gbm_buffer.h" | ||
3078 | 26 | #include "mock_gbm.h" | ||
3079 | 24 | #endif | 27 | #endif |
3080 | 25 | 28 | ||
3081 | 26 | #include "mir/graphics/buffer_basic.h" | 29 | #include "mir/graphics/buffer_basic.h" |
3082 | @@ -59,6 +62,14 @@ | |||
3083 | 59 | buf_pixel_format{properties.format}, | 62 | buf_pixel_format{properties.format}, |
3084 | 60 | buf_stride{stride} | 63 | buf_stride{stride} |
3085 | 61 | { | 64 | { |
3086 | 65 | #ifndef ANDROID | ||
3087 | 66 | auto buffer = std::make_shared<graphics::mesa::GBMNativeBuffer>(); | ||
3088 | 67 | int fake_bo{0}; | ||
3089 | 68 | buffer->bo = reinterpret_cast<gbm_bo*>(&fake_bo); //gbm_bo is opaque, so test code shouldn't dereference. | ||
3090 | 69 | native_buffer = buffer; | ||
3091 | 70 | #else | ||
3092 | 71 | native_buffer = std::make_shared<StubAndroidNativeBuffer>(); | ||
3093 | 72 | #endif | ||
3094 | 62 | } | 73 | } |
3095 | 63 | 74 | ||
3096 | 64 | virtual geometry::Size size() const { return buf_size; } | 75 | virtual geometry::Size size() const { return buf_size; } |
3097 | @@ -67,18 +78,12 @@ | |||
3098 | 67 | 78 | ||
3099 | 68 | virtual MirPixelFormat pixel_format() const { return buf_pixel_format; } | 79 | virtual MirPixelFormat pixel_format() const { return buf_pixel_format; } |
3100 | 69 | 80 | ||
3113 | 70 | virtual std::shared_ptr<graphics::NativeBuffer> native_buffer_handle() const | 81 | virtual std::shared_ptr<graphics::NativeBuffer> native_buffer_handle() const { return native_buffer; } |
3114 | 71 | { | 82 | virtual void gl_bind_to_texture() override {} |
3115 | 72 | #ifndef ANDROID | 83 | |
3116 | 73 | return std::make_shared<graphics::NativeBuffer>(); | 84 | virtual bool can_bypass() const override { return true; } |
3117 | 74 | #else | 85 | |
3118 | 75 | return std::make_shared<StubAndroidNativeBuffer>(); | 86 | std::shared_ptr<graphics::NativeBuffer> native_buffer; |
3107 | 76 | #endif | ||
3108 | 77 | } | ||
3109 | 78 | virtual void bind_to_texture() {} | ||
3110 | 79 | |||
3111 | 80 | virtual bool can_bypass() const override { return false; } | ||
3112 | 81 | |||
3119 | 82 | geometry::Size const buf_size; | 87 | geometry::Size const buf_size; |
3120 | 83 | MirPixelFormat const buf_pixel_format; | 88 | MirPixelFormat const buf_pixel_format; |
3121 | 84 | geometry::Stride const buf_stride; | 89 | geometry::Stride const buf_stride; |
3122 | 85 | 90 | ||
3123 | === modified file 'include/test/mir_test_doubles/stub_buffer_stream.h' | |||
3124 | --- include/test/mir_test_doubles/stub_buffer_stream.h 2014-03-26 05:48:59 +0000 | |||
3125 | +++ include/test/mir_test_doubles/stub_buffer_stream.h 2014-06-18 17:25:24 +0000 | |||
3126 | @@ -36,10 +36,17 @@ | |||
3127 | 36 | { | 36 | { |
3128 | 37 | stub_compositor_buffer = std::make_shared<StubBuffer>(); | 37 | stub_compositor_buffer = std::make_shared<StubBuffer>(); |
3129 | 38 | } | 38 | } |
3131 | 39 | void swap_client_buffers(graphics::Buffer*, std::function<void(graphics::Buffer* new_buffer)> complete) override | 39 | |
3132 | 40 | void acquire_client_buffer( | ||
3133 | 41 | std::function<void(graphics::Buffer* buffer)> complete) override | ||
3134 | 40 | { | 42 | { |
3135 | 41 | complete(&stub_client_buffer); | 43 | complete(&stub_client_buffer); |
3136 | 42 | } | 44 | } |
3137 | 45 | |||
3138 | 46 | void release_client_buffer(graphics::Buffer*) override | ||
3139 | 47 | { | ||
3140 | 48 | } | ||
3141 | 49 | |||
3142 | 43 | std::shared_ptr<graphics::Buffer> lock_compositor_buffer(void const*) override | 50 | std::shared_ptr<graphics::Buffer> lock_compositor_buffer(void const*) override |
3143 | 44 | { | 51 | { |
3144 | 45 | return stub_compositor_buffer; | 52 | return stub_compositor_buffer; |
3145 | 46 | 53 | ||
3146 | === modified file 'include/test/mir_test_doubles/stub_display_builder.h' | |||
3147 | --- include/test/mir_test_doubles/stub_display_builder.h 2014-05-28 07:43:51 +0000 | |||
3148 | +++ include/test/mir_test_doubles/stub_display_builder.h 2014-06-18 17:25:24 +0000 | |||
3149 | @@ -41,9 +41,9 @@ | |||
3150 | 41 | void make_current() {} | 41 | void make_current() {} |
3151 | 42 | void release_current() {} | 42 | void release_current() {} |
3152 | 43 | void post_update() {} | 43 | void post_update() {} |
3153 | 44 | bool can_bypass() const override { return false; } | ||
3154 | 45 | bool post_renderables_if_optimizable(graphics::RenderableList const&) { return false; } | 44 | bool post_renderables_if_optimizable(graphics::RenderableList const&) { return false; } |
3155 | 46 | MirOrientation orientation() const override { return mir_orientation_normal; } | 45 | MirOrientation orientation() const override { return mir_orientation_normal; } |
3156 | 46 | bool uses_alpha() const override { return false; }; | ||
3157 | 47 | void configure(graphics::DisplayConfigurationOutput const&) {} | 47 | void configure(graphics::DisplayConfigurationOutput const&) {} |
3158 | 48 | graphics::DisplayConfigurationOutput configuration() const | 48 | graphics::DisplayConfigurationOutput configuration() const |
3159 | 49 | { | 49 | { |
3160 | 50 | 50 | ||
3161 | === added file 'include/test/mir_test_doubles/stub_frame_dropping_policy_factory.h' | |||
3162 | --- include/test/mir_test_doubles/stub_frame_dropping_policy_factory.h 1970-01-01 00:00:00 +0000 | |||
3163 | +++ include/test/mir_test_doubles/stub_frame_dropping_policy_factory.h 2014-06-18 17:25:24 +0000 | |||
3164 | @@ -0,0 +1,58 @@ | |||
3165 | 1 | /* | ||
3166 | 2 | * Copyright © 2014 Canonical Ltd. | ||
3167 | 3 | * | ||
3168 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
3169 | 5 | * under the terms of the GNU General Public License version 3, | ||
3170 | 6 | * as published by the Free Software Foundation. | ||
3171 | 7 | * | ||
3172 | 8 | * This program is distributed in the hope that it will be useful, | ||
3173 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
3174 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
3175 | 11 | * GNU General Public License for more details. | ||
3176 | 12 | * | ||
3177 | 13 | * You should have received a copy of the GNU General Public License | ||
3178 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
3179 | 15 | * | ||
3180 | 16 | * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com> | ||
3181 | 17 | */ | ||
3182 | 18 | |||
3183 | 19 | |||
3184 | 20 | #ifndef MIR_TEST_DOUBLES_STUB_FRAME_DROPPING_POLICY_FACTORY_H_ | ||
3185 | 21 | #define MIR_TEST_DOUBLES_STUB_FRAME_DROPPING_POLICY_FACTORY_H_ | ||
3186 | 22 | |||
3187 | 23 | #include "mir/compositor/frame_dropping_policy_factory.h" | ||
3188 | 24 | #include "mir/compositor/frame_dropping_policy.h" | ||
3189 | 25 | |||
3190 | 26 | namespace mc = mir::compositor; | ||
3191 | 27 | |||
3192 | 28 | namespace mir | ||
3193 | 29 | { | ||
3194 | 30 | namespace test | ||
3195 | 31 | { | ||
3196 | 32 | namespace doubles | ||
3197 | 33 | { | ||
3198 | 34 | |||
3199 | 35 | class StubFrameDroppingPolicy : public mc::FrameDroppingPolicy | ||
3200 | 36 | { | ||
3201 | 37 | public: | ||
3202 | 38 | void swap_now_blocking() | ||
3203 | 39 | { | ||
3204 | 40 | } | ||
3205 | 41 | void swap_unblocked() | ||
3206 | 42 | { | ||
3207 | 43 | } | ||
3208 | 44 | }; | ||
3209 | 45 | |||
3210 | 46 | class StubFrameDroppingPolicyFactory : public mc::FrameDroppingPolicyFactory | ||
3211 | 47 | { | ||
3212 | 48 | public: | ||
3213 | 49 | std::unique_ptr<mc::FrameDroppingPolicy> create_policy(std::function<void(void)>) const override | ||
3214 | 50 | { | ||
3215 | 51 | return std::unique_ptr<mc::FrameDroppingPolicy>{new StubFrameDroppingPolicy}; | ||
3216 | 52 | } | ||
3217 | 53 | }; | ||
3218 | 54 | |||
3219 | 55 | } | ||
3220 | 56 | } | ||
3221 | 57 | } | ||
3222 | 58 | #endif // TEST_DOUBLES_STUB_FRAME_DROPPING_POLICY_FACTORY_H_ | ||
3223 | 0 | 59 | ||
3224 | === modified file 'include/test/mir_test_doubles/stub_renderable.h' | |||
3225 | --- include/test/mir_test_doubles/stub_renderable.h 2014-05-22 16:50:25 +0000 | |||
3226 | +++ include/test/mir_test_doubles/stub_renderable.h 2014-06-18 17:25:24 +0000 | |||
3227 | @@ -22,6 +22,11 @@ | |||
3228 | 22 | #include "mir_test_doubles/stub_buffer.h" | 22 | #include "mir_test_doubles/stub_buffer.h" |
3229 | 23 | #include <mir/graphics/renderable.h> | 23 | #include <mir/graphics/renderable.h> |
3230 | 24 | #include <memory> | 24 | #include <memory> |
3231 | 25 | #define GLM_FORCE_RADIANS | ||
3232 | 26 | #define GLM_PRECISION_MEDIUMP_FLOAT | ||
3233 | 27 | #include <glm/glm.hpp> | ||
3234 | 28 | #include <glm/gtc/matrix_transform.hpp> | ||
3235 | 29 | #include <glm/gtc/type_ptr.hpp> | ||
3236 | 25 | 30 | ||
3237 | 26 | namespace mir | 31 | namespace mir |
3238 | 27 | { | 32 | { |
3239 | @@ -33,20 +38,26 @@ | |||
3240 | 33 | class StubRenderable : public graphics::Renderable | 38 | class StubRenderable : public graphics::Renderable |
3241 | 34 | { | 39 | { |
3242 | 35 | public: | 40 | public: |
3243 | 41 | StubRenderable(std::shared_ptr<graphics::Buffer> const& buffer, geometry::Rectangle const& rect) | ||
3244 | 42 | : rect(rect), | ||
3245 | 43 | stub_buffer(buffer) | ||
3246 | 44 | {} | ||
3247 | 45 | |||
3248 | 36 | StubRenderable(geometry::Rectangle const& rect) | 46 | StubRenderable(geometry::Rectangle const& rect) |
3250 | 37 | : rect(rect) | 47 | : StubRenderable(make_stub_buffer(rect), rect) |
3251 | 38 | {} | 48 | {} |
3252 | 49 | |||
3253 | 39 | StubRenderable() : | 50 | StubRenderable() : |
3255 | 40 | StubRenderable({{},{}}) | 51 | StubRenderable(make_stub_buffer({{},{}}), {{},{}}) |
3256 | 41 | {} | 52 | {} |
3257 | 53 | |||
3258 | 42 | ID id() const override | 54 | ID id() const override |
3259 | 43 | { | 55 | { |
3260 | 44 | return this; | 56 | return this; |
3261 | 45 | } | 57 | } |
3262 | 46 | std::shared_ptr<graphics::Buffer> buffer() const override | 58 | std::shared_ptr<graphics::Buffer> buffer() const override |
3263 | 47 | { | 59 | { |
3266 | 48 | graphics::BufferProperties prop{rect.size, mir_pixel_format_abgr_8888, graphics::BufferUsage::hardware}; | 60 | return stub_buffer; |
3265 | 49 | return std::make_shared<StubBuffer>(prop); | ||
3267 | 50 | } | 61 | } |
3268 | 51 | bool alpha_enabled() const | 62 | bool alpha_enabled() const |
3269 | 52 | { | 63 | { |
3270 | @@ -79,10 +90,58 @@ | |||
3271 | 79 | } | 90 | } |
3272 | 80 | 91 | ||
3273 | 81 | private: | 92 | private: |
3274 | 93 | std::shared_ptr<graphics::Buffer> make_stub_buffer(geometry::Rectangle const& rect) | ||
3275 | 94 | { | ||
3276 | 95 | graphics::BufferProperties prop{ | ||
3277 | 96 | rect.size, mir_pixel_format_abgr_8888, graphics::BufferUsage::hardware}; | ||
3278 | 97 | return std::make_shared<StubBuffer>(prop); | ||
3279 | 98 | } | ||
3280 | 99 | |||
3281 | 82 | glm::mat4 trans; | 100 | glm::mat4 trans; |
3282 | 83 | geometry::Rectangle const rect; | 101 | geometry::Rectangle const rect; |
3285 | 84 | }; | 102 | std::shared_ptr<graphics::Buffer> const stub_buffer; |
3286 | 85 | 103 | }; | |
3287 | 104 | |||
3288 | 105 | struct StubTransformedRenderable : public StubRenderable | ||
3289 | 106 | { | ||
3290 | 107 | glm::mat4 transformation() const override | ||
3291 | 108 | { | ||
3292 | 109 | glm::mat4 transform(1.0); | ||
3293 | 110 | glm::vec3 vec(1.0, 0.0, 0.0); | ||
3294 | 111 | transform = glm::rotate(transform, 33.0f, vec); | ||
3295 | 112 | return transform; | ||
3296 | 113 | } | ||
3297 | 114 | }; | ||
3298 | 115 | |||
3299 | 116 | //hopefully the alpha representation gets condensed at some point | ||
3300 | 117 | struct StubShapedRenderable : public StubRenderable | ||
3301 | 118 | { | ||
3302 | 119 | bool shaped() const override | ||
3303 | 120 | { | ||
3304 | 121 | return true; | ||
3305 | 122 | } | ||
3306 | 123 | }; | ||
3307 | 124 | |||
3308 | 125 | struct StubTranslucentRenderable : public StubRenderable | ||
3309 | 126 | { | ||
3310 | 127 | bool alpha_enabled() const override | ||
3311 | 128 | { | ||
3312 | 129 | return true; | ||
3313 | 130 | } | ||
3314 | 131 | }; | ||
3315 | 132 | |||
3316 | 133 | struct PlaneAlphaRenderable : public StubRenderable | ||
3317 | 134 | { | ||
3318 | 135 | bool alpha_enabled() const override | ||
3319 | 136 | { | ||
3320 | 137 | return true; | ||
3321 | 138 | } | ||
3322 | 139 | float alpha() const override | ||
3323 | 140 | { | ||
3324 | 141 | //approx 99% alpha | ||
3325 | 142 | return 1.0f - ( 3.0f / 1024.0f ); | ||
3326 | 143 | } | ||
3327 | 144 | }; | ||
3328 | 86 | } | 145 | } |
3329 | 87 | } | 146 | } |
3330 | 88 | } | 147 | } |
3331 | 89 | 148 | ||
3332 | === modified file 'include/test/mir_test_doubles/stub_scene_session.h' | |||
3333 | --- include/test/mir_test_doubles/stub_scene_session.h 2014-05-22 11:31:21 +0000 | |||
3334 | +++ include/test/mir_test_doubles/stub_scene_session.h 2014-06-18 17:25:24 +0000 | |||
3335 | @@ -30,6 +30,8 @@ | |||
3336 | 30 | 30 | ||
3337 | 31 | struct StubSceneSession : public scene::Session | 31 | struct StubSceneSession : public scene::Session |
3338 | 32 | { | 32 | { |
3339 | 33 | StubSceneSession(pid_t pid = -1) : pid(pid) {} | ||
3340 | 34 | |||
3341 | 33 | frontend::SurfaceId create_surface(scene::SurfaceCreationParameters const& /* params */) override | 35 | frontend::SurfaceId create_surface(scene::SurfaceCreationParameters const& /* params */) override |
3342 | 34 | { | 36 | { |
3343 | 35 | return frontend::SurfaceId{0}; | 37 | return frontend::SurfaceId{0}; |
3344 | @@ -45,9 +47,10 @@ | |||
3345 | 45 | { | 47 | { |
3346 | 46 | return std::string(); | 48 | return std::string(); |
3347 | 47 | } | 49 | } |
3348 | 50 | |||
3349 | 48 | pid_t process_id() const override | 51 | pid_t process_id() const override |
3350 | 49 | { | 52 | { |
3352 | 50 | return -1; | 53 | return pid; |
3353 | 51 | } | 54 | } |
3354 | 52 | 55 | ||
3355 | 53 | void force_requests_to_complete() override | 56 | void force_requests_to_complete() override |
3356 | @@ -76,6 +79,16 @@ | |||
3357 | 76 | void set_lifecycle_state(MirLifecycleState /*state*/) | 79 | void set_lifecycle_state(MirLifecycleState /*state*/) |
3358 | 77 | { | 80 | { |
3359 | 78 | } | 81 | } |
3360 | 82 | |||
3361 | 83 | void start_prompt_session() override | ||
3362 | 84 | { | ||
3363 | 85 | } | ||
3364 | 86 | |||
3365 | 87 | void stop_prompt_session() override | ||
3366 | 88 | { | ||
3367 | 89 | } | ||
3368 | 90 | |||
3369 | 91 | pid_t const pid; | ||
3370 | 79 | }; | 92 | }; |
3371 | 80 | 93 | ||
3372 | 81 | } | 94 | } |
3373 | 82 | 95 | ||
3374 | === modified file 'include/test/mir_test_doubles/stub_scene_surface.h' | |||
3375 | --- include/test/mir_test_doubles/stub_scene_surface.h 2014-05-09 09:56:45 +0000 | |||
3376 | +++ include/test/mir_test_doubles/stub_scene_surface.h 2014-06-18 17:25:24 +0000 | |||
3377 | @@ -83,6 +83,10 @@ | |||
3378 | 83 | void remove_observer(std::weak_ptr<scene::SurfaceObserver> const&) override {} | 83 | void remove_observer(std::weak_ptr<scene::SurfaceObserver> const&) override {} |
3379 | 84 | 84 | ||
3380 | 85 | void set_reception_mode(input::InputReceptionMode mode) override { input_mode = mode; } | 85 | void set_reception_mode(input::InputReceptionMode mode) override { input_mode = mode; } |
3381 | 86 | |||
3382 | 87 | void set_cursor_image(std::shared_ptr<graphics::CursorImage> const& /* image */) {} | ||
3383 | 88 | std::shared_ptr<graphics::CursorImage> cursor_image() { return {}; } | ||
3384 | 89 | |||
3385 | 86 | MirPixelFormat pixel_format() const override { return mir_pixel_format_xrgb_8888; } | 90 | MirPixelFormat pixel_format() const override { return mir_pixel_format_xrgb_8888; } |
3386 | 87 | 91 | ||
3387 | 88 | void swap_buffers(graphics::Buffer*, std::function<void(graphics::Buffer*)>) override {} | 92 | void swap_buffers(graphics::Buffer*, std::function<void(graphics::Buffer*)>) override {} |
3388 | 89 | 93 | ||
3389 | === modified file 'include/test/mir_test_doubles/stub_shell.h' | |||
3390 | --- include/test/mir_test_doubles/stub_shell.h 2014-04-15 05:31:19 +0000 | |||
3391 | +++ include/test/mir_test_doubles/stub_shell.h 2014-06-18 17:25:24 +0000 | |||
3392 | @@ -49,6 +49,25 @@ | |||
3393 | 49 | void handle_surface_created(std::shared_ptr<frontend::Session> const& /* session */) override | 49 | void handle_surface_created(std::shared_ptr<frontend::Session> const& /* session */) override |
3394 | 50 | { | 50 | { |
3395 | 51 | } | 51 | } |
3396 | 52 | std::shared_ptr<frontend::PromptSession> start_prompt_session_for(std::shared_ptr<frontend::Session> const& /* session */, | ||
3397 | 53 | scene::PromptSessionCreationParameters const& /* params */) | ||
3398 | 54 | { | ||
3399 | 55 | return std::shared_ptr<frontend::PromptSession>(); | ||
3400 | 56 | } | ||
3401 | 57 | void add_prompt_provider_process_for( | ||
3402 | 58 | std::shared_ptr<frontend::PromptSession> const& /* prompt_session */, | ||
3403 | 59 | pid_t /* process_id */) | ||
3404 | 60 | { | ||
3405 | 61 | } | ||
3406 | 62 | void add_prompt_provider_for( | ||
3407 | 63 | std::shared_ptr<frontend::PromptSession> const& /* prompt_session */, | ||
3408 | 64 | std::shared_ptr<frontend::Session> const& /* session */) | ||
3409 | 65 | { | ||
3410 | 66 | } | ||
3411 | 67 | void stop_prompt_session(std::shared_ptr<frontend::PromptSession> const& /* prompt_session */) | ||
3412 | 68 | { | ||
3413 | 69 | } | ||
3414 | 70 | |||
3415 | 52 | std::shared_ptr<StubSession> const stub_session; | 71 | std::shared_ptr<StubSession> const stub_session; |
3416 | 53 | }; | 72 | }; |
3417 | 54 | 73 | ||
3418 | 55 | 74 | ||
3419 | === modified file 'include/test/mir_test_doubles/stub_swapping_gl_context.h' | |||
3420 | --- include/test/mir_test_doubles/stub_swapping_gl_context.h 2014-02-21 16:51:45 +0000 | |||
3421 | +++ include/test/mir_test_doubles/stub_swapping_gl_context.h 2014-06-18 17:25:24 +0000 | |||
3422 | @@ -20,6 +20,7 @@ | |||
3423 | 20 | #define MIR_TEST_DOUBLES_STUB_SWAPPING_GL_CONTEXT_H_ | 20 | #define MIR_TEST_DOUBLES_STUB_SWAPPING_GL_CONTEXT_H_ |
3424 | 21 | 21 | ||
3425 | 22 | #include "src/platform/graphics/android/gl_context.h" | 22 | #include "src/platform/graphics/android/gl_context.h" |
3426 | 23 | #include "stub_buffer.h" | ||
3427 | 23 | 24 | ||
3428 | 24 | namespace mir | 25 | namespace mir |
3429 | 25 | { | 26 | { |
3430 | @@ -31,6 +32,10 @@ | |||
3431 | 31 | struct StubSwappingGLContext : public graphics::android::SwappingGLContext | 32 | struct StubSwappingGLContext : public graphics::android::SwappingGLContext |
3432 | 32 | { | 33 | { |
3433 | 33 | void swap_buffers() const {} | 34 | void swap_buffers() const {} |
3434 | 35 | std::shared_ptr<graphics::Buffer> last_rendered_buffer() const | ||
3435 | 36 | { | ||
3436 | 37 | return std::make_shared<StubBuffer>(); | ||
3437 | 38 | } | ||
3438 | 34 | }; | 39 | }; |
3439 | 35 | 40 | ||
3440 | 36 | } | 41 | } |
3441 | 37 | 42 | ||
3442 | === modified file 'include/test/mir_test_framework/in_process_server.h' | |||
3443 | --- include/test/mir_test_framework/in_process_server.h 2014-03-06 06:05:17 +0000 | |||
3444 | +++ include/test/mir_test_framework/in_process_server.h 2014-06-18 17:25:24 +0000 | |||
3445 | @@ -1,5 +1,5 @@ | |||
3446 | 1 | /* | 1 | /* |
3448 | 2 | * Copyright © 2013 Canonical Ltd. | 2 | * Copyright © 2013-2014 Canonical Ltd. |
3449 | 3 | * | 3 | * |
3450 | 4 | * This program is free software: you can redistribute it and/or modify it | 4 | * This program is free software: you can redistribute it and/or modify it |
3451 | 5 | * under the terms of the GNU General Public License version 3, | 5 | * under the terms of the GNU General Public License version 3, |
3452 | @@ -19,6 +19,8 @@ | |||
3453 | 19 | #ifndef MIR_TEST_FRAMEWORK_IN_PROCESS_SERVER_H_ | 19 | #ifndef MIR_TEST_FRAMEWORK_IN_PROCESS_SERVER_H_ |
3454 | 20 | #define MIR_TEST_FRAMEWORK_IN_PROCESS_SERVER_H_ | 20 | #define MIR_TEST_FRAMEWORK_IN_PROCESS_SERVER_H_ |
3455 | 21 | 21 | ||
3456 | 22 | #include "mir_test_framework/server_runner.h" | ||
3457 | 23 | |||
3458 | 22 | #include <gtest/gtest.h> | 24 | #include <gtest/gtest.h> |
3459 | 23 | 25 | ||
3460 | 24 | #include <string> | 26 | #include <string> |
3461 | @@ -34,29 +36,18 @@ | |||
3462 | 34 | namespace mir_test_framework | 36 | namespace mir_test_framework |
3463 | 35 | { | 37 | { |
3464 | 36 | /// Fixture for running Mir server in test process | 38 | /// Fixture for running Mir server in test process |
3466 | 37 | struct InProcessServer : testing::Test | 39 | struct InProcessServer : testing::Test, private ServerRunner |
3467 | 38 | { | 40 | { |
3468 | 39 | InProcessServer(); | ||
3469 | 40 | ~InProcessServer(); | ||
3470 | 41 | |||
3471 | 42 | /// Starts the server | 41 | /// Starts the server |
3472 | 43 | /// \warning don't forget to call this if you override SetUp() | 42 | /// \warning don't forget to call this if you override SetUp() |
3474 | 44 | void SetUp() override; | 43 | void SetUp() override { ServerRunner::start_server(); } |
3475 | 45 | 44 | ||
3476 | 46 | /// Stops the server | 45 | /// Stops the server |
3477 | 47 | /// \warning don't forget to call this if you override TearDown() | 46 | /// \warning don't forget to call this if you override TearDown() |
3479 | 48 | void TearDown() override; | 47 | void TearDown() override { ServerRunner::stop_server(); } |
3480 | 49 | 48 | ||
3481 | 50 | /// \return a connection string for a new client to connect to the server | 49 | /// \return a connection string for a new client to connect to the server |
3491 | 51 | std::string new_connection(); | 50 | using ServerRunner::new_connection; |
3483 | 52 | |||
3484 | 53 | private: | ||
3485 | 54 | mir::DisplayServer* start_mir_server(); | ||
3486 | 55 | virtual mir::DefaultServerConfiguration& server_config() = 0; | ||
3487 | 56 | |||
3488 | 57 | char const* const old_env; | ||
3489 | 58 | std::thread server_thread; | ||
3490 | 59 | mir::DisplayServer* display_server = 0; | ||
3492 | 60 | }; | 51 | }; |
3493 | 61 | } | 52 | } |
3494 | 62 | 53 | ||
3495 | 63 | 54 | ||
3496 | === modified file 'include/test/mir_test_framework/input_testing_client_configuration.h' | |||
3497 | --- include/test/mir_test_framework/input_testing_client_configuration.h 2014-05-26 14:41:49 +0000 | |||
3498 | +++ include/test/mir_test_framework/input_testing_client_configuration.h 2014-06-18 17:25:24 +0000 | |||
3499 | @@ -20,8 +20,7 @@ | |||
3500 | 20 | #define MIR_TEST_FRAMEWORK_INPUT_TESTING_CLIENT_CONFIGURATION | 20 | #define MIR_TEST_FRAMEWORK_INPUT_TESTING_CLIENT_CONFIGURATION |
3501 | 21 | 21 | ||
3502 | 22 | #include "mir_test_framework/testing_client_configuration.h" | 22 | #include "mir_test_framework/testing_client_configuration.h" |
3505 | 23 | #include "mir_test_framework/cross_process_sync.h" | 23 | #include "mir_test/barrier.h" |
3504 | 24 | #include "mir_test/wait_condition.h" | ||
3506 | 25 | 24 | ||
3507 | 26 | #include <mir_toolkit/event.h> | 25 | #include <mir_toolkit/event.h> |
3508 | 27 | 26 | ||
3509 | @@ -29,6 +28,7 @@ | |||
3510 | 29 | 28 | ||
3511 | 30 | #include <string> | 29 | #include <string> |
3512 | 31 | 30 | ||
3513 | 31 | namespace mir { namespace test { class WaitCondition; } } | ||
3514 | 32 | namespace mir_test_framework | 32 | namespace mir_test_framework |
3515 | 33 | { | 33 | { |
3516 | 34 | 34 | ||
3517 | @@ -38,7 +38,7 @@ | |||
3518 | 38 | class InputTestingClientConfiguration : public TestingClientConfiguration | 38 | class InputTestingClientConfiguration : public TestingClientConfiguration |
3519 | 39 | { | 39 | { |
3520 | 40 | public: | 40 | public: |
3522 | 41 | InputTestingClientConfiguration(std::string const& client_name, CrossProcessSync const& input_cb_setup_fence); | 41 | InputTestingClientConfiguration(std::string const& client_name, mir::test::Barrier& input_cb_setup_fence); |
3523 | 42 | virtual ~InputTestingClientConfiguration() = default; | 42 | virtual ~InputTestingClientConfiguration() = default; |
3524 | 43 | 43 | ||
3525 | 44 | void exec(); | 44 | void exec(); |
3526 | @@ -62,7 +62,7 @@ | |||
3527 | 62 | std::string connect_string; | 62 | std::string connect_string; |
3528 | 63 | private: | 63 | private: |
3529 | 64 | std::string const client_name; | 64 | std::string const client_name; |
3531 | 65 | CrossProcessSync input_cb_setup_fence; | 65 | mir::test::Barrier& input_cb_setup_fence; |
3532 | 66 | }; | 66 | }; |
3533 | 67 | 67 | ||
3534 | 68 | } | 68 | } |
3535 | 69 | 69 | ||
3536 | === added file 'include/test/mir_test_framework/server_runner.h' | |||
3537 | --- include/test/mir_test_framework/server_runner.h 1970-01-01 00:00:00 +0000 | |||
3538 | +++ include/test/mir_test_framework/server_runner.h 2014-06-18 17:25:24 +0000 | |||
3539 | @@ -0,0 +1,60 @@ | |||
3540 | 1 | /* | ||
3541 | 2 | * Copyright © 2014 Canonical Ltd. | ||
3542 | 3 | * | ||
3543 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
3544 | 5 | * under the terms of the GNU General Public License version 3, | ||
3545 | 6 | * as published by the Free Software Foundation. | ||
3546 | 7 | * | ||
3547 | 8 | * This program is distributed in the hope that it will be useful, | ||
3548 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
3549 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
3550 | 11 | * GNU General Public License for more details. | ||
3551 | 12 | * | ||
3552 | 13 | * You should have received a copy of the GNU General Public License | ||
3553 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
3554 | 15 | * | ||
3555 | 16 | * Authored By: Alan Griffiths <alan@octopull.co.uk> | ||
3556 | 17 | */ | ||
3557 | 18 | |||
3558 | 19 | #ifndef MIR_TEST_FRAMEWORK_SERVER_RUNNER_H_ | ||
3559 | 20 | #define MIR_TEST_FRAMEWORK_SERVER_RUNNER_H_ | ||
3560 | 21 | |||
3561 | 22 | #include <gtest/gtest.h> | ||
3562 | 23 | |||
3563 | 24 | #include <string> | ||
3564 | 25 | #include <thread> | ||
3565 | 26 | |||
3566 | 27 | namespace mir | ||
3567 | 28 | { | ||
3568 | 29 | class DisplayServer; | ||
3569 | 30 | class DefaultServerConfiguration; | ||
3570 | 31 | } | ||
3571 | 32 | |||
3572 | 33 | namespace mir_test_framework | ||
3573 | 34 | { | ||
3574 | 35 | /// Utility for running Mir server in test process | ||
3575 | 36 | struct ServerRunner | ||
3576 | 37 | { | ||
3577 | 38 | ServerRunner(); | ||
3578 | 39 | virtual ~ServerRunner(); | ||
3579 | 40 | |||
3580 | 41 | /// Starts the server | ||
3581 | 42 | void start_server(); | ||
3582 | 43 | |||
3583 | 44 | /// Stops the server | ||
3584 | 45 | void stop_server(); | ||
3585 | 46 | |||
3586 | 47 | /// \return a connection string for a new client to connect to the server | ||
3587 | 48 | std::string new_connection(); | ||
3588 | 49 | |||
3589 | 50 | private: | ||
3590 | 51 | mir::DisplayServer* start_mir_server(); | ||
3591 | 52 | virtual mir::DefaultServerConfiguration& server_config() = 0; | ||
3592 | 53 | |||
3593 | 54 | char const* const old_env; | ||
3594 | 55 | std::thread server_thread; | ||
3595 | 56 | mir::DisplayServer* display_server = 0; | ||
3596 | 57 | }; | ||
3597 | 58 | } | ||
3598 | 59 | |||
3599 | 60 | #endif /* MIR_TEST_FRAMEWORK_SERVER_RUNNER_H_ */ | ||
3600 | 0 | 61 | ||
3601 | === modified file 'src/client/CMakeLists.txt' | |||
3602 | --- src/client/CMakeLists.txt 2014-05-22 11:31:21 +0000 | |||
3603 | +++ src/client/CMakeLists.txt 2014-06-18 17:25:24 +0000 | |||
3604 | @@ -48,6 +48,9 @@ | |||
3605 | 48 | mir_screencast.cpp | 48 | mir_screencast.cpp |
3606 | 49 | mir_screencast_api.cpp | 49 | mir_screencast_api.cpp |
3607 | 50 | mir_cursor_api.cpp | 50 | mir_cursor_api.cpp |
3608 | 51 | mir_prompt_session.cpp | ||
3609 | 52 | mir_prompt_session_api.cpp | ||
3610 | 53 | mir_event_distributor.cpp | ||
3611 | 51 | ) | 54 | ) |
3612 | 52 | 55 | ||
3613 | 53 | add_library( | 56 | add_library( |
3614 | @@ -82,7 +85,7 @@ | |||
3615 | 82 | mirclientlttngstatic | 85 | mirclientlttngstatic |
3616 | 83 | 86 | ||
3617 | 84 | ${MIR_COMMON_PLATFORM_LIBRARIES} | 87 | ${MIR_COMMON_PLATFORM_LIBRARIES} |
3619 | 85 | 88 | ||
3620 | 86 | 3rd_party | 89 | 3rd_party |
3621 | 87 | ) | 90 | ) |
3622 | 88 | 91 | ||
3623 | 89 | 92 | ||
3624 | === modified file 'src/client/connection_configuration.h' | |||
3625 | --- src/client/connection_configuration.h 2014-03-06 06:05:17 +0000 | |||
3626 | +++ src/client/connection_configuration.h 2014-06-18 17:25:24 +0000 | |||
3627 | @@ -47,6 +47,8 @@ | |||
3628 | 47 | class ClientPlatformFactory; | 47 | class ClientPlatformFactory; |
3629 | 48 | class DisplayConfiguration; | 48 | class DisplayConfiguration; |
3630 | 49 | class LifecycleControl; | 49 | class LifecycleControl; |
3631 | 50 | class EventSink; | ||
3632 | 51 | class EventHandlerRegister; | ||
3633 | 50 | 52 | ||
3634 | 51 | class ConnectionConfiguration | 53 | class ConnectionConfiguration |
3635 | 52 | { | 54 | { |
3636 | @@ -60,6 +62,8 @@ | |||
3637 | 60 | virtual std::shared_ptr<input::receiver::InputPlatform> the_input_platform() = 0; | 62 | virtual std::shared_ptr<input::receiver::InputPlatform> the_input_platform() = 0; |
3638 | 61 | virtual std::shared_ptr<DisplayConfiguration> the_display_configuration() = 0; | 63 | virtual std::shared_ptr<DisplayConfiguration> the_display_configuration() = 0; |
3639 | 62 | virtual std::shared_ptr<LifecycleControl> the_lifecycle_control() = 0; | 64 | virtual std::shared_ptr<LifecycleControl> the_lifecycle_control() = 0; |
3640 | 65 | virtual std::shared_ptr<EventSink> the_event_sink() = 0; | ||
3641 | 66 | virtual std::shared_ptr<EventHandlerRegister> the_event_handler_register() = 0; | ||
3642 | 63 | 67 | ||
3643 | 64 | protected: | 68 | protected: |
3644 | 65 | ConnectionConfiguration() = default; | 69 | ConnectionConfiguration() = default; |
3645 | 66 | 70 | ||
3646 | === modified file 'src/client/connection_surface_map.h' | |||
3647 | --- src/client/connection_surface_map.h 2014-03-06 06:05:17 +0000 | |||
3648 | +++ src/client/connection_surface_map.h 2014-06-18 17:25:24 +0000 | |||
3649 | @@ -33,6 +33,7 @@ | |||
3650 | 33 | { | 33 | { |
3651 | 34 | public: | 34 | public: |
3652 | 35 | ConnectionSurfaceMap(); | 35 | ConnectionSurfaceMap(); |
3653 | 36 | ~ConnectionSurfaceMap() noexcept; | ||
3654 | 36 | 37 | ||
3655 | 37 | void with_surface_do(int surface_id, std::function<void(MirSurface*)> exec) const override; | 38 | void with_surface_do(int surface_id, std::function<void(MirSurface*)> exec) const override; |
3656 | 38 | void insert(int surface_id, MirSurface* surface); | 39 | void insert(int surface_id, MirSurface* surface); |
3657 | 39 | 40 | ||
3658 | === modified file 'src/client/default_connection_configuration.cpp' | |||
3659 | --- src/client/default_connection_configuration.cpp 2014-03-26 05:48:59 +0000 | |||
3660 | +++ src/client/default_connection_configuration.cpp 2014-06-18 17:25:24 +0000 | |||
3661 | @@ -32,6 +32,7 @@ | |||
3662 | 32 | #include "lifecycle_control.h" | 32 | #include "lifecycle_control.h" |
3663 | 33 | #include "mir/shared_library.h" | 33 | #include "mir/shared_library.h" |
3664 | 34 | #include "client_platform_factory.h" | 34 | #include "client_platform_factory.h" |
3665 | 35 | #include "mir_event_distributor.h" | ||
3666 | 35 | 36 | ||
3667 | 36 | namespace mcl = mir::client; | 37 | namespace mcl = mir::client; |
3668 | 37 | 38 | ||
3669 | @@ -81,7 +82,7 @@ | |||
3670 | 81 | [this] | 82 | [this] |
3671 | 82 | { | 83 | { |
3672 | 83 | return mcl::rpc::make_rpc_channel( | 84 | return mcl::rpc::make_rpc_channel( |
3674 | 84 | the_socket_file(), the_surface_map(), the_display_configuration(), the_rpc_report(), the_lifecycle_control()); | 85 | the_socket_file(), the_surface_map(), the_display_configuration(), the_rpc_report(), the_lifecycle_control(), the_event_sink()); |
3675 | 85 | }); | 86 | }); |
3676 | 86 | } | 87 | } |
3677 | 87 | 88 | ||
3678 | @@ -182,3 +183,21 @@ | |||
3679 | 182 | return std::make_shared<mcl::LifecycleControl>(); | 183 | return std::make_shared<mcl::LifecycleControl>(); |
3680 | 183 | }); | 184 | }); |
3681 | 184 | } | 185 | } |
3682 | 186 | |||
3683 | 187 | std::shared_ptr<mcl::EventSink> mcl::DefaultConnectionConfiguration::the_event_sink() | ||
3684 | 188 | { | ||
3685 | 189 | return event_distributor( | ||
3686 | 190 | [] | ||
3687 | 191 | { | ||
3688 | 192 | return std::make_shared<MirEventDistributor>(); | ||
3689 | 193 | }); | ||
3690 | 194 | } | ||
3691 | 195 | |||
3692 | 196 | std::shared_ptr<mcl::EventHandlerRegister> mcl::DefaultConnectionConfiguration::the_event_handler_register() | ||
3693 | 197 | { | ||
3694 | 198 | return event_distributor( | ||
3695 | 199 | [] | ||
3696 | 200 | { | ||
3697 | 201 | return std::make_shared<MirEventDistributor>(); | ||
3698 | 202 | }); | ||
3699 | 203 | } | ||
3700 | 185 | 204 | ||
3701 | === modified file 'src/client/default_connection_configuration.h' | |||
3702 | --- src/client/default_connection_configuration.h 2014-03-06 06:05:17 +0000 | |||
3703 | +++ src/client/default_connection_configuration.h 2014-06-18 17:25:24 +0000 | |||
3704 | @@ -36,6 +36,7 @@ | |||
3705 | 36 | } | 36 | } |
3706 | 37 | namespace client | 37 | namespace client |
3707 | 38 | { | 38 | { |
3708 | 39 | class EventDistributor; | ||
3709 | 39 | 40 | ||
3710 | 40 | namespace rpc | 41 | namespace rpc |
3711 | 41 | { | 42 | { |
3712 | @@ -54,6 +55,8 @@ | |||
3713 | 54 | std::shared_ptr<input::receiver::InputPlatform> the_input_platform(); | 55 | std::shared_ptr<input::receiver::InputPlatform> the_input_platform(); |
3714 | 55 | std::shared_ptr<DisplayConfiguration> the_display_configuration(); | 56 | std::shared_ptr<DisplayConfiguration> the_display_configuration(); |
3715 | 56 | std::shared_ptr<LifecycleControl> the_lifecycle_control(); | 57 | std::shared_ptr<LifecycleControl> the_lifecycle_control(); |
3716 | 58 | std::shared_ptr<EventSink> the_event_sink(); | ||
3717 | 59 | std::shared_ptr<EventHandlerRegister> the_event_handler_register(); | ||
3718 | 57 | 60 | ||
3719 | 58 | virtual std::string the_socket_file(); | 61 | virtual std::string the_socket_file(); |
3720 | 59 | virtual std::shared_ptr<rpc::RpcReport> the_rpc_report(); | 62 | virtual std::shared_ptr<rpc::RpcReport> the_rpc_report(); |
3721 | @@ -67,6 +70,7 @@ | |||
3722 | 67 | CachedPtr<ConnectionSurfaceMap> surface_map; | 70 | CachedPtr<ConnectionSurfaceMap> surface_map; |
3723 | 68 | CachedPtr<DisplayConfiguration> display_configuration; | 71 | CachedPtr<DisplayConfiguration> display_configuration; |
3724 | 69 | CachedPtr<LifecycleControl> lifecycle_control; | 72 | CachedPtr<LifecycleControl> lifecycle_control; |
3725 | 73 | CachedPtr<EventDistributor> event_distributor; | ||
3726 | 70 | 74 | ||
3727 | 71 | CachedPtr<rpc::RpcReport> rpc_report; | 75 | CachedPtr<rpc::RpcReport> rpc_report; |
3728 | 72 | CachedPtr<input::receiver::InputReceiverReport> input_receiver_report; | 76 | CachedPtr<input::receiver::InputReceiverReport> input_receiver_report; |
3729 | 73 | 77 | ||
3730 | === added file 'src/client/event_distributor.h' | |||
3731 | --- src/client/event_distributor.h 1970-01-01 00:00:00 +0000 | |||
3732 | +++ src/client/event_distributor.h 2014-06-18 17:25:24 +0000 | |||
3733 | @@ -0,0 +1,37 @@ | |||
3734 | 1 | /* | ||
3735 | 2 | * Copyright © 2014 Canonical Ltd. | ||
3736 | 3 | * | ||
3737 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
3738 | 5 | * under the terms of the GNU Lesser General Public License version 3, | ||
3739 | 6 | * as published by the Free Software Foundation. | ||
3740 | 7 | * | ||
3741 | 8 | * This program is distributed in the hope that it will be useful, | ||
3742 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
3743 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
3744 | 11 | * GNU Lesser General Public License for more details. | ||
3745 | 12 | * | ||
3746 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
3747 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
3748 | 15 | * | ||
3749 | 16 | * Authored by: Nick Dedekind <nick.dedekind@canonical.com> | ||
3750 | 17 | */ | ||
3751 | 18 | |||
3752 | 19 | #ifndef MIR_CLIENT_EVENT_DISTRIBUTOR_H_ | ||
3753 | 20 | #define MIR_CLIENT_EVENT_DISTRIBUTOR_H_ | ||
3754 | 21 | |||
3755 | 22 | #include "event_sink.h" | ||
3756 | 23 | #include "event_handler_register.h" | ||
3757 | 24 | |||
3758 | 25 | namespace mir | ||
3759 | 26 | { | ||
3760 | 27 | namespace client | ||
3761 | 28 | { | ||
3762 | 29 | |||
3763 | 30 | class EventDistributor : public EventHandlerRegister, public EventSink | ||
3764 | 31 | { | ||
3765 | 32 | }; | ||
3766 | 33 | |||
3767 | 34 | } // namespace client | ||
3768 | 35 | } // namespace mir | ||
3769 | 36 | |||
3770 | 37 | #endif // MIR_CLIENT_EVENT_DISTRIBUTOR_H_ | ||
3771 | 0 | 38 | ||
3772 | === added file 'src/client/event_handler_register.h' | |||
3773 | --- src/client/event_handler_register.h 1970-01-01 00:00:00 +0000 | |||
3774 | +++ src/client/event_handler_register.h 2014-06-18 17:25:24 +0000 | |||
3775 | @@ -0,0 +1,47 @@ | |||
3776 | 1 | /* | ||
3777 | 2 | * Copyright © 2014 Canonical Ltd. | ||
3778 | 3 | * | ||
3779 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
3780 | 5 | * under the terms of the GNU Lesser General Public License version 3, | ||
3781 | 6 | * as published by the Free Software Foundation. | ||
3782 | 7 | * | ||
3783 | 8 | * This program is distributed in the hope that it will be useful, | ||
3784 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
3785 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
3786 | 11 | * GNU Lesser General Public License for more details. | ||
3787 | 12 | * | ||
3788 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
3789 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
3790 | 15 | * | ||
3791 | 16 | * Authored by: Nick Dedekind <nick.dedekind@canonical.com> | ||
3792 | 17 | */ | ||
3793 | 18 | |||
3794 | 19 | #ifndef MIR_CLIENT_EVENT_HANDLER_REGISTER_H_ | ||
3795 | 20 | #define MIR_CLIENT_EVENT_HANDLER_REGISTER_H_ | ||
3796 | 21 | |||
3797 | 22 | #include "mir_toolkit/event.h" | ||
3798 | 23 | |||
3799 | 24 | #include <functional> | ||
3800 | 25 | |||
3801 | 26 | namespace mir | ||
3802 | 27 | { | ||
3803 | 28 | namespace client | ||
3804 | 29 | { | ||
3805 | 30 | |||
3806 | 31 | class EventHandlerRegister | ||
3807 | 32 | { | ||
3808 | 33 | public: | ||
3809 | 34 | virtual ~EventHandlerRegister() = default; | ||
3810 | 35 | |||
3811 | 36 | virtual int register_event_handler(std::function<void(MirEvent const&)> const&) = 0; | ||
3812 | 37 | virtual void unregister_event_handler(int id) = 0; | ||
3813 | 38 | |||
3814 | 39 | protected: | ||
3815 | 40 | EventHandlerRegister() = default; | ||
3816 | 41 | EventHandlerRegister(EventHandlerRegister const&) = delete; | ||
3817 | 42 | EventHandlerRegister& operator=(EventHandlerRegister const&) = delete; | ||
3818 | 43 | }; | ||
3819 | 44 | } // namespace client | ||
3820 | 45 | } // namespace mir | ||
3821 | 46 | |||
3822 | 47 | #endif // MIR_CLIENT_EVENT_HANDLER_REGISTER_H_ | ||
3823 | 0 | 48 | ||
3824 | === added file 'src/client/event_sink.h' | |||
3825 | --- src/client/event_sink.h 1970-01-01 00:00:00 +0000 | |||
3826 | +++ src/client/event_sink.h 2014-06-18 17:25:24 +0000 | |||
3827 | @@ -0,0 +1,44 @@ | |||
3828 | 1 | /* | ||
3829 | 2 | * Copyright © 2014 Canonical Ltd. | ||
3830 | 3 | * | ||
3831 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
3832 | 5 | * under the terms of the GNU Lesser General Public License version 3, | ||
3833 | 6 | * as published by the Free Software Foundation. | ||
3834 | 7 | * | ||
3835 | 8 | * This program is distributed in the hope that it will be useful, | ||
3836 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
3837 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
3838 | 11 | * GNU Lesser General Public License for more details. | ||
3839 | 12 | * | ||
3840 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
3841 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
3842 | 15 | * | ||
3843 | 16 | * Authored by: Nick Dedekind <nick.dedekind@canonical.com> | ||
3844 | 17 | */ | ||
3845 | 18 | |||
3846 | 19 | #ifndef MIR_CLIENT_EVENT_SINK_H_ | ||
3847 | 20 | #define MIR_CLIENT_EVENT_SINK_H_ | ||
3848 | 21 | |||
3849 | 22 | #include "mir_toolkit/event.h" | ||
3850 | 23 | |||
3851 | 24 | namespace mir | ||
3852 | 25 | { | ||
3853 | 26 | namespace client | ||
3854 | 27 | { | ||
3855 | 28 | |||
3856 | 29 | class EventSink | ||
3857 | 30 | { | ||
3858 | 31 | public: | ||
3859 | 32 | virtual ~EventSink() = default; | ||
3860 | 33 | |||
3861 | 34 | virtual void handle_event(MirEvent const& e) = 0; | ||
3862 | 35 | |||
3863 | 36 | protected: | ||
3864 | 37 | EventSink() = default; | ||
3865 | 38 | EventSink(EventSink const&) = delete; | ||
3866 | 39 | EventSink& operator=(EventSink const&) = delete; | ||
3867 | 40 | }; | ||
3868 | 41 | } // namespace client | ||
3869 | 42 | } // namespace mir | ||
3870 | 43 | |||
3871 | 44 | #endif // MIR_CLIENT_EVENT_SINK_H_ | ||
3872 | 0 | 45 | ||
3873 | === modified file 'src/client/logging/input_receiver_report.cpp' | |||
3874 | --- src/client/logging/input_receiver_report.cpp 2014-03-06 06:05:17 +0000 | |||
3875 | +++ src/client/logging/input_receiver_report.cpp 2014-06-18 17:25:24 +0000 | |||
3876 | @@ -91,6 +91,7 @@ | |||
3877 | 91 | ss << " orientation: " << ev.pointer_coordinates[i].orientation << std::endl; | 91 | ss << " orientation: " << ev.pointer_coordinates[i].orientation << std::endl; |
3878 | 92 | ss << " vscroll: " << ev.pointer_coordinates[i].vscroll << std::endl; | 92 | ss << " vscroll: " << ev.pointer_coordinates[i].vscroll << std::endl; |
3879 | 93 | ss << " hscroll: " << ev.pointer_coordinates[i].hscroll << std::endl; | 93 | ss << " hscroll: " << ev.pointer_coordinates[i].hscroll << std::endl; |
3880 | 94 | ss << " tool_type: " << ev.pointer_coordinates[i].tool_type << std::endl; | ||
3881 | 94 | ss << " }" << std::endl; | 95 | ss << " }" << std::endl; |
3882 | 95 | } | 96 | } |
3883 | 96 | ss << "}"; | 97 | ss << "}"; |
3884 | 97 | 98 | ||
3885 | === modified file 'src/client/mir_connection.cpp' | |||
3886 | --- src/client/mir_connection.cpp 2014-05-22 11:31:21 +0000 | |||
3887 | +++ src/client/mir_connection.cpp 2014-06-18 17:25:24 +0000 | |||
3888 | @@ -18,6 +18,7 @@ | |||
3889 | 18 | 18 | ||
3890 | 19 | #include "mir_connection.h" | 19 | #include "mir_connection.h" |
3891 | 20 | #include "mir_surface.h" | 20 | #include "mir_surface.h" |
3892 | 21 | #include "mir_prompt_session.h" | ||
3893 | 21 | #include "client_platform.h" | 22 | #include "client_platform.h" |
3894 | 22 | #include "client_platform_factory.h" | 23 | #include "client_platform_factory.h" |
3895 | 23 | #include "rpc/mir_basic_rpc_channel.h" | 24 | #include "rpc/mir_basic_rpc_channel.h" |
3896 | @@ -82,7 +83,8 @@ | |||
3897 | 82 | input_platform(conf.the_input_platform()), | 83 | input_platform(conf.the_input_platform()), |
3898 | 83 | display_configuration(conf.the_display_configuration()), | 84 | display_configuration(conf.the_display_configuration()), |
3899 | 84 | lifecycle_control(conf.the_lifecycle_control()), | 85 | lifecycle_control(conf.the_lifecycle_control()), |
3901 | 85 | surface_map(conf.the_surface_map()) | 86 | surface_map(conf.the_surface_map()), |
3902 | 87 | event_handler_register(conf.the_event_handler_register()) | ||
3903 | 86 | { | 88 | { |
3904 | 87 | connect_result.set_error("connect not called"); | 89 | connect_result.set_error("connect not called"); |
3905 | 88 | { | 90 | { |
3906 | @@ -186,6 +188,7 @@ | |||
3907 | 186 | release_wait_handles.push_back(new_wait_handle); | 188 | release_wait_handles.push_back(new_wait_handle); |
3908 | 187 | } | 189 | } |
3909 | 188 | 190 | ||
3910 | 191 | new_wait_handle->expect_result(); | ||
3911 | 189 | server.release_surface(0, &message, &void_response, | 192 | server.release_surface(0, &message, &void_response, |
3912 | 190 | gp::NewCallback(this, &MirConnection::released, surf_release)); | 193 | gp::NewCallback(this, &MirConnection::released, surf_release)); |
3913 | 191 | 194 | ||
3914 | @@ -193,6 +196,11 @@ | |||
3915 | 193 | return new_wait_handle; | 196 | return new_wait_handle; |
3916 | 194 | } | 197 | } |
3917 | 195 | 198 | ||
3918 | 199 | MirPromptSession* MirConnection::create_prompt_session() | ||
3919 | 200 | { | ||
3920 | 201 | return new MirPromptSession(display_server(), event_handler_register); | ||
3921 | 202 | } | ||
3922 | 203 | |||
3923 | 196 | namespace | 204 | namespace |
3924 | 197 | { | 205 | { |
3925 | 198 | void default_lifecycle_event_handler(MirLifecycleState transition) | 206 | void default_lifecycle_event_handler(MirLifecycleState transition) |
3926 | @@ -272,6 +280,7 @@ | |||
3927 | 272 | 280 | ||
3928 | 273 | MirWaitHandle* MirConnection::disconnect() | 281 | MirWaitHandle* MirConnection::disconnect() |
3929 | 274 | { | 282 | { |
3930 | 283 | disconnect_wait_handle.expect_result(); | ||
3931 | 275 | server.disconnect(0, &ignored, &ignored, | 284 | server.disconnect(0, &ignored, &ignored, |
3932 | 276 | google::protobuf::NewCallback(this, &MirConnection::done_disconnect)); | 285 | google::protobuf::NewCallback(this, &MirConnection::done_disconnect)); |
3933 | 277 | 286 | ||
3934 | @@ -294,6 +303,7 @@ | |||
3935 | 294 | mir::protobuf::DRMMagic request; | 303 | mir::protobuf::DRMMagic request; |
3936 | 295 | request.set_magic(magic); | 304 | request.set_magic(magic); |
3937 | 296 | 305 | ||
3938 | 306 | drm_auth_magic_wait_handle.expect_result(); | ||
3939 | 297 | server.drm_auth_magic( | 307 | server.drm_auth_magic( |
3940 | 298 | 0, | 308 | 0, |
3941 | 299 | &request, | 309 | &request, |
3942 | @@ -304,40 +314,6 @@ | |||
3943 | 304 | return &drm_auth_magic_wait_handle; | 314 | return &drm_auth_magic_wait_handle; |
3944 | 305 | } | 315 | } |
3945 | 306 | 316 | ||
3946 | 307 | MirWaitHandle* MirConnection::new_fds_for_trusted_clients( | ||
3947 | 308 | unsigned int no_of_fds, | ||
3948 | 309 | mir_client_fd_callback callback, | ||
3949 | 310 | void * context) | ||
3950 | 311 | { | ||
3951 | 312 | mir::protobuf::SocketFDRequest request; | ||
3952 | 313 | request.set_number(no_of_fds); | ||
3953 | 314 | |||
3954 | 315 | server.new_fds_for_trusted_clients( | ||
3955 | 316 | nullptr, | ||
3956 | 317 | &request, | ||
3957 | 318 | &socket_fd_response, | ||
3958 | 319 | google::protobuf::NewCallback(this, &MirConnection::done_fds_for_trusted_clients, | ||
3959 | 320 | callback, context)); | ||
3960 | 321 | |||
3961 | 322 | return &fds_for_trusted_clients_wait_handle; | ||
3962 | 323 | } | ||
3963 | 324 | |||
3964 | 325 | void MirConnection::done_fds_for_trusted_clients( | ||
3965 | 326 | mir_client_fd_callback callback, | ||
3966 | 327 | void* context) | ||
3967 | 328 | { | ||
3968 | 329 | auto const size = socket_fd_response.fd_size(); | ||
3969 | 330 | |||
3970 | 331 | std::vector<int> fds; | ||
3971 | 332 | fds.reserve(size); | ||
3972 | 333 | |||
3973 | 334 | for (auto i = 0; i != size; ++i) | ||
3974 | 335 | fds.push_back(socket_fd_response.fd(i)); | ||
3975 | 336 | |||
3976 | 337 | callback(this, size, fds.data(), context); | ||
3977 | 338 | fds_for_trusted_clients_wait_handle.result_received(); | ||
3978 | 339 | } | ||
3979 | 340 | |||
3980 | 341 | bool MirConnection::is_valid(MirConnection *connection) | 317 | bool MirConnection::is_valid(MirConnection *connection) |
3981 | 342 | { | 318 | { |
3982 | 343 | { | 319 | { |
3983 | @@ -500,6 +476,7 @@ | |||
3984 | 500 | } | 476 | } |
3985 | 501 | } | 477 | } |
3986 | 502 | 478 | ||
3987 | 479 | configure_display_wait_handle.expect_result(); | ||
3988 | 503 | server.configure_display(0, &request, &display_configuration_response, | 480 | server.configure_display(0, &request, &display_configuration_response, |
3989 | 504 | google::protobuf::NewCallback(this, &MirConnection::done_display_configure)); | 481 | google::protobuf::NewCallback(this, &MirConnection::done_display_configure)); |
3990 | 505 | 482 | ||
3991 | @@ -522,6 +499,6 @@ | |||
3992 | 522 | } | 499 | } |
3993 | 523 | 500 | ||
3994 | 524 | mir::protobuf::DisplayServer& MirConnection::display_server() | 501 | mir::protobuf::DisplayServer& MirConnection::display_server() |
3996 | 525 | { | 502 | { |
3997 | 526 | return server; | 503 | return server; |
3998 | 527 | } | 504 | } |
3999 | 528 | 505 | ||
4000 | === modified file 'src/client/mir_connection.h' | |||
4001 | --- src/client/mir_connection.h 2014-05-22 11:31:21 +0000 | |||
4002 | +++ src/client/mir_connection.h 2014-06-18 17:25:24 +0000 | |||
4003 | @@ -45,6 +45,7 @@ | |||
4004 | 45 | class ConnectionSurfaceMap; | 45 | class ConnectionSurfaceMap; |
4005 | 46 | class DisplayConfiguration; | 46 | class DisplayConfiguration; |
4006 | 47 | class LifecycleControl; | 47 | class LifecycleControl; |
4007 | 48 | class EventHandlerRegister; | ||
4008 | 48 | 49 | ||
4009 | 49 | namespace rpc | 50 | namespace rpc |
4010 | 50 | { | 51 | { |
4011 | @@ -86,6 +87,8 @@ | |||
4012 | 86 | mir_surface_callback callback, | 87 | mir_surface_callback callback, |
4013 | 87 | void *context); | 88 | void *context); |
4014 | 88 | 89 | ||
4015 | 90 | MirPromptSession* create_prompt_session(); | ||
4016 | 91 | |||
4017 | 89 | char const * get_error_message(); | 92 | char const * get_error_message(); |
4018 | 90 | 93 | ||
4019 | 91 | MirWaitHandle* connect( | 94 | MirWaitHandle* connect( |
4020 | @@ -123,11 +126,6 @@ | |||
4021 | 123 | 126 | ||
4022 | 124 | bool set_extra_platform_data(std::vector<int> const& extra_platform_data); | 127 | bool set_extra_platform_data(std::vector<int> const& extra_platform_data); |
4023 | 125 | 128 | ||
4024 | 126 | MirWaitHandle* new_fds_for_trusted_clients( | ||
4025 | 127 | unsigned int no_of_fds, | ||
4026 | 128 | mir_client_fd_callback callback, | ||
4027 | 129 | void * context); | ||
4028 | 130 | |||
4029 | 131 | std::shared_ptr<google::protobuf::RpcChannel> rpc_channel() const | 129 | std::shared_ptr<google::protobuf::RpcChannel> rpc_channel() const |
4030 | 132 | { | 130 | { |
4031 | 133 | return channel; | 131 | return channel; |
4032 | @@ -147,7 +145,6 @@ | |||
4033 | 147 | mir::protobuf::ConnectParameters connect_parameters; | 145 | mir::protobuf::ConnectParameters connect_parameters; |
4034 | 148 | mir::protobuf::DRMAuthMagicStatus drm_auth_magic_status; | 146 | mir::protobuf::DRMAuthMagicStatus drm_auth_magic_status; |
4035 | 149 | mir::protobuf::DisplayConfiguration display_configuration_response; | 147 | mir::protobuf::DisplayConfiguration display_configuration_response; |
4036 | 150 | mir::protobuf::SocketFD socket_fd_response; | ||
4037 | 151 | 148 | ||
4038 | 152 | std::shared_ptr<mir::client::ClientPlatformFactory> const client_platform_factory; | 149 | std::shared_ptr<mir::client::ClientPlatformFactory> const client_platform_factory; |
4039 | 153 | std::shared_ptr<mir::client::ClientPlatform> platform; | 150 | std::shared_ptr<mir::client::ClientPlatform> platform; |
4040 | @@ -161,7 +158,6 @@ | |||
4041 | 161 | MirWaitHandle disconnect_wait_handle; | 158 | MirWaitHandle disconnect_wait_handle; |
4042 | 162 | MirWaitHandle drm_auth_magic_wait_handle; | 159 | MirWaitHandle drm_auth_magic_wait_handle; |
4043 | 163 | MirWaitHandle configure_display_wait_handle; | 160 | MirWaitHandle configure_display_wait_handle; |
4044 | 164 | MirWaitHandle fds_for_trusted_clients_wait_handle; | ||
4045 | 165 | 161 | ||
4046 | 166 | std::mutex release_wait_handle_guard; | 162 | std::mutex release_wait_handle_guard; |
4047 | 167 | std::vector<MirWaitHandle*> release_wait_handles; | 163 | std::vector<MirWaitHandle*> release_wait_handles; |
4048 | @@ -172,6 +168,8 @@ | |||
4049 | 172 | 168 | ||
4050 | 173 | std::shared_ptr<mir::client::ConnectionSurfaceMap> const surface_map; | 169 | std::shared_ptr<mir::client::ConnectionSurfaceMap> const surface_map; |
4051 | 174 | 170 | ||
4052 | 171 | std::shared_ptr<mir::client::EventHandlerRegister> const event_handler_register; | ||
4053 | 172 | |||
4054 | 175 | std::vector<int> extra_platform_data; | 173 | std::vector<int> extra_platform_data; |
4055 | 176 | 174 | ||
4056 | 177 | struct SurfaceRelease; | 175 | struct SurfaceRelease; |
4057 | @@ -181,7 +179,6 @@ | |||
4058 | 181 | void connected(mir_connected_callback callback, void * context); | 179 | void connected(mir_connected_callback callback, void * context); |
4059 | 182 | void released(SurfaceRelease ); | 180 | void released(SurfaceRelease ); |
4060 | 183 | void done_drm_auth_magic(mir_drm_auth_magic_callback callback, void* context); | 181 | void done_drm_auth_magic(mir_drm_auth_magic_callback callback, void* context); |
4061 | 184 | void done_fds_for_trusted_clients(mir_client_fd_callback callback, void* context); | ||
4062 | 185 | bool validate_user_display_config(MirDisplayConfiguration* config); | 182 | bool validate_user_display_config(MirDisplayConfiguration* config); |
4063 | 186 | }; | 183 | }; |
4064 | 187 | 184 | ||
4065 | 188 | 185 | ||
4066 | === modified file 'src/client/mir_connection_api.cpp' | |||
4067 | --- src/client/mir_connection_api.cpp 2014-05-22 11:31:21 +0000 | |||
4068 | +++ src/client/mir_connection_api.cpp 2014-06-18 17:25:24 +0000 | |||
4069 | @@ -272,24 +272,6 @@ | |||
4070 | 272 | } | 272 | } |
4071 | 273 | } | 273 | } |
4072 | 274 | 274 | ||
4073 | 275 | MirWaitHandle* mir_connection_new_fds_for_trusted_clients( | ||
4074 | 276 | MirConnection* connection, | ||
4075 | 277 | unsigned int no_of_fds, | ||
4076 | 278 | mir_client_fd_callback callback, | ||
4077 | 279 | void * context) | ||
4078 | 280 | { | ||
4079 | 281 | try | ||
4080 | 282 | { | ||
4081 | 283 | return connection ? | ||
4082 | 284 | connection->new_fds_for_trusted_clients(no_of_fds, callback, context) : | ||
4083 | 285 | nullptr; | ||
4084 | 286 | } | ||
4085 | 287 | catch (std::exception const&) | ||
4086 | 288 | { | ||
4087 | 289 | return nullptr; | ||
4088 | 290 | } | ||
4089 | 291 | } | ||
4090 | 292 | |||
4091 | 293 | MirEGLNativeDisplayType mir_connection_get_egl_native_display( | 275 | MirEGLNativeDisplayType mir_connection_get_egl_native_display( |
4092 | 294 | MirConnection* connection) | 276 | MirConnection* connection) |
4093 | 295 | { | 277 | { |
4094 | 296 | 278 | ||
4095 | === added file 'src/client/mir_event_distributor.cpp' | |||
4096 | --- src/client/mir_event_distributor.cpp 1970-01-01 00:00:00 +0000 | |||
4097 | +++ src/client/mir_event_distributor.cpp 2014-06-18 17:25:24 +0000 | |||
4098 | @@ -0,0 +1,56 @@ | |||
4099 | 1 | /* | ||
4100 | 2 | * Copyright © 2014 Canonical Ltd. | ||
4101 | 3 | * | ||
4102 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
4103 | 5 | * under the terms of the GNU Lesser General Public License version 3, | ||
4104 | 6 | * as published by the Free Software Foundation. | ||
4105 | 7 | * | ||
4106 | 8 | * This program is distributed in the hope that it will be useful, | ||
4107 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
4108 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
4109 | 11 | * GNU Lesser General Public License for more details. | ||
4110 | 12 | * | ||
4111 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
4112 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
4113 | 15 | * | ||
4114 | 16 | * Authored by: Nick Dedekind <nick.dedekind@canonical.com> | ||
4115 | 17 | */ | ||
4116 | 18 | |||
4117 | 19 | #include "mir_event_distributor.h" | ||
4118 | 20 | |||
4119 | 21 | MirEventDistributor::MirEventDistributor() : | ||
4120 | 22 | next_fn_id{0} | ||
4121 | 23 | { | ||
4122 | 24 | } | ||
4123 | 25 | |||
4124 | 26 | int MirEventDistributor::register_event_handler(std::function<void(MirEvent const&)> const& fn) | ||
4125 | 27 | { | ||
4126 | 28 | std::unique_lock<decltype(mutex)> lock(mutex); | ||
4127 | 29 | |||
4128 | 30 | int id = ++next_fn_id; | ||
4129 | 31 | event_handlers[id] = fn; | ||
4130 | 32 | return id; | ||
4131 | 33 | } | ||
4132 | 34 | |||
4133 | 35 | void MirEventDistributor::unregister_event_handler(int id) | ||
4134 | 36 | { | ||
4135 | 37 | std::unique_lock<decltype(mutex)> lock(mutex); | ||
4136 | 38 | |||
4137 | 39 | event_handlers.erase(id); | ||
4138 | 40 | } | ||
4139 | 41 | |||
4140 | 42 | void MirEventDistributor::handle_event(MirEvent const& event) | ||
4141 | 43 | { | ||
4142 | 44 | std::unique_lock<decltype(mutex)> lock(mutex); | ||
4143 | 45 | |||
4144 | 46 | auto const event_handlers_copy(event_handlers); | ||
4145 | 47 | |||
4146 | 48 | for (auto const& handler : event_handlers_copy) | ||
4147 | 49 | { | ||
4148 | 50 | // Ensure handler wasn't unregistered since making copy | ||
4149 | 51 | if (event_handlers.find(handler.first) != event_handlers.end()) | ||
4150 | 52 | { | ||
4151 | 53 | handler.second(event); | ||
4152 | 54 | } | ||
4153 | 55 | } | ||
4154 | 56 | } | ||
4155 | 0 | 57 | ||
4156 | === added file 'src/client/mir_event_distributor.h' | |||
4157 | --- src/client/mir_event_distributor.h 1970-01-01 00:00:00 +0000 | |||
4158 | +++ src/client/mir_event_distributor.h 2014-06-18 17:25:24 +0000 | |||
4159 | @@ -0,0 +1,43 @@ | |||
4160 | 1 | /* | ||
4161 | 2 | * Copyright © 2014 Canonical Ltd. | ||
4162 | 3 | * | ||
4163 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
4164 | 5 | * under the terms of the GNU Lesser General Public License version 3, | ||
4165 | 6 | * as published by the Free Software Foundation. | ||
4166 | 7 | * | ||
4167 | 8 | * This program is distributed in the hope that it will be useful, | ||
4168 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
4169 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
4170 | 11 | * GNU Lesser General Public License for more details. | ||
4171 | 12 | * | ||
4172 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
4173 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
4174 | 15 | * | ||
4175 | 16 | * Authored by: Nick Dedekind <nick.dedekind@canonical.com> | ||
4176 | 17 | */ | ||
4177 | 18 | |||
4178 | 19 | #ifndef MIR_EVENT_DISTRIBUTOR_H | ||
4179 | 20 | |||
4180 | 21 | #include "event_distributor.h" | ||
4181 | 22 | |||
4182 | 23 | #include <mutex> | ||
4183 | 24 | #include <map> | ||
4184 | 25 | |||
4185 | 26 | class MirEventDistributor : public mir::client::EventDistributor | ||
4186 | 27 | { | ||
4187 | 28 | public: | ||
4188 | 29 | MirEventDistributor(); | ||
4189 | 30 | ~MirEventDistributor() = default; | ||
4190 | 31 | |||
4191 | 32 | int register_event_handler(std::function<void(MirEvent const&)> const&) override; | ||
4192 | 33 | void unregister_event_handler(int id) override; | ||
4193 | 34 | |||
4194 | 35 | void handle_event(MirEvent const& event) override; | ||
4195 | 36 | |||
4196 | 37 | private: | ||
4197 | 38 | mutable std::recursive_mutex mutex; | ||
4198 | 39 | std::map<int, std::function<void(MirEvent const&)>> event_handlers; | ||
4199 | 40 | int next_fn_id; | ||
4200 | 41 | }; | ||
4201 | 42 | |||
4202 | 43 | #endif /* MIR_EVENT_DISTRIBUTOR_H */ | ||
4203 | 0 | 44 | ||
4204 | === added file 'src/client/mir_prompt_session.cpp' | |||
4205 | --- src/client/mir_prompt_session.cpp 1970-01-01 00:00:00 +0000 | |||
4206 | +++ src/client/mir_prompt_session.cpp 2014-06-18 17:25:24 +0000 | |||
4207 | @@ -0,0 +1,203 @@ | |||
4208 | 1 | /* | ||
4209 | 2 | * Copyright © 2014 Canonical Ltd. | ||
4210 | 3 | * | ||
4211 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
4212 | 5 | * under the terms of the GNU Lesser General Public License version 3, | ||
4213 | 6 | * as published by the Free Software Foundation. | ||
4214 | 7 | * | ||
4215 | 8 | * This program is distributed in the hope that it will be useful, | ||
4216 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
4217 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
4218 | 11 | * GNU Lesser General Public License for more details. | ||
4219 | 12 | * | ||
4220 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
4221 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
4222 | 15 | * | ||
4223 | 16 | * Authored by: Nick Dedekind <nick.dedekind@canonical.com> | ||
4224 | 17 | */ | ||
4225 | 18 | |||
4226 | 19 | #include "mir_prompt_session.h" | ||
4227 | 20 | #include "event_handler_register.h" | ||
4228 | 21 | |||
4229 | 22 | namespace mp = mir::protobuf; | ||
4230 | 23 | namespace mcl = mir::client; | ||
4231 | 24 | |||
4232 | 25 | MirPromptSession::MirPromptSession( | ||
4233 | 26 | mp::DisplayServer& server, | ||
4234 | 27 | std::shared_ptr<mcl::EventHandlerRegister> const& event_handler_register) : | ||
4235 | 28 | server(server), | ||
4236 | 29 | event_handler_register(event_handler_register), | ||
4237 | 30 | event_handler_register_id{event_handler_register->register_event_handler( | ||
4238 | 31 | [this](MirEvent const& event) | ||
4239 | 32 | { | ||
4240 | 33 | if (event.type == mir_event_type_prompt_session_state_change) | ||
4241 | 34 | set_state(event.prompt_session.new_state); | ||
4242 | 35 | })}, | ||
4243 | 36 | state(mir_prompt_session_state_stopped), | ||
4244 | 37 | handle_prompt_session_state_change{[](MirPromptSessionState){}} | ||
4245 | 38 | { | ||
4246 | 39 | } | ||
4247 | 40 | |||
4248 | 41 | MirPromptSession::~MirPromptSession() | ||
4249 | 42 | { | ||
4250 | 43 | set_state(mir_prompt_session_state_stopped); | ||
4251 | 44 | } | ||
4252 | 45 | |||
4253 | 46 | void MirPromptSession::set_state(MirPromptSessionState new_state) | ||
4254 | 47 | { | ||
4255 | 48 | std::lock_guard<decltype(event_handler_mutex)> lock(event_handler_mutex); | ||
4256 | 49 | |||
4257 | 50 | if (new_state != state) | ||
4258 | 51 | { | ||
4259 | 52 | handle_prompt_session_state_change(new_state); | ||
4260 | 53 | |||
4261 | 54 | if (new_state == mir_prompt_session_state_stopped) | ||
4262 | 55 | { | ||
4263 | 56 | event_handler_register->unregister_event_handler(event_handler_register_id); | ||
4264 | 57 | } | ||
4265 | 58 | |||
4266 | 59 | state = new_state; | ||
4267 | 60 | } | ||
4268 | 61 | } | ||
4269 | 62 | |||
4270 | 63 | MirWaitHandle* MirPromptSession::start(pid_t application_pid, mir_prompt_session_callback callback, void* context) | ||
4271 | 64 | { | ||
4272 | 65 | { | ||
4273 | 66 | std::lock_guard<decltype(mutex)> lock(mutex); | ||
4274 | 67 | parameters.set_application_pid(application_pid); | ||
4275 | 68 | } | ||
4276 | 69 | |||
4277 | 70 | start_wait_handle.expect_result(); | ||
4278 | 71 | server.start_prompt_session( | ||
4279 | 72 | 0, | ||
4280 | 73 | ¶meters, | ||
4281 | 74 | &session, | ||
4282 | 75 | google::protobuf::NewCallback(this, &MirPromptSession::done_start, | ||
4283 | 76 | callback, context)); | ||
4284 | 77 | |||
4285 | 78 | return &start_wait_handle; | ||
4286 | 79 | } | ||
4287 | 80 | |||
4288 | 81 | MirWaitHandle* MirPromptSession::stop(mir_prompt_session_callback callback, void* context) | ||
4289 | 82 | { | ||
4290 | 83 | stop_wait_handle.expect_result(); | ||
4291 | 84 | |||
4292 | 85 | server.stop_prompt_session( | ||
4293 | 86 | 0, | ||
4294 | 87 | &protobuf_void, | ||
4295 | 88 | &protobuf_void, | ||
4296 | 89 | google::protobuf::NewCallback(this, &MirPromptSession::done_stop, | ||
4297 | 90 | callback, context)); | ||
4298 | 91 | |||
4299 | 92 | return &stop_wait_handle; | ||
4300 | 93 | } | ||
4301 | 94 | |||
4302 | 95 | MirWaitHandle* MirPromptSession::add_prompt_provider(pid_t provider_pid, | ||
4303 | 96 | mir_prompt_session_add_prompt_provider_callback callback, | ||
4304 | 97 | void* context) | ||
4305 | 98 | { | ||
4306 | 99 | { | ||
4307 | 100 | std::lock_guard<decltype(mutex)> lock(mutex); | ||
4308 | 101 | prompt_provider.set_pid(provider_pid); | ||
4309 | 102 | } | ||
4310 | 103 | |||
4311 | 104 | add_result_wait_handle.expect_result(); | ||
4312 | 105 | server.add_prompt_provider( | ||
4313 | 106 | 0, | ||
4314 | 107 | &prompt_provider, | ||
4315 | 108 | &add_result, | ||
4316 | 109 | google::protobuf::NewCallback(this, &MirPromptSession::done_add_prompt_provider, | ||
4317 | 110 | callback, context)); | ||
4318 | 111 | |||
4319 | 112 | return &add_result_wait_handle; | ||
4320 | 113 | } | ||
4321 | 114 | |||
4322 | 115 | void MirPromptSession::register_prompt_session_state_change_callback( | ||
4323 | 116 | mir_prompt_session_state_change_callback callback, | ||
4324 | 117 | void* context) | ||
4325 | 118 | { | ||
4326 | 119 | std::lock_guard<decltype(event_handler_mutex)> lock(event_handler_mutex); | ||
4327 | 120 | |||
4328 | 121 | handle_prompt_session_state_change = | ||
4329 | 122 | [this, callback, context](MirPromptSessionState new_state) | ||
4330 | 123 | { | ||
4331 | 124 | callback(this, new_state, context); | ||
4332 | 125 | }; | ||
4333 | 126 | } | ||
4334 | 127 | |||
4335 | 128 | void MirPromptSession::done_start(mir_prompt_session_callback callback, void* context) | ||
4336 | 129 | { | ||
4337 | 130 | { | ||
4338 | 131 | std::lock_guard<decltype(session_mutex)> lock(session_mutex); | ||
4339 | 132 | |||
4340 | 133 | state = session.has_error() ? mir_prompt_session_state_stopped : mir_prompt_session_state_started; | ||
4341 | 134 | } | ||
4342 | 135 | |||
4343 | 136 | callback(this, context); | ||
4344 | 137 | start_wait_handle.result_received(); | ||
4345 | 138 | } | ||
4346 | 139 | |||
4347 | 140 | void MirPromptSession::done_stop(mir_prompt_session_callback callback, void* context) | ||
4348 | 141 | { | ||
4349 | 142 | set_state(mir_prompt_session_state_stopped); | ||
4350 | 143 | |||
4351 | 144 | callback(this, context); | ||
4352 | 145 | stop_wait_handle.result_received(); | ||
4353 | 146 | } | ||
4354 | 147 | |||
4355 | 148 | void MirPromptSession::done_add_prompt_provider(mir_prompt_session_add_prompt_provider_callback callback, void* context) | ||
4356 | 149 | { | ||
4357 | 150 | MirBool added = mir_true; | ||
4358 | 151 | if (add_result.has_error()) | ||
4359 | 152 | { | ||
4360 | 153 | added = mir_false; | ||
4361 | 154 | } | ||
4362 | 155 | callback(this, added, context); | ||
4363 | 156 | add_result_wait_handle.result_received(); | ||
4364 | 157 | } | ||
4365 | 158 | |||
4366 | 159 | char const* MirPromptSession::get_error_message() | ||
4367 | 160 | { | ||
4368 | 161 | std::lock_guard<decltype(session_mutex)> lock(session_mutex); | ||
4369 | 162 | |||
4370 | 163 | if (!session.has_error()) | ||
4371 | 164 | session.set_error(std::string{}); | ||
4372 | 165 | |||
4373 | 166 | return session.error().c_str(); | ||
4374 | 167 | } | ||
4375 | 168 | |||
4376 | 169 | MirWaitHandle* MirPromptSession::new_fds_for_prompt_providers( | ||
4377 | 170 | unsigned int no_of_fds, | ||
4378 | 171 | mir_client_fd_callback callback, | ||
4379 | 172 | void * context) | ||
4380 | 173 | { | ||
4381 | 174 | mir::protobuf::SocketFDRequest request; | ||
4382 | 175 | request.set_number(no_of_fds); | ||
4383 | 176 | |||
4384 | 177 | fds_for_prompt_providers_wait_handle.expect_result(); | ||
4385 | 178 | |||
4386 | 179 | server.new_fds_for_prompt_providers( | ||
4387 | 180 | nullptr, | ||
4388 | 181 | &request, | ||
4389 | 182 | &socket_fd_response, | ||
4390 | 183 | google::protobuf::NewCallback(this, &MirPromptSession::done_fds_for_prompt_providers, | ||
4391 | 184 | callback, context)); | ||
4392 | 185 | |||
4393 | 186 | return &fds_for_prompt_providers_wait_handle; | ||
4394 | 187 | } | ||
4395 | 188 | |||
4396 | 189 | void MirPromptSession::done_fds_for_prompt_providers( | ||
4397 | 190 | mir_client_fd_callback callback, | ||
4398 | 191 | void* context) | ||
4399 | 192 | { | ||
4400 | 193 | auto const size = socket_fd_response.fd_size(); | ||
4401 | 194 | |||
4402 | 195 | std::vector<int> fds; | ||
4403 | 196 | fds.reserve(size); | ||
4404 | 197 | |||
4405 | 198 | for (auto i = 0; i != size; ++i) | ||
4406 | 199 | fds.push_back(socket_fd_response.fd(i)); | ||
4407 | 200 | |||
4408 | 201 | callback(this, size, fds.data(), context); | ||
4409 | 202 | fds_for_prompt_providers_wait_handle.result_received(); | ||
4410 | 203 | } | ||
4411 | 0 | 204 | ||
4412 | === added file 'src/client/mir_prompt_session.h' | |||
4413 | --- src/client/mir_prompt_session.h 1970-01-01 00:00:00 +0000 | |||
4414 | +++ src/client/mir_prompt_session.h 2014-06-18 17:25:24 +0000 | |||
4415 | @@ -0,0 +1,94 @@ | |||
4416 | 1 | /* | ||
4417 | 2 | * Copyright © 2014 Canonical Ltd. | ||
4418 | 3 | * | ||
4419 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
4420 | 5 | * under the terms of the GNU Lesser General Public License version 3, | ||
4421 | 6 | * as published by the Free Software Foundation. | ||
4422 | 7 | * | ||
4423 | 8 | * This program is distributed in the hope that it will be useful, | ||
4424 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
4425 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
4426 | 11 | * GNU Lesser General Public License for more details. | ||
4427 | 12 | * | ||
4428 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
4429 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
4430 | 15 | * | ||
4431 | 16 | * Authored by: Nick Dedekind <nick.dedekind@canonical.com> | ||
4432 | 17 | */ | ||
4433 | 18 | |||
4434 | 19 | #ifndef MIR_CLIENT_MIR_PROMPT_SESSION_H_ | ||
4435 | 20 | #define MIR_CLIENT_MIR_PROMPT_SESSION_H_ | ||
4436 | 21 | |||
4437 | 22 | #include "mir_toolkit/mir_client_library.h" | ||
4438 | 23 | |||
4439 | 24 | #include "mir_protobuf.pb.h" | ||
4440 | 25 | #include "mir_wait_handle.h" | ||
4441 | 26 | |||
4442 | 27 | #include <mutex> | ||
4443 | 28 | #include <memory> | ||
4444 | 29 | #include <atomic> | ||
4445 | 30 | |||
4446 | 31 | namespace mir | ||
4447 | 32 | { | ||
4448 | 33 | /// The client-side library implementation namespace | ||
4449 | 34 | namespace client | ||
4450 | 35 | { | ||
4451 | 36 | class EventHandlerRegister; | ||
4452 | 37 | } | ||
4453 | 38 | } | ||
4454 | 39 | |||
4455 | 40 | struct MirPromptSession | ||
4456 | 41 | { | ||
4457 | 42 | public: | ||
4458 | 43 | MirPromptSession(mir::protobuf::DisplayServer& server, | ||
4459 | 44 | std::shared_ptr<mir::client::EventHandlerRegister> const& event_handler_register); | ||
4460 | 45 | |||
4461 | 46 | ~MirPromptSession(); | ||
4462 | 47 | |||
4463 | 48 | MirWaitHandle* start(pid_t application_pid, mir_prompt_session_callback callback, void* context); | ||
4464 | 49 | MirWaitHandle* stop(mir_prompt_session_callback callback, void* context); | ||
4465 | 50 | MirWaitHandle* add_prompt_provider(pid_t provider_pid, mir_prompt_session_add_prompt_provider_callback callback, void* context); | ||
4466 | 51 | |||
4467 | 52 | MirWaitHandle* new_fds_for_prompt_providers( | ||
4468 | 53 | unsigned int no_of_fds, | ||
4469 | 54 | mir_client_fd_callback callback, | ||
4470 | 55 | void * context); | ||
4471 | 56 | |||
4472 | 57 | void register_prompt_session_state_change_callback(mir_prompt_session_state_change_callback callback, void* context); | ||
4473 | 58 | |||
4474 | 59 | char const* get_error_message(); | ||
4475 | 60 | |||
4476 | 61 | private: | ||
4477 | 62 | std::mutex mutable mutex; // Protects parameters, wait_handles & results | ||
4478 | 63 | mir::protobuf::DisplayServer& server; | ||
4479 | 64 | mir::protobuf::PromptProvider prompt_provider; | ||
4480 | 65 | mir::protobuf::PromptSessionParameters parameters; | ||
4481 | 66 | mir::protobuf::Void add_result; | ||
4482 | 67 | mir::protobuf::Void protobuf_void; | ||
4483 | 68 | mir::protobuf::SocketFD socket_fd_response; | ||
4484 | 69 | std::shared_ptr<mir::client::EventHandlerRegister> const event_handler_register; | ||
4485 | 70 | int const event_handler_register_id; | ||
4486 | 71 | |||
4487 | 72 | MirWaitHandle start_wait_handle; | ||
4488 | 73 | MirWaitHandle stop_wait_handle; | ||
4489 | 74 | MirWaitHandle add_result_wait_handle; | ||
4490 | 75 | MirWaitHandle fds_for_prompt_providers_wait_handle; | ||
4491 | 76 | std::atomic<MirPromptSessionState> state; | ||
4492 | 77 | |||
4493 | 78 | std::mutex mutable session_mutex; // Protects session | ||
4494 | 79 | mir::protobuf::Void session; | ||
4495 | 80 | |||
4496 | 81 | std::mutex mutable event_handler_mutex; // Need another mutex for callback access to members | ||
4497 | 82 | std::function<void(MirPromptSessionState)> handle_prompt_session_state_change; | ||
4498 | 83 | |||
4499 | 84 | void set_state(MirPromptSessionState new_state); | ||
4500 | 85 | void done_start(mir_prompt_session_callback callback, void* context); | ||
4501 | 86 | void done_stop(mir_prompt_session_callback callback, void* context); | ||
4502 | 87 | void done_add_prompt_provider(mir_prompt_session_add_prompt_provider_callback callback, void* context); | ||
4503 | 88 | void done_fds_for_prompt_providers(mir_client_fd_callback callback, void* context); | ||
4504 | 89 | MirPromptSession(MirPromptSession const&) = delete; | ||
4505 | 90 | MirPromptSession& operator=(MirPromptSession const&) = delete; | ||
4506 | 91 | }; | ||
4507 | 92 | |||
4508 | 93 | #endif /* MIR_CLIENT_MIR_PROMPT_SESSION_H_ */ | ||
4509 | 94 | |||
4510 | 0 | 95 | ||
4511 | === added file 'src/client/mir_prompt_session_api.cpp' | |||
4512 | --- src/client/mir_prompt_session_api.cpp 1970-01-01 00:00:00 +0000 | |||
4513 | +++ src/client/mir_prompt_session_api.cpp 2014-06-18 17:25:24 +0000 | |||
4514 | @@ -0,0 +1,118 @@ | |||
4515 | 1 | /* | ||
4516 | 2 | * Copyright © 2014 Canonical Ltd. | ||
4517 | 3 | * | ||
4518 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
4519 | 5 | * under the terms of the GNU Lesser General Public License version 3, | ||
4520 | 6 | * as published by the Free Software Foundation. | ||
4521 | 7 | * | ||
4522 | 8 | * This program is distributed in the hope that it will be useful, | ||
4523 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
4524 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
4525 | 11 | * GNU Lesser General Public License for more details. | ||
4526 | 12 | * | ||
4527 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
4528 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
4529 | 15 | * | ||
4530 | 16 | * Authored by: Nick Dedekind <nick.dedekind@canonical.com> | ||
4531 | 17 | */ | ||
4532 | 18 | |||
4533 | 19 | |||
4534 | 20 | #include "mir_toolkit/mir_prompt_session.h" | ||
4535 | 21 | #include "mir_prompt_session.h" | ||
4536 | 22 | #include "mir_connection.h" | ||
4537 | 23 | |||
4538 | 24 | #include <stdexcept> | ||
4539 | 25 | #include <boost/throw_exception.hpp> | ||
4540 | 26 | |||
4541 | 27 | namespace | ||
4542 | 28 | { | ||
4543 | 29 | void null_callback(MirPromptSession*, void*) {} | ||
4544 | 30 | |||
4545 | 31 | void add_prompt_provider_callback( | ||
4546 | 32 | MirPromptSession*, | ||
4547 | 33 | MirBool added, | ||
4548 | 34 | void* context) | ||
4549 | 35 | { | ||
4550 | 36 | if (context) | ||
4551 | 37 | *(MirBool*)context = added; | ||
4552 | 38 | } | ||
4553 | 39 | |||
4554 | 40 | } | ||
4555 | 41 | |||
4556 | 42 | MirPromptSession *mir_connection_create_prompt_session_sync( | ||
4557 | 43 | MirConnection* connection, | ||
4558 | 44 | pid_t application_pid, | ||
4559 | 45 | mir_prompt_session_state_change_callback state_change_callback, | ||
4560 | 46 | void* context) | ||
4561 | 47 | { | ||
4562 | 48 | try | ||
4563 | 49 | { | ||
4564 | 50 | auto prompt_session = connection->create_prompt_session(); | ||
4565 | 51 | if (state_change_callback) | ||
4566 | 52 | prompt_session->register_prompt_session_state_change_callback(state_change_callback, context); | ||
4567 | 53 | |||
4568 | 54 | mir_wait_for(prompt_session->start(application_pid, | ||
4569 | 55 | null_callback, | ||
4570 | 56 | nullptr)); | ||
4571 | 57 | return prompt_session; | ||
4572 | 58 | } | ||
4573 | 59 | catch (std::exception const&) | ||
4574 | 60 | { | ||
4575 | 61 | // TODO callback with an error | ||
4576 | 62 | return nullptr; | ||
4577 | 63 | } | ||
4578 | 64 | } | ||
4579 | 65 | |||
4580 | 66 | MirWaitHandle *mir_prompt_session_add_prompt_provider( | ||
4581 | 67 | MirPromptSession *prompt_session, | ||
4582 | 68 | pid_t provider_pid, | ||
4583 | 69 | mir_prompt_session_add_prompt_provider_callback callback, | ||
4584 | 70 | void* context) | ||
4585 | 71 | { | ||
4586 | 72 | try | ||
4587 | 73 | { | ||
4588 | 74 | return prompt_session->add_prompt_provider(provider_pid, callback, context); | ||
4589 | 75 | } | ||
4590 | 76 | catch (std::exception const&) | ||
4591 | 77 | { | ||
4592 | 78 | // TODO callback with an error | ||
4593 | 79 | return nullptr; | ||
4594 | 80 | } | ||
4595 | 81 | } | ||
4596 | 82 | |||
4597 | 83 | MirBool mir_prompt_session_add_prompt_provider_sync( | ||
4598 | 84 | MirPromptSession *prompt_session, | ||
4599 | 85 | pid_t provider_pid) | ||
4600 | 86 | { | ||
4601 | 87 | MirBool result; | ||
4602 | 88 | mir_wait_for(mir_prompt_session_add_prompt_provider(prompt_session, | ||
4603 | 89 | provider_pid, | ||
4604 | 90 | add_prompt_provider_callback, | ||
4605 | 91 | &result)); | ||
4606 | 92 | return result; | ||
4607 | 93 | } | ||
4608 | 94 | |||
4609 | 95 | MirWaitHandle* mir_prompt_session_new_fds_for_prompt_providers( | ||
4610 | 96 | MirPromptSession *prompt_session, | ||
4611 | 97 | unsigned int no_of_fds, | ||
4612 | 98 | mir_client_fd_callback callback, | ||
4613 | 99 | void * context) | ||
4614 | 100 | { | ||
4615 | 101 | try | ||
4616 | 102 | { | ||
4617 | 103 | return prompt_session ? | ||
4618 | 104 | prompt_session->new_fds_for_prompt_providers(no_of_fds, callback, context) : | ||
4619 | 105 | nullptr; | ||
4620 | 106 | } | ||
4621 | 107 | catch (std::exception const&) | ||
4622 | 108 | { | ||
4623 | 109 | return nullptr; | ||
4624 | 110 | } | ||
4625 | 111 | } | ||
4626 | 112 | |||
4627 | 113 | void mir_prompt_session_release_sync( | ||
4628 | 114 | MirPromptSession *prompt_session) | ||
4629 | 115 | { | ||
4630 | 116 | mir_wait_for(prompt_session->stop(&null_callback, nullptr)); | ||
4631 | 117 | delete prompt_session; | ||
4632 | 118 | } | ||
4633 | 0 | 119 | ||
4634 | === modified file 'src/client/mir_screencast.cpp' | |||
4635 | --- src/client/mir_screencast.cpp 2014-03-11 16:19:27 +0000 | |||
4636 | +++ src/client/mir_screencast.cpp 2014-06-18 17:25:24 +0000 | |||
4637 | @@ -102,6 +102,7 @@ | |||
4638 | 102 | parameters.set_height(output_size.height.as_uint32_t()); | 102 | parameters.set_height(output_size.height.as_uint32_t()); |
4639 | 103 | parameters.set_pixel_format(pixel_format); | 103 | parameters.set_pixel_format(pixel_format); |
4640 | 104 | 104 | ||
4641 | 105 | create_screencast_wait_handle.expect_result(); | ||
4642 | 105 | server.create_screencast( | 106 | server.create_screencast( |
4643 | 106 | nullptr, | 107 | nullptr, |
4644 | 107 | ¶meters, | 108 | ¶meters, |
4645 | @@ -143,6 +144,7 @@ | |||
4646 | 143 | mir::protobuf::ScreencastId screencast_id; | 144 | mir::protobuf::ScreencastId screencast_id; |
4647 | 144 | screencast_id.set_value(protobuf_screencast.screencast_id().value()); | 145 | screencast_id.set_value(protobuf_screencast.screencast_id().value()); |
4648 | 145 | 146 | ||
4649 | 147 | release_wait_handle.expect_result(); | ||
4650 | 146 | server.release_screencast( | 148 | server.release_screencast( |
4651 | 147 | nullptr, | 149 | nullptr, |
4652 | 148 | &screencast_id, | 150 | &screencast_id, |
4653 | @@ -159,6 +161,7 @@ | |||
4654 | 159 | mir::protobuf::ScreencastId screencast_id; | 161 | mir::protobuf::ScreencastId screencast_id; |
4655 | 160 | screencast_id.set_value(protobuf_screencast.screencast_id().value()); | 162 | screencast_id.set_value(protobuf_screencast.screencast_id().value()); |
4656 | 161 | 163 | ||
4657 | 164 | next_buffer_wait_handle.expect_result(); | ||
4658 | 162 | server.screencast_buffer( | 165 | server.screencast_buffer( |
4659 | 163 | nullptr, | 166 | nullptr, |
4660 | 164 | &screencast_id, | 167 | &screencast_id, |
4661 | 165 | 168 | ||
4662 | === modified file 'src/client/mir_surface.cpp' | |||
4663 | --- src/client/mir_surface.cpp 2014-05-23 07:25:58 +0000 | |||
4664 | +++ src/client/mir_surface.cpp 2014-06-18 17:25:24 +0000 | |||
4665 | @@ -62,6 +62,7 @@ | |||
4666 | 62 | message.set_buffer_usage(params.buffer_usage); | 62 | message.set_buffer_usage(params.buffer_usage); |
4667 | 63 | message.set_output_id(params.output_id); | 63 | message.set_output_id(params.output_id); |
4668 | 64 | 64 | ||
4669 | 65 | create_wait_handle.expect_result(); | ||
4670 | 65 | server.create_surface(0, &message, &surface, gp::NewCallback(this, &MirSurface::created, callback, context)); | 66 | server.create_surface(0, &message, &surface, gp::NewCallback(this, &MirSurface::created, callback, context)); |
4671 | 66 | 67 | ||
4672 | 67 | for (int i = 0; i < mir_surface_attribs; i++) | 68 | for (int i = 0; i < mir_surface_attribs; i++) |
4673 | @@ -76,6 +77,11 @@ | |||
4674 | 76 | 77 | ||
4675 | 77 | MirSurface::~MirSurface() | 78 | MirSurface::~MirSurface() |
4676 | 78 | { | 79 | { |
4677 | 80 | { | ||
4678 | 81 | std::lock_guard<decltype(handle_mutex)> lock(handle_mutex); | ||
4679 | 82 | valid_surfaces.erase(this); | ||
4680 | 83 | } | ||
4681 | 84 | |||
4682 | 79 | std::lock_guard<decltype(mutex)> lock(mutex); | 85 | std::lock_guard<decltype(mutex)> lock(mutex); |
4683 | 80 | 86 | ||
4684 | 81 | if (input_thread) | 87 | if (input_thread) |
4685 | @@ -158,6 +164,7 @@ | |||
4686 | 158 | auto const mutable_buffer = surface.mutable_buffer(); | 164 | auto const mutable_buffer = surface.mutable_buffer(); |
4687 | 159 | lock.unlock(); | 165 | lock.unlock(); |
4688 | 160 | 166 | ||
4689 | 167 | next_buffer_wait_handle.expect_result(); | ||
4690 | 161 | server.next_buffer( | 168 | server.next_buffer( |
4691 | 162 | 0, | 169 | 0, |
4692 | 163 | id, | 170 | id, |
4693 | @@ -243,8 +250,10 @@ | |||
4694 | 243 | mir_surface_callback callback, | 250 | mir_surface_callback callback, |
4695 | 244 | void * context) | 251 | void * context) |
4696 | 245 | { | 252 | { |
4699 | 246 | std::lock_guard<decltype(handle_mutex)> lock(handle_mutex); | 253 | { |
4700 | 247 | valid_surfaces.erase(this); | 254 | std::lock_guard<decltype(handle_mutex)> lock(handle_mutex); |
4701 | 255 | valid_surfaces.erase(this); | ||
4702 | 256 | } | ||
4703 | 248 | 257 | ||
4704 | 249 | return connection->release_surface(this, callback, context); | 258 | return connection->release_surface(this, callback, context); |
4705 | 250 | } | 259 | } |
4706 | @@ -323,7 +332,7 @@ | |||
4707 | 323 | 332 | ||
4708 | 324 | configure_cursor_wait_handle.expect_result(); | 333 | configure_cursor_wait_handle.expect_result(); |
4709 | 325 | server.configure_cursor(0, &setting, &void_response, | 334 | server.configure_cursor(0, &setting, &void_response, |
4711 | 326 | google::protobuf::NewCallback(this, &MirSurface::on_configured)); | 335 | google::protobuf::NewCallback(this, &MirSurface::on_cursor_configured)); |
4712 | 327 | 336 | ||
4713 | 328 | return &configure_cursor_wait_handle; | 337 | return &configure_cursor_wait_handle; |
4714 | 329 | } | 338 | } |
4715 | @@ -375,6 +384,12 @@ | |||
4716 | 375 | } | 384 | } |
4717 | 376 | } | 385 | } |
4718 | 377 | 386 | ||
4719 | 387 | void MirSurface::on_cursor_configured() | ||
4720 | 388 | { | ||
4721 | 389 | configure_cursor_wait_handle.result_received(); | ||
4722 | 390 | } | ||
4723 | 391 | |||
4724 | 392 | |||
4725 | 378 | int MirSurface::attrib(MirSurfaceAttrib at) const | 393 | int MirSurface::attrib(MirSurfaceAttrib at) const |
4726 | 379 | { | 394 | { |
4727 | 380 | std::lock_guard<decltype(mutex)> lock(mutex); | 395 | std::lock_guard<decltype(mutex)> lock(mutex); |
4728 | 381 | 396 | ||
4729 | === modified file 'src/client/mir_surface.h' | |||
4730 | --- src/client/mir_surface.h 2014-05-23 07:25:58 +0000 | |||
4731 | +++ src/client/mir_surface.h 2014-06-18 17:25:24 +0000 | |||
4732 | @@ -102,6 +102,7 @@ | |||
4733 | 102 | mutable std::mutex mutex; // Protects all members of *this | 102 | mutable std::mutex mutex; // Protects all members of *this |
4734 | 103 | 103 | ||
4735 | 104 | void on_configured(); | 104 | void on_configured(); |
4736 | 105 | void on_cursor_configured(); | ||
4737 | 105 | void process_incoming_buffer(); | 106 | void process_incoming_buffer(); |
4738 | 106 | void populate(MirBufferPackage& buffer_package); | 107 | void populate(MirBufferPackage& buffer_package); |
4739 | 107 | void created(mir_surface_callback callback, void * context); | 108 | void created(mir_surface_callback callback, void * context); |
4740 | 108 | 109 | ||
4741 | === modified file 'src/client/mir_wait_handle.cpp' | |||
4742 | --- src/client/mir_wait_handle.cpp 2013-10-03 03:44:08 +0000 | |||
4743 | +++ src/client/mir_wait_handle.cpp 2014-06-18 17:25:24 +0000 | |||
4744 | @@ -1,5 +1,5 @@ | |||
4745 | 1 | /* | 1 | /* |
4747 | 2 | * Copyright © 2012 Canonical Ltd. | 2 | * Copyright © 2012-2014 Canonical Ltd. |
4748 | 3 | * | 3 | * |
4749 | 4 | * This program is free software: you can redistribute it and/or modify it | 4 | * This program is free software: you can redistribute it and/or modify it |
4750 | 5 | * under the terms of the GNU Lesser General Public License version 3, | 5 | * under the terms of the GNU Lesser General Public License version 3, |
4751 | @@ -33,14 +33,14 @@ | |||
4752 | 33 | 33 | ||
4753 | 34 | void MirWaitHandle::expect_result() | 34 | void MirWaitHandle::expect_result() |
4754 | 35 | { | 35 | { |
4756 | 36 | std::unique_lock<std::mutex> lock(guard); | 36 | std::lock_guard<std::mutex> lock(guard); |
4757 | 37 | 37 | ||
4758 | 38 | expecting++; | 38 | expecting++; |
4759 | 39 | } | 39 | } |
4760 | 40 | 40 | ||
4761 | 41 | void MirWaitHandle::result_received() | 41 | void MirWaitHandle::result_received() |
4762 | 42 | { | 42 | { |
4764 | 43 | std::unique_lock<std::mutex> lock(guard); | 43 | std::lock_guard<std::mutex> lock(guard); |
4765 | 44 | 44 | ||
4766 | 45 | received++; | 45 | received++; |
4767 | 46 | wait_condition.notify_all(); | 46 | wait_condition.notify_all(); |
4768 | @@ -50,8 +50,7 @@ | |||
4769 | 50 | { | 50 | { |
4770 | 51 | std::unique_lock<std::mutex> lock(guard); | 51 | std::unique_lock<std::mutex> lock(guard); |
4771 | 52 | 52 | ||
4774 | 53 | while ((!expecting && !received) || (received < expecting)) | 53 | wait_condition.wait(lock, [&]{ return received == expecting; }); |
4773 | 54 | wait_condition.wait(lock); | ||
4775 | 55 | 54 | ||
4776 | 56 | received = 0; | 55 | received = 0; |
4777 | 57 | expecting = 0; | 56 | expecting = 0; |
4778 | @@ -59,14 +58,9 @@ | |||
4779 | 59 | 58 | ||
4780 | 60 | void MirWaitHandle::wait_for_pending(std::chrono::milliseconds limit) | 59 | void MirWaitHandle::wait_for_pending(std::chrono::milliseconds limit) |
4781 | 61 | { | 60 | { |
4782 | 62 | using std::chrono::steady_clock; | ||
4783 | 63 | |||
4784 | 64 | std::unique_lock<std::mutex> lock(guard); | 61 | std::unique_lock<std::mutex> lock(guard); |
4785 | 65 | 62 | ||
4790 | 66 | auto time_limit = steady_clock::now() + limit; | 63 | wait_condition.wait_for(lock, limit, [&]{ return received == expecting; }); |
4787 | 67 | |||
4788 | 68 | while (received < expecting && steady_clock::now() < time_limit) | ||
4789 | 69 | wait_condition.wait_until(lock, time_limit); | ||
4791 | 70 | } | 64 | } |
4792 | 71 | 65 | ||
4793 | 72 | 66 | ||
4794 | @@ -74,11 +68,9 @@ | |||
4795 | 74 | { | 68 | { |
4796 | 75 | std::unique_lock<std::mutex> lock(guard); | 69 | std::unique_lock<std::mutex> lock(guard); |
4797 | 76 | 70 | ||
4800 | 77 | while (received == 0) | 71 | wait_condition.wait(lock, [&]{ return received != 0; }); |
4799 | 78 | wait_condition.wait(lock); | ||
4801 | 79 | 72 | ||
4805 | 80 | received--; | 73 | --received; |
4806 | 81 | if (expecting > 0) | 74 | --expecting; |
4804 | 82 | expecting--; | ||
4807 | 83 | } | 75 | } |
4808 | 84 | 76 | ||
4809 | 85 | 77 | ||
4810 | === modified file 'src/client/rpc/make_rpc_channel.h' | |||
4811 | --- src/client/rpc/make_rpc_channel.h 2014-03-06 06:05:17 +0000 | |||
4812 | +++ src/client/rpc/make_rpc_channel.h 2014-06-18 17:25:24 +0000 | |||
4813 | @@ -29,6 +29,7 @@ | |||
4814 | 29 | class SurfaceMap; | 29 | class SurfaceMap; |
4815 | 30 | class DisplayConfiguration; | 30 | class DisplayConfiguration; |
4816 | 31 | class LifecycleControl; | 31 | class LifecycleControl; |
4817 | 32 | class EventSink; | ||
4818 | 32 | 33 | ||
4819 | 33 | namespace rpc | 34 | namespace rpc |
4820 | 34 | { | 35 | { |
4821 | @@ -39,7 +40,8 @@ | |||
4822 | 39 | std::shared_ptr<SurfaceMap> const& map, | 40 | std::shared_ptr<SurfaceMap> const& map, |
4823 | 40 | std::shared_ptr<DisplayConfiguration> const& disp_conf, | 41 | std::shared_ptr<DisplayConfiguration> const& disp_conf, |
4824 | 41 | std::shared_ptr<RpcReport> const& rpc_report, | 42 | std::shared_ptr<RpcReport> const& rpc_report, |
4826 | 42 | std::shared_ptr<LifecycleControl> const& lifecycle_control); | 43 | std::shared_ptr<LifecycleControl> const& lifecycle_control, |
4827 | 44 | std::shared_ptr<EventSink> const& event_distributor); | ||
4828 | 43 | } | 45 | } |
4829 | 44 | } | 46 | } |
4830 | 45 | } | 47 | } |
4831 | 46 | 48 | ||
4832 | === modified file 'src/client/rpc/make_socket_rpc_channel.cpp' | |||
4833 | --- src/client/rpc/make_socket_rpc_channel.cpp 2014-03-06 06:05:17 +0000 | |||
4834 | +++ src/client/rpc/make_socket_rpc_channel.cpp 2014-06-18 17:25:24 +0000 | |||
4835 | @@ -44,13 +44,14 @@ | |||
4836 | 44 | std::shared_ptr<mcl::SurfaceMap> const& map, | 44 | std::shared_ptr<mcl::SurfaceMap> const& map, |
4837 | 45 | std::shared_ptr<mcl::DisplayConfiguration> const& disp_conf, | 45 | std::shared_ptr<mcl::DisplayConfiguration> const& disp_conf, |
4838 | 46 | std::shared_ptr<RpcReport> const& rpc_report, | 46 | std::shared_ptr<RpcReport> const& rpc_report, |
4840 | 47 | std::shared_ptr<mcl::LifecycleControl> const& lifecycle_control) | 47 | std::shared_ptr<mcl::LifecycleControl> const& lifecycle_control, |
4841 | 48 | std::shared_ptr<mcl::EventSink> const& event_sink) | ||
4842 | 48 | { | 49 | { |
4843 | 49 | if (fd_prefix.is_start_of(name)) | 50 | if (fd_prefix.is_start_of(name)) |
4844 | 50 | { | 51 | { |
4845 | 51 | auto const fd = atoi(name.c_str()+fd_prefix.size); | 52 | auto const fd = atoi(name.c_str()+fd_prefix.size); |
4847 | 52 | return std::make_shared<MirSocketRpcChannel>(fd, map, disp_conf, rpc_report, lifecycle_control); | 53 | return std::make_shared<MirSocketRpcChannel>(fd, map, disp_conf, rpc_report, lifecycle_control, event_sink); |
4848 | 53 | } | 54 | } |
4849 | 54 | 55 | ||
4851 | 55 | return std::make_shared<MirSocketRpcChannel>(name, map, disp_conf, rpc_report, lifecycle_control); | 56 | return std::make_shared<MirSocketRpcChannel>(name, map, disp_conf, rpc_report, lifecycle_control, event_sink); |
4852 | 56 | } | 57 | } |
4853 | 57 | 58 | ||
4854 | === modified file 'src/client/rpc/mir_socket_rpc_channel.cpp' | |||
4855 | --- src/client/rpc/mir_socket_rpc_channel.cpp 2014-05-22 12:41:12 +0000 | |||
4856 | +++ src/client/rpc/mir_socket_rpc_channel.cpp 2014-06-18 17:25:24 +0000 | |||
4857 | @@ -24,6 +24,7 @@ | |||
4858 | 24 | #include "../mir_surface.h" | 24 | #include "../mir_surface.h" |
4859 | 25 | #include "../display_configuration.h" | 25 | #include "../display_configuration.h" |
4860 | 26 | #include "../lifecycle_control.h" | 26 | #include "../lifecycle_control.h" |
4861 | 27 | #include "../event_sink.h" | ||
4862 | 27 | #include "mir/variable_length_array.h" | 28 | #include "mir/variable_length_array.h" |
4863 | 28 | 29 | ||
4864 | 29 | #include "mir_protobuf.pb.h" // For Buffer frig | 30 | #include "mir_protobuf.pb.h" // For Buffer frig |
4865 | @@ -50,7 +51,8 @@ | |||
4866 | 50 | std::shared_ptr<mcl::SurfaceMap> const& surface_map, | 51 | std::shared_ptr<mcl::SurfaceMap> const& surface_map, |
4867 | 51 | std::shared_ptr<DisplayConfiguration> const& disp_config, | 52 | std::shared_ptr<DisplayConfiguration> const& disp_config, |
4868 | 52 | std::shared_ptr<RpcReport> const& rpc_report, | 53 | std::shared_ptr<RpcReport> const& rpc_report, |
4870 | 53 | std::shared_ptr<LifecycleControl> const& lifecycle_control) : | 54 | std::shared_ptr<LifecycleControl> const& lifecycle_control, |
4871 | 55 | std::shared_ptr<EventSink> const& event_sink) : | ||
4872 | 54 | rpc_report(rpc_report), | 56 | rpc_report(rpc_report), |
4873 | 55 | pending_calls(rpc_report), | 57 | pending_calls(rpc_report), |
4874 | 56 | work(io_service), | 58 | work(io_service), |
4875 | @@ -58,6 +60,7 @@ | |||
4876 | 58 | surface_map(surface_map), | 60 | surface_map(surface_map), |
4877 | 59 | display_configuration(disp_config), | 61 | display_configuration(disp_config), |
4878 | 60 | lifecycle_control(lifecycle_control), | 62 | lifecycle_control(lifecycle_control), |
4879 | 63 | event_sink(event_sink), | ||
4880 | 61 | disconnected(false) | 64 | disconnected(false) |
4881 | 62 | { | 65 | { |
4882 | 63 | socket.connect(endpoint); | 66 | socket.connect(endpoint); |
4883 | @@ -69,7 +72,8 @@ | |||
4884 | 69 | std::shared_ptr<mcl::SurfaceMap> const& surface_map, | 72 | std::shared_ptr<mcl::SurfaceMap> const& surface_map, |
4885 | 70 | std::shared_ptr<DisplayConfiguration> const& disp_config, | 73 | std::shared_ptr<DisplayConfiguration> const& disp_config, |
4886 | 71 | std::shared_ptr<RpcReport> const& rpc_report, | 74 | std::shared_ptr<RpcReport> const& rpc_report, |
4888 | 72 | std::shared_ptr<LifecycleControl> const& lifecycle_control) : | 75 | std::shared_ptr<LifecycleControl> const& lifecycle_control, |
4889 | 76 | std::shared_ptr<EventSink> const& event_sink) : | ||
4890 | 73 | rpc_report(rpc_report), | 77 | rpc_report(rpc_report), |
4891 | 74 | pending_calls(rpc_report), | 78 | pending_calls(rpc_report), |
4892 | 75 | work(io_service), | 79 | work(io_service), |
4893 | @@ -77,6 +81,7 @@ | |||
4894 | 77 | surface_map(surface_map), | 81 | surface_map(surface_map), |
4895 | 78 | display_configuration(disp_config), | 82 | display_configuration(disp_config), |
4896 | 79 | lifecycle_control(lifecycle_control), | 83 | lifecycle_control(lifecycle_control), |
4897 | 84 | event_sink(event_sink), | ||
4898 | 80 | disconnected(false) | 85 | disconnected(false) |
4899 | 81 | { | 86 | { |
4900 | 82 | socket.assign(boost::asio::local::stream_protocol(), native_socket); | 87 | socket.assign(boost::asio::local::stream_protocol(), native_socket); |
4901 | @@ -413,11 +418,25 @@ | |||
4902 | 413 | 418 | ||
4903 | 414 | rpc_report->event_parsing_succeeded(e); | 419 | rpc_report->event_parsing_succeeded(e); |
4904 | 415 | 420 | ||
4910 | 416 | surface_map->with_surface_do(e.surface.id, | 421 | event_sink->handle_event(e); |
4911 | 417 | [&e](MirSurface* surface) | 422 | |
4912 | 418 | { | 423 | // todo - surfaces should register with the event handler register. |
4913 | 419 | surface->handle_event(e); | 424 | if (e.type == mir_event_type_surface) |
4914 | 420 | }); | 425 | { |
4915 | 426 | surface_map->with_surface_do(e.surface.id, | ||
4916 | 427 | [&e](MirSurface* surface) | ||
4917 | 428 | { | ||
4918 | 429 | surface->handle_event(e); | ||
4919 | 430 | }); | ||
4920 | 431 | } | ||
4921 | 432 | else if (e.type == mir_event_type_resize) | ||
4922 | 433 | { | ||
4923 | 434 | surface_map->with_surface_do(e.resize.surface_id, | ||
4924 | 435 | [&e](MirSurface* surface) | ||
4925 | 436 | { | ||
4926 | 437 | surface->handle_event(e); | ||
4927 | 438 | }); | ||
4928 | 439 | } | ||
4929 | 421 | } | 440 | } |
4930 | 422 | else | 441 | else |
4931 | 423 | { | 442 | { |
4932 | 424 | 443 | ||
4933 | === modified file 'src/client/rpc/mir_socket_rpc_channel.h' | |||
4934 | --- src/client/rpc/mir_socket_rpc_channel.h 2014-05-07 02:56:33 +0000 | |||
4935 | +++ src/client/rpc/mir_socket_rpc_channel.h 2014-06-18 17:25:24 +0000 | |||
4936 | @@ -44,6 +44,7 @@ | |||
4937 | 44 | class DisplayConfiguration; | 44 | class DisplayConfiguration; |
4938 | 45 | class SurfaceMap; | 45 | class SurfaceMap; |
4939 | 46 | class LifecycleControl; | 46 | class LifecycleControl; |
4940 | 47 | class EventSink; | ||
4941 | 47 | namespace rpc | 48 | namespace rpc |
4942 | 48 | { | 49 | { |
4943 | 49 | 50 | ||
4944 | @@ -56,13 +57,15 @@ | |||
4945 | 56 | std::shared_ptr<SurfaceMap> const& surface_map, | 57 | std::shared_ptr<SurfaceMap> const& surface_map, |
4946 | 57 | std::shared_ptr<DisplayConfiguration> const& disp_config, | 58 | std::shared_ptr<DisplayConfiguration> const& disp_config, |
4947 | 58 | std::shared_ptr<RpcReport> const& rpc_report, | 59 | std::shared_ptr<RpcReport> const& rpc_report, |
4949 | 59 | std::shared_ptr<LifecycleControl> const& lifecycle_control); | 60 | std::shared_ptr<LifecycleControl> const& lifecycle_control, |
4950 | 61 | std::shared_ptr<EventSink> const& event_sink); | ||
4951 | 60 | 62 | ||
4952 | 61 | MirSocketRpcChannel(int native_socket, | 63 | MirSocketRpcChannel(int native_socket, |
4953 | 62 | std::shared_ptr<SurfaceMap> const& surface_map, | 64 | std::shared_ptr<SurfaceMap> const& surface_map, |
4954 | 63 | std::shared_ptr<DisplayConfiguration> const& disp_config, | 65 | std::shared_ptr<DisplayConfiguration> const& disp_config, |
4955 | 64 | std::shared_ptr<RpcReport> const& rpc_report, | 66 | std::shared_ptr<RpcReport> const& rpc_report, |
4957 | 65 | std::shared_ptr<LifecycleControl> const& lifecycle_control); | 67 | std::shared_ptr<LifecycleControl> const& lifecycle_control, |
4958 | 68 | std::shared_ptr<EventSink> const& event_sink); | ||
4959 | 66 | ~MirSocketRpcChannel(); | 69 | ~MirSocketRpcChannel(); |
4960 | 67 | 70 | ||
4961 | 68 | private: | 71 | private: |
4962 | @@ -102,6 +105,7 @@ | |||
4963 | 102 | std::shared_ptr<SurfaceMap> surface_map; | 105 | std::shared_ptr<SurfaceMap> surface_map; |
4964 | 103 | std::shared_ptr<DisplayConfiguration> display_configuration; | 106 | std::shared_ptr<DisplayConfiguration> display_configuration; |
4965 | 104 | std::shared_ptr<LifecycleControl> lifecycle_control; | 107 | std::shared_ptr<LifecycleControl> lifecycle_control; |
4966 | 108 | std::shared_ptr<EventSink> event_sink; | ||
4967 | 105 | std::atomic<bool> disconnected; | 109 | std::atomic<bool> disconnected; |
4968 | 106 | }; | 110 | }; |
4969 | 107 | 111 | ||
4970 | 108 | 112 | ||
4971 | === modified file 'src/client/surface_map.cpp' | |||
4972 | --- src/client/surface_map.cpp 2014-03-06 06:05:17 +0000 | |||
4973 | +++ src/client/surface_map.cpp 2014-06-18 17:25:24 +0000 | |||
4974 | @@ -17,8 +17,10 @@ | |||
4975 | 17 | */ | 17 | */ |
4976 | 18 | 18 | ||
4977 | 19 | #include "connection_surface_map.h" | 19 | #include "connection_surface_map.h" |
4978 | 20 | #include "mir_surface.h" | ||
4979 | 21 | |||
4980 | 22 | #include <boost/throw_exception.hpp> | ||
4981 | 20 | #include <sstream> | 23 | #include <sstream> |
4982 | 21 | #include <boost/throw_exception.hpp> | ||
4983 | 22 | 24 | ||
4984 | 23 | namespace mcl=mir::client; | 25 | namespace mcl=mir::client; |
4985 | 24 | 26 | ||
4986 | @@ -26,10 +28,23 @@ | |||
4987 | 26 | { | 28 | { |
4988 | 27 | } | 29 | } |
4989 | 28 | 30 | ||
4990 | 31 | mcl::ConnectionSurfaceMap::~ConnectionSurfaceMap() noexcept | ||
4991 | 32 | { | ||
4992 | 33 | // Unless the client has screwed up there should be no surfaces left | ||
4993 | 34 | // here. (OTOH *we* don't need to leak memory when clients screw up.) | ||
4994 | 35 | std::lock_guard<std::mutex> lk(guard); | ||
4995 | 36 | |||
4996 | 37 | for (auto const& surface :surfaces) | ||
4997 | 38 | { | ||
4998 | 39 | if (MirSurface::is_valid(surface.second)) | ||
4999 | 40 | delete surface.second; | ||
5000 | 41 | } |
The diff has been truncated for viewing.