diff options
| author | Stefan Monnier | 2008-09-12 04:10:59 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2008-09-12 04:10:59 +0000 |
| commit | ed5ff21d09be6c15cefcc000fe266604a4c83544 (patch) | |
| tree | 5c34b6717780c1f0afc537ecd77d4e4584930ecc /src | |
| parent | da39107c7b70daf7dc0a160936bdb565bbc36918 (diff) | |
| download | emacs-ed5ff21d09be6c15cefcc000fe266604a4c83544.tar.gz emacs-ed5ff21d09be6c15cefcc000fe266604a4c83544.zip | |
* term.c (close_gpm): New fun extracted from Fgpm_mouse_stop.
(Fgpm_mouse_stop): Use it.
* termhooks.h (close_gpm): Declare.
* keyboard.c (tty_read_avail_input): Forcefully close the gpm
connection if Gpm_GetEvent fails.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/keyboard.c | 3 | ||||
| -rw-r--r-- | src/term.c | 14 | ||||
| -rw-r--r-- | src/termhooks.h | 4 |
4 files changed, 23 insertions, 4 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index adcc4851d22..1136e5e6057 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,11 @@ | |||
| 1 | 2008-09-12 Stefan Monnier <monnier@iro.umontreal.ca> | 1 | 2008-09-12 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 2 | ||
| 3 | * term.c (close_gpm): New fun extracted from Fgpm_mouse_stop. | ||
| 4 | (Fgpm_mouse_stop): Use it. | ||
| 5 | * termhooks.h (close_gpm): Declare. | ||
| 6 | * keyboard.c (tty_read_avail_input): Forcefully close the gpm | ||
| 7 | connection if Gpm_GetEvent fails. | ||
| 8 | |||
| 3 | * window.c (set_window_buffer): Always preserve current-buffer. | 9 | * window.c (set_window_buffer): Always preserve current-buffer. |
| 4 | 10 | ||
| 5 | 2008-09-12 Glenn Morris <rgm@gnu.org> | 11 | 2008-09-12 Glenn Morris <rgm@gnu.org> |
diff --git a/src/keyboard.c b/src/keyboard.c index 5015155d97f..cd18b91abf1 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -7110,6 +7110,9 @@ tty_read_avail_input (struct terminal *terminal, | |||
| 7110 | while (gpm = Gpm_GetEvent (&event), gpm == 1) { | 7110 | while (gpm = Gpm_GetEvent (&event), gpm == 1) { |
| 7111 | nread += handle_one_term_event (tty, &event, &hold_quit); | 7111 | nread += handle_one_term_event (tty, &event, &hold_quit); |
| 7112 | } | 7112 | } |
| 7113 | if (gpm < 0) | ||
| 7114 | /* Presumably the GPM daemon has closed the connection. */ | ||
| 7115 | close_gpm (); | ||
| 7113 | if (hold_quit.kind != NO_EVENT) | 7116 | if (hold_quit.kind != NO_EVENT) |
| 7114 | kbd_buffer_store_event (&hold_quit); | 7117 | kbd_buffer_store_event (&hold_quit); |
| 7115 | if (nread) | 7118 | if (nread) |
diff --git a/src/term.c b/src/term.c index 367040288ef..19382f9667c 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -3128,6 +3128,15 @@ Gpm-mouse can only be activated for one tty at a time. */) | |||
| 3128 | } | 3128 | } |
| 3129 | } | 3129 | } |
| 3130 | 3130 | ||
| 3131 | void | ||
| 3132 | close_gpm () | ||
| 3133 | { | ||
| 3134 | if (gpm_fd >= 0) | ||
| 3135 | delete_gpm_wait_descriptor (gpm_fd); | ||
| 3136 | while (Gpm_Close()); /* close all the stack */ | ||
| 3137 | gpm_tty = NULL; | ||
| 3138 | } | ||
| 3139 | |||
| 3131 | DEFUN ("gpm-mouse-stop", Fgpm_mouse_stop, Sgpm_mouse_stop, | 3140 | DEFUN ("gpm-mouse-stop", Fgpm_mouse_stop, Sgpm_mouse_stop, |
| 3132 | 0, 0, 0, | 3141 | 0, 0, 0, |
| 3133 | doc: /* Close a connection to Gpm. */) | 3142 | doc: /* Close a connection to Gpm. */) |
| @@ -3141,10 +3150,7 @@ DEFUN ("gpm-mouse-stop", Fgpm_mouse_stop, Sgpm_mouse_stop, | |||
| 3141 | if (!tty || gpm_tty != tty) | 3150 | if (!tty || gpm_tty != tty) |
| 3142 | return Qnil; /* Not activated on this terminal, nothing to do. */ | 3151 | return Qnil; /* Not activated on this terminal, nothing to do. */ |
| 3143 | 3152 | ||
| 3144 | if (gpm_fd >= 0) | 3153 | close_gpm (); |
| 3145 | delete_gpm_wait_descriptor (gpm_fd); | ||
| 3146 | while (Gpm_Close()); /* close all the stack */ | ||
| 3147 | gpm_tty = NULL; | ||
| 3148 | return Qnil; | 3154 | return Qnil; |
| 3149 | } | 3155 | } |
| 3150 | #endif /* HAVE_GPM */ | 3156 | #endif /* HAVE_GPM */ |
diff --git a/src/termhooks.h b/src/termhooks.h index 9edd4bf052e..71a935420d5 100644 --- a/src/termhooks.h +++ b/src/termhooks.h | |||
| @@ -643,5 +643,9 @@ extern void delete_terminal P_ ((struct terminal *)); | |||
| 643 | /* The initial terminal device, created by initial_term_init. */ | 643 | /* The initial terminal device, created by initial_term_init. */ |
| 644 | extern struct terminal *initial_terminal; | 644 | extern struct terminal *initial_terminal; |
| 645 | 645 | ||
| 646 | #ifdef HAVE_GPM | ||
| 647 | extern void close_gpm (void); | ||
| 648 | #endif | ||
| 649 | |||
| 646 | /* arch-tag: 33a00ecc-52b5-4186-a410-8801ac9f087d | 650 | /* arch-tag: 33a00ecc-52b5-4186-a410-8801ac9f087d |
| 647 | (do not change this comment) */ | 651 | (do not change this comment) */ |