emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/term/mac-win.el,v


From: YAMAMOTO Mitsuharu
Subject: [Emacs-diffs] Changes to emacs/lisp/term/mac-win.el,v
Date: Mon, 22 Jan 2007 08:27:24 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     YAMAMOTO Mitsuharu <mituharu>   07/01/22 08:27:24

Index: mac-win.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/term/mac-win.el,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -b -r1.86 -r1.87
--- mac-win.el  21 Jan 2007 03:22:34 -0000      1.86
+++ mac-win.el  22 Jan 2007 08:27:23 -0000      1.87
@@ -1687,6 +1687,26 @@
                                       (+ (* i 10) 12)))))
     result))
 
+(defconst mac-keyboard-modifier-mask-alist
+  (mapcar
+   (lambda (modifier-bit)
+     (cons (car modifier-bit) (lsh 1 (cdr modifier-bit))))
+   '((command  . 8)                    ; cmdKeyBit
+     (shift    . 9)                    ; shiftKeyBit
+     (option   . 11)                   ; optionKeyBit
+     (control  . 12)                   ; controlKeyBit
+     (function . 17)))                 ; kEventKeyModifierFnBit
+  "Alist of Mac keyboard modifier symbols vs masks.")
+
+(defun mac-ae-keyboard-modifiers (ae)
+  (let ((modifiers-value (mac-ae-number ae "kmod"))
+       modifiers)
+    (if modifiers-value
+       (dolist (modifier-mask mac-keyboard-modifier-mask-alist)
+         (if (/= (logand modifiers-value (cdr modifier-mask)) 0)
+             (setq modifiers (cons (car modifier-mask) modifiers)))))
+    modifiers))
+
 (defun mac-ae-open-documents (event)
   "Open the documents specified by the Apple event EVENT."
   (interactive "e")
@@ -1762,9 +1782,8 @@
 frame where the tool-bar toggle button was pressed.  With some
 modifiers, it changes global tool-bar visibility setting."
   (interactive "e")
-  (let* ((ae (mac-event-ae event))
-        (modifiers (cdr (mac-ae-parameter ae "kmod"))))
-    (if (and modifiers (not (string= modifiers "\000\000\000\000")))
+  (let ((ae (mac-event-ae event)))
+    (if (mac-ae-keyboard-modifiers ae)
        ;; Globally toggle tool-bar-mode if some modifier key is pressed.
        (tool-bar-mode)
       (let ((frame (mac-ae-frame ae)))
@@ -2221,10 +2240,10 @@
 (defun mac-dnd-insert-TIFF (window action data)
   (dnd-insert-text window action (mac-TIFF-to-string data)))
 
-(defun mac-dnd-drop-data (event frame window data type)
+(defun mac-dnd-drop-data (event frame window data type &optional action)
+  (or action (setq action 'private))
   (let* ((type-info (assoc type mac-dnd-types-alist))
         (handler (cdr type-info))
-        (action 'private)
         (w (posn-window (event-start event))))
     (when handler
       (if (and (windowp w) (window-live-p w)
@@ -2245,12 +2264,16 @@
 (defun mac-dnd-handle-drag-n-drop-event (event)
   "Receive drag and drop events."
   (interactive "e")
-  (let ((window (posn-window (event-start event))))
+  (let ((window (posn-window (event-start event)))
+       (ae (mac-event-ae event))
+       action)
     (when (windowp window) (select-window window))
-    (dolist (item (mac-ae-list (mac-event-ae event)))
+    (if (memq 'option (mac-ae-keyboard-modifiers ae))
+       (setq action 'copy))
+    (dolist (item (mac-ae-list ae))
       (if (not (equal (car item) "null"))
          (mac-dnd-drop-data event (selected-frame) window
-                            (cdr item) (car item)))))
+                            (cdr item) (car item) action))))
   (select-frame-set-input-focus (selected-frame)))
 
 ;;; Do the actual Windows setup here; the above code just defines
@@ -2591,7 +2614,6 @@
 ;; Initiate drag and drop
 
 (define-key special-event-map [drag-n-drop] 'mac-dnd-handle-drag-n-drop-event)
-(define-key special-event-map [M-drag-n-drop] 
'mac-dnd-handle-drag-n-drop-event)
 
 
 ;;;; Non-toolkit Scroll bars




reply via email to

[Prev in Thread] Current Thread [Next in Thread]