emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master cae187e430: Fix some bugs with drag and drop and Mozilla


From: Po Lu
Subject: master cae187e430: Fix some bugs with drag and drop and Mozilla
Date: Thu, 24 Mar 2022 04:39:42 -0400 (EDT)

branch: master
commit cae187e430dc01a46ff719257368c7166eaa8ad1
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    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.
---
 src/xfns.c  | 11 ++++++++++-
 src/xterm.c | 11 +++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/src/xfns.c b/src/xfns.c
index c4b924e007..52649b38dd 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 fcc1f55ccb..33165c27a7 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;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]