terminal-vga: stop reading from kbd/mouse on SIGUSR2
This commit is contained in:
parent
ad9fc6caa4
commit
e3fd396897
@ -1152,6 +1152,17 @@ void handle_mouse_abs(mouse_device_packet_t * packet) {
|
|||||||
handle_mouse_event(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) {
|
int main(int argc, char ** argv) {
|
||||||
|
|
||||||
@ -1200,6 +1211,8 @@ int main(int argc, char ** argv) {
|
|||||||
|
|
||||||
system("cursor-off"); /* Might GPF */
|
system("cursor-off"); /* Might GPF */
|
||||||
|
|
||||||
|
signal(SIGUSR2, sig_suspend_input);
|
||||||
|
|
||||||
int pid = getpid();
|
int pid = getpid();
|
||||||
uint32_t f = fork();
|
uint32_t f = fork();
|
||||||
|
|
||||||
@ -1266,6 +1279,8 @@ int main(int argc, char ** argv) {
|
|||||||
|
|
||||||
check_for_exit();
|
check_for_exit();
|
||||||
|
|
||||||
|
if (input_stopped) continue;
|
||||||
|
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
maybe_flip_cursor();
|
maybe_flip_cursor();
|
||||||
int r = read(fd_master, buf, 1024);
|
int r = read(fd_master, buf, 1024);
|
||||||
|
Loading…
Reference in New Issue
Block a user