Add callbacks that get invoked before the next call to select(), which will allow for a nice fix to https://github.com/fish-shell/fish-shell/issues/608. Eliminate the poll handler, and replace it with this mechanism.

This commit is contained in:
ridiculousfish
2013-04-03 13:49:58 -07:00
parent 11a444e914
commit 1543d02f96
3 changed files with 45 additions and 19 deletions

View File

@@ -815,9 +815,6 @@ void reader_init()
#ifdef VDSUSP
shell_modes.c_cc[VDSUSP] = _POSIX_VDISABLE;
#endif
/* Repaint if necessary before each byte is read. This lets us react immediately to universal variable color changes. */
input_common_set_poll_callback(reader_repaint_if_needed);
}
@@ -868,12 +865,21 @@ void reader_repaint_if_needed()
}
}
static void reader_repaint_if_needed_one_arg(void * unused)
{
reader_repaint_if_needed();
}
void reader_react_to_color_change()
{
if (data)
if (! data)
return;
if (! data->repaint_needed || ! data->screen_reset_needed)
{
data->repaint_needed = true;
data->screen_reset_needed = true;
input_common_add_callback(reader_repaint_if_needed_one_arg, NULL);
}
}