mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-10-05 07:39:28 +00:00
server添加多点触摸接口
This commit is contained in:
parent
4e386e879e
commit
310518f8ee
3 changed files with 179 additions and 22 deletions
|
@ -10,6 +10,7 @@ public class ControlEventReader {
|
|||
|
||||
private static final int KEYCODE_PAYLOAD_LENGTH = 9;
|
||||
private static final int MOUSE_PAYLOAD_LENGTH = 13;
|
||||
private static final int TOUCH_PAYLOAD_LENGTH = 10;
|
||||
private static final int SCROLL_PAYLOAD_LENGTH = 16;
|
||||
private static final int COMMAND_PAYLOAD_LENGTH = 1;
|
||||
|
||||
|
@ -48,7 +49,6 @@ public class ControlEventReader {
|
|||
return null;
|
||||
}
|
||||
int savedPosition = buffer.position();
|
||||
|
||||
int type = buffer.get();
|
||||
ControlEvent controlEvent;
|
||||
switch (type) {
|
||||
|
@ -61,6 +61,9 @@ public class ControlEventReader {
|
|||
case ControlEvent.TYPE_MOUSE:
|
||||
controlEvent = parseMouseControlEvent();
|
||||
break;
|
||||
case ControlEvent.TYPE_TOUCH:
|
||||
controlEvent = parseMouseTouchEvent();
|
||||
break;
|
||||
case ControlEvent.TYPE_SCROLL:
|
||||
controlEvent = parseScrollControlEvent();
|
||||
break;
|
||||
|
@ -113,6 +116,16 @@ public class ControlEventReader {
|
|||
return ControlEvent.createMotionControlEvent(action, buttons, position);
|
||||
}
|
||||
|
||||
private ControlEvent parseMouseTouchEvent() {
|
||||
if (buffer.remaining() < TOUCH_PAYLOAD_LENGTH) {
|
||||
return null;
|
||||
}
|
||||
int id = toUnsigned(buffer.get());
|
||||
int action = toUnsigned(buffer.get());
|
||||
Position position = readPosition(buffer);
|
||||
return ControlEvent.createMotionTouchEvent(id, action, position);
|
||||
}
|
||||
|
||||
private ControlEvent parseScrollControlEvent() {
|
||||
if (buffer.remaining() < SCROLL_PAYLOAD_LENGTH) {
|
||||
return null;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue