aboutsummaryrefslogtreecommitdiffstats
path: root/src/term.c
diff options
context:
space:
mode:
authorStefan Monnier2007-09-28 20:07:54 +0000
committerStefan Monnier2007-09-28 20:07:54 +0000
commit4ce5ab773b96bcef00e412e08b84c8b374a949fe (patch)
tree94e81ba9b79ae44eeb96bb1196d8c1268241798c /src/term.c
parent6178ce5e8b701c44d7c31ed54fa8021f049784d1 (diff)
downloademacs-4ce5ab773b96bcef00e412e08b84c8b374a949fe.tar.gz
emacs-4ce5ab773b96bcef00e412e08b84c8b374a949fe.zip
(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.
Diffstat (limited to 'src/term.c')
-rw-r--r--src/term.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/term.c b/src/term.c
index 6dbfb5daee8..f00f7b2fb75 100644
--- a/src/term.c
+++ b/src/term.c
@@ -2952,10 +2952,12 @@ Gpm-mouse can only be activated for one tty at a time. */)
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 (gpm_tty)
2956 error ("Gpm-mouse can only be activated for one tty at a time");
2957 if (!tty) 2955 if (!tty)
2958 error ("Gpm-mouse only works in the GNU/Linux console"); 2956 error ("Gpm-mouse only works in the GNU/Linux console");
2957 if (gpm_tty == tty)
2958 return Qnil; /* Already activated, nothing to do. */
2959 if (gpm_tty)
2960 error ("Gpm-mouse can only be activated for one tty at a time");
2959 2961
2960 connection.eventMask = ~0; 2962 connection.eventMask = ~0;
2961 connection.defaultMask = ~GPM_HARD; 2963 connection.defaultMask = ~GPM_HARD;
@@ -2983,6 +2985,14 @@ DEFUN ("gpm-mouse-stop", Fgpm_mouse_stop, Sgpm_mouse_stop,
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 */