mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-02-07 06:53:33 +00:00
Fix memzoom on Windows
Right now we can't call poll() on file and fifos on Windows. So we work around that by simply blocking on keyboard input. This is OK because on Windows we can't use /proc/*/mem for realtime monitoring, so there's no reason not to block. See #65
This commit is contained in:
parent
f3baa05195
commit
cc56038b05
2 changed files with 7 additions and 2 deletions
|
@ -97,6 +97,7 @@ static noasan textwindows wontreturn void WinMainNew(void) {
|
|||
SetConsoleCP(kNtCpUtf8);
|
||||
SetConsoleOutputCP(kNtCpUtf8);
|
||||
inhand = GetStdHandle(pushpop(kNtStdInputHandle));
|
||||
SetEnvironmentVariable(u"TERM", u"xterm-truecolor");
|
||||
GetConsoleMode(inhand, &__ntconsolemode);
|
||||
SetConsoleMode(inhand, kNtEnableProcessedInput | kNtEnableLineInput |
|
||||
kNtEnableEchoInput | kNtEnableMouseInput |
|
||||
|
|
|
@ -318,6 +318,7 @@ static void PreventBufferbloat(void) {
|
|||
|
||||
static bool HasPendingInput(void) {
|
||||
struct pollfd fds[1];
|
||||
if (IsWindows()) return true; /* XXX */
|
||||
fds[0].fd = 0;
|
||||
fds[0].events = POLLIN;
|
||||
fds[0].revents = 0;
|
||||
|
@ -841,16 +842,19 @@ static void RangesZoom(void) {
|
|||
}
|
||||
|
||||
static void MemZoom(void) {
|
||||
bool ok;
|
||||
ok = false;
|
||||
do {
|
||||
if (action & RESIZED) {
|
||||
GetTtySize();
|
||||
SetupCanvas();
|
||||
action &= ~RESIZED;
|
||||
}
|
||||
if (HasPendingInput()) {
|
||||
if (ok && HasPendingInput()) {
|
||||
ReadKeyboard();
|
||||
continue;
|
||||
if (!IsWindows()) continue; /* XXX */
|
||||
}
|
||||
ok = true;
|
||||
if (pid) {
|
||||
RangesZoom();
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue