emacs-diffs
[Top][All Lists]
Advanced

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

master 9ccaf35e0b: Implement `drag-source' values of track-mouse on NS


From: Po Lu
Subject: master 9ccaf35e0b: Implement `drag-source' values of track-mouse on NS
Date: Sun, 3 Apr 2022 07:21:07 -0400 (EDT)

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

    Implement `drag-source' values of track-mouse on NS
    
    * src/nsterm.m (ns_mouse_position): Don't return frame when
    appropriate.
---
 src/nsterm.m | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/src/nsterm.m b/src/nsterm.m
index f4c1e08925..15127d53fb 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -2270,6 +2270,7 @@ ns_mouse_position (struct frame **fp, int insist, 
Lisp_Object *bar_window,
   Lisp_Object frame, tail;
   struct frame *f = NULL;
   struct ns_display_info *dpyinfo;
+  bool return_no_frame_flag = false;
 
   NSTRACE ("ns_mouse_position");
 
@@ -2313,15 +2314,25 @@ ns_mouse_position (struct frame **fp, int insist, 
Lisp_Object *bar_window,
 #endif
 
   if (!f)
-    f = dpyinfo->ns_focus_frame ? dpyinfo->ns_focus_frame : SELECTED_FRAME ();
+    {
+      f = (dpyinfo->ns_focus_frame
+          ? dpyinfo->ns_focus_frame : SELECTED_FRAME ());
+      return_no_frame_flag = EQ (track_mouse, Qdrag_source);
+    }
+
+  if (!FRAME_NS_P (f))
+    f = NULL;
 
   /* While dropping, use the last mouse frame only if there is no
      currently focused frame.  */
-  if (!f
-      && EQ (track_mouse, Qdropping)
+  if (!f && (EQ (track_mouse, Qdropping)
+            || EQ (track_mouse, Qdrag_source))
       && dpyinfo->last_mouse_frame
       && FRAME_LIVE_P (dpyinfo->last_mouse_frame))
-    f = dpyinfo->last_mouse_frame;
+    {
+      f = dpyinfo->last_mouse_frame;
+      return_no_frame_flag = EQ (track_mouse, Qdrag_source);
+    }
 
   if (f && FRAME_NS_P (f))
     {
@@ -2340,7 +2351,7 @@ ns_mouse_position (struct frame **fp, int insist, 
Lisp_Object *bar_window,
       if (y) XSETINT (*y, lrint (view_position.y));
       if (time)
         *time = dpyinfo->last_mouse_movement_time;
-      *fp = f;
+      *fp = return_no_frame_flag ? NULL : f;
     }
 
   unblock_input ();



reply via email to

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