]> git.eshelyaron.com Git - emacs.git/commitdiff
Make XTmouse_position faster during dragging with lots of frames
authorPo Lu <luangruo@yahoo.com>
Sat, 4 Jun 2022 04:27:11 +0000 (12:27 +0800)
committerPo Lu <luangruo@yahoo.com>
Sat, 4 Jun 2022 04:27:11 +0000 (12:27 +0800)
* 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

index d5f45fbc94309f3842e2e429998739d77a1bd572..fe7cab7258e3f46b2ea0f2e006230998241d0bb4 100644 (file)
@@ -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);