emacs-diffs
[Top][All Lists]
Advanced

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

master c148bfc229: Fix handling of mouse motion across screens during dr


From: Po Lu
Subject: master c148bfc229: Fix handling of mouse motion across screens during drag-and-drop
Date: Fri, 24 Jun 2022 04:45:25 -0400 (EDT)

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

    Fix handling of mouse motion across screens during drag-and-drop
    
    * src/xterm.c (x_dnd_fill_empty_target): New function.
    (handle_one_xevent): Fill empty target if the event didn't come
    from the same screen.
---
 src/xterm.c | 48 +++++++++++++++++++++++++++++++++++-------------
 1 file changed, 35 insertions(+), 13 deletions(-)

diff --git a/src/xterm.c b/src/xterm.c
index 414a9c0ebe..d03b9a6d61 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -3893,6 +3893,18 @@ x_dnd_send_unsupported_drop (struct x_display_info 
*dpyinfo, Window target_windo
   kbd_buffer_store_event (&ie);
 }
 
+static Window
+x_dnd_fill_empty_target (int *proto_out, int *motif_out,
+                        Window *toplevel_out, bool *was_frame)
+{
+  *proto_out = -1;
+  *motif_out = XM_DRAG_STYLE_NONE;
+  *toplevel_out = None;
+  *was_frame = false;
+
+  return None;
+}
+
 static Window
 x_dnd_get_target_window (struct x_display_info *dpyinfo,
                         int root_x, int root_y, int *proto_out,
@@ -18111,12 +18123,16 @@ handle_one_xevent (struct x_display_info *dpyinfo,
                  }
              }
 
-           target = x_dnd_get_target_window (dpyinfo,
-                                             event->xmotion.x_root,
-                                             event->xmotion.y_root,
-                                             &target_proto,
-                                             &motif_style, &toplevel,
-                                             &was_frame);
+           if (event->xmotion.same_screen)
+             target = x_dnd_get_target_window (dpyinfo,
+                                               event->xmotion.x_root,
+                                               event->xmotion.y_root,
+                                               &target_proto,
+                                               &motif_style, &toplevel,
+                                               &was_frame);
+           else
+             target = x_dnd_fill_empty_target (&target_proto, &motif_style,
+                                               &toplevel, &was_frame);
 
            if (toplevel != x_dnd_last_seen_toplevel)
              {
@@ -19837,13 +19853,19 @@ handle_one_xevent (struct x_display_info *dpyinfo,
                        }
                    }
 
-                 target = x_dnd_get_target_window (dpyinfo,
-                                                   xev->root_x,
-                                                   xev->root_y,
-                                                   &target_proto,
-                                                   &motif_style,
-                                                   &toplevel,
-                                                   &was_frame);
+                 if (xev->root == dpyinfo->root_window)
+                   target = x_dnd_get_target_window (dpyinfo,
+                                                     xev->root_x,
+                                                     xev->root_y,
+                                                     &target_proto,
+                                                     &motif_style,
+                                                     &toplevel,
+                                                     &was_frame);
+                 else
+                   target = x_dnd_fill_empty_target (&target_proto,
+                                                     &motif_style,
+                                                     &toplevel,
+                                                     &was_frame);
 
                  if (toplevel != x_dnd_last_seen_toplevel)
                    {



reply via email to

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