comparison src/term.c @ 84969:6e58c1c8c0fc

(Fgpm_mouse_start): Don't signal an error if already activated on this tty. (Fgpm_mouse_stop): Only deactivate if it was activated on this tty.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Fri, 28 Sep 2007 20:07:54 +0000
parents 85eb2660cbe3
children a35153116cd0
comparison
equal deleted inserted replaced
84968:85eb2660cbe3 84969:6e58c1c8c0fc
2950 struct tty_display_info *tty 2950 struct tty_display_info *tty
2951 = ((f)->output_method == output_termcap 2951 = ((f)->output_method == output_termcap
2952 ? (f)->terminal->display_info.tty : NULL); 2952 ? (f)->terminal->display_info.tty : NULL);
2953 Gpm_Connect connection; 2953 Gpm_Connect connection;
2954 2954
2955 if (!tty)
2956 error ("Gpm-mouse only works in the GNU/Linux console");
2957 if (gpm_tty == tty)
2958 return Qnil; /* Already activated, nothing to do. */
2955 if (gpm_tty) 2959 if (gpm_tty)
2956 error ("Gpm-mouse can only be activated for one tty at a time"); 2960 error ("Gpm-mouse can only be activated for one tty at a time");
2957 if (!tty)
2958 error ("Gpm-mouse only works in the GNU/Linux console");
2959 2961
2960 connection.eventMask = ~0; 2962 connection.eventMask = ~0;
2961 connection.defaultMask = ~GPM_HARD; 2963 connection.defaultMask = ~GPM_HARD;
2962 connection.maxMod = ~0; 2964 connection.maxMod = ~0;
2963 connection.minMod = 0; 2965 connection.minMod = 0;
2981 DEFUN ("gpm-mouse-stop", Fgpm_mouse_stop, Sgpm_mouse_stop, 2983 DEFUN ("gpm-mouse-stop", Fgpm_mouse_stop, Sgpm_mouse_stop,
2982 0, 0, 0, 2984 0, 0, 0,
2983 doc: /* Close a connection to Gpm. */) 2985 doc: /* Close a connection to Gpm. */)
2984 () 2986 ()
2985 { 2987 {
2988 struct frame *f = SELECTED_FRAME ();
2989 struct tty_display_info *tty
2990 = ((f)->output_method == output_termcap
2991 ? (f)->terminal->display_info.tty : NULL);
2992
2993 if (!tty || gpm_tty != tty)
2994 return Qnil; /* Not activated on this terminal, nothing to do. */
2995
2986 if (gpm_fd >= 0) 2996 if (gpm_fd >= 0)
2987 delete_gpm_wait_descriptor (gpm_fd); 2997 delete_gpm_wait_descriptor (gpm_fd);
2988 while (Gpm_Close()); /* close all the stack */ 2998 while (Gpm_Close()); /* close all the stack */
2989 gpm_tty = NULL; 2999 gpm_tty = NULL;
2990 return Qnil; 3000 return Qnil;