1 ;;; x-win.el --- parse relevant switches and set up for X -*-coding: iso-2022-7bit;-*-
3 ;; Copyright (C) 1993, 1994, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
4 ;; 2008 Free Software Foundation, Inc.
7 ;; Keywords: terminals, i18n
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 of the License, or
14 ;; (at your option) 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. If not, see <http://www.gnu.org/licenses/>.
26 ;; X-win.el: this file defines functions to initialize the X window
27 ;; system and process X-specific command line parameters before
28 ;; creating the first X frame.
30 ;; Note that contrary to previous Emacs versions, the act of loading
31 ;; this file should not have the side effect of initializing the
32 ;; window system or processing command line arguments (this file is
33 ;; now loaded in loadup.el). See the variables
34 ;; `handle-args-function-alist' and
35 ;; `window-system-initialization-alist' for more details.
37 ;; startup.el will then examine startup files, and eventually call the hooks
38 ;; which create the first window(s).
42 ;; These are the standard X switches from the Xt Initialize.c file of
45 ;; Command line Resource Manager string
48 ;; +synchronous *synchronous
49 ;; -background *background
52 ;; -bordercolor *borderColor
53 ;; -borderwidth .borderWidth
59 ;; -foreground *foreground
60 ;; -geometry .geometry
63 ;; -reverse *reverseVideo
65 ;; -selectionTimeout .selectionTimeout
66 ;; -synchronous *synchronous
69 ;; An alist of X options and the function which handles them. See
72 (if (not (fboundp 'x-create-frame))
73 (error "%s: Loading x-win.el but not compiled for X" (invocation-name)))
84 (defvar x-invocation-args)
85 (defvar x-keysym-table)
86 (defvar x-selection-timeout)
88 (defvar x-session-previous-id)
90 (defvar x-command-line-resources nil)
92 ;; Handler for switches of the form "-switch value" or "-switch".
93 (defun x-handle-switch (switch)
94 (let ((aelt (assoc switch command-line-x-option-alist)))
96 (let ((param (nth 3 aelt))
99 (setq default-frame-alist
100 (cons (cons param value)
101 default-frame-alist))
102 (setq default-frame-alist
104 (car x-invocation-args))
106 x-invocation-args (cdr x-invocation-args)))))))
108 ;; Handler for switches of the form "-switch n"
109 (defun x-handle-numeric-switch (switch)
110 (let ((aelt (assoc switch command-line-x-option-alist)))
112 (let ((param (nth 3 aelt)))
113 (setq default-frame-alist
115 (string-to-number (car x-invocation-args)))
118 (cdr x-invocation-args))))))
120 ;; Handle options that apply to initial frame only
121 (defun x-handle-initial-switch (switch)
122 (let ((aelt (assoc switch command-line-x-option-alist)))
124 (let ((param (nth 3 aelt))
125 (value (nth 4 aelt)))
127 (setq initial-frame-alist
128 (cons (cons param value)
129 initial-frame-alist))
130 (setq initial-frame-alist
132 (car x-invocation-args))
134 x-invocation-args (cdr x-invocation-args)))))))
136 (defun x-handle-no-bitmap-icon (switch)
137 (setq default-frame-alist (cons '(icon-type) default-frame-alist)))
139 ;; Make -iconic apply only to the initial frame!
140 (defun x-handle-iconic (switch)
141 (setq initial-frame-alist
142 (cons '(visibility . icon) initial-frame-alist)))
144 ;; Handle the -xrm option.
145 (defun x-handle-xrm-switch (switch)
146 (unless (consp x-invocation-args)
147 (error "%s: missing argument to `%s' option" (invocation-name) switch))
148 (setq x-command-line-resources
149 (if (null x-command-line-resources)
150 (car x-invocation-args)
151 (concat x-command-line-resources "\n" (car x-invocation-args))))
152 (setq x-invocation-args (cdr x-invocation-args)))
154 (declare-function x-parse-geometry "frame.c" (string))
156 ;; Handle the geometry option
157 (defun x-handle-geometry (switch)
158 (let* ((geo (x-parse-geometry (car x-invocation-args)))
159 (left (assq 'left geo))
160 (top (assq 'top geo))
161 (height (assq 'height geo))
162 (width (assq 'width geo)))
163 (if (or height width)
164 (setq default-frame-alist
165 (append default-frame-alist
167 (if height (list height))
168 (if width (list width)))
170 (append initial-frame-alist
172 (if height (list height))
173 (if width (list width)))))
175 (setq initial-frame-alist
176 (append initial-frame-alist
177 '((user-position . t))
178 (if left (list left))
179 (if top (list top)))))
180 (setq x-invocation-args (cdr x-invocation-args))))
182 (defvar x-resource-name)
184 ;; Handle the -name option. Set the variable x-resource-name
185 ;; to the option's operand; set the name of
186 ;; the initial frame, too.
187 (defun x-handle-name-switch (switch)
188 (or (consp x-invocation-args)
189 (error "%s: missing argument to `%s' option" (invocation-name) switch))
190 (setq x-resource-name (car x-invocation-args)
191 x-invocation-args (cdr x-invocation-args))
192 (setq initial-frame-alist (cons (cons 'name x-resource-name)
193 initial-frame-alist)))
195 ;; Handle the --parent-id option.
196 (defun x-handle-parent-id (switch)
197 (or (consp x-invocation-args)
198 (error "%s: missing argument to `%s' option" (invocation-name) switch))
199 (setq initial-frame-alist (cons
201 (string-to-number (car x-invocation-args)))
203 x-invocation-args (cdr x-invocation-args)))
205 (defvar x-display-name nil
206 "The name of the X display on which Emacs was started.
208 For the X display name of individual frames, see the `display'
211 (defun x-handle-display (switch)
212 "Handle -display DISPLAY option."
213 (setq x-display-name (car x-invocation-args)
214 x-invocation-args (cdr x-invocation-args))
215 ;; Make subshell programs see the same DISPLAY value Emacs really uses.
216 ;; Note that this isn't completely correct, since Emacs can use
217 ;; multiple displays. However, there is no way to tell an already
218 ;; running subshell which display the user is currently typing on.
219 (setenv "DISPLAY" x-display-name))
221 (defun x-handle-args (args)
222 "Process the X-related command line options in ARGS.
223 This is done before the user's startup file is loaded. They are copied to
224 `x-invocation-args', from which the X-related things are extracted, first
225 the switch (e.g., \"-fg\") in the following code, and possible values
226 \(e.g., \"black\") in the option handler code (e.g., x-handle-switch).
227 This function returns ARGS minus the arguments that have been processed."
228 ;; We use ARGS to accumulate the args that we don't handle here, to return.
229 (setq x-invocation-args args
231 (while (and x-invocation-args
232 (not (equal (car x-invocation-args) "--")))
233 (let* ((this-switch (car x-invocation-args))
234 (orig-this-switch this-switch)
235 completion argval aelt handler)
236 (setq x-invocation-args (cdr x-invocation-args))
237 ;; Check for long options with attached arguments
238 ;; and separate out the attached option argument into argval.
239 (if (string-match "^--[^=]*=" this-switch)
240 (setq argval (substring this-switch (match-end 0))
241 this-switch (substring this-switch 0 (1- (match-end 0)))))
242 ;; Complete names of long options.
243 (if (string-match "^--" this-switch)
245 (setq completion (try-completion this-switch command-line-x-option-alist))
246 (if (eq completion t)
247 ;; Exact match for long option.
249 (if (stringp completion)
250 (let ((elt (assoc completion command-line-x-option-alist)))
251 ;; Check for abbreviated long option.
253 (error "Option `%s' is ambiguous" this-switch))
254 (setq this-switch completion))))))
255 (setq aelt (assoc this-switch command-line-x-option-alist))
256 (if aelt (setq handler (nth 2 aelt)))
259 (let ((x-invocation-args
260 (cons argval x-invocation-args)))
261 (funcall handler this-switch))
262 (funcall handler this-switch))
263 (setq args (cons orig-this-switch args)))))
264 (nconc (nreverse args) x-invocation-args))
266 ;; Handle the --smid switch. This is used by the session manager
267 ;; to give us back our session id we had on the previous run.
268 (defun x-handle-smid (switch)
269 (or (consp x-invocation-args)
270 (error "%s: missing argument to `%s' option" (invocation-name) switch))
271 (setq x-session-previous-id (car x-invocation-args)
272 x-invocation-args (cdr x-invocation-args)))
274 (defvar emacs-save-session-functions nil
275 "Special hook run when a save-session event occurs.
276 The functions do not get any argument.
277 Functions can return non-nil to inform the session manager that the
278 window system shutdown should be aborted.
280 See also `emacs-session-save'.")
282 (defun emacs-session-filename (session-id)
283 "Construct a filename to save the session in based on SESSION-ID.
284 If the directory ~/.emacs.d exists, we make a filename in there, otherwise
285 a file in the home directory."
286 (let ((basename (concat "session." session-id))
287 (emacs-dir user-emacs-directory))
288 (expand-file-name (if (file-directory-p emacs-dir)
289 (concat emacs-dir basename)
290 (concat "~/.emacs-" basename)))))
292 (defun emacs-session-save ()
293 "This function is called when the window system is shutting down.
294 If this function returns non-nil, the window system shutdown is cancelled.
296 When a session manager tells Emacs that the window system is shutting
297 down, this function is called. It calls the functions in the hook
298 `emacs-save-session-functions'. Functions are called with the current
299 buffer set to a temporary buffer. Functions should use `insert' to insert
300 lisp code to save the session state. The buffer is saved
301 in a file in the home directory of the user running Emacs. The file
302 is evaluated when Emacs is restarted by the session manager.
304 If any of the functions returns non-nil, no more functions are called
305 and this function returns non-nil. This will inform the session manager
306 that it should abort the window system shutdown."
307 (let ((filename (emacs-session-filename x-session-id))
308 (buf (get-buffer-create (concat " *SES " x-session-id))))
309 (when (file-exists-p filename)
310 (delete-file filename))
311 (with-current-buffer buf
312 (let ((cancel-shutdown (condition-case nil
313 ;; A return of t means cancel the shutdown.
314 (run-hook-with-args-until-success
315 'emacs-save-session-functions)
317 (unless cancel-shutdown
318 (write-file filename))
322 (defun emacs-session-restore (previous-session-id)
323 "Restore the Emacs session if started by a session manager.
324 The file saved by `emacs-session-save' is evaluated and deleted if it
326 (let ((filename (emacs-session-filename previous-session-id)))
327 (when (file-exists-p filename)
329 (delete-file filename)
330 (message "Restored session data"))))
336 ;; Standard X cursor shapes, courtesy of Mr. Fox, who wanted ALL of them.
339 (defconst x-pointer-X-cursor 0)
340 (defconst x-pointer-arrow 2)
341 (defconst x-pointer-based-arrow-down 4)
342 (defconst x-pointer-based-arrow-up 6)
343 (defconst x-pointer-boat 8)
344 (defconst x-pointer-bogosity 10)
345 (defconst x-pointer-bottom-left-corner 12)
346 (defconst x-pointer-bottom-right-corner 14)
347 (defconst x-pointer-bottom-side 16)
348 (defconst x-pointer-bottom-tee 18)
349 (defconst x-pointer-box-spiral 20)
350 (defconst x-pointer-center-ptr 22)
351 (defconst x-pointer-circle 24)
352 (defconst x-pointer-clock 26)
353 (defconst x-pointer-coffee-mug 28)
354 (defconst x-pointer-cross 30)
355 (defconst x-pointer-cross-reverse 32)
356 (defconst x-pointer-crosshair 34)
357 (defconst x-pointer-diamond-cross 36)
358 (defconst x-pointer-dot 38)
359 (defconst x-pointer-dotbox 40)
360 (defconst x-pointer-double-arrow 42)
361 (defconst x-pointer-draft-large 44)
362 (defconst x-pointer-draft-small 46)
363 (defconst x-pointer-draped-box 48)
364 (defconst x-pointer-exchange 50)
365 (defconst x-pointer-fleur 52)
366 (defconst x-pointer-gobbler 54)
367 (defconst x-pointer-gumby 56)
368 (defconst x-pointer-hand1 58)
369 (defconst x-pointer-hand2 60)
370 (defconst x-pointer-heart 62)
371 (defconst x-pointer-icon 64)
372 (defconst x-pointer-iron-cross 66)
373 (defconst x-pointer-left-ptr 68)
374 (defconst x-pointer-left-side 70)
375 (defconst x-pointer-left-tee 72)
376 (defconst x-pointer-leftbutton 74)
377 (defconst x-pointer-ll-angle 76)
378 (defconst x-pointer-lr-angle 78)
379 (defconst x-pointer-man 80)
380 (defconst x-pointer-middlebutton 82)
381 (defconst x-pointer-mouse 84)
382 (defconst x-pointer-pencil 86)
383 (defconst x-pointer-pirate 88)
384 (defconst x-pointer-plus 90)
385 (defconst x-pointer-question-arrow 92)
386 (defconst x-pointer-right-ptr 94)
387 (defconst x-pointer-right-side 96)
388 (defconst x-pointer-right-tee 98)
389 (defconst x-pointer-rightbutton 100)
390 (defconst x-pointer-rtl-logo 102)
391 (defconst x-pointer-sailboat 104)
392 (defconst x-pointer-sb-down-arrow 106)
393 (defconst x-pointer-sb-h-double-arrow 108)
394 (defconst x-pointer-sb-left-arrow 110)
395 (defconst x-pointer-sb-right-arrow 112)
396 (defconst x-pointer-sb-up-arrow 114)
397 (defconst x-pointer-sb-v-double-arrow 116)
398 (defconst x-pointer-shuttle 118)
399 (defconst x-pointer-sizing 120)
400 (defconst x-pointer-spider 122)
401 (defconst x-pointer-spraycan 124)
402 (defconst x-pointer-star 126)
403 (defconst x-pointer-target 128)
404 (defconst x-pointer-tcross 130)
405 (defconst x-pointer-top-left-arrow 132)
406 (defconst x-pointer-top-left-corner 134)
407 (defconst x-pointer-top-right-corner 136)
408 (defconst x-pointer-top-side 138)
409 (defconst x-pointer-top-tee 140)
410 (defconst x-pointer-trek 142)
411 (defconst x-pointer-ul-angle 144)
412 (defconst x-pointer-umbrella 146)
413 (defconst x-pointer-ur-angle 148)
414 (defconst x-pointer-watch 150)
415 (defconst x-pointer-xterm 152)
416 (defconst x-pointer-invisible 255)
421 ;; The ordering of the colors is chosen for the user's convenience in
422 ;; `list-colors-display', which displays the reverse of this list.
423 ;; Roughly speaking, `list-colors-display' orders by (i) named shades
424 ;; of grey with hue 0.0, sorted by value (ii) named colors with
425 ;; saturation 1.0, sorted by hue, (iii) named non-white colors with
426 ;; saturation less than 1.0, sorted by hue, (iv) other named shades of
427 ;; white, (v) numbered colors sorted by hue, and (vi) numbered shades
431 '("gray100" "gray99" "gray98" "gray97" "gray96" "gray95" "gray94" "gray93" "gray92"
432 "gray91" "gray90" "gray89" "gray88" "gray87" "gray86" "gray85" "gray84" "gray83"
433 "gray82" "gray81" "gray80" "gray79" "gray78" "gray77" "gray76" "gray75" "gray74"
434 "gray73" "gray72" "gray71" "gray70" "gray69" "gray68" "gray67" "gray66" "gray65"
435 "gray64" "gray63" "gray62" "gray61" "gray60" "gray59" "gray58" "gray57" "gray56"
436 "gray55" "gray54" "gray53" "gray52" "gray51" "gray50" "gray49" "gray48" "gray47"
437 "gray46" "gray45" "gray44" "gray43" "gray42" "gray41" "gray40" "gray39" "gray38"
438 "gray37" "gray36" "gray35" "gray34" "gray33" "gray32" "gray31" "gray30" "gray29"
439 "gray28" "gray27" "gray26" "gray25" "gray24" "gray23" "gray22" "gray21" "gray20"
440 "gray19" "gray18" "gray17" "gray16" "gray15" "gray14" "gray13" "gray12" "gray11"
441 "gray10" "gray9" "gray8" "gray7" "gray6" "gray5" "gray4" "gray3" "gray2" "gray1"
442 "gray0" "LightPink1" "LightPink2" "LightPink3" "LightPink4" "pink1" "pink2" "pink3"
443 "pink4" "PaleVioletRed1" "PaleVioletRed2" "PaleVioletRed3" "PaleVioletRed4"
444 "LavenderBlush1" "LavenderBlush2" "LavenderBlush3" "LavenderBlush4" "VioletRed1"
445 "VioletRed2" "VioletRed3" "VioletRed4" "HotPink1" "HotPink2" "HotPink3" "HotPink4"
446 "DeepPink1" "DeepPink2" "DeepPink3" "DeepPink4" "maroon1" "maroon2" "maroon3"
447 "maroon4" "orchid1" "orchid2" "orchid3" "orchid4" "plum1" "plum2" "plum3" "plum4"
448 "thistle1" "thistle2" "thistle3" "thistle4" "MediumOrchid1" "MediumOrchid2"
449 "MediumOrchid3" "MediumOrchid4" "DarkOrchid1" "DarkOrchid2" "DarkOrchid3"
450 "DarkOrchid4" "purple1" "purple2" "purple3" "purple4" "MediumPurple1"
451 "MediumPurple2" "MediumPurple3" "MediumPurple4" "SlateBlue1" "SlateBlue2"
452 "SlateBlue3" "SlateBlue4" "RoyalBlue1" "RoyalBlue2" "RoyalBlue3" "RoyalBlue4"
453 "LightSteelBlue1" "LightSteelBlue2" "LightSteelBlue3" "LightSteelBlue4" "SlateGray1"
454 "SlateGray2" "SlateGray3" "SlateGray4" "DodgerBlue1" "DodgerBlue2" "DodgerBlue3"
455 "DodgerBlue4" "SteelBlue1" "SteelBlue2" "SteelBlue3" "SteelBlue4" "SkyBlue1"
456 "SkyBlue2" "SkyBlue3" "SkyBlue4" "LightSkyBlue1" "LightSkyBlue2" "LightSkyBlue3"
457 "LightSkyBlue4" "LightBlue1" "LightBlue2" "LightBlue3" "LightBlue4" "CadetBlue1"
458 "CadetBlue2" "CadetBlue3" "CadetBlue4" "azure1" "azure2" "azure3" "azure4"
459 "LightCyan1" "LightCyan2" "LightCyan3" "LightCyan4" "PaleTurquoise1"
460 "PaleTurquoise2" "PaleTurquoise3" "PaleTurquoise4" "DarkSlateGray1" "DarkSlateGray2"
461 "DarkSlateGray3" "DarkSlateGray4" "aquamarine1" "aquamarine2" "aquamarine3"
462 "aquamarine4" "SeaGreen1" "SeaGreen2" "SeaGreen3" "SeaGreen4" "honeydew1"
463 "honeydew2" "honeydew3" "honeydew4" "DarkSeaGreen1" "DarkSeaGreen2" "DarkSeaGreen3"
464 "DarkSeaGreen4" "PaleGreen1" "PaleGreen2" "PaleGreen3" "PaleGreen4"
465 "DarkOliveGreen1" "DarkOliveGreen2" "DarkOliveGreen3" "DarkOliveGreen4" "OliveDrab1"
466 "OliveDrab2" "OliveDrab3" "OliveDrab4" "ivory1" "ivory2" "ivory3" "ivory4"
467 "LightYellow1" "LightYellow2" "LightYellow3" "LightYellow4" "khaki1" "khaki2"
468 "khaki3" "khaki4" "LemonChiffon1" "LemonChiffon2" "LemonChiffon3" "LemonChiffon4"
469 "LightGoldenrod1" "LightGoldenrod2" "LightGoldenrod3" "LightGoldenrod4" "cornsilk1"
470 "cornsilk2" "cornsilk3" "cornsilk4" "goldenrod1" "goldenrod2" "goldenrod3"
471 "goldenrod4" "DarkGoldenrod1" "DarkGoldenrod2" "DarkGoldenrod3" "DarkGoldenrod4"
472 "wheat1" "wheat2" "wheat3" "wheat4" "NavajoWhite1" "NavajoWhite2" "NavajoWhite3"
473 "NavajoWhite4" "burlywood1" "burlywood2" "burlywood3" "burlywood4" "AntiqueWhite1"
474 "AntiqueWhite2" "AntiqueWhite3" "AntiqueWhite4" "bisque1" "bisque2" "bisque3"
475 "bisque4" "tan1" "tan2" "tan3" "tan4" "PeachPuff1" "PeachPuff2" "PeachPuff3"
476 "PeachPuff4" "seashell1" "seashell2" "seashell3" "seashell4" "chocolate1"
477 "chocolate2" "chocolate3" "chocolate4" "sienna1" "sienna2" "sienna3" "sienna4"
478 "LightSalmon1" "LightSalmon2" "LightSalmon3" "LightSalmon4" "salmon1" "salmon2"
479 "salmon3" "salmon4" "coral1" "coral2" "coral3" "coral4" "tomato1" "tomato2"
480 "tomato3" "tomato4" "MistyRose1" "MistyRose2" "MistyRose3" "MistyRose4" "snow1"
481 "snow2" "snow3" "snow4" "RosyBrown1" "RosyBrown2" "RosyBrown3" "RosyBrown4"
482 "IndianRed1" "IndianRed2" "IndianRed3" "IndianRed4" "firebrick1" "firebrick2"
483 "firebrick3" "firebrick4" "brown1" "brown2" "brown3" "brown4" "magenta1" "magenta2"
484 "magenta3" "magenta4" "blue1" "blue2" "blue3" "blue4" "DeepSkyBlue1" "DeepSkyBlue2"
485 "DeepSkyBlue3" "DeepSkyBlue4" "turquoise1" "turquoise2" "turquoise3" "turquoise4"
486 "cyan1" "cyan2" "cyan3" "cyan4" "SpringGreen1" "SpringGreen2" "SpringGreen3"
487 "SpringGreen4" "green1" "green2" "green3" "green4" "chartreuse1" "chartreuse2"
488 "chartreuse3" "chartreuse4" "yellow1" "yellow2" "yellow3" "yellow4" "gold1" "gold2"
489 "gold3" "gold4" "orange1" "orange2" "orange3" "orange4" "DarkOrange1" "DarkOrange2"
490 "DarkOrange3" "DarkOrange4" "OrangeRed1" "OrangeRed2" "OrangeRed3" "OrangeRed4"
491 "red1" "red2" "red3" "red4" "lavender blush" "ghost white" "lavender" "alice blue"
492 "azure" "light cyan" "mint cream" "honeydew" "ivory" "light goldenrod yellow"
493 "light yellow" "beige" "floral white" "old lace" "blanched almond" "moccasin"
494 "papaya whip" "bisque" "antique white" "linen" "peach puff" "seashell" "misty rose"
495 "snow" "light pink" "pink" "hot pink" "deep pink" "maroon" "pale violet red"
496 "violet red" "medium violet red" "violet" "plum" "thistle" "orchid" "medium orchid"
497 "dark orchid" "purple" "blue violet" "medium purple" "light slate blue"
498 "medium slate blue" "slate blue" "dark slate blue" "midnight blue" "navy"
499 "dark blue" "light steel blue" "cornflower blue" "dodger blue" "royal blue"
500 "light slate gray" "slate gray" "dark slate gray" "steel blue" "cadet blue"
501 "light sky blue" "sky blue" "light blue" "powder blue" "pale turquoise" "turquoise"
502 "medium turquoise" "dark cyan" "aquamarine" "medium aquamarine" "light sea green"
503 "medium sea green" "sea green" "dark sea green" "pale green" "lime green"
504 "forest green" "light green" "green yellow" "yellow green" "olive drab"
505 "dark olive green" "lemon chiffon" "khaki" "dark khaki" "cornsilk"
506 "pale goldenrod" "light goldenrod" "goldenrod" "dark goldenrod" "wheat"
507 "navajo white" "tan" "burlywood" "sandy brown" "peru" "chocolate" "saddle brown"
508 "sienna" "rosy brown" "dark salmon" "coral" "tomato" "light salmon" "salmon"
509 "light coral" "indian red" "firebrick" "brown" "dark red" "magenta"
510 "dark magenta" "dark violet" "medium blue" "blue" "deep sky blue"
511 "cyan" "medium spring green" "spring green" "green" "lawn green" "chartreuse"
512 "yellow" "gold" "orange" "dark orange" "orange red" "red" "white" "white smoke"
513 "gainsboro" "light grey" "gray" "dark grey" "dim gray" "black" )
514 "The list of X colors from the `rgb.txt' file.
515 XConsortium: rgb.txt,v 10.41 94/02/20 18:39:36 rws Exp")
517 (defun xw-defined-colors (&optional frame)
518 "Internal function called by `defined-colors', which see."
519 (or frame (setq frame (selected-frame)))
520 (let ((all-colors x-colors)
522 (defined-colors nil))
524 (setq this-color (car all-colors)
525 all-colors (cdr all-colors))
526 (and (color-supported-p this-color frame t)
527 (setq defined-colors (cons this-color defined-colors))))
532 (defvar x-alternatives-map
533 (let ((map (make-sparse-keymap)))
534 ;; Map certain keypad keys into ASCII characters that people usually expect.
535 (define-key map [backspace] [127])
536 (define-key map [delete] [127])
537 (define-key map [tab] [?\t])
538 (define-key map [linefeed] [?\n])
539 (define-key map [clear] [?\C-l])
540 (define-key map [return] [?\C-m])
541 (define-key map [escape] [?\e])
542 (define-key map [M-backspace] [?\M-\d])
543 (define-key map [M-delete] [?\M-\d])
544 (define-key map [M-tab] [?\M-\t])
545 (define-key map [M-linefeed] [?\M-\n])
546 (define-key map [M-clear] [?\M-\C-l])
547 (define-key map [M-return] [?\M-\C-m])
548 (define-key map [M-escape] [?\M-\e])
549 (define-key map [iso-lefttab] [backtab])
550 (define-key map [S-iso-lefttab] [backtab])
552 "Keymap of possible alternative meanings for some keys.")
554 (defun x-setup-function-keys (frame)
555 "Set up `function-key-map' on FRAME for the X window system."
556 ;; Don't do this twice on the same display, or it would break
557 ;; normal-erase-is-backspace-mode.
558 (unless (terminal-parameter frame 'x-setup-function-keys)
559 ;; Map certain keypad keys into ASCII characters that people usually expect.
560 (with-selected-frame frame
561 (let ((map (copy-keymap x-alternatives-map)))
562 (set-keymap-parent map (keymap-parent local-function-key-map))
563 (set-keymap-parent local-function-key-map map)))
564 (set-terminal-parameter frame 'x-setup-function-keys t)))
566 ;; These tell read-char how to convert
567 ;; these special chars to ASCII.
568 (put 'backspace 'ascii-character 127)
569 (put 'delete 'ascii-character 127)
570 (put 'tab 'ascii-character ?\t)
571 (put 'linefeed 'ascii-character ?\n)
572 (put 'clear 'ascii-character 12)
573 (put 'return 'ascii-character 13)
574 (put 'escape 'ascii-character ?\e)
579 (defun vendor-specific-keysyms (vendor)
580 "Return the appropriate value of `system-key-alist' for VENDOR.
581 VENDOR is a string containing the name of the X Server's vendor,
582 as returned by `x-server-vendor'."
583 (cond ((or (string-equal vendor "Hewlett-Packard Incorporated")
584 (string-equal vendor "Hewlett-Packard Company"))
585 '(( 168 . mute-acute)
587 ( 170 . mute-asciicircum)
588 ( 171 . mute-diaeresis)
589 ( 172 . mute-asciitilde)
603 (65397 . kp-backtab)))
604 ;; Fixme: What about non-X11/NeWS sun server?
605 ((or (string-equal vendor "X11/NeWS - Sun Microsystems Inc.")
606 (string-equal vendor "X Consortium"))
610 ;; These are for Sun under X11R6
618 ;; This is used by DEC's X server.
619 '((65280 . remove)))))
624 (puthash i i x-keysym-table)
627 ;; Table from Kuhn's proposed additions to the `KEYSYM Encoding'
628 ;; appendix to the X protocol definition.
689 (#x1ff . ?
\e,B
\7f\e(B)
749 ;; Kana: Fixme: needs conversion to Japanese charset -- seems
750 ;; to require jisx0213, for which the Unicode translation
753 (#x4a1 . ?
\e$A!#
\e(B)
754 (#x4a2 . ?\
\e$A!8
\e(B)
755 (#x4a3 . ?\
\e$A!9
\e(B)
756 (#x4a4 . ?
\e$A!"
\e(B)
757 (#x4a5 . ?
\e$A!$
\e(B)
758 (#x4a6 . ?
\e$A%r
\e(B)
759 (#x4a7 . ?
\e$A%!
\e(B)
760 (#x4a8 . ?
\e$A%#
\e(B)
761 (#x4a9 . ?
\e$A%%
\e(B)
762 (#x4aa . ?
\e$A%'
\e(B)
763 (#x4ab . ?
\e$A%)
\e(B)
764 (#x4ac . ?
\e$A%c
\e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B)
805 (#x4d5 . ?
\e$A%f
\e(B)
806 (#x4d6 . ?
\e$A%h
\e(B)
807 (#x4d7 . ?
\e$A%i
\e(B)
808 (#x4d8 . ?
\e$A%j
\e(B)
809 (#x4d9 . ?
\e$A%k
\e(B)
810 (#x4da . ?
\e$A%l
\e(B)
811 (#x4db . ?
\e$A%m
\e(B)
812 (#x4dc . ?
\e$A%o
\e(B)
813 (#x4dd . ?
\e$A%s
\e(B)
814 (#x4de . ?
\e$B!+
\e(B)
815 (#x4df . ?
\e$B!,
\e(B)
866 (#x680 . ?
\e$,1)R
\e(B)
867 (#x681 . ?
\e$,1)V
\e(B)
868 (#x682 . ?
\e$,1)Z
\e(B)
869 (#x683 . ?
\e$,1)\
\e(B)
870 (#x684 . ?
\e$,1)b
\e(B)
871 (#x685 . ?
\e$,1)n
\e(B)
872 (#x686 . ?
\e$,1)p
\e(B)
873 (#x687 . ?
\e$,1)r
\e(B)
874 (#x688 . ?
\e$,1)v
\e(B)
875 (#x689 . ?
\e$,1)x
\e(B)
876 (#x68a . ?
\e$,1)z
\e(B)
877 (#x68c . ?
\e$,1*8
\e(B)
878 (#x68d . ?
\e$,1*B
\e(B)
879 (#x68e . ?
\e$,1*H
\e(B)
880 (#x68f . ?
\e$,1*N
\e(B)
881 (#x690 . ?
\e$,1)S
\e(B)
882 (#x691 . ?
\e$,1)W
\e(B)
883 (#x692 . ?
\e$,1)[
\e(B)
884 (#x693 . ?
\e$,1)]
\e(B)
885 (#x694 . ?
\e$,1)c
\e(B)
886 (#x695 . ?
\e$,1)o
\e(B)
887 (#x696 . ?
\e$,1)q
\e(B)
888 (#x697 . ?
\e$,1)s
\e(B)
889 (#x698 . ?
\e$,1)w
\e(B)
890 (#x699 . ?
\e$,1)y
\e(B)
891 (#x69a . ?
\e$,1){
\e(B)
892 (#x69c . ?
\e$,1*9
\e(B)
893 (#x69d . ?
\e$,1*C
\e(B)
894 (#x69e . ?
\e$,1*I
\e(B)
895 (#x69f . ?
\e$,1*O
\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}
\e(B)
1156 (#xac6 . ?
\e$(C(~
\e(B)
1157 (#xac9 . ?
\e$(D"o
\e(B)
1158 (#xaca . ?
\e$,2"s
\e(B)
1159 (#xacc . ?
\e$(O##
\e(B)
1160 (#xacd . ?
\e$(O#!
\e(B)
1161 (#xace . ?
\e$A!p
\e(B)
1162 (#xacf . ?
\e$,2!o
\e(B)
1163 (#xad0 . ?
\e,F!
\e(B)
1164 (#xad1 . ?
\e,F"
\e(B)
1165 (#xad2 . ?
\e,Y4
\e(B)
1166 (#xad3 . ?
\e,Y!
\e(B)
1167 (#xad4 . ?
\e$,1u^
\e(B)
1168 (#xad6 . ?
\e$A!d
\e(B)
1169 (#xad7 . ?
\e$A!e
\e(B)
1170 (#xad9 . ?
\e$,2%]
\e(B)
1171 (#xadb . ?
\e$,2!l
\e(B)
1172 (#xadc . ?
\e$(O#$
\e(B)
1173 (#xadd . ?
\e$(O#"
\e(B)
1174 (#xade . ?
\e$A!q
\e(B)
1175 (#xadf . ?
\e$,2!n
\e(B)
1176 (#xae0 . ?
\e$(O#?
\e(B)
1177 (#xae1 . ?
\e$,2!k
\e(B)
1178 (#xae2 . ?
\e$,2!m
\e(B)
1179 (#xae3 . ?
\e$A!w
\e(B)
1180 (#xae4 . ?
\e$(G!}
\e(B)
1181 (#xae5 . ?
\e$A!n
\e(B)
1182 (#xae6 . ?
\e$(O#@
\e(B)
1183 (#xae7 . ?
\e$,2!j
\e(B)
1184 (#xae8 . ?
\e$A!x
\e(B)
1185 (#xae9 . ?
\e$(G!~
\e(B)
1186 (#xaea . ?
\e$(C"P
\e(B)
1187 (#xaeb . ?
\e$(O-~
\e(B)
1188 (#xaec . ?
\e$(O&@
\e(B)
1189 (#xaed . ?
\e$(O&<
\e(B)
1190 (#xaee . ?
\e$(O&>
\e(B)
1191 (#xaf0 . ?
\e$,2%`
\e(B)
1192 (#xaf1 . ?
\e$B"w
\e(B)
1193 (#xaf2 . ?
\e$B"x
\e(B)
1194 (#xaf3 . ?
\e$(O'{
\e(B)
1195 (#xaf4 . ?
\e$,2%W
\e(B)
1196 (#xaf5 . ?
\e$B"t
\e(B)
1197 (#xaf6 . ?
\e$B"u
\e(B)
1198 (#xaf7 . ?
\e$A!a
\e(B)
1199 (#xaf8 . ?
\e$A!b
\e(B)
1200 (#xaf9 . ?
\e$(O&g
\e(B)
1201 (#xafa . ?
\e$,1zu
\e(B)
1202 (#xafb . ?
\e$,1uW
\e(B)
1203 (#xafc . ?
\e$,1s8
\e(B)
1204 (#xafd . ?
\e$,1rz
\e(B)
1205 (#xafe . ?
\e,Y%
\e(B)
1209 (#xba8 . ?
\e$A!E
\e(B)
1210 (#xba9 . ?
\e$A!D
\e(B)
1211 (#xbc0 . ?
\e,A/
\e(B)
1212 (#xbc2 . ?
\e$A!M
\e(B)
1213 (#xbc3 . ?
\e$A!I
\e(B)
1214 (#xbc4 . ?
\e$,1zj
\e(B)
1216 (#xbca . ?
\e$,1x8
\e(B)
1217 (#xbcc . ?
\e$,1|5
\e(B)
1218 (#xbce . ?
\e$,1yd
\e(B)
1219 (#xbcf . ?
\e$A!p
\e(B)
1220 (#xbd3 . ?
\e$,1zh
\e(B)
1221 (#xbd6 . ?
\e$A!H
\e(B)
1222 (#xbd8 . ?
\e$B"?
\e(B)
1223 (#xbda . ?
\e$B">
\e(B)
1224 (#xbdc . ?
\e$,1yb
\e(B)
1225 (#xbfc . ?
\e$,1yc
\e(B)
1227 (#xcdf . ?
\e,H_
\e(B)
1228 (#xce0 . ?
\e,H`
\e(B)
1229 (#xce1 . ?
\e,Ha
\e(B)
1230 (#xce2 . ?
\e,Hb
\e(B)
1231 (#xce3 . ?
\e,Hc
\e(B)
1232 (#xce4 . ?
\e,Hd
\e(B)
1233 (#xce5 . ?
\e,He
\e(B)
1234 (#xce6 . ?
\e,Hf
\e(B)
1235 (#xce7 . ?
\e,Hg
\e(B)
1236 (#xce8 . ?
\e,Hh
\e(B)
1237 (#xce9 . ?
\e,Hi
\e(B)
1238 (#xcea . ?
\e,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xeb4 . ?
\e$(C$4
\e(B)
1360 (#xeb5 . ?
\e$(C$5
\e(B)
1361 (#xeb6 . ?
\e$(C$6
\e(B)
1362 (#xeb7 . ?
\e$(C$7
\e(B)
1363 (#xeb8 . ?
\e$(C$8
\e(B)
1364 (#xeb9 . ?
\e$(C$9
\e(B)
1365 (#xeba . ?
\e$(C$:
\e(B)
1366 (#xebb . ?
\e$(C$;
\e(B)
1367 (#xebc . ?
\e$(C$<
\e(B)
1368 (#xebd . ?
\e$(C$=
\e(B)
1369 (#xebe . ?
\e$(C$>
\e(B)
1370 (#xebf . ?
\e$(C$?
\e(B)
1371 (#xec0 . ?
\e$(C$@
\e(B)
1372 (#xec1 . ?
\e$(C$A
\e(B)
1373 (#xec2 . ?
\e$(C$B
\e(B)
1374 (#xec3 . ?
\e$(C$C
\e(B)
1375 (#xec4 . ?
\e$(C$D
\e(B)
1376 (#xec5 . ?
\e$(C$E
\e(B)
1377 (#xec6 . ?
\e$(C$F
\e(B)
1378 (#xec7 . ?
\e$(C$G
\e(B)
1379 (#xec8 . ?
\e$(C$H
\e(B)
1380 (#xec9 . ?
\e$(C$I
\e(B)
1381 (#xeca . ?
\e$(C$J
\e(B)
1382 (#xecb . ?
\e$(C$K
\e(B)
1383 (#xecc . ?
\e$(C$L
\e(B)
1384 (#xecd . ?
\e$(C$M
\e(B)
1385 (#xece . ?
\e$(C$N
\e(B)
1386 (#xecf . ?
\e$(C$O
\e(B)
1387 (#xed0 . ?
\e$(C$P
\e(B)
1388 (#xed1 . ?
\e$(C$Q
\e(B)
1389 (#xed2 . ?
\e$(C$R
\e(B)
1390 (#xed3 . ?
\e$(C$S
\e(B)
1391 (#xed4 . ?
\e$,1LH
\e(B)
1392 (#xed5 . ?
\e$,1LI
\e(B)
1393 (#xed6 . ?
\e$,1LJ
\e(B)
1394 (#xed7 . ?
\e$,1LK
\e(B)
1395 (#xed8 . ?
\e$,1LL
\e(B)
1396 (#xed9 . ?
\e$,1LM
\e(B)
1397 (#xeda . ?
\e$,1LN
\e(B)
1398 (#xedb . ?
\e$,1LO
\e(B)
1399 (#xedc . ?
\e$,1LP
\e(B)
1400 (#xedd . ?
\e$,1LQ
\e(B)
1401 (#xede . ?
\e$,1LR
\e(B)
1402 (#xedf . ?
\e$,1LS
\e(B)
1403 (#xee0 . ?
\e$,1LT
\e(B)
1404 (#xee1 . ?
\e$,1LU
\e(B)
1405 (#xee2 . ?
\e$,1LV
\e(B)
1406 (#xee3 . ?
\e$,1LW
\e(B)
1407 (#xee4 . ?
\e$,1LX
\e(B)
1408 (#xee5 . ?
\e$,1LY
\e(B)
1409 (#xee6 . ?
\e$,1LZ
\e(B)
1410 (#xee7 . ?
\e$,1L[
\e(B)
1411 (#xee8 . ?
\e$,1L\
\e(B)
1412 (#xee9 . ?
\e$,1L]
\e(B)
1413 (#xeea . ?
\e$,1L^
\e(B)
1414 (#xeeb . ?
\e$,1L_
\e(B)
1415 (#xeec . ?
\e$,1L`
\e(B)
1416 (#xeed . ?
\e$,1La
\e(B)
1417 (#xeee . ?
\e$,1Lb
\e(B)
1418 (#xeef . ?
\e$(C$]
\e(B)
1419 (#xef0 . ?
\e$(C$a
\e(B)
1420 (#xef1 . ?
\e$(C$h
\e(B)
1421 (#xef2 . ?
\e$(C$o
\e(B)
1422 (#xef3 . ?
\e$(C$q
\e(B)
1423 (#xef4 . ?
\e$(C$t
\e(B)
1424 (#xef5 . ?
\e$(C$v
\e(B)
1425 (#xef6 . ?
\e$(C$}
\e(B)
1426 (#xef7 . ?
\e$(C$~
\e(B)
1427 (#xef8 . ?
\e$,1M+
\e(B)
1428 (#xef9 . ?
\e$,1M0
\e(B)
1429 (#xefa . ?
\e$,1M9
\e(B)
1430 (#xeff . ?
\e$,1tI
\e(B)
1436 (#x13bc . ?
\e,b<
\e(B)
1437 (#x13bd . ?
\e,b=
\e(B)
1438 (#x13be . ?
\e,_/
\e(B)
1440 (#x20a0 . ?
\e$,1t@
\e(B)
1441 (#x20a1 . ?
\e$,1tA
\e(B)
1442 (#x20a2 . ?
\e$,1tB
\e(B)
1443 (#x20a3 . ?
\e$,1tC
\e(B)
1444 (#x20a4 . ?
\e$,1tD
\e(B)
1445 (#x20a5 . ?
\e$,1tE
\e(B)
1446 (#x20a6 . ?
\e$,1tF
\e(B)
1447 (#x20a7 . ?
\e$,1tG
\e(B)
1448 (#x20a8 . ?
\e$,1tH
\e(B)
1449 (#x20aa . ?
\e$,1tJ
\e(B)
1450 (#x20ab . ?
\e$,1tK
\e(B)
1451 (#x20ac . ?
\e,b$
\e(B)))
1452 (puthash (car pair) (cdr pair) x-keysym-table))
1454 ;; The following keysym codes for graphics are listed in the document
1455 ;; as not having unicodes available:
1457 ;; #x08b1 TOP LEFT SUMMATION Technical
1458 ;; #x08b2 BOTTOM LEFT SUMMATION Technical
1459 ;; #x08b3 TOP VERTICAL SUMMATION CONNECTOR Technical
1460 ;; #x08b4 BOTTOM VERTICAL SUMMATION CONNECTOR Technical
1461 ;; #x08b5 TOP RIGHT SUMMATION Technical
1462 ;; #x08b6 BOTTOM RIGHT SUMMATION Technical
1463 ;; #x08b7 RIGHT MIDDLE SUMMATION Technical
1464 ;; #x0aac SIGNIFICANT BLANK SYMBOL Publish
1465 ;; #x0abd DECIMAL POINT Publish
1466 ;; #x0abf MARKER Publish
1467 ;; #x0acb TRADEMARK SIGN IN CIRCLE Publish
1468 ;; #x0ada HEXAGRAM Publish
1469 ;; #x0aff CURSOR Publish
1470 ;; #x0dde THAI MAIHANAKAT Thai
1473 ;;;; Selections and cut buffers
1475 ;; We keep track of the last text selected here, so we can check the
1476 ;; current selection against it, and avoid passing back our own text
1477 ;; from x-cut-buffer-or-selection-value. We track all three
1478 ;; seperately in case another X application only sets one of them
1479 ;; (say the cut buffer) we aren't fooled by the PRIMARY or
1480 ;; CLIPBOARD selection staying the same.
1481 (defvar x-last-selected-text-clipboard nil
1482 "The value of the CLIPBOARD X selection last time we selected or
1484 (defvar x-last-selected-text-primary nil
1485 "The value of the PRIMARY X selection last time we selected or
1487 (defvar x-last-selected-text-cut nil
1488 "The value of the X cut buffer last time we selected or pasted text.
1489 The actual text stored in the X cut buffer is what encoded from this value.")
1490 (defvar x-last-selected-text-cut-encoded nil
1491 "The value of the X cut buffer last time we selected or pasted text.
1492 This is the actual text stored in the X cut buffer.")
1493 (defvar x-last-cut-buffer-coding 'iso-latin-1
1494 "The coding we last used to encode/decode the text from the X cut buffer")
1496 (defvar x-cut-buffer-max 20000 ; Note this value is overridden below.
1497 "Max number of characters to put in the cut buffer.
1498 It is said that overlarge strings are slow to put into the cut buffer.")
1500 (defcustom x-select-enable-clipboard nil
1501 "Non-nil means cutting and pasting uses the clipboard.
1502 This is in addition to, but in preference to, the primary selection."
1506 (defcustom x-select-enable-primary t
1507 "Non-nil means cutting and pasting uses the primary selection."
1511 (defun x-select-text (text &optional push)
1512 "Make TEXT, a string, the primary X selection.
1513 Also, set the value of X cut buffer 0, for backward compatibility
1514 with older X applications.
1515 gildea@stop.mail-abuse.org says it's not desirable to put kills
1517 ;; With multi-tty, this function may be called from a tty frame.
1518 (when (eq (framep (selected-frame)) 'x)
1519 ;; Don't send the cut buffer too much text.
1520 ;; It becomes slow, and if really big it causes errors.
1521 (cond ((>= (length text) x-cut-buffer-max)
1522 (x-set-cut-buffer "" push)
1523 (setq x-last-selected-text-cut ""
1524 x-last-selected-text-cut-encoded ""))
1526 (setq x-last-selected-text-cut text
1527 x-last-cut-buffer-coding 'iso-latin-1
1528 x-last-selected-text-cut-encoded
1529 ;; ICCCM says cut buffer always contain ISO-Latin-1
1530 (encode-coding-string text 'iso-latin-1))
1531 (x-set-cut-buffer x-last-selected-text-cut-encoded push)))
1532 (when x-select-enable-primary
1533 (x-set-selection 'PRIMARY text)
1534 (setq x-last-selected-text-primary text))
1535 (when x-select-enable-clipboard
1536 (x-set-selection 'CLIPBOARD text)
1537 (setq x-last-selected-text-clipboard text))))
1539 (defvar x-select-request-type nil
1540 "*Data type request for X selection.
1541 The value is one of the following data types, a list of them, or nil:
1542 `COMPOUND_TEXT', `UTF8_STRING', `STRING', `TEXT'
1544 If the value is one of the above symbols, try only the specified
1547 If the value is a list of them, try each of them in the specified
1548 order until succeed.
1550 The value nil is the same as this list:
1551 \(UTF8_STRING COMPOUND_TEXT STRING)
1554 ;; Get a selection value of type TYPE by calling x-get-selection with
1555 ;; an appropiate DATA-TYPE argument decided by `x-select-request-type'.
1556 ;; The return value is already decoded. If x-get-selection causes an
1557 ;; error, this function return nil.
1559 (defun x-selection-value (type)
1560 (let ((request-type (or x-select-request-type
1561 '(UTF8_STRING COMPOUND_TEXT STRING)))
1563 (if (consp request-type)
1564 (while (and request-type (not text))
1566 (setq text (x-get-selection type (car request-type)))
1568 (setq request-type (cdr request-type)))
1570 (setq text (x-get-selection type request-type))
1573 (remove-text-properties 0 (length text) '(foreign-selection nil) text))
1576 ;; Return the value of the current X selection.
1577 ;; Consult the selection, and the cut buffer. Treat empty strings
1578 ;; as if they were unset.
1579 ;; If this function is called twice and finds the same text,
1580 ;; it returns nil the second time. This is so that a single
1581 ;; selection won't be added to the kill ring over and over.
1582 (defun x-cut-buffer-or-selection-value ()
1583 ;; With multi-tty, this function may be called from a tty frame.
1584 (when (eq (framep (selected-frame)) 'x)
1585 (let (clip-text primary-text cut-text)
1586 (when x-select-enable-clipboard
1587 (setq clip-text (x-selection-value 'CLIPBOARD))
1588 (if (string= clip-text "") (setq clip-text nil))
1590 ;; Check the CLIPBOARD selection for 'newness', is it different
1591 ;; from what we remebered them to be last time we did a
1592 ;; cut/paste operation.
1594 (cond ;; check clipboard
1595 ((or (not clip-text) (string= clip-text ""))
1596 (setq x-last-selected-text-clipboard nil))
1597 ((eq clip-text x-last-selected-text-clipboard) nil)
1598 ((string= clip-text x-last-selected-text-clipboard)
1599 ;; Record the newer string,
1600 ;; so subsequent calls can use the `eq' test.
1601 (setq x-last-selected-text-clipboard clip-text)
1603 (t (setq x-last-selected-text-clipboard clip-text)))))
1605 (when x-select-enable-primary
1606 (setq primary-text (x-selection-value 'PRIMARY))
1607 ;; Check the PRIMARY selection for 'newness', is it different
1608 ;; from what we remebered them to be last time we did a
1609 ;; cut/paste operation.
1611 (cond ;; check primary selection
1612 ((or (not primary-text) (string= primary-text ""))
1613 (setq x-last-selected-text-primary nil))
1614 ((eq primary-text x-last-selected-text-primary) nil)
1615 ((string= primary-text x-last-selected-text-primary)
1616 ;; Record the newer string,
1617 ;; so subsequent calls can use the `eq' test.
1618 (setq x-last-selected-text-primary primary-text)
1621 (setq x-last-selected-text-primary primary-text)))))
1623 (setq cut-text (x-get-cut-buffer 0))
1625 ;; Check the x cut buffer for 'newness', is it different
1626 ;; from what we remebered them to be last time we did a
1627 ;; cut/paste operation.
1629 (let ((next-coding (or next-selection-coding-system 'iso-latin-1)))
1630 (cond ;; check cut buffer
1631 ((or (not cut-text) (string= cut-text ""))
1632 (setq x-last-selected-text-cut nil))
1633 ;; This short cut doesn't work because x-get-cut-buffer
1634 ;; always returns a newly created string.
1635 ;; ((eq cut-text x-last-selected-text-cut) nil)
1636 ((and (string= cut-text x-last-selected-text-cut-encoded)
1637 (eq x-last-cut-buffer-coding next-coding))
1638 ;; See the comment above. No need of this recording.
1639 ;; Record the newer string,
1640 ;; so subsequent calls can use the `eq' test.
1641 ;; (setq x-last-selected-text-cut cut-text)
1644 (setq x-last-selected-text-cut-encoded cut-text
1645 x-last-cut-buffer-coding next-coding
1646 x-last-selected-text-cut
1647 ;; ICCCM says cut buffer always contain ISO-Latin-1, but
1648 ;; use next-selection-coding-system if not nil.
1649 (decode-coding-string
1650 cut-text next-coding))))))
1652 ;; As we have done one selection, clear this now.
1653 (setq next-selection-coding-system nil)
1655 ;; At this point we have recorded the current values for the
1656 ;; selection from clipboard (if we are supposed to) primary,
1657 ;; and cut buffer. So return the first one that has changed
1658 ;; (which is the first non-null one).
1660 ;; NOTE: There will be cases where more than one of these has
1661 ;; changed and the new values differ. This indicates that
1662 ;; something like the following has happened since the last time
1663 ;; we looked at the selections: Application X set all the
1664 ;; selections, then Application Y set only one or two of them (say
1665 ;; just the cut-buffer). In this case since we don't have
1666 ;; timestamps there is no way to know what the 'correct' value to
1667 ;; return is. The nice thing to do would be to tell the user we
1668 ;; saw multiple possible selections and ask the user which was the
1670 ;; This code is still a big improvement because now the user can
1671 ;; futz with the current selection and get emacs to pay attention
1672 ;; to the cut buffer again (previously as soon as clipboard or
1673 ;; primary had been set the cut buffer would essentially never be
1675 (or clip-text primary-text cut-text)
1678 ;; Arrange for the kill and yank functions to set and check the clipboard.
1679 (setq interprogram-cut-function 'x-select-text)
1680 (setq interprogram-paste-function 'x-cut-buffer-or-selection-value)
1682 (defun x-clipboard-yank ()
1683 "Insert the clipboard contents, or the last stretch of killed text."
1685 (let ((clipboard-text (x-selection-value 'CLIPBOARD))
1686 (x-select-enable-clipboard t))
1687 (if (and clipboard-text (> (length clipboard-text) 0))
1688 (kill-new clipboard-text))
1691 (declare-function accelerate-menu "xmenu.c" (&optional frame) t)
1693 (defun x-menu-bar-open (&optional frame)
1694 "Open the menu bar if `menu-bar-mode' is on. otherwise call `tmm-menubar'."
1696 (if menu-bar-mode (accelerate-menu frame)
1700 ;;; Window system initialization.
1702 (defun x-win-suspend-error ()
1703 (error "Suspending an Emacs running under X makes no sense"))
1705 (defvar x-initialized nil
1706 "Non-nil if the X window system has been initialized.")
1708 (declare-function x-open-connection "xfns.c"
1709 (display &optional xrm-string must-succeed))
1710 (declare-function x-server-max-request-size "xfns.c" (&optional terminal))
1711 (declare-function x-get-resource "frame.c"
1712 (attribute class &optional component subclass))
1714 (defun x-initialize-window-system ()
1715 "Initialize Emacs for X frames and open the first connection to an X server."
1716 ;; Make sure we have a valid resource name.
1717 (or (stringp x-resource-name)
1719 (setq x-resource-name (invocation-name))
1721 ;; Change any . or * characters in x-resource-name to hyphens,
1722 ;; so as not to choke when we use it in X resource queries.
1723 (while (setq i (string-match "[.*]" x-resource-name))
1724 (aset x-resource-name i ?-))))
1726 (x-open-connection (or x-display-name
1727 (setq x-display-name (or (getenv "DISPLAY" (selected-frame))
1728 (getenv "DISPLAY"))))
1729 x-command-line-resources
1730 ;; Exit Emacs with fatal error if this fails and we
1731 ;; are the initial display.
1732 (eq initial-window-system 'x))
1734 (setq x-cut-buffer-max (min (- (/ (x-server-max-request-size) 2) 100)
1737 ;; Setup the default fontset.
1738 (setup-default-fontset)
1740 ;; Create the standard fontset.
1741 (create-fontset-from-fontset-spec standard-fontset-spec t)
1743 ;; Create fontset specified in X resources "Fontset-N" (N is 0, 1, ...).
1744 (create-fontset-from-x-resource)
1746 ;; Set scroll bar mode to right if set by X resources. Default is left.
1747 (if (equal (x-get-resource "verticalScrollBars" "ScrollBars") "right")
1748 (customize-set-variable 'scroll-bar-mode 'right))
1750 ;; Apply a geometry resource to the initial frame. Put it at the end
1751 ;; of the alist, so that anything specified on the command line takes
1753 (let* ((res-geometry (x-get-resource "geometry" "Geometry"))
1757 (setq parsed (x-parse-geometry res-geometry))
1758 ;; If the resource specifies a position,
1759 ;; call the position and size "user-specified".
1760 (if (or (assq 'top parsed) (assq 'left parsed))
1761 (setq parsed (cons '(user-position . t)
1762 (cons '(user-size . t) parsed))))
1763 ;; All geometry parms apply to the initial frame.
1764 (setq initial-frame-alist (append initial-frame-alist parsed))
1765 ;; The size parms apply to all frames. Don't set it if there are
1766 ;; sizes there already (from command line).
1767 (if (and (assq 'height parsed)
1768 (not (assq 'height default-frame-alist)))
1769 (setq default-frame-alist
1770 (cons (cons 'height (cdr (assq 'height parsed)))
1771 default-frame-alist)))
1772 (if (and (assq 'width parsed)
1773 (not (assq 'width default-frame-alist)))
1774 (setq default-frame-alist
1775 (cons (cons 'width (cdr (assq 'width parsed)))
1776 default-frame-alist))))))
1778 ;; Check the reverseVideo resource.
1779 (let ((case-fold-search t))
1780 (let ((rv (x-get-resource "reverseVideo" "ReverseVideo")))
1782 (string-match "^\\(true\\|yes\\|on\\)$" rv))
1783 (setq default-frame-alist
1784 (cons '(reverse . t) default-frame-alist)))))
1786 ;; Set x-selection-timeout, measured in milliseconds.
1787 (let ((res-selection-timeout
1788 (x-get-resource "selectionTimeout" "SelectionTimeout")))
1789 (setq x-selection-timeout 20000)
1790 (if res-selection-timeout
1791 (setq x-selection-timeout (string-to-number res-selection-timeout))))
1793 ;; Don't let Emacs suspend under X.
1794 (add-hook 'suspend-hook 'x-win-suspend-error)
1796 ;; Turn off window-splitting optimization; X is usually fast enough
1797 ;; that this is only annoying.
1798 (setq split-window-keep-point t)
1800 ;; Motif direct handling of f10 wasn't working right,
1801 ;; So temporarily we've turned it off in lwlib-Xm.c
1802 ;; and turned the Emacs f10 back on.
1803 ;; ;; Motif normally handles f10 itself, so don't try to handle it a second time.
1804 ;; (if (featurep 'motif)
1805 ;; (global-set-key [f10] 'ignore))
1807 ;; Turn on support for mouse wheels.
1808 (mouse-wheel-mode 1)
1810 ;; Enable CLIPBOARD copy/paste through menu bar commands.
1811 (menu-bar-enable-clipboard)
1813 ;; Override Paste so it looks at CLIPBOARD first.
1814 (define-key menu-bar-edit-menu [paste]
1815 (append '(menu-item "Paste" x-clipboard-yank
1816 :enable (not buffer-read-only)
1817 :help "Paste (yank) text most recently cut/copied")
1820 (setq x-initialized t))
1822 (add-to-list 'handle-args-function-alist '(x . x-handle-args))
1823 (add-to-list 'frame-creation-function-alist '(x . x-create-frame-with-faces))
1824 (add-to-list 'window-system-initialization-alist '(x . x-initialize-window-system))
1826 ;; Initiate drag and drop
1827 (add-hook 'after-make-frame-functions 'x-dnd-init-frame)
1828 (define-key special-event-map [drag-n-drop] 'x-dnd-handle-drag-n-drop-event)
1830 (defcustom x-gtk-stock-map
1832 ("etc/images/new" . "gtk-new")
1833 ("etc/images/open" . "gtk-open")
1834 ("etc/images/diropen" . "n:system-file-manager")
1835 ("etc/images/close" . "gtk-close")
1836 ("etc/images/save" . "gtk-save")
1837 ("etc/images/saveas" . "gtk-save-as")
1838 ("etc/images/undo" . "gtk-undo")
1839 ("etc/images/cut" . "gtk-cut")
1840 ("etc/images/copy" . "gtk-copy")
1841 ("etc/images/paste" . "gtk-paste")
1842 ("etc/images/search" . "gtk-find")
1843 ("etc/images/print" . "gtk-print")
1844 ("etc/images/preferences" . "gtk-preferences")
1845 ("etc/images/help" . "gtk-help")
1846 ("etc/images/left-arrow" . "gtk-go-back")
1847 ("etc/images/right-arrow" . "gtk-go-forward")
1848 ("etc/images/home" . "gtk-home")
1849 ("etc/images/jump-to" . "gtk-jump-to")
1850 ("etc/images/index" . "gtk-index")
1851 ("etc/images/search" . "gtk-find")
1852 ("etc/images/exit" . "gtk-quit")
1853 ("etc/images/cancel" . "gtk-cancel")
1854 ("etc/images/info" . "gtk-info")
1855 ("etc/images/bookmark_add" . "n:bookmark_add")
1856 ;; Used in Gnus and/or MH-E:
1857 ("etc/images/attach" . "gtk-attach")
1858 ("etc/images/connect" . "gtk-connect")
1859 ("etc/images/contact" . "gtk-contact")
1860 ("etc/images/delete" . "gtk-delete")
1861 ("etc/images/describe" . "gtk-properties")
1862 ("etc/images/disconnect" . "gtk-disconnect")
1863 ;; ("etc/images/exit" . "gtk-exit")
1864 ("etc/images/lock-broken" . "gtk-lock_broken")
1865 ("etc/images/lock-ok" . "gtk-lock_ok")
1866 ("etc/images/lock" . "gtk-lock")
1867 ("etc/images/next-page" . "gtk-next-page")
1868 ("etc/images/refresh" . "gtk-refresh")
1869 ("etc/images/sort-ascending" . "gtk-sort-ascending")
1870 ("etc/images/sort-column-ascending" . "gtk-sort-column-ascending")
1871 ("etc/images/sort-criteria" . "gtk-sort-criteria")
1872 ("etc/images/sort-descending" . "gtk-sort-descending")
1873 ("etc/images/sort-row-ascending" . "gtk-sort-row-ascending")
1874 ("images/gnus/toggle-subscription" . "gtk-task-recurring")
1875 ("images/mail/compose" . "gtk-mail-compose")
1876 ("images/mail/copy" . "gtk-mail-copy")
1877 ("images/mail/forward" . "gtk-mail-forward")
1878 ("images/mail/inbox" . "gtk-inbox")
1879 ("images/mail/move" . "gtk-mail-move")
1880 ("images/mail/not-spam" . "gtk-not-spam")
1881 ("images/mail/outbox" . "gtk-outbox")
1882 ("images/mail/reply-all" . "gtk-mail-reply-to-all")
1883 ("images/mail/reply" . "gtk-mail-reply")
1884 ("images/mail/save-draft" . "gtk-mail-handling")
1885 ("images/mail/send" . "gtk-mail-send")
1886 ("images/mail/spam" . "gtk-spam")
1887 ;; No themed versions available:
1888 ;; mail/preview (combining stock_mail and stock_zoom)
1889 ;; mail/save (combining stock_mail, stock_save and stock_convert)
1891 "How icons for tool bars are mapped to Gtk+ stock items.
1892 Emacs must be compiled with the Gtk+ toolkit for this to have any effect.
1893 A value that begins with n: denotes a named icon instead of a stock icon."
1895 :type '(choice (repeat (choice symbol
1896 (cons (string :tag "Emacs icon")
1897 (string :tag "Stock/named")))))
1900 (defcustom icon-map-list '(x-gtk-stock-map)
1901 "A list of alists that maps icon file names to stock/named icons.
1902 The alists are searched in the order they appear. The first match is used.
1903 The keys in the alists are file names without extension and with two directory
1904 components. For example, to map /usr/share/emacs/22.1.1/etc/images/open.xpm
1905 to stock item gtk-open, use:
1907 (\"etc/images/open\" . \"gtk-open\")
1909 Themes also have named icons. To map to one of those, use n: before the name:
1911 (\"etc/images/diropen\" . \"n:system-file-manager\")
1913 The list elements are either the symbol name for the alist or the
1916 If you don't want stock icons, set the variable to nil."
1918 :type '(choice (const :tag "Don't use stock icons" nil)
1919 (repeat (choice symbol
1920 (cons (string :tag "Emacs icon")
1921 (string :tag "Stock/named")))))
1924 (defun x-gtk-map-stock (file)
1925 "Map icon with file name FILE to a Gtk+ stock name, using `x-gtk-stock-map'."
1927 (let* ((file-sans (file-name-sans-extension file))
1928 (key (and (string-match "/\\([^/]+/[^/]+/[^/]+$\\)" file-sans)
1929 (match-string 1 file-sans)))
1931 (mapc (lambda (elem)
1932 (let ((assoc (if (symbolp elem) (symbol-value elem) elem)))
1933 (or value (setq value (assoc-string (or key file-sans)
1936 (and value (cdr value)))
1941 ;; arch-tag: f1501302-db8b-4d95-88e3-116697d89f78
1942 ;;; x-win.el ends here