mirror of
https://github.com/openharmony/distributedhardware_distributed_input.git
synced 2026-07-18 16:04:40 -04:00
sim touchpad up
Signed-off-by: hwzhangchuang <zhangchuang.zhang@huawei.com>
This commit is contained in:
@@ -201,6 +201,12 @@ size_t InputHub::GetEvents(RawEvent *buffer, size_t bufferSize)
|
||||
return event - buffer;
|
||||
}
|
||||
|
||||
bool InputHub::IsTouchPad(Device *device)
|
||||
{
|
||||
return ((device->classes & INPUT_DEVICE_CLASS_TOUCH_MT) || (device->classes & INPUT_DEVICE_CLASS_TOUCH)) &&
|
||||
IsTouchPad(device->identifier));
|
||||
}
|
||||
|
||||
bool InputHub::IsTouchPad(const InputDevice &inputDevice)
|
||||
{
|
||||
std::string dhName = inputDevice.name;
|
||||
@@ -254,6 +260,13 @@ void InputHub::RecordDeviceChangeStates(Device *device, struct input_event readB
|
||||
if (event.type == EV_ABS && (event.code == ABS_MT_POSITION_Y || event.code == ABS_Y)) {
|
||||
DInputState::GetInstance().RefreshABSPosition(event.descriptor, -1, event.value);
|
||||
}
|
||||
|
||||
if (IsTouchPad(device) && event.type == EV_KEY && event.code == BTN_MOUSE && event.value == KEY_UP_STATE &&
|
||||
!DInputState::GetInstance().IsDhIdDown(event.descriptor)) {
|
||||
DHLOGI("Find touchpad UP state that not down effective at sink side, dhId: %s",
|
||||
event.descriptor.c_str());
|
||||
DInputState::GetInstance().SimulateTouchPadUpState(event.descriptor, event);
|
||||
}
|
||||
DHLOGD("RecordDeviceChangeStates end.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,6 +151,7 @@ private:
|
||||
bool ContainsNonZeroByte(const uint8_t *array, uint32_t startIndex, uint32_t endIndex);
|
||||
int64_t ProcessEventTimestamp(const input_event &event);
|
||||
bool IsTouchPad(const InputDevice &inputDevice);
|
||||
bool IsTouchPad(Device *device);
|
||||
|
||||
/*
|
||||
* this macro is used to tell if "bit" is set in "array"
|
||||
|
||||
Reference in New Issue
Block a user