From: Po Lu Date: Thu, 24 Mar 2022 08:36:47 +0000 (+0800) Subject: Fix some bugs with drag and drop and Mozilla X-Git-Tag: emacs-29.0.90~1931^2~946 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=cae187e430dc01a46ff719257368c7166eaa8ad1;p=emacs.git Fix some bugs with drag and drop and Mozilla * src/xfns.c (Fx_begin_drag): Call maybe_quit when iterating through potentially long lists. Also allow specifying XdndActionAsk manually again, since it's useful for debugging. * src/xterm.c (x_dnd_begin_drag_and_drop): Delete XdndActionList and XdndActionDescription if they were not specified. --- diff --git a/src/xfns.c b/src/xfns.c index c4b924e007f..52649b38dd1 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -6643,10 +6643,14 @@ instead. */) for (; CONSP (targets); targets = XCDR (targets)) { CHECK_STRING (XCAR (targets)); + maybe_quit (); if (ntargets < 2048) { - target_names[ntargets] = SSDATA (XCAR (targets)); + scratch = SSDATA (XCAR (targets)); + len = strlen (scratch); + target_names[ntargets] = SAFE_ALLOCA (len + 1); + strncpy (target_names[ntargets], scratch, len + 1);; ntargets++; } else @@ -6663,6 +6667,8 @@ instead. */) xaction = FRAME_DISPLAY_INFO (f)->Xatom_XdndActionLink; else if (EQ (action, QXdndActionPrivate)) xaction = FRAME_DISPLAY_INFO (f)->Xatom_XdndActionPrivate; + else if (EQ (action, QXdndActionAsk)) + xaction = FRAME_DISPLAY_INFO (f)->Xatom_XdndActionAsk; else if (CONSP (action)) { xaction = FRAME_DISPLAY_INFO (f)->Xatom_XdndActionAsk; @@ -6671,6 +6677,7 @@ instead. */) CHECK_LIST (action); for (; CONSP (action); action = XCDR (action)) { + maybe_quit (); tem = XCAR (action); CHECK_CONS (tem); t1 = XCAR (tem); @@ -6686,6 +6693,8 @@ instead. */) action_list[nnames] = FRAME_DISPLAY_INFO (f)->Xatom_XdndActionMove; else if (EQ (t1, QXdndActionLink)) action_list[nnames] = FRAME_DISPLAY_INFO (f)->Xatom_XdndActionLink; + else if (EQ (t1, QXdndActionAsk)) + action_list[nnames] = FRAME_DISPLAY_INFO (f)->Xatom_XdndActionAsk; else if (EQ (t1, QXdndActionPrivate)) action_list[nnames] = FRAME_DISPLAY_INFO (f)->Xatom_XdndActionPrivate; else diff --git a/src/xterm.c b/src/xterm.c index fcc1f55ccb6..33165c27a76 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -7010,6 +7010,17 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, Atom xaction, PropModeReplace, (unsigned char *) ask_action_list, n_ask_actions); } + else + { + /* Delete those two properties, since some clients look at them + and not the action to decide whether or not the user should + be prompted to select an action. */ + + XDeleteProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), + FRAME_DISPLAY_INFO (f)->Xatom_XdndActionList); + XDeleteProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), + FRAME_DISPLAY_INFO (f)->Xatom_XdndActionDescription); + } x_dnd_in_progress = true; x_dnd_frame = f;