terminal-vga: stop reading from kbd/mouse on SIGUSR2

This commit is contained in:
K. Lange 2018-10-27 16:17:54 +09:00
parent ad9fc6caa4
commit e3fd396897
1 changed files with 15 additions and 0 deletions

View File

@ -1152,6 +1152,17 @@ void handle_mouse_abs(mouse_device_packet_t * packet) {
handle_mouse_event(packet);
}
static int input_stopped = 0;
void sig_suspend_input(int sig) {
(void)sig;
char exit_message[] = "[Input stopped]\n";
write(fd_slave, exit_message, sizeof(exit_message));
input_stopped = 1;
signal(SIGUSR2, sig_suspend_input);
}
int main(int argc, char ** argv) {
@ -1200,6 +1211,8 @@ int main(int argc, char ** argv) {
system("cursor-off"); /* Might GPF */
signal(SIGUSR2, sig_suspend_input);
int pid = getpid();
uint32_t f = fork();
@ -1266,6 +1279,8 @@ int main(int argc, char ** argv) {
check_for_exit();
if (input_stopped) continue;
if (index == 0) {
maybe_flip_cursor();
int r = read(fd_master, buf, 1024);