diff options
| author | Stefan Monnier | 2007-09-21 17:10:48 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2007-09-21 17:10:48 +0000 |
| commit | 71f44e7ad49b434c191a84fcd46a7dfa94894735 (patch) | |
| tree | 7e825db8ca5a9413b8757d720b6a7d17a51543fe /src/term.c | |
| parent | 2171e172b8c1cf5ce4d4bc6cb123050352623d00 (diff) | |
| download | emacs-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/term.c')
| -rw-r--r-- | src/term.c | 27 |
1 files changed, 14 insertions, 13 deletions
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). */ |
| 199 | int term_gpm = 0; | 199 | struct tty_display_info *gpm_tty = NULL; |
| 200 | |||
| 201 | /* The id of the terminal device for which we have gpm support. */ | ||
| 202 | int 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 | ||
| 2962 | DEFUN ("term-open-connection", Fterm_open_connection, Sterm_open_connection, | 2959 | DEFUN ("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. |
| 2962 | We 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 */ |