fix drag issue on multiple windows with selected text at same time

This commit is contained in:
David Botton 2024-08-22 07:21:54 -04:00
parent 04031f2520
commit f736bfa4e4

View file

@ -989,7 +989,6 @@ The on-window-change clog-obj received is the new window"))
(defun on-gui-drag-down (obj data)
"Handle mouse down on drag items"
(let ((app (connection-data-item obj "clog-gui")))
(setf (in-drag app) (attribute obj "data-drag-type"))
(handler-case
(let* ((target (gethash (attribute obj "data-drag-obj") (windows app)))
(pointer-x (getf data ':screen-x))
@ -999,6 +998,9 @@ The on-window-change clog-obj received is the new window"))
(perform-drag nil))
(when target
(setf (drag-obj app) target)
(unless (keep-on-top (drag-obj app))
(setf (z-index (drag-obj app)) (incf (last-z app))))
(setf (in-drag app) (attribute obj "data-drag-type"))
(cond ((equalp (in-drag app) "m")
(setf obj-top
(js-to-integer (top (drag-obj app))))
@ -1011,18 +1013,22 @@ The on-window-change clog-obj received is the new window"))
(setf perform-drag (fire-on-window-can-size (drag-obj app))))
(t
(format t "Warning - invalid data-drag-type attribute")))
(unless (keep-on-top (drag-obj app))
(setf (z-index (drag-obj app)) (incf (last-z app))))
(fire-on-window-change (drag-obj app) app)
(setf (drag-y app) (- pointer-y obj-top))
(setf (drag-x app) (- pointer-x obj-left)))
(setf (drag-x app) (- pointer-x obj-left))
(cond (perform-drag
(set-on-pointer-move obj 'on-gui-drag-move)
(set-on-pointer-cancel obj 'on-gui-drag-stop)
(set-on-pointer-cancel obj
(lambda (obj data)
(setf (getf data ':screen-x) pointer-x)
(setf (getf data ':screen-y) pointer-y)
(on-gui-drag-stop obj data)))
(set-on-pointer-up obj 'on-gui-drag-stop))
(t
(setf (in-drag app) nil))))
(error () nil))))
(setf (in-drag app) nil)))))
(error ()
(setf (in-drag app) nil)))))
;;;;;;;;;;;;;;;;;;;;;;
;; on-gui-drag-move ;;
;;;;;;;;;;;;;;;;;;;;;;