]> git.eshelyaron.com Git - emacs.git/commitdiff
Use XI2 focus events on X toolkit builds
authorPo Lu <luangruo@yahoo.com>
Thu, 13 Jan 2022 01:32:14 +0000 (09:32 +0800)
committerPo Lu <luangruo@yahoo.com>
Thu, 13 Jan 2022 01:32:14 +0000 (09:32 +0800)
* 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.

src/xfns.c
src/xterm.c

index 028ee29a4aa878b534af196668089c641d9fb28a..ffad0bc3d1a4931718f7d7172badd04b49373864 100644 (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),
index 4925ecb6d3f8d88b6fc40aff67bf03ff7dd9493f..058c1dccc22bc8aee3dc44408bee703e3f15a8ad 100644 (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,