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
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
|
#ifndef _TKX11VNC_H
#define _TKX11VNC_H
#ifdef NOGUI
char gui_code[] = "";
#else
/*
* tkx11vnc.h: generated by 'tkx11vnc -spit'
* Abandon all hope, ye who enter here...
* ...edit tkx11vnc instead.
*/
char gui_code[] =
"#!/bin/sh\n"
"# the next line restarts using wish. \\\n"
"exec wish \"$0\" \"$@\"\n"
"catch {rename send {}}\n"
"#\n"
"# Copyright (c) 2004-2006 Karl J. Runge <runge@karlrunge.com>\n"
"# All rights reserved.\n"
"#\n"
"# This is free software; you can redistribute it and/or modify\n"
"# it under the terms of the GNU General Public License as published by\n"
"# the Free Software Foundation; either version 2 of the License, or\n"
"# (at your option) any later version.\n"
"#\n"
"# This software is distributed in the hope that it will be useful,\n"
"# but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
"# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
"# GNU General Public License for more details.\n"
"#\n"
"# You should have received a copy of the GNU General Public License\n"
"# along with this software; if not, write to the Free Software\n"
"# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,\n"
"# USA.\n"
"\n"
"#\n"
"# tkx11vnc v0.2\n"
"# This is a simple frontend to x11vnc. It uses the remote control\n"
"# and query features (-remote/-query aka -R/-Q) to interact with it. \n"
"# It is just a quick-n-dirty hack (it parses -help output, etc), but\n"
"# it could be of use playing with or learning about the (way too) many\n"
"# parameters x11vnc has.\n"
"# \n"
"# It can be used to interact with a running x11vnc (see the x11vnc\n"
"# -gui option), or to set the parameters and then start up x11vnc. \n"
"# \n"
"\n"
"#\n"
"# Below is a simple picture of how the gui should be laid out and how\n"
"# the menus should be organized. Most menu items correspond to remote\n"
"# control commands. A trailing \":\" after the item name means it is a string\n"
"# to be set rather than a boolean that can be toggled (e.g. the entry\n"
"# box must be used).\n"
"#\n"
"# Some tweak options may be set in the prefix \"=\" string.\n"
"# A means it is an \"Action\" (not a true variable)\n"
"# R means it is an action only valid in remote mode.\n"
"# S means it is an action only valid in startup mode.\n"
"# Q means it is an action worth querying after running.\n"
"# P means the string can be +/- appended/deleted (string may not\n"
"# be the same after the remote command)\n"
"# G means gui internal item\n"
"# F means can be set via file browse\n"
"# D means for simple gui\n"
"# -C:val1,... means it will be a checkbox (radio button)\n"
"# the \"-\" means no other options follow\n"
"# 0 means to skip the item.\n"
"# -- means add a separator\n"
"#\n"
"# The =GAL ... =GAL LOFF stuff is to provide submenus.\n"
"#\n"
"\n"
"global env started time_count\n"
"set started \"\"\n"
"proc dtime {{msg \"\"}} {\n"
" global started time_count\n"
" if {$started == \"\"} {\n"
" return\n"
" }\n"
" set diff [expr \"[exec gtod.bin] - $started\"]\n"
" set diff [format \"%.2f\" $diff]\n"
" incr time_count\n"
" if {$msg == \"\"} {\n"
" set msg $time_count\n"
" }\n"
" puts -nonewline stderr \"$msg $diff \" \n"
" puts stderr [clock format [clock seconds]]\n"
"}\n"
"\n"
"if [info exists env(X11VNC_GUI_TIME)] {\n"
" global started time_count\n"
" set started [exec gtod.bin]\n"
" set time_count 0\n"
" dtime \"S\"\n"
"}\n"
"\n"
"proc set_template {} {\n"
" global template\n"
" set template \"\n"
"Row: Actions Clients Permissions Keyboard Pointer Help\n"
"Row: Displays Screen Tuning Debugging Misc\n"
"\n"
"Actions\n"
" =SA start\n"
" =RA stop\n"
" --\n"
" =DSA attach\n"
" =DRA detach\n"
" --\n"
" =RA ping\n"
" =RA update-all\n"
" =GAL Settings::\n"
" =GA save-settings\n"
" =SFA load-settings:\n"
" =SA defaults-all\n"
" =0SA clear-all\n"
" --\n"
" =F rc:\n"
" norc\n"
" =GAL LOFF\n"
" -- D\n"
" =DRA stop+quit \n"
" =DGA Quit \n"
"\n"
"Help\n"
" =DGA gui\n"
" =DGA all\n"
"\n"
"Clients\n"
" =DRQA current:\n"
" =DF connect:\n"
" =DRQA disconnect:\n"
" --\n"
" accept:\n"
" afteraccept:\n"
" gone:\n"
" vncconnect\n"
" zeroconf\n"
" -- D\n"
" tightfilexfer\n"
" ultrafilexfer\n"
" proxy:\n"
" =GAL Chat::\n"
" chatwindow\n"
" =DRA chaton\n"
" =DRA chatoff\n"
" =GAL LOFF\n"
" =GAL Java-applet::\n"
" =D http\n"
" httpdir:\n"
" httpport:\n"
" https:\n"
" httpsredir:\n"
" enablehttpproxy\n"
" =GAL LOFF\n"
"\n"
"Displays\n"
" =D display:\n"
" =F auth:\n"
" =S reflect:\n"
" =D desktop:\n"
" =D rfbport:\n"
" =S autoport\n"
" =0 gui:\n"
"\n"
"Screen\n"
" =DRA refresh\n"
" =RA reset\n"
" =RA blacken\n"
" -- D\n"
" =D scale:\n"
" scale_cursor:\n"
" --\n"
" =D solid\n"
" solid_color:\n"
" --\n"
" =GAL OverlayVisuals::\n"
" overlay\n"
" overlay_nocursor\n"
" 8to24\n"
" 8to24_opts:\n"
" =GAL LOFF\n"
" =GAL 8-Bit-Color::\n"
" flashcmap\n"
" shiftcmap:\n"
" notruecolor\n"
" =GAL LOFF\n"
" =GAL SubWindow::\n"
" id:\n"
" sid:\n"
" =GAL LOFF\n"
" =GAL ResizeRotate::\n"
" = xrandr\n"
" =-C:resize,newfbsize,exit xrandr_mode:\n"
" rotate:\n"
" padgeom:\n"
" =GAL LOFF\n"
" =GAL Clipping::\n"
" =P blackout:\n"
" xinerama\n"
" clip:\n"
" =GAL LOFF\n"
" =GAL Misc-Screen::\n"
" fixscreen:\n"
" visual:\n"
" rawfb:\n"
" pipeinput:\n"
" uinput_accel:\n"
" uinput_reset:\n"
" uinput_always:\n"
" 24to32\n"
" =GAL LOFF\n"
"\n"
"Keyboard\n"
" =D norepeat\n"
" =D add_keysyms\n"
" modtweak\n"
" xkb\n"
" --\n"
" capslock\n"
" skip_lockkeys\n"
" --\n"
" skip_keycodes:\n"
" skip_dups\n"
" sloppy_keys\n"
" --\n"
" =FP remap:\n"
" clear_mods\n"
" clear_keys\n"
" clear_all\n"
" =RA clear_locks\n"
"\n"
"Pointer\n"
" =D-C:none,arrow,X,some,most cursor:\n"
" =-C:1,2,3,4,5,6 arrow:\n"
" --\n"
" cursorpos\n"
" =D nocursorshape\n"
" --\n"
" noxfixes\n"
" cursor_drag\n"
" =GAL AlphaBlending::\n"
" noalphablend\n"
" alphacut:\n"
" alphafrac:\n"
" alpharemove\n"
" =GAL LOFF\n"
" --\n"
" buttonmap:\n"
" --\n"
" xwarppointer\n"
"\n"
"Misc\n"
" =GD-C:full,icon,tray WindowView:\n"
" =GD simple-gui\n"
" -- D\n"
" =GA all-settings\n"
" =RA remote-cmd:\n"
" =GAL Selection::\n"
" =D nosel\n"
" noprimary\n"
" nosetprimary\n"
" noclipboard\n"
" nosetclipboard\n"
" seldir:\n"
" =GAL LOFF\n"
" =GAL X-ext::\n"
" xtrap\n"
" xrecord\n"
" =RQA reset_record\n"
" =GAL LOFF\n"
" =GAL MacOSX::\n"
" macnosaver\n"
" macnowait\n"
" macwheel:\n"
" macnoswap\n"
" macnoresize\n"
" maciconanim:\n"
" macmenu\n"
" =GAL LOFF\n"
" --\n"
" nofb\n"
" =D nobell\n"
" nolookup\n"
" rfbversion:\n"
" bg\n"
" =S loop\n"
" =S loopbg\n"
" =S sleepin:\n"
" =-C:ignore,exit sigpipe:\n"
" =0 inetd\n"
"\n"
"Debugging\n"
" debug_pointer\n"
" debug_keyboard\n"
" =F logfile:\n"
" =GA show-logfile\n"
" =GA tail-logfile\n"
" quiet\n"
" --\n"
" =GA show-start-cmd\n"
" =DG debug_gui\n"
" =GAL Misc-Debug::\n"
" debug_xevents\n"
" debug_xdamage\n"
" =-C:0,1,2,3 debug_wireframe:\n"
" debug_scroll\n"
" debug_tiles\n"
" debug_grabs\n"
" debug_sel\n"
" debug_ncache\n"
" dbg\n"
" =GAL LOFF\n"
"\n"
"Permissions\n"
" =DRQA lock\n"
" =DRQA unlock\n"
" =D shared\n"
" =D forever\n"
" --\n"
" =DFP allow:\n"
" =D localhost\n"
" =RA allowonce:\n"
" listen:\n"
" -- D\n"
" =D viewonly\n"
" input:\n"
" --\n"
" =GAL Passwords::\n"
" passwd:\n"
" viewpasswd:\n"
" =F passwdfile:\n"
" =F rfbauth:\n"
" usepw\n"
" --\n"
" unixpw\n"
" unixpw_list:\n"
" unixpw_nis\n"
" unixpw_nis_list:\n"
" =0 storepasswd\n"
" =GAL LOFF\n"
" =GAL SSL::\n"
" ssl\n"
" =F ssl_pem:\n"
" stunnel\n"
" =F stunnel_pem:\n"
" =F ssldir:\n"
" =F sslverify:\n"
" ssltimeout:\n"
" --\n"
" enc:\n"
" =GAL LOFF\n"
" =GAL Misc-Perms::\n"
" safer\n"
" unsafe\n"
" =RA noremote\n"
" =0S alwaysshared\n"
" =0S nevershared\n"
" =0S dontdisconnect\n"
" =SQA deny_all\n"
" timeout:\n"
" grabkbd\n"
" grabptr\n"
" grabalways\n"
" grablocal:\n"
" forcedpms\n"
" clientdpms\n"
" noserverdpms\n"
" noultraext\n"
" =GAL LOFF\n"
"\n"
"Tuning\n"
" =D-C:0,1,2,3,4 pointer_mode:\n"
" input_skip:\n"
" allinput\n"
" =D nodragging\n"
" -- D\n"
" speeds:\n"
" =D wait:\n"
" defer:\n"
" =D nap\n"
" screen_blank:\n"
" --\n"
" =GAL WireFrame::\n"
" wireframe\n"
" wireframe_mode:\n"
" =-C:never,top,always wirecopyrect:\n"
" =GAL LOFF\n"
" =GAL ScrollCopyRect::\n"
" =-C:never,keys,mouse,always scrollcopyrect:\n"
" scr_area:\n"
" scr_skip:\n"
" scr_inc:\n"
" scr_keys:\n"
" scr_term:\n"
" scr_keyrepeat:\n"
" scr_parms:\n"
" =GAL LOFF\n"
" =GAL XDAMAGE::\n"
" xdamage\n"
" xd_area:\n"
" xd_mem:\n"
" =GAL LOFF\n"
" =GAL Ncache::\n"
" ncache\n"
" ncache_size:\n"
" ncache_cr\n"
" ncache_no_moveraise\n"
" ncache_no_dtchange\n"
" ncache_old_wm\n"
" ncache_no_rootpixmap\n"
" ncache_keep_anims\n"
" ncache_pad:\n"
" =RA ncache_reset_rootpixmap\n"
" =GAL LOFF\n"
" --\n"
" =GAL SharedMemory::\n"
" noshm\n"
" flipbyteorder\n"
" onetile\n"
" =GAL LOFF\n"
" =GAL Misc-Tuning::\n"
" progressive:\n"
" fs:\n"
" gaps:\n"
" grow:\n"
" fuzz:\n"
" wait_ui:\n"
" setdefer:\n"
" nowait_bog\n"
" slow_fb:\n"
" xrefresh:\n"
" readtimeout:\n"
" snapfb\n"
" threads\n"
" wmdt:\n"
" rfbwait:\n"
" nodpms\n"
" nofbpm\n"
" =GAL LOFF\n"
"\"\n"
"}\n"
"\n"
"proc set_internal_help {} {\n"
" global helptext helpall\n"
"\n"
" # set some internal item help here:\n"
" set helptext(start) \"\n"
"Launch x11vnc with the settings you have prescribed in the gui.\n"
"The x11vnc process is started in an xterm window so you can see the\n"
"output, kill it, etc.\n"
"\n"
"By viewing this help item, the command built so far will be displayed\n"
"in the gui text area. Have a look. If you Press start it will be shown\n"
"as well and you will be asked to confirm running it.\n"
"\n"
"If you want to use a saved profile \\\"rc file\\\" you can do \\\"Misc -> rc\\\" and\n"
"select the file and simply start x11vnc using the rc file. Alternatively,\n"
"you could first use the \\\"Actions -> load-settings\\\" action to load in\n"
"an \\\"rc file\\\" and then press \\\"Actions -> start\\\" to start up x11vnc\n"
"based on those values.\n"
"\"\n"
" set helptext(stop) \"\n"
"The \\\"Actions -> stop\\\" action sends a signal to the running x11vnc\n"
"server indicating it should shutdown all connections and exit.\n"
"\n"
"The GUI stays running in case you want to start a new x11vnc or attach\n"
"to another one. Use \\\"Actions -> Quit\\\" if you then want to have the\n"
"gui exit. Use \\\"Actions -> stop+quit\\\" to have both exit at once.\n"
"\"\n"
"\n"
" set helptext(show-start-cmd) \"\n"
"Displays in the text area what the x11vnc start command (i.e. the command\n"
"run by \\\"Actions -> start\\\") looks like for the current values of the\n"
"settings. This can be done even in the attached state. Intended for\n"
"debugging the gui. The help item for \\\"Actions -> start\\\" gives the\n"
"same info.\n"
"\n"
"If you want to load in a saved profile \\\"rc file\\\" use \\\"Misc -> rc\\\"\n"
"and select the file. \\\"Actions -> load-settings\\\" does a similar thing\n"
"with an rc-file, but reading the file and setting the gui variables to\n"
"its values.\n"
"\"\n"
"\n"
" set helptext(debug_gui) \"\n"
"Set debug_gui to get more output printed in the text area.\n"
"\"\n"
"\n"
" set helptext(detach) \"\n"
"No longer be associated with the x11vnc server. Switch to the\n"
"non-connected state. The x11vnc server keeps running: it does not exit.\n"
"\n"
"You can either later reattach to it \\\"Actions -> attach\\\", or start\n"
"up a new x11vnc \\\"Actions -> start\\\", or exit \\\"Actions -> Quit\\\".\n"
"\"\n"
"\n"
" set helptext(attach) \"\n"
"Attach to a running x11vnc server, if possible. Switches to connected\n"
"state if successful. Usually the channel used to attach is via the X\n"
"display (VNC_CONNECT rootwin property) being polled by the x11vnc server.\n"
"To change or set the X display to use do \\\"Displays -> display\\\".\n"
"\n"
"Sometimes the \\\"-connect /path/to/filename\\\" is used as the communcation\n"
"channel. The running x11vnc has to know that \\\"/path/to/filename\\\"\n"
"is the communication channel (i.e. it is using the same -connect option).\n"
"\"\n"
"\n"
" set helptext(ping) \"\n"
"Check if x11vnc still responds to \\\"ping\\\" remote command.\n"
"\"\n"
"\n"
" set helptext(update-all) \"\n"
"Query the x11vnc server for the current values of all variables.\n"
"Populate the values into the gui's database.\n"
"\n"
"Normally the gui will refresh this info every time it interacts with\n"
"the x11vnc server (including after a few minutes of inactivity), so one\n"
"doesn't need to use this action very often (unless something else is\n"
"changing the state of the x11vnc server, or new clients have connected,\n"
"etc).\n"
"\"\n"
"\n"
" set helptext(clear-all) \"\n"
"Forget any variable settings either entered in by you or set at the\n"
"default. Basically sets everything to 0 or the string (unset).\n"
"\n"
"This action is only available in \\\"startup\\\" mode, not when connected\n"
"to a running x11vnc server (in that case the variable settings reflect\n"
"the state of the running x11vnc). To detach from a running x11vnc\n"
"server use \\\"Actions -> detach\\\"; to completely stop the x11vnc server\n"
"use \\\"Actions -> stop\\\".\n"
"\"\n"
"\n"
" set helptext(defaults-all) \"\n"
"Reset all variable settings to the default values. Basically sets\n"
"everything to the default queries \\\"x11vnc -QD var\\\" retrieved at startup.\n"
"\n"
"This action is only available in \\\"startup\\\" mode, not when connected\n"
"to a running x11vnc server (in that case the variable settings reflect\n"
"the state of the running x11vnc). To detach from a running x11vnc\n"
"server use \\\"Actions -> detach\\\"; to completely stop the x11vnc server\n"
"use \\\"Actions -> stop\\\".\n"
"\"\n"
"\n"
" set helptext(load-settings) \"\n"
"Read in the \\\"rc file\\\" you prescribe in the dialog and then set the\n"
"variables to those in the rc-file. Any variables not mentioned in the\n"
"rc-file are set to their default value.\n"
"\n"
"You could then do \\\"Actions -> start\\\" to start x11vnc with these\n"
"parameters. Or you could make some further changes to variables\n"
"using the gui before starting x11vnc.\n"
"\n"
"This action is only available in \\\"startup\\\" mode, not when connected\n"
"to a running x11vnc server (in that case the variable settings reflect\n"
"the state of the running x11vnc). To detach from a running x11vnc\n"
"server use \\\"Actions -> detach\\\"; to completely stop the x11vnc server\n"
"use \\\"Actions -> stop\\\".\n"
"\"\n"
"\n"
" set helptext(save-settings) \"\n"
"Construct a ~/.x11vncrc file based on the current settings and\n"
"offer to save it in a file (default ~/.x11vncrc). If saved in a\n"
"file other than the default, you can access the profile by using\n"
"the \\\"-rc <filename>\\\" option when starting x11vnc.\n"
"\n"
"If an rc file entry begins with \\\"#d\\\" that means the current\n"
"setting is at the Default value and so you probably want to leave\n"
"it commented out with the \\\"#\\\" character.\n"
"\n"
"If an rc file entry begins with \\\"#?\\\" that means we think\n"
"you probably do not really want to force the value to this setting.\n"
"\n"
"In either case, feel free to uncomment the line and/or change any\n"
"of the parameter values in the file. \n"
"\"\n"
"\n"
" set helptext(all-settings) \"\n"
"Displays the gui's database of all of the x11vnc server's current\n"
"settings. Use \\\"Actions -> update-all\\\" or \\\"Control+R\\\" to\n"
"refresh this list if it ever gets out of sync.\n"
"\"\n"
"\n"
" set helptext(remote-cmd) \"\n"
"Run a remote command (-R) or query (-Q) directly. Only a few\n"
"remote commands are not on a menu, but for those few you can\n"
"run the command directly this way. Just enter the command into\n"
"the Entry box when prompted. Use the prefix \\\"Q:\\\" to indicate\n"
"a -Q query. Examples: \\\"zero:20,20,100,100\\\", \\\"Q:ext_xfixes\\\" \n"
"\"\n"
"\n"
" set helptext(stop+quit) \"\n"
"Send the stop command to the x11vnc server, then terminate the tkx11vnc gui.\n"
"\"\n"
"\n"
" set helptext(show-logfile) \"\n"
"View the current contents of the logfile (if it exists and is accessible\n"
"by the gui process).\n"
"\"\n"
"\n"
" set helptext(tail-logfile) \"\n"
"Run the tail(1) command with -f option on the logfile in an xterm.\n"
"(if it exists and is accessible by the gui process).\n"
"\"\n"
"\n"
" set helptext(Quit) \"\n"
"Terminate the tkx11vnc gui. Any x11vnc server will be left running.\n"
"\"\n"
"\n"
" set helptext(current) \"\n"
"Shows a menu of currently connected VNC clients on the x11vnc server.\n"
"\n"
"Allows you to find more information about them, change their input\n"
"permissions, or disconnect them.\n"
"\n"
"Note that the File transfer permission only applies to UltraVNC\n"
"file transfer, not TightVNC file transfer.\n"
"\n"
"You will be prompted to confirm any disconnections.\n"
"\"\n"
"\n"
" set helptext(client) \"\n"
"After selecting a VNC client from the \\\"Clients -> current\\\" menu,\n"
"you will be presented with a dialog that shows the information\n"
"about the VNC client.\n"
"\n"
"You can choose to disconnect the client by clicking on the \n"
"\\\"Disconnect\\\" checkbox and pressing \\\"OK\\\". There will be a\n"
"confirmation dialog to doublecheck.\n"
"\n"
"Alternatively, you can fine tune the VNC client's input permissions\n"
"by selecting any of the Keystrokes, Mouse-Motion, Button-Click,\n"
"Clipboard-Input, or Files checkboxes and pressing \\\"OK\\\". This is like\n"
"the \\\"-input\\\" option but on a per-client basis.\n"
"\n"
"To not change any aspects of the VNC client press \\\"Cancel\\\".\n"
"\"\n"
"\n"
" set helptext(solid_color) \"\n"
"Set the -solid color value.\n"
"\"\n"
"\n"
" set helptext(xrandr_mode) \"\n"
"Set the -xrandr mode value.\n"
"\"\n"
"\n"
" set helptext(unixpw_list) \"\n"
"Set the -unixpw usernames list value.\n"
"\"\n"
"\n"
" set helptext(unixpw_nis_list) \"\n"
"Set the -unixpw_nis usernames list value.\n"
"\"\n"
"\n"
" set helptext(stunnel_pem) \"\n"
"Set the -stunnel pem filename value.\n"
"\"\n"
"\n"
" set helptext(ssl_pem) \"\n"
"Set the -ssl pem filename value.\n"
"\"\n"
"\n"
" set helptext(wireframe_mode) \"\n"
"Set the -wireframe mode string value.\n"
"\"\n"
"\n"
" set helptext(simple-gui) \"\n"
"Toggle between menu items corresponding the most basic ones\n"
"and all possible settings. I.e. toggle between a simple gui\n"
"and one for power users.\n"
"\"\n"
"\n"
" set helptext(Tray) \"\n"
"The tray/icon mode (started with \\\"x11vnc -gui tray ...\\\", etc.) presents\n"
"a small icon that indicates the status of the running x11vnc server.\n"
"\n"
"Depending on your environment, this icon may be embedded in a system\n"
"tray or applet dock, or simply be a standalone window. \\\"-gui tray\\\"\n"
"will attempt to embed the icon in the system tray, while \\\"-gui icon\\\"\n"
"is for a standalone window. Use \\\"-gui tray=setpass\\\" (or icon=setpass)\n"
"to be prompted to set the session password at startup.\n"
"\n"
"When the icon has a light background, that means no VNC viewers are\n"
"currently connected to the VNC display.\n"
"\n"
"When the icon has a dark background (i.e. reverse-video), that means at\n"
"least one VNC viewer is connected to the VNC display.\n"
"\n"
"Moving the mouse pointer over the icon will popup a \\\"status balloon\\\"\n"
"indicating the VNC display name and the names and info of any connected VNC\n"
"viewers. Press the middle mouse button if the balloon does not appear.\n"
"\n"
"Clicking the left or right mouse button on the icon displays a menu\n"
"of actions:\n"
"\n"
" Properties - Brings up the Properties dialog to set some basic\n"
" parameters. The full tkx11vnc GUI may be accessed\n"
" via the \\\"Advanced ...\\\" button. Press \\\"Help\\\"\n"
" in the Properties dialog for more info.\n"
" \n"
" Help - Displays this help text.\n"
" \n"
" New Client - Presents an entry box where you type in the name\n"
" of a computer that is running a VNC viewer in\n"
" \\\"listen\\\" mode (e.g. vncviewer -listen). For a\n"
" non-standard listening port use \\\"host:port\\\".\n"
"\n"
" Pressing \\\"OK\\\" will initiate the reverse\n"
" connection. Use a blank hostname to skip it.\n"
" \n"
" Disconnect - Shows a popup menu of connected clients. Click on\n"
" one to disconnect it, or click on \\\"All Clients\\\"\n"
" disconnect all clients.\n"
"\n"
" Window View - Switch between the \\\"full\\\" gui (also known as\n"
" \\\"Advanced\\\"), \\\"icon\\\" mode (small icon window with\n"
" popups), or \\\"tray\\\" mode (small icon embedded in the\n"
" system tray). This is a shortcut for the action:\n"
" \\\"Properties -> Advanced -> Misc -> WindowView\\\".\n"
" \n"
" Stop x11vnc - Directs the x11vnc server to disconnect all vncviewers\n"
" and then exit. The tray/icon GUI then exits as well.\n"
"\n"
" Logfile - Show the logfile if x11vnc is being run with one.\n"
"\n"
" Custom - If you have a \\$HOME/.x11vnc.gui file each uncommented\n"
" line in it becomes an additional menu item for this\n"
" menu. The remote control command is run directly\n"
" via \\\"x11vnc -R <command>\\\", or if prefixed with \n"
" \\\"action:\\\" runs a gui internal action, or if \\\"sep\\\"\n"
" adds a separator. Set X11VNC_CUSTOM_GUI to use\n"
" a different filename. Example file contents:\n"
"\n"
" scale:3/4\n"
" scale:1\n"
" scale_cursor:1\n"
" sep\n"
" action:all-settings\n"
" #debug_keyboard\n"
" sep\n"
" action:Quit\n"
"\n"
"Termination:\n"
"\n"
"If the x11vnc server stops for any reason, the tray/icon gui will exit.\n"
"\n"
"If you delete the tray/icon (e.g. X out button), that is the same\n"
"as the \\\"Stop x11vnc\\\" action in the menu. (This will disconnect any\n"
"VNC viewer you are currently using to access the display since the\n"
"x11vnc server is terminated).\n"
"\n"
"To terminate the tray/icon gui window but not the x11vnc server press\n"
"Control-C on the tray/icon window. You can also do this (and much\n"
"more) via Properties -> Advanced -> Actions -> Quit\n"
"\"\n"
"\n"
" set helptext(NewClient) \"\n"
" New Client - Presents an entry box where you type in the name\n"
" of a computer that is running a VNC viewer in\n"
" \\\"listen\\\" mode (e.g. vncviewer -listen). For a\n"
" non-standard listening port use \\\"host:port\\\".\n"
"\n"
" Pressing \\\"OK\\\" will initiate the reverse\n"
" connection. Use a blank hostname to skip it.\n"
" \n"
"\"\n"
"\n"
" set helptext(Properties) \"\n"
"The Properties dialog allows you to set some basic parameters of a\n"
"running x11vnc server. After modifying them press \\\"OK\\\" or \\\"Apply\\\"\n"
"to apply the changes, or press \\\"Cancel\\\" to skip applying them.\n"
"\n"
" Accept Connections:\n"
"\n"
" Toggles whether VNC viewers are allowed to connect or not. It corresponds\n"
" to the \\\"-R unlock\\\" and \\\"-R lock\\\" remote-control commands.\n"
"\n"
" Ask for Confirmation:\n"
"\n"
" Toggles whether a popup menu will be presented at the X display when\n"
" a new VNC viewer attempts to connect. The person sitting at the X\n"
" display can choose to accept or reject the connection or accept the\n"
" connection in ViewOnly mode. It corresponds to the \\\"-R accept:popup\\\"\n"
" and \\\"-R accept:\\\" remote-control commands.\n"
" \n"
" All Clients ViewOnly:\n"
"\n"
" Toggles whether the entire VNC desktop is view only. All clients\n"
" will only be able to watch when this is set (regardless of how they\n"
" logged in). It corresponds to the \\\"-R viewonly\\\" and \\\"-R noviewonly\\\"\n"
" remote-control commands.\n"
" \n"
" Shared:\n"
"\n"
" Toggles whether multiple simultaneous viewer connections are allowed\n"
" or not. It corresponds to the \\\"-R shared\\\" and \\\"-R noshared\\\"\n"
" remote-control commands.\n"
"\n"
" Advertise Service (Zeroconf):\n"
"\n"
" Toggles whether this VNC server should advertize itself via Zeroconf\n"
" (also called Bonjour, mDNS, and avahi). Then VNC viewers can then find\n"
" this service on the local network. It corresponds to the \\\"-R zeroconf\\\"\n"
" and \\\"-R nozeroconf\\\" remote-control commands.\n"
"\n"
" Serve Java Viewer Applet:\n"
"\n"
" Toggles whether this VNC server should serve up a Java VNC Viewer\n"
" applet via HTTP on http://hostname:5800/ (or port 5800+n for VNC\n"
" port 5900+n). A java enabled Web Browser can then connect to the\n"
" desktopby VNC. If SSL is active then the HTTPS URL https://hostname:5900/\n"
" (etc.) will work as well. This requires the x11vnc java viewer jar file\n"
" (shared/x11vnc/classes) to be installed. It corresponds to the\n"
" \\\"-R http\\\" and \\\"-R nohttp\\\" remote commands.\n"
"\n"
" Solid Background Color:\n"
"\n"
" To improve VNC performance, if this option is set, then x11vnc will try\n"
" to make the desktop background a solid color (which compresses extremely\n"
" well compared to photo images, etc.) It corresponds to the \\\"-R solid\\\"\n"
" and \\\"-R nosolid\\\" remote commands.\n"
"\n"
" Password:\n"
"\n"
" Lets you set the session password viewers may use to gain full access\n"
" to the display. This will only work if x11vnc was started with the\n"
" -gui icon or -gui tray mode.\n"
" \n"
" ViewOnly Password:\n"
"\n"
" Lets you set the session password viewers may use to gain view only\n"
" access to the display. This will only work if x11vnc was started with\n"
" the -gui icon or -gui tray mode.\n"
"\n"
"\n"
" NOTE: These \\\"session\\\" passwords only last for the current x11vnc\n"
" session (they are not remembered, see the -storepasswd, -passwdfile,\n"
" and -rfbauth x11vnc options for using stored passwords).\n"
"\n"
" If you set \\\"Password\\\" to the empty string that makes the \\\"ViewOnly\n"
" Password\\\" empty as well and removes the need for any password to log in.\n"
"\n"
" If you set \\\"ViewOnly Password\\\" to the empty string that just removes\n"
" the ViewOnly log in aspect: \\\"Password\\\" is still required to log in.\n"
"\n"
" - The \\\"Help\\\" button shows this help text.\n"
" \n"
" - The \\\"Advanced ...\\\" button replaces the Properties dialog with the full\n"
" tkx11vnc GUI. All dynamic settings can be modified in the full GUI.\n"
"\n"
"\n"
"==========================================================================\n"
"\n"
"Don't Lock Yourself Out:\n"
"\n"
" If you are sitting at the physical X display you cannot get into too\n"
" much trouble setting the Properties dialog values.\n"
"\n"
" However IF you are using a VNC Viewer to REMOTELY access the X display\n"
" some items in the Properties dialog can lock you out of further access:\n"
"\n"
" \\\"Accept Connections\\\" if you disable this remotely, and\n"
" accidentally disconnect your VNC viewer then you will not be\n"
" able to reconnect.\n"
" \n"
" \\\"Ask for Confirmation\\\" if you enable this only someone\n"
" sitting at the X display can confirm any new VNC connections.\n"
" Furthermore, any current VNC viewers will be blocked while\n"
" waiting for the confirmation (times out in 120 sec by default). \n"
" \n"
" \\\"All Clients ViewOnly\\\" if you enable this remotely, well\n"
" you can no longer provide input to disable it.\n"
" \n"
" If you do lock yourself out you could log in remotely and start up\n"
" a second x11vnc and connect to that one to try to fix things in the\n"
" first one.\n"
"\n"
" Note that if there are two or more x11vnc's on the same display the\n"
" use of the GUI may be ill-behaved. Terminate the second x11vnc as\n"
" soon as you have fixed the setting in the first one. Use of a remote\n"
" control command, e.g. \\\"x11vnc -R noviewonly\\\" or \\\"x11vnc -R unlock\\\"\n"
" is a good way to avoid this problem.\n"
"\"\n"
"\n"
" set helptext(all) $helpall\n"
"\n"
" set helptext(Misc-Tuning:) \"\n"
"x11vnc has what seems like hundreds of tuning parameters! In this\n"
"sub-menu we place some lesser used ones. Most likely you'll want to\n"
"leave them at their default values, but you can try them out quickly\n"
"with the gui to see if they improve things.\n"
"\"\n"
"\n"
" set helptext(Passwords:) \"\n"
"The items in this sub-menu pertain to setting passwords. Note that x11vnc\n"
"has two types of password files: RealVNC-style ones (you can create them\n"
"with x11vnc -storepasswd or other VNC utility program) you use these\n"
"via -rfbauth; and plain-text file passwords you use via -passwdfile.\n"
"\n"
"Normally passwords cannot be changed by remote-control (e.g. the gui),\n"
"but for the case of the \\\"Icon\\\" and \\\"Tray\\\" modes this constraint has\n"
"been relaxed.\n"
"\n"
"In neither the RealVNC-style nor the plain-text file cases should the\n"
"password files be readable by users you do not want to access the VNC\n"
"server. Contrary to popular belief, the RealVNC-style passwords are\n"
"not encrypted, merely obscured.\n"
"\n"
"x11vnc has the even less secure -passwd and -viewpasswd supplied on\n"
"the command line. Be careful with these since they could be read by\n"
"users with something like the ps(1) command. On some operating systems\n"
"x11vnc tries to quickly overwrite them on the command line but it doesn't\n"
"work everywhere.\n"
"\n"
"Regarding ViewOnly passwords (where a VNC client using that password\n"
"can only watch the screen, not interact with it), this is not available\n"
"with -rfbauth, but only with -passwdfile, -passwd, and -viewpasswd.\n"
"\"\n"
"\n"
" set helptext(SSL:) \"\n"
"In this sub-menu we provide the options related to SSL encrpytion\n"
"and authentication.\n"
"\n"
"There is a built-in mode (-ssl) using the OpenSSL library, and a 2nd\n"
"using the external stunnel program (-stunnel, that needs to be installed\n"
"on the system). Either may require or benefit from having PEM certificate\n"
"files specified.\n"
"\n"
"\"\n"
"\n"
" set helptext(Misc-Perms:) \"\n"
"In this sub-menu we provide some lesser used permission options.\n"
"\n"
"Regarding -alwaysshared, -nevershared, and -dontdisconnect, you probably\n"
"should never use them and just use x11vnc's -shared and -forever options\n"
"instead (these give basically the same functionality and if you mixed\n"
"them too much unexpected things may happen).\n"
"\"\n"
"#'\n"
"\n"
" set helptext(AlphaBlending:) \"\n"
"In this sub-menu we provide some tweak parameters for cursors (little\n"
"icon at the mouse pointer) that have transparency (i.e. an Alpha channel\n"
"in addition to Red, Green, and Blue RGB channels). For these cursors,\n"
"some of the graphics underneath the cursor is allowed to be blended in:\n"
"e.g. a drop-shadow (a terrible effect IMNSHO).\n"
"\n"
"AlphaBlending for x11vnc is only available when the XFIXES X extension is\n"
"present (since otherwise it cannot see the cursors at all and so applies\n"
"heuristics to show some fake cursors). AlphaBlending is only a problem\n"
"with x11vnc when the cursors are not opaque.\n"
"\n"
"Opaque cursors (e.g. bitmap or simply colored cursor) are rendered\n"
"correctly by x11vnc. Only when there is transparency does x11vnc have\n"
"to make some approximation to transform the cursor to be opaque (the\n"
"VNC protocol does not provide for an alpha channel in cursors, only RGB).\n"
"\n"
"The items in this sub-menu let you tweak x11vnc's approximation scheme\n"
"for cursors with transparency. Hopefully you won't have to use them.\n"
"Certain cursor \\\"themes\\\" may require adjustment however.\n"
"\"\n"
"#'\n"
" set helptext(OverlayVisuals:) \"\n"
"In this sub-menu are some options that involve fixing color problems\n"
"for \\\"Overlay\\\" or \\\"Multi-Depth\\\" visuals. This problem is rare\n"
"since overlay and multi-depth visual video hardware is rare. \n"
"Some Sun, SGI, and HP machines are known to have them.\n"
"\n"
"The short answer is if you have a multi-depth visual display (e.g. 8 and\n"
"24 bits), and you see messed up colors in x11vnc try the \\\"-overlay\\\"\n"
"option on Solaris or IRIX.\n"
"\n"
"A brief Background on pixels, color, and visuals:\n"
"\n"
" Pixels (picture elements) are kept in video memory as a certain number\n"
" of bits-per-pixel (bpp). Most common are 8bpp, 16bpp, and 32bpp.\n"
" Less common are 24bpp, 4bpp, and 1bpp (monochrome).\n"
"\n"
" How pixel values (i.e. values of the bits) are rendered into colors on\n"
" the screen can be done via different \\\"Recipes\\\". These different\n"
" recipes are referred to as \\\"visuals\\\". E.g. for 8bpp there is\n"
" a PseudoColor visual that maintains a mapping (that can be changed\n"
" dynamically) of the pixel values (256 possible ones) into RGB values.\n"
" Other 8bpp visuals, e.g. StaticGrey and TrueColor have fixed, regular\n"
" mappings and so provide less variation in kinds of colors.\n"
"\n"
" A visual's \\\"depth\\\" is how many of the pixels are used in the\n"
" actual recipe. This may sound wasteful (i.e. not using some of the\n"
" bits), but for 32bpp (4 billion colors) that is too much and nearly\n"
" always only 24 for them are used. The most common Visual seems to\n"
" be depth 24 TrueColor at 32bpp. This provides 16 million colors\n"
" which is more than the number of pixels on most screens (1280x1024 =\n"
" 1.3 million pixels). Another sometimes used visual that ignores some\n"
" bits is depth 15 TrueColor at 16bpp.\n"
"\n"
"OK, now, finally, to the Overlay Visuals. Some hardware (or software\n"
"emulations) allow different depth visuals to be used on the display\n"
"at the same time. The pixels of windows using different depth visuals\n"
"may overlap.\n"
"\n"
"The most common seems to be both 8 and 24 depth visuals on a 32bpp setup.\n"
"24 of the pixels can be used for one visual and the remaining 8 for the\n"
"other. This is sometimes referred to as \\\"8+24\\\" mode. Furthermore,\n"
"a speedup is achieved because writing graphics data to, say, the 8bit\n"
"visual does not destroy the image data in the 24bit visual. Evidently\n"
"popup menus can be done very quickly this way: they use the 8bit visual\n"
"and when the popup goes away the graphics data in the 24bit visual is\n"
"immediately reexposed without having the application redraw it.\n"
"\n"
"Also, some legacy applications can only use 8bpp visuals. But in these\n"
"days of high color graphics and web browsers one would like the rest\n"
"of the desktop to use depth 24 visuals. They often work on the multi\n"
"depth visuals.\n"
"\n"
"How does this effect x11vnc? x11vnc nearly always polls the root window\n"
"(container of all other windows). The root window will be one depth,\n"
"e.g. 8 or 24. Any windows using the *other* depth will appear to have\n"
"messed up colors (or just be black or some other solid color) when viewed\n"
"via x11vnc.\n"
"\n"
"How to fix? Solaris and IRIX provide an API to extract the full snapshot\n"
"of the display with all the colors correct. It comes to x11vnc as depth\n"
"24 TrueColor. To enable this use the \\\"-overlay\\\" option. Performance\n"
"may be slower, but if the colors are correct that is a big improvement.\n"
"\"\n"
"\n"
" set helptext(8-Bit-Color:) \"\n"
"Some older displays (e.g. with limited Video RAM) use 8 bits-per-pixel\n"
"color. This allows for only 256 different colors on the screen at the\n"
"same time. This sometimes leads to problems with viewing these 8bpp\n"
"displays via x11vnc. This sub-menu has some options that correspond to\n"
"workarounds for this case. If you can configure the machine to use 16bpp\n"
"it may be worth it to avoid the color problems (e.g. color flashing\n"
"as the 8bit colormap is switched).\n"
"\"\n"
" set helptext(SubWindow:) \"\n"
"This sub-menu has a couple options regarding having x11vnc poll a \n"
"single window, not the entire display. This way just the window\n"
"is shared.\n"
"\n"
"Note if the application pops up multiple windows they are not tracked\n"
"and shared. So this is not application sharing. The application has to\n"
"be very simple (e.g. a simple terminal or the image window on a webcam)\n"
"for this mode to be usable.\n"
"\"\n"
" set helptext(ResizeRotate:) \"\n"
"This sub-menu has some options regarding screens that support the X\n"
"Resize, Reflection, and Rotation Extension (RANDR), and one expects screen\n"
"resizing, reflection, or rotation to take place during the x11vnc session.\n"
"This is pretty rare, but x11vnc seems to handle it reasonably well using\n"
"this X extension.\n"
"\n"
"This mode is on by default in -id mode to try to track the changing\n"
"size of the SubWindow. It is not on by default for full-screen mode\n"
"because of the extra overhead, etc.\n"
"\"\n"
"\n"
" set helptext(WireFrame:) \"\n"
"This sub-menu has some options for the x11vnc wireframing speedup scheme.\n"
"\n"
"For x11vnc, Wireframing means to watch for toplevel windows being Opaquely\n"
"Moved or Resized. When x11vnc detects this, it stops polling the screen\n"
"and simply shows a \\\"wireframe\\\" outline of the window as it is being\n"
"moved or resized. This avoids \\\"screen polling thrashing\\\" when the\n"
"screen is changing so rapidly during this period. For various reasons\n"
"this is usually much faster then letting the window manager do its\n"
"own wireframing (you are encouraged to do Opaque moves and resizes\n"
"when using x11vnc!)\n"
"\n"
"Also, once a moved window is released in its new position, x11vnc uses\n"
"the VNC CopyRect encoding to very efficiently update the VNC viewers\n"
"(each just copies the image data locally).\n"
"\n"
"This sort of scheme was used much in the 1990's on local displays because\n"
"video hardware was slow at the time. x11vnc tries to use this same trick\n"
"as a speedup for its activities (the network is much slower than video\n"
"hardware writes, and the video hardware reads that x11vnc uses to poll\n"
"the screen are still slow today).\n"
"\"\n"
"#'\"\n"
"\n"
" set helptext(Safe:) \"\n"
"In this sub-menu are some options for making x11vnc operations\n"
"more, or less, safe. E.g. disable the running of external commands, etc.\n"
"\n"
"You can also turn off the Remote control channel (NOTE that doing that\n"
"will disable the GUI from being able to communicate with x11vnc).\n"
"\"\n"
"\n"
" set helptext(X-ext:) \"\n"
"In this sub-menu are a few rarely used options regarding some X extensions\n"
"used by x11vnc.\n"
"\"\n"
" set helptext(Clipping:) \"\n"
"In this sub-menu are some options regarding clipping or blacking out\n"
"portions of the Screen. E.g. under XINERAMA when the multiple monitors\n"
"are not the same size.\n"
"\n"
"\"\n"
" set helptext(Misc-Screen:) \"\n"
"In this sub-menu are some little used options modifying aspects of\n"
"the screen source.\n"
"\"\n"
"\n"
" set helptext(Settings:) \"\n"
"In this sub-menu are some options for saving and loading option settings.\n"
"The default file to store settings in is ~/.x11vncrc, but you can save\n"
"different \\\"profiles\\\" in other files for later use.\n"
"\n"
"\"\n"
" set helptext(Java-applet:) \"\n"
"In this sub-menu are some options for running the built-in HTTP server\n"
"that delivers the TightVNC Java VNC Viewer applet (VncViewer.jar) to\n"
"clients. The viewer runs in their Web browser.\n"
"\n"
"The default port listened on is 5800, so the URL is typically:\n"
"\n"
" http://hostname:5800/\n"
"\n"
"but this can be altered by -httpport, etc.\n"
"\"\n"
"\n"
" set helptext(Chat:) \"\n"
"In this sub-menu are some options for enabling a local chat window\n"
"and starting or stopping the current chat. This is the UltraVNC \n"
"Text Chat support in x11vnc.\n"
"\"\n"
"\n"
" set helptext(ScrollCopyRect:) \"\n"
"This sub-menu has some options for the x11vnc Scroll detection and\n"
"CopyRect speedup scheme.\n"
"\n"
"For this mode, x11vnc \\\"spies\\\" on communication between the X server and\n"
"applications using the RECORD extension. It looks for various patterns\n"
"to detect a scrolled window. This only works for some applications,\n"
"fortunately some important ones.\n"
"\n"
"Once the scroll is detected it uses the VNC CopyRect encoding for a\n"
"big speedup. Screen polling is also sped up for this scheme.\n"
"\n"
"There are many tweakable parameters for this mode and they are described\n"
"in the sub-menu items.\n"
"\"\n"
"\n"
" set helptext(XDAMAGE:) \"\n"
"The DAMAGE X extension allows the X server to send signals to x11vnc\n"
"telling it which regions of the screen have been changed. This improves\n"
"x11vnc's performance markedly. The DAMAGE extension must be available\n"
"on the display for this to work.\n"
"\n"
"Unfortunately DAMAGE cannot be trusted completely for the changed regions,\n"
"because often the reported changed region is much larger than the actual\n"
"changed regions. Nevertheless, x11vnc uses the DAMAGE information very\n"
"effectively as hints to improve its performance.\n"
"\n"
"The items in the sub-menu allow tweaking x11vnc's DAMAGE algorithm.\n"
"\"\n"
"\n"
" set helptext(Ncache:) \"\n"
"A simple client-side (viewer) caching scheme is enabled with the\n"
"\\\"-ncache n\\\" option. It simply uses \\\"n\\\" framebuffer sized areas\n"
"below the actual display for caching window pixel data. \n"
"\n"
"Drawbacks are it uses a lot of RAM (roughly n times more), and the\n"
"pixels cache area is visible in the viewers.\n"
"\n"
"The items in the sub-menu allow tweaking x11vnc's -ncache algorithm.\n"
"\"\n"
"\n"
" set helptext(SharedMemory:) \"\n"
"This sub-menu provides some options regarding SYSV shared memory usage\n"
"(shm) by x11vnc. Usually you want shm turned on because the x11vnc\n"
"process is nearly always running on the same machine the X server process\n"
"is running on. SharedMemory gives a performance speedup. However, if you\n"
"need to modify this scenario for special usage these options allow you to.\n"
"\"\n"
"\n"
" set helptext(Misc-Debug:) \"\n"
"This sub-menu contains a lot of debugging parameters usually used\n"
"for debugging x11vnc itself. This is unlike the -debug_pointer and\n"
"-debug_keyboard options that are useful in learning information, quirks,\n"
"etc. about your local display and environment.\n"
"\"\n"
"\n"
" set helptext(Selection:) \"\n"
"This sub-menu contains some options centering around the Selection\n"
"(also referred to as the Clipboard, Cutbuffers, etc). x11vnc will try\n"
"to exchange the selections between the VNC viewers and the X server.\n"
"You can adjust that behavior with these options.\n"
"\"\n"
"\n"
" set helptext(WindowView) \"\n"
"Set the Window View Mode for the gui. There are three modes:\n"
"\n"
" - full: Presents the full gui (Actions, Clients, etc, buttons,\n"
" and the Text area and Set/Entry box).\n"
"\n"
" - icon: Presents a small icon instead of the full gui. Moving\n"
" the mouse over it shows the VNC display name and any\n"
" connected clients. Clicking on the icon pops up a menu\n"
" of actions to perform. Among them is \\\"Properties\\\" that\n"
" allows setting more parameters. Clicking on \\\"Advanced\\\"\n"
" in \\\"Properties\\\" brings up the full gui.\n"
"\n"
" - tray: Attempt to embed the small icon in the system tray. If\n"
" this fails it will resort to icon mode where the small icon\n"
" is a standalone window.\n"
"\n"
"Note that in \\\"full\\\" mode if you delete the full gui window the gui\n"
"terminates (but the x11vnc server keeps running). However under \\\"icon\\\"\n"
"or \\\"tray\\\" mode if you bring up the full gui window via \\\"Properties ->\n"
"Advanced\\\" and then delete it the gui does NOT terminate.\n"
"\n"
"Also note that by default in \\\"icon\\\" mode if you delete the icon\n"
"window both the gui *and* the x11vnc server terminate.\n"
"\"\n"
"\n"
" set helptext(gui) \"\n"
"tkx11vnc is a simple frontend to x11vnc. Nothing fancy, it merely\n"
"provides an interface to each of the many x11vnc command line options and\n"
"remote control commands. See \\\"Help -> all\\\" for much info about x11vnc.\n"
"\n"
"For a simplier gui, run x11vnc in \\\"tray\\\" or \\\"icon\\\" mode such as\n"
"\\\"-gui tray\\\", \\\"-gui icon\\\", or \\\"-gui tray=setpass\\\". In that\n"
"mode the full gui is only available under \\\"Advanced ...\\\".\n"
"\n"
"Also, \\\"-gui ez\\\" will show fewer menu items (toggle via Misc -> simple_gui)\n"
"\n"
"All menu items have a (?) button one can click on to get more information\n"
"about the option or command.\n"
"\n"
"There are two states tkx11vnc can be in:\n"
"\n"
" 1) Available to control a running x11vnc process.\n"
"\n"
" 2) Getting ready to start a x11vnc process.\n"
"\n"
"Most people will just use state 1).\n"
"\n"
"In state 1) the Menu items available in the menus are those that\n"
"correspond to the x11vnc \\\"remote control\\\" commands. See the -remote\n"
"entry under \\\"Help -> all\\\" for a complete list. Also available is\n"
"the \\\"Actions -> stop\\\" item to shut down the running x11vnc server,\n"
"thereby changing to state 2). There are other actions available too.\n"
"\n"
"In state 2) the Menu items available in the menus (\\\"Actions\\\", \\\"Clients\\\",\n"
"etc.) are those that correspond to command line options used in starting\n"
"an x11vnc process, and the \\\"Actions -> start\\\" item executes\n"
"x11vnc thereby changing to state 1). To see what x11vnc startup command\n"
"you have built so far, look at the (?) help for \\\"Actions -> start\\\"\n"
"and it will show you what the command looks like.\n"
"\n"
"There is much overlap between the menu items available in state 1)\n"
"and state 2), but it is worth keeping in mind it is not 100%.\n"
"For example, you cannot set passwords or password files in state 1).\n"
"(update: simple password setting is now allowed in \\\"tray\\\" or \\\"icon\\\" mode).\n"
"\n"
"\n"
"Also note that there may be *two* separate X displays involved, not just\n"
"one: 1) the X display x11vnc will be polling (and making available to\n"
"VNC viewers), and 2) the X display this GUI is intended to display on.\n"
"\n"
"For example, one might use ssh to access the remote machine where the\n"
"GUI would display on :11 and x11vnc would poll display :0. By default\n"
"the gui will display on the value in the DISPLAY env. variable followed\n"
"by the value from the -display option. To override this, use something\n"
"like: \\\"-gui otherhost:0\\\", etc.\n"
"\n"
"\n"
"GUI components: \n"
"--- ----------\n"
"\n"
"1) At the top of the gui is a info text label where information will\n"
" be posted, e.g. when traversing menu items text indicating how to get\n"
" help on the item and its current value will be displayed.\n"
"\n"
"2) Below the info label is the area where the menu buttons, \\\"Actions\\\",\n"
" \\\"Clients\\\", etc., are presented. If a menu item has a checkbox,\n"
" it corresponds to a boolean on/off variable. Otherwise it is\n"
" either a string variable, or an action not associated with a\n"
" variable (for the most part).\n"
"\n"
"3) Below the menu button area is a label indicating the current x11vnc\n"
" X display being polled and the corresponding VNC display name. Both\n"
" will be \\\"(*none*)\\\" when there is no connection established.\n"
"\n"
"4) Below the x11 and vnc displays label is a text area there scrolling\n"
" information about actions being taken and commands being run is displayed.\n"
" To scroll click in the area and use PageUp/PageDown or the arrow keys.\n"
"\n"
"5) At the bottom is an entry area. When one selects a menu item that\n"
" requires supplying a string value, the label will be set to the\n"
" parameter name and one types in the new value. Then one presses the\n"
" \\\"OK\\\" button or presses \\\"Enter\\\" to set the value. Or you can press\n"
" \\\"Cancel\\\" or \\\"Escape\\\" to avoid changing the variable.\n"
"\n"
" Many variables are boolean toggles (for example, \\\"Permissions ->\n"
" viewonly\\\") or Radio button selections. Selecting these menu items\n"
" will NOT activate the entry area but rather toggle the variable\n"
" immediately.\n"
"\n"
"\n"
"CASCADES BUG: There is a bug not yet worked around for the cascade menus\n"
"where the (?) help button gets in the way. To get the mouse over to\n"
"the cascade menu click and release mouse to activate the cascade, then\n"
"you can click on its items. Dragging with a mouse button held down will\n"
"not work (sorry!).\n"
"\n"
"\n"
"Key Bindings:\n"
"\n"
" In the Text Area: Control-/ selects all of the text.\n"
" Anywhere: Control-d invokes \\\"Actions -> detach\\\"\n"
" Anywhere: Control-a invokes \\\"Actions -> attach\\\"\n"
" Anywhere: Control-p invokes \\\"Actions -> ping\\\"\n"
" Anywhere: Control-u and Control-r invoke \\\"Actions -> update-all\\\"\n"
"\"\n"
"\n"
"set under_wally \"\n"
"Misc:\n"
"\n"
"Since x11vnc has so many settings and to avoid further confusion,\n"
"the libvncserver options:\n"
"\n"
" -alwaysshared\n"
" -nevershared\n"
" -dontdisconnect\n"
"\n"
"are not available for changing in a running x11vnc (even though it\n"
"is feasible). These options overlap with the x11vnc options -shared\n"
"and -forever which are hopefully enough for most usage. They may be\n"
"specified for x11vnc startup if desired.\n"
"\n"
"\"\n"
"\n"
"global beginner_mode\n"
"if {$beginner_mode} {\n"
" set helptext(gui) \"\n"
"tkx11vnc is a simple frontend to x11vnc. It is currently running in\n"
"\\\"ez\\\" or \\\"simple\\\" mode. For many more options run it in normal\n"
"mode by toggling \\\"Misc -> simple_gui\\\".\n"
"\n"
"All menu items have a (?) button one can click on to get more information\n"
"about the option or command.\n"
"\n"
"GUI components: \n"
"--- ----------\n"
"\n"
"1) At the top of the gui is a info text label where information will\n"
" be posted, e.g. when traversing menu items text indicating how to get\n"
" help on the item and its current value will be displayed.\n"
"\n"
"2) Below the info label is the area where the menu buttons, \\\"Actions\\\",\n"
" \\\"Clients\\\", etc., are presented. If a menu item has a checkbox,\n"
" it corresponds to a boolean on/off variable. Otherwise it is\n"
" either a string variable, or an action not associated with a\n"
" variable (for the most part).\n"
"\n"
"3) Below the menu button area is a label indicating the current x11vnc\n"
" X display being polled and the corresponding VNC display name. Both\n"
" will be \\\"(*none*)\\\" when there is no connection established.\n"
"\n"
"4) Below the x11 and vnc displays label is a text area there scrolling\n"
" information about actions being taken and commands being run is displayed.\n"
" To scroll click in the area and use PageUp/PageDown or the arrow keys.\n"
"\n"
"5) At the bottom is an entry area. When one selects a menu item that\n"
" requires supplying a string value, the label will be set to the\n"
" parameter name and one types in the new value. Then one presses the\n"
" \\\"OK\\\" button or presses \\\"Enter\\\" to set the value. Or you can press\n"
" \\\"Cancel\\\" or \\\"Escape\\\" to avoid changing the variable.\n"
"\n"
" Many variables are boolean toggles (for example, \\\"Permissions ->\n"
" viewonly\\\") or Radio button selections. Selecting these menu items\n"
" will NOT activate the entry area but rather toggle the variable\n"
" immediately.\n"
"\n"
"CASCADES BUG: There is a bug not yet worked around for the cascade menus\n"
"where the (?) help button gets in the way. To get the mouse over to\n"
"the cascade menu click and release mouse to activate the cascade, then\n"
"you can click on its items. Dragging with a mouse button held down will\n"
"not work (sorry!).\n"
"\n"
"\"\n"
"}\n"
"\n"
"}\n"
"\n"
"proc center_win {w} {\n"
" wm withdraw $w\n"
" set x [expr [winfo screenwidth $w]/2 - [winfo reqwidth $w]/2];\n"
" set y [expr [winfo screenheight $w]/2 - [winfo reqheight $w]/2];\n"
" wm geometry $w +$x+$y\n"
" wm deiconify $w\n"
" update\n"
"}\n"
"\n"
"proc textwidth {text} {\n"
" set min 0;\n"
" foreach line [split $text \"\\n\"] {\n"
" set n [string length $line]\n"
" if {$n > $min} {\n"
" set min $n\n"
" }\n"
" }\n"
" return $min\n"
"}\n"
"\n"
"proc textheight {text} {\n"
" set count 0;\n"
" foreach line [split $text \"\\n\"] {\n"
" incr count\n"
" }\n"
" return $count\n"
"}\n"
"\n"
"proc set_name {name} {\n"
" global full_win icon_mode\n"
" global saved_set_name\n"
"\n"
" if {![info exists saved_set_name]} {\n"
" set saved_set_name \"tkx11vnc\"\n"
" }\n"
" if {$name == \"RESTORE\"} {\n"
" set name $saved_set_name\n"
" } else {\n"
" set saved_set_name $name\n"
" }\n"
" if {![info exists full_win]} {\n"
" return\n"
" }\n"
" set w \".\"\n"
" if {$icon_mode} {\n"
" wm title $w \"$name\"\n"
" wm iconname $w \"$name\"\n"
" set w $full_win\n"
" }\n"
" wm title $w \"$name\"\n"
" wm iconname $w \"$name\"\n"
"}\n"
"\n"
"proc make_toplevel {w {title \"\"}} {\n"
" catch {destroy $w}\n"
" toplevel $w;\n"
" bind $w <Escape> \"destroy $w\"\n"
" if {$title != \"\"} {\n"
" wm title $w $title\n"
" wm iconname $w $title\n"
" }\n"
"}\n"
"\n"
"proc textwin {name title text {entry \"\"}} {\n"
" global max_text_height max_text_width\n"
" global bfont ffont\n"
"\n"
" set width [textwidth $text]\n"
" incr width\n"
" if {$width > $max_text_width} {\n"
" set width $max_text_width\n"
" }\n"
" set height [textheight $text]\n"
" if {$height > $max_text_height} {\n"
" set height $max_text_height\n"
" }\n"
"\n"
" set w \".text_$name\"\n"
" make_toplevel $w $title\n"
"\n"
" frame $w.f -bd 0;\n"
" pack $w.f -fill both -expand 1\n"
" text $w.f.t -width $width -height $height -setgrid 1 -bd 2 \\\n"
" -yscrollcommand \"$w.f.y set\" -relief ridge \\\n"
" -font $ffont;\n"
" scrollbar $w.f.y -orient v -relief sunken -command \"$w.f.t yview\";\n"
" button $w.f.b -text \"Dismiss\" -command \"destroy $w\" -font $bfont \\\n"
" -pady 2\n"
"\n"
" $w.f.t insert 1.0 $text;\n"
"\n"
" bind $w <Enter> \"focus $w.f.t\"\n"
"\n"
" if {$entry != \"\"} {\n"
" # varname+Label Name\n"
" set list [split $entry \"+\"]\n"
" set varname [lindex $list 0]\n"
" set labname [lindex $list 1]\n"
" frame $w.f.ef -bd 1 -relief groove\n"
" label $w.f.ef.l -text \"$labname\" -anchor w -font $bfont\n"
" entry $w.f.ef.e -relief sunken -font $ffont \\\n"
" -textvariable $varname\n"
" button $w.f.ef.b -text \"OK\" -font $bfont \\\n"
" -command \"set ${varname}_ok 1; destroy $w\" \n"
" bind $w.f.ef.e <KeyPress-Return> \"set ${varname}_ok 1; destroy $w\"\n"
" \n"
" pack $w.f.ef.l -side left\n"
" pack $w.f.ef.e -side left -fill x -expand 1\n"
" pack $w.f.ef.b -side right\n"
" }\n"
"\n"
" wm withdraw $w\n"
" pack $w.f.b -side bottom -fill x \n"
" if {$entry != \"\"} {\n"
" pack $w.f.ef -side bottom -fill x \n"
" bind $w <Enter> \"focus $w.f.ef.e\"\n"
" $w.f.ef.e icursor end\n"
" } else {\n"
" bind $w <Enter> \"focus $w.f.t\"\n"
" }\n"
" pack $w.f.y -side right -fill y;\n"
" pack $w.f.t -side top -fill both -expand 1;\n"
" update\n"
"\n"
" center_win $w\n"
"\n"
" return $w\n"
"}\n"
"\n"
"proc active_when_connected {item} {\n"
" global helpremote helptext\n"
" global icon_mode\n"
"\n"
" if {$icon_mode} {\n"
" if {$item == \"passwd\"} {\n"
" return 1\n"
" }\n"
" if {$item == \"viewpasswd\"} {\n"
" return 1\n"
" }\n"
" }\n"
"\n"
" if {[opt_match G $item]} {\n"
" return 1\n"
" } elseif {[opt_match R $item]} {\n"
" return 1\n"
" } elseif {[opt_match S $item]} {\n"
" return 0\n"
" } elseif {[is_action $item]} {\n"
" if {[opt_match R $item]} {\n"
" return 1\n"
" } else {\n"
" return 0\n"
" }\n"
" } elseif {[info exists helpremote($item)]} {\n"
" return 1\n"
" } else {\n"
" return 0\n"
" }\n"
"}\n"
"\n"
"proc active_when_starting {item} {\n"
" global helpremote helptext beginner_mode\n"
"\n"
" if {$beginner_mode} {\n"
" if {[opt_match G $item]} {\n"
" return 1\n"
" }\n"
" if {$item == \"display\"} {\n"
" return 1\n"
" }\n"
" if {$item == \"attach\"} {\n"
" return 1\n"
" }\n"
" if {$item == \"debug_gui\"} {\n"
" return 1\n"
" }\n"
" return 0\n"
" }\n"
"\n"
" if {[opt_match G $item]} {\n"
" return 1\n"
" } elseif {[opt_match S $item]} {\n"
" return 1\n"
" } elseif {[opt_match R $item]} {\n"
" return 0\n"
" } elseif {[is_action $item]} {\n"
" if {[opt_match S $item]} {\n"
" return 1\n"
" } else {\n"
" return 0\n"
" }\n"
" } elseif {[info exists helptext($item)]} {\n"
" return 1\n"
" } else {\n"
" return 0\n"
" }\n"
"}\n"
"\n"
"proc help_win {item} {\n"
" global helptext helpremote menu_var\n"
" global query_ans query_aro\n"
" global beginner_mode\n"
"\n"
" set ok 0\n"
" set text \"Help on $item:\\n\\n\"\n"
"\n"
" if {$item == \"NewClient\"} {\n"
" ;\n"
" } elseif {[is_gui_internal $item]} {\n"
" if {$item != \"gui\" && $item != \"all\" && $item != \"Misc-Tuning:\" \\\n"
" && $item != \"Properties\" && $item != \"Tray\"} {\n"
" append text \" + Is a gui internal Action (cannot be set).\\n\";\n"
" }\n"
" } elseif {[is_action $item]} {\n"
" append text \" + Is a remote control Action (cannot be set).\\n\";\n"
" } elseif {[active_when_connected $item]} {\n"
" append text \" + Can be changed in a running x11vnc.\\n\";\n"
" } else {\n"
" append text \" - Cannot be changed in a running x11vnc.\\n\";\n"
" }\n"
" if {$item == \"NewClient\"} {\n"
" ;\n"
" } elseif {[is_gui_internal $item]} {\n"
" ;\n"
" } elseif {[active_when_starting $item]} {\n"
" append text \" + Can be set at x11vnc startup.\\n\";\n"
" } else {\n"
" if {! $beginner_mode} {\n"
" append text \" - Cannot be set at x11vnc startup.\\n\";\n"
" }\n"
" }\n"
" append text \"\\n\"\n"
"\n"
" if {[info exists helptext($item)]} {\n"
" append text \"\\n\"\n"
" if {[is_gui_internal $item]} {\n"
" append text \"==== x11vnc help: ====\\n\";\n"
" } else {\n"
" append text \"==== x11vnc startup option help: ====\\n\";\n"
" }\n"
" append text \"\\n\"\n"
" append text $helptext($item)\n"
" append text \"\\n\"\n"
" set ok 1\n"
" }\n"
"\n"
" if {[info exists helpremote($item)]} {\n"
" append text \"\\n\"\n"
" append text \"==== x11vnc remote control help: ====\\n\";\n"
" append text \"\\n\"\n"
" append text $helpremote($item)\n"
" set ok 1\n"
" }\n"
"\n"
" if {![is_action $item] && [info exists menu_var($item)]} {\n"
" global unset_str\n"
" append text \"\\n\\n\"\n"
" append text \"==== current $item value: ====\\n\";\n"
" append text \"\\n\"\n"
"\n"
" if {$item == \"passwd\" || $item == \"viewpasswd\"} {\n"
" ;\n"
" } elseif {$menu_var($item) == \"\"} {\n"
" append text \"$unset_str\\n\"\n"
" } else {\n"
" append text \"$menu_var($item)\\n\"\n"
" }\n"
" if {$item == \"http\" || $item == \"httpdir\" || $item == \"httpport\"} {\n"
" global vnc_url;\n"
" append text \"\\nURL: $vnc_url\\n\"\n"
" }\n"
" }\n"
"\n"
" if {$item == \"start\"} {\n"
" set str [get_start_x11vnc_txt]\n"
" append_text \"$str\\n\"\n"
"# append text \"\\nPossible \\$HOME/.x11vncrc settings for this command:\\n\\n\"\n"
"# set rctxt [get_start_x11vnc_cmd 1]\n"
"# append text \"$rctxt\\n\"\n"
" }\n"
"\n"
" regsub -all { } $item \" \" name\n"
"\n"
" if {$ok} {\n"
" textwin $name \"x11vnc help: $item\" \"$text\";\n"
" }\n"
" return $ok\n"
"}\n"
"\n"
"proc parse_help {} {\n"
" global env x11vnc_prog;\n"
" global helpall helptext;\n"
"\n"
" set helppipe [open \"| $x11vnc_prog -help\" \"r\"];\n"
" if {$helppipe == \"\"} {\n"
" puts stderr \"failed to run $x11vnc_prog -help\";\n"
" exit 1;\n"
" }\n"
"\n"
" set sawopts 0;\n"
" set curropt \"\";\n"
" while {[gets $helppipe line] > -1} {\n"
" append helpall \"$line\\n\" \n"
"\n"
" # XXX\n"
" if {[regexp {^Options:} $line]} {\n"
" set sawopts 1;\n"
" continue;\n"
" }\n"
" # XXX\n"
" if {[regexp {^These options} $line]} {\n"
" continue;\n"
" }\n"
" # tweak aliases:\n"
" regsub {^-zeroconf} $line \"-zero_conf\" line\n"
" regsub {^-avahi } $line \"-zeroconf\" line\n"
"\n"
" if {! $sawopts} {\n"
" continue;\n"
" }\n"
" if {[regexp {^-([0-9A-z_][0-9A-z_]*)} $line match name]} {\n"
" set allnames($name) 1;\n"
" if {\"$curropt\" != \"no$name\" && \"no$curropt\" != \"$name\"} {\n"
" set curropt $name;\n"
" set helptext($curropt) \"$line\\n\";\n"
" } else {\n"
" append helptext($curropt) \"$line\\n\";\n"
" }\n"
" } elseif {$curropt != \"\"} {\n"
" append helptext($curropt) \"$line\\n\";\n"
" }\n"
" }\n"
" foreach name [array names allnames] {\n"
" if {[regexp {^no} $name]} {\n"
" regsub {^no} $name \"\" pair\n"
" } else {\n"
" set pair \"no$name\"\n"
" }\n"
" if {[info exists helptext($name)]} {\n"
" if ![info exists helptext($pair)] {\n"
" set helptext($pair) $helptext($name);\n"
" }\n"
" } elseif {[info exists helptext($pair)]} {\n"
" if ![info exists helptext($name)] {\n"
" set helptext($name) $helptext($pair);\n"
" }\n"
" }\n"
" }\n"
"\n"
" set_internal_help\n"
"}\n"
"\n"
"proc tweak_both {new old} {\n"
" tweak_help $new $old\n"
" tweak_remote_help $new $old\n"
"}\n"
"\n"
"proc tweak_remote_help {new old} {\n"
" global helpremote\n"
" if ![info exists helpremote($new)] {\n"
" if {[info exists helpremote($old)]} {\n"
" set helpremote($new) $helpremote($old)\n"
" }\n"
" }\n"
"}\n"
"\n"
"proc tweak_help {new old} {\n"
" global helptext\n"
" if ![info exists helptext($new)] {\n"
" if {[info exists helptext($old)]} {\n"
" set helptext($new) $helptext($old)\n"
" }\n"
" }\n"
"}\n"
"\n"
"proc parse_remote_help {} {\n"
" global helpremote helptext help_indent remote_name;\n"
"\n"
" set sawopts 0;\n"
" set curropt \"\";\n"
" set possopts \"\";\n"
" set offset [expr $help_indent - 1];\n"
" foreach line [split $helptext(remote) \"\\n\"] {\n"
" \n"
" set line [string range $line $offset end];\n"
"\n"
" # XXX\n"
" if {[regexp {^The following -remote/-R commands} $line]} {\n"
" set sawopts 1;\n"
" continue;\n"
" }\n"
" # XXX\n"
" if {[regexp {^The vncconnect.*command} $line]} {\n"
" set sawopts 0;\n"
" }\n"
"\n"
" if {! $sawopts} {\n"
" continue;\n"
" }\n"
" if {[regexp {^([0-9A-z_][0-9A-z_:]*)} $line match name]} {\n"
" regsub {:.*$} $name \"\" popt\n"
" lappend possopts $popt\n"
" if {\"$curropt\" != \"no$name\" && \"no$curropt\" != \"$name\"} {\n"
" set curropt $name;\n"
" regsub {:.*$} $curropt \"\" curropt\n"
" set remote_name($curropt) $name\n"
" set helpremote($curropt) \"$line\\n\";\n"
" } else {\n"
" append helpremote($curropt) \"$line\\n\";\n"
" }\n"
" } elseif {$curropt != \"\"} {\n"
" append helpremote($curropt) \"$line\\n\";\n"
" }\n"
" }\n"
"\n"
" foreach popt $possopts {\n"
" if {[info exists helpremote($popt)]} {\n"
" continue\n"
" }\n"
" if {[regexp {^no} $popt]} {\n"
" regsub {^no} $popt \"\" try\n"
" } else {\n"
" set try \"no$popt\"\n"
" }\n"
" if {[info exists helpremote($try)]} {\n"
" set helpremote($popt) $helpremote($try)\n"
" }\n"
" }\n"
"}\n"
"\n"
"proc parse_query_help {} {\n"
" global query_ans query_aro query_ans_list query_aro_list helptext;\n"
"\n"
" set sawans 0;\n"
" set sawaro 0;\n"
" set ans_str \"\"\n"
" set aro_str \"\"\n"
"\n"
" foreach line [split $helptext(query) \"\\n\"] {\n"
"\n"
" if {! $sawans && [regexp {^ *ans=} $line]} {\n"
" set sawans 1\n"
" }\n"
" if {! $sawans} {\n"
" continue\n"
" }\n"
"\n"
" if {[regexp {^ *aro=} $line]} {\n"
" set sawaro 1\n"
" }\n"
" if {$sawaro && [regexp {^[ ]*$} $line]} {\n"
" set sawans 0\n"
" break\n"
" }\n"
"\n"
" regsub {ans=} $line \"\" line\n"
" regsub {aro=} $line \"\" line\n"
" set line [string trim $line]\n"
"\n"
" if {$sawaro} {\n"
" set aro_str \"$aro_str $line\"\n"
" } else {\n"
" set ans_str \"$ans_str $line\"\n"
" }\n"
" }\n"
"\n"
" regsub -all { *} $ans_str \" \" ans_str\n"
" regsub -all { *} $aro_str \" \" aro_str\n"
"\n"
" set ans_str [string trim $ans_str]\n"
" set aro_str [string trim $aro_str]\n"
" set query_ans_list [split $ans_str]\n"
" set query_aro_list [split $aro_str]\n"
"\n"
" foreach item $query_ans_list {\n"
" if {[regexp {^[ ]*$} $item]} {\n"
" continue\n"
" }\n"
" set query_ans($item) 1\n"
" }\n"
" foreach item $query_aro_list {\n"
" if {[regexp {^[ ]*$} $item]} {\n"
" continue\n"
" }\n"
" set query_aro($item) 1\n"
" }\n"
"}\n"
"\n"
"proc in_debug_mode {} {\n"
" global menu_var\n"
" if {![info exists menu_var(debug_gui)]} {\n"
" return 0\n"
" }\n"
" return $menu_var(debug_gui)\n"
"}\n"
"\n"
"# Menubar utilities:\n"
"proc menus_state {state} {\n"
" global menu_b\n"
"\n"
" foreach case [array names menu_b] {\n"
" set menu_button $menu_b($case)\n"
" if {![winfo exists $menu_button]} {\n"
" continue\n"
" }\n"
" $menu_button configure -state $state\n"
" }\n"
"}\n"
"\n"
"proc menus_enable {} {\n"
" global menus_disabled\n"
"\n"
" menus_state \"normal\"\n"
" set menus_disabled 0\n"
"}\n"
"\n"
"proc menus_disable {} {\n"
" global menus_disabled\n"
"\n"
" set menus_disabled 1\n"
" menus_state \"disabled\"\n"
"}\n"
"\n"
"# Entry box utilities:\n"
"proc entry_state {x state} {\n"
" global entry_box entry_label entry_ok entry_help entry_skip entry_browse\n"
" global old_labels\n"
" if {$x == \"all\"} {\n"
" if {!$old_labels} {\n"
" $entry_label configure -state $state\n"
" }\n"
" $entry_box configure -state $state\n"
" $entry_ok configure -state $state\n"
" $entry_skip configure -state $state\n"
" $entry_help configure -state $state\n"
" $entry_browse configure -state $state\n"
" } elseif {$x == \"label\"} {\n"
" if {!$old_labels} {\n"
" $entry_label configure -state $state\n"
" }\n"
" } elseif {$x == \"box\"} {\n"
" $entry_box configure -state $state\n"
" } elseif {$x == \"ok\"} {\n"
" $entry_ok configure -state $state\n"
" } elseif {$x == \"skip\"} {\n"
" $entry_skip configure -state $state\n"
" } elseif {$x == \"help\"} {\n"
" $entry_help configure -state $state\n"
" } elseif {$x == \"browse\"} {\n"
" $entry_browse configure -state $state\n"
" }\n"
"}\n"
"\n"
"proc entry_enable {{x \"all\"}} {\n"
" entry_state $x normal\n"
"}\n"
"\n"
"proc entry_disable {{x \"all\"}} {\n"
" entry_state $x disabled\n"
"}\n"
"\n"
"proc entry_browse_button {{show 1}} {\n"
" global entry_browse\n"
" if {$show} {\n"
" pack $entry_browse -side left\n"
" } else {\n"
" pack forget $entry_browse\n"
" }\n"
"}\n"
"proc entry_focus {} {\n"
" global entry_box\n"
" focus $entry_box\n"
"}\n"
"proc entry_select {} {\n"
" global entry_box\n"
" $entry_box selection range 0 end\n"
"}\n"
"proc entry_get {} {\n"
" global entry_box\n"
" return [$entry_box get]\n"
"}\n"
"proc entry_insert {str} {\n"
" global entry_box\n"
" entry_delete\n"
" $entry_box insert end $str\n"
" $entry_box icursor end\n"
"}\n"
"proc entry_delete {} {\n"
" global entry_box\n"
" $entry_box delete 0 end\n"
"}\n"
"\n"
"\n"
"# Utilities for remote control and updating vars.\n"
"\n"
"proc push_new_value {item name new {query 1}} {\n"
" global menu_var always_update remote_output query_output\n"
" global query_result_list\n"
"\n"
" set debug [in_debug_mode]\n"
"\n"
" set getout 0\n"
" set print_getout 0;\n"
"\n"
" set do_query_all 0\n"
"\n"
" set newnew \"\"\n"
" if {$item == \"disconnect\"} {\n"
" set newnew \"N/A\"\n"
" set do_query_all 1\n"
" } elseif {$always_update} {\n"
" set do_query_all 1\n"
" }\n"
"\n"
" if {$item == \"remote-cmd\"} {\n"
" # kludge for arbitrary remote command:\n"
" if {[regexp {^Q:} $new]} {\n"
" # extra kludge for Q:var to mean -Q var\n"
" regsub {^Q:} $new \"\" new\n"
" set qonly 1\n"
" } else {\n"
" set qonly 0\n"
" }\n"
" # need to extract item from new:\n"
" set qtmp $new\n"
" regsub {:.*$} $qtmp \"\" qtmp\n"
" if {$qonly} {\n"
" set rargs [list \"-Q\" \"$qtmp\"]\n"
" set print_getout 1\n"
" set qargs \"\"\n"
" } else {\n"
" set rargs [list \"-R\" \"$new\"]\n"
" set qargs \"\"\n"
" }\n"
" set getout 1\n"
"\n"
" } elseif {[value_is_string $item]} {\n"
" # string var:\n"
" set rargs [list \"-R\" \"$name:$new\"]\n"
" set qargs [list \"-Q\" \"$name\"]\n"
" } else {\n"
" # boolean var:\n"
" set rargs [list \"-R\" \"$name\"]\n"
" set qargs [list \"-Q\" \"$name\"]\n"
" }\n"
"\n"
" if {! $query && ! $always_update} {\n"
" set getout 1\n"
" } elseif {$item == \"noremote\"} {\n"
" set getout 1\n"
" } elseif {[is_action $item] && ![opt_match Q $item] && $rargs != \"\"} {\n"
" set getout 1\n"
" } elseif {[regexp {^(sid|id)$} $item] && ![regexp {^0x} $new]} {\n"
" set getout 1\n"
" }\n"
"\n"
" set remote_output \"\"\n"
" set query_output \"\"\n"
"\n"
" if {!$debug} {\n"
" if [regexp {passwd} $rargs] {\n"
" append_text \"x11vnc ...\"\n"
" } else {\n"
" append_text \"x11vnc $rargs ...\"\n"
" }\n"
" }\n"
"\n"
" if {$getout} {\n"
" set remote_output [run_remote_cmd $rargs]\n"
" if {$print_getout} {\n"
" append_text \"\\t$remote_output\"\n"
" }\n"
" append_text \"\\n\"\n"
" return\n"
" }\n"
"\n"
" if {$do_query_all} {\n"
" set all [all_query_vars]\n"
" set qargs [list \"-Q\" $all]\n"
"\n"
" global last_query_all_time\n"
" set last_query_all_time [clock seconds]\n"
" }\n"
"\n"
" set rqargs [concat $rargs $qargs]\n"
"\n"
" set query [run_remote_cmd $rqargs]\n"
" set query_output $query\n"
"\n"
" set query_result_list \"\"\n"
"\n"
" if {$newnew != \"\"} {\n"
" set new $newnew\n"
" }\n"
"\n"
" if {![see_if_ok $query $item \"$name:$new\"]} {\n"
" # failed\n"
" if {[regexp {^a..=} $query]} {\n"
" # but some result came back\n"
" # synchronize everything with a 2nd call.\n"
" set query_output [query_all 1]\n"
" } else {\n"
" # server may be dead\n"
" if {$item != \"ping\" && $item != \"attach\"} {\n"
" try_connect\n"
" }\n"
" }\n"
" } else {\n"
" # succeeded\n"
" # synchronize this variable (or variables)\n"
" # for a speedup used the list parsed by see_if_ok.\n"
" update_menu_vars \"USE_LIST\"\n"
"\n"
" if {$do_query_all} {\n"
" global all_settings\n"
" set all_settings $query\n"
" }\n"
" }\n"
"}\n"
"\n"
"proc set_kmbc_str {} {\n"
" global vl_bk vl_bm vl_bb vl_bc vl_bf vr_bk vr_bm vr_bb vr_bc vr_bf\n"
"\n"
" set str \"\"\n"
" if {$vl_bk} {\n"
" append str \"K\"\n"
" }\n"
" if {$vl_bm} {\n"
" append str \"M\"\n"
" }\n"
" if {$vl_bb} {\n"
" append str \"B\"\n"
" }\n"
" if {$vl_bc} {\n"
" append str \"C\"\n"
" }\n"
" if {$vl_bf} {\n"
" append str \"F\"\n"
" }\n"
" if {$vr_bk || $vr_bm || $vr_bb || $vr_bc || $vr_bf} {\n"
" append str \",\"\n"
" }\n"
" if {$vr_bk} {\n"
" append str \"K\"\n"
" }\n"
" if {$vr_bm} {\n"
" append str \"M\"\n"
" }\n"
" if {$vr_bb} {\n"
" append str \"B\"\n"
" }\n"
" if {$vr_bc} {\n"
" append str \"C\"\n"
" }\n"
" if {$vr_bf} {\n"
" append str \"F\"\n"
" }\n"
" entry_insert $str\n"
"}\n"
"\n"
"proc insert_input_window {} {\n"
" global text_area cleanup_window\n"
" global ffont menu_var\n"
" global vl_bk vl_bm vl_bb vl_bc vl_bf vr_bk vr_bm vr_bb vr_bc vr_bf\n"
"\n"
" append_text \"\\nUse these checkboxes to set the input permissions, \"\n"
" append_text \"or type in the \\\"KMBCF...\\\"\\n\"\n"
" append_text \"-input string manually. Then press \\\"OK\\\" or \\\"Cancel\\\".\\n\"\n"
" append_text \"(note: an empty setting means use the default behavior, \"\n"
" append_text \"see viewonly)\\n\\n\"\n"
" set w \"$text_area.wk_f\"\n"
" catch {destroy $w}\n"
" frame $w -bd 1 -relief ridge -cursor {top_left_arrow}\n"
" set fl $w.fl\n"
" frame $fl\n"
" set fr $w.fr\n"
" frame $fr\n"
" label $fl.l -font $ffont -text \"Normal clients: \"\n"
" checkbutton $fl.bk -pady 1 -font $ffont -anchor w -variable vl_bk \\\n"
" -pady 1 -command set_kmbc_str -text \"Keystrokes\" \n"
" checkbutton $fl.bm -font $ffont -anchor w -variable vl_bm \\\n"
" -pady 1 -command set_kmbc_str -text \"Mouse-Motion\" \n"
" checkbutton $fl.bb -font $ffont -anchor w -variable vl_bb \\\n"
" -pady 1 -command set_kmbc_str -text \"Button-Click\"\n"
" checkbutton $fl.bc -font $ffont -anchor w -variable vl_bc \\\n"
" -pady 1 -command set_kmbc_str -text \"Clipboard-Input\"\n"
" checkbutton $fl.bf -font $ffont -anchor w -variable vl_bf \\\n"
" -pady 1 -command set_kmbc_str -text \"Files\"\n"
" label $fr.l -pady 1 -font $ffont -text \"View-Only clients:\"\n"
" checkbutton $fr.bk -font $ffont -anchor w -variable vr_bk \\\n"
" -pady 1 -command set_kmbc_str -text \"Keystrokes\" \n"
" checkbutton $fr.bm -font $ffont -anchor w -variable vr_bm \\\n"
" -pady 1 -command set_kmbc_str -text \"Mouse-Motion\" \n"
" checkbutton $fr.bb -font $ffont -anchor w -variable vr_bb \\\n"
" -pady 1 -command set_kmbc_str -text \"Button-Click\"\n"
" checkbutton $fr.bc -font $ffont -anchor w -variable vr_bc \\\n"
" -pady 1 -command set_kmbc_str -text \"Clipboard-Input\"\n"
" checkbutton $fr.bf -font $ffont -anchor w -variable vr_bf \\\n"
" -pady 1 -command set_kmbc_str -text \"Files\"\n"
"\n"
" if {[info exists menu_var(input)]} {\n"
" set input_str $menu_var(input)\n"
" } else {\n"
" set input_str \"\"\n"
" }\n"
"\n"
" if {[regexp {(.*),(.*)} $input_str match normal viewonly]} {\n"
" ;\n"
" } else {\n"
" set normal $input_str\n"
" set viewonly \"\"\n"
" }\n"
" set vl_bk 0\n"
" set vl_bm 0\n"
" set vl_bb 0\n"
" set vl_bc 0\n"
" set vl_bf 0\n"
"\n"
" set vr_bk 0\n"
" set vr_bm 0\n"
" set vr_bb 0\n"
" set vr_bc 0\n"
" set vr_bf 0\n"
"\n"
" if {[regexp -nocase {K} $normal]} {\n"
" set vl_bk 1\n"
" }\n"
" if {[regexp -nocase {M} $normal]} {\n"
" set vl_bm 1\n"
" }\n"
" if {[regexp -nocase {B} $normal]} {\n"
" set vl_bb 1\n"
" }\n"
" if {[regexp -nocase {C} $normal]} {\n"
" set vl_bc 1\n"
" }\n"
" if {[regexp -nocase {F} $normal]} {\n"
" set vl_bf 1\n"
" }\n"
" if {[regexp -nocase {K} $viewonly]} {\n"
" set vr_bk 1\n"
" }\n"
" if {[regexp -nocase {M} $viewonly]} {\n"
" set vr_bm 1\n"
" }\n"
" if {[regexp -nocase {B} $viewonly]} {\n"
" set vr_bb 1\n"
" }\n"
" if {[regexp -nocase {C} $viewonly]} {\n"
" set vr_bc 1\n"
" }\n"
" if {[regexp -nocase {F} $viewonly]} {\n"
" set vr_bf 1\n"
" }\n"
"\n"
" pack $fl.l $fl.bk $fl.bm $fl.bb $fl.bc $fl.bf -side top -fill x\n"
" pack $fr.l $fr.bk $fr.bm $fr.bb $fr.bc $fr.bf -side top -fill x\n"
" pack $fl $fr -side left\n"
" update\n"
" update idletasks\n"
" $text_area window create end -window $w\n"
" $text_area see end\n"
" $text_area insert end \"\\n\"\n"
"# $text_area insert end \"\\n\\n\\n\\n\\n\\n\\n\\n\\n\"\n"
"\n"
" set cleanup_window $w\n"
"}\n"
"\n"
"proc set_ca_str {w} {\n"
" global ca_bk ca_bm ca_bb ca_bc ca_bf ca_di\n"
"\n"
" if {$ca_di} {\n"
" entry_insert \"disconnect\"\n"
" $w.bk configure -state disabled\n"
" $w.bm configure -state disabled\n"
" $w.bb configure -state disabled\n"
" $w.bc configure -state disabled\n"
" $w.bf configure -state disabled\n"
" return\n"
" }\n"
"\n"
" $w.bk configure -state normal\n"
" $w.bm configure -state normal\n"
" $w.bb configure -state normal\n"
" $w.bc configure -state normal\n"
" $w.bf configure -state normal\n"
"\n"
" set str \"\"\n"
" if {$ca_bk} {\n"
" append str \"K\"\n"
" }\n"
" if {$ca_bm} {\n"
" append str \"M\"\n"
" }\n"
" if {$ca_bb} {\n"
" append str \"B\"\n"
" }\n"
" if {$ca_bc} {\n"
" append str \"C\"\n"
" }\n"
" if {$ca_bf} {\n"
" append str \"F\"\n"
" }\n"
" entry_insert $str\n"
"}\n"
"\n"
"proc insert_client_action_window {input} {\n"
" global text_area cleanup_window\n"
" global ffont menu_var\n"
" global ca_bk ca_bm ca_bb ca_bc ca_bf ca_di\n"
"\n"
" append_text \"\\nUse these checkboxes to set the input permissions \"\n"
" append_text \"for this client\\n-OR- whether to disconnect it instead. \"\n"
" append_text \"Then press \\\"OK\\\" or \\\"Cancel\\\".\\n\\n\"\n"
" set w \"$text_area.ca_f\"\n"
" catch {destroy $w}\n"
" frame $w -bd 1 -relief ridge -cursor {top_left_arrow}\n"
" checkbutton $w.di -pady 1 -font $ffont -anchor w -variable ca_di \\\n"
" -pady 1 -command \"set_ca_str $w\" -text \"Disconnect \" \n"
" checkbutton $w.bk -font $ffont -anchor w -variable ca_bk \\\n"
" -pady 1 -command \"set_ca_str $w\" -text \"Keystrokes\" \n"
" checkbutton $w.bm -font $ffont -anchor w -variable ca_bm \\\n"
" -pady 1 -command \"set_ca_str $w\" -text \"Mouse-Motion\" \n"
" checkbutton $w.bb -font $ffont -anchor w -variable ca_bb \\\n"
" -pady 1 -command \"set_ca_str $w\" -text \"Button-Click\"\n"
" checkbutton $w.bc -font $ffont -anchor w -variable ca_bc \\\n"
" -pady 1 -command \"set_ca_str $w\" -text \"Clipboard\"\n"
" checkbutton $w.bf -font $ffont -anchor w -variable ca_bf \\\n"
" -pady 1 -command \"set_ca_str $w\" -text \"Files\"\n"
"\n"
" set ca_di 0\n"
" set ca_bk 0\n"
" set ca_bm 0\n"
" set ca_bb 0\n"
" set ca_bf 0\n"
" set ca_bc 0\n"
"\n"
" if {[regexp -nocase {K} $input]} {\n"
" set ca_bk 1\n"
" }\n"
" if {[regexp -nocase {M} $input]} {\n"
" set ca_bm 1\n"
" }\n"
" if {[regexp -nocase {B} $input]} {\n"
" set ca_bb 1\n"
" }\n"
" if {[regexp -nocase {C} $input]} {\n"
" set ca_bc 1\n"
" }\n"
" if {[regexp -nocase {F} $input]} {\n"
" set ca_bf 1\n"
" }\n"
"\n"
" pack $w.di $w.bk $w.bm $w.bb $w.bc $w.bf -side left\n"
" update\n"
" update idletasks\n"
" $text_area window create end -window $w\n"
" $text_area see end\n"
" $text_area insert end \"\\n\"\n"
"\n"
" set cleanup_window $w\n"
"}\n"
"\n"
"proc cleanup_text_window {} {\n"
" global cleanup_window\n"
" if {[info exists cleanup_window]} {\n"
" catch {destroy $cleanup_window}\n"
" }\n"
"}\n"
"\n"
"# For updating a string variable. Also used for simple OK/Cancel dialogs\n"
"# with entry = 0.\n"
"proc entry_dialog {item {entry 1}} {\n"
" global menu_var entry_str entry_set entry_dialog_item\n"
" global unset_str connected_to_x11vnc entry_box\n"
"\n"
" set entry_str \"Set $item\"\n"
" set entry_set 0\n"
" set entry_dialog_item $item\n"
"\n"
" entry_enable\n"
" menus_disable\n"
"\n"
" if {$item == \"passwd\" || $item == \"viewpasswd\"} {\n"
" $entry_box configure -show \"*\"\n"
" }\n"
"\n"
" if {$entry} {\n"
" entry_insert \"\"\n"
" if {[info exists menu_var($item)] &&\n"
" $menu_var($item) != $unset_str} {\n"
" entry_insert $menu_var($item)\n"
" entry_select\n"
" }\n"
"\n"
" if {[is_browse $item]} {\n"
" entry_browse_button\n"
" }\n"
" set_info \"Set parameter in entry box, \"\n"
" entry_focus\n"
" } else {\n"
" entry_disable box\n"
" }\n"
"\n"
" set clean_text_window 0;\n"
"\n"
" if {$item == \"input\"} {\n"
" insert_input_window\n"
" set clean_text_window 1\n"
" }\n"
"\n"
" update\n"
"\n"
" # wait for user reply:\n"
" vwait entry_set\n"
"\n"
" set rc $entry_set\n"
" set entry_set 0\n"
"\n"
" set value [entry_get]\n"
" update\n"
"\n"
" entry_browse_button 0\n"
" set entry_str \"Set... :\"\n"
"\n"
" entry_delete\n"
" entry_disable\n"
" menus_enable\n"
"\n"
" if {$clean_text_window} {\n"
" cleanup_text_window;\n"
" }\n"
"\n"
" update\n"
"\n"
" if {! $entry} {\n"
" ;\n"
" } elseif {$rc} {\n"
" set menu_var($item) $value\n"
" } else {\n"
" if {[in_debug_mode]} {\n"
" append_text \"skipped setting $item\\n\"\n"
" }\n"
" }\n"
"\n"
" $entry_box configure -show \"\"\n"
"\n"
" return $rc\n"
"}\n"
"\n"
"proc warning_dialog {msg {item \"gui\"} } {\n"
" append_text $msg\n"
" # just reuse the entry widgets for a yes/no dialog\n"
" return [entry_dialog $item 0]\n"
"}\n"
"\n"
"# For updating a boolean toggle:\n"
"proc check_var {item} {\n"
" global menu_var\n"
"\n"
" set inval $menu_var($item);\n"
"\n"
" if {$item == \"debug_gui\"} {\n"
" return \"\";\n"
" }\n"
"\n"
" set rname $item\n"
" if {! $inval} {\n"
" if {[regexp {^no} $item]} {\n"
" regsub {^no} $rname \"\" rname\n"
" } else {\n"
" set rname \"no$rname\"\n"
" }\n"
" }\n"
" return $rname\n"
"}\n"
"\n"
"proc see_if_ok {query item expected} {\n"
" global query_result_list\n"
"\n"
" set ok 0\n"
" set found \"\"\n"
"\n"
" set query_result_list [split_query $query]\n"
"\n"
" foreach q $query_result_list {\n"
" # XXX following will crash if $item is not a good regexp\n"
" # need to protect it \\Q$item\\E style...\n"
"# if {[regexp \"^$item:\" $q]} {\n"
"# set found $q\n"
"# }\n"
" if {[string first \"$item:\" $q] == 0} {\n"
" set found $q\n"
" }\n"
" if {$q == $expected} {\n"
" set ok 1\n"
" if {$found != \"\"} {\n"
" break;\n"
" }\n"
" }\n"
" }\n"
" if {$found == \"\"} {\n"
" set msg $query\n"
" regsub {^a..=} $msg {} msg\n"
" if {[string length $msg] > 60} {\n"
" set msg [string range $msg 0 60]\n"
" }\n"
" } else {\n"
" set msg $found\n"
" }\n"
" if {!$ok && $found != \"\"} {\n"
" # check for floating point match:\n"
" set v1 \"\"\n"
" set v2 \"\"\n"
" regexp {:([0-9.][0-9.]*)$} $found m0 v1\n"
" regexp {:([0-9.][0-9.]*)$} $expected m0 v2\n"
" if {$v1 != \"\" && $v2 != \"\"} {\n"
" set diff \"\"\n"
" catch {set diff [expr \"$v1 - $v2\"]}\n"
" if {$diff != \"\"} {\n"
" if {$diff < 0} {\n"
" set diff [expr \"0.0 - $diff\"]\n"
" }\n"
" if {$diff < 0.00001} {\n"
" set ok 1\n"
" }\n"
" }\n"
" }\n"
" }\n"
" if {$ok} {\n"
" append_text \"\\tSet OK ($msg)\\n\"\n"
" return 1\n"
"\n"
" } elseif {[opt_match P $item] && [regexp {:(-|\\+)} $expected]} {\n"
" # e.g. blackout:+30x30+20+20\n"
" append_text \"\\t($msg)\\n\"\n"
" return 1\n"
" } elseif {[regexp {:[0-9]\\.[0-9]} $expected]} {\n"
" append_text \"\\t($msg)\\n\"\n"
" return 1\n"
" } elseif {$item == \"connect\" || $item == \"disconnect\"\n"
" || $item == \"client\" || $item == \"client_input\"} {\n"
" append_text \"\\t($msg)\\n\"\n"
" return 1\n"
" } elseif {$item == \"passwd\" || $item == \"viewpasswd\"} {\n"
" append_text \"\\t($msg)\\n\"\n"
" return 1\n"
" } else {\n"
" append_text \"\\t*FAILED* $msg\\n\"\n"
" return 0\n"
" }\n"
"}\n"
"\n"
"proc get_default_vars {} {\n"
" global default_var\n"
"\n"
" set qry [all_query_vars]\n"
"\n"
" append qry \",vncconnect\"\n"
"\n"
" set qargs [list \"-QD\" $qry]\n"
" set all [run_remote_cmd $qargs]\n"
"\n"
" if {[regexp {ans=} $all]} {\n"
" #append_text \"Retrieved all default settings.\\n\"\n"
" } else {\n"
" #append_text \"Failed to retrieve default settings.\\n\"\n"
" }\n"
"\n"
" set query_result_list [split_query $all]\n"
"\n"
" set default_var(gui) \"\"\n"
"\n"
" foreach piece $query_result_list {\n"
" if {[regexp {^([^:][^:]*):(.*)$} $piece m0 item val]} {\n"
" if {$val == \"N/A\"} {\n"
" if {$item == \"vncconnect\"} {\n"
" set val 1\n"
" } else {\n"
" set val \"\"\n"
" }\n"
" }\n"
" if {$item == \"display\"} {\n"
" set val \"\"\n"
" } elseif {$item == \"desktop\"} {\n"
" set val \"\"\n"
" } elseif {$item == \"auth\"} {\n"
" set val \"\"\n"
" } elseif {$item == \"gui\"} {\n"
" continue\n"
" } \n"
" # some hacks we do here for now..\n"
" if {$item == \"cursor\" && $val == \"\"} {\n"
" set val \"most\"\n"
" } elseif {$item == \"scrollcopyrect\" && $val == \"\"} {\n"
" set val \"always\"\n"
" } elseif {$item == \"wirecopyrect\" && $val == \"\"} {\n"
" set val \"always\"\n"
"# } elseif {$item == \"overlay_nocursor\" && $val == 0} {\n"
"# set val 1\n"
" }\n"
"\n"
" set default_var($item) $val\n"
"#puts \"default: $item -> $val\"\n"
" }\n"
" }\n"
"}\n"
"\n"
"proc tilde_expand {file} {\n"
" global env\n"
" if {[file exists $file]} {\n"
" return $file\n"
" }\n"
"\n"
" set user \"\"\n"
" if {[info exists env(USER)]} {\n"
" set user $env(USER)\n"
" }\n"
" if {$user == \"\" && [info exists env(LOGNAME)]} {\n"
" set user $env(LOGNAME)\n"
" }\n"
"\n"
" set home \"\"\n"
" if {[info exists env(HOME)]} {\n"
" set home $env(HOME)\n"
" } elseif {$user != \"\"} {\n"
" set home \"/home/$user\"\n"
" }\n"
"\n"
" if {[regexp {^~} $file]} {\n"
" if {[regexp {^~/} $file]} {\n"
" if {$home != \"\"} {\n"
" regsub {^~} $file $home file\n"
" }\n"
" } else {\n"
" regsub {^~} $file \"/home/\" file\n"
" }\n"
" }\n"
" return $file\n"
"}\n"
"\n"
"proc insert_cmdline_vars {} {\n"
" global env cmd_var menu_var default_var x11vnc_cmdline\n"
" if {![info exists x11vnc_cmdline]} {\n"
" return\n"
" }\n"
" if {$x11vnc_cmdline == \"\"} {\n"
" return\n"
" }\n"
" set cmd_var(novar) 1 \n"
" set str [string trim $x11vnc_cmdline]\n"
"\n"
" while {[regexp -- {^-} $str]} {\n"
" if {[regexp -- {^--*([^ \\t][^ \\t]*)(.*)$} $str m var rest]} {\n"
" set rest [string trim $rest]\n"
" set var [string trim $var]\n"
" if {[regexp {^\\{\\{([^\\}]*)\\}\\}(.*)} $rest m val rest]} {\n"
" set str [string trim $rest]\n"
" set cmd_var($var) $val\n"
" } else {\n"
" set str $rest\n"
" set cmd_var($var) \"boolean\"\n"
" }\n"
" } else {\n"
" break\n"
" }\n"
" }\n"
"\n"
" if {[info exists cmd_var(rc)]} {\n"
" load_settings $cmd_var(rc)\n"
" } elseif {[info exists cmd_var(norc)]} {\n"
" ;\n"
" } else {\n"
" set filex [tilde_expand \"~/.x11vncrc\"]\n"
" if {[file exists $filex]} {\n"
" load_settings $filex\n"
" }\n"
" }\n"
"\n"
" foreach var [array names cmd_var] {\n"
" if {$var == \"novar\"} {\n"
" continue\n"
" }\n"
" if {[regexp {^[ \\t]*$} $var]} {\n"
" continue\n"
" }\n"
" if {[info exists menu_var($var)]} {\n"
" if {$cmd_var($var) == \"boolean\"} {\n"
" set menu_var($var) 1\n"
" } else {\n"
" set menu_var($var) $cmd_var($var)\n"
" }\n"
" }\n"
" }\n"
"}\n"
"\n"
"proc copy_default_vars {} {\n"
" global menu_var default_var\n"
" foreach item [array names default_var] {\n"
" if {[info exists menu_var($item)]} {\n"
" if {[info exists default_var($item)]} {\n"
" set menu_var($item) $default_var($item)\n"
" }\n"
" }\n"
" }\n"
" foreach item [array names menu_var] {\n"
" if {[info exists default_var($item)]} {\n"
" set menu_var($item) $default_var($item)\n"
" }\n"
" }\n"
"}\n"
"\n"
"proc update_menu_vars {{query \"\"}} {\n"
" global all_settings menu_var query_result_list\n"
"\n"
" set debug [in_debug_mode]\n"
"\n"
" if {$query == \"USE_LIST\"} {\n"
" ;\n"
" } elseif {$query == \"\"} {\n"
" set query_result_list [split_query $all_settings]\n"
" } else {\n"
" set query_result_list [split_query $query]\n"
" }\n"
"\n"
" foreach piece $query_result_list {\n"
"#puts stderr \"UMV: $piece\"\n"
" if {[regexp {^([^:][^:]*):(.*)$} $piece m0 item val]} {\n"
" if {[info exists menu_var($item)]} {\n"
" set old $menu_var($item)\n"
"#puts stderr \" $old\"\n"
" if {$val == \"N/A\"} {\n"
" continue\n"
" }\n"
" set menu_var($item) $val\n"
" }\n"
" if {$item == \"clients\"} {\n"
" update_clients_menu $val\n"
" } elseif {$item == \"display\"} {\n"
" set_x11_display $val\n"
" } elseif {$item == \"vncdisplay\"} {\n"
" set_vnc_display $val\n"
" } elseif {$item == \"http_url\"} {\n"
" set_vnc_url $val\n"
" }\n"
" }\n"
" }\n"
"}\n"
"\n"
"proc load_settings {{file \"\"}} {\n"
" global menu_var default_var env\n"
"\n"
" if {$file == \"\"} {\n"
" if {![info exists menu_var(load-settings)]} {\n"
" return\n"
" }\n"
" set file $menu_var(load-settings)\n"
" }\n"
" if {$file == \"\"} {\n"
" return\n"
" }\n"
"\n"
" set fh \"\"\n"
" set filex [tilde_expand $file]\n"
" catch {set fh [open $filex \"r\"]}\n"
"\n"
" if {$fh == \"\"} {\n"
" append_text \"load_settings: *** failed to open $filex ***\\n\"\n"
" return\n"
" }\n"
" copy_default_vars\n"
"\n"
" set str \"\"\n"
" while {[gets $fh line] > -1} {\n"
" regsub -all {\\\\#} $line {__QUOTED_HASH__} line\n"
" if {[regexp {^[ \\t]*#} $line]} {\n"
" continue\n"
" }\n"
" for {set i 0} {$i < 5} {incr i} {\n"
" regsub {#.*$} $line \"\" line\n"
" }\n"
" if {[regexp {^[ \\t]*$} $line]} {\n"
" continue\n"
" }\n"
" regsub -all {__QUOTED_HASH__} $line {#} line\n"
" if {[regexp {\\\\$} $line]} {\n"
" regsub {\\\\$} $line \" \" line\n"
" append str \"$line\"\n"
" } else {\n"
" append str \"$line\\n\"\n"
" }\n"
" }\n"
" close $fh\n"
"\n"
" set count 0\n"
" set parms \"\"\n"
"\n"
" foreach line [split $str \"\\n\"] {\n"
" set line [string trim $line]\n"
" regsub {^--*} $line \"\" line\n"
" regsub -all {[ \\t][ \\t]*} $line \" \" line\n"
" set list [split $line]\n"
" set item [lindex $list 0]\n"
" set value [lindex $list 1]\n"
" if {[regexp {^[ \\t]*$} $item]} {\n"
" continue\n"
" }\n"
" if {$item == \"gui\"} {\n"
" continue\n"
" }\n"
" if {[info exists menu_var($item)]} {\n"
" if {[value_is_bool $item]} {\n"
" set menu_var($item) 1\n"
" incr count\n"
" append parms \" -$item\\n\"\n"
" } elseif {[value_is_string $item]} {\n"
" if {$value != \"\"} {\n"
" set menu_var($item) $value\n"
" set nitem [get_nitem $item]\n"
" append parms \" -$nitem $value\\n\"\n"
" incr count\n"
" }\n"
" }\n"
" }\n"
" }\n"
" append_text \"loaded $count parameter settings from $filex\"\n"
" if {$count > 0} {\n"
" append_text \":\\n\"\n"
" append_text $parms\n"
" } else {\n"
" append_text \".\\n\"\n"
" }\n"
"}\n"
"\n"
"proc save_settings {} {\n"
" set rc_text [get_settings_rcfile]\n"
"\n"
" set top \"#\n"
"# This file is based on the current x11vnc settings and can be used as\n"
"# as a ~/.x11vncrc defaults file. If saved to another filename, these\n"
"# settings can be passed to x11vnc at startup via \\\"-rc <filename>\\\".\n"
"#\n"
"# The rc file comment character is \\\"#\\\". Use \\\"\\\\#\\\" for the literal char.\n"
"# You can continue lines using \\\"\\\\\\\" as the last character of a line.\n"
"#\n"
"# Lines beginning with \\\"#d\\\" indicate the parameter value is at its default\n"
"# setting and you probably want to leave it commented out.\n"
"#\n"
"# Lines beginning with \\\"#?\\\" indicate parameters you probably do not\n"
"# want to hardwire to the current setting (uncomment if you want that).\n"
"# \n"
"# Some parameters are boolean, e.g. -forever, and take no value; while\n"
"# the others, e.g. -wait 50, take a string or numerical value.\n"
"#\n"
"# For booleans, the line will end with comment \\\"default: on\\\" or\n"
"# \\\"default: off\\\" indicating the default setting. (Note: often\n"
"# \\\"-nofoobar\\\" corresponds to option \\\"-foobar\\\" and the former is\n"
"# \\\"the default\\\", e.g. -norepeat).\n"
"#\n"
"# For string or numerical options, the value \\\"\\\" in a line below\n"
"# means the default is unset and you will need to supply some non-empty\n"
"# value to use the parameter. For reference, if the default differs\n"
"# from your value it placed at the end of the line as a comment.\n"
"# \n"
"# Feel free to uncomment or comment any of the lines or to change any\n"
"# of the values of the parameters. Don't be surprised that most if not\n"
"# all of the lines below are commented out (x11vnc has so many parameters,\n"
"# most of them will be at their default values).\n"
"#-------------------------------------------------------------------------\n"
"\n"
"\"\n"
"\n"
" set rc_text \"$top$rc_text\"\n"
"\n"
" global env save_settings_var save_settings_var_ok\n"
" if {[info exists env(HOME)]} {\n"
" set save_settings_var \"$env(HOME)/.x11vncrc\"\n"
" } else {\n"
" set save_settings_var \".x11vncrc\"\n"
" }\n"
" set save_settings_var_ok 0\n"
"\n"
" set w [textwin \"save_settings\" \"Save Settings...\" $rc_text \\\n"
" \"save_settings_var+Save as:\"]\n"
"\n"
" tkwait window $w\n"
"\n"
" if {$save_settings_var_ok == 1} {\n"
" set file $save_settings_var\n"
" if {$file == \"\"} {\n"
" return\n"
" }\n"
" set file [tilde_expand $file]\n"
" append_text \"\\nSaving current settings to $file ...\\n\" \n"
" if {[file exists $file]} {\n"
" set backup \"${file}~\"\n"
" append_text \"Backing up $file -> $backup ...\\n\"\n"
" catch {file delete -force $backup}\n"
" set emsg \"*** Backup to $backup failed. ***\\n\"\n"
" if {![file exists $backup]} {\n"
" catch {file copy -force $file $backup}\n"
" if {![file exists $backup]} {\n"
" append_text $emsg\n"
" bell\n"
" }\n"
" } else {\n"
" append_text $emsg\n"
" bell\n"
" }\n"
" }\n"
" set fh \"\"\n"
" catch {set fh [open $file \"w\"]}\n"
" if {$fh != \"\"} {\n"
" puts $fh $rc_text\n"
" close $fh\n"
" if {![file exists $file]} {\n"
" append_text \"*** Saving to $file failed. ***\\n\"\n"
" bell\n"
" } else {\n"
" append_text \"Done.\\n\"\n"
" }\n"
" } else {\n"
" append_text \"*** Open of $file failed. ***\\n\"\n"
" bell\n"
" }\n"
" }\n"
"}\n"
"\n"
"proc clear_all {} {\n"
" global menu_var unset_str\n"
"\n"
" set debug [in_debug_mode]\n"
" \n"
" foreach item [array names menu_var] {\n"
" if {$item == \"debug_gui\"} {\n"
" continue\n"
" }\n"
" if {[info exists menu_var($item)]} {\n"
" if {[is_action $item]} {\n"
" set menu_var($item) \"\"\n"
" } elseif {[value_is_bool $item]} {\n"
" set menu_var($item) 0\n"
" } elseif {[value_is_string $item]} {\n"
" set menu_var($item) $unset_str\n"
" }\n"
" }\n"
" }\n"
" append_text \"Cleared all settings.\\n\"\n"
"}\n"
"\n"
"proc defaults_all {} {\n"
" copy_default_vars\n"
" append_text \"Reset all variables to default values.\\n\"\n"
"}\n"
"\n"
"proc all_query_vars {} {\n"
" global query_ans_list query_aro_list all_settings\n"
" global cache_all_query_vars\n"
" \n"
" if {$cache_all_query_vars != \"\"} {\n"
" return $cache_all_query_vars\n"
" }\n"
"\n"
" set qry \"\"\n"
" foreach item $query_ans_list {\n"
" if {$qry == \"\"} {\n"
" set qry $item\n"
" } else {\n"
" append qry \",$item\"\n"
" }\n"
" }\n"
" foreach item $query_aro_list {\n"
" if {$qry == \"\"} {\n"
" set qry $item\n"
" } else {\n"
" append qry \",$item\"\n"
" }\n"
" }\n"
" set cache_all_query_vars $qry\n"
"\n"
"#puts $qry\n"
"\n"
" return $qry\n"
"}\n"
"\n"
"proc query_all {{quiet 0}} {\n"
" global query_ans_list query_aro_list all_settings\n"
" global last_query_all_time\n"
"\n"
" dtime 1\n"
" set qry [all_query_vars]\n"
"\n"
" set qargs [list \"-Q\" $qry]\n"
" set all [run_remote_cmd $qargs]\n"
"\n"
" if {[regexp {ans=} $all]} {\n"
" if {! $quiet} {\n"
" append_text \"Retrieved all current settings.\\n\"\n"
" }\n"
" set all_settings $all\n"
" update_menu_vars $all\n"
" } else {\n"
" if {! $quiet} {\n"
" append_text \"Failed to retrieve current settings.\\n\"\n"
" }\n"
" }\n"
" set last_query_all_time [clock seconds]\n"
" dtime 2\n"
" return $all\n"
"}\n"
"\n"
"proc set_info {str} {\n"
" global info_str info_label\n"
"#set w1 [$info_label cget -width]\n"
"#set w2 [winfo width $info_label]\n"
"#puts \"set_info: w=$w1 winfo=$w2\"\n"
"#append_text \"$str\\n\"\n"
" set info_str \"$str\"\n"
" update\n"
"}\n"
"\n"
"proc append_text {str} {\n"
" global text_area text_area_str\n"
"\n"
" if {![info exists text_area_str]} {\n"
" set text_area_str \"\"\n"
" }\n"
" append text_area_str $str\n"
"\n"
" if {![info exists text_area]} {\n"
" puts stderr $str\n"
" return\n"
" }\n"
" if {$text_area == \"\"} {\n"
" puts stderr $str\n"
" return\n"
" }\n"
" if {![winfo exists $text_area]} {\n"
" puts stderr $str\n"
" return\n"
" }\n"
" \n"
" $text_area insert end $str\n"
" $text_area see end\n"
"}\n"
"\n"
"proc show_all_settings {} {\n"
" global all_settings\n"
" global client_sock client_tail\n"
" global x11vnc_client_file\n"
"\n"
" set txt \"\\nRead-Write settings:\\n\\n\"\n"
" foreach item [split_query $all_settings] {\n"
" regsub {:} $item {: } item\n"
" append txt \" $item\\n\"\n"
" if {[regexp {noremote} $item]} {\n"
" append txt \"\\nRead-Only settings:\\n\\n\"\n"
" }\n"
" }\n"
" append txt \"\\nInternal settings:\\n\\n\"\n"
" append txt \"x11vnc_client_file: $x11vnc_client_file\\n\"\n"
" if {[info exists client_tail]} {\n"
" append txt \"client_tail: $client_tail\\n\"\n"
" } else {\n"
" append txt \"client_tail: unset\\n\"\n"
" }\n"
" if {[info exists client_sock]} {\n"
" append txt \"client_sock: $client_sock\\n\"\n"
" } else {\n"
" append txt \"client_sock: unset\\n\"\n"
" }\n"
" set estr \"\"\n"
" catch {set estr [exec env | grep -i X11VNC]}\n"
" append txt \"$estr\\n\"\n"
" textwin \"Settings\" \"All Current Settings\" $txt\n"
"}\n"
"\n"
"proc show_logfile {} {\n"
" global menu_var unset_str\n"
"\n"
" set logfile [tilde_expand $menu_var(logfile)]\n"
" \n"
" if {$logfile == \"\" || $logfile == $unset_str} {\n"
" set txt \"\\nNo logfile was specified at x11vnc startup.\\n\\n\" \n"
" } elseif {![file exists $logfile]} {\n"
" set txt \"\\nLogfile \\\"$logfile\\\" does not exist.\\n\\n\"\n"
" } else {\n"
" set fh \"-3\"\n"
" set err \"\"\n"
" catch {set fh [open $logfile \"r\"]} err\n"
" if {$fh == \"-3\"} {\n"
" set txt \"\\nError opening \\\"$logfile\\\" $err.\\n\\n\"\n"
" } else {\n"
" set txt \"\\nLogfile \\\"$logfile\\\" current contents:\\n\"\n"
" while {[gets $fh line] > -1} {\n"
" append txt \"$line\\n\"\n"
" }\n"
" close $fh\n"
" }\n"
" }\n"
" textwin \"Logfile\" \"Logfile\" $txt\n"
"}\n"
"\n"
"proc tail_logfile {} {\n"
" global menu_var unset_str ffont\n"
" set logfile $menu_var(logfile)\n"
" \n"
" set txt \"\"\n"
" if {$logfile == \"\" || $logfile == $unset_str} {\n"
" set txt \"\\nNo logfile was specified at x11vnc startup.\\n\\n\" \n"
" } elseif {![file exists $logfile]} {\n"
" set txt \"\\nLogfile \\\"$logfile\\\" does not exist.\\n\\n\"\n"
" } else {\n"
" set cmd \"\"\n"
" set xterm_cmd \"xterm -sb -fn $ffont -geometry 80x45 -title x11vnc-logfile -e\"\n"
" set cmd [split $xterm_cmd]\n"
" lappend cmd \"tail\"\n"
" lappend cmd \"-3000f\"\n"
" lappend cmd $logfile\n"
" lappend cmd \"&\"\n"
" catch {[eval exec $cmd]}\n"
" }\n"
" if {$txt != \"\"} {\n"
" textwin \"Logfile\" \"Logfile\" $txt\n"
" }\n"
"}\n"
"\n"
"proc set_connected {yesno} {\n"
" global connected_to_x11vnc\n"
" set orig $connected_to_x11vnc\n"
" \n"
" if {$yesno == \"yes\"} {\n"
" set connected_to_x11vnc 1\n"
" } else {\n"
" set connected_to_x11vnc 0\n"
" no_x11_display\n"
" no_vnc_display\n"
" }\n"
" if {$orig != $connected_to_x11vnc} {\n"
" set_widgets\n"
" }\n"
"}\n"
"\n"
"proc detach_from_display {} {\n"
" global connected_to_x11vnc reply_xdisplay x11vnc_xdisplay\n"
" set str \"Detaching from X display.\"\n"
" if {$reply_xdisplay != \"\"} {\n"
" set str \"Detaching from $reply_xdisplay.\"\n"
" } elseif {$x11vnc_xdisplay != \"\"} {\n"
" set str \"Detaching from $x11vnc_xdisplay.\"\n"
" }\n"
" if {$connected_to_x11vnc} {\n"
" append_text \"$str\\n\"\n"
" }\n"
" set_connected no\n"
"}\n"
"\n"
"proc do_stop_quit {} {\n"
" push_new_value \"stop\" \"stop\" 1 0\n"
" set_connected no\n"
" update\n"
" after 250\n"
" destroy .\n"
"}\n"
"\n"
"# Menu item is an action:\n"
"proc do_action {item} {\n"
" global menu_var connected_to_x11vnc beginner_mode\n"
"\n"
" if {[in_debug_mode]} {\n"
" append_text \"action: \\\"$item\\\"\\n\"\n"
" }\n"
"#puts \"action: \\\"$item\\\"\\n\"\n"
"\n"
" if {$item == \"ping\"} {\n"
" if {$beginner_mode} {\n"
" try_connect_and_query_all\n"
" } else {\n"
" try_connect\n"
" }\n"
" return\n"
" } elseif {$item == \"start\"} {\n"
" start_x11vnc\n"
" return\n"
" } elseif {$item == \"detach\"} {\n"
" detach_from_display\n"
" return\n"
" } elseif {$item == \"attach\"} {\n"
" try_connect_and_query_all\n"
" return\n"
" } elseif {$item == \"update-all\"} {\n"
" query_all\n"
" return\n"
" } elseif {$item == \"clear-all\"} {\n"
" clear_all\n"
" return\n"
" } elseif {$item == \"defaults-all\"} {\n"
" defaults_all\n"
" return\n"
" } elseif {$item == \"save-settings\"} {\n"
" save_settings\n"
" return\n"
" } elseif {$item == \"show-start-cmd\"} {\n"
" show_start_cmd\n"
" return\n"
" } elseif {$item == \"all-settings\"} {\n"
" show_all_settings\n"
" return\n"
" } elseif {$item == \"show-logfile\"} {\n"
" show_logfile\n"
" return\n"
" } elseif {$item == \"tail-logfile\"} {\n"
" tail_logfile\n"
" return\n"
" } elseif {$item == \"Misc-Tuning:\"} {\n"
" menu_help \"$item\"\n"
" return\n"
" } elseif {$item == \"WindowView\"} {\n"
" change_view_state\n"
" return\n"
" } elseif {$item == \"quit\" || $item == \"Quit\"} {\n"
" destroy .\n"
" exit 0\n"
" } elseif {$item == \"stop+quit\"} {\n"
" do_stop_quit\n"
" }\n"
"\n"
" if {[value_is_string $item]} {\n"
" if {! [entry_dialog $item]} {\n"
" return\n"
" }\n"
" set new $menu_var($item)\n"
" set name $item\n"
" } else {\n"
" set new 1\n"
" set name $item\n"
" }\n"
"\n"
" if {$item == \"load-settings\"} {\n"
" load_settings\n"
" return\n"
" }\n"
"\n"
" if {! $connected_to_x11vnc} {\n"
" ;\n"
" } elseif {[regexp {^(stop|quit|exit|shutdown)$} $item]} {\n"
" # just do -R\n"
" append_text \"stopping remote x11vnc server...\\n\"\n"
" push_new_value $item $name $new 0\n"
" set_connected no\n"
" \n"
" } elseif {[opt_match Q $item]} {\n"
" push_new_value $item $name $new 1\n"
" } else {\n"
" push_new_value $item $name $new 0\n"
" }\n"
"}\n"
"\n"
"proc ptime {time} {\n"
" set usec [lindex [split $time] 0]\n"
" set sec [format \"%.3f\" [expr \"$usec / 1000000.0\"]]\n"
" puts \"time: $sec secs.\"\n"
"}\n"
"\n"
"proc do_var {item} {\n"
" global connected_to_x11vnc item_cascade menu_var\n"
"\n"
" set debug [in_debug_mode]\n"
"\n"
" set string 0\n"
" if {[is_action $item] || $item == \"WindowView\"} {\n"
" # Menu item is action:\n"
" if {$debug} {\n"
" ptime [time {do_action $item}]\n"
" } else {\n"
" do_action $item\n"
" }\n"
" return\n"
" }\n"
"\n"
" if {[value_is_string $item]} {\n"
" # Menu item is a string:\n"
" if {$item_cascade($item) != \"\"} {\n"
" # Cascade sets variable automatically\n"
" } else {\n"
" # Otherwise Entry box\n"
" if {![entry_dialog $item]} {\n"
" return\n"
" }\n"
" }\n"
" set new $menu_var($item)\n"
" set name $item\n"
" } else {\n"
" # Menu item is a boolean:\n"
" set name [check_var $item]\n"
" if {$name == \"\"} {\n"
" return\n"
" }\n"
" set new 1\n"
" }\n"
" if {$connected_to_x11vnc} {\n"
" if {$debug} {\n"
" ptime [time {push_new_value $item $name $new 1}]\n"
" } else {\n"
" push_new_value $item $name $new 1\n"
" }\n"
"\n"
" if {$item == \"http\"} {\n"
" global vnc_url\n"
" append_text \" URL: $vnc_url\\n\"\n"
" }\n"
" }\n"
"}\n"
"\n"
"proc menu_help {item} {\n"
" if ![help_win $item] {\n"
" textwin \"nohelp\" \"No help available\" \\\n"
" \"Sorry, no help avaiable for \\\"$item\\\"\"\n"
" }\n"
"}\n"
"\n"
"proc opt_match {c item} {\n"
" global item_opts\n"
" if {[info exists item_opts($item)]} {\n"
" if {[regexp \"^\\[A-z\\]*$c\" $item_opts($item)]} {\n"
" return 1\n"
" }\n"
" }\n"
" return 0\n"
"}\n"
"\n"
"proc is_action {item} {\n"
" return [opt_match A $item]\n"
"}\n"
"\n"
"proc is_gui_internal {item} {\n"
" if {$item == \"Properties\"} {\n"
" return 1\n"
" }\n"
" if {$item == \"Tray\"} {\n"
" return 1\n"
" }\n"
" return [opt_match G $item]\n"
"}\n"
"\n"
"proc is_browse {item} {\n"
" return [opt_match F $item]\n"
"}\n"
"\n"
"proc value_is_string {item} {\n"
" global item_bool\n"
" if {![info exists item_bool($item)]} {\n"
" return 0\n"
" }\n"
" if {! $item_bool($item)} {\n"
" return 1\n"
" } else {\n"
" return 0\n"
" }\n"
"}\n"
"\n"
"proc value_is_bool {item} {\n"
" global item_bool\n"
" if {![info exists item_bool($item)]} {\n"
" return 0\n"
" }\n"
" if {$item_bool($item)} {\n"
" return 1\n"
" } else {\n"
" return 0\n"
" }\n"
"}\n"
"\n"
"proc split_query0 {query} {\n"
" # original slower way with regexp/regsub\n"
" regsub -all {aro=} $query {ans=} query\n"
" set items {}\n"
" while {1} {\n"
" if {! [regexp {^ans=(.*)$} $query m0 m1]} {\n"
" break\n"
" }\n"
" set item $m1\n"
" set m2 \"\"\n"
" regexp {,ans=.*$} $item m2\n"
" regsub {,ans=.*$} $item \"\" item\n"
" if {$item != \"\"} {\n"
" lappend items $item\n"
" }\n"
" set query $m2\n"
" regsub {^,} $query \"\" query\n"
" }\n"
" return $items\n"
"}\n"
"\n"
"proc split_query {query} {\n"
" regsub -all {aro=} $query {ans=} query\n"
" set items {}\n"
" while {1} {\n"
" set n [string first \"ans=\" $query]\n"
" if {$n < 0} {\n"
" break\n"
" }\n"
" set from [expr $n+4]\n"
"\n"
" set m [string first \",ans=\" $query]\n"
" if {$m < 0} {\n"
" set more 0\n"
" set item [string range $query $from end]\n"
" } else {\n"
" set more 1\n"
" set to [expr $m-1]\n"
" set item [string range $query $from $to]\n"
" }\n"
" if {$item != \"\"} {\n"
" lappend items $item\n"
" }\n"
" if {$more} {\n"
" incr m\n"
" set query [string range $query $m end]\n"
" } else {\n"
" set query \"\"\n"
" }\n"
" }\n"
" return $items\n"
"}\n"
"\n"
"proc set_x11_display {name} {\n"
" global x11_display\n"
" set x11_display \"x11vnc X display: $name\"\n"
" set_name \"tkx11vnc - $name\"\n"
"}\n"
"proc set_vnc_display {name} {\n"
" global vnc_display icon_mode\n"
" set vnc_display \"VNC display: $name\"\n"
"\n"
" if {$icon_mode} {\n"
" set_icon_label\n"
" }\n"
"}\n"
"proc set_vnc_url {name} {\n"
" global vnc_url\n"
" set vnc_url $name\n"
"}\n"
"proc no_x11_display {} {\n"
" set_x11_display \"(*none*)\"\n"
" set_name \"tkx11vnc\"\n"
"}\n"
"proc no_vnc_display {} {\n"
" set_vnc_display \"(*none*)\"\n"
"}\n"
"proc no_vnc_url {} {\n"
" set_vnc_url \"(*none*)\"\n"
"}\n"
"\n"
"proc get_vnc_display_number {} {\n"
" global vnc_display\n"
" if ![info exists vnc_display] {\n"
" return \"none\"\n"
" }\n"
" if {$vnc_display == \"\"} {\n"
" return \"none\"\n"
" }\n"
" set str $vnc_display\n"
" regsub {VNC display: *} $str \"\" str\n"
" if [regexp {:([0-9][0-9]*)} $str m0 n] {\n"
" return $n\n"
" }\n"
" return \"none\"\n"
"}\n"
"\n"
"proc fetch_displays {} {\n"
"\n"
" set qargs [list \"-Q\" \"display,vncdisplay\"]\n"
" set result [run_remote_cmd $qargs]\n"
"\n"
" set got_x11 0\n"
" set got_vnc 0\n"
" set got_url 0\n"
"\n"
" foreach item [split_query $result] {\n"
" if {[regexp {^display:(.*)$} $item m0 m1]} {\n"
" set_x11_display $m1\n"
" set got_x11 1\n"
" } elseif {[regexp {^vncdisplay:(.*)$} $item m0 m1]} {\n"
" set_vnc_display $m1\n"
" set got_vnc 1\n"
" } elseif {[regexp {^http_url:(.*)$} $item m0 m1]} {\n"
" set_vnc_url $m1\n"
" set got_url 1\n"
" }\n"
" }\n"
" if {! $got_x11} {\n"
" no_x11_display\n"
" }\n"
" if {! $got_vnc} {\n"
" no_vnc_display\n"
" }\n"
" if {! $got_url} {\n"
" no_vnc_url\n"
" }\n"
"}\n"
"\n"
"proc client_dialog {client} {\n"
" set cid \"\"\n"
" set host \"\"\n"
" set ip \"\"\n"
" global menu_var text_area cleanup_window item_bool\n"
"\n"
" #<id>:<ip>:<port>:<user>:<unix>:<hostname>:<input>:<loginview>:<time>\n"
" append_text \"\\nClient info string:\\n - $client\\n\\n\"\n"
" if {[regexp {^(.*):(.*):(.*):(.*):(.*):(.*):(.*):(.*):(.*)$} \\\n"
" $client m0 m1 m2 m3 m4 m5 m6 m7 m8 m9]} {\n"
" set cid $m1\n"
" set ip $m2\n"
" set port $m3\n"
" set user $m4\n"
" set unix $m5\n"
" set host $m6\n"
" regsub {\\..*$} $host \"\" host\n"
" set input $m7\n"
" set logvo $m8\n"
" set ltime $m9\n"
" append_text \"Host: $host, Port: $port, User: $user\"\n"
" if {$unix != \"\" && $unix != \"none\"} {\n"
" append_text \", Unix: $unix\"\n"
" }\n"
" append_text \", IP: $ip, Id: $cid\\n\"\n"
" append_text \" - originally logged in as: \"\n"
" if {$logvo == \"1\" } {\n"
" append_text \"View-Only Client\"\n"
" } else {\n"
" append_text \"Normal Client\"\n"
" }\n"
" if {$ltime != \"\"} {\n"
" set tim [clock format $ltime]\n"
" append_text \", $tim\"\n"
" }\n"
" append_text \"\\n\"\n"
" append_text \" - currently allowed input: \"\n"
" set sk 0\n"
" set sm 0\n"
" set sb 0\n"
" set sc 0\n"
" set sf 0\n"
" if {[regexp -nocase {K} $input]} {\n"
" append_text \"Keystrokes\"\n"
" set sk 1\n"
" }\n"
" if {[regexp -nocase {M} $input]} {\n"
" if {$sk} {\n"
" append_text \", \"\n"
" }\n"
" append_text \"Mouse-Motion\"\n"
" set sm 1\n"
" }\n"
" if {[regexp -nocase {B} $input]} {\n"
" if {$sk || $sm} {\n"
" append_text \", \"\n"
" }\n"
" append_text \"Button-Click\"\n"
" set sb 1\n"
" }\n"
" if {[regexp -nocase {C} $input]} {\n"
" if {$sk || $sm || $sb} {\n"
" append_text \", \"\n"
" }\n"
" append_text \"Clipboard\"\n"
" set sm 1\n"
" }\n"
" if {[regexp -nocase {F} $input]} {\n"
" if {$sk || $sm || $sb || $sf} {\n"
" append_text \", \"\n"
" }\n"
" append_text \"Files\"\n"
" set sf 1\n"
" }\n"
" if {! $sk && ! $sm && ! $sb && ! $sm && ! $sf} {\n"
" append_text \"None\"\n"
" }\n"
" append_text \"\\n\"\n"
" }\n"
" if {$cid == \"\"} {\n"
" append_text \"Invalid client info string: $client\\n\"\n"
" return\n"
" }\n"
"\n"
" regsub -all {_} $input \"\" input\n"
" set menu_var(client) \"$input\"\n"
" set item_bool(client) 0\n"
"\n"
" insert_client_action_window $input\n"
" set rc [entry_dialog client 1]\n"
"\n"
" cleanup_text_window\n"
"\n"
" set val $menu_var(client)\n"
" #puts \"rc: $rc val: $val\"\n"
"\n"
" if {! $rc} {\n"
" return;\n"
" } elseif {[regexp -nocase {(disconnect|close)} $val]} {\n"
" disconnect_dialog $client\n"
" } else {\n"
" regsub -all -nocase {[^KMBCF]} $val \"\" val\n"
" set item_bool(client_input) 0\n"
" push_new_value \"client_input\" \"client_input\" \"$cid:$val\" 0\n"
" }\n"
"}\n"
"\n"
"proc disconnect_dialog {client} {\n"
" set cid \"\"\n"
" set host \"\"\n"
" set msg \"\\n\"\n"
" append msg \"*** Client info string:\\n $client\\n\"\n"
" if {[regexp {^(.*):(.*):(.*):(.*):(.*):(.*):(.*):(.*):(.*)$} \\\n"
" $client m0 m1 m2 m3 m4 m5 m6 m7 m8 m9]} {\n"
" set cid $m1\n"
" set ip $m2\n"
" set port $m3\n"
" set user $m4\n"
" set unix $m5\n"
" set host $m6\n"
" regsub {\\..*$} $host \"\" host\n"
" set input $m7\n"
" set logvo $m8\n"
" set ltime $m9\n"
" append_text \"Host: $host, Port: $port, IP: $ip, User: $user\"\n"
" if {$unix != \"\" && $unix != \"none\"} {\n"
" append_text \", Unix: $unix\"\n"
" }\n"
" append_text \", Id: $cid\\n\"\n"
" }\n"
" if {$cid == \"\"} {\n"
" append_text \"Invalid client info string: $client\\n\"\n"
" return\n"
" }\n"
" append msg \"*** To *DISCONNECT* this client press \\\"OK\\\" again, otherwise press \\\"Cancel\\\"\\n\"\n"
" bell\n"
" if {[warning_dialog $msg \"current\"]} {\n"
" push_new_value \"disconnect\" \"disconnect\" $cid 1\n"
" } else {\n"
" append_text \"disconnect cancelled.\\n\"\n"
" }\n"
"}\n"
"\n"
"proc update_clients_and_repost {} {\n"
" global item_cascade menu_m menu_b\n"
"\n"
" append_text \"Refreshing connected clients list... \"\n"
" query_all 1\n"
" update\n"
"\n"
" set saw 0\n"
" set casc $item_cascade(current)\n"
" set last [$casc index end]\n"
" for {set i 0} {$i <= $last} {incr i} {\n"
" if {[$casc type $i] == \"separator\"} {\n"
" continue\n"
" }\n"
" set name [$casc entrycget $i -label]\n"
" if {[regexp {^num-clients} $name]} {\n"
" continue\n"
" }\n"
" if {[regexp {^refresh-list} $name]} {\n"
" continue\n"
" }\n"
" if {! $saw} {\n"
" append_text \"\\n\"\n"
" }\n"
" set saw 1\n"
" append_text \"client: $name\\n\"\n"
" }\n"
" if {! $saw} {\n"
" append_text \"done.\\n\"\n"
" }\n"
"}\n"
"\n"
"proc update_clients_menu {list} {\n"
" global item_cascade ffont\n"
" global saved_clients_str\n"
"\n"
" if {![info exists saved_clients_str]} {\n"
" set saved_clients_str \"\"\n"
" }\n"
" if {$list == \"INIT\"} {\n"
" set list $saved_clients_str\n"
" } else {\n"
" set saved_clients_str $list\n"
" }\n"
"\n"
" set subm $item_cascade(current);\n"
" catch {destroy $subm}\n"
" menu $subm -tearoff 0 -font $ffont\n"
" $subm add command\n"
" $subm add command -label \"refresh-list\" \\\n"
" -command \"update_clients_and_repost\"\n"
" $subm add separator\n"
" set count 0\n"
" foreach client [split $list \",\"] {\n"
" if {![regexp {^[a-z0-9]*[a-z0-9]:} $client]} {\n"
" #append_text \"Skipping client line: \"\n"
" #append_text $client\n"
" #append_text \"\\n\"\n"
" continue\n"
" }\n"
" regsub -all {[{}()~!$&*|;'\"`{}<>\\[\\]]} $client \"\" client\n"
" #'\n"
" if {[regexp {^(.*):(.*):(.*):(.*):(.*):(.*):(.*):(.*):(.*)$} \\\n"
" $client m0 m1 m2 m3 m4 m5 m6 m7 m8 m9]} {\n"
" set id $m1\n"
" set user $m4\n"
" set unix $m5\n"
" set host $m6\n"
" regsub {\\..*$} $host \"\" host\n"
" set clabel \"$host $id\"\n"
" if {$unix != \"\" && $unix != \"none\"} {\n"
" set clabel \"$unix@$clabel\"\n"
" } elseif {$user != \"unknown-user\"} {\n"
" set clabel \"$user@$clabel\"\n"
" }\n"
" } else {\n"
" regsub {:.*$} $client \"\" clabel\n"
" }\n"
" $subm add command -label \"$clabel\" \\\n"
" -command \"client_dialog \\{$client\\}\"\n"
" incr count\n"
" }\n"
" $subm entryconfigure 0 -label \"num-clients: $count\"\n"
"}\n"
"\n"
"proc set_widgets {} {\n"
" global connected_to_x11vnc item_case item_menu item_entry menu_m\n"
"\n"
" foreach item [array names item_case] {\n"
" if ![info exists item_case($item)] { continue; }\n"
" set case $item_case($item)\n"
" if ![info exists item_menu($item)] { continue; }\n"
" set menu $item_menu($item)\n"
" if ![info exists item_entry($item)] { continue; }\n"
" set entry $item_entry($item)\n"
" if {$entry < 0} {\n"
" # skip case under beginner_mode \n"
" continue\n"
" }\n"
" set type [$menu type $entry]\n"
" if {$type == \"separator\" || $type == \"tearoff\"} {\n"
" continue\n"
" }\n"
" if {![winfo exists $menu]} {\n"
" continue\n"
" }\n"
" if {$connected_to_x11vnc} {\n"
" if {[active_when_connected $item]} {\n"
" $menu entryconfigure $entry -state normal\n"
" } else {\n"
" $menu entryconfigure $entry -state disabled\n"
" }\n"
" } else {\n"
" if {[active_when_starting $item]} {\n"
" $menu entryconfigure $entry -state normal\n"
" } else {\n"
" $menu entryconfigure $entry -state disabled\n"
" }\n"
" }\n"
" }\n"
"}\n"
"\n"
"proc toggle_simple_gui {} {\n"
" global beginner_mode simple_gui_created\n"
" global connected_to_x11vnc make_gui_count\n"
"\n"
" if {$beginner_mode} {\n"
" append_text \"\\nSwitching to simple-gui mode.\\n\"\n"
" } else {\n"
" append_text \"\\nSwitching to power-user gui mode.\\n\"\n"
" }\n"
"\n"
" if {$make_gui_count == 1} {\n"
" incr make_gui_count\n"
" }\n"
" set simple_gui_created 1\n"
" make_menu_items\n"
" set_widgets\n"
" set_internal_help\n"
" append_text \"\\n\"\n"
"}\n"
"\n"
"proc little_qs {m} {\n"
" global bfont ffont beginner_mode\n"
" global helpremote helptext helplabel\n"
" global tk_version osname\n"
"\n"
" if {$tk_version < 8.0} {\n"
" return\n"
" }\n"
" if {$osname == \"Darwin\"} {\n"
" return\n"
" }\n"
"\n"
" set n [$m index end]\n"
"\n"
" for {set i 0} {$i <= $n} {incr i} {\n"
" set type [$m type $i]\n"
"#puts \"$m - $i - $type\"\n"
" if {$type == \"separator\"} {\n"
" $m add separator\n"
" } elseif {$type == \"tearoff\"} {\n"
" continue;\n"
" } else {\n"
" set label [$m entrycget $i -label]\n"
" set str \"\"\n"
" if {[info exists helpremote($label)]} {\n"
" set str \"(?)\"\n"
" } elseif {[info exists helptext($label)]} {\n"
" set str \"(?)\"\n"
" }\n"
" $m add command -label $str \\\n"
" -font $ffont \\\n"
" -command \"menu_help $label\";\n"
"\n"
" if {$str == \"\"} {\n"
" $m entryconfigure end -state disabled\n"
" }\n"
" set arg \"$m,$i\"\n"
"#puts \"helplabel: $arg -> $label\"\n"
" set helplabel($arg) $label\n"
" set j [$m index end]\n"
" set arg \"$m,$j\"\n"
" set helplabel($arg) $label\n"
" }\n"
" if {$i == 0} {\n"
" $m entryconfigure end -columnbreak 1\n"
" }\n"
" }\n"
"\n"
" menu_bindings $m\n"
"}\n"
"\n"
"proc make_menu_items {} {\n"
" global template \n"
" global menu_b menu_m menu_count\n"
" global item_opts item_bool item_case item_menu item_entry menu_var unset_str\n"
" global item_cascade\n"
" global bfont ffont beginner_mode simple_gui_created\n"
" global helptext helpremote helplabel\n"
"\n"
" # some tweaks...\n"
" if {![info exists menu_var(deny)]} {\n"
" set menu_var(deny) 0\n"
" }\n"
"\n"
" set case \"\";\n"
" set L_casc \"\"\n"
" set L_casc_count 0\n"
" set L_menus [list]\n"
"\n"
" # Extract the menu items:\n"
" foreach line [split $template \"\\n\"] {\n"
" if {[regexp {^Row:} $line]} {\n"
" continue\n"
" }\n"
" if {[regexp {^[A-z]} $line]} {\n"
" set case [string trim $line]\n"
"\n"
" if {$simple_gui_created} {\n"
" set i0 0\n"
" #if {$case == \"Misc\"} { # kludge for simple_gui\n"
" # set i0 1\n"
" #}\n"
" catch {$menu_m($case) delete $i0 end}\n"
" }\n"
" set menu_count($case) 0\n"
" continue;\n"
" }\n"
"\n"
" set item [string trim $line]\n"
" regsub -all { *} $item \" \" item\n"
" if {$item == \"\"} {\n"
" continue;\n"
" }\n"
" set opts \"\"\n"
" if {[regexp {^=} $item]} {\n"
" set opts [lindex [split $item] 0]\n"
" regsub {^=} $opts \"\" opts\n"
" set item [lindex [split $item] 1]\n"
" }\n"
" if {[regexp {^0} $opts]} {\n"
" continue;\n"
" }\n"
" if {[regexp {:$} $item]} {\n"
" set bool 0\n"
" } else {\n"
" set bool 1\n"
" }\n"
" regsub {:$} $item {} item\n"
"\n"
" if {$item == \"LOFF\"} {\n"
" set L_casc \"\"\n"
" continue\n"
" }\n"
"\n"
" if {$item == \"-- D\"} {\n"
" set beginner_sep 1\n"
" set item \"--\"\n"
" } else {\n"
" set beginner_sep 0\n"
" }\n"
"\n"
" set item_opts($item) $opts\n"
" set item_case($item) $case\n"
" set item_bool($item) $bool\n"
" set item_cascade($item) \"\"\n"
"\n"
" if {$L_casc == \"\"} {\n"
" set item_entry($item) $menu_count($case)\n"
" set m $menu_m($case)\n"
" } else {\n"
" # hack for cascades for crowded menus. See =GAL opts.\n"
" set item_entry($item) $L_casc_count\n"
" set m $L_casc\n"
" }\n"
"\n"
" set mvar 0 \n"
"\n"
" if {$beginner_mode && ! $beginner_sep && ![opt_match D $item]} {\n"
" set item_entry($item) \"-1\"\n"
" continue;\n"
" }\n"
"\n"
" set item_menu($item) $m\n"
"\n"
" if {0} { puts \"ITEM: $item\\t- $opts\\t- $case\\t- \\\n"
" $bool\\t- $menu_count($case)\" }\n"
"\n"
" # Create the menu items, its variables, etc., etc.\n"
"\n"
" if {$item == \"--\"} {\n"
" $m add separator\n"
"\n"
" } elseif {$item == \"Quit\"} {\n"
" # Quit item must shut us down:\n"
" $m add command -label \"$item\" -underline 0 \\\n"
" -font $ffont \\\n"
" -command {destroy .; exit 0}\n"
"\n"
" } elseif {$case == \"Help\"} {\n"
" # Help is simple help:\n"
" $m add command -label \"$item\" \\\n"
" -font $ffont \\\n"
" -command \"menu_help $item\"\n"
"\n"
" } elseif {[opt_match L $item]} {\n"
" # Special sub-menu cascade (=GAL ends with LOFF)\n"
" set subm $m.casc_L$menu_count($case)\n"
" catch {destroy $subm}\n"
" menu $subm -tearoff 0 -font $ffont\n"
" set item_cascade($item) $subm\n"
" $m add cascade -label \"$item\" \\\n"
" -font $ffont \\\n"
" -menu $subm\n"
" set L_casc $subm\n"
" set L_casc_count -1\n"
" lappend L_menus $L_casc\n"
"\n"
" } elseif {$item == \"current\"} {\n"
" # Current clients cascade\n"
" set subm $m.current_cascade\n"
" catch {destroy $subm}\n"
" set item_cascade($item) $subm\n"
" update_clients_menu \"INIT\"\n"
" $m add cascade -label \"$item\" \\\n"
" -font $ffont \\\n"
" -menu $subm\n"
"\n"
" } elseif {[is_action $item]} {\n"
" # Action\n"
" $m add command -label \"$item\" \\\n"
" -font $ffont \\\n"
" -command \"do_var $item\"\n"
" if {![info exists menu_var($item)]} {\n"
" set menu_var($item) \"\"; # for convenience\n"
" }\n"
"\n"
" } elseif {! $item_bool($item)} {\n"
" # String\n"
" if {[regexp -- {-C:(.*)} $item_opts($item) m0 m1]} {\n"
" # Radiobutton select\n"
" set subm $m.radio_cascade$menu_count($case)\n"
" catch {destroy $subm}\n"
" menu $subm -tearoff 0 -font $ffont\n"
" foreach val [split $m1 \",\"] {\n"
" $subm add radiobutton -label \"$val\" \\\n"
" -command \"do_var $item\" \\\n"
" -value \"$val\" \\\n"
" -font $ffont \\\n"
" -variable menu_var($item)\n"
" }\n"
" $m add cascade -label \"$item\" \\\n"
" -font $ffont \\\n"
" -menu $subm\n"
" set item_cascade($item) $subm\n"
" } else {\n"
" # Arbitrary_string\n"
" $m add command -label \"$item\" \\\n"
" -font $ffont \\\n"
" -command \"do_var $item\"\n"
" }\n"
" set mvar 1\n"
"\n"
" } elseif {$item == \"simple-gui\"} {\n"
" $m add checkbutton -label \"$item\" \\\n"
" -command \"toggle_simple_gui\" \\\n"
" -font $ffont \\\n"
" -variable beginner_mode\n"
" } else {\n"
" # Boolean\n"
" $m add checkbutton -label \"$item\" \\\n"
" -command \"do_var $item\" \\\n"
" -font $ffont \\\n"
" -variable menu_var($item)\n"
" if {![info exists menu_var($item)]} {\n"
" set menu_var($item) 0\n"
" }\n"
" }\n"
"\n"
" if {$L_casc_count == -1} {\n"
" incr menu_count($case)\n"
" incr L_casc_count\n"
" } elseif {$L_casc != \"\"} {\n"
" incr L_casc_count\n"
" } else {\n"
" incr menu_count($case)\n"
" }\n"
"\n"
" if {$mvar} {\n"
" if {![info exists menu_var($item)]} {\n"
" set menu_var($item) $unset_str\n"
" }\n"
" }\n"
" }\n"
"\n"
" # Now make the little \"(?)\" help buttons\n"
" global osname\n"
" foreach case [array names menu_m] {\n"
" if {$case == \"Help\"} {\n"
" continue;\n"
" }\n"
" little_qs $menu_m($case);\n"
" }\n"
" foreach m $L_menus {\n"
" little_qs $m\n"
" }\n"
"}\n"
"\n"
"proc check_update_vars {} {\n"
" global last_query_all_time query_all_freq icon_mode\n"
" global connected_to_x11vnc client_tail client_sock\n"
"\n"
" set now [clock seconds]\n"
"\n"
" set delay $query_all_freq\n"
" if {$client_tail != \"\" && $client_sock == \"\"} {\n"
" set delay [expr 2 * $query_all_freq]\n"
" }\n"
"\n"
" if {$connected_to_x11vnc} {\n"
" set quiet 0\n"
" set refresh [expr \"$last_query_all_time + $delay\"]\n"
"\n"
" # puts \"menu_posted $now $last_query_all_time\"\n"
" # puts \"menu_posted $refresh\"\n"
"\n"
" if {$now > $refresh} {\n"
" append_text \"Refreshing current settings... \"\n"
" query_all $quiet\n"
" if {$quiet} {\n"
" append_text \"done\\n\"\n"
" }\n"
" }\n"
" }\n"
"}\n"
"\n"
"proc menu_posted {} {\n"
" check_update_vars\n"
"}\n"
"\n"
"proc props_widgets {state} {\n"
" global props_buttons\n"
" foreach w $props_buttons {\n"
" $w configure -state $state \n"
" }\n"
" update\n"
"}\n"
"\n"
"proc props_apply {} {\n"
" global props_accept props_confirm props_viewonly props_shared \n"
" global props_zeroconf props_javaview props_solid\n"
" global props_passwd props_viewpasswd\n"
" global prop0_accept prop0_confirm prop0_viewonly prop0_shared\n"
" global prop0_zeroconf prop0_javaview prop0_solid\n"
" global prop0_passwd prop0_viewpasswd\n"
" global menu_var\n"
" global client_sock\n"
"\n"
" props_widgets disabled\n"
"\n"
" set aft 500\n"
" if {[info exists client_sock]} {\n"
" if {$client_sock != \"\"} {\n"
" set aft 150\n"
" }\n"
" }\n"
" set did 0\n"
"\n"
" set fail 0\n"
"\n"
" if {$props_confirm != $prop0_confirm} {\n"
" if {$did > 0} {after $aft}; incr did\n"
" if {$props_confirm} {\n"
" push_new_value \"accept\" \"accept\" \"popup\" 1\n"
" } else {\n"
" push_new_value \"accept\" \"accept\" \"\" 1\n"
" }\n"
" if {$menu_var(accept) == \"popup\"} {\n"
" set props_confirm 1\n"
" } elseif {$menu_var(accept) == \"\"} {\n"
" set props_confirm 0\n"
" }\n"
" if {$props_confirm == $prop0_confirm} {incr fail}\n"
" set prop0_confirm $props_confirm\n"
" }\n"
"\n"
" if {$props_viewonly != $prop0_viewonly} {\n"
" if {$did > 0} {after $aft}; incr did\n"
" if {$props_viewonly} {\n"
" push_new_value \"viewonly\" \"viewonly\" 1 1\n"
" } else {\n"
" push_new_value \"viewonly\" \"noviewonly\" 1 1\n"
" }\n"
" if {$menu_var(viewonly)} {\n"
" set props_viewonly 1\n"
" } else {\n"
" set props_viewonly 0\n"
" }\n"
" if {$props_viewonly == $prop0_viewonly} {incr fail}\n"
" set prop0_viewonly $props_viewonly\n"
" }\n"
"\n"
" if {$props_shared != $prop0_shared} {\n"
" if {$did > 0} {after $aft}; incr did\n"
" if {$props_shared} {\n"
" push_new_value \"shared\" \"shared\" 1 1\n"
" } else {\n"
" push_new_value \"shared\" \"noshared\" 1 1\n"
" }\n"
" if {$menu_var(shared)} {\n"
" set props_shared 1\n"
" } else {\n"
" set props_shared 0\n"
" }\n"
" if {$props_shared == $prop0_shared} {incr fail}\n"
" set prop0_shared $props_shared\n"
" }\n"
"\n"
" if {$props_zeroconf != $prop0_zeroconf} {\n"
" if {$did > 0} {after $aft}; incr did\n"
" if {$props_zeroconf} {\n"
" push_new_value \"zeroconf\" \"zeroconf\" 1 1\n"
" } else {\n"
" push_new_value \"zeroconf\" \"nozeroconf\" 1 1\n"
" }\n"
" if {$menu_var(zeroconf)} {\n"
" set props_zeroconf 1\n"
" } else {\n"
" set props_zeroconf 0\n"
" }\n"
" if {$props_zeroconf == $prop0_zeroconf} {incr fail}\n"
" set prop0_zeroconf $props_zeroconf\n"
" }\n"
"\n"
" if {$props_javaview != $prop0_javaview} {\n"
" if {$did > 0} {after $aft}; incr did\n"
" if {$props_javaview} {\n"
" push_new_value \"http\" \"http\" 1 1\n"
" } else {\n"
" push_new_value \"http\" \"nohttp\" 1 1\n"
" }\n"
" if {$menu_var(http)} {\n"
" set props_javaview 1\n"
" } else {\n"
" set props_javaview 0\n"
" }\n"
" if {$props_javaview == $prop0_javaview} {incr fail}\n"
" set prop0_javaview $props_javaview\n"
" }\n"
"\n"
" if {$props_solid != $prop0_solid} {\n"
" if {$did > 0} {after $aft}; incr did\n"
" if {$props_solid} {\n"
" push_new_value \"solid\" \"solid\" 1 1\n"
" } else {\n"
" push_new_value \"solid\" \"nosolid\" 1 1\n"
" }\n"
" if {$menu_var(solid)} {\n"
" set props_solid 1\n"
" } else {\n"
" set props_solid 0\n"
" }\n"
" if {$props_solid == $prop0_solid} {incr fail}\n"
" set prop0_solid $props_solid\n"
" }\n"
"\n"
" set fpw 0\n"
" if {$props_passwd != $prop0_passwd} {\n"
" set fpw 1\n"
" }\n"
" set vpw 0\n"
" if {$props_viewpasswd != $prop0_viewpasswd} {\n"
" set vpw 1\n"
" }\n"
"\n"
" set pw_ord [list]\n"
" if {!$fpw && !$vpw } {\n"
" # neither change\n"
" ;\n"
" } elseif {$fpw && !$vpw} {\n"
" # full password change\n"
" if {$props_passwd == \"\"} {\n"
" if {$prop0_viewpasswd != \"\"} {\n"
" # set view to \"\" as well and first\n"
" set props_viewpasswd \"\"\n"
" set pw_ord [list vpw fpw]\n"
" } else {\n"
" set pw_ord [list fpw]\n"
" }\n"
" } else {\n"
" # assume view state OK\n"
" set pw_ord [list fpw]\n"
" }\n"
" \n"
" } elseif {!$fpw && $vpw} {\n"
" # view password change\n"
" if {$props_viewpasswd == \"\"} {\n"
" # assume full state OK\n"
" set pw_ord [list vpw]\n"
" } else {\n"
" if {$prop0_passwd == \"\"} {\n"
" # could be trouble, x11vnc makes random\n"
" # full passwd...\n"
" set pw_ord [list vpw]\n"
" } else {\n"
" # OK, full non-null.\n"
" set pw_ord [list vpw]\n"
" }\n"
" }\n"
" } elseif {$fpw && $vpw} {\n"
" # both full and view password change\n"
" if {$props_passwd == \"\" && $props_viewpasswd == \"\"} {\n"
" # OK, do view first\n"
" set pw_ord [list vpw fpw]\n"
" } elseif {$props_passwd == \"\" && $props_viewpasswd != \"\"} {\n"
" # Not good, do view first anyway x11vnc will fix.\n"
" set pw_ord [list vpw fpw]\n"
" } elseif {$props_passwd != \"\" && $props_viewpasswd == \"\"} {\n"
" # OK, view first\n"
" set pw_ord [list vpw fpw]\n"
" } elseif {$props_passwd != \"\" && $props_viewpasswd != \"\"} {\n"
" # OK, full first\n"
" set pw_ord [list fpw vpw]\n"
" }\n"
" }\n"
"\n"
" foreach case $pw_ord {\n"
" if {$case == \"fpw\"} {\n"
" if {$did > 0} {after $aft}; incr did\n"
" push_new_value \"passwd\" \"passwd\" \"$props_passwd\" 1\n"
" if {$props_passwd == $prop0_passwd} {incr fail}\n"
" set prop0_passwd $props_passwd\n"
" }\n"
" if {$case == \"vpw\"} {\n"
" if {$did > 0} {after $aft}; incr did\n"
" push_new_value \"viewpasswd\" \"viewpasswd\" \"$props_viewpasswd\" 1\n"
" if {$props_viewpasswd == $prop0_viewpasswd} {incr fail}\n"
" set prop0_viewpasswd $props_viewpasswd\n"
" }\n"
" }\n"
"\n"
" if {$props_accept != $prop0_accept} {\n"
" if {$did > 0} {after $aft}; incr did\n"
" if {$props_accept} {\n"
" push_new_value \"unlock\" \"unlock\" 1 0\n"
" } else {\n"
" push_new_value \"lock\" \"lock\" 1 0\n"
" }\n"
" if {$props_accept == $prop0_accept} {incr fail}\n"
" set prop0_accept $props_accept\n"
" }\n"
"\n"
" props_widgets normal\n"
" if {$fail > 0} {\n"
" return 0\n"
" } else {\n"
" return 1\n"
" }\n"
"}\n"
"\n"
"proc props_advanced {} {\n"
" global icon_mode icon_win props_win full_win\n"
" global props_advanced_first\n"
"\n"
" if ![info exists props_advanced_first] {\n"
" center_win $full_win\n"
" set props_advanced_first 1\n"
" set first 1\n"
" } else {\n"
" set first 0\n"
" }\n"
" update\n"
" wm deiconify $full_win\n"
" update\n"
"\n"
" if {$first} {\n"
" set w $full_win\n"
" wm minsize $w [winfo width $w] [winfo height $w]\n"
" }\n"
"}\n"
"\n"
"proc do_props {} {\n"
" global props_accept props_confirm props_viewonly props_shared\n"
" global props_zeroconf props_javaview props_solid\n"
" global props_passwd props_viewpasswd\n"
" global prop0_accept prop0_confirm prop0_viewonly prop0_shared\n"
" global prop0_zeroconf prop0_javaview prop0_solid\n"
" global prop0_passwd prop0_viewpasswd\n"
" global menu_var unset_str\n"
" global have_labelframes ffont bfont\n"
" global props_buttons icon_noadvanced\n"
" global icon_mode icon_mode_at_startup\n"
" global screen_height screen_width\n"
" global do_props_msg\n"
"\n"
" set msg \"\"\n"
" if {[info exists do_props_msg]} {\n"
" set msg $do_props_msg\n"
" }\n"
"\n"
" check_update_vars\n"
"\n"
" set pady 0.5m\n"
" set pady 0.3m\n"
" if {$screen_height <= 360} {\n"
" set pady 0m\n"
" }\n"
"\n"
" if [info exists menu_var(deny)] {\n"
" if {$menu_var(deny) == $unset_str || $menu_var(deny) == 0} {\n"
" set props_accept 1\n"
" } else {\n"
" set props_accept 0\n"
" }\n"
" } else {\n"
" set menu_var(deny) 0\n"
" set props_accept 1\n"
" }\n"
" set prop0_accept $props_accept\n"
"\n"
" if [info exists menu_var(accept)] {\n"
" if {$menu_var(accept) == $unset_str || $menu_var(accept) == \"\"} {\n"
" set props_confirm 0\n"
" } else {\n"
" set props_confirm 1\n"
" }\n"
" } else {\n"
" set menu_var(accept) \"\"\n"
" set props_confirm 0\n"
" }\n"
" set prop0_confirm $props_confirm\n"
"\n"
" if [info exists menu_var(viewonly)] {\n"
" if {$menu_var(viewonly) == $unset_str || $menu_var(viewonly) == \"\"} {\n"
" set props_viewonly 0\n"
" } elseif ($menu_var(viewonly)) {\n"
" set props_viewonly 1\n"
" } else {\n"
" set props_viewonly 0\n"
" }\n"
" } else {\n"
" set menu_var(viewonly) 0\n"
" set props_viewonly 0\n"
" }\n"
" set prop0_viewonly $props_viewonly\n"
"\n"
" if [info exists menu_var(shared)] {\n"
" if {$menu_var(shared) == $unset_str || $menu_var(shared) == \"\"} {\n"
" set props_shared 0\n"
" } elseif ($menu_var(shared)) {\n"
" set props_shared 1\n"
" } else {\n"
" set props_shared 0\n"
" }\n"
" } else {\n"
" set menu_var(shared) 0\n"
" set props_shared 0\n"
" }\n"
" set prop0_shared $props_shared\n"
"\n"
" if [info exists menu_var(zeroconf)] {\n"
" if {$menu_var(zeroconf) == $unset_str || $menu_var(zeroconf) == \"\"} {\n"
" set props_zeroconf 0\n"
" } elseif ($menu_var(zeroconf)) {\n"
" set props_zeroconf 1\n"
" } else {\n"
" set props_zeroconf 0\n"
" }\n"
" } else {\n"
" set menu_var(zeroconf) 0\n"
" set props_zeroconf 0\n"
" }\n"
" set prop0_zeroconf $props_zeroconf\n"
"\n"
" if [info exists menu_var(http)] {\n"
" if {$menu_var(http) == $unset_str || $menu_var(http) == \"\"} {\n"
" set props_javaview 0\n"
" } elseif ($menu_var(http)) {\n"
" set props_javaview 1\n"
" } else {\n"
" set props_javaview 0\n"
" }\n"
" } else {\n"
" set menu_var(http) 0\n"
" set props_javaview 0\n"
" }\n"
" set prop0_javaview $props_javaview\n"
"\n"
" if [info exists menu_var(solid)] {\n"
" if {$menu_var(solid) == $unset_str || $menu_var(solid) == \"\"} {\n"
" set props_solid 0\n"
" } elseif ($menu_var(solid)) {\n"
" set props_solid 1\n"
" } else {\n"
" set props_solid 0\n"
" }\n"
" } else {\n"
" set menu_var(solid) 0\n"
" set props_solid 0\n"
" }\n"
" set prop0_solid $props_solid\n"
"\n"
" if ![info exists props_passwd] {\n"
" set props_passwd \"\"\n"
" }\n"
" set prop0_passwd $props_passwd\n"
"\n"
" if ![info exists props_viewpasswd] {\n"
" set props_viewpasswd \"\"\n"
" }\n"
" set prop0_viewpasswd $props_viewpasswd\n"
"\n"
" if [info exists props_buttons] {\n"
" catch {unset props_buttons}\n"
" }\n"
" set props_buttons [list]\n"
"\n"
" set w .props\n"
" catch {destroy $w}\n"
" toplevel $w\n"
" wm title $w \"x11vnc Properties\"\n"
" set b1 \"$w.buttons1\"\n"
" frame $b1\n"
" button $b1.ok -text OK -command \"if {\\[props_apply\\]} {destroy $w}\" -font $bfont\n"
" button $b1.cancel -text Cancel -command \"destroy $w\" -font $bfont\n"
" button $b1.apply -text Apply -command \"props_apply\" -font $bfont\n"
"\n"
" bind $w <KeyPress-Escape> \"destroy $w\"\n"
"\n"
" pack $b1.ok $b1.cancel $b1.apply -side left -expand 0\n"
" lappend props_buttons $b1.apply $b1.cancel $b1.ok\n"
"\n"
" set b2 \"$w.buttons2\"\n"
" frame $b2\n"
"\n"
" button $b2.advanced -text \" Advanced ... \" \\\n"
" -command \"destroy $w; props_advanced\" -font $bfont\n"
" if {! $icon_noadvanced} {\n"
" lappend props_buttons $b2.advanced\n"
" pack $b2.advanced -side left -expand 0\n"
" }\n"
"\n"
" button $b2.help -text \" Help \" -command \"menu_help Properties\" -font $bfont\n"
" lappend props_buttons $b2.help\n"
" pack $b2.help -side left -expand 0\n"
"\n"
" set pw \"$w.passwd\"\n"
" if {$have_labelframes} {\n"
" labelframe $pw -text \"Password\" -font $bfont\n"
" } else {\n"
" frame $pw\n"
" set l $pw.l\n"
" label $l -text \"Password:\" -justify left -anchor w -font $bfont\n"
" pack $pw.l -fill x -expand 1 -padx 1m -pady 0m -side top\n"
" }\n"
" entry $pw.e -show \"*\" -textvariable props_passwd -font $bfont\n"
" pack $pw.e -fill x -expand 1 -padx 1m -pady $pady -side top\n"
"\n"
" set vp \"$w.viewpw\"\n"
" if {$have_labelframes} {\n"
" labelframe $vp -text \"ViewOnly Password\" -font $bfont\n"
" } else {\n"
" frame $vp\n"
" set l $vp.l\n"
" label $l -text \"ViewOnly Password:\" -justify left -anchor w -font $bfont\n"
" pack $vp.l -fill x -expand 1 -padx 1m -pady 0m -side top\n"
" }\n"
" entry $vp.e -show \"*\" -textvariable props_viewpasswd -font $bfont\n"
" pack $vp.e -fill x -expand 1 -padx 1m -pady $pady -side top\n"
"\n"
"\n"
" lappend props_buttons $vp.e\n"
"\n"
" if {! $icon_mode_at_startup} {\n"
" $vp.e configure -state disabled\n"
" catch {$vp.l configure -state disabled}\n"
" catch {$vp configure -state disabled}\n"
" catch {$vp configure -foreground grey60}\n"
" $pw.e configure -state disabled\n"
" catch {$pw.l configure -state disabled}\n"
" catch {$pw configure -state disabled}\n"
" catch {$pw configure -foreground grey60}\n"
" }\n"
"\n"
" lappend props_buttons $pw.e\n"
"\n"
" set sb \"$w.solid\"\n"
" frame $sb\n"
" checkbutton $sb.button -text \"Solid Background Color\" \\\n"
" -variable props_solid -anchor w -font $bfont\n"
" pack $sb.button -fill x -expand 1 -padx 1m -pady $pady\n"
"\n"
" set jv \"$w.javaview\"\n"
" frame $jv\n"
" checkbutton $jv.button -text \"Serve Java Viewer Applet\" \\\n"
" -variable props_javaview -anchor w -font $bfont\n"
" pack $jv.button -fill x -expand 1 -padx 1m -pady $pady\n"
"\n"
" set zc \"$w.zeroconf\"\n"
" frame $zc\n"
" checkbutton $zc.button -text \"Advertise Service (Zeroconf)\" \\\n"
" -variable props_zeroconf -anchor w -font $bfont\n"
" pack $zc.button -fill x -expand 1 -padx 1m -pady $pady\n"
"\n"
" set sh \"$w.shared\"\n"
" frame $sh\n"
" checkbutton $sh.button -text \"Shared\" \\\n"
" -variable props_shared -anchor w -font $bfont\n"
" pack $sh.button -fill x -expand 1 -padx 1m -pady $pady\n"
"\n"
" set vo \"$w.viewonly\"\n"
" frame $vo\n"
" checkbutton $vo.button -text \"All Clients ViewOnly\" \\\n"
" -variable props_viewonly -anchor w -font $bfont\n"
" pack $vo.button -fill x -expand 1 -padx 1m -pady $pady\n"
"\n"
" set cf \"$w.confirm\"\n"
" frame $cf\n"
" checkbutton $cf.button -text \"Ask for Confirmation\" \\\n"
" -variable props_confirm -anchor w -font $bfont\n"
" pack $cf.button -fill x -expand 1 -padx 1m -pady $pady\n"
"\n"
" set ac \"$w.accept\"\n"
" frame $ac\n"
" checkbutton $ac.button -text \"Accept Connections\" \\\n"
" -variable props_accept -anchor w -font $bfont\n"
" pack $ac.button -fill x -expand 1 -padx 1m -pady $pady\n"
"\n"
" set px \"6m\"\n"
" pack $b1 -side bottom -fill x -pady $pady -padx $px\n"
" pack $b2 -side bottom -fill x -pady $pady -padx $px\n"
" pack $vp -side bottom -fill x -pady $pady -padx $px\n"
" pack $pw -side bottom -fill x -pady $pady -padx $px\n"
" pack $sb -side bottom -fill x -pady 0m -padx $px\n"
" pack $jv -side bottom -fill x -pady 0m -padx $px\n"
" pack $zc -side bottom -fill x -pady 0m -padx $px\n"
" pack $sh -side bottom -fill x -pady 0m -padx $px\n"
" pack $vo -side bottom -fill x -pady 0m -padx $px\n"
" pack $cf -side bottom -fill x -pady 0m -padx $px\n"
" pack $ac -side bottom -fill x -pady 0m -padx $px\n"
"\n"
" global show_props_instructions\n"
" if {![info exists show_props_instructions]} {\n"
" set show_props_instructions 1\n"
" }\n"
"\n"
" wm withdraw $w\n"
"\n"
" if {$msg != \"\"} {\n"
" set tw [textwidth $msg]\n"
" set th [textheight $msg]\n"
" set th [expr $th - 1]\n"
" set ms \"$w.msg\"\n"
" text $ms -font $ffont -relief ridge -width $tw -height $th\n"
" $ms insert 1.0 $msg\n"
"\n"
" set si \"$w.instructions\"\n"
" frame $si\n"
" checkbutton $si.button -text \"Show Instructions\" \\\n"
" -variable show_props_instructions -anchor w -font $bfont \\\n"
" -command \"toggle_instructions $ms $pady $px\"\n"
"\n"
" pack $si.button -fill x -expand 1 -padx 1m -pady $pady\n"
" pack $si -side bottom -fill x -pady 0m -padx $px\n"
"\n"
" if {$show_props_instructions} {\n"
" pack $ms -side bottom -fill x -pady $pady -padx $px\n"
" }\n"
"\n"
" update\n"
" }\n"
"\n"
" lappend props_buttons $ac.button $cf.button $vo.button $sh.button $zc.button $jv.button $sb.button\n"
"\n"
" \n"
" update\n"
" wm resizable $w 1 0\n"
" center_win $w\n"
" update\n"
"\n"
" #wm minsize $w [winfo width $w] [winfo height $w]\n"
"\n"
" tkwait window $w\n"
" set show_props_instructions 0\n"
"}\n"
"\n"
"proc toggle_instructions {ms pady px} {\n"
" global show_props_instructions\n"
" if {$show_props_instructions} {\n"
" pack $ms -side bottom -fill x -pady $pady -padx $px\n"
" } else {\n"
" pack forget $ms\n"
" }\n"
" catch {pack .props}\n"
" update\n"
"}\n"
"\n"
"proc do_new_client {} {\n"
" global newclient ffont bfont\n"
"\n"
" set w .newclient\n"
" catch {destroy $w}\n"
" toplevel $w\n"
" label $w.l -text \"Hostname: \" -font $bfont\n"
" set newclient \"\"\n"
" entry $w.e -width 16 -textvariable newclient -font $bfont \n"
" button $w.b -text OK -command \"destroy $w\" -font $bfont\n"
" button $w.h -text Help -command \"menu_help NewClient\" -font $bfont\n"
" bind $w.e <Return> \"update; after 100; destroy $w\"\n"
"\n"
" wm title $w \"New Client\"\n"
"\n"
" pack $w.l $w.e $w.h $w.b -side left -pady 1m -padx 0.5m\n"
" focus $w.e\n"
" center_win $w\n"
" update \n"
" \n"
" tkwait window $w\n"
"\n"
" regsub -all {[{}()~!$&*|;'\"`{}<>\\[\\]]} $newclient \"\" newclient\n"
" #'\n"
" if {$newclient != \"\"} {\n"
" push_new_value \"connect\" \"connect\" \"$newclient\" 1\n"
" }\n"
"}\n"
"\n"
"proc do_disconnect_all {} {\n"
" push_new_value \"disconnect\" \"disconnect\" \"all\" 1\n"
"}\n"
"\n"
"proc do_disconnect_client {id} {\n"
" push_new_value \"disconnect\" \"disconnect\" \"$id\" 1\n"
"}\n"
"\n"
"proc popup_post {m} {\n"
" global popup_cascade_posted client_balloon\n"
" global client_id_list\n"
"\n"
" set popup_cascade_posted 0\n"
" \n"
" set wd \"$m.disconnect\"\n"
"\n"
" if {![winfo exists $wd]} {\n"
" return\n"
" }\n"
"\n"
" catch {$wd delete 0 end}\n"
"\n"
" $wd add command -label \"Disconnect client:\"\n"
" $wd add separator\n"
" $wd add command -label \"All Clients\" -command do_disconnect_all\n"
"\n"
" if {![info exists client_id_list]} {\n"
" return\n"
" }\n"
"\n"
" foreach client $client_id_list {\n"
" if {$client == \"\"} {\n"
" continue\n"
" }\n"
" if {[regexp {^([^:]*):(.*)$} $client mat id lab]} {\n"
" set nid [expr \"$id + 0\"]\n"
" $wd add command -label \"$nid $lab\" \\\n"
" -command \"do_disconnect_client $id\"\n"
" }\n"
" }\n"
"}\n"
"\n"
"proc pmenu {m x y} {\n"
" if {![winfo exists $m]} {\n"
" return\n"
" }\n"
" set x [expr $x-10]\n"
" set y [expr $y-10]\n"
" $m post $x $y\n"
" # XXX more care needed\n"
" grab set -global $m\n"
"}\n"
"\n"
"proc set_client_balloon {str} {\n"
" global client_balloon vnc_display\n"
" global client_id_list\n"
"\n"
" set client_id_list [list]\n"
" \n"
" set client_balloon \"$vnc_display\"\n"
" set count 0\n"
" regsub -all {^.*aro=clients:} $str \"\" str\n"
" regsub -all {aro=.*$} $str \"\" str\n"
" regsub -all {ans=.*$} $str \"\" str\n"
" foreach client [split $str \",\"] {\n"
" #puts \"client: $client\"\n"
" if [regexp {^[ ]*$} $client] {\n"
" continue\n"
" }\n"
" if {[regexp {^(.*):(.*):(.*):(.*):(.*):(.*):(.*):(.*):(.*)$} \\\n"
" $client m0 m1 m2 m3 m4 m5 m6 m7 m8 m9]} {\n"
" set id $m1\n"
" set nid [expr \"$m1 + 0\"]\n"
" set ip $m2\n"
" set port $m3\n"
" set user $m4\n"
" set unix $m5\n"
" if {[string length $user] >= 24} {\n"
" # weird identd hash...\n"
" set user [string range $user 0 8]\n"
" set user \"${user}...\"\n"
" }\n"
" if {$unix != \"\" && $unix != \"none\"} {\n"
" set user $unix\n"
" }\n"
" set host $m6\n"
" set input $m7\n"
" set vo $m8\n"
" set ltime $m9\n"
" if [regexp {^[ ]*$} $host] {\n"
" set host $ip\n"
" }\n"
" set client_balloon \"${client_balloon}\\n$nid $user\\@$host\"\n"
" if {$vo == \"1\"} {\n"
" set client_balloon \"${client_balloon} - view\"\n"
" lappend client_id_list \"$id:$user\\@$host - view\"\n"
" } else {\n"
" set client_balloon \"${client_balloon} - full\"\n"
" lappend client_id_list \"$id:$user\\@$host - full\"\n"
" }\n"
" } else {\n"
" set i [expr $count+1]\n"
" if {$i == 1} {\n"
" set client_balloon \"${client_balloon}\\nunknown-host$i\"\n"
" }\n"
" }\n"
" incr count\n"
" }\n"
" if {$count == 0} {\n"
" set client_balloon \"${client_balloon}\\nNo connections.\"\n"
" }\n"
" icon_win_cfg $count\n"
"}\n"
"\n"
"proc read_client_info {channel} {\n"
" global x11vnc_client_file client_str client_info_read\n"
" global read_client_info_lock\n"
" global read_clients\n"
" set db 0\n"
"\n"
" set read_clients 0\n"
"\n"
" if {![info exists read_client_info_lock]} {\n"
" set read_client_info_lock 0\n"
" }\n"
"\n"
" if {$channel != \"\"} {\n"
"\n"
" if {$read_client_info_lock} {\n"
" return\n"
" }\n"
" set read_client_info_lock 1\n"
" after 100\n"
" set str \"\"\n"
" set count [gets $channel str]\n"
" if {$db} {puts stderr \"read_client_info-$channel: $str\"}\n"
"\n"
" if {$count == -1 || [eof $channel]} {\n"
" close $channel\n"
" catch {file delete $x11vnc_client_file}\n"
" set read_client_info_lock 0\n"
" clean_icon_exit\n"
" }\n"
" if {$count > 0 && ![regexp {^[ ]*$} $str]} {\n"
" set client_info_read 1\n"
" if {$str == \"quit\"} {\n"
" catch {file delete $x11vnc_client_file}\n"
" set read_client_info_lock 0\n"
" clean_icon_exit\n"
" } elseif {$str == \"skip\"} {\n"
" ;\n"
" } elseif [regexp {^clients:} $str] {\n"
" regsub {^clients:} $str \"\" str\n"
" set read_clients 1\n"
" if {$str == \"none\"} {\n"
" set str \"\"\n"
" }\n"
" update_clients_menu $str\n"
" set client_str $str\n"
" set_client_balloon $str\n"
" }\n"
" }\n"
" set read_client_info_lock 0\n"
" }\n"
"}\n"
"\n"
"proc check_set_vnc_display {} {\n"
" \n"
" global read_clients check_set_vnc_display_done\n"
"\n"
" if {[info exists check_set_vnc_display_done]} {\n"
" return\n"
" }\n"
" if {[info exists read_clients]} {\n"
" if {$read_clients} {\n"
" after 250\n"
" query_all\n"
" global client_str\n"
" set_client_balloon $client_str\n"
" set check_set_vnc_display_done 1\n"
" }\n"
" }\n"
"}\n"
"\n"
"proc read_client_tail {} {\n"
" global client_tail\n"
"\n"
" if {$client_tail != \"\"} {\n"
" read_client_info $client_tail\n"
" check_set_vnc_display\n"
" }\n"
"}\n"
"\n"
"proc read_client_sock {} {\n"
" global client_sock\n"
"\n"
" if {$client_sock != \"\"} {\n"
" read_client_info $client_sock\n"
" check_set_vnc_display\n"
" }\n"
"}\n"
"\n"
"proc show_client_balloon {} {\n"
" global icon_mode icon_win props_win full_win\n"
" global client_balloon ffont connected_to_x11vnc\n"
"\n"
" set noinfo \"tkx11vnc: no client information\"\n"
" set noinfo \"$noinfo\\navailable from x11vnc ...\"\n"
" if ![info exists client_balloon] {\n"
" set client_balloon $noinfo\n"
" }\n"
" if {$client_balloon == \"\"} {\n"
" set client_balloon $noinfo\n"
" }\n"
"\n"
" set x [expr [winfo rootx $icon_win] + ([winfo width $icon_win]/2)]\n"
" set y [expr [winfo rooty $icon_win] + [winfo height $icon_win] + 4]\n"
"\n"
" set infotext $client_balloon\n"
" if {!$connected_to_x11vnc} {\n"
" set infotext \"Not currently attached to x11vnc\\nLast available info:\\n$infotext\"\n"
" }\n"
"\n"
" set w .client_balloon\n"
" catch {destroy $w}\n"
" toplevel $w -bg black -screen [winfo screen $icon_win]\n"
" wm overrideredirect $w 1\n"
" label $w.l -text \"$infotext\" -relief flat -bg \"#ffffaa\" -fg black \\\n"
" -padx 2 -pady 0 -anchor w -justify left -font $ffont\n"
" pack $w.l -side left -padx 1 -pady 1\n"
"\n"
" set w2 [winfo reqwidth $w.l]\n"
" set h2 [winfo reqheight $w.l]\n"
"\n"
" set W [winfo screenwidth $w]\n"
" set H [winfo screenheight $w]\n"
"\n"
" if {[expr $x+$w2] > $W} {\n"
" set w3 [winfo width $icon_win]\n"
" set x [expr \"$W - $w2 - $w3 - 4\"] \n"
" }\n"
" if {[expr $y+$h2] > $H} {\n"
" set h3 [winfo height $icon_win]\n"
" set y [expr \"$H - $h2 - $h3 - 4\"] \n"
" }\n"
"\n"
" wm geometry $w +${x}+${y}\n"
"}\n"
"\n"
"proc kill_client_balloon {} {\n"
" global client_balloon_id client_balloon_win\n"
" if [info exists client_balloon_id] {\n"
" catch {after cancel $client_balloon_id}\n"
" }\n"
" if [winfo exists .client_balloon] {\n"
" destroy .client_balloon\n"
" }\n"
"}\n"
"\n"
"proc icon_win_cfg {clients} {\n"
" global icon_win client_tail client_sock client_info_read\n"
"\n"
" if {![info exists icon_win]} {\n"
" return\n"
" }\n"
" if {$icon_win == \"\"} {\n"
" return\n"
" }\n"
" if {$clients > 0} {\n"
" $icon_win configure -bg black -fg white\n"
" } else {\n"
" $icon_win configure -bg white -fg black\n"
" }\n"
"\n"
" if {$client_tail == \"\" || !$client_info_read} {\n"
" if {$client_sock == \"\"} {\n"
" $icon_win configure -fg red\n"
" }\n"
" }\n"
"}\n"
"\n"
"proc server_accept {sock addr port} {\n"
" global socket_cookie server socket_got_callback\n"
" global client_tail client_sock\n"
" set db 0\n"
"\n"
" if {$db} {puts stderr \"sock=$sock addr=$addr port=$port\"}\n"
"\n"
" update; update idletasks\n"
" after 50\n"
" update; update idletasks\n"
" set count [gets $sock str]\n"
"\n"
" if {$count >= 0} {\n"
" set str [string trim $str]\n"
" if {$db} {puts stderr \"server_accept: \\\"$str\\\"\"}\n"
" if {$str == \"COOKIE:$socket_cookie\"} {\n"
" set client_sock $sock\n"
" if {$db} {puts stderr \"cookie matched. $client_sock\"}\n"
" } else {\n"
" if {$db} {puts stderr \"cookie NO matched.\"}\n"
" }\n"
" }\n"
" catch {close $server}\n"
" set socket_got_callback 1\n"
" if {$db} {puts stderr \"socket_got_callback $socket_got_callback\"}\n"
"}\n"
"\n"
"proc try_client_info_sock {} {\n"
" global socket_cookie server socket_got_callback\n"
" global x11vnc_started x11vnc_xdisplay hostname client_sock\n"
" global x11vnc_xdisplay0 menu_var\n"
"\n"
" set db 0\n"
"#dtime t1\n"
" set start 13037\n"
" set tries 100\n"
" set socket_got_callback 0\n"
"\n"
" set xd $x11vnc_xdisplay\n"
" if {$xd == \"\" && $x11vnc_xdisplay0 != \"\"} {\n"
" set xd $x11vnc_xdisplay0\n"
" }\n"
" if {$xd == \"\" && [info exists menu_var(display)]} {\n"
" set xd $menu_var(display)\n"
" }\n"
"\n"
" set myaddr \"\"\n"
" regsub {\\..*$} $hostname \"\" shost\n"
" if {$x11vnc_started} {\n"
" set myaddr \"127.0.0.1\"\n"
" } elseif {$xd != \"\"} {\n"
" if {[regexp {^:} $xd]} {\n"
" set myaddr \"127.0.0.1\"\n"
" } elseif {[regexp -nocase \"^$shost\" $xd]} {\n"
" set myaddr \"127.0.0.1\"\n"
" } elseif {[regexp -nocase \"^localhost\" $xd]} {\n"
" set myaddr \"127.0.0.1\"\n"
" } else {\n"
" set myaddr $hostname\n"
" }\n"
" } else {\n"
" set myaddr $hostname\n"
" }\n"
" \n"
" for {set i 0} {$i <= $tries} {incr i} {\n"
" set port [expr $start + $i]\n"
" set server [socket -server server_accept -myaddr $myaddr $port]\n"
" if {$server == \"\"} {\n"
" continue\n"
" }\n"
" if {[eof $server]} {\n"
" continue\n"
" }\n"
" set err \"\"\n"
" catch {set err [fconfigure $server -error]}\n"
" #puts \"err: $server: $err\"\n"
" if {$err == \"\"} {\n"
" break\n"
" }\n"
" }\n"
" if {$server == \"\"} {\n"
" append_text \"try_client_info_sock: server socket failed.\\n\"\n"
" return\n"
" }\n"
" if {! $x11vnc_started} {\n"
" run_remote_cmd [list \"-nosync\" \"-R\" \"noop\"]\n"
" if {$db} {dtime A}\n"
" after 250\n"
" if {$db} {dtime A}\n"
" }\n"
"\n"
" # set the cookie to some obscured randomness\n"
" set socket_cookie [clock clicks]\n"
" set r [expr rand()]\n"
" if {$r != \"\"} {\n"
" append socket_cookie $r\n"
" }\n"
" set r \"\"\n"
" catch {set r [winfo id .]}\n"
" if {$r != \"\"} {\n"
" append socket_cookie $r\n"
" }\n"
" if {[regexp {([0-9])([0-9])$} [clock clicks] m m1 m2]} {\n"
" regsub -all {\\.} $socket_cookie $m1 socket_cookie\n"
" regsub -all {x} $socket_cookie $m2 socket_cookie\n"
" }\n"
" run_remote_cmd [list \"-nosync\" \"-R\" \\\n"
" \"client_info_sock:$myaddr:$port:$socket_cookie\"]\n"
"#dtime t2\n"
" if {$db} {puts \"client_info_sock:$myaddr:$port:$socket_cookie\"}\n"
" for {set i 0} {$i < 10} {incr i} {\n"
" after 50\n"
" update; update idletasks\n"
"#dtime aa\n"
" if {$socket_got_callback != 0} {\n"
"#puts \"break-\"\n"
" break\n"
" }\n"
" }\n"
"#dtime t3\n"
"\n"
" set aftid \"\"\n"
" if {$socket_got_callback == 0} {\n"
" set aftid [after 10000 {set socket_got_callback 2}]\n"
" tkwait variable socket_got_callback\n"
" }\n"
"\n"
" if {$aftid != \"\"} {\n"
" catch {after cancel $aftid}\n"
" }\n"
"\n"
" if {$socket_got_callback != 1} {\n"
" puts stderr \"try_client_info_sock failed: no callback\\n\"\n"
" catch {close $server}\n"
" } else {\n"
" setup_client_sock 1\n"
" }\n"
"#dtime t4\n"
"}\n"
"\n"
"proc set_icon_label {} {\n"
" global icon_win\n"
"\n"
" set lab [get_icon_label]\n"
" \n"
" if {[info exists icon_win]} {\n"
" $icon_win configure -text $lab\n"
" }\n"
"}\n"
"\n"
"proc get_icon_label {{set 0}} {\n"
" global icon_minimal \n"
"\n"
" set lab0 \"x11\\nvnc\"\n"
" \n"
" if {$icon_minimal} {\n"
" set lab [get_vnc_display_number]\n"
" if {$lab != \"none\"} {\n"
" #set lab \" :$lab\"\n"
" set lab \":$lab\"\n"
" } else {\n"
" set lab \"-\"\n"
" }\n"
" } else {\n"
" set lab $lab0\n"
" }\n"
" return $lab\n"
"}\n"
"\n"
"# currently unused\n"
"proc lmenu {menu} {\n"
" global popup_cascade_posted\n"
" global left_iconwin_menu\n"
" set left_iconwin_menu 1\n"
" after 100\n"
" update\n"
" if {!$popup_cascade_posted && $left_iconwin_menu} {\n"
" for {set i 0} {$i < 3} {incr i} {\n"
" after 100\n"
" update\n"
" }\n"
" if {!$popup_cascade_posted && $left_iconwin_menu} {\n"
" $menu unpost\n"
" return\n"
" }\n"
" }\n"
" # kludge for WindowView\n"
" if {$popup_cascade_posted} {\n"
" focus $menu\n"
" }\n"
"}\n"
"\n"
"proc old_balloon {} {\n"
" global client_str saved_clients_str\n"
" set str \"\"\n"
" if {[info exists client_str]} {\n"
" if {$client_str != \"\"} {\n"
" set str $client_str\n"
" }\n"
" }\n"
" if {$str == \"\"} {\n"
" if {[info exists saved_clients_str]} {\n"
" set str $saved_clients_str\n"
" }\n"
" }\n"
" if {$str != \"\"} {\n"
" set_client_balloon $str\n"
" }\n"
"}\n"
"\n"
"proc get_custom_menu_items {} {\n"
" global env custom_last_read\n"
"\n"
" if {![info exists custom_last_read]} {\n"
" set custom_last_read 0\n"
" }\n"
" if {[info exists env(X11VNC_CUSTOM_GUI)]} {\n"
" set custom \"$env(X11VNC_CUSTOM_GUI)\"\n"
" } elseif {![info exists env(HOME)]} {\n"
" return [list \"none\"]\n"
" } else {\n"
" set custom \"$env(HOME)/.x11vnc.gui\"\n"
" }\n"
" if {![file exists $custom]} {\n"
" return [list \"none\"]\n"
" }\n"
"\n"
"# if {[file mtime $custom] <= $custom_last_read} {\n"
"# return [list \"nochange\"]\n"
"# }\n"
"\n"
" set in \"\"\n"
" catch {set in [open $custom \"r\"]} \n"
" if {$in == \"\"} {\n"
" return [list \"none\"]\n"
" }\n"
"\n"
" set custom_last_read [clock seconds]\n"
"\n"
" set count 0\n"
" while {[gets $in line] > -1} {\n"
" if {[regexp {^[ \\t]*#} $line]} {\n"
" continue\n"
" }\n"
" set line [string trim $line]\n"
" if {$line != \"\"} {\n"
" lappend items $line\n"
" incr count\n"
" }\n"
" }\n"
" close $in\n"
" \n"
" if {$count > 0} {\n"
" return $items\n"
" } else {\n"
" return [list \"none\"]\n"
" }\n"
"}\n"
"\n"
"proc make_custom_menu {menu font} {\n"
" set items [get_custom_menu_items]\n"
" set i0 [lindex $items 0]\n"
" catch {$menu delete 0 end}\n"
" if {$i0 != \"none\"} {\n"
" $menu add command -font $font -label \"Custom items:\"\n"
" $menu add separator\n"
" foreach item $items {\n"
" if {$item == \"sep\" || $item == \"separator\"} {\n"
" $menu add separator\n"
" continue\n"
" }\n"
" if {[regexp {^action:(.*)$} $item m action]} {\n"
" $menu add command -font $font -label \"$action\" \\\n"
" -command \"do_var $action\"\n"
" continue\n"
" }\n"
" $menu add command -font $font -label \"$item\" \\\n"
" -command \"run_remote_cmd \\[list \\\"-R\\\" \\\"$item\\\"\\]\"\n"
" }\n"
" }\n"
"}\n"
"\n"
"proc make_icon {} {\n"
" global icon_mode icon_embed_id icon_win props_win full_win\n"
" global tray_embed tray_running env\n"
" global x11vnc_client_file client_tail client_sock client_str saved_clients_str\n"
" global client_balloon_id\n"
" global bfont sfont snfont ffont\n"
" global icon_minimal gui_start_mode\n"
" global popup_cascade_posted menu_var x11vnc_gui_geom\n"
" set min_x 24\n"
" set min_y 24\n"
" \n"
" set font $bfont\n"
" set mfont $font\n"
"\n"
" if {$tray_embed} {\n"
" set font $sfont\n"
" set mfont $snfont\n"
" }\n"
" if {[info exists env(X11VNC_ICON_FONT)]} {\n"
" set font $env(X11VNC_ICON_FONT)\n"
" }\n"
" if {[regexp {([0-9][0-9]*)x([0-9][0-9]*)} $x11vnc_gui_geom m mx my]} {\n"
" if {$mx < $min_x} {\n"
" set min_x $mx\n"
" }\n"
" if {$my < $min_y} {\n"
" set min_y $my\n"
" }\n"
" }\n"
" wm minsize . $min_x $min_y\n"
"\n"
" if {$tray_embed && $tray_running} {\n"
" wm withdraw .\n"
" }\n"
"\n"
" set l .icon\n"
" set icon_win $l\n"
" catch destroy {$icon_win}\n"
" if {$icon_minimal} {\n"
" set bw 1\n"
" } else {\n"
" set bw 5\n"
" }\n"
" set lab [get_icon_label]\n"
" label $l -text $lab -borderwidth $bw -font $font\n"
" icon_win_cfg 0\n"
"\n"
"\n"
" set popup_cascade_posted 0\n"
" pack $l -fill both -expand 1\n"
" set menu \"$l.menu\"\n"
" menu $menu -tearoff 0 -postcommand \"popup_post $menu\"\n"
" $menu add command -font $mfont -label \"Properties\" -command do_props\n"
" $menu add command -font $mfont -label \"Help\" -command \"menu_help Tray\"\n"
" $menu add command -font $mfont -label \"Logfile\" -command show_logfile\n"
" $menu add separator\n"
" $menu add command -font $mfont -label \"New Client\" -command do_new_client\n"
"\n"
" set wd \"$menu.disconnect\"\n"
" catch {destroy $wd}\n"
" menu $wd -tearoff 0 -font $ffont \\\n"
" -postcommand {set popup_cascade_posted 1}\n"
" $wd add command -label \"Disconnect client:\"\n"
" $wd add separator\n"
" $wd add command -label \"All Clients\" -command do_disconnect_all\n"
" $menu add cascade -font $mfont -label \"Disconnect:\" -menu $wd\n"
"\n"
" $menu add separator\n"
"\n"
" set wv \"$menu.windowview\"\n"
" catch {destroy $wv}\n"
" menu $wv -tearoff 0 -font $ffont \\\n"
" -postcommand {set popup_cascade_posted 1}\n"
" foreach val {full icon tray} {\n"
" $wv add radiobutton -label \"$val\" \\\n"
" -value \"$val\" -font $ffont \\\n"
" -command \"do_var WindowView\" \\\n"
" -variable menu_var(WindowView)\n"
" }\n"
" $menu add cascade -font $mfont -label \"Window View:\" -menu $wv\n"
"\n"
" $menu add command -font $mfont -label \"Dismiss\" -command \"$menu unpost\"\n"
" $menu add command -font $mfont -label \"Stop x11vnc\" -command clean_icon_exit\n"
"\n"
" set items [get_custom_menu_items]\n"
" set i0 [lindex $items 0]\n"
" if {$i0 != \"none\" && $i0 != \"nochange\"} {\n"
" $menu add separator\n"
" set cm \"$menu.custom\"\n"
" catch {destroy $cm}\n"
" menu $cm -tearoff 0 -font $ffont \\\n"
" -postcommand \"set popup_cascade_posted 1; make_custom_menu $cm $ffont\"\n"
" $menu add cascade -font $mfont -label \"Custom:\" -menu $cm\n"
" }\n"
"\n"
" bind $icon_win <ButtonRelease-1> \"pmenu $menu %X %Y\"\n"
" bind $icon_win <ButtonRelease-3> \"pmenu $menu %X %Y\"\n"
" bind $icon_win <Enter> {set client_balloon_id [after 500 show_client_balloon]}\n"
" bind $icon_win <Button> {kill_client_balloon}\n"
" bind $icon_win <Leave> {kill_client_balloon}\n"
" bind $icon_win <Shift-ButtonRelease-1> {kill_client_balloon; show_client_balloon}\n"
" bind $icon_win <ButtonRelease-2> {kill_client_balloon; show_client_balloon}\n"
"# bind $menu <Leave> \"lmenu $menu\"\n"
"# bind $menu <Enter> \"set left_iconwin_menu 0\"\n"
"# bind $menu <KeyPress-Escape> \"$menu unpost\"\n"
"\n"
" bind . <Control-KeyPress-c> {destroy .; exit 0}\n"
"\n"
" if {!$tray_embed || !$tray_running} {\n"
" global x11vnc_gui_geom\n"
" if {$x11vnc_gui_geom != \"\"} {\n"
" set doit 1\n"
" if {[regexp {x} $x11vnc_gui_geom]} {\n"
" if {$gui_start_mode == \"full\"} {\n"
" set doit 0\n"
" }\n"
" } \n"
" if {$doit} {\n"
" wm geometry . $x11vnc_gui_geom\n"
" }\n"
" }\n"
" }\n"
" wm iconname . \"tkx11vnc\"\n"
" wm title . \"tkx11vnc\"\n"
" update\n"
" if {$tray_embed && $tray_running} {\n"
" #wm deiconify .; # why did we have this???\n"
" #after 10000 {wm deiconify .; puts \"reqheight [winfo reqheight .]\"; puts \"reqwidth [winfo reqwidth .]\"; puts \"height [winfo height .]\"; puts \"width [winfo width .]\"}\n"
" } else {\n"
" wm deiconify .\n"
" }\n"
" update\n"
"\n"
"#puts \"reqheight [winfo reqheight .]\"\n"
"#puts \"reqwidth [winfo reqwidth .]\"\n"
"#puts \"height [winfo height .]\"\n"
"#puts \"width [winfo width .]\"\n"
"#puts \"AAA\"\n"
"\n"
" old_balloon\n"
"}\n"
"\n"
"proc setup_client_channel {} {\n"
" global client_sock client_tail\n"
"\n"
"# XXX/setup_client_channel\n"
" if {$client_sock == \"\" } {\n"
" stop_watch on\n"
" try_client_info_sock\n"
" if {$client_sock == \"\" } {\n"
" after 500\n"
" try_client_info_sock\n"
" }\n"
" stop_watch off\n"
" }\n"
" if {$client_tail == \"\" && $client_sock == \"\"} {\n"
" set m \"\\n\"\n"
" set m \"${m}tkx11vnc:\\n\"\n"
" set m \"${m}\\n\"\n"
" set m \"${m} Warning -- running in icon/tray mode but the\\n\"\n"
" set m \"${m} connected client info channel from x11vnc is\\n\"\n"
" set m \"${m} not working. The viewer client list and icon\\n\"\n"
" set m \"${m} color indicator will not be accurate.\\n\"\n"
" set m \"${m}\\n\"\n"
" set m \"${m} You may need to restart \\\"x11vnc -gui tray ...\\\"\\n\"\n"
" set m \"${m} for this to work properly.\\n\"\n"
" set m \"${m}\\n\"\n"
" textwin \"Warning\" \"Warning\" $m\n"
" update\n"
" }\n"
" dtime C\n"
"}\n"
"\n"
"proc clean_client_tail {} {\n"
" global client_tail client_info_read\n"
" if [info exists client_tail] {\n"
" if {$client_tail != \"\"} {\n"
" set p \"\"\n"
" catch {set p [pid $client_tail]}\n"
" if {$p != \"\"} {\n"
" catch {exec kill -TERM $p >/dev/null 2>/dev/null}\n"
" }\n"
" catch {close $client_tail}\n"
" set client_tail \"\"\n"
" }\n"
" }\n"
" set client_info_read 0\n"
"}\n"
"\n"
"proc clean_icon_exit {} {\n"
" clean_client_tail\n"
" push_new_value \"stop\" \"stop\" 1 0\n"
" set_connected no\n"
" update\n"
" destroy .\n"
" exit\n"
"}\n"
"\n"
"proc make_gui {mode} {\n"
" global icon_mode tray_embed tray_running full_win icon_win\n"
" global top_widget_names x11vnc_gui_geom\n"
" global gui_current_state make_gui_count\n"
" global x11vnc_connect connected_to_x11vnc\n"
" global x11_display\n"
" global gui_start_mode\n"
"\n"
" incr make_gui_count\n"
"\n"
" if {$gui_start_mode == \"\"} {\n"
" set gui_start_mode $mode\n"
" }\n"
"\n"
" wm withdraw .\n"
"\n"
" set full_geom \"\"\n"
" if {[winfo exists .full]} {\n"
" catch {set full_geom [wm geometry .full]}\n"
" }\n"
"\n"
" set fw .full\n"
" set full_win $fw\n"
" catch {pack forget $full_win}\n"
" catch {pack forget $icon_win}\n"
" catch {destroy $full_win}\n"
" catch {destroy $icon_win}\n"
"\n"
" wm minsize . 1 1\n"
"\n"
" set gui_current_state \"\"\n"
"\n"
" if {$mode == \"full\"} {\n"
" frame $fw\n"
" set icon_mode 0\n"
"\n"
" wm protocol . WM_DELETE_WINDOW \"destroy .; exit\"\n"
" make_widgets $fw\n"
"\n"
" set w \".\"\n"
" wm geometry $w \"\"\n"
" if {$x11vnc_gui_geom != \"\"} {\n"
" set doit 1\n"
" if {[regexp {x} $x11vnc_gui_geom]} {\n"
" if {$gui_start_mode != $mode} {\n"
" set doit 0\n"
" }\n"
" }\n"
" if {$doit} {\n"
" wm geometry $w $x11vnc_gui_geom\n"
" }\n"
" }\n"
" pack $fw -fill both -expand 1\n"
"\n"
" } elseif {$mode == \"icon\" || $mode == \"tray\"} {\n"
"\n"
" toplevel $fw\n"
" wm withdraw $fw\n"
"\n"
" wm protocol $fw WM_DELETE_WINDOW \"wm withdraw .full\"\n"
" wm protocol . WM_DELETE_WINDOW \"clean_icon_exit\"\n"
" \n"
" if {$mode == \"icon\"} {\n"
" set tray_embed 0\n"
" } elseif {$mode == \"tray\"} {\n"
" set tray_embed 1\n"
" }\n"
" set icon_mode 1\n"
" make_widgets $fw\n"
" set w $fw\n"
" make_icon\n"
" wm geometry $fw \"\"\n"
" wm geometry . \"\"\n"
" } else {\n"
" return\n"
" }\n"
" set_view_variable $mode\n"
" set gui_current_state $mode\n"
"\n"
"\n"
" update\n"
" if {!$tray_embed || !$tray_running} {\n"
" wm deiconify .\n"
" }\n"
" update idletasks\n"
" wm minsize $w [winfo width $w] [winfo height $w]\n"
" if {$mode == \"full\" && $make_gui_count > 1} {\n"
" center_win .\n"
" }\n"
"\n"
"\n"
" if {$make_gui_count == 1} {\n"
" copy_default_vars\n"
" if {$x11vnc_connect} {\n"
" try_connect_and_query_all\n"
" } else {\n"
" insert_cmdline_vars\n"
" }\n"
" } else {\n"
" set_name \"RESTORE\"\n"
" }\n"
"\n"
" setup_client_tail\n"
"\n"
" set_widgets\n"
"\n"
" if {$mode == \"tray\"} {\n"
" setup_tray_embed\n"
" }\n"
"}\n"
"\n"
"proc make_widgets {top} {\n"
" global template make_gui_count\n"
" global menu_b menu_m menu_count\n"
" global item_opts item_bool item_case item_menu item_entry menu_var unset_str\n"
" global item_cascade\n"
" global info_label info_str x11_display vnc_display\n"
" global text_area text_area_str\n"
" global entry_box entry_str entry_set entry_label entry_ok entry_browse\n"
" global entry_help entry_skip\n"
" global bfont ffont beginner_mode\n"
" global helptext helpremote helplabel\n"
" global icon_mode icon_win props_win full_win\n"
" global top_widget_names\n"
" global screen_height screen_width\n"
"\n"
"\n"
" # Make the top label\n"
" set label_width 84\n"
" if {$screen_width <= 400} {\n"
" set label_width 64\n"
" }\n"
" set info_label \"$top.info\"\n"
" label $info_label -textvariable info_str -bd 2 -relief groove \\\n"
" -anchor w -width $label_width -font $ffont\n"
" pack $info_label -side top -fill x -expand 0\n"
"\n"
" set top_widget_names(info) $info_label\n"
"\n"
" # Extract the Rows:\n"
" set row 0;\n"
" set colmax 0;\n"
" foreach line [split $template \"\\n\"] {\n"
" if {[regexp {^Row: (.*)} $line rest]} {\n"
" set col 0\n"
" foreach case [split $rest] {\n"
" if {$case == \"\" || $case == \"Row:\"} {\n"
" continue\n"
" }\n"
" set menu_row($case) $row\n"
" set menu_col($case) $col\n"
"\n"
" lappend cases($col) $case;\n"
" set len [string length $case]\n"
" if {[info exists max_len($col)]} {\n"
" if {$len > $max_len($col)} {\n"
" set max_len($col) $len\n"
" }\n"
" } else {\n"
" set max_len($col) $len\n"
" }\n"
" incr col\n"
" if {$col > $colmax} {\n"
" set colmax $col\n"
" }\n"
" }\n"
" incr row;\n"
" }\n"
" }\n"
"\n"
" # Make frames for the rows and make the menu buttons.\n"
" set f \"$top.menuframe\"\n"
" frame $f\n"
" for {set c 0} {$c < $colmax} {incr c} {\n"
" set colf \"$f.menuframe$c\"\n"
" frame $colf\n"
" pack $colf -side left -fill y\n"
" set fbg [$colf cget -background]\n"
" foreach case $cases($c) {\n"
" set menub \"$colf.menu$case\";\n"
" set menu \"$colf.menu$case.menu\";\n"
" set menu_b($case) $menub\n"
" set menu_m($case) $menu\n"
" set ul 0\n"
" foreach char [split $case \"\"] {\n"
" set char [string tolower $char]\n"
" if {![info exists underlined($char)]} {\n"
" set underlined($char) 1\n"
" break\n"
" }\n"
" incr ul\n"
" }\n"
" global osname\n"
" set tstr \"$case\"\n"
" if {$osname == \"Darwin\"} {\n"
" #set tstr \" $case \"\n"
" }\n"
" menubutton $menub -text \"$tstr\" -underline $ul \\\n"
" -anchor w -menu $menu -background $fbg \\\n"
" -font $bfont\n"
" pack $menub -side top -fill x\n"
" menu $menu -tearoff 0 -postcommand menu_posted\n"
" }\n"
" }\n"
" pack $f -side top -fill x\n"
" set top_widget_names(menuframe) $f\n"
"\n"
" make_menu_items\n"
"\n"
" # Make the x11 and vnc display label bar:\n"
" set df \"$top.displayframe\"\n"
" frame $df -bd 1 -relief groove\n"
" set top_widget_names(displayframe) $df\n"
"\n"
" set df_x11 \"$df.xdisplay\"\n"
"\n"
" if {$make_gui_count == 1} {\n"
" no_x11_display\n"
" }\n"
" set lw [expr {$label_width / 2}]\n"
" label $df_x11 -textvariable x11_display -width $lw -anchor w \\\n"
" -font $ffont\n"
"\n"
" set df_vnc \"$df.vdisplay\"\n"
"\n"
" if {$make_gui_count == 1} {\n"
" no_vnc_display\n"
" }\n"
" label $df_vnc -textvariable vnc_display -width $lw -anchor w \\\n"
" -font $ffont\n"
"\n"
" pack $df_x11 $df_vnc -side left \n"
" pack $df -side top -fill x\n"
"\n"
" # text area\n"
" global text_height\n"
" set text_area \"$top.text\"\n"
" if {$screen_width <= 400} {\n"
" text $text_area -height $text_height -width $label_width \\\n"
" -relief ridge -font $ffont\n"
" } else {\n"
" text $text_area -height $text_height -relief ridge -font $ffont\n"
" }\n"
" pack $text_area -side top -fill both -expand 1\n"
" set top_widget_names(text) $text_area\n"
"\n"
"\n"
" if {$text_area_str == \"\"} {\n"
" set str \"Click Help -> gui for overview.\"\n"
" append_text \"\\n$str\\n\\n\"\n"
" } else {\n"
" append_text $text_area_str\n"
" }\n"
"\n"
" # Make entry box stuff\n"
" set ef \"$top.entryframe\"\n"
" frame $ef -bd 1 -relief groove\n"
" set top_widget_names(entryframe) $ef\n"
"\n"
" # Entry Label\n"
" set ef_label \"$ef.label\"\n"
" label $ef_label -textvariable entry_str -anchor w -font $bfont\n"
"\n"
" set entry_str \"Set... : \"\n"
" set ef_entry \"$ef.entry\"\n"
" entry $ef_entry -relief sunken -font $ffont\n"
" bind $ef_entry <KeyPress-Return> {set entry_set 1}\n"
" bind $ef_entry <KeyPress-Escape> {set entry_set 0}\n"
"\n"
" set ok_s \"OK\"\n"
" set cancel_s \"Cancel\"\n"
" set help_s \"Help\"\n"
" set browse_s \"Browse...\"\n"
" global osname\n"
" if {$osname == \"Darwin\"} {\n"
" set ok_s \" OK \"\n"
" set cancel_s \" Cancel \"\n"
" set help_s \" Help \"\n"
" set browse_s \" Browse... \"\n"
" }\n"
"\n"
" # Entry OK button\n"
" set bpx \"1m\"\n"
" set bpy \"1\"\n"
" set hlt \"0\"\n"
" set ef_ok \"$ef.ok\"\n"
" button $ef_ok -text $ok_s -pady $bpy -padx $bpx -command {set entry_set 1} \\\n"
" -highlightthickness $hlt \\\n"
" -font $bfont\n"
"\n"
" # Entry Skip button\n"
" set ef_skip \"$ef.skip\"\n"
" button $ef_skip -text $cancel_s -pady $bpy -padx $bpx -command {set entry_set 0} \\\n"
" -highlightthickness $hlt \\\n"
" -font $bfont\n"
"\n"
" # Entry Help button\n"
" set ef_help \"$ef.help\"\n"
" button $ef_help -text $help_s -pady $bpy -padx $bpx -command \\\n"
" {menu_help $entry_dialog_item} -font $bfont \\\n"
" -highlightthickness $hlt\n"
"\n"
" # Entry Browse button\n"
" set ef_browse \"$ef.browse\"\n"
" button $ef_browse -text $browse_s -pady $bpy -padx $bpx -font $bfont \\\n"
" -highlightthickness $hlt \\\n"
" -command {entry_insert [tk_getOpenFile]} \n"
"\n"
" pack $ef_label -side left\n"
" pack $ef_entry -side left -fill x -expand 1\n"
" pack $ef_ok -side right\n"
" pack $ef_skip -side right\n"
" pack $ef_help -side right\n"
" pack $ef -side bottom -fill x\n"
"\n"
" set entry_ok $ef_ok\n"
" set entry_skip $ef_skip\n"
" set entry_help $ef_help\n"
" set entry_box $ef_entry\n"
" set entry_browse $ef_browse\n"
" set entry_label $ef_label\n"
" entry_disable\n"
"\n"
"}\n"
"\n"
"proc menu_bindings {m} {\n"
" set db 0\n"
" if {$db} {puts \"menu_bindings $m\"}\n"
"\n"
" bind $m <<MenuSelect>> {\n"
"#syntax hilite bug \\\n"
"MenuSelect>>\n"
" set n [%W index active]\n"
" set db 0\n"
" if {$db} {puts stderr \"menu_bindings %W $n\"}\n"
" set label \" \"\n"
" if {$n != \"none\"} {\n"
" set str %W,$n\n"
" set which \"\"\n"
"\n"
" if {$db} {puts \"menu_bindings $str\"}\n"
" if {[info exists helplabel($str)]} {\n"
" set vname [format %%-16s $helplabel($str)]\n"
" set label \"Click (?) for help on: $vname\"\n"
" set which $helplabel($str)\n"
" }\n"
" if {$which == \"\"} {\n"
" ;\n"
" } elseif {$which == \"passwd\" || $which == \"viewpasswd\"} {\n"
" ;\n"
" } elseif {[is_action $which]} {\n"
" if {[info exists menu_var($which)] \n"
" && $menu_var($which) != \"\"} {\n"
" set label \"$label value: $menu_var($which)\"\n"
" } else {\n"
" set label \"$label (is action)\"\n"
" }\n"
" } elseif {[info exists menu_var($which)]} {\n"
" set label \"$label value: $menu_var($which)\"\n"
" if {$which == \"http\"} {\n"
" global vnc_url\n"
" set label \"$label URL: $vnc_url\"\n"
" }\n"
" }\n"
" }\n"
" set_info $label\n"
" }\n"
"}\n"
"\n"
"proc key_bindings {} {\n"
" global env menus_disabled\n"
" if {[info exists env(USER)] && $env(USER) == \"runge\"} {\n"
" # quick restart\n"
" bind . <Control-KeyPress-k> {exec $argv0 $argv &; destroy .}\n"
" }\n"
" bind . <Control-KeyPress-p> { \\\n"
" global menus_disabled; \\\n"
" if {!$menus_disabled} {try_connect_and_query_all} \\\n"
" }\n"
" bind . <Control-KeyPress-u> { \\\n"
" global menus_disabled; \\\n"
" if {!$menus_disabled} {query_all 0} \\\n"
" }\n"
" bind . <Control-KeyPress-r> { \\\n"
" global menus_disabled; \\\n"
" if {!$menus_disabled} {query_all 0} \\\n"
" }\n"
" bind . <Control-KeyPress-d> { \\\n"
" global menus_disabled; \\\n"
" if {!$menus_disabled} {detach_from_display} \\\n"
" }\n"
" bind . <Control-KeyPress-a> { \\\n"
" global menus_disabled; \\\n"
" if {!$menus_disabled} {try_connect_and_query_all} \\\n"
" }\n"
"}\n"
"\n"
"proc stop_watch {onoff} {\n"
" global orig_cursor text_area entry_box\n"
"\n"
" set widgets [list .]\n"
" if [info exists text_area] {\n"
" if {$text_area != \"\"} {\n"
" lappend widgets $text_area\n"
" }\n"
" }\n"
" if [info exists entry_box] {\n"
" if {$entry_box != \"\"} {\n"
" lappend widgets $entry_box\n"
" }\n"
" }\n"
"\n"
" if {$onoff == \"on\"} {\n"
" foreach item $widgets {\n"
" if {![winfo exists $item]} {\n"
" continue\n"
" }\n"
" $item config -cursor {watch}\n"
" }\n"
" } else {\n"
" foreach item $widgets {\n"
" if {![winfo exists $item]} {\n"
" continue\n"
" }\n"
" $item config -cursor {}\n"
" }\n"
" }\n"
" update\n"
"}\n"
"\n"
"proc double_check_noremote {} {\n"
" set msg \"\\n\\n\"\n"
" append msg \"*** WARNING: setting \\\"noremote\\\" will disable ALL remote control commands (i.e.\\n\"\n"
" append msg \"*** WARNING: *this* gui will be locked out). Do you really want to do this?\\n\"\n"
" append msg \"*** WARNING: If so, press \\\"OK\\\", otherwise press \\\"Cancel\\\"\\n\"\n"
" append msg \"\\n\"\n"
" bell\n"
" return [warning_dialog $msg \"noremote\"]\n"
"}\n"
"\n"
"proc get_settings_rcfile {} {\n"
" global menu_var default_var unset_str\n"
" global x11vnc_gui_params\n"
"\n"
" set rc_txt \"\"\n"
"\n"
" set menu_var(gui) $x11vnc_gui_params\n"
"\n"
" foreach item [lsort [array names menu_var]] {\n"
" if {$item == \"gui\"} {\n"
" ;\n"
" } elseif {![active_when_starting $item]} {\n"
" continue\n"
" } elseif {[is_action $item]} {\n"
" continue\n"
" }\n"
" if {$item == \"debug_gui\"} {\n"
" continue\n"
" } elseif {$item == \"WindowView\"} {\n"
" continue\n"
" } elseif {$item == \"rc\" || $item == \"norc\"} {\n"
" continue\n"
" }\n"
"\n"
" set def \"\"\n"
" if {[info exists default_var($item)]} {\n"
" set def $default_var($item)\n"
" }\n"
"\n"
" set qst \"\"\n"
" set hmm \"#? \"\n"
" if {$item == \"display\"} {\n"
" set qst $hmm\n"
" } elseif {$item == \"desktop\"} {\n"
" set qst $hmm\n"
" } elseif {$item == \"dontdisconnect\"} {\n"
" set qst $hmm\n"
" } elseif {$item == \"alwaysshared\"} {\n"
" set qst $hmm\n"
" } elseif {$item == \"nevershared\"} {\n"
" set qst $hmm\n"
" }\n"
"\n"
" if {![info exists menu_var($item)]} {\n"
" set mv $def\n"
" } else {\n"
" set mv $menu_var($item)\n"
" }\n"
" if {$mv == $unset_str} {\n"
" set mv \"\"\n"
" }\n"
" set ntab 3\n"
"\n"
" if {$item == \"gui\" || [value_is_string $item]} {\n"
" set nitem [get_nitem $item]\n"
"\n"
" if {$mv == \"\" && $def != \"\"} {\n"
" set qst $hmm\n"
" }\n"
" set n 0\n"
" if {$qst != \"\"} {\n"
" append rc_txt $qst\n"
" incr n [string length $qst]\n"
" } elseif {$mv == $def} {\n"
" append rc_txt \"#d \"\n"
" incr n [string length \"#d \"]\n"
" }\n"
" set mt $mv\n"
" regsub -all {#} $mt {\\#} mt\n"
" if {$mt == \"\"} {\n"
" set mt {\"\"}\n"
" }\n"
" append rc_txt \"-$nitem $mt\"\n"
"\n"
" if {$mv != $def} {\n"
" set m [string length \"-$nitem $mt\"]\n"
" incr n $m\n"
" set n [expr $n / 8]\n"
" set c 0\n"
" for {set i $n} {$i <= $ntab} {incr i} {\n"
" append rc_txt \"\\t\"\n"
" incr c\n"
" }\n"
" if {$c == 0} {\n"
" append rc_txt \"\\t\"\n"
" }\n"
" regsub -all {#} $def {\\#} def\n"
" if {$def == \"\"} {\n"
" set def {\"\"}\n"
" }\n"
" append rc_txt \"# default: $def\"\n"
" }\n"
" append rc_txt \"\\n\"\n"
"\n"
" } elseif {[value_is_bool $item]} {\n"
" set n 0\n"
" if {$qst != \"\"} {\n"
" append rc_txt $qst\n"
" incr n [string length $qst]\n"
" } elseif {$mv == $def} {\n"
" append rc_txt \"#d \"\n"
" incr n [string length \"#d \"]\n"
" }\n"
" if {$def == 1} {\n"
" set dv \"on\"\n"
" } else {\n"
" set dv \"off\"\n"
" }\n"
" append rc_txt \"-$item\"\n"
" set m [string length \"-$item\"]\n"
" incr n $m\n"
" set n [expr $n / 8]\n"
" for {set i $n} {$i <= $ntab} {incr i} {\n"
" append rc_txt \"\\t\"\n"
" }\n"
" append rc_txt \"# default: $dv\"\n"
" append rc_txt \"\\n\"\n"
"\n"
" }\n"
" }\n"
" return $rc_txt\n"
"}\n"
"\n"
"proc double_check_start_x11vnc {} {\n"
" global hostname\n"
" set msg [get_start_x11vnc_txt]\n"
" bell\n"
" append msg \"\\n\"\n"
" append msg \"*** To run the above command on machine \\\"$hostname\\\" (thereby\\n\"\n"
" append msg \"*** starting x11vnc) press \\\"OK\\\", otherwise press \\\"Cancel\\\".\\n\"\n"
" return [warning_dialog $msg \"start\"]\n"
"}\n"
"\n"
"proc get_start_x11vnc_txt {} {\n"
" set cmd [get_start_x11vnc_cmd]\n"
" set str [join $cmd]\n"
" set msg \"\"\n"
" append msg \"\\n\"\n"
" append msg \"==== The command built so far is: ====\\n\";\n"
" append msg \"\\n\"\n"
" append msg \"$str\\n\"\n"
" return $msg\n"
"}\n"
"\n"
"proc show_start_cmd {} {\n"
" set msg [get_start_x11vnc_txt]\n"
" append_text \"$msg\\n\"\n"
"}\n"
"\n"
"proc get_nitem {item} {\n"
" set nitem $item\n"
" if {$nitem == \"screen_blank\"} {\n"
" set nitem \"sb\"\n"
" } elseif {$nitem == \"xrandr_mode\"} {\n"
" set nitem \"xrandr\"\n"
" } elseif {$nitem == \"unixpw_list\"} {\n"
" set nitem \"unixpw\"\n"
" } elseif {$nitem == \"unixpw_nis_list\"} {\n"
" set nitem \"unixpw_nis\"\n"
" } elseif {$nitem == \"stunnel_pem\"} {\n"
" set nitem \"stunnel\"\n"
" } elseif {$nitem == \"ssl_pem\"} {\n"
" set nitem \"ssl\"\n"
" } elseif {$nitem == \"wireframe_mode\"} {\n"
" set nitem \"wireframe\"\n"
" } elseif {$nitem == \"solid_color\"} {\n"
" set nitem \"solid\"\n"
" }\n"
" return $nitem\n"
"}\n"
"\n"
"proc get_start_x11vnc_cmd {{show_rc 0}} {\n"
" global cmd_var menu_var default_var unset_str x11vnc_prog\n"
"\n"
" set xterm_cmd \"xterm -iconic -geometry 80x35 -title x11vnc-console -e\"\n"
"\n"
" set cmd [split $xterm_cmd]\n"
"\n"
" lappend cmd $x11vnc_prog\n"
"\n"
" lappend cmd \"-gui\"\n"
" lappend cmd \"none\"\n"
"\n"
" set rc_txt \"\"\n"
"\n"
" set saw_id 0\n"
"\n"
" foreach item [lsort [array names menu_var]] {\n"
" if {$item == \"gui\"} {\n"
" continue\n"
" } elseif {![active_when_starting $item]} {\n"
" continue\n"
" } elseif {[is_action $item]} {\n"
" continue\n"
" } elseif {$item == \"debug_gui\"} {\n"
" continue\n"
" } elseif {$item == \"WindowView\"} {\n"
" continue\n"
" }\n"
"\n"
" if {$item == \"id\" || $item == \"sid\"} {\n"
" set val $menu_var($item);\n"
" if {$val == \"0x0\" || $val == \"root\"} {\n"
" continue\n"
" }\n"
" }\n"
" if {$item == \"sid\" && $saw_id} {\n"
" continue\n"
" }\n"
" if {$item == \"id\"} {\n"
" set saw_id 1\n"
" } elseif {$item == \"httpport\" && $menu_var($item) == \"0\"} {\n"
" continue\n"
" } elseif {$item == \"progressive\" && $menu_var($item) == \"0\"} {\n"
" continue\n"
" } elseif {$item == \"dontdisconnect\" && $menu_var($item) == \"-1\"} {\n"
" continue\n"
" } elseif {$item == \"alwaysshared\" && $menu_var($item) == \"-1\"} {\n"
" continue\n"
" }\n"
"\n"
" if {[value_is_bool $item]} {\n"
" if {[info exists menu_var($item)]} {\n"
" set add 1\n"
" if {[info exists default_var($item)]} {\n"
" if {$menu_var($item) == $default_var($item)} {\n"
" set add 0;\n"
" }\n"
" } elseif {! $menu_var($item)} {\n"
" set add 0\n"
" }\n"
" if {$add} {\n"
" lappend cmd \"-$item\"\n"
" append rc_txt \"-$item\\n\"\n"
" }\n"
" }\n"
" } elseif {[value_is_string $item]} {\n"
" if {![info exists menu_var($item)]} {\n"
" continue\n"
" }\n"
" if {$menu_var($item) != \"\" && $menu_var($item) != $unset_str} {\n"
" set add 1\n"
" set nitem [get_nitem $item]\n"
"\n"
" if {[info exists default_var($item)]} {\n"
" if {$menu_var($item) == $default_var($item)} {\n"
" set add 0;\n"
" }\n"
" }\n"
" if {$add} {\n"
" lappend cmd \"-$nitem\"\n"
" set mv $menu_var($item)\n"
"\n"
" if {[regexp {^~} $mv]} {\n"
" if {$item == \"auth\" ||\n"
" $item == \"rc\" ||\n"
" $item == \"accept\" || \n"
" $item == \"connect\" || \n"
" $item == \"allow\" || \n"
" $item == \"passwdfile\" || \n"
" $item == \"o\" || \n"
" $item == \"logfile\" || \n"
" $item == \"remap\" || \n"
" $item == \"httpdir\"} { \n"
" set mv [tilde_expand $mv]\n"
" }\n"
" }\n"
" \n"
" lappend cmd $mv\n"
" set mt $mv\n"
" regsub -all {#} $mt {\\#} mt\n"
" append rc_txt \"-$nitem $mt\\n\"\n"
" }\n"
" }\n"
" }\n"
" }\n"
" lappend cmd \"2>\"\n"
" lappend cmd \"/dev/null\"\n"
" lappend cmd \"&\"\n"
" \n"
" if {$show_rc} {\n"
" return $rc_txt\n"
" } else {\n"
" return $cmd\n"
" }\n"
"}\n"
"\n"
"proc start_x11vnc {} {\n"
" global menu_var unset_str\n"
" global x11vnc_prog x11vnc_xdisplay\n"
" global connected_to_x11vnc\n"
"\n"
" if {$connected_to_x11vnc} {\n"
" append_text \"\\n\"\n"
" append_text \"WARNING: Still connected to an x11vnc server.\\n\"\n"
" append_text \"WARNING: Use \\\"stop\\\" or \\\"detach\\\" first.\\n\"\n"
" return 0\n"
" }\n"
"\n"
" if {![double_check_start_x11vnc]} {\n"
" return\n"
" }\n"
"\n"
" set x11vnc_xdisplay \"\"\n"
" if {[info exists menu_var(display)]} {\n"
" if {$menu_var(display) != \"\" && $menu_var(display) != $unset_str} {\n"
" set x11vnc_xdisplay $menu_var(display)\n"
" }\n"
" }\n"
"\n"
" set cmd [get_start_x11vnc_cmd]\n"
"\n"
" set str [join $cmd]\n"
" regsub { -e} $str \" -e \\\\\\n \" str\n"
"\n"
" if {0} {\n"
" puts \"running: $str\"\n"
" foreach word $cmd {\n"
" puts \" word: $word\"\n"
" }\n"
" }\n"
"\n"
" append_text \"Starting x11vnc in an iconified xterm with command:\\n\"\n"
" append_text \" $str\\n\\n\"\n"
" catch {[eval exec $cmd]}\n"
" after 500\n"
" try_connect_and_query_all 3\n"
" if {!$connected_to_x11vnc} {\n"
" append_text \"\\nStarting x11vnc seems to have failed.\\n\"\n"
" if {[regexp -- {-o } $str] || [regexp -- {-logfile} $str]} {\n"
" append_text \"Examine the logfile (Debugging -> show-logfile) for error messages.\\n\"\n"
" } else {\n"
" append_text \"Rerun with a logfile (if needed) and examine the logfile\\n\"\n"
" append_text \"(Debugging -> show-logfile) for error messages.\\n\"\n"
" }\n"
" }\n"
"}\n"
"\n"
"proc run_remote_cmd_via_sock {opts} {\n"
" global client_sock\n"
"\n"
" set db 0\n"
" if {[file channels $client_sock] == \"\"} {\n"
" set client_sock \"\"\n"
" return \"fail\"\n"
" }\n"
" if {[eof $client_sock]} {\n"
" catch {close $client_sock}\n"
" set client_sock \"\"\n"
" return \"fail\"\n"
" }\n"
" set result \"\"\n"
" \n"
" setup_client_sock 0\n"
"\n"
" set docmd \"\"\n"
" foreach opt $opts {\n"
" if {$opt == \"-R\"} {\n"
" set docmd \"-R\"\n"
" continue\n"
" } elseif {$opt == \"-Q\"} {\n"
" set docmd \"-Q\"\n"
" continue\n"
" }\n"
"\n"
" if {$docmd == \"\"} {\n"
" continue\n"
" } elseif {$docmd == \"-R\"} {\n"
" set str \"cmd=$opt\"\n"
" } elseif {$docmd == \"-Q\"} {\n"
" set str \"qry=$opt\"\n"
" } else {\n"
" set docmd \"\"\n"
" continue\n"
" }\n"
"\n"
" if {$db} {puts stderr \"run_remote_cmd_via_sock: $docmd \\\"$str\\\"\"}\n"
" puts $client_sock $str\n"
" if {$db} {puts stderr \"run_remote_cmd_via_sock: flush\"}\n"
" flush $client_sock\n"
" if {$db} {puts stderr \"run_remote_cmd_via_sock: gets\"}\n"
" gets $client_sock res\n"
" if {$db} {puts stderr \"run_remote_cmd_via_sock: \\\"$res\\\"\"}\n"
" set res [string trim $res]\n"
"\n"
" if [regexp {^clients:} $res] {\n"
" regsub {^clients:} $res \"\" tmp\n"
" if {$tmp == \"none\"} {\n"
" set tmp \"\"\n"
" }\n"
" update_clients_menu $tmp\n"
" set client_str $tmp\n"
" set_client_balloon $tmp\n"
"\n"
" if ![regexp {^clients} $opt] {\n"
" # we could block here...\n"
" if {$db} {puts stderr \"run_remote_cmd_via_sock: gets\"}\n"
" gets $client_sock res\n"
" if {$db} {puts stderr \"run_remote_cmd_via_sock: \\\"$res\\\"\"}\n"
" set res [string trim $res]\n"
" }\n"
" }\n"
"\n"
" set docmd \"\"\n"
"\n"
" if {$res != \"\"} {\n"
" append result \"$res\\n\"\n"
" }\n"
" }\n"
" \n"
" setup_client_sock 1\n"
"\n"
" set result [string trim $result]\n"
"\n"
" return $result\n"
"}\n"
"\n"
"proc run_remote_cmd {opts} {\n"
" global menu_var x11vnc_prog x11vnc_cmdline x11vnc_xdisplay\n"
" global x11vnc_auth_file x11vnc_connect_file\n"
" global client_sock\n"
"\n"
" set debug [in_debug_mode]\n"
"\n"
" if {[lindex $opts 0] == \"-R\" && [lindex $opts 1] == \"noremote\"} {\n"
" set str [join $opts]\n"
" if ![double_check_noremote] {\n"
" append_text \"skipping: x11vnc $str\"\n"
" return \"\"\n"
" } else {\n"
" append_text \"running: x11vnc $str (please do \\\"Actions -> detach\\\" to clean things up)\\n\"\n"
" append_text \"subsequent -R/-Q commands should fail...\"\n"
" }\n"
" }\n"
"\n"
" if {$client_sock != \"\"} {\n"
" menus_disable\n"
" stop_watch on\n"
" set result [run_remote_cmd_via_sock $opts]\n"
" stop_watch off\n"
" menus_enable\n"
" if {$result != \"fail\"} {\n"
" return $result\n"
" }\n"
" }\n"
"\n"
" set cmd \"\"\n"
"\n"
" lappend cmd $x11vnc_prog;\n"
"\n"
" if {$x11vnc_connect_file != \"\"} {\n"
" lappend cmd \"-connect\"\n"
" lappend cmd $x11vnc_connect_file\n"
" } else {\n"
" if {$x11vnc_xdisplay != \"\"} {\n"
" lappend cmd \"-display\"\n"
" lappend cmd $x11vnc_xdisplay\n"
" }\n"
" if {$x11vnc_auth_file != \"\"} {\n"
" lappend cmd \"-auth\"\n"
" lappend cmd $x11vnc_auth_file\n"
" }\n"
" }\n"
" lappend cmd \"-sync\"\n"
" foreach word $opts {\n"
" lappend cmd $word\n"
" }\n"
" lappend cmd \"2>\"\n"
" lappend cmd \"/dev/null\"\n"
"\n"
" if {0 || $debug} {\n"
" set str [join $cmd]\n"
" puts \"running: $str\"\n"
" foreach word $cmd {\n"
" puts \" word: $word\"\n"
" }\n"
" }\n"
"\n"
" set output \"\"\n"
" menus_disable\n"
"\n"
" stop_watch on\n"
" catch {set output [eval exec $cmd]}\n"
" stop_watch off\n"
"\n"
" menus_enable\n"
" if {$debug} {\n"
" if {[string length $output] > 100} {\n"
" set str [string range $output 0 100]\n"
" append_text \"output: $str ...\\n\"\n"
" } else {\n"
" append_text \"output: $output\\n\"\n"
" }\n"
" }\n"
" return $output\n"
"}\n"
"\n"
"proc try_connect_and_query_all {{n 2}} {\n"
" for {set i 0} {$i < $n} {incr i} {\n"
" if {$i > 0} {\n"
" after 500\n"
" append_text \"trying again ...\\n\"\n"
" }\n"
" if {[try_connect]} {\n"
" query_all\n"
" break\n"
" }\n"
" }\n"
"}\n"
"\n"
"proc try_connect {} {\n"
" global x11vnc_xdisplay connected_to_x11vnc reply_xdisplay\n"
" global menu_var unset_str\n"
"\n"
" set db 0\n"
"#dtime c1\n"
"\n"
" if {! $connected_to_x11vnc} {\n"
" if {[info exists menu_var(display)]} {\n"
" set d $menu_var(display)\n"
" if {$d != \"\" && $d != $unset_str && $d != $x11vnc_xdisplay} {\n"
" set x11vnc_xdisplay $menu_var(display)\n"
" append_text \"Setting X display to: $x11vnc_xdisplay\\n\"\n"
" }\n"
" }\n"
" }\n"
"\n"
" set_info \"Pinging $x11vnc_xdisplay ...\"\n"
" set rargs [list \"-Q\" \"ping\"]\n"
" set result [run_remote_cmd $rargs]\n"
"#dtime c2a\n"
"\n"
" if {$db} {puts \"try_connect: \\\"$result\\\"\"}\n"
"\n"
" if {[regexp {^ans=ping:} $result]} {\n"
" regsub {^ans=ping:} $result {} reply_xdisplay\n"
" set msg \"Connected to $reply_xdisplay\"\n"
" set_info $msg\n"
" append_text \"$msg\\n\"\n"
" set_connected yes\n"
"\n"
" setup_client_channel\n"
"#dtime c2b\n"
" setup_client_sock 1\n"
" setup_client_tail\n"
"\n"
" fetch_displays\n"
"#dtime c3a\n"
" return 1\n"
" } else {\n"
" set str \"x11vnc server.\"\n"
" if {$x11vnc_xdisplay != \"\"} {\n"
" set str $x11vnc_xdisplay\n"
" }\n"
" set msg \"No reply from $str\"\n"
" set_info $msg\n"
" append_text \"$msg\\n\"\n"
" set_connected no\n"
" return 0\n"
" }\n"
"}\n"
"\n"
"proc set_view_variable {val} {\n"
" global menu_var\n"
" set menu_var(WindowView) $val\n"
"}\n"
"proc get_view_variable {} {\n"
" global menu_var\n"
" if {![info exists menu_var(WindowView)]} {\n"
" set menu_var(WindowView) \"none\"\n"
" }\n"
" return $menu_var(WindowView)\n"
"}\n"
"\n"
"proc dono {a b c} {\n"
" exit 1;\n"
"}\n"
"\n"
"proc do_port_prompt {} {\n"
" global bfont ffont\n"
" global port_reply port_set\n"
"\n"
" set guess 5900\n"
" for {set i 0} {$i < 50} {incr i} {\n"
" set fh \"\"\n"
" set try [expr $guess + $i]\n"
" catch {set fh [socket -server dono $try]}\n"
" if {$fh != \"\"} {\n"
" catch {close $fh}\n"
" set guess $try\n"
" break;\n"
" }\n"
" }\n"
" set hn \"\"\n"
" catch {set hn [exec uname -n]}\n"
" if {$hn == \"\"} {\n"
" set hn \"hostname\"\n"
" }\n"
"\n"
" set text \" Set the x11vnc Listening Port:\n"
"\n"
" VNC Display :0 corresponds to TCP port 5900\n"
" VNC Display :1 corresponds to TCP port 5901\n"
" etc.\n"
"\n"
" In the Entry below, indicate a Port for x11vnc to listen on. \n"
"\n"
" Note that to connect to x11vnc, a VNC Viewer will need to\n"
" know your selection, for example:\n"
"\n"
" vncviewer $hn:0\n"
" vncviewer $hn:1\n"
" etc.\n"
"\n"
" Your firewall may block incoming connections to TCP ports;\n"
" if it does you may need to reconfigure it. \n"
" \n"
" You can also set some additional parameters:\n"
"\n"
" - Enable SSL encryption.\n"
" (requires an SSL enabled vncviewer, such as SSVNC) \n"
" - Listen only on localhost. (e.g. for an SSH tunnel)\n"
" - Enable UltraVNC or TightVNC File transfer.\n"
"\"\n"
" set port_set $guess\n"
" set port_reply \"\"\n"
"\n"
" toplevel .pp\n"
" wm title .pp \"Select x11vnc port\"\n"
"\n"
" wm protocol . WM_DELETE_WINDOW \"destroy .; exit\"\n"
" wm protocol .pp WM_DELETE_WINDOW \"destroy .pp; exit\"\n"
"\n"
" label .pp.m -text \"$text\" -relief ridge -justify left -font $ffont\n"
"\n"
" global tk_version\n"
" set tkold 0\n"
" if [info exists tk_version] {\n"
" if [regexp {^8\\.[0-3]$} $tk_version] {\n"
" set tkold 1\n"
" }\n"
" if [regexp {^[3-7]\\.} $tk_version] {\n"
" set tkold 1\n"
" }\n"
" }\n"
"\n"
" if {$tkold} {\n"
" frame .pp.f -bd 1 -relief ridge\n"
" } else {\n"
" frame .pp.f -bd 1 -relief ridge -pady 2\n"
" }\n"
" label .pp.f.l -text \"Port: \"\n"
" entry .pp.f.e -width 8 -textvariable port_set\n"
" global enable_ssl; set enable_ssl 0\n"
" if [info exists env(X11VNC_SSL_ENABLED)] {\n"
" set enable_ssl 1\n"
" }\n"
" checkbutton .pp.f.ssl -relief raised -pady 3 -padx 3 -text \"Enable SSL\" -variable enable_ssl\n"
" global localhost; set localhost 0\n"
" if [info exists env(X11VNC_LOCALHOST_ENABLED)] {\n"
" set localhost 1\n"
" }\n"
" checkbutton .pp.f.loc -relief raised -pady 3 -padx 3 -text \"Listen on localhost\" -variable localhost\n"
" pack .pp.f.l .pp.f.e -side left\n"
" pack .pp.f.loc .pp.f.ssl -side right\n"
"\n"
" if {$tkold} {\n"
" frame .pp.t -bd 1 -relief ridge\n"
" } else {\n"
" frame .pp.t -bd 1 -relief ridge -pady 2\n"
" }\n"
" global file_transfer; set file_transfer \"none\"\n"
" if [info exists env(X11VNC_FILETRANSFER_ENABLED)] {\n"
" set file_transfer $env(X11VNC_FILETRANSFER_ENABLED)\n"
" }\n"
" label .pp.t.l -text \"File Transfer: \"\n"
" radiobutton .pp.t.none -text \"None\" -variable file_transfer -value \"none\"\n"
" radiobutton .pp.t.ultra -text \"UltraVNC\" -variable file_transfer -value \"ultra\"\n"
" radiobutton .pp.t.tight -text \"TightVNC\" -variable file_transfer -value \"tight\"\n"
" pack .pp.t.l .pp.t.none .pp.t.ultra .pp.t.tight -side left\n"
"\n"
" frame .pp.o -bd 1 -relief ridge\n"
" button .pp.o.ok -text \"OK\" -command \"set port_reply 1; destroy .pp\"\n"
" button .pp.o.cancel -text \"Cancel\" -command \"set port_reply 0; destroy .pp\"\n"
" pack .pp.o.ok .pp.o.cancel -side left -fill x -expand 1\n"
" pack .pp.m -side top -fill x -expand 1 \n"
" pack .pp.f .pp.t .pp.o -side top -fill x\n"
"\n"
" focus .pp.f.e\n"
" .pp.f.e icursor end\n"
"\n"
" wm withdraw .pp\n"
" update\n"
" center_win .pp\n"
"\n"
" wm minsize .pp [winfo width .pp] [winfo height .pp]\n"
"\n"
" bind .pp.f.e <KeyPress-Return> \"set port_reply 1; destroy .pp\"\n"
"\n"
" vwait port_reply\n"
"\n"
" if {$port_reply} {\n"
" regsub -all {^:} $port_set \"\" port_set\n"
" regsub -all {[ \\t]} $port_set \"\" port_set\n"
" if {[regexp {^[0-9][0-9]*$} $port_set]} {\n"
" if {$port_set < 0} {\n"
" set port_set [expr 0 - $port_set]\n"
" } elseif {$port_set < 200} {\n"
" set port_set [expr $port_set + 5900]\n"
" } \n"
" puts \"$port_set:ssl${enable_ssl}:localhost$localhost:ft_$file_transfer\"\n"
" }\n"
" }\n"
"}\n"
"\n"
"proc change_view_state {} {\n"
" global menu_var gui_current_state\n"
"\n"
" set new [get_view_variable]\n"
"\n"
" if {![info exists gui_current_state]} {\n"
" set gui_current_state \"\"\n"
" }\n"
" set old $gui_current_state\n"
" #puts \"$old -> $new\"\n"
"\n"
" if {$old == $new} {\n"
" return\n"
" }\n"
"\n"
" if {$old == \"full\" || $old == \"icon\" || $old == \"tray\"} {\n"
" ;\n"
" } else {\n"
" set old \"none\"\n"
" }\n"
"\n"
" if {$new == \"full\" || $new == \"icon\" || $new == \"tray\"} {\n"
" if {$old == \"tray\"} {\n"
" # sigh XReparentWindow would be too easy...\n"
" # undo_tray_embed\n"
" restart_everything $new\n"
" destroy .\n"
" exit\n"
" }\n"
" make_gui $new\n"
" if {$new == \"tray\"} {\n"
" wm withdraw .\n"
" }\n"
" } else {\n"
" set_view_variable $old\n"
" }\n"
"}\n"
"\n"
"proc setup_client_tail {} {\n"
" global client_tail\n"
" if {$client_tail != \"\"} {\n"
" fileevent $client_tail readable read_client_tail\n"
" }\n"
"}\n"
"\n"
"proc setup_client_sock {{enable 1}} {\n"
" global client_sock\n"
" if {$client_sock != \"\"} {\n"
" if {$enable} {\n"
" fileevent $client_sock readable read_client_sock\n"
" } else {\n"
" fileevent $client_sock readable \"\"\n"
" }\n"
" }\n"
"}\n"
"\n"
"proc setup_tray_embed {} {\n"
" global icon_win\n"
" update\n"
" set w [winfo width .]\n"
" set h [winfo height .]\n"
" if {$w < 24} {\n"
" set w 24\n"
" }\n"
" if {$h < 24} {\n"
" set h 24\n"
" }\n"
" wm minsize . $w $h\n"
" set wid [winfo id .] \n"
" push_new_value \"remote-cmd\" \"remote-cmd\" \"trayembed:$wid\" 0\n"
"}\n"
"\n"
"proc restart_everything {gui_mode} {\n"
" global env gui_argv0 x11vnc_prog full_win\n"
" global icon_mode_at_startup\n"
" global tray_embed tray_running\n"
" if {$gui_mode == \"full\"} {\n"
" set env(X11VNC_ICON_MODE) 0\n"
" } elseif {$gui_mode == \"icon\"} {\n"
" set env(X11VNC_ICON_MODE) 1\n"
" } elseif {$gui_mode == \"tray\"} {\n"
" if {$tray_running} {\n"
" set env(X11VNC_ICON_MODE) \"RUNNING\"\n"
" } else {\n"
" set env(X11VNC_ICON_MODE) \"TRAY\"\n"
" }\n"
" }\n"
" puts stderr \"\"\n"
" puts stderr \"tkx11vnc: restarting gui to leave tray mode.\"\n"
" puts stderr \" new gui will be running in the background.\"\n"
" puts stderr \" use kill(1) rather than Ctrl-C to kill it.\"\n"
" puts stderr \"\"\n"
" if {[info exists env(X11VNC_RESTART_DEPTH)]} {\n"
" set n $env(X11VNC_RESTART_DEPTH)\n"
" incr n\n"
" set env(X11VNC_RESTART_DEPTH) $n\n"
" } else {\n"
" set env(X11VNC_RESTART_DEPTH) 0\n"
" }\n"
" set env(X11VNC_ICON_SETPASS) \"\"\n"
"\n"
" if {![info exists env(X11VNC_WISHCMD)]} {\n"
" puts stderr \"failure in restart_everything.\"\n"
" exit 1;\n"
" }\n"
"\n"
" set code [exec $x11vnc_prog -printgui]\n"
" if {[string length $code] < 20000} {\n"
" puts stderr \"failure in restart_everything.\"\n"
" exit 1;\n"
" }\n"
" set tmp \"/tmp/x11vnc[pid]\"\n"
" append tmp [clock clicks]\n"
" set tmp2 \"\"\n"
" catch {set tmp2 [exec mktemp $tmp.XXXXXX 2>/dev/null]}\n"
" if {$tmp2 != \"\" && [file exists $tmp2]} {\n"
" set tmp $tmp2\n"
" } else {\n"
" file delete -force $tmp\n"
" if {[file exists $tmp]} {\n"
" puts stderr \"failure in restart_everything.\"\n"
" exit 1;\n"
" }\n"
" }\n"
" set fh [open $tmp \"a\"]\n"
" if {![file owned $tmp]} {\n"
" puts stderr \"failure in restart_everything.\"\n"
" exit 1;\n"
" }\n"
" file attributes $tmp -permissions \"0400\"\n"
" puts $fh $code\n"
" close $fh\n"
"\n"
" #puts stderr [exec ls -l $tmp]\n"
"\n"
" wm withdraw .\n"
" catch {wm withdraw $full_win}\n"
" update\n"
"\n"
" exec $env(X11VNC_WISHCMD) $tmp &\n"
" after 2000\n"
" file delete -force $tmp\n"
" \n"
" destroy .\n"
" exit\n"
"}\n"
"\n"
"proc undo_tray_embed {} {\n"
" global icon_win\n"
" set wid [winfo id .] \n"
" push_new_value \"remote-cmd\" \"remote-cmd\" \"trayunembed:$wid\" 0\n"
"}\n"
"\n"
"############################################################################\n"
"# main:\n"
"\n"
"if [info exists env(X11VNC_GUI_TIME)] {\n"
" dtime M\n"
"}\n"
"\n"
"wm withdraw .\n"
"\n"
"global env x11vnc_prog x11vnc_cmdline x11vnc_xdisplay x11vnc_connect;\n"
"global x11vnc_xdisplay0\n"
"global x11vnc_client_file x11vnc_gui_geom x11vnc_started vnc_url\n"
"global x11vnc_gui_params\n"
"global x11vnc_auth_file x11vnc_connect_file beginner_mode simple_gui_created\n"
"global helpall helptext helpremote helplabel hostname osname\n"
"global all_settings reply_xdisplay always_update\n"
"global max_text_height max_text_width\n"
"global text_height\n"
"global menu_var unset_str menus_disabled\n"
"global bfont ffont sfont snfont old_labels have_labelframes\n"
"global connected_to_x11vnc\n"
"global cache_all_query_vars\n"
"global last_query_all_time query_all_freq client_tail client_sock client_info_read\n"
"global icon_mode icon_mode_at_startup\n"
"global tray_embed tray_running icon_setpasswd icon_embed_id\n"
"global icon_noadvanced icon_minimal\n"
"global make_gui_count text_area_str\n"
"global gui_argv0 gui_start_mode\n"
"global screen_height screen_width\n"
"\n"
"set unset_str \"(unset)\"\n"
"set vnc_url $unset_str\n"
"set connected_to_x11vnc 0\n"
"set menus_disabled 0\n"
"set max_text_height 40\n"
"set max_text_width 90\n"
"set text_height 14\n"
"set bfont \"-adobe-helvetica-bold-r-*-*-*-120-*-*-*-*-*-*\"\n"
"set sfont \"-adobe-helvetica-bold-r-*-*-*-100-*-*-*-*-*-*\"\n"
"set snfont \"-adobe-helvetica-medium-r-*-*-*-100-*-*-*-*-*-*\"\n"
"set ffont \"fixed\"\n"
"\n"
"set ls \"\"\n"
"catch {set ls [font metrics $bfont -linespace]}\n"
"if {$ls != \"\" && $ls > 14} {\n"
" # some recent setups have BIG rendering for the above fonts.\n"
" # on recent (8/08) debian these are really ragged:\n"
" set bfont \"-adobe-helvetica-bold-r-*-*-*-90-*-*-*-*-*-*\"\n"
" set sfont \"-adobe-helvetica-bold-r-*-*-*-75-*-*-*-*-*-*\"\n"
" set snfont \"-adobe-helvetica-medium-r-*-*-*-75-*-*-*-*-*-*\"\n"
"\n"
" set ls \"\"\n"
" catch {set ls [font metrics $bfont -linespace]}\n"
" if {$ls != \"\" && $ls < 14} {\n"
" # these are bigger but look better... but for how long?\n"
" set bfont \"-adobe-helvetica-bold-r-*-*-*-100-*-*-*-*-*-*\"\n"
" set sfont \"-adobe-helvetica-bold-r-*-*-*-80-*-*-*-*-*-*\"\n"
" set snfont \"-adobe-helvetica-medium-r-*-*-*-80-*-*-*-*-*-*\"\n"
"\n"
" # maybe consider... {-font font Font {Helvetica -12 bold} {Helvetica -12 bold}}\n"
" # or stick with system font like ssvnc.\n"
" }\n"
"}\n"
"\n"
"# need to check if \"fixed\" font under XFT on tk8.5 is actually fixed width!!\n"
"set ls \"\"\n"
"catch {set ls [font metrics $ffont -linespace]}\n"
"set fs \"\"\n"
"catch {set fs [font metrics $ffont -fixed]}\n"
"set redo 0\n"
"if {$fs != \"\" && $fs != \"1\"} {\n"
" set redo 1\n"
"}\n"
"if {$ls != \"\" && $ls > 14} {\n"
" set redo 1\n"
"}\n"
"if {$redo} {\n"
" foreach fn [font names] {\n"
" if {$fn == \"TkFixedFont\"} {\n"
" set ffont $fn\n"
" break\n"
" }\n"
" }\n"
"}\n"
"\n"
"set help_indent 24;\n"
"set reply_xdisplay \"\"\n"
"set all_settings \"None so far.\"\n"
"set always_update 1\n"
"set cache_all_query_vars \"\"\n"
"set query_all_freq 120\n"
"set last_query_all_time [clock seconds]\n"
"set client_tail \"\"\n"
"set client_sock \"\"\n"
"set client_info_read 0\n"
"set make_gui_count 0\n"
"set text_area_str \"\"\n"
"set gui_argv0 $argv0\n"
"set gui_start_mode \"\"\n"
"\n"
"if {$tk_version < 8.0} {\n"
" puts stderr \"\"\n"
" puts stderr \"*** tkx11vnc: tk version is old $tk_version, please use 8.0 or higher.\"\n"
" puts stderr \"*** will try to continue with reduced functionality...\"\n"
" puts stderr \"\"\n"
"}\n"
"if {[regexp {^[34]} $tk_version] || $tk_version == \"8.0\"} {\n"
" set old_labels 1\n"
"} else {\n"
" set old_labels 0\n"
"}\n"
"set have_labelframes 1\n"
"if {$tk_version < 8.4} {\n"
" set have_labelframes 0\n"
"}\n"
"\n"
"set screen_height [winfo screenheight .]\n"
"set screen_width [winfo screenwidth .]\n"
"if {$screen_height < 500} {\n"
" # short screen, PDA?\n"
" set max_text_height 22\n"
" set text_height 13\n"
" if {$screen_height <= 360} {\n"
" # very short.\n"
" set max_text_height 16\n"
" set max_text_width 60\n"
" set text_height 11\n"
" }\n"
"}\n"
"if {[info exists env(X11VNC_GUI_TEXT_HEIGHT)]} {\n"
" set max_text_height $env(X11VNC_GUI_TEXT_HEIGHT)\n"
"}\n"
"if {[info exists env(X11VNC_GUI_TEXT_WIDTH)]} {\n"
" set max_text_width $env(X11VNC_GUI_TEXT_WIDTH)\n"
"}\n"
"\n"
"if {\"$argv\" == \"-spit\"} {\n"
" set fh [open $argv0 r]\n"
" puts \"#ifndef _TKX11VNC_H\"\n"
" puts \"#define _TKX11VNC_H\"\n"
" puts \"#ifdef NOGUI\"\n"
" puts \"char gui_code\\[\\] = \\\"\\\";\"\n"
" puts \"#else\"\n"
" puts \"/*\"\n"
" puts \" * tkx11vnc.h: generated by 'tkx11vnc -spit'\"\n"
" puts \" * Abandon all hope, ye who enter here...\"\n"
" puts \" * ...edit tkx11vnc instead.\"\n"
" puts \" */\"\n"
" puts \" char gui_code\\[\\] =\"\n"
" while {[gets $fh line] > -1} {\n"
" regsub -all {\\\\} $line {\\\\\\\\} line\n"
" regsub -all {\"} $line {\\\\\"} line\n"
" puts \"\\\"$line\\\\n\\\"\"\n"
" }\n"
" puts \"#endif\"\n"
" puts \"/* ifdef NOGUI */\"\n"
" puts \"#endif\"\n"
" puts \"/* ifndef _TKX11VNC_H */\"\n"
" close $fh\n"
" puts \";\"\n"
" exit 0\n"
"}\n"
"if {\"$argv\" == \"-portprompt\"} {\n"
" do_port_prompt\n"
" exit 0\n"
"}\n"
"\n"
"\n"
"set_view_variable \"full\"\n"
"\n"
"#puts [exec env | grep X11VNC]\n"
"\n"
"# Read environment for clues:\n"
"\n"
"set x11vnc_client_file \"\";\n"
"if {[info exists env(X11VNC_CLIENT_FILE)]} {\n"
" set x11vnc_client_file $env(X11VNC_CLIENT_FILE);\n"
" set file $x11vnc_client_file\n"
"\n"
" set client_tail \"\"\n"
" if {[file exists $file] && [file isfile $file]} {\n"
" if {[file readable $file] && [file owned $file]} {\n"
" set client_tail [open \"|tail -f $x11vnc_client_file\" \"r\"]\n"
" }\n"
" }\n"
" if {$client_tail != \"\"} {\n"
" gets $client_tail tmp\n"
" if [eof $client_tail] {\n"
"#puts \"eof $client_tail\"\n"
" clean_client_tail\n"
" set client_tail \"\"\n"
" }\n"
" }\n"
" catch {file delete -force $x11vnc_client_file}\n"
"}\n"
"\n"
"if {[info exists env(X11VNC_PROG)]} {\n"
" set x11vnc_prog $env(X11VNC_PROG);\n"
"} else {\n"
" set x11vnc_prog \"x11vnc\";\n"
"}\n"
"\n"
"if {[info exists env(X11VNC_CMDLINE)]} {\n"
" set x11vnc_cmdline $env(X11VNC_CMDLINE);\n"
"} else {\n"
" set x11vnc_cmdline \"\";\n"
"}\n"
"\n"
"if {[info exists env(X11VNC_CONNECT)]} {\n"
" set x11vnc_connect 1\n"
"} else {\n"
" set x11vnc_connect 0;\n"
"}\n"
"\n"
"if {[info exists env(X11VNC_GUI_GEOM)]} {\n"
" set x11vnc_gui_geom $env(X11VNC_GUI_GEOM);\n"
"} else {\n"
" set x11vnc_gui_geom \"\"\n"
"}\n"
"if {[info exists env(X11VNC_GUI_PARAMS)]} {\n"
" set x11vnc_gui_params $env(X11VNC_GUI_PARAMS);\n"
"} else {\n"
" set x11vnc_gui_params \"\"\n"
"}\n"
"\n"
"if {[info exists env(X11VNC_CONNECT_FILE)]} {\n"
" set x11vnc_connect_file $env(X11VNC_CONNECT_FILE);\n"
"} else {\n"
" set x11vnc_connect_file \"\";\n"
"}\n"
"\n"
"set x11vnc_started 0\n"
"if {[info exists env(X11VNC_STARTED)]} {\n"
" set x11vnc_started 1\n"
"}\n"
"\n"
"set x11vnc_xdisplay \"\"\n"
"if {[info exists env(X11VNC_XDISPLAY)]} {\n"
" set x11vnc_xdisplay $env(X11VNC_XDISPLAY);\n"
" set x11vnc_connect 1\n"
"\n"
"} elseif {$argv != \"\" && [regexp {:[0-9]} $argv]} {\n"
" set env(X11VNC_XDISPLAY) \"$argv\"\n"
" set x11vnc_xdisplay \"$argv\"\n"
" set x11vnc_connect 1\n"
"\n"
"} elseif {[info exists env(DISPLAY)]} {\n"
" set x11vnc_xdisplay $env(DISPLAY);\n"
"} else {\n"
" set x11vnc_xdisplay \":0\";\n"
"}\n"
"set x11vnc_xdisplay0 $x11vnc_xdisplay\n"
"\n"
"if {[info exists env(X11VNC_AUTH_FILE)]} {\n"
" set x11vnc_auth_file $env(X11VNC_AUTH_FILE)\n"
"} else {\n"
" set x11vnc_auth_file \"\"\n"
"}\n"
"\n"
"set simple_gui_created 0\n"
"if {[info exists env(X11VNC_SIMPLE_GUI)]} {\n"
" set beginner_mode 1\n"
"} else {\n"
" set beginner_mode 0\n"
"}\n"
"\n"
"set icon_mode 0\n"
"set tray_embed 0\n"
"set tray_running 0\n"
"\n"
"if {![info exists env(X11VNC_ICON_MODE_AT_STARTUP)]} {\n"
" if {[info exists env(X11VNC_ICON_MODE)]} {\n"
" if {$env(X11VNC_ICON_MODE) != 0} {\n"
" set env(X11VNC_ICON_MODE_AT_STARTUP) 1\n"
" } else {\n"
" set env(X11VNC_ICON_MODE_AT_STARTUP) 0\n"
" }\n"
" } else {\n"
" set env(X11VNC_ICON_MODE_AT_STARTUP) 0\n"
" }\n"
"}\n"
"set icon_mode_at_startup $env(X11VNC_ICON_MODE_AT_STARTUP)\n"
"\n"
"if {![info exists env(X11VNC_ICON_MODE)]} {\n"
" set icon_mode 0\n"
"} elseif {$env(X11VNC_ICON_MODE) == \"\" || $env(X11VNC_ICON_MODE) == \"0\"} {\n"
" set icon_mode 0\n"
"} else {\n"
" set icon_mode 1\n"
" set_view_variable \"icon\"\n"
" if [regexp -nocase {TRAY} $env(X11VNC_ICON_MODE)] {\n"
" set tray_embed 1\n"
" }\n"
" if [regexp -nocase {RUNNING} $env(X11VNC_ICON_MODE)] {\n"
" set tray_running 1\n"
" }\n"
"}\n"
"\n"
"set icon_setpasswd 0\n"
"if {[info exists env(X11VNC_ICON_SETPASS)]} {\n"
" if {$env(X11VNC_ICON_SETPASS) != \"\"} {\n"
" set icon_setpasswd 1\n"
" }\n"
"}\n"
"\n"
"set icon_noadvanced 0\n"
"if {[info exists env(X11VNC_ICON_NOADVANCED)]} {\n"
" set icon_noadvanced 1\n"
"}\n"
"\n"
"set icon_minimal 0\n"
"if {[info exists env(X11VNC_ICON_MINIMAL)]} {\n"
" set icon_minimal 1\n"
"}\n"
"\n"
"if {[info exists env(X11VNC_ICON_EMBED_ID)]} {\n"
" set icon_embed_id $env(X11VNC_ICON_EMBED_ID)\n"
"} else {\n"
" set icon_embed_id \"\"\n"
"}\n"
"\n"
"\n"
"set hostname [exec uname -n]\n"
"set osname [exec uname]\n"
"\n"
"if {[regexp -nocase {IRIX} $osname]} {\n"
" # IRIX \"fixed\" font is huge and doublespaced... \n"
" set ffont $snfont\n"
"}\n"
"if {[regexp -nocase {Darwin} $osname]} {\n"
" set ffont {Monaco 10}\n"
" set bfont {system}\n"
"}\n"
"\n"
"#puts [exec env]\n"
"#puts \"x11vnc_xdisplay: $x11vnc_xdisplay\"\n"
"\n"
"set env(X11VNC_STD_HELP) 1\n"
"\n"
"# scrape the help output for the text and remote control vars:\n"
"parse_help;\n"
"parse_remote_help;\n"
"parse_query_help;\n"
"\n"
"# tweaks to duplicate help text:\n"
"tweak_remote_help lock deny\n"
"tweak_remote_help unlock deny\n"
"\n"
"tweak_both quiet q\n"
"tweak_help logfile o\n"
"tweak_both xwarppointer xwarp\n"
"tweak_both screen_blank sb\n"
"\n"
"set_template\n"
"\n"
"set_name \"tkx11vnc\"\n"
"\n"
"key_bindings;\n"
"\n"
"get_default_vars\n"
"\n"
"dtime D\n"
"\n"
"proc check_setpasswd {} {\n"
" global env icon_setpasswd\n"
" global do_props_msg\n"
" set do_props_msg \"\"\n"
" if {$icon_setpasswd} {\n"
" set m \"\\n\"\n"
" set m \" Note the x11vnc icon in the system tray \\n\" \n"
" set m \"${m} This panel is its 'Properties' dialog.\\n\" \n"
" set m \"${m}\\n\" \n"
" set m \"${m} To specify a Session Password and to\\n\" \n"
" set m \"${m} allow VNC clients to connect, follow\\n\" \n"
" set m \"${m} these steps:\\n\" \n"
" set m \"${m}\\n\" \n"
" set m \"${m} Enter a passwd in the Password field\\n\" \n"
" set m \"${m} (it can be left blank.) You can also\\n\" \n"
" set m \"${m} supply a ViewOnly passwd if desired.\\n\" \n"
" set m \"${m}\\n\" \n"
" set m \"${m} Set 'Accept Connections' and then Press \\n\" \n"
" set m \"${m} 'Apply' to allow incoming connections.\\n\" \n"
" set m \"${m}\\n\" \n"
" set m \"${m} The passwords are only for this x11vnc\\n\" \n"
" set m \"${m} session and are not saved. Run x11vnc\\n\" \n"
" set m \"${m} manually for more control.\\n\" \n"
" set m \"${m}\\n\" \n"
" set m \"${m} See 'Help' for details on each option.\\n\" \n"
"\n"
" global x11vnc_cmdline\n"
"\n"
" set dossl 0\n"
" if {[info exists x11vnc_cmdline]} {\n"
" if [regexp -- {-ssl} $x11vnc_cmdline] {\n"
" set dossl 1\n"
" }\n"
" }\n"
" if {$dossl || [info exists env(X11VNC_GOT_SSL)]} {\n"
" set m \"${m}\\n\" \n"
" set m \"${m} SSL encryption mode active. You can\\n\" \n"
" set m \"${m} find your Public Cert in the Logfile\\n\" \n"
" set m \"${m} and also the ~/.vnc/certs directory.\\n\" \n"
" }\n"
"\n"
" if {[info exists env(X11VNC_SETPASS_FAIL)]} {\n"
" set pp 5900\n"
" if {[info exists env(X11VNC_GOT_RFBPORT_VAL)]} {\n"
" if {$env(X11VNC_GOT_RFBPORT_VAL) > 0} {\n"
" set pp $env(X11VNC_GOT_RFBPORT_VAL)\n"
" }\n"
" }\n"
" \n"
" set m \" The x11vnc program failed to start! \\n\"\n"
" set m \"${m}\\n\" \n"
" set m \"${m} Maybe there is another VNC server\\n\"\n"
" set m \"${m} already listening on port $pp?\\n\"\n"
" set m \"${m}\\n\" \n"
" set m \"${m} You will need to start over after\\n\"\n"
" set m \"${m} you make sure x11vnc can start.\\n\"\n"
" }\n"
" \n"
" set do_props_msg $m\n"
" do_props\n"
" }\n"
"}\n"
"\n"
"if {0} {\n"
" if {[info exists env(X11VNC_ICON_SETPASS)]} {\n"
" if {$env(X11VNC_ICON_SETPASS) == \"2\"} {\n"
" global icon_mode_at_startup icon_mode\n"
" set icon_mode_at_startup 1\n"
" set icon_mode 2\n"
" }\n"
" }\n"
"}\n"
"\n"
"if {$icon_mode} {\n"
" if {$icon_mode == 2} {\n"
" make_gui \"full\"\n"
" } elseif {$tray_embed} {\n"
" make_gui \"tray\"\n"
" } else {\n"
" make_gui \"icon\"\n"
" }\n"
" dtime G\n"
" old_balloon\n"
" check_setpasswd\n"
"} else {\n"
" make_gui \"full\"\n"
" dtime G\n"
" check_setpasswd\n"
"}\n"
"\n"
"\n"
"# main loop.\n"
#endif
/* ifdef NOGUI */
#endif
/* ifndef _TKX11VNC_H */
;
|