Use XI2 focus events on X toolkit builds

* src/xfns.c (setup_xi_event_mask): Set focus masks on both the
shell window and the frame window.
* src/xterm.c (x_detect_focus_change): Enable XI2 focus code on
Xt.
This commit is contained in:
Po Lu 2022-01-13 09:32:14 +08:00
parent 9599b5923b
commit 8ba316736f
2 changed files with 10 additions and 9 deletions

View file

@ -3347,6 +3347,8 @@ setup_xi_event_mask (struct frame *f)
XISetMask (m, XI_Motion);
XISetMask (m, XI_Enter);
XISetMask (m, XI_Leave);
XISetMask (m, XI_FocusIn);
XISetMask (m, XI_FocusOut);
XISetMask (m, XI_KeyPress);
XISetMask (m, XI_KeyRelease);
XISelectEvents (FRAME_X_DISPLAY (f),
@ -3359,6 +3361,8 @@ setup_xi_event_mask (struct frame *f)
#ifdef USE_X_TOOLKIT
XISetMask (m, XI_KeyPress);
XISetMask (m, XI_KeyRelease);
XISetMask (m, XI_FocusIn);
XISetMask (m, XI_FocusOut);
XISelectEvents (FRAME_X_DISPLAY (f),
FRAME_OUTER_WINDOW (f),

View file

@ -5254,21 +5254,18 @@ 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;
#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)
&& ((XIEnterEvent *) xi_event)->focus
&& !(focus_state & FOCUS_EXPLICIT))
else if ((xi_event->evtype == XI_Enter
|| xi_event->evtype == XI_Leave)
&& (((XIEnterEvent *) xi_event)->detail
!= XINotifyInferior)
&& ((XIEnterEvent *) xi_event)->focus
&& !(focus_state & FOCUS_EXPLICIT))
x_focus_changed ((xi_event->evtype == XI_Enter
? FocusIn : FocusOut),
FOCUS_IMPLICIT,