From: Po Lu Date: Thu, 30 Dec 2021 03:18:42 +0000 (+0800) Subject: Work around xwidgets releasing the passive grab on an entry event X-Git-Tag: emacs-29.0.90~3355 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a4893515c249386bca39f1b9a90adc6fc68b48d5;p=emacs.git 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. --- 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; }