diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 8 | ||||
| -rw-r--r-- | src/keyboard.c | 12 | ||||
| -rw-r--r-- | src/term.c | 8 | ||||
| -rw-r--r-- | src/termhooks.h | 2 |
4 files changed, 22 insertions, 8 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index f6f8d2b89a5..93a3810d3bd 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2009-03-27 Kevin Ryde <user42@zip.com.au> | ||
| 2 | |||
| 3 | * keyboard.c (tty_read_avail_input): Don't treat a -1 return from | ||
| 4 | Gpm_GetEvent as an error that justifies closing the filedescriptor. | ||
| 5 | * term.c (close_gpm): Get the filedescriptor as a (new) parameter. | ||
| 6 | (Fgpm_mouse_stop): Pass that new parameter. | ||
| 7 | * termhooks.h (close_gpm): Adjust prototype. | ||
| 8 | |||
| 1 | 2009-03-26 Stefan Monnier <monnier@iro.umontreal.ca> | 9 | 2009-03-26 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 10 | ||
| 3 | * lisp.h (Fx_focus_frame): Declare. | 11 | * lisp.h (Fx_focus_frame): Declare. |
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, | |||
| 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) |
diff --git a/src/term.c b/src/term.c index 3fbc3c46c4d..6d6bfaf412f 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -3150,10 +3150,10 @@ Gpm-mouse can only be activated for one tty at a time. */) | |||
| 3150 | } | 3150 | } |
| 3151 | 3151 | ||
| 3152 | void | 3152 | void |
| 3153 | close_gpm () | 3153 | close_gpm (int fd) |
| 3154 | { | 3154 | { |
| 3155 | if (gpm_fd >= 0) | 3155 | if (fd >= 0) |
| 3156 | delete_gpm_wait_descriptor (gpm_fd); | 3156 | delete_gpm_wait_descriptor (fd); |
| 3157 | while (Gpm_Close()); /* close all the stack */ | 3157 | while (Gpm_Close()); /* close all the stack */ |
| 3158 | gpm_tty = NULL; | 3158 | gpm_tty = NULL; |
| 3159 | } | 3159 | } |
| @@ -3171,7 +3171,7 @@ DEFUN ("gpm-mouse-stop", Fgpm_mouse_stop, Sgpm_mouse_stop, | |||
| 3171 | if (!tty || gpm_tty != tty) | 3171 | if (!tty || gpm_tty != tty) |
| 3172 | return Qnil; /* Not activated on this terminal, nothing to do. */ | 3172 | return Qnil; /* Not activated on this terminal, nothing to do. */ |
| 3173 | 3173 | ||
| 3174 | close_gpm (); | 3174 | close_gpm (gpm_fd); |
| 3175 | return Qnil; | 3175 | return Qnil; |
| 3176 | } | 3176 | } |
| 3177 | #endif /* HAVE_GPM */ | 3177 | #endif /* HAVE_GPM */ |
diff --git a/src/termhooks.h b/src/termhooks.h index d8f0cb0b295..33d89674273 100644 --- a/src/termhooks.h +++ b/src/termhooks.h | |||
| @@ -653,7 +653,7 @@ extern void delete_terminal P_ ((struct terminal *)); | |||
| 653 | extern struct terminal *initial_terminal; | 653 | extern struct terminal *initial_terminal; |
| 654 | 654 | ||
| 655 | #ifdef HAVE_GPM | 655 | #ifdef HAVE_GPM |
| 656 | extern void close_gpm (void); | 656 | extern void close_gpm (int gpm_fd); |
| 657 | #endif | 657 | #endif |
| 658 | 658 | ||
| 659 | /* arch-tag: 33a00ecc-52b5-4186-a410-8801ac9f087d | 659 | /* arch-tag: 33a00ecc-52b5-4186-a410-8801ac9f087d |