Function: x-dnd-default-test-function

x-dnd-default-test-function is a byte-compiled function defined in x-dnd.el.gz.

Signature

(x-dnd-default-test-function WINDOW ACTION TYPES)

Documentation

The default test function for drag-and-drop.

WINDOW is where the mouse is when this function is called. It may be a frame if the mouse is over the menu bar, scroll bar or tool bar. ACTION is the suggested action from the source, and TYPES are the types the drop data can have. This function only accepts drops with types in x-dnd-known-types. It always returns the action private, unless types contains a value inside x-dnd-copy-types, in which case it may return copy.

Source Code

;; Defined in /usr/src/emacs/lisp/x-dnd.el.gz
(defun x-dnd-default-test-function (_window _action types)
  "The default test function for drag-and-drop.
WINDOW is where the mouse is when this function is called.  It
may be a frame if the mouse is over the menu bar, scroll bar or
tool bar.  ACTION is the suggested action from the source, and
TYPES are the types the drop data can have.  This function only
accepts drops with types in `x-dnd-known-types'.  It always
returns the action `private', unless `types' contains a value
inside `x-dnd-copy-types', in which case it may return `copy'."
  (let ((type (x-dnd-choose-type types)))
    (when type (let ((list x-dnd-copy-types))
                 (catch 'out
                   (while t
                     (if (not list)
                         (throw 'out (cons 'private type))
                       (if (x-dnd-find-type (car list) types)
                           (throw 'out (cons 'copy type))
                         (setq list (cdr list))))))))))