Lines Matching defs:touchpad
21 static const char* const kDeviceNameFormat = "vr-virtual-touchpad-%d";
34 std::unique_ptr<VirtualTouchpadEvdev> touchpad(new VirtualTouchpadEvdev());
35 touchpad->Reset();
36 return touchpad;
40 for (auto& touchpad : touchpad_) {
41 if (touchpad.injector) {
42 touchpad.injector->Close();
44 touchpad.injector = nullptr;
45 touchpad.owned_injector.reset();
46 touchpad.last_device_x = INT32_MIN;
47 touchpad.last_device_y = INT32_MIN;
48 touchpad.touches = 0;
49 touchpad.last_motion_event_buttons = 0;
56 Touchpad& touchpad = touchpad_[i];
57 if (!touchpad.injector) {
58 touchpad.owned_injector.reset(new EvdevInjector());
59 touchpad.injector = touchpad.owned_injector.get();
63 touchpad.injector->ConfigureBegin(DeviceName, kDeviceBusType,
66 touchpad.injector->ConfigureInputProperty(INPUT_PROP_DIRECT);
67 touchpad.injector->ConfigureMultiTouchXY(0, 0, kWidth - 1, kHeight - 1);
68 touchpad.injector->ConfigureAbsSlots(kSlots);
69 touchpad.injector->ConfigureKey(BTN_TOUCH);
70 touchpad.injector->ConfigureKey(BTN_BACK);
71 touchpad.injector->ConfigureEnd();
72 if (const status_t configuration_status = touchpad.injector->GetError()) {
94 Touchpad& touchpad = touchpad_[touchpad_id];
95 touchpad.touches = ((touchpad.touches & 1) << 1) | (pressure > 0);
97 device_y, touchpad.touches);
99 if (!touchpad.injector) {
102 touchpad.injector->ResetError();
103 switch (touchpad.touches) {
105 if (device_x != touchpad.last_device_x ||
106 device_y != touchpad.last_device_y) {
107 touchpad.injector->SendMultiTouchXY(0, 0, device_x, device_y);
108 touchpad.injector->SendSynReport();
113 touchpad.injector->SendMultiTouchXY(0, 0, device_x, device_y);
114 touchpad.injector->SendKey(BTN_TOUCH, EvdevInjector::KEY_PRESS);
115 touchpad.injector->SendSynReport();
118 touchpad.injector->SendKey(BTN_TOUCH, EvdevInjector::KEY_RELEASE);
119 touchpad.injector->SendMultiTouchLift(0);
120 touchpad.injector->SendSynReport();
123 if (device_x != touchpad.last_device_x ||
124 device_y != touchpad.last_device_y) {
125 touchpad.injector->SendMultiTouchXY(0, 0, device_x, device_y);
126 touchpad.injector->SendSynReport();
130 touchpad.last_device_x = device_x;
131 touchpad.last_device_y = device_y;
133 return touchpad.injector->GetError();
140 Touchpad& touchpad = touchpad_[touchpad_id];
141 const int changes = touchpad.last_motion_event_buttons ^ buttons;
148 ALOGV("change %X from %X to %X", changes, touchpad.last_motion_event_buttons,
151 if (!touchpad.injector) {
154 touchpad.injector->ResetError();
156 touchpad.injector->SendKey(BTN_BACK, (buttons & AMOTION_EVENT_BUTTON_BACK)
159 touchpad.injector->SendSynReport();
161 touchpad.last_motion_event_buttons = buttons;
162 return touchpad.injector->GetError();
167 const auto& touchpad = touchpad_[i];
168 result.appendFormat("[virtual touchpad %d]\n", i);
169 if (!touchpad.injector) {
174 touchpad.owned_injector ? "normal" : "test");
175 result.appendFormat("touches = %d\n", touchpad.touches);
177 touchpad.last_device_x, touchpad.last_device_y);
179 touchpad.last_motion_event_buttons);
180 touchpad.injector->dumpInternal(result);