]> git.eshelyaron.com Git - emacs.git/commitdiff
Minor optimization to x_query_pointer_1
authorPo Lu <luangruo@yahoo.com>
Sun, 21 Aug 2022 06:06:22 +0000 (14:06 +0800)
committerPo Lu <luangruo@yahoo.com>
Sun, 21 Aug 2022 06:06:22 +0000 (14:06 +0800)
* src/xterm.c (x_query_pointer_1): Clear client pointer if it
disappeared.

src/xterm.c

index 39e5a8e1861d923f039cf0cff9b97f1636a4a5e7..4f9b0b83b55f04c8fed88b3a2745c76fc868bc2a 100644 (file)
@@ -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;