1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
|
;;; x-win.el --- parse relevant switches and set up for X -*- lexical-binding:t -*-
;; Copyright (C) 1993-1994, 2001-2015 Free Software Foundation, Inc.
;; Author: FSF
;; Keywords: terminals, i18n
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; X-win.el: this file defines functions to initialize the X window
;; system and process X-specific command line parameters before
;; creating the first X frame.
;; Beginning in Emacs 23, the act of loading this file should not have
;; the side effect of initializing the window system or processing
;; command line arguments (this file is now loaded in loadup.el). See
;; `handle-args-function' and `window-system-initialization' for more details.
;; startup.el will then examine startup files, and eventually call the hooks
;; which create the first window(s).
;;; Code:
;; These are the standard X switches from the Xt Initialize.c file of
;; Release 4.
;; Command line Resource Manager string
;; +rv *reverseVideo
;; +synchronous *synchronous
;; -background *background
;; -bd *borderColor
;; -bg *background
;; -bordercolor *borderColor
;; -borderwidth .borderWidth
;; -bw .borderWidth
;; -display .display
;; -fg *foreground
;; -fn *font
;; -font *font
;; -foreground *foreground
;; -geometry .geometry
;; -iconic .iconic
;; -name .name
;; -reverse *reverseVideo
;; -rv *reverseVideo
;; -selectionTimeout .selectionTimeout
;; -synchronous *synchronous
;; -xrm
;; An alist of X options and the function which handles them. See
;; ../startup.el.
(eval-when-compile (require 'cl-lib))
(if (not (fboundp 'x-create-frame))
(error "%s: Loading x-win.el but not compiled for X" (invocation-name)))
(require 'term/common-win)
(require 'frame)
(require 'mouse)
(require 'scroll-bar)
(require 'faces)
(require 'select)
(require 'menu-bar)
(require 'fontset)
(require 'x-dnd)
(defvar x-invocation-args)
(defvar x-keysym-table)
(defvar x-selection-timeout)
(defvar x-session-id)
(defvar x-session-previous-id)
(defun x-handle-no-bitmap-icon (_switch)
(setq default-frame-alist (cons '(icon-type) default-frame-alist)))
;; Handle the --parent-id option.
(defun x-handle-parent-id (switch)
(or (consp x-invocation-args)
(error "%s: missing argument to `%s' option" (invocation-name) switch))
(setq initial-frame-alist (cons
(cons 'parent-id
(string-to-number (car x-invocation-args)))
initial-frame-alist)
x-invocation-args (cdr x-invocation-args)))
;; Handle the --smid switch. This is used by the session manager
;; to give us back our session id we had on the previous run.
(defun x-handle-smid (switch)
(or (consp x-invocation-args)
(error "%s: missing argument to `%s' option" (invocation-name) switch))
(setq x-session-previous-id (car x-invocation-args)
x-invocation-args (cdr x-invocation-args)))
(defvar emacs-save-session-functions nil
"Special hook run when a save-session event occurs.
The functions do not get any argument.
Functions can return non-nil to inform the session manager that the
window system shutdown should be aborted.
See also `emacs-session-save'.")
(defun emacs-session-filename (session-id)
"Construct a filename to save the session in based on SESSION-ID.
Return a filename in `user-emacs-directory', unless the session file
already exists in the home directory."
(let ((basename (concat "session." session-id)))
(locate-user-emacs-file basename
(concat ".emacs-" basename))))
(defun emacs-session-save ()
"This function is called when the window system is shutting down.
If this function returns non-nil, the window system shutdown is canceled.
When a session manager tells Emacs that the window system is shutting
down, this function is called. It calls the functions in the hook
`emacs-save-session-functions'. Functions are called with the current
buffer set to a temporary buffer. Functions should use `insert' to insert
lisp code to save the session state. The buffer is saved in a file in the
home directory of the user running Emacs. The file is evaluated when
Emacs is restarted by the session manager.
If any of the functions returns non-nil, no more functions are called
and this function returns non-nil. This will inform the session manager
that it should abort the window system shutdown."
(let ((filename (emacs-session-filename x-session-id))
(buf (get-buffer-create (concat " *SES " x-session-id))))
(when (file-exists-p filename)
(delete-file filename))
(with-current-buffer buf
(let ((cancel-shutdown (condition-case nil
;; A return of t means cancel the shutdown.
(run-hook-with-args-until-success
'emacs-save-session-functions)
(error t))))
(unless cancel-shutdown
(write-file filename))
(kill-buffer buf)
cancel-shutdown))))
(defun emacs-session-restore (previous-session-id)
"Restore the Emacs session if started by a session manager.
The file saved by `emacs-session-save' is evaluated and deleted if it
exists."
(let ((filename (emacs-session-filename previous-session-id)))
(when (file-exists-p filename)
(load-file filename)
(delete-file filename)
(message "Restored session data"))))
;;
;; Standard X cursor shapes, courtesy of Mr. Fox, who wanted ALL of them.
;;
(defconst x-pointer-X-cursor 0)
(defconst x-pointer-arrow 2)
(defconst x-pointer-based-arrow-down 4)
(defconst x-pointer-based-arrow-up 6)
(defconst x-pointer-boat 8)
(defconst x-pointer-bogosity 10)
(defconst x-pointer-bottom-left-corner 12)
(defconst x-pointer-bottom-right-corner 14)
(defconst x-pointer-bottom-side 16)
(defconst x-pointer-bottom-tee 18)
(defconst x-pointer-box-spiral 20)
(defconst x-pointer-center-ptr 22)
(defconst x-pointer-circle 24)
(defconst x-pointer-clock 26)
(defconst x-pointer-coffee-mug 28)
(defconst x-pointer-cross 30)
(defconst x-pointer-cross-reverse 32)
(defconst x-pointer-crosshair 34)
(defconst x-pointer-diamond-cross 36)
(defconst x-pointer-dot 38)
(defconst x-pointer-dotbox 40)
(defconst x-pointer-double-arrow 42)
(defconst x-pointer-draft-large 44)
(defconst x-pointer-draft-small 46)
(defconst x-pointer-draped-box 48)
(defconst x-pointer-exchange 50)
(defconst x-pointer-fleur 52)
(defconst x-pointer-gobbler 54)
(defconst x-pointer-gumby 56)
(defconst x-pointer-hand1 58)
(defconst x-pointer-hand2 60)
(defconst x-pointer-heart 62)
(defconst x-pointer-icon 64)
(defconst x-pointer-iron-cross 66)
(defconst x-pointer-left-ptr 68)
(defconst x-pointer-left-side 70)
(defconst x-pointer-left-tee 72)
(defconst x-pointer-leftbutton 74)
(defconst x-pointer-ll-angle 76)
(defconst x-pointer-lr-angle 78)
(defconst x-pointer-man 80)
(defconst x-pointer-middlebutton 82)
(defconst x-pointer-mouse 84)
(defconst x-pointer-pencil 86)
(defconst x-pointer-pirate 88)
(defconst x-pointer-plus 90)
(defconst x-pointer-question-arrow 92)
(defconst x-pointer-right-ptr 94)
(defconst x-pointer-right-side 96)
(defconst x-pointer-right-tee 98)
(defconst x-pointer-rightbutton 100)
(defconst x-pointer-rtl-logo 102)
(defconst x-pointer-sailboat 104)
(defconst x-pointer-sb-down-arrow 106)
(defconst x-pointer-sb-h-double-arrow 108)
(defconst x-pointer-sb-left-arrow 110)
(defconst x-pointer-sb-right-arrow 112)
(defconst x-pointer-sb-up-arrow 114)
(defconst x-pointer-sb-v-double-arrow 116)
(defconst x-pointer-shuttle 118)
(defconst x-pointer-sizing 120)
(defconst x-pointer-spider 122)
(defconst x-pointer-spraycan 124)
(defconst x-pointer-star 126)
(defconst x-pointer-target 128)
(defconst x-pointer-tcross 130)
(defconst x-pointer-top-left-arrow 132)
(defconst x-pointer-top-left-corner 134)
(defconst x-pointer-top-right-corner 136)
(defconst x-pointer-top-side 138)
(defconst x-pointer-top-tee 140)
(defconst x-pointer-trek 142)
(defconst x-pointer-ul-angle 144)
(defconst x-pointer-umbrella 146)
(defconst x-pointer-ur-angle 148)
(defconst x-pointer-watch 150)
(defconst x-pointer-xterm 152)
(defconst x-pointer-invisible 255)
;;;; Keysyms
(defun vendor-specific-keysyms (vendor)
"Return the appropriate value of `system-key-alist' for VENDOR.
VENDOR is a string containing the name of the X Server's vendor,
as returned by `x-server-vendor'."
(cond ((or (string-equal vendor "Hewlett-Packard Incorporated")
(string-equal vendor "Hewlett-Packard Company"))
'(( 168 . mute-acute)
( 169 . mute-grave)
( 170 . mute-asciicircum)
( 171 . mute-diaeresis)
( 172 . mute-asciitilde)
( 175 . lira)
( 190 . guilder)
( 252 . block)
( 256 . longminus)
(65388 . reset)
(65389 . system)
(65390 . user)
(65391 . clearline)
(65392 . insertline)
(65393 . deleteline)
(65394 . insertchar)
(65395 . deletechar)
(65396 . backtab)
(65397 . kp-backtab)))
;; Fixme: What about non-X11/NeWS sun server?
((or (string-equal vendor "X11/NeWS - Sun Microsystems Inc.")
(string-equal vendor "X Consortium"))
'((392976 . f36)
(392977 . f37)
(393056 . req)
;; These are for Sun under X11R6
(393072 . props)
(393073 . front)
(393074 . copy)
(393075 . open)
(393076 . paste)
(393077 . cut)))
(t
;; This is used by DEC's X server.
'((65280 . remove)))))
;; Latin-1
(let ((i 160))
(while (< i 256)
(puthash i i x-keysym-table)
(setq i (1+ i))))
;; Table from Kuhn's proposed additions to the `KEYSYM Encoding'
;; appendix to the X protocol definition.
(dolist
(pair
'(
;; Latin-2
(#x1a1 . ?Ą)
(#x1a2 . ?˘)
(#x1a3 . ?Ł)
(#x1a5 . ?Ľ)
(#x1a6 . ?Ś)
(#x1a9 . ?Š)
(#x1aa . ?Ş)
(#x1ab . ?Ť)
(#x1ac . ?Ź)
(#x1ae . ?Ž)
(#x1af . ?Ż)
(#x1b1 . ?ą)
(#x1b2 . ?˛)
(#x1b3 . ?ł)
(#x1b5 . ?ľ)
(#x1b6 . ?ś)
(#x1b7 . ?ˇ)
(#x1b9 . ?š)
(#x1ba . ?ş)
(#x1bb . ?ť)
(#x1bc . ?ź)
(#x1bd . ?˝)
(#x1be . ?ž)
(#x1bf . ?ż)
(#x1c0 . ?Ŕ)
(#x1c3 . ?Ă)
(#x1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. ?→)
(#x8fe . ?↓)
;; Special
(#x9e0 . ?◆)
(#x9e1 . ?▒)
(#x9e2 . ?␉)
(#x9e3 . ?␌)
(#x9e4 . ?␍)
(#x9e5 . ?␊)
(#x9e8 . ?)
(#x9e9 . ?␋)
(#x9ea . ?┘)
(#x9eb . ?┐)
(#x9ec . ?┌)
(#x9ed . ?└)
(#x9ee . ?┼)
(#x9ef . ?⎺)
(#x9f0 . ?⎻)
(#x9f1 . ?─)
(#x9f2 . ?⎼)
(#x9f3 . ?⎽)
(#x9f4 . ?├)
(#x9f5 . ?┤)
(#x9f6 . ?┴)
(#x9f7 . ?┬)
(#x9f8 . ?│)
;; Publishing
(#xaa1 . ? )
(#xaa2 . ? )
(#xaa3 . ? )
(#xaa4 . ? )
(#xaa5 . ? )
(#xaa6 . ? )
(#xaa7 . ? )
(#xaa8 . ? )
(#xaa9 . ?—)
(#xaaa . ?–)
(#xaae . ?…)
(#xaaf . ?‥)
(#xab0 . ?⅓)
(#xab1 . ?⅔)
(#xab2 . ?⅕)
(#xab3 . ?⅖)
(#xab4 . ?⅗)
(#xab5 . ?⅘)
(#xab6 . ?⅙)
(#xab7 . ?⅚)
(#xab8 . ?℅)
(#xabb . ?‒)
(#xabc . ?〈)
(#xabe . ?〉)
(#xac3 . ?⅛)
(#xac4 . ?⅜)
(#xac5 . ?⅝)
(#xac6 . ?⅞)
(#xac9 . ?™)
(#xaca . ?☓)
(#xacc . ?◁)
(#xacd . ?▷)
(#xace . ?○)
(#xacf . ?▯)
(#xad0 . ?‘)
(#xad1 . ?’)
(#xad2 . ?“)
(#xad3 . ?”)
(#xad4 . ?℞)
(#xad6 . ?′)
(#xad7 . ?″)
(#xad9 . ?✝)
(#xadb . ?▬)
(#xadc . ?◀)
(#xadd . ?▶)
(#xade . ?●)
(#xadf . ?▮)
(#xae0 . ?◦)
(#xae1 . ?▫)
(#xae2 . ?▭)
(#xae3 . ?△)
(#xae4 . ?▽)
(#xae5 . ?☆)
(#xae6 . ?•)
(#xae7 . ?▪)
(#xae8 . ?▲)
(#xae9 . ?▼)
(#xaea . ?☜)
(#xaeb . ?☞)
(#xaec . ?♣)
(#xaed . ?♦)
(#xaee . ?♥)
(#xaf0 . ?✠)
(#xaf1 . ?†)
(#xaf2 . ?‡)
(#xaf3 . ?✓)
(#xaf4 . ?✗)
(#xaf5 . ?♯)
(#xaf6 . ?♭)
(#xaf7 . ?♂)
(#xaf8 . ?♀)
(#xaf9 . ?☎)
(#xafa . ?⌕)
(#xafb . ?℗)
(#xafc . ?‸)
(#xafd . ?‚)
(#xafe . ?„)
;; APL
(#xba3 . ?<)
(#xba6 . ?>)
(#xba8 . ?∨)
(#xba9 . ?∧)
(#xbc0 . ?¯)
(#xbc2 . ?⊥)
(#xbc3 . ?∩)
(#xbc4 . ?⌊)
(#xbc6 . ?_)
(#xbca . ?∘)
(#xbcc . ?⎕)
(#xbce . ?⊤)
(#xbcf . ?○)
(#xbd3 . ?⌈)
(#xbd6 . ?∪)
(#xbd8 . ?⊃)
(#xbda . ?⊂)
(#xbdc . ?⊢)
(#xbfc . ?⊣)
;; Hebrew
(#xcdf . ?‗)
(#xce0 . ?א)
(#xce1 . ?ב)
(#xce2 . ?ג)
(#xce3 . ?ד)
(#xce4 . ?ה)
(#xce5 . ?ו)
(#xce6 . ?ז)
(#xce7 . ?ח)
(#xce8 . ?ט)
(#xce9 . ?י)
(#xcea . ?ך)
(#xceb . ?כ)
(#xcec . ?ל)
(#xced . ?ם)
(#xcee . ?מ)
(#xcef . ?ן)
(#xcf0 . ?נ)
(#xcf1 . ?ס)
(#xcf2 . ?ע)
(#xcf3 . ?ף)
(#xcf4 . ?פ)
(#xcf5 . ?ץ)
(#xcf6 . ?צ)
(#xcf7 . ?ק)
(#xcf8 . ?ר)
(#xcf9 . ?ש)
(#xcfa . ?ת)
;; Thai
(#xda1 . ?ก)
(#xda2 . ?ข)
(#xda3 . ?ฃ)
(#xda4 . ?ค)
(#xda5 . ?ฅ)
(#xda6 . ?ฆ)
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?ᆲ)
(#xedf . ?ᆳ)
(#xee0 . ?ᆴ)
(#xee1 . ?ᆵ)
(#xee2 . ?ᆶ)
(#xee3 . ?ᆷ)
(#xee4 . ?ᆸ)
(#xee5 . ?ᆹ)
(#xee6 . ?ᆺ)
(#xee7 . ?ᆻ)
(#xee8 . ?ᆼ)
(#xee9 . ?ᆽ)
(#xeea . ?ᆾ)
(#xeeb . ?ᆿ)
(#xeec . ?ᇀ)
(#xeed . ?ᇁ)
(#xeee . ?ᇂ)
(#xeef . ?ㅭ)
(#xef0 . ?ㅱ)
(#xef1 . ?ㅸ)
(#xef2 . ?ㅿ)
(#xef3 . ?ㆁ)
(#xef4 . ?ㆄ)
(#xef5 . ?ㆆ)
(#xef6 . ?ㆍ)
(#xef7 . ?ㆎ)
(#xef8 . ?ᇫ)
(#xef9 . ?ᇰ)
(#xefa . ?ᇹ)
(#xeff . ?₩)
;; Latin-5
;; Latin-6
;; Latin-7
;; Latin-8
;; Latin-9
(#x13bc . ?Œ)
(#x13bd . ?œ)
(#x13be . ?Ÿ)
;; Currency
(#x20a0 . ?₠)
(#x20a1 . ?₡)
(#x20a2 . ?₢)
(#x20a3 . ?₣)
(#x20a4 . ?₤)
(#x20a5 . ?₥)
(#x20a6 . ?₦)
(#x20a7 . ?₧)
(#x20a8 . ?₨)
(#x20aa . ?₪)
(#x20ab . ?₫)
(#x20ac . ?€)))
(puthash (car pair) (cdr pair) x-keysym-table))
;; The following keysym codes for graphics are listed in the document
;; as not having unicodes available:
;; #x08b1 TOP LEFT SUMMATION Technical
;; #x08b2 BOTTOM LEFT SUMMATION Technical
;; #x08b3 TOP VERTICAL SUMMATION CONNECTOR Technical
;; #x08b4 BOTTOM VERTICAL SUMMATION CONNECTOR Technical
;; #x08b5 TOP RIGHT SUMMATION Technical
;; #x08b6 BOTTOM RIGHT SUMMATION Technical
;; #x08b7 RIGHT MIDDLE SUMMATION Technical
;; #x0aac SIGNIFICANT BLANK SYMBOL Publish
;; #x0abd DECIMAL POINT Publish
;; #x0abf MARKER Publish
;; #x0acb TRADEMARK SIGN IN CIRCLE Publish
;; #x0ada HEXAGRAM Publish
;; #x0aff CURSOR Publish
;; #x0dde THAI MAIHANAKAT Thai
;;;; Selections
(define-obsolete-function-alias 'x-cut-buffer-or-selection-value
'x-selection-value "24.1")
;; Arrange for the kill and yank functions to set and check the clipboard.
(defun x-clipboard-yank ()
"Insert the clipboard contents, or the last stretch of killed text."
(declare (obsolete clipboard-yank "25.1"))
(interactive "*")
(let ((clipboard-text (gui--selection-value-internal 'CLIPBOARD))
(select-enable-clipboard t))
(if (and clipboard-text (> (length clipboard-text) 0))
(kill-new clipboard-text))
(yank)))
(declare-function accelerate-menu "xmenu.c" (&optional frame) t)
(defun x-menu-bar-open (&optional frame)
"Open the menu bar if it is shown.
`popup-menu' is used if it is off."
(interactive "i")
(cond
((and (not (zerop (or (frame-parameter nil 'menu-bar-lines) 0)))
(fboundp 'accelerate-menu))
(accelerate-menu frame))
(t
(popup-menu (mouse-menu-bar-map) last-nonmenu-event))))
;;; Window system initialization.
(defun x-win-suspend-error ()
"Report an error when a suspend is attempted.
This returns an error if any Emacs frames are X frames."
;; Don't allow suspending if any of the frames are X frames.
(if (memq 'x (mapcar #'window-system (frame-list)))
(error "Cannot suspend Emacs while running under X")))
(defvar x-initialized nil
"Non-nil if the X window system has been initialized.")
(declare-function x-open-connection "xfns.c"
(display &optional xrm-string must-succeed))
(declare-function x-server-max-request-size "xfns.c" (&optional terminal))
(declare-function x-get-resource "frame.c"
(attribute class &optional component subclass))
(declare-function x-parse-geometry "frame.c" (string))
(defvar x-resource-name)
(defvar x-display-name)
(defvar x-command-line-resources)
(cl-defmethod window-system-initialization (&context (window-system x)
&optional display)
"Initialize Emacs for X frames and open the first connection to an X server."
(cl-assert (not x-initialized))
;; Make sure we have a valid resource name.
(or (stringp x-resource-name)
(let (i)
(setq x-resource-name (invocation-name))
;; Change any . or * characters in x-resource-name to hyphens,
;; so as not to choke when we use it in X resource queries.
(while (setq i (string-match "[.*]" x-resource-name))
(aset x-resource-name i ?-))))
(x-open-connection (or display
(setq x-display-name (or (getenv "DISPLAY" (selected-frame))
(getenv "DISPLAY"))))
x-command-line-resources
;; Exit Emacs with fatal error if this fails and we
;; are the initial display.
(eq initial-window-system 'x))
;; Create the default fontset.
(create-default-fontset)
;; Create the standard fontset.
(condition-case err
(create-fontset-from-fontset-spec standard-fontset-spec t)
(error (display-warning
'initialization
(format "Creation of the standard fontset failed: %s" err)
:error)))
;; Create fontset specified in X resources "Fontset-N" (N is 0, 1, ...).
(create-fontset-from-x-resource)
;; Set scroll bar mode to right if set by X resources. Default is left.
(if (equal (x-get-resource "verticalScrollBars" "ScrollBars") "right")
(customize-set-variable 'scroll-bar-mode 'right))
;; Apply a geometry resource to the initial frame. Put it at the end
;; of the alist, so that anything specified on the command line takes
;; precedence.
(let* ((res-geometry (x-get-resource "geometry" "Geometry"))
parsed)
(if res-geometry
(progn
(setq parsed (x-parse-geometry res-geometry))
;; If the resource specifies a position,
;; call the position and size "user-specified".
(if (or (assq 'top parsed) (assq 'left parsed))
(setq parsed (cons '(user-position . t)
(cons '(user-size . t) parsed))))
;; All geometry parms apply to the initial frame.
(setq initial-frame-alist (append initial-frame-alist parsed))
;; The size parms apply to all frames. Don't set it if there are
;; sizes there already (from command line).
(if (and (assq 'height parsed)
(not (assq 'height default-frame-alist)))
(setq default-frame-alist
(cons (cons 'height (cdr (assq 'height parsed)))
default-frame-alist)))
(if (and (assq 'width parsed)
(not (assq 'width default-frame-alist)))
(setq default-frame-alist
(cons (cons 'width (cdr (assq 'width parsed)))
default-frame-alist))))))
;; Check the reverseVideo resource.
(let ((case-fold-search t))
(let ((rv (x-get-resource "reverseVideo" "ReverseVideo")))
(if (and rv
(string-match "^\\(true\\|yes\\|on\\)$" rv))
(setq default-frame-alist
(cons '(reverse . t) default-frame-alist)))))
;; Set x-selection-timeout, measured in milliseconds.
(let ((res-selection-timeout (x-get-resource "selectionTimeout"
"SelectionTimeout")))
(setq x-selection-timeout
(if res-selection-timeout
(string-to-number res-selection-timeout)
5000)))
;; Don't let Emacs suspend under X.
(add-hook 'suspend-hook 'x-win-suspend-error)
;; During initialization, we defer sending size hints to the window
;; manager, because that can induce a race condition:
;; http://lists.gnu.org/archive/html/emacs-devel/2008-10/msg00033.html
;; Send the size hints once initialization is done.
(add-hook 'after-init-hook 'x-wm-set-size-hint)
;; Turn off window-splitting optimization; X is usually fast enough
;; that this is only annoying.
(setq split-window-keep-point t)
;; Motif direct handling of f10 wasn't working right,
;; So temporarily we've turned it off in lwlib-Xm.c
;; and turned the Emacs f10 back on.
;; ;; Motif normally handles f10 itself, so don't try to handle it a second time.
;; (if (featurep 'motif)
;; (global-set-key [f10] 'ignore))
;; Enable CLIPBOARD copy/paste through menu bar commands.
(menu-bar-enable-clipboard)
;; ;; Override Paste so it looks at CLIPBOARD first.
;; (define-key menu-bar-edit-menu [paste]
;; (append '(menu-item "Paste" x-clipboard-yank
;; :enable (not buffer-read-only)
;; :help "Paste (yank) text most recently cut/copied")
;; nil))
(x-apply-session-resources)
(setq x-initialized t))
(declare-function x-own-selection-internal "xselect.c"
(selection value &optional frame))
(declare-function x-disown-selection-internal "xselect.c"
(selection &optional time-object terminal))
(declare-function x-selection-owner-p "xselect.c"
(&optional selection terminal))
(declare-function x-selection-exists-p "xselect.c"
(&optional selection terminal))
(declare-function x-get-selection-internal "xselect.c"
(selection-symbol target-type &optional time-stamp terminal))
(add-to-list 'display-format-alist '("\\`[^:]*:[0-9]+\\(\\.[0-9]+\\)?\\'" . x))
(cl-defmethod handle-args-function (args &context (window-system x))
(x-handle-args args))
(cl-defmethod frame-creation-function (params &context (window-system x))
(x-create-frame-with-faces params))
(cl-defmethod gui-backend-set-selection (selection value
&context (window-system x))
(if value (x-own-selection-internal selection value)
(x-disown-selection-internal selection)))
(cl-defmethod gui-backend-selection-owner-p (selection
&context (window-system x))
(x-selection-owner-p selection))
(cl-defmethod gui-backend-selection-exists-p (selection
&context (window-system x))
(x-selection-exists-p selection))
(cl-defmethod gui-backend-get-selection (selection-symbol target-type
&context (window-system x)
&optional time-stamp terminal)
(x-get-selection-internal selection-symbol target-type time-stamp terminal))
;; Initiate drag and drop
(add-hook 'after-make-frame-functions 'x-dnd-init-frame)
(define-key special-event-map [drag-n-drop] 'x-dnd-handle-drag-n-drop-event)
(defcustom x-gtk-stock-map
(mapcar (lambda (arg)
(cons (purecopy (car arg)) (purecopy (cdr arg))))
'(
("etc/images/new" . ("document-new" "gtk-new"))
("etc/images/open" . ("document-open" "gtk-open"))
("etc/images/diropen" . "n:system-file-manager")
("etc/images/close" . ("window-close" "gtk-close"))
("etc/images/save" . ("document-save" "gtk-save"))
("etc/images/saveas" . ("document-save-as" "gtk-save-as"))
("etc/images/undo" . ("edit-undo" "gtk-undo"))
("etc/images/cut" . ("edit-cut" "gtk-cut"))
("etc/images/copy" . ("edit-copy" "gtk-copy"))
("etc/images/paste" . ("edit-paste" "gtk-paste"))
("etc/images/search" . ("edit-find" "gtk-find"))
("etc/images/print" . ("document-print" "gtk-print"))
("etc/images/preferences" . ("preferences-system" "gtk-preferences"))
("etc/images/help" . ("help-browser" "gtk-help"))
("etc/images/left-arrow" . ("go-previous" "gtk-go-back"))
("etc/images/right-arrow" . ("go-next" "gtk-go-forward"))
("etc/images/home" . ("go-home" "gtk-home"))
("etc/images/jump-to" . ("go-jump" "gtk-jump-to"))
("etc/images/index" . "gtk-index")
("etc/images/exit" . ("application-exit" "gtk-quit"))
("etc/images/cancel" . "gtk-cancel")
("etc/images/info" . ("dialog-information" "gtk-info"))
("etc/images/bookmark_add" . "n:bookmark_add")
;; Used in Gnus and/or MH-E:
("etc/images/attach" . "gtk-attach")
("etc/images/connect" . "gtk-connect")
("etc/images/contact" . "gtk-contact")
("etc/images/delete" . ("edit-delete" "gtk-delete"))
("etc/images/describe" . ("document-properties" "gtk-properties"))
("etc/images/disconnect" . "gtk-disconnect")
;; ("etc/images/exit" . "gtk-exit")
("etc/images/lock-broken" . "gtk-lock_broken")
("etc/images/lock-ok" . "gtk-lock_ok")
("etc/images/lock" . "gtk-lock")
("etc/images/next-page" . "gtk-next-page")
("etc/images/refresh" . ("view-refresh" "gtk-refresh"))
("etc/images/sort-ascending" . ("view-sort-ascending" "gtk-sort-ascending"))
("etc/images/sort-column-ascending" . "gtk-sort-column-ascending")
("etc/images/sort-criteria" . "gtk-sort-criteria")
("etc/images/sort-descending" . ("view-sort-descending"
"gtk-sort-descending"))
("etc/images/sort-row-ascending" . "gtk-sort-row-ascending")
("images/gnus/toggle-subscription" . "gtk-task-recurring")
("images/mail/compose" . "gtk-mail-compose")
("images/mail/copy" . "gtk-mail-copy")
("images/mail/forward" . "gtk-mail-forward")
("images/mail/inbox" . "gtk-inbox")
("images/mail/move" . "gtk-mail-move")
("images/mail/not-spam" . "gtk-not-spam")
("images/mail/outbox" . "gtk-outbox")
("images/mail/reply-all" . "gtk-mail-reply-to-all")
("images/mail/reply" . "gtk-mail-reply")
("images/mail/save-draft" . "gtk-mail-handling")
("images/mail/send" . "gtk-mail-send")
("images/mail/spam" . "gtk-spam")
;; Used for GDB Graphical Interface
("images/gud/break" . "gtk-no")
("images/gud/recstart" . ("media-record" "gtk-media-record"))
("images/gud/recstop" . ("media-playback-stop" "gtk-media-stop"))
;; No themed versions available:
;; mail/preview (combining stock_mail and stock_zoom)
;; mail/save (combining stock_mail, stock_save and stock_convert)
))
"How icons for tool bars are mapped to Gtk+ stock items.
Emacs must be compiled with the Gtk+ toolkit for this to have any effect.
A value that begins with n: denotes a named icon instead of a stock icon."
:version "22.2"
:type '(choice (repeat
(choice symbol
(cons (string :tag "Emacs icon")
(choice (group (string :tag "Named")
(string :tag "Stock"))
(string :tag "Stock/named"))))))
:group 'x)
(defcustom icon-map-list '(x-gtk-stock-map)
"A list of alists that map icon file names to stock/named icons.
The alists are searched in the order they appear. The first match is used.
The keys in the alists are file names without extension and with two directory
components. For example, to map /usr/share/emacs/22.1.1/etc/images/open.xpm
to stock item gtk-open, use:
(\"etc/images/open\" . \"gtk-open\")
Themes also have named icons. To map to one of those, use n: before the name:
(\"etc/images/diropen\" . \"n:system-file-manager\")
The list elements are either the symbol name for the alist or the
alist itself.
If you don't want stock icons, set the variable to nil."
:version "22.2"
:type '(choice (const :tag "Don't use stock icons" nil)
(repeat (choice symbol
(cons (string :tag "Emacs icon")
(string :tag "Stock/named")))))
:group 'x)
(defconst x-gtk-stock-cache (make-hash-table :weakness t :test 'equal))
(defun x-gtk-map-stock (file)
"Map icon with file name FILE to a Gtk+ stock name.
This uses `icon-map-list' to map icon file names to stock icon names."
(when (stringp file)
(or (gethash file x-gtk-stock-cache)
(puthash
file
(save-match-data
(let* ((file-sans (file-name-sans-extension file))
(key (and (string-match "/\\([^/]+/[^/]+/[^/]+$\\)"
file-sans)
(match-string 1 file-sans)))
(icon-map icon-map-list)
elem value)
(while (and (null value) icon-map)
(setq elem (car icon-map)
value (assoc-string (or key file-sans)
(if (symbolp elem)
(symbol-value elem)
elem))
icon-map (cdr icon-map)))
(and value (cdr value))))
x-gtk-stock-cache))))
(global-set-key [XF86WakeUp] 'ignore)
(provide 'x-win)
;;; x-win.el ends here
|