emacs-diffs
[Top][All Lists]
Advanced

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

master 28b375a931: Fix target display checks during Motif DND


From: Po Lu
Subject: master 28b375a931: Fix target display checks during Motif DND
Date: Wed, 27 Apr 2022 20:46:34 -0400 (EDT)

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

    Fix target display checks during Motif DND
    
    * src/xterm.c (handle_one_xevent): Check that the Motif DND
    completion message is actually from the right display before
    proceeding.
---
 src/xterm.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/xterm.c b/src/xterm.c
index 891a242012..ff665acdf2 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -886,6 +886,10 @@ static bool x_dnd_waiting_for_finish;
    XmTRANSFER_SUCCESS or XmTRANSFER_FAILURE.  */
 static int x_dnd_waiting_for_motif_finish;
 
+/* The display the Motif drag receiver will send response data
+   from.  */
+struct x_display_info *x_dnd_waiting_for_motif_finish_display;
+
 /* Whether or not F1 was pressed during the drag-and-drop operation.
 
    Motif programs rely on this to decide whether or not help
@@ -14054,12 +14058,9 @@ handle_one_xevent (struct x_display_info *dpyinfo,
 
        if ((event->xclient.message_type
             == dpyinfo->Xatom_MOTIF_DRAG_AND_DROP_MESSAGE)
-           /* FIXME: There should probably be a check that the event
-              comes from the same display where the drop event was
-              sent, but there's no way to get that information here
-              safely.  */
            && x_dnd_waiting_for_finish
-           && x_dnd_waiting_for_motif_finish == 1)
+           && x_dnd_waiting_for_motif_finish == 1
+           && dpyinfo == x_dnd_waiting_for_motif_finish_display)
          {
            xm_drop_start_reply reply;
            uint16_t operation, status, action;
@@ -14417,6 +14418,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
 
        if (x_dnd_waiting_for_finish
            && x_dnd_waiting_for_motif_finish == 2
+           && dpyinfo == x_dnd_waiting_for_motif_finish_display
            && eventp->selection == dpyinfo->Xatom_XdndSelection
            && (eventp->target == dpyinfo->Xatom_XmTRANSFER_SUCCESS
                || eventp->target == dpyinfo->Xatom_XmTRANSFER_FAILURE))
@@ -16167,6 +16169,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
                                                      x_dnd_last_seen_window, 
&dmsg);
 
                                x_dnd_waiting_for_finish = true;
+                               x_dnd_waiting_for_motif_finish_display = 
dpyinfo;
                                x_dnd_waiting_for_motif_finish = 1;
                              }
                          }
@@ -17440,6 +17443,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
                                                            
x_dnd_last_seen_window, &dmsg);
 
                                      x_dnd_waiting_for_finish = true;
+                                     x_dnd_waiting_for_motif_finish_display = 
dpyinfo;
                                      x_dnd_waiting_for_motif_finish = 1;
                                    }
                                }



reply via email to

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