aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Monnier2007-09-21 17:10:48 +0000
committerStefan Monnier2007-09-21 17:10:48 +0000
commit71f44e7ad49b434c191a84fcd46a7dfa94894735 (patch)
tree7e825db8ca5a9413b8757d720b6a7d17a51543fe /src
parent2171e172b8c1cf5ce4d4bc6cb123050352623d00 (diff)
downloademacs-71f44e7ad49b434c191a84fcd46a7dfa94894735.tar.gz
emacs-71f44e7ad49b434c191a84fcd46a7dfa94894735.zip
* 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.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog12
-rw-r--r--src/keyboard.c2
-rw-r--r--src/sysdep.c2
-rw-r--r--src/term.c27
-rw-r--r--src/termhooks.h7
5 files changed, 30 insertions, 20 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 9867b64582e..5e31ba344fd 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,15 @@
12007-09-21 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * termhooks.h (term_gpm): Delete. Use gpm_tty's NULLness instead.
4 (gpm_tty): Change its type.
5 * term.c (term_gpm): Delete. Use gpm_tty's NULLness instead.
6 (gpm_tty): Change its type and initialize it.
7 (Fterm_open_connection): Check the frame is indeed a tty.
8 Use the new gpm_tty.
9 (Fterm_close_connection): Use the new gpm_tty.
10 * keyboard.c (tty_read_avail_input): Use the new gpm_tty.
11 * sysdep.c (init_sys_modes): term_gpm -> gpm_tty.
12
12007-09-21 Juanma Barranquero <lekktu@gmail.com> 132007-09-21 Juanma Barranquero <lekktu@gmail.com>
2 14
3 * w32term.c (x_draw_glyph_string): Use strike_through_color, not 15 * w32term.c (x_draw_glyph_string): Use strike_through_color, not
diff --git a/src/keyboard.c b/src/keyboard.c
index 1a09436557e..79b9ca32a61 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -7121,7 +7121,7 @@ tty_read_avail_input (struct terminal *terminal,
7121 return 0; /* The terminal is suspended. */ 7121 return 0; /* The terminal is suspended. */
7122 7122
7123#ifdef HAVE_GPM 7123#ifdef HAVE_GPM
7124 if (term_gpm && gpm_tty == tty->terminal->id) 7124 if (gpm_tty == tty)
7125 { 7125 {
7126 Gpm_Event event; 7126 Gpm_Event event;
7127 struct input_event hold_quit; 7127 struct input_event hold_quit;
diff --git a/src/sysdep.c b/src/sysdep.c
index d0a22808723..88f4b99da8e 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -1752,7 +1752,7 @@ init_sys_modes (tty_out)
1752 fcntl (fileno (tty_out->input), F_SETOWN, getpid ()); 1752 fcntl (fileno (tty_out->input), F_SETOWN, getpid ());
1753 init_sigio (fileno (tty_out->input)); 1753 init_sigio (fileno (tty_out->input));
1754#ifdef HAVE_GPM 1754#ifdef HAVE_GPM
1755 if (term_gpm) 1755 if (gpm_tty)
1756 { 1756 {
1757 fcntl (gpm_fd, F_SETOWN, getpid ()); 1757 fcntl (gpm_fd, F_SETOWN, getpid ());
1758 fcntl (gpm_fd, F_SETFL, fcntl (gpm_fd, F_GETFL, 0) | O_NONBLOCK); 1758 fcntl (gpm_fd, F_SETFL, fcntl (gpm_fd, F_GETFL, 0) | O_NONBLOCK);
diff --git a/src/term.c b/src/term.c
index e212259cef8..160e387e98d 100644
--- a/src/term.c
+++ b/src/term.c
@@ -195,11 +195,8 @@ static void term_mouse_highlight (struct frame *f, int x, int y);
195#include <sys/fcntl.h> 195#include <sys/fcntl.h>
196#include "buffer.h" 196#include "buffer.h"
197 197
198/* Nonzero means mouse is enabled on Linux console. */ 198/* The device for which we have enabled gpm support (or NULL). */
199int term_gpm = 0; 199struct tty_display_info *gpm_tty = NULL;
200
201/* The id of the terminal device for which we have gpm support. */
202int gpm_tty;
203 200
204/* These variables describe the range of text currently shown in its 201/* These variables describe the range of text currently shown in its
205 mouse-face, together with the window they apply to. As long as 202 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
2961 2958
2962DEFUN ("term-open-connection", Fterm_open_connection, Sterm_open_connection, 2959DEFUN ("term-open-connection", Fterm_open_connection, Sterm_open_connection,
2963 0, 0, 0, 2960 0, 0, 0,
2964 doc: /* Open a connection to Gpm. */) 2961 doc: /* Open a connection to Gpm.
2962We only support Gpm on one tty at a time. */)
2965 () 2963 ()
2966{ 2964{
2967 struct tty_display_info *tty = FRAME_TTY (SELECTED_FRAME ()); 2965 struct frame *f = SELECTED_FRAME ();
2966 struct tty_display_info *tty
2967 = ((f)->output_method == output_termcap
2968 ? (f)->terminal->display_info.tty : NULL);
2968 Gpm_Connect connection; 2969 Gpm_Connect connection;
2969 2970
2971 if (gpm_tty || !tty) /* Already running, or not applicable. */
2972 return Qnil;
2973
2970 connection.eventMask = ~0; 2974 connection.eventMask = ~0;
2971 connection.defaultMask = ~GPM_HARD; 2975 connection.defaultMask = ~GPM_HARD;
2972 connection.maxMod = ~0; 2976 connection.maxMod = ~0;
2973 connection.minMod = 0; 2977 connection.minMod = 0;
2974 gpm_zerobased = 1; 2978 gpm_zerobased = 1;
2975 2979
2976 /* We only support GPM on the controlling tty. */ 2980 if (Gpm_Open (&connection, 0) < 0)
2977 if (term_gpm || tty->terminal->id > 1
2978 || Gpm_Open (&connection, 0) < 0)
2979 return Qnil; 2981 return Qnil;
2980 else 2982 else
2981 { 2983 {
2982 term_gpm = 1; 2984 gpm_tty = tty;
2983 gpm_tty = tty->terminal->id;
2984 reset_sys_modes (tty); 2985 reset_sys_modes (tty);
2985 init_sys_modes (tty); 2986 init_sys_modes (tty);
2986 add_gpm_wait_descriptor (gpm_fd); 2987 add_gpm_wait_descriptor (gpm_fd);
@@ -2995,7 +2996,7 @@ DEFUN ("term-close-connection", Fterm_close_connection, Sterm_close_connection,
2995{ 2996{
2996 delete_gpm_wait_descriptor (gpm_fd); 2997 delete_gpm_wait_descriptor (gpm_fd);
2997 while (Gpm_Close()); /* close all the stack */ 2998 while (Gpm_Close()); /* close all the stack */
2998 term_gpm = 0; 2999 gpm_tty = NULL;
2999 return Qnil; 3000 return Qnil;
3000} 3001}
3001#endif /* HAVE_GPM */ 3002#endif /* HAVE_GPM */
diff --git a/src/termhooks.h b/src/termhooks.h
index c4b3839f972..8cb1194dc07 100644
--- a/src/termhooks.h
+++ b/src/termhooks.h
@@ -302,11 +302,8 @@ enum {
302extern int handle_one_term_event (struct tty_display_info *, Gpm_Event *, struct input_event *); 302extern int handle_one_term_event (struct tty_display_info *, Gpm_Event *, struct input_event *);
303extern void term_mouse_moveto (int, int); 303extern void term_mouse_moveto (int, int);
304 304
305/* Nonzero means mouse is enabled on Linux console */ 305/* The device for which we have enabled gpm support. */
306extern int term_gpm; 306extern struct tty_display_info *gpm_tty;
307
308/* The id of the terminal device for which we have gpm support. */
309extern int gpm_tty;
310#endif 307#endif
311 308
312#endif /* CONSP */ 309#endif /* CONSP */