diff options
author | Miles Bader <[email protected]> | 2007-06-11 01:00:07 +0000 |
---|---|---|
committer | Miles Bader <[email protected]> | 2007-06-11 01:00:07 +0000 |
commit | 67f3ad67ee317226cb5d1bb139de0cfd883fdc5e (patch) | |
tree | 58a0e1bea7a1d8728fd32e6127a44434e7eac006 /src/term.c | |
parent | d17cf4eb2024cf54e4a216312184665094ee3df4 (diff) | |
parent | 2d715b39ea1c89066f469405d065dd1a6631d28e (diff) |
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 781-792)
- Update from CVS
- Merge from gnus--rel--5.10
- Merge from emacs--rel--22
* emacs--rel--22 (patch 33-41)
* gnus--rel--5.10 (patch 226-228)
- Update from CVS
Revision: [email protected]/emacs--multi-tty--0--patch-21
Diffstat (limited to 'src/term.c')
-rw-r--r-- | src/term.c | 47 |
1 files changed, 17 insertions, 30 deletions
diff --git a/src/term.c b/src/term.c index 3a7490a2a3..ceeac103e8 100644 --- a/src/term.c +++ b/src/term.c @@ -208,11 +208,6 @@ static int mouse_face_past_end; static Lisp_Object Qmouse_face_window; static int mouse_face_face_id; -/* FRAME and X, Y position of mouse when last checked for - highlighting. X and Y can be negative or out of range for the frame. */ -struct frame *mouse_face_mouse_frame; -int mouse_face_mouse_x, mouse_face_mouse_y; - static int pos_x, pos_y; static int last_mouse_x, last_mouse_y; #endif /* HAVE_GPM */ @@ -2344,17 +2339,18 @@ the currently selected frame. */) ***********************************************************************/ #ifdef HAVE_GPM -void term_mouse_moveto (int x, int y) +void +term_mouse_moveto (int x, int y) { const char *name; int fd; + /* TODO: how to set mouse position? name = (const char *) ttyname (0); fd = open (name, O_WRONLY); - /* TODO: how to set mouse position? - SOME_FUNCTION (x, y, fd); */ + SOME_FUNCTION (x, y, fd); close (fd); last_mouse_x = x; - last_mouse_y = y; + last_mouse_y = y; */ } static void @@ -2534,10 +2530,6 @@ term_mouse_highlight (struct frame *f, int x, int y) || !f->glyphs_initialized_p) return; - mouse_face_mouse_x = x; - mouse_face_mouse_y = y; - mouse_face_mouse_frame = f; - /* Which window is that in? */ window = window_from_coordinates (f, x, y, &part, &x, &y, 0); @@ -2779,7 +2771,7 @@ term_mouse_movement (FRAME_PTR frame, Gpm_Event *event) if (event->x != last_mouse_x || event->y != last_mouse_y) { frame->mouse_moved = 1; - term_mouse_highlight (frame, event->x - 1, event->y - 1); + term_mouse_highlight (frame, event->x, event->y); /* Remember which glyph we're now on. */ last_mouse_x = event->x; last_mouse_y = event->y; @@ -2799,7 +2791,7 @@ term_mouse_movement (FRAME_PTR frame, Gpm_Event *event) Set *time to the time the mouse was at the returned position. - This should clear mouse_moved until the next motion + This clears mouse_moved until the next motion event arrives. */ static void term_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, @@ -2807,8 +2799,6 @@ term_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, Lisp_Object *y, unsigned long *time) { struct timeval now; - Lisp_Object frame, window; - struct window *w; *fp = SELECTED_FRAME (); (*fp)->mouse_moved = 0; @@ -2816,13 +2806,8 @@ term_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, *bar_window = Qnil; *part = 0; - XSETINT (*x, last_mouse_x); + XSETINT (*x, last_mouse_x); XSETINT (*y, last_mouse_y); - XSETFRAME (frame, *fp); - window = Fwindow_at (*x, *y, frame); - - XSETINT (*x, last_mouse_x - WINDOW_LEFT_EDGE_COL (XWINDOW (window))); - XSETINT (*y, last_mouse_y - WINDOW_TOP_EDGE_LINE (XWINDOW (window))); gettimeofday(&now, 0); *time = (now.tv_sec * 1000) + (now.tv_usec / 1000); } @@ -2869,7 +2854,7 @@ term_mouse_click (struct input_event *result, Gpm_Event *event, if (event->type & GPM_DRAG) result->modifiers |= drag_modifier; - if (!(event->type & (GPM_MOVE|GPM_DRAG))) { + if (!(event->type & (GPM_MOVE | GPM_DRAG))) { /* 1 << KG_SHIFT */ if (event->modifiers & (1 << 0)) @@ -2885,8 +2870,8 @@ term_mouse_click (struct input_event *result, Gpm_Event *event, result->modifiers |= meta_modifier; } - XSETINT (result->x, event->x - 1); - XSETINT (result->y, event->y - 1); + XSETINT (result->x, event->x); + XSETINT (result->y, event->y); XSETFRAME (result->frame_or_window, f); result->arg = Qnil; return Qnil; @@ -2905,7 +2890,7 @@ handle_one_term_event (struct tty_display_info *tty, Gpm_Event *event, struct in ie.kind = NO_EVENT; ie.arg = Qnil; - if (event->type & GPM_MOVE) { + if (event->type & (GPM_MOVE | GPM_DRAG)) { unsigned char buf[6 * sizeof (short)]; unsigned short *arg = (unsigned short *) buf + 1; const char *name; @@ -2916,8 +2901,8 @@ handle_one_term_event (struct tty_display_info *tty, Gpm_Event *event, struct in /* Display mouse pointer */ buf[sizeof(short) - 1] = 2; /* set selection */ - arg[0] = arg[2] = (unsigned short) event->x; - arg[1] = arg[3] = (unsigned short) event->y; + arg[0] = arg[2] = (unsigned short) event->x + gpm_zerobased; + arg[1] = arg[3] = (unsigned short) event->y + gpm_zerobased; arg[4] = (unsigned short) 3; name = (const char *) ttyname (0); @@ -2925,7 +2910,8 @@ handle_one_term_event (struct tty_display_info *tty, Gpm_Event *event, struct in ioctl (fd, TIOCLINUX, buf + sizeof (short) - 1); close (fd); - term_mouse_movement (f, event); + if (!term_mouse_movement (f, event)) + help_echo_string = previous_help_echo_string; /* If the contents of the global variable help_echo_string has changed, generate a HELP_EVENT. */ @@ -2977,6 +2963,7 @@ DEFUN ("term-open-connection", Fterm_open_connection, Sterm_open_connection, 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 |