emacs-diffs
[Top][All Lists]
Advanced

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

master a7fdbed880: Handle XI focus change events that specify implicit f


From: Po Lu
Subject: master a7fdbed880: Handle XI focus change events that specify implicit focus correctly
Date: Tue, 8 Mar 2022 08:36:16 -0500 (EST)

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

    Handle XI focus change events that specify implicit focus correctly
    
    * src/xterm.c (x_detect_focus_change): If detail is
    XINotifyPointer, set focus type to implicit.
---
 src/xterm.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/xterm.c b/src/xterm.c
index 72c7c05d89..94b8f60c71 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -6480,7 +6480,8 @@ x_detect_focus_change (struct x_display_info *dpyinfo, 
struct frame *frame,
 #ifdef HAVE_XINPUT2
     case GenericEvent:
       {
-       XIEvent *xi_event = (XIEvent *) event->xcookie.data;
+       XIEvent *xi_event = event->xcookie.data;
+       XIEnterEvent *enter_or_focus = event->xcookie.data;
 
         struct frame *focus_frame = dpyinfo->x_focus_event_frame;
         int focus_state
@@ -6490,13 +6491,14 @@ x_detect_focus_change (struct x_display_info *dpyinfo, 
struct frame *frame,
            || xi_event->evtype == XI_FocusOut)
          x_focus_changed ((xi_event->evtype == XI_FocusIn
                            ? FocusIn : FocusOut),
-                          FOCUS_EXPLICIT,
-                          dpyinfo, frame, bufp);
+                          ((enter_or_focus->detail
+                            == XINotifyPointer)
+                           ? FOCUS_IMPLICIT : FOCUS_EXPLICIT),
+                            dpyinfo, frame, bufp);
        else if ((xi_event->evtype == XI_Enter
                  || xi_event->evtype == XI_Leave)
-                && (((XIEnterEvent *) xi_event)->detail
-                    != XINotifyInferior)
-                && ((XIEnterEvent *) xi_event)->focus
+                && (enter_or_focus->detail != XINotifyInferior)
+                && enter_or_focus->focus
                 && !(focus_state & FOCUS_EXPLICIT))
          x_focus_changed ((xi_event->evtype == XI_Enter
                            ? FocusIn : FocusOut),



reply via email to

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