Commit 71f44e7a authored by Stefan Monnier's avatar Stefan Monnier

* 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.
parent 2171e172
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
......
......@@ -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;
......
......@@ -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);
......
......@@ -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 */
......
......@@ -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 */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment