mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-08-16 23:39:18 +00:00
Use precise scrolling values
Since SDL 2.0.18, the amount scrolled horizontally or vertically is exposed as a float (between 0 and 1). Forward a precise value to the Android device when possible. Refs <https://wiki.libsdl.org/SDL_MouseWheelEvent> Fixes #3363 <https://github.com/Genymobile/scrcpy/issues/3363> PR #3369 <https://github.com/Genymobile/scrcpy/pull/3369> Signed-off-by: Romain Vimont <rom@rom1v.com>
This commit is contained in:
parent
1f138aef41
commit
57056d078d
9 changed files with 37 additions and 30 deletions
|
@ -132,14 +132,14 @@ static void test_serialize_inject_scroll_event(void) {
|
|||
|
||||
unsigned char buf[SC_CONTROL_MSG_MAX_SIZE];
|
||||
size_t size = sc_control_msg_serialize(&msg, buf);
|
||||
assert(size == 25);
|
||||
assert(size == 21);
|
||||
|
||||
const unsigned char expected[] = {
|
||||
SC_CONTROL_MSG_TYPE_INJECT_SCROLL_EVENT,
|
||||
0x00, 0x00, 0x01, 0x04, 0x00, 0x00, 0x04, 0x02, // 260 1026
|
||||
0x04, 0x38, 0x07, 0x80, // 1080 1920
|
||||
0x00, 0x00, 0x00, 0x01, // 1
|
||||
0xFF, 0xFF, 0xFF, 0xFF, // -1
|
||||
0x7F, 0xFF, // 1 (float encoded as i16)
|
||||
0x80, 0x00, // -1 (float encoded as i16)
|
||||
0x00, 0x00, 0x00, 0x01, // 1
|
||||
};
|
||||
assert(!memcmp(buf, expected, sizeof(expected)));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue