From cd25ae2e9f8cf1d155084c125dae4058fccb6544 Mon Sep 17 00:00:00 2001 From: dickmao Date: Tue, 6 Oct 2020 14:21:03 -0400 Subject: [PATCH] Process sentinels need to work under X and commandline This is also noted in https://emacs.stackexchange.com/questions/60408/\ process-sentinels-dont-run-during-init-in-gui-emacs * 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. --- 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 50c425077a..c7056e49da 100644 --- a/src/process.c +++ b/src/process.c @@ -469,8 +469,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); @@ -479,12 +486,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); fd_callback_info[fd].flags |= PROCESS_FD; } diff --git a/src/process.h b/src/process.h index a783a31cb8..5660270e8f 100644 --- a/src/process.h +++ b/src/process.h @@ -284,6 +284,7 @@ pset_gnutls_cred_type (struct Lisp_Process *p, Lisp_Object val) 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 203085e24f..2fd1177625 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.26.2