Commit 20fc5e6
committed
input: Split out
When I implemented the `from_java()` constructors for `MotionEvent`
and `KeyEvent` in #456, I used a single `InputEventJava` wrapper since
that could wrap the existing `enum InputEvent` and only need a single
destructor calling `AInputEvent_release()` (which must only be called
when the input event was created from Java).
This however requires existing callers to `MotionEvent::from_java()` and
`KeyEvent::from_java()` to _unwrap_/unpack that nested `enum InputEvent`
again in order to get access to the underlying native methods, despite
already calling a specific constructor method (since Android makes a
distinction between both types).
Not that that is even reachable, since the nested `InputEvent` member
was private and there was no `Deref` into `&InputEvent` anywhere making
it impossible to use this API in any meaningful way.
Solve both issues by splitting the `struct` into a `Motion` and `Key`
variant, and implement `Deref` on both to their respective type. No
wrapper `InputEventJava` remains since there does not appear to be any
reason to pass both of these types into a single API.InputEventJava into Motion and Key with Deref
1 parent 29f27b7 commit 20fc5e6
2 files changed
Lines changed: 48 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
574 | 574 | | |
575 | 575 | | |
576 | 576 | | |
577 | | - | |
| 577 | + | |
578 | 578 | | |
579 | 579 | | |
580 | 580 | | |
| |||
589 | 589 | | |
590 | 590 | | |
591 | 591 | | |
592 | | - | |
| 592 | + | |
593 | 593 | | |
594 | 594 | | |
595 | 595 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | | - | |
| 29 | + | |
31 | 30 | | |
32 | 31 | | |
33 | | - | |
| 32 | + | |
34 | 33 | | |
35 | 34 | | |
36 | | - | |
37 | | - | |
38 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
39 | 71 | | |
40 | 72 | | |
41 | 73 | | |
42 | 74 | | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
| 75 | + | |
48 | 76 | | |
49 | 77 | | |
50 | 78 | | |
| |||
428 | 456 | | |
429 | 457 | | |
430 | 458 | | |
431 | | - | |
| 459 | + | |
432 | 460 | | |
433 | | - | |
434 | | - | |
435 | | - | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
436 | 464 | | |
437 | 465 | | |
438 | 466 | | |
| |||
1421 | 1449 | | |
1422 | 1450 | | |
1423 | 1451 | | |
1424 | | - | |
| 1452 | + | |
1425 | 1453 | | |
1426 | | - | |
1427 | | - | |
1428 | | - | |
| 1454 | + | |
1429 | 1455 | | |
1430 | 1456 | | |
1431 | 1457 | | |
| |||
0 commit comments