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