Commit 103df92
committed
mp.input: use unique event handlers for input.get requests
This makes changes to mp.input and console.lua so that every input.get
request uses a unique script-message to handle input events.
Previously, making new input.get requests shortly after the termination
of a previous request made by the same script could cause a race
condition where the input handler was closed but the new request
was still being drawn in the UI. This was caused by the `closed` event
for the previous request being received only after the new request was
registered, hence closing the event handler for the new request instead.
In addition, this commit makes the behaviour of calling input.get while
another request is active more consistent. When a new request is
received it overwrites the in-progress request, sending a `closed`
event. However, previously, the `closed` event could not be sent if both
requests came from the same script, as the new request would have
overwritten the event handler. Now, the `closed` event is called
regardless of where the new request comes from.1 parent 9483d6e commit 103df92
3 files changed
+38
-21
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
653 | 653 | | |
654 | 654 | | |
655 | 655 | | |
| 656 | + | |
| 657 | + | |
656 | 658 | | |
657 | | - | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
658 | 663 | | |
659 | 664 | | |
660 | 665 | | |
| |||
666 | 671 | | |
667 | 672 | | |
668 | 673 | | |
669 | | - | |
| 674 | + | |
670 | 675 | | |
| 676 | + | |
| 677 | + | |
671 | 678 | | |
672 | 679 | | |
673 | 680 | | |
674 | 681 | | |
675 | | - | |
676 | | - | |
677 | | - | |
678 | | - | |
| 682 | + | |
| 683 | + | |
679 | 684 | | |
680 | | - | |
| 685 | + | |
| 686 | + | |
681 | 687 | | |
682 | 688 | | |
683 | 689 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| 99 | + | |
99 | 100 | | |
100 | 101 | | |
101 | 102 | | |
| |||
949 | 950 | | |
950 | 951 | | |
951 | 952 | | |
952 | | - | |
| 953 | + | |
953 | 954 | | |
954 | 955 | | |
955 | 956 | | |
| |||
1070 | 1071 | | |
1071 | 1072 | | |
1072 | 1073 | | |
1073 | | - | |
| 1074 | + | |
1074 | 1075 | | |
1075 | 1076 | | |
1076 | 1077 | | |
| |||
1079 | 1080 | | |
1080 | 1081 | | |
1081 | 1082 | | |
1082 | | - | |
| 1083 | + | |
1083 | 1084 | | |
1084 | 1085 | | |
1085 | 1086 | | |
| |||
1481 | 1482 | | |
1482 | 1483 | | |
1483 | 1484 | | |
1484 | | - | |
| 1485 | + | |
1485 | 1486 | | |
1486 | 1487 | | |
1487 | 1488 | | |
| |||
1651 | 1652 | | |
1652 | 1653 | | |
1653 | 1654 | | |
1654 | | - | |
| 1655 | + | |
1655 | 1656 | | |
1656 | 1657 | | |
1657 | 1658 | | |
| |||
1662 | 1663 | | |
1663 | 1664 | | |
1664 | 1665 | | |
1665 | | - | |
1666 | | - | |
1667 | | - | |
| 1666 | + | |
| 1667 | + | |
| 1668 | + | |
1668 | 1669 | | |
1669 | 1670 | | |
1670 | 1671 | | |
1671 | 1672 | | |
| 1673 | + | |
1672 | 1674 | | |
1673 | 1675 | | |
1674 | 1676 | | |
| |||
1721 | 1723 | | |
1722 | 1724 | | |
1723 | 1725 | | |
| 1726 | + | |
| 1727 | + | |
| 1728 | + | |
| 1729 | + | |
1724 | 1730 | | |
1725 | 1731 | | |
1726 | 1732 | | |
1727 | 1733 | | |
1728 | | - | |
| 1734 | + | |
1729 | 1735 | | |
1730 | 1736 | | |
1731 | 1737 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
34 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
35 | 39 | | |
36 | 40 | | |
37 | 41 | | |
| |||
44 | 48 | | |
45 | 49 | | |
46 | 50 | | |
47 | | - | |
| 51 | + | |
48 | 52 | | |
49 | 53 | | |
| 54 | + | |
| 55 | + | |
50 | 56 | | |
51 | 57 | | |
52 | 58 | | |
53 | 59 | | |
54 | 60 | | |
| 61 | + | |
55 | 62 | | |
56 | | - | |
57 | | - | |
58 | | - | |
| 63 | + | |
59 | 64 | | |
60 | 65 | | |
61 | 66 | | |
| |||
0 commit comments