From 5be26b43f441e429dadbf7c8beccb351a84f1275 Mon Sep 17 00:00:00 2001 From: dickmao Date: Thu, 13 May 2021 15:21:53 +0200 Subject: [PATCH] Process sentinels need to work under X and commandline * src/process.c (add_non_keyboard_read_fd): Make this a public function. (add_process_read_fd): Fold old, static add_non_keyboard_read_fd guts into here. * src/xsmfns.c (ice_conn_watch_CB): Call add_non_keyboard_read_fd (bug#43834). --- src/process.c | 15 ++++++++------- src/process.h | 1 + src/xsmfns.c | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/process.c b/src/process.c index 84e301a87a5..47a2a6f1a31 100644 --- a/src/process.c +++ b/src/process.c @@ -473,8 +473,15 @@ add_read_fd (int fd, fd_callback func, void *data) fd_callback_info[fd].data = data; } +void +add_non_keyboard_read_fd (int fd, fd_callback func, void *data) +{ + add_read_fd(fd, func, data); + fd_callback_info[fd].flags &= ~KEYBOARD_FD; +} + static void -add_non_keyboard_read_fd (int fd) +add_process_read_fd (int fd) { eassert (fd >= 0 && fd < FD_SETSIZE); eassert (fd_callback_info[fd].func == NULL); @@ -483,12 +490,6 @@ add_non_keyboard_read_fd (int fd) fd_callback_info[fd].flags |= FOR_READ; if (fd > max_desc) max_desc = fd; -} - -static void -add_process_read_fd (int fd) -{ - add_non_keyboard_read_fd (fd); eassert (0 <= fd && fd < FD_SETSIZE); fd_callback_info[fd].flags |= PROCESS_FD; } diff --git a/src/process.h b/src/process.h index d041ada5867..0890f253a40 100644 --- a/src/process.h +++ b/src/process.h @@ -284,6 +284,7 @@ extern bool kbd_on_hold_p (void); typedef void (*fd_callback) (int fd, void *data); extern void add_read_fd (int fd, fd_callback func, void *data); +extern void add_non_keyboard_read_fd (int fd, fd_callback func, void *data); extern void delete_read_fd (int fd); extern void add_write_fd (int fd, fd_callback func, void *data); extern void delete_write_fd (int fd); diff --git a/src/xsmfns.c b/src/xsmfns.c index 10565a4b25f..ddb86d82fe1 100644 --- a/src/xsmfns.c +++ b/src/xsmfns.c @@ -357,7 +357,7 @@ ice_conn_watch_CB (IceConn iceConn, IcePointer clientData, } ice_fd = IceConnectionNumber (iceConn); - add_read_fd (ice_fd, x_session_check_input, NULL); + add_non_keyboard_read_fd (ice_fd, x_session_check_input, NULL); } /* Create the client leader window. */ -- 2.39.5