aboutsummaryrefslogtreecommitdiffstats
path: root/src/term.c
diff options
context:
space:
mode:
authorMiles Bader2007-06-11 01:00:07 +0000
committerMiles Bader2007-06-11 01:00:07 +0000
commit67f3ad67ee317226cb5d1bb139de0cfd883fdc5e (patch)
tree58a0e1bea7a1d8728fd32e6127a44434e7eac006 /src/term.c
parentd17cf4eb2024cf54e4a216312184665094ee3df4 (diff)
parent2d715b39ea1c89066f469405d065dd1a6631d28e (diff)
downloademacs-67f3ad67ee317226cb5d1bb139de0cfd883fdc5e.tar.gz
emacs-67f3ad67ee317226cb5d1bb139de0cfd883fdc5e.zip
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: emacs@sv.gnu.org/emacs--multi-tty--0--patch-21
Diffstat (limited to 'src/term.c')
-rw-r--r--src/term.c47
1 files changed, 17 insertions, 30 deletions
diff --git a/src/term.c b/src/term.c
index 3a7490a2a30..ceeac103e85 100644
--- a/src/term.c
+++ b/src/term.c
@@ -208,11 +208,6 @@ static int mouse_face_past_end;
208static Lisp_Object Qmouse_face_window; 208static Lisp_Object Qmouse_face_window;
209static int mouse_face_face_id; 209static int mouse_face_face_id;
210 210
211/* FRAME and X, Y position of mouse when last checked for
212 highlighting. X and Y can be negative or out of range for the frame. */
213struct frame *mouse_face_mouse_frame;
214int mouse_face_mouse_x, mouse_face_mouse_y;
215
216static int pos_x, pos_y; 211static int pos_x, pos_y;
217static int last_mouse_x, last_mouse_y; 212static int last_mouse_x, last_mouse_y;
218#endif /* HAVE_GPM */ 213#endif /* HAVE_GPM */
@@ -2344,17 +2339,18 @@ the currently selected frame. */)
2344 ***********************************************************************/ 2339 ***********************************************************************/
2345 2340
2346#ifdef HAVE_GPM 2341#ifdef HAVE_GPM
2347void term_mouse_moveto (int x, int y) 2342void
2343term_mouse_moveto (int x, int y)
2348{ 2344{
2349 const char *name; 2345 const char *name;
2350 int fd; 2346 int fd;
2347 /* TODO: how to set mouse position?
2351 name = (const char *) ttyname (0); 2348 name = (const char *) ttyname (0);
2352 fd = open (name, O_WRONLY); 2349 fd = open (name, O_WRONLY);
2353 /* TODO: how to set mouse position? 2350 SOME_FUNCTION (x, y, fd);
2354 SOME_FUNCTION (x, y, fd); */
2355 close (fd); 2351 close (fd);
2356 last_mouse_x = x; 2352 last_mouse_x = x;
2357 last_mouse_y = y; 2353 last_mouse_y = y; */
2358} 2354}
2359 2355
2360static void 2356static void
@@ -2534,10 +2530,6 @@ term_mouse_highlight (struct frame *f, int x, int y)
2534 || !f->glyphs_initialized_p) 2530 || !f->glyphs_initialized_p)
2535 return; 2531 return;
2536 2532
2537 mouse_face_mouse_x = x;
2538 mouse_face_mouse_y = y;
2539 mouse_face_mouse_frame = f;
2540
2541 /* Which window is that in? */ 2533 /* Which window is that in? */
2542 window = window_from_coordinates (f, x, y, &part, &x, &y, 0); 2534 window = window_from_coordinates (f, x, y, &part, &x, &y, 0);
2543 2535
@@ -2779,7 +2771,7 @@ term_mouse_movement (FRAME_PTR frame, Gpm_Event *event)
2779 if (event->x != last_mouse_x || event->y != last_mouse_y) 2771 if (event->x != last_mouse_x || event->y != last_mouse_y)
2780 { 2772 {
2781 frame->mouse_moved = 1; 2773 frame->mouse_moved = 1;
2782 term_mouse_highlight (frame, event->x - 1, event->y - 1); 2774 term_mouse_highlight (frame, event->x, event->y);
2783 /* Remember which glyph we're now on. */ 2775 /* Remember which glyph we're now on. */
2784 last_mouse_x = event->x; 2776 last_mouse_x = event->x;
2785 last_mouse_y = event->y; 2777 last_mouse_y = event->y;
@@ -2799,7 +2791,7 @@ term_mouse_movement (FRAME_PTR frame, Gpm_Event *event)
2799 2791
2800 Set *time to the time the mouse was at the returned position. 2792 Set *time to the time the mouse was at the returned position.
2801 2793
2802 This should clear mouse_moved until the next motion 2794 This clears mouse_moved until the next motion
2803 event arrives. */ 2795 event arrives. */
2804static void 2796static void
2805term_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, 2797term_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,
2807 Lisp_Object *y, unsigned long *time) 2799 Lisp_Object *y, unsigned long *time)
2808{ 2800{
2809 struct timeval now; 2801 struct timeval now;
2810 Lisp_Object frame, window;
2811 struct window *w;
2812 2802
2813 *fp = SELECTED_FRAME (); 2803 *fp = SELECTED_FRAME ();
2814 (*fp)->mouse_moved = 0; 2804 (*fp)->mouse_moved = 0;
@@ -2816,13 +2806,8 @@ term_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window,
2816 *bar_window = Qnil; 2806 *bar_window = Qnil;
2817 *part = 0; 2807 *part = 0;
2818 2808
2819 XSETINT (*x, last_mouse_x); 2809 XSETINT (*x, last_mouse_x);
2820 XSETINT (*y, last_mouse_y); 2810 XSETINT (*y, last_mouse_y);
2821 XSETFRAME (frame, *fp);
2822 window = Fwindow_at (*x, *y, frame);
2823
2824 XSETINT (*x, last_mouse_x - WINDOW_LEFT_EDGE_COL (XWINDOW (window)));
2825 XSETINT (*y, last_mouse_y - WINDOW_TOP_EDGE_LINE (XWINDOW (window)));
2826 gettimeofday(&now, 0); 2811 gettimeofday(&now, 0);
2827 *time = (now.tv_sec * 1000) + (now.tv_usec / 1000); 2812 *time = (now.tv_sec * 1000) + (now.tv_usec / 1000);
2828} 2813}
@@ -2869,7 +2854,7 @@ term_mouse_click (struct input_event *result, Gpm_Event *event,
2869 if (event->type & GPM_DRAG) 2854 if (event->type & GPM_DRAG)
2870 result->modifiers |= drag_modifier; 2855 result->modifiers |= drag_modifier;
2871 2856
2872 if (!(event->type & (GPM_MOVE|GPM_DRAG))) { 2857 if (!(event->type & (GPM_MOVE | GPM_DRAG))) {
2873 2858
2874 /* 1 << KG_SHIFT */ 2859 /* 1 << KG_SHIFT */
2875 if (event->modifiers & (1 << 0)) 2860 if (event->modifiers & (1 << 0))
@@ -2885,8 +2870,8 @@ term_mouse_click (struct input_event *result, Gpm_Event *event,
2885 result->modifiers |= meta_modifier; 2870 result->modifiers |= meta_modifier;
2886 } 2871 }
2887 2872
2888 XSETINT (result->x, event->x - 1); 2873 XSETINT (result->x, event->x);
2889 XSETINT (result->y, event->y - 1); 2874 XSETINT (result->y, event->y);
2890 XSETFRAME (result->frame_or_window, f); 2875 XSETFRAME (result->frame_or_window, f);
2891 result->arg = Qnil; 2876 result->arg = Qnil;
2892 return Qnil; 2877 return Qnil;
@@ -2905,7 +2890,7 @@ handle_one_term_event (struct tty_display_info *tty, Gpm_Event *event, struct in
2905 ie.kind = NO_EVENT; 2890 ie.kind = NO_EVENT;
2906 ie.arg = Qnil; 2891 ie.arg = Qnil;
2907 2892
2908 if (event->type & GPM_MOVE) { 2893 if (event->type & (GPM_MOVE | GPM_DRAG)) {
2909 unsigned char buf[6 * sizeof (short)]; 2894 unsigned char buf[6 * sizeof (short)];
2910 unsigned short *arg = (unsigned short *) buf + 1; 2895 unsigned short *arg = (unsigned short *) buf + 1;
2911 const char *name; 2896 const char *name;
@@ -2916,8 +2901,8 @@ handle_one_term_event (struct tty_display_info *tty, Gpm_Event *event, struct in
2916 /* Display mouse pointer */ 2901 /* Display mouse pointer */
2917 buf[sizeof(short) - 1] = 2; /* set selection */ 2902 buf[sizeof(short) - 1] = 2; /* set selection */
2918 2903
2919 arg[0] = arg[2] = (unsigned short) event->x; 2904 arg[0] = arg[2] = (unsigned short) event->x + gpm_zerobased;
2920 arg[1] = arg[3] = (unsigned short) event->y; 2905 arg[1] = arg[3] = (unsigned short) event->y + gpm_zerobased;
2921 arg[4] = (unsigned short) 3; 2906 arg[4] = (unsigned short) 3;
2922 2907
2923 name = (const char *) ttyname (0); 2908 name = (const char *) ttyname (0);
@@ -2925,7 +2910,8 @@ handle_one_term_event (struct tty_display_info *tty, Gpm_Event *event, struct in
2925 ioctl (fd, TIOCLINUX, buf + sizeof (short) - 1); 2910 ioctl (fd, TIOCLINUX, buf + sizeof (short) - 1);
2926 close (fd); 2911 close (fd);
2927 2912
2928 term_mouse_movement (f, event); 2913 if (!term_mouse_movement (f, event))
2914 help_echo_string = previous_help_echo_string;
2929 2915
2930 /* If the contents of the global variable help_echo_string 2916 /* If the contents of the global variable help_echo_string
2931 has changed, generate a HELP_EVENT. */ 2917 has changed, generate a HELP_EVENT. */
@@ -2977,6 +2963,7 @@ DEFUN ("term-open-connection", Fterm_open_connection, Sterm_open_connection,
2977 connection.defaultMask = ~GPM_HARD; 2963 connection.defaultMask = ~GPM_HARD;
2978 connection.maxMod = ~0; 2964 connection.maxMod = ~0;
2979 connection.minMod = 0; 2965 connection.minMod = 0;
2966 gpm_zerobased = 1;
2980 2967
2981 /* We only support GPM on the controlling tty. */ 2968 /* We only support GPM on the controlling tty. */
2982 if (term_gpm || tty->terminal->id > 1 2969 if (term_gpm || tty->terminal->id > 1