Handle down/up actions for BACK or POWER ON
Pressing right-click generates either BACK or POWER ON, depending on the current screen state. Forward DOWN and UP events separately to the device, to generate key events accordingly. Ref #1062 <https://github.com/Genymobile/scrcpy/issues/1062>
This commit is contained in:
@@ -140,14 +140,18 @@ static void test_serialize_inject_scroll_event(void) {
|
||||
static void test_serialize_back_or_screen_on(void) {
|
||||
struct control_msg msg = {
|
||||
.type = CONTROL_MSG_TYPE_BACK_OR_SCREEN_ON,
|
||||
.back_or_screen_on = {
|
||||
.action = AKEY_EVENT_ACTION_UP,
|
||||
},
|
||||
};
|
||||
|
||||
unsigned char buf[CONTROL_MSG_SERIALIZED_MAX_SIZE];
|
||||
int size = control_msg_serialize(&msg, buf);
|
||||
assert(size == 1);
|
||||
assert(size == 2);
|
||||
|
||||
const unsigned char expected[] = {
|
||||
CONTROL_MSG_TYPE_BACK_OR_SCREEN_ON,
|
||||
AKEY_EVENT_ACTION_UP,
|
||||
};
|
||||
assert(!memcmp(buf, expected, sizeof(expected)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user