From: Po Lu Date: Sun, 12 Jun 2022 08:41:40 +0000 (+0800) Subject: Fix phantom drag-and-drop targets showing up in some programs X-Git-Tag: emacs-29.0.90~1910^2~59 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=5bf409329b1b678c633c79456288a1c4d6f0e804;p=emacs.git Fix phantom drag-and-drop targets showing up in some programs * src/xterm.c (x_dnd_cleanup_drag_and_drop) (x_dnd_begin_drag_and_drop): Delete XdndTypeList if it was set after the DND operation completes. Some programs apparently think its presence on the drag source means there are more than 3 targets. --- diff --git a/src/xterm.c b/src/xterm.c index 842de55e2f6..5ec6912fbd7 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -4240,6 +4240,12 @@ x_dnd_cleanup_drag_and_drop (void *frame) if (x_dnd_motif_setup_p) XDeleteProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), FRAME_DISPLAY_INFO (f)->Xatom_XdndSelection); + + /* Remove any type list set as well. */ + if (x_dnd_init_type_lists && x_dnd_n_targets > 3) + XDeleteProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), + FRAME_DISPLAY_INFO (f)->Xatom_XdndTypeList); + unblock_input (); x_dnd_frame = NULL; @@ -11263,6 +11269,12 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, Atom xaction, XDeleteProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), FRAME_DISPLAY_INFO (f)->Xatom_XdndSelection); + + /* Remove any type list set as well. */ + if (x_dnd_init_type_lists && x_dnd_n_targets > 3) + XDeleteProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), + FRAME_DISPLAY_INFO (f)->Xatom_XdndTypeList); + /* Call kbd_buffer_store event, which calls handle_interrupt and sets `last-event-frame' along with various other things. */ @@ -11348,6 +11360,12 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, Atom xaction, if (x_dnd_motif_setup_p) XDeleteProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), FRAME_DISPLAY_INFO (f)->Xatom_XdndSelection); + + + /* Remove any type list set as well. */ + if (x_dnd_init_type_lists && x_dnd_n_targets > 3) + XDeleteProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), + FRAME_DISPLAY_INFO (f)->Xatom_XdndTypeList); unblock_input (); quit (); @@ -11386,6 +11404,11 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, Atom xaction, if (x_dnd_motif_setup_p) XDeleteProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), FRAME_DISPLAY_INFO (f)->Xatom_XdndSelection); + + /* Remove any type list set as well. */ + if (x_dnd_init_type_lists && x_dnd_n_targets > 3) + XDeleteProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), + FRAME_DISPLAY_INFO (f)->Xatom_XdndTypeList); unblock_input (); if (x_dnd_return_frame == 3