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
|
;;; -*- Mode: LISP; Syntax: Common-lisp; Package: XLIB; Base: 10; Lowercase: Yes -*-
;;; Copyright 1987, 1988 Massachusetts Institute of Technology, and
;;; Texas Instruments Incorporated
;;; Permission to use, copy, modify, and distribute this document for any purpose
;;; and without fee is hereby granted, provided that the above copyright notice
;;; appear in all copies and that both that copyright notice and this permission
;;; notice are retained, and that the name of M.I.T. not be used in advertising or
;;; publicity pertaining to this document without specific, written prior
;;; permission. M.I.T. makes no representations about the suitability of this
;;; document or the protocol defined in this document for any purpose. It is
;;; provided "as is" without express or implied warranty.
;;; Texas Instruments Incorporated provides this document "as is" without
;;; express or implied warranty.
;; Version 4
;; This is considered a somewhat changeable interface. Discussion of better
;; integration with CLOS, support for user-specified subclassess of basic
;; objects, and the additional functionality to match the C Xlib is still in
;; progress.
;; Primary Interface Author:
;; Robert W. Scheifler
;; MIT Laboratory for Computer Science
;; 545 Technology Square, Room 418
;; Cambridge, MA 02139
;; rws@zermatt.lcs.mit.edu
;; Design Contributors:
;; Dan Cerys, Texas Instruments
;; Scott Fahlman, CMU
;; Charles Hornig, Symbolics
;; John Irwin, Franz
;; Kerry Kimbrough, Texas Instruments
;; Chris Lindblad, MIT
;; Rob MacLachlan, CMU
;; Mike McMahon, Symbolics
;; David Moon, Symbolics
;; LaMott Oren, Texas Instruments
;; Daniel Weinreb, Symbolics
;; John Wroclawski, MIT
;; Richard Zippel, Symbolics
;; CLX Extensions
;; Adds some of the functionality provided by the C XLIB library.
;;
;; Primary Author
;; LaMott G. Oren
;; Texas Instruments
;;
;; Design Contributors:
;; Robert W. Scheifler, MIT
;; Note: all of the following is in the package XLIB.
(declaim (declaration arglist clx-values))
;; Note: if you have read the Version 11 protocol document or C Xlib manual, most of
;; the relationships should be fairly obvious. We have no intention of writing yet
;; another moby document for this interface.
(deftype card32 () '(unsigned-byte 32))
(deftype card29 () '(unsigned-byte 29))
(deftype int32 () '(signed-byte 32))
(deftype card16 () '(unsigned-byte 16))
(deftype int16 () '(signed-byte 16))
(deftype card8 () '(unsigned-byte 8))
(deftype int8 () '(signed-byte 8))
(deftype mask32 () 'card32)
(deftype mask16 () 'card16)
(deftype resource-id () 'card29)
;; Types employed: display, window, pixmap, cursor, font, gcontext, colormap, color.
;; These types are defined solely by a functional interface; we do not specify
;; whether they are implemented as structures or flavors or ... Although functions
;; below are written using DEFUN, this is not an implementation requirement (although
;; it is a requirement that they be functions as opposed to macros or special forms).
;; It is unclear whether with-slots in the Common Lisp Object System must work on
;; them.
;; Windows, pixmaps, cursors, fonts, gcontexts, and colormaps are all represented as
;; compound objects, rather than as integer resource-ids. This allows applications
;; to deal with multiple displays without having an explicit display argument in the
;; most common functions. Every function uses the display object indicated by the
;; first argument that is or contains a display; it is an error if arguments contain
;; different displays, and predictable results are not guaranteed.
;; Each of window, pixmap, drawable, cursor, font, gcontext, and colormap have the
;; following five functions:
(defun <mumble>-display (<mumble>)
(declare (type <mumble> <mumble>)
(clx-values display)))
(defun <mumble>-id (<mumble>)
(declare (type <mumble> <mumble>)
(clx-values resource-id)))
(defun <mumble>-equal (<mumble>-1 <mumble>-2)
(declare (type <mumble> <mumble>-1 <mumble>-2)))
(defun <mumble>-p (<mumble>)
(declare (type <mumble> <mumble>)
(clx-values boolean)))
;; The following functions are provided by color objects:
;; The intention is that IHS and YIQ and CYM interfaces will also exist. Note that
;; we are explicitly using a different spectrum representation than what is actually
;; transmitted in the protocol.
(deftype rgb-val () '(real 0 1))
(defun make-color (&key red green blue &allow-other-keys) ; for expansion
(declare (type rgb-val red green blue)
(clx-values color)))
(defun color-rgb (color)
(declare (type color color)
(clx-values red green blue)))
(defun color-red (color)
;; setf'able
(declare (type color color)
(clx-values rgb-val)))
(defun color-green (color)
;; setf'able
(declare (type color color)
(clx-values rgb-val)))
(defun color-blue (color)
;; setf'able
(declare (type color color)
(clx-values rgb-val)))
(deftype drawable () '(or window pixmap))
;; Atoms are accepted as strings or symbols, and are always returned as keywords.
;; Protocol-level integer atom ids are hidden, using a cache in the display object.
(deftype xatom () '(or string symbol))
(deftype stringable () '(or string symbol))
(deftype fontable () '(or stringable font))
;; Nil stands for CurrentTime.
(deftype timestamp () '(or null card32))
(deftype bit-gravity () '(member :forget :static :north-west :north :north-east
:west :center :east :south-west :south :south-east))
(deftype win-gravity () '(member :unmap :static :north-west :north :north-east
:west :center :east :south-west :south :south-east))
(deftype grab-status ()
'(member :success :already-grabbed :frozen :invalid-time :not-viewable))
(deftype boolean () '(or null (not null)))
(deftype pixel () '(unsigned-byte 32))
(deftype image-depth () '(integer 0 32))
(deftype keysym () 'card32)
(deftype array-index () `(integer 0 ,array-dimension-limit))
;; An association list.
(deftype alist (key-type-and-name datum-type-and-name) 'list)
(deftype clx-list (&optional element-type) 'list)
(deftype clx-sequence (&optional element-type) 'sequence)
;; A sequence, containing zero or more repetitions of the given elements,
;; with the elements expressed as (type name).
(deftype repeat-seq (&rest elts) 'sequence)
(deftype point-seq () '(repeat-seq (int16 x) (int16 y)))
(deftype seg-seq () '(repeat-seq (int16 x1) (int16 y1) (int16 x2) (int16 y2)))
(deftype rect-seq () '(repeat-seq (int16 x) (int16 y) (card16 width) (card16 height)))
;; Note that we are explicitly using a different angle representation than what
;; is actually transmitted in the protocol.
(deftype angle () '(real #.(* -2 pi) #.(* 2 pi)))
(deftype arc-seq () '(repeat-seq (int16 x) (int16 y) (card16 width) (card16 height)
(angle angle1) (angle angle2)))
(deftype event-mask-class ()
'(member :key-press :key-release :owner-grab-button :button-press :button-release
:enter-window :leave-window :pointer-motion :pointer-motion-hint
:button-1-motion :button-2-motion :button-3-motion :button-4-motion
:button-5-motion :button-motion :exposure :visibility-change
:structure-notify :resize-redirect :substructure-notify :substructure-redirect
:focus-change :property-change :colormap-change :keymap-state))
(deftype event-mask ()
'(or mask32 (clx-list event-mask-class)))
(deftype pointer-event-mask-class ()
'(member :button-press :button-release
:enter-window :leave-window :pointer-motion :pointer-motion-hint
:button-1-motion :button-2-motion :button-3-motion :button-4-motion
:button-5-motion :button-motion :keymap-state))
(deftype pointer-event-mask ()
'(or mask32 (clx-list pointer-event-mask-class)))
(deftype device-event-mask-class ()
'(member :key-press :key-release :button-press :button-release :pointer-motion
:button-1-motion :button-2-motion :button-3-motion :button-4-motion
:button-5-motion :button-motion))
(deftype device-event-mask ()
'(or mask32 (clx-list device-event-mask-class)))
(deftype modifier-key ()
'(member :shift :lock :control :mod-1 :mod-2 :mod-3 :mod-4 :mod-5))
(deftype modifier-mask ()
'(or (member :any) mask16 (clx-list modifier-key)))
(deftype state-mask-key ()
'(or modifier-key (member :button-1 :button-2 :button-3 :button-4 :button-5)))
(deftype gcontext-key ()
'(member :function :plane-mask :foreground :background
:line-width :line-style :cap-style :join-style :fill-style :fill-rule
:arc-mode :tile :stipple :ts-x :ts-y :font :subwindow-mode
:exposures :clip-x :clip-y :clip-mask :dash-offset :dashes))
(deftype event-key ()
'(member :key-press :key-release :button-press :button-release :motion-notify
:enter-notify :leave-notify :focus-in :focus-out :keymap-notify
:exposure :graphics-exposure :no-exposure :visibility-notify
:create-notify :destroy-notify :unmap-notify :map-notify :map-request
:reparent-notify :configure-notify :gravity-notify :resize-request
:configure-request :circulate-notify :circulate-request :property-notify
:selection-clear :selection-request :selection-notify
:colormap-notify :client-message))
(deftype error-key ()
'(member :access :alloc :atom :colormap :cursor :drawable :font :gcontext :id-choice
:illegal-request :implementation :length :match :name :pixmap :value :window))
(deftype draw-direction ()
'(member :left-to-right :right-to-left))
(defstruct bitmap-format
(unit <unspec> :type (member 8 16 32))
(pad <unspec> :type (member 8 16 32))
(lsb-first-p <unspec> :type boolean))
(defstruct pixmap-format
(depth <unspec> :type image-depth)
(bits-per-pixel <unspec> :type (member 1 4 8 16 24 32))
(pad <unspec> :type (member 8 16 32)))
(defstruct visual-info
(id <unspec> :type resource-id)
(display <unspec> :type display)
(class <unspec> :type (member :static-gray :static-color :true-color
:gray-scale :pseudo-color :direct-color))
(red-mask <unspec> :type pixel)
(green-mask <unspec> :type pixel)
(blue-mask <unspec> :type pixel)
(bits-per-rgb <unspec> :type card8)
(colormap-entries <unspec> :type card16))
(defstruct screen
(root <unspec> :type window)
(width <unspec> :type card16)
(height <unspec> :type card16)
(width-in-millimeters <unspec> :type card16)
(height-in-millimeters <unspec> :type card16)
(depths <unspec> :type (alist (image-depth depth) ((clx-list visual-info) visuals)))
(root-depth <unspec> :type image-depth)
(root-visual-info <unspec> :type visual-info)
(default-colormap <unspec> :type colormap)
(white-pixel <unspec> :type pixel)
(black-pixel <unspec> :type pixel)
(min-installed-maps <unspec> :type card16)
(max-installed-maps <unspec> :type card16)
(backing-stores <unspec> :type (member :never :when-mapped :always))
(save-unders-p <unspec> :type boolean)
(event-mask-at-open <unspec> :type mask32))
(defun screen-root-visual (screen)
(declare (type screen screen)
(clx-values resource-id)))
;; The list contains alternating keywords and integers.
(deftype font-props () 'list)
(defun open-display (host &key (display 0) protocol)
;; A string must be acceptable as a host, but otherwise the possible types for host
;; and protocol are not constrained, and will likely be very system dependent. The
;; default protocol is system specific. Authorization, if any, is assumed to come
;; from the environment somehow.
(declare (type integer display)
(clx-values display)))
(defun display-protocol-major-version (display)
(declare (type display display)
(clx-values card16)))
(defun display-protocol-minor-version (display)
(declare (type display display)
(clx-values card16)))
(defun display-vendor-name (display)
(declare (type display display)
(clx-values string)))
(defun display-release-number (display)
(declare (type display display)
(clx-values card32)))
(defun display-image-lsb-first-p (display)
(declare (type display display)
(clx-values boolean)))
(defun display-bitmap-formap (display)
(declare (type display display)
(clx-values bitmap-format)))
(defun display-pixmap-formats (display)
(declare (type display display)
(clx-values (clx-list pixmap-formats))))
(defun display-roots (display)
(declare (type display display)
(clx-values (clx-list screen))))
(defun display-motion-buffer-size (display)
(declare (type display display)
(clx-values card32)))
(defun display-max-request-length (display)
(declare (type display display)
(clx-values card16)))
(defun display-min-keycode (display)
(declare (type display display)
(clx-values card8)))
(defun display-max-keycode (display)
(declare (type display display)
(clx-values card8)))
(defun close-display (display)
(declare (type display display)))
(defun display-error-handler (display)
(declare (type display display)
(clx-values handler)))
(defsetf display-error-handler (display) (handler)
;; All errors (synchronous and asynchronous) are processed by calling an error
;; handler in the display. If handler is a sequence it is expected to contain
;; handler functions specific to each error; the error code is used to index the
;; sequence, fetching the appropriate handler. Any results returned by the handler
;; are ignored; it is assumed the handler either takes care of the error
;; completely, or else signals. For all core errors, the keyword/value argument
;; pairs are:
;; :major card8
;; :minor card16
;; :sequence card16
;; :current-sequence card16
;; :asynchronous (member t nil)
;; For :colormap, :cursor, :drawable, :font, :gcontext, :id-choice, :pixmap, and
;; :window errors another pair is:
;; :resource-id card32
;; For :atom errors, another pair is:
;; :atom-id card32
;; For :value errors, another pair is:
;; :value card32
(declare (type display display)
(type (or (clx-sequence (function (display symbol &key &allow-other-keys)))
(function (display symbol &key &allow-other-keys)))
handler)))
(defsetf display-report-asynchronous-errors (display) (when)
;; Most useful in multi-process lisps.
;;
;; Synchronous errors are always signalled in the process that made the
;; synchronous request. An error is considered synchronous if a process is
;; waiting for a reply with the same request-id as the error.
;;
;; Asynchronous errors can be signalled at any one of these three times:
;;
;; 1. As soon as they are read. They get signalled in whichever process
;; was doing the reading. This is enabled by
;; (setf (xlib:display-report-asynchronous-errors display)
;; '(:immediately))
;; This is the default.
;;
;; 2. Before any events are to be handled. You get these by doing an
;; event-listen with any timeout value other than 0, or in of the event
;; processing forms. This is useful if you using a background process to
;; handle input. This is enabled by
;; (setf (xlib:display-report-asynchronous-errors display)
;; '(:before-event-handling))
;;
;; 3. After a display-finish-output. You get these by doing a
;; display-finish-output. A cliche using this might have a with-display
;; wrapped around the display operations that possibly cause an asynchronous
;; error, with a display-finish-output right the end of the with-display to
;; catch any asynchronous errors. This is enabled by
;; (setf (xlib:display-report-asynchronous-errors display)
;; '(:after-finish-output))
;;
;; You can select any combination of the three keywords. For example, to
;; get errors reported before event handling and after finish-output,
;; (setf (xlib:display-report-asynchronous-errors display)
;; '(:before-event-handling :after-finish-output))
(declare (type list when))
)
(defmacro define-condition (name base &body items)
;; just a place-holder here for the real thing
)
(define-condition request-error error
display
major
minor
sequence
current-sequence
asynchronous)
(defun default-error-handler (display error-key &key &allow-other-keys)
;; The default display-error-handler.
;; It signals the conditions listed below.
(declare (type display display)
(type symbol error-key))
)
(define-condition resource-error request-error
resource-id)
(define-condition access-error request-error)
(define-condition alloc-error request-error)
(define-condition atom-error request-error
atom-id)
(define-condition colormap-error resource-error)
(define-condition cursor-error resource-error)
(define-condition drawable-error resource-error)
(define-condition font-error resource-error)
(define-condition gcontext-error resource-error)
(define-condition id-choice-error resource-error)
(define-condition illegal-request-error request-error)
(define-condition implementation-error request-error)
(define-condition length-error request-error)
(define-condition match-error request-error)
(define-condition name-error request-error)
(define-condition pixmap-error resource-error)
(define-condition value-error request-error
value)
(define-condition window-error resource-error)
(defmacro with-display ((display) &body body)
;; This macro is for use in a multi-process environment. It provides exclusive
;; access to the local display object for multiple request generation. It need not
;; provide immediate exclusive access for replies; that is, if another process is
;; waiting for a reply (while not in a with-display), then synchronization need not
;; (but can) occur immediately. Except where noted, all routines effectively
;; contain an implicit with-display where needed, so that correct synchronization
;; is always provided at the interface level on a per-call basis. Nested uses of
;; this macro will work correctly. This macro does not prevent concurrent event
;; processing; see with-event-queue.
)
(defun display-force-output (display)
;; Output is normally buffered; this forces any buffered output.
(declare (type display display)))
(defun display-finish-output (display)
;; Forces output, then causes a round-trip to ensure that all possible errors and
;; events have been received.
(declare (type display display)))
(defun display-after-function (display)
;; setf'able
;; If defined, called after every protocol request is generated, even those inside
;; explicit with-display's, but never called from inside the after-function itself.
;; The function is called inside the effective with-display for the associated
;; request. Default value is nil. Can be set, for example, to
;; #'display-force-output or #'display-finish-output.
(declare (type display display)
(clx-values (or null (function (display))))))
(defun create-window (&key parent x y width height (depth 0) (border-width 0)
(class :copy) (visual :copy)
background border gravity bit-gravity
backing-store backing-planes backing-pixel save-under
event-mask do-not-propagate-mask override-redirect
colormap cursor)
;; Display is obtained from parent. Only non-nil attributes are passed on in the
;; request: the function makes no assumptions about what the actual protocol
;; defaults are. Width and height are the inside size, excluding border.
(declare (type window parent)
(type int16 x y)
(type card16 width height depth border-width)
(type (member :copy :input-output :input-only) class)
(type (or (member :copy) visual-info) visual)
(type (or null (member :none :parent-relative) pixel pixmap) background)
(type (or null (member :copy) pixel pixmap) border)
(type (or null win-gravity) gravity)
(type (or null bit-gravity) bit-gravity)
(type (or null (member :not-useful :when-mapped :always) backing-store))
(type (or null pixel) backing-planes backing-pixel)
(type (or null event-mask) event-mask)
(type (or null device-event-mask) do-not-propagate-mask)
(type (or null (member :on :off)) save-under override-redirect)
(type (or null (member :copy) colormap) colormap)
(type (or null (member :none) cursor) cursor)
(clx-values window)))
(defun window-class (window)
(declare (type window window)
(clx-values (member :input-output :input-only))))
(defun window-visual-info (window)
(declare (type window window)
(clx-values visual-info)))
(defun window-visual (window)
(declare (type window window)
(clx-values resource-id)))
(defsetf window-background (window) (background)
(declare (type window window)
(type (or (member :none :parent-relative) pixel pixmap) background)))
(defsetf window-border (window) (border)
(declare (type window window)
(type (or (member :copy) pixel pixmap) border)))
(defun window-gravity (window)
;; setf'able
(declare (type window window)
(clx-values win-gravity)))
(defun window-bit-gravity (window)
;; setf'able
(declare (type window window)
(clx-values bit-gravity)))
(defun window-backing-store (window)
;; setf'able
(declare (type window window)
(clx-values (member :not-useful :when-mapped :always))))
(defun window-backing-planes (window)
;; setf'able
(declare (type window window)
(clx-values pixel)))
(defun window-backing-pixel (window)
;; setf'able
(declare (type window window)
(clx-values pixel)))
(defun window-save-under (window)
;; setf'able
(declare (type window window)
(clx-values (member :on :off))))
(defun window-event-mask (window)
;; setf'able
(declare (type window window)
(clx-values mask32)))
(defun window-do-not-propagate-mask (window)
;; setf'able
(declare (type window window)
(clx-values mask32)))
(defun window-override-redirect (window)
;; setf'able
(declare (type window window)
(clx-values (member :on :off))))
(defun window-colormap (window)
(declare (type window window)
(clx-values (or null colormap))))
(defsetf window-colormap (window) (colormap)
(declare (type window window)
(type (or (member :copy) colormap) colormap)))
(defsetf window-cursor (window) (cursor)
(declare (type window window)
(type (or (member :none) cursor) cursor)))
(defun window-colormap-installed-p (window)
(declare (type window window)
(clx-values boolean)))
(defun window-all-event-masks (window)
(declare (type window window)
(clx-values mask32)))
(defun window-map-state (window)
(declare (type window window)
(clx-values (member :unmapped :unviewable :viewable))))
(defsetf drawable-x (window) (x)
(declare (type window window)
(type int16 x)))
(defsetf drawable-y (window) (y)
(declare (type window window)
(type int16 y)))
(defsetf drawable-width (window) (width)
;; Inside width, excluding border.
(declare (type window window)
(type card16 width)))
(defsetf drawable-height (window) (height)
;; Inside height, excluding border.
(declare (type window window)
(type card16 height)))
(defsetf drawable-border-width (window) (border-width)
(declare (type window window)
(type card16 border-width)))
(defsetf window-priority (window &optional sibling) (mode)
;; A bit strange, but retains setf form.
(declare (type window window)
(type (or null window) sibling)
(type (member :above :below :top-if :bottom-if :opposite) mode)))
(defmacro with-state ((drawable) &body body)
;; Allows a consistent view to be obtained of data returned by GetWindowAttributes
;; and GetGeometry, and allows a coherent update using ChangeWindowAttributes and
;; ConfigureWindow. The body is not surrounded by a with-display. Within the
;; indefinite scope of the body, on a per-process basis in a multi-process
;; environment, the first call within an Accessor Group on the specified drawable
;; (the object, not just the variable) causes the complete results of the protocol
;; request to be retained, and returned in any subsequent accessor calls. Calls
;; within a Setf Group are delayed, and executed in a single request on exit from
;; the body. In addition, if a call on a function within an Accessor Group follows
;; a call on a function in the corresponding Setf Group, then all delayed setfs for
;; that group are executed, any retained accessor information for that group is
;; discarded, the corresponding protocol request is (re)issued, and the results are
;; (again) retained, and returned in any subsequent accessor calls.
;; Accessor Group A (for GetWindowAttributes):
;; window-visual-info, window-visual, window-class, window-gravity, window-bit-gravity,
;; window-backing-store, window-backing-planes, window-backing-pixel,
;; window-save-under, window-colormap, window-colormap-installed-p,
;; window-map-state, window-all-event-masks, window-event-mask,
;; window-do-not-propagate-mask, window-override-redirect
;; Setf Group A (for ChangeWindowAttributes):
;; window-gravity, window-bit-gravity, window-backing-store, window-backing-planes,
;; window-backing-pixel, window-save-under, window-event-mask,
;; window-do-not-propagate-mask, window-override-redirect, window-colormap,
;; window-cursor
;; Accessor Group G (for GetGeometry):
;; drawable-root, drawable-depth, drawable-x, drawable-y, drawable-width,
;; drawable-height, drawable-border-width
;; Setf Group G (for ConfigureWindow):
;; drawable-x, drawable-y, drawable-width, drawable-height, drawable-border-width,
;; window-priority
)
(defun destroy-window (window)
(declare (type window window)))
(defun destroy-subwindows (window)
(declare (type window window)))
(defun add-to-save-set (window)
(declare (type window window)))
(defun remove-from-save-set (window)
(declare (type window window)))
(defun reparent-window (window parent x y)
(declare (type window window parent)
(type int16 x y)))
(defun map-window (window)
(declare (type window window)))
(defun map-subwindows (window)
(declare (type window window)))
(defun unmap-window (window)
(declare (type window window)))
(defun unmap-subwindows (window)
(declare (type window window)))
(defun circulate-window-up (window)
(declare (type window window)))
(defun circulate-window-down (window)
(declare (type window window)))
(defun drawable-root (drawable)
(declare (type drawable drawable)
(clx-values window)))
(defun drawable-depth (drawable)
(declare (type drawable drawable)
(clx-values card8)))
(defun drawable-x (drawable)
(declare (type drawable drawable)
(clx-values int16)))
(defun drawable-y (drawable)
(declare (type drawable drawable)
(clx-values int16)))
(defun drawable-width (drawable)
;; For windows, inside width, excluding border.
(declare (type drawable drawable)
(clx-values card16)))
(defun drawable-height (drawable)
;; For windows, inside height, excluding border.
(declare (type drawable drawable)
(clx-values card16)))
(defun drawable-border-width (drawable)
(declare (type drawable drawable)
(clx-values card16)))
(defun query-tree (window &key (result-type 'list))
(declare (type window window)
(type type result-type)
(clx-values (clx-sequence window) parent root)))
(defun change-property (window property data type format
&key (mode :replace) (start 0) end transform)
;; Start and end affect sub-sequence extracted from data.
;; Transform is applied to each extracted element.
(declare (type window window)
(type xatom property type)
(type (member 8 16 32) format)
(type sequence data)
(type (member :replace :prepend :append) mode)
(type array-index start)
(type (or null array-index) end)
(type (or null (function (t) integer)) transform)))
(defun delete-property (window property)
(declare (type window window)
(type xatom property)))
(defun get-property (window property
&key type (start 0) end delete-p (result-type 'list) transform)
;; Transform is applied to each integer retrieved.
;; Nil is returned for type when the protocol returns None.
(declare (type window window)
(type xatom property)
(type (or null xatom) type)
(type array-index start)
(type (or null array-index) end)
(type boolean delete-p)
(type type result-type)
(type (or null (function (integer) t)) transform)
(clx-values data type format bytes-after)))
(defun rotate-properties (window properties &optional (delta 1))
;; Postive rotates left, negative rotates right (opposite of actual protocol request).
(declare (type window window)
(type (clx-sequence xatom) properties)
(type int16 delta)))
(defun list-properties (window &key (result-type 'list))
(declare (type window window)
(type type result-type)
(clx-values (clx-sequence keyword))))
;; Although atom-ids are not visible in the normal user interface, atom-ids might
;; appear in window properties and other user data, so conversion hooks are needed.
(defun intern-atom (display name)
(declare (type display display)
(type xatom name)
(clx-values resource-id)))
(defun find-atom (display name)
(declare (type display display)
(type xatom name)
(clx-values (or null resource-id))))
(defun atom-name (display atom-id)
(declare (type display display)
(type resource-id atom-id)
(clx-values keyword)))
(defun selection-owner (display selection)
(declare (type display display)
(type xatom selection)
(clx-values (or null window))))
(defsetf selection-owner (display selection &optional time) (owner)
;; A bit strange, but retains setf form.
(declare (type display display)
(type xatom selection)
(type (or null window) owner)
(type timestamp time)))
(defun convert-selection (selection type requestor &optional property time)
(declare (type xatom selection type)
(type window requestor)
(type (or null xatom) property)
(type timestamp time)))
(defun send-event (window event-key event-mask &rest args
&key propagate-p display &allow-other-keys)
;; Additional arguments depend on event-key, and are as specified further below
;; with declare-event, except that both resource-ids and resource objects are
;; accepted in the event components. The display argument is only required if the
;; window is :pointer-window or :input-focus. If an argument has synonyms, it is
;; only necessary to supply a value for one of them; it is an error to specify
;; different values for synonyms.
(declare (type (or window (member :pointer-window :input-focus)) window)
(type (or null event-key) event-key)
(type event-mask event-mask)
(type boolean propagate-p)
(type (or null display) display)))
(defun grab-pointer (window event-mask
&key owner-p sync-pointer-p sync-keyboard-p confine-to cursor time)
(declare (type window window)
(type pointer-event-mask event-mask)
(type boolean owner-p sync-pointer-p sync-keyboard-p)
(type (or null window) confine-to)
(type (or null cursor) cursor)
(type timestamp time)
(clx-values grab-status)))
(defun ungrab-pointer (display &key time)
(declare (type display display)
(type timestamp time)))
(defun grab-button (window button event-mask
&key (modifiers 0)
owner-p sync-pointer-p sync-keyboard-p confine-to cursor)
(declare (type window window)
(type (or (member :any) card8) button)
(type modifier-mask modifiers)
(type pointer-event-mask event-mask)
(type boolean owner-p sync-pointer-p sync-keyboard-p)
(type (or null window) confine-to)
(type (or null cursor) cursor)))
(defun ungrab-button (window button &key (modifiers 0))
(declare (type window window)
(type (or (member :any) card8) button)
(type modifier-mask modifiers)))
(defun change-active-pointer-grab (display event-mask &optional cursor time)
(declare (type display display)
(type pointer-event-mask event-mask)
(type (or null cursor) cursor)
(type timestamp time)))
(defun grab-keyboard (window &key owner-p sync-pointer-p sync-keyboard-p time)
(declare (type window window)
(type boolean owner-p sync-pointer-p sync-keyboard-p)
(type timestamp time)
(clx-values grab-status)))
(defun ungrab-keyboard (display &key time)
(declare (type display display)
(type timestamp time)))
(defun grab-key (window key &key (modifiers 0) owner-p sync-pointer-p sync-keyboard-p)
(declare (type window window)
(type boolean owner-p sync-pointer-p sync-keyboard-p)
(type (or (member :any) card8) key)
(type modifier-mask modifiers)))
(defun ungrab-key (window key &key (modifiers 0))
(declare (type window window)
(type (or (member :any) card8) key)
(type modifier-mask modifiers)))
(defun allow-events (display mode &optional time)
(declare (type display display)
(type (member :async-pointer :sync-pointer :reply-pointer
:async-keyboard :sync-keyboard :replay-keyboard
:async-both :sync-both)
mode)
(type timestamp time)))
(defun grab-server (display)
(declare (type display display)))
(defun ungrab-server (display)
(declare (type display display)))
(defmacro with-server-grabbed ((display) &body body)
;; The body is not surrounded by a with-display.
)
(defun query-pointer (window)
(declare (type window window)
(clx-values x y same-screen-p child mask root-x root-y root)))
(defun pointer-position (window)
(declare (type window window)
(clx-values x y same-screen-p)))
(defun global-pointer-position (display)
(declare (type display display)
(clx-values root-x root-y root)))
(defun motion-events (window &key start stop (result-type 'list))
(declare (type window window)
(type timestamp start stop)
(type type result-type)
(clx-values (repeat-seq (int16 x) (int16 y) (timestamp time)))))
(defun translate-coordinates (src src-x src-y dst)
;; If src and dst are not on the same screen, nil is returned.
(declare (type window src)
(type int16 src-x src-y)
(type window dst)
(clx-values dst-x dst-y child)))
(defun warp-pointer (dst dst-x dst-y)
(declare (type window dst)
(type int16 dst-x dst-y)))
(defun warp-pointer-relative (display x-off y-off)
(declare (type display display)
(type int16 x-off y-off)))
(defun warp-pointer-if-inside (dst dst-x dst-y src src-x src-y
&optional src-width src-height)
;; Passing in a zero src-width or src-height is a no-op. A null src-width or
;; src-height translates into a zero value in the protocol request.
(declare (type window dst src)
(type int16 dst-x dst-y src-x src-y)
(type (or null card16) src-width src-height)))
(defun warp-pointer-relative-if-inside (x-off y-off src src-x src-y
&optional src-width src-height)
;; Passing in a zero src-width or src-height is a no-op. A null src-width or
;; src-height translates into a zero value in the protocol request.
(declare (type window src)
(type int16 x-off y-off src-x src-y)
(type (or null card16) src-width src-height)))
(defun set-input-focus (display focus revert-to &optional time)
;; Setf ought to allow multiple values.
(declare (type display display)
(type (or (member :none :pointer-root) window) focus)
(type (member :none :parent :pointer-root) revert-to)
(type timestamp time)))
(defun input-focus (display)
(declare (type display display)
(clx-values focus revert-to)))
(defun query-keymap (display)
(declare (type display display)
(clx-values (bit-vector 256))))
(defun open-font (display name)
;; Font objects may be cached and reference counted locally within the display
;; object. This function might not execute a with-display if the font is cached.
;; The protocol QueryFont request happens on-demand under the covers.
(declare (type display display)
(type stringable name)
(clx-values font)))
;; We probably want a per-font bit to indicate whether caching on
;; text-extents/width calls is desirable. But what to name it?
(defun discard-font-info (font)
;; Discards any state that can be re-obtained with QueryFont. This is simply
;; a performance hint for memory-limited systems.
(declare (type font font)))
;; This can be signalled anywhere a pseudo font access fails.
(define-condition invalid-font error
font)
;; Note: font-font-info removed.
(defun font-name (font)
;; Returns nil for a pseudo font returned by gcontext-font.
(declare (type font font)
(clx-values (or null string))))
(defun font-direction (font)
(declare (type font font)
(clx-values draw-direction)))
(defun font-min-char (font)
(declare (type font font)
(clx-values card16)))
(defun font-max-char (font)
(declare (type font font)
(clx-values card16)))
(defun font-min-byte1 (font)
(declare (type font font)
(clx-values card8)))
(defun font-max-byte1 (font)
(declare (type font font)
(clx-values card8)))
(defun font-min-byte2 (font)
(declare (type font font)
(clx-values card8)))
(defun font-max-byte2 (font)
(declare (type font font)
(clx-values card8)))
(defun font-all-chars-exist-p (font)
(declare (type font font)
(clx-values boolean)))
(defun font-default-char (font)
(declare (type font font)
(clx-values card16)))
(defun font-ascent (font)
(declare (type font font)
(clx-values int16)))
(defun font-descent (font)
(declare (type font font)
(clx-values int16)))
;; The list contains alternating keywords and int32s.
(deftype font-props () 'list)
(defun font-properties (font)
(declare (type font font)
(clx-values font-props)))
(defun font-property (font name)
(declare (type font font)
(type keyword name)
(clx-values (or null int32))))
;; For each of left-bearing, right-bearing, width, ascent, descent, attributes:
(defun char-<metric> (font index)
;; Note: I have tentatively chosen to return nil for an out-of-bounds index
;; (or an in-bounds index on a pseudo font), although returning zero or
;; signalling might be better.
(declare (type font font)
(type card16 index)
(clx-values (or null int16))))
(defun max-char-<metric> (font)
;; Note: I have tentatively chosen separate accessors over allowing :min and
;; :max as an index above.
(declare (type font font)
(clx-values int16)))
(defun min-char-<metric> (font)
(declare (type font font)
(clx-values int16)))
;; Note: char16-<metric> accessors could be defined to accept two-byte indexes.
(defun close-font (font)
;; This might not generate a protocol request if the font is reference
;; counted locally or if it is a pseudo font.
(declare (type font font)))
(defun list-font-names (display pattern &key (max-fonts 65535) (result-type 'list))
(declare (type display display)
(type string pattern)
(type card16 max-fonts)
(type type result-type)
(clx-values (clx-sequence string))))
(defun list-fonts (display pattern &key (max-fonts 65535) (result-type 'list))
;; Returns "pseudo" fonts that contain basic font metrics and properties, but
;; no per-character metrics and no resource-ids. These pseudo fonts will be
;; converted (internally) to real fonts dynamically as needed, by issuing an
;; OpenFont request. However, the OpenFont might fail, in which case the
;; invalid-font error can arise.
(declare (type display display)
(type string pattern)
(type card16 max-fonts)
(type type result-type)
(clx-values (clx-sequence font))))
(defun font-path (display &key (result-type 'list))
(declare (type display display)
(type type result-type)
(clx-values (clx-sequence (or string pathname)))))
(defsetf font-path (display) (paths)
(declare (type display display)
(type (clx-sequence (or string pathname)) paths)))
(defun create-pixmap (&key width height depth drawable)
(declare (type card16 width height)
(type card8 depth)
(type drawable drawable)
(clx-values pixmap)))
(defun free-pixmap (pixmap)
(declare (type pixmap pixmap)))
(defun create-gcontext (&key drawable function plane-mask foreground background
line-width line-style cap-style join-style fill-style fill-rule
arc-mode tile stipple ts-x ts-y font subwindow-mode
exposures clip-x clip-y clip-mask clip-ordering
dash-offset dashes
(cache-p t))
;; Only non-nil components are passed on in the request, but for effective caching
;; assumptions have to be made about what the actual protocol defaults are. For
;; all gcontext components, a value of nil causes the default gcontext value to be
;; used. For clip-mask, this implies that an empty rect-seq cannot be represented
;; as a list. Note: use of stringable as font will cause an implicit open-font.
;; Note: papers over protocol SetClipRectangles and SetDashes special cases. If
;; cache-p is true, then gcontext state is cached locally, and changing a gcontext
;; component will have no effect unless the new value differs from the cached
;; value. Component changes (setfs and with-gcontext) are always deferred
;; regardless of the cache mode, and sent over the protocol only when required by a
;; local operation or by an explicit call to force-gcontext-changes.
(declare (type drawable drawable)
(type (or null boole-constant) function)
(type (or null pixel) plane-mask foreground background)
(type (or null card16) line-width dash-offset)
(type (or null int16) ts-x ts-y clip-x clip-y)
(type (or null (member :solid :dash :double-dash)) line-style)
(type (or null (member :not-last :butt :round :projecting)) cap-style)
(type (or null (member :miter :round :bevel)) join-style)
(type (or null (member :solid :tiled :opaque-stippled :stippled)) fill-style)
(type (or null (member :even-odd :winding)) fill-rule)
(type (or null (member :chord :pie-slice)) arc-mode)
(type (or null pixmap) tile stipple)
(type (or null fontable) font)
(type (or null (member :clip-by-children :include-inferiors)) subwindow-mode)
(type (or null (member :on :off)) exposures)
(type (or null (member :none) pixmap rect-seq) clip-mask)
(type (or null (member :unsorted :y-sorted :yx-sorted :yx-banded)) clip-ordering)
(type (or null (or card8 (clx-sequence card8))) dashes)
(type boolean cache)
(clx-values gcontext)))
;; For each argument to create-gcontext (except font, clip-mask and
;; clip-ordering) declared as (type <type> <name>), there is an accessor:
(defun gcontext-<name> (gcontext)
;; The value will be nil if the last value stored is unknown (e.g., the cache was
;; off, or the component was copied from a gcontext with unknown state).
(declare (type gcontext gcontext)
(clx-values <type>)))
;; For each argument to create-gcontext (except clip-mask and clip-ordering) declared
;; as (type (or null <type>) <name>), there is a setf for the corresponding accessor:
(defsetf gcontext-<name> (gcontext) (value)
(declare (type gcontext gcontext)
(type <type> value)))
(defun gcontext-font (gcontext &optional metrics-p)
;; If the stored font is known, it is returned. If it is not known and
;; metrics-p is false, then nil is returned. If it is not known and
;; metrics-p is true, then a pseudo font is returned. Full metric and
;; property information can be obtained, but the font does not have a name or
;; a resource-id, and attempts to use it where a resource-id is required will
;; result in an invalid-font error.
(declare (type gcontext gcontext)
(type boolean metrics-p)
(clx-values (or null font))))
(defun gcontext-clip-mask (gcontext)
(declare (type gcontext gcontext)
(clx-values (or null (member :none) pixmap rect-seq)
(or null (member :unsorted :y-sorted :yx-sorted :yx-banded)))))
(defsetf gcontext-clip-mask (gcontext &optional ordering) (clip-mask)
;; Is nil illegal here, or is it transformed to a vector?
;; A bit strange, but retains setf form.
(declare (type gcontext gcontext)
(type (or null (member :unsorted :y-sorted :yx-sorted :yx-banded)) clip-ordering)
(type (or (member :none) pixmap rect-seq) clip-mask)))
(defun force-gcontext-changes (gcontext)
;; Force any delayed changes.
(declare (type gcontext gcontext)))
(defmacro with-gcontext ((gcontext &key
function plane-mask foreground background
line-width line-style cap-style join-style fill-style fill-rule
arc-mode tile stipple ts-x ts-y font subwindow-mode
exposures clip-x clip-y clip-mask clip-ordering
dashes dash-offset)
&body body)
;; Changes gcontext components within the dynamic scope of the body (i.e.,
;; indefinite scope and dynamic extent), on a per-process basis in a multi-process
;; environment. The values are all evaluated before bindings are performed. The
;; body is not surrounded by a with-display. If cache-p is nil or the some
;; component states are unknown, this will implement save/restore by creating a
;; temporary gcontext and doing gcontext-components to and from it.
)
(defun copy-gcontext-components (src dst &rest keys)
(declare (type gcontext src dst)
(type (clx-list gcontext-key) keys)))
(defun copy-gcontext (src dst)
(declare (type gcontext src dst))
;; Copies all components.
)
(defun free-gcontext (gcontext)
(declare (type gcontext gcontext)))
(defun clear-area (window &key (x 0) (y 0) width height exposures-p)
;; Passing in a zero width or height is a no-op. A null width or height translates
;; into a zero value in the protocol request.
(declare (type window window)
(type int16 x y)
(type (or null card16) width height)
(type boolean exposures-p)))
(defun copy-area (src gcontext src-x src-y width height dst dst-x dst-y)
(declare (type drawable src dst)
(type gcontext gcontext)
(type int16 src-x src-y dst-x dst-y)
(type card16 width height)))
(defun copy-plane (src gcontext plane src-x src-y width height dst dst-x dst-y)
(declare (type drawable src dst)
(type gcontext gcontext)
(type pixel plane)
(type int16 src-x src-y dst-x dst-y)
(type card16 width height)))
(defun draw-point (drawable gcontext x y)
;; Should be clever about appending to existing buffered protocol request, provided
;; gcontext has not been modified.
(declare (type drawable drawable)
(type gcontext gcontext)
(type int16 x y)))
(defun draw-points (drawable gcontext points &optional relative-p)
(declare (type drawable drawable)
(type gcontext gcontext)
(type point-seq points)
(type boolean relative-p)))
(defun draw-line (drawable gcontext x1 y1 x2 y2 &optional relative-p)
;; Should be clever about appending to existing buffered protocol request, provided
;; gcontext has not been modified.
(declare (type drawable drawable)
(type gcontext gcontext)
(type int16 x1 y1 x2 y2)
(type boolean relative-p)))
(defun draw-lines (drawable gcontext points &key relative-p fill-p (shape :complex))
(declare (type drawable drawable)
(type gcontext gcontext)
(type point-seq points)
(type boolean relative-p fill-p)
(type (member :complex :non-convex :convex) shape)))
(defun draw-segments (drawable gcontext segments)
(declare (type drawable drawable)
(type gcontext gcontext)
(type seg-seq segments)))
(defun draw-rectangle (drawable gcontext x y width height &optional fill-p)
;; Should be clever about appending to existing buffered protocol request, provided
;; gcontext has not been modified.
(declare (type drawable drawable)
(type gcontext gcontext)
(type int16 x y)
(type card16 width height)
(type boolean fill-p)))
(defun draw-rectangles (drawable gcontext rectangles &optional fill-p)
(declare (type drawable drawable)
(type gcontext gcontext)
(type rect-seq rectangles)
(type boolean fill-p)))
(defun draw-arc (drawable gcontext x y width height angle1 angle2 &optional fill-p)
;; Should be clever about appending to existing buffered protocol request, provided
;; gcontext has not been modified.
(declare (type drawable drawable)
(type gcontext gcontext)
(type int16 x y)
(type card16 width height)
(type angle angle1 angle2)
(type boolean fill-p)))
(defun draw-arcs (drawable gcontext arcs &optional fill-p)
(declare (type drawable drawable)
(type gcontext gcontext)
(type arc-seq arcs)
(type boolean fill-p)))
;; The following image routines are bare minimum. It may be useful to define some
;; form of "image" object to hide representation details and format conversions. It
;; also may be useful to provide stream-oriented interfaces for reading and writing
;; the data.
(defun put-raw-image (drawable gcontext data
&key (start 0) depth x y width height (left-pad 0) format)
;; Data must be a sequence of 8-bit quantities, already in the appropriate format
;; for transmission; the caller is responsible for all byte and bit swapping and
;; compaction. Start is the starting index in data; the end is computed from the
;; other arguments.
(declare (type drawable drawable)
(type gcontext gcontext)
(type (clx-sequence card8) data)
(type array-index start)
(type card8 depth left-pad)
(type int16 x y)
(type card16 width height)
(type (member :bitmap :xy-pixmap :z-pixmap) format)))
(defun get-raw-image (drawable &key data (start 0) x y width height
(plane-mask 0xffffffff) format
(result-type '(vector (unsigned-byte 8))))
;; If data is given, it is modified in place (and returned), otherwise a new
;; sequence is created and returned, with a size computed from the other arguments
;; and the returned depth. The sequence is filled with 8-bit quantities, in
;; transmission format; the caller is responsible for any byte and bit swapping and
;; compaction required for further local use.
(declare (type drawable drawable)
(type (or null (clx-sequence card8)) data)
(type array-index start)
(type int16 x y)
(type card16 width height)
(type pixel plane-mask)
(type (member :xy-pixmap :z-pixmap) format)
(clx-values (clx-sequence card8) depth visual-info)))
(defun translate-default (src src-start src-end font dst dst-start)
;; dst is guaranteed to have room for (- src-end src-start) integer elements,
;; starting at dst-start; whether dst holds 8-bit or 16-bit elements depends
;; on context. font is the current font, if known. The function should
;; translate as many elements of src as possible into indexes in the current
;; font, and store them into dst. The first return value should be the src
;; index of the first untranslated element. If no further elements need to
;; be translated, the second return value should be nil. If a horizontal
;; motion is required before further translation, the second return value
;; should be the delta in x coordinate. If a font change is required for
;; further translation, the second return value should be the new font. If
;; known, the pixel width of the translated text can be returned as the third
;; value; this can allow for appending of subsequent output to the same
;; protocol request, if no overall width has been specified at the higher
;; level.
(declare (type sequence src)
(type array-index src-start src-end dst-start)
(type (or null font) font)
(type vector dst)
(clx-values array-index (or null int16 font) (or null int32))))
;; There is a question below of whether translate should always be required, or
;; if not, what the default should be or where it should come from. For
;; example, the default could be something that expected a string as src and
;; translated the CL standard character set to ASCII indexes, and ignored fonts
;; and bits. Or the default could expect a string but otherwise be "system
;; dependent". Or the default could be something that expected a vector of
;; integers and did no translation. Or the default could come from the
;; gcontext (but what about text-extents and text-width?).
(defun text-extents (font sequence &key (start 0) end translate)
;; If multiple fonts are involved, font-ascent and font-descent will be the
;; maximums. If multiple directions are involved, the direction will be nil.
;; Translate will always be called with a 16-bit dst buffer.
(declare (type sequence sequence)
(type (or font gcontext) font)
(type translate translate)
(clx-values width ascent descent left right font-ascent font-descent direction
(or null array-index))))
(defun text-width (font sequence &key (start 0) end translate)
;; Translate will always be called with a 16-bit dst buffer.
(declare (type sequence sequence)
(type (or font gcontext) font)
(type translate translate)
(clx-values int32 (or null array-index))))
;; This controls the element size of the dst buffer given to translate. If
;; :default is specified, the size will be based on the current font, if known,
;; and otherwise 16 will be used. [An alternative would be to pass the buffer
;; size to translate, and allow it to return the desired size if it doesn't
;; like the current size. The problem is that the protocol doesn't allow
;; switching within a single request, so to allow switching would require
;; knowing the width of text, which isn't necessarily known. We could call
;; text-width to compute it, but perhaps that is doing too many favors?] [An
;; additional possibility is to allow an index-size of :two-byte, in which case
;; translate would be given a double-length 8-bit array, and translate would be
;; expected to store first-byte/second-byte instead of 16-bit integers.]
(deftype index-size () '(member :default 8 16))
;; In the glyph functions below, if width is specified, it is assumed to be the
;; total pixel width of whatever string of glyphs is actually drawn.
;; Specifying width will allow for appending the output of subsequent calls to
;; the same protocol request, provided gcontext has not been modified in the
;; interim. If width is not specified, appending of subsequent output might
;; not occur (unless translate returns the width). Specifying width is simply
;; a hint, for performance.
(defun draw-glyph (drawable gcontext x y elt
&key translate width (size :default))
;; Returns true if elt is output, nil if translate refuses to output it.
;; Second result is width, if known.
(declare (type drawable drawable)
(type gcontext gcontext)
(type int16 x y)
(type translate translate)
(type (or null int32) width)
(type index-size size)
(clx-values boolean (or null int32))))
(defun draw-glyphs (drawable gcontext x y sequence
&key (start 0) end translate width (size :default))
;; First result is new start, if end was not reached. Second result is
;; overall width, if known.
(declare (type drawable drawable)
(type gcontext gcontext)
(type int16 x y)
(type sequence sequence)
(type array-index start)
(type (or null array-index) end)
(type (or null int32) width)
(type translate translate)
(type index-size size)
(clx-values (or null array-index) (or null int32))))
(defun draw-image-glyph (drawable gcontext x y elt
&key translate width (size :default))
;; Returns true if elt is output, nil if translate refuses to output it.
;; Second result is overall width, if known. An initial font change is
;; allowed from translate.
(declare (type drawable drawable)
(type gcontext gcontext)
(type int16 x y)
(type translate translate)
(type (or null int32) width)
(type index-size size)
(clx-values boolean (or null int32))))
(defun draw-image-glyphs (drawable gcontext x y sequence
&key (start 0) end width translate (size :default))
;; An initial font change is allowed from translate, but any subsequent font
;; change or horizontal motion will cause termination (because the protocol
;; doesn't support chaining). [Alternatively, font changes could be accepted
;; as long as they are accompanied with a width return value, or always
;; accept font changes and call text-width as required. However, horizontal
;; motion can't really be accepted, due to semantics.] First result is new
;; start, if end was not reached. Second result is overall width, if known.
(declare (type drawable drawable)
(type gcontext gcontext)
(type int16 x y)
(type sequence sequence)
(type array-index start)
(type (or null array-index) end)
(type (or null int32) width)
(type translate translate)
(type index-size size)
(clx-values (or null array-index) (or null int32))))
(defun create-colormap (visual window &optional alloc-p)
(declare (type visual-info visual)
(type window window)
(type boolean alloc-p)
(clx-values colormap)))
(defun free-colormap (colormap)
(declare (type colormap colormap)))
(defun copy-colormap-and-free (colormap)
(declare (type colormap colormap)
(clx-values colormap)))
(defun install-colormap (colormap)
(declare (type colormap colormap)))
(defun uninstall-colormap (colormap)
(declare (type colormap colormap)))
(defun installed-colormaps (window &key (result-type 'list))
(declare (type window window)
(type type result-type)
(clx-values (clx-sequence colormap))))
(defun alloc-color (colormap color)
(declare (type colormap colormap)
(type (or stringable color) color)
(clx-values pixel screen-color exact-color)))
(defun alloc-color-cells (colormap colors &key (planes 0) contiguous-p (result-type 'list))
(declare (type colormap colormap)
(type card16 colors planes)
(type boolean contiguous-p)
(type type result-type)
(clx-values (clx-sequence pixel) (clx-sequence mask))))
(defun alloc-color-planes (colormap colors
&key (reds 0) (greens 0) (blues 0)
contiguous-p (result-type 'list))
(declare (type colormap colormap)
(type card16 colors reds greens blues)
(type boolean contiguous-p)
(type type result-type)
(clx-values (clx-sequence pixel) red-mask green-mask blue-mask)))
(defun free-colors (colormap pixels &optional (plane-mask 0))
(declare (type colormap colormap)
(type (clx-sequence pixel) pixels)
(type pixel plane-mask)))
(defun store-color (colormap pixel spec &key (red-p t) (green-p t) (blue-p t))
(declare (type colormap colormap)
(type pixel pixel)
(type (or stringable color) spec)
(type boolean red-p green-p blue-p)))
(defun store-colors (colormap specs &key (red-p t) (green-p t) (blue-p t))
;; If stringables are specified for colors, it is unspecified whether all
;; stringables are first resolved and then a single StoreColors protocol request is
;; issued, or whether multiple StoreColors protocol requests are issued.
(declare (type colormap colormap)
(type (repeat-seq (pixel pixel) ((or stringable color) color)) specs)
(type boolean red-p green-p blue-p)))
(defun query-colors (colormap pixels &key (result-type 'list))
(declare (type colormap colormap)
(type (clx-sequence pixel) pixels)
(type type result-type)
(clx-values (clx-sequence color))))
(defun lookup-color (colormap name)
(declare (type colormap colormap)
(type stringable name)
(clx-values screen-color true-color)))
(defun create-cursor (&key source mask x y foreground background)
(declare (type pixmap source)
(type (or null pixmap) mask)
(type card16 x y)
(type color foreground background)
(clx-values cursor)))
(defun create-glyph-cursor (&key source-font source-char mask-font mask-char
foreground background)
(declare (type font source-font)
(type card16 source-char)
(type (or null font) mask-font)
(type (or null card16) mask-char)
(type color foreground background)
(clx-values cursor)))
(defun free-cursor (cursor)
(declare (type cursor cursor)))
(defun recolor-cursor (cursor foreground background)
(declare (type cursor cursor)
(type color foreground background)))
(defun query-best-cursor (width height drawable)
(declare (type card16 width height)
(type drawable display)
(clx-values width height)))
(defun query-best-tile (width height drawable)
(declare (type card16 width height)
(type drawable drawable)
(clx-values width height)))
(defun query-best-stipple (width height drawable)
(declare (type card16 width height)
(type drawable drawable)
(clx-values width height)))
(defun query-extension (display name)
(declare (type display display)
(type stringable name)
(clx-values major-opcode first-event first-error)))
(defun list-extensions (display &key (result-type 'list))
(declare (type display display)
(type type result-type)
(clx-values (clx-sequence string))))
;; Should pointer-mapping setf be changed to set-pointer-mapping?
(defun set-modifier-mapping (display &key shift lock control mod1 mod2 mod3 mod4 mod5)
;; Can signal device-busy.
;; Setf ought to allow multiple values.
;; Returns true for success, nil for failure
(declare (type display display)
(type (clx-sequence card8) shift lock control mod1 mod2 mod3 mod4 mod5)
(clx-values (member :success :busy :failed))))
(defun modifier-mapping (display)
;; each value is a list of card8s
(declare (type display display)
(clx-values shift lock control mod1 mod2 mod3 mod4 mod5)))
;; Either we will want lots of defconstants for well-known values, or perhaps
;; an integer-to-keyword translation function for well-known values.
(defun change-keyboard-mapping (display keysyms
&key (start 0) end (first-keycode start))
;; start/end give subrange of keysyms
;; first-keycode is the first-keycode to store at
(declare (type display display)
(type (array * (* *)) keysyms)
(type array-index start)
(type (or null array-index) end)
(type card8 first-keycode)))
(defun keyboard-mapping (display &key first-keycode start end data)
;; First-keycode specifies which keycode to start at (defaults to
;; min-keycode). Start specifies where (in result) to put first-keycode
;; (defaults to first-keycode). (- end start) is the number of keycodes to
;; get (end defaults to (1+ max-keycode)). If data is specified, the results
;; are put there.
(declare (type display display)
(type (or null card8) first-keycode)
(type (or null array-index) start end)
(type (or null (array * (* *))) data)
(clx-values (array * (* *)))))
(defun change-keyboard-control (display &key key-click-percent
bell-percent bell-pitch bell-duration
led led-mode key auto-repeat-mode)
(declare (type display display)
(type (or null (member :default) int16) key-click-percent
bell-percent bell-pitch bell-duration)
(type (or null card8) led key)
(type (or null (member :on :off)) led-mode)
(type (or null (member :on :off :default)) auto-repeat-mode)))
(defun keyboard-control (display)
(declare (type display display)
(clx-values key-click-percent bell-percent bell-pitch bell-duration
led-mask global-auto-repeat auto-repeats)))
(defun bell (display &optional (percent-from-normal 0))
;; It is assumed that an eventual audio extension to X will provide more complete
;; control.
(declare (type display display)
(type int8 percent-from-normal)))
(defun pointer-mapping (display &key (result-type 'list))
(declare (type display display)
(type type result-type)
(clx-values (clx-sequence card8))))
(defsetf pointer-mapping (display) (map)
;; Can signal device-busy.
(declare (type display display)
(type (clx-sequence card8) map)))
(defun change-pointer-control (display &key acceleration threshold)
;; Acceleration is rationalized if necessary.
(declare (type display display)
(type (or null (member :default) number) acceleration)
(type (or null (member :default) integer) threshold)))
(defun pointer-control (display)
(declare (type display display)
(clx-values acceleration threshold)))
(defun set-screen-saver (display timeout interval blanking exposures)
;; Setf ought to allow multiple values.
;; Timeout and interval are in seconds, will be rounded to minutes.
(declare (type display display)
(type (or (member :default) int16) timeout interval)
(type (member :on :off :default) blanking exposures)))
(defun screen-saver (display)
;; Returns timeout and interval in seconds.
(declare (type display display)
(clx-values timeout interval blanking exposures)))
(defun activate-screen-saver (display)
(declare (type display display)))
(defun reset-screen-saver (display)
(declare (type display display)))
(defun add-access-host (display host)
;; A string must be acceptable as a host, but otherwise the possible types for host
;; are not constrained, and will likely be very system dependent.
(declare (type display display)))
(defun remove-access-host (display host)
;; A string must be acceptable as a host, but otherwise the possible types for host
;; are not constrained, and will likely be very system dependent.
(declare (type display display)))
(defun access-hosts (display &key (result-type 'list))
;; The type of host objects returned is not constrained, except that the hosts must
;; be acceptable to add-access-host and remove-access-host.
(declare (type display display)
(type type result-type)
(clx-values (clx-sequence host) enabled-p)))
(defun access-control (display)
;; setf'able
(declare (type display display)
(clx-values boolean)))
(defun close-down-mode (display)
;; setf'able
;; Cached locally in display object.
(declare (type display display)
(clx-values (member :destroy :retain-permanent :retain-temporary))))
(defun kill-client (display resource-id)
(declare (type display display)
(type resource-id resource-id)))
(defun kill-temporary-clients (display)
(declare (type display display)))
(defun make-event-mask (&rest keys)
;; This is only defined for core events.
;; Useful for constructing event-mask, pointer-event-mask, device-event-mask.
(declare (type (clx-list event-mask-class) keys)
(clx-values mask32)))
(defun make-event-keys (event-mask)
;; This is only defined for core events.
(declare (type mask32 event-mask)
(clx-values (clx-list event-mask-class))))
(defun make-state-mask (&rest keys)
;; Useful for constructing modifier-mask, state-mask.
(declare (type (clx-list state-mask-key) keys)
(clx-values mask16)))
(defun make-state-keys (state-mask)
(declare (type mask16 mask)
(clx-values (clx-list state-mask-key))))
(defmacro with-event-queue ((display) &body body)
;; Grants exclusive access to event queue.
)
(defun event-listen (display &optional (timeout 0))
(declare (type display display)
(type (or null number) timeout)
(clx-values (or null number) (or null (member :timeout) (not null))))
;; Returns the number of events queued locally, if any, else nil. Hangs
;; waiting for events, forever if timeout is nil, else for the specified
;; number of seconds. The second value returned is :timeout if the
;; operation timed out, and some other non-nil value if an EOF has been
;; detected.
)
(defun process-event (display &key handler timeout peek-p discard-p (force-output-p t))
;; If force-output-p is true, first invokes display-force-output. Invokes
;; handler on each queued event until handler returns non-nil, and that
;; returned object is then returned by process-event. If peek-p is true,
;; then the event is not removed from the queue. If discard-p is true, then
;; events for which handler returns nil are removed from the queue,
;; otherwise they are left in place. Hangs until non-nil is generated for
;; some event, or for the specified timeout (in seconds, if given); however,
;; it is acceptable for an implementation to wait only once on network data,
;; and therefore timeout prematurely. Returns nil on timeout or EOF, with a
;; second return value being :timeout for a timeout and some other non-nil
;; value for EOF. If handler is a sequence, it is expected to contain
;; handler functions specific to each event class; the event code is used to
;; index the sequence, fetching the appropriate handler. The arguments to
;; the handler are described further below using declare-event. If
;; process-event is invoked recursively, the nested invocation begins with
;; the event after the one currently being processed.
(declare (type display display)
(type (or (clx-sequence (function (&key &allow-other-keys) t))
(function (&key &allow-other-keys) t))
handler)
(type (or null number) timeout)
(type boolean peek-p)))
(defun make-event-handlers (&key (type 'array) default)
(declare (type t type) ;Sequence type specifier
(type function default)
(clx-values sequence)) ;Default handler for initial content
;; Makes a handler sequence suitable for process-event
)
(defun event-handler (handlers event-key)
(declare (type sequence handlers)
(type event-key event-key)
(clx-values function))
;; Accessor for a handler sequence
)
(defsetf event-handler (handlers event-key) (handler)
(declare (type sequence handlers)
(type event-key event-key)
(type function handler)
(clx-values function))
;; Setf accessor for a handler sequence
)
(defmacro event-case ((display &key timeout peek-p discard-p (force-output-p t))
&body clauses)
(declare (arglist (display &key timeout peek-p discard-p force-output-p)
(event-or-events ((&rest args) |...|) &body body) |...|))
;; If force-output-p is true, first invokes display-force-output. Executes
;; the matching clause for each queued event until a clause returns non-nil,
;; and that returned object is then returned by event-case. If peek-p is
;; true, then the event is not removed from the queue. If discard-p is
;; true, then events for which the clause returns nil are removed from the
;; queue, otherwise they are left in place. Hangs until non-nil is
;; generated for some event, or for the specified timeout (in seconds, if
;; given); however, it is acceptable for an implementation to wait only once
;; on network data, and therefore timeout prematurely. Returns nil on
;; timeout or EOF with a second return value being :timeout for a timeout
;; and some other non-nil value for EOF. In each clause, event-or-events is
;; an event-key or a list of event-keys (but they need not be typed as
;; keywords) or the symbol t or otherwise (but only in the last clause).
;; The keys are not evaluated, and it is an error for the same key to appear
;; in more than one clause. Args is the list of event components of
;; interest; corresponding values (if any) are bound to variables with these
;; names (i.e., the args are variable names, not keywords, the keywords are
;; derived from the variable names). An arg can also be a (keyword var)
;; form, as for keyword args in a lambda lists. If no t/otherwise clause
;; appears, it is equivalent to having one that returns nil. If
;; process-event is invoked recursively, the nested invocation begins with
;; the event after the one currently being processed.
)
(defmacro event-cond ((display &key timeout peek-p discard-p (force-output-p t))
&body clauses)
;; The clauses of event-cond are of the form:
;; (event-or-events binding-list test-form . body-forms)
;;
;; EVENT-OR-EVENTS event-key or a list of event-keys (but they
;; need not be typed as keywords) or the symbol t
;; or otherwise (but only in the last clause). If
;; no t/otherwise clause appears, it is equivalent
;; to having one that returns nil. The keys are
;; not evaluated, and it is an error for the same
;; key to appear in more than one clause.
;;
;; BINDING-LIST The list of event components of interest.
;; corresponding values (if any) are bound to
;; variables with these names (i.e., the binding-list
;; has variable names, not keywords, the keywords are
;; derived from the variable names). An arg can also
;; be a (keyword var) form, as for keyword args in a
;; lambda list.
;;
;; The matching TEST-FORM for each queued event is executed until a
;; clause's test-form returns non-nil. Then the BODY-FORMS are
;; evaluated, returning the (possibly multiple) values of the last
;; form from event-cond. If there are no body-forms then, if the
;; test-form is non-nil, the value of the test-form is returned as a
;; single value.
;;
;; Options:
;; FORCE-OUTPUT-P When true, first invoke display-force-output if no
;; input is pending.
;;
;; PEEK-P When true, then the event is not removed from the queue.
;;
;; DISCARD-P When true, then events for which the clause returns nil
;; are removed from the queue, otherwise they are left in place.
;;
;; TIMEOUT If NIL, hang until non-nil is generated for some event's
;; test-form. Otherwise return NIL after TIMEOUT seconds have
;; elapsed. NIL is also returned whenever EOF is read.
;; Whenever NIL is returned a second value is returned which
;; is either :TIMEOUT if a timeout occurred or some other
;; non-NIL value if an EOF is detected.
;;
(declare (arglist (display &key timeout peek-p discard-p force-output-p)
(event-or-events (&rest args) test-form &body body) |...|))
)
(defun discard-current-event (display)
(declare (type display display)
(clx-values boolean))
;; Discard the current event for DISPLAY.
;; Returns NIL when the event queue is empty, else T.
;; To ensure events aren't ignored, application code should only call
;; this when throwing out of event-case or process-next-event, or from
;; inside even-case, event-cond or process-event when :peek-p is T and
;; :discard-p is NIL.
)
(defmacro declare-event (event-codes &rest declares)
;; Used to indicate the keyword arguments for handler functions in process-event
;; and event-case. In the declares, an argument listed as (name1 name2) indicates
;; synonyms for the same argument. All process-event handlers can have
;; (display display), (event-key event-key), and (boolean send-event-p) as keyword
;; arguments, and an event-case clause can also have event-key and send-event-p as
;; arguments.
(declare (arglist event-key-or-keys &rest (type &rest keywords))))
(declare-event (:key-press :key-release :button-press :button-release)
(card16 sequence)
(window (window event-window) root)
((or null window) child)
(boolean same-screen-p)
(int16 x y root-x root-y)
(card16 state)
((or null card32) time)
;; for key-press and key-release, code is the keycode
;; for button-press and button-release, code is the button number
(card8 code))
(declare-event :motion-notify
(card16 sequence)
(window (window event-window) root)
((or null window) child)
(boolean same-screen-p)
(int16 x y root-x root-y)
(card16 state)
((or null card32) time)
(boolean hint-p))
(declare-event (:enter-notify :leave-notify)
(card16 sequence)
(window (window event-window) root)
((or null window) child)
(boolean same-screen-p)
(int16 x y root-x root-y)
(card16 state)
((or null card32) time)
((member :normal :grab :ungrab) mode)
((member :ancestor :virtual :inferior :nonlinear :nonlinear-virtual) kind)
(boolean focus-p))
(declare-event (:focus-in :focus-out)
(card16 sequence)
(window (window event-window))
((member :normal :while-grabbed :grab :ungrab) mode)
((member :ancestor :virtual :inferior :nonlinear :nonlinear-virtual
:pointer :pointer-root :none)
kind))
(declare-event :keymap-notify
((bit-vector 256) keymap))
(declare-event :exposure
(card16 sequence)
(window (window event-window))
(card16 x y width height count))
(declare-event :graphics-exposure
(card16 sequence)
(drawable (drawable event-window))
(card16 x y width height count)
(card8 major)
(card16 minor))
(declare-event :no-exposure
(card16 sequence)
(drawable (drawable event-window))
(card8 major)
(card16 minor))
(declare-event :visibility-notify
(card16 sequence)
(window (window event-window))
((member :unobscured :partially-obscured :fully-obscured) state))
(declare-event :create-notify
(card16 sequence)
(window window (parent event-window))
(int16 x y)
(card16 width height border-width)
(boolean override-redirect-p))
(declare-event :destroy-notify
(card16 sequence)
(window event-window window))
(declare-event :unmap-notify
(card16 sequence)
(window event-window window)
(boolean configure-p))
(declare-event :map-notify
(card16 sequence)
(window event-window window)
(boolean override-redirect-p))
(declare-event :map-request
(card16 sequence)
(window (parent event-window) window))
(declare-event :reparent-notify
(card16 sequence)
(window event-window window parent)
(int16 x y)
(boolean override-redirect-p))
(declare-event :configure-notify
(card16 sequence)
(window event-window window)
(int16 x y)
(card16 width height border-width)
((or null window) above-sibling)
(boolean override-redirect-p))
(declare-event :gravity-notify
(card16 sequence)
(window event-window window)
(int16 x y))
(declare-event :resize-request
(card16 sequence)
(window (window event-window))
(card16 width height))
(declare-event :configure-request
(card16 sequence)
(window (parent event-window) window)
(int16 x y)
(card16 width height border-width)
((member :above :below :top-if :bottom-if :opposite) stack-mode)
((or null window) above-sibling)
(mask16 value-mask))
(declare-event :circulate-notify
(card16 sequence)
(window event-window window)
((member :top :bottom) place))
(declare-event :circulate-request
(card16 sequence)
(window (parent event-window) window)
((member :top :bottom) place))
(declare-event :property-notify
(card16 sequence)
(window (window event-window))
(keyword atom)
((member :new-value :deleted) state)
((or null card32) time))
(declare-event :selection-clear
(card16 sequence)
(window (window event-window))
(keyword selection)
((or null card32) time))
(declare-event :selection-request
(card16 sequence)
(window (window event-window) requestor)
(keyword selection target)
((or null keyword) property)
((or null card32) time))
(declare-event :selection-notify
(card16 sequence)
(window (window event-window))
(keyword selection target)
((or null keyword) property)
((or null card32) time))
(declare-event :colormap-notify
(card16 sequence)
(window (window event-window))
((or null colormap) colormap)
(boolean new-p installed-p))
(declare-event :mapping-notify
(card16 sequence)
((member :modifier :keyboard :pointer) request)
(card8 start count))
(declare-event :client-message
(card16 sequence)
(window (window event-window))
((member 8 16 32) format)
(sequence data))
(defun queue-event (display event-key &rest args &key append-p &allow-other-keys)
;; The event is put at the head of the queue if append-p is nil, else the tail.
;; Additional arguments depend on event-key, and are as specified above with
;; declare-event, except that both resource-ids and resource objects are accepted
;; in the event components.
(declare (type display display)
(type event-key event-key)
(type boolean append-p)))
;;; From here on, there has been less coherent review of the interface:
;;;-----------------------------------------------------------------------------
;;; Window Manager Property functions
(defun wm-name (window)
(declare (type window window)
(clx-values string)))
(defsetf wm-name (window) (name))
(defun wm-icon-name (window)
(declare (type window window)
(clx-values string)))
(defsetf wm-icon-name (window) (name))
(defun get-wm-class (window)
(declare (type window window)
(clx-values (or null name-string) (or null class-string))))
(defun set-wm-class (window resource-name resource-class)
(declare (type window window)
(type (or null stringable) resource-name resource-class)))
(defun wm-command (window)
;; Returns a list whose car is a command string and
;; whose cdr is the list of argument strings.
(declare (type window window)
(clx-values (clx-list string))))
(defsetf wm-command (window) (command)
;; Uses PRIN1 inside the ANSI common lisp form WITH-STANDARD-IO-SYNTAX (or
;; equivalent), with elements of command separated by NULL characters. This
;; enables
;; (with-standard-io-syntax (mapcar #'read-from-string (wm-command window)))
;; to recover a lisp command.
(declare (type window window)
(type (clx-list stringable) command)))
(defun wm-client-machine (window)
;; Returns a list whose car is a command string and
;; whose cdr is the list of argument strings.
(declare (type window window)
(clx-values string)))
(defsetf wm-client-machine (window) (string)
(declare (type window window)
(type stringable string)))
(defstruct wm-hints
(input nil :type (or null (member :off :on)))
(initial-state nil :type (or null (member :normal :iconic)))
(icon-pixmap nil :type (or null pixmap))
(icon-window nil :type (or null window))
(icon-x nil :type (or null card16))
(icon-y nil :type (or null card16))
(icon-mask nil :type (or null pixmap))
(window-group nil :type (or null resource-id))
(flags 0 :type card32) ;; Extension-hook. Exclusive-Or'ed with the FLAGS field
;; may be extended in the future
)
(defun wm-hints (window)
(declare (type window window)
(clx-values wm-hints)))
(defsetf wm-hints (window) (wm-hints))
(defstruct wm-size-hints
;; Defaulted T to put the burden of remembering these on widget programmers.
(user-specified-position-p t :type boolean) ;; True when user specified x y
(user-specified-size-p t :type boolean) ;; True when user specified width height
(x nil :type (or null int16)) ;; Obsolete
(y nil :type (or null int16)) ;; Obsolete
(width nil :type (or null card16)) ;; Obsolete
(height nil :type (or null card16)) ;; Obsolete
(min-width nil :type (or null card16))
(min-height nil :type (or null card16))
(max-width nil :type (or null card16))
(max-height nil :type (or null card16))
(width-inc nil :type (or null card16))
(height-inc nil :type (or null card16))
(min-aspect nil :type (or null number))
(max-aspect nil :type (or null number))
(base-width nil :type (or null card16))
(base-height nil :type (or null card16))
(win-gravity nil :type (or null win-gravity)))
(defun wm-normal-hints (window)
(declare (type window window)
(clx-values wm-size-hints)))
(defsetf wm-normal-hints (window) (wm-size-hints))
;; ICON-SIZES uses the SIZE-HINTS structure
(defun icon-sizes (window)
(declare (type window window)
(clx-values wm-size-hints)))
(defsetf icon-sizes (window) (wm-size-hints))
(defun wm-protocols (window)
(declare (type window window)
(clx-values protocols)))
(defsetf wm-protocols (window) (protocols)
(declare (type window window)
(type (clx-list keyword) protocols)))
(defun wm-colormap-windows (window)
(declare (type window window)
(clx-values windows)))
(defsetf wm-colormap-windows (window) (windows)
(declare (type window window)
(type (clx-list window) windows)))
(defun transient-for (window)
(declare (type window window)
(clx-values window)))
(defsetf transient-for (window) (transient)
(declare (type window window transient)))
(defun set-wm-properties (window &rest options &key
name icon-name resource-name resource-class command
hints normal-hints
;; the following are used for wm-normal-hints
user-specified-position-p user-specified-size-p
program-specified-position-p program-specified-size-p
min-width min-height max-width max-height
width-inc height-inc min-aspect max-aspect
base-width base-height win-gravity
;; the following are used for wm-hints
input initial-state icon-pixmap icon-window
icon-x icon-y icon-mask window-group)
;; Set properties for WINDOW.
(declare (type window window)
(type (or null stringable) name icoin-name resource-name resource-class)
(type (or null list) command)
(type (or null wm-hints) hints)
(type (or null wm-size-hints) normal-hints)
(type boolean user-specified-position-p user-specified-size-p)
(type boolean program-specified-position-p program-specified-size-p)
(type (or null card16) min-width min-height max-width max-height width-inc height-inc base-width base-height win-gravity)
(type (or null number) min-aspect max-aspect)
(type (or null (member :off :on)) input)
(type (or null (member :normal :iconic)) initial-state)
(type (or null pixmap) icon-pixmap icon-mask)
(type (or null window) icon-window)
(type (or null card16) icon-x icon-y)
(type (or null resource-id) window-group)))
(defun iconify-window (window)
(declare (type window window)))
(defun withdraw-window (window)
(declare (type window window)))
(defstruct standard-colormap
(colormap nil :type (or null colormap))
(base-pixel 0 :type pixel)
(max-color nil :type (or null color))
(mult-color nil :type (or null color))
(visual nil :type (or null visual-info))
(kill nil :type (or (member nil :release-by-freeing-colormap)
drawable gcontext cursor colormap font)))
(defun rgb-colormaps (window property)
(declare (type window window)
(type (member :rgb_default_map :rgb_best_map :rgb_red_map
:rgb_green_map :rgb_blue_map) property)
(clx-values (clx-list standard-colormap))))
(defsetf rgb-colormaps (window property) (standard-colormaps)
(declare (type window window)
(type (member :rgb_default_map :rgb_best_map :rgb_red_map
:rgb_green_map :rgb_blue_map) property)
(type (clx-list standard-colormap) standard-colormaps)))
(defun cut-buffer (display &key (buffer 0) (type :string) (result-type 'string)
(transform #'card8->char) (start 0) end)
;; Return the contents of cut-buffer BUFFER
(declare (type display display)
(type (integer 0 7) buffer)
(type xatom type)
(type array-index start)
(type (or null array-index) end)
(type t result-type) ;a sequence type
(type (or null (function (integer) t)) transform)
(clx-values sequence type format bytes-after)))
(defsetf cut-buffer (display buffer &key (type :string) (format 8)
(transform #'char->card8) (start 0) end) (data))
(defun rotate-cut-buffers (display &optional (delta 1) (careful-p t))
;; Positive rotates left, negative rotates right (opposite of actual
;; protocol request). When careful-p, ensure all cut-buffer
;; properties are defined, to prevent errors.
(declare (type display display)
(type int16 delta)
(type boolean careful-p)))
;;;-----------------------------------------------------------------------------
;;; Keycode mapping
(defun define-keysym-set (set first-keysym last-keysym)
;; Define all keysyms from first-keysym up to and including
;; last-keysym to be in SET (returned from the keysym-set function).
;; Signals an error if the keysym range overlaps an existing set.
(declare (type keyword set)
(type keysym first-keysym last-keysym)))
(defun keysym-set (keysym)
;; Return the character code set name of keysym
;; Note that the keyboard set (255) has been broken up into its parts.
(declare (type keysym keysym)
(clx-values keyword)))
(defun define-keysym (object keysym &key lowercase translate modifiers mask display)
;; Define the translation from keysym/modifiers to a (usually
;; character) object. ANy previous keysym definition with
;; KEYSYM and MODIFIERS is deleted before adding the new definition.
;;
;; MODIFIERS is either a modifier-mask or list containing intermixed
;; keysyms and state-mask-keys specifying when to use this
;; keysym-translation. The default is NIL.
;;
;; MASK is either a modifier-mask or list containing intermixed
;; keysyms and state-mask-keys specifying which modifiers to look at
;; (i.e. modifiers not specified are don't-cares).
;; If mask is :MODIFIERS then the mask is the same as the modifiers
;; (i.e. modifiers not specified by modifiers are don't cares)
;; The default mask is *default-keysym-translate-mask*
;;
;; If DISPLAY is specified, the translation will be local to DISPLAY,
;; otherwise it will be the default translation for all displays.
;;
;; LOWERCASE is used for uppercase alphabetic keysyms. The value
;; is the associated lowercase keysym. This information is used
;; by the keysym-both-case-p predicate (for caps-lock computations)
;; and by the keysym-downcase function.
;;
;; TRANSLATE will be called with parameters (display state OBJECT)
;; when translating KEYSYM and modifiers and mask are satisfied.
;; [e.g (zerop (logxor (logand state (or mask *default-keysym-translate-mask*))
;; (or modifiers 0)))
;; when mask and modifiers aren't lists of keysyms]
;; The default is #'default-keysym-translate
;;
(declare (type (or base-char t) object)
(type keysym keysym)
(type (or null mask16 (clx-list (or keysym state-mask-key)))
modifiers)
(type (or null (member :modifiers) mask16 (clx-list (or keysym state-mask-key)))
mask)
(type (or null display) display)
(type (or null keysym) lowercase)
(type (function (display card16 t) t) translate)))
(defvar *default-keysym-translate-mask*
(the (or (member :modifiers) mask16 (clx-list (or keysym state-mask-key)))
(logand #xff (lognot (make-state-mask :lock))))
"Default keysym state mask to use during keysym-translation.")
(defun undefine-keysym (object keysym &key display modifiers &allow-other-keys)
;; Undefine the keysym-translation translating KEYSYM to OBJECT with MODIFIERS.
;; If DISPLAY is non-nil, undefine the translation for DISPLAY if it exists.
(declare (type (or base-char t) object)
(type keysym keysym)
(type (or null mask16 (clx-list (or keysym state-mask-key)))
modifiers)
(type (or null display) display)))
(defun default-keysym-translate (display state object)
;; If object is a character, char-bits are set from state.
;; If object is a list, it is an alist with entries:
;; (base-char [modifiers] [mask-modifiers)
;; When MODIFIERS are specified, this character translation
;; will only take effect when the specified modifiers are pressed.
;; MASK-MODIFIERS can be used to specify a set of modifiers to ignore.
;; When MASK-MODIFIERS is missing, all other modifiers are ignored.
;; In ambiguous cases, the most specific translation is used.
(declare (type display display)
(type card16 state)
(type t object)
(clx-values t))) ;; Object returned by keycode->character
(defmacro keysym (keysym &rest bytes)
;; Build a keysym.
;; If KEYSYM is an integer, it is used as the most significant bits of
;; the keysym, and BYTES are used to specify low order bytes. The last
;; parameter is always byte4 of the keysym. If KEYSYM is not an
;; integer, the keysym associated with KEYSYM is returned.
;;
;; This is a macro and not a function macro to promote compile-time
;; lookup. All arguments are evaluated.
(declare (type t keysym)
(type (clx-list card8) bytes)
(clx-values keysym)))
(defun character->keysyms (character &optional display)
;; Given a character, return a list of all matching keysyms.
;; If DISPLAY is given, translations specific to DISPLAY are used,
;; otherwise only global translations are used.
;; Implementation dependent function.
;; May be slow [i.e. do a linear search over all known keysyms]
(declare (type t character)
(type (or null display) display)
(clx-values (clx-list keysym))))
(defun keycode->keysym (display keycode keysym-index)
(declare (type display display)
(type card8 code)
(type card16 state)
(type card8 keysym-index)
(clx-values keysym)))
(defun keysym->keycodes (display keysym)
;; Return keycodes for keysym, as multiple values
(declare (type display display)
(type keysym keysym)
(clx-values (or null keycode) (or null keycode) (or null keycode)))
)
(defun keysym->character (display keysym &optional state)
;; Find the character associated with a keysym.
;; STATE is used for adding char-bits to character as follows:
;; control -> char-control-bit
;; mod-1 -> char-meta-bit
;; mod-2 -> char-super-bit
;; mod-3 -> char-hyper-bit
;; Implementation dependent function.
(declare (type display display)
(type keysym keysym)
(type (or null card16) state)
(clx-values (or null character))))
(defun keycode->character (display keycode state &key keysym-index
(keysym-index-function #'default-keysym-index))
;; keysym-index defaults to the result of keysym-index-function which
;; is called with the following parameters:
;; (char0 state caps-lock-p keysyms-per-keycode)
;; where char0 is the "character" object associated with keysym-index 0 and
;; caps-lock-p is non-nil when the keysym associated with the lock
;; modifier is for caps-lock.
;; STATE is also used for setting char-bits:
;; control -> char-control-bit
;; mod-1 -> char-meta-bit
;; mod-2 -> char-super-bit
;; mod-3 -> char-hyper-bit
;; Implementation dependent function.
(declare (type display display)
(type card8 keycode)
(type card16 state)
(type (or null card8) keysym-index)
(type (or null (function (char0 state caps-lock-p keysyms-per-keycode) card8))
keysym-index-function)
(clx-values (or null character))))
(defun default-keysym-index (display keycode state)
;; Returns a keysym-index for use with keycode->character
(declare (clx-values card8))
)
;;; default-keysym-index implements the following tables:
;;;
;;; control shift caps-lock character character
;;; 0 0 0 #\a #\8
;;; 0 0 1 #\A #\8
;;; 0 1 0 #\A #\*
;;; 0 1 1 #\A #\*
;;; 1 0 0 #\control-A #\control-8
;;; 1 0 1 #\control-A #\control-8
;;; 1 1 0 #\control-shift-a #\control-*
;;; 1 1 1 #\control-shift-a #\control-*
;;;
;;; control shift shift-lock character character
;;; 0 0 0 #\a #\8
;;; 0 0 1 #\A #\*
;;; 0 1 0 #\A #\*
;;; 0 1 1 #\A #\8
;;; 1 0 0 #\control-A #\control-8
;;; 1 0 1 #\control-A #\control-*
;;; 1 1 0 #\control-shift-a #\control-*
;;; 1 1 1 #\control-shift-a #\control-8
(defun state-keysymp (display state keysym)
;; Returns T when a modifier key associated with KEYSYM is on in STATE
(declare (type display display)
(type card16 state)
(type keysym keysym)
(clx-values boolean)))
(defun mapping-notify (display request start count)
;; Called on a mapping-notify event to update
;; the keyboard-mapping cache in DISPLAY
(declare (type display display)
(type (member :modifier :keyboard :pointer) request)
(type card8 start count)))
(defun keysym-in-map-p (display keysym keymap)
;; Returns T if keysym is found in keymap
(declare (type display display)
(type keysym keysym)
(type (bit-vector 256) keymap)
(value boolean)))
(defun character-in-map-p (display character keymap)
;; Implementation dependent function.
;; Returns T if character is found in keymap
(declare (type display display)
(type t character)
(type (bit-vector 256) keymap)
(value boolean)))
;;;-----------------------------------------------------------------------------
;;; Extensions
(defmacro define-extension (name &key events errors)
;; Define extension NAME with EVENTS and ERRORS.
;; Note: The case of NAME is important.
;; To define the request, Use:
;; (with-buffer-request (display (extension-opcode ,name)) ,@body)
;; See the REQUESTS file for lots of examples.
;; To define event handlers, use declare-event.
;; To define error handlers, use declare-error and define-condition.
(declare (type stringable name)
(type (clx-list symbol) events errors)))
(defmacro extension-opcode (display name)
;; Returns the major opcode for extension NAME.
;; This is a macro to enable NAME to be interned for fast run-time
;; retrieval.
;; Note: The case of NAME is important.
(declare (type display display)
(type stringable name)
(clx-values card8)))
(defmacro define-error (error-key function)
;; Associate a function with ERROR-KEY which will be called with
;; parameters DISPLAY and REPLY-BUFFER and returns a plist of
;; keyword/value pairs which will be passed on to the error handler.
;; A compiler warning is printed when ERROR-KEY is not defined in a
;; preceding DEFINE-EXTENSION.
;; Note: REPLY-BUFFER may used with the READING-EVENT and READ-type
;; macros for getting error fields. See DECODE-CORE-ERROR for
; an example.
(declare (type symbol error-key)
(type function function)))
;; All core errors use this, so we make it available to extensions.
(defun decode-core-error (display event &optional arg)
;; All core errors have the following keyword/argument pairs:
;; :major integer
;; :minor integer
;; :sequence integer
;; :current-sequence integer
;; In addition, many have an additional argument that comes from the
;; same place in the event, but is named differently. When the ARG
;; argument is specified, the keyword ARG with card32 value starting
;; at byte 4 of the event is returned with the other keyword/argument
;; pairs.
(declare (type display display)
(type reply-buffer event)
(type (or null keyword) arg)
(clx-values keyword/arg-plist)))
;; This isn't new, just extended.
(defmacro declare-event (event-codes &body declares)
;; Used to indicate the keyword arguments for handler functions in
;; process-event and event-case.
;; Generates functions used in SEND-EVENT.
;; A compiler warning is printed when all of EVENT-CODES are not
;; defined by a preceding DEFINE-EXTENSION.
;; See the INPUT file for lots of examples.
(declare (type (or keyword (clx-list keywords)) event-codes)
(type (alist (field-type symbol) (field-names (clx-list symbol)))
declares)))
(defmacro define-gcontext-accessor (name &key default set-function copy-function)
;; This will define a new gcontext accessor called NAME.
;; Defines the gcontext-NAME accessor function and its defsetf.
;; Gcontext's will cache DEFAULT-VALUE and the last value SETF'ed when
;; gcontext-cache-p is true. The NAME keyword will be allowed in
;; CREATE-GCONTEXT, WITH-GCONTEXT, and COPY-GCONTEXT-COMPONENTS.
;; SET-FUNCTION will be called with parameters (GCONTEXT NEW-VALUE)
;; from create-gcontext, and force-gcontext-changes.
;; COPY-FUNCTION will be called with parameters (src-gc dst-gc src-value)
;; from copy-gcontext and copy-gcontext-components.
;; The copy-function defaults to:
;; (lambda (ignore dst-gc value)
;; (if value
;; (,set-function dst-gc value)
;; (error "Can't copy unknown GContext component ~a" ',name)))
(declare (type symbol name)
(type t default)
(type symbol set-function) ;; required
(type symbol copy-function)))
;; To aid extension implementors in attaching additional information to
;; clx data structures, the following accessors (with SETF's) are
;; defined. GETF can be used on these to extend the structures.
display-plist
screen-plist
visual-info-plist
gcontext-plist
font-plist
drawable-plist
;;; These have had perhaps even less review.
;;; Add some of the functionality provided by the C XLIB library.
;;;
;;; LaMott G. Oren, Texas Instruments 10/87
;;;
;;; Design Contributors:
;;; Robert W. Scheifler, MIT
;;;-----------------------------------------------------------------------------
;;; Regions (not yet implemented)
;;; Regions are arbitrary collections of pixels. This is represented
;;; in the region structure as either a list of rectangles or a bitmap.
(defun make-region (&optional x y width height)
;; With no parameters, returns an empty region
;; If some parameters are given, all must be given.
(declare (type (or null int16) x y width height)
(clx-values region)))
(defun region-p (thing))
(defun copy-region (region))
(defun region-empty-p (region)
(declare (type region region)
(clx-values boolean)))
(defun region-clip-box (region)
;; Returns a region which is the smallest enclosing rectangle
;; enclosing REGION
(declare (type region region)
(clx-values region)))
;; Accessors that return the boundaries of a region
(defun region-x (region))
(defun region-y (region))
(defun region-width (region))
(defun region-height (region))
(defsetf region-x (region) (x))
(defsetf region-y (region) (y))
;; Setting a region's X/Y translates the region
(defun region-intersection (&rest regions)
"Returns a region which is the intersection of one or more REGIONS.
Returns an empty region if the intersection is empty.
If there are no regions given, return a very large region."
(declare (type (clx-list region) regions)
(clx-values region)))
(defun region-union (&rest regions)
"Returns a region which is the union of a number of REGIONS
(i.e. the smallest region that can contain all the other regions)
Returns the empty region if no regions are given."
(declare (type (clx-list region) regions)
(clx-values region)))
(defun region-subtract (region subtract)
"Returns a region containing the points that are in REGION but not in SUBTRACT"
(declare (type region region subtract)
(clx-values region)))
(defun point-in-region-p (region x y)
;; Returns T when X/Y are a point within REGION.
(declare (type region region)
(type int16 x y)
(clx-values boolean)))
(defun region-equal (a b)
;; Returns T when regions a and b contain the same points.
;; That is, return t when for every X/Y (point-in-region-p a x y)
;; equals (point-in-region-p b x y)
(declare (type region a b)
(clx-values boolean)))
(defun subregion-p (large small)
"Returns T if SMALL is within LARGE.
That is, return T when for every X/Y (point-in-region-p small X Y)
implies (point-in-region-p large X Y)."
(declare (type region large small)
(clx-values boolean)))
(defun region-intersect-p (a b)
"Returns T if A intersects B.
That is, return T when there is some point common to regions A and B."
(declare (type region a b)
(clx-values boolean)))
(defun map-region (region function &rest args)
;; Calls function with arguments (x y . args) for every point in REGION.
(declare (type region region)
(type (function x y &rest args) function)))
;; Why isn't it better to augment
;; gcontext-clip-mask to deal with
;; (or null (member :none) pixmap rect-seq region)
;; and force conversions on the caller?
;; Good idea.
;;(defun gcontext-clip-region (gcontext)
;; ;; If the clip-mask of GCONTEXT is known, return it as a region.
;; (declare (type gcontext gcontext)
;; (clx-values (or null region))))
;;(defsetf gcontext-clip-region (gcontext) (region)
;; ;; Set the clip-rectangles or clip-mask for for GCONTEXT to include
;; ;; only the pixels within REGION.
;; (declare (type gcontext gcontext)
;; (type region region)))
(defun image->region (image)
;; Returns a region containing the 1 bits of a depth-1 image
;; Signals an error if image isn't of depth 1.
(declare (type image image)
(clx-values region)))
(defun region->image (region)
;; Returns a depth-1 image containg 1 bits for every pixel in REGION.
(declare (type region region)
(clx-values image)))
(defun polygon-region (points &optional (fill-rule :even-odd))
(declare (type sequence points) ;(repeat-seq (integer x) (integer y))
(type (member :even-odd :winding) fill-rule)
(clx-values region)))
;;;-----------------------------------------------------------------------------
;;; IMAGE functions
(deftype bitmap () '(array bit (* *)))
(deftype pixarray () '(array pixel (* *)))
(defconstant +lisp-byte-lsb-first-p+ #+lispm t #-lispm nil
"Byte order in pixel arrays")
(defstruct image
;; Public structure
(width 0 :type card16 :read-only t)
(height 0 :type card16 :read-only t)
(depth 1 :type card8 :read-only t)
(plist nil :type list))
;; Image-Plist accessors:
(defun image-name (image))
(defun image-x-hot (image))
(defun image-y-hot (image))
(defun image-red-mask (image))
(defun image-blue-mask (image))
(defun image-green-mask (image))
(defsetf image-name (image) (name))
(defsetf image-x-hot (image) (x))
(defsetf image-y-hot (image) (y))
(defsetf image-red-mask (image) (mask))
(defsetf image-blue-mask (image) (mask))
(defsetf image-green-mask (image) (mask))
(defstruct (image-x (:include image))
;; Use this format for shoveling image data
;; Private structure. Accessors for these NOT exported.
(format :z-pixmap :type (member :bitmap :xy-pixmap :z-pixmap))
(bytes-per-line 0 :type card16)
(scanline-pad 32 :type (member 8 16 32))
(bits-per-pixel 0 :type (member 1 4 8 16 24 32))
(bit-lsb-first-p nil :type boolean) ; Bit order
(byte-lsb-first-p nil :type boolean) ; Byte order
(data #() :type (array card8 (*)))) ; row-major
(defstruct (image-xy (:include image))
;; Public structure
;; Use this format for image processing
(bitmap-list nil :type (clx-list bitmap)))
(defstruct (image-z (:include image))
;; Public structure
;; Use this format for image processing
(bits-per-pixel 0 :type (member 1 4 8 16 24 32))
(pixarray #() :type pixarray))
(defun create-image (&key (width (required-arg width))
(height (required-arg height))
depth data plist name x-hot y-hot
red-mask blue-mask green-mask
bits-per-pixel format scanline-pad bytes-per-line
byte-lsb-first-p bit-lsb-first-p )
;; Returns an image-x image-xy or image-z structure, depending on the
;; type of the :DATA parameter.
(declare
(type card16 width height) ; Required
(type (or null card8) depth) ; Defualts to 1
(type (or (array card8 (*)) ;Returns image-x
(clx-list bitmap) ;Returns image-xy
pixarray) data) ;Returns image-z
(type list plist)
(type (or null stringable) name)
(type (or null card16) x-hot y-hot)
(type (or null pixel) red-mask blue-mask green-mask)
(type (or null (member 1 4 8 16 24 32)) bits-per-pixel)
;; The following parameters are ignored for image-xy and image-z:
(type (or null (member :bitmap :xy-pixmap :z-pixmap))
format) ; defaults to :z-pixmap
(type (or null (member 8 16 32)) scanline-pad)
(type (or null card16) bytes-per-line) ;default from width and scanline-pad
(type boolean byte-lsb-first-p bit-lsb-first-p)
(clx-values image)))
(defun get-image (drawable &key
(x (required-arg x))
(y (required-arg y))
(width (required-arg width))
(height (required-arg height))
plane-mask format result-type)
;; Get an image from the server.
;; Format defaults to :z-pixmap. Result-Type defaults from Format,
;; image-z for :z-pixmap, and image-xy for :xy-pixmap.
;; Plane-mask defaults to #xFFFFFFFF.
;; Returns an image-x image-xy or image-z structure, depending on the
;; result-type parameter.
(declare (type drawable drawable)
(type int16 x y) ;; required
(type card16 width height) ;; required
(type (or null pixel) plane-mask)
(type (or null (member :xy-pixmap :z-pixmap)) format)
(type (or null (member image-x image-xy image-z)) result-type)
(clx-values image)))
(defun put-image (drawable gcontext image &key
(src-x 0) (src-y 0)
(x (required-arg x))
(y (required-arg y))
width height
bitmap-p)
;; When BITMAP-P, force format to be :bitmap when depth=1
;; This causes gcontext to supply foreground & background pixels.
(declare (type drawable drawable)
(type gcontext gcontext)
(type image image)
(type int16 x y) ;; required
(type (or null card16) width height)
(type boolean bitmap-p)))
(defun copy-image (image &key (x 0) (y 0) width height result-type)
;; Copy with optional sub-imaging and format conversion.
;; result-type defaults to (type-of image)
(declare (type image image)
(type card16 x y)
(type (or null card16) width height) ;; Default from image
(type (or null (member image-x image-xy image-z)) result-type)
(clx-values image)))
(defun read-bitmap-file (pathname)
;; Creates an image from a C include file in standard X11 format
(declare (type (or pathname string stream) pathname)
(clx-values image)))
(defun write-bitmap-file (pathname image &optional name)
;; Writes an image to a C include file in standard X11 format
;; NAME argument used for variable prefixes. Defaults to "image"
(declare (type (or pathname string stream) pathname)
(type image image)
(type (or null stringable) name)))
;;;-----------------------------------------------------------------------------
;;; Resource data-base
(defun make-resource-database ()
;; Returns an empty resource data-base
(declare (clx-values resource-database)))
(defun get-resource (database value-name value-class full-name full-class)
;; Return the value of the resource in DATABASE whose partial name
;; most closely matches (append full-name (list value-name)) and
;; (append full-class (list value-class)).
(declare (type resource-database database)
(type stringable value-name value-class)
(type (clx-list stringable) full-name full-class)
(clx-values value)))
(defun add-resource (database name-list value)
;; name-list is a list of either strings or symbols. If a symbol,
;; case-insensitive comparisons will be used, if a string,
;; case-sensitive comparisons will be used. The symbol '* or
;; string "*" are used as wildcards, matching anything or nothing.
(declare (type resource-database database)
(type (clx-list stringable) name-list)
(type t value)))
(defun delete-resource (database name-list)
(declare (type resource-database database)
(type (clx-list stringable) name-list)))
(defun map-resource (database function &rest args)
;; Call FUNCTION on each resource in DATABASE.
;; FUNCTION is called with arguments (name-list value . args)
(declare (type resource-database database)
(type (function ((clx-list stringable) t &rest t) t) function)
(clx-values nil)))
(defun merge-resources (database with-database)
(declare (type resource-database database with-database)
(clx-values resource-database))
(map-resource #'add-resource database with-database)
with-database)
;; Note: with-input-from-string can be used with read-resources to define
;; default resources in a program file.
(defun read-resources (database pathname &key key test test-not)
;; Merges resources from a file in standard X11 format with DATABASE.
;; KEY is a function used for converting value-strings, the default is
;; identity. TEST and TEST-NOT are predicates used for filtering
;; which resources to include in the database. They are called with
;; the name and results of the KEY function.
(declare (type resource-database database)
(type (or pathname string stream) pathname)
(type (or null (function (string) t)) key)
(type (or null (function ((clx-list string) t) boolean))
test test-not)
(clx-values resource-database)))
(defun write-resources (database pathname &key write test test-not)
;; Write resources to PATHNAME in the standard X11 format.
;; WRITE is a function used for writing values, the default is #'princ
;; TEST and TEST-NOT are predicates used for filtering which resources
;; to include in the database. They are called with the name and value.
(declare (type resource-database database)
(type (or pathname string stream) pathname)
(type (or null (function (string stream) t)) write)
(type (or null (function ((clx-list string) t) boolean))
test test-not)))
(defun root-resources (screen &key database key test test-not)
"Returns a resource database containing the contents of the root window
RESOURCE_MANAGER property for the given SCREEN. If SCREEN is a display,
then its default screen is used. If an existing DATABASE is given, then
resource values are merged with the DATABASE and the modified DATABASE is
returned.
TEST and TEST-NOT are predicates for selecting which resources are
read. Arguments are a resource name list and a resource value. The KEY
function, if given, is called to convert a resource value string to the
value given to TEST or TEST-NOT."
(declare (type (or screen display) screen)
(type (or null resource-database) database)
(type (or null (function (string) t)) key)
(type (or null (function list boolean)) test test-not)
(clx-values resource-database)))
(defsetf root-resources (screen &key test test-not (write 'princ)) (database)
"Changes the contents of the root window RESOURCE_MANAGER property for the
given SCREEN. If SCREEN is a display, then its default screen is used.
TEST and TEST-NOT are predicates for selecting which resources from the
DATABASE are written. Arguments are a resource name list and a resource
value. The WRITE function is used to convert a resource value into a
string stored in the property."
(declare (type (or screen display) screen)
(type (or null resource-database) database)
(type (or null (function list boolean)) test test-not)
(type (or null (function (string stream) t)) write)
(clx-values resource-database)))
;;;-----------------------------------------------------------------------------
;;; Shared GContext's
(defmacro using-gcontext ((var &rest options &key drawable
function plane-mask foreground background
line-width line-style cap-style
join-style fill-style fill-rule arc-mode
tile stipple ts-x ts-y font
subwindow-mode exposures clip-x clip-y
clip-mask clip-ordering dash-offset
dashes)
&body body)
;; Equivalent to (let ((var (apply #'make-gcontext options))) ,@body)
;; but more efficient because it uses a gcontext cache associated with
;; drawable's display.
)
X11 Request Name CLX Function Name
----------------- -----------------
AllocColor ALLOC-COLOR
AllocColorCells ALLOC-COLOR-CELLS
AllocColorPlanes ALLOC-COLOR-PLANES
AllocNamedColor ALLOC-COLOR
AllowEvents ALLOW-EVENTS
Bell BELL
ChangeAccessControl (setf (ACCESS-CONTROL display) boolean)
ChangeActivePointerGrab CHANGE-ACTIVE-POINTER-GRAB
ChangeCloseDownMode (setf (CLOSE-DOWN-MODE display) mode)
ChangeGC FORCE-GCONTEXT-CHANGES
;; See WITH-GCONTEXT
(setf (gcontext-function gc) boole-constant)
(setf (gcontext-plane-mask gc) card32)
(setf (gcontext-foreground gc) card32)
(setf (gcontext-background gc) card32)
(setf (gcontext-line-width gc) card16)
(setf (gcontext-line-style gc) keyword)
(setf (gcontext-cap-style gc) keyword)
(setf (gcontext-join-style gc) keyword)
(setf (gcontext-fill-style gc) keyword)
(setf (gcontext-fill-rule gc) keyword)
(setf (gcontext-tile gc) pixmap)
(setf (gcontext-stipple gc) pixmap)
(setf (gcontext-ts-x gc) int16) ;; Tile-Stipple-X-origin
(setf (gcontext-ts-y gc) int16) ;; Tile-Stipple-Y-origin
(setf (gcontext-font gc &optional metrics-p) font)
(setf (gcontext-subwindow-mode gc) keyword)
(setf (gcontext-exposures gc) (member :on :off))
(setf (gcontext-clip-x gc) int16)
(setf (gcontext-clip-y gc) int16)
(setf (gcontext-clip-mask gc &optional ordering)
(or (member :none) pixmap rect-seq))
(setf (gcontext-dash-offset gc) card16)
(setf (gcontext-dashes gc) (or card8 sequence))
(setf (gcontext-arc-mode gc) (member :chord :pie-slice))
(setf (gcontext-clip-ordering gc) keyword)
ChangeHosts ADD-ACCESS-HOST
ChangeHosts REMOVE-ACCESS-HOST
ChangeKeyboardControl CHANGE-KEYBOARD-CONTROL
ChangePointerControl CHANGE-POINTER-CONTROL
ChangeProperty CHANGE-PROPERTY
ChangeSaveSet REMOVE-FROM-SAVE-SET
ChangeSaveSet ADD-TO-SAVE-SET
ChangeWindowAttributes
;; See WITH-STATE
(setf (window-background window) value)
(setf (window-border window) value)
(setf (window-bit-gravity window) value)
(setf (window-gravity window) value)
(setf (window-backing-store window) value)
(setf (window-backing-planes window) value)
(setf (window-backing-pixel window) value)
(setf (window-override-redirect window) value)
(setf (window-save-under window) value)
(setf (window-colormap window) value)
(setf (window-cursor window) value)
(setf (window-event-mask window) value)
(setf (window-do-not-propagate-mask window) value)
CirculateWindow CIRCULATE-WINDOW-DOWN
CirculateWindow CIRCULATE-WINDOW-UP
ClearToBackground CLEAR-AREA
CloseFont CLOSE-FONT
ConfigureWindow
;; See WITH-STATE
(setf (drawable-x drawable) integer)
(setf (drawable-y drawable) integer)
(setf (drawable-width drawable) integer)
(setf (drawable-height drawable) integer)
(setf (drawable-depth drawable) integer)
(setf (drawable-border-width drawable) integer)
(setf (window-priority window &optional sibling) integer)
ConvertSelection CONVERT-SELECTION
CopyArea COPY-AREA
CopyColormapAndFree COPY-COLORMAP-AND-FREE
CopyGC COPY-GCONTEXT
CopyGC COPY-GCONTEXT-COMPONENTS
CopyPlane COPY-PLANE
CreateColormap CREATE-COLORMAP
CreateCursor CREATE-CURSOR
CreateGC CREATE-GCONTEXT
CreateGlyphCursor CREATE-GLYPH-CURSOR
CreatePixmap CREATE-PIXMAP
CreateWindow CREATE-WINDOW
DeleteProperty DELETE-PROPERTY
DestroySubwindows DESTROY-SUBWINDOWS
DestroyWindow DESTROY-WINDOW
FillPoly DRAW-LINES
ForceScreenSaver RESET-SCREEN-SAVER
ForceScreenSaver ACTIVATE-SCREEN-SAVER
FreeColormap FREE-COLORMAP
FreeColors FREE-COLORS
FreeCursor FREE-CURSOR
FreeGC FREE-GCONTEXT
FreePixmap FREE-PIXMAP
GetAtomName ATOM-NAME
GetFontPath FONT-PATH
GetGeometry ;; See WITH-STATE
DRAWABLE-ROOT
DRAWABLE-X
DRAWABLE-Y
DRAWABLE-WIDTH
DRAWABLE-HEIGHT
DRAWABLE-DEPTH
DRAWABLE-BORDER-WIDTH
GetImage GET-RAW-IMAGE
GetInputFocus INPUT-FOCUS
GetKeyboardControl KEYBOARD-CONTROL
GetKeyboardMapping KEYBOARD-MAPPING
GetModifierMapping MODIFIER-MAPPING
GetMotionEvents MOTION-EVENTS
GetPointerControl POINTER-CONTROL
GetPointerMapping POINTER-MAPPING
GetProperty GET-PROPERTY
GetScreenSaver SCREEN-SAVER
GetSelectionOwner SELECTION-OWNER
GetWindowAttributes ;; See WITH-STATE
WINDOW-VISUAL-INFO
WINDOW-CLASS
WINDOW-BIT-GRAVITY
WINDOW-GRAVITY
WINDOW-BACKING-STORE
WINDOW-BACKING-PLANES
WINDOW-BACKING-PIXEL
WINDOW-SAVE-UNDER
WINDOW-OVERRIDE-REDIRECT
WINDOW-EVENT-MASK
WINDOW-DO-NOT-PROPAGATE-MASK
WINDOW-COLORMAP
WINDOW-COLORMAP-INSTALLED-P
WINDOW-ALL-EVENT-MASKS
WINDOW-MAP-STATE
GrabButton GRAB-BUTTON
GrabKey GRAB-KEY
GrabKeyboard GRAB-KEYBOARD
GrabPointer GRAB-POINTER
GrabServer GRAB-SERVER
ImageText16 DRAW-IMAGE-GLYPHS
ImageText16 DRAW-IMAGE-GLYPH
ImageText8 DRAW-IMAGE-GLYPHS
InstallColormap INSTALL-COLORMAP
InternAtom FIND-ATOM
InternAtom INTERN-ATOM
KillClient KILL-TEMPORARY-CLIENTS
KillClient KILL-CLIENT
ListExtensions LIST-EXTENSIONS
ListFonts LIST-FONT-NAMES
ListFontsWithInfo LIST-FONTS
ListHosts ACCESS-CONTROL
ListHosts ACCESS-HOSTS
ListInstalledColormaps INSTALLED-COLORMAPS
ListProperties LIST-PROPERTIES
LookupColor LOOKUP-COLOR
MapSubwindows MAP-SUBWINDOWS
MapWindow MAP-WINDOW
OpenFont OPEN-FONT
PolyArc DRAW-ARC
PolyArc DRAW-ARCS
PolyFillArc DRAW-ARC
PolyFillArc DRAW-ARCS
PolyFillRectangle DRAW-RECTANGLE
PolyFillRectangle DRAW-RECTANGLES
PolyLine DRAW-LINE
PolyLine DRAW-LINES
PolyPoint DRAW-POINT
PolyPoint DRAW-POINTS
PolyRectangle DRAW-RECTANGLE
PolyRectangle DRAW-RECTANGLES
PolySegment DRAW-SEGMENTS
PolyText16 DRAW-GLYPH
PolyText16 DRAW-GLYPHS
PolyText8 DRAW-GLYPHS
PutImage PUT-RAW-IMAGE
QueryBestSize QUERY-BEST-CURSOR
QueryBestSize QUERY-BEST-STIPPLE
QueryBestSize QUERY-BEST-TILE
QueryColors QUERY-COLORS
QueryExtension QUERY-EXTENSION
QueryFont FONT-NAME
FONT-NAME
FONT-DIRECTION
FONT-MIN-CHAR
FONT-MAX-CHAR
FONT-MIN-BYTE1
FONT-MAX-BYTE1
FONT-MIN-BYTE2
FONT-MAX-BYTE2
FONT-ALL-CHARS-EXIST-P
FONT-DEFAULT-CHAR
FONT-ASCENT
FONT-DESCENT
FONT-PROPERTIES
FONT-PROPERTY
CHAR-LEFT-BEARING
CHAR-RIGHT-BEARING
CHAR-WIDTH
CHAR-ASCENT
CHAR-DESCENT
CHAR-ATTRIBUTES
MIN-CHAR-LEFT-BEARING
MIN-CHAR-RIGHT-BEARING
MIN-CHAR-WIDTH
MIN-CHAR-ASCENT
MIN-CHAR-DESCENT
MIN-CHAR-ATTRIBUTES
MAX-CHAR-LEFT-BEARING
MAX-CHAR-RIGHT-BEARING
MAX-CHAR-WIDTH
MAX-CHAR-ASCENT
MAX-CHAR-DESCENT
MAX-CHAR-ATTRIBUTES
QueryKeymap QUERY-KEYMAP
QueryPointer GLOBAL-POINTER-POSITION
QueryPointer POINTER-POSITION
QueryPointer QUERY-POINTER
QueryTextExtents TEXT-EXTENTS
QueryTextExtents TEXT-WIDTH
QueryTree QUERY-TREE
RecolorCursor RECOLOR-CURSOR
ReparentWindow REPARENT-WINDOW
RotateProperties ROTATE-PROPERTIES
SendEvent SEND-EVENT
SetClipRectangles FORCE-GCONTEXT-CHANGES
;; See WITH-GCONTEXT
(setf (gcontext-clip-x gc) int16)
(setf (gcontext-clip-y gc) int16)
(setf (gcontext-clip-mask gc &optional ordering)
(or (member :none) pixmap rect-seq))
(setf (gcontext-clip-ordering gc) keyword)
SetDashes FORCE-GCONTEXT-CHANGES
;; See WITH-GCONTEXT
(setf (gcontext-dash-offset gc) card16)
(setf (gcontext-dashes gc) (or card8 sequence))
SetFontPath
(setf (font-path font) paths)
Where paths is (type (clx-sequence (or string pathname)))
SetInputFocus SET-INPUT-FOCUS
SetKeyboardMapping CHANGE-KEYBOARD-MAPPING
SetModifierMapping SET-MODIFIER-MAPPING
SetPointerMapping SET-POINTER-MAPPING
SetScreenSaver SET-SCREEN-SAVER
SetSelectionOwner SET-SELECTION-OWNER
StoreColors STORE-COLOR
StoreColors STORE-COLORS
StoreNamedColor STORE-COLOR
StoreNamedColor STORE-COLORS
TranslateCoords TRANSLATE-COORDINATES
UngrabButton UNGRAB-BUTTON
UngrabKey UNGRAB-KEY
UngrabKeyboard UNGRAB-KEYBOARD
UngrabPointer UNGRAB-POINTER
UngrabServer UNGRAB-SERVER
UninstallColormap UNINSTALL-COLORMAP
UnmapSubwindows UNMAP-SUBWINDOWS
UnmapWindow UNMAP-WINDOW
WarpPointer WARP-POINTER
WarpPointer WARP-POINTER-IF-INSIDE
WarpPointer WARP-POINTER-RELATIVE
WarpPointer WARP-POINTER-RELATIVE-IF-INSIDE
NoOperation NO-OPERATION
X11 Request Name CLX Function Name
----------------- -----------------
ListHosts ACCESS-CONTROL
ListHosts ACCESS-HOSTS
ForceScreenSaver ACTIVATE-SCREEN-SAVER
ChangeHosts ADD-ACCESS-HOST
ChangeSaveSet ADD-TO-SAVE-SET
AllocColor ALLOC-COLOR
AllocNamedColor ALLOC-COLOR
AllocColorCells ALLOC-COLOR-CELLS
AllocColorPlanes ALLOC-COLOR-PLANES
AllowEvents ALLOW-EVENTS
GetAtomName ATOM-NAME
Bell BELL
ChangeActivePointerGrab CHANGE-ACTIVE-POINTER-GRAB
ChangeKeyboardControl CHANGE-KEYBOARD-CONTROL
SetKeyboardMapping CHANGE-KEYBOARD-MAPPING
ChangePointerControl CHANGE-POINTER-CONTROL
ChangeProperty CHANGE-PROPERTY
QueryFont CHAR-ASCENT
QueryFont CHAR-ATTRIBUTES
QueryFont CHAR-DESCENT
QueryFont CHAR-LEFT-BEARING
QueryFont CHAR-RIGHT-BEARING
QueryFont CHAR-WIDTH
CirculateWindow CIRCULATE-WINDOW-DOWN
CirculateWindow CIRCULATE-WINDOW-UP
ClearToBackground CLEAR-AREA
CloseFont CLOSE-FONT
ConvertSelection CONVERT-SELECTION
CopyArea COPY-AREA
CopyColormapAndFree COPY-COLORMAP-AND-FREE
CopyGC COPY-GCONTEXT
CopyGC COPY-GCONTEXT-COMPONENTS
CopyPlane COPY-PLANE
CreateColormap CREATE-COLORMAP
CreateCursor CREATE-CURSOR
CreateGC CREATE-GCONTEXT
CreateGlyphCursor CREATE-GLYPH-CURSOR
CreatePixmap CREATE-PIXMAP
CreateWindow CREATE-WINDOW
DeleteProperty DELETE-PROPERTY
DestroySubwindows DESTROY-SUBWINDOWS
DestroyWindow DESTROY-WINDOW
PolyArc DRAW-ARC
PolyArc DRAW-ARCS
PolyText16 DRAW-GLYPH
PolyText16 DRAW-GLYPHS
PolyText8 DRAW-GLYPHS
ImageText16 DRAW-IMAGE-GLYPH
ImageText16 DRAW-IMAGE-GLYPHS
ImageText8 DRAW-IMAGE-GLYPHS
PolyLine DRAW-LINE
PolyLine DRAW-LINES
PolyPoint DRAW-POINT
PolyPoint DRAW-POINTS
PolyFillRectangle DRAW-RECTANGLE
PolyRectangle DRAW-RECTANGLE
PolyFillRectangle DRAW-RECTANGLES
PolyRectangle DRAW-RECTANGLES
PolySegment DRAW-SEGMENTS
GetGeometry DRAWABLE-BORDER-WIDTH
GetGeometry DRAWABLE-DEPTH
GetGeometry DRAWABLE-HEIGHT
GetGeometry DRAWABLE-ROOT
GetGeometry DRAWABLE-WIDTH
GetGeometry DRAWABLE-X
GetGeometry DRAWABLE-Y
FillPoly FILL-POLYGON
InternAtom FIND-ATOM
QueryFont FONT-ALL-CHARS-EXIST-P
QueryFont FONT-ASCENT
QueryFont FONT-DEFAULT-CHAR
QueryFont FONT-DESCENT
QueryFont FONT-DIRECTION
QueryFont FONT-MAX-BYTE1
QueryFont FONT-MAX-BYTE2
QueryFont FONT-MAX-CHAR
QueryFont FONT-MIN-BYTE1
QueryFont FONT-MIN-BYTE2
QueryFont FONT-MIN-CHAR
QueryFont FONT-NAME
QueryFont FONT-NAME
GetFontPath FONT-PATH
QueryFont FONT-PROPERTIES
QueryFont FONT-PROPERTY
ChangeGC FORCE-GCONTEXT-CHANGES
SetClipRectangles FORCE-GCONTEXT-CHANGES
SetDashes FORCE-GCONTEXT-CHANGES
FreeColormap FREE-COLORMAP
FreeColors FREE-COLORS
FreeCursor FREE-CURSOR
FreeGC FREE-GCONTEXT
FreePixmap FREE-PIXMAP
GetProperty GET-PROPERTY
GetImage GET-RAW-IMAGE
QueryPointer GLOBAL-POINTER-POSITION
GrabButton GRAB-BUTTON
GrabKey GRAB-KEY
GrabKeyboard GRAB-KEYBOARD
GrabPointer GRAB-POINTER
GrabServer GRAB-SERVER
GrabServer WITH-SERVER-GRABBED
GetInputFocus INPUT-FOCUS
InstallColormap INSTALL-COLORMAP
ListInstalledColormaps INSTALLED-COLORMAPS
InternAtom INTERN-ATOM
GetKeyboardControl KEYBOARD-CONTROL
GetKeyboardMapping KEYBOARD-MAPPING
KillClient KILL-CLIENT
KillClient KILL-TEMPORARY-CLIENTS
ListExtensions LIST-EXTENSIONS
ListFonts LIST-FONT-NAMES
ListFontsWithInfo LIST-FONTS
ListProperties LIST-PROPERTIES
LookupColor LOOKUP-COLOR
MapSubwindows MAP-SUBWINDOWS
MapWindow MAP-WINDOW
QueryFont MAX-CHAR-ASCENT
QueryFont MAX-CHAR-ATTRIBUTES
QueryFont MAX-CHAR-DESCENT
QueryFont MAX-CHAR-LEFT-BEARING
QueryFont MAX-CHAR-RIGHT-BEARING
QueryFont MAX-CHAR-WIDTH
QueryFont MIN-CHAR-ASCENT
QueryFont MIN-CHAR-ATTRIBUTES
QueryFont MIN-CHAR-DESCENT
QueryFont MIN-CHAR-LEFT-BEARING
QueryFont MIN-CHAR-RIGHT-BEARING
QueryFont MIN-CHAR-WIDTH
GetModifierMapping MODIFIER-MAPPING
GetMotionEvents MOTION-EVENTS
NoOperation NO-OPERATION
OpenFont OPEN-FONT
GetPointerControl POINTER-CONTROL
GetPointerMapping POINTER-MAPPING
QueryPointer POINTER-POSITION
PutImage PUT-RAW-IMAGE
QueryBestSize QUERY-BEST-CURSOR
QueryBestSize QUERY-BEST-STIPPLE
QueryBestSize QUERY-BEST-TILE
QueryColors QUERY-COLORS
QueryExtension QUERY-EXTENSION
QueryKeymap QUERY-KEYMAP
QueryPointer QUERY-POINTER
QueryTree QUERY-TREE
RecolorCursor RECOLOR-CURSOR
ChangeHosts REMOVE-ACCESS-HOST
ChangeSaveSet REMOVE-FROM-SAVE-SET
ReparentWindow REPARENT-WINDOW
ForceScreenSaver RESET-SCREEN-SAVER
RotateProperties ROTATE-PROPERTIES
GetScreenSaver SCREEN-SAVER
GetSelectionOwner SELECTION-OWNER
SendEvent SEND-EVENT
ChangeAccessControl SET-ACCESS-CONTROL
ChangeCloseDownMode SET-CLOSE-DOWN-MODE
SetInputFocus SET-INPUT-FOCUS
SetModifierMapping SET-MODIFIER-MAPPING
SetPointerMapping SET-POINTER-MAPPING
SetScreenSaver SET-SCREEN-SAVER
SetSelectionOwner SET-SELECTION-OWNER
StoreColors STORE-COLOR
StoreColors STORE-COLORS
StoreNamedColor STORE-COLOR
StoreNamedColor STORE-COLORS
QueryTextExtents TEXT-EXTENTS
QueryTextExtents TEXT-WIDTH
TranslateCoords TRANSLATE-COORDINATES
UngrabButton UNGRAB-BUTTON
UngrabKey UNGRAB-KEY
UngrabKeyboard UNGRAB-KEYBOARD
UngrabPointer UNGRAB-POINTER
UngrabServer UNGRAB-SERVER
UngrabServer WITH-SERVER-GRABBED
UninstallColormap UNINSTALL-COLORMAP
UnmapSubwindows UNMAP-SUBWINDOWS
UnmapWindow UNMAP-WINDOW
WarpPointer WARP-POINTER
WarpPointer WARP-POINTER-IF-INSIDE
WarpPointer WARP-POINTER-RELATIVE
WarpPointer WARP-POINTER-RELATIVE-IF-INSIDE
GetWindowAttributes WINDOW-ALL-EVENT-MASKS
GetWindowAttributes WINDOW-BACKING-PIXEL
GetWindowAttributes WINDOW-BACKING-PLANES
GetWindowAttributes WINDOW-BACKING-STORE
GetWindowAttributes WINDOW-BIT-GRAVITY
GetWindowAttributes WINDOW-CLASS
GetWindowAttributes WINDOW-COLORMAP
GetWindowAttributes WINDOW-COLORMAP-INSTALLED-P
GetWindowAttributes WINDOW-DO-NOT-PROPAGATE-MASK
GetWindowAttributes WINDOW-EVENT-MASK
GetWindowAttributes WINDOW-GRAVITY
GetWindowAttributes WINDOW-MAP-STATE
GetWindowAttributes WINDOW-OVERRIDE-REDIRECT
GetWindowAttributes WINDOW-SAVE-UNDER
GetWindowAttributes WINDOW-VISUAL-INFO
ConfigureWindow (SETF (DRAWABLE-BORDER-WIDTH DRAWABLE) INTEGER)
ConfigureWindow (SETF (DRAWABLE-DEPTH DRAWABLE) INTEGER)
ConfigureWindow (SETF (DRAWABLE-HEIGHT DRAWABLE) INTEGER)
ConfigureWindow (SETF (DRAWABLE-WIDTH DRAWABLE) INTEGER)
ConfigureWindow (SETF (DRAWABLE-X DRAWABLE) INTEGER)
ConfigureWindow (SETF (DRAWABLE-Y DRAWABLE) INTEGER)
SetFontPath (SETF (FONT-PATH FONT) PATHS)
ChangeGC (SETF (GCONTEXT-ARC-MODE GC) (MEMBER CHORD PIE-SLICE))
ChangeGC (SETF (GCONTEXT-BACKGROUND GC) CARD32)
ChangeGC (SETF (GCONTEXT-CAP-STYLE GC) KEYWORD)
SetClipRectangles (SETF (GCONTEXT-CLIP-MASK GC &OPTIONAL ORDERING)
(OR (MEMBER NONE) PIXMAP RECT-SEQ))
SetClipRectangles (SETF (GCONTEXT-CLIP-ORDERING GC) KEYWORD)
SetClipRectangles (SETF (GCONTEXT-CLIP-X GC) INT16)
SetClipRectangles (SETF (GCONTEXT-CLIP-Y GC) INT16)
SetDashes (SETF (GCONTEXT-DASH-OFFSET GC) CARD16)
SetDashes (SETF (GCONTEXT-DASHES GC) (OR CARD8 SEQUENCE))
ChangeGC (SETF (GCONTEXT-EXPOSURES GC) (MEMBER ON OFF))
ChangeGC (SETF (GCONTEXT-FILL-RULE GC) KEYWORD)
ChangeGC (SETF (GCONTEXT-FILL-STYLE GC) KEYWORD)
ChangeGC (SETF (GCONTEXT-FONT GC &OPTIONAL METRICS-P) FONT)
ChangeGC (SETF (GCONTEXT-FOREGROUND GC) CARD32)
ChangeGC (SETF (GCONTEXT-FUNCTION GC) BOOLE-CONSTANT)
ChangeGC (SETF (GCONTEXT-JOIN-STYLE GC) KEYWORD)
ChangeGC (SETF (GCONTEXT-LINE-STYLE GC) KEYWORD)
ChangeGC (SETF (GCONTEXT-LINE-WIDTH GC) CARD16)
ChangeGC (SETF (GCONTEXT-PLANE-MASK GC) CARD32)
ChangeGC (SETF (GCONTEXT-STIPPLE GC) PIXMAP)
ChangeGC (SETF (GCONTEXT-SUBWINDOW-MODE GC) KEYWORD)
ChangeGC (SETF (GCONTEXT-TILE GC) PIXMAP)
ChangeGC (SETF (GCONTEXT-TS-X GC) INT16)
ChangeGC (SETF (GCONTEXT-TS-Y GC) INT16)
ChangeWindowAttributes (SETF (WINDOW-BACKGROUND WINDOW) VALUE)
ChangeWindowAttributes (SETF (WINDOW-BACKING-PIXEL WINDOW) VALUE)
ChangeWindowAttributes (SETF (WINDOW-BACKING-PLANES WINDOW) VALUE)
ChangeWindowAttributes (SETF (WINDOW-BACKING-STORE WINDOW) VALUE)
ChangeWindowAttributes (SETF (WINDOW-BIT-GRAVITY WINDOW) VALUE)
ChangeWindowAttributes (SETF (WINDOW-BORDER WINDOW) VALUE)
ChangeWindowAttributes (SETF (WINDOW-COLORMAP WINDOW) VALUE)
ChangeWindowAttributes (SETF (WINDOW-CURSOR WINDOW) VALUE)
ChangeWindowAttributes (SETF (WINDOW-DO-NOT-PROPAGATE-MASK WINDOW) VALUE)
ChangeWindowAttributes (SETF (WINDOW-EVENT-MASK WINDOW) VALUE)
ChangeWindowAttributes (SETF (WINDOW-GRAVITY WINDOW) VALUE)
ChangeWindowAttributes (SETF (WINDOW-OVERRIDE-REDIRECT WINDOW) VALUE)
ConfigureWindow (SETF (WINDOW-PRIORITY WINDOW &OPTIONAL SIBLING) INTEGER)
ChangeWindowAttributes (SETF (WINDOW-SAVE-UNDER WINDOW) VALUE)
;; Here's a list of the CLX functions that don't directly correspond to
;; X Window System requests. The've been categorized by function:
;Display Management
CLOSE-DISPLAY
CLOSE-DOWN-MODE
DISPLAY-AFTER-FUNCTION ;; SETF'able
DISPLAY-FINISH-OUTPUT
DISPLAY-FORCE-OUTPUT
DISPLAY-INVOKE-AFTER-FUNCTION
OPEN-DISPLAY
WITH-DISPLAY
WITH-EVENT-QUEUE
;Extensions
DECLARE-EVENT
DECODE-CORE-ERROR
DEFAULT-ERROR-HANDLER
DEFINE-CONDITION
DEFINE-ERROR
DEFINE-EXTENSION
DEFINE-GCONTEXT-ACCESSOR
EXTENSION-OPCODE
;Events
EVENT-CASE
EVENT-LISTEN
MAPPING-NOTIFY
PROCESS-EVENT
EVENT-HANDLER
MAKE-EVENT-HANDLERS
QUEUE-EVENT
;Image
COPY-IMAGE
CREATE-IMAGE
GET-IMAGE
IMAGE-BLUE-MASK
IMAGE-DEPTH
IMAGE-GREEN-MASK
IMAGE-HEIGHT
IMAGE-NAME
IMAGE-PIXMAP
IMAGE-PLIST
IMAGE-RED-MASK
IMAGE-WIDTH
IMAGE-X-HOT
IMAGE-Y-HOT
PUT-IMAGE
READ-BITMAP-FILE
WRITE-BITMAP-FILE
;Keysyms
CHARACTER->KEYSYMS
CHARACTER-IN-MAP-P
DEFAULT-KEYSYM-INDEX
DEFAULT-KEYSYM-TRANSLATE
DEFINE-KEYSYM
DEFINE-KEYSYM-SET
KEYCODE->CHARACTER
KEYCODE->KEYSYM
KEYSYM
KEYSYM->CHARACTER
KEYSYM-IN-MAP-P
KEYSYM-SET
UNDEFINE-KEYSYM
;Properties
CUT-BUFFER
GET-STANDARD-COLORMAP
GET-WM-CLASS
ICON-SIZES
MAKE-WM-HINTS
MAKE-WM-SIZE-HINTS
ROTATE-CUT-BUFFERS
SET-STANDARD-COLORMAP
SET-WM-CLASS
TRANSIENT-FOR
WM-CLIENT-MACHINE
WM-COMMAND
WM-HINTS
WM-HINTS-FLAGS
WM-HINTS-ICON-MASK
WM-HINTS-ICON-PIXMAP
WM-HINTS-ICON-WINDOW
WM-HINTS-ICON-X
WM-HINTS-ICON-Y
WM-HINTS-INITIAL-STATE
WM-HINTS-INPUT
WM-HINTS-P
WM-HINTS-WINDOW-GROUP
WM-ICON-NAME
WM-NAME
WM-NORMAL-HINTS
WM-SIZE-HINTS-HEIGHT
WM-SIZE-HINTS-HEIGHT-INC
WM-SIZE-HINTS-MAX-ASPECT
WM-SIZE-HINTS-MAX-HEIGHT
WM-SIZE-HINTS-MAX-WIDTH
WM-SIZE-HINTS-MIN-ASPECT
WM-SIZE-HINTS-MIN-HEIGHT
WM-SIZE-HINTS-MIN-WIDTH
WM-SIZE-HINTS-P
WM-SIZE-HINTS-USER-SPECIFIED-POSITION-P
WM-SIZE-HINTS-USER-SPECIFIED-SIZE-P
WM-SIZE-HINTS-WIDTH
WM-SIZE-HINTS-WIDTH-INC
WM-SIZE-HINTS-X
WM-SIZE-HINTS-Y
WM-ZOOM-HINTS
;Misc.
MAKE-COLOR
MAKE-EVENT-KEYS
MAKE-EVENT-MASK
MAKE-RESOURCE-DATABASE
MAKE-STATE-KEYS
MAKE-STATE-MASK
DISCARD-FONT-INFO
TRANSLATE-DEFAULT
;Structures
BITMAP-FORMAT-LSB-FIRST-P
BITMAP-FORMAT-P
BITMAP-FORMAT-PAD
BITMAP-FORMAT-UNIT
BITMAP-IMAGE
COLOR-BLUE
COLOR-GREEN
COLOR-P
COLOR-RED
COLOR-RGB
COLORMAP-DISPLAY
COLORMAP-EQUAL
COLORMAP-ID
COLORMAP-P
COLORMAP-VISUAL-INFO
CURSOR-DISPLAY
CURSOR-EQUAL
CURSOR-ID
CURSOR-P
DRAWABLE-DISPLAY
DRAWABLE-EQUAL
DRAWABLE-ID
DRAWABLE-P
FONT-DISPLAY
FONT-EQUAL
FONT-ID
FONT-MAX-BOUNDS
FONT-MIN-BOUNDS
FONT-P
FONT-PLIST
GCONTEXT-DISPLAY
GCONTEXT-EQUAL
GCONTEXT-ID
GCONTEXT-P
GCONTEXT-PLIST
DISPLAY-AUTHORIZATION-DATA
DISPLAY-AUTHORIZATION-NAME
DISPLAY-BITMAP-FORMAT
DISPLAY-BYTE-ORDER
DISPLAY-DEFAULT-SCREEN
DISPLAY-DISPLAY
DISPLAY-ERROR-HANDLER
DISPLAY-IMAGE-LSB-FIRST-P
DISPLAY-KEYCODE-RANGE
DISPLAY-MAX-KEYCODE
DISPLAY-MAX-REQUEST-LENGTH
DISPLAY-MIN-KEYCODE
DISPLAY-MOTION-BUFFER-SIZE
DISPLAY-NSCREENS
DISPLAY-P
DISPLAY-PIXMAP-FORMATS
DISPLAY-PLIST
DISPLAY-PROTOCOL-MAJOR-VERSION
DISPLAY-PROTOCOL-MINOR-VERSION
DISPLAY-PROTOCOL-VERSION
DISPLAY-RELEASE-NUMBER
DISPLAY-RESOURCE-ID-BASE
DISPLAY-RESOURCE-ID-MASK
DISPLAY-ROOTS
DISPLAY-SQUISH
DISPLAY-VENDOR
DISPLAY-VENDOR-NAME
DISPLAY-VERSION-NUMBER
DISPLAY-XDEFAULTS
DISPLAY-XID
PIXMAP-DISPLAY
PIXMAP-EQUAL
PIXMAP-FORMAT-BITS-PER-PIXEL
PIXMAP-FORMAT-DEPTH
PIXMAP-FORMAT-P
PIXMAP-FORMAT-SCANLINE-PAD
PIXMAP-ID
PIXMAP-P
PIXMAP-PLIST
SCREEN-BACKING-STORES
SCREEN-BLACK-PIXEL
SCREEN-DEFAULT-COLORMAP
SCREEN-DEPTHS
SCREEN-EVENT-MASK-AT-OPEN
SCREEN-HEIGHT
SCREEN-HEIGHT-IN-MILLIMETERS
SCREEN-MAX-INSTALLED-MAPS
SCREEN-MIN-INSTALLED-MAPS
SCREEN-P
SCREEN-PLIST
SCREEN-ROOT
SCREEN-ROOT-DEPTH
SCREEN-ROOT-VISUAL-INFO
SCREEN-SAVE-UNDERS-P
SCREEN-WHITE-PIXEL
SCREEN-WIDTH
SCREEN-WIDTH-IN-MILLIMETERS
VISUAL-INFO
VISUAL-INFO-BITS-PER-RGB
VISUAL-INFO-BLUE-MASK
VISUAL-INFO-CLASS
VISUAL-INFO-COLORMAP-ENTRIES
VISUAL-INFO-GREEN-MASK
VISUAL-INFO-ID
VISUAL-INFO-P
VISUAL-INFO-PLIST
VISUAL-INFO-RED-MASK
WINDOW-DISPLAY
WINDOW-EQUAL
WINDOW-ID
WINDOW-P
WINDOW-PLIST
|