comparison 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
comparison
equal deleted inserted replaced
98154:b67146e746c0 98155:314662df7c17
3126 add_gpm_wait_descriptor (gpm_fd); 3126 add_gpm_wait_descriptor (gpm_fd);
3127 return Qnil; 3127 return Qnil;
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. */)
3134 () 3143 ()
3135 { 3144 {
3139 ? (f)->terminal->display_info.tty : NULL); 3148 ? (f)->terminal->display_info.tty : NULL);
3140 3149
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 */
3151 3157
3152 3158