Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
[emacs.git] / lisp / term / x-win.el
blobc32566181e580d120ea4de88b4bfdc9f766fcd9a
1 ;;; x-win.el --- parse relevant switches and set up for X -*-coding: utf-8; lexical-binding:t -*-
3 ;; Copyright (C) 1993-1994, 2001-2015 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 (eql 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 (eql x)))
1331 (x-handle-args args))
1333 (cl-defmethod frame-creation-function (params &context (window-system (eql x)))
1334 (x-create-frame-with-faces params))
1336 (cl-defmethod gui-backend-set-selection (selection value
1337 &context (window-system (eql 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 (eql x)))
1343 (x-selection-owner-p selection))
1345 (cl-defmethod gui-backend-selection-exists-p (selection
1346 &context (window-system (eql x)))
1347 (x-selection-exists-p selection))
1349 (cl-defmethod gui-backend-get-selection (selection-symbol target-type
1350 &context (window-system (eql 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" . ("ocument-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)
1491 ;;; x-win.el ends here