emacs-diffs
[Top][All Lists]
Advanced

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

master 8d4789c072: Minor optimization to x_query_pointer_1


From: Po Lu
Subject: master 8d4789c072: Minor optimization to x_query_pointer_1
Date: Sun, 21 Aug 2022 02:06:36 -0400 (EDT)

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

    Minor optimization to x_query_pointer_1
    
    * src/xterm.c (x_query_pointer_1): Clear client pointer if it
    disappeared.
---
 src/xterm.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/xterm.c b/src/xterm.c
index 39e5a8e186..4f9b0b83b5 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -13442,10 +13442,20 @@ x_query_pointer_1 (struct x_display_info *dpyinfo,
       x_uncatch_errors_after_check ();
 
       if (had_errors)
-       rc = XQueryPointer (dpyinfo->display, w, root_return,
-                           child_return, root_x_return,
-                           root_y_return, win_x_return,
-                           win_y_return, mask_return);
+       {
+         /* If the specified client pointer is the display's client
+            pointer, clear it now.  A new client pointer might not be
+            found before the next call to x_query_pointer_1 and
+            waiting for the error leads to excessive syncing.  */
+
+         if (client_pointer_device == dpyinfo->client_pointer_device)
+           dpyinfo->client_pointer_device = -1;
+
+         rc = XQueryPointer (dpyinfo->display, w, root_return,
+                             child_return, root_x_return,
+                             root_y_return, win_x_return,
+                             win_y_return, mask_return);
+       }
       else
        {
          state = 0;



reply via email to

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