emacs-diffs
[Top][All Lists]
Advanced

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

master d96db7b2e8: Don't loop through useless region when searching for


From: Po Lu
Subject: master d96db7b2e8: Don't loop through useless region when searching for DND toplevel
Date: Mon, 28 Mar 2022 21:09:13 -0400 (EDT)

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

    Don't loop through useless region when searching for DND toplevel
    
    * src/xterm.c (x_dnd_compute_toplevels): Optimize for the
    bounding rect being the window dimensions.
---
 src/xterm.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/src/xterm.c b/src/xterm.c
index 443009c0db..28311f94e9 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -1278,6 +1278,30 @@ x_dnd_compute_toplevels (struct x_display_info *dpyinfo)
              xfree (tem->input_rects);
              tem->n_input_rects = -1;
            }
+
+         /* And the common case where there is no input rect and the
+            bouding rect equals the window dimensions.  */
+
+         if (tem->n_input_rects == -1
+             && tem->n_bounding_rects == 1
+#ifdef USE_XCB
+             && tem->bounding_rects[0].width == (geometry_reply->width
+                                                 + 
geometry_reply->border_width)
+             && tem->bounding_rects[0].height == (geometry_reply->height
+                                                  + 
geometry_reply->border_width)
+             && tem->bounding_rects[0].x == -geometry_reply->border_width
+             && tem->bounding_rects[0].y == -geometry_reply->border_width
+#else
+             && tem->bounding_rects[0].width == attrs.width + 
attrs.border_width
+             && tem->bounding_rects[0].height == attrs.height + 
attrs.border_width
+             && tem->bounding_rects[0].x == -attrs.border_width
+             && tem->bounding_rects[0].y == -attrs.border_width
+#endif
+             )
+           {
+             xfree (tem->bounding_rects);
+             tem->n_bounding_rects = -1;
+           }
 #endif
 
          x_catch_errors (dpyinfo->display);



reply via email to

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