(number, original-date, add-to-diary-list)
[emacs.git] / lisp / term / w32-win.el
blob62fd6edd9190ae732c0e603fc937b72d9c88be36
1 ;;; w32-win.el --- parse switches controlling interface with W32 window system
3 ;; Copyright (C) 1993, 1994, 2001, 2002, 2003, 2004,
4 ;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
6 ;; Author: Kevin Gallo
7 ;; Keywords: terminals
9 ;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 3, or (at your option)
14 ;; any later version.
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 ;; Boston, MA 02110-1301, USA.
26 ;;; Commentary:
28 ;; w32-win.el: this file is loaded from ../lisp/startup.el when it recognizes
29 ;; that W32 windows are to be used. Command line switches are parsed and those
30 ;; pertaining to W32 are processed and removed from the command line. The
31 ;; W32 display is opened and hooks are set for popping up the initial window.
33 ;; startup.el will then examine startup files, and eventually call the hooks
34 ;; which create the first window (s).
36 ;;; Code:
39 ;; These are the standard X switches from the Xt Initialize.c file of
40 ;; Release 4.
42 ;; Command line Resource Manager string
44 ;; +rv *reverseVideo
45 ;; +synchronous *synchronous
46 ;; -background *background
47 ;; -bd *borderColor
48 ;; -bg *background
49 ;; -bordercolor *borderColor
50 ;; -borderwidth .borderWidth
51 ;; -bw .borderWidth
52 ;; -display .display
53 ;; -fg *foreground
54 ;; -fn *font
55 ;; -font *font
56 ;; -foreground *foreground
57 ;; -geometry .geometry
58 ;; -i .iconType
59 ;; -itype .iconType
60 ;; -iconic .iconic
61 ;; -name .name
62 ;; -reverse *reverseVideo
63 ;; -rv *reverseVideo
64 ;; -selectionTimeout .selectionTimeout
65 ;; -synchronous *synchronous
66 ;; -xrm
68 ;; An alist of X options and the function which handles them. See
69 ;; ../startup.el.
71 ;; (if (not (eq window-system 'w32))
72 ;; (error "%s: Loading w32-win.el but not compiled for w32" (invocation-name)))
74 (require 'frame)
75 (require 'mouse)
76 (require 'scroll-bar)
77 (require 'faces)
78 (require 'select)
79 (require 'menu-bar)
80 (require 'dnd)
81 (require 'w32-vars)
83 ;; Keep an obsolete alias for w32-focus-frame in case it is used by code
84 ;; outside Emacs.
85 (define-obsolete-function-alias 'w32-focus-frame 'x-focus-frame "23.1")
87 (defvar xlfd-regexp-registry-subnum)
88 (defvar w32-color-map) ;; defined in w32fns.c
90 (declare-function w32-send-sys-command "w32fns.c")
91 (declare-function w32-select-font "w32fns.c")
92 (declare-function set-message-beep "w32console.c")
94 ;; Conditional on new-fontset so bootstrapping works on non-GUI compiles
95 (if (fboundp 'new-fontset)
96 (require 'fontset))
98 ;; The following definition is used for debugging scroll bar events.
99 ;(defun w32-handle-scroll-bar-event (event) (interactive "e") (princ event))
101 (defun w32-drag-n-drop-debug (event)
102 "Print the drag-n-drop EVENT in a readable form."
103 (interactive "e")
104 (princ event))
106 (defun w32-drag-n-drop (event)
107 "Edit the files listed in the drag-n-drop EVENT.
108 Switch to a buffer editing the last file dropped."
109 (interactive "e")
110 (save-excursion
111 ;; Make sure the drop target has positive co-ords
112 ;; before setting the selected frame - otherwise it
113 ;; won't work. <skx@tardis.ed.ac.uk>
114 (let* ((window (posn-window (event-start event)))
115 (coords (posn-x-y (event-start event)))
116 (x (car coords))
117 (y (cdr coords)))
118 (if (and (> x 0) (> y 0))
119 (set-frame-selected-window nil window))
120 (mapc (lambda (file-name)
121 (let ((f (subst-char-in-string ?\\ ?/ file-name))
122 (coding (or file-name-coding-system
123 default-file-name-coding-system)))
124 (setq file-name
125 (mapconcat 'url-hexify-string
126 (split-string (encode-coding-string f coding)
127 "/")
128 "/")))
129 (dnd-handle-one-url window 'private
130 (concat "file:" file-name)))
131 (car (cdr (cdr event)))))
132 (raise-frame)))
134 (defun w32-drag-n-drop-other-frame (event)
135 "Edit the files listed in the drag-n-drop EVENT, in other frames.
136 May create new frames, or reuse existing ones. The frame editing
137 the last file dropped is selected."
138 (interactive "e")
139 (mapcar 'find-file-other-frame (car (cdr (cdr event)))))
141 ;; Bind the drag-n-drop event.
142 (global-set-key [drag-n-drop] 'w32-drag-n-drop)
143 (global-set-key [C-drag-n-drop] 'w32-drag-n-drop-other-frame)
145 ;; Keyboard layout/language change events
146 ;; For now ignore language-change events; in the future
147 ;; we should switch the Emacs Input Method to match the
148 ;; new layout/language selected by the user.
149 (global-set-key [language-change] 'ignore)
151 (defvar x-invocation-args)
153 (defvar x-command-line-resources nil)
155 (defun x-handle-switch (switch)
156 "Handle SWITCH of the form \"-switch value\" or \"-switch\"."
157 (let ((aelt (assoc switch command-line-x-option-alist)))
158 (if aelt
159 (push (cons (nth 3 aelt) (or (nth 4 aelt) (pop x-invocation-args)))
160 default-frame-alist))))
162 (defun x-handle-numeric-switch (switch)
163 "Handle SWITCH of the form \"-switch n\"."
164 (let ((aelt (assoc switch command-line-x-option-alist)))
165 (if aelt
166 (push (cons (nth 3 aelt) (string-to-number (pop x-invocation-args)))
167 default-frame-alist))))
169 ;; Handle options that apply to initial frame only
170 (defun x-handle-initial-switch (switch)
171 (let ((aelt (assoc switch command-line-x-option-alist)))
172 (if aelt
173 (push (cons (nth 3 aelt) (or (nth 4 aelt) (pop x-invocation-args)))
174 initial-frame-alist))))
176 (defun x-handle-iconic (switch)
177 "Make \"-iconic\" SWITCH apply only to the initial frame."
178 (push '(visibility . icon) initial-frame-alist))
180 (defun x-handle-xrm-switch (switch)
181 "Handle the \"-xrm\" SWITCH."
182 (or (consp x-invocation-args)
183 (error "%s: missing argument to `%s' option" (invocation-name) switch))
184 (setq x-command-line-resources
185 (if (null x-command-line-resources)
186 (car x-invocation-args)
187 (concat x-command-line-resources "\n" (car x-invocation-args))))
188 (setq x-invocation-args (cdr x-invocation-args)))
190 (defun x-handle-geometry (switch)
191 "Handle the \"-geometry\" SWITCH."
192 (let* ((geo (x-parse-geometry (car x-invocation-args)))
193 (left (assq 'left geo))
194 (top (assq 'top geo))
195 (height (assq 'height geo))
196 (width (assq 'width geo)))
197 (if (or height width)
198 (setq default-frame-alist
199 (append default-frame-alist
200 '((user-size . t))
201 (if height (list height))
202 (if width (list width)))
203 initial-frame-alist
204 (append initial-frame-alist
205 '((user-size . t))
206 (if height (list height))
207 (if width (list width)))))
208 (if (or left top)
209 (setq initial-frame-alist
210 (append initial-frame-alist
211 '((user-position . t))
212 (if left (list left))
213 (if top (list top)))))
214 (setq x-invocation-args (cdr x-invocation-args))))
216 (defun x-handle-name-switch (switch)
217 "Handle the \"-name\" SWITCH."
218 ;; Handle the -name option. Set the variable x-resource-name
219 ;; to the option's operand; set the name of the initial frame, too.
220 (or (consp x-invocation-args)
221 (error "%s: missing argument to `%s' option" (invocation-name) switch))
222 (setq x-resource-name (pop x-invocation-args))
223 (push (cons 'name x-resource-name) initial-frame-alist))
225 (defvar x-display-name nil
226 "The display name specifying server and frame.")
228 (defun x-handle-display (switch)
229 "Handle the \"-display\" SWITCH."
230 (setq x-display-name (pop x-invocation-args)))
232 (defun x-handle-args (args)
233 "Process the X-related command line options in ARGS.
234 This is done before the user's startup file is loaded. They are copied to
235 `x-invocation args' from which the X-related things are extracted, first
236 the switch (e.g., \"-fg\") in the following code, and possible values
237 \(e.g., \"black\") in the option handler code (e.g., x-handle-switch).
238 This returns ARGS with the arguments that have been processed removed."
239 ;; We use ARGS to accumulate the args that we don't handle here, to return.
240 (setq x-invocation-args args
241 args nil)
242 (while (and x-invocation-args
243 (not (equal (car x-invocation-args) "--")))
244 (let* ((this-switch (car x-invocation-args))
245 (orig-this-switch this-switch)
246 completion argval aelt handler)
247 (setq x-invocation-args (cdr x-invocation-args))
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 command-line-x-option-alist))
257 (if (eq completion t)
258 ;; Exact match for long option.
260 (if (stringp completion)
261 (let ((elt (assoc completion command-line-x-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 command-line-x-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 (push orig-this-switch args))))
275 (nconc (nreverse args) x-invocation-args))
278 ;; Available colors
281 (defvar x-colors '("LightGreen"
282 "light green"
283 "DarkRed"
284 "dark red"
285 "DarkMagenta"
286 "dark magenta"
287 "DarkCyan"
288 "dark cyan"
289 "DarkBlue"
290 "dark blue"
291 "DarkGray"
292 "dark gray"
293 "DarkGrey"
294 "dark grey"
295 "grey100"
296 "gray100"
297 "grey99"
298 "gray99"
299 "grey98"
300 "gray98"
301 "grey97"
302 "gray97"
303 "grey96"
304 "gray96"
305 "grey95"
306 "gray95"
307 "grey94"
308 "gray94"
309 "grey93"
310 "gray93"
311 "grey92"
312 "gray92"
313 "grey91"
314 "gray91"
315 "grey90"
316 "gray90"
317 "grey89"
318 "gray89"
319 "grey88"
320 "gray88"
321 "grey87"
322 "gray87"
323 "grey86"
324 "gray86"
325 "grey85"
326 "gray85"
327 "grey84"
328 "gray84"
329 "grey83"
330 "gray83"
331 "grey82"
332 "gray82"
333 "grey81"
334 "gray81"
335 "grey80"
336 "gray80"
337 "grey79"
338 "gray79"
339 "grey78"
340 "gray78"
341 "grey77"
342 "gray77"
343 "grey76"
344 "gray76"
345 "grey75"
346 "gray75"
347 "grey74"
348 "gray74"
349 "grey73"
350 "gray73"
351 "grey72"
352 "gray72"
353 "grey71"
354 "gray71"
355 "grey70"
356 "gray70"
357 "grey69"
358 "gray69"
359 "grey68"
360 "gray68"
361 "grey67"
362 "gray67"
363 "grey66"
364 "gray66"
365 "grey65"
366 "gray65"
367 "grey64"
368 "gray64"
369 "grey63"
370 "gray63"
371 "grey62"
372 "gray62"
373 "grey61"
374 "gray61"
375 "grey60"
376 "gray60"
377 "grey59"
378 "gray59"
379 "grey58"
380 "gray58"
381 "grey57"
382 "gray57"
383 "grey56"
384 "gray56"
385 "grey55"
386 "gray55"
387 "grey54"
388 "gray54"
389 "grey53"
390 "gray53"
391 "grey52"
392 "gray52"
393 "grey51"
394 "gray51"
395 "grey50"
396 "gray50"
397 "grey49"
398 "gray49"
399 "grey48"
400 "gray48"
401 "grey47"
402 "gray47"
403 "grey46"
404 "gray46"
405 "grey45"
406 "gray45"
407 "grey44"
408 "gray44"
409 "grey43"
410 "gray43"
411 "grey42"
412 "gray42"
413 "grey41"
414 "gray41"
415 "grey40"
416 "gray40"
417 "grey39"
418 "gray39"
419 "grey38"
420 "gray38"
421 "grey37"
422 "gray37"
423 "grey36"
424 "gray36"
425 "grey35"
426 "gray35"
427 "grey34"
428 "gray34"
429 "grey33"
430 "gray33"
431 "grey32"
432 "gray32"
433 "grey31"
434 "gray31"
435 "grey30"
436 "gray30"
437 "grey29"
438 "gray29"
439 "grey28"
440 "gray28"
441 "grey27"
442 "gray27"
443 "grey26"
444 "gray26"
445 "grey25"
446 "gray25"
447 "grey24"
448 "gray24"
449 "grey23"
450 "gray23"
451 "grey22"
452 "gray22"
453 "grey21"
454 "gray21"
455 "grey20"
456 "gray20"
457 "grey19"
458 "gray19"
459 "grey18"
460 "gray18"
461 "grey17"
462 "gray17"
463 "grey16"
464 "gray16"
465 "grey15"
466 "gray15"
467 "grey14"
468 "gray14"
469 "grey13"
470 "gray13"
471 "grey12"
472 "gray12"
473 "grey11"
474 "gray11"
475 "grey10"
476 "gray10"
477 "grey9"
478 "gray9"
479 "grey8"
480 "gray8"
481 "grey7"
482 "gray7"
483 "grey6"
484 "gray6"
485 "grey5"
486 "gray5"
487 "grey4"
488 "gray4"
489 "grey3"
490 "gray3"
491 "grey2"
492 "gray2"
493 "grey1"
494 "gray1"
495 "grey0"
496 "gray0"
497 "thistle4"
498 "thistle3"
499 "thistle2"
500 "thistle1"
501 "MediumPurple4"
502 "MediumPurple3"
503 "MediumPurple2"
504 "MediumPurple1"
505 "purple4"
506 "purple3"
507 "purple2"
508 "purple1"
509 "DarkOrchid4"
510 "DarkOrchid3"
511 "DarkOrchid2"
512 "DarkOrchid1"
513 "MediumOrchid4"
514 "MediumOrchid3"
515 "MediumOrchid2"
516 "MediumOrchid1"
517 "plum4"
518 "plum3"
519 "plum2"
520 "plum1"
521 "orchid4"
522 "orchid3"
523 "orchid2"
524 "orchid1"
525 "magenta4"
526 "magenta3"
527 "magenta2"
528 "magenta1"
529 "VioletRed4"
530 "VioletRed3"
531 "VioletRed2"
532 "VioletRed1"
533 "maroon4"
534 "maroon3"
535 "maroon2"
536 "maroon1"
537 "PaleVioletRed4"
538 "PaleVioletRed3"
539 "PaleVioletRed2"
540 "PaleVioletRed1"
541 "LightPink4"
542 "LightPink3"
543 "LightPink2"
544 "LightPink1"
545 "pink4"
546 "pink3"
547 "pink2"
548 "pink1"
549 "HotPink4"
550 "HotPink3"
551 "HotPink2"
552 "HotPink1"
553 "DeepPink4"
554 "DeepPink3"
555 "DeepPink2"
556 "DeepPink1"
557 "red4"
558 "red3"
559 "red2"
560 "red1"
561 "OrangeRed4"
562 "OrangeRed3"
563 "OrangeRed2"
564 "OrangeRed1"
565 "tomato4"
566 "tomato3"
567 "tomato2"
568 "tomato1"
569 "coral4"
570 "coral3"
571 "coral2"
572 "coral1"
573 "DarkOrange4"
574 "DarkOrange3"
575 "DarkOrange2"
576 "DarkOrange1"
577 "orange4"
578 "orange3"
579 "orange2"
580 "orange1"
581 "LightSalmon4"
582 "LightSalmon3"
583 "LightSalmon2"
584 "LightSalmon1"
585 "salmon4"
586 "salmon3"
587 "salmon2"
588 "salmon1"
589 "brown4"
590 "brown3"
591 "brown2"
592 "brown1"
593 "firebrick4"
594 "firebrick3"
595 "firebrick2"
596 "firebrick1"
597 "chocolate4"
598 "chocolate3"
599 "chocolate2"
600 "chocolate1"
601 "tan4"
602 "tan3"
603 "tan2"
604 "tan1"
605 "wheat4"
606 "wheat3"
607 "wheat2"
608 "wheat1"
609 "burlywood4"
610 "burlywood3"
611 "burlywood2"
612 "burlywood1"
613 "sienna4"
614 "sienna3"
615 "sienna2"
616 "sienna1"
617 "IndianRed4"
618 "IndianRed3"
619 "IndianRed2"
620 "IndianRed1"
621 "RosyBrown4"
622 "RosyBrown3"
623 "RosyBrown2"
624 "RosyBrown1"
625 "DarkGoldenrod4"
626 "DarkGoldenrod3"
627 "DarkGoldenrod2"
628 "DarkGoldenrod1"
629 "goldenrod4"
630 "goldenrod3"
631 "goldenrod2"
632 "goldenrod1"
633 "gold4"
634 "gold3"
635 "gold2"
636 "gold1"
637 "yellow4"
638 "yellow3"
639 "yellow2"
640 "yellow1"
641 "LightYellow4"
642 "LightYellow3"
643 "LightYellow2"
644 "LightYellow1"
645 "LightGoldenrod4"
646 "LightGoldenrod3"
647 "LightGoldenrod2"
648 "LightGoldenrod1"
649 "khaki4"
650 "khaki3"
651 "khaki2"
652 "khaki1"
653 "DarkOliveGreen4"
654 "DarkOliveGreen3"
655 "DarkOliveGreen2"
656 "DarkOliveGreen1"
657 "OliveDrab4"
658 "OliveDrab3"
659 "OliveDrab2"
660 "OliveDrab1"
661 "chartreuse4"
662 "chartreuse3"
663 "chartreuse2"
664 "chartreuse1"
665 "green4"
666 "green3"
667 "green2"
668 "green1"
669 "SpringGreen4"
670 "SpringGreen3"
671 "SpringGreen2"
672 "SpringGreen1"
673 "PaleGreen4"
674 "PaleGreen3"
675 "PaleGreen2"
676 "PaleGreen1"
677 "SeaGreen4"
678 "SeaGreen3"
679 "SeaGreen2"
680 "SeaGreen1"
681 "DarkSeaGreen4"
682 "DarkSeaGreen3"
683 "DarkSeaGreen2"
684 "DarkSeaGreen1"
685 "aquamarine4"
686 "aquamarine3"
687 "aquamarine2"
688 "aquamarine1"
689 "DarkSlateGray4"
690 "DarkSlateGray3"
691 "DarkSlateGray2"
692 "DarkSlateGray1"
693 "cyan4"
694 "cyan3"
695 "cyan2"
696 "cyan1"
697 "turquoise4"
698 "turquoise3"
699 "turquoise2"
700 "turquoise1"
701 "CadetBlue4"
702 "CadetBlue3"
703 "CadetBlue2"
704 "CadetBlue1"
705 "PaleTurquoise4"
706 "PaleTurquoise3"
707 "PaleTurquoise2"
708 "PaleTurquoise1"
709 "LightCyan4"
710 "LightCyan3"
711 "LightCyan2"
712 "LightCyan1"
713 "LightBlue4"
714 "LightBlue3"
715 "LightBlue2"
716 "LightBlue1"
717 "LightSteelBlue4"
718 "LightSteelBlue3"
719 "LightSteelBlue2"
720 "LightSteelBlue1"
721 "SlateGray4"
722 "SlateGray3"
723 "SlateGray2"
724 "SlateGray1"
725 "LightSkyBlue4"
726 "LightSkyBlue3"
727 "LightSkyBlue2"
728 "LightSkyBlue1"
729 "SkyBlue4"
730 "SkyBlue3"
731 "SkyBlue2"
732 "SkyBlue1"
733 "DeepSkyBlue4"
734 "DeepSkyBlue3"
735 "DeepSkyBlue2"
736 "DeepSkyBlue1"
737 "SteelBlue4"
738 "SteelBlue3"
739 "SteelBlue2"
740 "SteelBlue1"
741 "DodgerBlue4"
742 "DodgerBlue3"
743 "DodgerBlue2"
744 "DodgerBlue1"
745 "blue4"
746 "blue3"
747 "blue2"
748 "blue1"
749 "RoyalBlue4"
750 "RoyalBlue3"
751 "RoyalBlue2"
752 "RoyalBlue1"
753 "SlateBlue4"
754 "SlateBlue3"
755 "SlateBlue2"
756 "SlateBlue1"
757 "azure4"
758 "azure3"
759 "azure2"
760 "azure1"
761 "MistyRose4"
762 "MistyRose3"
763 "MistyRose2"
764 "MistyRose1"
765 "LavenderBlush4"
766 "LavenderBlush3"
767 "LavenderBlush2"
768 "LavenderBlush1"
769 "honeydew4"
770 "honeydew3"
771 "honeydew2"
772 "honeydew1"
773 "ivory4"
774 "ivory3"
775 "ivory2"
776 "ivory1"
777 "cornsilk4"
778 "cornsilk3"
779 "cornsilk2"
780 "cornsilk1"
781 "LemonChiffon4"
782 "LemonChiffon3"
783 "LemonChiffon2"
784 "LemonChiffon1"
785 "NavajoWhite4"
786 "NavajoWhite3"
787 "NavajoWhite2"
788 "NavajoWhite1"
789 "PeachPuff4"
790 "PeachPuff3"
791 "PeachPuff2"
792 "PeachPuff1"
793 "bisque4"
794 "bisque3"
795 "bisque2"
796 "bisque1"
797 "AntiqueWhite4"
798 "AntiqueWhite3"
799 "AntiqueWhite2"
800 "AntiqueWhite1"
801 "seashell4"
802 "seashell3"
803 "seashell2"
804 "seashell1"
805 "snow4"
806 "snow3"
807 "snow2"
808 "snow1"
809 "thistle"
810 "MediumPurple"
811 "medium purple"
812 "purple"
813 "BlueViolet"
814 "blue violet"
815 "DarkViolet"
816 "dark violet"
817 "DarkOrchid"
818 "dark orchid"
819 "MediumOrchid"
820 "medium orchid"
821 "orchid"
822 "plum"
823 "violet"
824 "magenta"
825 "VioletRed"
826 "violet red"
827 "MediumVioletRed"
828 "medium violet red"
829 "maroon"
830 "PaleVioletRed"
831 "pale violet red"
832 "LightPink"
833 "light pink"
834 "pink"
835 "DeepPink"
836 "deep pink"
837 "HotPink"
838 "hot pink"
839 "red"
840 "OrangeRed"
841 "orange red"
842 "tomato"
843 "LightCoral"
844 "light coral"
845 "coral"
846 "DarkOrange"
847 "dark orange"
848 "orange"
849 "LightSalmon"
850 "light salmon"
851 "salmon"
852 "DarkSalmon"
853 "dark salmon"
854 "brown"
855 "firebrick"
856 "chocolate"
857 "tan"
858 "SandyBrown"
859 "sandy brown"
860 "wheat"
861 "beige"
862 "burlywood"
863 "peru"
864 "sienna"
865 "SaddleBrown"
866 "saddle brown"
867 "IndianRed"
868 "indian red"
869 "RosyBrown"
870 "rosy brown"
871 "DarkGoldenrod"
872 "dark goldenrod"
873 "goldenrod"
874 "LightGoldenrod"
875 "light goldenrod"
876 "gold"
877 "yellow"
878 "LightYellow"
879 "light yellow"
880 "LightGoldenrodYellow"
881 "light goldenrod yellow"
882 "PaleGoldenrod"
883 "pale goldenrod"
884 "khaki"
885 "DarkKhaki"
886 "dark khaki"
887 "OliveDrab"
888 "olive drab"
889 "ForestGreen"
890 "forest green"
891 "YellowGreen"
892 "yellow green"
893 "LimeGreen"
894 "lime green"
895 "GreenYellow"
896 "green yellow"
897 "MediumSpringGreen"
898 "medium spring green"
899 "chartreuse"
900 "green"
901 "LawnGreen"
902 "lawn green"
903 "SpringGreen"
904 "spring green"
905 "PaleGreen"
906 "pale green"
907 "LightSeaGreen"
908 "light sea green"
909 "MediumSeaGreen"
910 "medium sea green"
911 "SeaGreen"
912 "sea green"
913 "DarkSeaGreen"
914 "dark sea green"
915 "DarkOliveGreen"
916 "dark olive green"
917 "DarkGreen"
918 "dark green"
919 "aquamarine"
920 "MediumAquamarine"
921 "medium aquamarine"
922 "CadetBlue"
923 "cadet blue"
924 "LightCyan"
925 "light cyan"
926 "cyan"
927 "turquoise"
928 "MediumTurquoise"
929 "medium turquoise"
930 "DarkTurquoise"
931 "dark turquoise"
932 "PaleTurquoise"
933 "pale turquoise"
934 "PowderBlue"
935 "powder blue"
936 "LightBlue"
937 "light blue"
938 "LightSteelBlue"
939 "light steel blue"
940 "SteelBlue"
941 "steel blue"
942 "LightSkyBlue"
943 "light sky blue"
944 "SkyBlue"
945 "sky blue"
946 "DeepSkyBlue"
947 "deep sky blue"
948 "DodgerBlue"
949 "dodger blue"
950 "blue"
951 "RoyalBlue"
952 "royal blue"
953 "MediumBlue"
954 "medium blue"
955 "LightSlateBlue"
956 "light slate blue"
957 "MediumSlateBlue"
958 "medium slate blue"
959 "SlateBlue"
960 "slate blue"
961 "DarkSlateBlue"
962 "dark slate blue"
963 "CornflowerBlue"
964 "cornflower blue"
965 "NavyBlue"
966 "navy blue"
967 "navy"
968 "MidnightBlue"
969 "midnight blue"
970 "LightGray"
971 "light gray"
972 "LightGrey"
973 "light grey"
974 "grey"
975 "gray"
976 "LightSlateGrey"
977 "light slate grey"
978 "LightSlateGray"
979 "light slate gray"
980 "SlateGrey"
981 "slate grey"
982 "SlateGray"
983 "slate gray"
984 "DimGrey"
985 "dim grey"
986 "DimGray"
987 "dim gray"
988 "DarkSlateGrey"
989 "dark slate grey"
990 "DarkSlateGray"
991 "dark slate gray"
992 "black"
993 "white"
994 "MistyRose"
995 "misty rose"
996 "LavenderBlush"
997 "lavender blush"
998 "lavender"
999 "AliceBlue"
1000 "alice blue"
1001 "azure"
1002 "MintCream"
1003 "mint cream"
1004 "honeydew"
1005 "seashell"
1006 "LemonChiffon"
1007 "lemon chiffon"
1008 "ivory"
1009 "cornsilk"
1010 "moccasin"
1011 "NavajoWhite"
1012 "navajo white"
1013 "PeachPuff"
1014 "peach puff"
1015 "bisque"
1016 "BlanchedAlmond"
1017 "blanched almond"
1018 "PapayaWhip"
1019 "papaya whip"
1020 "AntiqueWhite"
1021 "antique white"
1022 "linen"
1023 "OldLace"
1024 "old lace"
1025 "FloralWhite"
1026 "floral white"
1027 "gainsboro"
1028 "WhiteSmoke"
1029 "white smoke"
1030 "GhostWhite"
1031 "ghost white"
1032 "snow")
1033 "The list of X colors from the `rgb.txt' file.
1034 XConsortium: rgb.txt,v 10.41 94/02/20 18:39:36 rws Exp")
1036 (defun xw-defined-colors (&optional frame)
1037 "Internal function called by `defined-colors', which see."
1038 (or frame (setq frame (selected-frame)))
1039 (let ((defined-colors nil))
1040 (dolist (this-color (or (mapcar 'car w32-color-map) x-colors))
1041 (and (color-supported-p this-color frame t)
1042 (push this-color defined-colors)))
1043 defined-colors))
1046 ;;;; Function keys
1048 ;;; make f10 activate the real menubar rather than the mini-buffer menu
1049 ;;; navigation feature.
1050 (defun menu-bar-open (&optional frame)
1051 "Start key navigation of the menu bar in FRAME.
1053 This initially activates the first menu-bar item, and you can then navigate
1054 with the arrow keys, select a menu entry with the Return key or cancel with
1055 the Escape key. If FRAME has no menu bar, this function does nothing.
1057 If FRAME is nil or not given, use the selected frame."
1058 (interactive "i")
1059 (w32-send-sys-command ?\xf100 frame))
1062 ;; W32 systems have different fonts than commonly found on X, so
1063 ;; we define our own standard fontset here.
1064 (defvar w32-standard-fontset-spec
1065 "-*-Courier New-normal-r-*-*-13-*-*-*-c-*-fontset-standard"
1066 "String of fontset spec of the standard fontset.
1067 This defines a fontset consisting of the Courier New variations for
1068 European languages which are distributed with Windows as
1069 \"Multilanguage Support\".
1071 See the documentation of `create-fontset-from-fontset-spec' for the format.")
1073 (defun x-win-suspend-error ()
1074 "Report an error when a suspend is attempted."
1075 (error "Suspending an Emacs running under W32 makes no sense"))
1078 (defun mouse-set-font (&rest fonts)
1079 "Select an Emacs font from a list of known good fonts and fontsets.
1081 If `w32-use-w32-font-dialog' is non-nil (the default), use the Windows
1082 font dialog to display the list of possible fonts. Otherwise use a
1083 pop-up menu (like Emacs does on other platforms) initialized with
1084 the fonts in `w32-fixed-font-alist'.
1085 If `w32-list-proportional-fonts' is non-nil, add proportional fonts
1086 to the list in the font selection dialog (the fonts listed by the
1087 pop-up menu are unaffected by `w32-list-proportional-fonts')."
1088 (interactive
1089 (if w32-use-w32-font-dialog
1090 (let ((chosen-font (w32-select-font (selected-frame)
1091 w32-list-proportional-fonts)))
1092 (and chosen-font (list chosen-font)))
1093 (x-popup-menu
1094 last-nonmenu-event
1095 ;; Append list of fontsets currently defined.
1096 ;; Conditional on new-fontset so bootstrapping works on non-GUI compiles
1097 (if (fboundp 'new-fontset)
1098 (append w32-fixed-font-alist (list (generate-fontset-menu)))))))
1099 (if fonts
1100 (let (font)
1101 (while fonts
1102 (condition-case nil
1103 (progn
1104 (setq font (car fonts))
1105 (set-default-font font)
1106 (setq fonts nil))
1107 (error (setq fonts (cdr fonts)))))
1108 (if (null font)
1109 (error "Font not found")))))
1111 ;;; Set default known names for image libraries
1112 (setq image-library-alist
1113 '((xpm "libxpm.dll" "xpm4.dll" "libXpm-nox4.dll")
1114 (png "libpng12d.dll" "libpng12.dll" "libpng.dll"
1115 ;; these are libpng 1.2.8 from GTK+
1116 "libpng13d.dll" "libpng13.dll")
1117 (jpeg "jpeg62.dll" "libjpeg.dll" "jpeg-62.dll" "jpeg.dll")
1118 (tiff "libtiff3.dll" "libtiff.dll")
1119 (gif "giflib4.dll" "libungif4.dll" "libungif.dll")
1120 (svg "librsvg-2-2.dll")
1121 (gdk-pixbuf "libgdk_pixbuf-2.0-0.dll")
1122 (glib "libglib-2.0-0.dll")))
1124 ;;; multi-tty support
1125 (defvar w32-initialized nil
1126 "Non-nil if the w32 window system has been initialized.")
1128 (defun w32-initialize-window-system ()
1129 "Initialize Emacs for W32 GUI frames."
1131 ;; Do the actual Windows setup here; the above code just defines
1132 ;; functions and variables that we use now.
1134 (setq command-line-args (x-handle-args command-line-args))
1136 ;; Make sure we have a valid resource name.
1137 (or (stringp x-resource-name)
1138 (setq x-resource-name
1139 ;; Change any . or * characters in x-resource-name to hyphens,
1140 ;; so as not to choke when we use it in X resource queries.
1141 (replace-regexp-in-string "[.*]" "-" (invocation-name))))
1143 (x-open-connection "" x-command-line-resources
1144 ;; Exit with a fatal error if this fails and we
1145 ;; are the initial display
1146 (eq initial-window-system 'w32))
1148 ;; Setup the default fontset.
1149 (setup-default-fontset)
1151 ;; Enable Japanese fonts on Windows to be used by default.
1152 (set-fontset-font t (make-char 'katakana-jisx0201)
1153 '("*" . "JISX0208-SJIS"))
1154 (set-fontset-font t (make-char 'latin-jisx0201)
1155 '("*" . "JISX0208-SJIS"))
1156 (set-fontset-font t (make-char 'japanese-jisx0208)
1157 '("*" . "JISX0208-SJIS"))
1158 (set-fontset-font t (make-char 'japanese-jisx0208-1978)
1159 '("*" . "JISX0208-SJIS"))
1161 ;; Create the standard fontset.
1162 (create-fontset-from-fontset-spec w32-standard-fontset-spec t)
1163 ;; Create fontset specified in X resources "Fontset-N" (N is 0, 1,...).
1164 (create-fontset-from-x-resource)
1166 ;; Apply a geometry resource to the initial frame. Put it at the end
1167 ;; of the alist, so that anything specified on the command line takes
1168 ;; precedence.
1169 (let* ((res-geometry (x-get-resource "geometry" "Geometry"))
1170 parsed)
1171 (if res-geometry
1172 (progn
1173 (setq parsed (x-parse-geometry res-geometry))
1174 ;; If the resource specifies a position,
1175 ;; call the position and size "user-specified".
1176 (if (or (assq 'top parsed) (assq 'left parsed))
1177 (setq parsed (cons '(user-position . t)
1178 (cons '(user-size . t) parsed))))
1179 ;; All geometry parms apply to the initial frame.
1180 (setq initial-frame-alist (append initial-frame-alist parsed))
1181 ;; The size parms apply to all frames.
1182 (if (assq 'height parsed)
1183 (push (cons 'height (cdr (assq 'height parsed)))
1184 default-frame-alist))
1185 (if (assq 'width parsed)
1186 (push (cons 'width (cdr (assq 'width parsed)))
1187 default-frame-alist)))))
1189 ;; Check the reverseVideo resource.
1190 (let ((case-fold-search t))
1191 (let ((rv (x-get-resource "reverseVideo" "ReverseVideo")))
1192 (if (and rv (string-match "^\\(true\\|yes\\|on\\)$" rv))
1193 (push '(reverse . t) default-frame-alist))))
1195 ;; Don't let Emacs suspend under w32 gui
1196 (add-hook 'suspend-hook 'x-win-suspend-error)
1198 ;; Turn off window-splitting optimization; w32 is usually fast enough
1199 ;; that this is only annoying.
1200 (setq split-window-keep-point t)
1202 ;; Turn on support for mouse wheels
1203 (mouse-wheel-mode 1)
1205 ;; W32 expects the menu bar cut and paste commands to use the clipboard.
1206 (menu-bar-enable-clipboard)
1208 ;; Don't show the frame name; that's redundant.
1209 (setq-default mode-line-frame-identification " ")
1211 ;; Set to a system sound if you want a fancy bell.
1212 (set-message-beep 'ok)
1213 (setq w32-initialized t))
1215 (add-to-list 'handle-args-function-alist '(w32 . x-handle-args))
1216 (add-to-list 'frame-creation-function-alist '(w32 . x-create-frame-with-faces))
1217 (add-to-list 'window-system-initialization-alist '(w32 . w32-initialize-window-system))
1219 (provide 'w32-win)
1221 ;; arch-tag: 69fb1701-28c2-4890-b351-3d1fe4b4f166
1222 ;;; w32-win.el ends here