From: Po Lu Date: Thu, 13 Jan 2022 01:32:14 +0000 (+0800) Subject: Use XI2 focus events on X toolkit builds X-Git-Tag: emacs-29.0.90~3105 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=8ba316736f5d892182fb8d4fb75b919aa681d257;p=emacs.git 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. --- diff --git a/src/xfns.c b/src/xfns.c index 028ee29a4aa..ffad0bc3d1a 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -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), diff --git a/src/xterm.c b/src/xterm.c index 4925ecb6d3f..058c1dccc22 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -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,