summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2022-07-23 09:35:20 +0800
committerPo Lu <luangruo@yahoo.com>2022-07-23 09:35:20 +0800
commit792734a6e2cd5558debc8d9fe95d34cb3e809fa4 (patch)
treea6427211a727a65ce2fc3f07e1259a3a9d3352eb /src
parentdf508ffd2bedf901996d8899c63183aaf327f887 (diff)
Improve efficiency of DND tooltip movement
* src/xterm.c (x_dnd_begin_drag_and_drop): Clear new flag. (x_dnd_update_tooltip_position): Save last tooltip X and Y somewhere, so we don't move it upon client lists being updated.
Diffstat (limited to 'src')
-rw-r--r--src/xterm.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/xterm.c b/src/xterm.c
index 8b12d92f187..45a81a3fdb4 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -1390,6 +1390,12 @@ static int x_dnd_recursion_depth;
initiating Motif drag-and-drop for the first time. */
static Lisp_Object x_dnd_selection_alias_cell;
+/* The last known position of the tooltip window. */
+static int x_dnd_last_tooltip_x, x_dnd_last_tooltip_y;
+
+/* Whether or not those values are actually known yet. */
+static bool x_dnd_last_tooltip_valid;
+
/* Structure describing a single window that can be the target of
drag-and-drop operations. */
struct x_client_list_window
@@ -11670,6 +11676,7 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, Atom xaction,
x_dnd_run_unsupported_drop_function = false;
x_dnd_use_toplevels
= x_wm_supports (f, FRAME_DISPLAY_INFO (f)->Xatom_net_client_list_stacking);
+ x_dnd_last_tooltip_valid = false;
x_dnd_toplevels = NULL;
x_dnd_allow_current_frame = allow_current_frame;
x_dnd_movement_frame = NULL;
@@ -15928,6 +15935,15 @@ x_dnd_update_tooltip_position (int root_x, int root_y)
x_dnd_compute_tip_xy (&root_x, &root_y,
x_dnd_monitors);
+ if (x_dnd_last_tooltip_valid
+ && root_x == x_dnd_last_tooltip_x
+ && root_y == x_dnd_last_tooltip_y)
+ return;
+
+ x_dnd_last_tooltip_x = root_x;
+ x_dnd_last_tooltip_y = root_y;
+ x_dnd_last_tooltip_valid = true;
+
XMoveWindow (FRAME_X_DISPLAY (x_dnd_frame),
tip_window, root_x, root_y);
}