阅读:2403回复:0

鼠标中键映射为MENU键

楼主#
更多 发布于:2022-05-27 18:18
index 9dbabfb6..d9483155
--- a/native/services/inputflinger/InputReader.cpp
+++ b/native/services/inputflinger/InputReader.cpp
@@ -212,7 +212,7 @@ static inline bool sourcesMatchMask(uint32_t sources, uint32_t sourceMask) {
 static bool isPointerDown(int32_t buttonState) {
     return buttonState &
             (AMOTION_EVENT_BUTTON_PRIMARY | AMOTION_EVENT_BUTTON_SECONDARY
-                    | AMOTION_EVENT_BUTTON_TERTIARY);
+                               /* | AMOTION_EVENT_BUTTON_TERTIARY */);
 }


 static float calculateCommonVector(float a, float b) {
@@ -251,6 +251,9 @@ static void synthesizeButtonKeys(InputReaderContext* context, int32_t action,
     synthesizeButtonKey(context, action, when, deviceId, source, policyFlags,
             lastButtonState, currentButtonState,
             AMOTION_EVENT_BUTTON_FORWARD, AKEYCODE_FORWARD);
+       synthesizeButtonKey(context, action, when, deviceId, source, policyFlags,
+            lastButtonState, currentButtonState,
+            AMOTION_EVENT_BUTTON_TERTIARY, AKEYCODE_MENU);// MIDDLE mouth -> menu
 }


不解释太多,USB事件是从common/drivers/input/mousedev.c上报,在InputReader中解析,与常规的按键事件小有差别
调试命令:getevent -p,或者-i,或者-l,dumpsys input可以查看键值和up/down状态

最新喜欢:

zhaoyf13zhaoyf...
游客

返回顶部