summaryrefslogtreecommitdiff
path: root/src/term.c
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2008-09-12 04:10:59 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2008-09-12 04:10:59 +0000
commited5ff21d09be6c15cefcc000fe266604a4c83544 (patch)
tree5c34b6717780c1f0afc537ecd77d4e4584930ecc /src/term.c
parentda39107c7b70daf7dc0a160936bdb565bbc36918 (diff)
downloademacs-ed5ff21d09be6c15cefcc000fe266604a4c83544.tar.gz
* 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/term.c')
-rw-r--r--src/term.c14
1 files changed, 10 insertions, 4 deletions
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. */)
}
}
+void
+close_gpm ()
+{
+ if (gpm_fd >= 0)
+ delete_gpm_wait_descriptor (gpm_fd);
+ while (Gpm_Close()); /* close all the stack */
+ gpm_tty = NULL;
+}
+
DEFUN ("gpm-mouse-stop", Fgpm_mouse_stop, Sgpm_mouse_stop,
0, 0, 0,
doc: /* Close a connection to Gpm. */)
@@ -3141,10 +3150,7 @@ DEFUN ("gpm-mouse-stop", Fgpm_mouse_stop, Sgpm_mouse_stop,
if (!tty || gpm_tty != tty)
return Qnil; /* Not activated on this terminal, nothing to do. */
- if (gpm_fd >= 0)
- delete_gpm_wait_descriptor (gpm_fd);
- while (Gpm_Close()); /* close all the stack */
- gpm_tty = NULL;
+ close_gpm ();
return Qnil;
}
#endif /* HAVE_GPM */