From 3e640399d877908760b11782dcb208721b85d629 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Fri, 5 Nov 2021 10:22:27 +0800 Subject: [PATCH] Handle crossing events on xwidget windows correctly * src/xterm.c (handle_one_xevent): Clear help and mouse face when handling xwidget entry events. * src/xwidget.c (xwidget_motion_or_crossing): Add device to crossing events. (x_draw_xwidget_glyph_string): Add EnterWindowMask and LeaveWindowMask. --- src/xterm.c | 13 +++++++++++++ src/xwidget.c | 3 ++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/xterm.c b/src/xterm.c index fa7dd9b9ca0..756a8dd1edf 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -8896,10 +8896,23 @@ handle_one_xevent (struct x_display_info *dpyinfo, #ifdef HAVE_XWIDGETS { struct xwidget_view *xvw = xwidget_view_from_window (event->xcrossing.window); + Mouse_HLInfo *hlinfo; if (xvw) { xwidget_motion_or_crossing (xvw, event); + hlinfo = MOUSE_HL_INFO (xvw->frame); + + if (xvw->frame == hlinfo->mouse_face_mouse_frame) + { + clear_mouse_face (hlinfo); + hlinfo->mouse_face_mouse_frame = 0; + } + + if (any_help_event_p) + { + do_help = -1; + } goto OTHER; } } diff --git a/src/xwidget.c b/src/xwidget.c index c7589871584..067ff11002c 100644 --- a/src/xwidget.c +++ b/src/xwidget.c @@ -459,6 +459,7 @@ xwidget_motion_or_crossing (struct xwidget_view *view, const XEvent *event) xg_event->crossing.y = event->xcrossing.y + view->clip_top; xg_event->crossing.x_root = event->xcrossing.x_root; xg_event->crossing.y_root = event->xcrossing.y_root; + gdk_event_set_device (xg_event, find_suitable_pointer (view->frame)); } gtk_main_do_event (xg_event); @@ -947,7 +948,7 @@ x_draw_xwidget_glyph_string (struct glyph_string *s) XSETXWIDGET_VIEW (xvw, xv); XSetWindowAttributes a; a.event_mask = (ExposureMask | ButtonPressMask | ButtonReleaseMask - | PointerMotionMask); + | PointerMotionMask | EnterWindowMask | LeaveWindowMask); xv->wdesc = XCreateWindow (xv->dpy, FRAME_X_WINDOW (s->f), x + clip_left, y + clip_top, -- 2.39.5