diff src/term.c @ 98155:314662df7c17

* 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.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Fri, 12 Sep 2008 04:10:59 +0000
parents 62a07e57ef40
children 758774f72111
line wrap: on
line diff
--- a/src/term.c	Fri Sep 12 03:41:11 2008 +0000
+++ b/src/term.c	Fri Sep 12 04:10:59 2008 +0000
@@ -3128,6 +3128,15 @@
     }
 }
 
+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 @@
   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 */