Function: x-dnd-maybe-call-test-function

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

Signature

(x-dnd-maybe-call-test-function WINDOW ACTION)

Documentation

Call x-dnd-test-function if something has changed.

WINDOW is the window the mouse is over. ACTION is the suggested action from the source. If nothing has changed, return the last action and type we got from x-dnd-test-function.

Source Code

;; Defined in /usr/src/emacs/lisp/x-dnd.el.gz
(defun x-dnd-maybe-call-test-function (window action)
  "Call `x-dnd-test-function' if something has changed.
WINDOW is the window the mouse is over.  ACTION is the suggested
action from the source.  If nothing has changed, return the last
action and type we got from `x-dnd-test-function'."
  (let ((buffer (when (window-live-p window)
		  (window-buffer window)))
	(current-state (x-dnd-get-state-for-frame window)))
    (unless (and (equal buffer (aref current-state 0))
                 (equal window (aref current-state 1))
                 (equal action (aref current-state 3)))
      (save-current-buffer
	(when buffer (set-buffer buffer))
	(let* ((action-type (funcall x-dnd-test-function
				     window
				     action
				     (aref current-state 2)))
	       (handler (cdr (assoc (cdr action-type) x-dnd-types-alist))))
	  ;; Ignore action-type if we have no handler.
	  (setq current-state
		(x-dnd-save-state window
				  action
				  (when handler action-type)))))))
  (let ((current-state (x-dnd-get-state-for-frame window)))
    (cons (aref current-state 5)
	  (aref current-state 4))))