summaryrefslogtreecommitdiff
path: root/lisp/mouse.el
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2022-04-03 18:59:12 +0800
committerPo Lu <luangruo@yahoo.com>2022-04-03 18:59:12 +0800
commit28f720e7c483c37a6c94f6b561e8f175b3af51a4 (patch)
tree96634c9fca9a45633b1f913af066f79a14afad5e /lisp/mouse.el
parent441ce4672d4aab14d1bef078692fec7ad4ff0c0a (diff)
downloademacs-28f720e7c483c37a6c94f6b561e8f175b3af51a4.tar.gz
Make dragging stuff to a window above a frame work
* doc/lispref/frames.texi (Mouse Tracking): * etc/NEWS: Announce new `drag-source' value of `track-mouse'. * lisp/mouse.el (mouse-drag-and-drop-region): Use new value of `track-mouse' during interprogram drag and drop. * src/keyboard.c (make_lispy_position): Handle nil values of f correctly. * src/xdisp.c (define_frame_cursor1): Ignore if `drag-source' as well. (syms_of_xdisp): New defsym `drag-source'. * src/xterm.c (XTmouse_position): Implement `drag-source'. (mouse_or_wdesc_frame): Likewise.
Diffstat (limited to 'lisp/mouse.el')
-rw-r--r--lisp/mouse.el32
1 files changed, 22 insertions, 10 deletions
diff --git a/lisp/mouse.el b/lisp/mouse.el
index 92e289b4ced..f42492bb5d3 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -3085,7 +3085,18 @@ is copied instead of being cut."
(ignore-errors
(catch 'cross-program-drag
(track-mouse
- (setq track-mouse 'dropping)
+ (setq track-mouse (if mouse-drag-and-drop-region-cross-program
+ ;; When `track-mouse' is `drop', we
+ ;; get events with a posn-window of
+ ;; the grabbed frame even if some
+ ;; window is between that and the
+ ;; pointer. This makes dragging to a
+ ;; window on top of a frame
+ ;; impossible. With this value of
+ ;; `track-mouse', no frame is returned
+ ;; in that particular case.
+ 'drag-source
+ 'drop))
;; When event was "click" instead of "drag", skip loop.
(while (progn
(setq event (read-key)) ; read-event or read-key
@@ -3151,15 +3162,16 @@ is copied instead of being cut."
(when (and mouse-drag-and-drop-region-cross-program
(display-graphic-p)
(fboundp 'x-begin-drag)
- (framep (posn-window (event-end event)))
- (let ((location (posn-x-y (event-end event)))
- (frame (posn-window (event-end event))))
- (or (< (car location) 0)
- (< (cdr location) 0)
- (> (car location)
- (frame-pixel-width frame))
- (> (cdr location)
- (frame-pixel-height frame)))))
+ (or (and (framep (posn-window (event-end event)))
+ (let ((location (posn-x-y (event-end event)))
+ (frame (posn-window (event-end event))))
+ (or (< (car location) 0)
+ (< (cdr location) 0)
+ (> (car location)
+ (frame-pixel-width frame))
+ (> (cdr location)
+ (frame-pixel-height frame)))))
+ (not (posn-window (event-end event)))))
(mouse-drag-and-drop-region-hide-tooltip)
(gui-set-selection 'XdndSelection value-selection)
(let ((drag-action-or-frame