diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2009-03-27 16:14:23 +0000 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2009-03-27 16:14:23 +0000 |
commit | d347e4943a371d278f479db89d932f136d6ee659 (patch) | |
tree | 547f6c4557fb62a0135c1193e2019d6d73255294 /src/keyboard.c | |
parent | d696b0d53f982b231b26124f180a92a0e7935c06 (diff) | |
download | emacs-d347e4943a371d278f479db89d932f136d6ee659.tar.gz |
* keyboard.c (tty_read_avail_input): Don't treat a -1 return from
Gpm_GetEvent as an error that justifies closing the filedescriptor.
* term.c (close_gpm): Get the filedescriptor as a (new) parameter.
(Fgpm_mouse_stop): Pass that new parameter.
* termhooks.h (close_gpm): Adjust prototype.
Diffstat (limited to 'src/keyboard.c')
-rw-r--r-- | src/keyboard.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index 1bdf9a37b50..527a82b55ff 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -7184,17 +7184,23 @@ tty_read_avail_input (struct terminal *terminal, { Gpm_Event event; struct input_event hold_quit; - int gpm; + int gpm, fd = gpm_fd; EVENT_INIT (hold_quit); hold_quit.kind = NO_EVENT; + /* gpm==1 if event received. + gpm==0 if the GPM daemon has closed the connection, in which case + Gpm_GetEvent closes gpm_fd and clears it to -1, which is why + we save it in `fd' so close_gpm can remove it from the + select masks. + gpm==-1 if a protocol error or EWOULDBLOCK; the latter is normal. */ while (gpm = Gpm_GetEvent (&event), gpm == 1) { nread += handle_one_term_event (tty, &event, &hold_quit); } - if (gpm < 0) + if (gpm == 0) /* Presumably the GPM daemon has closed the connection. */ - close_gpm (); + close_gpm (fd); if (hold_quit.kind != NO_EVENT) kbd_buffer_store_event (&hold_quit); if (nread) |