From eff1bb78bd3bfa60cbf4982e90217d00887ea0c8 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Sun, 12 Dec 2021 14:00:09 +0800 Subject: [PATCH] Fix frame focus on X Toolkit builds with XInput 2 * src/xterm.c (x_detect_focus_change): Allow focus_state to not be FOCUS_EXPLICIT when handling FocusIn and FocusOut events. --- src/xterm.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/xterm.c b/src/xterm.c index f2129458e16..676de57455c 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -5144,9 +5144,13 @@ x_detect_focus_change (struct x_display_info *dpyinfo, struct frame *frame, int focus_state = focus_frame ? focus_frame->output_data.x->focus_state : 0; - if (!((xi_event->evtype == XI_Enter - || xi_event->evtype == XI_Leave) - && (focus_state & FOCUS_EXPLICIT))) + if (!((((xi_event->evtype == XI_Enter + || xi_event->evtype == XI_Leave) + && (((XIEnterEvent *) xi_event)->detail + != XINotifyInferior) + && (focus_state & FOCUS_EXPLICIT)) + || xi_event->evtype == XI_FocusIn + || xi_event->evtype == XI_FocusOut))) x_focus_changed ((xi_event->evtype == XI_Enter || xi_event->evtype == XI_FocusIn ? FocusIn : FocusOut), -- 2.39.5