From 0998426869aecdf26ae834feeed18c5ca235ef51 Mon Sep 17 00:00:00 2001 From: Jared Finder Date: Wed, 2 Dec 2020 00:05:59 -0800 Subject: [PATCH] Remove incorrect usage of HAVE_GPM. * src/frame.c (Fset_mouse_position, Fset_mouse_pixel_position): Call Fselect_frame and appropriate mouse_moveto function in all terminals, independent of defines. * src/term.c (init_tty): Initialize mouse_face_window for all terminals. (term_mouse_moveto): Make available even if HAVE_WINDOW_SYSTEM is defined. * src/xdisp.c (try_window_id): Call gui_clear_window_mouse_face in all cases. --- src/frame.c | 59 +++++++++++++++++++++++++++++++------------------ src/term.c | 4 +--- src/termhooks.h | 2 -- src/xdisp.c | 3 +-- 4 files changed, 39 insertions(+), 29 deletions(-) diff --git a/src/frame.c b/src/frame.c index 17ec455d2d..12e3763fe0 100644 --- a/src/frame.c +++ b/src/frame.c @@ -2572,23 +2572,30 @@ DEFUN ("set-mouse-position", Fset_mouse_position, Sset_mouse_position, 3, 3, 0, int yval = check_integer_range (y, INT_MIN, INT_MAX); /* I think this should be done with a hook. */ -#ifdef HAVE_WINDOW_SYSTEM if (FRAME_WINDOW_P (XFRAME (frame))) - /* Warping the mouse will cause enternotify and focus events. */ - frame_set_mouse_position (XFRAME (frame), xval, yval); -#elif defined MSDOS - if (FRAME_MSDOS_P (XFRAME (frame))) + { +#ifdef HAVE_WINDOW_SYSTEM + /* Warping the mouse will cause enternotify and focus events. */ + frame_set_mouse_position (XFRAME (frame), xval, yval); +#endif /* HAVE_WINDOW_SYSTEM */ + } + else if (FRAME_MSDOS_P (XFRAME (frame))) { Fselect_frame (frame, Qnil); +#ifdef MSDOS mouse_moveto (xval, yval); +#endif /* MSDOS */ } -#elif defined HAVE_GPM - Fselect_frame (frame, Qnil); - term_mouse_moveto (xval, yval); + else + { + Fselect_frame (frame, Qnil); +#ifdef HAVE_GPM + term_mouse_moveto (xval, yval); #else - (void) xval; - (void) yval; -#endif + (void) xval; + (void) yval; +#endif /* HAVE_GPM */ + } return Qnil; } @@ -2610,23 +2617,31 @@ DEFUN ("set-mouse-pixel-position", Fset_mouse_pixel_position, int yval = check_integer_range (y, INT_MIN, INT_MAX); /* I think this should be done with a hook. */ -#ifdef HAVE_WINDOW_SYSTEM if (FRAME_WINDOW_P (XFRAME (frame))) - /* Warping the mouse will cause enternotify and focus events. */ - frame_set_mouse_pixel_position (XFRAME (frame), xval, yval); -#elif defined MSDOS - if (FRAME_MSDOS_P (XFRAME (frame))) + { + /* Warping the mouse will cause enternotify and focus events. */ +#ifdef HAVE_WINDOW_SYSTEM + frame_set_mouse_pixel_position (XFRAME (frame), xval, yval); +#endif /* HAVE_WINDOW_SYSTEM */ + } + else if (FRAME_MSDOS_P (XFRAME (frame))) { Fselect_frame (frame, Qnil); +#ifdef MSDOS mouse_moveto (xval, yval); +#endif /* MSDOS */ } -#elif defined HAVE_GPM - Fselect_frame (frame, Qnil); - term_mouse_moveto (xval, yval); + else + { + Fselect_frame (frame, Qnil); +#ifdef HAVE_GPM + term_mouse_moveto (xval, yval); #else - (void) xval; - (void) yval; -#endif + (void) xval; + (void) yval; +#endif /* HAVE_GPM */ + + } return Qnil; } diff --git a/src/term.c b/src/term.c index fee3b55575..2437749d19 100644 --- a/src/term.c +++ b/src/term.c @@ -2382,7 +2382,6 @@ DEFUN ("resume-tty", Fresume_tty, Sresume_tty, 0, 1, 0, #ifdef HAVE_GPM -#ifndef HAVE_WINDOW_SYSTEM void term_mouse_moveto (int x, int y) { @@ -2396,7 +2395,6 @@ term_mouse_moveto (int x, int y) last_mouse_x = x; last_mouse_y = y; */ } -#endif /* HAVE_WINDOW_SYSTEM */ /* Implementation of draw_row_with_mouse_face for TTY/GPM. */ void @@ -4246,8 +4244,8 @@ init_tty (const char *name, const char *terminal_type, bool must_succeed) #ifdef HAVE_GPM terminal->mouse_position_hook = term_mouse_position; - tty->mouse_highlight.mouse_face_window = Qnil; #endif + tty->mouse_highlight.mouse_face_window = Qnil; terminal->kboard = allocate_kboard (Qnil); terminal->kboard->reference_count++; diff --git a/src/termhooks.h b/src/termhooks.h index 44ab14225f..7ffab7e86f 100644 --- a/src/termhooks.h +++ b/src/termhooks.h @@ -367,9 +367,7 @@ #define EVENT_INIT(event) memset (&(event), 0, sizeof (struct input_event)) #ifdef HAVE_GPM #include extern int handle_one_term_event (struct tty_display_info *, Gpm_Event *); -#ifndef HAVE_WINDOW_SYSTEM extern void term_mouse_moveto (int, int); -#endif /* The device for which we have enabled gpm support. */ extern struct tty_display_info *gpm_tty; diff --git a/src/xdisp.c b/src/xdisp.c index 76ef420a36..498e6f1065 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -20779,9 +20779,8 @@ #define GIVE_UP(X) return 0 + window_wants_header_line (w) + window_internal_height (w)); -#if defined (HAVE_GPM) || defined (MSDOS) gui_clear_window_mouse_face (w); -#endif + /* Perform the operation on the screen. */ if (dvpos > 0) { -- 2.20.1