From: Po Lu Date: Sun, 19 Jun 2022 07:21:46 +0000 (+0800) Subject: Ignore emulated mouse clicks during drag-and-drop X-Git-Tag: emacs-29.0.90~1447^2~1624 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=76f3878e287542ffaa40126528fc0cb2dc6a2a3d;p=emacs.git Ignore emulated mouse clicks during drag-and-drop * src/xterm.c (handle_one_xevent): Don't set dpyinfo->grab and last mouse frame for emulated mouse events during a drag-and-drop operation. --- diff --git a/src/xterm.c b/src/xterm.c index 455d5b795e9..1af0f41937d 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -20050,19 +20050,29 @@ handle_one_xevent (struct x_display_info *dpyinfo, { f = mouse_or_wdesc_frame (dpyinfo, xev->event); - if (xev->evtype == XI_ButtonPress) + /* Don't track grab status for emulated pointer + events, because they are ignored by the regular + mouse click processing code. */ +#ifdef XIPointerEmulated + if (!(xev->flags & XIPointerEmulated)) { - dpyinfo->grabbed |= (1 << xev->detail); - dpyinfo->last_mouse_frame = f; - if (f && !tab_bar_p) - f->last_tab_bar_item = -1; +#endif + if (xev->evtype == XI_ButtonPress) + { + dpyinfo->grabbed |= (1 << xev->detail); + dpyinfo->last_mouse_frame = f; + if (f && !tab_bar_p) + f->last_tab_bar_item = -1; #if ! defined (USE_GTK) - if (f && !tool_bar_p) - f->last_tool_bar_item = -1; + if (f && !tool_bar_p) + f->last_tool_bar_item = -1; #endif /* not USE_GTK */ + } + else + dpyinfo->grabbed &= ~(1 << xev->detail); +#ifdef XIPointerEmulated } - else - dpyinfo->grabbed &= ~(1 << xev->detail); +#endif if (xev->evtype == XI_ButtonPress && x_dnd_last_seen_window != None