diff options
author | James Ross-Gowan <rossymiles@gmail.com> | 2016-10-13 22:40:00 +1100 |
---|---|---|
committer | James Ross-Gowan <rossymiles@gmail.com> | 2016-10-14 08:44:33 +1100 |
commit | 6a8d1cdd49ca6c9d4656b9450253c71438ef5c49 (patch) | |
tree | 68b22a9e1ca1972bd2946b07e8f0633c4d96e7b0 /misc/rendezvous.h | |
parent | b5357e8ba751167832a480ae53d1c54acd1c2f6f (diff) | |
download | mpv-6a8d1cdd49ca6c9d4656b9450253c71438ef5c49.tar.bz2 mpv-6a8d1cdd49ca6c9d4656b9450253c71438ef5c49.tar.xz |
terminal-win: clean up console input
The original version of this code in getch2-win.c fetched 128 console
events at once. This was probably to maximize the chance of getting a
key event if there were other events in the buffer, because it returned
the value of the first key event it found and ignored all others. Since
that code was written, it has been modified to receive console input in
an event-based way using an input thread, so it is probably not
necessary to fetch so many events at once any more. Also, I'm not sure
what it would have done if there were more than 128 events in the
console input buffer. It's possible that fetching multiple events at a
time also had performance advantages, but I can't find any other
programs that do this. Even libuv just fetches one console event at a
time.
Change read_input() to fetch only one event at a time and to consume all
available events before returning to WaitForMultipleObjects. Also remove
some outdated comments and pass the console handle through to the input
thread instead of calling GetStdHandle multiple times (I think this is
theoretically more correct because it is possible for the handles
returned by GetStdHandle to be changed by other threads.)
Diffstat (limited to 'misc/rendezvous.h')
0 files changed, 0 insertions, 0 deletions