From: Stefan Monnier Date: Fri, 28 Sep 2007 20:07:54 +0000 (+0000) Subject: (Fgpm_mouse_start): Don't signal an error if already activated on this tty. X-Git-Tag: emacs-pretest-23.0.90~10584 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=4ce5ab773b96bcef00e412e08b84c8b374a949fe;p=emacs.git (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. --- diff --git a/src/ChangeLog b/src/ChangeLog index f7698a2cfc3..7ed8e48a4cc 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,9 @@ 2007-09-28 Stefan Monnier + * term.c (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. + * term.c (mouse_face_window): Rename from Qmouse_face_window. Update all users. (handle_one_term_event): Use Gpm_DrawPointer. 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. */) ? (f)->terminal->display_info.tty : NULL); Gpm_Connect connection; - if (gpm_tty) - error ("Gpm-mouse can only be activated for one tty at a time"); if (!tty) error ("Gpm-mouse only works in the GNU/Linux console"); + if (gpm_tty == tty) + return Qnil; /* Already activated, nothing to do. */ + if (gpm_tty) + error ("Gpm-mouse can only be activated for one tty at a time"); connection.eventMask = ~0; connection.defaultMask = ~GPM_HARD; @@ -2983,6 +2985,14 @@ DEFUN ("gpm-mouse-stop", Fgpm_mouse_stop, Sgpm_mouse_stop, doc: /* Close a connection to Gpm. */) () { + struct frame *f = SELECTED_FRAME (); + struct tty_display_info *tty + = ((f)->output_method == output_termcap + ? (f)->terminal->display_info.tty : NULL); + + 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 */