diff options
author | Po Lu <luangruo@yahoo.com> | 2022-01-13 09:32:14 +0800 |
---|---|---|
committer | Po Lu <luangruo@yahoo.com> | 2022-01-13 09:32:14 +0800 |
commit | 8ba316736f5d892182fb8d4fb75b919aa681d257 (patch) | |
tree | 48f812665181d059b55bde222a5986c39ae92a80 | |
parent | 9599b5923b2bc56fbf5e1fccee6a19643c75c984 (diff) | |
download | emacs-8ba316736f5d892182fb8d4fb75b919aa681d257.tar.gz emacs-8ba316736f5d892182fb8d4fb75b919aa681d257.tar.bz2 emacs-8ba316736f5d892182fb8d4fb75b919aa681d257.zip |
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.
-rw-r--r-- | src/xfns.c | 4 | ||||
-rw-r--r-- | src/xterm.c | 15 |
2 files changed, 10 insertions, 9 deletions
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, |