]> git.eshelyaron.com Git - emacs.git/commitdiff
Make mouse-related calls be more consistent on all frame types
authorJared Finder <jared@finder.org>
Wed, 2 Dec 2020 08:05:59 +0000 (00:05 -0800)
committerEli Zaretskii <eliz@gnu.org>
Sat, 16 Jan 2021 13:02:10 +0000 (15:02 +0200)
* src/frame.c (Fset_mouse_position, Fset_mouse_pixel_position): Call
Fselect_frame and appropriate mouse_moveto function on all non-GUI
frame types, independent of #ifdef's.
* src/term.c (init_tty): Initialize mouse_face_window for all
non-GUI frame types.
(term_mouse_moveto) [HAVE_GPM]: 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
src/term.c
src/termhooks.h
src/xdisp.c

index 45ee96e9620a70102884ff8567de3459f03fc638..4d3d05ebbd37876342969e18f36cbff17601f2a7 100644 (file)
@@ -2572,23 +2572,30 @@ before calling this function on it, like this.
   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 @@ before calling this function on it, like this.
   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;
 }
index a87f9c745ce35a0a7f1312fdfdb2416d63e14e62..2e2ab2bf4387cd136cfd4a280a3de763c4670c66 100644 (file)
@@ -2382,7 +2382,6 @@ frame's terminal). */)
 
 #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 @@ use the Bourne shell command 'TERM=...; export TERM' (C-shell:\n\
 
 #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++;
index 85a47c071b65ac71847eb7c3ce169c8a6a606303..3800679e803809efbf4a71e70ed70a7d37c344e0 100644 (file)
@@ -366,9 +366,7 @@ enum {
 #ifdef HAVE_GPM
 #include <gpm.h>
 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;
index ea67329cff1ce4d2813b089c072b2ce5b3fd4ce8..32e9773b54ed799ce8b216c38d205a551a614ee9 100644 (file)
@@ -20822,9 +20822,8 @@ try_window_id (struct window *w)
                     + 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)
            {