comparison lisp/x-dnd.el @ 81390:fe478726dca2

(x-dnd-maybe-call-test-function, x-dnd-save-state, x-dnd-drop-data): Remove redundant checks.
author Juanma Barranquero <lekktu@gmail.com>
date Thu, 14 Jun 2007 00:09:10 +0000
parents e3694f1cb928
children b98604865ea0 9c01792a3ce8 3619e7770f2e
comparison
equal deleted inserted replaced
81389:4e4dec192190 81390:fe478726dca2
169 (defun x-dnd-maybe-call-test-function (window action) 169 (defun x-dnd-maybe-call-test-function (window action)
170 "Call `x-dnd-test-function' if something has changed. 170 "Call `x-dnd-test-function' if something has changed.
171 WINDOW is the window the mouse is over. ACTION is the suggested 171 WINDOW is the window the mouse is over. ACTION is the suggested
172 action from the source. If nothing has changed, return the last 172 action from the source. If nothing has changed, return the last
173 action and type we got from `x-dnd-test-function'." 173 action and type we got from `x-dnd-test-function'."
174 (let ((buffer (when (and (windowp window) (window-live-p window)) 174 (let ((buffer (when (window-live-p window)
175 (window-buffer window))) 175 (window-buffer window)))
176 (current-state (x-dnd-get-state-for-frame window))) 176 (current-state (x-dnd-get-state-for-frame window)))
177 (when (or (not (equal buffer (aref current-state 0))) 177 (when (or (not (equal buffer (aref current-state 0)))
178 (not (equal window (aref current-state 1))) 178 (not (equal window (aref current-state 1)))
179 (not (equal action (aref current-state 3)))) 179 (not (equal action (aref current-state 3))))
204 (aset current-state 4 (cdr action-type)) 204 (aset current-state 4 (cdr action-type))
205 (aset current-state 3 action) 205 (aset current-state 3 action)
206 (when types (aset current-state 2 types)) 206 (when types (aset current-state 2 types))
207 (when extra-data (aset current-state 6 extra-data)) 207 (when extra-data (aset current-state 6 extra-data))
208 (aset current-state 1 window) 208 (aset current-state 1 window)
209 (aset current-state 0 (if (and (windowp window) 209 (aset current-state 0 (and (window-live-p window) (window-buffer window)))
210 (window-live-p window))
211 (window-buffer window) nil))
212 (setcdr (x-dnd-get-state-cons-for-frame window) current-state))) 210 (setcdr (x-dnd-get-state-cons-for-frame window) current-state)))
213 211
214 212
215 (defun x-dnd-handle-moz-url (window action data) 213 (defun x-dnd-handle-moz-url (window action data)
216 "Handle one item of type text/x-moz-url. 214 "Handle one item of type text/x-moz-url.
317 (handler (cdr type-info)) 315 (handler (cdr type-info))
318 (state (x-dnd-get-state-for-frame frame)) 316 (state (x-dnd-get-state-for-frame frame))
319 (action (aref state 5)) 317 (action (aref state 5))
320 (w (posn-window (event-start event)))) 318 (w (posn-window (event-start event))))
321 (when handler 319 (when handler
322 (if (and (windowp w) (window-live-p w) 320 (if (and (window-live-p w)
323 (not (window-minibuffer-p w)) 321 (not (window-minibuffer-p w))
324 (not (window-dedicated-p w))) 322 (not (window-dedicated-p w)))
325 ;; If dropping in an ordinary window which we could use, 323 ;; If dropping in an ordinary window which we could use,
326 ;; let dnd-open-file-other-window specify what to do. 324 ;; let dnd-open-file-other-window specify what to do.
327 (progn 325 (progn