Mir

Merge lp:~kdub/mir/unit-test-cleanup into lp:mir/0.1

Proposed by Kevin DuBois
Status: Superseded
Proposed branch: lp:~kdub/mir/unit-test-cleanup
Merge into: lp:mir/0.1
Diff against target: 26370 lines (+11033/-4123) (has conflicts)
348 files modified
3rd_party/android-input/android/CMakeLists.txt (+1/-0)
3rd_party/android-input/android/frameworks/base/include/androidfw/Input.h (+5/-2)
3rd_party/android-input/android/frameworks/base/include/androidfw/InputTransport.h (+10/-7)
3rd_party/android-input/android/frameworks/base/include/androidfw/IntSet.h (+104/-0)
3rd_party/android-input/android/frameworks/base/include/androidfw/VelocityControl.h (+2/-0)
3rd_party/android-input/android/frameworks/base/include/androidfw/VelocityTracker.h (+24/-22)
3rd_party/android-input/android/frameworks/base/services/input/InputDevice.cpp (+6/-3)
3rd_party/android-input/android/frameworks/base/services/input/InputDispatcher.cpp (+40/-33)
3rd_party/android-input/android/frameworks/base/services/input/InputDispatcher.h (+6/-6)
3rd_party/android-input/android/frameworks/base/services/input/InputEventPrinter.h (+138/-0)
3rd_party/android-input/android/frameworks/base/services/input/InputListener.h (+1/-1)
3rd_party/android-input/android/frameworks/base/services/input/InputReader.cpp (+409/-354)
3rd_party/android-input/android/frameworks/base/services/input/InputReader.h (+68/-40)
3rd_party/android-input/android/frameworks/base/services/input/InputTransport.cpp (+8/-8)
3rd_party/android-input/android/frameworks/base/services/input/IntSet.cpp (+123/-0)
3rd_party/android-input/android/frameworks/base/services/input/PointerController.cpp (+5/-8)
3rd_party/android-input/android/frameworks/base/services/input/PointerController.h (+2/-5)
3rd_party/android-input/android/frameworks/base/services/input/VelocityControl.cpp (+2/-2)
3rd_party/android-input/android/frameworks/base/services/input/VelocityTracker.cpp (+80/-83)
debian/changelog (+130/-0)
debian/control (+8/-0)
debian/libmirserver11.install (+4/-0)
doc/Doxyfile.in (+192/-82)
doc/component_reports.md (+1/-0)
doc/installing_prebuilt_on_pc.md (+6/-1)
doc/using_mir_on_pc.md (+14/-0)
examples/CMakeLists.txt (+1/-0)
examples/buffer_render_target.cpp (+3/-1)
examples/buffer_render_target.h (+1/-0)
examples/demo-inprocess-surface-client/inprocess_egl_client.cpp (+5/-1)
examples/demo-shell/demo_shell.cpp (+3/-0)
examples/demo-shell/window_manager.cpp (+102/-14)
examples/demo-shell/window_manager.h (+6/-2)
examples/demo_input_filter.cpp (+25/-3)
examples/eglapp.c (+16/-8)
examples/progressbar.c (+9/-4)
examples/render_surfaces.cpp (+19/-17)
include/client/mir_toolkit/mir_client_library.h (+1/-1)
include/platform/mir/graphics/basic_platform.h (+45/-0)
include/platform/mir/graphics/buffer_ipc_packer.h (+2/-0)
include/platform/mir/graphics/egl_resources.h (+10/-4)
include/platform/mir/graphics/native_platform.h (+1/-1)
include/platform/mir/graphics/platform.h (+4/-3)
include/server/mir/compositor/buffer_stream.h (+1/-0)
include/server/mir/compositor/scene.h (+1/-1)
include/server/mir/default_configuration_options.h (+6/-1)
include/server/mir/default_server_configuration.h (+54/-34)
include/server/mir/frontend/shell.h (+2/-2)
include/server/mir/frontend/surface.h (+4/-21)
include/server/mir/shell/snapshot.h (+3/-3)
include/server/mir/shell/surface.h (+21/-68)
include/server/mir/shell/surface_controller.h (+2/-2)
include/server/mir/surfaces/surfaces_report.h (+63/-0)
include/shared/mir/geometry/dimensions.h (+1/-0)
include/shared/mir/geometry/displacement.h (+2/-6)
include/shared/mir/geometry/point.h (+2/-7)
include/shared/mir/geometry/rectangle.h (+2/-7)
include/shared/mir/geometry/size.h (+2/-7)
include/shared/mir/graphics/android/mir_native_window.h (+2/-0)
include/shared/mir/input/input_platform.h (+3/-1)
include/shared/mir/input/input_receiver_report.h (+48/-0)
include/shared/mir/input/null_input_receiver_report.h (+46/-0)
include/shared/mir_toolkit/client_types.h (+2/-1)
include/shared/mir_toolkit/common.h (+4/-5)
include/shared/mir_toolkit/event.h (+9/-1)
include/shared/mir_toolkit/mir_native_buffer.h (+6/-2)
include/test/mir_test/client_event_matchers.h (+119/-0)
include/test/mir_test/draw/draw_pattern_checkered-inl.h (+10/-5)
include/test/mir_test_doubles/mock_buffer_packer.h (+1/-0)
include/test/mir_test_doubles/mock_buffer_stream.h (+1/-0)
include/test/mir_test_doubles/mock_display_device.h (+1/-2)
include/test/mir_test_doubles/mock_egl.h (+17/-1)
include/test/mir_test_doubles/mock_framebuffer_bundle.h (+50/-0)
include/test/mir_test_doubles/mock_frontend_surface.h (+1/-1)
include/test/mir_test_doubles/mock_gl.h (+2/-0)
include/test/mir_test_doubles/mock_hwc_composer_device_1.h (+28/-4)
include/test/mir_test_doubles/mock_surface.h (+4/-4)
include/test/mir_test_doubles/mock_surface_controller.h (+1/-1)
include/test/mir_test_doubles/mock_surface_state.h (+1/-0)
include/test/mir_test_doubles/null_platform.h (+7/-3)
include/test/mir_test_doubles/null_session_event_sink.h (+5/-1)
include/test/mir_test_doubles/null_snapshot_strategy.h (+5/-1)
include/test/mir_test_doubles/stub_buffer_stream.h (+4/-0)
include/test/mir_test_doubles/stub_display_buffer_factory.h (+75/-0)
include/test/mir_test_doubles/stub_display_configuration.h (+11/-4)
include/test/mir_test_doubles/stub_display_device.h (+13/-1)
include/test/mir_test_doubles/stub_surface.h (+1/-1)
include/test/mir_test_doubles/stub_surface_builder.h (+16/-3)
include/test/mir_test_doubles/stub_surface_controller.h (+1/-1)
include/test/mir_test_framework/input_testing_server_configuration.h (+2/-10)
include/test/mir_test_framework/udev_environment.h (+12/-1)
src/client/CMakeLists.txt (+1/-0)
src/client/android/android_client_buffer.cpp (+2/-0)
src/client/android/android_client_buffer_factory.cpp (+7/-1)
src/client/android/client_surface_interpreter.cpp (+1/-1)
src/client/default_connection_configuration.cpp (+20/-2)
src/client/default_connection_configuration.h (+9/-0)
src/client/gbm/gbm_client_buffer_factory.cpp (+6/-1)
src/client/logging/input_receiver_report.cpp (+125/-0)
src/client/logging/input_receiver_report.h (+54/-0)
src/client/lttng/rpc_report_tp.h (+14/-0)
src/client/mir_client_library.cpp (+1/-1)
src/client/mir_connection.cpp (+6/-8)
src/client/mir_connection.h (+2/-2)
src/client/mir_surface.cpp (+16/-5)
src/client/mir_surface.h (+1/-1)
src/platform/graphics/egl_resources.cpp (+30/-6)
src/server/CMakeLists.txt (+12/-1)
src/server/compositor/buffer_stream_surfaces.cpp (+5/-0)
src/server/compositor/buffer_stream_surfaces.h (+1/-0)
src/server/default_configuration_options.cpp (+15/-3)
src/server/frontend/CMakeLists.txt (+0/-1)
src/server/frontend/default_configuration.cpp (+98/-10)
src/server/frontend/protobuf_buffer_packer.cpp (+6/-0)
src/server/frontend/protobuf_buffer_packer.h (+1/-0)
src/server/frontend/published_socket_connector.cpp (+5/-5)
src/server/frontend/published_socket_connector.h (+3/-3)
src/server/frontend/session_mediator.cpp (+68/-34)
src/server/frontend/session_mediator.h (+8/-4)
src/server/frontend/surface.cpp (+1/-16)
src/server/graphics/CMakeLists.txt (+1/-0)
src/server/graphics/android/CMakeLists.txt (+3/-1)
src/server/graphics/android/android_buffer_allocator.cpp (+1/-1)
src/server/graphics/android/android_display.cpp (+18/-12)
src/server/graphics/android/android_display.h (+21/-1)
src/server/graphics/android/android_display_buffer_factory.h (+14/-6)
src/server/graphics/android/android_graphic_buffer_allocator.h (+1/-1)
src/server/graphics/android/android_platform.cpp (+42/-3)
src/server/graphics/android/android_platform.h (+17/-2)
src/server/graphics/android/display_buffer.cpp (+62/-0)
src/server/graphics/android/display_buffer.h (+58/-0)
src/server/graphics/android/display_buffer_factory.cpp (+79/-1)
src/server/graphics/android/display_buffer_factory.h (+26/-3)
src/server/graphics/android/display_device.h (+9/-0)
src/server/graphics/android/display_resource_factory.h (+16/-0)
src/server/graphics/android/fb_device.cpp (+23/-13)
src/server/graphics/android/fb_device.h (+5/-1)
src/server/graphics/android/framebuffer_bundle.h (+16/-11)
src/server/graphics/android/framebuffers.cpp (+116/-10)
src/server/graphics/android/framebuffers.h (+18/-13)
src/server/graphics/android/gl_context.cpp (+155/-0)
src/server/graphics/android/gl_context.h (+78/-0)
src/server/graphics/android/graphic_buffer_allocator.h (+1/-1)
src/server/graphics/android/hwc10_device.cpp (+36/-28)
src/server/graphics/android/hwc10_device.h (+27/-1)
src/server/graphics/android/hwc11_device.cpp (+34/-40)
src/server/graphics/android/hwc11_device.h (+22/-2)
src/server/graphics/android/hwc_common_device.cpp (+1/-7)
src/server/graphics/android/hwc_layerlist.cpp (+91/-102)
src/server/graphics/android/hwc_layerlist.h (+38/-59)
src/server/graphics/android/resource_factory.cpp (+66/-2)
src/server/graphics/android/resource_factory.h (+28/-0)
src/server/graphics/android/server_render_window.cpp (+13/-4)
src/server/graphics/android/server_render_window.h (+12/-0)
src/server/graphics/default_configuration.cpp (+160/-0)
src/server/graphics/gbm/CMakeLists.txt (+1/-1)
src/server/graphics/gbm/gbm_buffer.cpp (+4/-0)
src/server/graphics/gbm/gbm_display.cpp (+14/-6)
src/server/graphics/gbm/gbm_display.h (+1/-3)
src/server/graphics/gbm/gbm_display_helpers.cpp (+26/-76)
src/server/graphics/gbm/gbm_display_helpers.h (+4/-20)
src/server/graphics/gbm/gbm_platform.cpp (+9/-5)
src/server/graphics/gbm/gbm_platform.h (+4/-3)
src/server/graphics/gbm/linux_virtual_terminal.cpp (+11/-1)
src/server/graphics/gbm/native_gbm_platform.cpp (+1/-3)
src/server/graphics/gbm/native_gbm_platform.h (+1/-1)
src/server/graphics/gbm/udev_video_devices.cpp (+0/-58)
src/server/graphics/gbm/udev_video_devices.h (+0/-50)
src/server/graphics/gbm/udev_wrapper.cpp (+275/-0)
src/server/graphics/gbm/udev_wrapper.h (+149/-0)
src/server/graphics/gbm/video_devices.h (+0/-52)
src/server/graphics/nested/nested_display.cpp (+25/-3)
src/server/graphics/nested/nested_platform.cpp (+7/-2)
src/server/graphics/nested/nested_platform.h (+2/-2)
src/server/graphics/offscreen/CMakeLists.txt (+13/-0)
src/server/graphics/offscreen/display.cpp (+197/-0)
src/server/graphics/offscreen/display.h (+105/-0)
src/server/graphics/offscreen/display_buffer.cpp (+156/-0)
src/server/graphics/offscreen/display_buffer.h (+82/-0)
src/server/graphics/offscreen/display_configuration.cpp (+72/-0)
src/server/graphics/offscreen/display_configuration.h (+51/-0)
src/server/graphics/offscreen/gl_extensions_base.cpp (+51/-0)
src/server/graphics/offscreen/gl_extensions_base.h (+47/-0)
src/server/graphics/offscreen/surfaceless_egl_context.cpp (+132/-0)
src/server/graphics/offscreen/surfaceless_egl_context.h (+59/-0)
src/server/input/android/dummy_android_pointer_controller.h (+2/-4)
src/server/logging/default_configuration.cpp (+91/-0)
src/server/logging/display_report.cpp (+3/-2)
src/server/lttng/input_report_tp.h (+13/-0)
src/server/lttng/message_processor_report_tp.h (+14/-0)
src/server/shell/CMakeLists.txt (+4/-8)
src/server/shell/default_configuration.cpp (+76/-0)
src/server/shell/focus_sequence.h (+0/-51)
src/server/surfaces/CMakeLists.txt (+20/-2)
src/server/surfaces/application_session.cpp (+19/-18)
src/server/surfaces/application_session.h (+19/-11)
src/server/surfaces/basic_surface.h (+47/-3)
src/server/surfaces/broadcasting_session_event_sink.cpp (+13/-12)
src/server/surfaces/broadcasting_session_event_sink.h (+10/-13)
src/server/surfaces/default_configuration.cpp (+282/-0)
src/server/surfaces/default_session_container.cpp (+31/-3)
src/server/surfaces/default_session_container.h (+11/-11)
src/server/surfaces/gl_pixel_buffer.cpp (+9/-9)
src/server/surfaces/gl_pixel_buffer.h (+4/-4)
src/server/surfaces/global_event_sender.cpp (+10/-5)
src/server/surfaces/global_event_sender.h (+8/-10)
src/server/surfaces/mediating_display_changer.cpp (+17/-11)
src/server/surfaces/mediating_display_changer.h (+6/-8)
src/server/surfaces/mutable_surface_state.h (+1/-0)
src/server/surfaces/pixel_buffer.h (+4/-5)
src/server/surfaces/session_container.h (+14/-11)
src/server/surfaces/session_event_handler_register.h (+8/-9)
src/server/surfaces/session_event_sink.h (+8/-9)
src/server/surfaces/session_manager.cpp (+29/-29)
src/server/surfaces/session_manager.h (+22/-29)
src/server/surfaces/snapshot_strategy.h (+8/-6)
src/server/surfaces/surface.cpp (+33/-1)
src/server/surfaces/surface.h (+81/-0)
src/server/surfaces/surface_allocator.cpp (+7/-3)
src/server/surfaces/surface_allocator.h (+1/-1)
src/server/surfaces/surface_builder.h (+11/-8)
src/server/surfaces/surface_controller.cpp (+8/-3)
src/server/surfaces/surface_controller.h (+11/-2)
src/server/surfaces/surface_data.cpp (+10/-0)
src/server/surfaces/surface_data.h (+1/-0)
src/server/surfaces/surface_factory.h (+2/-2)
src/server/surfaces/surface_impl.cpp (+49/-31)
src/server/surfaces/surface_impl.h (+114/-0)
src/server/surfaces/surface_source.cpp (+9/-4)
src/server/surfaces/surface_source.h (+13/-9)
src/server/surfaces/surface_stack.cpp (+25/-7)
src/server/surfaces/surface_stack.h (+9/-5)
src/server/surfaces/surface_stack_model.h (+4/-4)
src/server/surfaces/surfaces_report.cpp (+129/-0)
src/server/surfaces/surfaces_report.h (+59/-0)
src/server/surfaces/threaded_snapshot_strategy.cpp (+10/-9)
src/server/surfaces/threaded_snapshot_strategy.h (+6/-7)
src/shared/geometry/CMakeLists.txt (+1/-0)
src/shared/geometry/ostream.cpp (+60/-0)
src/shared/geometry/rectangles.cpp (+0/-9)
src/shared/graphics/android/mir_native_window.cpp (+22/-9)
src/shared/input/android/android_input_lexicon.cpp (+3/-0)
src/shared/input/android/android_input_platform.cpp (+11/-3)
src/shared/input/android/android_input_platform.h (+4/-1)
src/shared/input/android/android_input_receiver.cpp (+9/-2)
src/shared/input/android/android_input_receiver.h (+7/-2)
src/shared/protobuf/mir_protobuf.proto (+8/-32)
tests/acceptance-tests/test_client_authorization.cpp (+9/-57)
tests/acceptance-tests/test_client_focus_notification.cpp (+13/-46)
tests/acceptance-tests/test_client_input.cpp (+393/-617)
tests/acceptance-tests/test_client_library.cpp (+75/-0)
tests/acceptance-tests/test_display_configuration.cpp (+6/-16)
tests/acceptance-tests/test_focus_selection.cpp (+14/-51)
tests/acceptance-tests/test_server_shutdown.cpp (+1/-1)
tests/acceptance-tests/test_surfaceloop.cpp (+0/-1)
tests/draw/android_graphics.cpp (+2/-1)
tests/draw/patterns.cpp (+12/-10)
tests/integration-tests/CMakeLists.txt (+2/-0)
tests/integration-tests/client/test_client_render.cpp (+76/-37)
tests/integration-tests/compositor/test_buffer_stream.cpp (+73/-0)
tests/integration-tests/graphics/android/test_display_integration.cpp (+58/-10)
tests/integration-tests/graphics/android/test_internal_client.cpp (+21/-4)
tests/integration-tests/graphics/gbm/test_buffer_integration.cpp (+5/-9)
tests/integration-tests/shell/CMakeLists.txt (+0/-2)
tests/integration-tests/shell/test_session_lifecycle_event.cpp (+4/-3)
tests/integration-tests/test_display_info.cpp (+20/-16)
tests/integration-tests/test_drm_auth_magic.cpp (+2/-17)
tests/integration-tests/test_session.cpp (+18/-18)
tests/integration-tests/test_session_manager.cpp (+16/-7)
tests/integration-tests/test_surfaceloop.cpp (+9/-20)
tests/integration-tests/test_swapinterval.cpp (+1/-0)
tests/mir_test_doubles/mock_egl.cpp (+1/-40)
tests/mir_test_doubles/mock_gl.cpp (+12/-0)
tests/mir_test_framework/input_testing_server_options.cpp (+0/-112)
tests/mir_test_framework/testing_server_options.cpp (+20/-20)
tests/mir_test_framework/udev_environment.cpp (+45/-0)
tests/unit-tests/android_input/CMakeLists.txt (+1/-0)
tests/unit-tests/android_input/input_reader.cpp (+156/-98)
tests/unit-tests/android_input/int_set.cpp (+133/-0)
tests/unit-tests/client/android/test_android_native_window.cpp (+22/-4)
tests/unit-tests/client/android/test_client_android_registrar.cpp (+1/-1)
tests/unit-tests/client/android/test_client_surface_interpreter.cpp (+16/-0)
tests/unit-tests/client/gbm/test_gbm_client_buffer.cpp (+21/-0)
tests/unit-tests/client/input/test_android_input_receiver.cpp (+8/-5)
tests/unit-tests/client/input/test_android_input_receiver_thread.cpp (+5/-2)
tests/unit-tests/client/test_android_client_buffer_factory.cpp (+5/-5)
tests/unit-tests/client/test_client_mir_surface.cpp (+48/-1)
tests/unit-tests/client/test_mir_connection.cpp (+15/-4)
tests/unit-tests/compositor/test_buffer_stream.cpp (+12/-0)
tests/unit-tests/compositor/test_default_display_buffer_compositor.cpp (+1/-1)
tests/unit-tests/compositor/test_gl_renderer.cpp (+1/-4)
tests/unit-tests/draw/test_draw_patterns.cpp (+10/-11)
tests/unit-tests/frontend/CMakeLists.txt (+4/-0)
tests/unit-tests/frontend/test_protobuf_buffer_packer.cpp (+3/-0)
tests/unit-tests/frontend/test_session_mediator.cpp (+24/-20)
tests/unit-tests/frontend/test_session_mediator_android.cpp (+10/-18)
tests/unit-tests/frontend/test_session_mediator_gbm.cpp (+10/-19)
tests/unit-tests/graphics/CMakeLists.txt (+1/-0)
tests/unit-tests/graphics/android/CMakeLists.txt (+1/-0)
tests/unit-tests/graphics/android/test_android_buffer_allocator.cpp (+1/-1)
tests/unit-tests/graphics/android/test_android_fb.cpp (+214/-2)
tests/unit-tests/graphics/android/test_android_platform.cpp (+43/-6)
tests/unit-tests/graphics/android/test_buffer.cpp (+1/-1)
tests/unit-tests/graphics/android/test_buffer_tex_bind.cpp (+2/-9)
tests/unit-tests/graphics/android/test_display_buffer_factory.cpp (+215/-0)
tests/unit-tests/graphics/android/test_fb_device.cpp (+59/-16)
tests/unit-tests/graphics/android/test_fb_simple_swapper.cpp (+179/-106)
tests/unit-tests/graphics/android/test_hwc10_device.cpp (+75/-33)
tests/unit-tests/graphics/android/test_hwc11_device.cpp (+89/-34)
tests/unit-tests/graphics/android/test_hwc_device.cpp (+59/-49)
tests/unit-tests/graphics/android/test_hwc_display.cpp (+134/-21)
tests/unit-tests/graphics/android/test_hwc_layerlist.cpp (+119/-136)
tests/unit-tests/graphics/android/test_internal_client_interpreter.cpp (+3/-3)
tests/unit-tests/graphics/android/test_interpreter_buffer_cache.cpp (+1/-1)
tests/unit-tests/graphics/android/test_resource_factory.cpp (+69/-28)
tests/unit-tests/graphics/android/test_server_interpreter.cpp (+49/-14)
tests/unit-tests/graphics/android/test_sync_fence.cpp (+1/-1)
tests/unit-tests/graphics/gbm/CMakeLists.txt (+1/-1)
tests/unit-tests/graphics/gbm/test_gbm_display.cpp (+57/-20)
tests/unit-tests/graphics/gbm/test_gbm_platform.cpp (+20/-10)
tests/unit-tests/graphics/gbm/test_linux_virtual_terminal.cpp (+58/-5)
tests/unit-tests/graphics/gbm/test_udev_helper.cpp (+467/-0)
tests/unit-tests/graphics/gbm/test_udev_video_devices.cpp (+0/-76)
tests/unit-tests/graphics/nested/CMakeLists.txt (+1/-0)
tests/unit-tests/graphics/nested/test_nested_platform.cpp (+27/-0)
tests/unit-tests/graphics/offscreen/CMakeLists.txt (+6/-0)
tests/unit-tests/graphics/offscreen/test_offscreen_display.cpp (+147/-0)
tests/unit-tests/graphics/test_display.cpp (+21/-4)
tests/unit-tests/input/android/test_android_communication_package.cpp (+2/-2)
tests/unit-tests/input/android/test_android_input_lexicon.cpp (+55/-14)
tests/unit-tests/input/android/test_android_input_manager.cpp (+2/-2)
tests/unit-tests/logging/test_display_report.cpp (+2/-1)
tests/unit-tests/shell/CMakeLists.txt (+3/-8)
tests/unit-tests/shell/test_mediating_display_changer.cpp (+5/-0)
tests/unit-tests/surfaces/CMakeLists.txt (+10/-0)
tests/unit-tests/surfaces/test_application_session.cpp (+11/-11)
tests/unit-tests/surfaces/test_broadcasting_session_event_sink.cpp (+8/-3)
tests/unit-tests/surfaces/test_default_focus_mechanism.cpp (+11/-6)
tests/unit-tests/surfaces/test_gl_pixel_buffer.cpp (+8/-4)
tests/unit-tests/surfaces/test_global_event_sender.cpp (+9/-3)
tests/unit-tests/surfaces/test_session_manager.cpp (+29/-29)
tests/unit-tests/surfaces/test_surface.cpp (+55/-1)
tests/unit-tests/surfaces/test_surface_controller.cpp (+10/-5)
tests/unit-tests/surfaces/test_surface_data.cpp (+19/-1)
tests/unit-tests/surfaces/test_surface_impl.cpp (+46/-30)
tests/unit-tests/surfaces/test_surface_stack.cpp (+2/-2)
tests/unit-tests/surfaces/test_the_session_container_implementation.cpp (+43/-32)
tests/unit-tests/surfaces/test_threaded_snapshot_strategy.cpp (+8/-2)
Text conflict in debian/changelog
Text conflict in debian/control
Path conflict: debian/libmirserver10.install / debian/libmirserver11.install
Text conflict in debian/libmirserver11.install
Text conflict in doc/using_mir_on_pc.md
Text conflict in examples/demo-inprocess-surface-client/inprocess_egl_client.cpp
Text conflict in examples/demo-shell/demo_shell.cpp
Text conflict in include/server/mir/default_configuration_options.h
Text conflict in include/server/mir/default_server_configuration.h
Text conflict in include/server/mir/surfaces/surfaces_report.h
Text conflict in include/test/mir_test_doubles/null_session_event_sink.h
Text conflict in include/test/mir_test_doubles/null_snapshot_strategy.h
Text conflict in include/test/mir_test_doubles/stub_display_device.h
Text conflict in include/test/mir_test_doubles/stub_surface_builder.h
Text conflict in src/server/CMakeLists.txt
Text conflict in src/server/default_configuration_options.cpp
Text conflict in src/server/frontend/default_configuration.cpp
Path conflict: src/server/frontend/global_event_sender.h / src/server/surfaces/global_event_sender.h
Text conflict in src/server/frontend/session_mediator.cpp
Text conflict in src/server/graphics/android/android_display.cpp
Text conflict in src/server/graphics/android/android_display.h
Text conflict in src/server/graphics/android/android_display_buffer_factory.h
Text conflict in src/server/graphics/android/android_platform.cpp
Text conflict in src/server/graphics/android/android_platform.h
Text conflict in src/server/graphics/android/display_buffer_factory.cpp
Text conflict in src/server/graphics/android/display_buffer_factory.h
Text conflict in src/server/graphics/android/display_device.h
Text conflict in src/server/graphics/android/display_resource_factory.h
Text conflict in src/server/graphics/android/fb_device.cpp
Text conflict in src/server/graphics/android/hwc10_device.cpp
Text conflict in src/server/graphics/android/hwc10_device.h
Text conflict in src/server/graphics/android/hwc11_device.cpp
Text conflict in src/server/graphics/android/hwc11_device.h
Text conflict in src/server/graphics/android/resource_factory.cpp
Text conflict in src/server/graphics/android/resource_factory.h
Text conflict in src/server/graphics/android/server_render_window.cpp
Text conflict in src/server/graphics/android/server_render_window.h
Text conflict in src/server/graphics/default_configuration.cpp
Text conflict in src/server/logging/default_configuration.cpp
Path conflict: src/server/logging/surfaces_report.h / src/server/surfaces/surfaces_report.h
Text conflict in src/server/shell/CMakeLists.txt
Path conflict: src/server/shell/broadcasting_session_event_sink.h / src/server/surfaces/broadcasting_session_event_sink.h
Text conflict in src/server/shell/default_configuration.cpp
Path conflict: src/server/shell/default_session_container.h / src/server/surfaces/default_session_container.h
Path conflict: src/server/shell/focus_sequence.h / <deleted>
Path conflict: src/server/shell/gl_pixel_buffer.h / src/server/surfaces/gl_pixel_buffer.h
Path conflict: src/server/shell/mediating_display_changer.h / src/server/surfaces/mediating_display_changer.h
Path conflict: src/server/shell/pixel_buffer.h / src/server/surfaces/pixel_buffer.h
Contents conflict in src/server/shell/registration_order_focus_sequence.cpp
Contents conflict in src/server/shell/registration_order_focus_sequence.h
Path conflict: src/server/shell/session_event_handler_register.h / src/server/surfaces/session_event_handler_register.h
Path conflict: src/server/shell/session_event_sink.h / src/server/surfaces/session_event_sink.h
Path conflict: src/server/shell/snapshot_strategy.h / src/server/surfaces/snapshot_strategy.h
Path conflict: src/server/shell/surface_source.h / src/server/surfaces/surface_source.h
Path conflict: src/server/shell/threaded_snapshot_strategy.h / src/server/surfaces/threaded_snapshot_strategy.h
Text conflict in src/server/surfaces/CMakeLists.txt
Text conflict in src/server/surfaces/application_session.h
Text conflict in src/server/surfaces/basic_surface.h
Text conflict in src/server/surfaces/default_configuration.cpp
Text conflict in src/server/surfaces/default_session_container.cpp
Text conflict in src/server/surfaces/global_event_sender.cpp
Text conflict in src/server/surfaces/mediating_display_changer.cpp
Text conflict in src/server/surfaces/session_manager.cpp
Text conflict in src/server/surfaces/surface.cpp
Text conflict in src/server/surfaces/surface_allocator.cpp
Text conflict in src/server/surfaces/surface_controller.cpp
Text conflict in src/server/surfaces/surface_controller.h
Text conflict in src/server/surfaces/surface_source.cpp
Text conflict in src/server/surfaces/surface_stack.cpp
Text conflict in src/server/surfaces/surface_stack.h
Text conflict in src/server/surfaces/surfaces_report.cpp
Text conflict in src/server/surfaces/surfaces_report.h
Text conflict in tests/acceptance-tests/test_client_input.cpp
Text conflict in tests/acceptance-tests/test_display_configuration.cpp
Text conflict in tests/acceptance-tests/test_focus_selection.cpp
Text conflict in tests/integration-tests/graphics/android/test_display_integration.cpp
Text conflict in tests/integration-tests/graphics/android/test_internal_client.cpp
Text conflict in tests/integration-tests/test_display_info.cpp
Text conflict in tests/integration-tests/test_session.cpp
Text conflict in tests/integration-tests/test_session_manager.cpp
Text conflict in tests/unit-tests/frontend/CMakeLists.txt
Text conflict in tests/unit-tests/frontend/test_session_mediator.cpp
Text conflict in tests/unit-tests/frontend/test_session_mediator_android.cpp
Text conflict in tests/unit-tests/frontend/test_session_mediator_gbm.cpp
Text conflict in tests/unit-tests/graphics/android/test_android_fb.cpp
Text conflict in tests/unit-tests/graphics/android/test_android_platform.cpp
Text conflict in tests/unit-tests/graphics/android/test_fb_device.cpp
Text conflict in tests/unit-tests/graphics/android/test_hwc10_device.cpp
Text conflict in tests/unit-tests/graphics/android/test_hwc11_device.cpp
Text conflict in tests/unit-tests/graphics/android/test_hwc_device.cpp
Text conflict in tests/unit-tests/graphics/android/test_hwc_display.cpp
Text conflict in tests/unit-tests/graphics/android/test_resource_factory.cpp
Text conflict in tests/unit-tests/graphics/android/test_server_interpreter.cpp
Text conflict in tests/unit-tests/graphics/test_display.cpp
Text conflict in tests/unit-tests/input/android/test_android_input_lexicon.cpp
Text conflict in tests/unit-tests/shell/CMakeLists.txt
Text conflict in tests/unit-tests/shell/test_mediating_display_changer.cpp
Contents conflict in tests/unit-tests/shell/test_registration_order_focus_sequence.cpp
Text conflict in tests/unit-tests/surfaces/test_broadcasting_session_event_sink.cpp
Text conflict in tests/unit-tests/surfaces/test_default_focus_mechanism.cpp
Text conflict in tests/unit-tests/surfaces/test_gl_pixel_buffer.cpp
Text conflict in tests/unit-tests/surfaces/test_global_event_sender.cpp
Text conflict in tests/unit-tests/surfaces/test_session_manager.cpp
Text conflict in tests/unit-tests/surfaces/test_surface.cpp
Text conflict in tests/unit-tests/surfaces/test_surface_controller.cpp
Text conflict in tests/unit-tests/surfaces/test_surface_impl.cpp
Text conflict in tests/unit-tests/surfaces/test_the_session_container_implementation.cpp
Text conflict in tests/unit-tests/surfaces/test_threaded_snapshot_strategy.cpp
To merge this branch: bzr merge lp:~kdub/mir/unit-test-cleanup
Reviewer Review Type Date Requested Status
Mir development team Pending
Review via email: mp+196191@code.launchpad.net

Commit message

clean up unit tests (ran under android) so there's no uninitialized value errors for the unit-tests/graphics/android tests, and make the tests run without gmock warning, unexpected call errors

Description of the change

clean up unit tests (ran under android) so there's no uninitialized value errors for the unit-tests/graphics/android tests, and make the tests run without gmock warning, unexpected call errors

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
=== modified file '3rd_party/android-input/android/CMakeLists.txt'
--- 3rd_party/android-input/android/CMakeLists.txt 2013-10-15 08:53:10 +0000
+++ 3rd_party/android-input/android/CMakeLists.txt 2013-11-21 20:19:28 +0000
@@ -33,6 +33,7 @@
33 frameworks/base/services/input/InputReader.cpp33 frameworks/base/services/input/InputReader.cpp
34 frameworks/base/services/input/InputTransport.cpp34 frameworks/base/services/input/InputTransport.cpp
35 frameworks/base/services/input/InputWindow.cpp35 frameworks/base/services/input/InputWindow.cpp
36 frameworks/base/services/input/IntSet.cpp
36 frameworks/base/services/input/PointerController.cpp37 frameworks/base/services/input/PointerController.cpp
37 # Keyboard/keymap handling38 # Keyboard/keymap handling
38 frameworks/base/services/input/GenericKeyMap.cpp39 frameworks/base/services/input/GenericKeyMap.cpp
3940
=== modified file '3rd_party/android-input/android/frameworks/base/include/androidfw/Input.h'
--- 3rd_party/android-input/android/frameworks/base/include/androidfw/Input.h 2013-05-03 16:38:07 +0000
+++ 3rd_party/android-input/android/frameworks/base/include/androidfw/Input.h 2013-11-21 20:19:28 +0000
@@ -77,9 +77,12 @@
77/*77/*
78 * Maximum pointer id value supported in a motion event.78 * Maximum pointer id value supported in a motion event.
79 * Smallest pointer id is 0.79 * Smallest pointer id is 0.
80 * (This is limited by our use of BitSet32 to track pointer assignments.)80 * Any reasonably large value that fits in a int32_t is fine.
81 * A "reasonably large" number is one that guarantees uniqueness of a touch id for some 30 seconds
82 * after its corresponding touch point has physically ended, under very heavy usage (many
83 * simultaneous taps ongoing).
81 */84 */
82#define MAX_POINTER_ID 3185#define MAX_POINTER_ID 100000000
8386
84/*87/*
85 * Declare a concrete type for the NDK's input event forward declaration.88 * Declare a concrete type for the NDK's input event forward declaration.
8689
=== modified file '3rd_party/android-input/android/frameworks/base/include/androidfw/InputTransport.h'
--- 3rd_party/android-input/android/frameworks/base/include/androidfw/InputTransport.h 2013-05-31 16:06:07 +0000
+++ 3rd_party/android-input/android/frameworks/base/include/androidfw/InputTransport.h 2013-11-21 20:19:28 +0000
@@ -29,12 +29,15 @@
29 */29 */
3030
31#include <androidfw/Input.h>31#include <androidfw/Input.h>
32#include <androidfw/IntSet.h>
32#include <std/Errors.h>33#include <std/Errors.h>
33#include <std/Timers.h>34#include <std/Timers.h>
34#include <std/RefBase.h>35#include <std/RefBase.h>
35#include <std/String8.h>36#include <std/String8.h>
36#include <std/Vector.h>37#include <std/Vector.h>
37#include <std/BitSet.h>38
39// C++ std lib
40#include <unordered_map>
3841
39namespace android {42namespace android {
4043
@@ -352,23 +355,23 @@
352 // Touch state per device and source, only for sources of class pointer.355 // Touch state per device and source, only for sources of class pointer.
353 struct History {356 struct History {
354 nsecs_t eventTime;357 nsecs_t eventTime;
355 BitSet32 idBits;358 IntSet ids;
356 int32_t idToIndex[MAX_POINTER_ID + 1];359 std::unordered_map<int32_t, size_t> idToIndex;
357 PointerCoords pointers[MAX_POINTERS];360 PointerCoords pointers[MAX_POINTERS];
358361
359 void initializeFrom(const InputMessage* msg) {362 void initializeFrom(const InputMessage* msg) {
360 eventTime = msg->body.motion.eventTime;363 eventTime = msg->body.motion.eventTime;
361 idBits.clear();364 ids.clear();
362 for (size_t i = 0; i < msg->body.motion.pointerCount; i++) {365 for (size_t i = 0; i < msg->body.motion.pointerCount; i++) {
363 uint32_t id = msg->body.motion.pointers[i].properties.id;366 uint32_t id = msg->body.motion.pointers[i].properties.id;
364 idBits.markBit(id);367 ids.insert(id);
365 idToIndex[id] = i;368 idToIndex[id] = i;
366 pointers[i].copyFrom(msg->body.motion.pointers[i].coords);369 pointers[i].copyFrom(msg->body.motion.pointers[i].coords);
367 }370 }
368 }371 }
369372
370 const PointerCoords& getPointerById(uint32_t id) const {373 const PointerCoords& getPointerById(uint32_t id) const {
371 return pointers[idToIndex[id]];374 return pointers[idToIndex.at(id)];
372 }375 }
373 };376 };
374 struct TouchState {377 struct TouchState {
@@ -385,7 +388,7 @@
385 historyCurrent = 0;388 historyCurrent = 0;
386 historySize = 0;389 historySize = 0;
387 lastResample.eventTime = 0;390 lastResample.eventTime = 0;
388 lastResample.idBits.clear();391 lastResample.ids.clear();
389 }392 }
390393
391 void addHistory(const InputMessage* msg) {394 void addHistory(const InputMessage* msg) {
392395
=== added file '3rd_party/android-input/android/frameworks/base/include/androidfw/IntSet.h'
--- 3rd_party/android-input/android/frameworks/base/include/androidfw/IntSet.h 1970-01-01 00:00:00 +0000
+++ 3rd_party/android-input/android/frameworks/base/include/androidfw/IntSet.h 2013-11-21 20:19:28 +0000
@@ -0,0 +1,104 @@
1/*
2 * Copyright © 2013 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Author: Daniel d'Andrada <daniel.dandrada@canonical.com>
17 */
18
19#ifndef ANDROID_INTSET_H
20#define ANDROID_INTSET_H
21
22#include <assert.h>
23
24// C++ std lib
25#include <algorithm>
26#include <sstream>
27#include <set>
28
29#ifdef ANDROID_INPUT_INTSET_TEST
30namespace test {
31#endif
32
33namespace android {
34
35/*
36 A set of integers
37
38 It serves two purposes:
39 - Provide a convenience wrapper for std::set<int32_t>. Because the std API is cumbersome.
40 - Provide an API similar to the BitSet32 class that it's replacing.
41 */
42class IntSet {
43public:
44
45#ifdef ANDROID_INPUT_INTSET_TEST
46 static int constructionCount;
47 static int destructionCount;
48#endif
49
50 IntSet();
51 IntSet(std::initializer_list<int32_t> list);
52 virtual ~IntSet();
53
54 IntSet operator -(const IntSet &other) const;
55 IntSet operator &(const IntSet &other) const;
56 bool operator ==(const IntSet &other) const;
57
58 std::set<int32_t>::iterator begin() { return stdSet.begin(); }
59 std::set<int32_t>::const_iterator begin() const { return stdSet.begin(); }
60 std::set<int32_t>::iterator end() { return stdSet.end(); }
61 std::set<int32_t>::const_iterator end() const { return stdSet.end(); }
62 std::set<int32_t>::const_iterator cbegin() const { return stdSet.cbegin(); }
63 std::set<int32_t>::const_iterator cend() const { return stdSet.cend(); }
64
65 void clear() { stdSet.clear(); }
66 void insert(int32_t value) { stdSet.insert(value); }
67
68 template<typename Func>
69 void forEach(Func func) { std::for_each(stdSet.begin(), stdSet.end(), func); }
70
71 template<typename Func>
72 void forEach(Func func) const { std::for_each(stdSet.begin(), stdSet.end(), func); }
73
74 void remove(int32_t value) { stdSet.erase(value); }
75 void remove(const IntSet &values);
76
77 size_t size() const { return stdSet.size(); }
78 size_t count() const { return stdSet.size(); }
79
80 bool isEmpty() const { return stdSet.empty(); }
81
82 bool contains(int32_t value) const;
83
84 int32_t first() const { return *stdSet.cbegin(); }
85
86 // It's assumed that the given value does exist in the set
87 size_t indexOf(int32_t value) const;
88
89 std::string toString() const;
90
91private:
92 void remove(std::set<int32_t>::iterator selfIterator,
93 std::set<int32_t>::const_iterator otherIterator,
94 std::set<int32_t>::const_iterator otherEnd);
95 std::set<int32_t> stdSet;
96};
97
98} // namespace android
99
100#ifdef ANDROID_INPUT_INTSET_TEST
101} // namespace test
102#endif
103
104#endif
0105
=== modified file '3rd_party/android-input/android/frameworks/base/include/androidfw/VelocityControl.h'
--- 3rd_party/android-input/android/frameworks/base/include/androidfw/VelocityControl.h 2013-05-03 16:38:07 +0000
+++ 3rd_party/android-input/android/frameworks/base/include/androidfw/VelocityControl.h 2013-11-21 20:19:28 +0000
@@ -19,6 +19,7 @@
1919
2020
21#include <androidfw/Input.h>21#include <androidfw/Input.h>
22#include <androidfw/IntSet.h>
22#include <androidfw/VelocityTracker.h>23#include <androidfw/VelocityTracker.h>
23#include <std/Timers.h>24#include <std/Timers.h>
2425
@@ -101,6 +102,7 @@
101 nsecs_t mLastMovementTime;102 nsecs_t mLastMovementTime;
102 VelocityTracker::Position mRawPosition;103 VelocityTracker::Position mRawPosition;
103 VelocityTracker mVelocityTracker;104 VelocityTracker mVelocityTracker;
105 IntSet mIds;
104};106};
105107
106} // namespace android108} // namespace android
107109
=== modified file '3rd_party/android-input/android/frameworks/base/include/androidfw/VelocityTracker.h'
--- 3rd_party/android-input/android/frameworks/base/include/androidfw/VelocityTracker.h 2013-05-03 16:38:07 +0000
+++ 3rd_party/android-input/android/frameworks/base/include/androidfw/VelocityTracker.h 2013-11-21 20:19:28 +0000
@@ -17,10 +17,12 @@
17#ifndef _ANDROIDFW_VELOCITY_TRACKER_H17#ifndef _ANDROIDFW_VELOCITY_TRACKER_H
18#define _ANDROIDFW_VELOCITY_TRACKER_H18#define _ANDROIDFW_VELOCITY_TRACKER_H
1919
20
21#include <androidfw/Input.h>20#include <androidfw/Input.h>
21#include <androidfw/IntSet.h>
22#include <std/Timers.h>22#include <std/Timers.h>
23#include <std/BitSet.h>23
24// C++ std lib
25#include <unordered_map>
2426
25namespace android {27namespace android {
2628
@@ -74,14 +76,14 @@
74 // Resets the velocity tracker state for specific pointers.76 // Resets the velocity tracker state for specific pointers.
75 // Call this method when some pointers have changed and may be reusing77 // Call this method when some pointers have changed and may be reusing
76 // an id that was assigned to a different pointer earlier.78 // an id that was assigned to a different pointer earlier.
77 void clearPointers(BitSet32 idBits);79 void clearPointers(const IntSet &ids);
7880
79 // Adds movement information for a set of pointers.81 // Adds movement information for a set of pointers.
80 // The idBits bitfield specifies the pointer ids of the pointers whose positions82 // The ids set specifies the pointer ids of the pointers whose positions
81 // are included in the movement.83 // are included in the movement.
82 // The positions array contains position information for each pointer in order by84 // The positions array contains position information for each pointer in order by
83 // increasing id. Its size should be equal to the number of one bits in idBits.85 // increasing id. Its size should be equal to the size of ids.
84 void addMovement(nsecs_t eventTime, BitSet32 idBits, const Position* positions);86 void addMovement(nsecs_t eventTime, const IntSet &ids, const Position* positions);
8587
86 // Adds movement information for all pointers in a MotionEvent, including historical samples.88 // Adds movement information for all pointers in a MotionEvent, including historical samples.
87 void addMovement(const MotionEvent* event);89 void addMovement(const MotionEvent* event);
@@ -100,13 +102,13 @@
100 inline int32_t getActivePointerId() const { return mActivePointerId; }102 inline int32_t getActivePointerId() const { return mActivePointerId; }
101103
102 // Gets a bitset containing all pointer ids from the most recent movement.104 // Gets a bitset containing all pointer ids from the most recent movement.
103 inline BitSet32 getCurrentPointerIdBits() const { return mCurrentPointerIdBits; }105 inline const IntSet &getCurrentPointerIds() const { return mCurrentPointerIds; }
104106
105private:107private:
106 static const char* DEFAULT_STRATEGY;108 static const char* DEFAULT_STRATEGY;
107109
108 nsecs_t mLastEventTime;110 nsecs_t mLastEventTime;
109 BitSet32 mCurrentPointerIdBits;111 IntSet mCurrentPointerIds;
110 int32_t mActivePointerId;112 int32_t mActivePointerId;
111 VelocityTrackerStrategy* mStrategy;113 VelocityTrackerStrategy* mStrategy;
112114
@@ -127,8 +129,8 @@
127 virtual ~VelocityTrackerStrategy() { }129 virtual ~VelocityTrackerStrategy() { }
128130
129 virtual void clear() = 0;131 virtual void clear() = 0;
130 virtual void clearPointers(BitSet32 idBits) = 0;132 virtual void clearPointers(const IntSet &ids) = 0;
131 virtual void addMovement(nsecs_t eventTime, BitSet32 idBits,133 virtual void addMovement(nsecs_t eventTime, const IntSet &ids,
132 const VelocityTracker::Position* positions) = 0;134 const VelocityTracker::Position* positions) = 0;
133 virtual bool getEstimator(uint32_t id, VelocityTracker::Estimator* outEstimator) const = 0;135 virtual bool getEstimator(uint32_t id, VelocityTracker::Estimator* outEstimator) const = 0;
134};136};
@@ -159,8 +161,8 @@
159 virtual ~LeastSquaresVelocityTrackerStrategy();161 virtual ~LeastSquaresVelocityTrackerStrategy();
160162
161 virtual void clear();163 virtual void clear();
162 virtual void clearPointers(BitSet32 idBits);164 virtual void clearPointers(const IntSet &ids);
163 virtual void addMovement(nsecs_t eventTime, BitSet32 idBits,165 virtual void addMovement(nsecs_t eventTime, const IntSet &ids,
164 const VelocityTracker::Position* positions);166 const VelocityTracker::Position* positions);
165 virtual bool getEstimator(uint32_t id, VelocityTracker::Estimator* outEstimator) const;167 virtual bool getEstimator(uint32_t id, VelocityTracker::Estimator* outEstimator) const;
166168
@@ -175,11 +177,11 @@
175177
176 struct Movement {178 struct Movement {
177 nsecs_t eventTime;179 nsecs_t eventTime;
178 BitSet32 idBits;180 IntSet ids;
179 VelocityTracker::Position positions[MAX_POINTERS];181 VelocityTracker::Position positions[MAX_POINTERS];
180182
181 inline const VelocityTracker::Position& getPosition(uint32_t id) const {183 inline const VelocityTracker::Position& getPosition(uint32_t id) const {
182 return positions[idBits.getIndexOfBit(id)];184 return positions[ids.indexOf(id)];
183 }185 }
184 };186 };
185187
@@ -202,8 +204,8 @@
202 ~IntegratingVelocityTrackerStrategy();204 ~IntegratingVelocityTrackerStrategy();
203205
204 virtual void clear();206 virtual void clear();
205 virtual void clearPointers(BitSet32 idBits);207 virtual void clearPointers(const IntSet &ids);
206 virtual void addMovement(nsecs_t eventTime, BitSet32 idBits,208 virtual void addMovement(nsecs_t eventTime, const IntSet &ids,
207 const VelocityTracker::Position* positions);209 const VelocityTracker::Position* positions);
208 virtual bool getEstimator(uint32_t id, VelocityTracker::Estimator* outEstimator) const;210 virtual bool getEstimator(uint32_t id, VelocityTracker::Estimator* outEstimator) const;
209211
@@ -218,8 +220,8 @@
218 };220 };
219221
220 const uint32_t mDegree;222 const uint32_t mDegree;
221 BitSet32 mPointerIdBits;223 IntSet mPointerIds;
222 State mPointerState[MAX_POINTER_ID + 1];224 std::unordered_map<int32_t, State> mPointerState; // maps the id of a pointer to its state
223225
224 void initState(State& state, nsecs_t eventTime, float xpos, float ypos) const;226 void initState(State& state, nsecs_t eventTime, float xpos, float ypos) const;
225 void updateState(State& state, nsecs_t eventTime, float xpos, float ypos) const;227 void updateState(State& state, nsecs_t eventTime, float xpos, float ypos) const;
@@ -236,8 +238,8 @@
236 virtual ~LegacyVelocityTrackerStrategy();238 virtual ~LegacyVelocityTrackerStrategy();
237239
238 virtual void clear();240 virtual void clear();
239 virtual void clearPointers(BitSet32 idBits);241 virtual void clearPointers(const IntSet &ids);
240 virtual void addMovement(nsecs_t eventTime, BitSet32 idBits,242 virtual void addMovement(nsecs_t eventTime, const IntSet &ids,
241 const VelocityTracker::Position* positions);243 const VelocityTracker::Position* positions);
242 virtual bool getEstimator(uint32_t id, VelocityTracker::Estimator* outEstimator) const;244 virtual bool getEstimator(uint32_t id, VelocityTracker::Estimator* outEstimator) const;
243245
@@ -253,11 +255,11 @@
253255
254 struct Movement {256 struct Movement {
255 nsecs_t eventTime;257 nsecs_t eventTime;
256 BitSet32 idBits;258 IntSet ids;
257 VelocityTracker::Position positions[MAX_POINTERS];259 VelocityTracker::Position positions[MAX_POINTERS];
258260
259 inline const VelocityTracker::Position& getPosition(uint32_t id) const {261 inline const VelocityTracker::Position& getPosition(uint32_t id) const {
260 return positions[idBits.getIndexOfBit(id)];262 return positions[ids.indexOf(id)];
261 }263 }
262 };264 };
263265
264266
=== modified file '3rd_party/android-input/android/frameworks/base/services/input/InputDevice.cpp'
--- 3rd_party/android-input/android/frameworks/base/services/input/InputDevice.cpp 2013-02-05 17:19:57 +0000
+++ 3rd_party/android-input/android/frameworks/base/services/input/InputDevice.cpp 2013-11-21 20:19:28 +0000
@@ -16,6 +16,9 @@
1616
17#define LOG_TAG "InputDevice"17#define LOG_TAG "InputDevice"
1818
19#include <cutils/log.h>
20#define DEBUG_PROBE 0
21
19#include <stdlib.h>22#include <stdlib.h>
20#include <unistd.h>23#include <unistd.h>
21#include <ctype.h>24#include <ctype.h>
@@ -97,7 +100,7 @@
97 path.append("/usr/");100 path.append("/usr/");
98 appendInputDeviceConfigurationFileRelativePath(path, name, type);101 appendInputDeviceConfigurationFileRelativePath(path, name, type);
99#if DEBUG_PROBE102#if DEBUG_PROBE
100 ALOGD("Probing for system provided input device configuration file: path='%s'", path.string());103 ALOGD("Probing for system provided input device configuration file: path='%s'", path.c_str());
101#endif104#endif
102 if (!access(c_str(path), R_OK)) {105 if (!access(c_str(path), R_OK)) {
103#if DEBUG_PROBE106#if DEBUG_PROBE
@@ -119,7 +122,7 @@
119 path.append("/system/devices/");122 path.append("/system/devices/");
120 appendInputDeviceConfigurationFileRelativePath(path, name, type);123 appendInputDeviceConfigurationFileRelativePath(path, name, type);
121#if DEBUG_PROBE124#if DEBUG_PROBE
122 ALOGD("Probing for system user input device configuration file: path='%s'", path.string());125 ALOGD("Probing for system user input device configuration file: path='%s'", path.c_str());
123#endif126#endif
124 if (!access(c_str(path), R_OK)) {127 if (!access(c_str(path), R_OK)) {
125#if DEBUG_PROBE128#if DEBUG_PROBE
@@ -131,7 +134,7 @@
131 // Not found.134 // Not found.
132#if DEBUG_PROBE135#if DEBUG_PROBE
133 ALOGD("Probe failed to find input device configuration file: name='%s', type=%d",136 ALOGD("Probe failed to find input device configuration file: name='%s', type=%d",
134 name.string(), type);137 name.c_str(), type);
135#endif138#endif
136 return String8();139 return String8();
137}140}
138141
=== modified file '3rd_party/android-input/android/frameworks/base/services/input/InputDispatcher.cpp'
--- 3rd_party/android-input/android/frameworks/base/services/input/InputDispatcher.cpp 2013-08-28 03:41:48 +0000
+++ 3rd_party/android-input/android/frameworks/base/services/input/InputDispatcher.cpp 2013-11-21 20:19:28 +0000
@@ -152,7 +152,7 @@
152 pointerCount, MAX_POINTERS);152 pointerCount, MAX_POINTERS);
153 return false;153 return false;
154 }154 }
155 BitSet32 pointerIdBits;155 IntSet pointerIds;
156 for (size_t i = 0; i < pointerCount; i++) {156 for (size_t i = 0; i < pointerCount; i++) {
157 int32_t id = pointerProperties[i].id;157 int32_t id = pointerProperties[i].id;
158 if (id < 0 || id > MAX_POINTER_ID) {158 if (id < 0 || id > MAX_POINTER_ID) {
@@ -160,11 +160,11 @@
160 id, MAX_POINTER_ID);160 id, MAX_POINTER_ID);
161 return false;161 return false;
162 }162 }
163 if (pointerIdBits.hasBit(id)) {163 if (pointerIds.contains(id)) {
164 ALOGE("Motion event has duplicate pointer id %d", id);164 ALOGE("Motion event has duplicate pointer id %d", id);
165 return false;165 return false;
166 }166 }
167 pointerIdBits.markBit(id);167 pointerIds.insert(id);
168 }168 }
169 return true;169 return true;
170}170}
@@ -1043,7 +1043,7 @@
1043 // Success! Output targets.1043 // Success! Output targets.
1044 injectionResult = INPUT_EVENT_INJECTION_SUCCEEDED;1044 injectionResult = INPUT_EVENT_INJECTION_SUCCEEDED;
1045 addWindowTargetLocked(mFocusedWindowHandle,1045 addWindowTargetLocked(mFocusedWindowHandle,
1046 InputTarget::FLAG_FOREGROUND | InputTarget::FLAG_DISPATCH_AS_IS, BitSet32(0),1046 InputTarget::FLAG_FOREGROUND | InputTarget::FLAG_DISPATCH_AS_IS, IntSet(),
1047 inputTargets);1047 inputTargets);
10481048
1049 // Done.1049 // Done.
@@ -1181,7 +1181,7 @@
1181 }1181 }
11821182
1183 mTempTouchState.addOrUpdateWindow(1183 mTempTouchState.addOrUpdateWindow(
1184 windowHandle, outsideTargetFlags, BitSet32(0));1184 windowHandle, outsideTargetFlags, IntSet());
1185 }1185 }
1186 }1186 }
1187 });1187 });
@@ -1250,10 +1250,10 @@
1250 }1250 }
12511251
1252 // Update the temporary touch state.1252 // Update the temporary touch state.
1253 BitSet32 pointerIds;1253 IntSet pointerIds;
1254 if (isSplit) {1254 if (isSplit) {
1255 uint32_t pointerId = entry->pointerProperties[pointerIndex].id;1255 int32_t pointerId = entry->pointerProperties[pointerIndex].id;
1256 pointerIds.markBit(pointerId);1256 pointerIds.insert(pointerId);
1257 }1257 }
1258 mTempTouchState.addOrUpdateWindow(newTouchedWindowHandle, targetFlags, pointerIds);1258 mTempTouchState.addOrUpdateWindow(newTouchedWindowHandle, targetFlags, pointerIds);
1259 } else {1259 } else {
@@ -1288,7 +1288,7 @@
1288#endif1288#endif
1289 // Make a slippery exit from the old window.1289 // Make a slippery exit from the old window.
1290 mTempTouchState.addOrUpdateWindow(oldTouchedWindowHandle,1290 mTempTouchState.addOrUpdateWindow(oldTouchedWindowHandle,
1291 InputTarget::FLAG_DISPATCH_AS_SLIPPERY_EXIT, BitSet32(0));1291 InputTarget::FLAG_DISPATCH_AS_SLIPPERY_EXIT, IntSet());
12921292
1293 // Make a slippery entrance into the new window.1293 // Make a slippery entrance into the new window.
1294 if (newTouchedWindowHandle->getInfo()->supportsSplitTouch()) {1294 if (newTouchedWindowHandle->getInfo()->supportsSplitTouch()) {
@@ -1304,9 +1304,9 @@
1304 targetFlags |= InputTarget::FLAG_WINDOW_IS_OBSCURED;1304 targetFlags |= InputTarget::FLAG_WINDOW_IS_OBSCURED;
1305 }1305 }
13061306
1307 BitSet32 pointerIds;1307 IntSet pointerIds;
1308 if (isSplit) {1308 if (isSplit) {
1309 pointerIds.markBit(entry->pointerProperties[0].id);1309 pointerIds.insert(entry->pointerProperties[0].id);
1310 }1310 }
1311 mTempTouchState.addOrUpdateWindow(newTouchedWindowHandle, targetFlags, pointerIds);1311 mTempTouchState.addOrUpdateWindow(newTouchedWindowHandle, targetFlags, pointerIds);
1312 }1312 }
@@ -1321,7 +1321,7 @@
1321 c_str(mLastHoverWindowHandle->getName()));1321 c_str(mLastHoverWindowHandle->getName()));
1322#endif1322#endif
1323 mTempTouchState.addOrUpdateWindow(mLastHoverWindowHandle,1323 mTempTouchState.addOrUpdateWindow(mLastHoverWindowHandle,
1324 InputTarget::FLAG_DISPATCH_AS_HOVER_EXIT, BitSet32(0));1324 InputTarget::FLAG_DISPATCH_AS_HOVER_EXIT, IntSet());
1325 }1325 }
13261326
1327 // Let the new window know that the hover sequence is starting.1327 // Let the new window know that the hover sequence is starting.
@@ -1331,7 +1331,7 @@
1331 c_str(newHoverWindowHandle->getName()));1331 c_str(newHoverWindowHandle->getName()));
1332#endif1332#endif
1333 mTempTouchState.addOrUpdateWindow(newHoverWindowHandle,1333 mTempTouchState.addOrUpdateWindow(newHoverWindowHandle,
1334 InputTarget::FLAG_DISPATCH_AS_HOVER_ENTER, BitSet32(0));1334 InputTarget::FLAG_DISPATCH_AS_HOVER_ENTER, IntSet());
1335 }1335 }
1336 }1336 }
13371337
@@ -1375,7 +1375,7 @@
1375 sp<InputWindowHandle> inputWindowHandle = touchedWindow.windowHandle;1375 sp<InputWindowHandle> inputWindowHandle = touchedWindow.windowHandle;
1376 if (inputWindowHandle->getInfo()->ownerUid != foregroundWindowUid) {1376 if (inputWindowHandle->getInfo()->ownerUid != foregroundWindowUid) {
1377 mTempTouchState.addOrUpdateWindow(inputWindowHandle,1377 mTempTouchState.addOrUpdateWindow(inputWindowHandle,
1378 InputTarget::FLAG_ZERO_COORDS, BitSet32(0));1378 InputTarget::FLAG_ZERO_COORDS, IntSet());
1379 }1379 }
1380 }1380 }
1381 }1381 }
@@ -1421,7 +1421,7 @@
1421 mTempTouchState.addOrUpdateWindow(windowHandle,1421 mTempTouchState.addOrUpdateWindow(windowHandle,
1422 InputTarget::FLAG_WINDOW_IS_OBSCURED1422 InputTarget::FLAG_WINDOW_IS_OBSCURED
1423 | InputTarget::FLAG_DISPATCH_AS_IS,1423 | InputTarget::FLAG_DISPATCH_AS_IS,
1424 BitSet32(0));1424 IntSet());
1425 }1425 }
1426 });1426 });
1427 }1427 }
@@ -1491,12 +1491,12 @@
1491 // One pointer went up.1491 // One pointer went up.
1492 if (isSplit) {1492 if (isSplit) {
1493 int32_t pointerIndex = getMotionEventActionPointerIndex(action);1493 int32_t pointerIndex = getMotionEventActionPointerIndex(action);
1494 uint32_t pointerId = entry->pointerProperties[pointerIndex].id;1494 int32_t pointerId = entry->pointerProperties[pointerIndex].id;
14951495
1496 for (size_t i = 0; i < mTempTouchState.windows.size(); ) {1496 for (size_t i = 0; i < mTempTouchState.windows.size(); ) {
1497 TouchedWindow& touchedWindow = mTempTouchState.windows.editItemAt(i);1497 TouchedWindow& touchedWindow = mTempTouchState.windows.editItemAt(i);
1498 if (touchedWindow.targetFlags & InputTarget::FLAG_SPLIT) {1498 if (touchedWindow.targetFlags & InputTarget::FLAG_SPLIT) {
1499 touchedWindow.pointerIds.clearBit(pointerId);1499 touchedWindow.pointerIds.remove(pointerId);
1500 if (touchedWindow.pointerIds.isEmpty()) {1500 if (touchedWindow.pointerIds.isEmpty()) {
1501 mTempTouchState.windows.removeAt(i);1501 mTempTouchState.windows.removeAt(i);
1502 continue;1502 continue;
@@ -1538,7 +1538,7 @@
1538}1538}
15391539
1540void InputDispatcher::addWindowTargetLocked(const sp<InputWindowHandle>& windowHandle,1540void InputDispatcher::addWindowTargetLocked(const sp<InputWindowHandle>& windowHandle,
1541 int32_t targetFlags, BitSet32 pointerIds, Vector<InputTarget>& inputTargets) {1541 int32_t targetFlags, const IntSet &pointerIds, Vector<InputTarget>& inputTargets) {
1542 inputTargets.push();1542 inputTargets.push();
15431543
1544 const InputWindowInfo* windowInfo = windowHandle->getInfo();1544 const InputWindowInfo* windowInfo = windowHandle->getInfo();
@@ -1693,12 +1693,13 @@
1693void InputDispatcher::prepareDispatchCycleLocked(nsecs_t currentTime,1693void InputDispatcher::prepareDispatchCycleLocked(nsecs_t currentTime,
1694 const sp<Connection>& connection, EventEntry* eventEntry, const InputTarget* inputTarget) {1694 const sp<Connection>& connection, EventEntry* eventEntry, const InputTarget* inputTarget) {
1695#if DEBUG_DISPATCH_CYCLE1695#if DEBUG_DISPATCH_CYCLE
1696 std::string pointerIdsString = inputTarget->pointerIds.toString();
1696 ALOGD("channel '%s' ~ prepareDispatchCycle - flags=0x%08x, "1697 ALOGD("channel '%s' ~ prepareDispatchCycle - flags=0x%08x, "
1697 "xOffset=%f, yOffset=%f, scaleFactor=%f, "1698 "xOffset=%f, yOffset=%f, scaleFactor=%f, "
1698 "pointerIds=0x%x",1699 "pointerIds=%s",
1699 connection->getInputChannelName(), inputTarget->flags,1700 connection->getInputChannelName(), inputTarget->flags,
1700 inputTarget->xOffset, inputTarget->yOffset,1701 inputTarget->xOffset, inputTarget->yOffset,
1701 inputTarget->scaleFactor, inputTarget->pointerIds.value);1702 inputTarget->scaleFactor, pointerIdsString.c_str());
1702#endif1703#endif
17031704
1704 // Skip this event if the connection status is not normal.1705 // Skip this event if the connection status is not normal.
@@ -2163,8 +2164,8 @@
2163}2164}
21642165
2165InputDispatcher::MotionEntry*2166InputDispatcher::MotionEntry*
2166InputDispatcher::splitMotionEvent(const MotionEntry* originalMotionEntry, BitSet32 pointerIds) {2167InputDispatcher::splitMotionEvent(const MotionEntry* originalMotionEntry, const IntSet &pointerIds) {
2167 ALOG_ASSERT(pointerIds.value != 0);2168 ALOG_ASSERT(!pointerIds.isEmpty());
21682169
2169 uint32_t splitPointerIndexMap[MAX_POINTERS];2170 uint32_t splitPointerIndexMap[MAX_POINTERS];
2170 PointerProperties splitPointerProperties[MAX_POINTERS];2171 PointerProperties splitPointerProperties[MAX_POINTERS];
@@ -2178,7 +2179,7 @@
2178 const PointerProperties& pointerProperties =2179 const PointerProperties& pointerProperties =
2179 originalMotionEntry->pointerProperties[originalPointerIndex];2180 originalMotionEntry->pointerProperties[originalPointerIndex];
2180 uint32_t pointerId = uint32_t(pointerProperties.id);2181 uint32_t pointerId = uint32_t(pointerProperties.id);
2181 if (pointerIds.hasBit(pointerId)) {2182 if (pointerIds.contains(pointerId)) {
2182 splitPointerIndexMap[splitPointerCount] = originalPointerIndex;2183 splitPointerIndexMap[splitPointerCount] = originalPointerIndex;
2183 splitPointerProperties[splitPointerCount].copyFrom(pointerProperties);2184 splitPointerProperties[splitPointerCount].copyFrom(pointerProperties);
2184 splitPointerCoords[splitPointerCount].copyFrom(2185 splitPointerCoords[splitPointerCount].copyFrom(
@@ -2207,8 +2208,8 @@
2207 int32_t originalPointerIndex = getMotionEventActionPointerIndex(action);2208 int32_t originalPointerIndex = getMotionEventActionPointerIndex(action);
2208 const PointerProperties& pointerProperties =2209 const PointerProperties& pointerProperties =
2209 originalMotionEntry->pointerProperties[originalPointerIndex];2210 originalMotionEntry->pointerProperties[originalPointerIndex];
2210 uint32_t pointerId = uint32_t(pointerProperties.id);2211 int32_t pointerId = pointerProperties.id;
2211 if (pointerIds.hasBit(pointerId)) {2212 if (pointerIds.contains(pointerId)) {
2212 if (pointerIds.count() == 1) {2213 if (pointerIds.count() == 1) {
2213 // The first/last pointer went down/up.2214 // The first/last pointer went down/up.
2214 action = maskedAction == AMOTION_EVENT_ACTION_POINTER_DOWN2215 action = maskedAction == AMOTION_EVENT_ACTION_POINTER_DOWN
@@ -2216,7 +2217,7 @@
2216 } else {2217 } else {
2217 // A secondary pointer went down/up.2218 // A secondary pointer went down/up.
2218 uint32_t splitPointerIndex = 0;2219 uint32_t splitPointerIndex = 0;
2219 while (pointerId != uint32_t(splitPointerProperties[splitPointerIndex].id)) {2220 while (pointerId != splitPointerProperties[splitPointerIndex].id) {
2220 splitPointerIndex += 1;2221 splitPointerIndex += 1;
2221 }2222 }
2222 action = maskedAction | (splitPointerIndex2223 action = maskedAction | (splitPointerIndex
@@ -2901,7 +2902,7 @@
2901 const TouchedWindow& touchedWindow = mTouchState.windows[i];2902 const TouchedWindow& touchedWindow = mTouchState.windows[i];
2902 if (touchedWindow.windowHandle == fromWindowHandle) {2903 if (touchedWindow.windowHandle == fromWindowHandle) {
2903 int32_t oldTargetFlags = touchedWindow.targetFlags;2904 int32_t oldTargetFlags = touchedWindow.targetFlags;
2904 BitSet32 pointerIds = touchedWindow.pointerIds;2905 IntSet pointerIds = touchedWindow.pointerIds;
29052906
2906 mTouchState.windows.removeAt(i);2907 mTouchState.windows.removeAt(i);
29072908
@@ -3000,10 +3001,14 @@
3000 dump.append(INDENT "TouchedWindows:\n");3001 dump.append(INDENT "TouchedWindows:\n");
3001 for (size_t i = 0; i < mTouchState.windows.size(); i++) {3002 for (size_t i = 0; i < mTouchState.windows.size(); i++) {
3002 const TouchedWindow& touchedWindow = mTouchState.windows[i];3003 const TouchedWindow& touchedWindow = mTouchState.windows[i];
3003 appendFormat(dump, INDENT2 "%d: name='%s', pointerIds=0x%0x, targetFlags=0x%x\n",3004 appendFormat(dump, INDENT2 "%d: name='%s'",
3004 i, c_str(touchedWindow.windowHandle->getName()),3005 i, c_str(touchedWindow.windowHandle->getName()));
3005 touchedWindow.pointerIds.value,3006
3006 touchedWindow.targetFlags);3007 dump.append(", pointerIds=(");
3008 touchedWindow.pointerIds.forEach([&](int32_t id) {appendFormat(dump, ", %d", id);});
3009 dump.append(")");
3010
3011 appendFormat(dump, ", targetFlags=0x%x\n", touchedWindow.targetFlags);
3007 }3012 }
3008 } else {3013 } else {
3009 dump.append(INDENT "TouchedWindows: <none>\n");3014 dump.append(INDENT "TouchedWindows: <none>\n");
@@ -4191,7 +4196,7 @@
4191}4196}
41924197
4193void InputDispatcher::TouchState::addOrUpdateWindow(const sp<InputWindowHandle>& windowHandle,4198void InputDispatcher::TouchState::addOrUpdateWindow(const sp<InputWindowHandle>& windowHandle,
4194 int32_t targetFlags, BitSet32 pointerIds) {4199 int32_t targetFlags, const IntSet &pointerIds) {
4195 if (targetFlags & InputTarget::FLAG_SPLIT) {4200 if (targetFlags & InputTarget::FLAG_SPLIT) {
4196 split = true;4201 split = true;
4197 }4202 }
@@ -4203,7 +4208,9 @@
4203 if (targetFlags & InputTarget::FLAG_DISPATCH_AS_SLIPPERY_EXIT) {4208 if (targetFlags & InputTarget::FLAG_DISPATCH_AS_SLIPPERY_EXIT) {
4204 touchedWindow.targetFlags &= ~InputTarget::FLAG_DISPATCH_AS_IS;4209 touchedWindow.targetFlags &= ~InputTarget::FLAG_DISPATCH_AS_IS;
4205 }4210 }
4206 touchedWindow.pointerIds.value |= pointerIds.value;4211 pointerIds.forEach([&](int32_t id) {
4212 touchedWindow.pointerIds.insert(id);
4213 });
4207 return;4214 return;
4208 }4215 }
4209 }4216 }
42104217
=== modified file '3rd_party/android-input/android/frameworks/base/services/input/InputDispatcher.h'
--- 3rd_party/android-input/android/frameworks/base/services/input/InputDispatcher.h 2013-05-30 19:24:29 +0000
+++ 3rd_party/android-input/android/frameworks/base/services/input/InputDispatcher.h 2013-11-21 20:19:28 +0000
@@ -19,13 +19,13 @@
1919
20#include <androidfw/Input.h>20#include <androidfw/Input.h>
21#include <androidfw/InputTransport.h>21#include <androidfw/InputTransport.h>
22#include <androidfw/IntSet.h>
22#include <std/KeyedVector.h>23#include <std/KeyedVector.h>
23#include <std/Vector.h>24#include <std/Vector.h>
24#include <std/Timers.h>25#include <std/Timers.h>
25#include <std/RefBase.h>26#include <std/RefBase.h>
26#include <std/String8.h>27#include <std/String8.h>
27#include <std/Looper.h>28#include <std/Looper.h>
28#include <std/BitSet.h>
29#include <std/atomic.h>29#include <std/atomic.h>
30#include <std/Condition.h>30#include <std/Condition.h>
31#include <std/Thread.h>31#include <std/Thread.h>
@@ -169,7 +169,7 @@
169169
170 // The subset of pointer ids to include in motion events dispatched to this input target170 // The subset of pointer ids to include in motion events dispatched to this input target
171 // if FLAG_SPLIT is set.171 // if FLAG_SPLIT is set.
172 BitSet32 pointerIds;172 IntSet pointerIds;
173};173};
174174
175175
@@ -953,7 +953,7 @@
953 struct TouchedWindow {953 struct TouchedWindow {
954 sp<InputWindowHandle> windowHandle;954 sp<InputWindowHandle> windowHandle;
955 int32_t targetFlags;955 int32_t targetFlags;
956 BitSet32 pointerIds; // zero unless target flag FLAG_SPLIT is set956 IntSet pointerIds; // empty unless target flag FLAG_SPLIT is set
957 };957 };
958 struct TouchState {958 struct TouchState {
959 bool down;959 bool down;
@@ -967,7 +967,7 @@
967 void reset();967 void reset();
968 void copyFrom(const TouchState& other);968 void copyFrom(const TouchState& other);
969 void addOrUpdateWindow(const sp<InputWindowHandle>& windowHandle,969 void addOrUpdateWindow(const sp<InputWindowHandle>& windowHandle,
970 int32_t targetFlags, BitSet32 pointerIds);970 int32_t targetFlags, const IntSet &pointerIds);
971 void removeWindow(const sp<InputWindowHandle>& windowHandle);971 void removeWindow(const sp<InputWindowHandle>& windowHandle);
972 void filterNonAsIsTouchWindows();972 void filterNonAsIsTouchWindows();
973 sp<InputWindowHandle> getFirstForegroundWindowHandle() const;973 sp<InputWindowHandle> getFirstForegroundWindowHandle() const;
@@ -1033,7 +1033,7 @@
1033 bool* outConflictingPointerActions);1033 bool* outConflictingPointerActions);
10341034
1035 void addWindowTargetLocked(const sp<InputWindowHandle>& windowHandle,1035 void addWindowTargetLocked(const sp<InputWindowHandle>& windowHandle,
1036 int32_t targetFlags, BitSet32 pointerIds, Vector<InputTarget>& inputTargets);1036 int32_t targetFlags, const IntSet &pointerIds, Vector<InputTarget>& inputTargets);
1037 void addMonitoringTargetsLocked(Vector<InputTarget>& inputTargets);1037 void addMonitoringTargetsLocked(Vector<InputTarget>& inputTargets);
10381038
1039 bool checkInjectionPermission(const sp<InputWindowHandle>& windowHandle,1039 bool checkInjectionPermission(const sp<InputWindowHandle>& windowHandle,
@@ -1072,7 +1072,7 @@
1072 const CancelationOptions& options);1072 const CancelationOptions& options);
10731073
1074 // Splitting motion events across windows.1074 // Splitting motion events across windows.
1075 MotionEntry* splitMotionEvent(const MotionEntry* originalMotionEntry, BitSet32 pointerIds);1075 MotionEntry* splitMotionEvent(const MotionEntry* originalMotionEntry, const IntSet &pointerIds);
10761076
1077 // Reset and drop everything the dispatcher is doing.1077 // Reset and drop everything the dispatcher is doing.
1078 void resetAndDropEverythingLocked(const char* reason);1078 void resetAndDropEverythingLocked(const char* reason);
10791079
=== added file '3rd_party/android-input/android/frameworks/base/services/input/InputEventPrinter.h'
--- 3rd_party/android-input/android/frameworks/base/services/input/InputEventPrinter.h 1970-01-01 00:00:00 +0000
+++ 3rd_party/android-input/android/frameworks/base/services/input/InputEventPrinter.h 2013-11-21 20:19:28 +0000
@@ -0,0 +1,138 @@
1/*
2 * Copyright © 2013 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Author: Daniel d'Andrada <daniel.dandrada@canonical.com>
17 */
18
19#ifndef INPUT_EVENT_PRINTER_H
20#define INPUT_EVENT_PRINTER_H
21
22#include <stdio.h>
23
24void synEvCodeToStr(char *codeStr, int code) {
25 switch(code) {
26 case SYN_REPORT:
27 sprintf(codeStr, "SYN_REPORT");
28 break;
29 case SYN_CONFIG:
30 sprintf(codeStr, "SYN_CONFIG");
31 break;
32 case SYN_MT_REPORT:
33 sprintf(codeStr, "SYN_MT_REPORT");
34 break;
35 case SYN_DROPPED:
36 sprintf(codeStr, "SYN_DROPPED");
37 break;
38 default:
39 sprintf(codeStr, "0x%08x", code);
40 break;
41 }
42}
43
44void absEvCodeToStr(char *codeStr, int code) {
45 switch(code) {
46 case ABS_X:
47 sprintf(codeStr, "ABS_X");
48 break;
49 case ABS_Y:
50 sprintf(codeStr, "ABS_Y");
51 break;
52 case ABS_MT_TOUCH_MAJOR:
53 sprintf(codeStr, "ABS_MT_TOUCH_MAJOR");
54 break;
55 case ABS_MT_TOUCH_MINOR:
56 sprintf(codeStr, "ABS_MT_TOUCH_MINOR");
57 break;
58 case ABS_MT_ORIENTATION:
59 sprintf(codeStr, "ABS_MT_ORIENTATION");
60 break;
61 case ABS_MT_POSITION_X:
62 sprintf(codeStr, "ABS_MT_POSITION_X");
63 break;
64 case ABS_MT_POSITION_Y:
65 sprintf(codeStr, "ABS_MT_POSITION_Y");
66 break;
67 case ABS_MT_TOOL_TYPE:
68 sprintf(codeStr, "ABS_MT_TOOL_TYPE");
69 break;
70 default:
71 sprintf(codeStr, "0x%08x", code);
72 break;
73 }
74}
75
76void keyEvCodeToStr(char *codeStr, int code) {
77 switch(code) {
78 case BTN_TOUCH:
79 sprintf(codeStr, "BTN_TOUCH");
80 break;
81 case BTN_STYLUS:
82 sprintf(codeStr, "BTN_STYLUS");
83 break;
84 default:
85 sprintf(codeStr, "0x%08x", code);
86 break;
87 }
88}
89
90void inputEvToStr(char *buffer, int type, int code, int value) {
91 char codeStr[100];
92 switch (type) {
93 case EV_SYN:
94 synEvCodeToStr(codeStr, code);
95 sprintf(buffer, "EV_SYN, %s, 0x%08x", codeStr, value);
96 break;
97 case EV_KEY:
98 keyEvCodeToStr(codeStr, code);
99 sprintf(buffer, "EV_KEY, %s, 0x%08x", codeStr, value);
100 break;
101 case EV_REL:
102 sprintf(buffer, "EV_REL, 0x%08x, 0x%08x", code, value);
103 break;
104 case EV_ABS:
105 absEvCodeToStr(codeStr, code);
106 sprintf(buffer, "EV_ABS, %s, 0x%08x", codeStr, value);
107 break;
108 case EV_MSC:
109 sprintf(buffer, "EV_MSC, 0x%08x, 0x%08x", code, value);
110 break;
111 case EV_SW:
112 sprintf(buffer, "EV_SW, 0x%08x, 0x%08x", code, value);
113 break;
114 case EV_LED:
115 sprintf(buffer, "EV_LED, 0x%08x, 0x%08x", code, value);
116 break;
117 case EV_SND:
118 sprintf(buffer, "EV_SND, 0x%08x, 0x%08x", code, value);
119 break;
120 case EV_REP:
121 sprintf(buffer, "EV_REP, 0x%08x, 0x%08x", code, value);
122 break;
123 case EV_FF:
124 sprintf(buffer, "EV_FF, 0x%08x, 0x%08x", code, value);
125 break;
126 case EV_PWR:
127 sprintf(buffer, "EV_PWR, 0x%08x, 0x%08x", code, value);
128 break;
129 case EV_FF_STATUS:
130 sprintf(buffer, "EV_FF_STATUS, 0x%08x, 0x%08x", code, value);
131 break;
132 default:
133 sprintf(buffer, "0x%08x, 0x%08x, 0x%08x", type, code, value);
134 break;
135 }
136}
137
138#endif // INPUT_EVENT_PRINTER_H
0139
=== modified file '3rd_party/android-input/android/frameworks/base/services/input/InputListener.h'
--- 3rd_party/android-input/android/frameworks/base/services/input/InputListener.h 2013-05-03 16:38:07 +0000
+++ 3rd_party/android-input/android/frameworks/base/services/input/InputListener.h 2013-11-21 20:19:28 +0000
@@ -38,7 +38,7 @@
38struct NotifyConfigurationChangedArgs : public NotifyArgs {38struct NotifyConfigurationChangedArgs : public NotifyArgs {
39 nsecs_t eventTime;39 nsecs_t eventTime;
4040
41 inline NotifyConfigurationChangedArgs() { }41 inline NotifyConfigurationChangedArgs() : eventTime{0} { }
4242
43 NotifyConfigurationChangedArgs(nsecs_t eventTime);43 NotifyConfigurationChangedArgs(nsecs_t eventTime);
4444
4545
=== modified file '3rd_party/android-input/android/frameworks/base/services/input/InputReader.cpp'
--- 3rd_party/android-input/android/frameworks/base/services/input/InputReader.cpp 2013-10-15 08:53:10 +0000
+++ 3rd_party/android-input/android/frameworks/base/services/input/InputReader.cpp 2013-11-21 20:19:28 +0000
@@ -47,6 +47,8 @@
4747
48#include <android/keycodes.h>48#include <android/keycodes.h>
4949
50#include <std/BitSet.h>
51
50#include <stddef.h>52#include <stddef.h>
51#include <stdlib.h>53#include <stdlib.h>
52#include <unistd.h>54#include <unistd.h>
@@ -54,6 +56,10 @@
54#include <limits.h>56#include <limits.h>
55#include <math.h>57#include <math.h>
5658
59#if DEBUG_RAW_EVENTS
60#include "InputEventPrinter.h"
61#endif
62
57#define INDENT " "63#define INDENT " "
58#define INDENT2 " "64#define INDENT2 " "
59#define INDENT3 " "65#define INDENT3 " "
@@ -339,7 +345,7 @@
339 batchSize += 1;345 batchSize += 1;
340 }346 }
341#if DEBUG_RAW_EVENTS347#if DEBUG_RAW_EVENTS
342 ALOGD("BatchSize: %d Count: %d", batchSize, count);348 ALOGD("BatchSize: %zu Count: %zu", batchSize, count);
343#endif349#endif
344 processEventsForDeviceLocked(deviceId, rawEvent, batchSize);350 processEventsForDeviceLocked(deviceId, rawEvent, batchSize);
345 } else {351 } else {
@@ -974,8 +980,9 @@
974 size_t numMappers = mMappers.size();980 size_t numMappers = mMappers.size();
975 for (const RawEvent* rawEvent = rawEvents; count--; rawEvent++) {981 for (const RawEvent* rawEvent = rawEvents; count--; rawEvent++) {
976#if DEBUG_RAW_EVENTS982#if DEBUG_RAW_EVENTS
977 ALOGD("Input event: device=%d type=0x%04x code=0x%04x value=0x%08x",983 char inputStr[200];
978 rawEvent->deviceId, rawEvent->type, rawEvent->code, rawEvent->value);984 inputEvToStr(inputStr, rawEvent->type, rawEvent->code, rawEvent->value);
985 ALOGD("Input event: device=%d %s", rawEvent->deviceId, inputStr);
979#endif986#endif
980987
981 if (mDropUntilNextSync) {988 if (mDropUntilNextSync) {
@@ -1434,32 +1441,31 @@
14341441
1435void RawPointerData::clear() {1442void RawPointerData::clear() {
1436 pointerCount = 0;1443 pointerCount = 0;
1437 clearIdBits();1444 clearIds();
1438}1445}
14391446
1440void RawPointerData::copyFrom(const RawPointerData& other) {1447void RawPointerData::copyFrom(const RawPointerData& other) {
1441 pointerCount = other.pointerCount;1448 pointerCount = other.pointerCount;
1442 hoveringIdBits = other.hoveringIdBits;1449 hoveringIds = other.hoveringIds;
1443 touchingIdBits = other.touchingIdBits;1450 touchingIds = other.touchingIds;
14441451
1445 for (uint32_t i = 0; i < pointerCount; i++) {1452 for (uint32_t i = 0; i < pointerCount; i++) {
1446 pointers[i] = other.pointers[i];1453 pointers[i] = other.pointers[i];
14471454
1448 int id = pointers[i].id;1455 int id = pointers[i].id;
1449 idToIndex[id] = other.idToIndex[id];
1450 }1456 }
1451}1457}
14521458
1453void RawPointerData::getCentroidOfTouchingPointers(float* outX, float* outY) const {1459void RawPointerData::getCentroidOfTouchingPointers(float* outX, float* outY) const {
1454 float x = 0, y = 0;1460 float x = 0, y = 0;
1455 uint32_t count = touchingIdBits.count();1461
1462 uint32_t count = touchingIds.count();
1456 if (count) {1463 if (count) {
1457 for (BitSet32 idBits(touchingIdBits); !idBits.isEmpty(); ) {1464 touchingIds.forEach([&](int32_t id) {
1458 uint32_t id = idBits.clearFirstMarkedBit();
1459 const Pointer& pointer = pointerForId(id);1465 const Pointer& pointer = pointerForId(id);
1460 x += pointer.x;1466 x += pointer.x;
1461 y += pointer.y;1467 y += pointer.y;
1462 }1468 });
1463 x /= count;1469 x /= count;
1464 y /= count;1470 y /= count;
1465 }1471 }
@@ -1476,21 +1482,18 @@
14761482
1477void CookedPointerData::clear() {1483void CookedPointerData::clear() {
1478 pointerCount = 0;1484 pointerCount = 0;
1479 hoveringIdBits.clear();1485 hoveringIds.clear();
1480 touchingIdBits.clear();1486 touchingIds.clear();
1481}1487}
14821488
1483void CookedPointerData::copyFrom(const CookedPointerData& other) {1489void CookedPointerData::copyFrom(const CookedPointerData& other) {
1484 pointerCount = other.pointerCount;1490 pointerCount = other.pointerCount;
1485 hoveringIdBits = other.hoveringIdBits;1491 hoveringIds = other.hoveringIds;
1486 touchingIdBits = other.touchingIdBits;1492 touchingIds = other.touchingIds;
14871493
1488 for (uint32_t i = 0; i < pointerCount; i++) {1494 for (uint32_t i = 0; i < pointerCount; i++) {
1489 pointerProperties[i].copyFrom(other.pointerProperties[i]);1495 pointerProperties[i].copyFrom(other.pointerProperties[i]);
1490 pointerCoords[i].copyFrom(other.pointerCoords[i]);1496 pointerCoords[i].copyFrom(other.pointerCoords[i]);
1491
1492 int id = pointerProperties[i].id;
1493 idToIndex[id] = other.idToIndex[id];
1494 }1497 }
1495}1498}
14961499
@@ -2554,7 +2557,8 @@
2554 InputMapper(device),2557 InputMapper(device),
2555 mSource(0), mDeviceMode(DEVICE_MODE_DISABLED),2558 mSource(0), mDeviceMode(DEVICE_MODE_DISABLED),
2556 mSurfaceOrientation(-1), mSurfaceWidth(-1), mSurfaceHeight(-1),2559 mSurfaceOrientation(-1), mSurfaceWidth(-1), mSurfaceHeight(-1),
2557 mPointerUsage(POINTER_USAGE_NONE) {2560 mPointerUsage(POINTER_USAGE_NONE),
2561 mNextNewPointerId(0) {
2558}2562}
25592563
2560TouchInputMapper::~TouchInputMapper() {2564TouchInputMapper::~TouchInputMapper() {
@@ -3499,12 +3503,12 @@
3499 mLastButtonState = 0;3503 mLastButtonState = 0;
3500 mCurrentRawVScroll = 0;3504 mCurrentRawVScroll = 0;
3501 mCurrentRawHScroll = 0;3505 mCurrentRawHScroll = 0;
3502 mCurrentFingerIdBits.clear();3506 mCurrentFingerIds.clear();
3503 mLastFingerIdBits.clear();3507 mLastFingerIds.clear();
3504 mCurrentStylusIdBits.clear();3508 mCurrentStylusIds.clear();
3505 mLastStylusIdBits.clear();3509 mLastStylusIds.clear();
3506 mCurrentMouseIdBits.clear();3510 mCurrentMouseIds.clear();
3507 mLastMouseIdBits.clear();3511 mLastMouseIds.clear();
3508 mPointerUsage = POINTER_USAGE_NONE;3512 mPointerUsage = POINTER_USAGE_NONE;
3509 mSentHoverEnter = false;3513 mSentHoverEnter = false;
3510 mDownTime = 0;3514 mDownTime = 0;
@@ -3553,21 +3557,25 @@
3553 mLastRawPointerData.pointerCount,3557 mLastRawPointerData.pointerCount,
3554 mCurrentRawPointerData.pointerCount);3558 mCurrentRawPointerData.pointerCount);
3555 } else {3559 } else {
3556 ALOGD("syncTouch: pointerCount %d -> %d, touching ids 0x%08x -> 0x%08x, "3560 std::string lastTouchingIdsString = mLastRawPointerData.touchingIds.toString();
3557 "hovering ids 0x%08x -> 0x%08x",3561 std::string currentTouchingIdsString = mCurrentRawPointerData.touchingIds.toString();
3562 std::string lastHoveringIdsString = mLastRawPointerData.hoveringIds.toString();
3563 std::string currentHoveringIdsString = mCurrentRawPointerData.hoveringIds.toString();
3564 ALOGD("syncTouch: pointerCount %u -> %u, touching ids (%s) -> (%s), "
3565 "hovering ids (%s) -> (%s)",
3558 mLastRawPointerData.pointerCount,3566 mLastRawPointerData.pointerCount,
3559 mCurrentRawPointerData.pointerCount,3567 mCurrentRawPointerData.pointerCount,
3560 mLastRawPointerData.touchingIdBits.value,3568 lastTouchingIdsString.c_str(),
3561 mCurrentRawPointerData.touchingIdBits.value,3569 currentTouchingIdsString.c_str(),
3562 mLastRawPointerData.hoveringIdBits.value,3570 lastHoveringIdsString.c_str(),
3563 mCurrentRawPointerData.hoveringIdBits.value);3571 currentHoveringIdsString.c_str());
3564 }3572 }
3565#endif3573#endif
35663574
3567 // Reset state that we will compute below.3575 // Reset state that we will compute below.
3568 mCurrentFingerIdBits.clear();3576 mCurrentFingerIds.clear();
3569 mCurrentStylusIdBits.clear();3577 mCurrentStylusIds.clear();
3570 mCurrentMouseIdBits.clear();3578 mCurrentMouseIds.clear();
3571 mCurrentCookedPointerData.clear();3579 mCurrentCookedPointerData.clear();
35723580
3573 if (mDeviceMode == DEVICE_MODE_DISABLED) {3581 if (mDeviceMode == DEVICE_MODE_DISABLED) {
@@ -3617,38 +3625,36 @@
36173625
3618 // Dispatch the touches either directly or by translation through a pointer on screen.3626 // Dispatch the touches either directly or by translation through a pointer on screen.
3619 if (mDeviceMode == DEVICE_MODE_POINTER) {3627 if (mDeviceMode == DEVICE_MODE_POINTER) {
3620 for (BitSet32 idBits(mCurrentRawPointerData.touchingIdBits); !idBits.isEmpty(); ) {3628 for (uint32_t i = 0; i < mCurrentRawPointerData.pointerCount; ++i) {
3621 uint32_t id = idBits.clearFirstMarkedBit();3629 const RawPointerData::Pointer& pointer = mCurrentRawPointerData.pointers[i];
3622 const RawPointerData::Pointer& pointer = mCurrentRawPointerData.pointerForId(id);
3623 if (pointer.toolType == AMOTION_EVENT_TOOL_TYPE_STYLUS3630 if (pointer.toolType == AMOTION_EVENT_TOOL_TYPE_STYLUS
3624 || pointer.toolType == AMOTION_EVENT_TOOL_TYPE_ERASER) {3631 || pointer.toolType == AMOTION_EVENT_TOOL_TYPE_ERASER) {
3625 mCurrentStylusIdBits.markBit(id);3632 mCurrentStylusIds.insert(pointer.id);
3626 } else if (pointer.toolType == AMOTION_EVENT_TOOL_TYPE_FINGER3633 } else if (pointer.toolType == AMOTION_EVENT_TOOL_TYPE_FINGER
3627 || pointer.toolType == AMOTION_EVENT_TOOL_TYPE_UNKNOWN) {3634 || pointer.toolType == AMOTION_EVENT_TOOL_TYPE_UNKNOWN) {
3628 mCurrentFingerIdBits.markBit(id);3635 mCurrentFingerIds.insert(pointer.id);
3629 } else if (pointer.toolType == AMOTION_EVENT_TOOL_TYPE_MOUSE) {3636 } else if (pointer.toolType == AMOTION_EVENT_TOOL_TYPE_MOUSE) {
3630 mCurrentMouseIdBits.markBit(id);3637 mCurrentMouseIds.insert(pointer.id);
3631 }3638 }
3632 }3639 }
3633 for (BitSet32 idBits(mCurrentRawPointerData.hoveringIdBits); !idBits.isEmpty(); ) {3640 mCurrentRawPointerData.hoveringIds.forEach([&](int32_t id) {
3634 uint32_t id = idBits.clearFirstMarkedBit();
3635 const RawPointerData::Pointer& pointer = mCurrentRawPointerData.pointerForId(id);3641 const RawPointerData::Pointer& pointer = mCurrentRawPointerData.pointerForId(id);
3636 if (pointer.toolType == AMOTION_EVENT_TOOL_TYPE_STYLUS3642 if (pointer.toolType == AMOTION_EVENT_TOOL_TYPE_STYLUS
3637 || pointer.toolType == AMOTION_EVENT_TOOL_TYPE_ERASER) {3643 || pointer.toolType == AMOTION_EVENT_TOOL_TYPE_ERASER) {
3638 mCurrentStylusIdBits.markBit(id);3644 mCurrentStylusIds.insert(id);
3639 }3645 }
3640 }3646 });
36413647
3642 // Stylus takes precedence over all tools, then mouse, then finger.3648 // Stylus takes precedence over all tools, then mouse, then finger.
3643 PointerUsage pointerUsage = mPointerUsage;3649 PointerUsage pointerUsage = mPointerUsage;
3644 if (!mCurrentStylusIdBits.isEmpty()) {3650 if (!mCurrentStylusIds.isEmpty()) {
3645 mCurrentMouseIdBits.clear();3651 mCurrentMouseIds.clear();
3646 mCurrentFingerIdBits.clear();3652 mCurrentFingerIds.clear();
3647 pointerUsage = POINTER_USAGE_STYLUS;3653 pointerUsage = POINTER_USAGE_STYLUS;
3648 } else if (!mCurrentMouseIdBits.isEmpty()) {3654 } else if (!mCurrentMouseIds.isEmpty()) {
3649 mCurrentFingerIdBits.clear();3655 mCurrentFingerIds.clear();
3650 pointerUsage = POINTER_USAGE_MOUSE;3656 pointerUsage = POINTER_USAGE_MOUSE;
3651 } else if (!mCurrentFingerIdBits.isEmpty() || isPointerDown(mCurrentButtonState)) {3657 } else if (!mCurrentFingerIds.isEmpty() || isPointerDown(mCurrentButtonState)) {
3652 pointerUsage = POINTER_USAGE_GESTURES;3658 pointerUsage = POINTER_USAGE_GESTURES;
3653 }3659 }
36543660
@@ -3661,8 +3667,7 @@
36613667
3662 mPointerController->setButtonState(mCurrentButtonState);3668 mPointerController->setButtonState(mCurrentButtonState);
3663 mPointerController->setSpots(mCurrentCookedPointerData.pointerCoords,3669 mPointerController->setSpots(mCurrentCookedPointerData.pointerCoords,
3664 mCurrentCookedPointerData.idToIndex,3670 mCurrentCookedPointerData.pointerCount);
3665 mCurrentCookedPointerData.touchingIdBits);
3666 }3671 }
36673672
3668 dispatchHoverExit(when, policyFlags);3673 dispatchHoverExit(when, policyFlags);
@@ -3679,9 +3684,9 @@
3679 mLastRawPointerData.copyFrom(mCurrentRawPointerData);3684 mLastRawPointerData.copyFrom(mCurrentRawPointerData);
3680 mLastCookedPointerData.copyFrom(mCurrentCookedPointerData);3685 mLastCookedPointerData.copyFrom(mCurrentCookedPointerData);
3681 mLastButtonState = mCurrentButtonState;3686 mLastButtonState = mCurrentButtonState;
3682 mLastFingerIdBits = mCurrentFingerIdBits;3687 mLastFingerIds = mCurrentFingerIds;
3683 mLastStylusIdBits = mCurrentStylusIdBits;3688 mLastStylusIds = mCurrentStylusIds;
3684 mLastMouseIdBits = mCurrentMouseIdBits;3689 mLastMouseIds = mCurrentMouseIds;
36853690
3686 // Clear some transient state.3691 // Clear some transient state.
3687 mCurrentRawVScroll = 0;3692 mCurrentRawVScroll = 0;
@@ -3699,7 +3704,7 @@
3699bool TouchInputMapper::consumeRawTouches(nsecs_t when, uint32_t policyFlags) {3704bool TouchInputMapper::consumeRawTouches(nsecs_t when, uint32_t policyFlags) {
3700 // Check for release of a virtual key.3705 // Check for release of a virtual key.
3701 if (mCurrentVirtualKey.down) {3706 if (mCurrentVirtualKey.down) {
3702 if (mCurrentRawPointerData.touchingIdBits.isEmpty()) {3707 if (mCurrentRawPointerData.touchingIds.isEmpty()) {
3703 // Pointer went up while virtual key was down.3708 // Pointer went up while virtual key was down.
3704 mCurrentVirtualKey.down = false;3709 mCurrentVirtualKey.down = false;
3705 if (!mCurrentVirtualKey.ignored) {3710 if (!mCurrentVirtualKey.ignored) {
@@ -3714,8 +3719,8 @@
3714 return true;3719 return true;
3715 }3720 }
37163721
3717 if (mCurrentRawPointerData.touchingIdBits.count() == 1) {3722 if (mCurrentRawPointerData.touchingIds.count() == 1) {
3718 uint32_t id = mCurrentRawPointerData.touchingIdBits.firstMarkedBit();3723 int32_t id = mCurrentRawPointerData.touchingIds.first();
3719 const RawPointerData::Pointer& pointer = mCurrentRawPointerData.pointerForId(id);3724 const RawPointerData::Pointer& pointer = mCurrentRawPointerData.pointerForId(id);
3720 const VirtualKey* virtualKey = findVirtualKeyHit(pointer.x, pointer.y);3725 const VirtualKey* virtualKey = findVirtualKeyHit(pointer.x, pointer.y);
3721 if (virtualKey && virtualKey->keyCode == mCurrentVirtualKey.keyCode) {3726 if (virtualKey && virtualKey->keyCode == mCurrentVirtualKey.keyCode) {
@@ -3741,15 +3746,15 @@
3741 }3746 }
3742 }3747 }
37433748
3744 if (mLastRawPointerData.touchingIdBits.isEmpty()3749 if (mLastRawPointerData.touchingIds.isEmpty()
3745 && !mCurrentRawPointerData.touchingIdBits.isEmpty()) {3750 && !mCurrentRawPointerData.touchingIds.isEmpty()) {
3746 // Pointer just went down. Check for virtual key press or off-screen touches.3751 // Pointer just went down. Check for virtual key press or off-screen touches.
3747 uint32_t id = mCurrentRawPointerData.touchingIdBits.firstMarkedBit();3752 int32_t id = mCurrentRawPointerData.touchingIds.first();
3748 const RawPointerData::Pointer& pointer = mCurrentRawPointerData.pointerForId(id);3753 const RawPointerData::Pointer& pointer = mCurrentRawPointerData.pointerForId(id);
3749 if (!isPointInsideSurface(pointer.x, pointer.y)) {3754 if (!isPointInsideSurface(pointer.x, pointer.y)) {
3750 // If exactly one pointer went down, check for virtual key hit.3755 // If exactly one pointer went down, check for virtual key hit.
3751 // Otherwise we will drop the entire stroke.3756 // Otherwise we will drop the entire stroke.
3752 if (mCurrentRawPointerData.touchingIdBits.count() == 1) {3757 if (mCurrentRawPointerData.touchingIds.count() == 1) {
3753 const VirtualKey* virtualKey = findVirtualKeyHit(pointer.x, pointer.y);3758 const VirtualKey* virtualKey = findVirtualKeyHit(pointer.x, pointer.y);
3754 if (virtualKey) {3759 if (virtualKey) {
3755 mCurrentVirtualKey.down = true;3760 mCurrentVirtualKey.down = true;
@@ -3789,7 +3794,7 @@
3789 // area and accidentally triggers a virtual key. This often happens when virtual keys3794 // area and accidentally triggers a virtual key. This often happens when virtual keys
3790 // are layed out below the screen near to where the on screen keyboard's space bar3795 // are layed out below the screen near to where the on screen keyboard's space bar
3791 // is displayed.3796 // is displayed.
3792 if (mConfig.virtualKeyQuietTime > 0 && !mCurrentRawPointerData.touchingIdBits.isEmpty()) {3797 if (mConfig.virtualKeyQuietTime > 0 && !mCurrentRawPointerData.touchingIds.isEmpty()) {
3793 mContext->disableVirtualKeysUntil(when + mConfig.virtualKeyQuietTime);3798 mContext->disableVirtualKeysUntil(when + mConfig.virtualKeyQuietTime);
3794 }3799 }
3795 return false;3800 return false;
@@ -3809,13 +3814,13 @@
3809}3814}
38103815
3811void TouchInputMapper::dispatchTouches(nsecs_t when, uint32_t policyFlags) {3816void TouchInputMapper::dispatchTouches(nsecs_t when, uint32_t policyFlags) {
3812 BitSet32 currentIdBits = mCurrentCookedPointerData.touchingIdBits;3817 IntSet &currentIds = mCurrentCookedPointerData.touchingIds;
3813 BitSet32 lastIdBits = mLastCookedPointerData.touchingIdBits;3818 IntSet &lastIds = mLastCookedPointerData.touchingIds;
3814 int32_t metaState = getContext()->getGlobalMetaState();3819 int32_t metaState = getContext()->getGlobalMetaState();
3815 int32_t buttonState = mCurrentButtonState;3820 int32_t buttonState = mCurrentButtonState;
38163821
3817 if (currentIdBits == lastIdBits) {3822 if (currentIds == lastIds) {
3818 if (!currentIdBits.isEmpty()) {3823 if (!currentIds.isEmpty()) {
3819 // No pointer id changes so this is a move event.3824 // No pointer id changes so this is a move event.
3820 // The listener takes care of batching moves so we don't have to deal with that here.3825 // The listener takes care of batching moves so we don't have to deal with that here.
3821 dispatchMotion(when, policyFlags, mSource,3826 dispatchMotion(when, policyFlags, mSource,
@@ -3823,66 +3828,63 @@
3823 AMOTION_EVENT_EDGE_FLAG_NONE,3828 AMOTION_EVENT_EDGE_FLAG_NONE,
3824 mCurrentCookedPointerData.pointerProperties,3829 mCurrentCookedPointerData.pointerProperties,
3825 mCurrentCookedPointerData.pointerCoords,3830 mCurrentCookedPointerData.pointerCoords,
3826 mCurrentCookedPointerData.idToIndex,3831 mCurrentCookedPointerData.pointerCount,
3827 currentIdBits, -1,3832 currentIds, -1,
3828 mOrientedXPrecision, mOrientedYPrecision, mDownTime);3833 mOrientedXPrecision, mOrientedYPrecision, mDownTime);
3829 }3834 }
3830 } else {3835 } else {
3831 // There may be pointers going up and pointers going down and pointers moving3836 // There may be pointers going up and pointers going down and pointers moving
3832 // all at the same time.3837 // all at the same time.
3833 BitSet32 upIdBits(lastIdBits.value & ~currentIdBits.value);3838 IntSet upIds = lastIds - currentIds;
3834 BitSet32 downIdBits(currentIdBits.value & ~lastIdBits.value);3839 IntSet downIds = currentIds - lastIds;
3835 BitSet32 moveIdBits(lastIdBits.value & currentIdBits.value);3840 IntSet moveIds = lastIds & currentIds;
3836 BitSet32 dispatchedIdBits(lastIdBits.value);3841 IntSet dispatchedIds = lastIds;
38373842
3838 // Update last coordinates of pointers that have moved so that we observe the new3843 // Update last coordinates of pointers that have moved so that we observe the new
3839 // pointer positions at the same time as other pointers that have just gone up.3844 // pointer positions at the same time as other pointers that have just gone up.
3840 bool moveNeeded = updateMovedPointers(3845 bool moveNeeded = updateMovedPointers(
3841 mCurrentCookedPointerData.pointerProperties,3846 mCurrentCookedPointerData.pointerProperties,
3842 mCurrentCookedPointerData.pointerCoords,3847 mCurrentCookedPointerData.pointerCoords,
3843 mCurrentCookedPointerData.idToIndex,3848 mCurrentCookedPointerData.pointerCount,
3844 mLastCookedPointerData.pointerProperties,3849 mLastCookedPointerData.pointerProperties,
3845 mLastCookedPointerData.pointerCoords,3850 mLastCookedPointerData.pointerCoords,
3846 mLastCookedPointerData.idToIndex,3851 mLastCookedPointerData.pointerCount,
3847 moveIdBits);3852 moveIds);
3848 if (buttonState != mLastButtonState) {3853 if (buttonState != mLastButtonState) {
3849 moveNeeded = true;3854 moveNeeded = true;
3850 }3855 }
38513856
3852 // Dispatch pointer up events.3857 // Dispatch pointer up events.
3853 while (!upIdBits.isEmpty()) {3858 upIds.forEach([&](int32_t upId) {
3854 uint32_t upId = upIdBits.clearFirstMarkedBit();
3855
3856 dispatchMotion(when, policyFlags, mSource,3859 dispatchMotion(when, policyFlags, mSource,
3857 AMOTION_EVENT_ACTION_POINTER_UP, 0, metaState, buttonState, 0,3860 AMOTION_EVENT_ACTION_POINTER_UP, 0, metaState, buttonState, 0,
3858 mLastCookedPointerData.pointerProperties,3861 mLastCookedPointerData.pointerProperties,
3859 mLastCookedPointerData.pointerCoords,3862 mLastCookedPointerData.pointerCoords,
3860 mLastCookedPointerData.idToIndex,3863 mLastCookedPointerData.pointerCount,
3861 dispatchedIdBits, upId,3864 dispatchedIds, upId,
3862 mOrientedXPrecision, mOrientedYPrecision, mDownTime);3865 mOrientedXPrecision, mOrientedYPrecision, mDownTime);
3863 dispatchedIdBits.clearBit(upId);3866 dispatchedIds.remove(upId);
3864 }3867 });
38653868
3866 // Dispatch move events if any of the remaining pointers moved from their old locations.3869 // Dispatch move events if any of the remaining pointers moved from their old locations.
3867 // Although applications receive new locations as part of individual pointer up3870 // Although applications receive new locations as part of individual pointer up
3868 // events, they do not generally handle them except when presented in a move event.3871 // events, they do not generally handle them except when presented in a move event.
3869 if (moveNeeded) {3872 if (moveNeeded) {
3870 ALOG_ASSERT(moveIdBits.value == dispatchedIdBits.value);3873 ALOG_ASSERT(moveIds == dispatchedIds);
3871 dispatchMotion(when, policyFlags, mSource,3874 dispatchMotion(when, policyFlags, mSource,
3872 AMOTION_EVENT_ACTION_MOVE, 0, metaState, buttonState, 0,3875 AMOTION_EVENT_ACTION_MOVE, 0, metaState, buttonState, 0,
3873 mCurrentCookedPointerData.pointerProperties,3876 mCurrentCookedPointerData.pointerProperties,
3874 mCurrentCookedPointerData.pointerCoords,3877 mCurrentCookedPointerData.pointerCoords,
3875 mCurrentCookedPointerData.idToIndex,3878 mCurrentCookedPointerData.pointerCount,
3876 dispatchedIdBits, -1,3879 dispatchedIds, -1,
3877 mOrientedXPrecision, mOrientedYPrecision, mDownTime);3880 mOrientedXPrecision, mOrientedYPrecision, mDownTime);
3878 }3881 }
38793882
3880 // Dispatch pointer down events using the new pointer locations.3883 // Dispatch pointer down events using the new pointer locations.
3881 while (!downIdBits.isEmpty()) {3884 downIds.forEach([&](int32_t downId) {
3882 uint32_t downId = downIdBits.clearFirstMarkedBit();3885 dispatchedIds.insert(downId);
3883 dispatchedIdBits.markBit(downId);
38843886
3885 if (dispatchedIdBits.count() == 1) {3887 if (dispatchedIds.count() == 1) {
3886 // First pointer is going down. Set down time.3888 // First pointer is going down. Set down time.
3887 mDownTime = when;3889 mDownTime = when;
3888 }3890 }
@@ -3891,40 +3893,40 @@
3891 AMOTION_EVENT_ACTION_POINTER_DOWN, 0, metaState, buttonState, 0,3893 AMOTION_EVENT_ACTION_POINTER_DOWN, 0, metaState, buttonState, 0,
3892 mCurrentCookedPointerData.pointerProperties,3894 mCurrentCookedPointerData.pointerProperties,
3893 mCurrentCookedPointerData.pointerCoords,3895 mCurrentCookedPointerData.pointerCoords,
3894 mCurrentCookedPointerData.idToIndex,3896 mCurrentCookedPointerData.pointerCount,
3895 dispatchedIdBits, downId,3897 dispatchedIds, downId,
3896 mOrientedXPrecision, mOrientedYPrecision, mDownTime);3898 mOrientedXPrecision, mOrientedYPrecision, mDownTime);
3897 }3899 });
3898 }3900 }
3899}3901}
39003902
3901void TouchInputMapper::dispatchHoverExit(nsecs_t when, uint32_t policyFlags) {3903void TouchInputMapper::dispatchHoverExit(nsecs_t when, uint32_t policyFlags) {
3902 if (mSentHoverEnter &&3904 if (mSentHoverEnter &&
3903 (mCurrentCookedPointerData.hoveringIdBits.isEmpty()3905 (mCurrentCookedPointerData.hoveringIds.isEmpty()
3904 || !mCurrentCookedPointerData.touchingIdBits.isEmpty())) {3906 || !mCurrentCookedPointerData.touchingIds.isEmpty())) {
3905 int32_t metaState = getContext()->getGlobalMetaState();3907 int32_t metaState = getContext()->getGlobalMetaState();
3906 dispatchMotion(when, policyFlags, mSource,3908 dispatchMotion(when, policyFlags, mSource,
3907 AMOTION_EVENT_ACTION_HOVER_EXIT, 0, metaState, mLastButtonState, 0,3909 AMOTION_EVENT_ACTION_HOVER_EXIT, 0, metaState, mLastButtonState, 0,
3908 mLastCookedPointerData.pointerProperties,3910 mLastCookedPointerData.pointerProperties,
3909 mLastCookedPointerData.pointerCoords,3911 mLastCookedPointerData.pointerCoords,
3910 mLastCookedPointerData.idToIndex,3912 mLastCookedPointerData.pointerCount,
3911 mLastCookedPointerData.hoveringIdBits, -1,3913 mLastCookedPointerData.hoveringIds, -1,
3912 mOrientedXPrecision, mOrientedYPrecision, mDownTime);3914 mOrientedXPrecision, mOrientedYPrecision, mDownTime);
3913 mSentHoverEnter = false;3915 mSentHoverEnter = false;
3914 }3916 }
3915}3917}
39163918
3917void TouchInputMapper::dispatchHoverEnterAndMove(nsecs_t when, uint32_t policyFlags) {3919void TouchInputMapper::dispatchHoverEnterAndMove(nsecs_t when, uint32_t policyFlags) {
3918 if (mCurrentCookedPointerData.touchingIdBits.isEmpty()3920 if (mCurrentCookedPointerData.touchingIds.isEmpty()
3919 && !mCurrentCookedPointerData.hoveringIdBits.isEmpty()) {3921 && !mCurrentCookedPointerData.hoveringIds.isEmpty()) {
3920 int32_t metaState = getContext()->getGlobalMetaState();3922 int32_t metaState = getContext()->getGlobalMetaState();
3921 if (!mSentHoverEnter) {3923 if (!mSentHoverEnter) {
3922 dispatchMotion(when, policyFlags, mSource,3924 dispatchMotion(when, policyFlags, mSource,
3923 AMOTION_EVENT_ACTION_HOVER_ENTER, 0, metaState, mCurrentButtonState, 0,3925 AMOTION_EVENT_ACTION_HOVER_ENTER, 0, metaState, mCurrentButtonState, 0,
3924 mCurrentCookedPointerData.pointerProperties,3926 mCurrentCookedPointerData.pointerProperties,
3925 mCurrentCookedPointerData.pointerCoords,3927 mCurrentCookedPointerData.pointerCoords,
3926 mCurrentCookedPointerData.idToIndex,3928 mCurrentCookedPointerData.pointerCount,
3927 mCurrentCookedPointerData.hoveringIdBits, -1,3929 mCurrentCookedPointerData.hoveringIds, -1,
3928 mOrientedXPrecision, mOrientedYPrecision, mDownTime);3930 mOrientedXPrecision, mOrientedYPrecision, mDownTime);
3929 mSentHoverEnter = true;3931 mSentHoverEnter = true;
3930 }3932 }
@@ -3933,8 +3935,8 @@
3933 AMOTION_EVENT_ACTION_HOVER_MOVE, 0, metaState, mCurrentButtonState, 0,3935 AMOTION_EVENT_ACTION_HOVER_MOVE, 0, metaState, mCurrentButtonState, 0,
3934 mCurrentCookedPointerData.pointerProperties,3936 mCurrentCookedPointerData.pointerProperties,
3935 mCurrentCookedPointerData.pointerCoords,3937 mCurrentCookedPointerData.pointerCoords,
3936 mCurrentCookedPointerData.idToIndex,3938 mCurrentCookedPointerData.pointerCount,
3937 mCurrentCookedPointerData.hoveringIdBits, -1,3939 mCurrentCookedPointerData.hoveringIds, -1,
3938 mOrientedXPrecision, mOrientedYPrecision, mDownTime);3940 mOrientedXPrecision, mOrientedYPrecision, mDownTime);
3939 }3941 }
3940}3942}
@@ -3944,8 +3946,8 @@
39443946
3945 mCurrentCookedPointerData.clear();3947 mCurrentCookedPointerData.clear();
3946 mCurrentCookedPointerData.pointerCount = currentPointerCount;3948 mCurrentCookedPointerData.pointerCount = currentPointerCount;
3947 mCurrentCookedPointerData.hoveringIdBits = mCurrentRawPointerData.hoveringIdBits;3949 mCurrentCookedPointerData.hoveringIds = mCurrentRawPointerData.hoveringIds;
3948 mCurrentCookedPointerData.touchingIdBits = mCurrentRawPointerData.touchingIdBits;3950 mCurrentCookedPointerData.touchingIds = mCurrentRawPointerData.touchingIds;
39493951
3950 // Walk through the the active pointers and map device coordinates onto3952 // Walk through the the active pointers and map device coordinates onto
3951 // surface coordinates and adjust for display orientation.3953 // surface coordinates and adjust for display orientation.
@@ -3988,7 +3990,7 @@
3988 }3990 }
39893991
3990 if (mCalibration.haveSizeIsSummed && mCalibration.sizeIsSummed) {3992 if (mCalibration.haveSizeIsSummed && mCalibration.sizeIsSummed) {
3991 uint32_t touchingCount = mCurrentRawPointerData.touchingIdBits.count();3993 uint32_t touchingCount = mCurrentRawPointerData.touchingIds.count();
3992 if (touchingCount > 1) {3994 if (touchingCount > 1) {
3993 touchMajor /= touchingCount;3995 touchMajor /= touchingCount;
3994 touchMinor /= touchingCount;3996 touchMinor /= touchingCount;
@@ -4137,9 +4139,6 @@
4137 properties.clear();4139 properties.clear();
4138 properties.id = id;4140 properties.id = id;
4139 properties.toolType = in.toolType;4141 properties.toolType = in.toolType;
4140
4141 // Write id index.
4142 mCurrentCookedPointerData.idToIndex[id] = i;
4143 }4142 }
4144}4143}
41454144
@@ -4203,8 +4202,7 @@
4203 mPointerController->clearSpots();4202 mPointerController->clearSpots();
4204 }4203 }
4205 mPointerController->setSpots(mPointerGesture.currentGestureCoords,4204 mPointerController->setSpots(mPointerGesture.currentGestureCoords,
4206 mPointerGesture.currentGestureIdToIndex,4205 mPointerGesture.currentGestureIds.count());
4207 mPointerGesture.currentGestureIdBits);
4208 } else {4206 } else {
4209 mPointerController->setPresentation(PointerControllerInterface::PRESENTATION_POINTER);4207 mPointerController->setPresentation(PointerControllerInterface::PRESENTATION_POINTER);
4210 }4208 }
@@ -4255,54 +4253,52 @@
4255 || mPointerGesture.currentGestureMode == PointerGesture::FREEFORM;4253 || mPointerGesture.currentGestureMode == PointerGesture::FREEFORM;
4256 bool moveNeeded = false;4254 bool moveNeeded = false;
4257 if (down && !cancelPreviousGesture && !finishPreviousGesture4255 if (down && !cancelPreviousGesture && !finishPreviousGesture
4258 && !mPointerGesture.lastGestureIdBits.isEmpty()4256 && !(mPointerGesture.lastGestureIds.isEmpty())
4259 && !mPointerGesture.currentGestureIdBits.isEmpty()) {4257 && !(mPointerGesture.currentGestureIds.isEmpty())) {
4260 BitSet32 movedGestureIdBits(mPointerGesture.currentGestureIdBits.value4258 IntSet movedGestureIds = mPointerGesture.currentGestureIds & mPointerGesture.lastGestureIds;
4261 & mPointerGesture.lastGestureIdBits.value);
4262 moveNeeded = updateMovedPointers(mPointerGesture.currentGestureProperties,4259 moveNeeded = updateMovedPointers(mPointerGesture.currentGestureProperties,
4263 mPointerGesture.currentGestureCoords, mPointerGesture.currentGestureIdToIndex,4260 mPointerGesture.currentGestureCoords, mPointerGesture.currentGestureIds.count(),
4264 mPointerGesture.lastGestureProperties,4261 mPointerGesture.lastGestureProperties,
4265 mPointerGesture.lastGestureCoords, mPointerGesture.lastGestureIdToIndex,4262 mPointerGesture.lastGestureCoords, mPointerGesture.lastGestureIds.count(),
4266 movedGestureIdBits);4263 movedGestureIds);
4267 if (buttonState != mLastButtonState) {4264 if (buttonState != mLastButtonState) {
4268 moveNeeded = true;4265 moveNeeded = true;
4269 }4266 }
4270 }4267 }
42714268
4272 // Send motion events for all pointers that went up or were canceled.4269 // Send motion events for all pointers that went up or were canceled.
4273 BitSet32 dispatchedGestureIdBits(mPointerGesture.lastGestureIdBits);4270 IntSet dispatchedGestureIds = mPointerGesture.lastGestureIds;
4274 if (!dispatchedGestureIdBits.isEmpty()) {4271 if (!dispatchedGestureIds.isEmpty()) {
4275 if (cancelPreviousGesture) {4272 if (cancelPreviousGesture) {
4276 dispatchMotion(when, policyFlags, mSource,4273 dispatchMotion(when, policyFlags, mSource,
4277 AMOTION_EVENT_ACTION_CANCEL, 0, metaState, buttonState,4274 AMOTION_EVENT_ACTION_CANCEL, 0, metaState, buttonState,
4278 AMOTION_EVENT_EDGE_FLAG_NONE,4275 AMOTION_EVENT_EDGE_FLAG_NONE,
4279 mPointerGesture.lastGestureProperties,4276 mPointerGesture.lastGestureProperties,
4280 mPointerGesture.lastGestureCoords, mPointerGesture.lastGestureIdToIndex,4277 mPointerGesture.lastGestureCoords, mPointerGesture.lastGestureIds.count(),
4281 dispatchedGestureIdBits, -1,4278 dispatchedGestureIds, -1,
4282 0, 0, mPointerGesture.downTime);4279 0, 0, mPointerGesture.downTime);
42834280
4284 dispatchedGestureIdBits.clear();4281 dispatchedGestureIds.clear();
4285 } else {4282 } else {
4286 BitSet32 upGestureIdBits;4283 IntSet upGestureIds;
4287 if (finishPreviousGesture) {4284 if (finishPreviousGesture) {
4288 upGestureIdBits = dispatchedGestureIdBits;4285 upGestureIds = dispatchedGestureIds;
4289 } else {4286 } else {
4290 upGestureIdBits.value = dispatchedGestureIdBits.value4287 upGestureIds = dispatchedGestureIds - mPointerGesture.currentGestureIds;
4291 & ~mPointerGesture.currentGestureIdBits.value;
4292 }4288 }
4293 while (!upGestureIdBits.isEmpty()) {4289
4294 uint32_t id = upGestureIdBits.clearFirstMarkedBit();4290 upGestureIds.forEach([&](int32_t upId) {
42954291
4296 dispatchMotion(when, policyFlags, mSource,4292 dispatchMotion(when, policyFlags, mSource,
4297 AMOTION_EVENT_ACTION_POINTER_UP, 0,4293 AMOTION_EVENT_ACTION_POINTER_UP, 0,
4298 metaState, buttonState, AMOTION_EVENT_EDGE_FLAG_NONE,4294 metaState, buttonState, AMOTION_EVENT_EDGE_FLAG_NONE,
4299 mPointerGesture.lastGestureProperties,4295 mPointerGesture.lastGestureProperties,
4300 mPointerGesture.lastGestureCoords, mPointerGesture.lastGestureIdToIndex,4296 mPointerGesture.lastGestureCoords, mPointerGesture.lastGestureIds.count(),
4301 dispatchedGestureIdBits, id,4297 dispatchedGestureIds, upId,
4302 0, 0, mPointerGesture.downTime);4298 0, 0, mPointerGesture.downTime);
43034299
4304 dispatchedGestureIdBits.clearBit(id);4300 dispatchedGestureIds.remove(upId);
4305 }4301 });
4306 }4302 }
4307 }4303 }
43084304
@@ -4311,30 +4307,29 @@
4311 dispatchMotion(when, policyFlags, mSource,4307 dispatchMotion(when, policyFlags, mSource,
4312 AMOTION_EVENT_ACTION_MOVE, 0, metaState, buttonState, AMOTION_EVENT_EDGE_FLAG_NONE,4308 AMOTION_EVENT_ACTION_MOVE, 0, metaState, buttonState, AMOTION_EVENT_EDGE_FLAG_NONE,
4313 mPointerGesture.currentGestureProperties,4309 mPointerGesture.currentGestureProperties,
4314 mPointerGesture.currentGestureCoords, mPointerGesture.currentGestureIdToIndex,4310 mPointerGesture.currentGestureCoords, mPointerGesture.currentGestureIds.count(),
4315 dispatchedGestureIdBits, -1,4311 dispatchedGestureIds, -1,
4316 0, 0, mPointerGesture.downTime);4312 0, 0, mPointerGesture.downTime);
4317 }4313 }
43184314
4319 // Send motion events for all pointers that went down.4315 // Send motion events for all pointers that went down.
4320 if (down) {4316 if (down) {
4321 BitSet32 downGestureIdBits(mPointerGesture.currentGestureIdBits.value4317 IntSet downGestureIds = mPointerGesture.currentGestureIds - dispatchedGestureIds;
4322 & ~dispatchedGestureIdBits.value);4318
4323 while (!downGestureIdBits.isEmpty()) {4319 downGestureIds.forEach([&](int32_t downId) {
4324 uint32_t id = downGestureIdBits.clearFirstMarkedBit();4320 dispatchedGestureIds.insert(downId);
4325 dispatchedGestureIdBits.markBit(id);4321
43264322 if (dispatchedGestureIds.size() == 1) {
4327 if (dispatchedGestureIdBits.count() == 1) {
4328 mPointerGesture.downTime = when;4323 mPointerGesture.downTime = when;
4329 }4324 }
43304325
4331 dispatchMotion(when, policyFlags, mSource,4326 dispatchMotion(when, policyFlags, mSource,
4332 AMOTION_EVENT_ACTION_POINTER_DOWN, 0, metaState, buttonState, 0,4327 AMOTION_EVENT_ACTION_POINTER_DOWN, 0, metaState, buttonState, 0,
4333 mPointerGesture.currentGestureProperties,4328 mPointerGesture.currentGestureProperties,
4334 mPointerGesture.currentGestureCoords, mPointerGesture.currentGestureIdToIndex,4329 mPointerGesture.currentGestureCoords, mPointerGesture.currentGestureIds.count(),
4335 dispatchedGestureIdBits, id,4330 dispatchedGestureIds, downId,
4336 0, 0, mPointerGesture.downTime);4331 0, 0, mPointerGesture.downTime);
4337 }4332 });
4338 }4333 }
43394334
4340 // Send motion events for hover.4335 // Send motion events for hover.
@@ -4343,11 +4338,11 @@
4343 AMOTION_EVENT_ACTION_HOVER_MOVE, 0,4338 AMOTION_EVENT_ACTION_HOVER_MOVE, 0,
4344 metaState, buttonState, AMOTION_EVENT_EDGE_FLAG_NONE,4339 metaState, buttonState, AMOTION_EVENT_EDGE_FLAG_NONE,
4345 mPointerGesture.currentGestureProperties,4340 mPointerGesture.currentGestureProperties,
4346 mPointerGesture.currentGestureCoords, mPointerGesture.currentGestureIdToIndex,4341 mPointerGesture.currentGestureCoords,
4347 mPointerGesture.currentGestureIdBits, -1,4342 mPointerGesture.currentGestureIds.count(), -1,
4348 0, 0, mPointerGesture.downTime);4343 0, 0, mPointerGesture.downTime);
4349 } else if (dispatchedGestureIdBits.isEmpty()4344 } else if (dispatchedGestureIds.isEmpty()
4350 && !mPointerGesture.lastGestureIdBits.isEmpty()) {4345 && !mPointerGesture.lastGestureIds.isEmpty()) {
4351 // Synthesize a hover move event after all pointers go up to indicate that4346 // Synthesize a hover move event after all pointers go up to indicate that
4352 // the pointer is hovering again even if the user is not currently touching4347 // the pointer is hovering again even if the user is not currently touching
4353 // the touch pad. This ensures that a view will receive a fresh hover enter4348 // the touch pad. This ensures that a view will receive a fresh hover enter
@@ -4375,32 +4370,29 @@
4375 // Update state.4370 // Update state.
4376 mPointerGesture.lastGestureMode = mPointerGesture.currentGestureMode;4371 mPointerGesture.lastGestureMode = mPointerGesture.currentGestureMode;
4377 if (!down) {4372 if (!down) {
4378 mPointerGesture.lastGestureIdBits.clear();4373 mPointerGesture.lastGestureIds.clear();
4379 } else {4374 } else {
4380 mPointerGesture.lastGestureIdBits = mPointerGesture.currentGestureIdBits;4375 mPointerGesture.lastGestureIds = mPointerGesture.currentGestureIds;
4381 for (BitSet32 idBits(mPointerGesture.currentGestureIdBits); !idBits.isEmpty(); ) {4376 mPointerGesture.lastGestureIdToIndex = mPointerGesture.currentGestureIdToIndex;
4382 uint32_t id = idBits.clearFirstMarkedBit();4377 for (uint32_t index = 0; index < mPointerGesture.currentGestureIds.count(); ++index) {
4383 uint32_t index = mPointerGesture.currentGestureIdToIndex[id];
4384 mPointerGesture.lastGestureProperties[index].copyFrom(4378 mPointerGesture.lastGestureProperties[index].copyFrom(
4385 mPointerGesture.currentGestureProperties[index]);4379 mPointerGesture.currentGestureProperties[index]);
4386 mPointerGesture.lastGestureCoords[index].copyFrom(4380 mPointerGesture.lastGestureCoords[index].copyFrom(
4387 mPointerGesture.currentGestureCoords[index]);4381 mPointerGesture.currentGestureCoords[index]);
4388 mPointerGesture.lastGestureIdToIndex[id] = index;
4389 }4382 }
4390 }4383 }
4391}4384}
43924385
4393void TouchInputMapper::abortPointerGestures(nsecs_t when, uint32_t policyFlags) {4386void TouchInputMapper::abortPointerGestures(nsecs_t when, uint32_t policyFlags) {
4394 // Cancel previously dispatches pointers.4387 // Cancel previously dispatches pointers.
4395 if (!mPointerGesture.lastGestureIdBits.isEmpty()) {4388 if (!mPointerGesture.lastGestureIds.isEmpty()) {
4396 int32_t metaState = getContext()->getGlobalMetaState();4389 int32_t metaState = getContext()->getGlobalMetaState();
4397 int32_t buttonState = mCurrentButtonState;4390 int32_t buttonState = mCurrentButtonState;
4398 dispatchMotion(when, policyFlags, mSource,4391 dispatchMotion(when, policyFlags, mSource,
4399 AMOTION_EVENT_ACTION_CANCEL, 0, metaState, buttonState,4392 AMOTION_EVENT_ACTION_CANCEL, 0, metaState, buttonState,
4400 AMOTION_EVENT_EDGE_FLAG_NONE,4393 AMOTION_EVENT_EDGE_FLAG_NONE,
4401 mPointerGesture.lastGestureProperties,4394 mPointerGesture.lastGestureProperties,
4402 mPointerGesture.lastGestureCoords, mPointerGesture.lastGestureIdToIndex,4395 mPointerGesture.lastGestureCoords, mPointerGesture.lastGestureIds.count(), -1,
4403 mPointerGesture.lastGestureIdBits, -1,
4404 0, 0, mPointerGesture.downTime);4396 0, 0, mPointerGesture.downTime);
4405 }4397 }
44064398
@@ -4440,7 +4432,7 @@
44404432
4441 mPointerGesture.activeGestureId = -1;4433 mPointerGesture.activeGestureId = -1;
4442 mPointerGesture.currentGestureMode = PointerGesture::NEUTRAL;4434 mPointerGesture.currentGestureMode = PointerGesture::NEUTRAL;
4443 mPointerGesture.currentGestureIdBits.clear();4435 mPointerGesture.currentGestureIds.clear();
44444436
4445 mPointerVelocityControl.reset();4437 mPointerVelocityControl.reset();
4446 return true;4438 return true;
@@ -4451,21 +4443,20 @@
4451 return false;4443 return false;
4452 }4444 }
44534445
4454 const uint32_t currentFingerCount = mCurrentFingerIdBits.count();4446 const uint32_t currentFingerCount = mCurrentFingerIds.size();
4455 const uint32_t lastFingerCount = mLastFingerIdBits.count();4447 const uint32_t lastFingerCount = mLastFingerIds.size();
44564448
4457 // Update the velocity tracker.4449 // Update the velocity tracker.
4458 {4450 {
4459 VelocityTracker::Position positions[MAX_POINTERS];4451 VelocityTracker::Position positions[MAX_POINTERS];
4460 uint32_t count = 0;4452 uint32_t count = 0;
4461 for (BitSet32 idBits(mCurrentFingerIdBits); !idBits.isEmpty(); count++) {4453 mCurrentFingerIds.forEach([&](int32_t id) {
4462 uint32_t id = idBits.clearFirstMarkedBit();
4463 const RawPointerData::Pointer& pointer = mCurrentRawPointerData.pointerForId(id);4454 const RawPointerData::Pointer& pointer = mCurrentRawPointerData.pointerForId(id);
4464 positions[count].x = pointer.x * mPointerXMovementScale;4455 positions[count].x = pointer.x * mPointerXMovementScale;
4465 positions[count].y = pointer.y * mPointerYMovementScale;4456 positions[count].y = pointer.y * mPointerYMovementScale;
4466 }4457 count++;
4467 mPointerGesture.velocityTracker.addMovement(when,4458 });
4468 mCurrentFingerIdBits, positions);4459 mPointerGesture.velocityTracker.addMovement(when, mCurrentFingerIds, positions);
4469 }4460 }
44704461
4471 // Pick a new active touch id if needed.4462 // Pick a new active touch id if needed.
@@ -4477,17 +4468,17 @@
4477 int32_t lastActiveTouchId = mPointerGesture.activeTouchId;4468 int32_t lastActiveTouchId = mPointerGesture.activeTouchId;
4478 int32_t activeTouchId = lastActiveTouchId;4469 int32_t activeTouchId = lastActiveTouchId;
4479 if (activeTouchId < 0) {4470 if (activeTouchId < 0) {
4480 if (!mCurrentFingerIdBits.isEmpty()) {4471 if (!mCurrentFingerIds.isEmpty()) {
4481 activeTouchChanged = true;4472 activeTouchChanged = true;
4482 activeTouchId = mPointerGesture.activeTouchId =4473 activeTouchId = mPointerGesture.activeTouchId =
4483 mCurrentFingerIdBits.firstMarkedBit();4474 mCurrentFingerIds.first();
4484 mPointerGesture.firstTouchTime = when;4475 mPointerGesture.firstTouchTime = when;
4485 }4476 }
4486 } else if (!mCurrentFingerIdBits.hasBit(activeTouchId)) {4477 } else if (!mCurrentFingerIds.contains(activeTouchId)) {
4487 activeTouchChanged = true;4478 activeTouchChanged = true;
4488 if (!mCurrentFingerIdBits.isEmpty()) {4479 if (!mCurrentFingerIds.isEmpty()) {
4489 activeTouchId = mPointerGesture.activeTouchId =4480 activeTouchId = mPointerGesture.activeTouchId =
4490 mCurrentFingerIdBits.firstMarkedBit();4481 mCurrentFingerIds.first();
4491 } else {4482 } else {
4492 activeTouchId = mPointerGesture.activeTouchId = -1;4483 activeTouchId = mPointerGesture.activeTouchId = -1;
4493 }4484 }
@@ -4535,7 +4526,7 @@
45354526
4536 mPointerGesture.activeGestureId = -1;4527 mPointerGesture.activeGestureId = -1;
4537 mPointerGesture.currentGestureMode = PointerGesture::QUIET;4528 mPointerGesture.currentGestureMode = PointerGesture::QUIET;
4538 mPointerGesture.currentGestureIdBits.clear();4529 mPointerGesture.currentGestureIds.clear();
45394530
4540 mPointerVelocityControl.reset();4531 mPointerVelocityControl.reset();
4541 } else if (isPointerDown(mCurrentButtonState)) {4532 } else if (isPointerDown(mCurrentButtonState)) {
@@ -4567,8 +4558,7 @@
4567 if (activeTouchId >= 0 && currentFingerCount > 1) {4558 if (activeTouchId >= 0 && currentFingerCount > 1) {
4568 int32_t bestId = -1;4559 int32_t bestId = -1;
4569 float bestSpeed = mConfig.pointerGestureDragMinSwitchSpeed;4560 float bestSpeed = mConfig.pointerGestureDragMinSwitchSpeed;
4570 for (BitSet32 idBits(mCurrentFingerIdBits); !idBits.isEmpty(); ) {4561 mCurrentFingerIds.forEach([&](int32_t id) {
4571 uint32_t id = idBits.clearFirstMarkedBit();
4572 float vx, vy;4562 float vx, vy;
4573 if (mPointerGesture.velocityTracker.getVelocity(id, &vx, &vy)) {4563 if (mPointerGesture.velocityTracker.getVelocity(id, &vx, &vy)) {
4574 float speed = hypotf(vx, vy);4564 float speed = hypotf(vx, vy);
@@ -4577,7 +4567,7 @@
4577 bestSpeed = speed;4567 bestSpeed = speed;
4578 }4568 }
4579 }4569 }
4580 }4570 });
4581 if (bestId >= 0 && bestId != activeTouchId) {4571 if (bestId >= 0 && bestId != activeTouchId) {
4582 mPointerGesture.activeTouchId = activeTouchId = bestId;4572 mPointerGesture.activeTouchId = activeTouchId = bestId;
4583 activeTouchChanged = true;4573 activeTouchChanged = true;
@@ -4588,7 +4578,7 @@
4588 }4578 }
4589 }4579 }
45904580
4591 if (activeTouchId >= 0 && mLastFingerIdBits.hasBit(activeTouchId)) {4581 if (activeTouchId >= 0 && mLastFingerIds.contains(activeTouchId)) {
4592 const RawPointerData::Pointer& currentPointer =4582 const RawPointerData::Pointer& currentPointer =
4593 mCurrentRawPointerData.pointerForId(activeTouchId);4583 mCurrentRawPointerData.pointerForId(activeTouchId);
4594 const RawPointerData::Pointer& lastPointer =4584 const RawPointerData::Pointer& lastPointer =
@@ -4611,9 +4601,8 @@
4611 mPointerController->getPosition(&x, &y);4601 mPointerController->getPosition(&x, &y);
46124602
4613 mPointerGesture.currentGestureMode = PointerGesture::BUTTON_CLICK_OR_DRAG;4603 mPointerGesture.currentGestureMode = PointerGesture::BUTTON_CLICK_OR_DRAG;
4614 mPointerGesture.currentGestureIdBits.clear();4604 mPointerGesture.currentGestureIds.clear();
4615 mPointerGesture.currentGestureIdBits.markBit(mPointerGesture.activeGestureId);4605 mPointerGesture.currentGestureIds.insert(mPointerGesture.activeGestureId);
4616 mPointerGesture.currentGestureIdToIndex[mPointerGesture.activeGestureId] = 0;
4617 mPointerGesture.currentGestureProperties[0].clear();4606 mPointerGesture.currentGestureProperties[0].clear();
4618 mPointerGesture.currentGestureProperties[0].id = mPointerGesture.activeGestureId;4607 mPointerGesture.currentGestureProperties[0].id = mPointerGesture.activeGestureId;
4619 mPointerGesture.currentGestureProperties[0].toolType = AMOTION_EVENT_TOOL_TYPE_FINGER;4608 mPointerGesture.currentGestureProperties[0].toolType = AMOTION_EVENT_TOOL_TYPE_FINGER;
@@ -4648,11 +4637,9 @@
46484637
4649 mPointerGesture.activeGestureId = 0;4638 mPointerGesture.activeGestureId = 0;
4650 mPointerGesture.currentGestureMode = PointerGesture::TAP;4639 mPointerGesture.currentGestureMode = PointerGesture::TAP;
4651 mPointerGesture.currentGestureIdBits.clear();4640 mPointerGesture.currentGestureIds.clear();
4652 mPointerGesture.currentGestureIdBits.markBit(4641 mPointerGesture.currentGestureIds.insert(
4653 mPointerGesture.activeGestureId);4642 mPointerGesture.activeGestureId);
4654 mPointerGesture.currentGestureIdToIndex[
4655 mPointerGesture.activeGestureId] = 0;
4656 mPointerGesture.currentGestureProperties[0].clear();4643 mPointerGesture.currentGestureProperties[0].clear();
4657 mPointerGesture.currentGestureProperties[0].id =4644 mPointerGesture.currentGestureProperties[0].id =
4658 mPointerGesture.activeGestureId;4645 mPointerGesture.activeGestureId;
@@ -4690,7 +4677,7 @@
4690#endif4677#endif
4691 mPointerGesture.activeGestureId = -1;4678 mPointerGesture.activeGestureId = -1;
4692 mPointerGesture.currentGestureMode = PointerGesture::NEUTRAL;4679 mPointerGesture.currentGestureMode = PointerGesture::NEUTRAL;
4693 mPointerGesture.currentGestureIdBits.clear();4680 mPointerGesture.currentGestureIds.clear();
4694 }4681 }
4695 } else if (currentFingerCount == 1) {4682 } else if (currentFingerCount == 1) {
4696 // Case 4. Exactly one finger down, button is not pressed. (HOVER or TAP_DRAG)4683 // Case 4. Exactly one finger down, button is not pressed. (HOVER or TAP_DRAG)
@@ -4724,7 +4711,7 @@
4724 mPointerGesture.currentGestureMode = PointerGesture::TAP_DRAG;4711 mPointerGesture.currentGestureMode = PointerGesture::TAP_DRAG;
4725 }4712 }
47264713
4727 if (mLastFingerIdBits.hasBit(activeTouchId)) {4714 if (mLastFingerIds.contains(activeTouchId)) {
4728 const RawPointerData::Pointer& currentPointer =4715 const RawPointerData::Pointer& currentPointer =
4729 mCurrentRawPointerData.pointerForId(activeTouchId);4716 mCurrentRawPointerData.pointerForId(activeTouchId);
4730 const RawPointerData::Pointer& lastPointer =4717 const RawPointerData::Pointer& lastPointer =
@@ -4764,9 +4751,8 @@
4764 float x, y;4751 float x, y;
4765 mPointerController->getPosition(&x, &y);4752 mPointerController->getPosition(&x, &y);
47664753
4767 mPointerGesture.currentGestureIdBits.clear();4754 mPointerGesture.currentGestureIds.clear();
4768 mPointerGesture.currentGestureIdBits.markBit(mPointerGesture.activeGestureId);4755 mPointerGesture.currentGestureIds.insert(mPointerGesture.activeGestureId);
4769 mPointerGesture.currentGestureIdToIndex[mPointerGesture.activeGestureId] = 0;
4770 mPointerGesture.currentGestureProperties[0].clear();4756 mPointerGesture.currentGestureProperties[0].clear();
4771 mPointerGesture.currentGestureProperties[0].id = mPointerGesture.activeGestureId;4757 mPointerGesture.currentGestureProperties[0].id = mPointerGesture.activeGestureId;
4772 mPointerGesture.currentGestureProperties[0].toolType =4758 mPointerGesture.currentGestureProperties[0].toolType =
@@ -4823,7 +4809,7 @@
4823 if (*outFinishPreviousGesture || *outCancelPreviousGesture) {4809 if (*outFinishPreviousGesture || *outCancelPreviousGesture) {
4824 mPointerGesture.currentGestureMode = PointerGesture::PRESS;4810 mPointerGesture.currentGestureMode = PointerGesture::PRESS;
4825 mPointerGesture.activeGestureId = 0;4811 mPointerGesture.activeGestureId = 0;
4826 mPointerGesture.referenceIdBits.clear();4812 mPointerGesture.referenceIds.clear();
4827 mPointerVelocityControl.reset();4813 mPointerVelocityControl.reset();
48284814
4829 // Use the centroid and pointer location as the reference points for the gesture.4815 // Use the centroid and pointer location as the reference points for the gesture.
@@ -4841,21 +4827,18 @@
4841 }4827 }
48424828
4843 // Clear the reference deltas for fingers not yet included in the reference calculation.4829 // Clear the reference deltas for fingers not yet included in the reference calculation.
4844 for (BitSet32 idBits(mCurrentFingerIdBits.value4830 (mCurrentFingerIds - mPointerGesture.referenceIds).forEach([&](int32_t id) {
4845 & ~mPointerGesture.referenceIdBits.value); !idBits.isEmpty(); ) {
4846 uint32_t id = idBits.clearFirstMarkedBit();
4847 mPointerGesture.referenceDeltas[id].dx = 0;4831 mPointerGesture.referenceDeltas[id].dx = 0;
4848 mPointerGesture.referenceDeltas[id].dy = 0;4832 mPointerGesture.referenceDeltas[id].dy = 0;
4849 }4833 });
4850 mPointerGesture.referenceIdBits = mCurrentFingerIdBits;4834 mPointerGesture.referenceIds = mCurrentFingerIds;
48514835
4852 // Add delta for all fingers and calculate a common movement delta.4836 // Add delta for all fingers and calculate a common movement delta.
4853 float commonDeltaX = 0, commonDeltaY = 0;4837 float commonDeltaX = 0, commonDeltaY = 0;
4854 BitSet32 commonIdBits(mLastFingerIdBits.value4838 IntSet commonIds = mLastFingerIds & mCurrentFingerIds;
4855 & mCurrentFingerIdBits.value);4839
4856 for (BitSet32 idBits(commonIdBits); !idBits.isEmpty(); ) {4840 bool first = true;
4857 bool first = (idBits == commonIdBits);4841 commonIds.forEach([&](int32_t id) {
4858 uint32_t id = idBits.clearFirstMarkedBit();
4859 const RawPointerData::Pointer& cpd = mCurrentRawPointerData.pointerForId(id);4842 const RawPointerData::Pointer& cpd = mCurrentRawPointerData.pointerForId(id);
4860 const RawPointerData::Pointer& lpd = mLastRawPointerData.pointerForId(id);4843 const RawPointerData::Pointer& lpd = mLastRawPointerData.pointerForId(id);
4861 PointerGesture::Delta& delta = mPointerGesture.referenceDeltas[id];4844 PointerGesture::Delta& delta = mPointerGesture.referenceDeltas[id];
@@ -4865,25 +4848,25 @@
4865 if (first) {4848 if (first) {
4866 commonDeltaX = delta.dx;4849 commonDeltaX = delta.dx;
4867 commonDeltaY = delta.dy;4850 commonDeltaY = delta.dy;
4851 first = false;
4868 } else {4852 } else {
4869 commonDeltaX = calculateCommonVector(commonDeltaX, delta.dx);4853 commonDeltaX = calculateCommonVector(commonDeltaX, delta.dx);
4870 commonDeltaY = calculateCommonVector(commonDeltaY, delta.dy);4854 commonDeltaY = calculateCommonVector(commonDeltaY, delta.dy);
4871 }4855 }
4872 }4856 });
48734857
4874 // Consider transitions from PRESS to SWIPE or MULTITOUCH.4858 // Consider transitions from PRESS to SWIPE or MULTITOUCH.
4875 if (mPointerGesture.currentGestureMode == PointerGesture::PRESS) {4859 if (mPointerGesture.currentGestureMode == PointerGesture::PRESS) {
4876 float dist[MAX_POINTER_ID + 1];4860 std::unordered_map<int32_t, float> dist;
4877 int32_t distOverThreshold = 0;4861 int32_t distOverThreshold = 0;
4878 for (BitSet32 idBits(mPointerGesture.referenceIdBits); !idBits.isEmpty(); ) {4862 mPointerGesture.referenceIds.forEach([&](int32_t id) {
4879 uint32_t id = idBits.clearFirstMarkedBit();
4880 PointerGesture::Delta& delta = mPointerGesture.referenceDeltas[id];4863 PointerGesture::Delta& delta = mPointerGesture.referenceDeltas[id];
4881 dist[id] = hypotf(delta.dx * mPointerXZoomScale,4864 dist[id] = hypotf(delta.dx * mPointerXZoomScale,
4882 delta.dy * mPointerYZoomScale);4865 delta.dy * mPointerYZoomScale);
4883 if (dist[id] > mConfig.pointerGestureMultitouchMinDistance) {4866 if (dist[id] > mConfig.pointerGestureMultitouchMinDistance) {
4884 distOverThreshold += 1;4867 distOverThreshold += 1;
4885 }4868 }
4886 }4869 });
48874870
4888 // Only transition when at least two pointers have moved further than4871 // Only transition when at least two pointers have moved further than
4889 // the minimum distance threshold.4872 // the minimum distance threshold.
@@ -4898,9 +4881,14 @@
4898 mPointerGesture.currentGestureMode = PointerGesture::FREEFORM;4881 mPointerGesture.currentGestureMode = PointerGesture::FREEFORM;
4899 } else {4882 } else {
4900 // There are exactly two pointers.4883 // There are exactly two pointers.
4901 BitSet32 idBits(mCurrentFingerIdBits);4884 int32_t id1;
4902 uint32_t id1 = idBits.clearFirstMarkedBit();4885 int32_t id2;
4903 uint32_t id2 = idBits.firstMarkedBit();4886 {
4887 auto currentFingerIdsIt = mCurrentFingerIds.cbegin();
4888 id1 = *currentFingerIdsIt;
4889 ++currentFingerIdsIt;
4890 id2 = *currentFingerIdsIt;
4891 }
4904 const RawPointerData::Pointer& p1 = mCurrentRawPointerData.pointerForId(id1);4892 const RawPointerData::Pointer& p1 = mCurrentRawPointerData.pointerForId(id1);
4905 const RawPointerData::Pointer& p2 = mCurrentRawPointerData.pointerForId(id2);4893 const RawPointerData::Pointer& p2 = mCurrentRawPointerData.pointerForId(id2);
4906 float mutualDistance = distance(p1.x, p1.y, p2.x, p2.y);4894 float mutualDistance = distance(p1.x, p1.y, p2.x, p2.y);
@@ -4977,12 +4965,11 @@
4977 // except in PRESS mode while waiting for a transition to occur.4965 // except in PRESS mode while waiting for a transition to occur.
4978 if (mPointerGesture.currentGestureMode != PointerGesture::PRESS4966 if (mPointerGesture.currentGestureMode != PointerGesture::PRESS
4979 && (commonDeltaX || commonDeltaY)) {4967 && (commonDeltaX || commonDeltaY)) {
4980 for (BitSet32 idBits(mPointerGesture.referenceIdBits); !idBits.isEmpty(); ) {4968 mPointerGesture.referenceIds.forEach([&](int32_t id) {
4981 uint32_t id = idBits.clearFirstMarkedBit();
4982 PointerGesture::Delta& delta = mPointerGesture.referenceDeltas[id];4969 PointerGesture::Delta& delta = mPointerGesture.referenceDeltas[id];
4983 delta.dx = 0;4970 delta.dx = 0;
4984 delta.dy = 0;4971 delta.dy = 0;
4985 }4972 });
49864973
4987 mPointerGesture.referenceTouchX += commonDeltaX;4974 mPointerGesture.referenceTouchX += commonDeltaX;
4988 mPointerGesture.referenceTouchY += commonDeltaY;4975 mPointerGesture.referenceTouchY += commonDeltaY;
@@ -5008,9 +4995,8 @@
5008#endif4995#endif
5009 ALOG_ASSERT(mPointerGesture.activeGestureId >= 0);4996 ALOG_ASSERT(mPointerGesture.activeGestureId >= 0);
50104997
5011 mPointerGesture.currentGestureIdBits.clear();4998 mPointerGesture.currentGestureIds.clear();
5012 mPointerGesture.currentGestureIdBits.markBit(mPointerGesture.activeGestureId);4999 mPointerGesture.currentGestureIds.insert(mPointerGesture.activeGestureId);
5013 mPointerGesture.currentGestureIdToIndex[mPointerGesture.activeGestureId] = 0;
5014 mPointerGesture.currentGestureProperties[0].clear();5000 mPointerGesture.currentGestureProperties[0].clear();
5015 mPointerGesture.currentGestureProperties[0].id = mPointerGesture.activeGestureId;5001 mPointerGesture.currentGestureProperties[0].id = mPointerGesture.activeGestureId;
5016 mPointerGesture.currentGestureProperties[0].toolType =5002 mPointerGesture.currentGestureProperties[0].toolType =
@@ -5030,16 +5016,16 @@
5030#endif5016#endif
5031 ALOG_ASSERT(mPointerGesture.activeGestureId >= 0);5017 ALOG_ASSERT(mPointerGesture.activeGestureId >= 0);
50325018
5033 mPointerGesture.currentGestureIdBits.clear();5019 mPointerGesture.currentGestureIds.clear();
50345020
5035 BitSet32 mappedTouchIdBits;5021 IntSet mappedTouchIds;
5036 BitSet32 usedGestureIdBits;5022 IntSet usedGestureIds;
5037 if (mPointerGesture.lastGestureMode != PointerGesture::FREEFORM) {5023 if (mPointerGesture.lastGestureMode != PointerGesture::FREEFORM) {
5038 // Initially, assign the active gesture id to the active touch point5024 // Initially, assign the active gesture id to the active touch point
5039 // if there is one. No other touch id bits are mapped yet.5025 // if there is one. No other touch id bits are mapped yet.
5040 if (!*outCancelPreviousGesture) {5026 if (!*outCancelPreviousGesture) {
5041 mappedTouchIdBits.markBit(activeTouchId);5027 mappedTouchIds.insert(activeTouchId);
5042 usedGestureIdBits.markBit(mPointerGesture.activeGestureId);5028 usedGestureIds.insert(mPointerGesture.activeGestureId);
5043 mPointerGesture.freeformTouchToGestureIdMap[activeTouchId] =5029 mPointerGesture.freeformTouchToGestureIdMap[activeTouchId] =
5044 mPointerGesture.activeGestureId;5030 mPointerGesture.activeGestureId;
5045 } else {5031 } else {
@@ -5048,38 +5034,41 @@
5048 } else {5034 } else {
5049 // Otherwise, assume we mapped all touches from the previous frame.5035 // Otherwise, assume we mapped all touches from the previous frame.
5050 // Reuse all mappings that are still applicable.5036 // Reuse all mappings that are still applicable.
5051 mappedTouchIdBits.value = mLastFingerIdBits.value5037 mappedTouchIds = mLastFingerIds & mCurrentFingerIds;
5052 & mCurrentFingerIdBits.value;5038 usedGestureIds = mPointerGesture.lastGestureIds;
5053 usedGestureIdBits = mPointerGesture.lastGestureIdBits;
50545039
5055 // Check whether we need to choose a new active gesture id because the5040 // Check whether we need to choose a new active gesture id because the
5056 // current went went up.5041 // current went went up.
5057 for (BitSet32 upTouchIdBits(mLastFingerIdBits.value5042 auto it = mLastFingerIds.cbegin();
5058 & ~mCurrentFingerIdBits.value);5043 while (it != mLastFingerIds.cend()) {
5059 !upTouchIdBits.isEmpty(); ) {5044 int32_t id = *it;
5060 uint32_t upTouchId = upTouchIdBits.clearFirstMarkedBit();5045 if (!mCurrentFingerIds.contains(id)) {
5061 uint32_t upGestureId = mPointerGesture.freeformTouchToGestureIdMap[upTouchId];5046 int32_t upGestureId = mPointerGesture.freeformTouchToGestureIdMap[id];
5062 if (upGestureId == uint32_t(mPointerGesture.activeGestureId)) {5047 if (upGestureId == mPointerGesture.activeGestureId) {
5063 mPointerGesture.activeGestureId = -1;5048 mPointerGesture.activeGestureId = -1;
5064 break;5049 break;
5050 }
5065 }5051 }
5052 it++;
5066 }5053 }
5067 }5054 }
50685055
5069#if DEBUG_GESTURES5056#if DEBUG_GESTURES
5070 ALOGD("Gestures: FREEFORM follow up "5057 {
5071 "mappedTouchIdBits=0x%08x, usedGestureIdBits=0x%08x, "5058 std::string mappedTouchIdsString = mappedTouchIdBits.toString();
5072 "activeGestureId=%d",5059 std::string usedGestureIdsString = usedGestureIdBits.toString();
5073 mappedTouchIdBits.value, usedGestureIdBits.value,5060 ALOGD("Gestures: FREEFORM follow up "
5074 mPointerGesture.activeGestureId);5061 "mappedTouchIds=%s, usedGestureIds=%s, "
5062 "activeGestureId=%d",
5063 mappedTouchIdsString.c_str(), usedGestureIdsString.c_str(),
5064 mPointerGesture.activeGestureId);
5065 }
5075#endif5066#endif
50765067 uint32_t i = 0;
5077 BitSet32 idBits(mCurrentFingerIdBits);5068 mCurrentFingerIds.forEach([&](int32_t touchId) {
5078 for (uint32_t i = 0; i < currentFingerCount; i++) {5069 int32_t gestureId;
5079 uint32_t touchId = idBits.clearFirstMarkedBit();5070 if (mappedTouchIds.contains(touchId)) {
5080 uint32_t gestureId;5071 gestureId = usedGestureIds.first();
5081 if (!mappedTouchIdBits.hasBit(touchId)) {
5082 gestureId = usedGestureIdBits.markFirstUnmarkedBit();
5083 mPointerGesture.freeformTouchToGestureIdMap[touchId] = gestureId;5072 mPointerGesture.freeformTouchToGestureIdMap[touchId] = gestureId;
5084#if DEBUG_GESTURES5073#if DEBUG_GESTURES
5085 ALOGD("Gestures: FREEFORM "5074 ALOGD("Gestures: FREEFORM "
@@ -5094,8 +5083,7 @@
5094 touchId, gestureId);5083 touchId, gestureId);
5095#endif5084#endif
5096 }5085 }
5097 mPointerGesture.currentGestureIdBits.markBit(gestureId);5086 mPointerGesture.currentGestureIds.insert(gestureId);
5098 mPointerGesture.currentGestureIdToIndex[gestureId] = i;
50995087
5100 const RawPointerData::Pointer& pointer =5088 const RawPointerData::Pointer& pointer =
5101 mCurrentRawPointerData.pointerForId(touchId);5089 mCurrentRawPointerData.pointerForId(touchId);
@@ -5116,11 +5104,12 @@
5116 AMOTION_EVENT_AXIS_Y, mPointerGesture.referenceGestureY + deltaY);5104 AMOTION_EVENT_AXIS_Y, mPointerGesture.referenceGestureY + deltaY);
5117 mPointerGesture.currentGestureCoords[i].setAxisValue(5105 mPointerGesture.currentGestureCoords[i].setAxisValue(
5118 AMOTION_EVENT_AXIS_PRESSURE, 1.0f);5106 AMOTION_EVENT_AXIS_PRESSURE, 1.0f);
5119 }5107
5108 ++i;
5109 });
51205110
5121 if (mPointerGesture.activeGestureId < 0) {5111 if (mPointerGesture.activeGestureId < 0) {
5122 mPointerGesture.activeGestureId =5112 mPointerGesture.activeGestureId = mPointerGesture.currentGestureIds.first();
5123 mPointerGesture.currentGestureIdBits.firstMarkedBit();
5124#if DEBUG_GESTURES5113#if DEBUG_GESTURES
5125 ALOGD("Gestures: FREEFORM new "5114 ALOGD("Gestures: FREEFORM new "
5126 "activeGestureId=%d", mPointerGesture.activeGestureId);5115 "activeGestureId=%d", mPointerGesture.activeGestureId);
@@ -5132,35 +5121,35 @@
5132 mPointerController->setButtonState(mCurrentButtonState);5121 mPointerController->setButtonState(mCurrentButtonState);
51335122
5134#if DEBUG_GESTURES5123#if DEBUG_GESTURES
5135 ALOGD("Gestures: finishPreviousGesture=%s, cancelPreviousGesture=%s, "5124 {
5136 "currentGestureMode=%d, currentGestureIdBits=0x%08x, "5125 std::string lastGestureIdsString = mPointerGesture.lastGestureIds.toString();
5137 "lastGestureMode=%d, lastGestureIdBits=0x%08x",5126
5138 toString(*outFinishPreviousGesture), toString(*outCancelPreviousGesture),5127 ALOGD("Gestures: finishPreviousGesture=%s, cancelPreviousGesture=%s, "
5139 mPointerGesture.currentGestureMode, mPointerGesture.currentGestureIdBits.value,5128 "currentGestureMode=%d, currentGestureIds.count()=%u, "
5140 mPointerGesture.lastGestureMode, mPointerGesture.lastGestureIdBits.value);5129 "lastGestureMode=%d, lastGestureIds=%s",
5141 for (BitSet32 idBits = mPointerGesture.currentGestureIdBits; !idBits.isEmpty(); ) {5130 toString(*outFinishPreviousGesture), toString(*outCancelPreviousGesture),
5142 uint32_t id = idBits.clearFirstMarkedBit();5131 mPointerGesture.currentGestureMode, mPointerGesture.currentGestureIds.count(),
5143 uint32_t index = mPointerGesture.currentGestureIdToIndex[id];5132 mPointerGesture.lastGestureMode, lastGestureIdsString.c_str());
5144 const PointerProperties& properties = mPointerGesture.currentGestureProperties[index];5133 for (uint32_t index = 0; index < mPointerGesture.currentGestureIds.count(); ++index) {
5145 const PointerCoords& coords = mPointerGesture.currentGestureCoords[index];5134 const PointerProperties& properties = mPointerGesture.currentGestureProperties[index];
5146 ALOGD(" currentGesture[%d]: index=%d, toolType=%d, "5135 const PointerCoords& coords = mPointerGesture.currentGestureCoords[index];
5147 "x=%0.3f, y=%0.3f, pressure=%0.3f",5136 ALOGD(" currentGesture[%d]: index=%d, toolType=%d, "
5148 id, index, properties.toolType,5137 "x=%0.3f, y=%0.3f, pressure=%0.3f",
5149 coords.getAxisValue(AMOTION_EVENT_AXIS_X),5138 id, index, properties.toolType,
5150 coords.getAxisValue(AMOTION_EVENT_AXIS_Y),5139 coords.getAxisValue(AMOTION_EVENT_AXIS_X),
5151 coords.getAxisValue(AMOTION_EVENT_AXIS_PRESSURE));5140 coords.getAxisValue(AMOTION_EVENT_AXIS_Y),
5152 }5141 coords.getAxisValue(AMOTION_EVENT_AXIS_PRESSURE));
5153 for (BitSet32 idBits = mPointerGesture.lastGestureIdBits; !idBits.isEmpty(); ) {5142 }
5154 uint32_t id = idBits.clearFirstMarkedBit();5143 for (uint32_t index = 0; index < mPointerGesture.lastGestureIds.count(); ++index) {
5155 uint32_t index = mPointerGesture.lastGestureIdToIndex[id];5144 const PointerProperties& properties = mPointerGesture.lastGestureProperties[index];
5156 const PointerProperties& properties = mPointerGesture.lastGestureProperties[index];5145 const PointerCoords& coords = mPointerGesture.lastGestureCoords[index];
5157 const PointerCoords& coords = mPointerGesture.lastGestureCoords[index];5146 ALOGD(" lastGesture[%d]: index=%d, toolType=%d, "
5158 ALOGD(" lastGesture[%d]: index=%d, toolType=%d, "5147 "x=%0.3f, y=%0.3f, pressure=%0.3f",
5159 "x=%0.3f, y=%0.3f, pressure=%0.3f",5148 id, index, properties.toolType,
5160 id, index, properties.toolType,5149 coords.getAxisValue(AMOTION_EVENT_AXIS_X),
5161 coords.getAxisValue(AMOTION_EVENT_AXIS_X),5150 coords.getAxisValue(AMOTION_EVENT_AXIS_Y),
5162 coords.getAxisValue(AMOTION_EVENT_AXIS_Y),5151 coords.getAxisValue(AMOTION_EVENT_AXIS_PRESSURE));
5163 coords.getAxisValue(AMOTION_EVENT_AXIS_PRESSURE));5152 }
5164 }5153 }
5165#endif5154#endif
5166 return true;5155 return true;
@@ -5171,14 +5160,14 @@
5171 mPointerSimple.currentProperties.clear();5160 mPointerSimple.currentProperties.clear();
51725161
5173 bool down, hovering;5162 bool down, hovering;
5174 if (!mCurrentStylusIdBits.isEmpty()) {5163 if (!mCurrentStylusIds.isEmpty()) {
5175 uint32_t id = mCurrentStylusIdBits.firstMarkedBit();5164 int32_t id = mCurrentStylusIds.first();
5176 uint32_t index = mCurrentCookedPointerData.idToIndex[id];5165 uint32_t index = mCurrentCookedPointerData.idToIndex(id);
5177 float x = mCurrentCookedPointerData.pointerCoords[index].getX();5166 float x = mCurrentCookedPointerData.pointerCoords[index].getX();
5178 float y = mCurrentCookedPointerData.pointerCoords[index].getY();5167 float y = mCurrentCookedPointerData.pointerCoords[index].getY();
5179 mPointerController->setPosition(x, y);5168 mPointerController->setPosition(x, y);
51805169
5181 hovering = mCurrentCookedPointerData.hoveringIdBits.hasBit(id);5170 hovering = mCurrentCookedPointerData.hoveringIds.contains(id);
5182 down = !hovering;5171 down = !hovering;
51835172
5184 mPointerController->getPosition(&x, &y);5173 mPointerController->getPosition(&x, &y);
@@ -5205,11 +5194,11 @@
5205 mPointerSimple.currentProperties.clear();5194 mPointerSimple.currentProperties.clear();
52065195
5207 bool down, hovering;5196 bool down, hovering;
5208 if (!mCurrentMouseIdBits.isEmpty()) {5197 if (!mCurrentMouseIds.isEmpty()) {
5209 uint32_t id = mCurrentMouseIdBits.firstMarkedBit();5198 uint32_t id = mCurrentMouseIds.first();
5210 uint32_t currentIndex = mCurrentRawPointerData.idToIndex[id];5199 uint32_t currentIndex = mCurrentRawPointerData.idToIndex(id);
5211 if (mLastMouseIdBits.hasBit(id)) {5200 if (mLastMouseIds.contains(id)) {
5212 uint32_t lastIndex = mCurrentRawPointerData.idToIndex[id];5201 uint32_t lastIndex = mCurrentRawPointerData.idToIndex(id);
5213 float deltaX = (mCurrentRawPointerData.pointers[currentIndex].x5202 float deltaX = (mCurrentRawPointerData.pointers[currentIndex].x
5214 - mLastRawPointerData.pointers[lastIndex].x)5203 - mLastRawPointerData.pointers[lastIndex].x)
5215 * mPointerXMovementScale;5204 * mPointerXMovementScale;
@@ -5377,19 +5366,17 @@
53775366
5378void TouchInputMapper::dispatchMotion(nsecs_t when, uint32_t policyFlags, uint32_t source,5367void TouchInputMapper::dispatchMotion(nsecs_t when, uint32_t policyFlags, uint32_t source,
5379 int32_t action, int32_t flags, int32_t metaState, int32_t buttonState, int32_t edgeFlags,5368 int32_t action, int32_t flags, int32_t metaState, int32_t buttonState, int32_t edgeFlags,
5380 const PointerProperties* properties, const PointerCoords* coords,5369 const PointerProperties* properties, const PointerCoords* coords, uint32_t inPointerCount,
5381 const uint32_t* idToIndex, BitSet32 idBits,
5382 int32_t changedId, float xPrecision, float yPrecision, nsecs_t downTime) {5370 int32_t changedId, float xPrecision, float yPrecision, nsecs_t downTime) {
5383 PointerCoords pointerCoords[MAX_POINTERS];5371 PointerCoords pointerCoords[MAX_POINTERS];
5384 PointerProperties pointerProperties[MAX_POINTERS];5372 PointerProperties pointerProperties[MAX_POINTERS];
5385 uint32_t pointerCount = 0;5373 uint32_t pointerCount = 0;
5386 while (!idBits.isEmpty()) {5374
5387 uint32_t id = idBits.clearFirstMarkedBit();5375 while (pointerCount < inPointerCount) {
5388 uint32_t index = idToIndex[id];5376 pointerProperties[pointerCount].copyFrom(properties[pointerCount]);
5389 pointerProperties[pointerCount].copyFrom(properties[index]);5377 pointerCoords[pointerCount].copyFrom(coords[pointerCount]);
5390 pointerCoords[pointerCount].copyFrom(coords[index]);5378
53915379 if (changedId >= 0 && properties[pointerCount].id == uint32_t(changedId)) {
5392 if (changedId >= 0 && id == uint32_t(changedId)) {
5393 action |= pointerCount << AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT;5380 action |= pointerCount << AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT;
5394 }5381 }
53955382
@@ -5418,31 +5405,94 @@
5418 getListener()->notifyMotion(&args);5405 getListener()->notifyMotion(&args);
5419}5406}
54205407
5408void TouchInputMapper::dispatchMotion(nsecs_t when, uint32_t policyFlags, uint32_t source,
5409 int32_t action, int32_t flags, int32_t metaState, int32_t buttonState, int32_t edgeFlags,
5410 const PointerProperties* properties, const PointerCoords* coords,
5411 uint32_t inPointerCount, const IntSet &idsToDispatch,
5412 int32_t changedId, float xPrecision, float yPrecision, nsecs_t downTime) {
5413 PointerCoords pointerCoords[MAX_POINTERS];
5414 PointerProperties pointerProperties[MAX_POINTERS];
5415 uint32_t pointerCount = 0;
5416
5417 for (uint32_t i = 0; i < inPointerCount && pointerCount < idsToDispatch.size(); ++i) {
5418 if (!idsToDispatch.contains(properties[i].id))
5419 continue;
5420
5421 pointerProperties[pointerCount].copyFrom(properties[i]);
5422 pointerCoords[pointerCount].copyFrom(coords[i]);
5423
5424 if (changedId >= 0 && properties[i].id == uint32_t(changedId)) {
5425 action |= i << AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT;
5426 }
5427
5428 pointerCount += 1;
5429 }
5430
5431 ALOG_ASSERT(pointerCount != 0);
5432
5433 if (changedId >= 0 && pointerCount == 1) {
5434 // Remove the poiter index part
5435 int actionPart = action & AMOTION_EVENT_ACTION_MASK;
5436
5437 // Replace initial down and final up action.
5438 // We can compare the action without masking off the changed pointer index
5439 // because we know the index is 0.
5440 if (actionPart == AMOTION_EVENT_ACTION_POINTER_DOWN) {
5441 actionPart = AMOTION_EVENT_ACTION_DOWN;
5442 } else if (actionPart & AMOTION_EVENT_ACTION_POINTER_UP) {
5443 actionPart = AMOTION_EVENT_ACTION_UP;
5444 } else {
5445 // Can't happen.
5446 ALOG_ASSERT(false);
5447 }
5448
5449 // And put it back into the action integer
5450 action = (action & AMOTION_EVENT_ACTION_POINTER_INDEX_MASK) | actionPart;
5451 }
5452
5453 NotifyMotionArgs args(when, getDeviceId(), source, policyFlags,
5454 action, flags, metaState, buttonState, edgeFlags,
5455 pointerCount, pointerProperties, pointerCoords, xPrecision, yPrecision, downTime);
5456 getListener()->notifyMotion(&args);
5457}
5458
5421bool TouchInputMapper::updateMovedPointers(const PointerProperties* inProperties,5459bool TouchInputMapper::updateMovedPointers(const PointerProperties* inProperties,
5422 const PointerCoords* inCoords, const uint32_t* inIdToIndex,5460 const PointerCoords* inCoords, uint32_t inPointerCount,
5423 PointerProperties* outProperties, PointerCoords* outCoords, const uint32_t* outIdToIndex,5461 PointerProperties* outProperties, PointerCoords* outCoords, uint32_t outPointerCount,
5424 BitSet32 idBits) const {5462 const IntSet &commonTouchingIds) const {
5425 bool changed = false;5463 bool changed = false;
5426 while (!idBits.isEmpty()) {5464
5427 uint32_t id = idBits.clearFirstMarkedBit();5465 if (commonTouchingIds.isEmpty()) {
5428 uint32_t inIndex = inIdToIndex[id];5466 return changed;
5429 uint32_t outIndex = outIdToIndex[id];5467 }
54305468
5431 const PointerProperties& curInProperties = inProperties[inIndex];5469 for (uint32_t inIndex = 0; inIndex < inPointerCount; ++inIndex) {
5432 const PointerCoords& curInCoords = inCoords[inIndex];5470 int32_t inId = inProperties[inIndex].id;
5433 PointerProperties& curOutProperties = outProperties[outIndex];5471 if (!commonTouchingIds.contains(inId)) {
5434 PointerCoords& curOutCoords = outCoords[outIndex];5472 continue;
54355473 }
5436 if (curInProperties != curOutProperties) {5474 for (uint32_t outIndex = 0; outIndex < outPointerCount; ++outIndex) {
5437 curOutProperties.copyFrom(curInProperties);5475 int32_t outId = outProperties[outIndex].id;
5438 changed = true;5476 if (inId == outId) {
5439 }5477 // The pointer is present in both sets. Let's see if it has moved.
54405478 const PointerProperties& curInProperties = inProperties[inIndex];
5441 if (curInCoords != curOutCoords) {5479 const PointerCoords& curInCoords = inCoords[inIndex];
5442 curOutCoords.copyFrom(curInCoords);5480 PointerProperties& curOutProperties = outProperties[outIndex];
5443 changed = true;5481 PointerCoords& curOutCoords = outCoords[outIndex];
5444 }5482
5445 }5483 if (curInProperties != curOutProperties) {
5484 curOutProperties.copyFrom(curInProperties);
5485 changed = true;
5486 }
5487
5488 if (curInCoords != curOutCoords) {
5489 curOutCoords.copyFrom(curInCoords);
5490 changed = true;
5491 }
5492 }
5493 }
5494 }
5495
5446 return changed;5496 return changed;
5447}5497}
54485498
@@ -5484,7 +5534,7 @@
5484 uint32_t currentPointerCount = mCurrentRawPointerData.pointerCount;5534 uint32_t currentPointerCount = mCurrentRawPointerData.pointerCount;
5485 uint32_t lastPointerCount = mLastRawPointerData.pointerCount;5535 uint32_t lastPointerCount = mLastRawPointerData.pointerCount;
54865536
5487 mCurrentRawPointerData.clearIdBits();5537 mCurrentRawPointerData.clearIds();
54885538
5489 if (currentPointerCount == 0) {5539 if (currentPointerCount == 0) {
5490 // No pointers to assign.5540 // No pointers to assign.
@@ -5494,10 +5544,9 @@
5494 if (lastPointerCount == 0) {5544 if (lastPointerCount == 0) {
5495 // All pointers are new.5545 // All pointers are new.
5496 for (uint32_t i = 0; i < currentPointerCount; i++) {5546 for (uint32_t i = 0; i < currentPointerCount; i++) {
5497 uint32_t id = i;5547 int32_t id = fetchNewPointerId();
5498 mCurrentRawPointerData.pointers[i].id = id;5548 mCurrentRawPointerData.pointers[i].id = id;
5499 mCurrentRawPointerData.idToIndex[id] = i;5549 mCurrentRawPointerData.insertId(id, mCurrentRawPointerData.isHovering(i));
5500 mCurrentRawPointerData.markIdBit(id, mCurrentRawPointerData.isHovering(i));
5501 }5550 }
5502 return;5551 return;
5503 }5552 }
@@ -5506,10 +5555,9 @@
5506 && mCurrentRawPointerData.pointers[0].toolType5555 && mCurrentRawPointerData.pointers[0].toolType
5507 == mLastRawPointerData.pointers[0].toolType) {5556 == mLastRawPointerData.pointers[0].toolType) {
5508 // Only one pointer and no change in count so it must have the same id as before.5557 // Only one pointer and no change in count so it must have the same id as before.
5509 uint32_t id = mLastRawPointerData.pointers[0].id;5558 int32_t id = mLastRawPointerData.pointers[0].id;
5510 mCurrentRawPointerData.pointers[0].id = id;5559 mCurrentRawPointerData.pointers[0].id = id;
5511 mCurrentRawPointerData.idToIndex[id] = 0;5560 mCurrentRawPointerData.insertId(id, mCurrentRawPointerData.isHovering(0));
5512 mCurrentRawPointerData.markIdBit(id, mCurrentRawPointerData.isHovering(0));
5513 return;5561 return;
5514 }5562 }
55155563
@@ -5569,9 +5617,9 @@
5569 }5617 }
55705618
5571#if DEBUG_POINTER_ASSIGNMENT5619#if DEBUG_POINTER_ASSIGNMENT
5572 ALOGD("assignPointerIds - initial distance min-heap: size=%d", heapSize);5620 ALOGD("assignPointerIds - initial distance min-heap: size=%u", heapSize);
5573 for (size_t i = 0; i < heapSize; i++) {5621 for (size_t i = 0; i < heapSize; i++) {
5574 ALOGD(" heap[%d]: cur=%d, last=%d, distance=%lld",5622 ALOGD(" heap[%d]: cur=%u, last=%u, distance=%llu",
5575 i, heap[i].currentPointerIndex, heap[i].lastPointerIndex,5623 i, heap[i].currentPointerIndex, heap[i].lastPointerIndex,
5576 heap[i].distance);5624 heap[i].distance);
5577 }5625 }
@@ -5580,10 +5628,8 @@
5580 // Pull matches out by increasing order of distance.5628 // Pull matches out by increasing order of distance.
5581 // To avoid reassigning pointers that have already been matched, the loop keeps track5629 // To avoid reassigning pointers that have already been matched, the loop keeps track
5582 // of which last and current pointers have been matched using the matchedXXXBits variables.5630 // of which last and current pointers have been matched using the matchedXXXBits variables.
5583 // It also tracks the used pointer id bits.
5584 BitSet32 matchedLastBits(0);5631 BitSet32 matchedLastBits(0);
5585 BitSet32 matchedCurrentBits(0);5632 BitSet32 matchedCurrentBits(0);
5586 BitSet32 usedIdBits(0);
5587 bool first = true;5633 bool first = true;
5588 for (uint32_t i = min(currentPointerCount, lastPointerCount); heapSize > 0 && i > 0; i--) {5634 for (uint32_t i = min(currentPointerCount, lastPointerCount); heapSize > 0 && i > 0; i--) {
5589 while (heapSize > 0) {5635 while (heapSize > 0) {
@@ -5635,12 +5681,9 @@
5635 matchedCurrentBits.markBit(currentPointerIndex);5681 matchedCurrentBits.markBit(currentPointerIndex);
5636 matchedLastBits.markBit(lastPointerIndex);5682 matchedLastBits.markBit(lastPointerIndex);
56375683
5638 uint32_t id = mLastRawPointerData.pointers[lastPointerIndex].id;5684 int32_t id = mLastRawPointerData.pointers[lastPointerIndex].id;
5639 mCurrentRawPointerData.pointers[currentPointerIndex].id = id;5685 mCurrentRawPointerData.pointers[currentPointerIndex].id = id;
5640 mCurrentRawPointerData.idToIndex[id] = currentPointerIndex;5686 mCurrentRawPointerData.insertId(id, mCurrentRawPointerData.isHovering(currentPointerIndex));
5641 mCurrentRawPointerData.markIdBit(id,
5642 mCurrentRawPointerData.isHovering(currentPointerIndex));
5643 usedIdBits.markBit(id);
56445687
5645#if DEBUG_POINTER_ASSIGNMENT5688#if DEBUG_POINTER_ASSIGNMENT
5646 ALOGD("assignPointerIds - matched: cur=%d, last=%d, id=%d, distance=%lld",5689 ALOGD("assignPointerIds - matched: cur=%d, last=%d, id=%d, distance=%lld",
@@ -5653,11 +5696,10 @@
5653 // Assign fresh ids to pointers that were not matched in the process.5696 // Assign fresh ids to pointers that were not matched in the process.
5654 for (uint32_t i = currentPointerCount - matchedCurrentBits.count(); i != 0; i--) {5697 for (uint32_t i = currentPointerCount - matchedCurrentBits.count(); i != 0; i--) {
5655 uint32_t currentPointerIndex = matchedCurrentBits.markFirstUnmarkedBit();5698 uint32_t currentPointerIndex = matchedCurrentBits.markFirstUnmarkedBit();
5656 uint32_t id = usedIdBits.markFirstUnmarkedBit();5699 int32_t id = fetchNewPointerId();
56575700
5658 mCurrentRawPointerData.pointers[currentPointerIndex].id = id;5701 mCurrentRawPointerData.pointers[currentPointerIndex].id = id;
5659 mCurrentRawPointerData.idToIndex[id] = currentPointerIndex;5702 mCurrentRawPointerData.insertId(id,
5660 mCurrentRawPointerData.markIdBit(id,
5661 mCurrentRawPointerData.isHovering(currentPointerIndex));5703 mCurrentRawPointerData.isHovering(currentPointerIndex));
56625704
5663#if DEBUG_POINTER_ASSIGNMENT5705#if DEBUG_POINTER_ASSIGNMENT
@@ -5667,6 +5709,14 @@
5667 }5709 }
5668}5710}
56695711
5712int32_t TouchInputMapper::fetchNewPointerId() {
5713 int32_t id = mNextNewPointerId++;
5714 if (mNextNewPointerId > MAX_POINTER_ID) {
5715 mNextNewPointerId = 0;
5716 }
5717 return id;
5718}
5719
5670int32_t TouchInputMapper::getKeyCodeState(uint32_t sourceMask, int32_t keyCode) {5720int32_t TouchInputMapper::getKeyCodeState(uint32_t sourceMask, int32_t keyCode) {
5671 if (mCurrentVirtualKey.down && mCurrentVirtualKey.keyCode == keyCode) {5721 if (mCurrentVirtualKey.down && mCurrentVirtualKey.keyCode == keyCode) {
5672 return AKEY_STATE_VIRTUAL;5722 return AKEY_STATE_VIRTUAL;
@@ -5740,16 +5790,21 @@
5740void SingleTouchInputMapper::syncTouch(nsecs_t when, bool* outHavePointerIds) {5790void SingleTouchInputMapper::syncTouch(nsecs_t when, bool* outHavePointerIds) {
5741 if (mTouchButtonAccumulator.isToolActive()) {5791 if (mTouchButtonAccumulator.isToolActive()) {
5742 mCurrentRawPointerData.pointerCount = 1;5792 mCurrentRawPointerData.pointerCount = 1;
5743 mCurrentRawPointerData.idToIndex[0] = 0;
57445793
5745 bool isHovering = mTouchButtonAccumulator.getToolType() != AMOTION_EVENT_TOOL_TYPE_MOUSE5794 bool isHovering = mTouchButtonAccumulator.getToolType() != AMOTION_EVENT_TOOL_TYPE_MOUSE
5746 && (mTouchButtonAccumulator.isHovering()5795 && (mTouchButtonAccumulator.isHovering()
5747 || (mRawPointerAxes.pressure.valid5796 || (mRawPointerAxes.pressure.valid
5748 && mSingleTouchMotionAccumulator.getAbsolutePressure() <= 0));5797 && mSingleTouchMotionAccumulator.getAbsolutePressure() <= 0));
5749 mCurrentRawPointerData.markIdBit(0, isHovering);
57505798
5751 RawPointerData::Pointer& outPointer = mCurrentRawPointerData.pointers[0];5799 RawPointerData::Pointer& outPointer = mCurrentRawPointerData.pointers[0];
5752 outPointer.id = 0;5800
5801 if (mLastRawPointerData.pointerCount == 1) {
5802 outPointer.id = mLastRawPointerData.pointers[0].id;
5803 mCurrentRawPointerData.insertId(outPointer.id, isHovering);
5804 } else {
5805 outPointer.id = -1;
5806 *outHavePointerIds = false;
5807 }
5753 outPointer.x = mSingleTouchMotionAccumulator.getAbsoluteX();5808 outPointer.x = mSingleTouchMotionAccumulator.getAbsoluteX();
5754 outPointer.y = mSingleTouchMotionAccumulator.getAbsoluteY();5809 outPointer.y = mSingleTouchMotionAccumulator.getAbsoluteY();
5755 outPointer.pressure = mSingleTouchMotionAccumulator.getAbsolutePressure();5810 outPointer.pressure = mSingleTouchMotionAccumulator.getAbsolutePressure();
@@ -5766,6 +5821,7 @@
5766 outPointer.toolType = AMOTION_EVENT_TOOL_TYPE_FINGER;5821 outPointer.toolType = AMOTION_EVENT_TOOL_TYPE_FINGER;
5767 }5822 }
5768 outPointer.isHovering = isHovering;5823 outPointer.isHovering = isHovering;
5824
5769 }5825 }
5770}5826}
57715827
@@ -5798,7 +5854,7 @@
5798void MultiTouchInputMapper::reset(nsecs_t when) {5854void MultiTouchInputMapper::reset(nsecs_t when) {
5799 mMultiTouchMotionAccumulator.reset(getDevice());5855 mMultiTouchMotionAccumulator.reset(getDevice());
58005856
5801 mPointerIdBits.clear();5857 mPointerIds.clear();
58025858
5803 TouchInputMapper::reset(when);5859 TouchInputMapper::reset(when);
5804}5860}
@@ -5812,7 +5868,7 @@
5812void MultiTouchInputMapper::syncTouch(nsecs_t when, bool* outHavePointerIds) {5868void MultiTouchInputMapper::syncTouch(nsecs_t when, bool* outHavePointerIds) {
5813 size_t inCount = mMultiTouchMotionAccumulator.getSlotCount();5869 size_t inCount = mMultiTouchMotionAccumulator.getSlotCount();
5814 size_t outCount = 0;5870 size_t outCount = 0;
5815 BitSet32 newPointerIdBits;5871 IntSet newPointerIds;
58165872
5817 for (size_t inIndex = 0; inIndex < inCount; inIndex++) {5873 for (size_t inIndex = 0; inIndex < inCount; inIndex++) {
5818 const MultiTouchMotionAccumulator::Slot* inSlot =5874 const MultiTouchMotionAccumulator::Slot* inSlot =
@@ -5861,27 +5917,26 @@
5861 int32_t trackingId = inSlot->getTrackingId();5917 int32_t trackingId = inSlot->getTrackingId();
5862 int32_t id = -1;5918 int32_t id = -1;
5863 if (trackingId >= 0) {5919 if (trackingId >= 0) {
5864 for (BitSet32 idBits(mPointerIdBits); !idBits.isEmpty(); ) {5920 mPointerIds.forEach([&](int32_t n) {
5865 uint32_t n = idBits.clearFirstMarkedBit();
5866 if (mPointerTrackingIdMap[n] == trackingId) {5921 if (mPointerTrackingIdMap[n] == trackingId) {
5867 id = n;5922 id = n;
5868 }5923 }
5869 }5924 });
58705925
5871 if (id < 0 && !mPointerIdBits.isFull()) {5926 if (id < 0) {
5872 id = mPointerIdBits.markFirstUnmarkedBit();5927 id = fetchNewPointerId();
5928 mPointerIds.insert(id);
5873 mPointerTrackingIdMap[id] = trackingId;5929 mPointerTrackingIdMap[id] = trackingId;
5874 }5930 }
5875 }5931 }
5876 if (id < 0) {5932 if (id < 0) {
5877 *outHavePointerIds = false;5933 *outHavePointerIds = false;
5878 mCurrentRawPointerData.clearIdBits();5934 mCurrentRawPointerData.clearIds();
5879 newPointerIdBits.clear();5935 newPointerIds.clear();
5880 } else {5936 } else {
5881 outPointer.id = id;5937 outPointer.id = id;
5882 mCurrentRawPointerData.idToIndex[id] = outCount;5938 mCurrentRawPointerData.insertId(id, isHovering);
5883 mCurrentRawPointerData.markIdBit(id, isHovering);5939 newPointerIds.insert(id);
5884 newPointerIdBits.markBit(id);
5885 }5940 }
5886 }5941 }
58875942
@@ -5889,7 +5944,7 @@
5889 }5944 }
58905945
5891 mCurrentRawPointerData.pointerCount = outCount;5946 mCurrentRawPointerData.pointerCount = outCount;
5892 mPointerIdBits = newPointerIdBits;5947 mPointerIds = newPointerIds;
58935948
5894 mMultiTouchMotionAccumulator.finishSync();5949 mMultiTouchMotionAccumulator.finishSync();
5895}5950}
@@ -5914,8 +5969,8 @@
5914 && mRawPointerAxes.slot.minValue == 0 && mRawPointerAxes.slot.maxValue > 0) {5969 && mRawPointerAxes.slot.minValue == 0 && mRawPointerAxes.slot.maxValue > 0) {
5915 size_t slotCount = mRawPointerAxes.slot.maxValue + 1;5970 size_t slotCount = mRawPointerAxes.slot.maxValue + 1;
5916 if (slotCount > MAX_SLOTS) {5971 if (slotCount > MAX_SLOTS) {
5917 ALOGW("MultiTouch Device %s reported %d slots but the framework "5972 ALOGW("MultiTouch Device %s reported %lu slots but the framework "
5918 "only supports a maximum of %d slots at this time.",5973 "only supports a maximum of %lu slots at this time.",
5919 c_str(getDeviceName()), slotCount, MAX_SLOTS);5974 c_str(getDeviceName()), slotCount, MAX_SLOTS);
5920 slotCount = MAX_SLOTS;5975 slotCount = MAX_SLOTS;
5921 }5976 }
@@ -6057,7 +6112,7 @@
6057 // If there are too many axes, start dropping them.6112 // If there are too many axes, start dropping them.
6058 // Prefer to keep explicitly mapped axes.6113 // Prefer to keep explicitly mapped axes.
6059 if (mAxes.size() > PointerCoords::MAX_AXES) {6114 if (mAxes.size() > PointerCoords::MAX_AXES) {
6060 ALOGI("Joystick '%s' has %d axes but the framework only supports a maximum of %d.",6115 ALOGI("Joystick '%s' has %lu axes but the framework only supports a maximum of %d.",
6061 c_str(getDeviceName()), mAxes.size(), PointerCoords::MAX_AXES);6116 c_str(getDeviceName()), mAxes.size(), PointerCoords::MAX_AXES);
6062 pruneAxes(true);6117 pruneAxes(true);
6063 pruneAxes(false);6118 pruneAxes(false);
60646119
=== modified file '3rd_party/android-input/android/frameworks/base/services/input/InputReader.h'
--- 3rd_party/android-input/android/frameworks/base/services/input/InputReader.h 2013-09-20 12:18:12 +0000
+++ 3rd_party/android-input/android/frameworks/base/services/input/InputReader.h 2013-11-21 20:19:28 +0000
@@ -22,6 +22,7 @@
22#include "InputListener.h"22#include "InputListener.h"
2323
24#include <androidfw/Input.h>24#include <androidfw/Input.h>
25#include <androidfw/IntSet.h>
25#include <androidfw/VelocityControl.h>26#include <androidfw/VelocityControl.h>
26#include <androidfw/VelocityTracker.h>27#include <androidfw/VelocityTracker.h>
27#include <std/KeyedVector.h>28#include <std/KeyedVector.h>
@@ -30,12 +31,14 @@
30#include <std/Timers.h>31#include <std/Timers.h>
31#include <std/RefBase.h>32#include <std/RefBase.h>
32#include <std/String8.h>33#include <std/String8.h>
33#include <std/BitSet.h>
3434
35#include <limits.h>35#include <limits.h>
36#include <stddef.h>36#include <stddef.h>
37#include <unistd.h>37#include <unistd.h>
3838
39// C++ std lib
40#include <unordered_map>
41
39// Maximum supported size of a vibration pattern.42// Maximum supported size of a vibration pattern.
40// Must be at least 2.43// Must be at least 2.
41#define MAX_VIBRATE_PATTERN_SIZE 10044#define MAX_VIBRATE_PATTERN_SIZE 100
@@ -678,7 +681,7 @@
678/* Raw data for a collection of pointers including a pointer id mapping table. */681/* Raw data for a collection of pointers including a pointer id mapping table. */
679struct RawPointerData {682struct RawPointerData {
680 struct Pointer {683 struct Pointer {
681 uint32_t id;684 int32_t id;
682 int32_t x;685 int32_t x;
683 int32_t y;686 int32_t y;
684 int32_t pressure;687 int32_t pressure;
@@ -696,29 +699,40 @@
696699
697 uint32_t pointerCount;700 uint32_t pointerCount;
698 Pointer pointers[MAX_POINTERS];701 Pointer pointers[MAX_POINTERS];
699 BitSet32 hoveringIdBits, touchingIdBits;702 IntSet hoveringIds, touchingIds;
700 uint32_t idToIndex[MAX_POINTER_ID + 1];703
704 uint32_t idToIndex(int32_t id) const {
705 uint32_t i = 0;
706
707 while (pointers[i].id != id && i < pointerCount) {
708 ++i;
709 }
710
711 assert(pointers[i].id == id);
712 return i;
713 }
714
701715
702 RawPointerData();716 RawPointerData();
703 void clear();717 void clear();
704 void copyFrom(const RawPointerData& other);718 void copyFrom(const RawPointerData& other);
705 void getCentroidOfTouchingPointers(float* outX, float* outY) const;719 void getCentroidOfTouchingPointers(float* outX, float* outY) const;
706720
707 inline void markIdBit(uint32_t id, bool isHovering) {721 inline void insertId(int32_t id, bool isHovering) {
708 if (isHovering) {722 if (isHovering) {
709 hoveringIdBits.markBit(id);723 hoveringIds.insert(id);
710 } else {724 } else {
711 touchingIdBits.markBit(id);725 touchingIds.insert(id);
712 }726 }
713 }727 }
714728
715 inline void clearIdBits() {729 inline void clearIds() {
716 hoveringIdBits.clear();730 hoveringIds.clear();
717 touchingIdBits.clear();731 touchingIds.clear();
718 }732 }
719733
720 inline const Pointer& pointerForId(uint32_t id) const {734 inline const Pointer& pointerForId(int32_t id) const {
721 return pointers[idToIndex[id]];735 return pointers[idToIndex(id)];
722 }736 }
723737
724 inline bool isHovering(uint32_t pointerIndex) {738 inline bool isHovering(uint32_t pointerIndex) {
@@ -732,15 +746,22 @@
732 uint32_t pointerCount;746 uint32_t pointerCount;
733 PointerProperties pointerProperties[MAX_POINTERS];747 PointerProperties pointerProperties[MAX_POINTERS];
734 PointerCoords pointerCoords[MAX_POINTERS];748 PointerCoords pointerCoords[MAX_POINTERS];
735 BitSet32 hoveringIdBits, touchingIdBits;749 IntSet hoveringIds, touchingIds;
736 uint32_t idToIndex[MAX_POINTER_ID + 1];750 uint32_t idToIndex(int32_t id) const {
751 uint32_t i = 0;
752
753 while (pointerProperties[i].id != id && i < pointerCount) { ++i; }
754
755 assert(pointerProperties[i].id == id);
756 return i;
757 }
737758
738 CookedPointerData();759 CookedPointerData();
739 void clear();760 void clear();
740 void copyFrom(const CookedPointerData& other);761 void copyFrom(const CookedPointerData& other);
741762
742 inline bool isHovering(uint32_t pointerIndex) {763 inline bool isHovering(uint32_t pointerIndex) {
743 return hoveringIdBits.hasBit(pointerProperties[pointerIndex].id);764 return hoveringIds.contains(pointerProperties[pointerIndex].id);
744 }765 }
745};766};
746767
@@ -1233,13 +1254,13 @@
1233 int32_t mCurrentRawVScroll;1254 int32_t mCurrentRawVScroll;
1234 int32_t mCurrentRawHScroll;1255 int32_t mCurrentRawHScroll;
12351256
1236 // Id bits used to differentiate fingers, stylus and mouse tools.1257 // Id sets used to differentiate fingers, stylus and mouse tools.
1237 BitSet32 mCurrentFingerIdBits; // finger or unknown1258 IntSet mCurrentFingerIds; // finger or unknown
1238 BitSet32 mLastFingerIdBits;1259 IntSet mLastFingerIds;
1239 BitSet32 mCurrentStylusIdBits; // stylus or eraser1260 IntSet mCurrentStylusIds; // stylus or eraser
1240 BitSet32 mLastStylusIdBits;1261 IntSet mLastStylusIds;
1241 BitSet32 mCurrentMouseIdBits; // mouse or lens1262 IntSet mCurrentMouseIds; // mouse or lens
1242 BitSet32 mLastMouseIdBits;1263 IntSet mLastMouseIds;
12431264
1244 // True if we sent a HOVER_ENTER event.1265 // True if we sent a HOVER_ENTER event.
1245 bool mSentHoverEnter;1266 bool mSentHoverEnter;
@@ -1266,6 +1287,7 @@
1266 virtual bool hasStylus() const = 0;1287 virtual bool hasStylus() const = 0;
12671288
1268 virtual void syncTouch(nsecs_t when, bool* outHavePointerIds) = 0;1289 virtual void syncTouch(nsecs_t when, bool* outHavePointerIds) = 0;
1290 int32_t fetchNewPointerId();
12691291
1270private:1292private:
1271 // The surface orientation and width and height set by configureSurface().1293 // The surface orientation and width and height set by configureSurface().
@@ -1445,14 +1467,14 @@
14451467
1446 // Pointer coords and ids for the current and previous pointer gesture.1468 // Pointer coords and ids for the current and previous pointer gesture.
1447 Mode currentGestureMode;1469 Mode currentGestureMode;
1448 BitSet32 currentGestureIdBits;1470 IntSet currentGestureIds;
1449 uint32_t currentGestureIdToIndex[MAX_POINTER_ID + 1];1471 std::unordered_map<int32_t, uint32_t> currentGestureIdToIndex;
1450 PointerProperties currentGestureProperties[MAX_POINTERS];1472 PointerProperties currentGestureProperties[MAX_POINTERS];
1451 PointerCoords currentGestureCoords[MAX_POINTERS];1473 PointerCoords currentGestureCoords[MAX_POINTERS];
14521474
1453 Mode lastGestureMode;1475 Mode lastGestureMode;
1454 BitSet32 lastGestureIdBits;1476 IntSet lastGestureIds;
1455 uint32_t lastGestureIdToIndex[MAX_POINTER_ID + 1];1477 std::unordered_map<int32_t, uint32_t> lastGestureIdToIndex;
1456 PointerProperties lastGestureProperties[MAX_POINTERS];1478 PointerProperties lastGestureProperties[MAX_POINTERS];
1457 PointerCoords lastGestureCoords[MAX_POINTERS];1479 PointerCoords lastGestureCoords[MAX_POINTERS];
14581480
@@ -1479,14 +1501,14 @@
14791501
1480 // Distance that each pointer has traveled which has not yet been1502 // Distance that each pointer has traveled which has not yet been
1481 // subsumed into the reference gesture position.1503 // subsumed into the reference gesture position.
1482 BitSet32 referenceIdBits;1504 IntSet referenceIds;
1483 struct Delta {1505 struct Delta {
1484 float dx, dy;1506 float dx, dy;
1485 };1507 };
1486 Delta referenceDeltas[MAX_POINTER_ID + 1];1508 std::unordered_map<int32_t, Delta> referenceDeltas;
14871509
1488 // Describes how touch ids are mapped to gesture ids for freeform gestures.1510 // Describes how touch ids are mapped to gesture ids for freeform gestures.
1489 uint32_t freeformTouchToGestureIdMap[MAX_POINTER_ID + 1];1511 std::unordered_map<int32_t, int32_t> freeformTouchToGestureIdMap;
14901512
1491 // A velocity tracker for determining whether to switch active pointers during drags.1513 // A velocity tracker for determining whether to switch active pointers during drags.
1492 VelocityTracker velocityTracker;1514 VelocityTracker velocityTracker;
@@ -1496,9 +1518,9 @@
1496 activeTouchId = -1;1518 activeTouchId = -1;
1497 activeGestureId = -1;1519 activeGestureId = -1;
1498 currentGestureMode = NEUTRAL;1520 currentGestureMode = NEUTRAL;
1499 currentGestureIdBits.clear();1521 currentGestureIds.clear();
1500 lastGestureMode = NEUTRAL;1522 lastGestureMode = NEUTRAL;
1501 lastGestureIdBits.clear();1523 lastGestureIds.clear();
1502 downTime = 0;1524 downTime = 0;
1503 velocityTracker.clear();1525 velocityTracker.clear();
1504 resetTap();1526 resetTap();
@@ -1584,20 +1606,26 @@
1584 int32_t action, int32_t flags, int32_t metaState, int32_t buttonState,1606 int32_t action, int32_t flags, int32_t metaState, int32_t buttonState,
1585 int32_t edgeFlags,1607 int32_t edgeFlags,
1586 const PointerProperties* properties, const PointerCoords* coords,1608 const PointerProperties* properties, const PointerCoords* coords,
1587 const uint32_t* idToIndex, BitSet32 idBits,1609 uint32_t inPointerCount,
1610 int32_t changedId, float xPrecision, float yPrecision, nsecs_t downTime);
1611 void dispatchMotion(nsecs_t when, uint32_t policyFlags, uint32_t source,
1612 int32_t action, int32_t flags, int32_t metaState, int32_t buttonState,
1613 int32_t edgeFlags,
1614 const PointerProperties* properties, const PointerCoords* coords,
1615 uint32_t inPointerCount, const IntSet &idsToDispatch,
1588 int32_t changedId, float xPrecision, float yPrecision, nsecs_t downTime);1616 int32_t changedId, float xPrecision, float yPrecision, nsecs_t downTime);
15891617
1590 // Updates pointer coords and properties for pointers with specified ids that have moved.1618 // Updates pointer coords and properties for pointers that have moved.
1591 // Returns true if any of them changed.1619 // Returns true if any of them changed.
1592 bool updateMovedPointers(const PointerProperties* inProperties,1620 bool updateMovedPointers(const PointerProperties* inProperties, const PointerCoords* inCoords,
1593 const PointerCoords* inCoords, const uint32_t* inIdToIndex,1621 uint32_t inPointerCount, PointerProperties* outProperties, PointerCoords* outCoords,
1594 PointerProperties* outProperties, PointerCoords* outCoords,1622 uint32_t outPointerCount, const IntSet &commonTouchingIds) const;
1595 const uint32_t* outIdToIndex, BitSet32 idBits) const;
15961623
1597 bool isPointInsideSurface(int32_t x, int32_t y);1624 bool isPointInsideSurface(int32_t x, int32_t y);
1598 const VirtualKey* findVirtualKeyHit(int32_t x, int32_t y);1625 const VirtualKey* findVirtualKeyHit(int32_t x, int32_t y);
15991626
1600 void assignPointerIds();1627 void assignPointerIds();
1628 int32_t mNextNewPointerId;
1601};1629};
16021630
16031631
@@ -1635,9 +1663,9 @@
1635private:1663private:
1636 MultiTouchMotionAccumulator mMultiTouchMotionAccumulator;1664 MultiTouchMotionAccumulator mMultiTouchMotionAccumulator;
16371665
1638 // Specifies the pointer id bits that are in use, and their associated tracking id.1666 // Specifies the pointer ids that are in use, and their associated tracking id.
1639 BitSet32 mPointerIdBits;1667 IntSet mPointerIds;
1640 int32_t mPointerTrackingIdMap[MAX_POINTER_ID + 1];1668 std::unordered_map<int32_t, int32_t> mPointerTrackingIdMap;
1641};1669};
16421670
16431671
16441672
=== modified file '3rd_party/android-input/android/frameworks/base/services/input/InputTransport.cpp'
--- 3rd_party/android-input/android/frameworks/base/services/input/InputTransport.cpp 2013-05-31 16:06:07 +0000
+++ 3rd_party/android-input/android/frameworks/base/services/input/InputTransport.cpp 2013-11-21 20:19:28 +0000
@@ -593,7 +593,7 @@
593 if (eventTime < touchState.lastResample.eventTime) {593 if (eventTime < touchState.lastResample.eventTime) {
594 rewriteMessage(touchState, msg);594 rewriteMessage(touchState, msg);
595 } else {595 } else {
596 touchState.lastResample.idBits.clear();596 touchState.lastResample.ids.clear();
597 }597 }
598 }598 }
599 break;599 break;
@@ -603,7 +603,7 @@
603 ssize_t index = findTouchState(deviceId, source);603 ssize_t index = findTouchState(deviceId, source);
604 if (index >= 0) {604 if (index >= 0) {
605 TouchState& touchState = mTouchStates.editItemAt(index);605 TouchState& touchState = mTouchStates.editItemAt(index);
606 touchState.lastResample.idBits.clearBit(msg->body.motion.getActionId());606 touchState.lastResample.ids.remove(msg->body.motion.getActionId());
607 rewriteMessage(touchState, msg);607 rewriteMessage(touchState, msg);
608 }608 }
609 break;609 break;
@@ -614,7 +614,7 @@
614 if (index >= 0) {614 if (index >= 0) {
615 TouchState& touchState = mTouchStates.editItemAt(index);615 TouchState& touchState = mTouchStates.editItemAt(index);
616 rewriteMessage(touchState, msg);616 rewriteMessage(touchState, msg);
617 touchState.lastResample.idBits.clearBit(msg->body.motion.getActionId());617 touchState.lastResample.ids.remove(msg->body.motion.getActionId());
618 }618 }
619 break;619 break;
620 }620 }
@@ -644,7 +644,7 @@
644void InputConsumer::rewriteMessage(const TouchState& state, InputMessage* msg) {644void InputConsumer::rewriteMessage(const TouchState& state, InputMessage* msg) {
645 for (size_t i = 0; i < msg->body.motion.pointerCount; i++) {645 for (size_t i = 0; i < msg->body.motion.pointerCount; i++) {
646 uint32_t id = msg->body.motion.pointers[i].properties.id;646 uint32_t id = msg->body.motion.pointers[i].properties.id;
647 if (state.lastResample.idBits.hasBit(id)) {647 if (state.lastResample.ids.contains(id)) {
648 PointerCoords& msgCoords = msg->body.motion.pointers[i].coords;648 PointerCoords& msgCoords = msg->body.motion.pointers[i].coords;
649 const PointerCoords& resampleCoords = state.lastResample.getPointerById(id);649 const PointerCoords& resampleCoords = state.lastResample.getPointerById(id);
650#if DEBUG_RESAMPLING650#if DEBUG_RESAMPLING
@@ -689,7 +689,7 @@
689 size_t pointerCount = event->getPointerCount();689 size_t pointerCount = event->getPointerCount();
690 for (size_t i = 0; i < pointerCount; i++) {690 for (size_t i = 0; i < pointerCount; i++) {
691 uint32_t id = event->getPointerId(i);691 uint32_t id = event->getPointerId(i);
692 if (!current->idBits.hasBit(id)) {692 if (!current->ids.contains(id)) {
693#if DEBUG_RESAMPLING693#if DEBUG_RESAMPLING
694 ALOGD("Not resampled, missing id %d", id);694 ALOGD("Not resampled, missing id %d", id);
695#endif695#endif
@@ -744,14 +744,14 @@
744744
745 // Resample touch coordinates.745 // Resample touch coordinates.
746 touchState.lastResample.eventTime = sampleTime;746 touchState.lastResample.eventTime = sampleTime;
747 touchState.lastResample.idBits.clear();747 touchState.lastResample.ids.clear();
748 for (size_t i = 0; i < pointerCount; i++) {748 for (size_t i = 0; i < pointerCount; i++) {
749 uint32_t id = event->getPointerId(i);749 uint32_t id = event->getPointerId(i);
750 touchState.lastResample.idToIndex[id] = i;750 touchState.lastResample.idToIndex[id] = i;
751 touchState.lastResample.idBits.markBit(id);751 touchState.lastResample.ids.insert(id);
752 PointerCoords& resampledCoords = touchState.lastResample.pointers[i];752 PointerCoords& resampledCoords = touchState.lastResample.pointers[i];
753 const PointerCoords& currentCoords = current->getPointerById(id);753 const PointerCoords& currentCoords = current->getPointerById(id);
754 if (other->idBits.hasBit(id)754 if (other->ids.contains(id)
755 && shouldResampleTool(event->getToolType(i))) {755 && shouldResampleTool(event->getToolType(i))) {
756 const PointerCoords& otherCoords = other->getPointerById(id);756 const PointerCoords& otherCoords = other->getPointerById(id);
757 resampledCoords.copyFrom(currentCoords);757 resampledCoords.copyFrom(currentCoords);
758758
=== added file '3rd_party/android-input/android/frameworks/base/services/input/IntSet.cpp'
--- 3rd_party/android-input/android/frameworks/base/services/input/IntSet.cpp 1970-01-01 00:00:00 +0000
+++ 3rd_party/android-input/android/frameworks/base/services/input/IntSet.cpp 2013-11-21 20:19:28 +0000
@@ -0,0 +1,123 @@
1/*
2 * Copyright © 2013 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Author: Daniel d'Andrada <daniel.dandrada@canonical.com>
17 */
18
19#include <androidfw/IntSet.h>
20
21#ifdef ANDROID_INPUT_INTSET_TEST
22using namespace test::android;
23#else
24using namespace android;
25#endif
26
27IntSet::IntSet() {
28#ifdef ANDROID_INPUT_INTSET_TEST
29 ++constructionCount;
30#endif
31}
32
33IntSet::IntSet(std::initializer_list<int32_t> list)
34 : stdSet(list) {
35#ifdef ANDROID_INPUT_INTSET_TEST
36 ++constructionCount;
37#endif
38}
39
40IntSet::~IntSet() {
41#ifdef ANDROID_INPUT_INTSET_TEST
42 ++destructionCount;
43#endif
44}
45
46IntSet IntSet::operator -(const IntSet &other) const {
47 IntSet result;
48
49 std::set_difference(stdSet.cbegin(), stdSet.cend(),
50 other.stdSet.cbegin(), other.stdSet.cend(),
51 std::inserter(result.stdSet, result.stdSet.begin()));
52
53 return result;
54}
55
56IntSet IntSet::operator &(const IntSet &other) const {
57 IntSet result;
58
59 std::set_intersection(stdSet.cbegin(), stdSet.cend(),
60 other.stdSet.cbegin(), other.stdSet.cend(),
61 std::inserter(result.stdSet, result.stdSet.begin()));
62
63 return result;
64}
65
66bool IntSet::operator ==(const IntSet &other) const {
67 return stdSet == other.stdSet;
68}
69
70void IntSet::remove(const IntSet &values) {
71 remove(stdSet.begin(), values.stdSet.begin(), values.stdSet.end());
72}
73
74bool IntSet::contains(int32_t value) const {
75 return stdSet.find(value) != stdSet.end();
76}
77
78size_t IntSet::indexOf(int32_t value) const {
79 auto it = stdSet.begin();
80 size_t index = 0;
81 while (it != stdSet.end() && *it != value) {
82 it++;
83 ++index;
84 }
85 assert(it != stdSet.end());
86 return index;
87}
88
89std::string IntSet::toString() const {
90 std::ostringstream stream;
91
92 bool isFirst = true;
93 forEach([&](int32_t value) {
94 if (isFirst) {
95 isFirst = false;
96 } else {
97 stream << ", ";
98 }
99 stream << value;
100 });
101
102 return stream.str();
103}
104
105void IntSet::remove(std::set<int32_t>::iterator selfIterator,
106 std::set<int32_t>::const_iterator otherIterator,
107 std::set<int32_t>::const_iterator otherEnd) {
108
109 if (selfIterator == stdSet.end() || otherIterator == otherEnd)
110 return;
111
112 if (*selfIterator < *otherIterator) {
113 selfIterator++;
114 remove(selfIterator, otherIterator, otherEnd);
115 } else if (*selfIterator == *otherIterator) {
116 selfIterator = stdSet.erase(selfIterator);
117 otherIterator++;
118 remove(selfIterator, otherIterator, otherEnd);
119 } else /* *selfIterator > *otherIterator */ {
120 otherIterator++;
121 remove(selfIterator, otherIterator, otherEnd);
122 }
123}
0124
=== modified file '3rd_party/android-input/android/frameworks/base/services/input/PointerController.cpp'
--- 3rd_party/android-input/android/frameworks/base/services/input/PointerController.cpp 2012-11-06 18:05:11 +0000
+++ 3rd_party/android-input/android/frameworks/base/services/input/PointerController.cpp 2013-11-21 20:19:28 +0000
@@ -167,15 +167,12 @@
167 }167 }
168}168}
169169
170void PointerController::setSpots(const PointerCoords* spotCoords,170void PointerController::setSpots(const PointerCoords* spotCoords, uint32_t spotCount) {
171 const uint32_t* spotIdToIndex, BitSet32 spotIdBits) {
172#if DEBUG_POINTER_UPDATES171#if DEBUG_POINTER_UPDATES
173 ALOGD("setSpots: idBits=%08x", spotIdBits.value);172 ALOGD("setSpots: spotCount=%d", spotCount);
174 for (BitSet32 idBits(spotIdBits); !idBits.isEmpty(); ) {173 for (size_t i = 0; i < spotCount; ++i) {
175 uint32_t id = idBits.firstMarkedBit();174 const PointerCoords& c = spotCoords[i];
176 idBits.clearBit(id);175 ALOGD(" spot %d: position=(%0.3f, %0.3f), pressure=%0.3f", i,
177 const PointerCoords& c = spotCoords[spotIdToIndex[id]];
178 ALOGD(" spot %d: position=(%0.3f, %0.3f), pressure=%0.3f", id,
179 c.getAxisValue(AMOTION_EVENT_AXIS_X),176 c.getAxisValue(AMOTION_EVENT_AXIS_X),
180 c.getAxisValue(AMOTION_EVENT_AXIS_Y),177 c.getAxisValue(AMOTION_EVENT_AXIS_Y),
181 c.getAxisValue(AMOTION_EVENT_AXIS_PRESSURE));178 c.getAxisValue(AMOTION_EVENT_AXIS_PRESSURE));
182179
=== modified file '3rd_party/android-input/android/frameworks/base/services/input/PointerController.h'
--- 3rd_party/android-input/android/frameworks/base/services/input/PointerController.h 2013-05-03 16:38:07 +0000
+++ 3rd_party/android-input/android/frameworks/base/services/input/PointerController.h 2013-11-21 20:19:28 +0000
@@ -18,7 +18,6 @@
18#define _UI_POINTER_CONTROLLER_H18#define _UI_POINTER_CONTROLLER_H
1919
20#include <androidfw/Input.h>20#include <androidfw/Input.h>
21#include <std/BitSet.h>
22#include <std/Mutex.h>21#include <std/Mutex.h>
23#include <std/RefBase.h>22#include <std/RefBase.h>
24#include <std/String8.h>23#include <std/String8.h>
@@ -104,8 +103,7 @@
104 * For spotCoords, pressure != 0 indicates that the spot's location is being103 * For spotCoords, pressure != 0 indicates that the spot's location is being
105 * pressed (not hovering).104 * pressed (not hovering).
106 */105 */
107 virtual void setSpots(const PointerCoords* spotCoords, const uint32_t* spotIdToIndex,106 virtual void setSpots(const PointerCoords* spotCoords, uint32_t spotCount) = 0;
108 BitSet32 spotIdBits) = 0;
109107
110 /* Removes all spots. */108 /* Removes all spots. */
111 virtual void clearSpots() = 0;109 virtual void clearSpots() = 0;
@@ -139,8 +137,7 @@
139 virtual void unfade(Transition transition);137 virtual void unfade(Transition transition);
140138
141 virtual void setPresentation(Presentation presentation);139 virtual void setPresentation(Presentation presentation);
142 virtual void setSpots(const PointerCoords* spotCoords,140 virtual void setSpots(const PointerCoords* spotCoords, uint32_t spotCount);
143 const uint32_t* spotIdToIndex, BitSet32 spotIdBits);
144 virtual void clearSpots();141 virtual void clearSpots();
145142
146 void setDisplaySize(int32_t width, int32_t height);143 void setDisplaySize(int32_t width, int32_t height);
147144
=== modified file '3rd_party/android-input/android/frameworks/base/services/input/VelocityControl.cpp'
--- 3rd_party/android-input/android/frameworks/base/services/input/VelocityControl.cpp 2013-05-03 16:38:07 +0000
+++ 3rd_party/android-input/android/frameworks/base/services/input/VelocityControl.cpp 2013-11-21 20:19:28 +0000
@@ -24,7 +24,6 @@
24#include <limits.h>24#include <limits.h>
2525
26#include <androidfw/VelocityControl.h>26#include <androidfw/VelocityControl.h>
27#include <std/BitSet.h>
28#include <std/Timers.h>27#include <std/Timers.h>
2928
30namespace android {29namespace android {
@@ -35,6 +34,7 @@
3534
36VelocityControl::VelocityControl() {35VelocityControl::VelocityControl() {
37 reset();36 reset();
37 mIds.insert(1);
38}38}
3939
40void VelocityControl::setParameters(const VelocityControlParameters& parameters) {40void VelocityControl::setParameters(const VelocityControlParameters& parameters) {
@@ -66,7 +66,7 @@
66 if (deltaY) {66 if (deltaY) {
67 mRawPosition.y += *deltaY;67 mRawPosition.y += *deltaY;
68 }68 }
69 mVelocityTracker.addMovement(eventTime, BitSet32(BitSet32::valueForBit(0)), &mRawPosition);69 mVelocityTracker.addMovement(eventTime, mIds, &mRawPosition);
7070
71 float vx, vy;71 float vx, vy;
72 float scale = mParameters.scale;72 float scale = mParameters.scale;
7373
=== modified file '3rd_party/android-input/android/frameworks/base/services/input/VelocityTracker.cpp'
--- 3rd_party/android-input/android/frameworks/base/services/input/VelocityTracker.cpp 2013-05-03 16:38:07 +0000
+++ 3rd_party/android-input/android/frameworks/base/services/input/VelocityTracker.cpp 2013-11-21 20:19:28 +0000
@@ -27,7 +27,7 @@
27#include <limits.h>27#include <limits.h>
2828
29#include <androidfw/VelocityTracker.h>29#include <androidfw/VelocityTracker.h>
30#include <std/BitSet.h>30#include <androidfw/IntSet.h>
31#include <std/String8.h>31#include <std/String8.h>
32#include <std/Timers.h>32#include <std/Timers.h>
33#include <std/Log.h>33#include <std/Log.h>
@@ -109,7 +109,7 @@
109const char* VelocityTracker::DEFAULT_STRATEGY = "lsq2";109const char* VelocityTracker::DEFAULT_STRATEGY = "lsq2";
110110
111VelocityTracker::VelocityTracker(const char* strategy) :111VelocityTracker::VelocityTracker(const char* strategy) :
112 mLastEventTime(0), mCurrentPointerIdBits(0), mActivePointerId(-1) {112 mLastEventTime(0), mActivePointerId(-1) {
113 char value[PROPERTY_VALUE_MAX];113 char value[PROPERTY_VALUE_MAX];
114114
115 // Allow the default strategy to be overridden using a system property for debugging.115 // Allow the default strategy to be overridden using a system property for debugging.
@@ -202,29 +202,24 @@
202}202}
203203
204void VelocityTracker::clear() {204void VelocityTracker::clear() {
205 mCurrentPointerIdBits.clear();205 mCurrentPointerIds.clear();
206 mActivePointerId = -1;206 mActivePointerId = -1;
207207
208 mStrategy->clear();208 mStrategy->clear();
209}209}
210210
211void VelocityTracker::clearPointers(BitSet32 idBits) {211void VelocityTracker::clearPointers(const IntSet &ids) {
212 BitSet32 remainingIdBits(mCurrentPointerIdBits.value & ~idBits.value);212 mCurrentPointerIds.remove(ids);
213 mCurrentPointerIdBits = remainingIdBits;
214213
215 if (mActivePointerId >= 0 && idBits.hasBit(mActivePointerId)) {214 if (mActivePointerId >= 0 && ids.contains(mActivePointerId)) {
216 mActivePointerId = !remainingIdBits.isEmpty() ? remainingIdBits.firstMarkedBit() : -1;215 mActivePointerId = !mCurrentPointerIds.isEmpty() ? mCurrentPointerIds.first() : -1;
217 }216 }
218217
219 mStrategy->clearPointers(idBits);218 mStrategy->clearPointers(ids);
220}219}
221220
222void VelocityTracker::addMovement(nsecs_t eventTime, BitSet32 idBits, const Position* positions) {221void VelocityTracker::addMovement(nsecs_t eventTime, const IntSet &ids, const Position* positions) {
223 while (idBits.count() > MAX_POINTERS) {222 if (!(mCurrentPointerIds & ids).isEmpty()
224 idBits.clearLastMarkedBit();
225 }
226
227 if ((mCurrentPointerIdBits.value & idBits.value)
228 && eventTime >= mLastEventTime + ASSUME_POINTER_STOPPED_TIME) {223 && eventTime >= mLastEventTime + ASSUME_POINTER_STOPPED_TIME) {
229#if DEBUG_VELOCITY224#if DEBUG_VELOCITY
230 ALOGD("VelocityTracker: stopped for %0.3f ms, clearing state.",225 ALOGD("VelocityTracker: stopped for %0.3f ms, clearing state.",
@@ -236,20 +231,18 @@
236 }231 }
237 mLastEventTime = eventTime;232 mLastEventTime = eventTime;
238233
239 mCurrentPointerIdBits = idBits;234 mCurrentPointerIds = ids;
240 if (mActivePointerId < 0 || !idBits.hasBit(mActivePointerId)) {235 if (mActivePointerId < 0 || !ids.contains(mActivePointerId)) {
241 mActivePointerId = idBits.isEmpty() ? -1 : idBits.firstMarkedBit();236 mActivePointerId = ids.isEmpty() ? -1 : ids.first();
242 }237 }
243238
244 mStrategy->addMovement(eventTime, idBits, positions);239 mStrategy->addMovement(eventTime, ids, positions);
245240
246#if DEBUG_VELOCITY241#if DEBUG_VELOCITY
247 ALOGD("VelocityTracker: addMovement eventTime=%lld, idBits=0x%08x, activePointerId=%d",242 ALOGD("VelocityTracker: addMovement eventTime=%lld, ids.cont()=%d, activePointerId=%d",
248 eventTime, idBits.value, mActivePointerId);243 eventTime, ids.count(), mActivePointerId);
249 for (BitSet32 iterBits(idBits); !iterBits.isEmpty(); ) {244 size_t index = 0;
250 uint32_t id = iterBits.firstMarkedBit();245 ids.forEach([&](int32_t id) {
251 uint32_t index = idBits.getIndexOfBit(id);
252 iterBits.clearBit(id);
253 Estimator estimator;246 Estimator estimator;
254 getEstimator(id, &estimator);247 getEstimator(id, &estimator);
255 ALOGD(" %d: position (%0.3f, %0.3f), "248 ALOGD(" %d: position (%0.3f, %0.3f), "
@@ -259,6 +252,7 @@
259 vectorToString(estimator.xCoeff, estimator.degree + 1).string(),252 vectorToString(estimator.xCoeff, estimator.degree + 1).string(),
260 vectorToString(estimator.yCoeff, estimator.degree + 1).string(),253 vectorToString(estimator.yCoeff, estimator.degree + 1).string(),
261 estimator.confidence);254 estimator.confidence);
255 ++index;
262 }256 }
263#endif257#endif
264}258}
@@ -276,9 +270,9 @@
276 // Start a new movement trace for a pointer that just went down.270 // Start a new movement trace for a pointer that just went down.
277 // We do this on down instead of on up because the client may want to query the271 // We do this on down instead of on up because the client may want to query the
278 // final velocity for a pointer that just went up.272 // final velocity for a pointer that just went up.
279 BitSet32 downIdBits;273 IntSet downIds;
280 downIdBits.markBit(event->getPointerId(event->getActionIndex()));274 downIds.insert(event->getPointerId(event->getActionIndex()));
281 clearPointers(downIdBits);275 clearPointers(downIds);
282 break;276 break;
283 }277 }
284 case AMOTION_EVENT_ACTION_MOVE:278 case AMOTION_EVENT_ACTION_MOVE:
@@ -301,14 +295,14 @@
301 pointerCount = MAX_POINTERS;295 pointerCount = MAX_POINTERS;
302 }296 }
303297
304 BitSet32 idBits;298 IntSet ids;
305 for (size_t i = 0; i < pointerCount; i++) {299 for (size_t i = 0; i < pointerCount; i++) {
306 idBits.markBit(event->getPointerId(i));300 ids.insert(event->getPointerId(i));
307 }301 }
308302
309 uint32_t pointerIndex[MAX_POINTERS];303 uint32_t pointerIndex[MAX_POINTERS];
310 for (size_t i = 0; i < pointerCount; i++) {304 for (size_t i = 0; i < pointerCount; i++) {
311 pointerIndex[i] = idBits.getIndexOfBit(event->getPointerId(i));305 pointerIndex[i] = ids.indexOf(event->getPointerId(i));
312 }306 }
313307
314 nsecs_t eventTime;308 nsecs_t eventTime;
@@ -322,7 +316,7 @@
322 positions[index].x = event->getHistoricalX(i, h);316 positions[index].x = event->getHistoricalX(i, h);
323 positions[index].y = event->getHistoricalY(i, h);317 positions[index].y = event->getHistoricalY(i, h);
324 }318 }
325 addMovement(eventTime, idBits, positions);319 addMovement(eventTime, ids, positions);
326 }320 }
327321
328 eventTime = event->getEventTime();322 eventTime = event->getEventTime();
@@ -331,7 +325,7 @@
331 positions[index].x = event->getX(i);325 positions[index].x = event->getX(i);
332 positions[index].y = event->getY(i);326 positions[index].y = event->getY(i);
333 }327 }
334 addMovement(eventTime, idBits, positions);328 addMovement(eventTime, ids, positions);
335}329}
336330
337bool VelocityTracker::getVelocity(uint32_t id, float* outVx, float* outVy) const {331bool VelocityTracker::getVelocity(uint32_t id, float* outVx, float* outVy) const {
@@ -367,15 +361,14 @@
367361
368void LeastSquaresVelocityTrackerStrategy::clear() {362void LeastSquaresVelocityTrackerStrategy::clear() {
369 mIndex = 0;363 mIndex = 0;
370 mMovements[0].idBits.clear();364 mMovements[0].ids.clear();
371}365}
372366
373void LeastSquaresVelocityTrackerStrategy::clearPointers(BitSet32 idBits) {367void LeastSquaresVelocityTrackerStrategy::clearPointers(const IntSet &ids) {
374 BitSet32 remainingIdBits(mMovements[mIndex].idBits.value & ~idBits.value);368 mMovements[mIndex].ids.remove(ids);
375 mMovements[mIndex].idBits = remainingIdBits;369}
376}370
377371void LeastSquaresVelocityTrackerStrategy::addMovement(nsecs_t eventTime, const IntSet &ids,
378void LeastSquaresVelocityTrackerStrategy::addMovement(nsecs_t eventTime, BitSet32 idBits,
379 const VelocityTracker::Position* positions) {372 const VelocityTracker::Position* positions) {
380 if (++mIndex == HISTORY_SIZE) {373 if (++mIndex == HISTORY_SIZE) {
381 mIndex = 0;374 mIndex = 0;
@@ -383,9 +376,9 @@
383376
384 Movement& movement = mMovements[mIndex];377 Movement& movement = mMovements[mIndex];
385 movement.eventTime = eventTime;378 movement.eventTime = eventTime;
386 movement.idBits = idBits;379 movement.ids = ids;
387 uint32_t count = idBits.count();380 size_t count = ids.count();
388 for (uint32_t i = 0; i < count; i++) {381 for (size_t i = 0; i < count; i++) {
389 movement.positions[i] = positions[i];382 movement.positions[i] = positions[i];
390 }383 }
391}384}
@@ -570,7 +563,7 @@
570 const Movement& newestMovement = mMovements[mIndex];563 const Movement& newestMovement = mMovements[mIndex];
571 do {564 do {
572 const Movement& movement = mMovements[index];565 const Movement& movement = mMovements[index];
573 if (!movement.idBits.hasBit(id)) {566 if (!movement.ids.contains(id)) {
574 break;567 break;
575 }568 }
576569
@@ -702,36 +695,44 @@
702}695}
703696
704void IntegratingVelocityTrackerStrategy::clear() {697void IntegratingVelocityTrackerStrategy::clear() {
705 mPointerIdBits.clear();698 mPointerIds.clear();
706}699}
707700
708void IntegratingVelocityTrackerStrategy::clearPointers(BitSet32 idBits) {701void IntegratingVelocityTrackerStrategy::clearPointers(const IntSet &ids) {
709 mPointerIdBits.value &= ~idBits.value;702 mPointerIds.remove(ids);
710}703}
711704
712void IntegratingVelocityTrackerStrategy::addMovement(nsecs_t eventTime, BitSet32 idBits,705void IntegratingVelocityTrackerStrategy::addMovement(nsecs_t eventTime, const IntSet &ids,
713 const VelocityTracker::Position* positions) {706 const VelocityTracker::Position* positions) {
714 uint32_t index = 0;707
715 for (BitSet32 iterIdBits(idBits); !iterIdBits.isEmpty();) {708 {
716 uint32_t id = iterIdBits.clearFirstMarkedBit();709 auto pointerIdsIt = mPointerIds.begin();
717 State& state = mPointerState[id];710 uint32_t index = 0;
718 const VelocityTracker::Position& position = positions[index++];711
719 if (mPointerIdBits.hasBit(id)) {712 for_each(ids.begin(), ids.end(), [&](int32_t id) {
720 updateState(state, eventTime, position.x, position.y);713 State& state = mPointerState[id];
721 } else {714 const VelocityTracker::Position& position = positions[index++];
722 initState(state, eventTime, position.x, position.y);715
723 }716 while (*pointerIdsIt < id && pointerIdsIt != mPointerIds.end())
717 pointerIdsIt++;
718
719 if (pointerIdsIt != mPointerIds.end() && *pointerIdsIt == id) {
720 updateState(state, eventTime, position.x, position.y);
721 } else {
722 initState(state, eventTime, position.x, position.y);
723 }
724 });
724 }725 }
725726
726 mPointerIdBits = idBits;727 mPointerIds = ids;
727}728}
728729
729bool IntegratingVelocityTrackerStrategy::getEstimator(uint32_t id,730bool IntegratingVelocityTrackerStrategy::getEstimator(uint32_t id,
730 VelocityTracker::Estimator* outEstimator) const {731 VelocityTracker::Estimator* outEstimator) const {
731 outEstimator->clear();732 outEstimator->clear();
732733
733 if (mPointerIdBits.hasBit(id)) {734 if (mPointerIds.contains(id)) {
734 const State& state = mPointerState[id];735 const State& state = mPointerState.at(id);
735 populateEstimator(state, outEstimator);736 populateEstimator(state, outEstimator);
736 return true;737 return true;
737 }738 }
@@ -823,15 +824,14 @@
823824
824void LegacyVelocityTrackerStrategy::clear() {825void LegacyVelocityTrackerStrategy::clear() {
825 mIndex = 0;826 mIndex = 0;
826 mMovements[0].idBits.clear();827 mMovements[0].ids.clear();
827}828}
828829
829void LegacyVelocityTrackerStrategy::clearPointers(BitSet32 idBits) {830void LegacyVelocityTrackerStrategy::clearPointers(const IntSet &ids) {
830 BitSet32 remainingIdBits(mMovements[mIndex].idBits.value & ~idBits.value);831 mMovements[mIndex].ids.remove(ids);
831 mMovements[mIndex].idBits = remainingIdBits;832}
832}833
833834void LegacyVelocityTrackerStrategy::addMovement(nsecs_t eventTime, const IntSet &ids,
834void LegacyVelocityTrackerStrategy::addMovement(nsecs_t eventTime, BitSet32 idBits,
835 const VelocityTracker::Position* positions) {835 const VelocityTracker::Position* positions) {
836 if (++mIndex == HISTORY_SIZE) {836 if (++mIndex == HISTORY_SIZE) {
837 mIndex = 0;837 mIndex = 0;
@@ -839,11 +839,8 @@
839839
840 Movement& movement = mMovements[mIndex];840 Movement& movement = mMovements[mIndex];
841 movement.eventTime = eventTime;841 movement.eventTime = eventTime;
842 movement.idBits = idBits;842 movement.ids = ids;
843 uint32_t count = idBits.count();843 memcpy(movement.positions, positions, sizeof(VelocityTracker::Position) * ids.count());
844 for (uint32_t i = 0; i < count; i++) {
845 movement.positions[i] = positions[i];
846 }
847}844}
848845
849bool LegacyVelocityTrackerStrategy::getEstimator(uint32_t id,846bool LegacyVelocityTrackerStrategy::getEstimator(uint32_t id,
@@ -851,7 +848,7 @@
851 outEstimator->clear();848 outEstimator->clear();
852849
853 const Movement& newestMovement = mMovements[mIndex];850 const Movement& newestMovement = mMovements[mIndex];
854 if (!newestMovement.idBits.hasBit(id)) {851 if (!newestMovement.ids.contains(id)) {
855 return false; // no data852 return false; // no data
856 }853 }
857854
@@ -862,7 +859,7 @@
862 do {859 do {
863 uint32_t nextOldestIndex = (oldestIndex == 0 ? HISTORY_SIZE : oldestIndex) - 1;860 uint32_t nextOldestIndex = (oldestIndex == 0 ? HISTORY_SIZE : oldestIndex) - 1;
864 const Movement& nextOldestMovement = mMovements[nextOldestIndex];861 const Movement& nextOldestMovement = mMovements[nextOldestIndex];
865 if (!nextOldestMovement.idBits.hasBit(id)862 if (!nextOldestMovement.ids.contains(id)
866 || nextOldestMovement.eventTime < minTime) {863 || nextOldestMovement.eventTime < minTime) {
867 break;864 break;
868 }865 }
869866
=== modified file 'debian/changelog'
--- debian/changelog 2013-11-20 07:36:15 +0000
+++ debian/changelog 2013-11-21 20:19:28 +0000
@@ -1,3 +1,4 @@
1<<<<<<< TREE
1mir (0.1.1+14.04.20131120-0ubuntu1) trusty; urgency=low2mir (0.1.1+14.04.20131120-0ubuntu1) trusty; urgency=low
23
3 [ Daniel van Vugt ]4 [ Daniel van Vugt ]
@@ -75,7 +76,36 @@
75mir (0.1.0+14.04.20131028-0ubuntu1) trusty; urgency=low76mir (0.1.0+14.04.20131028-0ubuntu1) trusty; urgency=low
7677
77 [ Daniel van Vugt ]78 [ Daniel van Vugt ]
79=======
80mir (0.1.1-0ubuntu1) UNRELEASED; urgency=low
81
82 * Bump version to 0.1.1
83
84 -- Daniel van Vugt <daniel.van.vugt@canonical.com> Wed, 30 Oct 2013 11:46:13 +0800
85
86mir (0.1.0+14.04.20131030-0ubuntu1) trusty; urgency=low
87
88 [ Ubuntu daily release ]
89 * New rebuild forced
90
91 [ Alan Griffiths ]
92 * client: Remove the timeout for detecting server crashes There are
93 valid cases when the server blocks for an indeterminate amount of
94 time during a client request, like when a next_buffer request blocks
95 because a surface is not visible or the server is paused. In such
96 cases, the timeout mechanism we used to detect server crashes caused
97 the clients to fail. Furthermore, the clients seem able to detect
98 server crashes without the timeout, rendering it needless anyway.
99 (LP: #1245958)
100
101 -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Wed, 30 Oct 2013 18:37:21 +0000
102
103mir (0.1.0+14.04.20131028-0ubuntu1) trusty; urgency=low
104
105 [ Daniel van Vugt ]
106>>>>>>> MERGE-SOURCE
78 * Bump version 0.1.0107 * Bump version 0.1.0
108<<<<<<< TREE
79 * Add method for testing if Rectangle::contains(Rectangle), which is109 * Add method for testing if Rectangle::contains(Rectangle), which is
80 the basis of any occlusion detection. (LP: #1227739)110 the basis of any occlusion detection. (LP: #1227739)
81 * Add support for traversing the Scene from front surface to back.111 * Add support for traversing the Scene from front surface to back.
@@ -174,6 +204,106 @@
174 * Automatic snapshot from revision 1161204 * Automatic snapshot from revision 1161
175205
176 -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Mon, 28 Oct 2013 02:04:31 +0000206 -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Mon, 28 Oct 2013 02:04:31 +0000
207=======
208 * Add method for testing if Rectangle::contains(Rectangle), which is
209 the basis of any occlusion detection. (LP: #1227739)
210 * Add support for traversing the Scene from front surface to back.
211 This is required for occlusion detection at least (coming soon). .
212 (LP: #1227739)
213 * Optimization: Turn off blending for surfaces that are not blendable.
214 On some systems this can have a noticeable performance benefit.
215 * Avoid rendering surfaces that are fully hidden by other surfaces.
216 This is particularly important for mobile device performance. (LP:
217 #1227739) . (LP: #1227739)
218 * Remove orphaned tags, which appear to have come from the Compiz
219 project (!?) Add tags for the most recent releases up to 0.0.16. No
220 files changed, only tags.
221 * Fix significant performance issues LP: #1241369 / LP: #1241371, and
222 probably more(!) Added regression test to catch such regressions and
223 revert the offending commit r1049. (LP: #1241369, #1241371)
224
225 [ Brandon Schaefer ]
226 * When Scroll events come in we don't keep around the android vscroll
227 hscroll data. Store it now. (LP: #1233089)
228
229 [ Albert Astals ]
230 * Fix mismatched free() / delete / delete [] reported by valgrind
231
232 [ Alexandros Frantzis ]
233 * server: Extend server status (formerly pause/resume) listener to
234 report "started" events This change is needed by users of
235 libmirserver, so they can properly synchronize external interactions
236 with the server. (LP: #1239876)
237 * graphics,examples: Don't enable more outputs than supported when
238 changing the display configuration. (LP: #1217877)
239 * client: Allow clients to call API functions after a connection break
240 has been detected When a client tries to call an API function after
241 a connection break has been detected in a previous API call, the
242 client blocks in the new call. This happens because in
243 MirSocketRpcChannel::notify_disconnected() the pending RPC calls are
244 not forced to complete, since the channel has already been marked as
245 'disconnected' by the failure in the previous call. Note that if the
246 break is first detected while calling an API function, then that
247 call doesn't block, since this is the first time we call
248 MirSocketRpcChannel::notify_disconnected() and the pending RPC calls
249 are forced to complete. This commit solves this problem by always
250 forcing requests to complete when a communication failure occurs,
251 even if a disconnection has already been handled. This is preferred
252 over the alternative of manually calling the completion callback in
253 a try-catch block when calling an RPC method because of: 1.
254 Correctness: In case the communication problem first occurs in that
255 call, the callback will be called twice, once by
256 notify_disconnected() and once manually. 2. Consistency: The
257 callback is called from one place regardless of whether the
258 communication problem is first detected during that call or not.
259 (LP: #1201436)
260 * graphics: Improve signature of native platform initialization method
261 Use an interface to provide the functionality needed by native
262 platforms.
263
264 [ Eleni Maria Stea ]
265 * Test GBMBufferAllocatorTest.bypass_disables_via_environment
266 overrides the MIR_BYPASS env variable, causing other tests that use
267 the MIR_BYPASS to fail when we run the unit-tests with --
268 gtest_repeat=N, N>1. Set back the MIR_BYPASS env. var. (LP:
269 #1238000)
270
271 [ Kevin DuBois ]
272 * fix: lp 1239577 TestClientIPCRender (an android-only gfx driver
273 test) was hanging due to changes in signal handling. refactor the
274 test, changing the cross-process sync mechanism so it doesn't use
275 sigcont. (LP: #1239577)
276 * graphics: android: eliminate one of the two DisplayBuffers. both
277 hwc/gpu displays use the same displaybuffer now. .
278
279 [ Daniel d'Andrada ]
280 * Add InputReader performance test.
281
282 [ Alan Griffiths ]
283 * logging: correct component tag in connector report.
284 * client: fix hang(s) in client API when server dies. (LP: #1227743)
285 * Fix failing acceptance-test:
286 ServerShutdown/OnSignal.removes_endpoint_on_signal (LP: #1237710)
287 Avoid fatal_signal_cleanup getting caught in a loop restoring itself
288 and then re-entering itself. This could happen in some permutations
289 of acceptance-tests where run_mir is entered with
290 fatal_signal_cleanup already set up from previous tests' server
291 instances. (LP: #1237710)
292 * CMake: remove creation of link to non-existent file.
293 * shared: some utility functions to provide some consistent ways to
294 use RAII and application of these functions to some code that has
295 had RAII related discussions recently.
296 * config: separate out the configuration options from the
297 configuration builder.
298 * config: ensure USC can access
299 DefaultConfigurationOptions::parse_options (LP: #1244192) (LP:
300 #1244192)
301
302 [ Ubuntu daily release ]
303 * Automatic snapshot from revision 1160
304
305 -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Mon, 28 Oct 2013 02:04:31 +0000
306>>>>>>> MERGE-SOURCE
177307
178mir (0.0.15+13.10.20131014-0ubuntu2) trusty; urgency=low308mir (0.0.15+13.10.20131014-0ubuntu2) trusty; urgency=low
179309
180310
=== modified file 'debian/control'
--- debian/control 2013-11-06 03:17:35 +0000
+++ debian/control 2013-11-21 20:19:28 +0000
@@ -69,7 +69,11 @@
69 .69 .
70 Contains the protocol's definition files.70 Contains the protocol's definition files.
7171
72<<<<<<< TREE
72Package: libmirserver1073Package: libmirserver10
74=======
75Package: libmirserver11
76>>>>>>> MERGE-SOURCE
73Section: libs77Section: libs
74Architecture: i386 amd64 armhf arm6478Architecture: i386 amd64 armhf arm64
75Multi-Arch: same79Multi-Arch: same
@@ -115,7 +119,11 @@
115Architecture: i386 amd64 armhf arm64119Architecture: i386 amd64 armhf arm64
116Multi-Arch: same120Multi-Arch: same
117Pre-Depends: ${misc:Pre-Depends}121Pre-Depends: ${misc:Pre-Depends}
122<<<<<<< TREE
118Depends: libmirserver10 (= ${binary:Version}),123Depends: libmirserver10 (= ${binary:Version}),
124=======
125Depends: libmirserver11 (= ${binary:Version}),
126>>>>>>> MERGE-SOURCE
119 libmirprotobuf-dev (= ${binary:Version}),127 libmirprotobuf-dev (= ${binary:Version}),
120 mircommon-dev (= ${binary:Version}),128 mircommon-dev (= ${binary:Version}),
121 libglm-dev,129 libglm-dev,
122130
=== renamed file 'debian/libmirserver10.install' => 'debian/libmirserver11.install'
--- debian/libmirserver10.install 2013-11-06 03:17:35 +0000
+++ debian/libmirserver11.install 2013-11-21 20:19:28 +0000
@@ -1,1 +1,5 @@
1<<<<<<< TREE
1usr/lib/*/libmirserver.so.102usr/lib/*/libmirserver.so.10
3=======
4usr/lib/*/libmirserver.so.11
5>>>>>>> MERGE-SOURCE
26
=== modified file 'doc/Doxyfile.in'
--- doc/Doxyfile.in 2013-07-02 11:27:33 +0000
+++ doc/Doxyfile.in 2013-11-21 20:19:28 +0000
@@ -1,14 +1,16 @@
1# Doxyfile 1.8.1.21# Doxyfile 1.8.4
22
3# This file describes the settings to be used by the documentation system3# This file describes the settings to be used by the documentation system
4# doxygen (www.doxygen.org) for a project4# doxygen (www.doxygen.org) for a project.
5#5#
6# All text after a hash (#) is considered a comment and will be ignored6# All text after a double hash (##) is considered a comment and is placed
7# in front of the TAG it is preceding .
8# All text after a hash (#) is considered a comment and will be ignored.
7# The format is:9# The format is:
8# TAG = value [value, ...]10# TAG = value [value, ...]
9# For lists items can also be appended using:11# For lists items can also be appended using:
10# TAG += value [value, ...]12# TAG += value [value, ...]
11# Values that contain spaces should be placed between quotes (" ")13# Values that contain spaces should be placed between quotes (" ").
1214
13#---------------------------------------------------------------------------15#---------------------------------------------------------------------------
14# Project related configuration options16# Project related configuration options
@@ -70,9 +72,9 @@
70# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,72# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
71# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,73# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
72# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English74# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
73# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,75# messages), Korean, Korean-en, Latvian, Lithuanian, Norwegian, Macedonian,
74# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak,76# Persian, Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic,
75# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.77# Slovak, Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
7678
77OUTPUT_LANGUAGE = English79OUTPUT_LANGUAGE = English
7880
@@ -136,7 +138,9 @@
136# only done if one of the specified strings matches the left-hand part of138# only done if one of the specified strings matches the left-hand part of
137# the path. The tag can be used to show relative paths in the file list.139# the path. The tag can be used to show relative paths in the file list.
138# If left blank the directory from which doxygen is run is used as the140# If left blank the directory from which doxygen is run is used as the
139# path to strip.141# path to strip. Note that you specify absolute paths here, but also
142# relative paths, which will be relative from the directory where doxygen is
143# started.
140144
141STRIP_FROM_PATH = @CMAKE_CURRENT_SOURCE_DIR@145STRIP_FROM_PATH = @CMAKE_CURRENT_SOURCE_DIR@
142146
@@ -239,14 +243,15 @@
239OPTIMIZE_OUTPUT_VHDL = NO243OPTIMIZE_OUTPUT_VHDL = NO
240244
241# Doxygen selects the parser to use depending on the extension of the files it245# Doxygen selects the parser to use depending on the extension of the files it
242# parses. With this tag you can assign which parser to use for a given extension.246# parses. With this tag you can assign which parser to use for a given
243# Doxygen has a built-in mapping, but you can override or extend it using this247# extension. Doxygen has a built-in mapping, but you can override or extend it
244# tag. The format is ext=language, where ext is a file extension, and language248# using this tag. The format is ext=language, where ext is a file extension,
245# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C,249# and language is one of the parsers supported by doxygen: IDL, Java,
246# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make250# Javascript, CSharp, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL, C,
247# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C251# C++. For instance to make doxygen treat .inc files as Fortran files (default
248# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions252# is PHP), and .f files as C (default is Fortran), use: inc=Fortran f=C. Note
249# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.253# that for custom extensions you also need to set FILE_PATTERNS otherwise the
254# files are not read by doxygen.
250255
251EXTENSION_MAPPING =256EXTENSION_MAPPING =
252257
@@ -259,6 +264,13 @@
259264
260MARKDOWN_SUPPORT = YES265MARKDOWN_SUPPORT = YES
261266
267# When enabled doxygen tries to link words that correspond to documented
268# classes, or namespaces to their corresponding documentation. Such a link can
269# be prevented in individual cases by by putting a % sign in front of the word
270# or globally by setting AUTOLINK_SUPPORT to NO.
271
272AUTOLINK_SUPPORT = YES
273
262# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want274# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
263# to include (a tag file for) the STL sources as input, then you should275# to include (a tag file for) the STL sources as input, then you should
264# set this tag to YES in order to let doxygen match functions declarations and276# set this tag to YES in order to let doxygen match functions declarations and
@@ -279,10 +291,10 @@
279291
280SIP_SUPPORT = NO292SIP_SUPPORT = NO
281293
282# For Microsoft's IDL there are propget and propput attributes to indicate getter294# For Microsoft's IDL there are propget and propput attributes to indicate
283# and setter methods for a property. Setting this option to YES (the default)295# getter and setter methods for a property. Setting this option to YES (the
284# will make doxygen replace the get and set methods by a property in the296# default) will make doxygen replace the get and set methods by a property in
285# documentation. This will only work if the methods are indeed getting or297# the documentation. This will only work if the methods are indeed getting or
286# setting a simple type. If this is not the case, or you want to show the298# setting a simple type. If this is not the case, or you want to show the
287# methods anyway, you should set this option to NO.299# methods anyway, you should set this option to NO.
288300
@@ -311,11 +323,11 @@
311INLINE_GROUPED_CLASSES = NO323INLINE_GROUPED_CLASSES = NO
312324
313# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and325# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and
314# unions with only public data fields will be shown inline in the documentation326# unions with only public data fields or simple typedef fields will be shown
315# of the scope in which they are defined (i.e. file, namespace, or group327# inline in the documentation of the scope in which they are defined (i.e. file,
316# documentation), provided this scope is documented. If set to NO (the default),328# namespace, or group documentation), provided this scope is documented. If set
317# structs, classes, and unions are shown on a separate page (for HTML and Man329# to NO (the default), structs, classes, and unions are shown on a separate
318# pages) or section (for LaTeX and RTF).330# page (for HTML and Man pages) or section (for LaTeX and RTF).
319331
320INLINE_SIMPLE_STRUCTS = NO332INLINE_SIMPLE_STRUCTS = NO
321333
@@ -329,30 +341,14 @@
329341
330TYPEDEF_HIDES_STRUCT = NO342TYPEDEF_HIDES_STRUCT = NO
331343
332# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to344# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This
333# determine which symbols to keep in memory and which to flush to disk.345# cache is used to resolve symbols given their name and scope. Since this can
334# When the cache is full, less often used symbols will be written to disk.346# be an expensive process and often the same symbol appear multiple times in
335# For small to medium size projects (<1000 input files) the default value is347# the code, doxygen keeps a cache of pre-resolved symbols. If the cache is too
336# probably good enough. For larger projects a too small cache size can cause348# small doxygen will become slower. If the cache is too large, memory is wasted.
337# doxygen to be busy swapping symbols to and from disk most of the time349# The cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid
338# causing a significant performance penalty.350# range is 0..9, the default is 0, corresponding to a cache size of 2^16 = 65536
339# If the system has enough physical memory increasing the cache will improve the351# symbols.
340# performance by keeping more symbols in memory. Note that the value works on
341# a logarithmic scale so increasing the size by one will roughly double the
342# memory usage. The cache size is given by this formula:
343# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
344# corresponding to a cache size of 2^16 = 65536 symbols.
345
346SYMBOL_CACHE_SIZE = 0
347
348# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be
349# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given
350# their name and scope. Since this can be an expensive process and often the
351# same symbol appear multiple times in the code, doxygen keeps a cache of
352# pre-resolved symbols. If the cache is too small doxygen will become slower.
353# If the cache is too large, memory is wasted. The cache size is given by this
354# formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0,
355# corresponding to a cache size of 2^16 = 65536 symbols.
356352
357LOOKUP_CACHE_SIZE = 0353LOOKUP_CACHE_SIZE = 0
358354
@@ -363,7 +359,7 @@
363# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in359# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
364# documentation are documented, even if no documentation was available.360# documentation are documented, even if no documentation was available.
365# Private class members and static file members will be hidden unless361# Private class members and static file members will be hidden unless
366# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES362# the EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES
367363
368EXTRACT_ALL = YES364EXTRACT_ALL = YES
369365
@@ -544,7 +540,8 @@
544GENERATE_DEPRECATEDLIST= YES540GENERATE_DEPRECATEDLIST= YES
545541
546# The ENABLED_SECTIONS tag can be used to enable conditional542# The ENABLED_SECTIONS tag can be used to enable conditional
547# documentation sections, marked by \if sectionname ... \endif.543# documentation sections, marked by \if section-label ... \endif
544# and \cond section-label ... \endcond blocks.
548545
549ENABLED_SECTIONS =546ENABLED_SECTIONS =
550547
@@ -571,7 +568,8 @@
571SHOW_FILES = YES568SHOW_FILES = YES
572569
573# Set the SHOW_NAMESPACES tag to NO to disable the generation of the570# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
574# Namespaces page. This will remove the Namespaces entry from the Quick Index571# Namespaces page.
572# This will remove the Namespaces entry from the Quick Index
575# and from the Folder Tree View (if specified). The default is YES.573# and from the Folder Tree View (if specified). The default is YES.
576574
577SHOW_NAMESPACES = YES575SHOW_NAMESPACES = YES
@@ -601,7 +599,8 @@
601# requires the bibtex tool to be installed. See also599# requires the bibtex tool to be installed. See also
602# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style600# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style
603# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this601# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this
604# feature you need bibtex and perl available in the search path.602# feature you need bibtex and perl available in the search path. Do not use
603# file names with spaces, bibtex cannot handle them.
605604
606CITE_BIB_FILES =605CITE_BIB_FILES =
607606
@@ -757,7 +756,11 @@
757# wildcard * is used, a substring. Examples: ANamespace, AClass,756# wildcard * is used, a substring. Examples: ANamespace, AClass,
758# AClass::ANamespace, ANamespace::*Test757# AClass::ANamespace, ANamespace::*Test
759758
760EXCLUDE_SYMBOLS = android google mfd mgg mp759EXCLUDE_SYMBOLS = android \
760 google \
761 mfd \
762 mgg \
763 mp
761764
762# The EXAMPLE_PATH tag can be used to specify one or more files or765# The EXAMPLE_PATH tag can be used to specify one or more files or
763# directories that contain example code fragments that are included (see766# directories that contain example code fragments that are included (see
@@ -790,14 +793,19 @@
790# by executing (via popen()) the command <filter> <input-file>, where <filter>793# by executing (via popen()) the command <filter> <input-file>, where <filter>
791# is the value of the INPUT_FILTER tag, and <input-file> is the name of an794# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
792# input file. Doxygen will then use the output that the filter program writes795# input file. Doxygen will then use the output that the filter program writes
793# to standard output. If FILTER_PATTERNS is specified, this tag will be796# to standard output.
794# ignored.797# If FILTER_PATTERNS is specified, this tag will be ignored.
798# Note that the filter must not add or remove lines; it is applied before the
799# code is scanned, but not when the output code is generated. If lines are added
800# or removed, the anchors will not be placed correctly.
795801
796INPUT_FILTER =802INPUT_FILTER =
797803
798# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern804# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
799# basis. Doxygen will compare the file name with each pattern and apply the805# basis.
800# filter if there is a match. The filters are a list of the form:806# Doxygen will compare the file name with each pattern and apply the
807# filter if there is a match.
808# The filters are a list of the form:
801# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further809# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
802# info on how filters are used. If FILTER_PATTERNS is empty or if810# info on how filters are used. If FILTER_PATTERNS is empty or if
803# non of the patterns match the file name, INPUT_FILTER is applied.811# non of the patterns match the file name, INPUT_FILTER is applied.
@@ -818,6 +826,13 @@
818826
819FILTER_SOURCE_PATTERNS =827FILTER_SOURCE_PATTERNS =
820828
829# If the USE_MD_FILE_AS_MAINPAGE tag refers to the name of a markdown file that
830# is part of the input, its contents will be placed on the main page
831# (index.html). This can be useful if you have a project on for instance GitHub
832# and want reuse the introduction page also for the doxygen output.
833
834USE_MDFILE_AS_MAINPAGE =
835
821#---------------------------------------------------------------------------836#---------------------------------------------------------------------------
822# configuration options related to source browsing837# configuration options related to source browsing
823#---------------------------------------------------------------------------838#---------------------------------------------------------------------------
@@ -855,7 +870,8 @@
855# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)870# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
856# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from871# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
857# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will872# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
858# link to the source code. Otherwise they will link to the documentation.873# link to the source code.
874# Otherwise they will link to the documentation.
859875
860REFERENCES_LINK_SOURCE = YES876REFERENCES_LINK_SOURCE = YES
861877
@@ -920,7 +936,7 @@
920# The HTML_HEADER tag can be used to specify a personal HTML header for936# The HTML_HEADER tag can be used to specify a personal HTML header for
921# each generated HTML page. If it is left blank doxygen will generate a937# each generated HTML page. If it is left blank doxygen will generate a
922# standard header. Note that when using a custom header you are responsible938# standard header. Note that when using a custom header you are responsible
923# for the proper inclusion of any scripts and style sheets that doxygen939# for the proper inclusion of any scripts and style sheets that doxygen
924# needs, which is dependent on the configuration options used.940# needs, which is dependent on the configuration options used.
925# It is advised to generate a default header using "doxygen -w html941# It is advised to generate a default header using "doxygen -w html
926# header.html footer.html stylesheet.css YourConfigFile" and then modify942# header.html footer.html stylesheet.css YourConfigFile" and then modify
@@ -938,18 +954,27 @@
938954
939# The HTML_STYLESHEET tag can be used to specify a user-defined cascading955# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
940# style sheet that is used by each HTML page. It can be used to956# style sheet that is used by each HTML page. It can be used to
941# fine-tune the look of the HTML output. If the tag is left blank doxygen957# fine-tune the look of the HTML output. If left blank doxygen will
942# will generate a default style sheet. Note that doxygen will try to copy958# generate a default style sheet. Note that it is recommended to use
943# the style sheet file to the HTML output directory, so don't put your own959# HTML_EXTRA_STYLESHEET instead of this one, as it is more robust and this
944# style sheet in the HTML output directory as well, or it will be erased!960# tag will in the future become obsolete.
945961
946HTML_STYLESHEET =962HTML_STYLESHEET =
963
964# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional
965# user-defined cascading style sheet that is included after the standard
966# style sheets created by doxygen. Using this option one can overrule
967# certain style aspects. This is preferred over using HTML_STYLESHEET
968# since it does not replace the standard style sheet and is therefor more
969# robust against future updates. Doxygen will copy the style sheet file to
970# the output directory.
971
947HTML_EXTRA_STYLESHEET = @CMAKE_BINARY_DIR@/doc/extra.css972HTML_EXTRA_STYLESHEET = @CMAKE_BINARY_DIR@/doc/extra.css
948973
949# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or974# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
950# other source files which should be copied to the HTML output directory. Note975# other source files which should be copied to the HTML output directory. Note
951# that these files will be copied to the base HTML output directory. Use the976# that these files will be copied to the base HTML output directory. Use the
952# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these977# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
953# files. In the HTML_STYLESHEET file, use the file name only. Also note that978# files. In the HTML_STYLESHEET file, use the file name only. Also note that
954# the files will be copied as-is; there are no commands or markers available.979# the files will be copied as-is; there are no commands or markers available.
955980
@@ -1030,9 +1055,9 @@
10301055
1031DOCSET_BUNDLE_ID = org.doxygen.Project1056DOCSET_BUNDLE_ID = org.doxygen.Project
10321057
1033# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify1058# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely
1034# the documentation publisher. This should be a reverse domain-name style1059# identify the documentation publisher. This should be a reverse domain-name
1035# string, e.g. com.mycompany.MyDocSet.documentation.1060# style string, e.g. com.mycompany.MyDocSet.documentation.
10361061
1037DOCSET_PUBLISHER_ID = org.doxygen.Publisher1062DOCSET_PUBLISHER_ID = org.doxygen.Publisher
10381063
@@ -1138,7 +1163,7 @@
1138QHG_LOCATION =1163QHG_LOCATION =
11391164
1140# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files1165# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
1141# will be generated, which together with the HTML files, form an Eclipse help1166# will be generated, which together with the HTML files, form an Eclipse help
1142# plugin. To install this plugin and make it available under the help contents1167# plugin. To install this plugin and make it available under the help contents
1143# menu in Eclipse, the contents of the directory containing the HTML and XML1168# menu in Eclipse, the contents of the directory containing the HTML and XML
1144# files needs to be copied into the plugins directory of eclipse. The name of1169# files needs to be copied into the plugins directory of eclipse. The name of
@@ -1217,13 +1242,21 @@
12171242
1218USE_MATHJAX = NO1243USE_MATHJAX = NO
12191244
1245# When MathJax is enabled you can set the default output format to be used for
1246# the MathJax output. Supported types are HTML-CSS, NativeMML (i.e. MathML) and
1247# SVG. The default value is HTML-CSS, which is slower, but has the best
1248# compatibility.
1249
1250MATHJAX_FORMAT = HTML-CSS
1251
1220# When MathJax is enabled you need to specify the location relative to the1252# When MathJax is enabled you need to specify the location relative to the
1221# HTML output directory using the MATHJAX_RELPATH option. The destination1253# HTML output directory using the MATHJAX_RELPATH option. The destination
1222# directory should contain the MathJax.js script. For instance, if the mathjax1254# directory should contain the MathJax.js script. For instance, if the mathjax
1223# directory is located at the same level as the HTML output directory, then1255# directory is located at the same level as the HTML output directory, then
1224# MATHJAX_RELPATH should be ../mathjax. The default value points to1256# MATHJAX_RELPATH should be ../mathjax. The default value points to
1225# the MathJax Content Delivery Network so you can quickly see the result without1257# the MathJax Content Delivery Network so you can quickly see the result without
1226# installing MathJax. However, it is strongly recommended to install a local1258# installing MathJax.
1259# However, it is strongly recommended to install a local
1227# copy of MathJax from http://www.mathjax.org before deployment.1260# copy of MathJax from http://www.mathjax.org before deployment.
12281261
1229MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest1262MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
@@ -1233,6 +1266,11 @@
12331266
1234MATHJAX_EXTENSIONS =1267MATHJAX_EXTENSIONS =
12351268
1269# The MATHJAX_CODEFILE tag can be used to specify a file with javascript
1270# pieces of code that will be used on startup of the MathJax code.
1271
1272MATHJAX_CODEFILE =
1273
1236# When the SEARCHENGINE tag is enabled doxygen will generate a search box1274# When the SEARCHENGINE tag is enabled doxygen will generate a search box
1237# for the HTML output. The underlying search engine uses javascript1275# for the HTML output. The underlying search engine uses javascript
1238# and DHTML and should work on any modern browser. Note that when using1276# and DHTML and should work on any modern browser. Note that when using
@@ -1244,15 +1282,55 @@
1244SEARCHENGINE = YES1282SEARCHENGINE = YES
12451283
1246# When the SERVER_BASED_SEARCH tag is enabled the search engine will be1284# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
1247# implemented using a PHP enabled web server instead of at the web client1285# implemented using a web server instead of a web client using Javascript.
1248# using Javascript. Doxygen will generate the search PHP script and index1286# There are two flavours of web server based search depending on the
1249# file to put on the web server. The advantage of the server1287# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for
1250# based approach is that it scales better to large projects and allows1288# searching and an index file used by the script. When EXTERNAL_SEARCH is
1251# full text search. The disadvantages are that it is more difficult to setup1289# enabled the indexing and searching needs to be provided by external tools.
1252# and does not have live searching capabilities.1290# See the manual for details.
12531291
1254SERVER_BASED_SEARCH = NO1292SERVER_BASED_SEARCH = NO
12551293
1294# When EXTERNAL_SEARCH is enabled doxygen will no longer generate the PHP
1295# script for searching. Instead the search results are written to an XML file
1296# which needs to be processed by an external indexer. Doxygen will invoke an
1297# external search engine pointed to by the SEARCHENGINE_URL option to obtain
1298# the search results. Doxygen ships with an example indexer (doxyindexer) and
1299# search engine (doxysearch.cgi) which are based on the open source search
1300# engine library Xapian. See the manual for configuration details.
1301
1302EXTERNAL_SEARCH = NO
1303
1304# The SEARCHENGINE_URL should point to a search engine hosted by a web server
1305# which will returned the search results when EXTERNAL_SEARCH is enabled.
1306# Doxygen ships with an example search engine (doxysearch) which is based on
1307# the open source search engine library Xapian. See the manual for configuration
1308# details.
1309
1310SEARCHENGINE_URL =
1311
1312# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
1313# search data is written to a file for indexing by an external tool. With the
1314# SEARCHDATA_FILE tag the name of this file can be specified.
1315
1316SEARCHDATA_FILE = searchdata.xml
1317
1318# When SERVER_BASED_SEARCH AND EXTERNAL_SEARCH are both enabled the
1319# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
1320# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
1321# projects and redirect the results back to the right project.
1322
1323EXTERNAL_SEARCH_ID =
1324
1325# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
1326# projects other than the one defined by this configuration file, but that are
1327# all added to the same external search index. Each project needs to have a
1328# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id
1329# of to a relative location where the documentation can be found.
1330# The format is: EXTRA_SEARCH_MAPPINGS = id1=loc1 id2=loc2 ...
1331
1332EXTRA_SEARCH_MAPPINGS =
1333
1256#---------------------------------------------------------------------------1334#---------------------------------------------------------------------------
1257# configuration options related to the LaTeX output1335# configuration options related to the LaTeX output
1258#---------------------------------------------------------------------------1336#---------------------------------------------------------------------------
@@ -1290,7 +1368,7 @@
12901368
1291# The PAPER_TYPE tag can be used to set the paper type that is used1369# The PAPER_TYPE tag can be used to set the paper type that is used
1292# by the printer. Possible values are: a4, letter, legal and1370# by the printer. Possible values are: a4, letter, legal and
1293# executive. If left blank a4wide will be used.1371# executive. If left blank a4 will be used.
12941372
1295PAPER_TYPE = a41373PAPER_TYPE = a4
12961374
@@ -1313,6 +1391,13 @@
13131391
1314LATEX_FOOTER =1392LATEX_FOOTER =
13151393
1394# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images
1395# or other source files which should be copied to the LaTeX output directory.
1396# Note that the files will be copied as-is; there are no commands or markers
1397# available.
1398
1399LATEX_EXTRA_FILES =
1400
1316# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated1401# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
1317# is prepared for conversion to pdf (using ps2pdf). The pdf file will1402# is prepared for conversion to pdf (using ps2pdf). The pdf file will
1318# contain links (just like the HTML output) instead of page references1403# contain links (just like the HTML output) instead of page references
@@ -1458,6 +1543,21 @@
1458XML_PROGRAMLISTING = YES1543XML_PROGRAMLISTING = YES
14591544
1460#---------------------------------------------------------------------------1545#---------------------------------------------------------------------------
1546# configuration options related to the DOCBOOK output
1547#---------------------------------------------------------------------------
1548
1549# If the GENERATE_DOCBOOK tag is set to YES Doxygen will generate DOCBOOK files
1550# that can be used to generate PDF.
1551
1552GENERATE_DOCBOOK = NO
1553
1554# The DOCBOOK_OUTPUT tag is used to specify where the DOCBOOK pages will be put.
1555# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in
1556# front of it. If left blank docbook will be used as the default path.
1557
1558DOCBOOK_OUTPUT = docbook
1559
1560#---------------------------------------------------------------------------
1461# configuration options for the AutoGen Definitions output1561# configuration options for the AutoGen Definitions output
1462#---------------------------------------------------------------------------1562#---------------------------------------------------------------------------
14631563
@@ -1488,8 +1588,10 @@
1488PERLMOD_LATEX = NO1588PERLMOD_LATEX = NO
14891589
1490# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be1590# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
1491# nicely formatted so it can be parsed by a human reader. This is useful1591# nicely formatted so it can be parsed by a human reader.
1492# if you want to understand what is going on. On the other hand, if this1592# This is useful
1593# if you want to understand what is going on.
1594# On the other hand, if this
1493# tag is set to NO the size of the Perl module output will be much smaller1595# tag is set to NO the size of the Perl module output will be much smaller
1494# and Perl will parse it just the same.1596# and Perl will parse it just the same.
14951597
@@ -1575,9 +1677,11 @@
1575# The TAGFILES option can be used to specify one or more tagfiles. For each1677# The TAGFILES option can be used to specify one or more tagfiles. For each
1576# tag file the location of the external documentation should be added. The1678# tag file the location of the external documentation should be added. The
1577# format of a tag file without this location is as follows:1679# format of a tag file without this location is as follows:
1578# TAGFILES = file1 file2 ...1680#
1681# TAGFILES = file1 file2 ...
1579# Adding location for the tag files is done as follows:1682# Adding location for the tag files is done as follows:
1580# TAGFILES = file1=loc1 "file2 = loc2" ...1683#
1684# TAGFILES = file1=loc1 "file2 = loc2" ...
1581# where "loc1" and "loc2" can be relative or absolute paths1685# where "loc1" and "loc2" can be relative or absolute paths
1582# or URLs. Note that each tag file must have a unique name (where the name does1686# or URLs. Note that each tag file must have a unique name (where the name does
1583# NOT include the path). If a tag file is not located in the directory in which1687# NOT include the path). If a tag file is not located in the directory in which
@@ -1602,6 +1706,12 @@
16021706
1603EXTERNAL_GROUPS = YES1707EXTERNAL_GROUPS = YES
16041708
1709# If the EXTERNAL_PAGES tag is set to YES all external pages will be listed
1710# in the related pages index. If set to NO, only the current project's
1711# pages will be listed.
1712
1713EXTERNAL_PAGES = YES
1714
1605# The PERL_PATH should be the absolute path and name of the perl script1715# The PERL_PATH should be the absolute path and name of the perl script
1606# interpreter (i.e. the result of `which perl').1716# interpreter (i.e. the result of `which perl').
16071717
@@ -1698,7 +1808,7 @@
1698# the class node. If there are many fields or methods and many nodes the1808# the class node. If there are many fields or methods and many nodes the
1699# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS1809# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS
1700# threshold limits the number of items for each type to make the size more1810# threshold limits the number of items for each type to make the size more
1701# managable. Set this to 0 for no limit. Note that the threshold may be1811# manageable. Set this to 0 for no limit. Note that the threshold may be
1702# exceeded by 50% before the limit is enforced.1812# exceeded by 50% before the limit is enforced.
17031813
1704UML_LIMIT_NUM_FIELDS = 101814UML_LIMIT_NUM_FIELDS = 10
17051815
=== modified file 'doc/component_reports.md'
--- doc/component_reports.md 2013-11-06 03:17:35 +0000
+++ doc/component_reports.md 2013-11-21 20:19:28 +0000
@@ -40,6 +40,7 @@
40Report | Handlers40Report | Handlers
41------------------- | --------41------------------- | --------
42rpc-report | log,lttng42rpc-report | log,lttng
43input-receiver | log
4344
44For example, to enable the logging RPC report, one should set the45For example, to enable the logging RPC report, one should set the
45`MIR_CLIENT_RPC_REPORT=log` environment variable.46`MIR_CLIENT_RPC_REPORT=log` environment variable.
4647
=== modified file 'doc/installing_prebuilt_on_pc.md'
--- doc/installing_prebuilt_on_pc.md 2013-11-06 03:17:35 +0000
+++ doc/installing_prebuilt_on_pc.md 2013-11-21 20:19:28 +0000
@@ -4,7 +4,12 @@
4Install Ubuntu 13.10 or later if you haven't done so already. Uninstall any4Install Ubuntu 13.10 or later if you haven't done so already. Uninstall any
5proprietary drivers (-nvidia, -fglrx) and reboot on the FOSS drivers.5proprietary drivers (-nvidia, -fglrx) and reboot on the FOSS drivers.
66
7Install Mir:7Install Mir in Ubuntu 13.10:
88
9 sudo apt-get update9 sudo apt-get update
10 sudo apt-get install mir-demos unity-system-compositor10 sudo apt-get install mir-demos unity-system-compositor
11
12Install Mir in Ubuntu 14.04 or later:
13
14 sudo apt-get update
15 sudo apt-get install mir-demos ubuntu-desktop-mir
1116
=== modified file 'doc/using_mir_on_pc.md'
--- doc/using_mir_on_pc.md 2013-11-06 03:17:35 +0000
+++ doc/using_mir_on_pc.md 2013-11-21 20:19:28 +0000
@@ -28,6 +28,7 @@
28-------------------------------------28-------------------------------------
2929
30Note: for this to work you need to have Mir and all its dependencies (which30Note: for this to work you need to have Mir and all its dependencies (which
31<<<<<<< TREE
31include lightdm, Mesa and the Xorg drivers). The easiest way is to run Ubuntu32include lightdm, Mesa and the Xorg drivers). The easiest way is to run Ubuntu
3213.10 or later.3313.10 or later.
3334
@@ -37,6 +38,19 @@
37system compositor, create the file38system compositor, create the file
38/etc/lightdm/lightdm.conf.d/10-unity-system-compositor.conf to look to look like39/etc/lightdm/lightdm.conf.d/10-unity-system-compositor.conf to look to look like
39this:40this:
41=======
42include lightdm, Mesa and the Xorg drivers). The easiest way is to run Ubuntu
4313.10 or later.
44
45If you are running Ubuntu 13.10, additionally install unity-system-compositor.
46If you are running Ubuntu 14.04 or later, instead install ubuntu-desktop-mir.
47These packages will install dependencies you need and will create a file in
48/etc/lightdm/lightdm.conf.d/10-unity-system-compositor.conf.
49
50If you have instead built from source, to set up the system compositor, create
51/etc/lightdm/lightdm.conf.d/10-unity-system-compositor.conf yourself and make
52it look like this:
53>>>>>>> MERGE-SOURCE
4054
41 [SeatDefaults]55 [SeatDefaults]
42 type=unity56 type=unity
4357
=== modified file 'examples/CMakeLists.txt'
--- examples/CMakeLists.txt 2013-09-23 13:37:44 +0000
+++ examples/CMakeLists.txt 2013-11-21 20:19:28 +0000
@@ -114,6 +114,7 @@
114target_link_libraries(mir_demo_standalone_render_surfaces114target_link_libraries(mir_demo_standalone_render_surfaces
115 mirserver115 mirserver
116 mirshell116 mirshell
117 mirsharedgeometry
117 ${Boost_LIBRARIES}118 ${Boost_LIBRARIES}
118)119)
119120
120121
=== modified file 'examples/buffer_render_target.cpp'
--- examples/buffer_render_target.cpp 2013-08-28 03:41:48 +0000
+++ examples/buffer_render_target.cpp 2013-11-21 20:19:28 +0000
@@ -27,7 +27,7 @@
27namespace mt = mir::tools;27namespace mt = mir::tools;
2828
29mt::BufferRenderTarget::BufferRenderTarget(mg::Buffer& buffer)29mt::BufferRenderTarget::BufferRenderTarget(mg::Buffer& buffer)
30 : buffer(buffer)30 : buffer(buffer), old_fbo(), old_viewport()
31{31{
32 /*32 /*
33 * With the new lazy buffer allocation method, we may be executing inside33 * With the new lazy buffer allocation method, we may be executing inside
@@ -35,12 +35,14 @@
35 * we change...35 * we change...
36 */36 */
37 glGetIntegerv(GL_VIEWPORT, old_viewport);37 glGetIntegerv(GL_VIEWPORT, old_viewport);
38 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &old_fbo);
38 resources.setup(buffer);39 resources.setup(buffer);
39}40}
4041
41mt::BufferRenderTarget::~BufferRenderTarget()42mt::BufferRenderTarget::~BufferRenderTarget()
42{43{
43 glFinish();44 glFinish();
45 glBindFramebuffer(GL_FRAMEBUFFER, old_fbo);
44 glViewport(old_viewport[0], old_viewport[1],46 glViewport(old_viewport[0], old_viewport[1],
45 old_viewport[2], old_viewport[3]);47 old_viewport[2], old_viewport[3]);
46}48}
4749
=== modified file 'examples/buffer_render_target.h'
--- examples/buffer_render_target.h 2013-08-28 03:41:48 +0000
+++ examples/buffer_render_target.h 2013-11-21 20:19:28 +0000
@@ -58,6 +58,7 @@
5858
59 Resources resources;59 Resources resources;
60 mir::graphics::Buffer& buffer;60 mir::graphics::Buffer& buffer;
61 GLint old_fbo;
61 GLint old_viewport[4];62 GLint old_viewport[4];
62};63};
6364
6465
=== modified file 'examples/demo-inprocess-surface-client/inprocess_egl_client.cpp'
--- examples/demo-inprocess-surface-client/inprocess_egl_client.cpp 2013-11-06 03:17:35 +0000
+++ examples/demo-inprocess-surface-client/inprocess_egl_client.cpp 2013-11-21 20:19:28 +0000
@@ -20,8 +20,13 @@
20#include "example_egl_helper.h"20#include "example_egl_helper.h"
2121
22#include "mir/main_loop.h"22#include "mir/main_loop.h"
23<<<<<<< TREE
23#include "mir/shell/focus_controller.h"24#include "mir/shell/focus_controller.h"
24#include "mir/shell/surface.h"25#include "mir/shell/surface.h"
26=======
27#include "mir/shell/focus_controller.h"
28#include "mir/frontend/surface.h"
29>>>>>>> MERGE-SOURCE
25#include "mir/shell/surface_creation_parameters.h"30#include "mir/shell/surface_creation_parameters.h"
26#include "mir/shell/session.h"31#include "mir/shell/session.h"
27#include "mir/frontend/session.h"32#include "mir/frontend/session.h"
@@ -47,7 +52,6 @@
47#include <signal.h>52#include <signal.h>
4853
49namespace mf = mir::frontend;54namespace mf = mir::frontend;
50namespace mc = mir::compositor;
51namespace msh = mir::shell;55namespace msh = mir::shell;
52namespace mg = mir::graphics;56namespace mg = mir::graphics;
53namespace me = mir::examples;57namespace me = mir::examples;
5458
=== modified file 'examples/demo-shell/demo_shell.cpp'
--- examples/demo-shell/demo_shell.cpp 2013-11-06 03:17:35 +0000
+++ examples/demo-shell/demo_shell.cpp 2013-11-21 20:19:28 +0000
@@ -24,7 +24,10 @@
2424
25#include "mir/run_mir.h"25#include "mir/run_mir.h"
26#include "mir/report_exception.h"26#include "mir/report_exception.h"
27<<<<<<< TREE
27#include "mir/shell/session_container.h"28#include "mir/shell/session_container.h"
29=======
30>>>>>>> MERGE-SOURCE
28#include "mir/graphics/display.h"31#include "mir/graphics/display.h"
29#include "mir/input/composite_event_filter.h"32#include "mir/input/composite_event_filter.h"
3033
3134
=== modified file 'examples/demo-shell/window_manager.cpp'
--- examples/demo-shell/window_manager.cpp 2013-11-06 03:17:35 +0000
+++ examples/demo-shell/window_manager.cpp 2013-11-21 20:19:28 +0000
@@ -14,6 +14,7 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *15 *
16 * Authored by: Robert Carr <robert.carr@canonical.com>16 * Authored by: Robert Carr <robert.carr@canonical.com>
17 * Daniel van Vugt <daniel.van.vugt@canonical.com>
17 */18 */
1819
19#include "window_manager.h"20#include "window_manager.h"
@@ -29,6 +30,7 @@
2930
30#include <cassert>31#include <cassert>
31#include <cstdlib>32#include <cstdlib>
33#include <cmath>
3234
33namespace me = mir::examples;35namespace me = mir::examples;
34namespace msh = mir::shell;36namespace msh = mir::shell;
@@ -41,7 +43,7 @@
41}43}
4244
43me::WindowManager::WindowManager()45me::WindowManager::WindowManager()
44 : max_fingers(0)46 : old_pinch_diam(0.0f), max_fingers(0)
45{47{
46}48}
4749
@@ -60,6 +62,9 @@
60 compositor = cptor;62 compositor = cptor;
61}63}
6264
65namespace
66{
67
63mir::geometry::Point average_pointer(MirMotionEvent const& motion)68mir::geometry::Point average_pointer(MirMotionEvent const& motion)
64{69{
65 using namespace mir;70 using namespace mir;
@@ -79,6 +84,36 @@
79 return Point{x, y};84 return Point{x, y};
80}85}
8186
87float measure_pinch(MirMotionEvent const& motion,
88 mir::geometry::Displacement& dir)
89{
90 int count = static_cast<int>(motion.pointer_count);
91 int max = 0;
92
93 for (int i = 0; i < count; i++)
94 {
95 for (int j = 0; j < i; j++)
96 {
97 int dx = motion.pointer_coordinates[i].x -
98 motion.pointer_coordinates[j].x;
99 int dy = motion.pointer_coordinates[i].y -
100 motion.pointer_coordinates[j].y;
101
102 int sqr = dx*dx + dy*dy;
103
104 if (sqr > max)
105 {
106 max = sqr;
107 dir = mir::geometry::Displacement{dx, dy};
108 }
109 }
110 }
111
112 return sqrtf(max); // return pinch diameter
113}
114
115} // namespace
116
82bool me::WindowManager::handle(MirEvent const& event)117bool me::WindowManager::handle(MirEvent const& event)
83{118{
84 // TODO: Fix android configuration and remove static hack ~racarr119 // TODO: Fix android configuration and remove static hack ~racarr
@@ -87,6 +122,8 @@
87 assert(display);122 assert(display);
88 assert(compositor);123 assert(compositor);
89124
125 bool handled = false;
126
90 if (event.key.type == mir_event_type_key &&127 if (event.key.type == mir_event_type_key &&
91 event.key.action == mir_key_action_down)128 event.key.action == mir_key_action_down)
92 {129 {
@@ -148,22 +185,73 @@
148 (event.motion.modifiers & mir_key_modifier_alt ||185 (event.motion.modifiers & mir_key_modifier_alt ||
149 fingers >= 3))186 fingers >= 3))
150 {187 {
188 geometry::Displacement pinch_dir;
189 auto pinch_diam =
190 measure_pinch(event.motion, pinch_dir);
191
151 // Start of a gesture: When the latest finger/button goes down192 // Start of a gesture: When the latest finger/button goes down
152 if (action == mir_motion_action_down ||193 if (action == mir_motion_action_down ||
153 action == mir_motion_action_pointer_down)194 action == mir_motion_action_pointer_down)
154 {195 {
155 relative_click = cursor - surf->top_left();
156 click = cursor;196 click = cursor;
157 }197 handled = true;
158 else if (event.motion.action == mir_motion_action_move)198 }
159 { // Movement is happening with one or more fingers/button down199 else if (event.motion.action == mir_motion_action_move &&
160 geometry::Point abs = cursor - relative_click;200 max_fingers <= 3) // Avoid accidental movement
161 if (max_fingers <= 3) // Avoid accidental movement201 {
162 {202 geometry::Displacement drag = cursor - old_cursor;
163 surf->move_to(abs);203
164 return true;204 if (event.motion.button_state ==
165 }205 mir_motion_button_tertiary)
166 }206 { // Resize by mouse middle button
207 int width = old_size.width.as_int() +
208 drag.dx.as_int();
209 int height = old_size.height.as_int() +
210 drag.dy.as_int();
211 if (width <= 0) width = 1;
212 if (height <= 0) height = 1;
213 surf->resize({width, height});
214 }
215 else
216 { // Move surface (by mouse or 3 fingers)
217 surf->move_to(old_pos + drag);
218 }
219
220 if (fingers == 3)
221 { // Resize by pinch/zoom
222 float diam_delta = pinch_diam - old_pinch_diam;
223 /*
224 * Resize vector (dx,dy) has length=diam_delta and
225 * direction=pinch_dir, so solve for (dx,dy)...
226 */
227 float lenlen = diam_delta * diam_delta;
228 int x = pinch_dir.dx.as_int();
229 int y = pinch_dir.dy.as_int();
230 int xx = x * x;
231 int yy = y * y;
232 int xxyy = xx + yy;
233 int dx = sqrtf(lenlen * xx / xxyy);
234 int dy = sqrtf(lenlen * yy / xxyy);
235 if (diam_delta < 0.0f)
236 {
237 dx = -dx;
238 dy = -dy;
239 }
240
241 int width = old_size.width.as_int() + dx;
242 int height = old_size.height.as_int() + dy;
243 if (width <= 0) width = 1;
244 if (height <= 0) height = 1;
245 surf->resize({width, height});
246 }
247
248 handled = true;
249 }
250
251 old_pos = surf->top_left();
252 old_size = surf->size();
253 old_pinch_diam = pinch_diam;
254 old_cursor = cursor;
167 }255 }
168 }256 }
169257
@@ -173,9 +261,9 @@
173 if (abs(dir.dx.as_int()) >= min_swipe_distance)261 if (abs(dir.dx.as_int()) >= min_swipe_distance)
174 {262 {
175 focus_controller->focus_next();263 focus_controller->focus_next();
176 return true;264 handled = true;
177 }265 }
178 }266 }
179 }267 }
180 return false;268 return handled;
181}269}
182270
=== modified file 'examples/demo-shell/window_manager.h'
--- examples/demo-shell/window_manager.h 2013-11-06 03:17:35 +0000
+++ examples/demo-shell/window_manager.h 2013-11-21 20:19:28 +0000
@@ -21,6 +21,7 @@
2121
22#include "mir/input/event_filter.h"22#include "mir/input/event_filter.h"
23#include "mir/geometry/displacement.h"23#include "mir/geometry/displacement.h"
24#include "mir/geometry/size.h"
2425
25#include <memory>26#include <memory>
2627
@@ -62,8 +63,11 @@
62 std::shared_ptr<graphics::Display> display;63 std::shared_ptr<graphics::Display> display;
63 std::shared_ptr<compositor::Compositor> compositor;64 std::shared_ptr<compositor::Compositor> compositor;
6465
65 geometry::Displacement relative_click; // Click location in window space66 geometry::Point click;
66 geometry::Point click; // Click location in screen space67 geometry::Point old_pos;
68 geometry::Point old_cursor;
69 geometry::Size old_size;
70 float old_pinch_diam;
67 int max_fingers; // Maximum number of fingers touched during gesture71 int max_fingers; // Maximum number of fingers touched during gesture
68};72};
6973
7074
=== modified file 'examples/demo_input_filter.cpp'
--- examples/demo_input_filter.cpp 2013-08-28 03:41:48 +0000
+++ examples/demo_input_filter.cpp 2013-11-21 20:19:28 +0000
@@ -32,6 +32,21 @@
3232
33struct PrintingEventFilter : public mi::EventFilter33struct PrintingEventFilter : public mi::EventFilter
34{34{
35 void print_motion_event(MirMotionEvent const& ev)
36 {
37 std::cout << "Motion Event time=" << ev.event_time
38 << " pointer_count=" << ev.pointer_count << std::endl;
39
40 for (size_t i = 0; i < ev.pointer_count; ++i)
41 {
42 std::cout << " "
43 << " id=" << ev.pointer_coordinates[i].id
44 << " pos=(" << ev.pointer_coordinates[i].x << ", " << ev.pointer_coordinates[i].y << ")"
45 << std::endl;
46 }
47 std::cout << "----------------" << std::endl << std::endl;
48 }
49
35 bool handle(MirEvent const& ev) override50 bool handle(MirEvent const& ev) override
36 {51 {
37 // TODO: Enhance printing52 // TODO: Enhance printing
@@ -42,8 +57,7 @@
42 }57 }
43 else if (ev.type == mir_event_type_motion)58 else if (ev.type == mir_event_type_motion)
44 {59 {
45 std::cout << "Handling motion event (time, pointer0_x, pointer0_y): " << ev.motion.event_time << " "60 print_motion_event(ev.motion);
46 << ev.motion.pointer_coordinates[0].x << " " << ev.motion.pointer_coordinates[0].y << std::endl;
47 }61 }
48 return false;62 return false;
49 }63 }
@@ -56,7 +70,7 @@
56 event_filter(std::make_shared<PrintingEventFilter>())70 event_filter(std::make_shared<PrintingEventFilter>())
57 {71 {
58 }72 }
59 73
60 std::shared_ptr<mi::CompositeEventFilter> the_composite_event_filter() override74 std::shared_ptr<mi::CompositeEventFilter> the_composite_event_filter() override
61 {75 {
62 auto composite_filter = ServerConfiguration::the_composite_event_filter();76 auto composite_filter = ServerConfiguration::the_composite_event_filter();
@@ -69,10 +83,18 @@
6983
70}84}
7185
86
87#include <std/MirLog.h>
88void my_write_to_log(int /*prio*/, char const* buffer)
89{
90 printf("%s\n", buffer);
91}
92
72int main(int argc, char const* argv[])93int main(int argc, char const* argv[])
73try94try
74{95{
75 DemoServerConfiguration config(argc, argv);96 DemoServerConfiguration config(argc, argv);
97 mir::write_to_log = my_write_to_log;
7698
77 mir::run_mir(config, [](mir::DisplayServer&) {/* empty init */});99 mir::run_mir(config, [](mir::DisplayServer&) {/* empty init */});
78 return 0;100 return 0;
79101
=== modified file 'examples/eglapp.c'
--- examples/eglapp.c 2013-10-07 09:21:27 +0000
+++ examples/eglapp.c 2013-11-21 20:19:28 +0000
@@ -23,6 +23,7 @@
23#include <signal.h>23#include <signal.h>
24#include <time.h>24#include <time.h>
25#include <EGL/egl.h>25#include <EGL/egl.h>
26#include <GLES2/gl2.h>
2627
27#include <xkbcommon/xkbcommon-keysyms.h>28#include <xkbcommon/xkbcommon-keysyms.h>
2829
@@ -75,6 +76,7 @@
75 time_t now = time(NULL);76 time_t now = time(NULL);
76 time_t dtime;77 time_t dtime;
77 int dcount;78 int dcount;
79 EGLint width, height;
7880
79 if (!running)81 if (!running)
80 return;82 return;
@@ -90,6 +92,14 @@
90 lasttime = now;92 lasttime = now;
91 lastcount = count;93 lastcount = count;
92 }94 }
95
96 /* This is one way to handle window resizing. But in future it would be
97 better to have resize events coming from the server */
98 if (eglQuerySurface(egldisplay, eglsurface, EGL_WIDTH, &width) &&
99 eglQuerySurface(egldisplay, eglsurface, EGL_HEIGHT, &height))
100 {
101 glViewport(0, 0, width, height);
102 }
93}103}
94104
95static void mir_eglapp_handle_input(MirSurface* surface, MirEvent const* ev, void* context)105static void mir_eglapp_handle_input(MirSurface* surface, MirEvent const* ev, void* context)
@@ -300,12 +310,11 @@
300310
301 const MirDisplayMode *mode = &output->modes[output->current_mode];311 const MirDisplayMode *mode = &output->modes[output->current_mode];
302312
303 const unsigned int max_formats = 10;313 unsigned int format[mir_pixel_formats];
304 unsigned int format[max_formats];
305 unsigned int nformats;314 unsigned int nformats;
306315
307 mir_connection_get_available_surface_formats(connection,316 mir_connection_get_available_surface_formats(connection,
308 format, max_formats, &nformats);317 format, mir_pixel_formats, &nformats);
309318
310 surfaceparm.pixel_format = format[0];319 surfaceparm.pixel_format = format[0];
311 for (unsigned int f = 0; f < nformats; f++)320 for (unsigned int f = 0; f < nformats; f++)
@@ -322,18 +331,17 @@
322 }331 }
323 }332 }
324333
325 printf("Connected to display: resolution (%dx%d), position(%dx%d), "334 printf("Current active output is %dx%d %+d%+d\n",
326 "supports %d pixel formats\n",
327 mode->horizontal_resolution, mode->vertical_resolution,335 mode->horizontal_resolution, mode->vertical_resolution,
328 output->position_x, output->position_y,336 output->position_x, output->position_y);
329 output->num_output_formats);
330337
331 surfaceparm.width = *width > 0 ? *width : mode->horizontal_resolution;338 surfaceparm.width = *width > 0 ? *width : mode->horizontal_resolution;
332 surfaceparm.height = *height > 0 ? *height : mode->vertical_resolution;339 surfaceparm.height = *height > 0 ? *height : mode->vertical_resolution;
333340
334 mir_display_config_destroy(display_config);341 mir_display_config_destroy(display_config);
335342
336 printf("Using pixel format #%d\n", surfaceparm.pixel_format);343 printf("Server supports %d of %d surface pixel formats. Using format: %d\n",
344 nformats, mir_pixel_formats, surfaceparm.pixel_format);
337 unsigned int bpp = get_bpp(surfaceparm.pixel_format);345 unsigned int bpp = get_bpp(surfaceparm.pixel_format);
338 EGLint attribs[] =346 EGLint attribs[] =
339 {347 {
340348
=== modified file 'examples/progressbar.c'
--- examples/progressbar.c 2013-08-27 08:52:43 +0000
+++ examples/progressbar.c 2013-11-21 20:19:28 +0000
@@ -33,6 +33,12 @@
33 uint8_t r, g, b, a;33 uint8_t r, g, b, a;
34} Color;34} Color;
3535
36static const Color blue = {0, 0, 255, 255};
37static const Color white = {255, 255, 255, 255};
38
39static const Color *const foreground = &white;
40static const Color *const background = &blue;
41
36static volatile sig_atomic_t running = 1;42static volatile sig_atomic_t running = 1;
3743
38static void shutdown(int signum)44static void shutdown(int signum)
@@ -178,6 +184,7 @@
178 MirGraphicsRegion backbuffer;184 MirGraphicsRegion backbuffer;
179185
180 mir_surface_get_graphics_region(surface, &backbuffer);186 mir_surface_get_graphics_region(surface, &backbuffer);
187 clear_region(&backbuffer, background);
181 copy_region(&backbuffer, canvas);188 copy_region(&backbuffer, canvas);
182 mir_surface_swap_buffers_sync(surface);189 mir_surface_swap_buffers_sync(surface);
183}190}
@@ -264,8 +271,6 @@
264 271
265 while (running)272 while (running)
266 {273 {
267 static const Color background = {0, 0, 255, 255};
268 static const Color foreground = {255, 255, 255, 255};
269 static const int width = 8;274 static const int width = 8;
270 static const int space = 1;275 static const int space = 1;
271 const int grid = width + 2 * space;276 const int grid = width + 2 * space;
@@ -275,11 +280,11 @@
275 const int y = (t / row) * grid + space;280 const int y = (t / row) * grid + space;
276281
277 if (t % square == 0)282 if (t % square == 0)
278 clear_region(&canvas, &background);283 clear_region(&canvas, background);
279284
280 t = (t + 1) % square;285 t = (t + 1) % square;
281286
282 draw_box(&canvas, x, y, width, &foreground);287 draw_box(&canvas, x, y, width, foreground);
283288
284 redraw(surf, &canvas);289 redraw(surf, &canvas);
285 usleep(sleep_usec);290 usleep(sleep_usec);
286291
=== modified file 'examples/render_surfaces.cpp'
--- examples/render_surfaces.cpp 2013-11-06 03:17:35 +0000
+++ examples/render_surfaces.cpp 2013-11-21 20:19:28 +0000
@@ -27,8 +27,8 @@
27#include "mir/graphics/cursor.h"27#include "mir/graphics/cursor.h"
28#include "mir/graphics/display.h"28#include "mir/graphics/display.h"
29#include "mir/graphics/display_buffer.h"29#include "mir/graphics/display_buffer.h"
30#include "mir/shell/surface_builder.h"30#include "mir/shell/surface_factory.h"
31#include "mir/surfaces/surface.h"31#include "mir/shell/surface.h"
32#include "mir/run_mir.h"32#include "mir/run_mir.h"
33#include "mir/report_exception.h"33#include "mir/report_exception.h"
3434
@@ -185,13 +185,13 @@
185{185{
186public:186public:
187 Moveable() {}187 Moveable() {}
188 Moveable(ms::Surface& s, const geom::Size& display_size,188 Moveable(std::shared_ptr<msh::Surface> const& s, const geom::Size& display_size,
189 float dx, float dy, const glm::vec3& rotation_axis, float alpha_offset)189 float dx, float dy, const glm::vec3& rotation_axis, float alpha_offset)
190 : surface(&s), display_size(display_size),190 : surface(s), display_size(display_size),
191 x{static_cast<float>(s.top_left().x.as_uint32_t())},191 x{static_cast<float>(s->top_left().x.as_uint32_t())},
192 y{static_cast<float>(s.top_left().y.as_uint32_t())},192 y{static_cast<float>(s->top_left().y.as_uint32_t())},
193 w{static_cast<float>(s.size().width.as_uint32_t())},193 w{static_cast<float>(s->size().width.as_uint32_t())},
194 h{static_cast<float>(s.size().height.as_uint32_t())},194 h{static_cast<float>(s->size().height.as_uint32_t())},
195 dx{dx},195 dx{dx},
196 dy{dy},196 dy{dy},
197 rotation_axis{rotation_axis},197 rotation_axis{rotation_axis},
@@ -233,7 +233,7 @@
233 }233 }
234234
235private:235private:
236 ms::Surface* surface;236 std::shared_ptr<msh::Surface> surface;
237 geom::Size display_size;237 geom::Size display_size;
238 float x;238 float x;
239 float y;239 float y;
@@ -387,7 +387,7 @@
387 std::cout << "Rendering " << moveables.size() << " surfaces" << std::endl;387 std::cout << "Rendering " << moveables.size() << " surfaces" << std::endl;
388388
389 auto const display = the_display();389 auto const display = the_display();
390 auto const surface_builder = the_surface_builder();390 auto const surface_factory = the_surfaces_surface_factory();
391 /* TODO: Get proper configuration */391 /* TODO: Get proper configuration */
392 geom::Rectangles view_area;392 geom::Rectangles view_area;
393 display->for_each_display_buffer([&view_area](mg::DisplayBuffer const& db)393 display->for_each_display_buffer([&view_area](mg::DisplayBuffer const& db)
@@ -406,18 +406,20 @@
406 int i = 0;406 int i = 0;
407 for (auto& m : moveables)407 for (auto& m : moveables)
408 {408 {
409 std::shared_ptr<ms::Surface> s = surface_builder->create_surface(409 auto const s = surface_factory->create_surface(
410 nullptr,410 nullptr,
411 msh::a_surface().of_size(surface_size)411 msh::a_surface().of_size(surface_size)
412 .of_pixel_format(surface_pf)412 .of_pixel_format(surface_pf)
413 .of_buffer_usage(mg::BufferUsage::hardware)413 .of_buffer_usage(mg::BufferUsage::hardware),
414 ).lock();414 mf::SurfaceId(), {});
415415
416 /*416 /*
417 * Let the system know that the surface is suitable for rendering417 * We call advance_client_buffer() twice so that the surface is
418 * (i.e., that it contains buffers with valid contents).418 * considers the first buffer to be posted.
419 * (TODO There must be a better way!)
419 */420 */
420 s->flag_for_render();421 s->advance_client_buffer();
422 s->advance_client_buffer();
421423
422 /*424 /*
423 * Place each surface at a different starting location and give it a425 * Place each surface at a different starting location and give it a
@@ -427,7 +429,7 @@
427 uint32_t const y = h * (0.5 + 0.25 * sin(i * angular_step)) - surface_side / 2.0;429 uint32_t const y = h * (0.5 + 0.25 * sin(i * angular_step)) - surface_side / 2.0;
428430
429 s->move_to({x, y});431 s->move_to({x, y});
430 m = Moveable(*s, display_size,432 m = Moveable(s, display_size,
431 cos(0.1f + i * M_PI / 6.0f) * w / 3.0f,433 cos(0.1f + i * M_PI / 6.0f) * w / 3.0f,
432 sin(0.1f + i * M_PI / 6.0f) * h / 3.0f,434 sin(0.1f + i * M_PI / 6.0f) * h / 3.0f,
433 glm::vec3{(i % 3 == 0) * 1.0f, (i % 3 == 1) * 1.0f, (i % 3 == 2) * 1.0f},435 glm::vec3{(i % 3 == 0) * 1.0f, (i % 3 == 1) * 1.0f, (i % 3 == 2) * 1.0f},
434436
=== modified file 'include/client/mir_toolkit/mir_client_library.h'
--- include/client/mir_toolkit/mir_client_library.h 2013-08-28 03:41:48 +0000
+++ include/client/mir_toolkit/mir_client_library.h 2013-11-21 20:19:28 +0000
@@ -207,7 +207,7 @@
207/**207/**
208 * Set the event handler to be called when events arrive for a surface.208 * Set the event handler to be called when events arrive for a surface.
209 * \warning event_handler could be called from another thread. You must do209 * \warning event_handler could be called from another thread. You must do
210 * and locking appropriate to protect your data accessed in the210 * any locking appropriate to protect your data accessed in the
211 * callback. There is also a chance that different events will be211 * callback. There is also a chance that different events will be
212 * called back in different threads, for the same surface,212 * called back in different threads, for the same surface,
213 * simultaneously.213 * simultaneously.
214214
=== added file 'include/platform/mir/graphics/basic_platform.h'
--- include/platform/mir/graphics/basic_platform.h 1970-01-01 00:00:00 +0000
+++ include/platform/mir/graphics/basic_platform.h 2013-11-21 20:19:28 +0000
@@ -0,0 +1,45 @@
1/*
2 * Copyright © 2013 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
17 */
18
19#ifndef MIR_GRAPHICS_BASIC_PLATFORM_H_
20#define MIR_GRAPHICS_BASIC_PLATFORM_H_
21
22#include <EGL/egl.h>
23
24namespace mir
25{
26namespace graphics
27{
28
29class BasicPlatform
30{
31public:
32 virtual ~BasicPlatform() = default;
33
34 virtual EGLNativeDisplayType egl_native_display() const = 0;
35
36protected:
37 BasicPlatform() = default;
38 BasicPlatform(BasicPlatform const&) = delete;
39 BasicPlatform& operator=(BasicPlatform const&) = delete;
40};
41
42}
43}
44
45#endif /* MIR_GRAPHICS_BASIC_PLATFORM_H_ */
046
=== modified file 'include/platform/mir/graphics/buffer_ipc_packer.h'
--- include/platform/mir/graphics/buffer_ipc_packer.h 2013-09-11 05:21:22 +0000
+++ include/platform/mir/graphics/buffer_ipc_packer.h 2013-11-21 20:19:28 +0000
@@ -20,6 +20,7 @@
20#define MIR_GRAPHICS_BUFFER_IPC_PACKER_H_20#define MIR_GRAPHICS_BUFFER_IPC_PACKER_H_
2121
22#include "mir/geometry/dimensions.h"22#include "mir/geometry/dimensions.h"
23#include "mir/geometry/size.h"
2324
24namespace mir25namespace mir
25{26{
@@ -34,6 +35,7 @@
34 virtual void pack_data(int) = 0;35 virtual void pack_data(int) = 0;
35 virtual void pack_stride(geometry::Stride) = 0;36 virtual void pack_stride(geometry::Stride) = 0;
36 virtual void pack_flags(unsigned int) = 0;37 virtual void pack_flags(unsigned int) = 0;
38 virtual void pack_size(geometry::Size const& size) = 0;
3739
38protected:40protected:
39 BufferIPCPacker() {}41 BufferIPCPacker() {}
4042
=== modified file 'include/platform/mir/graphics/egl_resources.h'
--- include/platform/mir/graphics/egl_resources.h 2013-08-28 03:41:48 +0000
+++ include/platform/mir/graphics/egl_resources.h 2013-11-21 20:19:28 +0000
@@ -30,6 +30,8 @@
30{30{
31public:31public:
32 EGLContextStore(EGLDisplay egl_display, EGLContext egl_context);32 EGLContextStore(EGLDisplay egl_display, EGLContext egl_context);
33 EGLContextStore(EGLContextStore&&);
34
33 ~EGLContextStore() noexcept;35 ~EGLContextStore() noexcept;
3436
35 operator EGLContext() const;37 operator EGLContext() const;
@@ -38,14 +40,18 @@
38 EGLContextStore(EGLContextStore const&) = delete;40 EGLContextStore(EGLContextStore const&) = delete;
39 EGLContextStore& operator=(EGLContextStore const&) = delete;41 EGLContextStore& operator=(EGLContextStore const&) = delete;
4042
41 EGLDisplay const egl_display_;43 EGLDisplay egl_display_;
42 EGLContext const egl_context_;44 EGLContext egl_context_;
43};45};
4446
45class EGLSurfaceStore47class EGLSurfaceStore
46{48{
47public:49public:
50 enum AllowNoSurface { DisallowNoSurface, AllowNoSurface };
51 EGLSurfaceStore(EGLDisplay egl_display, EGLSurface egl_surface,
52 enum AllowNoSurface allow_no_surface);
48 EGLSurfaceStore(EGLDisplay egl_display, EGLSurface egl_surface);53 EGLSurfaceStore(EGLDisplay egl_display, EGLSurface egl_surface);
54 EGLSurfaceStore(EGLSurfaceStore&&);
4955
50 ~EGLSurfaceStore() noexcept;56 ~EGLSurfaceStore() noexcept;
5157
@@ -55,8 +61,8 @@
55 EGLSurfaceStore(EGLSurfaceStore const&) = delete;61 EGLSurfaceStore(EGLSurfaceStore const&) = delete;
56 EGLSurfaceStore& operator=(EGLSurfaceStore const&) = delete;62 EGLSurfaceStore& operator=(EGLSurfaceStore const&) = delete;
5763
58 EGLDisplay const egl_display_;64 EGLDisplay egl_display_;
59 EGLSurface const egl_surface_;65 EGLSurface egl_surface_;
60};66};
6167
62}68}
6369
=== modified file 'include/platform/mir/graphics/native_platform.h'
--- include/platform/mir/graphics/native_platform.h 2013-10-23 09:33:59 +0000
+++ include/platform/mir/graphics/native_platform.h 2013-11-21 20:19:28 +0000
@@ -52,7 +52,7 @@
5252
53 virtual std::shared_ptr<InternalClient> create_internal_client() = 0;53 virtual std::shared_ptr<InternalClient> create_internal_client() = 0;
5454
55 virtual void fill_ipc_package(std::shared_ptr<BufferIPCPacker> const& packer, std::shared_ptr<Buffer> const& buffer) const = 0;55 virtual void fill_ipc_package(BufferIPCPacker* packer, Buffer const* buffer) const = 0;
5656
57 virtual ~NativePlatform() = default;57 virtual ~NativePlatform() = default;
58 NativePlatform(NativePlatform const&) = delete;58 NativePlatform(NativePlatform const&) = delete;
5959
=== modified file 'include/platform/mir/graphics/platform.h'
--- include/platform/mir/graphics/platform.h 2013-08-28 03:41:48 +0000
+++ include/platform/mir/graphics/platform.h 2013-11-21 20:19:28 +0000
@@ -20,6 +20,8 @@
20#ifndef MIR_GRAPHICS_PLATFORM_H_20#ifndef MIR_GRAPHICS_PLATFORM_H_
21#define MIR_GRAPHICS_PLATFORM_H_21#define MIR_GRAPHICS_PLATFORM_H_
2222
23#include "basic_platform.h"
24
23#include <memory>25#include <memory>
2426
25namespace mir27namespace mir
@@ -57,7 +59,7 @@
57 * Interface to platform specific support for graphics operations.59 * Interface to platform specific support for graphics operations.
58 * \ingroup platform_enablement60 * \ingroup platform_enablement
59 */61 */
60class Platform62class Platform : public BasicPlatform
61{63{
62public:64public:
63 Platform() = default;65 Platform() = default;
@@ -97,8 +99,7 @@
97 * \param [in] packer the object providing the packing functionality99 * \param [in] packer the object providing the packing functionality
98 * \param [in] buffer the buffer to fill the IPC package for100 * \param [in] buffer the buffer to fill the IPC package for
99 */101 */
100 virtual void fill_ipc_package(std::shared_ptr<BufferIPCPacker> const& packer,102 virtual void fill_ipc_package(BufferIPCPacker* packer, Buffer const* buffer) const = 0;
101 std::shared_ptr<graphics::Buffer> const& buffer) const = 0;
102103
103 /**104 /**
104 * Creates the in-process client support object.105 * Creates the in-process client support object.
105106
=== modified file 'include/server/mir/compositor/buffer_stream.h'
--- include/server/mir/compositor/buffer_stream.h 2013-11-06 03:17:35 +0000
+++ include/server/mir/compositor/buffer_stream.h 2013-11-21 20:19:28 +0000
@@ -47,6 +47,7 @@
47 virtual std::shared_ptr<graphics::Buffer> lock_snapshot_buffer() = 0;47 virtual std::shared_ptr<graphics::Buffer> lock_snapshot_buffer() = 0;
48 virtual geometry::PixelFormat get_stream_pixel_format() = 0;48 virtual geometry::PixelFormat get_stream_pixel_format() = 0;
49 virtual geometry::Size stream_size() = 0;49 virtual geometry::Size stream_size() = 0;
50 virtual void resize(geometry::Size const& size) = 0;
50 virtual void allow_framedropping(bool) = 0;51 virtual void allow_framedropping(bool) = 0;
51 virtual void force_requests_to_complete() = 0;52 virtual void force_requests_to_complete() = 0;
52};53};
5354
=== modified file 'include/server/mir/compositor/scene.h'
--- include/server/mir/compositor/scene.h 2013-11-06 03:17:35 +0000
+++ include/server/mir/compositor/scene.h 2013-11-21 20:19:28 +0000
@@ -75,7 +75,7 @@
75 * Scene changes.75 * Scene changes.
76 *76 *
77 * The supplied callback should not directly or indirectly (e.g.,77 * The supplied callback should not directly or indirectly (e.g.,
78 * by changing a property of a Renderable) change the state of78 * by changing a property of a surface) change the state of
79 * the Scene, otherwise a deadlock may occur.79 * the Scene, otherwise a deadlock may occur.
80 */80 */
81 virtual void set_change_callback(std::function<void()> const& f) = 0;81 virtual void set_change_callback(std::function<void()> const& f) = 0;
8282
=== modified file 'include/server/mir/default_configuration_options.h'
--- include/server/mir/default_configuration_options.h 2013-11-06 03:17:35 +0000
+++ include/server/mir/default_configuration_options.h 2013-11-21 20:19:28 +0000
@@ -40,7 +40,12 @@
40 static char const* const host_socket_opt;40 static char const* const host_socket_opt;
41 static char const* const standalone_opt;41 static char const* const standalone_opt;
42 static char const* const frontend_threads;42 static char const* const frontend_threads;
43 static char const* const name_opt;43<<<<<<< TREE
44 static char const* const name_opt;
45=======
46 static char const* const name_opt;
47 static char const* const offscreen_opt;
48>>>>>>> MERGE-SOURCE
4449
45 static char const* const glog;50 static char const* const glog;
46 static char const* const glog_stderrthreshold;51 static char const* const glog_stderrthreshold;
4752
=== modified file 'include/server/mir/default_server_configuration.h'
--- include/server/mir/default_server_configuration.h 2013-11-06 03:17:35 +0000
+++ include/server/mir/default_server_configuration.h 2013-11-21 20:19:28 +0000
@@ -55,32 +55,31 @@
55namespace shell55namespace shell
56{56{
57class SurfaceFactory;57class SurfaceFactory;
58class SurfaceBuilder;
59class SurfaceController;58class SurfaceController;
60class InputTargeter;59class InputTargeter;
61class SessionContainer;
62class FocusSetter;60class FocusSetter;
63class FocusSequence;
64class PlacementStrategy;61class PlacementStrategy;
65class SessionListener;62class SessionListener;
66class FocusController;63class FocusController;
67class SessionManager;
68class PixelBuffer;
69class SnapshotStrategy;
70class DisplayLayout;64class DisplayLayout;
71class SurfaceConfigurator;65class SurfaceConfigurator;
66}
67namespace time
68{
69class TimeSource;
70}
71namespace surfaces
72{
73class BroadcastingSessionEventSink;
74class BufferStreamFactory;
72class MediatingDisplayChanger;75class MediatingDisplayChanger;
76class PixelBuffer;
77class SessionContainer;
73class SessionEventSink;78class SessionEventSink;
74class SessionEventHandlerRegister;79class SessionEventHandlerRegister;
75class BroadcastingSessionEventSink;80class SessionManager;
76}81class SnapshotStrategy;
77namespace time82class SurfaceBuilder;
78{
79class TimeSource;
80}
81namespace surfaces
82{
83class BufferStreamFactory;
84class SurfaceStackModel;83class SurfaceStackModel;
85class SurfaceStack;84class SurfaceStack;
86class SurfaceController;85class SurfaceController;
@@ -186,15 +185,13 @@
186 * configurable interfaces for modifying shell185 * configurable interfaces for modifying shell
187 * @{ */186 * @{ */
188 virtual std::shared_ptr<shell::SurfaceFactory> the_shell_surface_factory();187 virtual std::shared_ptr<shell::SurfaceFactory> the_shell_surface_factory();
189 virtual std::shared_ptr<shell::SessionContainer> the_shell_session_container();188 virtual std::shared_ptr<shell::SurfaceFactory> the_surfaces_surface_factory();
190 virtual std::shared_ptr<shell::FocusSetter> the_shell_focus_setter();189 virtual std::shared_ptr<shell::FocusSetter> the_shell_focus_setter();
191 virtual std::shared_ptr<shell::FocusSequence> the_shell_focus_sequence();
192 virtual std::shared_ptr<shell::PlacementStrategy> the_shell_placement_strategy();190 virtual std::shared_ptr<shell::PlacementStrategy> the_shell_placement_strategy();
193 virtual std::shared_ptr<shell::SessionListener> the_shell_session_listener();191 virtual std::shared_ptr<shell::SessionListener> the_shell_session_listener();
194 virtual std::shared_ptr<shell::PixelBuffer> the_shell_pixel_buffer();
195 virtual std::shared_ptr<shell::SnapshotStrategy> the_shell_snapshot_strategy();
196 virtual std::shared_ptr<shell::DisplayLayout> the_shell_display_layout();192 virtual std::shared_ptr<shell::DisplayLayout> the_shell_display_layout();
197 virtual std::shared_ptr<shell::SurfaceConfigurator> the_shell_surface_configurator();193 virtual std::shared_ptr<shell::SurfaceConfigurator> the_shell_surface_configurator();
194<<<<<<< TREE
198 virtual std::shared_ptr<shell::SessionEventSink> the_shell_session_event_sink();195 virtual std::shared_ptr<shell::SessionEventSink> the_shell_session_event_sink();
199 virtual std::shared_ptr<shell::SessionEventHandlerRegister> the_shell_session_event_handler_register();196 virtual std::shared_ptr<shell::SessionEventHandlerRegister> the_shell_session_event_handler_register();
200 virtual std::shared_ptr<shell::SurfaceController> the_shell_surface_controller();197 virtual std::shared_ptr<shell::SurfaceController> the_shell_surface_controller();
@@ -212,6 +209,20 @@
212 /** @name surfaces configuration - customization209 /** @name surfaces configuration - customization
213 * configurable interfaces for modifying surfaces210 * configurable interfaces for modifying surfaces
214 * @{ */211 * @{ */
212=======
213 virtual std::shared_ptr<shell::SurfaceController> the_shell_surface_controller();
214 /** @} */
215
216 /** @name internal surfaces configuration
217 * builder functions used in the default implementation.
218 * The interfaces returned are not published, so the functions are only useful in tests
219 * @{ */
220 virtual std::shared_ptr<surfaces::PixelBuffer> the_pixel_buffer();
221 virtual std::shared_ptr<surfaces::SnapshotStrategy> the_snapshot_strategy();
222 virtual std::shared_ptr<surfaces::SessionContainer> the_session_container();
223 virtual std::shared_ptr<surfaces::SessionEventSink> the_session_event_sink();
224 virtual std::shared_ptr<surfaces::SessionEventHandlerRegister> the_session_event_handler_register();
225>>>>>>> MERGE-SOURCE
215 virtual std::shared_ptr<surfaces::SurfaceStackModel> the_surface_stack_model();226 virtual std::shared_ptr<surfaces::SurfaceStackModel> the_surface_stack_model();
216 virtual std::shared_ptr<surfaces::SurfacesReport> the_surfaces_report();227 virtual std::shared_ptr<surfaces::SurfacesReport> the_surfaces_report();
217 /** @} */228 /** @} */
@@ -220,6 +231,7 @@
220 * dependencies of surfaces on the rest of the Mir231 * dependencies of surfaces on the rest of the Mir
221 * @{ */232 * @{ */
222 virtual std::shared_ptr<surfaces::BufferStreamFactory> the_buffer_stream_factory();233 virtual std::shared_ptr<surfaces::BufferStreamFactory> the_buffer_stream_factory();
234 virtual std::shared_ptr<surfaces::SurfacesReport> the_surfaces_report();
223 /** @} */235 /** @} */
224236
225237
@@ -241,20 +253,15 @@
241253
242 virtual std::shared_ptr<time::TimeSource> the_time_source();254 virtual std::shared_ptr<time::TimeSource> the_time_source();
243255
244 virtual std::shared_ptr<shell::SessionManager> the_session_manager();
245
246protected:256protected:
247 using DefaultConfigurationOptions::the_options;257 using DefaultConfigurationOptions::the_options;
248 using DefaultConfigurationOptions::add_options;258 using DefaultConfigurationOptions::add_options;
249 using DefaultConfigurationOptions::parse_options;259 using DefaultConfigurationOptions::parse_options;
250260
251 virtual std::shared_ptr<input::InputChannelFactory> the_input_channel_factory();261 virtual std::shared_ptr<input::InputChannelFactory> the_input_channel_factory();
252 virtual std::shared_ptr<shell::MediatingDisplayChanger> the_mediating_display_changer();262 virtual std::shared_ptr<surfaces::MediatingDisplayChanger> the_mediating_display_changer();
253 virtual std::shared_ptr<shell::BroadcastingSessionEventSink> the_broadcasting_session_event_sink();
254263
255 CachedPtr<frontend::Connector> connector;264 CachedPtr<frontend::Connector> connector;
256 CachedPtr<shell::SessionManager> session_manager;
257
258265
259 CachedPtr<input::InputConfiguration> input_configuration;266 CachedPtr<input::InputConfiguration> input_configuration;
260267
@@ -283,13 +290,13 @@
283 CachedPtr<surfaces::SurfacesReport> surfaces_report;290 CachedPtr<surfaces::SurfacesReport> surfaces_report;
284291
285 CachedPtr<shell::SurfaceFactory> shell_surface_factory;292 CachedPtr<shell::SurfaceFactory> shell_surface_factory;
286 CachedPtr<shell::SessionContainer> shell_session_container;293 CachedPtr<shell::SurfaceFactory> surfaces_surface_factory;
294 CachedPtr<surfaces::SessionContainer> session_container;
287 CachedPtr<shell::FocusSetter> shell_focus_setter;295 CachedPtr<shell::FocusSetter> shell_focus_setter;
288 CachedPtr<shell::FocusSequence> shell_focus_sequence;
289 CachedPtr<shell::PlacementStrategy> shell_placement_strategy;296 CachedPtr<shell::PlacementStrategy> shell_placement_strategy;
290 CachedPtr<shell::SessionListener> shell_session_listener;297 CachedPtr<shell::SessionListener> shell_session_listener;
291 CachedPtr<shell::PixelBuffer> shell_pixel_buffer;298 CachedPtr<surfaces::PixelBuffer> pixel_buffer;
292 CachedPtr<shell::SnapshotStrategy> shell_snapshot_strategy;299 CachedPtr<surfaces::SnapshotStrategy> snapshot_strategy;
293 CachedPtr<shell::DisplayLayout> shell_display_layout;300 CachedPtr<shell::DisplayLayout> shell_display_layout;
294 CachedPtr<shell::SurfaceConfigurator> shell_surface_configurator;301 CachedPtr<shell::SurfaceConfigurator> shell_surface_configurator;
295 CachedPtr<compositor::DisplayBufferCompositorFactory> display_buffer_compositor_factory;302 CachedPtr<compositor::DisplayBufferCompositorFactory> display_buffer_compositor_factory;
@@ -297,26 +304,39 @@
297 CachedPtr<compositor::Compositor> compositor;304 CachedPtr<compositor::Compositor> compositor;
298 CachedPtr<logging::Logger> logger;305 CachedPtr<logging::Logger> logger;
299 CachedPtr<graphics::DisplayReport> display_report;306 CachedPtr<graphics::DisplayReport> display_report;
300 CachedPtr<surfaces::SurfaceController> surface_controller;
301 CachedPtr<time::TimeSource> time_source;307 CachedPtr<time::TimeSource> time_source;
302 CachedPtr<MainLoop> main_loop;308 CachedPtr<MainLoop> main_loop;
303 CachedPtr<ServerStatusListener> server_status_listener;309 CachedPtr<ServerStatusListener> server_status_listener;
304 CachedPtr<graphics::DisplayConfigurationPolicy> display_configuration_policy;310 CachedPtr<graphics::DisplayConfigurationPolicy> display_configuration_policy;
305 CachedPtr<graphics::nested::HostConnection> host_connection;311 CachedPtr<graphics::nested::HostConnection> host_connection;
306 CachedPtr<input::NestedInputRelay> nested_input_relay;312 CachedPtr<surfaces::MediatingDisplayChanger> mediating_display_changer;
307 CachedPtr<shell::MediatingDisplayChanger> mediating_display_changer;
308 CachedPtr<shell::BroadcastingSessionEventSink> broadcasting_session_event_sink;
309313
310private:314private:
311 std::shared_ptr<input::EventFilter> const default_filter;315 std::shared_ptr<input::EventFilter> const default_filter;
312
313 // the communications interface to use316 // the communications interface to use
314 virtual std::shared_ptr<frontend::ProtobufIpcFactory> the_ipc_factory(317 virtual std::shared_ptr<frontend::ProtobufIpcFactory> the_ipc_factory(
315 std::shared_ptr<frontend::Shell> const& shell,318 std::shared_ptr<frontend::Shell> const& shell,
316 std::shared_ptr<graphics::GraphicBufferAllocator> const& allocator);319 std::shared_ptr<graphics::GraphicBufferAllocator> const& allocator);
317320
318 virtual std::string the_socket_file() const;321 virtual std::string the_socket_file() const;
322<<<<<<< TREE
319 std::shared_ptr<input::NestedInputRelay> the_nested_input_relay();323 std::shared_ptr<input::NestedInputRelay> the_nested_input_relay();
324=======
325
326 // The following caches and factory functions are internal to the
327 // default implementations of corresponding the Mir components
328 CachedPtr<surfaces::BroadcastingSessionEventSink> broadcasting_session_event_sink;
329 CachedPtr<input::NestedInputRelay> nested_input_relay;
330 CachedPtr<surfaces::SurfaceController> surface_controller;
331 CachedPtr<surfaces::SessionManager> session_manager;
332
333 std::shared_ptr<surfaces::BroadcastingSessionEventSink> the_broadcasting_session_event_sink();
334 std::shared_ptr<input::NestedInputRelay> the_nested_input_relay();
335 std::shared_ptr<surfaces::SessionManager> the_session_manager();
336 std::shared_ptr<surfaces::SurfaceBuilder> the_surface_builder();
337 std::shared_ptr<surfaces::SurfaceController> the_surface_controller();
338 std::function<void()> force_threads_to_unblock_callback();
339>>>>>>> MERGE-SOURCE
320};340};
321}341}
322342
323343
=== modified file 'include/server/mir/frontend/shell.h'
--- include/server/mir/frontend/shell.h 2013-08-28 03:41:48 +0000
+++ include/server/mir/frontend/shell.h 2013-11-21 20:19:28 +0000
@@ -36,7 +36,7 @@
36class Shell36class Shell
37{37{
38public:38public:
39 virtual ~Shell() {}39 virtual ~Shell() = default;
4040
41 virtual std::shared_ptr<Session> open_session(41 virtual std::shared_ptr<Session> open_session(
42 std::string const& name, std::shared_ptr<EventSink> const& sink) = 0;42 std::string const& name, std::shared_ptr<EventSink> const& sink) = 0;
@@ -44,7 +44,7 @@
4444
45 virtual SurfaceId create_surface_for(std::shared_ptr<Session> const& session,45 virtual SurfaceId create_surface_for(std::shared_ptr<Session> const& session,
46 shell::SurfaceCreationParameters const& params) = 0;46 shell::SurfaceCreationParameters const& params) = 0;
47 47
48 virtual void handle_surface_created(std::shared_ptr<Session> const& session) = 0;48 virtual void handle_surface_created(std::shared_ptr<Session> const& session) = 0;
4949
50protected:50protected:
5151
=== modified file 'include/server/mir/frontend/surface.h'
--- include/server/mir/frontend/surface.h 2013-10-15 08:53:10 +0000
+++ include/server/mir/frontend/surface.h 2013-11-21 20:19:28 +0000
@@ -25,6 +25,8 @@
25#include "mir/geometry/size.h"25#include "mir/geometry/size.h"
26#include "mir_toolkit/common.h"26#include "mir_toolkit/common.h"
2727
28#include <glm/glm.hpp>
29
28#include <memory>30#include <memory>
2931
30namespace mir32namespace mir
@@ -55,12 +57,7 @@
55 virtual geometry::Size size() const = 0;57 virtual geometry::Size size() const = 0;
56 virtual geometry::PixelFormat pixel_format() const = 0;58 virtual geometry::PixelFormat pixel_format() const = 0;
5759
58 /// Submit the current client buffer, return the next client buffer
59 ///
60 /// \param [out] need_ipc: True if the buffer content must be sent via IPC
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches