Remove compat code in Tramp
[emacs.git] / lisp / term / x-win.el
blobc8e79e3f81a379d8f35f5c6afc8988171dccd048
1 ;;; x-win.el --- parse relevant switches and set up for X -*- lexical-binding:t -*-
3 ;; Copyright (C) 1993-1994, 2001-2016 Free Software Foundation, Inc.
5 ;; Author: FSF
6 ;; Keywords: terminals, i18n
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 ;; X-win.el: this file defines functions to initialize the X window
26 ;; system and process X-specific command line parameters before
27 ;; creating the first X frame.
29 ;; Beginning in Emacs 23, the act of loading this file should not have
30 ;; the side effect of initializing the window system or processing
31 ;; command line arguments (this file is now loaded in loadup.el). See
32 ;; `handle-args-function' and `window-system-initialization' for more details.
34 ;; startup.el will then examine startup files, and eventually call the hooks
35 ;; which create the first window(s).
37 ;;; 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 ;; -iconic .iconic
59 ;; -name .name
60 ;; -reverse *reverseVideo
61 ;; -rv *reverseVideo
62 ;; -selectionTimeout .selectionTimeout
63 ;; -synchronous *synchronous
64 ;; -xrm
66 ;; An alist of X options and the function which handles them. See
67 ;; ../startup.el.
69 (eval-when-compile (require 'cl-lib))
71 (if (not (fboundp 'x-create-frame))
72 (error "%s: Loading x-win.el but not compiled for X" (invocation-name)))
74 (require 'term/common-win)
75 (require 'frame)
76 (require 'mouse)
77 (require 'scroll-bar)
78 (require 'faces)
79 (require 'select)
80 (require 'menu-bar)
81 (require 'fontset)
82 (require 'x-dnd)
84 (defvar x-invocation-args)
85 (defvar x-keysym-table)
86 (defvar x-selection-timeout)
87 (defvar x-session-id)
88 (defvar x-session-previous-id)
90 (defun x-handle-no-bitmap-icon (_switch)
91 (setq default-frame-alist (cons '(icon-type) default-frame-alist)))
93 ;; Handle the --parent-id option.
94 (defun x-handle-parent-id (switch)
95 (or (consp x-invocation-args)
96 (error "%s: missing argument to `%s' option" (invocation-name) switch))
97 (setq initial-frame-alist (cons
98 (cons 'parent-id
99 (string-to-number (car x-invocation-args)))
100 initial-frame-alist)
101 x-invocation-args (cdr x-invocation-args)))
103 ;; Handle the --smid switch. This is used by the session manager
104 ;; to give us back our session id we had on the previous run.
105 (defun x-handle-smid (switch)
106 (or (consp x-invocation-args)
107 (error "%s: missing argument to `%s' option" (invocation-name) switch))
108 (setq x-session-previous-id (car x-invocation-args)
109 x-invocation-args (cdr x-invocation-args)))
111 (defvar emacs-save-session-functions nil
112 "Special hook run when a save-session event occurs.
113 The functions do not get any argument.
114 Functions can return non-nil to inform the session manager that the
115 window system shutdown should be aborted.
117 See also `emacs-session-save'.")
119 (defun emacs-session-filename (session-id)
120 "Construct a filename to save the session in based on SESSION-ID.
121 Return a filename in `user-emacs-directory', unless the session file
122 already exists in the home directory."
123 (let ((basename (concat "session." session-id)))
124 (locate-user-emacs-file basename
125 (concat ".emacs-" basename))))
127 (defun emacs-session-save ()
128 "This function is called when the window system is shutting down.
129 If this function returns non-nil, the window system shutdown is canceled.
131 When a session manager tells Emacs that the window system is shutting
132 down, this function is called. It calls the functions in the hook
133 `emacs-save-session-functions'. Functions are called with the current
134 buffer set to a temporary buffer. Functions should use `insert' to insert
135 lisp code to save the session state. The buffer is saved in a file in the
136 home directory of the user running Emacs. The file is evaluated when
137 Emacs is restarted by the session manager.
139 If any of the functions returns non-nil, no more functions are called
140 and this function returns non-nil. This will inform the session manager
141 that it should abort the window system shutdown."
142 (let ((filename (emacs-session-filename x-session-id))
143 (buf (get-buffer-create (concat " *SES " x-session-id))))
144 (when (file-exists-p filename)
145 (delete-file filename))
146 (with-current-buffer buf
147 (let ((cancel-shutdown (condition-case nil
148 ;; A return of t means cancel the shutdown.
149 (run-hook-with-args-until-success
150 'emacs-save-session-functions)
151 (error t))))
152 (unless cancel-shutdown
153 (write-file filename))
154 (kill-buffer buf)
155 cancel-shutdown))))
157 (defun emacs-session-restore (previous-session-id)
158 "Restore the Emacs session if started by a session manager.
159 The file saved by `emacs-session-save' is evaluated and deleted if it
160 exists."
161 (let ((filename (emacs-session-filename previous-session-id)))
162 (when (file-exists-p filename)
163 (load-file filename)
164 (delete-file filename)
165 (message "Restored session data"))))
171 ;; Standard X cursor shapes, courtesy of Mr. Fox, who wanted ALL of them.
174 (defconst x-pointer-X-cursor 0)
175 (defconst x-pointer-arrow 2)
176 (defconst x-pointer-based-arrow-down 4)
177 (defconst x-pointer-based-arrow-up 6)
178 (defconst x-pointer-boat 8)
179 (defconst x-pointer-bogosity 10)
180 (defconst x-pointer-bottom-left-corner 12)
181 (defconst x-pointer-bottom-right-corner 14)
182 (defconst x-pointer-bottom-side 16)
183 (defconst x-pointer-bottom-tee 18)
184 (defconst x-pointer-box-spiral 20)
185 (defconst x-pointer-center-ptr 22)
186 (defconst x-pointer-circle 24)
187 (defconst x-pointer-clock 26)
188 (defconst x-pointer-coffee-mug 28)
189 (defconst x-pointer-cross 30)
190 (defconst x-pointer-cross-reverse 32)
191 (defconst x-pointer-crosshair 34)
192 (defconst x-pointer-diamond-cross 36)
193 (defconst x-pointer-dot 38)
194 (defconst x-pointer-dotbox 40)
195 (defconst x-pointer-double-arrow 42)
196 (defconst x-pointer-draft-large 44)
197 (defconst x-pointer-draft-small 46)
198 (defconst x-pointer-draped-box 48)
199 (defconst x-pointer-exchange 50)
200 (defconst x-pointer-fleur 52)
201 (defconst x-pointer-gobbler 54)
202 (defconst x-pointer-gumby 56)
203 (defconst x-pointer-hand1 58)
204 (defconst x-pointer-hand2 60)
205 (defconst x-pointer-heart 62)
206 (defconst x-pointer-icon 64)
207 (defconst x-pointer-iron-cross 66)
208 (defconst x-pointer-left-ptr 68)
209 (defconst x-pointer-left-side 70)
210 (defconst x-pointer-left-tee 72)
211 (defconst x-pointer-leftbutton 74)
212 (defconst x-pointer-ll-angle 76)
213 (defconst x-pointer-lr-angle 78)
214 (defconst x-pointer-man 80)
215 (defconst x-pointer-middlebutton 82)
216 (defconst x-pointer-mouse 84)
217 (defconst x-pointer-pencil 86)
218 (defconst x-pointer-pirate 88)
219 (defconst x-pointer-plus 90)
220 (defconst x-pointer-question-arrow 92)
221 (defconst x-pointer-right-ptr 94)
222 (defconst x-pointer-right-side 96)
223 (defconst x-pointer-right-tee 98)
224 (defconst x-pointer-rightbutton 100)
225 (defconst x-pointer-rtl-logo 102)
226 (defconst x-pointer-sailboat 104)
227 (defconst x-pointer-sb-down-arrow 106)
228 (defconst x-pointer-sb-h-double-arrow 108)
229 (defconst x-pointer-sb-left-arrow 110)
230 (defconst x-pointer-sb-right-arrow 112)
231 (defconst x-pointer-sb-up-arrow 114)
232 (defconst x-pointer-sb-v-double-arrow 116)
233 (defconst x-pointer-shuttle 118)
234 (defconst x-pointer-sizing 120)
235 (defconst x-pointer-spider 122)
236 (defconst x-pointer-spraycan 124)
237 (defconst x-pointer-star 126)
238 (defconst x-pointer-target 128)
239 (defconst x-pointer-tcross 130)
240 (defconst x-pointer-top-left-arrow 132)
241 (defconst x-pointer-top-left-corner 134)
242 (defconst x-pointer-top-right-corner 136)
243 (defconst x-pointer-top-side 138)
244 (defconst x-pointer-top-tee 140)
245 (defconst x-pointer-trek 142)
246 (defconst x-pointer-ul-angle 144)
247 (defconst x-pointer-umbrella 146)
248 (defconst x-pointer-ur-angle 148)
249 (defconst x-pointer-watch 150)
250 (defconst x-pointer-xterm 152)
251 (defconst x-pointer-invisible 255)
254 ;;;; Keysyms
256 (defun vendor-specific-keysyms (vendor)
257 "Return the appropriate value of `system-key-alist' for VENDOR.
258 VENDOR is a string containing the name of the X Server's vendor,
259 as returned by `x-server-vendor'."
260 (cond ((or (string-equal vendor "Hewlett-Packard Incorporated")
261 (string-equal vendor "Hewlett-Packard Company"))
262 '(( 168 . mute-acute)
263 ( 169 . mute-grave)
264 ( 170 . mute-asciicircum)
265 ( 171 . mute-diaeresis)
266 ( 172 . mute-asciitilde)
267 ( 175 . lira)
268 ( 190 . guilder)
269 ( 252 . block)
270 ( 256 . longminus)
271 (65388 . reset)
272 (65389 . system)
273 (65390 . user)
274 (65391 . clearline)
275 (65392 . insertline)
276 (65393 . deleteline)
277 (65394 . insertchar)
278 (65395 . deletechar)
279 (65396 . backtab)
280 (65397 . kp-backtab)))
281 ;; Fixme: What about non-X11/NeWS sun server?
282 ((or (string-equal vendor "X11/NeWS - Sun Microsystems Inc.")
283 (string-equal vendor "X Consortium"))
284 '((392976 . f36)
285 (392977 . f37)
286 (393056 . req)
287 ;; These are for Sun under X11R6
288 (393072 . props)
289 (393073 . front)
290 (393074 . copy)
291 (393075 . open)
292 (393076 . paste)
293 (393077 . cut)))
295 ;; This is used by DEC's X server.
296 '((65280 . remove)))))
298 ;; Latin-1
299 (let ((i 160))
300 (while (< i 256)
301 (puthash i i x-keysym-table)
302 (setq i (1+ i))))
304 ;; Table from Kuhn's proposed additions to the `KEYSYM Encoding'
305 ;; appendix to the X protocol definition.
306 (dolist
307 (pair
309 ;; Latin-2
310 (#x1a1 . ?Ą)
311 (#x1a2 . ?˘)
312 (#x1a3 . ?Ł)
313 (#x1a5 . ?Ľ)
314 (#x1a6 . ?Ś)
315 (#x1a9 . ?Š)
316 (#x1aa . ?Ş)
317 (#x1ab . ?Ť)
318 (#x1ac . ?Ź)
319 (#x1ae . ?Ž)
320 (#x1af . ?Ż)
321 (#x1b1 . ?ą)
322 (#x1b2 . ?˛)
323 (#x1b3 . ?ł)
324 (#x1b5 . ?ľ)
325 (#x1b6 . ?ś)
326 (#x1b7 . ?ˇ)
327 (#x1b9 . ?š)
328 (#x1ba . ?ş)
329 (#x1bb . ?ť)
330 (#x1bc . ?ź)
331 (#x1bd . ?˝)
332 (#x1be . ?ž)
333 (#x1bf . ?ż)
334 (#x1c0 . ?Ŕ)
335 (#x1c3 . ?Ă)
336 (#x1c5 . ?Ĺ)
337 (#x1c6 . ?Ć)
338 (#x1c8 . ?Č)
339 (#x1ca . ?Ę)
340 (#x1cc . ?Ě)
341 (#x1cf . ?Ď)
342 (#x1d0 . ?Đ)
343 (#x1d1 . ?Ń)
344 (#x1d2 . ?Ň)
345 (#x1d5 . ?Ő)
346 (#x1d8 . ?Ř)
347 (#x1d9 . ?Ů)
348 (#x1db . ?Ű)
349 (#x1de . ?Ţ)
350 (#x1e0 . ?ŕ)
351 (#x1e3 . ?ă)
352 (#x1e5 . ?ĺ)
353 (#x1e6 . ?ć)
354 (#x1e8 . ?č)
355 (#x1ea . ?ę)
356 (#x1ec . ?ě)
357 (#x1ef . ?ď)
358 (#x1f0 . ?đ)
359 (#x1f1 . ?ń)
360 (#x1f2 . ?ň)
361 (#x1f5 . ?ő)
362 (#x1f8 . ?ř)
363 (#x1f9 . ?ů)
364 (#x1fb . ?ű)
365 (#x1fe . ?ţ)
366 (#x1ff . ?˙)
367 ;; Latin-3
368 (#x2a1 . ?Ħ)
369 (#x2a6 . ?Ĥ)
370 (#x2a9 . ?İ)
371 (#x2ab . ?Ğ)
372 (#x2ac . ?Ĵ)
373 (#x2b1 . ?ħ)
374 (#x2b6 . ?ĥ)
375 (#x2b9 . ?ı)
376 (#x2bb . ?ğ)
377 (#x2bc . ?ĵ)
378 (#x2c5 . ?Ċ)
379 (#x2c6 . ?Ĉ)
380 (#x2d5 . ?Ġ)
381 (#x2d8 . ?Ĝ)
382 (#x2dd . ?Ŭ)
383 (#x2de . ?Ŝ)
384 (#x2e5 . ?ċ)
385 (#x2e6 . ?ĉ)
386 (#x2f5 . ?ġ)
387 (#x2f8 . ?ĝ)
388 (#x2fd . ?ŭ)
389 (#x2fe . ?ŝ)
390 ;; Latin-4
391 (#x3a2 . ?ĸ)
392 (#x3a3 . ?Ŗ)
393 (#x3a5 . ?Ĩ)
394 (#x3a6 . ?Ļ)
395 (#x3aa . ?Ē)
396 (#x3ab . ?Ģ)
397 (#x3ac . ?Ŧ)
398 (#x3b3 . ?ŗ)
399 (#x3b5 . ?ĩ)
400 (#x3b6 . ?ļ)
401 (#x3ba . ?ē)
402 (#x3bb . ?ģ)
403 (#x3bc . ?ŧ)
404 (#x3bd . ?Ŋ)
405 (#x3bf . ?ŋ)
406 (#x3c0 . ?Ā)
407 (#x3c7 . ?Į)
408 (#x3cc . ?Ė)
409 (#x3cf . ?Ī)
410 (#x3d1 . ?Ņ)
411 (#x3d2 . ?Ō)
412 (#x3d3 . ?Ķ)
413 (#x3d9 . ?Ų)
414 (#x3dd . ?Ũ)
415 (#x3de . ?Ū)
416 (#x3e0 . ?ā)
417 (#x3e7 . ?į)
418 (#x3ec . ?ė)
419 (#x3ef . ?ī)
420 (#x3f1 . ?ņ)
421 (#x3f2 . ?ō)
422 (#x3f3 . ?ķ)
423 (#x3f9 . ?ų)
424 (#x3fd . ?ũ)
425 (#x3fe . ?ū)
426 (#x47e . ?‾)
427 (#x4a1 . ?。)
428 (#x4a2 . ?\「)
429 (#x4a3 . ?\」)
430 (#x4a4 . ?、)
431 (#x4a5 . ?・)
432 (#x4a6 . ?ヲ)
433 (#x4a7 . ?ァ)
434 (#x4a8 . ?ィ)
435 (#x4a9 . ?ゥ)
436 (#x4aa . ?ェ)
437 (#x4ab . ?ォ)
438 (#x4ac . ?ャ)
439 (#x4ad . ?ュ)
440 (#x4ae . ?ョ)
441 (#x4af . ?ッ)
442 (#x4b0 . ?ー)
443 (#x4b1 . ?ア)
444 (#x4b2 . ?イ)
445 (#x4b3 . ?ウ)
446 (#x4b4 . ?エ)
447 (#x4b5 . ?オ)
448 (#x4b6 . ?カ)
449 (#x4b7 . ?キ)
450 (#x4b8 . ?ク)
451 (#x4b9 . ?ケ)
452 (#x4ba . ?コ)
453 (#x4bb . ?サ)
454 (#x4bc . ?シ)
455 (#x4bd . ?ス)
456 (#x4be . ?セ)
457 (#x4bf . ?ソ)
458 (#x4c0 . ?タ)
459 (#x4c1 . ?チ)
460 (#x4c2 . ?ツ)
461 (#x4c3 . ?テ)
462 (#x4c4 . ?ト)
463 (#x4c5 . ?ナ)
464 (#x4c6 . ?ニ)
465 (#x4c7 . ?ヌ)
466 (#x4c8 . ?ネ)
467 (#x4c9 . ?ノ)
468 (#x4ca . ?ハ)
469 (#x4cb . ?ヒ)
470 (#x4cc . ?フ)
471 (#x4cd . ?ヘ)
472 (#x4ce . ?ホ)
473 (#x4cf . ?マ)
474 (#x4d0 . ?ミ)
475 (#x4d1 . ?ム)
476 (#x4d2 . ?メ)
477 (#x4d3 . ?モ)
478 (#x4d4 . ?ヤ)
479 (#x4d5 . ?ユ)
480 (#x4d6 . ?ヨ)
481 (#x4d7 . ?ラ)
482 (#x4d8 . ?リ)
483 (#x4d9 . ?ル)
484 (#x4da . ?レ)
485 (#x4db . ?ロ)
486 (#x4dc . ?ワ)
487 (#x4dd . ?ン)
488 (#x4de . ?゛)
489 (#x4df . ?゜)
490 ;; Arabic
491 (#x5ac . ?،)
492 (#x5bb . ?؛)
493 (#x5bf . ?؟)
494 (#x5c1 . ?ء)
495 (#x5c2 . ?آ)
496 (#x5c3 . ?أ)
497 (#x5c4 . ?ؤ)
498 (#x5c5 . ?إ)
499 (#x5c6 . ?ئ)
500 (#x5c7 . ?ا)
501 (#x5c8 . ?ب)
502 (#x5c9 . ?ة)
503 (#x5ca . ?ت)
504 (#x5cb . ?ث)
505 (#x5cc . ?ج)
506 (#x5cd . ?ح)
507 (#x5ce . ?خ)
508 (#x5cf . ?د)
509 (#x5d0 . ?ذ)
510 (#x5d1 . ?ر)
511 (#x5d2 . ?ز)
512 (#x5d3 . ?س)
513 (#x5d4 . ?ش)
514 (#x5d5 . ?ص)
515 (#x5d6 . ?ض)
516 (#x5d7 . ?ط)
517 (#x5d8 . ?ظ)
518 (#x5d9 . ?ع)
519 (#x5da . ?غ)
520 (#x5e0 . ?ـ)
521 (#x5e1 . ?ف)
522 (#x5e2 . ?ق)
523 (#x5e3 . ?ك)
524 (#x5e4 . ?ل)
525 (#x5e5 . ?م)
526 (#x5e6 . ?ن)
527 (#x5e7 . ?ه)
528 (#x5e8 . ?و)
529 (#x5e9 . ?ى)
530 (#x5ea . ?ي)
531 (#x5eb . ?ً)
532 (#x5ec . ?ٌ)
533 (#x5ed . ?ٍ)
534 (#x5ee . ?َ)
535 (#x5ef . ?ُ)
536 (#x5f0 . ?ِ)
537 (#x5f1 . ?ّ)
538 (#x5f2 . ?ْ)
539 ;; Cyrillic
540 (#x680 . ?Ғ)
541 (#x681 . ?Җ)
542 (#x682 . ?Қ)
543 (#x683 . ?Ҝ)
544 (#x684 . ?Ң)
545 (#x685 . ?Ү)
546 (#x686 . ?Ұ)
547 (#x687 . ?Ҳ)
548 (#x688 . ?Ҷ)
549 (#x689 . ?Ҹ)
550 (#x68a . ?Һ)
551 (#x68c . ?Ә)
552 (#x68d . ?Ӣ)
553 (#x68e . ?Ө)
554 (#x68f . ?Ӯ)
555 (#x690 . ?ғ)
556 (#x691 . ?җ)
557 (#x692 . ?қ)
558 (#x693 . ?ҝ)
559 (#x694 . ?ң)
560 (#x695 . ?ү)
561 (#x696 . ?ұ)
562 (#x697 . ?ҳ)
563 (#x698 . ?ҷ)
564 (#x699 . ?ҹ)
565 (#x69a . ?һ)
566 (#x69c . ?ә)
567 (#x69d . ?ӣ)
568 (#x69e . ?ө)
569 (#x69f . ?ӯ)
570 (#x6a1 . ?ђ)
571 (#x6a2 . ?ѓ)
572 (#x6a3 . ?ё)
573 (#x6a4 . ?є)
574 (#x6a5 . ?ѕ)
575 (#x6a6 . ?і)
576 (#x6a7 . ?ї)
577 (#x6a8 . ?ј)
578 (#x6a9 . ?љ)
579 (#x6aa . ?њ)
580 (#x6ab . ?ћ)
581 (#x6ac . ?ќ)
582 (#x6ae . ?ў)
583 (#x6af . ?џ)
584 (#x6b0 . ?№)
585 (#x6b1 . ?Ђ)
586 (#x6b2 . ?Ѓ)
587 (#x6b3 . ?Ё)
588 (#x6b4 . ?Є)
589 (#x6b5 . ?Ѕ)
590 (#x6b6 . ?І)
591 (#x6b7 . ?Ї)
592 (#x6b8 . ?Ј)
593 (#x6b9 . ?Љ)
594 (#x6ba . ?Њ)
595 (#x6bb . ?Ћ)
596 (#x6bc . ?Ќ)
597 (#x6be . ?Ў)
598 (#x6bf . ?Џ)
599 (#x6c0 . ?ю)
600 (#x6c1 . ?а)
601 (#x6c2 . ?б)
602 (#x6c3 . ?ц)
603 (#x6c4 . ?д)
604 (#x6c5 . ?е)
605 (#x6c6 . ?ф)
606 (#x6c7 . ?г)
607 (#x6c8 . ?х)
608 (#x6c9 . ?и)
609 (#x6ca . ?й)
610 (#x6cb . ?к)
611 (#x6cc . ?л)
612 (#x6cd . ?м)
613 (#x6ce . ?н)
614 (#x6cf . ?о)
615 (#x6d0 . ?п)
616 (#x6d1 . ?я)
617 (#x6d2 . ?р)
618 (#x6d3 . ?с)
619 (#x6d4 . ?т)
620 (#x6d5 . ?у)
621 (#x6d6 . ?ж)
622 (#x6d7 . ?в)
623 (#x6d8 . ?ь)
624 (#x6d9 . ?ы)
625 (#x6da . ?з)
626 (#x6db . ?ш)
627 (#x6dc . ?э)
628 (#x6dd . ?щ)
629 (#x6de . ?ч)
630 (#x6df . ?ъ)
631 (#x6e0 . ?Ю)
632 (#x6e1 . ?А)
633 (#x6e2 . ?Б)
634 (#x6e3 . ?Ц)
635 (#x6e4 . ?Д)
636 (#x6e5 . ?Е)
637 (#x6e6 . ?Ф)
638 (#x6e7 . ?Г)
639 (#x6e8 . ?Х)
640 (#x6e9 . ?И)
641 (#x6ea . ?Й)
642 (#x6eb . ?К)
643 (#x6ec . ?Л)
644 (#x6ed . ?М)
645 (#x6ee . ?Н)
646 (#x6ef . ?О)
647 (#x6f0 . ?П)
648 (#x6f1 . ?Я)
649 (#x6f2 . ?Р)
650 (#x6f3 . ?С)
651 (#x6f4 . ?Т)
652 (#x6f5 . ?У)
653 (#x6f6 . ?Ж)
654 (#x6f7 . ?В)
655 (#x6f8 . ?Ь)
656 (#x6f9 . ?Ы)
657 (#x6fa . ?З)
658 (#x6fb . ?Ш)
659 (#x6fc . ?Э)
660 (#x6fd . ?Щ)
661 (#x6fe . ?Ч)
662 (#x6ff . ?Ъ)
663 ;; Greek
664 (#x7a1 . ?Ά)
665 (#x7a2 . ?Έ)
666 (#x7a3 . ?Ή)
667 (#x7a4 . ?Ί)
668 (#x7a5 . ?Ϊ)
669 (#x7a7 . ?Ό)
670 (#x7a8 . ?Ύ)
671 (#x7a9 . ?Ϋ)
672 (#x7ab . ?Ώ)
673 (#x7ae . ?΅)
674 (#x7af . ?―)
675 (#x7b1 . ?ά)
676 (#x7b2 . ?έ)
677 (#x7b3 . ?ή)
678 (#x7b4 . ?ί)
679 (#x7b5 . ?ϊ)
680 (#x7b6 . ?ΐ)
681 (#x7b7 . ?ό)
682 (#x7b8 . ?ύ)
683 (#x7b9 . ?ϋ)
684 (#x7ba . ?ΰ)
685 (#x7bb . ?ώ)
686 (#x7c1 . ?Α)
687 (#x7c2 . ?Β)
688 (#x7c3 . ?Γ)
689 (#x7c4 . ?Δ)
690 (#x7c5 . ?Ε)
691 (#x7c6 . ?Ζ)
692 (#x7c7 . ?Η)
693 (#x7c8 . ?Θ)
694 (#x7c9 . ?Ι)
695 (#x7ca . ?Κ)
696 (#x7cb . ?Λ)
697 (#x7cc . ?Μ)
698 (#x7cd . ?Ν)
699 (#x7ce . ?Ξ)
700 (#x7cf . ?Ο)
701 (#x7d0 . ?Π)
702 (#x7d1 . ?Ρ)
703 (#x7d2 . ?Σ)
704 (#x7d4 . ?Τ)
705 (#x7d5 . ?Υ)
706 (#x7d6 . ?Φ)
707 (#x7d7 . ?Χ)
708 (#x7d8 . ?Ψ)
709 (#x7d9 . ?Ω)
710 (#x7e1 . ?α)
711 (#x7e2 . ?β)
712 (#x7e3 . ?γ)
713 (#x7e4 . ?δ)
714 (#x7e5 . ?ε)
715 (#x7e6 . ?ζ)
716 (#x7e7 . ?η)
717 (#x7e8 . ?θ)
718 (#x7e9 . ?ι)
719 (#x7ea . ?κ)
720 (#x7eb . ?λ)
721 (#x7ec . ?μ)
722 (#x7ed . ?ν)
723 (#x7ee . ?ξ)
724 (#x7ef . ?ο)
725 (#x7f0 . ?π)
726 (#x7f1 . ?ρ)
727 (#x7f2 . ?σ)
728 (#x7f3 . ?ς)
729 (#x7f4 . ?τ)
730 (#x7f5 . ?υ)
731 (#x7f6 . ?φ)
732 (#x7f7 . ?χ)
733 (#x7f8 . ?ψ)
734 (#x7f9 . ?ω)
735 ;; Technical
736 (#x8a1 . ?⎷)
737 (#x8a2 . ?┌)
738 (#x8a3 . ?─)
739 (#x8a4 . ?⌠)
740 (#x8a5 . ?⌡)
741 (#x8a6 . ?│)
742 (#x8a7 . ?⎡)
743 (#x8a8 . ?⎣)
744 (#x8a9 . ?⎤)
745 (#x8aa . ?⎦)
746 (#x8ab . ?⎛)
747 (#x8ac . ?⎝)
748 (#x8ad . ?⎞)
749 (#x8ae . ?⎠)
750 (#x8af . ?⎨)
751 (#x8b0 . ?⎬)
752 (#x8bc . ?≤)
753 (#x8bd . ?≠)
754 (#x8be . ?≥)
755 (#x8bf . ?∫)
756 (#x8c0 . ?∴)
757 (#x8c1 . ?∝)
758 (#x8c2 . ?∞)
759 (#x8c5 . ?∇)
760 (#x8c8 . ?∼)
761 (#x8c9 . ?≃)
762 (#x8cd . ?⇔)
763 (#x8ce . ?⇒)
764 (#x8cf . ?≡)
765 (#x8d6 . ?√)
766 (#x8da . ?⊂)
767 (#x8db . ?⊃)
768 (#x8dc . ?∩)
769 (#x8dd . ?∪)
770 (#x8de . ?∧)
771 (#x8df . ?∨)
772 (#x8ef . ?∂)
773 (#x8f6 . ?ƒ)
774 (#x8fb . ?←)
775 (#x8fc . ?↑)
776 (#x8fd . ?→)
777 (#x8fe . ?↓)
778 ;; Special
779 (#x9e0 . ?◆)
780 (#x9e1 . ?▒)
781 (#x9e2 . ?␉)
782 (#x9e3 . ?␌)
783 (#x9e4 . ?␍)
784 (#x9e5 . ?␊)
785 (#x9e8 . ?␤)
786 (#x9e9 . ?␋)
787 (#x9ea . ?┘)
788 (#x9eb . ?┐)
789 (#x9ec . ?┌)
790 (#x9ed . ?└)
791 (#x9ee . ?┼)
792 (#x9ef . ?⎺)
793 (#x9f0 . ?⎻)
794 (#x9f1 . ?─)
795 (#x9f2 . ?⎼)
796 (#x9f3 . ?⎽)
797 (#x9f4 . ?├)
798 (#x9f5 . ?┤)
799 (#x9f6 . ?┴)
800 (#x9f7 . ?┬)
801 (#x9f8 . ?│)
802 ;; Publishing
803 (#xaa1 . ? )
804 (#xaa2 . ? )
805 (#xaa3 . ? )
806 (#xaa4 . ? )
807 (#xaa5 . ? )
808 (#xaa6 . ? )
809 (#xaa7 . ? )
810 (#xaa8 . ? )
811 (#xaa9 . ?—)
812 (#xaaa . ?–)
813 (#xaae . ?…)
814 (#xaaf . ?‥)
815 (#xab0 . ?⅓)
816 (#xab1 . ?⅔)
817 (#xab2 . ?⅕)
818 (#xab3 . ?⅖)
819 (#xab4 . ?⅗)
820 (#xab5 . ?⅘)
821 (#xab6 . ?⅙)
822 (#xab7 . ?⅚)
823 (#xab8 . ?℅)
824 (#xabb . ?‒)
825 (#xabc . ?〈)
826 (#xabe . ?〉)
827 (#xac3 . ?⅛)
828 (#xac4 . ?⅜)
829 (#xac5 . ?⅝)
830 (#xac6 . ?⅞)
831 (#xac9 . ?™)
832 (#xaca . ?☓)
833 (#xacc . ?◁)
834 (#xacd . ?▷)
835 (#xace . ?○)
836 (#xacf . ?▯)
837 (#xad0 . ?‘)
838 (#xad1 . ?’)
839 (#xad2 . ?“)
840 (#xad3 . ?”)
841 (#xad4 . ?℞)
842 (#xad6 . ?′)
843 (#xad7 . ?″)
844 (#xad9 . ?✝)
845 (#xadb . ?▬)
846 (#xadc . ?◀)
847 (#xadd . ?▶)
848 (#xade . ?●)
849 (#xadf . ?▮)
850 (#xae0 . ?◦)
851 (#xae1 . ?▫)
852 (#xae2 . ?▭)
853 (#xae3 . ?△)
854 (#xae4 . ?▽)
855 (#xae5 . ?☆)
856 (#xae6 . ?•)
857 (#xae7 . ?▪)
858 (#xae8 . ?▲)
859 (#xae9 . ?▼)
860 (#xaea . ?☜)
861 (#xaeb . ?☞)
862 (#xaec . ?♣)
863 (#xaed . ?♦)
864 (#xaee . ?♥)
865 (#xaf0 . ?✠)
866 (#xaf1 . ?†)
867 (#xaf2 . ?‡)
868 (#xaf3 . ?✓)
869 (#xaf4 . ?✗)
870 (#xaf5 . ?♯)
871 (#xaf6 . ?♭)
872 (#xaf7 . ?♂)
873 (#xaf8 . ?♀)
874 (#xaf9 . ?☎)
875 (#xafa . ?⌕)
876 (#xafb . ?℗)
877 (#xafc . ?‸)
878 (#xafd . ?‚)
879 (#xafe . ?„)
880 ;; APL
881 (#xba3 . ?<)
882 (#xba6 . ?>)
883 (#xba8 . ?∨)
884 (#xba9 . ?∧)
885 (#xbc0 . ?¯)
886 (#xbc2 . ?⊥)
887 (#xbc3 . ?∩)
888 (#xbc4 . ?⌊)
889 (#xbc6 . ?_)
890 (#xbca . ?∘)
891 (#xbcc . ?⎕)
892 (#xbce . ?⊤)
893 (#xbcf . ?○)
894 (#xbd3 . ?⌈)
895 (#xbd6 . ?∪)
896 (#xbd8 . ?⊃)
897 (#xbda . ?⊂)
898 (#xbdc . ?⊢)
899 (#xbfc . ?⊣)
900 ;; Hebrew
901 (#xcdf . ?‗)
902 (#xce0 . ?א)
903 (#xce1 . ?ב)
904 (#xce2 . ?ג)
905 (#xce3 . ?ד)
906 (#xce4 . ?ה)
907 (#xce5 . ?ו)
908 (#xce6 . ?ז)
909 (#xce7 . ?ח)
910 (#xce8 . ?ט)
911 (#xce9 . ?י)
912 (#xcea . ?ך)
913 (#xceb . ?כ)
914 (#xcec . ?ל)
915 (#xced . ?ם)
916 (#xcee . ?מ)
917 (#xcef . ?ן)
918 (#xcf0 . ?נ)
919 (#xcf1 . ?ס)
920 (#xcf2 . ?ע)
921 (#xcf3 . ?ף)
922 (#xcf4 . ?פ)
923 (#xcf5 . ?ץ)
924 (#xcf6 . ?צ)
925 (#xcf7 . ?ק)
926 (#xcf8 . ?ר)
927 (#xcf9 . ?ש)
928 (#xcfa . ?ת)
929 ;; Thai
930 (#xda1 . ?ก)
931 (#xda2 . ?ข)
932 (#xda3 . ?ฃ)
933 (#xda4 . ?ค)
934 (#xda5 . ?ฅ)
935 (#xda6 . ?ฆ)
936 (#xda7 . ?ง)
937 (#xda8 . ?จ)
938 (#xda9 . ?ฉ)
939 (#xdaa . ?ช)
940 (#xdab . ?ซ)
941 (#xdac . ?ฌ)
942 (#xdad . ?ญ)
943 (#xdae . ?ฎ)
944 (#xdaf . ?ฏ)
945 (#xdb0 . ?ฐ)
946 (#xdb1 . ?ฑ)
947 (#xdb2 . ?ฒ)
948 (#xdb3 . ?ณ)
949 (#xdb4 . ?ด)
950 (#xdb5 . ?ต)
951 (#xdb6 . ?ถ)
952 (#xdb7 . ?ท)
953 (#xdb8 . ?ธ)
954 (#xdb9 . ?น)
955 (#xdba . ?บ)
956 (#xdbb . ?ป)
957 (#xdbc . ?ผ)
958 (#xdbd . ?ฝ)
959 (#xdbe . ?พ)
960 (#xdbf . ?ฟ)
961 (#xdc0 . ?ภ)
962 (#xdc1 . ?ม)
963 (#xdc2 . ?ย)
964 (#xdc3 . ?ร)
965 (#xdc4 . ?ฤ)
966 (#xdc5 . ?ล)
967 (#xdc6 . ?ฦ)
968 (#xdc7 . ?ว)
969 (#xdc8 . ?ศ)
970 (#xdc9 . ?ษ)
971 (#xdca . ?ส)
972 (#xdcb . ?ห)
973 (#xdcc . ?ฬ)
974 (#xdcd . ?อ)
975 (#xdce . ?ฮ)
976 (#xdcf . ?ฯ)
977 (#xdd0 . ?ะ)
978 (#xdd1 . ?ั)
979 (#xdd2 . ?า)
980 (#xdd3 . ?ำ)
981 (#xdd4 . ?ิ)
982 (#xdd5 . ?ี)
983 (#xdd6 . ?ึ)
984 (#xdd7 . ?ื)
985 (#xdd8 . ?ุ)
986 (#xdd9 . ?ู)
987 (#xdda . ?ฺ)
988 (#xddf . ?฿)
989 (#xde0 . ?เ)
990 (#xde1 . ?แ)
991 (#xde2 . ?โ)
992 (#xde3 . ?ใ)
993 (#xde4 . ?ไ)
994 (#xde5 . ?ๅ)
995 (#xde6 . ?ๆ)
996 (#xde7 . ?็)
997 (#xde8 . ?่)
998 (#xde9 . ?้)
999 (#xdea . ?๊)
1000 (#xdeb . ?๋)
1001 (#xdec . ?์)
1002 (#xded . ?ํ)
1003 (#xdf0 . ?๐)
1004 (#xdf1 . ?๑)
1005 (#xdf2 . ?๒)
1006 (#xdf3 . ?๓)
1007 (#xdf4 . ?๔)
1008 (#xdf5 . ?๕)
1009 (#xdf6 . ?๖)
1010 (#xdf7 . ?๗)
1011 (#xdf8 . ?๘)
1012 (#xdf9 . ?๙)
1013 ;; Korean
1014 (#xea1 . ?ㄱ)
1015 (#xea2 . ?ㄲ)
1016 (#xea3 . ?ㄳ)
1017 (#xea4 . ?ㄴ)
1018 (#xea5 . ?ㄵ)
1019 (#xea6 . ?ㄶ)
1020 (#xea7 . ?ㄷ)
1021 (#xea8 . ?ㄸ)
1022 (#xea9 . ?ㄹ)
1023 (#xeaa . ?ㄺ)
1024 (#xeab . ?ㄻ)
1025 (#xeac . ?ㄼ)
1026 (#xead . ?ㄽ)
1027 (#xeae . ?ㄾ)
1028 (#xeaf . ?ㄿ)
1029 (#xeb0 . ?ㅀ)
1030 (#xeb1 . ?ㅁ)
1031 (#xeb2 . ?ㅂ)
1032 (#xeb3 . ?ㅃ)
1033 (#xeb4 . ?ㅄ)
1034 (#xeb5 . ?ㅅ)
1035 (#xeb6 . ?ㅆ)
1036 (#xeb7 . ?ㅇ)
1037 (#xeb8 . ?ㅈ)
1038 (#xeb9 . ?ㅉ)
1039 (#xeba . ?ㅊ)
1040 (#xebb . ?ㅋ)
1041 (#xebc . ?ㅌ)
1042 (#xebd . ?ㅍ)
1043 (#xebe . ?ㅎ)
1044 (#xebf . ?ㅏ)
1045 (#xec0 . ?ㅐ)
1046 (#xec1 . ?ㅑ)
1047 (#xec2 . ?ㅒ)
1048 (#xec3 . ?ㅓ)
1049 (#xec4 . ?ㅔ)
1050 (#xec5 . ?ㅕ)
1051 (#xec6 . ?ㅖ)
1052 (#xec7 . ?ㅗ)
1053 (#xec8 . ?ㅘ)
1054 (#xec9 . ?ㅙ)
1055 (#xeca . ?ㅚ)
1056 (#xecb . ?ㅛ)
1057 (#xecc . ?ㅜ)
1058 (#xecd . ?ㅝ)
1059 (#xece . ?ㅞ)
1060 (#xecf . ?ㅟ)
1061 (#xed0 . ?ㅠ)
1062 (#xed1 . ?ㅡ)
1063 (#xed2 . ?ㅢ)
1064 (#xed3 . ?ㅣ)
1065 (#xed4 . ?ᆨ)
1066 (#xed5 . ?ᆩ)
1067 (#xed6 . ?ᆪ)
1068 (#xed7 . ?ᆫ)
1069 (#xed8 . ?ᆬ)
1070 (#xed9 . ?ᆭ)
1071 (#xeda . ?ᆮ)
1072 (#xedb . ?ᆯ)
1073 (#xedc . ?ᆰ)
1074 (#xedd . ?ᆱ)
1075 (#xede . ?ᆲ)
1076 (#xedf . ?ᆳ)
1077 (#xee0 . ?ᆴ)
1078 (#xee1 . ?ᆵ)
1079 (#xee2 . ?ᆶ)
1080 (#xee3 . ?ᆷ)
1081 (#xee4 . ?ᆸ)
1082 (#xee5 . ?ᆹ)
1083 (#xee6 . ?ᆺ)
1084 (#xee7 . ?ᆻ)
1085 (#xee8 . ?ᆼ)
1086 (#xee9 . ?ᆽ)
1087 (#xeea . ?ᆾ)
1088 (#xeeb . ?ᆿ)
1089 (#xeec . ?ᇀ)
1090 (#xeed . ?ᇁ)
1091 (#xeee . ?ᇂ)
1092 (#xeef . ?ㅭ)
1093 (#xef0 . ?ㅱ)
1094 (#xef1 . ?ㅸ)
1095 (#xef2 . ?ㅿ)
1096 (#xef3 . ?ㆁ)
1097 (#xef4 . ?ㆄ)
1098 (#xef5 . ?ㆆ)
1099 (#xef6 . ?ㆍ)
1100 (#xef7 . ?ㆎ)
1101 (#xef8 . ?ᇫ)
1102 (#xef9 . ?ᇰ)
1103 (#xefa . ?ᇹ)
1104 (#xeff . ?₩)
1105 ;; Latin-5
1106 ;; Latin-6
1107 ;; Latin-7
1108 ;; Latin-8
1109 ;; Latin-9
1110 (#x13bc . ?Œ)
1111 (#x13bd . ?œ)
1112 (#x13be . ?Ÿ)
1113 ;; Currency
1114 (#x20a0 . ?₠)
1115 (#x20a1 . ?₡)
1116 (#x20a2 . ?₢)
1117 (#x20a3 . ?₣)
1118 (#x20a4 . ?₤)
1119 (#x20a5 . ?₥)
1120 (#x20a6 . ?₦)
1121 (#x20a7 . ?₧)
1122 (#x20a8 . ?₨)
1123 (#x20aa . ?₪)
1124 (#x20ab . ?₫)
1125 (#x20ac . ?€)))
1126 (puthash (car pair) (cdr pair) x-keysym-table))
1128 ;; The following keysym codes for graphics are listed in the document
1129 ;; as not having unicodes available:
1131 ;; #x08b1 TOP LEFT SUMMATION Technical
1132 ;; #x08b2 BOTTOM LEFT SUMMATION Technical
1133 ;; #x08b3 TOP VERTICAL SUMMATION CONNECTOR Technical
1134 ;; #x08b4 BOTTOM VERTICAL SUMMATION CONNECTOR Technical
1135 ;; #x08b5 TOP RIGHT SUMMATION Technical
1136 ;; #x08b6 BOTTOM RIGHT SUMMATION Technical
1137 ;; #x08b7 RIGHT MIDDLE SUMMATION Technical
1138 ;; #x0aac SIGNIFICANT BLANK SYMBOL Publish
1139 ;; #x0abd DECIMAL POINT Publish
1140 ;; #x0abf MARKER Publish
1141 ;; #x0acb TRADEMARK SIGN IN CIRCLE Publish
1142 ;; #x0ada HEXAGRAM Publish
1143 ;; #x0aff CURSOR Publish
1144 ;; #x0dde THAI MAIHANAKAT Thai
1147 ;;;; Selections
1149 (define-obsolete-function-alias 'x-cut-buffer-or-selection-value
1150 'x-selection-value "24.1")
1152 ;; Arrange for the kill and yank functions to set and check the clipboard.
1154 (defun x-clipboard-yank ()
1155 "Insert the clipboard contents, or the last stretch of killed text."
1156 (declare (obsolete clipboard-yank "25.1"))
1157 (interactive "*")
1158 (let ((clipboard-text (gui--selection-value-internal 'CLIPBOARD))
1159 (select-enable-clipboard t))
1160 (if (and clipboard-text (> (length clipboard-text) 0))
1161 (kill-new clipboard-text))
1162 (yank)))
1164 (declare-function accelerate-menu "xmenu.c" (&optional frame) t)
1166 (defun x-menu-bar-open (&optional frame)
1167 "Open the menu bar if it is shown.
1168 `popup-menu' is used if it is off."
1169 (interactive "i")
1170 (cond
1171 ((and (not (zerop (or (frame-parameter nil 'menu-bar-lines) 0)))
1172 (fboundp 'accelerate-menu))
1173 (accelerate-menu frame))
1175 (popup-menu (mouse-menu-bar-map) last-nonmenu-event))))
1178 ;;; Window system initialization.
1180 (defun x-win-suspend-error ()
1181 "Report an error when a suspend is attempted.
1182 This returns an error if any Emacs frames are X frames."
1183 ;; Don't allow suspending if any of the frames are X frames.
1184 (if (memq 'x (mapcar #'window-system (frame-list)))
1185 (error "Cannot suspend Emacs while running under X")))
1187 (defvar x-initialized nil
1188 "Non-nil if the X window system has been initialized.")
1190 (declare-function x-open-connection "xfns.c"
1191 (display &optional xrm-string must-succeed))
1192 (declare-function x-server-max-request-size "xfns.c" (&optional terminal))
1193 (declare-function x-get-resource "frame.c"
1194 (attribute class &optional component subclass))
1195 (declare-function x-parse-geometry "frame.c" (string))
1196 (defvar x-resource-name)
1197 (defvar x-display-name)
1198 (defvar x-command-line-resources)
1200 (cl-defmethod window-system-initialization (&context (window-system x)
1201 &optional display)
1202 "Initialize Emacs for X frames and open the first connection to an X server."
1203 (cl-assert (not x-initialized))
1205 ;; Make sure we have a valid resource name.
1206 (or (stringp x-resource-name)
1207 (let (i)
1208 (setq x-resource-name (invocation-name))
1210 ;; Change any . or * characters in x-resource-name to hyphens,
1211 ;; so as not to choke when we use it in X resource queries.
1212 (while (setq i (string-match "[.*]" x-resource-name))
1213 (aset x-resource-name i ?-))))
1215 (x-open-connection (or display
1216 (setq x-display-name (or (getenv "DISPLAY" (selected-frame))
1217 (getenv "DISPLAY"))))
1218 x-command-line-resources
1219 ;; Exit Emacs with fatal error if this fails and we
1220 ;; are the initial display.
1221 (eq initial-window-system 'x))
1223 ;; Create the default fontset.
1224 (create-default-fontset)
1226 ;; Create the standard fontset.
1227 (condition-case err
1228 (create-fontset-from-fontset-spec standard-fontset-spec t)
1229 (error (display-warning
1230 'initialization
1231 (format "Creation of the standard fontset failed: %s" err)
1232 :error)))
1234 ;; Create fontset specified in X resources "Fontset-N" (N is 0, 1, ...).
1235 (create-fontset-from-x-resource)
1237 ;; Set scroll bar mode to right if set by X resources. Default is left.
1238 (if (equal (x-get-resource "verticalScrollBars" "ScrollBars") "right")
1239 (customize-set-variable 'scroll-bar-mode 'right))
1241 ;; Apply a geometry resource to the initial frame. Put it at the end
1242 ;; of the alist, so that anything specified on the command line takes
1243 ;; precedence.
1244 (let* ((res-geometry (x-get-resource "geometry" "Geometry"))
1245 parsed)
1246 (if res-geometry
1247 (progn
1248 (setq parsed (x-parse-geometry res-geometry))
1249 ;; If the resource specifies a position,
1250 ;; call the position and size "user-specified".
1251 (if (or (assq 'top parsed) (assq 'left parsed))
1252 (setq parsed (cons '(user-position . t)
1253 (cons '(user-size . t) parsed))))
1254 ;; All geometry parms apply to the initial frame.
1255 (setq initial-frame-alist (append initial-frame-alist parsed))
1256 ;; The size parms apply to all frames. Don't set it if there are
1257 ;; sizes there already (from command line).
1258 (if (and (assq 'height parsed)
1259 (not (assq 'height default-frame-alist)))
1260 (setq default-frame-alist
1261 (cons (cons 'height (cdr (assq 'height parsed)))
1262 default-frame-alist)))
1263 (if (and (assq 'width parsed)
1264 (not (assq 'width default-frame-alist)))
1265 (setq default-frame-alist
1266 (cons (cons 'width (cdr (assq 'width parsed)))
1267 default-frame-alist))))))
1269 ;; Check the reverseVideo resource.
1270 (let ((case-fold-search t))
1271 (let ((rv (x-get-resource "reverseVideo" "ReverseVideo")))
1272 (if (and rv
1273 (string-match "^\\(true\\|yes\\|on\\)$" rv))
1274 (setq default-frame-alist
1275 (cons '(reverse . t) default-frame-alist)))))
1277 ;; Set x-selection-timeout, measured in milliseconds.
1278 (let ((res-selection-timeout (x-get-resource "selectionTimeout"
1279 "SelectionTimeout")))
1280 (setq x-selection-timeout
1281 (if res-selection-timeout
1282 (string-to-number res-selection-timeout)
1283 5000)))
1285 ;; Don't let Emacs suspend under X.
1286 (add-hook 'suspend-hook 'x-win-suspend-error)
1288 ;; During initialization, we defer sending size hints to the window
1289 ;; manager, because that can induce a race condition:
1290 ;; http://lists.gnu.org/archive/html/emacs-devel/2008-10/msg00033.html
1291 ;; Send the size hints once initialization is done.
1292 (add-hook 'after-init-hook 'x-wm-set-size-hint)
1294 ;; Turn off window-splitting optimization; X is usually fast enough
1295 ;; that this is only annoying.
1296 (setq split-window-keep-point t)
1298 ;; Motif direct handling of f10 wasn't working right,
1299 ;; So temporarily we've turned it off in lwlib-Xm.c
1300 ;; and turned the Emacs f10 back on.
1301 ;; ;; Motif normally handles f10 itself, so don't try to handle it a second time.
1302 ;; (if (featurep 'motif)
1303 ;; (global-set-key [f10] 'ignore))
1305 ;; Enable CLIPBOARD copy/paste through menu bar commands.
1306 (menu-bar-enable-clipboard)
1308 ;; ;; Override Paste so it looks at CLIPBOARD first.
1309 ;; (define-key menu-bar-edit-menu [paste]
1310 ;; (append '(menu-item "Paste" x-clipboard-yank
1311 ;; :enable (not buffer-read-only)
1312 ;; :help "Paste (yank) text most recently cut/copied")
1313 ;; nil))
1315 (x-apply-session-resources)
1316 (setq x-initialized t))
1318 (declare-function x-own-selection-internal "xselect.c"
1319 (selection value &optional frame))
1320 (declare-function x-disown-selection-internal "xselect.c"
1321 (selection &optional time-object terminal))
1322 (declare-function x-selection-owner-p "xselect.c"
1323 (&optional selection terminal))
1324 (declare-function x-selection-exists-p "xselect.c"
1325 (&optional selection terminal))
1326 (declare-function x-get-selection-internal "xselect.c"
1327 (selection-symbol target-type &optional time-stamp terminal))
1329 (add-to-list 'display-format-alist '("\\`[^:]*:[0-9]+\\(\\.[0-9]+\\)?\\'" . x))
1330 (cl-defmethod handle-args-function (args &context (window-system x))
1331 (x-handle-args args))
1333 (cl-defmethod frame-creation-function (params &context (window-system x))
1334 (x-create-frame-with-faces params))
1336 (cl-defmethod gui-backend-set-selection (selection value
1337 &context (window-system x))
1338 (if value (x-own-selection-internal selection value)
1339 (x-disown-selection-internal selection)))
1341 (cl-defmethod gui-backend-selection-owner-p (selection
1342 &context (window-system x))
1343 (x-selection-owner-p selection))
1345 (cl-defmethod gui-backend-selection-exists-p (selection
1346 &context (window-system x))
1347 (x-selection-exists-p selection))
1349 (cl-defmethod gui-backend-get-selection (selection-symbol target-type
1350 &context (window-system x)
1351 &optional time-stamp terminal)
1352 (x-get-selection-internal selection-symbol target-type time-stamp terminal))
1354 ;; Initiate drag and drop
1355 (add-hook 'after-make-frame-functions 'x-dnd-init-frame)
1356 (define-key special-event-map [drag-n-drop] 'x-dnd-handle-drag-n-drop-event)
1358 (defcustom x-gtk-stock-map
1359 (mapcar (lambda (arg)
1360 (cons (purecopy (car arg)) (purecopy (cdr arg))))
1362 ("etc/images/new" . ("document-new" "gtk-new"))
1363 ("etc/images/open" . ("document-open" "gtk-open"))
1364 ("etc/images/diropen" . "n:system-file-manager")
1365 ("etc/images/close" . ("window-close" "gtk-close"))
1366 ("etc/images/save" . ("document-save" "gtk-save"))
1367 ("etc/images/saveas" . ("document-save-as" "gtk-save-as"))
1368 ("etc/images/undo" . ("edit-undo" "gtk-undo"))
1369 ("etc/images/cut" . ("edit-cut" "gtk-cut"))
1370 ("etc/images/copy" . ("edit-copy" "gtk-copy"))
1371 ("etc/images/paste" . ("edit-paste" "gtk-paste"))
1372 ("etc/images/search" . ("edit-find" "gtk-find"))
1373 ("etc/images/print" . ("document-print" "gtk-print"))
1374 ("etc/images/preferences" . ("preferences-system" "gtk-preferences"))
1375 ("etc/images/help" . ("help-browser" "gtk-help"))
1376 ("etc/images/left-arrow" . ("go-previous" "gtk-go-back"))
1377 ("etc/images/right-arrow" . ("go-next" "gtk-go-forward"))
1378 ("etc/images/home" . ("go-home" "gtk-home"))
1379 ("etc/images/jump-to" . ("go-jump" "gtk-jump-to"))
1380 ("etc/images/index" . "gtk-index")
1381 ("etc/images/exit" . ("application-exit" "gtk-quit"))
1382 ("etc/images/cancel" . "gtk-cancel")
1383 ("etc/images/info" . ("dialog-information" "gtk-info"))
1384 ("etc/images/bookmark_add" . "n:bookmark_add")
1385 ;; Used in Gnus and/or MH-E:
1386 ("etc/images/attach" . "gtk-attach")
1387 ("etc/images/connect" . "gtk-connect")
1388 ("etc/images/contact" . "gtk-contact")
1389 ("etc/images/delete" . ("edit-delete" "gtk-delete"))
1390 ("etc/images/describe" . ("document-properties" "gtk-properties"))
1391 ("etc/images/disconnect" . "gtk-disconnect")
1392 ;; ("etc/images/exit" . "gtk-exit")
1393 ("etc/images/lock-broken" . "gtk-lock_broken")
1394 ("etc/images/lock-ok" . "gtk-lock_ok")
1395 ("etc/images/lock" . "gtk-lock")
1396 ("etc/images/next-page" . "gtk-next-page")
1397 ("etc/images/refresh" . ("view-refresh" "gtk-refresh"))
1398 ("etc/images/sort-ascending" . ("view-sort-ascending" "gtk-sort-ascending"))
1399 ("etc/images/sort-column-ascending" . "gtk-sort-column-ascending")
1400 ("etc/images/sort-criteria" . "gtk-sort-criteria")
1401 ("etc/images/sort-descending" . ("view-sort-descending"
1402 "gtk-sort-descending"))
1403 ("etc/images/sort-row-ascending" . "gtk-sort-row-ascending")
1404 ("images/gnus/toggle-subscription" . "gtk-task-recurring")
1405 ("images/mail/compose" . "gtk-mail-compose")
1406 ("images/mail/copy" . "gtk-mail-copy")
1407 ("images/mail/forward" . "gtk-mail-forward")
1408 ("images/mail/inbox" . "gtk-inbox")
1409 ("images/mail/move" . "gtk-mail-move")
1410 ("images/mail/not-spam" . "gtk-not-spam")
1411 ("images/mail/outbox" . "gtk-outbox")
1412 ("images/mail/reply-all" . "gtk-mail-reply-to-all")
1413 ("images/mail/reply" . "gtk-mail-reply")
1414 ("images/mail/save-draft" . "gtk-mail-handling")
1415 ("images/mail/send" . "gtk-mail-send")
1416 ("images/mail/spam" . "gtk-spam")
1417 ;; Used for GDB Graphical Interface
1418 ("images/gud/break" . "gtk-no")
1419 ("images/gud/recstart" . ("media-record" "gtk-media-record"))
1420 ("images/gud/recstop" . ("media-playback-stop" "gtk-media-stop"))
1421 ;; No themed versions available:
1422 ;; mail/preview (combining stock_mail and stock_zoom)
1423 ;; mail/save (combining stock_mail, stock_save and stock_convert)
1425 "How icons for tool bars are mapped to Gtk+ stock items.
1426 Emacs must be compiled with the Gtk+ toolkit for this to have any effect.
1427 A value that begins with n: denotes a named icon instead of a stock icon."
1428 :version "22.2"
1429 :type '(choice (repeat
1430 (choice symbol
1431 (cons (string :tag "Emacs icon")
1432 (choice (group (string :tag "Named")
1433 (string :tag "Stock"))
1434 (string :tag "Stock/named"))))))
1435 :group 'x)
1437 (defcustom icon-map-list '(x-gtk-stock-map)
1438 "A list of alists that map icon file names to stock/named icons.
1439 The alists are searched in the order they appear. The first match is used.
1440 The keys in the alists are file names without extension and with two directory
1441 components. For example, to map /usr/share/emacs/22.1.1/etc/images/open.xpm
1442 to stock item gtk-open, use:
1444 (\"etc/images/open\" . \"gtk-open\")
1446 Themes also have named icons. To map to one of those, use n: before the name:
1448 (\"etc/images/diropen\" . \"n:system-file-manager\")
1450 The list elements are either the symbol name for the alist or the
1451 alist itself.
1453 If you don't want stock icons, set the variable to nil."
1454 :version "22.2"
1455 :type '(choice (const :tag "Don't use stock icons" nil)
1456 (repeat (choice symbol
1457 (cons (string :tag "Emacs icon")
1458 (string :tag "Stock/named")))))
1459 :group 'x)
1461 (defconst x-gtk-stock-cache (make-hash-table :weakness t :test 'equal))
1463 (defun x-gtk-map-stock (file)
1464 "Map icon with file name FILE to a Gtk+ stock name.
1465 This uses `icon-map-list' to map icon file names to stock icon names."
1466 (when (stringp file)
1467 (or (gethash file x-gtk-stock-cache)
1468 (puthash
1469 file
1470 (save-match-data
1471 (let* ((file-sans (file-name-sans-extension file))
1472 (key (and (string-match "/\\([^/]+/[^/]+/[^/]+$\\)"
1473 file-sans)
1474 (match-string 1 file-sans)))
1475 (icon-map icon-map-list)
1476 elem value)
1477 (while (and (null value) icon-map)
1478 (setq elem (car icon-map)
1479 value (assoc-string (or key file-sans)
1480 (if (symbolp elem)
1481 (symbol-value elem)
1482 elem))
1483 icon-map (cdr icon-map)))
1484 (and value (cdr value))))
1485 x-gtk-stock-cache))))
1487 (global-set-key [XF86WakeUp] 'ignore)
1489 (provide 'x-win)
1490 (provide 'term/x-win)
1492 ;;; x-win.el ends here