From d4f4fc67382462bfcd3cff3fd5c50aa9405364bf Mon Sep 17 00:00:00 2001 From: Aaron Lieberman Date: Sat, 31 Dec 2022 21:03:08 -0800 Subject: [PATCH] Fix bug with UnixMainLoop and idle When running in WSL Ubuntu, I was unable to process input. The issue was that when there's an idle function registered with the main loop, UnixMainLoop doesn't ever call poll. Without the poll call, pollmap doesn't get updated and the input callback doesn't get called. Change this so that it calls poll every loop iteration, even if there's an idle function. --- Terminal.Gui/ConsoleDrivers/CursesDriver/UnixMainLoop.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Terminal.Gui/ConsoleDrivers/CursesDriver/UnixMainLoop.cs b/Terminal.Gui/ConsoleDrivers/CursesDriver/UnixMainLoop.cs index 64dbb3b18..2e5e8720a 100644 --- a/Terminal.Gui/ConsoleDrivers/CursesDriver/UnixMainLoop.cs +++ b/Terminal.Gui/ConsoleDrivers/CursesDriver/UnixMainLoop.cs @@ -176,16 +176,15 @@ namespace Terminal.Gui { { UpdatePollMap (); - if (CheckTimers (wait, out var pollTimeout)) { - return true; - } + bool checkTimersResult = CheckTimers (wait, out var pollTimeout); var n = poll (pollmap, (uint)pollmap.Length, pollTimeout); if (n == KEY_RESIZE) { winChanged = true; } - return n >= KEY_RESIZE || CheckTimers (wait, out pollTimeout); + + return checkTimersResult || n >= KEY_RESIZE; } bool CheckTimers (bool wait, out int pollTimeout)