From: Po Lu Date: Sun, 12 Jun 2022 05:45:18 +0000 (+0800) Subject: Don't repetitively initialize type lists during DND X-Git-Tag: emacs-29.0.90~1910^2~61 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=c2695621fc52aa5eeebc45b82b9b916e30568589;p=emacs.git Don't repetitively initialize type lists during DND * src/xterm.c (x_dnd_send_enter): Only set XdndTypeList once. (x_dnd_begin_drag_and_drop): Clear type list flag. --- diff --git a/src/xterm.c b/src/xterm.c index e282856374d..842de55e2f6 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -1162,6 +1162,10 @@ static int x_dnd_waiting_for_finish_proto; where the drag-and-drop operation originated. */ static bool x_dnd_allow_current_frame; +/* Whether or not the `XdndTypeList' property has already been set on + the drag frame. */ +static bool x_dnd_init_type_lists; + /* Whether or not to return a frame from `x_dnd_begin_drag_and_drop'. 0 means to do nothing. 1 means to wait for the mouse to first exit @@ -3987,12 +3991,16 @@ x_dnd_send_enter (struct frame *f, Window target, int supported) for (i = 0; i < min (3, x_dnd_n_targets); ++i) msg.xclient.data.l[i + 2] = x_dnd_targets[i]; - if (x_dnd_n_targets > 3) + if (x_dnd_n_targets > 3 && !x_dnd_init_type_lists) XChangeProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), dpyinfo->Xatom_XdndTypeList, XA_ATOM, 32, PropModeReplace, (unsigned char *) x_dnd_targets, x_dnd_n_targets); + /* Now record that the type list has already been set (if required), + so we don't have to set it again. */ + x_dnd_init_type_lists = true; + x_catch_errors (dpyinfo->display); XSendEvent (FRAME_X_DISPLAY (f), target, False, NoEventMask, &msg); x_uncatch_errors (); @@ -11036,6 +11044,7 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, Atom xaction, x_dnd_toplevels = NULL; x_dnd_allow_current_frame = allow_current_frame; x_dnd_movement_frame = NULL; + x_dnd_init_type_lists = false; #ifdef HAVE_XKB x_dnd_keyboard_state = 0;