emacs-diffs
[Top][All Lists]
Advanced

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

master e154ba196a: Fix child frame focus for MPX environments


From: Po Lu
Subject: master e154ba196a: Fix child frame focus for MPX environments
Date: Sun, 21 Aug 2022 21:51:06 -0400 (EDT)

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

    Fix child frame focus for MPX environments
    
    * src/xterm.c (handle_one_xevent): Set child frame click-to
    focus on the pointer device's attachment.
---
 src/xterm.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/src/xterm.c b/src/xterm.c
index 200ef1d11f..103573d1fd 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -20270,7 +20270,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
              {
                block_input ();
                XSetInputFocus (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
-                               RevertToParent, CurrentTime);
+                               RevertToParent, event->xbutton.time);
                if (FRAME_PARENT_FRAME (f))
                  XRaiseWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f));
                unblock_input ();
@@ -21852,8 +21852,26 @@ handle_one_xevent (struct x_display_info *dpyinfo,
                  if (FRAME_PARENT_FRAME (f) || (hf && frame_ancestor_p (f, 
hf)))
                    {
                      block_input ();
+#if defined HAVE_GTK3 || (!defined USE_GTK && !defined USE_X_TOOLKIT)
+                     if (device)
+                       {
+                         /* This can generate XI_BadDevice if the
+                            device's attachment was destroyed
+                            server-side.  */
+                         x_ignore_errors_for_next_request (dpyinfo);
+                         XISetFocus (dpyinfo->display, device->attachment,
+                                     /* Note that the input extension
+                                        only supports RevertToParent-type
+                                        behavior.  */
+                                     FRAME_OUTER_WINDOW (f), xev->time);
+                         x_stop_ignoring_errors (dpyinfo);
+                       }
+#else
+                     /* Non-no toolkit builds without GTK 3 use core
+                        events to handle focus.  */
                      XSetInputFocus (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW 
(f),
-                                     RevertToParent, CurrentTime);
+                                     RevertToParent, xev->time);
+#endif
                      if (FRAME_PARENT_FRAME (f))
                        XRaiseWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW 
(f));
                      unblock_input ();



reply via email to

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