]> git.eshelyaron.com Git - emacs.git/commitdiff
Use right frame when computing mouse movement device
authorPo Lu <luangruo@yahoo.com>
Sat, 9 Apr 2022 03:37:56 +0000 (11:37 +0800)
committerPo Lu <luangruo@yahoo.com>
Sat, 9 Apr 2022 03:37:56 +0000 (11:37 +0800)
* src/keyboard.c (kbd_buffer_get_event): Use the frame on which
the mouse actually moved to compute the last mouse device.

src/keyboard.c

index 642ae7d7e0ad95672cd051d7c0a5745ebf93ecb8..98eebaf7f5385180e5f6beaaba12457bebaa7fc9 100644 (file)
@@ -4275,12 +4275,13 @@ kbd_buffer_get_event (KBOARD **kbp,
   /* Try generating a mouse motion event.  */
   else if (some_mouse_moved ())
     {
-      struct frame *f = some_mouse_moved ();
+      struct frame *f, *movement_frame = some_mouse_moved ();
       Lisp_Object bar_window;
       enum scroll_bar_part part;
       Lisp_Object x, y;
       Time t;
 
+      f = movement_frame;
       *kbp = current_kboard;
       /* Note that this uses F to determine which terminal to look at.
         If there is no valid info, it does not store anything
@@ -4317,8 +4318,8 @@ kbd_buffer_get_event (KBOARD **kbp,
        obj = make_lispy_movement (f, bar_window, part, x, y, t);
 
       if (!NILP (obj))
-       Vlast_event_device = (f && STRINGP (f->last_mouse_device)
-                             ? f->last_mouse_device
+       Vlast_event_device = (STRINGP (movement_frame->last_mouse_device)
+                             ? movement_frame->last_mouse_device
                              : virtual_core_pointer_name);
     }
   else