aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2022-01-13 09:32:14 +0800
committerPo Lu2022-01-13 09:32:14 +0800
commit8ba316736f5d892182fb8d4fb75b919aa681d257 (patch)
tree48f812665181d059b55bde222a5986c39ae92a80 /src
parent9599b5923b2bc56fbf5e1fccee6a19643c75c984 (diff)
downloademacs-8ba316736f5d892182fb8d4fb75b919aa681d257.tar.gz
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.
Diffstat (limited to 'src')
-rw-r--r--src/xfns.c4
-rw-r--r--src/xterm.c15
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)
3347 XISetMask (m, XI_Motion); 3347 XISetMask (m, XI_Motion);
3348 XISetMask (m, XI_Enter); 3348 XISetMask (m, XI_Enter);
3349 XISetMask (m, XI_Leave); 3349 XISetMask (m, XI_Leave);
3350 XISetMask (m, XI_FocusIn);
3351 XISetMask (m, XI_FocusOut);
3350 XISetMask (m, XI_KeyPress); 3352 XISetMask (m, XI_KeyPress);
3351 XISetMask (m, XI_KeyRelease); 3353 XISetMask (m, XI_KeyRelease);
3352 XISelectEvents (FRAME_X_DISPLAY (f), 3354 XISelectEvents (FRAME_X_DISPLAY (f),
@@ -3359,6 +3361,8 @@ setup_xi_event_mask (struct frame *f)
3359#ifdef USE_X_TOOLKIT 3361#ifdef USE_X_TOOLKIT
3360 XISetMask (m, XI_KeyPress); 3362 XISetMask (m, XI_KeyPress);
3361 XISetMask (m, XI_KeyRelease); 3363 XISetMask (m, XI_KeyRelease);
3364 XISetMask (m, XI_FocusIn);
3365 XISetMask (m, XI_FocusOut);
3362 3366
3363 XISelectEvents (FRAME_X_DISPLAY (f), 3367 XISelectEvents (FRAME_X_DISPLAY (f),
3364 FRAME_OUTER_WINDOW (f), 3368 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,
5254 int focus_state 5254 int focus_state
5255 = focus_frame ? focus_frame->output_data.x->focus_state : 0; 5255 = focus_frame ? focus_frame->output_data.x->focus_state : 0;
5256 5256
5257#ifdef USE_GTK
5258 if (xi_event->evtype == XI_FocusIn 5257 if (xi_event->evtype == XI_FocusIn
5259 || xi_event->evtype == XI_FocusOut) 5258 || xi_event->evtype == XI_FocusOut)
5260 x_focus_changed ((xi_event->evtype == XI_FocusIn 5259 x_focus_changed ((xi_event->evtype == XI_FocusIn
5261 ? FocusIn : FocusOut), 5260 ? FocusIn : FocusOut),
5262 FOCUS_EXPLICIT, 5261 FOCUS_EXPLICIT,
5263 dpyinfo, frame, bufp); 5262 dpyinfo, frame, bufp);
5264 else 5263 else if ((xi_event->evtype == XI_Enter
5265#endif 5264 || xi_event->evtype == XI_Leave)
5266 if ((xi_event->evtype == XI_Enter 5265 && (((XIEnterEvent *) xi_event)->detail
5267 || xi_event->evtype == XI_Leave) 5266 != XINotifyInferior)
5268 && (((XIEnterEvent *) xi_event)->detail 5267 && ((XIEnterEvent *) xi_event)->focus
5269 != XINotifyInferior) 5268 && !(focus_state & FOCUS_EXPLICIT))
5270 && ((XIEnterEvent *) xi_event)->focus
5271 && !(focus_state & FOCUS_EXPLICIT))
5272 x_focus_changed ((xi_event->evtype == XI_Enter 5269 x_focus_changed ((xi_event->evtype == XI_Enter
5273 ? FocusIn : FocusOut), 5270 ? FocusIn : FocusOut),
5274 FOCUS_IMPLICIT, 5271 FOCUS_IMPLICIT,