diff options
| author | Po Lu | 2022-07-23 09:35:20 +0800 |
|---|---|---|
| committer | Po Lu | 2022-07-23 09:35:20 +0800 |
| commit | 792734a6e2cd5558debc8d9fe95d34cb3e809fa4 (patch) | |
| tree | a6427211a727a65ce2fc3f07e1259a3a9d3352eb | |
| parent | df508ffd2bedf901996d8899c63183aaf327f887 (diff) | |
| download | emacs-792734a6e2cd5558debc8d9fe95d34cb3e809fa4.tar.gz emacs-792734a6e2cd5558debc8d9fe95d34cb3e809fa4.zip | |
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.
| -rw-r--r-- | src/xterm.c | 16 |
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; | |||
| 1390 | initiating Motif drag-and-drop for the first time. */ | 1390 | initiating Motif drag-and-drop for the first time. */ |
| 1391 | static Lisp_Object x_dnd_selection_alias_cell; | 1391 | static Lisp_Object x_dnd_selection_alias_cell; |
| 1392 | 1392 | ||
| 1393 | /* The last known position of the tooltip window. */ | ||
| 1394 | static int x_dnd_last_tooltip_x, x_dnd_last_tooltip_y; | ||
| 1395 | |||
| 1396 | /* Whether or not those values are actually known yet. */ | ||
| 1397 | static bool x_dnd_last_tooltip_valid; | ||
| 1398 | |||
| 1393 | /* Structure describing a single window that can be the target of | 1399 | /* Structure describing a single window that can be the target of |
| 1394 | drag-and-drop operations. */ | 1400 | drag-and-drop operations. */ |
| 1395 | struct x_client_list_window | 1401 | struct x_client_list_window |
| @@ -11670,6 +11676,7 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, Atom xaction, | |||
| 11670 | x_dnd_run_unsupported_drop_function = false; | 11676 | x_dnd_run_unsupported_drop_function = false; |
| 11671 | x_dnd_use_toplevels | 11677 | x_dnd_use_toplevels |
| 11672 | = x_wm_supports (f, FRAME_DISPLAY_INFO (f)->Xatom_net_client_list_stacking); | 11678 | = x_wm_supports (f, FRAME_DISPLAY_INFO (f)->Xatom_net_client_list_stacking); |
| 11679 | x_dnd_last_tooltip_valid = false; | ||
| 11673 | x_dnd_toplevels = NULL; | 11680 | x_dnd_toplevels = NULL; |
| 11674 | x_dnd_allow_current_frame = allow_current_frame; | 11681 | x_dnd_allow_current_frame = allow_current_frame; |
| 11675 | x_dnd_movement_frame = NULL; | 11682 | x_dnd_movement_frame = NULL; |
| @@ -15928,6 +15935,15 @@ x_dnd_update_tooltip_position (int root_x, int root_y) | |||
| 15928 | x_dnd_compute_tip_xy (&root_x, &root_y, | 15935 | x_dnd_compute_tip_xy (&root_x, &root_y, |
| 15929 | x_dnd_monitors); | 15936 | x_dnd_monitors); |
| 15930 | 15937 | ||
| 15938 | if (x_dnd_last_tooltip_valid | ||
| 15939 | && root_x == x_dnd_last_tooltip_x | ||
| 15940 | && root_y == x_dnd_last_tooltip_y) | ||
| 15941 | return; | ||
| 15942 | |||
| 15943 | x_dnd_last_tooltip_x = root_x; | ||
| 15944 | x_dnd_last_tooltip_y = root_y; | ||
| 15945 | x_dnd_last_tooltip_valid = true; | ||
| 15946 | |||
| 15931 | XMoveWindow (FRAME_X_DISPLAY (x_dnd_frame), | 15947 | XMoveWindow (FRAME_X_DISPLAY (x_dnd_frame), |
| 15932 | tip_window, root_x, root_y); | 15948 | tip_window, root_x, root_y); |
| 15933 | } | 15949 | } |