emacs-diffs
[Top][All Lists]
Advanced

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

master 378b4ccd4b: Fix DND leave events not being sent to toplevel after


From: Po Lu
Subject: master 378b4ccd4b: Fix DND leave events not being sent to toplevel after returning frame
Date: Fri, 8 Apr 2022 23:44:57 -0400 (EDT)

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

    Fix DND leave events not being sent to toplevel after returning frame
    
    * src/xterm.c (x_dnd_update_state, handle_one_xevent): Make sure
    to send leave events to the previous toplevel when cancelling to
    return a frame.
---
 src/xterm.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 69 insertions(+)

diff --git a/src/xterm.c b/src/xterm.c
index d94a3cf91a..509403fbf2 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -13303,6 +13303,29 @@ x_dnd_update_state (struct x_display_info *dpyinfo, 
Time timestamp)
          if (x_dnd_return_frame == 2
              && x_any_window_to_frame (dpyinfo, toplevel))
            {
+             if (x_dnd_last_seen_window != None
+                 && x_dnd_last_protocol_version != -1
+                 && x_dnd_last_seen_window != FRAME_OUTER_WINDOW (x_dnd_frame))
+               x_dnd_send_leave (x_dnd_frame, x_dnd_last_seen_window);
+             else if (x_dnd_last_seen_window != None
+                      && XM_DRAG_STYLE_IS_DYNAMIC (x_dnd_last_motif_style)
+                      && x_dnd_last_seen_window != FRAME_OUTER_WINDOW 
(x_dnd_frame))
+               {
+                 if (!x_dnd_motif_setup_p)
+                   xm_setup_drag_info (dpyinfo, x_dnd_frame);
+
+                 lmsg.reason = XM_DRAG_REASON (XM_DRAG_ORIGINATOR_INITIATOR,
+                                               XM_DRAG_REASON_TOP_LEVEL_LEAVE);
+                 lmsg.byteorder = XM_TARGETS_TABLE_CUR;
+                 lmsg.zero = 0;
+                 lmsg.timestamp = timestamp;
+                 lmsg.source_window = FRAME_X_WINDOW (x_dnd_frame);
+
+                 if (x_dnd_motif_setup_p)
+                   xm_send_top_level_leave_message (dpyinfo, FRAME_X_WINDOW 
(x_dnd_frame),
+                                                    x_dnd_last_seen_window, 
&lmsg);
+               }
+
              x_dnd_end_window = x_dnd_last_seen_window;
              x_dnd_last_seen_window = None;
              x_dnd_last_seen_toplevel = None;
@@ -14949,6 +14972,29 @@ handle_one_xevent (struct x_display_info *dpyinfo,
                if (x_dnd_return_frame == 2
                    && x_any_window_to_frame (dpyinfo, toplevel))
                  {
+                   if (x_dnd_last_seen_window != None
+                       && x_dnd_last_protocol_version != -1
+                       && x_dnd_last_seen_window != FRAME_OUTER_WINDOW 
(x_dnd_frame))
+                     x_dnd_send_leave (x_dnd_frame, x_dnd_last_seen_window);
+                   else if (x_dnd_last_seen_window != None
+                            && XM_DRAG_STYLE_IS_DYNAMIC 
(x_dnd_last_motif_style)
+                            && x_dnd_last_seen_window != FRAME_OUTER_WINDOW 
(x_dnd_frame))
+                     {
+                       if (!x_dnd_motif_setup_p)
+                         xm_setup_drag_info (dpyinfo, x_dnd_frame);
+
+                       lmsg.reason = XM_DRAG_REASON 
(XM_DRAG_ORIGINATOR_INITIATOR,
+                                                     
XM_DRAG_REASON_TOP_LEVEL_LEAVE);
+                       lmsg.byteorder = XM_TARGETS_TABLE_CUR;
+                       lmsg.zero = 0;
+                       lmsg.timestamp = event->xmotion.time;
+                       lmsg.source_window = FRAME_X_WINDOW (x_dnd_frame);
+
+                       if (x_dnd_motif_setup_p)
+                         xm_send_top_level_leave_message (dpyinfo, 
FRAME_X_WINDOW (x_dnd_frame),
+                                                          
x_dnd_last_seen_window, &lmsg);
+                     }
+
                    x_dnd_end_window = x_dnd_last_seen_window;
                    x_dnd_last_seen_window = None;
                    x_dnd_last_seen_toplevel = None;
@@ -16451,6 +16497,29 @@ handle_one_xevent (struct x_display_info *dpyinfo,
                      if (x_dnd_return_frame == 2
                          && x_any_window_to_frame (dpyinfo, toplevel))
                        {
+                         if (x_dnd_last_seen_window != None
+                             && x_dnd_last_protocol_version != -1
+                             && x_dnd_last_seen_window != FRAME_OUTER_WINDOW 
(x_dnd_frame))
+                           x_dnd_send_leave (x_dnd_frame, 
x_dnd_last_seen_window);
+                         else if (x_dnd_last_seen_window != None
+                                  && XM_DRAG_STYLE_IS_DYNAMIC 
(x_dnd_last_motif_style)
+                                  && x_dnd_last_seen_window != 
FRAME_OUTER_WINDOW (x_dnd_frame))
+                           {
+                             if (!x_dnd_motif_setup_p)
+                               xm_setup_drag_info (dpyinfo, x_dnd_frame);
+
+                             lmsg.reason = XM_DRAG_REASON 
(XM_DRAG_ORIGINATOR_INITIATOR,
+                                                           
XM_DRAG_REASON_TOP_LEVEL_LEAVE);
+                             lmsg.byteorder = XM_TARGETS_TABLE_CUR;
+                             lmsg.zero = 0;
+                             lmsg.timestamp = event->xmotion.time;
+                             lmsg.source_window = FRAME_X_WINDOW (x_dnd_frame);
+
+                             if (x_dnd_motif_setup_p)
+                               xm_send_top_level_leave_message (dpyinfo, 
FRAME_X_WINDOW (x_dnd_frame),
+                                                                
x_dnd_last_seen_window, &lmsg);
+                           }
+
                          x_dnd_end_window = x_dnd_last_seen_window;
                          x_dnd_last_seen_window = None;
                          x_dnd_last_seen_toplevel = None;



reply via email to

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