mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-04-21 20:15:04 +00:00
多点触控测试
This commit is contained in:
parent
2f74f9c068
commit
4c6e017322
1 changed files with 22 additions and 5 deletions
|
@ -24,14 +24,29 @@ void InputConvertGame::keyEvent(const QKeyEvent *from, const QSize& frameSize, c
|
|||
return;
|
||||
}
|
||||
|
||||
int action = 0;
|
||||
|
||||
// pointer index
|
||||
int pointerIndex = 0;
|
||||
|
||||
if (from->key() == Qt::Key_W) {
|
||||
pointerIndex = 0x0000;
|
||||
} else if (from->key() == Qt::Key_D) {
|
||||
pointerIndex = 0x0100;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
action |= pointerIndex;
|
||||
|
||||
// action
|
||||
AndroidMotioneventAction action;
|
||||
switch (from->type()) {
|
||||
case QEvent::KeyPress:
|
||||
action = AMOTION_EVENT_ACTION_DOWN;
|
||||
action |= AMOTION_EVENT_ACTION_DOWN;
|
||||
break;
|
||||
case QEvent::KeyRelease:
|
||||
action = AMOTION_EVENT_ACTION_UP;
|
||||
action |= AMOTION_EVENT_ACTION_UP;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
|
@ -51,7 +66,7 @@ void InputConvertGame::keyEvent(const QKeyEvent *from, const QSize& frameSize, c
|
|||
if (!controlEvent) {
|
||||
return;
|
||||
}
|
||||
controlEvent->setMouseEventData(action, AMOTION_EVENT_BUTTON_PRIMARY, QRect(pos.toPoint(), frameSize));
|
||||
controlEvent->setMouseEventData((AndroidMotioneventAction)action, AMOTION_EVENT_BUTTON_PRIMARY, QRect(pos.toPoint(), frameSize));
|
||||
sendControlEvent(controlEvent);
|
||||
|
||||
if (QEvent::KeyPress == from->type()) {
|
||||
|
@ -60,7 +75,9 @@ void InputConvertGame::keyEvent(const QKeyEvent *from, const QSize& frameSize, c
|
|||
return;
|
||||
}
|
||||
pos.setY(pos.y() - 50);
|
||||
controlEvent2->setMouseEventData(AMOTION_EVENT_ACTION_MOVE, AMOTION_EVENT_BUTTON_PRIMARY, QRect(pos.toPoint(), frameSize));
|
||||
action &= AMOTION_EVENT_ACTION_POINTER_INDEX_MASK;
|
||||
action |= AMOTION_EVENT_ACTION_MOVE;
|
||||
controlEvent2->setMouseEventData((AndroidMotioneventAction)action, AMOTION_EVENT_BUTTON_PRIMARY, QRect(pos.toPoint(), frameSize));
|
||||
sendControlEvent(controlEvent2);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue