mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-08-03 06:08:39 +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;
|
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
|
// action
|
||||||
AndroidMotioneventAction action;
|
|
||||||
switch (from->type()) {
|
switch (from->type()) {
|
||||||
case QEvent::KeyPress:
|
case QEvent::KeyPress:
|
||||||
action = AMOTION_EVENT_ACTION_DOWN;
|
action |= AMOTION_EVENT_ACTION_DOWN;
|
||||||
break;
|
break;
|
||||||
case QEvent::KeyRelease:
|
case QEvent::KeyRelease:
|
||||||
action = AMOTION_EVENT_ACTION_UP;
|
action |= AMOTION_EVENT_ACTION_UP;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
|
@ -51,7 +66,7 @@ void InputConvertGame::keyEvent(const QKeyEvent *from, const QSize& frameSize, c
|
||||||
if (!controlEvent) {
|
if (!controlEvent) {
|
||||||
return;
|
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);
|
sendControlEvent(controlEvent);
|
||||||
|
|
||||||
if (QEvent::KeyPress == from->type()) {
|
if (QEvent::KeyPress == from->type()) {
|
||||||
|
@ -60,7 +75,9 @@ void InputConvertGame::keyEvent(const QKeyEvent *from, const QSize& frameSize, c
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
pos.setY(pos.y() - 50);
|
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);
|
sendControlEvent(controlEvent2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue