Mercurial > emacs
comparison lisp/term/mac-win.el @ 95838:e7b40b183291
(x-toolkit-scroll-bars): Check bound.
(x-parse-geometry, x-resource-name)
(x-get-selection-internal, tool-bar-mode, set-fontset-font)
(new-fontset, x-display-list, x-open-connection, x-get-resource):
Define for compiler, for builds without X.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Thu, 12 Jun 2008 03:53:07 +0000 |
parents | 92723dccd995 |
children |
comparison
equal
deleted
inserted
replaced
95837:7ea2a6d03884 | 95838:e7b40b183291 |
---|---|
1 ;;; mac-win.el --- parse switches controlling interface with Mac window system -*-coding: utf-8-*- | 1 ;;; mac-win.el --- parse switches controlling interface with Mac window system -*-coding: utf-8-*- |
2 | 2 |
3 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, | 3 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, |
4 ;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc. | 4 ;; 2008 Free Software Foundation, Inc. |
5 | 5 |
6 ;; Author: Andrew Choi <akochoi@mac.com> | 6 ;; Author: Andrew Choi <akochoi@mac.com> |
7 ;; Keywords: terminals | 7 ;; Keywords: terminals |
8 | 8 |
9 ;; This file is part of GNU Emacs. | 9 ;; This file is part of GNU Emacs. |
150 (setq x-command-line-resources | 150 (setq x-command-line-resources |
151 (if (null x-command-line-resources) | 151 (if (null x-command-line-resources) |
152 (car x-invocation-args) | 152 (car x-invocation-args) |
153 (concat x-command-line-resources "\n" (car x-invocation-args)))) | 153 (concat x-command-line-resources "\n" (car x-invocation-args)))) |
154 (setq x-invocation-args (cdr x-invocation-args))) | 154 (setq x-invocation-args (cdr x-invocation-args))) |
155 | |
156 (declare-function x-parse-geometry "frame.c" (string)) | |
155 | 157 |
156 ;; Handle the geometry option | 158 ;; Handle the geometry option |
157 (defun x-handle-geometry (switch) | 159 (defun x-handle-geometry (switch) |
158 (let* ((geo (x-parse-geometry (car x-invocation-args))) | 160 (let* ((geo (x-parse-geometry (car x-invocation-args))) |
159 (left (assq 'left geo)) | 161 (left (assq 'left geo)) |
176 (append initial-frame-alist | 178 (append initial-frame-alist |
177 '((user-position . t)) | 179 '((user-position . t)) |
178 (if left (list left)) | 180 (if left (list left)) |
179 (if top (list top))))) | 181 (if top (list top))))) |
180 (setq x-invocation-args (cdr x-invocation-args)))) | 182 (setq x-invocation-args (cdr x-invocation-args)))) |
183 | |
184 (defvar x-resource-name) | |
181 | 185 |
182 ;; Handle the -name option. Set the variable x-resource-name | 186 ;; Handle the -name option. Set the variable x-resource-name |
183 ;; to the option's operand; set the name of | 187 ;; to the option's operand; set the name of |
184 ;; the initial frame, too. | 188 ;; the initial frame, too. |
185 (defun x-handle-name-switch (switch) | 189 (defun x-handle-name-switch (switch) |
766 (setq x-last-selected-text-clipboard nil) | 770 (setq x-last-selected-text-clipboard nil) |
767 (x-set-selection 'CLIPBOARD text) | 771 (x-set-selection 'CLIPBOARD text) |
768 (setq x-last-selected-text-clipboard text)) | 772 (setq x-last-selected-text-clipboard text)) |
769 ) | 773 ) |
770 | 774 |
775 (declare-function x-get-selection-internal "xselect.c" | |
776 (selection-symbol target-type &optional time-stamp)) | |
777 | |
771 (defun x-get-selection (&optional type data-type) | 778 (defun x-get-selection (&optional type data-type) |
772 "Return the value of a selection. | 779 "Return the value of a selection. |
773 The argument TYPE (default `PRIMARY') says which selection, | 780 The argument TYPE (default `PRIMARY') says which selection, |
774 and the argument DATA-TYPE (default `STRING') says | 781 and the argument DATA-TYPE (default `STRING') says |
775 how to convert the data. | 782 how to convert the data. |
1195 'mac-ae-quit-application) | 1202 'mac-ae-quit-application) |
1196 | 1203 |
1197 (define-key mac-apple-event-map [internet-event get-url] 'mac-ae-get-url) | 1204 (define-key mac-apple-event-map [internet-event get-url] 'mac-ae-get-url) |
1198 | 1205 |
1199 (define-key mac-apple-event-map [hi-command about] 'about-emacs) | 1206 (define-key mac-apple-event-map [hi-command about] 'about-emacs) |
1207 | |
1208 (declare-function tool-bar-mode "tool-bar" (&optional arg)) | |
1200 | 1209 |
1201 ;;; Converted Carbon Events | 1210 ;;; Converted Carbon Events |
1202 (defun mac-handle-toolbar-switch-mode (event) | 1211 (defun mac-handle-toolbar-switch-mode (event) |
1203 "Toggle visibility of tool-bars in response to EVENT. | 1212 "Toggle visibility of tool-bars in response to EVENT. |
1204 With no keyboard modifiers, it toggles the visibility of the | 1213 With no keyboard modifiers, it toggles the visibility of the |
1706 ("mac-cyrillic" . mac-cyrillic) | 1715 ("mac-cyrillic" . mac-cyrillic) |
1707 ("mac-symbol" . mac-symbol) | 1716 ("mac-symbol" . mac-symbol) |
1708 ("mac-dingbats" . mac-dingbats)) | 1717 ("mac-dingbats" . mac-dingbats)) |
1709 font-encoding-alist)) | 1718 font-encoding-alist)) |
1710 | 1719 |
1720 (declare-function set-fontset-font "fontset.c" | |
1721 (name target font-spec &optional frame add)) | |
1722 | |
1711 (defun fontset-add-mac-fonts (fontset &optional base-family) | 1723 (defun fontset-add-mac-fonts (fontset &optional base-family) |
1712 (dolist (elt `((latin . (,(or base-family "Monaco") . "mac-roman")) | 1724 (dolist (elt `((latin . (,(or base-family "Monaco") . "mac-roman")) |
1713 (mac-roman . (,base-family . "mac-roman")) | 1725 (mac-roman . (,base-family . "mac-roman")) |
1714 (mac-centraleurroman . (,base-family . "mac-centraleurroman")) | 1726 (mac-centraleurroman . (,base-family . "mac-centraleurroman")) |
1715 (mac-cyrillic . (,base-family . "mac-cyrillic")) | 1727 (mac-cyrillic . (,base-family . "mac-cyrillic")) |
1716 (mac-symbol . (,base-family . "mac-symbol")) | 1728 (mac-symbol . (,base-family . "mac-symbol")) |
1717 (mac-dingbats . (,base-family . "mac-dingbats")))) | 1729 (mac-dingbats . (,base-family . "mac-dingbats")))) |
1718 (set-fontset-font fontset (car elt) (cdr elt)))) | 1730 (set-fontset-font fontset (car elt) (cdr elt)))) |
1731 | |
1732 (declare-function new-fontset "fontset.c" (name fontlist)) | |
1719 | 1733 |
1720 (defun create-fontset-from-mac-roman-font (font &optional resolved-font | 1734 (defun create-fontset-from-mac-roman-font (font &optional resolved-font |
1721 fontset-name) | 1735 fontset-name) |
1722 "Create a fontset from a Mac roman font FONT. | 1736 "Create a fontset from a Mac roman font FONT. |
1723 | 1737 |
1762 | 1776 |
1763 ;; Change any . or * characters in x-resource-name to hyphens, | 1777 ;; Change any . or * characters in x-resource-name to hyphens, |
1764 ;; so as not to choke when we use it in X resource queries. | 1778 ;; so as not to choke when we use it in X resource queries. |
1765 (while (setq i (string-match "[.*]" x-resource-name)) | 1779 (while (setq i (string-match "[.*]" x-resource-name)) |
1766 (aset x-resource-name i ?-)))) | 1780 (aset x-resource-name i ?-)))) |
1781 | |
1782 (declare-function x-display-list "macfns.c" ()) | |
1783 (declare-function x-open-connection "macfns.c" | |
1784 (display &optional xrm-string must-succeed)) | |
1767 | 1785 |
1768 (if (x-display-list) | 1786 (if (x-display-list) |
1769 ;; On Mac OS 8/9, Most coding systems used in code conversion for | 1787 ;; On Mac OS 8/9, Most coding systems used in code conversion for |
1770 ;; font names are not ready at the time when the terminal frame is | 1788 ;; font names are not ready at the time when the terminal frame is |
1771 ;; created. So we reconstruct font name table for the initial | 1789 ;; created. So we reconstruct font name table for the initial |
1805 (define-key special-event-map [drag-n-drop] 'mac-dnd-handle-drag-n-drop-event) | 1823 (define-key special-event-map [drag-n-drop] 'mac-dnd-handle-drag-n-drop-event) |
1806 | 1824 |
1807 | 1825 |
1808 ;;;; Non-toolkit Scroll bars | 1826 ;;;; Non-toolkit Scroll bars |
1809 | 1827 |
1810 (unless x-toolkit-scroll-bars | 1828 (unless (and (boundp 'x-toolkit-scroll-bars) x-toolkit-scroll-bars) |
1811 | 1829 |
1812 ;; for debugging | 1830 ;; for debugging |
1813 ;; (defun mac-handle-scroll-bar-event (event) (interactive "e") (princ event)) | 1831 ;; (defun mac-handle-scroll-bar-event (event) (interactive "e") (princ event)) |
1814 | 1832 |
1815 ;;(global-set-key [vertical-scroll-bar mouse-1] 'mac-handle-scroll-bar-event) | 1833 ;;(global-set-key [vertical-scroll-bar mouse-1] 'mac-handle-scroll-bar-event) |
1847 "-*-Monaco-*-*-*-*-12-*-*-*-*-*-mac-roman" nil | 1865 "-*-Monaco-*-*-*-*-12-*-*-*-*-*-mac-roman" nil |
1848 "-apple-Monaco-normal-r-*-*-12-*-*-*-*-*-fontset-standard") | 1866 "-apple-Monaco-normal-r-*-*-12-*-*-*-*-*-fontset-standard") |
1849 | 1867 |
1850 ;; Create fontset specified in X resources "Fontset-N" (N is 0, 1, ...). | 1868 ;; Create fontset specified in X resources "Fontset-N" (N is 0, 1, ...). |
1851 (create-fontset-from-x-resource) | 1869 (create-fontset-from-x-resource) |
1870 | |
1871 (declare-function x-get-resource "frame.c" | |
1872 (attribute class &optional component subclass)) | |
1852 | 1873 |
1853 ;; Apply a geometry resource to the initial frame. Put it at the end | 1874 ;; Apply a geometry resource to the initial frame. Put it at the end |
1854 ;; of the alist, so that anything specified on the command line takes | 1875 ;; of the alist, so that anything specified on the command line takes |
1855 ;; precedence. | 1876 ;; precedence. |
1856 (let* ((res-geometry (x-get-resource "geometry" "Geometry")) | 1877 (let* ((res-geometry (x-get-resource "geometry" "Geometry")) |