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) <GenericEvent>: Don't
handle XI_FocusIn and XI_FocusOut events when not on GTK.
This commit is contained in:
Po Lu 2021-12-13 09:17:55 +08:00
parent a07d954fe2
commit 5181276b43
2 changed files with 18 additions and 12 deletions

View file

@ -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);

View file

@ -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)))
x_focus_changed ((xi_event->evtype == XI_Enter
|| xi_event->evtype == XI_FocusIn
#ifdef USE_GTK
if (xi_event->evtype == XI_FocusIn
|| xi_event->evtype == XI_FocusOut)
x_focus_changed ((xi_event->evtype == XI_FocusIn
? FocusIn : FocusOut),
(xi_event->evtype == XI_Enter
|| xi_event->evtype == XI_Leave
? FOCUS_IMPLICIT : FOCUS_EXPLICIT),
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
? FocusIn : FocusOut),
FOCUS_IMPLICIT,
dpyinfo, frame, bufp);
break;
}