From 72782ca182993dac6bd805bb3b54b21b7e7efa7d Mon Sep 17 00:00:00 2001 From: Po Lu Date: Sat, 9 Apr 2022 11:37:56 +0800 Subject: [PATCH] Use right frame when computing mouse movement device * 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 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/keyboard.c b/src/keyboard.c index 642ae7d7e0a..98eebaf7f53 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -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 -- 2.39.5