]> git.eshelyaron.com Git - emacs.git/commitdiff
* termhooks.h (term_gpm): Delete. Use gpm_tty's NULLness instead.
authorStefan Monnier <monnier@iro.umontreal.ca>
Fri, 21 Sep 2007 17:10:48 +0000 (17:10 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Fri, 21 Sep 2007 17:10:48 +0000 (17:10 +0000)
(gpm_tty): Change its type.
* term.c (term_gpm): Delete.  Use gpm_tty's NULLness instead.
(gpm_tty): Change its type and initialize it.
(Fterm_open_connection): Check the frame is indeed a tty.  Use the new gpm_tty.
(Fterm_close_connection): Use the new gpm_tty.
* keyboard.c (tty_read_avail_input): Use the new gpm_tty.
* sysdep.c (init_sys_modes): term_gpm -> gpm_tty.

src/ChangeLog
src/keyboard.c
src/sysdep.c
src/term.c
src/termhooks.h

index 9867b64582e233cfa805ff1158b9426673279c06..5e31ba344fdec8719bf16a626eda09c119bde140 100644 (file)
@@ -1,3 +1,15 @@
+2007-09-21  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * termhooks.h (term_gpm): Delete.  Use gpm_tty's NULLness instead.
+       (gpm_tty): Change its type.
+       * term.c (term_gpm): Delete.  Use gpm_tty's NULLness instead.
+       (gpm_tty): Change its type and initialize it.
+       (Fterm_open_connection): Check the frame is indeed a tty.
+       Use the new gpm_tty.
+       (Fterm_close_connection): Use the new gpm_tty.
+       * keyboard.c (tty_read_avail_input): Use the new gpm_tty.
+       * sysdep.c (init_sys_modes): term_gpm -> gpm_tty.
+
 2007-09-21  Juanma Barranquero  <lekktu@gmail.com>
 
        * w32term.c (x_draw_glyph_string): Use strike_through_color, not
index 1a09436557e3028d69eb211b8d4b41c1a5c9b700..79b9ca32a61475cd622f9850f3e51bd02a2a216b 100644 (file)
@@ -7121,7 +7121,7 @@ tty_read_avail_input (struct terminal *terminal,
     return 0;                   /* The terminal is suspended. */
 
 #ifdef HAVE_GPM
-  if (term_gpm && gpm_tty == tty->terminal->id)
+  if (gpm_tty == tty)
   {
       Gpm_Event event;
       struct input_event hold_quit;
index d0a22808723e1082b720e74c089d93fb828791c4..88f4b99da8e9f10bc9d81a08cfe5dadec6e6a725 100644 (file)
@@ -1752,7 +1752,7 @@ init_sys_modes (tty_out)
       fcntl (fileno (tty_out->input), F_SETOWN, getpid ());
       init_sigio (fileno (tty_out->input));
 #ifdef HAVE_GPM
-      if (term_gpm)
+      if (gpm_tty)
        {
          fcntl (gpm_fd, F_SETOWN, getpid ());
          fcntl (gpm_fd, F_SETFL, fcntl (gpm_fd, F_GETFL, 0) | O_NONBLOCK);
index e212259cef80003209c76f6211955f8e9cdd4a61..160e387e98dbf0514e2995c90e79d86c1757af47 100644 (file)
@@ -195,11 +195,8 @@ static void term_mouse_highlight (struct frame *f, int x, int y);
 #include <sys/fcntl.h>
 #include "buffer.h"
 
-/* Nonzero means mouse is enabled on Linux console.  */
-int term_gpm = 0;
-
-/* The id of the terminal device for which we have gpm support.  */
-int gpm_tty;
+/* The device for which we have enabled gpm support (or NULL).  */
+struct tty_display_info *gpm_tty = NULL;
 
 /* These variables describe the range of text currently shown in its
    mouse-face, together with the window they apply to.  As long as
@@ -2961,26 +2958,30 @@ handle_one_term_event (struct tty_display_info *tty, Gpm_Event *event, struct in
 
 DEFUN ("term-open-connection", Fterm_open_connection, Sterm_open_connection,
        0, 0, 0,
-       doc: /* Open a connection to Gpm.  */)
+       doc: /* Open a connection to Gpm.
+We only support Gpm on one tty at a time.  */)
      ()
 {
-  struct tty_display_info *tty = FRAME_TTY (SELECTED_FRAME ());
+  struct frame *f = SELECTED_FRAME ();
+  struct tty_display_info *tty
+    = ((f)->output_method == output_termcap
+       ? (f)->terminal->display_info.tty : NULL);
   Gpm_Connect connection;
 
+  if (gpm_tty || !tty)         /* Already running, or not applicable.  */
+    return Qnil;
+
   connection.eventMask = ~0;
   connection.defaultMask = ~GPM_HARD;
   connection.maxMod = ~0;
   connection.minMod = 0;
   gpm_zerobased = 1;
 
-  /* We only support GPM on the controlling tty.  */
-  if (term_gpm || tty->terminal->id > 1
-      || Gpm_Open (&connection, 0) < 0)
+  if (Gpm_Open (&connection, 0) < 0)
     return Qnil;
   else
     {
-      term_gpm = 1;
-      gpm_tty = tty->terminal->id;
+      gpm_tty = tty;
       reset_sys_modes (tty);
       init_sys_modes (tty);
       add_gpm_wait_descriptor (gpm_fd);
@@ -2995,7 +2996,7 @@ DEFUN ("term-close-connection", Fterm_close_connection, Sterm_close_connection,
 {
    delete_gpm_wait_descriptor (gpm_fd);
    while (Gpm_Close()); /* close all the stack */
-   term_gpm = 0;
+   gpm_tty = NULL;
    return Qnil;
 }
 #endif /* HAVE_GPM */
index c4b3839f972576ff49f80d1d6f90994824aed67b..8cb1194dc0701ec7dd0cdd45a8940974a8869814 100644 (file)
@@ -302,11 +302,8 @@ enum {
 extern int handle_one_term_event (struct tty_display_info *, Gpm_Event *, struct input_event *);
 extern void term_mouse_moveto (int, int);
 
-/* Nonzero means mouse is enabled on Linux console */
-extern int term_gpm;
-
-/* The id of the terminal device for which we have gpm support.  */
-extern int gpm_tty;
+/* The device for which we have enabled gpm support.  */
+extern struct tty_display_info *gpm_tty;
 #endif
 
 #endif /* CONSP */