mirror of https://github.com/adamdruppe/arsd.git
better compatibility with edge triggered eventloop
This commit is contained in:
parent
f9a105b914
commit
d53a37794b
17
terminal.d
17
terminal.d
|
@ -1668,6 +1668,23 @@ struct RealTimeConsoleInput {
|
|||
InputEvent[] readNextEvents() {
|
||||
terminal.flush(); // make sure all output is sent out before we try to get input
|
||||
|
||||
// we want to starve the read, especially if we're called from an edge-triggered
|
||||
// epoll (which might happen in version=with_eventloop.. impl detail there subject
|
||||
// to change).
|
||||
auto initial = readNextEventsHelper();
|
||||
|
||||
// lol this calls select() inside a function prolly called from epoll but meh,
|
||||
// it is the simplest thing that can possibly work. The alternative would be
|
||||
// doing non-blocking reads and buffering in the nextRaw function (not a bad idea
|
||||
// btw, just a bit more of a hassle).
|
||||
while(timedCheckForInput(0))
|
||||
initial ~= readNextEventsHelper();
|
||||
return initial;
|
||||
}
|
||||
|
||||
// The helper reads just one actual event from the pipe...
|
||||
version(Posix)
|
||||
InputEvent[] readNextEventsHelper() {
|
||||
InputEvent[] charPressAndRelease(dchar character) {
|
||||
if((flags & ConsoleInputFlags.releasedKeys))
|
||||
return [
|
||||
|
|
Loading…
Reference in New Issue