Commit 994d9841 authored by Nick Roberts's avatar Nick Roberts

(gpm_wait_mask, max_gpm_desc): New variables.

(wait_reading_process_output): Wait on gpm_fd too.
(add_gpm_wait_descriptor, delete_gpm_wait_descriptor)): New functions.
(add_gpm_wait_descriptor_called_flag): New variable.
(delete_keyboard_wait_descriptor): Check gpm_wait_mask.
parent 02ed7a7c
...@@ -328,14 +328,18 @@ extern int timers_run; ...@@ -328,14 +328,18 @@ extern int timers_run;
static SELECT_TYPE input_wait_mask; static SELECT_TYPE input_wait_mask;
/* Mask that excludes keyboard input descriptor (s). */ /* Mask that excludes keyboard input descriptor(s). */
static SELECT_TYPE non_keyboard_wait_mask; static SELECT_TYPE non_keyboard_wait_mask;
/* Mask that excludes process input descriptor (s). */ /* Mask that excludes process input descriptor(s). */
static SELECT_TYPE non_process_wait_mask; static SELECT_TYPE non_process_wait_mask;
/* Mask for the gpm mouse input descriptor. */
static SELECT_TYPE gpm_wait_mask;
#ifdef NON_BLOCKING_CONNECT #ifdef NON_BLOCKING_CONNECT
/* Mask of bits indicating the descriptors that we wait for connect to /* Mask of bits indicating the descriptors that we wait for connect to
complete on. Once they complete, they are removed from this mask complete on. Once they complete, they are removed from this mask
...@@ -357,6 +361,9 @@ static int max_process_desc; ...@@ -357,6 +361,9 @@ static int max_process_desc;
/* The largest descriptor currently in use for keyboard input. */ /* The largest descriptor currently in use for keyboard input. */
static int max_keyboard_desc; static int max_keyboard_desc;
/* The largest descriptor currently in use for gpm mouse input. */
static int max_gpm_desc;
/* Nonzero means delete a process right away if it exits. */ /* Nonzero means delete a process right away if it exits. */
static int delete_exited_processes; static int delete_exited_processes;
...@@ -4446,7 +4453,8 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display, ...@@ -4446,7 +4453,8 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
IF_NON_BLOCKING_CONNECT (Ctemp = connect_wait_mask); IF_NON_BLOCKING_CONNECT (Ctemp = connect_wait_mask);
EMACS_SET_SECS_USECS (timeout, 0, 0); EMACS_SET_SECS_USECS (timeout, 0, 0);
if ((select (max (max_process_desc, max_keyboard_desc) + 1, if ((select (max (max (max_process_desc, max_keyboard_desc),
max_gpm_desc) + 1,
&Atemp, &Atemp,
#ifdef NON_BLOCKING_CONNECT #ifdef NON_BLOCKING_CONNECT
(num_pending_connects > 0 ? &Ctemp : (SELECT_TYPE *)0), (num_pending_connects > 0 ? &Ctemp : (SELECT_TYPE *)0),
...@@ -4591,7 +4599,8 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display, ...@@ -4591,7 +4599,8 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
} }
#endif #endif
nfds = select (max (max_process_desc, max_keyboard_desc) + 1, nfds = select (max (max (max_process_desc, max_keyboard_desc),
max_gpm_desc) + 1,
&Available, &Available,
#ifdef NON_BLOCKING_CONNECT #ifdef NON_BLOCKING_CONNECT
(check_connect ? &Connecting : (SELECT_TYPE *)0), (check_connect ? &Connecting : (SELECT_TYPE *)0),
...@@ -6978,6 +6987,21 @@ add_keyboard_wait_descriptor (desc) ...@@ -6978,6 +6987,21 @@ add_keyboard_wait_descriptor (desc)
max_keyboard_desc = desc; max_keyboard_desc = desc;
} }
static int add_gpm_wait_descriptor_called_flag;
void
add_gpm_wait_descriptor (desc)
int desc;
{
if (! add_gpm_wait_descriptor_called_flag)
FD_CLR (0, &input_wait_mask);
add_gpm_wait_descriptor_called_flag = 1;
FD_SET (desc, &input_wait_mask);
FD_SET (desc, &gpm_wait_mask);
if (desc > max_gpm_desc)
max_gpm_desc = desc;
}
/* From now on, do not expect DESC to give keyboard input. */ /* From now on, do not expect DESC to give keyboard input. */
void void
...@@ -6993,10 +7017,29 @@ delete_keyboard_wait_descriptor (desc) ...@@ -6993,10 +7017,29 @@ delete_keyboard_wait_descriptor (desc)
if (desc == max_keyboard_desc) if (desc == max_keyboard_desc)
for (fd = 0; fd < lim; fd++) for (fd = 0; fd < lim; fd++)
if (FD_ISSET (fd, &input_wait_mask) if (FD_ISSET (fd, &input_wait_mask)
&& !FD_ISSET (fd, &non_keyboard_wait_mask)) && !FD_ISSET (fd, &non_keyboard_wait_mask)
&& !FD_ISSET (fd, &gpm_wait_mask))
max_keyboard_desc = fd; max_keyboard_desc = fd;
} }
void
delete_gpm_wait_descriptor (desc)
int desc;
{
int fd;
int lim = max_gpm_desc;
FD_CLR (desc, &input_wait_mask);
FD_CLR (desc, &non_process_wait_mask);
if (desc == max_gpm_desc)
for (fd = 0; fd < lim; fd++)
if (FD_ISSET (fd, &input_wait_mask)
&& !FD_ISSET (fd, &non_keyboard_wait_mask)
&& !FD_ISSET (fd, &non_process_wait_mask))
max_gpm_desc = fd;
}
/* Return nonzero if *MASK has a bit set /* Return nonzero if *MASK has a bit set
that corresponds to one of the keyboard input descriptors. */ that corresponds to one of the keyboard input descriptors. */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment