emacs-diffs
[Top][All Lists]
Advanced

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

master c259ae909f: Make XTmouse_position faster during dragging with lot


From: Po Lu
Subject: master c259ae909f: Make XTmouse_position faster during dragging with lots of frames
Date: Sat, 4 Jun 2022 00:27:24 -0400 (EDT)

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

    Make XTmouse_position faster during dragging with lots of frames
    
    * src/xterm.c (x_tooltip_window_to_frame): New function.
    (XTmouse_position): Use that to find tooltip frames underneath
    the pointer instead.
---
 src/xterm.c | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/src/xterm.c b/src/xterm.c
index d5f45fbc94..fe7cab7258 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -10275,6 +10275,27 @@ x_window_to_frame (struct x_display_info *dpyinfo, int 
wdesc)
   return 0;
 }
 
+/* Like x_any_window_to_frame but only try to find tooltip frames.  */
+static struct frame *
+x_tooltip_window_to_frame (struct x_display_info *dpyinfo,
+                          Window wdesc)
+{
+  Lisp_Object tail, frame;
+  struct frame *f;
+
+  FOR_EACH_FRAME (tail, frame)
+    {
+      f = XFRAME (frame);
+
+      if (FRAME_X_P (f) && FRAME_TOOLTIP_P (f)
+         && FRAME_DISPLAY_INFO (f) == dpyinfo
+         && FRAME_X_WINDOW (f) == wdesc)
+       return f;
+    }
+
+  return NULL;
+}
+
 #if defined (USE_X_TOOLKIT) || defined (USE_GTK)
 
 /* Like x_window_to_frame but also compares the window with the widget's
@@ -11855,9 +11876,9 @@ XTmouse_position (struct frame **fp, int insist, 
Lisp_Object *bar_window,
                    && (EQ (track_mouse, Qdrag_source)
                        || EQ (track_mouse, Qdropping)))
                  {
-                   maybe_tooltip = x_any_window_to_frame (dpyinfo, child);
+                   maybe_tooltip = x_tooltip_window_to_frame (dpyinfo, child);
 
-                   if (maybe_tooltip && FRAME_TOOLTIP_P (maybe_tooltip))
+                   if (maybe_tooltip)
                      child = x_get_window_below (dpyinfo->display, child,
                                                  parent_x, parent_y, &win_x,
                                                  &win_y);



reply via email to

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