summaryrefslogtreecommitdiff
path: root/lisp/x-dnd.el
diff options
context:
space:
mode:
authorJan Djärv <jan.h.d@swipnet.se>2011-06-20 22:49:12 +0200
committerJan Djärv <jan.h.d@swipnet.se>2011-06-20 22:49:12 +0200
commitca5307394f6861fc825434c268e0a44adf8a3252 (patch)
tree409fcced16cdeac26e13dcd59579256c067d91b3 /lisp/x-dnd.el
parent4cb3bfa09c6838a579fcf3dab9b7ea1135a2fb4b (diff)
downloademacs-ca5307394f6861fc825434c268e0a44adf8a3252.tar.gz
* x-dnd.el (x-dnd-version-from-flags)
(x-dnd-more-than-3-from-flags): New functions that handle long-as-cons and long as number. (x-dnd-handle-xdnd): Call functions above. Fixes: debbugs:8899
Diffstat (limited to 'lisp/x-dnd.el')
-rw-r--r--lisp/x-dnd.el17
1 files changed, 15 insertions, 2 deletions
diff --git a/lisp/x-dnd.el b/lisp/x-dnd.el
index 1c6af1f45f2..04b759a8116 100644
--- a/lisp/x-dnd.el
+++ b/lisp/x-dnd.el
@@ -433,6 +433,18 @@ otherwise return the frame coordinates."
(declare-function x-get-selection-internal "xselect.c"
(selection-symbol target-type &optional time-stamp))
+(defun x-dnd-version-from-flags (flags)
+ "Return the version byte from the 32 bit FLAGS in an XDndEnter message"
+ (if (consp flags) ;; Long as cons
+ (ash (car flags) -8)
+ (ash flags -24))) ;; Ordinary number
+
+(defun x-dnd-more-than-3-from-flags (flags)
+ "Return the nmore-than3 bit from the 32 bit FLAGS in an XDndEnter message"
+ (if (consp flags)
+ (logand (cdr flags) 1)
+ (logand flags 1)))
+
(defun x-dnd-handle-xdnd (event frame window message _format data)
"Receive one XDND event (client message) and send the appropriate reply.
EVENT is the client message. FRAME is where the mouse is now.
@@ -440,9 +452,10 @@ WINDOW is the window within FRAME where the mouse is now.
FORMAT is 32 (not used). MESSAGE is the data part of an XClientMessageEvent."
(cond ((equal "XdndEnter" message)
(let* ((flags (aref data 1))
- (version (and (consp flags) (ash (car flags) -8)))
- (more-than-3 (and (consp flags) (cdr flags)))
+ (version (x-dnd-version-from-flags flags))
+ (more-than-3 (x-dnd-more-than-3-from-flags flags))
(dnd-source (aref data 0)))
+ (message "%s %s" version more-than-3)
(if version ;; If flags is bad, version will be nil.
(x-dnd-save-state
window nil nil