From a4893515c249386bca39f1b9a90adc6fc68b48d5 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Thu, 30 Dec 2021 11:18:42 +0800 Subject: [PATCH] Work around xwidgets releasing the passive grab on an entry event * src/xterm.c (handle_one_xevent): Don't send XI_Enter events to xwidgets if button 1 is pressed. --- src/xterm.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/xterm.c b/src/xterm.c index 61dff7aaab6..afac07e7ff2 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -10011,8 +10011,14 @@ handle_one_xevent (struct x_display_info *dpyinfo, #ifdef HAVE_XWIDGETS if (xwidget_view) { - *finish = X_EVENT_DROP; - xwidget_motion_or_crossing (xwidget_view, event); + /* Don't send an enter event to the xwidget if the + first button is pressed, to avoid it releasing + the passive grab. I don't know why that happens, + but this workaround makes dragging to select text + work again. */ + if (!(enter->buttons.mask_len + && XIMaskIsSet (enter->buttons.mask, 1))) + xwidget_motion_or_crossing (xwidget_view, event); goto XI_OTHER; } -- 2.39.2