# Copyright 2019 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/chromeos/args.gni")
import("//build/config/linux/pkg_config.gni")
import("//build/config/ui.gni")
assert(use_ozone && (is_linux || is_chromeos))
visibility = [ ":*" ]
declare_args() {
# Support ChromeOS touchpad gestures with ozone.
use_evdev_gestures = is_chromeos_device
}
config("evdev_config") {
defines = [ "USE_EVDEV" ]
}
if (use_evdev_gestures) {
pkg_config("libevdev-cros") {
packages = [ "libevdev-cros" ]
}
pkg_config("libgestures") {
packages = [ "libgestures" ]
}
config("evdev_gestures_config") {
defines = [ "USE_EVDEV_GESTURES" ]
}
}
if (use_libinput) {
pkg_config("libinput") {
packages = [ "libinput" ]
}
config("libinput_config") {
defines = [ "USE_LIBINPUT" ]
}
}
component("evdev") {
output_name = "events_ozone_evdev"
sources = [
"device_event_dispatcher_evdev.cc",
"device_event_dispatcher_evdev.h",
"event_converter_evdev.cc",
"event_converter_evdev.h",
"event_converter_evdev_impl.cc",
"event_converter_evdev_impl.h",
"event_factory_evdev.cc",
"event_factory_evdev.h",
"event_thread_evdev.cc",
"event_thread_evdev.h",
"gamepad_event_converter_evdev.cc",
"gamepad_event_converter_evdev.h",
"heatmap_palm_detector.cc",
"heatmap_palm_detector.h",
"imposter_checker_evdev.cc",
"imposter_checker_evdev.h",
"imposter_checker_evdev_state.cc",
"imposter_checker_evdev_state.h",
"input_controller_evdev.cc",
"input_controller_evdev.h",
"input_device_factory_evdev.cc",
"input_device_factory_evdev.h",
"input_device_factory_evdev_metrics.cc",
"input_device_factory_evdev_metrics.h",
"input_device_factory_evdev_proxy.cc",
"input_device_factory_evdev_proxy.h",
"input_device_opener.h",
"input_device_opener_evdev.cc",
"input_device_opener_evdev.h",
"input_device_settings_evdev.cc",
"input_device_settings_evdev.h",
"input_injector_evdev.cc",
"input_injector_evdev.h",
"keyboard_evdev.cc",
"keyboard_evdev.h",
"microphone_mute_switch_event_converter_evdev.cc",
"microphone_mute_switch_event_converter_evdev.h",
"mouse_button_map_evdev.cc",
"mouse_button_map_evdev.h",
"stylus_button_event_converter_evdev.cc",
"stylus_button_event_converter_evdev.h",
"tablet_event_converter_evdev.cc",
"tablet_event_converter_evdev.h",
"touch_evdev_debug_buffer.cc",
"touch_evdev_debug_buffer.h",
"touch_evdev_types.cc",
"touch_evdev_types.h",
"touch_event_converter_evdev.cc",
"touch_event_converter_evdev.h",
"touch_filter/edge_touch_filter.cc",
"touch_filter/edge_touch_filter.h",
"touch_filter/false_touch_finder.cc",
"touch_filter/false_touch_finder.h",
"touch_filter/heuristic_stylus_palm_detection_filter.cc",
"touch_filter/heuristic_stylus_palm_detection_filter.h",
"touch_filter/neural_stylus_palm_detection_filter.cc",
"touch_filter/neural_stylus_palm_detection_filter.h",
"touch_filter/neural_stylus_palm_detection_filter_model.cc",
"touch_filter/neural_stylus_palm_detection_filter_model.h",
"touch_filter/neural_stylus_palm_detection_filter_util.cc",
"touch_filter/neural_stylus_palm_detection_filter_util.h",
"touch_filter/open_palm_detection_filter.cc",
"touch_filter/open_palm_detection_filter.h",
"touch_filter/palm_detection_filter.cc",
"touch_filter/palm_detection_filter.h",
"touch_filter/palm_detection_filter_factory.cc",
"touch_filter/palm_detection_filter_factory.h",
"touch_filter/palm_model/onedevice_train_palm_detection_filter_inference.cc",
"touch_filter/palm_model/onedevice_train_palm_detection_filter_inference.h",
"touch_filter/palm_model/onedevice_train_palm_detection_filter_inference_beta.cc",
"touch_filter/palm_model/onedevice_train_palm_detection_filter_inference_beta.h",
"touch_filter/palm_model/onedevice_train_palm_detection_filter_model.cc",
"touch_filter/palm_model/onedevice_train_palm_detection_filter_model.h",
"touch_filter/shared_palm_detection_filter_state.h",
"touch_filter/touch_filter.h",
]
defines = [ "IS_EVDEV_IMPL" ]
deps = [
":event_device_info",
":keyboard_mouse_combo_metrics",
":mouse_button_property",
"//base",
"//build:chromeos_buildflags",
"//third_party/re2:re2",
"//ui/display",
"//ui/events",
"//ui/events:dom_keycode_converter",
"//ui/events:events_base",
"//ui/events/devices",
"//ui/events/ozone",
"//ui/events/ozone/layout",
"//ui/events/platform",
"//ui/gfx",
"//ui/ozone:ozone_base",
]
if (is_chromeos_ash) {
sources += [
"fake_keyboard_heuristic_metrics.cc",
"fake_keyboard_heuristic_metrics.h",
"numberpad_metrics.cc",
"numberpad_metrics.h",
]
deps += [
"//ash/constants",
"//chromeos/ash/components/feature_usage",
]
visibility += [
"//chrome/browser/ui",
"//chrome/browser/ui/ash",
"//chrome/browser/ui/ash/main_extra_parts",
"//chromeos/ash/components/heatmap/*",
]
}
public_configs = [ ":evdev_config" ]
if (use_evdev_gestures) {
sources += [
"libgestures_glue/event_reader_libevdev_cros.cc",
"libgestures_glue/event_reader_libevdev_cros.h",
"libgestures_glue/gesture_feedback.cc",
"libgestures_glue/gesture_feedback.h",
"libgestures_glue/gesture_interpreter_libevdev_cros.cc",
"libgestures_glue/gesture_interpreter_libevdev_cros.h",
"libgestures_glue/gesture_logging.cc",
"libgestures_glue/gesture_logging.h",
"libgestures_glue/gesture_properties_service.cc",
"libgestures_glue/gesture_properties_service.h",
"libgestures_glue/gesture_property_provider.cc",
"libgestures_glue/gesture_property_provider.h",
"libgestures_glue/gesture_timer_provider.cc",
"libgestures_glue/gesture_timer_provider.h",
"libgestures_glue/haptic_touchpad_handler.cc",
"libgestures_glue/haptic_touchpad_handler.h",
]
deps += [ "//ui/ozone/public/mojom:gesture_properties_service" ]
configs += [
":libevdev-cros",
":libgestures",
]
public_configs += [ ":evdev_gestures_config" ]
}
if (use_libinput) {
configs += [ ":libinput" ]
public_configs += [ ":libinput_config" ]
sources += [
"libinput_event_converter.cc",
"libinput_event_converter.h",
]
}
visibility += [
"//ash/webui/diagnostics_ui/*",
"//ui/chromeos/*",
"//ui/events/*",
"//ui/ozone/*",
]
}
source_set("mouse_button_property") {
sources = [
"mouse_button_property.cc",
"mouse_button_property.h",
]
deps = [
"//base",
"//ui/events",
]
visibility += [
"//ash/*",
"//components/exo",
]
}
source_set("keyboard_mouse_combo_metrics") {
sources = [ "keyboard_mouse_combo_device_metrics.h" ]
deps = [
"//base",
"//ui/events/devices",
"//ui/events/ozone",
]
visibility += [ "//ash:*" ]
}
source_set("event_device_info") {
sources = [
"event_device_info.cc",
"event_device_info.h",
]
deps = [
":keyboard_mouse_combo_metrics",
"//base",
"//ui/events/devices",
"//ui/events/ozone",
]
visibility += [
"//ash:ash_unittests",
"//ash/webui/diagnostics_ui/backend:*",
"//chrome/browser/ash:unit_tests",
"//chrome/browser/ash/system_logs:unit_tests",
"//chromeos/ash/services/cros_healthd/*",
"//ui/chromeos/*",
"//ui/events/ash/*",
]
}
source_set("event_device_info_test_utils") {
testonly = true
sources = [
"event_device_test_util.cc",
"event_device_test_util.h",
]
deps = [
":evdev",
":event_device_info",
"//base",
]
visibility += [
"//ash/webui/diagnostics_ui/backend:unit_tests",
"//chrome/browser/ash:unit_tests",
"//chrome/browser/ash/system_logs:unit_tests",
"//ui/events/ash:unit_tests",
]
}
source_set("unittests") {
testonly = true
sources = [
"event_converter_evdev_impl_unittest.cc",
"event_converter_test_util.cc",
"event_converter_test_util.h",
"event_device_info_unittest.cc",
"event_factory_evdev_unittest.cc",
"gamepad_event_converter_evdev_unittest.cc",
"input_controller_evdev_unittest.cc",
"input_injector_evdev_unittest.cc",
"libgestures_glue/haptic_touchpad_handler.cc",
"libgestures_glue/haptic_touchpad_handler.h",
"libgestures_glue/haptic_touchpad_handler_unittest.cc",
"microphone_mute_switch_event_converter_evdev_unittest.cc",
"stylus_button_event_converter_evdev_unittest.cc",
"tablet_event_converter_evdev_unittest.cc",
"testing/fake_cursor_delegate_evdev.h",
"touch_event_converter_evdev_unittest.cc",
"touch_filter/false_touch_finder_unittest.cc",
"touch_filter/heuristic_stylus_palm_detection_filter_unittest.cc",
"touch_filter/neural_stylus_palm_detection_filter_unittest.cc",
"touch_filter/neural_stylus_palm_detection_filter_util_unittest.cc",
"touch_filter/open_palm_detection_filter_unittest.cc",
"touch_filter/palm_detection_filter_factory_unittest.cc",
]
deps = [
":evdev",
":event_device_info",
":event_device_info_test_utils",
":mouse_button_property",
"//base",
"//base/test:test_support",
"//build:chromeos_buildflags",
"//testing/gmock",
"//testing/gtest",
"//third_party/re2:re2",
"//ui/events",
"//ui/events:dom_keycode_converter",
"//ui/events/devices",
"//ui/events/ozone",
"//ui/events/ozone/layout",
"//ui/gfx/geometry",
]
if (is_chromeos_ash) {
sources += [
"input_device_factory_evdev_unittest.cc",
"mouse_button_map_evdev_unittest.cc",
"numberpad_metrics_unittest.cc",
]
deps += [
"//ash/constants",
"//chromeos/ash/components/feature_usage",
]
}
visibility += [ "//ui/events/ozone:unittests" ]
}