mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-07-28 11:49:10 +00:00
Forward action button to device
On click event, only the whole buttons state was passed to the device. In addition, on ACTION_DOWN and ACTION_UP, pass the button associated to the action. Refs #3635 <https://github.com/Genymobile/scrcpy/issues/3635> Co-authored-by: Romain Vimont <rom@rom1v.com> Signed-off-by: Romain Vimont <rom@rom1v.com>
This commit is contained in:
parent
07806ba915
commit
0afef0c634
8 changed files with 29 additions and 10 deletions
|
@ -90,13 +90,14 @@ static void test_serialize_inject_touch_event(void) {
|
|||
},
|
||||
},
|
||||
.pressure = 1.0f,
|
||||
.action_button = AMOTION_EVENT_BUTTON_PRIMARY,
|
||||
.buttons = AMOTION_EVENT_BUTTON_PRIMARY,
|
||||
},
|
||||
};
|
||||
|
||||
unsigned char buf[SC_CONTROL_MSG_MAX_SIZE];
|
||||
size_t size = sc_control_msg_serialize(&msg, buf);
|
||||
assert(size == 28);
|
||||
assert(size == 32);
|
||||
|
||||
const unsigned char expected[] = {
|
||||
SC_CONTROL_MSG_TYPE_INJECT_TOUCH_EVENT,
|
||||
|
@ -105,7 +106,8 @@ static void test_serialize_inject_touch_event(void) {
|
|||
0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0xc8, // 100 200
|
||||
0x04, 0x38, 0x07, 0x80, // 1080 1920
|
||||
0xff, 0xff, // pressure
|
||||
0x00, 0x00, 0x00, 0x01 // AMOTION_EVENT_BUTTON_PRIMARY
|
||||
0x00, 0x00, 0x00, 0x01, // AMOTION_EVENT_BUTTON_PRIMARY (action button)
|
||||
0x00, 0x00, 0x00, 0x01, // AMOTION_EVENT_BUTTON_PRIMARY (buttons)
|
||||
};
|
||||
assert(!memcmp(buf, expected, sizeof(expected)));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue