summaryrefslogtreecommitdiff
path: root/src/nsterm.m
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2022-04-03 09:59:14 +0800
committerPo Lu <luangruo@yahoo.com>2022-04-03 09:59:14 +0800
commitf229710d41e85752bc1a835bae56c055a62813d9 (patch)
tree217d476c6209b4a014a1aa7a05293bb6c325d103 /src/nsterm.m
parente9d4f119da48fe119d9d7a6d1b9a054c043bd517 (diff)
downloademacs-f229710d41e85752bc1a835bae56c055a62813d9.tar.gz
Implement new DND features on GNUstep
* lisp/term/ns-win.el (ns-drag-n-drop): Handle special `lambda' drag-n-drop events. * src/nsterm.m: ([EmacsView wantsPeriodicDraggingUpdates]): ([EmacsView draggingUpdated:]): New functions.
Diffstat (limited to 'src/nsterm.m')
-rw-r--r--src/nsterm.m31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/nsterm.m b/src/nsterm.m
index fd56094c28b..f4c1e08925c 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -8056,6 +8056,37 @@ not_in_argv (NSString *arg)
return YES;
}
+- (BOOL) wantsPeriodicDraggingUpdates
+{
+ return YES;
+}
+
+- (NSDragOperation) draggingUpdated: (id <NSDraggingInfo>) sender
+{
+ struct input_event ie;
+ NSPoint position;
+ int x, y;
+
+ EVENT_INIT (ie);
+ ie.kind = DRAG_N_DROP_EVENT;
+
+ /* Get rid of mouse face. */
+ [self mouseExited: [[self window] currentEvent]];
+
+ position = [self convertPoint: [sender draggingLocation]
+ fromView: nil];
+ x = lrint (position.x);
+ y = lrint (position.y);
+
+ XSETINT (ie.x, x);
+ XSETINT (ie.y, y);
+ XSETFRAME (ie.frame_or_window, emacsframe);
+ ie.arg = Qlambda;
+ ie.modifiers = 0;
+
+ kbd_buffer_store_event (&ie);
+ return NSDragOperationGeneric;
+}
-(BOOL)performDragOperation: (id <NSDraggingInfo>) sender
{