From: Po Lu Date: Mon, 13 Dec 2021 01:17:55 +0000 (+0800) Subject: Stop using XI focus events on non-GTK builds X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1^2~5^2~16^2~4034^2~3 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=5181276b4362b25cd91818bc0b4e6fbd985b5882;p=emacs.git Stop using XI focus events on non-GTK builds * src/xfns.c (setup_xi_event_mask): Stop setting XI_FocusIn and XI_FocusOut. * src/xterm.c (x_detect_focus_change) : Don't handle XI_FocusIn and XI_FocusOut events when not on GTK. --- diff --git a/src/xfns.c b/src/xfns.c index 5eff9f5b0f8..b5694829aef 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -2936,8 +2936,10 @@ setup_xi_event_mask (struct frame *f) XISetMask (m, XI_Motion); XISetMask (m, XI_Enter); XISetMask (m, XI_Leave); +#if 0 XISetMask (m, XI_FocusIn); XISetMask (m, XI_FocusOut); +#endif XISelectEvents (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), &mask, 1); diff --git a/src/xterm.c b/src/xterm.c index 9d60292756d..1f377f838b3 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -5144,19 +5144,23 @@ 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) - && (((XIEnterEvent *) xi_event)->detail - != XINotifyInferior) - && !(focus_state & FOCUS_EXPLICIT)) - || xi_event->evtype == XI_FocusIn - || xi_event->evtype == XI_FocusOut))) +#ifdef USE_GTK + if (xi_event->evtype == XI_FocusIn + || xi_event->evtype == XI_FocusOut) + x_focus_changed ((xi_event->evtype == XI_FocusIn + ? FocusIn : FocusOut), + FOCUS_EXPLICIT, + dpyinfo, frame, bufp); + else +#endif + if ((xi_event->evtype == XI_Enter + || xi_event->evtype == XI_Leave) + && (((XIEnterEvent *) xi_event)->detail + != XINotifyInferior) + && !(focus_state & FOCUS_EXPLICIT)) x_focus_changed ((xi_event->evtype == XI_Enter - || xi_event->evtype == XI_FocusIn ? FocusIn : FocusOut), - (xi_event->evtype == XI_Enter - || xi_event->evtype == XI_Leave - ? FOCUS_IMPLICIT : FOCUS_EXPLICIT), + FOCUS_IMPLICIT, dpyinfo, frame, bufp); break; }