#include "ui/events/ozone/evdev/input_controller_evdev.h"
#include <linux/input.h>
#include <algorithm>
#include <memory>
#include <utility>
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/memory/weak_ptr.h"
#include "base/task/single_thread_task_runner.h"
#include "ui/events/devices/device_data_manager.h"
#include "ui/events/devices/stylus_state.h"
#include "ui/events/ozone/evdev/input_device_factory_evdev_proxy.h"
#include "ui/events/ozone/evdev/input_device_settings_evdev.h"
#include "ui/events/ozone/evdev/keyboard_evdev.h"
#include "ui/events/ozone/evdev/mouse_button_map_evdev.h"
namespace ui {
namespace {
TouchpadSettingsEvdev& GetTouchpadSettings(InputDeviceSettingsEvdev& settings,
std::optional<int> device_id) { … }
MouseSettingsEvdev& GetMouseSettings(InputDeviceSettingsEvdev& settings,
std::optional<int> device_id) { … }
PointingStickSettingsEvdev& GetPointingStickSettings(
InputDeviceSettingsEvdev& settings,
std::optional<int> device_id) { … }
}
class InputControllerEvdev::ScopedDisableInputDevicesImpl
: public ScopedDisableInputDevices { … };
InputControllerEvdev::InputControllerEvdev(
KeyboardEvdev* keyboard,
MouseButtonMapEvdev* mouse_button_map,
MouseButtonMapEvdev* pointing_stick_button_map)
: … { … }
InputControllerEvdev::~InputControllerEvdev() = default;
void InputControllerEvdev::SetInputDeviceFactory(
InputDeviceFactoryEvdevProxy* input_device_factory) { … }
void InputControllerEvdev::set_has_mouse(bool has_mouse) { … }
void InputControllerEvdev::set_any_keys_pressed(bool any) { … }
void InputControllerEvdev::set_has_pointing_stick(bool has_pointing_stick) { … }
void InputControllerEvdev::set_has_touchpad(bool has_touchpad) { … }
void InputControllerEvdev::set_has_haptic_touchpad(bool has_haptic_touchpad) { … }
void InputControllerEvdev::OnScopedDisableInputDevicesCreated() { … }
void InputControllerEvdev::OnScopedDisableInputDevicesDestroyed() { … }
bool InputControllerEvdev::AreInputDevicesEnabled() const { … }
std::unique_ptr<ScopedDisableInputDevices>
InputControllerEvdev::DisableInputDevices() { … }
void InputControllerEvdev::DisableKeyboardImposterCheck() { … }
InputDeviceSettingsEvdev InputControllerEvdev::GetInputDeviceSettings() const { … }
bool InputControllerEvdev::HasMouse() { … }
bool InputControllerEvdev::HasPointingStick() { … }
bool InputControllerEvdev::HasTouchpad() { … }
bool InputControllerEvdev::HasHapticTouchpad() { … }
bool InputControllerEvdev::IsCapsLockEnabled() { … }
void InputControllerEvdev::SetCapsLockEnabled(bool enabled) { … }
void InputControllerEvdev::SetNumLockEnabled(bool enabled) { … }
bool InputControllerEvdev::IsAutoRepeatEnabled() { … }
void InputControllerEvdev::SetAutoRepeatEnabled(bool enabled) { … }
void InputControllerEvdev::SetAutoRepeatRate(const base::TimeDelta& delay,
const base::TimeDelta& interval) { … }
void InputControllerEvdev::GetAutoRepeatRate(base::TimeDelta* delay,
base::TimeDelta* interval) { … }
void InputControllerEvdev::SetKeyboardKeyBitsMapping(
base::flat_map<int, std::vector<uint64_t>> key_bits_mapping) { … }
std::vector<uint64_t> InputControllerEvdev::GetKeyboardKeyBits(int id) { … }
void InputControllerEvdev::SetCurrentLayoutByName(
const std::string& layout_name,
base::OnceCallback<void(bool)> callback) { … }
void InputControllerEvdev::SetInternalTouchpadEnabled(bool enabled) { … }
bool InputControllerEvdev::IsInternalTouchpadEnabled() const { … }
void InputControllerEvdev::SetTouchscreensEnabled(bool enabled) { … }
void InputControllerEvdev::SetTouchEventLoggingEnabled(bool enabled) { … }
void InputControllerEvdev::SetInternalKeyboardFilter(
bool enable_filter,
std::vector<DomCode> allowed_keys) { … }
void InputControllerEvdev::SetThreeFingerClick(bool enabled) { … }
void InputControllerEvdev::SetTouchpadSensitivity(std::optional<int> device_id,
int value) { … }
void InputControllerEvdev::SetTouchpadAcceleration(std::optional<int> device_id,
bool enabled) { … }
void InputControllerEvdev::SetTouchpadScrollAcceleration(
std::optional<int> device_id,
bool enabled) { … }
void InputControllerEvdev::SetTouchpadScrollSensitivity(
std::optional<int> device_id,
int value) { … }
void InputControllerEvdev::SetTouchpadHapticFeedback(
std::optional<int> device_id,
bool enabled) { … }
void InputControllerEvdev::SetTouchpadHapticClickSensitivity(
std::optional<int> device_id,
int value) { … }
void InputControllerEvdev::SetTapToClick(std::optional<int> device_id,
bool enabled) { … }
void InputControllerEvdev::SetTapDragging(std::optional<int> device_id,
bool enabled) { … }
void InputControllerEvdev::SetNaturalScroll(std::optional<int> device_id,
bool enabled) { … }
void InputControllerEvdev::SetMouseSensitivity(std::optional<int> device_id,
int value) { … }
void InputControllerEvdev::SetMouseScrollSensitivity(
std::optional<int> device_id,
int value) { … }
void InputControllerEvdev::SetMouseScrollAcceleration(
std::optional<int> device_id,
bool enabled) { … }
void InputControllerEvdev::SetPointingStickSensitivity(
std::optional<int> device_id,
int value) { … }
void InputControllerEvdev::SetMouseReverseScroll(std::optional<int> device_id,
bool enabled) { … }
void InputControllerEvdev::SetPointingStickAcceleration(
std::optional<int> device_id,
bool enabled) { … }
void InputControllerEvdev::SetMouseAcceleration(std::optional<int> device_id,
bool enabled) { … }
void InputControllerEvdev::SetPrimaryButtonRight(std::optional<int> device_id,
bool right) { … }
void InputControllerEvdev::SetPointingStickPrimaryButtonRight(
std::optional<int> device_id,
bool right) { … }
void InputControllerEvdev::SetGamepadKeyBitsMapping(
base::flat_map<int, std::vector<uint64_t>> key_bits_mapping) { … }
std::vector<uint64_t> InputControllerEvdev::GetGamepadKeyBits(int id) { … }
void InputControllerEvdev::SuspendMouseAcceleration() { … }
void InputControllerEvdev::EndMouseAccelerationSuspension() { … }
void InputControllerEvdev::SetTapToClickPaused(bool state) { … }
void InputControllerEvdev::GetStylusSwitchState(
GetStylusSwitchStateReply reply) { … }
void InputControllerEvdev::GetTouchDeviceStatus(
GetTouchDeviceStatusReply reply) { … }
void InputControllerEvdev::GetTouchEventLog(const base::FilePath& out_dir,
GetTouchEventLogReply reply) { … }
void InputControllerEvdev::DescribeForLog(
InputController::DescribeForLogReply reply) const { … }
void InputControllerEvdev::GetGesturePropertiesService(
mojo::PendingReceiver<ozone::mojom::GesturePropertiesService> receiver) { … }
void InputControllerEvdev::ScheduleUpdateDeviceSettings() { … }
void InputControllerEvdev::UpdateDeviceSettings() { … }
void InputControllerEvdev::UpdateCapsLockLed() { … }
void InputControllerEvdev::PlayVibrationEffect(int id,
uint8_t amplitude,
uint16_t duration_millis) { … }
void InputControllerEvdev::StopVibration(int id) { … }
void InputControllerEvdev::PlayHapticTouchpadEffect(
ui::HapticTouchpadEffect effect,
ui::HapticTouchpadEffectStrength strength) { … }
void InputControllerEvdev::SetHapticTouchpadEffectForNextButtonRelease(
ui::HapticTouchpadEffect effect,
ui::HapticTouchpadEffectStrength strength) { … }
void InputControllerEvdev::OnInputDeviceRemoved(int device_id) { … }
bool InputControllerEvdev::AreAnyKeysPressed() { … }
void InputControllerEvdev::BlockModifiersOnDevices(
std::vector<int> device_ids) { … }
}