#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "ui/events/ozone/evdev/event_converter_evdev_impl.h"
#include <errno.h>
#include <linux/input.h>
#include <stddef.h>
#include "base/containers/contains.h"
#include "base/logging.h"
#include "base/trace_event/trace_event.h"
#include "build/chromeos_buildflags.h"
#include "ui/events/devices/stylus_state.h"
#include "ui/events/event.h"
#include "ui/events/event_utils.h"
#include "ui/events/keycodes/dom/keycode_converter.h"
#include "ui/events/ozone/evdev/device_event_dispatcher_evdev.h"
#include "ui/events/ozone/evdev/event_device_util.h"
#include "ui/events/ozone/evdev/numberpad_metrics.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "ui/events/ozone/evdev/numberpad_metrics.h"
#endif
namespace ui {
namespace {
const int kKeyReleaseValue = …;
const int kKeyRepeatValue = …;
const int kSwitchStylusInserted = …;
constexpr unsigned int kModifierEvdevCodes[] = …;
}
EventConverterEvdevImpl::EventConverterEvdevImpl(
base::ScopedFD fd,
base::FilePath path,
int id,
const EventDeviceInfo& devinfo,
CursorDelegateEvdev* cursor,
DeviceEventDispatcherEvdev* dispatcher)
: … { … }
EventConverterEvdevImpl::~EventConverterEvdevImpl() { … }
void EventConverterEvdevImpl::OnFileCanReadWithoutBlocking(int fd) { … }
KeyboardType EventConverterEvdevImpl::GetKeyboardType() const { … }
bool EventConverterEvdevImpl::HasKeyboard() const { … }
bool EventConverterEvdevImpl::HasTouchpad() const { … }
bool EventConverterEvdevImpl::HasCapsLockLed() const { … }
bool EventConverterEvdevImpl::HasStylusSwitch() const { … }
bool EventConverterEvdevImpl::HasAssistantKey() const { … }
bool EventConverterEvdevImpl::HasFunctionKey() const { … }
void EventConverterEvdevImpl::SetKeyFilter(bool enable_filter,
std::vector<DomCode> allowed_keys) { … }
void EventConverterEvdevImpl::SetBlockModifiers(bool block_modifiers) { … }
void EventConverterEvdevImpl::OnDisabled() { … }
std::vector<uint64_t> EventConverterEvdevImpl::GetKeyboardKeyBits() const { … }
ui::StylusState EventConverterEvdevImpl::GetStylusSwitchState() { … }
void EventConverterEvdevImpl::ProcessEvents(const input_event* inputs,
int count) { … }
void EventConverterEvdevImpl::ConvertKeyEvent(const input_event& input) { … }
void EventConverterEvdevImpl::ConvertMouseMoveEvent(const input_event& input) { … }
void EventConverterEvdevImpl::OnKeyChange(unsigned int key,
bool down,
const base::TimeTicks& timestamp) { … }
void EventConverterEvdevImpl::GenerateKeyMetrics(unsigned int key, bool down) { … }
void EventConverterEvdevImpl::ReleaseKeys() { … }
void EventConverterEvdevImpl::ReleaseMouseButtons() { … }
void EventConverterEvdevImpl::OnLostSync() { … }
void EventConverterEvdevImpl::DispatchMouseButton(const input_event& input) { … }
void EventConverterEvdevImpl::OnButtonChange(int code,
bool down,
base::TimeTicks timestamp) { … }
void EventConverterEvdevImpl::SetReceivedValidInputCallback(
ReceivedValidInputCallback callback) { … }
void EventConverterEvdevImpl::FlushEvents(const input_event& input) { … }
std::ostream& EventConverterEvdevImpl::DescribeForLog(std::ostream& os) const { … }
}