Mercurial > emacs
comparison src/keyboard.c @ 102744:d69c45eb83b1
* 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.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Fri, 27 Mar 2009 16:14:23 +0000 |
parents | ae4c4cf5b7eb |
children | 3292a88d45ce |
comparison
equal
deleted
inserted
replaced
102743:043083354750 | 102744:d69c45eb83b1 |
---|---|
7182 #ifdef HAVE_GPM | 7182 #ifdef HAVE_GPM |
7183 if (gpm_tty == tty) | 7183 if (gpm_tty == tty) |
7184 { | 7184 { |
7185 Gpm_Event event; | 7185 Gpm_Event event; |
7186 struct input_event hold_quit; | 7186 struct input_event hold_quit; |
7187 int gpm; | 7187 int gpm, fd = gpm_fd; |
7188 | 7188 |
7189 EVENT_INIT (hold_quit); | 7189 EVENT_INIT (hold_quit); |
7190 hold_quit.kind = NO_EVENT; | 7190 hold_quit.kind = NO_EVENT; |
7191 | 7191 |
7192 /* gpm==1 if event received. | |
7193 gpm==0 if the GPM daemon has closed the connection, in which case | |
7194 Gpm_GetEvent closes gpm_fd and clears it to -1, which is why | |
7195 we save it in `fd' so close_gpm can remove it from the | |
7196 select masks. | |
7197 gpm==-1 if a protocol error or EWOULDBLOCK; the latter is normal. */ | |
7192 while (gpm = Gpm_GetEvent (&event), gpm == 1) { | 7198 while (gpm = Gpm_GetEvent (&event), gpm == 1) { |
7193 nread += handle_one_term_event (tty, &event, &hold_quit); | 7199 nread += handle_one_term_event (tty, &event, &hold_quit); |
7194 } | 7200 } |
7195 if (gpm < 0) | 7201 if (gpm == 0) |
7196 /* Presumably the GPM daemon has closed the connection. */ | 7202 /* Presumably the GPM daemon has closed the connection. */ |
7197 close_gpm (); | 7203 close_gpm (fd); |
7198 if (hold_quit.kind != NO_EVENT) | 7204 if (hold_quit.kind != NO_EVENT) |
7199 kbd_buffer_store_event (&hold_quit); | 7205 kbd_buffer_store_event (&hold_quit); |
7200 if (nread) | 7206 if (nread) |
7201 return nread; | 7207 return nread; |
7202 } | 7208 } |