From 5e07d1d0fc93bfd59983d5a832d08e771e5b6212 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Wed, 10 Aug 2022 10:33:43 +0800 Subject: [PATCH] Improve MPX interaction with xwidgets and drag-and-drop * src/xterm.c (handle_one_xevent): Handle focus interaction in more places. --- src/xterm.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/xterm.c b/src/xterm.c index ab43a8ec517..41537ade155 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -21333,6 +21333,10 @@ handle_one_xevent (struct x_display_info *dpyinfo, } #endif + if (f && device) + xi_handle_interaction (dpyinfo, f, device, + xev->time); + if (xev->evtype == XI_ButtonPress && x_dnd_last_seen_window != None) { @@ -21579,11 +21583,19 @@ handle_one_xevent (struct x_display_info *dpyinfo, xev->send_event); source = xi_device_from_id (dpyinfo, xev->sourceid); + device = xi_device_from_id (dpyinfo, xev->deviceid); #ifdef HAVE_XWIDGETS xvw = xwidget_view_from_window (xev->event); if (xvw) { + /* If the user interacts with a frame that's focused + on another device, but not the current focus + frame, make it the focus frame. */ + if (device) + xi_handle_interaction (dpyinfo, xvw->frame, + device, xev->time); + xwidget_button (xvw, xev->evtype == XI_ButtonPress, lrint (xev->event_x), lrint (xev->event_y), xev->detail, xi_convert_event_state (xev), @@ -21603,8 +21615,6 @@ handle_one_xevent (struct x_display_info *dpyinfo, } #endif - device = xi_device_from_id (dpyinfo, xev->deviceid); - if (!device) goto XI_OTHER; -- 2.39.5