鼠标右键映射为在Jelly Bean中遍历

时间:2012-11-15 13:26:39

标签: android

我们更改了`framework / base / services / input / inputreader.cpp中的部分代码,使鼠标右键单击工作以便遍历。

case BTN_RIGHT:
    mBtnRight = rawEvent->value;
    break;

case BTN_RIGHT:                       
    mBtnBack = rawEvent->value;
    break;

它正在接收所有鼠标事件。当我单击鼠标右键时,它正在接收动作事件以及键事件。但是它无法分派键事件。

给出错误:


D/InputDispatcher( 1229): dispatchKey - eventTime=1352984476958100000, deviceId=2, source=0x2002, policyFlags=0x42000000, action=0x1, flags=0x0, keyCode=0x4, scanCode=0x0, metaState=0x0, repeatCount=0, downTime=1352984476958100000
D/InputDispatcher( 1229): Waiting for application to become ready for input: AppWindowToken{41294900 token=Token{411c0f90 ActivityRecord{41301e68 com.android.calculator2/.Calculator}}} - Window{413ff3c0 com.android.calculator2/com.android.calculator2.Calculator paused=false}.  Reason: Waiting because the focused window has not finished processing the input events that were previously delivered to it.
D/InputDispatcher( 1229): findFocusedWindow finished: injectionResult=-1, timeSpentWaitingForApplication=0.0ms

这是Jelly Bean的错误吗?

1 个答案:

答案 0 :(得分:2)

要使鼠标Right_click作为后退按钮工作,请执行以下更改。它对我有用。

 in function reset(InputDevice* device) {

            replace mBtnRight = device->isKeyPressed(BTN_RIGHT); line to

                    mBtnBack =  device->isKeyPressed(BTN_RIGHT);

             and 
  in function process(const RawEvent* rawEvent) {

              remove  3 lines   case BTN_RIGHT:
                                mBtnRight = rawEvent->value;
                                break;
                     and Add "case BTN_RIGHT:" before case BTN_BACK:" as shown below

                     case BTN_RIGHT:
                     case BTN_BACK:                       
                     mBtnBack = rawEvent->value;
                     break;

/ *这就是它对我有用。 * /