emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 8ba316736f: Use XI2 focus events on X toolkit builds


From: Po Lu
Subject: master 8ba316736f: Use XI2 focus events on X toolkit builds
Date: Wed, 12 Jan 2022 20:33:05 -0500 (EST)

branch: master
commit 8ba316736f5d892182fb8d4fb75b919aa681d257
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    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.
---
 src/xfns.c  |  4 ++++
 src/xterm.c | 15 ++++++---------
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/src/xfns.c b/src/xfns.c
index 028ee29a4a..ffad0bc3d1 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 4925ecb6d3..058c1dccc2 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,



reply via email to

[Prev in Thread] Current Thread [Next in Thread]