Firefly开源社区

[风之空响]firefly解决部分游戏/APP只支持触摸操作,不支持鼠标点击的问题

741

积分

68

威望

68

贡献

技术大神

Rank: 3Rank: 3

积分
741
QQ
发表于 2017-6-20 11:59:00     
本帖最后由 风之空响 于 2017-7-13 09:51 编辑

***************************************
更新:在7.1上面有点问题,会导致kodi二级菜单不能用
***************************************
之前有群友问过这个问题,今天有空就贴一下解决办法吧。部分游戏/APP只支持触摸操作,不支持鼠标点击的问题,例如现在大热的王者荣耀就是这样,不要问我是怎么知道的。
其实解决办法很简单,就是在InputReader.cpp中,当鼠标点击操作的时候,把它替换成触摸操作,是不是很简单
下面贴一下代码:

  1. --- a/frameworks/native/services/inputflinger/InputReader.cpp
  2. +++ b/frameworks/native/services/inputflinger/InputReader.cpp
  3. @@ -2738,6 +2738,14 @@ void CursorInputMapper::sync(nsecs_t when) {
  4.              motionEventAction = AMOTION_EVENT_ACTION_HOVER_MOVE;
  5.          }

  6. +        if(motionEventAction == AMOTION_EVENT_ACTION_DOWN
  7. +             || motionEventAction == AMOTION_EVENT_ACTION_UP)
  8. +         {
  9. +             ALOGD("CursorInputMapper::sync motionEventAction==DOWN or UP");
  10. +             pointerProperties.toolType = AMOTION_EVENT_TOOL_TYPE_FINGER;
  11. +             mSource = AINPUT_SOURCE_TOUCHSCREEN;
  12. +        }
  13. +
  14.          if (buttonsReleased) {
  15.              BitSet32 released(buttonsReleased);
  16.              while (!released.isEmpty()) {
复制代码

这个修改方式适用于 android4.4.2-android7.0






下面贴一下群友的解决方式
  1. frameworks/native/services/inputflinger/InputReader.cpp
  2.     String8 deviceTypeString;
  3.     if (getDevice()->getConfiguration().tryGetProperty(String8("touch.deviceType"),
  4.             deviceTypeString)) {
  5.         if (deviceTypeString == "touchScreen") {
  6.             mParameters.deviceType = Parameters::DEVICE_TYPE_TOUCH_SCREEN;
  7.         } else if (deviceTypeString == "touchPad") {
  8.             mParameters.deviceType = Parameters::DEVICE_TYPE_TOUCH_PAD;
  9.         } else if (deviceTypeString == "touchNavigation") {
  10.             mParameters.deviceType = Parameters::DEVICE_TYPE_TOUCH_NAVIGATION;
  11.         } else if (deviceTypeString == "pointer") {
  12.             mParameters.deviceType = Parameters::DEVICE_TYPE_POINTER;//<font color="#ff0000">此处改为Parameters::DEVICE_TYPE_TOUCH_SCREEN</font>
  13.         } else if (deviceTypeString != "default") {
  14.             ALOGW("Invalid value for touch.deviceType: '%s'", deviceTypeString.string());
  15.         }
  16.     }
复制代码





回复

使用道具 举报

79

积分

0

威望

0

贡献

技术小白

积分
79
发表于 2018-5-12 20:43:11     
很好啊
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

友情链接 : 爱板网 电子发烧友论坛 云汉电子社区 粤ICP备14022046号-2
快速回复 返回顶部 返回列表