Merge from trunk
[emacs.git] / lisp / term / common-win.el
blobc13d22dde71aca781e59064bab086e5df65cb5ac
1 ;;; common-win.el --- common part of handling window systems
3 ;; Copyright (C) 1993-1994, 2001-2011 Free Software Foundation, Inc.
5 ;; Maintainer: FSF
6 ;; Keywords: terminals
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software: you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation, either version 3 of the License, or
13 ;; (at your option) any later version.
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
23 ;;; Commentary:
25 ;;; Code:
27 (defcustom x-select-enable-clipboard t
28 "Non-nil means cutting and pasting uses the clipboard.
29 This is in addition to, but in preference to, the primary selection.
31 Note that MS-Windows does not support selection types other than the
32 clipboard. (The primary selection that is set by Emacs is not
33 accessible to other programs on MS-Windows.)
35 This variable is not used by the Nextstep port."
36 :type 'boolean
37 :group 'killing
38 ;; The GNU/Linux version changed in 24.1, the MS-Windows version did not.
39 :version "24.1")
41 (defvar x-last-selected-text) ; w32-fns.el
42 (declare-function w32-set-clipboard-data "w32select.c"
43 (string &optional ignored))
44 (defvar ns-last-selected-text) ; ns-win.el
45 (declare-function ns-set-pasteboard "ns-win" (string))
47 (defun x-select-text (text)
48 "Select TEXT, a string, according to the window system.
50 On X, if `x-select-enable-clipboard' is non-nil, copy TEXT to the
51 clipboard. If `x-select-enable-primary' is non-nil, put TEXT in
52 the primary selection.
54 On MS-Windows, make TEXT the current selection. If
55 `x-select-enable-clipboard' is non-nil, copy the text to the
56 clipboard as well.
58 On Nextstep, put TEXT in the pasteboard (`x-select-enable-clipboard'
59 is not used)."
60 (cond ((eq system-type 'windows-nt)
61 (if x-select-enable-clipboard
62 (w32-set-clipboard-data text))
63 (setq x-last-selected-text text))
64 ((featurep 'ns)
65 ;; Don't send the pasteboard too much text.
66 ;; It becomes slow, and if really big it causes errors.
67 (ns-set-pasteboard text)
68 (setq ns-last-selected-text text))
70 ;; With multi-tty, this function may be called from a tty frame.
71 (when (eq (framep (selected-frame)) 'x)
72 (when x-select-enable-primary
73 (x-set-selection 'PRIMARY text)
74 (setq x-last-selected-text-primary text))
75 (when x-select-enable-clipboard
76 (x-set-selection 'CLIPBOARD text)
77 (setq x-last-selected-text-clipboard text))))))
79 ;;;; Function keys
81 (defvar x-alternatives-map
82 (let ((map (make-sparse-keymap)))
83 ;; Map certain keypad keys into ASCII characters that people usually expect.
84 (define-key map [M-backspace] [?\M-\d])
85 (define-key map [M-delete] [?\M-\d])
86 (define-key map [M-tab] [?\M-\t])
87 (define-key map [M-linefeed] [?\M-\n])
88 (define-key map [M-clear] [?\M-\C-l])
89 (define-key map [M-return] [?\M-\C-m])
90 (define-key map [M-escape] [?\M-\e])
91 (unless (featurep 'ns)
92 (define-key map [iso-lefttab] [backtab])
93 (define-key map [S-iso-lefttab] [backtab]))
94 (and (or (eq system-type 'windows-nt)
95 (featurep 'ns))
96 (define-key map [S-tab] [backtab]))
97 map)
98 "Keymap of possible alternative meanings for some keys.")
100 (defun x-setup-function-keys (frame)
101 "Set up `function-key-map' on the graphical frame FRAME."
102 ;; Don't do this twice on the same display, or it would break
103 ;; normal-erase-is-backspace-mode.
104 (unless (terminal-parameter frame 'x-setup-function-keys)
105 ;; Map certain keypad keys into ASCII characters that people usually expect.
106 (with-selected-frame frame
107 (let ((map (copy-keymap x-alternatives-map)))
108 (set-keymap-parent map (keymap-parent local-function-key-map))
109 (set-keymap-parent local-function-key-map map))
110 (when (featurep 'ns)
111 (setq interprogram-cut-function 'x-select-text
112 interprogram-paste-function 'x-selection-value
113 system-key-alist
114 (list
115 ;; These are special "keys" used to pass events from C to lisp.
116 (cons (logior (lsh 0 16) 1) 'ns-power-off)
117 (cons (logior (lsh 0 16) 2) 'ns-open-file)
118 (cons (logior (lsh 0 16) 3) 'ns-open-temp-file)
119 (cons (logior (lsh 0 16) 4) 'ns-drag-file)
120 (cons (logior (lsh 0 16) 5) 'ns-drag-color)
121 (cons (logior (lsh 0 16) 6) 'ns-drag-text)
122 (cons (logior (lsh 0 16) 7) 'ns-change-font)
123 (cons (logior (lsh 0 16) 8) 'ns-open-file-line)
124 ;;; (cons (logior (lsh 0 16) 9) 'ns-insert-working-text)
125 ;;; (cons (logior (lsh 0 16) 10) 'ns-delete-working-text)
126 (cons (logior (lsh 0 16) 11) 'ns-spi-service-call)
127 (cons (logior (lsh 0 16) 12) 'ns-new-frame)
128 (cons (logior (lsh 0 16) 13) 'ns-toggle-toolbar)
129 (cons (logior (lsh 0 16) 14) 'ns-show-prefs)
130 ))))
131 (set-terminal-parameter frame 'x-setup-function-keys t)))
133 (defvar x-invocation-args)
135 (defvar x-command-line-resources nil)
137 ;; Handler for switches of the form "-switch value" or "-switch".
138 (defun x-handle-switch (switch &optional numeric)
139 (let ((aelt (assoc switch command-line-x-option-alist)))
140 (if aelt
141 (setq default-frame-alist
142 (cons (cons (nth 3 aelt)
143 (if numeric
144 (string-to-number (pop x-invocation-args))
145 (or (nth 4 aelt) (pop x-invocation-args))))
146 default-frame-alist)))))
148 ;; Handler for switches of the form "-switch n"
149 (defun x-handle-numeric-switch (switch)
150 (x-handle-switch switch t))
152 ;; Handle options that apply to initial frame only
153 (defun x-handle-initial-switch (switch)
154 (let ((aelt (assoc switch command-line-x-option-alist)))
155 (if aelt
156 (setq initial-frame-alist
157 (cons (cons (nth 3 aelt)
158 (or (nth 4 aelt) (pop x-invocation-args)))
159 initial-frame-alist)))))
161 ;; Make -iconic apply only to the initial frame!
162 (defun x-handle-iconic (switch)
163 (setq initial-frame-alist
164 (cons '(visibility . icon) initial-frame-alist)))
166 ;; Handle the -xrm option.
167 (defun x-handle-xrm-switch (switch)
168 (unless (consp x-invocation-args)
169 (error "%s: missing argument to `%s' option" (invocation-name) switch))
170 (setq x-command-line-resources
171 (if (null x-command-line-resources)
172 (pop x-invocation-args)
173 (concat x-command-line-resources "\n" (pop x-invocation-args)))))
175 (declare-function x-parse-geometry "frame.c" (string))
177 ;; Handle the geometry option
178 (defun x-handle-geometry (switch)
179 (let* ((geo (x-parse-geometry (pop x-invocation-args)))
180 (left (assq 'left geo))
181 (top (assq 'top geo))
182 (height (assq 'height geo))
183 (width (assq 'width geo)))
184 (if (or height width)
185 (setq default-frame-alist
186 (append default-frame-alist
187 '((user-size . t))
188 (if height (list height))
189 (if width (list width)))
190 initial-frame-alist
191 (append initial-frame-alist
192 '((user-size . t))
193 (if height (list height))
194 (if width (list width)))))
195 (if (or left top)
196 (setq initial-frame-alist
197 (append initial-frame-alist
198 '((user-position . t))
199 (if left (list left))
200 (if top (list top)))))))
202 (defvar x-resource-name)
204 ;; Handle the -name option. Set the variable x-resource-name
205 ;; to the option's operand; set the name of
206 ;; the initial frame, too.
207 (defun x-handle-name-switch (switch)
208 (or (consp x-invocation-args)
209 (error "%s: missing argument to `%s' option" (invocation-name) switch))
210 (setq x-resource-name (pop x-invocation-args)
211 initial-frame-alist (cons (cons 'name x-resource-name)
212 initial-frame-alist)))
214 (defvar x-display-name nil
215 "The name of the window display on which Emacs was started.
216 On X, the display name of individual X frames is recorded in the
217 `display' frame parameter.")
219 (defun x-handle-display (switch)
220 "Handle -display DISPLAY option."
221 (setq x-display-name (pop x-invocation-args))
222 ;; Make subshell programs see the same DISPLAY value Emacs really uses.
223 ;; Note that this isn't completely correct, since Emacs can use
224 ;; multiple displays. However, there is no way to tell an already
225 ;; running subshell which display the user is currently typing on.
226 (setenv "DISPLAY" x-display-name))
228 (defun x-handle-args (args)
229 "Process the X (or Nextstep) related command line options in ARGS.
230 This is done before the user's startup file is loaded.
231 Copies the options in ARGS to `x-invocation-args'. It then extracts
232 the X (or Nextstep) options according to the handlers defined in
233 `command-line-x-option-alist' (or `command-line-ns-option-alist').
234 For example, `x-handle-switch' handles a switch like \"-fg\" and its
235 value \"black\". This function returns ARGS minus the arguments that
236 have been processed."
237 ;; We use ARGS to accumulate the args that we don't handle here, to return.
238 (setq x-invocation-args args ; FIXME let-bind?
239 args nil)
240 (while (and x-invocation-args
241 (not (equal (car x-invocation-args) "--")))
242 (let* ((this-switch (pop x-invocation-args))
243 (orig-this-switch this-switch)
244 (option-alist (if (featurep 'ns)
245 command-line-ns-option-alist
246 command-line-x-option-alist))
247 completion argval aelt handler)
248 ;; Check for long options with attached arguments
249 ;; and separate out the attached option argument into argval.
250 (if (string-match "^--[^=]*=" this-switch)
251 (setq argval (substring this-switch (match-end 0))
252 this-switch (substring this-switch 0 (1- (match-end 0)))))
253 ;; Complete names of long options.
254 (if (string-match "^--" this-switch)
255 (progn
256 (setq completion (try-completion this-switch option-alist))
257 (if (eq completion t)
258 ;; Exact match for long option.
260 (if (stringp completion)
261 (let ((elt (assoc completion option-alist)))
262 ;; Check for abbreviated long option.
263 (or elt
264 (error "Option `%s' is ambiguous" this-switch))
265 (setq this-switch completion))))))
266 (setq aelt (assoc this-switch option-alist))
267 (if aelt (setq handler (nth 2 aelt)))
268 (if handler
269 (if argval
270 (let ((x-invocation-args
271 (cons argval x-invocation-args)))
272 (funcall handler this-switch))
273 (funcall handler this-switch))
274 (setq args (cons orig-this-switch args)))))
275 (nconc (nreverse args) x-invocation-args))
279 ;; Available colors
281 ;; The ordering of the colors is chosen for the user's convenience in
282 ;; `list-colors-display', which displays the reverse of this list.
283 ;; Roughly speaking, `list-colors-display' orders by (i) named shades
284 ;; of grey with hue 0.0, sorted by value (ii) named colors with
285 ;; saturation 1.0, sorted by hue, (iii) named non-white colors with
286 ;; saturation less than 1.0, sorted by hue, (iv) other named shades of
287 ;; white, (v) numbered colors sorted by hue, and (vi) numbered shades
288 ;; of grey.
290 (declare-function ns-list-colors "nsfns.m" (&optional frame))
292 (defvar x-colors
293 (if (featurep 'ns) (ns-list-colors)
294 (purecopy
295 '("gray100" "grey100" "gray99" "grey99" "gray98" "grey98" "gray97"
296 "grey97" "gray96" "grey96" "gray95" "grey95" "gray94" "grey94"
297 "gray93" "grey93" "gray92" "grey92" "gray91" "grey91" "gray90"
298 "grey90" "gray89" "grey89" "gray88" "grey88" "gray87" "grey87"
299 "gray86" "grey86" "gray85" "grey85" "gray84" "grey84" "gray83"
300 "grey83" "gray82" "grey82" "gray81" "grey81" "gray80" "grey80"
301 "gray79" "grey79" "gray78" "grey78" "gray77" "grey77" "gray76"
302 "grey76" "gray75" "grey75" "gray74" "grey74" "gray73" "grey73"
303 "gray72" "grey72" "gray71" "grey71" "gray70" "grey70" "gray69"
304 "grey69" "gray68" "grey68" "gray67" "grey67" "gray66" "grey66"
305 "gray65" "grey65" "gray64" "grey64" "gray63" "grey63" "gray62"
306 "grey62" "gray61" "grey61" "gray60" "grey60" "gray59" "grey59"
307 "gray58" "grey58" "gray57" "grey57" "gray56" "grey56" "gray55"
308 "grey55" "gray54" "grey54" "gray53" "grey53" "gray52" "grey52"
309 "gray51" "grey51" "gray50" "grey50" "gray49" "grey49" "gray48"
310 "grey48" "gray47" "grey47" "gray46" "grey46" "gray45" "grey45"
311 "gray44" "grey44" "gray43" "grey43" "gray42" "grey42" "gray41"
312 "grey41" "gray40" "grey40" "gray39" "grey39" "gray38" "grey38"
313 "gray37" "grey37" "gray36" "grey36" "gray35" "grey35" "gray34"
314 "grey34" "gray33" "grey33" "gray32" "grey32" "gray31" "grey31"
315 "gray30" "grey30" "gray29" "grey29" "gray28" "grey28" "gray27"
316 "grey27" "gray26" "grey26" "gray25" "grey25" "gray24" "grey24"
317 "gray23" "grey23" "gray22" "grey22" "gray21" "grey21" "gray20"
318 "grey20" "gray19" "grey19" "gray18" "grey18" "gray17" "grey17"
319 "gray16" "grey16" "gray15" "grey15" "gray14" "grey14" "gray13"
320 "grey13" "gray12" "grey12" "gray11" "grey11" "gray10" "grey10"
321 "gray9" "grey9" "gray8" "grey8" "gray7" "grey7" "gray6" "grey6"
322 "gray5" "grey5" "gray4" "grey4" "gray3" "grey3" "gray2" "grey2"
323 "gray1" "grey1" "gray0" "grey0"
324 "LightPink1" "LightPink2" "LightPink3" "LightPink4"
325 "pink1" "pink2" "pink3" "pink4"
326 "PaleVioletRed1" "PaleVioletRed2" "PaleVioletRed3" "PaleVioletRed4"
327 "LavenderBlush1" "LavenderBlush2" "LavenderBlush3" "LavenderBlush4"
328 "VioletRed1" "VioletRed2" "VioletRed3" "VioletRed4"
329 "HotPink1" "HotPink2" "HotPink3" "HotPink4"
330 "DeepPink1" "DeepPink2" "DeepPink3" "DeepPink4"
331 "maroon1" "maroon2" "maroon3" "maroon4"
332 "orchid1" "orchid2" "orchid3" "orchid4"
333 "plum1" "plum2" "plum3" "plum4"
334 "thistle1" "thistle2" "thistle3" "thistle4"
335 "MediumOrchid1" "MediumOrchid2" "MediumOrchid3" "MediumOrchid4"
336 "DarkOrchid1" "DarkOrchid2" "DarkOrchid3" "DarkOrchid4"
337 "purple1" "purple2" "purple3" "purple4"
338 "MediumPurple1" "MediumPurple2" "MediumPurple3" "MediumPurple4"
339 "SlateBlue1" "SlateBlue2" "SlateBlue3" "SlateBlue4"
340 "RoyalBlue1" "RoyalBlue2" "RoyalBlue3" "RoyalBlue4"
341 "LightSteelBlue1" "LightSteelBlue2" "LightSteelBlue3" "LightSteelBlue4"
342 "SlateGray1" "SlateGray2" "SlateGray3" "SlateGray4"
343 "DodgerBlue1" "DodgerBlue2" "DodgerBlue3" "DodgerBlue4"
344 "SteelBlue1" "SteelBlue2" "SteelBlue3" "SteelBlue4"
345 "SkyBlue1" "SkyBlue2" "SkyBlue3" "SkyBlue4"
346 "LightSkyBlue1" "LightSkyBlue2" "LightSkyBlue3" "LightSkyBlue4"
347 "LightBlue1" "LightBlue2" "LightBlue3" "LightBlue4"
348 "CadetBlue1" "CadetBlue2" "CadetBlue3" "CadetBlue4"
349 "azure1" "azure2" "azure3" "azure4"
350 "LightCyan1" "LightCyan2" "LightCyan3" "LightCyan4"
351 "PaleTurquoise1" "PaleTurquoise2" "PaleTurquoise3" "PaleTurquoise4"
352 "DarkSlateGray1" "DarkSlateGray2" "DarkSlateGray3" "DarkSlateGray4"
353 "aquamarine1" "aquamarine2" "aquamarine3" "aquamarine4"
354 "SeaGreen1" "SeaGreen2" "SeaGreen3" "SeaGreen4"
355 "honeydew1" "honeydew2" "honeydew3" "honeydew4"
356 "DarkSeaGreen1" "DarkSeaGreen2" "DarkSeaGreen3" "DarkSeaGreen4"
357 "PaleGreen1" "PaleGreen2" "PaleGreen3" "PaleGreen4"
358 "DarkOliveGreen1" "DarkOliveGreen2" "DarkOliveGreen3" "DarkOliveGreen4"
359 "OliveDrab1" "OliveDrab2" "OliveDrab3" "OliveDrab4"
360 "ivory1" "ivory2" "ivory3" "ivory4"
361 "LightYellow1" "LightYellow2" "LightYellow3" "LightYellow4"
362 "khaki1" "khaki2" "khaki3" "khaki4"
363 "LemonChiffon1" "LemonChiffon2" "LemonChiffon3" "LemonChiffon4"
364 "LightGoldenrod1" "LightGoldenrod2" "LightGoldenrod3" "LightGoldenrod4"
365 "cornsilk1" "cornsilk2" "cornsilk3" "cornsilk4"
366 "goldenrod1" "goldenrod2" "goldenrod3" "goldenrod4"
367 "DarkGoldenrod1" "DarkGoldenrod2" "DarkGoldenrod3" "DarkGoldenrod4"
368 "wheat1" "wheat2" "wheat3" "wheat4"
369 "NavajoWhite1" "NavajoWhite2" "NavajoWhite3" "NavajoWhite4"
370 "burlywood1" "burlywood2" "burlywood3" "burlywood4"
371 "AntiqueWhite1" "AntiqueWhite2" "AntiqueWhite3" "AntiqueWhite4"
372 "bisque1" "bisque2" "bisque3" "bisque4"
373 "tan1" "tan2" "tan3" "tan4"
374 "PeachPuff1" "PeachPuff2" "PeachPuff3" "PeachPuff4"
375 "seashell1" "seashell2" "seashell3" "seashell4"
376 "chocolate1" "chocolate2" "chocolate3" "chocolate4"
377 "sienna1" "sienna2" "sienna3" "sienna4"
378 "LightSalmon1" "LightSalmon2" "LightSalmon3" "LightSalmon4"
379 "salmon1" "salmon2" "salmon3" "salmon4"
380 "coral1" "coral2" "coral3" "coral4"
381 "tomato1" "tomato2" "tomato3" "tomato4"
382 "MistyRose1" "MistyRose2" "MistyRose3" "MistyRose4"
383 "snow1" "snow2" "snow3" "snow4"
384 "RosyBrown1" "RosyBrown2" "RosyBrown3" "RosyBrown4"
385 "IndianRed1" "IndianRed2" "IndianRed3" "IndianRed4"
386 "firebrick1" "firebrick2" "firebrick3" "firebrick4"
387 "brown1" "brown2" "brown3" "brown4"
388 "magenta1" "magenta2" "magenta3" "magenta4"
389 "blue1" "blue2" "blue3" "blue4"
390 "DeepSkyBlue1" "DeepSkyBlue2" "DeepSkyBlue3" "DeepSkyBlue4"
391 "turquoise1" "turquoise2" "turquoise3" "turquoise4"
392 "cyan1" "cyan2" "cyan3" "cyan4"
393 "SpringGreen1" "SpringGreen2" "SpringGreen3" "SpringGreen4"
394 "green1" "green2" "green3" "green4"
395 "chartreuse1" "chartreuse2" "chartreuse3" "chartreuse4"
396 "yellow1" "yellow2" "yellow3" "yellow4"
397 "gold1" "gold2" "gold3" "gold4"
398 "orange1" "orange2" "orange3" "orange4"
399 "DarkOrange1" "DarkOrange2" "DarkOrange3" "DarkOrange4"
400 "OrangeRed1" "OrangeRed2" "OrangeRed3" "OrangeRed4"
401 "red1" "red2" "red3" "red4"
402 "lavender blush" "LavenderBlush" "ghost white" "GhostWhite"
403 "lavender" "alice blue" "AliceBlue" "azure" "light cyan"
404 "LightCyan" "mint cream" "MintCream" "honeydew" "ivory"
405 "light goldenrod yellow" "LightGoldenrodYellow" "light yellow"
406 "LightYellow" "beige" "floral white" "FloralWhite" "old lace"
407 "OldLace" "blanched almond" "BlanchedAlmond" "moccasin"
408 "papaya whip" "PapayaWhip" "bisque" "antique white"
409 "AntiqueWhite" "linen" "peach puff" "PeachPuff" "seashell"
410 "misty rose" "MistyRose" "snow" "light pink" "LightPink" "pink"
411 "hot pink" "HotPink" "deep pink" "DeepPink" "maroon"
412 "pale violet red" "PaleVioletRed" "violet red" "VioletRed"
413 "medium violet red" "MediumVioletRed" "violet" "plum" "thistle"
414 "orchid" "medium orchid" "MediumOrchid" "dark orchid"
415 "DarkOrchid" "purple" "blue violet" "BlueViolet" "medium purple"
416 "MediumPurple" "light slate blue" "LightSlateBlue"
417 "medium slate blue" "MediumSlateBlue" "slate blue" "SlateBlue"
418 "dark slate blue" "DarkSlateBlue" "midnight blue" "MidnightBlue"
419 "navy" "navy blue" "NavyBlue" "dark blue" "DarkBlue"
420 "light steel blue" "LightSteelBlue" "cornflower blue"
421 "CornflowerBlue" "dodger blue" "DodgerBlue" "royal blue"
422 "RoyalBlue" "light slate gray" "light slate grey"
423 "LightSlateGray" "LightSlateGrey" "slate gray" "slate grey"
424 "SlateGray" "SlateGrey" "dark slate gray" "dark slate grey"
425 "DarkSlateGray" "DarkSlateGrey" "steel blue" "SteelBlue"
426 "cadet blue" "CadetBlue" "light sky blue" "LightSkyBlue"
427 "sky blue" "SkyBlue" "light blue" "LightBlue" "powder blue"
428 "PowderBlue" "pale turquoise" "PaleTurquoise" "turquoise"
429 "medium turquoise" "MediumTurquoise" "dark turquoise"
430 "DarkTurquoise" "dark cyan" "DarkCyan" "aquamarine"
431 "medium aquamarine" "MediumAquamarine" "light sea green"
432 "LightSeaGreen" "medium sea green" "MediumSeaGreen" "sea green"
433 "SeaGreen" "dark sea green" "DarkSeaGreen" "pale green"
434 "PaleGreen" "lime green" "LimeGreen" "dark green" "DarkGreen"
435 "forest green" "ForestGreen" "light green" "LightGreen"
436 "green yellow" "GreenYellow" "yellow green" "YellowGreen"
437 "olive drab" "OliveDrab" "dark olive green" "DarkOliveGreen"
438 "lemon chiffon" "LemonChiffon" "khaki" "dark khaki" "DarkKhaki"
439 "cornsilk" "pale goldenrod" "PaleGoldenrod" "light goldenrod"
440 "LightGoldenrod" "goldenrod" "dark goldenrod" "DarkGoldenrod"
441 "wheat" "navajo white" "NavajoWhite" "tan" "burlywood"
442 "sandy brown" "SandyBrown" "peru" "chocolate" "saddle brown"
443 "SaddleBrown" "sienna" "rosy brown" "RosyBrown" "dark salmon"
444 "DarkSalmon" "coral" "tomato" "light salmon" "LightSalmon"
445 "salmon" "light coral" "LightCoral" "indian red" "IndianRed"
446 "firebrick" "brown" "dark red" "DarkRed" "magenta"
447 "dark magenta" "DarkMagenta" "dark violet" "DarkViolet"
448 "medium blue" "MediumBlue" "blue" "deep sky blue" "DeepSkyBlue"
449 "cyan" "medium spring green" "MediumSpringGreen" "spring green"
450 "SpringGreen" "green" "lawn green" "LawnGreen" "chartreuse"
451 "yellow" "gold" "orange" "dark orange" "DarkOrange" "orange red"
452 "OrangeRed" "red" "white" "white smoke" "WhiteSmoke" "gainsboro"
453 "light gray" "light grey" "LightGray" "LightGrey" "gray" "grey"
454 "dark gray" "dark grey" "DarkGray" "DarkGrey" "dim gray"
455 "dim grey" "DimGray" "DimGrey" "black")))
456 "List of basic colors available on color displays.
457 For X, the list comes from the `rgb.txt' file,v 10.41 94/02/20.
458 For Nextstep, this is a list of non-PANTONE colors returned by
459 the operating system.")
461 (defvar w32-color-map)
463 (defun xw-defined-colors (&optional frame)
464 "Internal function called by `defined-colors', which see."
465 (if (featurep 'ns)
466 x-colors
467 (or frame (setq frame (selected-frame)))
468 (let (defined-colors)
469 (dolist (this-color (if (eq system-type 'windows-nt)
470 (or (mapcar 'car w32-color-map) x-colors)
471 x-colors))
472 (and (color-supported-p this-color frame t)
473 (setq defined-colors (cons this-color defined-colors))))
474 defined-colors)))
476 ;;; common-win.el ends here