comparison lisp/term/mac-win.el @ 59189:60ffced08532

* term/mac-win.el: Require x-dnd. (mac-drag-n-drop): Sync with W32 version. Use x-dnd.el functions. * macfns.c (install_window_handler): Modify extern to return OSErr value. (mac_window): Handle return value of install_window_handler. * macterm.c (reflect_byte): Remove function. (mac_create_bitmap_from_bitmap_data): Don't call it. Lookup table instead. (mac_do_font_lists): Simplify calculation of the longest nonspecial string. [TARGET_API_MAC_CARBON] (init_mac_drag_n_drop): Remove function and declaration. (mac_initialize) [TARGET_API_MAC_CARBON]: Don't call it. [TARGET_API_MAC_CARBON] (mac_do_track_drag): New function and declaration. (install_window_handler): Return OSErr value. (install_window_handler) [TARGET_API_MAC_CARBON]: Register handlers for tracking/receiving drag-and-drop items. (do_ae_open_documents): Generate unibyte strings for filenames. [TARGET_API_MAC_CARBON] (mac_do_receive_drag): Likewise. Reject only non-filename items. Set event modifiers. Set return value.
author Steven Tamm <steventamm@mac.com>
date Wed, 29 Dec 2004 17:25:02 +0000
parents 8d9ea622c741
children d6563f85d9e5
comparison
equal deleted inserted replaced
59188:6b0648eec44c 59189:60ffced08532
74 (require 'scroll-bar) 74 (require 'scroll-bar)
75 (require 'faces) 75 (require 'faces)
76 ;;(require 'select) 76 ;;(require 'select)
77 (require 'menu-bar) 77 (require 'menu-bar)
78 (require 'fontset) 78 (require 'fontset)
79 ;;(require 'x-dnd) 79 (require 'x-dnd)
80 80
81 (defvar x-invocation-args) 81 (defvar x-invocation-args)
82 82
83 (defvar x-command-line-resources nil) 83 (defvar x-command-line-resources nil)
84 84
1562 1562
1563 ;; Turn on support for mouse wheels. 1563 ;; Turn on support for mouse wheels.
1564 (mouse-wheel-mode 1) 1564 (mouse-wheel-mode 1)
1565 1565
1566 (defun mac-drag-n-drop (event) 1566 (defun mac-drag-n-drop (event)
1567 "Edit the files listed in the drag-n-drop event.\n\ 1567 "Edit the files listed in the drag-n-drop EVENT.
1568 Switch to a buffer editing the last file dropped." 1568 Switch to a buffer editing the last file dropped."
1569 (interactive "e") 1569 (interactive "e")
1570 (save-excursion 1570 (save-excursion
1571 ;; Make sure the drop target has positive co-ords 1571 ;; Make sure the drop target has positive co-ords
1572 ;; before setting the selected frame - otherwise it 1572 ;; before setting the selected frame - otherwise it
1575 (coords (posn-x-y (event-start event))) 1575 (coords (posn-x-y (event-start event)))
1576 (x (car coords)) 1576 (x (car coords))
1577 (y (cdr coords))) 1577 (y (cdr coords)))
1578 (if (and (> x 0) (> y 0)) 1578 (if (and (> x 0) (> y 0))
1579 (set-frame-selected-window nil window)) 1579 (set-frame-selected-window nil window))
1580 (mapcar 1580 (mapcar (lambda (file-name)
1581 '(lambda (file) 1581 (x-dnd-handle-one-url window 'private
1582 (find-file 1582 (concat "file:" file-name)))
1583 (decode-coding-string 1583 (car (cdr (cdr event)))))
1584 file 1584 (raise-frame)))
1585 (or file-name-coding-system
1586 default-file-name-coding-system))))
1587 (car (cdr (cdr event)))))
1588 (raise-frame)
1589 (recenter)))
1590 1585
1591 (global-set-key [drag-n-drop] 'mac-drag-n-drop) 1586 (global-set-key [drag-n-drop] 'mac-drag-n-drop)
1592 1587
1593 ;; By checking whether the variable mac-ready-for-drag-n-drop has been 1588 ;; By checking whether the variable mac-ready-for-drag-n-drop has been
1594 ;; defined, the event loop in macterm.c can be informed that it can 1589 ;; defined, the event loop in macterm.c can be informed that it can